@kitn.ai/ui 0.29.0 → 0.31.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 (280) hide show
  1. package/README.md +11 -7
  2. package/dist/{Icon-DObhsRtm.js → Icon-DJDuE_-x.js} +1 -1
  3. package/dist/action-icons-xkBBVKkF.js +1 -0
  4. package/dist/agent-tooling/construct/schema-url.d.ts +9 -0
  5. package/dist/agent-tooling/construct/schema.d.ts +76 -1
  6. package/dist/agent-tooling/construct/templates.d.ts +45 -0
  7. package/dist/arrow-down-DU6wOl-h.js +1 -0
  8. package/dist/arrow-left-DD46kN17.js +1 -0
  9. package/dist/artifact-DoUAr1Fd.js +1 -0
  10. package/dist/assets/dev-DwzHsqYD.js +553 -0
  11. package/dist/{attachments-Qr4kg-2b.js → attachments-BLWPDiLH.js} +1 -1
  12. package/dist/{audio-visualizer-DToYdfSc.js → audio-visualizer-DhHicYvV.js} +1 -1
  13. package/dist/{badge-CdEu_jn2.js → badge-BGm7pcwi.js} +1 -1
  14. package/dist/{bell-DQAAOpDz.js → bell-CMEdSo7A.js} +1 -1
  15. package/dist/builder-app/App.d.ts +1 -0
  16. package/dist/builder-app/edit-guard.d.ts +8 -0
  17. package/dist/builder-app/main.d.ts +0 -0
  18. package/dist/builder-page/assets/index-C10OF-ur.js +72 -0
  19. package/dist/builder-page/assets/index-CFyKLBlu.css +1 -0
  20. package/dist/builder-page/index.html +20 -0
  21. package/dist/button-BM0YTTDQ.js +1 -0
  22. package/dist/{card-renderer-Jx70m6_l.js → card-renderer-Ds-wXc6_.js} +1 -1
  23. package/dist/check-BG1VfYjm.js +1 -0
  24. package/dist/{checkbox-group-B2_rpoPM.js → checkbox-group-CqXj8ehz.js} +1 -1
  25. package/dist/{checkbox-D7iRB3nL.js → checkbox-np_5mKxM.js} +1 -1
  26. package/dist/chevron-down-CZ4W0hy6.js +1 -0
  27. package/dist/chevron-right-5gdxkCTF.js +1 -0
  28. package/dist/{choice-card-m0BYqqOK.js → choice-card-BYBmPAT5.js} +1 -1
  29. package/dist/circle-C0lwjD2A.js +1 -0
  30. package/dist/circle-check-BfT1cxQU.js +1 -0
  31. package/dist/{circle-x-BPG0iPst.js → circle-x-DzUfvRqr.js} +1 -1
  32. package/dist/{code-block-ClMLKb7C.js → code-block-H6E5Eurc.js} +1 -1
  33. package/dist/{collapsible-B4DlWicL.js → collapsible-CBq1Tj6y.js} +1 -1
  34. package/dist/components/builder-composer-triggers.d.ts +62 -0
  35. package/dist/components/builder-layout.d.ts +54 -0
  36. package/dist/components/builder-message-actions.d.ts +63 -0
  37. package/dist/components/builder-panel-derived.d.ts +18 -0
  38. package/dist/components/builder-panel.d.ts +240 -0
  39. package/dist/components/builder-preview.d.ts +11 -0
  40. package/dist/components/builder-shell-controls.d.ts +69 -0
  41. package/dist/components/builder-skeleton.d.ts +58 -0
  42. package/dist/components/builder-start.d.ts +79 -0
  43. package/dist/components/builder-workspace-variants.d.ts +23 -0
  44. package/dist/components/captions.d.ts +66 -0
  45. package/dist/components/chat-thread.d.ts +27 -1
  46. package/dist/components/construct-form-paths.d.ts +54 -0
  47. package/dist/components/message.d.ts +5 -0
  48. package/dist/{composer-sQ0HcvyG.js → composer-B5IvgxAF.js} +1 -1
  49. package/dist/{confirm-card-rQWDQsnC.js → confirm-card-B63pZIfG.js} +1 -1
  50. package/dist/construct-cli.es.js +469 -125
  51. package/dist/construct-templates.d.ts +5 -0
  52. package/dist/construct-templates.js +266 -0
  53. package/dist/construct.js +269 -86
  54. package/dist/{context-0kg4ZX1J.js → context-Byqor78j.js} +1 -1
  55. package/dist/controllable-C4BSt73s.js +1 -0
  56. package/dist/{conversation-item-BxwQLaFJ.js → conversation-item-piXZFRWa.js} +1 -1
  57. package/dist/{conversation-list-BCfGN1JU.js → conversation-list-B5yu9cPg.js} +1 -1
  58. package/dist/{copy-n9u9rqpi.js → copy-DfI2NYEX.js} +1 -1
  59. package/dist/{create-tween-uPkArjIG.js → create-tween-C4j96_Aj.js} +1 -1
  60. package/dist/{create-tween-C-q-JCM-.js → create-tween-CHleHI8m.js} +1 -1
  61. package/dist/{create-tween-CRrJXxBd.js → create-tween-DQ6lOhdl.js} +1 -1
  62. package/dist/{create-tween-DZ3RRDHD.js → create-tween-DyjTgkJi.js} +1 -1
  63. package/dist/custom-elements.json +40 -5
  64. package/dist/{default-input-CaMrJkgH.js → default-input-Bwmt8Lai.js} +1 -1
  65. package/dist/define-B3OpsIDE.js +1 -0
  66. package/dist/define.js +41 -41
  67. package/dist/define.server.js +46 -46
  68. package/dist/{disclosure-WUImBbDv.js → disclosure-ZSAlD4wg.js} +1 -1
  69. package/dist/{dropdown-wZVeJOMd.js → dropdown-CSRhiMN2.js} +1 -1
  70. package/dist/elements/agent-card.js +1 -1
  71. package/dist/elements/artifact.js +1 -1
  72. package/dist/elements/attachments.js +1 -1
  73. package/dist/elements/audio-visualizer.js +1 -1
  74. package/dist/elements/avatar.js +1 -1
  75. package/dist/elements/badge.js +1 -1
  76. package/dist/elements/button.js +1 -1
  77. package/dist/elements/card.js +1 -1
  78. package/dist/elements/cards.js +1 -1
  79. package/dist/elements/chain-of-thought.js +1 -1
  80. package/dist/elements/chat-actions.d.ts +12 -0
  81. package/dist/elements/chat-scope-picker.js +1 -1
  82. package/dist/elements/chat-types.d.ts +7 -2
  83. package/dist/elements/chat-workspace.js +1 -1
  84. package/dist/elements/chat.js +1 -1
  85. package/dist/elements/checkbox-group.js +1 -1
  86. package/dist/elements/checkbox.js +1 -1
  87. package/dist/elements/checkpoint.js +1 -1
  88. package/dist/elements/choice.js +1 -1
  89. package/dist/elements/coachmark.js +1 -1
  90. package/dist/elements/code-block.js +1 -1
  91. package/dist/elements/command.js +1 -1
  92. package/dist/elements/compare.js +1 -1
  93. package/dist/elements/composer.js +1 -1
  94. package/dist/elements/confirm-card.js +1 -1
  95. package/dist/elements/context-meter.js +1 -1
  96. package/dist/elements/conversation-item.js +1 -1
  97. package/dist/elements/conversation-list.js +1 -1
  98. package/dist/elements/dialog.js +1 -1
  99. package/dist/elements/dock.js +1 -1
  100. package/dist/elements/dropdown.js +1 -1
  101. package/dist/elements/editable-label.js +1 -1
  102. package/dist/elements/embed.js +1 -1
  103. package/dist/elements/empty.js +1 -1
  104. package/dist/elements/feedback-bar.js +1 -1
  105. package/dist/elements/file-tree.js +1 -1
  106. package/dist/elements/file-upload.js +1 -1
  107. package/dist/elements/form.js +1 -1
  108. package/dist/elements/hover-card.js +1 -1
  109. package/dist/elements/icon.js +1 -1
  110. package/dist/elements/image.js +1 -1
  111. package/dist/elements/input.js +1 -1
  112. package/dist/elements/kbd.js +1 -1
  113. package/dist/elements/link-preview.js +1 -1
  114. package/dist/elements/loader.js +1 -1
  115. package/dist/elements/markdown.js +1 -1
  116. package/dist/elements/menu.js +1 -1
  117. package/dist/elements/message-skills.js +1 -1
  118. package/dist/elements/message.js +1 -1
  119. package/dist/elements/model-switcher.js +1 -1
  120. package/dist/elements/nav.js +1 -1
  121. package/dist/elements/notice.js +1 -1
  122. package/dist/elements/pane-grid.js +1 -1
  123. package/dist/elements/pane-group.js +1 -1
  124. package/dist/elements/pane.js +1 -1
  125. package/dist/elements/popover.js +1 -1
  126. package/dist/elements/progress-bar.js +1 -1
  127. package/dist/elements/prompt-dock.js +1 -1
  128. package/dist/elements/prompt-input.js +1 -1
  129. package/dist/elements/prompt-suggestions.js +1 -1
  130. package/dist/elements/radio-group.js +1 -1
  131. package/dist/elements/reasoning.js +1 -1
  132. package/dist/elements/remote.js +1 -1
  133. package/dist/elements/resizable.js +1 -1
  134. package/dist/elements/response-stream.js +1 -1
  135. package/dist/elements/screen.js +1 -1
  136. package/dist/elements/scroll-area.js +1 -1
  137. package/dist/elements/scroll-button.js +1 -1
  138. package/dist/elements/search.js +1 -1
  139. package/dist/elements/segmented.js +1 -1
  140. package/dist/elements/select.js +1 -1
  141. package/dist/elements/separator.js +1 -1
  142. package/dist/elements/setting-item.js +1 -1
  143. package/dist/elements/settings-group.js +1 -1
  144. package/dist/elements/skeleton.js +1 -1
  145. package/dist/elements/slider.js +1 -1
  146. package/dist/elements/source.js +1 -1
  147. package/dist/elements/status.js +1 -1
  148. package/dist/elements/switch.js +1 -1
  149. package/dist/elements/tabs.js +1 -1
  150. package/dist/elements/tasks.js +1 -1
  151. package/dist/elements/text-shimmer.js +1 -1
  152. package/dist/elements/thinking-bar.js +1 -1
  153. package/dist/elements/thread.js +1 -1
  154. package/dist/elements/toast.js +1 -1
  155. package/dist/elements/tool.js +1 -1
  156. package/dist/elements/tooltip.js +1 -1
  157. package/dist/elements/voice-input.js +1 -1
  158. package/dist/elements/voice-output.js +1 -1
  159. package/dist/elements.d.ts +22 -10
  160. package/dist/{ellipsis-CbOpJnU3.js → ellipsis-CJ5QIjWo.js} +1 -1
  161. package/dist/{embed-CrfjkbUG.js → embed-6Vji0PfS.js} +1 -1
  162. package/dist/{external-link-ByXAwBBQ.js → external-link-BPTtTdet.js} +1 -1
  163. package/dist/{file-text-DMib2qwt.js → file-text-eVjcFDrK.js} +1 -1
  164. package/dist/{file-tree-CJqM2aP7.js → file-tree-a9tfWYmg.js} +1 -1
  165. package/dist/{folder-_BAb929C.js → folder-DN6Ilq6d.js} +1 -1
  166. package/dist/{form-DSZgZQZk.js → form-U1cwhcQx.js} +1 -1
  167. package/dist/{hover-card-BQbul9eq.js → hover-card-C5ptzZOZ.js} +1 -1
  168. package/dist/{icon-CdcfRhYI.js → icon-BOMrFp0D.js} +1 -1
  169. package/dist/index.js +2297 -2279
  170. package/dist/index.server.js +2102 -2084
  171. package/dist/{info-DsFjGuI_.js → info-DxzKsIHn.js} +1 -1
  172. package/dist/{input-DKbmkMos.js → input-aW72PACH.js} +1 -1
  173. package/dist/kai.es.js +1 -1
  174. package/dist/{kbd-PvdGhX4s.js → kbd-BP-6MwUs.js} +1 -1
  175. package/dist/{link-preview-DbM1866N.js → link-preview-CZaDilMG.js} +1 -1
  176. package/dist/{link-zF8PzWfF.js → link-rlN11N0B.js} +1 -1
  177. package/dist/loader-BdFK70fF.js +1 -0
  178. package/dist/{markdown-LMvmAyBk.js → markdown-DjEaoNz-.js} +1 -1
  179. package/dist/mcp.es.js +587 -111
  180. package/dist/message--Nlbemtp.js +1 -0
  181. package/dist/message-C88yTu2A.js +1 -0
  182. package/dist/message-circle-CZeVDN1f.js +1 -0
  183. package/dist/message-square-BXNBKC6i.js +1 -0
  184. package/dist/{minimize-2-BQRoBV1V.js → minimize-2-BxLOOSEf.js} +1 -1
  185. package/dist/{model-switcher-CMpCOYcB.js → model-switcher-BxRvub2A.js} +1 -1
  186. package/dist/{overlay-Cb-MkyDa.js → overlay-CDwKJtHN.js} +1 -1
  187. package/dist/{panel-right-i8warFxT.js → panel-right-BovedCwW.js} +1 -1
  188. package/dist/{paperclip-ByY3UVO6.js → paperclip-D0Xyjja2.js} +1 -1
  189. package/dist/play-DGJ4MgB2.js +1 -0
  190. package/dist/primitives/speech.d.ts +35 -0
  191. package/dist/primitives/use-auto-resize.d.ts +11 -0
  192. package/dist/{progress-bar-jVAHvMUf.js → progress-bar-D-aQfy5h.js} +1 -1
  193. package/dist/{prompt-suggestion-CD-qtNgC.js → prompt-suggestion-C6qLjMEQ.js} +1 -1
  194. package/dist/{radio-BsoBMhkF.js → radio-D1CkXISc.js} +1 -1
  195. package/dist/react/index.d.ts +22 -6
  196. package/dist/react.js +13 -13
  197. package/dist/{reasoning-4kBPtlTx.js → reasoning-DARmbgmE.js} +1 -1
  198. package/dist/register-impl-WcrdIihK.js +424 -0
  199. package/dist/{resizable-uPmY9VY-.js → resizable-Da6oSO2z.js} +1 -1
  200. package/dist/{rotate-ccw-B2xn93py.js → rotate-ccw-31ed1xK_.js} +1 -1
  201. package/dist/{rotate-cw-CMVLoCyH.js → rotate-cw-qkl39dw3.js} +1 -1
  202. package/dist/{scroll-area-BqLUo8ZZ.js → scroll-area-RrKnLYlA.js} +1 -1
  203. package/dist/{scroll-button-DslXiJyL.js → scroll-button--QeNjobK.js} +1 -1
  204. package/dist/{select-2cLRtPGT.js → select-CS_0mWW3.js} +1 -1
  205. package/dist/{separator-BWQtNJcM.js → separator-fT-zBypW.js} +1 -1
  206. package/dist/{settings-BBR63jLg.js → settings-dfkV_WDm.js} +1 -1
  207. package/dist/{settings-group-B2ciy-Iw.js → settings-group-CX694npG.js} +1 -1
  208. package/dist/{skeleton-CkHI-HgC.js → skeleton-BsqKD9TV.js} +1 -1
  209. package/dist/{slider-DDR9U-i0.js → slider-_EWfTH9H.js} +1 -1
  210. package/dist/{solid-DruVOXnf.js → solid-BITWG_VE.js} +4214 -3996
  211. package/dist/{solid-BzCFdL25.js → solid-CRFYWlBw.js} +5647 -5373
  212. package/dist/solid.d.ts +6 -0
  213. package/dist/solid.js +259 -254
  214. package/dist/solid.server.js +259 -254
  215. package/dist/{source-GEnFF528.js → source-Da1TFiuj.js} +1 -1
  216. package/dist/speech-CjbWuqG2.js +1 -0
  217. package/dist/{star-CilHq8GP.js → star-ZvSbbXS6.js} +1 -1
  218. package/dist/{store-Ciyk6eZG.js → store-DE5lcr9q.js} +1 -1
  219. package/dist/{switch-KkeQIbuH.js → switch-P_fsHqv3.js} +1 -1
  220. package/dist/{tasks-card-BrN4bggJ.js → tasks-card-B86qqyZm.js} +1 -1
  221. package/dist/text-shimmer-BAkw_65G.js +1 -0
  222. package/dist/textarea-Bkinatpi.js +1 -0
  223. package/dist/theme.tokens.css +22 -21
  224. package/dist/{thumbs-up-CsT9Wzb9.js → thumbs-up-CDGW7a4o.js} +1 -1
  225. package/dist/{toast-store-tgK6MuMv.js → toast-store-B94I50AO.js} +1 -1
  226. package/dist/{tool-DzUjIBT8.js → tool-CUiCeyi1.js} +1 -1
  227. package/dist/{tooltip-Bkkg_4t0.js → tooltip-B3wlQSPh.js} +1 -1
  228. package/dist/{trash-2-jBKxjGGQ.js → trash-2-Cu8yZmFQ.js} +1 -1
  229. package/dist/{triangle-alert-DlQ68ppf.js → triangle-alert-CCtDUUmn.js} +1 -1
  230. package/dist/ui/button-variant-names.d.ts +12 -0
  231. package/dist/ui/button.d.ts +6 -0
  232. package/dist/ui/color-field.d.ts +48 -0
  233. package/dist/ui/textarea.d.ts +4 -0
  234. package/dist/ui/toggle-chip.d.ts +40 -0
  235. package/dist/{upload-TcAHXv9W.js → upload-CxotJlLv.js} +1 -1
  236. package/dist/{use-card-resolution-DaZqAdWf.js → use-card-resolution-DILUvNyj.js} +1 -1
  237. package/dist/{variant-aurora-DbW_OWL2.js → variant-aurora-BGaXBBGf.js} +1 -1
  238. package/dist/{variant-aurora-BhLuYxJR.js → variant-aurora-BLcQmvkd.js} +1 -1
  239. package/dist/{variant-aurora-CNmfHhcx.js → variant-aurora-DZIfAtx1.js} +2 -2
  240. package/dist/{variant-aurora-D6GsdTPA.js → variant-aurora-DpoIW4ZX.js} +2 -2
  241. package/dist/{variant-custom-BRvaNHSi.js → variant-custom-BhtWdAxE.js} +1 -1
  242. package/dist/{variant-custom-DMTrEO5w.js → variant-custom-BtApuSyr.js} +2 -2
  243. package/dist/{variant-custom-DV2x254s.js → variant-custom-C-zS4ZtE.js} +2 -2
  244. package/dist/{variant-custom-BvYHR62b.js → variant-custom-swi9PXxU.js} +1 -1
  245. package/dist/{variant-wave-sp-qwsdI.js → variant-wave-7JCIwhpb.js} +1 -1
  246. package/dist/{variant-wave-BpDd8t3Z.js → variant-wave-BG4nGr6x.js} +1 -1
  247. package/dist/{variant-wave-BNMGrDfj.js → variant-wave-C32lM9G2.js} +2 -2
  248. package/dist/{variant-wave-CyBueXj9.js → variant-wave-Dl6jOiK3.js} +2 -2
  249. package/dist/x-C4niw05N.js +1 -0
  250. package/frameworks/react/index.tsx +12 -6
  251. package/kit-base.css +311 -0
  252. package/llms-full.txt +9 -6
  253. package/llms.txt +1 -1
  254. package/package.json +23 -4
  255. package/solid.css +48 -0
  256. package/src/elements/element-meta.json +39 -14
  257. package/theme.css +39 -23
  258. package/dist/action-icons-CcgNN2oT.js +0 -1
  259. package/dist/arrow-down-CjRU3JgV.js +0 -1
  260. package/dist/arrow-left-Bnpb1UEW.js +0 -1
  261. package/dist/artifact-Bwt7OgcR.js +0 -1
  262. package/dist/assets/dev-5XzXYR21.js +0 -91
  263. package/dist/button-DkuOnGLy.js +0 -1
  264. package/dist/check-njkVdZu2.js +0 -1
  265. package/dist/chevron-down-B72s6PXR.js +0 -1
  266. package/dist/chevron-right-BatuHzUm.js +0 -1
  267. package/dist/circle-check-B62pODB3.js +0 -1
  268. package/dist/circle-zx0ByzY9.js +0 -1
  269. package/dist/controllable-CnGpMF6r.js +0 -1
  270. package/dist/define-By-uL588.js +0 -1
  271. package/dist/loader-BM4CEz4G.js +0 -1
  272. package/dist/message-BSsgvHvf.js +0 -1
  273. package/dist/message-BYZECyek.js +0 -1
  274. package/dist/message-circle-DruwObfX.js +0 -1
  275. package/dist/message-square-BG6q6mlm.js +0 -1
  276. package/dist/play-BvKKq3fX.js +0 -1
  277. package/dist/register-impl-B1hLkrI8.js +0 -424
  278. package/dist/text-shimmer-Dcj1MHuq.js +0 -1
  279. package/dist/textarea-Dpvbngbg.js +0 -1
  280. package/dist/x-Z5UntkIJ.js +0 -1
