@chatsdk-dev/ui 0.0.1 → 0.1.2

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,49 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
4
+ import { Badge } from "@chatsdk-dev/ui/atoms/badge";
5
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/atoms/collapsible";
6
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
7
+ import { BrainIcon, ChevronDownIcon, DotIcon } from "lucide-react";
8
+ import { createContext, memo, useContext, useMemo } from "react";
9
+ const ChainOfThoughtContext = createContext(null);
10
+ const useChainOfThought = () => {
11
+ const context = useContext(ChainOfThoughtContext);
12
+ if (!context) {
13
+ throw new Error("ChainOfThought components must be used within ChainOfThought");
14
+ }
15
+ return context;
16
+ };
17
+ export const ChainOfThought = memo(({ className, open, defaultOpen = false, onOpenChange, children, ...props }) => {
18
+ const [isOpen, setIsOpen] = useControllableState({
19
+ defaultProp: defaultOpen,
20
+ onChange: onOpenChange,
21
+ prop: open,
22
+ });
23
+ const chainOfThoughtContext = useMemo(() => ({ isOpen, setIsOpen }), [isOpen, setIsOpen]);
24
+ return (_jsx(ChainOfThoughtContext.Provider, { value: chainOfThoughtContext, children: _jsx("div", { className: cn("not-prose w-full space-y-4", className), ...props, children: children }) }));
25
+ });
26
+ export const ChainOfThoughtHeader = memo(({ className, children, ...props }) => {
27
+ const { isOpen, setIsOpen } = useChainOfThought();
28
+ return (_jsx(Collapsible, { onOpenChange: setIsOpen, open: isOpen, children: _jsxs(CollapsibleTrigger, { className: cn("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground", className), ...props, children: [_jsx(BrainIcon, { className: "size-4" }), _jsx("span", { className: "flex-1 text-left", children: children ?? "Chain of Thought" }), _jsx(ChevronDownIcon, { className: cn("size-4 transition-transform", isOpen ? "rotate-180" : "rotate-0") })] }) }));
29
+ });
30
+ const stepStatusStyles = {
31
+ active: "text-foreground",
32
+ complete: "text-muted-foreground",
33
+ pending: "text-muted-foreground/50",
34
+ };
35
+ export const ChainOfThoughtStep = memo(({ className, icon: Icon = DotIcon, label, description, status = "complete", children, ...props }) => (_jsxs("div", { className: cn("flex gap-2 text-sm", stepStatusStyles[status], "fade-in-0 slide-in-from-top-2 animate-in", className), ...props, children: [_jsxs("div", { className: "relative mt-0.5", children: [_jsx(Icon, { className: "size-4" }), _jsx("div", { className: "absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-border" })] }), _jsxs("div", { className: "flex-1 space-y-2 overflow-hidden", children: [_jsx("div", { children: label }), description && (_jsx("div", { className: "text-muted-foreground text-xs", children: description })), children] })] })));
36
+ export const ChainOfThoughtSearchResults = memo(({ className, ...props }) => (_jsx("div", { className: cn("flex flex-wrap items-center gap-2", className), ...props })));
37
+ export const ChainOfThoughtSearchResult = memo(({ className, children, ...props }) => (_jsx(Badge, { className: cn("gap-1 px-2 py-0.5 font-normal text-xs", className), variant: "secondary", ...props, children: children })));
38
+ export const ChainOfThoughtContent = memo(({ className, children, ...props }) => {
39
+ const { isOpen } = useChainOfThought();
40
+ return (_jsx(Collapsible, { open: isOpen, children: _jsx(CollapsibleContent, { className: cn("mt-2 space-y-3", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", className), ...props, children: children }) }));
41
+ });
42
+ export const ChainOfThoughtImage = memo(({ className, children, caption, ...props }) => (_jsxs("div", { className: cn("mt-2 space-y-2", className), ...props, children: [_jsx("div", { className: "relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children: children }), caption && _jsx("p", { className: "text-muted-foreground text-xs", children: caption })] })));
43
+ ChainOfThought.displayName = "ChainOfThought";
44
+ ChainOfThoughtHeader.displayName = "ChainOfThoughtHeader";
45
+ ChainOfThoughtStep.displayName = "ChainOfThoughtStep";
46
+ ChainOfThoughtSearchResults.displayName = "ChainOfThoughtSearchResults";
47
+ ChainOfThoughtSearchResult.displayName = "ChainOfThoughtSearchResult";
48
+ ChainOfThoughtContent.displayName = "ChainOfThoughtContent";
49
+ ChainOfThoughtImage.displayName = "ChainOfThoughtImage";
@@ -0,0 +1,12 @@
1
+ import { Button } from "@chatsdk-dev/ui/atoms/button";
2
+ import type { LucideProps } from "lucide-react";
3
+ import type { ComponentProps, HTMLAttributes } from "react";
4
+ export type CheckpointProps = HTMLAttributes<HTMLDivElement>;
5
+ export declare const Checkpoint: ({ className, children, ...props }: CheckpointProps) => import("react/jsx-runtime").JSX.Element;
6
+ export type CheckpointIconProps = LucideProps;
7
+ export declare const CheckpointIcon: ({ className, children, ...props }: CheckpointIconProps) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
8
+ export type CheckpointTriggerProps = ComponentProps<typeof Button> & {
9
+ tooltip?: string;
10
+ };
11
+ export declare const CheckpointTrigger: ({ children, variant, size, tooltip, ...props }: CheckpointTriggerProps) => import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=checkpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/checkpoint.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAQtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE7D,eAAO,MAAM,UAAU,GAAI,mCAIxB,eAAe,4CAWjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAE9C,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,yVAGnB,CAAC;AAEJ,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,gDAM/B,sBAAsB,4CAkBtB,CAAC"}
@@ -0,0 +1,10 @@
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 { Separator } from "@chatsdk-dev/ui/atoms/separator";
5
+ import { Tooltip, TooltipContent, TooltipTrigger, } from "@chatsdk-dev/ui/atoms/tooltip";
6
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
7
+ import { BookmarkIcon } from "lucide-react";
8
+ export const Checkpoint = ({ className, children, ...props }) => (_jsxs("div", { className: cn("flex items-center gap-0.5 overflow-hidden text-muted-foreground", className), ...props, children: [children, _jsx(Separator, {})] }));
9
+ export const CheckpointIcon = ({ className, children, ...props }) => children ?? (_jsx(BookmarkIcon, { className: cn("size-4 shrink-0", className), ...props }));
10
+ export const CheckpointTrigger = ({ children, variant = "ghost", size = "sm", tooltip, ...props }) => tooltip ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: () => (_jsx(Button, { size: size, type: "button", variant: variant, ...props, children: children })) }), _jsx(TooltipContent, { align: "start", side: "bottom", children: tooltip })] })) : (_jsx(Button, { size: size, type: "button", variant: variant, ...props, children: children }));
@@ -0,0 +1,46 @@
1
+ import { Button } from "@chatsdk-dev/ui/atoms/button";
2
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@chatsdk-dev/ui/atoms/select";
3
+ import type { ComponentProps, HTMLAttributes } from "react";
4
+ import type { BundledLanguage, ThemedToken } from "shiki";
5
+ type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
6
+ code: string;
7
+ language: BundledLanguage;
8
+ showLineNumbers?: boolean;
9
+ };
10
+ interface TokenizedCode {
11
+ tokens: ThemedToken[][];
12
+ fg: string;
13
+ bg: string;
14
+ }
15
+ export declare const highlightCode: (code: string, language: BundledLanguage, callback?: (result: TokenizedCode) => void) => TokenizedCode | null;
16
+ export declare const CodeBlockContainer: ({ className, language, style, ...props }: HTMLAttributes<HTMLDivElement> & {
17
+ language: string;
18
+ }) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const CodeBlockHeader: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const CodeBlockTitle: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const CodeBlockFilename: ({ children, className, ...props }: HTMLAttributes<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const CodeBlockActions: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const CodeBlockContent: ({ code, language, showLineNumbers, }: {
24
+ code: string;
25
+ language: BundledLanguage;
26
+ showLineNumbers?: boolean;
27
+ }) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const CodeBlock: ({ code, language, showLineNumbers, className, children, ...props }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
29
+ export type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
30
+ onCopy?: () => void;
31
+ onError?: (error: Error) => void;
32
+ timeout?: number;
33
+ };
34
+ export declare const CodeBlockCopyButton: ({ onCopy, onError, timeout, children, className, ...props }: CodeBlockCopyButtonProps) => import("react/jsx-runtime").JSX.Element;
35
+ export type CodeBlockLanguageSelectorProps = ComponentProps<typeof Select>;
36
+ export declare const CodeBlockLanguageSelector: (props: CodeBlockLanguageSelectorProps) => import("react/jsx-runtime").JSX.Element;
37
+ export type CodeBlockLanguageSelectorTriggerProps = ComponentProps<typeof SelectTrigger>;
38
+ export declare const CodeBlockLanguageSelectorTrigger: ({ className, ...props }: CodeBlockLanguageSelectorTriggerProps) => import("react/jsx-runtime").JSX.Element;
39
+ export type CodeBlockLanguageSelectorValueProps = ComponentProps<typeof SelectValue>;
40
+ export declare const CodeBlockLanguageSelectorValue: (props: CodeBlockLanguageSelectorValueProps) => import("react/jsx-runtime").JSX.Element;
41
+ export type CodeBlockLanguageSelectorContentProps = ComponentProps<typeof SelectContent>;
42
+ export declare const CodeBlockLanguageSelectorContent: ({ align, ...props }: CodeBlockLanguageSelectorContentProps) => import("react/jsx-runtime").JSX.Element;
43
+ export type CodeBlockLanguageSelectorItemProps = ComponentProps<typeof SelectItem>;
44
+ export declare const CodeBlockLanguageSelectorItem: (props: CodeBlockLanguageSelectorItemProps) => import("react/jsx-runtime").JSX.Element;
45
+ export {};
46
+ //# sourceMappingURL=code-block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK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AAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACrE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6DAOjC,wBAAwB,4CA8C1B,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE3E,eAAO,MAAM,yBAAyB,GACpC,OAAO,8BAA8B,4CACb,CAAC;AAE3B,MAAM,MAAM,qCAAqC,GAAG,cAAc,CAChE,OAAO,aAAa,CACrB,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,yBAG9C,qCAAqC,4CASvC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,cAAc,CAC9D,OAAO,WAAW,CACnB,CAAC;AAEF,eAAO,MAAM,8BAA8B,GACzC,OAAO,mCAAmC,4CACb,CAAC;AAEhC,MAAM,MAAM,qCAAqC,GAAG,cAAc,CAChE,OAAO,aAAa,CACrB,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAAI,qBAG9C,qCAAqC,4CAEvC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,cAAc,CAC7D,OAAO,UAAU,CAClB,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,OAAO,kCAAkC,4CACb,CAAC"}
@@ -0,0 +1,216 @@
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 { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@chatsdk-dev/ui/atoms/select";
5
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
6
+ import { CheckIcon, CopyIcon } from "lucide-react";
7
+ import { createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
8
+ import { createHighlighter } from "shiki";
9
+ // Shiki uses bitflags for font styles: 1=italic, 2=bold, 4=underline
10
+ // oxlint-disable-next-line eslint(no-bitwise)
11
+ const isItalic = (fontStyle) => fontStyle && fontStyle & 1;
12
+ // oxlint-disable-next-line eslint(no-bitwise)
13
+ const isBold = (fontStyle) => fontStyle && fontStyle & 2;
14
+ const isUnderline = (fontStyle) =>
15
+ // oxlint-disable-next-line eslint(no-bitwise)
16
+ fontStyle && fontStyle & 4;
17
+ const addKeysToTokens = (lines) => lines.map((line, lineIdx) => ({
18
+ key: `line-${lineIdx}`,
19
+ tokens: line.map((token, tokenIdx) => ({
20
+ key: `line-${lineIdx}-${tokenIdx}`,
21
+ token,
22
+ })),
23
+ }));
24
+ // Token rendering component
25
+ const TokenSpan = ({ token }) => (_jsx("span", { className: "dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)]", style: {
26
+ backgroundColor: token.bgColor,
27
+ color: token.color,
28
+ fontStyle: isItalic(token.fontStyle) ? "italic" : undefined,
29
+ fontWeight: isBold(token.fontStyle) ? "bold" : undefined,
30
+ textDecoration: isUnderline(token.fontStyle) ? "underline" : undefined,
31
+ ...token.htmlStyle,
32
+ }, children: token.content }));
33
+ // Line number styles using CSS counters
34
+ const LINE_NUMBER_CLASSES = cn("block", "before:content-[counter(line)]", "before:inline-block", "before:[counter-increment:line]", "before:w-8", "before:mr-4", "before:text-right", "before:text-muted-foreground/50", "before:font-mono", "before:select-none");
35
+ // Line rendering component
36
+ const LineSpan = ({ keyedLine, showLineNumbers, }) => (_jsx("span", { className: showLineNumbers ? LINE_NUMBER_CLASSES : "block", children: keyedLine.tokens.length === 0
37
+ ? "\n"
38
+ : keyedLine.tokens.map(({ token, key }) => (_jsx(TokenSpan, { token: token }, key))) }));
39
+ // Context
40
+ const CodeBlockContext = createContext({
41
+ code: "",
42
+ });
43
+ // Highlighter cache (singleton per language)
44
+ const highlighterCache = new Map();
45
+ // Token cache
46
+ const tokensCache = new Map();
47
+ // Subscribers for async token updates
48
+ const subscribers = new Map();
49
+ const getTokensCacheKey = (code, language) => {
50
+ const start = code.slice(0, 100);
51
+ const end = code.length > 100 ? code.slice(-100) : "";
52
+ return `${language}:${code.length}:${start}:${end}`;
53
+ };
54
+ const getHighlighter = (language) => {
55
+ const cached = highlighterCache.get(language);
56
+ if (cached) {
57
+ return cached;
58
+ }
59
+ const highlighterPromise = createHighlighter({
60
+ langs: [language],
61
+ themes: ["github-light", "github-dark"],
62
+ });
63
+ highlighterCache.set(language, highlighterPromise);
64
+ return highlighterPromise;
65
+ };
66
+ // Create raw tokens for immediate display while highlighting loads
67
+ const createRawTokens = (code) => ({
68
+ bg: "transparent",
69
+ fg: "inherit",
70
+ tokens: code.split("\n").map((line) => line === ""
71
+ ? []
72
+ : [
73
+ {
74
+ color: "inherit",
75
+ content: line,
76
+ },
77
+ ]),
78
+ });
79
+ // Synchronous highlight with callback for async results
80
+ export const highlightCode = (code, language,
81
+ // oxlint-disable-next-line eslint-plugin-promise(prefer-await-to-callbacks)
82
+ callback) => {
83
+ const tokensCacheKey = getTokensCacheKey(code, language);
84
+ // Return cached result if available
85
+ const cached = tokensCache.get(tokensCacheKey);
86
+ if (cached) {
87
+ return cached;
88
+ }
89
+ // Subscribe callback if provided
90
+ if (callback) {
91
+ if (!subscribers.has(tokensCacheKey)) {
92
+ subscribers.set(tokensCacheKey, new Set());
93
+ }
94
+ subscribers.get(tokensCacheKey)?.add(callback);
95
+ }
96
+ // Start highlighting in background - fire-and-forget async pattern
97
+ getHighlighter(language)
98
+ // oxlint-disable-next-line eslint-plugin-promise(prefer-await-to-then)
99
+ .then((highlighter) => {
100
+ const availableLangs = highlighter.getLoadedLanguages();
101
+ const langToUse = availableLangs.includes(language) ? language : "text";
102
+ const result = highlighter.codeToTokens(code, {
103
+ lang: langToUse,
104
+ themes: {
105
+ dark: "github-dark",
106
+ light: "github-light",
107
+ },
108
+ });
109
+ const tokenized = {
110
+ bg: result.bg ?? "transparent",
111
+ fg: result.fg ?? "inherit",
112
+ tokens: result.tokens,
113
+ };
114
+ // Cache the result
115
+ tokensCache.set(tokensCacheKey, tokenized);
116
+ // Notify all subscribers
117
+ const subs = subscribers.get(tokensCacheKey);
118
+ if (subs) {
119
+ for (const sub of subs) {
120
+ sub(tokenized);
121
+ }
122
+ subscribers.delete(tokensCacheKey);
123
+ }
124
+ })
125
+ // oxlint-disable-next-line eslint-plugin-promise(prefer-await-to-then), eslint-plugin-promise(prefer-await-to-callbacks)
126
+ .catch((error) => {
127
+ console.error("Failed to highlight code:", error);
128
+ subscribers.delete(tokensCacheKey);
129
+ });
130
+ return null;
131
+ };
132
+ const CodeBlockBody = memo(({ tokenized, showLineNumbers, className, }) => {
133
+ const preStyle = useMemo(() => ({
134
+ backgroundColor: tokenized.bg,
135
+ color: tokenized.fg,
136
+ }), [tokenized.bg, tokenized.fg]);
137
+ const keyedLines = useMemo(() => addKeysToTokens(tokenized.tokens), [tokenized.tokens]);
138
+ return (_jsx("pre", { className: cn("dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)] m-0 p-4 text-sm", className), style: preStyle, children: _jsx("code", { className: cn("font-mono text-sm", showLineNumbers &&
139
+ "[counter-increment:line_0] [counter-reset:line]"), children: keyedLines.map((keyedLine) => (_jsx(LineSpan, { keyedLine: keyedLine, showLineNumbers: showLineNumbers }, keyedLine.key))) }) }));
140
+ }, (prevProps, nextProps) => prevProps.tokenized === nextProps.tokenized &&
141
+ prevProps.showLineNumbers === nextProps.showLineNumbers &&
142
+ prevProps.className === nextProps.className);
143
+ CodeBlockBody.displayName = "CodeBlockBody";
144
+ export const CodeBlockContainer = ({ className, language, style, ...props }) => (_jsx("div", { className: cn("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", className), "data-language": language, style: {
145
+ containIntrinsicSize: "auto 200px",
146
+ contentVisibility: "auto",
147
+ ...style,
148
+ }, ...props }));
149
+ export const CodeBlockHeader = ({ children, className, ...props }) => (_jsx("div", { className: cn("flex items-center justify-between border-b bg-muted/80 px-3 py-2 text-muted-foreground text-xs", className), ...props, children: children }));
150
+ export const CodeBlockTitle = ({ children, className, ...props }) => (_jsx("div", { className: cn("flex items-center gap-2", className), ...props, children: children }));
151
+ export const CodeBlockFilename = ({ children, className, ...props }) => (_jsx("span", { className: cn("font-mono", className), ...props, children: children }));
152
+ export const CodeBlockActions = ({ children, className, ...props }) => (_jsx("div", { className: cn("-my-1 -mr-1 flex items-center gap-2", className), ...props, children: children }));
153
+ export const CodeBlockContent = ({ code, language, showLineNumbers = false, }) => {
154
+ // Memoized raw tokens for immediate display
155
+ const rawTokens = useMemo(() => createRawTokens(code), [code]);
156
+ // Synchronous cache lookup — avoids setState in effect for cached results
157
+ const syncTokens = useMemo(() => highlightCode(code, language) ?? rawTokens, [code, language, rawTokens]);
158
+ // Async highlighting result (populated after shiki loads)
159
+ const [asyncTokens, setAsyncTokens] = useState(null);
160
+ const asyncKeyRef = useRef({ code, language });
161
+ // Invalidate stale async tokens synchronously during render
162
+ if (asyncKeyRef.current.code !== code ||
163
+ asyncKeyRef.current.language !== language) {
164
+ asyncKeyRef.current = { code, language };
165
+ setAsyncTokens(null);
166
+ }
167
+ useEffect(() => {
168
+ let cancelled = false;
169
+ highlightCode(code, language, (result) => {
170
+ if (!cancelled) {
171
+ setAsyncTokens(result);
172
+ }
173
+ });
174
+ return () => {
175
+ cancelled = true;
176
+ };
177
+ }, [code, language]);
178
+ const tokenized = asyncTokens ?? syncTokens;
179
+ return (_jsx("div", { className: "relative overflow-auto", children: _jsx(CodeBlockBody, { showLineNumbers: showLineNumbers, tokenized: tokenized }) }));
180
+ };
181
+ export const CodeBlock = ({ code, language, showLineNumbers = false, className, children, ...props }) => {
182
+ const contextValue = useMemo(() => ({ code }), [code]);
183
+ return (_jsx(CodeBlockContext.Provider, { value: contextValue, children: _jsxs(CodeBlockContainer, { className: className, language: language, ...props, children: [children, _jsx(CodeBlockContent, { code: code, language: language, showLineNumbers: showLineNumbers })] }) }));
184
+ };
185
+ export const CodeBlockCopyButton = ({ onCopy, onError, timeout = 2000, children, className, ...props }) => {
186
+ const [isCopied, setIsCopied] = useState(false);
187
+ const timeoutRef = useRef(0);
188
+ const { code } = useContext(CodeBlockContext);
189
+ const copyToClipboard = useCallback(async () => {
190
+ if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
191
+ onError?.(new Error("Clipboard API not available"));
192
+ return;
193
+ }
194
+ try {
195
+ if (!isCopied) {
196
+ await navigator.clipboard.writeText(code);
197
+ setIsCopied(true);
198
+ onCopy?.();
199
+ timeoutRef.current = window.setTimeout(() => setIsCopied(false), timeout);
200
+ }
201
+ }
202
+ catch (error) {
203
+ onError?.(error);
204
+ }
205
+ }, [code, onCopy, onError, timeout, isCopied]);
206
+ useEffect(() => () => {
207
+ window.clearTimeout(timeoutRef.current);
208
+ }, []);
209
+ const Icon = isCopied ? CheckIcon : CopyIcon;
210
+ return (_jsx(Button, { className: cn("shrink-0", className), onClick: copyToClipboard, size: "icon", variant: "ghost", ...props, children: children ?? _jsx(Icon, { size: 14 }) }));
211
+ };
212
+ export const CodeBlockLanguageSelector = (props) => _jsx(Select, { ...props });
213
+ export const CodeBlockLanguageSelectorTrigger = ({ className, ...props }) => (_jsx(SelectTrigger, { className: cn("h-7 border-none bg-transparent px-2 text-xs shadow-none", className), size: "sm", ...props }));
214
+ export const CodeBlockLanguageSelectorValue = (props) => _jsx(SelectValue, { ...props });
215
+ export const CodeBlockLanguageSelectorContent = ({ align = "end", ...props }) => (_jsx(SelectContent, { align: align, ...props }));
216
+ export const CodeBlockLanguageSelectorItem = (props) => _jsx(SelectItem, { ...props });
@@ -0,0 +1,65 @@
1
+ import { Avatar } from "@chatsdk-dev/ui/atoms/avatar";
2
+ import { Button } from "@chatsdk-dev/ui/atoms/button";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@chatsdk-dev/ui/atoms/collapsible";
4
+ import { FileIcon } from "lucide-react";
5
+ import type { ComponentProps, HTMLAttributes } from "react";
6
+ export type CommitProps = ComponentProps<typeof Collapsible>;
7
+ export declare const Commit: ({ className, children, ...props }: CommitProps) => import("react/jsx-runtime").JSX.Element;
8
+ export type CommitHeaderProps = ComponentProps<typeof CollapsibleTrigger>;
9
+ export declare const CommitHeader: ({ className, children, ...props }: CommitHeaderProps) => import("react/jsx-runtime").JSX.Element;
10
+ export type CommitHashProps = HTMLAttributes<HTMLSpanElement>;
11
+ export declare const CommitHash: ({ className, children, ...props }: CommitHashProps) => import("react/jsx-runtime").JSX.Element;
12
+ export type CommitMessageProps = HTMLAttributes<HTMLSpanElement>;
13
+ export declare const CommitMessage: ({ className, children, ...props }: CommitMessageProps) => import("react/jsx-runtime").JSX.Element;
14
+ export type CommitMetadataProps = HTMLAttributes<HTMLDivElement>;
15
+ export declare const CommitMetadata: ({ className, children, ...props }: CommitMetadataProps) => import("react/jsx-runtime").JSX.Element;
16
+ export type CommitSeparatorProps = HTMLAttributes<HTMLSpanElement>;
17
+ export declare const CommitSeparator: ({ className, children, ...props }: CommitSeparatorProps) => import("react/jsx-runtime").JSX.Element;
18
+ export type CommitInfoProps = HTMLAttributes<HTMLDivElement>;
19
+ export declare const CommitInfo: ({ className, children, ...props }: CommitInfoProps) => import("react/jsx-runtime").JSX.Element;
20
+ export type CommitAuthorProps = HTMLAttributes<HTMLDivElement>;
21
+ export declare const CommitAuthor: ({ className, children, ...props }: CommitAuthorProps) => import("react/jsx-runtime").JSX.Element;
22
+ export type CommitAuthorAvatarProps = ComponentProps<typeof Avatar> & {
23
+ initials: string;
24
+ };
25
+ export declare const CommitAuthorAvatar: ({ initials, className, ...props }: CommitAuthorAvatarProps) => import("react/jsx-runtime").JSX.Element;
26
+ export type CommitTimestampProps = HTMLAttributes<HTMLTimeElement> & {
27
+ date: Date;
28
+ };
29
+ export declare const CommitTimestamp: ({ date, className, children, ...props }: CommitTimestampProps) => import("react/jsx-runtime").JSX.Element;
30
+ export type CommitActionsProps = HTMLAttributes<HTMLDivElement>;
31
+ export declare const CommitActions: ({ className, children, ...props }: CommitActionsProps) => import("react/jsx-runtime").JSX.Element;
32
+ export type CommitCopyButtonProps = ComponentProps<typeof Button> & {
33
+ hash: string;
34
+ onCopy?: () => void;
35
+ onError?: (error: Error) => void;
36
+ timeout?: number;
37
+ };
38
+ export declare const CommitCopyButton: ({ hash, onCopy, onError, timeout, children, className, ...props }: CommitCopyButtonProps) => import("react/jsx-runtime").JSX.Element;
39
+ export type CommitContentProps = ComponentProps<typeof CollapsibleContent>;
40
+ export declare const CommitContent: ({ className, children, ...props }: CommitContentProps) => import("react/jsx-runtime").JSX.Element;
41
+ export type CommitFilesProps = HTMLAttributes<HTMLDivElement>;
42
+ export declare const CommitFiles: ({ className, children, ...props }: CommitFilesProps) => import("react/jsx-runtime").JSX.Element;
43
+ export type CommitFileProps = HTMLAttributes<HTMLDivElement>;
44
+ export declare const CommitFile: ({ className, children, ...props }: CommitFileProps) => import("react/jsx-runtime").JSX.Element;
45
+ export type CommitFileInfoProps = HTMLAttributes<HTMLDivElement>;
46
+ export declare const CommitFileInfo: ({ className, children, ...props }: CommitFileInfoProps) => import("react/jsx-runtime").JSX.Element;
47
+ export type CommitFileStatusProps = HTMLAttributes<HTMLSpanElement> & {
48
+ status: "added" | "modified" | "deleted" | "renamed";
49
+ };
50
+ export declare const CommitFileStatus: ({ status, className, children, ...props }: CommitFileStatusProps) => import("react/jsx-runtime").JSX.Element;
51
+ export type CommitFileIconProps = ComponentProps<typeof FileIcon>;
52
+ export declare const CommitFileIcon: ({ className, ...props }: CommitFileIconProps) => import("react/jsx-runtime").JSX.Element;
53
+ export type CommitFilePathProps = HTMLAttributes<HTMLSpanElement>;
54
+ export declare const CommitFilePath: ({ className, children, ...props }: CommitFilePathProps) => import("react/jsx-runtime").JSX.Element;
55
+ export type CommitFileChangesProps = HTMLAttributes<HTMLDivElement>;
56
+ export declare const CommitFileChanges: ({ className, children, ...props }: CommitFileChangesProps) => import("react/jsx-runtime").JSX.Element;
57
+ export type CommitFileAdditionsProps = HTMLAttributes<HTMLSpanElement> & {
58
+ count: number;
59
+ };
60
+ export declare const CommitFileAdditions: ({ count, className, children, ...props }: CommitFileAdditionsProps) => import("react/jsx-runtime").JSX.Element | null;
61
+ export type CommitFileDeletionsProps = HTMLAttributes<HTMLSpanElement> & {
62
+ count: number;
63
+ };
64
+ export declare const CommitFileDeletions: ({ count, className, children, ...props }: CommitFileDeletionsProps) => import("react/jsx-runtime").JSX.Element | null;
65
+ //# sourceMappingURL=commit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/commit.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAkB,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAGL,QAAQ,EAIT,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5D,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC;AAE7D,eAAO,MAAM,MAAM,GAAI,mCAAmC,WAAW,4CAOpE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE1E,eAAO,MAAM,YAAY,GAAI,mCAI1B,iBAAiB,4CAanB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU,GAAI,mCAIxB,eAAe,4CAKjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAEjE,eAAO,MAAM,aAAa,GAAI,mCAI3B,kBAAkB,4CAIpB,CAAC;AAEF,MAAM,MAAM,mBA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AO,MAAM,mBAAmB,GAAI,0CAKjC,wBAAwB,mDAkB1B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,eAAe,CAAC,GAAG;IACvE,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,0CAKjC,wBAAwB,mDAkB1B,CAAC"}
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Avatar, AvatarFallback } from "@chatsdk-dev/ui/atoms/avatar";
4
+ import { Button } from "@chatsdk-dev/ui/atoms/button";
5
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@chatsdk-dev/ui/atoms/collapsible";
6
+ import { cn } from "@chatsdk-dev/ui/lib/utils";
7
+ import { CheckIcon, CopyIcon, FileIcon, GitCommitIcon, MinusIcon, PlusIcon, } from "lucide-react";
8
+ import { useCallback, useEffect, useRef, useState } from "react";
9
+ export const Commit = ({ className, children, ...props }) => (_jsx(Collapsible, { className: cn("rounded-lg border bg-background", className), ...props, children: children }));
10
+ export const CommitHeader = ({ className, children, ...props }) => (_jsx(CollapsibleTrigger, { render: () => (_jsx("div", { className: cn("group flex cursor-pointer items-center justify-between gap-4 p-3 text-left transition-colors hover:opacity-80", className), children: children })) }));
11
+ export const CommitHash = ({ className, children, ...props }) => (_jsxs("span", { className: cn("font-mono text-xs", className), ...props, children: [_jsx(GitCommitIcon, { className: "mr-1 inline-block size-3" }), children] }));
12
+ export const CommitMessage = ({ className, children, ...props }) => (_jsx("span", { className: cn("font-medium text-sm", className), ...props, children: children }));
13
+ export const CommitMetadata = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center gap-2 text-muted-foreground text-xs", className), ...props, children: children }));
14
+ export const CommitSeparator = ({ className, children, ...props }) => (_jsx("span", { className: className, ...props, children: children ?? "•" }));
15
+ export const CommitInfo = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex flex-1 flex-col", className), ...props, children: children }));
16
+ export const CommitAuthor = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center", className), ...props, children: children }));
17
+ export const CommitAuthorAvatar = ({ initials, className, ...props }) => (_jsx(Avatar, { className: cn("size-8", className), ...props, children: _jsx(AvatarFallback, { className: "text-xs", children: initials }) }));
18
+ const relativeTimeFormat = new Intl.RelativeTimeFormat("en", {
19
+ numeric: "auto",
20
+ });
21
+ const formatRelativeDate = (date) => {
22
+ const days = Math.round((date.getTime() - Date.now()) / (1000 * 60 * 60 * 24));
23
+ return relativeTimeFormat.format(days, "day");
24
+ };
25
+ export const CommitTimestamp = ({ date, className, children, ...props }) => {
26
+ const [formatted, setFormatted] = useState("");
27
+ const updateFormatted = useCallback(() => {
28
+ setFormatted(formatRelativeDate(date));
29
+ }, [date]);
30
+ useEffect(() => {
31
+ updateFormatted();
32
+ }, [updateFormatted]);
33
+ return (_jsx("time", { className: cn("text-xs", className), dateTime: date.toISOString(), ...props, children: children ?? formatted }));
34
+ };
35
+ const handleActionsClick = (e) => e.stopPropagation();
36
+ const handleActionsKeyDown = (e) => e.stopPropagation();
37
+ export const CommitActions = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center gap-1", className), onClick: handleActionsClick, onKeyDown: handleActionsKeyDown, role: "group", ...props, children: children }));
38
+ export const CommitCopyButton = ({ hash, onCopy, onError, timeout = 2000, children, className, ...props }) => {
39
+ const [isCopied, setIsCopied] = useState(false);
40
+ const timeoutRef = useRef(0);
41
+ const copyToClipboard = useCallback(async () => {
42
+ if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
43
+ onError?.(new Error("Clipboard API not available"));
44
+ return;
45
+ }
46
+ try {
47
+ if (!isCopied) {
48
+ await navigator.clipboard.writeText(hash);
49
+ setIsCopied(true);
50
+ onCopy?.();
51
+ timeoutRef.current = window.setTimeout(() => setIsCopied(false), timeout);
52
+ }
53
+ }
54
+ catch (error) {
55
+ onError?.(error);
56
+ }
57
+ }, [hash, onCopy, onError, timeout, isCopied]);
58
+ useEffect(() => () => {
59
+ window.clearTimeout(timeoutRef.current);
60
+ }, []);
61
+ const Icon = isCopied ? CheckIcon : CopyIcon;
62
+ return (_jsx(Button, { className: cn("size-7 shrink-0", className), onClick: copyToClipboard, size: "icon", variant: "ghost", ...props, children: children ?? _jsx(Icon, { size: 14 }) }));
63
+ };
64
+ export const CommitContent = ({ className, children, ...props }) => (_jsx(CollapsibleContent, { className: cn("border-t p-3", className), ...props, children: children }));
65
+ export const CommitFiles = ({ className, children, ...props }) => (_jsx("div", { className: cn("space-y-1", className), ...props, children: children }));
66
+ export const CommitFile = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex items-center justify-between gap-2 rounded px-2 py-1 text-sm hover:bg-muted/50", className), ...props, children: children }));
67
+ export const CommitFileInfo = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex min-w-0 items-center gap-2", className), ...props, children: children }));
68
+ const fileStatusStyles = {
69
+ added: "text-green-600 dark:text-green-400",
70
+ deleted: "text-red-600 dark:text-red-400",
71
+ modified: "text-yellow-600 dark:text-yellow-400",
72
+ renamed: "text-blue-600 dark:text-blue-400",
73
+ };
74
+ const fileStatusLabels = {
75
+ added: "A",
76
+ deleted: "D",
77
+ modified: "M",
78
+ renamed: "R",
79
+ };
80
+ export const CommitFileStatus = ({ status, className, children, ...props }) => (_jsx("span", { className: cn("font-medium font-mono text-xs", fileStatusStyles[status], className), ...props, children: children ?? fileStatusLabels[status] }));
81
+ export const CommitFileIcon = ({ className, ...props }) => (_jsx(FileIcon, { className: cn("size-3.5 shrink-0 text-muted-foreground", className), ...props }));
82
+ export const CommitFilePath = ({ className, children, ...props }) => (_jsx("span", { className: cn("truncate font-mono text-xs", className), ...props, children: children }));
83
+ export const CommitFileChanges = ({ className, children, ...props }) => (_jsx("div", { className: cn("flex shrink-0 items-center gap-1 font-mono text-xs", className), ...props, children: children }));
84
+ export const CommitFileAdditions = ({ count, className, children, ...props }) => {
85
+ if (count <= 0) {
86
+ return null;
87
+ }
88
+ return (_jsx("span", { className: cn("text-green-600 dark:text-green-400", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(PlusIcon, { className: "inline-block size-3" }), count] })) }));
89
+ };
90
+ export const CommitFileDeletions = ({ count, className, children, ...props }) => {
91
+ if (count <= 0) {
92
+ return null;
93
+ }
94
+ return (_jsx("span", { className: cn("text-red-600 dark:text-red-400", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsx(MinusIcon, { className: "inline-block size-3" }), count] })) }));
95
+ };
@@ -0,0 +1,50 @@
1
+ import { Alert, AlertDescription } from "@chatsdk-dev/ui/atoms/alert";
2
+ import { Button } from "@chatsdk-dev/ui/atoms/button";
3
+ import type { ToolUIPart } from "ai";
4
+ import type { ComponentProps, ReactNode } from "react";
5
+ type ToolUIPartApproval = {
6
+ id: string;
7
+ approved?: never;
8
+ reason?: never;
9
+ } | {
10
+ id: string;
11
+ approved: boolean;
12
+ reason?: string;
13
+ } | {
14
+ id: string;
15
+ approved: true;
16
+ reason?: string;
17
+ } | {
18
+ id: string;
19
+ approved: true;
20
+ reason?: string;
21
+ } | {
22
+ id: string;
23
+ approved: false;
24
+ reason?: string;
25
+ } | undefined;
26
+ export type ConfirmationProps = ComponentProps<typeof Alert> & {
27
+ approval?: ToolUIPartApproval;
28
+ state: ToolUIPart["state"];
29
+ };
30
+ export declare const Confirmation: ({ className, approval, state, ...props }: ConfirmationProps) => import("react/jsx-runtime").JSX.Element | null;
31
+ export type ConfirmationTitleProps = ComponentProps<typeof AlertDescription>;
32
+ export declare const ConfirmationTitle: ({ className, ...props }: ConfirmationTitleProps) => import("react/jsx-runtime").JSX.Element;
33
+ export interface ConfirmationRequestProps {
34
+ children?: ReactNode;
35
+ }
36
+ export declare const ConfirmationRequest: ({ children }: ConfirmationRequestProps) => ReactNode;
37
+ export interface ConfirmationAcceptedProps {
38
+ children?: ReactNode;
39
+ }
40
+ export declare const ConfirmationAccepted: ({ children, }: ConfirmationAcceptedProps) => ReactNode;
41
+ export interface ConfirmationRejectedProps {
42
+ children?: ReactNode;
43
+ }
44
+ export declare const ConfirmationRejected: ({ children, }: ConfirmationRejectedProps) => ReactNode;
45
+ export type ConfirmationActionsProps = ComponentProps<"div">;
46
+ export declare const ConfirmationActions: ({ className, ...props }: ConfirmationActionsProps) => import("react/jsx-runtime").JSX.Element | null;
47
+ export type ConfirmationActionProps = ComponentProps<typeof Button>;
48
+ export declare const ConfirmationAction: (props: ConfirmationActionProps) => import("react/jsx-runtime").JSX.Element;
49
+ export {};
50
+ //# sourceMappingURL=confirmation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../../src/molecules/ai/confirmation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,KAAK,kBAAkB,GACnB;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,CAAC;IACh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