@niscorp/nova 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ACTION_DOCS.md +552 -0
- package/ADAPTER.md +170 -0
- package/DESIGN.md +719 -0
- package/I18N_DOCS.md +224 -0
- package/LAYOUT_DOCS.md +505 -0
- package/LICENSE +202 -0
- package/REACT_DOCS.md +562 -0
- package/README.md +379 -0
- package/SHELL_DOCS.md +615 -0
- package/TERMINAL_DOCS.md +124 -0
- package/dist/adapters/dom/components/index.cjs +473 -0
- package/dist/adapters/dom/components/index.cjs.map +1 -0
- package/dist/adapters/dom/components/index.d.cts +48 -0
- package/dist/adapters/dom/components/index.d.ts +48 -0
- package/dist/adapters/dom/components/index.js +420 -0
- package/dist/adapters/dom/components/index.js.map +1 -0
- package/dist/adapters/dom/index.cjs +171 -0
- package/dist/adapters/dom/index.cjs.map +1 -0
- package/dist/adapters/dom/index.d.cts +29 -0
- package/dist/adapters/dom/index.d.ts +29 -0
- package/dist/adapters/dom/index.js +15 -0
- package/dist/adapters/dom/index.js.map +1 -0
- package/dist/adapters/dom/server.cjs +129 -0
- package/dist/adapters/dom/server.cjs.map +1 -0
- package/dist/adapters/dom/server.d.cts +15 -0
- package/dist/adapters/dom/server.d.ts +15 -0
- package/dist/adapters/dom/server.js +37 -0
- package/dist/adapters/dom/server.js.map +1 -0
- package/dist/adapters/ink/index.d.ts +75 -0
- package/dist/adapters/ink/index.js +472 -0
- package/dist/adapters/ink/index.js.map +1 -0
- package/dist/adapters/react/components/index.cjs +552 -0
- package/dist/adapters/react/components/index.cjs.map +1 -0
- package/dist/adapters/react/components/index.d.cts +30 -0
- package/dist/adapters/react/components/index.d.ts +30 -0
- package/dist/adapters/react/components/index.js +12 -0
- package/dist/adapters/react/components/index.js.map +1 -0
- package/dist/adapters/react/index.cjs +1526 -0
- package/dist/adapters/react/index.cjs.map +1 -0
- package/dist/adapters/react/index.d.cts +149 -0
- package/dist/adapters/react/index.d.ts +149 -0
- package/dist/adapters/react/index.js +12 -0
- package/dist/adapters/react/index.js.map +1 -0
- package/dist/adapters/tty/components/index.cjs +255 -0
- package/dist/adapters/tty/components/index.cjs.map +1 -0
- package/dist/adapters/tty/components/index.d.cts +40 -0
- package/dist/adapters/tty/components/index.d.ts +40 -0
- package/dist/adapters/tty/components/index.js +187 -0
- package/dist/adapters/tty/components/index.js.map +1 -0
- package/dist/adapters/tty/index.cjs +76 -0
- package/dist/adapters/tty/index.cjs.map +1 -0
- package/dist/adapters/tty/index.d.cts +47 -0
- package/dist/adapters/tty/index.d.ts +47 -0
- package/dist/adapters/tty/index.js +76 -0
- package/dist/adapters/tty/index.js.map +1 -0
- package/dist/adapters/vue/components/index.cjs +619 -0
- package/dist/adapters/vue/components/index.cjs.map +1 -0
- package/dist/adapters/vue/components/index.d.cts +224 -0
- package/dist/adapters/vue/components/index.d.ts +224 -0
- package/dist/adapters/vue/components/index.js +12 -0
- package/dist/adapters/vue/components/index.js.map +1 -0
- package/dist/adapters/vue/index.cjs +747 -0
- package/dist/adapters/vue/index.cjs.map +1 -0
- package/dist/adapters/vue/index.d.cts +98 -0
- package/dist/adapters/vue/index.d.ts +98 -0
- package/dist/adapters/vue/index.js +127 -0
- package/dist/adapters/vue/index.js.map +1 -0
- package/dist/agent/index.cjs +178 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +28 -0
- package/dist/agent/index.d.ts +28 -0
- package/dist/agent/index.js +30 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/chunk-2MNLEL45.js +47 -0
- package/dist/chunk-2MNLEL45.js.map +1 -0
- package/dist/chunk-3HGE3VWK.js +753 -0
- package/dist/chunk-3HGE3VWK.js.map +1 -0
- package/dist/chunk-4ZID7UX5.js +549 -0
- package/dist/chunk-4ZID7UX5.js.map +1 -0
- package/dist/chunk-7B3RDENH.js +1982 -0
- package/dist/chunk-7B3RDENH.js.map +1 -0
- package/dist/chunk-7S5BNPUS.js +54 -0
- package/dist/chunk-7S5BNPUS.js.map +1 -0
- package/dist/chunk-7TS3YVQR.js +114 -0
- package/dist/chunk-7TS3YVQR.js.map +1 -0
- package/dist/chunk-EG2RUXJN.js +266 -0
- package/dist/chunk-EG2RUXJN.js.map +1 -0
- package/dist/chunk-GVBBL36G.js +429 -0
- package/dist/chunk-GVBBL36G.js.map +1 -0
- package/dist/chunk-I5D2R5UA.js +753 -0
- package/dist/chunk-I5D2R5UA.js.map +1 -0
- package/dist/chunk-IGLCWXQ3.js +304 -0
- package/dist/chunk-IGLCWXQ3.js.map +1 -0
- package/dist/chunk-JI7ZRESP.js +64 -0
- package/dist/chunk-JI7ZRESP.js.map +1 -0
- package/dist/chunk-L5223LLX.js +31 -0
- package/dist/chunk-L5223LLX.js.map +1 -0
- package/dist/chunk-LA3BSEMX.js +1905 -0
- package/dist/chunk-LA3BSEMX.js.map +1 -0
- package/dist/chunk-OAMC6R6E.js +121 -0
- package/dist/chunk-OAMC6R6E.js.map +1 -0
- package/dist/chunk-OGD5CCMZ.js +62 -0
- package/dist/chunk-OGD5CCMZ.js.map +1 -0
- package/dist/chunk-PF4OJTYU.js +199 -0
- package/dist/chunk-PF4OJTYU.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-RBU5PHN4.js +8 -0
- package/dist/chunk-RBU5PHN4.js.map +1 -0
- package/dist/chunk-RQB4PRPV.js +285 -0
- package/dist/chunk-RQB4PRPV.js.map +1 -0
- package/dist/chunk-V32EVEVM.js +464 -0
- package/dist/chunk-V32EVEVM.js.map +1 -0
- package/dist/chunk-ZITHBBF3.js +85 -0
- package/dist/chunk-ZITHBBF3.js.map +1 -0
- package/dist/devtools/index.cjs +1088 -0
- package/dist/devtools/index.cjs.map +1 -0
- package/dist/devtools/index.d.cts +33 -0
- package/dist/devtools/index.d.ts +33 -0
- package/dist/devtools/index.js +399 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/effects-CndX9K7D.d.cts +123 -0
- package/dist/effects-CndX9K7D.d.ts +123 -0
- package/dist/endpoints-CD-6Jl-H.d.ts +36 -0
- package/dist/endpoints-Dem-EdRx.d.cts +36 -0
- package/dist/i18n/index.cjs +299 -0
- package/dist/i18n/index.cjs.map +1 -0
- package/dist/i18n/index.d.cts +28 -0
- package/dist/i18n/index.d.ts +28 -0
- package/dist/i18n/index.js +180 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index-CNfzSBe2.d.ts +93 -0
- package/dist/index-caZoXSwr.d.cts +93 -0
- package/dist/index.cjs +3723 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +144 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.cjs +635 -0
- package/dist/migrations/index.cjs.map +1 -0
- package/dist/migrations/index.d.cts +97 -0
- package/dist/migrations/index.d.ts +97 -0
- package/dist/migrations/index.js +50 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/palette-CP0wd3bE.d.ts +15 -0
- package/dist/palette-lm0bU9i5.d.cts +15 -0
- package/dist/primitive-props-BH_EJWIe.d.cts +100 -0
- package/dist/primitive-props-BH_EJWIe.d.ts +100 -0
- package/dist/primitive-props-CGoJvmcH.d.cts +100 -0
- package/dist/primitive-props-CGoJvmcH.d.ts +100 -0
- package/dist/reflect/index.cjs +998 -0
- package/dist/reflect/index.cjs.map +1 -0
- package/dist/reflect/index.d.cts +125 -0
- package/dist/reflect/index.d.ts +125 -0
- package/dist/reflect/index.js +13 -0
- package/dist/reflect/index.js.map +1 -0
- package/dist/schemas-DPdeFlCT.d.cts +38 -0
- package/dist/schemas-DPdeFlCT.d.ts +38 -0
- package/dist/schemas-pMyyuXV7.d.cts +47 -0
- package/dist/schemas-pMyyuXV7.d.ts +47 -0
- package/dist/types-Boh9ckdG.d.ts +194 -0
- package/dist/types-Brc7v_pS.d.ts +198 -0
- package/dist/types-ByNSwtUV.d.cts +20 -0
- package/dist/types-DdltMfw7.d.ts +20 -0
- package/dist/types-De0KpxfI.d.cts +198 -0
- package/dist/types-DhHL0twe.d.ts +20 -0
- package/dist/types-Dv6JLmgo.d.cts +194 -0
- package/dist/types-Q80YtOQt.d.cts +20 -0
- package/package.json +237 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/react/components/stack.tsx","../src/adapters/react/components/text.tsx","../src/adapters/react/context.ts","../src/adapters/react/provider.tsx","../src/adapters/react/error-marker.tsx","../src/adapters/react/render-node.tsx","../src/adapters/react/render-tree.tsx","../src/adapters/react/error-boundary.tsx","../src/adapters/react/hooks/use-shell.ts","../src/adapters/react/hooks/use-canvas-render-tree.ts","../src/adapters/react/hooks/use-shell-render-tree.ts","../src/adapters/react/nova.tsx","../src/adapters/react/hooks/use-shell-state.ts","../src/adapters/react/hooks/use-canvas.ts","../src/adapters/react/hooks/use-action-data.ts","../src/adapters/react/hooks/use-action-status.ts","../src/adapters/react/hooks/use-render-tree.ts","../src/adapters/react/hooks/use-nova-dispatch.ts","../src/adapters/react/hooks/use-nova-publish.ts","../src/adapters/react/hooks/use-nova-registry.ts","../src/adapters/react/hooks/use-slot-wrapper.ts","../src/adapters/react/components/input.tsx","../src/adapters/react/components/button.tsx","../src/adapters/react/components/box.tsx","../src/adapters/react/components/panel.tsx","../src/adapters/react/components/json-tree.tsx","../src/adapters/react/components/canvas-slot.tsx","../src/adapters/react/components/action-slot.tsx","../src/adapters/react/components/index.ts"],"names":["jsx","Component","createElement","Fragment","useContext","useRef","useCallback","useSyncExternalStore","useMemo","EMPTY","useState","jsxs"],"mappings":";;;;;;;AAUA,IAAM,SAAA,GAAY;AAAA,EAChB,KAAA,EAAO,YAAA;AAAA,EACP,MAAA,EAAQ,QAAA;AAAA,EACR,GAAA,EAAK,UAAA;AAAA,EACL,OAAA,EAAS;AACX,CAAA;AAEA,IAAM,WAAA,GAAc;AAAA,EAClB,KAAA,EAAO,YAAA;AAAA,EAC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Aa,MAAA;AAAA,MACvC,QAAQ,OAAA,EAAS,UAAA;AAAA,MAEhB,yBAAe,IAAA,CAAK,MAAA,mBACnBA,GAAAA,CAAC,kBAAkB,QAAA,EAAlB,EAA2B,KAAA,EAAO,MAAA,EACjC,0BAAAA,GAAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAO,IAAA,EAAM,GAC3B,CAAA,GACE;AAAA;AAAA,GACN;AAEJ;AAEA,UAAA,CAAW,IAAA,GAAO;AAAA,EAChB,WAAA,EAAa,sEAAA;AAAA,EACb,WAAA,EAAa;AACf,CAAA;;;ACvBO,IAAM,2BAAA,GAA8B,CACzC,QAAA,KACS;AACT,EAAA,QAAA,CAAS,WAAA,CAAY;AAAA,IACnB,KAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH","file":"chunk-I5D2R5UA.js","sourcesContent":["import type { CSSProperties } from 'react';\nimport { StackPropsSchema, type StackProps } from '../../primitive-props';\nimport type { NovaComponent, NovaComponentProps } from '@react';\n\n// ═══════════════════════════════════════════════════════════\n// Stack — flex container\n// ═══════════════════════════════════════════════════════════\n\nexport { StackPropsSchema, type StackProps };\n\nconst ALIGN_MAP = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n stretch: 'stretch',\n} as const;\n\nconst JUSTIFY_MAP = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n between: 'space-between',\n around: 'space-around',\n} as const;\n\nexport const Stack: NovaComponent<StackProps> = ({\n direction,\n gap,\n align,\n justify,\n padding,\n wrap,\n children,\n}: NovaComponentProps & StackProps) => {\n const style: CSSProperties = {\n display: 'flex',\n flexDirection: direction ?? 'column',\n gap: gap ?? 0,\n alignItems: ALIGN_MAP[align ?? 'stretch'],\n justifyContent: JUSTIFY_MAP[justify ?? 'start'],\n padding: padding ?? 0,\n flexWrap: wrap === true ? 'wrap' : 'nowrap',\n };\n return <div style={style}>{children}</div>;\n};\n\nStack.meta = {\n description: 'Flex container that arranges children in a row or column.',\n propsSchema: StackPropsSchema,\n};\n","import { createElement, type CSSProperties } from 'react';\nimport { TextPropsSchema, type TextProps } from '../../primitive-props';\nimport type { NovaComponent, NovaComponentProps } from '@react';\n\n// ═══════════════════════════════════════════════════════════\n// Text — typography element\n// ═══════════════════════════════════════════════════════════\n\nexport { TextPropsSchema, type TextProps };\n\nconst SIZE_MAP = {\n sm: '12px',\n md: '14px',\n lg: '16px',\n xl: '20px',\n '2xl': '24px',\n} as const;\n\nconst WEIGHT_MAP = {\n normal: 400,\n medium: 500,\n bold: 700,\n} as const;\n\nexport const Text: NovaComponent<TextProps> = ({\n as,\n size,\n weight,\n color,\n children,\n}: NovaComponentProps & TextProps) => {\n const tag = as ?? 'span';\n const style: CSSProperties = {\n fontSize: SIZE_MAP[size ?? 'md'],\n fontWeight: WEIGHT_MAP[weight ?? 'normal'],\n color: color ?? 'inherit',\n };\n return createElement(tag, { style }, children);\n};\n\nText.meta = {\n description: 'Text element with semantic typography props.',\n propsSchema: TextPropsSchema,\n};\n","import { createContext, type ComponentType, type FC, type ReactNode } from 'react';\nimport type { ActionDefinition } from '@action';\nimport type { ComponentRegistry } from '@layout';\nimport type { Shell } from '@shell';\nimport type { NovaComponent, NovaDispatch, NovaPublish } from './types';\n\n// ═══════════════════════════════════════════════════════════\n// Two React contexts:\n// - NovaRenderContext: registry + dispatch + publish (+ optional\n// slotWrapper). Required to render a layout. Does NOT require a shell.\n// - NovaShellContext: the shell itself. Consumers who want\n// shell-aware hooks (canvases, runtimes, state) need this.\n// ═══════════════════════════════════════════════════════════\n\n// An app-supplied component that wraps each action instance's rendered content\n// at the ActionSlot seam — the single pluggable point for cross-cutting\n// concerns: enter/leave animation, an auth/feature gate, logging, an error\n// boundary. Nova hands it IDENTITY (canvasId / instanceId / the action's\n// definition), never live state, and owns no timing — the wrapper (and whatever\n// it plugs in: framer-motion, react-transition-group, plain CSS) owns all of\n// that. The three identity fields are `undefined` while a slot is empty or\n// exiting; a presence-managing wrapper captured them when content was present.\nexport type SlotWrapperProps = {\n canvasId?: string;\n instanceId?: string;\n action?: ActionDefinition;\n children?: ReactNode;\n};\nexport type SlotWrapper = FC<SlotWrapperProps>;\n\nexport type NovaRenderContextValue = {\n registry: ComponentRegistry<NovaComponent>;\n dispatch: NovaDispatch;\n publish: NovaPublish;\n slotWrapper?: SlotWrapper;\n // used when a component name is unregistered — a permissive renderer (a\n // terminal on a reference kit) supplies one so unknown primitives render\n // their children instead of an error marker; strict consumers omit it.\n // Same seam as the DOM and TTY adapters' `fallback`.\n fallback?: NovaComponent;\n // host-specific leaf renderers. The DOM host renders a text node as a bare\n // string and an error node as a <span> — both crash a non-DOM react host\n // (ink requires every string inside <Text>). A host that isn't the DOM\n // supplies its own wrappers; browser consumers omit both.\n textWrapper?: ComponentType<{ children?: ReactNode }>;\n errorMarker?: ComponentType<{ code: string; message: string }>;\n};\n\nexport const NovaRenderContext = createContext<NovaRenderContextValue | undefined>(undefined);\nexport const NovaShellContext = createContext<Shell | undefined>(undefined);\n","import { useMemo, type ComponentType, type FC, type ReactNode } from 'react';\nimport type { ComponentRegistry } from '@layout';\nimport type { Shell } from '@shell';\nimport {\n NovaRenderContext,\n NovaShellContext,\n type NovaRenderContextValue,\n type SlotWrapper,\n} from './context';\nimport type { NovaComponent, NovaDispatch, NovaPublish } from './types';\n\nconst noopDispatch: NovaDispatch = () => {};\nconst noopPublish: NovaPublish = () => {};\n\n// ═══════════════════════════════════════════════════════════\n// <NovaRenderProvider>\n//\n// The framework-agnostic renderer context. Pairs a component\n// registry with a dispatch and publish function. Works with no\n// shell — dispatch and publish default to no-ops so static\n// layouts can be rendered without any event infrastructure.\n// ═══════════════════════════════════════════════════════════\n\nexport type NovaRenderProviderProps = {\n registry: ComponentRegistry<NovaComponent>;\n dispatch?: NovaDispatch;\n publish?: NovaPublish;\n slotWrapper?: SlotWrapper;\n // renderer for unregistered component names; omit for strict error markers\n fallback?: NovaComponent;\n // host-specific leaf renderers (see NovaRenderContextValue) — a non-DOM\n // react host (ink) supplies both; browser consumers omit them\n textWrapper?: ComponentType<{ children?: ReactNode }>;\n errorMarker?: ComponentType<{ code: string; message: string }>;\n children?: ReactNode;\n};\n\nexport const NovaRenderProvider: FC<NovaRenderProviderProps> = ({\n registry,\n dispatch = noopDispatch,\n publish = noopPublish,\n slotWrapper,\n fallback,\n textWrapper,\n errorMarker,\n children,\n}) => {\n const value = useMemo<NovaRenderContextValue>(\n () => ({ registry, dispatch, publish, slotWrapper, fallback, textWrapper, errorMarker }),\n [registry, dispatch, publish, slotWrapper, fallback, textWrapper, errorMarker],\n );\n return <NovaRenderContext.Provider value={value}>{children}</NovaRenderContext.Provider>;\n};\n\n// ═══════════════════════════════════════════════════════════\n// <NovaShellProvider>\n//\n// A thin wrapper over <NovaRenderProvider> that also exposes the\n// shell via context. The registry defaults to `shell.registry` so\n// callers don't have to thread it through twice; pass an explicit\n// `registry` override only when the shell should render against a\n// different one (rare).\n// ═══════════════════════════════════════════════════════════\n\nexport type NovaShellProviderProps = {\n shell: Shell;\n registry?: ComponentRegistry<NovaComponent>;\n slotWrapper?: SlotWrapper;\n children?: ReactNode;\n};\n\nexport const NovaShellProvider: FC<NovaShellProviderProps> = ({\n shell,\n registry,\n slotWrapper,\n children,\n}) => {\n const dispatch = useMemo<NovaDispatch>(() => (event) => shell.dispatch(event), [shell]);\n const publish = useMemo<NovaPublish>(\n () => (channel, payload) => shell.publish(channel, payload),\n [shell],\n );\n const resolvedRegistry = (registry ?? shell.registry) as ComponentRegistry<NovaComponent>;\n return (\n <NovaShellContext.Provider value={shell}>\n <NovaRenderProvider\n registry={resolvedRegistry}\n dispatch={dispatch}\n publish={publish}\n slotWrapper={slotWrapper}\n >\n {children}\n </NovaRenderProvider>\n </NovaShellContext.Provider>\n );\n};\n","import type { FC } from 'react';\n\nexport type ErrorMarkerProps = {\n code: string;\n message: string;\n};\n\n// Renders error RenderNodes surfaced by the renderer in lax mode.\n// Consumers can style via the `data-nova-error` attribute.\nexport const ErrorMarker: FC<ErrorMarkerProps> = ({ code, message }) => (\n <span data-nova-error={code} role=\"alert\">\n {`[${code}] ${message}`}\n </span>\n);\n","import { Fragment, createElement, useContext, type FC } from 'react';\nimport { NOVA_MODEL_PROP, NOVA_REF_PROP, renderNodeKey, type RenderNode } from '@layout';\nimport { NovaRenderContext } from './context';\nimport { ErrorMarker } from './error-marker';\nimport { RenderTree } from './render-tree';\n\nexport type RenderNodeViewProps = {\n node: RenderNode;\n};\n\nexport const RenderNodeView: FC<RenderNodeViewProps> = ({ node }) => {\n const ctx = useContext(NovaRenderContext);\n if (ctx === undefined) {\n throw new Error('RenderNodeView must be used inside <NovaRenderProvider>');\n }\n\n if (node.type === 'text') {\n // a non-DOM host (ink) must wrap every string — bare text crashes it\n const TextWrap = ctx.textWrapper;\n return TextWrap === undefined ? <Fragment>{node.value}</Fragment> : <TextWrap>{node.value}</TextWrap>;\n }\n if (node.type === 'fragment') {\n return <RenderTree nodes={node.children} />;\n }\n if (node.type === 'error') {\n const Marker = ctx.errorMarker ?? ErrorMarker;\n return <Marker code={node.code} message={node.message} />;\n }\n\n // node.type === 'component'\n const entry = ctx.registry.get(node.name);\n const Component = entry !== undefined ? entry.component : ctx.fallback;\n if (Component === undefined) {\n return <ErrorMarker code=\"COMPONENT_NOT_FOUND\" message={node.name} />;\n }\n const props: Record<string, unknown> = { ...node.props };\n if (node.model !== undefined) {\n props[NOVA_MODEL_PROP] = { ref: node.model.ref, path: node.model.path };\n }\n if (node.ref !== undefined) {\n props[NOVA_REF_PROP] = node.ref;\n }\n // Children go in as a keyed ARRAY of per-child elements (not one RenderTree\n // wrapper) so a component can address them individually with React.Children —\n // a Grid wraps each in a weighted flex cell. React flattens the array the\n // same way it would the fragment; keys follow core's renderNodeKey.\n return createElement(\n Component,\n props,\n node.children.length === 0\n ? undefined\n : node.children.map((child, i) => <RenderNodeView key={renderNodeKey(child, i)} node={child} />),\n );\n};\n","import { Fragment, type FC } from 'react';\nimport { renderNodeKey, type RenderNode } from '@layout';\nimport { RenderNodeView } from './render-node';\n\nexport type RenderTreeProps = {\n nodes: RenderNode[];\n};\n\nexport const RenderTree: FC<RenderTreeProps> = ({ nodes }) => (\n <Fragment>\n {nodes.map((node, i) => (\n <RenderNodeView key={renderNodeKey(node, i)} node={node} />\n ))}\n </Fragment>\n);\n","import { Component, type ErrorInfo, type ReactNode } from 'react';\n\n// ═══════════════════════════════════════════════════════════\n// React error boundaries REQUIRE a class component as of React 19.\n// There is no functional alternative today. This is the ONLY class\n// in the package outside `shared/errors.ts`. Justified strictly by\n// the framework requirement — every other abstraction in nova uses\n// factory + closure.\n// ═══════════════════════════════════════════════════════════\n\nexport type NovaErrorBoundaryProps = {\n children?: ReactNode;\n fallback?: (error: Error) => ReactNode;\n onError?: (error: Error, info: ErrorInfo) => void;\n};\n\ntype NovaErrorBoundaryState = {\n error: Error | undefined;\n};\n\nexport class NovaErrorBoundary extends Component<NovaErrorBoundaryProps, NovaErrorBoundaryState> {\n state: NovaErrorBoundaryState = { error: undefined };\n\n static getDerivedStateFromError(error: Error): NovaErrorBoundaryState {\n return { error };\n }\n\n componentDidCatch(error: Error, info: ErrorInfo): void {\n const handler = this.props.onError;\n if (handler !== undefined) handler(error, info);\n }\n\n render(): ReactNode {\n const { error } = this.state;\n if (error !== undefined) {\n const fallback = this.props.fallback;\n if (fallback !== undefined) return fallback(error);\n return (\n <div data-nova-error-boundary=\"true\" role=\"alert\">\n {error.message}\n </div>\n );\n }\n return this.props.children;\n }\n}\n","import { useContext } from 'react';\nimport type { Shell } from '@shell';\nimport { NovaShellContext } from '../context';\n\nexport const useShell = (): Shell => {\n const shell = useContext(NovaShellContext);\n if (shell === undefined) {\n throw new Error('useShell must be used inside <NovaShellProvider>');\n }\n return shell;\n};\n","import { useCallback, useRef, useSyncExternalStore } from 'react';\nimport type { RenderNode } from '@layout';\nimport type { Shell } from '@shell';\nimport { useShell } from './use-shell';\n\ntype Cache = {\n shell: Shell;\n canvasId: string | undefined;\n tree: RenderNode[];\n};\n\nconst EMPTY: RenderNode[] = [];\n\nexport const useCanvasRenderTree = (canvasId: string | undefined): RenderNode[] => {\n const shell = useShell();\n const cacheRef = useRef<Cache | undefined>(undefined);\n\n const subscribe = useCallback(\n (cb: () => void) =>\n shell.onStateChange(() => {\n const tree = canvasId === undefined ? EMPTY : shell.getCanvasRenderTree(canvasId);\n cacheRef.current = { shell, canvasId, tree };\n cb();\n }),\n [shell, canvasId],\n );\n\n const getSnapshot = useCallback((): RenderNode[] => {\n const cached = cacheRef.current;\n if (cached !== undefined && cached.shell === shell && cached.canvasId === canvasId) {\n return cached.tree;\n }\n const tree = canvasId === undefined ? EMPTY : shell.getCanvasRenderTree(canvasId);\n cacheRef.current = { shell, canvasId, tree };\n return tree;\n }, [shell, canvasId]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import { useCallback, useRef, useSyncExternalStore } from 'react';\nimport type { RenderNode } from '@layout';\nimport type { Shell } from '@shell';\nimport { useShell } from './use-shell';\n\ntype Cache = {\n shell: Shell;\n tree: RenderNode[];\n};\n\nexport const useShellRenderTree = (): RenderNode[] => {\n const shell = useShell();\n const cacheRef = useRef<Cache | undefined>(undefined);\n\n const subscribe = useCallback(\n (cb: () => void) =>\n shell.onStateChange(() => {\n cacheRef.current = { shell, tree: shell.getShellRenderTree() };\n cb();\n }),\n [shell],\n );\n\n const getSnapshot = useCallback((): RenderNode[] => {\n const cached = cacheRef.current;\n if (cached === undefined || cached.shell !== shell) {\n const tree = shell.getShellRenderTree();\n cacheRef.current = { shell, tree };\n return tree;\n }\n return cached.tree;\n }, [shell]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import { useMemo, useState, type FC, type ReactNode } from 'react';\nimport {\n createComponentRegistry,\n createLayoutStore,\n renderLayout,\n type ComponentRegistry,\n type LayoutNode,\n type LayoutStore,\n type RegistrationInput,\n type RenderContext,\n type RenderOnError,\n} from '@layout';\nimport type { Shell } from '@shell';\nimport { registerNovaReactComponents } from './components';\nimport type { SlotWrapper } from './context';\nimport { NovaRenderProvider, NovaShellProvider } from './provider';\nimport { RenderTree } from './render-tree';\nimport { useCanvasRenderTree } from './hooks/use-canvas-render-tree';\nimport { useShell } from './hooks/use-shell';\nimport { useShellRenderTree } from './hooks/use-shell-render-tree';\nimport type { NovaComponent } from './types';\n\n// ═══════════════════════════════════════════════════════════\n// <Nova.Layout> / <Nova.Shell> / <Nova.Canvas>\n//\n// The three mountable surfaces for Nova. Each hides the\n// registry/store/provider/render-tree wiring behind a single\n// component so stories and apps can stay declarative.\n//\n// <Nova.Layout layout data components? />\n// <Nova.Shell shell />\n// <Nova.Canvas shell? id />\n//\n// Lower-level primitives (NovaShellProvider, RenderTree, the\n// render-tree hooks) remain exported for advanced composition.\n// ═══════════════════════════════════════════════════════════\n\nconst ensureReactBuiltins = (registry: ComponentRegistry<NovaComponent>): void => {\n // Idempotent: the React adapter's slot components (CanvasSlot / ActionSlot)\n // are required for the shell's default layouts, and the primitive\n // components (Stack, Text, Input, Button, Box) are the authoring vocabulary\n // every demo expects. A single presence check short-circuits re-registration.\n if (registry.has('CanvasSlot')) return;\n registerNovaReactComponents(registry);\n};\n\n// ─── <Nova.Layout> ─────────────────────────────────────────\n\nexport type NovaLayoutProps = {\n // The layout tree to render. Inline LayoutNode or a LayoutStore id\n // (requires `store` to contain that id).\n layout: LayoutNode | string;\n // Data scope for resolvables (`$.x`, `{{x}}`). Defaults to `{}`.\n data?: Record<string, unknown>;\n // Extra components to register. Merged after builtins so they can\n // override (rare) or extend (common) the default set.\n components?: Record<string, RegistrationInput<NovaComponent>>;\n // Pass a pre-built registry instead of letting Nova create one.\n // When provided, `components` and `builtins` are ignored — the\n // caller is responsible for the registry's contents.\n registry?: ComponentRegistry<NovaComponent>;\n // Pass a pre-built layout store instead of letting Nova create one.\n store?: LayoutStore;\n // Register Nova's React builtins (Stack, Text, Input, Button, Box,\n // CanvasSlot, ActionSlot). Default true. Only applies when `registry`\n // was NOT provided.\n builtins?: boolean;\n strict?: boolean;\n onError?: RenderOnError;\n // The words this layout wears. Forwarded to the renderer, which is where a\n // language enters — this component translates nothing itself, and neither\n // does any other adapter.\n phrases?: RenderContext['phrases'];\n phraseKeys?: RenderContext['phraseKeys'];\n onPhraseMiss?: RenderContext['onPhraseMiss'];\n children?: ReactNode;\n};\n\nexport const NovaLayout: FC<NovaLayoutProps> = ({\n layout,\n data,\n components,\n registry: registryProp,\n store: storeProp,\n builtins = true,\n strict,\n onError,\n phrases,\n phraseKeys,\n onPhraseMiss,\n children,\n}) => {\n // A registry and store are stable for the lifetime of this component\n // instance. useState(init) fixes them on first render without the hazards\n // of registering during useMemo recomputation.\n const [registry] = useState<ComponentRegistry<NovaComponent>>(() => {\n if (registryProp !== undefined) return registryProp;\n const reg = createComponentRegistry<NovaComponent>();\n if (builtins) registerNovaReactComponents(reg);\n if (components !== undefined) reg.registerAll(components);\n return reg;\n });\n const [store] = useState<LayoutStore>(() => storeProp ?? createLayoutStore());\n\n const nodes = useMemo(() => {\n const resolved = typeof layout === 'string' ? store.get(layout) : layout;\n if (resolved === undefined) return [];\n return renderLayout(resolved, data ?? {}, {\n store,\n registry,\n ...(strict === undefined ? {} : { strict }),\n ...(onError === undefined ? {} : { onError }),\n ...(phrases === undefined ? {} : { phrases }),\n ...(phraseKeys === undefined ? {} : { phraseKeys }),\n ...(onPhraseMiss === undefined ? {} : { onPhraseMiss }),\n });\n }, [layout, data, store, registry, strict, onError, phrases, phraseKeys, onPhraseMiss]);\n\n return (\n <NovaRenderProvider registry={registry}>\n <RenderTree nodes={nodes} />\n {children}\n </NovaRenderProvider>\n );\n};\n\n// ─── <Nova.Shell> ──────────────────────────────────────────\n\nexport type NovaShellProps = {\n shell: Shell;\n // Override the registry used for rendering. Defaults to shell.registry.\n // Pass this only when the same shell should render against a different\n // component set (rare — typically for theming or A/B swaps).\n registry?: ComponentRegistry<NovaComponent>;\n // Optional app-supplied component that wraps every action instance's content\n // at the ActionSlot seam (animation, auth/feature gates, logging, …). Nova\n // owns none of that logic — see `SlotWrapper`. Omit for plain rendering.\n slotWrapper?: SlotWrapper;\n // Ensure the React adapter's slot components are registered on the\n // shell's registry. Default true. Safe to leave on — idempotent.\n builtins?: boolean;\n};\n\nconst ShellRenderTreeView: FC = () => {\n const nodes = useShellRenderTree();\n return <RenderTree nodes={nodes} />;\n};\n\nexport const NovaShell: FC<NovaShellProps> = ({ shell, registry, slotWrapper, builtins = true }) => {\n const resolvedRegistry = (registry ?? shell.registry) as ComponentRegistry<NovaComponent>;\n // Register React builtins onto the resolved registry on first render.\n // useState's lazy initializer gives us a synchronous, once-per-mount hook.\n useState(() => {\n if (builtins) ensureReactBuiltins(resolvedRegistry);\n return true;\n });\n return (\n <NovaShellProvider shell={shell} registry={resolvedRegistry} slotWrapper={slotWrapper}>\n <ShellRenderTreeView />\n </NovaShellProvider>\n );\n};\n\n// ─── <Nova.Canvas> ─────────────────────────────────────────\n\nexport type NovaCanvasProps = {\n // The canvas to render.\n id: string;\n // Optional: when provided, Nova.Canvas creates its own NovaShellProvider.\n // When omitted, Nova.Canvas must be nested inside an existing\n // <Nova.Shell> / <NovaShellProvider>.\n shell?: Shell;\n registry?: ComponentRegistry<NovaComponent>;\n builtins?: boolean;\n};\n\nconst CanvasRenderTreeView: FC<{ canvasId: string }> = ({ canvasId }) => {\n const nodes = useCanvasRenderTree(canvasId);\n return <RenderTree nodes={nodes} />;\n};\n\nconst CanvasInContext: FC<{ canvasId: string }> = ({ canvasId }) => {\n // Asserts we're inside a NovaShellProvider so useShell doesn't throw.\n useShell();\n return <CanvasRenderTreeView canvasId={canvasId} />;\n};\n\nconst CanvasStandalone: FC<{\n canvasId: string;\n shell: Shell;\n registry?: ComponentRegistry<NovaComponent>;\n builtins: boolean;\n}> = ({ canvasId, shell, registry, builtins }) => {\n const resolvedRegistry = (registry ?? shell.registry) as ComponentRegistry<NovaComponent>;\n useState(() => {\n if (builtins) ensureReactBuiltins(resolvedRegistry);\n return true;\n });\n return (\n <NovaShellProvider shell={shell} registry={resolvedRegistry}>\n <CanvasRenderTreeView canvasId={canvasId} />\n </NovaShellProvider>\n );\n};\n\nexport const NovaCanvas: FC<NovaCanvasProps> = ({ id, shell, registry, builtins = true }) => {\n if (shell === undefined) return <CanvasInContext canvasId={id} />;\n return (\n <CanvasStandalone\n canvasId={id}\n shell={shell}\n builtins={builtins}\n {...(registry === undefined ? {} : { registry })}\n />\n );\n};\n\n// ─── namespace ─────────────────────────────────────────────\n\nexport const Nova = {\n Layout: NovaLayout,\n Shell: NovaShell,\n Canvas: NovaCanvas,\n} as const;\n","import { useCallback, useRef, useSyncExternalStore } from 'react';\nimport type { Shell, StateSnapshot } from '@shell';\nimport { useShell } from './use-shell';\n\nexport const useShellState = (): StateSnapshot => {\n const shell = useShell();\n const cacheRef = useRef<{ shell: Shell; snapshot: StateSnapshot } | undefined>(undefined);\n if (cacheRef.current === undefined || cacheRef.current.shell !== shell) {\n cacheRef.current = { shell, snapshot: shell.getState() };\n }\n\n const subscribe = useCallback(\n (cb: () => void) =>\n shell.onStateChange((snapshot) => {\n cacheRef.current = { shell, snapshot };\n cb();\n }),\n [shell],\n );\n\n const getSnapshot = useCallback((): StateSnapshot => {\n const cached = cacheRef.current;\n if (cached === undefined || cached.shell !== shell) {\n const snapshot = shell.getState();\n cacheRef.current = { shell, snapshot };\n return snapshot;\n }\n return cached.snapshot;\n }, [shell]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import { useCallback, useRef, useSyncExternalStore } from 'react';\nimport type { CanvasState, Shell } from '@shell';\nimport { useShell } from './use-shell';\n\ntype Cache = {\n shell: Shell;\n canvasId: string;\n state: CanvasState;\n};\n\nexport const useCanvas = (canvasId: string): CanvasState => {\n const shell = useShell();\n const cacheRef = useRef<Cache | undefined>(undefined);\n\n // The shell owns canvas-change equality — onCanvasChange only fires on\n // meaningful change, so no comparator lives here.\n const subscribe = useCallback(\n (cb: () => void) =>\n shell.onCanvasChange(canvasId, (next) => {\n cacheRef.current = { shell, canvasId, state: next };\n cb();\n }),\n [shell, canvasId],\n );\n\n const getSnapshot = useCallback((): CanvasState => {\n const cached = cacheRef.current;\n if (cached !== undefined && cached.shell === shell && cached.canvasId === canvasId) {\n return cached.state;\n }\n const state = shell.getCanvasState(canvasId);\n cacheRef.current = { shell, canvasId, state };\n return state;\n }, [shell, canvasId]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import { useCallback, useRef, useSyncExternalStore } from 'react';\nimport { useShell } from './use-shell';\n\ntype DataSnapshot = Record<string, unknown> | undefined;\n\nexport const useActionData = (instanceId: string): DataSnapshot => {\n const shell = useShell();\n const cacheRef = useRef<DataSnapshot>(undefined);\n\n const subscribe = useCallback(\n (cb: () => void) => {\n const runtime = shell.getRuntime(instanceId);\n if (runtime === undefined) return () => {};\n return runtime.onDataChange((next) => {\n cacheRef.current = next;\n cb();\n });\n },\n [shell, instanceId],\n );\n\n const getSnapshot = useCallback((): DataSnapshot => {\n const runtime = shell.getRuntime(instanceId);\n if (runtime === undefined) {\n cacheRef.current = undefined;\n return undefined;\n }\n const current = runtime.getData();\n if (cacheRef.current !== current) cacheRef.current = current;\n return cacheRef.current;\n }, [shell, instanceId]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import { useCallback, useRef, useSyncExternalStore } from 'react';\nimport type { ActionStatus } from '@action';\nimport { useShell } from './use-shell';\n\nexport const useActionStatus = (instanceId: string): ActionStatus | undefined => {\n const shell = useShell();\n const cacheRef = useRef<ActionStatus | undefined>(undefined);\n\n const subscribe = useCallback(\n (cb: () => void) => {\n const runtime = shell.getRuntime(instanceId);\n if (runtime === undefined) return () => {};\n return runtime.onStatusChange((next) => {\n cacheRef.current = next;\n cb();\n });\n },\n [shell, instanceId],\n );\n\n const getSnapshot = useCallback((): ActionStatus | undefined => {\n const runtime = shell.getRuntime(instanceId);\n if (runtime === undefined) {\n cacheRef.current = undefined;\n return undefined;\n }\n const current = runtime.instance.status;\n if (cacheRef.current !== current) cacheRef.current = current;\n return cacheRef.current;\n }, [shell, instanceId]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import { useCallback, useRef, useSyncExternalStore } from 'react';\nimport type { RenderNode } from '@layout';\nimport type { Phrasebook } from '../../../i18n/phrases';\nimport { useShell } from './use-shell';\n\ntype Cache = {\n data: Record<string, unknown> | undefined;\n // WHAT ELSE A TREE DEPENDS ON. Data is not the only input to a render: the\n // renderer also reads the shell's book, and `setPhrases` changes it without\n // touching a single instance's data. Cached on data alone, an instance that\n // was already mounted when the language changed would go on showing the old\n // words until something unrelated happened to it — which is precisely the\n // failure `setPhrases` exists to prevent.\n phrases: Phrasebook | undefined;\n tree: RenderNode[];\n};\n\nconst EMPTY: RenderNode[] = [];\n\nexport const useRenderTree = (instanceId: string): RenderNode[] => {\n const shell = useShell();\n const cacheRef = useRef<Cache | undefined>(undefined);\n\n const subscribe = useCallback(\n (cb: () => void) => {\n // Two sources, because a tree has two inputs. Data changes come from the\n // runtime; a language change is shell-wide and arrives as a state change,\n // the same signal the canvas and shell trees already listen to.\n const offState = shell.onStateChange(() => cb());\n const runtime = shell.getRuntime(instanceId);\n if (runtime === undefined) return offState;\n const offData = runtime.onDataChange(() => cb());\n return (): void => {\n offData();\n offState();\n };\n },\n [shell, instanceId],\n );\n\n const getSnapshot = useCallback((): RenderNode[] => {\n const runtime = shell.getRuntime(instanceId);\n if (runtime === undefined) {\n cacheRef.current = undefined;\n return EMPTY;\n }\n const data = runtime.getData();\n const phrases = shell.getPhrases();\n const cached = cacheRef.current;\n if (cached !== undefined && cached.data === data && cached.phrases === phrases) return cached.tree;\n const tree = runtime.render();\n cacheRef.current = { data, phrases, tree };\n return tree;\n }, [shell, instanceId]);\n\n return useSyncExternalStore(subscribe, getSnapshot);\n};\n","import { useContext } from 'react';\nimport { NovaRenderContext } from '../context';\nimport type { NovaDispatch } from '../types';\n\nexport const useNovaDispatch = (): NovaDispatch => {\n const ctx = useContext(NovaRenderContext);\n if (ctx === undefined) {\n throw new Error('useNovaDispatch must be used inside <NovaRenderProvider>');\n }\n return ctx.dispatch;\n};\n","import { useContext } from 'react';\nimport { NovaRenderContext } from '../context';\nimport type { NovaPublish } from '../types';\n\nexport const useNovaPublish = (): NovaPublish => {\n const ctx = useContext(NovaRenderContext);\n if (ctx === undefined) {\n throw new Error('useNovaPublish must be used inside <NovaRenderProvider>');\n }\n return ctx.publish;\n};\n","import { useContext } from 'react';\nimport type { ComponentRegistry } from '@layout';\nimport { NovaRenderContext } from '../context';\nimport type { NovaComponent } from '../types';\n\n// Returns the component registry exposed via <NovaRenderProvider>.\n// Useful for components that need to introspect or look up other\n// registered components (for agent tooling, dev inspectors, etc).\nexport const useNovaRegistry = (): ComponentRegistry<NovaComponent> => {\n const ctx = useContext(NovaRenderContext);\n if (ctx === undefined) {\n throw new Error('useNovaRegistry must be used inside <NovaRenderProvider>');\n }\n return ctx.registry;\n};\n","import { useContext } from 'react';\nimport { NovaRenderContext, type SlotWrapper } from '../context';\n\n// Reads the optional app-supplied slotWrapper from render context. Returns\n// undefined when none was provided (or when called outside a provider) — the\n// caller then renders content directly (passthrough). Unlike the dispatch/\n// publish hooks this never throws: a missing slotWrapper is the common case.\nexport const useSlotWrapper = (): SlotWrapper | undefined =>\n useContext(NovaRenderContext)?.slotWrapper;\n","import { useEffect, useRef, useState, type ChangeEvent, type CSSProperties } from 'react';\nimport { InputPropsSchema, type InputProps } from '../../primitive-props';\nimport { useNovaDispatch, type NovaComponent, type NovaComponentProps } from '@react';\n\n// ═══════════════════════════════════════════════════════════\n// Input — text input bound to model\n//\n// Number inputs still dispatch a string payload; mutation ops\n// handle parsing on the action side.\n//\n// Two remote round-trip obligations (ADAPTER.md §6), because the shell may be\n// authoritative over a socket:\n// - it holds local editing state while focused, so an async tree echo can't\n// clobber the value the user is mid-typing;\n// - it honours the layout's `debounce` prop, coalescing keystrokes before\n// they hit the wire. A local shell echoes synchronously and neither matters,\n// but a remote one drops keystrokes without them.\n// ═══════════════════════════════════════════════════════════\n\nexport { InputPropsSchema, type InputProps };\n\nconst computeStyle = (isDisabled: boolean, isFocused: boolean, isHovered: boolean): CSSProperties => {\n const borderColor = isDisabled\n ? '#d1d5db'\n : isFocused\n ? '#2563eb'\n : isHovered\n ? '#9ca3af'\n : '#d1d5db';\n return {\n padding: '8px 12px',\n border: `1px solid ${borderColor}`,\n borderRadius: 6,\n fontSize: 14,\n background: isDisabled ? '#f9fafb' : '#ffffff',\n color: isDisabled ? '#9ca3af' : 'inherit',\n cursor: isDisabled ? 'not-allowed' : 'text',\n minWidth: 240,\n outline: 'none',\n boxShadow: isFocused ? '0 0 0 3px rgba(37, 99, 235, 0.15)' : 'none',\n transition: 'border-color 150ms, box-shadow 150ms',\n };\n};\n\nexport const Input: NovaComponent<InputProps> = ({\n type,\n placeholder,\n disabled,\n value,\n debounce,\n novaModel,\n}: NovaComponentProps & InputProps) => {\n const dispatch = useNovaDispatch();\n const [isHovered, setIsHovered] = useState(false);\n // `draft` is the local editing value; `null` means \"not editing — the\n // server value is authoritative\". While editing (focused) the draft wins,\n // so an async tree echo arriving mid-type never resets what the user typed.\n const [draft, setDraft] = useState<string | null>(null);\n const isFocused = draft !== null;\n const shown = draft ?? value ?? '';\n const isDisabled = disabled ?? false;\n const debounceMs = debounce ?? 0;\n\n // A single pending debounced dispatch — cancelled on the next keystroke,\n // flushed on blur, dropped on unmount (a keystroke against a screen that has\n // gone is worse than a lost one — the same reasoning as the socket's).\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const clearPending = (): void => {\n if (timer.current !== undefined) {\n clearTimeout(timer.current);\n timer.current = undefined;\n }\n };\n useEffect(() => clearPending, []);\n\n const fire = (next: string): void => {\n if (novaModel === undefined) return;\n dispatch({ type: 'ui:model', ref: novaModel.ref, payload: next });\n };\n\n const onChange = (event: ChangeEvent<HTMLInputElement>): void => {\n const next = event.target.value;\n setDraft(next);\n if (debounceMs > 0) {\n clearPending();\n timer.current = setTimeout(() => {\n timer.current = undefined;\n fire(next);\n }, debounceMs);\n } else {\n fire(next);\n }\n };\n\n const onFocus = (): void => setDraft(value ?? '');\n const onBlur = (): void => {\n // Flush any pending keystroke now, then hand authority back to the server.\n if (timer.current !== undefined && draft !== null) {\n clearPending();\n fire(draft);\n }\n setDraft(null);\n };\n\n return (\n <input\n type={type ?? 'text'}\n placeholder={placeholder}\n disabled={isDisabled}\n value={shown}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={computeStyle(isDisabled, isFocused, isHovered)}\n />\n );\n};\n\nInput.meta = {\n description: 'Text input bound to data via the `model` field on the layout node.',\n propsSchema: InputPropsSchema,\n};\n","import { useState, type CSSProperties, type MouseEvent } from 'react';\nimport { ButtonPropsSchema, type ButtonProps } from '../../primitive-props';\nimport { useNovaDispatch, type NovaComponent, type NovaComponentProps } from '@react';\n\n// ═══════════════════════════════════════════════════════════\n// Button — clickable element\n//\n// Click events fire as `ui:click` carrying the layout node's\n// `ref` (injected as `novaRef`). Without a ref, clicks are no-ops.\n// ═══════════════════════════════════════════════════════════\n\nexport { ButtonPropsSchema, type ButtonProps };\n\ntype Variant = 'primary' | 'secondary' | 'ghost';\n\nconst BASE_STYLE: CSSProperties = {\n borderRadius: 6,\n fontSize: 14,\n fontWeight: 500,\n transition: 'background-color 100ms',\n};\n\nconst primaryStyle = (isDisabled: boolean, isHovered: boolean, isActive: boolean): CSSProperties => ({\n ...BASE_STYLE,\n padding: '8px 16px',\n border: 'none',\n color: '#ffffff',\n cursor: isDisabled ? 'not-allowed' : 'pointer',\n background: isDisabled\n ? '#93c5fd'\n : isActive\n ? '#1e40af'\n : isHovered\n ? '#1d4ed8'\n : '#2563eb',\n});\n\nconst secondaryStyle = (isDisabled: boolean, isHovered: boolean, isActive: boolean): CSSProperties => ({\n ...BASE_STYLE,\n padding: '8px 16px',\n border: `1px solid ${isDisabled ? '#e5e7eb' : isHovered ? '#9ca3af' : '#d1d5db'}`,\n color: isDisabled ? '#9ca3af' : '#1f2937',\n cursor: isDisabled ? 'not-allowed' : 'pointer',\n background: isDisabled\n ? '#ffffff'\n : isActive\n ? '#e5e7eb'\n : isHovered\n ? '#f3f4f6'\n : '#ffffff',\n});\n\nconst ghostStyle = (isDisabled: boolean, isHovered: boolean, isActive: boolean): CSSProperties => ({\n ...BASE_STYLE,\n padding: '8px 12px',\n border: 'none',\n color: isDisabled ? '#93c5fd' : '#2563eb',\n cursor: isDisabled ? 'not-allowed' : 'pointer',\n background: isDisabled\n ? 'transparent'\n : isActive\n ? '#dbeafe'\n : isHovered\n ? '#eff6ff'\n : 'transparent',\n});\n\nconst styleFor = (\n variant: Variant,\n isDisabled: boolean,\n isHovered: boolean,\n isActive: boolean,\n): CSSProperties => {\n if (variant === 'primary') return primaryStyle(isDisabled, isHovered, isActive);\n if (variant === 'secondary') return secondaryStyle(isDisabled, isHovered, isActive);\n return ghostStyle(isDisabled, isHovered, isActive);\n};\n\nexport const Button: NovaComponent<ButtonProps> = ({\n label,\n variant,\n disabled,\n novaRef,\n children,\n}: NovaComponentProps & ButtonProps) => {\n const dispatch = useNovaDispatch();\n const [isHovered, setIsHovered] = useState(false);\n const [isActive, setIsActive] = useState(false);\n const isDisabled = disabled ?? false;\n const style = styleFor(variant ?? 'primary', isDisabled, isHovered, isActive);\n const onClick = (_event: MouseEvent<HTMLButtonElement>): void => {\n if (isDisabled) return;\n if (novaRef === undefined) return;\n dispatch({ type: 'ui:click', ref: novaRef });\n };\n return (\n <button\n type=\"button\"\n disabled={isDisabled}\n style={style}\n onClick={onClick}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => {\n setIsHovered(false);\n setIsActive(false);\n }}\n onMouseDown={() => setIsActive(true)}\n onMouseUp={() => setIsActive(false)}\n >\n {label ?? children}\n </button>\n );\n};\n\nButton.meta = {\n description: \"Clickable button. Click events fire as `ui:click` with the layout node's ref.\",\n propsSchema: ButtonPropsSchema,\n};\n","import type { CSSProperties } from 'react';\nimport { BoxPropsSchema, type BoxProps } from '../../primitive-props';\nimport type { NovaComponent, NovaComponentProps } from '@react';\n\n// ═══════════════════════════════════════════════════════════\n// Box — generic styled container\n// ═══════════════════════════════════════════════════════════\n\nexport { BoxPropsSchema, type BoxProps };\n\nexport const Box: NovaComponent<BoxProps> = ({\n padding,\n background,\n border,\n radius,\n children,\n}: NovaComponentProps & BoxProps) => {\n const style: CSSProperties = {\n padding: padding ?? 0,\n background: background ?? 'transparent',\n border: border === true ? '1px solid #e5e7eb' : 'none',\n borderRadius: radius ?? 0,\n };\n return <div style={style}>{children}</div>;\n};\n\nBox.meta = {\n description: 'Generic container with basic styling props. Use Stack for layout, Box for visual wrapping.',\n propsSchema: BoxPropsSchema,\n};\n","import { PanelPropsSchema, type PanelProps } from '../../primitive-props';\nimport { useNovaDispatch } from '@react';\nimport type { NovaComponent, NovaComponentProps } from '@react';\n\n// ═══════════════════════════════════════════════════════════\n// Panel — a framed, elevated surface with an optional title header. The\n// generic version of a dashboard/devtools panel; used by nova/devtools.\n// `closeRef` grows a header ✕ firing ui:click with that ref (the same\n// prop-ref convention as Table's rowRef).\n// ═══════════════════════════════════════════════════════════\n\nexport { PanelPropsSchema, type PanelProps };\n\nexport const Panel: NovaComponent<PanelProps> = ({ title, backRef, closeRef, children }: NovaComponentProps & PanelProps) => {\n const dispatch = useNovaDispatch();\n return (\n <div style={{ border: '1px solid #d8dae0', borderRadius: 10, background: '#fff', boxShadow: '0 1px 3px rgba(0,0,0,.06)', padding: 12 }}>\n {title !== undefined && (\n <div style={{ display: 'flex', alignItems: 'center', gap: 6, fontWeight: 600, fontSize: 13, marginBottom: 8 }}>\n {backRef !== undefined && (\n <button\n type=\"button\"\n style={{ border: 'none', background: 'none', color: '#6b7280', cursor: 'pointer', fontSize: 13, lineHeight: 1, padding: 2 }}\n onClick={() => dispatch({ type: 'ui:click', ref: backRef })}\n >\n ←\n </button>\n )}\n <span style={{ flex: 1 }}>{title}</span>\n {closeRef !== undefined && (\n <button\n type=\"button\"\n style={{ border: 'none', background: 'none', color: '#6b7280', cursor: 'pointer', fontSize: 13, lineHeight: 1, padding: 2 }}\n onClick={() => dispatch({ type: 'ui:click', ref: closeRef })}\n >\n ✕\n </button>\n )}\n </div>\n )}\n {children}\n </div>\n );\n};\n\nPanel.meta = { description: 'A framed, elevated surface with an optional title; `closeRef` adds a header ✕.', propsSchema: PanelPropsSchema };\n","import type { FC } from 'react';\nimport { JsonTreePropsSchema, type JsonTreeProps } from '../../primitive-props';\nimport type { NovaComponent, NovaComponentProps } from '@react';\n\n// ═══════════════════════════════════════════════════════════\n// JsonTree — a collapsible view of any JSON value, via native <details> (no\n// state). The value arrives already resolved in props. Used by nova/devtools\n// to show data / endpoint configs / audit detail; useful anywhere.\n// ═══════════════════════════════════════════════════════════\n\nconst entriesOf = (value: object): Array<[string, unknown]> =>\n Array.isArray(value) ? value.map((item, index): [string, unknown] => [String(index), item]) : Object.entries(value);\n\nconst JsonNode: FC<{ value: unknown; name?: string }> = ({ value, name }) => {\n if (value !== null && typeof value === 'object') {\n const entries = entriesOf(value);\n const shape = Array.isArray(value) ? `[${entries.length}]` : `{${entries.length}}`;\n return (\n <details>\n <summary style={{ cursor: 'pointer', color: '#6b7280' }}>{name === undefined ? shape : `${name} ${shape}`}</summary>\n <div style={{ paddingLeft: 13, borderLeft: '1px solid #d8dae0', marginLeft: 3 }}>\n {entries.map(([key, child]) => (\n <JsonNode key={key} value={child} name={key} />\n ))}\n </div>\n </details>\n );\n }\n const text = name === undefined ? JSON.stringify(value) : `${name}: ${JSON.stringify(value)}`;\n return <div style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>{text}</div>;\n};\n\nexport { JsonTreePropsSchema, type JsonTreeProps };\n\nexport const JsonTree: NovaComponent<JsonTreeProps> = ({ value, label }: NovaComponentProps & JsonTreeProps) => (\n <div style={{ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace', fontSize: 12, lineHeight: 1.5 }}>\n <JsonNode value={value} name={label} />\n </div>\n);\n\nJsonTree.meta = { description: 'A collapsible view of any JSON value.', propsSchema: JsonTreePropsSchema };\n","import { CanvasSlotPropsSchema, type CanvasSlotProps } from '../../primitive-props';\nimport { RenderTree, useCanvasRenderTree } from '@react';\nimport type { NovaComponent, NovaComponentProps } from '@react';\n\n// ═══════════════════════════════════════════════════════════\n// CanvasSlot — structural component that renders a canvas's\n// actionLayout inside a shell's canvasLayout. Used as a leaf in\n// the shell-tier layout tree.\n// ═══════════════════════════════════════════════════════════\n\nexport { CanvasSlotPropsSchema, type CanvasSlotProps };\n\nexport const CanvasSlot: NovaComponent<CanvasSlotProps> = ({\n canvasId,\n}: NovaComponentProps & CanvasSlotProps) => {\n const tree = useCanvasRenderTree(canvasId);\n if (canvasId === undefined || canvasId === '') return null;\n return <RenderTree nodes={tree} />;\n};\n\nCanvasSlot.meta = {\n description: 'Renders a canvas by id, recursing into its actionLayout.',\n propsSchema: CanvasSlotPropsSchema,\n};\n","import { useContext, useMemo } from 'react';\nimport { ActionSlotPropsSchema, type ActionSlotProps } from '../../primitive-props';\nimport { scopeDispatch } from '@shared/event-bus';\nimport { RenderTree, useRenderTree, useShell, useSlotWrapper } from '@react';\nimport type { NovaComponent, NovaComponentProps, NovaRenderContextValue } from '@react';\nimport { NovaRenderContext } from '@react/context';\n\n// ═══════════════════════════════════════════════════════════\n// ActionSlot — structural component that renders a single action\n// instance inside a canvas's actionLayout. Resolves to nothing\n// when instanceId is missing (e.g. the canvas has no active).\n//\n// This is the one seam where an instance's content mounts/unmounts,\n// so it's where an app-supplied `slotWrapper` (if any) wraps the\n// content — for animation, gating, logging, etc. Nova owns none of\n// that; it just hands the wrapper identity and the rendered tree.\n// ═══════════════════════════════════════════════════════════\n\n// The authoring contract (instanceId only, strict) lives in ../../primitive-props.\nexport { ActionSlotPropsSchema, type ActionSlotProps };\n\nexport const ActionSlot: NovaComponent<ActionSlotProps> = ({\n instanceId,\n}: NovaComponentProps & ActionSlotProps) => {\n const tree = useRenderTree(instanceId ?? '');\n const slotWrapper = useSlotWrapper();\n const shell = useShell();\n const hasInstance = instanceId !== undefined && instanceId !== '';\n\n // Scope dispatch to THIS instance so the runtime delivers UI events from\n // its rendered subtree to this instance's own triggers only. The stamping\n // rule itself is core semantics — see scopeDispatch.\n const ctx = useContext(NovaRenderContext);\n const scoped = useMemo<NovaRenderContextValue | undefined>(() => {\n if (ctx === undefined || instanceId === undefined || instanceId === '') return ctx;\n return { ...ctx, dispatch: scopeDispatch(ctx.dispatch, instanceId) };\n }, [ctx, instanceId]);\n\n // No app-supplied wrapper → original behavior, plus the scoped dispatch.\n if (slotWrapper === undefined) {\n if (!hasInstance) return null;\n return (\n <NovaRenderContext.Provider value={scoped}>\n <RenderTree nodes={tree} />\n </NovaRenderContext.Provider>\n );\n }\n\n // With a wrapper, render it PERSISTENTLY (content or null) so a\n // presence-managing wrapper can animate an instance leaving. Identity\n // (canvasId / the ActionDefinition) resolves from the live runtime when one\n // is present; it is undefined while the slot is empty or exiting.\n const runtime = hasInstance ? shell.getRuntime(instanceId) : undefined;\n const Wrapper = slotWrapper;\n return (\n <Wrapper\n canvasId={runtime?.instance.canvasId}\n instanceId={hasInstance ? instanceId : undefined}\n action={runtime?.definition}\n >\n {hasInstance && tree.length ? (\n <NovaRenderContext.Provider value={scoped}>\n <RenderTree nodes={tree} />\n </NovaRenderContext.Provider>\n ) : null}\n </Wrapper>\n );\n};\n\nActionSlot.meta = {\n description: 'Renders an action instance by id. Used inside a canvas actionLayout.',\n propsSchema: ActionSlotPropsSchema,\n};\n","// ═══════════════════════════════════════════════════════════\n// @niscorp/nova/adapters/react/components\n//\n// Headless React component set for Nova layouts. All five\n// components carry static `.meta` (description + Zod props\n// schema). The `registerNovaReactComponents` helper batches\n// them into a registry via `registerAll`.\n// ═══════════════════════════════════════════════════════════\n\nimport type { ComponentRegistry } from '@layout';\nimport type { NovaComponent } from '@react';\nimport { Stack } from './stack';\nimport { Text } from './text';\nimport { Input } from './input';\nimport { Button } from './button';\nimport { Box } from './box';\nimport { Panel } from './panel';\nimport { JsonTree } from './json-tree';\nimport { CanvasSlot } from './canvas-slot';\nimport { ActionSlot } from './action-slot';\n\n// ─── Stack ─────────────────────────────────────────────────\nexport { Stack, StackPropsSchema, type StackProps } from './stack';\n\n// ─── Text ──────────────────────────────────────────────────\nexport { Text, TextPropsSchema, type TextProps } from './text';\n\n// ─── Input ─────────────────────────────────────────────────\nexport { Input, InputPropsSchema, type InputProps } from './input';\n\n// ─── Button ────────────────────────────────────────────────\nexport { Button, ButtonPropsSchema, type ButtonProps } from './button';\n\n// ─── Box ───────────────────────────────────────────────────\nexport { Box, BoxPropsSchema, type BoxProps } from './box';\n\n// ─── Introspection primitives (used by nova/devtools) ──────\nexport { Panel, PanelPropsSchema, type PanelProps } from './panel';\nexport { JsonTree, JsonTreePropsSchema, type JsonTreeProps } from './json-tree';\n\n// ─── Shell slots (react) ───────────────────────────────────\n// CanvasSlot / ActionSlot are shell-aware: they pull state from\n// the React shell context and must only be used inside a\n// <NovaShellProvider>. Non-React adapters register their own\n// equivalents implementing the same prop contract.\nexport { CanvasSlot, CanvasSlotPropsSchema, type CanvasSlotProps } from './canvas-slot';\nexport { ActionSlot, ActionSlotPropsSchema, type ActionSlotProps } from './action-slot';\n\n// ─── Bulk registration helper ──────────────────────────────\nexport const registerNovaReactComponents = (\n registry: ComponentRegistry<NovaComponent>,\n): void => {\n registry.registerAll({\n Stack,\n Text,\n Input,\n Button,\n Box,\n Panel,\n JsonTree,\n CanvasSlot,\n ActionSlot,\n });\n};\n"]}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { collectChannels, auditAction } from './chunk-RQB4PRPV.js';
|
|
2
|
+
|
|
3
|
+
// src/reflect/walk.ts
|
|
4
|
+
var isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
|
+
var walkNodes = (value, visit) => {
|
|
6
|
+
if (Array.isArray(value)) {
|
|
7
|
+
for (const item of value) walkNodes(item, visit);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (!isRecord(value)) return;
|
|
11
|
+
visit(value);
|
|
12
|
+
for (const inner of Object.values(value)) walkNodes(inner, visit);
|
|
13
|
+
};
|
|
14
|
+
var componentsOf = (value) => {
|
|
15
|
+
const out = /* @__PURE__ */ new Set();
|
|
16
|
+
walkNodes(value, (record) => {
|
|
17
|
+
if (typeof record["component"] === "string") out.add(record["component"]);
|
|
18
|
+
});
|
|
19
|
+
return out;
|
|
20
|
+
};
|
|
21
|
+
var refsOf = (value) => {
|
|
22
|
+
const out = /* @__PURE__ */ new Set();
|
|
23
|
+
walkNodes(value, (record) => {
|
|
24
|
+
if (record["component"] === void 0 || !isRecord(record["props"])) return;
|
|
25
|
+
walkNodes(record["props"], (props) => {
|
|
26
|
+
for (const [key, propValue] of Object.entries(props)) {
|
|
27
|
+
if ((key === "ref" || key.endsWith("Ref")) && typeof propValue === "string" && propValue !== "") out.add(propValue);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
return out;
|
|
32
|
+
};
|
|
33
|
+
var loopVarsOf = (value) => {
|
|
34
|
+
const out = /* @__PURE__ */ new Set();
|
|
35
|
+
walkNodes(value, (record) => {
|
|
36
|
+
if (typeof record["as"] === "string" && record["for"] !== void 0) out.add(record["as"]);
|
|
37
|
+
});
|
|
38
|
+
return out;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/reflect/audit.ts
|
|
42
|
+
var classifyAudit = (issue, definition) => {
|
|
43
|
+
const layout = typeof definition.layout === "object" ? definition.layout : void 0;
|
|
44
|
+
const bind = issue.match(/binds "\$\.([\w.]+)"/);
|
|
45
|
+
if (bind !== null) {
|
|
46
|
+
const root = (bind[1] ?? "").split(".")[0] ?? "";
|
|
47
|
+
if (root === "index" || root === "items") {
|
|
48
|
+
return { kind: "info", tag: "loop scope", reason: `\`${root}\` is a renderer-reserved loop variable` };
|
|
49
|
+
}
|
|
50
|
+
if (loopVarsOf(layout).has(root)) {
|
|
51
|
+
return { kind: "info", tag: "loop var", reason: `\`${root}\` is a loop \`as:\` variable \u2014 in scope at runtime` };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const ref = issue.match(/ref "([^"]+)"/);
|
|
55
|
+
if (ref !== null && issue.includes("listens") && refsOf(layout).has(ref[1] ?? "")) {
|
|
56
|
+
return { kind: "info", tag: "prop ref", reason: "dispatched by a component from a props value (e.g. Table rowRef / cell.ref)" };
|
|
57
|
+
}
|
|
58
|
+
if (issue.includes("{{")) {
|
|
59
|
+
return { kind: "info", tag: "template", reason: "target resolves from data at runtime \u2014 statically unknowable" };
|
|
60
|
+
}
|
|
61
|
+
return { kind: "address" };
|
|
62
|
+
};
|
|
63
|
+
var auditCatalog = (definitions) => {
|
|
64
|
+
const defs = Array.isArray(definitions) ? [...definitions] : Object.values(definitions);
|
|
65
|
+
const catalog = defs.map((definition) => ({ id: definition.id, ...definition.input !== void 0 ? { input: definition.input } : {} }));
|
|
66
|
+
const channels = [
|
|
67
|
+
...new Set(
|
|
68
|
+
defs.flatMap((definition) => {
|
|
69
|
+
const usage = collectChannels(definition);
|
|
70
|
+
return [...usage.emits, ...usage.listens];
|
|
71
|
+
})
|
|
72
|
+
)
|
|
73
|
+
];
|
|
74
|
+
return defs.map((definition) => {
|
|
75
|
+
const issues = auditAction(definition, { catalog, channels }).issues.map((issue) => ({ issue, ...classifyAudit(issue, definition) }));
|
|
76
|
+
issues.sort((a, b) => Number(a.kind === "info") - Number(b.kind === "info"));
|
|
77
|
+
return { id: definition.id, address: issues.filter((issue) => issue.kind === "address").length, issues };
|
|
78
|
+
}).filter((row) => row.issues.length > 0).sort((a, b) => b.address - a.address);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// src/reflect/shell.ts
|
|
82
|
+
var snapshotShell = (shell, exclude = []) => {
|
|
83
|
+
const state = shell.getState();
|
|
84
|
+
const canvases = Object.values(state.canvases).filter((canvas) => !exclude.includes(canvas.id)).map((canvas) => ({
|
|
85
|
+
id: canvas.id,
|
|
86
|
+
depth: canvas.stack.length,
|
|
87
|
+
items: [...canvas.stack].reverse().map((instance) => ({
|
|
88
|
+
definitionId: instance.definitionId,
|
|
89
|
+
instanceId: instance.id,
|
|
90
|
+
status: instance.status,
|
|
91
|
+
active: instance.id === canvas.active?.id
|
|
92
|
+
}))
|
|
93
|
+
}));
|
|
94
|
+
return { canvases, layouts: shell.layoutStore.list(), components: shell.registry.list() };
|
|
95
|
+
};
|
|
96
|
+
var compact = (value, over, head) => {
|
|
97
|
+
if (Array.isArray(value)) {
|
|
98
|
+
return over === 0 || value.length <= over ? value.map((item) => compact(item, over, head)) : [...value.slice(0, head).map((item) => compact(item, over, head)), `\u2026${value.length - head} more`];
|
|
99
|
+
}
|
|
100
|
+
if (value === null || typeof value !== "object") return value;
|
|
101
|
+
const out = {};
|
|
102
|
+
for (const [key, inner] of Object.entries(value)) out[key] = compact(inner, over, head);
|
|
103
|
+
return out;
|
|
104
|
+
};
|
|
105
|
+
var describeShell = (shell, options = {}) => {
|
|
106
|
+
const { only, mark, collapseOver = 5, head = 3, clean } = options;
|
|
107
|
+
const lines = [];
|
|
108
|
+
for (const [canvasId, canvas] of Object.entries(shell.getState().canvases)) {
|
|
109
|
+
if (only !== void 0 && !only.includes(canvasId)) continue;
|
|
110
|
+
if (canvas.active === void 0) {
|
|
111
|
+
lines.push(` ${canvasId}: (empty)`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
lines.push(` ${canvasId}: ${canvas.stack.map((item, index) => `${item.definitionId}${index === canvas.stack.length - 1 ? "*" : ""}`).join(" \u203A ")}`);
|
|
115
|
+
for (const item of canvas.stack) {
|
|
116
|
+
const runtime = shell.getRuntime(item.id);
|
|
117
|
+
const note = mark?.(item.id);
|
|
118
|
+
const data = runtime === void 0 ? void 0 : (clean ?? ((value) => value))(runtime.getData());
|
|
119
|
+
lines.push(` ${item.definitionId}${note === void 0 ? "" : ` ${note}`} data: ${data === void 0 ? "{}" : JSON.stringify(compact(data, collapseOver, head))}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return lines.join("\n");
|
|
123
|
+
};
|
|
124
|
+
var describeInstance = (shell, instanceId) => {
|
|
125
|
+
const runtime = shell.getRuntime(instanceId);
|
|
126
|
+
if (runtime === void 0) return void 0;
|
|
127
|
+
const definition = runtime.definition;
|
|
128
|
+
const layout = definition.layout;
|
|
129
|
+
const layoutNode = typeof layout === "string" ? shell.layoutStore.get(layout) : layout;
|
|
130
|
+
const issues = auditAction(definition).issues.map((issue) => ({ issue, ...classifyAudit(issue, definition) }));
|
|
131
|
+
return {
|
|
132
|
+
id: definition.id,
|
|
133
|
+
instanceId,
|
|
134
|
+
canvasId: runtime.instance.canvasId,
|
|
135
|
+
status: runtime.instance.status,
|
|
136
|
+
title: definition.title ?? "",
|
|
137
|
+
data: runtime.getData(),
|
|
138
|
+
endpoints: Object.entries(definition.endpoints ?? {}).map(([name, config]) => ({ name, config })),
|
|
139
|
+
triggers: definition.triggers ?? [],
|
|
140
|
+
lifecycle: definition.lifecycle ?? {},
|
|
141
|
+
layoutKind: typeof layout === "string" ? "store" : "inline",
|
|
142
|
+
layout: layoutNode,
|
|
143
|
+
input: definition.input,
|
|
144
|
+
issues
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/reflect/graph.ts
|
|
149
|
+
var navTargetsOf = (definition) => {
|
|
150
|
+
const out = /* @__PURE__ */ new Set();
|
|
151
|
+
const scan = (value) => walkNodes(value, (record) => {
|
|
152
|
+
for (const key of ["push", "replace", "resetTo"]) {
|
|
153
|
+
const target = record[key];
|
|
154
|
+
if (isRecord(target) && typeof target["action"] === "string") out.add(target["action"]);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
scan(definition.triggers ?? []);
|
|
158
|
+
scan(definition.lifecycle ?? {});
|
|
159
|
+
return [...out].sort();
|
|
160
|
+
};
|
|
161
|
+
var actionGraph = (definitions) => {
|
|
162
|
+
const defs = Array.isArray(definitions) ? [...definitions] : Object.values(definitions);
|
|
163
|
+
const known = new Set(defs.map((definition) => definition.id));
|
|
164
|
+
const dangling = /* @__PURE__ */ new Set();
|
|
165
|
+
const nodes = defs.map((definition) => {
|
|
166
|
+
const pushes = navTargetsOf(definition);
|
|
167
|
+
for (const target of pushes) if (!target.includes("{{") && !known.has(target)) dangling.add(target);
|
|
168
|
+
const usage = collectChannels(definition);
|
|
169
|
+
return { id: definition.id, pushes, emits: usage.emits, listens: usage.listens };
|
|
170
|
+
});
|
|
171
|
+
return { nodes, dangling: [...dangling].sort() };
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// src/reflect/cycles.ts
|
|
175
|
+
var NAV_KEYS = ["push", "replace", "resetTo"];
|
|
176
|
+
var isLiteral = (value) => typeof value === "string" && value !== "" && !value.includes("{{");
|
|
177
|
+
var edgesOf = (definition, from, steps, known, out) => {
|
|
178
|
+
if (!Array.isArray(steps)) return;
|
|
179
|
+
for (const step of steps) {
|
|
180
|
+
if (!isRecord(step)) continue;
|
|
181
|
+
const emit = step["emit"];
|
|
182
|
+
if (isRecord(emit) && isLiteral(emit["channel"])) out.push({ from, to: `channel:${emit["channel"]}`, action: definition.id, via: "emit" });
|
|
183
|
+
if (step["reload"] === true) out.push({ from, to: `mount:${definition.id}`, action: definition.id, via: "reload" });
|
|
184
|
+
for (const key of NAV_KEYS) {
|
|
185
|
+
const nav = step[key];
|
|
186
|
+
if (isRecord(nav) && isLiteral(nav["action"]) && known.has(nav["action"])) out.push({ from, to: `mount:${nav["action"]}`, action: definition.id, via: key });
|
|
187
|
+
}
|
|
188
|
+
if (typeof step["call"] === "string") {
|
|
189
|
+
edgesOf(definition, from, step["onSuccess"], known, out);
|
|
190
|
+
edgesOf(definition, from, step["onError"], known, out);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var label = (node) => node.startsWith("channel:") ? node.slice("channel:".length) : `mount ${node.slice("mount:".length)}`;
|
|
195
|
+
var chainCycles = (definitions) => {
|
|
196
|
+
const defs = Array.isArray(definitions) ? [...definitions] : Object.values(definitions);
|
|
197
|
+
const known = new Set(defs.map((definition) => definition.id));
|
|
198
|
+
const edges = [];
|
|
199
|
+
for (const definition of defs) {
|
|
200
|
+
for (const trigger of definition.triggers ?? []) {
|
|
201
|
+
if (isLiteral(trigger.message)) edgesOf(definition, `channel:${trigger.message}`, trigger.do, known, edges);
|
|
202
|
+
}
|
|
203
|
+
edgesOf(definition, `mount:${definition.id}`, definition.lifecycle?.mount, known, edges);
|
|
204
|
+
}
|
|
205
|
+
const outgoing = /* @__PURE__ */ new Map();
|
|
206
|
+
for (const edge of edges) outgoing.set(edge.from, [...outgoing.get(edge.from) ?? [], edge]);
|
|
207
|
+
const index = /* @__PURE__ */ new Map();
|
|
208
|
+
const low = /* @__PURE__ */ new Map();
|
|
209
|
+
const onStack = /* @__PURE__ */ new Set();
|
|
210
|
+
const stack = [];
|
|
211
|
+
const components = [];
|
|
212
|
+
let counter = 0;
|
|
213
|
+
const connect = (node) => {
|
|
214
|
+
index.set(node, counter);
|
|
215
|
+
low.set(node, counter);
|
|
216
|
+
counter += 1;
|
|
217
|
+
stack.push(node);
|
|
218
|
+
onStack.add(node);
|
|
219
|
+
for (const edge of outgoing.get(node) ?? []) {
|
|
220
|
+
if (!index.has(edge.to)) {
|
|
221
|
+
connect(edge.to);
|
|
222
|
+
low.set(node, Math.min(low.get(node) ?? 0, low.get(edge.to) ?? 0));
|
|
223
|
+
} else if (onStack.has(edge.to)) {
|
|
224
|
+
low.set(node, Math.min(low.get(node) ?? 0, index.get(edge.to) ?? 0));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (low.get(node) !== index.get(node)) return;
|
|
228
|
+
const component = [];
|
|
229
|
+
for (let top = stack.pop(); top !== void 0; top = stack.pop()) {
|
|
230
|
+
onStack.delete(top);
|
|
231
|
+
component.push(top);
|
|
232
|
+
if (top === node) break;
|
|
233
|
+
}
|
|
234
|
+
components.push(component);
|
|
235
|
+
};
|
|
236
|
+
for (const node of [...outgoing.keys()].sort()) if (!index.has(node)) connect(node);
|
|
237
|
+
const cycleIn = (component) => {
|
|
238
|
+
const members = new Set(component);
|
|
239
|
+
const start = [...component].sort()[0];
|
|
240
|
+
if (start === void 0) return void 0;
|
|
241
|
+
const via = /* @__PURE__ */ new Map();
|
|
242
|
+
const queue = [start];
|
|
243
|
+
for (let node = queue.shift(); node !== void 0; node = queue.shift()) {
|
|
244
|
+
for (const edge of outgoing.get(node) ?? []) {
|
|
245
|
+
if (!members.has(edge.to)) continue;
|
|
246
|
+
if (edge.to === start) {
|
|
247
|
+
const steps = [edge];
|
|
248
|
+
for (let back = via.get(node); back !== void 0; back = via.get(back.from)) steps.unshift(back);
|
|
249
|
+
return steps;
|
|
250
|
+
}
|
|
251
|
+
if (via.has(edge.to)) continue;
|
|
252
|
+
via.set(edge.to, edge);
|
|
253
|
+
queue.push(edge.to);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return void 0;
|
|
257
|
+
};
|
|
258
|
+
return components.map(cycleIn).filter((steps) => steps !== void 0).map((steps) => ({
|
|
259
|
+
steps,
|
|
260
|
+
path: [label(steps[0]?.from ?? ""), ...steps.map((step) => `\u2014${step.via} (${step.action})\u2192 ${label(step.to)}`)].join(" ")
|
|
261
|
+
})).sort((a, b) => a.path.localeCompare(b.path));
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// src/reflect/liveness.ts
|
|
265
|
+
var callsIn = (steps) => {
|
|
266
|
+
const names = /* @__PURE__ */ new Set();
|
|
267
|
+
walkNodes(steps, (record) => {
|
|
268
|
+
if (typeof record["call"] === "string") names.add(record["call"]);
|
|
269
|
+
});
|
|
270
|
+
return names;
|
|
271
|
+
};
|
|
272
|
+
var livenessOf = (definition) => {
|
|
273
|
+
const triggers = definition.triggers ?? [];
|
|
274
|
+
const layout = definition.layout;
|
|
275
|
+
let bound = false;
|
|
276
|
+
if (layout !== void 0 && typeof layout !== "string") {
|
|
277
|
+
walkNodes(layout, (record) => {
|
|
278
|
+
if (typeof record["component"] === "string" && record["model"] !== void 0) bound = true;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
const opening = callsIn(definition.lifecycle ?? {});
|
|
282
|
+
const afterwards = callsIn(triggers.map((trigger) => trigger.do));
|
|
283
|
+
const endpoints = Object.entries(definition.endpoints ?? {}).map(([name, config]) => {
|
|
284
|
+
const spec = config;
|
|
285
|
+
const use = { name, onOpen: opening.has(name), later: afterwards.has(name) };
|
|
286
|
+
if (isRecord(spec) && typeof spec["fn"] === "string") return { ...use, kind: "fn" };
|
|
287
|
+
return {
|
|
288
|
+
...use,
|
|
289
|
+
kind: "http",
|
|
290
|
+
...isRecord(spec) && typeof spec["url"] === "string" ? { url: spec["url"] } : {},
|
|
291
|
+
...isRecord(spec) && spec["request"] !== void 0 ? { request: spec["request"] } : {}
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
return {
|
|
295
|
+
gestures: bound || triggers.some((trigger) => typeof trigger.event === "string"),
|
|
296
|
+
listens: [...new Set(triggers.map((trigger) => trigger.message).filter((channel) => typeof channel === "string"))].sort(),
|
|
297
|
+
endpoints,
|
|
298
|
+
opaqueLayout: typeof layout === "string"
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
export { actionGraph, auditCatalog, chainCycles, classifyAudit, componentsOf, describeInstance, describeShell, isRecord, livenessOf, loopVarsOf, refsOf, snapshotShell, walkNodes };
|
|
303
|
+
//# sourceMappingURL=chunk-IGLCWXQ3.js.map
|
|
304
|
+
//# sourceMappingURL=chunk-IGLCWXQ3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/reflect/walk.ts","../src/reflect/audit.ts","../src/reflect/shell.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AQ,CAAC,CAAC,CAAA,CAAE,IAAA,EAAK;AAAA,IAC3I,SAAA;AAAA,IACA,YAAA,EAAc,OAAO,MAAA,KAAW;AAAA,GAClC;AACF","file":"chunk-IGLCWXQ3.js","sourcesContent":["// ═══════════════════════════════════════════════════════════\n// The one traversal the codebase kept re-writing. A nova artifact — a layout,\n// a render tree, a definition, a whole manifest — is nested plain objects and\n// arrays; walking it to collect or check \"every node that has X\" was\n// hand-rolled in moss (collectComponents, hasVisibleContent) and relay's\n// devtools (walk, collectLoopVars, collectPropRefs). This is that walk, once,\n// plus the collectors that ride it.\n//\n// This is the STRUCTURAL walk — it visits every plain-object record. The\n// SEMANTIC walkers (collectChannels, which follows call→onSuccess; the typed\n// RenderNode model-binding walk) stay their own thing: folding them onto a\n// blind structural walk would lose their precision.\n// ═══════════════════════════════════════════════════════════\n\nexport const isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\n// Visit every plain-object record in a nova tree, arrays and nested objects\n// included. The visitor sees each record before its children.\nexport const walkNodes = (value: unknown, visit: (record: Record<string, unknown>) => void): void => {\n if (Array.isArray(value)) {\n for (const item of value) walkNodes(item, visit);\n return;\n }\n if (!isRecord(value)) return;\n visit(value);\n for (const inner of Object.values(value)) walkNodes(inner, visit);\n};\n\n// Every component NAME referenced anywhere in a tree — layouts, render trees,\n// fragments, a manifest. (Was moss's `collectComponents`.)\nexport const componentsOf = (value: unknown): Set<string> => {\n const out = new Set<string>();\n walkNodes(value, (record) => {\n if (typeof record['component'] === 'string') out.add(record['component']);\n });\n return out;\n};\n\n// Every ref carried by a `ref` / `*Ref` key INSIDE a component's props — the\n// refs a component dispatches for (a Table's rowRef, a cell's ref), which\n// node-level `ref:` analysis doesn't see. (Was devtools' `collectPropRefs`.)\nexport const refsOf = (value: unknown): Set<string> => {\n const out = new Set<string>();\n walkNodes(value, (record) => {\n if (record['component'] === undefined || !isRecord(record['props'])) return;\n walkNodes(record['props'], (props) => {\n for (const [key, propValue] of Object.entries(props)) {\n if ((key === 'ref' || key.endsWith('Ref')) && typeof propValue === 'string' && propValue !== '') out.add(propValue);\n }\n });\n });\n return out;\n};\n\n// Every loop `as:` variable declared anywhere in a layout — the names that are\n// in scope at runtime inside a `for`. (Was devtools' `collectLoopVars`.)\nexport const loopVarsOf = (value: unknown): Set<string> => {\n const out = new Set<string>();\n walkNodes(value, (record) => {\n if (typeof record['as'] === 'string' && record['for'] !== undefined) out.add(record['as']);\n });\n return out;\n};\n","import { auditAction, collectChannels } from '@action';\nimport type { ActionDefinition } from '@action';\nimport { loopVarsOf, refsOf } from './walk';\n\n// ═══════════════════════════════════════════════════════════\n// Audit classification — the static auditAction (action/audit.ts) has three\n// known blind spots; each is decidable from the definition itself. This turns\n// a raw issue string into `address` (a real break a human should see) or\n// `info` (runtime-explained). It's nova reasoning about its OWN audit\n// semantics — generic, not app opinion — so it lives here, not in an app's\n// devtools. Uses the walk collectors (loopVarsOf/refsOf).\n// ═══════════════════════════════════════════════════════════\n\nexport type IssueClass = { kind: 'address' } | { kind: 'info'; tag: string; reason: string };\n\nexport const classifyAudit = (issue: string, definition: ActionDefinition): IssueClass => {\n const layout = typeof definition.layout === 'object' ? definition.layout : undefined;\n\n const bind = issue.match(/binds \"\\$\\.([\\w.]+)\"/);\n if (bind !== null) {\n const root = (bind[1] ?? '').split('.')[0] ?? '';\n if (root === 'index' || root === 'items') {\n return { kind: 'info', tag: 'loop scope', reason: `\\`${root}\\` is a renderer-reserved loop variable` };\n }\n if (loopVarsOf(layout).has(root)) {\n return { kind: 'info', tag: 'loop var', reason: `\\`${root}\\` is a loop \\`as:\\` variable — in scope at runtime` };\n }\n }\n\n const ref = issue.match(/ref \"([^\"]+)\"/);\n if (ref !== null && issue.includes('listens') && refsOf(layout).has(ref[1] ?? '')) {\n return { kind: 'info', tag: 'prop ref', reason: 'dispatched by a component from a props value (e.g. Table rowRef / cell.ref)' };\n }\n\n if (issue.includes('{{')) {\n return { kind: 'info', tag: 'template', reason: 'target resolves from data at runtime — statically unknowable' };\n }\n\n return { kind: 'address' };\n};\n\nexport type ClassifiedIssue = { issue: string } & IssueClass;\nexport type CatalogAuditRow = { id: string; address: number; issues: ClassifiedIssue[] };\n\n// Audit a whole set of definitions and classify every finding: each definition\n// is checked against a catalog + channel vocabulary derived from the set, so\n// cross-action wiring (a push to a missing action, a channel nobody serves) is\n// visible. Rows carry unresolved (`address`) findings first and sort by how\n// many they have. The self-audit devtools render this verbatim.\nexport const auditCatalog = (\n definitions: Record<string, ActionDefinition> | readonly ActionDefinition[],\n): CatalogAuditRow[] => {\n const defs = Array.isArray(definitions) ? [...definitions] : Object.values(definitions);\n const catalog = defs.map((definition) => ({ id: definition.id, ...(definition.input !== undefined ? { input: definition.input } : {}) }));\n const channels = [\n ...new Set(\n defs.flatMap((definition) => {\n const usage = collectChannels(definition);\n return [...usage.emits, ...usage.listens];\n }),\n ),\n ];\n return defs\n .map((definition): CatalogAuditRow => {\n const issues = auditAction(definition, { catalog, channels }).issues.map((issue): ClassifiedIssue => ({ issue, ...classifyAudit(issue, definition) }));\n issues.sort((a, b) => Number(a.kind === 'info') - Number(b.kind === 'info'));\n return { id: definition.id, address: issues.filter((issue) => issue.kind === 'address').length, issues };\n })\n .filter((row) => row.issues.length > 0)\n .sort((a, b) => b.address - a.address);\n};\n","import type { Shell } from '@shell';\nimport type { ActionDefinition, EndpointConfig, TriggerConfig } from '@action';\nimport type { LayoutNode } from '@layout';\nimport { classifyAudit, type ClassifiedIssue } from './audit';\nimport { auditAction } from '@action';\n\n// ═══════════════════════════════════════════════════════════\n// Shell reflection — nova reading its own running state. The canvas/instance\n// tree (snapshotShell) and a full model for one instance (describeInstance).\n// Both were re-derived in relay's devtools fns; they're pure reads over the\n// Shell's own introspection API, so they belong here. Consumers: devtools, and\n// (server-ladder) the working-set / level-streaming that walks the same tree.\n// ═══════════════════════════════════════════════════════════\n\nexport type InstanceRef = {\n definitionId: string;\n instanceId: string;\n status: string;\n active: boolean;\n};\n\nexport type CanvasRef = {\n id: string;\n depth: number;\n // top-of-stack first\n items: InstanceRef[];\n};\n\nexport type ShellSnapshot = {\n canvases: CanvasRef[];\n layouts: string[];\n // every component name the shell's registry can render\n components: string[];\n};\n\n// The whole shell as a tree of canvases → instances, plus the shell-level\n// model (layout store ids, registered component names). `exclude` drops\n// canvases the caller owns (a devtools canvas shouldn't inspect itself).\nexport const snapshotShell = (shell: Shell, exclude: readonly string[] = []): ShellSnapshot => {\n const state = shell.getState();\n const canvases = Object.values(state.canvases)\n .filter((canvas) => !exclude.includes(canvas.id))\n .map((canvas): CanvasRef => ({\n id: canvas.id,\n depth: canvas.stack.length,\n items: [...canvas.stack].reverse().map((instance): InstanceRef => ({\n definitionId: instance.definitionId,\n instanceId: instance.id,\n status: instance.status,\n active: instance.id === canvas.active?.id,\n })),\n }));\n return { canvases, layouts: shell.layoutStore.list(), components: shell.registry.list() };\n};\n\n// ─── the shell as text ─────────────────────────────────────\n// What a model is shown when it has to reason about a screen. Same tree as\n// snapshotShell, rendered flat with each card's live data.\n//\n// Long arrays collapse to a head and a count: an agent looking at the same\n// screen many times a shift cannot pay for forty rows each time, and a person\n// reading a board of forty does not hold forty either.\n\nexport type DescribeShellOptions = {\n // Canvases to render. Default: all of them.\n only?: readonly string[];\n // Marks an instance in the output. An agent whose answer is the complete state\n // of its own canvases has to tell its cards from the person's.\n mark?: (instanceId: string) => string | undefined;\n // Array length past which values collapse. 0 disables collapsing.\n collapseOver?: number;\n head?: number;\n // Last pass over each card's data before it is written. A caller that knows\n // which fields are for rendering rather than reading — tones, formatted\n // stamps — drops them here instead of paying for them.\n clean?: (data: Record<string, unknown>) => Record<string, unknown>;\n};\n\nconst compact = (value: unknown, over: number, head: number): unknown => {\n if (Array.isArray(value)) {\n return over === 0 || value.length <= over ? value.map((item) => compact(item, over, head)) : [...value.slice(0, head).map((item) => compact(item, over, head)), `…${value.length - head} more`];\n }\n if (value === null || typeof value !== 'object') return value;\n const out: Record<string, unknown> = {};\n for (const [key, inner] of Object.entries(value as Record<string, unknown>)) out[key] = compact(inner, over, head);\n return out;\n};\n\nexport const describeShell = (shell: Shell, options: DescribeShellOptions = {}): string => {\n const { only, mark, collapseOver = 5, head = 3, clean } = options;\n const lines: string[] = [];\n for (const [canvasId, canvas] of Object.entries(shell.getState().canvases)) {\n if (only !== undefined && !only.includes(canvasId)) continue;\n if (canvas.active === undefined) {\n lines.push(` ${canvasId}: (empty)`);\n continue;\n }\n lines.push(` ${canvasId}: ${canvas.stack.map((item, index) => `${item.definitionId}${index === canvas.stack.length - 1 ? '*' : ''}`).join(' › ')}`);\n for (const item of canvas.stack) {\n const runtime = shell.getRuntime(item.id);\n const note = mark?.(item.id);\n const data = runtime === undefined ? undefined : (clean ?? ((value: Record<string, unknown>) => value))(runtime.getData());\n lines.push(` ${item.definitionId}${note === undefined ? '' : ` ${note}`} data: ${data === undefined ? '{}' : JSON.stringify(compact(data, collapseOver, head))}`);\n }\n }\n return lines.join('\\n');\n};\n\nexport type InstanceModel = {\n id: string;\n instanceId: string;\n canvasId: string;\n status: string;\n title: string;\n data: Record<string, unknown>;\n endpoints: Array<{ name: string; config: EndpointConfig }>;\n triggers: TriggerConfig[];\n lifecycle: Record<string, unknown>;\n layoutKind: 'inline' | 'store';\n layout: LayoutNode | undefined;\n input: Record<string, unknown> | undefined;\n issues: ClassifiedIssue[];\n};\n\n// The full model for one live instance — its definition wiring, its current\n// data, and its classified audit. `undefined` when the id isn't mounted.\nexport const describeInstance = (shell: Shell, instanceId: string): InstanceModel | undefined => {\n const runtime = shell.getRuntime(instanceId);\n if (runtime === undefined) return undefined;\n\n const definition: ActionDefinition = runtime.definition;\n const layout = definition.layout;\n const layoutNode = typeof layout === 'string' ? shell.layoutStore.get(layout) : layout;\n const issues = auditAction(definition).issues.map((issue): ClassifiedIssue => ({ issue, ...classifyAudit(issue, definition) }));\n\n return {\n id: definition.id,\n instanceId,\n canvasId: runtime.instance.canvasId,\n status: runtime.instance.status,\n title: definition.title ?? '',\n data: runtime.getData(),\n endpoints: Object.entries(definition.endpoints ?? {}).map(([name, config]) => ({ name, config })),\n triggers: definition.triggers ?? [],\n lifecycle: definition.lifecycle ?? {},\n layoutKind: typeof layout === 'string' ? 'store' : 'inline',\n layout: layoutNode,\n input: definition.input,\n issues,\n };\n};\n","import { collectChannels } from '@action';\nimport type { ActionDefinition } from '@action';\nimport { walkNodes, isRecord } from './walk';\n\n// ═══════════════════════════════════════════════════════════\n// The action graph — each action's outgoing edges: the actions it can push to\n// (navigation) and the channels it emits/listens on. This is the adjacency the\n// audit closure walks per role, and the neighbourhood the server ladder's\n// working-set / level-streaming serves by radius. Built on the walk (nav\n// targets) + the semantic channel walker. Reachability (radius-N) layers on\n// top when working-set streaming lands.\n// ═══════════════════════════════════════════════════════════\n\n// Every action a definition navigates to — push/replace/resetTo targets in its\n// triggers and lifecycle. A template target ({{…}}) is runtime-resolved, kept\n// as-is so a caller can see it's dynamic.\nconst navTargetsOf = (definition: ActionDefinition): string[] => {\n const out = new Set<string>();\n const scan = (value: unknown): void =>\n walkNodes(value, (record) => {\n for (const key of ['push', 'replace', 'resetTo']) {\n const target = record[key];\n if (isRecord(target) && typeof target['action'] === 'string') out.add(target['action']);\n }\n });\n scan(definition.triggers ?? []);\n scan(definition.lifecycle ?? {});\n return [...out].sort();\n};\n\nexport type ActionNode = {\n id: string;\n pushes: string[];\n emits: string[];\n listens: string[];\n};\n\nexport type ActionGraph = {\n nodes: ActionNode[];\n // ids referenced as push targets that aren't defined here (a dangling edge)\n dangling: string[];\n};\n\nexport const actionGraph = (\n definitions: Record<string, ActionDefinition> | readonly ActionDefinition[],\n): ActionGraph => {\n const defs = Array.isArray(definitions) ? [...definitions] : Object.values(definitions);\n const known = new Set(defs.map((definition) => definition.id));\n const dangling = new Set<string>();\n\n const nodes = defs.map((definition): ActionNode => {\n const pushes = navTargetsOf(definition);\n for (const target of pushes) if (!target.includes('{{') && !known.has(target)) dangling.add(target);\n const usage = collectChannels(definition);\n return { id: definition.id, pushes, emits: usage.emits, listens: usage.listens };\n });\n\n return { nodes, dangling: [...dangling].sort() };\n};\n","import type { ActionDefinition } from '@action';\nimport { isRecord } from './walk';\n\n// ═══════════════════════════════════════════════════════════\n// CHAINS THAT NEVER END, found in the definitions. A step list has no\n// conditionals, so once a chain can come back to where it started it always\n// will: a trigger on `x` that emits `x`, two triggers answering each other, a\n// mount that reloads itself, a mount whose emit reaches a trigger that pushes\n// the same action again. The runtime stops every such chain at its budget\n// (action/runtime/cause.ts); this finds them before anything runs.\n//\n// The graph: a node is where steps start running — a channel (its message\n// triggers) or an action's mount. An edge is a step that starts more:\n//\n// · `emit: c` → the channel c\n// · `reload` → this action's own mount\n// · `push`/`replace`/`resetTo` of A → A's mount\n//\n// followed through `call`'s onSuccess/onError, which run as part of the same\n// chain. A channel or target written as a template (`{{…}}`) is decided at\n// runtime and has no edge; a push to an action not in the set has none\n// either. Fragment triggers join when an action is composed — walk the\n// composed definitions to see them.\n// ═══════════════════════════════════════════════════════════\n\nexport type ChainStep = {\n // Where the steps run: `channel:x` or `mount:<action id>`.\n from: string;\n to: string;\n // The action whose trigger or mount carries the step.\n action: string;\n // What the step is: `emit`, `reload`, `push`, `replace`, `resetTo`.\n via: string;\n};\n\nexport type ChainCycle = {\n // The steps round the cycle, back to where it started.\n steps: ChainStep[];\n // One line: `x —emit (loop)→ x`.\n path: string;\n};\n\nconst NAV_KEYS = ['push', 'replace', 'resetTo'];\n\nconst isLiteral = (value: unknown): value is string => typeof value === 'string' && value !== '' && !value.includes('{{');\n\nconst edgesOf = (definition: ActionDefinition, from: string, steps: unknown, known: ReadonlySet<string>, out: ChainStep[]): void => {\n if (!Array.isArray(steps)) return;\n for (const step of steps) {\n if (!isRecord(step)) continue;\n const emit = step['emit'];\n if (isRecord(emit) && isLiteral(emit['channel'])) out.push({ from, to: `channel:${emit['channel']}`, action: definition.id, via: 'emit' });\n if (step['reload'] === true) out.push({ from, to: `mount:${definition.id}`, action: definition.id, via: 'reload' });\n for (const key of NAV_KEYS) {\n const nav = step[key];\n if (isRecord(nav) && isLiteral(nav['action']) && known.has(nav['action'])) out.push({ from, to: `mount:${nav['action']}`, action: definition.id, via: key });\n }\n if (typeof step['call'] === 'string') {\n edgesOf(definition, from, step['onSuccess'], known, out);\n edgesOf(definition, from, step['onError'], known, out);\n }\n }\n};\n\nconst label = (node: string): string => (node.startsWith('channel:') ? node.slice('channel:'.length) : `mount ${node.slice('mount:'.length)}`);\n\nexport const chainCycles = (definitions: Record<string, ActionDefinition> | readonly ActionDefinition[]): ChainCycle[] => {\n const defs = Array.isArray(definitions) ? [...definitions] : Object.values(definitions);\n const known = new Set(defs.map((definition) => definition.id));\n const edges: ChainStep[] = [];\n for (const definition of defs) {\n for (const trigger of definition.triggers ?? []) {\n if (isLiteral(trigger.message)) edgesOf(definition, `channel:${trigger.message}`, trigger.do, known, edges);\n }\n edgesOf(definition, `mount:${definition.id}`, definition.lifecycle?.mount, known, edges);\n }\n const outgoing = new Map<string, ChainStep[]>();\n for (const edge of edges) outgoing.set(edge.from, [...(outgoing.get(edge.from) ?? []), edge]);\n\n // One cycle per strongly connected component that has one (Tarjan), so a\n // tangle of triggers reports once, not once per rotation of every loop in it.\n const index = new Map<string, number>();\n const low = new Map<string, number>();\n const onStack = new Set<string>();\n const stack: string[] = [];\n const components: string[][] = [];\n let counter = 0;\n const connect = (node: string): void => {\n index.set(node, counter);\n low.set(node, counter);\n counter += 1;\n stack.push(node);\n onStack.add(node);\n for (const edge of outgoing.get(node) ?? []) {\n if (!index.has(edge.to)) {\n connect(edge.to);\n low.set(node, Math.min(low.get(node) ?? 0, low.get(edge.to) ?? 0));\n } else if (onStack.has(edge.to)) {\n low.set(node, Math.min(low.get(node) ?? 0, index.get(edge.to) ?? 0));\n }\n }\n if (low.get(node) !== index.get(node)) return;\n const component: string[] = [];\n for (let top = stack.pop(); top !== undefined; top = stack.pop()) {\n onStack.delete(top);\n component.push(top);\n if (top === node) break;\n }\n components.push(component);\n };\n for (const node of [...outgoing.keys()].sort()) if (!index.has(node)) connect(node);\n\n // A path round the component from its first node back to it, by\n // breadth-first search inside the component — the shortest such cycle.\n const cycleIn = (component: readonly string[]): ChainStep[] | undefined => {\n const members = new Set(component);\n const start = [...component].sort()[0];\n if (start === undefined) return undefined;\n const via = new Map<string, ChainStep>();\n const queue = [start];\n for (let node = queue.shift(); node !== undefined; node = queue.shift()) {\n for (const edge of outgoing.get(node) ?? []) {\n if (!members.has(edge.to)) continue;\n if (edge.to === start) {\n const steps = [edge];\n for (let back = via.get(node); back !== undefined; back = via.get(back.from)) steps.unshift(back);\n return steps;\n }\n if (via.has(edge.to)) continue;\n via.set(edge.to, edge);\n queue.push(edge.to);\n }\n }\n return undefined;\n };\n\n return components\n .map(cycleIn)\n .filter((steps): steps is ChainStep[] => steps !== undefined)\n .map((steps) => ({\n steps,\n path: [label(steps[0]?.from ?? ''), ...steps.map((step) => `—${step.via} (${step.action})→ ${label(step.to)}`)].join(' '),\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n};\n","import type { ActionDefinition } from '@action';\nimport { isRecord, walkNodes } from './walk';\n\n// ═══════════════════════════════════════════════════════════\n// What an action can still DO once it has been drawn — read off its own\n// definition.\n//\n// A screen that has been rendered is either finished or it is not. It is\n// finished when nothing on it can be pressed, nothing it waits on can arrive,\n// and nothing it would call is left to call: its tree is then the whole of it,\n// and a host can serve that tree and keep nothing running behind it. Everything\n// that makes it NOT finished is a declared part of the definition — a trigger,\n// a binding, a channel, an endpoint — so the question is decidable without\n// running anything.\n//\n// This reports the facts and decides nothing. Whether a given endpoint needs a\n// server is not nova's to know (it does not know what answers a url); a host\n// that does — moss, holding the entries behind each fingerprint — composes the\n// verdict from these.\n// ═══════════════════════════════════════════════════════════\n\nexport type EndpointUse = {\n name: string;\n kind: 'fn' | 'http';\n // http only: the url as authored (a template stays a template), and the\n // request body as authored — where a host finds the fingerprint it replays.\n url?: string;\n request?: unknown;\n // called while the action OPENS (its lifecycle hooks, and what those chain to)\n onOpen: boolean;\n // called because of something that happens LATER (a trigger, and what it chains to)\n later: boolean;\n};\n\nexport type ActionLiveness = {\n // A person can do something here: a `ui:` trigger, or a two-way binding (a\n // bound field writes the action's data, which lives wherever the shell does).\n gestures: boolean;\n // The channels it waits on — something else can change it while it is shown.\n listens: readonly string[];\n // Every declared endpoint, and when it is called. One that is never called\n // is still listed (`onOpen` and `later` both false): dead, but declared.\n endpoints: readonly EndpointUse[];\n // The layout is a store id, not inline: what it draws — bindings included —\n // cannot be read here, so a caller must not conclude nothing can be pressed.\n opaqueLayout: boolean;\n};\n\n// Every endpoint name a list of steps calls, nested steps included.\nconst callsIn = (steps: unknown): Set<string> => {\n const names = new Set<string>();\n walkNodes(steps, (record) => {\n if (typeof record['call'] === 'string') names.add(record['call']);\n });\n return names;\n};\n\nexport const livenessOf = (definition: ActionDefinition): ActionLiveness => {\n const triggers = definition.triggers ?? [];\n const layout = definition.layout;\n\n let bound = false;\n if (layout !== undefined && typeof layout !== 'string') {\n walkNodes(layout, (record) => {\n if (typeof record['component'] === 'string' && record['model'] !== undefined) bound = true;\n });\n }\n\n const opening = callsIn(definition.lifecycle ?? {});\n const afterwards = callsIn(triggers.map((trigger) => trigger.do));\n\n const endpoints = Object.entries(definition.endpoints ?? {}).map(([name, config]): EndpointUse => {\n const spec: unknown = config;\n const use = { name, onOpen: opening.has(name), later: afterwards.has(name) };\n if (isRecord(spec) && typeof spec['fn'] === 'string') return { ...use, kind: 'fn' };\n return {\n ...use,\n kind: 'http',\n ...(isRecord(spec) && typeof spec['url'] === 'string' ? { url: spec['url'] } : {}),\n ...(isRecord(spec) && spec['request'] !== undefined ? { request: spec['request'] } : {}),\n };\n });\n\n return {\n gestures: bound || triggers.some((trigger) => typeof trigger.event === 'string'),\n listens: [...new Set(triggers.map((trigger) => trigger.message).filter((channel): channel is string => typeof channel === 'string'))].sort(),\n endpoints,\n opaqueLayout: typeof layout === 'string',\n };\n};\n"]}
|