@ai-matrx/rich-content 0.2.4 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/code-block/CodeBlock.d.ts +44 -0
- package/dist/code-block/CodeBlock.js +449 -0
- package/dist/code-block/CodeBlockHeader.d.ts +63 -0
- package/dist/code-block/CodeBlockHeader.js +472 -0
- package/dist/code-block/CodeEditorLoading.d.ts +3 -0
- package/dist/code-block/CodeEditorLoading.js +34 -0
- package/dist/code-block/LanguageDisplay.d.ts +28 -0
- package/dist/code-block/LanguageDisplay.js +279 -0
- package/dist/code-block/SmallCodeEditor.d.ts +30 -0
- package/dist/code-block/SmallCodeEditor.js +22 -0
- package/dist/code-block/StickyButtons.d.ts +35 -0
- package/dist/code-block/StickyButtons.js +88 -0
- package/dist/code-block/highlight/ShikiCodeView.d.ts +26 -0
- package/dist/code-block/highlight/ShikiCodeView.js +134 -0
- package/dist/code-block/highlight/shiki-highlighter.d.ts +14 -0
- package/dist/code-block/highlight/shiki-highlighter.js +126 -0
- package/dist/code-block/highlight/useHighlightedLines.d.ts +18 -0
- package/dist/code-block/highlight/useHighlightedLines.js +142 -0
- package/dist/code-block/sticky-inset.d.ts +6 -0
- package/dist/code-block/sticky-inset.js +10 -0
- package/dist/display/block-interaction.d.ts +33 -0
- package/dist/display/block-interaction.js +13 -0
- package/dist/display/blocks/ChatCollapsibleWrapper.d.ts +13 -0
- package/dist/display/blocks/ChatCollapsibleWrapper.js +56 -0
- package/dist/display/blocks/buildMediaSource.d.ts +25 -0
- package/dist/display/blocks/buildMediaSource.js +43 -0
- package/dist/display/blocks/canvas-adaptive.d.ts +118 -0
- package/dist/display/blocks/canvas-adaptive.js +127 -0
- package/dist/display/blocks/canvas-fit.d.ts +24 -0
- package/dist/display/blocks/canvas-fit.js +19 -0
- package/dist/display/blocks/chart/ChartBlock.d.ts +8 -0
- package/dist/display/blocks/chart/ChartBlock.js +125 -0
- package/dist/display/blocks/chart/ChartCanvas.d.ts +18 -0
- package/dist/display/blocks/chart/ChartCanvas.js +159 -0
- package/dist/display/blocks/chart/TableChart.d.ts +25 -0
- package/dist/display/blocks/chart/TableChart.js +97 -0
- package/dist/display/blocks/chart/chart-spec.d.ts +39 -0
- package/dist/display/blocks/chart/chart-spec.js +128 -0
- package/dist/display/blocks/chart/labels.d.ts +20 -0
- package/dist/display/blocks/chart/labels.js +7 -0
- package/dist/display/blocks/chart/table-chart.d.ts +37 -0
- package/dist/display/blocks/chart/table-chart.js +231 -0
- package/dist/display/blocks/common/BlockHeaderWrapper.d.ts +56 -0
- package/dist/display/blocks/common/BlockHeaderWrapper.js +310 -0
- package/dist/display/blocks/common/ContentBlockWrapper.d.ts +40 -0
- package/dist/display/blocks/common/ContentBlockWrapper.js +214 -0
- package/dist/display/blocks/common/SandboxedHtml.d.ts +27 -0
- package/dist/display/blocks/common/SandboxedHtml.js +26 -0
- package/dist/display/blocks/diagram/DiagramLoadingVisualization.d.ts +6 -0
- package/dist/display/blocks/diagram/DiagramLoadingVisualization.js +190 -0
- package/dist/display/blocks/diagram/InteractiveDiagramBlock.d.ts +51 -0
- package/dist/display/blocks/diagram/InteractiveDiagramBlock.js +2415 -0
- package/dist/display/blocks/diagram/diagram-printer.d.ts +16 -0
- package/dist/display/blocks/diagram/diagram-printer.js +294 -0
- package/dist/display/blocks/diagram/diagram-visual-defaults.d.ts +116 -0
- package/dist/display/blocks/diagram/diagram-visual-defaults.js +400 -0
- package/dist/display/blocks/diagram/layout-utils.d.ts +90 -0
- package/dist/display/blocks/diagram/layout-utils.js +347 -0
- package/dist/display/blocks/diagram/parseDiagramJSON.d.ts +105 -0
- package/dist/display/blocks/diagram/parseDiagramJSON.js +296 -0
- package/dist/display/blocks/diagram/presentation-direction.d.ts +29 -0
- package/dist/display/blocks/diagram/presentation-direction.js +19 -0
- package/dist/display/blocks/diagram/ui-utils.d.ts +1 -0
- package/dist/display/blocks/diagram/ui-utils.js +18 -0
- package/dist/display/blocks/diff/DiffBlock.d.ts +10 -0
- package/dist/display/blocks/diff/DiffBlock.js +119 -0
- package/dist/display/blocks/diff/DiffCanvas.d.ts +15 -0
- package/dist/display/blocks/diff/DiffCanvas.js +20 -0
- package/dist/display/blocks/generic/GenericStructuredBlock.d.ts +24 -0
- package/dist/display/blocks/generic/GenericStructuredBlock.js +53 -0
- package/dist/display/blocks/generic/StructuredValueTabs.d.ts +21 -0
- package/dist/display/blocks/generic/StructuredValueTabs.js +124 -0
- package/dist/display/blocks/generic/tile-actions-slot.d.ts +39 -0
- package/dist/display/blocks/generic/tile-actions-slot.js +33 -0
- package/dist/display/blocks/images/ImageBlock.d.ts +8 -0
- package/dist/display/blocks/images/ImageBlock.js +265 -0
- package/dist/display/blocks/json/JsonBlock.d.ts +34 -0
- package/dist/display/blocks/json/JsonBlock.js +562 -0
- package/dist/display/blocks/json/JsonTableView.d.ts +10 -0
- package/dist/display/blocks/json/JsonTableView.js +173 -0
- package/dist/display/blocks/json/json-compact-stringify.d.ts +25 -0
- package/dist/display/blocks/json/json-compact-stringify.js +52 -0
- package/dist/display/blocks/json/json-tabular-utils.d.ts +65 -0
- package/dist/display/blocks/json/json-tabular-utils.js +121 -0
- package/dist/display/blocks/links/LinkComponent.d.ts +6 -0
- package/dist/display/blocks/links/LinkComponent.js +373 -0
- package/dist/display/blocks/links/LinkComponentWithFetch.d.ts +1 -0
- package/dist/display/blocks/links/LinkComponentWithFetch.js +0 -0
- package/dist/display/blocks/markdown/MarkdownKindBlock.d.ts +48 -0
- package/dist/display/blocks/markdown/MarkdownKindBlock.js +52 -0
- package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.d.ts +17 -0
- package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.js +70 -0
- package/dist/display/blocks/mermaid/MermaidBlock.d.ts +19 -0
- package/dist/display/blocks/mermaid/MermaidBlock.js +386 -0
- package/dist/display/blocks/search-replace/SearchReplaceBlock.d.ts +50 -0
- package/dist/display/blocks/search-replace/SearchReplaceBlock.js +71 -0
- package/dist/display/blocks/svg/SvgBlock.d.ts +8 -0
- package/dist/display/blocks/svg/SvgBlock.js +126 -0
- package/dist/display/blocks/table/StreamingTableRenderer.d.ts +53 -0
- package/dist/display/blocks/table/StreamingTableRenderer.js +907 -0
- package/dist/display/blocks/table/TableRenderPathDiagnostic.d.ts +21 -0
- package/dist/display/blocks/table/TableRenderPathDiagnostic.js +79 -0
- package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.d.ts +14 -0
- package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.js +15 -0
- package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.d.ts +13 -0
- package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.js +19 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTrace.d.ts +30 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTrace.js +75 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.d.ts +13 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.js +48 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.d.ts +12 -0
- package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.js +19 -0
- package/dist/display/blocks/toml/TomlBlock.d.ts +7 -0
- package/dist/display/blocks/toml/TomlBlock.js +167 -0
- package/dist/display/blocks/tree/TreeBlock.d.ts +7 -0
- package/dist/display/blocks/tree/TreeBlock.js +163 -0
- package/dist/display/blocks/xml/XmlBlock.d.ts +23 -0
- package/dist/display/blocks/xml/XmlBlock.js +197 -0
- package/dist/display/blocks/xml/readXmlTag.d.ts +1 -0
- package/dist/display/blocks/xml/readXmlTag.js +1 -0
- package/dist/display/blocks/xml/xml-tokenize.d.ts +13 -0
- package/dist/display/blocks/xml/xml-tokenize.js +169 -0
- package/dist/display/blocks/yaml/YamlBlock.d.ts +7 -0
- package/dist/display/blocks/yaml/YamlBlock.js +191 -0
- package/dist/display/chat-markdown/BasicMarkdownContent.d.ts +29 -0
- package/dist/display/chat-markdown/BasicMarkdownContent.js +122 -0
- package/dist/display/chat-markdown/BlockRenderingContext.d.ts +23 -0
- package/dist/display/chat-markdown/BlockRenderingContext.js +17 -0
- package/dist/display/chat-markdown/ConfigurableMarkdownContent.d.ts +172 -0
- package/dist/display/chat-markdown/ConfigurableMarkdownContent.js +649 -0
- package/dist/display/chat-markdown/InlineCodeSnippet.d.ts +19 -0
- package/dist/display/chat-markdown/InlineCodeSnippet.js +146 -0
- package/dist/display/chat-markdown/InlineCodeSnippetKindGate.d.ts +11 -0
- package/dist/display/chat-markdown/InlineCodeSnippetKindGate.js +9 -0
- package/dist/display/chat-markdown/KindTextGate.d.ts +31 -0
- package/dist/display/chat-markdown/KindTextGate.js +60 -0
- package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.d.ts +6 -0
- package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.js +92 -0
- package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.d.ts +72 -0
- package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.js +94 -0
- package/dist/display/chat-markdown/block-registry/BlockRenderer.d.ts +126 -0
- package/dist/display/chat-markdown/block-registry/BlockRenderer.js +473 -0
- package/dist/display/chat-markdown/block-registry/block-dispatch.d.ts +410 -0
- package/dist/display/chat-markdown/block-registry/block-dispatch.js +495 -0
- package/dist/display/chat-markdown/block-registry/json-parse-utils.d.ts +13 -0
- package/dist/display/chat-markdown/block-registry/json-parse-utils.js +236 -0
- package/dist/display/chat-markdown/constants.d.ts +14 -0
- package/dist/display/chat-markdown/constants.js +317 -0
- package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.d.ts +31 -0
- package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.js +62 -0
- package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.d.ts +12 -0
- package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.js +18 -0
- package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.d.ts +22 -0
- package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.js +130 -0
- package/dist/display/chat-markdown/diff-blocks/diff-style-registry.d.ts +21 -0
- package/dist/display/chat-markdown/diff-blocks/diff-style-registry.js +91 -0
- package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.d.ts +26 -0
- package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.js +186 -0
- package/dist/display/chat-markdown/diff-blocks/types.d.ts +56 -0
- package/dist/display/chat-markdown/diff-blocks/types.js +0 -0
- package/dist/display/chat-markdown/internal-handlers/BlockFallback.d.ts +20 -0
- package/dist/display/chat-markdown/internal-handlers/BlockFallback.js +83 -0
- package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.d.ts +4 -0
- package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.js +16 -0
- package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.d.ts +17 -0
- package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.js +40 -0
- package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.d.ts +8 -0
- package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.js +91 -0
- package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.d.ts +20 -0
- package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.js +72 -0
- package/dist/display/chat-markdown/kind-source-view.d.ts +14 -0
- package/dist/display/chat-markdown/kind-source-view.js +14 -0
- package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.d.ts +28 -0
- package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.js +65 -0
- package/dist/display/chat-markdown/progressive-mount.d.ts +18 -0
- package/dist/display/chat-markdown/progressive-mount.js +90 -0
- package/dist/display/chat-markdown/render-block-to-content-block.d.ts +31 -0
- package/dist/display/chat-markdown/render-block-to-content-block.js +32 -0
- package/dist/display/chat-markdown/settle-stream-blocks.d.ts +50 -0
- package/dist/display/chat-markdown/settle-stream-blocks.js +26 -0
- package/dist/display/chat-markdown/stable-blocks.d.ts +15 -0
- package/dist/display/chat-markdown/stable-blocks.js +54 -0
- package/dist/display/chat-markdown/types.d.ts +11 -0
- package/dist/display/chat-markdown/types.js +26 -0
- package/dist/display/specimen/SpecimenContext.d.ts +26 -0
- package/dist/display/specimen/SpecimenContext.js +64 -0
- package/dist/display/tables/MarkdownTable.d.ts +23 -0
- package/dist/display/tables/MarkdownTable.js +769 -0
- package/dist/display/tables/MarkdownTableScrollArea.d.ts +12 -0
- package/dist/display/tables/MarkdownTableScrollArea.js +92 -0
- package/dist/display/tables/SendToGoogleSheetButton.d.ts +19 -0
- package/dist/display/tables/SendToGoogleSheetButton.js +93 -0
- package/dist/display/tables/SendToWorkbookButton.d.ts +24 -0
- package/dist/display/tables/SendToWorkbookButton.js +93 -0
- package/dist/display/tables/TableSaveToMenu.d.ts +16 -0
- package/dist/display/tables/TableSaveToMenu.js +98 -0
- package/dist/display/tables/TableWithSeparatedControls.d.ts +22 -0
- package/dist/display/tables/TableWithSeparatedControls.js +574 -0
- package/dist/display/tables/ViewTableModal.d.ts +14 -0
- package/dist/display/tables/ViewTableModal.js +67 -0
- package/dist/display/tables/editing/ColumnActionsMenu.d.ts +16 -0
- package/dist/display/tables/editing/ColumnActionsMenu.js +80 -0
- package/dist/display/tables/editing/RowActionsMenu.d.ts +16 -0
- package/dist/display/tables/editing/RowActionsMenu.js +80 -0
- package/dist/display/tables/editing/TableEditToolbar.d.ts +15 -0
- package/dist/display/tables/editing/TableEditToolbar.js +63 -0
- package/dist/display/tables/editing/tableMutations.d.ts +50 -0
- package/dist/display/tables/editing/tableMutations.js +148 -0
- package/dist/display/tables/editing/useDoubleClickEdit.d.ts +43 -0
- package/dist/display/tables/editing/useDoubleClickEdit.js +51 -0
- package/dist/display/tables/editing/useTableUndo.d.ts +25 -0
- package/dist/display/tables/editing/useTableUndo.js +17 -0
- package/dist/display/tables/table-action-row.d.ts +8 -0
- package/dist/display/tables/table-action-row.js +31 -0
- package/dist/display/tables/table-viewer.d.ts +13 -0
- package/dist/display/tables/table-viewer.js +18 -0
- package/dist/host/ErrorActions.d.ts +1 -1
- package/dist/host/ErrorNotice.d.ts +10 -0
- package/dist/host/ErrorNotice.js +19 -0
- package/dist/host/app-bindings.d.ts +155 -0
- package/dist/host/app-bindings.js +160 -0
- package/dist/host/diagnostics.d.ts +2 -2
- package/dist/host/diagnostics.js +2 -1
- package/dist/host/tables.d.ts +1 -6
- package/dist/host/types.d.ts +14 -7
- package/dist/levels/RichContent.d.ts +3 -0
- package/dist/levels/RichContent.js +102 -0
- package/dist/levels/RichContentInline.d.ts +28 -0
- package/dist/levels/RichContentInline.js +61 -0
- package/dist/levels/RichContentPreview.d.ts +12 -0
- package/dist/levels/RichContentPreview.js +39 -0
- package/dist/levels/RichContentStandardImpl.d.ts +12 -0
- package/dist/levels/RichContentStandardImpl.js +27 -0
- package/dist/levels/RichContentStaticProse.d.ts +46 -0
- package/dist/levels/RichContentStaticProse.js +100 -0
- package/dist/levels/depth.d.ts +18 -0
- package/dist/levels/depth.js +32 -0
- package/dist/levels/prose/inline-level-elements.d.ts +19 -0
- package/dist/levels/prose/inline-level-elements.js +103 -0
- package/dist/levels/prose/prose-block-elements.d.ts +25 -0
- package/dist/levels/prose/prose-block-elements.js +313 -0
- package/dist/levels/prose/prose-inline-elements.d.ts +13 -0
- package/dist/levels/prose/prose-inline-elements.js +143 -0
- package/dist/levels/prose/prose-prepare.d.ts +50 -0
- package/dist/levels/prose/prose-prepare.js +246 -0
- package/dist/levels/prose/remote-image-policy.d.ts +34 -0
- package/dist/levels/prose/remote-image-policy.js +153 -0
- package/dist/levels/prose/variant-root.d.ts +9 -0
- package/dist/levels/prose/variant-root.js +34 -0
- package/dist/levels/rich-content-types.d.ts +93 -0
- package/dist/levels/rich-content-types.js +4 -0
- package/dist/levels/server/DelimiterViolationReport.d.ts +7 -0
- package/dist/levels/server/DelimiterViolationReport.js +24 -0
- package/dist/levels/server/RichContentServer.d.ts +27 -0
- package/dist/levels/server/RichContentServer.js +97 -0
- package/dist/levels/standard/NestedRichContent.d.ts +7 -0
- package/dist/levels/standard/NestedRichContent.js +70 -0
- package/dist/levels/standard/StandardBlocks.d.ts +13 -0
- package/dist/levels/standard/StandardBlocks.js +239 -0
- package/dist/levels/standard/StandardKindRegion.d.ts +14 -0
- package/dist/levels/standard/StandardKindRegion.js +69 -0
- package/dist/levels/standard/standard-kind-region.d.ts +19 -0
- package/dist/levels/standard/standard-kind-region.js +21 -0
- package/dist/levels/standard/static-standard.d.ts +23 -0
- package/dist/levels/standard/static-standard.js +187 -0
- package/dist/levels/standard/stream-holdback.d.ts +2 -0
- package/dist/levels/standard/stream-holdback.js +77 -0
- package/dist/mermaid/MermaidFullscreen.d.ts +17 -0
- package/dist/mermaid/MermaidFullscreen.js +71 -0
- package/dist/mermaid/MermaidRenderer.d.ts +20 -0
- package/dist/mermaid/MermaidRenderer.js +267 -0
- package/dist/mermaid/MermaidView.d.ts +27 -0
- package/dist/mermaid/MermaidView.js +68 -0
- package/dist/mermaid/MermaidViewport.d.ts +75 -0
- package/dist/mermaid/MermaidViewport.js +286 -0
- package/dist/mermaid/adapters/er.d.ts +10 -0
- package/dist/mermaid/adapters/er.js +205 -0
- package/dist/mermaid/adapters/flowchart.d.ts +17 -0
- package/dist/mermaid/adapters/flowchart.js +634 -0
- package/dist/mermaid/adapters/journey.d.ts +9 -0
- package/dist/mermaid/adapters/journey.js +207 -0
- package/dist/mermaid/adapters/mindmap.d.ts +12 -0
- package/dist/mermaid/adapters/mindmap.js +252 -0
- package/dist/mermaid/adapters/pie.d.ts +7 -0
- package/dist/mermaid/adapters/pie.js +172 -0
- package/dist/mermaid/adapters/quadrant.d.ts +8 -0
- package/dist/mermaid/adapters/quadrant.js +231 -0
- package/dist/mermaid/adapters/register.d.ts +7 -0
- package/dist/mermaid/adapters/register.js +19 -0
- package/dist/mermaid/adapters/sequence.d.ts +8 -0
- package/dist/mermaid/adapters/sequence.js +251 -0
- package/dist/mermaid/adapters/state.d.ts +12 -0
- package/dist/mermaid/adapters/state.js +245 -0
- package/dist/mermaid/adapters/timeline.d.ts +8 -0
- package/dist/mermaid/adapters/timeline.js +245 -0
- package/dist/mermaid/catalog.d.ts +33 -0
- package/dist/mermaid/catalog.js +202 -0
- package/dist/mermaid/diagram-type.d.ts +39 -0
- package/dist/mermaid/diagram-type.js +89 -0
- package/dist/mermaid/export.d.ts +21 -0
- package/dist/mermaid/export.js +112 -0
- package/dist/mermaid/extract-fence.d.ts +15 -0
- package/dist/mermaid/extract-fence.js +22 -0
- package/dist/mermaid/lazy-draw.d.ts +40 -0
- package/dist/mermaid/lazy-draw.js +168 -0
- package/dist/mermaid/model/adapter.d.ts +28 -0
- package/dist/mermaid/model/adapter.js +16 -0
- package/dist/mermaid/model/ops.d.ts +282 -0
- package/dist/mermaid/model/ops.js +9 -0
- package/dist/mermaid/model/round-trip.d.ts +22 -0
- package/dist/mermaid/model/round-trip.js +45 -0
- package/dist/mermaid/model/types.d.ts +271 -0
- package/dist/mermaid/model/types.js +0 -0
- package/dist/mermaid/print-render.d.ts +9 -0
- package/dist/mermaid/print-render.js +39 -0
- package/dist/mermaid/runtime.d.ts +25 -0
- package/dist/mermaid/runtime.js +183 -0
- package/dist/mermaid/sanitize.d.ts +46 -0
- package/dist/mermaid/sanitize.js +234 -0
- package/dist/mermaid/types.d.ts +43 -0
- package/dist/mermaid/types.js +21 -0
- package/dist/mermaid/view/ViewModePane.d.ts +24 -0
- package/dist/mermaid/view/ViewModePane.js +9 -0
- package/dist/utils/client-lazy.d.ts +1 -1
- package/dist/utils/client-lazy.js +4 -1
- package/dist/utils/lifted/DiffView.d.ts +10 -0
- package/dist/utils/lifted/DiffView.js +26 -0
- package/dist/utils/lifted/IconButton.d.ts +24 -0
- package/dist/utils/lifted/IconButton.js +43 -0
- package/dist/utils/lifted/MatrxMiniLoader.d.ts +1 -0
- package/dist/utils/lifted/MatrxMiniLoader.js +8 -0
- package/dist/utils/lifted/ShimmerText.d.ts +5 -0
- package/dist/utils/lifted/ShimmerText.js +21 -0
- package/dist/utils/lifted/SuspenseLoader.d.ts +16 -0
- package/dist/utils/lifted/SuspenseLoader.js +42 -0
- package/dist/utils/lifted/Tooltip.d.ts +20 -0
- package/dist/utils/lifted/Tooltip.js +52 -0
- package/dist/utils/lifted/artifactId.d.ts +34 -0
- package/dist/utils/lifted/artifactId.js +15 -0
- package/dist/utils/lifted/canvasContent.d.ts +63 -0
- package/dist/utils/lifted/canvasContent.js +98 -0
- package/dist/utils/lifted/captureReactError.d.ts +24 -0
- package/dist/utils/lifted/captureReactError.js +28 -0
- package/dist/utils/lifted/chunk-load-recovery.d.ts +25 -0
- package/dist/utils/lifted/chunk-load-recovery.js +36 -0
- package/dist/utils/lifted/code-editor-agent-types.d.ts +6 -0
- package/dist/utils/lifted/code-editor-agent-types.js +0 -0
- package/dist/utils/lifted/code-editor-agents.d.ts +39 -0
- package/dist/utils/lifted/code-editor-agents.js +52 -0
- package/dist/utils/lifted/code-language-extension.d.ts +1 -0
- package/dist/utils/lifted/code-language-extension.js +60 -0
- package/dist/utils/lifted/custom-icons.d.ts +16 -0
- package/dist/utils/lifted/custom-icons.js +47 -0
- package/dist/utils/lifted/durability.d.ts +16 -0
- package/dist/utils/lifted/durability.js +45 -0
- package/dist/utils/lifted/errors.d.ts +30 -0
- package/dist/utils/lifted/errors.js +29 -0
- package/dist/utils/lifted/html-document.d.ts +1 -0
- package/dist/utils/lifted/html-document.js +12 -0
- package/dist/utils/lifted/languageOptions.d.ts +9 -0
- package/dist/utils/lifted/languageOptions.js +52 -0
- package/dist/utils/lifted/languages.d.ts +34 -0
- package/dist/utils/lifted/languages.js +175 -0
- package/dist/utils/lifted/loading-spinner.d.ts +18 -0
- package/dist/utils/lifted/loading-spinner.js +200 -0
- package/dist/utils/lifted/media-refs.d.ts +13 -0
- package/dist/utils/lifted/media-refs.js +27 -0
- package/dist/utils/lifted/scroll-root.d.ts +1 -0
- package/dist/utils/lifted/scroll-root.js +25 -0
- package/dist/utils/lifted/syntax-themes.d.ts +32 -0
- package/dist/utils/lifted/syntax-themes.js +100 -0
- package/dist/utils/lifted/url-utm.d.ts +24 -0
- package/dist/utils/lifted/url-utm.js +66 -0
- package/dist/utils/lifted/use-is-mounted.d.ts +24 -0
- package/dist/utils/lifted/use-is-mounted.js +21 -0
- package/dist/utils/lifted/useToastManager.d.ts +1 -0
- package/dist/utils/lifted/useToastManager.js +7 -0
- package/dist/utils/report-kind-at-raw-renderer.d.ts +19 -0
- package/dist/utils/report-kind-at-raw-renderer.js +32 -0
- package/package.json +48 -10
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useClipboard } from "@ai-matrx/kit/clipboard";
|
|
4
|
+
import { toast } from "../../../host/toast.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { Braces, Check, Copy, TriangleAlert } from "lucide-react";
|
|
7
|
+
import { cn } from "@ai-matrx/design-system";
|
|
8
|
+
import { hasKindErrors } from "../../../kinds/react/kind-problems.js";
|
|
9
|
+
import { IntoTileActions, useHasTileActionsSlot } from "./tile-actions-slot.js";
|
|
10
|
+
import { ErrorAlchemyMenu } from "../../../host/ErrorActions.js";
|
|
11
|
+
function GhostIconButton({
|
|
12
|
+
active,
|
|
13
|
+
label,
|
|
14
|
+
icon: Icon,
|
|
15
|
+
onClick,
|
|
16
|
+
iconClassName
|
|
17
|
+
}) {
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
type: "button",
|
|
22
|
+
onClick,
|
|
23
|
+
"aria-pressed": active,
|
|
24
|
+
"aria-label": label,
|
|
25
|
+
title: label,
|
|
26
|
+
className: cn(
|
|
27
|
+
"inline-flex h-6 w-6 items-center justify-center rounded-md transition-colors",
|
|
28
|
+
active ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
29
|
+
),
|
|
30
|
+
children: /* @__PURE__ */ jsx(Icon, { className: cn("h-3.5 w-3.5", iconClassName) })
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function StructuredValueTabs({
|
|
35
|
+
value,
|
|
36
|
+
raw,
|
|
37
|
+
header,
|
|
38
|
+
problems,
|
|
39
|
+
children
|
|
40
|
+
}) {
|
|
41
|
+
const { copyText } = useClipboard({
|
|
42
|
+
notify: (message, kind) => kind === "error" ? toast.error(message) : toast.success(message)
|
|
43
|
+
});
|
|
44
|
+
const [tab, setTab] = useState("preview");
|
|
45
|
+
const [copied, setCopied] = useState(false);
|
|
46
|
+
const hasSlot = useHasTileActionsSlot();
|
|
47
|
+
const json = value !== void 0 && value !== null ? JSON.stringify(value, null, 2) : raw ?? "";
|
|
48
|
+
const copy = async () => {
|
|
49
|
+
try {
|
|
50
|
+
await copyText(json);
|
|
51
|
+
setCopied(true);
|
|
52
|
+
setTimeout(() => setCopied(false), 1500);
|
|
53
|
+
} catch {
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const jsonActive = tab === "json";
|
|
57
|
+
const errorsActive = tab === "errors";
|
|
58
|
+
const shownProblems = problems ?? [];
|
|
59
|
+
const hasErrors = hasKindErrors(shownProblems);
|
|
60
|
+
const controls = /* @__PURE__ */ jsxs("span", { className: "inline-flex shrink-0 items-center gap-0.5", children: [
|
|
61
|
+
shownProblems.length > 0 ? /* @__PURE__ */ jsx(
|
|
62
|
+
GhostIconButton,
|
|
63
|
+
{
|
|
64
|
+
active: errorsActive,
|
|
65
|
+
label: errorsActive ? "Back to preview" : `View ${shownProblems.length} problem${shownProblems.length === 1 ? "" : "s"}`,
|
|
66
|
+
icon: TriangleAlert,
|
|
67
|
+
onClick: () => setTab(errorsActive ? "preview" : "errors"),
|
|
68
|
+
iconClassName: errorsActive ? void 0 : hasErrors ? "text-destructive" : "text-amber-600 dark:text-amber-400"
|
|
69
|
+
}
|
|
70
|
+
) : null,
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
GhostIconButton,
|
|
73
|
+
{
|
|
74
|
+
active: jsonActive,
|
|
75
|
+
label: jsonActive ? "Back to preview" : "View JSON",
|
|
76
|
+
icon: Braces,
|
|
77
|
+
onClick: () => setTab(jsonActive ? "preview" : "json")
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
jsonActive ? /* @__PURE__ */ jsx(
|
|
81
|
+
GhostIconButton,
|
|
82
|
+
{
|
|
83
|
+
active: false,
|
|
84
|
+
label: copied ? "Copied" : "Copy JSON",
|
|
85
|
+
icon: copied ? Check : Copy,
|
|
86
|
+
onClick: copy,
|
|
87
|
+
iconClassName: copied ? "text-emerald-600 dark:text-emerald-400" : void 0
|
|
88
|
+
}
|
|
89
|
+
) : null
|
|
90
|
+
] });
|
|
91
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(!hasSlot && "relative"), children: [
|
|
92
|
+
/* @__PURE__ */ jsx(IntoTileActions, { children: hasSlot ? controls : (
|
|
93
|
+
// No header slot and no reserved row: the button sits in the
|
|
94
|
+
// content area's own top-right corner (see file header for why
|
|
95
|
+
// that's safe for the bodies this wraps).
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "absolute right-0 top-0 z-10", children: controls })
|
|
97
|
+
) }),
|
|
98
|
+
header,
|
|
99
|
+
tab === "preview" ? children : tab === "errors" ? /* @__PURE__ */ jsxs("div", { className: "max-h-[28rem] space-y-2 overflow-auto rounded-md border border-border bg-muted/30 p-3", children: [
|
|
100
|
+
shownProblems.map((problem, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 text-xs leading-relaxed", children: [
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
TriangleAlert,
|
|
103
|
+
{
|
|
104
|
+
className: cn(
|
|
105
|
+
"mt-0.5 h-3.5 w-3.5 shrink-0",
|
|
106
|
+
problem.severity === "error" ? "text-destructive" : problem.severity === "warning" ? "text-amber-600 dark:text-amber-400" : "text-muted-foreground"
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
111
|
+
/* @__PURE__ */ jsxs("span", { className: "mr-1.5 rounded bg-muted px-1 py-0.5 font-mono text-[10px] text-muted-foreground", children: [
|
|
112
|
+
problem.code,
|
|
113
|
+
problem.path ? ` @ ${problem.path}` : ""
|
|
114
|
+
] }),
|
|
115
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: problem.message })
|
|
116
|
+
] })
|
|
117
|
+
] }, i)),
|
|
118
|
+
/* @__PURE__ */ jsx(ErrorAlchemyMenu, {})
|
|
119
|
+
] }) : /* @__PURE__ */ jsx("pre", { className: "max-h-[28rem] overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs leading-relaxed text-foreground", children: json })
|
|
120
|
+
] });
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
StructuredValueTabs
|
|
124
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE HEADER-ACTIONS SLOT — lets deep content place its small controls in its
|
|
3
|
+
* host tile's HEADER line instead of spending a body row on them.
|
|
4
|
+
*
|
|
5
|
+
* Arman (2026-08-26, Study Pack run page): "the preview versus JSON is
|
|
6
|
+
* sitting outside of the component, but not in the header section as tiny
|
|
7
|
+
* buttons as they should be. Instead, they're giant buttons wasting all of
|
|
8
|
+
* the most valuable user interface space." The header row already exists and
|
|
9
|
+
* already has dead space to the right of the title; the controls belong
|
|
10
|
+
* there.
|
|
11
|
+
*
|
|
12
|
+
* Mechanics: the HOST (a run-surface tile, a deliverable card) renders
|
|
13
|
+
* `<TileActionsTarget/>` inside its header and wraps its body in
|
|
14
|
+
* `<TileActionsProvider>`. Body content (StructuredValueTabs) portals its
|
|
15
|
+
* controls into the target when one exists, and renders them inline —
|
|
16
|
+
* compactly — when it doesn't, so every non-tile surface keeps working with
|
|
17
|
+
* zero changes.
|
|
18
|
+
*/
|
|
19
|
+
import React from "react";
|
|
20
|
+
export declare function TileActionsProvider({ target, children, }: {
|
|
21
|
+
target: HTMLElement | null;
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
/** The header-side mount point. Renders nothing visible of its own. */
|
|
25
|
+
export declare function useTileActionsTarget(): {
|
|
26
|
+
target: HTMLElement | null;
|
|
27
|
+
targetProps: {
|
|
28
|
+
ref: (el: HTMLElement | null) => void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Render `children` into the host tile's header slot when one is provided,
|
|
33
|
+
* inline otherwise. The one seam every in-body control row uses.
|
|
34
|
+
*/
|
|
35
|
+
export declare function IntoTileActions({ children }: {
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
}): React.JSX.Element;
|
|
38
|
+
/** True when a header slot exists (content can drop its inline reserved row). */
|
|
39
|
+
export declare function useHasTileActionsSlot(): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
useContext,
|
|
6
|
+
useState
|
|
7
|
+
} from "react";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
9
|
+
const TileActionsContext = createContext(null);
|
|
10
|
+
function TileActionsProvider({
|
|
11
|
+
target,
|
|
12
|
+
children
|
|
13
|
+
}) {
|
|
14
|
+
return /* @__PURE__ */ jsx(TileActionsContext.Provider, { value: target, children });
|
|
15
|
+
}
|
|
16
|
+
function useTileActionsTarget() {
|
|
17
|
+
const [el, setEl] = useState(null);
|
|
18
|
+
return { target: el, targetProps: { ref: setEl } };
|
|
19
|
+
}
|
|
20
|
+
function IntoTileActions({ children }) {
|
|
21
|
+
const target = useContext(TileActionsContext);
|
|
22
|
+
if (target) return createPortal(children, target);
|
|
23
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
24
|
+
}
|
|
25
|
+
function useHasTileActionsSlot() {
|
|
26
|
+
return useContext(TileActionsContext) !== null;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
IntoTileActions,
|
|
30
|
+
TileActionsProvider,
|
|
31
|
+
useHasTileActionsSlot,
|
|
32
|
+
useTileActionsTarget
|
|
33
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ImageBlockProps {
|
|
3
|
+
src: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
}
|
|
6
|
+
/** A remote image obeys the surrounding policy (remote-image-policy.tsx); our own files always draw. */
|
|
7
|
+
declare const ImageBlock: React.FC<ImageBlockProps>;
|
|
8
|
+
export default ImageBlock;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect } from "react";
|
|
4
|
+
import {
|
|
5
|
+
DownloadIcon,
|
|
6
|
+
ClipboardCopyIcon,
|
|
7
|
+
ThumbsUpIcon,
|
|
8
|
+
ThumbsDownIcon,
|
|
9
|
+
ShareIcon,
|
|
10
|
+
Maximize2Icon,
|
|
11
|
+
ZoomInIcon,
|
|
12
|
+
ZoomOutIcon,
|
|
13
|
+
XIcon,
|
|
14
|
+
CopyIcon,
|
|
15
|
+
PencilIcon
|
|
16
|
+
} from "lucide-react";
|
|
17
|
+
import {
|
|
18
|
+
useMediaBlob,
|
|
19
|
+
useMediaLoadRecovery,
|
|
20
|
+
useMediaResolution
|
|
21
|
+
} from "@ai-matrx/media/core";
|
|
22
|
+
import { fileSourceToMediaRef } from "../../../utils/lifted/media-refs.js";
|
|
23
|
+
import { recognizeOurFileUrl } from "@ai-matrx/media/files/engine/media/our-file-sources";
|
|
24
|
+
import { RemoteImageGate, remoteImageHost } from "../../../levels/prose/remote-image-policy.js";
|
|
25
|
+
import { Button } from "@ai-matrx/design-system/controls";
|
|
26
|
+
import { TapTargetButton } from "@ai-matrx/design-system/tap-target";
|
|
27
|
+
const MAX_IMAGE_HEIGHT = 700;
|
|
28
|
+
const ImageBlockImpl = ({ src: srcProp, alt = "Image" }) => {
|
|
29
|
+
const ourFile = recognizeOurFileUrl(srcProp);
|
|
30
|
+
const mediaRef = fileSourceToMediaRef(ourFile?.source);
|
|
31
|
+
const { resolution } = useMediaResolution(mediaRef);
|
|
32
|
+
const needsBlob = resolution?.transport === "blob";
|
|
33
|
+
const authenticatedBlob = useMediaBlob(needsBlob ? mediaRef : null);
|
|
34
|
+
const resolvedFromIdentity = needsBlob ? authenticatedBlob.url : resolution?.src ?? null;
|
|
35
|
+
const effectiveSrc = mediaRef ? resolvedFromIdentity : srcProp;
|
|
36
|
+
const src = effectiveSrc ?? "";
|
|
37
|
+
const renderSrc = effectiveSrc ?? void 0;
|
|
38
|
+
const remoteReferrer = renderSrc && remoteImageHost(renderSrc) ? "no-referrer" : void 0;
|
|
39
|
+
const {
|
|
40
|
+
retryKey,
|
|
41
|
+
onLoadError: handleImageError
|
|
42
|
+
} = useMediaLoadRecovery(effectiveSrc ?? null, {
|
|
43
|
+
recoverable: !needsBlob && (!!ourFile?.fileId || !!effectiveSrc && recognizeOurFileUrl(effectiveSrc) !== null),
|
|
44
|
+
failureRef: mediaRef
|
|
45
|
+
});
|
|
46
|
+
const editableFileId = ourFile?.fileId ?? null;
|
|
47
|
+
const [feedback, setFeedback] = useState("none");
|
|
48
|
+
const [showCopySuccess, setShowCopySuccess] = useState(false);
|
|
49
|
+
const [showShareModal, setShowShareModal] = useState(false);
|
|
50
|
+
const [showExpandedView, setShowExpandedView] = useState(false);
|
|
51
|
+
const [zoomLevel, setZoomLevel] = useState(1);
|
|
52
|
+
const imageRef = useRef(null);
|
|
53
|
+
const handleDownload = async (e) => {
|
|
54
|
+
e?.preventDefault();
|
|
55
|
+
try {
|
|
56
|
+
const response = await fetch(src);
|
|
57
|
+
const blob = await response.blob();
|
|
58
|
+
const url = window.URL.createObjectURL(blob);
|
|
59
|
+
const link = document.createElement("a");
|
|
60
|
+
link.href = url;
|
|
61
|
+
link.download = src.split("/").pop() || "image";
|
|
62
|
+
document.body.appendChild(link);
|
|
63
|
+
link.click();
|
|
64
|
+
document.body.removeChild(link);
|
|
65
|
+
window.URL.revokeObjectURL(url);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error("Failed to download image:", err);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const handleCopyUrl = (e) => {
|
|
71
|
+
e?.preventDefault();
|
|
72
|
+
navigator.clipboard.writeText(src).then(() => {
|
|
73
|
+
setShowCopySuccess(true);
|
|
74
|
+
setTimeout(() => setShowCopySuccess(false), 2e3);
|
|
75
|
+
}).catch((err) => {
|
|
76
|
+
console.error("Failed to copy URL:", err);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const handleCopyImage = async (e) => {
|
|
80
|
+
e?.preventDefault();
|
|
81
|
+
try {
|
|
82
|
+
const response = await fetch(src);
|
|
83
|
+
const blob = await response.blob();
|
|
84
|
+
if (navigator.clipboard && navigator.clipboard.write) {
|
|
85
|
+
await navigator.clipboard.write([
|
|
86
|
+
new ClipboardItem({
|
|
87
|
+
[blob.type]: blob
|
|
88
|
+
})
|
|
89
|
+
]);
|
|
90
|
+
setShowCopySuccess(true);
|
|
91
|
+
setTimeout(() => setShowCopySuccess(false), 2e3);
|
|
92
|
+
} else {
|
|
93
|
+
console.error("Clipboard API not supported");
|
|
94
|
+
}
|
|
95
|
+
} catch (err) {
|
|
96
|
+
console.error("Failed to copy image to clipboard:", err);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const handleShare = async (e) => {
|
|
100
|
+
e?.preventDefault();
|
|
101
|
+
if (navigator.share) {
|
|
102
|
+
try {
|
|
103
|
+
await navigator.share({
|
|
104
|
+
title: "Shared Image",
|
|
105
|
+
url: src
|
|
106
|
+
});
|
|
107
|
+
} catch (err) {
|
|
108
|
+
console.error("Failed to share:", err);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
setShowShareModal(true);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const handleFeedback = (type) => {
|
|
115
|
+
setFeedback(type);
|
|
116
|
+
console.log(`User ${type}d this image`);
|
|
117
|
+
};
|
|
118
|
+
const openInNewTab = (url) => {
|
|
119
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
120
|
+
};
|
|
121
|
+
const handleExpand = () => {
|
|
122
|
+
setShowExpandedView(true);
|
|
123
|
+
setZoomLevel(1);
|
|
124
|
+
};
|
|
125
|
+
const handleZoomIn = () => {
|
|
126
|
+
setZoomLevel((prev) => Math.min(prev + 0.25, 3));
|
|
127
|
+
};
|
|
128
|
+
const handleZoomOut = () => {
|
|
129
|
+
setZoomLevel((prev) => Math.max(prev - 0.25, 0.5));
|
|
130
|
+
};
|
|
131
|
+
const handleCloseExpanded = () => {
|
|
132
|
+
setShowExpandedView(false);
|
|
133
|
+
setZoomLevel(1);
|
|
134
|
+
};
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (!showExpandedView) return void 0;
|
|
137
|
+
const onKey = (e) => {
|
|
138
|
+
if (e.key === "Escape") handleCloseExpanded();
|
|
139
|
+
};
|
|
140
|
+
window.addEventListener("keydown", onKey);
|
|
141
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
142
|
+
}, [showExpandedView]);
|
|
143
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative my-4 rounded-3xl group max-w-[900px]", "data-matrx-glass-plane": "", children: [
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
"img",
|
|
146
|
+
{
|
|
147
|
+
ref: imageRef,
|
|
148
|
+
src: renderSrc,
|
|
149
|
+
referrerPolicy: remoteReferrer,
|
|
150
|
+
alt,
|
|
151
|
+
onDoubleClick: handleExpand,
|
|
152
|
+
onError: handleImageError,
|
|
153
|
+
className: "w-full h-auto rounded-3xl object-contain cursor-zoom-in",
|
|
154
|
+
style: { maxHeight: MAX_IMAGE_HEIGHT }
|
|
155
|
+
},
|
|
156
|
+
retryKey
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute top-4 right-2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200", children: [
|
|
159
|
+
/* @__PURE__ */ jsx(TapTargetButton, { icon: /* @__PURE__ */ jsx(DownloadIcon, {}), ariaLabel: "Download", onClick: handleDownload }),
|
|
160
|
+
/* @__PURE__ */ jsx(TapTargetButton, { icon: /* @__PURE__ */ jsx(ClipboardCopyIcon, {}), ariaLabel: "Copy URL", onClick: handleCopyUrl }),
|
|
161
|
+
/* @__PURE__ */ jsx(TapTargetButton, { icon: /* @__PURE__ */ jsx(CopyIcon, {}), ariaLabel: "Copy Image", onClick: handleCopyImage }),
|
|
162
|
+
/* @__PURE__ */ jsx(TapTargetButton, { icon: /* @__PURE__ */ jsx(ShareIcon, {}), ariaLabel: "Share", onClick: handleShare }),
|
|
163
|
+
editableFileId && /* @__PURE__ */ jsx(TapTargetButton, { icon: /* @__PURE__ */ jsx(PencilIcon, {}), ariaLabel: "Edit image", onClick: () => window.open(
|
|
164
|
+
`/images/edit/${editableFileId}`,
|
|
165
|
+
"_blank",
|
|
166
|
+
"noopener,noreferrer"
|
|
167
|
+
) }),
|
|
168
|
+
/* @__PURE__ */ jsx(TapTargetButton, { icon: /* @__PURE__ */ jsx(Maximize2Icon, {}), ariaLabel: "Expand", onClick: handleExpand })
|
|
169
|
+
] }),
|
|
170
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-2 left-2 flex items-center opacity-0 group-hover:opacity-100 transition-opacity duration-200", children: [
|
|
171
|
+
/* @__PURE__ */ jsx(TapTargetButton, { icon: /* @__PURE__ */ jsx(ThumbsUpIcon, {}), ariaLabel: "Like", pressed: feedback === "like", onClick: () => handleFeedback("like") }),
|
|
172
|
+
/* @__PURE__ */ jsx(TapTargetButton, { icon: /* @__PURE__ */ jsx(ThumbsDownIcon, {}), ariaLabel: "Dislike", pressed: feedback === "dislike", onClick: () => handleFeedback("dislike") })
|
|
173
|
+
] }),
|
|
174
|
+
showShareModal && /* @__PURE__ */ jsx(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50",
|
|
178
|
+
onClick: () => setShowShareModal(false),
|
|
179
|
+
children: /* @__PURE__ */ jsxs(
|
|
180
|
+
"div",
|
|
181
|
+
{
|
|
182
|
+
className: "bg-card text-card-foreground border border-border p-6 rounded-lg max-w-md w-full",
|
|
183
|
+
onClick: (e) => e.stopPropagation(),
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-bold mb-4", children: "Share this image" }),
|
|
186
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-4 mb-4", children: [
|
|
187
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", onClick: () => openInNewTab(
|
|
188
|
+
`https://twitter.com/intent/tweet?url=${encodeURIComponent(src)}`
|
|
189
|
+
), children: "Twitter" }),
|
|
190
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", onClick: () => openInNewTab(
|
|
191
|
+
`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(src)}`
|
|
192
|
+
), children: "Facebook" }),
|
|
193
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", onClick: () => openInNewTab(
|
|
194
|
+
`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(src)}`
|
|
195
|
+
), children: "LinkedIn" })
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mt-4", children: [
|
|
198
|
+
/* @__PURE__ */ jsx(
|
|
199
|
+
"input",
|
|
200
|
+
{
|
|
201
|
+
type: "text",
|
|
202
|
+
value: src,
|
|
203
|
+
readOnly: true,
|
|
204
|
+
className: "flex-1 border border-border bg-background p-2 rounded mr-2"
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", onClick: handleCopyUrl, children: showCopySuccess ? "Copied!" : "Copy" })
|
|
208
|
+
] }),
|
|
209
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", onClick: () => setShowShareModal(false), className: "mt-4 w-full", children: "Close" })
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
showExpandedView && /* @__PURE__ */ jsxs(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
className: "fixed inset-0 z-[9999] bg-black/95 flex items-center justify-center",
|
|
219
|
+
onClick: handleCloseExpanded,
|
|
220
|
+
children: [
|
|
221
|
+
/* @__PURE__ */ jsx(
|
|
222
|
+
"img",
|
|
223
|
+
{
|
|
224
|
+
src: renderSrc,
|
|
225
|
+
referrerPolicy: remoteReferrer,
|
|
226
|
+
alt,
|
|
227
|
+
onClick: (e) => e.stopPropagation(),
|
|
228
|
+
onDoubleClick: handleCloseExpanded,
|
|
229
|
+
onError: handleImageError,
|
|
230
|
+
style: {
|
|
231
|
+
transform: `scale(${zoomLevel})`,
|
|
232
|
+
transformOrigin: "center center"
|
|
233
|
+
},
|
|
234
|
+
className: "h-[94dvh] w-[96vw] object-contain transition-transform duration-200 cursor-zoom-out"
|
|
235
|
+
},
|
|
236
|
+
retryKey
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", icon: /* @__PURE__ */ jsx(XIcon, {}), onClick: handleCloseExpanded, title: "Close (Esc)", className: "fixed top-3 left-1/2 z-[10000]", children: /* @__PURE__ */ jsx("span", { children: "Close" }) }),
|
|
239
|
+
/* @__PURE__ */ jsxs("div", { className: "fixed bottom-6 left-1/2 -translate-x-1/2 z-[10000] flex items-center gap-3 bg-black/70 backdrop-blur-sm px-5 py-2.5 rounded-full", children: [
|
|
240
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", icon: /* @__PURE__ */ jsx(ZoomOutIcon, {}), onClick: (e) => {
|
|
241
|
+
e.stopPropagation();
|
|
242
|
+
handleZoomOut();
|
|
243
|
+
}, title: "Zoom Out", "aria-label": "Zoom Out" }),
|
|
244
|
+
/* @__PURE__ */ jsxs("span", { className: "text-white text-sm font-medium min-w-[3rem] text-center", children: [
|
|
245
|
+
Math.round(zoomLevel * 100),
|
|
246
|
+
"%"
|
|
247
|
+
] }),
|
|
248
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", icon: /* @__PURE__ */ jsx(ZoomInIcon, {}), onClick: (e) => {
|
|
249
|
+
e.stopPropagation();
|
|
250
|
+
handleZoomIn();
|
|
251
|
+
}, title: "Zoom In", "aria-label": "Zoom In" }),
|
|
252
|
+
/* @__PURE__ */ jsx("div", { className: "w-px h-5 bg-white/20" }),
|
|
253
|
+
/* @__PURE__ */ jsx(Button, { variant: "quiet", icon: /* @__PURE__ */ jsx(XIcon, {}), onClick: handleCloseExpanded, title: "Close (Esc)", "aria-label": "Close (Esc)" })
|
|
254
|
+
] })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
showCopySuccess && /* @__PURE__ */ jsx("div", { className: "fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded shadow-lg", children: "Copied to clipboard!" })
|
|
259
|
+
] });
|
|
260
|
+
};
|
|
261
|
+
const ImageBlock = (props) => /* @__PURE__ */ jsx(RemoteImageGate, { src: props.src, alt: props.alt, block: true, children: /* @__PURE__ */ jsx(ImageBlockImpl, { ...props }) });
|
|
262
|
+
var ImageBlock_default = ImageBlock;
|
|
263
|
+
export {
|
|
264
|
+
ImageBlock_default as default
|
|
265
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CanonicalBlockIR } from "@ai-matrx/content-ir";
|
|
3
|
+
interface JsonBlockProps {
|
|
4
|
+
content: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
isStreamActive?: boolean;
|
|
7
|
+
allowEdit?: boolean;
|
|
8
|
+
customBuiltinKeys?: string[];
|
|
9
|
+
onCodeChange?: (newCode: string) => void;
|
|
10
|
+
/** When set with messageId, enables "Add to conversation context". */
|
|
11
|
+
conversationId?: string | null;
|
|
12
|
+
messageId?: string | null;
|
|
13
|
+
/** Hide the self-referential conversion action inside conversion previews. */
|
|
14
|
+
allowConvertToShape?: boolean;
|
|
15
|
+
/** Canonical promotion evidence for this JSON region, when one exists. */
|
|
16
|
+
irEnvelope?: CanonicalBlockIR | null;
|
|
17
|
+
/** The fence meta (title, highlighted lines) — see markdown-core/fence-meta.ts. */
|
|
18
|
+
meta?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* JSON-aware wrapper around CodeBlock. Default view is the standard code
|
|
22
|
+
* editor (zero regression); a small view-mode toggle in the header lets
|
|
23
|
+
* the user switch to Tree, Table (when tabular), or Path Explorer.
|
|
24
|
+
*
|
|
25
|
+
* JSON-specific extras (save-to-table, NDJSON/CSV/XLSX downloads) feed
|
|
26
|
+
* through CodeBlock's unified kebab menu via `extraMenuItems`. Non-code
|
|
27
|
+
* views render their own header using the same AdvancedMenu pattern.
|
|
28
|
+
*
|
|
29
|
+
* If JSON parsing fails or the content is mid-stream, falls back to a
|
|
30
|
+
* plain CodeBlock with no view toggle — the user keeps the original
|
|
31
|
+
* experience, just without the extras.
|
|
32
|
+
*/
|
|
33
|
+
export declare const JsonBlock: React.FC<JsonBlockProps>;
|
|
34
|
+
export default JsonBlock;
|