foldkit-mixins 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -324,7 +324,7 @@ one.
324
324
  | `Style.when(condition, piece)` | a boolean known at authoring time |
325
325
  | `Style.whenInput(predicate, piece)` | a condition read from the view input at render time |
326
326
  | `Style.recipe({ base, variants, defaults, compound })` | one slot: returns `selection => StyleValue`; every field is optional, so a recipe may be only its base |
327
- | `Style.recipeFor(Slots)({ base, variants, defaults, compound })` | every slot: returns `selection => RecipePieces`, in which every `base` slot is present and a variant's slot may be absent; `null` unsets a defaulted axis, which is how a recipe makes a piece optional; `.extend(patch)` composes per slot, removes nothing, and refuses a slot the contract lacks; `.add(more)` gives it an axis or a value it lacks ([A look a shipped recipe lacks](#a-look-a-shipped-recipe-lacks)) |
327
+ | `Style.recipeFor(Slots)({ base, variants, defaults, compound })` | every slot: returns `selection => RecipePieces`, in which every `base` slot is present and a variant's slot may be absent; `null` unsets a defaulted axis, which is how a recipe makes a piece optional; `.extend(patch)` composes per slot, removes nothing, and refuses a slot the contract lacks; `.add(more)` gives it an axis or a value it lacks ([A look a shipped recipe lacks](#a-look-a-shipped-recipe-lacks)); `.style(selection?, options?)` is `Style.forSlots(Slots)(recipe(selection), options)` in one call, the `NamedStyle` a view's `style` takes |
328
328
  | `Style.perItem(item => piece)` / `Style.stagger({ stepMs })` | a piece from the item the slot is rendered for (`attrs(base, item)`); stagger writes `--fk-index` inline and the `calc` delay as a rule |
329
329
  | `Style.forCapability(Slots)(capability, piece)` | one piece for every public slot whose capability satisfies it |
330
330
  | `Style.slots(pieces, options?)` / `Style.slot(slotOptions, piece)` | an application's own Slots declared by their style: `{ slots, style }` (see [An application's own look](#an-applications-own-look)) |
@@ -429,8 +429,8 @@ it in two ways, and neither forks it:
429
429
  - `.add(more)` gives it what it **lacks**: a value on an axis it has, or a new axis. A value
430
430
  the axis already has is refused, in the type and with `mixins:recipe-value-exists`.
431
431
 
432
- Both return a recipe, so `.extend`, `.add` and a `null` selection work on the result, and
433
- neither changes the recipe it was called on.
432
+ Both return a recipe, so `.extend`, `.add`, `.style` and a `null` selection work on the
433
+ result, and neither changes the recipe it was called on.
434
434
 
435
435
  ```ts standalone
436
436
  import { Capability, Slot, Slots, Style } from 'foldkit-mixins'
@@ -457,8 +457,11 @@ const AppButton = Button.add({
457
457
  width: { full: { button: Style.self({ inlineSize: '100%' }) } },
458
458
  })
459
459
 
460
- export const Brand = Style.forSlots(ButtonSlots)(AppButton({ tone: 'brand', width: 'full' }))
461
- export const Accent = Style.forSlots(ButtonSlots)(AppButton())
460
+ // `.style` selects and makes the view's Style in one call; `.style()` is the defaults.
461
+ export const Brand = AppButton.style({ tone: 'brand', width: 'full' })
462
+ export const Accent = AppButton.style()
463
+ // The same in two calls, for when the pieces are composed first.
464
+ export const Spelled = Style.forSlots(ButtonSlots)(AppButton({ tone: 'brand', width: 'full' }))
462
465
 
463
466
  // @ts-expect-error `accent` is the recipe's own: adjust it with `extend`.
464
467
  Button.add({ tone: { accent: { button: Style.self({ background: 'navy' }) } } })
@@ -912,6 +915,7 @@ that case the contract, the style and the setup can each be written once:
912
915
  | You are... | Use |
913
916
  | --- | --- |
914
917
  | styling a contract someone published | `Style.forSlots(ButtonSlots)(pieces, options)` |
918
+ | taking a published recipe's look as it ships | `Recipes.Button.style(selection, options)` |
915
919
  | declaring your own Slots and their look | `Style.slots(pieces, options)` |
916
920
  | fixing theme, `app` layer and page sheet for one application | `AppStyle.make` from `foldkit-mixins/app` |
917
921
  | writing a token-backed declaration in a word | `Utilities` from `foldkit-mixins/utilities` |
@@ -946,7 +950,10 @@ Style.install(stylesheet)
946
950
  ```
947
951
 
948
952
  A published contract takes the same layer through the kit's `forSlots`, as
949
- `forSlots(ButtonSlots)(Recipes.Button())` with `foldkit-mixins-ui`.
953
+ `forSlots(ButtonSlots)(Recipes.Button())` with `foldkit-mixins-ui`, and a recipe's `.style`
954
+ takes it as an option: `Recipes.Button.style({}, { layer: L.layer('app') })`, with `L` from
955
+ `AppStyle.make`. The shipped pieces keep their `components` and `variants` layers either way;
956
+ the layer places what the application's own `.extend` added with none.
950
957
 
951
958
  What each call does, and does not do:
952
959
 
package/dist/style.d.ts CHANGED
@@ -156,6 +156,12 @@ export interface SlotRecipe<Slots, Variants extends SlotRecipeVariants<Slots>, K
156
156
  * axis has no default; `extend` gives it one.
157
157
  */
158
158
  readonly add: <const More extends AxisNames>(more: AddedAxes<Slots, Variants, More>) => SlotRecipe<Slots, MergeAxes<Slots, Variants, More>, Known>;
159
+ /**
160
+ * A selection as a style of the recipe's contract, ready for a view's
161
+ * `style`: `Style.forSlots(slots)(recipe(selection), options)` in one call.
162
+ * With no selection, the defaults.
163
+ */
164
+ readonly style: (selection?: SlotRecipeSelection<Variants>, options?: StyleOptions) => NamedStyle<Slots>;
159
165
  }
160
166
  /** The axes and value names `add` was given; what each value holds is `StylePieces`. */
161
167
  type AxisNames = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
