@ai-matrx/rich-content 0.2.4 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/code-block/CodeBlock.d.ts +44 -0
- package/dist/code-block/CodeBlock.js +449 -0
- package/dist/code-block/CodeBlockHeader.d.ts +63 -0
- package/dist/code-block/CodeBlockHeader.js +472 -0
- package/dist/code-block/CodeEditorLoading.d.ts +3 -0
- package/dist/code-block/CodeEditorLoading.js +34 -0
- package/dist/code-block/LanguageDisplay.d.ts +28 -0
- package/dist/code-block/LanguageDisplay.js +279 -0
- package/dist/code-block/SmallCodeEditor.d.ts +30 -0
- package/dist/code-block/SmallCodeEditor.js +22 -0
- package/dist/code-block/StickyButtons.d.ts +35 -0
- package/dist/code-block/StickyButtons.js +88 -0
- package/dist/code-block/highlight/ShikiCodeView.d.ts +26 -0
- package/dist/code-block/highlight/ShikiCodeView.js +134 -0
- package/dist/code-block/highlight/shiki-highlighter.d.ts +14 -0
- package/dist/code-block/highlight/shiki-highlighter.js +126 -0
- package/dist/code-block/highlight/useHighlightedLines.d.ts +18 -0
- package/dist/code-block/highlight/useHighlightedLines.js +142 -0
- package/dist/code-block/sticky-inset.d.ts +6 -0
- package/dist/code-block/sticky-inset.js +10 -0
- package/dist/display/block-interaction.d.ts +33 -0
- package/dist/display/block-interaction.js +13 -0
- package/dist/display/blocks/ChatCollapsibleWrapper.d.ts +13 -0
- package/dist/display/blocks/ChatCollapsibleWrapper.js +56 -0
- package/dist/display/blocks/buildMediaSource.d.ts +25 -0
- package/dist/display/blocks/buildMediaSource.js +43 -0
- package/dist/display/blocks/canvas-adaptive.d.ts +118 -0
- package/dist/display/blocks/canvas-adaptive.js +127 -0
- package/dist/display/blocks/canvas-fit.d.ts +24 -0
- package/dist/display/blocks/canvas-fit.js +19 -0
- package/dist/display/blocks/chart/ChartBlock.d.ts +8 -0
- package/dist/display/blocks/chart/ChartBlock.js +125 -0
- package/dist/display/blocks/chart/ChartCanvas.d.ts +18 -0
- package/dist/display/blocks/chart/ChartCanvas.js +159 -0
- package/dist/display/blocks/chart/TableChart.d.ts +25 -0
- package/dist/display/blocks/chart/TableChart.js +97 -0
- package/dist/display/blocks/chart/chart-spec.d.ts +39 -0
- package/dist/display/blocks/chart/chart-spec.js +128 -0
- package/dist/display/blocks/chart/labels.d.ts +20 -0
- package/dist/display/blocks/chart/labels.js +7 -0
- package/dist/display/blocks/chart/table-chart.d.ts +37 -0
- package/dist/display/blocks/chart/table-chart.js +231 -0
- package/dist/display/blocks/common/BlockHeaderWrapper.d.ts +56 -0
- package/dist/display/blocks/common/BlockHeaderWrapper.js +310 -0
- package/dist/display/blocks/common/ContentBlockWrapper.d.ts +40 -0
- package/dist/display/blocks/common/ContentBlockWrapper.js +214 -0
- package/dist/display/blocks/common/SandboxedHtml.d.ts +27 -0
- package/dist/display/blocks/common/SandboxedHtml.js +26 -0
- package/dist/display/blocks/diagram/DiagramLoadingVisualization.d.ts +6 -0
- package/dist/display/blocks/diagram/DiagramLoadingVisualization.js +190 -0
- package/dist/display/blocks/diagram/InteractiveDiagramBlock.d.ts +51 -0
- package/dist/display/blocks/diagram/InteractiveDiagramBlock.js +2415 -0
- package/dist/display/blocks/diagram/diagram-printer.d.ts +16 -0
- package/dist/display/blocks/diagram/diagram-printer.js +294 -0
- package/dist/display/blocks/diagram/diagram-visual-defaults.d.ts +116 -0
- package/dist/display/blocks/diagram/diagram-visual-defaults.js +400 -0
- package/dist/display/blocks/diagram/layout-utils.d.ts +90 -0
- package/dist/display/blocks/diagram/layout-utils.js +347 -0
- package/dist/display/blocks/diagram/parseDiagramJSON.d.ts +105 -0
- package/dist/display/blocks/diagram/parseDiagramJSON.js +296 -0
- package/dist/display/blocks/diagram/presentation-direction.d.ts +29 -0
- package/dist/display/blocks/diagram/presentation-direction.js +19 -0
- package/dist/display/blocks/diagram/ui-utils.d.ts +1 -0
- package/dist/display/blocks/diagram/ui-utils.js +18 -0
- package/dist/display/blocks/diff/DiffBlock.d.ts +10 -0
- package/dist/display/blocks/diff/DiffBlock.js +119 -0
- package/dist/display/blocks/diff/DiffCanvas.d.ts +15 -0
- package/dist/display/blocks/diff/DiffCanvas.js +20 -0
- package/dist/display/blocks/generic/GenericStructuredBlock.d.ts +24 -0
- package/dist/display/blocks/generic/GenericStructuredBlock.js +53 -0
- package/dist/display/blocks/generic/StructuredValueTabs.d.ts +21 -0
- package/dist/display/blocks/generic/StructuredValueTabs.js +124 -0
- package/dist/display/blocks/generic/tile-actions-slot.d.ts +39 -0
- package/dist/display/blocks/generic/tile-actions-slot.js +33 -0
- package/dist/display/blocks/images/ImageBlock.d.ts +8 -0
- package/dist/display/blocks/images/ImageBlock.js +265 -0
- package/dist/display/blocks/json/JsonBlock.d.ts +34 -0
- package/dist/display/blocks/json/JsonBlock.js +562 -0
- package/dist/display/blocks/json/JsonTableView.d.ts +10 -0
- package/dist/display/blocks/json/JsonTableView.js +173 -0
- package/dist/display/blocks/json/json-compact-stringify.d.ts +25 -0
- package/dist/display/blocks/json/json-compact-stringify.js +52 -0
- package/dist/display/blocks/json/json-tabular-utils.d.ts +65 -0
- package/dist/display/blocks/json/json-tabular-utils.js +121 -0
- package/dist/display/blocks/links/LinkComponent.d.ts +6 -0
- package/dist/display/blocks/links/LinkComponent.js +373 -0
- package/dist/display/blocks/links/LinkComponentWithFetch.d.ts +1 -0
- package/dist/display/blocks/links/LinkComponentWithFetch.js +0 -0
- package/dist/display/blocks/markdown/MarkdownKindBlock.d.ts +48 -0
- package/dist/display/blocks/markdown/MarkdownKindBlock.js +52 -0
- package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.d.ts +17 -0
- package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.js +70 -0
- package/dist/display/blocks/mermaid/MermaidBlock.d.ts +19 -0
- package/dist/display/blocks/mermaid/MermaidBlock.js +386 -0
- package/dist/display/blocks/search-replace/SearchReplaceBlock.d.ts +50 -0
- package/dist/display/blocks/search-replace/SearchReplaceBlock.js +71 -0
- package/dist/display/blocks/svg/SvgBlock.d.ts +8 -0
- package/dist/display/blocks/svg/SvgBlock.js +126 -0
- package/dist/display/blocks/table/StreamingTableRenderer.d.ts +53 -0
- package/dist/display/blocks/table/StreamingTableRenderer.js +907 -0
- package/dist/display/blocks/table/TableRenderPathDiagnostic.d.ts +21 -0
- package/dist/display/blocks/table/TableRenderPathDiagnostic.js +79 -0
- package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.d.ts +14 -0
- package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.js +15 -0
- package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.d.ts +13 -0
- package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.js +19 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTrace.d.ts +30 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTrace.js +75 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.d.ts +13 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.js +48 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.d.ts +12 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.js +19 -0
- package/dist/display/blocks/toml/TomlBlock.d.ts +7 -0
- package/dist/display/blocks/toml/TomlBlock.js +167 -0
- package/dist/display/blocks/tree/TreeBlock.d.ts +7 -0
- package/dist/display/blocks/tree/TreeBlock.js +163 -0
- package/dist/display/blocks/xml/XmlBlock.d.ts +23 -0
- package/dist/display/blocks/xml/XmlBlock.js +197 -0
- package/dist/display/blocks/xml/readXmlTag.d.ts +1 -0
- package/dist/display/blocks/xml/readXmlTag.js +1 -0
- package/dist/display/blocks/xml/xml-tokenize.d.ts +13 -0
- package/dist/display/blocks/xml/xml-tokenize.js +169 -0
- package/dist/display/blocks/yaml/YamlBlock.d.ts +7 -0
- package/dist/display/blocks/yaml/YamlBlock.js +191 -0
- package/dist/display/chat-markdown/BasicMarkdownContent.d.ts +29 -0
- package/dist/display/chat-markdown/BasicMarkdownContent.js +122 -0
- package/dist/display/chat-markdown/BlockRenderingContext.d.ts +23 -0
- package/dist/display/chat-markdown/BlockRenderingContext.js +17 -0
- package/dist/display/chat-markdown/ConfigurableMarkdownContent.d.ts +172 -0
- package/dist/display/chat-markdown/ConfigurableMarkdownContent.js +649 -0
- package/dist/display/chat-markdown/InlineCodeSnippet.d.ts +19 -0
- package/dist/display/chat-markdown/InlineCodeSnippet.js +146 -0
- package/dist/display/chat-markdown/InlineCodeSnippetKindGate.d.ts +11 -0
- package/dist/display/chat-markdown/InlineCodeSnippetKindGate.js +9 -0
- package/dist/display/chat-markdown/KindTextGate.d.ts +31 -0
- package/dist/display/chat-markdown/KindTextGate.js +60 -0
- package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.d.ts +6 -0
- package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.js +92 -0
- package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.d.ts +72 -0
- package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.js +94 -0
- package/dist/display/chat-markdown/block-registry/BlockRenderer.d.ts +126 -0
- package/dist/display/chat-markdown/block-registry/BlockRenderer.js +473 -0
- package/dist/display/chat-markdown/block-registry/block-dispatch.d.ts +410 -0
- package/dist/display/chat-markdown/block-registry/block-dispatch.js +495 -0
- package/dist/display/chat-markdown/block-registry/json-parse-utils.d.ts +13 -0
- package/dist/display/chat-markdown/block-registry/json-parse-utils.js +236 -0
- package/dist/display/chat-markdown/constants.d.ts +14 -0
- package/dist/display/chat-markdown/constants.js +317 -0
- package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.d.ts +31 -0
- package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.js +62 -0
- package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.d.ts +12 -0
- package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.js +18 -0
- package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.d.ts +22 -0
- package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.js +130 -0
- package/dist/display/chat-markdown/diff-blocks/diff-style-registry.d.ts +21 -0
- package/dist/display/chat-markdown/diff-blocks/diff-style-registry.js +91 -0
- package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.d.ts +26 -0
- package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.js +186 -0
- package/dist/display/chat-markdown/diff-blocks/types.d.ts +56 -0
- package/dist/display/chat-markdown/diff-blocks/types.js +0 -0
- package/dist/display/chat-markdown/internal-handlers/BlockFallback.d.ts +20 -0
- package/dist/display/chat-markdown/internal-handlers/BlockFallback.js +83 -0
- package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.d.ts +4 -0
- package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.js +16 -0
- package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.d.ts +17 -0
- package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.js +40 -0
- package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.d.ts +8 -0
- package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.js +91 -0
- package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.d.ts +20 -0
- package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.js +72 -0
- package/dist/display/chat-markdown/kind-source-view.d.ts +14 -0
- package/dist/display/chat-markdown/kind-source-view.js +14 -0
- package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.d.ts +28 -0
- package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.js +65 -0
- package/dist/display/chat-markdown/progressive-mount.d.ts +18 -0
- package/dist/display/chat-markdown/progressive-mount.js +90 -0
- package/dist/display/chat-markdown/render-block-to-content-block.d.ts +31 -0
- package/dist/display/chat-markdown/render-block-to-content-block.js +32 -0
- package/dist/display/chat-markdown/settle-stream-blocks.d.ts +50 -0
- package/dist/display/chat-markdown/settle-stream-blocks.js +26 -0
- package/dist/display/chat-markdown/stable-blocks.d.ts +15 -0
- package/dist/display/chat-markdown/stable-blocks.js +54 -0
- package/dist/display/chat-markdown/types.d.ts +11 -0
- package/dist/display/chat-markdown/types.js +26 -0
- package/dist/display/specimen/SpecimenContext.d.ts +26 -0
- package/dist/display/specimen/SpecimenContext.js +64 -0
- package/dist/display/tables/MarkdownTable.d.ts +23 -0
- package/dist/display/tables/MarkdownTable.js +769 -0
- package/dist/display/tables/MarkdownTableScrollArea.d.ts +12 -0
- package/dist/display/tables/MarkdownTableScrollArea.js +92 -0
- package/dist/display/tables/SendToGoogleSheetButton.d.ts +19 -0
- package/dist/display/tables/SendToGoogleSheetButton.js +93 -0
- package/dist/display/tables/SendToWorkbookButton.d.ts +24 -0
- package/dist/display/tables/SendToWorkbookButton.js +93 -0
- package/dist/display/tables/TableSaveToMenu.d.ts +16 -0
- package/dist/display/tables/TableSaveToMenu.js +98 -0
- package/dist/display/tables/TableWithSeparatedControls.d.ts +22 -0
- package/dist/display/tables/TableWithSeparatedControls.js +574 -0
- package/dist/display/tables/ViewTableModal.d.ts +14 -0
- package/dist/display/tables/ViewTableModal.js +67 -0
- package/dist/display/tables/editing/ColumnActionsMenu.d.ts +16 -0
- package/dist/display/tables/editing/ColumnActionsMenu.js +80 -0
- package/dist/display/tables/editing/RowActionsMenu.d.ts +16 -0
- package/dist/display/tables/editing/RowActionsMenu.js +80 -0
- package/dist/display/tables/editing/TableEditToolbar.d.ts +15 -0
- package/dist/display/tables/editing/TableEditToolbar.js +63 -0
- package/dist/display/tables/editing/tableMutations.d.ts +50 -0
- package/dist/display/tables/editing/tableMutations.js +148 -0
- package/dist/display/tables/editing/useDoubleClickEdit.d.ts +43 -0
- package/dist/display/tables/editing/useDoubleClickEdit.js +51 -0
- package/dist/display/tables/editing/useTableUndo.d.ts +25 -0
- package/dist/display/tables/editing/useTableUndo.js +17 -0
- package/dist/display/tables/table-action-row.d.ts +8 -0
- package/dist/display/tables/table-action-row.js +31 -0
- package/dist/display/tables/table-viewer.d.ts +13 -0
- package/dist/display/tables/table-viewer.js +18 -0
- package/dist/host/ErrorActions.d.ts +1 -1
- package/dist/host/ErrorNotice.d.ts +10 -0
- package/dist/host/ErrorNotice.js +19 -0
- package/dist/host/app-bindings.d.ts +155 -0
- package/dist/host/app-bindings.js +160 -0
- package/dist/host/diagnostics.d.ts +2 -2
- package/dist/host/diagnostics.js +2 -1
- package/dist/host/tables.d.ts +1 -6
- package/dist/host/types.d.ts +14 -7
- package/dist/levels/RichContent.d.ts +3 -0
- package/dist/levels/RichContent.js +102 -0
- package/dist/levels/RichContentInline.d.ts +28 -0
- package/dist/levels/RichContentInline.js +61 -0
- package/dist/levels/RichContentPreview.d.ts +12 -0
- package/dist/levels/RichContentPreview.js +39 -0
- package/dist/levels/RichContentStandardImpl.d.ts +12 -0
- package/dist/levels/RichContentStandardImpl.js +27 -0
- package/dist/levels/RichContentStaticProse.d.ts +46 -0
- package/dist/levels/RichContentStaticProse.js +100 -0
- package/dist/levels/depth.d.ts +18 -0
- package/dist/levels/depth.js +32 -0
- package/dist/levels/prose/inline-level-elements.d.ts +19 -0
- package/dist/levels/prose/inline-level-elements.js +103 -0
- package/dist/levels/prose/prose-block-elements.d.ts +25 -0
- package/dist/levels/prose/prose-block-elements.js +313 -0
- package/dist/levels/prose/prose-inline-elements.d.ts +13 -0
- package/dist/levels/prose/prose-inline-elements.js +143 -0
- package/dist/levels/prose/prose-prepare.d.ts +50 -0
- package/dist/levels/prose/prose-prepare.js +246 -0
- package/dist/levels/prose/remote-image-policy.d.ts +34 -0
- package/dist/levels/prose/remote-image-policy.js +153 -0
- package/dist/levels/prose/variant-root.d.ts +9 -0
- package/dist/levels/prose/variant-root.js +34 -0
- package/dist/levels/rich-content-types.d.ts +93 -0
- package/dist/levels/rich-content-types.js +4 -0
- package/dist/levels/server/DelimiterViolationReport.d.ts +7 -0
- package/dist/levels/server/DelimiterViolationReport.js +24 -0
- package/dist/levels/server/RichContentServer.d.ts +27 -0
- package/dist/levels/server/RichContentServer.js +97 -0
- package/dist/levels/standard/NestedRichContent.d.ts +7 -0
- package/dist/levels/standard/NestedRichContent.js +70 -0
- package/dist/levels/standard/StandardBlocks.d.ts +13 -0
- package/dist/levels/standard/StandardBlocks.js +239 -0
- package/dist/levels/standard/StandardKindRegion.d.ts +14 -0
- package/dist/levels/standard/StandardKindRegion.js +69 -0
- package/dist/levels/standard/standard-kind-region.d.ts +19 -0
- package/dist/levels/standard/standard-kind-region.js +21 -0
- package/dist/levels/standard/static-standard.d.ts +23 -0
- package/dist/levels/standard/static-standard.js +187 -0
- package/dist/levels/standard/stream-holdback.d.ts +2 -0
- package/dist/levels/standard/stream-holdback.js +77 -0
- package/dist/mermaid/MermaidFullscreen.d.ts +17 -0
- package/dist/mermaid/MermaidFullscreen.js +71 -0
- package/dist/mermaid/MermaidRenderer.d.ts +20 -0
- package/dist/mermaid/MermaidRenderer.js +267 -0
- package/dist/mermaid/MermaidView.d.ts +27 -0
- package/dist/mermaid/MermaidView.js +68 -0
- package/dist/mermaid/MermaidViewport.d.ts +75 -0
- package/dist/mermaid/MermaidViewport.js +286 -0
- package/dist/mermaid/adapters/er.d.ts +10 -0
- package/dist/mermaid/adapters/er.js +205 -0
- package/dist/mermaid/adapters/flowchart.d.ts +17 -0
- package/dist/mermaid/adapters/flowchart.js +634 -0
- package/dist/mermaid/adapters/journey.d.ts +9 -0
- package/dist/mermaid/adapters/journey.js +207 -0
- package/dist/mermaid/adapters/mindmap.d.ts +12 -0
- package/dist/mermaid/adapters/mindmap.js +252 -0
- package/dist/mermaid/adapters/pie.d.ts +7 -0
- package/dist/mermaid/adapters/pie.js +172 -0
- package/dist/mermaid/adapters/quadrant.d.ts +8 -0
- package/dist/mermaid/adapters/quadrant.js +231 -0
- package/dist/mermaid/adapters/register.d.ts +7 -0
- package/dist/mermaid/adapters/register.js +19 -0
- package/dist/mermaid/adapters/sequence.d.ts +8 -0
- package/dist/mermaid/adapters/sequence.js +251 -0
- package/dist/mermaid/adapters/state.d.ts +12 -0
- package/dist/mermaid/adapters/state.js +245 -0
- package/dist/mermaid/adapters/timeline.d.ts +8 -0
- package/dist/mermaid/adapters/timeline.js +245 -0
- package/dist/mermaid/catalog.d.ts +33 -0
- package/dist/mermaid/catalog.js +202 -0
- package/dist/mermaid/diagram-type.d.ts +39 -0
- package/dist/mermaid/diagram-type.js +89 -0
- package/dist/mermaid/export.d.ts +21 -0
- package/dist/mermaid/export.js +112 -0
- package/dist/mermaid/extract-fence.d.ts +15 -0
- package/dist/mermaid/extract-fence.js +22 -0
- package/dist/mermaid/lazy-draw.d.ts +40 -0
- package/dist/mermaid/lazy-draw.js +168 -0
- package/dist/mermaid/model/adapter.d.ts +28 -0
- package/dist/mermaid/model/adapter.js +16 -0
- package/dist/mermaid/model/ops.d.ts +282 -0
- package/dist/mermaid/model/ops.js +9 -0
- package/dist/mermaid/model/round-trip.d.ts +22 -0
- package/dist/mermaid/model/round-trip.js +45 -0
- package/dist/mermaid/model/types.d.ts +271 -0
- package/dist/mermaid/model/types.js +0 -0
- package/dist/mermaid/print-render.d.ts +9 -0
- package/dist/mermaid/print-render.js +39 -0
- package/dist/mermaid/runtime.d.ts +25 -0
- package/dist/mermaid/runtime.js +183 -0
- package/dist/mermaid/sanitize.d.ts +46 -0
- package/dist/mermaid/sanitize.js +234 -0
- package/dist/mermaid/types.d.ts +43 -0
- package/dist/mermaid/types.js +21 -0
- package/dist/mermaid/view/ViewModePane.d.ts +24 -0
- package/dist/mermaid/view/ViewModePane.js +9 -0
- package/dist/utils/client-lazy.d.ts +1 -1
- package/dist/utils/client-lazy.js +4 -1
- package/dist/utils/lifted/DiffView.d.ts +10 -0
- package/dist/utils/lifted/DiffView.js +26 -0
- package/dist/utils/lifted/IconButton.d.ts +24 -0
- package/dist/utils/lifted/IconButton.js +43 -0
- package/dist/utils/lifted/MatrxMiniLoader.d.ts +1 -0
- package/dist/utils/lifted/MatrxMiniLoader.js +8 -0
- package/dist/utils/lifted/ShimmerText.d.ts +5 -0
- package/dist/utils/lifted/ShimmerText.js +21 -0
- package/dist/utils/lifted/SuspenseLoader.d.ts +16 -0
- package/dist/utils/lifted/SuspenseLoader.js +42 -0
- package/dist/utils/lifted/Tooltip.d.ts +20 -0
- package/dist/utils/lifted/Tooltip.js +52 -0
- package/dist/utils/lifted/artifactId.d.ts +34 -0
- package/dist/utils/lifted/artifactId.js +15 -0
- package/dist/utils/lifted/canvasContent.d.ts +63 -0
- package/dist/utils/lifted/canvasContent.js +98 -0
- package/dist/utils/lifted/captureReactError.d.ts +24 -0
- package/dist/utils/lifted/captureReactError.js +28 -0
- package/dist/utils/lifted/chunk-load-recovery.d.ts +25 -0
- package/dist/utils/lifted/chunk-load-recovery.js +36 -0
- package/dist/utils/lifted/code-editor-agent-types.d.ts +6 -0
- package/dist/utils/lifted/code-editor-agent-types.js +0 -0
- package/dist/utils/lifted/code-editor-agents.d.ts +39 -0
- package/dist/utils/lifted/code-editor-agents.js +52 -0
- package/dist/utils/lifted/code-language-extension.d.ts +1 -0
- package/dist/utils/lifted/code-language-extension.js +60 -0
- package/dist/utils/lifted/custom-icons.d.ts +16 -0
- package/dist/utils/lifted/custom-icons.js +47 -0
- package/dist/utils/lifted/durability.d.ts +16 -0
- package/dist/utils/lifted/durability.js +45 -0
- package/dist/utils/lifted/errors.d.ts +30 -0
- package/dist/utils/lifted/errors.js +29 -0
- package/dist/utils/lifted/html-document.d.ts +1 -0
- package/dist/utils/lifted/html-document.js +12 -0
- package/dist/utils/lifted/languageOptions.d.ts +9 -0
- package/dist/utils/lifted/languageOptions.js +52 -0
- package/dist/utils/lifted/languages.d.ts +34 -0
- package/dist/utils/lifted/languages.js +175 -0
- package/dist/utils/lifted/loading-spinner.d.ts +18 -0
- package/dist/utils/lifted/loading-spinner.js +200 -0
- package/dist/utils/lifted/media-refs.d.ts +13 -0
- package/dist/utils/lifted/media-refs.js +27 -0
- package/dist/utils/lifted/scroll-root.d.ts +1 -0
- package/dist/utils/lifted/scroll-root.js +25 -0
- package/dist/utils/lifted/syntax-themes.d.ts +32 -0
- package/dist/utils/lifted/syntax-themes.js +100 -0
- package/dist/utils/lifted/url-utm.d.ts +24 -0
- package/dist/utils/lifted/url-utm.js +66 -0
- package/dist/utils/lifted/use-is-mounted.d.ts +24 -0
- package/dist/utils/lifted/use-is-mounted.js +21 -0
- package/dist/utils/lifted/useToastManager.d.ts +1 -0
- package/dist/utils/lifted/useToastManager.js +7 -0
- package/dist/utils/report-kind-at-raw-renderer.d.ts +19 -0
- package/dist/utils/report-kind-at-raw-renderer.js +32 -0
- package/package.json +48 -10
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_DIAGRAM_RENDER_HINTS,
|
|
3
|
+
DIAGRAM_BACKGROUNDS,
|
|
4
|
+
DIAGRAM_BORDER_STYLES,
|
|
5
|
+
DIAGRAM_EDGE_MARKERS,
|
|
6
|
+
DIAGRAM_NODE_SHAPES,
|
|
7
|
+
inferDiagramNodeVisuals,
|
|
8
|
+
normalizeDiagramIconName
|
|
9
|
+
} from "./diagram-visual-defaults.js";
|
|
10
|
+
import { extractErrorMessage } from "../../../utils/lifted/errors.js";
|
|
11
|
+
function isOneOf(value, values) {
|
|
12
|
+
return typeof value === "string" && values.includes(value);
|
|
13
|
+
}
|
|
14
|
+
function materializeDiagramDefaults(diagram) {
|
|
15
|
+
const type = diagram.type || "flowchart";
|
|
16
|
+
const nodes = diagram.nodes.map((node, index) => {
|
|
17
|
+
const nodeType = node.nodeType || node.type || "default";
|
|
18
|
+
const inferred = inferDiagramNodeVisuals({
|
|
19
|
+
diagramType: type,
|
|
20
|
+
nodeType,
|
|
21
|
+
label: node.label,
|
|
22
|
+
description: node.description,
|
|
23
|
+
details: node.details,
|
|
24
|
+
isGroup: node.isGroup
|
|
25
|
+
});
|
|
26
|
+
const isGroup = node.isGroup === true;
|
|
27
|
+
return {
|
|
28
|
+
...node,
|
|
29
|
+
nodeType,
|
|
30
|
+
position: node.position ?? generateDefaultPosition(index, type),
|
|
31
|
+
isGroup,
|
|
32
|
+
...isGroup ? {
|
|
33
|
+
width: node.width ?? 420,
|
|
34
|
+
height: node.height ?? 260,
|
|
35
|
+
groupStyle: node.groupStyle ?? "dashed"
|
|
36
|
+
} : {},
|
|
37
|
+
color: node.color || inferred.color,
|
|
38
|
+
icon: normalizeDiagramIconName(node.icon || inferred.icon),
|
|
39
|
+
shape: node.shape ?? inferred.shape,
|
|
40
|
+
borderStyle: node.borderStyle ?? inferred.borderStyle,
|
|
41
|
+
textAlign: node.textAlign ?? inferred.textAlign
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
const edges = (diagram.edges ?? []).map((edge, index) => {
|
|
45
|
+
const isMarriage = edge.relationship === "marriage" || edge.relationship === "divorced";
|
|
46
|
+
const marker = edge.marker ?? (edge.arrow === false || isMarriage ? "none" : "end");
|
|
47
|
+
return {
|
|
48
|
+
...edge,
|
|
49
|
+
id: edge.id || `edge_${edge.source}_to_${edge.target}_${index}`,
|
|
50
|
+
type: !edge.type || edge.type === "default" ? "bezier" : edge.type,
|
|
51
|
+
color: edge.color || "gray",
|
|
52
|
+
lineStyle: edge.lineStyle ?? (edge.dashed ? "dashed" : "solid"),
|
|
53
|
+
dashed: edge.lineStyle === "dashed" || edge.dashed === true,
|
|
54
|
+
strokeWidth: edge.strokeWidth ?? 2,
|
|
55
|
+
marker,
|
|
56
|
+
arrow: marker !== "none",
|
|
57
|
+
animated: edge.animated === true
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
...diagram,
|
|
62
|
+
type,
|
|
63
|
+
nodes,
|
|
64
|
+
edges,
|
|
65
|
+
layout: {
|
|
66
|
+
direction: diagram.layout?.direction ?? "TB",
|
|
67
|
+
spacing: diagram.layout?.spacing ?? 100,
|
|
68
|
+
algorithm: diagram.layout?.algorithm ?? (type === "pedigree" ? "pedigree" : "dagre")
|
|
69
|
+
},
|
|
70
|
+
renderHints: {
|
|
71
|
+
...DEFAULT_DIAGRAM_RENDER_HINTS,
|
|
72
|
+
...diagram.renderHints
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function parseDiagramJSON(content) {
|
|
77
|
+
try {
|
|
78
|
+
let jsonContent = content.trim();
|
|
79
|
+
const codeBlockMatch = jsonContent.match(/```(?:json)?\s*([\s\S]*?)\s*```/);
|
|
80
|
+
if (codeBlockMatch) {
|
|
81
|
+
jsonContent = codeBlockMatch[1].trim();
|
|
82
|
+
}
|
|
83
|
+
const parsed = JSON.parse(jsonContent);
|
|
84
|
+
const diagramData = parsed.diagram || parsed;
|
|
85
|
+
if (!diagramData) throw new Error("No diagram data found in JSON");
|
|
86
|
+
if (!diagramData.title || !diagramData.nodes || !Array.isArray(diagramData.nodes)) {
|
|
87
|
+
throw new Error("Missing required fields: title or nodes array");
|
|
88
|
+
}
|
|
89
|
+
const processedNodes = diagramData.nodes.map(
|
|
90
|
+
(node, index) => {
|
|
91
|
+
if (!node.id || !node.label) {
|
|
92
|
+
throw new Error(`Node ${index} missing required id or label`);
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
id: node.id,
|
|
96
|
+
label: node.label,
|
|
97
|
+
type: node.type,
|
|
98
|
+
nodeType: node.nodeType || node.type || "default",
|
|
99
|
+
description: node.description,
|
|
100
|
+
details: node.details,
|
|
101
|
+
position: node.position || generateDefaultPosition(index, diagramData.type || "flowchart"),
|
|
102
|
+
isGroup: node.isGroup === true,
|
|
103
|
+
parentId: typeof node.parentId === "string" ? node.parentId : void 0,
|
|
104
|
+
width: typeof node.width === "number" ? node.width : void 0,
|
|
105
|
+
height: typeof node.height === "number" ? node.height : void 0,
|
|
106
|
+
groupStyle: isOneOf(node.groupStyle, DIAGRAM_BORDER_STYLES) ? node.groupStyle : void 0,
|
|
107
|
+
// Pedigree fields
|
|
108
|
+
gender: node.gender,
|
|
109
|
+
affected: node.affected,
|
|
110
|
+
deceased: node.deceased,
|
|
111
|
+
proband: node.proband,
|
|
112
|
+
birthYear: node.birthYear,
|
|
113
|
+
deathYear: node.deathYear,
|
|
114
|
+
generation: node.generation,
|
|
115
|
+
// Generic
|
|
116
|
+
metadata: node.metadata,
|
|
117
|
+
color: node.color,
|
|
118
|
+
icon: node.icon,
|
|
119
|
+
shape: isOneOf(node.shape, DIAGRAM_NODE_SHAPES) ? node.shape : void 0,
|
|
120
|
+
borderStyle: isOneOf(node.borderStyle, DIAGRAM_BORDER_STYLES) ? node.borderStyle : void 0,
|
|
121
|
+
textAlign: node.textAlign === "left" || node.textAlign === "center" ? node.textAlign : void 0
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
const processedEdges = (diagramData.edges || []).map(
|
|
126
|
+
(edge, index) => {
|
|
127
|
+
const source = edge.source || edge.from;
|
|
128
|
+
const target = edge.target || edge.to;
|
|
129
|
+
if (!source || !target) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Edge ${index} missing required source/from or target/to field`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
const id = edge.id || `edge_${source}_to_${target}_${index}`;
|
|
135
|
+
return {
|
|
136
|
+
id,
|
|
137
|
+
source,
|
|
138
|
+
target,
|
|
139
|
+
label: edge.label,
|
|
140
|
+
type: edge.type || "default",
|
|
141
|
+
color: edge.color,
|
|
142
|
+
dashed: edge.dashed || false,
|
|
143
|
+
lineStyle: edge.lineStyle === "solid" || edge.lineStyle === "dashed" || edge.lineStyle === "dotted" ? edge.lineStyle : void 0,
|
|
144
|
+
strokeWidth: edge.strokeWidth || 2,
|
|
145
|
+
relationship: edge.relationship,
|
|
146
|
+
arrow: edge.arrow,
|
|
147
|
+
marker: isOneOf(edge.marker, DIAGRAM_EDGE_MARKERS) ? edge.marker : void 0,
|
|
148
|
+
animated: edge.animated
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
return materializeDiagramDefaults({
|
|
153
|
+
title: diagramData.title,
|
|
154
|
+
description: diagramData.description,
|
|
155
|
+
type: diagramData.type || "flowchart",
|
|
156
|
+
nodes: processedNodes,
|
|
157
|
+
edges: processedEdges,
|
|
158
|
+
layout: diagramData.layout || {
|
|
159
|
+
direction: "TB",
|
|
160
|
+
spacing: 100
|
|
161
|
+
},
|
|
162
|
+
renderHints: diagramData.renderHints && typeof diagramData.renderHints === "object" ? {
|
|
163
|
+
...diagramData.renderHints,
|
|
164
|
+
...isOneOf(
|
|
165
|
+
diagramData.renderHints.background,
|
|
166
|
+
DIAGRAM_BACKGROUNDS
|
|
167
|
+
) ? {
|
|
168
|
+
background: diagramData.renderHints.background
|
|
169
|
+
} : {}
|
|
170
|
+
} : void 0
|
|
171
|
+
});
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.error("Error parsing diagram JSON:", error);
|
|
174
|
+
throw new Error(
|
|
175
|
+
`Failed to parse diagram JSON: ${extractErrorMessage(error, "Unknown error")}`
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function generateDefaultPosition(index, diagramType) {
|
|
180
|
+
switch (diagramType) {
|
|
181
|
+
case "flowchart":
|
|
182
|
+
case "process":
|
|
183
|
+
return { x: 250, y: index * 120 + 50 };
|
|
184
|
+
case "orgchart":
|
|
185
|
+
case "pedigree": {
|
|
186
|
+
const level = Math.floor(index / 3);
|
|
187
|
+
const position = index % 3;
|
|
188
|
+
return { x: position * 200 + 100, y: level * 200 + 50 };
|
|
189
|
+
}
|
|
190
|
+
case "mindmap": {
|
|
191
|
+
const angle = index * 2 * Math.PI / 8;
|
|
192
|
+
const radius = 200 + Math.floor(index / 8) * 100;
|
|
193
|
+
return {
|
|
194
|
+
x: 300 + radius * Math.cos(angle),
|
|
195
|
+
y: 300 + radius * Math.sin(angle)
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
case "timeline":
|
|
199
|
+
return { x: index * 200 + 100, y: 200 };
|
|
200
|
+
case "network": {
|
|
201
|
+
const cols = 4;
|
|
202
|
+
const row = Math.floor(index / cols);
|
|
203
|
+
const col = index % cols;
|
|
204
|
+
return { x: col * 180 + 100 + row % 2 * 90, y: row * 140 + 80 };
|
|
205
|
+
}
|
|
206
|
+
case "system": {
|
|
207
|
+
const gridCols = 3;
|
|
208
|
+
const gridRow = Math.floor(index / gridCols);
|
|
209
|
+
const gridCol = index % gridCols;
|
|
210
|
+
return { x: gridCol * 220 + 120, y: gridRow * 160 + 100 };
|
|
211
|
+
}
|
|
212
|
+
default:
|
|
213
|
+
return {
|
|
214
|
+
x: index % 3 * 200 + 100,
|
|
215
|
+
y: Math.floor(index / 3) * 150 + 100
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function validateDiagram(diagram) {
|
|
220
|
+
if (!diagram.title || !diagram.nodes || !Array.isArray(diagram.nodes))
|
|
221
|
+
return false;
|
|
222
|
+
const nodeIds = /* @__PURE__ */ new Set();
|
|
223
|
+
for (const node of diagram.nodes) {
|
|
224
|
+
if (!node.id || !node.label) return false;
|
|
225
|
+
if (nodeIds.has(node.id)) return false;
|
|
226
|
+
nodeIds.add(node.id);
|
|
227
|
+
}
|
|
228
|
+
const byId = new Map(diagram.nodes.map((node) => [node.id, node]));
|
|
229
|
+
for (const node of diagram.nodes) {
|
|
230
|
+
if (!node.parentId) continue;
|
|
231
|
+
const parent = byId.get(node.parentId);
|
|
232
|
+
if (!parent?.isGroup || parent.id === node.id) return false;
|
|
233
|
+
const seen = /* @__PURE__ */ new Set([node.id]);
|
|
234
|
+
let ancestor = parent;
|
|
235
|
+
while (ancestor) {
|
|
236
|
+
if (seen.has(ancestor.id)) return false;
|
|
237
|
+
seen.add(ancestor.id);
|
|
238
|
+
ancestor = ancestor.parentId ? byId.get(ancestor.parentId) : void 0;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (diagram.edges) {
|
|
242
|
+
const edgeIds = /* @__PURE__ */ new Set();
|
|
243
|
+
for (const edge of diagram.edges) {
|
|
244
|
+
if (!edge.source || !edge.target) return false;
|
|
245
|
+
if (edgeIds.has(edge.id)) return false;
|
|
246
|
+
edgeIds.add(edge.id);
|
|
247
|
+
if (!nodeIds.has(edge.source) || !nodeIds.has(edge.target)) return false;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
function diagramToJSON(diagram) {
|
|
253
|
+
return JSON.stringify({ diagram }, null, 2);
|
|
254
|
+
}
|
|
255
|
+
function parseDiagramContent(content) {
|
|
256
|
+
try {
|
|
257
|
+
return parseDiagramJSON(content);
|
|
258
|
+
} catch {
|
|
259
|
+
return materializeDiagramDefaults({
|
|
260
|
+
title: "Simple Diagram",
|
|
261
|
+
description: "Generated from content",
|
|
262
|
+
type: "flowchart",
|
|
263
|
+
nodes: [
|
|
264
|
+
{
|
|
265
|
+
id: "node1",
|
|
266
|
+
label: "Start",
|
|
267
|
+
nodeType: "start",
|
|
268
|
+
position: { x: 250, y: 50 }
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: "node2",
|
|
272
|
+
label: "Process",
|
|
273
|
+
nodeType: "process",
|
|
274
|
+
position: { x: 250, y: 170 }
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: "node3",
|
|
278
|
+
label: "End",
|
|
279
|
+
nodeType: "end",
|
|
280
|
+
position: { x: 250, y: 290 }
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
edges: [
|
|
284
|
+
{ id: "edge1", source: "node1", target: "node2" },
|
|
285
|
+
{ id: "edge2", source: "node2", target: "node3" }
|
|
286
|
+
]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
export {
|
|
291
|
+
diagramToJSON,
|
|
292
|
+
materializeDiagramDefaults,
|
|
293
|
+
parseDiagramContent,
|
|
294
|
+
parseDiagramJSON,
|
|
295
|
+
validateDiagram
|
|
296
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which way a diagram flows when the canvas tells us the shape of its pane.
|
|
3
|
+
*
|
|
4
|
+
* Outside the canvas there is no presentation (`flow === null`) and the
|
|
5
|
+
* diagram keeps the direction its data asks for — behaviour unchanged.
|
|
6
|
+
*
|
|
7
|
+
* Inside the canvas the AXIS follows the pane: a tall narrow pane flows top to
|
|
8
|
+
* bottom, a wide one left to right (`preferredFlowDirection` from
|
|
9
|
+
* `@ai-matrx/canvas`). The data's hint only keeps its SENSE — a "BT" diagram
|
|
10
|
+
* stays bottom-up in a portrait pane and becomes right-to-left in a wide one.
|
|
11
|
+
* A family tree (pedigree) and an org chart are generational/hierarchical by
|
|
12
|
+
* meaning, so their direction is never re-chosen.
|
|
13
|
+
*/
|
|
14
|
+
export type DiagramDirection = "TB" | "LR" | "BT" | "RL";
|
|
15
|
+
export type CanvasFlow = "vertical" | "horizontal";
|
|
16
|
+
export declare function diagramDirectionForFlow(flow: CanvasFlow | null, hinted: DiagramDirection | undefined, diagramType: string): DiagramDirection;
|
|
17
|
+
/**
|
|
18
|
+
* When the pane's flow flips (split, unsplit, expand), re-lay the diagram out
|
|
19
|
+
* only when the current arrangement is still OURS: the automatic layout has
|
|
20
|
+
* run, nobody re-arranged it by hand, and the diagram is not an authored map
|
|
21
|
+
* whose layout is the document.
|
|
22
|
+
*/
|
|
23
|
+
export declare function shouldRelayoutOnFlowChange(input: {
|
|
24
|
+
previousFlow: CanvasFlow | null;
|
|
25
|
+
flow: CanvasFlow | null;
|
|
26
|
+
autoLaidOut: boolean;
|
|
27
|
+
personArranged: boolean;
|
|
28
|
+
authoring: boolean;
|
|
29
|
+
}): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const DIRECTION_IS_MEANING = /* @__PURE__ */ new Set(["pedigree", "orgchart"]);
|
|
2
|
+
function diagramDirectionForFlow(flow, hinted, diagramType) {
|
|
3
|
+
const authored = hinted ?? "TB";
|
|
4
|
+
if (flow === null || DIRECTION_IS_MEANING.has(diagramType)) return authored;
|
|
5
|
+
const reversed = authored === "BT" || authored === "RL";
|
|
6
|
+
if (flow === "vertical") return reversed ? "BT" : "TB";
|
|
7
|
+
return reversed ? "RL" : "LR";
|
|
8
|
+
}
|
|
9
|
+
function shouldRelayoutOnFlowChange(input) {
|
|
10
|
+
const { previousFlow, flow, autoLaidOut, personArranged, authoring } = input;
|
|
11
|
+
if (flow === null || previousFlow === null || flow === previousFlow) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return autoLaidOut && !personArranged && !authoring;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
diagramDirectionForFlow,
|
|
18
|
+
shouldRelayoutOnFlowChange
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatDiagramType: (type: string) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const formatDiagramType = (type) => {
|
|
2
|
+
const typeMap = {
|
|
3
|
+
flowchart: "Flow Chart",
|
|
4
|
+
mindmap: "Mind Map",
|
|
5
|
+
orgchart: "Organizational Chart",
|
|
6
|
+
network: "Network Diagram",
|
|
7
|
+
system: "System Architecture",
|
|
8
|
+
process: "Process Flow",
|
|
9
|
+
pedigree: "Family Pedigree",
|
|
10
|
+
timeline: "Timeline",
|
|
11
|
+
erd: "Entity Relationship Diagram",
|
|
12
|
+
sequence: "Sequence Diagram"
|
|
13
|
+
};
|
|
14
|
+
return typeMap[type] || type.charAt(0).toUpperCase() + type.slice(1);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
formatDiagramType
|
|
18
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DiffBlockProps {
|
|
3
|
+
content?: string;
|
|
4
|
+
isStreamActive?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/** A unified diff (not a JSON spec): at least one hunk header or +/- line. */
|
|
8
|
+
export declare function isUnifiedDiff(raw: string): boolean;
|
|
9
|
+
export declare const DiffBlock: React.FC<DiffBlockProps>;
|
|
10
|
+
export default DiffBlock;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useClipboard } from "@ai-matrx/kit/clipboard";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
|
+
import { clientLazy } from "../../../utils/client-lazy.js";
|
|
6
|
+
import { Check, Columns2, Copy, GitCompareArrows, Rows3, TriangleAlert } from "lucide-react";
|
|
7
|
+
import { toast } from "../../../host/toast.js";
|
|
8
|
+
import { Skeleton } from "@ai-matrx/design-system";
|
|
9
|
+
import { cn } from "@ai-matrx/design-system";
|
|
10
|
+
import CodeBlock from "../../../code-block/CodeBlock.js";
|
|
11
|
+
import { soleFence } from "@ai-matrx/content-ir/source";
|
|
12
|
+
import { ErrorAlchemyMenu } from "../../../host/ErrorActions.js";
|
|
13
|
+
import { useCanvasPresentation } from "@ai-matrx/canvas/react";
|
|
14
|
+
import { diffIsSplit } from "../canvas-adaptive.js";
|
|
15
|
+
import { Button } from "@ai-matrx/design-system/controls";
|
|
16
|
+
const DiffCanvas = clientLazy(() => import("./DiffCanvas.js"), {
|
|
17
|
+
loading: () => /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" })
|
|
18
|
+
});
|
|
19
|
+
function str(v) {
|
|
20
|
+
return v == null ? "" : typeof v === "string" ? v : String(v);
|
|
21
|
+
}
|
|
22
|
+
function parseDiff(raw) {
|
|
23
|
+
let s = raw.trim();
|
|
24
|
+
const fenced = soleFence(s);
|
|
25
|
+
if (fenced && ["", "json", "diff"].includes(fenced.lang.toLowerCase())) s = fenced.body.trim();
|
|
26
|
+
let obj;
|
|
27
|
+
try {
|
|
28
|
+
obj = JSON.parse(s);
|
|
29
|
+
} catch {
|
|
30
|
+
try {
|
|
31
|
+
obj = JSON.parse(s.replace(/,(\s*[}\]])/g, "$1"));
|
|
32
|
+
} catch {
|
|
33
|
+
return { error: "Diff needs a JSON object with `old` and `new` strings." };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!obj || typeof obj !== "object") return { error: "Diff needs a JSON object with `old` and `new`." };
|
|
37
|
+
const o = obj;
|
|
38
|
+
const oldValue = str(o.old ?? o.before ?? o.original ?? o.left);
|
|
39
|
+
const newValue = str(o.new ?? o.after ?? o.updated ?? o.modified ?? o.right);
|
|
40
|
+
if (!oldValue && !newValue) return { error: "Diff needs at least one of `old` / `new`." };
|
|
41
|
+
return {
|
|
42
|
+
title: typeof o.title === "string" ? o.title : void 0,
|
|
43
|
+
oldValue,
|
|
44
|
+
newValue,
|
|
45
|
+
split: o.split !== false,
|
|
46
|
+
splitExplicit: typeof o.split === "boolean"
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function isUnifiedDiff(raw) {
|
|
50
|
+
const s = raw.trimStart();
|
|
51
|
+
if (!s || s.startsWith("{") || s.startsWith("[")) return false;
|
|
52
|
+
return /^(@@ .* @@|\+\+\+ |--- |[+-](?![+-]{2}))/m.test(s);
|
|
53
|
+
}
|
|
54
|
+
const DiffBlock = (props) => {
|
|
55
|
+
const content = props.content ?? "";
|
|
56
|
+
if (isUnifiedDiff(content)) {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
CodeBlock,
|
|
59
|
+
{
|
|
60
|
+
showSource: true,
|
|
61
|
+
code: content,
|
|
62
|
+
language: "diff",
|
|
63
|
+
isStreamActive: props.isStreamActive,
|
|
64
|
+
className: props.className
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return /* @__PURE__ */ jsx(DiffSpecBlock, { ...props });
|
|
69
|
+
};
|
|
70
|
+
const DiffSpecBlock = ({ content = "", isStreamActive = false, className }) => {
|
|
71
|
+
const { copyText } = useClipboard({
|
|
72
|
+
notify: (message, kind) => kind === "error" ? toast.error(message) : toast.success(message)
|
|
73
|
+
});
|
|
74
|
+
const parsed = useMemo(() => isStreamActive ? null : parseDiff(content), [content, isStreamActive]);
|
|
75
|
+
const spec = parsed && !("error" in parsed) ? parsed : null;
|
|
76
|
+
const error = parsed && "error" in parsed ? parsed.error : null;
|
|
77
|
+
const [copied, setCopied] = useState(false);
|
|
78
|
+
const [split, setSplit] = useState(null);
|
|
79
|
+
const presentation = useCanvasPresentation();
|
|
80
|
+
const effectiveSplit = diffIsSplit({
|
|
81
|
+
presentation,
|
|
82
|
+
personChoice: split,
|
|
83
|
+
authored: spec?.split ?? true,
|
|
84
|
+
authoredExplicitly: spec?.splitExplicit ?? false
|
|
85
|
+
});
|
|
86
|
+
const handleCopy = async () => {
|
|
87
|
+
try {
|
|
88
|
+
await copyText(content.trim());
|
|
89
|
+
setCopied(true);
|
|
90
|
+
setTimeout(() => setCopied(false), 1500);
|
|
91
|
+
} catch {
|
|
92
|
+
toast.error("Couldn't copy");
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("my-3 overflow-hidden rounded-lg border border-border bg-card", className), children: [
|
|
96
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border bg-muted/50 px-3 py-1.5", children: [
|
|
97
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
98
|
+
/* @__PURE__ */ jsx(GitCompareArrows, { className: "h-3.5 w-3.5 shrink-0 text-primary" }),
|
|
99
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: spec?.title ?? "Changes" }),
|
|
100
|
+
isStreamActive && /* @__PURE__ */ jsx("span", { className: "shrink-0 animate-pulse text-xs text-muted-foreground", children: "\u2026" })
|
|
101
|
+
] }),
|
|
102
|
+
!isStreamActive && spec && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
103
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", icon: effectiveSplit ? /* @__PURE__ */ jsx(Rows3, {}) : /* @__PURE__ */ jsx(Columns2, {}), "aria-label": effectiveSplit ? "Unified view" : "Split view", title: effectiveSplit ? "Unified view" : "Split view", onClick: () => setSplit(!effectiveSplit) }),
|
|
104
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", icon: copied ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Copy, {}), "aria-label": copied ? "Copied" : "Copy source", title: copied ? "Copied" : "Copy source", onClick: handleCopy })
|
|
105
|
+
] })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-[60dvh] overflow-auto", children: isStreamActive ? /* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" }) }) : error ? /* @__PURE__ */ jsxs("div", { className: "m-3 flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm", children: [
|
|
108
|
+
/* @__PURE__ */ jsx(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-destructive" }),
|
|
109
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: error }),
|
|
110
|
+
/* @__PURE__ */ jsx(ErrorAlchemyMenu, { error })
|
|
111
|
+
] }) : spec ? /* @__PURE__ */ jsx("div", { "data-diff-view": effectiveSplit ? "split" : "unified", children: /* @__PURE__ */ jsx(DiffCanvas, { oldValue: spec.oldValue, newValue: spec.newValue, split: effectiveSplit }) }) : null })
|
|
112
|
+
] });
|
|
113
|
+
};
|
|
114
|
+
var DiffBlock_default = DiffBlock;
|
|
115
|
+
export {
|
|
116
|
+
DiffBlock,
|
|
117
|
+
DiffBlock_default as default,
|
|
118
|
+
isUnifiedDiff
|
|
119
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiffCanvas — the diff renderer for a DiffBlock (```diff fences).
|
|
3
|
+
*
|
|
4
|
+
* Self-sizing, chrome-less light-engine diff (DiffBlock provides the card,
|
|
5
|
+
* title, split/unified toggle, and copy). Uses the canonical InlineTextDiff so
|
|
6
|
+
* it shares the one diff engine + GitHub-style color palette with the rest of
|
|
7
|
+
* the app — no third-party diff library. DiffBlock still loads this file via
|
|
8
|
+
* `next/dynamic ssr:false`, the single boundary for this subtree.
|
|
9
|
+
*/
|
|
10
|
+
import React from "react";
|
|
11
|
+
export default function DiffCanvas({ oldValue, newValue, split, }: {
|
|
12
|
+
oldValue: string;
|
|
13
|
+
newValue: string;
|
|
14
|
+
split: boolean;
|
|
15
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { InlineTextDiff } from "@ai-matrx/diff/react";
|
|
4
|
+
function DiffCanvas({
|
|
5
|
+
oldValue,
|
|
6
|
+
newValue,
|
|
7
|
+
split
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx("div", { className: "px-1 py-1 text-[13px]", children: /* @__PURE__ */ jsx(
|
|
10
|
+
InlineTextDiff,
|
|
11
|
+
{
|
|
12
|
+
original: oldValue,
|
|
13
|
+
modified: newValue,
|
|
14
|
+
view: split ? "split" : "inline"
|
|
15
|
+
}
|
|
16
|
+
) });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
DiffCanvas as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Matrix binding of the OFFICIAL fallback renderer for a resolved `__kind`
|
|
3
|
+
* block that has no registered component (Shape System ruling R6).
|
|
4
|
+
*
|
|
5
|
+
* The view lives in `@ai-matrx/content-ir-react` (`GenericStructuredView`):
|
|
6
|
+
* envelope-first value recovery, the honest "no custom view yet" / "registered
|
|
7
|
+
* but held inactive" distinction, and the zero-data-loss verbatim backstop when
|
|
8
|
+
* nothing parsed. Its body renders through THIS app's structured-value floor
|
|
9
|
+
* (`StructuredValueView`) via the host seam — the reason a Study Pack step is a
|
|
10
|
+
* readable document instead of a JSON dump.
|
|
11
|
+
*
|
|
12
|
+
* Bare by construction (THE WRAPPER LAW): every host that routes a block here
|
|
13
|
+
* already draws chrome.
|
|
14
|
+
*/
|
|
15
|
+
import React from "react";
|
|
16
|
+
export interface GenericStructuredBlockProps {
|
|
17
|
+
/** The raw region source — the zero-loss floor when no envelope survived. */
|
|
18
|
+
content: string;
|
|
19
|
+
/** Carries `__ir` (the parsed envelope) and `__ir_route` (the seam marker). */
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
declare const GenericStructuredBlock: React.FC<GenericStructuredBlockProps>;
|
|
24
|
+
export default GenericStructuredBlock;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { Braces } from "lucide-react";
|
|
5
|
+
import { GenericStructuredView } from "@ai-matrx/content-ir-react";
|
|
6
|
+
import { reconstructRegionValue } from "@ai-matrx/content-ir";
|
|
7
|
+
import { ContentIrHostBoundary } from "../../../host/ContentIrHostBoundary.js";
|
|
8
|
+
import { readIrRouteMarker } from "../../../kinds/react/kind-route.js";
|
|
9
|
+
import { collectKindProblems } from "../../../kinds/react/kind-problems.js";
|
|
10
|
+
import { readEnvelope } from "../../../kinds/redux/render-block-envelope.js";
|
|
11
|
+
import { reportKindComponentIncident } from "../../../host/kind-incident.js";
|
|
12
|
+
import { KindFixItBar } from "../../../host/app-bindings.js";
|
|
13
|
+
import { StructuredValueTabs } from "./StructuredValueTabs.js";
|
|
14
|
+
const StillArriving = /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
15
|
+
/* @__PURE__ */ jsx(Braces, { className: "h-3.5 w-3.5 shrink-0 animate-pulse" }),
|
|
16
|
+
/* @__PURE__ */ jsx("span", { children: "Still arriving\u2026" })
|
|
17
|
+
] });
|
|
18
|
+
function useGenericFloorAlarm(metadata) {
|
|
19
|
+
const kind = readEnvelope(metadata)?.root.kind ?? null;
|
|
20
|
+
const reason = readIrRouteMarker(metadata)?.reason ?? null;
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!kind) return;
|
|
23
|
+
reportKindComponentIncident({
|
|
24
|
+
kind,
|
|
25
|
+
errorType: "generic_floor_render",
|
|
26
|
+
message: `"${kind}" rendered through the GENERIC structured viewer` + (reason === "inactive" ? " \u2014 a component row exists but is held is_active=false." : " \u2014 no component is bound, so the reader sees a key/value dump.")
|
|
27
|
+
});
|
|
28
|
+
}, [kind, reason]);
|
|
29
|
+
}
|
|
30
|
+
const GenericStructuredBlock = (props) => {
|
|
31
|
+
useGenericFloorAlarm(props.metadata);
|
|
32
|
+
const envelope = readEnvelope(props.metadata);
|
|
33
|
+
const value = envelope ? reconstructRegionValue(envelope) : void 0;
|
|
34
|
+
const settledKind = envelope?.root.kind && envelope.root.status === "complete" ? envelope.root.kind : null;
|
|
35
|
+
const problems = collectKindProblems(
|
|
36
|
+
envelope,
|
|
37
|
+
readIrRouteMarker(props.metadata)
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ jsx(ContentIrHostBoundary, { children: /* @__PURE__ */ jsx(
|
|
40
|
+
StructuredValueTabs,
|
|
41
|
+
{
|
|
42
|
+
value,
|
|
43
|
+
raw: props.content,
|
|
44
|
+
problems,
|
|
45
|
+
header: settledKind ? /* @__PURE__ */ jsx(KindFixItBar, { kind: settledKind, value }) : void 0,
|
|
46
|
+
children: /* @__PURE__ */ jsx(GenericStructuredView, { ...props, streamingIndicator: StillArriving })
|
|
47
|
+
}
|
|
48
|
+
) });
|
|
49
|
+
};
|
|
50
|
+
var GenericStructuredBlock_default = GenericStructuredBlock;
|
|
51
|
+
export {
|
|
52
|
+
GenericStructuredBlock_default as default
|
|
53
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { KindProblem } from "../../../kinds/react/kind-problems.js";
|
|
3
|
+
/**
|
|
4
|
+
* `value` feeds the JSON tab (pretty-printed, copyable); `raw` is the
|
|
5
|
+
* zero-loss fallback when no structured value survived. `header` renders any
|
|
6
|
+
* host status line (kind drift note, "still arriving") above the content.
|
|
7
|
+
*/
|
|
8
|
+
export declare function StructuredValueTabs({ value, raw, header, problems, children, }: {
|
|
9
|
+
value: unknown;
|
|
10
|
+
raw?: string | null;
|
|
11
|
+
header?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* What the parser/route recorded about this value being a BROKEN or
|
|
14
|
+
* unroutable kind instance (`collectKindProblems`). Non-empty adds the
|
|
15
|
+
* Errors tab — the exact problems, in-band, for everyone (Arman,
|
|
16
|
+
* 2026-08-29: a `__kind` that isn't kind-rendered must be acknowledged as
|
|
17
|
+
* a kind, with its exact errors — never an anonymous JSON dump).
|
|
18
|
+
*/
|
|
19
|
+
problems?: KindProblem[];
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}): React.JSX.Element;
|