@pairdraw/dom-css 0.19.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +16 -1
- package/dist/browser.js +2 -2
- package/dist/chunks/behaviours/controls.js +34 -2
- package/dist/chunks/behaviours/controls.js.map +1 -1
- package/dist/chunks/behaviours/states/layers.js +110 -5
- package/dist/chunks/behaviours/states/layers.js.map +1 -1
- package/dist/chunks/behaviours/states/tailwind.js +17 -2
- package/dist/chunks/behaviours/states/tailwind.js.map +1 -1
- package/dist/chunks/browser.js +208 -53
- package/dist/chunks/browser.js.map +1 -1
- package/dist/chunks/export/components/groups.js +3 -2
- package/dist/chunks/export/components/groups.js.map +1 -1
- package/dist/chunks/export/components/layers.js +50 -8
- package/dist/chunks/export/components/layers.js.map +1 -1
- package/dist/export.d.ts +9 -0
- package/dist/scene-graph2.d.ts +6 -0
- package/package.json +3 -3
- package/src/behaviours/controls.ts +49 -2
- package/src/behaviours/states/tailwind.ts +4 -1
- package/src/browser.ts +1 -0
- package/src/export/components/model.ts +60 -7
- package/src/export/components/react/index.ts +4 -0
- package/src/export/components/repeats.ts +7 -2
- package/src/export/components/vue.ts +38 -9
- package/src/export/css.ts +3 -2
- package/src/export/font-size-class.ts +13 -0
- package/src/export/html.ts +5 -1
- package/src/export/projection.ts +121 -10
- package/src/import/flow.ts +15 -0
- package/src/import/fonts.ts +40 -0
- package/src/import/scene-graph.ts +199 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layers.js","names":["drawing","propsType","ROOT_ATTRIBUTES","HEADING_STYLE","ICONIFY","iconElement","reference","drawing","designElement","bindingAttributes","shaderCanvas","IMPORT_COMPONENT","propsType"],"sources":["../../../../src/export/components/properties.ts","../../../../src/export/components/shaders.ts","../../../../src/export/components/tree.ts","../../../../src/export/components/model.ts","../../../../src/export/components/styling.ts","../../../../src/export/components/react/shared.ts","../../../../src/export/components/react/fields.ts","../../../../src/export/components/react/radix.ts","../../../../src/export/components/react/props.ts","../../../../src/export/components/react/index.ts","../../../../src/export/components/vue.ts","../../../../src/export/components/layers.ts"],"sourcesContent":["import { ownerVariants } from '#dom-css/behaviours/states/model'\nimport type { StateElement } from '#dom-css/behaviours/states/types'\nimport { camelCase } from 'es-toolkit/string'\n\nimport type { ComponentPropertyReferenceField, SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { behaviourProperties, findLayerByPath } from '@pairdraw/scene-graph/behaviours'\n\nimport { claimName, identifierName } from '../storybook/names'\n\n/** A text property the component takes as a string prop and draws in the layers bound to it. */\nexport interface TextProp {\n /** The prop's identifier. */\n name: string\n /** The text property's id, which instances assign values by. */\n id: string\n /** The text property's name. */\n property: string\n default: string\n}\n\n/** A boolean property the component takes as a prop, showing the layers bound to it while on. */\nexport interface BooleanProp {\n /** The prop's identifier. */\n name: string\n /** The boolean property's id, which instances assign values by. */\n id: string\n /** The boolean property's name. */\n property: string\n default: boolean\n}\n\n/**\n * A slot property the component takes as content in place of the design's, which it shows\n * when none is given.\n */\nexport interface SlotProp {\n /** The prop's identifier, and the slot's name in Vue. */\n name: string\n /** The slot property's id. */\n id: string\n /** The slot property's name. */\n property: string\n}\n\n/**\n * The layers bound to a property through `field`, each with the prop it draws. A layer is\n * bound when it is in any variant, found by the path every variant shares.\n */\nfunction boundLayers(\n graph: SceneGraph,\n set: SceneNode,\n elements: readonly StateElement[],\n field: ComponentPropertyReferenceField,\n props: ReadonlyMap<string, string>\n): Map<StateElement, string> {\n const variants = ownerVariants(graph, set)\n const bound = new Map<StateElement, string>()\n for (const element of elements) {\n const path = element.key.split('\\0')[0] ?? ''\n for (const variant of variants) {\n const reference = findLayerByPath(graph, variant.id, path)?.componentPropertyReferences.find(\n (item) => item.field === field\n )\n const prop = reference && props.get(reference.propertyId)\n if (prop) {\n bound.set(element, prop)\n break\n }\n }\n }\n return bound\n}\n\nconst propName = (property: string, taken: Set<string>, fallback: string) =>\n claimName(camelCase(identifierName(property, fallback)), taken)\n\n/** The set's boolean properties as props, and the layers each shows while it is on. */\nexport function booleanProps(\n graph: SceneGraph,\n set: SceneNode,\n elements: readonly StateElement[],\n taken: Set<string>\n): { booleans: BooleanProp[]; shownBy: Map<StateElement, string> } {\n const booleans = behaviourProperties(graph, set)\n .filter((definition) => definition.type === 'BOOLEAN')\n .map((definition) => ({\n name: propName(definition.name, taken, 'Shown'),\n id: definition.id,\n property: definition.name,\n default: definition.defaultValue === 'true'\n }))\n const byId = new Map(booleans.map((prop) => [prop.id, prop.name]))\n return { booleans, shownBy: boundLayers(graph, set, elements, 'VISIBLE', byId) }\n}\n\n/**\n * The set's slot properties as props, and the frame each fills, except frames a behaviour\n * draws its parts in, such as a switch's thumb, which stay its parts.\n */\nexport function slotProps(\n graph: SceneGraph,\n set: SceneNode,\n elements: readonly StateElement[],\n taken: Set<string>,\n parts: ReadonlyMap<StateElement, string>\n): { slots: SlotProp[]; slotOf: Map<StateElement, string> } {\n const definitions = behaviourProperties(graph, set).filter(\n (definition) => definition.type === 'SLOT'\n )\n const frames = elements.filter((element) => !parts.has(element))\n const slots = definitions.map((definition) => ({\n name: propName(definition.name, taken, 'Content'),\n id: definition.id,\n property: definition.name\n }))\n const byId = new Map(slots.map((prop) => [prop.id, prop.name]))\n const slotOf = boundLayers(graph, set, frames, 'SLOT_CONTENT', byId)\n // A slot no layer draws has nowhere to show its content, so it is no prop.\n const drawn = new Set(slotOf.values())\n return { slots: slots.filter((slot) => drawn.has(slot.name)), slotOf }\n}\n\n/**\n * The set's text properties as props, and the layers bound to each. A layer is bound when it\n * is in any variant, found by the path every variant shares.\n */\nexport function textProps(\n graph: SceneGraph,\n set: SceneNode,\n elements: readonly StateElement[],\n taken: Set<string>,\n /** A field's text property, which its input shows rather than a prop. */\n input: string | undefined\n): { texts: TextProp[]; bound: Map<StateElement, string>; input: StateElement[] } {\n const definitions = behaviourProperties(graph, set).filter(\n (item) => item.type === 'TEXT' && item.id !== input\n )\n const texts = definitions.map((definition) => ({\n name: claimName(camelCase(identifierName(definition.name, 'Text')), taken),\n id: definition.id,\n property: definition.name,\n default: definition.defaultValue\n }))\n const byId = new Map(definitions.map((definition, i) => [definition.id, texts[i]]))\n const variants = ownerVariants(graph, set)\n const bound = new Map<StateElement, string>()\n const inputs: StateElement[] = []\n for (const element of elements) {\n // A key ends with the words a layer reads, which a text prop draws in every variant.\n const path = element.key.split('\\0')[0] ?? ''\n for (const variant of variants) {\n const reference = findLayerByPath(graph, variant.id, path)?.componentPropertyReferences.find(\n (item) => item.field === 'TEXT'\n )\n if (reference && reference.propertyId === input) {\n inputs.push(element)\n break\n }\n const prop = reference && byId.get(reference.propertyId)\n if (prop) {\n bound.set(element, prop.name)\n break\n }\n }\n }\n return { texts, bound, input: inputs }\n}\n","import type { StateElement } from '#dom-css/behaviours/states/types'\n\nimport { es, jsx } from '@pairdraw/emit'\nimport type { SceneGraph } from '@pairdraw/scene-graph'\nimport { findLayerByPath } from '@pairdraw/scene-graph/behaviours'\nimport {\n isShaderPresetPaint,\n shaderOfPaint,\n type ShaderComponent,\n type ShaderPreset,\n type ShaderPresetPaint\n} from '@pairdraw/scene-graph/shaders'\n\nimport { isPositioned } from '../projection'\nimport type { ComponentElement, ComponentNode } from './model'\n\n/** A shader a layer fills with, drawn by the `shaders` library behind the layer's content. */\nexport interface ShaderLayer {\n preset: ShaderPreset\n /** The readable class the shader's canvas is styled by. */\n className: string\n /** Whether the layer is positioned already, so the shader can be placed inside it. */\n positioned: boolean\n}\n\nexport function shaderLayer(\n node: StateElement,\n className: string,\n preset: ShaderPreset | undefined\n): ShaderLayer | undefined {\n if (!preset) return undefined\n const position = node.base.position\n return {\n preset,\n className: `${className}-shader`,\n positioned: isPositioned(position)\n }\n}\n\n/**\n * The shader each element's layer fills with in the rest variant: the topmost visible shader\n * fill, which the component plays behind the layer's content.\n */\nexport function shaderLayers(\n graph: SceneGraph,\n restId: string,\n elements: readonly StateElement[]\n): Map<StateElement, ShaderPreset> {\n const shaders = new Map<StateElement, ShaderPreset>()\n for (const element of elements) {\n const layer = findLayerByPath(graph, restId, element.key.split('\\0')[0] ?? '')\n if (!layer) continue\n const shader = layer.fills\n .filter((fill) => fill.visible)\n .map((fill) => shaderOfPaint(layer, fill))\n .findLast((found): found is ShaderPresetPaint => found !== null && isShaderPresetPaint(found))\n if (shader) shaders.set(element, shader.preset)\n }\n return shaders\n}\n\n/** Whether an effect's name can be imported, as every effect the library has can. */\nconst isEffectName = (type: string) => es.isIdentifierName(type)\n\n/** The effects of `components` a generated component draws: those it can import by name. */\nexport const drawnEffects = (components: readonly ShaderComponent[] | undefined) =>\n (components ?? []).filter((component) => isEffectName(component.type))\n\n/**\n * `import { Shader as ShaderCanvas, Aurora as ShaderAurora } from 'shaders/vue'`: the canvas and\n * effects a component draws, under names apart from its own.\n */\nexport function shaderImport(source: 'shaders/vue' | 'shaders/react', effects: Iterable<string>) {\n const names = ['Shader', ...[...effects].sort()]\n return {\n type: 'ImportDeclaration',\n importKind: 'value',\n specifiers: names.map((name) => ({\n type: 'ImportSpecifier',\n imported: es.identifier(name),\n local: es.identifier(name === 'Shader' ? SHADER_CANVAS : shaderEffectName(name))\n })),\n source: es.string(source)\n }\n}\n\n/** The local name a generated component imports effect `type` as, apart from its own names. */\nexport const shaderEffectName = (type: string) => `Shader${type}`\n\n/** An effect's props as JSX attributes: strings as they are, anything else as JSON. */\nexport function shaderEffectAttributes(component: ShaderComponent): es.SyntaxNode[] {\n return Object.entries(component.props ?? {}).map(([key, value]) =>\n jsx.attribute(\n key,\n typeof value === 'string' ? jsx.stringValue(value) : jsx.container(es.json(value))\n )\n )\n}\n\n/** The local name of the library's `Shader` canvas. */\nexport const SHADER_CANVAS = 'ShaderCanvas'\n\n/** The elements of a component's tree that fill with a shader. */\nexport function shaderElements(node: ComponentNode): ComponentElement[] {\n if (node.type !== 'element') return []\n return [...(node.shader ? [node] : []), ...node.children.flatMap(shaderElements)]\n}\n\n/**\n * The style that puts each shader behind its layer's content: the layer becomes its own\n * stacking context, positioned if it is not already, and the shader fills it beneath\n * everything it holds, clipped to its corners.\n */\nexport function shaderCSS(tree: ComponentElement): string {\n return shaderElements(tree)\n .flatMap(({ className, shader }) =>\n shader\n ? [\n `.${className} { isolation: isolate;${shader.positioned ? '' : ' position: relative;'} }`,\n `.${shader.className} { position: absolute; inset: 0; z-index: -1; border-radius: inherit; overflow: hidden; pointer-events: none; }`\n ]\n : []\n )\n .join('\\n')\n}\n","import type { StateElement } from '#dom-css/behaviours/states/types'\n\nimport type { ShaderPreset } from '@pairdraw/scene-graph/shaders'\n\nimport type { InputLayers } from './fields'\nimport type { ComponentBinding, ComponentElement, ComponentNode } from './model'\nimport type { UsedLayer } from './references'\nimport type { RepeatedPart } from './repeats'\nimport { shaderLayer } from './shaders'\n\n/** What each layer of the rest variant is to the component, gathered before its tree is built. */\nexport interface TreeLabels {\n parts: Map<StateElement, string>\n classes: Map<StateElement, string>\n /** The text prop each bound text layer draws, by layer. */\n texts: Map<StateElement, string>\n /** Layers that use another component or an icon in place of drawing themselves. */\n used: Map<StateElement, UsedLayer>\n /** Layers drawn once per value, such as tab triggers and panels. */\n repeated: Map<StateElement, RepeatedPart>\n /** A field's text layer, drawn as its input, and the ones it replaces. */\n input: InputLayers | null\n /** The boolean prop that shows each bound layer. */\n shownBy: Map<StateElement, string>\n /** The slot prop each slot frame shows. */\n slotOf: Map<StateElement, string>\n /** The shader each layer fills with. */\n shaders: Map<StateElement, ShaderPreset>\n /** The layer of the rest variant each element draws. */\n layerOf: (element: StateElement) => string | undefined\n}\n\nexport function componentTree(\n node: StateElement,\n labels: TreeLabels,\n bindings: ComponentBinding[]\n): ComponentElement {\n const repeated = labels.repeated.get(node)\n const layerId = labels.layerOf(node)\n const part = repeated?.part ?? labels.parts.get(node) ?? null\n const text = labels.texts.get(node)\n const className = labels.classes.get(node) ?? ''\n return {\n type: 'element',\n part,\n ...(repeated ? { value: repeated.value } : {}),\n tag: node.tagName,\n className,\n layerId,\n attrs: node.attrs,\n bindings: part === 'root' ? bindings : [],\n shownBy: labels.shownBy.get(node),\n slot: labels.slotOf.get(node),\n shader: shaderLayer(node, className, labels.shaders.get(node)),\n // A bound text layer draws its prop in place of the design's words and their runs.\n children: text\n ? [{ type: 'textProp', name: text }]\n : node.children.flatMap((child) =>\n child.type === 'text' ? [{ type: 'text', value: child.text }] : childNode(child, labels)\n )\n }\n}\n\nfunction childNode(element: StateElement, labels: TreeLabels): ComponentNode[] {\n const className = labels.classes.get(element) ?? ''\n const layerId = labels.layerOf(element)\n if (labels.input?.element === element) return [{ type: 'input', className, layerId }]\n if (labels.input?.replaced.includes(element)) return []\n const used = labels.used.get(element)\n if (!used) return [componentTree(element, labels, [])]\n return [{ ...used, className, layerId }]\n}\n","import { behaviourArgs, type BehaviourArgs } from '#dom-css/behaviours/args'\nimport { BUTTON_RESET } from '#dom-css/behaviours/reset'\nimport { allElements } from '#dom-css/behaviours/states/layers'\nimport { ownerVariants, restLayerOf, stateStyles } from '#dom-css/behaviours/states/model'\nimport { layerClassNames, propAttribute } from '#dom-css/behaviours/states/names'\nimport type { StateElement, StateStyles } from '#dom-css/behaviours/states/types'\nimport { uniq } from 'es-toolkit/array'\nimport { camelCase } from 'es-toolkit/string'\n\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport {\n behaviourContract,\n behaviourProperties,\n layerPath,\n readBehaviour,\n textBinding,\n type Behaviour\n} from '@pairdraw/scene-graph/behaviours'\nimport { variantDefaultValue } from '@pairdraw/scene-graph/components'\nimport { slotPropertyId } from '@pairdraw/scene-graph/slots'\n\nimport type { SceneGraphToDesignOptions } from '../projection'\nimport { claimName, identifierName } from '../storybook/names'\nimport {\n blockRoot,\n freePlacedParts,\n inputLayers,\n inputValue,\n numberInput,\n rangeModel,\n textModel\n} from './fields'\nimport {\n groupItems,\n GROUP_ITEMS,\n isGroup,\n type GroupKind,\n type ItemBuilder,\n type ItemKind\n} from './groups'\nimport type { IconPackage } from './icons'\nimport {\n booleanProps,\n slotProps,\n textProps,\n type BooleanProp,\n type SlotProp,\n type TextProp\n} from './properties'\nimport {\n referencedLayers,\n type ComponentReference,\n type ComponentReferences,\n type IconReference,\n type UsedLayer\n} from './references'\nimport { activeTriggers, tabParts, type ChoiceModel, type RepeatedPart } from './repeats'\nimport { shaderLayers, type ShaderLayer } from './shaders'\nimport type { ComponentStyling } from './styling'\nimport { componentTree } from './tree'\n\n/** Kinds generated as components so far; the rest keep static stories. */\nconst GENERATED_KINDS = [\n 'button',\n 'switch',\n 'checkbox',\n 'toggle',\n 'collapsible',\n 'tabs',\n 'radioGroup',\n 'toggleGroup',\n 'accordion',\n 'slider',\n 'progress',\n 'numberField',\n 'textField',\n 'textarea'\n] as const\n\n/** What a generated component is: a control on its own, or a group's item. */\n/**\n * What a generated component is: a control on its own, a group's item, or `plain`, a component\n * without a behaviour, which takes its properties as props and has no control of its own.\n */\nexport type GeneratedKind = (typeof GENERATED_KINDS)[number] | ItemKind | 'plain'\n\n/** A variant property the component takes as a prop and sets on its root as `data-*`. */\ninterface VariantProp {\n /** The prop's identifier. */\n name: string\n /** The variant property it draws, which state styles name the condition after. */\n property: string\n options: string[]\n default: string\n}\n\n/**\n * What the control's root binds, which each framework writes in its own idiom: the two-way\n * value (`v-model`, or Radix's `checked` and `onCheckedChange`), `disabled`, and a variant\n * property the component sets as a `data-*` attribute from its prop.\n */\nexport type ComponentBinding =\n | { type: 'model'; name: string }\n | { type: 'disabled' }\n /** A group's item: the value it stands for, which the group chooses among. */\n | { type: 'value' }\n | { type: 'prop'; prop: VariantProp; attribute: string }\n\n/** A layer of the generated markup, before a framework picks its element or component. */\nexport interface ComponentElement {\n type: 'element'\n /** The behaviour part the layer draws, `root` for the control itself, or null. */\n part: string | null\n /** The element the design projects to, used when no library component draws the part. */\n tag: string\n /** The readable class the state styles select it by. */\n className: string\n /** Attributes the design sets, such as an image's `src` or its own `class`. */\n attrs: Record<string, string>\n /** On the root only. */\n bindings: ComponentBinding[]\n /** The boolean prop that shows the layer, which hides it while off. */\n shownBy?: string\n /** The slot prop whose content the layer shows in place of its own. */\n slot?: string\n /** The layer of the rest variant it draws, which code links back to. */\n layerId?: string\n /** The value a repeated part stands for, such as a tab trigger's tab. */\n value?: string\n /** The shader the layer fills with, which plays behind its content. */\n shader?: ShaderLayer\n children: ComponentNode[]\n}\n\n/** A number the component binds two ways, within its range, starting where the design does. */\nexport interface RangeModel {\n min: number\n max: number\n step: number\n default: number\n}\n\n/**\n * Text a field binds two ways: the words it starts with, and the placeholder an empty field\n * shows when the design draws one.\n */\nexport interface TextModel {\n default: string\n placeholder: string | null\n}\n\nexport type ComponentNode =\n | ComponentElement\n | { type: 'text'; value: string }\n /** The value of a text prop, drawn where the design binds a text layer to it. */\n | { type: 'textProp'; name: string }\n /** A field's input, drawn where the design binds its text layer to the field's text. */\n | { type: 'input'; className: string; layerId?: string }\n | ComponentReference\n | IconReference\n\n/** One component generated from a component set with a behaviour. */\nexport interface ComponentModel {\n /** The component's identifier and file name. */\n name: string\n kind: GeneratedKind\n styles: StateStyles\n /** The markup every framework writes, with each layer's part and the root's bindings. */\n tree: ComponentElement\n /**\n * The value the component binds two ways: a boolean such as `checked`, `pressed`, or `open`,\n * or `value` when it chooses among `choice`, as tabs do.\n */\n model: string | null\n /** The options a string model takes and the one it starts on. */\n choice: ChoiceModel | null\n /** The range a number model takes, as a slider, progress bar, or number field has. */\n range: RangeModel | null\n /** The text a text field or textarea binds. */\n text: TextModel | null\n /** A group's item takes the `value` it stands for, which the group chooses among. */\n valueProp: boolean\n /** The component of a group's items, generated beside the group's own. */\n item: ComponentModel | null\n /** Whether the set draws a disabled state, so the component takes `disabled`. */\n disabled: boolean\n props: VariantProp[]\n texts: TextProp[]\n booleans: BooleanProp[]\n slots: SlotProp[]\n /** The variant properties that draw its booleans and states, which references set. */\n args: BehaviourArgs\n}\n\n/** A generated component's files, and what its stories need to know about it. */\nexport interface GeneratedComponent {\n /**\n * The component's files. A file of JSX lists the layer each of its JSX elements draws, in the\n * order they open, `null` for an element no layer drew, such as a shader's canvas.\n */\n files: { path: string; content: string; layerIds?: (string | null)[] }[]\n /** How stories import it: its path next to them, and whether it's a named export. */\n entry: { path: string; named: boolean }\n /** The prop a story sets the value with, if the component has one. */\n valueArg: string | null\n /** Whether that prop takes a list of the value, as Radix's slider does. */\n valueList?: boolean\n}\n\n/** How a generator writes a component. */\nexport interface ComponentGeneratorOptions {\n /** A stylesheet beside the component, by default, or Tailwind utilities in its markup. */\n styling?: ComponentStyling\n /** The package icons come from; Iconify by default, and for any icon the package lacks. */\n icons?: IconPackage\n}\n\nexport type ComponentGenerator = (\n component: ComponentModel,\n options?: ComponentGeneratorOptions\n) => Promise<GeneratedComponent>\n\n/** Parts each kind renders as a native button, which the reset clears for the design. */\nconst BUTTON_PARTS: Record<GeneratedKind, readonly string[]> = {\n button: ['root'],\n switch: ['root'],\n checkbox: ['root'],\n toggle: ['root'],\n collapsible: ['trigger'],\n tabs: ['trigger'],\n radioGroup: [],\n toggleGroup: [],\n accordion: [],\n slider: [],\n progress: [],\n numberField: ['increment', 'decrement'],\n textField: [],\n textarea: [],\n plain: [],\n radioGroupItem: ['root'],\n toggleGroupItem: ['root'],\n accordionItem: ['trigger']\n}\n\nconst isGenerated = (kind: Behaviour['kind']): kind is (typeof GENERATED_KINDS)[number] =>\n (GENERATED_KINDS as readonly string[]).includes(kind)\n\n/** What an owner generates as: a group's item when it is one, its own kind, or nothing. */\nfunction generatedKind(kind: Behaviour['kind'], itemOf?: GroupKind): GeneratedKind | null {\n if (itemOf) return GROUP_ITEMS[itemOf]\n return isGenerated(kind) ? kind : null\n}\n\n/** Layer paths of the slot frames that draw each part, the same in every variant. */\nfunction partPaths(graph: SceneGraph, set: SceneNode, behaviour: Behaviour): Map<string, string> {\n const partOfSlot = new Map(Object.entries(behaviour.parts).map(([part, slot]) => [slot, part]))\n const paths = new Map<string, string>()\n const visit = (variant: SceneNode, node: SceneNode) => {\n const part = partOfSlot.get(slotPropertyId(node) ?? '')\n if (part) paths.set(layerPath(graph, variant.id, node.id), part)\n for (const child of graph.getChildren(node.id)) visit(variant, child)\n }\n for (const variant of ownerVariants(graph, set))\n for (const child of graph.getChildren(variant.id)) visit(variant, child)\n return paths\n}\n\n/**\n * The component a set with a behaviour generates, or `null` when its kind is not generated\n * yet or its variants have no rest state to start from.\n */\nexport interface ComponentModelOptions extends Pick<SceneGraphToDesignOptions, 'vectorElement'> {\n /**\n * The other components generated alongside, which instances of them use rather than\n * drawing their layers.\n */\n references?: ComponentReferences\n /** The component's identifier and file name; the owner's name by default. */\n name?: string\n /** A group's item component's name; the group's name with `Item` by default. */\n itemName?: string\n /** Generate the owner as the item of a group of this kind, which only lives in the group. */\n itemOf?: GroupKind\n}\n\n/** Each layer's behaviour part: the root, and the slot frames that draw the others. */\nfunction behaviourParts(\n graph: SceneGraph,\n set: SceneNode,\n behaviour: Behaviour,\n root: StateElement\n): Map<StateElement, string> {\n const paths = partPaths(graph, set, behaviour)\n const contract = behaviourContract(behaviour.kind).parts\n const parts = new Map<StateElement, string>([[root, 'root']])\n for (const element of allElements(root)) {\n const part = paths.get(element.key)\n if (part && contract.some((item) => item.id === part)) parts.set(element, part)\n }\n return parts\n}\n\n/** Clears the native button look from the parts a kind renders as buttons. */\nfunction resetButtons(\n kind: GeneratedKind,\n parts: ReadonlyMap<StateElement, string>,\n repeated: ReadonlyMap<StateElement, RepeatedPart>\n): void {\n const all = [...parts, ...[...repeated].map(([element, item]) => [element, item.part] as const)]\n for (const [element, part] of all)\n if (BUTTON_PARTS[kind].includes(part)) element.base = { ...BUTTON_RESET, ...element.base }\n}\n\n/** The variant properties that are not values or states, as props set as `data-*`. */\nfunction variantProps(\n graph: SceneGraph,\n set: SceneNode,\n args: BehaviourArgs,\n taken: Set<string>\n): VariantProp[] {\n const bound = new Set([...args.booleans.keys(), args.states?.property, args.filled?.property])\n return behaviourProperties(graph, set)\n .filter((definition) => definition.type === 'VARIANT' && !bound.has(definition.name))\n .map((definition) => ({\n name: claimName(camelCase(identifierName(definition.name, 'Prop')), taken),\n property: definition.name,\n // A document may record no options, which the variants' own values then are.\n options: uniq([\n ...(definition.variantOptions ?? []),\n ...ownerVariants(graph, set).map(\n (variant) => variant.componentPropertyValues[definition.name] ?? ''\n )\n ]).filter((option) => option !== ''),\n default: variantDefaultValue(graph, set, definition)\n }))\n}\n\n/** What the root binds: its model, an item's value, `disabled`, and its variant props. */\nfunction rootBindings(\n model: string | null,\n item: boolean,\n disabled: boolean,\n props: readonly VariantProp[]\n): ComponentBinding[] {\n return [\n ...(model ? [{ type: 'model' as const, name: model }] : []),\n ...(item ? [{ type: 'value' as const }] : []),\n ...(disabled ? [{ type: 'disabled' as const }] : []),\n ...props.map((prop) => ({\n type: 'prop' as const,\n prop,\n attribute: propAttribute(prop.property)\n }))\n ]\n}\n\n/**\n * A group's items, built as the group's item component; null for other owners and for a\n * group's item itself.\n */\nfunction itemsOf(\n graph: SceneGraph,\n behaviour: Behaviour,\n variantIds: readonly string[],\n parts: ReadonlyMap<StateElement, string>,\n options: ComponentModelOptions,\n build: (itemOf: GroupKind) => ItemBuilder\n): ReturnType<typeof groupItems> {\n if (options.itemOf || !isGroup(behaviour.kind)) return null\n const itemsElement = [...parts].find(([, part]) => part === 'items')?.[0]\n return groupItems(graph, variantIds, itemsElement, build(behaviour.kind))\n}\n\n/**\n * The value the component binds two ways: `value` when it chooses among options or holds a\n * number or text, its boolean such as `checked`, or none for a group's item, which its group\n * chooses.\n */\nfunction modelName(args: BehaviourArgs, item: boolean, valued: boolean): string | null {\n if (valued) return 'value'\n if (item) return null\n return [...args.booleans.values()].find((arg) => arg.name !== 'disabled')?.name ?? null\n}\n\n/** Whether the set draws a disabled look, as a boolean or an interaction state. */\nconst drawsDisabled = (args: BehaviourArgs) =>\n [...args.booleans.values()].some((arg) => arg.name === 'disabled') ||\n args.states?.disabled !== undefined\n\n/** The layers used rather than drawn: a group's items, then other generated components. */\nfunction usedLayers(\n graph: SceneGraph,\n root: StateElement,\n variantIds: readonly string[],\n items: ReadonlyMap<StateElement, UsedLayer> | undefined,\n references: ComponentReferences | undefined\n): Map<StateElement, UsedLayer> {\n const used = new Map(items)\n if (references)\n for (const [element, layer] of referencedLayers(graph, root, variantIds, references, used))\n used.set(element, layer)\n return used\n}\n\n/**\n * Sizes the design gives include a layer's padding and border, which a component's own\n * stylesheet has to say, since no page reset around it does. A root without a width hugs its\n * content, as the design draws it.\n */\nfunction borderBoxes(root: StateElement): void {\n // A root the design sizes to its content hugs it, where a block would fill its container.\n if (!Object.hasOwn(root.base, 'width')) root.base = { ...root.base, width: 'fit-content' }\n for (const element of allElements(root)) {\n const has = (property: string) => Object.hasOwn(element.base, property)\n if ((has('width') || has('height')) && !has('box-sizing'))\n element.base = { 'box-sizing': 'border-box', ...element.base }\n }\n}\n\n/**\n * Each layer's part, and tabs' triggers and panels, with the styles the generated parts need:\n * native buttons cleared, the chosen tab's look, and moving parts free of their drawn place.\n */\nfunction drawnParts(\n graph: SceneGraph,\n set: SceneNode,\n behaviour: Behaviour | null,\n kind: GeneratedKind,\n root: StateElement\n) {\n // A component without a behaviour has no parts but its root.\n const parts = behaviour\n ? behaviourParts(graph, set, behaviour, root)\n : new Map<StateElement, string>([[root, 'root']])\n const tabs = behaviour?.kind === 'tabs' ? tabParts(parts) : null\n const repeated = tabs?.repeated ?? new Map<StateElement, RepeatedPart>()\n activeTriggers(repeated)\n resetButtons(kind, parts, repeated)\n freePlacedParts(kind, parts)\n blockRoot(kind, root)\n borderBoxes(root)\n return { parts, tabs, repeated }\n}\n\n/** The number or text the component holds, and the text property a field's input shows. */\nfunction valueModels(\n graph: SceneGraph,\n set: SceneNode,\n kind: GeneratedKind,\n behaviour: Behaviour | null,\n args: BehaviourArgs\n): { range: RangeModel | null; text: TextModel | null; inputProperty: string | undefined } {\n if (!behaviour) return { range: null, text: null, inputProperty: undefined }\n const valueText = inputValue(kind)\n const inputProperty = valueText && textBinding(behaviour, valueText)\n const definition = behaviourProperties(graph, set).find((item) => item.id === inputProperty)\n return {\n range: rangeModel(kind, behaviour),\n text: textModel(kind, definition, args),\n inputProperty\n }\n}\n\nexport function componentModel(\n graph: SceneGraph,\n set: SceneNode,\n options: ComponentModelOptions = {}\n): ComponentModel | null {\n const behaviour = readBehaviour(set)\n // A component without a behaviour is plain: its properties are its props.\n const kind = behaviour ? generatedKind(behaviour.kind, options.itemOf) : 'plain'\n const styles = kind ? stateStyles(graph, set, options) : null\n const args = behaviourArgs(graph, set) ?? { booleans: new Map() }\n if (!kind || !styles) return null\n const name = options.name ?? identifierName(set.name, 'Component')\n\n const { parts, tabs, repeated } = drawnParts(graph, set, behaviour, kind, styles.root)\n\n // A group's items first, so its item component is used for them rather than a standalone one.\n const variantIds = [styles.restId, ...ownerVariants(graph, set).map((variant) => variant.id)]\n const items =\n behaviour &&\n itemsOf(\n graph,\n behaviour,\n variantIds,\n parts,\n options,\n (itemOf) => (owner) =>\n componentModel(graph, owner, {\n ...options,\n name: options.itemName ?? `${name}Item`,\n itemName: undefined,\n itemOf\n })\n )\n\n const choice = tabs?.choice ?? items?.choice ?? null\n const { range, text, inputProperty } = valueModels(graph, set, kind, behaviour, args)\n const model = modelName(args, !!options.itemOf, !!(choice ?? range ?? text))\n const taken = new Set([...(model ? [model] : []), 'disabled', 'value'])\n const props = variantProps(graph, set, args, taken)\n const disabled = drawsDisabled(args)\n const used = usedLayers(graph, styles.root, variantIds, items?.used, options.references)\n const elements = allElements(styles.root)\n const texts = textProps(graph, set, elements, taken, inputProperty)\n const input = inputLayers(texts.input)\n numberInput(input, range)\n const { booleans, shownBy } = booleanProps(graph, set, elements, taken)\n const { slots, slotOf } = slotProps(graph, set, elements, taken, parts)\n return {\n name,\n kind,\n styles,\n tree: componentTree(\n styles.root,\n {\n parts,\n classes: layerClassNames(styles),\n texts: texts.bound,\n used,\n repeated,\n input,\n shownBy,\n slotOf,\n shaders: shaderLayers(graph, styles.restId, elements),\n layerOf: (element) => restLayerOf(graph, styles, element)\n },\n rootBindings(model, !!options.itemOf, disabled, props)\n ),\n model,\n choice,\n range,\n text,\n valueProp: !!options.itemOf,\n item: items?.item ?? null,\n disabled,\n props,\n texts: texts.texts,\n booleans,\n slots,\n args\n }\n}\n","import { layerClassNames } from '#dom-css/behaviours/states/names'\nimport { stateTailwindClasses } from '#dom-css/behaviours/states/tailwind'\n\nimport type { ComponentModel } from './model'\nimport { shaderElements } from './shaders'\n\n/** How a generated component is styled: a stylesheet, or Tailwind utilities in its markup. */\nexport const COMPONENT_STYLINGS = ['css', 'tailwind'] as const\nexport type ComponentStyling = (typeof COMPONENT_STYLINGS)[number]\n\n/** Where a layer's shader plays: filling the layer, beneath its content, inside its corners. */\nexport const SHADER_UTILITIES = 'pointer-events-none absolute inset-0 -z-10 rounded-[inherit]'\n\n/**\n * The class each of a component's readable class names stands for. Styled with a stylesheet, a\n * class is itself; with Tailwind it is the layer's utilities, its states behind their variants,\n * and a shader canvas's placement.\n */\nexport function componentClasses(\n component: ComponentModel,\n styling: ComponentStyling\n): (className: string) => string {\n if (styling === 'css') return (className) => className\n const readable = layerClassNames(component.styles)\n const utilities = stateTailwindClasses(component.styles)\n const byClass = new Map<string, string>()\n for (const [element, className] of readable) byClass.set(className, utilities.get(element) ?? '')\n for (const { shader } of shaderElements(component.tree))\n if (shader) byClass.set(shader.className, SHADER_UTILITIES)\n return (className) => byClass.get(className) ?? className\n}\n","import { es, jsx } from '@pairdraw/emit'\n\nimport type { IconDrawing, IconImport, IconPackage } from '../icons'\nimport type { ComponentModel, GeneratedKind } from '../model'\n\n/** `styles.thumb`, or `styles['switch-thumb']` for a class that isn't an identifier. */\nexport function moduleClass(className: string): es.SyntaxNode {\n return {\n type: 'MemberExpression',\n object: es.identifier('styles'),\n property: es.isIdentifierName(className) ? es.identifier(className) : es.string(className),\n computed: !es.isIdentifierName(className),\n optional: false\n }\n}\n\n/** What a component's markup uses, which its module imports. */\nexport interface MarkupUses {\n component: ComponentModel\n kind: GeneratedKind\n choice: ComponentModel['choice']\n /** Other generated components. */\n components: Set<string>\n /** Whether an icon is drawn by Iconify. */\n icons: boolean\n /** The package icons come from, and what the icons drawn from it import. */\n iconPackage: IconPackage\n iconImports: IconImport[]\n /** Names an icon's imports apart from the component's other names. */\n nameIcon: (drawing: IconDrawing) => IconDrawing\n /** A layer's class as the component is styled: its CSS module class, or its utilities. */\n classOf: (className: string) => es.SyntaxNode\n /** The layer each JSX element draws, which code links back to. */\n layers: WeakMap<es.SyntaxNode, string>\n /** Effects of the `shaders` library its layers fill with. */\n shaders: Set<string>\n}\n\nexport const numeric = (name: string, value: number) =>\n jsx.attribute(name, jsx.container(es.number(value)))\n\n/** A `className` value: a plain string as an attribute string, anything else in braces. */\nexport function classValue(value: es.SyntaxNode): es.SyntaxNode {\n return value.type === 'Literal' && typeof value.value === 'string'\n ? jsx.stringValue(value.value)\n : jsx.container(value)\n}\n\n/** `element`, recorded as drawing `layerId`, so code can link back to that layer. */\nexport function drawing(\n element: es.SyntaxNode,\n layerId: string | undefined,\n uses: MarkupUses\n): es.SyntaxNode {\n if (layerId) uses.layers.set(element, layerId)\n return element\n}\n\n/** The layer of each JSX element in `program`, in the order the elements open. */\nexport function elementLayers(\n program: es.SyntaxNode,\n layers: WeakMap<es.SyntaxNode, string>\n): (string | null)[] {\n const found: (string | null)[] = []\n const visit = (value: unknown) => {\n if (Array.isArray(value)) {\n for (const item of value) visit(item)\n return\n }\n if (!es.isNode(value)) return\n if (value.type === 'JSXElement') found.push(layers.get(value) ?? null)\n for (const item of Object.values(value)) visit(item)\n }\n visit(program)\n return found\n}\n","import dedent from 'dedent'\n\nimport { es, jsx } from '@pairdraw/emit'\n\nimport { progressWidth } from '../fields'\nimport type { ComponentElement, ComponentModel, GeneratedKind } from '../model'\nimport { classValue, numeric, type MarkupUses } from './shared'\n\n/** Kinds whose native input takes the caller's props, rather than their root. */\nexport const INPUT_PROPS: Partial<Record<GeneratedKind, 'input' | 'textarea'>> = {\n textField: 'input',\n textarea: 'textarea'\n}\n\n/** A number field's stepper parts, which change its value by a step. */\nexport const STEPPERS: Record<string, { label: string; sign: '+' | '-' }> = {\n increment: { label: 'Increase', sign: '+' },\n decrement: { label: 'Decrease', sign: '-' }\n}\n\n/** What a part of a native or measured control needs: a stepper's step, an indicator's width. */\nexport function partAttributes(node: ComponentElement, uses: MarkupUses): es.SyntaxNode[] {\n const { range } = uses.component\n if (!range || !node.part) return []\n if (uses.kind === 'progress' && node.part === 'indicator') {\n const style = progressWidth(range, es.identifier('value'))\n return style ? [jsx.attribute('style', jsx.container(style))] : []\n }\n const stepper = uses.kind === 'numberField' ? STEPPERS[node.part] : undefined\n if (!stepper) return []\n return [\n jsx.attribute('aria-label', jsx.stringValue(stepper.label)),\n jsx.attribute('disabled', jsx.container(es.identifier('disabled'))),\n jsx.attribute(\n 'onClick',\n jsx.container(es.parseExpression(`() => commit(value ${stepper.sign} ${String(range.step)})`))\n )\n ]\n}\n\nconst NUMBER_INPUT = [\n ['type', jsx.stringValue('number')],\n ['value', jsx.container(es.parseExpression(\"Number.isNaN(value) ? '' : value\"))],\n [\n 'onChange',\n jsx.container(es.parseExpression('(event) => setValue(event.target.valueAsNumber)'))\n ],\n ['onBlur', jsx.container(es.parseExpression('() => commit(value)'))]\n] as const\n\n/** A field's input: a number input that commits within its range, or the input or textarea. */\nexport function inputElement(className: string, uses: MarkupUses, depth: number): es.SyntaxNode {\n const { component } = uses\n const classAttribute = jsx.attribute('className', classValue(uses.classOf(className)))\n const { range } = component\n if (range)\n return jsx.element(\n 'input',\n [\n ...NUMBER_INPUT.map(([name, value]) => jsx.attribute(name, value)),\n numeric('min', range.min),\n numeric('max', range.max),\n numeric('step', range.step),\n jsx.attribute('disabled', jsx.container(es.identifier('disabled'))),\n classAttribute\n ],\n [],\n depth\n )\n const start = component.text?.default\n const placeholder = component.text?.placeholder\n return jsx.element(\n INPUT_PROPS[uses.kind] ?? 'input',\n [\n ...(placeholder ? [jsx.attribute('placeholder', jsx.stringValue(placeholder))] : []),\n ...(start ? [jsx.attribute('defaultValue', jsx.stringValue(start))] : []),\n // The input takes the caller's props, such as `name` or `onChange`.\n jsx.spread(es.identifier('props')),\n classAttribute\n ],\n [],\n depth\n )\n}\n\n/** A destructured prop, with the default it takes when the caller leaves it out. */\nexport interface Parameter {\n name: string\n default?: es.SyntaxNode\n}\n\n/** Props a kind reads itself: a progress bar's value, a number field's start and changes. */\nexport function kindParameters(component: ComponentModel): Parameter[] {\n const { range } = component\n if (component.kind === 'progress' && range)\n return [{ name: 'value', default: es.number(range.default) }]\n if (component.kind === 'numberField' && range)\n return [\n { name: 'defaultValue', default: es.number(range.default) },\n { name: 'onValueChange' },\n { name: 'disabled' }\n ]\n return []\n}\n\n/**\n * A number field's value: typed freely, and settled within its range when it loses focus or a\n * stepper moves it, which is when the caller hears of it.\n */\nexport const NUMBER_STATE = (range: { min: number; max: number }) =>\n es.fill(\n es.parseModule(dedent`\n const [value, setValue] = useState(defaultValue)\n const commit = (next: number) => {\n const settled = Number.isNaN(next) ? $min : Math.min($max, Math.max($min, next))\n setValue(settled)\n onValueChange?.(settled)\n }\n `),\n { $min: es.number(range.min), $max: es.number(range.max) }\n ).body\n\n/** The component function's statements before it returns, such as a number field's state. */\nexport function prepend(declaration: es.SyntaxNode | undefined, statements: es.SyntaxNode[]): void {\n const fn = es.child(declaration, 'declaration')\n const body = es.child(fn, 'body')\n if (!body || statements.length === 0) return\n body.body = [...statements, ...es.children(body, 'body')]\n}\n","import { upperFirst } from 'es-toolkit/string'\n\nimport type { GeneratedKind } from '../model'\n\n/**\n * The Radix primitive a kind renders, from the unified `radix-ui` package, and the component\n * of it each part uses. Its root takes the value two ways (`checked` and `onCheckedChange`,\n * `pressed`, `open`) and `disabled` itself, so the generated props extend the root's.\n */\nexport const RADIX: Record<\n GeneratedKind,\n { namespace: string; parts: Record<string, string> } | null\n> = {\n button: null,\n switch: { namespace: 'Switch', parts: { root: 'Root', thumb: 'Thumb' } },\n checkbox: { namespace: 'Checkbox', parts: { root: 'Root', indicator: 'Indicator' } },\n toggle: { namespace: 'Toggle', parts: { root: 'Root' } },\n collapsible: {\n namespace: 'Collapsible',\n parts: { root: 'Root', trigger: 'Trigger', content: 'Content' }\n },\n tabs: {\n namespace: 'Tabs',\n parts: { root: 'Root', list: 'List', trigger: 'Trigger', content: 'Content' }\n },\n radioGroup: { namespace: 'RadioGroup', parts: { root: 'Root' } },\n toggleGroup: { namespace: 'ToggleGroup', parts: { root: 'Root' } },\n accordion: { namespace: 'Accordion', parts: { root: 'Root' } },\n radioGroupItem: { namespace: 'RadioGroup', parts: { root: 'Item', indicator: 'Indicator' } },\n toggleGroupItem: { namespace: 'ToggleGroup', parts: { root: 'Item' } },\n accordionItem: {\n namespace: 'Accordion',\n parts: { root: 'Item', trigger: 'Trigger', content: 'Content' }\n },\n slider: {\n namespace: 'Slider',\n parts: { root: 'Root', track: 'Track', range: 'Range', thumb: 'Thumb' }\n },\n progress: { namespace: 'Progress', parts: { root: 'Root', indicator: 'Indicator' } },\n // Radix has no number or text field; these are native inputs in the design's own elements.\n numberField: null,\n textField: null,\n textarea: null,\n // A component without a behaviour is the design's own elements.\n plain: null\n}\n\n/** The local name a Radix namespace is imported as, such as `SwitchPrimitive`. */\nexport const PRIMITIVE = (namespace: string) => `${namespace}Primitive`\n\n/** `defaultChecked`: Radix's uncontrolled value, which a nested control starts from. */\nexport const defaultOf = (model: string) => `default${upperFirst(model)}`\n","import { es } from '@pairdraw/emit'\n\nimport type { ComponentModel, GeneratedComponent, GeneratedKind } from '../model'\nimport { kindParameters, type Parameter } from './fields'\nimport { defaultOf, PRIMITIVE, RADIX } from './radix'\n\n/**\n * The props of a group that fixes one choice at a time, without the `type` it fixes. The\n * root's own props join the single and multiple choice, which a single value can't satisfy.\n */\nexport const SINGLE_PROPS: Partial<Record<GeneratedKind, string>> = {\n toggleGroup: 'ToggleGroupSingleProps',\n accordion: 'AccordionSingleProps'\n}\n\nconst qualified = (namespace: string, name: string) => ({\n type: 'TSQualifiedName',\n left: es.identifier(PRIMITIVE(namespace)),\n right: es.identifier(name)\n})\n\n/** Props a kind declares itself, where no Radix root has them. */\nconst OWN_PROPS: Partial<Record<GeneratedKind, string>> = {\n progress: \"Omit<ComponentProps<typeof ProgressPrimitive.Root>, 'value'> & { value?: number }\",\n numberField:\n \"Omit<ComponentProps<'div'>, 'defaultValue' | 'onChange'> & { defaultValue?: number; onValueChange?: (value: number) => void; disabled?: boolean }\",\n textField: \"ComponentProps<'input'>\",\n textarea: \"ComponentProps<'textarea'>\"\n}\n\n/** The root's own props, or a single choice group's. */\nfunction rootPropsType(kind: GeneratedKind, tag: string): es.SyntaxNode {\n const own = OWN_PROPS[kind]\n if (own) return es.parseType(own)\n // A component without a behaviour takes its root element's props.\n if (kind === 'plain') return es.parseType(`ComponentProps<'${tag}'>`)\n const radix = RADIX[kind]\n if (!radix) return es.parseType(\"ComponentProps<'button'>\")\n const single = SINGLE_PROPS[kind]\n if (single)\n return es.fill(es.parseType(\"Omit<$Props, 'type'>\"), {\n $Props: qualified(radix.namespace, single)\n })\n return es.fill(es.parseType('ComponentProps<typeof $Root>'), {\n $Root: qualified(radix.namespace, radix.parts.root)\n })\n}\n\n/** The root's own props, extended with the component's variant props when it has any. */\nexport function propsType(component: ComponentModel): es.SyntaxNode {\n const base = rootPropsType(component.kind, component.tree.tag)\n const own = [component.props, component.texts, component.booleans, component.slots]\n if (own.every((list) => list.length === 0)) return base\n return {\n type: 'TSIntersectionType',\n types: [\n base,\n es.objectType([\n ...component.props.map((prop): [string, es.SyntaxNode, boolean] => [\n prop.name,\n es.stringUnionType(prop.options),\n true\n ]),\n ...component.texts.map((text): [string, es.SyntaxNode, boolean] => [\n text.name,\n es.parseType('string'),\n true\n ]),\n ...component.booleans.map((prop): [string, es.SyntaxNode, boolean] => [\n prop.name,\n es.parseType('boolean'),\n true\n ]),\n ...component.slots.map((slot): [string, es.SyntaxNode, boolean] => [\n slot.name,\n es.parseType('ReactNode'),\n true\n ])\n ])\n ]\n }\n}\n\n/**\n * `{ size = 'Small', label = 'Save', ...props }`: variant and text props with their defaults,\n * kept off the root, and the rest passed on.\n */\nexport function parameters(component: ComponentModel): es.SyntaxNode {\n const own: Parameter[] = [\n ...kindParameters(component),\n ...[...component.props, ...component.texts].map((prop) => ({\n name: prop.name,\n default: es.string(prop.default)\n })),\n ...component.booleans.map((prop) => ({\n name: prop.name,\n default: es.parseExpression(String(prop.default))\n })),\n // Slots are kept off the root too, which would otherwise get them as attributes.\n ...component.slots.map((slot) => ({ name: slot.name }))\n ]\n if (own.length === 0) return es.identifier('props')\n return {\n type: 'ObjectPattern',\n properties: [\n ...own.map((prop) => ({\n type: 'Property',\n kind: 'init',\n key: es.identifier(prop.name),\n value: prop.default\n ? { type: 'AssignmentPattern', left: es.identifier(prop.name), right: prop.default }\n : es.identifier(prop.name),\n computed: false,\n method: false,\n shorthand: true\n })),\n { type: 'RestElement', argument: es.identifier('props') }\n ]\n }\n}\n\n/**\n * `import { useState, type ComponentProps, type ReactNode } from 'react'` with only what the\n * component uses: a number field's state, its root's props, and its slots' content.\n */\nexport function reactImport(uses: {\n state: boolean\n props: boolean\n slots: boolean\n}): es.SyntaxNode[] {\n const types = [...(uses.props ? ['ComponentProps'] : []), ...(uses.slots ? ['ReactNode'] : [])]\n if (!uses.state && types.length === 0) return []\n const specifiers = uses.state\n ? ['useState', ...types.map((name) => `type ${name}`)].join(', ')\n : types.join(', ')\n return es.parseModule(`import ${uses.state ? '' : 'type '}{ ${specifiers} } from 'react'`).body\n}\n\n/**\n * The prop a story sets the value with: Radix's uncontrolled value, so a story's control and\n * its play function can both change it, which a slider takes as a list; a progress bar's own\n * value, which nothing else changes.\n */\nexport function valueArg(\n kind: GeneratedKind,\n model: string | null\n): Pick<GeneratedComponent, 'valueArg' | 'valueList'> {\n if (!model) return { valueArg: null }\n if (kind === 'progress') return { valueArg: 'value' }\n return { valueArg: defaultOf(model), ...(kind === 'slider' ? { valueList: true } : {}) }\n}\n","import { HEADING_RESET } from '#dom-css/behaviours/reset'\nimport { stateStylesToCSS } from '#dom-css/behaviours/states/css'\nimport dedent from 'dedent'\nimport { compact } from 'es-toolkit/array'\nimport { omit } from 'es-toolkit/object'\nimport { camelCase } from 'es-toolkit/string'\n\nimport { es, jsx } from '@pairdraw/emit'\nimport type { ShaderComponent } from '@pairdraw/scene-graph/shaders'\n\nimport { drawingImports, iconDrawing, iconImportDeclarations, iconNamer } from '../icons'\nimport type { ComponentElement, ComponentGenerator, ComponentNode, GeneratedKind } from '../model'\nimport type { ComponentReference, IconReference } from '../references'\nimport {\n drawnEffects,\n SHADER_CANVAS,\n shaderCSS,\n shaderEffectAttributes,\n shaderEffectName,\n shaderImport,\n type ShaderLayer\n} from '../shaders'\nimport { componentClasses } from '../styling'\nimport {\n INPUT_PROPS,\n inputElement,\n NUMBER_STATE,\n partAttributes,\n prepend,\n STEPPERS\n} from './fields'\nimport { parameters, propsType, reactImport, SINGLE_PROPS, valueArg } from './props'\nimport { defaultOf, PRIMITIVE, RADIX } from './radix'\nimport { classValue, drawing, elementLayers, moduleClass, numeric, type MarkupUses } from './shared'\n\n/** What a group's root fixes: one item chosen at a time, and an accordion that can all close. */\nconst ROOT_ATTRIBUTES: Partial<Record<GeneratedKind, es.SyntaxNode[]>> = {\n toggleGroup: [jsx.attribute('type', jsx.stringValue('single'))],\n accordion: [jsx.attribute('type', jsx.stringValue('single')), jsx.attribute('collapsible', null)]\n}\n\nconst HEADING_STYLE = jsx.container(\n es.object(\n Object.entries(HEADING_RESET).map(\n ([property, value]) => [camelCase(property), es.string(value)] as const\n )\n )\n)\n\n/** Several classes on one element, skipping a caller's that is absent. */\nconst CLASS_NAMES = es.parseExpression(\"$classes.filter(Boolean).join(' ')\")\n\n/** Whether a layer renders as a native button: a button's root, or a number field's stepper. */\nconst isNativeButton = (node: ComponentElement, kind: GeneratedKind) =>\n (kind === 'button' && node.part === 'root') ||\n (kind === 'numberField' && node.part !== null && Object.hasOwn(STEPPERS, node.part))\n\n/** A Radix primitive's part, a native button, or the design's tag. */\nfunction tagOf(node: ComponentElement, kind: GeneratedKind): string {\n const radix = RADIX[kind]\n const part = node.part ? radix?.parts[node.part] : undefined\n if (radix && part) return `${PRIMITIVE(radix.namespace)}.${part}`\n return isNativeButton(node, kind) ? 'button' : node.tag\n}\n\n/** `disabled || undefined`, so a native root sets `data-disabled` only while disabled. */\nconst disabledFlag = (kind: GeneratedKind) =>\n es.parseExpression(\n kind === 'numberField' ? 'disabled || undefined' : 'props.disabled || undefined'\n )\n\n/** The Iconify component, named apart from any component the design calls `Icon`. */\nconst ICONIFY = 'IconifyIcon'\n\n/** An icon: its package's own component where it has the icon, Iconify's otherwise. */\nfunction iconElement(node: IconReference, uses: MarkupUses, depth: number): es.SyntaxNode {\n const className = jsx.attribute('className', classValue(uses.classOf(node.className)))\n const found = iconDrawing(node.icon, uses.iconPackage, 'react')\n const drawn = found && uses.nameIcon(found)\n if (!drawn) {\n uses.icons = true\n return jsx.element(\n ICONIFY,\n [jsx.attribute('icon', jsx.stringValue(node.icon)), className],\n [],\n depth\n )\n }\n uses.iconImports.push(...drawingImports(drawn))\n if (drawn.type === 'component') return jsx.element(drawn.import.local, [className], [], depth)\n return jsx.element(\n drawn.component.local,\n [jsx.attribute('icon', jsx.container(es.identifier(drawn.import.local))), className],\n [],\n depth\n )\n}\n\n/** A reference's prop value: a bare name for true, `{false}`, or a string. */\nfunction referenceValue(value: string | boolean): es.SyntaxNode | null {\n if (value === true) return null\n if (value === false) return jsx.container(jsx.literal(false))\n return jsx.stringValue(value)\n}\n\nfunction reference(node: ComponentReference, uses: MarkupUses, depth: number): es.SyntaxNode {\n uses.components.add(node.component)\n return drawing(\n jsx.element(\n node.component,\n [\n jsx.attribute('className', classValue(uses.classOf(node.className))),\n ...node.props.map((prop) => jsx.attribute(prop.name, referenceValue(prop.value))),\n ...(node.model ? [jsx.attribute(defaultOf(node.model), null)] : [])\n ],\n [],\n depth\n ),\n node.layerId,\n uses\n )\n}\n\nfunction element(node: ComponentNode, uses: MarkupUses, depth: number): es.SyntaxNode {\n if (node.type === 'text') return jsx.text(node.value)\n if (node.type === 'textProp') return jsx.container(es.identifier(node.name))\n if (node.type === 'reference') return reference(node, uses, depth)\n if (node.type === 'input')\n return drawing(inputElement(node.className, uses, depth), node.layerId, uses)\n if (node.type === 'icon') return drawing(iconElement(node, uses, depth), node.layerId, uses)\n return designElement(node, uses, depth)\n}\n\n/**\n * The design's own classes, the state styles' module class, and on the root the caller's,\n * which the spread would otherwise lose to the generated one.\n */\nfunction classNameOf(node: ComponentElement, root: boolean, uses: MarkupUses): es.SyntaxNode {\n const classes = [\n ...(node.attrs.class ? [es.string(node.attrs.class)] : []),\n uses.classOf(node.className),\n ...(root ? [es.parseExpression('props.className')] : [])\n ]\n const only = classes.length === 1 ? classes.at(0) : undefined\n return only ?? es.fill(CLASS_NAMES, { $classes: es.array(classes) })\n}\n\n/**\n * What a root fixes before the caller's props: a group's single choice and its start, and a\n * slider's or progress bar's range and the value it starts at.\n */\nfunction rootAttributes(uses: MarkupUses): es.SyntaxNode[] {\n const { component } = uses\n const start = uses.choice?.default\n const { range } = component\n return [\n ...(ROOT_ATTRIBUTES[uses.kind] ?? []),\n // A choice starts on the design's option, which the caller's props can change.\n ...(start ? [jsx.attribute('defaultValue', jsx.stringValue(start))] : []),\n ...(range && uses.kind === 'slider'\n ? [\n jsx.attribute('defaultValue', jsx.container(es.array([es.number(range.default)]))),\n numeric('min', range.min),\n numeric('max', range.max),\n numeric('step', range.step)\n ]\n : []),\n ...(range && uses.kind === 'progress'\n ? [\n // Radix takes a value within its range, as the indicator draws one.\n jsx.attribute(\n 'value',\n jsx.container(\n es.fill(es.parseExpression('Math.min($max, Math.max($min, value))'), {\n $min: es.number(range.min),\n $max: es.number(range.max)\n })\n )\n ),\n numeric('max', range.max)\n ]\n : [])\n ]\n}\n\nfunction bindingAttributes(\n node: ComponentElement,\n kind: GeneratedKind,\n native: boolean\n): es.SyntaxNode[] {\n return node.bindings.flatMap((binding) => {\n if (binding.type === 'prop')\n return [jsx.attribute(binding.attribute, jsx.container(es.identifier(binding.prop.name)))]\n // Radix sets `data-disabled` on its own roots; a native root needs it for the styles.\n if (binding.type === 'disabled' && native)\n return [jsx.attribute('data-disabled', jsx.container(disabledFlag(kind)))]\n return []\n })\n}\n\n/** A shader playing behind its layer's content, with telemetry off, as every export has it. */\nfunction shaderCanvas(shader: ShaderLayer, uses: MarkupUses, depth: number): es.SyntaxNode {\n const effect =\n (at: number) =>\n (component: ShaderComponent): es.SyntaxNode => {\n uses.shaders.add(component.type)\n const children = drawnEffects(component.children).map(effect(at + 1))\n return jsx.element(\n shaderEffectName(component.type),\n shaderEffectAttributes(component),\n children,\n at\n )\n }\n return jsx.element(\n SHADER_CANVAS,\n [\n jsx.attribute('className', classValue(uses.classOf(shader.className))),\n jsx.attribute('disableTelemetry', null)\n ],\n drawnEffects(shader.preset.components).map(effect(depth + 1)),\n depth\n )\n}\n\n/** Words alone stay on the element's line, where a line break would add a space. */\nfunction wordsOnly(node: ComponentElement): boolean {\n const only = node.children.length === 1 ? node.children[0]?.type : undefined\n return !node.slot && !node.shader && (only === 'text' || only === 'textProp')\n}\n\nfunction designElement(node: ComponentElement, uses: MarkupUses, depth: number): es.SyntaxNode {\n const kind = uses.kind\n const root = node.part === 'root'\n const native = root && !(node.part && RADIX[kind]?.parts[node.part])\n const attributes = [\n ...(isNativeButton(node, kind) ? [jsx.attribute('type', jsx.stringValue('button'))] : []),\n ...(root ? rootAttributes(uses) : []),\n // The root passes the caller's props on, such as `checked` or `onClick`, unless its input\n // takes them.\n ...(root && !INPUT_PROPS[kind] ? [jsx.spread(es.identifier('props'))] : []),\n ...(node.value === undefined ? [] : [jsx.attribute('value', jsx.stringValue(node.value))]),\n ...Object.entries(omit(node.attrs, ['class'])).map(([name, value]) =>\n jsx.attribute(name, jsx.stringValue(value))\n ),\n ...partAttributes(node, uses),\n jsx.attribute('className', classValue(classNameOf(node, root, uses))),\n ...bindingAttributes(node, kind, native)\n ]\n const inline = wordsOnly(node)\n // Radix puts an accordion item's trigger in a header, which carries the heading level.\n const header = kind === 'accordionItem' && node.part === 'trigger'\n const childDepth = depth + (header ? 2 : 1)\n const content = node.children.map((child) => element(child, uses, childDepth))\n const shader = node.shader ? [shaderCanvas(node.shader, uses, childDepth)] : []\n const drawn = drawing(\n jsx.element(\n tagOf(node, kind),\n attributes,\n [...shader, ...(node.slot ? [slotContent(node.slot, content, childDepth)] : content)],\n depth + (header ? 1 : 0),\n inline\n ),\n node.layerId,\n uses\n )\n const shown = header\n ? jsx.element(\n `${PRIMITIVE('Accordion')}.Header`,\n [jsx.attribute('style', HEADING_STYLE)],\n [drawn],\n depth\n )\n : drawn\n return node.shownBy ? whenShown(node.shownBy, shown) : shown\n}\n\nconst LOGICAL = (operator: '&&' | '??', left: es.SyntaxNode, right: es.SyntaxNode) => ({\n type: 'LogicalExpression',\n operator,\n left,\n right\n})\n\n/** `{content ?? <>…</>}`: what the caller passes for a slot, or the design's content. */\nfunction slotContent(slot: string, children: es.SyntaxNode[], depth: number): es.SyntaxNode {\n return jsx.container(LOGICAL('??', es.identifier(slot), jsx.fragment(children, depth)))\n}\n\n/** `{showIcon && <…/>}`: a layer a boolean prop shows. */\nfunction whenShown(prop: string, drawn: es.SyntaxNode): es.SyntaxNode {\n return jsx.container(LOGICAL('&&', es.identifier(prop), drawn))\n}\n\nconst MODULE = es.parseModule(dedent`\n import type { ComponentProps } from 'react'\n\n import styles from '$styles'\n\n export type $Props = $Type\n\n export function $Name($params: $Props) {\n return $body\n }\n`)\n\nconst RADIX_IMPORT = es.parseModule(`import { $Namespace as $Primitive } from 'radix-ui'`)\nconst ICONIFY_IMPORT = es.parseModule(`import { Icon as ${ICONIFY} } from '@iconify/react'`).body\nconst IMPORT_COMPONENT = es.parseModule(`import { $Component } from '$path'`)\n\n/**\n * A component as a React component on Radix UI: its parts as Radix primitives from the\n * `radix-ui` package, its variants' state styles in a CSS module, and props that extend the\n * Radix root's with its other variant properties.\n */\nexport const reactComponent: ComponentGenerator = async (component, options = {}) => {\n const styling = options.styling ?? 'css'\n const radix = RADIX[component.kind]\n const stylesPath = `${component.name}.module.css`\n const classOf = componentClasses(component, styling)\n const uses: MarkupUses = {\n component,\n // Styled with Tailwind, a layer's utilities are written out; otherwise its module class.\n classOf: (className) =>\n styling === 'css' ? moduleClass(className) : es.string(classOf(className)),\n kind: component.kind,\n choice: component.choice,\n components: new Set(),\n layers: new WeakMap(),\n icons: false,\n iconPackage: options.icons ?? 'iconify',\n iconImports: [],\n nameIcon: iconNamer(component, [\n ICONIFY,\n 'styles',\n `${component.name}Props`,\n ...(radix ? [radix.namespace, PRIMITIVE(radix.namespace)] : [])\n ]),\n shaders: new Set()\n }\n const body = element(component.tree, uses, 1)\n const imports = [\n ...(uses.icons ? ICONIFY_IMPORT : []),\n ...iconImportDeclarations(uses.iconImports),\n ...(uses.shaders.size > 0 ? [shaderImport('shaders/react', uses.shaders)] : []),\n ...(radix\n ? es.fill(RADIX_IMPORT, {\n $Namespace: es.identifier(radix.namespace),\n $Primitive: es.identifier(PRIMITIVE(radix.namespace))\n }).body\n : []),\n ...[...uses.components].sort().flatMap(\n (name) =>\n es.fill(IMPORT_COMPONENT, {\n $Component: es.identifier(name),\n $path: es.string(`./${name}`)\n }).body\n )\n ]\n const [, stylesImport, ...rest] = es.fill(MODULE, {\n $styles: es.string(`./${stylesPath}`),\n $Props: es.identifier(`${component.name}Props`),\n $Type: propsType(component),\n $Name: es.identifier(component.name),\n $params: parameters(component),\n $body: body\n }).body\n const state =\n component.kind === 'numberField' && component.range ? NUMBER_STATE(component.range) : []\n prepend(rest.at(-1), state)\n const react = reactImport({\n state: state.length > 0,\n // A single choice group's props come from Radix's own type, not `ComponentProps`.\n props: !SINGLE_PROPS[component.kind],\n slots: component.slots.length > 0\n })\n const program = {\n type: 'Program',\n sourceType: 'module',\n body: [...react, ...imports, ...(styling === 'css' ? [stylesImport] : []), ...rest]\n }\n // Tailwind styles the markup itself; a CSS module is written beside it otherwise.\n const stylesheet =\n styling === 'css'\n ? [\n {\n path: stylesPath,\n content: compact([\n (await stateStylesToCSS(component.styles)).css,\n shaderCSS(component.tree)\n ]).join('\\n')\n }\n ]\n : []\n const model = component.model\n // A group's items are their own component, which the group's markup uses.\n const item = component.item ? await reactComponent(component.item, options) : null\n return {\n files: [\n ...(item?.files ?? []),\n {\n path: `${component.name}.tsx`,\n content: `${jsx.printModule(program)}\\n`,\n // The template is filled with copies, so the body, which holds all the JSX, is read.\n layerIds: elementLayers(body, uses.layers)\n },\n ...stylesheet\n ],\n entry: { path: `./${component.name}`, named: true },\n ...valueArg(component.kind, model)\n }\n}\n","import { HEADING_RESET } from '#dom-css/behaviours/reset'\nimport { stateStylesToCSS } from '#dom-css/behaviours/states/css'\nimport dedent from 'dedent'\nimport { compact } from 'es-toolkit/array'\nimport { omit } from 'es-toolkit/object'\nimport { camelCase, kebabCase, upperFirst } from 'es-toolkit/string'\n\nimport { es, vue } from '@pairdraw/emit'\nimport type { ShaderComponent } from '@pairdraw/scene-graph/shaders'\n\nimport { claimName } from '../storybook/names'\nimport { progressWidth } from './fields'\nimport {\n drawingImports,\n iconDrawing,\n iconImportDeclarations,\n iconNamer,\n type IconDrawing,\n type IconImport,\n type IconPackage\n} from './icons'\nimport type {\n ComponentBinding,\n ComponentElement,\n ComponentGenerator,\n ComponentModel,\n ComponentNode,\n GeneratedKind\n} from './model'\nimport type { ComponentReference, IconReference } from './references'\nimport {\n drawnEffects,\n SHADER_CANVAS,\n shaderCSS,\n shaderEffectName,\n shaderImport,\n type ShaderLayer\n} from './shaders'\nimport { componentClasses } from './styling'\n\n/** The Reka UI components a kind renders, by part, and the prop its model binds. */\nconst REKA: Record<\n GeneratedKind,\n { parts: Record<string, string>; model?: 'modelValue' | 'open' }\n> = {\n button: { parts: {} },\n switch: { parts: { root: 'SwitchRoot', thumb: 'SwitchThumb' }, model: 'modelValue' },\n checkbox: {\n parts: { root: 'CheckboxRoot', indicator: 'CheckboxIndicator' },\n model: 'modelValue'\n },\n toggle: { parts: { root: 'Toggle' }, model: 'modelValue' },\n collapsible: {\n parts: {\n root: 'CollapsibleRoot',\n trigger: 'CollapsibleTrigger',\n content: 'CollapsibleContent'\n },\n model: 'open'\n },\n tabs: {\n parts: { root: 'TabsRoot', list: 'TabsList', trigger: 'TabsTrigger', content: 'TabsContent' },\n model: 'modelValue'\n },\n radioGroup: { parts: { root: 'RadioGroupRoot' }, model: 'modelValue' },\n toggleGroup: { parts: { root: 'ToggleGroupRoot' }, model: 'modelValue' },\n accordion: { parts: { root: 'AccordionRoot' }, model: 'modelValue' },\n radioGroupItem: { parts: { root: 'RadioGroupItem', indicator: 'RadioGroupIndicator' } },\n toggleGroupItem: { parts: { root: 'ToggleGroupItem' } },\n accordionItem: {\n parts: { root: 'AccordionItem', trigger: 'AccordionTrigger', content: 'AccordionContent' }\n },\n slider: {\n parts: { root: 'SliderRoot', track: 'SliderTrack', range: 'SliderRange', thumb: 'SliderThumb' },\n model: 'modelValue'\n },\n progress: {\n parts: { root: 'ProgressRoot', indicator: 'ProgressIndicator' },\n model: 'modelValue'\n },\n numberField: {\n parts: {\n root: 'NumberFieldRoot',\n increment: 'NumberFieldIncrement',\n decrement: 'NumberFieldDecrement'\n },\n model: 'modelValue'\n },\n // Reka has no text field; the root is the design's own element around a native input.\n textField: { parts: {} },\n textarea: { parts: {} },\n // A component without a behaviour is the design's own elements.\n plain: { parts: {} }\n}\n\n/** Kinds whose two-way value is their input's, which binds it rather than the root. */\nconst INPUT_MODEL: ReadonlySet<GeneratedKind> = new Set(['textField', 'textarea'])\n\n/** What a group's root fixes: one item chosen at a time, and an accordion that can all close. */\nconst ROOT_ATTRIBUTES: Partial<Record<GeneratedKind, vue.VueAttribute[]>> = {\n toggleGroup: [vue.attribute('type', 'single')],\n accordion: [vue.attribute('type', 'single'), vue.bound('collapsible', es.parseExpression('true'))]\n}\n\nconst identifier = (name: string) => es.identifier(name)\n\nconst HEADING_STYLE = Object.entries(HEADING_RESET)\n .map(([property, value]) => `${property}: ${value}`)\n .join('; ')\n\n/** `disabled || undefined`, so a native button sets `data-disabled` only while disabled. */\nconst DISABLED_FLAG = es.parseExpression('disabled || undefined')\n\nfunction bindingAttributes(\n binding: ComponentBinding,\n uses: TemplateUses,\n native: boolean\n): vue.VueAttribute[] {\n const { kind } = uses\n if (binding.type === 'model') {\n if (INPUT_MODEL.has(kind)) return []\n // Reka's slider takes a list of values, which the model's single one stands in.\n const bound = uses.sliderValues ?? binding.name\n return [vue.model(identifier(bound), REKA[kind].model === 'open' ? 'open' : undefined)]\n }\n if (binding.type === 'prop') return [vue.bound(binding.attribute, identifier(binding.prop.name))]\n if (binding.type === 'value') return [vue.bound('value', identifier('value'))]\n // Reka sets `data-disabled` on its own roots; a native root needs it for the state styles.\n return [\n ...(native && kind !== 'button' ? [] : [vue.bound('disabled', identifier('disabled'))]),\n ...(native ? [vue.bound('data-disabled', DISABLED_FLAG)] : [])\n ]\n}\n\n/** The number range a slider, progress bar, or number field's root is given. */\nfunction rangeAttributes(component: ComponentModel): vue.VueAttribute[] {\n const { range } = component\n if (!range) return []\n const bound = (name: 'min' | 'max' | 'step') => vue.bound(name, es.number(range[name]))\n // A progress bar only takes its maximum; its minimum is where the indicator is empty.\n return component.kind === 'progress'\n ? [bound('max')]\n : [bound('min'), bound('max'), bound('step')]\n}\n\nfunction progressStyle(component: ComponentModel): vue.VueAttribute[] {\n const { range, model } = component\n const style = range && model ? progressWidth(range, identifier(model)) : null\n return style ? [vue.bound('style', style)] : []\n}\n\n/** `element`, recorded as drawing `layerId`, so code can link back to that layer. */\nfunction drawing(\n element: vue.VueElement,\n layerId: string | undefined,\n uses: TemplateUses\n): vue.VueElement {\n if (layerId) uses.layers.set(element, layerId)\n return element\n}\n\n/** A field's input: Reka's for a number field, else a native input or textarea. */\nfunction inputNode(className: string, uses: TemplateUses): vue.VueElement {\n const { component } = uses\n if (component.kind === 'numberField') {\n uses.reka.add('NumberFieldInput')\n return vue.element('NumberFieldInput', [vue.attribute('class', uses.classOf(className))])\n }\n const placeholder = component.text?.placeholder\n return vue.element(component.kind === 'textarea' ? 'textarea' : 'input', [\n vue.attribute('class', uses.classOf(className)),\n ...(component.model ? [vue.model(identifier(component.model))] : []),\n ...(placeholder ? [vue.attribute('placeholder', placeholder)] : []),\n ...(component.disabled ? [vue.bound('disabled', identifier('disabled'))] : [])\n ])\n}\n\n/** What a template uses, which its script imports and declares. */\ninterface TemplateUses {\n component: ComponentModel\n kind: GeneratedKind\n /** The list a slider's root binds, standing in for its single value. */\n sliderValues: string | null\n /** Reka components. */\n reka: Set<string>\n /** Other generated components. */\n components: Set<string>\n /** Whether an icon is drawn by Iconify. */\n icons: boolean\n /** The package icons come from, and what the icons drawn from it import. */\n iconPackage: IconPackage\n iconImports: IconImport[]\n /** Names an icon's imports apart from the component's other names. */\n nameIcon: (drawing: IconDrawing) => IconDrawing\n /** The class a layer's readable class name stands for, as the component is styled. */\n classOf: (className: string) => string\n /** The layer each element draws, which code links back to. */\n layers: WeakMap<vue.VueElement, string>\n /** Effects of the `shaders` library its layers fill with. */\n shaders: Set<string>\n /** A ref per nested control drawn on, which its `v-model` binds. */\n models: { name: string }[]\n taken: Set<string>\n}\n\n/** The Iconify component, named apart from any component the design calls `Icon`. */\nconst ICONIFY = 'IconifyIcon'\n\n/** An icon: its package's own component where it has the icon, Iconify's otherwise. */\nfunction iconElement(node: IconReference, uses: TemplateUses): vue.VueElement {\n const className = vue.attribute('class', uses.classOf(node.className))\n const found = iconDrawing(node.icon, uses.iconPackage, 'vue')\n const drawn = found && uses.nameIcon(found)\n if (!drawn) {\n uses.icons = true\n return vue.element(ICONIFY, [vue.attribute('icon', node.icon), className])\n }\n uses.iconImports.push(...drawingImports(drawn))\n if (drawn.type === 'component') return vue.element(drawn.import.local, [className])\n return vue.element(drawn.component.local, [\n vue.bound('icon', identifier(drawn.import.local)),\n className\n ])\n}\n\nfunction reference(node: ComponentReference, uses: TemplateUses): vue.VueElement {\n uses.components.add(node.component)\n const model = node.model\n ? claimName(`${camelCase(node.component)}${upperFirst(node.model)}`, uses.taken)\n : null\n if (model) uses.models.push({ name: model })\n return vue.element(node.component, [\n vue.attribute('class', uses.classOf(node.className)),\n ...node.props.map((prop) =>\n typeof prop.value === 'boolean'\n ? vue.bound(prop.name, es.parseExpression(String(prop.value)))\n : vue.attribute(prop.name, prop.value)\n ),\n // The control stays operable, starting from the value the design draws.\n ...(model && node.model ? [vue.model(identifier(model), node.model)] : [])\n ])\n}\n\n/** A design element's attributes: what shows it, its part's own, the design's, and bindings. */\nfunction elementAttributes(\n node: ComponentElement,\n uses: TemplateUses,\n { native, button }: { native: boolean; button: boolean }\n): vue.VueAttribute[] {\n const root = node.part === 'root'\n return [\n ...(node.shownBy ? [vue.renderIf(identifier(node.shownBy))] : []),\n ...(button ? [vue.attribute('type', 'button')] : []),\n ...(root ? [...(ROOT_ATTRIBUTES[uses.kind] ?? []), ...rangeAttributes(uses.component)] : []),\n ...(uses.kind === 'progress' && node.part === 'indicator' ? progressStyle(uses.component) : []),\n ...Object.entries(omit(node.attrs, ['class'])).map(([name, value]) =>\n vue.attribute(name, value)\n ),\n vue.attribute('class', compact([node.attrs.class, uses.classOf(node.className)]).join(' ')),\n ...(node.value === undefined ? [] : [vue.attribute('value', node.value)]),\n ...node.bindings.flatMap((binding) => bindingAttributes(binding, uses, native))\n ]\n}\n\n/** A shader playing behind its layer's content, with telemetry off, as every export has it. */\nfunction shaderCanvas(shader: ShaderLayer, uses: TemplateUses): vue.VueNode {\n const effect = (component: ShaderComponent): vue.VueNode => {\n uses.shaders.add(component.type)\n return vue.element(\n shaderEffectName(component.type),\n Object.entries(component.props ?? {}).map(([key, value]) =>\n typeof value === 'string'\n ? vue.attribute(kebabCase(key), value)\n : vue.bound(kebabCase(key), es.json(value))\n ),\n drawnEffects(component.children).map(effect)\n )\n }\n return vue.element(\n SHADER_CANVAS,\n [\n vue.attribute('class', uses.classOf(shader.className)),\n vue.bound('disable-telemetry', es.json(true))\n ],\n drawnEffects(shader.preset.components).map(effect)\n )\n}\n\nfunction designElement(node: ComponentElement, uses: TemplateUses): vue.VueElement {\n const reka = node.part ? REKA[uses.kind].parts[node.part] : undefined\n if (reka) uses.reka.add(reka)\n const native = node.part === 'root' && !reka\n const button = native && uses.kind === 'button'\n const content = node.children.map((child) => templateNode(child, uses))\n const children = node.shader ? [shaderCanvas(node.shader, uses), ...content] : content\n const element = drawing(\n vue.element(\n reka ?? (button ? 'button' : node.tag),\n elementAttributes(node, uses, { native, button }),\n // A slot frame shows what the caller passes, or the design's content.\n node.slot\n ? [\n ...(node.shader ? [shaderCanvas(node.shader, uses)] : []),\n vue.element('slot', [vue.attribute('name', node.slot)], content)\n ]\n : children\n ),\n node.layerId,\n uses\n )\n // Reka puts an accordion item's trigger in a header, which carries the heading level.\n if (uses.kind !== 'accordionItem' || node.part !== 'trigger') return element\n uses.reka.add('AccordionHeader')\n return vue.element('AccordionHeader', [vue.attribute('style', HEADING_STYLE)], [element])\n}\n\nfunction templateNode(node: ComponentNode, uses: TemplateUses): vue.VueNode {\n if (node.type === 'text') return vue.text(node.value)\n if (node.type === 'textProp') return vue.interpolation(identifier(node.name))\n if (node.type === 'reference') return drawing(reference(node, uses), node.layerId, uses)\n if (node.type === 'input') return drawing(inputNode(node.className, uses), node.layerId, uses)\n if (node.type === 'icon') return drawing(iconElement(node, uses), node.layerId, uses)\n return designElement(node, uses)\n}\n\nfunction propsType(component: ComponentModel): es.SyntaxNode {\n const members: [string, es.SyntaxNode, boolean][] = component.props.map((prop) => [\n prop.name,\n es.stringUnionType(prop.options),\n true\n ])\n if (component.disabled) members.unshift(['disabled', es.parseType('boolean'), true])\n // A group's item always stands for a value, which has no default.\n if (component.valueProp) members.unshift(['value', es.parseType('string'), false])\n for (const text of component.texts) members.push([text.name, es.parseType('string'), true])\n for (const prop of component.booleans) members.push([prop.name, es.parseType('boolean'), true])\n return es.objectType(members)\n}\n\n/** `defineProps`, with `withDefaults` when any prop has a default to give. */\n/** Whether any prop has a default to give: `disabled`, a variant, a text, or a boolean. */\nconst hasDefaults = (component: ComponentModel) =>\n component.disabled ||\n component.props.length > 0 ||\n component.texts.length > 0 ||\n component.booleans.length > 0\n\nfunction propsDeclaration(component: ComponentModel): es.SyntaxNode[] {\n const optional = hasDefaults(component)\n return optional\n ? es.fill(PROPS, { $Props: propsType(component), $defaults: propsDefaults(component) }).body\n : es.fill(REQUIRED_PROPS, { $Props: propsType(component) }).body\n}\n\nfunction propsDefaults(component: ComponentModel): es.SyntaxNode {\n return es.object([\n ...(component.disabled ? [['disabled', es.parseExpression('false')] as const] : []),\n ...component.props.map((prop) => [prop.name, es.string(prop.default)] as const),\n ...component.texts.map((text) => [text.name, es.string(text.default)] as const),\n ...component.booleans.map(\n (prop) => [prop.name, es.parseExpression(String(prop.default))] as const\n )\n ])\n}\n\nconst PROPS = es.parseModule('withDefaults(defineProps<$Props>(), $defaults)')\nconst REQUIRED_PROPS = es.parseModule('defineProps<$Props>()')\nconst MODEL = es.parseModule('const $model = defineModel<boolean>($name, { default: false })')\nconst CHOICE_MODEL = es.parseModule(\n 'const $model = defineModel<$Type>($name, { default: $default })'\n)\nconst OPEN_CHOICE_MODEL = es.parseModule('const $model = defineModel<$Type>($name)')\nconst VALUE_MODEL = es.parseModule(\n 'const $model = defineModel<$Type>($name, { default: $default })'\n)\nconst SLIDER_VALUES = es.parseModule(dedent`\n const $values = computed({\n get: () => [$model.value],\n set: (next: number[] | undefined) => {\n $model.value = next?.[0] ?? $model.value\n }\n })\n`)\n\nfunction namedImport(names: readonly string[], source: string, local = (name: string) => name) {\n return {\n type: 'ImportDeclaration',\n importKind: 'value',\n specifiers: names.map((name) => ({\n type: 'ImportSpecifier',\n imported: identifier(name),\n local: identifier(local(name))\n })),\n source: es.string(source)\n }\n}\n\nconst IMPORT_COMPONENT = es.parseModule(`import $Component from '$path'`)\nconst MODEL_REF = es.parseModule('const $name = ref(true)')\n\n/** What the script imports: Vue's helpers, Iconify, Reka, and other generated components. */\nfunction scriptImports(uses: TemplateUses): es.SyntaxNode[] {\n const helpers = compact([uses.sliderValues && 'computed', uses.models.length > 0 && 'ref'])\n return [\n ...(helpers.length > 0 ? [namedImport(helpers, 'vue')] : []),\n ...(uses.icons ? [namedImport(['Icon'], '@iconify/vue', () => ICONIFY)] : []),\n ...iconImportDeclarations(uses.iconImports),\n ...(uses.reka.size > 0 ? [namedImport([...uses.reka].sort(), 'reka-ui')] : []),\n ...(uses.shaders.size > 0 ? [shaderImport('shaders/vue', uses.shaders)] : []),\n ...[...uses.components].sort().flatMap(\n (name) =>\n es.fill(IMPORT_COMPONENT, {\n $Component: identifier(name),\n $path: es.string(`./${name}.vue`)\n }).body\n )\n ]\n}\n\n/** The model's declaration: a choice, a number or text, or a boolean, and a slider's list. */\nfunction modelDeclaration(component: ComponentModel, uses: TemplateUses): es.SyntaxNode[] {\n const name = component.model\n if (!name) return []\n const { choice, range, text } = component\n const base = { $model: identifier(name), $name: es.string(name) }\n if (choice)\n return es.fill(choice.default === null ? OPEN_CHOICE_MODEL : CHOICE_MODEL, {\n ...base,\n $Type: es.stringUnionType(choice.options),\n $default: choice.default === null ? es.OMIT : es.string(choice.default)\n }).body\n if (!range && !text) return es.fill(MODEL, base).body\n const model = es.fill(VALUE_MODEL, {\n ...base,\n $Type: es.parseType(range ? 'number' : 'string'),\n $default: range ? es.number(range.default) : es.string(text?.default ?? '')\n }).body\n const values = uses.sliderValues\n ? es.fill(SLIDER_VALUES, { $values: identifier(uses.sliderValues), $model: identifier(name) })\n .body\n : []\n return [...model, ...values]\n}\n\nfunction script(component: ComponentModel, uses: TemplateUses): es.SyntaxNode {\n const props = component.valueProp || hasDefaults(component) ? propsDeclaration(component) : []\n const refs = uses.models.flatMap(\n (item) => es.fill(MODEL_REF, { $name: identifier(item.name) }).body\n )\n return {\n type: 'Program',\n sourceType: 'module',\n body: [...scriptImports(uses), ...props, ...modelDeclaration(component, uses), ...refs]\n }\n}\n\n/**\n * A component as a Vue single-file component on Reka UI: its variants' state styles in a\n * scoped stylesheet, its parts as Reka components, and its props from the behaviour and its\n * other variant properties.\n */\nexport const vueComponent: ComponentGenerator = async (component, options = {}) => {\n const styling = options.styling ?? 'css'\n const taken = new Set([\n ...component.props.map((prop) => prop.name),\n ...component.texts.map((text) => text.name),\n ...component.booleans.map((prop) => prop.name),\n ...component.slots.map((slot) => slot.name),\n ...(component.model ? [component.model] : []),\n 'disabled'\n ])\n const uses: TemplateUses = {\n component,\n classOf: componentClasses(component, styling),\n layers: new WeakMap(),\n kind: component.kind,\n sliderValues:\n component.kind === 'slider' && component.model ? claimName('values', taken) : null,\n reka: new Set(),\n components: new Set(),\n icons: false,\n iconPackage: options.icons ?? 'iconify',\n iconImports: [],\n nameIcon: iconNamer(component, [ICONIFY, ...taken]),\n shaders: new Set(),\n models: [],\n // Refs share the script with the component's own props and model.\n taken\n }\n const template = templateNode(component.tree, uses)\n // Tailwind styles the markup itself; a stylesheet is written beside it otherwise.\n const style =\n styling === 'css'\n ? compact([(await stateStylesToCSS(component.styles)).css, shaderCSS(component.tree)]).join(\n '\\n'\n )\n : undefined\n const path = `${component.name}.vue`\n // A group's items are their own component, which the group's template uses.\n const item = component.item ? await vueComponent(component.item, options) : null\n const sfc = { script: script(component, uses), template, style }\n return {\n files: [\n ...(item?.files ?? []),\n {\n path,\n content: vue.printComponent(sfc),\n layerIds: vue\n .componentElements(sfc)\n .map((element) => (element && uses.layers.get(element)) ?? null)\n }\n ],\n entry: { path: `./${path}`, named: false },\n // `v-model` binds the value, and its prop takes a story's initial value.\n valueArg: component.model\n }\n}\n","import { stateStylesToCSS } from '#dom-css/behaviours/states/css'\nimport { restLayerOf, stateStyles } from '#dom-css/behaviours/states/model'\nimport { stateStylesToTailwind } from '#dom-css/behaviours/states/tailwind'\nimport type { StateElement, StateNode, StateStyles } from '#dom-css/behaviours/states/types'\nimport type { DesignDocument, DesignElement, DesignNode } from '#dom-css/types'\nimport { zip } from 'es-toolkit/array'\n\nimport type { SceneGraph } from '@pairdraw/scene-graph'\n\nimport { extractImageAssets, type ExportHTMLFile } from '../bundle'\nimport { serializedElements, serializeHTML } from '../html'\nimport type { SceneGraphToDesignOptions } from '../projection'\nimport { claimName, identifierName } from '../storybook/names'\nimport { componentModel, type ComponentGeneratorOptions, type GeneratedComponent } from './model'\nimport { reactComponent } from './react'\nimport { vueComponent } from './vue'\n\n/** The frameworks a layer can be generated as a component for. */\nexport const LAYER_COMPONENT_FRAMEWORKS = ['vue', 'react'] as const\nexport type LayerComponentFramework = (typeof LAYER_COMPONENT_FRAMEWORKS)[number]\n\n/** A layer as a component: its name and the files that make it up. */\nexport interface LayerComponent {\n name: string\n layerId: string\n files: GeneratedComponent['files']\n}\n\n/**\n * Each layer as a Vue or React component, as the Storybook export generates a component set's:\n * a component set with its variants as props and its behaviour's parts, and any other layer as\n * a plain component of the elements it draws. Names stay distinct across the layers.\n */\nexport async function layerComponents(\n graph: SceneGraph,\n layerIds: readonly string[],\n framework: LayerComponentFramework,\n options: Pick<SceneGraphToDesignOptions, 'vectorElement'> & ComponentGeneratorOptions = {}\n): Promise<LayerComponent[]> {\n const generate = framework === 'vue' ? vueComponent : reactComponent\n const taken = new Set<string>()\n const components: LayerComponent[] = []\n for (const layerId of layerIds) {\n const layer = graph.getNode(layerId)\n if (!layer) continue\n const name = claimName(identifierName(layer.name, 'Component'), taken)\n // No other layer is a generated component here, but icons from a set are still used.\n const model = componentModel(graph, layer, { ...options, name, references: new Map() })\n if (!model) continue\n const { files } = await generate(model, { styling: options.styling, icons: options.icons })\n components.push({ name, layerId, files })\n }\n return components\n}\n\n/** Layers as HTML and the stylesheet that styles it, and the images it points at. */\nexport interface LayerMarkup {\n html: string\n /** The layer each element of `html` draws, in the order they open, `null` for none. */\n layerIds: (string | null)[]\n css: string\n images: ExportHTMLFile[]\n}\n\n/** The state element each element of markup built from it draws, which it builds one for one. */\nfunction drawnBy(\n state: StateNode,\n design: DesignNode,\n found: Map<DesignElement, StateElement>\n): void {\n if (state.type === 'text' || design.type === 'text') return\n found.set(design, state)\n for (const [child, built] of zip(state.children, design.children)) drawnBy(child, built, found)\n}\n\n/** The layer of each element `serializeHTML` writes for the document, in the order they open. */\nfunction markupLayers(graph: SceneGraph, styles: StateStyles, document: DesignDocument) {\n const states = new Map<DesignElement, StateElement>()\n for (const root of document.children) drawnBy(styles.root, root, states)\n return serializedElements(document).map((element) => {\n const state = element && states.get(element)\n return (state && restLayerOf(graph, styles, state)) ?? null\n })\n}\n\n/**\n * Layers as indented HTML with a readable class per layer and one stylesheet, as the generated\n * components draw them, or with Tailwind utilities in place of the classes and no stylesheet.\n * Images are files under `assetBasePath` rather than inlined.\n */\nexport async function layerMarkup(\n graph: SceneGraph,\n layerIds: readonly string[],\n options: Pick<SceneGraphToDesignOptions, 'vectorElement'> &\n ComponentGeneratorOptions & { assetBasePath?: string } = {}\n): Promise<LayerMarkup> {\n const taken = new Set<string>()\n const html: string[] = []\n const layers: (string | null)[] = []\n const css: string[] = []\n for (const layerId of layerIds) {\n const layer = graph.getNode(layerId)\n const styles = layer && stateStyles(graph, layer, options)\n if (!layer || !styles) continue\n // Two layers named alike would share class names, and their rules would collide.\n const name = claimName(styles.name, taken, { separator: ' ' })\n const named = { ...styles, name }\n const sheet =\n options.styling === 'tailwind'\n ? { document: stateStylesToTailwind(named), css: '' }\n : await stateStylesToCSS(named)\n html.push(serializeHTML(sheet.document, { indent: true }))\n layers.push(...markupLayers(graph, named, sheet.document))\n if (sheet.css) css.push(sheet.css)\n }\n const { html: page, files } = extractImageAssets(\n html.join('\\n\\n'),\n options.assetBasePath ?? 'assets'\n )\n return { html: page, layerIds: layers, css: css.join('\\n'), images: files }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAS,YACP,OACA,KACA,UACA,OACA,OAC2B;CAC3B,MAAM,WAAW,cAAc,OAAO,GAAG;CACzC,MAAM,wBAAQ,IAAI,IAA0B;CAC5C,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,OAAO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O,OAAO,MAAM,QAAQ,CAAC;EACzD,IAAI,MAAM,KAAK,IAAI,KAAK,MAAM,GAAG;CACnC;CACA,MAAM,EAAE,MAAM,MAAM,UAAU,mBAC5B,KAAK,KAAK,MAAM,GAChB,QAAQ,iBAAiB,QAC3B;CACA,OAAO;EAAE,MAAM;EAAM,UAAU;EAAQ,KAAK,IAAI,KAAK,IAAI;EAAG,QAAQ;CAAM;AAC5E"}
|
|
1
|
+
{"version":3,"file":"layers.js","names":["drawing","propsType","ROOT_ATTRIBUTES","HEADING_STYLE","ICONIFY","iconElement","reference","drawing","designElement","bindingAttributes","shaderCanvas","IMPORT_COMPONENT","propsType"],"sources":["../../../../src/export/components/properties.ts","../../../../src/export/components/shaders.ts","../../../../src/export/components/tree.ts","../../../../src/export/components/model.ts","../../../../src/export/components/styling.ts","../../../../src/export/components/react/shared.ts","../../../../src/export/components/react/fields.ts","../../../../src/export/components/react/radix.ts","../../../../src/export/components/react/props.ts","../../../../src/export/components/react/index.ts","../../../../src/export/components/vue.ts","../../../../src/export/components/layers.ts"],"sourcesContent":["import { ownerVariants } from '#dom-css/behaviours/states/model'\nimport type { StateElement } from '#dom-css/behaviours/states/types'\nimport { camelCase } from 'es-toolkit/string'\n\nimport type { ComponentPropertyReferenceField, SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport { behaviourProperties, findLayerByPath } from '@pairdraw/scene-graph/behaviours'\n\nimport { claimName, identifierName } from '../storybook/names'\n\n/** A text property the component takes as a string prop and draws in the layers bound to it. */\nexport interface TextProp {\n /** The prop's identifier. */\n name: string\n /** The text property's id, which instances assign values by. */\n id: string\n /** The text property's name. */\n property: string\n default: string\n}\n\n/** A boolean property the component takes as a prop, showing the layers bound to it while on. */\nexport interface BooleanProp {\n /** The prop's identifier. */\n name: string\n /** The boolean property's id, which instances assign values by. */\n id: string\n /** The boolean property's name. */\n property: string\n default: boolean\n}\n\n/**\n * A slot property the component takes as content in place of the design's, which it shows\n * when none is given.\n */\nexport interface SlotProp {\n /** The prop's identifier, and the slot's name in Vue. */\n name: string\n /** The slot property's id. */\n id: string\n /** The slot property's name. */\n property: string\n}\n\n/**\n * The layers bound to a property through `field`, each with the prop it draws. A layer is\n * bound when it is in any variant, found by the path every variant shares.\n */\nfunction boundLayers(\n graph: SceneGraph,\n set: SceneNode,\n elements: readonly StateElement[],\n field: ComponentPropertyReferenceField,\n props: ReadonlyMap<string, string>\n): Map<StateElement, string> {\n const variants = ownerVariants(graph, set)\n const bound = new Map<StateElement, string>()\n for (const element of elements) {\n const path = element.key.split('\\0')[0] ?? ''\n for (const variant of variants) {\n const reference = findLayerByPath(graph, variant.id, path)?.componentPropertyReferences.find(\n (item) => item.field === field\n )\n const prop = reference && props.get(reference.propertyId)\n if (prop) {\n bound.set(element, prop)\n break\n }\n }\n }\n return bound\n}\n\nconst propName = (property: string, taken: Set<string>, fallback: string) =>\n claimName(camelCase(identifierName(property, fallback)), taken)\n\n/** The set's boolean properties as props, and the layers each shows while it is on. */\nexport function booleanProps(\n graph: SceneGraph,\n set: SceneNode,\n elements: readonly StateElement[],\n taken: Set<string>\n): { booleans: BooleanProp[]; shownBy: Map<StateElement, string> } {\n const booleans = behaviourProperties(graph, set)\n .filter((definition) => definition.type === 'BOOLEAN')\n .map((definition) => ({\n name: propName(definition.name, taken, 'Shown'),\n id: definition.id,\n property: definition.name,\n default: definition.defaultValue === 'true'\n }))\n const byId = new Map(booleans.map((prop) => [prop.id, prop.name]))\n return { booleans, shownBy: boundLayers(graph, set, elements, 'VISIBLE', byId) }\n}\n\n/**\n * The set's slot properties as props, and the frame each fills, except frames a behaviour\n * draws its parts in, such as a switch's thumb, which stay its parts.\n */\nexport function slotProps(\n graph: SceneGraph,\n set: SceneNode,\n elements: readonly StateElement[],\n taken: Set<string>,\n parts: ReadonlyMap<StateElement, string>\n): { slots: SlotProp[]; slotOf: Map<StateElement, string> } {\n const definitions = behaviourProperties(graph, set).filter(\n (definition) => definition.type === 'SLOT'\n )\n const frames = elements.filter((element) => !parts.has(element))\n const slots = definitions.map((definition) => ({\n name: propName(definition.name, taken, 'Content'),\n id: definition.id,\n property: definition.name\n }))\n const byId = new Map(slots.map((prop) => [prop.id, prop.name]))\n const slotOf = boundLayers(graph, set, frames, 'SLOT_CONTENT', byId)\n // A slot no layer draws has nowhere to show its content, so it is no prop.\n const drawn = new Set(slotOf.values())\n return { slots: slots.filter((slot) => drawn.has(slot.name)), slotOf }\n}\n\n/**\n * The set's text properties as props, and the layers bound to each. A layer is bound when it\n * is in any variant, found by the path every variant shares.\n */\nexport function textProps(\n graph: SceneGraph,\n set: SceneNode,\n elements: readonly StateElement[],\n taken: Set<string>,\n /** A field's text property, which its input shows rather than a prop. */\n input: string | undefined\n): { texts: TextProp[]; bound: Map<StateElement, string>; input: StateElement[] } {\n const definitions = behaviourProperties(graph, set).filter(\n (item) => item.type === 'TEXT' && item.id !== input\n )\n const texts = definitions.map((definition) => ({\n name: claimName(camelCase(identifierName(definition.name, 'Text')), taken),\n id: definition.id,\n property: definition.name,\n default: definition.defaultValue\n }))\n const byId = new Map(definitions.map((definition, i) => [definition.id, texts[i]]))\n const variants = ownerVariants(graph, set)\n const bound = new Map<StateElement, string>()\n const inputs: StateElement[] = []\n for (const element of elements) {\n // A key ends with the words a layer reads, which a text prop draws in every variant.\n const path = element.key.split('\\0')[0] ?? ''\n for (const variant of variants) {\n const reference = findLayerByPath(graph, variant.id, path)?.componentPropertyReferences.find(\n (item) => item.field === 'TEXT'\n )\n if (reference && reference.propertyId === input) {\n inputs.push(element)\n break\n }\n const prop = reference && byId.get(reference.propertyId)\n if (prop) {\n bound.set(element, prop.name)\n break\n }\n }\n }\n return { texts, bound, input: inputs }\n}\n","import type { StateElement } from '#dom-css/behaviours/states/types'\n\nimport { es, jsx } from '@pairdraw/emit'\nimport type { SceneGraph } from '@pairdraw/scene-graph'\nimport { findLayerByPath } from '@pairdraw/scene-graph/behaviours'\nimport {\n isShaderPresetPaint,\n shaderOfPaint,\n type ShaderComponent,\n type ShaderPreset,\n type ShaderPresetPaint\n} from '@pairdraw/scene-graph/shaders'\n\nimport { isPositioned } from '../projection'\nimport type { ComponentElement, ComponentNode } from './model'\n\n/** A shader a layer fills with, drawn by the `shaders` library behind the layer's content. */\nexport interface ShaderLayer {\n preset: ShaderPreset\n /** The readable class the shader's canvas is styled by. */\n className: string\n /** Whether the layer is positioned already, so the shader can be placed inside it. */\n positioned: boolean\n}\n\nexport function shaderLayer(\n node: StateElement,\n className: string,\n preset: ShaderPreset | undefined\n): ShaderLayer | undefined {\n if (!preset) return undefined\n const position = node.base.position\n return {\n preset,\n className: `${className}-shader`,\n positioned: isPositioned(position)\n }\n}\n\n/**\n * The shader each element's layer fills with in the rest variant: the topmost visible shader\n * fill, which the component plays behind the layer's content.\n */\nexport function shaderLayers(\n graph: SceneGraph,\n restId: string,\n elements: readonly StateElement[]\n): Map<StateElement, ShaderPreset> {\n const shaders = new Map<StateElement, ShaderPreset>()\n for (const element of elements) {\n const layer = findLayerByPath(graph, restId, element.key.split('\\0')[0] ?? '')\n if (!layer) continue\n const shader = layer.fills\n .filter((fill) => fill.visible)\n .map((fill) => shaderOfPaint(layer, fill))\n .findLast((found): found is ShaderPresetPaint => found !== null && isShaderPresetPaint(found))\n if (shader) shaders.set(element, shader.preset)\n }\n return shaders\n}\n\n/** Whether an effect's name can be imported, as every effect the library has can. */\nconst isEffectName = (type: string) => es.isIdentifierName(type)\n\n/** The effects of `components` a generated component draws: those it can import by name. */\nexport const drawnEffects = (components: readonly ShaderComponent[] | undefined) =>\n (components ?? []).filter((component) => isEffectName(component.type))\n\n/**\n * `import { Shader as ShaderCanvas, Aurora as ShaderAurora } from 'shaders/vue'`: the canvas and\n * effects a component draws, under names apart from its own.\n */\nexport function shaderImport(source: 'shaders/vue' | 'shaders/react', effects: Iterable<string>) {\n const names = ['Shader', ...[...effects].sort()]\n return {\n type: 'ImportDeclaration',\n importKind: 'value',\n specifiers: names.map((name) => ({\n type: 'ImportSpecifier',\n imported: es.identifier(name),\n local: es.identifier(name === 'Shader' ? SHADER_CANVAS : shaderEffectName(name))\n })),\n source: es.string(source)\n }\n}\n\n/** The local name a generated component imports effect `type` as, apart from its own names. */\nexport const shaderEffectName = (type: string) => `Shader${type}`\n\n/** An effect's props as JSX attributes: strings as they are, anything else as JSON. */\nexport function shaderEffectAttributes(component: ShaderComponent): es.SyntaxNode[] {\n return Object.entries(component.props ?? {}).map(([key, value]) =>\n jsx.attribute(\n key,\n typeof value === 'string' ? jsx.stringValue(value) : jsx.container(es.json(value))\n )\n )\n}\n\n/** The local name of the library's `Shader` canvas. */\nexport const SHADER_CANVAS = 'ShaderCanvas'\n\n/** The elements of a component's tree that fill with a shader. */\nexport function shaderElements(node: ComponentNode): ComponentElement[] {\n if (node.type !== 'element') return []\n return [...(node.shader ? [node] : []), ...node.children.flatMap(shaderElements)]\n}\n\n/**\n * The style that puts each shader behind its layer's content: the layer becomes its own\n * stacking context, positioned if it is not already, and the shader fills it beneath\n * everything it holds, clipped to its corners.\n */\nexport function shaderCSS(tree: ComponentElement): string {\n return shaderElements(tree)\n .flatMap(({ className, shader }) =>\n shader\n ? [\n `.${className} { isolation: isolate;${shader.positioned ? '' : ' position: relative;'} }`,\n `.${shader.className} { position: absolute; inset: 0; z-index: -1; border-radius: inherit; overflow: hidden; pointer-events: none; }`\n ]\n : []\n )\n .join('\\n')\n}\n","import type { StateElement } from '#dom-css/behaviours/states/types'\n\nimport type { ShaderPreset } from '@pairdraw/scene-graph/shaders'\n\nimport type { InputLayers } from './fields'\nimport type { ComponentBinding, ComponentElement, ComponentNode } from './model'\nimport type { UsedLayer } from './references'\nimport type { RepeatedPart } from './repeats'\nimport { shaderLayer } from './shaders'\n\n/** What each layer of the rest variant is to the component, gathered before its tree is built. */\nexport interface TreeLabels {\n parts: Map<StateElement, string>\n classes: Map<StateElement, string>\n /** The text prop each bound text layer draws, by layer. */\n texts: Map<StateElement, string>\n /** Layers that use another component or an icon in place of drawing themselves. */\n used: Map<StateElement, UsedLayer>\n /** Layers drawn once per value, such as tab triggers and panels. */\n repeated: Map<StateElement, RepeatedPart>\n /** A field's text layer, drawn as its input, and the ones it replaces. */\n input: InputLayers | null\n /** The boolean prop that shows each bound layer. */\n shownBy: Map<StateElement, string>\n /** The slot prop each slot frame shows. */\n slotOf: Map<StateElement, string>\n /** The shader each layer fills with. */\n shaders: Map<StateElement, ShaderPreset>\n /** The layer of the rest variant each element draws. */\n layerOf: (element: StateElement) => string | undefined\n}\n\nexport function componentTree(\n node: StateElement,\n labels: TreeLabels,\n bindings: ComponentBinding[]\n): ComponentElement {\n const repeated = labels.repeated.get(node)\n const layerId = labels.layerOf(node)\n const part = repeated?.part ?? labels.parts.get(node) ?? null\n const text = labels.texts.get(node)\n const className = labels.classes.get(node) ?? ''\n return {\n type: 'element',\n part,\n ...(repeated ? { value: repeated.value } : {}),\n tag: node.tagName,\n className,\n layerId,\n attrs: node.attrs,\n bindings: part === 'root' ? bindings : [],\n shownBy: labels.shownBy.get(node),\n slot: labels.slotOf.get(node),\n shader: shaderLayer(node, className, labels.shaders.get(node)),\n // A bound text layer draws its prop in place of the design's words and their runs.\n children: text\n ? [{ type: 'textProp', name: text }]\n : node.children.flatMap((child) =>\n child.type === 'text' ? [{ type: 'text', value: child.text }] : childNode(child, labels)\n )\n }\n}\n\nfunction childNode(element: StateElement, labels: TreeLabels): ComponentNode[] {\n const className = labels.classes.get(element) ?? ''\n const layerId = labels.layerOf(element)\n if (labels.input?.element === element) return [{ type: 'input', className, layerId }]\n if (labels.input?.replaced.includes(element)) return []\n const used = labels.used.get(element)\n if (!used) return [componentTree(element, labels, [])]\n return [{ ...used, className, layerId }]\n}\n","import { behaviourArgs, type BehaviourArgs } from '#dom-css/behaviours/args'\nimport { BUTTON_RESET } from '#dom-css/behaviours/reset'\nimport { allElements } from '#dom-css/behaviours/states/layers'\nimport { ownerVariants, restLayerOf, stateStyles } from '#dom-css/behaviours/states/model'\nimport { layerClassNames, propAttribute } from '#dom-css/behaviours/states/names'\nimport type { StateElement, StateStyles } from '#dom-css/behaviours/states/types'\nimport { uniq } from 'es-toolkit/array'\nimport { camelCase } from 'es-toolkit/string'\n\nimport type { ComponentPropertyDefinition, SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport {\n behaviourContract,\n behaviourProperties,\n booleanBinding,\n layerPath,\n readBehaviour,\n textBinding,\n type Behaviour\n} from '@pairdraw/scene-graph/behaviours'\nimport { variantDefaultValue } from '@pairdraw/scene-graph/components'\nimport { slotPropertyId } from '@pairdraw/scene-graph/slots'\n\nimport type { SceneGraphToDesignOptions } from '../projection'\nimport { claimName, identifierName } from '../storybook/names'\nimport {\n blockRoot,\n freePlacedParts,\n inputLayers,\n inputValue,\n numberInput,\n rangeModel,\n textModel\n} from './fields'\nimport {\n groupItems,\n GROUP_ITEMS,\n isGroup,\n type GroupKind,\n type ItemBuilder,\n type ItemKind\n} from './groups'\nimport type { IconPackage } from './icons'\nimport {\n booleanProps,\n slotProps,\n textProps,\n type BooleanProp,\n type SlotProp,\n type TextProp\n} from './properties'\nimport {\n referencedLayers,\n type ComponentReference,\n type ComponentReferences,\n type IconReference,\n type UsedLayer\n} from './references'\nimport { activeTriggers, tabParts, type ChoiceModel, type RepeatedPart } from './repeats'\nimport { shaderLayers, type ShaderLayer } from './shaders'\nimport type { ComponentStyling } from './styling'\nimport { componentTree } from './tree'\n\n/** Kinds generated as components so far; the rest keep static stories. */\nconst GENERATED_KINDS = [\n 'button',\n 'switch',\n 'checkbox',\n 'toggle',\n 'collapsible',\n 'tabs',\n 'radioGroup',\n 'toggleGroup',\n 'accordion',\n 'slider',\n 'progress',\n 'numberField',\n 'textField',\n 'textarea'\n] as const\n\n/** What a generated component is: a control on its own, or a group's item. */\n/**\n * What a generated component is: a control on its own, a group's item, or `plain`, a component\n * without a behaviour, which takes its properties as props and has no control of its own.\n */\nexport type GeneratedKind = (typeof GENERATED_KINDS)[number] | ItemKind | 'plain'\n\n/** A variant property the component takes as a prop and sets on its root as `data-*`. */\ninterface VariantProp {\n /** The prop's identifier. */\n name: string\n /** The variant property it draws, which state styles name the condition after. */\n property: string\n options: string[]\n default: string\n}\n\n/**\n * What the control's root binds, which each framework writes in its own idiom: the two-way\n * value (`v-model`, or Radix's `checked` and `onCheckedChange`), `disabled`, and a variant\n * property the component sets as a `data-*` attribute from its prop.\n */\nexport type ComponentBinding =\n | { type: 'model'; name: string }\n | { type: 'disabled' }\n /** A group's item: the value it stands for, which the group chooses among. */\n | { type: 'value' }\n | { type: 'prop'; prop: VariantProp; attribute: string }\n /** The model's choice on the variant property it draws, as the attribute that picks it. */\n | { type: 'modelProp'; name: string; attribute: string }\n\n/** A layer of the generated markup, before a framework picks its element or component. */\nexport interface ComponentElement {\n type: 'element'\n /** The behaviour part the layer draws, `root` for the control itself, or null. */\n part: string | null\n /** The element the design projects to, used when no library component draws the part. */\n tag: string\n /** The readable class the state styles select it by. */\n className: string\n /** Attributes the design sets, such as an image's `src` or its own `class`. */\n attrs: Record<string, string>\n /** On the root only. */\n bindings: ComponentBinding[]\n /** The boolean prop that shows the layer, which hides it while off. */\n shownBy?: string\n /** The slot prop whose content the layer shows in place of its own. */\n slot?: string\n /** The layer of the rest variant it draws, which code links back to. */\n layerId?: string\n /** The value a repeated part stands for, such as a tab trigger's tab. */\n value?: string\n /** The shader the layer fills with, which plays behind its content. */\n shader?: ShaderLayer\n children: ComponentNode[]\n}\n\n/** A number the component binds two ways, within its range, starting where the design does. */\nexport interface RangeModel {\n min: number\n max: number\n step: number\n default: number\n}\n\n/**\n * Text a field binds two ways: the words it starts with, and the placeholder an empty field\n * shows when the design draws one.\n */\nexport interface TextModel {\n default: string\n placeholder: string | null\n}\n\nexport type ComponentNode =\n | ComponentElement\n | { type: 'text'; value: string }\n /** The value of a text prop, drawn where the design binds a text layer to it. */\n | { type: 'textProp'; name: string }\n /** A field's input, drawn where the design binds its text layer to the field's text. */\n | { type: 'input'; className: string; layerId?: string }\n | ComponentReference\n | IconReference\n\n/**\n * Whether a field's markup always draws its input, which then takes the caller's attributes. A\n * field whose text is not bound yet has none, and an input inside a slot is replaced when the\n * caller fills the slot; the root takes the attributes then.\n */\nexport function drawsInput(node: ComponentElement): boolean {\n return node.children.some(\n (child) =>\n child.type === 'input' || (child.type === 'element' && !child.slot && drawsInput(child))\n )\n}\n\n/** One component generated from a component set with a behaviour. */\nexport interface ComponentModel {\n /** The component's identifier and file name. */\n name: string\n kind: GeneratedKind\n styles: StateStyles\n /** The markup every framework writes, with each layer's part and the root's bindings. */\n tree: ComponentElement\n /**\n * The value the component binds two ways: a boolean such as `checked`, `pressed`, or `open`,\n * or `value` when it chooses among `choice`, as tabs do.\n */\n model: string | null\n /** The options a string model takes and the one it starts on. */\n choice: ChoiceModel | null\n /** The range a number model takes, as a slider, progress bar, or number field has. */\n range: RangeModel | null\n /** The text a text field or textarea binds. */\n text: TextModel | null\n /** A group's item takes the `value` it stands for, which the group chooses among. */\n valueProp: boolean\n /** The component of a group's items, generated beside the group's own. */\n item: ComponentModel | null\n /** Whether the set draws a disabled state, so the component takes `disabled`. */\n disabled: boolean\n props: VariantProp[]\n texts: TextProp[]\n booleans: BooleanProp[]\n slots: SlotProp[]\n /** The variant properties that draw its booleans and states, which references set. */\n args: BehaviourArgs\n}\n\n/** A generated component's files, and what its stories need to know about it. */\nexport interface GeneratedComponent {\n /**\n * The component's files. A file of JSX lists the layer each of its JSX elements draws, in the\n * order they open, `null` for an element no layer drew, such as a shader's canvas.\n */\n files: { path: string; content: string; layerIds?: (string | null)[] }[]\n /** How stories import it: its path next to them, and whether it's a named export. */\n entry: { path: string; named: boolean }\n /** The prop a story sets the value with, if the component has one. */\n valueArg: string | null\n /** Whether that prop takes a list of the value, as Radix's slider does. */\n valueList?: boolean\n}\n\n/** How a generator writes a component. */\nexport interface ComponentGeneratorOptions {\n /** A stylesheet beside the component, by default, or Tailwind utilities in its markup. */\n styling?: ComponentStyling\n /** The package icons come from; Iconify by default, and for any icon the package lacks. */\n icons?: IconPackage\n}\n\nexport type ComponentGenerator = (\n component: ComponentModel,\n options?: ComponentGeneratorOptions\n) => Promise<GeneratedComponent>\n\n/** Parts each kind renders as a native button, which the reset clears for the design. */\nconst BUTTON_PARTS: Record<GeneratedKind, readonly string[]> = {\n button: ['root'],\n switch: ['root'],\n checkbox: ['root'],\n toggle: ['root'],\n collapsible: ['trigger'],\n tabs: ['trigger'],\n radioGroup: [],\n toggleGroup: [],\n accordion: [],\n slider: [],\n progress: [],\n numberField: ['increment', 'decrement'],\n textField: [],\n textarea: [],\n plain: [],\n radioGroupItem: ['root'],\n toggleGroupItem: ['root'],\n accordionItem: ['trigger']\n}\n\nconst isGenerated = (kind: Behaviour['kind']): kind is (typeof GENERATED_KINDS)[number] =>\n (GENERATED_KINDS as readonly string[]).includes(kind)\n\n/** What an owner generates as: a group's item when it is one, its own kind, or nothing. */\nfunction generatedKind(kind: Behaviour['kind'], itemOf?: GroupKind): GeneratedKind | null {\n if (itemOf) return GROUP_ITEMS[itemOf]\n return isGenerated(kind) ? kind : null\n}\n\n/** Layer paths of the slot frames that draw each part, the same in every variant. */\nfunction partPaths(graph: SceneGraph, set: SceneNode, behaviour: Behaviour): Map<string, string> {\n const partOfSlot = new Map(Object.entries(behaviour.parts).map(([part, slot]) => [slot, part]))\n const paths = new Map<string, string>()\n const visit = (variant: SceneNode, node: SceneNode) => {\n const part = partOfSlot.get(slotPropertyId(node) ?? '')\n if (part) paths.set(layerPath(graph, variant.id, node.id), part)\n for (const child of graph.getChildren(node.id)) visit(variant, child)\n }\n for (const variant of ownerVariants(graph, set))\n for (const child of graph.getChildren(variant.id)) visit(variant, child)\n return paths\n}\n\n/**\n * The component a set with a behaviour generates, or `null` when its kind is not generated\n * yet or its variants have no rest state to start from.\n */\nexport interface ComponentModelOptions extends Pick<SceneGraphToDesignOptions, 'vectorElement'> {\n /**\n * The other components generated alongside, which instances of them use rather than\n * drawing their layers.\n */\n references?: ComponentReferences\n /** The component's identifier and file name; the owner's name by default. */\n name?: string\n /** A group's item component's name; the group's name with `Item` by default. */\n itemName?: string\n /** Generate the owner as the item of a group of this kind, which only lives in the group. */\n itemOf?: GroupKind\n}\n\n/** The variant props a component takes, without the property its choice draws. */\nfunction choiceProps(\n graph: SceneGraph,\n set: SceneNode,\n args: BehaviourArgs,\n taken: Set<string>,\n choice: ComponentPropertyDefinition | undefined\n): VariantProp[] {\n taken.add(choice?.name ?? '')\n return variantProps(graph, set, args, taken).filter((prop) => prop.property !== choice?.name)\n}\n\n/** Each layer's behaviour part: the root, and the slot frames that draw the others. */\nfunction behaviourParts(\n graph: SceneGraph,\n set: SceneNode,\n behaviour: Behaviour,\n root: StateElement\n): Map<StateElement, string> {\n const paths = partPaths(graph, set, behaviour)\n const contract = behaviourContract(behaviour.kind).parts\n const parts = new Map<StateElement, string>([[root, 'root']])\n for (const element of allElements(root)) {\n const part = paths.get(element.key)\n if (part && contract.some((item) => item.id === part)) parts.set(element, part)\n }\n return parts\n}\n\n/** Clears the native button look from the parts a kind renders as buttons. */\nfunction resetButtons(\n kind: GeneratedKind,\n parts: ReadonlyMap<StateElement, string>,\n repeated: ReadonlyMap<StateElement, RepeatedPart>\n): void {\n const all = [...parts, ...[...repeated].map(([element, item]) => [element, item.part] as const)]\n for (const [element, part] of all)\n if (BUTTON_PARTS[kind].includes(part)) element.base = { ...BUTTON_RESET, ...element.base }\n}\n\n/** The variant properties that are not values or states, as props set as `data-*`. */\nfunction variantProps(\n graph: SceneGraph,\n set: SceneNode,\n args: BehaviourArgs,\n taken: Set<string>\n): VariantProp[] {\n const bound = new Set([...args.booleans.keys(), args.states?.property, args.filled?.property])\n return behaviourProperties(graph, set)\n .filter((definition) => definition.type === 'VARIANT' && !bound.has(definition.name))\n .map((definition) => ({\n name: claimName(camelCase(identifierName(definition.name, 'Prop')), taken),\n property: definition.name,\n // A document may record no options, which the variants' own values then are.\n options: uniq([\n ...(definition.variantOptions ?? []),\n ...ownerVariants(graph, set).map(\n (variant) => variant.componentPropertyValues[definition.name] ?? ''\n )\n ]).filter((option) => option !== ''),\n default: variantDefaultValue(graph, set, definition)\n }))\n}\n\n/** What the root binds: its model, an item's value, `disabled`, and its variant props. */\nfunction rootBindings(\n model: string | null,\n item: boolean,\n disabled: boolean,\n props: readonly VariantProp[],\n choice?: { name: string; attribute: string }\n): ComponentBinding[] {\n return [\n ...(model ? [{ type: 'model' as const, name: model }] : []),\n ...(model && choice\n ? [{ type: 'modelProp' as const, name: model, attribute: choice.attribute }]\n : []),\n ...(item ? [{ type: 'value' as const }] : []),\n ...(disabled ? [{ type: 'disabled' as const }] : []),\n ...props.map((prop) => ({\n type: 'prop' as const,\n prop,\n attribute: propAttribute(prop.property)\n }))\n ]\n}\n\n/**\n * A group's items, built as the group's item component; null for other owners and for a\n * group's item itself.\n */\nfunction itemsOf(\n graph: SceneGraph,\n behaviour: Behaviour,\n variantIds: readonly string[],\n parts: ReadonlyMap<StateElement, string>,\n options: ComponentModelOptions,\n build: (itemOf: GroupKind) => ItemBuilder\n): ReturnType<typeof groupItems> {\n if (options.itemOf || !isGroup(behaviour.kind)) return null\n const itemsElement = [...parts].find(([, part]) => part === 'items')?.[0]\n return groupItems(graph, variantIds, itemsElement, build(behaviour.kind))\n}\n\n/**\n * The value the component binds two ways: `value` when it chooses among options or holds a\n * number or text, its boolean such as `checked`, or none for a group's item, which its group\n * chooses.\n */\nfunction modelName(args: BehaviourArgs, item: boolean, valued: boolean): string | null {\n if (valued) return 'value'\n if (item) return null\n return [...args.booleans.values()].find((arg) => arg.name !== 'disabled')?.name ?? null\n}\n\n/** Whether the set draws a disabled look, as a boolean or an interaction state. */\nconst drawsDisabled = (args: BehaviourArgs) =>\n [...args.booleans.values()].some((arg) => arg.name === 'disabled') ||\n args.states?.disabled !== undefined\n\n/** The layers used rather than drawn: a group's items, then other generated components. */\nfunction usedLayers(\n graph: SceneGraph,\n root: StateElement,\n variantIds: readonly string[],\n items: ReadonlyMap<StateElement, UsedLayer> | undefined,\n references: ComponentReferences | undefined\n): Map<StateElement, UsedLayer> {\n const used = new Map(items)\n if (references)\n for (const [element, layer] of referencedLayers(graph, root, variantIds, references, used))\n used.set(element, layer)\n return used\n}\n\n/**\n * Sizes the design gives include a layer's padding and border, which a component's own\n * stylesheet has to say, since no page reset around it does. A root without a width hugs its\n * content, as the design draws it.\n */\nfunction borderBoxes(root: StateElement): void {\n // A root the design sizes to its content hugs it, where a block would fill its container.\n if (!Object.hasOwn(root.base, 'width')) root.base = { ...root.base, width: 'fit-content' }\n for (const element of allElements(root)) {\n const has = (property: string) => Object.hasOwn(element.base, property)\n if ((has('width') || has('height')) && !has('box-sizing'))\n element.base = { 'box-sizing': 'border-box', ...element.base }\n }\n}\n\n/**\n * Each layer's part, and tabs' triggers and panels, with the styles the generated parts need:\n * native buttons cleared, the chosen tab's look, and moving parts free of their drawn place.\n */\nfunction drawnParts(\n graph: SceneGraph,\n set: SceneNode,\n behaviour: Behaviour | null,\n kind: GeneratedKind,\n root: StateElement\n) {\n // A component without a behaviour has no parts but its root.\n const parts = behaviour\n ? behaviourParts(graph, set, behaviour, root)\n : new Map<StateElement, string>([[root, 'root']])\n const choiceBinding = behaviour?.kind === 'tabs' ? booleanBinding(behaviour, 'value') : undefined\n const choiceProperty = choiceBinding\n ? behaviourProperties(graph, set).find(\n (item) => item.id === choiceBinding.propertyId && item.type === 'VARIANT'\n )\n : undefined\n const tabs =\n behaviour?.kind === 'tabs' ? tabParts(parts, choiceProperty?.variantOptions ?? []) : null\n const repeated = tabs?.repeated ?? new Map<StateElement, RepeatedPart>()\n activeTriggers(repeated)\n resetButtons(kind, parts, repeated)\n freePlacedParts(kind, parts)\n blockRoot(kind, root)\n borderBoxes(root)\n return { parts, tabs, repeated, choiceProperty }\n}\n\n/** The number or text the component holds, and the text property a field's input shows. */\nfunction valueModels(\n graph: SceneGraph,\n set: SceneNode,\n kind: GeneratedKind,\n behaviour: Behaviour | null,\n args: BehaviourArgs\n): { range: RangeModel | null; text: TextModel | null; inputProperty: string | undefined } {\n if (!behaviour) return { range: null, text: null, inputProperty: undefined }\n const valueText = inputValue(kind)\n const inputProperty = valueText && textBinding(behaviour, valueText)\n const definition = behaviourProperties(graph, set).find((item) => item.id === inputProperty)\n return {\n range: rangeModel(kind, behaviour),\n text: textModel(kind, definition, args),\n inputProperty\n }\n}\n\nexport function componentModel(\n graph: SceneGraph,\n set: SceneNode,\n options: ComponentModelOptions = {}\n): ComponentModel | null {\n const behaviour = readBehaviour(set)\n // A component without a behaviour is plain: its properties are its props.\n const kind = behaviour ? generatedKind(behaviour.kind, options.itemOf) : 'plain'\n const styles = kind ? stateStyles(graph, set, options) : null\n const args = behaviourArgs(graph, set) ?? { booleans: new Map() }\n if (!kind || !styles) return null\n const name = options.name ?? identifierName(set.name, 'Component')\n\n const { parts, tabs, repeated, choiceProperty } = drawnParts(\n graph,\n set,\n behaviour,\n kind,\n styles.root\n )\n\n // A group's items first, so its item component is used for them rather than a standalone one.\n const variantIds = [styles.restId, ...ownerVariants(graph, set).map((variant) => variant.id)]\n const items =\n behaviour &&\n itemsOf(\n graph,\n behaviour,\n variantIds,\n parts,\n options,\n (itemOf) => (owner) =>\n componentModel(graph, owner, {\n ...options,\n name: options.itemName ?? `${name}Item`,\n itemName: undefined,\n itemOf\n })\n )\n\n const choice = tabs?.choice ?? items?.choice ?? null\n const { range, text, inputProperty } = valueModels(graph, set, kind, behaviour, args)\n const model = modelName(args, !!options.itemOf, !!(choice ?? range ?? text))\n const taken = new Set([...(model ? [model] : []), 'disabled', 'value'])\n const props = choiceProps(graph, set, args, taken, choiceProperty)\n const disabled = drawsDisabled(args)\n const used = usedLayers(graph, styles.root, variantIds, items?.used, options.references)\n const elements = allElements(styles.root)\n const texts = textProps(graph, set, elements, taken, inputProperty)\n const input = inputLayers(texts.input)\n numberInput(input, range)\n const { booleans, shownBy } = booleanProps(graph, set, elements, taken)\n const { slots, slotOf } = slotProps(graph, set, elements, taken, parts)\n return {\n name,\n kind,\n styles,\n tree: componentTree(\n styles.root,\n {\n parts,\n classes: layerClassNames(styles),\n texts: texts.bound,\n used,\n repeated,\n input,\n shownBy,\n slotOf,\n shaders: shaderLayers(graph, styles.restId, elements),\n layerOf: (element) => restLayerOf(graph, styles, element)\n },\n rootBindings(\n model,\n !!options.itemOf,\n disabled,\n props,\n choiceProperty && {\n name: choiceProperty.name,\n attribute: propAttribute(choiceProperty.name)\n }\n )\n ),\n model,\n choice,\n range,\n text,\n valueProp: !!options.itemOf,\n item: items?.item ?? null,\n disabled,\n props,\n texts: texts.texts,\n booleans,\n slots,\n args\n }\n}\n","import { layerClassNames } from '#dom-css/behaviours/states/names'\nimport { stateTailwindClasses } from '#dom-css/behaviours/states/tailwind'\n\nimport type { ComponentModel } from './model'\nimport { shaderElements } from './shaders'\n\n/** How a generated component is styled: a stylesheet, or Tailwind utilities in its markup. */\nexport const COMPONENT_STYLINGS = ['css', 'tailwind'] as const\nexport type ComponentStyling = (typeof COMPONENT_STYLINGS)[number]\n\n/** Where a layer's shader plays: filling the layer, beneath its content, inside its corners. */\nexport const SHADER_UTILITIES = 'pointer-events-none absolute inset-0 -z-10 rounded-[inherit]'\n\n/**\n * The class each of a component's readable class names stands for. Styled with a stylesheet, a\n * class is itself; with Tailwind it is the layer's utilities, its states behind their variants,\n * and a shader canvas's placement.\n */\nexport function componentClasses(\n component: ComponentModel,\n styling: ComponentStyling\n): (className: string) => string {\n if (styling === 'css') return (className) => className\n const readable = layerClassNames(component.styles)\n const utilities = stateTailwindClasses(component.styles)\n const byClass = new Map<string, string>()\n for (const [element, className] of readable) byClass.set(className, utilities.get(element) ?? '')\n for (const { shader } of shaderElements(component.tree))\n if (shader) byClass.set(shader.className, SHADER_UTILITIES)\n return (className) => byClass.get(className) ?? className\n}\n","import { es, jsx } from '@pairdraw/emit'\n\nimport type { IconDrawing, IconImport, IconPackage } from '../icons'\nimport type { ComponentModel, GeneratedKind } from '../model'\n\n/** `styles.thumb`, or `styles['switch-thumb']` for a class that isn't an identifier. */\nexport function moduleClass(className: string): es.SyntaxNode {\n return {\n type: 'MemberExpression',\n object: es.identifier('styles'),\n property: es.isIdentifierName(className) ? es.identifier(className) : es.string(className),\n computed: !es.isIdentifierName(className),\n optional: false\n }\n}\n\n/** What a component's markup uses, which its module imports. */\nexport interface MarkupUses {\n component: ComponentModel\n kind: GeneratedKind\n choice: ComponentModel['choice']\n /** Other generated components. */\n components: Set<string>\n /** Whether an icon is drawn by Iconify. */\n icons: boolean\n /** The package icons come from, and what the icons drawn from it import. */\n iconPackage: IconPackage\n iconImports: IconImport[]\n /** Names an icon's imports apart from the component's other names. */\n nameIcon: (drawing: IconDrawing) => IconDrawing\n /** A layer's class as the component is styled: its CSS module class, or its utilities. */\n classOf: (className: string) => es.SyntaxNode\n /** The layer each JSX element draws, which code links back to. */\n layers: WeakMap<es.SyntaxNode, string>\n /** Effects of the `shaders` library its layers fill with. */\n shaders: Set<string>\n}\n\nexport const numeric = (name: string, value: number) =>\n jsx.attribute(name, jsx.container(es.number(value)))\n\n/** A `className` value: a plain string as an attribute string, anything else in braces. */\nexport function classValue(value: es.SyntaxNode): es.SyntaxNode {\n return value.type === 'Literal' && typeof value.value === 'string'\n ? jsx.stringValue(value.value)\n : jsx.container(value)\n}\n\n/** `element`, recorded as drawing `layerId`, so code can link back to that layer. */\nexport function drawing(\n element: es.SyntaxNode,\n layerId: string | undefined,\n uses: MarkupUses\n): es.SyntaxNode {\n if (layerId) uses.layers.set(element, layerId)\n return element\n}\n\n/** The layer of each JSX element in `program`, in the order the elements open. */\nexport function elementLayers(\n program: es.SyntaxNode,\n layers: WeakMap<es.SyntaxNode, string>\n): (string | null)[] {\n const found: (string | null)[] = []\n const visit = (value: unknown) => {\n if (Array.isArray(value)) {\n for (const item of value) visit(item)\n return\n }\n if (!es.isNode(value)) return\n if (value.type === 'JSXElement') found.push(layers.get(value) ?? null)\n for (const item of Object.values(value)) visit(item)\n }\n visit(program)\n return found\n}\n","import dedent from 'dedent'\n\nimport { es, jsx } from '@pairdraw/emit'\n\nimport { progressWidth } from '../fields'\nimport type { ComponentElement, ComponentModel, GeneratedKind } from '../model'\nimport { classValue, numeric, type MarkupUses } from './shared'\n\n/** Kinds whose native input takes the caller's props, rather than their root. */\nexport const INPUT_PROPS: Partial<Record<GeneratedKind, 'input' | 'textarea'>> = {\n textField: 'input',\n textarea: 'textarea'\n}\n\n/** A number field's stepper parts, which change its value by a step. */\nexport const STEPPERS: Record<string, { label: string; sign: '+' | '-' }> = {\n increment: { label: 'Increase', sign: '+' },\n decrement: { label: 'Decrease', sign: '-' }\n}\n\n/** What a part of a native or measured control needs: a stepper's step, an indicator's width. */\nexport function partAttributes(node: ComponentElement, uses: MarkupUses): es.SyntaxNode[] {\n const { range } = uses.component\n if (!range || !node.part) return []\n if (uses.kind === 'progress' && node.part === 'indicator') {\n const style = progressWidth(range, es.identifier('value'))\n return style ? [jsx.attribute('style', jsx.container(style))] : []\n }\n const stepper = uses.kind === 'numberField' ? STEPPERS[node.part] : undefined\n if (!stepper) return []\n return [\n jsx.attribute('aria-label', jsx.stringValue(stepper.label)),\n jsx.attribute('disabled', jsx.container(es.identifier('disabled'))),\n jsx.attribute(\n 'onClick',\n jsx.container(es.parseExpression(`() => commit(value ${stepper.sign} ${String(range.step)})`))\n )\n ]\n}\n\nconst NUMBER_INPUT = [\n ['type', jsx.stringValue('number')],\n ['value', jsx.container(es.parseExpression(\"Number.isNaN(value) ? '' : value\"))],\n [\n 'onChange',\n jsx.container(es.parseExpression('(event) => setValue(event.target.valueAsNumber)'))\n ],\n ['onBlur', jsx.container(es.parseExpression('() => commit(value)'))]\n] as const\n\n/** A field's input: a number input that commits within its range, or the input or textarea. */\nexport function inputElement(className: string, uses: MarkupUses, depth: number): es.SyntaxNode {\n const { component } = uses\n const classAttribute = jsx.attribute('className', classValue(uses.classOf(className)))\n const { range } = component\n if (range)\n return jsx.element(\n 'input',\n [\n ...NUMBER_INPUT.map(([name, value]) => jsx.attribute(name, value)),\n numeric('min', range.min),\n numeric('max', range.max),\n numeric('step', range.step),\n jsx.attribute('disabled', jsx.container(es.identifier('disabled'))),\n classAttribute\n ],\n [],\n depth\n )\n const start = component.text?.default\n const placeholder = component.text?.placeholder\n return jsx.element(\n INPUT_PROPS[uses.kind] ?? 'input',\n [\n ...(placeholder ? [jsx.attribute('placeholder', jsx.stringValue(placeholder))] : []),\n ...(start ? [jsx.attribute('defaultValue', jsx.stringValue(start))] : []),\n // The input takes the caller's props, such as `name` or `onChange`.\n jsx.spread(es.identifier('props')),\n classAttribute\n ],\n [],\n depth\n )\n}\n\n/** A destructured prop, with the default it takes when the caller leaves it out. */\nexport interface Parameter {\n name: string\n default?: es.SyntaxNode\n}\n\n/** Props a kind reads itself: a progress bar's value, a number field's start and changes. */\nexport function kindParameters(component: ComponentModel): Parameter[] {\n const { range } = component\n if (component.kind === 'progress' && range)\n return [{ name: 'value', default: es.number(range.default) }]\n if (component.kind === 'numberField' && range)\n return [\n { name: 'defaultValue', default: es.number(range.default) },\n { name: 'onValueChange' },\n { name: 'disabled' }\n ]\n return []\n}\n\n/**\n * A number field's value: typed freely, and settled within its range when it loses focus or a\n * stepper moves it, which is when the caller hears of it.\n */\nexport const NUMBER_STATE = (range: { min: number; max: number }) =>\n es.fill(\n es.parseModule(dedent`\n const [value, setValue] = useState(defaultValue)\n const commit = (next: number) => {\n const settled = Number.isNaN(next) ? $min : Math.min($max, Math.max($min, next))\n setValue(settled)\n onValueChange?.(settled)\n }\n `),\n { $min: es.number(range.min), $max: es.number(range.max) }\n ).body\n\n/** The component function's statements before it returns, such as a number field's state. */\nexport function prepend(declaration: es.SyntaxNode | undefined, statements: es.SyntaxNode[]): void {\n const fn = es.child(declaration, 'declaration')\n const body = es.child(fn, 'body')\n if (!body || statements.length === 0) return\n body.body = [...statements, ...es.children(body, 'body')]\n}\n","import { upperFirst } from 'es-toolkit/string'\n\nimport type { GeneratedKind } from '../model'\n\n/**\n * The Radix primitive a kind renders, from the unified `radix-ui` package, and the component\n * of it each part uses. Its root takes the value two ways (`checked` and `onCheckedChange`,\n * `pressed`, `open`) and `disabled` itself, so the generated props extend the root's.\n */\nexport const RADIX: Record<\n GeneratedKind,\n { namespace: string; parts: Record<string, string> } | null\n> = {\n button: null,\n switch: { namespace: 'Switch', parts: { root: 'Root', thumb: 'Thumb' } },\n checkbox: { namespace: 'Checkbox', parts: { root: 'Root', indicator: 'Indicator' } },\n toggle: { namespace: 'Toggle', parts: { root: 'Root' } },\n collapsible: {\n namespace: 'Collapsible',\n parts: { root: 'Root', trigger: 'Trigger', content: 'Content' }\n },\n tabs: {\n namespace: 'Tabs',\n parts: { root: 'Root', list: 'List', trigger: 'Trigger', content: 'Content' }\n },\n radioGroup: { namespace: 'RadioGroup', parts: { root: 'Root' } },\n toggleGroup: { namespace: 'ToggleGroup', parts: { root: 'Root' } },\n accordion: { namespace: 'Accordion', parts: { root: 'Root' } },\n radioGroupItem: { namespace: 'RadioGroup', parts: { root: 'Item', indicator: 'Indicator' } },\n toggleGroupItem: { namespace: 'ToggleGroup', parts: { root: 'Item' } },\n accordionItem: {\n namespace: 'Accordion',\n parts: { root: 'Item', trigger: 'Trigger', content: 'Content' }\n },\n slider: {\n namespace: 'Slider',\n parts: { root: 'Root', track: 'Track', range: 'Range', thumb: 'Thumb' }\n },\n progress: { namespace: 'Progress', parts: { root: 'Root', indicator: 'Indicator' } },\n // Radix has no number or text field; these are native inputs in the design's own elements.\n numberField: null,\n textField: null,\n textarea: null,\n // A component without a behaviour is the design's own elements.\n plain: null\n}\n\n/** The local name a Radix namespace is imported as, such as `SwitchPrimitive`. */\nexport const PRIMITIVE = (namespace: string) => `${namespace}Primitive`\n\n/** `defaultChecked`: Radix's uncontrolled value, which a nested control starts from. */\nexport const defaultOf = (model: string) => `default${upperFirst(model)}`\n","import { es } from '@pairdraw/emit'\n\nimport type { ComponentModel, GeneratedComponent, GeneratedKind } from '../model'\nimport { kindParameters, type Parameter } from './fields'\nimport { defaultOf, PRIMITIVE, RADIX } from './radix'\n\n/**\n * The props of a group that fixes one choice at a time, without the `type` it fixes. The\n * root's own props join the single and multiple choice, which a single value can't satisfy.\n */\nexport const SINGLE_PROPS: Partial<Record<GeneratedKind, string>> = {\n toggleGroup: 'ToggleGroupSingleProps',\n accordion: 'AccordionSingleProps'\n}\n\nconst qualified = (namespace: string, name: string) => ({\n type: 'TSQualifiedName',\n left: es.identifier(PRIMITIVE(namespace)),\n right: es.identifier(name)\n})\n\n/** Props a kind declares itself, where no Radix root has them. */\nconst OWN_PROPS: Partial<Record<GeneratedKind, string>> = {\n progress: \"Omit<ComponentProps<typeof ProgressPrimitive.Root>, 'value'> & { value?: number }\",\n numberField:\n \"Omit<ComponentProps<'div'>, 'defaultValue' | 'onChange'> & { defaultValue?: number; onValueChange?: (value: number) => void; disabled?: boolean }\",\n textField: \"ComponentProps<'input'>\",\n textarea: \"ComponentProps<'textarea'>\"\n}\n\n/** The root's own props, or a single choice group's. */\nfunction rootPropsType(kind: GeneratedKind, tag: string): es.SyntaxNode {\n const own = OWN_PROPS[kind]\n if (own) return es.parseType(own)\n // A component without a behaviour takes its root element's props.\n if (kind === 'plain') return es.parseType(`ComponentProps<'${tag}'>`)\n const radix = RADIX[kind]\n if (!radix) return es.parseType(\"ComponentProps<'button'>\")\n const single = SINGLE_PROPS[kind]\n if (single)\n return es.fill(es.parseType(\"Omit<$Props, 'type'>\"), {\n $Props: qualified(radix.namespace, single)\n })\n return es.fill(es.parseType('ComponentProps<typeof $Root>'), {\n $Root: qualified(radix.namespace, radix.parts.root)\n })\n}\n\n/** The root's own props, extended with the component's variant props when it has any. */\nexport function propsType(component: ComponentModel): es.SyntaxNode {\n const base = rootPropsType(component.kind, component.tree.tag)\n const own = [component.props, component.texts, component.booleans, component.slots]\n if (own.every((list) => list.length === 0)) return base\n return {\n type: 'TSIntersectionType',\n types: [\n base,\n es.objectType([\n ...component.props.map((prop): [string, es.SyntaxNode, boolean] => [\n prop.name,\n es.stringUnionType(prop.options),\n true\n ]),\n ...component.texts.map((text): [string, es.SyntaxNode, boolean] => [\n text.name,\n es.parseType('string'),\n true\n ]),\n ...component.booleans.map((prop): [string, es.SyntaxNode, boolean] => [\n prop.name,\n es.parseType('boolean'),\n true\n ]),\n ...component.slots.map((slot): [string, es.SyntaxNode, boolean] => [\n slot.name,\n es.parseType('ReactNode'),\n true\n ])\n ])\n ]\n }\n}\n\n/**\n * `{ size = 'Small', label = 'Save', ...props }`: variant and text props with their defaults,\n * kept off the root, and the rest passed on.\n */\nexport function parameters(component: ComponentModel): es.SyntaxNode {\n const own: Parameter[] = [\n ...kindParameters(component),\n ...[...component.props, ...component.texts].map((prop) => ({\n name: prop.name,\n default: es.string(prop.default)\n })),\n ...component.booleans.map((prop) => ({\n name: prop.name,\n default: es.parseExpression(String(prop.default))\n })),\n // Slots are kept off the root too, which would otherwise get them as attributes.\n ...component.slots.map((slot) => ({ name: slot.name }))\n ]\n if (own.length === 0) return es.identifier('props')\n return {\n type: 'ObjectPattern',\n properties: [\n ...own.map((prop) => ({\n type: 'Property',\n kind: 'init',\n key: es.identifier(prop.name),\n value: prop.default\n ? { type: 'AssignmentPattern', left: es.identifier(prop.name), right: prop.default }\n : es.identifier(prop.name),\n computed: false,\n method: false,\n shorthand: true\n })),\n { type: 'RestElement', argument: es.identifier('props') }\n ]\n }\n}\n\n/**\n * `import { useState, type ComponentProps, type ReactNode } from 'react'` with only what the\n * component uses: a number field's state, its root's props, and its slots' content.\n */\nexport function reactImport(uses: {\n state: boolean\n props: boolean\n slots: boolean\n}): es.SyntaxNode[] {\n const types = [...(uses.props ? ['ComponentProps'] : []), ...(uses.slots ? ['ReactNode'] : [])]\n if (!uses.state && types.length === 0) return []\n const specifiers = uses.state\n ? ['useState', ...types.map((name) => `type ${name}`)].join(', ')\n : types.join(', ')\n return es.parseModule(`import ${uses.state ? '' : 'type '}{ ${specifiers} } from 'react'`).body\n}\n\n/**\n * The prop a story sets the value with: Radix's uncontrolled value, so a story's control and\n * its play function can both change it, which a slider takes as a list; a progress bar's own\n * value, which nothing else changes.\n */\nexport function valueArg(\n kind: GeneratedKind,\n model: string | null\n): Pick<GeneratedComponent, 'valueArg' | 'valueList'> {\n if (!model) return { valueArg: null }\n if (kind === 'progress') return { valueArg: 'value' }\n return { valueArg: defaultOf(model), ...(kind === 'slider' ? { valueList: true } : {}) }\n}\n","import { HEADING_RESET } from '#dom-css/behaviours/reset'\nimport { stateStylesToCSS } from '#dom-css/behaviours/states/css'\nimport dedent from 'dedent'\nimport { compact } from 'es-toolkit/array'\nimport { omit } from 'es-toolkit/object'\nimport { camelCase } from 'es-toolkit/string'\n\nimport { es, jsx } from '@pairdraw/emit'\nimport type { ShaderComponent } from '@pairdraw/scene-graph/shaders'\n\nimport { drawingImports, iconDrawing, iconImportDeclarations, iconNamer } from '../icons'\nimport type { ComponentElement, ComponentGenerator, ComponentNode, GeneratedKind } from '../model'\nimport type { ComponentReference, IconReference } from '../references'\nimport {\n drawnEffects,\n SHADER_CANVAS,\n shaderCSS,\n shaderEffectAttributes,\n shaderEffectName,\n shaderImport,\n type ShaderLayer\n} from '../shaders'\nimport { componentClasses } from '../styling'\nimport {\n INPUT_PROPS,\n inputElement,\n NUMBER_STATE,\n partAttributes,\n prepend,\n STEPPERS\n} from './fields'\nimport { parameters, propsType, reactImport, SINGLE_PROPS, valueArg } from './props'\nimport { defaultOf, PRIMITIVE, RADIX } from './radix'\nimport { classValue, drawing, elementLayers, moduleClass, numeric, type MarkupUses } from './shared'\n\n/** What a group's root fixes: one item chosen at a time, and an accordion that can all close. */\nconst ROOT_ATTRIBUTES: Partial<Record<GeneratedKind, es.SyntaxNode[]>> = {\n toggleGroup: [jsx.attribute('type', jsx.stringValue('single'))],\n accordion: [jsx.attribute('type', jsx.stringValue('single')), jsx.attribute('collapsible', null)]\n}\n\nconst HEADING_STYLE = jsx.container(\n es.object(\n Object.entries(HEADING_RESET).map(\n ([property, value]) => [camelCase(property), es.string(value)] as const\n )\n )\n)\n\n/** Several classes on one element, skipping a caller's that is absent. */\nconst CLASS_NAMES = es.parseExpression(\"$classes.filter(Boolean).join(' ')\")\n\n/** Whether a layer renders as a native button: a button's root, or a number field's stepper. */\nconst isNativeButton = (node: ComponentElement, kind: GeneratedKind) =>\n (kind === 'button' && node.part === 'root') ||\n (kind === 'numberField' && node.part !== null && Object.hasOwn(STEPPERS, node.part))\n\n/** A Radix primitive's part, a native button, or the design's tag. */\nfunction tagOf(node: ComponentElement, kind: GeneratedKind): string {\n const radix = RADIX[kind]\n const part = node.part ? radix?.parts[node.part] : undefined\n if (radix && part) return `${PRIMITIVE(radix.namespace)}.${part}`\n return isNativeButton(node, kind) ? 'button' : node.tag\n}\n\n/** `disabled || undefined`, so a native root sets `data-disabled` only while disabled. */\nconst disabledFlag = (kind: GeneratedKind) =>\n es.parseExpression(\n kind === 'numberField' ? 'disabled || undefined' : 'props.disabled || undefined'\n )\n\n/** The Iconify component, named apart from any component the design calls `Icon`. */\nconst ICONIFY = 'IconifyIcon'\n\n/** An icon: its package's own component where it has the icon, Iconify's otherwise. */\nfunction iconElement(node: IconReference, uses: MarkupUses, depth: number): es.SyntaxNode {\n const className = jsx.attribute('className', classValue(uses.classOf(node.className)))\n const found = iconDrawing(node.icon, uses.iconPackage, 'react')\n const drawn = found && uses.nameIcon(found)\n if (!drawn) {\n uses.icons = true\n return jsx.element(\n ICONIFY,\n [jsx.attribute('icon', jsx.stringValue(node.icon)), className],\n [],\n depth\n )\n }\n uses.iconImports.push(...drawingImports(drawn))\n if (drawn.type === 'component') return jsx.element(drawn.import.local, [className], [], depth)\n return jsx.element(\n drawn.component.local,\n [jsx.attribute('icon', jsx.container(es.identifier(drawn.import.local))), className],\n [],\n depth\n )\n}\n\n/** A reference's prop value: a bare name for true, `{false}`, or a string. */\nfunction referenceValue(value: string | boolean): es.SyntaxNode | null {\n if (value === true) return null\n if (value === false) return jsx.container(jsx.literal(false))\n return jsx.stringValue(value)\n}\n\nfunction reference(node: ComponentReference, uses: MarkupUses, depth: number): es.SyntaxNode {\n uses.components.add(node.component)\n return drawing(\n jsx.element(\n node.component,\n [\n jsx.attribute('className', classValue(uses.classOf(node.className))),\n ...node.props.map((prop) => jsx.attribute(prop.name, referenceValue(prop.value))),\n ...(node.model ? [jsx.attribute(defaultOf(node.model), null)] : [])\n ],\n [],\n depth\n ),\n node.layerId,\n uses\n )\n}\n\nfunction element(node: ComponentNode, uses: MarkupUses, depth: number): es.SyntaxNode {\n if (node.type === 'text') return jsx.text(node.value)\n if (node.type === 'textProp') return jsx.container(es.identifier(node.name))\n if (node.type === 'reference') return reference(node, uses, depth)\n if (node.type === 'input')\n return drawing(inputElement(node.className, uses, depth), node.layerId, uses)\n if (node.type === 'icon') return drawing(iconElement(node, uses, depth), node.layerId, uses)\n return designElement(node, uses, depth)\n}\n\n/**\n * The design's own classes, the state styles' module class, and on the root the caller's,\n * which the spread would otherwise lose to the generated one.\n */\nfunction classNameOf(node: ComponentElement, root: boolean, uses: MarkupUses): es.SyntaxNode {\n const classes = [\n ...(node.attrs.class ? [es.string(node.attrs.class)] : []),\n uses.classOf(node.className),\n ...(root ? [es.parseExpression('props.className')] : [])\n ]\n const only = classes.length === 1 ? classes.at(0) : undefined\n return only ?? es.fill(CLASS_NAMES, { $classes: es.array(classes) })\n}\n\n/**\n * What a root fixes before the caller's props: a group's single choice and its start, and a\n * slider's or progress bar's range and the value it starts at.\n */\nfunction rootAttributes(uses: MarkupUses): es.SyntaxNode[] {\n const { component } = uses\n const start = uses.choice?.default\n const { range } = component\n return [\n ...(ROOT_ATTRIBUTES[uses.kind] ?? []),\n // A choice starts on the design's option, which the caller's props can change.\n ...(start ? [jsx.attribute('defaultValue', jsx.stringValue(start))] : []),\n ...(range && uses.kind === 'slider'\n ? [\n jsx.attribute('defaultValue', jsx.container(es.array([es.number(range.default)]))),\n numeric('min', range.min),\n numeric('max', range.max),\n numeric('step', range.step)\n ]\n : []),\n ...(range && uses.kind === 'progress'\n ? [\n // Radix takes a value within its range, as the indicator draws one.\n jsx.attribute(\n 'value',\n jsx.container(\n es.fill(es.parseExpression('Math.min($max, Math.max($min, value))'), {\n $min: es.number(range.min),\n $max: es.number(range.max)\n })\n )\n ),\n numeric('max', range.max)\n ]\n : [])\n ]\n}\n\nfunction bindingAttributes(\n node: ComponentElement,\n kind: GeneratedKind,\n native: boolean\n): es.SyntaxNode[] {\n return node.bindings.flatMap((binding) => {\n if (binding.type === 'prop')\n return [jsx.attribute(binding.attribute, jsx.container(es.identifier(binding.prop.name)))]\n if (binding.type === 'modelProp')\n return [\n jsx.attribute(binding.attribute, jsx.container(es.parseExpression(`props.${binding.name}`)))\n ]\n // Radix sets `data-disabled` on its own roots; a native root needs it for the styles.\n if (binding.type === 'disabled' && native)\n return [jsx.attribute('data-disabled', jsx.container(disabledFlag(kind)))]\n return []\n })\n}\n\n/** A shader playing behind its layer's content, with telemetry off, as every export has it. */\nfunction shaderCanvas(shader: ShaderLayer, uses: MarkupUses, depth: number): es.SyntaxNode {\n const effect =\n (at: number) =>\n (component: ShaderComponent): es.SyntaxNode => {\n uses.shaders.add(component.type)\n const children = drawnEffects(component.children).map(effect(at + 1))\n return jsx.element(\n shaderEffectName(component.type),\n shaderEffectAttributes(component),\n children,\n at\n )\n }\n return jsx.element(\n SHADER_CANVAS,\n [\n jsx.attribute('className', classValue(uses.classOf(shader.className))),\n jsx.attribute('disableTelemetry', null)\n ],\n drawnEffects(shader.preset.components).map(effect(depth + 1)),\n depth\n )\n}\n\n/** Words alone stay on the element's line, where a line break would add a space. */\nfunction wordsOnly(node: ComponentElement): boolean {\n const only = node.children.length === 1 ? node.children[0]?.type : undefined\n return !node.slot && !node.shader && (only === 'text' || only === 'textProp')\n}\n\nfunction designElement(node: ComponentElement, uses: MarkupUses, depth: number): es.SyntaxNode {\n const kind = uses.kind\n const root = node.part === 'root'\n const native = root && !(node.part && RADIX[kind]?.parts[node.part])\n const attributes = [\n ...(isNativeButton(node, kind) ? [jsx.attribute('type', jsx.stringValue('button'))] : []),\n ...(root ? rootAttributes(uses) : []),\n // The root passes the caller's props on, such as `checked` or `onClick`, unless its input\n // takes them.\n ...(root && !INPUT_PROPS[kind] ? [jsx.spread(es.identifier('props'))] : []),\n ...(node.value === undefined ? [] : [jsx.attribute('value', jsx.stringValue(node.value))]),\n ...Object.entries(omit(node.attrs, ['class'])).map(([name, value]) =>\n jsx.attribute(name, jsx.stringValue(value))\n ),\n ...partAttributes(node, uses),\n jsx.attribute('className', classValue(classNameOf(node, root, uses))),\n ...bindingAttributes(node, kind, native)\n ]\n const inline = wordsOnly(node)\n // Radix puts an accordion item's trigger in a header, which carries the heading level.\n const header = kind === 'accordionItem' && node.part === 'trigger'\n const childDepth = depth + (header ? 2 : 1)\n const content = node.children.map((child) => element(child, uses, childDepth))\n const shader = node.shader ? [shaderCanvas(node.shader, uses, childDepth)] : []\n const drawn = drawing(\n jsx.element(\n tagOf(node, kind),\n attributes,\n [...shader, ...(node.slot ? [slotContent(node.slot, content, childDepth)] : content)],\n depth + (header ? 1 : 0),\n inline\n ),\n node.layerId,\n uses\n )\n const shown = header\n ? jsx.element(\n `${PRIMITIVE('Accordion')}.Header`,\n [jsx.attribute('style', HEADING_STYLE)],\n [drawn],\n depth\n )\n : drawn\n return node.shownBy ? whenShown(node.shownBy, shown) : shown\n}\n\nconst LOGICAL = (operator: '&&' | '??', left: es.SyntaxNode, right: es.SyntaxNode) => ({\n type: 'LogicalExpression',\n operator,\n left,\n right\n})\n\n/** `{content ?? <>…</>}`: what the caller passes for a slot, or the design's content. */\nfunction slotContent(slot: string, children: es.SyntaxNode[], depth: number): es.SyntaxNode {\n return jsx.container(LOGICAL('??', es.identifier(slot), jsx.fragment(children, depth)))\n}\n\n/** `{showIcon && <…/>}`: a layer a boolean prop shows. */\nfunction whenShown(prop: string, drawn: es.SyntaxNode): es.SyntaxNode {\n return jsx.container(LOGICAL('&&', es.identifier(prop), drawn))\n}\n\nconst MODULE = es.parseModule(dedent`\n import type { ComponentProps } from 'react'\n\n import styles from '$styles'\n\n export type $Props = $Type\n\n export function $Name($params: $Props) {\n return $body\n }\n`)\n\nconst RADIX_IMPORT = es.parseModule(`import { $Namespace as $Primitive } from 'radix-ui'`)\nconst ICONIFY_IMPORT = es.parseModule(`import { Icon as ${ICONIFY} } from '@iconify/react'`).body\nconst IMPORT_COMPONENT = es.parseModule(`import { $Component } from '$path'`)\n\n/**\n * A component as a React component on Radix UI: its parts as Radix primitives from the\n * `radix-ui` package, its variants' state styles in a CSS module, and props that extend the\n * Radix root's with its other variant properties.\n */\nexport const reactComponent: ComponentGenerator = async (component, options = {}) => {\n const styling = options.styling ?? 'css'\n const radix = RADIX[component.kind]\n const stylesPath = `${component.name}.module.css`\n const classOf = componentClasses(component, styling)\n const uses: MarkupUses = {\n component,\n // Styled with Tailwind, a layer's utilities are written out; otherwise its module class.\n classOf: (className) =>\n styling === 'css' ? moduleClass(className) : es.string(classOf(className)),\n kind: component.kind,\n choice: component.choice,\n components: new Set(),\n layers: new WeakMap(),\n icons: false,\n iconPackage: options.icons ?? 'iconify',\n iconImports: [],\n nameIcon: iconNamer(component, [\n ICONIFY,\n 'styles',\n `${component.name}Props`,\n ...(radix ? [radix.namespace, PRIMITIVE(radix.namespace)] : [])\n ]),\n shaders: new Set()\n }\n const body = element(component.tree, uses, 1)\n const imports = [\n ...(uses.icons ? ICONIFY_IMPORT : []),\n ...iconImportDeclarations(uses.iconImports),\n ...(uses.shaders.size > 0 ? [shaderImport('shaders/react', uses.shaders)] : []),\n ...(radix\n ? es.fill(RADIX_IMPORT, {\n $Namespace: es.identifier(radix.namespace),\n $Primitive: es.identifier(PRIMITIVE(radix.namespace))\n }).body\n : []),\n ...[...uses.components].sort().flatMap(\n (name) =>\n es.fill(IMPORT_COMPONENT, {\n $Component: es.identifier(name),\n $path: es.string(`./${name}`)\n }).body\n )\n ]\n const [, stylesImport, ...rest] = es.fill(MODULE, {\n $styles: es.string(`./${stylesPath}`),\n $Props: es.identifier(`${component.name}Props`),\n $Type: propsType(component),\n $Name: es.identifier(component.name),\n $params: parameters(component),\n $body: body\n }).body\n const state =\n component.kind === 'numberField' && component.range ? NUMBER_STATE(component.range) : []\n prepend(rest.at(-1), state)\n const react = reactImport({\n state: state.length > 0,\n // A single choice group's props come from Radix's own type, not `ComponentProps`.\n props: !SINGLE_PROPS[component.kind],\n slots: component.slots.length > 0\n })\n const program = {\n type: 'Program',\n sourceType: 'module',\n body: [...react, ...imports, ...(styling === 'css' ? [stylesImport] : []), ...rest]\n }\n // Tailwind styles the markup itself; a CSS module is written beside it otherwise.\n const stylesheet =\n styling === 'css'\n ? [\n {\n path: stylesPath,\n content: compact([\n (await stateStylesToCSS(component.styles)).css,\n shaderCSS(component.tree)\n ]).join('\\n')\n }\n ]\n : []\n const model = component.model\n // A group's items are their own component, which the group's markup uses.\n const item = component.item ? await reactComponent(component.item, options) : null\n return {\n files: [\n ...(item?.files ?? []),\n {\n path: `${component.name}.tsx`,\n content: `${jsx.printModule(program)}\\n`,\n // The template is filled with copies, so the body, which holds all the JSX, is read.\n layerIds: elementLayers(body, uses.layers)\n },\n ...stylesheet\n ],\n entry: { path: `./${component.name}`, named: true },\n ...valueArg(component.kind, model)\n }\n}\n","import { HEADING_RESET } from '#dom-css/behaviours/reset'\nimport { stateStylesToCSS } from '#dom-css/behaviours/states/css'\nimport dedent from 'dedent'\nimport { compact } from 'es-toolkit/array'\nimport { omit } from 'es-toolkit/object'\nimport { camelCase, kebabCase, upperFirst } from 'es-toolkit/string'\n\nimport { es, vue } from '@pairdraw/emit'\nimport type { ShaderComponent } from '@pairdraw/scene-graph/shaders'\n\nimport { claimName } from '../storybook/names'\nimport { progressWidth } from './fields'\nimport {\n drawingImports,\n iconDrawing,\n iconImportDeclarations,\n iconNamer,\n type IconDrawing,\n type IconImport,\n type IconPackage\n} from './icons'\nimport {\n drawsInput,\n type ComponentBinding,\n type ComponentElement,\n type ComponentGenerator,\n type ComponentModel,\n type ComponentNode,\n type GeneratedKind\n} from './model'\nimport type { ComponentReference, IconReference } from './references'\nimport {\n drawnEffects,\n SHADER_CANVAS,\n shaderCSS,\n shaderEffectName,\n shaderImport,\n type ShaderLayer\n} from './shaders'\nimport { componentClasses } from './styling'\n\n/** The Reka UI components a kind renders, by part, and the prop its model binds. */\nconst REKA: Record<\n GeneratedKind,\n { parts: Record<string, string>; model?: 'modelValue' | 'open' }\n> = {\n button: { parts: {} },\n switch: { parts: { root: 'SwitchRoot', thumb: 'SwitchThumb' }, model: 'modelValue' },\n checkbox: {\n parts: { root: 'CheckboxRoot', indicator: 'CheckboxIndicator' },\n model: 'modelValue'\n },\n toggle: { parts: { root: 'Toggle' }, model: 'modelValue' },\n collapsible: {\n parts: {\n root: 'CollapsibleRoot',\n trigger: 'CollapsibleTrigger',\n content: 'CollapsibleContent'\n },\n model: 'open'\n },\n tabs: {\n parts: { root: 'TabsRoot', list: 'TabsList', trigger: 'TabsTrigger', content: 'TabsContent' },\n model: 'modelValue'\n },\n radioGroup: { parts: { root: 'RadioGroupRoot' }, model: 'modelValue' },\n toggleGroup: { parts: { root: 'ToggleGroupRoot' }, model: 'modelValue' },\n accordion: { parts: { root: 'AccordionRoot' }, model: 'modelValue' },\n radioGroupItem: { parts: { root: 'RadioGroupItem', indicator: 'RadioGroupIndicator' } },\n toggleGroupItem: { parts: { root: 'ToggleGroupItem' } },\n accordionItem: {\n parts: { root: 'AccordionItem', trigger: 'AccordionTrigger', content: 'AccordionContent' }\n },\n slider: {\n parts: { root: 'SliderRoot', track: 'SliderTrack', range: 'SliderRange', thumb: 'SliderThumb' },\n model: 'modelValue'\n },\n progress: {\n parts: { root: 'ProgressRoot', indicator: 'ProgressIndicator' },\n model: 'modelValue'\n },\n numberField: {\n parts: {\n root: 'NumberFieldRoot',\n increment: 'NumberFieldIncrement',\n decrement: 'NumberFieldDecrement'\n },\n model: 'modelValue'\n },\n // Reka has no text field; the root is the design's own element around a native input.\n textField: { parts: {} },\n textarea: { parts: {} },\n // A component without a behaviour is the design's own elements.\n plain: { parts: {} }\n}\n\n/**\n * Kinds whose two-way value is their input's, which binds it rather than the root. Their input\n * takes the caller's attributes too, such as `name` or `required`, and the root only `class`,\n * as the React components spread the caller's props on the input.\n */\nconst INPUT_MODEL: ReadonlySet<GeneratedKind> = new Set(['textField', 'textarea'])\n\n/** Whether the caller's attributes go to the field's input: it is a field, and draws one. */\nconst attrsToInput = (component: ComponentModel) =>\n INPUT_MODEL.has(component.kind) && drawsInput(component.tree)\n\n/** The caller's attributes but `class`, which the root takes, for a field's input. */\nconst INPUT_ATTRS = es.parseExpression('{ ...$attrs, class: undefined }')\n\n/** The caller's `class`, which a field's root takes since its attributes go to the input. */\nconst ROOT_CLASS = es.parseExpression('$attrs.class')\n\n/** The caller's attributes reach the input rather than falling through to the root. */\nconst NO_ATTRS_FALLTHROUGH = es.parseModule('defineOptions({ inheritAttrs: false })')\n\n/** What a group's root fixes: one item chosen at a time, and an accordion that can all close. */\nconst ROOT_ATTRIBUTES: Partial<Record<GeneratedKind, vue.VueAttribute[]>> = {\n toggleGroup: [vue.attribute('type', 'single')],\n accordion: [vue.attribute('type', 'single'), vue.bound('collapsible', es.parseExpression('true'))]\n}\n\nconst identifier = (name: string) => es.identifier(name)\n\nconst HEADING_STYLE = Object.entries(HEADING_RESET)\n .map(([property, value]) => `${property}: ${value}`)\n .join('; ')\n\n/** `disabled || undefined`, so a native button sets `data-disabled` only while disabled. */\nconst DISABLED_FLAG = es.parseExpression('disabled || undefined')\n\nfunction bindingAttributes(\n binding: ComponentBinding,\n uses: TemplateUses,\n native: boolean\n): vue.VueAttribute[] {\n const { kind } = uses\n if (binding.type === 'model') {\n if (INPUT_MODEL.has(kind)) return []\n // Reka's slider takes a list of values, which the model's single one stands in.\n const bound = uses.sliderValues ?? binding.name\n return [vue.model(identifier(bound), REKA[kind].model === 'open' ? 'open' : undefined)]\n }\n if (binding.type === 'prop') return [vue.bound(binding.attribute, identifier(binding.prop.name))]\n if (binding.type === 'modelProp') return [vue.bound(binding.attribute, identifier(binding.name))]\n if (binding.type === 'value') return [vue.bound('value', identifier('value'))]\n // Reka sets `data-disabled` on its own roots; a native root needs it for the state styles.\n return [\n ...(native && kind !== 'button' ? [] : [vue.bound('disabled', identifier('disabled'))]),\n ...(native ? [vue.bound('data-disabled', DISABLED_FLAG)] : [])\n ]\n}\n\n/** The number range a slider, progress bar, or number field's root is given. */\nfunction rangeAttributes(component: ComponentModel): vue.VueAttribute[] {\n const { range } = component\n if (!range) return []\n const bound = (name: 'min' | 'max' | 'step') => vue.bound(name, es.number(range[name]))\n // A progress bar only takes its maximum; its minimum is where the indicator is empty.\n return component.kind === 'progress'\n ? [bound('max')]\n : [bound('min'), bound('max'), bound('step')]\n}\n\nfunction progressStyle(component: ComponentModel): vue.VueAttribute[] {\n const { range, model } = component\n const style = range && model ? progressWidth(range, identifier(model)) : null\n return style ? [vue.bound('style', style)] : []\n}\n\n/** `element`, recorded as drawing `layerId`, so code can link back to that layer. */\nfunction drawing(\n element: vue.VueElement,\n layerId: string | undefined,\n uses: TemplateUses\n): vue.VueElement {\n if (layerId) uses.layers.set(element, layerId)\n return element\n}\n\n/** A field's input: Reka's for a number field, else a native input or textarea. */\nfunction inputNode(className: string, uses: TemplateUses): vue.VueElement {\n const { component } = uses\n if (component.kind === 'numberField') {\n uses.reka.add('NumberFieldInput')\n return vue.element('NumberFieldInput', [vue.attribute('class', uses.classOf(className))])\n }\n const placeholder = component.text?.placeholder\n return vue.element(component.kind === 'textarea' ? 'textarea' : 'input', [\n vue.attribute('class', uses.classOf(className)),\n ...(component.model ? [vue.model(identifier(component.model))] : []),\n ...(placeholder ? [vue.attribute('placeholder', placeholder)] : []),\n // The caller's attributes, such as `name` or a placeholder of its own, after the design's.\n vue.spread(INPUT_ATTRS),\n ...(component.disabled ? [vue.bound('disabled', identifier('disabled'))] : [])\n ])\n}\n\n/** What a template uses, which its script imports and declares. */\ninterface TemplateUses {\n component: ComponentModel\n kind: GeneratedKind\n /** The list a slider's root binds, standing in for its single value. */\n sliderValues: string | null\n /** Reka components. */\n reka: Set<string>\n /** Other generated components. */\n components: Set<string>\n /** Whether an icon is drawn by Iconify. */\n icons: boolean\n /** The package icons come from, and what the icons drawn from it import. */\n iconPackage: IconPackage\n iconImports: IconImport[]\n /** Names an icon's imports apart from the component's other names. */\n nameIcon: (drawing: IconDrawing) => IconDrawing\n /** The class a layer's readable class name stands for, as the component is styled. */\n classOf: (className: string) => string\n /** The layer each element draws, which code links back to. */\n layers: WeakMap<vue.VueElement, string>\n /** Effects of the `shaders` library its layers fill with. */\n shaders: Set<string>\n /** A ref per nested control drawn on, which its `v-model` binds. */\n models: { name: string }[]\n taken: Set<string>\n}\n\n/** The Iconify component, named apart from any component the design calls `Icon`. */\nconst ICONIFY = 'IconifyIcon'\n\n/** An icon: its package's own component where it has the icon, Iconify's otherwise. */\nfunction iconElement(node: IconReference, uses: TemplateUses): vue.VueElement {\n const className = vue.attribute('class', uses.classOf(node.className))\n const found = iconDrawing(node.icon, uses.iconPackage, 'vue')\n const drawn = found && uses.nameIcon(found)\n if (!drawn) {\n uses.icons = true\n return vue.element(ICONIFY, [vue.attribute('icon', node.icon), className])\n }\n uses.iconImports.push(...drawingImports(drawn))\n if (drawn.type === 'component') return vue.element(drawn.import.local, [className])\n return vue.element(drawn.component.local, [\n vue.bound('icon', identifier(drawn.import.local)),\n className\n ])\n}\n\nfunction reference(node: ComponentReference, uses: TemplateUses): vue.VueElement {\n uses.components.add(node.component)\n const model = node.model\n ? claimName(`${camelCase(node.component)}${upperFirst(node.model)}`, uses.taken)\n : null\n if (model) uses.models.push({ name: model })\n return vue.element(node.component, [\n vue.attribute('class', uses.classOf(node.className)),\n ...node.props.map((prop) =>\n typeof prop.value === 'boolean'\n ? vue.bound(prop.name, es.parseExpression(String(prop.value)))\n : vue.attribute(prop.name, prop.value)\n ),\n // The control stays operable, starting from the value the design draws.\n ...(model && node.model ? [vue.model(identifier(model), node.model)] : [])\n ])\n}\n\n/** A design element's attributes: what shows it, its part's own, the design's, and bindings. */\nfunction elementAttributes(\n node: ComponentElement,\n uses: TemplateUses,\n { native, button }: { native: boolean; button: boolean }\n): vue.VueAttribute[] {\n const root = node.part === 'root'\n return [\n ...(node.shownBy ? [vue.renderIf(identifier(node.shownBy))] : []),\n ...(button ? [vue.attribute('type', 'button')] : []),\n ...(root ? [...(ROOT_ATTRIBUTES[uses.kind] ?? []), ...rangeAttributes(uses.component)] : []),\n ...(uses.kind === 'progress' && node.part === 'indicator' ? progressStyle(uses.component) : []),\n ...Object.entries(omit(node.attrs, ['class'])).map(([name, value]) =>\n vue.attribute(name, value)\n ),\n vue.attribute('class', compact([node.attrs.class, uses.classOf(node.className)]).join(' ')),\n ...(root && attrsToInput(uses.component) ? [vue.bound('class', ROOT_CLASS)] : []),\n ...(node.value === undefined ? [] : [vue.attribute('value', node.value)]),\n ...node.bindings.flatMap((binding) => bindingAttributes(binding, uses, native))\n ]\n}\n\n/** A shader playing behind its layer's content, with telemetry off, as every export has it. */\nfunction shaderCanvas(shader: ShaderLayer, uses: TemplateUses): vue.VueNode {\n const effect = (component: ShaderComponent): vue.VueNode => {\n uses.shaders.add(component.type)\n return vue.element(\n shaderEffectName(component.type),\n Object.entries(component.props ?? {}).map(([key, value]) =>\n typeof value === 'string'\n ? vue.attribute(kebabCase(key), value)\n : vue.bound(kebabCase(key), es.json(value))\n ),\n drawnEffects(component.children).map(effect)\n )\n }\n return vue.element(\n SHADER_CANVAS,\n [\n vue.attribute('class', uses.classOf(shader.className)),\n vue.bound('disable-telemetry', es.json(true))\n ],\n drawnEffects(shader.preset.components).map(effect)\n )\n}\n\nfunction designElement(node: ComponentElement, uses: TemplateUses): vue.VueElement {\n const reka = node.part ? REKA[uses.kind].parts[node.part] : undefined\n if (reka) uses.reka.add(reka)\n const native = node.part === 'root' && !reka\n const button = native && uses.kind === 'button'\n const content = node.children.map((child) => templateNode(child, uses))\n const children = node.shader ? [shaderCanvas(node.shader, uses), ...content] : content\n const element = drawing(\n vue.element(\n reka ?? (button ? 'button' : node.tag),\n elementAttributes(node, uses, { native, button }),\n // A slot frame shows what the caller passes, or the design's content.\n node.slot\n ? [\n ...(node.shader ? [shaderCanvas(node.shader, uses)] : []),\n vue.element('slot', [vue.attribute('name', node.slot)], content)\n ]\n : children\n ),\n node.layerId,\n uses\n )\n // Reka puts an accordion item's trigger in a header, which carries the heading level.\n if (uses.kind !== 'accordionItem' || node.part !== 'trigger') return element\n uses.reka.add('AccordionHeader')\n return vue.element('AccordionHeader', [vue.attribute('style', HEADING_STYLE)], [element])\n}\n\nfunction templateNode(node: ComponentNode, uses: TemplateUses): vue.VueNode {\n if (node.type === 'text') return vue.text(node.value)\n if (node.type === 'textProp') return vue.interpolation(identifier(node.name))\n if (node.type === 'reference') return drawing(reference(node, uses), node.layerId, uses)\n if (node.type === 'input') return drawing(inputNode(node.className, uses), node.layerId, uses)\n if (node.type === 'icon') return drawing(iconElement(node, uses), node.layerId, uses)\n return designElement(node, uses)\n}\n\nfunction propsType(component: ComponentModel): es.SyntaxNode {\n const members: [string, es.SyntaxNode, boolean][] = component.props.map((prop) => [\n prop.name,\n es.stringUnionType(prop.options),\n true\n ])\n if (component.disabled) members.unshift(['disabled', es.parseType('boolean'), true])\n // A group's item always stands for a value, which has no default.\n if (component.valueProp) members.unshift(['value', es.parseType('string'), false])\n for (const text of component.texts) members.push([text.name, es.parseType('string'), true])\n for (const prop of component.booleans) members.push([prop.name, es.parseType('boolean'), true])\n return es.objectType(members)\n}\n\n/** `defineProps`, with `withDefaults` when any prop has a default to give. */\n/** Whether any prop has a default to give: `disabled`, a variant, a text, or a boolean. */\nconst hasDefaults = (component: ComponentModel) =>\n component.disabled ||\n component.props.length > 0 ||\n component.texts.length > 0 ||\n component.booleans.length > 0\n\nfunction propsDeclaration(component: ComponentModel): es.SyntaxNode[] {\n const optional = hasDefaults(component)\n return optional\n ? es.fill(PROPS, { $Props: propsType(component), $defaults: propsDefaults(component) }).body\n : es.fill(REQUIRED_PROPS, { $Props: propsType(component) }).body\n}\n\nfunction propsDefaults(component: ComponentModel): es.SyntaxNode {\n return es.object([\n ...(component.disabled ? [['disabled', es.parseExpression('false')] as const] : []),\n ...component.props.map((prop) => [prop.name, es.string(prop.default)] as const),\n ...component.texts.map((text) => [text.name, es.string(text.default)] as const),\n ...component.booleans.map(\n (prop) => [prop.name, es.parseExpression(String(prop.default))] as const\n )\n ])\n}\n\nconst PROPS = es.parseModule('withDefaults(defineProps<$Props>(), $defaults)')\nconst REQUIRED_PROPS = es.parseModule('defineProps<$Props>()')\nconst MODEL = es.parseModule('const $model = defineModel<boolean>($name, { default: false })')\nconst CHOICE_MODEL = es.parseModule(\n 'const $model = defineModel<$Type>($name, { default: $default })'\n)\nconst OPEN_CHOICE_MODEL = es.parseModule('const $model = defineModel<$Type>($name)')\nconst VALUE_MODEL = es.parseModule(\n 'const $model = defineModel<$Type>($name, { default: $default })'\n)\nconst SLIDER_VALUES = es.parseModule(dedent`\n const $values = computed({\n get: () => [$model.value],\n set: (next: number[] | undefined) => {\n $model.value = next?.[0] ?? $model.value\n }\n })\n`)\n\nfunction namedImport(names: readonly string[], source: string, local = (name: string) => name) {\n return {\n type: 'ImportDeclaration',\n importKind: 'value',\n specifiers: names.map((name) => ({\n type: 'ImportSpecifier',\n imported: identifier(name),\n local: identifier(local(name))\n })),\n source: es.string(source)\n }\n}\n\nconst IMPORT_COMPONENT = es.parseModule(`import $Component from '$path'`)\nconst MODEL_REF = es.parseModule('const $name = ref(true)')\n\n/** What the script imports: Vue's helpers, Iconify, Reka, and other generated components. */\nfunction scriptImports(uses: TemplateUses): es.SyntaxNode[] {\n const helpers = compact([uses.sliderValues && 'computed', uses.models.length > 0 && 'ref'])\n return [\n ...(helpers.length > 0 ? [namedImport(helpers, 'vue')] : []),\n ...(uses.icons ? [namedImport(['Icon'], '@iconify/vue', () => ICONIFY)] : []),\n ...iconImportDeclarations(uses.iconImports),\n ...(uses.reka.size > 0 ? [namedImport([...uses.reka].sort(), 'reka-ui')] : []),\n ...(uses.shaders.size > 0 ? [shaderImport('shaders/vue', uses.shaders)] : []),\n ...[...uses.components].sort().flatMap(\n (name) =>\n es.fill(IMPORT_COMPONENT, {\n $Component: identifier(name),\n $path: es.string(`./${name}.vue`)\n }).body\n )\n ]\n}\n\n/** The model's declaration: a choice, a number or text, or a boolean, and a slider's list. */\nfunction modelDeclaration(component: ComponentModel, uses: TemplateUses): es.SyntaxNode[] {\n const name = component.model\n if (!name) return []\n const { choice, range, text } = component\n const base = { $model: identifier(name), $name: es.string(name) }\n if (choice)\n return es.fill(choice.default === null ? OPEN_CHOICE_MODEL : CHOICE_MODEL, {\n ...base,\n $Type: es.stringUnionType(choice.options),\n $default: choice.default === null ? es.OMIT : es.string(choice.default)\n }).body\n if (!range && !text) return es.fill(MODEL, base).body\n const model = es.fill(VALUE_MODEL, {\n ...base,\n $Type: es.parseType(range ? 'number' : 'string'),\n $default: range ? es.number(range.default) : es.string(text?.default ?? '')\n }).body\n const values = uses.sliderValues\n ? es.fill(SLIDER_VALUES, { $values: identifier(uses.sliderValues), $model: identifier(name) })\n .body\n : []\n return [...model, ...values]\n}\n\nfunction script(component: ComponentModel, uses: TemplateUses): es.SyntaxNode {\n const props = component.valueProp || hasDefaults(component) ? propsDeclaration(component) : []\n const refs = uses.models.flatMap(\n (item) => es.fill(MODEL_REF, { $name: identifier(item.name) }).body\n )\n const options = attrsToInput(component) ? NO_ATTRS_FALLTHROUGH.body : []\n return {\n type: 'Program',\n sourceType: 'module',\n body: [\n ...scriptImports(uses),\n ...options,\n ...props,\n ...modelDeclaration(component, uses),\n ...refs\n ]\n }\n}\n\n/**\n * A component as a Vue single-file component on Reka UI: its variants' state styles in a\n * scoped stylesheet, its parts as Reka components, and its props from the behaviour and its\n * other variant properties.\n */\nexport const vueComponent: ComponentGenerator = async (component, options = {}) => {\n const styling = options.styling ?? 'css'\n const taken = new Set([\n ...component.props.map((prop) => prop.name),\n ...component.texts.map((text) => text.name),\n ...component.booleans.map((prop) => prop.name),\n ...component.slots.map((slot) => slot.name),\n ...(component.model ? [component.model] : []),\n 'disabled'\n ])\n const uses: TemplateUses = {\n component,\n classOf: componentClasses(component, styling),\n layers: new WeakMap(),\n kind: component.kind,\n sliderValues:\n component.kind === 'slider' && component.model ? claimName('values', taken) : null,\n reka: new Set(),\n components: new Set(),\n icons: false,\n iconPackage: options.icons ?? 'iconify',\n iconImports: [],\n nameIcon: iconNamer(component, [ICONIFY, ...taken]),\n shaders: new Set(),\n models: [],\n // Refs share the script with the component's own props and model.\n taken\n }\n const template = templateNode(component.tree, uses)\n // Tailwind styles the markup itself; a stylesheet is written beside it otherwise.\n const style =\n styling === 'css'\n ? compact([(await stateStylesToCSS(component.styles)).css, shaderCSS(component.tree)]).join(\n '\\n'\n )\n : undefined\n const path = `${component.name}.vue`\n // A group's items are their own component, which the group's template uses.\n const item = component.item ? await vueComponent(component.item, options) : null\n const sfc = { script: script(component, uses), template, style }\n return {\n files: [\n ...(item?.files ?? []),\n {\n path,\n content: vue.printComponent(sfc),\n layerIds: vue\n .componentElements(sfc)\n .map((element) => (element && uses.layers.get(element)) ?? null)\n }\n ],\n entry: { path: `./${path}`, named: false },\n // `v-model` binds the value, and its prop takes a story's initial value.\n valueArg: component.model\n }\n}\n","import { stateStylesToCSS } from '#dom-css/behaviours/states/css'\nimport { restLayerOf, stateStyles } from '#dom-css/behaviours/states/model'\nimport { stateStylesToTailwind } from '#dom-css/behaviours/states/tailwind'\nimport type { StateElement, StateNode, StateStyles } from '#dom-css/behaviours/states/types'\nimport type { DesignDocument, DesignElement, DesignNode } from '#dom-css/types'\nimport { zip } from 'es-toolkit/array'\n\nimport type { SceneGraph } from '@pairdraw/scene-graph'\n\nimport { extractImageAssets, type ExportHTMLFile } from '../bundle'\nimport { serializedElements, serializeHTML } from '../html'\nimport type { SceneGraphToDesignOptions } from '../projection'\nimport { claimName, identifierName } from '../storybook/names'\nimport { componentModel, type ComponentGeneratorOptions, type GeneratedComponent } from './model'\nimport { reactComponent } from './react'\nimport { vueComponent } from './vue'\n\n/** The frameworks a layer can be generated as a component for. */\nexport const LAYER_COMPONENT_FRAMEWORKS = ['vue', 'react'] as const\nexport type LayerComponentFramework = (typeof LAYER_COMPONENT_FRAMEWORKS)[number]\n\n/** A layer as a component: its name and the files that make it up. */\nexport interface LayerComponent {\n name: string\n layerId: string\n files: GeneratedComponent['files']\n}\n\n/**\n * Each layer as a Vue or React component, as the Storybook export generates a component set's:\n * a component set with its variants as props and its behaviour's parts, and any other layer as\n * a plain component of the elements it draws. Names stay distinct across the layers.\n */\nexport async function layerComponents(\n graph: SceneGraph,\n layerIds: readonly string[],\n framework: LayerComponentFramework,\n options: Pick<SceneGraphToDesignOptions, 'vectorElement'> & ComponentGeneratorOptions = {}\n): Promise<LayerComponent[]> {\n const generate = framework === 'vue' ? vueComponent : reactComponent\n const taken = new Set<string>()\n const components: LayerComponent[] = []\n for (const layerId of layerIds) {\n const layer = graph.getNode(layerId)\n if (!layer) continue\n const name = claimName(identifierName(layer.name, 'Component'), taken)\n // No other layer is a generated component here, but icons from a set are still used.\n const model = componentModel(graph, layer, { ...options, name, references: new Map() })\n if (!model) continue\n const { files } = await generate(model, { styling: options.styling, icons: options.icons })\n components.push({ name, layerId, files })\n }\n return components\n}\n\n/** Layers as HTML and the stylesheet that styles it, and the images it points at. */\nexport interface LayerMarkup {\n html: string\n /** The layer each element of `html` draws, in the order they open, `null` for none. */\n layerIds: (string | null)[]\n css: string\n images: ExportHTMLFile[]\n}\n\n/** The state element each element of markup built from it draws, which it builds one for one. */\nfunction drawnBy(\n state: StateNode,\n design: DesignNode,\n found: Map<DesignElement, StateElement>\n): void {\n if (state.type === 'text' || design.type === 'text') return\n found.set(design, state)\n for (const [child, built] of zip(state.children, design.children)) drawnBy(child, built, found)\n}\n\n/** The layer of each element `serializeHTML` writes for the document, in the order they open. */\nfunction markupLayers(graph: SceneGraph, styles: StateStyles, document: DesignDocument) {\n const states = new Map<DesignElement, StateElement>()\n for (const root of document.children) drawnBy(styles.root, root, states)\n return serializedElements(document).map((element) => {\n const state = element && states.get(element)\n return (state && restLayerOf(graph, styles, state)) ?? null\n })\n}\n\n/**\n * Layers as indented HTML with a readable class per layer and one stylesheet, as the generated\n * components draw them, or with Tailwind utilities in place of the classes and no stylesheet.\n * Images are files under `assetBasePath` rather than inlined.\n */\nexport async function layerMarkup(\n graph: SceneGraph,\n layerIds: readonly string[],\n options: Pick<SceneGraphToDesignOptions, 'vectorElement'> &\n ComponentGeneratorOptions & { assetBasePath?: string } = {}\n): Promise<LayerMarkup> {\n const taken = new Set<string>()\n const html: string[] = []\n const layers: (string | null)[] = []\n const css: string[] = []\n for (const layerId of layerIds) {\n const layer = graph.getNode(layerId)\n const styles = layer && stateStyles(graph, layer, options)\n if (!layer || !styles) continue\n // Two layers named alike would share class names, and their rules would collide.\n const name = claimName(styles.name, taken, { separator: ' ' })\n const named = { ...styles, name }\n const sheet =\n options.styling === 'tailwind'\n ? { document: stateStylesToTailwind(named), css: '' }\n : await stateStylesToCSS(named)\n html.push(serializeHTML(sheet.document, { indent: true }))\n layers.push(...markupLayers(graph, named, sheet.document))\n if (sheet.css) css.push(sheet.css)\n }\n const { html: page, files } = extractImageAssets(\n html.join('\\n\\n'),\n options.assetBasePath ?? 'assets'\n )\n return { html: page, layerIds: layers, css: css.join('\\n'), images: files }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAS,YACP,OACA,KACA,UACA,OACA,OAC2B;CAC3B,MAAM,WAAW,cAAc,OAAO,GAAG;CACzC,MAAM,wBAAQ,IAAI,IAA0B;CAC5C,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,OAAO,QAAQ,IAAI,MAAM,IAAI,CAAC,CAAC,MAAM;EAC3C,KAAK,MAAM,WAAW,UAAU;GAC9B,MAAM,YAAY,gBAAgB,OAAO,QAAQ,IAAI,IAAI,CAAC,EAAE,4BAA4B,MACrF,SAAS,KAAK,UAAU,KAC3B;GACA,MAAM,OAAO,aAAa,MAAM,IAAI,UAAU,UAAU;GACxD,IAAI,MAAM;IACR,MAAM,IAAI,SAAS,IAAI;IACvB;GACF;EACF;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