diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 74a7f9f..cc87ee2 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -19,3 +19,18 @@ export function inline(_: CSSObject): StylexAttrsParamter { export function id(_?: string): string { throw new Error('`id` calls should be compiled away.') } + +function createWhenAPI(errorMessage: string) { + return (selector: string, pseudo?: string) => { + throw new Error(errorMessage) + } +} + +export const when = { + // a b + ancestor: createWhenAPI("'when.ancestor' calls should be compiled away."), + // a:has(b) + descendent: createWhenAPI("'when.descendent' calls should be compiled away."), + // a + b + sibling: createWhenAPI("'when.sibling' calls should be compiled away.") +}