@kitn.ai/ui 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/README.md +55 -17
  2. package/dist/components/artifact.d.ts +39 -1
  3. package/dist/components/attachment-types.d.ts +12 -0
  4. package/dist/components/attachments.d.ts +2 -10
  5. package/dist/components/card.d.ts +27 -0
  6. package/dist/components/chain-of-thought.d.ts +78 -2
  7. package/dist/components/chat-scope-picker.d.ts +7 -0
  8. package/dist/components/chat-thread.d.ts +39 -16
  9. package/dist/components/choice-card.d.ts +27 -0
  10. package/dist/components/coachmark.d.ts +49 -0
  11. package/dist/components/composer-dom.d.ts +35 -0
  12. package/dist/components/composer-highlight.d.ts +48 -0
  13. package/dist/components/composer-history.d.ts +34 -0
  14. package/dist/components/composer.d.ts +86 -0
  15. package/dist/components/confirm-card.d.ts +17 -0
  16. package/dist/components/conversation-item.d.ts +9 -0
  17. package/dist/components/conversation-list.d.ts +36 -1
  18. package/dist/components/dismissed-stub.d.ts +22 -0
  19. package/dist/components/file-tree.d.ts +15 -0
  20. package/dist/components/form.d.ts +34 -0
  21. package/dist/components/markdown.d.ts +3 -0
  22. package/dist/components/message.d.ts +71 -2
  23. package/dist/components/model-switcher.d.ts +7 -0
  24. package/dist/components/prompt-input.d.ts +13 -4
  25. package/dist/components/prompt-suggestion.d.ts +9 -1
  26. package/dist/components/reasoning.d.ts +14 -1
  27. package/dist/components/response-compare-types.d.ts +66 -0
  28. package/dist/components/response-compare.d.ts +65 -0
  29. package/dist/components/screen.d.ts +46 -0
  30. package/dist/components/tasks-card.d.ts +50 -1
  31. package/dist/components/toast.d.ts +58 -0
  32. package/dist/components/tool-types.d.ts +10 -0
  33. package/dist/components/tool.d.ts +8 -8
  34. package/dist/components/use-card-resolution.d.ts +10 -6
  35. package/dist/components/voice-input.d.ts +27 -0
  36. package/dist/components/voice-output.d.ts +33 -0
  37. package/dist/core-C8fzo39E.js +12 -0
  38. package/dist/custom-elements.json +8472 -1691
  39. package/dist/elements/agent-card.d.ts +1 -0
  40. package/dist/elements/agent-card.js +1 -0
  41. package/dist/elements/artifact.js +1 -0
  42. package/dist/elements/attachments.js +1 -0
  43. package/dist/elements/autoloader.d.ts +2 -0
  44. package/dist/elements/autoloader.js +1 -0
  45. package/dist/elements/avatar.d.ts +1 -0
  46. package/dist/elements/avatar.js +1 -0
  47. package/dist/elements/badge.d.ts +1 -0
  48. package/dist/elements/badge.js +1 -0
  49. package/dist/elements/button.d.ts +1 -0
  50. package/dist/elements/button.js +1 -0
  51. package/dist/elements/card.js +1 -0
  52. package/dist/elements/cards.d.ts +1 -0
  53. package/dist/elements/cards.js +1 -0
  54. package/dist/elements/chain-of-thought.d.ts +0 -12
  55. package/dist/elements/chain-of-thought.js +1 -0
  56. package/dist/elements/chat-scope-picker.js +1 -0
  57. package/dist/elements/chat-types.d.ts +8 -2
  58. package/dist/elements/chat-workspace.js +1 -0
  59. package/dist/elements/chat.js +1 -0
  60. package/dist/elements/checkpoint.js +1 -0
  61. package/dist/elements/choice.js +1 -0
  62. package/dist/elements/chunks/Icon-DLLBeLG5.js +1 -0
  63. package/dist/elements/chunks/action-icons-UB4V5FNq.js +1 -0
  64. package/dist/elements/chunks/arrow-left-C-gwlUmx.js +1 -0
  65. package/dist/elements/chunks/attachments-CgbErf1r.js +1 -0
  66. package/dist/elements/chunks/badge-DTQpgB6N.js +1 -0
  67. package/dist/elements/chunks/bash-InADTalH.js +1 -0
  68. package/dist/elements/chunks/button-XDUM6lXs.js +1 -0
  69. package/dist/elements/chunks/card-CBlFZ-7I.js +1 -0
  70. package/dist/elements/chunks/card-routing-C986KuUA.js +1 -0
  71. package/dist/elements/chunks/chat-thread-BIhmqwNL.js +1 -0
  72. package/dist/elements/chunks/check-hGUoVIKb.js +1 -0
  73. package/dist/elements/chunks/chevron-down-DDoaSUtO.js +1 -0
  74. package/dist/elements/chunks/chevron-right-CdGEUakB.js +1 -0
  75. package/dist/elements/chunks/circle-BKAZdmzb.js +1 -0
  76. package/dist/elements/chunks/circle-check-CmYG-y3I.js +1 -0
  77. package/dist/elements/chunks/circle-x-DewgAEym.js +1 -0
  78. package/dist/elements/chunks/cn-CU7UAWzk.js +1 -0
  79. package/dist/elements/chunks/code-block-DedwxwFI.js +1 -0
  80. package/dist/elements/chunks/collapsible-FfgmTHtM.js +1 -0
  81. package/dist/elements/chunks/composer-Cfbw5HKT.js +65 -0
  82. package/dist/elements/chunks/context-DwJmxlRE.js +1 -0
  83. package/dist/elements/chunks/conversation-list-DsCQMfPq.js +1 -0
  84. package/dist/elements/chunks/core-AYMC6_lb.js +12 -0
  85. package/dist/elements/chunks/css-M7EaDHN_.js +1 -0
  86. package/dist/elements/chunks/default-input-BuqsoENC.js +1 -0
  87. package/dist/elements/chunks/define-rGsaWsLL.js +1 -0
  88. package/dist/elements/chunks/disclosure-CwoAkpMH.js +1 -0
  89. package/dist/elements/chunks/download-DJ06G3Bz.js +1 -0
  90. package/dist/elements/chunks/dropdown-BFg8ri_R.js +1 -0
  91. package/dist/elements/chunks/ellipsis-dlN6YvGw.js +1 -0
  92. package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +141 -0
  93. package/dist/elements/chunks/external-link-DBX2lc_R.js +1 -0
  94. package/dist/elements/chunks/file-text-HfwUx4F9.js +1 -0
  95. package/dist/elements/chunks/file-tree-C6Toj71u.js +1 -0
  96. package/dist/elements/chunks/folder-MYuqa9Xp.js +1 -0
  97. package/dist/elements/chunks/github-dark-dimmed-DUshB20C.js +1 -0
  98. package/dist/elements/chunks/github-light-JYsPkUQd.js +1 -0
  99. package/dist/elements/chunks/hover-card-gE7iyXdW.js +1 -0
  100. package/dist/elements/chunks/html-CPZ3oZQ7.js +1 -0
  101. package/dist/elements/chunks/icon-Vqz4ivrY.js +1 -0
  102. package/dist/elements/chunks/index-BCRhi84a.js +1 -0
  103. package/dist/elements/chunks/info-B_toFS0l.js +1 -0
  104. package/dist/elements/chunks/input-gzbHYZvQ.js +1 -0
  105. package/dist/elements/chunks/javascript-C25yR2R2.js +1 -0
  106. package/dist/elements/chunks/json-DxJze_jm.js +1 -0
  107. package/dist/elements/chunks/kbd-n49c4KZm.js +1 -0
  108. package/dist/elements/chunks/link-CKPs9yM0.js +1 -0
  109. package/dist/elements/chunks/loader-q6MamGus.js +1 -0
  110. package/dist/elements/chunks/markdown-DBrcqq4S.js +64 -0
  111. package/dist/elements/chunks/message-CTqaYI0s.js +1 -0
  112. package/dist/elements/chunks/message-feedback-Cvzm03w0.js +1 -0
  113. package/dist/elements/chunks/message-square-CUg9eRCi.js +1 -0
  114. package/dist/elements/chunks/minimize-2-l2klxP6K.js +1 -0
  115. package/dist/elements/chunks/model-switcher-CmyjiHO1.js +1 -0
  116. package/dist/elements/chunks/overlay-C8sOYqjT.js +1 -0
  117. package/dist/elements/chunks/paperclip-42Ia7xHD.js +1 -0
  118. package/dist/elements/chunks/progress-bar-tzKMWAwO.js +1 -0
  119. package/dist/elements/chunks/prompt-suggestion-D3F6vP_A.js +1 -0
  120. package/dist/elements/chunks/reasoning-BJNmmyov.js +1 -0
  121. package/dist/elements/chunks/resizable-BRsk19qI.js +1 -0
  122. package/dist/elements/chunks/rotate-cw-BgcggLHC.js +1 -0
  123. package/dist/elements/chunks/scroll-area-CgGbFFbT.js +1 -0
  124. package/dist/elements/chunks/separator-8hM4GdHE.js +1 -0
  125. package/dist/elements/chunks/settings-CaUIYOg-.js +1 -0
  126. package/dist/elements/chunks/settings-group-CYjOVIZQ.js +1 -0
  127. package/dist/elements/chunks/share-BTYM3Ddt.js +1 -0
  128. package/dist/elements/chunks/skeleton-DsTYrPUe.js +1 -0
  129. package/dist/elements/chunks/slots-DkZ-Cmha.js +1 -0
  130. package/dist/elements/chunks/star-9R3LBQ9n.js +1 -0
  131. package/dist/elements/chunks/store-CYl5Y0_u.js +1 -0
  132. package/dist/elements/chunks/svelte--5p79yCD.js +1 -0
  133. package/dist/elements/chunks/text-shimmer-CaYGv8Se.js +1 -0
  134. package/dist/elements/chunks/textarea-NEr2SLcD.js +1 -0
  135. package/dist/elements/chunks/thumbs-up-DZYZkFfc.js +1 -0
  136. package/dist/elements/chunks/toast-store-ClxVZRcc.js +1 -0
  137. package/dist/elements/chunks/tool-CHZOmoe9.js +1 -0
  138. package/dist/elements/chunks/tooltip-WpHElELC.js +1 -0
  139. package/dist/elements/chunks/triangle-alert-BlS80PUg.js +1 -0
  140. package/dist/elements/chunks/tsx-B8rCNbgL.js +1 -0
  141. package/dist/elements/chunks/typescript-RycA9KXf.js +1 -0
  142. package/dist/elements/chunks/use-card-resolution-VSVoxDeJ.js +1 -0
  143. package/dist/elements/chunks/video-DxTPZqT8.js +1 -0
  144. package/dist/elements/chunks/vue-BmIZj4XD.js +1 -0
  145. package/dist/elements/chunks/x-C1qtndxn.js +1 -0
  146. package/dist/elements/coachmark.d.ts +1 -0
  147. package/dist/elements/coachmark.js +1 -0
  148. package/dist/elements/code-block.js +1 -0
  149. package/dist/elements/command.d.ts +1 -0
  150. package/dist/elements/command.js +1 -0
  151. package/dist/elements/compare.d.ts +1 -0
  152. package/dist/elements/compare.js +1 -0
  153. package/dist/elements/composer.d.ts +1 -0
  154. package/dist/elements/composer.js +1 -0
  155. package/dist/elements/confirm-card.js +1 -0
  156. package/dist/elements/context-meter.js +1 -0
  157. package/dist/elements/conversation-list.d.ts +1 -11
  158. package/dist/elements/conversation-list.js +1 -0
  159. package/dist/elements/default-input.d.ts +20 -9
  160. package/dist/elements/define.d.ts +11 -0
  161. package/dist/elements/dialog.d.ts +1 -0
  162. package/dist/elements/dialog.js +1 -0
  163. package/dist/elements/disclosure.d.ts +37 -0
  164. package/dist/elements/editable-label.d.ts +1 -0
  165. package/dist/elements/editable-label.js +1 -0
  166. package/dist/elements/embed.js +1 -0
  167. package/dist/elements/empty.js +1 -0
  168. package/dist/elements/feedback-bar.js +1 -0
  169. package/dist/elements/file-tree.js +1 -0
  170. package/dist/elements/file-upload.js +1 -0
  171. package/dist/elements/form.js +1 -0
  172. package/dist/elements/hover-card.d.ts +1 -0
  173. package/dist/elements/hover-card.js +1 -0
  174. package/dist/elements/icon.d.ts +1 -0
  175. package/dist/elements/icon.js +1 -0
  176. package/dist/elements/image.js +1 -0
  177. package/dist/elements/input.d.ts +1 -0
  178. package/dist/elements/input.js +1 -0
  179. package/dist/elements/kbd.d.ts +1 -0
  180. package/dist/elements/kbd.js +1 -0
  181. package/dist/elements/link-preview.js +1 -0
  182. package/dist/elements/loader.js +1 -0
  183. package/dist/elements/markdown.js +1 -0
  184. package/dist/elements/menu.d.ts +1 -0
  185. package/dist/elements/menu.js +1 -0
  186. package/dist/elements/message-skills.d.ts +0 -16
  187. package/dist/elements/message-skills.js +1 -0
  188. package/dist/elements/message.js +1 -0
  189. package/dist/elements/model-switcher.d.ts +1 -11
  190. package/dist/elements/model-switcher.js +1 -0
  191. package/dist/elements/nav.d.ts +1 -0
  192. package/dist/elements/nav.js +1 -0
  193. package/dist/elements/notice.d.ts +1 -0
  194. package/dist/elements/notice.js +1 -0
  195. package/dist/elements/pane-group.d.ts +1 -0
  196. package/dist/elements/pane-group.js +1 -0
  197. package/dist/elements/pane.d.ts +1 -0
  198. package/dist/elements/pane.js +1 -0
  199. package/dist/elements/popover.js +1 -0
  200. package/dist/elements/progress-bar.d.ts +1 -0
  201. package/dist/elements/progress-bar.js +1 -0
  202. package/dist/elements/prompt-dock.d.ts +1 -0
  203. package/dist/elements/prompt-dock.js +1 -0
  204. package/dist/elements/prompt-input.d.ts +1 -9
  205. package/dist/elements/prompt-input.js +1 -0
  206. package/dist/elements/prompt-suggestions.d.ts +0 -6
  207. package/dist/elements/prompt-suggestions.js +1 -0
  208. package/dist/elements/reasoning.js +1 -0
  209. package/dist/elements/register.d.ts +10 -0
  210. package/dist/elements/remote.js +1 -0
  211. package/dist/elements/resizable.d.ts +1 -17
  212. package/dist/elements/resizable.js +1 -0
  213. package/dist/elements/response-stream.js +14 -0
  214. package/dist/elements/screen.d.ts +1 -0
  215. package/dist/elements/screen.js +1 -0
  216. package/dist/elements/scroll-area.d.ts +1 -0
  217. package/dist/elements/scroll-area.js +1 -0
  218. package/dist/elements/scroll-button.js +1 -0
  219. package/dist/elements/search.d.ts +1 -0
  220. package/dist/elements/search.js +1 -0
  221. package/dist/elements/segmented.d.ts +1 -0
  222. package/dist/elements/segmented.js +1 -0
  223. package/dist/elements/separator.d.ts +1 -0
  224. package/dist/elements/separator.js +1 -0
  225. package/dist/elements/setting-item.d.ts +1 -0
  226. package/dist/elements/setting-item.js +1 -0
  227. package/dist/elements/settings-group.d.ts +1 -0
  228. package/dist/elements/settings-group.js +1 -0
  229. package/dist/elements/skeleton.d.ts +1 -0
  230. package/dist/elements/skeleton.js +1 -0
  231. package/dist/elements/slots.d.ts +176 -0
  232. package/dist/elements/source.d.ts +0 -17
  233. package/dist/elements/source.js +1 -0
  234. package/dist/elements/status.d.ts +1 -0
  235. package/dist/elements/status.js +1 -0
  236. package/dist/elements/switch.js +1 -0
  237. package/dist/elements/tabs.d.ts +1 -0
  238. package/dist/elements/tabs.js +1 -0
  239. package/dist/elements/tasks.js +1 -0
  240. package/dist/elements/text-shimmer.js +1 -0
  241. package/dist/elements/thinking-bar.js +1 -0
  242. package/dist/elements/toast.d.ts +1 -0
  243. package/dist/elements/toast.js +1 -0
  244. package/dist/elements/tool.js +1 -0
  245. package/dist/elements/tooltip.d.ts +1 -0
  246. package/dist/elements/tooltip.js +1 -0
  247. package/dist/elements/voice-input.js +1 -0
  248. package/dist/elements/voice-output.d.ts +1 -0
  249. package/dist/elements/voice-output.js +1 -0
  250. package/dist/elements.d.ts +772 -61
  251. package/dist/engine-javascript-C1x7zo1_.js +141 -0
  252. package/dist/index.d.ts +15 -2
  253. package/dist/index.js +14405 -9810
  254. package/dist/kai.es.js +1 -0
  255. package/dist/llms/llms-full.txt +1234 -107
  256. package/dist/llms/llms.txt +4 -4
  257. package/dist/mcp.es.js +217 -6
  258. package/dist/primitives/card-contract.d.ts +20 -4
  259. package/dist/primitives/card-recovery.d.ts +55 -0
  260. package/dist/primitives/composer-model.d.ts +22 -0
  261. package/dist/primitives/composer-triggers.d.ts +19 -0
  262. package/dist/primitives/create-kai-chat.d.ts +38 -0
  263. package/dist/primitives/message-feedback.d.ts +35 -0
  264. package/dist/primitives/toast-store.d.ts +118 -0
  265. package/dist/primitives/use-speech-recognition.d.ts +26 -0
  266. package/dist/react/index.d.ts +1166 -98
  267. package/dist/react/runtime.d.ts +9 -2
  268. package/dist/react/use-kai-chat.d.ts +41 -0
  269. package/dist/react.js +575 -186
  270. package/dist/register-impl-CYWGkgbI.js +141 -0
  271. package/dist/schemas/choice.schema.json +5 -0
  272. package/dist/schemas/tasks.schema.json +7 -2
  273. package/dist/state/index.d.ts +4 -0
  274. package/dist/state/messages.d.ts +11 -0
  275. package/dist/state/stream.d.ts +22 -0
  276. package/dist/state/suggestions.d.ts +4 -0
  277. package/dist/state.js +117 -0
  278. package/dist/theme.tokens.css +87 -0
  279. package/dist/types.d.ts +4 -0
  280. package/dist/ui/agent-card.d.ts +61 -0
  281. package/dist/ui/button.d.ts +5 -2
  282. package/dist/ui/card.d.ts +61 -0
  283. package/dist/ui/collapsible.d.ts +15 -1
  284. package/dist/ui/command.d.ts +33 -0
  285. package/dist/ui/dialog.d.ts +42 -0
  286. package/dist/ui/dropdown.d.ts +95 -1
  287. package/dist/ui/editable-label.d.ts +26 -0
  288. package/dist/ui/hover-card.d.ts +13 -1
  289. package/dist/ui/icon.d.ts +18 -0
  290. package/dist/ui/input.d.ts +33 -0
  291. package/dist/ui/kbd.d.ts +21 -0
  292. package/dist/ui/nav.d.ts +62 -0
  293. package/dist/ui/notice.d.ts +31 -0
  294. package/dist/ui/overlay.d.ts +12 -0
  295. package/dist/ui/pane-grid.d.ts +58 -0
  296. package/dist/ui/pane-group.d.ts +75 -0
  297. package/dist/ui/pane.d.ts +78 -0
  298. package/dist/ui/popover.d.ts +11 -1
  299. package/dist/ui/progress-bar.d.ts +23 -0
  300. package/dist/ui/prompt-dock.d.ts +96 -0
  301. package/dist/ui/resizable.d.ts +12 -0
  302. package/dist/ui/scroll-area.d.ts +4 -0
  303. package/dist/ui/segmented.d.ts +28 -0
  304. package/dist/ui/settings-group.d.ts +32 -0
  305. package/dist/ui/skeleton.d.ts +12 -0
  306. package/dist/ui/stat.d.ts +16 -0
  307. package/dist/ui/status.d.ts +13 -0
  308. package/dist/ui/switch.d.ts +8 -1
  309. package/dist/ui/tabs.d.ts +35 -0
  310. package/dist/ui/tooltip.d.ts +20 -1
  311. package/frameworks/react/index.tsx +1100 -163
  312. package/frameworks/react/runtime.tsx +30 -1
  313. package/frameworks/react/use-kai-chat.tsx +87 -0
  314. package/llms-full.txt +1234 -107
  315. package/llms.txt +4 -4
  316. package/package.json +36 -12
  317. package/src/agent-tooling/mcp/manifest.ts +14 -0
  318. package/src/agent-tooling/mcp/tools/debug.ts +194 -6
  319. package/src/agent-tooling/mcp/tools/reference.ts +32 -0
  320. package/src/agent-tooling/mcp/tools/scaffold.ts +162 -1
  321. package/src/components/artifact.tsx +98 -13
  322. package/src/components/attachment-types.ts +13 -0
  323. package/src/components/attachments.tsx +4 -14
  324. package/src/components/card.tsx +109 -15
  325. package/src/components/chain-of-thought.tsx +210 -1
  326. package/src/components/chat-scope-picker.tsx +13 -3
  327. package/src/components/chat-thread.tsx +238 -137
  328. package/src/components/choice-card.tsx +136 -15
  329. package/src/components/coachmark.tsx +245 -0
  330. package/src/components/component-meta.json +921 -108
  331. package/src/components/composer-dom.ts +159 -0
  332. package/src/components/composer-highlight.ts +242 -0
  333. package/src/components/composer-history.ts +82 -0
  334. package/src/components/composer.tsx +979 -0
  335. package/src/components/confirm-card.tsx +69 -2
  336. package/src/components/conversation-item.tsx +69 -7
  337. package/src/components/conversation-list.tsx +134 -37
  338. package/src/components/dismissed-stub.tsx +80 -0
  339. package/src/components/file-tree.tsx +197 -47
  340. package/src/components/form-widgets.tsx +9 -7
  341. package/src/components/form.tsx +161 -20
  342. package/src/components/image.tsx +3 -5
  343. package/src/components/link-preview.tsx +5 -4
  344. package/src/components/markdown.tsx +5 -2
  345. package/src/components/message.tsx +174 -14
  346. package/src/components/model-switcher.tsx +19 -4
  347. package/src/components/prompt-input.tsx +46 -75
  348. package/src/components/prompt-suggestion.tsx +48 -16
  349. package/src/components/reasoning.tsx +29 -6
  350. package/src/components/response-compare-types.ts +127 -0
  351. package/src/components/response-compare.tsx +460 -0
  352. package/src/components/screen.tsx +176 -0
  353. package/src/components/tasks-card.tsx +374 -23
  354. package/src/components/toast.tsx +486 -0
  355. package/src/components/tool-types.ts +10 -0
  356. package/src/components/tool.tsx +22 -16
  357. package/src/components/use-card-resolution.ts +24 -8
  358. package/src/components/voice-input.tsx +102 -19
  359. package/src/components/voice-output.tsx +202 -0
  360. package/src/elements/agent-card.tsx +67 -0
  361. package/src/elements/artifact.tsx +53 -4
  362. package/src/elements/attachments.tsx +1 -0
  363. package/src/elements/autoloader.ts +89 -0
  364. package/src/elements/avatar.tsx +33 -0
  365. package/src/elements/badge.tsx +32 -0
  366. package/src/elements/button.tsx +126 -0
  367. package/src/elements/card-media.jpg +0 -0
  368. package/src/elements/card.tsx +124 -31
  369. package/src/elements/cards.tsx +81 -7
  370. package/src/elements/chain-of-thought.tsx +77 -32
  371. package/src/elements/chat-scope-picker.tsx +35 -8
  372. package/src/elements/chat-types.ts +9 -2
  373. package/src/elements/chat-workspace.tsx +157 -43
  374. package/src/elements/chat.tsx +49 -25
  375. package/src/elements/choice.tsx +71 -19
  376. package/src/elements/coachmark.tsx +90 -0
  377. package/src/elements/command.tsx +209 -0
  378. package/src/elements/compare.tsx +110 -0
  379. package/src/elements/compiled.css +1 -1
  380. package/src/elements/composer.tsx +151 -0
  381. package/src/elements/confirm-card.tsx +36 -11
  382. package/src/elements/conversation-list.tsx +80 -11
  383. package/src/elements/default-input.tsx +75 -53
  384. package/src/elements/define.tsx +47 -6
  385. package/src/elements/dialog.tsx +98 -0
  386. package/src/elements/disclosure.ts +73 -0
  387. package/src/elements/editable-label.tsx +125 -0
  388. package/src/elements/element-manifest.json +310 -0
  389. package/src/elements/element-meta.json +5954 -1605
  390. package/src/elements/element-types.d.ts +771 -60
  391. package/src/elements/file-tree.tsx +12 -2
  392. package/src/elements/file-upload.tsx +1 -1
  393. package/src/elements/form.tsx +54 -11
  394. package/src/elements/hover-card.tsx +80 -0
  395. package/src/elements/icon-names.json +48 -0
  396. package/src/elements/icon.tsx +41 -0
  397. package/src/elements/input.tsx +203 -0
  398. package/src/elements/kbd.tsx +45 -0
  399. package/src/elements/menu.tsx +217 -0
  400. package/src/elements/message.tsx +84 -55
  401. package/src/elements/model-switcher.tsx +27 -1
  402. package/src/elements/nav.tsx +87 -0
  403. package/src/elements/notice.tsx +53 -0
  404. package/src/elements/pane-group.tsx +119 -0
  405. package/src/elements/pane.tsx +129 -0
  406. package/src/elements/popover.tsx +39 -17
  407. package/src/elements/progress-bar.tsx +39 -0
  408. package/src/elements/prompt-dock.tsx +81 -0
  409. package/src/elements/prompt-input.tsx +112 -63
  410. package/src/elements/prompt-suggestions.tsx +25 -9
  411. package/src/elements/reasoning.tsx +30 -9
  412. package/src/elements/register-impl.ts +41 -3
  413. package/src/elements/register.ts +20 -3
  414. package/src/elements/remote.tsx +4 -0
  415. package/src/elements/resizable.tsx +48 -11
  416. package/src/elements/screen.tsx +90 -0
  417. package/src/elements/scroll-area.tsx +33 -0
  418. package/src/elements/search.tsx +180 -0
  419. package/src/elements/segmented.tsx +135 -0
  420. package/src/elements/separator.tsx +36 -0
  421. package/src/elements/setting-item.tsx +50 -0
  422. package/src/elements/settings-group.tsx +37 -0
  423. package/src/elements/skeleton.tsx +45 -0
  424. package/src/elements/slots.ts +607 -0
  425. package/src/elements/source.tsx +13 -6
  426. package/src/elements/status.tsx +42 -0
  427. package/src/elements/styles.css +19 -0
  428. package/src/elements/switch.tsx +89 -14
  429. package/src/elements/tabs.tsx +95 -0
  430. package/src/elements/tasks.tsx +70 -14
  431. package/src/elements/toast.tsx +89 -0
  432. package/src/elements/tool.tsx +43 -9
  433. package/src/elements/tooltip.tsx +85 -0
  434. package/src/elements/video-poster.jpg +0 -0
  435. package/src/elements/voice-input.tsx +66 -16
  436. package/src/elements/voice-output.tsx +69 -0
  437. package/src/index.ts +35 -2
  438. package/src/primitives/card-contract.ts +14 -5
  439. package/src/primitives/card-recovery.ts +149 -0
  440. package/src/primitives/card-routing.ts +3 -0
  441. package/src/primitives/card-schemas/choice.schema.json +5 -0
  442. package/src/primitives/card-schemas/tasks.schema.json +7 -2
  443. package/src/primitives/composer-model.ts +49 -0
  444. package/src/primitives/composer-triggers.ts +35 -0
  445. package/src/primitives/create-kai-chat.ts +66 -0
  446. package/src/primitives/message-feedback.ts +123 -0
  447. package/src/primitives/toast-store.ts +276 -0
  448. package/src/primitives/use-speech-recognition.ts +135 -0
  449. package/src/state/index.ts +6 -0
  450. package/src/state/messages.ts +36 -0
  451. package/src/state/stream.ts +92 -0
  452. package/src/state/suggestions.ts +9 -0
  453. package/src/types.ts +4 -0
  454. package/src/ui/agent-card.tsx +212 -0
  455. package/src/ui/button.tsx +16 -5
  456. package/src/ui/card.tsx +245 -0
  457. package/src/ui/collapsible.tsx +30 -4
  458. package/src/ui/command.tsx +99 -0
  459. package/src/ui/dialog.tsx +217 -0
  460. package/src/ui/dropdown.tsx +375 -13
  461. package/src/ui/editable-label.tsx +112 -0
  462. package/src/ui/hover-card.tsx +28 -5
  463. package/src/ui/icon.tsx +110 -0
  464. package/src/ui/input.tsx +132 -0
  465. package/src/ui/kbd.tsx +118 -0
  466. package/src/ui/nav.tsx +282 -0
  467. package/src/ui/notice.tsx +84 -0
  468. package/src/ui/overlay.tsx +108 -2
  469. package/src/ui/pane-grid.tsx +116 -0
  470. package/src/ui/pane-group.tsx +280 -0
  471. package/src/ui/pane.tsx +193 -0
  472. package/src/ui/popover.tsx +16 -2
  473. package/src/ui/progress-bar.tsx +83 -0
  474. package/src/ui/prompt-dock.tsx +145 -0
  475. package/src/ui/resizable.tsx +69 -1
  476. package/src/ui/scroll-area.tsx +14 -3
  477. package/src/ui/segmented.tsx +109 -0
  478. package/src/ui/settings-group.tsx +67 -0
  479. package/src/ui/skeleton.tsx +62 -5
  480. package/src/ui/stat.tsx +41 -0
  481. package/src/ui/status.tsx +48 -0
  482. package/src/ui/switch.tsx +49 -23
  483. package/src/ui/tabs.tsx +168 -0
  484. package/src/ui/tooltip.tsx +57 -7
  485. package/theme.css +113 -0
  486. package/dist/components/slash-command.d.ts +0 -15
  487. package/dist/kitn-chat.es.js +0 -1
  488. package/dist/register-impl-wCsFPoh9.js +0 -77
  489. package/dist/register-ujhr1nBS.js +0 -1
  490. package/src/components/slash-command.tsx +0 -232
  491. package/src/elements/framework-usage.json +0 -563
  492. /package/dist/{kitn-chat-provider.d.ts → kai-provider.d.ts} +0 -0
  493. /package/dist/{kitn-chat-provider.es.js → kai-provider.es.js} +0 -0
