@chatsdk-dev/ui 0.0.1 → 0.1.3

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 (468) hide show
  1. package/README.md +7 -7
  2. package/dist/atoms/accordion.d.ts +7 -0
  3. package/dist/atoms/accordion.d.ts.map +1 -0
  4. package/dist/atoms/accordion.js +18 -0
  5. package/dist/atoms/alert-dialog.d.ts +19 -0
  6. package/dist/atoms/alert-dialog.d.ts.map +1 -0
  7. package/dist/atoms/alert-dialog.js +42 -0
  8. package/dist/atoms/alert.d.ts +11 -0
  9. package/dist/atoms/alert.d.ts.map +1 -0
  10. package/dist/atoms/alert.js +27 -0
  11. package/dist/atoms/avatar.d.ts +12 -0
  12. package/dist/atoms/avatar.d.ts.map +1 -0
  13. package/dist/atoms/avatar.js +23 -0
  14. package/dist/atoms/badge.d.ts +8 -0
  15. package/dist/atoms/badge.d.ts.map +1 -0
  16. package/dist/atoms/badge.js +44 -0
  17. package/dist/atoms/button-group.d.ts +11 -0
  18. package/dist/atoms/button-group.d.ts.map +1 -0
  19. package/dist/atoms/button-group.js +36 -0
  20. package/dist/atoms/button-loader.d.ts +9 -0
  21. package/dist/atoms/button-loader.d.ts.map +1 -0
  22. package/dist/atoms/button-loader.js +10 -0
  23. package/dist/atoms/button.d.ts +9 -0
  24. package/dist/atoms/button.d.ts.map +1 -0
  25. package/dist/atoms/button.js +32 -0
  26. package/dist/atoms/card.d.ts +12 -0
  27. package/dist/atoms/card.d.ts.map +1 -0
  28. package/dist/atoms/card.js +25 -0
  29. package/dist/atoms/carousel.d.ts +29 -0
  30. package/dist/atoms/carousel.d.ts.map +1 -0
  31. package/dist/atoms/carousel.js +91 -0
  32. package/dist/atoms/collapsible.d.ts +6 -0
  33. package/dist/atoms/collapsible.d.ts.map +1 -0
  34. package/dist/atoms/collapsible.js +13 -0
  35. package/dist/atoms/command.d.ts +20 -0
  36. package/dist/atoms/command.d.ts.map +1 -0
  37. package/dist/atoms/command.js +35 -0
  38. package/dist/atoms/container.d.ts +8 -0
  39. package/dist/atoms/container.d.ts.map +1 -0
  40. package/dist/atoms/container.js +5 -0
  41. package/dist/atoms/dialog.d.ts +19 -0
  42. package/dist/atoms/dialog.d.ts.map +1 -0
  43. package/dist/atoms/dialog.js +38 -0
  44. package/dist/atoms/dots-loader.d.ts +15 -0
  45. package/dist/atoms/dots-loader.d.ts.map +1 -0
  46. package/dist/atoms/dots-loader.js +21 -0
  47. package/dist/atoms/drawer.d.ts +14 -0
  48. package/dist/atoms/drawer.d.ts.map +1 -0
  49. package/dist/atoms/drawer.js +35 -0
  50. package/dist/atoms/dropdown-menu.d.ts +26 -0
  51. package/dist/atoms/dropdown-menu.d.ts.map +1 -0
  52. package/dist/atoms/dropdown-menu.js +51 -0
  53. package/dist/atoms/empty.d.ts +12 -0
  54. package/dist/atoms/empty.d.ts.map +1 -0
  55. package/dist/atoms/empty.js +33 -0
  56. package/dist/atoms/field.d.ts +25 -0
  57. package/dist/atoms/field.d.ts.map +1 -0
  58. package/dist/atoms/field.js +68 -0
  59. package/dist/atoms/form.d.ts +23 -0
  60. package/dist/atoms/form.d.ts.map +1 -0
  61. package/dist/atoms/form.js +68 -0
  62. package/dist/atoms/header.d.ts +6 -0
  63. package/dist/atoms/header.d.ts.map +1 -0
  64. package/dist/atoms/header.js +6 -0
  65. package/dist/atoms/hover-card.d.ts +6 -0
  66. package/dist/atoms/hover-card.d.ts.map +1 -0
  67. package/dist/atoms/hover-card.js +14 -0
  68. package/dist/atoms/index.d.ts +5 -0
  69. package/dist/atoms/index.d.ts.map +1 -0
  70. package/dist/atoms/index.js +5 -0
  71. package/dist/atoms/input-group.d.ts +19 -0
  72. package/dist/atoms/input-group.d.ts.map +1 -0
  73. package/dist/atoms/input-group.js +57 -0
  74. package/dist/atoms/input.d.ts +7 -0
  75. package/dist/atoms/input.d.ts.map +1 -0
  76. package/dist/atoms/input.js +6 -0
  77. package/dist/atoms/label.d.ts +3 -0
  78. package/dist/atoms/label.d.ts.map +1 -0
  79. package/dist/atoms/label.js +7 -0
  80. package/dist/atoms/logo.d.ts +7 -0
  81. package/dist/atoms/logo.d.ts.map +1 -0
  82. package/dist/atoms/logo.js +6 -0
  83. package/dist/atoms/number-flow.d.ts +3 -0
  84. package/dist/atoms/number-flow.d.ts.map +1 -0
  85. package/dist/atoms/number-flow.js +6 -0
  86. package/dist/atoms/popover.d.ts +10 -0
  87. package/dist/atoms/popover.d.ts.map +1 -0
  88. package/dist/atoms/popover.js +23 -0
  89. package/dist/atoms/progress.d.ts +8 -0
  90. package/dist/atoms/progress.d.ts.map +1 -0
  91. package/dist/atoms/progress.js +20 -0
  92. package/dist/atoms/radio-group.d.ts +6 -0
  93. package/dist/atoms/radio-group.d.ts.map +1 -0
  94. package/dist/atoms/radio-group.js +13 -0
  95. package/dist/atoms/scroll-area.d.ts +5 -0
  96. package/dist/atoms/scroll-area.d.ts.map +1 -0
  97. package/dist/atoms/scroll-area.js +11 -0
  98. package/dist/atoms/select.d.ts +17 -0
  99. package/dist/atoms/select.d.ts.map +1 -0
  100. package/dist/atoms/select.js +34 -0
  101. package/dist/atoms/separator.d.ts +3 -0
  102. package/dist/atoms/separator.d.ts.map +1 -0
  103. package/dist/atoms/separator.js +7 -0
  104. package/dist/atoms/sheet.d.ts +15 -0
  105. package/dist/atoms/sheet.d.ts.map +1 -0
  106. package/dist/atoms/sheet.js +37 -0
  107. package/dist/atoms/sidebar.d.ts +65 -0
  108. package/dist/atoms/sidebar.d.ts.map +1 -0
  109. package/dist/atoms/sidebar.js +258 -0
  110. package/dist/atoms/skeleton.d.ts +2 -0
  111. package/dist/atoms/skeleton.d.ts.map +1 -0
  112. package/dist/atoms/skeleton.js +5 -0
  113. package/dist/atoms/spinner.d.ts +3 -0
  114. package/dist/atoms/spinner.d.ts.map +1 -0
  115. package/dist/atoms/spinner.js +7 -0
  116. package/dist/atoms/switch.d.ts +5 -0
  117. package/dist/atoms/switch.d.ts.map +1 -0
  118. package/dist/atoms/switch.js +7 -0
  119. package/dist/atoms/table.d.ts +13 -0
  120. package/dist/atoms/table.d.ts.map +1 -0
  121. package/dist/atoms/table.js +28 -0
  122. package/dist/atoms/tabs.d.ts +12 -0
  123. package/dist/atoms/tabs.d.ts.map +1 -0
  124. package/dist/atoms/tabs.js +32 -0
  125. package/dist/atoms/textarea.d.ts +3 -0
  126. package/dist/atoms/textarea.d.ts.map +1 -0
  127. package/dist/atoms/textarea.js +5 -0
  128. package/dist/atoms/toggle.d.ts +9 -0
  129. package/dist/atoms/toggle.d.ts.map +1 -0
  130. package/dist/atoms/toggle.js +26 -0
  131. package/dist/atoms/tooltip.d.ts +7 -0
  132. package/dist/atoms/tooltip.d.ts.map +1 -0
  133. package/dist/atoms/tooltip.js +17 -0
  134. package/dist/atoms/typography/h1.d.ts +10 -0
  135. package/dist/atoms/typography/h1.d.ts.map +1 -0
  136. package/dist/atoms/typography/h1.js +6 -0
  137. package/dist/atoms/typography/paragraph.d.ts +6 -0
  138. package/dist/atoms/typography/paragraph.d.ts.map +1 -0
  139. package/dist/atoms/typography/paragraph.js +6 -0
  140. package/dist/atoms/typography/text.d.ts +14 -0
  141. package/dist/atoms/typography/text.d.ts.map +1 -0
  142. package/dist/atoms/typography/text.js +41 -0
  143. package/dist/components/responsive-alert-dialog.d.ts +16 -0
  144. package/dist/components/responsive-alert-dialog.d.ts.map +1 -0
  145. package/dist/components/responsive-alert-dialog.js +20 -0
  146. package/dist/components/responsive-dialog.d.ts +11 -0
  147. package/dist/components/responsive-dialog.d.ts.map +1 -0
  148. package/dist/components/responsive-dialog.js +21 -0
  149. package/dist/hooks/use-copy-to-clipboard.d.ts +2 -0
  150. package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
  151. package/dist/hooks/use-copy-to-clipboard.js +31 -0
  152. package/dist/index.css +1580 -39
  153. package/dist/molecules/actions.d.ts +10 -0
  154. package/dist/molecules/actions.d.ts.map +1 -0
  155. package/dist/molecules/actions.js +13 -0
  156. package/dist/molecules/agent.d.ts +27 -0
  157. package/dist/molecules/agent.d.ts.map +1 -0
  158. package/dist/molecules/agent.js +27 -0
  159. package/dist/molecules/ai/actions.d.ts +10 -0
  160. package/dist/molecules/ai/actions.d.ts.map +1 -0
  161. package/dist/molecules/ai/actions.js +13 -0
  162. package/dist/molecules/ai/agent.d.ts +27 -0
  163. package/dist/molecules/ai/agent.d.ts.map +1 -0
  164. package/dist/molecules/ai/agent.js +27 -0
  165. package/dist/molecules/ai/artifact.d.ts +24 -0
  166. package/dist/molecules/ai/artifact.d.ts.map +1 -0
  167. package/dist/molecules/ai/artifact.js +20 -0
  168. package/dist/molecules/ai/attachments.d.ts +55 -0
  169. package/dist/molecules/ai/attachments.d.ts.map +1 -0
  170. package/dist/molecules/ai/attachments.js +125 -0
  171. package/dist/molecules/ai/audio-player.d.ts +30 -0
  172. package/dist/molecules/ai/audio-player.d.ts.map +1 -0
  173. package/dist/molecules/ai/audio-player.js +43 -0
  174. package/dist/molecules/ai/canvas.d.ts +9 -0
  175. package/dist/molecules/ai/canvas.d.ts.map +1 -0
  176. package/dist/molecules/ai/canvas.js +5 -0
  177. package/dist/molecules/ai/chain-of-thought.d.ts +30 -0
  178. package/dist/molecules/ai/chain-of-thought.d.ts.map +1 -0
  179. package/dist/molecules/ai/chain-of-thought.js +49 -0
  180. package/dist/molecules/ai/checkpoint.d.ts +12 -0
  181. package/dist/molecules/ai/checkpoint.d.ts.map +1 -0
  182. package/dist/molecules/ai/checkpoint.js +10 -0
  183. package/dist/molecules/ai/code-block.d.ts +46 -0
  184. package/dist/molecules/ai/code-block.d.ts.map +1 -0
  185. package/dist/molecules/ai/code-block.js +216 -0
  186. package/dist/molecules/ai/commit.d.ts +65 -0
  187. package/dist/molecules/ai/commit.d.ts.map +1 -0
  188. package/dist/molecules/ai/commit.js +95 -0
  189. package/dist/molecules/ai/confirmation.d.ts +50 -0
  190. package/dist/molecules/ai/confirmation.d.ts.map +1 -0
  191. package/dist/molecules/ai/confirmation.js +61 -0
  192. package/dist/molecules/ai/connection.d.ts +3 -0
  193. package/dist/molecules/ai/connection.d.ts.map +1 -0
  194. package/dist/molecules/ai/connection.js +3 -0
  195. package/dist/molecules/ai/context.d.ts +33 -0
  196. package/dist/molecules/ai/context.d.ts.map +1 -0
  197. package/dist/molecules/ai/context.js +164 -0
  198. package/dist/molecules/ai/controls.d.ts +5 -0
  199. package/dist/molecules/ai/controls.d.ts.map +1 -0
  200. package/dist/molecules/ai/controls.js +5 -0
  201. package/dist/molecules/ai/conversation.d.ts +24 -0
  202. package/dist/molecules/ai/conversation.d.ts.map +1 -0
  203. package/dist/molecules/ai/conversation.js +41 -0
  204. package/dist/molecules/ai/edge.d.ts +6 -0
  205. package/dist/molecules/ai/edge.d.ts.map +1 -0
  206. package/dist/molecules/ai/edge.js +87 -0
  207. package/dist/molecules/ai/environment-variables.d.ts +39 -0
  208. package/dist/molecules/ai/environment-variables.d.ts.map +1 -0
  209. package/dist/molecules/ai/environment-variables.js +87 -0
  210. package/dist/molecules/ai/file-tree.d.ts +27 -0
  211. package/dist/molecules/ai/file-tree.d.ts.map +1 -0
  212. package/dist/molecules/ai/file-tree.js +71 -0
  213. package/dist/molecules/ai/image.d.ts +7 -0
  214. package/dist/molecules/ai/image.d.ts.map +1 -0
  215. package/dist/molecules/ai/image.js +3 -0
  216. package/dist/molecules/ai/inline-citation.d.ts +39 -0
  217. package/dist/molecules/ai/inline-citation.d.ts.map +1 -0
  218. package/dist/molecules/ai/inline-citation.js +68 -0
  219. package/dist/molecules/ai/jsx-preview.d.ts +30 -0
  220. package/dist/molecules/ai/jsx-preview.d.ts.map +1 -0
  221. package/dist/molecules/ai/jsx-preview.js +167 -0
  222. package/dist/molecules/ai/loader.d.ts +6 -0
  223. package/dist/molecules/ai/loader.d.ts.map +1 -0
  224. package/dist/molecules/ai/loader.js +4 -0
  225. package/dist/molecules/ai/message.d.ts +38 -0
  226. package/dist/molecules/ai/message.d.ts.map +1 -0
  227. package/dist/molecules/ai/message.js +92 -0
  228. package/dist/molecules/ai/mic-selector.d.ts +46 -0
  229. package/dist/molecules/ai/mic-selector.d.ts.map +1 -0
  230. package/dist/molecules/ai/mic-selector.js +184 -0
  231. package/dist/molecules/ai/model-selector.d.ts +36 -0
  232. package/dist/molecules/ai/model-selector.d.ts.map +1 -0
  233. package/dist/molecules/ai/model-selector.js +18 -0
  234. package/dist/molecules/ai/node.d.ts +22 -0
  235. package/dist/molecules/ai/node.d.ts.map +1 -0
  236. package/dist/molecules/ai/node.js +11 -0
  237. package/dist/molecules/ai/open-in-chat.d.ts +29 -0
  238. package/dist/molecules/ai/open-in-chat.d.ts.map +1 -0
  239. package/dist/molecules/ai/open-in-chat.js +100 -0
  240. package/dist/molecules/ai/package-info.d.ts +30 -0
  241. package/dist/molecules/ai/package-info.d.ts.map +1 -0
  242. package/dist/molecules/ai/package-info.js +50 -0
  243. package/dist/molecules/ai/panel.d.ts +6 -0
  244. package/dist/molecules/ai/panel.d.ts.map +1 -0
  245. package/dist/molecules/ai/panel.js +4 -0
  246. package/dist/molecules/ai/persona.d.ts +49 -0
  247. package/dist/molecules/ai/persona.d.ts.map +1 -0
  248. package/dist/molecules/ai/persona.js +189 -0
  249. package/dist/molecules/ai/plan.d.ts +26 -0
  250. package/dist/molecules/ai/plan.d.ts.map +1 -0
  251. package/dist/molecules/ai/plan.js +34 -0
  252. package/dist/molecules/ai/prompt-input.d.ts +149 -0
  253. package/dist/molecules/ai/prompt-input.d.ts.map +1 -0
  254. package/dist/molecules/ai/prompt-input.js +702 -0
  255. package/dist/molecules/ai/queue.d.ts +62 -0
  256. package/dist/molecules/ai/queue.d.ts.map +1 -0
  257. package/dist/molecules/ai/queue.js +28 -0
  258. package/dist/molecules/ai/reasoning.d.ts +27 -0
  259. package/dist/molecules/ai/reasoning.d.ts.map +1 -0
  260. package/dist/molecules/ai/reasoning.js +95 -0
  261. package/dist/molecules/ai/response.d.ts +6 -0
  262. package/dist/molecules/ai/response.d.ts.map +1 -0
  263. package/dist/molecules/ai/response.js +18 -0
  264. package/dist/molecules/ai/sandbox.d.ts +25 -0
  265. package/dist/molecules/ai/sandbox.d.ts.map +1 -0
  266. package/dist/molecules/ai/sandbox.js +15 -0
  267. package/dist/molecules/ai/schema-display.d.ts +56 -0
  268. package/dist/molecules/ai/schema-display.d.ts.map +1 -0
  269. package/dist/molecules/ai/schema-display.js +73 -0
  270. package/dist/molecules/ai/shimmer.d.ts +10 -0
  271. package/dist/molecules/ai/shimmer.d.ts.map +1 -0
  272. package/dist/molecules/ai/shimmer.js +28 -0
  273. package/dist/molecules/ai/snippet.d.ts +19 -0
  274. package/dist/molecules/ai/snippet.d.ts.map +1 -0
  275. package/dist/molecules/ai/snippet.js +46 -0
  276. package/dist/molecules/ai/sources.d.ts +13 -0
  277. package/dist/molecules/ai/sources.d.ts.map +1 -0
  278. package/dist/molecules/ai/sources.js +9 -0
  279. package/dist/molecules/ai/speech-input.d.ts +55 -0
  280. package/dist/molecules/ai/speech-input.d.ts.map +1 -0
  281. package/dist/molecules/ai/speech-input.js +187 -0
  282. package/dist/molecules/ai/stack-trace.d.ts +38 -0
  283. package/dist/molecules/ai/stack-trace.d.ts.map +1 -0
  284. package/dist/molecules/ai/stack-trace.js +194 -0
  285. package/dist/molecules/ai/suggestion.d.ts +11 -0
  286. package/dist/molecules/ai/suggestion.d.ts.map +1 -0
  287. package/dist/molecules/ai/suggestion.js +13 -0
  288. package/dist/molecules/ai/task.d.ts +15 -0
  289. package/dist/molecules/ai/task.d.ts.map +1 -0
  290. package/dist/molecules/ai/task.js +10 -0
  291. package/dist/molecules/ai/terminal.d.ts +28 -0
  292. package/dist/molecules/ai/terminal.d.ts.map +1 -0
  293. package/dist/molecules/ai/terminal.js +68 -0
  294. package/dist/molecules/ai/test-results.d.ts +59 -0
  295. package/dist/molecules/ai/test-results.d.ts.map +1 -0
  296. package/dist/molecules/ai/test-results.js +97 -0
  297. package/dist/molecules/ai/tool.d.ts +32 -0
  298. package/dist/molecules/ai/tool.d.ts.map +1 -0
  299. package/dist/molecules/ai/tool.js +49 -0
  300. package/dist/molecules/ai/toolbar.d.ts +6 -0
  301. package/dist/molecules/ai/toolbar.d.ts.map +1 -0
  302. package/dist/molecules/ai/toolbar.js +4 -0
  303. package/dist/molecules/ai/transcription.d.ts +17 -0
  304. package/dist/molecules/ai/transcription.d.ts.map +1 -0
  305. package/dist/molecules/ai/transcription.js +36 -0
  306. package/dist/molecules/ai/voice-selector.d.ts +64 -0
  307. package/dist/molecules/ai/voice-selector.d.ts.map +1 -0
  308. package/dist/molecules/ai/voice-selector.js +224 -0
  309. package/dist/molecules/ai/web-preview.d.ts +35 -0
  310. package/dist/molecules/ai/web-preview.d.ts.map +1 -0
  311. package/dist/molecules/ai/web-preview.js +65 -0
  312. package/dist/molecules/artifact.d.ts +24 -0
  313. package/dist/molecules/artifact.d.ts.map +1 -0
  314. package/dist/molecules/artifact.js +20 -0
  315. package/dist/molecules/attachments.d.ts +55 -0
  316. package/dist/molecules/attachments.d.ts.map +1 -0
  317. package/dist/molecules/attachments.js +125 -0
  318. package/dist/molecules/audio-player.d.ts +30 -0
  319. package/dist/molecules/audio-player.d.ts.map +1 -0
  320. package/dist/molecules/audio-player.js +43 -0
  321. package/dist/molecules/canvas.d.ts +9 -0
  322. package/dist/molecules/canvas.d.ts.map +1 -0
  323. package/dist/molecules/canvas.js +5 -0
  324. package/dist/molecules/chain-of-thought.d.ts +30 -0
  325. package/dist/molecules/chain-of-thought.d.ts.map +1 -0
  326. package/dist/molecules/chain-of-thought.js +49 -0
  327. package/dist/molecules/chat-message.d.ts +10 -0
  328. package/dist/molecules/chat-message.d.ts.map +1 -0
  329. package/dist/molecules/chat-message.js +53 -0
  330. package/dist/molecules/checkpoint.d.ts +12 -0
  331. package/dist/molecules/checkpoint.d.ts.map +1 -0
  332. package/dist/molecules/checkpoint.js +10 -0
  333. package/dist/molecules/code-block.d.ts +46 -0
  334. package/dist/molecules/code-block.d.ts.map +1 -0
  335. package/dist/molecules/code-block.js +216 -0
  336. package/dist/molecules/commit.d.ts +65 -0
  337. package/dist/molecules/commit.d.ts.map +1 -0
  338. package/dist/molecules/commit.js +95 -0
  339. package/dist/molecules/confirmation.d.ts +50 -0
  340. package/dist/molecules/confirmation.d.ts.map +1 -0
  341. package/dist/molecules/confirmation.js +61 -0
  342. package/dist/molecules/connection.d.ts +3 -0
  343. package/dist/molecules/connection.d.ts.map +1 -0
  344. package/dist/molecules/connection.js +3 -0
  345. package/dist/molecules/context.d.ts +33 -0
  346. package/dist/molecules/context.d.ts.map +1 -0
  347. package/dist/molecules/context.js +164 -0
  348. package/dist/molecules/controls.d.ts +5 -0
  349. package/dist/molecules/controls.d.ts.map +1 -0
  350. package/dist/molecules/controls.js +5 -0
  351. package/dist/molecules/conversation.d.ts +24 -0
  352. package/dist/molecules/conversation.d.ts.map +1 -0
  353. package/dist/molecules/conversation.js +41 -0
  354. package/dist/molecules/edge.d.ts +6 -0
  355. package/dist/molecules/edge.d.ts.map +1 -0
  356. package/dist/molecules/edge.js +87 -0
  357. package/dist/molecules/environment-variables.d.ts +39 -0
  358. package/dist/molecules/environment-variables.d.ts.map +1 -0
  359. package/dist/molecules/environment-variables.js +87 -0
  360. package/dist/molecules/file-tree.d.ts +27 -0
  361. package/dist/molecules/file-tree.d.ts.map +1 -0
  362. package/dist/molecules/file-tree.js +71 -0
  363. package/dist/molecules/image.d.ts +7 -0
  364. package/dist/molecules/image.d.ts.map +1 -0
  365. package/dist/molecules/image.js +3 -0
  366. package/dist/molecules/inline-citation.d.ts +39 -0
  367. package/dist/molecules/inline-citation.d.ts.map +1 -0
  368. package/dist/molecules/inline-citation.js +68 -0
  369. package/dist/molecules/jsx-preview.d.ts +30 -0
  370. package/dist/molecules/jsx-preview.d.ts.map +1 -0
  371. package/dist/molecules/jsx-preview.js +167 -0
  372. package/dist/molecules/loader.d.ts +6 -0
  373. package/dist/molecules/loader.d.ts.map +1 -0
  374. package/dist/molecules/loader.js +4 -0
  375. package/dist/molecules/message.d.ts +38 -0
  376. package/dist/molecules/message.d.ts.map +1 -0
  377. package/dist/molecules/message.js +92 -0
  378. package/dist/molecules/mic-selector.d.ts +46 -0
  379. package/dist/molecules/mic-selector.d.ts.map +1 -0
  380. package/dist/molecules/mic-selector.js +184 -0
  381. package/dist/molecules/model-selector.d.ts +36 -0
  382. package/dist/molecules/model-selector.d.ts.map +1 -0
  383. package/dist/molecules/model-selector.js +18 -0
  384. package/dist/molecules/node.d.ts +22 -0
  385. package/dist/molecules/node.d.ts.map +1 -0
  386. package/dist/molecules/node.js +11 -0
  387. package/dist/molecules/open-in-chat.d.ts +29 -0
  388. package/dist/molecules/open-in-chat.d.ts.map +1 -0
  389. package/dist/molecules/open-in-chat.js +100 -0
  390. package/dist/molecules/package-info.d.ts +30 -0
  391. package/dist/molecules/package-info.d.ts.map +1 -0
  392. package/dist/molecules/package-info.js +50 -0
  393. package/dist/molecules/panel.d.ts +6 -0
  394. package/dist/molecules/panel.d.ts.map +1 -0
  395. package/dist/molecules/panel.js +4 -0
  396. package/dist/molecules/persona.d.ts +49 -0
  397. package/dist/molecules/persona.d.ts.map +1 -0
  398. package/dist/molecules/persona.js +189 -0
  399. package/dist/molecules/plan.d.ts +26 -0
  400. package/dist/molecules/plan.d.ts.map +1 -0
  401. package/dist/molecules/plan.js +34 -0
  402. package/dist/molecules/prompt-input.d.ts +149 -0
  403. package/dist/molecules/prompt-input.d.ts.map +1 -0
  404. package/dist/molecules/prompt-input.js +702 -0
  405. package/dist/molecules/queue.d.ts +62 -0
  406. package/dist/molecules/queue.d.ts.map +1 -0
  407. package/dist/molecules/queue.js +28 -0
  408. package/dist/molecules/reasoning.d.ts +27 -0
  409. package/dist/molecules/reasoning.d.ts.map +1 -0
  410. package/dist/molecules/reasoning.js +95 -0
  411. package/dist/molecules/response.d.ts +6 -0
  412. package/dist/molecules/response.d.ts.map +1 -0
  413. package/dist/molecules/response.js +18 -0
  414. package/dist/molecules/responsive-alert-dialog.d.ts +16 -0
  415. package/dist/molecules/responsive-alert-dialog.d.ts.map +1 -0
  416. package/dist/molecules/responsive-alert-dialog.js +20 -0
  417. package/dist/molecules/responsive-dialog.d.ts +11 -0
  418. package/dist/molecules/responsive-dialog.d.ts.map +1 -0
  419. package/dist/molecules/responsive-dialog.js +21 -0
  420. package/dist/molecules/sandbox.d.ts +25 -0
  421. package/dist/molecules/sandbox.d.ts.map +1 -0
  422. package/dist/molecules/sandbox.js +15 -0
  423. package/dist/molecules/schema-display.d.ts +56 -0
  424. package/dist/molecules/schema-display.d.ts.map +1 -0
  425. package/dist/molecules/schema-display.js +73 -0
  426. package/dist/molecules/shimmer.d.ts +10 -0
  427. package/dist/molecules/shimmer.d.ts.map +1 -0
  428. package/dist/molecules/shimmer.js +28 -0
  429. package/dist/molecules/snippet.d.ts +19 -0
  430. package/dist/molecules/snippet.d.ts.map +1 -0
  431. package/dist/molecules/snippet.js +46 -0
  432. package/dist/molecules/sources.d.ts +13 -0
  433. package/dist/molecules/sources.d.ts.map +1 -0
  434. package/dist/molecules/sources.js +9 -0
  435. package/dist/molecules/speech-input.d.ts +55 -0
  436. package/dist/molecules/speech-input.d.ts.map +1 -0
  437. package/dist/molecules/speech-input.js +187 -0
  438. package/dist/molecules/stack-trace.d.ts +38 -0
  439. package/dist/molecules/stack-trace.d.ts.map +1 -0
  440. package/dist/molecules/stack-trace.js +194 -0
  441. package/dist/molecules/suggestion.d.ts +11 -0
  442. package/dist/molecules/suggestion.d.ts.map +1 -0
  443. package/dist/molecules/suggestion.js +13 -0
  444. package/dist/molecules/task.d.ts +15 -0
  445. package/dist/molecules/task.d.ts.map +1 -0
  446. package/dist/molecules/task.js +10 -0
  447. package/dist/molecules/terminal.d.ts +28 -0
  448. package/dist/molecules/terminal.d.ts.map +1 -0
  449. package/dist/molecules/terminal.js +68 -0
  450. package/dist/molecules/test-results.d.ts +59 -0
  451. package/dist/molecules/test-results.d.ts.map +1 -0
  452. package/dist/molecules/test-results.js +97 -0
  453. package/dist/molecules/tool.d.ts +32 -0
  454. package/dist/molecules/tool.d.ts.map +1 -0
  455. package/dist/molecules/tool.js +49 -0
  456. package/dist/molecules/toolbar.d.ts +6 -0
  457. package/dist/molecules/toolbar.d.ts.map +1 -0
  458. package/dist/molecules/toolbar.js +4 -0
  459. package/dist/molecules/transcription.d.ts +17 -0
  460. package/dist/molecules/transcription.d.ts.map +1 -0
  461. package/dist/molecules/transcription.js +36 -0
  462. package/dist/molecules/voice-selector.d.ts +64 -0
  463. package/dist/molecules/voice-selector.d.ts.map +1 -0
  464. package/dist/molecules/voice-selector.js +224 -0
  465. package/dist/molecules/web-preview.d.ts +35 -0
  466. package/dist/molecules/web-preview.d.ts.map +1 -0
  467. package/dist/molecules/web-preview.js +65 -0
  468. package/package.json +27 -8
