foldkit-mixins 0.2.0 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["make","is","is","MetadataToken.is","make","MetadataToken.nameOf","MetadataToken.make","describe","MetadataToken.nameOf","Capability.extendsCapability","is","MetadataToken.is","make","MetadataToken.make","equals","describe","make","empty","compose","ih","MetadataToken.nameOf","define","attach","Capability.extendsCapability","MetadataToken.nameOf","forSlots","Mixin.dynamic","attach","SlotView.attach","is","MetadataToken.is","make","MetadataToken.make","describe","is","MetadataToken.is","make","MetadataToken.make","describe","Capability.Base","describe","MetadataToken.nameOf","Slot.is","Slot.make","define","Slot.describe","Capability.extendsCapability","pseudo","media","supports","container","nest","keyframes","Rules.pseudo","Rules.media","Rules.supports","Rules.container","Rules.nest","Rules.keyframes","Rules.className","Rules.css","Mixin.dynamic","SlotView.attach"],"sources":["../src/metadataToken.ts","../src/capability.ts","../src/a11y.ts","../src/attr.ts","../src/diagnostics.ts","../src/mixin.ts","../src/pipe.ts","../src/attribute.ts","../src/resolver.ts","../src/slotView.ts","../src/behavior.ts","../src/event.ts","../src/requirement.ts","../src/slot.ts","../src/slots.ts","../src/styleRules.ts","../src/style.ts","../src/theme.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 * Structural accessibility validation. A `Pattern` names the Slots a widget\n * must publish, the capabilities those Slots must satisfy, and the events and\n * attributes they must expose. `validate` compares a `Slots` contract against a\n * pattern and reports every mismatch as a `Diagnostic`. It is pure and\n * DOM-independent: it checks the declared contract, not a rendered tree, so it\n * verifies only the contract it is given and does not certify WCAG conformance.\n */\nimport * as Capability from './capability.js'\nimport type { Diagnostic } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport type { Any as AnySlot, AttributeName, EventName, SlotCapability } from './slot.js'\n\nexport type A11yDiagnosticCode =\n | 'a11y:missing-slot'\n | 'a11y:hidden-slot'\n | 'a11y:capability-mismatch'\n | 'a11y:missing-event'\n | 'a11y:missing-attribute'\n\nexport interface A11yDiagnostic extends Diagnostic {\n readonly source: 'a11y'\n readonly code: A11yDiagnosticCode\n}\n\nexport interface SlotRequirement {\n readonly capability?: SlotCapability\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n /** An absent slot is expected, not a diagnostic. A present slot is still checked. */\n readonly optional?: boolean\n}\n\nexport type Requirements = Readonly<Record<string, SlotRequirement>>\n\nexport const PatternTypeId: unique symbol = Symbol.for('foldkit-mixins/A11yPattern')\n\nexport interface Pattern<Spec extends Requirements = Requirements> {\n readonly [PatternTypeId]: { readonly Requirements: Spec }\n readonly requirements: Spec\n}\n\nexport const pattern = <const Spec extends Requirements>(spec: Spec): Pattern<Spec> => {\n const requirements = Object.create(null) as Record<string, SlotRequirement>\n for (const name of Object.getOwnPropertyNames(spec)) {\n const requirement = spec[name]\n if (requirement === undefined) continue\n Object.defineProperty(requirements, name, {\n value: Object.freeze({ ...requirement }),\n enumerable: true,\n configurable: false,\n writable: false,\n })\n }\n Object.freeze(requirements)\n return Object.freeze({\n [PatternTypeId]: { Requirements: undefined as unknown as Spec },\n requirements: requirements as Spec,\n }) as Pattern<Spec>\n}\n\nconst publishes = (\n names: ReadonlyArray<string | MetadataToken.Any>,\n required: string | MetadataToken.Any,\n): boolean => {\n const requiredName = MetadataToken.nameOf(required)\n return names.some(name => MetadataToken.nameOf(name) === requiredName)\n}\n\nconst diagnostic = (\n code: A11yDiagnosticCode,\n message: string,\n slot: string,\n details?: Readonly<Record<string, unknown>>,\n): A11yDiagnostic => ({\n source: 'a11y',\n code,\n severity: 'error',\n message,\n slot,\n ...(details === undefined ? {} : { details }),\n})\n\nexport const validate = (\n pattern: Pattern,\n slots: { readonly [name: string]: AnySlot },\n): ReadonlyArray<A11yDiagnostic> => {\n const diagnostics: Array<A11yDiagnostic> = []\n for (const name of Object.getOwnPropertyNames(pattern.requirements)) {\n const requirement = pattern.requirements[name]\n if (requirement === undefined) continue\n if (!Object.hasOwn(slots, name)) {\n if (requirement.optional === true) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-slot',\n `A11y pattern requires slot \"${name}\", which the contract does not publish`,\n name,\n ),\n )\n continue\n }\n const slot = slots[name]\n if (slot === undefined) continue\n if (slot.hidden) {\n diagnostics.push(\n diagnostic(\n 'a11y:hidden-slot',\n `A11y pattern requires slot \"${name}\", which is hidden`,\n name,\n ),\n )\n continue\n }\n if (\n requirement.capability !== undefined &&\n !Capability.extendsCapability(slot.capability, requirement.capability)\n ) {\n diagnostics.push(\n diagnostic(\n 'a11y:capability-mismatch',\n `A11y pattern requires capability \"${MetadataToken.nameOf(requirement.capability)}\" on slot \"${name}\", which has \"${MetadataToken.nameOf(slot.capability)}\"`,\n name,\n {\n required: MetadataToken.nameOf(requirement.capability),\n actual: MetadataToken.nameOf(slot.capability),\n },\n ),\n )\n }\n for (const event of requirement.events ?? []) {\n const eventName = MetadataToken.nameOf(event)\n if (publishes(slot.events, event)) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-event',\n `A11y pattern requires event \"${eventName}\" on slot \"${name}\", which does not publish it`,\n name,\n { event: eventName },\n ),\n )\n }\n for (const attribute of requirement.attributes ?? []) {\n const attributeName = MetadataToken.nameOf(attribute)\n if (publishes(slot.attributes, attribute)) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-attribute',\n `A11y pattern requires attribute \"${attributeName}\" on slot \"${name}\", which does not publish it`,\n name,\n { attribute: attributeName },\n ),\n )\n }\n }\n return diagnostics\n}\n","/**\n * Slot attribute tokens. Ported from `effect-atom-jsx/src/View.ts` `Attribute`,\n * plus ARIA names the Foldkit plan lists.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type AttrToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.attribute',\n Name\n>\n\nexport const is = (value: unknown): value is AttrToken =>\n MetadataToken.is(value) && value.kind === 'view.attribute'\n\nexport const make = <const Name extends string>(name: Name): AttrToken<Name> =>\n MetadataToken.make('view.attribute', name)\n\nexport const equals = (left: AttrToken, right: AttrToken): boolean => left.name === right.name\n\nexport const describe = (attr: AttrToken): { readonly name: string } => ({\n name: attr.name,\n})\n\nexport const Role = make('role')\nexport const AriaLabel = make('aria-label')\nexport const AriaDescribedby = make('aria-describedby')\nexport const AriaExpanded = make('aria-expanded')\nexport const AriaSelected = make('aria-selected')\nexport const AriaInvalid = make('aria-invalid')\nexport const AriaDisabled = make('aria-disabled')\nexport const Disabled = make('disabled')\nexport const Value = make('value')\n","/**\n * Structured diagnostics for attachment conflicts. Codes are stable so tests,\n * DevTools, and editor tooling can share them. Resolution failures are\n * programming errors (a definition attaches something a slot does not allow),\n * so `resolve` throws a `DiagnosticError` carrying one.\n */\nexport type DiagnosticCode =\n | 'mixins:unknown-slot'\n | 'mixins:hidden-slot'\n | 'mixins:capability-mismatch'\n | 'mixins:unsupported-event'\n | 'mixins:unsupported-attribute'\n | 'mixins:protected-event'\n | 'mixins:protected-attribute'\n | 'mixins:protected-style-property'\n | 'mixins:event-conflict'\n | 'mixins:attribute-conflict'\n | 'mixins:structural-override'\n | 'mixins:duplicate-mount-name'\n | 'style:conditional-rules-unsupported'\n | 'a11y:missing-slot'\n | 'a11y:hidden-slot'\n | 'a11y:capability-mismatch'\n | 'a11y:missing-event'\n | 'a11y:missing-attribute'\n\nexport interface Diagnostic {\n readonly source: 'mixins' | 'a11y'\n readonly code: DiagnosticCode\n readonly severity: 'error'\n readonly message: string\n readonly slot?: string\n readonly details?: Readonly<Record<string, unknown>>\n}\n\nexport class DiagnosticError extends Error {\n readonly diagnostic: Diagnostic\n\n constructor(diagnostic: Diagnostic) {\n super(diagnostic.message)\n this.name = 'DiagnosticError'\n this.diagnostic = diagnostic\n }\n}\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 * Internal attribute helpers. Foldkit's `isChildAttribute` and the tagged\n * attribute shape are not public, so this module localizes the two casts they\n * require. 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 Object.hasOwn(value, '_tag') &&\n typeof (value as { readonly _tag?: unknown })._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 * 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 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 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)) style.set(property, value)\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 for (const [property, value] of Object.entries(attribute.value)) {\n if (protectedStyle.has(property)) {\n fail(\n 'mixins:protected-style-property',\n `slot \"${slot ?? '?'}\" protects style property \"${property}\"`,\n { property },\n )\n }\n style.set(property, value)\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 if (protectedStyle.has(property)) {\n fail(\n 'mixins:protected-style-property',\n `slot \"${slot ?? '?'}\" protects style property \"${property}\"`,\n { property },\n )\n }\n style.set(property, value)\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 type { Html, HtmlBuilder } from 'foldkit/html'\nimport type { SlotContribution } from './contribution.js'\nimport { evaluate, type AnyMixin, type Mixin, type MixinFor, type StaticMixin } 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> = {\n readonly attrs: (base?: SlotAttributes<Message>) => SlotAttributes<Message>\n}\n\nexport type SlotBuilders<Slots, Message> = {\n readonly [K in keyof Slots]: SlotBuilder<Message>\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/** 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 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>) => {\n const contributions = []\n for (const mixin of mixins) {\n const contribution = mixin.contributions[name]\n if (contribution !== undefined) {\n contributions.push(\n evaluate(contribution as SlotContribution<Message>, {\n input: context.input,\n h: context.h,\n }),\n )\n }\n }\n return resolve(base, contributions, { slot: name, protected: protection })\n },\n }\n }\n return builders as SlotBuilders<Slots, Message>\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/** 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 * `Behavior` is a named set of interaction contributions attached to declared\n * Slots. It owns no state: attributes are built from the view's `input` and `h`\n * while resolving, so the Message universe is the view's. A stateful widget is\n * a Foldkit Submodel; a continuous element listener is a Mount; a network call\n * is Message -> update -> Command.\n */\nimport type { Attribute, ChildAttribute, HtmlBuilder } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\nimport * as Capability from './capability.js'\nimport type { SlotContribution } from './contribution.js'\nimport { DiagnosticError, type DiagnosticCode } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport * as Mixin from './mixin.js'\nimport type { Mixin as MixinValue } from './mixin.js'\nimport type { Any as AnySlot, AttributeName, EventName, HiddenOf, SlotCapability } from './slot.js'\nimport * as SlotView from './slotView.js'\n\nexport interface SlotRequirements {\n readonly capability?: SlotCapability\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n}\n\nexport interface BehaviorSlotOptions<Input, Message> {\n readonly requires?: SlotRequirements\n readonly attributes?: (context: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => ReadonlyArray<Attribute<Message> | ChildAttribute>\n readonly mount?: (input: Input) => MountAction<Message, any>\n}\n\nexport type BehaviorSpec<Slots, Input, Message> = {\n readonly [K in keyof Slots as HiddenOf<Slots[K]> extends true ? never : K]?: BehaviorSlotOptions<\n Input,\n Message\n >\n}\n\nexport interface NamedBehavior<Slots, Input, Message> {\n readonly name?: string\n readonly spec: BehaviorSpec<Slots, Input, Message>\n readonly mixin: MixinValue<Message>\n}\n\n/** Identity helper; `forSlots` supplies the contextual `Input`/`Message`. */\nexport const slot = <Options extends BehaviorSlotOptions<any, any>>(options: Options): Options =>\n options\n\nfunction fail(\n code: DiagnosticCode,\n message: string,\n slotName: string,\n details?: Readonly<Record<string, unknown>>,\n): never {\n throw new DiagnosticError({\n source: 'mixins',\n code,\n severity: 'error',\n message,\n slot: slotName,\n ...(details === undefined ? {} : { details }),\n })\n}\n\nconst validateRequirements = (\n name: string,\n slot: AnySlot,\n requirements: SlotRequirements,\n): void => {\n if (\n requirements.capability !== undefined &&\n !Capability.extendsCapability(slot.capability, requirements.capability)\n ) {\n fail(\n 'mixins:capability-mismatch',\n `Behavior requires capability \"${MetadataToken.nameOf(requirements.capability)}\" on slot \"${name}\", which has \"${MetadataToken.nameOf(slot.capability)}\"`,\n name,\n { required: MetadataToken.nameOf(requirements.capability) },\n )\n }\n for (const event of requirements.events ?? []) {\n const eventName = MetadataToken.nameOf(event)\n if (!slot.events.some(allowed => MetadataToken.nameOf(allowed) === eventName)) {\n fail(\n 'mixins:unsupported-event',\n `Behavior requires event \"${eventName}\" on slot \"${name}\", which does not publish it`,\n name,\n { event: eventName },\n )\n }\n }\n for (const attribute of requirements.attributes ?? []) {\n const attributeName = MetadataToken.nameOf(attribute)\n if (!slot.attributes.some(allowed => MetadataToken.nameOf(allowed) === attributeName)) {\n fail(\n 'mixins:unsupported-attribute',\n `Behavior requires attribute \"${attributeName}\" on slot \"${name}\", which does not publish it`,\n name,\n { attribute: attributeName },\n )\n }\n }\n}\n\nexport const forSlots =\n <Slots>(slots: Slots) =>\n <Input, Message>(\n spec: BehaviorSpec<Slots, Input, Message>,\n options?: { readonly name?: string },\n ): NamedBehavior<Slots, Input, Message> => {\n const source = slots as unknown as Record<string, AnySlot>\n const contributions: Record<string, SlotContribution<Message>> = Object.create(null)\n for (const [name, slotOptions] of Object.entries(\n spec as Record<string, BehaviorSlotOptions<Input, Message> | undefined>,\n )) {\n const target = source[name]\n if (target === undefined) {\n fail('mixins:unknown-slot', `Behavior targets unknown slot \"${name}\"`, name)\n }\n if (target.hidden) {\n fail('mixins:hidden-slot', `Behavior targets hidden slot \"${name}\"`, name)\n }\n if (slotOptions?.requires !== undefined) {\n validateRequirements(name, target, slotOptions.requires)\n }\n const attributes = slotOptions?.attributes\n const mount = slotOptions?.mount\n if (attributes === undefined && mount === undefined) continue\n contributions[name] = context => ({\n ...(attributes === undefined\n ? {}\n : { attributes: attributes({ input: context.input as Input, h: context.h }) }),\n ...(mount === undefined ? {} : { mounts: [mount(context.input as Input)] }),\n })\n }\n return Object.freeze({\n ...(options?.name === undefined ? {} : { name: options.name }),\n spec,\n mixin: Mixin.dynamic<Message>(options?.name ?? 'Behavior', contributions),\n })\n }\n\n/**\n * Attaches a Behavior to a view. The behavior's `Input` becomes the attached\n * view's `Input`: a behavior declared over only the fields it reads is rejected\n * even though those fields are a subset, and one declared over extra fields\n * widens what the view must be called with. Declare `Input` as the view's own\n * input type.\n */\nexport const attach =\n <BehaviorSlots, Message, Input>(behavior: NamedBehavior<BehaviorSlots, Input, Message>) =>\n <ViewSlots>(\n view: SlotView.SlotView<ViewSlots, Input, Message>,\n ): SlotView.SlotView<ViewSlots, Input, Message> =>\n SlotView.attach(behavior.mixin)(view)\n\nexport const Behavior = { slot, forSlots, attach } as const\n","/**\n * Slot event tokens. Ported from `effect-atom-jsx/src/View.ts` `Event`, plus\n * the extra names the Foldkit plan lists.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type EventToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.event',\n Name\n>\n\nexport const is = (value: unknown): value is EventToken =>\n MetadataToken.is(value) && value.kind === 'view.event'\n\nexport const make = <const Name extends string>(name: Name): EventToken<Name> =>\n MetadataToken.make('view.event', name)\n\nexport const equals = (left: EventToken, right: EventToken): boolean => left.name === right.name\n\nexport const describe = (event: EventToken): { readonly name: string } => ({\n name: event.name,\n})\n\nexport const Press = make('press')\nexport const Click = make('click')\nexport const Cancel = make('cancel')\nexport const Input = make('input')\nexport const Change = make('change')\nexport const Focus = make('focus')\nexport const Blur = make('blur')\nexport const KeyDown = make('keydown')\nexport const PointerDown = make('pointerdown')\nexport const PointerUp = make('pointerup')\nexport const Hover = make('hover')\nexport const Submit = make('submit')\n","/**\n * Platform requirement tokens. Ported from `effect-atom-jsx/src/View.ts`\n * `Requirement`.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type RequirementToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.requirement',\n Name\n>\n\nexport const is = (value: unknown): value is RequirementToken =>\n MetadataToken.is(value) && value.kind === 'view.requirement'\n\nexport const make = <const Name extends string>(name: Name): RequirementToken<Name> =>\n MetadataToken.make('view.requirement', name)\n\nexport const describe = (requirement: RequirementToken): { readonly name: string } => ({\n name: requirement.name,\n})\n\nexport const Keyboard = make('keyboard')\nexport const Pointer = make('pointer')\nexport const Clipboard = make('clipboard')\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 * Deterministic compilation of rule-based Style. A rule selector is written\n * relative to the generated class with `&` (`&:hover`). The class name is an\n * FNV-1a hash of the canonical rule text, so equal rules share a class and the\n * server and the browser derive the same name. Pure data in, CSS text out: no\n * registry, no DOM, no `Date.now`.\n */\nexport interface StyleRule {\n readonly selector: string\n readonly at?: string\n readonly declarations: Readonly<Record<string, string>>\n}\n\nexport const rule = (\n selector: string,\n declarations: Readonly<Record<string, string>>,\n at?: string,\n): StyleRule =>\n Object.freeze({\n selector,\n declarations: Object.freeze({ ...declarations }),\n ...(at === undefined ? {} : { at }),\n })\n\nexport const pseudo = (suffix: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule(`&${suffix}`, declarations)\n\nexport const media = (query: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule('&', declarations, `@media ${query}`)\n\nexport const supports = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleRule => rule('&', declarations, `@supports ${condition}`)\n\nexport const container = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleRule => rule('&', declarations, `@container ${condition}`)\n\n/** A nested selector relative to the class, e.g. `> span` or `[data-open] &`. */\nexport const nest = (selector: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule(`& ${selector}`, declarations)\n\n/** `gridTemplateColumns` -> `grid-template-columns`; custom properties pass through. */\nconst kebab = (property: string): string =>\n property.startsWith('--')\n ? property\n : property.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n\nconst declarationsText = (declarations: Readonly<Record<string, string>>): string =>\n Object.keys(declarations)\n .sort()\n .map(property => `${kebab(property)}:${declarations[property]}`)\n .join(';')\n\n/** Canonical, declaration-sorted, authored-rule-order text for a rule list. */\nexport const canonical = (rules: ReadonlyArray<StyleRule>): string =>\n rules\n .map(entry => {\n const body = `{${declarationsText(entry.declarations)}}`\n return entry.at === undefined\n ? `${entry.selector}${body}`\n : `${entry.at}{${entry.selector}${body}}`\n })\n .join('')\n\nconst hash = (value: string): string => {\n let state = 2166136261\n for (let index = 0; index < value.length; index++) {\n state ^= value.charCodeAt(index)\n state = Math.imul(state, 16777619)\n }\n return (state >>> 0).toString(36)\n}\n\nexport interface Keyframes {\n readonly name: string\n readonly css: string\n}\n\n/** Deterministic `@keyframes`: step order is authored, declarations sorted. */\nexport const keyframes = (\n frames: Readonly<Record<string, Readonly<Record<string, string>>>>,\n): Keyframes => {\n const body = Object.entries(frames)\n .map(([step, declarations]) => `${step}{${declarationsText(declarations)}}`)\n .join('')\n const name = `kf-${hash(body)}`\n return Object.freeze({ name, css: `@keyframes ${name}{${body}}` })\n}\n\nexport const className = (rules: ReadonlyArray<StyleRule>): string =>\n `style-${hash(canonical(rules))}`\n\nconst selectorFor = (generated: string, selector: string): string =>\n selector.includes('&') ? selector.replace(/&/g, `.${generated}`) : `.${generated} ${selector}`\n\nexport const css = (generated: string, rules: ReadonlyArray<StyleRule>): string =>\n rules\n .map(entry => {\n const body = `{${declarationsText(entry.declarations)}}`\n const selector = `${selectorFor(generated, entry.selector)}${body}`\n return entry.at === undefined ? selector : `${entry.at}{${selector}}`\n })\n .join('')\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.\n */\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 type { HiddenOf } from './slot.js'\nimport * as SlotView from './slotView.js'\nimport * as Rules from './styleRules.js'\nimport type { StyleRule } from './styleRules.js'\n\nexport interface StyleValue {\n readonly classes: ReadonlyArray<string>\n readonly style: Readonly<Record<string, string>>\n /** Input-driven pieces resolved at render time; empty for a static style. */\n readonly conditions?: ReadonlyArray<StyleCondition>\n /** Rule-based appearance compiled to a deterministic class plus CSS. */\n readonly rules?: ReadonlyArray<StyleRule>\n /** Class-independent CSS (keyframes, layers, global rules). */\n readonly globalCss?: ReadonlyArray<string>\n}\n\nexport interface StyleCondition {\n readonly predicate: (input: unknown) => boolean\n readonly piece: StyleValue\n}\n\n/** A hidden slot is internal: it is neither styleable nor behavior-targetable. */\nexport type StylePieces<Slots> = {\n readonly [K in keyof Slots as HiddenOf<Slots[K]> extends true ? never : K]?: StyleValue\n}\n\nexport interface NamedStyle<Slots> {\n readonly name?: string\n readonly pieces: StylePieces<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\nconst tokens = (value: string): ReadonlyArray<string> =>\n value.split(/\\s+/).filter(token => token.length > 0)\n\nexport const empty: StyleValue = Object.freeze({\n classes: Object.freeze([]) as ReadonlyArray<string>,\n style: Object.freeze({}) as Readonly<Record<string, string>>,\n})\n\nexport const classPiece = (value: string): StyleValue =>\n Object.freeze({ classes: Object.freeze(tokens(value)), style: empty.style })\n\nexport const inline = (value: Readonly<Record<string, string>>): StyleValue =>\n Object.freeze({ classes: empty.classes, style: Object.freeze({ ...value }) })\n\n/** Concatenate classes; later inline declarations win per property. */\nexport const compose = (...pieces: ReadonlyArray<StyleValue>): StyleValue => {\n const conditions = pieces.flatMap(piece => piece.conditions ?? [])\n const rules = pieces.flatMap(piece => piece.rules ?? [])\n const globalCss = pieces.flatMap(piece => piece.globalCss ?? [])\n return Object.freeze({\n classes: Object.freeze(pieces.flatMap(piece => piece.classes)),\n style: Object.freeze(Object.assign(Object.create(null), ...pieces.map(piece => piece.style))),\n ...(conditions.length === 0 ? {} : { conditions: Object.freeze(conditions) }),\n ...(rules.length === 0 ? {} : { rules: Object.freeze(rules) }),\n ...(globalCss.length === 0 ? {} : { globalCss: Object.freeze(globalCss) }),\n })\n}\n\n/** A pseudo-class/element rule, e.g. `Style.pseudo(':hover', { color: 'red' })`. */\nexport const pseudo = (\n suffix: string,\n declarations: Readonly<Record<string, string>>,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.pseudo(suffix, declarations)]),\n })\n\n/** An at-rule, e.g. `Style.media('(min-width: 40rem)', { color: 'red' })`. */\nexport const media = (query: string, declarations: Readonly<Record<string, string>>): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.media(query, declarations)]),\n })\n\n/** An at-rule, e.g. `Style.supports('(display: grid)', { display: 'grid' })`. */\nexport const supports = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.supports(condition, declarations)]),\n })\n\n/** A container query, e.g. `Style.container('(min-width: 30rem)', {...})`. */\nexport const container = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.container(condition, declarations)]),\n })\n\n/** A nested selector relative to the generated class, e.g. `Style.nest('> span', {...})`. */\nexport const nest = (\n selector: string,\n declarations: Readonly<Record<string, string>>,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.nest(selector, declarations)]),\n })\n\n/**\n * A deterministic `@keyframes` block. Compose `style` where the animation is\n * declared and reference `name` in an `animation` declaration.\n */\nexport const keyframes = (\n frames: Readonly<Record<string, Readonly<Record<string, string>>>>,\n): { readonly name: string; readonly style: StyleValue } => {\n const compiled = Rules.keyframes(frames)\n return Object.freeze({\n name: compiled.name,\n style: Object.freeze({\n classes: empty.classes,\n style: empty.style,\n globalCss: Object.freeze([compiled.css]),\n }),\n })\n}\n\n/** Raw class-independent CSS (a layer, a global rule). Prefer typed helpers. */\nexport const global = (css: string): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n globalCss: Object.freeze([css]),\n })\n\n/** A boolean known at authoring time. */\nexport const when = (condition: boolean, piece: StyleValue): StyleValue =>\n condition ? 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>(\n predicate: (input: Input) => boolean,\n piece: StyleValue,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n conditions: Object.freeze([\n { predicate: (input: unknown) => predicate(input as Input), piece },\n ]),\n })\n\n/** Fold every active condition (recursively) into a condition-free style. */\nconst resolveStyle = (style: StyleValue, input: unknown): StyleValue => {\n const active = (style.conditions ?? [])\n .filter(condition => condition.predicate(input))\n .map(condition => resolveStyle(condition.piece, input))\n return Object.freeze({\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\nconst hasConditionalRules = (style: StyleValue): boolean =>\n (style.conditions ?? []).some(\n condition => (condition.piece.rules ?? []).length > 0 || hasConditionalRules(condition.piece),\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}\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/** A rule-bearing style gets one deterministic class and its CSS text. */\nconst compileStyle = (style: StyleValue): CompiledStyle => {\n const rules = style.rules ?? []\n const globalRules = collectGlobalCss(style)\n const generated = rules.length === 0 ? undefined : Rules.className(rules)\n return {\n classes: generated === undefined ? style.classes : Object.freeze([...style.classes, generated]),\n style: style.style,\n ...(generated === undefined ? {} : { css: Rules.css(generated, rules), ruleClass: generated }),\n ...(globalRules.length === 0 ? {} : { globalRules }),\n }\n}\n\n/** A rule's class is static while a `whenInput` condition is not, so they cannot combine. */\nconst assertRulesSupported = (style: StyleValue): void => {\n if (!hasConditionalRules(style)) return\n throw new DiagnosticError({\n source: 'mixins',\n code: 'style:conditional-rules-unsupported',\n severity: 'error',\n message: 'Style.pseudo/media may not appear inside Style.whenInput',\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 = (style: StyleValue, compiled: CompiledStyle): 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) return Object.freeze(attributes)\n const contribution: InputContribution<never> = context => {\n const resolved = resolveStyle({ ...style, classes: compiled.classes }, context.input)\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?: { readonly name?: string }): NamedStyle<Slots> => {\n const known = slots as unknown as Record<string, unknown>\n const contributions: Record<string, SlotContribution<never>> = 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, StyleValue | 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 // 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 assertRulesSupported(piece)\n const compiled = compileStyle(piece)\n contributions[key] = contributionFrom(piece, compiled)\n if (compiled.ruleClass !== undefined && compiled.css !== undefined) {\n rules.push({ className: compiled.ruleClass, css: compiled.css })\n css += compiled.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,\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\n/** Deduplicated global then scoped CSS for one `<style>` block, first seen wins. */\nexport const stylesheet = (\n ...styles: ReadonlyArray<{\n readonly rules: ReadonlyArray<{ readonly className: string; readonly css: string }>\n readonly globalRules: ReadonlyArray<string>\n }>\n): string => {\n const scoped = new Map<string, string>()\n const global = new Set<string>()\n for (const style of styles) {\n for (const rule of style.rules) {\n if (!scoped.has(rule.className)) scoped.set(rule.className, rule.css)\n }\n for (const rule of style.globalRules) global.add(rule)\n }\n return [...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 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 D['variants']]?: keyof 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 const Style = {\n class: classPiece,\n inline,\n compose,\n when,\n whenInput,\n pseudo,\n media,\n supports,\n container,\n nest,\n keyframes,\n global,\n empty,\n forSlots,\n attach,\n recipe,\n stylesheet,\n} as const\n","/**\n * `Theme` is typed token data, not a service. Dynamic theme state (light/dark)\n * belongs in the Foldkit Model; `variables` compiles the tokens to CSS custom\n * properties so switching a class or a root style is cheap and SSR-safe.\n */\nimport type { StyleValue } from './style.js'\nimport { inline } from './style.js'\n\nexport type ThemeTokens = {\n readonly [group: string]: { readonly [name: string]: string }\n}\n\nexport type Theme<T extends ThemeTokens = ThemeTokens> = T\n\nconst VAR_PREFIX = '--fk'\n\nexport const define = <T extends ThemeTokens>(tokens: T): Readonly<T> =>\n Object.freeze(\n Object.fromEntries(\n Object.entries(tokens).map(([group, names]) => [group, Object.freeze({ ...names })]),\n ),\n ) as Readonly<T>\n\nexport const variable = <T extends ThemeTokens, G extends keyof T & string>(\n _theme: T,\n group: G,\n name: keyof T[G] & string,\n): string => `var(${VAR_PREFIX}-${group}-${name})`\n\nexport const variables = <T extends ThemeTokens>(theme: T): StyleValue => {\n const style: Record<string, string> = {}\n for (const [group, names] of Object.entries(theme)) {\n for (const [name, value] of Object.entries(names as Record<string, string>)) {\n style[`${VAR_PREFIX}-${group}-${name}`] = value\n }\n }\n return inline(style)\n}\n\nexport const Theme = { define, variable, variables } 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,MAAM,eAAe,KAAK,mDAAmD;CACzF;CACA,cAAc,IAAI,MAAM,WAAW;CACnC,MAAM,aAAwC;EAC5C,GAAGC,OAA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SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,WAAW,UAAU,aAAa,KAAK,GACxF,OAAO,KAAK,SAAS,KAAK;CAG9B,OAAO,QAAQ,GAAG,MAAM;AAC1B;AAEF,MAAa,QAAQ;CACnB,OAAO;CACP;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;AClYA,MAAM,aAAa;AAEnB,MAAa,UAAiC,WAC5C,OAAO,OACL,OAAO,YACL,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,OAAO,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CACrF,CACF;AAEF,MAAa,YACX,QACA,OACA,SACW,OAAO,WAAW,GAAG,MAAM,GAAG,KAAK;AAEhD,MAAa,aAAoC,UAAyB;CACxE,MAAM,QAAgC,CAAC;CACvC,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,GAC/C,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAA+B,GACxE,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU;CAG9C,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,QAAQ;CAAE;CAAQ;CAAU;AAAU"}
1
+ {"version":3,"file":"index.mjs","names":["make","is","is","MetadataToken.is","make","MetadataToken.nameOf","MetadataToken.make","describe","MetadataToken.nameOf","Capability.extendsCapability","is","MetadataToken.is","make","MetadataToken.make","equals","describe","ih","make","empty","compose","MetadataToken.nameOf","define","attach","Capability.extendsCapability","MetadataToken.nameOf","forSlots","Mixin.dynamic","attach","SlotView.attach","is","MetadataToken.is","make","MetadataToken.make","describe","is","MetadataToken.is","make","MetadataToken.make","describe","Capability.Base","describe","MetadataToken.nameOf","Slot.is","Slot.make","define","Slot.describe","Capability.extendsCapability","pseudo","media","supports","container","nest","keyframes","Rules.pseudo","Rules.media","Rules.supports","Rules.container","Rules.nest","Rules.keyframes","Rules.className","Rules.css","Mixin.dynamic","SlotView.attach"],"sources":["../src/metadataToken.ts","../src/capability.ts","../src/a11y.ts","../src/attr.ts","../src/attribute.ts","../src/attributes.ts","../src/diagnostics.ts","../src/mixin.ts","../src/pipe.ts","../src/resolver.ts","../src/slotView.ts","../src/behavior.ts","../src/event.ts","../src/requirement.ts","../src/slot.ts","../src/slots.ts","../src/styleRules.ts","../src/style.ts","../src/theme.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 * Structural accessibility validation. A `Pattern` names the Slots a widget\n * must publish, the capabilities those Slots must satisfy, and the events and\n * attributes they must expose. `validate` compares a `Slots` contract against a\n * pattern and reports every mismatch as a `Diagnostic`. It is pure and\n * DOM-independent: it checks the declared contract, not a rendered tree, so it\n * verifies only the contract it is given and does not certify WCAG conformance.\n */\nimport * as Capability from './capability.js'\nimport type { Diagnostic } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport type { Any as AnySlot, AttributeName, EventName, SlotCapability } from './slot.js'\n\nexport type A11yDiagnosticCode =\n | 'a11y:missing-slot'\n | 'a11y:hidden-slot'\n | 'a11y:capability-mismatch'\n | 'a11y:missing-event'\n | 'a11y:missing-attribute'\n\nexport interface A11yDiagnostic extends Diagnostic {\n readonly source: 'a11y'\n readonly code: A11yDiagnosticCode\n}\n\nexport interface SlotRequirement {\n readonly capability?: SlotCapability\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n /** An absent slot is expected, not a diagnostic. A present slot is still checked. */\n readonly optional?: boolean\n}\n\nexport type Requirements = Readonly<Record<string, SlotRequirement>>\n\nexport const PatternTypeId: unique symbol = Symbol.for('foldkit-mixins/A11yPattern')\n\nexport interface Pattern<Spec extends Requirements = Requirements> {\n readonly [PatternTypeId]: { readonly Requirements: Spec }\n readonly requirements: Spec\n}\n\nexport const pattern = <const Spec extends Requirements>(spec: Spec): Pattern<Spec> => {\n const requirements = Object.create(null) as Record<string, SlotRequirement>\n for (const name of Object.getOwnPropertyNames(spec)) {\n const requirement = spec[name]\n if (requirement === undefined) continue\n Object.defineProperty(requirements, name, {\n value: Object.freeze({ ...requirement }),\n enumerable: true,\n configurable: false,\n writable: false,\n })\n }\n Object.freeze(requirements)\n return Object.freeze({\n [PatternTypeId]: { Requirements: undefined as unknown as Spec },\n requirements: requirements as Spec,\n }) as Pattern<Spec>\n}\n\nconst publishes = (\n names: ReadonlyArray<string | MetadataToken.Any>,\n required: string | MetadataToken.Any,\n): boolean => {\n const requiredName = MetadataToken.nameOf(required)\n return names.some(name => MetadataToken.nameOf(name) === requiredName)\n}\n\nconst diagnostic = (\n code: A11yDiagnosticCode,\n message: string,\n slot: string,\n details?: Readonly<Record<string, unknown>>,\n): A11yDiagnostic => ({\n source: 'a11y',\n code,\n severity: 'error',\n message,\n slot,\n ...(details === undefined ? {} : { details }),\n})\n\nexport const validate = (\n pattern: Pattern,\n slots: { readonly [name: string]: AnySlot },\n): ReadonlyArray<A11yDiagnostic> => {\n const diagnostics: Array<A11yDiagnostic> = []\n for (const name of Object.getOwnPropertyNames(pattern.requirements)) {\n const requirement = pattern.requirements[name]\n if (requirement === undefined) continue\n if (!Object.hasOwn(slots, name)) {\n if (requirement.optional === true) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-slot',\n `A11y pattern requires slot \"${name}\", which the contract does not publish`,\n name,\n ),\n )\n continue\n }\n const slot = slots[name]\n if (slot === undefined) continue\n if (slot.hidden) {\n diagnostics.push(\n diagnostic(\n 'a11y:hidden-slot',\n `A11y pattern requires slot \"${name}\", which is hidden`,\n name,\n ),\n )\n continue\n }\n if (\n requirement.capability !== undefined &&\n !Capability.extendsCapability(slot.capability, requirement.capability)\n ) {\n diagnostics.push(\n diagnostic(\n 'a11y:capability-mismatch',\n `A11y pattern requires capability \"${MetadataToken.nameOf(requirement.capability)}\" on slot \"${name}\", which has \"${MetadataToken.nameOf(slot.capability)}\"`,\n name,\n {\n required: MetadataToken.nameOf(requirement.capability),\n actual: MetadataToken.nameOf(slot.capability),\n },\n ),\n )\n }\n for (const event of requirement.events ?? []) {\n const eventName = MetadataToken.nameOf(event)\n if (publishes(slot.events, event)) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-event',\n `A11y pattern requires event \"${eventName}\" on slot \"${name}\", which does not publish it`,\n name,\n { event: eventName },\n ),\n )\n }\n for (const attribute of requirement.attributes ?? []) {\n const attributeName = MetadataToken.nameOf(attribute)\n if (publishes(slot.attributes, attribute)) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-attribute',\n `A11y pattern requires attribute \"${attributeName}\" on slot \"${name}\", which does not publish it`,\n name,\n { attribute: attributeName },\n ),\n )\n }\n }\n return diagnostics\n}\n","/**\n * Slot attribute tokens. Ported from `effect-atom-jsx/src/View.ts` `Attribute`,\n * plus ARIA names the Foldkit plan lists.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type AttrToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.attribute',\n Name\n>\n\nexport const is = (value: unknown): value is AttrToken =>\n MetadataToken.is(value) && value.kind === 'view.attribute'\n\nexport const make = <const Name extends string>(name: Name): AttrToken<Name> =>\n MetadataToken.make('view.attribute', name)\n\nexport const equals = (left: AttrToken, right: AttrToken): boolean => left.name === right.name\n\nexport const describe = (attr: AttrToken): { readonly name: string } => ({\n name: attr.name,\n})\n\nexport const Role = make('role')\nexport const AriaLabel = make('aria-label')\nexport const AriaDescribedby = make('aria-describedby')\nexport const AriaExpanded = make('aria-expanded')\nexport const AriaSelected = make('aria-selected')\nexport const AriaInvalid = make('aria-invalid')\nexport const AriaDisabled = make('aria-disabled')\nexport const Disabled = make('disabled')\nexport const Value = make('value')\n","/**\n * Internal attribute helpers. Foldkit's `isChildAttribute` and the tagged\n * attribute shape are not public, so this module localizes the two casts they\n * require. 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 Object.hasOwn(value, '_tag') &&\n typeof (value as { readonly _tag?: unknown })._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 * Typed reads over a resolved `SlotAttributes` bundle. Foldkit's tagged\n * attribute union narrows on `_tag`, so a lookup by tag returns that variant's\n * own fields (`value`, `message`, `key`, `action`) without a cast.\n */\nimport type { Attribute } from 'foldkit/html'\nimport { isTagged } from './attribute.js'\nimport type { SlotAttributes } from './resolver.js'\n\n/** Every Foldkit attribute tag: `'Class'`, `'OnClick'`, `'DataAttribute'`, … */\nexport type Tag = Attribute<never>['_tag']\n\n/** The attribute variant carrying `T`. */\nexport type Of<Message, T extends Tag> = Extract<Attribute<Message>, { readonly _tag: T }>\n\n/** The tag of one bundle entry; `undefined` for an opaque `ChildAttribute`. */\nexport const tagOf = <Message>(attribute: SlotAttributes<Message>[number]): Tag | undefined =>\n isTagged(attribute) ? attribute._tag : undefined\n\nconst hasTag =\n <Message, T extends Tag>(tag: T) =>\n (attribute: SlotAttributes<Message>[number]): attribute is Of<Message, T> =>\n tagOf(attribute) === tag\n\n/** The first attribute with `tag`, typed as that variant. */\nexport const find = <Message, T extends Tag>(\n attributes: SlotAttributes<Message>,\n tag: T,\n): Of<Message, T> | undefined => attributes.find(hasTag<Message, T>(tag))\n\n/** Every attribute with `tag`, in bundle order. */\nexport const filter = <Message, T extends Tag>(\n attributes: SlotAttributes<Message>,\n tag: T,\n): ReadonlyArray<Of<Message, T>> => attributes.filter(hasTag<Message, T>(tag))\n","/**\n * Structured diagnostics for attachment conflicts. Codes are stable so tests,\n * DevTools, and editor tooling can share them. Resolution failures are\n * programming errors (a definition attaches something a slot does not allow),\n * so `resolve` throws a `DiagnosticError` carrying one.\n */\nexport type DiagnosticCode =\n | 'mixins:unknown-slot'\n | 'mixins:hidden-slot'\n | 'mixins:capability-mismatch'\n | 'mixins:unsupported-event'\n | 'mixins:unsupported-attribute'\n | 'mixins:protected-event'\n | 'mixins:protected-attribute'\n | 'mixins:protected-style-property'\n | 'mixins:event-conflict'\n | 'mixins:attribute-conflict'\n | 'mixins:structural-override'\n | 'mixins:duplicate-mount-name'\n | 'style:conditional-rules-unsupported'\n | 'a11y:missing-slot'\n | 'a11y:hidden-slot'\n | 'a11y:capability-mismatch'\n | 'a11y:missing-event'\n | 'a11y:missing-attribute'\n\nexport interface Diagnostic {\n readonly source: 'mixins' | 'a11y'\n readonly code: DiagnosticCode\n readonly severity: 'error'\n readonly message: string\n readonly slot?: string\n readonly details?: Readonly<Record<string, unknown>>\n}\n\nexport class DiagnosticError extends Error {\n readonly diagnostic: Diagnostic\n\n constructor(diagnostic: Diagnostic) {\n super(diagnostic.message)\n this.name = 'DiagnosticError'\n this.diagnostic = diagnostic\n }\n}\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 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 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)) style.set(property, value)\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 for (const [property, value] of Object.entries(attribute.value)) {\n if (protectedStyle.has(property)) {\n fail(\n 'mixins:protected-style-property',\n `slot \"${slot ?? '?'}\" protects style property \"${property}\"`,\n { property },\n )\n }\n style.set(property, value)\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 if (protectedStyle.has(property)) {\n fail(\n 'mixins:protected-style-property',\n `slot \"${slot ?? '?'}\" protects style property \"${property}\"`,\n { property },\n )\n }\n style.set(property, value)\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 { inertHtml, type Html, type HtmlBuilder } from 'foldkit/html'\nimport type { SlotContribution } from './contribution.js'\nimport { evaluate, type AnyMixin, type Mixin, type MixinFor, type StaticMixin } 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> = {\n readonly attrs: (base?: SlotAttributes<Message>) => SlotAttributes<Message>\n}\n\nexport type SlotBuilders<Slots, Message> = {\n readonly [K in keyof Slots]: SlotBuilder<Message>\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/** 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 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>) => {\n const contributions = []\n for (const mixin of mixins) {\n const contribution = mixin.contributions[name]\n if (contribution !== undefined) {\n contributions.push(\n evaluate(contribution as SlotContribution<Message>, {\n input: context.input,\n h: context.h,\n }),\n )\n }\n }\n return resolve(base, contributions, { slot: name, protected: protection })\n },\n }\n }\n return builders as SlotBuilders<Slots, Message>\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 because inert handlers are never dispatched.\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 * `Behavior` is a named set of interaction contributions attached to declared\n * Slots. It owns no state: attributes are built from the view's `input` and `h`\n * while resolving, so the Message universe is the view's. A stateful widget is\n * a Foldkit Submodel; a continuous element listener is a Mount; a network call\n * is Message -> update -> Command.\n */\nimport type { Attribute, ChildAttribute, HtmlBuilder } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\nimport * as Capability from './capability.js'\nimport type { SlotContribution } from './contribution.js'\nimport { DiagnosticError, type DiagnosticCode } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport * as Mixin from './mixin.js'\nimport type { Mixin as MixinValue } from './mixin.js'\nimport type { Any as AnySlot, AttributeName, EventName, HiddenOf, SlotCapability } from './slot.js'\nimport * as SlotView from './slotView.js'\n\nexport interface SlotRequirements {\n readonly capability?: SlotCapability\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n}\n\nexport interface BehaviorSlotOptions<Input, Message> {\n readonly requires?: SlotRequirements\n readonly attributes?: (context: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => ReadonlyArray<Attribute<Message> | ChildAttribute>\n readonly mount?: (input: Input) => MountAction<Message, any>\n}\n\nexport type BehaviorSpec<Slots, Input, Message> = {\n readonly [K in keyof Slots as HiddenOf<Slots[K]> extends true ? never : K]?: BehaviorSlotOptions<\n Input,\n Message\n >\n}\n\nexport interface NamedBehavior<Slots, Input, Message> {\n readonly name?: string\n readonly spec: BehaviorSpec<Slots, Input, Message>\n readonly mixin: MixinValue<Message>\n}\n\n/** Identity helper; `forSlots` supplies the contextual `Input`/`Message`. */\nexport const slot = <Options extends BehaviorSlotOptions<any, any>>(options: Options): Options =>\n options\n\nfunction fail(\n code: DiagnosticCode,\n message: string,\n slotName: string,\n details?: Readonly<Record<string, unknown>>,\n): never {\n throw new DiagnosticError({\n source: 'mixins',\n code,\n severity: 'error',\n message,\n slot: slotName,\n ...(details === undefined ? {} : { details }),\n })\n}\n\nconst validateRequirements = (\n name: string,\n slot: AnySlot,\n requirements: SlotRequirements,\n): void => {\n if (\n requirements.capability !== undefined &&\n !Capability.extendsCapability(slot.capability, requirements.capability)\n ) {\n fail(\n 'mixins:capability-mismatch',\n `Behavior requires capability \"${MetadataToken.nameOf(requirements.capability)}\" on slot \"${name}\", which has \"${MetadataToken.nameOf(slot.capability)}\"`,\n name,\n { required: MetadataToken.nameOf(requirements.capability) },\n )\n }\n for (const event of requirements.events ?? []) {\n const eventName = MetadataToken.nameOf(event)\n if (!slot.events.some(allowed => MetadataToken.nameOf(allowed) === eventName)) {\n fail(\n 'mixins:unsupported-event',\n `Behavior requires event \"${eventName}\" on slot \"${name}\", which does not publish it`,\n name,\n { event: eventName },\n )\n }\n }\n for (const attribute of requirements.attributes ?? []) {\n const attributeName = MetadataToken.nameOf(attribute)\n if (!slot.attributes.some(allowed => MetadataToken.nameOf(allowed) === attributeName)) {\n fail(\n 'mixins:unsupported-attribute',\n `Behavior requires attribute \"${attributeName}\" on slot \"${name}\", which does not publish it`,\n name,\n { attribute: attributeName },\n )\n }\n }\n}\n\nexport const forSlots =\n <Slots>(slots: Slots) =>\n <Input, Message>(\n spec: BehaviorSpec<Slots, Input, Message>,\n options?: { readonly name?: string },\n ): NamedBehavior<Slots, Input, Message> => {\n const source = slots as unknown as Record<string, AnySlot>\n const contributions: Record<string, SlotContribution<Message>> = Object.create(null)\n for (const [name, slotOptions] of Object.entries(\n spec as Record<string, BehaviorSlotOptions<Input, Message> | undefined>,\n )) {\n const target = source[name]\n if (target === undefined) {\n fail('mixins:unknown-slot', `Behavior targets unknown slot \"${name}\"`, name)\n }\n if (target.hidden) {\n fail('mixins:hidden-slot', `Behavior targets hidden slot \"${name}\"`, name)\n }\n if (slotOptions?.requires !== undefined) {\n validateRequirements(name, target, slotOptions.requires)\n }\n const attributes = slotOptions?.attributes\n const mount = slotOptions?.mount\n if (attributes === undefined && mount === undefined) continue\n contributions[name] = context => ({\n ...(attributes === undefined\n ? {}\n : { attributes: attributes({ input: context.input as Input, h: context.h }) }),\n ...(mount === undefined ? {} : { mounts: [mount(context.input as Input)] }),\n })\n }\n return Object.freeze({\n ...(options?.name === undefined ? {} : { name: options.name }),\n spec,\n mixin: Mixin.dynamic<Message>(options?.name ?? 'Behavior', contributions),\n })\n }\n\n/**\n * Attaches a Behavior to a view. The behavior's `Input` becomes the attached\n * view's `Input`: a behavior declared over only the fields it reads is rejected\n * even though those fields are a subset, and one declared over extra fields\n * widens what the view must be called with. Declare `Input` as the view's own\n * input type.\n */\nexport const attach =\n <BehaviorSlots, Message, Input>(behavior: NamedBehavior<BehaviorSlots, Input, Message>) =>\n <ViewSlots>(\n view: SlotView.SlotView<ViewSlots, Input, Message>,\n ): SlotView.SlotView<ViewSlots, Input, Message> =>\n SlotView.attach(behavior.mixin)(view)\n\nexport const Behavior = { slot, forSlots, attach } as const\n","/**\n * Slot event tokens. Ported from `effect-atom-jsx/src/View.ts` `Event`, plus\n * the extra names the Foldkit plan lists.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type EventToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.event',\n Name\n>\n\nexport const is = (value: unknown): value is EventToken =>\n MetadataToken.is(value) && value.kind === 'view.event'\n\nexport const make = <const Name extends string>(name: Name): EventToken<Name> =>\n MetadataToken.make('view.event', name)\n\nexport const equals = (left: EventToken, right: EventToken): boolean => left.name === right.name\n\nexport const describe = (event: EventToken): { readonly name: string } => ({\n name: event.name,\n})\n\nexport const Press = make('press')\nexport const Click = make('click')\nexport const Cancel = make('cancel')\nexport const Input = make('input')\nexport const Change = make('change')\nexport const Focus = make('focus')\nexport const Blur = make('blur')\nexport const KeyDown = make('keydown')\nexport const PointerDown = make('pointerdown')\nexport const PointerUp = make('pointerup')\nexport const Hover = make('hover')\nexport const Submit = make('submit')\n","/**\n * Platform requirement tokens. Ported from `effect-atom-jsx/src/View.ts`\n * `Requirement`.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type RequirementToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.requirement',\n Name\n>\n\nexport const is = (value: unknown): value is RequirementToken =>\n MetadataToken.is(value) && value.kind === 'view.requirement'\n\nexport const make = <const Name extends string>(name: Name): RequirementToken<Name> =>\n MetadataToken.make('view.requirement', name)\n\nexport const describe = (requirement: RequirementToken): { readonly name: string } => ({\n name: requirement.name,\n})\n\nexport const Keyboard = make('keyboard')\nexport const Pointer = make('pointer')\nexport const Clipboard = make('clipboard')\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 * Deterministic compilation of rule-based Style. A rule selector is written\n * relative to the generated class with `&` (`&:hover`). The class name is an\n * FNV-1a hash of the canonical rule text, so equal rules share a class and the\n * server and the browser derive the same name. Pure data in, CSS text out: no\n * registry, no DOM, no `Date.now`.\n */\nexport interface StyleRule {\n readonly selector: string\n readonly at?: string\n readonly declarations: Readonly<Record<string, string>>\n}\n\nexport const rule = (\n selector: string,\n declarations: Readonly<Record<string, string>>,\n at?: string,\n): StyleRule =>\n Object.freeze({\n selector,\n declarations: Object.freeze({ ...declarations }),\n ...(at === undefined ? {} : { at }),\n })\n\nexport const pseudo = (suffix: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule(`&${suffix}`, declarations)\n\nexport const media = (query: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule('&', declarations, `@media ${query}`)\n\nexport const supports = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleRule => rule('&', declarations, `@supports ${condition}`)\n\nexport const container = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleRule => rule('&', declarations, `@container ${condition}`)\n\n/** A nested selector relative to the class, e.g. `> span` or `[data-open] &`. */\nexport const nest = (selector: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule(`& ${selector}`, declarations)\n\n/** `gridTemplateColumns` -> `grid-template-columns`; custom properties pass through. */\nconst kebab = (property: string): string =>\n property.startsWith('--')\n ? property\n : property.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n\nconst declarationsText = (declarations: Readonly<Record<string, string>>): string =>\n Object.keys(declarations)\n .sort()\n .map(property => `${kebab(property)}:${declarations[property]}`)\n .join(';')\n\n/** Canonical, declaration-sorted, authored-rule-order text for a rule list. */\nexport const canonical = (rules: ReadonlyArray<StyleRule>): string =>\n rules\n .map(entry => {\n const body = `{${declarationsText(entry.declarations)}}`\n return entry.at === undefined\n ? `${entry.selector}${body}`\n : `${entry.at}{${entry.selector}${body}}`\n })\n .join('')\n\nconst hash = (value: string): string => {\n let state = 2166136261\n for (let index = 0; index < value.length; index++) {\n state ^= value.charCodeAt(index)\n state = Math.imul(state, 16777619)\n }\n return (state >>> 0).toString(36)\n}\n\nexport interface Keyframes {\n readonly name: string\n readonly css: string\n}\n\n/** Deterministic `@keyframes`: step order is authored, declarations sorted. */\nexport const keyframes = (\n frames: Readonly<Record<string, Readonly<Record<string, string>>>>,\n): Keyframes => {\n const body = Object.entries(frames)\n .map(([step, declarations]) => `${step}{${declarationsText(declarations)}}`)\n .join('')\n const name = `kf-${hash(body)}`\n return Object.freeze({ name, css: `@keyframes ${name}{${body}}` })\n}\n\nexport const className = (rules: ReadonlyArray<StyleRule>): string =>\n `style-${hash(canonical(rules))}`\n\nconst selectorFor = (generated: string, selector: string): string =>\n selector.includes('&') ? selector.replace(/&/g, `.${generated}`) : `.${generated} ${selector}`\n\nexport const css = (generated: string, rules: ReadonlyArray<StyleRule>): string =>\n rules\n .map(entry => {\n const body = `{${declarationsText(entry.declarations)}}`\n const selector = `${selectorFor(generated, entry.selector)}${body}`\n return entry.at === undefined ? selector : `${entry.at}{${selector}}`\n })\n .join('')\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.\n */\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 type { HiddenOf } from './slot.js'\nimport * as SlotView from './slotView.js'\nimport * as Rules from './styleRules.js'\nimport type { StyleRule } from './styleRules.js'\n\nexport interface StyleValue {\n readonly classes: ReadonlyArray<string>\n readonly style: Readonly<Record<string, string>>\n /** Input-driven pieces resolved at render time; empty for a static style. */\n readonly conditions?: ReadonlyArray<StyleCondition>\n /** Rule-based appearance compiled to a deterministic class plus CSS. */\n readonly rules?: ReadonlyArray<StyleRule>\n /** Class-independent CSS (keyframes, layers, global rules). */\n readonly globalCss?: ReadonlyArray<string>\n}\n\nexport interface StyleCondition {\n readonly predicate: (input: unknown) => boolean\n readonly piece: StyleValue\n}\n\n/** A hidden slot is internal: it is neither styleable nor behavior-targetable. */\nexport type StylePieces<Slots> = {\n readonly [K in keyof Slots as HiddenOf<Slots[K]> extends true ? never : K]?: StyleValue\n}\n\nexport interface NamedStyle<Slots> {\n readonly name?: string\n readonly pieces: StylePieces<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\nconst tokens = (value: string): ReadonlyArray<string> =>\n value.split(/\\s+/).filter(token => token.length > 0)\n\nexport const empty: StyleValue = Object.freeze({\n classes: Object.freeze([]) as ReadonlyArray<string>,\n style: Object.freeze({}) as Readonly<Record<string, string>>,\n})\n\nexport const classPiece = (value: string): StyleValue =>\n Object.freeze({ classes: Object.freeze(tokens(value)), style: empty.style })\n\nexport const inline = (value: Readonly<Record<string, string>>): StyleValue =>\n Object.freeze({ classes: empty.classes, style: Object.freeze({ ...value }) })\n\n/** Concatenate classes; later inline declarations win per property. */\nexport const compose = (...pieces: ReadonlyArray<StyleValue>): StyleValue => {\n const conditions = pieces.flatMap(piece => piece.conditions ?? [])\n const rules = pieces.flatMap(piece => piece.rules ?? [])\n const globalCss = pieces.flatMap(piece => piece.globalCss ?? [])\n return Object.freeze({\n classes: Object.freeze(pieces.flatMap(piece => piece.classes)),\n style: Object.freeze(Object.assign(Object.create(null), ...pieces.map(piece => piece.style))),\n ...(conditions.length === 0 ? {} : { conditions: Object.freeze(conditions) }),\n ...(rules.length === 0 ? {} : { rules: Object.freeze(rules) }),\n ...(globalCss.length === 0 ? {} : { globalCss: Object.freeze(globalCss) }),\n })\n}\n\n/** A pseudo-class/element rule, e.g. `Style.pseudo(':hover', { color: 'red' })`. */\nexport const pseudo = (\n suffix: string,\n declarations: Readonly<Record<string, string>>,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.pseudo(suffix, declarations)]),\n })\n\n/** An at-rule, e.g. `Style.media('(min-width: 40rem)', { color: 'red' })`. */\nexport const media = (query: string, declarations: Readonly<Record<string, string>>): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.media(query, declarations)]),\n })\n\n/** An at-rule, e.g. `Style.supports('(display: grid)', { display: 'grid' })`. */\nexport const supports = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.supports(condition, declarations)]),\n })\n\n/** A container query, e.g. `Style.container('(min-width: 30rem)', {...})`. */\nexport const container = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.container(condition, declarations)]),\n })\n\n/** A nested selector relative to the generated class, e.g. `Style.nest('> span', {...})`. */\nexport const nest = (\n selector: string,\n declarations: Readonly<Record<string, string>>,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n rules: Object.freeze([Rules.nest(selector, declarations)]),\n })\n\n/**\n * A deterministic `@keyframes` block. Compose `style` where the animation is\n * declared and reference `name` in an `animation` declaration.\n */\nexport const keyframes = (\n frames: Readonly<Record<string, Readonly<Record<string, string>>>>,\n): { readonly name: string; readonly style: StyleValue } => {\n const compiled = Rules.keyframes(frames)\n return Object.freeze({\n name: compiled.name,\n style: Object.freeze({\n classes: empty.classes,\n style: empty.style,\n globalCss: Object.freeze([compiled.css]),\n }),\n })\n}\n\n/** Raw class-independent CSS (a layer, a global rule). Prefer typed helpers. */\nexport const global = (css: string): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n globalCss: Object.freeze([css]),\n })\n\n/** A boolean known at authoring time. */\nexport const when = (condition: boolean, piece: StyleValue): StyleValue =>\n condition ? 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>(\n predicate: (input: Input) => boolean,\n piece: StyleValue,\n): StyleValue =>\n Object.freeze({\n classes: empty.classes,\n style: empty.style,\n conditions: Object.freeze([\n { predicate: (input: unknown) => predicate(input as Input), piece },\n ]),\n })\n\n/** Fold every active condition (recursively) into a condition-free style. */\nconst resolveStyle = (style: StyleValue, input: unknown): StyleValue => {\n const active = (style.conditions ?? [])\n .filter(condition => condition.predicate(input))\n .map(condition => resolveStyle(condition.piece, input))\n return Object.freeze({\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\nconst hasConditionalRules = (style: StyleValue): boolean =>\n (style.conditions ?? []).some(\n condition => (condition.piece.rules ?? []).length > 0 || hasConditionalRules(condition.piece),\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}\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/** A rule-bearing style gets one deterministic class and its CSS text. */\nconst compileStyle = (style: StyleValue): CompiledStyle => {\n const rules = style.rules ?? []\n const globalRules = collectGlobalCss(style)\n const generated = rules.length === 0 ? undefined : Rules.className(rules)\n return {\n classes: generated === undefined ? style.classes : Object.freeze([...style.classes, generated]),\n style: style.style,\n ...(generated === undefined ? {} : { css: Rules.css(generated, rules), ruleClass: generated }),\n ...(globalRules.length === 0 ? {} : { globalRules }),\n }\n}\n\n/** A rule's class is static while a `whenInput` condition is not, so they cannot combine. */\nconst assertRulesSupported = (style: StyleValue): void => {\n if (!hasConditionalRules(style)) return\n throw new DiagnosticError({\n source: 'mixins',\n code: 'style:conditional-rules-unsupported',\n severity: 'error',\n message: 'Style.pseudo/media may not appear inside Style.whenInput',\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 = (style: StyleValue, compiled: CompiledStyle): 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) return Object.freeze(attributes)\n const contribution: InputContribution<never> = context => {\n const resolved = resolveStyle({ ...style, classes: compiled.classes }, context.input)\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?: { readonly name?: string }): NamedStyle<Slots> => {\n const known = slots as unknown as Record<string, unknown>\n const contributions: Record<string, SlotContribution<never>> = 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, StyleValue | 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 // 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 assertRulesSupported(piece)\n const compiled = compileStyle(piece)\n contributions[key] = contributionFrom(piece, compiled)\n if (compiled.ruleClass !== undefined && compiled.css !== undefined) {\n rules.push({ className: compiled.ruleClass, css: compiled.css })\n css += compiled.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,\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\n/** Deduplicated global then scoped CSS for one `<style>` block, first seen wins. */\nexport const stylesheet = (\n ...styles: ReadonlyArray<{\n readonly rules: ReadonlyArray<{ readonly className: string; readonly css: string }>\n readonly globalRules: ReadonlyArray<string>\n }>\n): string => {\n const scoped = new Map<string, string>()\n const global = new Set<string>()\n for (const style of styles) {\n for (const rule of style.rules) {\n if (!scoped.has(rule.className)) scoped.set(rule.className, rule.css)\n }\n for (const rule of style.globalRules) global.add(rule)\n }\n return [...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 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 D['variants']]?: keyof 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 const Style = {\n class: classPiece,\n inline,\n compose,\n when,\n whenInput,\n pseudo,\n media,\n supports,\n container,\n nest,\n keyframes,\n global,\n empty,\n forSlots,\n attach,\n recipe,\n stylesheet,\n} as const\n","/**\n * `Theme` is typed token data, not a service. Dynamic theme state (light/dark)\n * belongs in the Foldkit Model; `variables` compiles the tokens to CSS custom\n * properties so switching a class or a root style is cheap and SSR-safe.\n */\nimport type { StyleValue } from './style.js'\nimport { inline } from './style.js'\n\nexport type ThemeTokens = {\n readonly [group: string]: { readonly [name: string]: string }\n}\n\nexport type Theme<T extends ThemeTokens = ThemeTokens> = T\n\nconst VAR_PREFIX = '--fk'\n\nexport const define = <T extends ThemeTokens>(tokens: T): Readonly<T> =>\n Object.freeze(\n Object.fromEntries(\n Object.entries(tokens).map(([group, names]) => [group, Object.freeze({ ...names })]),\n ),\n ) as Readonly<T>\n\nexport const variable = <T extends ThemeTokens, G extends keyof T & string>(\n _theme: T,\n group: G,\n name: keyof T[G] & string,\n): string => `var(${VAR_PREFIX}-${group}-${name})`\n\nexport const variables = <T extends ThemeTokens>(theme: T): StyleValue => {\n const style: Record<string, string> = {}\n for (const [group, names] of Object.entries(theme)) {\n for (const [name, value] of Object.entries(names as Record<string, string>)) {\n style[`${VAR_PREFIX}-${group}-${name}`] = value\n }\n }\n return inline(style)\n}\n\nexport const Theme = { define, variable, variables } 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,MA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,CAAC,CAAC,CACrF,CACF;AAEF,MAAa,YACX,QACA,OACA,SACW,OAAO,WAAW,GAAG,MAAM,GAAG,KAAK;AAEhD,MAAa,aAAoC,UAAyB;CACxE,MAAM,QAAgC,CAAC;CACvC,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,GAC/C,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAA+B,GACxE,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU;CAG9C,OAAO,OAAO,KAAK;AACrB;AAEA,MAAa,QAAQ;CAAE;CAAQ;CAAU;AAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldkit-mixins",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Typed slot contracts and inside-out Style/Behavior attachments for Foldkit.",
5
5
  "keywords": [
6
6
  "foldkit",