@agent-native/core 0.42.0 → 0.44.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 (139) hide show
  1. package/README.md +17 -56
  2. package/dist/chat-threads/store.d.ts.map +1 -1
  3. package/dist/chat-threads/store.js +71 -10
  4. package/dist/chat-threads/store.js.map +1 -1
  5. package/dist/cli/pr-visual-recap-workflow.d.ts +1 -1
  6. package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
  7. package/dist/cli/pr-visual-recap-workflow.js +1 -1
  8. package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
  9. package/dist/cli/recap.d.ts.map +1 -1
  10. package/dist/cli/recap.js +13 -13
  11. package/dist/cli/recap.js.map +1 -1
  12. package/dist/cli/skills.d.ts +2 -6
  13. package/dist/cli/skills.d.ts.map +1 -1
  14. package/dist/cli/skills.js +21 -79
  15. package/dist/cli/skills.js.map +1 -1
  16. package/dist/client/AssistantChat.d.ts.map +1 -1
  17. package/dist/client/AssistantChat.js +76 -18
  18. package/dist/client/AssistantChat.js.map +1 -1
  19. package/dist/client/blocks/index.d.ts +9 -0
  20. package/dist/client/blocks/index.d.ts.map +1 -1
  21. package/dist/client/blocks/index.js +9 -0
  22. package/dist/client/blocks/index.js.map +1 -1
  23. package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -1
  24. package/dist/client/blocks/library/AnnotatedCodeBlock.js +3 -3
  25. package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -1
  26. package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -1
  27. package/dist/client/blocks/library/ApiEndpointBlock.js +1 -1
  28. package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -1
  29. package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -1
  30. package/dist/client/blocks/library/DiffBlock.js +128 -19
  31. package/dist/client/blocks/library/DiffBlock.js.map +1 -1
  32. package/dist/client/blocks/library/FileTreeBlock.d.ts.map +1 -1
  33. package/dist/client/blocks/library/FileTreeBlock.js +31 -4
  34. package/dist/client/blocks/library/FileTreeBlock.js.map +1 -1
  35. package/dist/client/blocks/library/JsonExplorerBlock.js +1 -1
  36. package/dist/client/blocks/library/JsonExplorerBlock.js.map +1 -1
  37. package/dist/client/blocks/library/MermaidBlock.js +1 -1
  38. package/dist/client/blocks/library/MermaidBlock.js.map +1 -1
  39. package/dist/client/blocks/library/callout.config.d.ts +29 -0
  40. package/dist/client/blocks/library/callout.config.d.ts.map +1 -0
  41. package/dist/client/blocks/library/callout.config.js +33 -0
  42. package/dist/client/blocks/library/callout.config.js.map +1 -0
  43. package/dist/client/blocks/library/callout.d.ts +20 -0
  44. package/dist/client/blocks/library/callout.d.ts.map +1 -0
  45. package/dist/client/blocks/library/callout.js +61 -0
  46. package/dist/client/blocks/library/callout.js.map +1 -0
  47. package/dist/client/blocks/library/checklist.d.ts.map +1 -1
  48. package/dist/client/blocks/library/checklist.js +3 -3
  49. package/dist/client/blocks/library/checklist.js.map +1 -1
  50. package/dist/client/blocks/library/code-tabs.js +1 -1
  51. package/dist/client/blocks/library/code-tabs.js.map +1 -1
  52. package/dist/client/blocks/library/diagram.config.d.ts +64 -0
  53. package/dist/client/blocks/library/diagram.config.d.ts.map +1 -0
  54. package/dist/client/blocks/library/diagram.config.js +111 -0
  55. package/dist/client/blocks/library/diagram.config.js.map +1 -0
  56. package/dist/client/blocks/library/diagram.d.ts +16 -0
  57. package/dist/client/blocks/library/diagram.d.ts.map +1 -0
  58. package/dist/client/blocks/library/diagram.js +261 -0
  59. package/dist/client/blocks/library/diagram.js.map +1 -0
  60. package/dist/client/blocks/library/question-form.config.d.ts +69 -0
  61. package/dist/client/blocks/library/question-form.config.d.ts.map +1 -0
  62. package/dist/client/blocks/library/question-form.config.js +58 -0
  63. package/dist/client/blocks/library/question-form.config.js.map +1 -0
  64. package/dist/client/blocks/library/question-form.d.ts +20 -0
  65. package/dist/client/blocks/library/question-form.d.ts.map +1 -0
  66. package/dist/client/blocks/library/question-form.js +286 -0
  67. package/dist/client/blocks/library/question-form.js.map +1 -0
  68. package/dist/client/blocks/library/sanitize-html.d.ts +5 -0
  69. package/dist/client/blocks/library/sanitize-html.d.ts.map +1 -0
  70. package/dist/client/blocks/library/sanitize-html.js +240 -0
  71. package/dist/client/blocks/library/sanitize-html.js.map +1 -0
  72. package/dist/client/blocks/library/server-specs.d.ts.map +1 -1
  73. package/dist/client/blocks/library/server-specs.js +49 -0
  74. package/dist/client/blocks/library/server-specs.js.map +1 -1
  75. package/dist/client/blocks/library/specs.d.ts.map +1 -1
  76. package/dist/client/blocks/library/specs.js +9 -0
  77. package/dist/client/blocks/library/specs.js.map +1 -1
  78. package/dist/client/blocks/library/tabs.d.ts.map +1 -1
  79. package/dist/client/blocks/library/tabs.js +12 -12
  80. package/dist/client/blocks/library/tabs.js.map +1 -1
  81. package/dist/client/blocks/library/wireframe-kit.d.ts +260 -0
  82. package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -0
  83. package/dist/client/blocks/library/wireframe-kit.js +920 -0
  84. package/dist/client/blocks/library/wireframe-kit.js.map +1 -0
  85. package/dist/client/blocks/library/wireframe.config.d.ts +123 -0
  86. package/dist/client/blocks/library/wireframe.config.d.ts.map +1 -0
  87. package/dist/client/blocks/library/wireframe.config.js +311 -0
  88. package/dist/client/blocks/library/wireframe.config.js.map +1 -0
  89. package/dist/client/blocks/library/wireframe.d.ts +15 -0
  90. package/dist/client/blocks/library/wireframe.d.ts.map +1 -0
  91. package/dist/client/blocks/library/wireframe.js +206 -0
  92. package/dist/client/blocks/library/wireframe.js.map +1 -0
  93. package/dist/client/blocks/mdx.d.ts.map +1 -1
  94. package/dist/client/blocks/mdx.js +11 -0
  95. package/dist/client/blocks/mdx.js.map +1 -1
  96. package/dist/client/blocks/registry.d.ts +9 -0
  97. package/dist/client/blocks/registry.d.ts.map +1 -1
  98. package/dist/client/blocks/registry.js +12 -5
  99. package/dist/client/blocks/registry.js.map +1 -1
  100. package/dist/client/blocks/server.d.ts +1 -0
  101. package/dist/client/blocks/server.d.ts.map +1 -1
  102. package/dist/client/blocks/server.js +1 -0
  103. package/dist/client/blocks/server.js.map +1 -1
  104. package/dist/client/blocks/types.d.ts +8 -0
  105. package/dist/client/blocks/types.d.ts.map +1 -1
  106. package/dist/client/blocks/types.js.map +1 -1
  107. package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +1 -1
  108. package/dist/client/rich-markdown-editor/DragHandle.js +112 -84
  109. package/dist/client/rich-markdown-editor/DragHandle.js.map +1 -1
  110. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -1
  111. package/dist/client/rich-markdown-editor/RegistryBlockNode.js +1 -1
  112. package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
  113. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +9 -1
  114. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -1
  115. package/dist/client/rich-markdown-editor/SharedRichEditor.js +3 -1
  116. package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -1
  117. package/dist/client/rich-markdown-editor/extensions.d.ts +13 -1
  118. package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -1
  119. package/dist/client/rich-markdown-editor/extensions.js +4 -2
  120. package/dist/client/rich-markdown-editor/extensions.js.map +1 -1
  121. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -1
  122. package/dist/client/rich-markdown-editor/useCollabReconcile.js +11 -1
  123. package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -1
  124. package/dist/server/poll.d.ts.map +1 -1
  125. package/dist/server/poll.js +30 -14
  126. package/dist/server/poll.js.map +1 -1
  127. package/dist/styles/agent-native.css +1 -0
  128. package/dist/styles/blocks.css +1388 -0
  129. package/dist/templates/default/.agents/skills/storing-data/SKILL.md +2 -0
  130. package/dist/templates/workspace-core/.agents/skills/performance/SKILL.md +141 -0
  131. package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +2 -0
  132. package/docs/content/plan-plugin.md +8 -8
  133. package/docs/content/pr-visual-recap.md +2 -2
  134. package/docs/content/template-plan.md +94 -17
  135. package/package.json +2 -1
  136. package/src/templates/default/.agents/skills/storing-data/SKILL.md +2 -0
  137. package/src/templates/workspace-core/.agents/skills/performance/SKILL.md +141 -0
  138. package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +2 -0
  139. package/docs/content/visual-plans.md +0 -82
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wireframe.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/wireframe.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1C,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,WAAW,EACX,SAAS,EACT,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,oBAAoB,CAAC;AA+C5B,MAAM,eAAe,GAA4C;IAC/D,6EAA6E;IAC7E,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IAClD,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IACnD,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IACnD,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IACnD,KAAK,EAAE,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IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,CAAC,OAAO,CAAC;IACpB,WAAW,EAAE,QAAQ;IACrB,KAAK,EAAE,WAAW;IAClB,WAAW,EACT,4JAA4J;IAC9J,8EAA8E;IAC9E,2EAA2E;IAC3E,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;CAClD,CAAC,CAAC","sourcesContent":["import {\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport { defineBlock } from \"../types.js\";\nimport type {\n BlockReadProps,\n BlockEditProps,\n BlockRenderContext,\n} from \"../types.js\";\nimport {\n wireframeSchema,\n wireframeMdx,\n type WireframeData,\n type WireframeSurface,\n} from \"./wireframe.config.js\";\nimport {\n HTML_ROUGH_SELECTOR,\n KitConfigContext,\n RoughOverlay,\n Screen,\n renderNodes,\n useIsDark,\n useWireframeStyle,\n} from \"./wireframe-kit.js\";\nimport {\n sanitizeWireframeCss,\n sanitizeWireframeHtml,\n scopeDesignCss,\n} from \"./sanitize-html.js\";\n\n/**\n * Shared `wireframe` block — a hand-drawn low-fi mockup of one screen, rendered\n * from either a declarative kit tree (`data.screen`) or a self-contained HTML\n * mockup (`data.html`), inside a surface-locked frame (desktop/mobile/popover/\n * panel/browser) with a rough.js sketch overlay. Lives in core so any app can\n * register it (it originated in the plan template).\n *\n * DECOUPLING from the plan original:\n * - Theme: `useIsDark()` reads `document.documentElement.classList` instead of\n * `next-themes` (the MermaidBlock precedent), so core stays dependency-light.\n * - HTML sanitize: the HTML path runs `data.html`/`data.css` through the\n * app-injected `ctx.sanitizeHtml`. If no sanitizer is wired the HTML path is\n * skipped (kit tree or an empty frame renders) — core never injects unsanitized\n * author HTML.\n * - The plan-only prototype runtime, design-element selection, and legacy region\n * fallback are intentionally NOT ported; those are plan-canvas features, not\n * part of the document-block render. The kit element vocabulary, the `--wf-*`\n * token contract, and the `.plan-wf` / `[data-rough]` classes the overlay\n * measures are preserved exactly.\n *\n * The section carries the app-neutral `an-block` class plus the legacy\n * `plan-block` class so plan renders byte-identically while any other app gets\n * the theme-token treatment from core's `blocks.css`.\n *\n * The wireframe is canvas / agent-patch edited (node-addressable content patches\n * applied server-side), NOT schema-form edited in the browser — so `Edit` reuses\n * the same static render as `Read`, mirroring the plan `WireframeEditor`.\n */\n\ntype SurfacePreset = {\n width: number;\n /**\n * Floor height for the surface. The frame is AUTO-HEIGHT (content-driven): it\n * grows past this when content is tall and shrinks toward its content height\n * when content is short, but never collapses below this floor — so an empty or\n * near-empty frame still reads as that surface instead of a thin sliver. This\n * is a `min-height`, not a fixed `height`: it is the lower bound the old fixed\n * preset height used to also be the UPPER bound, which is what left a big empty\n * vertical band below short content (e.g. a header + one dropdown padded to a\n * tall fixed aspect).\n */\n minHeight: number;\n radius: number;\n};\n\nconst SURFACE_PRESETS: Record<WireframeSurface, SurfacePreset> = {\n // mobile keeps a tall floor: a phone frame reads as a phone even when short.\n mobile: { width: 300, minHeight: 360, radius: 30 },\n desktop: { width: 840, minHeight: 200, radius: 14 },\n browser: { width: 900, minHeight: 200, radius: 14 },\n popover: { width: 360, minHeight: 120, radius: 16 },\n panel: { width: 420, minHeight: 200, radius: 16 },\n};\n\nfunction isHtmlData(data: WireframeData): boolean {\n return typeof data.html === \"string\" && data.html.trim().length > 0;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Shared frame shell: surface-locked WIDTH + auto (content-driven) height + */\n/* theme + rough overlay. The frame keeps each surface's footprint and chrome */\n/* but fits its content height instead of padding to a fixed aspect, so short */\n/* content yields a short frame and tall content grows. Pass `canvasSize` to */\n/* opt a fixed-aspect canvas artboard back into a hard pixel height. */\n/* -------------------------------------------------------------------------- */\n\nfunction ArtboardFrame({\n surface,\n compact,\n canvasSize,\n canvasWidth,\n skeleton,\n renderMode,\n roughOverlay = true,\n selector,\n caption,\n render,\n}: {\n surface: WireframeSurface;\n compact?: boolean;\n /**\n * Force a FIXED pixel height instead of the auto-height (content-driven)\n * default. Reserved for fixed-aspect canvas artboards (pan/zoom). Document-flow\n * wireframes — what recaps render — leave this unset so the frame fits content.\n */\n canvasSize?: number;\n canvasWidth?: number;\n skeleton?: boolean;\n renderMode?: \"wireframe\" | \"design\";\n roughOverlay?: boolean;\n selector: string;\n caption?: string;\n render: (ctx: {\n theme: \"light\" | \"dark\";\n style: \"sketchy\" | \"clean\";\n }) => ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const fitRef = useRef<HTMLDivElement>(null);\n const isDark = useIsDark();\n const theme: \"light\" | \"dark\" = isDark ? \"dark\" : \"light\";\n const style = useWireframeStyle();\n const preset = SURFACE_PRESETS[surface] ?? SURFACE_PRESETS.desktop;\n const width = canvasWidth ?? preset.width;\n // AUTO-HEIGHT: with no explicit `canvasSize` the artboard height is driven by\n // its content (`height: auto`), floored at the surface's `minHeight` so a short\n // screen produces a short frame and a tall screen grows — instead of every\n // surface being padded to a fixed preset height that left a big empty band\n // below short content. A `canvasSize` (fixed-aspect canvas artboard) overrides\n // this with a hard pixel height.\n const fixedHeight = canvasSize;\n const minHeight = fixedHeight ?? preset.minHeight;\n const baseScale = compact ? Math.min(1, 320 / preset.width) : 1;\n const maxFrameWidth = compact ? preset.width * baseScale : width;\n const [fitScale, setFitScale] = useState(baseScale);\n // The scaled artboard is `transform: scale()`-ed, which does not change its\n // layout box, so the wrapper that reserves vertical space must track the\n // artboard's ACTUAL rendered height. With a fixed height that's known up front;\n // with auto-height we measure it.\n const [measuredHeight, setMeasuredHeight] = useState<number | null>(\n fixedHeight ?? null,\n );\n const designMode = renderMode === \"design\";\n const sketchy = !designMode && style === \"sketchy\" && !skeleton;\n const roughEnabled = sketchy && roughOverlay;\n const paper = designMode\n ? \"hsl(var(--background))\"\n : \"var(--plan-document, hsl(var(--background)))\";\n const frameBorder = skeleton\n ? \"var(--plan-placeholder-line, var(--plan-line, hsl(var(--border))))\"\n : \"var(--plan-line, hsl(var(--border)))\";\n\n useEffect(() => {\n const element = fitRef.current;\n if (!element) return;\n const measure = () => {\n const availableWidth = element.clientWidth;\n const nextScale =\n availableWidth > 0\n ? Math.min(baseScale, availableWidth / width)\n : baseScale;\n setFitScale((current) =>\n Math.abs(current - nextScale) < 0.001 ? current : nextScale,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [baseScale, width]);\n\n // Track the auto-height artboard's rendered height so the (un-transformed)\n // wrapper reserves exactly the scaled space the frame occupies. Skipped when a\n // fixed height is supplied — there's nothing to measure.\n useEffect(() => {\n if (fixedHeight != null) return;\n const element = ref.current;\n if (!element) return;\n const measure = () => {\n const next = element.offsetHeight;\n setMeasuredHeight((current) =>\n current != null && Math.abs(current - next) < 0.5 ? current : next,\n );\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(element);\n return () => observer.disconnect();\n }, [fixedHeight]);\n\n // Height the wrapper reserves: the measured (or fixed) artboard height scaled\n // by the fit factor. Falls back to the surface floor before the first measure\n // so SSR / first paint reserves a sensible box rather than collapsing.\n const reservedHeight = (measuredHeight ?? minHeight) * fitScale;\n\n return (\n <div\n ref={fitRef}\n className=\"plan-kit-wireframe\"\n style={{\n width: \"100%\",\n maxWidth: maxFrameWidth,\n }}\n >\n <div\n style={{\n width: \"100%\",\n maxWidth: maxFrameWidth,\n height: reservedHeight,\n marginInline: \"auto\",\n }}\n >\n <div\n ref={ref}\n className=\"plan-kit-artboard relative\"\n style={{\n width,\n // Auto-height by default (content-driven, floored at `minHeight`);\n // a fixed `canvasSize` locks the height for canvas artboards.\n ...(fixedHeight != null ? { height: fixedHeight } : { minHeight }),\n borderRadius: preset.radius,\n background: paper,\n boxShadow: \"0 10px 34px hsl(var(--foreground) / 0.10)\",\n ...(fitScale !== 1\n ? {\n transform: `scale(${fitScale})`,\n transformOrigin: \"top left\",\n }\n : {}),\n }}\n >\n {/* Content drives the artboard height in flow when auto-height; for a\n fixed height it's pinned to the box. Rounded corners clip overflow\n either way. */}\n <div\n className=\"overflow-hidden\"\n style={{\n borderRadius: preset.radius,\n ...(fixedHeight != null\n ? { position: \"absolute\", inset: 0 }\n : { minHeight }),\n }}\n >\n {render({ theme, style })}\n </div>\n {!roughEnabled && (\n <div\n className=\"pointer-events-none absolute inset-0\"\n style={{\n borderRadius: preset.radius,\n border: `1.5px solid ${frameBorder}`,\n }}\n />\n )}\n <RoughOverlay\n scopeRef={ref}\n enabled={roughEnabled}\n frameRadius={preset.radius}\n selector={selector}\n />\n </div>\n </div>\n {caption && (\n <p className=\"mt-2 text-center text-xs text-plan-muted\">{caption}</p>\n )}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* HTML artboard — author HTML, themed + roughened by the renderer. */\n/* -------------------------------------------------------------------------- */\n\nfunction HtmlArtboard({\n data,\n ctx,\n compact,\n}: {\n data: WireframeData;\n ctx: BlockRenderContext;\n compact?: boolean;\n}) {\n const renderMode = data.renderMode ?? \"wireframe\";\n // Sanitize author HTML/CSS at the render point (defense-in-depth against stored\n // XSS). Self-contained in core via the shared block sanitizer (DOM-based in the\n // browser, regex fallback on the server) so the HTML mockup path renders in any\n // app without the host wiring a sanitizer hook.\n const safeHtml = useMemo(() => sanitizeWireframeHtml(data.html), [data.html]);\n const scopeId = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n const scopedCss = useMemo(() => {\n const safeCss = sanitizeWireframeCss(data.css);\n // Scope every author selector under this instance's artboard so global\n // selectors (body, *, .app-shell, :root) can't restyle/hide the host app.\n return safeCss\n ? scopeDesignCss(safeCss, `[data-plan-design-scope=\"${scopeId}\"]`)\n : \"\";\n }, [data.css, scopeId]);\n\n return (\n <ArtboardFrame\n surface={data.surface}\n compact={compact}\n skeleton={data.skeleton}\n renderMode={renderMode}\n selector={HTML_ROUGH_SELECTOR}\n caption={data.caption}\n render={({ theme, style }) => (\n <div\n className=\"plan-html-frame\"\n data-theme={theme}\n data-style={style}\n data-render-mode={renderMode}\n data-plan-design-scope={scopeId}\n data-skeleton={data.skeleton ? \"true\" : undefined}\n >\n {scopedCss && <style>{scopedCss}</style>}\n <div\n className=\"plan-html-frame-content\"\n dangerouslySetInnerHTML={{ __html: safeHtml }}\n />\n </div>\n )}\n />\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Kit artboard — declarative kit tree. */\n/* -------------------------------------------------------------------------- */\n\nfunction KitArtboard({\n data,\n compact,\n}: {\n data: WireframeData;\n compact?: boolean;\n}) {\n return (\n <ArtboardFrame\n surface={data.surface}\n compact={compact}\n skeleton={data.skeleton}\n selector=\"[data-rough]\"\n caption={data.caption}\n render={({ theme, style }) => (\n <KitConfigContext.Provider\n value={{ skeleton: data.skeleton, theme, style }}\n >\n {renderKitScreen(data.screen ?? [])}\n </KitConfigContext.Provider>\n )}\n />\n );\n}\n\nfunction renderKitScreen(\n nodes: NonNullable<WireframeData[\"screen\"]>,\n): ReactNode {\n if (nodes.length === 1 && nodes[0]?.el === \"screen\") {\n return renderNodes(nodes);\n }\n // `minHeight` (not `height`) so the screen fills the auto-height artboard floor\n // but grows past it when content is tall, instead of locking to a fixed box.\n return (\n <Screen pad=\"calc(var(--pad) * 1.35)\" style={{ minHeight: \"100%\" }}>\n {renderNodes(nodes)}\n </Screen>\n );\n}\n\n/**\n * The bare wireframe surface (no block section / title). Routes to the HTML\n * mockup when `data.html` is present and a sanitizer is wired; otherwise renders\n * the kit tree.\n */\nfunction WireframeSurfaceView({\n data,\n ctx,\n compact,\n}: {\n data: WireframeData;\n ctx: BlockRenderContext;\n compact?: boolean;\n}) {\n if (isHtmlData(data)) {\n return <HtmlArtboard data={data} ctx={ctx} compact={compact} />;\n }\n return <KitArtboard data={data} compact={compact} />;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Block Read / Edit */\n/* -------------------------------------------------------------------------- */\n\n/** Read-only renderer for a `wireframe` block. */\nexport function WireframeBlock({\n data,\n blockId,\n title,\n summary,\n ctx,\n}: BlockReadProps<WireframeData>) {\n return (\n <section\n className=\"an-block plan-block an-wireframe\"\n data-block-id={blockId}\n >\n {title && <div className=\"an-block-label plan-block-label\">{title}</div>}\n <WireframeSurfaceView data={data} ctx={ctx} />\n {summary && <p className=\"mt-5 text-plan-muted\">{summary}</p>}\n </section>\n );\n}\n\n/**\n * Editor for the `wireframe` block. The wireframe is canvas / agent-patch edited\n * (it never calls `onChange`), so edit mode reuses the read surface — mirroring\n * the plan `WireframeEditor`. The host document editor already wraps the registry\n * edit path in a titled section, so this renders only the surface to avoid\n * double-nesting.\n */\nexport function WireframeEditor({ data, ctx }: BlockEditProps<WireframeData>) {\n return <WireframeSurfaceView data={data} ctx={ctx} />;\n}\n\n/** Full client spec for the shared `wireframe` block (schema + MDX + Read/Edit). */\nexport const wireframeBlock = defineBlock<WireframeData>({\n type: \"wireframe\",\n schema: wireframeSchema,\n mdx: wireframeMdx,\n Read: WireframeBlock,\n Edit: WireframeEditor,\n placement: [\"block\"],\n editSurface: \"inline\",\n label: \"Wireframe\",\n description:\n \"A sketch wireframe of one screen built from kit primitives (or an HTML mockup), rendered in a chosen surface frame (desktop/mobile/popover/panel/browser).\",\n // `surface` is the only required field; `screen` defaults to []. Start on the\n // desktop surface with an empty screen so the canvas/agent can fill it in.\n empty: () => ({ surface: \"desktop\", screen: [] }),\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/mdx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;;;GAOG;AAMH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAErD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAA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AE,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAWF,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAgBrE;AA4DD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,eAAe,CAyBlE;AAMD,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,EACpB,KAAK,EAAE,iBAAiB,GACvB,MAAM,CA+BR;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAmBxC"}
@@ -79,6 +79,17 @@ function literalNodeValue(node) {
79
79
  return undefined;
80
80
  if (node.type === "Literal")
81
81
  return node.value;
82
+ if (node.type === "TemplateLiteral") {
83
+ // A template literal WITH `${…}` interpolations can't be evaluated
84
+ // statically — fail loudly so the import errors instead of falling through
85
+ // to a confusing JSON parse error or silently dropping the attribute.
86
+ if ((node.expressions?.length ?? 0) > 0) {
87
+ throw new Error("Template literal attribute values may not contain ${…} expressions; use a static string.");
88
+ }
89
+ // A template literal with no expressions is a static string:
90
+ // `<div>hi</div>` → "<div>hi</div>".
91
+ return node.quasis?.[0]?.value?.cooked ?? "";
92
+ }
82
93
  if (node.type === "ArrayExpression") {
83
94
  return (node.elements ?? []).map((item) => literalNodeValue(item));
84
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mdx.js","sourceRoot":"","sources":["../../../src/client/blocks/mdx.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,KAAc;IAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACrD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC;IACjD,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,IAAI,KAAK,KAAK,GAAG,CAAC;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,uBAAuB,CAAC,IAAI,CAAC,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AC,IAAI,CAAC;IACtB,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,IAAa,CAAC;IAClB,IAAI,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACvD,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CACzC,IAAI,CAAC,QAAQ,IAAI,EAAE,EACnB,GAAG,SAAS,IAAI,IAAI,CAAC,EAAE,EAAE,CAC1B,CAAC;QACF,IAAI,GAAG,EAAE,GAAI,SAAoB,EAAE,GAAI,YAAuB,EAAE,CAAC;IACnE,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import type { BlockSpec, BlockAttrReader, MdxAttrValue } from \"./types.js\";\nimport type { BlockRegistry } from \"./registry.js\";\n\n/**\n * Registry-driven MDX serialize/parse, plus the shared encoder primitives that\n * are the round-trip contract. This module is React-free so the server MDX\n * adapter (`plan-mdx.ts`) and the agent schema export can import it. The encoder\n * + estree literal walker are kept BYTE-FOR-BYTE identical to the originals in\n * `plan-mdx.ts` — `plan-mdx.ts` re-imports them so nothing else there changes\n * and stored `.mdx` files round-trip the same.\n */\n\n/* -------------------------------------------------------------------------- */\n/* Serialize-side encoder primitives (moved verbatim from plan-mdx.ts) */\n/* -------------------------------------------------------------------------- */\n\nexport function jsonExpression(value: unknown): string {\n return JSON.stringify(value, null, 2);\n}\n\nexport function escapeAttr(value: string): string {\n return value\n .replace(/&/g, \"&amp;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\");\n}\n\n/**\n * Encode a single attribute. Returns \"\" (the attribute is dropped) for\n * undefined/null; a bare/`={false}` flag for booleans; `={n}` for numbers; a\n * quoted string when it matches the safe charset and is short, else a JSON\n * expression. Objects/arrays always serialize as a JSON expression.\n */\nexport function prop(name: string, value: unknown): string {\n if (value === undefined || value === null) return \"\";\n if (typeof value === \"boolean\") {\n return value ? ` ${name}` : ` ${name}={false}`;\n }\n if (typeof value === \"number\") return ` ${name}={${value}}`;\n if (typeof value === \"string\") {\n if (/^[\\w .:/@#,+()[\\]-]+$/.test(value) && value.length < 140) {\n return ` ${name}=\"${escapeAttr(value)}\"`;\n }\n return ` ${name}={${jsonExpression(value)}}`;\n }\n return ` ${name}={${jsonExpression(value)}}`;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Parse-side attribute resolution (moved verbatim from plan-mdx.ts) */\n/* -------------------------------------------------------------------------- */\n\n/** Minimal MDX AST node shape (subset of the remark-mdx jsx element). */\nexport type MdxAttrNode = {\n type: string;\n name?: string;\n value?: string | null | MdxAttrExpression;\n};\n\ntype MdxAttrExpression = {\n type: string;\n value: string;\n data?: unknown;\n};\n\ntype EstreeNode = {\n type: string;\n value?: unknown;\n name?: string;\n expression?: EstreeNode;\n body?: EstreeNode[];\n elements?: Array<EstreeNode | null>;\n properties?: EstreeNode[];\n key?: EstreeNode;\n computed?: boolean;\n argument?: EstreeNode;\n operator?: string;\n};\n\nexport type MdxJsxNode = {\n type: string;\n name?: string;\n attributes?: MdxAttrNode[];\n children?: unknown[];\n [key: string]: unknown;\n};\n\nfunction findAttribute(\n node: MdxJsxNode,\n name: string,\n): MdxAttrNode | undefined {\n return node.attributes?.find(\n (attr) => attr.type === \"mdxJsxAttribute\" && attr.name === name,\n );\n}\n\nexport function attributeValue(attr: MdxAttrNode | undefined): unknown {\n if (!attr) return undefined;\n if (attr.value === null || attr.value === undefined) return true;\n if (typeof attr.value === \"string\") return attr.value;\n const astValue = literalExpressionValue(attr.value);\n if (astValue !== undefined) return astValue;\n const expression = attr.value.value.trim();\n if (!expression) return undefined;\n if (expression === \"undefined\") return undefined;\n try {\n return JSON.parse(expression);\n } catch {\n throw new Error(\n `Unsupported MDX attribute expression for \"${attr.name}\": {${expression}}. Use literal values or valid JSON.`,\n );\n }\n}\n\nfunction literalExpressionValue(expression: MdxAttrExpression): unknown {\n const estree = (expression.data as { estree?: EstreeNode } | undefined)\n ?.estree;\n const statement = estree?.body?.[0];\n if (!statement || statement.type !== \"ExpressionStatement\") return undefined;\n return literalNodeValue(statement.expression);\n}\n\nfunction literalNodeValue(node: EstreeNode | undefined | null): unknown {\n if (!node) return undefined;\n if (node.type === \"Literal\") return node.value;\n if (node.type === \"ArrayExpression\") {\n return (node.elements ?? []).map((item) => literalNodeValue(item));\n }\n if (node.type === \"ObjectExpression\") {\n const out: Record<string, unknown> = {};\n for (const property of node.properties ?? []) {\n if (property.type !== \"Property\" || property.computed) return undefined;\n const key = property.key;\n const rawKey =\n key?.type === \"Identifier\"\n ? key.name\n : key?.type === \"Literal\" && typeof key.value === \"string\"\n ? key.value\n : undefined;\n if (!rawKey) return undefined;\n const value = literalNodeValue(property.value as EstreeNode | undefined);\n if (value !== undefined) out[rawKey] = value;\n }\n return out;\n }\n if (node.type === \"UnaryExpression\") {\n const value = literalNodeValue(node.argument);\n if (typeof value !== \"number\") return undefined;\n if (node.operator === \"-\") return -value;\n if (node.operator === \"+\") return value;\n }\n if (node.type === \"Identifier\") {\n if (node.name === \"undefined\") return undefined;\n if (node.name === \"NaN\") return Number.NaN;\n if (node.name === \"Infinity\") return Infinity;\n }\n return undefined;\n}\n\n/** Build a {@link BlockAttrReader} bound to one parsed JSX node. */\nexport function createAttrReader(node: MdxJsxNode): BlockAttrReader {\n const read = (name: string) => attributeValue(findAttribute(node, name));\n return {\n raw: read,\n string(name) {\n const value = read(name);\n return typeof value === \"string\" ? value : undefined;\n },\n number(name) {\n const value = read(name);\n return typeof value === \"number\" ? value : undefined;\n },\n bool(name) {\n const value = read(name);\n return typeof value === \"boolean\" ? value : undefined;\n },\n array(name) {\n const value = read(name);\n return Array.isArray(value) ? (value as never[]) : undefined;\n },\n object(name) {\n const value = read(name);\n return value && typeof value === \"object\" ? (value as never) : undefined;\n },\n };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Registry serialize / parse */\n/* -------------------------------------------------------------------------- */\n\n/** The base-attribute + body shape every block carries. */\nexport interface SerializableBlock {\n id: string;\n title?: string;\n summary?: string;\n editable?: boolean;\n data: unknown;\n}\n\n/** Base block attributes parsed from a node, before the type-specific data. */\nexport interface ParsedBlockBase {\n id: string;\n title?: string;\n summary?: string;\n editable?: boolean;\n}\n\n/**\n * Serialize a block to its MDX element using its spec. Byte output MUST match\n * the legacy `serializeBlock` for every converted block: base attrs\n * (`id,title,summary,editable`) first, then the spec's `toAttrs` in insertion\n * order, then either nested children, prose children, or self-closing.\n */\nexport function serializeSpecBlock(\n spec: BlockSpec<any>,\n block: SerializableBlock,\n): string {\n const base =\n prop(\"id\", block.id) +\n prop(\"title\", block.title) +\n prop(\"summary\", block.summary) +\n prop(\"editable\", block.editable);\n\n const attrs = spec.mdx.toAttrs(block.data);\n const childrenField = spec.mdx.childrenField;\n const attrStr = Object.entries(attrs)\n .filter(([key]) => key !== childrenField)\n .map(([key, value]) => prop(key, value as MdxAttrValue | undefined))\n .join(\"\");\n\n const tag = spec.mdx.tag;\n\n // Custom nested-MDX children (e.g. wireframe Screen/kit tree).\n if (spec.mdx.serializeChildren) {\n return `<${tag}${base}${attrStr}>\\n${spec.mdx.serializeChildren(block.data)}\\n</${tag}>`;\n }\n\n // Prose children (rich-text, callout): body is a trimmed markdown string.\n if (childrenField) {\n const body = String(\n (block.data as Record<string, unknown>)[childrenField] ?? \"\",\n ).trim();\n return `<${tag}${base}${attrStr}>\\n\\n${body}\\n\\n</${tag}>`;\n }\n\n // Self-closing structured block.\n return `<${tag}${base}${attrStr} />`;\n}\n\n/**\n * Parse one MDX JSX node into a block via the registry, if its tag is\n * registered. Returns `null` for unregistered tags so the caller can fall back\n * to its legacy parser. `base` is the already-extracted id/title/summary/\n * editable; `children` is the stringified prose children.\n */\nexport function parseSpecBlock(\n registry: BlockRegistry,\n node: MdxJsxNode,\n base: ParsedBlockBase,\n children: string,\n idContext: string,\n): { type: string; data: unknown } | null {\n const tag = node.name;\n if (!tag) return null;\n const spec = registry.getByTag(tag);\n if (!spec) return null;\n\n const reader = createAttrReader(node);\n let data: unknown;\n if (spec.mdx.parseChildren) {\n const fromAttrs = spec.mdx.fromAttrs(reader, children);\n const fromChildren = spec.mdx.parseChildren(\n node.children ?? [],\n `${idContext}-${base.id}`,\n );\n data = { ...(fromAttrs as object), ...(fromChildren as object) };\n } else {\n data = spec.mdx.fromAttrs(reader, children);\n }\n return { type: spec.type, data };\n}\n"]}
1
+ {"version":3,"file":"mdx.js","sourceRoot":"","sources":["../../../src/client/blocks/mdx.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,KAAc;IAC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IAAI,CAAC,GAAG,CAAC,aAAa,CACzC,IAAI,CAAC,QAAQ,IAAI,EAAE,EACnB,GAAG,SAAS,IAAI,IAAI,CAAC,EAAE,EAAE,CAC1B,CAAC;QACF,IAAI,GAAG,EAAE,GAAI,SAAoB,EAAE,GAAI,YAAuB,EAAE,CAAC;IACnE,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import type { BlockSpec, BlockAttrReader, MdxAttrValue } from \"./types.js\";\nimport type { BlockRegistry } from \"./registry.js\";\n\n/**\n * Registry-driven MDX serialize/parse, plus the shared encoder primitives that\n * are the round-trip contract. This module is React-free so the server MDX\n * adapter (`plan-mdx.ts`) and the agent schema export can import it. The encoder\n * + estree literal walker are kept BYTE-FOR-BYTE identical to the originals in\n * `plan-mdx.ts` — `plan-mdx.ts` re-imports them so nothing else there changes\n * and stored `.mdx` files round-trip the same.\n */\n\n/* -------------------------------------------------------------------------- */\n/* Serialize-side encoder primitives (moved verbatim from plan-mdx.ts) */\n/* -------------------------------------------------------------------------- */\n\nexport function jsonExpression(value: unknown): string {\n return JSON.stringify(value, null, 2);\n}\n\nexport function escapeAttr(value: string): string {\n return value\n .replace(/&/g, \"&amp;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\");\n}\n\n/**\n * Encode a single attribute. Returns \"\" (the attribute is dropped) for\n * undefined/null; a bare/`={false}` flag for booleans; `={n}` for numbers; a\n * quoted string when it matches the safe charset and is short, else a JSON\n * expression. Objects/arrays always serialize as a JSON expression.\n */\nexport function prop(name: string, value: unknown): string {\n if (value === undefined || value === null) return \"\";\n if (typeof value === \"boolean\") {\n return value ? ` ${name}` : ` ${name}={false}`;\n }\n if (typeof value === \"number\") return ` ${name}={${value}}`;\n if (typeof value === \"string\") {\n if (/^[\\w .:/@#,+()[\\]-]+$/.test(value) && value.length < 140) {\n return ` ${name}=\"${escapeAttr(value)}\"`;\n }\n return ` ${name}={${jsonExpression(value)}}`;\n }\n return ` ${name}={${jsonExpression(value)}}`;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Parse-side attribute resolution (moved verbatim from plan-mdx.ts) */\n/* -------------------------------------------------------------------------- */\n\n/** Minimal MDX AST node shape (subset of the remark-mdx jsx element). */\nexport type MdxAttrNode = {\n type: string;\n name?: string;\n value?: string | null | MdxAttrExpression;\n};\n\ntype MdxAttrExpression = {\n type: string;\n value: string;\n data?: unknown;\n};\n\ntype EstreeTemplateElement = {\n type: string;\n value?: { cooked?: string | null; raw?: string };\n};\n\ntype EstreeNode = {\n type: string;\n value?: unknown;\n name?: string;\n expression?: EstreeNode;\n body?: EstreeNode[];\n elements?: Array<EstreeNode | null>;\n properties?: EstreeNode[];\n key?: EstreeNode;\n computed?: boolean;\n argument?: EstreeNode;\n operator?: string;\n quasis?: EstreeTemplateElement[];\n expressions?: EstreeNode[];\n};\n\nexport type MdxJsxNode = {\n type: string;\n name?: string;\n attributes?: MdxAttrNode[];\n children?: unknown[];\n [key: string]: unknown;\n};\n\nfunction findAttribute(\n node: MdxJsxNode,\n name: string,\n): MdxAttrNode | undefined {\n return node.attributes?.find(\n (attr) => attr.type === \"mdxJsxAttribute\" && attr.name === name,\n );\n}\n\nexport function attributeValue(attr: MdxAttrNode | undefined): unknown {\n if (!attr) return undefined;\n if (attr.value === null || attr.value === undefined) return true;\n if (typeof attr.value === \"string\") return attr.value;\n const astValue = literalExpressionValue(attr.value);\n if (astValue !== undefined) return astValue;\n const expression = attr.value.value.trim();\n if (!expression) return undefined;\n if (expression === \"undefined\") return undefined;\n try {\n return JSON.parse(expression);\n } catch {\n throw new Error(\n `Unsupported MDX attribute expression for \"${attr.name}\": {${expression}}. Use literal values or valid JSON.`,\n );\n }\n}\n\nfunction literalExpressionValue(expression: MdxAttrExpression): unknown {\n const estree = (expression.data as { estree?: EstreeNode } | undefined)\n ?.estree;\n const statement = estree?.body?.[0];\n if (!statement || statement.type !== \"ExpressionStatement\") return undefined;\n return literalNodeValue(statement.expression);\n}\n\nfunction literalNodeValue(node: EstreeNode | undefined | null): unknown {\n if (!node) return undefined;\n if (node.type === \"Literal\") return node.value;\n if (node.type === \"TemplateLiteral\") {\n // A template literal WITH `${…}` interpolations can't be evaluated\n // statically — fail loudly so the import errors instead of falling through\n // to a confusing JSON parse error or silently dropping the attribute.\n if ((node.expressions?.length ?? 0) > 0) {\n throw new Error(\n \"Template literal attribute values may not contain ${…} expressions; use a static string.\",\n );\n }\n // A template literal with no expressions is a static string:\n // `<div>hi</div>` → \"<div>hi</div>\".\n return node.quasis?.[0]?.value?.cooked ?? \"\";\n }\n if (node.type === \"ArrayExpression\") {\n return (node.elements ?? []).map((item) => literalNodeValue(item));\n }\n if (node.type === \"ObjectExpression\") {\n const out: Record<string, unknown> = {};\n for (const property of node.properties ?? []) {\n if (property.type !== \"Property\" || property.computed) return undefined;\n const key = property.key;\n const rawKey =\n key?.type === \"Identifier\"\n ? key.name\n : key?.type === \"Literal\" && typeof key.value === \"string\"\n ? key.value\n : undefined;\n if (!rawKey) return undefined;\n const value = literalNodeValue(property.value as EstreeNode | undefined);\n if (value !== undefined) out[rawKey] = value;\n }\n return out;\n }\n if (node.type === \"UnaryExpression\") {\n const value = literalNodeValue(node.argument);\n if (typeof value !== \"number\") return undefined;\n if (node.operator === \"-\") return -value;\n if (node.operator === \"+\") return value;\n }\n if (node.type === \"Identifier\") {\n if (node.name === \"undefined\") return undefined;\n if (node.name === \"NaN\") return Number.NaN;\n if (node.name === \"Infinity\") return Infinity;\n }\n return undefined;\n}\n\n/** Build a {@link BlockAttrReader} bound to one parsed JSX node. */\nexport function createAttrReader(node: MdxJsxNode): BlockAttrReader {\n const read = (name: string) => attributeValue(findAttribute(node, name));\n return {\n raw: read,\n string(name) {\n const value = read(name);\n return typeof value === \"string\" ? value : undefined;\n },\n number(name) {\n const value = read(name);\n return typeof value === \"number\" ? value : undefined;\n },\n bool(name) {\n const value = read(name);\n return typeof value === \"boolean\" ? value : undefined;\n },\n array(name) {\n const value = read(name);\n return Array.isArray(value) ? (value as never[]) : undefined;\n },\n object(name) {\n const value = read(name);\n return value && typeof value === \"object\" ? (value as never) : undefined;\n },\n };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Registry serialize / parse */\n/* -------------------------------------------------------------------------- */\n\n/** The base-attribute + body shape every block carries. */\nexport interface SerializableBlock {\n id: string;\n title?: string;\n summary?: string;\n editable?: boolean;\n data: unknown;\n}\n\n/** Base block attributes parsed from a node, before the type-specific data. */\nexport interface ParsedBlockBase {\n id: string;\n title?: string;\n summary?: string;\n editable?: boolean;\n}\n\n/**\n * Serialize a block to its MDX element using its spec. Byte output MUST match\n * the legacy `serializeBlock` for every converted block: base attrs\n * (`id,title,summary,editable`) first, then the spec's `toAttrs` in insertion\n * order, then either nested children, prose children, or self-closing.\n */\nexport function serializeSpecBlock(\n spec: BlockSpec<any>,\n block: SerializableBlock,\n): string {\n const base =\n prop(\"id\", block.id) +\n prop(\"title\", block.title) +\n prop(\"summary\", block.summary) +\n prop(\"editable\", block.editable);\n\n const attrs = spec.mdx.toAttrs(block.data);\n const childrenField = spec.mdx.childrenField;\n const attrStr = Object.entries(attrs)\n .filter(([key]) => key !== childrenField)\n .map(([key, value]) => prop(key, value as MdxAttrValue | undefined))\n .join(\"\");\n\n const tag = spec.mdx.tag;\n\n // Custom nested-MDX children (e.g. wireframe Screen/kit tree).\n if (spec.mdx.serializeChildren) {\n return `<${tag}${base}${attrStr}>\\n${spec.mdx.serializeChildren(block.data)}\\n</${tag}>`;\n }\n\n // Prose children (rich-text, callout): body is a trimmed markdown string.\n if (childrenField) {\n const body = String(\n (block.data as Record<string, unknown>)[childrenField] ?? \"\",\n ).trim();\n return `<${tag}${base}${attrStr}>\\n\\n${body}\\n\\n</${tag}>`;\n }\n\n // Self-closing structured block.\n return `<${tag}${base}${attrStr} />`;\n}\n\n/**\n * Parse one MDX JSX node into a block via the registry, if its tag is\n * registered. Returns `null` for unregistered tags so the caller can fall back\n * to its legacy parser. `base` is the already-extracted id/title/summary/\n * editable; `children` is the stringified prose children.\n */\nexport function parseSpecBlock(\n registry: BlockRegistry,\n node: MdxJsxNode,\n base: ParsedBlockBase,\n children: string,\n idContext: string,\n): { type: string; data: unknown } | null {\n const tag = node.name;\n if (!tag) return null;\n const spec = registry.getByTag(tag);\n if (!spec) return null;\n\n const reader = createAttrReader(node);\n let data: unknown;\n if (spec.mdx.parseChildren) {\n const fromAttrs = spec.mdx.fromAttrs(reader, children);\n const fromChildren = spec.mdx.parseChildren(\n node.children ?? [],\n `${idContext}-${base.id}`,\n );\n data = { ...(fromAttrs as object), ...(fromChildren as object) };\n } else {\n data = spec.mdx.fromAttrs(reader, children);\n }\n return { type: spec.type, data };\n}\n"]}
@@ -9,6 +9,15 @@ import type { BlockSpec, BlockPlacement } from "./types.js";
9
9
  export declare class BlockRegistry {
10
10
  private byType;
11
11
  private byTag;
12
+ /**
13
+ * Register (or re-register) a block spec. Last registration wins: re-registering
14
+ * an existing block `type` (or MDX `tag`) OVERRIDES the previous spec rather than
15
+ * throwing. This lets an app intentionally override a shared library block with
16
+ * its own variant, and makes module-level registration idempotent under dev HMR
17
+ * (which can re-run a registration module against a registry that survived the
18
+ * reload). When a re-registered type changes its MDX tag, the stale tag mapping
19
+ * is dropped so `getByTag` can't return an orphaned spec.
20
+ */
12
21
  register(spec: BlockSpec<any>): void;
13
22
  get(type: string): BlockSpec<any> | undefined;
14
23
  getByTag(tag: string): BlockSpec<any> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5D;;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C,GAAG,CAAC,GAAG,SAAS;IAIjD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B,+EAA+E;IAC/E,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC;IAInB;;;;;;OAMG;IACH,qBAAqB,IAAI,GAAG,CAAC,MAAM,CAAC;IAQpC,8DAA8D;IAC9D,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE;CAMnD;AAED,0CAA0C;AAC1C,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,GACtB,IAAI,CAEN"}
@@ -8,12 +8,19 @@
8
8
  export class BlockRegistry {
9
9
  byType = new Map();
10
10
  byTag = new Map();
11
+ /**
12
+ * Register (or re-register) a block spec. Last registration wins: re-registering
13
+ * an existing block `type` (or MDX `tag`) OVERRIDES the previous spec rather than
14
+ * throwing. This lets an app intentionally override a shared library block with
15
+ * its own variant, and makes module-level registration idempotent under dev HMR
16
+ * (which can re-run a registration module against a registry that survived the
17
+ * reload). When a re-registered type changes its MDX tag, the stale tag mapping
18
+ * is dropped so `getByTag` can't return an orphaned spec.
19
+ */
11
20
  register(spec) {
12
- if (this.byType.has(spec.type)) {
13
- throw new Error(`Block type "${spec.type}" is already registered.`);
14
- }
15
- if (this.byTag.has(spec.mdx.tag)) {
16
- throw new Error(`Block MDX tag "${spec.mdx.tag}" is already registered.`);
21
+ const prevForType = this.byType.get(spec.type);
22
+ if (prevForType && prevForType.mdx.tag !== spec.mdx.tag) {
23
+ this.byTag.delete(prevForType.mdx.tag);
17
24
  }
18
25
  this.byType.set(spec.type, spec);
19
26
  this.byTag.set(spec.mdx.tag, spec);
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/client/blocks/registry.ts"],"names":[],"mappings":"AAEA;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C;IAED;;;;;;OAMG;IACH,qBAAqB;QACnB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;QAChC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,IAAI,IAAI,CAAC,gBAAgB;gBAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,8DAA8D;IAC9D,IAAI,CAAC,SAA0B;QAC7B,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACtC,OAAO,SAAS;YACd,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC1D,CAAC,CAAC,GAAG,CAAC;IACV,CAAC;CACF;AAED,0CAA0C;AAC1C,MAAM,UAAU,cAAc,CAC5B,QAAuB,EACvB,KAAuB;IAEvB,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { BlockSpec, BlockPlacement } from \"./types.js\";\n\n/**\n * In-memory block registry. Holds two lookups: by runtime `type` (render +\n * serialize side) and by MDX `tag` (parse side). The registry is a plain object\n * usable both inside React (via the context provider) and outside it (the\n * server MDX serializer/parser, agent schema export) — mirroring how the legacy\n * `BLOCK_COMPONENTS` set and `serializeBlock`/`parseBlock` are plain functions.\n */\nexport class BlockRegistry {\n private byType = new Map<string, BlockSpec<any>>();\n private byTag = new Map<string, BlockSpec<any>>();\n\n register(spec: BlockSpec<any>): void {\n if (this.byType.has(spec.type)) {\n throw new Error(`Block type \"${spec.type}\" is already registered.`);\n }\n if (this.byTag.has(spec.mdx.tag)) {\n throw new Error(`Block MDX tag \"${spec.mdx.tag}\" is already registered.`);\n }\n this.byType.set(spec.type, spec);\n this.byTag.set(spec.mdx.tag, spec);\n }\n\n get(type: string): BlockSpec<any> | undefined {\n return this.byType.get(type);\n }\n\n getByTag(tag: string): BlockSpec<any> | undefined {\n return this.byTag.get(tag);\n }\n\n has(type: string): boolean {\n return this.byType.has(type);\n }\n\n hasTag(tag: string): boolean {\n return this.byTag.has(tag);\n }\n\n /** All registered MDX tags — replaces the hardcoded `BLOCK_COMPONENTS` set. */\n tags(): Set<string> {\n return new Set(this.byTag.keys());\n }\n\n /**\n * The set of registered block `type`s whose specs declare\n * `notionCompatible: true` — i.e. they round-trip to Notion-Flavored Markdown\n * and may sync to Notion. Apps use this as the registry-backed part of their\n * Notion gating allowlist; prose-only NFM analogs that are not registry atoms\n * (rich-text, callout) are NOT in here — apps union those in separately.\n */\n notionCompatibleTypes(): Set<string> {\n const types = new Set<string>();\n for (const spec of this.byType.values()) {\n if (spec.notionCompatible) types.add(spec.type);\n }\n return types;\n }\n\n /** All registered specs, optionally filtered by placement. */\n list(placement?: BlockPlacement): BlockSpec<any>[] {\n const all = [...this.byType.values()];\n return placement\n ? all.filter((spec) => spec.placement.includes(placement))\n : all;\n }\n}\n\n/** Register a batch of specs in order. */\nexport function registerBlocks(\n registry: BlockRegistry,\n specs: BlockSpec<any>[],\n): void {\n for (const spec of specs) registry.register(spec);\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/client/blocks/registry.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,OAAO,aAAa;IAChB,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAC;IAC3C,KAAK,GAAG,IAAI,GAAG,EAA0B,CAAC;IAElD;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAoB;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,WAAW,IAAI,WAAW,CAA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G,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACtC,OAAO,SAAS;YACd,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC1D,CAAC,CAAC,GAAG,CAAC;IACV,CAAC;CACF;AAED,0CAA0C;AAC1C,MAAM,UAAU,cAAc,CAC5B,QAAuB,EACvB,KAAuB;IAEvB,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import type { BlockSpec, BlockPlacement } from \"./types.js\";\n\n/**\n * In-memory block registry. Holds two lookups: by runtime `type` (render +\n * serialize side) and by MDX `tag` (parse side). The registry is a plain object\n * usable both inside React (via the context provider) and outside it (the\n * server MDX serializer/parser, agent schema export) — mirroring how the legacy\n * `BLOCK_COMPONENTS` set and `serializeBlock`/`parseBlock` are plain functions.\n */\nexport class BlockRegistry {\n private byType = new Map<string, BlockSpec<any>>();\n private byTag = new Map<string, BlockSpec<any>>();\n\n /**\n * Register (or re-register) a block spec. Last registration wins: re-registering\n * an existing block `type` (or MDX `tag`) OVERRIDES the previous spec rather than\n * throwing. This lets an app intentionally override a shared library block with\n * its own variant, and makes module-level registration idempotent under dev HMR\n * (which can re-run a registration module against a registry that survived the\n * reload). When a re-registered type changes its MDX tag, the stale tag mapping\n * is dropped so `getByTag` can't return an orphaned spec.\n */\n register(spec: BlockSpec<any>): void {\n const prevForType = this.byType.get(spec.type);\n if (prevForType && prevForType.mdx.tag !== spec.mdx.tag) {\n this.byTag.delete(prevForType.mdx.tag);\n }\n this.byType.set(spec.type, spec);\n this.byTag.set(spec.mdx.tag, spec);\n }\n\n get(type: string): BlockSpec<any> | undefined {\n return this.byType.get(type);\n }\n\n getByTag(tag: string): BlockSpec<any> | undefined {\n return this.byTag.get(tag);\n }\n\n has(type: string): boolean {\n return this.byType.has(type);\n }\n\n hasTag(tag: string): boolean {\n return this.byTag.has(tag);\n }\n\n /** All registered MDX tags — replaces the hardcoded `BLOCK_COMPONENTS` set. */\n tags(): Set<string> {\n return new Set(this.byTag.keys());\n }\n\n /**\n * The set of registered block `type`s whose specs declare\n * `notionCompatible: true` — i.e. they round-trip to Notion-Flavored Markdown\n * and may sync to Notion. Apps use this as the registry-backed part of their\n * Notion gating allowlist; prose-only NFM analogs that are not registry atoms\n * (rich-text, callout) are NOT in here — apps union those in separately.\n */\n notionCompatibleTypes(): Set<string> {\n const types = new Set<string>();\n for (const spec of this.byType.values()) {\n if (spec.notionCompatible) types.add(spec.type);\n }\n return types;\n }\n\n /** All registered specs, optionally filtered by placement. */\n list(placement?: BlockPlacement): BlockSpec<any>[] {\n const all = [...this.byType.values()];\n return placement\n ? all.filter((spec) => spec.placement.includes(placement))\n : all;\n }\n}\n\n/** Register a batch of specs in order. */\nexport function registerBlocks(\n registry: BlockRegistry,\n specs: BlockSpec<any>[],\n): void {\n for (const spec of specs) registry.register(spec);\n}\n"]}
@@ -21,6 +21,7 @@ export { codeTabsSchema, codeTabsMdx, type CodeTabsData, type CodeTabsTab, } fro
21
21
  export { htmlSchema, htmlMdx, type HtmlBlockData, } from "./library/html.config.js";
22
22
  export { tabsSchema, tabsMdx, type TabsData, type TabsOrientation, type TabsTab, } from "./library/tabs.config.js";
23
23
  export { columnsSchema, columnsMdx, type ColumnsData, type ColumnsColumn, } from "./library/columns.config.js";
24
+ export { calloutSchema, calloutMdx, CALLOUT_TONES, type CalloutData, type CalloutTone, } from "./library/callout.config.js";
24
25
  export { mermaidSchema, mermaidMdx, type MermaidData, } from "./library/mermaid.config.js";
25
26
  export { apiEndpointSchema, apiEndpointMdx, API_ENDPOINT_METHODS, API_PARAM_LOCATIONS, type ApiEndpointData, type ApiEndpointMethod, type ApiEndpointParam, type ApiEndpointRequest, type ApiEndpointResponse, type ApiParamLocation, } from "./library/api-endpoint.config.js";
26
27
  export { dataModelSchema, dataModelMdx, DATA_MODEL_RELATION_KINDS, type DataModelData, type DataModelEntity, type DataModelField, type DataModelRelation, type DataModelRelationKind, } from "./library/data-model.config.js";
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,EACX,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC9B,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAMpB,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,KAAK,2BAA2B,GACjC,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,QAAQ,EACR,KAAK,SAAS,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,UAAU,EACV,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":"server.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,EACX,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC9B,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAMpB,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,KAAK,2BAA2B,GACjC,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,QAAQ,EACR,KAAK,SAAS,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,UAAU,EACV,OAAO,EACP,KAAK,aAAa,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,OAAO,EACP,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,OAAO,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,EACb,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,aAAa,EACb,UAAU,EACV,KAAK,WAAW,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,EACzB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,UAAU,EACV,OAAO,EACP,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,KAAK,gBAAgB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,KAAK,eAAe,GACrB,MAAM,kCAAkC,CAAC"}
@@ -28,6 +28,7 @@ export { codeTabsSchema, codeTabsMdx, } from "./library/code-tabs.config.js";
28
28
  export { htmlSchema, htmlMdx, } from "./library/html.config.js";
29
29
  export { tabsSchema, tabsMdx, } from "./library/tabs.config.js";
30
30
  export { columnsSchema, columnsMdx, } from "./library/columns.config.js";
31
+ export { calloutSchema, calloutMdx, CALLOUT_TONES, } from "./library/callout.config.js";
31
32
  // Dev-doc block library — React-free schema + MDX config only. The React
32
33
  // `Read`/`Edit` live in the matching `./library/<Name>Block.tsx` (imported from
33
34
  // the full `@agent-native/core/blocks` entry), never from here.
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/client/blocks/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,GAOZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GAKf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAE/B,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAE5B,MAAM,2BAA2B,CAAC;AAEnC,0EAA0E;AAC1E,0EAA0E;AAC1E,uDAAuD;AACvD,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,QAAQ,GAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,UAAU,EACV,OAAO,GAER,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,OAAO,GAIR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,EACb,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,yEAAyE;AACzE,gFAAgF;AAChF,gEAAgE;AAChE,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,GAOpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAM1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,UAAU,EACV,OAAO,GAGR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,GAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAGjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,kCAAkC,CAAC","sourcesContent":["/**\n * `@agent-native/core/blocks/server` — the React-free subset of the block\n * registry for server / agent code (MDX serialize/parse, the registry, schema\n * introspection, the `markdown()` helper, agent schema export). Importing this\n * entry never pulls React into the server bundle.\n *\n * A `BlockSpec` carries React (`Read`/`Edit`) and pure (`schema`/`mdx`) parts in\n * the same object; the server path only touches `spec.schema` / `spec.mdx`. The\n * app's registry module is shared by browser and server, but the server only\n * ever calls these React-free functions on it.\n */\n\nexport {\n defineBlock,\n type BlockSpec,\n type BlockPlacement,\n type BlockMdxConfig,\n type BlockAttrReader,\n type MdxAttrValue,\n type NestedBlock,\n} from \"./types.js\";\n\nexport { BlockRegistry, registerBlocks } from \"./registry.js\";\n\nexport {\n markdown,\n richtext,\n introspect,\n type FieldKind,\n type FieldDescriptor,\n} from \"./schema-form/introspect.js\";\n\nexport {\n prop,\n escapeAttr,\n jsonExpression,\n attributeValue,\n createAttrReader,\n serializeSpecBlock,\n parseSpecBlock,\n type MdxJsxNode,\n type MdxAttrNode,\n type SerializableBlock,\n type ParsedBlockBase,\n} from \"./mdx.js\";\n\nexport {\n describeBlocksForAgent,\n renderBlockVocabularyReference,\n type BlockAgentDoc,\n} from \"./agent.js\";\n\n// Standard library registration (React-free). Server / shared registries call\n// `registerLibraryBlockConfigs(registry)` to register the whole standard library\n// as `Read: () => null` config stubs in one place, then add their app-specific\n// block configs on top. `libraryBlockConfigs` is the underlying ordered array.\nexport {\n libraryBlockConfigs,\n registerLibraryBlockConfigs,\n type LibraryBlockConfigOverrides,\n} from \"./library/server-specs.js\";\n\n// Standard block library — React-free schema + MDX config only. The React\n// `Read`/`Edit` live in `./library/checklist.tsx` (imported from the full\n// `@agent-native/core/blocks` entry), never from here.\nexport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n type ChecklistItem,\n} from \"./library/checklist.config.js\";\nexport {\n tableSchema,\n tableMdx,\n type TableData,\n} from \"./library/table.config.js\";\nexport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n type CodeTabsTab,\n} from \"./library/code-tabs.config.js\";\nexport {\n htmlSchema,\n htmlMdx,\n type HtmlBlockData,\n} from \"./library/html.config.js\";\nexport {\n tabsSchema,\n tabsMdx,\n type TabsData,\n type TabsOrientation,\n type TabsTab,\n} from \"./library/tabs.config.js\";\nexport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n type ColumnsColumn,\n} from \"./library/columns.config.js\";\n\n// Dev-doc block library — React-free schema + MDX config only. The React\n// `Read`/`Edit` live in the matching `./library/<Name>Block.tsx` (imported from\n// the full `@agent-native/core/blocks` entry), never from here.\nexport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./library/mermaid.config.js\";\nexport {\n apiEndpointSchema,\n apiEndpointMdx,\n API_ENDPOINT_METHODS,\n API_PARAM_LOCATIONS,\n type ApiEndpointData,\n type ApiEndpointMethod,\n type ApiEndpointParam,\n type ApiEndpointRequest,\n type ApiEndpointResponse,\n type ApiParamLocation,\n} from \"./library/api-endpoint.config.js\";\nexport {\n dataModelSchema,\n dataModelMdx,\n DATA_MODEL_RELATION_KINDS,\n type DataModelData,\n type DataModelEntity,\n type DataModelField,\n type DataModelRelation,\n type DataModelRelationKind,\n} from \"./library/data-model.config.js\";\nexport {\n diffSchema,\n diffMdx,\n type DiffData,\n type DiffMode,\n} from \"./library/diff.config.js\";\nexport {\n fileTreeSchema,\n fileTreeMdx,\n FILE_TREE_CHANGES,\n type FileTreeData,\n type FileTreeEntry,\n type FileTreeChange,\n} from \"./library/file-tree.config.js\";\nexport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./library/json-explorer.config.js\";\nexport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n type AnnotatedCodeAnnotation,\n} from \"./library/annotated-code.config.js\";\nexport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./library/openapi-spec.config.js\";\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/client/blocks/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,GAOZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,GAGX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GAKf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAE/B,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAE5B,MAAM,2BAA2B,CAAC;AAEnC,0EAA0E;AAC1E,0EAA0E;AAC1E,uDAAuD;AACvD,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,EACX,QAAQ,GAET,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,UAAU,EACV,OAAO,GAER,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,OAAO,GAIR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,EACb,UAAU,GAGX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,GAGd,MAAM,6BAA6B,CAAC;AAErC,yEAAyE;AACzE,gFAAgF;AAChF,gEAAgE;AAChE,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,GAOpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAM1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,UAAU,EACV,OAAO,GAGR,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,GAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAGjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,kCAAkC,CAAC","sourcesContent":["/**\n * `@agent-native/core/blocks/server` — the React-free subset of the block\n * registry for server / agent code (MDX serialize/parse, the registry, schema\n * introspection, the `markdown()` helper, agent schema export). Importing this\n * entry never pulls React into the server bundle.\n *\n * A `BlockSpec` carries React (`Read`/`Edit`) and pure (`schema`/`mdx`) parts in\n * the same object; the server path only touches `spec.schema` / `spec.mdx`. The\n * app's registry module is shared by browser and server, but the server only\n * ever calls these React-free functions on it.\n */\n\nexport {\n defineBlock,\n type BlockSpec,\n type BlockPlacement,\n type BlockMdxConfig,\n type BlockAttrReader,\n type MdxAttrValue,\n type NestedBlock,\n} from \"./types.js\";\n\nexport { BlockRegistry, registerBlocks } from \"./registry.js\";\n\nexport {\n markdown,\n richtext,\n introspect,\n type FieldKind,\n type FieldDescriptor,\n} from \"./schema-form/introspect.js\";\n\nexport {\n prop,\n escapeAttr,\n jsonExpression,\n attributeValue,\n createAttrReader,\n serializeSpecBlock,\n parseSpecBlock,\n type MdxJsxNode,\n type MdxAttrNode,\n type SerializableBlock,\n type ParsedBlockBase,\n} from \"./mdx.js\";\n\nexport {\n describeBlocksForAgent,\n renderBlockVocabularyReference,\n type BlockAgentDoc,\n} from \"./agent.js\";\n\n// Standard library registration (React-free). Server / shared registries call\n// `registerLibraryBlockConfigs(registry)` to register the whole standard library\n// as `Read: () => null` config stubs in one place, then add their app-specific\n// block configs on top. `libraryBlockConfigs` is the underlying ordered array.\nexport {\n libraryBlockConfigs,\n registerLibraryBlockConfigs,\n type LibraryBlockConfigOverrides,\n} from \"./library/server-specs.js\";\n\n// Standard block library — React-free schema + MDX config only. The React\n// `Read`/`Edit` live in `./library/checklist.tsx` (imported from the full\n// `@agent-native/core/blocks` entry), never from here.\nexport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n type ChecklistItem,\n} from \"./library/checklist.config.js\";\nexport {\n tableSchema,\n tableMdx,\n type TableData,\n} from \"./library/table.config.js\";\nexport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n type CodeTabsTab,\n} from \"./library/code-tabs.config.js\";\nexport {\n htmlSchema,\n htmlMdx,\n type HtmlBlockData,\n} from \"./library/html.config.js\";\nexport {\n tabsSchema,\n tabsMdx,\n type TabsData,\n type TabsOrientation,\n type TabsTab,\n} from \"./library/tabs.config.js\";\nexport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n type ColumnsColumn,\n} from \"./library/columns.config.js\";\nexport {\n calloutSchema,\n calloutMdx,\n CALLOUT_TONES,\n type CalloutData,\n type CalloutTone,\n} from \"./library/callout.config.js\";\n\n// Dev-doc block library — React-free schema + MDX config only. The React\n// `Read`/`Edit` live in the matching `./library/<Name>Block.tsx` (imported from\n// the full `@agent-native/core/blocks` entry), never from here.\nexport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./library/mermaid.config.js\";\nexport {\n apiEndpointSchema,\n apiEndpointMdx,\n API_ENDPOINT_METHODS,\n API_PARAM_LOCATIONS,\n type ApiEndpointData,\n type ApiEndpointMethod,\n type ApiEndpointParam,\n type ApiEndpointRequest,\n type ApiEndpointResponse,\n type ApiParamLocation,\n} from \"./library/api-endpoint.config.js\";\nexport {\n dataModelSchema,\n dataModelMdx,\n DATA_MODEL_RELATION_KINDS,\n type DataModelData,\n type DataModelEntity,\n type DataModelField,\n type DataModelRelation,\n type DataModelRelationKind,\n} from \"./library/data-model.config.js\";\nexport {\n diffSchema,\n diffMdx,\n type DiffData,\n type DiffMode,\n} from \"./library/diff.config.js\";\nexport {\n fileTreeSchema,\n fileTreeMdx,\n FILE_TREE_CHANGES,\n type FileTreeData,\n type FileTreeEntry,\n type FileTreeChange,\n} from \"./library/file-tree.config.js\";\nexport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./library/json-explorer.config.js\";\nexport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n type AnnotatedCodeAnnotation,\n} from \"./library/annotated-code.config.js\";\nexport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./library/openapi-spec.config.js\";\n"]}
@@ -186,6 +186,14 @@ export interface BlockRenderContext {
186
186
  blockSummary?: string;
187
187
  blockData?: unknown;
188
188
  }) => React.ReactNode;
