@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
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { cn } from 'cn';
1
+ export { cn } from './classnames.js';
2
2
  export type SnippetLike = import('svelte').Snippet;
3
3
  export declare function stopPropagation(event: Event): void;
4
4
  export declare function isPromiseLike(value: unknown): value is PromiseLike<unknown>;
package/dist/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- export { cn } from 'cn';
1
+ export { cn } from './classnames.js';
2
2
  const RESOURCE_PROTOCOLS = new Set(['http:', 'https:', 'blob:']);
3
3
  export function stopPropagation(event) {
4
4
  event.stopPropagation();
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@svadmin/ai-elements",
3
- "version": "0.5.1",
3
+ "version": "0.8.0",
4
4
  "description": "Composable Svelte 5 AI interaction components for SVAdmin",
5
5
  "type": "module",
6
6
  "sideEffects": [
7
- "./dist/ai.css",
8
- "./dist/ai.theme.css"
7
+ "./dist/*.css",
8
+ "./vendor/**/*.css"
9
9
  ],
10
10
  "files": [
11
11
  "dist",
12
12
  "README.md",
13
- "UPSTREAM_PARITY.md",
14
13
  "THIRD_PARTY_NOTICES.md",
15
14
  "!dist/**/*.test.*",
16
15
  "!dist/**/*.test-*",
17
16
  "!dist/**/*.spec.*",
18
- "!dist/**/*.spec-*"
17
+ "!dist/**/*.spec-*",
18
+ "vendor"
19
19
  ],
20
20
  "main": "dist/index.js",
21
21
  "types": "dist/index.d.ts",
@@ -32,10 +32,6 @@
32
32
  "import": "./dist/ai.css",
33
33
  "default": "./dist/ai.css"
34
34
  },
35
- "./ai.theme.css": {
36
- "style": "./dist/ai.theme.css",
37
- "default": "./dist/ai.theme.css"
38
- },
39
35
  "./components/*.svelte": {
40
36
  "types": "./dist/components/*.svelte.d.ts",
41
37
  "svelte": "./dist/components/*.svelte",
@@ -53,10 +49,14 @@
53
49
  "./parity": {
54
50
  "types": "./dist/parity-manifest.d.ts",
55
51
  "default": "./dist/parity-manifest.js"
52
+ },
53
+ "./ai.theme.css": {
54
+ "style": "./dist/ai.theme.css",
55
+ "default": "./dist/ai.theme.css"
56
56
  }
57
57
  },
58
58
  "peerDependencies": {
59
- "@svadmin/core": "^0.50.0",
59
+ "@svadmin/core": "^0.53.0",
60
60
  "@tanstack/svelte-query": "^6.1.48",
61
61
  "svelte": "^5.56.10"
62
62
  },
@@ -70,31 +70,46 @@
70
70
  "@rive-app/webgl2": "^2.41.0",
71
71
  "@sinclair/typebox": "^0.34.52",
72
72
  "@xyflow/svelte": "^1.6.5",
73
- "cn": "^0.2.4",
74
- "streamdown-svelte": "^3.0.6"
73
+ "type-fest": "^4.41.0",
74
+ "clsx": "^2.1.1",
75
+ "@floating-ui/dom": "^1.7.4",
76
+ "@shikijs/langs": "^3.17.1",
77
+ "@shikijs/themes": "^3.17.1",
78
+ "esm-env": "^1.2.2",
79
+ "katex": "^0.16.22",
80
+ "marked": "^16.2.1",
81
+ "mermaid": "^11.11.0",
82
+ "rehype-harden": "^1.1.8",
83
+ "rehype-raw": "^7.0.0",
84
+ "rehype-sanitize": "^6.0.0",
85
+ "rehype-stringify": "^10.0.1",
86
+ "remark-cjk-friendly": "^2.0.1",
87
+ "remark-cjk-friendly-gfm-strikethrough": "^2.0.1",
88
+ "remark-gfm": "^4.0.1",
89
+ "remark-parse": "^11.0.0",
90
+ "remark-rehype": "^11.1.2",
91
+ "shiki": "^3.13.0",
92
+ "unified": "^11.0.5",
93
+ "unist-util-visit": "^5.1.0",
94
+ "@streamdown-svelte/plugin-core": "1.0.0",
95
+ "@streamdown-svelte/remend": "1.3.0"
75
96
  },
