@ai-matrx/rich-content 0.2.4 → 0.2.6
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 +18 -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 +32 -3
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { useState, useRef, useEffect, useCallback, useId, memo } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { cn } from "@ai-matrx/design-system";
|
|
6
|
+
import { Copy, Check, Bookmark, ExternalLink, FileText } from "lucide-react";
|
|
7
|
+
import { addUtmSource } from "../../../utils/lifted/url-utm.js";
|
|
8
|
+
class LinkErrorBoundary extends React.Component {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
super(props);
|
|
11
|
+
this.state = { hasError: false };
|
|
12
|
+
}
|
|
13
|
+
static getDerivedStateFromError() {
|
|
14
|
+
return { hasError: true };
|
|
15
|
+
}
|
|
16
|
+
componentDidCatch(error, errorInfo) {
|
|
17
|
+
console.error("LinkComponent Error:", error, errorInfo);
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
if (this.state.hasError) {
|
|
21
|
+
const { href, fallbackChildren } = this.props;
|
|
22
|
+
const safeHref = href ? addUtmSource(href) : "#";
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"a",
|
|
25
|
+
{
|
|
26
|
+
href: safeHref,
|
|
27
|
+
target: "_blank",
|
|
28
|
+
rel: "noopener noreferrer",
|
|
29
|
+
className: "text-blue-600 dark:text-blue-400 underline",
|
|
30
|
+
children: fallbackChildren || "Link"
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return this.props.children;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
let activePopupId = null;
|
|
38
|
+
const popupListeners = /* @__PURE__ */ new Set();
|
|
39
|
+
const LINK_MENU_OPEN_DELAY_MS = 250;
|
|
40
|
+
const setActivePopup = (id) => {
|
|
41
|
+
activePopupId = id;
|
|
42
|
+
popupListeners.forEach((listener) => listener(id));
|
|
43
|
+
};
|
|
44
|
+
const useGlobalPopupState = (componentId) => {
|
|
45
|
+
const [isActive, setIsActive] = useState(false);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const listener = (activeId) => {
|
|
48
|
+
setIsActive(activeId === componentId);
|
|
49
|
+
};
|
|
50
|
+
popupListeners.add(listener);
|
|
51
|
+
setIsActive(activePopupId === componentId);
|
|
52
|
+
return () => {
|
|
53
|
+
popupListeners.delete(listener);
|
|
54
|
+
};
|
|
55
|
+
}, [componentId]);
|
|
56
|
+
const openPopup = useCallback(
|
|
57
|
+
() => setActivePopup(componentId),
|
|
58
|
+
[componentId]
|
|
59
|
+
);
|
|
60
|
+
const closePopup = useCallback(() => setActivePopup(null), []);
|
|
61
|
+
return { isActive, openPopup, closePopup };
|
|
62
|
+
};
|
|
63
|
+
const LinkComponentCore = ({
|
|
64
|
+
href,
|
|
65
|
+
children
|
|
66
|
+
}) => {
|
|
67
|
+
if (!href || typeof href !== "string") {
|
|
68
|
+
return /* @__PURE__ */ jsx("span", { className: "text-blue-600 dark:text-blue-400", children: children || "Invalid Link" });
|
|
69
|
+
}
|
|
70
|
+
return /* @__PURE__ */ jsx(ValidLinkComponentCore, { href, children });
|
|
71
|
+
};
|
|
72
|
+
const ValidLinkComponentCore = ({
|
|
73
|
+
href,
|
|
74
|
+
children
|
|
75
|
+
}) => {
|
|
76
|
+
const finalHref = addUtmSource(href);
|
|
77
|
+
const componentId = `link-popup-${useId()}`;
|
|
78
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
79
|
+
const [copied, setCopied] = useState(false);
|
|
80
|
+
const [menuPosition, setMenuPosition] = useState({ x: 0, y: 0 });
|
|
81
|
+
const isMountedRef = useRef(false);
|
|
82
|
+
const linkRef = useRef(null);
|
|
83
|
+
const menuRef = useRef(null);
|
|
84
|
+
const mouseTrackingRef = useRef(false);
|
|
85
|
+
const openTimerRef = useRef(null);
|
|
86
|
+
const {
|
|
87
|
+
isActive: isPopupActive,
|
|
88
|
+
openPopup,
|
|
89
|
+
closePopup
|
|
90
|
+
} = useGlobalPopupState(componentId);
|
|
91
|
+
const clearOpenTimer = useCallback(() => {
|
|
92
|
+
if (openTimerRef.current) {
|
|
93
|
+
clearTimeout(openTimerRef.current);
|
|
94
|
+
openTimerRef.current = null;
|
|
95
|
+
}
|
|
96
|
+
}, []);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
isMountedRef.current = true;
|
|
99
|
+
return () => {
|
|
100
|
+
isMountedRef.current = false;
|
|
101
|
+
clearOpenTimer();
|
|
102
|
+
if (activePopupId === componentId) {
|
|
103
|
+
setActivePopup(null);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}, [clearOpenTimer, componentId]);
|
|
107
|
+
const handleMouseMove = useCallback(
|
|
108
|
+
(e) => {
|
|
109
|
+
if (!menuRef.current || !mouseTrackingRef.current) return;
|
|
110
|
+
try {
|
|
111
|
+
const menuRect = menuRef.current.getBoundingClientRect();
|
|
112
|
+
const isMouseNearMenu = e.clientX >= menuRect.left - 20 && e.clientX <= menuRect.right + 20 && e.clientY >= menuRect.top - 20 && e.clientY <= menuRect.bottom + 20;
|
|
113
|
+
const linkRect = linkRef.current?.getBoundingClientRect();
|
|
114
|
+
const isMouseNearLink = linkRect && e.clientX >= linkRect.left - 5 && e.clientX <= linkRect.right + 5 && e.clientY >= linkRect.top - 5 && e.clientY <= linkRect.bottom + 5;
|
|
115
|
+
if (!isMouseNearMenu && !isMouseNearLink) {
|
|
116
|
+
mouseTrackingRef.current = false;
|
|
117
|
+
setIsHovered(false);
|
|
118
|
+
closePopup();
|
|
119
|
+
}
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error("Error in handleMouseMove:", error);
|
|
122
|
+
mouseTrackingRef.current = false;
|
|
123
|
+
setIsHovered(false);
|
|
124
|
+
closePopup();
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
[closePopup]
|
|
128
|
+
);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (isPopupActive && isHovered) {
|
|
131
|
+
mouseTrackingRef.current = true;
|
|
132
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
133
|
+
} else {
|
|
134
|
+
mouseTrackingRef.current = false;
|
|
135
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
136
|
+
}
|
|
137
|
+
return () => {
|
|
138
|
+
mouseTrackingRef.current = false;
|
|
139
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
140
|
+
};
|
|
141
|
+
}, [isPopupActive, isHovered, handleMouseMove]);
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (!isPopupActive && isHovered) {
|
|
144
|
+
setIsHovered(false);
|
|
145
|
+
}
|
|
146
|
+
}, [isPopupActive, isHovered]);
|
|
147
|
+
const handleMouseEnter = useCallback(
|
|
148
|
+
(e) => {
|
|
149
|
+
try {
|
|
150
|
+
clearOpenTimer();
|
|
151
|
+
setMenuPosition({ x: e.clientX, y: e.clientY });
|
|
152
|
+
openTimerRef.current = setTimeout(() => {
|
|
153
|
+
openTimerRef.current = null;
|
|
154
|
+
setIsHovered(true);
|
|
155
|
+
openPopup();
|
|
156
|
+
}, LINK_MENU_OPEN_DELAY_MS);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error("Error in handleMouseEnter:", error);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
[clearOpenTimer, openPopup]
|
|
162
|
+
);
|
|
163
|
+
const handleMouseLeave = useCallback(() => {
|
|
164
|
+
clearOpenTimer();
|
|
165
|
+
}, [clearOpenTimer]);
|
|
166
|
+
const handleCopyLink = useCallback(() => {
|
|
167
|
+
if (!navigator.clipboard) {
|
|
168
|
+
console.error("Clipboard API not available");
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
navigator.clipboard.writeText(finalHref).then(() => {
|
|
172
|
+
setCopied(true);
|
|
173
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
174
|
+
}).catch((err) => {
|
|
175
|
+
console.error("Failed to copy link:", err);
|
|
176
|
+
});
|
|
177
|
+
}, [finalHref]);
|
|
178
|
+
const handleOpenInNewTab = useCallback(
|
|
179
|
+
(e) => {
|
|
180
|
+
e.stopPropagation();
|
|
181
|
+
try {
|
|
182
|
+
window.open(finalHref, "_blank", "noopener,noreferrer");
|
|
183
|
+
} catch (error) {
|
|
184
|
+
console.error("Failed to open link:", error);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
[finalHref]
|
|
188
|
+
);
|
|
189
|
+
const handleAddToFavorites = useCallback(() => {
|
|
190
|
+
console.log("Added to favorites:", { url: finalHref, title: children });
|
|
191
|
+
}, [finalHref, children]);
|
|
192
|
+
const handleGetContent = useCallback(() => {
|
|
193
|
+
console.log("Getting content from:", finalHref);
|
|
194
|
+
}, [finalHref]);
|
|
195
|
+
const getMenuStyle = useCallback(() => {
|
|
196
|
+
if (!menuPosition || !isMountedRef.current) return {};
|
|
197
|
+
try {
|
|
198
|
+
const menuWidth = 300;
|
|
199
|
+
const menuHeight = 200;
|
|
200
|
+
const windowWidth = window.innerWidth;
|
|
201
|
+
const windowHeight = window.innerHeight;
|
|
202
|
+
let left = menuPosition.x;
|
|
203
|
+
let top = menuPosition.y;
|
|
204
|
+
if (left + menuWidth > windowWidth) {
|
|
205
|
+
left = Math.max(10, windowWidth - menuWidth - 10);
|
|
206
|
+
}
|
|
207
|
+
if (top + menuHeight > windowHeight) {
|
|
208
|
+
top = Math.max(10, windowHeight - menuHeight - 10);
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
position: "fixed",
|
|
212
|
+
top: `${top}px`,
|
|
213
|
+
left: `${left}px`,
|
|
214
|
+
zIndex: 100
|
|
215
|
+
};
|
|
216
|
+
} catch (error) {
|
|
217
|
+
console.error("Error calculating menu position:", error);
|
|
218
|
+
return {};
|
|
219
|
+
}
|
|
220
|
+
}, [menuPosition]);
|
|
221
|
+
const truncateUrl = useCallback((url, maxLength = 40) => {
|
|
222
|
+
if (!url || url.length <= maxLength) return url;
|
|
223
|
+
const start = url.substring(0, maxLength / 2);
|
|
224
|
+
const end = url.substring(url.length - maxLength / 2);
|
|
225
|
+
return `${start}...${end}`;
|
|
226
|
+
}, []);
|
|
227
|
+
const displayText = typeof children === "string" ? children : "Link";
|
|
228
|
+
const popupMenu = isPopupActive && isHovered && isMountedRef.current && /* @__PURE__ */ jsxs(
|
|
229
|
+
"div",
|
|
230
|
+
{
|
|
231
|
+
ref: menuRef,
|
|
232
|
+
className: "bg-white dark:bg-gray-900 border-border rounded-lg shadow-2xl backdrop-blur-sm py-0 w-[280px] text-gray-700 dark:text-gray-200 text-sm overflow-hidden",
|
|
233
|
+
style: getMenuStyle(),
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 py-3 border-b border-gray-100 dark:border-gray-800", children: /* @__PURE__ */ jsx(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
className: "font-semibold text-base truncate text-gray-900 dark:text-gray-100",
|
|
239
|
+
title: displayText,
|
|
240
|
+
children: displayText
|
|
241
|
+
}
|
|
242
|
+
) }),
|
|
243
|
+
/* @__PURE__ */ jsxs("div", { className: "py-2", children: [
|
|
244
|
+
/* @__PURE__ */ jsxs(
|
|
245
|
+
"div",
|
|
246
|
+
{
|
|
247
|
+
className: "px-4 py-2.5 hover:bg-blue-50 dark:hover:bg-blue-900/20 cursor-pointer flex items-center gap-3 transition-colors duration-150 group",
|
|
248
|
+
onClick: handleCopyLink,
|
|
249
|
+
children: [
|
|
250
|
+
copied ? /* @__PURE__ */ jsx(
|
|
251
|
+
Check,
|
|
252
|
+
{
|
|
253
|
+
size: 16,
|
|
254
|
+
className: "text-green-600 dark:text-green-400 flex-shrink-0"
|
|
255
|
+
}
|
|
256
|
+
) : /* @__PURE__ */ jsx(
|
|
257
|
+
Copy,
|
|
258
|
+
{
|
|
259
|
+
size: 16,
|
|
260
|
+
className: "text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-400 flex-shrink-0 transition-colors"
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ jsx(
|
|
264
|
+
"span",
|
|
265
|
+
{
|
|
266
|
+
className: `${copied ? "text-green-700 dark:text-green-300" : "text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-gray-100"}`,
|
|
267
|
+
children: copied ? "Copied!" : "Copy link"
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
/* @__PURE__ */ jsxs(
|
|
274
|
+
"div",
|
|
275
|
+
{
|
|
276
|
+
className: "px-4 py-2.5 hover:bg-blue-50 dark:hover:bg-blue-900/20 cursor-pointer flex items-center gap-3 transition-colors duration-150 group",
|
|
277
|
+
onClick: handleOpenInNewTab,
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsx(
|
|
280
|
+
ExternalLink,
|
|
281
|
+
{
|
|
282
|
+
size: 16,
|
|
283
|
+
className: "text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-400 flex-shrink-0 transition-colors"
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-gray-100 truncate", children: "Open in new tab" })
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
/* @__PURE__ */ jsxs(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
className: "px-4 py-2.5 hover:bg-blue-50 dark:hover:bg-blue-900/20 cursor-pointer flex items-center gap-3 transition-colors duration-150 group",
|
|
294
|
+
onClick: handleAddToFavorites,
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ jsx(
|
|
297
|
+
Bookmark,
|
|
298
|
+
{
|
|
299
|
+
size: 16,
|
|
300
|
+
className: "text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-400 flex-shrink-0 transition-colors"
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-gray-100 truncate", children: "Add to favorites" })
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
/* @__PURE__ */ jsxs(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
className: "px-4 py-2.5 hover:bg-blue-50 dark:hover:bg-blue-900/20 cursor-pointer flex items-center gap-3 transition-colors duration-150 group",
|
|
311
|
+
onClick: handleGetContent,
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ jsx(
|
|
314
|
+
FileText,
|
|
315
|
+
{
|
|
316
|
+
size: 16,
|
|
317
|
+
className: "text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-400 flex-shrink-0 transition-colors"
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-700 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-gray-100 truncate", children: "Get content" })
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] }),
|
|
325
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 py-2.5 bg-gray-50 dark:bg-gray-800/50 border-t border-gray-100 dark:border-gray-800", children: /* @__PURE__ */ jsx(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
className: "text-[11px] text-gray-500 dark:text-gray-400 truncate font-mono",
|
|
329
|
+
title: finalHref,
|
|
330
|
+
children: truncateUrl(finalHref, 40)
|
|
331
|
+
}
|
|
332
|
+
) })
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
337
|
+
/* @__PURE__ */ jsx(
|
|
338
|
+
"a",
|
|
339
|
+
{
|
|
340
|
+
ref: linkRef,
|
|
341
|
+
href: finalHref,
|
|
342
|
+
target: "_blank",
|
|
343
|
+
rel: "noopener noreferrer",
|
|
344
|
+
onMouseEnter: handleMouseEnter,
|
|
345
|
+
onMouseLeave: handleMouseLeave,
|
|
346
|
+
className: cn(
|
|
347
|
+
"relative inline text-blue-600 dark:text-blue-400 underline font-medium",
|
|
348
|
+
"transition-all duration-200 hover:text-blue-700 dark:hover:text-blue-300",
|
|
349
|
+
isHovered && isPopupActive && "text-blue-800 dark:text-blue-200"
|
|
350
|
+
),
|
|
351
|
+
children
|
|
352
|
+
}
|
|
353
|
+
),
|
|
354
|
+
popupMenu && typeof document !== "undefined" && createPortal(popupMenu, document.body)
|
|
355
|
+
] });
|
|
356
|
+
};
|
|
357
|
+
const MemoizedLinkComponentCore = memo(
|
|
358
|
+
LinkComponentCore,
|
|
359
|
+
(prevProps, nextProps) => {
|
|
360
|
+
return prevProps.href === nextProps.href && prevProps.children === nextProps.children;
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
const LinkComponent = ({
|
|
364
|
+
href,
|
|
365
|
+
children
|
|
366
|
+
}) => {
|
|
367
|
+
return /* @__PURE__ */ jsx(LinkErrorBoundary, { href, fallbackChildren: children, children: /* @__PURE__ */ jsx(MemoizedLinkComponentCore, { href, children }) });
|
|
368
|
+
};
|
|
369
|
+
var LinkComponent_default = LinkComponent;
|
|
370
|
+
export {
|
|
371
|
+
LinkComponent,
|
|
372
|
+
LinkComponent_default as default
|
|
373
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MarkdownKindBlock — the registered web renderer for the `markdown` kind.
|
|
3
|
+
*
|
|
4
|
+
* ## Why it exists
|
|
5
|
+
*
|
|
6
|
+
* Arman's render law had two paths: "official declared kind component, or
|
|
7
|
+
* streaming markdown — that's it"
|
|
8
|
+
* (common-docs/systems/architecture/content-ir/FEATURE.md §4). The
|
|
9
|
+
* `markdown` kind — `{ text: string }`, the shape the agent output contract
|
|
10
|
+
* (§6) folds prose into — collapses those two paths into ONE by making the
|
|
11
|
+
* second path a kind whose component IS the proven streaming renderer.
|
|
12
|
+
*
|
|
13
|
+
* So this component invents NOTHING. It reads `text` off the kind instance and
|
|
14
|
+
* hands it to {@link MarkdownStream}, the engine that already renders every
|
|
15
|
+
* streamed assistant message. Prose renders as prose; a fenced kind payload
|
|
16
|
+
* inside that prose routes to ITS component through the same pipeline, exactly
|
|
17
|
+
* as it does in chat. Without this route the kind fell to
|
|
18
|
+
* `GenericStructuredBlock`, which showed a reader the field label "Text" above
|
|
19
|
+
* their own document — markdown source, unrendered.
|
|
20
|
+
*
|
|
21
|
+
* ## Route contract
|
|
22
|
+
*
|
|
23
|
+
* Reached ONLY through `applyIrKindRoute`'s resolver-only path (a
|
|
24
|
+
* `content_ir.kind_component` row: `markdown` / web / output /
|
|
25
|
+
* `markdown_stream`), which CLEARS `serverData` — the raw region's
|
|
26
|
+
* `{ language: "json" }` annotation is not kind data. The value comes from the
|
|
27
|
+
* envelope on `metadata.__ir`, with the same descending-fidelity recovery
|
|
28
|
+
* `WebAnalysisItemBlock` and the generic block use, so a region that never
|
|
29
|
+
* parsed still shows its source verbatim rather than nothing.
|
|
30
|
+
*
|
|
31
|
+
* ## Bare by construction (THE WRAPPER LAW)
|
|
32
|
+
*
|
|
33
|
+
* Every host that routes a block here already draws chrome, and MarkdownStream
|
|
34
|
+
* is the documented import for "bare rendering with no actions" (the
|
|
35
|
+
* `RichDocument` front door adds the toolkit). No card, no border, no padding.
|
|
36
|
+
*/
|
|
37
|
+
import React from "react";
|
|
38
|
+
export interface MarkdownKindBlockProps {
|
|
39
|
+
/** The raw region source — the zero-loss floor when no envelope survived. */
|
|
40
|
+
content: string;
|
|
41
|
+
/** Carries `__ir` (the parsed envelope) and `__ir_route` (the seam marker). */
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
/** True while the producing stream is still open. */
|
|
44
|
+
isStreamActive?: boolean;
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
declare const MarkdownKindBlock: React.FC<MarkdownKindBlockProps>;
|
|
48
|
+
export default MarkdownKindBlock;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { MarkdownStream } from "../../../host/app-bindings.js";
|
|
4
|
+
import {
|
|
5
|
+
RichContentDepthProvider,
|
|
6
|
+
useRichContentDepth
|
|
7
|
+
} from "../../../levels/depth.js";
|
|
8
|
+
import { NestedRichContent } from "../../../levels/standard/NestedRichContent.js";
|
|
9
|
+
import { readEnvelope } from "../../../kinds/redux/render-block-envelope.js";
|
|
10
|
+
import { reconstructRegionValue } from "@ai-matrx/content-ir";
|
|
11
|
+
function isRecord(value) {
|
|
12
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13
|
+
}
|
|
14
|
+
function readValue(content, metadata) {
|
|
15
|
+
const envelope = readEnvelope(metadata);
|
|
16
|
+
if (envelope) return reconstructRegionValue(envelope);
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(content);
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function readText(value) {
|
|
24
|
+
if (!isRecord(value)) return null;
|
|
25
|
+
return typeof value.text === "string" ? value.text : null;
|
|
26
|
+
}
|
|
27
|
+
const MarkdownKindBlock = ({
|
|
28
|
+
content,
|
|
29
|
+
metadata,
|
|
30
|
+
isStreamActive,
|
|
31
|
+
className
|
|
32
|
+
}) => {
|
|
33
|
+
const { depth } = useRichContentDepth();
|
|
34
|
+
const text = readText(readValue(content, metadata));
|
|
35
|
+
const markdown = text ?? content;
|
|
36
|
+
if (!markdown) return null;
|
|
37
|
+
if (depth > 0) {
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
NestedRichContent,
|
|
40
|
+
{
|
|
41
|
+
source: markdown,
|
|
42
|
+
isStreaming: isStreamActive,
|
|
43
|
+
className
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(RichContentDepthProvider, { depth: 1, children: /* @__PURE__ */ jsx(MarkdownStream, { imagePolicy: "inherit", content: markdown, isStreamActive }) }) });
|
|
48
|
+
};
|
|
49
|
+
var MarkdownKindBlock_default = MarkdownKindBlock;
|
|
50
|
+
export {
|
|
51
|
+
MarkdownKindBlock_default as default
|
|
52
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface MarkdownPreviewBlockProps {
|
|
3
|
+
content: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
isStreamActive?: boolean;
|
|
6
|
+
onCodeChange?: (newCode: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* The fenced document ALREADY RENDERED by a static root (the server level or
|
|
9
|
+
* the SSR'd static leaf — standard/static-standard.tsx), so its prose is in
|
|
10
|
+
* the server HTML. Used for the Preview view while the block is not
|
|
11
|
+
* streaming; without it the preview renders client-side through
|
|
12
|
+
* NestedRichContent. Both are the same core at the same depth.
|
|
13
|
+
*/
|
|
14
|
+
renderedPreview?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const MarkdownPreviewBlock: React.FC<MarkdownPreviewBlockProps>;
|
|
17
|
+
export default MarkdownPreviewBlock;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useClipboard } from "@ai-matrx/kit/clipboard";
|
|
4
|
+
import { toast } from "../../../host/toast.js";
|
|
5
|
+
import { useState, lazy, Suspense } from "react";
|
|
6
|
+
import { cn } from "@ai-matrx/design-system";
|
|
7
|
+
import { Copy, Check, Eye, Code2, FileText } from "lucide-react";
|
|
8
|
+
import { NestedRichContent } from "../../../levels/standard/NestedRichContent.js";
|
|
9
|
+
import MatrxMiniLoader from "../../../utils/lifted/MatrxMiniLoader.js";
|
|
10
|
+
import { Button } from "@ai-matrx/design-system/controls";
|
|
11
|
+
const CodeBlock = lazy(
|
|
12
|
+
() => import("../../../code-block/CodeBlock.js")
|
|
13
|
+
);
|
|
14
|
+
const MarkdownPreviewBlock = ({
|
|
15
|
+
content,
|
|
16
|
+
className,
|
|
17
|
+
isStreamActive,
|
|
18
|
+
onCodeChange,
|
|
19
|
+
renderedPreview
|
|
20
|
+
}) => {
|
|
21
|
+
const { copyText } = useClipboard({
|
|
22
|
+
notify: (message, kind) => kind === "error" ? toast.error(message) : toast.success(message)
|
|
23
|
+
});
|
|
24
|
+
const [mode, setMode] = useState("preview");
|
|
25
|
+
const [copied, setCopied] = useState(false);
|
|
26
|
+
const handleCopy = async () => {
|
|
27
|
+
await copyText(content);
|
|
28
|
+
setCopied(true);
|
|
29
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: cn(
|
|
35
|
+
"my-3 rounded-lg border border-border bg-card overflow-hidden",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 py-1.5 border-b border-border/50 bg-muted/30", children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
41
|
+
/* @__PURE__ */ jsx(FileText, { className: "w-3.5 h-3.5 text-blue-500" }),
|
|
42
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-mono font-semibold text-blue-600 dark:text-blue-400", children: "Markdown" })
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
45
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border/50 overflow-hidden mr-1", children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", pressed: mode === "preview", icon: /* @__PURE__ */ jsx(Eye, {}), onClick: () => setMode("preview"), children: "Preview" }),
|
|
47
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", pressed: mode === "source", icon: /* @__PURE__ */ jsx(Code2, {}), onClick: () => setMode("source"), children: "Source" })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", icon: copied ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Copy, {}), glyphTone: copied ? "success" : void 0, onClick: handleCopy, "aria-label": "Copy" })
|
|
50
|
+
] })
|
|
51
|
+
] }),
|
|
52
|
+
mode === "preview" ? /* @__PURE__ */ jsx("div", { className: "px-4 py-3", children: renderedPreview && !isStreamActive ? renderedPreview : /* @__PURE__ */ jsx(NestedRichContent, { source: content, isStreaming: isStreamActive }) }) : /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(MatrxMiniLoader, {}), children: /* @__PURE__ */ jsx(
|
|
53
|
+
CodeBlock,
|
|
54
|
+
{
|
|
55
|
+
showSource: true,
|
|
56
|
+
code: content,
|
|
57
|
+
language: "markdown",
|
|
58
|
+
fontSize: 14,
|
|
59
|
+
isStreamActive,
|
|
60
|
+
onCodeChange
|
|
61
|
+
}
|
|
62
|
+
) })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
var MarkdownPreviewBlock_default = MarkdownPreviewBlock;
|
|
68
|
+
export {
|
|
69
|
+
MarkdownPreviewBlock_default as default
|
|
70
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MermaidBlockData } from "@ai-matrx/agents/generated/stream-events";
|
|
3
|
+
export interface MermaidBlockProps {
|
|
4
|
+
content?: string;
|
|
5
|
+
serverData?: MermaidBlockData | null;
|
|
6
|
+
metadata?: Record<string, unknown>;
|
|
7
|
+
isStreamActive?: boolean;
|
|
8
|
+
conversationId?: string;
|
|
9
|
+
messageId?: string;
|
|
10
|
+
blockIndex?: number;
|
|
11
|
+
taskId?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
/** canvas_items row id when rendering a materialized artifact by reference. */
|
|
14
|
+
artifactId?: string;
|
|
15
|
+
/** Artifact version when known (rendered as a chip). */
|
|
16
|
+
artifactVersion?: number;
|
|
17
|
+
}
|
|
18
|
+
declare const MermaidBlock: React.FC<MermaidBlockProps>;
|
|
19
|
+
export default MermaidBlock;
|