@niscorp/nova 0.3.1 → 0.4.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.
Files changed (72) hide show
  1. package/ACTION_DOCS.md +1 -1
  2. package/CHANGELOG.md +15 -0
  3. package/DESIGN.md +9 -6
  4. package/README.md +1 -1
  5. package/SHELL_DOCS.md +8 -10
  6. package/dist/adapters/dom/components/index.d.cts +1 -1
  7. package/dist/adapters/dom/components/index.d.ts +1 -1
  8. package/dist/adapters/dom/index.cjs +4 -4
  9. package/dist/adapters/dom/index.d.cts +1 -1
  10. package/dist/adapters/dom/index.d.ts +1 -1
  11. package/dist/adapters/dom/index.js +2 -2
  12. package/dist/adapters/dom/server.cjs +3 -3
  13. package/dist/adapters/dom/server.d.cts +1 -1
  14. package/dist/adapters/dom/server.d.ts +1 -1
  15. package/dist/adapters/dom/server.js +2 -2
  16. package/dist/adapters/react/components/index.cjs +22 -22
  17. package/dist/adapters/react/components/index.js +3 -3
  18. package/dist/adapters/react/index.cjs +25 -25
  19. package/dist/adapters/react/index.d.cts +1 -1
  20. package/dist/adapters/react/index.d.ts +1 -1
  21. package/dist/adapters/react/index.js +3 -3
  22. package/dist/adapters/tty/components/index.d.cts +1 -1
  23. package/dist/adapters/tty/components/index.d.ts +1 -1
  24. package/dist/adapters/tty/index.cjs +1 -1
  25. package/dist/adapters/tty/index.d.cts +1 -1
  26. package/dist/adapters/tty/index.d.ts +1 -1
  27. package/dist/adapters/tty/index.js +1 -1
  28. package/dist/adapters/vue/components/index.cjs +22 -22
  29. package/dist/adapters/vue/components/index.js +3 -3
  30. package/dist/adapters/vue/index.cjs +30 -30
  31. package/dist/adapters/vue/index.d.cts +1 -1
  32. package/dist/adapters/vue/index.d.ts +1 -1
  33. package/dist/adapters/vue/index.js +4 -4
  34. package/dist/{chunk-2H6Y25FO.js → chunk-2HWYS6OJ.js} +3 -3
  35. package/dist/{chunk-2H6Y25FO.js.map → chunk-2HWYS6OJ.js.map} +1 -1
  36. package/dist/{chunk-OSIFUROH.js → chunk-2SEZAI3I.js} +4 -4
  37. package/dist/{chunk-OSIFUROH.js.map → chunk-2SEZAI3I.js.map} +1 -1
  38. package/dist/{chunk-3JE77TNL.js → chunk-3YS2FBF5.js} +40 -21
  39. package/dist/chunk-3YS2FBF5.js.map +1 -0
  40. package/dist/{chunk-PCUXNVWF.js → chunk-D42FJUQA.js} +4 -4
  41. package/dist/{chunk-PCUXNVWF.js.map → chunk-D42FJUQA.js.map} +1 -1
  42. package/dist/{chunk-SABSY2BW.cjs → chunk-EZ3AJRQ7.cjs} +4 -4
  43. package/dist/{chunk-SABSY2BW.cjs.map → chunk-EZ3AJRQ7.cjs.map} +1 -1
  44. package/dist/{chunk-I35ZD3PU.cjs → chunk-FG6IKUHA.cjs} +16 -16
  45. package/dist/{chunk-I35ZD3PU.cjs.map → chunk-FG6IKUHA.cjs.map} +1 -1
  46. package/dist/{chunk-EK2GBZ7D.js → chunk-O2N4BVLL.js} +3 -3
  47. package/dist/{chunk-EK2GBZ7D.js.map → chunk-O2N4BVLL.js.map} +1 -1
  48. package/dist/{chunk-FKAPJMNR.cjs → chunk-WQJZMXS5.cjs} +15 -15
  49. package/dist/{chunk-FKAPJMNR.cjs.map → chunk-WQJZMXS5.cjs.map} +1 -1
  50. package/dist/{chunk-DLZNZHUW.cjs → chunk-X77B4ZKQ.cjs} +40 -21
  51. package/dist/chunk-X77B4ZKQ.cjs.map +1 -0
  52. package/dist/{chunk-HDREPLRA.cjs → chunk-XHDQIQAG.cjs} +4 -4
  53. package/dist/{chunk-HDREPLRA.cjs.map → chunk-XHDQIQAG.cjs.map} +1 -1
  54. package/dist/devtools/index.d.cts +1 -1
  55. package/dist/devtools/index.d.ts +1 -1
  56. package/dist/document/index.d.cts +3 -3
  57. package/dist/document/index.d.ts +3 -3
  58. package/dist/examples/index.d.cts +1 -1
  59. package/dist/examples/index.d.ts +1 -1
  60. package/dist/{head-CBib11hD.d.ts → head-BvqHLqlL.d.ts} +1 -1
  61. package/dist/{head-BOjhYA36.d.cts → head-CB1fcRjc.d.cts} +1 -1
  62. package/dist/index.cjs +15 -15
  63. package/dist/index.d.cts +3 -3
  64. package/dist/index.d.ts +3 -3
  65. package/dist/index.js +1 -1
  66. package/dist/reflect/index.d.cts +1 -1
  67. package/dist/reflect/index.d.ts +1 -1
  68. package/dist/{types-OsJI-ceI.d.cts → types-BTha1ZLR.d.cts} +1 -2
  69. package/dist/{types-Dn9cBFCC.d.ts → types-BxpSKUxn.d.ts} +1 -2
  70. package/package.json +3 -3
  71. package/dist/chunk-3JE77TNL.js.map +0 -1
  72. package/dist/chunk-DLZNZHUW.cjs.map +0 -1