76
97
  "devDependencies": {
77
98
  "@happy-dom/global-registrator": "^20.11.12",
78
99
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
79
- "@tailwindcss/node": "^4.3.3",
80
- "@tailwindcss/oxide": "^4.3.3",
81
100
  "@testing-library/dom": "^10.4.1",
82
101
  "@testing-library/svelte": "^5.4.2",
83
102
  "@testing-library/user-event": "^14.6.6",
84
- "@types/bun": "^1.4.0",
103
+ "@types/bun": "^1.4.2",
85
104
  "happy-dom": "^20.11.12",
86
- "postcss": "^8.5.26",
87
- "tailwind-variants": "^3.3.1",
88
- "tailwindcss": "^4.3.3",
89
- "tw-animate-css": "^1.4.0",
90
105
  "vitest": "^4.1.11"
91
106
  },
92
107
  "scripts": {
93
- "build": "node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && bun scripts/clean-dist.ts && node scripts/build-static-css.mjs",
108
+ "build": "node ../../scripts/build-migrated-ui.mjs ai-elements && node ../../scripts/build-native-classnames.mjs ai-elements && node ../../node_modules/@sveltejs/package/svelte-package.js -i src -o dist && bun scripts/clean-dist.ts",
94
109
  "check": "svelte-check --tsgo-experimental-api --tsconfig ./tsconfig.json --threshold error",
95
110
  "test": "vitest run --config ./vitest.config.ts && bun test scripts/clean-dist.test.ts scripts/audit-upstream-parity.test.ts",
96
- "test:css": "node --test scripts/static-css.test.mjs",
97
- "audit:upstream": "bun scripts/audit-upstream-parity.ts"
111
+ "audit:upstream": "bun scripts/audit-upstream-parity.ts",
112
+ "styles:migrated:check": "node ../../scripts/build-migrated-ui.mjs ai-elements --check"
98
113
  },
99
114
  "license": "MIT",