@@ -170,7 +176,8 @@ export type MergeAxes<Slots, Variants, More> = { readonly [A in keyof Variants |
170
176
  /**
171
177
  * A recipe over every slot of a contract: `base` pieces per slot, `variants`
172
178
  * per axis and value, `defaults`, and `compound` matches. The result of a
173
- * selection is a `StylePieces` for `Style.forSlots`. A design system ships
179
+ * selection is a `StylePieces` for `Style.forSlots`; `.style(selection)` is
180
+ * that `NamedStyle` in one call. A design system ships
174
181
  * the recipe; an application adjusts it with `extend` instead of forking.
175
182
  */
176
183
  export declare const recipeFor: <Slots>(slots: Slots) => <Variants extends SlotRecipeVariants<Slots> = {}, Base extends StylePieces<Slots> = {}>(def: SlotRecipeDef<Slots, Variants> & {
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","names":["Piece","StyleValue","MixinValue","SlotView","SlotsContract"],"sources":["../src/style.ts"],"mappings":";;;;;;;;;;YA6DY,YAAY,SAAS,aAAa,OAAOA;KAEhD,aAAa,OAAO,q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B,mBAAmB,cAAc,oCACjC,qBAAqB,cAAc,gCAA8B,SAE9D,KACP,YAAY,GAAG,QAAQ,YAAY,8FAEpC,QACMA,YACN,UAAU,YAAY,GAAG,QAAQ,YAAY;;YAUpC,eAAe,iBAAiB,WAAW,IAAIA,UAAQ,UAAU,EAAE;;YAGnE,cAAc,KAAKI,qBACnB,WAAW,IAAI,EAAE,WAAW,cAAc,EAAE,KAAK;;iBAI5C,SAAS;WACf,OAAO,cAAc;WACrB,OAAO,WAAW,cAAc;;;;;;;;;qBAU9B,QAAS,GAAC,QAAU,eAAe,IAAE,UAAY,iBAAe,SAAS;;;;;;;qBAyBzE,UAAO,gBAAkB;qBAgBzB"}
package/dist/style.js CHANGED
@@ -292,7 +292,8 @@ const assertKnownSlots = (slots, pieces, where) => {
292
292
  /**
293
293
  * A recipe over every slot of a contract: `base` pieces per slot, `variants`
294
294
  * per axis and value, `defaults`, and `compound` matches. The result of a
295
- * selection is a `StylePieces` for `Style.forSlots`. A design system ships
295
+ * selection is a `StylePieces` for `Style.forSlots`; `.style(selection)` is
296
+ * that `NamedStyle` in one call. A design system ships
296
297
  * the recipe; an application adjusts it with `extend` instead of forking.
297
298
  */
298
299
  const recipeFor = (slots) => (def) => {
@@ -359,10 +360,12 @@ const recipeFor = (slots) => (def) => {
359
360
  variants
360
361
  });
361
362
  };
363
+ const style = (selection, options) => forSlots(slots)(select(selection), options);
362
364
  return Object.assign(select, {
363
365
  def: full,
364
366
  extend,
365
- add
367
+ add,
368
+ style
366
369
  });
367
370
  };
368
371
  /**
package/dist/style.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","names":["Mixin","SlotView","defineSlots"],"sources":["../src/style.ts"],"sourcesContent":["/**\n * `Style` is pure data: class tokens and inline declarations that compile to a\n * `SlotContribution`. It never touches the DOM and never mutates state.\n * `forSlots` validates piece keys against the published contract at definition\n * time, so a typo fails loudly. The builders themselves live in\n * `styleValue.ts`; this module joins them to slots.\n */\nimport * as Capability from './capability.js'\nimport { declaredNames, isUnordered, layerOf, topLevelBlocks } from './cssBlocks.js'\nimport type { InputContribution, SlotContribution } from './contribution.js'\nimport { DiagnosticError } from './diagnostics.js'\nimport { own } from './record.js'\nimport * as Mixin from './mixin.js'\nimport type { Mixin as MixinValue, MixinMeta, SlotMeta } from './mixin.js'\nimport * as SlotModule from './slot.js'\nimport type {\n Any as AnySlot,\n AttributeName,\n EventName,\n HiddenOf,\n MakeOptions,\n RequirementName,\n SlotCapability,\n UnnamedSlot,\n} from './slot.js'\nimport { define as defineSlots, type Contract as SlotsContract } from './slots.js'\nimport type { Placement } from './layers.js'\nimport type { SlotItem } from './slotItem.js'\nimport * as SlotView from './slotView.js'\nimport { complete, register, usedDrawn, usedIn } from './inject.js'\nimport * as Rules from './styleRules.js'\nimport {\n allowDiscrete,\n classPiece,\n compose,\n at,\n container,\n empty,\n enter,\n global,\n grid,\n inline,\n keyframes,\n media,\n nest,\n pseudo,\n responsive,\n self,\n states,\n supports,\n vars,\n viewTransitionName,\n make,\n toStyleValue,\n type Piece,\n type StyleValue,\n} from './styleValue.js'\n\nexport type { Piece, StyleCondition, StyleValue } from './styleValue.js'\n\n/** A hidden slot is internal: it is neither styleable nor behavior-targetable. */\nexport type StylePieces<Slots> = PublicPieces<Slots, Piece>\n\ntype PublicPieces<Slots, Value> = {\n readonly [K in keyof Slots as HiddenOf<Slots[K]> extends true ? never : K]?: Value\n}\n\n/** `StylePieces` with every piece a `StyleValue`, as a recipe or a `NamedStyle` gives them. */\nexport type StyleValues<Slots> = PublicPieces<Slots, StyleValue>\n\nexport interface NamedStyle<Slots> {\n /**\n * Type only, never set: the slot names this style may hold. Every key of\n * `pieces` is optional, so two contracts sharing one slot name would accept\n * each other's styles; this makes a style assignable only where the contract\n * asked for names every slot the style's own contract has.\n */\n readonly '~slots'?: keyof PublicPieces<Slots, never>\n readonly name?: string\n /** Each piece as compiled, placed in the `layer` when one was given. */\n readonly pieces: StyleValues<Slots>\n readonly mixin: MixinValue<never>\n /** Concatenated rule CSS for every static piece. */\n readonly css: string\n /** Concatenated class-independent CSS (keyframes, layers, global rules). */\n readonly globalCss: string\n /** One entry per generated class, for a deduplicating stylesheet. */\n readonly rules: ReadonlyArray<{ readonly className: string; readonly css: string }>\n /** Class-independent rule chunks, for a deduplicating stylesheet. */\n readonly globalRules: ReadonlyArray<string>\n}\n\nexport interface StyleOptions {\n readonly name?: string\n /**\n * The layer every piece is placed in before compiling, e.g.\n * `Layers.standard.layer('app')`. A rule already in a layer keeps it.\n */\n readonly layer?: Placement\n}\n\n/** A boolean known at authoring time. */\nexport const when = (condition: boolean, piece: Piece): StyleValue =>\n condition ? toStyleValue(piece) : empty\n\n/** A condition read from the view input at render time. The piece applies when\n * `predicate` returns true for the input the view was rendered with. */\nexport const whenInput = <Input>(predicate: (input: Input) => boolean, piece: Piece): StyleValue =>\n make({\n // Kept as given, not wrapped: a frozen style module (`viteFreeze.ts`) finds the predicate's import by its identity.\n conditions: Object.freeze([\n { predicate: predicate as (input: unknown) => boolean, piece: toStyleValue(piece) },\n ]),\n })\n\n/**\n * A piece computed from the item the slot is rendered for, when the view\n * passes one to `attrs(base, item)`; nothing for a slot rendered once.\n */\nexport const perItem = (piece: (item: SlotItem) => Piece): StyleValue =>\n make({\n items: Object.freeze([\n (item: SlotItem | undefined) => (item === undefined ? empty : toStyleValue(piece(item))),\n ]),\n })\n\n/**\n * A per-item delay for an entrance: writes `--fk-index` and\n * `transition-delay: calc(var(--fk-index) * <step>)` (or `animation-delay`),\n * so a list staggers with no timer. Pass the item to `attrs` for each row.\n */\nexport const stagger = (options: {\n readonly stepMs: number\n readonly property?: 'transitionDelay' | 'animationDelay'\n}): StyleValue =>\n compose(\n // The delay is a rule; only the index is the item's own, inline.\n self({\n [options.property ?? 'transitionDelay']: `calc(var(--fk-index) * ${options.stepMs}ms)`,\n }),\n perItem(item => inline({ '--fk-index': String(item.index) })),\n )\n\n/** Fold every active condition and item piece (recursively) into a plain style. */\nconst resolveStyle = (style: StyleValue, input: unknown, item?: SlotItem): StyleValue => {\n const active = [\n ...(style.conditions ?? [])\n .filter(condition => condition.predicate(input))\n .map(condition => condition.piece),\n ...(style.items ?? []).map(piece => piece(item)),\n ].map(piece => resolveStyle(piece, input, item))\n return make({\n classes: Object.freeze([...style.classes, ...active.flatMap(piece => piece.classes)]),\n style: Object.freeze(\n Object.assign(Object.create(null), style.style, ...active.map(piece => piece.style)),\n ),\n })\n}\n\ninterface CompiledStyle {\n readonly classes: ReadonlyArray<string>\n readonly style: Readonly<Record<string, string>>\n readonly css?: string\n readonly ruleClass?: string\n readonly globalRules?: ReadonlyArray<string>\n /** Every class the tree compiled to, with its CSS, static or conditional. */\n readonly compiled: ReadonlyArray<{ readonly className: string; readonly css: string }>\n}\n\n/** Global CSS is emitted whether or not its condition is active. */\nconst collectGlobalCss = (style: StyleValue): ReadonlyArray<string> => [\n ...(style.globalCss ?? []),\n ...(style.conditions ?? []).flatMap(condition => collectGlobalCss(condition.piece)),\n]\n\n/**\n * Compiles every rule-bearing node in the tree to its class: the node's\n * classes gain the generated one, and the CSS is collected. A conditional\n * piece's rules are compiled the same way, so the class is static and only\n * its presence follows the input.\n */\nconst compileTree = (\n style: StyleValue,\n globalCss: string,\n collected: Array<{ readonly className: string; readonly css: string }>,\n): StyleValue => {\n const rules = style.rules ?? []\n const generated = rules.length === 0 ? undefined : Rules.className(rules)\n if (generated !== undefined) {\n const css = Rules.css(generated, rules)\n register(generated, css, globalCss)\n collected.push({ className: generated, css })\n }\n const conditions = (style.conditions ?? []).map(condition => ({\n predicate: condition.predicate,\n piece: compileTree(condition.piece, globalCss, collected),\n }))\n return Object.freeze({\n ...style,\n classes: generated === undefined ? style.classes : Object.freeze([...style.classes, generated]),\n ...(conditions.length === 0 ? {} : { conditions: Object.freeze(conditions) }),\n })\n}\n\n/** A style with every rule in it compiled: the tree with classes, plus the CSS. */\nconst compileStyle = (style: StyleValue): CompiledStyle & { readonly tree: StyleValue } => {\n const collected: Array<{ readonly className: string; readonly css: string }> = []\n const globalRules = collectGlobalCss(style)\n // Every class the Style compiles to carries its globals, so a server that\n // finds any one of them in markup writes what the Style needs.\n const tree = compileTree(style, globalRules.join(''), collected)\n const first = collected[0]\n return {\n tree,\n classes: tree.classes,\n style: tree.style,\n ...(first === undefined\n ? {}\n : { css: collected.map(entry => entry.css).join(''), ruleClass: first.className }),\n ...(globalRules.length === 0 ? {} : { globalRules }),\n compiled: collected,\n }\n}\n\n/**\n * A static style stays static data; a style with input conditions compiles to a\n * message-free `InputContribution`, so it still attaches to any view.\n */\nconst contributionFrom = (\n style: StyleValue,\n compiled: CompiledStyle & { readonly tree: StyleValue },\n): SlotContribution<never> => {\n const globalCss = compiled.globalRules?.join('')\n const attributes = {\n classes: compiled.classes,\n style: compiled.style,\n ...(compiled.css === undefined ? {} : { css: compiled.css }),\n ...(globalCss === undefined ? {} : { globalCss }),\n }\n if ((style.conditions ?? []).length === 0 && (style.items ?? []).length === 0) {\n return Object.freeze(attributes)\n }\n const contribution: InputContribution<never> = context => {\n const resolved = resolveStyle(compiled.tree, context.input, context.item)\n return Object.freeze({\n classes: resolved.classes,\n style: resolved.style,\n ...(compiled.css === undefined ? {} : { css: compiled.css }),\n ...(globalCss === undefined ? {} : { globalCss }),\n })\n }\n return contribution\n}\n\nconst NOTHING_REQUIRED = Object.freeze({ events: Object.freeze([]), attributes: Object.freeze([]) })\n\n/** A Style asks nothing of a slot and supplies nothing; a piece may read the input. */\nconst styleMeta = (contributions: Record<string, SlotContribution<never>>): MixinMeta => {\n const slots: Record<string, SlotMeta> = Object.create(null)\n for (const [slot, contribution] of Object.entries(contributions)) {\n slots[slot] = Object.freeze({\n requires: NOTHING_REQUIRED,\n provides: Object.freeze([]),\n reads: Mixin.isDynamic(contribution) ? 'input' : 'static',\n })\n }\n return Object.freeze({ kind: 'style', slots: Object.freeze(slots) })\n}\n\nexport const forSlots =\n <Slots>(slots: Slots) =>\n (pieces: StylePieces<Slots>, options?: StyleOptions): NamedStyle<Slots> => {\n const known = slots as unknown as Record<string, unknown>\n const contributions: Record<string, SlotContribution<never>> = Object.create(null)\n // What was compiled, so `pieces` recomposed elsewhere keeps the layer too.\n const compiledPieces: Record<string, StyleValue> = Object.create(null)\n const rules: Array<{ className: string; css: string }> = []\n const globalRules: Array<string> = []\n let css = ''\n let globalCss = ''\n for (const [key, piece] of Object.entries(pieces as Record<string, Piece | undefined>)) {\n if (!Object.hasOwn(known, key)) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:unknown-slot',\n severity: 'error',\n message: `Style targets unknown slot \"${key}\"`,\n slot: key,\n })\n }\n if ((known[key] as { readonly hidden?: boolean } | undefined)?.hidden === true) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:hidden-slot',\n severity: 'error',\n message: `Style targets hidden slot \"${key}\"`,\n slot: key,\n })\n }\n if (piece !== undefined) {\n const value = toStyleValue(piece)\n const placed = options?.layer === undefined ? value : options.layer.place(value)\n compiledPieces[key] = placed\n // Rule and global CSS are static even when the contribution is deferred,\n // so compile once, then build the contribution and gather the CSS.\n const compiled = compileStyle(placed)\n contributions[key] = contributionFrom(placed, compiled)\n for (const entry of compiled.compiled) {\n rules.push(entry)\n css += entry.css\n }\n if (compiled.globalRules !== undefined) {\n globalRules.push(...compiled.globalRules)\n globalCss += compiled.globalRules.join('')\n }\n }\n }\n return Object.freeze({\n ...(options?.name === undefined ? {} : { name: options.name }),\n pieces: compiledPieces,\n mixin: Mixin.dynamic<never>(\n options?.name ?? 'Style',\n contributions,\n styleMeta(contributions),\n ),\n css,\n globalCss,\n rules: Object.freeze(rules),\n globalRules: Object.freeze(globalRules),\n })\n }\n\nexport interface StylesheetSource {\n readonly rules: ReadonlyArray<{ readonly className: string; readonly css: string }>\n readonly globalRules: ReadonlyArray<string>\n}\n\nconst isStylesheetSource = (value: StyleValue | StylesheetSource): value is StylesheetSource =>\n 'globalRules' in value\n\nconst LAYER_STATEMENT = /^@layer [^{}]+;$/\n\nconst sourceOf = (style: StyleValue): StylesheetSource => {\n const compiled = compileStyle(style)\n return { rules: compiled.compiled, globalRules: compiled.globalRules ?? [] }\n}\n\n/**\n * An unlayered rule beats every layer, `app` included, so once a sheet\n * declares an order, a rule outside it, or in a layer the order does not\n * name (which would sort after the last one), is a mistake. Keyframes, font\n * faces, and registered properties are not ordered by the cascade and pass.\n */\nconst refuseUnlayered = (\n css: string,\n names: ReadonlyArray<string>,\n where: string,\n className?: string,\n): void => {\n for (const block of topLevelBlocks(css)) {\n if (isUnordered(block)) continue\n const layer = layerOf(block)\n if (layer !== undefined && names.includes(layer)) continue\n throw new DiagnosticError({\n source: 'style',\n code: 'style:unlayered-rule',\n severity: 'error',\n message:\n layer === undefined\n ? `Style.stylesheet declares a layer order, but ${where} has a rule outside it, which would beat every layer; place its piece with L.in(name, …)`\n : `${where} is in layer \"${layer}\", which the declared order (${names.join(', ')}) does not name, so it would sort after \"${names.at(-1)}\"; place it with L.in(name, …)`,\n details: {\n ...(className === undefined ? {} : { className }),\n ...(layer === undefined ? {} : { layer }),\n },\n })\n }\n}\n\n/**\n * One `<style>` block: the `@layer …;` statement first (one order per\n * sheet), then the other global chunks, then the scoped classes, each\n * deduplicated with the first seen winning. A bare `StyleValue` (a theme\n * root, a layered reset, a layout) compiles like a piece of a `NamedStyle`.\n * With an order declared, every rule must sit in one of its layers\n * (`style:unlayered-rule`); without one, unlayered rules are allowed.\n */\nexport const stylesheet = (...styles: ReadonlyArray<StyleValue | StylesheetSource>): string => {\n const scoped = new Map<string, string>()\n const global = new Set<string>()\n let order: string | undefined\n for (const style of styles) {\n const source = isStylesheetSource(style) ? style : sourceOf(style)\n for (const rule of source.rules) {\n if (!scoped.has(rule.className)) scoped.set(rule.className, rule.css)\n }\n for (const rule of source.globalRules) {\n if (!LAYER_STATEMENT.test(rule)) {\n global.add(rule)\n } else if (order === undefined) {\n order = rule\n } else if (order !== rule) {\n throw new DiagnosticError({\n source: 'style',\n code: 'style:conflicting-layer-order',\n severity: 'error',\n message: `Style.stylesheet was given two layer orders: \"${order}\" and \"${rule}\"`,\n })\n }\n }\n }\n if (order !== undefined) {\n const names = declaredNames(order)\n for (const chunk of global) refuseUnlayered(chunk, names, `global CSS \"${chunk.slice(0, 60)}\"`)\n for (const [className, css] of scoped) {\n refuseUnlayered(css, names, `class \"${className}\"`, className)\n }\n }\n return [...(order === undefined ? [] : [order]), ...global, ...scoped.values()].join('')\n}\n\nexport const attach =\n <Slots>(style: NamedStyle<Slots>) =>\n <ViewSlots, Input, Message, Provides extends string = never>(\n view: SlotView.SlotView<ViewSlots, Input, Message, Provides>,\n ): SlotView.SlotView<ViewSlots, Input, Message, Provides> =>\n SlotView.attach(style.mixin)(view)\n\nexport type RecipeVariantDef = Readonly<Record<string, StyleValue>>\n\n/** A combination style applied when every `when` entry matches the selection. */\nexport interface RecipeCompound<Variants extends Readonly<Record<string, RecipeVariantDef>>> {\n readonly when: Partial<{ readonly [K in keyof Variants]: keyof Variants[K] & string }>\n readonly style: StyleValue\n}\n\nexport interface RecipeDef<Variants extends Readonly<Record<string, RecipeVariantDef>>> {\n readonly base?: StyleValue\n /** Absent for a recipe that is only its base. */\n readonly variants?: Variants\n readonly defaults?: { readonly [K in keyof Variants]?: keyof Variants[K] & string }\n readonly compound?: ReadonlyArray<RecipeCompound<Variants>>\n}\n\nexport type AnyRecipeDef = RecipeDef<Record<string, RecipeVariantDef>>\n\n/**\n * The selection of a recipe with no axes. An empty mapped type is `{}`, and\n * TypeScript checks no excess keys against `{}`, so `{ tone: 'quiet' }`\n * compiled and did nothing.\n */\ntype NoAxes = { readonly [key: string]: never }\n\nexport type RecipeSelection<D extends AnyRecipeDef> = [keyof NonNullable<D['variants']>] extends [\n never,\n]\n ? NoAxes\n : {\n readonly [K in keyof NonNullable<D['variants']>]?: keyof NonNullable<D['variants']>[K] &\n string\n }\n\n/** A recipe is just Style data: base, one piece per selected variant, then any\n * matching compound. `compound.when` is keyed by the recipe's variants, so a\n * typo is a compile error rather than a silently dead combination. */\nexport const recipe =\n <Variants extends Readonly<Record<string, RecipeVariantDef>> = {}>(def: RecipeDef<Variants>) =>\n (selection: RecipeSelection<RecipeDef<Variants>>): StyleValue => {\n const pieces: Array<StyleValue> = []\n if (def.base !== undefined) pieces.push(def.base)\n const effective: Record<string, string> = Object.create(null)\n for (const [variant, values] of Object.entries(def.variants ?? {})) {\n const chosen =\n own(selection as Record<string, string | undefined>, variant) ??\n (def.defaults as Record<string, string | undefined> | undefined)?.[variant]\n if (chosen === undefined) continue\n effective[variant] = chosen\n const piece = (values as Record<string, StyleValue>)[chosen]\n if (piece !== undefined) pieces.push(piece)\n }\n for (const compound of def.compound ?? []) {\n if (Object.entries(compound.when).every(([variant, value]) => effective[variant] === value)) {\n pieces.push(compound.style)\n }\n }\n return compose(...pieces)\n }\n\nexport type SlotRecipeVariants<Slots> = Readonly<\n Record<string, Readonly<Record<string, StylePieces<Slots>>>>\n>\n\nexport interface SlotRecipeDef<Slots, Variants extends SlotRecipeVariants<Slots>> {\n readonly base?: StylePieces<Slots>\n /** Absent for a recipe that is only its base. */\n readonly variants?: Variants\n readonly defaults?: { readonly [K in keyof Variants]?: keyof Variants[K] & string }\n readonly compound?: ReadonlyArray<{\n readonly when: Partial<{ readonly [K in keyof Variants]: keyof Variants[K] & string }>\n readonly style: StylePieces<Slots>\n }>\n}\n\n/** A selection; `null` unsets an axis that has a default. */\nexport type SlotRecipeSelection<Variants> = [keyof Variants] extends [never]\n ? NoAxes\n : { readonly [K in keyof Variants]?: (keyof Variants[K] & string) | null }\n\nexport interface SlotRecipePatch<Slots, Variants extends SlotRecipeVariants<Slots>> {\n readonly base?: StylePieces<Slots>\n readonly variants?: {\n readonly [K in keyof Variants]?: { readonly [V in keyof Variants[K]]?: StylePieces<Slots> }\n }\n readonly defaults?: SlotRecipeDef<Slots, Variants>['defaults']\n readonly compound?: SlotRecipeDef<Slots, Variants>['compound']\n}\n\n/**\n * What a selection gives: `StyleValues`, with each slot `Known` names\n * present. A recipe's base pieces are in every selection; a variant's or a\n * compound's are not, since `null` or another value can leave them out.\n */\nexport type RecipePieces<Slots, Known extends PropertyKey = never> = StyleValues<Slots> & {\n readonly [K in Known]: StyleValue\n}\n\n/** The keys of `T` that always hold a value: a base typed `StylePieces` names none. */\ntype PresentKeys<T> = Exclude<\n { [K in keyof T]: undefined extends T[K] ? never : K }[keyof T],\n undefined\n>\n\nexport interface SlotRecipe<\n Slots,\n Variants extends SlotRecipeVariants<Slots>,\n Known extends PropertyKey = never,\n> {\n (selection?: SlotRecipeSelection<Variants>): RecipePieces<Slots, Known>\n /** The definition, with `variants` present (`{}` when none was given). */\n readonly def: SlotRecipeDef<Slots, Variants> & { readonly variants: Variants }\n /**\n * The same recipe with `patch` merged in: base pieces compose per slot, a\n * variant's pieces compose over the base recipe's, compounds append,\n * defaults override. A slot the contract lacks is refused at once.\n */\n readonly extend: <Base extends StylePieces<Slots> = {}>(\n patch: SlotRecipePatch<Slots, Variants> & { readonly base?: Base },\n ) => SlotRecipe<Slots, Variants, Known | PresentKeys<Base>>\n /**\n * The same recipe with axes and values it lacks: a new axis, or a new\n * value on an axis it has. A value the axis already has throws\n * (`mixins:recipe-value-exists`): adjusting one is `extend`'s. An added\n * axis has no default; `extend` gives it one.\n */\n readonly add: <const More extends AxisNames>(\n more: AddedAxes<Slots, Variants, More>,\n ) => SlotRecipe<Slots, MergeAxes<Slots, Variants, More>, Known>\n}\n\n/** The axes and value names `add` was given; what each value holds is `StylePieces`. */\ntype AxisNames = Readonly<Record<string, Readonly<Record<string, unknown>>>>\n\n/**\n * What `add` takes. Mapped over the names being inferred, so each value is\n * checked as `StylePieces` where it is written (a slot the contract lacks is\n * an error there), and a value the axis already has is `never`.\n */\ntype AddedAxes<Slots, Variants, More> = {\n readonly [A in keyof More]: {\n readonly [V in keyof More[A]]: A extends keyof Variants\n ? V extends keyof Variants[A]\n ? never\n : StylePieces<Slots>\n : StylePieces<Slots>\n }\n}\n\n/** `Variants` with what `add` was given: the axes of both, each with the values of both. */\nexport type MergeAxes<Slots, Variants, More> = {\n readonly [A in keyof Variants | keyof More]: {\n readonly [\n V in\n | (A extends keyof Variants ? keyof Variants[A] : never)\n | (A extends keyof More ? keyof More[A] : never)\n ]: StylePieces<Slots>\n }\n}\n\nconst copyAxes = <Slots>(\n axes: SlotRecipeVariants<Slots>,\n): Record<string, Record<string, StylePieces<Slots>>> => {\n // No prototype: an axis or value named `constructor` is absent until given.\n const copy: Record<string, Record<string, StylePieces<Slots>>> = Object.create(null)\n for (const [axis, values] of Object.entries(axes)) {\n copy[axis] = Object.assign(Object.create(null), values)\n }\n return copy\n}\n\nconst mergePieces = <Slots>(\n left: StylePieces<Slots> | undefined,\n right: StylePieces<Slots> | undefined,\n): StyleValues<Slots> => {\n const merged: Record<string, StyleValue> = Object.create(null)\n for (const source of [left, right]) {\n for (const [slot, piece] of Object.entries((source ?? {}) as Record<string, Piece>)) {\n const existing = merged[slot]\n merged[slot] = existing === undefined ? toStyleValue(piece) : compose(existing, piece)\n }\n }\n return merged as StyleValues<Slots>\n}\n\nconst assertKnownSlots = <Slots>(\n slots: Slots,\n pieces: StylePieces<Slots> | undefined,\n where: string,\n): void => {\n const known = slots as unknown as Record<string, unknown>\n for (const slot of Object.keys((pieces ?? {}) as Record<string, unknown>)) {\n if (!Object.hasOwn(known, slot)) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:unknown-slot',\n severity: 'error',\n message: `Recipe ${where} targets unknown slot \"${slot}\"`,\n slot,\n })\n }\n }\n}\n\n/**\n * A recipe over every slot of a contract: `base` pieces per slot, `variants`\n * per axis and value, `defaults`, and `compound` matches. The result of a\n * selection is a `StylePieces` for `Style.forSlots`. A design system ships\n * the recipe; an application adjusts it with `extend` instead of forking.\n */\nexport const recipeFor =\n <Slots>(slots: Slots) =>\n <Variants extends SlotRecipeVariants<Slots> = {}, Base extends StylePieces<Slots> = {}>(\n def: SlotRecipeDef<Slots, Variants> & { readonly base?: Base },\n ): SlotRecipe<Slots, Variants, PresentKeys<Base>> => {\n // Absent variants are none; `{}` is what the default type argument names.\n const full = { ...def, variants: def.variants ?? ({} as Variants) }\n const axes: SlotRecipeVariants<Slots> = full.variants\n assertKnownSlots(slots, def.base, 'base')\n for (const [axis, values] of Object.entries(axes)) {\n for (const [value, pieces] of Object.entries(values)) {\n assertKnownSlots(slots, pieces as StylePieces<Slots>, `variants.${axis}.${value}`)\n }\n }\n for (const entry of def.compound ?? []) assertKnownSlots(slots, entry.style, 'compound')\n const select = (selection: SlotRecipeSelection<Variants> = {}): StyleValues<Slots> => {\n let pieces = mergePieces(def.base, undefined)\n const effective: Record<string, string> = Object.create(null)\n for (const [axis, values] of Object.entries(axes)) {\n const picked = own(selection as Record<string, string | null | undefined>, axis)\n const chosen =\n picked === null\n ? undefined\n : (picked ?? (def.defaults as Record<string, string | undefined> | undefined)?.[axis])\n if (chosen === undefined) continue\n effective[axis] = chosen\n const piece = (values as Record<string, StylePieces<Slots>>)[chosen]\n if (piece !== undefined) pieces = mergePieces(pieces, piece)\n }\n for (const entry of def.compound ?? []) {\n if (Object.entries(entry.when).every(([axis, value]) => effective[axis] === value)) {\n pieces = mergePieces(pieces, entry.style)\n }\n }\n return pieces\n }\n const extend = (patch: SlotRecipePatch<Slots, Variants>) => {\n const variants = copyAxes(axes)\n for (const [axis, values] of Object.entries(patch.variants ?? {})) {\n const target = variants[axis] ?? Object.create(null)\n for (const [value, pieces] of Object.entries(\n (values ?? {}) as Record<string, StylePieces<Slots>>,\n )) {\n target[value] = mergePieces(target[value], pieces)\n }\n variants[axis] = target\n }\n return recipeFor(slots)({\n base: mergePieces(def.base, patch.base),\n variants: variants as unknown as Variants,\n defaults: { ...def.defaults, ...patch.defaults } as NonNullable<\n SlotRecipeDef<Slots, Variants>['defaults']\n >,\n compound: [...(def.compound ?? []), ...(patch.compound ?? [])],\n })\n }\n const add = (more: SlotRecipeVariants<Slots>) => {\n const variants = copyAxes(axes)\n for (const [axis, values] of Object.entries(more)) {\n const target = variants[axis] ?? Object.create(null)\n for (const [value, pieces] of Object.entries(values)) {\n if (Object.hasOwn(target, value)) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:recipe-value-exists',\n severity: 'error',\n message: `Recipe axis \"${axis}\" already has the value \"${value}\"; adjust it with extend`,\n details: { axis, value },\n })\n }\n target[value] = pieces\n }\n variants[axis] = target\n }\n // Defining the result checks the added pieces' slots.\n return recipeFor(slots)<SlotRecipeVariants<Slots>, Base>({ ...def, variants })\n }\n // `select` merges the base first and removes nothing, so every base key\n // is present; `extend`'s merged base holds both bases' keys.\n return Object.assign(select, { def: full, extend, add }) as unknown as SlotRecipe<\n Slots,\n Variants,\n PresentKeys<Base>\n >\n }\n\n/**\n * One piece for every public slot whose capability satisfies `capability`:\n * a focus ring for every `Focusable`, a disabled treatment for every\n * `Interactive`, in one line.\n */\nexport const forCapability =\n <Slots>(slots: Slots) =>\n (\n capability: string | Capability.Any,\n piece: Piece,\n options?: StyleOptions,\n ): NamedStyle<Slots> => {\n const source = slots as unknown as Record<string, AnySlot>\n const value = toStyleValue(piece)\n const pieces: Record<string, StyleValue> = Object.create(null)\n for (const [name, slot] of Object.entries(source)) {\n if (slot.hidden) continue\n if (Capability.extendsCapability(slot.capability, capability)) pieces[name] = value\n }\n return forSlots(slots)(pieces as StylePieces<Slots>, options)\n }\n\nexport const SlotPieceTypeId: unique symbol = Symbol.for('foldkit-mixins/SlotPiece')\n\n/** A key of `Style.slots` that declares more than a Container: its slot, and its piece. */\nexport interface SlotPiece<S = UnnamedSlot> {\n readonly [SlotPieceTypeId]: S\n readonly piece: Piece\n}\n\nconst isSlotPiece = (value: unknown): value is SlotPiece =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, SlotPieceTypeId)\n\n/** What `Style.slots` declares for a key given only a piece. */\nexport type ContainerSlot = UnnamedSlot<\n typeof Capability.Container,\n readonly [],\n readonly [],\n readonly [],\n false\n>\n\nconst containerSlot: ContainerSlot = SlotModule.make({ capability: Capability.Container })\n\n/**\n * A key of `Style.slots` with slot options: `form: Style.slot({ events:\n * [Event.Submit] }, piece)`. The capability defaults to `Container`; a slot\n * declared here is the application's own, so it cannot be hidden.\n */\nexport const slot = <\n const C extends SlotCapability = typeof Capability.Container,\n const Events extends ReadonlyArray<EventName> = readonly [],\n const Attributes extends ReadonlyArray<AttributeName> = readonly [],\n const Requirements extends ReadonlyArray<RequirementName> = readonly [],\n>(\n options: Pick<\n MakeOptions<C, Events, Attributes, Requirements, false>,\n 'capability' | 'events' | 'attributes' | 'requirements' | 'protected'\n >,\n piece: Piece = empty,\n): SlotPiece<UnnamedSlot<C, Events, Attributes, Requirements, false>> =>\n Object.freeze({\n [SlotPieceTypeId]: SlotModule.make({\n capability: Capability.Container,\n ...options,\n }) as UnnamedSlot<C, Events, Attributes, Requirements, false>,\n piece,\n })\n\n/** What `Style.slots` takes: per key a piece, or a `Style.slot(options, piece)`. */\nexport type DeclaredPieces<S> = { readonly [K in keyof S]: Piece | SlotPiece<S[K]> }\n\n/** The contract `Style.slots` declares: a Container for a piece, the given slot for a `Style.slot`. */\nexport type DeclaredSlots<S> = SlotsContract<{\n readonly [K in keyof S]: S[K] extends UnnamedSlot ? S[K] : ContainerSlot\n}>\n\n/** A contract and the style that declared it. */\nexport interface Declared<S> {\n readonly slots: DeclaredSlots<S>\n readonly style: NamedStyle<DeclaredSlots<S>>\n}\n\n/**\n * An application's own Slots declared by their style: each key is a\n * `Container` slot with that piece, or a `Style.slot(options, piece)`.\n * `slots` is the contract a `SlotView` draws and `style` the `NamedStyle`\n * it attaches. To style a contract someone else published (`ButtonSlots`),\n * use `forSlots` instead.\n */\nexport const slots = <S>(pieces: DeclaredPieces<S>, options?: StyleOptions): Declared<S> => {\n const entries = Object.entries(pieces as Record<string, Piece | SlotPiece>)\n const contract = defineSlots(\n Object.fromEntries(\n entries.map(([key, value]) => [\n key,\n isSlotPiece(value) ? value[SlotPieceTypeId] : containerSlot,\n ]),\n ),\n ) as unknown as DeclaredSlots<S>\n const style = forSlots(contract)(\n Object.fromEntries(\n entries.map(([key, value]) => [key, isSlotPiece(value) ? value.piece : value]),\n ) as StylePieces<DeclaredSlots<S>>,\n options,\n )\n return Object.freeze({ slots: contract, style })\n}\n\n/**\n * Puts `css` (typically `Style.stylesheet(…)`) in the page's head as one\n * `<style>`, unless a `<style>` there already holds exactly this text (a page\n * rendered with it on the server, a second call). Returns that element, for\n * a caller that removes it. Browser only: throws where there is no `document`.\n */\nexport const install = (css: string): HTMLStyleElement => {\n if (typeof document === 'undefined') {\n throw new Error(\n 'Style.install needs a browser document; a server writes the sheet into the page',\n )\n }\n const present = Array.from(document.head.querySelectorAll('style')).find(\n element => element.textContent === css,\n )\n if (present !== undefined) return present\n const element = document.createElement('style')\n element.textContent = css\n document.head.append(element)\n return element\n}\n\nexport const Style = {\n class: classPiece,\n inline,\n compose,\n when,\n whenInput,\n pseudo,\n self,\n media,\n supports,\n at,\n container,\n nest,\n states,\n responsive,\n vars,\n enter,\n allowDiscrete,\n viewTransitionName,\n grid,\n keyframes,\n global,\n empty,\n perItem,\n stagger,\n forSlots,\n forCapability,\n slot,\n slots,\n attach,\n recipe,\n recipeFor,\n stylesheet,\n install,\n usedIn,\n usedDrawn,\n complete,\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsGA,MAAa,QAAQ,WAAoB,UACvC,YAAY,aAAa,KAAK,IAAI;;;AAIpC,MAAa,aAAoB,WAAsC,UACrE,KAAK,EAEH,YAAY,OAAO,OAAO,CACxB;CAAa;CAA0C,OAAO,aAAa,KAAK;AAAE,CACpF,CAAC,EACH,CAAC;;;;;AAMH,MAAa,WAAW,UACtB,KAAK,EACH,OAAO,OAAO,OAAO,EAClB,SAAgC,SAAS,KAAA,IAAY,QAAQ,aAAa,MAAM,IAAI,CAAC,CACxF,CAAC,EACH,CAAC;;;;;;AAOH,MAAa,WAAW,YAItB,QAEE,KAAK,GACF,QAAQ,YAAY,oBAAoB,0BAA0B,QAAQ,OAAO,KACpF,CAAC,GACD,SAAQ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ACtB,SAAS,KAAK,OAAO,OAAO;CAC5B,OAAO;AACT;AAEA,MAAa,QAAQ;CACnB,OAAO;CACP;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"style.js","names":["Mixin","SlotView","defineSlots"],"sources":["../src/style.ts"],"sourcesContent":["/**\n * `Style` is pure data: class tokens and inline declarations that compile to a\n * `SlotContribution`. It never touches the DOM and never mutates state.\n * `forSlots` validates piece keys against the published contract at definition\n * time, so a typo fails loudly. The builders themselves live in\n * `styleValue.ts`; this module joins them to slots.\n */\nimport * as Capability from './capability.js'\nimport { declaredNames, isUnordered, layerOf, topLevelBlocks } from './cssBlocks.js'\nimport type { InputContribution, SlotContribution } from './contribution.js'\nimport { DiagnosticError } from './diagnostics.js'\nimport { own } from './record.js'\nimport * as Mixin from './mixin.js'\nimport type { Mixin as MixinValue, MixinMeta, SlotMeta } from './mixin.js'\nimport * as SlotModule from './slot.js'\nimport type {\n Any as AnySlot,\n AttributeName,\n EventName,\n HiddenOf,\n MakeOptions,\n RequirementName,\n SlotCapability,\n UnnamedSlot,\n} from './slot.js'\nimport { define as defineSlots, type Contract as SlotsContract } from './slots.js'\nimport type { Placement } from './layers.js'\nimport type { SlotItem } from './slotItem.js'\nimport * as SlotView from './slotView.js'\nimport { complete, register, usedDrawn, usedIn } from './inject.js'\nimport * as Rules from './styleRules.js'\nimport {\n allowDiscrete,\n classPiece,\n compose,\n at,\n container,\n empty,\n enter,\n global,\n grid,\n inline,\n keyframes,\n media,\n nest,\n pseudo,\n responsive,\n self,\n states,\n supports,\n vars,\n viewTransitionName,\n make,\n toStyleValue,\n type Piece,\n type StyleValue,\n} from './styleValue.js'\n\nexport type { Piece, StyleCondition, StyleValue } from './styleValue.js'\n\n/** A hidden slot is internal: it is neither styleable nor behavior-targetable. */\nexport type StylePieces<Slots> = PublicPieces<Slots, Piece>\n\ntype PublicPieces<Slots, Value> = {\n readonly [K in keyof Slots as HiddenOf<Slots[K]> extends true ? never : K]?: Value\n}\n\n/** `StylePieces` with every piece a `StyleValue`, as a recipe or a `NamedStyle` gives them. */\nexport type StyleValues<Slots> = PublicPieces<Slots, StyleValue>\n\nexport interface NamedStyle<Slots> {\n /**\n * Type only, never set: the slot names this style may hold. Every key of\n * `pieces` is optional, so two contracts sharing one slot name would accept\n * each other's styles; this makes a style assignable only where the contract\n * asked for names every slot the style's own contract has.\n */\n readonly '~slots'?: keyof PublicPieces<Slots, never>\n readonly name?: string\n /** Each piece as compiled, placed in the `layer` when one was given. */\n readonly pieces: StyleValues<Slots>\n readonly mixin: MixinValue<never>\n /** Concatenated rule CSS for every static piece. */\n readonly css: string\n /** Concatenated class-independent CSS (keyframes, layers, global rules). */\n readonly globalCss: string\n /** One entry per generated class, for a deduplicating stylesheet. */\n readonly rules: ReadonlyArray<{ readonly className: string; readonly css: string }>\n /** Class-independent rule chunks, for a deduplicating stylesheet. */\n readonly globalRules: ReadonlyArray<string>\n}\n\nexport interface StyleOptions {\n readonly name?: string\n /**\n * The layer every piece is placed in before compiling, e.g.\n * `Layers.standard.layer('app')`. A rule already in a layer keeps it.\n */\n readonly layer?: Placement\n}\n\n/** A boolean known at authoring time. */\nexport const when = (condition: boolean, piece: Piece): StyleValue =>\n condition ? toStyleValue(piece) : empty\n\n/** A condition read from the view input at render time. The piece applies when\n * `predicate` returns true for the input the view was rendered with. */\nexport const whenInput = <Input>(predicate: (input: Input) => boolean, piece: Piece): StyleValue =>\n make({\n // Kept as given, not wrapped: a frozen style module (`viteFreeze.ts`) finds the predicate's import by its identity.\n conditions: Object.freeze([\n { predicate: predicate as (input: unknown) => boolean, piece: toStyleValue(piece) },\n ]),\n })\n\n/**\n * A piece computed from the item the slot is rendered for, when the view\n * passes one to `attrs(base, item)`; nothing for a slot rendered once.\n */\nexport const perItem = (piece: (item: SlotItem) => Piece): StyleValue =>\n make({\n items: Object.freeze([\n (item: SlotItem | undefined) => (item === undefined ? empty : toStyleValue(piece(item))),\n ]),\n })\n\n/**\n * A per-item delay for an entrance: writes `--fk-index` and\n * `transition-delay: calc(var(--fk-index) * <step>)` (or `animation-delay`),\n * so a list staggers with no timer. Pass the item to `attrs` for each row.\n */\nexport const stagger = (options: {\n readonly stepMs: number\n readonly property?: 'transitionDelay' | 'animationDelay'\n}): StyleValue =>\n compose(\n // The delay is a rule; only the index is the item's own, inline.\n self({\n [options.property ?? 'transitionDelay']: `calc(var(--fk-index) * ${options.stepMs}ms)`,\n }),\n perItem(item => inline({ '--fk-index': String(item.index) })),\n )\n\n/** Fold every active condition and item piece (recursively) into a plain style. */\nconst resolveStyle = (style: StyleValue, input: unknown, item?: SlotItem): StyleValue => {\n const active = [\n ...(style.conditions ?? [])\n .filter(condition => condition.predicate(input))\n .map(condition => condition.piece),\n ...(style.items ?? []).map(piece => piece(item)),\n ].map(piece => resolveStyle(piece, input, item))\n return make({\n classes: Object.freeze([...style.classes, ...active.flatMap(piece => piece.classes)]),\n style: Object.freeze(\n Object.assign(Object.create(null), style.style, ...active.map(piece => piece.style)),\n ),\n })\n}\n\ninterface CompiledStyle {\n readonly classes: ReadonlyArray<string>\n readonly style: Readonly<Record<string, string>>\n readonly css?: string\n readonly ruleClass?: string\n readonly globalRules?: ReadonlyArray<string>\n /** Every class the tree compiled to, with its CSS, static or conditional. */\n readonly compiled: ReadonlyArray<{ readonly className: string; readonly css: string }>\n}\n\n/** Global CSS is emitted whether or not its condition is active. */\nconst collectGlobalCss = (style: StyleValue): ReadonlyArray<string> => [\n ...(style.globalCss ?? []),\n ...(style.conditions ?? []).flatMap(condition => collectGlobalCss(condition.piece)),\n]\n\n/**\n * Compiles every rule-bearing node in the tree to its class: the node's\n * classes gain the generated one, and the CSS is collected. A conditional\n * piece's rules are compiled the same way, so the class is static and only\n * its presence follows the input.\n */\nconst compileTree = (\n style: StyleValue,\n globalCss: string,\n collected: Array<{ readonly className: string; readonly css: string }>,\n): StyleValue => {\n const rules = style.rules ?? []\n const generated = rules.length === 0 ? undefined : Rules.className(rules)\n if (generated !== undefined) {\n const css = Rules.css(generated, rules)\n register(generated, css, globalCss)\n collected.push({ className: generated, css })\n }\n const conditions = (style.conditions ?? []).map(condition => ({\n predicate: condition.predicate,\n piece: compileTree(condition.piece, globalCss, collected),\n }))\n return Object.freeze({\n ...style,\n classes: generated === undefined ? style.classes : Object.freeze([...style.classes, generated]),\n ...(conditions.length === 0 ? {} : { conditions: Object.freeze(conditions) }),\n })\n}\n\n/** A style with every rule in it compiled: the tree with classes, plus the CSS. */\nconst compileStyle = (style: StyleValue): CompiledStyle & { readonly tree: StyleValue } => {\n const collected: Array<{ readonly className: string; readonly css: string }> = []\n const globalRules = collectGlobalCss(style)\n // Every class the Style compiles to carries its globals, so a server that\n // finds any one of them in markup writes what the Style needs.\n const tree = compileTree(style, globalRules.join(''), collected)\n const first = collected[0]\n return {\n tree,\n classes: tree.classes,\n style: tree.style,\n ...(first === undefined\n ? {}\n : { css: collected.map(entry => entry.css).join(''), ruleClass: first.className }),\n ...(globalRules.length === 0 ? {} : { globalRules }),\n compiled: collected,\n }\n}\n\n/**\n * A static style stays static data; a style with input conditions compiles to a\n * message-free `InputContribution`, so it still attaches to any view.\n */\nconst contributionFrom = (\n style: StyleValue,\n compiled: CompiledStyle & { readonly tree: StyleValue },\n): SlotContribution<never> => {\n const globalCss = compiled.globalRules?.join('')\n const attributes = {\n classes: compiled.classes,\n style: compiled.style,\n ...(compiled.css === undefined ? {} : { css: compiled.css }),\n ...(globalCss === undefined ? {} : { globalCss }),\n }\n if ((style.conditions ?? []).length === 0 && (style.items ?? []).length === 0) {\n return Object.freeze(attributes)\n }\n const contribution: InputContribution<never> = context => {\n const resolved = resolveStyle(compiled.tree, context.input, context.item)\n return Object.freeze({\n classes: resolved.classes,\n style: resolved.style,\n ...(compiled.css === undefined ? {} : { css: compiled.css }),\n ...(globalCss === undefined ? {} : { globalCss }),\n })\n }\n return contribution\n}\n\nconst NOTHING_REQUIRED = Object.freeze({ events: Object.freeze([]), attributes: Object.freeze([]) })\n\n/** A Style asks nothing of a slot and supplies nothing; a piece may read the input. */\nconst styleMeta = (contributions: Record<string, SlotContribution<never>>): MixinMeta => {\n const slots: Record<string, SlotMeta> = Object.create(null)\n for (const [slot, contribution] of Object.entries(contributions)) {\n slots[slot] = Object.freeze({\n requires: NOTHING_REQUIRED,\n provides: Object.freeze([]),\n reads: Mixin.isDynamic(contribution) ? 'input' : 'static',\n })\n }\n return Object.freeze({ kind: 'style', slots: Object.freeze(slots) })\n}\n\nexport const forSlots =\n <Slots>(slots: Slots) =>\n (pieces: StylePieces<Slots>, options?: StyleOptions): NamedStyle<Slots> => {\n const known = slots as unknown as Record<string, unknown>\n const contributions: Record<string, SlotContribution<never>> = Object.create(null)\n // What was compiled, so `pieces` recomposed elsewhere keeps the layer too.\n const compiledPieces: Record<string, StyleValue> = Object.create(null)\n const rules: Array<{ className: string; css: string }> = []\n const globalRules: Array<string> = []\n let css = ''\n let globalCss = ''\n for (const [key, piece] of Object.entries(pieces as Record<string, Piece | undefined>)) {\n if (!Object.hasOwn(known, key)) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:unknown-slot',\n severity: 'error',\n message: `Style targets unknown slot \"${key}\"`,\n slot: key,\n })\n }\n if ((known[key] as { readonly hidden?: boolean } | undefined)?.hidden === true) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:hidden-slot',\n severity: 'error',\n message: `Style targets hidden slot \"${key}\"`,\n slot: key,\n })\n }\n if (piece !== undefined) {\n const value = toStyleValue(piece)\n const placed = options?.layer === undefined ? value : options.layer.place(value)\n compiledPieces[key] = placed\n // Rule and global CSS are static even when the contribution is deferred,\n // so compile once, then build the contribution and gather the CSS.\n const compiled = compileStyle(placed)\n contributions[key] = contributionFrom(placed, compiled)\n for (const entry of compiled.compiled) {\n rules.push(entry)\n css += entry.css\n }\n if (compiled.globalRules !== undefined) {\n globalRules.push(...compiled.globalRules)\n globalCss += compiled.globalRules.join('')\n }\n }\n }\n return Object.freeze({\n ...(options?.name === undefined ? {} : { name: options.name }),\n pieces: compiledPieces,\n mixin: Mixin.dynamic<never>(\n options?.name ?? 'Style',\n contributions,\n styleMeta(contributions),\n ),\n css,\n globalCss,\n rules: Object.freeze(rules),\n globalRules: Object.freeze(globalRules),\n })\n }\n\nexport interface StylesheetSource {\n readonly rules: ReadonlyArray<{ readonly className: string; readonly css: string }>\n readonly globalRules: ReadonlyArray<string>\n}\n\nconst isStylesheetSource = (value: StyleValue | StylesheetSource): value is StylesheetSource =>\n 'globalRules' in value\n\nconst LAYER_STATEMENT = /^@layer [^{}]+;$/\n\nconst sourceOf = (style: StyleValue): StylesheetSource => {\n const compiled = compileStyle(style)\n return { rules: compiled.compiled, globalRules: compiled.globalRules ?? [] }\n}\n\n/**\n * An unlayered rule beats every layer, `app` included, so once a sheet\n * declares an order, a rule outside it, or in a layer the order does not\n * name (which would sort after the last one), is a mistake. Keyframes, font\n * faces, and registered properties are not ordered by the cascade and pass.\n */\nconst refuseUnlayered = (\n css: string,\n names: ReadonlyArray<string>,\n where: string,\n className?: string,\n): void => {\n for (const block of topLevelBlocks(css)) {\n if (isUnordered(block)) continue\n const layer = layerOf(block)\n if (layer !== undefined && names.includes(layer)) continue\n throw new DiagnosticError({\n source: 'style',\n code: 'style:unlayered-rule',\n severity: 'error',\n message:\n layer === undefined\n ? `Style.stylesheet declares a layer order, but ${where} has a rule outside it, which would beat every layer; place its piece with L.in(name, …)`\n : `${where} is in layer \"${layer}\", which the declared order (${names.join(', ')}) does not name, so it would sort after \"${names.at(-1)}\"; place it with L.in(name, …)`,\n details: {\n ...(className === undefined ? {} : { className }),\n ...(layer === undefined ? {} : { layer }),\n },\n })\n }\n}\n\n/**\n * One `<style>` block: the `@layer …;` statement first (one order per\n * sheet), then the other global chunks, then the scoped classes, each\n * deduplicated with the first seen winning. A bare `StyleValue` (a theme\n * root, a layered reset, a layout) compiles like a piece of a `NamedStyle`.\n * With an order declared, every rule must sit in one of its layers\n * (`style:unlayered-rule`); without one, unlayered rules are allowed.\n */\nexport const stylesheet = (...styles: ReadonlyArray<StyleValue | StylesheetSource>): string => {\n const scoped = new Map<string, string>()\n const global = new Set<string>()\n let order: string | undefined\n for (const style of styles) {\n const source = isStylesheetSource(style) ? style : sourceOf(style)\n for (const rule of source.rules) {\n if (!scoped.has(rule.className)) scoped.set(rule.className, rule.css)\n }\n for (const rule of source.globalRules) {\n if (!LAYER_STATEMENT.test(rule)) {\n global.add(rule)\n } else if (order === undefined) {\n order = rule\n } else if (order !== rule) {\n throw new DiagnosticError({\n source: 'style',\n code: 'style:conflicting-layer-order',\n severity: 'error',\n message: `Style.stylesheet was given two layer orders: \"${order}\" and \"${rule}\"`,\n })\n }\n }\n }\n if (order !== undefined) {\n const names = declaredNames(order)\n for (const chunk of global) refuseUnlayered(chunk, names, `global CSS \"${chunk.slice(0, 60)}\"`)\n for (const [className, css] of scoped) {\n refuseUnlayered(css, names, `class \"${className}\"`, className)\n }\n }\n return [...(order === undefined ? [] : [order]), ...global, ...scoped.values()].join('')\n}\n\nexport const attach =\n <Slots>(style: NamedStyle<Slots>) =>\n <ViewSlots, Input, Message, Provides extends string = never>(\n view: SlotView.SlotView<ViewSlots, Input, Message, Provides>,\n ): SlotView.SlotView<ViewSlots, Input, Message, Provides> =>\n SlotView.attach(style.mixin)(view)\n\nexport type RecipeVariantDef = Readonly<Record<string, StyleValue>>\n\n/** A combination style applied when every `when` entry matches the selection. */\nexport interface RecipeCompound<Variants extends Readonly<Record<string, RecipeVariantDef>>> {\n readonly when: Partial<{ readonly [K in keyof Variants]: keyof Variants[K] & string }>\n readonly style: StyleValue\n}\n\nexport interface RecipeDef<Variants extends Readonly<Record<string, RecipeVariantDef>>> {\n readonly base?: StyleValue\n /** Absent for a recipe that is only its base. */\n readonly variants?: Variants\n readonly defaults?: { readonly [K in keyof Variants]?: keyof Variants[K] & string }\n readonly compound?: ReadonlyArray<RecipeCompound<Variants>>\n}\n\nexport type AnyRecipeDef = RecipeDef<Record<string, RecipeVariantDef>>\n\n/**\n * The selection of a recipe with no axes. An empty mapped type is `{}`, and\n * TypeScript checks no excess keys against `{}`, so `{ tone: 'quiet' }`\n * compiled and did nothing.\n */\ntype NoAxes = { readonly [key: string]: never }\n\nexport type RecipeSelection<D extends AnyRecipeDef> = [keyof NonNullable<D['variants']>] extends [\n never,\n]\n ? NoAxes\n : {\n readonly [K in keyof NonNullable<D['variants']>]?: keyof NonNullable<D['variants']>[K] &\n string\n }\n\n/** A recipe is just Style data: base, one piece per selected variant, then any\n * matching compound. `compound.when` is keyed by the recipe's variants, so a\n * typo is a compile error rather than a silently dead combination. */\nexport const recipe =\n <Variants extends Readonly<Record<string, RecipeVariantDef>> = {}>(def: RecipeDef<Variants>) =>\n (selection: RecipeSelection<RecipeDef<Variants>>): StyleValue => {\n const pieces: Array<StyleValue> = []\n if (def.base !== undefined) pieces.push(def.base)\n const effective: Record<string, string> = Object.create(null)\n for (const [variant, values] of Object.entries(def.variants ?? {})) {\n const chosen =\n own(selection as Record<string, string | undefined>, variant) ??\n (def.defaults as Record<string, string | undefined> | undefined)?.[variant]\n if (chosen === undefined) continue\n effective[variant] = chosen\n const piece = (values as Record<string, StyleValue>)[chosen]\n if (piece !== undefined) pieces.push(piece)\n }\n for (const compound of def.compound ?? []) {\n if (Object.entries(compound.when).every(([variant, value]) => effective[variant] === value)) {\n pieces.push(compound.style)\n }\n }\n return compose(...pieces)\n }\n\nexport type SlotRecipeVariants<Slots> = Readonly<\n Record<string, Readonly<Record<string, StylePieces<Slots>>>>\n>\n\nexport interface SlotRecipeDef<Slots, Variants extends SlotRecipeVariants<Slots>> {\n readonly base?: StylePieces<Slots>\n /** Absent for a recipe that is only its base. */\n readonly variants?: Variants\n readonly defaults?: { readonly [K in keyof Variants]?: keyof Variants[K] & string }\n readonly compound?: ReadonlyArray<{\n readonly when: Partial<{ readonly [K in keyof Variants]: keyof Variants[K] & string }>\n readonly style: StylePieces<Slots>\n }>\n}\n\n/** A selection; `null` unsets an axis that has a default. */\nexport type SlotRecipeSelection<Variants> = [keyof Variants] extends [never]\n ? NoAxes\n : { readonly [K in keyof Variants]?: (keyof Variants[K] & string) | null }\n\nexport interface SlotRecipePatch<Slots, Variants extends SlotRecipeVariants<Slots>> {\n readonly base?: StylePieces<Slots>\n readonly variants?: {\n readonly [K in keyof Variants]?: { readonly [V in keyof Variants[K]]?: StylePieces<Slots> }\n }\n readonly defaults?: SlotRecipeDef<Slots, Variants>['defaults']\n readonly compound?: SlotRecipeDef<Slots, Variants>['compound']\n}\n\n/**\n * What a selection gives: `StyleValues`, with each slot `Known` names\n * present. A recipe's base pieces are in every selection; a variant's or a\n * compound's are not, since `null` or another value can leave them out.\n */\nexport type RecipePieces<Slots, Known extends PropertyKey = never> = StyleValues<Slots> & {\n readonly [K in Known]: StyleValue\n}\n\n/** The keys of `T` that always hold a value: a base typed `StylePieces` names none. */\ntype PresentKeys<T> = Exclude<\n { [K in keyof T]: undefined extends T[K] ? never : K }[keyof T],\n undefined\n>\n\nexport interface SlotRecipe<\n Slots,\n Variants extends SlotRecipeVariants<Slots>,\n Known extends PropertyKey = never,\n> {\n (selection?: SlotRecipeSelection<Variants>): RecipePieces<Slots, Known>\n /** The definition, with `variants` present (`{}` when none was given). */\n readonly def: SlotRecipeDef<Slots, Variants> & { readonly variants: Variants }\n /**\n * The same recipe with `patch` merged in: base pieces compose per slot, a\n * variant's pieces compose over the base recipe's, compounds append,\n * defaults override. A slot the contract lacks is refused at once.\n */\n readonly extend: <Base extends StylePieces<Slots> = {}>(\n patch: SlotRecipePatch<Slots, Variants> & { readonly base?: Base },\n ) => SlotRecipe<Slots, Variants, Known | PresentKeys<Base>>\n /**\n * The same recipe with axes and values it lacks: a new axis, or a new\n * value on an axis it has. A value the axis already has throws\n * (`mixins:recipe-value-exists`): adjusting one is `extend`'s. An added\n * axis has no default; `extend` gives it one.\n */\n readonly add: <const More extends AxisNames>(\n more: AddedAxes<Slots, Variants, More>,\n ) => SlotRecipe<Slots, MergeAxes<Slots, Variants, More>, Known>\n /**\n * A selection as a style of the recipe's contract, ready for a view's\n * `style`: `Style.forSlots(slots)(recipe(selection), options)` in one call.\n * With no selection, the defaults.\n */\n readonly style: (\n selection?: SlotRecipeSelection<Variants>,\n options?: StyleOptions,\n ) => NamedStyle<Slots>\n}\n\n/** The axes and value names `add` was given; what each value holds is `StylePieces`. */\ntype AxisNames = Readonly<Record<string, Readonly<Record<string, unknown>>>>\n\n/**\n * What `add` takes. Mapped over the names being inferred, so each value is\n * checked as `StylePieces` where it is written (a slot the contract lacks is\n * an error there), and a value the axis already has is `never`.\n */\ntype AddedAxes<Slots, Variants, More> = {\n readonly [A in keyof More]: {\n readonly [V in keyof More[A]]: A extends keyof Variants\n ? V extends keyof Variants[A]\n ? never\n : StylePieces<Slots>\n : StylePieces<Slots>\n }\n}\n\n/** `Variants` with what `add` was given: the axes of both, each with the values of both. */\nexport type MergeAxes<Slots, Variants, More> = {\n readonly [A in keyof Variants | keyof More]: {\n readonly [\n V in\n | (A extends keyof Variants ? keyof Variants[A] : never)\n | (A extends keyof More ? keyof More[A] : never)\n ]: StylePieces<Slots>\n }\n}\n\nconst copyAxes = <Slots>(\n axes: SlotRecipeVariants<Slots>,\n): Record<string, Record<string, StylePieces<Slots>>> => {\n // No prototype: an axis or value named `constructor` is absent until given.\n const copy: Record<string, Record<string, StylePieces<Slots>>> = Object.create(null)\n for (const [axis, values] of Object.entries(axes)) {\n copy[axis] = Object.assign(Object.create(null), values)\n }\n return copy\n}\n\nconst mergePieces = <Slots>(\n left: StylePieces<Slots> | undefined,\n right: StylePieces<Slots> | undefined,\n): StyleValues<Slots> => {\n const merged: Record<string, StyleValue> = Object.create(null)\n for (const source of [left, right]) {\n for (const [slot, piece] of Object.entries((source ?? {}) as Record<string, Piece>)) {\n const existing = merged[slot]\n merged[slot] = existing === undefined ? toStyleValue(piece) : compose(existing, piece)\n }\n }\n return merged as StyleValues<Slots>\n}\n\nconst assertKnownSlots = <Slots>(\n slots: Slots,\n pieces: StylePieces<Slots> | undefined,\n where: string,\n): void => {\n const known = slots as unknown as Record<string, unknown>\n for (const slot of Object.keys((pieces ?? {}) as Record<string, unknown>)) {\n if (!Object.hasOwn(known, slot)) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:unknown-slot',\n severity: 'error',\n message: `Recipe ${where} targets unknown slot \"${slot}\"`,\n slot,\n })\n }\n }\n}\n\n/**\n * A recipe over every slot of a contract: `base` pieces per slot, `variants`\n * per axis and value, `defaults`, and `compound` matches. The result of a\n * selection is a `StylePieces` for `Style.forSlots`; `.style(selection)` is\n * that `NamedStyle` in one call. A design system ships\n * the recipe; an application adjusts it with `extend` instead of forking.\n */\nexport const recipeFor =\n <Slots>(slots: Slots) =>\n <Variants extends SlotRecipeVariants<Slots> = {}, Base extends StylePieces<Slots> = {}>(\n def: SlotRecipeDef<Slots, Variants> & { readonly base?: Base },\n ): SlotRecipe<Slots, Variants, PresentKeys<Base>> => {\n // Absent variants are none; `{}` is what the default type argument names.\n const full = { ...def, variants: def.variants ?? ({} as Variants) }\n const axes: SlotRecipeVariants<Slots> = full.variants\n assertKnownSlots(slots, def.base, 'base')\n for (const [axis, values] of Object.entries(axes)) {\n for (const [value, pieces] of Object.entries(values)) {\n assertKnownSlots(slots, pieces as StylePieces<Slots>, `variants.${axis}.${value}`)\n }\n }\n for (const entry of def.compound ?? []) assertKnownSlots(slots, entry.style, 'compound')\n const select = (selection: SlotRecipeSelection<Variants> = {}): StyleValues<Slots> => {\n let pieces = mergePieces(def.base, undefined)\n const effective: Record<string, string> = Object.create(null)\n for (const [axis, values] of Object.entries(axes)) {\n const picked = own(selection as Record<string, string | null | undefined>, axis)\n const chosen =\n picked === null\n ? undefined\n : (picked ?? (def.defaults as Record<string, string | undefined> | undefined)?.[axis])\n if (chosen === undefined) continue\n effective[axis] = chosen\n const piece = (values as Record<string, StylePieces<Slots>>)[chosen]\n if (piece !== undefined) pieces = mergePieces(pieces, piece)\n }\n for (const entry of def.compound ?? []) {\n if (Object.entries(entry.when).every(([axis, value]) => effective[axis] === value)) {\n pieces = mergePieces(pieces, entry.style)\n }\n }\n return pieces\n }\n const extend = (patch: SlotRecipePatch<Slots, Variants>) => {\n const variants = copyAxes(axes)\n for (const [axis, values] of Object.entries(patch.variants ?? {})) {\n const target = variants[axis] ?? Object.create(null)\n for (const [value, pieces] of Object.entries(\n (values ?? {}) as Record<string, StylePieces<Slots>>,\n )) {\n target[value] = mergePieces(target[value], pieces)\n }\n variants[axis] = target\n }\n return recipeFor(slots)({\n base: mergePieces(def.base, patch.base),\n variants: variants as unknown as Variants,\n defaults: { ...def.defaults, ...patch.defaults } as NonNullable<\n SlotRecipeDef<Slots, Variants>['defaults']\n >,\n compound: [...(def.compound ?? []), ...(patch.compound ?? [])],\n })\n }\n const add = (more: SlotRecipeVariants<Slots>) => {\n const variants = copyAxes(axes)\n for (const [axis, values] of Object.entries(more)) {\n const target = variants[axis] ?? Object.create(null)\n for (const [value, pieces] of Object.entries(values)) {\n if (Object.hasOwn(target, value)) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:recipe-value-exists',\n severity: 'error',\n message: `Recipe axis \"${axis}\" already has the value \"${value}\"; adjust it with extend`,\n details: { axis, value },\n })\n }\n target[value] = pieces\n }\n variants[axis] = target\n }\n // Defining the result checks the added pieces' slots.\n return recipeFor(slots)<SlotRecipeVariants<Slots>, Base>({ ...def, variants })\n }\n const style = (selection?: SlotRecipeSelection<Variants>, options?: StyleOptions) =>\n forSlots(slots)(select(selection), options)\n // `select` merges the base first and removes nothing, so every base key\n // is present; `extend`'s merged base holds both bases' keys.\n return Object.assign(select, { def: full, extend, add, style }) as unknown as SlotRecipe<\n Slots,\n Variants,\n PresentKeys<Base>\n >\n }\n\n/**\n * One piece for every public slot whose capability satisfies `capability`:\n * a focus ring for every `Focusable`, a disabled treatment for every\n * `Interactive`, in one line.\n */\nexport const forCapability =\n <Slots>(slots: Slots) =>\n (\n capability: string | Capability.Any,\n piece: Piece,\n options?: StyleOptions,\n ): NamedStyle<Slots> => {\n const source = slots as unknown as Record<string, AnySlot>\n const value = toStyleValue(piece)\n const pieces: Record<string, StyleValue> = Object.create(null)\n for (const [name, slot] of Object.entries(source)) {\n if (slot.hidden) continue\n if (Capability.extendsCapability(slot.capability, capability)) pieces[name] = value\n }\n return forSlots(slots)(pieces as StylePieces<Slots>, options)\n }\n\nexport const SlotPieceTypeId: unique symbol = Symbol.for('foldkit-mixins/SlotPiece')\n\n/** A key of `Style.slots` that declares more than a Container: its slot, and its piece. */\nexport interface SlotPiece<S = UnnamedSlot> {\n readonly [SlotPieceTypeId]: S\n readonly piece: Piece\n}\n\nconst isSlotPiece = (value: unknown): value is SlotPiece =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, SlotPieceTypeId)\n\n/** What `Style.slots` declares for a key given only a piece. */\nexport type ContainerSlot = UnnamedSlot<\n typeof Capability.Container,\n readonly [],\n readonly [],\n readonly [],\n false\n>\n\nconst containerSlot: ContainerSlot = SlotModule.make({ capability: Capability.Container })\n\n/**\n * A key of `Style.slots` with slot options: `form: Style.slot({ events:\n * [Event.Submit] }, piece)`. The capability defaults to `Container`; a slot\n * declared here is the application's own, so it cannot be hidden.\n */\nexport const slot = <\n const C extends SlotCapability = typeof Capability.Container,\n const Events extends ReadonlyArray<EventName> = readonly [],\n const Attributes extends ReadonlyArray<AttributeName> = readonly [],\n const Requirements extends ReadonlyArray<RequirementName> = readonly [],\n>(\n options: Pick<\n MakeOptions<C, Events, Attributes, Requirements, false>,\n 'capability' | 'events' | 'attributes' | 'requirements' | 'protected'\n >,\n piece: Piece = empty,\n): SlotPiece<UnnamedSlot<C, Events, Attributes, Requirements, false>> =>\n Object.freeze({\n [SlotPieceTypeId]: SlotModule.make({\n capability: Capability.Container,\n ...options,\n }) as UnnamedSlot<C, Events, Attributes, Requirements, false>,\n piece,\n })\n\n/** What `Style.slots` takes: per key a piece, or a `Style.slot(options, piece)`. */\nexport type DeclaredPieces<S> = { readonly [K in keyof S]: Piece | SlotPiece<S[K]> }\n\n/** The contract `Style.slots` declares: a Container for a piece, the given slot for a `Style.slot`. */\nexport type DeclaredSlots<S> = SlotsContract<{\n readonly [K in keyof S]: S[K] extends UnnamedSlot ? S[K] : ContainerSlot\n}>\n\n/** A contract and the style that declared it. */\nexport interface Declared<S> {\n readonly slots: DeclaredSlots<S>\n readonly style: NamedStyle<DeclaredSlots<S>>\n}\n\n/**\n * An application's own Slots declared by their style: each key is a\n * `Container` slot with that piece, or a `Style.slot(options, piece)`.\n * `slots` is the contract a `SlotView` draws and `style` the `NamedStyle`\n * it attaches. To style a contract someone else published (`ButtonSlots`),\n * use `forSlots` instead.\n */\nexport const slots = <S>(pieces: DeclaredPieces<S>, options?: StyleOptions): Declared<S> => {\n const entries = Object.entries(pieces as Record<string, Piece | SlotPiece>)\n const contract = defineSlots(\n Object.fromEntries(\n entries.map(([key, value]) => [\n key,\n isSlotPiece(value) ? value[SlotPieceTypeId] : containerSlot,\n ]),\n ),\n ) as unknown as DeclaredSlots<S>\n const style = forSlots(contract)(\n Object.fromEntries(\n entries.map(([key, value]) => [key, isSlotPiece(value) ? value.piece : value]),\n ) as StylePieces<DeclaredSlots<S>>,\n options,\n )\n return Object.freeze({ slots: contract, style })\n}\n\n/**\n * Puts `css` (typically `Style.stylesheet(…)`) in the page's head as one\n * `<style>`, unless a `<style>` there already holds exactly this text (a page\n * rendered with it on the server, a second call). Returns that element, for\n * a caller that removes it. Browser only: throws where there is no `document`.\n */\nexport const install = (css: string): HTMLStyleElement => {\n if (typeof document === 'undefined') {\n throw new Error(\n 'Style.install needs a browser document; a server writes the sheet into the page',\n )\n }\n const present = Array.from(document.head.querySelectorAll('style')).find(\n element => element.textContent === css,\n )\n if (present !== undefined) return present\n const element = document.createElement('style')\n element.textContent = css\n document.head.append(element)\n return element\n}\n\nexport const Style = {\n class: classPiece,\n inline,\n compose,\n when,\n whenInput,\n pseudo,\n self,\n media,\n supports,\n at,\n container,\n nest,\n states,\n responsive,\n vars,\n enter,\n allowDiscrete,\n viewTransitionName,\n grid,\n keyframes,\n global,\n empty,\n perItem,\n stagger,\n forSlots,\n forCapability,\n slot,\n slots,\n attach,\n recipe,\n recipeFor,\n stylesheet,\n install,\n usedIn,\n usedDrawn,\n complete,\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsGA,MAAa,QAAQ,WAAoB,UACvC,YAAY,aAAa,KAAK,IAAI;;;AAIpC,MAAa,aAAoB,WAAsC,UACrE,KAAK,EAEH,YAAY,OAAO,OAAO,CACxB;CAAa;CAA0C,OAAO,aAAa,KAAK;AAAE,CACpF,CAAC,EACH,CAAC;;;;;AAMH,MAAa,WAAW,UACtB,KAAK,EACH,OAAO,OAAO,OAAO,EAClB,SAAgC,SAAS,KAAA,IAAY,QAAQ,aAAa,MAAM,IAAI,CAAC,CACxF,CAAC,EACH,CAAC;;;;;;AAOH,MAAa,WAAW,YAItB,QAEE,KAAK,GACF,QAAQ,YAAY,oBAAoB,0BAA0B,QAAQ,OAAO,KACpF,CAAC,GACD,SAAQ,SAAQ,OAAO,EAAE,cAAc,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAC9D;;AAGF,MAAM,gBAAgB,OAAmB,OAAgB,SAAgC;CACvF,MAAM,SAAS,CACb,IAAI,MAAM,cAAc,CAAC,EAAA,CACtB,QAAO,cAAa,UAAU,UAAU,KAAK,CAAC,CAAC,CAC/C,KAAI,cAAa,UAAU,KAAK,GACnC,IAAI,MAAM,SAAS,CAAC,EAAA,CAAG,KAAI,UAAS,MAAM,IAAI,CAAC,CACjD,CAAC,CAAC,KAAI,UAAS,aAAa,OAAO,OAAO,IAAI,CAAC;CAC/C,OAAO,KAAK;EACV,SAAS,OAAO,OAAO,CAAC,GAAG,MAAM,SAAS,GAAG,OAAO,SAAQ,UAAS,MAAM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MAAa,QAMX,SAIA,QAAe,UAEf,OAAO,OAAO;EACX,kBAAkB,WAAW,KAAK;EACjC,YAAY,WAAW;EACvB,GAAG;CACL,CAAC;CACD;AACF,CAAC;;;;;;;;AAuBH,MAAa,SAAY,QAA2B,YAAwC;CAC1F,MAAM,UAAU,OAAO,QAAQ,MAA2C;CAC1E,MAAM,WAAWC,OACf,OAAO,YACL,QAAQ,KAAK,CAAC,KAAK,WAAW,CAC5B,KACA,YAAY,KAAK,IAAI,MAAM,mBAAmB,aAChD,CAAC,CACH,CACF;CACA,MAAM,QAAQ,SAAS,QAAQ,CAAC,CAC9B,OAAO,YACL,QAAQ,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,YAAY,KAAK,IAAI,MAAM,QAAQ,KAAK,CAAC,CAC/E,GACA,OACF;CACA,OAAO,OAAO,OAAO;EAAE,OAAO;EAAU;CAAM,CAAC;AACjD;;;;;;;AAQA,MAAa,WAAW,QAAkC;CACxD,IAAI,OAAO,aAAa,aACtB,MAAM,IAAI,MACR,iFACF;CAEF,MAAM,UAAU,MAAM,KAAK,SAAS,KAAK,iBAAiB,OAAO,CAAC,CAAC,CAAC,MAClE,YAAW,QAAQ,gBAAgB,GACrC;CACA,IAAI,YAAY,KAAA,GAAW,OAAO;CAClC,MAAM,UAAU,SAAS,cAAc,OAAO;CAC9C,QAAQ,cAAc;CACtB,SAAS,KAAK,OAAO,OAAO;CAC5B,OAAO;AACT;AAEA,MAAa,QAAQ;CACnB,OAAO;CACP;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit-mixins",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "Typed slot contracts and inside-out Style/Behavior attachments for Foldkit.",
5
5
  "keywords": [
6
6
  "foldkit",
@@ -119,7 +119,7 @@
119
119
  },
120
120
  "dependencies": {
121
121
  "csstype": "^3.2.3",
122
- "foldkit-surface": "0.15.0"
122
+ "foldkit-surface": "0.16.0"
123
123
  },
124
124
  "scripts": {
125
125
  "build": "node ../../scripts/declarations.mjs . && tsdown && node ../../scripts/declared-any.mjs .",