@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,126 @@
|
|
|
1
|
+
import { createHighlighterCore } from "shiki/core";
|
|
2
|
+
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
|
3
|
+
import { bundledLanguages, bundledLanguagesAlias } from "shiki/langs";
|
|
4
|
+
import { JSON_SYNTAX_COLORS } from "../../utils/lifted/syntax-themes.js";
|
|
5
|
+
const SHIKI_THEME = { light: "matrx-light", dark: "matrx-dark" };
|
|
6
|
+
const PLAIN_LANGUAGES = /* @__PURE__ */ new Set(["text", "plaintext", "plain", "txt", ""]);
|
|
7
|
+
const LANGUAGE_ALIASES = {
|
|
8
|
+
react: "tsx",
|
|
9
|
+
shell: "shellscript",
|
|
10
|
+
sh: "shellscript",
|
|
11
|
+
bash: "shellscript",
|
|
12
|
+
zsh: "shellscript",
|
|
13
|
+
console: "shellsession",
|
|
14
|
+
terminal: "shellsession",
|
|
15
|
+
golang: "go",
|
|
16
|
+
"c#": "csharp",
|
|
17
|
+
"c++": "cpp",
|
|
18
|
+
plaintext: "text",
|
|
19
|
+
vue: "vue",
|
|
20
|
+
jsonc: "jsonc",
|
|
21
|
+
json5: "json5"
|
|
22
|
+
};
|
|
23
|
+
function jsonScopes(palette) {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
scope: ["support.type.property-name.json"],
|
|
27
|
+
settings: { foreground: palette.key }
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
scope: ["string.quoted.double.json", "string.json"],
|
|
31
|
+
settings: { foreground: palette.string }
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
scope: ["constant.numeric.json"],
|
|
35
|
+
settings: { foreground: palette.number }
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
scope: ["constant.language.json"],
|
|
39
|
+
settings: { foreground: palette.boolean }
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
scope: [
|
|
43
|
+
"punctuation.separator.dictionary.key-value.json",
|
|
44
|
+
"punctuation.separator.dictionary.pair.json",
|
|
45
|
+
"punctuation.separator.array.json",
|
|
46
|
+
"punctuation.definition.dictionary.begin.json",
|
|
47
|
+
"punctuation.definition.dictionary.end.json",
|
|
48
|
+
"punctuation.definition.array.begin.json",
|
|
49
|
+
"punctuation.definition.array.end.json"
|
|
50
|
+
],
|
|
51
|
+
settings: { foreground: palette.punctuation }
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
async function loadTheme(base, name, palette) {
|
|
56
|
+
const theme = (await base).default;
|
|
57
|
+
return {
|
|
58
|
+
...theme,
|
|
59
|
+
name,
|
|
60
|
+
tokenColors: [
|
|
61
|
+
...theme.tokenColors ?? theme.settings ?? [],
|
|
62
|
+
...jsonScopes(palette)
|
|
63
|
+
],
|
|
64
|
+
settings: void 0
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
let highlighterPromise = null;
|
|
68
|
+
function getHighlighter() {
|
|
69
|
+
if (!highlighterPromise) {
|
|
70
|
+
highlighterPromise = createHighlighterCore({
|
|
71
|
+
engine: createJavaScriptRegexEngine({ forgiving: true }),
|
|
72
|
+
themes: [
|
|
73
|
+
loadTheme(
|
|
74
|
+
import("@shikijs/themes/light-plus"),
|
|
75
|
+
SHIKI_THEME.light,
|
|
76
|
+
JSON_SYNTAX_COLORS.light
|
|
77
|
+
),
|
|
78
|
+
loadTheme(
|
|
79
|
+
import("@shikijs/themes/dark-plus"),
|
|
80
|
+
SHIKI_THEME.dark,
|
|
81
|
+
JSON_SYNTAX_COLORS.dark
|
|
82
|
+
)
|
|
83
|
+
],
|
|
84
|
+
langs: []
|
|
85
|
+
}).catch((error) => {
|
|
86
|
+
highlighterPromise = null;
|
|
87
|
+
throw error;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return highlighterPromise;
|
|
91
|
+
}
|
|
92
|
+
function resolveShikiLanguage(raw) {
|
|
93
|
+
const lower = (raw ?? "").trim().toLowerCase();
|
|
94
|
+
if (PLAIN_LANGUAGES.has(lower)) return "text";
|
|
95
|
+
const aliased = LANGUAGE_ALIASES[lower] ?? lower;
|
|
96
|
+
if (aliased in bundledLanguages) return aliased;
|
|
97
|
+
const canonical = bundledLanguagesAlias[aliased];
|
|
98
|
+
if (canonical) return aliased;
|
|
99
|
+
return "text";
|
|
100
|
+
}
|
|
101
|
+
const loading = /* @__PURE__ */ new Map();
|
|
102
|
+
async function ensureLanguage(highlighter, language) {
|
|
103
|
+
if (language === "text") return;
|
|
104
|
+
if (highlighter.getLoadedLanguages().includes(language)) return;
|
|
105
|
+
let pending = loading.get(language);
|
|
106
|
+
if (!pending) {
|
|
107
|
+
const importer = bundledLanguages[language];
|
|
108
|
+
if (!importer) return;
|
|
109
|
+
pending = importer().then(
|
|
110
|
+
(mod) => highlighter.loadLanguage(
|
|
111
|
+
mod.default
|
|
112
|
+
)
|
|
113
|
+
).catch((error) => {
|
|
114
|
+
loading.delete(language);
|
|
115
|
+
throw error;
|
|
116
|
+
});
|
|
117
|
+
loading.set(language, pending);
|
|
118
|
+
}
|
|
119
|
+
await pending;
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
SHIKI_THEME,
|
|
123
|
+
ensureLanguage,
|
|
124
|
+
getHighlighter,
|
|
125
|
+
resolveShikiLanguage
|
|
126
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface HighlightedToken {
|
|
2
|
+
content: string;
|
|
3
|
+
light?: string;
|
|
4
|
+
dark?: string;
|
|
5
|
+
fontStyle?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface HighlightedCode {
|
|
8
|
+
/** One entry per source line; null while the grammar loads. */
|
|
9
|
+
lines: HighlightedToken[][] | null;
|
|
10
|
+
/** Theme background colors, for the block surface. */
|
|
11
|
+
background: {
|
|
12
|
+
light: string;
|
|
13
|
+
dark: string;
|
|
14
|
+
} | null;
|
|
15
|
+
/** The exact code `lines` were tokenized from (it lags `code` by a tick). */
|
|
16
|
+
source: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function useHighlightedLines(code: string, rawLanguage: string | undefined): HighlightedCode;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
function toToken(token) {
|
|
4
|
+
const style = token.htmlStyle;
|
|
5
|
+
return {
|
|
6
|
+
content: token.content,
|
|
7
|
+
light: style?.["--shiki-light"] ?? token.color,
|
|
8
|
+
dark: style?.["--shiki-dark"] ?? token.color,
|
|
9
|
+
fontStyle: token.fontStyle
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function splitLines(tokens) {
|
|
13
|
+
const lines = [[]];
|
|
14
|
+
for (const token of tokens) {
|
|
15
|
+
if (token.content === "\n") {
|
|
16
|
+
lines.push([]);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
lines[lines.length - 1].push(toToken(token));
|
|
20
|
+
}
|
|
21
|
+
return lines;
|
|
22
|
+
}
|
|
23
|
+
const SLICE_LINES = 40;
|
|
24
|
+
const SLICE_BUDGET_MS = 8;
|
|
25
|
+
function takeLines(text, count) {
|
|
26
|
+
let index = -1;
|
|
27
|
+
for (let i = 0; i < count; i += 1) {
|
|
28
|
+
index = text.indexOf("\n", index + 1);
|
|
29
|
+
if (index === -1) return text;
|
|
30
|
+
}
|
|
31
|
+
return text.slice(0, index + 1);
|
|
32
|
+
}
|
|
33
|
+
function yieldToMain() {
|
|
34
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
35
|
+
}
|
|
36
|
+
const CACHE_LIMIT = 64;
|
|
37
|
+
const cache = /* @__PURE__ */ new Map();
|
|
38
|
+
function cacheKey(language, code) {
|
|
39
|
+
return `${language}\0${code}`;
|
|
40
|
+
}
|
|
41
|
+
function readCache(language, code) {
|
|
42
|
+
const key = cacheKey(language, code);
|
|
43
|
+
const hit = cache.get(key);
|
|
44
|
+
if (!hit) return null;
|
|
45
|
+
cache.delete(key);
|
|
46
|
+
cache.set(key, hit);
|
|
47
|
+
return hit;
|
|
48
|
+
}
|
|
49
|
+
function writeCache(language, code, lines) {
|
|
50
|
+
cache.set(cacheKey(language, code), lines);
|
|
51
|
+
while (cache.size > CACHE_LIMIT) {
|
|
52
|
+
const oldest = cache.keys().next().value;
|
|
53
|
+
if (oldest === void 0) break;
|
|
54
|
+
cache.delete(oldest);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function useHighlightedLines(code, rawLanguage) {
|
|
58
|
+
const [result, setResult] = useState({
|
|
59
|
+
lines: null,
|
|
60
|
+
background: null,
|
|
61
|
+
source: ""
|
|
62
|
+
});
|
|
63
|
+
const slot = useRef(null);
|
|
64
|
+
const generation = useRef(0);
|
|
65
|
+
const queue = useRef(Promise.resolve());
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const run = ++generation.current;
|
|
68
|
+
const task = async () => {
|
|
69
|
+
const [
|
|
70
|
+
{ getHighlighter, ensureLanguage, resolveShikiLanguage, SHIKI_THEME },
|
|
71
|
+
{ ShikiStreamTokenizer }
|
|
72
|
+
] = await Promise.all([
|
|
73
|
+
import("./shiki-highlighter.js"),
|
|
74
|
+
import("@shikijs/stream")
|
|
75
|
+
]);
|
|
76
|
+
if (run !== generation.current) return;
|
|
77
|
+
const highlighter = await getHighlighter();
|
|
78
|
+
const language = resolveShikiLanguage(rawLanguage);
|
|
79
|
+
await ensureLanguage(highlighter, language);
|
|
80
|
+
let current = slot.current;
|
|
81
|
+
const isAppend = current !== null && current.language === language && code.startsWith(current.consumed);
|
|
82
|
+
if (!current || !isAppend) {
|
|
83
|
+
current = {
|
|
84
|
+
tokenizer: new ShikiStreamTokenizer({
|
|
85
|
+
highlighter,
|
|
86
|
+
lang: language,
|
|
87
|
+
themes: { light: SHIKI_THEME.light, dark: SHIKI_THEME.dark },
|
|
88
|
+
defaultColor: false
|
|
89
|
+
}),
|
|
90
|
+
language,
|
|
91
|
+
consumed: ""
|
|
92
|
+
};
|
|
93
|
+
slot.current = current;
|
|
94
|
+
}
|
|
95
|
+
const background = {
|
|
96
|
+
light: highlighter.getTheme(SHIKI_THEME.light).bg,
|
|
97
|
+
dark: highlighter.getTheme(SHIKI_THEME.dark).bg
|
|
98
|
+
};
|
|
99
|
+
const cached = readCache(language, code);
|
|
100
|
+
if (cached && current.consumed === "") {
|
|
101
|
+
setResult({ lines: cached, background, source: code });
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const tokenizer = current.tokenizer;
|
|
105
|
+
const publish = (source) => setResult({
|
|
106
|
+
lines: splitLines([...tokenizer.tokensStable, ...tokenizer.tokensUnstable]),
|
|
107
|
+
background,
|
|
108
|
+
source
|
|
109
|
+
});
|
|
110
|
+
let delta = code.slice(current.consumed.length);
|
|
111
|
+
let sliceStart = performance.now();
|
|
112
|
+
while (delta) {
|
|
113
|
+
const piece = takeLines(delta, SLICE_LINES);
|
|
114
|
+
await tokenizer.enqueue(piece);
|
|
115
|
+
current.consumed += piece;
|
|
116
|
+
delta = delta.slice(piece.length);
|
|
117
|
+
if (delta && performance.now() - sliceStart > SLICE_BUDGET_MS) {
|
|
118
|
+
if (run === generation.current) publish(current.consumed);
|
|
119
|
+
await yieldToMain();
|
|
120
|
+
if (run !== generation.current) return;
|
|
121
|
+
sliceStart = performance.now();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (run !== generation.current) return;
|
|
125
|
+
publish(code);
|
|
126
|
+
writeCache(language, code, splitLines([
|
|
127
|
+
...tokenizer.tokensStable,
|
|
128
|
+
...tokenizer.tokensUnstable
|
|
129
|
+
]));
|
|
130
|
+
};
|
|
131
|
+
queue.current = queue.current.then(task).catch((error) => {
|
|
132
|
+
console.warn(
|
|
133
|
+
`[CodeBlock] syntax highlighting unavailable for "${rawLanguage ?? "text"}" \u2014 showing plain text.`,
|
|
134
|
+
error
|
|
135
|
+
);
|
|
136
|
+
});
|
|
137
|
+
}, [code, rawLanguage]);
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
useHighlightedLines
|
|
142
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const STICKY_CHROME_SELECTOR = "[data-sticky-chrome]";
|
|
2
|
+
function stickyRestInset(args) {
|
|
3
|
+
const header = Math.max(0, Math.round(args.headerBottom - args.restTop));
|
|
4
|
+
const chrome = args.chromeHeights.reduce((sum, h) => sum + Math.max(0, h), 0);
|
|
5
|
+
return header + Math.round(chrome);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
STICKY_CHROME_SELECTOR,
|
|
9
|
+
stickyRestInset
|
|
10
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a chat host tells the block renderer about the conversation it renders in — and what an
|
|
3
|
+
* interactive block (a decision, a questionnaire) records back. Owned here because the engine
|
|
4
|
+
* reads it; the chat package supplies it (`configureRichContent({ app: { useHideReasoning, … } })`
|
|
5
|
+
* today, a provider once chat depends on this package).
|
|
6
|
+
*/
|
|
7
|
+
/** How an answer edit is remarked (ported from @ai-matrx/chat instance-resources/remarks). */
|
|
8
|
+
export interface AnswerEditRemarkMeta {
|
|
9
|
+
origin: "choice" | "kind";
|
|
10
|
+
/** "I chose SQLite." — replaces the raw diff when it is the only change. */
|
|
11
|
+
projection?: string | null;
|
|
12
|
+
/** The decision's prompt (or the shape's title). */
|
|
13
|
+
quote?: string | null;
|
|
14
|
+
}
|
|
15
|
+
/** The status line an expert's in-progress turn shows (the chat package's label). */
|
|
16
|
+
export declare const EXPERT_WORKING_LABEL = "Working\u2026";
|
|
17
|
+
/**
|
|
18
|
+
* A host's renderer for a JSON code block that is an agent's structured answer (matrx-frontend:
|
|
19
|
+
* `StructuredAgentAnswerBlock` against the bound agent's output schema). Returns null when the
|
|
20
|
+
* block is not one; a bare host has none (the JSON shows as a code block).
|
|
21
|
+
*/
|
|
22
|
+
import type { ReactNode } from "react";
|
|
23
|
+
type JsonAnswerRenderer = (ctx: {
|
|
24
|
+
block: {
|
|
25
|
+
content: string;
|
|
26
|
+
};
|
|
27
|
+
outputSchema?: unknown;
|
|
28
|
+
renderBasicMarkdown: (s: string) => ReactNode;
|
|
29
|
+
index: number;
|
|
30
|
+
}) => ReactNode | null;
|
|
31
|
+
export declare function registerJsonAnswerRenderer(renderer: JsonAnswerRenderer | null): void;
|
|
32
|
+
export declare function jsonAnswerRenderer(): JsonAnswerRenderer | null;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const EXPERT_WORKING_LABEL = "Working\u2026";
|
|
2
|
+
const ANSWER_KEY = /* @__PURE__ */ Symbol.for("ai-matrx.rich-content.json-answer-renderer");
|
|
3
|
+
function registerJsonAnswerRenderer(renderer) {
|
|
4
|
+
globalThis[ANSWER_KEY] = renderer;
|
|
5
|
+
}
|
|
6
|
+
function jsonAnswerRenderer() {
|
|
7
|
+
return globalThis[ANSWER_KEY] ?? null;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
EXPERT_WORKING_LABEL,
|
|
11
|
+
jsonAnswerRenderer,
|
|
12
|
+
registerJsonAnswerRenderer
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface ChatCollapsibleWrapperProps {
|
|
3
|
+
icon: ReactNode;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
controls?: ReactNode;
|
|
6
|
+
initialOpen?: boolean;
|
|
7
|
+
onStateChange?: (state: boolean) => void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
maxWidth?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const ChatCollapsibleWrapper: React.FC<ChatCollapsibleWrapperProps>;
|
|
13
|
+
export default ChatCollapsibleWrapper;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@ai-matrx/design-system";
|
|
5
|
+
import { ChevronDown } from "lucide-react";
|
|
6
|
+
import { ControlRow } from "@ai-matrx/design-system/controls";
|
|
7
|
+
const ChatCollapsibleWrapper = ({
|
|
8
|
+
icon,
|
|
9
|
+
title,
|
|
10
|
+
controls,
|
|
11
|
+
initialOpen = true,
|
|
12
|
+
onStateChange,
|
|
13
|
+
children,
|
|
14
|
+
className = "",
|
|
15
|
+
maxWidth = "max-w-5xl"
|
|
16
|
+
}) => {
|
|
17
|
+
const [isOpen, setIsOpen] = useState(initialOpen);
|
|
18
|
+
const handleOpenChange = (open) => {
|
|
19
|
+
setIsOpen(open);
|
|
20
|
+
if (onStateChange) {
|
|
21
|
+
onStateChange(open);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
Collapsible,
|
|
26
|
+
{
|
|
27
|
+
open: isOpen,
|
|
28
|
+
onOpenChange: handleOpenChange,
|
|
29
|
+
className: `border-2 border-zinc-200 dark:border-zinc-700 rounded-3xl shadow-sm my-1 w-full ${maxWidth} mx-auto hover:bg-accent/50 hover:shadow-sm ${className}`,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex w-full items-center justify-between rounded-t-lg hover:bg-accent/50 hover:shadow-sm", children: [
|
|
32
|
+
/* @__PURE__ */ jsxs(CollapsibleTrigger, { className: "flex-1 flex items-center gap-2 py-1 pl-4 pr-1 font-medium hover:bg-accent/50 hover:shadow-sm", children: [
|
|
33
|
+
icon,
|
|
34
|
+
typeof title === "string" ? /* @__PURE__ */ jsx("span", { children: title }) : title,
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
ChevronDown,
|
|
37
|
+
{
|
|
38
|
+
className: `h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 ml-auto ${isOpen ? "rotate-180" : ""}`
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] }),
|
|
42
|
+
controls && // One ControlRow: every action carries its own 3px half-gap, the row adds none.
|
|
43
|
+
/* @__PURE__ */ jsx(ControlRow, { nowrap: true, className: "shrink-0 pr-3", onClick: (e) => e.stopPropagation(), children: controls })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { className: "bg-transparent dark:bg-transparent border-none", children: /* @__PURE__ */ jsxs("div", { className: "relative p-0 border-none", children: [
|
|
46
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-0 left-8 right-8 h-px bg-zinc-200 dark:bg-zinc-700" }),
|
|
47
|
+
children
|
|
48
|
+
] }) })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
var ChatCollapsibleWrapper_default = ChatCollapsibleWrapper;
|
|
54
|
+
export {
|
|
55
|
+
ChatCollapsibleWrapper_default as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* components/mardown-display/blocks/buildMediaSource.ts
|
|
3
|
+
*
|
|
4
|
+
* Shared URL-resolution for the chat media output-block renderers
|
|
5
|
+
* (`AudioOutputBlockRenderer`, `VideoOutputBlockRenderer`). Turns the raw
|
|
6
|
+
* `serverData` of an `audio_output` / `video_output` / `media_block` render
|
|
7
|
+
* block into the strongest `FileSource` we can, so the universal file handler
|
|
8
|
+
* (`useFileSrc`) resolves a DURABLE, playable URL — preferring the public/CDN
|
|
9
|
+
* URL and resolving from `file_id` — instead of echoing a raw legacy URL.
|
|
10
|
+
*
|
|
11
|
+
* Why this exists: the old renderers passed the raw `data.url` straight to the
|
|
12
|
+
* player. During streaming Python sends only a `file_id` (no minted URL) so it
|
|
13
|
+
* didn't play; when a URL was present it was a raw signed S3 link that leaked
|
|
14
|
+
* through "Copy link". Routing through the handler fixes both. See
|
|
15
|
+
* `AudioOutputBlockRenderer.tsx` and FOUND_DEFECTS.md → "Media durability".
|
|
16
|
+
*/
|
|
17
|
+
import type { FileSource } from "@ai-matrx/media/files/engine/handler/types";
|
|
18
|
+
export declare function pickStr(v: unknown): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Build the strongest `FileSource` from a media block's `serverData`.
|
|
21
|
+
* A permanent Matrx CDN URL wins because public media needs no authenticated
|
|
22
|
+
* hop. Otherwise identity (`file_id`) beats opaque URLs so the handler can
|
|
23
|
+
* resolve the durable authenticated lane. Expiring URLs are never rendered.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildMediaSource(sd: Record<string, unknown>, mime?: string): FileSource | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fileIdFromUserFilesUrl,
|
|
3
|
+
isDurableMediaUrl
|
|
4
|
+
} from "../../utils/lifted/durability.js";
|
|
5
|
+
import { isUuidShape } from "@ai-matrx/kit/uuid";
|
|
6
|
+
function pickStr(v) {
|
|
7
|
+
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
8
|
+
}
|
|
9
|
+
function buildMediaSource(sd, mime) {
|
|
10
|
+
const urlish = [
|
|
11
|
+
pickStr(sd.cdnUrl) ?? pickStr(sd.cdn_url),
|
|
12
|
+
pickStr(sd.downloadUrl) ?? pickStr(sd.download_url),
|
|
13
|
+
pickStr(sd.url) ?? pickStr(sd.file_url),
|
|
14
|
+
pickStr(sd.externalUrl) ?? pickStr(sd.external_url)
|
|
15
|
+
].filter((u) => !!u);
|
|
16
|
+
const publicCdn = urlish.find(isPermanentMatrxCdnUrl);
|
|
17
|
+
if (publicCdn) {
|
|
18
|
+
return { kind: "public_cdn", url: publicCdn, mime };
|
|
19
|
+
}
|
|
20
|
+
const directId = pickStr(sd.fileId) ?? pickStr(sd.file_id);
|
|
21
|
+
if (directId && isUuidShape(directId)) {
|
|
22
|
+
return { kind: "file_id", fileId: directId, mime };
|
|
23
|
+
}
|
|
24
|
+
for (const cand of urlish) {
|
|
25
|
+
const id = fileIdFromUserFilesUrl(cand);
|
|
26
|
+
if (id) return { kind: "file_id", fileId: id, mime };
|
|
27
|
+
}
|
|
28
|
+
const durable = urlish.find((u) => isDurableMediaUrl(u));
|
|
29
|
+
if (durable) return { kind: "external_url", url: durable, mime };
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function isPermanentMatrxCdnUrl(url) {
|
|
33
|
+
if (!isDurableMediaUrl(url)) return false;
|
|
34
|
+
try {
|
|
35
|
+
return /(^|\.)cdn\.matrxserver\.com$/i.test(new URL(url).hostname);
|
|
36
|
+
} catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
buildMediaSource,
|
|
42
|
+
pickStr
|
|
43
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How each render block adapts to the canvas pane it is shown in.
|
|
3
|
+
*
|
|
4
|
+
* Every function takes the live `CanvasPresentation` from
|
|
5
|
+
* `useCanvasPresentation()` — `null` outside the canvas — and answers `null`
|
|
6
|
+
* (or the block's existing behaviour) when there is none, so a block rendered
|
|
7
|
+
* in chat, a note or a window is unchanged. Inside the canvas the pane's shape
|
|
8
|
+
* decides (`preferredFlowDirection` from `@ai-matrx/canvas`): tall narrow panes
|
|
9
|
+
* stack and flow top to bottom, wide panes sit side by side. A person's own
|
|
10
|
+
* explicit choice (a toggle they pressed, a direction an author wrote) is
|
|
11
|
+
* always passed in and always wins.
|
|
12
|
+
*
|
|
13
|
+
* Pure functions, so each rule is tested without a browser
|
|
14
|
+
* (`__tests__/canvas-adaptive.test.ts`).
|
|
15
|
+
*/
|
|
16
|
+
import { type CanvasPresentation } from "@ai-matrx/canvas";
|
|
17
|
+
export type CanvasFlow = "vertical" | "horizontal";
|
|
18
|
+
/** Wide enough for two readable columns side by side. */
|
|
19
|
+
export declare const CANVAS_TWO_COLUMN_WIDTH = 640;
|
|
20
|
+
export declare function canvasFlow(p: CanvasPresentation | null): CanvasFlow | null;
|
|
21
|
+
export interface FitBounds {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}
|
|
27
|
+
export interface FitViewport {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
zoom: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The smallest zoom a diagram is ever fitted to in a portrait canvas pane:
|
|
34
|
+
* node titles (14px semibold) stay at or above ~10px on screen. Below this a
|
|
35
|
+
* wide fan-out graph fitted to a 360px pane read at zoom 0.2–0.3 — every
|
|
36
|
+
* label a smear. Tuned live on "How photosynthesis works" and "Ava Science
|
|
37
|
+
* Book" (2026-10-02).
|
|
38
|
+
*/
|
|
39
|
+
export declare const DIAGRAM_READABLE_ZOOM = 0.72;
|
|
40
|
+
/**
|
|
41
|
+
* A diagram in a portrait canvas pane fits the pane's WIDTH and starts at the
|
|
42
|
+
* top; the rest is reached by scrolling down. Shrinking the whole graph to fit
|
|
43
|
+
* a tall narrow pane makes every label unreadable, and the phone rule (fill
|
|
44
|
+
* the height) forces sideways panning.
|
|
45
|
+
*
|
|
46
|
+
* The width fit never goes below `readableZoom`. When the graph is wider than
|
|
47
|
+
* the pane at that zoom it starts at its ROOT — the top-left of the layout's
|
|
48
|
+
* first rank (`firstRank`, the topmost nodes) — and the rest is reached by
|
|
49
|
+
* scrolling down and panning across.
|
|
50
|
+
*
|
|
51
|
+
* Returns `null` when the graph already fits whole at a readable zoom (the
|
|
52
|
+
* contained fit is used) or the pane is not portrait.
|
|
53
|
+
*/
|
|
54
|
+
export declare function portraitWidthFitViewport(input: {
|
|
55
|
+
presentation: CanvasPresentation | null;
|
|
56
|
+
bounds: FitBounds;
|
|
57
|
+
/** Bounds of the layout's first rank; defaults to the graph's top-left. */
|
|
58
|
+
firstRank?: FitBounds | null;
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
minZoom: number;
|
|
62
|
+
maxZoom: number;
|
|
63
|
+
padding: number;
|
|
64
|
+
containedZoom: number;
|
|
65
|
+
readableZoom?: number;
|
|
66
|
+
}): FitViewport | null;
|
|
67
|
+
/**
|
|
68
|
+
* The layout's first rank: the nodes whose top edge is the graph's topmost
|
|
69
|
+
* (within `tolerance` px). In a top-to-bottom layout that is the root row.
|
|
70
|
+
*/
|
|
71
|
+
export declare function firstRankBounds(nodes: readonly FitBounds[], tolerance?: number): FitBounds | null;
|
|
72
|
+
/** Wheel and trackpad scroll the diagram down a portrait pane instead of zooming it. */
|
|
73
|
+
export declare function diagramScrollPans(p: CanvasPresentation | null): boolean;
|
|
74
|
+
/** A timeline runs left to right across a wide pane; everywhere else top to bottom. */
|
|
75
|
+
export declare function timelineAxis(p: CanvasPresentation | null): "vertical" | "horizontal";
|
|
76
|
+
/** A text tree in a portrait pane wraps long lines downward instead of scrolling sideways. */
|
|
77
|
+
export declare function treeWrapsLines(p: CanvasPresentation | null): boolean;
|
|
78
|
+
/** A decision tree's Yes and No branches sit side by side in a wide pane; stacked otherwise. */
|
|
79
|
+
export declare function decisionBranchesSideBySide(p: CanvasPresentation | null): boolean;
|
|
80
|
+
export interface ChartPaneLayout {
|
|
81
|
+
/** Height of the plot area in px. */
|
|
82
|
+
height: number;
|
|
83
|
+
legend: "bottom" | "right";
|
|
84
|
+
/** Bars grow sideways (categories down the left) in a portrait pane. */
|
|
85
|
+
horizontalBars: boolean;
|
|
86
|
+
}
|
|
87
|
+
export declare function chartPaneLayout(p: CanvasPresentation | null, chartType: string): ChartPaneLayout | null;
|
|
88
|
+
export type SlideThumbnailPlacement = "below" | "side";
|
|
89
|
+
/** In the canvas the slide scales to fit; thumbnails sit below a portrait pane, beside a wide one. */
|
|
90
|
+
export declare function slideThumbnailPlacement(p: CanvasPresentation | null): SlideThumbnailPlacement | null;
|
|
91
|
+
/** The scale that fits a fixed-size slide stage inside a box, keeping its aspect ratio. */
|
|
92
|
+
export declare function fitScale(stage: {
|
|
93
|
+
width: number;
|
|
94
|
+
height: number;
|
|
95
|
+
}, box: {
|
|
96
|
+
width: number;
|
|
97
|
+
height: number;
|
|
98
|
+
}): number;
|
|
99
|
+
/**
|
|
100
|
+
* Side by side when the pane is wide, one column when it is narrow. A person's
|
|
101
|
+
* toggle always wins; so does an author who wrote `split` explicitly. Outside
|
|
102
|
+
* the canvas the authored default (split) is unchanged.
|
|
103
|
+
*/
|
|
104
|
+
export declare function diffIsSplit(input: {
|
|
105
|
+
presentation: CanvasPresentation | null;
|
|
106
|
+
personChoice: boolean | null;
|
|
107
|
+
authored: boolean;
|
|
108
|
+
authoredExplicitly: boolean;
|
|
109
|
+
}): boolean;
|
|
110
|
+
/** The list of places beside a map: always shown in a wide pane, behind a toggle when narrow. */
|
|
111
|
+
export declare function mapPlacesList(p: CanvasPresentation | null): "side" | "toggle" | null;
|
|
112
|
+
/**
|
|
113
|
+
* The source to DRAW for a flowchart that declares no direction: TB in a
|
|
114
|
+
* portrait pane, LR in a wide one. An author's explicit direction is never
|
|
115
|
+
* touched, nothing outside the canvas changes, and the stored source is never
|
|
116
|
+
* rewritten — this only shapes what is drawn.
|
|
117
|
+
*/
|
|
118
|
+
export declare function mermaidSourceForFlow(source: string, flow: CanvasFlow | null): string;
|