100
115
  "publishConfig": {
@@ -0,0 +1,93 @@
1
+ <script lang="ts">
2
+ import { useStreamdown } from './context.svelte.js';
3
+ let { text }: { text: string } = $props();
4
+
5
+ const streamdown = useStreamdown();
6
+ const whitespaceOnlyPattern = /^\s+$/;
7
+ let previousRenderedLength = $state(0);
8
+ let committedText = $state('');
9
+
10
+ const tokenizeNewContent = (text: string) => {
11
+ if (!text) return [];
12
+
13
+ let splitRegex;
14
+ if (streamdown.animation.tokenize === 'word') {
15
+ splitRegex = /(\s+)/;
16
+ } else {
17
+ splitRegex = /(.)/;
18
+ }
19
+
20
+ return text.split(splitRegex).filter((token) => token.length > 0);
21
+ };
22
+
23
+ const tokens = $derived.by(() => {
24
+ let cursor = 0;
25
+ let newAnimatedTokenIndex = 0;
26
+ const stagger = streamdown.animation.stagger ?? 0;
27
+
28
+ return tokenizeNewContent(text).map((token) => {
29
+ const start = cursor;
30
+ cursor += token.length;
31
+
32
+ if (whitespaceOnlyPattern.test(token)) {
33
+ return {
34
+ content: token,
35
+ animated: false,
36
+ style: undefined
37
+ };
38
+ }
39
+
40
+ const isAlreadyRendered = previousRenderedLength > 0 && start < previousRenderedLength;
41
+ const duration = isAlreadyRendered ? 0 : streamdown.animation.duration;
42
+ const delay = !isAlreadyRendered && stagger > 0 ? newAnimatedTokenIndex * stagger : 0;
43
+
44
+ if (!isAlreadyRendered) {
45
+ newAnimatedTokenIndex += 1;
46
+ }
47
+
48
+ return {
49
+ content: token,
50
+ animated: true,
51
+ style: `--sd-animation:sd-${streamdown.animation.type};
52
+ --sd-duration:${duration}ms;
53
+ --sd-easing:${streamdown.animation.timingFunction};
54
+ ${delay > 0 ? `--sd-delay:${delay}ms;\n` : ''}animation-name: var(--sd-animation);
55
+ animation-duration: var(--sd-duration);
56
+ animation-timing-function: var(--sd-easing);
57
+ animation-delay: var(--sd-delay, 0ms);
58
+ animation-iteration-count: 1;
59
+ animation-fill-mode: forwards;
60
+ white-space: pre-wrap;
61
+ display: inline-block;
62
+ text-decoration: inherit;`
63
+ };
64
+ });
65
+ });
66
+
67
+ $effect(() => {
68
+ if (!(streamdown.animation.enabled && streamdown.isAnimating)) {
69
+ previousRenderedLength = 0;
70
+ committedText = '';
71
+ return;
72
+ }
73
+
74
+ if (text !== committedText) {
75
+ previousRenderedLength = committedText.length;
76
+ committedText = text;
77
+ }
78
+ });
79
+ </script>
80
+
81
+ {#if streamdown.animation.enabled}
82
+ {#each tokens as token}
83
+ {#if token.animated}
84
+ <span data-streamdown-animate="" style={token.style}>
85
+ {token.content}
86
+ </span>
87
+ {:else}
88
+ {token.content}
89
+ {/if}
90
+ {/each}
91
+ {:else}
92
+ {text}
93
+ {/if}
@@ -0,0 +1,6 @@
1
+ type $$ComponentProps = {
2
+ text: string;
3
+ };
4
+ declare const AnimatedText: import("svelte").Component<$$ComponentProps, {}, "">;
5
+ type AnimatedText = ReturnType<typeof AnimatedText>;
6
+ export default AnimatedText;
@@ -0,0 +1,96 @@
1
+ <script lang="ts">
2
+ import { setContext } from 'svelte';
3
+ import BlockTokens from './block/BlockTokens.svelte';
4
+ import { renderBlockHtml } from './block/html.js';
5
+ import { useStreamdown } from './context.svelte.js';
6
+ import { filterMarkdownTokens } from './markdown.js';
7
+ import { lex, type StreamdownToken } from './marked/index.js';
8
+ import { applyPluginMarkdownTransforms } from './plugins.js';
9
+ import { repairIncompleteMarkdown } from './streamdown/incomplete-markdown.js';
10
+ import { detectTextDirection } from './utils/detectDirection.js';
11
+ import { hasIncompleteCodeFence, STREAMDOWN_BLOCK_CONTEXT } from './incomplete-code.js';
12
+
13
+ let {
14
+ block,
15
+ static: isStatic = false,
16
+ tokens: providedTokens,
17
+ parseIncompleteMarkdown: shouldParseIncompleteMarkdown = true,
18
+ isIncomplete = false
19
+ }: {
20
+ block: string;
21
+ static?: boolean;
22
+ tokens?: StreamdownToken[];
23
+ parseIncompleteMarkdown?: boolean;
24
+ isIncomplete?: boolean;
25
+ } = $props();
26
+
27
+ const streamdown = useStreamdown();
28
+ const repairedBlock = $derived.by(() => {
29
+ if (providedTokens) {
30
+ return block;
31
+ }
32
+
33
+ if (isStatic || !shouldParseIncompleteMarkdown || streamdown.parseIncompleteMarkdown === false) {
34
+ return block;
35
+ }
36
+
37
+ return repairIncompleteMarkdown(block, streamdown.remend);
38
+ });
39
+ const markdown = $derived(applyPluginMarkdownTransforms(repairedBlock, streamdown.plugins));
40
+ const isIncompleteCodeFence = $derived(
41
+ streamdown.isAnimating && !isStatic && hasIncompleteCodeFence(block)
42
+ );
43
+ const tokens = $derived(
44
+ filterMarkdownTokens(providedTokens ?? lex(markdown, streamdown.extensions), {
45
+ allowedElements: streamdown.allowedElements,
46
+ allowElement: streamdown.allowElement,
47
+ disallowedElements: streamdown.disallowedElements,
48
+ skipHtml: streamdown.skipHtml,
49
+ unwrapDisallowed: streamdown.unwrapDisallowed
50
+ })
51
+ );
52
+ const securityHtmlBlock = $derived.by(() => {
53
+ return renderBlockHtml(markdown, {
54
+ allowedImagePrefixes: streamdown.allowedImagePrefixes,
55
+ allowedLinkPrefixes: streamdown.allowedLinkPrefixes,
56
+ allowedTags: streamdown.allowedTags,
57
+ defaultOrigin: streamdown.defaultOrigin,
58
+ renderHtml: streamdown.renderHtml,
59
+ skipHtml: streamdown.skipHtml,
60
+ urlTransform: streamdown.urlTransform
61
+ });
62
+ });
63
+
64
+ const dir = $derived.by(() => {
65
+ if (!streamdown.dir) {
66
+ return undefined;
67
+ }
68
+
69
+ if (streamdown.dir === 'auto') {
70
+ return detectTextDirection(markdown);
71
+ }
72
+
73
+ return streamdown.dir;
74
+ });
75
+
76
+ setContext(STREAMDOWN_BLOCK_CONTEXT, {
77
+ get isIncompleteCodeFence() {
78
+ return isIncompleteCodeFence;
79
+ },
80
+ get rawBlock() {
81
+ return block;
82
+ }
83
+ });
84
+ </script>
85
+
86
+ {#if securityHtmlBlock !== null}
87
+ {@html securityHtmlBlock}
88
+ {:else}
89
+ {#if dir}
90
+ <div data-streamdown-dir={dir} {dir} style="display: contents;">
91
+ <BlockTokens {tokens} {isIncomplete} {isStatic} />
92
+ </div>
93
+ {:else}
94
+ <BlockTokens {tokens} {isIncomplete} {isStatic} />
95
+ {/if}
96
+ {/if}
@@ -0,0 +1,11 @@
1
+ import { type StreamdownToken } from './marked/index.js';
2
+ type $$ComponentProps = {
3
+ block: string;
4
+ static?: boolean;
5
+ tokens?: StreamdownToken[];
6
+ parseIncompleteMarkdown?: boolean;
7
+ isIncomplete?: boolean;
8
+ };
9
+ declare const Block: import("svelte").Component<$$ComponentProps, {}, "">;
10
+ type Block = ReturnType<typeof Block>;
11
+ export default Block;
@@ -0,0 +1,69 @@
1
+ <script lang="ts">
2
+ const icons = {
3
+ note: `<circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" />`,
4
+ caution: `<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>`,
5
+ important: `<path
6
+ d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"
7
+ /><path d="M7 11h10" /><path d="M7 15h6" /><path d="M7 7h8" />`,
8
+ tip: `<path
9
+ d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"
10
+ /><path d="M9 18h6" /><path d="M10 22h4" />`,
11
+ warning: `<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /><path
12
+ d="M12 9v4"
13
+ /><path d="M12 17h.01" />`
14
+ };
15
+
16
+ import { useStreamdown } from '../context.svelte.js';
17
+ import { resolveIcon } from './icons.js';
18
+ import Slot from './Slot.svelte';
19
+ import type { AlertToken } from '../marked/index.js';
20
+ import type { Snippet } from 'svelte';
21
+
22
+ const streamdown = useStreamdown();
23
+
24
+ const {
25
+ children,
26
+ token,
27
+ id
28
+ }: {
29
+ id: string;
30
+ children: Snippet;
31
+ token: AlertToken;
32
+ } = $props();
33
+ </script>
34
+
35
+ <Slot
36
+ props={{
37
+ children,
38
+ token
39
+ }}
40
+ render={streamdown.snippets.alert}
41
+ >
42
+ <div
43
+ data-streamdown-alert={id}
44
+ style={streamdown.isMounted ? streamdown.animationBlockStyle : ''}
45
+ class={`${streamdown.theme.alert.base} ${streamdown.theme.alert[token.variant]}`}
46
+ >
47
+ <div data-alert-title class={streamdown.theme.alert.title}>
48
+ {@render resolveIcon(streamdown.icons, token.variant, icon)()}
49
+ {streamdown.translations?.alert?.[token.variant] || token.variant}
50
+ </div>
51
+ {@render children()}
52
+ </div>
53
+ </Slot>
54
+
55
+ {#snippet icon()}
56
+ <svg
57
+ xmlns="http://www.w3.org/2000/svg"
58
+ width="24"
59
+ height="24"
60
+ viewBox="0 0 24 24"
61
+ fill="none"
62
+ stroke-width="2"
63
+ stroke-linecap="round"
64
+ stroke-linejoin="round"
65
+ class={streamdown.theme.alert.icon}
66
+ >
67
+ {@html icons[token.variant]}
68
+ </svg>
69
+ {/snippet}
@@ -0,0 +1,10 @@
1
+ import type { AlertToken } from '../marked/index.js';
2
+ import type { Snippet } from 'svelte';
3
+ type $$ComponentProps = {
4
+ id: string;
5
+ children: Snippet;
6
+ token: AlertToken;
7
+ };
8
+ declare const Alert: import("svelte").Component<$$ComponentProps, {}, "">;
9
+ type Alert = ReturnType<typeof Alert>;
10
+ export default Alert;
@@ -0,0 +1,260 @@
1
+ <script lang="ts">
2
+ import { useStreamdown } from '../context.svelte.js';
3
+ import Slot from './Slot.svelte';
4
+ import { useClickOutside } from '../utils/useClickOutside.svelte.js';
5
+ import { scale } from 'svelte/transition';
6
+ import Block from '../Block.svelte';
7
+ import { useKeyDown } from '../utils/useKeyDown.svelte.js';
8
+ import type { CitationToken } from '../marked/marked-citations.js';
9
+ import { StepperState } from './stepperState.svelte.js';
10
+ import { Popover } from './popover.svelte.js';
11
+ import { get } from '../utils/get.js';
12
+ import { chevronLeft, chevronRight, resolveIcon } from './icons.js';
13
+
14
+ const {
15
+ token
16
+ }: {
17
+ token: CitationToken;
18
+ } = $props();
19
+ const streamdown = useStreamdown();
20
+ const id = $props.id();
21
+ const popover = new Popover();
22
+
23
+ const citationWithSources = $derived.by(() => {
24
+ return token.keys.reduce((acc, key) => {
25
+ const source = get<Record<string, any>>(streamdown.sources, key);
26
+ const safeUrl = (url: string | null) => {
27
+ if (url == null) return null;
28
+ try {
29
+ return new URL(url);
30
+ } catch (error) {
31
+ return null;
32
+ }
33
+ };
34
+ if (source) {
35
+ const url = safeUrl(source.url ?? source.href ?? source.link ?? source.source);
36
+ acc.push({
37
+ key,
38
+ title: source.title ?? source.name ?? source.author ?? null,
39
+ url,
40
+ host: url ? url.host.replace('www.', '') : null,
41
+ favicon: url ? `https://www.google.com/s2/favicons?domain=${url.hostname}&sz=128` : null,
42
+ content: source.content ?? source.text ?? source.summary ?? source.excerpt ?? null,
43
+ source
44
+ });
45
+ }
46
+ return acc;
47
+ }, [] as CitationWithSource[]);
48
+ });
49
+ useKeyDown({
50
+ keys: ['Escape'],
51
+ get isActive() {
52
+ return popover.isOpen;
53
+ },
54
+ callback: () => {
55
+ popover.isOpen = false;
56
+ }
57
+ });
58
+ const clickOutside = useClickOutside({
59
+ get isActive() {
60
+ return popover.isOpen;
61
+ },
62
+ callback: () => {
63
+ popover.isOpen = false;
64
+ }
65
+ });
66
+
67
+ const stepper = new StepperState({
68
+ get items() {
69
+ return citationWithSources;
70
+ },
71
+ keyFramesOptions: { duration: 200, easing: 'ease-in-out', fill: 'forwards' }
72
+ });
73
+
74
+ type CitationWithSource = Record<string, any> & {
75
+ key: string;
76
+ title: string | null;
77
+ url: URL | null;
78
+ favicon: string | null;
79
+ content: string | null;
80
+ source: Record<string, any>;
81
+ };
82
+ </script>
83
+
84
+ {#if popover.isOpen}
85
+ <dialog
86
+ data-streamdown-citation-popover={id}
87
+ id={'citation-popover-' + id}
88
+ aria-modal="false"
89
+ transition:scale|global={{ start: 0.95, duration: 200 }}
90
+ {@attach clickOutside.attachment}
91
+ {@attach popover.popoverAttachment}
92
+ open
93
+ class={`${streamdown.theme.components.popover}`}
94
+ style:max-width="400px"
95
+ >
96
+ <Slot
97
+ props={{
98
+ token,
99
+ isOpen: popover.isOpen
100
+ }}
101
+ render={streamdown.snippets.inlineCitationPopover}
102
+ >
103
+ {#if streamdown.inlineCitationsMode === 'carousel'}
104
+ {@render carouselView()}
105
+ {:else}
106
+ {@render listView()}
107
+ {/if}
108
+ </Slot>
109
+ </dialog>
110
+ {/if}
111
+
112
+ {#snippet listView()}
113
+ <div class={streamdown.theme.inlineCitation.list.base}>
114
+ {#each citationWithSources as { favicon, key, source, title, url }}
115
+ <Slot render={streamdown.snippets.inlineCitationContent} props={{ source, key, token }}>
116
+ <a
117
+ class={streamdown.theme.inlineCitation.list.item}
118
+ href={url?.toString()}
119
+ target="_blank"
120
+ rel="noopener noreferrer"
121
+ >
122
+ {#if title}
123
+ <span class={streamdown.theme.inlineCitation.list.title}>{title}</span>
124
+ {/if}
125
+ {#if url}
126
+ <span class={streamdown.theme.inlineCitation.list.url}>
127
+ {#if favicon}
128
+ <img
129
+ src={favicon}
130
+ alt={title || url.host}
131
+ class={streamdown.theme.inlineCitation.list.favicon}
132
+ />
133
+ {/if}
134
+ {url.host}{url.pathname === '/' ? '' : url.pathname}
135
+ </span>
136
+ {/if}
137
+ </a>
138
+ </Slot>
139
+ {/each}
140
+ </div>
141
+ {/snippet}
142
+
143
+ {#snippet carouselView()}
144
+ {#if citationWithSources.length > 1}
145
+ <div class={streamdown.theme.inlineCitation.carousel.header}>
146
+ <div class={streamdown.theme.inlineCitation.carousel.stepCounter}>
147
+ {stepper.activeStep + 1}
148
+ / {citationWithSources.length}
149
+ </div>
150
+ <div class={streamdown.theme.inlineCitation.carousel.buttons}>
151
+ <button
152
+ disabled={!stepper.canGoPrevious}
153
+ class={streamdown.theme.components.button}
154
+ onclick={() => stepper.previous()}
155
+ >
156
+ {@render resolveIcon(streamdown.icons, 'chevronLeft', chevronLeft)()}
157
+ </button>
158
+ <button
159
+ disabled={!stepper.canGoNext}
160
+ class={streamdown.theme.components.button}
161
+ onclick={() => stepper.next()}
162
+ >
163
+ {@render resolveIcon(streamdown.icons, 'chevronRight', chevronRight)()}
164
+ </button>
165
+ </div>
166
+ </div>
167
+ {/if}
168
+ <div
169
+ use:stepper.scroller
170
+ style:height={Number.isFinite(stepper.stepHeights[stepper.activeStep])
171
+ ? `${stepper.stepHeights[stepper.activeStep]}px`
172
+ : 'auto'}
173
+ style:overflow="hidden"
174
+ style:position="relative"
175
+ style:transition-duration="200ms"
176
+ style:transition-timing-function="ease-in-out"
177
+ aria-label="Citations-${id}"
178
+ >
179
+ <div
180
+ bind:this={stepper.stepContainer}
181
+ style:display="grid"
182
+ style:transition-duration={`${200}ms`}
183
+ style:width="100%"
184
+ style:grid-template-columns="repeat({citationWithSources.length}, 100%)"
185
+ >
186
+ {#each citationWithSources as { favicon, key, source, title, url, content }, index}
187
+ <div
188
+ bind:offsetHeight={stepper.stepHeights[index]}
189
+ data-step={index}
190
+ tabindex={stepper.activeStep === index ? 0 : -1}
191
+ inert={stepper.activeStep !== index}
192
+ role="tabpanel"
193
+ style:height="fit-content"
194
+ style:width="100%"
195
+ style:flex-grow="1"
196
+ aria-label="Citation-${id}"
197
+ >
198
+ <Slot render={streamdown.snippets.inlineCitationContent} props={{ source, key, token }}>
199
+ {#if url || title}
200
+ <div class="mb-4">
201
+ {#if title}
202
+ <div class={streamdown.theme.inlineCitation.carousel.title}>
203
+ {title}
204
+ </div>
205
+ {/if}
206
+ {#if url}
207
+ <a
208
+ href={url.toString()}
209
+ target="_blank"
210
+ rel="noopener noreferrer"
211
+ class={streamdown.theme.inlineCitation.carousel.url}
212
+ >
213
+ {#if favicon}
214
+ <img
215
+ src={favicon}
216
+ alt={title || url.host}
217
+ class={streamdown.theme.inlineCitation.carousel.favicon}
218
+ />
219
+ {/if}
220
+ <!-- Skip search params -->
221
+ {url.host}{url.pathname === '/' ? '' : url.pathname}
222
+ </a>
223
+ {/if}
224
+ </div>
225
+ {/if}
226
+ {#if content}
227
+ <Block block={content} />
228
+ {/if}
229
+ </Slot>
230
+ </div>
231
+ {/each}
232
+ </div>
233
+ </div>
234
+ {/snippet}
235
+
236
+ {#if citationWithSources.length > 0}
237
+ <button
238
+ data-streamdown-citation-preview={id}
239
+ style={streamdown.animationBlockStyle}
240
+ bind:this={popover.reference}
241
+ class={streamdown.theme.inlineCitation.preview}
242
+ onclick={() => (popover.isOpen = !popover.isOpen)}
243
+ aria-expanded={popover.isOpen}
244
+ aria-haspopup="dialog"
245
+ aria-controls={'citation-popover-' + id}
246
+ {@attach clickOutside.attachment}
247
+ >
248
+ <Slot
249
+ render={streamdown.snippets.inlineCitationPreview}
250
+ props={{
251
+ token
252
+ }}
253
+ >
254
+ {citationWithSources[0]?.url?.host ??
255
+ citationWithSources[0]?.title ??
256
+ citationWithSources[0]?.key}
257
+ {citationWithSources.length > 1 ? ` +${citationWithSources.length - 1}` : ''}
258
+ </Slot>
259
+ </button>
260
+ {/if}
@@ -0,0 +1,7 @@
1
+ import type { CitationToken } from '../marked/marked-citations.js';
2
+ type $$ComponentProps = {
3
+ token: CitationToken;
4
+ };
5
+ declare const Citation: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type Citation = ReturnType<typeof Citation>;
7
+ export default Citation;