@@ -0,0 +1,27 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ export type FileTreeProps = Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> & {
3
+ expanded?: Set<string>;
4
+ defaultExpanded?: Set<string>;
5
+ selectedPath?: string;
6
+ onSelect?: (path: string) => void;
7
+ onExpandedChange?: (expanded: Set<string>) => void;
8
+ };
9
+ export declare const FileTree: ({ expanded: controlledExpanded, defaultExpanded, selectedPath, onSelect, onExpandedChange, className, children, ...props }: FileTreeProps) => import("react/jsx-runtime").JSX.Element;
10
+ export type FileTreeIconProps = HTMLAttributes<HTMLSpanElement>;
11
+ export declare const FileTreeIcon: ({ className, children, ...props }: FileTreeIconProps) => import("react/jsx-runtime").JSX.Element;
12
+ export type FileTreeNameProps = HTMLAttributes<HTMLSpanElement>;
13
+ export declare const FileTreeName: ({ className, children, ...props }: FileTreeNameProps) => import("react/jsx-runtime").JSX.Element;
14
+ export type FileTreeFolderProps = HTMLAttributes<HTMLDivElement> & {
15
+ path: string;
16
+ name: string;
17
+ };
18
+ export declare const FileTreeFolder: ({ path, name, className, children, ...props }: FileTreeFolderProps) => import("react/jsx-runtime").JSX.Element;
19
+ export type FileTreeFileProps = HTMLAttributes<HTMLDivElement> & {
20
+ path: string;
21
+ name: string;
22
+ icon?: ReactNode;
23
+ };
24
+ export declare const FileTreeFile: ({ path, name, icon, className, children, ...props }: FileTreeFileProps) => import("react/jsx-runtime").JSX.Element;
25
+ export type FileTreeActionsProps = HTMLAttributes<HTMLDivElement>;
26
+ export declare const FileTreeActions: ({ className, children, ...props }: FileTreeActionsProps) => import("react/jsx-runtime").JSX.Element;
27
+ //# sourceMappingURL=file-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-tree.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/file-tree.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA0BvD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IAC7E,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,4HAStB,aAAa,4CAqCf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAEhE,eAAO,MAAM,YAAY,GAAI,mCAI1B,iBAAiB,4CAInB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAEhE,eAAO,MAAM,YAAY,GAAI,mCAI1B,iBAAiB,4CAInB,CAAC;AAcF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,+CAM5B,mBAAmB,4CAuErB,CAAC;AAYF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,qDAO1B,iBAAiB,4CA8CnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAIlE,eAAO,MAAM,eAAe,GAAI,mCAI7B,oBAAoB,4CAUtB,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/atoms/collapsible";
4
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
5
+ import { ChevronRightIcon, FileIcon, FolderIcon, FolderOpenIcon, } from "lucide-react";
6
+ import { createContext, useCallback, useContext, useMemo, useState, } from "react";
7
+ // Default noop for context default value
8
+ // oxlint-disable-next-line eslint(no-empty-function)
9
+ const noop = () => { };
10
+ const FileTreeContext = createContext({
11
+ // oxlint-disable-next-line eslint-plugin-unicorn(no-new-builtin)
12
+ expandedPaths: new Set(),
13
+ togglePath: noop,
14
+ });
15
+ export const FileTree = ({ expanded: controlledExpanded, defaultExpanded = new Set(), selectedPath, onSelect, onExpandedChange, className, children, ...props }) => {
16
+ const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
17
+ const expandedPaths = controlledExpanded ?? internalExpanded;
18
+ const togglePath = useCallback((path) => {
19
+ const newExpanded = new Set(expandedPaths);
20
+ if (newExpanded.has(path)) {
21
+ newExpanded.delete(path);
22
+ }
23
+ else {
24
+ newExpanded.add(path);
25
+ }
26
+ setInternalExpanded(newExpanded);
27
+ onExpandedChange?.(newExpanded);
28
+ }, [expandedPaths, onExpandedChange]);
29
+ const contextValue = useMemo(() => ({ expandedPaths, onSelect, selectedPath, togglePath }), [expandedPaths, onSelect, selectedPath, togglePath]);
30
+ return (_jsx(FileTreeContext.Provider, { value: contextValue, children: _jsx("div", { className: cn("rounded-lg border bg-background font-mono text-sm", className), role: "tree", ...props, children: _jsx("div", { className: "p-2", children: children }) }) }));
31
+ };
32
+ export const FileTreeIcon = ({ className, children, ...props }) => (_jsx("span", { className: cn("shrink-0", className), ...props, children: children }));
33
+ export const FileTreeName = ({ className, children, ...props }) => (_jsx("span", { className: cn("truncate", className), ...props, children: children }));
34
+ const FileTreeFolderContext = createContext({
35
+ isExpanded: false,
36
+ name: "",
37
+ path: "",
38
+ });
39
+ export const FileTreeFolder = ({ path, name, className, children, ...props }) => {
40
+ const { expandedPaths, togglePath, selectedPath, onSelect } = useContext(FileTreeContext);
41
+ const isExpanded = expandedPaths.has(path);
42
+ const isSelected = selectedPath === path;
43
+ const handleOpenChange = useCallback(() => {
44
+ togglePath(path);
45
+ }, [togglePath, path]);
46
+ const handleSelect = useCallback(() => {
47
+ onSelect?.(path);
48
+ }, [onSelect, path]);
49
+ const folderContextValue = useMemo(() => ({ isExpanded, name, path }), [isExpanded, name, path]);
50
+ return (_jsx(FileTreeFolderContext.Provider, { value: folderContextValue, children: _jsx(Collapsible, { onOpenChange: handleOpenChange, open: isExpanded, children: _jsxs("div", { className: cn("", className), role: "treeitem", tabIndex: 0, ...props, children: [_jsxs("div", { className: cn("flex w-full items-center gap-1 rounded px-2 py-1 text-left transition-colors hover:bg-muted/50", isSelected && "bg-muted"), children: [_jsx(CollapsibleTrigger, { render: () => (_jsx("button", { className: "flex shrink-0 cursor-pointer items-center border-none bg-transparent p-0", type: "button", children: _jsx(ChevronRightIcon, { className: cn("size-4 shrink-0 text-muted-foreground transition-transform", isExpanded && "rotate-90") }) })) }), _jsxs("button", { className: "flex min-w-0 flex-1 cursor-pointer items-center gap-1 border-none bg-transparent p-0 text-left", onClick: handleSelect, type: "button", children: [_jsx(FileTreeIcon, { children: isExpanded ? (_jsx(FolderOpenIcon, { className: "size-4 text-blue-500" })) : (_jsx(FolderIcon, { className: "size-4 text-blue-500" })) }), _jsx(FileTreeName, { children: name })] })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "ml-4 border-l pl-2", children: children }) })] }) }) }));
51
+ };
52
+ const FileTreeFileContext = createContext({
53
+ name: "",
54
+ path: "",
55
+ });
56
+ export const FileTreeFile = ({ path, name, icon, className, children, ...props }) => {
57
+ const { selectedPath, onSelect } = useContext(FileTreeContext);
58
+ const isSelected = selectedPath === path;
59
+ const handleClick = useCallback(() => {
60
+ onSelect?.(path);
61
+ }, [onSelect, path]);
62
+ const handleKeyDown = useCallback((e) => {
63
+ if (e.key === "Enter" || e.key === " ") {
64
+ onSelect?.(path);
65
+ }
66
+ }, [onSelect, path]);
67
+ const fileContextValue = useMemo(() => ({ name, path }), [name, path]);
68
+ return (_jsx(FileTreeFileContext.Provider, { value: fileContextValue, children: _jsx("div", { className: cn("flex cursor-pointer items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-muted/50", isSelected && "bg-muted", className), onClick: handleClick, onKeyDown: handleKeyDown, role: "treeitem", tabIndex: 0, ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx("span", { className: "size-4 shrink-0" }), _jsx(FileTreeIcon, { children: icon ?? _jsx(FileIcon, { className: "size-4 text-muted-foreground" }) }), _jsx(FileTreeName, { children: name })] })) }) }));
69
+ };
70
+ const stopPropagation = (e) => e.stopPropagation();
71
+ export const FileTreeActions = ({ className, children, ...props }) => (_jsx("div", { className: cn("ml-auto flex items-center gap-1", className), onClick: stopPropagation, onKeyDown: stopPropagation, role: "group", ...props, children: children }));
@@ -0,0 +1,7 @@
1
+ import type { Experimental_GeneratedImage } from "ai";
2
+ export type ImageProps = Experimental_GeneratedImage & {
3
+ className?: string;
4
+ alt?: string;
5
+ };
6
+ export declare const Image: ({ base64, uint8Array: _uint8Array, mediaType, ...props }: ImageProps) => import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/image.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,IAAI,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG,2BAA2B,GAAG;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,0DAKnB,UAAU,4CAUZ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
3
+ export const Image = ({ base64, uint8Array: _uint8Array, mediaType, ...props }) => (_jsx("img", { ...props, alt: props.alt, className: cn("h-auto max-w-full overflow-hidden rounded-md", props.className), src: `data:${mediaType};base64,${base64}` }));
@@ -0,0 +1,39 @@
1
+ import { Badge } from "@chatsdk-dev/ui/atoms/badge";
2
+ import { Carousel } from "@chatsdk-dev/ui/atoms/carousel";
3
+ import { HoverCard } from "@chatsdk-dev/ui/atoms/hover-card";
4
+ import type { ComponentProps } from "react";
5
+ export type InlineCitationProps = ComponentProps<"span">;
6
+ export declare const InlineCitation: ({ className, ...props }: InlineCitationProps) => import("react/jsx-runtime").JSX.Element;
7
+ export type InlineCitationTextProps = ComponentProps<"span">;
8
+ export declare const InlineCitationText: ({ className, ...props }: InlineCitationTextProps) => import("react/jsx-runtime").JSX.Element;
9
+ export type InlineCitationCardProps = ComponentProps<typeof HoverCard>;
10
+ export declare const InlineCitationCard: (props: InlineCitationCardProps) => import("react/jsx-runtime").JSX.Element;
11
+ export type InlineCitationCardTriggerProps = ComponentProps<typeof Badge> & {
12
+ sources: string[];
13
+ };
14
+ export declare const InlineCitationCardTrigger: ({ sources, className, ...props }: InlineCitationCardTriggerProps) => import("react/jsx-runtime").JSX.Element;
15
+ export type InlineCitationCardBodyProps = ComponentProps<"div">;
16
+ export declare const InlineCitationCardBody: ({ className, ...props }: InlineCitationCardBodyProps) => import("react/jsx-runtime").JSX.Element;
17
+ export type InlineCitationCarouselProps = ComponentProps<typeof Carousel>;
18
+ export declare const InlineCitationCarousel: ({ className, children, ...props }: InlineCitationCarouselProps) => import("react/jsx-runtime").JSX.Element;
19
+ export type InlineCitationCarouselContentProps = ComponentProps<"div">;
20
+ export declare const InlineCitationCarouselContent: (props: InlineCitationCarouselContentProps) => import("react/jsx-runtime").JSX.Element;
21
+ export type InlineCitationCarouselItemProps = ComponentProps<"div">;
22
+ export declare const InlineCitationCarouselItem: ({ className, ...props }: InlineCitationCarouselItemProps) => import("react/jsx-runtime").JSX.Element;
23
+ export type InlineCitationCarouselHeaderProps = ComponentProps<"div">;
24
+ export declare const InlineCitationCarouselHeader: ({ className, ...props }: InlineCitationCarouselHeaderProps) => import("react/jsx-runtime").JSX.Element;
25
+ export type InlineCitationCarouselIndexProps = ComponentProps<"div">;
26
+ export declare const InlineCitationCarouselIndex: ({ children, className, ...props }: InlineCitationCarouselIndexProps) => import("react/jsx-runtime").JSX.Element;
27
+ export type InlineCitationCarouselPrevProps = ComponentProps<"button">;
28
+ export declare const InlineCitationCarouselPrev: ({ className, ...props }: InlineCitationCarouselPrevProps) => import("react/jsx-runtime").JSX.Element;
29
+ export type InlineCitationCarouselNextProps = ComponentProps<"button">;
30
+ export declare const InlineCitationCarouselNext: ({ className, ...props }: InlineCitationCarouselNextProps) => import("react/jsx-runtime").JSX.Element;
31
+ export type InlineCitationSourceProps = ComponentProps<"div"> & {
32
+ title?: string;
33
+ url?: string;
34
+ description?: string;
35
+ };
36
+ export declare const InlineCitationSource: ({ title, url, description, className, children, ...props }: InlineCitationSourceProps) => import("react/jsx-runtime").JSX.Element;
37
+ export type InlineCitationQuoteProps = ComponentProps<"blockquote">;
38
+ export declare const InlineCitationQuote: ({ children, className, ...props }: InlineCitationQuoteProps) => import("react/jsx-runtime").JSX.Element;
39
+ //# sourceMappingURL=inline-citation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-citation.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/inline-citation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EACL,QAAQ,EAGT,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,SAAS,EAGV,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAS5C,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,cAAc,GAAI,yBAG5B,mBAAmB,4CAKrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,kBAAkB,GAAI,yBAGhC,uBAAuB,4CAKzB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC;AAEvE,eAAO,MAAM,kBAAkB,GAAI,OAAO,uBAAuB,4CAEhE,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,GAAG;IAC1E,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,kCAIvC,8BAA8B,4CAmBhC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEhE,eAAO,MAAM,sBAAsB,GAAI,yBAGpC,2BAA2B,4CAE7B,CAAC;AASF,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE1E,eAAO,MAAM,sBAAsB,GAAI,mCAIpC,2BAA2B,4CAU7B,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEvE,eAAO,MAAM,6BAA6B,GACxC,OAAO,kCAAkC,4CACR,CAAC;AAEpC,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEpE,eAAO,MAAM,0BAA0B,GAAI,yBAGxC,+BAA+B,4CAKjC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEtE,eAAO,MAAM,4BAA4B,GAAI,yBAG1C,iCAAiC,4CAQnC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAErE,eAAO,MAAM,2BAA2B,GAAI,mCAIzC,gCAAgC,4CAsClC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,0BAA0B,GAAI,yBAGxC,+BAA+B,4CAoBjC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,0BAA0B,GAAI,yBAGxC,+BAA+B,4CAoBjC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,4DAOlC,yBAAyB,4CAe3B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;AAEpE,eAAO,MAAM,mBAAmB,GAAI,mCAIjC,wBAAwB,4CAU1B,CAAC"}
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Badge } from "@chatsdk-dev/ui/atoms/badge";
4
+ import { Carousel, CarouselContent, CarouselItem, } from "@chatsdk-dev/ui/atoms/carousel";
5
+ import { HoverCard, HoverCardContent, HoverCardTrigger, } from "@chatsdk-dev/ui/atoms/hover-card";
6
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
7
+ import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
8
+ import { createContext, useCallback, useContext, useEffect, useState, } from "react";
9
+ export const InlineCitation = ({ className, ...props }) => (_jsx("span", { className: cn("group inline items-center gap-1", className), ...props }));
10
+ export const InlineCitationText = ({ className, ...props }) => (_jsx("span", { className: cn("transition-colors group-hover:bg-accent", className), ...props }));
11
+ export const InlineCitationCard = (props) => (_jsx(HoverCard, { ...props }));
12
+ export const InlineCitationCardTrigger = ({ sources, className, ...props }) => (_jsx(HoverCardTrigger, { render: () => (_jsx(Badge, { className: cn("ml-1 rounded-full", className), variant: "secondary", ...props, children: sources[0] ? (_jsxs(_Fragment, { children: [new URL(sources[0]).hostname, " ", sources.length > 1 && `+${sources.length - 1}`] })) : ("unknown") })) }));
13
+ export const InlineCitationCardBody = ({ className, ...props }) => (_jsx(HoverCardContent, { className: cn("relative w-80 p-0", className), ...props }));
14
+ const CarouselApiContext = createContext(undefined);
15
+ const useCarouselApi = () => {
16
+ const context = useContext(CarouselApiContext);
17
+ return context;
18
+ };
19
+ export const InlineCitationCarousel = ({ className, children, ...props }) => {
20
+ const [api, setApi] = useState();
21
+ return (_jsx(CarouselApiContext.Provider, { value: api, children: _jsx(Carousel, { className: cn("w-full", className), setApi: setApi, ...props, children: children }) }));
22
+ };
23
+ export const InlineCitationCarouselContent = (props) => _jsx(CarouselContent, { ...props });
24
+ export const InlineCitationCarouselItem = ({ className, ...props }) => (_jsx(CarouselItem, { className: cn("w-full space-y-2 p-4 pl-8", className), ...props }));
25
+ export const InlineCitationCarouselHeader = ({ className, ...props }) => (_jsx("div", { className: cn("flex items-center justify-between gap-2 rounded-t-md bg-secondary p-2", className), ...props }));
26
+ export const InlineCitationCarouselIndex = ({ children, className, ...props }) => {
27
+ const api = useCarouselApi();
28
+ const [current, setCurrent] = useState(0);
29
+ const [count, setCount] = useState(0);
30
+ const syncState = useCallback(() => {
31
+ if (!api) {
32
+ return;
33
+ }
34
+ setCount(api.scrollSnapList().length);
35
+ setCurrent(api.selectedScrollSnap() + 1);
36
+ }, [api]);
37
+ useEffect(() => {
38
+ if (!api) {
39
+ return;
40
+ }
41
+ syncState();
42
+ api.on("select", syncState);
43
+ return () => {
44
+ api.off("select", syncState);
45
+ };
46
+ }, [api, syncState]);
47
+ return (_jsx("div", { className: cn("flex flex-1 items-center justify-end px-3 py-1 text-muted-foreground text-xs", className), ...props, children: children ?? `${current}/${count}` }));
48
+ };
49
+ export const InlineCitationCarouselPrev = ({ className, ...props }) => {
50
+ const api = useCarouselApi();
51
+ const handleClick = useCallback(() => {
52
+ if (api) {
53
+ api.scrollPrev();
54
+ }
55
+ }, [api]);
56
+ return (_jsx("button", { "aria-label": "Previous", className: cn("shrink-0", className), onClick: handleClick, type: "button", ...props, children: _jsx(ArrowLeftIcon, { className: "size-4 text-muted-foreground" }) }));
57
+ };
58
+ export const InlineCitationCarouselNext = ({ className, ...props }) => {
59
+ const api = useCarouselApi();
60
+ const handleClick = useCallback(() => {
61
+ if (api) {
62
+ api.scrollNext();
63
+ }
64
+ }, [api]);
65
+ return (_jsx("button", { "aria-label": "Next", className: cn("shrink-0", className), onClick: handleClick, type: "button", ...props, children: _jsx(ArrowRightIcon, { className: "size-4 text-muted-foreground" }) }));
66
+ };
67
+ export const InlineCitationSource = ({ title, url, description, className, children, ...props }) => (_jsxs("div", { className: cn("space-y-1", className), ...props, children: [title && (_jsx("h4", { className: "truncate font-medium text-sm leading-tight", children: title })), url && (_jsx("p", { className: "truncate break-all text-muted-foreground text-xs", children: url })), description && (_jsx("p", { className: "line-clamp-3 text-muted-foreground text-sm leading-relaxed", children: description })), children] }));
68
+ export const InlineCitationQuote = ({ children, className, ...props }) => (_jsx("blockquote", { className: cn("border-muted border-l-2 pl-3 text-muted-foreground text-sm italic", className), ...props, children: children }));
@@ -0,0 +1,30 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ import type { TProps as JsxParserProps } from "react-jsx-parser";
3
+ interface JSXPreviewContextValue {
4
+ jsx: string;
5
+ processedJsx: string;
6
+ isStreaming: boolean;
7
+ error: Error | null;
8
+ setError: (error: Error | null) => void;
9
+ setLastGoodJsx: (jsx: string) => void;
10
+ components: JsxParserProps["components"];
11
+ bindings: JsxParserProps["bindings"];
12
+ onErrorProp?: (error: Error) => void;
13
+ }
14
+ export declare const useJSXPreview: () => JSXPreviewContextValue;
15
+ export type JSXPreviewProps = ComponentProps<"div"> & {
16
+ jsx: string;
17
+ isStreaming?: boolean;
18
+ components?: JsxParserProps["components"];
19
+ bindings?: JsxParserProps["bindings"];
20
+ onError?: (error: Error) => void;
21
+ };
22
+ export declare const JSXPreview: import("react").MemoExoticComponent<({ jsx, isStreaming, components, bindings, onError, className, children, ...props }: JSXPreviewProps) => import("react/jsx-runtime").JSX.Element>;
23
+ export type JSXPreviewContentProps = Omit<ComponentProps<"div">, "children">;
24
+ export declare const JSXPreviewContent: import("react").MemoExoticComponent<({ className, ...props }: JSXPreviewContentProps) => import("react/jsx-runtime").JSX.Element>;
25
+ export type JSXPreviewErrorProps = ComponentProps<"div"> & {
26
+ children?: ReactNode | ((error: Error) => ReactNode);
27
+ };
28
+ export declare const JSXPreviewError: import("react").MemoExoticComponent<({ className, children, ...props }: JSXPreviewErrorProps) => import("react/jsx-runtime").JSX.Element | null>;
29
+ export {};
30
+ //# sourceMappingURL=jsx-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-preview.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/jsx-preview.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWvD,OAAO,KAAK,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGjE,UAAU,sBAAsB;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC;IACxC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IACzC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACtC;AAMD,eAAO,MAAM,aAAa,8BAMzB,CAAC;AAqFF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,UAAU,2HAUlB,eAAe,6CAgDnB,CAAC;AAIF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAE7E,eAAO,MAAM,iBAAiB,gEACF,sBAAsB,6CAgEjD,CAAC;AAIF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC;CACtD,CAAC;AAYF,eAAO,MAAM,eAAe,0EACU,oBAAoB,oDA0BzD,CAAC"}
@@ -0,0 +1,167 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
4
+ import { AlertCircle } from "lucide-react";
5
+ import { createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
6
+ import JsxParser from "react-jsx-parser";
7
+ const JSXPreviewContext = createContext(null);
8
+ const TAG_REGEX = /<\/?([a-zA-Z][a-zA-Z0-9]*)\s*([^>]*?)(\/)?>/;
9
+ export const useJSXPreview = () => {
10
+ const context = useContext(JSXPreviewContext);
11
+ if (!context) {
12
+ throw new Error("JSXPreview components must be used within JSXPreview");
13
+ }
14
+ return context;
15
+ };
16
+ const matchJsxTag = (code) => {
17
+ if (code.trim() === "") {
18
+ return null;
19
+ }
20
+ const match = code.match(TAG_REGEX);
21
+ if (!match || match.index === undefined) {
22
+ return null;
23
+ }
24
+ const [fullMatch, tagName, attributes, selfClosing] = match;
25
+ let type;
26
+ if (selfClosing) {
27
+ type = "self-closing";
28
+ }
29
+ else if (fullMatch.startsWith("</")) {
30
+ type = "closing";
31
+ }
32
+ else {
33
+ type = "opening";
34
+ }
35
+ return {
36
+ attributes: attributes?.trim(),
37
+ endIndex: match.index + fullMatch.length,
38
+ startIndex: match.index,
39
+ tag: fullMatch,
40
+ tagName,
41
+ type,
42
+ };
43
+ };
44
+ const stripIncompleteTag = (text) => {
45
+ // Find the last '<' that isn't part of a complete tag
46
+ const lastOpen = text.lastIndexOf("<");
47
+ if (lastOpen === -1) {
48
+ return text;
49
+ }
50
+ const afterOpen = text.slice(lastOpen);
51
+ // If there's no closing '>' after the last '<', it's an incomplete tag
52
+ if (!afterOpen.includes(">")) {
53
+ return text.slice(0, lastOpen);
54
+ }
55
+ return text;
56
+ };
57
+ const completeJsxTag = (code) => {
58
+ const stack = [];
59
+ let result = "";
60
+ let currentPosition = 0;
61
+ while (currentPosition < code.length) {
62
+ const match = matchJsxTag(code.slice(currentPosition));
63
+ if (!match) {
64
+ // No more tags found, strip any trailing incomplete tag
65
+ result += stripIncompleteTag(code.slice(currentPosition));
66
+ break;
67
+ }
68
+ const { tagName, type, endIndex } = match;
69
+ // Include any text content before this tag
70
+ result += code.slice(currentPosition, currentPosition + endIndex);
71
+ if (type === "opening") {
72
+ stack.push(tagName ?? "");
73
+ }
74
+ else if (type === "closing") {
75
+ stack.pop();
76
+ }
77
+ currentPosition += endIndex;
78
+ }
79
+ return (result +
80
+ stack
81
+ .reverse()
82
+ .map((tag) => `</${tag}>`)
83
+ .join(""));
84
+ };
85
+ export const JSXPreview = memo(({ jsx, isStreaming = false, components, bindings, onError, className, children, ...props }) => {
86
+ const [prevJsx, setPrevJsx] = useState(jsx);
87
+ const [error, setError] = useState(null);
88
+ const [_lastGoodJsx, setLastGoodJsx] = useState("");
89
+ // Clear error when jsx changes (derived state pattern)
90
+ if (jsx !== prevJsx) {
91
+ setPrevJsx(jsx);
92
+ setError(null);
93
+ }
94
+ const processedJsx = useMemo(() => (isStreaming ? completeJsxTag(jsx) : jsx), [jsx, isStreaming]);
95
+ const contextValue = useMemo(() => ({
96
+ bindings,
97
+ components,
98
+ error,
99
+ isStreaming,
100
+ jsx,
101
+ onErrorProp: onError,
102
+ processedJsx,
103
+ setError,
104
+ setLastGoodJsx,
105
+ }), [
106
+ bindings,
107
+ components,
108
+ error,
109
+ isStreaming,
110
+ jsx,
111
+ onError,
112
+ processedJsx,
113
+ setError,
114
+ ]);
115
+ return (_jsx(JSXPreviewContext.Provider, { value: contextValue, children: _jsx("div", { className: cn("relative", className), ...props, children: children }) }));
116
+ });
117
+ JSXPreview.displayName = "JSXPreview";
118
+ export const JSXPreviewContent = memo(({ className, ...props }) => {
119
+ const { processedJsx, isStreaming, components, bindings, setError, setLastGoodJsx, onErrorProp, } = useJSXPreview();
120
+ const errorReportedRef = useRef(null);
121
+ const lastGoodJsxRef = useRef("");
122
+ const [hadError, setHadError] = useState(false);
123
+ // Reset error tracking when jsx changes
124
+ useEffect(() => {
125
+ errorReportedRef.current = null;
126
+ setHadError(false);
127
+ }, [processedJsx]);
128
+ const handleError = useCallback((err) => {
129
+ // Prevent duplicate error reports for the same jsx
130
+ if (errorReportedRef.current === processedJsx) {
131
+ return;
132
+ }
133
+ errorReportedRef.current = processedJsx;
134
+ // During streaming, suppress errors and fall back to last good JSX
135
+ if (isStreaming) {
136
+ setHadError(true);
137
+ return;
138
+ }
139
+ setError(err);
140
+ onErrorProp?.(err);
141
+ }, [processedJsx, isStreaming, onErrorProp, setError]);
142
+ // Track the last JSX that rendered without error
143
+ useEffect(() => {
144
+ if (!errorReportedRef.current) {
145
+ lastGoodJsxRef.current = processedJsx;
146
+ setLastGoodJsx(processedJsx);
147
+ }
148
+ }, [processedJsx, setLastGoodJsx]);
149
+ // During streaming, if the current JSX errored, re-render with last good version
150
+ const displayJsx = isStreaming && hadError ? lastGoodJsxRef.current : processedJsx;
151
+ return (_jsx("div", { className: cn("jsx-preview-content", className), ...props, children: _jsx(JsxParser, { bindings: bindings, components: components, jsx: displayJsx, onError: handleError, renderInWrapper: false }) }));
152
+ });
153
+ JSXPreviewContent.displayName = "JSXPreviewContent";
154
+ const renderChildren = (children, error) => {
155
+ if (typeof children === "function") {
156
+ return children(error);
157
+ }
158
+ return children;
159
+ };
160
+ export const JSXPreviewError = memo(({ className, children, ...props }) => {
161
+ const { error } = useJSXPreview();
162
+ if (!error) {
163
+ return null;
164
+ }
165
+ return (_jsx("div", { className: cn("flex items-center gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive text-sm", className), ...props, children: children ? (renderChildren(children, error)) : (_jsxs(_Fragment, { children: [_jsx(AlertCircle, { className: "size-4 shrink-0" }), _jsx("span", { children: error.message })] })) }));
166
+ });
167
+ JSXPreviewError.displayName = "JSXPreviewError";
@@ -0,0 +1,6 @@
1
+ import type { HTMLAttributes } from "react";
2
+ export type LoaderProps = HTMLAttributes<HTMLDivElement> & {
3
+ size?: number;
4
+ };
5
+ export declare const Loader: ({ className, size, ...props }: LoaderProps) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/loader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAkF5C,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,+BAAoC,WAAW,4CAUrE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
3
+ const LoaderIcon = ({ size = 16 }) => (_jsxs("svg", { height: size, strokeLinejoin: "round", style: { color: "currentcolor" }, viewBox: "0 0 16 16", width: size, children: [_jsx("title", { children: "Loader" }), _jsxs("g", { clipPath: "url(#clip0_2393_1490)", children: [_jsx("path", { d: "M8 0V4", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M8 16V12", opacity: "0.5", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M3.29773 1.52783L5.64887 4.7639", opacity: "0.9", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M12.7023 1.52783L10.3511 4.7639", opacity: "0.1", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M12.7023 14.472L10.3511 11.236", opacity: "0.4", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M3.29773 14.472L5.64887 11.236", opacity: "0.6", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M15.6085 5.52783L11.8043 6.7639", opacity: "0.2", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M0.391602 10.472L4.19583 9.23598", opacity: "0.7", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M15.6085 10.4722L11.8043 9.2361", opacity: "0.3", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("path", { d: "M0.391602 5.52783L4.19583 6.7639", opacity: "0.8", stroke: "currentColor", strokeWidth: "1.5" })] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_2393_1490", children: _jsx("rect", { fill: "white", height: "16", width: "16" }) }) })] }));
4
+ export const Loader = ({ className, size = 16, ...props }) => (_jsx("div", { className: cn("inline-flex animate-spin items-center justify-center", className), ...props, children: _jsx(LoaderIcon, { size: size }) }));
@@ -0,0 +1,38 @@
1
+ import { Button } from "@chatsdk-dev/ui/atoms/button";
2
+ import { ButtonGroup } from "@chatsdk-dev/ui/atoms/button-group";
3
+ import type { UIMessage } from "ai";
4
+ import type { ComponentProps, HTMLAttributes } from "react";
5
+ import { Streamdown } from "streamdown";
6
+ export type MessageProps = HTMLAttributes<HTMLDivElement> & {
7
+ from: UIMessage["role"];
8
+ };
9
+ export declare const Message: ({ className, from, ...props }: MessageProps) => import("react/jsx-runtime").JSX.Element;
10
+ export type MessageContentProps = HTMLAttributes<HTMLDivElement>;
11
+ export declare const MessageContent: ({ children, className, ...props }: MessageContentProps) => import("react/jsx-runtime").JSX.Element;
12
+ export type MessageActionsProps = ComponentProps<"div">;
13
+ export declare const MessageActions: ({ className, children, ...props }: MessageActionsProps) => import("react/jsx-runtime").JSX.Element;
14
+ export type MessageActionProps = ComponentProps<typeof Button> & {
15
+ tooltip?: string;
16
+ label?: string;
17
+ };
18
+ export declare const MessageAction: ({ tooltip, children, label, variant, size, ...props }: MessageActionProps) => import("react/jsx-runtime").JSX.Element;
19
+ export type MessageBranchProps = HTMLAttributes<HTMLDivElement> & {
20
+ defaultBranch?: number;
21
+ onBranchChange?: (branchIndex: number) => void;
22
+ };
23
+ export declare const MessageBranch: ({ defaultBranch, onBranchChange, className, ...props }: MessageBranchProps) => import("react/jsx-runtime").JSX.Element;
24
+ export type MessageBranchContentProps = HTMLAttributes<HTMLDivElement>;
25
+ export declare const MessageBranchContent: ({ children, ...props }: MessageBranchContentProps) => import("react/jsx-runtime").JSX.Element[];
26
+ export type MessageBranchSelectorProps = ComponentProps<typeof ButtonGroup>;
27
+ export declare const MessageBranchSelector: ({ className, ...props }: MessageBranchSelectorProps) => import("react/jsx-runtime").JSX.Element | null;
28
+ export type MessageBranchPreviousProps = ComponentProps<typeof Button>;
29
+ export declare const MessageBranchPrevious: ({ children, ...props }: MessageBranchPreviousProps) => import("react/jsx-runtime").JSX.Element;
30
+ export type MessageBranchNextProps = ComponentProps<typeof Button>;
31
+ export declare const MessageBranchNext: ({ children, ...props }: MessageBranchNextProps) => import("react/jsx-runtime").JSX.Element;
32
+ export type MessageBranchPageProps = HTMLAttributes<HTMLSpanElement>;
33
+ export declare const MessageBranchPage: ({ className, ...props }: MessageBranchPageProps) => import("react/jsx-runtime").JSX.Element;
34
+ export type MessageResponseProps = ComponentProps<typeof Streamdown>;
35
+ export declare const MessageResponse: import("react").MemoExoticComponent<({ className, ...props }: MessageResponseProps) => import("react/jsx-runtime").JSX.Element>;
36
+ export type MessageToolbarProps = ComponentProps<"div">;
37
+ export declare const MessageToolbar: ({ className, children, ...props }: MessageToolbarProps) => import("react/jsx-runtime").JSX.Element;
38
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/message.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACL,WAAW,EAEZ,MAAM,oCAAoC,CAAC;AAY5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAgB,MAAM,OAAO,CAAC;AAU1E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,+BAA+B,YAAY,4CASlE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,4CAYrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,4CAIrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,uDAO3B,kBAAkB,4CAsBpB,CAAC;AA2BF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,wDAK3B,kBAAkB,4CA4CpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEvE,eAAO,MAAM,oBAAoB,GAAI,wBAGlC,yBAAyB,8CA0B3B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC;AAE5E,eAAO,MAAM,qBAAqB,GAAI,yBAGnC,0BAA0B,mDAkB5B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEvE,eAAO,MAAM,qBAAqB,GAAI,wBAGnC,0BAA0B,4CAgB5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEnE,eAAO,MAAM,iBAAiB,GAAI,wBAG/B,sBAAsB,4CAgBxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAErE,eAAO,MAAM,iBAAiB,GAAI,yBAG/B,sBAAsB,4CAcxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAIrE,eAAO,MAAM,eAAe,gEACA,oBAAoB,6CAa/C,CAAC;AAIF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,4CAUrB,CAAC"}
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button } from "@chatsdk-dev/ui/atoms/button";
4
+ import { ButtonGroup, ButtonGroupText, } from "@chatsdk-dev/ui/atoms/button-group";
5
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@chatsdk-dev/ui/atoms/tooltip";
6
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
7
+ import { cjk } from "@streamdown/cjk";
8
+ import { code } from "@streamdown/code";
9
+ import { math } from "@streamdown/math";
10
+ import { mermaid } from "@streamdown/mermaid";
11
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
12
+ import { createContext, memo, useCallback, useContext, useEffect, useMemo, useState, } from "react";
13
+ import { Streamdown } from "streamdown";
14
+ export const Message = ({ className, from, ...props }) => (_jsx("div", { className: cn("group flex w-full max-w-[95%] flex-col gap-2", from === "user" ? "is-user ml-auto justify-end" : "is-assistant", className), ...props }));
15
+ export const MessageContent = ({ children, className, ...props }) => (_jsx("div", { className: cn("is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground", className), ...props, children: children }));
16
+ export const MessageActions = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center gap-1", className), ...props, children: children }));
17
+ export const MessageAction = ({ tooltip, children, label, variant = "ghost", size = "icon", ...props }) => {
18
+ const button = (_jsxs(Button, { size: size, type: "button", variant: variant, ...props, children: [children, _jsx("span", { className: "sr-only", children: label || tooltip })] }));
19
+ if (tooltip) {
20
+ return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: () => button }), _jsx(TooltipContent, { children: _jsx("p", { children: tooltip }) })] }) }));
21
+ }
22
+ return button;
23
+ };
24
+ const MessageBranchContext = createContext(null);
25
+ const useMessageBranch = () => {
26
+ const context = useContext(MessageBranchContext);
27
+ if (!context) {
28
+ throw new Error("MessageBranch components must be used within MessageBranch");
29
+ }
30
+ return context;
31
+ };
32
+ export const MessageBranch = ({ defaultBranch = 0, onBranchChange, className, ...props }) => {
33
+ const [currentBranch, setCurrentBranch] = useState(defaultBranch);
34
+ const [branches, setBranches] = useState([]);
35
+ const handleBranchChange = useCallback((newBranch) => {
36
+ setCurrentBranch(newBranch);
37
+ onBranchChange?.(newBranch);
38
+ }, [onBranchChange]);
39
+ const goToPrevious = useCallback(() => {
40
+ const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
41
+ handleBranchChange(newBranch);
42
+ }, [currentBranch, branches.length, handleBranchChange]);
43
+ const goToNext = useCallback(() => {
44
+ const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
45
+ handleBranchChange(newBranch);
46
+ }, [currentBranch, branches.length, handleBranchChange]);
47
+ const contextValue = useMemo(() => ({
48
+ branches,
49
+ currentBranch,
50
+ goToNext,
51
+ goToPrevious,
52
+ setBranches,
53
+ totalBranches: branches.length,
54
+ }), [branches, currentBranch, goToNext, goToPrevious]);
55
+ return (_jsx(MessageBranchContext.Provider, { value: contextValue, children: _jsx("div", { className: cn("grid w-full gap-2 [&>div]:pb-0", className), ...props }) }));
56
+ };
57
+ export const MessageBranchContent = ({ children, ...props }) => {
58
+ const { currentBranch, setBranches, branches } = useMessageBranch();
59
+ const childrenArray = useMemo(() => (Array.isArray(children) ? children : [children]), [children]);
60
+ // Use useEffect to update branches when they change
61
+ useEffect(() => {
62
+ if (branches.length !== childrenArray.length) {
63
+ setBranches(childrenArray);
64
+ }
65
+ }, [childrenArray, branches, setBranches]);
66
+ return childrenArray.map((branch, index) => (_jsx("div", { className: cn("grid gap-2 overflow-hidden [&>div]:pb-0", index === currentBranch ? "block" : "hidden"), ...props, children: branch }, branch.key)));
67
+ };
68
+ export const MessageBranchSelector = ({ className, ...props }) => {
69
+ const { totalBranches } = useMessageBranch();
70
+ // Don't render if there's only one branch
71
+ if (totalBranches <= 1) {
72
+ return null;
73
+ }
74
+ return (_jsx(ButtonGroup, { className: cn("[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md", className), orientation: "horizontal", ...props }));
75
+ };
76
+ export const MessageBranchPrevious = ({ children, ...props }) => {
77
+ const { goToPrevious, totalBranches } = useMessageBranch();
78
+ return (_jsx(Button, { "aria-label": "Previous branch", disabled: totalBranches <= 1, onClick: goToPrevious, size: "icon", type: "button", variant: "ghost", ...props, children: children ?? _jsx(ChevronLeftIcon, { size: 14 }) }));
79
+ };
80
+ export const MessageBranchNext = ({ children, ...props }) => {
81
+ const { goToNext, totalBranches } = useMessageBranch();
82
+ return (_jsx(Button, { "aria-label": "Next branch", disabled: totalBranches <= 1, onClick: goToNext, size: "icon", type: "button", variant: "ghost", ...props, children: children ?? _jsx(ChevronRightIcon, { size: 14 }) }));
83
+ };
84
+ export const MessageBranchPage = ({ className, ...props }) => {
85
+ const { currentBranch, totalBranches } = useMessageBranch();
86
+ return (_jsxs(ButtonGroupText, { className: cn("border-none bg-transparent text-muted-foreground shadow-none", className), ...props, children: [currentBranch + 1, " of ", totalBranches] }));
87
+ };
88
+ const streamdownPlugins = { cjk, code, math, mermaid };
89
+ export const MessageResponse = memo(({ className, ...props }) => (_jsx(Streamdown, { className: cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className), plugins: streamdownPlugins, ...props })), (prevProps, nextProps) => prevProps.children === nextProps.children &&
90
+ nextProps.isAnimating === prevProps.isAnimating);
91
+ MessageResponse.displayName = "MessageResponse";
92
+ export const MessageToolbar = ({ className, children, ...props }) => (_jsx("div", { className: cn("mt-4 flex w-full items-center justify-between gap-4", className), ...props, children: children }));