@svadmin/ai-elements 0.5.1 → 0.8.0

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 (303) hide show
  1. package/README.md +18 -53
  2. package/THIRD_PARTY_NOTICES.md +67 -6
  3. package/dist/ai.css +149 -2740
  4. package/dist/ai.theme.css +1 -2771
  5. package/dist/class-properties.generated.d.ts +1 -0
  6. package/dist/class-properties.generated.js +2 -0
  7. package/dist/classnames.d.ts +8 -0
  8. package/dist/classnames.js +26 -0
  9. package/dist/components/AICommandBar.svelte +6 -4
  10. package/dist/components/ChatDialog.svelte +102 -125
  11. package/dist/components/ChatDialog.svelte.d.ts +3 -9
  12. package/dist/components/Conversation.svelte +34 -10
  13. package/dist/components/ConversationContent.svelte +1 -1
  14. package/dist/components/ConversationScrollButton.svelte +0 -1
  15. package/dist/components/CopilotPanel.svelte +8 -6
  16. package/dist/components/Message.svelte +1 -1
  17. package/dist/components/MessageActions.svelte +1 -1
  18. package/dist/components/MessageContent.svelte +1 -1
  19. package/dist/components/MessageToolbar.svelte +1 -1
  20. package/dist/components/Response.svelte +32 -12
  21. package/dist/components/Response.svelte.d.ts +3 -3
  22. package/dist/components/Tool.svelte +13 -13
  23. package/dist/components/Tool.svelte.d.ts +1 -1
  24. package/dist/components/action/Action.svelte +3 -1
  25. package/dist/components/artifact/ArtifactAction.svelte +3 -1
  26. package/dist/components/attachments/Attachment.svelte +4 -2
  27. package/dist/components/attachments/Attachments.svelte +3 -1
  28. package/dist/components/attachments/types.js +3 -2
  29. package/dist/components/audio-player/AudioPlayer.svelte.d.ts +1 -1
  30. package/dist/components/canvas/Canvas.svelte +1 -1
  31. package/dist/components/checkpoint/index.d.ts +2 -2
  32. package/dist/components/code/index.d.ts +9 -1
  33. package/dist/components/code/index.js +8 -1
  34. package/dist/components/code-block/CodeBlockLanguageSelector.svelte.d.ts +1 -1
  35. package/dist/components/code-block/highlight.js +11 -10
  36. package/dist/components/commit/Commit.svelte +23 -2
  37. package/dist/components/commit/CommitActions.svelte +2 -11
  38. package/dist/components/commit/CommitCopyButton.svelte +1 -1
  39. package/dist/components/commit/CommitHeader.svelte +12 -2
  40. package/dist/components/commit/context.svelte.d.ts +6 -0
  41. package/dist/components/commit/context.svelte.js +14 -0
  42. package/dist/components/context/Context.svelte +6 -4
  43. package/dist/components/context/TokensWithCost.svelte +2 -1
  44. package/dist/components/edge/Animated.svelte +6 -6
  45. package/dist/components/edge/Temporary.svelte +6 -5
  46. package/dist/components/file-tree/FileTree.svelte +7 -5
  47. package/dist/components/jsx-preview/parser.js +10 -10
  48. package/dist/components/message/MessageAction.svelte +3 -1
  49. package/dist/components/mic-selector/MicSelector.svelte.d.ts +1 -1
  50. package/dist/components/model-selector/ModelSelectorDialog.svelte +3 -1
  51. package/dist/components/open-in-chat/OpenInChatGPT.svelte +3 -1
  52. package/dist/components/open-in-chat/OpenInClaude.svelte +3 -1
  53. package/dist/components/open-in-chat/OpenInCursor.svelte +3 -1
  54. package/dist/components/open-in-chat/OpenInGitHub.svelte +3 -1
  55. package/dist/components/open-in-chat/OpenInScira.svelte +3 -1
  56. package/dist/components/open-in-chat/OpenInT3.svelte +3 -1
  57. package/dist/components/open-in-chat/OpenInv0.svelte +3 -1
  58. package/dist/components/package-info/PackageInfo.svelte +3 -1
  59. package/dist/components/prompt-input/PromptInput.svelte +8 -18
  60. package/dist/components/prompt-input/PromptInputCommand.svelte +2 -1
  61. package/dist/components/prompt-input/PromptInputSelect.svelte.d.ts +1 -1
  62. package/dist/components/prompt-input/PromptInputSubmit.svelte +5 -18
  63. package/dist/components/prompt-input/PromptInputTextarea.svelte +6 -11
  64. package/dist/components/prompt-input/context.svelte.d.ts +1 -8
  65. package/dist/components/prompt-input/files.js +3 -2
  66. package/dist/components/question/Question.svelte +3 -1
  67. package/dist/components/schema-display/SchemaDisplay.svelte +4 -2
  68. package/dist/components/schema-display/SchemaDisplayParameter.svelte +14 -1
  69. package/dist/components/schema-display/SchemaDisplayProperty.svelte +16 -1
  70. package/dist/components/snippet/index.d.ts +3 -3
  71. package/dist/components/stack-trace/StackTrace.svelte +7 -5
  72. package/dist/components/suggestion/index.d.ts +1 -1
  73. package/dist/components/terminal/Terminal.svelte +4 -2
  74. package/dist/components/terminal/ansi.js +9 -6
  75. package/dist/components/test-results/Test.svelte +1 -1
  76. package/dist/components/test-results/TestResults.svelte +1 -1
  77. package/dist/components/test-results/context.svelte.d.ts +1 -1
  78. package/dist/components/tool/ToolContent.svelte +1 -1
  79. package/dist/components/tool/ToolHeader.svelte +5 -5
  80. package/dist/components/tool/ToolInput.svelte +2 -4
  81. package/dist/components/tool/ToolOutput.svelte +2 -4
  82. package/dist/components/tool/ToolStatusBadge.svelte +2 -3
  83. package/dist/components/voice-selector/VoiceSelector.svelte +2 -1
  84. package/dist/components/voice-selector/VoiceSelector.svelte.d.ts +2 -2
  85. package/dist/components/voice-selector/context.svelte.d.ts +2 -1
  86. package/dist/components/web-preview/WebPreview.svelte +4 -3
  87. package/dist/contracts.d.ts +2 -2
  88. package/dist/generated-components.d.ts +15 -1
  89. package/dist/generated-components.js +20 -1
  90. package/dist/internal/Tooltip.svelte +2 -1
  91. package/dist/parity-manifest.d.ts +0 -1
  92. package/dist/parity-manifest.js +0 -97
  93. package/dist/utilities.css +3172 -0
  94. package/dist/utils.d.ts +1 -1
  95. package/dist/utils.js +1 -1
  96. package/package.json +37 -22
  97. package/vendor/streamdown/AnimatedText.svelte +93 -0
  98. package/vendor/streamdown/AnimatedText.svelte.d.ts +6 -0
  99. package/vendor/streamdown/Block.svelte +96 -0
  100. package/vendor/streamdown/Block.svelte.d.ts +11 -0
  101. package/vendor/streamdown/Elements/Alert.svelte +69 -0
  102. package/vendor/streamdown/Elements/Alert.svelte.d.ts +10 -0
  103. package/vendor/streamdown/Elements/Citation.svelte +260 -0
  104. package/vendor/streamdown/Elements/Citation.svelte.d.ts +7 -0
  105. package/vendor/streamdown/Elements/Code.svelte +226 -0
  106. package/vendor/streamdown/Elements/Code.svelte.d.ts +9 -0
  107. package/vendor/streamdown/Elements/Element.svelte +574 -0
  108. package/vendor/streamdown/Elements/Element.svelte.d.ts +10 -0
  109. package/vendor/streamdown/Elements/FootnoteRef.svelte +30 -0
  110. package/vendor/streamdown/Elements/FootnoteRef.svelte.d.ts +7 -0
  111. package/vendor/streamdown/Elements/Footnotes.svelte +54 -0
  112. package/vendor/streamdown/Elements/Footnotes.svelte.d.ts +7 -0
  113. package/vendor/streamdown/Elements/Image.svelte +200 -0
  114. package/vendor/streamdown/Elements/Image.svelte.d.ts +10 -0
  115. package/vendor/streamdown/Elements/Link.svelte +220 -0
  116. package/vendor/streamdown/Elements/Link.svelte.d.ts +10 -0
  117. package/vendor/streamdown/Elements/LinkSafetyModal.svelte +121 -0
  118. package/vendor/streamdown/Elements/LinkSafetyModal.svelte.d.ts +4 -0
  119. package/vendor/streamdown/Elements/Math.svelte +100 -0
  120. package/vendor/streamdown/Elements/Math.svelte.d.ts +9 -0
  121. package/vendor/streamdown/Elements/Mermaid.svelte +455 -0
  122. package/vendor/streamdown/Elements/Mermaid.svelte.d.ts +9 -0
  123. package/vendor/streamdown/Elements/MermaidDownload.svelte +145 -0
  124. package/vendor/streamdown/Elements/MermaidDownload.svelte.d.ts +8 -0
  125. package/vendor/streamdown/Elements/Slot.svelte +23 -0
  126. package/vendor/streamdown/Elements/Slot.svelte.d.ts +10 -0
  127. package/vendor/streamdown/Elements/Table.svelte +195 -0
  128. package/vendor/streamdown/Elements/Table.svelte.d.ts +9 -0
  129. package/vendor/streamdown/Elements/TableDownload.svelte +221 -0
  130. package/vendor/streamdown/Elements/TableDownload.svelte.d.ts +8 -0
  131. package/vendor/streamdown/Elements/fallbacks/CodeFallback.svelte +41 -0
  132. package/vendor/streamdown/Elements/fallbacks/CodeFallback.svelte.d.ts +9 -0
  133. package/vendor/streamdown/Elements/fallbacks/MathFallback.svelte +35 -0
  134. package/vendor/streamdown/Elements/fallbacks/MathFallback.svelte.d.ts +8 -0
  135. package/vendor/streamdown/Elements/fallbacks/MermaidFallback.svelte +36 -0
  136. package/vendor/streamdown/Elements/fallbacks/MermaidFallback.svelte.d.ts +9 -0
  137. package/vendor/streamdown/Elements/fallbacks/index.d.ts +3 -0
  138. package/vendor/streamdown/Elements/fallbacks/index.js +3 -0
  139. package/vendor/streamdown/Elements/icons.d.ts +31 -0
  140. package/vendor/streamdown/Elements/icons.js +200 -0
  141. package/vendor/streamdown/Elements/index.d.ts +8 -0
  142. package/vendor/streamdown/Elements/index.js +8 -0
  143. package/vendor/streamdown/Elements/popover.svelte.d.ts +8 -0
  144. package/vendor/streamdown/Elements/popover.svelte.js +45 -0
  145. package/vendor/streamdown/Elements/stepperState.svelte.d.ts +36 -0
  146. package/vendor/streamdown/Elements/stepperState.svelte.js +92 -0
  147. package/vendor/streamdown/IconProvider.svelte +11 -0
  148. package/vendor/streamdown/IconProvider.svelte.d.ts +30 -0
  149. package/vendor/streamdown/LICENSE +202 -0
  150. package/vendor/streamdown/PluginProvider.svelte +11 -0
  151. package/vendor/streamdown/PluginProvider.svelte.d.ts +30 -0
  152. package/vendor/streamdown/README.svadmin.md +5 -0
  153. package/vendor/streamdown/Streamdown.svelte +447 -0
  154. package/vendor/streamdown/Streamdown.svelte.d.ts +25 -0
  155. package/vendor/streamdown/block/BlockTokens.svelte +45 -0
  156. package/vendor/streamdown/block/BlockTokens.svelte.d.ts +9 -0
  157. package/vendor/streamdown/block/html.d.ts +14 -0
  158. package/vendor/streamdown/block/html.js +27 -0
  159. package/vendor/streamdown/block/text.d.ts +10 -0
  160. package/vendor/streamdown/block/text.js +31 -0
  161. package/vendor/streamdown/context-key.d.ts +1 -0
  162. package/vendor/streamdown/context-key.js +1 -0
  163. package/vendor/streamdown/context.svelte.d.ts +24 -0
  164. package/vendor/streamdown/context.svelte.js +75 -0
  165. package/vendor/streamdown/contracts/plugins.d.ts +26 -0
  166. package/vendor/streamdown/contracts/plugins.js +1 -0
  167. package/vendor/streamdown/contracts/streamdown.d.ts +374 -0
  168. package/vendor/streamdown/contracts/streamdown.js +29 -0
  169. package/vendor/streamdown/detect-direction.d.ts +1 -0
  170. package/vendor/streamdown/detect-direction.js +1 -0
  171. package/vendor/streamdown/icon-context.d.ts +36 -0
  172. package/vendor/streamdown/icon-context.js +52 -0
  173. package/vendor/streamdown/incomplete-code.d.ts +6 -0
  174. package/vendor/streamdown/incomplete-code.js +23 -0
  175. package/vendor/streamdown/index.d.ts +22 -0
  176. package/vendor/streamdown/index.js +20 -0
  177. package/vendor/streamdown/markdown-parse-cache.d.ts +37 -0
  178. package/vendor/streamdown/markdown-parse-cache.js +109 -0
  179. package/vendor/streamdown/markdown.d.ts +21 -0
  180. package/vendor/streamdown/markdown.js +214 -0
  181. package/vendor/streamdown/marked/index.d.ts +44 -0
  182. package/vendor/streamdown/marked/index.js +228 -0
  183. package/vendor/streamdown/marked/marked-alert.d.ts +13 -0
  184. package/vendor/streamdown/marked/marked-alert.js +47 -0
  185. package/vendor/streamdown/marked/marked-align.d.ts +10 -0
  186. package/vendor/streamdown/marked/marked-align.js +45 -0
  187. package/vendor/streamdown/marked/marked-br.d.ts +6 -0
  188. package/vendor/streamdown/marked/marked-br.js +15 -0
  189. package/vendor/streamdown/marked/marked-citations.d.ts +8 -0
  190. package/vendor/streamdown/marked/marked-citations.js +53 -0
  191. package/vendor/streamdown/marked/marked-cjk.d.ts +2 -0
  192. package/vendor/streamdown/marked/marked-cjk.js +165 -0
  193. package/vendor/streamdown/marked/marked-dl.d.ts +23 -0
  194. package/vendor/streamdown/marked/marked-dl.js +44 -0
  195. package/vendor/streamdown/marked/marked-footnotes.d.ts +26 -0
  196. package/vendor/streamdown/marked/marked-footnotes.js +101 -0
  197. package/vendor/streamdown/marked/marked-hr.d.ts +6 -0
  198. package/vendor/streamdown/marked/marked-hr.js +18 -0
  199. package/vendor/streamdown/marked/marked-list.d.ts +31 -0
  200. package/vendor/streamdown/marked/marked-list.js +330 -0
  201. package/vendor/streamdown/marked/marked-math.d.ts +13 -0
  202. package/vendor/streamdown/marked/marked-math.js +129 -0
  203. package/vendor/streamdown/marked/marked-mdx.d.ts +12 -0
  204. package/vendor/streamdown/marked/marked-mdx.js +124 -0
  205. package/vendor/streamdown/marked/marked-subsup.d.ts +22 -0
  206. package/vendor/streamdown/marked/marked-subsup.js +40 -0
  207. package/vendor/streamdown/marked/marked-table.d.ts +80 -0
  208. package/vendor/streamdown/marked/marked-table.js +527 -0
  209. package/vendor/streamdown/plugin-context.d.ts +19 -0
  210. package/vendor/streamdown/plugin-context.js +40 -0
  211. package/vendor/streamdown/plugins/cjk-shared.d.ts +1 -0
  212. package/vendor/streamdown/plugins/cjk-shared.js +1 -0
  213. package/vendor/streamdown/plugins.d.ts +19 -0
  214. package/vendor/streamdown/plugins.js +107 -0
  215. package/vendor/streamdown/provenance.json +229 -0
  216. package/vendor/streamdown/remend.d.ts +2 -0
  217. package/vendor/streamdown/remend.js +1 -0
  218. package/vendor/streamdown/security/html.d.ts +19 -0
  219. package/vendor/streamdown/security/html.js +329 -0
  220. package/vendor/streamdown/security/preprocess-custom-tags.d.ts +1 -0
  221. package/vendor/streamdown/security/preprocess-custom-tags.js +20 -0
  222. package/vendor/streamdown/security/preprocess-literal-tag-content.d.ts +1 -0
  223. package/vendor/streamdown/security/preprocess-literal-tag-content.js +16 -0
  224. package/vendor/streamdown/security/types.d.ts +1 -0
  225. package/vendor/streamdown/security/types.js +1 -0
  226. package/vendor/streamdown/site/SiteHeader.svelte +94 -0
  227. package/vendor/streamdown/site/SiteHeader.svelte.d.ts +6 -0
  228. package/vendor/streamdown/site/home/HomeDemo.svelte +122 -0
  229. package/vendor/streamdown/site/home/HomeDemo.svelte.d.ts +3 -0
  230. package/vendor/streamdown/site/home/HomePage.svelte +293 -0
  231. package/vendor/streamdown/site/home/HomePage.svelte.d.ts +3 -0
  232. package/vendor/streamdown/site/home/content.d.ts +69 -0
  233. package/vendor/streamdown/site/home/content.js +144 -0
  234. package/vendor/streamdown/site/metadata.d.ts +4 -0
  235. package/vendor/streamdown/site/metadata.js +4 -0
  236. package/vendor/streamdown/site/navigation.d.ts +6 -0
  237. package/vendor/streamdown/site/navigation.js +22 -0
  238. package/vendor/streamdown/streamdown/config.d.ts +41 -0
  239. package/vendor/streamdown/streamdown/config.js +125 -0
  240. package/vendor/streamdown/streamdown/context.d.ts +12 -0
  241. package/vendor/streamdown/streamdown/context.js +2 -0
  242. package/vendor/streamdown/streamdown/incomplete-markdown.d.ts +5 -0
  243. package/vendor/streamdown/streamdown/incomplete-markdown.js +79 -0
  244. package/vendor/streamdown/streamdown/pipeline.d.ts +95 -0
  245. package/vendor/streamdown/streamdown/pipeline.js +138 -0
  246. package/vendor/streamdown/streamdown/runtime.d.ts +59 -0
  247. package/vendor/streamdown/streamdown/runtime.js +112 -0
  248. package/vendor/streamdown/streaming.d.ts +5 -0
  249. package/vendor/streamdown/streaming.js +5 -0
  250. package/vendor/streamdown/theme.d.ts +486 -0
  251. package/vendor/streamdown/theme.js +370 -0
  252. package/vendor/streamdown/translations.d.ts +43 -0
  253. package/vendor/streamdown/translations.js +54 -0
  254. package/vendor/streamdown/url-policy.d.ts +1 -0
  255. package/vendor/streamdown/url-policy.js +1 -0
  256. package/vendor/streamdown/utils/bind.d.ts +8 -0
  257. package/vendor/streamdown/utils/bind.js +26 -0
  258. package/vendor/streamdown/utils/bundledLanguages.d.ts +1 -0
  259. package/vendor/streamdown/utils/bundledLanguages.js +1 -0
  260. package/vendor/streamdown/utils/code-block.d.ts +8 -0
  261. package/vendor/streamdown/utils/code-block.js +38 -0
  262. package/vendor/streamdown/utils/copy.svelte.d.ts +7 -0
  263. package/vendor/streamdown/utils/copy.svelte.js +38 -0
  264. package/vendor/streamdown/utils/darkMode.svelte.d.ts +3 -0
  265. package/vendor/streamdown/utils/darkMode.svelte.js +49 -0
  266. package/vendor/streamdown/utils/detectDirection.d.ts +1 -0
  267. package/vendor/streamdown/utils/detectDirection.js +19 -0
  268. package/vendor/streamdown/utils/get.d.ts +1 -0
  269. package/vendor/streamdown/utils/get.js +25 -0
  270. package/vendor/streamdown/utils/hightlighter.svelte.d.ts +30 -0
  271. package/vendor/streamdown/utils/hightlighter.svelte.js +524 -0
  272. package/vendor/streamdown/utils/index.d.ts +3 -0
  273. package/vendor/streamdown/utils/index.js +3 -0
  274. package/vendor/streamdown/utils/mermaid.d.ts +13 -0
  275. package/vendor/streamdown/utils/mermaid.js +49 -0
  276. package/vendor/streamdown/utils/panzoom.svelte.d.ts +35 -0
  277. package/vendor/streamdown/utils/panzoom.svelte.js +556 -0
  278. package/vendor/streamdown/utils/parse-incomplete-markdown.d.ts +2 -0
  279. package/vendor/streamdown/utils/parse-incomplete-markdown.js +2 -0
  280. package/vendor/streamdown/utils/runtime-env.d.ts +1 -0
  281. package/vendor/streamdown/utils/runtime-env.js +13 -0
  282. package/vendor/streamdown/utils/save.d.ts +1 -0
  283. package/vendor/streamdown/utils/save.js +14 -0
  284. package/vendor/streamdown/utils/scroll-lock.d.ts +2 -0
  285. package/vendor/streamdown/utils/scroll-lock.js +35 -0
  286. package/vendor/streamdown/utils/table.d.ts +8 -0
  287. package/vendor/streamdown/utils/table.js +176 -0
  288. package/vendor/streamdown/utils/url.d.ts +22 -0
  289. package/vendor/streamdown/utils/url.js +98 -0
  290. package/vendor/streamdown/utils/useClickOutside.svelte.d.ts +8 -0
  291. package/vendor/streamdown/utils/useClickOutside.svelte.js +41 -0
  292. package/vendor/streamdown/utils/useKeyDown.svelte.d.ts +5 -0
  293. package/vendor/streamdown/utils/useKeyDown.svelte.js +23 -0
  294. package/UPSTREAM_PARITY.md +0 -69
  295. package/dist/ai-theme.css +0 -28
  296. package/dist/components/code/code-variants.d.ts +0 -25
  297. package/dist/components/code/code-variants.js +0 -20
  298. package/dist/components/conversation/scroll.d.ts +0 -4
  299. package/dist/components/conversation/scroll.js +0 -85
  300. package/dist/components/message/content-polish-html.d.ts +0 -5
  301. package/dist/components/message/content-polish-html.js +0 -75
  302. package/dist/components/tool/content-polish-scroll-region.d.ts +0 -3
  303. package/dist/components/tool/content-polish-scroll-region.js +0 -22