@@ -0,0 +1,193 @@
1
+ import { type JSX, Show } from 'solid-js';
2
+ import { Maximize2, Minimize2, X, Columns2, PanelRight } from 'lucide-solid';
3
+ import { cn } from '../utils/cn';
4
+
5
+ /** The work state of the pane's agent/process. Drives a tone-colored status dot
6
+ * (and optional label) in the header. */
7
+ export type PaneStatusTone = 'working' | 'idle' | 'done' | 'error' | 'blocked';
8
+
9
+ export interface PaneStatus {
10
+ /** The tone — maps to a semantic status hue (see {@link PANE_STATUS_BG}). */
11
+ tone: PaneStatusTone;
12
+ /** Optional text beside the dot (e.g. "Running tests…"). Without it the dot is
13
+ * decorative and only the color carries meaning. */
14
+ label?: string;
15
+ /** Animate a ping ring on the dot — for the live `working` state. Respects
16
+ * prefers-reduced-motion. */
17
+ pulse?: boolean;
18
+ }
19
+
20
+ /** tone → status-dot color utility, backed by the kit's tool-* / muted tokens so
21
+ * it reads correctly in BOTH light and dark without hardcoded colors.
22
+ * - `working` → blue (in-flight)
23
+ * - `idle` → neutral muted (waiting)
24
+ * - `done` → green (complete)
25
+ * - `error` → red (failed)
26
+ * - `blocked` → amber (needs input / stalled) */
27
+ export const PANE_STATUS_BG: Record<PaneStatusTone, string> = {
28
+ working: 'bg-tool-blue',
29
+ idle: 'bg-muted-foreground',
30
+ done: 'bg-tool-green',
31
+ error: 'bg-tool-red',
32
+ blocked: 'bg-tool-amber',
33
+ };
34
+
35
+ export interface PaneProps {
36
+ /** A glyph/avatar shown before the title (an agent icon, a model avatar). */
37
+ leading?: JSX.Element;
38
+ /** The pane title — the agent / window name. */
39
+ title: string;
40
+ /** A role / label shown under the title (e.g. "Reviewer", "claude-sonnet"). */
41
+ subtitle?: string;
42
+ /** A tone-colored status dot (+ optional label) in the header. */
43
+ status?: PaneStatus;
44
+ /** Extra header controls, placed BEFORE the built-in window controls. */
45
+ actions?: JSX.Element;
46
+ /** The pane body — scrolls inside a `min-h-0 flex-1 overflow-y-auto` region. */
47
+ children?: JSX.Element;
48
+ /** A pinned row below the body (e.g. a composer). Stays put while the body scrolls. */
49
+ footer?: JSX.Element;
50
+ /** Highlight the frame with a ring/border to signal the ACTIVE pane. */
51
+ focused?: boolean;
52
+ /** Show the restore glyph (Minimize2) instead of maximize (Maximize2). */
53
+ maximized?: boolean;
54
+ /** Maximize/restore window control. */
55
+ onMaximize?: () => void;
56
+ /** Close window control. */
57
+ onClose?: () => void;
58
+ /** Optional split control — the button only renders when this is provided. */
59
+ onSplit?: () => void;
60
+ /** Optional dock-to-side control — the button only renders when this is provided. */
61
+ onDock?: () => void;
62
+ /** Extra classes for the outer frame. */
63
+ class?: string;
64
+ }
65
+
66
+ /** A header window-control: a square, muted icon button. */
67
+ function ControlButton(props: { label: string; onClick?: () => void; children: JSX.Element }) {
68
+ return (
69
+ <button
70
+ type="button"
71
+ aria-label={props.label}
72
+ onClick={() => props.onClick?.()}
73
+ class="flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-80 transition-colors hover:bg-hover hover:text-foreground hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
74
+ >
75
+ {props.children}
76
+ </button>
77
+ );
78
+ }
79
+
80
+ /**
81
+ * Pane — a reusable framed panel for a multi-agent workspace: a header (leading
82
+ * glyph + title/subtitle + status dot + actions + window controls), a scrolling
83
+ * body, and an optional pinned footer (e.g. a composer). It is the "pane frame"
84
+ * every agent tile otherwise re-hand-rolls.
85
+ *
86
+ * Layout: the outer frame is a column flexbox; the header and footer hold their
87
+ * height (`shrink-0`) while the body takes the rest (`min-h-0 flex-1
88
+ * overflow-y-auto`) so content scrolls INSIDE the pane. Give the pane a bounded
89
+ * height (a fixed parent, or `h-full` inside a grid/flex track) for the scroll to
90
+ * engage; the body imposes no padding so content controls its own.
91
+ *
92
+ * Window controls (right side of the header): maximize/restore (Maximize2 ↔
93
+ * Minimize2, toggled by `maximized`) and close (X) are always present; split
94
+ * (Columns2) and dock (PanelRight) only render when `onSplit` / `onDock` are
95
+ * passed. Each fires its callback prop.
96
+ *
97
+ * States: `focused` paints a ring + accent border to mark the active pane;
98
+ * `maximized` swaps the maximize glyph for restore.
99
+ *
100
+ * Colors come entirely from design tokens (surface / border / ring / tool-*),
101
+ * so it reads correctly in light and dark with no hardcoded values. The header,
102
+ * body, footer, and window-control cluster are exposed via
103
+ * `::part(header|body|footer|controls)` for the `kai-pane` facade.
104
+ */
105
+ export function Pane(props: PaneProps) {
106
+ return (
107
+ <div
108
+ data-pane
109
+ class={cn(
110
+ 'flex h-full min-h-0 flex-col overflow-hidden rounded-xl border bg-surface',
111
+ props.focused ? 'border-ring ring-2 ring-inset ring-ring/35' : 'border-border',
112
+ props.class,
113
+ )}
114
+ >
115
+ <div
116
+ part="header"
117
+ class="flex shrink-0 items-center gap-2.5 border-b border-border px-3 py-2"
118
+ >
119
+ <Show when={props.leading}>
120
+ <span class="flex shrink-0 items-center text-muted-foreground">{props.leading}</span>
121
+ </Show>
122
+ <div class="flex min-w-0 flex-col">
123
+ <span class="truncate text-sm font-medium leading-tight text-foreground">{props.title}</span>
124
+ <Show when={props.subtitle}>
125
+ <span class="truncate text-xs leading-tight text-muted-foreground">{props.subtitle}</span>
126
+ </Show>
127
+ </div>
128
+ <Show when={props.status}>
129
+ {(status) => (
130
+ <span
131
+ class="flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground"
132
+ role={status().label ? 'status' : undefined}
133
+ aria-label={status().label}
134
+ >
135
+ <span class="relative flex size-2">
136
+ <Show when={status().pulse}>
137
+ <span
138
+ aria-hidden="true"
139
+ class={cn(
140
+ 'absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 motion-reduce:hidden',
141
+ PANE_STATUS_BG[status().tone],
142
+ )}
143
+ />
144
+ </Show>
145
+ <span
146
+ aria-hidden="true"
147
+ class={cn('relative inline-flex size-2 rounded-full', PANE_STATUS_BG[status().tone])}
148
+ />
149
+ </span>
150
+ <Show when={status().label}>
151
+ <span class="truncate">{status().label}</span>
152
+ </Show>
153
+ </span>
154
+ )}
155
+ </Show>
156
+ <div part="controls" class="ml-auto flex shrink-0 items-center gap-0.5">
157
+ {props.actions}
158
+ <Show when={props.onSplit}>
159
+ <ControlButton label="Split pane" onClick={props.onSplit}>
160
+ <Columns2 class="size-4" aria-hidden="true" />
161
+ </ControlButton>
162
+ </Show>
163
+ <Show when={props.onDock}>
164
+ <ControlButton label="Dock pane" onClick={props.onDock}>
165
+ <PanelRight class="size-4" aria-hidden="true" />
166
+ </ControlButton>
167
+ </Show>
168
+ <ControlButton
169
+ label={props.maximized ? 'Restore pane' : 'Maximize pane'}
170
+ onClick={props.onMaximize}
171
+ >
172
+ <Show when={props.maximized} fallback={<Maximize2 class="size-4" aria-hidden="true" />}>
173
+ <Minimize2 class="size-4" aria-hidden="true" />
174
+ </Show>
175
+ </ControlButton>
176
+ <ControlButton label="Close pane" onClick={props.onClose}>
177
+ <X class="size-4" aria-hidden="true" />
178
+ </ControlButton>
179
+ </div>
180
+ </div>
181
+
182
+ <div part="body" class="min-h-0 flex-1 overflow-y-auto">
183
+ {props.children}
184
+ </div>
185
+
186
+ <Show when={props.footer}>
187
+ <div part="footer" class="shrink-0 border-t border-border">
188
+ {props.footer}
189
+ </div>
190
+ </Show>
191
+ </div>
192
+ );
193
+ }
@@ -1,8 +1,12 @@
1
- import { createSignal, Show, type JSX } from 'solid-js';
1
+ import { createSignal, Show, type JSX, type Accessor } from 'solid-js';
2
2
  import type { Placement } from '@floating-ui/dom';
