@kitn.ai/ui 0.26.0 → 0.28.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 (488) hide show
  1. package/README.md +25 -6
  2. package/bin/mcp.js +16 -3
  3. package/bin/route.js +23 -0
  4. package/bin/route.test.js +58 -0
  5. package/dist/{elements/chunks/Icon--Y8vsFal.js → Icon-DObhsRtm.js} +1 -1
  6. package/dist/action-icons-CcgNN2oT.js +1 -0
  7. package/dist/arrow-down-CjRU3JgV.js +1 -0
  8. package/dist/arrow-left-Bnpb1UEW.js +1 -0
  9. package/dist/artifact-Bwt7OgcR.js +1 -0
  10. package/dist/assets/dev-5XzXYR21.js +91 -0
  11. package/dist/attachments-Qr4kg-2b.js +1 -0
  12. package/dist/{elements/chunks/audio-visualizer-D7lB6mvR.js → audio-visualizer-DToYdfSc.js} +1 -1
  13. package/dist/badge-CdEu_jn2.js +1 -0
  14. package/dist/bash-InADTalH.js +1 -6
  15. package/dist/bell-DQAAOpDz.js +1 -0
  16. package/dist/{elements/chunks/button-flUbeufF.js → button-DkuOnGLy.js} +1 -1
  17. package/dist/card-renderer-Jx70m6_l.js +1 -0
  18. package/dist/card-routing-0YidER_3.js +1 -0
  19. package/dist/check-njkVdZu2.js +1 -0
  20. package/dist/checkbox-D7iRB3nL.js +1 -0
  21. package/dist/checkbox-group-B2_rpoPM.js +1 -0
  22. package/dist/chevron-down-B72s6PXR.js +1 -0
  23. package/dist/chevron-right-BatuHzUm.js +1 -0
  24. package/dist/choice-card-m0BYqqOK.js +1 -0
  25. package/dist/circle-check-B62pODB3.js +1 -0
  26. package/dist/circle-x-BPG0iPst.js +1 -0
  27. package/dist/circle-zx0ByzY9.js +1 -0
  28. package/dist/{elements/chunks/cn-CU7UAWzk.js → cn-DN5AWfiS.js} +1 -1
  29. package/dist/code-block-ClMLKb7C.js +1 -0
  30. package/dist/{elements/chunks/collapsible-BzbXpPzr.js → collapsible-B4DlWicL.js} +1 -1
  31. package/dist/components/attachment-types.d.ts +7 -0
  32. package/dist/components/audio-visualizer/fit-scale.d.ts +1 -1
  33. package/dist/components/card-renderer.d.ts +13 -0
  34. package/dist/components/card.d.ts +4 -0
  35. package/dist/components/chat-thread.d.ts +135 -2
  36. package/dist/components/conversation-item.d.ts +35 -7
  37. package/dist/components/conversation-list.d.ts +17 -5
  38. package/dist/components/conversation-panel.d.ts +29 -0
  39. package/dist/components/form-widgets.d.ts +67 -2
  40. package/dist/components/form.d.ts +48 -1
  41. package/dist/components/home-panel.d.ts +34 -0
  42. package/dist/components/message.d.ts +25 -3
  43. package/dist/components/reasoning.d.ts +6 -0
  44. package/dist/components/scroll-button.d.ts +11 -0
  45. package/dist/components/thread.d.ts +5 -0
  46. package/dist/components/tool-types.d.ts +9 -0
  47. package/dist/components/widget-tab-bar.d.ts +16 -0
  48. package/dist/composer-sQ0HcvyG.js +106 -0
  49. package/dist/confirm-card-rQWDQsnC.js +1 -0
  50. package/dist/construct-cli.es.js +1337 -0
  51. package/dist/{elements/chunks/context-VLIL3sJ-.js → context-0kg4ZX1J.js} +1 -1
  52. package/dist/controllable-CnGpMF6r.js +1 -0
  53. package/dist/conversation-item-BxwQLaFJ.js +1 -0
  54. package/dist/conversation-list-BCfGN1JU.js +1 -0
  55. package/dist/copy-n9u9rqpi.js +1 -0
  56. package/dist/core-AYMC6_lb.js +12 -5874
  57. package/dist/{create-tween-BFT6c-Y8.js → create-tween-C-q-JCM-.js} +1 -1
  58. package/dist/{create-tween-CJNlzoaO.js → create-tween-CRrJXxBd.js} +1 -1
  59. package/dist/{create-tween-CQED4T0g.js → create-tween-DZ3RRDHD.js} +1 -1
  60. package/dist/{elements/chunks/create-tween-c4Z8TDYz.js → create-tween-uPkArjIG.js} +2 -2
  61. package/dist/css-M7EaDHN_.js +1 -6
  62. package/dist/custom-elements.json +1433 -202
  63. package/dist/default-input-CaMrJkgH.js +1 -0
  64. package/dist/define-By-uL588.js +1 -0
  65. package/dist/define.d.ts +4 -0
  66. package/dist/define.js +510 -0
  67. package/dist/define.server.d.ts +5 -0
  68. package/dist/define.server.js +506 -0
  69. package/dist/{elements/chunks/disclosure-CcNbyLy0.js → disclosure-WUImBbDv.js} +1 -1
  70. package/dist/{elements/chunks/dropdown-BgWTthUx.js → dropdown-wZVeJOMd.js} +1 -1
  71. package/dist/elements/agent-card.js +1 -1
  72. package/dist/elements/artifact.js +1 -1
  73. package/dist/elements/attachments.js +1 -1
  74. package/dist/elements/audio-visualizer.js +1 -1
  75. package/dist/elements/autoloader.js +1 -1
  76. package/dist/elements/avatar.js +1 -1
  77. package/dist/elements/badge.js +1 -1
  78. package/dist/elements/button.js +1 -1
  79. package/dist/elements/card.js +1 -1
  80. package/dist/elements/cards.js +1 -1
  81. package/dist/elements/chain-of-thought.js +1 -1
  82. package/dist/elements/chat-scope-picker.js +1 -1
  83. package/dist/elements/chat-workspace.js +1 -1
  84. package/dist/elements/chat.js +1 -1
  85. package/dist/elements/checkbox-group.d.ts +1 -0
  86. package/dist/elements/checkbox-group.js +1 -0
  87. package/dist/elements/checkbox.d.ts +1 -0
  88. package/dist/elements/checkbox.js +1 -0
  89. package/dist/elements/checkpoint.js +1 -1
  90. package/dist/elements/choice.js +1 -1
  91. package/dist/elements/coachmark.js +1 -1
  92. package/dist/elements/code-block.js +1 -1
  93. package/dist/elements/command.js +1 -1
  94. package/dist/elements/compare.js +1 -1
  95. package/dist/elements/composer.js +1 -1
  96. package/dist/elements/confirm-card.js +1 -1
  97. package/dist/elements/context-meter.js +1 -1
  98. package/dist/elements/conversation-item.js +1 -1
  99. package/dist/elements/conversation-list.js +1 -1
  100. package/dist/elements/define-entry.d.ts +12 -0
  101. package/dist/elements/dialog.js +1 -1
  102. package/dist/elements/dock.js +102 -8
  103. package/dist/elements/dropdown.js +1 -1
  104. package/dist/elements/editable-label.js +1 -1
  105. package/dist/elements/element-data-types.d.ts +37 -0
  106. package/dist/elements/embed.js +1 -1
  107. package/dist/elements/empty.js +1 -1
  108. package/dist/elements/feedback-bar.js +1 -1
  109. package/dist/elements/file-tree.js +1 -1
  110. package/dist/elements/file-upload.js +1 -1
  111. package/dist/elements/form.js +1 -1
  112. package/dist/elements/hover-card.js +1 -1
  113. package/dist/elements/icon.js +1 -1
  114. package/dist/elements/image.js +1 -1
  115. package/dist/elements/input.js +1 -1
  116. package/dist/elements/kbd.js +1 -1
  117. package/dist/elements/link-preview.js +1 -1
  118. package/dist/elements/loader.js +1 -1
  119. package/dist/elements/markdown.js +1 -1
  120. package/dist/elements/menu.js +1 -1
  121. package/dist/elements/message-skills.js +1 -1
  122. package/dist/elements/message.js +1 -1
  123. package/dist/elements/model-switcher.js +1 -1
  124. package/dist/elements/nav.js +1 -1
  125. package/dist/elements/notice.js +1 -1
  126. package/dist/elements/pane-grid.d.ts +1 -0
  127. package/dist/elements/pane-grid.js +1 -0
  128. package/dist/elements/pane-group.js +1 -1
  129. package/dist/elements/pane.js +1 -1
  130. package/dist/elements/popover.js +1 -1
  131. package/dist/elements/progress-bar.js +1 -1
  132. package/dist/elements/prompt-dock.js +1 -1
  133. package/dist/elements/prompt-input.js +1 -1
  134. package/dist/elements/prompt-suggestions.js +1 -1
  135. package/dist/elements/radio-group.d.ts +1 -0
  136. package/dist/elements/radio-group.js +1 -0
  137. package/dist/elements/reasoning.js +1 -1
  138. package/dist/elements/remote.js +1 -1
  139. package/dist/elements/resizable.js +1 -1
  140. package/dist/elements/response-stream.js +2 -2
  141. package/dist/elements/screen.js +1 -1
  142. package/dist/elements/scroll-area.js +1 -1
  143. package/dist/elements/scroll-button.js +1 -1
  144. package/dist/elements/search.js +1 -1
  145. package/dist/elements/segmented.js +1 -1
  146. package/dist/elements/select.d.ts +1 -0
  147. package/dist/elements/select.js +1 -0
  148. package/dist/elements/separator.js +1 -1
  149. package/dist/elements/setting-item.js +1 -1
  150. package/dist/elements/settings-group.js +1 -1
  151. package/dist/elements/skeleton.js +1 -1
  152. package/dist/elements/slider.d.ts +1 -0
  153. package/dist/elements/slider.js +1 -0
  154. package/dist/elements/slots.d.ts +1 -1
  155. package/dist/elements/source.js +1 -1
  156. package/dist/elements/status.js +1 -1
  157. package/dist/elements/switch.js +1 -1
  158. package/dist/elements/tabs.js +1 -1
  159. package/dist/elements/tasks.js +1 -1
  160. package/dist/elements/text-shimmer.js +1 -1
  161. package/dist/elements/thinking-bar.js +1 -1
  162. package/dist/elements/thread.js +1 -1
  163. package/dist/elements/toast.js +1 -1
  164. package/dist/elements/tool.js +1 -1
  165. package/dist/elements/tooltip.js +1 -1
  166. package/dist/elements/voice-input.js +1 -1
  167. package/dist/elements/voice-output.js +1 -1
  168. package/dist/elements.d.ts +380 -26
  169. package/dist/{elements/chunks/ellipsis-7gU33mL2.js → ellipsis-CbOpJnU3.js} +1 -1
  170. package/dist/embed-CrfjkbUG.js +1 -0
  171. package/dist/engine-javascript-vq0WuIJl.js +14 -2516
  172. package/dist/{elements/chunks/external-link-CSOEsNlx.js → external-link-ByXAwBBQ.js} +1 -1
  173. package/dist/file-text-DMib2qwt.js +1 -0
  174. package/dist/{elements/chunks/file-tree-zvB2i7P9.js → file-tree-CJqM2aP7.js} +1 -1
  175. package/dist/folder-_BAb929C.js +1 -0
  176. package/dist/form-DSZgZQZk.js +1 -0
  177. package/dist/github-dark-dimmed-DUshB20C.js +1 -4
  178. package/dist/github-light-JYsPkUQd.js +1 -4
  179. package/dist/hover-card-BQbul9eq.js +1 -0
  180. package/dist/html-CPZ3oZQ7.js +1 -10
  181. package/dist/icon-CdcfRhYI.js +1 -0
  182. package/dist/{elements/chunks/index-BCRhi84a.js → index-xu_pdcPi.js} +1 -1
  183. package/dist/index.d.ts +4 -2
  184. package/dist/index.js +7474 -5857
  185. package/dist/index.server.js +5965 -4762
  186. package/dist/info-DsFjGuI_.js +1 -0
  187. package/dist/input-DKbmkMos.js +1 -0
  188. package/dist/javascript-C25yR2R2.js +1 -6
  189. package/dist/json-DxJze_jm.js +1 -6
  190. package/dist/kai.es.js +1 -1
  191. package/dist/kbd-PvdGhX4s.js +1 -0
  192. package/dist/{elements/chunks/link-preview-OQ9IEq0f.js → link-preview-DbM1866N.js} +1 -1
  193. package/dist/link-zF8PzWfF.js +1 -0
  194. package/dist/loader-BM4CEz4G.js +1 -0
  195. package/dist/{elements/chunks/markdown-DgBFaGAz.js → markdown-LMvmAyBk.js} +7 -7
  196. package/dist/mcp.es.js +1361 -81
  197. package/dist/message-BSsgvHvf.js +1 -0
  198. package/dist/message-BYZECyek.js +1 -0
  199. package/dist/message-circle-DruwObfX.js +1 -0
  200. package/dist/message-square-BG6q6mlm.js +1 -0
  201. package/dist/{elements/chunks/minimize-2-DPIUKTrT.js → minimize-2-BQRoBV1V.js} +1 -1
  202. package/dist/{elements/chunks/model-switcher-DsT8tFB0.js → model-switcher-CMpCOYcB.js} +1 -1
  203. package/dist/{elements/chunks/overlay-DuiwdXjm.js → overlay-Cb-MkyDa.js} +1 -1
  204. package/dist/panel-right-i8warFxT.js +1 -0
  205. package/dist/paperclip-ByY3UVO6.js +1 -0
  206. package/dist/play-BvKKq3fX.js +1 -0
  207. package/dist/primitives/card-data-types.d.ts +49 -0
  208. package/dist/primitives/card-routing.d.ts +1 -33
  209. package/dist/primitives/card-validate.d.ts +2 -2
  210. package/dist/primitives/chat-config.d.ts +29 -2
  211. package/dist/primitives/conversation-store.d.ts +54 -0
  212. package/dist/primitives/field-mask.d.ts +96 -0
  213. package/dist/primitives/field-semantics.d.ts +36 -0
  214. package/dist/primitives/input-mask.d.ts +46 -0
  215. package/dist/primitives/url-scheme-policy.d.ts +34 -0
  216. package/dist/primitives/use-resize-observer.d.ts +2 -2
  217. package/dist/progress-bar-jVAHvMUf.js +1 -0
  218. package/dist/prompt-suggestion-CD-qtNgC.js +1 -0
  219. package/dist/radio-BsoBMhkF.js +1 -0
  220. package/dist/react/index.d.ts +586 -19
  221. package/dist/react.js +223 -187
  222. package/dist/reasoning-4kBPtlTx.js +1 -0
  223. package/dist/register-impl-B1hLkrI8.js +424 -0
  224. package/dist/{elements/chunks/resizable-D181b4fM.js → resizable-uPmY9VY-.js} +1 -1
  225. package/dist/rotate-ccw-B2xn93py.js +1 -0
  226. package/dist/rotate-cw-CMVLoCyH.js +1 -0
  227. package/dist/schemas/form.schema.json +21 -1
  228. package/dist/schemas/tool-defs.d.ts +11 -1
  229. package/dist/schemas.js +81 -81
  230. package/dist/scroll-area-BqLUo8ZZ.js +1 -0
  231. package/dist/scroll-button-DslXiJyL.js +1 -0
  232. package/dist/select-2cLRtPGT.js +1 -0
  233. package/dist/{elements/chunks/separator-CeJHQqLW.js → separator-BWQtNJcM.js} +1 -1
  234. package/dist/{elements/chunks/settings-CqaHgJF9.js → settings-BBR63jLg.js} +1 -1
  235. package/dist/{elements/chunks/settings-group-CjqjLCOn.js → settings-group-B2ciy-Iw.js} +1 -1
  236. package/dist/{elements/chunks/skeleton-D8akBnKS.js → skeleton-CkHI-HgC.js} +1 -1
  237. package/dist/slider-DDR9U-i0.js +1 -0
  238. package/dist/{solid-BtdqNZI7.js → solid-BzCFdL25.js} +9771 -7594
  239. package/dist/{solid-CnavwBye.js → solid-DruVOXnf.js} +7893 -6183
  240. package/dist/solid.d.ts +16 -2
  241. package/dist/solid.js +256 -243
  242. package/dist/solid.server.js +256 -243
  243. package/dist/source-GEnFF528.js +1 -0
  244. package/dist/star-CilHq8GP.js +1 -0
  245. package/dist/state/index.d.ts +1 -1
  246. package/dist/state/mock.d.ts +32 -2
  247. package/dist/state.js +133 -108
  248. package/dist/store-Ciyk6eZG.js +1 -0
  249. package/dist/svelte--5p79yCD.js +1 -15
  250. package/dist/switch-KkeQIbuH.js +1 -0
  251. package/dist/tasks-card-BrN4bggJ.js +1 -0
  252. package/dist/text-shimmer-Dcj1MHuq.js +1 -0
  253. package/dist/textarea-Dpvbngbg.js +1 -0
  254. package/dist/theme.tokens.css +110 -13
  255. package/dist/{elements/chunks/thumbs-up-DX2Ijk3H.js → thumbs-up-CsT9Wzb9.js} +1 -1
  256. package/dist/toast-store-tgK6MuMv.js +1 -0
  257. package/dist/{elements/chunks/tool-DKQ2D1DP.js → tool-DzUjIBT8.js} +1 -1
  258. package/dist/{elements/chunks/tooltip-B0G99y8w.js → tooltip-Bkkg_4t0.js} +1 -1
  259. package/dist/trash-2-jBKxjGGQ.js +1 -0
  260. package/dist/{elements/chunks/triangle-alert-F9cyUEyy.js → triangle-alert-DlQ68ppf.js} +1 -1
  261. package/dist/tsx-B8rCNbgL.js +1 -6
  262. package/dist/types.d.ts +48 -3
  263. package/dist/typescript-RycA9KXf.js +1 -6
  264. package/dist/ui/checkbox-group.d.ts +83 -0
  265. package/dist/ui/checkbox.d.ts +40 -0
  266. package/dist/ui/dock.d.ts +51 -0
  267. package/dist/ui/icon.d.ts +3 -0
  268. package/dist/ui/input.d.ts +48 -2
  269. package/dist/ui/radio.d.ts +85 -0
  270. package/dist/ui/select.d.ts +71 -0
  271. package/dist/ui/slider.d.ts +65 -0
  272. package/dist/ui/switch.d.ts +9 -2
  273. package/dist/upload-TcAHXv9W.js +1 -0
  274. package/dist/url-scheme-policy-DR5DgvkM.js +1 -0
  275. package/dist/use-card-resolution-DaZqAdWf.js +1 -0
  276. package/dist/{elements/chunks/variant-aurora-qt6Zct8M.js → variant-aurora-BhLuYxJR.js} +1 -1
  277. package/dist/{variant-aurora-B8II3-I1.js → variant-aurora-CNmfHhcx.js} +2 -2
  278. package/dist/{variant-aurora-CMNWOSJR.js → variant-aurora-D6GsdTPA.js} +2 -2
  279. package/dist/{variant-aurora-CcuDMWwQ.js → variant-aurora-DbW_OWL2.js} +1 -1
  280. package/dist/{elements/chunks/variant-custom-tJp22_BQ.js → variant-custom-BRvaNHSi.js} +1 -1
  281. package/dist/{variant-custom-L16JLLZy.js → variant-custom-BvYHR62b.js} +1 -1
  282. package/dist/{variant-custom-BdvYC7af.js → variant-custom-DMTrEO5w.js} +2 -2
  283. package/dist/{variant-custom-C714mqKl.js → variant-custom-DV2x254s.js} +2 -2
  284. package/dist/{variant-wave-ecwykeyL.js → variant-wave-BNMGrDfj.js} +2 -2
  285. package/dist/{variant-wave-2S4La2Ka.js → variant-wave-BpDd8t3Z.js} +1 -1
  286. package/dist/{variant-wave-D7ruiA1W.js → variant-wave-CyBueXj9.js} +2 -2
  287. package/dist/{elements/chunks/variant-wave-CaQ5ti39.js → variant-wave-sp-qwsdI.js} +1 -1
  288. package/dist/vue-BmIZj4XD.js +1 -33
  289. package/dist/x-Z5UntkIJ.js +1 -0
  290. package/frameworks/react/index.tsx +210 -22
  291. package/llms-full.txt +1184 -22
  292. package/llms.txt +6 -3
  293. package/package.json +17 -4
  294. package/src/agent-tooling/README.md +192 -0
  295. package/src/agent-tooling/catalog/invariants.ts +3 -3
  296. package/src/agent-tooling/catalog/surfaces.ts +72 -0
  297. package/src/agent-tooling/construct/cli-entry.ts +8 -0
  298. package/src/agent-tooling/construct/cli.ts +147 -0
  299. package/src/agent-tooling/construct/codegen.ts +1635 -0
  300. package/src/agent-tooling/construct/construct.v1.schema.json +319 -0
  301. package/src/agent-tooling/construct/dev.ts +148 -0
  302. package/src/agent-tooling/construct/fixtures/demo-widget.construct.json +7 -0
  303. package/src/agent-tooling/construct/fixtures/ops-console.construct.json +44 -0
  304. package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +32 -0
  305. package/src/agent-tooling/construct/schema.ts +452 -0
  306. package/src/agent-tooling/mcp/server.ts +2 -1
  307. package/src/agent-tooling/mcp/tools/construct.ts +130 -0
  308. package/src/agent-tooling/mcp/tools/debug.ts +126 -4
  309. package/src/agent-tooling/mcp/tools/reference.ts +104 -3
  310. package/src/agent-tooling/recipes/composed-thread.ts +714 -0
  311. package/src/agent-tooling/recipes/index.ts +22 -0
  312. package/src/agent-tooling/recipes/types.ts +32 -0
  313. package/src/agent-tooling/registry.ts +5 -0
  314. package/src/components/attachment-types.ts +7 -0
  315. package/src/components/audio-visualizer/fit-scale.ts +1 -1
  316. package/src/components/card-renderer.tsx +39 -8
  317. package/src/components/card.tsx +10 -2
  318. package/src/components/chat-scope-picker.tsx +2 -2
  319. package/src/components/chat-thread.tsx +602 -43
  320. package/src/components/choice-card.tsx +102 -37
  321. package/src/components/coachmark.tsx +1 -1
  322. package/src/components/code-block.tsx +2 -2
  323. package/src/components/composer.tsx +89 -15
  324. package/src/components/confirm-card.tsx +20 -4
  325. package/src/components/conversation-item.tsx +56 -9
  326. package/src/components/conversation-list.tsx +25 -10
  327. package/src/components/conversation-panel.tsx +118 -0
  328. package/src/components/empty.tsx +14 -3
  329. package/src/components/file-tree.tsx +5 -1
  330. package/src/components/form-widgets.tsx +257 -195
  331. package/src/components/form.tsx +297 -9
  332. package/src/components/home-panel.tsx +159 -0
  333. package/src/components/loader.tsx +12 -5
  334. package/src/components/message-skills.tsx +1 -1
  335. package/src/components/message.tsx +71 -11
  336. package/src/components/prompt-input.tsx +7 -1
  337. package/src/components/prompt-suggestion.tsx +4 -1
  338. package/src/components/reasoning.tsx +30 -3
  339. package/src/components/response-compare.tsx +2 -2
  340. package/src/components/scroll-button.tsx +56 -4
  341. package/src/components/source.tsx +6 -1
  342. package/src/components/tasks-card.tsx +58 -16
  343. package/src/components/thread.tsx +10 -1
  344. package/src/components/toast.tsx +1 -1
  345. package/src/components/tool-types.ts +9 -0
  346. package/src/components/widget-tab-bar.tsx +73 -0
  347. package/src/elements/attachments.tsx +3 -1
  348. package/src/elements/chat-workspace.tsx +1 -1
  349. package/src/elements/chat.tsx +115 -5
  350. package/src/elements/checkbox-group.tsx +164 -0
  351. package/src/elements/checkbox.tsx +134 -0
  352. package/src/elements/compiled.css +1 -1
  353. package/src/elements/composer.tsx +12 -1
  354. package/src/elements/conversation-item.tsx +62 -22
  355. package/src/elements/conversation-list.tsx +2 -2
  356. package/src/elements/define-entry.ts +12 -0
  357. package/src/elements/dock.tsx +11 -0
  358. package/src/elements/element-data-types.ts +40 -0
  359. package/src/elements/element-manifest.json +24 -0
  360. package/src/elements/element-meta.json +767 -34
  361. package/src/elements/element-nonscalar.json +17 -0
  362. package/src/elements/element-types.d.ts +380 -26
  363. package/src/elements/feedback-bar.tsx +5 -0
  364. package/src/elements/icon-names.json +29 -0
  365. package/src/elements/input.tsx +312 -23
  366. package/src/elements/message.tsx +2 -0
  367. package/src/elements/pane-grid.tsx +111 -0
  368. package/src/elements/prompt-input.tsx +8 -2
  369. package/src/elements/radio-group.tsx +129 -0
  370. package/src/elements/register-impl.ts +6 -0
  371. package/src/elements/scroll-button.tsx +54 -6
  372. package/src/elements/select.tsx +165 -0
  373. package/src/elements/slider.tsx +171 -0
  374. package/src/elements/slots.ts +1 -1
  375. package/src/elements/styles.css +89 -3
  376. package/src/elements/thread.tsx +2 -0
  377. package/src/elements/toast.tsx +14 -1
  378. package/src/index.ts +5 -2
  379. package/src/primitives/card-data-types.ts +49 -0
  380. package/src/primitives/card-host.tsx +4 -2
  381. package/src/primitives/card-routing.ts +7 -56
  382. package/src/primitives/card-schemas/form.schema.json +21 -1
  383. package/src/primitives/card-validate.ts +10 -2
  384. package/src/primitives/chat-config.tsx +33 -6
  385. package/src/primitives/conversation-store.ts +248 -0
  386. package/src/primitives/field-mask.ts +256 -0
  387. package/src/primitives/field-semantics.ts +115 -0
  388. package/src/primitives/input-mask.ts +853 -0
  389. package/src/primitives/toast-store.ts +66 -4
  390. package/src/primitives/url-scheme-policy.ts +70 -0
  391. package/src/primitives/use-resize-observer.ts +2 -2
  392. package/src/schemas/tool-defs.ts +12 -2
  393. package/src/solid.ts +20 -2
  394. package/src/state/index.ts +1 -1
  395. package/src/state/mock.ts +92 -6
  396. package/src/types.ts +45 -3
  397. package/src/ui/agent-card.tsx +2 -2
  398. package/src/ui/avatar.tsx +1 -1
  399. package/src/ui/checkbox-group.tsx +153 -0
  400. package/src/ui/checkbox.tsx +63 -0
  401. package/src/ui/dock.tsx +192 -7
  402. package/src/ui/icon.tsx +53 -0
  403. package/src/ui/input.tsx +249 -9
  404. package/src/ui/kbd.tsx +1 -1
  405. package/src/ui/nav.tsx +1 -1
  406. package/src/ui/pane-group.tsx +2 -2
  407. package/src/ui/radio.tsx +150 -0
  408. package/src/ui/select.tsx +168 -0
  409. package/src/ui/slider.tsx +178 -0
  410. package/src/ui/switch.tsx +49 -18
  411. package/src/utils/cn.ts +11 -5
  412. package/theme.css +112 -13
  413. package/dist/elements/chunks/action-icons-D9u3OzYW.js +0 -1
  414. package/dist/elements/chunks/arrow-left-CVh1TeN7.js +0 -1
  415. package/dist/elements/chunks/artifact-BkYcfIlZ.js +0 -1
  416. package/dist/elements/chunks/attachments-DwfNlubq.js +0 -1
  417. package/dist/elements/chunks/badge-Q0-Cmwzz.js +0 -1
  418. package/dist/elements/chunks/bash-InADTalH.js +0 -1
  419. package/dist/elements/chunks/card-renderer-3Dyl-FpN.js +0 -1
  420. package/dist/elements/chunks/card-routing-BK09BdmL.js +0 -1
  421. package/dist/elements/chunks/check-B5kBPKeo.js +0 -1
  422. package/dist/elements/chunks/chevron-down-DZ1GS39h.js +0 -1
  423. package/dist/elements/chunks/chevron-right-CvP7OUd2.js +0 -1
  424. package/dist/elements/chunks/choice-card-D4QUIOWZ.js +0 -1
  425. package/dist/elements/chunks/circle-CDf9g6MQ.js +0 -1
  426. package/dist/elements/chunks/circle-check-CA47Nqbz.js +0 -1
  427. package/dist/elements/chunks/circle-x-CJ_HVbC8.js +0 -1
  428. package/dist/elements/chunks/code-block-BdLiTitd.js +0 -1
  429. package/dist/elements/chunks/composer-Byve-n8K.js +0 -69
  430. package/dist/elements/chunks/confirm-card-B0flE3MN.js +0 -1
  431. package/dist/elements/chunks/controllable-DTwTIlwp.js +0 -1
  432. package/dist/elements/chunks/conversation-item-BDztezOG.js +0 -1
  433. package/dist/elements/chunks/copy-Nf-kqxXH.js +0 -1
  434. package/dist/elements/chunks/core-AYMC6_lb.js +0 -12
  435. package/dist/elements/chunks/css-M7EaDHN_.js +0 -1
  436. package/dist/elements/chunks/default-input-C2iLFq0b.js +0 -1
  437. package/dist/elements/chunks/define-wjHR1MkU.js +0 -1
  438. package/dist/elements/chunks/download-C4V7tBdb.js +0 -1
  439. package/dist/elements/chunks/embed-D3KewsIJ.js +0 -1
  440. package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +0 -141
  441. package/dist/elements/chunks/file-text-D1G8khle.js +0 -1
  442. package/dist/elements/chunks/folder-WW2LGLid.js +0 -1
  443. package/dist/elements/chunks/form-CQirdC4W.js +0 -1
  444. package/dist/elements/chunks/github-dark-dimmed-DUshB20C.js +0 -1
  445. package/dist/elements/chunks/github-light-JYsPkUQd.js +0 -1
  446. package/dist/elements/chunks/hover-card-CJJkfHTK.js +0 -1
  447. package/dist/elements/chunks/html-CPZ3oZQ7.js +0 -1
  448. package/dist/elements/chunks/icon-Cfgmf4fa.js +0 -1
  449. package/dist/elements/chunks/info-DX3YMOt6.js +0 -1
  450. package/dist/elements/chunks/input-BtW9U6Sq.js +0 -1
  451. package/dist/elements/chunks/javascript-C25yR2R2.js +0 -1
  452. package/dist/elements/chunks/json-DxJze_jm.js +0 -1
  453. package/dist/elements/chunks/kbd-LGXwuT_V.js +0 -1
  454. package/dist/elements/chunks/link-2My69BqT.js +0 -1
  455. package/dist/elements/chunks/loader-iOxc_Tu-.js +0 -1
  456. package/dist/elements/chunks/message-VMZohrXx.js +0 -1
  457. package/dist/elements/chunks/message-circle-CpXMM-_n.js +0 -1
  458. package/dist/elements/chunks/message-square-DxcWtETQ.js +0 -1
  459. package/dist/elements/chunks/message-tZmV2A3p.js +0 -1
  460. package/dist/elements/chunks/paperclip-CRZVp4z_.js +0 -1
  461. package/dist/elements/chunks/progress-bar-DNy66e_E.js +0 -1
  462. package/dist/elements/chunks/prompt-suggestion-Bn64Nl7L.js +0 -1
  463. package/dist/elements/chunks/reasoning-Emn9N4-T.js +0 -1
  464. package/dist/elements/chunks/rotate-cw-CPWe37D9.js +0 -1
  465. package/dist/elements/chunks/scroll-area-ClZkZxIk.js +0 -1
  466. package/dist/elements/chunks/scroll-button-DPE-t3x_.js +0 -1
  467. package/dist/elements/chunks/share-CyfnNEqp.js +0 -1
  468. package/dist/elements/chunks/source-UWCvmVak.js +0 -1
  469. package/dist/elements/chunks/star-DoHFAikQ.js +0 -1
  470. package/dist/elements/chunks/store-Cjq0qwYN.js +0 -1
  471. package/dist/elements/chunks/svelte--5p79yCD.js +0 -1
  472. package/dist/elements/chunks/tasks-card-CmZ5xh6v.js +0 -1
  473. package/dist/elements/chunks/text-shimmer-DYn09zrz.js +0 -1
  474. package/dist/elements/chunks/textarea-skiGHURM.js +0 -1
  475. package/dist/elements/chunks/toast-store-CFnQpThX.js +0 -1
  476. package/dist/elements/chunks/tsx-B8rCNbgL.js +0 -1
  477. package/dist/elements/chunks/typescript-RycA9KXf.js +0 -1
  478. package/dist/elements/chunks/use-card-resolution-DoA2f_EU.js +0 -1
  479. package/dist/elements/chunks/vue-BmIZj4XD.js +0 -1
  480. package/dist/elements/chunks/x-B6UnOiLw.js +0 -1
  481. package/dist/llms/llms-full.txt +0 -2949
  482. package/dist/llms/llms.txt +0 -156
  483. package/dist/register-impl-DpE7icIb.js +0 -293
  484. package/dist/ui/stat.d.ts +0 -16
  485. package/src/ui/stat.tsx +0 -41
  486. /package/dist/{elements/chunks/card-tags-D8lZ-C_U.js → card-tags-D8lZ-C_U.js} +0 -0
  487. /package/dist/{elements/chunks/link-preview-DNILK391.js → link-preview-DNILK391.js} +0 -0
  488. /package/dist/{elements/chunks/slots-DaNjX0rc.js → slots-DaNjX0rc.js} +0 -0
