@syncropel/projections 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAqFH;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,MAAM;IACN,SAAS;IACT,MAAM;IACN,MAAM;IACN,WAAW;IACX,QAAQ;IACR,aAAa;IACb,aAAa;IACb,QAAQ;IACR,aAAa;IACb,aAAa;IACb,UAAU;IACV,6CAA6C;IAC7C,MAAM;IACN,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,MAAM;IACN,4BAA4B;IAC5B,WAAW;IACX,uCAAuC;IACvC,OAAO;IACP,OAAO;IACP,QAAQ;IACR,UAAU;IACV,WAAW;IACX,OAAO;IACP,MAAM;IACN,WAAW;IACX,qCAAqC;IACrC,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,yCAAyC;IACzC,YAAY;IACZ,eAAe;CACP,CAAC","sourcesContent":["/**\n * SRP v0.6 — TypeScript schema types.\n *\n * The Syncropel Rendering Protocol is a narrow JSON schema of block-level\n * primitives for declarative UI documents. See the spec and examples at\n * https://syncropel.com.\n *\n * v0.2 adds five interactive container + input nodes (tabs, data-table,\n * board, text-input, form). v0.3 adds the `segmented` node plus a\n * polished-data-grid increment to `data-table`. v0.4 adds eight\n * visualization + hierarchy nodes — `meter`, `gauge`, `avatar`,\n * `progress`, `sparkline`, `chart`, `tree`, `tag-input` — plus\n * `data-table` row selection and a two-line cell kind. v0.5 adds four\n * library-workspace nodes — `popover`, `slider`, `rating`, `thumbnail` —\n * plus `data-table` sticky columns and `meter` / `rating` / `thumbnail`\n * cell kinds. v0.6 adds two configuration-control nodes — `facet-grid`\n * (a faceted filter) and `column-config` (a grid column picker). v0.7\n * adds no node types — it is pure grammar: the host action grammar\n * (`emit` / `set-state` / `navigate` / `open-pane`), the `QueryBinding`\n * forms, and the expression sublanguage in `expr.ts`. Every addition is\n * additive + backwards-compatible: every v0.1–v0.6 document remains\n * valid. See ADR-102 through ADR-109.\n */\n\n// ---------------------------------------------------------------------------\n// Document envelope\n// ---------------------------------------------------------------------------\n\n/**\n * An SRP v0.1 document — the top-level envelope a Tier-1 extension emits.\n */\nexport interface SRPDocument {\n /**\n * Protocol version. A `\"0.2\"` document may use the v0.2 node additions;\n * a `\"0.3\"` document may additionally use `segmented` + the data-grid\n * props; a `\"0.4\"` document may additionally use the visualization +\n * hierarchy nodes. The version is a capability advertisement, not an\n * enforcement boundary — node validity is decided by `NODE_TYPES`\n * membership.\n */\n srp: \"0.1\" | \"0.2\" | \"0.3\" | \"0.4\" | \"0.5\" | \"0.6\" | \"0.7\";\n meta?: SRPMeta;\n root: SRPNode;\n}\n\nexport interface SRPMeta {\n name?: string;\n version?: string;\n description?: string;\n publisher?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Discriminated union of all 33 node types\n// ---------------------------------------------------------------------------\n\nexport type SRPNode =\n // Containers (5)\n | ColumnNode\n | RowNode\n | GridNode\n | CardNode\n | DividerNode\n // Record rendering (3)\n | RecordLineNode\n | RecordLineListNode\n | ChipNode\n // Data display (4)\n | HeadingNode\n | TextNode\n | StatNode\n | KeyValueNode\n // Interactive (4)\n | ButtonNode\n | IconButtonNode\n | CopyButtonNode\n | SelectNode\n // Feedback (3)\n | EmptyStateNode\n | ErrorStateNode\n | SkeletonNode\n // Interactive containers + inputs — SRP v0.2 (5)\n | TabsNode\n | DataTableNode\n | BoardNode\n | TextInputNode\n | FormNode\n // Choice control — SRP v0.3 (1)\n | SegmentedNode\n // Visualization + hierarchy — SRP v0.4 (8)\n | MeterNode\n | GaugeNode\n | AvatarNode\n | ProgressNode\n | SparklineNode\n | ChartNode\n | TreeNode\n | TagInputNode\n // Library-workspace nodes — SRP v0.5 (4)\n | PopoverNode\n | SliderNode\n | RatingNode\n | ThumbnailNode\n // Configuration-control nodes — SRP v0.6 (2)\n | FacetGridNode\n | ColumnConfigNode;\n\n/**\n * The 39 canonical node-type discriminator strings (19 v0.1 + 5 v0.2 +\n * 1 v0.3 + 8 v0.4 + 4 v0.5 + 2 v0.6).\n */\nexport const NODE_TYPES = [\n \"column\",\n \"row\",\n \"grid\",\n \"card\",\n \"divider\",\n \"record-line\",\n \"record-line-list\",\n \"chip\",\n \"heading\",\n \"text\",\n \"stat\",\n \"key-value\",\n \"button\",\n \"icon-button\",\n \"copy-button\",\n \"select\",\n \"empty-state\",\n \"error-state\",\n \"skeleton\",\n // SRP v0.2 — interactive containers + inputs\n \"tabs\",\n \"data-table\",\n \"board\",\n \"text-input\",\n \"form\",\n // SRP v0.3 — choice control\n \"segmented\",\n // SRP v0.4 — visualization + hierarchy\n \"meter\",\n \"gauge\",\n \"avatar\",\n \"progress\",\n \"sparkline\",\n \"chart\",\n \"tree\",\n \"tag-input\",\n // SRP v0.5 — library-workspace nodes\n \"popover\",\n \"slider\",\n \"rating\",\n \"thumbnail\",\n // SRP v0.6 — configuration-control nodes\n \"facet-grid\",\n \"column-config\",\n] as const;\n\nexport type NodeType = (typeof NODE_TYPES)[number];\n\n// ---------------------------------------------------------------------------\n// Fields every node may carry\n// ---------------------------------------------------------------------------\n\ninterface NodeBase {\n when?: string;\n bind?: Record<string, unknown>;\n actions?: Record<string, SRPAction>;\n}\n\n// ---------------------------------------------------------------------------\n// Token unions (mirror @syncropel/react token scales)\n// ---------------------------------------------------------------------------\n\nexport type Gap = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type Padding = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type DividerSpacing = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type Cols = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\nexport type ColumnAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type RowAlign = \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\nexport type Justify =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"between\"\n | \"around\"\n | \"evenly\";\n\nexport type RecordLineVariant =\n | \"feed\"\n | \"compact\"\n | \"detail\"\n | \"search\"\n | \"thread\";\n\nexport type ChipTone = \"default\" | \"info\" | \"warn\" | \"error\";\n\nexport type TextSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\";\nexport type TextTone =\n | \"primary\"\n | \"secondary\"\n | \"muted\"\n | \"success\"\n | \"warning\"\n | \"danger\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\nexport type ButtonSize = \"xs\" | \"sm\" | \"md\";\n\nexport type SkeletonShape = \"rect\" | \"circle\" | \"text\";\n\n// --- SRP v0.2 tokens ---\nexport type TableColumnAlign = \"start\" | \"end\";\nexport type DataTableVariant = \"default\" | \"compact\";\nexport type TextInputKind = \"text\" | \"search\";\n/**\n * How a `data-table` column renders its cell value. `text` (default) is a\n * plain string; `chip` renders the value as a compact metadata chip;\n * `lines` (SRP v0.4) renders a two-line cell — the value at `key` as the\n * primary line and the value at the column's `subKey` as a muted subtitle.\n *\n * SRP v0.5 adds three visual cell kinds: `meter` renders a numeric `0..1`\n * value as an inline bar (recoloured by the column's `thresholds`);\n * `rating` renders a numeric value as a row of stars (count from the\n * column's `max`); `thumbnail` renders a URL-valued cell as a small image.\n */\nexport type TableCellKind =\n | \"text\"\n | \"chip\"\n | \"lines\"\n | \"meter\"\n | \"rating\"\n | \"thumbnail\";\n\n// --- SRP v0.3 tokens ---\n\n/**\n * A row accent tone — `data-table` `rowTone` paints a left-border (and a\n * subtle tint) keyed off a column value. Wider than `ChipTone`: it adds\n * `accent` and `success` so a row can read as \"in progress\" / \"done\".\n */\nexport type RowTone =\n | \"default\"\n | \"accent\"\n | \"success\"\n | \"warn\"\n | \"error\"\n | \"info\";\n\n/** Sort direction for a `data-table` column. */\nexport type SortDirection = \"asc\" | \"desc\";\n\n/** Which side of the row a `data-table` `rowActions` cell sits on. */\nexport type RowActionPosition = \"leading\" | \"trailing\";\n\n/**\n * How a `segmented` control presents. `solid` (default) is a light pill\n * group; `underline` is a borderless tab strip (active option underlined).\n * Added in SRP v0.3.1.\n */\nexport type SegmentedVariant = \"solid\" | \"underline\";\n\n// --- SRP v0.4 tokens ---\n\n/**\n * A visualization tone — shared by `meter`, `gauge`, `progress`,\n * `sparkline`, and `chart`. Drives the fill / stroke colour. Added SRP v0.4.\n */\nexport type VizTone =\n | \"neutral\"\n | \"accent\"\n | \"success\"\n | \"warn\"\n | \"error\"\n | \"info\";\n\n/** A visualization size step — shared by the SRP v0.4 viz nodes. */\nexport type VizSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\n/** How a `meter` renders its fill — one bar, or a row of discrete cells. */\nexport type MeterVariant = \"continuous\" | \"segmented\";\n\n/** How a `sparkline` renders its series. */\nexport type SparklineVariant = \"line\" | \"bar\";\n\n/** The plot kind a `chart` draws. */\nexport type ChartKind = \"line\" | \"area\" | \"bar\" | \"pie\";\n\n/**\n * Glyph kinds — the closed enumeration of semantic symbols the palette renders.\n * Covers act types, domain objects, thread states, and the AITL marker.\n */\nexport type GlyphKind =\n // Act types (coordination)\n | \"INTEND\"\n | \"DO\"\n | \"KNOW\"\n | \"LEARN\"\n // Act types (effects)\n | \"GET\"\n | \"PUT\"\n | \"CALL\"\n | \"MAP\"\n // AITL marker\n | \"AITL\"\n // Domain objects\n | \"thread\"\n | \"fork\"\n | \"record-parent\"\n | \"namespace\"\n | \"actor\"\n | \"file\"\n | \"pattern\"\n | \"page\"\n | \"view\"\n // Thread states\n | \"state-open\"\n | \"state-active\"\n | \"state-converged\"\n | \"state-closed\"\n | \"state-abandoned\";\n\n// ---------------------------------------------------------------------------\n// Actions + queries\n// ---------------------------------------------------------------------------\n\n/**\n * The legacy (SRP ≤ v0.6) action form — an opaque intent name dispatched\n * to a host-supplied handler. Still valid in v0.7 as the escape hatch for\n * a non-generic host; new workspace records SHOULD prefer the v0.7 verbs.\n */\nexport interface ActionDesc {\n intent: string;\n payload?: Record<string, unknown>;\n}\n\n// --- SRP v0.7 — the host action grammar (ADR-109 D1) -----------------------\n\n/**\n * A record-emit specification. String values anywhere in `body` (and in\n * `thread`) may carry `{…}` interpolation resolved against the action\n * scope (`form.*`, `row.*`, `state.*`). `thread: \"$new\"` directs the host\n * to allocate a fresh `th_` id.\n */\nexport interface EmitSpec {\n /** Act type — INTEND | DO | KNOW | LEARN | GET | PUT | CALL | MAP. */\n act: string;\n /** Target thread id, or `\"$new\"` for a host-generated fresh thread. */\n thread: string;\n /** The record body. */\n body: Record<string, unknown>;\n}\n\n/**\n * v0.7 — emit a record via the SDK. Capability-checked by the generic\n * host against the workspace record's `meta.capabilities.emit`\n * (ADR-109 D5). An optional `id` keys the mutation lifecycle (ADR-109 D3);\n * `optimistic` supplies a body the host inserts immediately and rolls\n * back on failure.\n */\nexport interface EmitAction {\n emit: EmitSpec;\n id?: string;\n optimistic?: Record<string, unknown>;\n /**\n * v0.7 — actions dispatched *after* the emit resolves successfully.\n * The host runs them in order once the record is emitted (used to\n * close + clear a composer after a create). They do not run on\n * failure — so an error guard inside the still-open form can show.\n */\n onSuccess?: SRPAction[];\n}\n\n/** v0.7 — write the host state bag (ADR-109 D6). */\nexport interface SetStateAction {\n setState: { key: string; value: unknown };\n}\n\n/** v0.7 — route the viewer. Scope-checked against `meta.capabilities.navigate`. */\nexport interface NavigateAction {\n /** Target path; may carry `{…}` interpolation. */\n navigate: string;\n}\n\n/** v0.7 — open a record in a `<WorkspaceShell>` region. */\nexport interface OpenPaneAction {\n openPane: { region: string; record: string };\n}\n\n/**\n * An SRP action — what an event binding triggers. v0.7 adds four\n * self-describing verbs a generic host executes with no workspace-specific\n * code; the legacy `ActionDesc` form remains a member for compatibility.\n */\nexport type SRPAction =\n | ActionDesc\n | EmitAction\n | SetStateAction\n | NavigateAction\n | OpenPaneAction;\n\n/**\n * v0.7 — a named query binding (ADR-109 D4). A node's `bind.query` is\n * either a raw {@link VQLQuery} (legacy) or a `QueryBinding`. `name` lets\n * the host expose a query-count via the expression path\n * `query.<name>.count`. Exactly one of `filter` / `fold` is set:\n * `filter` is a raw ADR-037 VQL query; `fold` names a server-side\n * projection/fold endpoint (e.g. `\"tasks.snapshot\"`).\n */\nexport interface QueryBinding {\n name: string;\n filter?: VQLQuery;\n fold?: string;\n /**\n * v0.7 — an optional client-side row filter: an expression\n * (see `expr.ts`) evaluated per row against `{ row, state }`. Rows for\n * which it is falsy are dropped *after* fetch. This is the host-owned\n * post-fetch transform that lets filter state (`@state.*`) narrow a\n * query without re-hitting the server (ADR-109 D6).\n */\n where?: string;\n}\n\n/**\n * VQL (Value Query Language) — the query shape a Syncropel server resolves\n * against its record store. Used by `record-line-list` nodes that bind to\n * a live query rather than a static list of record ids.\n *\n * The shape is deliberately open (index signature) — additional fields\n * are protocol extensions the server understands.\n */\nexport interface VQLQuery {\n act?: string;\n actor?: string;\n thread?: string;\n kind?: string;\n since?: number;\n limit?: number;\n [k: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Container node definitions (5)\n// ---------------------------------------------------------------------------\n\nexport interface ColumnNode extends NodeBase {\n type: \"column\";\n props?: { gap?: Gap; align?: ColumnAlign; justify?: Justify };\n children?: SRPNode[];\n}\n\nexport interface RowNode extends NodeBase {\n type: \"row\";\n props?: {\n gap?: Gap;\n align?: RowAlign;\n justify?: Justify;\n wrap?: boolean;\n };\n children?: SRPNode[];\n}\n\nexport interface GridNode extends NodeBase {\n type: \"grid\";\n props: { cols: Cols; gap?: Gap; rowGap?: Gap; colGap?: Gap };\n children?: SRPNode[];\n}\n\nexport interface CardNode extends NodeBase {\n type: \"card\";\n props?: { padding?: Padding; interactive?: boolean };\n children?: SRPNode[];\n}\n\nexport interface DividerNode extends NodeBase {\n type: \"divider\";\n props?: { orientation?: \"horizontal\" | \"vertical\"; spacing?: DividerSpacing };\n}\n\n// ---------------------------------------------------------------------------\n// Record-rendering (3)\n// ---------------------------------------------------------------------------\n\nexport interface RecordLineNode extends NodeBase {\n type: \"record-line\";\n props: {\n variant: RecordLineVariant;\n /**\n * SRP v0.3 — an optional dotted body path (`body.priority`). When set,\n * the line renders a small chip carrying that field's value. Lets\n * `board` cards (which render through `record-line`) show a priority\n * or status chip.\n */\n chipField?: string;\n };\n bind: { record: string };\n}\n\nexport interface RecordLineListNode extends NodeBase {\n type: \"record-line-list\";\n props: { variant: RecordLineVariant; max?: number; empty?: string };\n bind: { query: VQLQuery | QueryBinding } | { items: string[] };\n}\n\nexport interface ChipNode extends NodeBase {\n type: \"chip\";\n props: { label: string; tone?: ChipTone; glyph?: GlyphKind };\n}\n\n// ---------------------------------------------------------------------------\n// Data display (4)\n// ---------------------------------------------------------------------------\n\nexport interface HeadingNode extends NodeBase {\n type: \"heading\";\n props: { level: 1 | 2 | 3 | 4 | 5 | 6; text: string };\n}\n\nexport interface TextNode extends NodeBase {\n type: \"text\";\n props: {\n text: string;\n size?: TextSize;\n weight?: TextWeight;\n tone?: TextTone;\n inline?: boolean;\n };\n}\n\nexport interface StatNode extends NodeBase {\n type: \"stat\";\n props: {\n label: string;\n value: string | number;\n delta?: string | number;\n deltaTone?: \"auto\" | \"neutral\";\n };\n}\n\nexport interface KeyValueNode extends NodeBase {\n type: \"key-value\";\n props: { label: string; value: string };\n}\n\n// ---------------------------------------------------------------------------\n// Interactive (4)\n// ---------------------------------------------------------------------------\n\nexport interface ButtonNode extends NodeBase {\n type: \"button\";\n props: {\n label: string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n disabled?: boolean;\n loading?: boolean;\n };\n actions?: { onClick?: SRPAction };\n}\n\nexport interface IconButtonNode extends NodeBase {\n type: \"icon-button\";\n props: {\n glyph: GlyphKind;\n ariaLabel: string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n disabled?: boolean;\n loading?: boolean;\n };\n actions?: { onClick?: SRPAction };\n}\n\nexport interface CopyButtonNode extends NodeBase {\n type: \"copy-button\";\n props: { value: string; label?: string };\n}\n\nexport interface SelectNode extends NodeBase {\n type: \"select\";\n props: { options: { label: string; value: string }[] };\n bind: { value: string };\n actions?: { onChange?: SRPAction };\n}\n\n// ---------------------------------------------------------------------------\n// Feedback (3)\n// ---------------------------------------------------------------------------\n\nexport interface EmptyStateNode extends NodeBase {\n type: \"empty-state\";\n props: {\n message: string;\n action?: { label: string; intent: string };\n };\n}\n\nexport interface ErrorStateNode extends NodeBase {\n type: \"error-state\";\n props: {\n message: string;\n retry?: { intent: string };\n };\n}\n\nexport interface SkeletonNode extends NodeBase {\n type: \"skeleton\";\n props?: {\n shape?: SkeletonShape;\n width?: string | number | \"full\";\n height?: string | number;\n };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.2 — interactive containers + inputs (5)\n//\n// All five reuse the v0.1 contract: `props` is static config, `bind` is\n// host-supplied state, `actions` declares intents the host dispatches. SRP\n// owns layout + shape; the host owns state + behaviour. See ADR-102 and the\n// SRP v0.2 design spec.\n// ---------------------------------------------------------------------------\n\n/**\n * A container whose children are panels; one panel shows at a time. The host\n * supplies the active tab id via `bind.active` and renders the panel whose\n * index matches it in `props.tabs`.\n */\nexport interface TabsNode extends NodeBase {\n type: \"tabs\";\n props: { tabs: { id: string; label: string; glyph?: GlyphKind }[] };\n bind: { active: string };\n actions?: { onTabChange?: SRPAction };\n /** Panels, parallel to `props.tabs` by index. */\n children?: SRPNode[];\n}\n\n/** A single `data-table` column definition. */\nexport interface DataTableColumnDef {\n /** Dotted path into each row (`body.goal`, `actor`). */\n key: string;\n label: string;\n align?: TableColumnAlign;\n width?: string;\n /** How the cell value renders. Default `text`. */\n kind?: TableCellKind;\n /**\n * SRP v0.3 — for a `kind: \"chip\"` column, a map from cell value to chip\n * tone. A value with no entry renders a `default`-tone chip.\n */\n tones?: Record<string, ChipTone>;\n /**\n * SRP v0.3 — an explicit value order for sorting this column. When the\n * column is the sort key, rows order by each value's index in this list\n * (so `critical` < `high` < `medium` < `low`, not alphabetical). Values\n * absent from the list sort after the listed ones.\n */\n order?: string[];\n /**\n * SRP v0.4 — for a `kind: \"lines\"` column, the dotted path whose value\n * renders as the muted second line beneath the `key` value.\n */\n subKey?: string;\n /**\n * SRP v0.5 — for a `kind: \"meter\"` column, value-keyed recolouring of\n * the inline bar (energy low→high, score bands). List in ascending `at`.\n */\n thresholds?: VizThreshold[];\n /**\n * SRP v0.5 — for a `kind: \"rating\"` column, the number of stars. Also\n * the default tone source for a `meter` cell when no `thresholds` match.\n * Default 5.\n */\n max?: number;\n}\n\n/** SRP v0.3 — a `data-table` sort descriptor. */\nexport interface TableSort {\n key: string;\n direction: SortDirection;\n}\n\n/**\n * SRP v0.3 — a per-row action affordance on a `data-table`. Rendered as a\n * small button in a leading or trailing cell; a click dispatches `intent`\n * with the row merged into the payload as `row`.\n */\nexport interface TableRowAction {\n /** Stable identifier for this row action (also the legacy intent name). */\n intent: string;\n /** A semantic glyph for an icon-only affordance. */\n glyph?: GlyphKind;\n /** A text label — used when no `glyph` is given (or as the aria-label). */\n label?: string;\n /** Which side of the row the action cell sits on. Default `leading`. */\n position?: RowActionPosition;\n /**\n * v0.7 — the action a click triggers. When set, the host dispatches\n * this `SRPAction` with the row as runtime context (`{row}`); when\n * omitted, the legacy `{ intent, payload: { row } }` form is dispatched.\n */\n action?: SRPAction;\n}\n\n/**\n * SRP v0.3 — a `data-table` row accent. The row paints a left-border (and\n * a subtle tint) whose tone is looked up from `tones` by the value at\n * `key`. A value with no entry gets no accent.\n */\nexport interface TableRowTone {\n /** Dotted path into the row whose value selects the tone. */\n key: string;\n tones: Record<string, RowTone>;\n}\n\n/**\n * A columnar record list — richer than `record-line-list`: explicit columns,\n * alignment, optional sort. `column.key` is a dotted path into each row.\n *\n * SRP v0.3 adds the polished-data-grid props: column `tones` + `order`,\n * `defaultSort`, `rowActions`, and `rowTone`. SRP v0.4 adds `selectable`\n * (a leading checkbox column with multi-select) — all optional + additive.\n */\nexport interface DataTableNode extends NodeBase {\n type: \"data-table\";\n props: {\n columns: DataTableColumnDef[];\n variant?: DataTableVariant;\n sortable?: boolean;\n empty?: string;\n /** SRP v0.3 — the sort applied before any header interaction. */\n defaultSort?: TableSort;\n /** SRP v0.3 — per-row action affordances. */\n rowActions?: TableRowAction[];\n /** SRP v0.3 — a value-keyed row accent. */\n rowTone?: TableRowTone;\n /**\n * SRP v0.4 — render a leading checkbox column with a select-all\n * header. The table owns selection state and dispatches\n * `onSelectionChange` with the selected rows.\n */\n selectable?: boolean;\n /**\n * SRP v0.5 — pin the first N columns (and the leading checkbox /\n * action cells) so they stay visible while the rest scroll\n * horizontally. Default 0 (no pinned columns).\n */\n stickyColumns?: number;\n };\n bind: { query: VQLQuery | QueryBinding } | { rows: Record<string, unknown>[] };\n actions?: {\n onRowClick?: SRPAction;\n onSort?: SRPAction;\n /** SRP v0.4 — fired (with `rows`) when the selection changes. */\n onSelectionChange?: SRPAction;\n };\n}\n\n/**\n * A kanban board — records bucketed into columns by the `props.groupBy` field.\n * A record lands in the column whose `id` equals its `groupBy` value; records\n * matching no column are dropped. `onCardMove` is advisory — a host MAY\n * support drag; a board without drag is read-only and still valid.\n */\nexport interface BoardNode extends NodeBase {\n type: \"board\";\n props: {\n columns: { id: string; label: string }[];\n groupBy: string;\n cardVariant?: RecordLineVariant;\n /**\n * SRP v0.3 — a dotted body path passed through to each card's\n * `record-line` as its `chipField`, so cards show a metadata chip\n * (e.g. `body.priority`).\n */\n cardChipField?: string;\n };\n bind: { query: VQLQuery | QueryBinding };\n actions?: { onCardClick?: SRPAction; onCardMove?: SRPAction };\n}\n\n/**\n * An editable text field — the `select` of free text. The host owns\n * `bind.value` and re-renders on change (identical ownership model to\n * `select`).\n */\nexport interface TextInputNode extends NodeBase {\n type: \"text-input\";\n props?: {\n placeholder?: string;\n multiline?: boolean;\n inputKind?: TextInputKind;\n size?: TextSize;\n disabled?: boolean;\n };\n bind: { value: string };\n actions?: { onChange?: SRPAction; onSubmit?: SRPAction };\n}\n\n/**\n * A container that groups inputs and declares a submit intent. The host\n * collects child input values (by their `bind`) and dispatches `onSubmit`.\n */\nexport interface FormNode extends NodeBase {\n type: \"form\";\n props?: { submitLabel?: string; busy?: boolean };\n actions?: { onSubmit?: SRPAction };\n children?: SRPNode[];\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.3 — choice control (1)\n//\n// `segmented` is the third stateful input (alongside `select` + `text-input`)\n// and reuses the same ownership model: `bind.value` is host-supplied, a\n// pick dispatches `onChange`. See ADR-103.\n// ---------------------------------------------------------------------------\n\n/** One option in a `segmented` control. */\nexport interface SegmentedOption {\n value: string;\n label: string;\n /** An optional count/marker rendered as a small badge on the option. */\n badge?: string | number;\n}\n\n/**\n * v0.7 — a live group-count binding for `segmented` option badges. The\n * host counts the records in query `from`, grouped by the `groupBy`\n * dotted field; each option whose `value` equals a group value gets that\n * count as its badge. The option named by `total` (a catch-all like\n * \"All\") gets the grand total. Lets a static record show live filter\n * counts without baking them in.\n */\nexport interface SegmentedCounts {\n /** The query name (a `QueryBinding.name`) whose records are counted. */\n from: string;\n /** Dotted field path the records are grouped by (`body.bucket`). */\n groupBy: string;\n /** Option value that should display the grand total (e.g. `\"all\"`). */\n total?: string;\n}\n\n/**\n * A row of mutually-exclusive options — a filter/choice control. Distinct\n * from `tabs`: it has no panels, it is purely a bound value. The host owns\n * `bind.value`; picking an option dispatches `onChange` with the new value.\n */\nexport interface SegmentedNode extends NodeBase {\n type: \"segmented\";\n props: {\n options: SegmentedOption[];\n size?: ButtonSize;\n /** Presentation — `solid` (light pill group, default) or `underline`\n * (borderless tab strip). Added in SRP v0.3.1. */\n variant?: SegmentedVariant;\n };\n /**\n * `value` is the host-supplied selection. `counts` (v0.7) binds live\n * group-counts onto the option badges — see {@link SegmentedCounts}.\n */\n bind: { value: string; counts?: SegmentedCounts };\n actions?: { onChange?: SRPAction };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.4 — visualization + hierarchy nodes (8)\n//\n// `meter`, `gauge`, `progress`, `sparkline`, `chart` are read-only data\n// displays — `props` carries the values, there is no `bind`. `avatar` is a\n// read-only identity token. `tree` + `tag-input` are interactive: they\n// reuse the v0.1 ownership model — `bind` is host state, `actions` declares\n// dispatched intents. Music-specific widgets (waveforms, transition tables)\n// are NOT in SRP — a renderer registers those as plug-in node types. See\n// ADR-104.\n// ---------------------------------------------------------------------------\n\n/**\n * A value→tone threshold for a `meter`. The meter's value selects the\n * highest threshold whose `at` it reaches; that tone recolours the fill.\n * List thresholds in ascending `at` order.\n */\nexport interface VizThreshold {\n at: number;\n tone: VizTone;\n}\n\n/**\n * A horizontal bar gauge — renders a `0..1` reading as a proportional\n * fill. `continuous` is a single bar; `segmented` is a row of discrete\n * cells. `thresholds` recolours the meter by value (energy low→high,\n * trust score, match confidence).\n */\nexport interface MeterNode extends NodeBase {\n type: \"meter\";\n props: {\n /** The reading, clamped to `0..1`. */\n value: number;\n tone?: VizTone;\n variant?: MeterVariant;\n /** Cell count when `variant: \"segmented\"`. Default 5. */\n segments?: number;\n /** Value-keyed recolouring; overrides `tone` for the matched band. */\n thresholds?: VizThreshold[];\n size?: VizSize;\n /** Optional caption rendered beside the bar. */\n label?: string;\n };\n}\n\n/** A coloured band on a `gauge` arc — e.g. a Dial zone. */\nexport interface GaugeZone {\n from: number;\n to: number;\n tone: VizTone;\n label?: string;\n}\n\n/**\n * A radial arc gauge — renders a `0..1` reading on a 270° arc. Doubles as\n * the Syncropel Dial (the `d ∈ [0,1]` control surface, F3): `zones` paints\n * the REPLAY / ADAPT / EXPLORE / CREATE bands.\n */\nexport interface GaugeNode extends NodeBase {\n type: \"gauge\";\n props: {\n /** The reading, clamped to `0..1`. */\n value: number;\n label?: string;\n tone?: VizTone;\n /** Coloured arc bands — drawn behind the value sweep. */\n zones?: GaugeZone[];\n size?: VizSize;\n /** Render the numeric value in the arc centre. Default true. */\n showValue?: boolean;\n /** How the centre value reads. Default `decimal`. */\n format?: \"percent\" | \"decimal\";\n };\n}\n\n/**\n * A compact identity token — an image (`src`), or initials derived from\n * `name`, or a semantic `glyph` fallback. Square, rounded.\n */\nexport interface AvatarNode extends NodeBase {\n type: \"avatar\";\n props: {\n /** Display name — the source of initials + the accessible label. */\n name: string;\n src?: string;\n glyph?: GlyphKind;\n size?: VizSize;\n };\n}\n\n/**\n * A progress bar. With `value` it fills proportionally (determinate);\n * with `indeterminate` it animates with no known extent. Distinct from\n * `meter`: `progress` reads as \"advancing toward done\", `meter` as a\n * static measurement.\n */\nexport interface ProgressNode extends NodeBase {\n type: \"progress\";\n props?: {\n /** The fraction complete, `0..1`. Omit when `indeterminate`. */\n value?: number;\n indeterminate?: boolean;\n tone?: VizTone;\n label?: string;\n /** Render the percentage as text. Default false. */\n showValue?: boolean;\n size?: VizSize;\n };\n}\n\n/**\n * A tiny inline chart — a bare series with no axes or legend, for\n * trend-at-a-glance (cost over time, dispatch throughput, energy shape).\n */\nexport interface SparklineNode extends NodeBase {\n type: \"sparkline\";\n props: {\n values: number[];\n variant?: SparklineVariant;\n tone?: VizTone;\n /** Width in px, or `\"full\"` to fill the container. Default 96. */\n width?: number | \"full\";\n /** Height in px. Default 24. */\n height?: number;\n };\n}\n\n/** One point in a `chart` series. */\nexport interface ChartPoint {\n x: string | number;\n y: number;\n}\n\n/** One series in a `chart` — or, for a `pie`, one ring of slices. */\nexport interface ChartSeries {\n label?: string;\n tone?: VizTone;\n points: ChartPoint[];\n}\n\n/**\n * A labelled chart — a `line` / `area` / `bar` plot, or a `pie` whose\n * slices are `series[0].points`. Richer than `sparkline`: axes, a legend,\n * a title.\n */\nexport interface ChartNode extends NodeBase {\n type: \"chart\";\n props: {\n kind: ChartKind;\n series: ChartSeries[];\n title?: string;\n /** Plot height in px. Default 200. */\n height?: number;\n /** Draw axes + gridlines (ignored for `pie`). Default true. */\n showAxis?: boolean;\n /** Draw a series legend. Default false. */\n showLegend?: boolean;\n };\n}\n\n/** One node in a `tree`. Recursive — `children` nest arbitrarily deep. */\nexport interface TreeItem {\n id: string;\n label: string;\n glyph?: GlyphKind;\n /** A small trailing count / marker. */\n badge?: string | number;\n children?: TreeItem[];\n}\n\n/**\n * A hierarchical, collapsible list — playlist folders, namespace trees,\n * thread forks, file browsers. The host owns `bind.selected` /\n * `bind.expanded`; a click dispatches `onSelect` / `onToggle`. When `bind`\n * is omitted the tree manages expand/collapse internally.\n */\nexport interface TreeNode extends NodeBase {\n type: \"tree\";\n props: {\n items: TreeItem[];\n /** Item ids expanded on first render. */\n defaultExpanded?: string[];\n };\n bind?: { selected?: string; expanded?: string[] };\n actions?: { onSelect?: SRPAction; onToggle?: SRPAction };\n}\n\n/**\n * An editable set of tags — type-and-enter to add, click ✕ to remove,\n * optional autocomplete `suggestions`. The fourth stateful input\n * (alongside `select`, `text-input`, `segmented`); the host owns\n * `bind.tags` and re-renders on `onChange`.\n */\nexport interface TagInputNode extends NodeBase {\n type: \"tag-input\";\n props?: {\n placeholder?: string;\n suggestions?: string[];\n size?: TextSize;\n disabled?: boolean;\n };\n bind: { tags: string[] };\n actions?: { onChange?: SRPAction };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.5 — library-workspace nodes (4)\n//\n// `popover` is a container whose children are an anchored panel — it owns\n// its own open/close state, so it needs no `bind`. `slider` + `rating` are\n// the fifth + sixth stateful inputs (alongside select / text-input /\n// segmented / tag-input): the host owns `bind.value`, a change dispatches\n// `onChange`. `thumbnail` is a read-only rectangular image token. These\n// four close the gap between the visualization palette and a full\n// library-management workspace (a configurable grid + filter + column\n// popovers + a record editor). See ADR-105.\n// ---------------------------------------------------------------------------\n\n/** Which edge of the trigger a `popover` panel aligns to. */\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\n/** Corner rounding for a `thumbnail`. */\nexport type ThumbnailRadius = \"none\" | \"sm\" | \"md\" | \"lg\" | \"full\";\n\n/** Aspect ratio for a `thumbnail`. */\nexport type ThumbnailAspect = \"square\" | \"video\" | \"wide\";\n\n/**\n * A trigger button paired with an anchored panel. Clicking the trigger\n * opens `children` in a popover; an outside click or `Escape` closes it.\n * The popover owns its open state — it is presentation, not host state —\n * so there is no `bind`. The toolbar Columns + Filters controls of a\n * library view are `popover` nodes wrapping a `column-config` / `facet`\n * panel.\n */\nexport interface PopoverNode extends NodeBase {\n type: \"popover\";\n props: {\n /** The trigger button's label. */\n label: string;\n /** An optional leading glyph on the trigger. */\n glyph?: GlyphKind;\n variant?: ButtonVariant;\n size?: ButtonSize;\n /** Which trigger edge the panel aligns to. Default `start`. */\n align?: PopoverAlign;\n /** A small count/marker badge on the trigger (e.g. active filters). */\n badge?: string | number;\n };\n /** The popover panel content. */\n children?: SRPNode[];\n}\n\n/**\n * A draggable numeric input — the continuous sibling of `select`. The host\n * owns `bind.value`; a drag (or arrow key) dispatches `onChange` with the\n * new value. Distinct from `meter` (read-only measurement) and `progress`\n * (advancing-toward-done): `slider` is an editable control.\n */\nexport interface SliderNode extends NodeBase {\n type: \"slider\";\n props: {\n min: number;\n max: number;\n /** Snap increment. Default 1. */\n step?: number;\n tone?: VizTone;\n label?: string;\n /** Render the current value as text beside the track. Default false. */\n showValue?: boolean;\n size?: VizSize;\n disabled?: boolean;\n };\n bind: { value: number };\n actions?: { onChange?: SRPAction };\n}\n\n/**\n * A row of stars. With `readOnly` it is a display (a table cell, a card\n * field); otherwise it is an input — clicking a star dispatches `onChange`\n * with the new value. The host owns `bind.value`.\n */\nexport interface RatingNode extends NodeBase {\n type: \"rating\";\n props?: {\n /** Star count. Default 5. */\n max?: number;\n size?: VizSize;\n /** Display only — no interaction, no `onChange`. Default false. */\n readOnly?: boolean;\n tone?: VizTone;\n };\n bind: { value: number };\n actions?: { onChange?: SRPAction };\n}\n\n/**\n * A rectangular image token — album art, a file preview, a cover. An\n * `src` image, or a semantic `glyph` fallback when `src` is absent or\n * fails to load. Distinct from `avatar` (a square identity token that\n * derives initials from a name): `thumbnail` is content imagery with a\n * configurable aspect ratio.\n */\nexport interface ThumbnailNode extends NodeBase {\n type: \"thumbnail\";\n props: {\n /** Accessible description — required even when `src` is set. */\n alt: string;\n src?: string;\n /** Fallback glyph when `src` is absent or fails to load. */\n glyph?: GlyphKind;\n size?: VizSize;\n /** Corner rounding. Default `sm`. */\n radius?: ThumbnailRadius;\n /** Aspect ratio. Default `square`. */\n aspect?: ThumbnailAspect;\n };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.6 — configuration-control nodes (2)\n//\n// `facet-grid` + `column-config` are the declarative bodies of the\n// Filters and Columns popovers of a library workspace. Both are stateful\n// inputs in the v0.1 ownership model — the host owns `bind`, an\n// interaction dispatches an intent. They pair with `data-table`:\n// `facet-grid` chooses which rows it shows, `column-config` chooses which\n// columns. See ADR-106.\n// ---------------------------------------------------------------------------\n\n/** One selectable option within a `facet-grid` category. */\nexport interface FacetOption {\n value: string;\n label: string;\n /** A corpus count rendered as a trailing badge on the chip. */\n count?: number;\n}\n\n/** One category (tab) of a `facet-grid` — e.g. genre, mood, vibe. */\nexport interface FacetCategory {\n id: string;\n label: string;\n options: FacetOption[];\n}\n\n/**\n * A faceted filter — a row of category tabs, and beneath the active tab a\n * wrapped grid of selectable, count-bearing chips. The host owns the\n * active category (`bind.active`) and the selected values per category\n * (`bind.selected`); a tab pick dispatches `onFacetChange`, a chip toggle\n * dispatches `onToggle`. The Filters panel's tag section of a library\n * view is a `facet-grid`.\n */\nexport interface FacetGridNode extends NodeBase {\n type: \"facet-grid\";\n props: {\n facets: FacetCategory[];\n };\n bind: {\n /** The active category id. */\n active: string;\n /** Selected values, keyed by category id. */\n selected?: Record<string, string[]>;\n };\n actions?: {\n /** Category tab changed — payload `{ facet }`. */\n onFacetChange?: SRPAction;\n /** A chip toggled — payload `{ facet, value }`. */\n onToggle?: SRPAction;\n };\n}\n\n/** One configurable column in a `column-config`. */\nexport interface ColumnConfigColumn {\n id: string;\n label: string;\n}\n\n/** A named visible-column set a `column-config` can apply in one click. */\nexport interface ColumnConfigPreset {\n id: string;\n label: string;\n /** The visible column ids, in order. */\n columns: string[];\n}\n\n/**\n * A grid column picker — preset buttons plus a drag-to-reorder list of\n * visibility checkboxes. The host owns `bind.visible` (the visible column\n * ids, in display order); any change dispatches `onChange` with the new\n * order. Pairs with `data-table` — `bind.visible` selects + orders the\n * table's columns. The Columns panel of a library view is a\n * `column-config`.\n */\nexport interface ColumnConfigNode extends NodeBase {\n type: \"column-config\";\n props: {\n columns: ColumnConfigColumn[];\n presets?: ColumnConfigPreset[];\n };\n bind: {\n /** The visible column ids, in display order. */\n visible: string[];\n };\n actions?: {\n /** Visibility or order changed — payload `{ visible }`. */\n onChange?: SRPAction;\n };\n}\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA8FH;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ;IACR,KAAK;IACL,MAAM;IACN,MAAM;IACN,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,MAAM;IACN,SAAS;IACT,MAAM;IACN,MAAM;IACN,WAAW;IACX,QAAQ;IACR,aAAa;IACb,aAAa;IACb,QAAQ;IACR,aAAa;IACb,aAAa;IACb,UAAU;IACV,6CAA6C;IAC7C,MAAM;IACN,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,MAAM;IACN,4BAA4B;IAC5B,WAAW;IACX,uCAAuC;IACvC,OAAO;IACP,OAAO;IACP,QAAQ;IACR,UAAU;IACV,WAAW;IACX,OAAO;IACP,MAAM;IACN,WAAW;IACX,qCAAqC;IACrC,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,yCAAyC;IACzC,YAAY;IACZ,eAAe;IACf,4DAA4D;IAC5D,OAAO;IACP,YAAY;IACZ,OAAO;IACP,MAAM;IACN,MAAM;IACN,+DAA+D;IAC/D,QAAQ;IACR,WAAW;CACH,CAAC","sourcesContent":["/**\n * SRP v0.8 — TypeScript schema types.\n *\n * The Syncropel Rendering Protocol is a narrow JSON schema of block-level\n * primitives for declarative UI documents. See the spec and examples at\n * https://syncropel.com.\n *\n * v0.2 adds five interactive container + input nodes (tabs, data-table,\n * board, text-input, form). v0.3 adds the `segmented` node plus a\n * polished-data-grid increment to `data-table`. v0.4 adds eight\n * visualization + hierarchy nodes — `meter`, `gauge`, `avatar`,\n * `progress`, `sparkline`, `chart`, `tree`, `tag-input` — plus\n * `data-table` row selection and a two-line cell kind. v0.5 adds four\n * library-workspace nodes — `popover`, `slider`, `rating`, `thumbnail` —\n * plus `data-table` sticky columns and `meter` / `rating` / `thumbnail`\n * cell kinds. v0.6 adds two configuration-control nodes — `facet-grid`\n * (a faceted filter) and `column-config` (a grid column picker). v0.7\n * adds no node types — it is pure grammar: the host action grammar\n * (`emit` / `set-state` / `navigate` / `open-pane`), the `QueryBinding`\n * forms, and the expression sublanguage in `expr.ts`. **v0.8 adds five\n * visual-atom nodes — `glyph`, `status-dot`, `pulse`, `link`, `code` —\n * the kernel-rendered building blocks for `core.site.v1` static sites\n * (per ADR-104 Amendment 1 + ADR-119).** Every addition is additive +\n * backwards-compatible: every v0.1–v0.7 document remains valid. See\n * ADR-102 through ADR-109 + ADR-119.\n */\n\n// ---------------------------------------------------------------------------\n// Document envelope\n// ---------------------------------------------------------------------------\n\n/**\n * An SRP v0.1 document — the top-level envelope a Tier-1 extension emits.\n */\nexport interface SRPDocument {\n /**\n * Protocol version. A `\"0.2\"` document may use the v0.2 node additions;\n * a `\"0.3\"` document may additionally use `segmented` + the data-grid\n * props; a `\"0.4\"` document may additionally use the visualization +\n * hierarchy nodes. The version is a capability advertisement, not an\n * enforcement boundary — node validity is decided by `NODE_TYPES`\n * membership.\n */\n srp: \"0.1\" | \"0.2\" | \"0.3\" | \"0.4\" | \"0.5\" | \"0.6\" | \"0.7\" | \"0.8\" | \"0.9\";\n meta?: SRPMeta;\n root: SRPNode;\n}\n\nexport interface SRPMeta {\n name?: string;\n version?: string;\n description?: string;\n publisher?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Discriminated union of all 46 node types\n// ---------------------------------------------------------------------------\n\nexport type SRPNode =\n // Containers (5)\n | ColumnNode\n | RowNode\n | GridNode\n | CardNode\n | DividerNode\n // Record rendering (3)\n | RecordLineNode\n | RecordLineListNode\n | ChipNode\n // Data display (4)\n | HeadingNode\n | TextNode\n | StatNode\n | KeyValueNode\n // Interactive (4)\n | ButtonNode\n | IconButtonNode\n | CopyButtonNode\n | SelectNode\n // Feedback (3)\n | EmptyStateNode\n | ErrorStateNode\n | SkeletonNode\n // Interactive containers + inputs — SRP v0.2 (5)\n | TabsNode\n | DataTableNode\n | BoardNode\n | TextInputNode\n | FormNode\n // Choice control — SRP v0.3 (1)\n | SegmentedNode\n // Visualization + hierarchy — SRP v0.4 (8)\n | MeterNode\n | GaugeNode\n | AvatarNode\n | ProgressNode\n | SparklineNode\n | ChartNode\n | TreeNode\n | TagInputNode\n // Library-workspace nodes — SRP v0.5 (4)\n | PopoverNode\n | SliderNode\n | RatingNode\n | ThumbnailNode\n // Configuration-control nodes — SRP v0.6 (2)\n | FacetGridNode\n | ColumnConfigNode\n // Visual atoms — SRP v0.8 (5)\n | GlyphNode\n | StatusDotNode\n | PulseNode\n | LinkNode\n | CodeNode\n // Settings/config input atoms — SRP v0.9 (2)\n | ToggleNode\n | AccordionNode;\n\n/**\n * The 46 canonical node-type discriminator strings (19 v0.1 + 5 v0.2 +\n * 1 v0.3 + 8 v0.4 + 4 v0.5 + 2 v0.6 + 5 v0.8 + 2 v0.9).\n */\nexport const NODE_TYPES = [\n \"column\",\n \"row\",\n \"grid\",\n \"card\",\n \"divider\",\n \"record-line\",\n \"record-line-list\",\n \"chip\",\n \"heading\",\n \"text\",\n \"stat\",\n \"key-value\",\n \"button\",\n \"icon-button\",\n \"copy-button\",\n \"select\",\n \"empty-state\",\n \"error-state\",\n \"skeleton\",\n // SRP v0.2 — interactive containers + inputs\n \"tabs\",\n \"data-table\",\n \"board\",\n \"text-input\",\n \"form\",\n // SRP v0.3 — choice control\n \"segmented\",\n // SRP v0.4 — visualization + hierarchy\n \"meter\",\n \"gauge\",\n \"avatar\",\n \"progress\",\n \"sparkline\",\n \"chart\",\n \"tree\",\n \"tag-input\",\n // SRP v0.5 — library-workspace nodes\n \"popover\",\n \"slider\",\n \"rating\",\n \"thumbnail\",\n // SRP v0.6 — configuration-control nodes\n \"facet-grid\",\n \"column-config\",\n // SRP v0.8 — visual atoms (kernel-rendered building blocks)\n \"glyph\",\n \"status-dot\",\n \"pulse\",\n \"link\",\n \"code\",\n // SRP v0.9 — settings/config input atoms (faculty settings_ui)\n \"toggle\",\n \"accordion\",\n] as const;\n\nexport type NodeType = (typeof NODE_TYPES)[number];\n\n// ---------------------------------------------------------------------------\n// Fields every node may carry\n// ---------------------------------------------------------------------------\n\ninterface NodeBase {\n when?: string;\n bind?: Record<string, unknown>;\n actions?: Record<string, SRPAction>;\n}\n\n// ---------------------------------------------------------------------------\n// Token unions (mirror @syncropel/react token scales)\n// ---------------------------------------------------------------------------\n\nexport type Gap = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type Padding = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type DividerSpacing = \"none\" | \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type Cols = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\nexport type ColumnAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type RowAlign = \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\nexport type Justify =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"between\"\n | \"around\"\n | \"evenly\";\n\nexport type RecordLineVariant =\n | \"feed\"\n | \"compact\"\n | \"detail\"\n | \"search\"\n | \"thread\";\n\nexport type ChipTone = \"default\" | \"info\" | \"warn\" | \"error\";\n\nexport type TextSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\";\nexport type TextTone =\n | \"primary\"\n | \"secondary\"\n | \"muted\"\n | \"success\"\n | \"warning\"\n | \"danger\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\nexport type ButtonSize = \"xs\" | \"sm\" | \"md\";\n\nexport type SkeletonShape = \"rect\" | \"circle\" | \"text\";\n\n// --- SRP v0.2 tokens ---\nexport type TableColumnAlign = \"start\" | \"end\";\nexport type DataTableVariant = \"default\" | \"compact\";\n/**\n * `secret` (SRP v0.9) renders masked and marks the value as sensitive:\n * hosts must not log or echo it, and write-backs should carry a secret\n * REFERENCE (e.g. an `auth_token_ref`), never the raw credential — the\n * referencing is the host adapter's concern, the masking is the\n * renderer's.\n */\nexport type TextInputKind = \"text\" | \"search\" | \"secret\";\n/**\n * How a `data-table` column renders its cell value. `text` (default) is a\n * plain string; `chip` renders the value as a compact metadata chip;\n * `lines` (SRP v0.4) renders a two-line cell — the value at `key` as the\n * primary line and the value at the column's `subKey` as a muted subtitle.\n *\n * SRP v0.5 adds three visual cell kinds: `meter` renders a numeric `0..1`\n * value as an inline bar (recoloured by the column's `thresholds`);\n * `rating` renders a numeric value as a row of stars (count from the\n * column's `max`); `thumbnail` renders a URL-valued cell as a small image.\n */\nexport type TableCellKind =\n | \"text\"\n | \"chip\"\n | \"lines\"\n | \"meter\"\n | \"rating\"\n | \"thumbnail\";\n\n// --- SRP v0.3 tokens ---\n\n/**\n * A row accent tone — `data-table` `rowTone` paints a left-border (and a\n * subtle tint) keyed off a column value. Wider than `ChipTone`: it adds\n * `accent` and `success` so a row can read as \"in progress\" / \"done\".\n */\nexport type RowTone =\n | \"default\"\n | \"accent\"\n | \"success\"\n | \"warn\"\n | \"error\"\n | \"info\";\n\n/** Sort direction for a `data-table` column. */\nexport type SortDirection = \"asc\" | \"desc\";\n\n/** Which side of the row a `data-table` `rowActions` cell sits on. */\nexport type RowActionPosition = \"leading\" | \"trailing\";\n\n/**\n * How a `segmented` control presents. `solid` (default) is a light pill\n * group; `underline` is a borderless tab strip (active option underlined).\n * Added in SRP v0.3.1.\n */\nexport type SegmentedVariant = \"solid\" | \"underline\";\n\n// --- SRP v0.4 tokens ---\n\n/**\n * A visualization tone — shared by `meter`, `gauge`, `progress`,\n * `sparkline`, and `chart`. Drives the fill / stroke colour. Added SRP v0.4.\n */\nexport type VizTone =\n | \"neutral\"\n | \"accent\"\n | \"success\"\n | \"warn\"\n | \"error\"\n | \"info\";\n\n/** A visualization size step — shared by the SRP v0.4 viz nodes. */\nexport type VizSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\n/** How a `meter` renders its fill — one bar, or a row of discrete cells. */\nexport type MeterVariant = \"continuous\" | \"segmented\";\n\n/** How a `sparkline` renders its series. */\nexport type SparklineVariant = \"line\" | \"bar\";\n\n/** The plot kind a `chart` draws. */\nexport type ChartKind = \"line\" | \"area\" | \"bar\" | \"pie\";\n\n/**\n * Glyph kinds — the closed enumeration of semantic symbols the palette renders.\n * Covers act types, domain objects, thread states, and the AITL marker.\n */\nexport type GlyphKind =\n // Act types (coordination)\n | \"INTEND\"\n | \"DO\"\n | \"KNOW\"\n | \"LEARN\"\n // Act types (effects)\n | \"GET\"\n | \"PUT\"\n | \"CALL\"\n | \"MAP\"\n // AITL marker\n | \"AITL\"\n // Domain objects\n | \"thread\"\n | \"fork\"\n | \"record-parent\"\n | \"namespace\"\n | \"actor\"\n | \"file\"\n | \"pattern\"\n | \"page\"\n | \"view\"\n // Thread states\n | \"state-open\"\n | \"state-active\"\n | \"state-converged\"\n | \"state-closed\"\n | \"state-abandoned\";\n\n// ---------------------------------------------------------------------------\n// Actions + queries\n// ---------------------------------------------------------------------------\n\n/**\n * The legacy (SRP ≤ v0.6) action form — an opaque intent name dispatched\n * to a host-supplied handler. Still valid in v0.7 as the escape hatch for\n * a non-generic host; new workspace records SHOULD prefer the v0.7 verbs.\n */\nexport interface ActionDesc {\n intent: string;\n payload?: Record<string, unknown>;\n}\n\n// --- SRP v0.7 — the host action grammar (ADR-109 D1) -----------------------\n\n/**\n * A record-emit specification. String values anywhere in `body` (and in\n * `thread`) may carry `{…}` interpolation resolved against the action\n * scope (`form.*`, `row.*`, `state.*`). `thread: \"$new\"` directs the host\n * to allocate a fresh `th_` id.\n */\nexport interface EmitSpec {\n /** Act type — INTEND | DO | KNOW | LEARN | GET | PUT | CALL | MAP. */\n act: string;\n /** Target thread id, or `\"$new\"` for a host-generated fresh thread. */\n thread: string;\n /** The record body. */\n body: Record<string, unknown>;\n}\n\n/**\n * v0.7 — emit a record via the SDK. Capability-checked by the generic\n * host against the workspace record's `meta.capabilities.emit`\n * (ADR-109 D5). An optional `id` keys the mutation lifecycle (ADR-109 D3);\n * `optimistic` supplies a body the host inserts immediately and rolls\n * back on failure.\n */\nexport interface EmitAction {\n emit: EmitSpec;\n id?: string;\n optimistic?: Record<string, unknown>;\n /**\n * v0.7 — actions dispatched *after* the emit resolves successfully.\n * The host runs them in order once the record is emitted (used to\n * close + clear a composer after a create). They do not run on\n * failure — so an error guard inside the still-open form can show.\n */\n onSuccess?: SRPAction[];\n}\n\n/** v0.7 — write the host state bag (ADR-109 D6). */\nexport interface SetStateAction {\n setState: { key: string; value: unknown };\n}\n\n/** v0.7 — route the viewer. Scope-checked against `meta.capabilities.navigate`. */\nexport interface NavigateAction {\n /** Target path; may carry `{…}` interpolation. */\n navigate: string;\n}\n\n/** v0.7 — open a record in a `<WorkspaceShell>` region. */\nexport interface OpenPaneAction {\n openPane: { region: string; record: string };\n}\n\n/**\n * An SRP action — what an event binding triggers. v0.7 adds four\n * self-describing verbs a generic host executes with no workspace-specific\n * code; the legacy `ActionDesc` form remains a member for compatibility.\n */\nexport type SRPAction =\n | ActionDesc\n | EmitAction\n | SetStateAction\n | NavigateAction\n | OpenPaneAction;\n\n/**\n * v0.7 — a named query binding (ADR-109 D4). A node's `bind.query` is\n * either a raw {@link VQLQuery} (legacy) or a `QueryBinding`. `name` lets\n * the host expose a query-count via the expression path\n * `query.<name>.count`. Exactly one of `filter` / `fold` is set:\n * `filter` is a raw ADR-037 VQL query; `fold` names a server-side\n * projection/fold endpoint (e.g. `\"tasks.snapshot\"`).\n */\nexport interface QueryBinding {\n name: string;\n filter?: VQLQuery;\n fold?: string;\n /**\n * v0.7 — an optional client-side row filter: an expression\n * (see `expr.ts`) evaluated per row against `{ row, state }`. Rows for\n * which it is falsy are dropped *after* fetch. This is the host-owned\n * post-fetch transform that lets filter state (`@state.*`) narrow a\n * query without re-hitting the server (ADR-109 D6).\n */\n where?: string;\n}\n\n/**\n * VQL (Value Query Language) — the query shape a Syncropel server resolves\n * against its record store. Used by `record-line-list` nodes that bind to\n * a live query rather than a static list of record ids.\n *\n * The shape is deliberately open (index signature) — additional fields\n * are protocol extensions the server understands.\n */\nexport interface VQLQuery {\n act?: string;\n actor?: string;\n thread?: string;\n kind?: string;\n since?: number;\n limit?: number;\n [k: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Container node definitions (5)\n// ---------------------------------------------------------------------------\n\nexport interface ColumnNode extends NodeBase {\n type: \"column\";\n props?: { gap?: Gap; align?: ColumnAlign; justify?: Justify };\n children?: SRPNode[];\n}\n\nexport interface RowNode extends NodeBase {\n type: \"row\";\n props?: {\n gap?: Gap;\n align?: RowAlign;\n justify?: Justify;\n wrap?: boolean;\n };\n children?: SRPNode[];\n}\n\nexport interface GridNode extends NodeBase {\n type: \"grid\";\n props: { cols: Cols; gap?: Gap; rowGap?: Gap; colGap?: Gap };\n children?: SRPNode[];\n}\n\nexport interface CardNode extends NodeBase {\n type: \"card\";\n props?: { padding?: Padding; interactive?: boolean };\n children?: SRPNode[];\n}\n\nexport interface DividerNode extends NodeBase {\n type: \"divider\";\n props?: { orientation?: \"horizontal\" | \"vertical\"; spacing?: DividerSpacing };\n}\n\n// ---------------------------------------------------------------------------\n// Record-rendering (3)\n// ---------------------------------------------------------------------------\n\nexport interface RecordLineNode extends NodeBase {\n type: \"record-line\";\n props: {\n variant: RecordLineVariant;\n /**\n * SRP v0.3 — an optional dotted body path (`body.priority`). When set,\n * the line renders a small chip carrying that field's value. Lets\n * `board` cards (which render through `record-line`) show a priority\n * or status chip.\n */\n chipField?: string;\n };\n bind: { record: string };\n}\n\nexport interface RecordLineListNode extends NodeBase {\n type: \"record-line-list\";\n props: { variant: RecordLineVariant; max?: number; empty?: string };\n bind: { query: VQLQuery | QueryBinding } | { items: string[] };\n}\n\nexport interface ChipNode extends NodeBase {\n type: \"chip\";\n props: { label: string; tone?: ChipTone; glyph?: GlyphKind };\n}\n\n// ---------------------------------------------------------------------------\n// Data display (4)\n// ---------------------------------------------------------------------------\n\nexport interface HeadingNode extends NodeBase {\n type: \"heading\";\n props: { level: 1 | 2 | 3 | 4 | 5 | 6; text: string };\n}\n\nexport interface TextNode extends NodeBase {\n type: \"text\";\n props: {\n text: string;\n size?: TextSize;\n weight?: TextWeight;\n tone?: TextTone;\n inline?: boolean;\n };\n}\n\nexport interface StatNode extends NodeBase {\n type: \"stat\";\n props: {\n label: string;\n value: string | number;\n delta?: string | number;\n deltaTone?: \"auto\" | \"neutral\";\n };\n}\n\nexport interface KeyValueNode extends NodeBase {\n type: \"key-value\";\n props: { label: string; value: string };\n}\n\n// ---------------------------------------------------------------------------\n// Interactive (4)\n// ---------------------------------------------------------------------------\n\nexport interface ButtonNode extends NodeBase {\n type: \"button\";\n props: {\n label: string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n disabled?: boolean;\n loading?: boolean;\n };\n actions?: { onClick?: SRPAction };\n}\n\nexport interface IconButtonNode extends NodeBase {\n type: \"icon-button\";\n props: {\n glyph: GlyphKind;\n ariaLabel: string;\n variant?: ButtonVariant;\n size?: ButtonSize;\n disabled?: boolean;\n loading?: boolean;\n };\n actions?: { onClick?: SRPAction };\n}\n\nexport interface CopyButtonNode extends NodeBase {\n type: \"copy-button\";\n props: { value: string; label?: string };\n}\n\nexport interface SelectNode extends NodeBase {\n type: \"select\";\n props: { options: { label: string; value: string }[] };\n bind: { value: string };\n actions?: { onChange?: SRPAction };\n}\n\n// ---------------------------------------------------------------------------\n// Feedback (3)\n// ---------------------------------------------------------------------------\n\nexport interface EmptyStateNode extends NodeBase {\n type: \"empty-state\";\n props: {\n message: string;\n action?: { label: string; intent: string };\n };\n}\n\nexport interface ErrorStateNode extends NodeBase {\n type: \"error-state\";\n props: {\n message: string;\n retry?: { intent: string };\n };\n}\n\nexport interface SkeletonNode extends NodeBase {\n type: \"skeleton\";\n props?: {\n shape?: SkeletonShape;\n width?: string | number | \"full\";\n height?: string | number;\n };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.2 — interactive containers + inputs (5)\n//\n// All five reuse the v0.1 contract: `props` is static config, `bind` is\n// host-supplied state, `actions` declares intents the host dispatches. SRP\n// owns layout + shape; the host owns state + behaviour. See ADR-102 and the\n// SRP v0.2 design spec.\n// ---------------------------------------------------------------------------\n\n/**\n * A container whose children are panels; one panel shows at a time. The host\n * supplies the active tab id via `bind.active` and renders the panel whose\n * index matches it in `props.tabs`.\n */\nexport interface TabsNode extends NodeBase {\n type: \"tabs\";\n props: { tabs: { id: string; label: string; glyph?: GlyphKind }[] };\n bind: { active: string };\n actions?: { onTabChange?: SRPAction };\n /** Panels, parallel to `props.tabs` by index. */\n children?: SRPNode[];\n}\n\n/** A single `data-table` column definition. */\nexport interface DataTableColumnDef {\n /** Dotted path into each row (`body.goal`, `actor`). */\n key: string;\n label: string;\n align?: TableColumnAlign;\n width?: string;\n /** How the cell value renders. Default `text`. */\n kind?: TableCellKind;\n /**\n * SRP v0.3 — for a `kind: \"chip\"` column, a map from cell value to chip\n * tone. A value with no entry renders a `default`-tone chip.\n */\n tones?: Record<string, ChipTone>;\n /**\n * SRP v0.3 — an explicit value order for sorting this column. When the\n * column is the sort key, rows order by each value's index in this list\n * (so `critical` < `high` < `medium` < `low`, not alphabetical). Values\n * absent from the list sort after the listed ones.\n */\n order?: string[];\n /**\n * SRP v0.4 — for a `kind: \"lines\"` column, the dotted path whose value\n * renders as the muted second line beneath the `key` value.\n */\n subKey?: string;\n /**\n * SRP v0.5 — for a `kind: \"meter\"` column, value-keyed recolouring of\n * the inline bar (energy low→high, score bands). List in ascending `at`.\n */\n thresholds?: VizThreshold[];\n /**\n * SRP v0.5 — for a `kind: \"rating\"` column, the number of stars. Also\n * the default tone source for a `meter` cell when no `thresholds` match.\n * Default 5.\n */\n max?: number;\n}\n\n/** SRP v0.3 — a `data-table` sort descriptor. */\nexport interface TableSort {\n key: string;\n direction: SortDirection;\n}\n\n/**\n * SRP v0.3 — a per-row action affordance on a `data-table`. Rendered as a\n * small button in a leading or trailing cell; a click dispatches `intent`\n * with the row merged into the payload as `row`.\n */\nexport interface TableRowAction {\n /** Stable identifier for this row action (also the legacy intent name). */\n intent: string;\n /** A semantic glyph for an icon-only affordance. */\n glyph?: GlyphKind;\n /** A text label — used when no `glyph` is given (or as the aria-label). */\n label?: string;\n /** Which side of the row the action cell sits on. Default `leading`. */\n position?: RowActionPosition;\n /**\n * v0.7 — the action a click triggers. When set, the host dispatches\n * this `SRPAction` with the row as runtime context (`{row}`); when\n * omitted, the legacy `{ intent, payload: { row } }` form is dispatched.\n */\n action?: SRPAction;\n}\n\n/**\n * SRP v0.3 — a `data-table` row accent. The row paints a left-border (and\n * a subtle tint) whose tone is looked up from `tones` by the value at\n * `key`. A value with no entry gets no accent.\n */\nexport interface TableRowTone {\n /** Dotted path into the row whose value selects the tone. */\n key: string;\n tones: Record<string, RowTone>;\n}\n\n/**\n * A columnar record list — richer than `record-line-list`: explicit columns,\n * alignment, optional sort. `column.key` is a dotted path into each row.\n *\n * SRP v0.3 adds the polished-data-grid props: column `tones` + `order`,\n * `defaultSort`, `rowActions`, and `rowTone`. SRP v0.4 adds `selectable`\n * (a leading checkbox column with multi-select) — all optional + additive.\n */\nexport interface DataTableNode extends NodeBase {\n type: \"data-table\";\n props: {\n columns: DataTableColumnDef[];\n variant?: DataTableVariant;\n sortable?: boolean;\n empty?: string;\n /** SRP v0.3 — the sort applied before any header interaction. */\n defaultSort?: TableSort;\n /** SRP v0.3 — per-row action affordances. */\n rowActions?: TableRowAction[];\n /** SRP v0.3 — a value-keyed row accent. */\n rowTone?: TableRowTone;\n /**\n * SRP v0.4 — render a leading checkbox column with a select-all\n * header. The table owns selection state and dispatches\n * `onSelectionChange` with the selected rows.\n */\n selectable?: boolean;\n /**\n * SRP v0.5 — pin the first N columns (and the leading checkbox /\n * action cells) so they stay visible while the rest scroll\n * horizontally. Default 0 (no pinned columns).\n */\n stickyColumns?: number;\n };\n bind: { query: VQLQuery | QueryBinding } | { rows: Record<string, unknown>[] };\n actions?: {\n onRowClick?: SRPAction;\n onSort?: SRPAction;\n /** SRP v0.4 — fired (with `rows`) when the selection changes. */\n onSelectionChange?: SRPAction;\n };\n}\n\n/**\n * A kanban board — records bucketed into columns by the `props.groupBy` field.\n * A record lands in the column whose `id` equals its `groupBy` value; records\n * matching no column are dropped. `onCardMove` is advisory — a host MAY\n * support drag; a board without drag is read-only and still valid.\n */\nexport interface BoardNode extends NodeBase {\n type: \"board\";\n props: {\n columns: { id: string; label: string }[];\n groupBy: string;\n cardVariant?: RecordLineVariant;\n /**\n * SRP v0.3 — a dotted body path passed through to each card's\n * `record-line` as its `chipField`, so cards show a metadata chip\n * (e.g. `body.priority`).\n */\n cardChipField?: string;\n };\n bind: { query: VQLQuery | QueryBinding };\n actions?: { onCardClick?: SRPAction; onCardMove?: SRPAction };\n}\n\n/**\n * An editable text field — the `select` of free text. The host owns\n * `bind.value` and re-renders on change (identical ownership model to\n * `select`).\n */\nexport interface TextInputNode extends NodeBase {\n type: \"text-input\";\n props?: {\n placeholder?: string;\n multiline?: boolean;\n inputKind?: TextInputKind;\n size?: TextSize;\n disabled?: boolean;\n };\n bind: { value: string };\n actions?: { onChange?: SRPAction; onSubmit?: SRPAction };\n}\n\n/**\n * A container that groups inputs and declares a submit intent. The host\n * collects child input values (by their `bind`) and dispatches `onSubmit`.\n */\nexport interface FormNode extends NodeBase {\n type: \"form\";\n props?: { submitLabel?: string; busy?: boolean };\n actions?: { onSubmit?: SRPAction };\n children?: SRPNode[];\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.3 — choice control (1)\n//\n// `segmented` is the third stateful input (alongside `select` + `text-input`)\n// and reuses the same ownership model: `bind.value` is host-supplied, a\n// pick dispatches `onChange`. See ADR-103.\n// ---------------------------------------------------------------------------\n\n/** One option in a `segmented` control. */\nexport interface SegmentedOption {\n value: string;\n label: string;\n /** An optional count/marker rendered as a small badge on the option. */\n badge?: string | number;\n}\n\n/**\n * v0.7 — a live group-count binding for `segmented` option badges. The\n * host counts the records in query `from`, grouped by the `groupBy`\n * dotted field; each option whose `value` equals a group value gets that\n * count as its badge. The option named by `total` (a catch-all like\n * \"All\") gets the grand total. Lets a static record show live filter\n * counts without baking them in.\n */\nexport interface SegmentedCounts {\n /** The query name (a `QueryBinding.name`) whose records are counted. */\n from: string;\n /** Dotted field path the records are grouped by (`body.bucket`). */\n groupBy: string;\n /** Option value that should display the grand total (e.g. `\"all\"`). */\n total?: string;\n}\n\n/**\n * A row of mutually-exclusive options — a filter/choice control. Distinct\n * from `tabs`: it has no panels, it is purely a bound value. The host owns\n * `bind.value`; picking an option dispatches `onChange` with the new value.\n */\nexport interface SegmentedNode extends NodeBase {\n type: \"segmented\";\n props: {\n options: SegmentedOption[];\n size?: ButtonSize;\n /** Presentation — `solid` (light pill group, default) or `underline`\n * (borderless tab strip). Added in SRP v0.3.1. */\n variant?: SegmentedVariant;\n };\n /**\n * `value` is the host-supplied selection. `counts` (v0.7) binds live\n * group-counts onto the option badges — see {@link SegmentedCounts}.\n */\n bind: { value: string; counts?: SegmentedCounts };\n actions?: { onChange?: SRPAction };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.4 — visualization + hierarchy nodes (8)\n//\n// `meter`, `gauge`, `progress`, `sparkline`, `chart` are read-only data\n// displays — `props` carries the values, there is no `bind`. `avatar` is a\n// read-only identity token. `tree` + `tag-input` are interactive: they\n// reuse the v0.1 ownership model — `bind` is host state, `actions` declares\n// dispatched intents. Music-specific widgets (waveforms, transition tables)\n// are NOT in SRP — a renderer registers those as plug-in node types. See\n// ADR-104.\n// ---------------------------------------------------------------------------\n\n/**\n * A value→tone threshold for a `meter`. The meter's value selects the\n * highest threshold whose `at` it reaches; that tone recolours the fill.\n * List thresholds in ascending `at` order.\n */\nexport interface VizThreshold {\n at: number;\n tone: VizTone;\n}\n\n/**\n * A horizontal bar gauge — renders a `0..1` reading as a proportional\n * fill. `continuous` is a single bar; `segmented` is a row of discrete\n * cells. `thresholds` recolours the meter by value (energy low→high,\n * trust score, match confidence).\n */\nexport interface MeterNode extends NodeBase {\n type: \"meter\";\n props: {\n /** The reading, clamped to `0..1`. */\n value: number;\n tone?: VizTone;\n variant?: MeterVariant;\n /** Cell count when `variant: \"segmented\"`. Default 5. */\n segments?: number;\n /** Value-keyed recolouring; overrides `tone` for the matched band. */\n thresholds?: VizThreshold[];\n size?: VizSize;\n /** Optional caption rendered beside the bar. */\n label?: string;\n };\n}\n\n/** A coloured band on a `gauge` arc — e.g. a Dial zone. */\nexport interface GaugeZone {\n from: number;\n to: number;\n tone: VizTone;\n label?: string;\n}\n\n/**\n * A radial arc gauge — renders a `0..1` reading on a 270° arc. Doubles as\n * the Syncropel Dial (the `d ∈ [0,1]` control surface, F3): `zones` paints\n * the REPLAY / ADAPT / EXPLORE / CREATE bands.\n */\nexport interface GaugeNode extends NodeBase {\n type: \"gauge\";\n props: {\n /** The reading, clamped to `0..1`. */\n value: number;\n label?: string;\n tone?: VizTone;\n /** Coloured arc bands — drawn behind the value sweep. */\n zones?: GaugeZone[];\n size?: VizSize;\n /** Render the numeric value in the arc centre. Default true. */\n showValue?: boolean;\n /** How the centre value reads. Default `decimal`. */\n format?: \"percent\" | \"decimal\";\n };\n}\n\n/**\n * A compact identity token — an image (`src`), or initials derived from\n * `name`, or a semantic `glyph` fallback. Square, rounded.\n */\nexport interface AvatarNode extends NodeBase {\n type: \"avatar\";\n props: {\n /** Display name — the source of initials + the accessible label. */\n name: string;\n src?: string;\n glyph?: GlyphKind;\n size?: VizSize;\n };\n}\n\n/**\n * A progress bar. With `value` it fills proportionally (determinate);\n * with `indeterminate` it animates with no known extent. Distinct from\n * `meter`: `progress` reads as \"advancing toward done\", `meter` as a\n * static measurement.\n */\nexport interface ProgressNode extends NodeBase {\n type: \"progress\";\n props?: {\n /** The fraction complete, `0..1`. Omit when `indeterminate`. */\n value?: number;\n indeterminate?: boolean;\n tone?: VizTone;\n label?: string;\n /** Render the percentage as text. Default false. */\n showValue?: boolean;\n size?: VizSize;\n };\n}\n\n/**\n * A tiny inline chart — a bare series with no axes or legend, for\n * trend-at-a-glance (cost over time, dispatch throughput, energy shape).\n */\nexport interface SparklineNode extends NodeBase {\n type: \"sparkline\";\n props: {\n values: number[];\n variant?: SparklineVariant;\n tone?: VizTone;\n /** Width in px, or `\"full\"` to fill the container. Default 96. */\n width?: number | \"full\";\n /** Height in px. Default 24. */\n height?: number;\n };\n}\n\n/** One point in a `chart` series. */\nexport interface ChartPoint {\n x: string | number;\n y: number;\n}\n\n/** One series in a `chart` — or, for a `pie`, one ring of slices. */\nexport interface ChartSeries {\n label?: string;\n tone?: VizTone;\n points: ChartPoint[];\n}\n\n/**\n * A labelled chart — a `line` / `area` / `bar` plot, or a `pie` whose\n * slices are `series[0].points`. Richer than `sparkline`: axes, a legend,\n * a title.\n */\nexport interface ChartNode extends NodeBase {\n type: \"chart\";\n props: {\n kind: ChartKind;\n series: ChartSeries[];\n title?: string;\n /** Plot height in px. Default 200. */\n height?: number;\n /** Draw axes + gridlines (ignored for `pie`). Default true. */\n showAxis?: boolean;\n /** Draw a series legend. Default false. */\n showLegend?: boolean;\n };\n}\n\n/** One node in a `tree`. Recursive — `children` nest arbitrarily deep. */\nexport interface TreeItem {\n id: string;\n label: string;\n glyph?: GlyphKind;\n /** A small trailing count / marker. */\n badge?: string | number;\n children?: TreeItem[];\n}\n\n/**\n * A hierarchical, collapsible list — playlist folders, namespace trees,\n * thread forks, file browsers. The host owns `bind.selected` /\n * `bind.expanded`; a click dispatches `onSelect` / `onToggle`. When `bind`\n * is omitted the tree manages expand/collapse internally.\n */\nexport interface TreeNode extends NodeBase {\n type: \"tree\";\n props: {\n items: TreeItem[];\n /** Item ids expanded on first render. */\n defaultExpanded?: string[];\n };\n bind?: { selected?: string; expanded?: string[] };\n actions?: { onSelect?: SRPAction; onToggle?: SRPAction };\n}\n\n/**\n * An editable set of tags — type-and-enter to add, click ✕ to remove,\n * optional autocomplete `suggestions`. The fourth stateful input\n * (alongside `select`, `text-input`, `segmented`); the host owns\n * `bind.tags` and re-renders on `onChange`.\n */\nexport interface TagInputNode extends NodeBase {\n type: \"tag-input\";\n props?: {\n placeholder?: string;\n suggestions?: string[];\n size?: TextSize;\n disabled?: boolean;\n };\n bind: { tags: string[] };\n actions?: { onChange?: SRPAction };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.5 — library-workspace nodes (4)\n//\n// `popover` is a container whose children are an anchored panel — it owns\n// its own open/close state, so it needs no `bind`. `slider` + `rating` are\n// the fifth + sixth stateful inputs (alongside select / text-input /\n// segmented / tag-input): the host owns `bind.value`, a change dispatches\n// `onChange`. `thumbnail` is a read-only rectangular image token. These\n// four close the gap between the visualization palette and a full\n// library-management workspace (a configurable grid + filter + column\n// popovers + a record editor). See ADR-105.\n// ---------------------------------------------------------------------------\n\n/** Which edge of the trigger a `popover` panel aligns to. */\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\n/** Corner rounding for a `thumbnail`. */\nexport type ThumbnailRadius = \"none\" | \"sm\" | \"md\" | \"lg\" | \"full\";\n\n/** Aspect ratio for a `thumbnail`. */\nexport type ThumbnailAspect = \"square\" | \"video\" | \"wide\";\n\n/**\n * A trigger button paired with an anchored panel. Clicking the trigger\n * opens `children` in a popover; an outside click or `Escape` closes it.\n * The popover owns its open state — it is presentation, not host state —\n * so there is no `bind`. The toolbar Columns + Filters controls of a\n * library view are `popover` nodes wrapping a `column-config` / `facet`\n * panel.\n */\nexport interface PopoverNode extends NodeBase {\n type: \"popover\";\n props: {\n /** The trigger button's label. */\n label: string;\n /** An optional leading glyph on the trigger. */\n glyph?: GlyphKind;\n variant?: ButtonVariant;\n size?: ButtonSize;\n /** Which trigger edge the panel aligns to. Default `start`. */\n align?: PopoverAlign;\n /** A small count/marker badge on the trigger (e.g. active filters). */\n badge?: string | number;\n };\n /** The popover panel content. */\n children?: SRPNode[];\n}\n\n/**\n * A draggable numeric input — the continuous sibling of `select`. The host\n * owns `bind.value`; a drag (or arrow key) dispatches `onChange` with the\n * new value. Distinct from `meter` (read-only measurement) and `progress`\n * (advancing-toward-done): `slider` is an editable control.\n */\nexport interface SliderNode extends NodeBase {\n type: \"slider\";\n props: {\n min: number;\n max: number;\n /** Snap increment. Default 1. */\n step?: number;\n tone?: VizTone;\n label?: string;\n /** Render the current value as text beside the track. Default false. */\n showValue?: boolean;\n size?: VizSize;\n disabled?: boolean;\n };\n bind: { value: number };\n actions?: { onChange?: SRPAction };\n}\n\n/**\n * A row of stars. With `readOnly` it is a display (a table cell, a card\n * field); otherwise it is an input — clicking a star dispatches `onChange`\n * with the new value. The host owns `bind.value`.\n */\nexport interface RatingNode extends NodeBase {\n type: \"rating\";\n props?: {\n /** Star count. Default 5. */\n max?: number;\n size?: VizSize;\n /** Display only — no interaction, no `onChange`. Default false. */\n readOnly?: boolean;\n tone?: VizTone;\n };\n bind: { value: number };\n actions?: { onChange?: SRPAction };\n}\n\n/**\n * A rectangular image token — album art, a file preview, a cover. An\n * `src` image, or a semantic `glyph` fallback when `src` is absent or\n * fails to load. Distinct from `avatar` (a square identity token that\n * derives initials from a name): `thumbnail` is content imagery with a\n * configurable aspect ratio.\n */\nexport interface ThumbnailNode extends NodeBase {\n type: \"thumbnail\";\n props: {\n /** Accessible description — required even when `src` is set. */\n alt: string;\n src?: string;\n /** Fallback glyph when `src` is absent or fails to load. */\n glyph?: GlyphKind;\n size?: VizSize;\n /** Corner rounding. Default `sm`. */\n radius?: ThumbnailRadius;\n /** Aspect ratio. Default `square`. */\n aspect?: ThumbnailAspect;\n };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.6 — configuration-control nodes (2)\n//\n// `facet-grid` + `column-config` are the declarative bodies of the\n// Filters and Columns popovers of a library workspace. Both are stateful\n// inputs in the v0.1 ownership model — the host owns `bind`, an\n// interaction dispatches an intent. They pair with `data-table`:\n// `facet-grid` chooses which rows it shows, `column-config` chooses which\n// columns. See ADR-106.\n// ---------------------------------------------------------------------------\n\n/** One selectable option within a `facet-grid` category. */\nexport interface FacetOption {\n value: string;\n label: string;\n /** A corpus count rendered as a trailing badge on the chip. */\n count?: number;\n}\n\n/** One category (tab) of a `facet-grid` — e.g. genre, mood, vibe. */\nexport interface FacetCategory {\n id: string;\n label: string;\n options: FacetOption[];\n}\n\n/**\n * A faceted filter — a row of category tabs, and beneath the active tab a\n * wrapped grid of selectable, count-bearing chips. The host owns the\n * active category (`bind.active`) and the selected values per category\n * (`bind.selected`); a tab pick dispatches `onFacetChange`, a chip toggle\n * dispatches `onToggle`. The Filters panel's tag section of a library\n * view is a `facet-grid`.\n */\nexport interface FacetGridNode extends NodeBase {\n type: \"facet-grid\";\n props: {\n facets: FacetCategory[];\n };\n bind: {\n /** The active category id. */\n active: string;\n /** Selected values, keyed by category id. */\n selected?: Record<string, string[]>;\n };\n actions?: {\n /** Category tab changed — payload `{ facet }`. */\n onFacetChange?: SRPAction;\n /** A chip toggled — payload `{ facet, value }`. */\n onToggle?: SRPAction;\n };\n}\n\n/** One configurable column in a `column-config`. */\nexport interface ColumnConfigColumn {\n id: string;\n label: string;\n}\n\n/** A named visible-column set a `column-config` can apply in one click. */\nexport interface ColumnConfigPreset {\n id: string;\n label: string;\n /** The visible column ids, in order. */\n columns: string[];\n}\n\n/**\n * A grid column picker — preset buttons plus a drag-to-reorder list of\n * visibility checkboxes. The host owns `bind.visible` (the visible column\n * ids, in display order); any change dispatches `onChange` with the new\n * order. Pairs with `data-table` — `bind.visible` selects + orders the\n * table's columns. The Columns panel of a library view is a\n * `column-config`.\n */\nexport interface ColumnConfigNode extends NodeBase {\n type: \"column-config\";\n props: {\n columns: ColumnConfigColumn[];\n presets?: ColumnConfigPreset[];\n };\n bind: {\n /** The visible column ids, in display order. */\n visible: string[];\n };\n actions?: {\n /** Visibility or order changed — payload `{ visible }`. */\n onChange?: SRPAction;\n };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.8 — visual atoms (5)\n//\n// The five kernel-rendered building blocks for `core.site.v1` static\n// sites (per ADR-104 Amendment 1 §D5 + ADR-119). All five are read-only\n// — `props` carries the value, no `bind`, no `actions`, no `when`. The\n// kernel SSR renderer renders them to zero-JS HTML using the canonical\n// design tokens (per ADR-118). The React renderer renders them as\n// `<Glyph>`, `<StatusDot>`, `<Pulse>`, `<Link>`, `<Code>` atoms.\n//\n// Per ADR-120, both renderers produce DOM-tree-equivalent output for\n// every fixture in the conformance corpus.\n// ---------------------------------------------------------------------------\n\n/** Size step for a `glyph` node. */\nexport type GlyphSize = \"xs\" | \"sm\" | \"md\";\n\n/** Size step for a `status-dot` node. */\nexport type StatusDotSize = \"xs\" | \"sm\";\n\n/**\n * A state colour signalled by `status-dot`. Distinct from `ChipTone`:\n * `chip` is a labelled metadata chip; `status-dot` is a coloured\n * filled circle signalling a workflow state (not a semantic kind —\n * for kind identity use `glyph` instead).\n */\nexport type StatusDotState =\n | \"active\"\n | \"idle\"\n | \"blocked\"\n | \"error\"\n | \"success\"\n | \"warning\"\n | \"muted\";\n\n/** Where a `link` node opens. */\nexport type LinkTarget = \"_self\" | \"_blank\";\n\n/** Tone of a `link` node. */\nexport type LinkTone = \"accent\" | \"primary\" | \"muted\";\n\n/**\n * A canonical Unicode-symbol glyph for a semantic kind — act type,\n * domain object, thread state, or AITL marker. Renders as a\n * `role=\"img\"` span carrying the symbol from the canonical glyph\n * table (per ADR-119 D3, mirroring `@syncropel/react/tokens/glyphs.ts`).\n *\n * For state-as-status (active/blocked/etc.), use `status-dot` instead.\n */\nexport interface GlyphNode extends NodeBase {\n type: \"glyph\";\n props: {\n kind: GlyphKind;\n size?: GlyphSize;\n /** When true (default), the glyph adopts its semantic color.\n * When false, inherits `currentColor`. */\n colored?: boolean;\n /** Accessible label override. Defaults to `\"<kind> glyph\"`. */\n label?: string;\n };\n}\n\n/**\n * A small filled circle indicating state. For semantic kind identity\n * (act type, domain object), use `glyph` instead.\n */\nexport interface StatusDotNode extends NodeBase {\n type: \"status-dot\";\n props: {\n state: StatusDotState;\n size?: StatusDotSize;\n /** When true, the dot pulses (using the global `animate-pulse`\n * keyframe). Respects `prefers-reduced-motion`. */\n pulse?: boolean;\n /** Accessible label. Omit if paired with visible text in the parent;\n * required when the dot is standalone. */\n label?: string;\n };\n}\n\n/**\n * A pulsing inline loading affordance — typically an animated `…`\n * ellipsis. For block-level loading placeholders use `skeleton`\n * instead; for advancing-progress use `progress`.\n */\nexport interface PulseNode extends NodeBase {\n type: \"pulse\";\n props?: {\n /** Accessible announcement. Defaults to `\"Loading\"`. */\n label?: string;\n };\n}\n\n/**\n * A navigational anchor. Distinct from `button`:\n * - `link` is for navigation (`<a href>`); the renderer emits a real anchor.\n * - `button` is for actions (dispatches via `actions.onClick`).\n *\n * External targets (`target='_blank'`) automatically receive\n * `rel=\"noreferrer\"`. Renders a focus ring + hover affordance via the\n * canonical design tokens.\n */\nexport interface LinkNode extends NodeBase {\n type: \"link\";\n props: {\n href: string;\n text: string;\n target?: LinkTarget;\n tone?: LinkTone;\n };\n}\n\n/**\n * Inline or block-level code. `inline` (default true) renders as\n * `<code>` for use within text; `inline: false` renders as\n * `<pre><code>` for a block. An optional `title` surfaces as the\n * element's accessible name.\n */\nexport interface CodeNode extends NodeBase {\n type: \"code\";\n props: {\n text: string;\n inline?: boolean;\n /** Accessible title — surfaces as `title` attribute. */\n title?: string;\n };\n}\n\n// ---------------------------------------------------------------------------\n// SRP v0.9 — settings/config input atoms (2)\n//\n// The atoms a faculty's declared `settings_ui` projection is authored\n// with (research day-one/12 §5): Settings is a fold over deployed\n// faculties — each `core.engine.faculty.v1` manifest carries its own\n// `settings_ui` SRP document, so a new faculty ships its settings\n// screen as data with zero host change. Both reuse the v0.1 ownership\n// contract: `props` is static config, `bind` is host-supplied state,\n// `actions` declares what a change dispatches (typically an\n// `EmitAction` LEARN on `th_engine_config` — the existing v0.7 action\n// grammar IS the write-back; no new binding mechanism).\n// ---------------------------------------------------------------------------\n\n/**\n * A labelled on/off switch — the faculty opt-in control. The host owns\n * `bind.value` and re-renders on change (the `select` ownership model,\n * boolean-valued). `description` carries the reassurance line (\"you can\n * add this later\").\n */\nexport interface ToggleNode extends NodeBase {\n type: \"toggle\";\n props: {\n label: string;\n /** Secondary line under the label (e.g. \"you can add this later\"). */\n description?: string;\n disabled?: boolean;\n };\n bind: { value: boolean };\n actions?: { onChange?: SRPAction };\n}\n\n/**\n * A collapsible section grouping child atoms — the \"Customize\" /\n * progressive-disclosure container. Structural: no value of its own.\n * When `bind` is omitted the accordion manages open/closed internally\n * (the `tree` precedent); a host may control it via `bind.open` and\n * observe flips via `onToggle`.\n */\nexport interface AccordionNode extends NodeBase {\n type: \"accordion\";\n props: {\n title: string;\n subtitle?: string;\n /** Initial state when uncontrolled. Default false (collapsed). */\n defaultOpen?: boolean;\n };\n bind?: { open?: boolean };\n actions?: { onToggle?: SRPAction };\n children?: SRPNode[];\n}\n"]}
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Runtime validators for SRP v0.1 – v0.7 documents.
2
+ * Runtime validators for SRP v0.1 – v0.8 documents.
3
3
  *