@@ -0,0 +1,66 @@
1
+ import { JSX } from 'solid-js';
2
+ /**
3
+ * `Captions` — live closed-captioning: the text shown WHILE someone (the
4
+ * user or the agent) is speaking, distinct from a scrollback transcript.
5
+ * Built for the Voice template (`elements/builder-voice.stories.tsx`) but
6
+ * kept generic — any voice surface that wants a caption line can use this
7
+ * directly.
8
+ *
9
+ * - Driven by `segments`, oldest first — the LAST entry is the current
10
+ * line. Everything else is history, only rendered by `stacked`.
11
+ * - `variant` picks the chrome: `'lower-third'` (a semi-opaque bar, the
12
+ * broadcast-caption look), `'floating'` (a card that floats above a
13
+ * visualizer, `kai-elevation`), `'minimal'` (bare text, no chrome — the
14
+ * original shape this component shipped with), `'stacked'` (the last two
15
+ * lines of history fade in behind the current line, which stays full
16
+ * strength). Default `'minimal'`.
17
+ * - Speaker-aware via `data-speaker` + a small uppercase label ("You" /
18
+ * "Assistant") — NOT a color swap. Accent stays reserved for the
19
+ * visualizer per the owner's Voice-round instruction, so the distinction
20
+ * lives in the label and a subtle weight difference, both drawn from the
21
+ * muted/foreground tiers, never `text-primary`.
22
+ * - Interim (`final: false`) text renders `text-muted-foreground` / a hair
23
+ * lighter than a finalized line's `text-foreground`, so a caption visibly
24
+ * "settles" the moment the model (or the ASR) commits it.
25
+ * - Undefined/empty `segments`, or a current segment whose `text` is empty
26
+ * or whitespace-only, renders NOTHING — a real `<Show>` around a presence
27
+ * gate, not a hidden/zero-opacity node left in the DOM.
28
+ * - One `role="status"`/`aria-live="polite"` region, wrapping ONLY the
29
+ * current line — `stacked`'s history lines sit outside it
30
+ * (`aria-hidden="true"`) so they don't get re-announced every time the
31
+ * region's content changes. This mirrors `toast.tsx`'s
32
+ * `role="region"`/`aria-live="polite"` pattern (the kit's other
33
+ * speech-adjacent live region) rather than inventing a second policy, and
34
+ * is the ONLY live region this component renders — it says nothing about
35
+ * history, so it can't double-announce anything a transcript component
36
+ * elsewhere on the page is already announcing.
37
+ * - Appear/update reuses the kit's real exit-animation primitive,
38
+ * `createPresence` (`ui/overlay.tsx`), for the whole component's
39
+ * mount/unmount, and a keyed `<For>` around the current line so a NEW
40
+ * segment object (the same "new object per changed item" contract the
41
+ * rest of the kit's reactive props follow) retriggers its own
42
+ * `animate-in` rather than being silently patched in place. Both use the
43
+ * same already-compiled `animate-in ... data-[closed]:animate-out ...`
44
+ * Tailwind-animate classes `DropdownContent`/`DialogContent`/
45
+ * `HoverCardContent` use, and both carry `motion-reduce:animate-none` (the
46
+ * same pattern `screen.tsx`/`dialog.tsx` use) so `prefers-reduced-motion:
47
+ * reduce` turns the animation off entirely — the text still appears,
48
+ * updates and disappears, just without motion.
49
+ */
50
+ export interface CaptionSegment {
51
+ /** Whose speech this line represents. */
52
+ speaker: 'user' | 'assistant';
53
+ /** The line's text. Empty/whitespace on the CURRENT segment renders nothing. */
54
+ text: string;
55
+ /** Whether ASR/the model has committed this line. Default `true`. */
56
+ final?: boolean;
57
+ }
58
+ export type CaptionsVariant = 'lower-third' | 'floating' | 'minimal' | 'stacked';
59
+ export interface CaptionsProps {
60
+ /** Caption lines, oldest first. The last entry is the current line. */
61
+ segments?: CaptionSegment[];
62
+ /** Which visual treatment to render. Default `'minimal'`. */
63
+ variant?: CaptionsVariant;
64
+ class?: string;
65
+ }
66
+ export declare function Captions(props: CaptionsProps): JSX.Element;
@@ -4,7 +4,7 @@ import { MessageActionDetail } from '../primitives/message-feedback.js';
4
4
  import { RejectedAttachment } from '../elements/default-input.js';