@@ -1,16 +1,37 @@
1
1
  import { JSX } from 'solid-js';
2
- import { FormField } from './form.js';
2
+ import { FieldMaskHint, FormField } from './form.js';
3
3
  /** The shared prop shape every leaf widget receives from FieldRow. */
4
4
  export interface WidgetProps {
5
5
  id: string;
6
6
  value: unknown;
7
7
  field: FormField;
8
+ /**
9
+ * The field's resolved format hints, or an empty resolution.
10
+ *
11
+ * RESOLVED IN `FieldRow`, not here. The row already has to resolve them to render
12
+ * the format hint text and put its id in `aria-describedby`, and resolving the same
13
+ * untrusted `x-kai-*` keys a second time in the widget would warn twice about the
14
+ * same bad hint and could disagree with what the row said out loud.
15
+ */
16
+ mask?: FieldMaskHint;
8
17
  disabled: boolean;
9
18
  placeholder?: string;
10
19
  required: boolean;
11
20
  invalid: boolean;
12
21
  describedBy?: string;
13
22
  label: string;
23
+ /**
24
+ * The id of the row's VISIBLE label element, for widgets whose control is a group
25
+ * rather than one labelable input.
26
+ *
27
+ * `FieldRow` used to suppress its `<label>` for those kinds and each widget named
28
+ * itself with `aria-label={props.label}`, which is a name only a screen reader can
29
+ * reach: "Severity", "Environments" and "Tags" were announced and invisible. The row
30
+ * now always renders the text and hands its id down here, so one string names the
31
+ * group and everybody can see it. Absent means the widget is on its own (a bare
32
+ * widget rendered outside `FieldRow`), so `aria-label` stays the fallback.
33
+ */
34
+ labelledBy?: string;
14
35
  onInput: (value: unknown) => void;
15
36
  onBlur: () => void;
16
37
  }
