@lostgradient/cinder 0.15.0 → 0.16.1

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 (338) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +3 -3
  3. package/components.json +2 -143
  4. package/dist/components/access-gate/index.js +379 -327
  5. package/dist/components/alert-dialog/index.js +170 -172
  6. package/dist/components/confirm-dialog/index.js +170 -172
  7. package/dist/components/data-table/index.js +88 -31
  8. package/dist/components/drawer/index.js +11 -11
  9. package/dist/components/focus-trap/index.d.ts +1 -0
  10. package/dist/components/focus-trap/index.js +171 -1
  11. package/dist/components/icons/index.d.ts +80 -1
  12. package/dist/components/icons/index.js +1256 -0
  13. package/dist/components/markdown-editor/index.js +170 -170
  14. package/dist/components/modal/index.js +20 -20
  15. package/dist/components/review-editor/index.js +170 -187
  16. package/dist/components/sheet/index.js +11 -11
  17. package/dist/components/sidebar/index.js +37 -37
  18. package/dist/components/table/index.js +85 -28
  19. package/dist/components/table/table.css +11 -0
  20. package/dist/components/table/table.schema.js +10 -1
  21. package/dist/components/table/table.types.d.ts +24 -1
  22. package/dist/index.d.ts +0 -8
  23. package/dist/index.js +23266 -30180
  24. package/dist/server/components/access-gate/index.js +7 -10
  25. package/dist/server/components/alert-dialog/index.js +4 -4
  26. package/dist/server/components/approval-card/index.js +6 -6
  27. package/dist/server/components/autocomplete/index.js +4 -4
  28. package/dist/server/components/choice-grid/index.js +2 -2
  29. package/dist/server/components/color-field/index.js +2 -2
  30. package/dist/server/components/combobox/index.js +3 -3
  31. package/dist/server/components/command-item/index.js +3 -5
  32. package/dist/server/components/command-menu/index.js +3 -5
  33. package/dist/server/components/confirm-dialog/index.js +4 -4
  34. package/dist/server/components/context-menu/index.js +7 -7
  35. package/dist/server/components/data-table/index.js +4 -4
  36. package/dist/server/components/date-picker/index.js +4 -4
  37. package/dist/server/components/date-range-field/index.js +4 -4
  38. package/dist/server/components/diff-viewer/index.js +9 -11
  39. package/dist/server/components/drawer/index.js +4 -4
  40. package/dist/server/components/dropdown/index.js +7 -7
  41. package/dist/server/components/faceted-filter-bar/index.js +2 -2
  42. package/dist/server/components/focus-trap/index.js +7 -2
  43. package/dist/server/components/icons/index.js +156 -0
  44. package/dist/server/components/inline-loading/index.js +1 -1
  45. package/dist/server/components/json-schema-editor/index.js +11 -13
  46. package/dist/server/components/load-more/index.js +2 -3
  47. package/dist/server/components/markdown-editor/index.js +13 -12
  48. package/dist/server/components/menu-bar/index.js +4 -4
  49. package/dist/server/components/modal/index.js +4 -4
  50. package/dist/server/components/popover/index.js +3 -3
  51. package/dist/server/components/review-editor/index.js +169 -122
  52. package/dist/server/components/schedule-builder/index.js +5 -5
  53. package/dist/server/components/schema-form/index.js +1 -1
  54. package/dist/server/components/segment/index.js +3 -3
  55. package/dist/server/components/segmented-control/index.js +4 -4
  56. package/dist/server/components/selection-popover/index.js +3 -3
  57. package/dist/server/components/sheet/index.js +3 -3
  58. package/dist/server/components/sidebar/index.js +4 -4
  59. package/dist/server/components/table/index.js +4 -4
  60. package/dist/server/components/tag-input/index.js +2 -2
  61. package/dist/server/index.js +272 -316
  62. package/dist/server/{index.server-dwwqssey.js → index.server-0qh3v3nq.js} +1 -1
  63. package/dist/server/index.server-25wmev4e.js +2 -0
  64. package/dist/server/{index.server-zdm63dt8.js → index.server-2c56kqws.js} +107 -25
  65. package/dist/server/{index.server-y4n8vc08.js → index.server-2pc5cv6c.js} +1 -1
  66. package/dist/server/{index.server-1vsv7ngz.js → index.server-3g76h7z7.js} +12 -2
  67. package/dist/server/{index.server-xz99aed4.js → index.server-45n4s30n.js} +12 -12
  68. package/dist/server/{index.server-zzd5wpbw.js → index.server-4dfs3xwn.js} +1 -1
  69. package/dist/server/{index.server-vhyjjx9z.js → index.server-4jkqgp17.js} +7 -9
  70. package/dist/server/{index.server-bmxbsk4y.js → index.server-51sxnete.js} +18 -18
  71. package/dist/server/{index.server-1bwvsnjk.js → index.server-6rv1rfwq.js} +37 -14
  72. package/dist/server/{index.server-np3c7kx0.js → index.server-7798gc22.js} +1 -1
  73. package/dist/server/{index.server-2m1kenak.js → index.server-7kjw6qw5.js} +1 -1
  74. package/dist/server/{index.server-tfftb7hs.js → index.server-7zpzspk6.js} +1 -1
  75. package/dist/server/{index.server-7yvpb6z7.js → index.server-894t97kv.js} +4 -4
  76. package/dist/server/{index.server-47v2fhp4.js → index.server-8b35ekqg.js} +1 -1
  77. package/dist/server/{index.server-j5hn2qds.js → index.server-8nm871y8.js} +80 -30
  78. package/dist/server/{index.server-h0cvwvhy.js → index.server-9drzqktm.js} +1 -1
  79. package/dist/server/{index.server-x9s4m9eg.js → index.server-agsdwg53.js} +1 -1
  80. package/dist/server/{index.server-hpeavvnq.js → index.server-b4gp066a.js} +1 -1
  81. package/dist/server/{index.server-gkazv439.js → index.server-bf7d81b4.js} +7 -7
  82. package/dist/server/{index.server-krqvnt6p.js → index.server-d4ft97bx.js} +4 -2
  83. package/dist/server/{index.server-t1x9h8cb.js → index.server-dg19y3m7.js} +1 -1
  84. package/dist/server/{index.server-jt1twhgk.js → index.server-dq0k0qf6.js} +10 -10
  85. package/dist/server/{index.server-pxq277t5.js → index.server-frb9e55d.js} +1 -1
  86. package/dist/server/{index.server-9kz37z89.js → index.server-g3726bja.js} +1 -1
  87. package/dist/server/{index.server-jdcq5zza.js → index.server-gwgm8gqg.js} +8 -8
  88. package/dist/server/index.server-gyzmkrnz.js +2 -0
  89. package/dist/server/{index.server-mr68brd6.js → index.server-jgdtsvz2.js} +1 -1
  90. package/dist/server/{index.server-p56xxef1.js → index.server-m8ya4p7w.js} +1 -1
  91. package/dist/server/{index.server-1nq7z1qw.js → index.server-mda2y5g6.js} +1 -1
  92. package/dist/server/{index.server-e89qfamd.js → index.server-mknhgg07.js} +4 -4
  93. package/dist/server/{index.server-j570vb03.js → index.server-mvjzcna5.js} +1 -1
  94. package/dist/server/index.server-n4jxy52q.js +2 -0
  95. package/dist/server/{index.server-eftvmq3f.js → index.server-pfbzz3x7.js} +1 -1
  96. package/dist/server/{index.server-zrh23kty.js → index.server-pyjzfjfn.js} +1 -1
  97. package/dist/server/{index.server-rga8sc7j.js → index.server-q1d48s9t.js} +40 -36
  98. package/dist/server/{index.server-46cjwcqw.js → index.server-qv0kkre4.js} +5 -5
  99. package/dist/server/{index.server-yhzydqxe.js → index.server-r82zjq88.js} +5 -5
  100. package/dist/server/{index.server-9ykk1kbg.js → index.server-rbd5ys4z.js} +1 -1
  101. package/dist/server/{index.server-tcay903b.js → index.server-tnecnach.js} +4 -4
  102. package/dist/server/{index.server-h89zk5ev.js → index.server-wasj5rbh.js} +8 -8
  103. package/dist/server/{index.server-9ra3xv88.js → index.server-x66zvjfc.js} +9 -9
  104. package/dist/server/index.server-xanq9ppe.js +119 -0
  105. package/dist/server/{index.server-6sh11ap6.js → index.server-y4kfz0er.js} +1 -1
  106. package/dist/server/{index.server-n82rcv0m.js → index.server-z721a5gp.js} +4 -4
  107. package/dist/server/{index.server-mm1xa3kr.js → index.server-zdhv33ph.js} +51 -20
  108. package/dist/server/{index.server-t3hknp1c.js → index.server-zm04d9eq.js} +4 -4
  109. package/dist/server/{index.server-nx9c2ep1.js → index.server-zncgb7mw.js} +2 -2
  110. package/package.json +10 -130
  111. package/src/components/focus-trap/index.ts +1 -0
  112. package/src/components/icons/index.ts +82 -40
  113. package/src/components/table/table.css +11 -0
  114. package/src/components/table/table.examples.json +3 -3
  115. package/src/components/table/table.schema.json +9 -0
  116. package/src/components/table/table.schema.ts +11 -0
  117. package/src/components/table/table.svelte +58 -14
  118. package/src/components/table/table.types.ts +27 -1
  119. package/src/index.ts +0 -34
  120. package/src/styles/components.css +0 -4
  121. package/dist/components/chat/adapter/chat-adapter.d.ts +0 -123
  122. package/dist/components/chat/adapter/index.d.ts +0 -8
  123. package/dist/components/chat/artifact/artifact-panel.svelte.d.ts +0 -15
  124. package/dist/components/chat/artifact/artifact-viewer.svelte.d.ts +0 -10
  125. package/dist/components/chat/artifact/chat-artifact-layout.svelte.d.ts +0 -23
  126. package/dist/components/chat/artifact/index.d.ts +0 -3
  127. package/dist/components/chat/builders.d.ts +0 -25
  128. package/dist/components/chat/chat.css +0 -16
  129. package/dist/components/chat/chat.css.d.ts +0 -1
  130. package/dist/components/chat/chat.schema.d.ts +0 -3
  131. package/dist/components/chat/chat.schema.js +0 -366
  132. package/dist/components/chat/chat.svelte.d.ts +0 -31
  133. package/dist/components/chat/chat.types.d.ts +0 -268
  134. package/dist/components/chat/chat.variables.d.ts +0 -2
  135. package/dist/components/chat/chat.variables.js +0 -61
  136. package/dist/components/chat/container/chat-events.d.ts +0 -22
  137. package/dist/components/chat/container/chat-history-trigger.svelte.d.ts +0 -15
  138. package/dist/components/chat/container/chat-jump-controls.svelte.d.ts +0 -24
  139. package/dist/components/chat/container/chat-participant-typing.svelte.d.ts +0 -31
  140. package/dist/components/chat/container/chat-search-bar.svelte.d.ts +0 -38
  141. package/dist/components/chat/container/chat-status-announcer.svelte.d.ts +0 -21
  142. package/dist/components/chat/container/chat.svelte.d.ts +0 -17
  143. package/dist/components/chat/container/index.d.ts +0 -12
  144. package/dist/components/chat/container/scroll-utilities.d.ts +0 -119
  145. package/dist/components/chat/container/use-chat-disclosure-state.svelte.d.ts +0 -58
  146. package/dist/components/chat/container/use-chat-keyboard-nav.svelte.d.ts +0 -57
  147. package/dist/components/chat/container/use-chat-message-groups.svelte.d.ts +0 -74
  148. package/dist/components/chat/container/use-chat-read-receipts.svelte.d.ts +0 -51
  149. package/dist/components/chat/container/use-chat-scroll-state.svelte.d.ts +0 -111
  150. package/dist/components/chat/container/use-chat-search.svelte.d.ts +0 -82
  151. package/dist/components/chat/container/use-chat-typing-indicator.svelte.d.ts +0 -76
  152. package/dist/components/chat/container/use-chat-unread-state.svelte.d.ts +0 -80
  153. package/dist/components/chat/container/use-chat-virtualizer.svelte.d.ts +0 -47
  154. package/dist/components/chat/conversation-model.d.ts +0 -16
  155. package/dist/components/chat/export/conversation-export-actions.svelte.d.ts +0 -17
  156. package/dist/components/chat/export/index.d.ts +0 -8
  157. package/dist/components/chat/index.d.ts +0 -25
  158. package/dist/components/chat/index.js +0 -11319
  159. package/dist/components/chat/input/attachment-kind.d.ts +0 -10
  160. package/dist/components/chat/input/chat-attachment-preview.svelte.d.ts +0 -8
  161. package/dist/components/chat/input/chat-attachment-serialization.d.ts +0 -9
  162. package/dist/components/chat/input/chat-attachment.d.ts +0 -11
  163. package/dist/components/chat/input/chat-input.svelte.d.ts +0 -79
  164. package/dist/components/chat/input/index.d.ts +0 -5
  165. package/dist/components/chat/message/chat-date-separator.svelte.d.ts +0 -12
  166. package/dist/components/chat/message/chat-message-parts-renderer.svelte.d.ts +0 -4
  167. package/dist/components/chat/message/chat-message-parts.d.ts +0 -96
  168. package/dist/components/chat/message/chat-message.svelte.d.ts +0 -91
  169. package/dist/components/chat/message/chat-read-receipt.svelte.d.ts +0 -27
  170. package/dist/components/chat/message/image-lightbox.svelte.d.ts +0 -17
  171. package/dist/components/chat/message/index.d.ts +0 -6
  172. package/dist/components/chat/message/markdown-preview.svelte.d.ts +0 -8
  173. package/dist/components/chat/message/message-attachments.svelte.d.ts +0 -17
  174. package/dist/components/chat/message/message-content.svelte.d.ts +0 -18
  175. package/dist/components/chat/message/parts/image-part.svelte.d.ts +0 -17
  176. package/dist/components/chat/message/parts/markdown-part.svelte.d.ts +0 -8
  177. package/dist/components/chat/message/parts/reasoning-part.svelte.d.ts +0 -12
  178. package/dist/components/chat/message/parts/step-part.svelte.d.ts +0 -8
  179. package/dist/components/chat/message/parts/suggestion-part.svelte.d.ts +0 -18
  180. package/dist/components/chat/message/parts/tool-approval-part.svelte.d.ts +0 -12
  181. package/dist/components/chat/message/parts/tool-call-part.svelte.d.ts +0 -12
  182. package/dist/components/chat/message/parts/tool-result-part.svelte.d.ts +0 -8
  183. package/dist/components/chat/message/tool-call-group.svelte.d.ts +0 -15
  184. package/dist/components/chat/message/tool-payload-code.svelte.d.ts +0 -9
  185. package/dist/components/chat/utilities/conversation.d.ts +0 -12
  186. package/dist/components/chat/utilities/index.d.ts +0 -9
  187. package/dist/components/chat/utilities/types.d.ts +0 -262
  188. package/dist/components/chat/utilities/utilities.d.ts +0 -140
  189. package/dist/components/chat-composer-popover/chat-composer-popover-filter.d.ts +0 -11
  190. package/dist/components/chat-composer-popover/chat-composer-popover.css +0 -7
  191. package/dist/components/chat-composer-popover/chat-composer-popover.css.d.ts +0 -1
  192. package/dist/components/chat-composer-popover/chat-composer-popover.schema.d.ts +0 -3
  193. package/dist/components/chat-composer-popover/chat-composer-popover.schema.js +0 -150
  194. package/dist/components/chat-composer-popover/chat-composer-popover.svelte.d.ts +0 -46
  195. package/dist/components/chat-composer-popover/chat-composer-popover.types.d.ts +0 -77
  196. package/dist/components/chat-composer-popover/chat-composer-popover.variables.d.ts +0 -2
  197. package/dist/components/chat-composer-popover/chat-composer-popover.variables.js +0 -61
  198. package/dist/components/chat-composer-popover/index.d.ts +0 -6
  199. package/dist/components/chat-composer-popover/index.js +0 -3285
  200. package/dist/components/chat-conversation-header/chat-conversation-header.css +0 -51
  201. package/dist/components/chat-conversation-header/chat-conversation-header.css.d.ts +0 -1
  202. package/dist/components/chat-conversation-header/chat-conversation-header.schema.d.ts +0 -3
  203. package/dist/components/chat-conversation-header/chat-conversation-header.schema.js +0 -94
  204. package/dist/components/chat-conversation-header/chat-conversation-header.svelte.d.ts +0 -19
  205. package/dist/components/chat-conversation-header/chat-conversation-header.types.d.ts +0 -18
  206. package/dist/components/chat-conversation-header/chat-conversation-header.variables.d.ts +0 -2
  207. package/dist/components/chat-conversation-header/chat-conversation-header.variables.js +0 -61
  208. package/dist/components/chat-conversation-header/index.d.ts +0 -5
  209. package/dist/components/chat-conversation-header/index.js +0 -4278
  210. package/dist/components/chat-conversation-list/chat-conversation-list.css +0 -127
  211. package/dist/components/chat-conversation-list/chat-conversation-list.css.d.ts +0 -1
  212. package/dist/components/chat-conversation-list/chat-conversation-list.schema.d.ts +0 -3
  213. package/dist/components/chat-conversation-list/chat-conversation-list.schema.js +0 -105
  214. package/dist/components/chat-conversation-list/chat-conversation-list.svelte.d.ts +0 -21
  215. package/dist/components/chat-conversation-list/chat-conversation-list.types.d.ts +0 -17
  216. package/dist/components/chat-conversation-list/chat-conversation-list.variables.d.ts +0 -2
  217. package/dist/components/chat-conversation-list/chat-conversation-list.variables.js +0 -61
  218. package/dist/components/chat-conversation-list/conversation-summary.d.ts +0 -30
  219. package/dist/components/chat-conversation-list/index.d.ts +0 -6
  220. package/dist/components/chat-conversation-list/index.js +0 -536
  221. package/dist/server/components/chat/index.js +0 -131
  222. package/dist/server/components/chat-composer-popover/index.js +0 -26
  223. package/dist/server/components/chat-conversation-header/index.js +0 -41
  224. package/dist/server/components/chat-conversation-list/index.js +0 -19
  225. package/dist/server/index.server-2bbwajb2.js +0 -54
  226. package/dist/server/index.server-2hqrv7ca.js +0 -9
  227. package/dist/server/index.server-67qgdypc.js +0 -9
  228. package/dist/server/index.server-6hnfzc7f.js +0 -263
  229. package/dist/server/index.server-8rmtb8vx.js +0 -175
  230. package/dist/server/index.server-a59y47rw.js +0 -59
  231. package/dist/server/index.server-bfkka7x4.js +0 -2
  232. package/dist/server/index.server-czf35aba.js +0 -4241
  233. package/dist/server/index.server-kb6w1a7c.js +0 -27
  234. package/dist/server/index.server-mzj20rfz.js +0 -77
  235. package/dist/server/index.server-nphtb2ey.js +0 -76
  236. package/dist/server/index.server-qkfd0qa7.js +0 -2
  237. package/dist/server/index.server-rf67m8v5.js +0 -2
  238. package/dist/server/index.server-rqe5bqgm.js +0 -37
  239. package/dist/server/index.server-xtjjmsyq.js +0 -315
  240. package/dist/server/index.server-yq9evnp4.js +0 -38
  241. package/dist/server/index.server-z1qvwaem.js +0 -74
  242. package/dist/server/index.server-z7hxtqs1.js +0 -83
  243. package/src/components/chat/adapter/chat-adapter.ts +0 -132
  244. package/src/components/chat/adapter/index.ts +0 -15
  245. package/src/components/chat/artifact/artifact-panel.svelte +0 -112
  246. package/src/components/chat/artifact/artifact-viewer.svelte +0 -101
  247. package/src/components/chat/artifact/chat-artifact-layout.svelte +0 -56
  248. package/src/components/chat/artifact/index.ts +0 -3
  249. package/src/components/chat/builders.ts +0 -464
  250. package/src/components/chat/chat.css +0 -16
  251. package/src/components/chat/chat.examples.json +0 -67
  252. package/src/components/chat/chat.schema.json +0 -290
  253. package/src/components/chat/chat.schema.ts +0 -335
  254. package/src/components/chat/chat.svelte +0 -67
  255. package/src/components/chat/chat.types.ts +0 -284
  256. package/src/components/chat/chat.variables.json +0 -1
  257. package/src/components/chat/chat.variables.ts +0 -3
  258. package/src/components/chat/container/chat-events.ts +0 -26
  259. package/src/components/chat/container/chat-history-trigger.svelte +0 -95
  260. package/src/components/chat/container/chat-jump-controls.svelte +0 -191
  261. package/src/components/chat/container/chat-participant-typing.svelte +0 -128
  262. package/src/components/chat/container/chat-search-bar.svelte +0 -219
  263. package/src/components/chat/container/chat-status-announcer.svelte +0 -22
  264. package/src/components/chat/container/chat.svelte +0 -1879
  265. package/src/components/chat/container/index.ts +0 -64
  266. package/src/components/chat/container/scroll-utilities.ts +0 -204
  267. package/src/components/chat/container/use-chat-disclosure-state.svelte.ts +0 -62
  268. package/src/components/chat/container/use-chat-keyboard-nav.svelte.ts +0 -153
  269. package/src/components/chat/container/use-chat-message-groups.svelte.ts +0 -146
  270. package/src/components/chat/container/use-chat-read-receipts.svelte.ts +0 -62
  271. package/src/components/chat/container/use-chat-scroll-state.svelte.ts +0 -292
  272. package/src/components/chat/container/use-chat-search.svelte.ts +0 -116
  273. package/src/components/chat/container/use-chat-typing-indicator.svelte.ts +0 -153
  274. package/src/components/chat/container/use-chat-unread-state.svelte.ts +0 -170
  275. package/src/components/chat/container/use-chat-virtualizer.svelte.ts +0 -260
  276. package/src/components/chat/conversation-model.ts +0 -56
  277. package/src/components/chat/export/conversation-export-actions.svelte +0 -174
  278. package/src/components/chat/export/index.ts +0 -9
  279. package/src/components/chat/index.ts +0 -160
  280. package/src/components/chat/input/attachment-kind.ts +0 -28
  281. package/src/components/chat/input/chat-attachment-preview.svelte +0 -223
  282. package/src/components/chat/input/chat-attachment-serialization.ts +0 -63
  283. package/src/components/chat/input/chat-attachment.ts +0 -12
  284. package/src/components/chat/input/chat-input.svelte +0 -810
  285. package/src/components/chat/input/index.ts +0 -9
  286. package/src/components/chat/message/chat-date-separator.svelte +0 -87
  287. package/src/components/chat/message/chat-message-parts-renderer.svelte +0 -139
  288. package/src/components/chat/message/chat-message-parts.ts +0 -163
  289. package/src/components/chat/message/chat-message.svelte +0 -861
  290. package/src/components/chat/message/chat-read-receipt.svelte +0 -85
  291. package/src/components/chat/message/image-lightbox.svelte +0 -255
  292. package/src/components/chat/message/index.ts +0 -6
  293. package/src/components/chat/message/markdown-preview.svelte +0 -77
  294. package/src/components/chat/message/message-attachments.svelte +0 -178
  295. package/src/components/chat/message/message-content.svelte +0 -132
  296. package/src/components/chat/message/parts/image-part.svelte +0 -11
  297. package/src/components/chat/message/parts/markdown-part.svelte +0 -17
  298. package/src/components/chat/message/parts/reasoning-part.svelte +0 -274
  299. package/src/components/chat/message/parts/step-part.svelte +0 -127
  300. package/src/components/chat/message/parts/suggestion-part.svelte +0 -83
  301. package/src/components/chat/message/parts/tool-approval-part.svelte +0 -298
  302. package/src/components/chat/message/parts/tool-call-part.svelte +0 -19
  303. package/src/components/chat/message/parts/tool-result-part.svelte +0 -65
  304. package/src/components/chat/message/tool-call-group.svelte +0 -274
  305. package/src/components/chat/message/tool-payload-code.svelte +0 -35
  306. package/src/components/chat/utilities/conversation.ts +0 -44
  307. package/src/components/chat/utilities/index.ts +0 -33
  308. package/src/components/chat/utilities/types.ts +0 -288
  309. package/src/components/chat/utilities/utilities.ts +0 -507
  310. package/src/components/chat-composer-popover/chat-composer-popover-filter.ts +0 -68
  311. package/src/components/chat-composer-popover/chat-composer-popover.css +0 -7
  312. package/src/components/chat-composer-popover/chat-composer-popover.examples.json +0 -13
  313. package/src/components/chat-composer-popover/chat-composer-popover.schema.json +0 -90
  314. package/src/components/chat-composer-popover/chat-composer-popover.schema.ts +0 -95
  315. package/src/components/chat-composer-popover/chat-composer-popover.svelte +0 -234
  316. package/src/components/chat-composer-popover/chat-composer-popover.types.ts +0 -88
  317. package/src/components/chat-composer-popover/chat-composer-popover.variables.json +0 -1
  318. package/src/components/chat-composer-popover/chat-composer-popover.variables.ts +0 -3
  319. package/src/components/chat-composer-popover/index.ts +0 -19
  320. package/src/components/chat-conversation-header/chat-conversation-header.css +0 -51
  321. package/src/components/chat-conversation-header/chat-conversation-header.examples.json +0 -13
  322. package/src/components/chat-conversation-header/chat-conversation-header.schema.json +0 -34
  323. package/src/components/chat-conversation-header/chat-conversation-header.schema.ts +0 -38
  324. package/src/components/chat-conversation-header/chat-conversation-header.svelte +0 -49
  325. package/src/components/chat-conversation-header/chat-conversation-header.types.ts +0 -20
  326. package/src/components/chat-conversation-header/chat-conversation-header.variables.json +0 -1
  327. package/src/components/chat-conversation-header/chat-conversation-header.variables.ts +0 -3
  328. package/src/components/chat-conversation-header/index.ts +0 -9
  329. package/src/components/chat-conversation-list/chat-conversation-list.css +0 -127
  330. package/src/components/chat-conversation-list/chat-conversation-list.examples.json +0 -13
  331. package/src/components/chat-conversation-list/chat-conversation-list.schema.json +0 -45
  332. package/src/components/chat-conversation-list/chat-conversation-list.schema.ts +0 -52
  333. package/src/components/chat-conversation-list/chat-conversation-list.svelte +0 -75
  334. package/src/components/chat-conversation-list/chat-conversation-list.types.ts +0 -18
  335. package/src/components/chat-conversation-list/chat-conversation-list.variables.json +0 -1
  336. package/src/components/chat-conversation-list/chat-conversation-list.variables.ts +0 -3
  337. package/src/components/chat-conversation-list/conversation-summary.ts +0 -88
  338. package/src/components/chat-conversation-list/index.ts +0 -11
