@metamorph-labs/polymorph-screen 1.0.17 → 1.0.18
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/CHANGELOG.md +44 -0
- package/dist/card.js +1 -1
- package/dist/check.js +1 -1
- package/dist/chunks/{card-DbGNeT3m.js → card-CVzvz0j_.js} +2 -2
- package/dist/chunks/{card-DbGNeT3m.js.map → card-CVzvz0j_.js.map} +1 -1
- package/dist/chunks/{check-DDXOiNKG.js → check-BB8y9DW3.js} +259 -147
- package/dist/chunks/check-BB8y9DW3.js.map +1 -0
- package/dist/chunks/{vocabulary-uhojNKy_.js → vocabulary-C8KzYJUx.js} +6 -3
- package/dist/chunks/vocabulary-C8KzYJUx.js.map +1 -0
- package/dist/index.js +5 -5
- package/dist/types/_internal/registry/screen-table.d.ts +5 -1
- package/dist/types/_internal/spec/validate.d.ts +8 -1
- package/dist/vocabulary.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/check-DDXOiNKG.js.map +0 -1
- package/dist/chunks/vocabulary-uhojNKy_.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @polymorph/screen
|
|
2
2
|
|
|
3
|
+
## 1.0.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ddbd1d4: **Three usage rules for Button, and a destructive Button never takes focus first.**
|
|
8
|
+
|
|
9
|
+
- `@polymorph/rules` gains three red rules, in `stageTwoRules` and so in `allRules`, which
|
|
10
|
+
`polymorph add` applies. An app that upgrades may see new reports from them:
|
|
11
|
+
- `polymorph/one-main-button`: a second main Button (`solid`/`accent`, the defaults) in one
|
|
12
|
+
Dialog, Drawer, Popover, Card or `Dashboard.Panel`.
|
|
13
|
+
- `polymorph/danger-last`: within one group of Buttons placed together, a danger Button
|
|
14
|
+
before another Button.
|
|
15
|
+
- `polymorph/trailing-icon`: a `trailingIcon` that is not a direction or a disclosure. The fix
|
|
16
|
+
moves the role to `icon` when the Button has none.
|
|
17
|
+
|
|
18
|
+
The groups report them as warnings, so a build that passed still passes. Spread the new
|
|
19
|
+
`usageRulesAsErrors` after the groups to make them errors. The rules read TSX, Vue, Svelte,
|
|
20
|
+
Solid and Angular. `@polymorph/rules/usage` holds what they count.
|
|
21
|
+
|
|
22
|
+
- A warning stays a warning past ESLint. `verify`'s `Diagnostic` gains an optional `severity`
|
|
23
|
+
(`error` or `warning`), which `verify` always writes from the linter's result, with
|
|
24
|
+
`isWarning`, `errorsOf` and `warningsOf` beside it. `polymorph check` marks a warning, counts it
|
|
25
|
+
apart and exits 1 on errors only. The MCP server's `validate`, `fix` and `fix_file` return
|
|
26
|
+
warnings in `warnings`, apart from `violations`, and `ok` reads the violations alone.
|
|
27
|
+
`emitCheckedScreen` returns `warnings` beside `violations`, and `emit_screen`, `pnpm emit` and
|
|
28
|
+
the screen scripts write a screen whose code has only warnings. Every existing rule is an
|
|
29
|
+
error, so nothing else changes.
|
|
30
|
+
- `danger-last` reads the Buttons one element holds side by side, up to a `Separator`, as one
|
|
31
|
+
group. A destructive action in a group of its own, apart from the group that holds the main
|
|
32
|
+
Button, may come first.
|
|
33
|
+
- `design/icons.json` marks the roles a trailing icon may take `trailing`: `collapse`, `down`,
|
|
34
|
+
`expand`, `forward`, `next` and `open-external`. The registry publishes it as `icons.trailing`.
|
|
35
|
+
- The validation of a screen spec (`@polymorph/spec/validate`, and `checkScreen` in
|
|
36
|
+
`@polymorph/screen`) reports the same three as faults.
|
|
37
|
+
- `@polymorph/engine`: `modalFocusTarget` never puts focus on a destructive Button when a
|
|
38
|
+
Dialog or a Drawer opens, in any framework. A footer whose rightmost action is destructive
|
|
39
|
+
starts on its leftmost safe action. A footer whose every action is destructive starts in the
|
|
40
|
+
body, else on close. A Dialog with a `tone="danger"` primary used to start on it.
|
|
41
|
+
- `@polymorph/recipes`: a disabled control fades its glyph with its label where it did not:
|
|
42
|
+
Accordion's chevron at rest, a checked and disabled entry's check in Menu, ContextMenu,
|
|
43
|
+
Menubar, SplitButton, Select, Combobox and MultiSelect, a disabled submenu row's chevron, and
|
|
44
|
+
the text of ImageEditor's and FileUpload's drop zones. A danger row's icon in Menu,
|
|
45
|
+
ContextMenu, Menubar and SplitButton takes the row's danger colour, as its spec says.
|
|
46
|
+
|
|
3
47
|
## 1.0.17
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
package/dist/card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as outputContract, n as runtimeCard } from "./chunks/card-
|
|
1
|
+
export { t as outputContract, n as runtimeCard } from "./chunks/card-CVzvz0j_.js";
|
package/dist/check.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as checkScreen } from "./chunks/check-
|
|
1
|
+
export { t as checkScreen } from "./chunks/check-BB8y9DW3.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as e, g as t, i as n } from "./members-CPUURBV9.js";
|
|
2
2
|
import { c as r, n as i, t as a } from "./urls-DMQZeRPI.js";
|
|
3
|
-
import { t as o } from "./vocabulary-
|
|
3
|
+
import { t as o } from "./vocabulary-C8KzYJUx.js";
|
|
4
4
|
//#region ../registry/src/card-parts.ts
|
|
5
5
|
var s = /* @__PURE__ */ new Set([
|
|
6
6
|
"children",
|
|
@@ -226,4 +226,4 @@ function j(e = {}) {
|
|
|
226
226
|
//#endregion
|
|
227
227
|
export { j as n, A as t };
|
|
228
228
|
|
|
229
|
-
//# sourceMappingURL=card-
|
|
229
|
+
//# sourceMappingURL=card-CVzvz0j_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-DbGNeT3m.js","names":["unionParts","shippedParts","allowedMembers","SPEC_ID","ADDRESS_SCHEMES","ADDRESS_KEYS","VOCABULARY","CONVENTION_PROPS","TIER_ORDER","TIER_TITLE","wrapped","words","paragraph","lines","line","word","width","ARIA","name","NODE_TYPE","EVENT_HANDLER_ALIAS","REF_TYPE","DOM_PARAMETER","unwrap","inner","text","closing","depth","at","open","char","commaParts","parts","start","last","functionType","part","end","rest","colon","parameter","cardType","roles","flat","printed","whole","literals","literal","written","bare","boolean","node","kept","distinct","NOTHING","propList","own","props","prop","names","allAria","type","question","questions","isFunctionPrint","memberLines","segments","member","variant","tones","purpose","s","framework","recorded","candidate","dataTypeLines","catalogue","vocabulary","reached","queue","read","listed","primitive","primitives","next","field","members","owner","renderRuntimeCard","options","role","out","tiers","tier","inTier","items","code","OPENING","outputContract","allowed","scopes","patched","rungs","addresses","schemes","runtimeCard"],"sources":["../../../registry/src/card-parts.ts","../../../registry/src/runtime-card.ts","../../src/card.ts"],"sourcesContent":["/**\n * What the system card (`card.ts`) and the run-time card (`runtime-card.ts`)\n * share: the conventions stated once, the tiers' reading order and titles,\n * how a paragraph is wrapped, and how a member React draws through a function\n * is found.\n *\n * It imports nothing, so the run-time card reaches none of the registry\n * builder through it.\n */\n\n/** Conventions the whole vocabulary shares, stated once and omitted from each row. */\nexport const CONVENTION_PROPS: ReadonlySet<string> = new Set([\n 'children',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-required',\n])\n\n// Content, then data, then pages. This is the reading order `galleries.ts` uses.\nexport const TIER_ORDER: readonly string[] = [\n 'icon',\n 'layout',\n 'controls',\n 'overlays',\n 'structure',\n 'charts',\n 'ai',\n 'archetypes',\n]\n\nexport const TIER_TITLE: Readonly<Record<string, string>> = {\n icon: 'Iconography',\n layout: 'Layout primitives',\n controls: 'Controls',\n overlays: 'Overlays',\n structure: 'Structure',\n ai: 'AI — the conversation',\n archetypes: 'Page archetypes',\n}\n\n/**\n * A paragraph broken into lines of at most `width` characters, at spaces outside\n * a code span, so `polymorph init --framework` stays on one line.\n */\nexport function wrapped(paragraph: string, width = 84): string[] {\n const words = paragraph.match(/(?:`[^`]*`|[^\\s`])+/g) ?? []\n const lines: string[] = []\n let line = ''\n for (const word of words) {\n if (line !== '' && line.length + 1 + word.length > width) {\n lines.push(line)\n line = word\n } else line = line === '' ? word : `${line} ${word}`\n }\n if (line !== '') lines.push(line)\n return lines\n}\n\n/** An export as `optionsCarrier` reads it: its kind and the props it takes. */\ninterface CarrierExport {\n readonly kind: string\n readonly props: readonly { readonly name: string }[]\n}\n\n/**\n * The function export whose options are the member's own props (`toast()` for\n * Toast), or `undefined`. React has no component of the member's name then:\n * a call site calls the function, and the member's props are its options.\n */\nexport function optionsCarrier<Export extends CarrierExport>(component: {\n readonly props: readonly { readonly name: string }[]\n readonly exports: readonly Export[]\n}): Export | undefined {\n const own = component.props.filter((prop) => !prop.name.includes('.'))\n const names = new Set(own.map((prop) => prop.name))\n return component.exports.find(\n (other) =>\n other.kind === 'function' &&\n other.props.length === own.length &&\n other.props.every((prop) => names.has(prop.name)),\n )\n}\n","import { CONVENTION_PROPS, TIER_ORDER, TIER_TITLE, wrapped } from './card-parts'\nimport { shippedParts, unionParts, type Framework, type PartsOwner } from './frameworks'\nimport { DEFAULT_PLATFORM } from './platforms'\n\n/**\n * The run-time card: the members a model may compose in a screen a host draws\n * at run time, each with what the model needs to write it lawfully without a\n * tool call.\n *\n * It is the system card's vocabulary section (`card.ts`) with the prop types\n * written out, because a model with no tool to look a prop up must know what\n * a prop takes: an enum's literals, whether it is text or a node, and the\n * signature of a callback it binds to an action. Everything a screen document\n * cannot use is left out: tokens, the red rules, the ladder beyond the rungs a\n * document declares, install facts, platforms and frameworks other than the\n * one drawing.\n *\n * It reads a vocabulary, not the registry: the registry is one, and the\n * run-time table (`screen-table.ts`) another, so `@polymorph/screen` renders\n * the card from the table a host installed. `packages/screen/src/card.test.ts`\n * holds the two renderings equal. The output contract that follows the card\n * in a model's prompt is the screen package's (`packages/screen/src/card.ts`).\n *\n * This module reads no file, so the browser can import it\n * (`@polymorph/registry/runtime-card`).\n */\n\ninterface CardProp {\n readonly name: string\n readonly type: string\n readonly optional: boolean\n}\n\n/** What the card reads of a member. */\nexport interface RuntimeCardMember extends PartsOwner<{\n readonly name: string\n readonly props: readonly CardProp[]\n}> {\n readonly name: string\n readonly tier: string\n readonly purpose: string\n readonly props: readonly CardProp[]\n readonly grid: Readonly<Record<string, readonly string[]>> | null\n}\n\n/** What the card reads of an exception primitive. */\nexport interface RuntimeCardPrimitive {\n readonly name: string\n readonly rung: number\n readonly purpose: string\n readonly props: readonly CardProp[]\n}\n\n/** What the card reads of a named data type a prop takes: its fields, or the types it is a union of. */\nexport interface RuntimeCardDataType {\n readonly name: string\n readonly params: readonly string[]\n readonly union?: readonly string[]\n readonly fields: readonly CardProp[]\n}\n\n/** What the card reads of a vocabulary: the registry and the run-time table both have it. */\nexport interface RuntimeCardVocabulary {\n readonly components: readonly RuntimeCardMember[]\n readonly exceptions: { readonly primitives: readonly RuntimeCardPrimitive[] }\n readonly icons: { readonly roles: readonly { readonly name: string }[] }\n /** The named data types the props take. A vocabulary without them gets a card without them. */\n readonly dataTypes?: readonly RuntimeCardDataType[]\n}\n\nexport interface RuntimeCardOptions {\n /** The web framework that draws the screen: a member's parts are the ones it carries. */\n readonly framework: Framework\n /** The members and exception primitives the host allows, by name. Every other is left out. */\n readonly members: ReadonlySet<string>\n}\n\n/**\n * The ARIA hooks a member takes, written once as `aria-*` on a member that takes all four.\n * The mark is not a word a document could hold as a key: a model that read `aria` in a\n * member's line wrote a prop of that name, holding an object.\n */\nconst ARIA = [...CONVENTION_PROPS].filter((name) => name.startsWith('aria-'))\n\n/** A type the vocabulary draws as a node: an element, a text, or a list of them. */\nconst NODE_TYPE = /^(?:React\\.)?(?:ReactNode|ReactElement|ReactPortal)\\b|^JSX\\.Element\\b/\n\n/** A React handler alias (`ReactEventHandler<T>`): a function of one DOM event, which an action does not receive. */\nconst EVENT_HANDLER_ALIAS = /^(?:React\\.)?[A-Z]\\w*EventHandler(?:<.*>)?$/s\n\n/** A ref, which an element holds in code and a document cannot write. */\nconst REF_TYPE = /^(?:React\\.)?(?:Ref|RefObject|MutableRefObject|RefCallback)</\n\n/** A parameter a callback receives that a document's action cannot use: a DOM event or element. */\nconst DOM_PARAMETER = /(?:^|[^\\w])(?:\\w*Event|HTML\\w*Element|Element)(?:<|$)/\n\n/** The text without the parentheses around all of it. */\nfunction unwrap(text: string): string {\n let inner = text.trim()\n while (inner.startsWith('(') && closing(inner, 0) === inner.length - 1) {\n inner = inner.slice(1, -1).trim()\n }\n return inner\n}\n\n/** The index of the bracket that closes the one at `open`, or -1. */\nfunction closing(text: string, open: number): number {\n let depth = 0\n for (let at = open; at < text.length; at += 1) {\n const char = text[at] as string\n if ('(<{['.includes(char)) depth += 1\n else if (')}]'.includes(char) || (char === '>' && text[at - 1] !== '=')) {\n depth -= 1\n if (depth === 0) return at\n }\n }\n return -1\n}\n\n/** The text split at each top-level comma. */\nfunction commaParts(text: string): string[] {\n const parts: string[] = []\n let depth = 0\n let start = 0\n for (let at = 0; at < text.length; at += 1) {\n const char = text[at] as string\n if ('(<{['.includes(char)) depth += 1\n else if (')}]'.includes(char) || (char === '>' && text[at - 1] !== '=')) depth -= 1\n else if (char === ',' && depth === 0) {\n parts.push(text.slice(start, at).trim())\n start = at + 1\n }\n }\n const last = text.slice(start).trim()\n if (last !== '') parts.push(last)\n return parts\n}\n\n/** A function type as the card writes it, or `null` when the text is not one. */\nfunction functionType(part: string, roles: ReadonlySet<string>): string | null {\n const text = unwrap(part)\n if (!text.startsWith('(')) return null\n const end = closing(text, 0)\n if (end === -1) return null\n const rest = text.slice(end + 1).trim()\n if (!rest.startsWith('=>')) return null\n const parameters = commaParts(text.slice(1, end)).filter((parameter) => {\n const colon = parameter.indexOf(':')\n return colon === -1 || !DOM_PARAMETER.test(parameter.slice(colon + 1).trim())\n })\n return `(${parameters.join(', ')}) => ${cardType(rest.slice(2), roles)}`\n}\n\n/**\n * A printed prop type as the card writes it: `undefined` left out, because\n * `*` marks a required prop and `?` an optional field; an icon role union as\n * `IconRole`, which the card lists once; `false | true` as `boolean`; a React\n * node type as `node`; a callback without the DOM event it is handed, which\n * an action does not receive; and the parts of a union joined by `|`, a\n * function among them in parentheses.\n */\nexport function cardType(printed: string, roles: ReadonlySet<string>): string {\n // An optional field of an object type says `?` already: `skipToContent?: string`.\n const flat = printed\n .replace(/\\s+/g, ' ')\n .trim()\n .replace(/\\?: ([^;{}]+?) \\| undefined;/g, '?: $1;')\n // A function's result runs to the end of the text: `() => void | Promise<void>` is one\n // function, as the validator reads it (`isActionType`), not a union with a promise.\n const whole = functionType(flat, roles)\n if (whole !== null) return whole\n const parts = unionParts(flat)\n if (parts.length === 0) return 'undefined'\n const literals = parts.filter((part) => /^\"[^\"]*\"$/.test(part)).map((part) => part.slice(1, -1))\n if (\n roles.size > 0 &&\n literals.length === parts.length &&\n literals.length === roles.size &&\n literals.every((literal) => roles.has(literal))\n ) {\n return 'IconRole'\n }\n const written = parts.map((part) => {\n const bare = unwrap(part)\n if (NODE_TYPE.test(bare)) return 'node'\n if (EVENT_HANDLER_ALIAS.test(bare)) return '() => void'\n return functionType(bare, roles) ?? bare.replace(/^readonly /, '')\n })\n const boolean = written.includes('false') && written.includes('true')\n const node = written.includes('node')\n const kept = written.filter(\n (part) =>\n !(boolean && (part === 'false' || part === 'true')) &&\n // A node is already a text or a number.\n !(node && (part === 'string' || part === 'number')),\n )\n if (boolean) kept.unshift('boolean')\n const distinct = [...new Set(kept)]\n // A function in a union is parenthesised, so its result does not read as part of the union.\n return distinct\n .map((part) => (distinct.length > 1 && part.includes('=>') ? `(${part})` : part))\n .join('|')\n}\n\n/** A function's printed result that is nothing: what an action returns. */\nconst NOTHING =\n /=> (?:void|undefined|Promise<(?:void|undefined)>)(?:\\|(?:void|undefined|Promise<(?:void|undefined)>))*\\)?$/\n\n/**\n * `name: type`, `*` marking a required one; the four ARIA hooks as `aria-*`\n * where all four are taken. A ref is left out, as a document cannot hold one.\n * With `questions`, a function that returns a value is written `fn`: a\n * data type's field of that kind cannot be given by a document at all, so its\n * signature says nothing a document can use.\n */\nfunction propList(\n props: readonly CardProp[],\n roles: ReadonlySet<string>,\n questions = false,\n): string[] {\n const own = props.filter(\n (prop) =>\n !prop.name.includes('.') && !unionParts(prop.type).every((part) => REF_TYPE.test(part)),\n )\n const names = new Set(own.map((prop) => prop.name))\n const allAria = ARIA.every((name) => names.has(name))\n const written = own\n .filter((prop) => !(allAria && ARIA.includes(prop.name)))\n .map((prop) => {\n const type = cardType(prop.type, roles)\n const question = questions && isFunctionPrint(prop.type) && !NOTHING.test(type)\n return `${prop.name}${prop.optional ? '' : '*'}: ${question ? 'fn' : type}`\n })\n return allAria ? [...written, 'aria-*'] : written\n}\n\n/** One member, then a line under it for each part the framework carries. */\nfunction memberLines(\n member: RuntimeCardMember,\n framework: Framework,\n roles: ReadonlySet<string>,\n): string[] {\n const segments = propList(member.props, roles)\n if (member.grid !== null) {\n segments.push(\n `cells: ${Object.entries(member.grid)\n .map(([variant, tones]) => `${variant}(${tones.join('|')})`)\n .join(' ')}`,\n )\n }\n const purpose = member.purpose === '' ? '' : ` — ${member.purpose}`\n const lines = [`- **${member.name}**${purpose}${segments.map((s) => ` · ${s}`).join('')}`]\n for (const part of shippedParts(member, DEFAULT_PLATFORM, framework)) {\n // A part whose props the registry does not record cannot be checked, so a document cannot compose it.\n const recorded = member.parts.find((candidate) => candidate.name === part.name)\n if (recorded === undefined) continue\n const props = propList(recorded.props, roles)\n lines.push(\n ` - **${member.name}.${part.name}**${props.length === 0 ? '' : ` · ${props.join(' · ')}`}`,\n )\n }\n return lines\n}\n\n/** Whether a printed type is a function, alone or in a union with `undefined`: a callback, not data. */\nfunction isFunctionPrint(printed: string): boolean {\n const flat = printed.replace(/\\s+/g, ' ').trim()\n if (functionType(flat, new Set()) !== null) return true\n const parts = unionParts(flat)\n return (\n parts.length > 0 &&\n parts.every(\n (part) => functionType(part, new Set()) !== null || EVENT_HANDLER_ALIAS.test(unwrap(part)),\n )\n )\n}\n\n/**\n * The data types section: each named data type the listed members' props\n * take, the types those types' fields take, and so on, each printed once,\n * sorted by name. A callback's parameters are not data a document writes,\n * so a type only a callback names is left out. A type that is the props of\n * a listed member (`StatProps`) points at the member's line.\n */\nfunction dataTypeLines(\n vocabulary: RuntimeCardVocabulary,\n listed: readonly RuntimeCardMember[],\n primitives: readonly RuntimeCardPrimitive[],\n framework: Framework,\n roles: ReadonlySet<string>,\n): string[] {\n const catalogue = new Map((vocabulary.dataTypes ?? []).map((type) => [type.name, type]))\n if (catalogue.size === 0) return []\n const reached = new Set<string>()\n const queue: string[] = []\n const read = (printed: string) => {\n if (isFunctionPrint(printed)) return\n for (const name of printed.match(/\\b[A-Z][A-Za-z0-9]*\\b/g) ?? []) {\n if (catalogue.has(name) && !reached.has(name)) {\n reached.add(name)\n queue.push(name)\n }\n }\n }\n for (const member of listed) {\n for (const prop of member.props) if (!prop.name.includes('.')) read(prop.type)\n for (const part of shippedParts(member, DEFAULT_PLATFORM, framework)) {\n const recorded = member.parts.find((candidate) => candidate.name === part.name)\n for (const prop of recorded?.props ?? []) read(prop.type)\n }\n }\n for (const primitive of primitives) for (const prop of primitive.props) read(prop.type)\n for (let next = queue.shift(); next !== undefined; next = queue.shift()) {\n const type = catalogue.get(next)\n for (const member of type?.union ?? []) read(member)\n for (const field of type?.fields ?? []) read(field.type)\n }\n if (reached.size === 0) return []\n\n const members = new Set(listed.map((member) => member.name))\n const lines = [...catalogue.values()]\n .filter((type) => reached.has(type.name))\n .map((type) => {\n const name = `**${type.name}${type.params.length === 0 ? '' : `<${type.params.join(', ')}>`}**`\n if (type.union !== undefined) return `- ${name} = ${type.union.join(' | ')}`\n const owner = type.name.endsWith('Props') ? type.name.slice(0, -'Props'.length) : ''\n if (members.has(owner)) return `- ${name} · the props of \\`${owner}\\``\n return `- ${name}${propList(type.fields, roles, true)\n .map((field) => ` · ${field}`)\n .join('')}`\n })\n return [\n '### Data types',\n '',\n ...wrapped(\n 'A prop typed with one of these takes an object: write it as `{ \"$object\": { … } }` with ' +\n 'the fields listed, `*` marking a required one, or bind the prop to an input that holds ' +\n 'it. A `node` field takes an element. A function field cannot be written as a value: one ' +\n 'shown by its signature returns nothing and takes a binding to an action input of that ' +\n 'type; one shown as `fn` returns a value, and a document cannot give it.',\n 96,\n ),\n '',\n ...lines,\n '',\n ]\n}\n\n/**\n * The card's members section, for the members a host allows: a legend, the\n * members tier by tier in the system card's reading order, the exception\n * primitives, the data types their props take, and the icon roles when a\n * member listed takes one.\n */\nexport function renderRuntimeCard(\n vocabulary: RuntimeCardVocabulary,\n options: RuntimeCardOptions,\n): string {\n const { framework, members } = options\n const roles = new Set(vocabulary.icons.roles.map((role) => role.name))\n const listed = vocabulary.components.filter((member) => members.has(member.name))\n const out: string[] = [\n '## Members',\n '',\n ...wrapped(\n 'One line per member: what it is for, then its props as `name: type`, `*` marking a ' +\n 'required one, then its lawful variant × tone `cells`; a part (`Member.Part`) is a line ' +\n 'under its member. `node` is an element, a text, or a list of them. A function type is ' +\n 'a callback: bind it to an input of that type. `aria-*` stands for four props, each ' +\n `written under its own name (${ARIA.map((name) => `\\`${name}\\``).join(', ')}); no member ` +\n 'has a prop named `aria`. A member takes no prop it does not list, and takes children ' +\n 'only where it lists `children`.',\n 96,\n ),\n '',\n ]\n\n const tiers = [...new Set([...TIER_ORDER, ...listed.map((member) => member.tier)])]\n for (const tier of tiers) {\n const inTier = listed.filter((member) => member.tier === tier)\n if (inTier.length === 0) continue\n out.push(`### ${TIER_TITLE[tier] ?? tier}`, '')\n for (const member of inTier) out.push(...memberLines(member, framework, roles))\n out.push('')\n }\n\n const primitives = vocabulary.exceptions.primitives.filter((primitive) =>\n members.has(primitive.name),\n )\n if (primitives.length > 0) {\n out.push('### Declared exceptions', '')\n for (const primitive of primitives) {\n const props = propList(primitive.props, roles)\n out.push(\n `- **${primitive.name}** (rung ${primitive.rung}) — ${primitive.purpose}` +\n props.map((prop) => ` · ${prop}`).join(''),\n )\n }\n out.push('')\n }\n\n out.push(...dataTypeLines(vocabulary, listed, primitives, framework, roles))\n\n if (out.some((line) => line.includes('IconRole'))) {\n out.push(\n '### Icon roles',\n '',\n ...wrapped(\n 'An `IconRole` is a meaning, never a glyph name, and one of: ' +\n `${vocabulary.icons.roles.map((role) => role.name).join(', ')}.`,\n 96,\n ),\n '',\n )\n }\n return out.join('\\n')\n}\n","import { DEFAULT_FRAMEWORK } from '@polymorph/registry/frameworks'\nimport { renderRuntimeCard } from '@polymorph/registry/runtime-card'\nimport { SPEC_ID } from '@polymorph/spec/schema'\n\nimport { allowedMembers, type MemberOptions, type ScreenVocabulary } from './members'\nimport { ADDRESS_KEYS, ADDRESS_SCHEMES } from './urls'\nimport { VOCABULARY } from './vocabulary'\n\n/**\n * The run-time card: what a host puts in a model's system prompt so the\n * model writes a screen the host can draw, in one call, with no tool.\n *\n * It has three parts. The opening says what the model is doing. The members\n * section is the registry's (`renderRuntimeCard` in\n * `packages/registry/src/runtime-card.ts`), rendered from the vocabulary\n * table the host installed, for the members the host allows. The output\n * contract says what the answer is: one `polymorph-screen/1` document, and\n * what the host does with each part of it at run time. A host builds its\n * prompt from the version it runs, so the card never names a member the host\n * cannot draw.\n */\n\nexport interface CardOptions extends MemberOptions {\n /** The vocabulary to describe. The generated table when absent. */\n vocabulary?: ScreenVocabulary\n}\n\n/** `a`, `a and b`, `a, b and c`. */\nconst listed = (items: readonly string[]): string =>\n items.length <= 1 ? items.join('') : `${items.slice(0, -1).join(', ')} and ${items.at(-1)}`\n\nconst code = (text: string) => `\\`${text}\\``\n\n/** The opening: what the model is asked to do, and what it cannot do. */\nconst OPENING = [\n '# Writing a screen',\n '',\n 'You write one screen as a document that names members of a closed vocabulary, their props and',\n 'what they hold. The host draws it at once, in its own theme: every colour, space, size and motion',\n 'is the theme’s, so a document has no field for a style, a class or an expression. Choose members',\n 'and variants; bind content to the inputs the host hands the screen.',\n '',\n].join('\\n')\n\n/** The output contract, for the members a host allows. */\nexport function outputContract(options: CardOptions = {}): string {\n const vocabulary = options.vocabulary ?? VOCABULARY\n const allowed = allowedMembers(vocabulary, options)\n const scopes = vocabulary.exceptions.primitives.filter((primitive) => allowed.has(primitive.name))\n const patched = vocabulary.components\n .filter((member) => allowed.has(member.name))\n .filter((member) => member.props.some((prop) => prop.name === 'patch'))\n .map((member) => code(member.name))\n const rungs = [\n ...scopes.map((primitive) => `${code(primitive.name)} is rung ${primitive.rung}`),\n ...(patched.length === 0 ? [] : [`a ${code('patch')} prop (on ${listed(patched)}) is rung 3`]),\n ]\n const addresses = listed([...ADDRESS_KEYS].map(code))\n const schemes = ADDRESS_SCHEMES.map(code)\n\n const lines = [\n '## What you write',\n '',\n `Answer with one document in the ${code(SPEC_ID)} format, as JSON in one fenced \\`json\\``,\n 'block. The host draws it while it arrives, so write its keys in this order: `spec`, `name`,',\n '`purpose`, `inputs`, and `root` last.',\n '',\n `- ${code('spec')} is ${code(JSON.stringify(SPEC_ID))}. ${code('name')} is a PascalCase name for the screen that no member has.`,\n ` ${code('purpose')} is one sentence.`,\n '- `inputs` lists what the host hands the screen, each `{ \"name\": …, \"type\": … }`. A data input is',\n ' named for a key of the host’s data, and its `type` is a TypeScript type (`string`, `Order[]`);',\n ' an input the host has no value for is empty. An input whose type is a function that returns',\n ' nothing (`(id: string) => void`) is an action: when a member calls it, the host is told its',\n ' name, its arguments and the value of every named control. Bind each callback prop the person',\n ' acts through to an action input of the callback’s type. A function that returns a value',\n ' (`(row: Row) => string`) is answered with an empty answer and the host is never told.',\n '- `root` is an element: `{ \"component\": …, \"props\": { … }, \"children\": [ … ] }`, `props` and',\n ' `children` left out when empty. `component` is a member or a part (`Member.Part`) listed',\n ' above. Every prop goes inside `props`, and a member takes no prop and no child it does not list.',\n ' Write an element’s plain props before its props that hold elements, and `props` before',\n ' `children`: the screen is drawn as it is written, and an element is drawn once its plain',\n ' props are whole.',\n '- A value is a string, a number, a boolean, `null`, an element, a list of values, a binding',\n ' `{ \"$\": \"input\" }` or `{ \"$\": \"input.field\" }`, or a structured object `{ \"$object\": { … } }`',\n ' (an option, a column). A binding names a declared input and is never an expression.',\n '- There is no condition and no loop: every element is drawn whenever the screen is. Content that',\n ' is sometimes absent is a prop bound to an input that is empty while there is nothing to show.',\n '- A control with a `name` reports its current value under that name with every action, so name',\n ' each field a person fills in. A name is used once in a screen: two forms on one screen name',\n ' their fields apart (`signInEmail`, `signUpEmail`), because one name holds one value.',\n `- An address (${addresses}) is relative, a fragment, or ${schemes.slice(0, -1).join(', ')} or ${schemes.at(-1) ?? ''}.`,\n ]\n if (rungs.length > 0) {\n lines.push(\n `- A declared exception: ${listed(rungs)}. An element that is one carries`,\n ' `\"exception\": { \"rung\": …, \"because\": \"…\" }`, the reason in four words or more; no other',\n ' element has `exception`.',\n )\n }\n return `${lines.join('\\n')}\\n`\n}\n\n/**\n * The run-time card for the members a host allows: the opening, the members\n * section and the output contract. Its default is every member the\n * framework draws but those that host another library's code.\n */\nexport function runtimeCard(options: CardOptions = {}): string {\n const vocabulary = options.vocabulary ?? VOCABULARY\n const members = renderRuntimeCard(vocabulary, {\n framework: options.framework ?? DEFAULT_FRAMEWORK,\n members: allowedMembers(vocabulary, options),\n })\n return `${OPENING}\\n${members}\\n${outputContract(options)}`\n}\n"],"mappings":";;;;AAWA,IAAaO,oBAAwC,IAAI,IAAI;CAC3D;CACA;CACA;CACA;CACA;AACF,CAAC,GAGYC,IAAgC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEaC,IAA+C;CAC1D,MAAM;CACN,QAAQ;CACR,UAAU;CACV,UAAU;CACV,WAAW;CACX,IAAI;CACJ,YAAY;AACd;AAMA,SAAgBC,EAAQ,GAAmB,IAAQ,IAAc;CAC/D,IAAMC,IAAQC,EAAU,MAAM,sBAAsB,KAAK,CAAC,GACpDC,IAAkB,CAAC,GACrBC,IAAO;CACX,KAAK,IAAMC,KAAQJ,GACjB,AAAIG,MAAS,MAAMA,EAAK,SAAS,IAAIC,EAAK,SAASC,KACjDH,EAAM,KAAKC,CAAI,GACf,IAAOC,KACF,IAAOD,MAAS,KAAKC,IAAO,GAAGD,EAAK,GAAGC;CAGhD,OADID,MAAS,MAAID,EAAM,KAAKC,CAAI,GACz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AMA,EAAQ,GAAG,EAAE,KAAK,GAAG;CACxH;CAQA,OAPIF,EAAM,SAAS,KACjBzF,EAAM,KACJ,2BAA2BoE,EAAOqB,CAAK,EAAE,mCACzC,sGACA,4BACF,GAEK,GAAGzF,EAAM,KAAK,IAAI,EAAE;AAC7B;AAOA,SAAgB4F,EAAY,IAAuB,CAAC,GAAW;CAC7D,IAAM5B,IAAaY,EAAQ,cAAcnF;CAKzC,OAAO,GAAG2F,EAAQ,IAJFT,EAAkBX,GAAY;EAC5C,WAAWY,EAAQ,aAAA;EACnB,SAASvF,EAAe2E,GAAYY,CAAO;CAC7C,CACsB,EAAQ,IAAIS,EAAeT,CAAO;AAC1D"}
|
|
1
|
+
{"version":3,"file":"card-CVzvz0j_.js","names":["unionParts","shippedParts","allowedMembers","SPEC_ID","ADDRESS_SCHEMES","ADDRESS_KEYS","VOCABULARY","CONVENTION_PROPS","TIER_ORDER","TIER_TITLE","wrapped","words","paragraph","lines","line","word","width","ARIA","name","NODE_TYPE","EVENT_HANDLER_ALIAS","REF_TYPE","DOM_PARAMETER","unwrap","inner","text","closing","depth","at","open","char","commaParts","parts","start","last","functionType","part","end","rest","colon","parameter","cardType","roles","flat","printed","whole","literals","literal","written","bare","boolean","node","kept","distinct","NOTHING","propList","own","props","prop","names","allAria","type","question","questions","isFunctionPrint","memberLines","segments","member","variant","tones","purpose","s","framework","recorded","candidate","dataTypeLines","catalogue","vocabulary","reached","queue","read","listed","primitive","primitives","next","field","members","owner","renderRuntimeCard","options","role","out","tiers","tier","inTier","items","code","OPENING","outputContract","allowed","scopes","patched","rungs","addresses","schemes","runtimeCard"],"sources":["../../../registry/src/card-parts.ts","../../../registry/src/runtime-card.ts","../../src/card.ts"],"sourcesContent":["/**\n * What the system card (`card.ts`) and the run-time card (`runtime-card.ts`)\n * share: the conventions stated once, the tiers' reading order and titles,\n * how a paragraph is wrapped, and how a member React draws through a function\n * is found.\n *\n * It imports nothing, so the run-time card reaches none of the registry\n * builder through it.\n */\n\n/** Conventions the whole vocabulary shares, stated once and omitted from each row. */\nexport const CONVENTION_PROPS: ReadonlySet<string> = new Set([\n 'children',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-required',\n])\n\n// Content, then data, then pages. This is the reading order `galleries.ts` uses.\nexport const TIER_ORDER: readonly string[] = [\n 'icon',\n 'layout',\n 'controls',\n 'overlays',\n 'structure',\n 'charts',\n 'ai',\n 'archetypes',\n]\n\nexport const TIER_TITLE: Readonly<Record<string, string>> = {\n icon: 'Iconography',\n layout: 'Layout primitives',\n controls: 'Controls',\n overlays: 'Overlays',\n structure: 'Structure',\n ai: 'AI — the conversation',\n archetypes: 'Page archetypes',\n}\n\n/**\n * A paragraph broken into lines of at most `width` characters, at spaces outside\n * a code span, so `polymorph init --framework` stays on one line.\n */\nexport function wrapped(paragraph: string, width = 84): string[] {\n const words = paragraph.match(/(?:`[^`]*`|[^\\s`])+/g) ?? []\n const lines: string[] = []\n let line = ''\n for (const word of words) {\n if (line !== '' && line.length + 1 + word.length > width) {\n lines.push(line)\n line = word\n } else line = line === '' ? word : `${line} ${word}`\n }\n if (line !== '') lines.push(line)\n return lines\n}\n\n/** An export as `optionsCarrier` reads it: its kind and the props it takes. */\ninterface CarrierExport {\n readonly kind: string\n readonly props: readonly { readonly name: string }[]\n}\n\n/**\n * The function export whose options are the member's own props (`toast()` for\n * Toast), or `undefined`. React has no component of the member's name then:\n * a call site calls the function, and the member's props are its options.\n */\nexport function optionsCarrier<Export extends CarrierExport>(component: {\n readonly props: readonly { readonly name: string }[]\n readonly exports: readonly Export[]\n}): Export | undefined {\n const own = component.props.filter((prop) => !prop.name.includes('.'))\n const names = new Set(own.map((prop) => prop.name))\n return component.exports.find(\n (other) =>\n other.kind === 'function' &&\n other.props.length === own.length &&\n other.props.every((prop) => names.has(prop.name)),\n )\n}\n","import { CONVENTION_PROPS, TIER_ORDER, TIER_TITLE, wrapped } from './card-parts'\nimport { shippedParts, unionParts, type Framework, type PartsOwner } from './frameworks'\nimport { DEFAULT_PLATFORM } from './platforms'\n\n/**\n * The run-time card: the members a model may compose in a screen a host draws\n * at run time, each with what the model needs to write it lawfully without a\n * tool call.\n *\n * It is the system card's vocabulary section (`card.ts`) with the prop types\n * written out, because a model with no tool to look a prop up must know what\n * a prop takes: an enum's literals, whether it is text or a node, and the\n * signature of a callback it binds to an action. Everything a screen document\n * cannot use is left out: tokens, the red rules, the ladder beyond the rungs a\n * document declares, install facts, platforms and frameworks other than the\n * one drawing.\n *\n * It reads a vocabulary, not the registry: the registry is one, and the\n * run-time table (`screen-table.ts`) another, so `@polymorph/screen` renders\n * the card from the table a host installed. `packages/screen/src/card.test.ts`\n * holds the two renderings equal. The output contract that follows the card\n * in a model's prompt is the screen package's (`packages/screen/src/card.ts`).\n *\n * This module reads no file, so the browser can import it\n * (`@polymorph/registry/runtime-card`).\n */\n\ninterface CardProp {\n readonly name: string\n readonly type: string\n readonly optional: boolean\n}\n\n/** What the card reads of a member. */\nexport interface RuntimeCardMember extends PartsOwner<{\n readonly name: string\n readonly props: readonly CardProp[]\n}> {\n readonly name: string\n readonly tier: string\n readonly purpose: string\n readonly props: readonly CardProp[]\n readonly grid: Readonly<Record<string, readonly string[]>> | null\n}\n\n/** What the card reads of an exception primitive. */\nexport interface RuntimeCardPrimitive {\n readonly name: string\n readonly rung: number\n readonly purpose: string\n readonly props: readonly CardProp[]\n}\n\n/** What the card reads of a named data type a prop takes: its fields, or the types it is a union of. */\nexport interface RuntimeCardDataType {\n readonly name: string\n readonly params: readonly string[]\n readonly union?: readonly string[]\n readonly fields: readonly CardProp[]\n}\n\n/** What the card reads of a vocabulary: the registry and the run-time table both have it. */\nexport interface RuntimeCardVocabulary {\n readonly components: readonly RuntimeCardMember[]\n readonly exceptions: { readonly primitives: readonly RuntimeCardPrimitive[] }\n readonly icons: { readonly roles: readonly { readonly name: string }[] }\n /** The named data types the props take. A vocabulary without them gets a card without them. */\n readonly dataTypes?: readonly RuntimeCardDataType[]\n}\n\nexport interface RuntimeCardOptions {\n /** The web framework that draws the screen: a member's parts are the ones it carries. */\n readonly framework: Framework\n /** The members and exception primitives the host allows, by name. Every other is left out. */\n readonly members: ReadonlySet<string>\n}\n\n/**\n * The ARIA hooks a member takes, written once as `aria-*` on a member that takes all four.\n * The mark is not a word a document could hold as a key: a model that read `aria` in a\n * member's line wrote a prop of that name, holding an object.\n */\nconst ARIA = [...CONVENTION_PROPS].filter((name) => name.startsWith('aria-'))\n\n/** A type the vocabulary draws as a node: an element, a text, or a list of them. */\nconst NODE_TYPE = /^(?:React\\.)?(?:ReactNode|ReactElement|ReactPortal)\\b|^JSX\\.Element\\b/\n\n/** A React handler alias (`ReactEventHandler<T>`): a function of one DOM event, which an action does not receive. */\nconst EVENT_HANDLER_ALIAS = /^(?:React\\.)?[A-Z]\\w*EventHandler(?:<.*>)?$/s\n\n/** A ref, which an element holds in code and a document cannot write. */\nconst REF_TYPE = /^(?:React\\.)?(?:Ref|RefObject|MutableRefObject|RefCallback)</\n\n/** A parameter a callback receives that a document's action cannot use: a DOM event or element. */\nconst DOM_PARAMETER = /(?:^|[^\\w])(?:\\w*Event|HTML\\w*Element|Element)(?:<|$)/\n\n/** The text without the parentheses around all of it. */\nfunction unwrap(text: string): string {\n let inner = text.trim()\n while (inner.startsWith('(') && closing(inner, 0) === inner.length - 1) {\n inner = inner.slice(1, -1).trim()\n }\n return inner\n}\n\n/** The index of the bracket that closes the one at `open`, or -1. */\nfunction closing(text: string, open: number): number {\n let depth = 0\n for (let at = open; at < text.length; at += 1) {\n const char = text[at] as string\n if ('(<{['.includes(char)) depth += 1\n else if (')}]'.includes(char) || (char === '>' && text[at - 1] !== '=')) {\n depth -= 1\n if (depth === 0) return at\n }\n }\n return -1\n}\n\n/** The text split at each top-level comma. */\nfunction commaParts(text: string): string[] {\n const parts: string[] = []\n let depth = 0\n let start = 0\n for (let at = 0; at < text.length; at += 1) {\n const char = text[at] as string\n if ('(<{['.includes(char)) depth += 1\n else if (')}]'.includes(char) || (char === '>' && text[at - 1] !== '=')) depth -= 1\n else if (char === ',' && depth === 0) {\n parts.push(text.slice(start, at).trim())\n start = at + 1\n }\n }\n const last = text.slice(start).trim()\n if (last !== '') parts.push(last)\n return parts\n}\n\n/** A function type as the card writes it, or `null` when the text is not one. */\nfunction functionType(part: string, roles: ReadonlySet<string>): string | null {\n const text = unwrap(part)\n if (!text.startsWith('(')) return null\n const end = closing(text, 0)\n if (end === -1) return null\n const rest = text.slice(end + 1).trim()\n if (!rest.startsWith('=>')) return null\n const parameters = commaParts(text.slice(1, end)).filter((parameter) => {\n const colon = parameter.indexOf(':')\n return colon === -1 || !DOM_PARAMETER.test(parameter.slice(colon + 1).trim())\n })\n return `(${parameters.join(', ')}) => ${cardType(rest.slice(2), roles)}`\n}\n\n/**\n * A printed prop type as the card writes it: `undefined` left out, because\n * `*` marks a required prop and `?` an optional field; an icon role union as\n * `IconRole`, which the card lists once; `false | true` as `boolean`; a React\n * node type as `node`; a callback without the DOM event it is handed, which\n * an action does not receive; and the parts of a union joined by `|`, a\n * function among them in parentheses.\n */\nexport function cardType(printed: string, roles: ReadonlySet<string>): string {\n // An optional field of an object type says `?` already: `skipToContent?: string`.\n const flat = printed\n .replace(/\\s+/g, ' ')\n .trim()\n .replace(/\\?: ([^;{}]+?) \\| undefined;/g, '?: $1;')\n // A function's result runs to the end of the text: `() => void | Promise<void>` is one\n // function, as the validator reads it (`isActionType`), not a union with a promise.\n const whole = functionType(flat, roles)\n if (whole !== null) return whole\n const parts = unionParts(flat)\n if (parts.length === 0) return 'undefined'\n const literals = parts.filter((part) => /^\"[^\"]*\"$/.test(part)).map((part) => part.slice(1, -1))\n if (\n roles.size > 0 &&\n literals.length === parts.length &&\n literals.length === roles.size &&\n literals.every((literal) => roles.has(literal))\n ) {\n return 'IconRole'\n }\n const written = parts.map((part) => {\n const bare = unwrap(part)\n if (NODE_TYPE.test(bare)) return 'node'\n if (EVENT_HANDLER_ALIAS.test(bare)) return '() => void'\n return functionType(bare, roles) ?? bare.replace(/^readonly /, '')\n })\n const boolean = written.includes('false') && written.includes('true')\n const node = written.includes('node')\n const kept = written.filter(\n (part) =>\n !(boolean && (part === 'false' || part === 'true')) &&\n // A node is already a text or a number.\n !(node && (part === 'string' || part === 'number')),\n )\n if (boolean) kept.unshift('boolean')\n const distinct = [...new Set(kept)]\n // A function in a union is parenthesised, so its result does not read as part of the union.\n return distinct\n .map((part) => (distinct.length > 1 && part.includes('=>') ? `(${part})` : part))\n .join('|')\n}\n\n/** A function's printed result that is nothing: what an action returns. */\nconst NOTHING =\n /=> (?:void|undefined|Promise<(?:void|undefined)>)(?:\\|(?:void|undefined|Promise<(?:void|undefined)>))*\\)?$/\n\n/**\n * `name: type`, `*` marking a required one; the four ARIA hooks as `aria-*`\n * where all four are taken. A ref is left out, as a document cannot hold one.\n * With `questions`, a function that returns a value is written `fn`: a\n * data type's field of that kind cannot be given by a document at all, so its\n * signature says nothing a document can use.\n */\nfunction propList(\n props: readonly CardProp[],\n roles: ReadonlySet<string>,\n questions = false,\n): string[] {\n const own = props.filter(\n (prop) =>\n !prop.name.includes('.') && !unionParts(prop.type).every((part) => REF_TYPE.test(part)),\n )\n const names = new Set(own.map((prop) => prop.name))\n const allAria = ARIA.every((name) => names.has(name))\n const written = own\n .filter((prop) => !(allAria && ARIA.includes(prop.name)))\n .map((prop) => {\n const type = cardType(prop.type, roles)\n const question = questions && isFunctionPrint(prop.type) && !NOTHING.test(type)\n return `${prop.name}${prop.optional ? '' : '*'}: ${question ? 'fn' : type}`\n })\n return allAria ? [...written, 'aria-*'] : written\n}\n\n/** One member, then a line under it for each part the framework carries. */\nfunction memberLines(\n member: RuntimeCardMember,\n framework: Framework,\n roles: ReadonlySet<string>,\n): string[] {\n const segments = propList(member.props, roles)\n if (member.grid !== null) {\n segments.push(\n `cells: ${Object.entries(member.grid)\n .map(([variant, tones]) => `${variant}(${tones.join('|')})`)\n .join(' ')}`,\n )\n }\n const purpose = member.purpose === '' ? '' : ` — ${member.purpose}`\n const lines = [`- **${member.name}**${purpose}${segments.map((s) => ` · ${s}`).join('')}`]\n for (const part of shippedParts(member, DEFAULT_PLATFORM, framework)) {\n // A part whose props the registry does not record cannot be checked, so a document cannot compose it.\n const recorded = member.parts.find((candidate) => candidate.name === part.name)\n if (recorded === undefined) continue\n const props = propList(recorded.props, roles)\n lines.push(\n ` - **${member.name}.${part.name}**${props.length === 0 ? '' : ` · ${props.join(' · ')}`}`,\n )\n }\n return lines\n}\n\n/** Whether a printed type is a function, alone or in a union with `undefined`: a callback, not data. */\nfunction isFunctionPrint(printed: string): boolean {\n const flat = printed.replace(/\\s+/g, ' ').trim()\n if (functionType(flat, new Set()) !== null) return true\n const parts = unionParts(flat)\n return (\n parts.length > 0 &&\n parts.every(\n (part) => functionType(part, new Set()) !== null || EVENT_HANDLER_ALIAS.test(unwrap(part)),\n )\n )\n}\n\n/**\n * The data types section: each named data type the listed members' props\n * take, the types those types' fields take, and so on, each printed once,\n * sorted by name. A callback's parameters are not data a document writes,\n * so a type only a callback names is left out. A type that is the props of\n * a listed member (`StatProps`) points at the member's line.\n */\nfunction dataTypeLines(\n vocabulary: RuntimeCardVocabulary,\n listed: readonly RuntimeCardMember[],\n primitives: readonly RuntimeCardPrimitive[],\n framework: Framework,\n roles: ReadonlySet<string>,\n): string[] {\n const catalogue = new Map((vocabulary.dataTypes ?? []).map((type) => [type.name, type]))\n if (catalogue.size === 0) return []\n const reached = new Set<string>()\n const queue: string[] = []\n const read = (printed: string) => {\n if (isFunctionPrint(printed)) return\n for (const name of printed.match(/\\b[A-Z][A-Za-z0-9]*\\b/g) ?? []) {\n if (catalogue.has(name) && !reached.has(name)) {\n reached.add(name)\n queue.push(name)\n }\n }\n }\n for (const member of listed) {\n for (const prop of member.props) if (!prop.name.includes('.')) read(prop.type)\n for (const part of shippedParts(member, DEFAULT_PLATFORM, framework)) {\n const recorded = member.parts.find((candidate) => candidate.name === part.name)\n for (const prop of recorded?.props ?? []) read(prop.type)\n }\n }\n for (const primitive of primitives) for (const prop of primitive.props) read(prop.type)\n for (let next = queue.shift(); next !== undefined; next = queue.shift()) {\n const type = catalogue.get(next)\n for (const member of type?.union ?? []) read(member)\n for (const field of type?.fields ?? []) read(field.type)\n }\n if (reached.size === 0) return []\n\n const members = new Set(listed.map((member) => member.name))\n const lines = [...catalogue.values()]\n .filter((type) => reached.has(type.name))\n .map((type) => {\n const name = `**${type.name}${type.params.length === 0 ? '' : `<${type.params.join(', ')}>`}**`\n if (type.union !== undefined) return `- ${name} = ${type.union.join(' | ')}`\n const owner = type.name.endsWith('Props') ? type.name.slice(0, -'Props'.length) : ''\n if (members.has(owner)) return `- ${name} · the props of \\`${owner}\\``\n return `- ${name}${propList(type.fields, roles, true)\n .map((field) => ` · ${field}`)\n .join('')}`\n })\n return [\n '### Data types',\n '',\n ...wrapped(\n 'A prop typed with one of these takes an object: write it as `{ \"$object\": { … } }` with ' +\n 'the fields listed, `*` marking a required one, or bind the prop to an input that holds ' +\n 'it. A `node` field takes an element. A function field cannot be written as a value: one ' +\n 'shown by its signature returns nothing and takes a binding to an action input of that ' +\n 'type; one shown as `fn` returns a value, and a document cannot give it.',\n 96,\n ),\n '',\n ...lines,\n '',\n ]\n}\n\n/**\n * The card's members section, for the members a host allows: a legend, the\n * members tier by tier in the system card's reading order, the exception\n * primitives, the data types their props take, and the icon roles when a\n * member listed takes one.\n */\nexport function renderRuntimeCard(\n vocabulary: RuntimeCardVocabulary,\n options: RuntimeCardOptions,\n): string {\n const { framework, members } = options\n const roles = new Set(vocabulary.icons.roles.map((role) => role.name))\n const listed = vocabulary.components.filter((member) => members.has(member.name))\n const out: string[] = [\n '## Members',\n '',\n ...wrapped(\n 'One line per member: what it is for, then its props as `name: type`, `*` marking a ' +\n 'required one, then its lawful variant × tone `cells`; a part (`Member.Part`) is a line ' +\n 'under its member. `node` is an element, a text, or a list of them. A function type is ' +\n 'a callback: bind it to an input of that type. `aria-*` stands for four props, each ' +\n `written under its own name (${ARIA.map((name) => `\\`${name}\\``).join(', ')}); no member ` +\n 'has a prop named `aria`. A member takes no prop it does not list, and takes children ' +\n 'only where it lists `children`.',\n 96,\n ),\n '',\n ]\n\n const tiers = [...new Set([...TIER_ORDER, ...listed.map((member) => member.tier)])]\n for (const tier of tiers) {\n const inTier = listed.filter((member) => member.tier === tier)\n if (inTier.length === 0) continue\n out.push(`### ${TIER_TITLE[tier] ?? tier}`, '')\n for (const member of inTier) out.push(...memberLines(member, framework, roles))\n out.push('')\n }\n\n const primitives = vocabulary.exceptions.primitives.filter((primitive) =>\n members.has(primitive.name),\n )\n if (primitives.length > 0) {\n out.push('### Declared exceptions', '')\n for (const primitive of primitives) {\n const props = propList(primitive.props, roles)\n out.push(\n `- **${primitive.name}** (rung ${primitive.rung}) — ${primitive.purpose}` +\n props.map((prop) => ` · ${prop}`).join(''),\n )\n }\n out.push('')\n }\n\n out.push(...dataTypeLines(vocabulary, listed, primitives, framework, roles))\n\n if (out.some((line) => line.includes('IconRole'))) {\n out.push(\n '### Icon roles',\n '',\n ...wrapped(\n 'An `IconRole` is a meaning, never a glyph name, and one of: ' +\n `${vocabulary.icons.roles.map((role) => role.name).join(', ')}.`,\n 96,\n ),\n '',\n )\n }\n return out.join('\\n')\n}\n","import { DEFAULT_FRAMEWORK } from '@polymorph/registry/frameworks'\nimport { renderRuntimeCard } from '@polymorph/registry/runtime-card'\nimport { SPEC_ID } from '@polymorph/spec/schema'\n\nimport { allowedMembers, type MemberOptions, type ScreenVocabulary } from './members'\nimport { ADDRESS_KEYS, ADDRESS_SCHEMES } from './urls'\nimport { VOCABULARY } from './vocabulary'\n\n/**\n * The run-time card: what a host puts in a model's system prompt so the\n * model writes a screen the host can draw, in one call, with no tool.\n *\n * It has three parts. The opening says what the model is doing. The members\n * section is the registry's (`renderRuntimeCard` in\n * `packages/registry/src/runtime-card.ts`), rendered from the vocabulary\n * table the host installed, for the members the host allows. The output\n * contract says what the answer is: one `polymorph-screen/1` document, and\n * what the host does with each part of it at run time. A host builds its\n * prompt from the version it runs, so the card never names a member the host\n * cannot draw.\n */\n\nexport interface CardOptions extends MemberOptions {\n /** The vocabulary to describe. The generated table when absent. */\n vocabulary?: ScreenVocabulary\n}\n\n/** `a`, `a and b`, `a, b and c`. */\nconst listed = (items: readonly string[]): string =>\n items.length <= 1 ? items.join('') : `${items.slice(0, -1).join(', ')} and ${items.at(-1)}`\n\nconst code = (text: string) => `\\`${text}\\``\n\n/** The opening: what the model is asked to do, and what it cannot do. */\nconst OPENING = [\n '# Writing a screen',\n '',\n 'You write one screen as a document that names members of a closed vocabulary, their props and',\n 'what they hold. The host draws it at once, in its own theme: every colour, space, size and motion',\n 'is the theme’s, so a document has no field for a style, a class or an expression. Choose members',\n 'and variants; bind content to the inputs the host hands the screen.',\n '',\n].join('\\n')\n\n/** The output contract, for the members a host allows. */\nexport function outputContract(options: CardOptions = {}): string {\n const vocabulary = options.vocabulary ?? VOCABULARY\n const allowed = allowedMembers(vocabulary, options)\n const scopes = vocabulary.exceptions.primitives.filter((primitive) => allowed.has(primitive.name))\n const patched = vocabulary.components\n .filter((member) => allowed.has(member.name))\n .filter((member) => member.props.some((prop) => prop.name === 'patch'))\n .map((member) => code(member.name))\n const rungs = [\n ...scopes.map((primitive) => `${code(primitive.name)} is rung ${primitive.rung}`),\n ...(patched.length === 0 ? [] : [`a ${code('patch')} prop (on ${listed(patched)}) is rung 3`]),\n ]\n const addresses = listed([...ADDRESS_KEYS].map(code))\n const schemes = ADDRESS_SCHEMES.map(code)\n\n const lines = [\n '## What you write',\n '',\n `Answer with one document in the ${code(SPEC_ID)} format, as JSON in one fenced \\`json\\``,\n 'block. The host draws it while it arrives, so write its keys in this order: `spec`, `name`,',\n '`purpose`, `inputs`, and `root` last.',\n '',\n `- ${code('spec')} is ${code(JSON.stringify(SPEC_ID))}. ${code('name')} is a PascalCase name for the screen that no member has.`,\n ` ${code('purpose')} is one sentence.`,\n '- `inputs` lists what the host hands the screen, each `{ \"name\": …, \"type\": … }`. A data input is',\n ' named for a key of the host’s data, and its `type` is a TypeScript type (`string`, `Order[]`);',\n ' an input the host has no value for is empty. An input whose type is a function that returns',\n ' nothing (`(id: string) => void`) is an action: when a member calls it, the host is told its',\n ' name, its arguments and the value of every named control. Bind each callback prop the person',\n ' acts through to an action input of the callback’s type. A function that returns a value',\n ' (`(row: Row) => string`) is answered with an empty answer and the host is never told.',\n '- `root` is an element: `{ \"component\": …, \"props\": { … }, \"children\": [ … ] }`, `props` and',\n ' `children` left out when empty. `component` is a member or a part (`Member.Part`) listed',\n ' above. Every prop goes inside `props`, and a member takes no prop and no child it does not list.',\n ' Write an element’s plain props before its props that hold elements, and `props` before',\n ' `children`: the screen is drawn as it is written, and an element is drawn once its plain',\n ' props are whole.',\n '- A value is a string, a number, a boolean, `null`, an element, a list of values, a binding',\n ' `{ \"$\": \"input\" }` or `{ \"$\": \"input.field\" }`, or a structured object `{ \"$object\": { … } }`',\n ' (an option, a column). A binding names a declared input and is never an expression.',\n '- There is no condition and no loop: every element is drawn whenever the screen is. Content that',\n ' is sometimes absent is a prop bound to an input that is empty while there is nothing to show.',\n '- A control with a `name` reports its current value under that name with every action, so name',\n ' each field a person fills in. A name is used once in a screen: two forms on one screen name',\n ' their fields apart (`signInEmail`, `signUpEmail`), because one name holds one value.',\n `- An address (${addresses}) is relative, a fragment, or ${schemes.slice(0, -1).join(', ')} or ${schemes.at(-1) ?? ''}.`,\n ]\n if (rungs.length > 0) {\n lines.push(\n `- A declared exception: ${listed(rungs)}. An element that is one carries`,\n ' `\"exception\": { \"rung\": …, \"because\": \"…\" }`, the reason in four words or more; no other',\n ' element has `exception`.',\n )\n }\n return `${lines.join('\\n')}\\n`\n}\n\n/**\n * The run-time card for the members a host allows: the opening, the members\n * section and the output contract. Its default is every member the\n * framework draws but those that host another library's code.\n */\nexport function runtimeCard(options: CardOptions = {}): string {\n const vocabulary = options.vocabulary ?? VOCABULARY\n const members = renderRuntimeCard(vocabulary, {\n framework: options.framework ?? DEFAULT_FRAMEWORK,\n members: allowedMembers(vocabulary, options),\n })\n return `${OPENING}\\n${members}\\n${outputContract(options)}`\n}\n"],"mappings":";;;;AAWA,IAAaO,oBAAwC,IAAI,IAAI;CAC3D;CACA;CACA;CACA;CACA;AACF,CAAC,GAGYC,IAAgC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEaC,IAA+C;CAC1D,MAAM;CACN,QAAQ;CACR,UAAU;CACV,UAAU;CACV,WAAW;CACX,IAAI;CACJ,YAAY;AACd;AAMA,SAAgBC,EAAQ,GAAmB,IAAQ,IAAc;CAC/D,IAAMC,IAAQC,EAAU,MAAM,sBAAsB,KAAK,CAAC,GACpDC,IAAkB,CAAC,GACrBC,IAAO;CACX,KAAK,IAAMC,KAAQJ,GACjB,AAAIG,MAAS,MAAMA,EAAK,SAAS,IAAIC,EAAK,SAASC,KACjDH,EAAM,KAAKC,CAAI,GACf,IAAOC,KACF,IAAOD,MAAS,KAAKC,IAAO,GAAGD,EAAK,GAAGC;CAGhD,OADID,MAAS,MAAID,EAAM,KAAKC,CAAI,GACzBD;AACT;;;ACyBA,IAAMI,IAAO,CAAC,GAAGV,CAAgB,CAAC,CAAC,QAAQ,MAASW,EAAK,WAAW,OAAO,CAAC,GAGtEC,IAAY,yEAGZC,IAAsB,gDAGtBC,IAAW,gEAGXC,IAAgB;AAGtB,SAASC,EAAO,GAAsB;CACpC,IAAIC,IAAQC,EAAK,KAAK;CACtB,OAAOD,EAAM,WAAW,GAAG,KAAKE,EAAQF,GAAO,CAAC,MAAMA,EAAM,SAAS,IACnE,IAAQA,EAAM,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK;CAElC,OAAOA;AACT;AAGA,SAASE,EAAQ,GAAc,GAAsB;CACnD,IAAIC,IAAQ;CACZ,KAAK,IAAIC,IAAKC,GAAMD,IAAKH,EAAK,QAAQ,KAAM,GAAG;EAC7C,IAAMK,IAAOL,EAAKG;EAClB,IAAI,OAAO,SAASE,CAAI,GAAG,KAAS;OAC/B,KA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