@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.
Files changed (382) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/code-block/CodeBlock.d.ts +44 -0
  3. package/dist/code-block/CodeBlock.js +449 -0
  4. package/dist/code-block/CodeBlockHeader.d.ts +63 -0
  5. package/dist/code-block/CodeBlockHeader.js +472 -0
  6. package/dist/code-block/CodeEditorLoading.d.ts +3 -0
  7. package/dist/code-block/CodeEditorLoading.js +34 -0
  8. package/dist/code-block/LanguageDisplay.d.ts +28 -0
  9. package/dist/code-block/LanguageDisplay.js +279 -0
  10. package/dist/code-block/SmallCodeEditor.d.ts +30 -0
  11. package/dist/code-block/SmallCodeEditor.js +22 -0
  12. package/dist/code-block/StickyButtons.d.ts +35 -0
  13. package/dist/code-block/StickyButtons.js +88 -0
  14. package/dist/code-block/highlight/ShikiCodeView.d.ts +26 -0
  15. package/dist/code-block/highlight/ShikiCodeView.js +134 -0
  16. package/dist/code-block/highlight/shiki-highlighter.d.ts +14 -0
  17. package/dist/code-block/highlight/shiki-highlighter.js +126 -0
  18. package/dist/code-block/highlight/useHighlightedLines.d.ts +18 -0
  19. package/dist/code-block/highlight/useHighlightedLines.js +142 -0
  20. package/dist/code-block/sticky-inset.d.ts +6 -0
  21. package/dist/code-block/sticky-inset.js +10 -0
  22. package/dist/display/block-interaction.d.ts +33 -0
  23. package/dist/display/block-interaction.js +13 -0
  24. package/dist/display/blocks/ChatCollapsibleWrapper.d.ts +13 -0
  25. package/dist/display/blocks/ChatCollapsibleWrapper.js +56 -0
  26. package/dist/display/blocks/buildMediaSource.d.ts +25 -0
  27. package/dist/display/blocks/buildMediaSource.js +43 -0
  28. package/dist/display/blocks/canvas-adaptive.d.ts +118 -0
  29. package/dist/display/blocks/canvas-adaptive.js +127 -0
  30. package/dist/display/blocks/canvas-fit.d.ts +24 -0
  31. package/dist/display/blocks/canvas-fit.js +19 -0
  32. package/dist/display/blocks/chart/ChartBlock.d.ts +8 -0
  33. package/dist/display/blocks/chart/ChartBlock.js +125 -0
  34. package/dist/display/blocks/chart/ChartCanvas.d.ts +18 -0
  35. package/dist/display/blocks/chart/ChartCanvas.js +159 -0
  36. package/dist/display/blocks/chart/TableChart.d.ts +25 -0
  37. package/dist/display/blocks/chart/TableChart.js +97 -0
  38. package/dist/display/blocks/chart/chart-spec.d.ts +39 -0
  39. package/dist/display/blocks/chart/chart-spec.js +128 -0
  40. package/dist/display/blocks/chart/labels.d.ts +20 -0
  41. package/dist/display/blocks/chart/labels.js +7 -0
  42. package/dist/display/blocks/chart/table-chart.d.ts +37 -0
  43. package/dist/display/blocks/chart/table-chart.js +231 -0
  44. package/dist/display/blocks/common/BlockHeaderWrapper.d.ts +56 -0
  45. package/dist/display/blocks/common/BlockHeaderWrapper.js +310 -0
  46. package/dist/display/blocks/common/ContentBlockWrapper.d.ts +40 -0
  47. package/dist/display/blocks/common/ContentBlockWrapper.js +214 -0
  48. package/dist/display/blocks/common/SandboxedHtml.d.ts +27 -0
  49. package/dist/display/blocks/common/SandboxedHtml.js +26 -0
  50. package/dist/display/blocks/csv/CsvBlock.js +5 -1
  51. package/dist/display/blocks/diagram/DiagramLoadingVisualization.d.ts +6 -0
  52. package/dist/display/blocks/diagram/DiagramLoadingVisualization.js +190 -0
  53. package/dist/display/blocks/diagram/InteractiveDiagramBlock.d.ts +51 -0
  54. package/dist/display/blocks/diagram/InteractiveDiagramBlock.js +2415 -0
  55. package/dist/display/blocks/diagram/diagram-printer.d.ts +16 -0
  56. package/dist/display/blocks/diagram/diagram-printer.js +294 -0
  57. package/dist/display/blocks/diagram/diagram-visual-defaults.d.ts +116 -0
  58. package/dist/display/blocks/diagram/diagram-visual-defaults.js +400 -0
  59. package/dist/display/blocks/diagram/layout-utils.d.ts +90 -0
  60. package/dist/display/blocks/diagram/layout-utils.js +347 -0
  61. package/dist/display/blocks/diagram/parseDiagramJSON.d.ts +105 -0
  62. package/dist/display/blocks/diagram/parseDiagramJSON.js +296 -0
  63. package/dist/display/blocks/diagram/presentation-direction.d.ts +29 -0
  64. package/dist/display/blocks/diagram/presentation-direction.js +19 -0
  65. package/dist/display/blocks/diagram/ui-utils.d.ts +1 -0
  66. package/dist/display/blocks/diagram/ui-utils.js +18 -0
  67. package/dist/display/blocks/diff/DiffBlock.d.ts +10 -0
  68. package/dist/display/blocks/diff/DiffBlock.js +119 -0
  69. package/dist/display/blocks/diff/DiffCanvas.d.ts +15 -0
  70. package/dist/display/blocks/diff/DiffCanvas.js +20 -0
  71. package/dist/display/blocks/generic/GenericStructuredBlock.d.ts +24 -0
  72. package/dist/display/blocks/generic/GenericStructuredBlock.js +53 -0
  73. package/dist/display/blocks/generic/StructuredValueTabs.d.ts +21 -0
  74. package/dist/display/blocks/generic/StructuredValueTabs.js +124 -0
  75. package/dist/display/blocks/generic/tile-actions-slot.d.ts +39 -0
  76. package/dist/display/blocks/generic/tile-actions-slot.js +33 -0
  77. package/dist/display/blocks/images/ImageBlock.d.ts +8 -0
  78. package/dist/display/blocks/images/ImageBlock.js +265 -0
  79. package/dist/display/blocks/json/JsonBlock.d.ts +34 -0
  80. package/dist/display/blocks/json/JsonBlock.js +562 -0
  81. package/dist/display/blocks/json/JsonTableView.d.ts +10 -0
  82. package/dist/display/blocks/json/JsonTableView.js +173 -0
  83. package/dist/display/blocks/json/json-compact-stringify.d.ts +25 -0
  84. package/dist/display/blocks/json/json-compact-stringify.js +52 -0
  85. package/dist/display/blocks/json/json-tabular-utils.d.ts +65 -0
  86. package/dist/display/blocks/json/json-tabular-utils.js +121 -0
  87. package/dist/display/blocks/links/LinkComponent.d.ts +6 -0
  88. package/dist/display/blocks/links/LinkComponent.js +373 -0
  89. package/dist/display/blocks/links/LinkComponentWithFetch.d.ts +1 -0
  90. package/dist/display/blocks/links/LinkComponentWithFetch.js +0 -0
  91. package/dist/display/blocks/markdown/MarkdownKindBlock.d.ts +48 -0
  92. package/dist/display/blocks/markdown/MarkdownKindBlock.js +52 -0
  93. package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.d.ts +17 -0
  94. package/dist/display/blocks/markdown-preview/MarkdownPreviewBlock.js +70 -0
  95. package/dist/display/blocks/mermaid/MermaidBlock.d.ts +19 -0
  96. package/dist/display/blocks/mermaid/MermaidBlock.js +386 -0
  97. package/dist/display/blocks/search-replace/SearchReplaceBlock.d.ts +50 -0
  98. package/dist/display/blocks/search-replace/SearchReplaceBlock.js +71 -0
  99. package/dist/display/blocks/svg/SvgBlock.d.ts +8 -0
  100. package/dist/display/blocks/svg/SvgBlock.js +126 -0
  101. package/dist/display/blocks/table/StreamingTableRenderer.d.ts +53 -0
  102. package/dist/display/blocks/table/StreamingTableRenderer.js +907 -0
  103. package/dist/display/blocks/table/TableRenderPathDiagnostic.d.ts +21 -0
  104. package/dist/display/blocks/table/TableRenderPathDiagnostic.js +79 -0
  105. package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.d.ts +14 -0
  106. package/dist/display/blocks/thinking-reasoning/ConsolidatedReasoningVisualization.js +15 -0
  107. package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.d.ts +13 -0
  108. package/dist/display/blocks/thinking-reasoning/ReasoningVisualization.js +19 -0
  109. package/dist/display/blocks/thinking-reasoning/ThinkingTrace.d.ts +30 -0
  110. package/dist/display/blocks/thinking-reasoning/ThinkingTrace.js +75 -0
  111. package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.d.ts +13 -0
  112. package/dist/display/blocks/thinking-reasoning/ThinkingTraceMarkdown.js +48 -0
  113. package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.d.ts +12 -0
  114. package/dist/display/blocks/thinking-reasoning/ThinkingVisualization.js +19 -0
  115. package/dist/display/blocks/toml/TomlBlock.d.ts +7 -0
  116. package/dist/display/blocks/toml/TomlBlock.js +167 -0
  117. package/dist/display/blocks/tree/TreeBlock.d.ts +7 -0
  118. package/dist/display/blocks/tree/TreeBlock.js +163 -0
  119. package/dist/display/blocks/xml/XmlBlock.d.ts +23 -0
  120. package/dist/display/blocks/xml/XmlBlock.js +197 -0
  121. package/dist/display/blocks/xml/readXmlTag.d.ts +1 -0
  122. package/dist/display/blocks/xml/readXmlTag.js +1 -0
  123. package/dist/display/blocks/xml/xml-tokenize.d.ts +13 -0
  124. package/dist/display/blocks/xml/xml-tokenize.js +169 -0
  125. package/dist/display/blocks/yaml/YamlBlock.d.ts +7 -0
  126. package/dist/display/blocks/yaml/YamlBlock.js +191 -0
  127. package/dist/display/chat-markdown/BasicMarkdownContent.d.ts +29 -0
  128. package/dist/display/chat-markdown/BasicMarkdownContent.js +122 -0
  129. package/dist/display/chat-markdown/BlockRenderingContext.d.ts +23 -0
  130. package/dist/display/chat-markdown/BlockRenderingContext.js +17 -0
  131. package/dist/display/chat-markdown/ConfigurableMarkdownContent.d.ts +172 -0
  132. package/dist/display/chat-markdown/ConfigurableMarkdownContent.js +649 -0
  133. package/dist/display/chat-markdown/InlineCodeSnippet.d.ts +19 -0
  134. package/dist/display/chat-markdown/InlineCodeSnippet.js +146 -0
  135. package/dist/display/chat-markdown/InlineCodeSnippetKindGate.d.ts +11 -0
  136. package/dist/display/chat-markdown/InlineCodeSnippetKindGate.js +9 -0
  137. package/dist/display/chat-markdown/KindTextGate.d.ts +31 -0
  138. package/dist/display/chat-markdown/KindTextGate.js +60 -0
  139. package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.d.ts +6 -0
  140. package/dist/display/chat-markdown/QuestionnaireLoadingVisualization.js +92 -0
  141. package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.d.ts +72 -0
  142. package/dist/display/chat-markdown/block-registry/BlockComponentRegistry.js +94 -0
  143. package/dist/display/chat-markdown/block-registry/BlockRenderer.d.ts +126 -0
  144. package/dist/display/chat-markdown/block-registry/BlockRenderer.js +473 -0
  145. package/dist/display/chat-markdown/block-registry/block-dispatch.d.ts +410 -0
  146. package/dist/display/chat-markdown/block-registry/block-dispatch.js +495 -0
  147. package/dist/display/chat-markdown/block-registry/json-parse-utils.d.ts +13 -0
  148. package/dist/display/chat-markdown/block-registry/json-parse-utils.js +236 -0
  149. package/dist/display/chat-markdown/constants.d.ts +14 -0
  150. package/dist/display/chat-markdown/constants.js +317 -0
  151. package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.d.ts +31 -0
  152. package/dist/display/chat-markdown/diff-blocks/DiffCollapsible.js +62 -0
  153. package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.d.ts +12 -0
  154. package/dist/display/chat-markdown/diff-blocks/DiffLoadingIndicator.js +18 -0
  155. package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.d.ts +22 -0
  156. package/dist/display/chat-markdown/diff-blocks/StreamingDiffBlock.js +130 -0
  157. package/dist/display/chat-markdown/diff-blocks/diff-style-registry.d.ts +21 -0
  158. package/dist/display/chat-markdown/diff-blocks/diff-style-registry.js +91 -0
  159. package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.d.ts +26 -0
  160. package/dist/display/chat-markdown/diff-blocks/renderers/SearchReplaceDiffRenderer.js +186 -0
  161. package/dist/display/chat-markdown/diff-blocks/types.d.ts +56 -0
  162. package/dist/display/chat-markdown/diff-blocks/types.js +0 -0
  163. package/dist/display/chat-markdown/internal-handlers/BlockFallback.d.ts +20 -0
  164. package/dist/display/chat-markdown/internal-handlers/BlockFallback.js +83 -0
  165. package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.d.ts +4 -0
  166. package/dist/display/chat-markdown/internal-handlers/InlineStatusIndicator.js +16 -0
  167. package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.d.ts +17 -0
  168. package/dist/display/chat-markdown/internal-handlers/MarkdownErrorBoundary.js +40 -0
  169. package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.d.ts +8 -0
  170. package/dist/display/chat-markdown/internal-handlers/PlainTextFallback.js +91 -0
  171. package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.d.ts +20 -0
  172. package/dist/display/chat-markdown/internal-handlers/SafeBlockRenderer.js +72 -0
  173. package/dist/display/chat-markdown/kind-source-view.d.ts +14 -0
  174. package/dist/display/chat-markdown/kind-source-view.js +14 -0
  175. package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.d.ts +28 -0
  176. package/dist/display/chat-markdown/matrx-variables/MatrxVariableInline.js +65 -0
  177. package/dist/display/chat-markdown/progressive-mount.d.ts +18 -0
  178. package/dist/display/chat-markdown/progressive-mount.js +90 -0
  179. package/dist/display/chat-markdown/render-block-to-content-block.d.ts +31 -0
  180. package/dist/display/chat-markdown/render-block-to-content-block.js +32 -0
  181. package/dist/display/chat-markdown/settle-stream-blocks.d.ts +50 -0
  182. package/dist/display/chat-markdown/settle-stream-blocks.js +26 -0
  183. package/dist/display/chat-markdown/stable-blocks.d.ts +15 -0
  184. package/dist/display/chat-markdown/stable-blocks.js +54 -0
  185. package/dist/display/chat-markdown/types.d.ts +11 -0
  186. package/dist/display/chat-markdown/types.js +26 -0
  187. package/dist/display/specimen/SpecimenContext.d.ts +26 -0
  188. package/dist/display/specimen/SpecimenContext.js +64 -0
  189. package/dist/display/tables/MarkdownTable.d.ts +23 -0
  190. package/dist/display/tables/MarkdownTable.js +769 -0
  191. package/dist/display/tables/MarkdownTableScrollArea.d.ts +12 -0
  192. package/dist/display/tables/MarkdownTableScrollArea.js +92 -0
  193. package/dist/display/tables/SendToGoogleSheetButton.d.ts +19 -0
  194. package/dist/display/tables/SendToGoogleSheetButton.js +93 -0
  195. package/dist/display/tables/SendToWorkbookButton.d.ts +24 -0
  196. package/dist/display/tables/SendToWorkbookButton.js +93 -0
  197. package/dist/display/tables/TableSaveToMenu.d.ts +16 -0
  198. package/dist/display/tables/TableSaveToMenu.js +98 -0
  199. package/dist/display/tables/TableWithSeparatedControls.d.ts +22 -0
  200. package/dist/display/tables/TableWithSeparatedControls.js +574 -0
  201. package/dist/display/tables/ViewTableModal.d.ts +14 -0
  202. package/dist/display/tables/ViewTableModal.js +67 -0
  203. package/dist/display/tables/editing/ColumnActionsMenu.d.ts +16 -0
  204. package/dist/display/tables/editing/ColumnActionsMenu.js +80 -0
  205. package/dist/display/tables/editing/RowActionsMenu.d.ts +16 -0
  206. package/dist/display/tables/editing/RowActionsMenu.js +80 -0
  207. package/dist/display/tables/editing/TableEditToolbar.d.ts +15 -0
  208. package/dist/display/tables/editing/TableEditToolbar.js +63 -0
  209. package/dist/display/tables/editing/tableMutations.d.ts +50 -0
  210. package/dist/display/tables/editing/tableMutations.js +148 -0
  211. package/dist/display/tables/editing/useDoubleClickEdit.d.ts +43 -0
  212. package/dist/display/tables/editing/useDoubleClickEdit.js +51 -0
  213. package/dist/display/tables/editing/useTableUndo.d.ts +25 -0
  214. package/dist/display/tables/editing/useTableUndo.js +17 -0
  215. package/dist/display/tables/table-action-row.d.ts +8 -0
  216. package/dist/display/tables/table-action-row.js +31 -0
  217. package/dist/display/tables/table-viewer.d.ts +13 -0
  218. package/dist/display/tables/table-viewer.js +18 -0
  219. package/dist/host/ErrorActions.d.ts +1 -1
  220. package/dist/host/ErrorNotice.d.ts +10 -0
  221. package/dist/host/ErrorNotice.js +19 -0
  222. package/dist/host/app-bindings.d.ts +155 -0
  223. package/dist/host/app-bindings.js +160 -0
  224. package/dist/host/diagnostics.d.ts +2 -2
  225. package/dist/host/diagnostics.js +2 -1
  226. package/dist/host/tables.d.ts +1 -6
  227. package/dist/host/types.d.ts +14 -7
  228. package/dist/levels/RichContent.d.ts +3 -0
  229. package/dist/levels/RichContent.js +102 -0
  230. package/dist/levels/RichContentInline.d.ts +28 -0
  231. package/dist/levels/RichContentInline.js +61 -0
  232. package/dist/levels/RichContentPreview.d.ts +12 -0
  233. package/dist/levels/RichContentPreview.js +39 -0
  234. package/dist/levels/RichContentStandardImpl.d.ts +12 -0
  235. package/dist/levels/RichContentStandardImpl.js +27 -0
  236. package/dist/levels/RichContentStaticProse.d.ts +46 -0
  237. package/dist/levels/RichContentStaticProse.js +100 -0
  238. package/dist/levels/depth.d.ts +18 -0
  239. package/dist/levels/depth.js +32 -0
  240. package/dist/levels/prose/inline-level-elements.d.ts +19 -0
  241. package/dist/levels/prose/inline-level-elements.js +103 -0
  242. package/dist/levels/prose/prose-block-elements.d.ts +25 -0
  243. package/dist/levels/prose/prose-block-elements.js +313 -0
  244. package/dist/levels/prose/prose-inline-elements.d.ts +13 -0
  245. package/dist/levels/prose/prose-inline-elements.js +143 -0
  246. package/dist/levels/prose/prose-prepare.d.ts +50 -0
  247. package/dist/levels/prose/prose-prepare.js +246 -0
  248. package/dist/levels/prose/remote-image-policy.d.ts +34 -0
  249. package/dist/levels/prose/remote-image-policy.js +153 -0
  250. package/dist/levels/prose/variant-root.d.ts +9 -0
  251. package/dist/levels/prose/variant-root.js +34 -0
  252. package/dist/levels/rich-content-types.d.ts +93 -0
  253. package/dist/levels/rich-content-types.js +4 -0
  254. package/dist/levels/server/DelimiterViolationReport.d.ts +7 -0
  255. package/dist/levels/server/DelimiterViolationReport.js +24 -0
  256. package/dist/levels/server/RichContentServer.d.ts +27 -0
  257. package/dist/levels/server/RichContentServer.js +97 -0
  258. package/dist/levels/standard/NestedRichContent.d.ts +7 -0
  259. package/dist/levels/standard/NestedRichContent.js +70 -0
  260. package/dist/levels/standard/StandardBlocks.d.ts +13 -0
  261. package/dist/levels/standard/StandardBlocks.js +239 -0
  262. package/dist/levels/standard/StandardKindRegion.d.ts +14 -0
  263. package/dist/levels/standard/StandardKindRegion.js +69 -0
  264. package/dist/levels/standard/standard-kind-region.d.ts +19 -0
  265. package/dist/levels/standard/standard-kind-region.js +21 -0
  266. package/dist/levels/standard/static-standard.d.ts +23 -0
  267. package/dist/levels/standard/static-standard.js +187 -0
  268. package/dist/levels/standard/stream-holdback.d.ts +2 -0
  269. package/dist/levels/standard/stream-holdback.js +77 -0
  270. package/dist/mermaid/MermaidFullscreen.d.ts +17 -0
  271. package/dist/mermaid/MermaidFullscreen.js +71 -0
  272. package/dist/mermaid/MermaidRenderer.d.ts +20 -0
  273. package/dist/mermaid/MermaidRenderer.js +267 -0
  274. package/dist/mermaid/MermaidView.d.ts +27 -0
  275. package/dist/mermaid/MermaidView.js +68 -0
  276. package/dist/mermaid/MermaidViewport.d.ts +75 -0
  277. package/dist/mermaid/MermaidViewport.js +286 -0
  278. package/dist/mermaid/adapters/er.d.ts +10 -0
  279. package/dist/mermaid/adapters/er.js +205 -0
  280. package/dist/mermaid/adapters/flowchart.d.ts +17 -0
  281. package/dist/mermaid/adapters/flowchart.js +634 -0
  282. package/dist/mermaid/adapters/journey.d.ts +9 -0
  283. package/dist/mermaid/adapters/journey.js +207 -0
  284. package/dist/mermaid/adapters/mindmap.d.ts +12 -0
  285. package/dist/mermaid/adapters/mindmap.js +252 -0
  286. package/dist/mermaid/adapters/pie.d.ts +7 -0
  287. package/dist/mermaid/adapters/pie.js +172 -0
  288. package/dist/mermaid/adapters/quadrant.d.ts +8 -0
  289. package/dist/mermaid/adapters/quadrant.js +231 -0
  290. package/dist/mermaid/adapters/register.d.ts +7 -0
  291. package/dist/mermaid/adapters/register.js +19 -0
  292. package/dist/mermaid/adapters/sequence.d.ts +8 -0
  293. package/dist/mermaid/adapters/sequence.js +251 -0
  294. package/dist/mermaid/adapters/state.d.ts +12 -0
  295. package/dist/mermaid/adapters/state.js +245 -0
  296. package/dist/mermaid/adapters/timeline.d.ts +8 -0
  297. package/dist/mermaid/adapters/timeline.js +245 -0
  298. package/dist/mermaid/catalog.d.ts +33 -0
  299. package/dist/mermaid/catalog.js +202 -0
  300. package/dist/mermaid/diagram-type.d.ts +39 -0
  301. package/dist/mermaid/diagram-type.js +89 -0
  302. package/dist/mermaid/export.d.ts +21 -0
  303. package/dist/mermaid/export.js +112 -0
  304. package/dist/mermaid/extract-fence.d.ts +15 -0
  305. package/dist/mermaid/extract-fence.js +22 -0
  306. package/dist/mermaid/lazy-draw.d.ts +40 -0
  307. package/dist/mermaid/lazy-draw.js +168 -0
  308. package/dist/mermaid/model/adapter.d.ts +28 -0
  309. package/dist/mermaid/model/adapter.js +16 -0
  310. package/dist/mermaid/model/ops.d.ts +282 -0
  311. package/dist/mermaid/model/ops.js +9 -0
  312. package/dist/mermaid/model/round-trip.d.ts +22 -0
  313. package/dist/mermaid/model/round-trip.js +45 -0
  314. package/dist/mermaid/model/types.d.ts +271 -0
  315. package/dist/mermaid/model/types.js +0 -0
  316. package/dist/mermaid/print-render.d.ts +9 -0
  317. package/dist/mermaid/print-render.js +39 -0
  318. package/dist/mermaid/runtime.d.ts +25 -0
  319. package/dist/mermaid/runtime.js +183 -0
  320. package/dist/mermaid/sanitize.d.ts +46 -0
  321. package/dist/mermaid/sanitize.js +234 -0
  322. package/dist/mermaid/types.d.ts +43 -0
  323. package/dist/mermaid/types.js +21 -0
  324. package/dist/mermaid/view/ViewModePane.d.ts +24 -0
  325. package/dist/mermaid/view/ViewModePane.js +9 -0
  326. package/dist/utils/client-lazy.d.ts +1 -1
  327. package/dist/utils/client-lazy.js +4 -1
  328. package/dist/utils/lifted/DiffView.d.ts +10 -0
  329. package/dist/utils/lifted/DiffView.js +26 -0
  330. package/dist/utils/lifted/IconButton.d.ts +24 -0
  331. package/dist/utils/lifted/IconButton.js +43 -0
  332. package/dist/utils/lifted/MatrxMiniLoader.d.ts +1 -0
  333. package/dist/utils/lifted/MatrxMiniLoader.js +8 -0
  334. package/dist/utils/lifted/ShimmerText.d.ts +5 -0
  335. package/dist/utils/lifted/ShimmerText.js +21 -0
  336. package/dist/utils/lifted/SuspenseLoader.d.ts +16 -0
  337. package/dist/utils/lifted/SuspenseLoader.js +42 -0
  338. package/dist/utils/lifted/Tooltip.d.ts +20 -0
  339. package/dist/utils/lifted/Tooltip.js +52 -0
  340. package/dist/utils/lifted/artifactId.d.ts +34 -0
  341. package/dist/utils/lifted/artifactId.js +15 -0
  342. package/dist/utils/lifted/canvasContent.d.ts +63 -0
  343. package/dist/utils/lifted/canvasContent.js +98 -0
  344. package/dist/utils/lifted/captureReactError.d.ts +24 -0
  345. package/dist/utils/lifted/captureReactError.js +28 -0
  346. package/dist/utils/lifted/chunk-load-recovery.d.ts +25 -0
  347. package/dist/utils/lifted/chunk-load-recovery.js +36 -0
  348. package/dist/utils/lifted/code-editor-agent-types.d.ts +6 -0
  349. package/dist/utils/lifted/code-editor-agent-types.js +0 -0
  350. package/dist/utils/lifted/code-editor-agents.d.ts +39 -0
  351. package/dist/utils/lifted/code-editor-agents.js +52 -0
  352. package/dist/utils/lifted/code-language-extension.d.ts +1 -0
  353. package/dist/utils/lifted/code-language-extension.js +60 -0
  354. package/dist/utils/lifted/custom-icons.d.ts +16 -0
  355. package/dist/utils/lifted/custom-icons.js +47 -0
  356. package/dist/utils/lifted/durability.d.ts +16 -0
  357. package/dist/utils/lifted/durability.js +45 -0
  358. package/dist/utils/lifted/errors.d.ts +30 -0
  359. package/dist/utils/lifted/errors.js +29 -0
  360. package/dist/utils/lifted/html-document.d.ts +1 -0
  361. package/dist/utils/lifted/html-document.js +12 -0
  362. package/dist/utils/lifted/languageOptions.d.ts +9 -0
  363. package/dist/utils/lifted/languageOptions.js +52 -0
  364. package/dist/utils/lifted/languages.d.ts +34 -0
  365. package/dist/utils/lifted/languages.js +175 -0
  366. package/dist/utils/lifted/loading-spinner.d.ts +18 -0
  367. package/dist/utils/lifted/loading-spinner.js +200 -0
  368. package/dist/utils/lifted/media-refs.d.ts +13 -0
  369. package/dist/utils/lifted/media-refs.js +27 -0
  370. package/dist/utils/lifted/scroll-root.d.ts +1 -0
  371. package/dist/utils/lifted/scroll-root.js +25 -0
  372. package/dist/utils/lifted/syntax-themes.d.ts +32 -0
  373. package/dist/utils/lifted/syntax-themes.js +100 -0
  374. package/dist/utils/lifted/url-utm.d.ts +24 -0
  375. package/dist/utils/lifted/url-utm.js +66 -0
  376. package/dist/utils/lifted/use-is-mounted.d.ts +24 -0
  377. package/dist/utils/lifted/use-is-mounted.js +21 -0
  378. package/dist/utils/lifted/useToastManager.d.ts +1 -0
  379. package/dist/utils/lifted/useToastManager.js +7 -0
  380. package/dist/utils/report-kind-at-raw-renderer.d.ts +19 -0
  381. package/dist/utils/report-kind-at-raw-renderer.js +32 -0
  382. package/package.json +32 -3
