@chatsdk-dev/elements 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 (329) hide show
  1. package/README.md +3 -3
  2. package/dist/api-CIYPz72L.d.ts +10 -0
  3. package/dist/api-CIYPz72L.d.ts.map +1 -0
  4. package/dist/callbacks-PIvHXeEI.d.ts +24 -0
  5. package/dist/callbacks-PIvHXeEI.d.ts.map +1 -0
  6. package/dist/chat-element-CCsDDFif.js +441 -0
  7. package/dist/chat-element-CCsDDFif.js.map +1 -0
  8. package/dist/chat-element-CSpa62Te.d.ts +53 -0
  9. package/dist/chat-element-CSpa62Te.d.ts.map +1 -0
  10. package/dist/chatsdk-provider-BhlChLFd.d.ts +15 -0
  11. package/dist/chatsdk-provider-BhlChLFd.d.ts.map +1 -0
  12. package/dist/common/utils.d.ts +14 -0
  13. package/dist/common/utils.d.ts.map +1 -0
  14. package/dist/common/utils.js +26 -0
  15. package/dist/common/utils.js.map +1 -0
  16. package/dist/components/info-card.d.ts +20 -11
  17. package/dist/components/info-card.d.ts.map +1 -0
  18. package/dist/components/info-card.js +38 -1
  19. package/dist/components/info-card.js.map +1 -0
  20. package/dist/config-BigIL6TQ.js +29 -0
  21. package/dist/config-BigIL6TQ.js.map +1 -0
  22. package/dist/config-CqihvSgz.d.ts +150 -0
  23. package/dist/config-CqihvSgz.d.ts.map +1 -0
  24. package/dist/config-D_jVTH_D.d.ts +58 -0
  25. package/dist/config-D_jVTH_D.d.ts.map +1 -0
  26. package/dist/context-aSaHw-ac.d.ts +13 -0
  27. package/dist/context-aSaHw-ac.d.ts.map +1 -0
  28. package/dist/element-provider-C_nBsftD.d.ts +40 -0
  29. package/dist/element-provider-C_nBsftD.d.ts.map +1 -0
  30. package/dist/features/chat/chat-card.d.ts +5 -3
  31. package/dist/features/chat/chat-card.d.ts.map +1 -0
  32. package/dist/features/chat/chat-card.js +2 -14
  33. package/dist/features/chat/chat-element.d.ts +2 -0
  34. package/dist/features/chat/chat-element.js +2 -0
  35. package/dist/features/chat/chat-header/chat-header.d.ts +8 -4
  36. package/dist/features/chat/chat-header/chat-header.d.ts.map +1 -0
  37. package/dist/features/chat/chat-header/chat-header.js +2 -14
  38. package/dist/features/chat/chat-header/chat-menu.d.ts +5 -3
  39. package/dist/features/chat/chat-header/chat-menu.d.ts.map +1 -0
  40. package/dist/features/chat/chat-header/chat-menu.js +29 -2
  41. package/dist/features/chat/chat-header/chat-menu.js.map +1 -0
  42. package/dist/features/chat/chat-history/chat-history-empty.d.ts +5 -3
  43. package/dist/features/chat/chat-history/chat-history-empty.d.ts.map +1 -0
  44. package/dist/features/chat/chat-history/chat-history-empty.js +24 -1
  45. package/dist/features/chat/chat-history/chat-history-empty.js.map +1 -0
  46. package/dist/features/chat/chat-history/chat-history.d.ts +5 -3
  47. package/dist/features/chat/chat-history/chat-history.d.ts.map +1 -0
  48. package/dist/features/chat/chat-history/chat-history.js +2 -14
  49. package/dist/features/chat/chat-main/chat-main.d.ts +10 -0
  50. package/dist/features/chat/chat-main/chat-main.d.ts.map +1 -0
  51. package/dist/features/chat/chat-main/chat-main.js +3 -0
  52. package/dist/features/chat/chat-main/use-chat.d.ts +23 -0
  53. package/dist/features/chat/chat-main/use-chat.d.ts.map +1 -0
  54. package/dist/features/chat/chat-main/use-chat.js +3 -0
  55. package/dist/features/chat/chat-main/use-initial-messages.d.ts +22 -0
  56. package/dist/features/chat/chat-main/use-initial-messages.d.ts.map +1 -0
  57. package/dist/features/chat/chat-main/use-initial-messages.js +2 -0
  58. package/dist/features/chat/chat-prompt-input.d.ts +20 -12
  59. package/dist/features/chat/chat-prompt-input.d.ts.map +1 -0
  60. package/dist/features/chat/chat-prompt-input.js +3 -14
  61. package/dist/features/chat/chat.context.d.ts +17 -15
  62. package/dist/features/chat/chat.context.d.ts.map +1 -0
  63. package/dist/features/chat/chat.context.js +9 -12
  64. package/dist/features/chat/chat.context.js.map +1 -0
  65. package/dist/features/chat/index.d.ts +2 -14
  66. package/dist/features/chat/index.js +2 -14
  67. package/dist/features/chat/queries/query-keys.d.ts +7 -5
  68. package/dist/features/chat/queries/query-keys.d.ts.map +1 -0
  69. package/dist/features/chat/queries/query-keys.js +19 -1
  70. package/dist/features/chat/queries/query-keys.js.map +1 -0
  71. package/dist/features/chat/queries/use-create-conversation-mutation.d.ts +27 -23
  72. package/dist/features/chat/queries/use-create-conversation-mutation.d.ts.map +1 -0
  73. package/dist/features/chat/queries/use-create-conversation-mutation.js +17 -36
  74. package/dist/features/chat/queries/use-create-conversation-mutation.js.map +1 -0
  75. package/dist/features/chat/queries/use-get-chat-query.d.ts +9 -5
  76. package/dist/features/chat/queries/use-get-chat-query.d.ts.map +1 -0
  77. package/dist/features/chat/queries/use-get-chat-query.js +2 -14
  78. package/dist/features/chat/queries/use-get-conversation-query.d.ts +56 -46
  79. package/dist/features/chat/queries/use-get-conversation-query.d.ts.map +1 -0
  80. package/dist/features/chat/queries/use-get-conversation-query.js +2 -14
  81. package/dist/features/chat/queries/use-list-conversations-query.d.ts +27 -23
  82. package/dist/features/chat/queries/use-list-conversations-query.d.ts.map +1 -0
  83. package/dist/features/chat/queries/use-list-conversations-query.js +2 -14
  84. package/dist/features/chat/store.d.ts +10 -8
  85. package/dist/features/chat/store.d.ts.map +1 -0
  86. package/dist/features/chat/store.js +15 -1
  87. package/dist/features/chat/store.js.map +1 -0
  88. package/dist/features/chat/utils.d.ts +4 -2
  89. package/dist/features/chat/utils.d.ts.map +1 -0
  90. package/dist/features/chat/utils.js +15 -1
  91. package/dist/features/chat/utils.js.map +1 -0
  92. package/dist/features/data-fetching/use-api-client.d.ts +5 -3
  93. package/dist/features/data-fetching/use-api-client.d.ts.map +1 -0
  94. package/dist/features/data-fetching/use-api-client.js +2 -14
  95. package/dist/features/element/chatsdk-provider.d.ts +2 -0
  96. package/dist/features/element/chatsdk-provider.js +23 -0
  97. package/dist/features/element/chatsdk-provider.js.map +1 -0
  98. package/dist/features/element/constants.d.ts +5 -0
  99. package/dist/features/element/constants.d.ts.map +1 -0
  100. package/dist/features/element/constants.js +6 -0
  101. package/dist/features/element/constants.js.map +1 -0
  102. package/dist/features/element/element-provider.d.ts +2 -0
  103. package/dist/features/element/element-provider.js +82 -0
  104. package/dist/features/element/element-provider.js.map +1 -0
  105. package/dist/features/element/store.d.ts +2 -0
  106. package/dist/features/element/store.js +112 -0
  107. package/dist/features/element/store.js.map +1 -0
  108. package/dist/features/element/types/api.d.ts +2 -0
  109. package/dist/features/element/types/api.js +1 -0
  110. package/dist/features/element/types/callbacks.d.ts +2 -0
  111. package/dist/features/element/types/callbacks.js +1 -0
  112. package/dist/features/element/types/config.d.ts +2 -0
  113. package/dist/features/element/types/config.js +1 -0
  114. package/dist/features/element/types/context.d.ts +2 -0
  115. package/dist/features/element/types/context.js +1 -0
  116. package/dist/features/element/types/locale.d.ts +2 -0
  117. package/dist/features/element/types/locale.js +1 -0
  118. package/dist/features/element/types/theme.d.ts +2 -0
  119. package/dist/features/element/types/theme.js +1 -0
  120. package/dist/features/element/types/translations.d.ts +2 -0
  121. package/dist/features/element/types/translations.js +1 -0
  122. package/dist/features/element/use-element-config.d.ts +40 -0
  123. package/dist/features/element/use-element-config.d.ts.map +1 -0
  124. package/dist/features/element/use-element-config.js +39 -0
  125. package/dist/features/element/use-element-config.js.map +1 -0
  126. package/dist/features/element/use-merge-global-config.d.ts +20 -0
  127. package/dist/features/element/use-merge-global-config.d.ts.map +1 -0
  128. package/dist/features/element/use-merge-global-config.js +34 -0
  129. package/dist/features/element/use-merge-global-config.js.map +1 -0
  130. package/dist/features/element/utils.d.ts +2 -0
  131. package/dist/features/element/utils.js +86 -0
  132. package/dist/features/element/utils.js.map +1 -0
  133. package/dist/features/logger/logger.d.ts +2 -9
  134. package/dist/features/logger/logger.js +15 -1
  135. package/dist/features/logger/logger.js.map +1 -0
  136. package/dist/i18n/config.d.ts +2 -61
  137. package/dist/i18n/config.js +2 -1
  138. package/dist/i18n/i18next.d.ts +1382 -10
  139. package/dist/i18n/i18next.d.ts.map +1 -0
  140. package/dist/i18n/i18next.js +27 -2
  141. package/dist/i18n/i18next.js.map +1 -0
  142. package/dist/i18n/utils.d.ts +4 -3
  143. package/dist/i18n/utils.d.ts.map +1 -0
  144. package/dist/i18n/utils.js +10 -3
  145. package/dist/i18n/utils.js.map +1 -0
  146. package/dist/index.d.ts +5 -20
  147. package/dist/index.js +68 -20
  148. package/dist/index.js.map +1 -0
  149. package/dist/locale-W5Kyyi4X.d.ts +11 -0
  150. package/dist/locale-W5Kyyi4X.d.ts.map +1 -0
  151. package/dist/logger-BvmhODdq.d.ts +11 -0
  152. package/dist/logger-BvmhODdq.d.ts.map +1 -0
  153. package/dist/store-CGX9oRlE.d.ts +46 -0
  154. package/dist/store-CGX9oRlE.d.ts.map +1 -0
  155. package/dist/styles.css +1954 -1963
  156. package/dist/theme-Cb-RBWbR.d.ts +38 -0
  157. package/dist/theme-Cb-RBWbR.d.ts.map +1 -0
  158. package/package.json +18 -50
  159. package/dist/chunk-2LHKM7RD.js +0 -14
  160. package/dist/chunk-5UMYP6MD.js +0 -10
  161. package/dist/chunk-AP4MG32M.js +0 -36
  162. package/dist/chunk-CFM57HOS.js +0 -358
  163. package/dist/chunk-EGIUE7H2.js +0 -37
  164. package/dist/chunk-M5OONVIO.js +0 -90
  165. package/dist/chunk-MXTBCHYC.js +0 -31
  166. package/dist/chunk-NIC3MOMY.js +0 -55
  167. package/dist/chunk-QTRMNIG3.js +0 -83
  168. package/dist/chunk-R7G3RQLU.js +0 -36
  169. package/dist/chunk-RJG5D2TM.js +0 -113
  170. package/dist/chunk-SLJNKQ2G.js +0 -125
  171. package/dist/chunk-TDEFIW2L.js +0 -9
  172. package/dist/chunk-TDP6D7U7.js +0 -551
  173. package/dist/chunk-V2ITXC65.js +0 -24
  174. package/dist/chunk-VS55HRUS.js +0 -16
  175. package/dist/chunk-VYDYCGJL.js +0 -25
  176. package/dist/chunk-X5YUF2YM.js +0 -113
  177. package/dist/chunk-YX46JVQN.js +0 -78
  178. package/dist/chunk-YXAMLTTT.js +0 -16
  179. package/dist/chunk-YXFVHSY4.js +0 -51
  180. package/dist/chunk-ZCSZX3OI.js +0 -4
  181. package/dist/common/use-copy-to-clipboard.d.ts +0 -3
  182. package/dist/common/use-copy-to-clipboard.js +0 -33
  183. package/dist/common/utilts.d.ts +0 -8
  184. package/dist/common/utilts.js +0 -28
  185. package/dist/components/ai-elements/actions.d.ts +0 -13
  186. package/dist/components/ai-elements/actions.js +0 -42
  187. package/dist/components/ai-elements/agent.d.ts +0 -31
  188. package/dist/components/ai-elements/agent.js +0 -77
  189. package/dist/components/ai-elements/artifact.d.ts +0 -27
  190. package/dist/components/ai-elements/artifact.js +0 -108
  191. package/dist/components/ai-elements/attachments.d.ts +0 -57
  192. package/dist/components/ai-elements/attachments.js +0 -258
  193. package/dist/components/ai-elements/audio-player.d.ts +0 -33
  194. package/dist/components/ai-elements/audio-player.js +0 -199
  195. package/dist/components/ai-elements/canvas.d.ts +0 -10
  196. package/dist/components/ai-elements/canvas.js +0 -24
  197. package/dist/components/ai-elements/chain-of-thought.d.ts +0 -34
  198. package/dist/components/ai-elements/chain-of-thought.js +0 -159
  199. package/dist/components/ai-elements/checkpoint.d.ts +0 -16
  200. package/dist/components/ai-elements/checkpoint.js +0 -47
  201. package/dist/components/ai-elements/code-block.d.ts +0 -48
  202. package/dist/components/ai-elements/code-block.js +0 -1
  203. package/dist/components/ai-elements/commit.d.ts +0 -68
  204. package/dist/components/ai-elements/commit.js +0 -314
  205. package/dist/components/ai-elements/confirmation.d.ts +0 -52
  206. package/dist/components/ai-elements/confirmation.js +0 -76
  207. package/dist/components/ai-elements/connection.d.ts +0 -5
  208. package/dist/components/ai-elements/connection.js +0 -34
  209. package/dist/components/ai-elements/context.d.ts +0 -36
  210. package/dist/components/ai-elements/context.js +0 -320
  211. package/dist/components/ai-elements/controls.d.ts +0 -8
  212. package/dist/components/ai-elements/controls.js +0 -17
  213. package/dist/components/ai-elements/conversation.d.ts +0 -27
  214. package/dist/components/ai-elements/conversation.js +0 -119
  215. package/dist/components/ai-elements/edge.d.ts +0 -9
  216. package/dist/components/ai-elements/edge.js +0 -111
  217. package/dist/components/ai-elements/environment-variables.d.ts +0 -42
  218. package/dist/components/ai-elements/environment-variables.js +0 -208
  219. package/dist/components/ai-elements/file-tree.d.ts +0 -30
  220. package/dist/components/ai-elements/file-tree.js +0 -212
  221. package/dist/components/ai-elements/image.d.ts +0 -10
  222. package/dist/components/ai-elements/image.js +0 -23
  223. package/dist/components/ai-elements/inline-citation.d.ts +0 -42
  224. package/dist/components/ai-elements/inline-citation.js +0 -203
  225. package/dist/components/ai-elements/jsx-preview.d.ts +0 -33
  226. package/dist/components/ai-elements/jsx-preview.js +0 -206
  227. package/dist/components/ai-elements/loader.d.ts +0 -9
  228. package/dist/components/ai-elements/loader.js +0 -115
  229. package/dist/components/ai-elements/message.d.ts +0 -42
  230. package/dist/components/ai-elements/message.js +0 -259
  231. package/dist/components/ai-elements/mic-selector.d.ts +0 -49
  232. package/dist/components/ai-elements/mic-selector.js +0 -252
  233. package/dist/components/ai-elements/model-selector.d.ts +0 -39
  234. package/dist/components/ai-elements/model-selector.js +0 -73
  235. package/dist/components/ai-elements/node.d.ts +0 -25
  236. package/dist/components/ai-elements/node.js +0 -41
  237. package/dist/components/ai-elements/open-in-chat.d.ts +0 -32
  238. package/dist/components/ai-elements/open-in-chat.js +0 -366
  239. package/dist/components/ai-elements/package-info.d.ts +0 -32
  240. package/dist/components/ai-elements/package-info.js +0 -162
  241. package/dist/components/ai-elements/panel.d.ts +0 -8
  242. package/dist/components/ai-elements/panel.js +0 -17
  243. package/dist/components/ai-elements/persona.d.ts +0 -50
  244. package/dist/components/ai-elements/persona.js +0 -209
  245. package/dist/components/ai-elements/plan.d.ts +0 -29
  246. package/dist/components/ai-elements/plan.js +0 -95
  247. package/dist/components/ai-elements/prompt-input.d.ts +0 -153
  248. package/dist/components/ai-elements/prompt-input.js +0 -939
  249. package/dist/components/ai-elements/queue.d.ts +0 -65
  250. package/dist/components/ai-elements/queue.js +0 -179
  251. package/dist/components/ai-elements/reasoning.d.ts +0 -30
  252. package/dist/components/ai-elements/reasoning.js +0 -161
  253. package/dist/components/ai-elements/response.d.ts +0 -9
  254. package/dist/components/ai-elements/response.js +0 -33
  255. package/dist/components/ai-elements/sandbox.d.ts +0 -28
  256. package/dist/components/ai-elements/sandbox.js +0 -98
  257. package/dist/components/ai-elements/schema-display.d.ts +0 -58
  258. package/dist/components/ai-elements/schema-display.js +0 -313
  259. package/dist/components/ai-elements/shimmer.d.ts +0 -14
  260. package/dist/components/ai-elements/shimmer.js +0 -1
  261. package/dist/components/ai-elements/snippet.d.ts +0 -22
  262. package/dist/components/ai-elements/snippet.js +0 -90
  263. package/dist/components/ai-elements/sources.d.ts +0 -16
  264. package/dist/components/ai-elements/sources.js +0 -62
  265. package/dist/components/ai-elements/speech-input.d.ts +0 -57
  266. package/dist/components/ai-elements/speech-input.js +0 -206
  267. package/dist/components/ai-elements/stack-trace.d.ts +0 -42
  268. package/dist/components/ai-elements/stack-trace.js +0 -377
  269. package/dist/components/ai-elements/suggestion.d.ts +0 -14
  270. package/dist/components/ai-elements/suggestion.js +0 -41
  271. package/dist/components/ai-elements/task.d.ts +0 -18
  272. package/dist/components/ai-elements/task.js +0 -60
  273. package/dist/components/ai-elements/terminal.d.ts +0 -31
  274. package/dist/components/ai-elements/terminal.js +0 -203
  275. package/dist/components/ai-elements/test-results.d.ts +0 -61
  276. package/dist/components/ai-elements/test-results.js +0 -349
  277. package/dist/components/ai-elements/tool.d.ts +0 -35
  278. package/dist/components/ai-elements/tool.js +0 -2
  279. package/dist/components/ai-elements/toolbar.d.ts +0 -8
  280. package/dist/components/ai-elements/toolbar.js +0 -18
  281. package/dist/components/ai-elements/transcription.d.ts +0 -19
  282. package/dist/components/ai-elements/transcription.js +0 -90
  283. package/dist/components/ai-elements/voice-selector.d.ts +0 -66
  284. package/dist/components/ai-elements/voice-selector.js +0 -332
  285. package/dist/components/ai-elements/web-preview.d.ts +0 -38
  286. package/dist/components/ai-elements/web-preview.js +0 -214
  287. package/dist/components/responsive-alert-dialog.d.ts +0 -19
  288. package/dist/components/responsive-alert-dialog.js +0 -1
  289. package/dist/components/responsive-dialog.d.ts +0 -14
  290. package/dist/components/responsive-dialog.js +0 -1
  291. package/dist/config-IcWUmjwj.d.ts +0 -239
  292. package/dist/features/chat/chat-element/chat-element.d.ts +0 -8
  293. package/dist/features/chat/chat-element/chat-element.js +0 -14
  294. package/dist/features/chat/chat-element/use-chat.d.ts +0 -21
  295. package/dist/features/chat/chat-element/use-chat.js +0 -14
  296. package/dist/features/chat/chat-element/use-initial-messages.d.ts +0 -20
  297. package/dist/features/chat/chat-element/use-initial-messages.js +0 -14
  298. package/dist/features/chat/chat-message.d.ts +0 -10
  299. package/dist/features/chat/chat-message.js +0 -1
  300. package/dist/features/chat/chat-molecule.d.ts +0 -35
  301. package/dist/features/chat/chat-molecule.js +0 -14
  302. package/dist/features/molecule/chatsdk-provider.d.ts +0 -19
  303. package/dist/features/molecule/chatsdk-provider.js +0 -26
  304. package/dist/features/molecule/constants.d.ts +0 -3
  305. package/dist/features/molecule/constants.js +0 -1
  306. package/dist/features/molecule/molecule-provider.d.ts +0 -39
  307. package/dist/features/molecule/molecule-provider.js +0 -1
  308. package/dist/features/molecule/store.d.ts +0 -53
  309. package/dist/features/molecule/store.js +0 -3
  310. package/dist/features/molecule/types/api.d.ts +0 -8
  311. package/dist/features/molecule/types/api.js +0 -1
  312. package/dist/features/molecule/types/callbacks.d.ts +0 -22
  313. package/dist/features/molecule/types/callbacks.js +0 -1
  314. package/dist/features/molecule/types/config.d.ts +0 -10
  315. package/dist/features/molecule/types/config.js +0 -1
  316. package/dist/features/molecule/types/context.d.ts +0 -11
  317. package/dist/features/molecule/types/context.js +0 -1
  318. package/dist/features/molecule/types/locale.d.ts +0 -9
  319. package/dist/features/molecule/types/locale.js +0 -1
  320. package/dist/features/molecule/types/theme.d.ts +0 -38
  321. package/dist/features/molecule/types/theme.js +0 -1
  322. package/dist/features/molecule/types/translations.d.ts +0 -10
  323. package/dist/features/molecule/types/translations.js +0 -1
  324. package/dist/features/molecule/use-merge-global-config.d.ts +0 -22
  325. package/dist/features/molecule/use-merge-global-config.js +0 -5
  326. package/dist/features/molecule/use-molecule-config.d.ts +0 -41
  327. package/dist/features/molecule/use-molecule-config.js +0 -6
  328. package/dist/features/molecule/utils.d.ts +0 -10
  329. package/dist/features/molecule/utils.js +0 -1
