@niscorp/nova 0.1.2 → 0.1.4
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/ADAPTER.md +6 -0
- package/CHANGELOG.md +20 -0
- package/README.md +29 -1
- package/dist/adapters/dom/index.cjs +98 -4
- package/dist/adapters/dom/index.cjs.map +1 -1
- package/dist/adapters/dom/index.js +7 -7
- package/dist/adapters/dom/server.cjs +12 -1
- package/dist/adapters/dom/server.cjs.map +1 -1
- package/dist/adapters/dom/server.js +7 -7
- package/dist/adapters/react/components/index.cjs +32 -10
- package/dist/adapters/react/components/index.cjs.map +1 -1
- package/dist/adapters/react/components/index.d.cts +2 -2
- package/dist/adapters/react/components/index.d.ts +2 -2
- package/dist/adapters/react/components/index.js +9 -5
- package/dist/adapters/react/index.cjs +268 -97
- package/dist/adapters/react/index.cjs.map +1 -1
- package/dist/adapters/react/index.js +9 -5
- package/dist/adapters/tty/index.cjs +8 -1
- package/dist/adapters/tty/index.cjs.map +1 -1
- package/dist/adapters/tty/index.js +12 -1
- package/dist/adapters/tty/index.js.map +1 -1
- package/dist/adapters/vue/components/index.cjs +32 -1
- package/dist/adapters/vue/components/index.cjs.map +1 -1
- package/dist/adapters/vue/components/index.d.cts +1 -1
- package/dist/adapters/vue/components/index.d.ts +1 -1
- package/dist/adapters/vue/components/index.js +9 -5
- package/dist/adapters/vue/index.cjs +218 -23
- package/dist/adapters/vue/index.cjs.map +1 -1
- package/dist/adapters/vue/index.js +10 -9
- package/dist/adapters/vue/index.js.map +1 -1
- package/dist/{chunk-7S5BNPUS.js → chunk-4ERQYDF6.js} +36 -4
- package/dist/chunk-4ERQYDF6.js.map +1 -0
- package/dist/{chunk-FQAJ24KA.js → chunk-4I2PFMY7.js} +33 -8
- package/dist/chunk-4I2PFMY7.js.map +1 -0
- package/dist/{chunk-IGLCWXQ3.js → chunk-7PKS7UYL.js} +3 -3
- package/dist/{chunk-IGLCWXQ3.js.map → chunk-7PKS7UYL.js.map} +1 -1
- package/dist/{chunk-GVBBL36G.js → chunk-DIFE573X.js} +196 -4
- package/dist/chunk-DIFE573X.js.map +1 -0
- package/dist/chunk-EHHJJLRX.js +16 -0
- package/dist/chunk-EHHJJLRX.js.map +1 -0
- package/dist/{chunk-3HGE3VWK.js → chunk-KYQ4EAQH.js} +33 -11
- package/dist/chunk-KYQ4EAQH.js.map +1 -0
- package/dist/{chunk-V32EVEVM.js → chunk-RXECI7DE.js} +300 -5
- package/dist/chunk-RXECI7DE.js.map +1 -0
- package/dist/{chunk-4ZID7UX5.js → chunk-UUYXVOK2.js} +52 -8
- package/dist/chunk-UUYXVOK2.js.map +1 -0
- package/dist/chunk-UV5YGBHQ.js +62 -0
- package/dist/chunk-UV5YGBHQ.js.map +1 -0
- package/dist/{chunk-6N4WRC5V.js → chunk-WZVQ5PUB.js} +85 -12
- package/dist/chunk-WZVQ5PUB.js.map +1 -0
- package/dist/chunk-X7SSNSQC.js +6 -0
- package/dist/chunk-X7SSNSQC.js.map +1 -0
- package/dist/devtools/index.js +4 -5
- package/dist/devtools/index.js.map +1 -1
- package/dist/document/index.cjs +199 -0
- package/dist/document/index.cjs.map +1 -0
- package/dist/document/index.d.cts +20 -0
- package/dist/document/index.d.ts +20 -0
- package/dist/document/index.js +125 -0
- package/dist/document/index.js.map +1 -0
- package/dist/head-BNj8GwPO.d.cts +20 -0
- package/dist/head-CS6X6ZKr.d.ts +20 -0
- package/dist/index.cjs +77 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +5 -6
- package/dist/migrations/index.js +1 -2
- package/dist/migrations/index.js.map +1 -1
- package/dist/reflect/index.js +4 -5
- package/package.json +13 -3
- package/dist/chunk-3HGE3VWK.js.map +0 -1
- package/dist/chunk-4ZID7UX5.js.map +0 -1
- package/dist/chunk-6N4WRC5V.js.map +0 -1
- package/dist/chunk-7S5BNPUS.js.map +0 -1
- package/dist/chunk-FQAJ24KA.js.map +0 -1
- package/dist/chunk-GVBBL36G.js.map +0 -1
- package/dist/chunk-PF4OJTYU.js +0 -199
- package/dist/chunk-PF4OJTYU.js.map +0 -1
- package/dist/chunk-RQB4PRPV.js +0 -285
- package/dist/chunk-RQB4PRPV.js.map +0 -1
- package/dist/chunk-V32EVEVM.js.map +0 -1
- package/dist/chunk-ZITHBBF3.js +0 -85
- package/dist/chunk-ZITHBBF3.js.map +0 -1
- package/dist/{primitive-props-BH_EJWIe.d.ts → primitive-props-Cl5jiC8g.d.cts} +1 -1
- package/dist/{primitive-props-BH_EJWIe.d.cts → primitive-props-Cl5jiC8g.d.ts} +1 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters/dom/index.ts"],"names":["before"],"mappings":";;;;AAsEA,IAAM,WAAA,GAAc,YAAA;AACpB,IAAM,WAAA,GAAc,YAAA;AAsCpB,IAAM,OAAA,GAAU,CAAC,IAAA,EAAc,OAAA,KAAiC;AAC9D,EAAA,MAAM,EAAA,GAAK,QAAA,CAAS,aAAA,CAAc,KAAK,CAAA;AACvC,EAAA,EAAA,CAAG,YAAA,CAAa,mBAAmB,IAAI,CAAA;AACvC,EAAA,EAAA,CAAG,WAAA,GAAc,CAAA,EAAG,IAAI,CAAA,EAAA,EAAK,OAAO,CAAA,CAAA;AACpC,EAAA,OAAO,EAAA;AACT,CAAA;AAGA,IAAM,KAAA,GAAQ,CAAC,CAAA,EAAY,CAAA,KAAwB;AACjD,EAAA,IAAI,MAAA,CAAO,EAAA,CAAG,CAAA,EAAG,CAAC,GAAG,OAAO,IAAA;AAC5B,EAAA,IAAI,OAAO,CAAA,KAAM,QAAA,IAAY,OAAO,CAAA,KAAM,YAAY,CAAA,KAAM,IAAA,IAAQ,CAAA,KAAM,IAAA,EAAM,OAAO,KAAA;AACvF,EAAA,IAAI,KAAA,CAAM,QAAQ,CAAC,CAAA,KAAM,MAAM,OAAA,CAAQ,CAAC,GAAG,OAAO,KAAA;AAClD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;AAAA,GACF;AACF","file":"chunk-FQAJ24KA.js","sourcesContent":["import { renderNodeKey } from '@layout/adapter';\nimport type { ComponentRegistry, RenderNode } from '@layout/types';\nimport type { NovaEvent } from '@shared/event-bus/schemas';\nimport { shellView } from '@shell';\nimport type { RenderApi, Shell } from '@shell';\n\n// ═══════════════════════════════════════════════════════════\n// @niscorp/nova/adapters/dom — a vanilla-DOM adapter, the platform sibling of\n// nova/react. It turns a served RenderNode tree into DOM: registry lookup →\n// element, recurse children, and wire events BY CONVENTION — a `ref`'d\n// element dispatches `ui:click`, a `model`'d element dispatches `ui:model`\n// (+ `ui:key`), the payload of a click is the node's `value` prop. Origin is\n// never stamped here — moss stamps the active instance server-side.\n//\n// No framework: the registry maps a component name to a function that builds\n// an element from props + already-rendered children. `CanvasSlot` is resolved\n// here (the frame's markers → per-canvas trees), the one piece of terminal\n// structure the renderer owns; the terminal hands in `canvasTree`/`dispatch`.\n//\n// WHAT DID NOT CHANGE IS NOT DRAWN AGAIN. The view keeps the tree it drew\n// beside the DOM that tree produced, and a render walks the two together: a\n// node that is the same as last time keeps its element — the same DOM node,\n// never taken off the page — and only what differs is built. An element that\n// stays keeps everything the tree does not hold: focus, scroll, selection, an\n// open <details>, a running animation, a timer its component started.\n// See packages/nova/ADAPTER.md for the shared adapter contract, and \"The DOM\n// adapter keeps what did not change\" there for the rules a kit can rely on.\n// ═══════════════════════════════════════════════════════════\n\nexport type DomComponentContext = {\n props: Record<string, unknown>;\n // the node's children, already rendered — the component appends them where\n // it wants (most append to their own element; leaves ignore them).\n children: Node[];\n // the dispatch in force here (canvas-scoped inside a CanvasSlot) — for\n // data-driven components with INTERNAL interactivity (a table's row clicks,\n // an inline checkbox); simple components ignore it and let the renderer wire\n // their `ref`/`model` by convention.\n dispatch: (event: NovaEvent) => void;\n // The other end of anything the component starts — a timer, an observer, a\n // subscription. `cleanup` runs once, when the element this call returns\n // leaves the page for good: it was removed, it was replaced because its own\n // props changed, or the view was destroyed. An element that stays is not\n // asked again, so what it started keeps running until then.\n onRemove: (cleanup: () => void) => void;\n // Say that what this component drew depends on its children — it marked\n // them, counted them, treated the first unlike the rest — rather than only\n // holding them. A component that only holds its children has them patched in\n // place under the element it returned; one that says this is asked again\n // whenever it would be handed different children, and is handed the ones that\n // stayed as it left them, so what it does to them it must be able to do twice.\n dependsOnChildren: () => void;\n};\n\n// A DOM component: props + rendered children in, one element out.\nexport type DomComponent = (ctx: DomComponentContext) => HTMLElement;\n\n// What the terminal hands the view: core's `RenderApi` (the frame, per-canvas\n// trees, a canvas-scoped dispatch, publish). Aliased, not redeclared, so the\n// dom adapter, the react adapter, and moss's terminal share ONE definition —\n// drift is impossible. CanvasSlot resolution + event routing ride these; the\n// renderer never touches the wire directly.\nexport type DomRenderApi = RenderApi;\n\nexport type DomView = {\n // (re)render from the current snapshot; call on every wire change\n render: () => void;\n destroy: () => void;\n};\n\nconst CANVAS_SLOT = 'CanvasSlot';\nconst ACTION_SLOT = 'ActionSlot';\n\ntype ComponentRenderNode = Extract<RenderNode, { type: 'component' }>;\ntype Dispatch = (event: NovaEvent) => void;\n\n// The recursion context: the registry, the dispatch in force (frame chrome\n// dispatches nothing; a CanvasSlot switches it to that canvas's), publish,\n// and the canvas resolver.\ntype Ctx = {\n registry: ComponentRegistry<DomComponent>;\n dispatch: Dispatch;\n api: DomRenderApi;\n // used when a component name is unregistered — a permissive renderer (the\n // html terminal's default kit) supplies one so unknown primitives render\n // their children instead of an error; strict consumers omit it.\n fallback?: DomComponent;\n};\n\n// One node of the tree as it was last drawn, beside the DOM it produced.\ntype Mount = {\n node: RenderNode;\n // the context this node's children are drawn in\n ctx: Ctx;\n // its top-level DOM nodes: one for a component, a text or an error; a\n // fragment has no element of its own, so its are its children's\n dom: Node[];\n kids: Mount[];\n // Where the kids' nodes can be patched in place: the element itself, when it\n // holds exactly them (`holdsExactly`), or a canvas's own host. `undefined`\n // when the component put them anywhere else — a change to which nodes it has\n // then asks the component again.\n host: HTMLElement | undefined;\n cleanups: (() => void)[];\n // a bound field that may not show what the tree says: it was typed in, or the\n // tree's value changed while it was being typed in\n field: { stale: boolean };\n};\n\nconst errorEl = (code: string, message: string): HTMLElement => {\n const el = document.createElement('div');\n el.setAttribute('data-nova-error', code);\n el.textContent = `${code}: ${message}`;\n return el;\n};\n\n// A tree is JSON, so sameness is structural.\nconst equal = (a: unknown, b: unknown): boolean => {\n if (Object.is(a, b)) return true;\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) return false;\n if (Array.isArray(a) !== Array.isArray(b)) return false;\n const keys = Object.keys(a);\n if (keys.length !== Object.keys(b).length) return false;\n return keys.every((key) => Object.hasOwn(b, key) && equal(Reflect.get(a, key), Reflect.get(b, key)));\n};\n\nconst withoutValue = (props: Record<string, unknown>): Record<string, unknown> => {\n const { value: _value, ...rest } = props;\n return rest;\n};\n\nconst sameNodes = (a: Node[], b: Node[]): boolean => a.length === b.length && a.every((node, i) => node === b[i]);\n\n// (Plain indexed loops on purpose: this runs twice for every component on every\n// render, and measured in Chrome it is what a render of a long list spends its\n// time in. `flatMap` is slower once warm; `for…of` is twice as slow while cold,\n// which is when a first draw happens.)\nconst flat = (kids: Mount[]): Node[] => {\n const nodes: Node[] = [];\n for (let i = 0; i < kids.length; i += 1) {\n const dom = kids[i]?.dom ?? [];\n for (let j = 0; j < dom.length; j += 1) {\n const node = dom[j];\n if (node !== undefined) nodes.push(node);\n }\n }\n return nodes;\n};\n\nconst canvasIdOf = (node: ComponentRenderNode): string => {\n const canvasId = node.props['canvasId'];\n return typeof canvasId === 'string' ? canvasId : '';\n};\n\n// Which canvas or which instance a slot stands for. A different one in the\n// same place is a different screen, however alike the two look.\nconst slotOf = (node: ComponentRenderNode): unknown => {\n if (node.name === CANVAS_SLOT) return node.props['canvasId'];\n if (node.name === ACTION_SLOT) return node.props['instanceId'];\n return undefined;\n};\n\n// Core's `renderNodeKey` names a node among its siblings. Two siblings that\n// share a name (looped rows that share a `ref` and carry no key) are told\n// apart by which of them comes first.\nconst keyed = <T>(items: readonly T[], nodeOf: (item: T) => RenderNode): [string, T][] => {\n const seen = new Map<string, number>();\n return items.map((item, i) => {\n const key = renderNodeKey(nodeOf(item), i);\n const count = seen.get(key) ?? 0;\n seen.set(key, count + 1);\n return [count === 0 ? key : `${key}#${count}`, item];\n });\n};\n\n// Whether two nodes at the same index would be given the same key by core's\n// `renderNodeKey` — asked without building the key. Siblings mostly stay where\n// they are from one render to the next, and then nothing has to be looked up.\nconst samePlace = (a: RenderNode, b: RenderNode): boolean => {\n if (a.key !== undefined || b.key !== undefined) return a.key === b.key;\n if (a.type === 'component' && b.type === 'component') return a.ref !== undefined || b.ref !== undefined ? a.ref === b.ref : a.name === b.name;\n if (a.type === 'error' && b.type === 'error') return a.code === b.code;\n return a.type === b.type;\n};\n\nconst gathered = (nodes: Node[]): DocumentFragment => {\n const fragment = document.createDocumentFragment();\n for (const node of nodes) fragment.appendChild(node);\n return fragment;\n};\n\n// Whether a component's children can be patched where they stand: only when the\n// element it returned holds exactly the nodes it was handed, in order, and\n// nothing else. Then adding one, taking one out or moving one is what the\n// component would have drawn anyway. Anything else — a wrapper inside, a cell\n// around each, a heading of its own before them — and the adapter cannot know\n// what the component would do with one child more (a kit that wraps each child\n// looks, with a single child, exactly like one that wraps them all), so it asks.\n// What the shape of the element cannot show — a component that marks or counts\n// the children it holds — the component says itself (`dependsOnChildren`).\nconst holdsExactly = (el: Node, nodes: Node[]): boolean => nodes.length > 0 && el.childNodes.length === nodes.length && nodes.every((node, i) => el.childNodes[i] === node);\n\n// Of the nodes wanted, the longest run that already stands in the wanted order\n// — given where each stood before (-1: it is new). Those stay where they are\n// and the rest are put around them, so a reorder moves as few elements as it\n// can: taking an element out of the page, even to put it straight back,\n// restarts its animations and drops its scroll.\nconst standing = (stoodAt: number[]): Set<number> => {\n // ends[k]: the wanted index that ends the best run of length k + 1\n const ends: number[] = [];\n const before: number[] = [];\n stoodAt.forEach((stood, i) => {\n before[i] = -1;\n if (stood < 0) return;\n let lo = 0;\n let hi = ends.length;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if ((stoodAt[ends[mid] ?? 0] ?? 0) < stood) lo = mid + 1;\n else hi = mid;\n }\n before[i] = lo > 0 ? (ends[lo - 1] ?? -1) : -1;\n ends[lo] = i;\n });\n const run = new Set<number>();\n let at = ends[ends.length - 1] ?? -1;\n while (at >= 0) {\n run.add(at);\n at = before[at] ?? -1;\n }\n return run;\n};\n\n// Read the model value off an event target — a checkbox reports `checked`,\n// everything else `value`.\nconst readValue = (target: EventTarget | null): unknown => {\n if (target instanceof HTMLInputElement && target.type === 'checkbox') return target.checked;\n if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) return target.value;\n return '';\n};\n\n// Attach the conventional listeners: a model'd element is an input (dispatch\n// ui:model on change, ui:key on keydown); a bare ref'd element is clickable\n// (dispatch ui:click, payload = its `value` prop). Uniform across every\n// component — the event vocabulary is the convention, not per-component code.\n//\n// The listeners close over the node they were wired for. That is safe because\n// an element is only ever kept for a node that says the same: a different\n// `ref`, `model`, or prop builds a new element with new listeners (a bound\n// field's `value` aside, which no listener reads).\nconst wireEvents = (el: HTMLElement, node: ComponentRenderNode, dispatch: Dispatch, field: { stale: boolean }): void => {\n if (node.model !== undefined) {\n const ref = node.model.ref;\n const wait = node.props['debounce'];\n const debounce = typeof wait === 'number' ? wait : 0;\n let pending: { value: unknown; timer: ReturnType<typeof setTimeout> } | undefined;\n const fire = (value: unknown): void => dispatch({ type: 'ui:model', ref, payload: value });\n el.addEventListener('input', (e) => {\n field.stale = true;\n const value = readValue(e.target);\n if (debounce <= 0) {\n fire(value);\n return;\n }\n if (pending !== undefined) clearTimeout(pending.timer);\n const timer = setTimeout(() => {\n pending = undefined;\n fire(value);\n }, debounce);\n pending = { value, timer };\n });\n // Leaving the field sends what was still waiting (ADAPTER.md, obligation 6).\n // Caught on the way down: blur does not bubble, and the field may sit\n // inside the component's element rather than be it.\n el.addEventListener(\n 'blur',\n () => {\n if (pending === undefined) return;\n clearTimeout(pending.timer);\n const { value } = pending;\n pending = undefined;\n fire(value);\n },\n true,\n );\n el.addEventListener('keydown', (e) => {\n if (e instanceof KeyboardEvent) dispatch({ type: 'ui:key', ref, key: e.key });\n });\n return;\n }\n if (node.ref !== undefined) {\n const ref = node.ref;\n el.addEventListener('click', (e) => {\n e.stopPropagation();\n const value = node.props['value'];\n dispatch(value === undefined ? { type: 'ui:click', ref } : { type: 'ui:click', ref, payload: value });\n });\n }\n};\n\n// The per-instance boundary a served tree carries. A list canvas renders\n// several live instances at once, so a click inside THIS boundary must reach\n// THIS instance: its events carry it as their origin (the server's\n// active-instance fallback only holds for a card-deck canvas). An event that\n// already has an origin keeps it — moss's react terminal does the same.\nconst inInstance = (node: RenderNode, ctx: Ctx): Ctx => {\n if (node.type !== 'component' || node.name !== ACTION_SLOT) return ctx;\n const instanceId = node.props['instanceId'];\n if (typeof instanceId !== 'string' || instanceId === '') return ctx;\n const outer = ctx.dispatch;\n return { ...ctx, dispatch: (event) => outer(event.origin === undefined ? { ...event, origin: instanceId } : event) };\n};\n\n// A field a person types in — where what is being typed must not be written\n// over. A checkbox or a radio has no \"being typed\": it is on or off, and the\n// tree's answer shows at once.\nconst isTypedIn = (el: Element | null): el is HTMLInputElement | HTMLTextAreaElement =>\n el instanceof HTMLTextAreaElement || (el instanceof HTMLInputElement && el.type !== 'checkbox' && el.type !== 'radio');\n\n// What such a field holds that is not in the tree: what is being typed, and\n// where the caret is.\ntype Typing = { value: string; start: number | null; end: number | null };\n\nconst typingIn = (el: Element | null): Typing | undefined => (isTypedIn(el) ? { value: el.value, start: el.selectionStart, end: el.selectionEnd } : undefined);\n\nconst placeCaret = (el: HTMLInputElement | HTMLTextAreaElement, typing: Typing): void => {\n try {\n el.setSelectionRange(typing.start ?? el.value.length, typing.end ?? el.value.length);\n } catch {\n /* selectionRange throws on some input types — harmless */\n }\n};\n\n// Where a node sits under `root`, as the child index at each level — and the\n// node that sits there. Markup drawn ahead of time and the first render over it\n// are the same elements in the same places, so this is how an element of the\n// one finds its twin in the other.\nconst placeUnder = (root: Node, node: Node): number[] | undefined => {\n const place: number[] = [];\n let at: Node = node;\n while (at !== root) {\n const parent = at.parentNode;\n if (parent === null) return undefined;\n const child = at;\n place.unshift([...parent.childNodes].findIndex((sibling) => sibling === child));\n at = parent;\n }\n return place;\n};\n\nconst nodeUnder = (root: Node, place: number[]): Node | undefined => place.reduce<Node | undefined>((at, index) => at?.childNodes[index], root);\n\nexport const createDomView = (\n root: HTMLElement,\n registry: ComponentRegistry<DomComponent>,\n api: DomRenderApi,\n options: { fallback?: DomComponent } = {},\n): DomView => {\n // The frame dispatches nothing (chrome); only a CanvasSlot's subtree does.\n const top: Ctx = { registry, dispatch: () => undefined, api, ...(options.fallback !== undefined ? { fallback: options.fallback } : {}) };\n let mounts: Mount[] = [];\n // Whatever is in the root before the first render is not this view's: markup\n // that arrived with the page is replaced by the first render, once.\n let drawn = false;\n // Counts every node built and every write to the page, so a component can\n // tell \"nothing below me changed\" from \"something did\".\n let writes = 0;\n // Focus is the element's, so it follows the element: `from` held it when the\n // render began, `to` is what was built in its place if it had to be.\n const refocus: { from: Element | null; to: HTMLElement | undefined } = { from: null, to: undefined };\n // a bound component's field state (Mount.field), found from its element\n const fields = new WeakMap<Node, { stale: boolean }>();\n\n const builderOf = (node: ComponentRenderNode, ctx: Ctx): DomComponent | undefined => ctx.registry.get(node.name)?.component ?? ctx.fallback;\n\n const leaf = (node: RenderNode, ctx: Ctx, el: Node): Mount => ({ node, ctx, dom: [el], kids: [], host: undefined, cleanups: [], field: { stale: false } });\n\n // The element is going: whatever its component started stops. Its kids are\n // not touched — they may be living on under the element built in its place.\n const leave = (mount: Mount): void => {\n if (mount.cleanups.length === 0) return;\n for (const cleanup of mount.cleanups.splice(0)) cleanup();\n };\n\n const drop = (mount: Mount): void => {\n leave(mount);\n for (const kid of mount.kids) drop(kid);\n };\n\n // Ask the component for its element. Children go in as they always have: one\n // Node per child, a fragment child (a loop) as a DocumentFragment. Kids that\n // were on the page already are moved into the new element by the component.\n const assemble = (node: ComponentRenderNode, ctx: Ctx, kids: Mount[], replaced?: Mount): Mount => {\n if (replaced !== undefined) leave(replaced);\n const builder = builderOf(node, ctx);\n if (builder === undefined) {\n for (const kid of kids) drop(kid);\n return leaf(node, ctx, errorEl('COMPONENT_NOT_FOUND', node.name));\n }\n const children = kids.map((kid): Node => {\n const [only] = kid.dom;\n if (kid.node.type !== 'fragment' && only !== undefined) return only;\n const fragment = document.createDocumentFragment();\n fragment.append(...kid.dom);\n return fragment;\n });\n const cleanups: (() => void)[] = [];\n const field = { stale: false };\n let holdsOnly = true;\n writes += 1;\n const el = builder({\n props: node.props,\n children,\n dispatch: ctx.dispatch,\n onRemove: (cleanup) => void cleanups.push(cleanup),\n dependsOnChildren: () => {\n holdsOnly = false;\n },\n });\n el.setAttribute('data-component', node.name);\n if (node.ref !== undefined) el.setAttribute('data-ref', node.ref);\n wireEvents(el, node, ctx.dispatch, field);\n if (node.model !== undefined) fields.set(el, field);\n if (replaced !== undefined && refocus.from !== null && replaced.dom[0] === refocus.from) refocus.to = el;\n return { node, ctx, dom: [el], kids, host: holdsOnly && holdsExactly(el, flat(kids)) ? el : undefined, cleanups, field };\n };\n\n const build = (node: RenderNode, parent: Ctx): Mount => {\n const ctx = inInstance(node, parent);\n writes += 1;\n if (node.type === 'text') return leaf(node, ctx, document.createTextNode(node.value));\n if (node.type === 'error') return leaf(node, ctx, errorEl(node.code, node.message));\n if (node.type === 'fragment') {\n const kids = node.children.map((child) => build(child, ctx));\n return { node, ctx, dom: flat(kids), kids, host: undefined, cleanups: [], field: { stale: false } };\n }\n if (node.name === CANVAS_SLOT) {\n const canvasId = canvasIdOf(node);\n const host = document.createElement('div');\n host.setAttribute('data-canvas', canvasId);\n // Switch dispatch to this canvas's; the server stamps origin, so the\n // terminal just tags the canvas.\n const canvasCtx: Ctx = { ...ctx, dispatch: (event) => ctx.api.dispatch(canvasId, event) };\n const kids = canvasId === '' ? [] : ctx.api.canvasTree(canvasId).map((child) => build(child, canvasCtx));\n host.append(...flat(kids));\n return { node, ctx: canvasCtx, dom: [host], kids, host, cleanups: [], field: { stale: false } };\n }\n if (builderOf(node, ctx) === undefined) return leaf(node, ctx, errorEl('COMPONENT_NOT_FOUND', node.name));\n return assemble(node, ctx, node.children.map((child) => build(child, ctx)));\n };\n\n // Make `host` hold `after` where it held `before`: what left is taken out,\n // what is new is put in, and a node that already stands where it belongs is\n // not touched. The writes are as few as they can be: nodes that go in side by\n // side go in together, and a host none of whose nodes stay is refilled in one.\n const place = (host: HTMLElement, before: Node[], after: Node[]): void => {\n if (sameNodes(before, after)) return;\n const wanted = new Set(after);\n if (host.childNodes.length === before.length && !before.some((node) => wanted.has(node))) {\n host.replaceChildren(gathered(after));\n writes += 1;\n return;\n }\n for (const node of before) {\n if (wanted.has(node) || node.parentNode !== host) continue;\n host.removeChild(node);\n writes += 1;\n }\n const stoodAt = new Map(before.map((node, i) => [node, i]));\n const stays = standing(after.map((node) => stoodAt.get(node) ?? -1));\n // right to left: what goes in between two nodes that stay is gathered, and\n // put in before the one on its right\n let anchor: Node | null = null;\n let run: Node[] = [];\n const putIn = (): void => {\n const [only] = run;\n if (only === undefined) return;\n host.insertBefore(run.length === 1 ? only : gathered(run.reverse()), anchor);\n writes += 1;\n run = [];\n };\n for (let i = after.length - 1; i >= 0; i -= 1) {\n const node = after[i];\n if (node === undefined) continue;\n if (stays.has(i)) {\n putIn();\n anchor = node;\n } else run.push(node);\n }\n putIn();\n };\n\n // Siblings are matched by key. A match is patched, a node with no match is\n // built, and what was drawn and has no match any more is let go.\n const reconcile = (olds: Mount[], nexts: readonly RenderNode[], ctx: Ctx): Mount[] => {\n // the usual case: the same siblings in the same places\n if (olds.length === nexts.length && olds.every((old, i) => samePlace(old.node, nexts[i] ?? old.node))) {\n return olds.map((old, i) => patch(old, nexts[i] ?? old.node, ctx));\n }\n const drawnBy = new Map(keyed(olds, (old) => old.node));\n const kids = keyed(nexts, (next) => next).map(([key, next]) => {\n const old = drawnBy.get(key);\n if (old === undefined) return build(next, ctx);\n drawnBy.delete(key);\n return patch(old, next, ctx);\n });\n for (const gone of drawnBy.values()) drop(gone);\n return kids;\n };\n\n const patch = (old: Mount, next: RenderNode, parent: Ctx): Mount => {\n const prev = old.node;\n const afresh = (): Mount => {\n drop(old);\n return build(next, parent);\n };\n if (prev.type === 'text' && next.type === 'text') {\n const [node] = old.dom;\n if (prev.value !== next.value && node !== undefined) {\n node.nodeValue = next.value;\n writes += 1;\n }\n old.node = next;\n return old;\n }\n if (prev.type === 'fragment' && next.type === 'fragment') {\n // no element of its own: the host above it puts its nodes in place\n old.kids = reconcile(old.kids, next.children, old.ctx);\n old.dom = flat(old.kids);\n old.node = next;\n return old;\n }\n if (prev.type !== 'component' || next.type !== 'component') return equal(prev, next) ? old : afresh();\n // A different component, or a different canvas or instance in the same\n // place: nothing of the old one is kept. Its listeners dispatch as the old\n // instance; kept, a press would reach an instance that is no longer here.\n if (prev.name !== next.name || !Object.is(slotOf(prev), slotOf(next))) return afresh();\n\n if (next.name === CANVAS_SLOT) {\n const host = old.host;\n if (host === undefined) return afresh();\n const canvasId = canvasIdOf(next);\n const before = flat(old.kids);\n old.kids = reconcile(old.kids, canvasId === '' ? [] : old.ctx.api.canvasTree(canvasId), old.ctx);\n place(host, before, flat(old.kids));\n old.node = next;\n return old;\n }\n\n const [el] = old.dom;\n if (el === undefined) return afresh();\n let own = equal(prev.props, next.props) && prev.ref === next.ref && equal(prev.model, next.model);\n if (next.model !== undefined) {\n const active = el.ownerDocument?.activeElement ?? null;\n if (isTypedIn(active) && el.contains(active)) {\n // WHILE A BOUND FIELD IS BEING TYPED IN, what the person is typing wins\n // over the tree (ADAPTER.md, obligation 6) — so a tree that differs only\n // in the field's value is not a reason to build another field. The one\n // being typed in stays, with its caret, its composition and its pending\n // debounce; it is marked as showing something the tree does not say.\n if (!own && prev.ref === next.ref && equal(prev.model, next.model) && equal(withoutValue(prev.props), withoutValue(next.props))) {\n old.field.stale = true;\n own = true;\n }\n } else if (old.field.stale) {\n // Released — or never a field one types in (a checkbox that was\n // pressed): the tree's value is the field's again. How a value is shown\n // is the kit's business, so the kit is asked for the field afresh.\n own = false;\n }\n }\n\n // what the component was handed, child by child — asked only of one that\n // did something of its own with its children\n const handed = old.host === undefined ? old.kids.map((kid) => kid.dom) : undefined;\n const before = flat(old.kids);\n const mark = writes;\n const kids = reconcile(old.kids, next.children, old.ctx);\n const after = flat(kids);\n const kept = (): Mount => {\n old.kids = kids;\n old.node = next;\n return old;\n };\n if (own) {\n if (old.host !== undefined) {\n // Its element holds exactly its children's nodes, so they are put in\n // place there. (Down to none at all is left to the component: it may\n // draw itself differently when empty.)\n if (after.length > 0) {\n place(old.host, before, after);\n return kept();\n }\n } else if (handed !== undefined && handed.length === kids.length && kids.every((kid, i) => sameNodes(handed[i] ?? [], kid.dom))) {\n // It did something of its own with its children, and it would be handed\n // the same nodes, child for child, so it would draw the same. Whatever\n // changed further down was patched where it stands — which is on the\n // page only if this component put its children on the page.\n if (writes === mark || after.every((node) => el.contains(node))) return kept();\n }\n }\n // Its own props changed, or its children changed where they cannot be\n // reached: ask the component again. What is below was reconciled all the\n // same, so a descendant that did not change is the same node in the new\n // element — moved, not rebuilt.\n return assemble(next, old.ctx, kids, old);\n };\n\n const render = (): void => {\n const doc = root.ownerDocument;\n const active = doc.activeElement !== null && root.contains(doc.activeElement) ? doc.activeElement : null;\n const typing = typingIn(active);\n // The first render replaces markup that arrived with the page. Somebody may\n // already be in it — in a field, typing — so where they are is noted, to be\n // found again in the elements drawn over it.\n const adopted = !drawn && active !== null ? placeUnder(root, active) : undefined;\n refocus.from = active;\n refocus.to = undefined;\n if (!drawn) root.replaceChildren();\n drawn = true;\n const before = flat(mounts);\n mounts = reconcile(mounts, api.frame(), top);\n place(root, before, flat(mounts));\n const twin = adopted === undefined ? undefined : nodeUnder(root, adopted);\n // An element that stayed where it was still has focus. One that was moved\n // lost it in the move, and one that was built again never had it: give it\n // back — and to a field built again, what was being typed in the one it\n // replaced, because the in-progress value wins over the tree's.\n const rebuilt = refocus.to ?? (twin instanceof HTMLElement && twin.tagName === active?.tagName ? twin : undefined);\n const target = rebuilt ?? (active instanceof HTMLElement && active.isConnected ? active : undefined);\n refocus.from = null;\n refocus.to = undefined;\n if (target === undefined || doc.activeElement === target) return;\n if (rebuilt !== undefined && typing !== undefined && isTypedIn(target)) {\n target.value = typing.value;\n const field = fields.get(target);\n if (field !== undefined) field.stale = true;\n }\n target.focus({ preventScroll: true });\n if (typing !== undefined && isTypedIn(target)) placeCaret(target, typing);\n };\n\n const destroy = (): void => {\n for (const mount of mounts) drop(mount);\n mounts = [];\n drawn = false;\n root.replaceChildren();\n };\n\n return { render, destroy };\n};\n\n// A SHELL THAT LIVES IN THIS PAGE, drawn into `root` and kept current: the\n// shell's own view (`shellView`), this adapter over it, and a render on every\n// change — which touches only what that change touched. The whole of a browser\n// entry for an app whose shell runs in the browser:\n//\n// mountShell(root, registry, await boot());\n//\n// A `root` that already holds the same screen as markup — drawn ahead of time\n// by `renderToString` (./server) from the same boot — is picked up by the first\n// render: it replaces those elements with the same elements in one step, so\n// nothing can disagree with them. From the second render on, elements stay.\nexport const mountShell = (\n root: HTMLElement,\n registry: ComponentRegistry<DomComponent>,\n shell: Shell,\n options: { fallback?: DomComponent } = {},\n): { destroy: () => void } => {\n const view = shellView(shell);\n const dom = createDomView(root, registry, view.api, options);\n dom.render();\n const stop = view.subscribe(dom.render);\n return {\n destroy: () => {\n stop();\n dom.destroy();\n },\n };\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/action/mutations/ops/set.ts","../src/action/mutations/ops/toggle.ts","../src/action/mutations/ops/increment.ts","../src/action/mutations/ops/decrement.ts","../src/action/mutations/ops/push.ts","../src/action/mutations/ops/pop.ts","../src/action/mutations/ops/remove-at.ts","../src/action/mutations/ops/move.ts","../src/action/mutations/ops/clear.ts","../src/action/mutations/ops/reset.ts","../src/action/mutations/ops/index.ts","../src/action/mutations/registry.ts","../src/action/schemas/endpoints.ts","../src/action/schemas/effects.ts","../src/action/schemas/lifecycle.ts","../src/action/schemas/triggers.ts","../src/action/schemas/index.ts"],"names":["z","next"],"mappings":";;;;;AAKO,IAAM,gBAAA,GAAmB,EAC7B,MAAA,CAAO;AAAA,EACN,GAAA,EAAK,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,6DAA6D,CAAA;AAAA,EACtF,KAAA,EAAO,CAAA,CAAE,OAAA,EAAQ,CAAE,SAAS,qCAAqC;AACnE,CAAC,CAAA,CACA,MAAA,EAAO,CACP,QAAA,CAAS,2CAA2C,CAAA;AAIhD,IAAM,eAAA,GAAkB,EAC5B,MAAA,CAAO;AAAA,EACN,GAAA,EAAK,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,wBAAwB,CAAA;AAAA,EACjD,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,sDAAsD;AAClF,CAAC,CAAA,CACA,MAAA,EAAO,CACP,QAAA,CAAS,qDAAqD,CAAA;AAI1D,IAAM,UAAA,GAA6C;AAAA,EACxD,GAAA,EAAK,KAAA;AAAA,EACL,MAAA,EAAQ,gBAAA;AAAA,EACR,KAAA,EAAO,CAAC,QAAA,KAAa,MAAA,CAAO,UAAU,KAAK,CAAA,IAAK,MAAA,CAAO,QAAA,EAAU,OAAO,CAAA;AAAA,EACxE,KAAA,EAAO,CAAC,IAAA,EAAM,QAAA,KAAa;AACzB,IAAA,MAAM,OAAO,OAAA,CAAQ,IAAA,EAAM,QAAA,CAAS,GAAA,EAAK,SAAS,KAAK,CAAA;AACvD,IAAA,OAAO,QAAA,CAAS,IAAI,CAAA,GAAI,IAAA,GAAO,IAAA;AAAA,EACjC;AACF,CAAA;AAEO,IAAM,SAAA,GAA2C;AAAA,EACtD,GAAA,EAAK,KAAA;AAAA,EACL,MAAA,EAAQ,eAAA;AAAA,EACR,KAAA,EA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mF,CAAA;AAAA,EAC/I,QAAA,EAAUA,EAAE,KAAA,CAAM,mBAAmB,EAAE,QAAA,EAAS,CAAE,SAAS,8FAAgG,CAAA;AAAA,EAC3J,SAAA,EAAWA,CAAAA,CACR,MAAA,CAAOA,CAAAA,CAAE,MAAA,EAAO,EAAG,oBAAoB,CAAA,CACvC,QAAA,EAAS,CACT,QAAA,CAAS,6EAA6E,CAAA;AAAA,EACzF,SAAA,EAAW,qBAAA,CAAsB,QAAA,EAAS,CAAE,SAAS,0DAA2D;AAClH,CAAC,CAAA,CACA,MAAA,EAAO,CACP,QAAA,CAAS,yKAA+J","file":"chunk-GVBBL36G.js","sourcesContent":["import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { hasKey, isObject } from '@shared/common';\nimport type { MutationOp } from '../types';\n\nexport const SetByValueSchema = z\n .object({\n set: z.string().describe('Data path to write to, e.g. \"user.name\" or \"items.0.title\".'),\n value: z.unknown().describe('Literal value to write at the path.'),\n })\n .strict()\n .describe('Set a field at a path to a literal value.');\n\nexport type SetByValueMutation = z.infer<typeof SetByValueSchema>;\n\nexport const SetByFromSchema = z\n .object({\n set: z.string().describe('Data path to write to.'),\n from: z.string().describe('Data path (or template path) to read the value from.'),\n })\n .strict()\n .describe('Set a field at a path by copying from another path.');\n\nexport type SetByFromMutation = z.infer<typeof SetByFromSchema>;\n\nexport const setValueOp: MutationOp<SetByValueMutation> = {\n key: 'set',\n schema: SetByValueSchema,\n match: (mutation) => hasKey(mutation, 'set') && hasKey(mutation, 'value'),\n apply: (data, mutation) => {\n const next = setPath(data, mutation.set, mutation.value);\n return isObject(next) ? next : data;\n },\n};\n\nexport const setFromOp: MutationOp<SetByFromMutation> = {\n key: 'set',\n schema: SetByFromSchema,\n match: (mutation) => hasKey(mutation, 'set') && hasKey(mutation, 'from'),\n apply: (data, mutation) => {\n const value = getPath(data, mutation.from);\n const next = setPath(data, mutation.set, value);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { isObject } from '@shared/common';\nimport type { MutationOp } from '../types';\n\nexport const ToggleSchema = z\n .object({\n toggle: z.string().describe('Boolean data path to flip.'),\n })\n .strict()\n .describe('Flip a boolean at the given path.');\n\nexport type ToggleMutation = z.infer<typeof ToggleSchema>;\n\nexport const toggleOp: MutationOp<ToggleMutation> = {\n key: 'toggle',\n schema: ToggleSchema,\n apply: (data, mutation) => {\n const current = getPath(data, mutation.toggle);\n const flipped = !(current === true);\n const next = setPath(data, mutation.toggle, flipped);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { isObject } from '@shared/common';\nimport type { MutationOp } from '../types';\n\nexport const IncrementSchema = z\n .object({\n increment: z.string().describe('Numeric data path to increment.'),\n by: z.number().optional().describe('Amount to increment by; defaults to 1.'),\n })\n .strict()\n .describe('Increment a numeric field.');\n\nexport type IncrementMutation = z.infer<typeof IncrementSchema>;\n\nexport const incrementOp: MutationOp<IncrementMutation> = {\n key: 'increment',\n schema: IncrementSchema,\n apply: (data, mutation) => {\n const current = getPath(data, mutation.increment);\n const base = typeof current === 'number' ? current : 0;\n const by = mutation.by ?? 1;\n const next = setPath(data, mutation.increment, base + by);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { isObject } from '@shared/common';\nimport type { MutationOp } from '../types';\n\nexport const DecrementSchema = z\n .object({\n decrement: z.string().describe('Numeric data path to decrement.'),\n by: z.number().optional().describe('Amount to decrement by; defaults to 1.'),\n })\n .strict()\n .describe('Decrement a numeric field.');\n\nexport type DecrementMutation = z.infer<typeof DecrementSchema>;\n\nexport const decrementOp: MutationOp<DecrementMutation> = {\n key: 'decrement',\n schema: DecrementSchema,\n apply: (data, mutation) => {\n const current = getPath(data, mutation.decrement);\n const base = typeof current === 'number' ? current : 0;\n const by = mutation.by ?? 1;\n const next = setPath(data, mutation.decrement, base - by);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { isArray, isObject } from '@shared/common';\nimport { MutationError } from '@shared/errors';\nimport type { MutationOp } from '../types';\n\nexport const PushSchema = z\n .object({\n push: z.string().describe('Array data path to append to.'),\n value: z.unknown().optional().describe('Value to append.'),\n })\n .strict()\n .describe('Append a value to an array field.');\n\nexport type PushMutation = z.infer<typeof PushSchema>;\n\nexport const pushOp: MutationOp<PushMutation> = {\n key: 'push',\n schema: PushSchema,\n // Guard against the PushEffect navigation effect whose `push` is an object.\n match: (mutation) => typeof mutation.push === 'string',\n apply: (data, mutation, ctx) => {\n const current = getPath(data, mutation.push);\n // push tolerates missing paths by creating a new array (lax mode only).\n if (current !== undefined && !isArray(current)) {\n if (ctx.strict) {\n throw new MutationError(\n `push: path \"${mutation.push}\" is not an array`,\n { op: 'push', path: mutation.push, reason: 'wrong-type' },\n );\n }\n return data;\n }\n if (current === undefined && ctx.strict) {\n throw new MutationError(\n `push: path \"${mutation.push}\" does not exist`,\n { op: 'push', path: mutation.push, reason: 'missing' },\n );\n }\n const arr = isArray(current) ? current.slice() : [];\n arr.push(mutation.value);\n const next = setPath(data, mutation.push, arr);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { isArray, isObject } from '@shared/common';\nimport { MutationError } from '@shared/errors';\nimport type { MutationOp } from '../types';\n\nexport const PopSchema = z\n .object({\n pop: z.string().describe('Array data path to remove the last element from.'),\n })\n .strict()\n .describe('Remove the last element from an array field.');\n\nexport type PopMutation = z.infer<typeof PopSchema>;\n\nexport const popOp: MutationOp<PopMutation> = {\n key: 'pop',\n schema: PopSchema,\n // Guard against the PopEffect whose `pop` is the literal `true`.\n match: (mutation) => typeof mutation.pop === 'string',\n apply: (data, mutation, ctx) => {\n const current = getPath(data, mutation.pop);\n if (!isArray(current)) {\n if (ctx.strict) {\n throw new MutationError(\n `pop: path \"${mutation.pop}\" ${current === undefined ? 'does not exist' : 'is not an array'}`,\n { op: 'pop', path: mutation.pop, reason: current === undefined ? 'missing' : 'wrong-type' },\n );\n }\n return data;\n }\n const arr = current.slice();\n arr.pop();\n const next = setPath(data, mutation.pop, arr);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { isArray, isObject } from '@shared/common';\nimport { MutationError } from '@shared/errors';\nimport type { MutationOp } from '../types';\n\nexport const RemoveAtSchema = z\n .object({\n removeAt: z.string().describe('Array data path to remove an element from.'),\n index: z\n .union([z.number().int(), z.string()])\n .describe('Index to remove. A string is a template (e.g. \"{{@event.payload}}\") resolved before applying.'),\n })\n .strict()\n .describe('Remove an element at a specific index of an array field.');\n\nexport type RemoveAtMutation = z.infer<typeof RemoveAtSchema>;\n\nexport const removeAtOp: MutationOp<RemoveAtMutation> = {\n key: 'removeAt',\n schema: RemoveAtSchema,\n apply: (data, mutation, ctx) => {\n const current = getPath(data, mutation.removeAt);\n if (!isArray(current)) {\n if (ctx.strict) {\n throw new MutationError(\n `removeAt: path \"${mutation.removeAt}\" ${current === undefined ? 'does not exist' : 'is not an array'}`,\n {\n op: 'removeAt',\n path: mutation.removeAt,\n reason: current === undefined ? 'missing' : 'wrong-type',\n },\n );\n }\n return data;\n }\n // Index may be a literal number or a resolved template; coerce and guard.\n const index = Number(mutation.index);\n if (!Number.isInteger(index)) return data;\n const arr = current.slice();\n arr.splice(index, 1);\n const next = setPath(data, mutation.removeAt, arr);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { isArray, isObject } from '@shared/common';\nimport { MutationError } from '@shared/errors';\nimport type { MutationOp } from '../types';\n\nexport const MoveSchema = z\n .object({\n move: z.string().describe('Array data path to reorder within.'),\n from: z\n .union([z.number().int(), z.string()])\n .describe('Index to move. A string is a template (e.g. \"{{@event.payload}}\") resolved before applying.'),\n to: z\n .union([z.number().int(), z.string()])\n .describe('Destination index. A string is a template resolved before applying.'),\n })\n .strict()\n .describe('Move an array element from one index to another.');\n\nexport type MoveMutation = z.infer<typeof MoveSchema>;\n\nexport const moveOp: MutationOp<MoveMutation> = {\n key: 'move',\n schema: MoveSchema,\n apply: (data, mutation, ctx) => {\n const current = getPath(data, mutation.move);\n if (!isArray(current)) {\n if (ctx.strict) {\n throw new MutationError(\n `move: path \"${mutation.move}\" ${current === undefined ? 'does not exist' : 'is not an array'}`,\n {\n op: 'move',\n path: mutation.move,\n reason: current === undefined ? 'missing' : 'wrong-type',\n },\n );\n }\n return data;\n }\n // from/to may be literal numbers or resolved templates; coerce and guard.\n const from = Number(mutation.from);\n const to = Number(mutation.to);\n if (!Number.isInteger(from) || !Number.isInteger(to)) return data;\n if (from < 0 || from >= current.length) return data;\n const arr = current.slice();\n const [item] = arr.splice(from, 1);\n arr.splice(Math.max(0, Math.min(to, arr.length)), 0, item);\n const next = setPath(data, mutation.move, arr);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { deletePath, getPath, setPath } from '@shared/bindings/paths';\nimport { isArray, isObject } from '@shared/common';\nimport { MutationError } from '@shared/errors';\nimport type { MutationOp } from '../types';\n\nexport const ClearSchema = z\n .object({\n clear: z.string().describe('Array or object data path to clear.'),\n })\n .strict()\n .describe('Clear an array or object field.');\n\nexport type ClearMutation = z.infer<typeof ClearSchema>;\n\nexport const clearOp: MutationOp<ClearMutation> = {\n key: 'clear',\n schema: ClearSchema,\n apply: (data, mutation, ctx) => {\n const current = getPath(data, mutation.clear);\n if (isArray(current)) {\n const next = setPath(data, mutation.clear, []);\n return isObject(next) ? next : data;\n }\n if (isObject(current)) {\n const next = setPath(data, mutation.clear, {});\n return isObject(next) ? next : data;\n }\n if (ctx.strict) {\n throw new MutationError(\n `clear: path \"${mutation.clear}\" ${current === undefined ? 'does not exist' : 'is not an array or object'}`,\n {\n op: 'clear',\n path: mutation.clear,\n reason: current === undefined ? 'missing' : 'wrong-type',\n },\n );\n }\n const next = deletePath(data, mutation.clear);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { getPath, setPath } from '@shared/bindings/paths';\nimport { isObject } from '@shared/common';\nimport type { MutationOp } from '../types';\n\nexport const ResetSchema = z\n .object({\n reset: z.string().describe('Data path to reset to its initial (definition.data) value.'),\n })\n .strict()\n .describe('Reset a field to its initial value from the action definition.');\n\nexport type ResetMutation = z.infer<typeof ResetSchema>;\n\nexport const resetOp: MutationOp<ResetMutation> = {\n key: 'reset',\n schema: ResetSchema,\n apply: (data, mutation, ctx) => {\n const initialValue = getPath(ctx.initial, mutation.reset);\n const next = setPath(data, mutation.reset, initialValue);\n return isObject(next) ? next : data;\n },\n};\n","import { z } from 'zod';\nimport { setValueOp, setFromOp } from './set';\nimport { toggleOp } from './toggle';\nimport { incrementOp } from './increment';\nimport { decrementOp } from './decrement';\nimport { pushOp } from './push';\nimport { popOp } from './pop';\nimport { removeAtOp } from './remove-at';\nimport { moveOp } from './move';\nimport { clearOp } from './clear';\nimport { resetOp } from './reset';\nimport type { MutationOp } from '../types';\n\n// The single source of truth for mutation operations. The validation schema,\n// the `Mutation` type, and the runtime dispatch table (see registry.ts) are\n// all derived from this one list — adding an op is a one-line change here.\nexport const OPS = [\n setValueOp,\n setFromOp,\n toggleOp,\n incrementOp,\n decrementOp,\n pushOp,\n popOp,\n removeAtOp,\n moveOp,\n clearOp,\n resetOp,\n] as const;\n\n// Precise mutation type, distributed from each op's own mutation shape.\ntype MutationOf<O> = O extends MutationOp<infer T> ? T : never;\nexport type Mutation = MutationOf<(typeof OPS)[number]>;\n\n// Runtime validator, derived from the ops: a mutation is any one of their\n// schemas. The cast widens each op's schema to `z.ZodType<Mutation>` (sound —\n// every op's mutation is a Mutation) so the union's output type is `Mutation`.\nexport const MutationSchema = z\n .union(\n OPS.map((op) => op.schema) as [z.ZodType<Mutation>, z.ZodType<Mutation>, ...z.ZodType<Mutation>[]],\n )\n .describe('A single immutable mutation applied to the action data.');\n","import { hasKey, isObject } from '@shared/common';\nimport { OPS, type Mutation } from './ops';\nimport type { MutationContext, MutationData, MutationOp } from './types';\n\n// ═══════════════════════════════════════════════════════════\n// Pure dispatch over the op list. Each op is generic over its own\n// mutation shape; `toDispatchOp` collapses that into a uniform handler\n// that runs the op's own schema parse before apply. The single `any` is\n// the deliberate type-erasure boundary where the heterogeneous ops meet\n// one dispatch table — each op's schema/apply stay type-checked at their\n// definition. The table is derived from OPS, so it can't drift from it.\n// ═══════════════════════════════════════════════════════════\n\ntype DispatchOp = {\n key: string;\n match: (mutation: Record<string, unknown>) => boolean;\n run: (data: MutationData, mutation: Record<string, unknown>, ctx: MutationContext) => MutationData;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- erasure boundary\nconst toDispatchOp = (op: MutationOp<any>): DispatchOp => ({\n key: op.key,\n match: op.match ?? ((mutation) => hasKey(mutation, op.key)),\n run: (data, mutation, ctx) => op.apply(data, op.schema.parse(mutation), ctx),\n});\n\nconst DISPATCH: readonly DispatchOp[] = OPS.map(toDispatchOp);\n\nconst findOp = (mutation: Record<string, unknown>): DispatchOp | undefined => {\n for (const op of DISPATCH) {\n if (op.match(mutation)) return op;\n }\n return undefined;\n};\n\nexport type ApplyMutationOptions = {\n /** Snapshot used by `reset`. Must be deep-cloned by the caller. */\n initial?: MutationData;\n /** Strict mode — array ops throw MutationError on missing/wrong-type paths. */\n strict?: boolean;\n};\n\nconst buildCtx = (opts: ApplyMutationOptions): MutationContext => ({\n initial: opts.initial ?? {},\n strict: opts.strict ?? false,\n});\n\nexport const applyMutation = (\n data: MutationData,\n mutation: Mutation,\n opts: ApplyMutationOptions = {},\n): MutationData => {\n if (!isObject(mutation)) return data;\n const op = findOp(mutation);\n if (op === undefined) return data;\n return op.run(data, mutation, buildCtx(opts));\n};\n\nexport const applyMutations = (\n data: MutationData,\n mutations: readonly Mutation[],\n opts: ApplyMutationOptions = {},\n): MutationData => {\n if (mutations.length === 0) return data;\n const ctx = buildCtx(opts);\n let current = data;\n for (const mutation of mutations) {\n if (!isObject(mutation)) continue;\n const op = findOp(mutation);\n if (op === undefined) continue;\n current = op.run(current, mutation, ctx);\n }\n return current;\n};\n","import { z } from 'zod';\n\nconst HttpEndpointSchema = z\n .object({\n url: z.string().describe('Template URL, e.g. \"/api/users/{{$.userId}}\".'),\n method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']).describe('HTTP method.'),\n headers: z.record(z.string(), z.string()).optional().describe('Static request headers.'),\n request: z\n .unknown()\n .optional()\n .describe(\n 'Transform config run by the injected evaluator over the ACTION DATA to build the ' +\n 'request body — EVALUATED ON EVERY CALL, so body values can follow screen state. ' +\n 'Static parts are literal JSON; a dynamic part is an evaluator op over the data root, ' +\n 'e.g. { \"q\": { \"$ref\": \"$.search\" } } makes body field q carry the current $.search each call. ' +\n 'Requires an injected transform.',\n ),\n response: z\n .unknown()\n .optional()\n .describe(\n 'Transform config run by the injected evaluator over the reply as received ' +\n '(`$` is the reply — object, array, or scalar) to produce the value stored at `target`. ' +\n 'Requires an injected transform.',\n ),\n target: z.string().optional().describe('Data path to store the result at on success.'),\n errorTarget: z.string().optional().describe('Data path to store the error at on failure.'),\n timeoutMs: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('How long to wait for the reply, in ms, before the call fails to onError. Defaults to the shell default (30000). Set it on an endpoint that is slow by nature — a model call that may take minutes.'),\n })\n .strict()\n .describe('A named HTTP call. `request`/`response` shape the body/reply via the injected transform.');\n\nconst FunctionEndpointSchema = z\n .object({\n fn: z\n .string()\n .describe(\n 'Key of a function registered in `ShellConfig.functions`. The host must ' +\n 'register the name before the action runs.',\n ),\n target: z.string().optional().describe('Data path to store the return value at on success.'),\n errorTarget: z.string().optional().describe('Data path to store the error at on failure.'),\n timeoutMs: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('How long to wait for the reply, in ms, before the call fails to onError. Defaults to the shell default (30000). Set it on an endpoint that is slow by nature — a model call that may take minutes.'),\n })\n .strict()\n .describe('A named local function call. Handler is provided via `ShellConfig.functions`.');\n\nexport const EndpointConfigSchema = z\n .union([HttpEndpointSchema, FunctionEndpointSchema])\n .describe('An endpoint — either an HTTP call or a local function.');\n\nexport type EndpointConfig = z.infer<typeof EndpointConfigSchema>;\nexport type HttpEndpointConfig = z.infer<typeof HttpEndpointSchema>;\nexport type FunctionEndpointConfig = z.infer<typeof FunctionEndpointSchema>;\n","import { z } from 'zod';\nimport { MutationSchema } from '../mutations';\nimport type { Mutation } from '../mutations';\n\n// ═══════════════════════════════════════════════════════════\n// Effects + Steps (recursive union of Mutation | Effect)\n// ═══════════════════════════════════════════════════════════\n\nexport type Step = Mutation | Effect;\n\nexport type CallEffect = {\n call: string;\n onSuccess?: Step[];\n onError?: Step[];\n};\n\nexport type EmitEffect = {\n emit: { channel: string; payload?: unknown };\n};\n\nexport type PushEffect = {\n push: { action: string; canvas?: string; input?: Record<string, unknown>; with?: string[] };\n};\n\nexport type PopEffect = { pop: true };\n\nexport type ReplaceEffect = {\n replace: { action: string; canvas?: string; input?: Record<string, unknown>; with?: string[] };\n};\n\n// Pop a canvas down to a given instance (everything above it is popped). The\n// stack-nav breadcrumb fires this with the target crumb's instance id.\nexport type PopToEffect = { popTo: { canvas?: string; instance: string } };\n\n// Reset a canvas to a single root action (clear the whole stack, then push). The\n// screen-level nav (sidebar) fires this so drilling into a record doesn't leave\n// a stale stack beneath the new screen.\nexport type ResetToEffect = {\n resetTo: { action: string; canvas?: string; input?: Record<string, unknown>; with?: string[] };\n};\n\n// Remove ONE instance anywhere in a canvas's stack (not just the top). On a\n// list-mode canvas — where every card is live and visible at once — this is how\n// a card's own close button dismisses itself. `pop` removes the top; this\n// removes a named one.\nexport type RemoveInstanceEffect = { removeInstance: { canvas?: string; instance: string } };\n\n// Sugar for `removeInstance` aimed at the firing instance itself: a card's X\n// says \"close me\" without knowing its own id. The runtime desugars it to\n// `removeInstance` with the instance's real id before it escapes.\nexport type RemoveSelfEffect = { removeSelf: true };\n\n// Make a canvas EQUAL a list read from the action's data — the declarative\n// verb (shell/reconcile.ts) as a step. Every other navigation step moves ONE\n// action; a surface whose actions come from rows (a set of tools, a set of\n// cards) has as many as the rows say, and a fixed list of steps cannot.\n// Missing actions are pushed, ones no longer listed are removed, ones already\n// there stay mounted. A row naming an action this shell does not have (not\n// granted) is skipped, as an ungranted `initial` candidate is.\nexport type ReconcileEffect = {\n reconcile: { to: string; action: string; input?: string; canvas?: string; own?: 'pushed' | 'canvas'; with?: string[] };\n};\nexport type ReloadEffect = { reload: true };\n\nexport type Effect =\n | CallEffect\n | EmitEffect\n | PushEffect\n | PopEffect\n | ReplaceEffect\n | PopToEffect\n | ResetToEffect\n | RemoveInstanceEffect\n | RemoveSelfEffect\n | ReconcileEffect\n | ReloadEffect;\n\nexport const StepSchema: z.ZodType<Step> = z.lazy(() =>\n z.union([MutationSchema, EffectSchema]).describe('A step is either a mutation or an effect.'),\n);\n\nconst CallEffectSchema: z.ZodType<CallEffect> = z.lazy(() =>\n z\n .object({\n call: z.string().describe('Name of the endpoint to invoke.'),\n onSuccess: z.array(StepSchema).optional().describe('Steps to run after a successful response.'),\n onError: z\n .array(StepSchema)\n .optional()\n .describe('Steps to run after an error response (with @error scope available).'),\n })\n .strict()\n .describe('Invoke a named endpoint with optional success/error step branches.'),\n);\n\nconst EmitEffectSchema = z\n .object({\n emit: z\n .object({\n channel: z.string().describe('Channel name to publish on.'),\n payload: z\n .unknown()\n .optional()\n .describe('Payload to publish; templates are resolved against the current data.'),\n })\n .strict()\n .describe('Channel + payload to publish.'),\n })\n .strict()\n .describe('Publish a payload to a message channel.');\n\nconst PushEffectSchema = z\n .object({\n push: z\n .object({\n action: z\n .string()\n .describe('Definition id of the action to push onto a canvas — MUST be an id that actually exists (an unknown id fails at click time, invisible to a mount check).'),\n canvas: z.string().optional().describe('Canvas id to push onto; defaults to the current canvas.'),\n input: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Initial input merged into the new action data. Keys must belong to the target action\\'s declared input contract — invented keys are silently useless.'),\n with: z\n .array(z.string())\n .optional()\n .describe('Fragment ids to compose the action with before it is instantiated. Each wraps the action (the action fills its `{ slot }`) and contributes its triggers/data; the action wins on conflict. See ActionFragment.'),\n })\n .strict()\n .describe('Push parameters.'),\n })\n .strict()\n .describe('Push a new action onto a canvas (escapes via onNavigate callback).');\n\nconst PopEffectSchema = z\n .object({\n pop: z.literal(true).describe('Sentinel literal — must be true.'),\n })\n .strict()\n .describe('Pop the current action (escapes via onNavigate callback).');\n\nconst ReplaceEffectSchema = z\n .object({\n replace: z\n .object({\n action: z.string().describe('Definition id of the replacement action.'),\n canvas: z\n .string()\n .optional()\n .describe('Canvas id to replace on; defaults to the current canvas.'),\n input: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Initial input merged into the new action data.'),\n with: z\n .array(z.string())\n .optional()\n .describe('Fragment ids to compose the action with before it is instantiated. Each wraps the action (the action fills its `{ slot }`) and contributes its triggers/data; the action wins on conflict. See ActionFragment.'),\n })\n .strict()\n .describe('Replace parameters.'),\n })\n .strict()\n .describe('Replace the current action (escapes via onNavigate callback).');\n\nconst PopToEffectSchema = z\n .object({\n popTo: z\n .object({\n canvas: z.string().optional().describe('Canvas id to pop on; defaults to the current canvas.'),\n instance: z.string().describe('Pop the canvas until this instance id is on top (no-op if absent).'),\n })\n .strict()\n .describe('Pop-to-instance parameters.'),\n })\n .strict()\n .describe('Pop a canvas down to a given instance (escapes via onNavigate callback).');\n\nconst ResetToEffectSchema = z\n .object({\n resetTo: z\n .object({\n action: z.string().describe('Definition id of the new root action.'),\n canvas: z.string().optional().describe('Canvas id to reset; defaults to the current canvas.'),\n input: z.record(z.string(), z.unknown()).optional().describe('Initial input merged into the new root action.'),\n with: z.array(z.string()).optional().describe('Fragment ids to compose the action with. See ActionFragment.'),\n })\n .strict()\n .describe('Reset parameters.'),\n })\n .strict()\n .describe('Clear a canvas and push a single new root action (escapes via onNavigate callback).');\n\nconst RemoveInstanceEffectSchema = z\n .object({\n removeInstance: z\n .object({\n canvas: z.string().optional().describe('Canvas id to remove from; defaults to the current canvas.'),\n instance: z.string().describe('Instance id to unmount and drop from the stack (no-op if absent).'),\n })\n .strict()\n .describe('Remove-instance parameters.'),\n })\n .strict()\n .describe('Remove one instance anywhere in a canvas stack (escapes via onNavigate callback).');\n\nconst RemoveSelfEffectSchema = z\n .object({\n removeSelf: z.literal(true).describe('Sentinel literal — must be true. Removes the firing instance (desugars to removeInstance).'),\n })\n .strict()\n .describe('Close the firing instance — the list-card X (escapes via onNavigate callback).');\n\nconst ReconcileEffectSchema = z\n .object({\n reconcile: z\n .object({\n to: z.string().describe('Binding to the desired list, e.g. \"$.tools\" — an array of rows; anything else is an empty list.'),\n action: z.string().describe('The row field naming the action to place, e.g. \"tool_id\". Rows without it are skipped.'),\n input: z.string().optional().describe('The row field holding that action\\'s input (an object), if any.'),\n canvas: z.string().optional().describe('Canvas id to reconcile; defaults to the current canvas.'),\n own: z\n .enum(['pushed', 'canvas'])\n .optional()\n .describe('What this step may remove: \"pushed\" (default) only what this action placed there; \"canvas\" everything on it — for an action that owns the canvas outright.'),\n with: z.array(z.string()).optional().describe('Fragment ids to compose each placed action with. See ActionFragment.'),\n })\n .strict()\n .describe('Reconcile parameters.'),\n })\n .strict()\n .describe('Make a canvas hold exactly the actions a list names: push the missing, remove the unlisted, keep the rest mounted (escapes via onNavigate callback).');\n\n// Re-run the firing instance's `mount` hook — the action re-reads whatever it\n// reads, in place, keeping its identity and its data.\n//\n// The gap this fills: a stacked canvas suspends what it covers and `resume`\n// already re-runs mount, so a revealed action is never stale. A LIST canvas\n// suspends nothing — every card stays active — so a card that loaded at seed\n// time and is opened an hour later would show the hour-old answer. `reload` is\n// what \"opening it\" means there.\nconst ReloadEffectSchema = z\n .object({\n reload: z.literal(true).describe('Sentinel literal — must be true. Re-runs this instance\\'s mount hook.'),\n })\n .strict()\n .describe('Re-read the firing instance in place — the list-card open.');\n\nexport const EffectSchema: z.ZodType<Effect> = z.lazy(() =>\n z\n .union([CallEffectSchema, EmitEffectSchema, PushEffectSchema, PopEffectSchema, ReplaceEffectSchema, PopToEffectSchema, ResetToEffectSchema, RemoveInstanceEffectSchema, RemoveSelfEffectSchema, ReconcileEffectSchema, ReloadEffectSchema])\n .describe('An effect that touches the outside world.'),\n);\n","import { z } from 'zod';\nimport { StepSchema } from './effects';\n\nexport const LifecycleConfigSchema = z\n .object({\n mount: z.array(StepSchema).optional().describe('Steps to run when the action mounts.'),\n unmount: z.array(StepSchema).optional().describe('Steps to run when the action unmounts.'),\n suspend: z.array(StepSchema).optional().describe('Steps to run when the action is suspended.'),\n resume: z.array(StepSchema).optional().describe('Steps to run when the action resumes.'),\n })\n .strict()\n .describe('Lifecycle hooks for the action runtime state machine.');\n\nexport type LifecycleConfig = z.infer<typeof LifecycleConfigSchema>;\n","import { z } from 'zod';\nimport { StepSchema } from './effects';\n\nexport const TriggerConfigSchema = z\n .object({\n event: z\n .string()\n .optional()\n .describe('UI event type to listen for: \"ui:click\" (activations, incl. table rows), \"ui:model\" (an input\\'s value changed), \"ui:key\".'),\n message: z.string().optional().describe('Message bus channel name to listen on (fired by an `emit` step, possibly from another action).'),\n ref: z\n .string()\n .optional()\n .describe('Component ref to filter events by — MUST match a `ref` carried by a node in this action\\'s layout; a trigger on a ref no layout node carries never fires.'),\n key: z.string().optional().describe('Key to filter \"ui:key\" events by, e.g. \"ArrowDown\".'),\n do: z\n .array(StepSchema)\n .describe('Ordered steps to execute when the trigger fires. Steps may reference the firing event as \"@event\" — \"@event.payload\" is the fired value (a table row click: the row\\'s clickKey/rowKey field; an input\\'s ui:model: the typed text).'),\n })\n .strict()\n .refine((trigger) => trigger.event !== undefined || trigger.message !== undefined, {\n message: 'A trigger must specify either \"event\" or \"message\".',\n })\n .describe('Binds an event or message source to an ordered sequence of steps.');\n\nexport type TriggerConfig = z.infer<typeof TriggerConfigSchema>;\n","import { z } from 'zod';\nimport { LayoutNodeSchema } from '@layout/schemas';\nimport { MutationSchema } from '../mutations';\nimport { EndpointConfigSchema } from './endpoints';\nimport { LifecycleConfigSchema } from './lifecycle';\nimport { TriggerConfigSchema } from './triggers';\n\n// ═══════════════════════════════════════════════════════════\n// Action Definition — composes all sibling schemas.\n// ═══════════════════════════════════════════════════════════\n\nexport const ActionDefinitionSchema = z\n .object({\n id: z.string().describe('Stable definition id.'),\n name: z.string().optional().describe('Human-readable name.'),\n description: z.string().optional().describe('Free-form description.'),\n title: z\n .string()\n .optional()\n .describe(\n \"A resolvable label for this instance, evaluated against its own data (e.g. '{{$.view.record.name}}'). Exposed as `instance.title` on a canvas's actionLayout scope so stack-nav chrome can label crumbs/tabs; falls back to `name` then the action id.\",\n ),\n layout: z\n .union([z.string(), LayoutNodeSchema])\n .optional()\n .describe('Either a layout id stored in the layout store, or an inline LayoutNode.'),\n data: z.record(z.string(), z.unknown()).optional().describe('Static default data merged with input on mount.'),\n input: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\n 'JSON Schema of the data keys an opener may seed when loading this action — its public, openable-input contract (author in Zod, convert with z.toJSONSchema). Fields must be a subset of `data`. Descriptive only: the runtime does not validate loads against it.',\n ),\n triggers: z.array(TriggerConfigSchema).optional().describe('Event/message triggers.'),\n endpoints: z\n .record(z.string(), EndpointConfigSchema)\n .optional()\n .describe('Named endpoints — HTTP calls or local functions.'),\n lifecycle: LifecycleConfigSchema.optional().describe('Lifecycle hooks.'),\n })\n .strict()\n .describe('Definition of an action: layout + data + behavior.');\n\nexport type ActionDefinition = z.infer<typeof ActionDefinitionSchema>;\n\n// ═══════════════════════════════════════════════════════════\n// Action Fragment — a reusable PARTIAL action (every field optional) that is\n// MERGED into a concrete action at a push/replace `with`, producing the\n// effective ActionDefinition that gets instantiated. This is composition, not\n// inheritance: `Action + ActionFragment ⇒ Action`. A fragment is abstract — it\n// only exists merged, lives in its own registry, and cannot be pushed as an\n// action on its own. Its `layout` is the chrome that WRAPS the action; a\n// `{ slot: 'body' }` node in it is filled with the composing action's layout.\n// On merge: the action's layout fills the slot; data/endpoints deep-merge with\n// the action winning; triggers and per-hook lifecycle steps concatenate\n// (fragment first). See `composeAction`.\n// ═══════════════════════════════════════════════════════════\n\nexport const ActionFragmentSchema = z\n .object({\n kind: z.literal('fragment').describe('Discriminator — marks this as an abstract, merge-only fragment.'),\n id: z.string().describe('Stable fragment id, referenced from a push/replace `with: [...]`.'),\n name: z.string().optional().describe('Human-readable name.'),\n description: z.string().optional().describe('Free-form description.'),\n layout: z\n .union([z.string(), LayoutNodeSchema])\n .optional()\n .describe('The wrapping (chrome) layout, or a layout id. Put a `{ slot: \"body\" }` node where the composing action\\'s own layout is dropped in.'),\n data: z.record(z.string(), z.unknown()).optional().describe('Partial default data; deep-merged under the action (the action wins on conflict).'),\n triggers: z.array(TriggerConfigSchema).optional().describe('Pre-wired triggers (e.g. a modal\\'s close/cancel). Concatenated before the action\\'s triggers.'),\n endpoints: z\n .record(z.string(), EndpointConfigSchema)\n .optional()\n .describe('Named endpoints, merged under the action (the action wins on a name clash).'),\n lifecycle: LifecycleConfigSchema.optional().describe('Lifecycle hooks; per-hook steps run before the action\\'s.'),\n })\n .strict()\n .describe('A reusable partial action — layout + wired behavior — merged into a concrete action at a push `with`. Abstract: only exists merged, never instantiated alone.');\n\nexport type ActionFragment = z.infer<typeof ActionFragmentSchema>;\n\n// Re-export mutations schema (for backwards-compatible imports within action/)\nexport { MutationSchema };\nexport type { Mutation } from '../mutations';\n\n// Re-export sibling schemas + inferred types\nexport { EffectSchema, StepSchema } from './effects';\nexport type { Effect, Step, CallEffect, EmitEffect, PushEffect, PopEffect, ReplaceEffect, PopToEffect, ResetToEffect, RemoveInstanceEffect, RemoveSelfEffect, ReconcileEffect, ReloadEffect } from './effects';\nexport { TriggerConfigSchema } from './triggers';\nexport type { TriggerConfig } from './triggers';\nexport { EndpointConfigSchema } from './endpoints';\nexport type { EndpointConfig, HttpEndpointConfig, FunctionEndpointConfig } from './endpoints';\nexport { LifecycleConfigSchema } from './lifecycle';\nexport type { LifecycleConfig } from './lifecycle';\n"]}
|
package/dist/chunk-PF4OJTYU.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { isArray, isObject } from './chunk-RBU5PHN4.js';
|
|
2
|
-
|
|
3
|
-
// src/shared/errors.ts
|
|
4
|
-
var ErrorCodes = {
|
|
5
|
-
render: "RENDER_ERROR",
|
|
6
|
-
componentNotFound: "COMPONENT_NOT_FOUND",
|
|
7
|
-
layoutRefNotFound: "LAYOUT_REF_NOT_FOUND",
|
|
8
|
-
definitionValidation: "DEFINITION_VALIDATION_ERROR",
|
|
9
|
-
unknownAction: "UNKNOWN_ACTION",
|
|
10
|
-
unknownFragment: "UNKNOWN_FRAGMENT",
|
|
11
|
-
unknownFunction: "UNKNOWN_FUNCTION",
|
|
12
|
-
shellDisposed: "SHELL_DISPOSED",
|
|
13
|
-
lifecycle: "LIFECYCLE_ERROR",
|
|
14
|
-
mutation: "MUTATION_ERROR",
|
|
15
|
-
runaway: "RUNAWAY_CHAIN"
|
|
16
|
-
};
|
|
17
|
-
var NovaError = class extends Error {
|
|
18
|
-
code;
|
|
19
|
-
context;
|
|
20
|
-
constructor(code, message, context, options) {
|
|
21
|
-
super(message, options);
|
|
22
|
-
this.name = "NovaError";
|
|
23
|
-
this.code = code;
|
|
24
|
-
this.context = context;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var RenderError = class extends NovaError {
|
|
28
|
-
constructor(message, context, options) {
|
|
29
|
-
super(ErrorCodes.render, message, context, options);
|
|
30
|
-
this.name = "RenderError";
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var ComponentNotFoundError = class extends NovaError {
|
|
34
|
-
constructor(message, context, options) {
|
|
35
|
-
super(ErrorCodes.componentNotFound, message, context, options);
|
|
36
|
-
this.name = "ComponentNotFoundError";
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var LayoutRefNotFoundError = class extends NovaError {
|
|
40
|
-
constructor(message, context, options) {
|
|
41
|
-
super(ErrorCodes.layoutRefNotFound, message, context, options);
|
|
42
|
-
this.name = "LayoutRefNotFoundError";
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var DefinitionValidationError = class extends NovaError {
|
|
46
|
-
constructor(message, context, options) {
|
|
47
|
-
super(ErrorCodes.definitionValidation, message, context, options);
|
|
48
|
-
this.name = "DefinitionValidationError";
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var UnknownActionError = class extends NovaError {
|
|
52
|
-
constructor(message, context, options) {
|
|
53
|
-
super(ErrorCodes.unknownAction, message, context, options);
|
|
54
|
-
this.name = "UnknownActionError";
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var UnknownFragmentError = class extends NovaError {
|
|
58
|
-
constructor(message, context, options) {
|
|
59
|
-
super(ErrorCodes.unknownFragment, message, context, options);
|
|
60
|
-
this.name = "UnknownFragmentError";
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
var ShellDisposedError = class extends NovaError {
|
|
64
|
-
constructor(message, context, options) {
|
|
65
|
-
super(ErrorCodes.shellDisposed, message, context, options);
|
|
66
|
-
this.name = "ShellDisposedError";
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
var UnknownFunctionError = class extends NovaError {
|
|
70
|
-
constructor(name, options) {
|
|
71
|
-
super(
|
|
72
|
-
ErrorCodes.unknownFunction,
|
|
73
|
-
`Unknown function: "${name}". Is it registered in shell config's \`functions\` map?`,
|
|
74
|
-
{ name },
|
|
75
|
-
options
|
|
76
|
-
);
|
|
77
|
-
this.name = "UnknownFunctionError";
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
var LifecycleError = class extends NovaError {
|
|
81
|
-
constructor(message, context, options) {
|
|
82
|
-
super(ErrorCodes.lifecycle, message, context, options);
|
|
83
|
-
this.name = "LifecycleError";
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
var MutationError = class extends NovaError {
|
|
87
|
-
constructor(message, context, options) {
|
|
88
|
-
super(ErrorCodes.mutation, message, context, options);
|
|
89
|
-
this.name = "MutationError";
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// src/shared/bindings/paths.ts
|
|
94
|
-
var splitPath = (path) => {
|
|
95
|
-
if (path.length === 0) return [];
|
|
96
|
-
return path.split(".");
|
|
97
|
-
};
|
|
98
|
-
var isIndex = (segment) => /^\d+$/.test(segment);
|
|
99
|
-
var cloneContainer = (value, nextSegment) => {
|
|
100
|
-
if (isArray(value)) return value.slice();
|
|
101
|
-
if (isObject(value)) return { ...value };
|
|
102
|
-
if (nextSegment !== void 0 && isIndex(nextSegment)) return [];
|
|
103
|
-
return {};
|
|
104
|
-
};
|
|
105
|
-
var writeSegment = (container, segment, value) => {
|
|
106
|
-
if (isArray(container)) {
|
|
107
|
-
if (isIndex(segment)) {
|
|
108
|
-
const index = Number.parseInt(segment, 10);
|
|
109
|
-
container[index] = value;
|
|
110
|
-
}
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
container[segment] = value;
|
|
114
|
-
};
|
|
115
|
-
var readSegment = (container, segment) => {
|
|
116
|
-
if (isArray(container)) {
|
|
117
|
-
if (!isIndex(segment)) return void 0;
|
|
118
|
-
const index = Number.parseInt(segment, 10);
|
|
119
|
-
return container[index];
|
|
120
|
-
}
|
|
121
|
-
return container[segment];
|
|
122
|
-
};
|
|
123
|
-
var getPath = (data, path) => {
|
|
124
|
-
const segments = splitPath(path);
|
|
125
|
-
let current = data;
|
|
126
|
-
for (const segment of segments) {
|
|
127
|
-
if (current === void 0 || current === null) return void 0;
|
|
128
|
-
if (isArray(current)) {
|
|
129
|
-
if (isIndex(segment)) {
|
|
130
|
-
const index = Number.parseInt(segment, 10);
|
|
131
|
-
current = current[index];
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
if (segment === "length") {
|
|
135
|
-
current = current.length;
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
return void 0;
|
|
139
|
-
}
|
|
140
|
-
if (isObject(current)) {
|
|
141
|
-
if (segment in current) {
|
|
142
|
-
current = current[segment];
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
return void 0;
|
|
146
|
-
}
|
|
147
|
-
return void 0;
|
|
148
|
-
}
|
|
149
|
-
return current;
|
|
150
|
-
};
|
|
151
|
-
var setPath = (data, path, value) => {
|
|
152
|
-
const segments = splitPath(path);
|
|
153
|
-
if (segments.length === 0) return value;
|
|
154
|
-
const root = cloneContainer(data, segments[0]);
|
|
155
|
-
let parent = root;
|
|
156
|
-
for (let i = 0; i < segments.length - 1; i += 1) {
|
|
157
|
-
const segment = segments[i];
|
|
158
|
-
const nextSegment = segments[i + 1];
|
|
159
|
-
if (segment === void 0) continue;
|
|
160
|
-
const existing = readSegment(parent, segment);
|
|
161
|
-
const cloned = cloneContainer(existing, nextSegment);
|
|
162
|
-
writeSegment(parent, segment, cloned);
|
|
163
|
-
parent = cloned;
|
|
164
|
-
}
|
|
165
|
-
const last = segments[segments.length - 1];
|
|
166
|
-
if (last !== void 0) writeSegment(parent, last, value);
|
|
167
|
-
return root;
|
|
168
|
-
};
|
|
169
|
-
var deletePath = (data, path) => {
|
|
170
|
-
const segments = splitPath(path);
|
|
171
|
-
if (segments.length === 0) return void 0;
|
|
172
|
-
const root = cloneContainer(data, segments[0]);
|
|
173
|
-
let parent = root;
|
|
174
|
-
for (let i = 0; i < segments.length - 1; i += 1) {
|
|
175
|
-
const segment = segments[i];
|
|
176
|
-
const nextSegment = segments[i + 1];
|
|
177
|
-
if (segment === void 0) continue;
|
|
178
|
-
const existing = readSegment(parent, segment);
|
|
179
|
-
if (existing === void 0 || existing === null) return root;
|
|
180
|
-
const cloned = cloneContainer(existing, nextSegment);
|
|
181
|
-
writeSegment(parent, segment, cloned);
|
|
182
|
-
parent = cloned;
|
|
183
|
-
}
|
|
184
|
-
const last = segments[segments.length - 1];
|
|
185
|
-
if (last === void 0) return root;
|
|
186
|
-
if (isArray(parent)) {
|
|
187
|
-
if (isIndex(last)) {
|
|
188
|
-
const index = Number.parseInt(last, 10);
|
|
189
|
-
parent.splice(index, 1);
|
|
190
|
-
}
|
|
191
|
-
} else {
|
|
192
|
-
delete parent[last];
|
|
193
|
-
}
|
|
194
|
-
return root;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export { ComponentNotFoundError, DefinitionValidationError, ErrorCodes, LayoutRefNotFoundError, LifecycleError, MutationError, NovaError, RenderError, ShellDisposedError, UnknownActionError, UnknownFragmentError, UnknownFunctionError, deletePath, getPath, setPath };
|
|
198
|
-
//# sourceMappingURL=chunk-PF4OJTYU.js.map
|
|
199
|
-
//# sourceMappingURL=chunk-PF4OJTYU.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shared/errors.ts","../src/shared/bindings/paths.ts"],"names":[],"mappings":";;;AAMO,IAAM,UAAA,GAAa;AAAA,EACxB,MAAA,EAAQ,cAAA;AAAA,EACR,iBAAA,EAAmB,qBAAA;AAAA,EACnB,iBAAA,EAAmB,sBAAA;AAAA,EACnB,oBAAA,EAAsB,6BAAA;AAAA,EACtB,aAAA,EAAe,gBAAA;AAAA,EACf,eAAA,EAAiB,kBAAA;AAAA,EACjB,eAAA,EAAiB,kBAAA;AAAA,EACjB,aAAA,EAAe,gBAAA;AAAA,EACf,SAAA,EAAW,iBAAA;AAAA,EACX,QAAA,EAAU,gBAAA;AAAA,EACV,OAAA,EAAS;AACX;AAcO,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EAC1B,IAAA;AAAA,EACA,OAAA;AAAA,EAET,WAAA,CACE,IAAA,EACA,OAAA,EACA,OAAA,EACA,OAAA,EACA;AACA,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,IAAA,GAAO,WAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU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M,WAAA,GAAc,QAAA,CAAS,CAAA,GAAI,CAAC,CAAA;AAClC,IAAA,IAAI,YAAY,MAAA,EAAW;AAC3B,IAAA,MAAM,QAAA,GAAW,WAAA,CAAY,MAAA,EAAQ,OAAO,CAAA;AAC5C,IAAA,IAAI,QAAA,KAAa,MAAA,IAAa,QAAA,KAAa,IAAA,EAAM,OAAO,IAAA;AACxD,IAAA,MAAM,MAAA,GAAS,cAAA,CAAe,QAAA,EAAU,WAAW,CAAA;AACnD,IAAA,YAAA,CAAa,MAAA,EAAQ,SAAS,MAAM,CAAA;AACpC,IAAA,MAAA,GAAS,MAAA;AAAA,EACX;AAEA,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,QAAA,CAAS,MAAA,GAAS,CAAC,CAAA;AACzC,EAAA,IAAI,IAAA,KAAS,QAAW,OAAO,IAAA;AAC/B,EAAA,IAAI,OAAA,CAAQ,MAAM,CAAA,EAAG;AACnB,IAAA,IAAI,OAAA,CAAQ,IAAI,CAAA,EAAG;AACjB,MAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,QAAA,CAAS,IAAA,EAAM,EAAE,CAAA;AACtC,MAAA,MAAA,CAAO,MAAA,CAAO,OAAO,CAAC,CAAA;AAAA,IACxB;AAAA,EACF,CAAA,MAAO;AACL,IAAA,OAAO,OAAO,IAAI,CAAA;AAAA,EACpB;AACA,EAAA,OAAO,IAAA;AACT","file":"chunk-PF4OJTYU.js","sourcesContent":["import type { z } from 'zod';\n\n// ═══════════════════════════════════════════════════════════\n// Error codes\n// ═══════════════════════════════════════════════════════════\n\nexport const ErrorCodes = {\n render: 'RENDER_ERROR',\n componentNotFound: 'COMPONENT_NOT_FOUND',\n layoutRefNotFound: 'LAYOUT_REF_NOT_FOUND',\n definitionValidation: 'DEFINITION_VALIDATION_ERROR',\n unknownAction: 'UNKNOWN_ACTION',\n unknownFragment: 'UNKNOWN_FRAGMENT',\n unknownFunction: 'UNKNOWN_FUNCTION',\n shellDisposed: 'SHELL_DISPOSED',\n lifecycle: 'LIFECYCLE_ERROR',\n mutation: 'MUTATION_ERROR',\n runaway: 'RUNAWAY_CHAIN',\n} as const;\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\nexport type NovaErrorContext = Record<string, unknown>;\n\n// ═══════════════════════════════════════════════════════════\n// Base error — classes are permitted here because these are\n// the only thrown error types; identity + instanceof are needed.\n//\n// Subclasses are added when there is a real throw site. Do not\n// add dead exports.\n// ═══════════════════════════════════════════════════════════\n\nexport class NovaError extends Error {\n readonly code: ErrorCode;\n readonly context: NovaErrorContext | undefined;\n\n constructor(\n code: ErrorCode,\n message: string,\n context?: NovaErrorContext,\n options?: { cause?: unknown },\n ) {\n super(message, options);\n this.name = 'NovaError';\n this.code = code;\n this.context = context;\n }\n}\n\nexport class RenderError extends NovaError {\n constructor(message: string, context?: NovaErrorContext, options?: { cause?: unknown }) {\n super(ErrorCodes.render, message, context, options);\n this.name = 'RenderError';\n }\n}\n\nexport type ComponentNotFoundContext = NovaErrorContext & { name: string };\n\nexport class ComponentNotFoundError extends NovaError {\n constructor(\n message: string,\n context: ComponentNotFoundContext,\n options?: { cause?: unknown },\n ) {\n super(ErrorCodes.componentNotFound, message, context, options);\n this.name = 'ComponentNotFoundError';\n }\n}\n\nexport type LayoutRefNotFoundContext = NovaErrorContext & { ref: string };\n\nexport class LayoutRefNotFoundError extends NovaError {\n constructor(\n message: string,\n context: LayoutRefNotFoundContext,\n options?: { cause?: unknown },\n ) {\n super(ErrorCodes.layoutRefNotFound, message, context, options);\n this.name = 'LayoutRefNotFoundError';\n }\n}\n\nexport type DefinitionValidationFailure = {\n id: string;\n issues: z.core.$ZodIssue[];\n};\n\nexport type DefinitionValidationContext = NovaErrorContext & {\n failures: DefinitionValidationFailure[];\n};\n\nexport class DefinitionValidationError extends NovaError {\n constructor(\n message: string,\n context: DefinitionValidationContext,\n options?: { cause?: unknown },\n ) {\n super(ErrorCodes.definitionValidation, message, context, options);\n this.name = 'DefinitionValidationError';\n }\n}\n\nexport type UnknownActionContext = NovaErrorContext & { actionId: string };\n\nexport class UnknownActionError extends NovaError {\n constructor(\n message: string,\n context: UnknownActionContext,\n options?: { cause?: unknown },\n ) {\n super(ErrorCodes.unknownAction, message, context, options);\n this.name = 'UnknownActionError';\n }\n}\n\nexport type UnknownFragmentContext = NovaErrorContext & { fragmentId: string };\n\nexport class UnknownFragmentError extends NovaError {\n constructor(\n message: string,\n context: UnknownFragmentContext,\n options?: { cause?: unknown },\n ) {\n super(ErrorCodes.unknownFragment, message, context, options);\n this.name = 'UnknownFragmentError';\n }\n}\n\nexport class ShellDisposedError extends NovaError {\n constructor(message: string, context?: NovaErrorContext, options?: { cause?: unknown }) {\n super(ErrorCodes.shellDisposed, message, context, options);\n this.name = 'ShellDisposedError';\n }\n}\n\nexport type UnknownFunctionContext = NovaErrorContext & { name: string };\n\nexport class UnknownFunctionError extends NovaError {\n constructor(name: string, options?: { cause?: unknown }) {\n super(\n ErrorCodes.unknownFunction,\n `Unknown function: \"${name}\". Is it registered in shell config's \\`functions\\` map?`,\n { name },\n options,\n );\n this.name = 'UnknownFunctionError';\n }\n}\n\nexport type LifecycleHook = 'mount' | 'unmount' | 'suspend' | 'resume';\n\nexport type LifecycleErrorContext = NovaErrorContext & {\n hook?: LifecycleHook;\n instanceId?: string;\n};\n\nexport class LifecycleError extends NovaError {\n constructor(\n message: string,\n context?: LifecycleErrorContext,\n options?: { cause?: unknown },\n ) {\n super(ErrorCodes.lifecycle, message, context, options);\n this.name = 'LifecycleError';\n }\n}\n\nexport type MutationErrorContext = NovaErrorContext & {\n op: string;\n path: string;\n reason: 'missing' | 'wrong-type';\n};\n\nexport class MutationError extends NovaError {\n constructor(\n message: string,\n context: MutationErrorContext,\n options?: { cause?: unknown },\n ) {\n super(ErrorCodes.mutation, message, context, options);\n this.name = 'MutationError';\n }\n}\n","import { isArray, isObject } from '../common';\n\n// ═══════════════════════════════════════════════════════════\n// Path helpers — get/set/delete on nested data structures.\n// Dot paths: \"a.b.0.c\". Numeric segments are array indices\n// when the parent is an array.\n// ═══════════════════════════════════════════════════════════\n\nconst splitPath = (path: string): string[] => {\n if (path.length === 0) return [];\n return path.split('.');\n};\n\nconst isIndex = (segment: string): boolean => /^\\d+$/.test(segment);\n\ntype Container = Record<string, unknown> | unknown[];\n\nconst cloneContainer = (value: unknown, nextSegment: string | undefined): Container => {\n if (isArray(value)) return value.slice();\n if (isObject(value)) return { ...value };\n if (nextSegment !== undefined && isIndex(nextSegment)) return [];\n return {};\n};\n\nconst writeSegment = (container: Container, segment: string, value: unknown): void => {\n if (isArray(container)) {\n if (isIndex(segment)) {\n const index = Number.parseInt(segment, 10);\n container[index] = value;\n }\n return;\n }\n container[segment] = value;\n};\n\nconst readSegment = (container: Container, segment: string): unknown => {\n if (isArray(container)) {\n if (!isIndex(segment)) return undefined;\n const index = Number.parseInt(segment, 10);\n return container[index];\n }\n return container[segment];\n};\n\nexport const getPath = (data: unknown, path: string): unknown => {\n const segments = splitPath(path);\n let current: unknown = data;\n for (const segment of segments) {\n if (current === undefined || current === null) return undefined;\n if (isArray(current)) {\n if (isIndex(segment)) {\n const index = Number.parseInt(segment, 10);\n current = current[index];\n continue;\n }\n if (segment === 'length') {\n current = current.length;\n continue;\n }\n return undefined;\n }\n if (isObject(current)) {\n if (segment in current) {\n current = current[segment];\n continue;\n }\n return undefined;\n }\n return undefined;\n }\n return current;\n};\n\nexport const setPath = (data: unknown, path: string, value: unknown): unknown => {\n const segments = splitPath(path);\n if (segments.length === 0) return value;\n\n const root = cloneContainer(data, segments[0]);\n let parent: Container = root;\n\n for (let i = 0; i < segments.length - 1; i += 1) {\n const segment = segments[i];\n const nextSegment = segments[i + 1];\n if (segment === undefined) continue;\n const existing = readSegment(parent, segment);\n const cloned = cloneContainer(existing, nextSegment);\n writeSegment(parent, segment, cloned);\n parent = cloned;\n }\n\n const last = segments[segments.length - 1];\n if (last !== undefined) writeSegment(parent, last, value);\n return root;\n};\n\nexport const deletePath = (data: unknown, path: string): unknown => {\n const segments = splitPath(path);\n if (segments.length === 0) return undefined;\n\n const root = cloneContainer(data, segments[0]);\n let parent: Container = root;\n\n for (let i = 0; i < segments.length - 1; i += 1) {\n const segment = segments[i];\n const nextSegment = segments[i + 1];\n if (segment === undefined) continue;\n const existing = readSegment(parent, segment);\n if (existing === undefined || existing === null) return root;\n const cloned = cloneContainer(existing, nextSegment);\n writeSegment(parent, segment, cloned);\n parent = cloned;\n }\n\n const last = segments[segments.length - 1];\n if (last === undefined) return root;\n if (isArray(parent)) {\n if (isIndex(last)) {\n const index = Number.parseInt(last, 10);\n parent.splice(index, 1);\n }\n } else {\n delete parent[last];\n }\n return root;\n};\n"]}
|