@@ -22,10 +43,54 @@ export declare function TextareaWidget(props: WidgetProps): JSX.Element;
22
43
  export declare function NumberWidget(props: WidgetProps): JSX.Element;
23
44
  export declare function SliderWidget(props: WidgetProps): JSX.Element;
24
45
  export declare function RatingWidget(props: WidgetProps): JSX.Element;
46
+ /**
47
+ * The boolean field's switch IS `ui/switch.tsx` — it is not a lookalike.
48
+ *
49
+ * This used to hand-roll its own `<button role="switch">` at 44×24 while
50
+ * `<kai-switch>` shipped the same control at 36×20, so a consumer putting the two
51
+ * side by side saw two different switches; and its thumb used `bg-background`,
52
+ * re-introducing in the copy the dark-mode disappearing-thumb bug that
53
+ * `ui/switch.tsx:80` carries a comment about having fixed. Delegating removes both.
54
+ * The size convergence (44×24 → 36×20) is visible inside `kai-form` and intended.
55
+ *
56
+ * The four form-only hooks — `id`, `data-control` and the `aria-required` /
57
+ * `aria-invalid` / `aria-describedby` trio — are ordinary props now (plan decision
58
+ * D-7). They used to be stamped onto the button through `buttonRef` + a
59
+ * `createEffect`, which worked but meant this widget reached into the primitive's
60
+ * DOM to make `form.focusField()` land. `Switch` forwards anything it does not own
61
+ * to its inner button, exactly like `Checkbox` and `Radio` forward to their inputs,
62
+ * so all four ride the same path every other widget's hooks do.
63
+ */
25
64
  export declare function SwitchWidget(props: WidgetProps): JSX.Element;