@@ -1 +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/head.tsx","../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","StackPropsSchema","createElement","TextPropsSchema","createContext","useContext","useEffect","useMemo","createShellHead","Fragment","isHeadNode","Component","NOVA_MODEL_PROP","NOVA_REF_PROP","renderNodeKey","useRef","useCallback","useSyncExternalStore","useState","createComponentRegistry","createLayoutStore","renderLayout","jsxs","EMPTY","InputPropsSchema","ButtonPropsSchema","BoxPropsSchema","PanelPropsSchema","JsonTreePropsSchema","CanvasSlotPropsSchema","scopeDispatch","ActionSlotPropsSchema"],"mappings":";;;;;;;;;;AAMA,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,EACP,MAAA,EAAQ,QAAA;AAAA,EACR,GAAA,EAAK,UAAA;AAAA,EACL,OAAA,EAAS,eAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAA;AAEO,IAAM,QAAmC,CAAC;AAAA,EAC/C,SAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAA,KAAuC;AACrC,EAAA,MAAM,KAAA,GAAuB;AAAA,IAC3B,OAAA,EAAS,MAAA;AAAA,IACT,eAAe,SAAA,IAAa,QAAA;AAAA,IAC5B,KAAK,GAAA,IAAO,CAAA;AAAA,IACZ,UAAA,EAAY,SAAA,CAAU,KAAA,IAAS,SAAS,CAAA;AAAA,IACxC,cAAA,EAAgB,WAAA,CAAY,OAAA,IAAW,OAAO,CAAA;AAAA,IAC9C,SAAS,OAAA,IAAW,CAAA;AAAA,IACpB,QAAA,EAAU,IAAA,KAAS,IAAA,GAAO,MAAA,GAAS;AAAA,GACrC;AACA,EAAA,uBAAOA,cAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAe,QAAA,EAAS,CAAA;AACtC;AAEA,KAAA,CAAM,IAAA,GAAO;AAAA,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A,CAAK,MAAA,mBACnBA,cAAAA,CAAC,kBAAkB,QAAA,EAAlB,EAA2B,KAAA,EAAO,MAAA,EACjC,0BAAAA,cAAAA,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+B;AACf,CAAA;;;AC1BO,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-FKAPJMNR.cjs","sourcesContent":["import type { CSSProperties } from 'react';\nimport { StackPropsSchema, type StackProps } from '../../primitive-props';\nimport type { NovaComponent, NovaComponentProps } from '@react';\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\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\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 fallback?: NovaComponent;\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 { createContext, useContext, useEffect, useMemo, type FC, type ReactNode } from 'react';\nimport type { Shell } from '@shell';\nimport { createShellHead, type ShellHead } from '../../document/shell-head';\n\nconst ShellHeadContext = createContext<ShellHead | undefined>(undefined);\n\nexport const HeadMark: FC = () => {\n const head = useContext(ShellHeadContext);\n useEffect(() => {\n if (head === undefined) return undefined;\n head.enter();\n return head.leave;\n }, [head]);\n return null;\n};\n\nexport const ShellHeadProvider: FC<{ shell: Shell; children?: ReactNode }> = ({ shell, children }) => {\n const head = useMemo(() => createShellHead(shell), [shell]);\n useEffect(() => head.watch(), [head]);\n return <ShellHeadContext.Provider value={head}>{children}</ShellHeadContext.Provider>;\n};\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 { ShellHeadProvider } from './head';\nimport type { NovaComponent, NovaDispatch, NovaPublish } from './types';\n\nconst noopDispatch: NovaDispatch = () => {};\nconst noopPublish: NovaPublish = () => {};\n\nexport type NovaRenderProviderProps = {\n registry: ComponentRegistry<NovaComponent>;\n dispatch?: NovaDispatch;\n publish?: NovaPublish;\n slotWrapper?: SlotWrapper;\n fallback?: NovaComponent;\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\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 <ShellHeadProvider shell={shell}>{children}</ShellHeadProvider>\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\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, type ReactElement } from 'react';\nimport { NOVA_MODEL_PROP, NOVA_REF_PROP, renderNodeKey, type RenderNode } from '@layout';\nimport { isHeadNode } from '@shell';\nimport { NovaRenderContext } from './context';\nimport { ErrorMarker } from './error-marker';\nimport { HeadMark } from './head';\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 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 if (isHeadNode(node)) return <HeadMark />;\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 // A keyed array of per-child elements, not one RenderTree: a component can\n // then address its children one by one with React.Children (a Grid gives each\n // its own cell).\n const viewOf = (child: RenderNode, i: number): ReactElement => <RenderNodeView key={renderNodeKey(child, i)} node={child} />;\n if (!node.children.some(isHeadNode)) {\n return createElement(Component, props, node.children.length === 0 ? undefined : node.children.map(viewOf));\n }\n // A head among them is not handed to the component: a kit that gives every\n // child a cell would give it an empty one.\n const views = node.children.map((child, i) => ({ head: isHeadNode(child), view: viewOf(child, i) }));\n const shown = views.filter((child) => !child.head).map((child) => child.view);\n return (\n <Fragment>\n {createElement(Component, props, shown.length === 0 ? undefined : shown)}\n {views.filter((child) => child.head).map((child) => child.view)}\n </Fragment>\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// A class because React has no function-component error boundary.\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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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\nconst ensureReactBuiltins = (registry: ComponentRegistry<NovaComponent>): void => {\n if (registry.has('CanvasSlot')) return;\n registerNovaReactComponents(registry);\n};\n\nexport type NovaLayoutProps = {\n layout: LayoutNode | string;\n data?: Record<string, unknown>;\n components?: Record<string, RegistrationInput<NovaComponent>>;\n registry?: ComponentRegistry<NovaComponent>;\n store?: LayoutStore;\n builtins?: boolean;\n strict?: boolean;\n onError?: RenderOnError;\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 // useState, not useMemo: the registry and the store are created once and stay\n // for the life of this component.\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\nexport type NovaShellProps = {\n shell: Shell;\n registry?: ComponentRegistry<NovaComponent>;\n slotWrapper?: SlotWrapper;\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 // A lazy useState initializer, not an effect: it runs synchronously, once per\n // mount, before anything below renders.\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\nexport type NovaCanvasProps = {\n id: string;\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 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\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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 // The renderer also reads the shell's phrases, and `setPhrases` changes them\n // without touching any instance's data.\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 // A language change is shell-wide and arrives as a state change.\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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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\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\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\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 // `null` means not editing: the tree's value shows. While focused the draft\n // wins, so a tree echo that arrives mid-typing does not reset what was 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 pending dispatch is dropped on unmount, not flushed: a keystroke against a\n // screen that has gone is worse than a lost one.\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 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\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\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\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\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\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\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 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 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 // The wrapper is rendered even with no content, so one that manages presence\n // can animate an instance leaving.\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","import 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\nexport { Stack, StackPropsSchema, type StackProps } from './stack';\n\nexport { Text, TextPropsSchema, type TextProps } from './text';\n\nexport { Input, InputPropsSchema, type InputProps } from './input';\n\nexport { Button, ButtonPropsSchema, type ButtonProps } from './button';\n\nexport { Box, BoxPropsSchema, type BoxProps } from './box';\n\nexport { Panel, PanelPropsSchema, type PanelProps } from './panel';\nexport { JsonTree, JsonTreePropsSchema, type JsonTreeProps } from './json-tree';\n\nexport { CanvasSlot, CanvasSlotPropsSchema, type CanvasSlotProps } from './canvas-slot';\nexport { ActionSlot, ActionSlotPropsSchema, type ActionSlotProps } from './action-slot';\n\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"]}
1
+ {"version":3,"sources":["../src/adapters/react/components/stack.tsx","../src/adapters/react/components/text.tsx","../src/adapters/react/context.ts","../src/adapters/react/head.tsx","../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","StackPropsSchema","createElement","TextPropsSchema","createContext","useContext","useEffect","useMemo","createShellHead","Fragment","isHeadNode","Component","NOVA_MODEL_PROP","NOVA_REF_PROP","renderNodeKey","useRef","useCallback","useSyncExternalStore","useState","createComponentRegistry","createLayoutStore","renderLayout","jsxs","EMPTY","InputPropsSchema","ButtonPropsSchema","BoxPropsSchema","PanelPropsSchema","JsonTreePropsSchema","CanvasSlotPropsSchema","scopeDispatch","ActionSlotPropsSchema"],"mappings":";;;;;;;;;;AAMA,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,EACP,MAAA,EAAQ,QAAA;AAAA,EACR,GAAA,EAAK,UAAA;AAAA,EACL,OAAA,EAAS,eAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAA;AAEO,IAAM,QAAmC,CAAC;AAAA,EAC/C,SAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAA,KAAuC;AACrC,EAAA,MAAM,KAAA,GAAuB;AAAA,IAC3B,OAAA,EAAS,MAAA;AAAA,IACT,eAAe,SAAA,IAAa,QAAA;AAAA,IAC5B,KAAK,GAAA,IAAO,CAAA;AAAA,IACZ,UAAA,EAAY,SAAA,CAAU,KAAA,IAAS,SAAS,CAAA;AAAA,IACxC,cAAA,EAAgB,WAAA,CAAY,OAAA,IAAW,OAAO,CAAA;AAAA,IAC9C,SAAS,OAAA,IAAW,CAAA;AAAA,IACpB,QAAA,EAAU,IAAA,KAAS,IAAA,GAAO,MAAA,GAAS;AAAA,GACrC;AACA,EAAA,uBAAOA,cAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAe,QAAA,EAAS,CAAA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,OAAA,EAAS,UAAA;AAAA,MAEhB,yBAAe,IAAA,CAAK,MAAA,mBACnBA,cAAAA,CAAC,kBAAkB,QAAA,EAAlB,EAA2B,KAAA,EAAO,MAAA,EACjC,0BAAAA,cAAAA,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+B;AACf,CAAA;;;AC1BO,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-WQJZMXS5.cjs","sourcesContent":["import type { CSSProperties } from 'react';\nimport { StackPropsSchema, type StackProps } from '../../primitive-props';\nimport type { NovaComponent, NovaComponentProps } from '@react';\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\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\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 fallback?: NovaComponent;\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 { createContext, useContext, useEffect, useMemo, type FC, type ReactNode } from 'react';\nimport type { Shell } from '@shell';\nimport { createShellHead, type ShellHead } from '../../document/shell-head';\n\nconst ShellHeadContext = createContext<ShellHead | undefined>(undefined);\n\nexport const HeadMark: FC = () => {\n const head = useContext(ShellHeadContext);\n useEffect(() => {\n if (head === undefined) return undefined;\n head.enter();\n return head.leave;\n }, [head]);\n return null;\n};\n\nexport const ShellHeadProvider: FC<{ shell: Shell; children?: ReactNode }> = ({ shell, children }) => {\n const head = useMemo(() => createShellHead(shell), [shell]);\n useEffect(() => head.watch(), [head]);\n return <ShellHeadContext.Provider value={head}>{children}</ShellHeadContext.Provider>;\n};\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 { ShellHeadProvider } from './head';\nimport type { NovaComponent, NovaDispatch, NovaPublish } from './types';\n\nconst noopDispatch: NovaDispatch = () => {};\nconst noopPublish: NovaPublish = () => {};\n\nexport type NovaRenderProviderProps = {\n registry: ComponentRegistry<NovaComponent>;\n dispatch?: NovaDispatch;\n publish?: NovaPublish;\n slotWrapper?: SlotWrapper;\n fallback?: NovaComponent;\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\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 <ShellHeadProvider shell={shell}>{children}</ShellHeadProvider>\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\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, type ReactElement } from 'react';\nimport { NOVA_MODEL_PROP, NOVA_REF_PROP, renderNodeKey, type RenderNode } from '@layout';\nimport { isHeadNode } from '@shell';\nimport { NovaRenderContext } from './context';\nimport { ErrorMarker } from './error-marker';\nimport { HeadMark } from './head';\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 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 if (isHeadNode(node)) return <HeadMark />;\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 // A keyed array of per-child elements, not one RenderTree: a component can\n // then address its children one by one with React.Children (a Grid gives each\n // its own cell).\n const viewOf = (child: RenderNode, i: number): ReactElement => <RenderNodeView key={renderNodeKey(child, i)} node={child} />;\n if (!node.children.some(isHeadNode)) {\n return createElement(Component, props, node.children.length === 0 ? undefined : node.children.map(viewOf));\n }\n // A head among them is not handed to the component: a kit that gives every\n // child a cell would give it an empty one.\n const views = node.children.map((child, i) => ({ head: isHeadNode(child), view: viewOf(child, i) }));\n const shown = views.filter((child) => !child.head).map((child) => child.view);\n return (\n <Fragment>\n {createElement(Component, props, shown.length === 0 ? undefined : shown)}\n {views.filter((child) => child.head).map((child) => child.view)}\n </Fragment>\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// A class because React has no function-component error boundary.\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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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\nconst ensureReactBuiltins = (registry: ComponentRegistry<NovaComponent>): void => {\n if (registry.has('CanvasSlot')) return;\n registerNovaReactComponents(registry);\n};\n\nexport type NovaLayoutProps = {\n layout: LayoutNode | string;\n data?: Record<string, unknown>;\n components?: Record<string, RegistrationInput<NovaComponent>>;\n registry?: ComponentRegistry<NovaComponent>;\n store?: LayoutStore;\n builtins?: boolean;\n strict?: boolean;\n onError?: RenderOnError;\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 // useState, not useMemo: the registry and the store are created once and stay\n // for the life of this component.\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\nexport type NovaShellProps = {\n shell: Shell;\n registry?: ComponentRegistry<NovaComponent>;\n slotWrapper?: SlotWrapper;\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 // A lazy useState initializer, not an effect: it runs synchronously, once per\n // mount, before anything below renders.\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\nexport type NovaCanvasProps = {\n id: string;\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 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\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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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 // The renderer also reads the shell's phrases, and `setPhrases` changes them\n // without touching any instance's data.\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 // A language change is shell-wide and arrives as a state change.\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 // The third argument is what a server reads: without it React refuses to draw\n // this to markup (\"Missing getServerSnapshot\").\n return useSyncExternalStore(subscribe, getSnapshot, 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\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\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\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 // `null` means not editing: the tree's value shows. While focused the draft\n // wins, so a tree echo that arrives mid-typing does not reset what was 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 pending dispatch is dropped on unmount, not flushed: a keystroke against a\n // screen that has gone is worse than a lost one.\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 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\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\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\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\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\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\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 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 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 // The wrapper is rendered even with no content, so one that manages presence\n // can animate an instance leaving.\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","import 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\nexport { Stack, StackPropsSchema, type StackProps } from './stack';\n\nexport { Text, TextPropsSchema, type TextProps } from './text';\n\nexport { Input, InputPropsSchema, type InputProps } from './input';\n\nexport { Button, ButtonPropsSchema, type ButtonProps } from './button';\n\nexport { Box, BoxPropsSchema, type BoxProps } from './box';\n\nexport { Panel, PanelPropsSchema, type PanelProps } from './panel';\nexport { JsonTree, JsonTreePropsSchema, type JsonTreeProps } from './json-tree';\n\nexport { CanvasSlot, CanvasSlotPropsSchema, type CanvasSlotProps } from './canvas-slot';\nexport { ActionSlot, ActionSlotPropsSchema, type ActionSlotProps } from './action-slot';\n\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"]}
@@ -1198,6 +1198,11 @@ var validateFragments = (fragments) => {
1198
1198
  );