@@ -0,0 +1,21 @@
1
+ export interface TableRenderDiagnosticContext {
2
+ /** Block type that routed here (usually "text"). */
3
+ blockType: string;
4
+ /** Where in the pipeline this markdown table was rendered. */
5
+ renderPath: "BasicMarkdownContent";
6
+ conversationId?: string;
7
+ messageId?: string;
8
+ requestId?: string;
9
+ surfaceKey?: string;
10
+ /** First ~120 chars of the hosting block for identification. */
11
+ contentPreview?: string;
12
+ }
13
+ interface TableRenderPathDiagnosticProps {
14
+ context: TableRenderDiagnosticContext;
15
+ }
16
+ /**
17
+ * Admin-only warning shown under tables that rendered through the markdown
18
+ * fallback (react-markdown GFM) instead of StreamingTableRenderer / TableArtifact.
19
+ */
20
+ export declare function TableRenderPathDiagnostic({ context, }: TableRenderPathDiagnosticProps): import("react").JSX.Element | null;
21
+ export {};
@@ -0,0 +1,79 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { AlertTriangle } from "lucide-react";
4
+ import { EntityRef } from "../../../host/app-bindings.js";
5
+ import { useIsAdminDebugger } from "../../../host/app-bindings.js";
6
+ function TableRenderPathDiagnostic({
7
+ context
8
+ }) {
9
+ const isAdmin = Boolean(useIsAdminDebugger());
10
+ if (!isAdmin) return null;
11
+ return /* @__PURE__ */ jsxs("div", { className: "my-2 rounded-md border border-amber-500/60 bg-amber-50/90 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100", children: [
12
+ /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center gap-1.5 font-semibold", children: [
13
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "h-3.5 w-3.5 shrink-0" }),
14
+ "Table render path diagnostic (admin)"
15
+ ] }),
16
+ /* @__PURE__ */ jsxs("p", { className: "mb-2 leading-relaxed opacity-90", children: [
17
+ "This table was rendered by",
18
+ " ",
19
+ /* @__PURE__ */ jsx("code", { className: "rounded bg-amber-200/60 px-1 dark:bg-amber-900/60", children: context.renderPath }),
20
+ " ",
21
+ "(plain GFM HTML), not",
22
+ " ",
23
+ /* @__PURE__ */ jsx("code", { className: "rounded bg-amber-200/60 px-1 dark:bg-amber-900/60", children: "StreamingTableRenderer" }),
24
+ ". The block splitter did not promote it to",
25
+ " ",
26
+ /* @__PURE__ */ jsx("code", { className: "rounded bg-amber-200/60 px-1 dark:bg-amber-900/60", children: 'type: "table"' }),
27
+ " ",
28
+ "before render."
29
+ ] }),
30
+ /* @__PURE__ */ jsxs("dl", { className: "grid gap-1 font-mono text-[11px] leading-relaxed opacity-80", children: [
31
+ /* @__PURE__ */ jsxs("div", { children: [
32
+ /* @__PURE__ */ jsx("dt", { className: "inline font-semibold", children: "host block type: " }),
33
+ /* @__PURE__ */ jsx("dd", { className: "inline", children: context.blockType })
34
+ ] }),
35
+ context.surfaceKey ? /* @__PURE__ */ jsxs("div", { children: [
36
+ /* @__PURE__ */ jsx("dt", { className: "inline font-semibold", children: "surfaceKey: " }),
37
+ /* @__PURE__ */ jsx("dd", { className: "inline break-all", children: context.surfaceKey })
38
+ ] }) : null,
39
+ context.conversationId ? /* @__PURE__ */ jsxs("div", { children: [
40
+ /* @__PURE__ */ jsx("dt", { className: "inline font-semibold", children: "conversationId: " }),
41
+ /* @__PURE__ */ jsx("dd", { className: "inline", children: /* @__PURE__ */ jsx(
42
+ EntityRef,
43
+ {
44
+ token: "conversation",
45
+ id: context.conversationId,
46
+ name: context.conversationId,
47
+ showIcon: false,
48
+ openInNewTab: true,
49
+ wrap: true,
50
+ className: "inline-flex"
51
+ }
52
+ ) })
53
+ ] }) : null,
54
+ context.messageId ? /* @__PURE__ */ jsxs("div", { children: [
55
+ /* @__PURE__ */ jsx("dt", { className: "inline font-semibold", children: "messageId: " }),
56
+ /* @__PURE__ */ jsx("dd", { className: "inline break-all", children: context.messageId })
57
+ ] }) : null,
58
+ context.requestId ? /* @__PURE__ */ jsxs("div", { children: [
59
+ /* @__PURE__ */ jsx("dt", { className: "inline font-semibold", children: "requestId: " }),
60
+ /* @__PURE__ */ jsx("dd", { className: "inline break-all", children: context.requestId })
61
+ ] }) : null,
62
+ context.contentPreview ? /* @__PURE__ */ jsxs("div", { children: [
63
+ /* @__PURE__ */ jsx("dt", { className: "inline font-semibold", children: "block preview: " }),
64
+ /* @__PURE__ */ jsx("dd", { className: "inline break-all", children: context.contentPreview })
65
+ ] }) : null
66
+ ] }),
67
+ /* @__PURE__ */ jsxs("p", { className: "mt-2 leading-relaxed opacity-75", children: [
68
+ "Likely causes: Redux client ",
69
+ /* @__PURE__ */ jsx("code", { children: "text" }),
70
+ " block skipped re-split (processedBlocks path), DB text fragment without header+separator in the same part, or malformed table markdown (rows must start with",
71
+ " ",
72
+ /* @__PURE__ */ jsx("code", { children: "|" }),
73
+ ")."
74
+ ] })
75
+ ] });
76
+ }
77
+ export {
78
+ TableRenderPathDiagnostic
79
+ };
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ /**
3
+ * Adapter — multi-step reasoning collapses into the single unified
4
+ * {@link ThinkingTrace}. The steps are joined into one trace; expanding shows
5
+ * them in order.
6
+ */
7
+ interface ConsolidatedReasoningVisualizationProps {
8
+ /** Raw reasoning text blocks (the content from each `<reasoning>` block). */
9
+ reasoningTexts: string[];
10
+ showReasoning?: boolean;
11
+ isStreaming?: boolean;
12
+ }
13
+ declare const ConsolidatedReasoningVisualization: React.FC<ConsolidatedReasoningVisualizationProps>;
14
+ export default ConsolidatedReasoningVisualization;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import ThinkingTrace from "./ThinkingTrace.js";
4
+ const ConsolidatedReasoningVisualization = ({ reasoningTexts, showReasoning = true, isStreaming = false }) => /* @__PURE__ */ jsx(
5
+ ThinkingTrace,
6
+ {
7
+ texts: reasoningTexts,
8
+ showThinking: showReasoning,
9
+ isStreaming
10
+ }
11
+ );
12
+ var ConsolidatedReasoningVisualization_default = ConsolidatedReasoningVisualization;
13
+ export {
14
+ ConsolidatedReasoningVisualization_default as default
15
+ };
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ /**
3
+ * Adapter — the canonical renderer is the unified, text-based
4
+ * {@link ThinkingTrace}. Kept so every caller (BlockRenderer's `thinking` /
5
+ * `reasoning` cases, the legacy chat stream display, demos) renders identically.
6
+ */
7
+ interface ReasoningVisualizationProps {
8
+ reasoningText: string;
9
+ showReasoning?: boolean;
10
+ isStreaming?: boolean;
11
+ }
12
+ declare const ReasoningVisualization: React.FC<ReasoningVisualizationProps>;
13
+ export default ReasoningVisualization;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import ThinkingTrace from "./ThinkingTrace.js";
4
+ const ReasoningVisualization = ({
5
+ reasoningText,
6
+ showReasoning = true,
7
+ isStreaming = false
8
+ }) => /* @__PURE__ */ jsx(
9
+ ThinkingTrace,
10
+ {
11
+ text: reasoningText,
12
+ showThinking: showReasoning,
13
+ isStreaming
14
+ }
15
+ );
16
+ var ReasoningVisualization_default = ReasoningVisualization;
17
+ export {
18
+ ReasoningVisualization_default as default
19
+ };
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ export interface ThinkingTraceProps {
3
+ /** A single thinking/reasoning text block. */
4
+ text?: string;
5
+ /** Multiple reasoning steps (consolidated) — joined into one trace. */
6
+ texts?: string[];
7
+ /** Hide entirely (per-surface `hideReasoning`). */
8
+ showThinking?: boolean;
9
+ /** True while tokens are still arriving — shows the thought "coming in". */
10
+ isStreaming?: boolean;
11
+ }
12
+ /**
13
+ * ThinkingTrace — the single, unified renderer for model thinking / reasoning.
14
+ *
15
+ * One primitive for EVERY source: live stream, static markdown, and DB-loaded
16
+ * turns all render through this. There is no per-source variant.
17
+ *
18
+ * It reads like a line of the transcript, not a component:
19
+ * - collapsed by default — a quiet, muted affordance. No box, no border fill,
20
+ * no gradient, no background. It takes up about one line.
21
+ * - while streaming — the latest line of thought streams in on that one line,
22
+ * so you can watch it think without it being in your face.
23
+ * - click to expand — the full reasoning text, lightly indented.
24
+ *
25
+ * The legacy boxes (`ThinkingVisualization`, `ReasoningVisualization`,
26
+ * `ConsolidatedReasoningVisualization`) are now thin adapters over this, so
27
+ * the look is identical everywhere it appears.
28
+ */
29
+ declare const ThinkingTrace: React.FC<ThinkingTraceProps>;
30
+ export default ThinkingTrace;
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { ChevronRight } from "lucide-react";
5
+ import { cn } from "@ai-matrx/design-system";
6
+ import { ShimmerText } from "../../../utils/lifted/ShimmerText.js";
7
+ import { ThinkingTraceMarkdown } from "./ThinkingTraceMarkdown.js";
8
+ const ThinkingTrace = ({
9
+ text,
10
+ texts,
11
+ showThinking = true,
12
+ isStreaming = false
13
+ }) => {
14
+ const [expanded, setExpanded] = useState(false);
15
+ const bodyRef = useRef(null);
16
+ const stripReasoningTags = (s) => s.replace(/<\/?(?:thinking|think|reasoning|reason)>/gi, "");
17
+ const fullText = stripReasoningTags(
18
+ texts && texts.length > 0 ? texts.filter((t) => t?.trim()).join("\n\n") : text ?? ""
19
+ ).trim();
20
+ useEffect(() => {
21
+ if (expanded && isStreaming && bodyRef.current) {
22
+ bodyRef.current.scrollTop = bodyRef.current.scrollHeight;
23
+ }
24
+ }, [fullText, expanded, isStreaming]);
25
+ if (!showThinking || !fullText) return null;
26
+ const tail = fullText.split("\n").filter((l) => l.trim()).pop() ?? "";
27
+ const collapsedLabel = isStreaming ? tail || "Thinking\u2026" : "Thought process";
28
+ return /* @__PURE__ */ jsxs("div", { className: "my-1.5 text-xs", children: [
29
+ /* @__PURE__ */ jsxs(
30
+ "button",
31
+ {
32
+ type: "button",
33
+ onClick: () => setExpanded((v) => !v),
34
+ "aria-expanded": expanded,
35
+ className: "flex w-full items-center gap-1.5 text-left text-muted-foreground transition-colors hover:text-foreground",
36
+ children: [
37
+ /* @__PURE__ */ jsx(
38
+ ChevronRight,
39
+ {
40
+ className: cn(
41
+ "h-3 w-3 shrink-0 transition-transform",
42
+ expanded && "rotate-90"
43
+ )
44
+ }
45
+ ),
46
+ isStreaming && !expanded && /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-muted-foreground/50" }),
47
+ isStreaming && !expanded ? tail ? /* @__PURE__ */ jsx(
48
+ ThinkingTraceMarkdown,
49
+ {
50
+ content: tail,
51
+ variant: "inline",
52
+ className: "min-w-0 flex-1 text-xs"
53
+ }
54
+ ) : (
55
+ // Gradient sweep when tokens haven't arrived yet — same shimmer as
56
+ // "Processing…" / "Planning…".
57
+ /* @__PURE__ */ jsx(ShimmerText, { text: "Thinking\u2026", className: "truncate text-xs" })
58
+ ) : /* @__PURE__ */ jsx("span", { className: "truncate", children: expanded ? "Thought process" : collapsedLabel })
59
+ ]
60
+ }
61
+ ),
62
+ expanded && /* @__PURE__ */ jsx(
63
+ "div",
64
+ {
65
+ ref: bodyRef,
66
+ className: "mt-1 ml-1 max-h-[400px] overflow-y-auto border-l border-border/60 pl-3 leading-relaxed",
67
+ children: /* @__PURE__ */ jsx(ThinkingTraceMarkdown, { content: fullText, variant: "body" })
68
+ }
69
+ )
70
+ ] });
71
+ };
72
+ var ThinkingTrace_default = ThinkingTrace;
73
+ export {
74
+ ThinkingTrace_default as default
75
+ };
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ type ThinkingTraceMarkdownVariant = "inline" | "body";
3
+ interface ThinkingTraceMarkdownProps {
4
+ content: string;
5
+ variant?: ThinkingTraceMarkdownVariant;
6
+ className?: string;
7
+ }
8
+ /**
9
+ * Compact markdown renderer for thinking / reasoning traces.
10
+ * `inline` keeps the collapsed one-line tail readable; `body` is for expand.
11
+ */
12
+ export declare function ThinkingTraceMarkdown({ content, variant, className, }: ThinkingTraceMarkdownProps): React.JSX.Element | null;
13
+ export {};
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import MarkdownCore from "../../../markdown-core/MarkdownCore.js";
4
+ import { cn } from "@ai-matrx/design-system";
5
+ import { NestedRichContent } from "../../../levels/standard/NestedRichContent.js";
6
+ const inlineComponents = {
7
+ p: ({ children }) => /* @__PURE__ */ jsx("span", { className: "inline", children }),
8
+ strong: ({ children }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold text-foreground/85", children }),
9
+ em: ({ children }) => /* @__PURE__ */ jsx("em", { className: "italic", children }),
10
+ ul: ({ children }) => /* @__PURE__ */ jsx("span", { className: "inline", children }),
11
+ ol: ({ children }) => /* @__PURE__ */ jsx("span", { className: "inline", children }),
12
+ li: ({ children }) => /* @__PURE__ */ jsx("span", { className: "inline [&:not(:last-child)]:mr-1", children }),
13
+ blockquote: ({ children }) => /* @__PURE__ */ jsx("span", { className: "inline", children }),
14
+ code: ({ children }) => /* @__PURE__ */ jsx("code", { className: "rounded bg-muted/60 px-0.5 font-mono text-[0.9em]", children }),
15
+ a: ({ children, href }) => /* @__PURE__ */ jsx(
16
+ "a",
17
+ {
18
+ href,
19
+ className: "text-primary underline underline-offset-2",
20
+ target: "_blank",
21
+ rel: "noopener noreferrer",
22
+ children
23
+ }
24
+ )
25
+ };
26
+ function ThinkingTraceMarkdown({
27
+ content,
28
+ variant = "body",
29
+ className
30
+ }) {
31
+ if (!content.trim()) return null;
32
+ if (variant === "body") {
33
+ return /* @__PURE__ */ jsx("div", { className: cn("min-w-0 text-muted-foreground", className), children: /* @__PURE__ */ jsx(NestedRichContent, { source: content }) });
34
+ }
35
+ return /* @__PURE__ */ jsx(
36
+ "div",
37
+ {
38
+ className: cn(
39
+ "min-w-0 text-muted-foreground truncate [&_*]:inline",
40
+ className
41
+ ),
42
+ children: /* @__PURE__ */ jsx(MarkdownCore, { preset: "gfm-breaks", components: inlineComponents, children: content })
43
+ }
44
+ );
45
+ }
46
+ export {
47
+ ThinkingTraceMarkdown
48
+ };
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ /**
3
+ * Adapter — preserved for existing callers (legacy chat stream display, demos).
4
+ * The real rendering is the unified, text-based {@link ThinkingTrace}.
5
+ */
6
+ interface ThinkingVisualizationProps {
7
+ thinkingText?: string;
8
+ showThinking?: boolean;
9
+ isStreaming?: boolean;
10
+ }
11
+ declare const ThinkingVisualization: React.FC<ThinkingVisualizationProps>;
12
+ export default ThinkingVisualization;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import ThinkingTrace from "./ThinkingTrace.js";
4
+ const ThinkingVisualization = ({
5
+ thinkingText,
6
+ showThinking = true,
7
+ isStreaming = false
8
+ }) => /* @__PURE__ */ jsx(
9
+ ThinkingTrace,
10
+ {
11
+ text: thinkingText,
12
+ showThinking,
13
+ isStreaming
14
+ }
15
+ );
16
+ var ThinkingVisualization_default = ThinkingVisualization;
17
+ export {
18
+ ThinkingVisualization_default as default
19
+ };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface TomlBlockProps {
3
+ content: string;
4
+ className?: string;
5
+ }
6
+ declare const TomlBlock: React.FC<TomlBlockProps>;
7
+ export default TomlBlock;
@@ -0,0 +1,167 @@
1
+ "use client";
2
+ import { Fragment, 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 { cn } from "@ai-matrx/design-system";
7
+ import { Copy, Check, ChevronRight, ChevronDown } from "lucide-react";
8
+ import { Button } from "@ai-matrx/design-system/controls";
9
+ function parseTomlLines(content) {
10
+ return content.split("\n").map((raw) => {
11
+ const trimmed = raw.trim();
12
+ if (!trimmed) {
13
+ return { type: "blank", indent: 0, raw };
14
+ }
15
+ if (trimmed.startsWith("#")) {
16
+ return { type: "comment", indent: 0, raw };
17
+ }
18
+ const arraySection = trimmed.match(/^\[\[(.+)\]\]$/);
19
+ if (arraySection) {
20
+ return {
21
+ type: "array-section",
22
+ indent: 0,
23
+ section: arraySection[1],
24
+ raw
25
+ };
26
+ }
27
+ const section = trimmed.match(/^\[([^\]]+)\]$/);
28
+ if (section) {
29
+ return { type: "section", indent: 0, section: section[1], raw };
30
+ }
31
+ const kvMatch = trimmed.match(/^([^=]+?)\s*=\s*(.+)$/);
32
+ if (kvMatch) {
33
+ return {
34
+ type: "key-value",
35
+ indent: 0,
36
+ key: kvMatch[1].trim(),
37
+ value: kvMatch[2].trim(),
38
+ raw
39
+ };
40
+ }
41
+ return { type: "key-value", indent: 0, value: trimmed, raw };
42
+ });
43
+ }
44
+ function renderTomlValue(value) {
45
+ if (value === "true" || value === "false") {
46
+ return /* @__PURE__ */ jsx("span", { className: "text-orange-600 dark:text-orange-400 font-medium", children: value });
47
+ }
48
+ if (/^-?\d+(\.\d+)?$/.test(value)) {
49
+ return /* @__PURE__ */ jsx("span", { className: "text-purple-600 dark:text-purple-400", children: value });
50
+ }
51
+ if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
52
+ return /* @__PURE__ */ jsx("span", { className: "text-green-600 dark:text-green-400", children: value });
53
+ }
54
+ if (value.startsWith('"""') || value.startsWith("'''")) {
55
+ return /* @__PURE__ */ jsx("span", { className: "text-green-600 dark:text-green-400", children: value });
56
+ }
57
+ if (value.startsWith("[")) {
58
+ return /* @__PURE__ */ jsx("span", { className: "text-green-600 dark:text-green-400", children: value });
59
+ }
60
+ if (value.startsWith("{")) {
61
+ return /* @__PURE__ */ jsx("span", { className: "text-blue-600 dark:text-blue-400", children: value });
62
+ }
63
+ if (/^\d{4}-\d{2}-\d{2}/.test(value)) {
64
+ return /* @__PURE__ */ jsx("span", { className: "text-cyan-600 dark:text-cyan-400", children: value });
65
+ }
66
+ return /* @__PURE__ */ jsx("span", { className: "text-green-600 dark:text-green-400", children: value });
67
+ }
68
+ const TomlBlock = ({ content, className }) => {
69
+ const { copyText } = useClipboard({
70
+ notify: (message, kind) => kind === "error" ? toast.error(message) : toast.success(message)
71
+ });
72
+ const [copied, setCopied] = useState(false);
73
+ const [collapsedSections, setCollapsedSections] = useState(
74
+ /* @__PURE__ */ new Set()
75
+ );
76
+ const lines = parseTomlLines(content);
77
+ const handleCopy = async () => {
78
+ await copyText(content);
79
+ setCopied(true);
80
+ setTimeout(() => setCopied(false), 2e3);
81
+ };
82
+ const toggleSection = (idx) => {
83
+ setCollapsedSections((prev) => {
84
+ const next = new Set(prev);
85
+ if (next.has(idx)) next.delete(idx);
86
+ else next.add(idx);
87
+ return next;
88
+ });
89
+ };
90
+ const getSectionEnd = (sectionIdx) => {
91
+ let end = sectionIdx + 1;
92
+ while (end < lines.length) {
93
+ const line = lines[end];
94
+ if (line.type === "section" || line.type === "array-section") break;
95
+ end++;
96
+ }
97
+ return end;
98
+ };
99
+ const hiddenLines = /* @__PURE__ */ new Set();
100
+ for (const idx of collapsedSections) {
101
+ const end = getSectionEnd(idx);
102
+ for (let j = idx + 1; j < end; j++) hiddenLines.add(j);
103
+ }
104
+ return /* @__PURE__ */ jsxs(
105
+ "div",
106
+ {
107
+ className: cn(
108
+ "my-3 rounded-lg border border-border bg-card overflow-hidden",
109
+ className
110
+ ),
111
+ children: [
112
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 py-1.5 border-b border-border/50 bg-muted/30", children: [
113
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-mono font-semibold text-violet-600 dark:text-violet-400", children: "TOML" }),
114
+ /* @__PURE__ */ jsx(Button, { variant: "quiet", icon: copied ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Copy, {}), glyphTone: copied ? "success" : void 0, onClick: handleCopy, "aria-label": "Copy" })
115
+ ] }),
116
+ /* @__PURE__ */ jsx("div", { className: "px-3 py-2 font-mono text-sm leading-relaxed overflow-x-auto", children: lines.map((line, idx) => {
117
+ if (hiddenLines.has(idx)) return null;
118
+ if (line.type === "blank") {
119
+ return /* @__PURE__ */ jsx("div", { className: "h-3" }, idx);
120
+ }
121
+ if (line.type === "comment") {
122
+ return /* @__PURE__ */ jsx("div", { className: "text-muted-foreground italic", children: line.raw.trim() }, idx);
123
+ }
124
+ if (line.type === "section" || line.type === "array-section") {
125
+ const isCollapsed = collapsedSections.has(idx);
126
+ const bracket = line.type === "array-section" ? "[[" : "[";
127
+ const closeBracket = line.type === "array-section" ? "]]" : "]";
128
+ return /* @__PURE__ */ jsxs(
129
+ "div",
130
+ {
131
+ className: "flex items-center group/section hover:bg-muted/30 rounded-sm -mx-1 px-1 mt-2 first:mt-0",
132
+ children: [
133
+ /* @__PURE__ */ jsx(Button, { variant: "quiet", icon: isCollapsed ? /* @__PURE__ */ jsx(ChevronRight, {}) : /* @__PURE__ */ jsx(ChevronDown, {}), onClick: () => toggleSection(idx), "aria-label": isCollapsed ? "Expand" : "Collapse", "aria-expanded": !isCollapsed, className: "mr-1" }),
134
+ /* @__PURE__ */ jsxs("span", { children: [
135
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: bracket }),
136
+ /* @__PURE__ */ jsx("span", { className: "text-blue-600 dark:text-blue-400 font-semibold", children: line.section }),
137
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: closeBracket })
138
+ ] }),
139
+ isCollapsed && /* @__PURE__ */ jsx("span", { className: "ml-2 text-xs text-muted-foreground bg-muted px-1.5 py-0.5 rounded", children: "..." })
140
+ ]
141
+ },
142
+ idx
143
+ );
144
+ }
145
+ return /* @__PURE__ */ jsxs(
146
+ "div",
147
+ {
148
+ className: "hover:bg-muted/30 rounded-sm -mx-1 px-1 pl-5",
149
+ children: [
150
+ line.key && /* @__PURE__ */ jsxs(Fragment, { children: [
151
+ /* @__PURE__ */ jsx("code", { className: "text-amber-600 dark:text-amber-400", children: line.key }),
152
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: " = " })
153
+ ] }),
154
+ line.value !== void 0 && renderTomlValue(line.value)
155
+ ]
156
+ },
157
+ idx
158
+ );
159
+ }) })
160
+ ]
161
+ }
162
+ );
163
+ };
164
+ var TomlBlock_default = TomlBlock;
165
+ export {
166
+ TomlBlock_default as default
167
+ };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface TreeBlockProps {
3
+ content: string;
4
+ className?: string;
5
+ }
6
+ declare const TreeBlock: React.FC<TreeBlockProps>;
7
+ export default TreeBlock;