26
65
  export declare function CheckboxWidget(props: WidgetProps): JSX.Element;
27
66
  export declare function RadioGroupWidget(props: WidgetProps): JSX.Element;
28
67
  export declare function SelectWidget(props: WidgetProps): JSX.Element;
29
- export declare function CheckboxGroupWidget(props: WidgetProps): JSX.Element;
68
+ /**
69
+ * An array field whose items are an `enum`, as a list of checkboxes.
70
+ *
71
+ * The bordered/divided row chrome, the `role="group"` wrapper and the rows themselves
72
+ * live in `ui/checkbox-group.tsx` now — this widget only turns a JSON-Schema
73
+ * `items.enum` into options and owns the array in and out. It used to hand-roll the
74
+ * identical chrome beside `RadioGroup`, which already owned it.
75
+ *
76
+ * The emitted array holds the SCHEMA's values, not their string forms, so a numeric
77
+ * or boolean enum survives a round trip.
78
+ */
79
+ export declare function CheckboxGroupWidget(props: WidgetProps & {
80
+ class?: string;
81
+ }): JSX.Element;
82
+ /**
83
+ * The LONG version of `checkbox-group`: an array-of-enum field whose option list is
84
+ * over the row's `inlineMax`.
85
+ *
86
+ * This was a `<select multiple>` until decision D-3 was ruled. `<select multiple>` is a
87
+ * poor control on every platform — the multi-select affordance is invisible, discovering
88
+ * it means knowing to ctrl/cmd-click, and there is no touch story at all. It is the same
89
+ * control as `checkbox-group`, so it renders as one, with a scroll cap because the only
90
+ * thing that made a long list bearable in a chat card was the select's fixed-height box.
91
+ *
92
+ * The scroll cap is a presentation decision (how a long list fits), not a limit: every
93
+ * option is rendered, nothing is truncated or dropped.
94
+ */
30
95
  export declare function MultiSelectWidget(props: WidgetProps): JSX.Element;
31
96
  export declare function TagListWidget(props: WidgetProps): JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { JSX } from 'solid-js';
2
2
  import { CardHost, CardResolution } from '../primitives/card-contract.js';
3
+ import { FieldSemanticType } from '../primitives/field-semantics.js';
3
4
  import { FormDefinition, FormField } from '../primitives/card-data-types.js';
4
5
  export type { FormCardEnvelope, FormDefinition, FormField, } from '../primitives/card-data-types.js';
5
6
  /** The internal widget identifiers `widgetFor` resolves to. */
@@ -8,6 +9,49 @@ export declare const DEFAULT_INLINE_MAX = 4;
8
9
  /** Resolve the widget for a field. An explicit valid `x-kai-widget` always wins;
9
10
  * otherwise the type/format/enum/constraint combination selects the widget. */
10
11
  export declare function widgetFor(field: FormField, inlineMax: number): WidgetKind;
12
+ /**
13
+ * What one field's `x-kai-*` format hints resolve to.
14
+ *
15
+ * The three props on the left are `Input`'s masking surface verbatim;
16
+ * `hint` is the TEXT statement of the expected format, which `FieldRow` renders and
17
+ * links through its EXISTING `aria-describedby` chain (no third channel).
18
+ * Every field is `undefined` when the field carries no hints, which is what "byte for
19
+ * byte the behavior of today" means here.
20
+ */
21
+ export interface FieldMaskHint {
22
+ /** The compiled-clean mask pattern handed to `Input`'s `format`. */
23
+ format?: string;
24
+ /** An explicit, aligned display guide. Absent = the pattern derives its own. */
25
+ guide?: string;
26
+ /** The tier-1 semantic type: `inputmode`, `autocomplete`, and the canonical form. */
27
+ semantic?: FieldSemanticType;
28
+ /** The expected format, stated in text for the description chain. */
29
+ hint?: string;
30
+ /**
31
+ * Everything that was ignored and why, as DATA rather than as a side effect.
32
+ *
33
+ * Resolution runs inside a memo on a render path, so it must never throw and must
34
+ * not warn twice for the same reason on a re-render. Returning the messages lets
35
+ * `FieldRow` own the once-per-row discipline and lets the pure tests assert the
36
+ * wording without a console spy.
37
+ */
38
+ warnings: string[];
39
+ }
40
+ /** The resolution of a field with no format hints: shared, frozen, and the default
41
+ * every non-text widget carries so the prop bag has one shape. */
42
+ export declare const EMPTY_MASK_HINT: FieldMaskHint;
43
+ /**
44
+ * Resolve a field's `x-kai-format` / `x-kai-mask` / `x-kai-mask-guide` into the
45
+ * masking props `Input` takes, or into nothing at all.
46
+ *
47
+ * EVERY INPUT HERE IS MODEL OUTPUT and therefore untrusted. The hints are
48
+ * display-only — they produce text and caret positions, never HTML, a URL or an
49
+ * attribute on a navigable element — so this is about denial of service and
50
+ * confusion, not injection: an unknown token, a pattern the engine refuses and a
51
+ * misaligned guide each degrade to the largest thing that still works, and say so.
52
+ * A THROW here would take out the whole card, including the fields that were fine.
53
+ */
54
+ export declare function resolveFieldMask(field: FormField, fieldKey?: string): FieldMaskHint;
11
55
  /** Humanize a camelCase / snake_case property key into a label. */
12
56
  export declare function humanize(key: string): string;
13
57
  /** Field order: `x-kai-order` (filtered to known keys, missing appended) if
@@ -122,10 +166,11 @@ interface FieldRowProps {
122
166
  * signal behind the prop it read. The object identity is constant, so the
123
167
  * `WidgetSwitch` prop below never changes either.
124
168
  */
