@kitn.ai/ui 0.30.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 (261) hide show
  1. package/README.md +1 -1
  2. package/dist/{Icon-BzBET3E-.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-DGjzHYUT.js → artifact-DoUAr1Fd.js} +1 -1
  10. package/dist/assets/dev-DwzHsqYD.js +553 -0
  11. package/dist/{attachments-YvXHlg88.js → attachments-BLWPDiLH.js} +1 -1
  12. package/dist/{audio-visualizer-9lz5IHsL.js → audio-visualizer-DhHicYvV.js} +1 -1
  13. package/dist/{badge-Dh_vp8A5.js → badge-BGm7pcwi.js} +1 -1
  14. package/dist/{bell-CT7_WUwS.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-DZVaGH2e.js → card-renderer-Ds-wXc6_.js} +1 -1
  23. package/dist/check-BG1VfYjm.js +1 -0
  24. package/dist/{checkbox-group-BiryEXPQ.js → checkbox-group-CqXj8ehz.js} +1 -1
  25. package/dist/{checkbox-Bu2T2e0U.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-CM6IjkmL.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-Bk-dA5Wf.js → circle-x-DzUfvRqr.js} +1 -1
  32. package/dist/{code-block-B26t-Q7q.js → code-block-H6E5Eurc.js} +1 -1
  33. package/dist/{collapsible-Bhc636Cf.js → collapsible-CBq1Tj6y.js} +1 -1
  34. package/dist/components/builder-message-actions.d.ts +9 -18
  35. package/dist/components/builder-panel-derived.d.ts +18 -0
  36. package/dist/components/builder-panel.d.ts +51 -0
  37. package/dist/components/builder-start.d.ts +14 -10
  38. package/dist/components/chat-thread.d.ts +27 -1
  39. package/dist/components/construct-form-paths.d.ts +54 -0
  40. package/dist/components/message.d.ts +5 -0
  41. package/dist/{composer-DMI85B6j.js → composer-B5IvgxAF.js} +1 -1
  42. package/dist/{confirm-card-B0YIAwXp.js → confirm-card-B63pZIfG.js} +1 -1
  43. package/dist/construct-cli.es.js +469 -125
  44. package/dist/construct-templates.d.ts +5 -0
  45. package/dist/construct-templates.js +266 -0
  46. package/dist/construct.js +269 -86
  47. package/dist/{context-DWgfhqWp.js → context-Byqor78j.js} +1 -1
  48. package/dist/controllable-C4BSt73s.js +1 -0
  49. package/dist/{conversation-item-BsOsVGmT.js → conversation-item-piXZFRWa.js} +1 -1
  50. package/dist/{conversation-list-aX3Vtc7L.js → conversation-list-B5yu9cPg.js} +1 -1
  51. package/dist/{copy-BmEwsNhJ.js → copy-DfI2NYEX.js} +1 -1
  52. package/dist/{create-tween-CNOAU3Fx.js → create-tween-C4j96_Aj.js} +1 -1
  53. package/dist/{create-tween-WfqiENls.js → create-tween-CHleHI8m.js} +1 -1
  54. package/dist/{create-tween-wlFtW9Kh.js → create-tween-DQ6lOhdl.js} +1 -1
  55. package/dist/{create-tween-zt79ba32.js → create-tween-DyjTgkJi.js} +1 -1
  56. package/dist/custom-elements.json +40 -5
  57. package/dist/{default-input-DMV5Eaze.js → default-input-Bwmt8Lai.js} +1 -1
  58. package/dist/define-B3OpsIDE.js +1 -0
  59. package/dist/define.js +2 -2
  60. package/dist/define.server.js +2 -2
  61. package/dist/{disclosure-NnACBxsC.js → disclosure-ZSAlD4wg.js} +1 -1
  62. package/dist/{dropdown-DT7G0RGR.js → dropdown-CSRhiMN2.js} +1 -1
  63. package/dist/elements/agent-card.js +1 -1
  64. package/dist/elements/artifact.js +1 -1
  65. package/dist/elements/attachments.js +1 -1
  66. package/dist/elements/audio-visualizer.js +1 -1
  67. package/dist/elements/avatar.js +1 -1
  68. package/dist/elements/badge.js +1 -1
  69. package/dist/elements/button.js +1 -1
  70. package/dist/elements/card.js +1 -1
  71. package/dist/elements/cards.js +1 -1
  72. package/dist/elements/chain-of-thought.js +1 -1
  73. package/dist/elements/chat-actions.d.ts +12 -0
  74. package/dist/elements/chat-scope-picker.js +1 -1
  75. package/dist/elements/chat-types.d.ts +7 -2
  76. package/dist/elements/chat-workspace.js +1 -1
  77. package/dist/elements/chat.js +1 -1
  78. package/dist/elements/checkbox-group.js +1 -1
  79. package/dist/elements/checkbox.js +1 -1
  80. package/dist/elements/checkpoint.js +1 -1
  81. package/dist/elements/choice.js +1 -1
  82. package/dist/elements/coachmark.js +1 -1
  83. package/dist/elements/code-block.js +1 -1
  84. package/dist/elements/command.js +1 -1
  85. package/dist/elements/compare.js +1 -1
  86. package/dist/elements/composer.js +1 -1
  87. package/dist/elements/confirm-card.js +1 -1
  88. package/dist/elements/context-meter.js +1 -1
  89. package/dist/elements/conversation-item.js +1 -1
  90. package/dist/elements/conversation-list.js +1 -1
  91. package/dist/elements/dialog.js +1 -1
  92. package/dist/elements/dock.js +1 -1
  93. package/dist/elements/dropdown.js +1 -1
  94. package/dist/elements/editable-label.js +1 -1
  95. package/dist/elements/embed.js +1 -1
  96. package/dist/elements/empty.js +1 -1
  97. package/dist/elements/feedback-bar.js +1 -1
  98. package/dist/elements/file-tree.js +1 -1
  99. package/dist/elements/file-upload.js +1 -1
  100. package/dist/elements/form.js +1 -1
  101. package/dist/elements/hover-card.js +1 -1
  102. package/dist/elements/icon.js +1 -1
  103. package/dist/elements/image.js +1 -1
  104. package/dist/elements/input.js +1 -1
  105. package/dist/elements/kbd.js +1 -1
  106. package/dist/elements/link-preview.js +1 -1
  107. package/dist/elements/loader.js +1 -1
  108. package/dist/elements/markdown.js +1 -1
  109. package/dist/elements/menu.js +1 -1
  110. package/dist/elements/message-skills.js +1 -1
  111. package/dist/elements/message.js +1 -1
  112. package/dist/elements/model-switcher.js +1 -1
  113. package/dist/elements/nav.js +1 -1
  114. package/dist/elements/notice.js +1 -1
  115. package/dist/elements/pane-grid.js +1 -1
  116. package/dist/elements/pane-group.js +1 -1
  117. package/dist/elements/pane.js +1 -1
  118. package/dist/elements/popover.js +1 -1
  119. package/dist/elements/progress-bar.js +1 -1
  120. package/dist/elements/prompt-dock.js +1 -1
  121. package/dist/elements/prompt-input.js +1 -1
  122. package/dist/elements/prompt-suggestions.js +1 -1
  123. package/dist/elements/radio-group.js +1 -1
  124. package/dist/elements/reasoning.js +1 -1
  125. package/dist/elements/remote.js +1 -1
  126. package/dist/elements/resizable.js +1 -1
  127. package/dist/elements/response-stream.js +1 -1
  128. package/dist/elements/screen.js +1 -1
  129. package/dist/elements/scroll-area.js +1 -1
  130. package/dist/elements/scroll-button.js +1 -1
  131. package/dist/elements/search.js +1 -1
  132. package/dist/elements/segmented.js +1 -1
  133. package/dist/elements/select.js +1 -1
  134. package/dist/elements/separator.js +1 -1
  135. package/dist/elements/setting-item.js +1 -1
  136. package/dist/elements/settings-group.js +1 -1
  137. package/dist/elements/skeleton.js +1 -1
  138. package/dist/elements/slider.js +1 -1
  139. package/dist/elements/source.js +1 -1
  140. package/dist/elements/status.js +1 -1
  141. package/dist/elements/switch.js +1 -1
  142. package/dist/elements/tabs.js +1 -1
  143. package/dist/elements/tasks.js +1 -1
  144. package/dist/elements/text-shimmer.js +1 -1
  145. package/dist/elements/thinking-bar.js +1 -1
  146. package/dist/elements/thread.js +1 -1
  147. package/dist/elements/toast.js +1 -1
  148. package/dist/elements/tool.js +1 -1
  149. package/dist/elements/tooltip.js +1 -1
  150. package/dist/elements/voice-input.js +1 -1
  151. package/dist/elements/voice-output.js +1 -1
  152. package/dist/elements.d.ts +22 -10
  153. package/dist/{ellipsis-6pJ7SxYT.js → ellipsis-CJ5QIjWo.js} +1 -1
  154. package/dist/{embed-BMje-nxj.js → embed-6Vji0PfS.js} +1 -1
  155. package/dist/{external-link-Beh9DKeR.js → external-link-BPTtTdet.js} +1 -1
  156. package/dist/{file-text-D1GPfZ8Q.js → file-text-eVjcFDrK.js} +1 -1
  157. package/dist/{file-tree-Dwj2lqg-.js → file-tree-a9tfWYmg.js} +1 -1
  158. package/dist/{folder-b6D8x1DY.js → folder-DN6Ilq6d.js} +1 -1
  159. package/dist/{form-DWgdxDXu.js → form-U1cwhcQx.js} +1 -1
  160. package/dist/{hover-card-CWRkqm40.js → hover-card-C5ptzZOZ.js} +1 -1
  161. package/dist/{icon-CL0jdhsf.js → icon-BOMrFp0D.js} +1 -1
  162. package/dist/index.js +1991 -1989
  163. package/dist/index.server.js +1886 -1884
  164. package/dist/{info-0cOUherQ.js → info-DxzKsIHn.js} +1 -1
  165. package/dist/{input-BH6Ru91Q.js → input-aW72PACH.js} +1 -1
  166. package/dist/kai.es.js +1 -1
  167. package/dist/{kbd-DRAnVtNX.js → kbd-BP-6MwUs.js} +1 -1
  168. package/dist/{link-preview-DODgRyV9.js → link-preview-CZaDilMG.js} +1 -1
  169. package/dist/{link-Dlr0vssB.js → link-rlN11N0B.js} +1 -1
  170. package/dist/{loader-KvJB6NrT.js → loader-BdFK70fF.js} +1 -1
  171. package/dist/{markdown-DX9tuJVj.js → markdown-DjEaoNz-.js} +1 -1
  172. package/dist/mcp.es.js +579 -107
  173. package/dist/message--Nlbemtp.js +1 -0
  174. package/dist/message-C88yTu2A.js +1 -0
  175. package/dist/message-circle-CZeVDN1f.js +1 -0
  176. package/dist/message-square-BXNBKC6i.js +1 -0
  177. package/dist/{minimize-2-CyOHJwcN.js → minimize-2-BxLOOSEf.js} +1 -1
  178. package/dist/{model-switcher-0hrKDiK2.js → model-switcher-BxRvub2A.js} +1 -1
  179. package/dist/{overlay-DBMFXie6.js → overlay-CDwKJtHN.js} +1 -1
  180. package/dist/{panel-right-t8SWJL6e.js → panel-right-BovedCwW.js} +1 -1
  181. package/dist/{paperclip-CdzuOjbU.js → paperclip-D0Xyjja2.js} +1 -1
  182. package/dist/play-DGJ4MgB2.js +1 -0
  183. package/dist/primitives/speech.d.ts +35 -0
  184. package/dist/{progress-bar-CiBtxMWT.js → progress-bar-D-aQfy5h.js} +1 -1
  185. package/dist/{prompt-suggestion-I_DHP21i.js → prompt-suggestion-C6qLjMEQ.js} +1 -1
  186. package/dist/{radio-C_p3n39l.js → radio-D1CkXISc.js} +1 -1
  187. package/dist/react/index.d.ts +22 -6
  188. package/dist/react.js +13 -13
  189. package/dist/{reasoning-BDwy_tIe.js → reasoning-DARmbgmE.js} +1 -1
  190. package/dist/register-impl-WcrdIihK.js +424 -0
  191. package/dist/{resizable-SYC-fStM.js → resizable-Da6oSO2z.js} +1 -1
  192. package/dist/{rotate-ccw-B1nwmwuY.js → rotate-ccw-31ed1xK_.js} +1 -1
  193. package/dist/{rotate-cw-CLAnBcm1.js → rotate-cw-qkl39dw3.js} +1 -1
  194. package/dist/{scroll-area-zRyXoLhI.js → scroll-area-RrKnLYlA.js} +1 -1
  195. package/dist/{scroll-button-jzrbYCG9.js → scroll-button--QeNjobK.js} +1 -1
  196. package/dist/{select-DM-0nEe0.js → select-CS_0mWW3.js} +1 -1
  197. package/dist/{separator-BToOOoOt.js → separator-fT-zBypW.js} +1 -1
  198. package/dist/{settings-PaGo_S4U.js → settings-dfkV_WDm.js} +1 -1
  199. package/dist/{settings-group-BFXGIfXq.js → settings-group-CX694npG.js} +1 -1
  200. package/dist/{skeleton-DYpmFnnm.js → skeleton-BsqKD9TV.js} +1 -1
  201. package/dist/{slider-ebutAmkQ.js → slider-_EWfTH9H.js} +1 -1
  202. package/dist/{solid-15v_3WVL.js → solid-BITWG_VE.js} +3073 -3006
  203. package/dist/{solid-5P-otgdi.js → solid-CRFYWlBw.js} +3865 -3797
  204. package/dist/solid.js +1 -1
  205. package/dist/solid.server.js +1 -1
  206. package/dist/{source-c1gpRl9h.js → source-Da1TFiuj.js} +1 -1
  207. package/dist/speech-CjbWuqG2.js +1 -0
  208. package/dist/{star-pcV_3LqF.js → star-ZvSbbXS6.js} +1 -1
  209. package/dist/{store-CSgbFFCg.js → store-DE5lcr9q.js} +1 -1
  210. package/dist/{switch-Bh2OdLV2.js → switch-P_fsHqv3.js} +1 -1
  211. package/dist/{tasks-card-CbqQAn2S.js → tasks-card-B86qqyZm.js} +1 -1
  212. package/dist/{text-shimmer-BSzgEnDH.js → text-shimmer-BAkw_65G.js} +1 -1
  213. package/dist/{textarea-DrYNt_0z.js → textarea-Bkinatpi.js} +1 -1
  214. package/dist/{thumbs-up-BL3-NenK.js → thumbs-up-CDGW7a4o.js} +1 -1
  215. package/dist/{toast-store-DkOlYczt.js → toast-store-B94I50AO.js} +1 -1
  216. package/dist/{tool-CeIWUVUe.js → tool-CUiCeyi1.js} +1 -1
  217. package/dist/{tooltip-GA-nmg06.js → tooltip-B3wlQSPh.js} +1 -1
  218. package/dist/{trash-2-CT66QWlm.js → trash-2-Cu8yZmFQ.js} +1 -1
  219. package/dist/{triangle-alert-CeHLWxhD.js → triangle-alert-CCtDUUmn.js} +1 -1
  220. package/dist/ui/button-variant-names.d.ts +12 -0
  221. package/dist/ui/button.d.ts +6 -0
  222. package/dist/{upload-9Csb0F0J.js → upload-CxotJlLv.js} +1 -1
  223. package/dist/{use-card-resolution-Zg0a08Z-.js → use-card-resolution-DILUvNyj.js} +1 -1
  224. package/dist/{variant-aurora-4VBQHIKV.js → variant-aurora-BGaXBBGf.js} +1 -1
  225. package/dist/{variant-aurora-LE3fqxgw.js → variant-aurora-BLcQmvkd.js} +1 -1
  226. package/dist/{variant-aurora-DBeCAQNk.js → variant-aurora-DZIfAtx1.js} +2 -2
  227. package/dist/{variant-aurora-FzHVXHby.js → variant-aurora-DpoIW4ZX.js} +2 -2
  228. package/dist/{variant-custom-DI5R0rln.js → variant-custom-BhtWdAxE.js} +1 -1
  229. package/dist/{variant-custom-WWnrrRHS.js → variant-custom-BtApuSyr.js} +2 -2
  230. package/dist/{variant-custom-BQkNuPpE.js → variant-custom-C-zS4ZtE.js} +2 -2
  231. package/dist/{variant-custom-AFRGcOBS.js → variant-custom-swi9PXxU.js} +1 -1
  232. package/dist/{variant-wave-wTP5v_jU.js → variant-wave-7JCIwhpb.js} +1 -1
  233. package/dist/{variant-wave-nSI2sfII.js → variant-wave-BG4nGr6x.js} +1 -1
  234. package/dist/{variant-wave-DuQV7DhQ.js → variant-wave-C32lM9G2.js} +2 -2
  235. package/dist/{variant-wave-DUCbH5oI.js → variant-wave-Dl6jOiK3.js} +2 -2
  236. package/dist/x-C4niw05N.js +1 -0
  237. package/frameworks/react/index.tsx +12 -6
  238. package/llms-full.txt +9 -6
  239. package/llms.txt +1 -1
  240. package/package.json +7 -3
  241. package/solid.css +17 -2
  242. package/src/elements/element-meta.json +39 -14
  243. package/dist/action-icons-DaW2pU6m.js +0 -1
  244. package/dist/arrow-down-D783iMJj.js +0 -1
  245. package/dist/arrow-left-0VLM5kyg.js +0 -1
  246. package/dist/assets/dev-5XzXYR21.js +0 -91
  247. package/dist/button-C_3te6fm.js +0 -1
  248. package/dist/check-CiEOVnEN.js +0 -1
  249. package/dist/chevron-down-CSobuZRG.js +0 -1
  250. package/dist/chevron-right-DR9ZAP-2.js +0 -1
  251. package/dist/circle-BC66EYF7.js +0 -1
  252. package/dist/circle-check-BqmahW0O.js +0 -1
  253. package/dist/controllable-BagRpyHv.js +0 -1
  254. package/dist/define-CI0y3eE4.js +0 -1
  255. package/dist/message-BqQ7Ot5q.js +0 -1
  256. package/dist/message-DkaGfBd8.js +0 -1
  257. package/dist/message-circle-BPpp5QKv.js +0 -1
  258. package/dist/message-square-BLbsd9BJ.js +0 -1
  259. package/dist/play-BXy1u7rW.js +0 -1
  260. package/dist/register-impl-DvEnhIxx.js +0 -424
  261. package/dist/x-eiO9V6J6.js +0 -1
