foldkit-mixins 0.6.0 → 0.8.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 +19 -1
- package/dist/app.d.mts +1 -1
- package/dist/app.mjs +6 -6
- package/dist/{core-Bxj0UQDF.mjs → core-IMVYU8JN.mjs} +2 -2
- package/dist/{core-Bxj0UQDF.mjs.map → core-IMVYU8JN.mjs.map} +1 -1
- package/dist/defaults.d.mts.map +1 -1
- package/dist/defaults.mjs +2 -2
- package/dist/defaults.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{layers-B31M0tDi.mjs → layers-keV38soP.mjs} +2 -2
- package/dist/{layers-B31M0tDi.mjs.map → layers-keV38soP.mjs.map} +1 -1
- package/dist/layers.mjs +1 -1
- package/dist/layout.mjs +1 -1
- package/dist/{oklch-BxvCD0oi.d.mts → oklch-FOemcYSv.d.mts} +4 -1
- package/dist/{oklch-BxvCD0oi.d.mts.map → oklch-FOemcYSv.d.mts.map} +1 -1
- package/dist/prose.mjs +1 -1
- package/dist/{root-C1u12YMD.mjs → root-BBi88KYx.mjs} +3 -3
- package/dist/{root-C1u12YMD.mjs.map → root-BBi88KYx.mjs.map} +1 -1
- package/dist/{slotMark-Rdsjb7XI.mjs → slotMark-DK75y0GJ.mjs} +2 -2
- package/dist/{slotMark-Rdsjb7XI.mjs.map → slotMark-DK75y0GJ.mjs.map} +1 -1
- package/dist/{style-CKjLee4e.mjs → style-CmHD4Ul3.mjs} +4 -4
- package/dist/{style-CKjLee4e.mjs.map → style-CmHD4Ul3.mjs.map} +1 -1
- package/dist/styleValue-BavTe9MZ.d.mts.map +1 -1
- package/dist/{styleValue-_G9jwb17.mjs → styleValue-Cj4YjgVB.mjs} +60 -2
- package/dist/styleValue-Cj4YjgVB.mjs.map +1 -0
- package/dist/testing.d.mts +35 -0
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +82 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.d.mts +13 -2
- package/dist/theme.d.mts.map +1 -1
- package/dist/theme.mjs +16 -13
- package/dist/theme.mjs.map +1 -1
- package/dist/{tokens-DteBJVN-.mjs → tokens-BkWHtxjY.mjs} +16 -4
- package/dist/tokens-BkWHtxjY.mjs.map +1 -0
- package/dist/{tokens-BR_qxDR7.d.mts → tokens-XZSP0AvO.d.mts} +9 -1
- package/dist/tokens-XZSP0AvO.d.mts.map +1 -0
- package/dist/utilities.d.mts +2 -2
- package/dist/utilities.mjs +3 -3
- package/package.json +1 -1
- package/dist/styleValue-_G9jwb17.mjs.map +0 -1
- package/dist/tokens-BR_qxDR7.d.mts.map +0 -1
- package/dist/tokens-DteBJVN-.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-CKjLee4e.mjs","names":["make","is","is","MetadataToken.is","make","MetadataToken.nameOf","MetadataToken.make","describe","ih","make","MetadataToken.nameOf","define","attach","Capability.Base","describe","MetadataToken.nameOf","Slot.is","Slot.make","Slot.describe","Capability.extendsCapability","empty","make","compose","Rules.className","css","Rules.css","Mixin.dynamic","SlotView.attach","Capability.extendsCapability","SlotModule.make","Capability.Container","defineSlots"],"sources":["../src/metadataToken.ts","../src/capability.ts","../src/attribute.ts","../src/mixin.ts","../src/pipe.ts","../src/resolver.ts","../src/slotView.ts","../src/slot.ts","../src/slots.ts","../src/style.ts"],"sourcesContent":["/**\n * Ported from `effect-atom-jsx/src/MetadataToken.ts`. Kinded name tokens so\n * Event, Attr, Requirement, and Capability share one witness instead of four\n * ad-hoc brands.\n */\nexport const MetadataTokenTypeId: unique symbol = Symbol.for('foldkit-mixins/MetadataToken')\n\nexport interface MetadataToken<Kind extends string, Name extends string> {\n readonly [MetadataTokenTypeId]: {\n readonly Kind: Kind\n readonly Name: Name\n }\n readonly kind: Kind\n readonly name: Name\n}\n\nexport type Any = MetadataToken<string, string>\n\nexport type NameOf<T> =\n T extends MetadataToken<any, infer Name> ? Name : T extends string ? T : never\n\nexport type KindOf<T> = T extends MetadataToken<infer Kind, any> ? Kind : never\n\nexport type NamesOf<T extends readonly unknown[]> = NameOf<T[number]>\n\nexport const make = <const Kind extends string, const Name extends string>(\n kind: Kind,\n name: Name,\n): MetadataToken<Kind, Name> => {\n if (name === '') {\n throw new Error(`${kind} name must be non-empty`)\n }\n return {\n [MetadataTokenTypeId]: {\n Kind: undefined as unknown as Kind,\n Name: undefined as unknown as Name,\n },\n kind,\n name,\n }\n}\n\nexport const is = (value: unknown): value is Any =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, MetadataTokenTypeId)\n\nexport const nameOf = (value: string | Any): string => (is(value) ? value.name : value)\n","/**\n * Ported from `effect-atom-jsx/src/Element.ts` `Capability`, without Handle\n * objects. Inheritance is metadata: a behavior that needs Interactive can\n * attach to TextInput. Lookups go through a Map so `__proto__` is a legal name.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type CapabilityParent = string | MetadataToken.MetadataToken<'element.capability', string>\n\nexport interface Capability<\n Name extends string = string,\n Extends extends readonly CapabilityParent[] = readonly [],\n> extends MetadataToken.MetadataToken<'element.capability', Name> {\n readonly extends: Extends\n}\n\nexport type Any = Capability<string, readonly CapabilityParent[]>\nexport type NameOf<T> = MetadataToken.NameOf<T>\nexport type NamesOf<T extends readonly unknown[]> = MetadataToken.NamesOf<T>\nexport type ExtendsOf<T> =\n T extends Capability<any, infer Extends> ? MetadataToken.NameOf<Extends[number]> : never\nexport type AssignableNamesOf<T> = T extends string\n ? T\n : T extends Capability<any, infer Extends>\n ? MetadataToken.NameOf<T> | AssignableNamesOf<Extends[number]>\n : MetadataToken.NameOf<T>\n\nexport type Satisfies<Actual, Required extends { readonly name: string }> =\n Required['name'] extends AssignableNamesOf<Actual> ? true : false\n\nconst parentsByName = new Map<string, ReadonlyArray<string>>()\nconst registry = new Map<string, Any>()\n\nexport const is = (value: unknown): value is Any =>\n MetadataToken.is(value) && value.kind === 'element.capability'\n\nexport const make = <\n const Name extends string,\n const Extends extends readonly CapabilityParent[] = readonly [],\n>(\n name: Name,\n options?: { readonly extends?: Extends },\n): Capability<Name, Extends> => {\n if (name === '') {\n throw new Error('Capability name must be non-empty')\n }\n const parents = (options?.extends ?? []) as Extends\n const parentNames = parents.map(parent => MetadataToken.nameOf(parent))\n const existing = registry.get(name)\n if (existing !== undefined) {\n const existingNames = existing.extends.map(parent => MetadataToken.nameOf(parent))\n if (\n existingNames.length === parentNames.length &&\n existingNames.every((parentName, index) => parentName === parentNames[index])\n ) {\n return existing as Capability<Name, Extends>\n }\n throw new Error(`Capability \"${name}\" is already defined with a different extends list`)\n }\n parentsByName.set(name, parentNames)\n const capability: Capability<Name, Extends> = {\n ...MetadataToken.make('element.capability', name),\n extends: Object.freeze([...parents]) as Extends,\n }\n registry.set(name, capability)\n return Object.freeze(capability)\n}\n\n/** True when `value` is `base` or inherits from it. Ported from AF-UI. */\nexport const extendsCapability = (value: string | Any, base: string | Any): boolean => {\n const valueName = MetadataToken.nameOf(value)\n const baseName = MetadataToken.nameOf(base)\n if (valueName === baseName) return true\n const visited = new Set<string>()\n const stack = [...(parentsByName.get(valueName) ?? [])]\n while (stack.length > 0) {\n const current = stack.pop()\n if (current === undefined) continue\n if (current === baseName) return true\n if (visited.has(current)) continue\n visited.add(current)\n stack.push(...(parentsByName.get(current) ?? []))\n }\n return false\n}\n\nexport const satisfies = (actual: string | Any, required: string | Any): boolean =>\n extendsCapability(actual, required)\n\nexport const names = (capability: Any): ReadonlyArray<string> => {\n const seen = new Set<string>()\n const walk = (name: string) => {\n if (seen.has(name)) return\n seen.add(name)\n for (const parent of parentsByName.get(name) ?? []) walk(parent)\n }\n walk(capability.name)\n return [...seen]\n}\n\nexport const describe = (\n capability: Any,\n): { readonly name: string; readonly extends: ReadonlyArray<string> } => ({\n name: capability.name,\n extends: capability.extends.map(parent => MetadataToken.nameOf(parent)),\n})\n\nexport const Base = make('Base')\nexport const Interactive = make('Interactive', { extends: [Base] })\nexport const Container = make('Container', { extends: [Interactive] })\nexport const Focusable = make('Focusable', { extends: [Interactive] })\nexport const TextInput = make('TextInput', { extends: [Focusable] })\nexport const Draggable = make('Draggable', { extends: [Interactive] })\nexport const Collection = make('Collection', { extends: [Base] })\n","/**\n * Internal attribute helpers. Foldkit's `isChildAttribute` and the tagged\n * attribute shape are not public, so this module reads them in one place.\n * Probed against foldkit 0.158.2; see docs/design/mixins-DESIGN.md.\n */\nimport type { Attribute, ChildAttribute } from 'foldkit/html'\nimport { inertHtml as ih } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\n\n/** The brand `childAttribute.d.ts` stamps; Foldkit's guard is not exported. */\nconst CHILD_ATTRIBUTE_BRAND = '__childAttribute'\n\nexport const isChildAttribute = (value: unknown): value is ChildAttribute =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, CHILD_ATTRIBUTE_BRAND)\n\ninterface Tagged {\n readonly _tag: string\n}\n\nexport const isTagged = (value: unknown): value is Tagged =>\n typeof value === 'object' &&\n value !== null &&\n // `hasOwn` refuses an inherited tag; `in` is what narrows the type.\n Object.hasOwn(value, '_tag') &&\n '_tag' in value &&\n typeof value._tag === 'string'\n\n/** `Class` carries no Message, so the inert builder is the honest constructor. */\nexport const classAttribute = (value: string): Attribute<never> => ih.Class(value)\n\nexport const styleAttribute = (value: Record<string, string>): Attribute<never> => ih.Style(value)\n\n/**\n * `inertHtml.OnMount` only accepts `MountAction<never>`, so a Message-bearing\n * mount is built directly. The shape is the same tagged value `h.OnMount`\n * produces (`{ _tag: 'OnMount', action }`).\n */\nexport const mountAttribute = <Message>(action: MountAction<Message, any>): Attribute<Message> =>\n ({ _tag: 'OnMount', action }) as Attribute<Message>\n","/**\n * `Mixin` is the common algebra: a named set of per-slot contributions.\n *\n * `StaticMixin` holds only static contributions, so it stays assignable to any\n * Message universe; Style uses it. `Mixin` may hold deferred contributions and\n * is tied to one Message universe; Behavior uses it. Composition is immutable\n * and keeps the deferred form when either side is deferred.\n */\nimport type {\n Contribution,\n ContributionContext,\n DynamicContribution,\n SlotContribution,\n StaticContribution,\n StaticContributionMap,\n} from './contribution.js'\n\nexport interface Mixin<Message = never> {\n readonly name: string\n readonly contributions: Contribution<Message>\n}\n\nexport interface StaticMixin<Message = never> {\n readonly name: string\n readonly contributions: StaticContributionMap<Message>\n}\n\nexport type AnyMixin = Mixin<any> | StaticMixin<any>\n\n/**\n * A Mixin acceptable in any context of `Message`. `Mixin<never>` is included\n * explicitly because a message-free dynamic Mixin (input-driven Style) does not\n * widen to `Mixin<Message>` — `HtmlBuilder` is invariant in `Message`.\n */\nexport type MixinFor<Message> = Mixin<Message> | StaticMixin<Message> | Mixin<never>\n\nexport const isDynamic = <Message>(\n contribution: SlotContribution<Message>,\n): contribution is DynamicContribution<Message> => typeof contribution === 'function'\n\nexport const evaluate = <Message>(\n contribution: SlotContribution<Message>,\n context: ContributionContext<Message>,\n): StaticContribution<Message> => (isDynamic(contribution) ? contribution(context) : contribution)\n\nconst mergeStatic = <Message>(\n left: StaticContribution<Message>,\n right: StaticContribution<Message>,\n): StaticContribution<Message> => {\n const css = `${left.css ?? ''}${right.css ?? ''}`\n const globalCss = `${left.globalCss ?? ''}${right.globalCss ?? ''}`\n return Object.freeze({\n classes: Object.freeze([...(left.classes ?? []), ...(right.classes ?? [])]),\n style: Object.freeze({ ...(left.style ?? {}), ...(right.style ?? {}) }),\n attributes: Object.freeze([...(left.attributes ?? []), ...(right.attributes ?? [])]),\n mounts: Object.freeze([...(left.mounts ?? []), ...(right.mounts ?? [])]),\n ...(css === '' ? {} : { css }),\n ...(globalCss === '' ? {} : { globalCss }),\n })\n}\n\nconst mergeSlot = <Message>(\n left: SlotContribution<Message>,\n right: SlotContribution<Message>,\n): SlotContribution<Message> => {\n if (!isDynamic(left) && !isDynamic(right)) return mergeStatic(left, right)\n return context => mergeStatic(evaluate(left, context), evaluate(right, context))\n}\n\nexport const make = <Message = never>(\n name: string,\n contributions: StaticContributionMap<Message>,\n): StaticMixin<Message> =>\n Object.freeze({ name, contributions: Object.freeze({ ...contributions }) })\n\nexport const dynamic = <Message = never>(\n name: string,\n contributions: Contribution<Message>,\n): Mixin<Message> => Object.freeze({ name, contributions: Object.freeze({ ...contributions }) })\n\nexport const empty = <Message = never>(): StaticMixin<Message> => make('Empty', {})\n\nexport const compose = <Message = never>(\n ...mixins: ReadonlyArray<MixinFor<Message>>\n): Mixin<Message> => {\n const merged: Record<string, SlotContribution<Message>> = Object.create(null)\n for (const mixin of mixins) {\n for (const [slot, contribution] of Object.entries(mixin.contributions)) {\n if (contribution === undefined) continue\n // A `Mixin<never>` may only contribute message-free data; the cast lets it\n // compose with a message-bearing Mixin under one algebra.\n const normalized = contribution as SlotContribution<Message>\n const existing = merged[slot]\n merged[slot] = existing === undefined ? normalized : mergeSlot(existing, normalized)\n }\n }\n return dynamic(mixins.length === 0 ? 'Empty' : mixins.map(mixin => mixin.name).join('+'), merged)\n}\n\nexport const contributionsFor = <Message>(\n mixin: Mixin<Message> | StaticMixin<Message>,\n slot: string,\n): SlotContribution<Message> | undefined => mixin.contributions[slot]\n","/** Ported from `effect-atom-jsx/src/View.ts` `pipeSelf`. */\nexport const pipeSelf = (self: unknown, fns: ReadonlyArray<(value: any) => any>): unknown =>\n fns.reduce((acc, fn) => fn(acc), self)\n\nexport type Pipeable<Self> = {\n pipe(): Self\n pipe(...fns: ReadonlyArray<(self: Self) => Self>): Self\n pipe<A>(ab: (self: Self) => A): A\n pipe<A, B>(ab: (self: Self) => A, bc: (a: A) => B): B\n pipe<A, B, C>(ab: (self: Self) => A, bc: (a: A) => B, cd: (b: B) => C): C\n}\n","/**\n * The deterministic resolver. `resolve` is pure: it decomposes the base\n * attributes, applies contributions in attachment order, enforces ownership\n * and protection, then emits one canonical `Class`, one `Style`, and at most\n * one `OnMount`. Conflicts throw a `DiagnosticError` before Foldkit could\n * silently chain or replace.\n */\nimport { Stream } from 'effect'\nimport type { Attribute, ChildAttribute } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\nimport {\n classAttribute,\n isChildAttribute,\n isTagged,\n mountAttribute,\n styleAttribute,\n} from './attribute.js'\nimport type { StaticContribution } from './contribution.js'\nimport { DiagnosticError, type Diagnostic, type DiagnosticCode } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport type { SlotProtection } from './slot.js'\n\nexport type SlotAttributes<Message> = ReadonlyArray<Attribute<Message> | ChildAttribute>\n\nexport interface ResolveOptions {\n readonly slot?: string\n readonly protected?: SlotProtection\n}\n\n/** `AriaLabel` -> `arialabel`, `aria-label` -> `arialabel`; tags and tokens agree. */\nconst normalizeName = (name: string): string => name.replace(/[^a-z0-9]/gi, '').toLowerCase()\n\n/** Attribute tags are PascalCase (`OnKeyDown`); event tokens are lowercase. */\nconst eventNameOfTag = (tag: string): string =>\n normalizeName(tag.startsWith('On') ? tag.slice(2) : tag)\n\nconst splitClasses = (value: string): ReadonlyArray<string> =>\n value.split(/\\s+/).filter(token => token.length > 0)\n\n/** `Prop`/`Attribute`/`DataAttribute`/`OnCustomEvent` are keyed individually. */\nconst ownershipKey = (tag: string, value: unknown): string => {\n if (typeof value !== 'object' || value === null) return tag\n const record = value as { readonly key?: unknown; readonly name?: unknown }\n switch (tag) {\n case 'Prop':\n case 'Attribute':\n case 'DataAttribute':\n return `${tag}:${String(record.key)}`\n case 'OnCustomEvent':\n return `${tag}:${String(record.name)}`\n default:\n return tag\n }\n}\n\nconst toDiagnostic = (\n code: DiagnosticCode,\n message: string,\n slot: string | undefined,\n details: Readonly<Record<string, unknown>>,\n): Diagnostic => ({\n source: 'mixins',\n code,\n severity: 'error',\n message,\n ...(slot === undefined ? {} : { slot }),\n details,\n})\n\nexport const resolve = <Message>(\n base: SlotAttributes<Message> | undefined,\n contributions: ReadonlyArray<StaticContribution<Message>>,\n options: ResolveOptions = {},\n): SlotAttributes<Message> => {\n const slot = options.slot\n const protection = options.protected\n const protectedEvents = new Set(\n (protection?.events ?? []).map(event => normalizeName(MetadataToken.nameOf(event))),\n )\n const protectedAttributes = new Set(\n (protection?.attributes ?? []).map(attr => normalizeName(MetadataToken.nameOf(attr))),\n )\n const protectedStyle = new Set(protection?.style ?? [])\n\n const classes: Array<string> = []\n const classSeen = new Set<string>()\n const style = new Map<string, string>()\n // Who wrote each inline style property. Style pieces layer over the base and\n // over each other (that is restyling); a Behavior's property has one owner,\n // and a Style piece may not overwrite what a Behavior set.\n const styleOwners = new Map<string, 'base' | 'style' | 'behavior'>()\n const mounts: Array<MountAction<Message, any>> = []\n const mountNames = new Map<string, number>()\n const preserved: Array<Attribute<Message> | ChildAttribute> = []\n const added: Array<Attribute<Message> | ChildAttribute> = []\n const ownedEvents = new Map<string, string>()\n const ownedAttributes = new Map<string, string>()\n\n function fail(\n code: DiagnosticCode,\n message: string,\n details: Readonly<Record<string, unknown>>,\n ): never {\n throw new DiagnosticError(toDiagnostic(code, message, slot, details))\n }\n\n const addClass = (token: string): void => {\n if (classSeen.has(token)) return\n classSeen.add(token)\n classes.push(token)\n }\n\n const writeStyle = (\n property: string,\n value: string,\n writer: 'base' | 'style' | 'behavior',\n ): void => {\n if (writer !== 'base' && protectedStyle.has(property)) {\n fail(\n 'mixins:protected-style-property',\n `slot \"${slot ?? '?'}\" protects style property \"${property}\"`,\n { property },\n )\n }\n const owner = styleOwners.get(property)\n if (\n (writer === 'behavior' && owner !== undefined) ||\n (writer === 'style' && owner === 'behavior')\n ) {\n fail(\n 'mixins:style-property-conflict',\n `two owners for style property \"${property}\": ${owner === 'base' ? 'the view' : owner === 'style' ? 'a Style' : 'a Behavior'} already sets it`,\n { property, owner, writer },\n )\n }\n if (owner === undefined || writer === 'behavior') styleOwners.set(property, writer)\n style.set(property, value)\n }\n\n const addMount = (action: MountAction<Message, any>): void => {\n const count = (mountNames.get(action.name) ?? 0) + 1\n mountNames.set(action.name, count)\n if (count > 1) {\n fail('mixins:duplicate-mount-name', `two Mounts are both named \"${action.name}\"`, {\n name: action.name,\n })\n }\n mounts.push(action)\n }\n\n const reserve = (tag: string, value: unknown): void => {\n if (tag === 'OnMount') return\n // `OnCustomEvent` is keyed by its event name, not treated as one native event.\n if (tag.startsWith('On') && tag !== 'OnCustomEvent') {\n ownedEvents.set(eventNameOfTag(tag), tag)\n return\n }\n ownedAttributes.set(ownershipKey(tag, value), tag)\n }\n\n const addBase = (attribute: Attribute<Message> | ChildAttribute): void => {\n if (isChildAttribute(attribute)) {\n const inner = (attribute as { readonly attribute?: unknown }).attribute\n if (isTagged(inner)) reserve(inner._tag, inner)\n preserved.push(attribute)\n return\n }\n const tag = attribute._tag\n switch (tag) {\n case 'Class':\n for (const token of splitClasses(attribute.value)) addClass(token)\n return\n case 'Style':\n for (const [property, value] of Object.entries(attribute.value)) {\n writeStyle(property, value, 'base')\n }\n return\n case 'OnMount':\n addMount(attribute.action)\n return\n default:\n reserve(tag, attribute)\n preserved.push(attribute)\n }\n }\n\n const applyMixinAttribute = (attribute: Attribute<Message> | ChildAttribute): void => {\n if (isChildAttribute(attribute)) {\n const inner = (attribute as { readonly attribute?: unknown }).attribute\n if (isTagged(inner)) reserve(inner._tag, inner)\n added.push(attribute)\n return\n }\n const tag = attribute._tag\n switch (tag) {\n case 'Class':\n for (const token of splitClasses(attribute.value)) addClass(token)\n return\n case 'Style':\n // A `Style` attribute inside a contribution's attributes is a Behavior's.\n for (const [property, value] of Object.entries(attribute.value)) {\n writeStyle(property, value, 'behavior')\n }\n return\n case 'OnMount':\n addMount(attribute.action)\n return\n case 'Key':\n case 'InnerHTML':\n fail(\n 'mixins:structural-override',\n `a Mixin may not contribute \"${tag}\"; it is structural ownership`,\n { tag },\n )\n default:\n if (tag.startsWith('On') && tag !== 'OnCustomEvent') {\n const eventName = eventNameOfTag(tag)\n if (protectedEvents.has(eventName)) {\n fail('mixins:protected-event', `slot \"${slot ?? '?'}\" protects event \"${eventName}\"`, {\n tag,\n event: eventName,\n })\n }\n const owner = ownedEvents.get(eventName)\n if (owner !== undefined) {\n fail(\n 'mixins:event-conflict',\n `two owners for event \"${eventName}\": \"${owner}\" already owns it`,\n { tag, event: eventName, owner },\n )\n }\n ownedEvents.set(eventName, tag)\n } else {\n const key = ownershipKey(tag, attribute)\n if (protectedAttributes.has(normalizeName(tag))) {\n fail(\n 'mixins:protected-attribute',\n `slot \"${slot ?? '?'}\" protects attribute \"${tag}\"`,\n { tag },\n )\n }\n const owner = ownedAttributes.get(key)\n if (owner !== undefined) {\n fail(\n 'mixins:attribute-conflict',\n `two owners for \"${key}\": a ${owner} attribute already occupies it`,\n { tag, key, owner },\n )\n }\n ownedAttributes.set(key, tag)\n }\n added.push(attribute)\n }\n }\n\n for (const attribute of base ?? []) addBase(attribute)\n\n for (const contribution of contributions) {\n for (const token of contribution.classes ?? []) addClass(token)\n for (const [property, value] of Object.entries(contribution.style ?? {})) {\n writeStyle(property, value, 'style')\n }\n for (const attribute of contribution.attributes ?? []) applyMixinAttribute(attribute)\n for (const mount of contribution.mounts ?? []) addMount(mount)\n }\n\n const emitted: Array<Attribute<Message> | ChildAttribute> = []\n if (classes.length > 0) emitted.push(classAttribute(classes.join(' ')))\n if (style.size > 0) emitted.push(styleAttribute(Object.fromEntries(style)))\n emitted.push(...preserved, ...added)\n const composed = composeMounts(mounts, slot)\n if (composed !== undefined) emitted.push(composed)\n return emitted\n}\n\nconst composeMounts = <Message>(\n mounts: ReadonlyArray<MountAction<Message, any>>,\n slot: string | undefined,\n): Attribute<Message> | undefined => {\n const first = mounts[0]\n if (first === undefined) return undefined\n if (mounts.length === 1) return mountAttribute(first)\n const name = `Mixins[${slot ?? 'slot'}](${mounts.map(mount => mount.name).join(',')})`\n return mountAttribute({\n name,\n args: {\n slot: slot ?? null,\n actions: mounts.map(mount => ({ name: mount.name, args: mount.args })),\n },\n f: (element, viewStateChanges) =>\n Stream.mergeAll(\n mounts.map(mount => mount.f(element, viewStateChanges)),\n { concurrency: 'unbounded' },\n ),\n })\n}\n","/**\n * `SlotView` is the structural equivalent of a Surface: a pure Foldkit view\n * that publishes typed Slots and lets Mixins attach without forking it. It\n * owns no state and runs no Effects. Attached Mixins are resolved into\n * ordinary Foldkit attributes per slot, using the view's own `h` so Message\n * capability masking is preserved.\n */\nimport { createKeyedLazy, createLazy, inertHtml, type Html, type HtmlBuilder } from 'foldkit/html'\nimport type { NamedBehavior } from './behavior.js'\nimport type { SlotContribution, SlotItem } from './contribution.js'\nimport { ensure } from './inject.js'\nimport { SLOT_MARK, isMarking } from './slotMark.js'\nimport {\n evaluate,\n isDynamic,\n type AnyMixin,\n type Mixin,\n type MixinFor,\n type StaticMixin,\n} from './mixin.js'\nimport { pipeSelf, type Pipeable } from './pipe.js'\nimport { resolve, type SlotAttributes } from './resolver.js'\nimport type { Any as AnySlot, SlotProtection } from './slot.js'\n\nexport type SlotBuilder<Message, Slots = unknown> = {\n /**\n * The view's base attributes plus every resolved contribution. Pass `item`\n * when the slot is rendered once per item, so a Behavior can decorate each\n * repetition differently.\n */\n readonly attrs: (base?: SlotAttributes<Message>, item?: SlotItem) => SlotAttributes<Message>\n /**\n * One item's drawing, drawn again only when a value in `args` changed by\n * identity or what the Mixins gave the Slots it used for this item changed\n * in value (a static Style by identity). `draw` must read nothing but its\n * arguments, so pass a function defined once, not a closure made per\n * render. Keyed by `item.id`, else its index, and remembered per `draw`:\n * two views drawing one key with one `draw` share its memo, and miss it\n * whenever what they give it differs.\n */\n readonly lazy: <const Args extends Readonly<Record<string, unknown>>>(\n item: SlotItem,\n draw: (slots: SlotBuilders<Slots, Message>, h: HtmlBuilder<Message>, args: Args) => Html,\n args: Args,\n ) => Html\n}\n\nexport type SlotBuilders<Slots, Message> = {\n readonly [K in keyof Slots]: SlotBuilder<Message, Slots>\n}\n\nexport type SlotViewRender<Slots, Input, Message> = (\n input: Input,\n slots: SlotBuilders<Slots, Message>,\n h: HtmlBuilder<Message>,\n) => Html\n\nexport interface SlotView<Slots, Input, Message> extends Pipeable<SlotView<Slots, Input, Message>> {\n (input: Input, h: HtmlBuilder<Message>): Html\n readonly name?: string\n readonly slots: Slots\n readonly mixins: ReadonlyArray<MixinFor<Message>>\n readonly render: SlotViewRender<Slots, Input, Message>\n}\n\n/** Mixins resolved against one input: a part's own against its selection, the view's against the whole. */\ninterface MixinGroup<Message> {\n readonly mixins: ReadonlyArray<MixinFor<Message>>\n readonly input: unknown\n}\n\n// The view's Mixins behind each builders record `buildersFor` makes, so an\n// assembly's parts resolve the same ones; the array itself, so a memo can compare it.\nconst mixinsOf = new WeakMap<object, ReadonlyArray<MixinFor<any>>>()\n\n/** Like `buildersFor`, with each group of Mixins resolved against its own input, in order. */\nconst buildersOver = <Slots, Message>(\n slots: Slots,\n groups: ReadonlyArray<MixinGroup<Message>>,\n h: HtmlBuilder<Message>,\n): SlotBuilders<Slots, Message> => {\n const source = slots as unknown as Record<string, AnySlot>\n const builders: Record<string, SlotBuilder<Message>> = Object.create(null)\n for (const name of Object.getOwnPropertyNames(source)) {\n const slot = source[name]\n if (slot === undefined) continue\n const protection: SlotProtection = slot.protected\n builders[name] = {\n attrs: (base?: SlotAttributes<Message>, item?: SlotItem) => {\n using?.add(name)\n const contributions = []\n for (const { mixins, input } of groups) {\n for (const mixin of mixins) {\n const contribution = mixin.contributions[name]\n if (contribution !== undefined) {\n const evaluated = evaluate(contribution as SlotContribution<Message>, {\n input,\n h,\n ...(item === undefined ? {} : { item }),\n })\n // What this Slot draws brings its CSS, whether or not a stylesheet listed it.\n ensure(evaluated)\n contributions.push(evaluated)\n }\n }\n }\n const resolved = resolve(base, contributions, { slot: name, protected: protection })\n // Only while a test draws with `Inert.draw`: never for a real render.\n return isMarking() ? [...resolved, h.DataAttribute(SLOT_MARK, name)] : resolved\n },\n lazy: (item, draw, args) =>\n drawItem(item, draw, args, {\n builders: builders as SlotBuilders<Slots, Message>,\n h,\n given: used =>\n used.flatMap(slot =>\n groups.flatMap(({ mixins, input }) =>\n mixins.flatMap(mixin => {\n // As `attrs` reads it: a `Mixin<never>` only ever gives message-free data.\n const contribution = mixin.contributions[slot] as\n SlotContribution<Message> | undefined\n // A static one as it is: two views apart only by a Style draw rows apart.\n return contribution === undefined\n ? []\n : [isDynamic(contribution) ? contribution({ input, h, item }) : contribution]\n }),\n ),\n ),\n first: name,\n }),\n }\n }\n return builders as SlotBuilders<Slots, Message>\n}\n\n// The Slots the per-item drawing now running has used, if one is, and whether\n// it drew another inside it.\nconst NESTED = Symbol('nested')\nlet using: Set<string | typeof NESTED> | undefined\n\n/** One `draw`'s items: their memo, the Slots each used, and what those were given. */\ninterface ItemMemo {\n readonly lazy: ReturnType<typeof createKeyedLazy>\n readonly used: Map<PropertyKey, ReadonlyArray<string | typeof NESTED>>\n readonly given: Map<PropertyKey, unknown>\n}\nconst itemMemos = new WeakMap<object, ItemMemo>()\nconst itemMemoOf = (draw: object): ItemMemo => {\n const known = itemMemos.get(draw)\n if (known !== undefined) return known\n const made = { lazy: createKeyedLazy(), used: new Map(), given: new Map() }\n itemMemos.set(draw, made)\n return made\n}\n\n// The drawing a missed item runs: set just before the memo is asked, so the\n// memo sees one function whose arguments are all it compares.\nlet pending: (() => Html) | undefined\nconst runPending = (..._compared: ReadonlyArray<unknown>): Html => pending!()\n\n// How many memoized drawings have started. Foldkit's lazy slot throws before\n// it calls the drawing when there is no runtime frame, so a throw with this\n// unchanged is that, and a throw after it moved is the drawing's own error.\nlet started = 0\n\n/**\n * `memoized()` under a lazy slot, or `plain()` where there is no runtime frame\n * to memoize under (a test, a server's first pass). An error from the drawing\n * itself is thrown as it is, not drawn a second time.\n */\nconst memoizedOr = (memoized: () => Html, plain: () => Html): Html => {\n const before = started\n try {\n return memoized()\n } catch (error) {\n if (started !== before) throw error\n return plain()\n }\n}\n\nconst isPlain = (value: object): boolean => {\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null || Array.isArray(value)\n}\n\n/**\n * Whether two evaluated contributions hold the same data: arrays and plain\n * objects (Foldkit's attributes and Messages are) by value, anything else by\n * identity, since a `Map` or a `Date` keeps its contents where `Object.keys`\n * does not see them. A handler made per render is never the same, so an item\n * a Mixin gives one is drawn again every time: correct, not cached.\n */\nconst sameData = (left: unknown, right: unknown, depth = 0): boolean => {\n if (Object.is(left, right)) return true\n if (depth > 8) return false\n if (typeof left !== 'object' || typeof right !== 'object' || left === null || right === null)\n return false\n if (!isPlain(left) || Object.getPrototypeOf(left) !== Object.getPrototypeOf(right)) return false\n const keys = Object.keys(left)\n if (keys.length !== Object.keys(right).length) return false\n return keys.every(\n key =>\n Object.hasOwn(right, key) &&\n sameData(\n (left as Record<string, unknown>)[key],\n (right as Record<string, unknown>)[key],\n depth + 1,\n ),\n )\n}\n\nconst drawItem = <Slots, Message, Args extends Readonly<Record<string, unknown>>>(\n item: SlotItem,\n draw: (slots: SlotBuilders<Slots, Message>, h: HtmlBuilder<Message>, args: Args) => Html,\n args: Args,\n context: {\n readonly builders: SlotBuilders<Slots, Message>\n readonly h: HtmlBuilder<Message>\n readonly given: (used: ReadonlyArray<string>) => ReadonlyArray<unknown>\n readonly first: string\n },\n): Html => {\n // Inside another item's drawing, drawn in place, and the outer one is not\n // cached: its key would read this one's Slots with the outer item.\n if (using !== undefined) {\n using.add(NESTED)\n return draw(context.builders, context.h, args)\n }\n const memo = itemMemoOf(draw)\n const key = item.id ?? item.index\n // What an item used and was given is kept only under a runtime frame, where a\n // memo can use it: a server drawing page after page keeps nothing.\n const run = (kept: boolean): Html => {\n started++\n using = new Set()\n try {\n const html = draw(context.builders, context.h, args)\n if (kept) memo.used.set(key, [...using])\n return html\n } finally {\n using = undefined\n }\n }\n const used = memo.used.get(key) ?? [context.first]\n if (used.includes(NESTED)) return run(true)\n const now = context.given(used.filter(slot => slot !== NESTED))\n const before = memo.given.get(key)\n // The same data keeps the value last compared, so the memo sees it unchanged.\n const given = before !== undefined && sameData(before, now) ? before : now\n pending = () => run(true)\n try {\n // The record is new every render; its keys and values are what stay the same.\n const compared = [draw, given, ...Object.keys(args), ...Object.values(args)]\n return memoizedOr(\n () => {\n const html = memo.lazy(key, runPending, compared)\n memo.given.set(key, given)\n return html\n },\n () => run(false),\n )\n } finally {\n pending = undefined\n }\n}\n\n/** Build one `attrs` resolver per published slot, evaluating Mixins lazily. */\nexport const buildersFor = <Slots, Message, Input>(\n slots: Slots,\n mixins: ReadonlyArray<MixinFor<Message>>,\n context: { readonly input: Input; readonly h: HtmlBuilder<Message> },\n): SlotBuilders<Slots, Message> => {\n const builders = buildersOver(slots, [{ mixins, input: context.input }], context.h)\n mixinsOf.set(builders, mixins)\n return builders\n}\n\nconst makeView = <Slots, Input, Message>(\n name: string | undefined,\n slots: Slots,\n mixins: ReadonlyArray<MixinFor<Message>>,\n render: SlotViewRender<Slots, Input, Message>,\n): SlotView<Slots, Input, Message> => {\n const view = (input: Input, h: HtmlBuilder<Message>): Html =>\n render(input, buildersFor(slots, mixins, { input, h }), h)\n // A function's own `name` is read-only; define it rather than assigning.\n if (name !== undefined) {\n Object.defineProperty(view, 'name', { value: name, configurable: true })\n }\n return Object.assign(view, {\n slots,\n mixins,\n render,\n pipe: (...fns: ReadonlyArray<(self: unknown) => unknown>) => pipeSelf(view, fns),\n }) as unknown as SlotView<Slots, Input, Message>\n}\n\n/**\n * Defines a view over published Slots.\n *\n * `Message` has no anchor but the render callback's builder, so it is inferred\n * from an explicit `h: HtmlBuilder<Message>` annotation on that parameter.\n * Without one it resolves to `unknown`, and the first error appears later and\n * elsewhere — an invariance mismatch at `Style.attach`/`Behavior.attach` that\n * does not name the missing annotation. `forMessages<Message>()` fixes the\n * Message universe up front instead, and leaves `h` contextually typed.\n */\nexport const define = <Slots, Input, Message>(\n slots: Slots,\n render: SlotViewRender<Slots, Input, Message>,\n options?: { readonly name?: string },\n): SlotView<Slots, Input, Message> => makeView(options?.name, slots, [], render)\n\n/**\n * Foldkit's `inertHtml` typed for a Message universe, for rendering a view\n * outside a runtime (tests, demos, static description). `inertHtml` is\n * `HtmlBuilder<never>`, and the builder is invariant in `Message`, so this is\n * the one cast: sound outside a runtime render, where no handler is ever\n * dispatched. Inside one it is the same builder every view is given, so its\n * handlers would reach the frame's `update`: use the view's own `h` there.\n */\nexport const inertBuilder = <Message>(): HtmlBuilder<Message> =>\n inertHtml as unknown as HtmlBuilder<Message>\n\n/** The `SlotView` constructors with `Message` already fixed. */\nexport interface MessageSlotView<Message> {\n readonly define: <Slots, Input>(\n slots: Slots,\n render: SlotViewRender<Slots, Input, Message>,\n options?: { readonly name?: string },\n ) => SlotView<Slots, Input, Message>\n}\n\n/**\n * Binds the view constructors to one Message universe, so the render callback\n * no longer has to annotate `h` to pin it. `Input` is still inferred from the\n * callback's own `input` annotation.\n *\n * @example\n * ```ts\n * const Field = SlotView.forMessages<Message>().define(\n * FieldSlots,\n * (input: FieldInput, slots, h) =>\n * h.input(slots.input.attrs([h.OnInput(value => Message.ChangedValue({ value }))])),\n * )\n * ```\n */\nexport const forMessages = <Message>(): MessageSlotView<Message> => ({ define })\n\n/** A transform on any view, used by Message-free static mixins such as Style. */\nexport type SlotViewTransform = <Slots, Input, Message>(\n view: SlotView<Slots, Input, Message>,\n) => SlotView<Slots, Input, Message>\n\n/** A transform restricted to one Message universe, for Behavior mixins. */\nexport type SlotViewTransformFor<Message> = <Slots, Input>(\n view: SlotView<Slots, Input, Message>,\n) => SlotView<Slots, Input, Message>\n\n/** Attach one Mixin. Returns a new view; the original is unchanged. */\nexport function attach(mixin: StaticMixin<never> | Mixin<never>): SlotViewTransform\nexport function attach<MixinMessage>(mixin: Mixin<MixinMessage>): SlotViewTransformFor<MixinMessage>\nexport function attach(mixin: AnyMixin | Mixin<never>): any {\n return (view: SlotView<any, any, any>) =>\n makeView(view.name, view.slots, [...view.mixins, mixin], view.render)\n}\n\n/**\n * One piece of an assembled view, drawn from its own selection of the view's\n * input: the keys it names in `reads`, and nothing else. It is drawn again\n * only when one of those values changed, by identity.\n */\nexport interface Part<Slots, Input, Message> {\n readonly name: string\n readonly reads: ReadonlyArray<keyof Input>\n /** The Behaviors declared with the part, resolved against its selection. */\n readonly mixins: ReadonlyArray<MixinFor<Message>>\n // `any`: the part's own selection, which `Parts.part` typed from `reads`.\n readonly render: (\n input: any,\n slots: SlotBuilders<Slots, Message>,\n h: HtmlBuilder<Message>,\n ) => Html\n}\n\n/** An assembly's own drawing: the parts it places, by `draw`, and anything else around them. */\nexport type AssemblyRender<Slots, Input, Message> = (\n input: Input,\n slots: SlotBuilders<Slots, Message>,\n h: HtmlBuilder<Message>,\n draw: (part: Part<Slots, Input, Message>) => Html,\n) => Html\n\nexport interface Parts<Slots, Input, Message> {\n /**\n * A part reading `reads` of the input. `behaviors` are declared over that\n * selection, so they cannot read what the part does not redraw for.\n */\n readonly part: <const Reads extends ReadonlyArray<keyof Input>>(\n name: string,\n options: {\n readonly reads: Reads\n readonly behaviors?: ReadonlyArray<NamedBehavior<Slots, Pick<Input, Reads[number]>, Message>>\n },\n render: (\n input: Pick<Input, Reads[number]>,\n slots: SlotBuilders<Slots, Message>,\n h: HtmlBuilder<Message>,\n ) => Html,\n ) => Part<Slots, Input, Message>\n /**\n * A SlotView that draws its parts where `render` places them. Styles and\n * Behaviors attach to it as to any SlotView and reach every part's Slots.\n */\n readonly assemble: (\n render: AssemblyRender<Slots, Input, Message>,\n options?: { readonly name?: string },\n ) => SlotView<Slots, Input, Message>\n}\n\n// A part's memo. A part drawn twice in one render is the same drawing twice,\n// which Foldkit copies for the second place.\nconst lazies = new WeakMap<object, ReturnType<typeof createLazy>>()\nconst lazyOf = (part: object): ReturnType<typeof createLazy> => {\n const known = lazies.get(part)\n if (known !== undefined) return known\n const made = createLazy()\n lazies.set(part, made)\n return made\n}\n\n// Whether any of these Mixins reads the input: a function contribution may.\nconst readsInput = new WeakMap<ReadonlyArray<MixinFor<any>>, boolean>()\nconst anyDynamic = (mixins: ReadonlyArray<MixinFor<any>>): boolean => {\n const known = readsInput.get(mixins)\n if (known !== undefined) return known\n const found = mixins.some(mixin => Object.values(mixin.contributions).some(isDynamic))\n readsInput.set(mixins, found)\n return found\n}\n\n/**\n * One part, from its arguments alone, so the memo sees one function: the\n * whole input only when a view-wide Mixin reads it, and the part's read values.\n */\nconst drawPart = <Slots, Input, Message>(\n part: Part<Slots, Input, Message>,\n slots: Slots,\n h: HtmlBuilder<Message>,\n mixins: ReadonlyArray<MixinFor<Message>>,\n whole: unknown,\n ...values: Array<unknown>\n): Html => {\n started++\n const selection = Object.fromEntries(part.reads.map((key, at) => [key, values[at]]))\n const groups = [\n { mixins: part.mixins, input: selection },\n { mixins, input: whole },\n ]\n return part.render(selection, buildersOver(slots, groups, h), h)\n}\n\n/**\n * Parts over one set of Slots and one input, and the assembly that places them.\n *\n * @example\n * ```ts\n * const Parts = SlotView.parts(PanelSlots)<PanelInput, Message>()\n * const Title = Parts.part('Title', { reads: ['title'] }, (input, slots, h) =>\n * h.h2(slots.title.attrs(), [input.title]),\n * )\n * const Panel = Parts.assemble((input, slots, h, draw) => h.section(slots.root.attrs(), [draw(Title)]))\n * ```\n */\nexport const parts =\n <Slots>(slots: Slots) =>\n <Input, Message>(): Parts<Slots, Input, Message> => ({\n part: (name, options, render) => ({\n name,\n reads: options.reads,\n mixins: (options.behaviors ?? []).map(behavior => behavior.mixin),\n render,\n }),\n assemble: (render, options) =>\n makeView<Slots, Input, Message>(options?.name, slots, [], (input, builders, h) => {\n const mixins: ReadonlyArray<MixinFor<Message>> = mixinsOf.get(builders) ?? []\n // A Mixin attached to the whole view that reads the input is resolved\n // against all of it, so a part it reaches redraws whenever the input changes.\n const whole = anyDynamic(mixins) ? input : undefined\n return render(input, builders, h, part => {\n const args: Parameters<typeof drawPart<Slots, Input, Message>> = [\n part,\n slots,\n h,\n mixins,\n whole,\n ...part.reads.map(key => input[key]),\n ]\n return memoizedOr(\n () => lazyOf(part)(drawPart<Slots, Input, Message>, args),\n () => drawPart(...args),\n )\n })\n }),\n })\n","/**\n * Slot witnesses. Ported from `effect-atom-jsx/src/View.ts` `Slot`, without\n * Handle binding. A slot is named metadata: capability, allowed events,\n * attributes, platform requirements, hidden, and Foldkit-only `protected`.\n */\nimport type { AttrToken } from './attr.js'\nimport type { Any as AnyCapability } from './capability.js'\nimport * as Capability from './capability.js'\nimport type { EventToken } from './event.js'\nimport * as MetadataToken from './metadataToken.js'\nimport { pipeSelf, type Pipeable } from './pipe.js'\nimport type { RequirementToken } from './requirement.js'\n\nexport const SlotTypeId: unique symbol = Symbol.for('foldkit-mixins/Slot')\nexport type SlotTypeId = typeof SlotTypeId\n\nexport type EventName = string | EventToken\nexport type AttributeName = string | AttrToken\nexport type RequirementName = string | RequirementToken\nexport type SlotCapability = string | AnyCapability\n\nexport interface SlotProtection {\n readonly events: ReadonlyArray<EventName>\n readonly attributes: ReadonlyArray<AttributeName>\n readonly style: ReadonlyArray<string>\n}\n\nexport interface SlotMetadata<Name extends string = string> {\n readonly name: Name\n readonly capability: SlotCapability\n readonly allowedEvents: readonly EventName[]\n readonly allowedAttributes: readonly AttributeName[]\n readonly platformRequirements: readonly RequirementName[]\n readonly hidden: boolean\n readonly protected: SlotProtection\n}\n\nexport interface Slot<\n Name extends string = string,\n C extends SlotCapability = typeof Capability.Base,\n Events extends readonly EventName[] = readonly [],\n Attributes extends readonly AttributeName[] = readonly [],\n Requirements extends readonly RequirementName[] = readonly [],\n Hidden extends boolean = false,\n> extends Pipeable<Slot<Name, C, Events, Attributes, Requirements, Hidden>> {\n readonly [SlotTypeId]: {\n readonly Name: Name\n readonly Capability: C\n readonly Events: Events\n readonly Attributes: Attributes\n readonly Requirements: Requirements\n readonly Hidden: Hidden\n }\n readonly name: Name\n readonly capability: C\n readonly events: Events\n readonly attributes: Attributes\n readonly requirements: Requirements\n readonly hidden: Hidden\n readonly protected: SlotProtection\n readonly metadata: SlotMetadata<Name> & {\n readonly capability: C\n readonly allowedEvents: Events\n readonly allowedAttributes: Attributes\n readonly platformRequirements: Requirements\n readonly hidden: Hidden\n }\n}\n\nexport type Any = Slot<\n string,\n SlotCapability,\n readonly EventName[],\n readonly AttributeName[],\n readonly RequirementName[],\n boolean\n>\n\nexport type UnnamedSlot<\n C extends SlotCapability = SlotCapability,\n Events extends readonly EventName[] = readonly EventName[],\n Attributes extends readonly AttributeName[] = readonly AttributeName[],\n Requirements extends readonly RequirementName[] = readonly RequirementName[],\n Hidden extends boolean = boolean,\n> = Omit<Slot<'', C, Events, Attributes, Requirements, Hidden>, 'name'> & {\n readonly name?: never\n}\n\nexport type NameOf<T> = T extends Slot<infer Name, any, any, any, any, any> ? Name : never\nexport type CapabilityOf<T> =\n T extends Slot<any, infer C, any, any, any, any> ? MetadataToken.NameOf<C> : never\nexport type CapabilityValueOf<T> = T extends Slot<any, infer C, any, any, any, any> ? C : never\nexport type EventsOf<T> =\n T extends Slot<any, any, infer Events, any, any, any> ? MetadataToken.NamesOf<Events> : never\nexport type AttributesOf<T> =\n T extends Slot<any, any, any, infer Attributes, any, any>\n ? MetadataToken.NamesOf<Attributes>\n : never\nexport type HiddenOf<T> = T extends Slot<any, any, any, any, any, infer Hidden> ? Hidden : never\nexport type AssignableCapabilityNamesOf<T> = Capability.AssignableNamesOf<CapabilityValueOf<T>>\nexport type Public<T> = HiddenOf<T> extends true ? never : T\nexport type Hidden<T> = HiddenOf<T> extends true ? T : never\n\nexport const is = (value: unknown): value is Any | UnnamedSlot =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, SlotTypeId)\n\nconst emptyProtection: SlotProtection = Object.freeze({\n events: Object.freeze([]) as ReadonlyArray<EventName>,\n attributes: Object.freeze([]) as ReadonlyArray<AttributeName>,\n style: Object.freeze([]) as ReadonlyArray<string>,\n})\n\nexport interface MakeOptions<\n C extends SlotCapability = SlotCapability,\n Events extends readonly EventName[] = readonly EventName[],\n Attributes extends readonly AttributeName[] = readonly AttributeName[],\n Requirements extends readonly RequirementName[] = readonly RequirementName[],\n Hidden extends boolean = boolean,\n> {\n readonly capability?: C\n readonly events?: Events\n readonly allowedEvents?: Events\n readonly attributes?: Attributes\n readonly allowedAttributes?: Attributes\n readonly requirements?: Requirements\n readonly platformRequirements?: Requirements\n readonly hidden?: Hidden\n readonly protected?: {\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n readonly style?: ReadonlyArray<string>\n }\n}\n\nconst protectionOf = (options: MakeOptions | undefined): SlotProtection => {\n const specified = options?.protected\n if (specified === undefined) return emptyProtection\n return Object.freeze({\n events: Object.freeze([...(specified.events ?? [])]),\n attributes: Object.freeze([...(specified.attributes ?? [])]),\n style: Object.freeze([...(specified.style ?? [])]),\n })\n}\n\nconst createSlot = <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n>(\n name: Name,\n options: MakeOptions<C, Events, Attributes, Requirements, Hidden> | undefined,\n): Slot<Name, C, Events, Attributes, Requirements, Hidden> => {\n const capability = (options?.capability ?? Capability.Base) as C\n const events = (options?.events ?? options?.allowedEvents ?? []) as Events\n const attributes = (options?.attributes ?? options?.allowedAttributes ?? []) as Attributes\n const requirements = (options?.requirements ??\n options?.platformRequirements ??\n []) as Requirements\n const hidden = (options?.hidden ?? false) as Hidden\n const protection = protectionOf(options)\n const metadata = {\n name,\n capability,\n allowedEvents: events,\n allowedAttributes: attributes,\n platformRequirements: requirements,\n hidden,\n protected: protection,\n }\n const out = {\n [SlotTypeId]: {\n Name: undefined as unknown as Name,\n Capability: undefined as unknown as C,\n Events: undefined as unknown as Events,\n Attributes: undefined as unknown as Attributes,\n Requirements: undefined as unknown as Requirements,\n Hidden: undefined as unknown as Hidden,\n },\n name,\n capability,\n events,\n attributes,\n requirements,\n hidden,\n protected: protection,\n metadata,\n } as Slot<Name, C, Events, Attributes, Requirements, Hidden>\n return Object.assign(out, {\n pipe: (...fns: ReadonlyArray<(value: any) => any>) => pipeSelf(out, fns),\n }) as Slot<Name, C, Events, Attributes, Requirements, Hidden>\n}\n\n/** AF-UI form: name is the first argument. */\nexport function make<\n const Name extends string,\n const C extends SlotCapability = typeof Capability.Base,\n const Events extends readonly EventName[] = readonly [],\n const Attributes extends readonly AttributeName[] = readonly [],\n const Requirements extends readonly RequirementName[] = readonly [],\n const Hidden extends boolean = false,\n>(\n name: Name,\n options?: MakeOptions<C, Events, Attributes, Requirements, Hidden>,\n): Slot<Name, C, Events, Attributes, Requirements, Hidden>\n/** Foldkit form: name comes from `Slots.define` keys. */\nexport function make<\n const C extends SlotCapability = typeof Capability.Base,\n const Events extends readonly EventName[] = readonly [],\n const Attributes extends readonly AttributeName[] = readonly [],\n const Requirements extends readonly RequirementName[] = readonly [],\n const Hidden extends boolean = false,\n>(\n options: MakeOptions<C, Events, Attributes, Requirements, Hidden>,\n): UnnamedSlot<C, Events, Attributes, Requirements, Hidden>\nexport function make(\n nameOrOptions: string | MakeOptions,\n options?: MakeOptions,\n): Any | UnnamedSlot {\n if (typeof nameOrOptions === 'string') {\n return createSlot(nameOrOptions, options)\n }\n const unnamed = createSlot('', nameOrOptions)\n const { name: _dropped, ...rest } = unnamed\n return rest as UnnamedSlot\n}\n\n/** Pipeable transform replacing a named slot's capability. */\nexport const capability =\n <const C extends SlotCapability>(capability: C) =>\n <\n Name extends string,\n OldC extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n >(\n slot: Slot<Name, OldC, Events, Attributes, Requirements, Hidden>,\n ): Slot<Name, C, Events, Attributes, Requirements, Hidden> =>\n createSlot(slot.name, {\n capability,\n events: slot.events,\n attributes: slot.attributes,\n requirements: slot.requirements,\n hidden: slot.hidden,\n protected: slot.protected,\n })\n\n/** Pipeable transform replacing a named slot's allowed events. */\nexport const events =\n <const Next extends readonly EventName[]>(...next: Next) =>\n <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n >(\n slot: Slot<Name, C, Events, Attributes, Requirements, Hidden>,\n ): Slot<Name, C, Next, Attributes, Requirements, Hidden> =>\n createSlot(slot.name, {\n capability: slot.capability,\n events: next,\n attributes: slot.attributes,\n requirements: slot.requirements,\n hidden: slot.hidden,\n protected: slot.protected,\n })\n\n/** Pipeable transform replacing a named slot's allowed attributes. */\nexport const attributes =\n <const Next extends readonly AttributeName[]>(...next: Next) =>\n <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n >(\n slot: Slot<Name, C, Events, Attributes, Requirements, Hidden>,\n ): Slot<Name, C, Events, Next, Requirements, Hidden> =>\n createSlot(slot.name, {\n capability: slot.capability,\n events: slot.events,\n attributes: next,\n requirements: slot.requirements,\n hidden: slot.hidden,\n protected: slot.protected,\n })\n\n/** Pipeable transform replacing a named slot's platform requirements. */\nexport const requires =\n <const Next extends readonly RequirementName[]>(...next: Next) =>\n <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n >(\n slot: Slot<Name, C, Events, Attributes, Requirements, Hidden>,\n ): Slot<Name, C, Events, Attributes, Next, Hidden> =>\n createSlot(slot.name, {\n capability: slot.capability,\n events: slot.events,\n attributes: slot.attributes,\n requirements: next,\n hidden: slot.hidden,\n protected: slot.protected,\n })\n\n/** Pipeable transform marking a named slot hidden from public attachment. */\nexport const hide = <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n>(\n slot: Slot<Name, C, Events, Attributes, Requirements, Hidden>,\n): Slot<Name, C, Events, Attributes, Requirements, true> =>\n createSlot(slot.name, {\n capability: slot.capability,\n events: slot.events,\n attributes: slot.attributes,\n requirements: slot.requirements,\n hidden: true,\n protected: slot.protected,\n })\n\nexport const describe = (\n slot: Any | UnnamedSlot,\n): {\n readonly name?: string\n readonly capability: string\n readonly events: ReadonlyArray<string>\n readonly attributes: ReadonlyArray<string>\n readonly requirements: ReadonlyArray<string>\n readonly hidden: boolean\n readonly protected: {\n readonly events: ReadonlyArray<string>\n readonly attributes: ReadonlyArray<string>\n readonly style: ReadonlyArray<string>\n }\n} => {\n const named = slot.name !== undefined && slot.name !== '' ? { name: slot.name } : {}\n return {\n ...named,\n capability: MetadataToken.nameOf(slot.capability),\n events: slot.events.map(event => MetadataToken.nameOf(event)),\n attributes: slot.attributes.map(attr => MetadataToken.nameOf(attr)),\n requirements: slot.requirements.map(requirement => MetadataToken.nameOf(requirement)),\n hidden: slot.hidden,\n protected: {\n events: slot.protected.events.map(event => MetadataToken.nameOf(event)),\n attributes: slot.protected.attributes.map(attr => MetadataToken.nameOf(attr)),\n style: slot.protected.style,\n },\n }\n}\n","/**\n * Slot contracts. Ported from `effect-atom-jsx/src/View.ts` `Slots.define`,\n * without minting element Handles. Names come from keys. Entries may be\n * `Slot.make({...})` or AF-UI option objects `{ capability, allowedEvents }`.\n */\nimport * as Capability from './capability.js'\nimport * as Slot from './slot.js'\nimport type {\n Any as AnySlot,\n MakeOptions,\n Slot as NamedSlot,\n SlotCapability,\n UnnamedSlot,\n} from './slot.js'\n\nexport const SlotsTypeId: unique symbol = Symbol.for('foldkit-mixins/Slots')\n\nexport type Contract<S extends { readonly [K in keyof S]: UnnamedSlot | MakeOptions }> = {\n readonly [K in keyof S]: S[K] extends UnnamedSlot<\n infer C,\n infer Events,\n infer Attributes,\n infer Requirements,\n infer Hidden\n >\n ? NamedSlot<K & string, C, Events, Attributes, Requirements, Hidden>\n : S[K] extends MakeOptions<\n infer C,\n infer Events,\n infer Attributes,\n infer Requirements,\n infer Hidden\n >\n ? NamedSlot<K & string, C, Events, Attributes, Requirements, Hidden>\n : never\n}\n\nexport type NamesOf<T> = keyof T & string\nexport type PublicNamesOf<T> = {\n readonly [K in keyof T & string]: Slot.HiddenOf<T[K]> extends true ? never : K\n}[keyof T & string]\nexport type HiddenNamesOf<T> = {\n readonly [K in keyof T & string]: Slot.HiddenOf<T[K]> extends true ? K : never\n}[keyof T & string]\nexport type WithCapability<T, C extends SlotCapability> = {\n readonly [\n K in keyof T & string as Capability.NameOf<C> extends Slot.AssignableCapabilityNamesOf<T[K]>\n ? K\n : never\n ]: T[K]\n}\n\nconst toUnnamed = (value: unknown, key: string): UnnamedSlot => {\n if (Slot.is(value)) {\n return value as UnnamedSlot\n }\n if (typeof value === 'object' && value !== null && Object.hasOwn(value, 'capability')) {\n return Slot.make(value as MakeOptions)\n }\n throw new Error(`Slots.define: \"${key}\" is not a Slot or slot options object`)\n}\n\nexport const define = <const S extends { readonly [K in keyof S]: UnnamedSlot | MakeOptions }>(\n spec: S,\n): Contract<S> => {\n const proto = Object.getPrototypeOf(spec)\n if (proto !== Object.prototype && proto !== null) {\n throw new Error(\n 'Slots.define: pass a plain object; quote [\"__proto__\"] to use that as a slot name',\n )\n }\n const contract = Object.create(null) as Record<string, NamedSlot>\n for (const key of Object.getOwnPropertyNames(spec)) {\n const unnamed = toUnnamed((spec as Record<string, unknown>)[key], key)\n Object.defineProperty(contract, key, {\n value: Slot.make(key, {\n capability: unnamed.capability,\n events: unnamed.events,\n attributes: unnamed.attributes,\n requirements: unnamed.requirements,\n hidden: unnamed.hidden,\n protected: unnamed.protected,\n }),\n enumerable: true,\n configurable: false,\n writable: false,\n })\n }\n Object.freeze(contract)\n return contract as unknown as Contract<S>\n}\n\nexport const describe = (contract: {\n readonly [key: string]: AnySlot | UnnamedSlot\n}): {\n readonly slots: Readonly<\n Record<\n string,\n {\n readonly name: string\n readonly capability: string\n readonly events: ReadonlyArray<string>\n readonly attributes: ReadonlyArray<string>\n readonly requirements: ReadonlyArray<string>\n readonly hidden: boolean\n readonly protected: {\n readonly events: ReadonlyArray<string>\n readonly attributes: ReadonlyArray<string>\n readonly style: ReadonlyArray<string>\n }\n }\n >\n >\n} => {\n const slots: Record<string, ReturnType<typeof Slot.describe> & { readonly name: string }> =\n Object.create(null)\n for (const key of Object.getOwnPropertyNames(contract)) {\n const slot = contract[key]\n if (slot === undefined || !Slot.is(slot)) continue\n const described = Slot.describe(slot)\n slots[key] = {\n ...described,\n name: slot.name !== undefined && slot.name !== '' ? slot.name : key,\n }\n }\n return { slots }\n}\n\nexport const withCapability = <\n T extends { readonly [key: string]: AnySlot },\n C extends SlotCapability,\n>(\n contract: T,\n capability: C,\n): WithCapability<T, C> => {\n const out = Object.create(null) as Record<string, AnySlot>\n for (const key of Object.getOwnPropertyNames(contract)) {\n const slot = contract[key]\n if (slot === undefined || !Slot.is(slot)) continue\n if (Capability.extendsCapability(slot.capability, capability)) {\n out[key] = slot\n }\n }\n return out as WithCapability<T, C>\n}\n","/**\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 * as Mixin from './mixin.js'\nimport type { Mixin as MixinValue } 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 { register, 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 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 conditions: Object.freeze([\n { predicate: (input: unknown) => predicate(input as Input), 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 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)\n collected.push({ className: generated, css })\n }\n const conditions = (style.conditions ?? []).map(condition => ({\n predicate: condition.predicate,\n piece: compileTree(condition.piece, 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 tree = compileTree(style, collected)\n const globalRules = collectGlobalCss(style)\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\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>(options?.name ?? 'Style', contributions),\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>(\n view: SlotView.SlotView<ViewSlots, Input, Message>,\n ): SlotView.SlotView<ViewSlots, Input, Message> =>\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\nexport type RecipeSelection<D extends AnyRecipeDef> = {\n readonly [K in keyof NonNullable<D['variants']>]?: keyof NonNullable<D['variants']>[K] & 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> = {}\n for (const [variant, values] of Object.entries(def.variants ?? {})) {\n const chosen =\n (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> = {\n readonly [K in keyof Variants]?: (keyof Variants[K] & string) | null\n}\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\nexport interface SlotRecipe<Slots, Variants extends SlotRecipeVariants<Slots>> {\n (selection?: SlotRecipeSelection<Variants>): StyleValues<Slots>\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: (patch: SlotRecipePatch<Slots, Variants>) => SlotRecipe<Slots, Variants>\n}\n\nconst mergePieces = <Slots>(\n left: StylePieces<Slots> | undefined,\n right: StylePieces<Slots> | undefined,\n): StyleValues<Slots> => {\n const merged: Record<string, StyleValue> = {}\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> = {}>(\n def: SlotRecipeDef<Slots, Variants>,\n ): SlotRecipe<Slots, Variants> => {\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> = {}\n for (const [axis, values] of Object.entries(axes)) {\n const picked = (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>): SlotRecipe<Slots, Variants> => {\n const variants: Record<string, Record<string, StylePieces<Slots>>> = {}\n for (const [axis, values] of Object.entries(axes)) {\n variants[axis] = { ...(values as Record<string, StylePieces<Slots>>) }\n }\n for (const [axis, values] of Object.entries(patch.variants ?? {})) {\n const target = variants[axis] ?? {}\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 return Object.assign(select, { def: full, extend })\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> = {}\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} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,MAAa,sBAAqC,OAAO,IAAI,8BAA8B;AAoB3F,MAAaA,UACX,MACA,SAC8B;CAC9B,IAAI,SAAS,IACX,MAAM,IAAI,MAAM,GAAG,KAAK,wBAAwB;CAElD,OAAO;GACJ,sBAAsB;GACrB,MAAM,KAAA;GACN,MAAM,K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,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,SAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,OAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"style-CmHD4Ul3.mjs","names":["make","is","is","MetadataToken.is","make","MetadataToken.nameOf","MetadataToken.make","describe","ih","make","MetadataToken.nameOf","define","attach","Capability.Base","describe","MetadataToken.nameOf","Slot.is","Slot.make","Slot.describe","Capability.extendsCapability","empty","make","compose","Rules.className","css","Rules.css","Mixin.dynamic","SlotView.attach","Capability.extendsCapability","SlotModule.make","Capability.Container","defineSlots"],"sources":["../src/metadataToken.ts","../src/capability.ts","../src/attribute.ts","../src/mixin.ts","../src/pipe.ts","../src/resolver.ts","../src/slotView.ts","../src/slot.ts","../src/slots.ts","../src/style.ts"],"sourcesContent":["/**\n * Ported from `effect-atom-jsx/src/MetadataToken.ts`. Kinded name tokens so\n * Event, Attr, Requirement, and Capability share one witness instead of four\n * ad-hoc brands.\n */\nexport const MetadataTokenTypeId: unique symbol = Symbol.for('foldkit-mixins/MetadataToken')\n\nexport interface MetadataToken<Kind extends string, Name extends string> {\n readonly [MetadataTokenTypeId]: {\n readonly Kind: Kind\n readonly Name: Name\n }\n readonly kind: Kind\n readonly name: Name\n}\n\nexport type Any = MetadataToken<string, string>\n\nexport type NameOf<T> =\n T extends MetadataToken<any, infer Name> ? Name : T extends string ? T : never\n\nexport type KindOf<T> = T extends MetadataToken<infer Kind, any> ? Kind : never\n\nexport type NamesOf<T extends readonly unknown[]> = NameOf<T[number]>\n\nexport const make = <const Kind extends string, const Name extends string>(\n kind: Kind,\n name: Name,\n): MetadataToken<Kind, Name> => {\n if (name === '') {\n throw new Error(`${kind} name must be non-empty`)\n }\n return {\n [MetadataTokenTypeId]: {\n Kind: undefined as unknown as Kind,\n Name: undefined as unknown as Name,\n },\n kind,\n name,\n }\n}\n\nexport const is = (value: unknown): value is Any =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, MetadataTokenTypeId)\n\nexport const nameOf = (value: string | Any): string => (is(value) ? value.name : value)\n","/**\n * Ported from `effect-atom-jsx/src/Element.ts` `Capability`, without Handle\n * objects. Inheritance is metadata: a behavior that needs Interactive can\n * attach to TextInput. Lookups go through a Map so `__proto__` is a legal name.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type CapabilityParent = string | MetadataToken.MetadataToken<'element.capability', string>\n\nexport interface Capability<\n Name extends string = string,\n Extends extends readonly CapabilityParent[] = readonly [],\n> extends MetadataToken.MetadataToken<'element.capability', Name> {\n readonly extends: Extends\n}\n\nexport type Any = Capability<string, readonly CapabilityParent[]>\nexport type NameOf<T> = MetadataToken.NameOf<T>\nexport type NamesOf<T extends readonly unknown[]> = MetadataToken.NamesOf<T>\nexport type ExtendsOf<T> =\n T extends Capability<any, infer Extends> ? MetadataToken.NameOf<Extends[number]> : never\nexport type AssignableNamesOf<T> = T extends string\n ? T\n : T extends Capability<any, infer Extends>\n ? MetadataToken.NameOf<T> | AssignableNamesOf<Extends[number]>\n : MetadataToken.NameOf<T>\n\nexport type Satisfies<Actual, Required extends { readonly name: string }> =\n Required['name'] extends AssignableNamesOf<Actual> ? true : false\n\nconst parentsByName = new Map<string, ReadonlyArray<string>>()\nconst registry = new Map<string, Any>()\n\nexport const is = (value: unknown): value is Any =>\n MetadataToken.is(value) && value.kind === 'element.capability'\n\nexport const make = <\n const Name extends string,\n const Extends extends readonly CapabilityParent[] = readonly [],\n>(\n name: Name,\n options?: { readonly extends?: Extends },\n): Capability<Name, Extends> => {\n if (name === '') {\n throw new Error('Capability name must be non-empty')\n }\n const parents = (options?.extends ?? []) as Extends\n const parentNames = parents.map(parent => MetadataToken.nameOf(parent))\n const existing = registry.get(name)\n if (existing !== undefined) {\n const existingNames = existing.extends.map(parent => MetadataToken.nameOf(parent))\n if (\n existingNames.length === parentNames.length &&\n existingNames.every((parentName, index) => parentName === parentNames[index])\n ) {\n return existing as Capability<Name, Extends>\n }\n throw new Error(`Capability \"${name}\" is already defined with a different extends list`)\n }\n parentsByName.set(name, parentNames)\n const capability: Capability<Name, Extends> = {\n ...MetadataToken.make('element.capability', name),\n extends: Object.freeze([...parents]) as Extends,\n }\n registry.set(name, capability)\n return Object.freeze(capability)\n}\n\n/** True when `value` is `base` or inherits from it. Ported from AF-UI. */\nexport const extendsCapability = (value: string | Any, base: string | Any): boolean => {\n const valueName = MetadataToken.nameOf(value)\n const baseName = MetadataToken.nameOf(base)\n if (valueName === baseName) return true\n const visited = new Set<string>()\n const stack = [...(parentsByName.get(valueName) ?? [])]\n while (stack.length > 0) {\n const current = stack.pop()\n if (current === undefined) continue\n if (current === baseName) return true\n if (visited.has(current)) continue\n visited.add(current)\n stack.push(...(parentsByName.get(current) ?? []))\n }\n return false\n}\n\nexport const satisfies = (actual: string | Any, required: string | Any): boolean =>\n extendsCapability(actual, required)\n\nexport const names = (capability: Any): ReadonlyArray<string> => {\n const seen = new Set<string>()\n const walk = (name: string) => {\n if (seen.has(name)) return\n seen.add(name)\n for (const parent of parentsByName.get(name) ?? []) walk(parent)\n }\n walk(capability.name)\n return [...seen]\n}\n\nexport const describe = (\n capability: Any,\n): { readonly name: string; readonly extends: ReadonlyArray<string> } => ({\n name: capability.name,\n extends: capability.extends.map(parent => MetadataToken.nameOf(parent)),\n})\n\nexport const Base = make('Base')\nexport const Interactive = make('Interactive', { extends: [Base] })\nexport const Container = make('Container', { extends: [Interactive] })\nexport const Focusable = make('Focusable', { extends: [Interactive] })\nexport const TextInput = make('TextInput', { extends: [Focusable] })\nexport const Draggable = make('Draggable', { extends: [Interactive] })\nexport const Collection = make('Collection', { extends: [Base] })\n","/**\n * Internal attribute helpers. Foldkit's `isChildAttribute` and the tagged\n * attribute shape are not public, so this module reads them in one place.\n * Probed against foldkit 0.158.2; see docs/design/mixins-DESIGN.md.\n */\nimport type { Attribute, ChildAttribute } from 'foldkit/html'\nimport { inertHtml as ih } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\n\n/** The brand `childAttribute.d.ts` stamps; Foldkit's guard is not exported. */\nconst CHILD_ATTRIBUTE_BRAND = '__childAttribute'\n\nexport const isChildAttribute = (value: unknown): value is ChildAttribute =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, CHILD_ATTRIBUTE_BRAND)\n\ninterface Tagged {\n readonly _tag: string\n}\n\nexport const isTagged = (value: unknown): value is Tagged =>\n typeof value === 'object' &&\n value !== null &&\n // `hasOwn` refuses an inherited tag; `in` is what narrows the type.\n Object.hasOwn(value, '_tag') &&\n '_tag' in value &&\n typeof value._tag === 'string'\n\n/** `Class` carries no Message, so the inert builder is the honest constructor. */\nexport const classAttribute = (value: string): Attribute<never> => ih.Class(value)\n\nexport const styleAttribute = (value: Record<string, string>): Attribute<never> => ih.Style(value)\n\n/**\n * `inertHtml.OnMount` only accepts `MountAction<never>`, so a Message-bearing\n * mount is built directly. The shape is the same tagged value `h.OnMount`\n * produces (`{ _tag: 'OnMount', action }`).\n */\nexport const mountAttribute = <Message>(action: MountAction<Message, any>): Attribute<Message> =>\n ({ _tag: 'OnMount', action }) as Attribute<Message>\n","/**\n * `Mixin` is the common algebra: a named set of per-slot contributions.\n *\n * `StaticMixin` holds only static contributions, so it stays assignable to any\n * Message universe; Style uses it. `Mixin` may hold deferred contributions and\n * is tied to one Message universe; Behavior uses it. Composition is immutable\n * and keeps the deferred form when either side is deferred.\n */\nimport type {\n Contribution,\n ContributionContext,\n DynamicContribution,\n SlotContribution,\n StaticContribution,\n StaticContributionMap,\n} from './contribution.js'\n\nexport interface Mixin<Message = never> {\n readonly name: string\n readonly contributions: Contribution<Message>\n}\n\nexport interface StaticMixin<Message = never> {\n readonly name: string\n readonly contributions: StaticContributionMap<Message>\n}\n\nexport type AnyMixin = Mixin<any> | StaticMixin<any>\n\n/**\n * A Mixin acceptable in any context of `Message`. `Mixin<never>` is included\n * explicitly because a message-free dynamic Mixin (input-driven Style) does not\n * widen to `Mixin<Message>` — `HtmlBuilder` is invariant in `Message`.\n */\nexport type MixinFor<Message> = Mixin<Message> | StaticMixin<Message> | Mixin<never>\n\nexport const isDynamic = <Message>(\n contribution: SlotContribution<Message>,\n): contribution is DynamicContribution<Message> => typeof contribution === 'function'\n\nexport const evaluate = <Message>(\n contribution: SlotContribution<Message>,\n context: ContributionContext<Message>,\n): StaticContribution<Message> => (isDynamic(contribution) ? contribution(context) : contribution)\n\nconst mergeStatic = <Message>(\n left: StaticContribution<Message>,\n right: StaticContribution<Message>,\n): StaticContribution<Message> => {\n const css = `${left.css ?? ''}${right.css ?? ''}`\n const globalCss = `${left.globalCss ?? ''}${right.globalCss ?? ''}`\n return Object.freeze({\n classes: Object.freeze([...(left.classes ?? []), ...(right.classes ?? [])]),\n style: Object.freeze({ ...(left.style ?? {}), ...(right.style ?? {}) }),\n attributes: Object.freeze([...(left.attributes ?? []), ...(right.attributes ?? [])]),\n mounts: Object.freeze([...(left.mounts ?? []), ...(right.mounts ?? [])]),\n ...(css === '' ? {} : { css }),\n ...(globalCss === '' ? {} : { globalCss }),\n })\n}\n\nconst mergeSlot = <Message>(\n left: SlotContribution<Message>,\n right: SlotContribution<Message>,\n): SlotContribution<Message> => {\n if (!isDynamic(left) && !isDynamic(right)) return mergeStatic(left, right)\n return context => mergeStatic(evaluate(left, context), evaluate(right, context))\n}\n\nexport const make = <Message = never>(\n name: string,\n contributions: StaticContributionMap<Message>,\n): StaticMixin<Message> =>\n Object.freeze({ name, contributions: Object.freeze({ ...contributions }) })\n\nexport const dynamic = <Message = never>(\n name: string,\n contributions: Contribution<Message>,\n): Mixin<Message> => Object.freeze({ name, contributions: Object.freeze({ ...contributions }) })\n\nexport const empty = <Message = never>(): StaticMixin<Message> => make('Empty', {})\n\nexport const compose = <Message = never>(\n ...mixins: ReadonlyArray<MixinFor<Message>>\n): Mixin<Message> => {\n const merged: Record<string, SlotContribution<Message>> = Object.create(null)\n for (const mixin of mixins) {\n for (const [slot, contribution] of Object.entries(mixin.contributions)) {\n if (contribution === undefined) continue\n // A `Mixin<never>` may only contribute message-free data; the cast lets it\n // compose with a message-bearing Mixin under one algebra.\n const normalized = contribution as SlotContribution<Message>\n const existing = merged[slot]\n merged[slot] = existing === undefined ? normalized : mergeSlot(existing, normalized)\n }\n }\n return dynamic(mixins.length === 0 ? 'Empty' : mixins.map(mixin => mixin.name).join('+'), merged)\n}\n\nexport const contributionsFor = <Message>(\n mixin: Mixin<Message> | StaticMixin<Message>,\n slot: string,\n): SlotContribution<Message> | undefined => mixin.contributions[slot]\n","/** Ported from `effect-atom-jsx/src/View.ts` `pipeSelf`. */\nexport const pipeSelf = (self: unknown, fns: ReadonlyArray<(value: any) => any>): unknown =>\n fns.reduce((acc, fn) => fn(acc), self)\n\nexport type Pipeable<Self> = {\n pipe(): Self\n pipe(...fns: ReadonlyArray<(self: Self) => Self>): Self\n pipe<A>(ab: (self: Self) => A): A\n pipe<A, B>(ab: (self: Self) => A, bc: (a: A) => B): B\n pipe<A, B, C>(ab: (self: Self) => A, bc: (a: A) => B, cd: (b: B) => C): C\n}\n","/**\n * The deterministic resolver. `resolve` is pure: it decomposes the base\n * attributes, applies contributions in attachment order, enforces ownership\n * and protection, then emits one canonical `Class`, one `Style`, and at most\n * one `OnMount`. Conflicts throw a `DiagnosticError` before Foldkit could\n * silently chain or replace.\n */\nimport { Stream } from 'effect'\nimport type { Attribute, ChildAttribute } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\nimport {\n classAttribute,\n isChildAttribute,\n isTagged,\n mountAttribute,\n styleAttribute,\n} from './attribute.js'\nimport type { StaticContribution } from './contribution.js'\nimport { DiagnosticError, type Diagnostic, type DiagnosticCode } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport type { SlotProtection } from './slot.js'\n\nexport type SlotAttributes<Message> = ReadonlyArray<Attribute<Message> | ChildAttribute>\n\nexport interface ResolveOptions {\n readonly slot?: string\n readonly protected?: SlotProtection\n}\n\n/** `AriaLabel` -> `arialabel`, `aria-label` -> `arialabel`; tags and tokens agree. */\nconst normalizeName = (name: string): string => name.replace(/[^a-z0-9]/gi, '').toLowerCase()\n\n/** Attribute tags are PascalCase (`OnKeyDown`); event tokens are lowercase. */\nconst eventNameOfTag = (tag: string): string =>\n normalizeName(tag.startsWith('On') ? tag.slice(2) : tag)\n\nconst splitClasses = (value: string): ReadonlyArray<string> =>\n value.split(/\\s+/).filter(token => token.length > 0)\n\n/** `Prop`/`Attribute`/`DataAttribute`/`OnCustomEvent` are keyed individually. */\nconst ownershipKey = (tag: string, value: unknown): string => {\n if (typeof value !== 'object' || value === null) return tag\n const record = value as { readonly key?: unknown; readonly name?: unknown }\n switch (tag) {\n case 'Prop':\n case 'Attribute':\n case 'DataAttribute':\n return `${tag}:${String(record.key)}`\n case 'OnCustomEvent':\n return `${tag}:${String(record.name)}`\n default:\n return tag\n }\n}\n\nconst toDiagnostic = (\n code: DiagnosticCode,\n message: string,\n slot: string | undefined,\n details: Readonly<Record<string, unknown>>,\n): Diagnostic => ({\n source: 'mixins',\n code,\n severity: 'error',\n message,\n ...(slot === undefined ? {} : { slot }),\n details,\n})\n\nexport const resolve = <Message>(\n base: SlotAttributes<Message> | undefined,\n contributions: ReadonlyArray<StaticContribution<Message>>,\n options: ResolveOptions = {},\n): SlotAttributes<Message> => {\n const slot = options.slot\n const protection = options.protected\n const protectedEvents = new Set(\n (protection?.events ?? []).map(event => normalizeName(MetadataToken.nameOf(event))),\n )\n const protectedAttributes = new Set(\n (protection?.attributes ?? []).map(attr => normalizeName(MetadataToken.nameOf(attr))),\n )\n const protectedStyle = new Set(protection?.style ?? [])\n\n const classes: Array<string> = []\n const classSeen = new Set<string>()\n const style = new Map<string, string>()\n // Who wrote each inline style property. Style pieces layer over the base and\n // over each other (that is restyling); a Behavior's property has one owner,\n // and a Style piece may not overwrite what a Behavior set.\n const styleOwners = new Map<string, 'base' | 'style' | 'behavior'>()\n const mounts: Array<MountAction<Message, any>> = []\n const mountNames = new Map<string, number>()\n const preserved: Array<Attribute<Message> | ChildAttribute> = []\n const added: Array<Attribute<Message> | ChildAttribute> = []\n const ownedEvents = new Map<string, string>()\n const ownedAttributes = new Map<string, string>()\n\n function fail(\n code: DiagnosticCode,\n message: string,\n details: Readonly<Record<string, unknown>>,\n ): never {\n throw new DiagnosticError(toDiagnostic(code, message, slot, details))\n }\n\n const addClass = (token: string): void => {\n if (classSeen.has(token)) return\n classSeen.add(token)\n classes.push(token)\n }\n\n const writeStyle = (\n property: string,\n value: string,\n writer: 'base' | 'style' | 'behavior',\n ): void => {\n if (writer !== 'base' && protectedStyle.has(property)) {\n fail(\n 'mixins:protected-style-property',\n `slot \"${slot ?? '?'}\" protects style property \"${property}\"`,\n { property },\n )\n }\n const owner = styleOwners.get(property)\n if (\n (writer === 'behavior' && owner !== undefined) ||\n (writer === 'style' && owner === 'behavior')\n ) {\n fail(\n 'mixins:style-property-conflict',\n `two owners for style property \"${property}\": ${owner === 'base' ? 'the view' : owner === 'style' ? 'a Style' : 'a Behavior'} already sets it`,\n { property, owner, writer },\n )\n }\n if (owner === undefined || writer === 'behavior') styleOwners.set(property, writer)\n style.set(property, value)\n }\n\n const addMount = (action: MountAction<Message, any>): void => {\n const count = (mountNames.get(action.name) ?? 0) + 1\n mountNames.set(action.name, count)\n if (count > 1) {\n fail('mixins:duplicate-mount-name', `two Mounts are both named \"${action.name}\"`, {\n name: action.name,\n })\n }\n mounts.push(action)\n }\n\n const reserve = (tag: string, value: unknown): void => {\n if (tag === 'OnMount') return\n // `OnCustomEvent` is keyed by its event name, not treated as one native event.\n if (tag.startsWith('On') && tag !== 'OnCustomEvent') {\n ownedEvents.set(eventNameOfTag(tag), tag)\n return\n }\n ownedAttributes.set(ownershipKey(tag, value), tag)\n }\n\n const addBase = (attribute: Attribute<Message> | ChildAttribute): void => {\n if (isChildAttribute(attribute)) {\n const inner = (attribute as { readonly attribute?: unknown }).attribute\n if (isTagged(inner)) reserve(inner._tag, inner)\n preserved.push(attribute)\n return\n }\n const tag = attribute._tag\n switch (tag) {\n case 'Class':\n for (const token of splitClasses(attribute.value)) addClass(token)\n return\n case 'Style':\n for (const [property, value] of Object.entries(attribute.value)) {\n writeStyle(property, value, 'base')\n }\n return\n case 'OnMount':\n addMount(attribute.action)\n return\n default:\n reserve(tag, attribute)\n preserved.push(attribute)\n }\n }\n\n const applyMixinAttribute = (attribute: Attribute<Message> | ChildAttribute): void => {\n if (isChildAttribute(attribute)) {\n const inner = (attribute as { readonly attribute?: unknown }).attribute\n if (isTagged(inner)) reserve(inner._tag, inner)\n added.push(attribute)\n return\n }\n const tag = attribute._tag\n switch (tag) {\n case 'Class':\n for (const token of splitClasses(attribute.value)) addClass(token)\n return\n case 'Style':\n // A `Style` attribute inside a contribution's attributes is a Behavior's.\n for (const [property, value] of Object.entries(attribute.value)) {\n writeStyle(property, value, 'behavior')\n }\n return\n case 'OnMount':\n addMount(attribute.action)\n return\n case 'Key':\n case 'InnerHTML':\n fail(\n 'mixins:structural-override',\n `a Mixin may not contribute \"${tag}\"; it is structural ownership`,\n { tag },\n )\n default:\n if (tag.startsWith('On') && tag !== 'OnCustomEvent') {\n const eventName = eventNameOfTag(tag)\n if (protectedEvents.has(eventName)) {\n fail('mixins:protected-event', `slot \"${slot ?? '?'}\" protects event \"${eventName}\"`, {\n tag,\n event: eventName,\n })\n }\n const owner = ownedEvents.get(eventName)\n if (owner !== undefined) {\n fail(\n 'mixins:event-conflict',\n `two owners for event \"${eventName}\": \"${owner}\" already owns it`,\n { tag, event: eventName, owner },\n )\n }\n ownedEvents.set(eventName, tag)\n } else {\n const key = ownershipKey(tag, attribute)\n if (protectedAttributes.has(normalizeName(tag))) {\n fail(\n 'mixins:protected-attribute',\n `slot \"${slot ?? '?'}\" protects attribute \"${tag}\"`,\n { tag },\n )\n }\n const owner = ownedAttributes.get(key)\n if (owner !== undefined) {\n fail(\n 'mixins:attribute-conflict',\n `two owners for \"${key}\": a ${owner} attribute already occupies it`,\n { tag, key, owner },\n )\n }\n ownedAttributes.set(key, tag)\n }\n added.push(attribute)\n }\n }\n\n for (const attribute of base ?? []) addBase(attribute)\n\n for (const contribution of contributions) {\n for (const token of contribution.classes ?? []) addClass(token)\n for (const [property, value] of Object.entries(contribution.style ?? {})) {\n writeStyle(property, value, 'style')\n }\n for (const attribute of contribution.attributes ?? []) applyMixinAttribute(attribute)\n for (const mount of contribution.mounts ?? []) addMount(mount)\n }\n\n const emitted: Array<Attribute<Message> | ChildAttribute> = []\n if (classes.length > 0) emitted.push(classAttribute(classes.join(' ')))\n if (style.size > 0) emitted.push(styleAttribute(Object.fromEntries(style)))\n emitted.push(...preserved, ...added)\n const composed = composeMounts(mounts, slot)\n if (composed !== undefined) emitted.push(composed)\n return emitted\n}\n\nconst composeMounts = <Message>(\n mounts: ReadonlyArray<MountAction<Message, any>>,\n slot: string | undefined,\n): Attribute<Message> | undefined => {\n const first = mounts[0]\n if (first === undefined) return undefined\n if (mounts.length === 1) return mountAttribute(first)\n const name = `Mixins[${slot ?? 'slot'}](${mounts.map(mount => mount.name).join(',')})`\n return mountAttribute({\n name,\n args: {\n slot: slot ?? null,\n actions: mounts.map(mount => ({ name: mount.name, args: mount.args })),\n },\n f: (element, viewStateChanges) =>\n Stream.mergeAll(\n mounts.map(mount => mount.f(element, viewStateChanges)),\n { concurrency: 'unbounded' },\n ),\n })\n}\n","/**\n * `SlotView` is the structural equivalent of a Surface: a pure Foldkit view\n * that publishes typed Slots and lets Mixins attach without forking it. It\n * owns no state and runs no Effects. Attached Mixins are resolved into\n * ordinary Foldkit attributes per slot, using the view's own `h` so Message\n * capability masking is preserved.\n */\nimport { createKeyedLazy, createLazy, inertHtml, type Html, type HtmlBuilder } from 'foldkit/html'\nimport type { NamedBehavior } from './behavior.js'\nimport type { SlotContribution, SlotItem } from './contribution.js'\nimport { ensure } from './inject.js'\nimport { SLOT_MARK, isMarking } from './slotMark.js'\nimport {\n evaluate,\n isDynamic,\n type AnyMixin,\n type Mixin,\n type MixinFor,\n type StaticMixin,\n} from './mixin.js'\nimport { pipeSelf, type Pipeable } from './pipe.js'\nimport { resolve, type SlotAttributes } from './resolver.js'\nimport type { Any as AnySlot, SlotProtection } from './slot.js'\n\nexport type SlotBuilder<Message, Slots = unknown> = {\n /**\n * The view's base attributes plus every resolved contribution. Pass `item`\n * when the slot is rendered once per item, so a Behavior can decorate each\n * repetition differently.\n */\n readonly attrs: (base?: SlotAttributes<Message>, item?: SlotItem) => SlotAttributes<Message>\n /**\n * One item's drawing, drawn again only when a value in `args` changed by\n * identity or what the Mixins gave the Slots it used for this item changed\n * in value (a static Style by identity). `draw` must read nothing but its\n * arguments, so pass a function defined once, not a closure made per\n * render. Keyed by `item.id`, else its index, and remembered per `draw`:\n * two views drawing one key with one `draw` share its memo, and miss it\n * whenever what they give it differs.\n */\n readonly lazy: <const Args extends Readonly<Record<string, unknown>>>(\n item: SlotItem,\n draw: (slots: SlotBuilders<Slots, Message>, h: HtmlBuilder<Message>, args: Args) => Html,\n args: Args,\n ) => Html\n}\n\nexport type SlotBuilders<Slots, Message> = {\n readonly [K in keyof Slots]: SlotBuilder<Message, Slots>\n}\n\nexport type SlotViewRender<Slots, Input, Message> = (\n input: Input,\n slots: SlotBuilders<Slots, Message>,\n h: HtmlBuilder<Message>,\n) => Html\n\nexport interface SlotView<Slots, Input, Message> extends Pipeable<SlotView<Slots, Input, Message>> {\n (input: Input, h: HtmlBuilder<Message>): Html\n readonly name?: string\n readonly slots: Slots\n readonly mixins: ReadonlyArray<MixinFor<Message>>\n readonly render: SlotViewRender<Slots, Input, Message>\n}\n\n/** Mixins resolved against one input: a part's own against its selection, the view's against the whole. */\ninterface MixinGroup<Message> {\n readonly mixins: ReadonlyArray<MixinFor<Message>>\n readonly input: unknown\n}\n\n// The view's Mixins behind each builders record `buildersFor` makes, so an\n// assembly's parts resolve the same ones; the array itself, so a memo can compare it.\nconst mixinsOf = new WeakMap<object, ReadonlyArray<MixinFor<any>>>()\n\n/** Like `buildersFor`, with each group of Mixins resolved against its own input, in order. */\nconst buildersOver = <Slots, Message>(\n slots: Slots,\n groups: ReadonlyArray<MixinGroup<Message>>,\n h: HtmlBuilder<Message>,\n): SlotBuilders<Slots, Message> => {\n const source = slots as unknown as Record<string, AnySlot>\n const builders: Record<string, SlotBuilder<Message>> = Object.create(null)\n for (const name of Object.getOwnPropertyNames(source)) {\n const slot = source[name]\n if (slot === undefined) continue\n const protection: SlotProtection = slot.protected\n builders[name] = {\n attrs: (base?: SlotAttributes<Message>, item?: SlotItem) => {\n using?.add(name)\n const contributions = []\n for (const { mixins, input } of groups) {\n for (const mixin of mixins) {\n const contribution = mixin.contributions[name]\n if (contribution !== undefined) {\n const evaluated = evaluate(contribution as SlotContribution<Message>, {\n input,\n h,\n ...(item === undefined ? {} : { item }),\n })\n // What this Slot draws brings its CSS, whether or not a stylesheet listed it.\n ensure(evaluated)\n contributions.push(evaluated)\n }\n }\n }\n const resolved = resolve(base, contributions, { slot: name, protected: protection })\n // Only while a test draws with `Inert.draw`: never for a real render.\n return isMarking() ? [...resolved, h.DataAttribute(SLOT_MARK, name)] : resolved\n },\n lazy: (item, draw, args) =>\n drawItem(item, draw, args, {\n builders: builders as SlotBuilders<Slots, Message>,\n h,\n given: used =>\n used.flatMap(slot =>\n groups.flatMap(({ mixins, input }) =>\n mixins.flatMap(mixin => {\n // As `attrs` reads it: a `Mixin<never>` only ever gives message-free data.\n const contribution = mixin.contributions[slot] as\n SlotContribution<Message> | undefined\n // A static one as it is: two views apart only by a Style draw rows apart.\n return contribution === undefined\n ? []\n : [isDynamic(contribution) ? contribution({ input, h, item }) : contribution]\n }),\n ),\n ),\n first: name,\n }),\n }\n }\n return builders as SlotBuilders<Slots, Message>\n}\n\n// The Slots the per-item drawing now running has used, if one is, and whether\n// it drew another inside it.\nconst NESTED = Symbol('nested')\nlet using: Set<string | typeof NESTED> | undefined\n\n/** One `draw`'s items: their memo, the Slots each used, and what those were given. */\ninterface ItemMemo {\n readonly lazy: ReturnType<typeof createKeyedLazy>\n readonly used: Map<PropertyKey, ReadonlyArray<string | typeof NESTED>>\n readonly given: Map<PropertyKey, unknown>\n}\nconst itemMemos = new WeakMap<object, ItemMemo>()\nconst itemMemoOf = (draw: object): ItemMemo => {\n const known = itemMemos.get(draw)\n if (known !== undefined) return known\n const made = { lazy: createKeyedLazy(), used: new Map(), given: new Map() }\n itemMemos.set(draw, made)\n return made\n}\n\n// The drawing a missed item runs: set just before the memo is asked, so the\n// memo sees one function whose arguments are all it compares.\nlet pending: (() => Html) | undefined\nconst runPending = (..._compared: ReadonlyArray<unknown>): Html => pending!()\n\n// How many memoized drawings have started. Foldkit's lazy slot throws before\n// it calls the drawing when there is no runtime frame, so a throw with this\n// unchanged is that, and a throw after it moved is the drawing's own error.\nlet started = 0\n\n/**\n * `memoized()` under a lazy slot, or `plain()` where there is no runtime frame\n * to memoize under (a test, a server's first pass). An error from the drawing\n * itself is thrown as it is, not drawn a second time.\n */\nconst memoizedOr = (memoized: () => Html, plain: () => Html): Html => {\n const before = started\n try {\n return memoized()\n } catch (error) {\n if (started !== before) throw error\n return plain()\n }\n}\n\nconst isPlain = (value: object): boolean => {\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null || Array.isArray(value)\n}\n\n/**\n * Whether two evaluated contributions hold the same data: arrays and plain\n * objects (Foldkit's attributes and Messages are) by value, anything else by\n * identity, since a `Map` or a `Date` keeps its contents where `Object.keys`\n * does not see them. A handler made per render is never the same, so an item\n * a Mixin gives one is drawn again every time: correct, not cached.\n */\nconst sameData = (left: unknown, right: unknown, depth = 0): boolean => {\n if (Object.is(left, right)) return true\n if (depth > 8) return false\n if (typeof left !== 'object' || typeof right !== 'object' || left === null || right === null)\n return false\n if (!isPlain(left) || Object.getPrototypeOf(left) !== Object.getPrototypeOf(right)) return false\n const keys = Object.keys(left)\n if (keys.length !== Object.keys(right).length) return false\n return keys.every(\n key =>\n Object.hasOwn(right, key) &&\n sameData(\n (left as Record<string, unknown>)[key],\n (right as Record<string, unknown>)[key],\n depth + 1,\n ),\n )\n}\n\nconst drawItem = <Slots, Message, Args extends Readonly<Record<string, unknown>>>(\n item: SlotItem,\n draw: (slots: SlotBuilders<Slots, Message>, h: HtmlBuilder<Message>, args: Args) => Html,\n args: Args,\n context: {\n readonly builders: SlotBuilders<Slots, Message>\n readonly h: HtmlBuilder<Message>\n readonly given: (used: ReadonlyArray<string>) => ReadonlyArray<unknown>\n readonly first: string\n },\n): Html => {\n // Inside another item's drawing, drawn in place, and the outer one is not\n // cached: its key would read this one's Slots with the outer item.\n if (using !== undefined) {\n using.add(NESTED)\n return draw(context.builders, context.h, args)\n }\n const memo = itemMemoOf(draw)\n const key = item.id ?? item.index\n // What an item used and was given is kept only under a runtime frame, where a\n // memo can use it: a server drawing page after page keeps nothing.\n const run = (kept: boolean): Html => {\n started++\n using = new Set()\n try {\n const html = draw(context.builders, context.h, args)\n if (kept) memo.used.set(key, [...using])\n return html\n } finally {\n using = undefined\n }\n }\n const used = memo.used.get(key) ?? [context.first]\n if (used.includes(NESTED)) return run(true)\n const now = context.given(used.filter(slot => slot !== NESTED))\n const before = memo.given.get(key)\n // The same data keeps the value last compared, so the memo sees it unchanged.\n const given = before !== undefined && sameData(before, now) ? before : now\n pending = () => run(true)\n try {\n // The record is new every render; its keys and values are what stay the same.\n const compared = [draw, given, ...Object.keys(args), ...Object.values(args)]\n return memoizedOr(\n () => {\n const html = memo.lazy(key, runPending, compared)\n memo.given.set(key, given)\n return html\n },\n () => run(false),\n )\n } finally {\n pending = undefined\n }\n}\n\n/** Build one `attrs` resolver per published slot, evaluating Mixins lazily. */\nexport const buildersFor = <Slots, Message, Input>(\n slots: Slots,\n mixins: ReadonlyArray<MixinFor<Message>>,\n context: { readonly input: Input; readonly h: HtmlBuilder<Message> },\n): SlotBuilders<Slots, Message> => {\n const builders = buildersOver(slots, [{ mixins, input: context.input }], context.h)\n mixinsOf.set(builders, mixins)\n return builders\n}\n\nconst makeView = <Slots, Input, Message>(\n name: string | undefined,\n slots: Slots,\n mixins: ReadonlyArray<MixinFor<Message>>,\n render: SlotViewRender<Slots, Input, Message>,\n): SlotView<Slots, Input, Message> => {\n const view = (input: Input, h: HtmlBuilder<Message>): Html =>\n render(input, buildersFor(slots, mixins, { input, h }), h)\n // A function's own `name` is read-only; define it rather than assigning.\n if (name !== undefined) {\n Object.defineProperty(view, 'name', { value: name, configurable: true })\n }\n return Object.assign(view, {\n slots,\n mixins,\n render,\n pipe: (...fns: ReadonlyArray<(self: unknown) => unknown>) => pipeSelf(view, fns),\n }) as unknown as SlotView<Slots, Input, Message>\n}\n\n/**\n * Defines a view over published Slots.\n *\n * `Message` has no anchor but the render callback's builder, so it is inferred\n * from an explicit `h: HtmlBuilder<Message>` annotation on that parameter.\n * Without one it resolves to `unknown`, and the first error appears later and\n * elsewhere — an invariance mismatch at `Style.attach`/`Behavior.attach` that\n * does not name the missing annotation. `forMessages<Message>()` fixes the\n * Message universe up front instead, and leaves `h` contextually typed.\n */\nexport const define = <Slots, Input, Message>(\n slots: Slots,\n render: SlotViewRender<Slots, Input, Message>,\n options?: { readonly name?: string },\n): SlotView<Slots, Input, Message> => makeView(options?.name, slots, [], render)\n\n/**\n * Foldkit's `inertHtml` typed for a Message universe, for rendering a view\n * outside a runtime (tests, demos, static description). `inertHtml` is\n * `HtmlBuilder<never>`, and the builder is invariant in `Message`, so this is\n * the one cast: sound outside a runtime render, where no handler is ever\n * dispatched. Inside one it is the same builder every view is given, so its\n * handlers would reach the frame's `update`: use the view's own `h` there.\n */\nexport const inertBuilder = <Message>(): HtmlBuilder<Message> =>\n inertHtml as unknown as HtmlBuilder<Message>\n\n/** The `SlotView` constructors with `Message` already fixed. */\nexport interface MessageSlotView<Message> {\n readonly define: <Slots, Input>(\n slots: Slots,\n render: SlotViewRender<Slots, Input, Message>,\n options?: { readonly name?: string },\n ) => SlotView<Slots, Input, Message>\n}\n\n/**\n * Binds the view constructors to one Message universe, so the render callback\n * no longer has to annotate `h` to pin it. `Input` is still inferred from the\n * callback's own `input` annotation.\n *\n * @example\n * ```ts\n * const Field = SlotView.forMessages<Message>().define(\n * FieldSlots,\n * (input: FieldInput, slots, h) =>\n * h.input(slots.input.attrs([h.OnInput(value => Message.ChangedValue({ value }))])),\n * )\n * ```\n */\nexport const forMessages = <Message>(): MessageSlotView<Message> => ({ define })\n\n/** A transform on any view, used by Message-free static mixins such as Style. */\nexport type SlotViewTransform = <Slots, Input, Message>(\n view: SlotView<Slots, Input, Message>,\n) => SlotView<Slots, Input, Message>\n\n/** A transform restricted to one Message universe, for Behavior mixins. */\nexport type SlotViewTransformFor<Message> = <Slots, Input>(\n view: SlotView<Slots, Input, Message>,\n) => SlotView<Slots, Input, Message>\n\n/** Attach one Mixin. Returns a new view; the original is unchanged. */\nexport function attach(mixin: StaticMixin<never> | Mixin<never>): SlotViewTransform\nexport function attach<MixinMessage>(mixin: Mixin<MixinMessage>): SlotViewTransformFor<MixinMessage>\nexport function attach(mixin: AnyMixin | Mixin<never>): any {\n return (view: SlotView<any, any, any>) =>\n makeView(view.name, view.slots, [...view.mixins, mixin], view.render)\n}\n\n/**\n * One piece of an assembled view, drawn from its own selection of the view's\n * input: the keys it names in `reads`, and nothing else. It is drawn again\n * only when one of those values changed, by identity.\n */\nexport interface Part<Slots, Input, Message> {\n readonly name: string\n readonly reads: ReadonlyArray<keyof Input>\n /** The Behaviors declared with the part, resolved against its selection. */\n readonly mixins: ReadonlyArray<MixinFor<Message>>\n // `any`: the part's own selection, which `Parts.part` typed from `reads`.\n readonly render: (\n input: any,\n slots: SlotBuilders<Slots, Message>,\n h: HtmlBuilder<Message>,\n ) => Html\n}\n\n/** An assembly's own drawing: the parts it places, by `draw`, and anything else around them. */\nexport type AssemblyRender<Slots, Input, Message> = (\n input: Input,\n slots: SlotBuilders<Slots, Message>,\n h: HtmlBuilder<Message>,\n draw: (part: Part<Slots, Input, Message>) => Html,\n) => Html\n\nexport interface Parts<Slots, Input, Message> {\n /**\n * A part reading `reads` of the input. `behaviors` are declared over that\n * selection, so they cannot read what the part does not redraw for.\n */\n readonly part: <const Reads extends ReadonlyArray<keyof Input>>(\n name: string,\n options: {\n readonly reads: Reads\n readonly behaviors?: ReadonlyArray<NamedBehavior<Slots, Pick<Input, Reads[number]>, Message>>\n },\n render: (\n input: Pick<Input, Reads[number]>,\n slots: SlotBuilders<Slots, Message>,\n h: HtmlBuilder<Message>,\n ) => Html,\n ) => Part<Slots, Input, Message>\n /**\n * A SlotView that draws its parts where `render` places them. Styles and\n * Behaviors attach to it as to any SlotView and reach every part's Slots.\n */\n readonly assemble: (\n render: AssemblyRender<Slots, Input, Message>,\n options?: { readonly name?: string },\n ) => SlotView<Slots, Input, Message>\n}\n\n// A part's memo. A part drawn twice in one render is the same drawing twice,\n// which Foldkit copies for the second place.\nconst lazies = new WeakMap<object, ReturnType<typeof createLazy>>()\nconst lazyOf = (part: object): ReturnType<typeof createLazy> => {\n const known = lazies.get(part)\n if (known !== undefined) return known\n const made = createLazy()\n lazies.set(part, made)\n return made\n}\n\n// Whether any of these Mixins reads the input: a function contribution may.\nconst readsInput = new WeakMap<ReadonlyArray<MixinFor<any>>, boolean>()\nconst anyDynamic = (mixins: ReadonlyArray<MixinFor<any>>): boolean => {\n const known = readsInput.get(mixins)\n if (known !== undefined) return known\n const found = mixins.some(mixin => Object.values(mixin.contributions).some(isDynamic))\n readsInput.set(mixins, found)\n return found\n}\n\n/**\n * One part, from its arguments alone, so the memo sees one function: the\n * whole input only when a view-wide Mixin reads it, and the part's read values.\n */\nconst drawPart = <Slots, Input, Message>(\n part: Part<Slots, Input, Message>,\n slots: Slots,\n h: HtmlBuilder<Message>,\n mixins: ReadonlyArray<MixinFor<Message>>,\n whole: unknown,\n ...values: Array<unknown>\n): Html => {\n started++\n const selection = Object.fromEntries(part.reads.map((key, at) => [key, values[at]]))\n const groups = [\n { mixins: part.mixins, input: selection },\n { mixins, input: whole },\n ]\n return part.render(selection, buildersOver(slots, groups, h), h)\n}\n\n/**\n * Parts over one set of Slots and one input, and the assembly that places them.\n *\n * @example\n * ```ts\n * const Parts = SlotView.parts(PanelSlots)<PanelInput, Message>()\n * const Title = Parts.part('Title', { reads: ['title'] }, (input, slots, h) =>\n * h.h2(slots.title.attrs(), [input.title]),\n * )\n * const Panel = Parts.assemble((input, slots, h, draw) => h.section(slots.root.attrs(), [draw(Title)]))\n * ```\n */\nexport const parts =\n <Slots>(slots: Slots) =>\n <Input, Message>(): Parts<Slots, Input, Message> => ({\n part: (name, options, render) => ({\n name,\n reads: options.reads,\n mixins: (options.behaviors ?? []).map(behavior => behavior.mixin),\n render,\n }),\n assemble: (render, options) =>\n makeView<Slots, Input, Message>(options?.name, slots, [], (input, builders, h) => {\n const mixins: ReadonlyArray<MixinFor<Message>> = mixinsOf.get(builders) ?? []\n // A Mixin attached to the whole view that reads the input is resolved\n // against all of it, so a part it reaches redraws whenever the input changes.\n const whole = anyDynamic(mixins) ? input : undefined\n return render(input, builders, h, part => {\n const args: Parameters<typeof drawPart<Slots, Input, Message>> = [\n part,\n slots,\n h,\n mixins,\n whole,\n ...part.reads.map(key => input[key]),\n ]\n return memoizedOr(\n () => lazyOf(part)(drawPart<Slots, Input, Message>, args),\n () => drawPart(...args),\n )\n })\n }),\n })\n","/**\n * Slot witnesses. Ported from `effect-atom-jsx/src/View.ts` `Slot`, without\n * Handle binding. A slot is named metadata: capability, allowed events,\n * attributes, platform requirements, hidden, and Foldkit-only `protected`.\n */\nimport type { AttrToken } from './attr.js'\nimport type { Any as AnyCapability } from './capability.js'\nimport * as Capability from './capability.js'\nimport type { EventToken } from './event.js'\nimport * as MetadataToken from './metadataToken.js'\nimport { pipeSelf, type Pipeable } from './pipe.js'\nimport type { RequirementToken } from './requirement.js'\n\nexport const SlotTypeId: unique symbol = Symbol.for('foldkit-mixins/Slot')\nexport type SlotTypeId = typeof SlotTypeId\n\nexport type EventName = string | EventToken\nexport type AttributeName = string | AttrToken\nexport type RequirementName = string | RequirementToken\nexport type SlotCapability = string | AnyCapability\n\nexport interface SlotProtection {\n readonly events: ReadonlyArray<EventName>\n readonly attributes: ReadonlyArray<AttributeName>\n readonly style: ReadonlyArray<string>\n}\n\nexport interface SlotMetadata<Name extends string = string> {\n readonly name: Name\n readonly capability: SlotCapability\n readonly allowedEvents: readonly EventName[]\n readonly allowedAttributes: readonly AttributeName[]\n readonly platformRequirements: readonly RequirementName[]\n readonly hidden: boolean\n readonly protected: SlotProtection\n}\n\nexport interface Slot<\n Name extends string = string,\n C extends SlotCapability = typeof Capability.Base,\n Events extends readonly EventName[] = readonly [],\n Attributes extends readonly AttributeName[] = readonly [],\n Requirements extends readonly RequirementName[] = readonly [],\n Hidden extends boolean = false,\n> extends Pipeable<Slot<Name, C, Events, Attributes, Requirements, Hidden>> {\n readonly [SlotTypeId]: {\n readonly Name: Name\n readonly Capability: C\n readonly Events: Events\n readonly Attributes: Attributes\n readonly Requirements: Requirements\n readonly Hidden: Hidden\n }\n readonly name: Name\n readonly capability: C\n readonly events: Events\n readonly attributes: Attributes\n readonly requirements: Requirements\n readonly hidden: Hidden\n readonly protected: SlotProtection\n readonly metadata: SlotMetadata<Name> & {\n readonly capability: C\n readonly allowedEvents: Events\n readonly allowedAttributes: Attributes\n readonly platformRequirements: Requirements\n readonly hidden: Hidden\n }\n}\n\nexport type Any = Slot<\n string,\n SlotCapability,\n readonly EventName[],\n readonly AttributeName[],\n readonly RequirementName[],\n boolean\n>\n\nexport type UnnamedSlot<\n C extends SlotCapability = SlotCapability,\n Events extends readonly EventName[] = readonly EventName[],\n Attributes extends readonly AttributeName[] = readonly AttributeName[],\n Requirements extends readonly RequirementName[] = readonly RequirementName[],\n Hidden extends boolean = boolean,\n> = Omit<Slot<'', C, Events, Attributes, Requirements, Hidden>, 'name'> & {\n readonly name?: never\n}\n\nexport type NameOf<T> = T extends Slot<infer Name, any, any, any, any, any> ? Name : never\nexport type CapabilityOf<T> =\n T extends Slot<any, infer C, any, any, any, any> ? MetadataToken.NameOf<C> : never\nexport type CapabilityValueOf<T> = T extends Slot<any, infer C, any, any, any, any> ? C : never\nexport type EventsOf<T> =\n T extends Slot<any, any, infer Events, any, any, any> ? MetadataToken.NamesOf<Events> : never\nexport type AttributesOf<T> =\n T extends Slot<any, any, any, infer Attributes, any, any>\n ? MetadataToken.NamesOf<Attributes>\n : never\nexport type HiddenOf<T> = T extends Slot<any, any, any, any, any, infer Hidden> ? Hidden : never\nexport type AssignableCapabilityNamesOf<T> = Capability.AssignableNamesOf<CapabilityValueOf<T>>\nexport type Public<T> = HiddenOf<T> extends true ? never : T\nexport type Hidden<T> = HiddenOf<T> extends true ? T : never\n\nexport const is = (value: unknown): value is Any | UnnamedSlot =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, SlotTypeId)\n\nconst emptyProtection: SlotProtection = Object.freeze({\n events: Object.freeze([]) as ReadonlyArray<EventName>,\n attributes: Object.freeze([]) as ReadonlyArray<AttributeName>,\n style: Object.freeze([]) as ReadonlyArray<string>,\n})\n\nexport interface MakeOptions<\n C extends SlotCapability = SlotCapability,\n Events extends readonly EventName[] = readonly EventName[],\n Attributes extends readonly AttributeName[] = readonly AttributeName[],\n Requirements extends readonly RequirementName[] = readonly RequirementName[],\n Hidden extends boolean = boolean,\n> {\n readonly capability?: C\n readonly events?: Events\n readonly allowedEvents?: Events\n readonly attributes?: Attributes\n readonly allowedAttributes?: Attributes\n readonly requirements?: Requirements\n readonly platformRequirements?: Requirements\n readonly hidden?: Hidden\n readonly protected?: {\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n readonly style?: ReadonlyArray<string>\n }\n}\n\nconst protectionOf = (options: MakeOptions | undefined): SlotProtection => {\n const specified = options?.protected\n if (specified === undefined) return emptyProtection\n return Object.freeze({\n events: Object.freeze([...(specified.events ?? [])]),\n attributes: Object.freeze([...(specified.attributes ?? [])]),\n style: Object.freeze([...(specified.style ?? [])]),\n })\n}\n\nconst createSlot = <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n>(\n name: Name,\n options: MakeOptions<C, Events, Attributes, Requirements, Hidden> | undefined,\n): Slot<Name, C, Events, Attributes, Requirements, Hidden> => {\n const capability = (options?.capability ?? Capability.Base) as C\n const events = (options?.events ?? options?.allowedEvents ?? []) as Events\n const attributes = (options?.attributes ?? options?.allowedAttributes ?? []) as Attributes\n const requirements = (options?.requirements ??\n options?.platformRequirements ??\n []) as Requirements\n const hidden = (options?.hidden ?? false) as Hidden\n const protection = protectionOf(options)\n const metadata = {\n name,\n capability,\n allowedEvents: events,\n allowedAttributes: attributes,\n platformRequirements: requirements,\n hidden,\n protected: protection,\n }\n const out = {\n [SlotTypeId]: {\n Name: undefined as unknown as Name,\n Capability: undefined as unknown as C,\n Events: undefined as unknown as Events,\n Attributes: undefined as unknown as Attributes,\n Requirements: undefined as unknown as Requirements,\n Hidden: undefined as unknown as Hidden,\n },\n name,\n capability,\n events,\n attributes,\n requirements,\n hidden,\n protected: protection,\n metadata,\n } as Slot<Name, C, Events, Attributes, Requirements, Hidden>\n return Object.assign(out, {\n pipe: (...fns: ReadonlyArray<(value: any) => any>) => pipeSelf(out, fns),\n }) as Slot<Name, C, Events, Attributes, Requirements, Hidden>\n}\n\n/** AF-UI form: name is the first argument. */\nexport function make<\n const Name extends string,\n const C extends SlotCapability = typeof Capability.Base,\n const Events extends readonly EventName[] = readonly [],\n const Attributes extends readonly AttributeName[] = readonly [],\n const Requirements extends readonly RequirementName[] = readonly [],\n const Hidden extends boolean = false,\n>(\n name: Name,\n options?: MakeOptions<C, Events, Attributes, Requirements, Hidden>,\n): Slot<Name, C, Events, Attributes, Requirements, Hidden>\n/** Foldkit form: name comes from `Slots.define` keys. */\nexport function make<\n const C extends SlotCapability = typeof Capability.Base,\n const Events extends readonly EventName[] = readonly [],\n const Attributes extends readonly AttributeName[] = readonly [],\n const Requirements extends readonly RequirementName[] = readonly [],\n const Hidden extends boolean = false,\n>(\n options: MakeOptions<C, Events, Attributes, Requirements, Hidden>,\n): UnnamedSlot<C, Events, Attributes, Requirements, Hidden>\nexport function make(\n nameOrOptions: string | MakeOptions,\n options?: MakeOptions,\n): Any | UnnamedSlot {\n if (typeof nameOrOptions === 'string') {\n return createSlot(nameOrOptions, options)\n }\n const unnamed = createSlot('', nameOrOptions)\n const { name: _dropped, ...rest } = unnamed\n return rest as UnnamedSlot\n}\n\n/** Pipeable transform replacing a named slot's capability. */\nexport const capability =\n <const C extends SlotCapability>(capability: C) =>\n <\n Name extends string,\n OldC extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n >(\n slot: Slot<Name, OldC, Events, Attributes, Requirements, Hidden>,\n ): Slot<Name, C, Events, Attributes, Requirements, Hidden> =>\n createSlot(slot.name, {\n capability,\n events: slot.events,\n attributes: slot.attributes,\n requirements: slot.requirements,\n hidden: slot.hidden,\n protected: slot.protected,\n })\n\n/** Pipeable transform replacing a named slot's allowed events. */\nexport const events =\n <const Next extends readonly EventName[]>(...next: Next) =>\n <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n >(\n slot: Slot<Name, C, Events, Attributes, Requirements, Hidden>,\n ): Slot<Name, C, Next, Attributes, Requirements, Hidden> =>\n createSlot(slot.name, {\n capability: slot.capability,\n events: next,\n attributes: slot.attributes,\n requirements: slot.requirements,\n hidden: slot.hidden,\n protected: slot.protected,\n })\n\n/** Pipeable transform replacing a named slot's allowed attributes. */\nexport const attributes =\n <const Next extends readonly AttributeName[]>(...next: Next) =>\n <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n >(\n slot: Slot<Name, C, Events, Attributes, Requirements, Hidden>,\n ): Slot<Name, C, Events, Next, Requirements, Hidden> =>\n createSlot(slot.name, {\n capability: slot.capability,\n events: slot.events,\n attributes: next,\n requirements: slot.requirements,\n hidden: slot.hidden,\n protected: slot.protected,\n })\n\n/** Pipeable transform replacing a named slot's platform requirements. */\nexport const requires =\n <const Next extends readonly RequirementName[]>(...next: Next) =>\n <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n >(\n slot: Slot<Name, C, Events, Attributes, Requirements, Hidden>,\n ): Slot<Name, C, Events, Attributes, Next, Hidden> =>\n createSlot(slot.name, {\n capability: slot.capability,\n events: slot.events,\n attributes: slot.attributes,\n requirements: next,\n hidden: slot.hidden,\n protected: slot.protected,\n })\n\n/** Pipeable transform marking a named slot hidden from public attachment. */\nexport const hide = <\n Name extends string,\n C extends SlotCapability,\n Events extends readonly EventName[],\n Attributes extends readonly AttributeName[],\n Requirements extends readonly RequirementName[],\n Hidden extends boolean,\n>(\n slot: Slot<Name, C, Events, Attributes, Requirements, Hidden>,\n): Slot<Name, C, Events, Attributes, Requirements, true> =>\n createSlot(slot.name, {\n capability: slot.capability,\n events: slot.events,\n attributes: slot.attributes,\n requirements: slot.requirements,\n hidden: true,\n protected: slot.protected,\n })\n\nexport const describe = (\n slot: Any | UnnamedSlot,\n): {\n readonly name?: string\n readonly capability: string\n readonly events: ReadonlyArray<string>\n readonly attributes: ReadonlyArray<string>\n readonly requirements: ReadonlyArray<string>\n readonly hidden: boolean\n readonly protected: {\n readonly events: ReadonlyArray<string>\n readonly attributes: ReadonlyArray<string>\n readonly style: ReadonlyArray<string>\n }\n} => {\n const named = slot.name !== undefined && slot.name !== '' ? { name: slot.name } : {}\n return {\n ...named,\n capability: MetadataToken.nameOf(slot.capability),\n events: slot.events.map(event => MetadataToken.nameOf(event)),\n attributes: slot.attributes.map(attr => MetadataToken.nameOf(attr)),\n requirements: slot.requirements.map(requirement => MetadataToken.nameOf(requirement)),\n hidden: slot.hidden,\n protected: {\n events: slot.protected.events.map(event => MetadataToken.nameOf(event)),\n attributes: slot.protected.attributes.map(attr => MetadataToken.nameOf(attr)),\n style: slot.protected.style,\n },\n }\n}\n","/**\n * Slot contracts. Ported from `effect-atom-jsx/src/View.ts` `Slots.define`,\n * without minting element Handles. Names come from keys. Entries may be\n * `Slot.make({...})` or AF-UI option objects `{ capability, allowedEvents }`.\n */\nimport * as Capability from './capability.js'\nimport * as Slot from './slot.js'\nimport type {\n Any as AnySlot,\n MakeOptions,\n Slot as NamedSlot,\n SlotCapability,\n UnnamedSlot,\n} from './slot.js'\n\nexport const SlotsTypeId: unique symbol = Symbol.for('foldkit-mixins/Slots')\n\nexport type Contract<S extends { readonly [K in keyof S]: UnnamedSlot | MakeOptions }> = {\n readonly [K in keyof S]: S[K] extends UnnamedSlot<\n infer C,\n infer Events,\n infer Attributes,\n infer Requirements,\n infer Hidden\n >\n ? NamedSlot<K & string, C, Events, Attributes, Requirements, Hidden>\n : S[K] extends MakeOptions<\n infer C,\n infer Events,\n infer Attributes,\n infer Requirements,\n infer Hidden\n >\n ? NamedSlot<K & string, C, Events, Attributes, Requirements, Hidden>\n : never\n}\n\nexport type NamesOf<T> = keyof T & string\nexport type PublicNamesOf<T> = {\n readonly [K in keyof T & string]: Slot.HiddenOf<T[K]> extends true ? never : K\n}[keyof T & string]\nexport type HiddenNamesOf<T> = {\n readonly [K in keyof T & string]: Slot.HiddenOf<T[K]> extends true ? K : never\n}[keyof T & string]\nexport type WithCapability<T, C extends SlotCapability> = {\n readonly [\n K in keyof T & string as Capability.NameOf<C> extends Slot.AssignableCapabilityNamesOf<T[K]>\n ? K\n : never\n ]: T[K]\n}\n\nconst toUnnamed = (value: unknown, key: string): UnnamedSlot => {\n if (Slot.is(value)) {\n return value as UnnamedSlot\n }\n if (typeof value === 'object' && value !== null && Object.hasOwn(value, 'capability')) {\n return Slot.make(value as MakeOptions)\n }\n throw new Error(`Slots.define: \"${key}\" is not a Slot or slot options object`)\n}\n\nexport const define = <const S extends { readonly [K in keyof S]: UnnamedSlot | MakeOptions }>(\n spec: S,\n): Contract<S> => {\n const proto = Object.getPrototypeOf(spec)\n if (proto !== Object.prototype && proto !== null) {\n throw new Error(\n 'Slots.define: pass a plain object; quote [\"__proto__\"] to use that as a slot name',\n )\n }\n const contract = Object.create(null) as Record<string, NamedSlot>\n for (const key of Object.getOwnPropertyNames(spec)) {\n const unnamed = toUnnamed((spec as Record<string, unknown>)[key], key)\n Object.defineProperty(contract, key, {\n value: Slot.make(key, {\n capability: unnamed.capability,\n events: unnamed.events,\n attributes: unnamed.attributes,\n requirements: unnamed.requirements,\n hidden: unnamed.hidden,\n protected: unnamed.protected,\n }),\n enumerable: true,\n configurable: false,\n writable: false,\n })\n }\n Object.freeze(contract)\n return contract as unknown as Contract<S>\n}\n\nexport const describe = (contract: {\n readonly [key: string]: AnySlot | UnnamedSlot\n}): {\n readonly slots: Readonly<\n Record<\n string,\n {\n readonly name: string\n readonly capability: string\n readonly events: ReadonlyArray<string>\n readonly attributes: ReadonlyArray<string>\n readonly requirements: ReadonlyArray<string>\n readonly hidden: boolean\n readonly protected: {\n readonly events: ReadonlyArray<string>\n readonly attributes: ReadonlyArray<string>\n readonly style: ReadonlyArray<string>\n }\n }\n >\n >\n} => {\n const slots: Record<string, ReturnType<typeof Slot.describe> & { readonly name: string }> =\n Object.create(null)\n for (const key of Object.getOwnPropertyNames(contract)) {\n const slot = contract[key]\n if (slot === undefined || !Slot.is(slot)) continue\n const described = Slot.describe(slot)\n slots[key] = {\n ...described,\n name: slot.name !== undefined && slot.name !== '' ? slot.name : key,\n }\n }\n return { slots }\n}\n\nexport const withCapability = <\n T extends { readonly [key: string]: AnySlot },\n C extends SlotCapability,\n>(\n contract: T,\n capability: C,\n): WithCapability<T, C> => {\n const out = Object.create(null) as Record<string, AnySlot>\n for (const key of Object.getOwnPropertyNames(contract)) {\n const slot = contract[key]\n if (slot === undefined || !Slot.is(slot)) continue\n if (Capability.extendsCapability(slot.capability, capability)) {\n out[key] = slot\n }\n }\n return out as WithCapability<T, C>\n}\n","/**\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 * as Mixin from './mixin.js'\nimport type { Mixin as MixinValue } 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 { register, 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 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 conditions: Object.freeze([\n { predicate: (input: unknown) => predicate(input as Input), 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 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)\n collected.push({ className: generated, css })\n }\n const conditions = (style.conditions ?? []).map(condition => ({\n predicate: condition.predicate,\n piece: compileTree(condition.piece, 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 tree = compileTree(style, collected)\n const globalRules = collectGlobalCss(style)\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\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>(options?.name ?? 'Style', contributions),\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>(\n view: SlotView.SlotView<ViewSlots, Input, Message>,\n ): SlotView.SlotView<ViewSlots, Input, Message> =>\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\nexport type RecipeSelection<D extends AnyRecipeDef> = {\n readonly [K in keyof NonNullable<D['variants']>]?: keyof NonNullable<D['variants']>[K] & 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> = {}\n for (const [variant, values] of Object.entries(def.variants ?? {})) {\n const chosen =\n (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> = {\n readonly [K in keyof Variants]?: (keyof Variants[K] & string) | null\n}\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\nexport interface SlotRecipe<Slots, Variants extends SlotRecipeVariants<Slots>> {\n (selection?: SlotRecipeSelection<Variants>): StyleValues<Slots>\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: (patch: SlotRecipePatch<Slots, Variants>) => SlotRecipe<Slots, Variants>\n}\n\nconst mergePieces = <Slots>(\n left: StylePieces<Slots> | undefined,\n right: StylePieces<Slots> | undefined,\n): StyleValues<Slots> => {\n const merged: Record<string, StyleValue> = {}\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> = {}>(\n def: SlotRecipeDef<Slots, Variants>,\n ): SlotRecipe<Slots, Variants> => {\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> = {}\n for (const [axis, values] of Object.entries(axes)) {\n const picked = (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>): SlotRecipe<Slots, Variants> => {\n const variants: Record<string, Record<string, StylePieces<Slots>>> = {}\n for (const [axis, values] of Object.entries(axes)) {\n variants[axis] = { ...(values as Record<string, StylePieces<Slots>>) }\n }\n for (const [axis, values] of Object.entries(patch.variants ?? {})) {\n const target = variants[axis] ?? {}\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 return Object.assign(select, { def: full, extend })\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> = {}\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} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,MAAa,sBAAqC,OAAO,IAAI,8BAA8B;AAoB3F,MAAaA,UACX,MACA,SAC8B;CAC9B,IAAI,SAAS,IACX,MAAM,IAAI,MAAM,GAAG,KAAK,wBAAwB;CAElD,OAAO;GACJ,sBAAsB;GACrB,MAAM,KAAA;GACN,MAAM,KAAA;EACR;EACA;EACA;CACF;AACF;AAEA,MAAaC,QAAM,UACjB,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,OAAO,OAAO,mBAAmB;AAEzF,MAAa,UAAU,UAAiCA,KAAG,KAAK,IAAI,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;ACfjF,MAAM,gCAAgB,IAAI,IAAmC;AAC7D,MAAM,2BAAW,IAAI,IAAiB;AAEtC,MAAaC,QAAM,UACjBC,KAAiB,KAAK,KAAK,MAAM,SAAS;AAE5C,MAAaC,UAIX,MACA,YAC8B;CAC9B,IAAI,SAAS,IACX,MAAM,IAAI,MAAM,mCAAmC;CAErD,MAAM,UAAW,SAAS,WAAW,CAAC;CACtC,MAAM,cAAc,QAAQ,KAAI,WAAUC,OAAqB,MAAM,CAAC;CACtE,MAAM,WAAW,SAAS,IAAI,IAAI;CAClC,IAAI,aAAa,KAAA,GAAW;EAC1B,MAAM,gBAAgB,SAAS,QAAQ,KAAI,WAAUA,OAAqB,MAAM,CAAC;EACjF,IACE,cAAc,WAAW,YAAY,UACrC,cAAc,OAAO,YAAY,UAAU,eAAe,YAAY,MAAM,GAE5E,OAAO;EAET,MAAM,IAAI,MA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tB,SAAS,KAAK,OAAO,OAAO;CAC5B,OAAO;AACT;AAEA,MAAa,QAAQ;CACnB,OAAO;CACP;CACA,SAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,OAAA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleValue-BavTe9MZ.d.mts","names":[],"sources":["../src/styleRules.ts","../src/styleValue.ts"],"mappings":";;;;;;;;;;UAOiB;WACN;WACA;;WAEA;WACA,cAAc,SAAS;;;;;;;;;;KCOtB,2BAA2B,WAAW;YACtC;;;cAIC;UAEI;YACL;WACD,SAAS;WACT,OAAO,SAAS;;WAEhB,aAAa,cAAc;;WAE3B,QAAQ,eAAe,MAAM,yBAAyB;;WAEtD,QAAQ,cAAc;;WAEtB,YAAY;;UAGN;WACN,YAAY;WACZ,OAAO;;;;;;KA6BN,QACR,cAEC;WAA0B;KAC3B,cAAc;
|
|
1
|
+
{"version":3,"file":"styleValue-BavTe9MZ.d.mts","names":[],"sources":["../src/styleRules.ts","../src/styleValue.ts"],"mappings":";;;;;;;;;;UAOiB;WACN;WACA;;WAEA;WACA,cAAc,SAAS;;;;;;;;;;KCOtB,2BAA2B,WAAW;YACtC;;;cAIC;UAEI;YACL;WACD,SAAS;WACT,OAAO,SAAS;;WAEhB,aAAa,cAAc;;WAE3B,QAAQ,eAAe,MAAM,yBAAyB;;WAEtD,QAAQ,cAAc;;WAEtB,YAAY;;UAGN;WACN,YAAY;WACZ,OAAO;;;;;;KA6BN,QACR,cAEC;WAA0B;KAC3B,cAAc;UAiPD,WAAW;;WAEjB,OAAO,cAAc,cAAc;WACnC;WACA;WACA;;UAGM,KAAK;;WAEX,OAAO;;WAEP,OAAO,MAAM,SAAS;;WAEtB,OAAO,cAAc"}
|