Skip to content

Commit

Permalink
chore: init when
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Jan 14, 2025
1 parent b4ff71a commit ca3b9ba
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}

0 comments on commit ca3b9ba

Please sign in to comment.