@ai-matrx/rich-content 0.2.3 → 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 +22 -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/csv/CsvBlock.js +5 -1
- 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,313 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { InlineCodeSnippet } from "../../display/chat-markdown/InlineCodeSnippet.js";
|
|
4
|
+
import { MarkdownTableScrollArea } from "../../display/tables/MarkdownTableScrollArea.js";
|
|
5
|
+
import {
|
|
6
|
+
THICK_HR_SENTINEL,
|
|
7
|
+
detectTextDirection,
|
|
8
|
+
getDirectionClasses,
|
|
9
|
+
getDirectionFontSize
|
|
10
|
+
} from "./prose-prepare.js";
|
|
11
|
+
import { PROSE_INLINE_ELEMENTS } from "./prose-inline-elements.js";
|
|
12
|
+
const ListItemComponent = ({ children, node, id, value }) => {
|
|
13
|
+
const itemText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
14
|
+
const itemDirection = detectTextDirection(itemText);
|
|
15
|
+
const nodeClassName = node?.properties?.className;
|
|
16
|
+
const isTaskItem = Array.isArray(nodeClassName) && nodeClassName.includes("task-list-item");
|
|
17
|
+
if (isTaskItem) {
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
"li",
|
|
20
|
+
{
|
|
21
|
+
id,
|
|
22
|
+
value,
|
|
23
|
+
className: `mb-1 ${getDirectionFontSize(itemDirection)} ${getDirectionClasses(itemDirection)}`,
|
|
24
|
+
dir: itemDirection,
|
|
25
|
+
children
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"li",
|
|
31
|
+
{
|
|
32
|
+
id,
|
|
33
|
+
value,
|
|
34
|
+
className: `mb-1 ${getDirectionFontSize(itemDirection)} ${getDirectionClasses(itemDirection)}`,
|
|
35
|
+
dir: itemDirection,
|
|
36
|
+
children
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
function renderProseTable({ node, children, ...props }, after) {
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
42
|
+
/* @__PURE__ */ jsx(MarkdownTableScrollArea, { className: "my-3 rounded-md border border-border", children: /* @__PURE__ */ jsx("table", { className: "w-full text-sm border-collapse", ...props, children }) }),
|
|
43
|
+
after
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
const PROSE_BLOCK_ELEMENTS = {
|
|
47
|
+
...PROSE_INLINE_ELEMENTS,
|
|
48
|
+
p: ({ node, children, ...props }) => {
|
|
49
|
+
const childArray = React.Children.toArray(children);
|
|
50
|
+
if (childArray.length === 1 && childArray[0] === "\xA0") {
|
|
51
|
+
return /* @__PURE__ */ jsx("div", { className: "h-[0.75em]" });
|
|
52
|
+
}
|
|
53
|
+
if (childArray.length === 1 && childArray[0] === THICK_HR_SENTINEL) {
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
"hr",
|
|
56
|
+
{
|
|
57
|
+
className: "my-5 border-0 h-[3px] rounded-full bg-blue-500 dark:bg-blue-400",
|
|
58
|
+
role: "separator"
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
let isMathOnly = false;
|
|
63
|
+
if (childArray.length === 1) {
|
|
64
|
+
const child = childArray[0];
|
|
65
|
+
if (child && typeof child === "object" && "props" in child && child.props && typeof child.props === "object" && "className" in child.props && typeof child.props.className === "string") {
|
|
66
|
+
isMathOnly = child.props.className.includes("katex");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const extractTextFromChildren = (children2) => {
|
|
70
|
+
if (typeof children2 === "string") return children2;
|
|
71
|
+
if (Array.isArray(children2)) {
|
|
72
|
+
return children2.map((child) => extractTextFromChildren(child)).join("");
|
|
73
|
+
}
|
|
74
|
+
if (children2 && typeof children2 === "object" && "props" in children2 && children2.props && typeof children2.props === "object" && "children" in children2.props) {
|
|
75
|
+
return extractTextFromChildren(children2.props.children);
|
|
76
|
+
}
|
|
77
|
+
return "";
|
|
78
|
+
};
|
|
79
|
+
const paragraphText = extractTextFromChildren(children);
|
|
80
|
+
const paragraphDirection = detectTextDirection(paragraphText);
|
|
81
|
+
const paragraphDirClasses = getDirectionClasses(paragraphDirection);
|
|
82
|
+
if (isMathOnly) {
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
"p",
|
|
85
|
+
{
|
|
86
|
+
className: "font-sans tracking-wide leading-relaxed text-base mb-4 text-center",
|
|
87
|
+
...props,
|
|
88
|
+
children
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
"p",
|
|
94
|
+
{
|
|
95
|
+
className: `font-sans tracking-wide leading-relaxed ${getDirectionFontSize(paragraphDirection)} mb-2 pl-0 ml-0 ${paragraphDirClasses}`,
|
|
96
|
+
dir: paragraphDirection,
|
|
97
|
+
...props,
|
|
98
|
+
children
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
blockquote: ({ node, children, ...props }) => {
|
|
103
|
+
const blockquoteText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
104
|
+
const blockquoteDirection = detectTextDirection(blockquoteText);
|
|
105
|
+
const isRtl = blockquoteDirection === "rtl";
|
|
106
|
+
return /* @__PURE__ */ jsx(
|
|
107
|
+
"blockquote",
|
|
108
|
+
{
|
|
109
|
+
className: `${isRtl ? "pr-4 border-r-4" : "pl-4 border-l-4"} py-3 border-blue-200 dark:border-blue-700 italic text-gray-700 dark:text-gray-300 bg-blue-50 dark:bg-blue-950/20 ${getDirectionClasses(blockquoteDirection)}`,
|
|
110
|
+
dir: blockquoteDirection,
|
|
111
|
+
...props,
|
|
112
|
+
children
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
ul: ({ node, children, ...props }) => {
|
|
117
|
+
const listText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
118
|
+
const listDirection = detectTextDirection(listText);
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
"ul",
|
|
121
|
+
{
|
|
122
|
+
className: `matrx-md-ul mb-3 leading-relaxed ${getDirectionFontSize(listDirection)} pl-6 ${getDirectionClasses(listDirection)}`,
|
|
123
|
+
dir: listDirection,
|
|
124
|
+
...props,
|
|
125
|
+
children
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
},
|
|
129
|
+
ol: ({ node, children, ...props }) => {
|
|
130
|
+
const listText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
131
|
+
const listDirection = detectTextDirection(listText);
|
|
132
|
+
return /* @__PURE__ */ jsx(
|
|
133
|
+
"ol",
|
|
134
|
+
{
|
|
135
|
+
className: `matrx-md-ol mb-3 leading-relaxed ${getDirectionFontSize(listDirection)} pl-6 ${getDirectionClasses(listDirection)}`,
|
|
136
|
+
dir: listDirection,
|
|
137
|
+
...props,
|
|
138
|
+
children
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
},
|
|
142
|
+
li: ({ node, children, ...props }) => {
|
|
143
|
+
return /* @__PURE__ */ jsx(ListItemComponent, { node, id: props.id, value: props.value !== void 0 && Number.isFinite(Number(props.value)) ? Number(props.value) : void 0, children });
|
|
144
|
+
},
|
|
145
|
+
h1: ({ node, children, ...props }) => {
|
|
146
|
+
const headingText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
147
|
+
const headingDirection = detectTextDirection(headingText);
|
|
148
|
+
return /* @__PURE__ */ jsx(
|
|
149
|
+
"h1",
|
|
150
|
+
{
|
|
151
|
+
className: `text-xl text-blue-500 font-bold mt-4 mb-2 font-heading ${getDirectionClasses(headingDirection)}`,
|
|
152
|
+
dir: headingDirection,
|
|
153
|
+
...props,
|
|
154
|
+
children
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
h2: ({ node, children, ...props }) => {
|
|
159
|
+
const headingText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
160
|
+
const headingDirection = detectTextDirection(headingText);
|
|
161
|
+
return /* @__PURE__ */ jsx(
|
|
162
|
+
"h2",
|
|
163
|
+
{
|
|
164
|
+
className: `text-lg text-blue-500 font-semibold mt-3 mb-1.5 font-heading ${getDirectionClasses(headingDirection)}`,
|
|
165
|
+
dir: headingDirection,
|
|
166
|
+
...props,
|
|
167
|
+
children
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
h3: ({ node, children, ...props }) => {
|
|
172
|
+
const headingText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
173
|
+
const headingDirection = detectTextDirection(headingText);
|
|
174
|
+
return /* @__PURE__ */ jsx(
|
|
175
|
+
"h3",
|
|
176
|
+
{
|
|
177
|
+
className: `text-base text-blue-500 font-semibold mt-2 mb-1 font-heading ${getDirectionClasses(headingDirection)}`,
|
|
178
|
+
dir: headingDirection,
|
|
179
|
+
...props,
|
|
180
|
+
children
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
},
|
|
184
|
+
h4: ({ node, children, ...props }) => {
|
|
185
|
+
const headingText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
186
|
+
const headingDirection = detectTextDirection(headingText);
|
|
187
|
+
return /* @__PURE__ */ jsx(
|
|
188
|
+
"h4",
|
|
189
|
+
{
|
|
190
|
+
className: `text-sm text-blue-400 font-semibold mt-2 mb-1 font-heading ${getDirectionClasses(headingDirection)}`,
|
|
191
|
+
dir: headingDirection,
|
|
192
|
+
...props,
|
|
193
|
+
children
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
},
|
|
197
|
+
pre: ({ node, children, ...props }) => {
|
|
198
|
+
const childArray = React.Children.toArray(children);
|
|
199
|
+
const codeChild = childArray.find((child) => {
|
|
200
|
+
if (!React.isValidElement(child)) return false;
|
|
201
|
+
const p = child.props;
|
|
202
|
+
return p.node?.tagName === "code" || typeof p.className === "string";
|
|
203
|
+
});
|
|
204
|
+
if (React.isValidElement(codeChild)) {
|
|
205
|
+
const codeProps = codeChild.props;
|
|
206
|
+
const langClass = String(codeProps.className || "");
|
|
207
|
+
const langMatch = langClass.match(/language-(\w+)/);
|
|
208
|
+
const language = langMatch?.[1];
|
|
209
|
+
const codeText = String(codeProps.children ?? "").replace(
|
|
210
|
+
/\n$/,
|
|
211
|
+
""
|
|
212
|
+
);
|
|
213
|
+
if (codeText) {
|
|
214
|
+
return /* @__PURE__ */ jsx(
|
|
215
|
+
InlineCodeSnippet,
|
|
216
|
+
{
|
|
217
|
+
code: codeText,
|
|
218
|
+
language,
|
|
219
|
+
className: "my-2",
|
|
220
|
+
renderVariables: true
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return /* @__PURE__ */ jsx("pre", { className: "my-3", ...props, children });
|
|
226
|
+
},
|
|
227
|
+
hr: ({ node, ...props }) => /* @__PURE__ */ jsx(
|
|
228
|
+
"hr",
|
|
229
|
+
{
|
|
230
|
+
className: "my-3 border-t border-gray-300 dark:border-gray-600",
|
|
231
|
+
...props
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
div: ({ node, className, children, ...props }) => {
|
|
235
|
+
return /* @__PURE__ */ jsx("div", { className, ...props, children });
|
|
236
|
+
},
|
|
237
|
+
table: (props) => renderProseTable(props),
|
|
238
|
+
thead: ({ node, children, ...props }) => /* @__PURE__ */ jsx("thead", { className: "bg-muted/50", ...props, children }),
|
|
239
|
+
tbody: ({ node, children, ...props }) => /* @__PURE__ */ jsx("tbody", { ...props, children }),
|
|
240
|
+
tr: ({ node, children, ...props }) => /* @__PURE__ */ jsx(
|
|
241
|
+
"tr",
|
|
242
|
+
{
|
|
243
|
+
className: "border-t border-border/30 hover:bg-muted/20 transition-colors",
|
|
244
|
+
...props,
|
|
245
|
+
children
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
th: ({ node, children, ...props }) => /* @__PURE__ */ jsx(
|
|
249
|
+
"th",
|
|
250
|
+
{
|
|
251
|
+
className: "px-3 py-1.5 text-left text-xs font-semibold text-foreground border-r border-border/30 last:border-r-0",
|
|
252
|
+
...props,
|
|
253
|
+
children
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
td: ({ node, children, ...props }) => /* @__PURE__ */ jsx(
|
|
257
|
+
"td",
|
|
258
|
+
{
|
|
259
|
+
className: "px-3 py-1.5 text-foreground border-r border-border/30 last:border-r-0",
|
|
260
|
+
...props,
|
|
261
|
+
children
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
};
|
|
265
|
+
const PROSE_FRAME_CSS = `
|
|
266
|
+
/* Center display math that appears after a line break */
|
|
267
|
+
.math-content-wrapper p > .block + .katex {
|
|
268
|
+
display: block;
|
|
269
|
+
text-align: center;
|
|
270
|
+
margin: 1em 0;
|
|
271
|
+
font-size: 1.5em;
|
|
272
|
+
}
|
|
273
|
+
/* Increase font size for standalone math paragraphs */
|
|
274
|
+
.math-content-wrapper p.text-center .katex {
|
|
275
|
+
font-size: 1.5em;
|
|
276
|
+
}
|
|
277
|
+
/* Override pre tags that contain inline code (indented text blocks) */
|
|
278
|
+
.math-content-wrapper pre:has(> code.bg-blue-100),
|
|
279
|
+
.math-content-wrapper pre:has(> code.dark\\:bg-blue-900\\/30) {
|
|
280
|
+
white-space: pre-wrap;
|
|
281
|
+
word-wrap: break-word;
|
|
282
|
+
overflow-wrap: anywhere;
|
|
283
|
+
font-family: inherit;
|
|
284
|
+
background: transparent;
|
|
285
|
+
padding: 0;
|
|
286
|
+
margin: 0;
|
|
287
|
+
}
|
|
288
|
+
/* Make the code inside these pre tags behave like inline code */
|
|
289
|
+
.math-content-wrapper pre:has(> code.bg-blue-100) > code,
|
|
290
|
+
.math-content-wrapper pre:has(> code.dark\\:bg-blue-900\\/30) > code {
|
|
291
|
+
white-space: normal;
|
|
292
|
+
display: inline;
|
|
293
|
+
overflow-wrap: anywhere;
|
|
294
|
+
word-break: normal;
|
|
295
|
+
}
|
|
296
|
+
`;
|
|
297
|
+
function proseFrameClass(direction) {
|
|
298
|
+
return `relative my-2 group ${getDirectionClasses(direction)} math-content-wrapper overflow-x-hidden min-w-0 break-words`;
|
|
299
|
+
}
|
|
300
|
+
function proseElementsWithNested(renderNested) {
|
|
301
|
+
if (!renderNested) return PROSE_BLOCK_ELEMENTS;
|
|
302
|
+
return {
|
|
303
|
+
...PROSE_BLOCK_ELEMENTS,
|
|
304
|
+
"matrx-nested": (props) => renderNested(String(props["data-source"] ?? ""))
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
export {
|
|
308
|
+
PROSE_BLOCK_ELEMENTS,
|
|
309
|
+
PROSE_FRAME_CSS,
|
|
310
|
+
proseElementsWithNested,
|
|
311
|
+
proseFrameClass,
|
|
312
|
+
renderProseTable
|
|
313
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MarkdownComponents as Components } from "../../markdown-core/markdown-core-types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Splits a plain string into an array mixing literal spans and
|
|
5
|
+
* MatrxVariableInline elements. Used for inline code and fenced-code paths
|
|
6
|
+
* where the remark plugin intentionally leaves `{{var}}` unexpanded.
|
|
7
|
+
*/
|
|
8
|
+
export declare function splitWithVariables(text: string): React.ReactNode[];
|
|
9
|
+
/**
|
|
10
|
+
* Inline-mark renderers shared by every level. Module scope, so the map's
|
|
11
|
+
* identity is stable across renders (react-markdown re-renders on change).
|
|
12
|
+
*/
|
|
13
|
+
export declare const PROSE_INLINE_ELEMENTS: Components;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@ai-matrx/design-system";
|
|
3
|
+
import { LinkComponent } from "../../display/blocks/links/LinkComponent.js";
|
|
4
|
+
import { useHeadingAnchors } from "../../markdown-core/heading-anchors-context.js";
|
|
5
|
+
import { isHeadingAnchorProps } from "../../markdown-core/heading-anchors-props.js";
|
|
6
|
+
import { MatrxVariableInline } from "../../display/chat-markdown/matrx-variables/MatrxVariableInline.js";
|
|
7
|
+
import { CitationMarkerInline } from "../../host/app-bindings.js";
|
|
8
|
+
import { InDocAnchor } from "../../markdown-core/syntax/elements/InDocAnchor.js";
|
|
9
|
+
import { RemoteImageGate } from "./remote-image-policy.js";
|
|
10
|
+
import {
|
|
11
|
+
isInDocHref,
|
|
12
|
+
renderMarkdownInput
|
|
13
|
+
} from "../../markdown-core/syntax/elements/core-syntax-elements.js";
|
|
14
|
+
import {
|
|
15
|
+
detectTextDirection,
|
|
16
|
+
getDirectionClasses
|
|
17
|
+
} from "./prose-prepare.js";
|
|
18
|
+
const INLINE_VARIABLE_RE = /\{\{([a-zA-Z_][a-zA-Z0-9_.]*)\}\}/g;
|
|
19
|
+
function splitWithVariables(text) {
|
|
20
|
+
INLINE_VARIABLE_RE.lastIndex = 0;
|
|
21
|
+
const nodes = [];
|
|
22
|
+
let lastIdx = 0;
|
|
23
|
+
let match;
|
|
24
|
+
let i = 0;
|
|
25
|
+
while ((match = INLINE_VARIABLE_RE.exec(text)) !== null) {
|
|
26
|
+
if (match.index > lastIdx) nodes.push(text.slice(lastIdx, match.index));
|
|
27
|
+
nodes.push(/* @__PURE__ */ jsx(MatrxVariableInline, { "data-name": match[1] }, i++));
|
|
28
|
+
lastIdx = match.index + match[0].length;
|
|
29
|
+
}
|
|
30
|
+
if (lastIdx < text.length) nodes.push(text.slice(lastIdx));
|
|
31
|
+
return nodes.length > 0 ? nodes : [text];
|
|
32
|
+
}
|
|
33
|
+
function LinkElement({ node, href, children, ...rest }) {
|
|
34
|
+
const anchorsOn = useHeadingAnchors();
|
|
35
|
+
if (!anchorsOn && isHeadingAnchorProps(rest)) return null;
|
|
36
|
+
return isInDocHref(href) ? /* @__PURE__ */ jsx(InDocAnchor, { href, ...rest, children }) : href ? /* @__PURE__ */ jsx(LinkComponent, { href, children }) : /* @__PURE__ */ jsx(Fragment, { children });
|
|
37
|
+
}
|
|
38
|
+
const PROSE_INLINE_ELEMENTS = {
|
|
39
|
+
a: LinkElement,
|
|
40
|
+
// Task checkboxes: interactive only under a save adapter
|
|
41
|
+
// (MarkdownSourceEditProvider), read-only state marks otherwise.
|
|
42
|
+
input: ({ node, ...props }) => renderMarkdownInput(props),
|
|
43
|
+
strong: ({ node, children, ...props }) => {
|
|
44
|
+
const isInHeading = false;
|
|
45
|
+
const boldText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
46
|
+
const boldDirection = detectTextDirection(boldText);
|
|
47
|
+
const boldDirClasses = getDirectionClasses(boldDirection);
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
"strong",
|
|
50
|
+
{
|
|
51
|
+
className: `${isInHeading ? "" : "font-extrabold"} ${boldDirClasses}`,
|
|
52
|
+
dir: boldDirection,
|
|
53
|
+
...props,
|
|
54
|
+
children
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
em: ({ node, children, ...props }) => {
|
|
59
|
+
const isInHeading = false;
|
|
60
|
+
const italicText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
61
|
+
const italicDirection = detectTextDirection(italicText);
|
|
62
|
+
const italicDirClasses = getDirectionClasses(italicDirection);
|
|
63
|
+
return /* @__PURE__ */ jsx(
|
|
64
|
+
"em",
|
|
65
|
+
{
|
|
66
|
+
className: `${isInHeading ? "italic" : "italic text-blue-600 dark:text-blue-400"} ${italicDirClasses}`,
|
|
67
|
+
dir: italicDirection,
|
|
68
|
+
...props,
|
|
69
|
+
children
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
code: ({ node, className, children, ...props }) => {
|
|
74
|
+
const langClass = className || "";
|
|
75
|
+
const isFenced = langClass.startsWith("language-");
|
|
76
|
+
if (isFenced) {
|
|
77
|
+
return /* @__PURE__ */ jsx("code", { className, ...props, children });
|
|
78
|
+
}
|
|
79
|
+
const rawText = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : null;
|
|
80
|
+
const codeContent = rawText && rawText.includes("{{") ? splitWithVariables(rawText) : children;
|
|
81
|
+
return /* @__PURE__ */ jsx(
|
|
82
|
+
"code",
|
|
83
|
+
{
|
|
84
|
+
"data-kind-source": "explicit",
|
|
85
|
+
className: cn(
|
|
86
|
+
"px-1.5 py-0 rounded font-mono text-sm font-medium",
|
|
87
|
+
"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
88
|
+
className
|
|
89
|
+
),
|
|
90
|
+
style: {
|
|
91
|
+
overflowWrap: "anywhere",
|
|
92
|
+
wordBreak: "normal"
|
|
93
|
+
},
|
|
94
|
+
...props,
|
|
95
|
+
children: codeContent
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
img: ({ node, ...props }) => (
|
|
100
|
+
// The core's URL sanitizer turns a refused address (javascript:,
|
|
101
|
+
// vbscript:, data:text/html…) into an empty src. An <img src=""> draws a
|
|
102
|
+
// broken image and re-requests the page, so a refused image is never
|
|
103
|
+
// drawn: it says so, with its alt text (guard:
|
|
104
|
+
// components/rich-content/__tests__/refused-image-url.test.tsx).
|
|
105
|
+
typeof props.src === "string" && props.src.trim() !== "" ? (
|
|
106
|
+
// Inline images flow rather than fill the width, so multiple images on
|
|
107
|
+
// one line sit side by side and wrap. Standalone images on their own
|
|
108
|
+
// line take the dedicated full-width ImageBlock path (the splitter
|
|
109
|
+
// only leaves an image here when it shares a line with other content).
|
|
110
|
+
// A remote image obeys the level's policy (remote-image-policy.tsx).
|
|
111
|
+
/* @__PURE__ */ jsx(RemoteImageGate, { src: props.src, alt: props.alt, children: /* @__PURE__ */ jsx(
|
|
112
|
+
"img",
|
|
113
|
+
{
|
|
114
|
+
className: "inline-block h-auto max-w-full rounded-md my-2 mr-2 object-contain align-top",
|
|
115
|
+
style: { maxHeight: 700 },
|
|
116
|
+
referrerPolicy: "no-referrer",
|
|
117
|
+
...props,
|
|
118
|
+
alt: props.alt || "Image"
|
|
119
|
+
}
|
|
120
|
+
) })
|
|
121
|
+
) : /* @__PURE__ */ jsx(
|
|
122
|
+
"span",
|
|
123
|
+
{
|
|
124
|
+
"data-rc-refused-image": "",
|
|
125
|
+
className: "rounded border border-dashed border-border px-1 text-xs text-muted-foreground",
|
|
126
|
+
children: props.alt ? `Image not shown (\u201C${props.alt}\u201D) \u2014 its address is not allowed.` : "Image not shown \u2014 its address is not allowed."
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
),
|
|
130
|
+
br: ({ node, ...props }) => /* @__PURE__ */ jsx("br", {}),
|
|
131
|
+
span: ({ node, className, children, ...props }) => {
|
|
132
|
+
return /* @__PURE__ */ jsx("span", { className, ...props, children });
|
|
133
|
+
},
|
|
134
|
+
"matrx-variable": ({ node, ...props }) => /* @__PURE__ */ jsx(MatrxVariableInline, { ...props }),
|
|
135
|
+
// Inline citation marker `<matrxcite n="…" />` (emitted into display
|
|
136
|
+
// text by message-citations.insertCitationMarkers, converted to a
|
|
137
|
+
// `matrx-cite` element by remarkMatrxCite) → numbered superscript chip.
|
|
138
|
+
"matrx-cite": ({ node, ...props }) => /* @__PURE__ */ jsx(CitationMarkerInline, { ...props })
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
PROSE_INLINE_ELEMENTS,
|
|
142
|
+
splitWithVariables
|
|
143
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Private-use sentinel for a standalone `===` line. The `p` renderer swaps a
|
|
2
|
+
* paragraph whose only child is this token for a thick blue rule. */
|
|
3
|
+
export declare const THICK_HR_SENTINEL = "\uE000THICK_HR\uE000";
|
|
4
|
+
/**
|
|
5
|
+
* Turn standalone `===` lines into their own sentinel paragraphs, leaving
|
|
6
|
+
* fenced code untouched so a sample of `===` stays `===`.
|
|
7
|
+
*
|
|
8
|
+
* A blank line is forced on both sides. The one before stops CommonMark from
|
|
9
|
+
* reading the previous line as a setext heading. The one after is required
|
|
10
|
+
* because remark-breaks turns a single newline into a `<br>` inside the same
|
|
11
|
+
* paragraph, and the rule only replaces a paragraph whose only child is the
|
|
12
|
+
* sentinel. Without that break the token is painted as text.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isolateThickHorizontalRules(source: string): string;
|
|
15
|
+
export declare const detectTextDirection: (text: string) => "rtl" | "ltr";
|
|
16
|
+
export declare const getDirectionClasses: (direction: "rtl" | "ltr") => "text-left ltr" | "text-right rtl";
|
|
17
|
+
export declare const getDirectionFontSize: (direction: "rtl" | "ltr") => "text-base" | "text-sm";
|
|
18
|
+
/**
|
|
19
|
+
* Swap every fenced code region for a one-line private-use token, and give
|
|
20
|
+
* back a function that puts the original bytes back. Null when there is no
|
|
21
|
+
* fence (the common case costs one scan). An unclosed fence (a stream still
|
|
22
|
+
* arriving) is protected to the end.
|
|
23
|
+
*/
|
|
24
|
+
export declare function protectFencedCode(source: string): {
|
|
25
|
+
text: string;
|
|
26
|
+
restore: (s: string) => string;
|
|
27
|
+
} | null;
|
|
28
|
+
/**
|
|
29
|
+
* Leading spaces become nbsp so a model's hand-indented text keeps its shape
|
|
30
|
+
* — EXCEPT where the indentation is markdown structure: a list marker line,
|
|
31
|
+
* and any indented line that continues a list item (a quote, a callout, a
|
|
32
|
+
* `:::` directive, a second paragraph under `- item`). Flattening those to
|
|
33
|
+
* nbsp printed `> [!caution]` and `:::` as literal text inside list items
|
|
34
|
+
* (verify-RC-B8 failure 1). A list context ends at the first non-indented,
|
|
35
|
+
* non-blank line that is not itself a list item.
|
|
36
|
+
*/
|
|
37
|
+
export declare function preserveIndentation(source: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Prose preparation for ONE GFM table cell (verify-RC-B4 R6-1): the inline
|
|
40
|
+
* steps only. A cell is inline content, so `* see note` stays `* see note`
|
|
41
|
+
* (the document pass rewrites a leading `* ` bullet to `- `).
|
|
42
|
+
*/
|
|
43
|
+
export declare function preprocessCellProse(rawContent: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Massage raw model prose into the markdown the core parses: escape non-HTML
|
|
46
|
+
* angle-bracket tokens, keep indentation, normalize list/bold spacing, turn
|
|
47
|
+
* `===` into the thick rule sentinel and extra blank lines into spacers.
|
|
48
|
+
* Math is NOT touched here — the core's math normalizer owns it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function preprocessProse(rawContent: string): string;
|