5
5
  import { MediaTypeFilter } from '../wire/media-types.js';
6
6
  import { TriggerDef } from './composer.js';
7
- import { ChatMessage } from '../elements/chat-types.js';
7
+ import { ChatMessage, ChatMessageAction, CustomAction } from '../elements/chat-types.js';
8
8
  import { ProseSize } from '../primitives/chat-config.js';
9
9
  import { ModelOption, HomeConfig, HomeLinkEntry } from '../types.js';
10
10
  import { CardComponentMap } from '../primitives/card-registry.js';
@@ -230,6 +230,27 @@ export interface ChatThreadProps {
230
230
  /** Whether each message's action bar is always visible (`'always'`, default)
231
231
  * or only revealed on hover of that message row (`'hover'`). */
232
232
  actionsReveal?: 'always' | 'hover';
233
+ /** Role-scoped DEFAULT action bars (B-7b): a user message with no `actions`
234
+ * of its own gets `userActions`; an assistant message, `assistantActions`.
235
+ * A per-message `m.actions` OVERRIDES the role default (replace, not
236
+ * merge), so a message that sets `actions: []` renders NO action bar even
237
+ * when a role default is set. Set as JS properties. */
238
+ userActions?: (ChatMessageAction | CustomAction)[];
239
+ /** See `userActions`, the assistant-role default. */
240
+ assistantActions?: (ChatMessageAction | CustomAction)[];
241
+ /** Hide the citations row consecutive `source` parts collapse into
242
+ * (`part="citations"`, message.tsx). Named as a HIDE, not `sources:
243
+ * boolean`, so absence-means-default stays unambiguous: absent/false is
244
+ * today's rendering, byte-for-byte (B-8). */
245
+ hideSources?: boolean;
246
+ /** JSX rendered immediately BEFORE the composer region — the `emptyContent`
247
+ * escape-hatch pattern verbatim (plain JSX handed down inside the same
248
+ * tree, no Portal), for a caller composing ChatThread directly as a Solid
249
+ * component (B-9). Not reachable through `<kai-chat>` (JSX has no
250
+ * web-component consumer form — same boundary as `headerEndContent`). */
251
+ composerStart?: JSX.Element;
252
+ /** JSX rendered immediately AFTER the composer region (see composerStart). */
253
+ composerEnd?: JSX.Element;
233
254
  onValueChange?: (value: string) => void;
234
255
  onSubmit?: (detail: {
235
256
  value: string;
@@ -266,5 +287,10 @@ export interface ChatThreadController {
266
287
  * `onOpenChange={(open) => !open && controller.closeConversationsList()}`
267
288
  * at the call site covers all three with no per-path wiring. */
268
289
  closeConversationsList(): void;
290
+ /** Start a fresh conversation — the same path as the list view's "+ New
291
+ * conversation" row: clears the active id, returns to the chat view,
292
+ * and delivers `[]` through `onConversationLoad`. The imperative seam
293
+ * the construct shell palette's "New conversation" entry drives (B-10). */
294
+ startNewConversation(): void;
269
295
  }
270
296
  export declare function ChatThread(props: ChatThreadProps): JSX.Element;
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ import { Construct } from '../agent-tooling/construct/schema.js';
3
+ export declare function getAtPath(construct: Construct, path: string): unknown;
4
+ export declare function setAtPath(construct: Construct, path: string, value: unknown): Construct;
5
+ export declare function deleteAtPath(construct: Construct, path: string): Construct;
6
+ /** Registered copy of the schema's z.literal(true) leaves; the drift check
7
+ * (derivePresenceBooleanPaths) fails a new presence-style key until it is
8
+ * translated here. */
9
+ export declare const PRESENCE_BOOLEAN_PATHS: readonly ["capabilities.conversations", "home.recentConversation", "shell.commandPalette"];
10
+ export declare function readPresenceBoolean(c: Construct, path: string): boolean;
11
+ export declare function writePresenceBoolean(c: Construct, path: string, on: boolean): Construct;
12
+ export declare function derivePresenceBooleanPaths(): string[];
13
+ export declare const ANCHORED_BOOLEAN_DEFAULTS: Record<string, boolean>;
14
+ export declare function readAnchoredBoolean(c: Construct, path: string): boolean;
15
+ export declare function writeAnchoredBoolean(c: Construct, path: string, next: boolean): Construct;
16
+ export declare function unwrapSchema(node: z.ZodType): z.ZodType;
17
+ export declare function schemaNodeAt(path: string): z.ZodType | undefined;
18
+ export type ControlKind = {
19
+ kind: 'enum';
20
+ options: readonly string[];
21
+ } | {
22
+ kind: 'boolean';
23
+ } | {
24
+ kind: 'presence';
25
+ } | {
26
+ kind: 'string';
27
+ } | {
28
+ kind: 'string-list';
29
+ } | {
30
+ kind: 'section';
31
+ keys: readonly string[];
32
+ } | {
33
+ kind: 'complex';
34
+ };
35
+ export declare function controlKindFor(node: z.ZodType): ControlKind;
36
+ export type RuleVisibility = {
37
+ treatment: 'hide-section';
38
+ section: string;
39
+ } | {
40
+ treatment: 'disable-with-reason';
41
+ path: string;
42
+ reason: string;
43
+ } | {
44
+ treatment: 'show-requires';
45
+ path: string;
46
+ } | {
47
+ treatment: 'reject-only';
48
+ };
49
+ /** Keyed by CROSS_FIELD_RULES ids — the key-set-equality test in
50
+ * construct-form-paths.test.ts fails a new superRefine rule until the
51
+ * builder classifies it here (B-20's drift guard). `reject-only` means the
52
+ * panel surfaces the rule only through validation problems (duplicates,
53
+ * URL-scheme rejections — states the panel's own editors cannot produce). */
54
+ export declare const RULE_VISIBILITY: Record<string, RuleVisibility>;
@@ -122,6 +122,11 @@ export interface MessageBodyProps {
122
122
  /** `'always'` (default) keeps the bar visible; `'hover'` reveals it on parent
123
123
  * `.group` hover. */
124
124
  actionsReveal?: 'always' | 'hover';
125
+ /** Skip the citations row that consecutive `source` parts collapse into
126
+ * (`part="citations"`). The parts STAY in `parts` — the wire encoder
127
+ * still needs them, in order — only the rendering is skipped. Default
128
+ * absent/false: today's rendering, byte-for-byte (B-8). */
129
+ hideSources?: boolean;
125
130
  /** Fired with the built-in name or custom id when an action is clicked. */
126
131
  onAction?: (id: string) => void;
127
132
  /** The currently-active feedback vote, so the bar can mark like/dislike and
@@ -1,4 +1,4 @@
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:`
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-B3OpsIDE.js";import{c as P}from"./cn-DN5AWfiS.js";import{u as tt,c as nt,a as rt}from"./overlay-CDwKJtHN.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
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
3
  .kai-composer-pill {
4
4
  display: inline-flex; align-items: center; gap: 0.2rem;
@@ -1 +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};
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-B3OpsIDE.js";import{c as K}from"./cn-DN5AWfiS.js";import{B as D}from"./button-BM0YTTDQ.js";import{u as P,a as Q,C as x,D as V}from"./use-card-resolution-DILUvNyj.js";import{e as W}from"./card-routing-0YidER_3.js";import{t as X}from"./triangle-alert-CCtDUUmn.js";import{c as Y}from"./check-BG1VfYjm.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};