@@ -1,507 +0,0 @@
1
- /**
2
- * Utility functions for chat message operations.
3
- *
4
- * These helpers work with the published {@link Message} type to extract
5
- * content for copy/export operations.
6
- */
7
-
8
- import type { Message, MultiModalContent, ToolResult } from '../conversation-model.ts';
9
- import type {
10
- ChatMessagePart,
11
- ImageMessagePart,
12
- MessagePartDerivationContext,
13
- StepInfo,
14
- StepStatus,
15
- ToolApprovalMessagePart,
16
- } from './types.ts';
17
-
18
- /** Namespaced metadata keys the overlay parts read (ignorable by plain rendering). */
19
- export const CINDER_REASONING_METADATA_KEY = 'cinder:reasoning';
20
- export const CINDER_STEPS_METADATA_KEY = 'cinder:steps';
21
- export const CINDER_SUGGESTIONS_METADATA_KEY = 'cinder:suggestions';
22
-
23
- const STEP_STATUSES: ReadonlySet<string> = new Set<StepStatus>([
24
- 'pending',
25
- 'running',
26
- 'done',
27
- 'error',
28
- ]);
29
-
30
- /**
31
- * Narrows an unknown value to a valid {@link StepInfo}. Uses `in`-operator
32
- * narrowing (no `as` assertion) so each accessed field is type-safe.
33
- */
34
- function isStepInfo(value: unknown): value is StepInfo {
35
- if (value === null || typeof value !== 'object') return false;
36
- if (!('title' in value) || !('content' in value) || !('status' in value)) return false;
37
- return (
38
- typeof value.title === 'string' &&
39
- typeof value.content === 'string' &&
40
- typeof value.status === 'string' &&
41
- STEP_STATUSES.has(value.status)
42
- );
43
- }
44
-
45
- /**
46
- * Runs a per-message overlay callback, guarding a consumer throw (a buggy
47
- * callback can never break the chat render). Returns the sentinel `undefined`
48
- * for "no opinion — fall back to metadata", distinguished from a callback that
49
- * returns a real (possibly empty) value meaning "this is authoritative".
50
- */
51
- function runOverlayCallback<T>(
52
- message: Message,
53
- fromProp: ((message: Message) => T | undefined) | undefined,
54
- ): { handled: boolean; value: T | undefined } {
55
- if (fromProp === undefined) return { handled: false, value: undefined };
56
- try {
57
- const value = fromProp(message);
58
- // `undefined` means "fall back to metadata"; any other return (incl. an
59
- // empty string/array, which suppresses the overlay) is authoritative.
60
- return value === undefined ? { handled: false, value: undefined } : { handled: true, value };
61
- } catch {
62
- // A throwing callback is treated as "no opinion" — fall back to metadata
63
- // rather than letting the error escape and break the render.
64
- return { handled: false, value: undefined };
65
- }
66
- }
67
-
68
- /**
69
- * Resolves the reasoning overlay for a message. An explicit per-message callback
70
- * is consulted first; when it returns `undefined` (or throws) the resolution
71
- * falls back to `cinder:reasoning` namespaced metadata. An empty string from the
72
- * callback is authoritative and suppresses the overlay. That suppression is
73
- * returned as `''` so downstream part derivation can also skip transcript-native
74
- * `thinking` content. Returns `undefined` when no reasoning source applies.
75
- */
76
- export function resolveMessageReasoning(
77
- message: Message,
78
- fromProp?: (message: Message) => string | undefined,
79
- ): string | undefined {
80
- const fromCallback = runOverlayCallback(message, fromProp);
81
- if (fromCallback.handled && fromCallback.value === '') return '';
82
- const candidate: unknown = fromCallback.handled
83
- ? fromCallback.value
84
- : message.metadata[CINDER_REASONING_METADATA_KEY];
85
- return typeof candidate === 'string' && candidate.length > 0 ? candidate : undefined;
86
- }
87
-
88
- /**
89
- * Resolves the step overlay for a message. An explicit per-message callback is
90
- * consulted first; when it returns `undefined` (or throws) the resolution falls
91
- * back to `cinder:steps` namespaced metadata. An empty array from the callback is
92
- * authoritative and suppresses the overlay. Invalid entries are dropped. Returns
93
- * `undefined` when no valid steps apply.
94
- */
95
- export function resolveMessageSteps(
96
- message: Message,
97
- fromProp?: (message: Message) => StepInfo[] | undefined,
98
- ): StepInfo[] | undefined {
99
- const fromCallback = runOverlayCallback(message, fromProp);
100
- const candidate: unknown = fromCallback.handled
101
- ? fromCallback.value
102
- : message.metadata[CINDER_STEPS_METADATA_KEY];
103
- if (!Array.isArray(candidate)) return undefined;
104
- const steps = candidate.filter(isStepInfo);
105
- return steps.length > 0 ? steps : undefined;
106
- }
107
-
108
- /**
109
- * Resolves the suggestion overlay for a message. An explicit per-message callback
110
- * is consulted first; when it returns `undefined` (or throws) the resolution
111
- * falls back to `cinder:suggestions` namespaced metadata. An empty array from the
112
- * callback is authoritative and suppresses the overlay. Non-string entries are
113
- * dropped. Returns `undefined` when no valid suggestions apply.
114
- */
115
- export function resolveMessageSuggestions(
116
- message: Message,
117
- fromProp?: (message: Message) => string[] | undefined,
118
- ): string[] | undefined {
119
- const fromCallback = runOverlayCallback(message, fromProp);
120
- const candidate: unknown = fromCallback.handled
121
- ? fromCallback.value
122
- : message.metadata[CINDER_SUGGESTIONS_METADATA_KEY];
123
- if (!Array.isArray(candidate)) return undefined;
124
- const suggestions = candidate.filter((entry): entry is string => typeof entry === 'string');
125
- return suggestions.length > 0 ? suggestions : undefined;
126
- }
127
-
128
- /**
129
- * Normalizes content to a multi-modal array.
130
- *
131
- * Strings are wrapped in a single text part; a single content item is wrapped
132
- * in an array; an array is returned as-is. The `ReadonlyArray` in/out signature
133
- * matches {@link Message.content} so callers pass `message.content` with zero casts.
134
- *
135
- * @param input - String, single content item, or readonly content array
136
- * @returns The content as a readonly multi-modal array
137
- */
138
- export function toMultiModalArray(
139
- input: string | MultiModalContent | ReadonlyArray<MultiModalContent>,
140
- ): ReadonlyArray<MultiModalContent> {
141
- if (typeof input === 'string') return [{ type: 'text', text: input }];
142
- // A single MultiModalContent has a `type` discriminant; an array does not.
143
- // (`Array.isArray` doesn't narrow a `ReadonlyArray` out of the union, so key
144
- // off the discriminant instead — no cast needed.)
145
- return 'type' in input ? [input] : input;
146
- }
147
-
148
- function formatJSONValue(value: unknown): string {
149
- return typeof value === 'string' ? value : JSON.stringify(value, null, 2);
150
- }
151
-
152
- function getServerContentText(part: MultiModalContent): string | undefined {
153
- switch (part.type) {
154
- case 'text':
155
- return part.text;
156
- case 'server_tool_use':
157
- return [`Server tool use: ${part.name}`, formatJSONValue(part.input)].join('\n');
158
- case 'web_search_tool_result':
159
- return [`Web search result: ${part.tool_use_id}`, formatJSONValue(part.content)].join('\n');
160
- case 'code_execution_tool_result':
161
- case 'bash_code_execution_tool_result':
162
- case 'text_editor_code_execution_tool_result':
163
- case 'web_fetch_tool_result':
164
- return [`Server tool result: ${part.tool_use_id}`, formatJSONValue(part.content)].join('\n');
165
- case 'container_upload':
166
- return `Container upload: ${part.file_id}`;
167
- default:
168
- return undefined;
169
- }
170
- }
171
-
172
- /**
173
- * Extracts all content parts from a message as a multi-modal array.
174
- * `content` is `string | ReadonlyArray<MultiModalContent>` and never nullish.
175
- * A string yields a single text part (an empty string yields one empty text
176
- * part); an array is returned as-is, so an empty array yields an empty array.
177
- *
178
- * @param message - The message to extract parts from
179
- * @returns A readonly array of content parts
180
- */
181
- export function getMessageParts(message: Message): ReadonlyArray<MultiModalContent> {
182
- // `content` is `string | ReadonlyArray<MultiModalContent>` (never nullish);
183
- // toMultiModalArray handles the empty-string and empty-array cases.
184
- return toMultiModalArray(message.content);
185
- }
186
-
187
- /**
188
- * Extracts all text content from a message, joined by newlines.
189
- * Non-text parts (images, etc.) are excluded from the result.
190
- *
191
- * This is useful for copying a message's text content to clipboard
192
- * without including non-text attachments.
193
- *
194
- * @param message - The message to extract text from
195
- * @returns The concatenated text content
196
- *
197
- * @example
198
- * ```typescript
199
- * const text = getMessageText(message);
200
- * await copyToClipboard(text);
201
- * ```
202
- */
203
- export function getMessageText(message: Message): string {
204
- return getMessageParts(message)
205
- .map(getServerContentText)
206
- .filter((text): text is string => typeof text === 'string' && text.length > 0)
207
- .join('\n');
208
- }
209
-
210
- /**
211
- * Derives image render parts from a message's content array.
212
- *
213
- * One {@link ImageMessagePart} per image segment, keyed by the image's index in
214
- * the original content array so identity is stable as a streaming text body
215
- * grows alongside it. A string body has no images and yields an empty array.
216
- */
217
- function deriveImageParts(message: Message): ImageMessagePart[] {
218
- if (typeof message.content === 'string') return [];
219
-
220
- const parts: ImageMessagePart[] = [];
221
- message.content.forEach((segment, index) => {
222
- if (segment.type === 'image') {
223
- parts.push({
224
- type: 'image',
225
- key: `${message.id}:image:${index}`,
226
- image: segment,
227
- });
228
- }
229
- });
230
- return parts;
231
- }
232
-
233
- function deriveReasoningContent(
234
- message: Message,
235
- explicitReasoning: string | undefined,
236
- ): string | undefined {
237
- if (explicitReasoning === '') return undefined;
238
- const reasoningSegments =
239
- explicitReasoning && explicitReasoning.length > 0 ? [explicitReasoning] : [];
240
- if (typeof message.content !== 'string') {
241
- let hasRedactedThinking = false;
242
- for (const segment of message.content) {
243
- if (segment.type === 'thinking' && segment.thinking.length > 0) {
244
- reasoningSegments.push(segment.thinking);
245
- }
246
- if (segment.type === 'redacted_thinking') {
247
- hasRedactedThinking = true;
248
- }
249
- }
250
- if (hasRedactedThinking) {
251
- reasoningSegments.push(
252
- 'Redacted reasoning is preserved in this transcript but cannot be displayed.',
253
- );
254
- }
255
- }
256
-
257
- return reasoningSegments.length > 0 ? reasoningSegments.join('\n\n') : undefined;
258
- }
259
-
260
- /**
261
- * Builds a {@link ToolApprovalMessagePart} from an `action_required` tool result.
262
- *
263
- * Shared by both the standalone `tool-result` branch and the paired `tool-call`
264
- * branch of {@link deriveMessageParts} so the approval prompt renders for either
265
- * transcript shape. The human-readable tool name resolves from the paired
266
- * tool-call when available (else the call id); the approval state comes from the
267
- * container's approved/denied id sets. Caller guarantees `result.action` exists.
268
- */
269
- function deriveToolApprovalPart(
270
- messageId: string,
271
- result: ToolResult,
272
- context: MessagePartDerivationContext,
273
- ): ToolApprovalMessagePart {
274
- const approved = context.approvedToolCallIds?.has(result.callId)
275
- ? true
276
- : context.deniedToolCallIds?.has(result.callId)
277
- ? false
278
- : undefined;
279
- return {
280
- type: 'tool-approval',
281
- key: `${messageId}:tool-approval:${result.callId}`,
282
- toolCallId: result.callId,
283
- toolName: context.toolCallPair?.call.name ?? result.callId,
284
- action: result.action!,
285
- approved,
286
- };
287
- }
288
-
289
- /**
290
- * Derives the ordered render parts for a single message.
291
- *
292
- * This is the cinder-OWNED bridge from the compatible {@link Message} mirror to
293
- * the {@link ChatMessagePart} render layer. It is pure: every part is computed
294
- * from the message plus the per-message {@link MessagePartDerivationContext}
295
- * (the resolved tool-call pair and the live streaming buffer), never from
296
- * conversation-global state or any runtime library. UI-only parts are never
297
- * written back to the transcript.
298
- *
299
- * Body derivation mirrors the historical role-branch rendering exactly:
300
- * - `tool-call` messages emit a single `tool-call` part ONLY when the container
301
- * resolved a pair for them (`context.toolCallPair`). This matches the original
302
- * `isToolCall && toolPair` guard: the real container always supplies a pair
303
- * for a tool-call message (with `result: undefined` while the result is still
304
- * pending), so a pending call still renders as a card; a standalone
305
- * `<ChatMessage>` given no pair falls through to the text body, exactly as
306
- * before.
307
- * - `tool-result` messages with a `toolResult` emit a single `tool-result`
308
- * part (the container hides results already folded into a paired card).
309
- * - every other role emits a `markdown` body part carrying the effective text
310
- * (streaming `overrideContent` resolved in).
311
- *
312
- * Every branch then appends one `image` part per image segment in the content,
313
- * so attachments render below the body for all roles — exactly as the historical
314
- * unconditional `MessageAttachments` did.
315
- *
316
- * A `tool-call` message with no resolved pair, or a `tool-result` message with
317
- * no `toolResult`, falls back to the markdown path rather than producing nothing.
318
- *
319
- * @param message - The message to derive parts for
320
- * @param context - Per-message pairing + streaming context (optional)
321
- * @returns The ordered render parts (stable `key` on each for keyed iteration)
322
- */
323
- export function deriveMessageParts(
324
- message: Message,
325
- context: MessagePartDerivationContext = {},
326
- ): ChatMessagePart[] {
327
- // Images render below the body for every role (the historical attachment view
328
- // was unconditional), so each branch appends them after its body part.
329
- const imageParts = deriveImageParts(message);
330
-
331
- // Tool-call body: emit a tool-call part only when the container resolved a
332
- // pair for this message (mirrors the original `isToolCall && toolPair`
333
- // guard). With no pair, fall through to the markdown body below — the same
334
- // text rendering the original showed for an unpaired tool-call message.
335
- //
336
- // When that pair's result is `action_required` with an action, ALSO emit a
337
- // tool-approval part after the call card. In the common paired transcript the
338
- // standalone `tool-result` row is folded into this card (the container hides
339
- // paired results), so without this the approval prompt would never render for
340
- // the call-plus-result shape — only for a rare standalone action_required
341
- // result. The card shows what is being called; the approval gates consent.
342
- if (message.role === 'tool-call' && message.toolCall && context.toolCallPair) {
343
- const result = context.toolCallPair.result;
344
- const approvalPart =
345
- result && result.outcome === 'action_required' && result.action
346
- ? deriveToolApprovalPart(message.id, result, context)
347
- : undefined;
348
- return [
349
- {
350
- type: 'tool-call',
351
- key: `${message.id}:tool-call:${message.toolCall.id}`,
352
- pair: context.toolCallPair,
353
- },
354
- ...(approvalPart ? [approvalPart] : []),
355
- ...imageParts,
356
- ];
357
- }
358
-
359
- // Tool-result body: when the outcome is `action_required` and an action is
360
- // present, emit a `tool-approval` part instead of the plain `tool-result`
361
- // part. The approval part carries the action, the tool call id (used to
362
- // look up the tool name from the paired tool-call), and the resolved
363
- // approval state from the container's approved/denied id sets. A plain
364
- // `success` or `error` result falls through to the standard `tool-result`
365
- // part, so this branch is a strict superset that adds zero visual change
366
- // for non-approval results.
367
- if (message.role === 'tool-result' && message.toolResult) {
368
- const result = message.toolResult;
369
- if (result.outcome === 'action_required' && result.action) {
370
- return [deriveToolApprovalPart(message.id, result, context), ...imageParts];
371
- }
372
- return [
373
- {
374
- type: 'tool-result',
375
- key: `${message.id}:tool-result:${result.callId}`,
376
- result,
377
- },
378
- ...imageParts,
379
- ];
380
- }
381
-
382
- // Default body: markdown text (streaming override resolved in) followed by
383
- // images. `body` is a representation-independent key, so a streaming body
384
- // never remounts as its text grows, and an attachment landing after it keeps
385
- // its own index-based key.
386
- //
387
- // C4: Composition order is steps → reasoning → markdown → images.
388
- // Steps surface the plan, reasoning surfaces extended thinking, markdown is
389
- // the final answer. When neither is present the branch is identical to today.
390
- const content = context.overrideContent ?? getMessageText(message);
391
-
392
- const bodyParts: ChatMessagePart[] = [];
393
-
394
- // C4: Step parts — one per entry in context.steps[], in order.
395
- if (context.steps && context.steps.length > 0) {
396
- for (let index = 0; index < context.steps.length; index++) {
397
- const step = context.steps[index]!;
398
- bodyParts.push({
399
- type: 'step',
400
- key: `${message.id}:step:${index}`,
401
- index,
402
- title: step.title,
403
- content: step.content,
404
- status: step.status,
405
- });
406
- }
407
- }
408
-
409
- // C4: Reasoning part — emitted before the markdown body when present.
410
- const reasoningContent = deriveReasoningContent(message, context.reasoning);
411
- if (reasoningContent) {
412
- bodyParts.push({
413
- type: 'reasoning',
414
- key: `${message.id}:reasoning`,
415
- content: reasoningContent,
416
- streaming: context.streaming ?? false,
417
- });
418
- }
419
-
420
- bodyParts.push({
421
- type: 'markdown',
422
- key: `${message.id}:body`,
423
- content,
424
- streaming: context.streaming ?? false,
425
- expanded: context.expanded ?? true,
426
- });
427
-
428
- // C5: Suggestion parts — one per entry in context.suggestions[], after the
429
- // markdown body but before images. An empty or absent array adds nothing,
430
- // keeping the plain-transcript path identical to before.
431
- if (context.suggestions && context.suggestions.length > 0) {
432
- for (let index = 0; index < context.suggestions.length; index++) {
433
- const label = context.suggestions[index]!;
434
- bodyParts.push({
435
- type: 'suggestion',
436
- key: `${message.id}:suggestion:${index}`,
437
- index,
438
- label,
439
- });
440
- }
441
- }
442
-
443
- return [...bodyParts, ...imageParts];
444
- }
445
-
446
- /**
447
- * Gets the role label for a message.
448
- * Maps internal role values to human-readable labels.
449
- *
450
- * @param message - The message to get the role label for
451
- * @returns A human-readable role label
452
- */
453
- export function getMessageRoleLabel(message: Message): string {
454
- const labels: Record<Message['role'], string> = {
455
- user: 'User',
456
- assistant: 'Assistant',
457
- system: 'System',
458
- developer: 'Developer',
459
- 'tool-call': 'Tool Call',
460
- 'tool-result': 'Tool Result',
461
- snapshot: 'Snapshot',
462
- };
463
- return labels[message.role] ?? message.role;
464
- }
465
-
466
- /**
467
- * Formats a single message as Markdown for copy operations.
468
- *
469
- * Currently returns just the text content without role labels,
470
- * since the UI context makes the source obvious. The separate function
471
- * exists for API clarity and future extensibility (e.g., adding code
472
- * fences for tool results).
473
- *
474
- * @param message - The message to format
475
- * @returns Markdown-formatted message content
476
- */
477
- export function formatMessageAsMarkdown(message: Message): string {
478
- return getMessageText(message);
479
- }
480
-
481
- /**
482
- * Formats a message with role label for conversation export.
483
- *
484
- * @param message - The message to format
485
- * @returns Markdown-formatted message with role header
486
- */
487
- function formatMessageWithRole(message: Message): string {
488
- const roleLabel = getMessageRoleLabel(message);
489
- const text = getMessageText(message);
490
- return `**${roleLabel}:**\n\n${text}`;
491
- }
492
-
493
- /**
494
- * Converts a list of messages to Markdown format.
495
- *
496
- * This is a browser-compatible markdown serialization for chat transcripts,
497
- * avoiding the Node.js APIs (createRequire) used by server-side exporters.
498
- *
499
- * @param messages - The messages to convert
500
- * @returns Markdown-formatted conversation
501
- */
502
- export function messagesToMarkdown(messages: Message[]): string {
503
- return messages
504
- .filter((msg) => msg.role !== 'system' && msg.role !== 'developer')
505
- .map(formatMessageWithRole)
506
- .join('\n\n---\n\n');
507
- }
@@ -1,68 +0,0 @@
1
- export type FuzzyFilterItem = {
2
- value: string;
3
- label: string;
4
- keywords?: readonly string[] | undefined;
5
- };
6
-
7
- export type FuzzyFilterResult<TItem extends FuzzyFilterItem> = {
8
- item: TItem;
9
- score: number;
10
- };
11
-
12
- function normalize(value: string): string {
13
- return value.trim().toLowerCase();
14
- }
15
-
16
- export function fuzzySubsequenceScore(candidate: string, query: string): number | null {
17
- const normalizedCandidate = normalize(candidate);
18
- const normalizedQuery = normalize(query);
19
-
20
- if (normalizedQuery.length === 0) return 0;
21
- if (normalizedCandidate.length === 0) return null;
22
-
23
- let score = 0;
24
- let searchIndex = 0;
25
- let previousMatchIndex = -1;
26
-
27
- for (const character of normalizedQuery) {
28
- const matchIndex = normalizedCandidate.indexOf(character, searchIndex);
29
- if (matchIndex === -1) return null;
30
-
31
- score += matchIndex === previousMatchIndex + 1 ? 4 : 1;
32
- if (matchIndex === 0) score += 2;
33
- if (/[\s/_-]/u.test(normalizedCandidate[matchIndex - 1] ?? '')) score += 2;
34
-
35
- previousMatchIndex = matchIndex;
36
- searchIndex = matchIndex + 1;
37
- }
38
-
39
- return score - normalizedCandidate.length * 0.01;
40
- }
41
-
42
- export function filterFuzzySubsequence<TItem extends FuzzyFilterItem>(
43
- items: readonly TItem[],
44
- query: string,
45
- ): TItem[] {
46
- const normalizedQuery = normalize(query);
47
- if (normalizedQuery.length === 0) return [...items];
48
-
49
- const matchedItems = items
50
- .map((item, index) => {
51
- const candidates = [item.label, item.value, ...(item.keywords ?? [])];
52
- let bestScore: number | null = null;
53
-
54
- for (const candidate of candidates) {
55
- const score = fuzzySubsequenceScore(candidate, normalizedQuery);
56
- if (score !== null && (bestScore === null || score > bestScore)) {
57
- bestScore = score;
58
- }
59
- }
60
-
61
- return bestScore === null ? null : { item, index, score: bestScore };
62
- })
63
- .filter((result) => result !== null);
64
-
65
- matchedItems.sort((a, b) => b.score - a.score || a.index - b.index);
66
-
67
- return matchedItems.map((result) => result.item);
68
- }
@@ -1,7 +0,0 @@
1
- @layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
2
- /* ChatComposerPopover renders CommandMenu and CommandItem internally. Pull in
3
- * the command menu family so the wrapper is styled through its own styles path. */
4
- @import '../command-menu/command-menu.css';
5
-
6
- @layer cinder.components {
7
- }
@@ -1,13 +0,0 @@
1
- {
2
- "$schema": "../../schemas/examples.schema.json",
3
- "component": "chat-composer-popover",
4
- "import": "@lostgradient/cinder/chat-composer-popover",
5
- "examples": [
6
- {
7
- "id": "slash-commands",
8
- "title": "Slash commands in ChatInput",
9
- "description": "Wires ChatComposerPopover to ChatInput with consumer-owned command definitions.",
10
- "code": "<script lang=\"ts\">\n import ChatComposerPopover, {\n type ChatComposerPopoverSelection,\n } from '@lostgradient/cinder/chat-composer-popover';\n import { ChatInput } from '@lostgradient/cinder/chat';\n\n type SlashCommand = {\n value: string;\n label: string;\n description: string;\n insert: string;\n keywords?: string[];\n };\n\n const commands: SlashCommand[] = [\n {\n value: 'help',\n label: 'Help',\n description: 'Show available assistant commands',\n insert: '/help ',\n keywords: ['docs', 'support'],\n },\n {\n value: 'new',\n label: 'New conversation',\n description: 'Start a fresh thread',\n insert: '/new ',\n keywords: ['reset', 'fresh'],\n },\n {\n value: 'tools',\n label: 'Tools',\n description: 'Open tool controls',\n insert: '/tools ',\n keywords: ['integrations', 'actions'],\n },\n {\n value: 'stop',\n label: 'Stop',\n description: 'Stop the current response',\n insert: '/stop',\n keywords: ['cancel', 'halt'],\n },\n ];\n\n let value = $state('');\n let selectedCommand = $state('None');\n\n function handleSelect(selection: ChatComposerPopoverSelection<SlashCommand>) {\n value = `${value.slice(0, selection.range.start)}${selection.item.insert}${value.slice(\n selection.range.end,\n )}`;\n selectedCommand = selection.item.label;\n }\n</script>\n\n<ChatComposerPopover id=\"slash-command\" bind:value items={commands} onselect={handleSelect}>\n {#snippet composer(composerProps)}\n <ChatInput\n id=\"chat\"\n bind:value\n allowAttachments={false}\n placeholder=\"Type / for commands\"\n composerRole={composerProps.composerRole}\n composerAriaExpanded={composerProps.composerAriaExpanded}\n composerAriaControls={composerProps.composerAriaControls}\n composerAriaActiveDescendant={composerProps.composerAriaActiveDescendant}\n composerAriaAutocomplete={composerProps.composerAriaAutocomplete}\n oncomposerinput={composerProps.oncomposerinput}\n oncomposerkeydown={composerProps.oncomposerkeydown}\n oncomposerselectionchange={composerProps.oncomposerselectionchange}\n oncomposerblur={composerProps.oncomposerblur}\n />\n {/snippet}\n</ChatComposerPopover>\n\n<p>Selected: {selectedCommand}</p>\n"
11
- }
12
- ]
13
- }
@@ -1,90 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "type": "object",
4
- "properties": {
5
- "id": {
6
- "type": "string",
7
- "description": "Unique identifier used for the listbox and item ids."
8
- },
9
- "value": {
10
- "type": "string",
11
- "description": "Current composer value. Bind this to the same value as ChatInput."
12
- },
13
- "triggers": {
14
- "type": "array",
15
- "items": {
16
- "type": "string"
17
- },
18
- "description": "Trigger characters that open the popover. Default `['/', '@']`."
19
- },
20
- "label": {
21
- "type": "string",
22
- "description": "Accessible listbox label. Default `'Composer suggestions'`."
23
- },
24
- "placement": {
25
- "enum": [
26
- "top",
27
- "bottom",
28
- "left",
29
- "right",
30
- "top-start",
31
- "top-end",
32
- "bottom-start",
33
- "bottom-end"
34
- ],
35
- "description": "Caret-relative placement. Default `'bottom-start'`."
36
- },
37
- "offset": {
38
- "type": "number",
39
- "description": "Distance in px between the caret and popover. Default `6`."
40
- }
41
- },
42
- "additionalProperties": false,
43
- "required": ["id"],
44
- "metadata": {
45
- "unsupportedProps": [
46
- {
47
- "name": "composer",
48
- "reason": "function-or-snippet",
49
- "required": true,
50
- "description": "Render the ChatInput or compatible composer with the provided overlay props."
51
- },
52
- {
53
- "name": "detectTrigger",
54
- "reason": "function-or-snippet",
55
- "description": "Override trigger detection."
56
- },
57
- {
58
- "name": "empty",
59
- "reason": "function-or-snippet",
60
- "description": "Optional empty state rendered when filtering produces no matching rows."
61
- },
62
- {
63
- "name": "filter",
64
- "reason": "function-or-snippet",
65
- "description": "Override filtering."
66
- },
67
- {
68
- "name": "item",
69
- "reason": "function-or-snippet",
70
- "description": "Optional custom row contents. Defaults to the item label and description."
71
- },
72
- {
73
- "name": "items",
74
- "reason": "generic-type-parameter",
75
- "required": true,
76
- "description": "Consumer-owned command or mention definitions."
77
- },
78
- {
79
- "name": "ondismiss",
80
- "reason": "function-or-snippet",
81
- "description": "Invoked when Escape, trigger loss, or outside pointerdown dismisses the popover."
82
- },
83
- {
84
- "name": "onselect",
85
- "reason": "function-or-snippet",
86
- "description": "Invoked when an enabled item is selected by keyboard or pointer."
87
- }
88
- ]
89
- }
90
- }