189
+ /**
190
+ * Submit a respondent's answers from a `question-form` / `visual-questions`
191
+ * block back to the host. The app decides how to route the summary (e.g. send
192
+ * to the inline agent, copy to clipboard). Core blocks call this through the
193
+ * context so they never import app-specific submit wiring; omit it and the
194
+ * block degrades to a no-op submit.
195
+ */
196
+ onQuestionFormSubmit?: (summary: string) => void;
189
197
  }
190
198
  export interface BlockAiFieldActionProps {
191
199
  blockId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/blocks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AAEH,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,EAAE,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACxC,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC;IAClD,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IACjD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAAC,KA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,MAAM,CAAC;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,EAAE,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC;CAC/E;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAE3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/blocks/types.ts"],"names":[],"mappings":"AAmWA,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAQ,IAAsB;IACvD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { FC } from \"react\";\nimport type { ZodType } from \"zod\";\n\n/**\n * Block-registry contract. A `BlockSpec` describes one document block end to end:\n * its data shape (`schema`), how it round-trips to MDX source (`mdx`), how it\n * renders read-only (`Read`) and how it is edited (`Edit`, or an auto-generated\n * schema-driven editor when omitted), where it can be placed (`placement`), and\n * metadata for menus / agent schema export.\n *\n * The registry runs ALONGSIDE existing per-block code (the plan `PlanBlockView`\n * switch + `serializeBlock`/`parseBlock`). Renderers check the registry first;\n * unregistered block types fall through to the legacy code path unchanged. The\n * MDX `tag` and attribute shape for a converted block MUST match the historical\n * encoding (e.g. `<Callout tone>…body…</Callout>`) so stored `.mdx` files still\n * parse byte-compatibly.\n */\n\n/** Where a block can be placed in a document. */\nexport type BlockPlacement = \"block\" | \"inline\";\n\n/**\n * A serialized MDX/NFM attribute value before the shared `prop()` encoder runs.\n * `prop()` decides string-vs-JSON encoding; this is just the value domain.\n */\nexport type MdxAttrValue =\n | string\n | number\n | boolean\n | unknown[]\n | Record<string, unknown>;\n\n/**\n * Type-narrowed reader over the resolved MDX attributes of a parsed block node.\n * The values are already estree/JSON-resolved by the shared attribute reader\n * (the same engine `plan-mdx.ts` uses), so a spec's `fromAttrs` never touches\n * the AST directly.\n */\nexport interface BlockAttrReader {\n string(name: string): string | undefined;\n number(name: string): number | undefined;\n bool(name: string): boolean | undefined;\n array<T = unknown>(name: string): T[] | undefined;\n object<T = unknown>(name: string): T | undefined;\n raw(name: string): unknown;\n}\n\n/**\n * Maps a block's validated data to/from its MDX component representation.\n * `tag` is the JSX component name in source (e.g. \"Callout\"). It MUST match the\n * historical name in `plan-mdx.ts` `BLOCK_COMPONENTS` / stored `.mdx` files or\n * existing plans break.\n */\nexport interface BlockMdxConfig<TData> {\n /** JSX component name in MDX source. Stable contract — never rename. */\n tag: string;\n /**\n * Encode `data` → a flat attribute bag. The registry serializer runs each\n * value through the shared `prop()` encoder (string-vs-JSON heuristic) and\n * preserves insertion order, so write the keys in the exact historical order.\n * Return `undefined` for a key (or omit it) to drop the attribute. When\n * `childrenField` is set, that field is excluded from the attribute bag.\n */\n toAttrs: (data: TData) => Record<string, MdxAttrValue | undefined>;\n /**\n * Decode resolved attributes (+ optional children markdown) → data. Must\n * tolerate missing/partial attributes for backward-compat (mirror today's\n * `?? []` / `?? \"\"` defaults).\n */\n fromAttrs: (attrs: BlockAttrReader, children: string) => TData;\n /**\n * When set, this data field is a markdown string serialized as MDX *children*\n * between the open/close tags (prose-bearing blocks: rich-text, callout)\n * rather than as a prop — so the body survives as real, inline-editable MDX\n * prose in source.\n */\n childrenField?: keyof TData & string;\n /**\n * Opt-in custom children serializer for blocks whose internals are nested MDX\n * components rather than a single markdown string (e.g. wireframe → Screen/kit\n * primitives). When present it overrides `childrenField`. `serializeChildren`\n * returns the raw inner MDX; `parseChildren` receives the child MDX AST nodes.\n */\n serializeChildren?: (data: TData) => string;\n parseChildren?: (childNodes: unknown[], idContext: string) => Partial<TData>;\n}\n\n/**\n * App-injected capabilities. Core blocks stay app-agnostic by taking these\n * rather than importing app services — mirroring `createImageExtension`'s\n * `onImageUpload` injection. Provided via `BlockRegistryProvider`.\n */\nexport interface BlockRenderContext {\n /** Markdown dialect for the auto-editor's rich-text field. */\n dialect?: \"gfm\" | \"nfm\";\n /** Resolve an asset id → displayable URL. */\n resolveAssetSrc?: (assetId: string) => string | undefined;\n /** Open the shared asset picker (returns the chosen asset). */\n pickAsset?: () => Promise<{ assetId: string; url?: string } | null>;\n /** Upload a local file, returns a hosted URL. */\n uploadFile?: (file: File) => Promise<{ url: string; assetId?: string }>;\n /** Call an app action by name (for blocks that fetch live data). */\n callAction?: (name: string, args: unknown) => Promise<unknown>;\n /** Sanitizer for HTML-bearing blocks. Provided by the app/core. */\n sanitizeHtml?: (html: string, css?: string) => string;\n /**\n * Render a markdown string with the app's read-only markdown renderer. Lets a\n * core block (whose `Read` lives in core) defer prose rendering to the app's\n * markdown reader (e.g. the plan `PlanMarkdownReader`) without importing it.\n */\n renderMarkdown?: (\n markdown: string,\n options?: { className?: string },\n ) => React.ReactNode;\n /**\n * Render an inline, editable rich-markdown field. The auto-editor calls this\n * for a `markdown()`-tagged field so the app owns the editor wiring (collab,\n * autosave debounce, dialect) rather than core hardcoding it.\n */\n renderMarkdownEditor?: (props: {\n value: string;\n onChange: (next: string) => void;\n editable: boolean;\n blockId?: string;\n className?: string;\n ariaLabel?: string;\n }) => React.ReactNode;\n /**\n * Render an app-owned edit-by-prompt affordance (\"Describe a change…\") for a focused/editable block\n * field. Core block editors pass the current field value and nearby companion\n * fields; the host app decides how to collect the prompt and route it to the\n * agent sidebar. This keeps reusable core blocks from importing app-specific\n * popover/composer code while still exposing a generic AI edit hook.\n */\n renderAiFieldAction?: (props: BlockAiFieldActionProps) => React.ReactNode;\n /**\n * Render a nested child block through the app's own block dispatcher. Container\n * blocks whose `Read`/`Edit` live in core (e.g. tabs) call this to render each\n * child so the recursion keeps flowing through the SAME app renderer the\n * top-level document uses — registered children render via their spec, and\n * unregistered (not-yet-converted) children still fall through the app's legacy\n * switch. This is the coexistence seam: a core container never has to know\n * about app-specific child block types. Returns `null`/`undefined` when no\n * dispatcher is wired (read-only/SSR-only contexts can omit it).\n */\n renderBlock?: (props: {\n block: NestedBlock;\n /** Commit a replacement for this child block (edit mode only). */\n onChange?: (next: NestedBlock) => void;\n /** Whether the parent container is being edited. */\n editing?: boolean;\n /** Tighten embedded visuals in dense contexts (e.g. tab panes). */\n compactVisuals?: boolean;\n }) => React.ReactNode;\n /**\n * Render a nested editable block list through the host app's document editor.\n * Container blocks such as columns call this for each editable region so slash\n * commands, nested structured blocks, and ordinary prose behave like the\n * top-level document while the container still persists its normalized runtime\n * data. Source adapters may still expose a human-friendly nested MDX form\n * (for example `<Columns><Column>markdown</Column></Columns>`) and normalize it\n * into these block arrays at runtime.\n */\n renderBlocksEditor?: (props: {\n blocks: NestedBlock[];\n onChange: (blocks: NestedBlock[]) => void;\n editable: boolean;\n containerBlockId: string;\n regionId: string;\n regionLabel?: string;\n /** Tighten embedded visuals in dense regions such as tab panes. */\n compactVisuals?: boolean;\n }) => React.ReactNode;\n /**\n * Wrap a block's edit form in an app-provided \"panel\" surface (e.g. a shadcn\n * Popover anchored to the corner edit button) for `editSurface: \"panel\"`\n * blocks. Core renders the rendered `Read` view plus a corner trigger button\n * and the form, then hands them here so the app owns the overlay primitive\n * (core stays shadcn-free, mirroring `renderMarkdownEditor`). When omitted, a\n * panel-mode block falls back to inline editing. `title` is the block label.\n */\n renderEditSurface?: (props: {\n title: string;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n trigger: React.ReactNode;\n children: React.ReactNode;\n /** Metadata for host-provided contextual controls such as the edit-by-prompt CTA. */\n blockId?: string;\n blockType?: string;\n blockTitle?: string;\n blockSummary?: string;\n blockData?: unknown;\n }) => React.ReactNode;\n}\n\nexport interface BlockAiFieldActionProps {\n blockId: string;\n blockType: string;\n blockTitle?: string;\n blockSummary?: string;\n fieldLabel: string;\n fieldValue: string;\n draftScope: string;\n disabled?: boolean;\n /**\n * Human-readable instructions for the host agent prompt. Mention how to patch\n * the block and which sibling fields should be preserved.\n */\n instructions: string;\n companionFields?: Array<{\n label: string;\n value: string;\n language?: string;\n }>;\n}\n\n/**\n * The minimal shape of a nested child block passed to {@link\n * BlockRenderContext.renderBlock}. It mirrors the app's block union loosely (the\n * app casts it back to its own block type) — a discriminating `type`, a stable\n * `id`, optional heading/summary, and the type-specific `data`.\n */\nexport interface NestedBlock {\n type: string;\n id: string;\n title?: string;\n summary?: string;\n data: unknown;\n [key: string]: unknown;\n}\n\nexport interface BlockContainerRegion {\n id: string;\n label?: string;\n blocks: NestedBlock[];\n}\n\nexport interface BlockContainerSpec<TData> {\n regions: (data: TData) => BlockContainerRegion[];\n updateRegion: (data: TData, regionId: string, blocks: NestedBlock[]) => TData;\n addRegion?: (data: TData, afterRegionId?: string) => TData;\n removeRegion?: (data: TData, regionId: string) => TData;\n reorderRegion?: (\n data: TData,\n fromRegionId: string,\n toRegionId: string,\n ) => TData;\n}\n\nexport type BlockDataChangeMeta = {\n containerRegion?: {\n regionId: string;\n blocks: NestedBlock[];\n };\n};\n\n/** Props passed to a block's read-only renderer. */\nexport interface BlockReadProps<TData> {\n data: TData;\n /** Stable block id (for anchors, comment targeting, source patches). */\n blockId: string;\n /** Block heading, when present. */\n title?: string;\n /** Block trailing summary, when present. */\n summary?: string;\n /** Injected app capabilities. */\n ctx: BlockRenderContext;\n}\n\n/** Props passed to a block's editor (custom or schema-generated). */\nexport interface BlockEditProps<TData> {\n data: TData;\n onChange: (next: TData, meta?: BlockDataChangeMeta) => void;\n editable: boolean;\n blockId: string;\n title?: string;\n summary?: string;\n /** Injected app capabilities. */\n ctx: BlockRenderContext;\n}\n\nexport interface BlockSpec<TData = unknown> {\n /** Discriminator. Equals the runtime block `type`. */\n type: string;\n /** Zod schema for `data`. Drives validation AND the schema-auto-editor. */\n schema: ZodType<TData>;\n /** MDX round-trip config. */\n mdx: BlockMdxConfig<TData>;\n /** Read-only renderer (replaces a `PlanBlockView` switch branch / NodeView). */\n Read: FC<BlockReadProps<TData>>;\n /**\n * Optional editor. When omitted, the registry renders the schema-driven\n * `SchemaBlockEditor` generated from `schema`. Supply for full control\n * (wireframe canvas, diagram editor).\n */\n Edit?: FC<BlockEditProps<TData>>;\n /** Allowed placements: `[\"block\"]`, `[\"inline\"]`, or both. */\n placement: BlockPlacement[];\n /**\n * When `true`, this block's data maps to a Notion-Flavored-Markdown (NFM)\n * analog and therefore round-trips into a Notion page. Apps can derive\n * registry-backed Notion allowlists with\n * {@link BlockRegistry.notionCompatibleTypes} instead of hand-maintaining\n * per-app sets. Set it on registry-atom blocks with an NFM counterpart\n * (checklist, table); leave it `false`/undefined on dev-doc blocks\n * (api-endpoint, openapi-spec, data-model, diff, file-tree, json-explorer,\n * annotated-code, mermaid, custom-html, tabs, code-tabs) and visual/plan-only\n * blocks (wireframe, diagram). Prose blocks that aren't registry atoms\n * (rich-text, callout) carry their NFM analog through the prose path, not this\n * flag.\n */\n notionCompatible?: boolean;\n /**\n * How the block is edited in a `block`-placed document:\n * - `\"inline\"` — the `Edit`/auto-form renders in place for direct\n * manipulation of authored content (prose, checklist text, table cells,\n * code bodies). Schema-ish metadata such as tone/type, tab labels,\n * language, density, or structural settings should still be tucked behind a\n * contextual edit/settings affordance inside the custom `Edit`.\n * - `\"panel\"` — the block shows its rendered `Read` view with a corner edit\n * button that opens the `Edit`/auto-form in an app-provided panel (popover).\n * Best for config-driven blocks whose render differs from their props\n * (custom HTML, charts, any user-registered block).\n * - `\"container\"` — the block renders its `Edit` in place, and that editor\n * may call `ctx.renderBlocksEditor` for nested block regions with normal\n * slash commands and nested structured blocks.\n * Defaults to `\"inline\"` when a custom `Edit` is supplied, else `\"panel\"`\n * (auto-form blocks are property forms, ideal for a panel). The app must wire\n * `ctx.renderEditSurface` for `\"panel\"` to take effect; otherwise it falls\n * back to inline.\n */\n editSurface?: \"inline\" | \"panel\" | \"container\";\n /**\n * Optional generic contract for content-bearing container blocks. Keep this\n * runtime-oriented: it describes editable regions over normalized block arrays;\n * source formats can provide readable nested MDX adapters independently.\n */\n container?: BlockContainerSpec<TData>;\n /** Human label for menus + agent schema export. */\n label: string;\n /** Tabler icon component for UI menus (never emoji/robot/sparkle). */\n icon?: FC<{ size?: number; className?: string }>;\n /** One-line description for the agent schema export. */\n description: string;\n /** Optional default `data` factory for slash-menu insertion (an empty block). */\n empty?: () => TData;\n /**\n * Optional block-specific source-patch handlers, generalizing bespoke ops\n * like `update-custom-html`. Keyed by op name; the registry dispatches a\n * matching patch op here. Generic ops (`update-block` shallow-merge) need none.\n */\n patches?: Record<string, (data: TData, op: Record<string, unknown>) => TData>;\n}\n\n/** Identity helper for authoring a spec with full type inference. */\nexport function defineBlock<TData>(spec: BlockSpec<TData>): BlockSpec<TData> {\n return spec;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/blocks/types.ts"],"names":[],"mappings":"AA2WA,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAQ,IAAsB;IACvD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { FC } from \"react\";\nimport type { ZodType } from \"zod\";\n\n/**\n * Block-registry contract. A `BlockSpec` describes one document block end to end:\n * its data shape (`schema`), how it round-trips to MDX source (`mdx`), how it\n * renders read-only (`Read`) and how it is edited (`Edit`, or an auto-generated\n * schema-driven editor when omitted), where it can be placed (`placement`), and\n * metadata for menus / agent schema export.\n *\n * The registry runs ALONGSIDE existing per-block code (the plan `PlanBlockView`\n * switch + `serializeBlock`/`parseBlock`). Renderers check the registry first;\n * unregistered block types fall through to the legacy code path unchanged. The\n * MDX `tag` and attribute shape for a converted block MUST match the historical\n * encoding (e.g. `<Callout tone>…body…</Callout>`) so stored `.mdx` files still\n * parse byte-compatibly.\n */\n\n/** Where a block can be placed in a document. */\nexport type BlockPlacement = \"block\" | \"inline\";\n\n/**\n * A serialized MDX/NFM attribute value before the shared `prop()` encoder runs.\n * `prop()` decides string-vs-JSON encoding; this is just the value domain.\n */\nexport type MdxAttrValue =\n | string\n | number\n | boolean\n | unknown[]\n | Record<string, unknown>;\n\n/**\n * Type-narrowed reader over the resolved MDX attributes of a parsed block node.\n * The values are already estree/JSON-resolved by the shared attribute reader\n * (the same engine `plan-mdx.ts` uses), so a spec's `fromAttrs` never touches\n * the AST directly.\n */\nexport interface BlockAttrReader {\n string(name: string): string | undefined;\n number(name: string): number | undefined;\n bool(name: string): boolean | undefined;\n array<T = unknown>(name: string): T[] | undefined;\n object<T = unknown>(name: string): T | undefined;\n raw(name: string): unknown;\n}\n\n/**\n * Maps a block's validated data to/from its MDX component representation.\n * `tag` is the JSX component name in source (e.g. \"Callout\"). It MUST match the\n * historical name in `plan-mdx.ts` `BLOCK_COMPONENTS` / stored `.mdx` files or\n * existing plans break.\n */\nexport interface BlockMdxConfig<TData> {\n /** JSX component name in MDX source. Stable contract — never rename. */\n tag: string;\n /**\n * Encode `data` → a flat attribute bag. The registry serializer runs each\n * value through the shared `prop()` encoder (string-vs-JSON heuristic) and\n * preserves insertion order, so write the keys in the exact historical order.\n * Return `undefined` for a key (or omit it) to drop the attribute. When\n * `childrenField` is set, that field is excluded from the attribute bag.\n */\n toAttrs: (data: TData) => Record<string, MdxAttrValue | undefined>;\n /**\n * Decode resolved attributes (+ optional children markdown) → data. Must\n * tolerate missing/partial attributes for backward-compat (mirror today's\n * `?? []` / `?? \"\"` defaults).\n */\n fromAttrs: (attrs: BlockAttrReader, children: string) => TData;\n /**\n * When set, this data field is a markdown string serialized as MDX *children*\n * between the open/close tags (prose-bearing blocks: rich-text, callout)\n * rather than as a prop — so the body survives as real, inline-editable MDX\n * prose in source.\n */\n childrenField?: keyof TData & string;\n /**\n * Opt-in custom children serializer for blocks whose internals are nested MDX\n * components rather than a single markdown string (e.g. wireframe → Screen/kit\n * primitives). When present it overrides `childrenField`. `serializeChildren`\n * returns the raw inner MDX; `parseChildren` receives the child MDX AST nodes.\n */\n serializeChildren?: (data: TData) => string;\n parseChildren?: (childNodes: unknown[], idContext: string) => Partial<TData>;\n}\n\n/**\n * App-injected capabilities. Core blocks stay app-agnostic by taking these\n * rather than importing app services — mirroring `createImageExtension`'s\n * `onImageUpload` injection. Provided via `BlockRegistryProvider`.\n */\nexport interface BlockRenderContext {\n /** Markdown dialect for the auto-editor's rich-text field. */\n dialect?: \"gfm\" | \"nfm\";\n /** Resolve an asset id → displayable URL. */\n resolveAssetSrc?: (assetId: string) => string | undefined;\n /** Open the shared asset picker (returns the chosen asset). */\n pickAsset?: () => Promise<{ assetId: string; url?: string } | null>;\n /** Upload a local file, returns a hosted URL. */\n uploadFile?: (file: File) => Promise<{ url: string; assetId?: string }>;\n /** Call an app action by name (for blocks that fetch live data). */\n callAction?: (name: string, args: unknown) => Promise<unknown>;\n /** Sanitizer for HTML-bearing blocks. Provided by the app/core. */\n sanitizeHtml?: (html: string, css?: string) => string;\n /**\n * Render a markdown string with the app's read-only markdown renderer. Lets a\n * core block (whose `Read` lives in core) defer prose rendering to the app's\n * markdown reader (e.g. the plan `PlanMarkdownReader`) without importing it.\n */\n renderMarkdown?: (\n markdown: string,\n options?: { className?: string },\n ) => React.ReactNode;\n /**\n * Render an inline, editable rich-markdown field. The auto-editor calls this\n * for a `markdown()`-tagged field so the app owns the editor wiring (collab,\n * autosave debounce, dialect) rather than core hardcoding it.\n */\n renderMarkdownEditor?: (props: {\n value: string;\n onChange: (next: string) => void;\n editable: boolean;\n blockId?: string;\n className?: string;\n ariaLabel?: string;\n }) => React.ReactNode;\n /**\n * Render an app-owned edit-by-prompt affordance (\"Describe a change…\") for a focused/editable block\n * field. Core block editors pass the current field value and nearby companion\n * fields; the host app decides how to collect the prompt and route it to the\n * agent sidebar. This keeps reusable core blocks from importing app-specific\n * popover/composer code while still exposing a generic AI edit hook.\n */\n renderAiFieldAction?: (props: BlockAiFieldActionProps) => React.ReactNode;\n /**\n * Render a nested child block through the app's own block dispatcher. Container\n * blocks whose `Read`/`Edit` live in core (e.g. tabs) call this to render each\n * child so the recursion keeps flowing through the SAME app renderer the\n * top-level document uses — registered children render via their spec, and\n * unregistered (not-yet-converted) children still fall through the app's legacy\n * switch. This is the coexistence seam: a core container never has to know\n * about app-specific child block types. Returns `null`/`undefined` when no\n * dispatcher is wired (read-only/SSR-only contexts can omit it).\n */\n renderBlock?: (props: {\n block: NestedBlock;\n /** Commit a replacement for this child block (edit mode only). */\n onChange?: (next: NestedBlock) => void;\n /** Whether the parent container is being edited. */\n editing?: boolean;\n /** Tighten embedded visuals in dense contexts (e.g. tab panes). */\n compactVisuals?: boolean;\n }) => React.ReactNode;\n /**\n * Render a nested editable block list through the host app's document editor.\n * Container blocks such as columns call this for each editable region so slash\n * commands, nested structured blocks, and ordinary prose behave like the\n * top-level document while the container still persists its normalized runtime\n * data. Source adapters may still expose a human-friendly nested MDX form\n * (for example `<Columns><Column>markdown</Column></Columns>`) and normalize it\n * into these block arrays at runtime.\n */\n renderBlocksEditor?: (props: {\n blocks: NestedBlock[];\n onChange: (blocks: NestedBlock[]) => void;\n editable: boolean;\n containerBlockId: string;\n regionId: string;\n regionLabel?: string;\n /** Tighten embedded visuals in dense regions such as tab panes. */\n compactVisuals?: boolean;\n }) => React.ReactNode;\n /**\n * Wrap a block's edit form in an app-provided \"panel\" surface (e.g. a shadcn\n * Popover anchored to the corner edit button) for `editSurface: \"panel\"`\n * blocks. Core renders the rendered `Read` view plus a corner trigger button\n * and the form, then hands them here so the app owns the overlay primitive\n * (core stays shadcn-free, mirroring `renderMarkdownEditor`). When omitted, a\n * panel-mode block falls back to inline editing. `title` is the block label.\n */\n renderEditSurface?: (props: {\n title: string;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n trigger: React.ReactNode;\n children: React.ReactNode;\n /** Metadata for host-provided contextual controls such as the edit-by-prompt CTA. */\n blockId?: string;\n blockType?: string;\n blockTitle?: string;\n blockSummary?: string;\n blockData?: unknown;\n }) => React.ReactNode;\n /**\n * Submit a respondent's answers from a `question-form` / `visual-questions`\n * block back to the host. The app decides how to route the summary (e.g. send\n * to the inline agent, copy to clipboard). Core blocks call this through the\n * context so they never import app-specific submit wiring; omit it and the\n * block degrades to a no-op submit.\n */\n onQuestionFormSubmit?: (summary: string) => void;\n}\n\nexport interface BlockAiFieldActionProps {\n blockId: string;\n blockType: string;\n blockTitle?: string;\n blockSummary?: string;\n fieldLabel: string;\n fieldValue: string;\n draftScope: string;\n disabled?: boolean;\n /**\n * Human-readable instructions for the host agent prompt. Mention how to patch\n * the block and which sibling fields should be preserved.\n */\n instructions: string;\n companionFields?: Array<{\n label: string;\n value: string;\n language?: string;\n }>;\n}\n\n/**\n * The minimal shape of a nested child block passed to {@link\n * BlockRenderContext.renderBlock}. It mirrors the app's block union loosely (the\n * app casts it back to its own block type) — a discriminating `type`, a stable\n * `id`, optional heading/summary, and the type-specific `data`.\n */\nexport interface NestedBlock {\n type: string;\n id: string;\n title?: string;\n summary?: string;\n data: unknown;\n [key: string]: unknown;\n}\n\nexport interface BlockContainerRegion {\n id: string;\n label?: string;\n blocks: NestedBlock[];\n}\n\nexport interface BlockContainerSpec<TData> {\n regions: (data: TData) => BlockContainerRegion[];\n updateRegion: (data: TData, regionId: string, blocks: NestedBlock[]) => TData;\n addRegion?: (data: TData, afterRegionId?: string) => TData;\n removeRegion?: (data: TData, regionId: string) => TData;\n reorderRegion?: (\n data: TData,\n fromRegionId: string,\n toRegionId: string,\n ) => TData;\n}\n\nexport type BlockDataChangeMeta = {\n containerRegion?: {\n regionId: string;\n blocks: NestedBlock[];\n };\n};\n\n/** Props passed to a block's read-only renderer. */\nexport interface BlockReadProps<TData> {\n data: TData;\n /** Stable block id (for anchors, comment targeting, source patches). */\n blockId: string;\n /** Block heading, when present. */\n title?: string;\n /** Block trailing summary, when present. */\n summary?: string;\n /** Injected app capabilities. */\n ctx: BlockRenderContext;\n}\n\n/** Props passed to a block's editor (custom or schema-generated). */\nexport interface BlockEditProps<TData> {\n data: TData;\n onChange: (next: TData, meta?: BlockDataChangeMeta) => void;\n editable: boolean;\n blockId: string;\n title?: string;\n summary?: string;\n /** Injected app capabilities. */\n ctx: BlockRenderContext;\n}\n\nexport interface BlockSpec<TData = unknown> {\n /** Discriminator. Equals the runtime block `type`. */\n type: string;\n /** Zod schema for `data`. Drives validation AND the schema-auto-editor. */\n schema: ZodType<TData>;\n /** MDX round-trip config. */\n mdx: BlockMdxConfig<TData>;\n /** Read-only renderer (replaces a `PlanBlockView` switch branch / NodeView). */\n Read: FC<BlockReadProps<TData>>;\n /**\n * Optional editor. When omitted, the registry renders the schema-driven\n * `SchemaBlockEditor` generated from `schema`. Supply for full control\n * (wireframe canvas, diagram editor).\n */\n Edit?: FC<BlockEditProps<TData>>;\n /** Allowed placements: `[\"block\"]`, `[\"inline\"]`, or both. */\n placement: BlockPlacement[];\n /**\n * When `true`, this block's data maps to a Notion-Flavored-Markdown (NFM)\n * analog and therefore round-trips into a Notion page. Apps can derive\n * registry-backed Notion allowlists with\n * {@link BlockRegistry.notionCompatibleTypes} instead of hand-maintaining\n * per-app sets. Set it on registry-atom blocks with an NFM counterpart\n * (checklist, table); leave it `false`/undefined on dev-doc blocks\n * (api-endpoint, openapi-spec, data-model, diff, file-tree, json-explorer,\n * annotated-code, mermaid, custom-html, tabs, code-tabs) and visual/plan-only\n * blocks (wireframe, diagram). Prose blocks that aren't registry atoms\n * (rich-text, callout) carry their NFM analog through the prose path, not this\n * flag.\n */\n notionCompatible?: boolean;\n /**\n * How the block is edited in a `block`-placed document:\n * - `\"inline\"` — the `Edit`/auto-form renders in place for direct\n * manipulation of authored content (prose, checklist text, table cells,\n * code bodies). Schema-ish metadata such as tone/type, tab labels,\n * language, density, or structural settings should still be tucked behind a\n * contextual edit/settings affordance inside the custom `Edit`.\n * - `\"panel\"` — the block shows its rendered `Read` view with a corner edit\n * button that opens the `Edit`/auto-form in an app-provided panel (popover).\n * Best for config-driven blocks whose render differs from their props\n * (custom HTML, charts, any user-registered block).\n * - `\"container\"` — the block renders its `Edit` in place, and that editor\n * may call `ctx.renderBlocksEditor` for nested block regions with normal\n * slash commands and nested structured blocks.\n * Defaults to `\"inline\"` when a custom `Edit` is supplied, else `\"panel\"`\n * (auto-form blocks are property forms, ideal for a panel). The app must wire\n * `ctx.renderEditSurface` for `\"panel\"` to take effect; otherwise it falls\n * back to inline.\n */\n editSurface?: \"inline\" | \"panel\" | \"container\";\n /**\n * Optional generic contract for content-bearing container blocks. Keep this\n * runtime-oriented: it describes editable regions over normalized block arrays;\n * source formats can provide readable nested MDX adapters independently.\n */\n container?: BlockContainerSpec<TData>;\n /** Human label for menus + agent schema export. */\n label: string;\n /** Tabler icon component for UI menus (never emoji/robot/sparkle). */\n icon?: FC<{ size?: number; className?: string }>;\n /** One-line description for the agent schema export. */\n description: string;\n /** Optional default `data` factory for slash-menu insertion (an empty block). */\n empty?: () => TData;\n /**\n * Optional block-specific source-patch handlers, generalizing bespoke ops\n * like `update-custom-html`. Keyed by op name; the registry dispatches a\n * matching patch op here. Generic ops (`update-block` shallow-merge) need none.\n */\n patches?: Record<string, (data: TData, op: Record<string, unknown>) => TData>;\n}\n\n/** Identity helper for authoring a spec with full type inference. */\nexport function defineBlock<TData>(spec: BlockSpec<TData>): BlockSpec<TData> {\n return spec;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DragHandle.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/DragHandle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,2BAA2B,CAAC;AAE7E,MA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