3
3
  import { cn } from '../utils/cn';
4
4
  import { createPresence, usePosition, useDismiss } from './overlay';
5
5
 
6
+ /** Imperative open controller, handed to a parent (e.g. the kai-popover facade)
7
+ * via `controllerRef` so it can drive/observe open state. */
8
+ export interface PopoverController { open: Accessor<boolean>; setOpen: (v: boolean) => void; }
9
+
6
10
  export interface PopoverProps {
7
11
  /** The trigger content (e.g. a button). Clicking it toggles the popover. */
8
12
  trigger: JSX.Element;
@@ -17,8 +21,12 @@ export interface PopoverProps {
17
21
  open?: boolean;
18
22
  /** Initial open state when uncontrolled. */
19
23
  defaultOpen?: boolean;
24
+ /** When true, clicking the trigger never opens the popover. */
25
+ disabled?: boolean;
20
26
  /** Fires whenever the popover wants to open or close. */
21
27
  onOpenChange?: (open: boolean) => void;
28
+ /** Receive the open controller (open accessor + setOpen) once mounted. */
29
+ controllerRef?: (api: PopoverController) => void;
22
30
  /** Extra elements counted as "inside" for outside-click dismissal — e.g. the
23
31
  * custom-element host, so clicks on slotted panel content don't dismiss. */
24
32
  boundary?: () => HTMLElement | undefined;
@@ -45,10 +53,16 @@ export function Popover(props: PopoverProps) {
45
53
  props.onOpenChange?.(v);
46
54
  };
47
55
 
56
+ // Hand the open controller up to a parent (e.g. the kai-popover facade) so it
57
+ // can drive/observe open state via wireDisclosure.
58
+ props.controllerRef?.({ open: isOpen, setOpen });
59
+
48
60
  const presence = createPresence(isOpen);
49
61
  const position = usePosition(trigger, panel, {
50
62
  placement: props.placement ?? 'bottom-start',
51
63
  gutter: props.gutter ?? 6,
64
+ // Trigger removed from the DOM -> close so the panel portal doesn't orphan.
65
+ onDisconnect: () => setOpen(false),
52
66
  });
53
67
  useDismiss({
54
68
  enabled: isOpen,
@@ -61,7 +75,7 @@ export function Popover(props: PopoverProps) {
61
75
  <span
62
76
  ref={setTrigger}
63
77
  style={{ display: 'inline-flex' }}
64
- onClick={() => setOpen(!isOpen())}
78
+ onClick={() => { if (!props.disabled) setOpen(!isOpen()); }}
65
79
  >
66
80
  {props.trigger}
67
81
  </span>
@@ -0,0 +1,83 @@
1
+ import { type JSX, Show, splitProps, createUniqueId } from 'solid-js';
2
+ import { cn } from '../utils/cn';
3
+
4
+ export type ProgressTone = 'primary' | 'success' | 'warning' | 'error' | 'info';
5
+
6
+ /** Fill hue per `tone`. `primary` is the theme accent; the rest use the kit's
7
+ * tool hues (the same colors as kai-status / kai-notice). */
8
+ export const TONE_FILL: Record<ProgressTone, string> = {
9
+ primary: 'bg-primary',
10
+ success: 'bg-tool-green',
11
+ warning: 'bg-tool-amber',
12
+ error: 'bg-tool-red',
13
+ info: 'bg-tool-blue',
14
+ };
15
+
16
+ export interface ProgressBarProps extends JSX.HTMLAttributes<HTMLDivElement> {
17
+ /** Current progress value (0..max). */
18
+ value: number;
19
+ /** The value `value` runs to. Defaults to 100. */
20
+ max?: number;
21
+ /** Optional caption above the track. */
22
+ label?: string;
23
+ /** Fill color. Defaults to `primary`. Override via `::part(fill)` for custom hues. */
24
+ tone?: ProgressTone;
25
+ }
26
+
27
+ /**
28
+ * A thin determinate progress bar: a rounded track with a `bg-primary` fill whose
29
+ * width is `value / max`, clamped to 0..100%. Theme-aware (track = `bg-surface-strong`,
30
+ * fill = `bg-primary`). Set `tone` for a semantic fill hue. Restyle via
31
+ * `::part(track)` / `::part(fill)`. The fill width transitions smoothly under
32
+ * `prefers-reduced-motion: no-preference`.
33
+ */
34
+ export function ProgressBar(props: ProgressBarProps) {
35
+ const [local, rest] = splitProps(props, [
36
+ 'value', 'max', 'label', 'tone', 'class', 'aria-label', 'aria-labelledby',
37
+ ]);
38
+ const labelId = createUniqueId();
39
+ const max = () => local.max ?? 100;
40
+ // Clamp value into [0, max]; drive both the fill width and aria-valuenow off it
41
+ // so the bar and the announced value stay consistent.
42
+ const clamped = () => {
43
+ const m = max();
44
+ if (!(m > 0)) return 0;
45
+ return Math.max(0, Math.min(local.value, m));
46
+ };
47
+ const percent = () => {
48
+ const m = max();
49
+ return m > 0 ? (clamped() / m) * 100 : 0;
50
+ };
51
+ // The progressbar must always carry an accessible name. Prefer the rendered
52
+ // visible label; else a caller-supplied aria-labelledby/aria-label; else a
53
+ // generic default so the bar is never nameless (axe `aria-progressbar-name`).
54
+ const labelledBy = () => (local.label ? labelId : local['aria-labelledby']);
55
+ const ariaLabel = () =>
56
+ local.label || local['aria-labelledby'] ? undefined : local['aria-label'] ?? 'Progress';
57
+ return (
58
+ <div class={cn('flex flex-col gap-1', local.class)} {...rest}>
59
+ <Show when={local.label}>
60
+ <span id={labelId} class="text-xs text-muted-foreground">{local.label}</span>
61
+ </Show>
62
+ <div
63
+ part="track"
64
+ role="progressbar"
65
+ aria-valuenow={clamped()}
66
+ aria-valuemin={0}
67
+ aria-valuemax={max()}
68
+ aria-labelledby={labelledBy()}
69
+ aria-label={ariaLabel()}
70
+ class="h-1.5 w-full overflow-hidden rounded-full bg-surface-strong"
71
+ >
72
+ <div
73
+ part="fill"
74
+ class={cn(
75
+ 'h-full rounded-full motion-safe:transition-[width] motion-safe:duration-500 motion-safe:ease-out',
76
+ TONE_FILL[local.tone ?? 'primary'],
77
+ )}
78
+ style={{ width: `${percent()}%` }}
79
+ />
80
+ </div>
81
+ </div>
82
+ );
83
+ }
@@ -0,0 +1,145 @@
1
+ import { type JSX, Show } from 'solid-js';
2
+ import { cn } from '../utils/cn';
3
+
4
+ /** How the tray frames the input — the SPATIAL axis (padding/inset only).
5
+ * Orthogonal to {@link PromptDockAppearance}, which controls the surface.
6
+ * - `inset` (default) — uniform inset frames the input on ALL edges (the classic look).
7
+ * - `edge` — top/bottom inset only; the input sits FLUSH left/right so the lips span
8
+ * the full width.
9
+ * - `none` — no inset at all; the lips attach directly to the input as a plain stack. */
10
+ export type PromptDockFrame = 'inset' | 'edge' | 'none';
11
+
12
+ /** How the tray surface looks — the VISUAL axis (background / border / radius only).
13
+ * Orthogonal to {@link PromptDockFrame}, which controls the spatial inset. Works like
14
+ * a button variant.
15
+ * - `soft` (default) — sunken surface + border + radius (the classic look).
16
+ * - `outlined` — transparent surface + border + radius.
17
+ * - `filled` — sunken surface, no border, + radius.
18
+ * - `plain` — transparent surface, no border, no radius (truly bare). */
19
+ export type PromptDockAppearance = 'soft' | 'outlined' | 'filled' | 'plain';
20
+
21
+ export interface PromptDockProps {
22
+ /** Optional content for the recessed band ABOVE the input (a notice, a hint).
23
+ * When omitted, no top lip renders and only the input shows. */
24
+ top?: JSX.Element;
25
+ /** Optional content for the recessed band BELOW the input (a mode / control row).
26
+ * When omitted, no bottom lip renders. */
27
+ bottom?: JSX.Element;
28
+ /** Extra classes for the TOP lip wrapper, merged over the default band styling.
29
+ * Use this to give the top region its own surface (e.g. a tinted notice) without
30
+ * affecting the bottom. The eventual `kai-prompt-dock` element will expose the
31
+ * same region via `::part(top)`. */
32
+ topClass?: string;
33
+ /** Extra classes for the BOTTOM lip wrapper, merged over the default band styling.
34
+ * The eventual `kai-prompt-dock` element will expose this region via
35
+ * `::part(bottom)`. */
36
+ bottomClass?: string;
37
+ /** How the tray frames the input — the SPATIAL inset only. Defaults to `'inset'`
38
+ * (the classic recessed look), so existing consumers are unaffected.
39
+ * See {@link PromptDockFrame}. */
40
+ frame?: PromptDockFrame;
41
+ /** How the tray surface looks — the VISUAL axis (background / border / radius),
42
+ * orthogonal to `frame`. Defaults to `'soft'` (the classic look), so existing
43
+ * consumers are unaffected. See {@link PromptDockAppearance}. */
44
+ appearance?: PromptDockAppearance;
45
+ /** The prompt input - the raised card that floats on the tray. */
46
+ children: JSX.Element;
47
+ /** Extra classes for the outer tray. */
48
+ class?: string;
49
+ }
50
+
51
+ /** Shared base styling for a lip region; per-region classes append/override it. */
52
+ const LIP_BASE = 'px-3 py-2 text-sm leading-snug text-muted-foreground';
53
+
54
+ /**
55
+ * PromptDock - a recessed tray that frames a prompt input and can extend with
56
+ * optional "lip" regions above and/or below it.
57
+ *
58
+ * The model: the input stays the prominent, fully-rounded RAISED card; the lips
59
+ * sit in a slightly darker, RECESSED band tucked above and/or below it, sharing
60
+ * the tray's outer rounding so the whole thing reads as one cohesive control.
61
+ * When nothing is slotted top or bottom, only the input shows: no visible lip.
62
+ *
63
+ * Styling splits into two ORTHOGONAL axes so the spatial framing and the surface
64
+ * can be set independently (like a button's size vs. its variant):
65
+ *
66
+ * `frame` - the SPATIAL inset (padding only):
67
+ * - `inset` (default) - a small, uniform inset frames the input on EVERY side
68
+ * (the tray padding plus the flex gap give a ~6px frame). The classic look.
69
+ * - `edge` - top/bottom inset only; the input is FLUSH on the left / right so the
70
+ * lips span the full width. Matches the Claude Code / Codex references, where the
71
+ * lip is a top/bottom phenomenon.
72
+ * - `none` - no inset at all; the lips attach directly to the input as a plain
73
+ * vertical stack. The lips keep their own internal padding so content still has
74
+ * breathing room.
75
+ *
76
+ * `appearance` - the SURFACE (background / border / radius):
77
+ * - `soft` (default) - sunken surface + border + radius (the classic look).
78
+ * - `outlined` - transparent surface + border + radius.
79
+ * - `filled` - sunken surface, no border, + radius.
80
+ * - `plain` - transparent surface, no border, no radius (truly bare).
81
+ *
82
+ * The two are independent: e.g. `frame="none" appearance="plain"` is a bare stack,
83
+ * while `frame="inset" appearance="outlined"` keeps the inset but drops the fill.
84
+ *
85
+ * Surface, border, radius and inset come from four CSS custom-property TOKENS, so
86
+ * a consumer can fine-tune the chrome without touching internals (override the var
87
+ * from outside; the variant chooses the structure). Each is referenced with a
88
+ * fallback so it resolves stand-alone:
89
+ * - `--kai-prompt-dock-surface` - tray background (default `var(--color-surface-sunken)`)
90
+ * - `--kai-prompt-dock-border` - tray border color (default `var(--color-border)`)
91
+ * - `--kai-prompt-dock-radius` - outer radius (default `1.25rem`)
92
+ * - `--kai-prompt-dock-inset` - frame thickness around the input (default `0.375rem`)
93
+ *
94
+ * Colors default to the surface tokens (surface-sunken for the tray and lips; the
95
+ * input brings its own raised bg-surface), so it reads correctly in both light and
96
+ * dark themes without hardcoded colors. The top and bottom lips are independently
97
+ * styleable via `topClass` / `bottomClass` (e.g. a tinted notice up top over a
98
+ * neutral control row below).
99
+ *
100
+ * The eventual `kai-prompt-dock` element will expose the same three regions via
101
+ * `::part(tray)` / `::part(top)` / `::part(bottom)`; the primitive's equivalent
102
+ * hooks are the `class` / `topClass` / `bottomClass` props.
103
+ */
104
+ export function PromptDock(props: PromptDockProps) {
105
+ const frame = (): PromptDockFrame => props.frame ?? 'inset';
106
+ const appearance = (): PromptDockAppearance => props.appearance ?? 'soft';
107
+ // `appearance` drives the surface (background / border / radius); `frame` drives the
108
+ // inset (padding). The two axes are independent.
109
+ const filled = () => appearance() === 'soft' || appearance() === 'filled';
110
+ const bordered = () => appearance() === 'soft' || appearance() === 'outlined';
111
+ return (
112
+ <div
113
+ data-prompt-dock
114
+ part="tray"
115
+ // Surface / border / radius / inset live in the tokenized inline style so the
116
+ // var fallbacks resolve and external overrides win; only the structural
117
+ // flex + gap stay in classes.
118
+ class={cn('flex flex-col gap-1.5', props.class)}
119
+ style={{
120
+ background: filled()
121
+ ? 'var(--kai-prompt-dock-surface, var(--color-surface-sunken))'
122
+ : 'transparent',
123
+ border: bordered()
124
+ ? '1px solid var(--kai-prompt-dock-border, var(--color-border))'
125
+ : '0',
126
+ 'border-radius':
127
+ appearance() === 'plain' ? '0' : 'var(--kai-prompt-dock-radius, 1.25rem)',
128
+ padding:
129
+ frame() === 'none'
130
+ ? '0'
131
+ : frame() === 'edge'
132
+ ? 'var(--kai-prompt-dock-inset, 0.375rem) 0'
133
+ : 'var(--kai-prompt-dock-inset, 0.375rem)',
134
+ }}
135
+ >
136
+ <Show when={props.top}>
137
+ <div part="top" class={cn(LIP_BASE, props.topClass)}>{props.top}</div>
138
+ </Show>
139
+ {props.children}
140
+ <Show when={props.bottom}>
141
+ <div part="bottom" class={cn(LIP_BASE, props.bottomClass)}>{props.bottom}</div>
142
+ </Show>
143
+ </div>
144
+ );
145
+ }
@@ -53,6 +53,51 @@ export function resolveToPx(value: SizeValue | undefined, containerPx: number):
53
53
  return Number.isFinite(n) ? (n / 100) * containerPx : undefined;
54
54
  }
55
55
 
56
+ /** Parse a CSS length we can statically clamp (`px` or `%` only). */
57
+ function parseStaticLen(v: string): { n: number; unit: 'px' | '%' } | null {
58
+ const m = /^\s*(-?\d*\.?\d+)(px|%)\s*$/.exec(v);
59
+ return m ? { n: parseFloat(m[1]), unit: m[2] as 'px' | '%' } : null;
60
+ }
61
+
62
+ /**
63
+ * Build a panel's INITIAL `flex-basis`, clamped into its `[min, max]` bounds so
64
+ * it never PAINTS past its max (or below its min). The drag handler already
65
+ * clamps, but only once a drag begins — without this, a percentage default on a
66
+ * wide container (e.g. `40%` against a `480px` max) renders wider than max and
67
+ * then SNAPS to max on the first resize. Uses CSS `clamp()`/`min()`/`max()` so
68
+ * the bound is enforced at layout time against the live container size, with
69
+ * MIXED units (a `%` default vs a `px` max) resolving correctly — no JS measure.
70
+ * `basis`/`min`/`max` are already-normalized CSS lengths (see `normalizeSize`);
71
+ * an undefined `basis` stays undefined → the caller falls back to flexible.
72
+ */
73
+ export function clampBasis(
74
+ basis: string | undefined,
75
+ min: string | undefined,
76
+ max: string | undefined,
77
+ ): string | undefined {
78
+ if (basis === undefined) return undefined;
79
+ // Static fast-path: when the basis and every present bound share ONE unit
80
+ // (all px or all %), the clamp is computable at author time, so emit a bare
81
+ // value. This avoids a needless clamp()/min()/max() wrapper (and keeps jsdom
82
+ // from reducing an all-px clamp() to calc()). MIXED units (e.g. a `%` basis
83
+ // against a `px` max) can only resolve against the live container, so they
84
+ // keep the CSS function and clamp at layout time.
85
+ const b = parseStaticLen(basis);
86
+ const lo = min === undefined ? undefined : parseStaticLen(min);
87
+ const hi = max === undefined ? undefined : parseStaticLen(max);
88
+ if (b && (min === undefined || lo?.unit === b.unit) && (max === undefined || hi?.unit === b.unit)) {
89
+ // CSS clamp(MIN, VAL, MAX) === max(MIN, min(VAL, MAX)).
90
+ let n = b.n;
91
+ if (hi) n = Math.min(n, hi.n);
92
+ if (lo) n = Math.max(n, lo.n);
93
+ return `${n}${b.unit}`;
94
+ }
95
+ if (min !== undefined && max !== undefined) return `clamp(${min}, ${basis}, ${max})`;
96
+ if (max !== undefined) return `min(${basis}, ${max})`;
97
+ if (min !== undefined) return `max(${min}, ${basis})`;
98
+ return basis;
99
+ }
100
+
56
101
  // --- ResizablePanelGroup ---
57
102
 
58
103
  export interface ResizablePanelGroupProps extends JSX.HTMLAttributes<HTMLDivElement> {
@@ -112,8 +157,31 @@ function ResizablePanel(props: ResizablePanelProps) {
112
157
  // main axis to content size — the bug this replaces.) Mirrors the
113
158
  // `<kai-resizable>` web-component panel and the Shoelace/Web Awesome grid layout.
114
159
  // min:0 on BOTH axes enables shrink-to-scroll; overflow hidden.
160
+ // Effective min/max as CSS lengths, sourced from the typed `minSize`/`maxSize`
161
+ // props OR — when absent — from the `data-min-size`/`-pct` (and `-max-`)
162
+ // attributes a consumer may pass directly. The `kai-workspace` rail does the
163
+ // latter (`<ResizablePanel data-min-size="240" data-max-size="420">`). A bare
164
+ // `data-*-size` is pixels, `data-*-size-pct` is percent — the same convention
165
+ // the handle reads at drag time, so the initial clamp matches the drag clamp.
166
+ const effectiveBound = (
167
+ localVal: SizeValue | undefined,
168
+ pxAttr: unknown,
169
+ pctAttr: unknown,
170
+ ): string | undefined => {
171
+ const fromProp = normalizeSize(localVal);
172
+ if (fromProp !== undefined) return fromProp;
173
+ const px = pxAttr == null ? '' : String(pxAttr).trim();
174
+ if (px !== '') { const n = parseFloat(px); if (Number.isFinite(n)) return `${n}px`; }
175
+ const pct = pctAttr == null ? '' : String(pctAttr).trim();
176
+ if (pct !== '') { const n = parseFloat(pct); if (Number.isFinite(n)) return `${n}%`; }
177
+ return undefined;
178
+ };
179
+
115
180
  const sizeStyle = (): Record<string, string> => {
116
- const basis = normalizeSize(local.defaultSize);
181
+ const r = rest as Record<string, unknown>;
182
+ const minB = effectiveBound(local.minSize, r['data-min-size'], r['data-min-size-pct']);
183
+ const maxB = effectiveBound(local.maxSize, r['data-max-size'], r['data-max-size-pct']);
184
+ const basis = clampBasis(normalizeSize(local.defaultSize), minB, maxB);
117
185
  const base: Record<string, string> = basis !== undefined
118
186
  ? { 'flex-basis': basis, 'flex-grow': '0', 'flex-shrink': '0' }
119
187
  : { flex: '1 1 0%' };
@@ -1,14 +1,25 @@
1
1
  import { type JSX, splitProps } from 'solid-js';
2
2
  import { cn } from '../utils/cn';
3
3
 
4
- export interface ScrollAreaProps extends JSX.HTMLAttributes<HTMLDivElement> { children: JSX.Element; }
4
+ export type ScrollOrientation = 'vertical' | 'horizontal' | 'both';
5
+
6
+ export interface ScrollAreaProps extends JSX.HTMLAttributes<HTMLDivElement> {
7
+ children: JSX.Element;
8
+ /** Which axis scrolls. `vertical` (default) · `horizontal` · `both`. The cross
9
+ * axis is clamped to `hidden` so content can't overflow it. */
10
+ orientation?: ScrollOrientation;
11
+ }
5
12
 
6
13
  export function ScrollArea(props: ScrollAreaProps) {
7
- const [local, rest] = splitProps(props, ['children', 'class']);
14
+ const [local, rest] = splitProps(props, ['children', 'class', 'orientation']);
15
+ const overflow = () =>
16
+ local.orientation === 'horizontal' ? 'overflow-x-auto overflow-y-hidden'
17
+ : local.orientation === 'both' ? 'overflow-auto'
18
+ : 'overflow-y-auto overflow-x-hidden';
8
19
  return (
9
20
  // tabindex=0 keeps the scroll region reachable by keyboard when it has no
10
21
  // focusable descendants (WCAG 2.1.1 — axe `scrollable-region-focusable`).
11
- <div tabindex={0} class={cn('overflow-y-auto scrollbar-thin', local.class)} {...rest}>
22
+ <div tabindex={0} class={cn(overflow(), 'scrollbar-thin', local.class)} {...rest}>
12
23
  {local.children}
13
24
  </div>
14
25
  );