4
4
  * Pure functions — no dependencies. Return a ValidationResult with either a
5
- * `valid: true` flag or a list of errors keyed by path.
5
+ * `valid: true` flag or a list of errors keyed by path. v0.8 adds five
6
+ * visual-atom validators (glyph, status-dot, pulse, link, code) — per
7
+ * ADR-119; all additive.
6
8
  */
7
9
  import type { SRPDocument, SRPNode } from "./schema.js";
8
10
  export interface ValidationError {
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAOxD,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,MAAM,mBAAmB,GAC3B,qBAAqB,GACrB,cAAc,GACd,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,wBAAwB,GACxB,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,uBAAuB,GACvB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GACxB;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GACf;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAahD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAoC1D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAM1E;AAw7CD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW,CAG9D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,OAAO,CAGxD"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAOxD,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,MAAM,mBAAmB,GAC3B,qBAAqB,GACrB,cAAc,GACd,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,wBAAwB,GACxB,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,uBAAuB,GACvB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GACxB;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GACf;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAahD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAsC1D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAM1E;AA88CD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW,CAG9D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,OAAO,CAGxD"}
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Runtime validators for SRP v0.1 – v0.7 documents.
2
+ * Runtime validators for SRP v0.1 – v0.8 documents.
3
3
  *
4
4
  * Pure functions — no dependencies. Return a ValidationResult with either a
