@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,472 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import {
|
|
5
|
+
Copy,
|
|
6
|
+
Check,
|
|
7
|
+
Download,
|
|
8
|
+
Expand,
|
|
9
|
+
Eye,
|
|
10
|
+
Minimize,
|
|
11
|
+
Edit2,
|
|
12
|
+
ChevronDown,
|
|
13
|
+
ChevronUp,
|
|
14
|
+
Loader2,
|
|
15
|
+
RotateCcw,
|
|
16
|
+
WrapText,
|
|
17
|
+
Maximize2,
|
|
18
|
+
ListOrdered,
|
|
19
|
+
Zap,
|
|
20
|
+
Paintbrush,
|
|
21
|
+
Code2,
|
|
22
|
+
Brain,
|
|
23
|
+
FileCode,
|
|
24
|
+
SquareArrowOutUpRight,
|
|
25
|
+
MoreHorizontal,
|
|
26
|
+
Globe
|
|
27
|
+
} from "lucide-react";
|
|
28
|
+
import { cn } from "@ai-matrx/design-system";
|
|
29
|
+
import LanguageDisplay from "./LanguageDisplay.js";
|
|
30
|
+
import IconButton from "../utils/lifted/IconButton.js";
|
|
31
|
+
import { extensionForLanguage } from "../utils/lifted/languageOptions.js";
|
|
32
|
+
import { useOpenOverlay, useSaveAndOpenInCodeEditor } from "../host/app-bindings.js";
|
|
33
|
+
const CHAT_CAPTURES_FOLDER_NAME = "Chat Captures";
|
|
34
|
+
import {
|
|
35
|
+
DYNAMIC_CONTEXT_CODE_EDITOR_AGENT,
|
|
36
|
+
GENERIC_CODE_EDITOR_AGENT,
|
|
37
|
+
PROMPT_APP_UI_EDITOR_AGENT,
|
|
38
|
+
agentForPromptKey
|
|
39
|
+
} from "../utils/lifted/code-editor-agents.js";
|
|
40
|
+
import { AdvancedMenu } from "../host/app-bindings.js";
|
|
41
|
+
import { useAdvancedMenu } from "../host/app-bindings.js";
|
|
42
|
+
const CodeBlockHeader = ({
|
|
43
|
+
language,
|
|
44
|
+
title,
|
|
45
|
+
linesCount,
|
|
46
|
+
isEditing,
|
|
47
|
+
isFullScreen,
|
|
48
|
+
isCollapsed,
|
|
49
|
+
code,
|
|
50
|
+
handleCopy,
|
|
51
|
+
handleDownload,
|
|
52
|
+
toggleEdit,
|
|
53
|
+
toggleFullScreen,
|
|
54
|
+
toggleCollapse,
|
|
55
|
+
toggleWrapLines,
|
|
56
|
+
isCopied,
|
|
57
|
+
isMobile,
|
|
58
|
+
isCompleteHTML = false,
|
|
59
|
+
handleViewHTML,
|
|
60
|
+
isCreatingPage = false,
|
|
61
|
+
showWrapLines = true,
|
|
62
|
+
handleFormat,
|
|
63
|
+
handleReset,
|
|
64
|
+
minimapEnabled = false,
|
|
65
|
+
toggleMinimap,
|
|
66
|
+
onAIEdit,
|
|
67
|
+
hideLanguageDisplay = false,
|
|
68
|
+
allowEdit = true,
|
|
69
|
+
customBuiltinKeys = [],
|
|
70
|
+
headerLeftSlot,
|
|
71
|
+
extraMenuItems
|
|
72
|
+
}) => {
|
|
73
|
+
const canCollapse = linesCount > 5;
|
|
74
|
+
return /* @__PURE__ */ jsxs(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
className: cn(
|
|
78
|
+
"flex min-w-0 items-center justify-between gap-2",
|
|
79
|
+
isMobile ? "pl-3" : "pl-5",
|
|
80
|
+
"py-0 rounded-t-xl",
|
|
81
|
+
"bg-zinc-300 dark:bg-zinc-700",
|
|
82
|
+
"text-xs text-gray-700 dark:text-gray-300",
|
|
83
|
+
"transition-all duration-200",
|
|
84
|
+
!isEditing && canCollapse && "cursor-pointer hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors"
|
|
85
|
+
),
|
|
86
|
+
onClick: isEditing || !canCollapse ? void 0 : toggleCollapse,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center space-x-4 overflow-hidden", children: [
|
|
89
|
+
!language && /* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("div", { className: "w-3 h-3 rounded-full bg-red-500" }),
|
|
91
|
+
/* @__PURE__ */ jsx("div", { className: "w-3 h-3 rounded-full bg-yellow-500" }),
|
|
92
|
+
/* @__PURE__ */ jsx("div", { className: "w-3 h-3 rounded-full bg-green-500" })
|
|
93
|
+
] }),
|
|
94
|
+
!hideLanguageDisplay && /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
95
|
+
/* @__PURE__ */ jsx(LanguageDisplay, { language, isMobile }),
|
|
96
|
+
title && /* @__PURE__ */ jsx(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
className: "max-w-[40ch] truncate font-mono text-xs text-neutral-800 dark:text-neutral-100",
|
|
100
|
+
title,
|
|
101
|
+
children: title
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
!isMobile && /* @__PURE__ */ jsxs("span", { className: "text-xs text-neutral-600 dark:text-neutral-400", children: [
|
|
105
|
+
linesCount,
|
|
106
|
+
" ",
|
|
107
|
+
linesCount === 1 ? "line" : "lines"
|
|
108
|
+
] })
|
|
109
|
+
] }),
|
|
110
|
+
headerLeftSlot && /* @__PURE__ */ jsx(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
onClick: (e) => e.stopPropagation(),
|
|
114
|
+
className: "flex items-center",
|
|
115
|
+
children: headerLeftSlot
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
CodeBlockButtons,
|
|
121
|
+
{
|
|
122
|
+
code,
|
|
123
|
+
language,
|
|
124
|
+
isEditing,
|
|
125
|
+
isFullScreen,
|
|
126
|
+
isCopied,
|
|
127
|
+
canCollapse,
|
|
128
|
+
isCollapsed,
|
|
129
|
+
handleCopy,
|
|
130
|
+
handleDownload,
|
|
131
|
+
toggleEdit,
|
|
132
|
+
toggleFullScreen,
|
|
133
|
+
toggleWrapLines,
|
|
134
|
+
toggleCollapse,
|
|
135
|
+
isMobile,
|
|
136
|
+
showWrapLines,
|
|
137
|
+
handleFormat,
|
|
138
|
+
handleReset,
|
|
139
|
+
minimapEnabled,
|
|
140
|
+
toggleMinimap,
|
|
141
|
+
onAIEdit,
|
|
142
|
+
allowEdit,
|
|
143
|
+
customBuiltinKeys,
|
|
144
|
+
isCompleteHTML,
|
|
145
|
+
handleViewHTML,
|
|
146
|
+
isCreatingPage,
|
|
147
|
+
extraMenuItems
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
const AI_EDIT_ICONS = {
|
|
155
|
+
[GENERIC_CODE_EDITOR_AGENT.mandateKey]: Code2,
|
|
156
|
+
[DYNAMIC_CONTEXT_CODE_EDITOR_AGENT.mandateKey]: Brain,
|
|
157
|
+
[PROMPT_APP_UI_EDITOR_AGENT.mandateKey]: Paintbrush
|
|
158
|
+
};
|
|
159
|
+
const noopEvent = () => ({ stopPropagation() {
|
|
160
|
+
} });
|
|
161
|
+
const CodeBlockButtons = ({
|
|
162
|
+
code,
|
|
163
|
+
language,
|
|
164
|
+
isEditing,
|
|
165
|
+
isFullScreen,
|
|
166
|
+
isCopied,
|
|
167
|
+
canCollapse,
|
|
168
|
+
isCollapsed,
|
|
169
|
+
handleCopy,
|
|
170
|
+
handleDownload,
|
|
171
|
+
toggleWrapLines,
|
|
172
|
+
toggleEdit,
|
|
173
|
+
toggleFullScreen,
|
|
174
|
+
toggleCollapse,
|
|
175
|
+
isMobile,
|
|
176
|
+
showWrapLines = true,
|
|
177
|
+
handleFormat,
|
|
178
|
+
handleReset,
|
|
179
|
+
minimapEnabled = false,
|
|
180
|
+
toggleMinimap,
|
|
181
|
+
onAIEdit,
|
|
182
|
+
allowEdit = true,
|
|
183
|
+
customBuiltinKeys = [],
|
|
184
|
+
isCompleteHTML = false,
|
|
185
|
+
handleViewHTML,
|
|
186
|
+
isCreatingPage = false,
|
|
187
|
+
extraMenuItems
|
|
188
|
+
}) => {
|
|
189
|
+
const menu = useAdvancedMenu();
|
|
190
|
+
const kebabRef = useRef(null);
|
|
191
|
+
const [isOpeningInEditor, setIsOpeningInEditor] = useState(false);
|
|
192
|
+
const openOverlay = useOpenOverlay();
|
|
193
|
+
const saveAndOpenInCodeEditor = useSaveAndOpenInCodeEditor();
|
|
194
|
+
const handleSaveToCode = () => {
|
|
195
|
+
if (!code?.trim()) return;
|
|
196
|
+
openOverlay(
|
|
197
|
+
{
|
|
198
|
+
overlayId: "saveToCode",
|
|
199
|
+
data: {
|
|
200
|
+
initialContent: code,
|
|
201
|
+
initialLanguage: language ?? "plaintext",
|
|
202
|
+
suggestedName: void 0,
|
|
203
|
+
defaultFolderId: null
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
};
|
|
208
|
+
const handleOpenInEditor = async () => {
|
|
209
|
+
if (!code?.trim() || isOpeningInEditor) return;
|
|
210
|
+
setIsOpeningInEditor(true);
|
|
211
|
+
try {
|
|
212
|
+
const ext = extensionForLanguage(language);
|
|
213
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
214
|
+
const name = `snippet-${stamp}.${ext}`;
|
|
215
|
+
await saveAndOpenInCodeEditor({
|
|
216
|
+
name,
|
|
217
|
+
language,
|
|
218
|
+
content: code,
|
|
219
|
+
folderName: CHAT_CAPTURES_FOLDER_NAME,
|
|
220
|
+
tags: ["chat-capture"],
|
|
221
|
+
metadata: {
|
|
222
|
+
source: "chat-code-block",
|
|
223
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
} catch (err) {
|
|
227
|
+
console.error("[CodeBlockHeader] open-in-editor failed", err);
|
|
228
|
+
} finally {
|
|
229
|
+
setIsOpeningInEditor(false);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const aiEditJobs = [];
|
|
233
|
+
for (const cfg of [
|
|
234
|
+
GENERIC_CODE_EDITOR_AGENT,
|
|
235
|
+
DYNAMIC_CONTEXT_CODE_EDITOR_AGENT,
|
|
236
|
+
...customBuiltinKeys.map((key) => agentForPromptKey(key))
|
|
237
|
+
]) {
|
|
238
|
+
if (!aiEditJobs.some((j) => j.mandateKey === cfg.mandateKey))
|
|
239
|
+
aiEditJobs.push(cfg);
|
|
240
|
+
}
|
|
241
|
+
const menuItems = [];
|
|
242
|
+
if (isMobile && toggleFullScreen) {
|
|
243
|
+
menuItems.push({
|
|
244
|
+
key: "fullscreen",
|
|
245
|
+
icon: isFullScreen ? Minimize : Expand,
|
|
246
|
+
label: isFullScreen ? "Exit fullscreen" : "Fullscreen",
|
|
247
|
+
category: "View",
|
|
248
|
+
showToast: false,
|
|
249
|
+
action: () => toggleFullScreen(noopEvent())
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (isMobile && toggleCollapse && canCollapse && !isEditing) {
|
|
253
|
+
menuItems.push({
|
|
254
|
+
key: "collapse",
|
|
255
|
+
icon: isCollapsed ? ChevronDown : ChevronUp,
|
|
256
|
+
label: isCollapsed ? "Expand code" : "Collapse code",
|
|
257
|
+
category: "View",
|
|
258
|
+
showToast: false,
|
|
259
|
+
action: () => toggleCollapse(noopEvent())
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
if (toggleWrapLines) {
|
|
263
|
+
menuItems.push({
|
|
264
|
+
key: "wrap",
|
|
265
|
+
icon: WrapText,
|
|
266
|
+
iconColor: showWrapLines ? "text-blue-600 dark:text-blue-400" : void 0,
|
|
267
|
+
label: showWrapLines ? "Disable word wrap" : "Enable word wrap",
|
|
268
|
+
category: "View",
|
|
269
|
+
showToast: false,
|
|
270
|
+
action: () => toggleWrapLines(noopEvent())
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
if (toggleMinimap) {
|
|
274
|
+
menuItems.push({
|
|
275
|
+
key: "minimap",
|
|
276
|
+
icon: Maximize2,
|
|
277
|
+
iconColor: isEditing && minimapEnabled ? "text-blue-600 dark:text-blue-400" : void 0,
|
|
278
|
+
label: minimapEnabled ? "Hide minimap" : "Show minimap",
|
|
279
|
+
// Edit-mode only: absent outside it, never a greyed dead row (RC-B9 F7).
|
|
280
|
+
hidden: !isEditing,
|
|
281
|
+
category: "View",
|
|
282
|
+
showToast: false,
|
|
283
|
+
action: () => toggleMinimap(noopEvent())
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
if (handleFormat) {
|
|
287
|
+
menuItems.push({
|
|
288
|
+
key: "format",
|
|
289
|
+
icon: Zap,
|
|
290
|
+
label: "Format code",
|
|
291
|
+
description: "Shift+Alt+F",
|
|
292
|
+
hidden: !isEditing,
|
|
293
|
+
category: "Edit",
|
|
294
|
+
showToast: false,
|
|
295
|
+
action: () => handleFormat(noopEvent())
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
if (handleReset) {
|
|
299
|
+
menuItems.push({
|
|
300
|
+
key: "reset",
|
|
301
|
+
icon: RotateCcw,
|
|
302
|
+
label: "Reset to original",
|
|
303
|
+
// Edit-mode only: absent outside it, never a greyed dead row (RC-B9 F7).
|
|
304
|
+
hidden: !isEditing,
|
|
305
|
+
category: "Edit",
|
|
306
|
+
showToast: false,
|
|
307
|
+
action: () => handleReset(noopEvent())
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
menuItems.push({
|
|
311
|
+
key: "copy-numbered",
|
|
312
|
+
icon: ListOrdered,
|
|
313
|
+
label: "Copy with line numbers",
|
|
314
|
+
category: "Copy",
|
|
315
|
+
showToast: false,
|
|
316
|
+
action: () => handleCopy(noopEvent(), true)
|
|
317
|
+
});
|
|
318
|
+
menuItems.push({
|
|
319
|
+
key: "download",
|
|
320
|
+
icon: Download,
|
|
321
|
+
label: "Download as code",
|
|
322
|
+
description: `code.${extensionForLanguage(language) || "txt"}`,
|
|
323
|
+
category: "Download",
|
|
324
|
+
showToast: false,
|
|
325
|
+
action: () => handleDownload(noopEvent())
|
|
326
|
+
});
|
|
327
|
+
if (isCompleteHTML && handleViewHTML) {
|
|
328
|
+
menuItems.push({
|
|
329
|
+
key: "view-html",
|
|
330
|
+
icon: Globe,
|
|
331
|
+
iconColor: "text-purple-600 dark:text-purple-400",
|
|
332
|
+
label: "Open HTML preview",
|
|
333
|
+
description: "Render in Canvas",
|
|
334
|
+
disabled: isCreatingPage,
|
|
335
|
+
category: "Preview",
|
|
336
|
+
showToast: false,
|
|
337
|
+
action: handleViewHTML
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
menuItems.push({
|
|
341
|
+
key: "save-to-code",
|
|
342
|
+
icon: FileCode,
|
|
343
|
+
iconColor: "text-rose-600 dark:text-rose-400",
|
|
344
|
+
label: "Save to Code files",
|
|
345
|
+
description: "Add to your /code workspace",
|
|
346
|
+
category: "Save",
|
|
347
|
+
showToast: false,
|
|
348
|
+
action: handleSaveToCode
|
|
349
|
+
});
|
|
350
|
+
menuItems.push({
|
|
351
|
+
key: "save-and-open",
|
|
352
|
+
icon: isOpeningInEditor ? Loader2 : SquareArrowOutUpRight,
|
|
353
|
+
iconColor: "text-blue-600 dark:text-blue-400",
|
|
354
|
+
label: "Save and open in editor",
|
|
355
|
+
description: "Drops into Chat Captures",
|
|
356
|
+
disabled: isOpeningInEditor,
|
|
357
|
+
category: "Save",
|
|
358
|
+
showToast: false,
|
|
359
|
+
action: handleOpenInEditor
|
|
360
|
+
});
|
|
361
|
+
if (allowEdit && onAIEdit) {
|
|
362
|
+
for (const job of aiEditJobs) {
|
|
363
|
+
menuItems.push({
|
|
364
|
+
key: `ai-${job.mandateKey}`,
|
|
365
|
+
icon: AI_EDIT_ICONS[job.mandateKey] ?? Code2,
|
|
366
|
+
iconColor: "text-purple-600 dark:text-purple-400",
|
|
367
|
+
label: job.name,
|
|
368
|
+
category: "AI",
|
|
369
|
+
showToast: false,
|
|
370
|
+
action: () => onAIEdit({ mandateKey: job.mandateKey, title: job.name })
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (extraMenuItems && extraMenuItems.length > 0) {
|
|
375
|
+
menuItems.push(...extraMenuItems);
|
|
376
|
+
}
|
|
377
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex shrink-0 items-center gap-0.5", isMobile ? "pr-2" : "pr-5"), children: [
|
|
378
|
+
toggleFullScreen && !isMobile && /* @__PURE__ */ jsx(
|
|
379
|
+
IconButton,
|
|
380
|
+
{
|
|
381
|
+
icon: isFullScreen ? Minimize : Expand,
|
|
382
|
+
tooltip: isFullScreen ? "Exit fullscreen" : "Fullscreen",
|
|
383
|
+
variant: "ghost",
|
|
384
|
+
onClick: toggleFullScreen,
|
|
385
|
+
tooltipSide: "bottom"
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
toggleCollapse && !isMobile && /* @__PURE__ */ jsx(
|
|
389
|
+
IconButton,
|
|
390
|
+
{
|
|
391
|
+
icon: isCollapsed ? ChevronDown : ChevronUp,
|
|
392
|
+
tooltip: !canCollapse ? "Too few lines to collapse" : isEditing ? "Cannot collapse in edit mode" : isCollapsed ? "Expand code" : "Collapse code",
|
|
393
|
+
variant: "ghost",
|
|
394
|
+
onClick: toggleCollapse,
|
|
395
|
+
tooltipSide: "bottom",
|
|
396
|
+
disabled: isEditing || !canCollapse,
|
|
397
|
+
className: cn(
|
|
398
|
+
isEditing || !canCollapse ? "opacity-40 cursor-not-allowed" : ""
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ jsx(
|
|
403
|
+
IconButton,
|
|
404
|
+
{
|
|
405
|
+
icon: isCopied ? Check : Copy,
|
|
406
|
+
tooltip: isCopied ? "Copied!" : "Copy code",
|
|
407
|
+
variant: "ghost",
|
|
408
|
+
onClick: (e) => {
|
|
409
|
+
e.stopPropagation();
|
|
410
|
+
handleCopy(e);
|
|
411
|
+
},
|
|
412
|
+
tooltipSide: "bottom"
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
toggleEdit && allowEdit && /* @__PURE__ */ jsx(
|
|
416
|
+
IconButton,
|
|
417
|
+
{
|
|
418
|
+
icon: isEditing ? Eye : Edit2,
|
|
419
|
+
tooltip: isEditing ? "Exit edit mode" : "Edit code",
|
|
420
|
+
variant: "ghost",
|
|
421
|
+
onClick: toggleEdit,
|
|
422
|
+
tooltipSide: "bottom"
|
|
423
|
+
}
|
|
424
|
+
),
|
|
425
|
+
/* @__PURE__ */ jsx("div", { ref: kebabRef, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
426
|
+
IconButton,
|
|
427
|
+
{
|
|
428
|
+
icon: MoreHorizontal,
|
|
429
|
+
tooltip: "More actions",
|
|
430
|
+
variant: "ghost",
|
|
431
|
+
tooltipSide: "bottom",
|
|
432
|
+
onClick: () => {
|
|
433
|
+
if (kebabRef.current) menu.open(kebabRef.current);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
) }),
|
|
437
|
+
/* @__PURE__ */ jsx(
|
|
438
|
+
AdvancedMenu,
|
|
439
|
+
{
|
|
440
|
+
...menu.menuProps,
|
|
441
|
+
anchorElement: menu.anchorElement,
|
|
442
|
+
items: menuItems,
|
|
443
|
+
title: "Code actions",
|
|
444
|
+
position: "bottom-right",
|
|
445
|
+
width: "260px",
|
|
446
|
+
maxWidth: "300px"
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
] });
|
|
450
|
+
};
|
|
451
|
+
const EditButton = ({
|
|
452
|
+
isEditing,
|
|
453
|
+
toggleEdit
|
|
454
|
+
}) => {
|
|
455
|
+
if (isEditing || !toggleEdit) return null;
|
|
456
|
+
return /* @__PURE__ */ jsx("div", { className: "absolute top-4 right-2 z-10 backdrop-blur-sm rounded-md", children: /* @__PURE__ */ jsx(
|
|
457
|
+
IconButton,
|
|
458
|
+
{
|
|
459
|
+
icon: Edit2,
|
|
460
|
+
tooltip: "Edit code",
|
|
461
|
+
variant: "ghost",
|
|
462
|
+
onClick: toggleEdit,
|
|
463
|
+
tooltipSide: "bottom"
|
|
464
|
+
}
|
|
465
|
+
) });
|
|
466
|
+
};
|
|
467
|
+
var CodeBlockHeader_default = CodeBlockHeader;
|
|
468
|
+
export {
|
|
469
|
+
CodeBlockHeader,
|
|
470
|
+
EditButton,
|
|
471
|
+
CodeBlockHeader_default as default
|
|
472
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { FileCode } from "lucide-react";
|
|
4
|
+
const CodeEditorLoading = () => {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full h-full bg-textured flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center space-y-4", children: [
|
|
6
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
7
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 animate-ping opacity-20", children: /* @__PURE__ */ jsx(FileCode, { className: "w-16 h-16 text-blue-500 dark:text-blue-400" }) }),
|
|
8
|
+
/* @__PURE__ */ jsx(FileCode, { className: "w-16 h-16 text-blue-500 dark:text-blue-400 animate-pulse" })
|
|
9
|
+
] }),
|
|
10
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 w-64", children: [
|
|
11
|
+
/* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
12
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-2 bg-purple-400 dark:bg-purple-500 rounded-full animate-pulse" }),
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 flex-1 bg-gray-200 dark:bg-gray-700 rounded-full animate-pulse", style: { animationDelay: "100ms" } })
|
|
14
|
+
] }),
|
|
15
|
+
/* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
16
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-2 bg-green-400 dark:bg-green-500 rounded-full animate-pulse", style: { animationDelay: "200ms" } }),
|
|
17
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-40 bg-gray-200 dark:bg-gray-700 rounded-full animate-pulse", style: { animationDelay: "300ms" } })
|
|
18
|
+
] }),
|
|
19
|
+
/* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
20
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-2 bg-blue-400 dark:bg-blue-500 rounded-full animate-pulse", style: { animationDelay: "400ms" } }),
|
|
21
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-56 bg-gray-200 dark:bg-gray-700 rounded-full animate-pulse", style: { animationDelay: "500ms" } })
|
|
22
|
+
] }),
|
|
23
|
+
/* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
24
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-2 bg-yellow-400 dark:bg-yellow-500 rounded-full animate-pulse", style: { animationDelay: "600ms" } }),
|
|
25
|
+
/* @__PURE__ */ jsx("div", { className: "h-2 w-32 bg-gray-200 dark:bg-gray-700 rounded-full animate-pulse", style: { animationDelay: "700ms" } })
|
|
26
|
+
] })
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-600 dark:text-gray-400 text-sm mt-2 animate-pulse", children: "Initializing code editor..." })
|
|
29
|
+
] }) });
|
|
30
|
+
};
|
|
31
|
+
var CodeEditorLoading_default = CodeEditorLoading;
|
|
32
|
+
export {
|
|
33
|
+
CodeEditorLoading_default as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type IconProps = {
|
|
3
|
+
size?: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
interface LanguageInfo {
|
|
7
|
+
name: string;
|
|
8
|
+
icon: React.FC<IconProps>;
|
|
9
|
+
color: string;
|
|
10
|
+
/** null → icon has its own fixed size (e.g. custom SVGs). */
|
|
11
|
+
size: number | null;
|
|
12
|
+
}
|
|
13
|
+
export declare const languageMap: Record<string, LanguageInfo>;
|
|
14
|
+
/**
|
|
15
|
+
* The display entry for a fence language. A language we have no icon for
|
|
16
|
+
* shows its own name (`nginx`, `toml`) with the generic code icon — never a
|
|
17
|
+
* misleading "Code".
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveLanguageInfo(language: string): LanguageInfo;
|
|
20
|
+
export declare function getLanguageIconNode(language: string, compact?: boolean, iconOverride?: React.ReactNode): React.ReactNode;
|
|
21
|
+
interface LanguageDisplayProps {
|
|
22
|
+
language?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
iconSize?: number;
|
|
25
|
+
isMobile?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare const LanguageDisplay: React.FC<LanguageDisplayProps>;
|
|
28
|
+
export default LanguageDisplay;
|