@@ -1,159 +0,0 @@
1
- import { useControllableState } from '@radix-ui/react-use-controllable-state';
2
- import { Badge } from '@chatsdk-dev/ui/components/badge';
3
- import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@chatsdk-dev/ui/components/collapsible';
4
- import { cn } from '@chatsdk-dev/ui/lib/utils';
5
- import { BrainIcon, ChevronDownIcon, DotIcon } from 'lucide-react';
6
- import { createContext, memo, useMemo, useContext } from 'react';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
-
9
- var ChainOfThoughtContext = createContext(
10
- null
11
- );
12
- var useChainOfThought = () => {
13
- const context = useContext(ChainOfThoughtContext);
14
- if (!context) {
15
- throw new Error(
16
- "ChainOfThought components must be used within ChainOfThought"
17
- );
18
- }
19
- return context;
20
- };
21
- var ChainOfThought = memo(
22
- ({
23
- className,
24
- open,
25
- defaultOpen = false,
26
- onOpenChange,
27
- children,
28
- ...props
29
- }) => {
30
- const [isOpen, setIsOpen] = useControllableState({
31
- defaultProp: defaultOpen,
32
- onChange: onOpenChange,
33
- prop: open
34
- });
35
- const chainOfThoughtContext = useMemo(
36
- () => ({ isOpen, setIsOpen }),
37
- [isOpen, setIsOpen]
38
- );
39
- return /* @__PURE__ */ jsx(ChainOfThoughtContext.Provider, { value: chainOfThoughtContext, children: /* @__PURE__ */ jsx("div", { className: cn("not-prose w-full space-y-4", className), ...props, children }) });
40
- }
41
- );
42
- var ChainOfThoughtHeader = memo(
43
- ({ className, children, ...props }) => {
44
- const { isOpen, setIsOpen } = useChainOfThought();
45
- return /* @__PURE__ */ jsx(Collapsible, { onOpenChange: setIsOpen, open: isOpen, children: /* @__PURE__ */ jsxs(
46
- CollapsibleTrigger,
47
- {
48
- className: cn(
49
- "flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",
50
- className
51
- ),
52
- ...props,
53
- children: [
54
- /* @__PURE__ */ jsx(BrainIcon, { className: "size-4" }),
55
- /* @__PURE__ */ jsx("span", { className: "flex-1 text-left", children: children ?? "Chain of Thought" }),
56
- /* @__PURE__ */ jsx(
57
- ChevronDownIcon,
58
- {
59
- className: cn(
60
- "size-4 transition-transform",
61
- isOpen ? "rotate-180" : "rotate-0"
62
- )
63
- }
64
- )
65
- ]
66
- }
67
- ) });
68
- }
69
- );
70
- var stepStatusStyles = {
71
- active: "text-foreground",
72
- complete: "text-muted-foreground",
73
- pending: "text-muted-foreground/50"
74
- };
75
- var ChainOfThoughtStep = memo(
76
- ({
77
- className,
78
- icon: Icon = DotIcon,
79
- label,
80
- description,
81
- status = "complete",
82
- children,
83
- ...props
84
- }) => /* @__PURE__ */ jsxs(
85
- "div",
86
- {
87
- className: cn(
88
- "flex gap-2 text-sm",
89
- stepStatusStyles[status],
90
- "fade-in-0 slide-in-from-top-2 animate-in",
91
- className
92
- ),
93
- ...props,
94
- children: [
95
- /* @__PURE__ */ jsxs("div", { className: "relative mt-0.5", children: [
96
- /* @__PURE__ */ jsx(Icon, { className: "size-4" }),
97
- /* @__PURE__ */ jsx("div", { className: "absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-border" })
98
- ] }),
99
- /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2 overflow-hidden", children: [
100
- /* @__PURE__ */ jsx("div", { children: label }),
101
- description && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-xs", children: description }),
102
- children
103
- ] })
104
- ]
105
- }
106
- )
107
- );
108
- var ChainOfThoughtSearchResults = memo(
109
- ({ className, ...props }) => /* @__PURE__ */ jsx(
110
- "div",
111
- {
112
- className: cn("flex flex-wrap items-center gap-2", className),
113
- ...props
114
- }
115
- )
116
- );
117
- var ChainOfThoughtSearchResult = memo(
118
- ({ className, children, ...props }) => /* @__PURE__ */ jsx(
119
- Badge,
120
- {
121
- className: cn("gap-1 px-2 py-0.5 font-normal text-xs", className),
122
- variant: "secondary",
123
- ...props,
124
- children
125
- }
126
- )
127
- );
128
- var ChainOfThoughtContent = memo(
129
- ({ className, children, ...props }) => {
130
- const { isOpen } = useChainOfThought();
131
- return /* @__PURE__ */ jsx(Collapsible, { open: isOpen, children: /* @__PURE__ */ jsx(
132
- CollapsibleContent,
133
- {
134
- className: cn(
135
- "mt-2 space-y-3",
136
- "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",
137
- className
138
- ),
139
- ...props,
140
- children
141
- }
142
- ) });
143
- }
144
- );
145
- var ChainOfThoughtImage = memo(
146
- ({ className, children, caption, ...props }) => /* @__PURE__ */ jsxs("div", { className: cn("mt-2 space-y-2", className), ...props, children: [
147
- /* @__PURE__ */ jsx("div", { className: "relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children }),
148
- caption && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: caption })
149
- ] })
150
- );
151
- ChainOfThought.displayName = "ChainOfThought";
152
- ChainOfThoughtHeader.displayName = "ChainOfThoughtHeader";
153
- ChainOfThoughtStep.displayName = "ChainOfThoughtStep";
154
- ChainOfThoughtSearchResults.displayName = "ChainOfThoughtSearchResults";
155
- ChainOfThoughtSearchResult.displayName = "ChainOfThoughtSearchResult";
156
- ChainOfThoughtContent.displayName = "ChainOfThoughtContent";
157
- ChainOfThoughtImage.displayName = "ChainOfThoughtImage";
158
-
159
- export { ChainOfThought, ChainOfThoughtContent, ChainOfThoughtHeader, ChainOfThoughtImage, ChainOfThoughtSearchResult, ChainOfThoughtSearchResults, ChainOfThoughtStep };
@@ -1,16 +0,0 @@
1
- import * as react from 'react';
2
- import { HTMLAttributes, ComponentProps } from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { Button } from '@chatsdk-dev/ui/components/button';
5
- import { LucideProps } from 'lucide-react';
6
-
7
- type CheckpointProps = HTMLAttributes<HTMLDivElement>;
8
- declare const Checkpoint: ({ className, children, ...props }: CheckpointProps) => react_jsx_runtime.JSX.Element;
9
- type CheckpointIconProps = LucideProps;
10
- declare const CheckpointIcon: ({ className, children, ...props }: CheckpointIconProps) => string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined>;
11
- type CheckpointTriggerProps = ComponentProps<typeof Button> & {
12
- tooltip?: string;
13
- };
14
- declare const CheckpointTrigger: ({ children, variant, size, tooltip, ...props }: CheckpointTriggerProps) => react_jsx_runtime.JSX.Element;
15
-
16
- export { Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps };
@@ -1,47 +0,0 @@
1
- import { Button } from '@chatsdk-dev/ui/components/button';
2
- import { Separator } from '@chatsdk-dev/ui/components/separator';
3
- import { Tooltip, TooltipTrigger, TooltipContent } from '@chatsdk-dev/ui/components/tooltip';
4
- import { cn } from '@chatsdk-dev/ui/lib/utils';
5
- import { BookmarkIcon } from 'lucide-react';
6
- import { jsxs, jsx } from 'react/jsx-runtime';
7
-
8
- var Checkpoint = ({
9
- className,
10
- children,
11
- ...props
12
- }) => /* @__PURE__ */ jsxs(
13
- "div",
14
- {
15
- className: cn(
16
- "flex items-center gap-0.5 overflow-hidden text-muted-foreground",
17
- className
18
- ),
19
- ...props,
20
- children: [
21
- children,
22
- /* @__PURE__ */ jsx(Separator, {})
23
- ]
24
- }
25
- );
26
- var CheckpointIcon = ({
27
- className,
28
- children,
29
- ...props
30
- }) => children ?? /* @__PURE__ */ jsx(BookmarkIcon, { className: cn("size-4 shrink-0", className), ...props });
31
- var CheckpointTrigger = ({
32
- children,
33
- variant = "ghost",
34
- size = "sm",
35
- tooltip,
36
- ...props
37
- }) => tooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [
38
- /* @__PURE__ */ jsx(
39
- TooltipTrigger,
40
- {
41
- render: () => /* @__PURE__ */ jsx(Button, { size, type: "button", variant, ...props, children })
42
- }
43
- ),
44
- /* @__PURE__ */ jsx(TooltipContent, { align: "start", side: "bottom", children: tooltip })
45
- ] }) : /* @__PURE__ */ jsx(Button, { size, type: "button", variant, ...props, children });
46
-
47
- export { Checkpoint, CheckpointIcon, CheckpointTrigger };
@@ -1,48 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Button } from '@chatsdk-dev/ui/components/button';
3
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@chatsdk-dev/ui/components/select';
4
- import { HTMLAttributes, ComponentProps } from 'react';
5
- import { BundledLanguage, ThemedToken } from 'shiki';
6
-
7
- type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
8
- code: string;
9
- language: BundledLanguage;
10
- showLineNumbers?: boolean;
11
- };
12
- interface TokenizedCode {
13
- tokens: ThemedToken[][];
14
- fg: string;
15
- bg: string;
16
- }
17
- declare const highlightCode: (code: string, language: BundledLanguage, callback?: (result: TokenizedCode) => void) => TokenizedCode | null;
18
- declare const CodeBlockContainer: ({ className, language, style, ...props }: HTMLAttributes<HTMLDivElement> & {
19
- language: string;
20
- }) => react_jsx_runtime.JSX.Element;
21
- declare const CodeBlockHeader: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
22
- declare const CodeBlockTitle: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
23
- declare const CodeBlockFilename: ({ children, className, ...props }: HTMLAttributes<HTMLSpanElement>) => react_jsx_runtime.JSX.Element;
24
- declare const CodeBlockActions: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
25
- declare const CodeBlockContent: ({ code, language, showLineNumbers, }: {
26
- code: string;
27
- language: BundledLanguage;
28
- showLineNumbers?: boolean;
29
- }) => react_jsx_runtime.JSX.Element;
30
- declare const CodeBlock: ({ code, language, showLineNumbers, className, children, ...props }: CodeBlockProps) => react_jsx_runtime.JSX.Element;
31
- type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
32
- onCopy?: () => void;
33
- onError?: (error: Error) => void;
34
- timeout?: number;
35
- };
36
- declare const CodeBlockCopyButton: ({ onCopy, onError, timeout, children, className, ...props }: CodeBlockCopyButtonProps) => react_jsx_runtime.JSX.Element;
37
- type CodeBlockLanguageSelectorProps = ComponentProps<typeof Select>;
38
- declare const CodeBlockLanguageSelector: (props: CodeBlockLanguageSelectorProps) => react_jsx_runtime.JSX.Element;
39
- type CodeBlockLanguageSelectorTriggerProps = ComponentProps<typeof SelectTrigger>;
40
- declare const CodeBlockLanguageSelectorTrigger: ({ className, ...props }: CodeBlockLanguageSelectorTriggerProps) => react_jsx_runtime.JSX.Element;
41
- type CodeBlockLanguageSelectorValueProps = ComponentProps<typeof SelectValue>;
42
- declare const CodeBlockLanguageSelectorValue: (props: CodeBlockLanguageSelectorValueProps) => react_jsx_runtime.JSX.Element;
43
- type CodeBlockLanguageSelectorContentProps = ComponentProps<typeof SelectContent>;
44
- declare const CodeBlockLanguageSelectorContent: ({ align, ...props }: CodeBlockLanguageSelectorContentProps) => react_jsx_runtime.JSX.Element;
45
- type CodeBlockLanguageSelectorItemProps = ComponentProps<typeof SelectItem>;
46
- declare const CodeBlockLanguageSelectorItem: (props: CodeBlockLanguageSelectorItemProps) => react_jsx_runtime.JSX.Element;
47
-
48
- export { CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, type CodeBlockCopyButtonProps, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, type CodeBlockLanguageSelectorContentProps, CodeBlockLanguageSelectorItem, type CodeBlockLanguageSelectorItemProps, type CodeBlockLanguageSelectorProps, CodeBlockLanguageSelectorTrigger, type CodeBlockLanguageSelectorTriggerProps, CodeBlockLanguageSelectorValue, type CodeBlockLanguageSelectorValueProps, CodeBlockTitle, highlightCode };
@@ -1 +0,0 @@
1
- export { CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, CodeBlockLanguageSelectorItem, CodeBlockLanguageSelectorTrigger, CodeBlockLanguageSelectorValue, CodeBlockTitle, highlightCode } from '../../chunk-CFM57HOS.js';
@@ -1,68 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Avatar } from '@chatsdk-dev/ui/components/avatar';
3
- import { Button } from '@chatsdk-dev/ui/components/button';
4
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@chatsdk-dev/ui/components/collapsible';
5
- import { FileIcon } from 'lucide-react';
6
- import { ComponentProps, HTMLAttributes } from 'react';
7
-
8
- type CommitProps = ComponentProps<typeof Collapsible>;
9
- declare const Commit: ({ className, children, ...props }: CommitProps) => react_jsx_runtime.JSX.Element;
10
- type CommitHeaderProps = ComponentProps<typeof CollapsibleTrigger>;
11
- declare const CommitHeader: ({ className, children, ...props }: CommitHeaderProps) => react_jsx_runtime.JSX.Element;
12
- type CommitHashProps = HTMLAttributes<HTMLSpanElement>;
13
- declare const CommitHash: ({ className, children, ...props }: CommitHashProps) => react_jsx_runtime.JSX.Element;
14
- type CommitMessageProps = HTMLAttributes<HTMLSpanElement>;
15
- declare const CommitMessage: ({ className, children, ...props }: CommitMessageProps) => react_jsx_runtime.JSX.Element;
16
- type CommitMetadataProps = HTMLAttributes<HTMLDivElement>;
17
- declare const CommitMetadata: ({ className, children, ...props }: CommitMetadataProps) => react_jsx_runtime.JSX.Element;
18
- type CommitSeparatorProps = HTMLAttributes<HTMLSpanElement>;
19
- declare const CommitSeparator: ({ className, children, ...props }: CommitSeparatorProps) => react_jsx_runtime.JSX.Element;
20
- type CommitInfoProps = HTMLAttributes<HTMLDivElement>;
21
- declare const CommitInfo: ({ className, children, ...props }: CommitInfoProps) => react_jsx_runtime.JSX.Element;
22
- type CommitAuthorProps = HTMLAttributes<HTMLDivElement>;
23
- declare const CommitAuthor: ({ className, children, ...props }: CommitAuthorProps) => react_jsx_runtime.JSX.Element;
24
- type CommitAuthorAvatarProps = ComponentProps<typeof Avatar> & {
25
- initials: string;
26
- };
27
- declare const CommitAuthorAvatar: ({ initials, className, ...props }: CommitAuthorAvatarProps) => react_jsx_runtime.JSX.Element;
28
- type CommitTimestampProps = HTMLAttributes<HTMLTimeElement> & {
29
- date: Date;
30
- };
31
- declare const CommitTimestamp: ({ date, className, children, ...props }: CommitTimestampProps) => react_jsx_runtime.JSX.Element;
32
- type CommitActionsProps = HTMLAttributes<HTMLDivElement>;
33
- declare const CommitActions: ({ className, children, ...props }: CommitActionsProps) => react_jsx_runtime.JSX.Element;
34
- type CommitCopyButtonProps = ComponentProps<typeof Button> & {
35
- hash: string;
36
- onCopy?: () => void;
37
- onError?: (error: Error) => void;
38
- timeout?: number;
39
- };
40
- declare const CommitCopyButton: ({ hash, onCopy, onError, timeout, children, className, ...props }: CommitCopyButtonProps) => react_jsx_runtime.JSX.Element;
41
- type CommitContentProps = ComponentProps<typeof CollapsibleContent>;
42
- declare const CommitContent: ({ className, children, ...props }: CommitContentProps) => react_jsx_runtime.JSX.Element;
43
- type CommitFilesProps = HTMLAttributes<HTMLDivElement>;
44
- declare const CommitFiles: ({ className, children, ...props }: CommitFilesProps) => react_jsx_runtime.JSX.Element;
45
- type CommitFileProps = HTMLAttributes<HTMLDivElement>;
46
- declare const CommitFile: ({ className, children, ...props }: CommitFileProps) => react_jsx_runtime.JSX.Element;
47
- type CommitFileInfoProps = HTMLAttributes<HTMLDivElement>;
48
- declare const CommitFileInfo: ({ className, children, ...props }: CommitFileInfoProps) => react_jsx_runtime.JSX.Element;
49
- type CommitFileStatusProps = HTMLAttributes<HTMLSpanElement> & {
50
- status: "added" | "modified" | "deleted" | "renamed";
51
- };
52
- declare const CommitFileStatus: ({ status, className, children, ...props }: CommitFileStatusProps) => react_jsx_runtime.JSX.Element;
53
- type CommitFileIconProps = ComponentProps<typeof FileIcon>;
54
- declare const CommitFileIcon: ({ className, ...props }: CommitFileIconProps) => react_jsx_runtime.JSX.Element;
55
- type CommitFilePathProps = HTMLAttributes<HTMLSpanElement>;
56
- declare const CommitFilePath: ({ className, children, ...props }: CommitFilePathProps) => react_jsx_runtime.JSX.Element;
57
- type CommitFileChangesProps = HTMLAttributes<HTMLDivElement>;
58
- declare const CommitFileChanges: ({ className, children, ...props }: CommitFileChangesProps) => react_jsx_runtime.JSX.Element;
59
- type CommitFileAdditionsProps = HTMLAttributes<HTMLSpanElement> & {
60
- count: number;
61
- };
62
- declare const CommitFileAdditions: ({ count, className, children, ...props }: CommitFileAdditionsProps) => react_jsx_runtime.JSX.Element | null;
63
- type CommitFileDeletionsProps = HTMLAttributes<HTMLSpanElement> & {
64
- count: number;
65
- };
66
- declare const CommitFileDeletions: ({ count, className, children, ...props }: CommitFileDeletionsProps) => react_jsx_runtime.JSX.Element | null;
67
-
68
- export { Commit, CommitActions, type CommitActionsProps, CommitAuthor, CommitAuthorAvatar, type CommitAuthorAvatarProps, type CommitAuthorProps, CommitContent, type CommitContentProps, CommitCopyButton, type CommitCopyButtonProps, CommitFile, CommitFileAdditions, type CommitFileAdditionsProps, CommitFileChanges, type CommitFileChangesProps, CommitFileDeletions, type CommitFileDeletionsProps, CommitFileIcon, type CommitFileIconProps, CommitFileInfo, type CommitFileInfoProps, CommitFilePath, type CommitFilePathProps, type CommitFileProps, CommitFileStatus, type CommitFileStatusProps, CommitFiles, type CommitFilesProps, CommitHash, type CommitHashProps, CommitHeader, type CommitHeaderProps, CommitInfo, type CommitInfoProps, CommitMessage, type CommitMessageProps, CommitMetadata, type CommitMetadataProps, type CommitProps, CommitSeparator, type CommitSeparatorProps, CommitTimestamp, type CommitTimestampProps };
@@ -1,314 +0,0 @@
1
- import { Avatar, AvatarFallback } from '@chatsdk-dev/ui/components/avatar';
2
- import { Button } from '@chatsdk-dev/ui/components/button';
3
- import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@chatsdk-dev/ui/components/collapsible';
4
- import { cn } from '@chatsdk-dev/ui/lib/utils';
5
- import { GitCommitIcon, CheckIcon, CopyIcon, FileIcon, PlusIcon, MinusIcon } from 'lucide-react';
6
- import { useState, useCallback, useEffect, useRef } from 'react';
7
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
-
9
- var Commit = ({ className, children, ...props }) => /* @__PURE__ */ jsx(
10
- Collapsible,
11
- {
12
- className: cn("rounded-lg border bg-background", className),
13
- ...props,
14
- children
15
- }
16
- );
17
- var CommitHeader = ({
18
- className,
19
- children,
20
- ...props
21
- }) => /* @__PURE__ */ jsx(
22
- CollapsibleTrigger,
23
- {
24
- render: () => /* @__PURE__ */ jsx(
25
- "div",
26
- {
27
- className: cn(
28
- "group flex cursor-pointer items-center justify-between gap-4 p-3 text-left transition-colors hover:opacity-80",
29
- className
30
- ),
31
- children
32
- }
33
- )
34
- }
35
- );
36
- var CommitHash = ({
37
- className,
38
- children,
39
- ...props
40
- }) => /* @__PURE__ */ jsxs("span", { className: cn("font-mono text-xs", className), ...props, children: [
41
- /* @__PURE__ */ jsx(GitCommitIcon, { className: "mr-1 inline-block size-3" }),
42
- children
43
- ] });
44
- var CommitMessage = ({
45
- className,
46
- children,
47
- ...props
48
- }) => /* @__PURE__ */ jsx("span", { className: cn("font-medium text-sm", className), ...props, children });
49
- var CommitMetadata = ({
50
- className,
51
- children,
52
- ...props
53
- }) => /* @__PURE__ */ jsx(
54
- "div",
55
- {
56
- className: cn(
57
- "flex items-center gap-2 text-muted-foreground text-xs",
58
- className
59
- ),
60
- ...props,
61
- children
62
- }
63
- );
64
- var CommitSeparator = ({
65
- className,
66
- children,
67
- ...props
68
- }) => /* @__PURE__ */ jsx("span", { className, ...props, children: children ?? "\u2022" });
69
- var CommitInfo = ({
70
- className,
71
- children,
72
- ...props
73
- }) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-1 flex-col", className), ...props, children });
74
- var CommitAuthor = ({
75
- className,
76
- children,
77
- ...props
78
- }) => /* @__PURE__ */ jsx("div", { className: cn("flex items-center", className), ...props, children });
79
- var CommitAuthorAvatar = ({
80
- initials,
81
- className,
82
- ...props
83
- }) => /* @__PURE__ */ jsx(Avatar, { className: cn("size-8", className), ...props, children: /* @__PURE__ */ jsx(AvatarFallback, { className: "text-xs", children: initials }) });
84
- var relativeTimeFormat = new Intl.RelativeTimeFormat("en", {
85
- numeric: "auto"
86
- });
87
- var formatRelativeDate = (date) => {
88
- const days = Math.round(
89
- (date.getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
90
- );
91
- return relativeTimeFormat.format(days, "day");
92
- };
93
- var CommitTimestamp = ({
94
- date,
95
- className,
96
- children,
97
- ...props
98
- }) => {
99
- const [formatted, setFormatted] = useState("");
100
- const updateFormatted = useCallback(() => {
101
- setFormatted(formatRelativeDate(date));
102
- }, [date]);
103
- useEffect(() => {
104
- updateFormatted();
105
- }, [updateFormatted]);
106
- return /* @__PURE__ */ jsx(
107
- "time",
108
- {
109
- className: cn("text-xs", className),
110
- dateTime: date.toISOString(),
111
- ...props,
112
- children: children ?? formatted
113
- }
114
- );
115
- };
116
- var handleActionsClick = (e) => e.stopPropagation();
117
- var handleActionsKeyDown = (e) => e.stopPropagation();
118
- var CommitActions = ({
119
- className,
120
- children,
121
- ...props
122
- }) => /* @__PURE__ */ jsx(
123
- "div",
124
- {
125
- className: cn("flex items-center gap-1", className),
126
- onClick: handleActionsClick,
127
- onKeyDown: handleActionsKeyDown,
128
- role: "group",
129
- ...props,
130
- children
131
- }
132
- );
133
- var CommitCopyButton = ({
134
- hash,
135
- onCopy,
136
- onError,
137
- timeout = 2e3,
138
- children,
139
- className,
140
- ...props
141
- }) => {
142
- const [isCopied, setIsCopied] = useState(false);
143
- const timeoutRef = useRef(0);
144
- const copyToClipboard = useCallback(async () => {
145
- if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
146
- onError?.(new Error("Clipboard API not available"));
147
- return;
148
- }
149
- try {
150
- if (!isCopied) {
151
- await navigator.clipboard.writeText(hash);
152
- setIsCopied(true);
153
- onCopy?.();
154
- timeoutRef.current = window.setTimeout(
155
- () => setIsCopied(false),
156
- timeout
157
- );
158
- }
159
- } catch (error) {
160
- onError?.(error);
161
- }
162
- }, [hash, onCopy, onError, timeout, isCopied]);
163
- useEffect(
164
- () => () => {
165
- window.clearTimeout(timeoutRef.current);
166
- },
167
- []
168
- );
169
- const Icon = isCopied ? CheckIcon : CopyIcon;
170
- return /* @__PURE__ */ jsx(
171
- Button,
172
- {
173
- className: cn("size-7 shrink-0", className),
174
- onClick: copyToClipboard,
175
- size: "icon",
176
- variant: "ghost",
177
- ...props,
178
- children: children ?? /* @__PURE__ */ jsx(Icon, { size: 14 })
179
- }
180
- );
181
- };
182
- var CommitContent = ({
183
- className,
184
- children,
185
- ...props
186
- }) => /* @__PURE__ */ jsx(CollapsibleContent, { className: cn("border-t p-3", className), ...props, children });
187
- var CommitFiles = ({
188
- className,
189
- children,
190
- ...props
191
- }) => /* @__PURE__ */ jsx("div", { className: cn("space-y-1", className), ...props, children });
192
- var CommitFile = ({
193
- className,
194
- children,
195
- ...props
196
- }) => /* @__PURE__ */ jsx(
197
- "div",
198
- {
199
- className: cn(
200
- "flex items-center justify-between gap-2 rounded px-2 py-1 text-sm hover:bg-muted/50",
201
- className
202
- ),
203
- ...props,
204
- children
205
- }
206
- );
207
- var CommitFileInfo = ({
208
- className,
209
- children,
210
- ...props
211
- }) => /* @__PURE__ */ jsx("div", { className: cn("flex min-w-0 items-center gap-2", className), ...props, children });
212
- var fileStatusStyles = {
213
- added: "text-green-600 dark:text-green-400",
214
- deleted: "text-red-600 dark:text-red-400",
215
- modified: "text-yellow-600 dark:text-yellow-400",
216
- renamed: "text-blue-600 dark:text-blue-400"
217
- };
218
- var fileStatusLabels = {
219
- added: "A",
220
- deleted: "D",
221
- modified: "M",
222
- renamed: "R"
223
- };
224
- var CommitFileStatus = ({
225
- status,
226
- className,
227
- children,
228
- ...props
229
- }) => /* @__PURE__ */ jsx(
230
- "span",
231
- {
232
- className: cn(
233
- "font-medium font-mono text-xs",
234
- fileStatusStyles[status],
235
- className
236
- ),
237
- ...props,
238
- children: children ?? fileStatusLabels[status]
239
- }
240
- );
241
- var CommitFileIcon = ({
242
- className,
243
- ...props
244
- }) => /* @__PURE__ */ jsx(
245
- FileIcon,
246
- {
247
- className: cn("size-3.5 shrink-0 text-muted-foreground", className),
248
- ...props
249
- }
250
- );
251
- var CommitFilePath = ({
252
- className,
253
- children,
254
- ...props
255
- }) => /* @__PURE__ */ jsx("span", { className: cn("truncate font-mono text-xs", className), ...props, children });
256
- var CommitFileChanges = ({
257
- className,
258
- children,
259
- ...props
260
- }) => /* @__PURE__ */ jsx(
261
- "div",
262
- {
263
- className: cn(
264
- "flex shrink-0 items-center gap-1 font-mono text-xs",
265
- className
266
- ),
267
- ...props,
268
- children
269
- }
270
- );
271
- var CommitFileAdditions = ({
272
- count,
273
- className,
274
- children,
275
- ...props
276
- }) => {
277
- if (count <= 0) {
278
- return null;
279
- }
280
- return /* @__PURE__ */ jsx(
281
- "span",
282
- {
283
- className: cn("text-green-600 dark:text-green-400", className),
284
- ...props,
285
- children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
286
- /* @__PURE__ */ jsx(PlusIcon, { className: "inline-block size-3" }),
287
- count
288
- ] })
289
- }
290
- );
291
- };
292
- var CommitFileDeletions = ({
293
- count,
294
- className,
295
- children,
296
- ...props
297
- }) => {
298
- if (count <= 0) {
299
- return null;
300
- }
301
- return /* @__PURE__ */ jsx(
302
- "span",
303
- {
304
- className: cn("text-red-600 dark:text-red-400", className),
305
- ...props,
306
- children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
307
- /* @__PURE__ */ jsx(MinusIcon, { className: "inline-block size-3" }),
308
- count
309
- ] })
310
- }
311
- );
312
- };
313
-
314
- export { Commit, CommitActions, CommitAuthor, CommitAuthorAvatar, CommitContent, CommitCopyButton, CommitFile, CommitFileAdditions, CommitFileChanges, CommitFileDeletions, CommitFileIcon, CommitFileInfo, CommitFilePath, CommitFileStatus, CommitFiles, CommitHash, CommitHeader, CommitInfo, CommitMessage, CommitMetadata, CommitSeparator, CommitTimestamp };