@@ -151,6 +151,57 @@ export interface AcceptChip {
151
151
  * second one growing beside it.
152
152
  */
153
153
  export declare const ACCEPT_CHIPS: readonly AcceptChip[];
154
+ export declare function Section(props: {
155
+ title: string;
156
+ children: JSX.Element;
157
+ }): JSX.Element;
158
+ export declare function Field(props: {
159
+ label: string;
160
+ hint?: string;
161
+ children: JSX.Element;
162
+ }): JSX.Element;
163
+ export declare function Row(props: {
164
+ label: string;
165
+ children: JSX.Element;
166
+ muted?: boolean;
167
+ }): JSX.Element;
168
+ /** A minimal, reusable string-tag editor — the taglist pattern the spike
169
+ * proved out (`starters`). `capabilities.attachments.accept` moved to
170
+ * `AcceptTypeEditor` below (owner feedback, design round 2): raw MIME
171
+ * strings are a bad first surface for this audience. */
172
+ export declare function TagEditor(props: {
173
+ tags: string[];
174
+ onChange: (next: string[]) => void;
175
+ ariaLabel: string;
176
+ placeholder?: string;
177
+ }): JSX.Element;
178
+ /**
179
+ * `capabilities.attachments.accept` — chips for the common cases
180
+ * (`ACCEPT_CHIPS`) over a collapsed "Advanced" raw MIME-list editor.
181
+ *
182
+ * A chip lights up (`aria-pressed`) exactly when EVERY one of its patterns is
183
+ * present in `accept` — toggling it adds/removes that whole pattern group.
184
+ *
185
+ * Owner feedback (design round 5): the raw pattern list is no longer shown
186
+ * under the chips at all — it lives ONLY inside the "Advanced" disclosure,
187
+ * as an autosizing textarea (one MIME type/glob per line, not a comma
188
+ * string: each edit adds or removes a LINE rather than reflowing a long
189
+ * wrapped string, and a list copied from a spec or another tool's `accept`
190
+ * field is naturally one-per-line already; a pasted comma list still parses
191
+ * fine, `commitDraft` splits on either). A hand-added entry lives only
192
+ * there; no chip claims it.
193
+ */
194
+ export declare function AcceptTypeEditor(props: {
195
+ accept: string[];
196
+ onChange: (next: string[]) => void;
197
+ }): JSX.Element;
198
+ /** `home.links` — the array-of-objects hard case (RECOMMENDATION.md), as a
199
+ * small labeled-row repeater. Each row explicitly numbered ("Link N") so a
200
+ * scanning eye always knows which entry it's looking at. */
201
+ export declare function LinksEditor(props: {
202
+ links: BuilderHomeLink[];
203
+ onChange: (next: BuilderHomeLink[]) => void;
204
+ }): JSX.Element;
154
205
  /**
155
206
  * `BuilderPanel` — the visual construct builder's inspector: identity, layout,
156
207
  * theme, an optional Home tab, and capabilities. Pure props/callbacks, stub-
@@ -1,20 +1,20 @@
1
1
  import { JSX } from 'solid-js';
2
- export type BuilderTemplateId = 'widget' | 'inAppAssistant' | 'assistant' | 'research' | 'workspace' | 'voice' | 'scratch';
3
- /** The template ids that DO have a card — every `BuilderTemplateId` except
4
- * `'scratch'`, which has no illustration and never appears in
5
- * `BUILDER_TEMPLATES`. */
6
- export type BuilderCardTemplateId = Exclude<BuilderTemplateId, 'scratch'>;
2
+ import { TemplateId } from '../agent-tooling/construct/templates.js';
3
+ export type BuilderTemplateId = TemplateId | 'scratch';
4
+ /** The template ids that DO have a card — every registry id. */
5
+ export type BuilderCardTemplateId = TemplateId;
7
6
  export interface BuilderTemplate {
8
7
  id: BuilderCardTemplateId;
9
8
  name: string;
10
9
  description: string;
11
10
  }
12
- /** V1 templates, in build order (T-1: easiest to hardest, so controls
13
- * accumulate template to template). Names and one-liners are the T-4/T-7
14
- * copy this round exists to force into existence. Round P2 grows the set
15
- * from four to six (In-app assistant, Voice) and sharpens the four
16
- * existing one-liners for instant recognition. */
11
+ /** All six cards, DERIVED from the template registry (B-17b) id, name and
12
+ * one-liner are the registry's own; this module adds only the
13
+ * illustrations, which stay component-side keyed by id (SVGs are not
14
+ * registry data). The Labs story renders all six (T-1a); a real product
15
+ * surface renders BUILDABLE_BUILDER_TEMPLATES instead (menu-honesty). */
17
16
  export declare const BUILDER_TEMPLATES: readonly BuilderTemplate[];
17
+ export declare const BUILDABLE_BUILDER_TEMPLATES: readonly BuilderTemplate[];
18
18
  export interface BuilderStartProps {
19
19
  /** The currently selected template id, or unset for none yet. Controlled —
20
20
  * this component holds no selection state of its own. */
@@ -32,6 +32,10 @@ export interface BuilderStartProps {
32
32
  * navigate to.
33
33
  */
34
34
  onSelect: (id: BuilderTemplateId) => void;
35
+ /** Which cards to render. Defaults to BUILDABLE_BUILDER_TEMPLATES
36
+ * (menu-honest by default). The Labs story passes BUILDER_TEMPLATES (all
37
+ * six) explicitly to show the full catalog. */
38
+ templates?: readonly BuilderTemplate[];
35
39
  class?: string;
36
40
  }
37
41
  export declare const BLUEPRINT_BG: {
@@ -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-CI0y3eE4.js";import{c as P}from"./cn-DN5AWfiS.js";import{u as tt,c as nt,a as rt}from"./overlay-DBMFXie6.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-CI0y3eE4.js";import{c as K}from"./cn-DN5AWfiS.js";import{B as D}from"./button-C_3te6fm.js";import{u as P,a as Q,C as x,D as V}from"./use-card-resolution-Zg0a08Z-.js";import{e as W}from"./card-routing-0YidER_3.js";import{t as X}from"./triangle-alert-CeHLWxhD.js";import{c as Y}from"./check-CiEOVnEN.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};