@@ -0,0 +1,35 @@
1
+ export interface PanzoomOptions {
2
+ enabled?: boolean | (() => boolean);
3
+ minZoom?: number;
4
+ maxZoom?: number;
5
+ zoomSpeed?: number;
6
+ doubleClickScale?: number;
7
+ initialScale?: number;
8
+ initialX?: number;
9
+ initialY?: number;
10
+ activateMouseWheel?: boolean | (() => boolean);
11
+ }
12
+ export interface ExpandOptions {
13
+ padding?: number;
14
+ duration?: number;
15
+ easing?: string;
16
+ zIndex?: number;
17
+ fitRatio?: number;
18
+ }
19
+ export declare const usePanzoom: (opts?: PanzoomOptions) => {
20
+ attach: (target: HTMLElement | SVGSVGElement) => () => void;
21
+ zoomToFit: (padding?: number) => void;
22
+ zoomBy: (factor: number) => void;
23
+ zoomIn: (factor?: number) => void;
24
+ zoomOut: (factor?: number) => void;
25
+ moveBy: (dx: number, dy: number) => void;
26
+ setTransform: (nx: number, ny: number, ns: number) => void;
27
+ expand: (expand: boolean) => void;
28
+ toggleExpand: () => Promise<void>;
29
+ readonly transform: {
30
+ readonly x: number;
31
+ readonly y: number;
32
+ readonly scale: number;
33
+ };
34
+ readonly expanded: boolean;
35
+ };
@@ -0,0 +1,556 @@
1
+ import { onDestroy, untrack } from 'svelte';
2
+ export const usePanzoom = (opts = {}) => {
3
+ // state
4
+ let x = opts.initialX ?? 0;
5
+ let y = opts.initialY ?? 0;
6
+ let scale = opts.initialScale ?? 1;
7
+ // options
8
+ const minZoom = opts.minZoom ?? 0.1;
9
+ const maxZoom = opts.maxZoom ?? Number.POSITIVE_INFINITY;
10
+ const zoomSpeed = opts.zoomSpeed ?? 1;
11
+ const doubleClickScale = opts.doubleClickScale ?? 1.75;
12
+ const resolveFlag = (value, fallback) => (typeof value === 'function' ? value() : value) ?? fallback;
13
+ const isEnabled = () => resolveFlag(opts.enabled, true);
14
+ const isMouseWheelEnabled = () => resolveFlag(opts.activateMouseWheel, false);
15
+ let node = $state(null); // element we transform
16
+ let eventTarget = $state(null); // element we listen on (parent container if available)
17
+ let createdWrapper = null; // wrapper we created if no parent existed
18
+ const listeners = new Set();
19
+ // drag state
20
+ let dragging = false;
21
+ let lastClientX = 0;
22
+ let lastClientY = 0;
23
+ let dragOffMove = null;
24
+ let dragOffUp = null;
25
+ let previousStyle = null;
26
+ // touch state
27
+ let touchMode = 'none';
28
+ let pinchDistance = 0;
29
+ let pinchCenter = null;
30
+ // expand/collapse state
31
+ let isExpanded = $state(false);
32
+ let animating = false;
33
+ let placeholderEl = null;
34
+ function onKeyDown(e) {
35
+ if (e.key === 'Escape' || e.keyCode === 27) {
36
+ if (isExpanded && !animating) {
37
+ // fire and forget
38
+ void expand(false);
39
+ }
40
+ }
41
+ }
42
+ const destroy = () => {
43
+ listeners.forEach((off) => off());
44
+ listeners.clear();
45
+ if (placeholderEl) {
46
+ placeholderEl.remove();
47
+ placeholderEl = null;
48
+ }
49
+ if (createdWrapper) {
50
+ // Move node back out of wrapper before removing wrapper
51
+ if (node && createdWrapper.parentElement) {
52
+ createdWrapper.parentElement.insertBefore(node, createdWrapper);
53
+ }
54
+ createdWrapper.remove();
55
+ createdWrapper = null;
56
+ }
57
+ if (dragOffMove)
58
+ dragOffMove();
59
+ if (dragOffUp)
60
+ dragOffUp();
61
+ };
62
+ onDestroy(() => {
63
+ destroy();
64
+ });
65
+ $effect(() => {
66
+ const enabled = isEnabled();
67
+ const currentNode = node;
68
+ const interactionTarget = (eventTarget ?? currentNode);
69
+ if (!interactionTarget && !currentNode) {
70
+ return;
71
+ }
72
+ if (interactionTarget) {
73
+ interactionTarget.style.userSelect = enabled ? 'none' : '';
74
+ interactionTarget.style.touchAction = enabled ? 'none' : '';
75
+ interactionTarget.style.cursor = enabled ? 'grab' : '';
76
+ interactionTarget.style.overscrollBehavior = enabled ? 'contain' : '';
77
+ }
78
+ if (!enabled && currentNode) {
79
+ currentNode.style.cursor = '';
80
+ }
81
+ return () => {
82
+ if (interactionTarget) {
83
+ interactionTarget.style.userSelect = '';
84
+ interactionTarget.style.touchAction = '';
85
+ interactionTarget.style.cursor = '';
86
+ interactionTarget.style.overscrollBehavior = '';
87
+ }
88
+ if (currentNode) {
89
+ currentNode.style.cursor = '';
90
+ }
91
+ };
92
+ });
93
+ function normalize() {
94
+ // clamp and round to reduce subpixel jitter
95
+ scale = clampScale(scale);
96
+ const r = (v) => Math.round(v * 1000) / 1000;
97
+ x = r(x);
98
+ y = r(y);
99
+ scale = r(scale);
100
+ }
101
+ function apply() {
102
+ if (!node)
103
+ return;
104
+ normalize();
105
+ // Use CSS transform regardless of DOM/SVG root; modern browsers support this.
106
+ const el = node;
107
+ el.style.transformOrigin = '0 0';
108
+ el.style.willChange = 'transform';
109
+ // transform order is right-to-left. We want screen = translate + scale * local
110
+ // so use translate() first, then scale().
111
+ el.style.transform = `translate3d(${x}px, ${y}px, 0) scale(${scale})`;
112
+ }
113
+ function clampScale(s) {
114
+ if (s < minZoom)
115
+ return minZoom;
116
+ if (s > maxZoom)
117
+ return maxZoom;
118
+ return s;
119
+ }
120
+ function zoomAt(clientX, clientY, factor) {
121
+ if (!node)
122
+ return;
123
+ if (!Number.isFinite(factor) || factor === 1)
124
+ return;
125
+ const nextScale = clampScale(scale * factor);
126
+ const ratio = nextScale / scale;
127
+ if (ratio === 1)
128
+ return;
129
+ const owner = (eventTarget ?? node.parentElement ?? node);
130
+ const ownerRect = owner.getBoundingClientRect();
131
+ const ox = clientX - ownerRect.left;
132
+ const oy = clientY - ownerRect.top;
133
+ // Keep (ox, oy) stationary in owner's coordinate space
134
+ x = ratio * x + (1 - ratio) * ox;
135
+ y = ratio * y + (1 - ratio) * oy;
136
+ scale = nextScale;
137
+ apply();
138
+ }
139
+ function kineticWheel(deltaY) {
140
+ // deltaY > 0 => zoom out; use smooth exponential scaling
141
+ const sign = Math.sign(deltaY);
142
+ const step = Math.min(0.25, Math.abs((zoomSpeed * deltaY) / 128));
143
+ return 1 - sign * step;
144
+ }
145
+ function onWheel(e) {
146
+ if (!isEnabled())
147
+ return;
148
+ if (!isMouseWheelEnabled())
149
+ return;
150
+ if (!node)
151
+ return;
152
+ if (animating) {
153
+ e.preventDefault();
154
+ e.stopPropagation();
155
+ return;
156
+ }
157
+ // Always prevent default to stop page scroll
158
+ e.preventDefault();
159
+ e.stopPropagation();
160
+ const factor = kineticWheel(e.deltaY * (e.deltaMode ? 100 : 1));
161
+ zoomAt(e.clientX, e.clientY, factor);
162
+ // re-apply using latest rect
163
+ apply();
164
+ }
165
+ function onDblClick(e) {
166
+ if (!isEnabled())
167
+ return;
168
+ // Ignore dblclicks that originate outside of the pan/zoom content (the node)
169
+ const t = e.target;
170
+ if (node && t && !(t === node || node.contains(t))) {
171
+ return; // likely UI control inside container; don't zoom
172
+ }
173
+ // Ignore dblclicks on interactive elements or those explicitly marked to ignore
174
+ const isInteractive = (el) => {
175
+ const tag = el.tagName.toLowerCase();
176
+ return (el.closest('[data-panzoom-ignore]') !== null ||
177
+ ['button', 'a', 'input', 'textarea', 'select', 'label', 'summary', 'details'].includes(tag) ||
178
+ el.isContentEditable);
179
+ };
180
+ if (t && isInteractive(t))
181
+ return;
182
+ e.preventDefault();
183
+ // Anchor double-click zoom at parent center to avoid shifts on rapid clicks
184
+ const baseEl = (eventTarget ?? node?.parentElement ?? node);
185
+ const base = baseEl.getBoundingClientRect();
186
+ const cx = base.left + base.width / 2;
187
+ const cy = base.top + base.height / 2;
188
+ zoomAt(cx, cy, doubleClickScale);
189
+ }
190
+ function startDrag(e) {
191
+ if (!isEnabled())
192
+ return;
193
+ if (animating) {
194
+ e.preventDefault();
195
+ return;
196
+ }
197
+ if (e.button !== 0)
198
+ return; // left only
199
+ dragging = true;
200
+ lastClientX = e.clientX;
201
+ lastClientY = e.clientY;
202
+ e.preventDefault();
203
+ if (node)
204
+ node.style.cursor = 'grabbing';
205
+ dragOffMove = () => window.removeEventListener('mousemove', onDragMove);
206
+ dragOffUp = () => window.removeEventListener('mouseup', endDrag);
207
+ window.addEventListener('mousemove', onDragMove, { passive: false });
208
+ window.addEventListener('mouseup', endDrag, { passive: true });
209
+ listeners.add(dragOffMove);
210
+ listeners.add(dragOffUp);
211
+ }
212
+ function onDragMove(e) {
213
+ if (!dragging)
214
+ return;
215
+ const dx = e.clientX - lastClientX;
216
+ const dy = e.clientY - lastClientY;
217
+ lastClientX = e.clientX;
218
+ lastClientY = e.clientY;
219
+ x += dx;
220
+ y += dy;
221
+ apply();
222
+ }
223
+ function endDrag() {
224
+ dragging = false;
225
+ if (node)
226
+ node.style.cursor = 'grab';
227
+ if (dragOffMove) {
228
+ dragOffMove();
229
+ listeners.delete(dragOffMove);
230
+ }
231
+ if (dragOffUp) {
232
+ dragOffUp();
233
+ listeners.delete(dragOffUp);
234
+ }
235
+ dragOffMove = dragOffUp = null;
236
+ }
237
+ function onTouchStart(e) {
238
+ if (!isEnabled())
239
+ return;
240
+ const hasButton = e
241
+ .composedPath()
242
+ .some((el) => el.tagName?.toLowerCase?.() === 'button');
243
+ if (hasButton)
244
+ return;
245
+ if (!node)
246
+ return;
247
+ if (animating) {
248
+ e.preventDefault();
249
+ return;
250
+ }
251
+ if (e.touches.length === 1) {
252
+ touchMode = 'pan';
253
+ lastClientX = e.touches[0].clientX;
254
+ lastClientY = e.touches[0].clientY;
255
+ }
256
+ else if (e.touches.length >= 2) {
257
+ touchMode = 'pinch';
258
+ const [t1, t2] = [e.touches[0], e.touches[1]];
259
+ pinchDistance = Math.hypot(t1.clientX - t2.clientX, t1.clientY - t2.clientY);
260
+ pinchCenter = {
261
+ x: (t1.clientX + t2.clientX) / 2,
262
+ y: (t1.clientY + t2.clientY) / 2
263
+ };
264
+ }
265
+ // prevent default scrolling/zooming
266
+ e.preventDefault();
267
+ const offMove = () => window.removeEventListener('touchmove', onTouchMove);
268
+ const offEnd = () => window.removeEventListener('touchend', onTouchEnd);
269
+ const offCancel = () => window.removeEventListener('touchcancel', onTouchEnd);
270
+ window.addEventListener('touchmove', onTouchMove, { passive: false });
271
+ window.addEventListener('touchend', onTouchEnd, { passive: true });
272
+ window.addEventListener('touchcancel', onTouchEnd, { passive: true });
273
+ listeners.add(offMove);
274
+ listeners.add(offEnd);
275
+ listeners.add(offCancel);
276
+ }
277
+ function onTouchMove(e) {
278
+ if (!node)
279
+ return;
280
+ if (touchMode === 'pan' && e.touches.length === 1) {
281
+ const t = e.touches[0];
282
+ const dx = t.clientX - lastClientX;
283
+ const dy = t.clientY - lastClientY;
284
+ lastClientX = t.clientX;
285
+ lastClientY = t.clientY;
286
+ x += dx;
287
+ y += dy;
288
+ apply();
289
+ e.preventDefault();
290
+ }
291
+ else if (touchMode === 'pinch' && e.touches.length >= 2) {
292
+ const [t1, t2] = [e.touches[0], e.touches[1]];
293
+ const dist = Math.hypot(t1.clientX - t2.clientX, t1.clientY - t2.clientY);
294
+ const factor = dist / (pinchDistance || dist);
295
+ const center = {
296
+ x: (t1.clientX + t2.clientX) / 2,
297
+ y: (t1.clientY + t2.clientY) / 2
298
+ };
299
+ zoomAt(center.x, center.y, factor);
300
+ pinchDistance = dist;
301
+ pinchCenter = center;
302
+ e.preventDefault();
303
+ }
304
+ }
305
+ function onTouchEnd() {
306
+ if (!node)
307
+ return;
308
+ if (touchMode === 'pinch') {
309
+ // reset pinch state, keep resulting transform
310
+ touchMode = 'none';
311
+ pinchDistance = 0;
312
+ pinchCenter = null;
313
+ }
314
+ else if (touchMode === 'pan') {
315
+ touchMode = 'none';
316
+ }
317
+ }
318
+ function internalAttach(target) {
319
+ return untrack(() => {
320
+ node = target;
321
+ // Ensure eventTarget and node are different elements to avoid FLIP conflicts
322
+ const isSVG = typeof SVGSVGElement !== 'undefined' && target instanceof SVGSVGElement;
323
+ if (isSVG) {
324
+ // For SVG, prefer parent element
325
+ eventTarget = target.parentElement;
326
+ }
327
+ else {
328
+ // For non-SVG, try to use parent element when available
329
+ const parent = target.parentElement;
330
+ if (parent && parent instanceof HTMLElement) {
331
+ eventTarget = parent;
332
+ }
333
+ else {
334
+ // No suitable parent - create wrapper to ensure separation
335
+ const wrapper = document.createElement('div');
336
+ wrapper.style.cssText = `
337
+ display: contents;
338
+ contain: layout style;
339
+ `
340
+ .replace(/\s+/g, ' ')
341
+ .trim();
342
+ // Insert wrapper and move target into it
343
+ if (target.parentElement) {
344
+ target.parentElement.insertBefore(wrapper, target);
345
+ }
346
+ wrapper.appendChild(target);
347
+ eventTarget = wrapper;
348
+ createdWrapper = wrapper;
349
+ }
350
+ }
351
+ // Final fallback if no eventTarget was established
352
+ if (!eventTarget) {
353
+ eventTarget = target;
354
+ }
355
+ apply();
356
+ // helper to add and track listeners with options
357
+ const add = (type, handler, options) => {
358
+ const n = (eventTarget ?? node);
359
+ n.addEventListener(type, handler, options);
360
+ const off = () => n.removeEventListener(type, handler, options);
361
+ listeners.add(off);
362
+ return off;
363
+ };
364
+ const addWindow = (type, handler, options) => {
365
+ window.addEventListener(type, handler, options);
366
+ const off = () => window.removeEventListener(type, handler, options);
367
+ listeners.add(off);
368
+ return off;
369
+ };
370
+ // core events with passive: false where needed
371
+ add('mousedown', startDrag, { passive: false });
372
+ add('wheel', onWheel, { passive: false, capture: true });
373
+ add('dblclick', onDblClick, { passive: false });
374
+ add('touchstart', onTouchStart, { passive: false });
375
+ addWindow('keydown', onKeyDown, { passive: true });
376
+ // For SVG root, use fill-box so translation math stays in CSS px space
377
+ const n = node;
378
+ if (typeof SVGSVGElement !== 'undefined' && target instanceof SVGSVGElement) {
379
+ n.style.transformBox = 'fill-box';
380
+ }
381
+ return () => {
382
+ destroy();
383
+ };
384
+ });
385
+ }
386
+ const expand = (expand) => {
387
+ if (!eventTarget)
388
+ return;
389
+ // Capture first state
390
+ const first = eventTarget.getBoundingClientRect();
391
+ if (expand) {
392
+ // Expanding: immediately apply expanded state
393
+ // We should add margin to the parent element to account for the expanded height
394
+ if (eventTarget.parentElement) {
395
+ const styleAttributes = ['margin-block', 'height'];
396
+ styleAttributes.forEach((attribute) => {
397
+ if (eventTarget?.parentElement) {
398
+ eventTarget.parentElement.style.setProperty(attribute, getComputedStyle(eventTarget).getPropertyValue(attribute));
399
+ }
400
+ });
401
+ }
402
+ eventTarget.dataset.expanded = 'true';
403
+ isExpanded = true;
404
+ zoomToFit();
405
+ // Force layout to get the final position
406
+ const last = eventTarget.getBoundingClientRect();
407
+ // Calculate the inverse transform
408
+ const deltaX = first.left - last.left;
409
+ const deltaY = first.top - last.top;
410
+ const deltaW = first.width / last.width;
411
+ const deltaH = first.height / last.height;
412
+ // Animate from original position to expanded
413
+ const animation = eventTarget.animate([
414
+ {
415
+ transformOrigin: '0 0',
416
+ transform: `translate(${deltaX}px, ${deltaY}px) scale(${deltaW}, ${deltaH})`
417
+ },
418
+ {
419
+ transformOrigin: '0 0',
420
+ transform: 'translate(0px, 0px) scale(1, 1)'
421
+ }
422
+ ], {
423
+ duration: 350,
424
+ easing: 'cubic-bezier(0.4, 0.0, 0.2, 1)',
425
+ fill: 'both'
426
+ });
427
+ animation.finished.then(() => {
428
+ animation.cancel();
429
+ });
430
+ }
431
+ else {
432
+ // Collapsing: keep expanded state during animation, then remove
433
+ const last = {
434
+ left: first.left,
435
+ top: first.top,
436
+ width: first.width,
437
+ height: first.height
438
+ };
439
+ // Calculate where it will be after collapsing
440
+ eventTarget.dataset.expanded = 'false';
441
+ const final = eventTarget.getBoundingClientRect();
442
+ // Restore expanded state for animation
443
+ eventTarget.dataset.expanded = 'true';
444
+ const deltaX = final.left - last.left;
445
+ const deltaY = final.top - last.top;
446
+ const deltaW = final.width / last.width;
447
+ const deltaH = final.height / last.height;
448
+ // Animate from expanded to collapsed
449
+ const animation = eventTarget.animate([
450
+ {
451
+ transformOrigin: '0 0',
452
+ transform: 'translate(0px, 0px) scale(1, 1)'
453
+ },
454
+ {
455
+ transformOrigin: '0 0',
456
+ transform: `translate(${deltaX}px, ${deltaY}px) scale(${deltaW}, ${deltaH})`
457
+ }
458
+ ], {
459
+ duration: 350,
460
+ easing: 'cubic-bezier(0.4, 0.0, 0.2, 1)',
461
+ fill: 'both'
462
+ });
463
+ animation.finished.then(() => {
464
+ animation.cancel();
465
+ // Only remove expanded state after animation completes
466
+ if (!eventTarget)
467
+ return;
468
+ eventTarget.dataset.expanded = 'false';
469
+ eventTarget.parentElement.style.height = 'fit-content';
470
+ isExpanded = false;
471
+ zoomToFit();
472
+ });
473
+ }
474
+ };
475
+ async function toggleExpand() {
476
+ if (isExpanded)
477
+ return expand(false);
478
+ return expand(true);
479
+ }
480
+ function zoomToFit(padding = 0.05) {
481
+ if (!node)
482
+ return;
483
+ const parent = node.parentElement;
484
+ if (!parent)
485
+ return;
486
+ const parentRect = parent.getBoundingClientRect();
487
+ const rect = node.getBoundingClientRect();
488
+ // infer unscaled natural size by dividing by current scale
489
+ const naturalWidth = rect.width / scale || 0;
490
+ const naturalHeight = rect.height / scale || 0;
491
+ const targetWidth = parentRect.width * (1 - 2 * padding);
492
+ const targetHeight = parentRect.height * (1 - 2 * padding);
493
+ if (naturalWidth <= 0 || naturalHeight <= 0 || targetWidth <= 0 || targetHeight <= 0)
494
+ return;
495
+ const s = clampScale(Math.min(targetWidth / naturalWidth, targetHeight / naturalHeight));
496
+ // Temporarily apply scale with zero translate to measure new size
497
+ scale = s;
498
+ x = 0;
499
+ y = 0;
500
+ apply();
501
+ const newRect = node.getBoundingClientRect();
502
+ // compute centered position inside parent
503
+ const targetLeft = parentRect.left + (parentRect.width - newRect.width) / 2;
504
+ const targetTop = parentRect.top + (parentRect.height - newRect.height) / 2;
505
+ x = targetLeft - newRect.left;
506
+ y = targetTop - newRect.top;
507
+ apply();
508
+ }
509
+ function zoomBy(factor) {
510
+ if (!node)
511
+ return;
512
+ // Use zoomAt with the center of the container for consistent behavior
513
+ const owner = (eventTarget ?? node.parentElement ?? node);
514
+ const ownerRect = owner.getBoundingClientRect();
515
+ const cx = ownerRect.left + ownerRect.width / 2;
516
+ const cy = ownerRect.top + ownerRect.height / 2;
517
+ zoomAt(cx, cy, factor);
518
+ }
519
+ function moveBy(dx, dy) {
520
+ x += dx;
521
+ y += dy;
522
+ apply();
523
+ }
524
+ function zoomIn(factor = 1.25) {
525
+ zoomBy(factor);
526
+ }
527
+ function zoomOut(factor = 1.25) {
528
+ // zoom out by inverse multiplier
529
+ if (factor <= 0)
530
+ return;
531
+ zoomBy(1 / factor);
532
+ }
533
+ function setTransform(nx, ny, ns) {
534
+ scale = clampScale(ns);
535
+ x = nx;
536
+ y = ny;
537
+ apply();
538
+ }
539
+ return {
540
+ attach: internalAttach,
541
+ zoomToFit,
542
+ zoomBy,
543
+ zoomIn,
544
+ zoomOut,
545
+ moveBy,
546
+ setTransform,
547
+ expand,
548
+ toggleExpand,
549
+ get transform() {
550
+ return { x, y, scale };
551
+ },
552
+ get expanded() {
553
+ return isExpanded;
554
+ }
555
+ };
556
+ };
@@ -0,0 +1,2 @@
1
+ export { IncompleteMarkdownParser, type Plugin } from '@streamdown-svelte/remend';
2
+ export { createStreamdownIncompleteMarkdownParser, parseStreamdownIncompleteMarkdown as parseIncompleteMarkdown, repairIncompleteMarkdown } from '../streamdown/incomplete-markdown.js';
@@ -0,0 +1,2 @@
1
+ export { IncompleteMarkdownParser } from '@streamdown-svelte/remend';
2
+ export { createStreamdownIncompleteMarkdownParser, parseStreamdownIncompleteMarkdown as parseIncompleteMarkdown, repairIncompleteMarkdown } from '../streamdown/incomplete-markdown.js';
@@ -0,0 +1 @@
1
+ export declare function isTestMode(): boolean;
@@ -0,0 +1,13 @@
1
+ function hasVitestGlobal() {
2
+ const runtime = globalThis;
3
+ return '__vitest_browser__' in runtime || '__vitest_worker__' in runtime;
4
+ }
5
+ function hasProcessTestEnv() {
6
+ if (typeof process === 'undefined' || !process.env) {
7
+ return false;
8
+ }
9
+ return process.env.VITEST === 'true' || process.env.NODE_ENV === 'test';
10
+ }
11
+ export function isTestMode() {
12
+ return hasVitestGlobal() || hasProcessTestEnv();
13
+ }
@@ -0,0 +1 @@
1
+ export declare const save: (filename: string, content: string | Blob, mimeType: string) => void;
@@ -0,0 +1,14 @@
1
+ export const save = (filename, content, mimeType) => {
2
+ const blob = content instanceof Blob ? content : new Blob([content], { type: mimeType });
3
+ const url = URL.createObjectURL(blob);
4
+ const link = document.createElement('a');
5
+ link.href = url;
6
+ link.download = filename;
7
+ document.body.appendChild(link);
8
+ link.click();
9
+ document.body.removeChild(link);
10
+ // Revoke after the current task so browser downloads and Playwright probes can observe the blob URL.
11
+ setTimeout(() => {
12
+ URL.revokeObjectURL(url);
13
+ }, 0);
14
+ };
@@ -0,0 +1,2 @@
1
+ export declare function lockBodyScroll(targetDocument?: Document): () => void;
2
+ export declare function resetBodyScrollLocksForTests(targetDocument?: Document): void;
@@ -0,0 +1,35 @@
1
+ const scrollLockState = new WeakMap();
2
+ function getScrollLockState(targetDocument) {
3
+ let state = scrollLockState.get(targetDocument);
4
+ if (!state) {
5
+ state = {
6
+ count: 0,
7
+ previousOverflow: ''
8
+ };
9
+ scrollLockState.set(targetDocument, state);
10
+ }
11
+ return state;
12
+ }
13
+ export function lockBodyScroll(targetDocument = document) {
14
+ const state = getScrollLockState(targetDocument);
15
+ if (state.count === 0) {
16
+ state.previousOverflow = targetDocument.body.style.overflow;
17
+ targetDocument.body.style.overflow = 'hidden';
18
+ }
19
+ state.count += 1;
20
+ let released = false;
21
+ return () => {
22
+ if (released) {
23
+ return;
24
+ }
25
+ released = true;
26
+ state.count = Math.max(0, state.count - 1);
27
+ if (state.count === 0) {
28
+ targetDocument.body.style.overflow = state.previousOverflow;
29
+ }
30
+ };
31
+ }
32
+ export function resetBodyScrollLocksForTests(targetDocument = document) {
33
+ scrollLockState.delete(targetDocument);
34
+ targetDocument.body.style.overflow = '';
35
+ }
@@ -0,0 +1,8 @@
1
+ export interface TableData {
2
+ headers: string[];
3
+ rows: string[][];
4
+ }
5
+ export declare const extractTableDataFromElement: (tableElement: ParentNode) => TableData;
6
+ export declare const tableDataToCSV: ({ headers, rows }: TableData) => string;
7
+ export declare const tableDataToTSV: ({ headers, rows }: TableData) => string;
8
+ export declare const tableDataToMarkdown: ({ headers, rows }: TableData) => string;