@niscorp/nova 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/dist/adapters/dom/components/index.cjs +4 -51
- package/dist/adapters/dom/components/index.cjs.map +1 -1
- package/dist/adapters/dom/index.cjs +22 -686
- package/dist/adapters/dom/index.cjs.map +1 -1
- package/dist/adapters/dom/index.js +3 -3
- package/dist/adapters/dom/server.cjs +14 -411
- package/dist/adapters/dom/server.cjs.map +1 -1
- package/dist/adapters/dom/server.js +3 -3
- package/dist/adapters/react/components/index.cjs +87 -562
- package/dist/adapters/react/components/index.cjs.map +1 -1
- package/dist/adapters/react/components/index.js +4 -4
- package/dist/adapters/react/index.cjs +97 -1815
- package/dist/adapters/react/index.cjs.map +1 -1
- package/dist/adapters/react/index.js +4 -4
- package/dist/adapters/tty/components/index.cjs +3 -44
- package/dist/adapters/tty/components/index.cjs.map +1 -1
- package/dist/adapters/tty/index.cjs +13 -5
- package/dist/adapters/tty/index.cjs.map +1 -1
- package/dist/adapters/tty/index.js +2 -2
- package/dist/adapters/vue/components/index.cjs +88 -639
- package/dist/adapters/vue/components/index.cjs.map +1 -1
- package/dist/adapters/vue/components/index.js +4 -4
- package/dist/adapters/vue/index.cjs +96 -962
- package/dist/adapters/vue/index.cjs.map +1 -1
- package/dist/adapters/vue/index.js +5 -5
- package/dist/agent/index.cjs +13 -151
- package/dist/agent/index.cjs.map +1 -1
- package/dist/chunk-5YQIAS4V.cjs +184 -0
- package/dist/chunk-5YQIAS4V.cjs.map +1 -0
- package/dist/{chunk-F2H7WP6R.js → chunk-7MATRNZZ.js} +5 -5
- package/dist/{chunk-F2H7WP6R.js.map → chunk-7MATRNZZ.js.map} +1 -1
- package/dist/chunk-AGEAMUQR.cjs +436 -0
- package/dist/chunk-AGEAMUQR.cjs.map +1 -0
- package/dist/chunk-D4PUWBN6.cjs +72 -0
- package/dist/chunk-D4PUWBN6.cjs.map +1 -0
- package/dist/chunk-ECFWPZGL.cjs +2117 -0
- package/dist/chunk-ECFWPZGL.cjs.map +1 -0
- package/dist/{chunk-VOD5JA4D.js → chunk-EG45GQOE.js} +3 -3
- package/dist/{chunk-VOD5JA4D.js.map → chunk-EG45GQOE.js.map} +1 -1
- package/dist/chunk-FSUMCJAR.cjs +646 -0
- package/dist/chunk-FSUMCJAR.cjs.map +1 -0
- package/dist/chunk-GV7UC3SS.cjs +33 -0
- package/dist/chunk-GV7UC3SS.cjs.map +1 -0
- package/dist/chunk-HYFNOF7Y.cjs +97 -0
- package/dist/chunk-HYFNOF7Y.cjs.map +1 -0
- package/dist/chunk-KOYRJXTI.cjs +123 -0
- package/dist/chunk-KOYRJXTI.cjs.map +1 -0
- package/dist/chunk-KW34ZKF5.cjs +12 -0
- package/dist/chunk-KW34ZKF5.cjs.map +1 -0
- package/dist/chunk-M3UFIUXK.cjs +318 -0
- package/dist/chunk-M3UFIUXK.cjs.map +1 -0
- package/dist/chunk-OE527MXF.cjs +49 -0
- package/dist/chunk-OE527MXF.cjs.map +1 -0
- package/dist/{chunk-DU2VIJAF.js → chunk-P5SJ3QXJ.js} +3 -3
- package/dist/{chunk-DU2VIJAF.js.map → chunk-P5SJ3QXJ.js.map} +1 -1
- package/dist/chunk-PBPUSZIQ.cjs +808 -0
- package/dist/chunk-PBPUSZIQ.cjs.map +1 -0
- package/dist/chunk-PMKWYOOX.cjs +64 -0
- package/dist/chunk-PMKWYOOX.cjs.map +1 -0
- package/dist/chunk-PNQY6OFB.cjs +132 -0
- package/dist/chunk-PNQY6OFB.cjs.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/{chunk-SVNK5NIK.js → chunk-QLFHYHJ2.js} +4 -4
- package/dist/{chunk-SVNK5NIK.js.map → chunk-QLFHYHJ2.js.map} +1 -1
- package/dist/{chunk-G4LSLLGI.js → chunk-RB4OMSPA.js} +5 -5
- package/dist/{chunk-G4LSLLGI.js.map → chunk-RB4OMSPA.js.map} +1 -1
- package/dist/chunk-UGG7MCX4.cjs +34 -0
- package/dist/chunk-UGG7MCX4.cjs.map +1 -0
- package/dist/chunk-WGZZKCJQ.cjs +157 -0
- package/dist/chunk-WGZZKCJQ.cjs.map +1 -0
- package/dist/{chunk-3JRTELLC.js → chunk-X5JTZ5LW.js} +3 -3
- package/dist/{chunk-3JRTELLC.js.map → chunk-X5JTZ5LW.js.map} +1 -1
- package/dist/{chunk-Y6XVPRYH.js → chunk-XUSKGJRI.js} +2 -2
- package/dist/chunk-XUSKGJRI.js.map +1 -0
- package/dist/chunk-Z7CS43ZT.cjs +808 -0
- package/dist/chunk-Z7CS43ZT.cjs.map +1 -0
- package/dist/chunk-ZYTWQZZC.cjs +623 -0
- package/dist/chunk-ZYTWQZZC.cjs.map +1 -0
- package/dist/devtools/index.cjs +13 -697
- package/dist/devtools/index.cjs.map +1 -1
- package/dist/devtools/index.js +2 -2
- package/dist/document/index.cjs +56 -301
- package/dist/document/index.cjs.map +1 -1
- package/dist/examples/index.cjs +6 -31
- package/dist/examples/index.cjs.map +1 -1
- package/dist/i18n/index.cjs +44 -292
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/index.cjs +335 -3954
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/migrations/index.cjs +7 -590
- package/dist/migrations/index.cjs.map +1 -1
- package/dist/reflect/index.cjs +85 -994
- package/dist/reflect/index.cjs.map +1 -1
- package/dist/reflect/index.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-Y6XVPRYH.js.map +0 -1
package/dist/agent/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shared/bindings/schemas.ts","../../src/layout/schemas.ts","../../src/agent/layout.agent.ts","../../src/agent/palette.ts","../../src/agent/affordances.ts"],"names":["z","defineAgent"],"mappings":";;;;;;AAEiCA,MAC9B,MAAA,CAAO;AAA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,KAAK,EAAE,GAAA,EAAK,OAAO,SAAA,EAAW,GAAA,EAAK,KAAK,CAAA;AAAA,UAC/C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAIA,IAAA,KAAA,MAAW,SAAS,MAAA,CAAO,MAAA,CAAO,MAAM,CAAA,EAAG,IAAA,CAAK,OAAO,UAAU,CAAA;AAAA,EACnE,CAAA;AAEA,EAAA,IAAA,CAAK,MAAA,kBAAQ,IAAI,GAAA,EAAK,CAAA;AACtB,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA,EAAW,CAAC,GAAG,SAAS,EAAE,IAAA,EAAK;AAAA,IAC/B,eAAA,EAAiB,CAAC,GAAG,QAAQ,EAAE,IAAA,EAAK;AAAA,IACpC;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["import { z } from 'zod';\n\nexport const IfDirectiveSchema = z\n .object({\n $if: z.unknown().describe('Condition — resolved recursively, then checked for truthiness.'),\n $then: z.unknown().describe('Value when condition is truthy — resolved recursively.'),\n $else: z\n .unknown()\n .optional()\n .describe('Value when condition is falsy — resolved recursively.'),\n })\n .strict()\n .describe('Conditional value directive. Resolved at bind time.');\n\nexport type IfDirective = z.infer<typeof IfDirectiveSchema>;\n\nexport const ResolvableSchema = z\n .unknown()\n .describe(\n 'Any value. Strings support {{}} templates and bare $-paths. The data ROOT is '\n + '\"$.\" — a data key is ALWAYS \"$.key\" (\"{{$.rows.length}} found\", \"$.loading\"); '\n + '\"$key\" without the dot is INVALID. Loop variables (a `for` directive\\'s `as`) '\n + 'are \"$<name>.field\" (\"{{$row.title}}\"). Objects may be directives like '\n + '{$if,$then,$else}. Arrays and nested objects are walked recursively. '\n + 'Everything else is literal.',\n );\n","import { z } from 'zod';\nimport { ResolvableSchema } from '../shared/bindings/schemas';\n\n// ═══════════════════════════════════════════════════════════\n// Layout node schemas\n// ═══════════════════════════════════════════════════════════\n\nexport const LayoutPrimitiveSchema = z\n .union([z.string(), z.number(), z.boolean(), z.null()])\n .describe('A primitive layout value rendered as text.');\n\nexport type LayoutPrimitive = z.infer<typeof LayoutPrimitiveSchema>;\n\nexport type ComponentNode = {\n component: string;\n props?: Record<string, unknown>;\n children?: LayoutNode | LayoutNode[];\n ref?: string;\n model?: string;\n events?: Record<string, unknown>;\n};\n\nexport const ComponentNodeSchema: z.ZodType<ComponentNode> = z.lazy(() =>\n z\n .object({\n component: z.string().describe('The registry name of the component to render.'),\n props: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Component props; values may be bindings to be resolved at render time.'),\n children: z\n .union([LayoutNodeSchema, z.array(LayoutNodeSchema)])\n .optional()\n .describe('Child layout content (a single node or an array of nodes).'),\n ref: z.string().optional().describe('A stable identifier used to target this component from event handlers.'),\n model: z.string().optional().describe('A two-way binding path, e.g. \"$.name\".'),\n events: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Map of event name to event configuration handled by the action runtime.'),\n })\n .strict()\n .describe('A node that instantiates a component from the registry.'),\n);\n\nexport type ConditionalNode = {\n if: unknown;\n then: LayoutNode;\n else?: LayoutNode;\n};\n\nexport const ConditionalNodeSchema: z.ZodType<ConditionalNode> = z.lazy(() =>\n z\n .object({\n if: ResolvableSchema.describe('Resolvable value evaluated for truthiness.'),\n then: LayoutNodeSchema.describe('Layout to render when condition is truthy.'),\n else: LayoutNodeSchema.optional().describe('Layout to render when condition is falsy.'),\n })\n .strict()\n .describe('A node that conditionally renders one of two branches.'),\n);\n\nexport type LoopNode = {\n for: unknown;\n as: string;\n key?: string;\n do: LayoutNode;\n};\n\nexport const LoopNodeSchema: z.ZodType<LoopNode> = z.lazy(() =>\n z\n .object({\n for: ResolvableSchema.describe('Resolvable value that resolves to an iterable array.'),\n as: z.string().describe('Name to bind each iterated item under in the inner scope.'),\n key: z.string().optional().describe('Optional key path on each item used for stable identity.'),\n do: LayoutNodeSchema.describe('Layout rendered once per iterated item.'),\n })\n .strict()\n .describe('A node that iterates an array binding and renders a layout for each item.'),\n);\n\nexport const LayoutRefNodeSchema = z\n .object({\n ref: z.string().describe('Identifier of a layout stored in the layout store to inline at this position.'),\n })\n .strict()\n .describe('A reference to a stored layout, inlined during render.');\n\nexport type LayoutRefNode = z.infer<typeof LayoutRefNodeSchema>;\n\nexport const SlotNodeSchema = z\n .object({\n slot: z\n .string()\n .describe(\n 'Name of a slot placeholder. When an ActionFragment is composed with an action ' +\n '(a push/replace `with`), the fragment\\'s `{ slot: \"body\" }` node is replaced by ' +\n 'the composing action\\'s own layout. An unfilled slot renders nothing.',\n ),\n })\n .strict()\n .describe(\n 'A placeholder that a fragment-merge fills with a composing action\\'s layout. ' +\n 'Only meaningful inside an ActionFragment\\'s layout.',\n );\n\nexport type SlotNode = z.infer<typeof SlotNodeSchema>;\n\nexport type LayoutNode =\n | ComponentNode\n | ConditionalNode\n | LoopNode\n | LayoutRefNode\n | SlotNode\n | LayoutNode[]\n | LayoutPrimitive;\n\nexport const LayoutNodeSchema: z.ZodType<LayoutNode> = z.lazy(() =>\n z\n .union([\n ComponentNodeSchema,\n ConditionalNodeSchema,\n LoopNodeSchema,\n LayoutRefNodeSchema,\n SlotNodeSchema,\n z.array(LayoutNodeSchema),\n LayoutPrimitiveSchema,\n ])\n .describe('Any layout node: component, conditional, loop, layout ref, slot, array of nodes, or a primitive text value.'),\n);\n","// ═══════════════════════════════════════════════════════════\n// @niscorp/nova/agent — Nova layout agent\n// ═══════════════════════════════════════════════════════════\n//\n// Given an intent, a component palette, and a data example, produces a Nova\n// LayoutNode — a tree of components, conditionals, loops and bindings that\n// renders the data as a UI.\n//\n// Same pattern as @niscorp/prism/agent and @niscorp/vex/agent: one exported\n// `const`, the canonical schema as the payload (cortex validates the whole\n// recursive tree and feeds failures back in-loop), and the variable inputs\n// (intent, palette, dataShape) passed at call time. Cortex is an optional\n// peer dep — the rest of @niscorp/nova does not need it.\n//\n// import { layoutAgent, paletteFromRegistry } from '@niscorp/nova/agent';\n//\n// const result = await layoutAgent.run({\n// intent: 'a table of company and value',\n// palette: paletteFromRegistry(registry, { include: ['Table'] }),\n// dataShape: [{ company: '', value: 0 }],\n// }, { llm }).result;\n// if (result.ok) render(result.output.data, rows);\n//\n// The LayoutNode schema is NOT embedded in this prompt — cortex injects\n// it (output.doc 'auto') because the recursive tree can't ride the\n// respond tool's params. Node types, binding syntax and directives all\n// live in the schema's .describe() calls; fixes go there, not here.\n\nimport { defineAgent, type AgentDefinition } from '@niscorp/cortex';\n\nimport { LayoutNodeSchema } from '../layout/schemas';\nimport type { LayoutNode } from '../layout/schemas';\n\n// The agent's payload IS the LayoutNode; the model's one-line why\n// rides the envelope's `reasoning` field.\nexport type LayoutAgentOutput = LayoutNode;\n\nconst INSTRUCTIONS = `You are the Nova layout agent. Given an intent, a component palette, and a data example, produce a Nova LayoutNode that renders the data as a UI.\n\nYour input:\n - intent: what UI to produce.\n - palette: the ONLY components you may use. Each is { name, description, propsSchema }. Every \"component\" field in your output MUST be one of these names, and its props MUST fit that component's propsSchema. Set ONLY props that appear in the schema — there is no other styling; components render in their own default style.\n - dataShape: a JSON example of the data the layout binds against. The data is the binding ROOT — reference it with \"$\": an array → a Table's \"rows\": \"$\" or a loop { \"for\": \"$\", \"as\": \"row\", \"do\": … } binding \"{{$row.field}}\"; an object → \"$.field\"; a scalar → \"$\".\n - styleGuide (optional): house style rules — follow them.\n - base (optional): an existing layout to work from. If given, keep its structure and component choices, adapting the bindings to this intent + data — use it to match a prior layout or to revise it.\n\nYour envelope's \\`data\\` is the LayoutNode; \\`reasoning\\` is a one-sentence explanation. The layout MUST validate against the OUTPUT SCHEMA below.\n\nWorked example (illustrative — read the schema + palette for the real details):\nINPUT { \"intent\": \"list each name on its own line\", \"palette\": [{\"name\":\"Stack\",\"description\":\"Vertical container for children.\"},{\"name\":\"Text\",\"description\":\"Renders text; children is the string.\"}], \"dataShape\": [{ \"name\": \"\" }] }\ndata { \"component\": \"Stack\", \"children\": { \"for\": \"$\", \"as\": \"row\", \"do\": { \"component\": \"Text\", \"children\": \"{{$row.name}}\" } } }`;\n\nexport const layoutAgent: AgentDefinition<LayoutNode> = defineAgent<LayoutNode>({\n id: 'nova.layout',\n description: 'Generates a Nova LayoutNode from an intent, a component palette, and a data example.',\n instructions: INSTRUCTIONS,\n output: { schema: LayoutNodeSchema },\n});\n","import type { ComponentRegistry, ComponentMeta } from '../layout/types';\n\n// ───────────────────────────────────────────────────────────\n// Derive a layout-agent palette from a ComponentRegistry.\n//\n// Reads each component's `meta.description` + `meta.propsSchema` straight off the\n// registry and hands the agent a JSON Schema derived from the same Zod schema the\n// renderer validates against — no drift. Component authors put what the agent\n// needs on the source schema via `.describe()`; fixes go there, not here.\n// ───────────────────────────────────────────────────────────\n\nexport type LayoutPaletteEntry = { name: string; description: string; propsSchema?: object };\n\nexport type PaletteFromRegistryOptions = {\n // Optional allowlist of component names. When omitted, every registered\n // component appears — pass a curated subset to keep the agent's vocabulary\n // tight (e.g. exclude shell slots / nav chrome).\n include?: readonly string[];\n // Prop names to strip from every component's schema. Use it to hide props the\n // agent must not set — e.g. presentational knobs (`bg`, `class`, `pad`) — so the\n // components can only render in their default style.\n omitProps?: readonly string[];\n};\n\n// Drop `omit` keys from a JSON Schema's `properties` (and `required`), so the\n// agent never sees them.\nconst stripProps = (schema: object, omit: readonly string[]): object => {\n const s = schema as { properties?: Record<string, unknown>; required?: string[] };\n if (s.properties === undefined) return schema;\n const properties = { ...s.properties };\n for (const p of omit) delete properties[p];\n const required = s.required?.filter((r) => !omit.includes(r));\n return { ...s, properties, ...(required !== undefined ? { required } : {}) };\n};\n\n// ONE PALETTE ENTRY, from a component's meta — the conversion at the heart of a\n// palette, factored out so a second caller derives an author's props from the\n// SAME Zod schema and the SAME JSON-Schema target, never a fork that drifts.\n// moss's integration contract calls this to answer \"what may I build against\"\n// for a person, which is the same question the layout agent asks of the palette;\n// `omitProps` and binding-awareness stay the caller's concern. A component with\n// no schema yields name + description alone, exactly as a bare registration does.\nexport const paletteEntryOf = (name: string, meta: ComponentMeta, omitProps?: readonly string[]): LayoutPaletteEntry => {\n let propsSchema: object | undefined;\n if (meta.propsSchema !== undefined) {\n // The app's schema converts itself (Standard JSON Schema): it may come from\n // the app's zod copy, and ours would read that copy's metadata through our registry.\n const js = meta.propsSchema['~standard'].jsonSchema.output({ target: 'draft-07' });\n propsSchema = omitProps !== undefined && omitProps.length > 0 ? stripProps(js, omitProps) : js;\n }\n return { name, description: meta.description ?? '', ...(propsSchema === undefined ? {} : { propsSchema }) };\n};\n\nexport const paletteFromRegistry = (\n registry: ComponentRegistry,\n options: PaletteFromRegistryOptions = {},\n): LayoutPaletteEntry[] => {\n const names = options.include ?? registry.list();\n const out: LayoutPaletteEntry[] = [];\n for (const name of names) {\n const entry = registry.get(name);\n if (entry === undefined) continue;\n out.push(paletteEntryOf(name, entry.meta, options.omitProps));\n }\n return out;\n};\n","// ═══════════════════════════════════════════════════════════\n// Affordance collection — the deterministic half of the action/layout seam.\n//\n// A layout's interactive surface is fully present in its tree: `ref` (event\n// sources), `*Ref` props (component-specific event sources, e.g. a Table's\n// sortRef), `model` (two-way input bindings), and every `$.key` binding it\n// reads. A director agent that wires triggers against a layout it never sees\n// needs that surface as data — so it is DERIVED here by walking the tree,\n// never self-reported by the layout model. A receipt computed from the\n// artifact cannot lie about the artifact.\n// ═══════════════════════════════════════════════════════════\n\nexport type InteractiveRef = {\n ref: string;\n component: string;\n // How the ref is attached: the node's own `ref` field, or a `*Ref` prop name.\n via: string;\n};\n\nexport type InteractiveModel = {\n // The bound data path, e.g. '$.search'.\n path: string;\n component: string;\n};\n\nexport type InteractiveSurface = {\n refs: InteractiveRef[];\n models: InteractiveModel[];\n // Distinct top-level data keys the layout reads anywhere ('$.rows' → 'rows').\n boundKeys: string[];\n // Malformed-looking bindings: `$ident.…` where `ident` is neither the data\n // root (`$.`) nor a loop variable declared by an enclosing `for`/`as` —\n // e.g. `{{$kpi.count}}` (missing dot) renders literally and passes every\n // other check. Collected scope-aware so `{{$row.title}}` inside its loop\n // stays legal.\n suspectBindings: string[];\n componentCount: number;\n};\n\nconst KEY_PATTERN = /\\$\\.([A-Za-z_][A-Za-z0-9_]*)/g;\nconst VAR_PATTERN = /\\$([A-Za-z_][A-Za-z0-9_]*)\\./g;\n\nexport const collectInteractive = (layout: unknown): InteractiveSurface => {\n const refs: InteractiveRef[] = [];\n const models: InteractiveModel[] = [];\n const boundKeys = new Set<string>();\n const suspects = new Set<string>();\n let componentCount = 0;\n\n const scanString = (value: string, scope: ReadonlySet<string>): void => {\n for (const match of value.matchAll(KEY_PATTERN)) {\n const key = match[1];\n if (key !== undefined) boundKeys.add(key);\n }\n for (const match of value.matchAll(VAR_PATTERN)) {\n const name = match[1];\n if (name !== undefined && !scope.has(name)) suspects.add(`$${name}.`);\n }\n };\n\n const walk = (node: unknown, scope: ReadonlySet<string>): void => {\n if (typeof node === 'string') return scanString(node, scope);\n if (Array.isArray(node)) {\n for (const child of node) walk(child, scope);\n return;\n }\n if (node === null || typeof node !== 'object') return;\n const record = node as Record<string, unknown>;\n\n // A `for` directive declares its loop variable for everything beneath.\n const loopVar = record['for'] !== undefined && typeof record['as'] === 'string' ? record['as'] : undefined;\n const childScope = loopVar !== undefined ? new Set([...scope, loopVar]) : scope;\n\n const component = typeof record['component'] === 'string' ? record['component'] : undefined;\n if (component !== undefined) {\n componentCount += 1;\n if (typeof record['ref'] === 'string' && record['ref'].length > 0) {\n refs.push({ ref: record['ref'], component, via: 'ref' });\n }\n if (typeof record['model'] === 'string' && record['model'].length > 0) {\n models.push({ path: record['model'], component });\n }\n const props = record['props'];\n if (props !== null && typeof props === 'object' && !Array.isArray(props)) {\n for (const [key, value] of Object.entries(props as Record<string, unknown>)) {\n if (key.endsWith('Ref') && typeof value === 'string' && value.length > 0) {\n refs.push({ ref: value, component, via: key });\n }\n }\n }\n }\n // Generic descent: directives (`if`/`for`), props, children, column cell\n // specs — every nested node and binding is reached without schema-specific\n // cases. Strings are scanned for `$.key` bindings on the way.\n for (const value of Object.values(record)) walk(value, childScope);\n };\n\n walk(layout, new Set());\n return {\n refs,\n models,\n boundKeys: [...boundKeys].sort(),\n suspectBindings: [...suspects].sort(),\n componentCount,\n };\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/agent/layout.agent.ts"],"names":["defineAgent","LayoutNodeSchema"],"mappings":";;;;;;;;AAqCA,IAAM,YAAA,GAAe,CAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA,oIAAA,CAAA;AAed,IAAM,cAA2CA,kBAAA,CAAwB;AAAA,EAC9E,EAAA,EAAI,aAAA;AAAA,EACJ,WAAA,EAAa,sFAAA;AAAA,EACb,YAAA,EAAc,YAAA;AAAA,EACd,MAAA,EAAQ,EAAE,MAAA,EAAQC,kCAAA;AACpB,CAAC","file":"index.cjs","sourcesContent":["// ═══════════════════════════════════════════════════════════\n// @niscorp/nova/agent — Nova layout agent\n// ═══════════════════════════════════════════════════════════\n//\n// Given an intent, a component palette, and a data example, produces a Nova\n// LayoutNode — a tree of components, conditionals, loops and bindings that\n// renders the data as a UI.\n//\n// Same pattern as @niscorp/prism/agent and @niscorp/vex/agent: one exported\n// `const`, the canonical schema as the payload (cortex validates the whole\n// recursive tree and feeds failures back in-loop), and the variable inputs\n// (intent, palette, dataShape) passed at call time. Cortex is an optional\n// peer dep — the rest of @niscorp/nova does not need it.\n//\n// import { layoutAgent, paletteFromRegistry } from '@niscorp/nova/agent';\n//\n// const result = await layoutAgent.run({\n// intent: 'a table of company and value',\n// palette: paletteFromRegistry(registry, { include: ['Table'] }),\n// dataShape: [{ company: '', value: 0 }],\n// }, { llm }).result;\n// if (result.ok) render(result.output.data, rows);\n//\n// The LayoutNode schema is NOT embedded in this prompt — cortex injects\n// it (output.doc 'auto') because the recursive tree can't ride the\n// respond tool's params. Node types, binding syntax and directives all\n// live in the schema's .describe() calls; fixes go there, not here.\n\nimport { defineAgent, type AgentDefinition } from '@niscorp/cortex';\n\nimport { LayoutNodeSchema } from '../layout/schemas';\nimport type { LayoutNode } from '../layout/schemas';\n\n// The agent's payload IS the LayoutNode; the model's one-line why\n// rides the envelope's `reasoning` field.\nexport type LayoutAgentOutput = LayoutNode;\n\nconst INSTRUCTIONS = `You are the Nova layout agent. Given an intent, a component palette, and a data example, produce a Nova LayoutNode that renders the data as a UI.\n\nYour input:\n - intent: what UI to produce.\n - palette: the ONLY components you may use. Each is { name, description, propsSchema }. Every \"component\" field in your output MUST be one of these names, and its props MUST fit that component's propsSchema. Set ONLY props that appear in the schema — there is no other styling; components render in their own default style.\n - dataShape: a JSON example of the data the layout binds against. The data is the binding ROOT — reference it with \"$\": an array → a Table's \"rows\": \"$\" or a loop { \"for\": \"$\", \"as\": \"row\", \"do\": … } binding \"{{$row.field}}\"; an object → \"$.field\"; a scalar → \"$\".\n - styleGuide (optional): house style rules — follow them.\n - base (optional): an existing layout to work from. If given, keep its structure and component choices, adapting the bindings to this intent + data — use it to match a prior layout or to revise it.\n\nYour envelope's \\`data\\` is the LayoutNode; \\`reasoning\\` is a one-sentence explanation. The layout MUST validate against the OUTPUT SCHEMA below.\n\nWorked example (illustrative — read the schema + palette for the real details):\nINPUT { \"intent\": \"list each name on its own line\", \"palette\": [{\"name\":\"Stack\",\"description\":\"Vertical container for children.\"},{\"name\":\"Text\",\"description\":\"Renders text; children is the string.\"}], \"dataShape\": [{ \"name\": \"\" }] }\ndata { \"component\": \"Stack\", \"children\": { \"for\": \"$\", \"as\": \"row\", \"do\": { \"component\": \"Text\", \"children\": \"{{$row.name}}\" } } }`;\n\nexport const layoutAgent: AgentDefinition<LayoutNode> = defineAgent<LayoutNode>({\n id: 'nova.layout',\n description: 'Generates a Nova LayoutNode from an intent, a component palette, and a data example.',\n instructions: INSTRUCTIONS,\n output: { schema: LayoutNodeSchema },\n});\n"]}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkKOYRJXTI_cjs = require('./chunk-KOYRJXTI.cjs');
|
|
4
|
+
var chunkKW34ZKF5_cjs = require('./chunk-KW34ZKF5.cjs');
|
|
5
|
+
|
|
6
|
+
// src/i18n/translate.ts
|
|
7
|
+
var walkNode = (node, where, pass) => {
|
|
8
|
+
if (node.type === "text") {
|
|
9
|
+
if (!pass.text) return node;
|
|
10
|
+
const value = chunkKOYRJXTI_cjs.swap(node.value, where, pass);
|
|
11
|
+
return value === node.value ? node : { ...node, value };
|
|
12
|
+
}
|
|
13
|
+
if (node.type === "fragment") {
|
|
14
|
+
const children2 = walkNodes(node.children, where, pass);
|
|
15
|
+
return children2 === node.children ? node : { ...node, children: children2 };
|
|
16
|
+
}
|
|
17
|
+
if (node.type === "error") return node;
|
|
18
|
+
const at = node.ref === void 0 ? `${where}/${node.name}` : `${where}/${node.name}#${node.ref}`;
|
|
19
|
+
let props = node.props;
|
|
20
|
+
let propsChanged = false;
|
|
21
|
+
const nextProps = {};
|
|
22
|
+
for (const [key, value] of Object.entries(node.props)) {
|
|
23
|
+
const next = chunkKOYRJXTI_cjs.walkValue(value, pass.isProse(key), `${at}.${key}`, pass);
|
|
24
|
+
if (next !== value) propsChanged = true;
|
|
25
|
+
nextProps[key] = next;
|
|
26
|
+
}
|
|
27
|
+
if (propsChanged) props = nextProps;
|
|
28
|
+
const children = walkNodes(node.children, at, pass);
|
|
29
|
+
if (!propsChanged && children === node.children) return node;
|
|
30
|
+
return { ...node, props, children };
|
|
31
|
+
};
|
|
32
|
+
var walkNodes = (nodes, where, pass) => {
|
|
33
|
+
let changed = false;
|
|
34
|
+
const out = nodes.map((node) => {
|
|
35
|
+
const next = walkNode(node, where, pass);
|
|
36
|
+
if (next !== node) changed = true;
|
|
37
|
+
return next;
|
|
38
|
+
});
|
|
39
|
+
return changed ? out : nodes;
|
|
40
|
+
};
|
|
41
|
+
var translateRenderTree = (tree, options) => {
|
|
42
|
+
if (Object.keys(options.phrases).length === 0) return tree;
|
|
43
|
+
const pass = chunkKOYRJXTI_cjs.passFor({
|
|
44
|
+
phrases: options.phrases,
|
|
45
|
+
...options.keys === void 0 ? {} : { keys: options.keys },
|
|
46
|
+
...options.onMiss === void 0 ? {} : { onMiss: options.onMiss }
|
|
47
|
+
});
|
|
48
|
+
if (pass === void 0) return tree;
|
|
49
|
+
return walkNodes(tree, "", pass);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/i18n/harvest.ts
|
|
53
|
+
var sinkInto = (found, keys) => {
|
|
54
|
+
const matcher = chunkKOYRJXTI_cjs.matcherFor(keys);
|
|
55
|
+
return {
|
|
56
|
+
add: (phrase, where) => {
|
|
57
|
+
const trimmed = phrase.trim();
|
|
58
|
+
if (!chunkKOYRJXTI_cjs.isPhrase(trimmed)) return;
|
|
59
|
+
const sites = found.get(trimmed);
|
|
60
|
+
if (sites === void 0) found.set(trimmed, /* @__PURE__ */ new Set([where]));
|
|
61
|
+
else sites.add(where);
|
|
62
|
+
},
|
|
63
|
+
isProse: matcher.isProse,
|
|
64
|
+
text: matcher.text
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
var harvestWithin = (value, where, sink) => {
|
|
68
|
+
if (typeof value === "string") {
|
|
69
|
+
sink.add(value, where);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (chunkKW34ZKF5_cjs.isArray(value)) {
|
|
73
|
+
value.forEach((entry, index) => harvestWithin(entry, `${where}[${String(index)}]`, sink));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (chunkKW34ZKF5_cjs.isObject(value)) {
|
|
77
|
+
for (const [key, entry] of Object.entries(value)) harvestWithin(entry, `${where}.${key}`, sink);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var harvestProps = (props, where, sink) => {
|
|
81
|
+
for (const [key, value] of Object.entries(props)) {
|
|
82
|
+
if (sink.isProse(key)) {
|
|
83
|
+
harvestWithin(value, `${where}.${key}`, sink);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (chunkKW34ZKF5_cjs.isObject(value) || chunkKW34ZKF5_cjs.isArray(value)) harvestNested(value, `${where}.${key}`, sink);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var harvestNested = (value, where, sink) => {
|
|
90
|
+
if (chunkKW34ZKF5_cjs.isArray(value)) {
|
|
91
|
+
value.forEach((entry, index) => harvestNested(entry, `${where}[${String(index)}]`, sink));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!chunkKW34ZKF5_cjs.isObject(value)) return;
|
|
95
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
96
|
+
if (sink.isProse(key)) harvestWithin(entry, `${where}.${key}`, sink);
|
|
97
|
+
else harvestNested(entry, `${where}.${key}`, sink);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var harvestNode = (node, where, sink) => {
|
|
101
|
+
if (node === null || node === void 0) return;
|
|
102
|
+
if (typeof node === "string") {
|
|
103
|
+
if (sink.text) sink.add(node, where);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (typeof node === "number" || typeof node === "boolean") return;
|
|
107
|
+
if (chunkKW34ZKF5_cjs.isArray(node)) {
|
|
108
|
+
node.forEach((child, index) => harvestNode(child, `${where}[${String(index)}]`, sink));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (!chunkKW34ZKF5_cjs.isObject(node)) return;
|
|
112
|
+
const component = node["component"];
|
|
113
|
+
if (component === void 0) {
|
|
114
|
+
if ("ref" in node || "slot" in node) return;
|
|
115
|
+
if ("if" in node) {
|
|
116
|
+
harvestNode(node["then"], `${where}.then`, sink);
|
|
117
|
+
harvestNode(node["else"], `${where}.else`, sink);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if ("for" in node && "do" in node) {
|
|
121
|
+
harvestNode(node["do"], `${where}.do`, sink);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const at = `${where}/${String(component)}`;
|
|
127
|
+
const props = node["props"];
|
|
128
|
+
if (chunkKW34ZKF5_cjs.isObject(props)) harvestProps(props, at, sink);
|
|
129
|
+
harvestNode(node["children"], `${at}.children`, sink);
|
|
130
|
+
};
|
|
131
|
+
var toList = (found) => [...found.entries()].map(([phrase, sites]) => ({ phrase, where: [...sites].sort() })).sort((a, b) => a.phrase.localeCompare(b.phrase));
|
|
132
|
+
var harvestLayout = (layout, keys) => {
|
|
133
|
+
const found = /* @__PURE__ */ new Map();
|
|
134
|
+
harvestNode(layout, "", sinkInto(found, keys));
|
|
135
|
+
return toList(found);
|
|
136
|
+
};
|
|
137
|
+
var harvestSteps = (value, where, sink) => {
|
|
138
|
+
if (chunkKW34ZKF5_cjs.isArray(value)) {
|
|
139
|
+
value.forEach((entry, index) => harvestSteps(entry, `${where}[${String(index)}]`, sink));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (!chunkKW34ZKF5_cjs.isObject(value)) return;
|
|
143
|
+
const target = value["set"];
|
|
144
|
+
const written = value["value"];
|
|
145
|
+
if (typeof target === "string" && typeof written === "string") sink.add(written, `${where}.set:${target}`);
|
|
146
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
147
|
+
if (key === "set" || key === "value") continue;
|
|
148
|
+
harvestSteps(entry, `${where}.${key}`, sink);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var harvestDefinition = (definition, keys) => {
|
|
152
|
+
const found = /* @__PURE__ */ new Map();
|
|
153
|
+
const sink = sinkInto(found, keys);
|
|
154
|
+
const id = definition.id;
|
|
155
|
+
if (typeof definition.title === "string") sink.add(definition.title, `${id}.title`);
|
|
156
|
+
for (const [key, value] of Object.entries(definition.data ?? {})) {
|
|
157
|
+
if (typeof value === "string") sink.add(value, `${id}.data.${key}`);
|
|
158
|
+
else if (chunkKW34ZKF5_cjs.isObject(value) || chunkKW34ZKF5_cjs.isArray(value)) harvestNested(value, `${id}.data.${key}`, sink);
|
|
159
|
+
}
|
|
160
|
+
if (definition.layout !== void 0) harvestNode(definition.layout, id, sink);
|
|
161
|
+
if (definition.triggers !== void 0) harvestSteps(definition.triggers, `${id}.triggers`, sink);
|
|
162
|
+
if (definition.lifecycle !== void 0) harvestSteps(definition.lifecycle, `${id}.lifecycle`, sink);
|
|
163
|
+
return toList(found);
|
|
164
|
+
};
|
|
165
|
+
var harvestDefinitions = (definitions, keys) => {
|
|
166
|
+
const found = /* @__PURE__ */ new Map();
|
|
167
|
+
for (const definition of Object.values(definitions)) {
|
|
168
|
+
for (const entry of harvestDefinition(definition, keys)) {
|
|
169
|
+
const sites = found.get(entry.phrase);
|
|
170
|
+
if (sites === void 0) found.set(entry.phrase, new Set(entry.where));
|
|
171
|
+
else for (const site of entry.where) sites.add(site);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return toList(found);
|
|
175
|
+
};
|
|
176
|
+
var missingFrom = (harvested, phrases) => harvested.filter((entry) => phrases[entry.phrase] === void 0);
|
|
177
|
+
|
|
178
|
+
exports.harvestDefinition = harvestDefinition;
|
|
179
|
+
exports.harvestDefinitions = harvestDefinitions;
|
|
180
|
+
exports.harvestLayout = harvestLayout;
|
|
181
|
+
exports.missingFrom = missingFrom;
|
|
182
|
+
exports.translateRenderTree = translateRenderTree;
|
|
183
|
+
//# sourceMappingURL=chunk-5YQIAS4V.cjs.map
|
|
184
|
+
//# sourceMappingURL=chunk-5YQIAS4V.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/i18n/translate.ts","../src/i18n/harvest.ts"],"names":["swap","children","walkValue","passFor","matcherFor","isPhrase","isArray","isObject"],"mappings":";;;;;;AAoCA,IAAM,QAAA,GAAW,CAAC,IAAA,EAAkB,KAAA,EAAe,IAAA,KAA2B;AAC5E,EAAA,IAAI,IAAA,CAAK,SAAS,MAAA,EAAQ;AACxB,IAAA,IAAI,CAAC,IAAA,CAAK,IAAA,EAAM,OAAO,IAAA;AACvB,IAAA,MAAM,KAAA,GAAQA,sBAAA,CAAK,IAAA,CAAK,KAAA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KAAA,EAAO,KAAA,CAAM,IAAI,IAAI,CAAA;AAAA,IACrD;AAAA,EACF;AACA,EAAA,OAAO,OAAO,KAAK,CAAA;AACrB;AAGO,IAAM,WAAA,GAAc,CACzB,SAAA,EACA,OAAA,KACsB,SAAA,CAAU,MAAA,CAAO,CAAC,KAAA,KAAU,OAAA,CAAQ,KAAA,CAAM,MAAM,CAAA,KAAM,MAAS","file":"chunk-5YQIAS4V.cjs","sourcesContent":["import type { RenderNode } from '../layout';\nimport { passFor, swap, walkValue } from './swap';\nimport type { Pass } from './swap';\nimport type { PhraseKeys, Phrasebook } from './phrases';\n\n// ═══════════════════════════════════════════════════════════\n// translateRenderTree — the late pass, for whoever holds a tree they did not\n// render.\n//\n// NOT the main road any more. Since the swap moved into the renderer\n// (`layout/renderer.ts`), a tree that came out of a nova shell is already in\n// the reader's language and this pass would find nothing to do. What is left\n// for it is every tree that arrived from somewhere else: a frame replayed from\n// a cache, an exporter's fixture, a test that builds nodes by hand.\n//\n// Structure in, same structure out, with prose swapped. A phrase with no entry\n// passes through unchanged — the only sane failure, since a missing\n// translation should show the source language, never an empty box and never a\n// key. `onMiss` is how a check turns those into a list.\n//\n// One deliberate difference from the renderer: an EMPTY book short-circuits\n// here and returns the very same tree, patterns included. The renderer fills\n// patterns even with no book, because a source-language session has nobody\n// else to do it; a tree-holder with no book has nothing to say about a tree it\n// did not make.\n// ═══════════════════════════════════════════════════════════\n\nexport type TranslateOptions = {\n phrases: Phrasebook;\n keys?: PhraseKeys;\n // Called once per untranslated phrase, with where it was found. For a dev\n // check that has to answer \"what did we forget\" without a human reading every\n // screen. Never call it from a hot path — it is a reporting seam.\n onMiss?: (phrase: string, where: string) => void;\n};\n\nconst walkNode = (node: RenderNode, where: string, pass: Pass): RenderNode => {\n if (node.type === 'text') {\n if (!pass.text) return node;\n const value = swap(node.value, where, pass);\n return value === node.value ? node : { ...node, value };\n }\n\n if (node.type === 'fragment') {\n const children = walkNodes(node.children, where, pass);\n return children === node.children ? node : { ...node, children };\n }\n\n // An error node's message is a diagnostic for whoever is on call, not product\n // copy — left in the language the stack throws in, deliberately.\n if (node.type === 'error') return node;\n\n const at = node.ref === undefined ? `${where}/${node.name}` : `${where}/${node.name}#${node.ref}`;\n let props = node.props;\n let propsChanged = false;\n const nextProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(node.props)) {\n const next = walkValue(value, pass.isProse(key), `${at}.${key}`, pass);\n if (next !== value) propsChanged = true;\n nextProps[key] = next;\n }\n if (propsChanged) props = nextProps;\n\n const children = walkNodes(node.children, at, pass);\n if (!propsChanged && children === node.children) return node;\n return { ...node, props, children };\n};\n\n// Identity is returned when nothing under a node changed. Not an optimisation\n// for its own sake: an untranslated locale (the source language) must produce\n// the byte-identical frame it produced before this pass existed, or every\n// English session pays a delta rebuild for a walk that did nothing.\nconst walkNodes = (nodes: RenderNode[], where: string, pass: Pass): RenderNode[] => {\n let changed = false;\n const out = nodes.map((node) => {\n const next = walkNode(node, where, pass);\n if (next !== node) changed = true;\n return next;\n });\n return changed ? out : nodes;\n};\n\nexport const translateRenderTree = (tree: RenderNode[], options: TranslateOptions): RenderNode[] => {\n // An empty phrasebook is the source language. Skip the walk entirely rather\n // than doing it and finding nothing.\n if (Object.keys(options.phrases).length === 0) return tree;\n const pass = passFor({\n phrases: options.phrases,\n ...(options.keys === undefined ? {} : { keys: options.keys }),\n ...(options.onMiss === undefined ? {} : { onMiss: options.onMiss }),\n });\n if (pass === undefined) return tree;\n return walkNodes(tree, '', pass);\n};\n","import { isArray, isObject } from '../shared/common';\nimport type { ActionDefinition } from '../action';\nimport type { LayoutNode } from '../layout';\nimport { isPhrase, matcherFor } from './phrases';\nimport type { PhraseKeys } from './phrases';\n\n// ═══════════════════════════════════════════════════════════\n// harvest — read every phrase an action could put on a screen, without\n// running it.\n//\n// The other half of the late pass. Keying a dictionary on source strings only\n// works if there is a mechanical way to enumerate them; otherwise \"translate\n// the app\" means a human reading every layout, and the second language is\n// permanently 90% done.\n//\n// This walks the AUTHORED artifacts — definitions and layouts — not a rendered\n// tree, and that is the point: what comes back is exactly the set of strings a\n// person wrote, never a value that arrived from the database. A member called\n// \"Pass\" can therefore never enter the dictionary by being on screen the day\n// somebody ran the harvest.\n// ═══════════════════════════════════════════════════════════\n\nexport type HarvestedPhrase = {\n phrase: string;\n /** Every author site it came from — sorted, deduped. */\n where: readonly string[];\n};\n\ntype Sink = {\n add: (phrase: string, where: string) => void;\n isProse: (key: string) => boolean;\n text: boolean;\n};\n\nconst sinkInto = (found: Map<string, Set<string>>, keys: PhraseKeys | undefined): Sink => {\n const matcher = matcherFor(keys);\n return {\n add: (phrase, where) => {\n const trimmed = phrase.trim();\n if (!isPhrase(trimmed)) return;\n const sites = found.get(trimmed);\n if (sites === undefined) found.set(trimmed, new Set([where]));\n else sites.add(where);\n },\n isProse: matcher.isProse,\n text: matcher.text,\n };\n};\n\n// Inside an allowlisted prop, EVERY reachable literal is a phrase. A `label`\n// holding `{ $if: …, $then: 'Save', $else: 'Create' }` has two of them, and a\n// harvester that only accepted a direct string would silently drop the branch\n// nobody was looking at.\nconst harvestWithin = (value: unknown, where: string, sink: Sink): void => {\n if (typeof value === 'string') {\n sink.add(value, where);\n return;\n }\n if (isArray(value)) {\n value.forEach((entry, index) => harvestWithin(entry, `${where}[${String(index)}]`, sink));\n return;\n }\n if (isObject(value)) {\n for (const [key, entry] of Object.entries(value)) harvestWithin(entry, `${where}.${key}`, sink);\n }\n};\n\nconst harvestProps = (props: Record<string, unknown>, where: string, sink: Sink): void => {\n for (const [key, value] of Object.entries(props)) {\n if (sink.isProse(key)) {\n harvestWithin(value, `${where}.${key}`, sink);\n continue;\n }\n // Not a prose key itself — but a nested object under it may hold one\n // (`cell: { label }` inside a column spec). Keep descending; only the KEY\n // decides, never the depth.\n if (isObject(value) || isArray(value)) harvestNested(value, `${where}.${key}`, sink);\n }\n};\n\nconst harvestNested = (value: unknown, where: string, sink: Sink): void => {\n if (isArray(value)) {\n value.forEach((entry, index) => harvestNested(entry, `${where}[${String(index)}]`, sink));\n return;\n }\n if (!isObject(value)) return;\n for (const [key, entry] of Object.entries(value)) {\n if (sink.isProse(key)) harvestWithin(entry, `${where}.${key}`, sink);\n else harvestNested(entry, `${where}.${key}`, sink);\n }\n};\n\n// Takes `unknown` rather than `LayoutNode`: the walk discriminates the node\n// kinds structurally, and narrowing a union by `in` checks fights the compiler\n// for no benefit here — every branch reads what it needs and guards it.\nconst harvestNode = (node: unknown, where: string, sink: Sink): void => {\n if (node === null || node === undefined) return;\n if (typeof node === 'string') {\n // A text position: the layout's literal children.\n if (sink.text) sink.add(node, where);\n return;\n }\n if (typeof node === 'number' || typeof node === 'boolean') return;\n if (isArray(node)) {\n node.forEach((child, index) => harvestNode(child, `${where}[${String(index)}]`, sink));\n return;\n }\n if (!isObject(node)) return;\n\n const component = node['component'];\n if (component === undefined) {\n // A stored-layout reference and a fragment slot are ids, never words.\n if ('ref' in node || 'slot' in node) return;\n if ('if' in node) {\n harvestNode(node['then'], `${where}.then`, sink);\n harvestNode(node['else'], `${where}.else`, sink);\n return;\n }\n if ('for' in node && 'do' in node) {\n harvestNode(node['do'], `${where}.do`, sink);\n return;\n }\n return;\n }\n\n const at = `${where}/${String(component)}`;\n const props = node['props'];\n if (isObject(props)) harvestProps(props, at, sink);\n harvestNode(node['children'], `${at}.children`, sink);\n};\n\nconst toList = (found: Map<string, Set<string>>): HarvestedPhrase[] =>\n [...found.entries()]\n .map(([phrase, sites]) => ({ phrase, where: [...sites].sort() }))\n .sort((a, b) => a.phrase.localeCompare(b.phrase));\n\nexport const harvestLayout = (layout: LayoutNode, keys?: PhraseKeys): HarvestedPhrase[] => {\n const found = new Map<string, Set<string>>();\n harvestNode(layout, '', sinkInto(found, keys));\n return toList(found);\n};\n\n// A `{ set: '<key>', value: '<literal>' }` step writes words into data, and\n// data lands in props. An error message a trigger sets is as much product copy\n// as a heading, and is otherwise invisible to a harvester that only reads\n// layouts.\nconst harvestSteps = (value: unknown, where: string, sink: Sink): void => {\n if (isArray(value)) {\n value.forEach((entry, index) => harvestSteps(entry, `${where}[${String(index)}]`, sink));\n return;\n }\n if (!isObject(value)) return;\n const target = value['set'];\n const written = value['value'];\n if (typeof target === 'string' && typeof written === 'string') sink.add(written, `${where}.set:${target}`);\n for (const [key, entry] of Object.entries(value)) {\n if (key === 'set' || key === 'value') continue;\n harvestSteps(entry, `${where}.${key}`, sink);\n }\n};\n\nexport const harvestDefinition = (definition: ActionDefinition, keys?: PhraseKeys): HarvestedPhrase[] => {\n const found = new Map<string, Set<string>>();\n const sink = sinkInto(found, keys);\n const id = definition.id;\n\n // The title is chrome's words — a Sheet header, a catalog entry — and reaches\n // the tree as a prop rather than from the layout.\n if (typeof definition.title === 'string') sink.add(definition.title, `${id}.title`);\n\n // Defaulted data is a screen's opening text: the 'Stock' in a theme name, the\n // placeholder a list shows before its first read lands.\n //\n // TWO RULES, because `data` is two things at once.\n //\n // A top-level string is taken WHOLE, whatever its key. Where it lands decides\n // whether it is prose, and only the LAYOUT knows that: `runningHint` is not a\n // prose key and reaches the glass as a text child, so a matcher applied here\n // would drop a sentence the pass goes on to translate. The cost of taking\n // them all is enum values and ids in the report, which a host filters by name.\n //\n // Anything NESTED is walked by the matcher instead, and that is the rule that\n // reaches an options array — `views: [{ value: 'running', label: 'Running' }]`\n // yields `Running` and never `running`. Without it a tab strip built in data\n // is not merely untranslatable but UNCOUNTED, which is the worse half: the\n // harvest reports a full book while the words are missing from the screen.\n for (const [key, value] of Object.entries(definition.data ?? {})) {\n if (typeof value === 'string') sink.add(value, `${id}.data.${key}`);\n else if (isObject(value) || isArray(value)) harvestNested(value, `${id}.data.${key}`, sink);\n }\n\n if (definition.layout !== undefined) harvestNode(definition.layout, id, sink);\n if (definition.triggers !== undefined) harvestSteps(definition.triggers, `${id}.triggers`, sink);\n if (definition.lifecycle !== undefined) harvestSteps(definition.lifecycle, `${id}.lifecycle`, sink);\n\n return toList(found);\n};\n\nexport const harvestDefinitions = (\n definitions: Record<string, ActionDefinition>,\n keys?: PhraseKeys,\n): HarvestedPhrase[] => {\n const found = new Map<string, Set<string>>();\n for (const definition of Object.values(definitions)) {\n for (const entry of harvestDefinition(definition, keys)) {\n const sites = found.get(entry.phrase);\n if (sites === undefined) found.set(entry.phrase, new Set(entry.where));\n else for (const site of entry.where) sites.add(site);\n }\n }\n return toList(found);\n};\n\n/** Phrases with no entry in the book — what a language is still missing. */\nexport const missingFrom = (\n harvested: readonly HarvestedPhrase[],\n phrases: Readonly<Record<string, string>>,\n): HarvestedPhrase[] => harvested.filter((entry) => phrases[entry.phrase] === undefined);\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { StackPropsSchema, BoxPropsSchema, TextPropsSchema, ButtonPropsSchema, InputPropsSchema, PanelPropsSchema, JsonTreePropsSchema, CanvasSlotPropsSchema, ActionSlotPropsSchema, createShellHead } from './chunk-
|
|
2
|
-
import { scopeDispatch } from './chunk-
|
|
1
|
+
import { StackPropsSchema, BoxPropsSchema, TextPropsSchema, ButtonPropsSchema, InputPropsSchema, PanelPropsSchema, JsonTreePropsSchema, CanvasSlotPropsSchema, ActionSlotPropsSchema, createShellHead } from './chunk-EG45GQOE.js';
|
|
2
|
+
import { scopeDispatch } from './chunk-P5SJ3QXJ.js';
|
|
3
3
|
import { isHeadNode } from './chunk-RFBIGRCI.js';
|
|
4
|
-
import { renderNodeKey, NOVA_MODEL_PROP, NOVA_REF_PROP } from './chunk-
|
|
4
|
+
import { renderNodeKey, NOVA_MODEL_PROP, NOVA_REF_PROP } from './chunk-XUSKGJRI.js';
|
|
5
5
|
import { defineComponent, h, shallowRef, onBeforeUnmount, inject, onMounted, watch, provide, createTextVNode, Fragment, toValue } from 'vue';
|
|
6
6
|
|
|
7
7
|
var px = (value) => `${value ?? 0}px`;
|
|
@@ -589,5 +589,5 @@ var registerNovaVueComponents = (registry) => {
|
|
|
589
589
|
};
|
|
590
590
|
|
|
591
591
|
export { ActionSlot, Box, Button, CanvasSlot, ErrorMarker, Input, JsonTree, NovaRenderKey, NovaShellKey, Panel, RenderNodeView, RenderTree, Stack, Text, isNovaComponent, provideShellHead, registerNovaVueComponents, useActionData, useActionStatus, useCanvas, useCanvasRenderTree, useNovaDispatch, useNovaPublish, useNovaRegistry, useRenderTree, useShell, useShellRenderTree, useShellState, useSlotWrapper };
|
|
592
|
-
//# sourceMappingURL=chunk-
|
|
593
|
-
//# sourceMappingURL=chunk-
|
|
592
|
+
//# sourceMappingURL=chunk-7MATRNZZ.js.map
|
|
593
|
+
//# sourceMappingURL=chunk-7MATRNZZ.js.map
|