5
- * `valid: true` flag or a list of errors keyed by path.
5
+ * `valid: true` flag or a list of errors keyed by path. v0.8 adds five
6
+ * visual-atom validators (glyph, status-dot, pulse, link, code) — per
7
+ * ADR-119; all additive.
6
8
  */
7
9
  import { NODE_TYPES } from "./schema.js";
8
10
  class Collector {
@@ -34,8 +36,10 @@ export function validateSRP(doc) {
34
36
  d.srp !== "0.4" &&
35
37
  d.srp !== "0.5" &&
36
38
  d.srp !== "0.6" &&
37
- d.srp !== "0.7") {
38
- c.add("/srp", "SRP_VERSION_INVALID", `srp field must be "0.1"–"0.7", got ${JSON.stringify(d.srp)}`);
39
+ d.srp !== "0.7" &&
40
+ d.srp !== "0.8" &&
41
+ d.srp !== "0.9") {
42
+ c.add("/srp", "SRP_VERSION_INVALID", `srp field must be "0.1"–"0.9", got ${JSON.stringify(d.srp)}`);
39
43
  }
40
44
  if (!("root" in d)) {
41
45
  c.add("/root", "ROOT_MISSING", "SRP document must have a root node");
@@ -186,6 +190,28 @@ function validateNodeInto(node, path, c) {
186
190
  case "column-config":
187
191
  validateColumnConfig(n, path, c);
188
192
  break;
193
+ // SRP v0.8 — visual atoms
194
+ case "glyph":
195
+ validateGlyph(n, path, c);
196
+ break;
197
+ case "status-dot":
198
+ validateStatusDot(n, path, c);
199
+ break;
200
+ case "pulse":
201
+ validatePulse(n, path, c);
202
+ break;
203
+ case "link":
204
+ validateLink(n, path, c);
205
+ break;
206
+ case "code":
207
+ validateCode(n, path, c);
208
+ break;
209
+ case "toggle":
210
+ validateToggle(n, path, c);
211
+ break;
212
+ case "accordion":
213
+ validateAccordion(n, path, c);
214
+ break;
189
215
  }
190
216
  }
191
217
  // ---------------------------------------------------------------------------
@@ -487,7 +513,7 @@ function validateTextInput(n, path, c) {
487
513
  }
488
514
  const props = n.props;
489
515
  if (props && props.inputKind !== undefined) {
490
- const allowed = ["text", "search"];
516
+ const allowed = ["text", "search", "secret"];
491
517
  if (typeof props.inputKind !== "string" ||
492
518
  !allowed.includes(props.inputKind)) {
493
519
  c.add(`${path}/props/inputKind`, "PROPS_INVALID_VALUE", `text-input "props.inputKind" must be one of ${allowed.join(" | ")}`);
@@ -830,4 +856,135 @@ export function isSRPNode(node) {
830
856
  const result = validateNode(node, "");
831
857
  return result.valid;
832
858
  }
859
+ // ---------------------------------------------------------------------------
860
+ // SRP v0.8 — visual-atom validators (5)
861
+ // ---------------------------------------------------------------------------
862
+ const VALID_GLYPH_KINDS = new Set([
863
+ // Act types (coordination)
864
+ "INTEND", "DO", "KNOW", "LEARN",
865
+ // Act types (effects)
866
+ "GET", "PUT", "CALL", "MAP",
867
+ // AITL marker
868
+ "AITL",
869
+ // Domain objects
870
+ "thread", "fork", "record-parent", "namespace", "actor", "file", "pattern", "page", "view",
871
+ // Thread states
872
+ "state-open", "state-active", "state-converged", "state-closed", "state-abandoned",
873
+ ]);
874
+ const VALID_GLYPH_SIZES = new Set(["xs", "sm", "md"]);
875
+ const VALID_STATUS_DOT_STATES = new Set([
876
+ "active", "idle", "blocked", "error", "success", "warning", "muted",
877
+ ]);
878
+ const VALID_STATUS_DOT_SIZES = new Set(["xs", "sm"]);
879
+ const VALID_LINK_TARGETS = new Set(["_self", "_blank"]);
880
+ const VALID_LINK_TONES = new Set(["accent", "primary", "muted"]);
881
+ function validateGlyph(n, path, c) {
882
+ const props = (n.props ?? {});
883
+ if (typeof props.kind !== "string") {
884
+ c.add(`${path}/props/kind`, "PROPS_MISSING_REQUIRED", `glyph requires "props.kind" (a string)`);
885
+ }
886
+ else if (!VALID_GLYPH_KINDS.has(props.kind)) {
887
+ c.add(`${path}/props/kind`, "PROPS_INVALID_VALUE", `glyph "props.kind" must be a known GlyphKind; got "${props.kind}"`);
888
+ }
889
+ if (props.size !== undefined && (typeof props.size !== "string" || !VALID_GLYPH_SIZES.has(props.size))) {
890
+ c.add(`${path}/props/size`, "PROPS_INVALID_VALUE", `glyph "props.size" must be "xs"|"sm"|"md"`);
891
+ }
892
+ if (props.colored !== undefined && typeof props.colored !== "boolean") {
893
+ c.add(`${path}/props/colored`, "PROPS_INVALID_VALUE", `glyph "props.colored" must be a boolean`);
894
+ }
895
+ if (props.label !== undefined && typeof props.label !== "string") {
896
+ c.add(`${path}/props/label`, "PROPS_INVALID_VALUE", `glyph "props.label" must be a string when provided`);
897
+ }
898
+ }
899
+ function validateStatusDot(n, path, c) {
900
+ const props = (n.props ?? {});
901
+ if (typeof props.state !== "string") {
902
+ c.add(`${path}/props/state`, "PROPS_MISSING_REQUIRED", `status-dot requires "props.state" (a string)`);
903
+ }
904
+ else if (!VALID_STATUS_DOT_STATES.has(props.state)) {
905
+ c.add(`${path}/props/state`, "PROPS_INVALID_VALUE", `status-dot "props.state" must be one of: active, idle, blocked, error, success, warning, muted`);
906
+ }
907
+ if (props.size !== undefined && (typeof props.size !== "string" || !VALID_STATUS_DOT_SIZES.has(props.size))) {
908
+ c.add(`${path}/props/size`, "PROPS_INVALID_VALUE", `status-dot "props.size" must be "xs"|"sm"`);
909
+ }
910
+ if (props.pulse !== undefined && typeof props.pulse !== "boolean") {
911
+ c.add(`${path}/props/pulse`, "PROPS_INVALID_VALUE", `status-dot "props.pulse" must be a boolean`);
912
+ }
913
+ if (props.label !== undefined && typeof props.label !== "string") {
914
+ c.add(`${path}/props/label`, "PROPS_INVALID_VALUE", `status-dot "props.label" must be a string when provided`);
915
+ }
916
+ }
917
+ function validatePulse(n, path, c) {
918
+ // `props` is entirely optional for pulse.
919
+ if (n.props !== undefined) {
920
+ const props = n.props;
921
+ if (props.label !== undefined && typeof props.label !== "string") {
922
+ c.add(`${path}/props/label`, "PROPS_INVALID_VALUE", `pulse "props.label" must be a string when provided`);
923
+ }
924
+ }
925
+ }
926
+ function validateLink(n, path, c) {
927
+ const props = (n.props ?? {});
928
+ if (typeof props.href !== "string" || props.href.length === 0) {
929
+ c.add(`${path}/props/href`, "PROPS_MISSING_REQUIRED", `link requires "props.href" (a non-empty string)`);
930
+ }
931
+ if (typeof props.text !== "string" || props.text.length === 0) {
932
+ c.add(`${path}/props/text`, "PROPS_MISSING_REQUIRED", `link requires "props.text" (a non-empty string)`);
933
+ }
934
+ if (props.target !== undefined && (typeof props.target !== "string" || !VALID_LINK_TARGETS.has(props.target))) {
935
+ c.add(`${path}/props/target`, "PROPS_INVALID_VALUE", `link "props.target" must be "_self"|"_blank"`);
936
+ }
937
+ if (props.tone !== undefined && (typeof props.tone !== "string" || !VALID_LINK_TONES.has(props.tone))) {
938
+ c.add(`${path}/props/tone`, "PROPS_INVALID_VALUE", `link "props.tone" must be "accent"|"primary"|"muted"`);
939
+ }
940
+ }
941
+ function validateCode(n, path, c) {
942
+ const props = (n.props ?? {});
943
+ if (typeof props.text !== "string") {
944
+ c.add(`${path}/props/text`, "PROPS_MISSING_REQUIRED", `code requires "props.text" (a string)`);
945
+ }
946
+ if (props.inline !== undefined && typeof props.inline !== "boolean") {
947
+ c.add(`${path}/props/inline`, "PROPS_INVALID_VALUE", `code "props.inline" must be a boolean when provided`);
948
+ }
949
+ if (props.title !== undefined && typeof props.title !== "string") {
950
+ c.add(`${path}/props/title`, "PROPS_INVALID_VALUE", `code "props.title" must be a string when provided`);
951
+ }
952
+ }
953
+ // ---------------------------------------------------------------------------
954
+ // SRP v0.9 node validators — settings/config input atoms
955
+ // ---------------------------------------------------------------------------
956
+ function validateToggle(n, path, c) {
957
+ const props = (n.props ?? {});
958
+ if (typeof props.label !== "string" || props.label.length === 0) {
959
+ c.add(`${path}/props/label`, "PROPS_MISSING_REQUIRED", `toggle requires a non-empty "props.label"`);
960
+ }
961
+ if (props.description !== undefined && typeof props.description !== "string") {
962
+ c.add(`${path}/props/description`, "PROPS_INVALID_VALUE", `toggle "props.description" must be a string when provided`);
963
+ }
964
+ if (props.disabled !== undefined && typeof props.disabled !== "boolean") {
965
+ c.add(`${path}/props/disabled`, "PROPS_INVALID_VALUE", `toggle "props.disabled" must be a boolean when provided`);
966
+ }
967
+ const bind = n.bind;
968
+ if (!bind || typeof bind.value !== "boolean") {
969
+ c.add(`${path}/bind/value`, "BIND_MISSING_REQUIRED", `toggle requires "bind.value" (a boolean — the host owns the state)`);
970
+ }
971
+ }
972
+ function validateAccordion(n, path, c) {
973
+ const props = (n.props ?? {});
974
+ if (typeof props.title !== "string" || props.title.length === 0) {
975
+ c.add(`${path}/props/title`, "PROPS_MISSING_REQUIRED", `accordion requires a non-empty "props.title"`);
976
+ }
977
+ if (props.subtitle !== undefined && typeof props.subtitle !== "string") {
978
+ c.add(`${path}/props/subtitle`, "PROPS_INVALID_VALUE", `accordion "props.subtitle" must be a string when provided`);
979
+ }
980
+ if (props.defaultOpen !== undefined && typeof props.defaultOpen !== "boolean") {
981
+ c.add(`${path}/props/defaultOpen`, "PROPS_INVALID_VALUE", `accordion "props.defaultOpen" must be a boolean when provided`);
982
+ }
983
+ const bind = n.bind;
984
+ if (bind && bind.open !== undefined && typeof bind.open !== "boolean") {
985
+ c.add(`${path}/bind/open`, "BIND_INVALID_SHAPE", `accordion "bind.open" must be a boolean when provided`);
986
+ }
987
+ // Children are validated recursively (it is a structural container).
988
+ validateContainer(n, path, c);
989
+ }
833
990
  //# sourceMappingURL=validators.js.map