125
- export declare function fieldCommon(props: FieldRowProps, id: string, placeholder: () => string | undefined, label: () => string, describedBy?: () => string | undefined): ReturnType<FieldRowCommon>;
169
+ export declare function fieldCommon(props: FieldRowProps, id: string, placeholder: () => string | undefined, label: () => string, describedBy?: () => string | undefined, mask?: () => FieldMaskHint, labelledBy?: () => string | undefined): ReturnType<FieldRowCommon>;
126
170
  type FieldRowCommon = () => {
127
171
  id: string;
128
172
  value: unknown;
173
+ mask: FieldMaskHint;
129
174
  field: FormField;
130
175
  disabled: boolean;
131
176
  placeholder?: string;
@@ -133,6 +178,8 @@ type FieldRowCommon = () => {
133
178
  invalid: boolean;
134
179
  describedBy?: string;
135
180
  label: string;
181
+ /** The id of the row's visible <label>, for widgets that name a GROUP. */
182
+ labelledBy?: string;
136
183
  onInput: (v: unknown) => void;
137
184
  onBlur: () => void;
138
185
  };
@@ -0,0 +1,34 @@
1
+ import { ConversationSummary, HomeLinkEntry } from '../types.js';
2
+ export interface HomePanelProps {
3
+ greeting?: {
4
+ title?: string;
5
+ subtitle?: string;
6
+ };
7
+ /** The most-recent conversation, host-derived. `undefined` hides the card
8
+ * entirely — this component never fetches or picks one itself. */
9
+ recent?: ConversationSummary;
10
+ /** Defaults to `true`. */
11
+ showNewConversation?: boolean;
12
+ /** Defaults to `'Send us a message'`. */
13
+ newChatLabel?: string;
14
+ links?: HomeLinkEntry[];
15
+ onSelectRecent?: (id: string) => void;
16
+ onNewChat: () => void;
17
+ /** Fired only for href-less link entries — an entry with a safe `href`
18
+ * navigates as a real anchor instead. */
19
+ onLink?: (entry: HomeLinkEntry) => void;
20
+ class?: string;
21
+ }
22
+ /**
23
+ * The widget home screen (Intercom-pattern, H-1): greeting, the most-recent
24
+ * conversation, a "start a new conversation" CTA, and a list of host-defined
25
+ * links. Pure props in, events out — no fetching, no routing; a later task
26
+ * wires this behind `ChatThread`'s Home/Messages tab bar.
27
+ *
28
+ * Unsafe-href rule: a `links` entry with an `href` that fails `isSafeUrl`
29
+ * (e.g. `javascript:`) is NOT silently promoted into a button/event-emitter —
30
+ * that would let a host-authored-but-attacker-influenced config still fire a
31
+ * handler off a scheme SAFE_SCHEMES rejects. It renders as a plain,
32
+ * non-interactive row: label visible, no anchor, no button, no click handler.
33
+ */
34
+ export declare function HomePanel(props: HomePanelProps): import("solid-js").JSX.Element;
@@ -105,6 +105,12 @@ export interface MessageBodyProps {
105
105
  * the kit checks its own seven built-ins and leaves your own card type
106
106
  * unvalidated. A schema here WINS over a built-in of the same name. */
107
107
  cardSchemas?: CardSchemaMap;
108
+ /** The custom-element host node to emit card events off when no `CardProvider`
109
+ * is above this body, forwarded to `CardRenderer` as `hostElement`. The
110
+ * `<kai-chat>`/`<kai-message>`/`<kai-thread>` facades pass their own element,
111
+ * so a `card` part's events leave as the bubbling `kai-card` CustomEvent
112
+ * instead of being silently discarded. */
113
+ cardHostElement?: HTMLElement;
108
114
  /** Whether this is a user message (right-aligned bubble) vs an assistant
109
115
  * message (full-width transparent). */
110
116
  isUser: boolean;
@@ -125,11 +131,27 @@ export interface MessageBodyProps {
125
131
  copied?: boolean;
126
132
  /** Whether this message is the one currently streaming. Forwarded to each
127
133
  * reasoning part's `<Reasoning>` so the disclosure auto-opens while the
128
- * model is thinking and settles back once the stream ends (F-21: without it
129
- * the user watches a static collapsed "Reasoning" label for the whole
130
- * thinking window). The caller owns the definition of "streaming" — for
134
+ * model is thinking and settles back once the stream ends. Without it the
135
+ * user watches a static collapsed "Reasoning" label for the whole thinking
136
+ * window. The caller owns the definition of "streaming" — for
131
137
  * `ChatThread` that is `loading` + being the last assistant message. */
132
138
  isStreaming?: boolean;
139
+ /** How a `reasoning` part renders. `'full'` (default) is the current
140
+ * behavior: the collapsible `<Reasoning>` disclosure, with the "Thinking…"
141
+ * shimmer on its trigger while `isStreaming`. `'compact'` drops the
142
+ * disclosure entirely and shows only a shimmer loader while the part is
143
+ * streaming — nothing once it settles, so there is no expandable detail to
144
+ * open. `'off'` renders the part not at all, in either state. Kit-decides-
145
+ * HOW: this is a display-mode fact about the medium, not a per-message
146
+ * toggle, so it applies uniformly to every reasoning part in the body. */
147
+ reasoningMode?: 'full' | 'compact' | 'off';
148
+ /** Seeds the reasoning disclosure open AND keeps it tracking the stream
149
+ * (open while streaming, closes when it settles): the pre-Task-19f `full`
150
+ * behavior. Default false/absent: the panel starts closed (just the
151
+ * "Thinking" shimmer chip) and only opens on click, the current default
152
+ * (owner ruling, 2026-08-26). Meaningless when `reasoningMode` is
153
+ * `'compact'`/`'off'` (no disclosure exists to open). */
154
+ reasoningDefaultOpen?: boolean;
133
155
  /** INJECT slot projected at the TOP of the body — above the reasoning / tools /
134
156
  * content. A per-message header: a model-name label, a role + timestamp line.
135
157
  * In the `<kai-message>` shadow this is `<slot name="before-body" />`. */
@@ -18,6 +18,12 @@ export interface ReasoningProps {
18
18
  disabled?: boolean;
19
19
  /** Receive the open controller (open accessor + setOpen) once mounted. */
20
20
  controllerRef?: (api: ReasoningController) => void;
21
+ /** Keep auto-opening while streaming and auto-closing when it settles (the
22
+ * pre-Task-19f `full` behavior). Default false: the panel starts per
23
+ * `defaultOpen` and stays exactly where the user leaves it — streaming only
24
+ * changes the trigger's label (shimmer), never the open state, matching the
25
+ * "closed chip, expand on click" default (owner ruling, 2026-08-26). */
26
+ openOnStream?: boolean;
21
27
  }
22
28
  declare function Reasoning(props: ReasoningProps): JSX.Element;
23
29
  export interface ReasoningTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
@@ -2,6 +2,17 @@ export interface ScrollButtonProps {
2
2
  class?: string;
3
3
  variant?: 'outline' | 'ghost' | 'default';
4
4
  size?: 'sm' | 'md' | 'lg' | 'icon' | 'icon-sm';
5
+ /**
6
+ * The button's accessible name. Used whether or not the label is visible, so
7
+ * the announced text is always localisable. Defaults to `"Scroll to bottom"`.
8
+ */
9
+ label?: string;
10
+ /**
11
+ * Also render `label` visibly beside the icon. Defaults to `false` (icon
12
+ * only). When it is visible the text IS the accessible name, so nothing is
13
+ * announced twice.
14
+ */
15
+ showLabel?: boolean;
5
16
  }
6
17
  declare function ScrollButton(props: ScrollButtonProps): import("solid-js").JSX.Element;
7
18
  export { ScrollButton };
@@ -27,6 +27,11 @@ export interface ThreadProps {
27
27
  * the kit checks its own seven built-ins and leaves your own card type
28
28
  * unvalidated. A schema here WINS over a built-in of the same name. */
29
29
  cardSchemas?: CardSchemaMap;
30
+ /** The custom-element host node to emit card events off when no `CardProvider`
31
+ * is present, forwarded through `MessageBody` to `CardRenderer`. The
32
+ * element facades pass their own host element so card events leave as the
33
+ * bubbling `kai-card` CustomEvent. */
34
+ cardHostElement?: HTMLElement;
30
35
  /** Show a typing indicator on the pending assistant turn — use while awaiting
31
36
  * the assistant's reply. */
32
37
  loading?: boolean;
@@ -23,6 +23,15 @@ export interface ToolPart {
23
23
  type: string;
24
24
  /** Semantic classification for rendering. Derive with classifyTool(type). */
25
25
  kind?: ToolKind;
26
+ /** The call's lifecycle. A provider stream (real or `createMockResponder`)
27
+ * only ever ANNOUNCES a call: arguments stream in (`input-streaming`), then
28
+ * the part parks at `input-available` — and stays there. The kit parses and
29
+ * renders the call; EXECUTING it and answering is the host's side of the
30
+ * seam: after the read settles, run the tool and patch the part forward with
31
+ * `stream.upsertTool(id, { state: 'output-available', output })` (or
32
+ * `upsertToolPart`), or `output-error` + `errorText` on failure. The one
33
+ * exception is a call the provider ran itself (`raw` carries the result and
34
+ * the wire sets `output` directly) — never re-execute those. */
26
35
  state: 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
27
36
  /** Last VALID parsed snapshot, fingerprint-deduped. The primary channel: this is
28
37
  * what the kit renders. */
@@ -0,0 +1,16 @@
1
+ export interface WidgetTabBarProps {
2
+ active: 'home' | 'messages';
3
+ onChange: (tab: 'home' | 'messages') => void;
4
+ /** Whether the Messages tab has unread activity. Reaches BOTH the visible
5
+ * dot and the tab's accessible name (`aria-label`) — a dot alone is
6
+ * invisible to assistive tech, the #336 lesson this test pins. */
7
+ unread?: boolean;
8
+ homeLabel?: string;
9
+ messagesLabel?: string;
10
+ }
11
+ /**
12
+ * The widget's Home/Messages tab bar (Intercom-pattern chrome, H-2/H-6). Real
13
+ * `tablist`/`tab` semantics — this is a persistent view switch within the
14
+ * widget, not page navigation, so it is not `<Nav>`'s `role="page"` dialect.
15
+ */
16
+ export declare function WidgetTabBar(props: WidgetTabBarProps): import("solid-js").JSX.Element;
@@ -0,0 +1,106 @@
1
+ import{A as Ye,g as z,w as Je,k as Q,j as de,o as ue,x as De,h as Qe,i as N,u as Ne,a as H,d as O,b as Z,l as ee,c as $,F as Oe,S as G,t as S,Q as Ze,e as et}from"./define-By-uL588.js";import{c as P}from"./cn-DN5AWfiS.js";import{u as tt,c as nt,a as rt}from"./overlay-Cb-MkyDa.js";function M(n){if(n==null)return[];if(typeof n=="string")return n.length?[{type:"text",text:n}]:[];const l=[];for(const t of n)if(t.type==="text"){if(!t.text)continue;const i=l[l.length-1];i&&i.type==="text"?l[l.length-1]={type:"text",text:i.text+t.text}:l.push({type:"text",text:t.text})}else l.push({type:"entity",entity:t.entity});return l}function te(n,l){let t="";for(const i of n)i.type==="text"?t+=i.text:t+=i.entity.promptText??i.entity.label;return t}function he(n){return n.filter(l=>l.type==="entity").map(l=>l.entity)}function ne(n){return n.every(l=>l.type==="text"&&l.text.length===0)}const C="\u200B",pe="data-kai-entity",fe=new WeakMap;function U(n){return!!n&&n.nodeType===1&&n.hasAttribute(pe)}function re(n){return n.ownerDocument.createTreeWalker(n,NodeFilter.SHOW_TEXT,{acceptNode(l){let t=l.parentElement;for(;t&&t!==n;){if(t.hasAttribute(pe))return NodeFilter.FILTER_REJECT;t=t.parentElement}return NodeFilter.FILTER_ACCEPT}})}function ot(n){switch(n){case"skill":return"/";case"agent":return"@";default:return""}}function Le(n){const l=t=>`<svg viewBox="0 0 24 24" width="1em" height="1em" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`;switch(n){case"agent":return l('<rect x="4" y="8" width="16" height="12" rx="3"/><path d="M12 4.5V8M9.5 13.5v1.5M14.5 13.5v1.5"/><circle cx="12" cy="3" r="1.2"/>');case"plugin":return l('<path d="M9 2v4M15 2v4M6 6h12v5a6 6 0 0 1-12 0zM12 17v5"/>');default:return""}}function Ie(n,l,t){const i=n.createElement("span");i.setAttribute(pe,""),i.setAttribute("contenteditable","false"),i.dataset.kind=l.kind,i.dataset.id=l.id,i.className="kai-composer-pill";const u=ot(l.kind);if(u){const s=n.createElement("span");s.className="kai-composer-pill-sigil",s.setAttribute("aria-hidden","true"),s.textContent=u,i.appendChild(s)}else{const s=l.icon??t?.[l.kind];if(s){const h=n.createElement("img");h.src=s,h.alt="",h.className="kai-composer-pill-icon",i.appendChild(h)}else{const h=Le(l.kind);if(h){const f=n.createElement("span");f.className="kai-composer-pill-icon kai-composer-pill-glyph",f.setAttribute("aria-hidden","true"),f.innerHTML=h,i.appendChild(f)}}}return i.appendChild(n.createTextNode(l.label)),fe.set(i,l),i}function L(n){const l=[],t=n.childNodes;return t.forEach((i,u)=>{if(U(i)){const s=fe.get(i),h=i;l.push({type:"entity",entity:s??{kind:h.dataset.kind??"",id:h.dataset.id??"",label:h.textContent??""}})}else if(i.nodeType===1&&i.tagName==="BR"){if(u===t.length-1)return;l.push({type:"text",text:`
2
+ `})}else i.nodeType===3&&l.push({type:"text",text:(i.textContent??"").split(C).join("")})}),M(l)}function oe(n,l,t=document,i){n.textContent="";for(const u of l)u.type==="text"?n.appendChild(t.createTextNode(u.text)):(n.appendChild(Ie(t,u.entity,i)),n.appendChild(t.createTextNode(C)))}function it(n,l,t){if(l<0||l>n.length)return null;for(let i=l-1;i>=0;i--){const u=n[i];if(/\s/.test(u))return null;if(t.includes(u))return i===0||/\s/.test(n[i-1])?{char:u,query:n.slice(i+1,l),start:i}:null}return null}function at(n,l,t){if(!t.length)return null;const i=t.map(h=>h.char),u=it(n,l,i);if(!u)return null;const s=t.find(h=>h.char===u.char);return s?{def:s,query:u.query,start:u.start}:null}function lt(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function st(n,l){const t=[];for(const s of l){let h,f;typeof s=="string"?(h=new RegExp(lt(s),"gi"),f=void 0):(h=new RegExp(s.pattern,s.flags??"gi"),f=s.class),h.lastIndex=0;let k;for(;(k=h.exec(n))!==null;){const x=k.index,w=x+k[0].length;if(w===x){h.lastIndex=x+1;continue}t.push({start:x,end:w,class:f})}}t.sort((s,h)=>s.start-h.start);const i=[];let u=-1;for(const s of t)s.start>=u&&(i.push(s),u=s.end);return i}function ct(){try{return typeof CSS<"u"&&typeof CSS.highlights<"u"&&typeof Highlight<"u"}catch{return!1}}const dt="kai-composer-highlight";function ut(n,l,t,i=dt){if(!ct())return;const u=CSS.highlights;if(l.length===0){u.delete(i);return}const s=[];let h=0;const f=n.ownerDocument,k=re(n);let x=k.nextNode();for(;x;){const v=x.textContent??"",b=[];for(let p=0;p<v.length;p++)v[p]!==t&&b.push(p);if(b.length>0){const p=new Int32Array(b.length);for(let m=0;m<b.length;m++)p[m]=b[m];s.push({node:x,strippedStart:h,strippedToRaw:p}),h+=b.length}x=k.nextNode()}function w(v){let b=0,p=s.length-1;for(;b<=p;){const m=b+p>>1,T=s[m],q=T.strippedStart+T.strippedToRaw.length;if(v<T.strippedStart)p=m-1;else if(v>=q)b=m+1;else{const R=v-T.strippedStart;return{node:T.node,rawOffset:T.strippedToRaw[R]}}}if(s.length>0){const m=s[s.length-1];if(v-m.strippedStart===m.strippedToRaw.length)return{node:m.node,rawOffset:m.strippedToRaw[m.strippedToRaw.length-1]+1}}return null}const y=[];for(const v of l){const b=w(v.start),p=w(v.end);if(!b||!p)continue;const m=f.createRange();m.setStart(b.node,b.rawOffset),m.setEnd(p.node,p.rawOffset),y.push(m)}if(y.length===0){u.delete(i);return}const A=new Highlight(...y);u.set(i,A)}function ht(n,l=200){let t=[n],i=0;return{record(u,s){if(s&&i===t.length-1){t[i]=u;return}t=t.slice(0,i+1),t.push(u),t.length>l?t.shift():i++},undo(){return i===0?null:(i--,t[i])},redo(){return i>=t.length-1?null:(i++,t[i])},reset(u){t=[u],i=0},canUndo(){return i>0},canRedo(){return i<t.length-1},size(){return t.length}}}var pt=S("<style>"),ft=S(`<style>
3
+ .kai-composer-pill {
4
+ display: inline-flex; align-items: center; gap: 0.2rem;
5
+ /* middle (not baseline): a flex pill's baseline differs with/without an
6
+ icon, which misaligns adjacent pills \u2014 middle aligns them consistently. */
7
+ vertical-align: middle; height: 1.5em;
8
+ /* Asymmetric margin: a roomier trailing gap (so typed text isn't flush
9
+ after a pill) + a smaller leading gap. */
10
+ margin: 0 0.3rem 0 0.1rem;
11
+ border-radius: 0.375rem;
12
+ font-weight: 500; white-space: nowrap; user-select: none; cursor: default;
13
+ box-sizing: border-box; line-height: 1;
14
+ }
15
+ /* Skills + agents: LIGHT \u2014 decorated inline text led by a sigil, NOT a
16
+ chip. A distinct colour per kind (overridable); the sigil is dimmer
17
+ than the label. (A GUI affords this richer-but-light look; a CLI can't.) */
18
+ .kai-composer-pill[data-kind="skill"],
19
+ .kai-composer-pill[data-kind="agent"] {
20
+ padding: 0 0.1rem; background: transparent;
21
+ /* Read like a command, not a title \u2014 lowercase the DISPLAY only; the
22
+ entity label + emitted payload keep the consumer's original casing. */
23
+ text-transform: lowercase;
24
+ }
25
+ .kai-composer-pill[data-kind="skill"] { color: var(--kai-pill-skill, #2563eb); }
26
+ .kai-composer-pill[data-kind="agent"] { color: var(--kai-pill-agent, #7c3aed); }
27
+ /* Brighter hues on dark so they don't muddy against a dark field. The
28
+ consumer's --kai-pill-* override still wins (it's the var value); only
29
+ the FALLBACK shifts per scheme.
30
+
31
+ Keyed on the kit's RESOLVED theme (the \`.dark\` wrapper an element
32
+ facade puts inside its shadow root, and the \`.dark\` class the docs /
33
+ Storybook put on &lt;html>) \u2014 NOT \`prefers-color-scheme\`. Those are
34
+ different questions: \`theme="light"\` on a machine whose OS is dark is
35
+ an ordinary, common configuration, and the media query answered the OS
36
+ while the surface under the pill answered the attribute. That painted
37
+ the DARK hue (#6ea8fe) on the LIGHT field: 2.33:1, under both the
38
+ 4.5:1 text floor (SC 1.4.3) and even 3:1. Matched pairs looked fine,
39
+ which is why it survived \u2014 never scheme-match a colour whose backdrop
40
+ is chosen by the theme attribute. */
41
+ .dark .kai-composer-pill[data-kind="skill"] { color: var(--kai-pill-skill, #6ea8fe); }
42
+ .dark .kai-composer-pill[data-kind="agent"] { color: var(--kai-pill-agent, #c4a7fc); }
43
+ /* Dimmer than the label, but the sigil is what makes a pill read as
44
+ \`/skill\` vs \`@agent\`, so it is a meaningful glyph and owes 3:1
45
+ (SC 1.4.11). At 0.6 the light-mode composite was 2.52:1. */
46
+ .kai-composer-pill-sigil { opacity: 0.8; font-weight: 600; }
47
+ /* Plugins (and any other/unknown kind): the richer CHIP \u2014 background +
48
+ icon \u2014 so a composite bundle reads differently at a glance. */
49
+ .kai-composer-pill:not([data-kind="skill"]):not([data-kind="agent"]) {
50
+ padding: 0 0.4rem;
51
+ background-color: color-mix(in srgb, currentColor 10%, transparent);
52
+ }
53
+ /* Selected (caret arrowed onto the pill): a highlight box, like Claude
54
+ Code web. Tinted by the pill's own colour via currentColor. */
55
+ .kai-composer-pill[data-selected] {
56
+ background-color: color-mix(in srgb, currentColor 18%, transparent);
57
+ box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 30%, transparent);
58
+ }
59
+ /* Fixed height + an icon never taller than the box \u2192 iconed and iconless
60
+ pills are exactly the same height (no baseline shift in the line). */
61
+ .kai-composer-pill-icon { width: 1em; height: 1em; flex-shrink: 0; }
62
+ img.kai-composer-pill-icon { border-radius: 9999px; object-fit: cover; }
63
+ .kai-composer-pill-glyph { display: inline-flex; align-items: center; justify-content: center; opacity: 0.8; }
64
+ .kai-composer-pill-glyph svg { width: 1em; height: 1em; display: block; }
65
+ /* The editable is the containing block for the placeholder pseudo-element. */
66
+ [data-kai-composer-editable] { position: relative; }
67
+ /* While a pill is arrow-selected the pill IS the selection, so hide the text
68
+ caret so a blinking cursor doesn't sit beside the highlight box. Returns
69
+ the moment the pill selection clears (arrow off, type, click, backspace). */
70
+ [data-kai-composer-editable][data-pill-selected] { caret-color: transparent; }
71
+ /* Placeholder via pseudo-element \u2014 exempt from axe color-contrast like a
72
+ native &lt;textarea> placeholder. position:absolute (with auto offsets =
73
+ its static text-origin spot) takes it OUT of flow, so the caret sits at
74
+ the START of the field instead of after the placeholder text. */
75
+ [data-kai-composer-editable].kai-composer-empty::before {
76
+ content: attr(data-placeholder);
77
+ position: absolute;
78
+ color: var(--color-muted-foreground, #9ca3af);
79
+ pointer-events: none;
80
+ }
81
+ `),gt=S("<div class=relative><div data-kai-composer-editable role=textbox aria-multiline=true>"),mt=S("<div role=listbox aria-label=Suggestions style=position:fixed>"),kt=S('<div class="px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground select-none">'),yt=S('<span class="text-muted-foreground truncate min-w-0">'),vt=S('<button role=option><span class="font-medium whitespace-nowrap shrink-0">'),bt=S('<span class="kai-composer-pill-glyph w-4 h-4 shrink-0"aria-hidden=true>'),xt=S('<img alt class="w-4 h-4 rounded object-cover shrink-0">'),wt=S("<div>");function E(n){var l;const t=n.getRootNode();return typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&typeof t.getSelection=="function"?t.getSelection():((l=n.ownerDocument)==null?void 0:l.getSelection())??null}function $e(n){let l="";const t=re(n);let i=t.nextNode();for(;i;)l+=(i.textContent??"").split(C).join(""),i=t.nextNode();return l}function ge(n){const l=E(n);if(!l||l.rangeCount===0)return 0;const t=l.getRangeAt(0);if(!t.collapsed)return 0;const{startContainer:i,startOffset:u}=t;let s=0;const h=re(n);let f=h.nextNode();for(;f;){if(f===i){const k=(f.textContent??"").slice(0,u);return s+=k.split(C).join("").length,s}s+=(f.textContent??"").split(C).join("").length,f=h.nextNode()}return s}function Ct(n){const l=n.ownerDocument,t=E(n);if(!t||t.rangeCount===0)return null;const i=t.getRangeAt(0).cloneRange();i.collapse(!0);const u=i.getClientRects();if(u.length>0&&(u[0].width>0||u[0].height>0))return u[0];const s=l.createElement("span");s.textContent="\u200B",s.style.position="absolute",s.style.visibility="hidden",i.insertNode(s);const h=s.getBoundingClientRect();return s.remove(),h.width>0||h.height>0?h:null}function Tt(n,l){const t=E(n);if(!t)return;const i=n.ownerDocument.createRange(),u=re(n);let s=l,h=u.nextNode(),f=!1;for(;h;){const k=h.textContent??"",x=k.split(C).join("").length;if(s<=x){let w=0,y=0;for(;w<k.length&&y<s;)k[w]!==C&&y++,w++;for(;w<k.length&&k[w]===C;)w++;i.setStart(h,w),f=!0;break}s-=x,h=u.nextNode()}f?i.collapse(!0):(i.selectNodeContents(n),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}function Rt(n){const l=Ye();let t;const[i,u]=z(),s=`kai-composer-highlight-${Je()}`,[h,f]=z(ne(M(n.value))),[k,x]=z(null),w=e=>{const r=k();r&&r!==e&&r.removeAttribute("data-selected"),e.setAttribute("data-selected",""),x(e)},y=()=>{const e=k();e&&(e.removeAttribute("data-selected"),x(null))},A=ht({doc:M(n.value),caret:0});let v=0;const b=500,[p,m]=z(null),[T,q]=z(0),R=Q(()=>{const e=p();if(!(e!=null&&e.def.items))return[];const r=new Set(he(L(t)).map(o=>`${o.kind}:${o.id}`)),a=e.query.toLowerCase();return e.def.items.filter(o=>{var c;const d=o.kind??e.def.kind;return r.has(`${d}:${o.id}`)?!1:a===""?!0:o.label.toLowerCase().includes(a)||(((c=o.description)==null?void 0:c.toLowerCase().includes(a))??!1)})}),Me=Q(()=>{const e=[];return R().forEach((r,a)=>{let o=e.find(c=>c.group===r.group);o||(o={group:r.group,items:[]},e.push(o)),o.items.push({item:r,index:a})}),e}),ie=Q(()=>R().length>0),me=e=>{var r;return e.kind??((r=p())==null?void 0:r.def.kind)??""},qe=e=>{var r;return e.icon??((r=n.kindIcons)==null?void 0:r[me(e)])};de(()=>{const e=R().length;T()>=e&&q(Math.max(0,e-1))});const Be=Q(()=>{const e=p();if(!e)return;const r=e.caretRect;return{getBoundingClientRect:()=>r}}),{pos:ke,hidden:Ke}=tt(Be,i,{placement:"bottom-start",gutter:4}),{present:je,state:He,setRef:Fe}=nt(ie);rt({enabled:ie,onDismiss:()=>B(),refs:()=>[t,i()]});function B(){var e;p()&&(m(null),(e=n.onTriggerClose)==null||e.call(n))}const K=()=>{const e=L(t);return{doc:e,text:te(e),entities:he(e)}};function X(){const e=n.highlights,r=e!=null&&e.length?st($e(t),e):[];ut(t,r,C,s)}ue(()=>{oe(t,M(n.value),t.ownerDocument,n.kindIcons),f(ne(L(t))),X(),A.reset({doc:L(t),caret:0})}),de(De(()=>n.value,e=>{te(M(e))!==te(L(t))&&(y(),oe(t,M(e),t.ownerDocument,n.kindIcons),f(ne(L(t))),X(),A.reset({doc:L(t),caret:0}))},{defer:!0})),de(De(()=>n.highlights,()=>X(),{defer:!0}));function ye(){var e;const r=n.triggers;if(!(r!=null&&r.length)){p()&&B();return}const a=$e(t),o=ge(t),c=at(a,o,r);if(c){const d=Ct(t);if(d){const g=p();m({def:c.def,query:c.query,start:c.start,caretRect:d}),(!g||g.def.char!==c.def.char||g.query!==c.query)&&((e=n.onTrigger)==null||e.call(n,{char:c.def.char,query:c.query,rect:d}))}}else p()&&B()}const W=e=>{var r;f(ne(e.doc)),(r=n.onChange)==null||r.call(n,e),ye(),X()},_e=()=>{y();const e=K();W(e);const r=Date.now();A.record({doc:e.doc,caret:ge(t)},r-v<b),v=r},ve=()=>{const e=K();W(e),A.record({doc:e.doc,caret:ge(t)},!1),v=0},be=e=>{y(),oe(t,e.doc,t.ownerDocument,n.kindIcons),Tt(t,e.caret),W(K()),v=0},ze=()=>{const e=A.undo();e&&be(e)},xe=()=>{const e=A.redo();e&&be(e)};let ae=!1;const Ge=e=>{var r;ae=!0,(r=n.onFocus)==null||r.call(n,e)},Pe=e=>{var r;ae=!1,y(),(r=n.onBlur)==null||r.call(n,e)};ue(()=>{const e=t.ownerDocument,r=()=>{ae&&ye()};e.addEventListener("selectionchange",r),Qe(()=>e.removeEventListener("selectionchange",r))}),ue(()=>{var e;(e=n.controllerRef)==null||e.call(n,{focus:r=>t.focus(r),blur:()=>t.blur(),clear:()=>{y(),oe(t,[],t.ownerDocument,n.kindIcons),W(K()),A.reset({doc:L(t),caret:0}),v=0},send:()=>{var r;return(r=n.onSubmit)==null?void 0:r.call(n,K())},insertEntity:r=>Ce(r)})});function we(e){const r=p();if(!r)return;const a={kind:e.kind??r.def.kind,id:e.id,label:e.label,icon:e.icon,promptText:e.promptText,data:e.data};Ce(a,{deleteBefore:1+r.query.length}),B()}const Ce=(e,r)=>{var a;const o=t.ownerDocument,c=E(t);if(!c||c.rangeCount===0)return;const d=c.getRangeAt(0);if(r!=null&&r.deleteBefore&&d.collapsed){let Y=r.deleteBefore,j=d.startContainer,_=d.startOffset;for(;Y>0&&j&&j.nodeType===3;){const Ve=j.textContent??"";for(;_>0&&Y>0;)_--,Ve[_]!==C&&Y--;if(Y>0){const J=j.previousSibling;if(J&&J.nodeType===3)j=J,_=(J.textContent??"").length;else break}}const ce=o.createRange();ce.setStart(j,_),ce.setEnd(d.startContainer,d.startOffset),ce.deleteContents()}const g=c.getRangeAt(0);g.collapsed||g.deleteContents();const I=Ie(o,e,n.kindIcons),D=o.createTextNode(C);g.insertNode(D),g.insertNode(I);const se=o.createRange();se.setStartAfter(D),se.collapse(!0),c.removeAllRanges(),c.addRange(se),(a=n.onEntityAdd)==null||a.call(n,e),ve()},V=e=>(e??"").split("").every(r=>r===C),F=e=>!!e&&e.nodeType===Node.TEXT_NODE&&V(e.textContent),Te=e=>{const{startContainer:r,startOffset:a}=e;if(r===t){let o=a-1;for(;F(t.childNodes[o]);)o--;const c=t.childNodes[o];return U(c)?c:null}if(r.nodeType===Node.TEXT_NODE){if(!V((r.textContent??"").slice(0,a)))return null;let o=r.previousSibling;for(;F(o);)o=o.previousSibling;return U(o)?o:null}return null},Re=e=>{const{startContainer:r,startOffset:a}=e;if(r===t){let o=a;for(;F(t.childNodes[o]);)o++;const c=t.childNodes[o];return U(c)?c:null}if(r.nodeType===Node.TEXT_NODE){if(!V((r.textContent??"").slice(a)))return null;let o=r.nextSibling;for(;F(o);)o=o.nextSibling;return U(o)?o:null}return null},Se=e=>{var r;const a=fe.get(e),o=e.nextSibling;o?.nodeType===Node.TEXT_NODE&&V(o.textContent)&&o.remove(),e.remove(),a&&((r=n.onEntityRemove)==null||r.call(n,a)),ve()},Ue=e=>{const r=E(t);if(!r)return;const a=t.ownerDocument.createRange();a.setStartBefore(e),a.collapse(!0),r.removeAllRanges(),r.addRange(a)},Ae=e=>{const r=E(t);if(!r)return;let a=e;for(;F(a.nextSibling);)a=a.nextSibling;const o=t.ownerDocument.createRange();o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o)},Xe=e=>{var r;if((e.metaKey||e.ctrlKey)&&(e.key==="z"||e.key==="Z")){e.preventDefault(),e.shiftKey?xe():ze();return}if((e.metaKey||e.ctrlKey)&&(e.key==="y"||e.key==="Y")){e.preventDefault(),xe();return}if(ie()&&R().length>0){if(e.key==="ArrowDown"){e.preventDefault(),q(o=>(o+1)%R().length);return}if(e.key==="ArrowUp"){e.preventDefault(),q(o=>(o-1+R().length)%R().length);return}if(e.key==="Enter"||e.key==="Tab"){const o=R();if(o.length>0){e.preventDefault(),e.stopPropagation(),we(o[T()]);return}}if(e.key==="Escape"){e.preventDefault(),B();return}}else if(p()&&e.key==="Escape"){e.preventDefault(),B();return}const a=k();if(a&&a.isConnected){if(e.key==="ArrowLeft"){e.preventDefault(),Ue(a),y();return}if(e.key==="ArrowRight"){e.preventDefault(),Ae(a),y();return}if(e.key==="Backspace"||e.key==="Delete"){e.preventDefault();const o=a.previousSibling;y(),Se(a);const c=E(t);if(c){const d=t.ownerDocument.createRange();o&&o.isConnected?d.setStartAfter(o):d.setStart(t,0),d.collapse(!0),c.removeAllRanges(),c.addRange(d)}return}if(e.key==="Escape"){e.preventDefault(),y();return}if(e.key==="Shift"||e.key==="Meta"||e.key==="Control"||e.key==="Alt")return;Ae(a),y()}if(!k()&&(e.key==="ArrowLeft"||e.key==="ArrowRight")&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey){const o=E(t);if(o&&o.rangeCount>0){const c=o.getRangeAt(0);if(c.collapsed){const d=e.key==="ArrowLeft"?Te(c):Re(c);if(d){e.preventDefault(),w(d);return}}}}if(e.key==="Backspace"||e.key==="Delete"){const o=E(t);if(!o||o.rangeCount===0)return;const c=o.getRangeAt(0);if(!c.collapsed)return;const d=e.key==="Backspace"?Te(c):Re(c);if(d){e.preventDefault(),Se(d);return}}if(e.key==="Enter"&&!e.shiftKey&&n.submitOnEnter!==!1){if(e.preventDefault(),n.disabled||n.loading)return;(r=n.onSubmit)==null||r.call(n,K())}},le=()=>n.maxHeight??240,We=()=>n.editableClass??P("text-foreground min-h-[44px] w-full text-start overflow-y-auto whitespace-pre-wrap break-words",Ze(l.proseSize()),n.bare?"kai-focus-inset":"outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"),Ee=[(()=>{var e=pt();return N(e,`
82
+ /* MARKED text, not selected text. Reads --color-highlight (overridable via
83
+ --kai-color-highlight), a warm <mark> yellow. It used to be a 22% tint of
84
+ --color-primary with a #6366f1 indigo fallback \u2014 but the kit's
85
+ --color-primary is a NEUTRAL (near-black in light, near-white in dark),
86
+ so the indigo the fallback implied never appeared and the highlight
87
+ rendered plain grey in both themes.
88
+
89
+ NO \`prefers-color-scheme\` here, deliberately \u2014 the same trap that put
90
+ the pill hues below at 2.33:1. The OS scheme and the kit's RESOLVED
91
+ theme are different questions, and \`theme="light"\` on a dark-OS machine
92
+ is an ordinary configuration; a scheme-keyed value would paint the dark
93
+ amber on the light field. The pills answer this by scoping to \`.dark\`,
94
+ which is NOT available here: \`::highlight()\` names a document-registered
95
+ highlight, so there is no wrapper to hang a descendant selector on.
96
+
97
+ It does not need one. \`--color-highlight\` reaches this pseudo through
98
+ highlight inheritance from the ORIGINATING element \u2014 the text inside the
99
+ \`.dark\` wrapper \u2014 so the token already answers the resolved theme,
100
+ verified by rendering the dark amber under \`theme="dark"\` with only the
101
+ LIGHT literal below as a fallback. The literal is therefore reachable
102
+ only when no kit stylesheet is loaded at all, and it is deliberately the
103
+ light one: an unstyled page is a white page, and guessing from the OS is
104
+ exactly the failure above. */
105
+ ::highlight(${s}) { background-color: var(--color-highlight, hsl(45 96% 78%)); }
106
+ `),e})(),ft(),(()=>{var e=gt(),r=e.firstChild;return r.addEventListener("blur",Pe),r.addEventListener("focus",Ge),r.$$mousedown=y,r.$$keydown=Xe,r.$$input=_e,Ne(a=>{var o;t=a,(o=n.editableRef)==null||o.call(n,a)},r),H(a=>{var o=k()?"":void 0,c=n.placeholder??"",d=n.disabled?!1:"plaintext-only",g=n.ariaLabel||n.placeholder||"Message input",I=P(We(),h()&&n.placeholder?"kai-composer-empty":""),D=typeof le()=="number"?`${le()}px`:String(le());return o!==a.e&&O(r,"data-pill-selected",a.e=o),c!==a.t&&O(r,"data-placeholder",a.t=c),d!==a.a&&O(r,"contenteditable",a.a=d),g!==a.o&&O(r,"aria-label",a.o=g),I!==a.i&&Z(r,a.i=I),D!==a.n&&ee(r,"max-height",a.n=D),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),e})(),$(G,{get when(){return je()},get children(){var e=mt();return Ne(r=>{u(r),Fe(r)},e),N(e,$(Oe,{get each(){return Me()},children:r=>[$(G,{get when(){return r.group},get children(){var a=kt();return N(a,()=>r.group),a}}),$(Oe,{get each(){return r.items},children:a=>(()=>{var o=vt(),c=o.firstChild;return o.$$click=d=>{d.preventDefault(),we(a.item)},o.$$mousedown=d=>d.preventDefault(),o.addEventListener("mouseenter",()=>q(a.index)),N(o,$(G,{get when(){return qe(a.item)},get fallback(){return $(G,{get when(){return Le(me(a.item))},children:d=>(()=>{var g=bt();return H(()=>g.innerHTML=d()),g})()})},children:d=>(()=>{var g=xt();return H(()=>O(g,"src",d())),g})()}),c),N(c,()=>a.item.label),N(o,$(G,{get when(){return a.item.description},get children(){var d=yt();return N(d,()=>a.item.description),d}}),null),H(d=>{var g=T()===a.index,I=a.index,D=P("w-full flex items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors",T()===a.index?"bg-muted text-foreground":"text-foreground hover:bg-muted");return g!==d.e&&O(o,"aria-selected",d.e=g),I!==d.t&&O(o,"data-index",d.t=I),D!==d.a&&Z(o,d.a=D),d},{e:void 0,t:void 0,a:void 0}),o})()})]})),H(r=>{var a=He(),o=P("absolute z-50 min-w-[240px] max-w-[420px] max-h-[320px] overflow-y-auto rounded-lg bg-card shadow-lg py-1","border border-border"),c=`${ke().x}px`,d=`${ke().y}px`,g=Ke()?"hidden":"visible";return a!==r.e&&O(e,"data-state",r.e=a),o!==r.t&&Z(e,r.t=o),c!==r.a&&ee(e,"left",r.a=c),d!==r.o&&ee(e,"top",r.o=d),g!==r.i&&ee(e,"visibility",r.i=g),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}})];return n.bare?Ee:(()=>{var e=wt();return N(e,Ee),H(()=>Z(e,P("kai-composer relative rounded-xl bg-surface p-2","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-0",n.disabled&&"cursor-not-allowed opacity-60"))),e})()}et(["input","keydown","mousedown","click"]);export{Rt as C,he as e,M as n,te as s};
@@ -0,0 +1 @@
1
+ import{q as L,s as N,k as v,j as T,x as O,o as H,c as d,E as U,S as f,i as l,a as $,b as F,d as q,F as G,u as A,t as h,e as J}from"./define-By-uL588.js";import{c as K}from"./cn-DN5AWfiS.js";import{B as D}from"./button-DkuOnGLy.js";import{u as P,a as Q,C as x,D as V}from"./use-card-resolution-DaZqAdWf.js";import{e as W}from"./card-routing-0YidER_3.js";import{t as X}from"./triangle-alert-DlQ68ppf.js";import{c as Y}from"./check-njkVdZu2.js";var Z=h('<div class="flex items-center gap-2 text-sm font-medium text-destructive dark:text-red-400"><span>Heads up'),_=h('<p class="text-sm font-semibold text-foreground">'),ee=h('<p class="text-sm text-muted-foreground">'),te=h("<div>"),re=h('<div class="flex w-full flex-wrap items-center justify-between gap-2"><div class="ml-auto flex flex-wrap items-center gap-2">'),ae=h('<div class="ml-auto flex items-center gap-2 text-sm font-medium text-foreground"><span>');const ne="confirm",ie=new Set(["primary","default","destructive"]);function de(o){switch(o){case"primary":return"default";case"destructive":return"destructive";case"default":case void 0:return"outline";default:return console.warn(`[kai-confirm] unknown action style "${o}"; using default`),"outline"}}function oe(o){if(!Array.isArray(o)||o.length===0)return{actions:[],error:"This card couldn't be displayed."};const c=new Set,r=[];for(const m of o){if(!m||typeof m!="object")continue;const i=m;if(typeof i.id!="string"||i.id.length===0||typeof i.label!="string"||i.label.length===0)continue;if(c.has(i.id)){console.warn(`[kai-confirm] duplicate action id "${i.id}" ignored`);continue}c.add(i.id);const g=ie.has(i.style)?i.style:void 0;i.style!==void 0&&g===void 0&&console.warn(`[kai-confirm] unknown action style "${String(i.style)}"; using default`),r.push({id:i.id,label:i.label,style:g,payload:i.payload,default:i.default===!0})}return r.length===0?{actions:[],error:"This card couldn't be displayed."}:{actions:r}}function se(o){var c;return(c=o.find(r=>r.default))==null?void 0:c.id}function le(o){const c=L({cardId:"kai-confirm",autofocus:!1},o),[r]=N(c,["data","cardId","heading","host","hostElement","autofocus","class","resolution","controllerRef"]),m=P(),i=e=>{const n=r.host??m;n?n.emit(e):r.hostElement&&W(r.hostElement,e)},g=v(()=>{var e;return oe((e=r.data)==null?void 0:e.actions)}),I=v(()=>g().error===void 0),C=v(()=>g().error??""),p=v(()=>g().actions),j=()=>{var e;return((e=r.data)==null?void 0:e.tone)??"default"},M=()=>j()==="danger",k=v(()=>se(p())),u=Q({prop:()=>r.resolution,data:()=>r.data}),z=v(()=>{const e=u.resolution();if(!e||e.kind!=="action")return;const n=p().find(t=>t.id===e.action);return{label:n?.label??e.action}});T(O(I,e=>{i(e?{kind:"ready",cardId:r.cardId}:{kind:"error",cardId:r.cardId,message:C()})}));const b=e=>{u.isResolved()||(i({kind:"action",cardId:r.cardId,action:e.id,...e.payload!==void 0?{payload:e.payload}:{}}),u.setLocal({kind:"action",action:e.id,...e.payload!==void 0?{payload:e.payload}:{}}))},E=()=>{u.isResolved()||(i({kind:"dismiss",cardId:r.cardId}),u.setLocal({kind:"dismissed"}))},R=()=>i({kind:"reopen",cardId:r.cardId});let S,y;const B=()=>y?y.querySelector('button[data-kai-default="true"]')??y.querySelector("button[data-action-id]"):null;return H(()=>{var e;(e=r.controllerRef)==null||e.call(r,{focus:n=>{var t;return(t=B())==null?void 0:t.focus(n)},confirm:n=>{const t=p(),a=n??k();if(a===void 0)return;const s=t.find(w=>w.id===a);s&&b(s)},dismiss:()=>E(),reopen:()=>R()})}),T(()=>{const e=r.hostElement;if(!e)return;const n=u.resolution();n&&n.kind==="action"?e.setAttribute("data-kai-resolved",n.action):e.removeAttribute("data-kai-resolved")}),d(f,{get when(){return I()},get fallback(){return d(x,{get heading(){return r.heading},get errorMessage(){return C()}})},get children(){return d(U,{fallback:()=>(i({kind:"error",cardId:r.cardId,message:"The card failed to render."}),d(x,{get heading(){return r.heading},errorMessage:"The card failed to render."})),get children(){return d(f,{get when(){return!u.isDeferred()},get fallback(){return d(V,{type:ne,get title(){return r.heading},onReopen:R})},get children(){return d(x,{get heading(){return r.heading},get actions(){return d(f,{get when(){return!u.isResolved()},get fallback(){return(()=>{var e=ae(),n=e.firstChild;return l(e,d(Y,{size:16,"aria-hidden":"true"}),n),l(n,()=>{var t;return(t=z())==null?void 0:t.label}),$(()=>q(e,"role",u.isOptimistic()?"status":void 0)),e})()},get children(){var e=re(),n=e.firstChild;l(e,d(f,{get when(){var a;return((a=r.data)==null?void 0:a.dismissible)===!0},get children(){return d(D,{type:"button",variant:"ghost","aria-label":"Dismiss",onClick:E,children:"Dismiss"})}}),n);var t=y;return typeof t=="function"?A(t,n):y=n,l(n,d(G,{get each(){return p()},children:a=>d(D,{type:"button",get variant(){return de(a.style)},get"data-action-id"(){return a.id},get"data-kai-default"(){return a.default?"true":void 0},ref:s=>{r.autofocus&&a.id===k()&&queueMicrotask(()=>s.focus())},onClick:()=>b(a),get children(){return a.label}})})),e}})},get children(){var e=te();e.$$keydown=t=>{if(t.key!=="Enter"||t.target.tagName==="BUTTON")return;const a=k();if(a===void 0)return;const s=p().find(w=>w.id===a);s&&b(s)};var n=S;return typeof n=="function"?A(n,e):S=e,l(e,d(f,{get when(){return M()},get children(){var t=Z(),a=t.firstChild;return l(t,d(X,{size:16,class:"shrink-0","aria-hidden":"true"}),a),t}}),null),l(e,d(f,{get when(){var t;return(t=r.data)==null?void 0:t.heading},get children(){var t=_();return l(t,()=>{var a;return(a=r.data)==null?void 0:a.heading}),t}}),null),l(e,d(f,{get when(){var t;return(t=r.data)==null?void 0:t.body},get children(){var t=ee();return l(t,()=>{var a;return(a=r.data)==null?void 0:a.body}),t}}),null),$(t=>{var a=K("flex flex-col gap-2",r.class),s=k()!==void 0?0:void 0;return a!==t.e&&F(e,t.e=a),s!==t.t&&q(e,"tabindex",t.t=s),t},{e:void 0,t:void 0}),e}})}})}})}})}J(["keydown"]);export{le as C};