@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,234 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectDiagramType,
|
|
3
|
+
splitFrontmatter
|
|
4
|
+
} from "./diagram-type.js";
|
|
5
|
+
import { soleFence } from "@ai-matrx/content-ir/source";
|
|
6
|
+
function humanizeMermaidError(raw) {
|
|
7
|
+
if (!raw) return raw;
|
|
8
|
+
const lower = raw.toLowerCase();
|
|
9
|
+
const isInternalNoise = lower.includes("circular structure") || lower.includes("__reactfiber") || lower.includes("htmlhtmlelement") || lower.includes("statenode") || lower.includes("converting circular");
|
|
10
|
+
if (isInternalNoise) {
|
|
11
|
+
return "The diagram could not be parsed \u2014 the syntax is invalid.";
|
|
12
|
+
}
|
|
13
|
+
const firstLine = raw.split("\n")[0]?.trim();
|
|
14
|
+
return firstLine && firstLine.length > 0 ? firstLine : raw;
|
|
15
|
+
}
|
|
16
|
+
const NORMALIZERS = [
|
|
17
|
+
{
|
|
18
|
+
rule: "strip-wrapping-fence",
|
|
19
|
+
detail: "Removed a stray ```mermaid fence wrapped around the diagram body",
|
|
20
|
+
apply: (s) => {
|
|
21
|
+
const fenced = soleFence(s);
|
|
22
|
+
return fenced && ["", "mermaid", "mmd"].includes(fenced.lang.toLowerCase()) ? fenced.body : s;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
rule: "normalize-whitespace",
|
|
27
|
+
detail: "Normalized line endings and removed BOM/zero-width characters",
|
|
28
|
+
apply: (s) => s.replace(/\r\n?/g, "\n").replace(/[]/g, "").replace(/^\n+/, "")
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
rule: "replace-smart-quotes",
|
|
32
|
+
detail: "Replaced smart quotes with straight quotes",
|
|
33
|
+
apply: (s) => s.replace(/[“”]/g, '"').replace(/[‘’]/g, "'")
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
rule: "convert-newline-escapes",
|
|
37
|
+
detail: "Converted literal \\n line-break escapes to <br/> (mermaid uses <br/>, not \\n)",
|
|
38
|
+
// The #1 LLM mistake: emitting a literal backslash-n (two chars) for a
|
|
39
|
+
// line break inside a label. Mermaid's parser rejects it; the line break
|
|
40
|
+
// token is <br/>. Real source newlines are 0x0A bytes and are untouched —
|
|
41
|
+
// this only rewrites the two-char escape sequences `\n` and `\r\n`.
|
|
42
|
+
apply: (s) => s.replace(/\\(?:r\\)?n/g, "<br/>")
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
rule: "decode-arrow-entities",
|
|
46
|
+
detail: "Decoded HTML-escaped arrows (--> \u2192 -->)",
|
|
47
|
+
apply: (s) => s.replace(/-->/g, "-->").replace(/->>/g, "->>").replace(/>/g, ">")
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
rule: "normalize-arrow-dashes",
|
|
51
|
+
detail: "Replaced en/em dashes inside arrows with ASCII hyphens (\u2014> \u2192 -->)",
|
|
52
|
+
// Only touches a dash-run that ENDS in `>` or BEGINS after `<`, so the
|
|
53
|
+
// arrow's shape is preserved across every diagram type — an em-dash in a
|
|
54
|
+
// label (no adjacent `>`/`<`) is never touched. Fixes editor/keyboard
|
|
55
|
+
// autocorrect turning `-->` into `—>`.
|
|
56
|
+
apply: (s) => s.replace(/[-–—=.]*[–—][-–—=.]*>/g, (run) => run.replace(/[–—]/g, "-")).replace(/<[-–—=.]*[–—][-–—=.]*/g, (run) => run.replace(/[–—]/g, "-"))
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
const FLOWCHART_ONLY = (t) => t === "flowchart";
|
|
60
|
+
const ANY = () => true;
|
|
61
|
+
function mapBodyLines(source, fn) {
|
|
62
|
+
const { bodyStartIndex, lines } = splitFrontmatter(source);
|
|
63
|
+
const out = lines.map((line, i) => i < bodyStartIndex ? line : fn(line));
|
|
64
|
+
return out.join("\n");
|
|
65
|
+
}
|
|
66
|
+
const FIXERS = [
|
|
67
|
+
{
|
|
68
|
+
rule: "header-own-line",
|
|
69
|
+
detail: "Moved the diagram header onto its own line",
|
|
70
|
+
appliesTo: FLOWCHART_ONLY,
|
|
71
|
+
apply: (s) => mapBodyLines(s, (line) => {
|
|
72
|
+
const m = /^(\s*)(flowchart|graph)\s+(TB|TD|LR|RL|BT)\s+(\S.*)$/.exec(
|
|
73
|
+
line
|
|
74
|
+
);
|
|
75
|
+
return m ? `${m[1]}${m[2]} ${m[3]}
|
|
76
|
+
${m[1]} ${m[4]}` : line;
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
rule: "fix-comment-syntax",
|
|
81
|
+
detail: "Converted // and # comment lines to %% comments",
|
|
82
|
+
appliesTo: ANY,
|
|
83
|
+
apply: (s) => mapBodyLines(
|
|
84
|
+
s,
|
|
85
|
+
(line) => line.replace(/^(\s*)(\/\/|#)(?!#)\s?/, "$1%% ")
|
|
86
|
+
)
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
rule: "strip-list-bullets",
|
|
90
|
+
detail: "Removed markdown list bullets the model added before statements",
|
|
91
|
+
appliesTo: ANY,
|
|
92
|
+
apply: (s) => mapBodyLines(s, (line) => line.replace(/^(\s*)[-*]\s+(?=\w)/, "$1"))
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
rule: "fix-arrow-typos",
|
|
96
|
+
detail: "Repaired arrow syntax (-> and => become -->)",
|
|
97
|
+
appliesTo: FLOWCHART_ONLY,
|
|
98
|
+
apply: (s) => mapBodyLines(
|
|
99
|
+
s,
|
|
100
|
+
(line) => line.replace(/(\s)=>(\s)/g, "$1-->$2").replace(/([^-<>])->([^>])/g, "$1-->$2")
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
rule: "quote-unsafe-labels",
|
|
105
|
+
detail: "Quoted node labels containing special characters",
|
|
106
|
+
appliesTo: FLOWCHART_ONLY,
|
|
107
|
+
apply: (s) => mapBodyLines(s, (line) => {
|
|
108
|
+
const UNSAFE = /[(){}\[\]:;#&|]/;
|
|
109
|
+
const wrap = (label) => `"${label.trim().replace(/"/g, "#quot;")}"`;
|
|
110
|
+
let out = line.replace(
|
|
111
|
+
/([A-Za-z0-9_]+)\(\[(?!")([^\]]*)\]\)/g,
|
|
112
|
+
(m, id, label) => UNSAFE.test(label) ? `${id}([${wrap(label)}])` : m
|
|
113
|
+
).replace(
|
|
114
|
+
/([A-Za-z0-9_]+)\[\((?!")([^)]*)\)\]/g,
|
|
115
|
+
(m, id, label) => UNSAFE.test(label) ? `${id}[(${wrap(label)})]` : m
|
|
116
|
+
).replace(
|
|
117
|
+
/([A-Za-z0-9_]+)\[\[(?!")([^\]]*)\]\]/g,
|
|
118
|
+
(m, id, label) => UNSAFE.test(label) ? `${id}[[${wrap(label)}]]` : m
|
|
119
|
+
).replace(
|
|
120
|
+
/([A-Za-z0-9_]+)\{\{(?!")([^}]*)\}\}/g,
|
|
121
|
+
(m, id, label) => UNSAFE.test(label) ? `${id}{{${wrap(label)}}}` : m
|
|
122
|
+
);
|
|
123
|
+
out = out.replace(
|
|
124
|
+
/([A-Za-z0-9_]+)\[(?!\[)(?!\()(?!")([^\]]*[(){}:;#&][^\]]*)\]/g,
|
|
125
|
+
(_m, id, label) => `${id}[${wrap(label)}]`
|
|
126
|
+
).replace(
|
|
127
|
+
/([A-Za-z0-9_]+)\{(?!\{)(?!")([^}]*[()[\]:;#&][^}]*)\}/g,
|
|
128
|
+
(_m, id, label) => `${id}{${wrap(label)}}`
|
|
129
|
+
);
|
|
130
|
+
return out;
|
|
131
|
+
})
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
rule: "fix-reserved-end",
|
|
135
|
+
detail: 'Renamed reserved node id "end" (lowercase "end" breaks flowcharts)',
|
|
136
|
+
appliesTo: FLOWCHART_ONLY,
|
|
137
|
+
apply: (s) => mapBodyLines(s, (line) => {
|
|
138
|
+
if (/^\s*end\s*$/.test(line)) return line;
|
|
139
|
+
return line.replace(/(^|\s|>)end(\[|\(|\{)/g, "$1end_node$2").replace(/(^|\s|>)end($|\s)/g, "$1end_node$2");
|
|
140
|
+
})
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
rule: "strip-markdown-emphasis",
|
|
144
|
+
detail: "Removed **bold** / __underline__ markers inside labels",
|
|
145
|
+
appliesTo: ANY,
|
|
146
|
+
apply: (s) => mapBodyLines(
|
|
147
|
+
s,
|
|
148
|
+
(line) => line.replace(/\*\*([^*]+)\*\*/g, "$1").replace(/__([^_]+)__/g, "$1")
|
|
149
|
+
)
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
rule: "remove-trailing-commas",
|
|
153
|
+
detail: "Removed trailing commas after data values",
|
|
154
|
+
appliesTo: (t) => t === "pie" || t === "xychart",
|
|
155
|
+
apply: (s) => mapBodyLines(s, (line) => line.replace(/,\s*$/, ""))
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
rule: "balance-subgraph-end",
|
|
159
|
+
detail: "Appended missing `end` for an unclosed subgraph",
|
|
160
|
+
appliesTo: FLOWCHART_ONLY,
|
|
161
|
+
apply: (s) => {
|
|
162
|
+
const opens = (s.match(/^\s*subgraph\b/gm) || []).length;
|
|
163
|
+
const ends = (s.match(/^\s*end\s*$/gm) || []).length;
|
|
164
|
+
if (opens > ends) return s + "\nend".repeat(opens - ends);
|
|
165
|
+
return s;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
rule: "escape-inner-quotes",
|
|
170
|
+
detail: "Escaped quote characters inside quoted labels",
|
|
171
|
+
appliesTo: FLOWCHART_ONLY,
|
|
172
|
+
apply: (s) => mapBodyLines(
|
|
173
|
+
s,
|
|
174
|
+
(line) => line.replace(
|
|
175
|
+
/([[({])"(.*)"([\])}])/g,
|
|
176
|
+
(full, open, inner, close) => inner.includes('"') ? `${open}"${inner.replace(/"/g, "#quot;")}"${close}` : full
|
|
177
|
+
)
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
function scream(fixes, originalLength) {
|
|
182
|
+
console.warn(
|
|
183
|
+
`[MermaidSanitize] RECOVERED an invalid diagram (${originalLength} chars) via ${fixes.length} fix(es): ` + fixes.map((f) => f.rule).join(" \u2192 "),
|
|
184
|
+
fixes
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
async function parseWithLadder(raw, validate, opts) {
|
|
188
|
+
const first = await validate(raw);
|
|
189
|
+
if (first.ok) return { source: raw, valid: true, fixes: [] };
|
|
190
|
+
const fixes = [];
|
|
191
|
+
let current = raw;
|
|
192
|
+
for (const n of NORMALIZERS) {
|
|
193
|
+
const next = n.apply(current);
|
|
194
|
+
if (next !== current) {
|
|
195
|
+
fixes.push({ rule: n.rule, detail: n.detail });
|
|
196
|
+
current = next;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (fixes.length > 0) {
|
|
200
|
+
const check = await validate(current);
|
|
201
|
+
if (check.ok) {
|
|
202
|
+
if (!opts.streaming) scream(fixes, raw.length);
|
|
203
|
+
return { source: current, valid: true, fixes };
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (opts.streaming) {
|
|
207
|
+
return { source: current, valid: false, fixes };
|
|
208
|
+
}
|
|
209
|
+
const diagramType = detectDiagramType(current);
|
|
210
|
+
let lastError = first.error;
|
|
211
|
+
for (const fixer of FIXERS) {
|
|
212
|
+
if (!fixer.appliesTo(diagramType)) continue;
|
|
213
|
+
const next = fixer.apply(current);
|
|
214
|
+
if (next === current) continue;
|
|
215
|
+
fixes.push({ rule: fixer.rule, detail: fixer.detail });
|
|
216
|
+
current = next;
|
|
217
|
+
const check = await validate(current);
|
|
218
|
+
if (check.ok) {
|
|
219
|
+
scream(fixes, raw.length);
|
|
220
|
+
return { source: current, valid: true, fixes };
|
|
221
|
+
}
|
|
222
|
+
lastError = check.error ?? lastError;
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
source: current,
|
|
226
|
+
valid: false,
|
|
227
|
+
fixes,
|
|
228
|
+
error: lastError ?? "Mermaid could not parse this diagram"
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
export {
|
|
232
|
+
humanizeMermaidError,
|
|
233
|
+
parseWithLadder
|
|
234
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the Mermaid system.
|
|
3
|
+
*
|
|
4
|
+
* The mermaid library itself is ONLY imported (dynamically) by runtime.ts.
|
|
5
|
+
* Everything else in components/mermaid/ stays mermaid-free so it can load
|
|
6
|
+
* in the initial bundle without dragging the ~2MB engine along.
|
|
7
|
+
*/
|
|
8
|
+
export type MermaidTheme = "default" | "dark" | "forest" | "neutral" | "base";
|
|
9
|
+
export type MermaidThemePreference = "auto" | MermaidTheme;
|
|
10
|
+
export type MermaidLook = "classic" | "handDrawn";
|
|
11
|
+
export type MermaidLayout = "dagre" | "elk";
|
|
12
|
+
/** Resolved options handed to the render engine (no "auto" — already resolved). */
|
|
13
|
+
export interface MermaidRenderOptions {
|
|
14
|
+
theme: MermaidTheme;
|
|
15
|
+
look: MermaidLook;
|
|
16
|
+
layout: MermaidLayout;
|
|
17
|
+
/**
|
|
18
|
+
* Where a pie chart draws its legend. "bottom" stacks it under the pie so a
|
|
19
|
+
* narrow pane or a phone shows every label; the renderer picks it from the
|
|
20
|
+
* frame's width. Omitted = mermaid's default (right of the pie).
|
|
21
|
+
*/
|
|
22
|
+
pieLegend?: MermaidPieLegend;
|
|
23
|
+
}
|
|
24
|
+
export type MermaidPieLegend = "right" | "bottom";
|
|
25
|
+
/** User-facing option set; theme may be "auto" (follows app dark/light mode). */
|
|
26
|
+
export interface MermaidOptionPreferences {
|
|
27
|
+
theme: MermaidThemePreference;
|
|
28
|
+
look: MermaidLook;
|
|
29
|
+
layout: MermaidLayout;
|
|
30
|
+
}
|
|
31
|
+
export declare const DEFAULT_MERMAID_PREFERENCES: MermaidOptionPreferences;
|
|
32
|
+
/** Per-artifact metadata persisted in canvas_items.content.metadata. */
|
|
33
|
+
export interface MermaidArtifactMetadata {
|
|
34
|
+
diagramType?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
theme?: MermaidThemePreference;
|
|
37
|
+
look?: MermaidLook;
|
|
38
|
+
layout?: MermaidLayout;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
export declare function resolveMermaidTheme(pref: MermaidThemePreference, appMode: "light" | "dark"): MermaidTheme;
|
|
42
|
+
/** Stable string key for a render-options combination (config re-init gate). */
|
|
43
|
+
export declare function renderOptionsKey(opts: MermaidRenderOptions): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
console.log(
|
|
2
|
+
"%c[MERMAID IMPORT TEST] components/mermaid/types.ts",
|
|
3
|
+
"color: #fff; background: #7c3aed; font-weight: bold; padding: 2px 6px; border-radius: 3px;"
|
|
4
|
+
);
|
|
5
|
+
const DEFAULT_MERMAID_PREFERENCES = {
|
|
6
|
+
theme: "auto",
|
|
7
|
+
look: "classic",
|
|
8
|
+
layout: "dagre"
|
|
9
|
+
};
|
|
10
|
+
function resolveMermaidTheme(pref, appMode) {
|
|
11
|
+
if (pref !== "auto") return pref;
|
|
12
|
+
return appMode === "dark" ? "dark" : "default";
|
|
13
|
+
}
|
|
14
|
+
function renderOptionsKey(opts) {
|
|
15
|
+
return `${opts.theme}|${opts.look}|${opts.layout}|${opts.pieLegend ?? "right"}`;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
DEFAULT_MERMAID_PREFERENCES,
|
|
19
|
+
renderOptionsKey,
|
|
20
|
+
resolveMermaidTheme
|
|
21
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIEW mode — the diagram, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* The workbench's other three modes are all EDITORS: `visual` is tap-to-edit,
|
|
5
|
+
* `outline` is structured rows, `code` is a CodeMirror/preview split. Before
|
|
6
|
+
* this pane there was no way to simply LOOK at a diagram in the canvas, and
|
|
7
|
+
* because `visual`/`outline` are gated on the structural-fidelity check, any
|
|
8
|
+
* diagram with advanced syntax (subgraphs, `style` lines — i.e. most real ones)
|
|
9
|
+
* fell back to `code` and greeted the user with source beside their diagram.
|
|
10
|
+
*
|
|
11
|
+
* So this is the default mode: full-pane, chrome-free, pan/zoom, no source. It
|
|
12
|
+
* renders through `MermaidRenderer` — the same renderer behind the inline chat
|
|
13
|
+
* block, the fullscreen view and the public share page — with the workbench's
|
|
14
|
+
* LIVE render options, so theme/look/layout changes from the toolbar apply here
|
|
15
|
+
* exactly as they do in the other modes.
|
|
16
|
+
*/
|
|
17
|
+
import React from "react";
|
|
18
|
+
import type { MermaidRenderOptions } from "../types.js";
|
|
19
|
+
interface ViewModePaneProps {
|
|
20
|
+
source: string;
|
|
21
|
+
options: MermaidRenderOptions;
|
|
22
|
+
}
|
|
23
|
+
export declare function ViewModePane({ source, options }: ViewModePaneProps): React.JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { MermaidRenderer } from "../MermaidRenderer.js";
|
|
4
|
+
function ViewModePane({ source, options }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full min-h-0 p-2", children: /* @__PURE__ */ jsx(MermaidRenderer, { source, options, fillHeight: true }) });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
ViewModePane
|
|
9
|
+
};
|
|
@@ -8,6 +8,6 @@ import { type ComponentType } from "react";
|
|
|
8
8
|
export declare function useIsClient(): boolean;
|
|
9
9
|
export declare function clientLazy<P extends object>(load: () => Promise<{
|
|
10
10
|
default: ComponentType<P>;
|
|
11
|
-
}
|
|
11
|
+
} | ComponentType<P>>, options?: {
|
|
12
12
|
loading?: ComponentType;
|
|
13
13
|
}): ComponentType<P>;
|
|
@@ -8,7 +8,10 @@ function useIsClient() {
|
|
|
8
8
|
return useSyncExternalStore(subscribe, onClient, onServer);
|
|
9
9
|
}
|
|
10
10
|
function clientLazy(load, options = {}) {
|
|
11
|
-
const Lazy = lazy(
|
|
11
|
+
const Lazy = lazy(async () => {
|
|
12
|
+
const m = await load();
|
|
13
|
+
return typeof m === "function" || !("default" in m) ? { default: m } : m;
|
|
14
|
+
});
|
|
12
15
|
const Loading = options.loading;
|
|
13
16
|
function ClientLazy(props) {
|
|
14
17
|
const client = useIsClient();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface DiffViewProps {
|
|
3
|
+
originalCode: string;
|
|
4
|
+
modifiedCode: string;
|
|
5
|
+
language: string;
|
|
6
|
+
showLineNumbers?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function DiffView({ originalCode, modifiedCode, language, showLineNumbers, className, }: DiffViewProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { DiffViewer } from "@ai-matrx/diff/react";
|
|
4
|
+
function DiffView({
|
|
5
|
+
originalCode,
|
|
6
|
+
modifiedCode,
|
|
7
|
+
language,
|
|
8
|
+
showLineNumbers = true,
|
|
9
|
+
className
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
DiffViewer,
|
|
13
|
+
{
|
|
14
|
+
original: originalCode,
|
|
15
|
+
modified: modifiedCode,
|
|
16
|
+
language,
|
|
17
|
+
engine: "auto",
|
|
18
|
+
defaultView: "inline",
|
|
19
|
+
showLineNumbers,
|
|
20
|
+
className
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
DiffView
|
|
26
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type GlyphTone } from "@ai-matrx/design-system/controls";
|
|
3
|
+
import { LucideIcon } from "lucide-react";
|
|
4
|
+
/**
|
|
5
|
+
* A door onto THE control: an icon-only controls `Button` (the 28px circle) with an optional
|
|
6
|
+
* tooltip. It has no size and no colour of its own — a glyph whose colour carries meaning says
|
|
7
|
+
* so with `glyphTone`; `className` places it (margin, position, flex), never restyles it.
|
|
8
|
+
*/
|
|
9
|
+
export interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
10
|
+
icon: LucideIcon | React.ComponentType;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
/** Legacy tone words map onto the control's variants: ghost → quiet, default → primary,
|
|
13
|
+
* destructive → danger. */
|
|
14
|
+
variant?: "ghost" | "outline" | "default" | "secondary" | "destructive" | "link";
|
|
15
|
+
/** The glyph's own status ink when its colour carries meaning. */
|
|
16
|
+
glyphTone?: GlyphTone;
|
|
17
|
+
/** Work in flight: the glyph turns (a refresh, a duplicate, an export). */
|
|
18
|
+
spinning?: boolean;
|
|
19
|
+
tooltipSide?: "top" | "right" | "bottom" | "left";
|
|
20
|
+
tooltipAlign?: "start" | "center" | "end";
|
|
21
|
+
tooltipOffset?: number;
|
|
22
|
+
}
|
|
23
|
+
declare const IconButton: React.FC<IconButtonProps>;
|
|
24
|
+
export default IconButton;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@ai-matrx/design-system";
|
|
3
|
+
import { Button } from "@ai-matrx/design-system/controls";
|
|
4
|
+
const VARIANT = {
|
|
5
|
+
ghost: "quiet",
|
|
6
|
+
outline: "outline",
|
|
7
|
+
secondary: "outline",
|
|
8
|
+
default: "primary",
|
|
9
|
+
destructive: "danger",
|
|
10
|
+
link: "link"
|
|
11
|
+
};
|
|
12
|
+
const IconButton = ({
|
|
13
|
+
icon: Icon,
|
|
14
|
+
tooltip,
|
|
15
|
+
variant = "ghost",
|
|
16
|
+
glyphTone,
|
|
17
|
+
spinning = false,
|
|
18
|
+
tooltipSide = "bottom",
|
|
19
|
+
tooltipAlign = "center",
|
|
20
|
+
tooltipOffset = 5,
|
|
21
|
+
"aria-label": ariaLabel,
|
|
22
|
+
...props
|
|
23
|
+
}) => {
|
|
24
|
+
const control = /* @__PURE__ */ jsx(
|
|
25
|
+
Button,
|
|
26
|
+
{
|
|
27
|
+
variant: VARIANT[variant],
|
|
28
|
+
icon: spinning ? /* @__PURE__ */ jsx(Icon, { className: "animate-spin" }) : /* @__PURE__ */ jsx(Icon, {}),
|
|
29
|
+
glyphTone,
|
|
30
|
+
"aria-label": ariaLabel ?? tooltip ?? "Action",
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
if (!tooltip) return control;
|
|
35
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
36
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: control }),
|
|
37
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: tooltipSide, align: tooltipAlign, className: "z-[9999]", sideOffset: tooltipOffset, children: tooltip })
|
|
38
|
+
] });
|
|
39
|
+
};
|
|
40
|
+
var IconButton_default = IconButton;
|
|
41
|
+
export {
|
|
42
|
+
IconButton_default as default
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MatrxMiniLoader(): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import LoadingSpinner from "./loading-spinner.js";
|
|
3
|
+
function MatrxMiniLoader() {
|
|
4
|
+
return /* @__PURE__ */ jsx(LoadingSpinner, { variant: "dots", message: "Initializing Matrx...", size: "md" });
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
MatrxMiniLoader as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@ai-matrx/design-system";
|
|
4
|
+
function ShimmerText({ text, className }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"span",
|
|
7
|
+
{
|
|
8
|
+
className: cn(
|
|
9
|
+
"inline-block bg-clip-text text-transparent bg-[length:200%_100%] animate-shimmer",
|
|
10
|
+
className
|
|
11
|
+
),
|
|
12
|
+
style: {
|
|
13
|
+
backgroundImage: "linear-gradient(90deg, hsl(var(--muted-foreground) / 0.3) 0%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground) / 0.3) 100%)"
|
|
14
|
+
},
|
|
15
|
+
children: text
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
ShimmerText
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface SuspenseLoaderProps {
|
|
2
|
+
/** Size of the spinner */
|
|
3
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
4
|
+
/** Whether to center in container */
|
|
5
|
+
centered?: boolean;
|
|
6
|
+
/** Context shown beside the spinner and announced as a live status. */
|
|
7
|
+
message?: string;
|
|
8
|
+
/** Custom className */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Minimal loading component for Suspense boundaries
|
|
13
|
+
* Adaptable to any context with simple spinner animation
|
|
14
|
+
*/
|
|
15
|
+
export default function SuspenseLoader({ size, centered, message, className, }: SuspenseLoaderProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Loader2 } from "lucide-react";
|
|
3
|
+
const sizeClasses = {
|
|
4
|
+
xs: "h-3 w-3",
|
|
5
|
+
sm: "h-4 w-4",
|
|
6
|
+
md: "h-6 w-6",
|
|
7
|
+
lg: "h-8 w-8"
|
|
8
|
+
};
|
|
9
|
+
function SuspenseLoader({
|
|
10
|
+
size = "sm",
|
|
11
|
+
centered = true,
|
|
12
|
+
message,
|
|
13
|
+
className = ""
|
|
14
|
+
}) {
|
|
15
|
+
const spinner = /* @__PURE__ */ jsx(
|
|
16
|
+
Loader2,
|
|
17
|
+
{
|
|
18
|
+
className: `${sizeClasses[size]} animate-spin text-muted-foreground opacity-50 ${className}`,
|
|
19
|
+
"aria-hidden": message ? true : void 0,
|
|
20
|
+
"aria-label": message ? void 0 : "Loading"
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
const content = message ? /* @__PURE__ */ jsxs(
|
|
24
|
+
"span",
|
|
25
|
+
{
|
|
26
|
+
className: "inline-flex items-center gap-2",
|
|
27
|
+
role: "status",
|
|
28
|
+
"aria-live": "polite",
|
|
29
|
+
children: [
|
|
30
|
+
spinner,
|
|
31
|
+
/* @__PURE__ */ jsx("span", { children: message })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
) : spinner;
|
|
35
|
+
if (centered) {
|
|
36
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-full h-full min-h-[2rem]", children: content });
|
|
37
|
+
}
|
|
38
|
+
return content;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
SuspenseLoader as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type SimpleTooltipProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
text?: string;
|
|
5
|
+
};
|
|
6
|
+
type AdvancedTooltipProps = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
text?: string;
|
|
9
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
10
|
+
align?: "center" | "start" | "end";
|
|
11
|
+
delayDuration?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
sideOffset?: number;
|
|
14
|
+
contentClassName?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
variant?: "default" | "error" | "warning" | "success";
|
|
17
|
+
};
|
|
18
|
+
export declare const SimpleTooltip: ({ children, text }: SimpleTooltipProps) => string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
|
|
19
|
+
export declare const AdvancedTooltip: ({ children, text, side, align, delayDuration, className, sideOffset, contentClassName, disabled, variant, }: AdvancedTooltipProps) => string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
Tooltip,
|
|
5
|
+
TooltipContent,
|
|
6
|
+
TooltipTrigger
|
|
7
|
+
} from "@ai-matrx/design-system";
|
|
8
|
+
const SimpleTooltip = ({ children, text }) => {
|
|
9
|
+
if (!text) return children;
|
|
10
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
11
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children }),
|
|
12
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: text }) })
|
|
13
|
+
] });
|
|
14
|
+
};
|
|
15
|
+
const AdvancedTooltip = ({
|
|
16
|
+
children,
|
|
17
|
+
text,
|
|
18
|
+
side = "top",
|
|
19
|
+
align = "center",
|
|
20
|
+
delayDuration = 200,
|
|
21
|
+
className = "",
|
|
22
|
+
sideOffset = 4,
|
|
23
|
+
contentClassName = "",
|
|
24
|
+
disabled = false,
|
|
25
|
+
variant = "default"
|
|
26
|
+
}) => {
|
|
27
|
+
if (!text || disabled) return children;
|
|
28
|
+
const variantStyles = {
|
|
29
|
+
default: "bg-popover text-popover-foreground",
|
|
30
|
+
error: "bg-destructive text-destructive-foreground",
|
|
31
|
+
warning: "bg-warning text-black",
|
|
32
|
+
success: "bg-success text-black"
|
|
33
|
+
};
|
|
34
|
+
const baseContentClasses = "rounded-md px-3 py-1.5 text-sm shadow-md animate-in fade-in-0 zoom-in-95";
|
|
35
|
+
return /* @__PURE__ */ jsxs(Tooltip, { delayDuration, children: [
|
|
36
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, className, children }),
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
TooltipContent,
|
|
39
|
+
{
|
|
40
|
+
side,
|
|
41
|
+
align,
|
|
42
|
+
sideOffset,
|
|
43
|
+
className: `${baseContentClasses} ${variantStyles[variant]} ${contentClassName}`,
|
|
44
|
+
children: /* @__PURE__ */ jsx("p", { className: "leading-none whitespace-pre-wrap", children: text })
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] });
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
AdvancedTooltip,
|
|
51
|
+
SimpleTooltip
|
|
52
|
+
};
|