1199
1199
  }
1200
1200
  };
1201
+ var refuseSharedId = (id) => {
1202
+ throw new chunkCQZH3L3W_cjs.DefinitionValidationError(`"${id}" is the id of an action and of a fragment`, {
1203
+ failures: [{ id, issues: [{ code: "custom", path: [], message: "an id names an action or a fragment, never both", input: void 0 }] }]
1204
+ });
1205
+ };
1201
1206
  var snapshotCanvas = (canvas) => {
1202
1207
  const stack = canvas.stack.slice();
1203
1208
  return {
@@ -1444,8 +1449,12 @@ var createTelemetry = (config) => {
1444
1449
 
1445
1450
  // src/shell/shell.ts
1446
1451
  var defaultShellIdFactory = createIdFactory("shell");
1452
+ var isFragment = (definition) => typeof definition === "object" && definition !== null && "kind" in definition && definition.kind === "fragment";
1447
1453
  var createShell = (config) => {
1448
1454
  validateActions(config.actions);
1455
+ validateFragments(config.fragments ?? {});
1456
+ const shared = Object.keys(config.fragments ?? {}).find((fragmentId) => Object.hasOwn(config.actions, fragmentId));
1457
+ if (shared !== void 0) refuseSharedId(shared);
1449
1458
  const id = (config.shellIdFn ?? defaultShellIdFactory)();
1450
1459
  const instanceIdFn = config.instanceIdFn ?? createIdFactory("act");
1451
1460
  const strict = config.strict ?? false;
@@ -1497,7 +1506,15 @@ var createShell = (config) => {
1497
1506
  }
1498
1507
  const canvasOrder = config.canvases.map((cfg) => cfg.id);
1499
1508
  let canvasLayout = config.canvasLayout;
1500
- const actions = { ...config.actions };
1509
+ const definitions = { ...config.actions, ...config.fragments };
1510
+ const actionOf = (actionId) => {
1511
+ const held = definitions[actionId];
1512
+ return held === void 0 || isFragment(held) ? void 0 : held;
1513
+ };
1514
+ const fragmentOf = (fragmentId) => {
1515
+ const held = definitions[fragmentId];
1516
+ return held !== void 0 && isFragment(held) ? held : void 0;
1517
+ };
1501
1518
  let phrases = config.phrases;
1502
1519
  let bearing = config.phrases !== void 0 || config.phraseKeys !== void 0;
1503
1520
  const SOURCE = {};
@@ -1509,7 +1526,6 @@ var createShell = (config) => {
1509
1526
  ...config.onPhraseMiss === void 0 ? {} : { onPhraseMiss: config.onPhraseMiss }
1510
1527
  };
1511
1528
  };
1512
- const fragments = { ...config.fragments ?? {} };
1513
1529
  let disposed = false;
1514
1530
  const guardNotDisposed = () => {
1515
1531
  if (disposed) throw new chunkCQZH3L3W_cjs.ShellDisposedError("Shell disposed");
@@ -1532,19 +1548,28 @@ var createShell = (config) => {
1532
1548
  return created;
1533
1549
  };
1534
1550
  const getDefinition = (actionId) => {
1535
- const def = actions[actionId];
1551
+ const def = actionOf(actionId);
1536
1552
  if (def === void 0) throw new chunkCQZH3L3W_cjs.UnknownActionError(`Unknown action: ${actionId}`, { actionId });
1537
1553
  return def;
1538
1554
  };
1539
1555
  const registerAction = (definition) => {
1540
1556
  guard();
1541
- validateActions({ [definition.id]: definition });
1542
- actions[definition.id] = definition;
1557
+ if (isFragment(definition)) {
1558
+ if (definition.id === void 0) throw new chunkCQZH3L3W_cjs.UnknownFragmentError("Fragment is missing an id", { fragmentId: "" });
1559
+ validateFragments({ [definition.id]: definition });
1560
+ } else {
1561
+ validateActions({ [definition.id]: definition });
1562
+ }
1563
+ const held = Object.hasOwn(definitions, definition.id) ? definitions[definition.id] : void 0;
1564
+ if (held !== void 0 && isFragment(held) !== isFragment(definition)) refuseSharedId(definition.id);
1565
+ definitions[definition.id] = definition;
1543
1566
  };
1544
1567
  const removeAction = (actionId) => {
1545
1568
  guard();
1546
- if (actions[actionId] === void 0) return;
1547
- delete actions[actionId];
1569
+ const held = definitions[actionId];
1570
+ if (held === void 0) return;
1571
+ delete definitions[actionId];
1572
+ if (isFragment(held)) return;
1548
1573
  journal.forgetAction(actionId);
1549
1574
  let changed = false;
1550
1575
  for (const [, canvas] of canvases) {
@@ -1560,16 +1585,10 @@ var createShell = (config) => {
1560
1585
  if (changed) fireState();
1561
1586
  };
1562
1587
  const getFragment = (fragmentId) => {
1563
- const frag = fragments[fragmentId];
1588
+ const frag = fragmentOf(fragmentId);
1564
1589
  if (frag === void 0) throw new chunkCQZH3L3W_cjs.UnknownFragmentError(`Unknown fragment: ${fragmentId}`, { fragmentId });
1565
1590
  return frag;
1566
1591
  };
1567
- const registerFragment = (fragment) => {
1568
- guard();
1569
- if (fragment.id === void 0) throw new chunkCQZH3L3W_cjs.UnknownFragmentError("Fragment is missing an id", { fragmentId: "" });
1570
- validateFragments({ [fragment.id]: fragment });
1571
- fragments[fragment.id] = fragment;
1572
- };
1573
1592
  const resolveDefinition = (actionId, fragmentIds) => {
1574
1593
  const def = getDefinition(actionId);
1575
1594
  if (fragmentIds === void 0 || fragmentIds.length === 0) return def;
@@ -1630,12 +1649,12 @@ var createShell = (config) => {
1630
1649
  removeInstance: (cid, iid) => removeInstance(cid, iid),
1631
1650
  reconcile: (cid, desired, options) => {
1632
1651
  const before = positionOf(cid);
1633
- const known = desired.filter((entry) => actions[entry.actionId] !== void 0).map((entry) => options.with === void 0 ? entry : { ...entry, with: options.with });
1652
+ const known = desired.filter((entry) => actionOf(entry.actionId) !== void 0).map((entry) => options.with === void 0 ? entry : { ...entry, with: options.with });
1634
1653
  const result = journal.mute(
1635
1654
  () => reconcileCanvas(shell, cid, known, {
1636
1655
  origin: options.origin,
1637
1656
  ...options.own === void 0 ? {} : { own: options.own },
1638
- definitionOf: (actionId) => actions[actionId]
1657
+ definitionOf: actionOf
1639
1658
  })
1640
1659
  );
1641
1660
  if (result.changed) journal.record(cid, before);
@@ -1769,7 +1788,8 @@ var createShell = (config) => {
1769
1788
  if (common === canvas.stack.length && common === entry.stack.length) return false;
1770
1789
  for (let i = common; i < entry.stack.length; i += 1) {
1771
1790
  const frame = entry.stack[i];
1772
- if (frame !== void 0 && actions[frame.action] === void 0) return false;
1791
+ if (frame === void 0) continue;
1792
+ if (actionOf(frame.action) === void 0 || frame.with?.some((fragmentId) => fragmentOf(fragmentId) === void 0) === true) return false;
1773
1793
  }
1774
1794
  journal.mute(() => {
1775
1795
  const standing = canvas.clearStack();
@@ -1925,7 +1945,7 @@ var createShell = (config) => {
1925
1945
  return renderLayoutOrRef(canvasLayout ?? DEFAULT_SHELL_LAYOUT, { canvases: canvasList });
1926
1946
  };
1927
1947
  const titleOf = (instance) => {
1928
- const def = registry.get(instance.id)?.definition ?? actions[instance.definitionId];
1948
+ const def = registry.get(instance.id)?.definition ?? actionOf(instance.definitionId);
1929
1949
  if (def?.title !== void 0) {
1930
1950
  const resolved = chunkK54CT3QN_cjs.resolve(def.title, chunkK54CT3QN_cjs.createScopeChain(instance.data));
1931
1951
  if (resolved !== void 0 && resolved !== null && resolved !== "") return String(resolved);
@@ -1963,7 +1983,6 @@ var createShell = (config) => {
1963
1983
  back,
1964
1984
  registerAction,
1965
1985
  removeAction,
1966
- registerFragment,
1967
1986
  addCanvas,
1968
1987
  removeCanvas,
1969
1988
  setCanvasLayout,
@@ -2080,5 +2099,5 @@ exports.scopeDispatch = scopeDispatch;
2080
2099
  exports.shellIdle = shellIdle;
2081
2100
  exports.shellSettled = shellSettled;
2082
2101
  exports.shellView = shellView;
2083
- //# sourceMappingURL=chunk-DLZNZHUW.cjs.map
2084
- //# sourceMappingURL=chunk-DLZNZHUW.cjs.map
2102
+ //# sourceMappingURL=chunk-X77B4ZKQ.cjs.map
2103
+ //# sourceMappingURL=chunk-X77B4ZKQ.cjs.map