@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
package/README.md CHANGED
@@ -75,7 +75,7 @@ The element bundle is a self-contained ES module — load it directly from [jsDe
75
75
  ```
76
76
 
77
77
  <!-- x-release-please-start-version -->
78
- The URLs above track the **latest** release — handy for trying things out. **For production, pin an exact version** (e.g. `@kitn.ai/ui@0.29.0/dist/kai.es.js`): pinned URLs are immutable and cached far more aggressively, and — since this package is pre-1.0 — pinning shields you from breaking changes in a future minor release.
78
+ The URLs above track the **latest** release — handy for trying things out. **For production, pin an exact version** (e.g. `@kitn.ai/ui@0.31.0/dist/kai.es.js`): pinned URLs are immutable and cached far more aggressively, and — since this package is pre-1.0 — pinning shields you from breaking changes in a future minor release.
79
79
  <!-- x-release-please-end -->
80
80
 
81
81
  > **Pin `0.25.0` or newer.** Every version from `0.14.1` through `0.24.0` is covered by a [critical security advisory](https://github.com/kitn-ai/ui/security/advisories) and is deprecated on npm. `npm install` warns you about a deprecated version; **a CDN fetch does not**, so an old pinned URL in a page keeps serving the vulnerable bundle silently.
@@ -96,7 +96,7 @@ import {
96
96
  Message, MessageContent,
97
97
  PromptInput, PromptInputTextarea, PromptInputActions,
98
98
  } from '@kitn.ai/ui';
99
- import '@kitn.ai/ui/theme.css'; // Tailwind-source; non-Tailwind builds import theme.tokens.css instead see "Which theme file"
99
+ import '@kitn.ai/ui/solid.css'; // Tailwind-source: tokens + base rules + the animation/typography plugins, see "Which theme file"
100
100
 
101
101
  function App() {
102
102
  const [input, setInput] = createSignal('');
@@ -315,17 +315,19 @@ Per element: `<kai-chat codeHighlight={false}>` renders code as plain text.
315
315
 
316
316
  ## Theming
317
317
 
318
- Visual appearance is driven by `--color-*` CSS custom properties in `theme.css`. Because inherited CSS pierces the Shadow DOM boundary, overriding tokens on `:root` rebrands the components even the web-component ones:
318
+ Every element reads its colors from `--color-*` custom properties, and each of those is defined on `:host` inside the shadow root as `var(--kai-color-*, <default>)`. A `:host` declaration beats anything inherited from the page, so setting `--color-primary` on `:root` does NOT reach the elements. Set the `--kai-` names instead; custom properties inherit through the shadow boundary and the `:host` fallback picks them up:
319
319
 
320
320
  ```css
321
321
  :root {
322
- --color-background: #0f0f0f;
323
- --color-primary: #7c3aed;
324
- --color-muted: #1e1e1e;
322
+ --kai-color-background: #0f0f0f;
323
+ --kai-color-primary: #7c3aed;
324
+ --kai-color-muted: #1e1e1e;
325
325
  }
326
326
  ```
327
327
 
328
- For web components the kit's CSS is injected into each shadow root automatically; the token stylesheet is optional and only themes host-page chrome / rebrands.
328
+ To rebrand one element rather than the page, target the element itself. A rule in the document (`kai-chat { --color-primary: #7c3aed }`) outranks the shadow root's `:host` rule, so the bare `--color-*` names work there.
329
+
330
+ The kit's CSS is injected into each shadow root automatically, so the token stylesheet is optional for web components. The unprefixed `--color-*` names it defines are for your own host-page chrome and the light-DOM SolidJS components, which have no shadow root.
329
331
 
330
332
  ### Which theme file
331
333
 
@@ -334,6 +336,8 @@ Two builds of the same tokens; the condition is whether **Tailwind processes the
334
336
  - **`@kitn.ai/ui/theme.css`** — Tailwind v4 source (`@theme` block; needs `tailwindcss` as a peer). Import it only in an app whose build runs Tailwind over its CSS. Served raw to a browser, the `@theme` block is discarded whole and the tokens never apply.
335
337
  - **`@kitn.ai/ui/theme.tokens.css`** — the compiled plain-CSS build of the same tokens, no toolchain requirements. Use it in every non-Tailwind bundler app and for `<link>`/CDN pages.
336
338
 
339
+ For the SolidJS components (Option B) import **`@kitn.ai/ui/solid.css`** instead of `theme.css`. It imports `theme.css` and adds what the `kai-*` elements carry in their shadow roots and a light-DOM app must compile itself: the form-control and focus-ring rules, `tw-animate-css` (overlay animations) and `@tailwindcss/typography` (`prose-*`). Those two are optional peer dependencies: `npm i -D tw-animate-css @tailwindcss/typography`. Keep the `@source` line pointing at the kit either way.
340
+
337
341
  ## For AI agents / LLMs
338
342
 
339
343
  The package ships a stdio MCP server too — `npx @kitn.ai/ui mcp` gives any MCP harness tools to look up the real `kai-*` API, scaffold a wired chat surface, theme it, and catch the classic mistakes:
@@ -1 +1 @@
1
- import{s as d,p as h,q as i,m as u,i as c,c as n,D as k,F as g,t as w}from"./define-By-uL588.js";var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},t=m,p=w("<svg>"),v=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),b=(...r)=>r.filter((e,s,o)=>!!e&&o.indexOf(e)===s).join(" "),f=r=>{const[e,s]=d(r,["color","size","strokeWidth","children","class","name","iconNode","absoluteStrokeWidth"]);return(()=>{var o=p();return h(o,i(t,{get width(){return e.size??t.width},get height(){return e.size??t.height},get stroke(){return e.color??t.stroke},get"stroke-width"(){return u(()=>!!e.absoluteStrokeWidth)()?Number(e.strokeWidth??t["stroke-width"])*24/Number(e.size):Number(e.strokeWidth??t["stroke-width"])},get class(){return b("lucide","lucide-icon",e.name!=null?`lucide-${v(e?.name)}`:void 0,e.class!=null?e.class:"")}},s),!0,!0),c(o,n(g,{get each(){return e.iconNode},children:([a,l])=>n(k,i({component:a},l))})),o})()},z=f;export{z as I};
1
+ import{s as d,p as h,q as i,m as u,i as c,c as n,D as k,F as g,t as w}from"./define-B3OpsIDE.js";var m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},t=m,p=w("<svg>"),v=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),b=(...r)=>r.filter((e,s,o)=>!!e&&o.indexOf(e)===s).join(" "),f=r=>{const[e,s]=d(r,["color","size","strokeWidth","children","class","name","iconNode","absoluteStrokeWidth"]);return(()=>{var o=p();return h(o,i(t,{get width(){return e.size??t.width},get height(){return e.size??t.height},get stroke(){return e.color??t.stroke},get"stroke-width"(){return u(()=>!!e.absoluteStrokeWidth)()?Number(e.strokeWidth??t["stroke-width"])*24/Number(e.size):Number(e.strokeWidth??t["stroke-width"])},get class(){return b("lucide","lucide-icon",e.name!=null?`lucide-${v(e?.name)}`:void 0,e.class!=null?e.class:"")}},s),!0,!0),c(o,n(g,{get each(){return e.iconNode},children:([a,l])=>n(k,i({component:a},l))})),o})()},z=f;export{z as I};
@@ -0,0 +1 @@
1
+ import{I as e}from"./Icon-DJDuE_-x.js";import{c as o,q as r}from"./define-B3OpsIDE.js";import{f as s,t as i,b as p,s as m,p as k}from"./trash-2-Cu8yZmFQ.js";import{c as d}from"./check-BG1VfYjm.js";import{c as n}from"./copy-DfI2NYEX.js";import{d as l}from"./rotate-cw-qkl39dw3.js";import{e as f}from"./ellipsis-CJ5QIjWo.js";import{l as c}from"./link-rlN11N0B.js";import{s as y}from"./star-ZvSbbXS6.js";import{t as h,a as v}from"./thumbs-up-CDGW7a4o.js";import{x as u}from"./x-C4niw05N.js";var g=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],M=a=>o(e,r(a,{name:"RefreshCw",iconNode:g})),R=M,L=[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]],N=a=>o(e,r(a,{name:"Reply",iconNode:L})),w=N,x=[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]],C=a=>o(e,r(a,{name:"Volume2",iconNode:x})),t=C;const b={copy:n,like:v,dislike:h,regenerate:R,edit:k,speak:t,share:m,bookmark:p,download:l,link:c,trash:i,check:d,x:u,star:y,flag:s,reply:w,more:f,"volume-2":t};function j(a){if(a)return b[a]}const q={copy:"Copy",like:"Like",dislike:"Dislike",regenerate:"Regenerate",edit:"Edit",speak:"Read aloud"};export{q as B,j as a};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The construct schema's published URL — a LEAF on purpose (the kit-pin.ts
3
+ * pattern, same reason as C-2's chat-actions const): templates.ts must stamp
4
+ * `$schema` on every starter (B-14) without a value import of schema.ts,
5
+ * whose top-level zod side effects esbuild cannot tree-shake past
6
+ * (create-kai's wizard.ts header records that failure). schema.ts re-exports
7
+ * this, so every existing import site keeps its one address.
8
+ */
9
+ export declare const CONSTRUCT_SCHEMA_URL = "https://ui.kitn.ai/schemas/construct/v1.json";
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const CONSTRUCT_SCHEMA_URL = "https://ui.kitn.ai/schemas/construct/v1.json";
2
+ export { CONSTRUCT_SCHEMA_URL } from './schema-url.js';
3
3
  export declare const ConstructSchema: z.ZodObject<{
4
4
  $schema: z.ZodOptional<z.ZodString>;
5
5
  name: z.ZodString;
@@ -32,6 +32,17 @@ export declare const ConstructSchema: z.ZodObject<{
32
32
  }, z.core.$strict>>;
33
33
  header: z.ZodOptional<z.ZodObject<{
34
34
  title: z.ZodOptional<z.ZodString>;
35
+ themeToggle: z.ZodOptional<z.ZodBoolean>;
36
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
+ label: z.ZodString;
38
+ variant: z.ZodOptional<z.ZodEnum<{
39
+ default: "default";
40
+ ghost: "ghost";
41
+ subtle: "subtle";
42
+ outline: "outline";
43
+ destructive: "destructive";
44
+ }>>;
45
+ }, z.core.$strict>>>;
35
46
  }, z.core.$strict>>;
36
47
  empty: z.ZodOptional<z.ZodObject<{
37
48
  title: z.ZodString;
@@ -74,6 +85,27 @@ export declare const ConstructSchema: z.ZodObject<{
74
85
  }>>;
75
86
  reasoningOpen: z.ZodOptional<z.ZodBoolean>;
76
87
  conversations: z.ZodOptional<z.ZodLiteral<true>>;
88
+ messageActions: z.ZodOptional<z.ZodObject<{
89
+ user: z.ZodOptional<z.ZodArray<z.ZodEnum<{
90
+ copy: "copy";
91
+ like: "like";
92
+ dislike: "dislike";
93
+ regenerate: "regenerate";
94
+ edit: "edit";
95
+ speak: "speak";
96
+ }>>>;
97
+ assistant: z.ZodOptional<z.ZodArray<z.ZodEnum<{
98
+ copy: "copy";
99
+ like: "like";
100
+ dislike: "dislike";
101
+ regenerate: "regenerate";
102
+ edit: "edit";
103
+ speak: "speak";
104
+ }>>>;
105
+ }, z.core.$strict>>;
106
+ sources: z.ZodOptional<z.ZodObject<{
107
+ strip: z.ZodOptional<z.ZodBoolean>;
108
+ }, z.core.$strict>>;
77
109
  }, z.core.$strict>>;
78
110
  cards: z.ZodOptional<z.ZodArray<z.ZodObject<{
79
111
  name: z.ZodString;
@@ -90,8 +122,51 @@ export declare const ConstructSchema: z.ZodObject<{
90
122
  launcherIcon: z.ZodOptional<z.ZodString>;
91
123
  defaultOpen: z.ZodOptional<z.ZodBoolean>;
92
124
  }, z.core.$strict>>;
125
+ aside: z.ZodOptional<z.ZodObject<{
126
+ position: z.ZodOptional<z.ZodEnum<{
127
+ start: "start";
128
+ end: "end";
129
+ }>>;
130
+ width: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strict>>;
132
+ shell: z.ZodOptional<z.ZodObject<{
133
+ commandPalette: z.ZodOptional<z.ZodLiteral<true>>;
134
+ userMenu: z.ZodOptional<z.ZodObject<{
135
+ name: z.ZodString;
136
+ plan: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strict>>;
138
+ }, z.core.$strict>>;
139
+ composer: z.ZodOptional<z.ZodObject<{
140
+ triggers: z.ZodOptional<z.ZodObject<{
141
+ slash: z.ZodOptional<z.ZodArray<z.ZodObject<{
142
+ id: z.ZodString;
143
+ label: z.ZodString;
144
+ description: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strict>>>;
146
+ mention: z.ZodOptional<z.ZodArray<z.ZodObject<{
147
+ id: z.ZodString;
148
+ label: z.ZodString;
149
+ description: z.ZodOptional<z.ZodString>;
150
+ }, z.core.$strict>>>;
151
+ }, z.core.$strict>>;
152
+ }, z.core.$strict>>;
93
153
  }, z.core.$strict>;
94
154
  export type Construct = z.infer<typeof ConstructSchema>;
155
+ /** One cross-field rule of the construct format (B-20). The table is the
156
+ * visibility layer's guard: the builder's RULE_VISIBILITY registry
157
+ * (src/components/construct-form-paths.ts) is keyed by these ids, and a
158
+ * key-set-equality test fails any new rule until the builder classifies
159
+ * it. `paths` names the dotted construct paths the rule READS — panel
160
+ * metadata, not zod mechanics. Bodies are the pre-table superRefine code
161
+ * verbatim; behavior (messages included) is pinned by schema.test.ts and
162
+ * the generated artifact is pinned byte-identical by verify:generated
163
+ * (superRefine never serializes into z.toJSONSchema output). */
164
+ export interface CrossFieldRule {
165
+ id: string;
166
+ paths: readonly string[];
167
+ check: (construct: Construct, ctx: z.RefinementCtx) => void;
168
+ }
169
+ export declare const CROSS_FIELD_RULES: readonly CrossFieldRule[];
95
170
  export interface ConstructProblem {
96
171
  /** Dotted path into the construct, '' for the root. */
97
172
  path: string;
@@ -0,0 +1,45 @@
1
+ import { Construct } from './schema.js';
2
+ export type TemplateId = 'widget' | 'inAppAssistant' | 'assistant' | 'research' | 'workspace' | 'voice';
3
+ export type BuildableTemplateId = Exclude<TemplateId, 'voice'>;
4
+ export interface TemplateVariant {
5
+ id: string;
6
+ name: string;
7
+ description: string;
8
+ starter: Construct;
9
+ }
10
+ /** One panel section: a stable id (phase 3's BuilderPanel keys its section
11
+ * registry off these — the shape builder-panel.tsx's sections already
12
+ * stubbed) plus the schema paths the section edits. */
13
+ export interface TemplateControlSection {
14
+ id: string;
15
+ paths: readonly string[];
16
+ }
17
+ export interface BuildableTemplate {
18
+ id: BuildableTemplateId;
19
+ name: string;
20
+ description: string;
21
+ availability: 'buildable';
22
+ starter: Construct;
23
+ variants?: readonly TemplateVariant[];
24
+ controls: readonly TemplateControlSection[];
25
+ }
26
+ export interface StoryOnlyTemplate {
27
+ id: Extract<TemplateId, 'voice'>;
28
+ name: string;
29
+ description: string;
30
+ availability: 'story-only';
31
+ }
32
+ export type TemplateEntry = BuildableTemplate | StoryOnlyTemplate;
33
+ export declare const TEMPLATES: readonly TemplateEntry[];
34
+ export declare function buildableTemplates(): readonly BuildableTemplate[];
35
+ export declare function templateById(id: TemplateId): TemplateEntry | undefined;
36
+ /**
37
+ * Derive a buildable template's family from a LOADED construct's own shape
38
+ * (T-3 forbids a template key in the file, so there is nothing else to read
39
+ * this from). Layout is the discriminant for four of the five buildable
40
+ * families; `fullscreen` splits further on `capabilities.sources` being
41
+ * present, the research template's one defining fact (see researchStarter's
42
+ * comment). `custom` and any unrecognized shape return undefined — the
43
+ * caller falls back to a neutral label rather than guessing.
44
+ */
45
+ export declare function inferTemplateId(c: Construct): BuildableTemplateId | undefined;
@@ -0,0 +1 @@
1
+ import{I as o}from"./Icon-DJDuE_-x.js";import{c as r,q as e}from"./define-B3OpsIDE.js";var m=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],p=a=>r(o,e(a,{name:"ArrowDown",iconNode:m})),t=p;export{t as a};
@@ -0,0 +1 @@
1
+ import{I as o}from"./Icon-DJDuE_-x.js";import{c as r,q as e}from"./define-B3OpsIDE.js";var m=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],t=a=>r(o,e(a,{name:"ArrowLeft",iconNode:m})),p=t;export{p as a};
@@ -0,0 +1 @@
1
+ import{q as J,s as he,g as k,k as y,j as F,x as Q,o as X,p as fe,i as c,c as a,S as g,t as v,d as p,a as z,b as Y,u as Z,m as ge,h as be,e as ve}from"./define-B3OpsIDE.js";import{c as H}from"./cn-DN5AWfiS.js";import{B as C}from"./button-BM0YTTDQ.js";import{C as me,a as pe}from"./code-block-H6E5Eurc.js";import{F as we}from"./file-tree-a9tfWYmg.js";import{L as xe}from"./loader-BdFK70fF.js";import{a as ke,i as ee}from"./url-scheme-policy-DR5DgvkM.js";import{a as ye}from"./arrow-left-DD46kN17.js";import{a as ze,r as Ce,h as Te,e as Fe,c as Pe,d as Se}from"./rotate-cw-qkl39dw3.js";import{e as re}from"./external-link-BPTtTdet.js";import{f as Oe}from"./file-text-eVjcFDrK.js";import{m as Re,a as je}from"./minimize-2-BxLOOSEf.js";const Ie="6.0.227",ne=`https://cdn.jsdelivr.net/npm/pdfjs-dist@${Ie}/build`,He=()=>import(/*@vite-ignore*/`${ne}/pdf.min.mjs`),Ne=`${ne}/pdf.worker.min.mjs`;let Ee=He,Me=Ne,N=null;function $e(){if(!N){const r=Ee;N=(async()=>{const t=await r(),e=t.default??t;return e.GlobalWorkerOptions.workerSrc=Me,e})()}return N}async function Be(r,t,e){const i=await(await $e()).getDocument({url:r}).promise;t.replaceChildren();const o=typeof window<"u"&&window.devicePixelRatio?window.devicePixelRatio:1;for(let s=1;s<=i.numPages;s++){const d=await i.getPage(s),u=d.getViewport({scale:1}),h=u.width>0?e/u.width:1,f=d.getViewport({scale:h*o}),b=document.createElement("canvas");b.width=Math.max(1,Math.floor(f.width)),b.height=Math.max(1,Math.floor(f.height)),b.setAttribute("role","img"),b.setAttribute("aria-label",`Page ${s}`),b.style.width="100%",b.style.height="auto",b.style.display="block";const w=b.getContext("2d");t.appendChild(b),await d.render({canvasContext:w,viewport:f}).promise}return{pages:i.numPages}}var Le=v('<div><div class="relative min-h-0 flex-1">'),Ue=v('<form class="min-w-0 flex-1"><label class=sr-only for=kai-artifact-path>Address</label><input id=kai-artifact-path name=kai-artifact-path type=text autocomplete=off placeholder="Enter a path or URL\u2026">'),De=v("<div class=flex-1 aria-hidden=true>"),Ae=v('<div role=tablist aria-label=View class="flex shrink-0 items-center gap-0.5 rounded-md bg-muted p-0.5">'),Ve=v('<div data-artifact-toolbar class="flex shrink-0 items-center gap-1.5 border-b border-border bg-surface px-2 py-1.5">'),We=v("<button type=button role=tab>"),Ke=v('<iframe class="absolute inset-0 h-full w-full border-0 bg-white">'),_e=v('<div class="absolute inset-0 flex"><div class="w-56 shrink-0 overflow-auto border-r border-border bg-surface-sunken py-1.5 kai-scrollbar-thin"></div><div class="min-w-0 flex-1 overflow-auto kai-scrollbar-thin">'),qe=v('<div class="flex h-full items-center justify-center p-6 text-sm text-muted-foreground">Select a file to view its source.'),Ge=v('<div class="flex h-full items-center justify-center p-6 text-sm text-muted-foreground">No source \u2014 this file (<!>) has no code view.'),Je=v('<div class="flex flex-wrap items-center justify-center gap-2"><a class="inline-flex h-8 items-center gap-1.5 rounded-md border border-border bg-background px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"target=_blank rel="noopener noreferrer">Open in new tab</a><a class="inline-flex h-8 items-center gap-1.5 rounded-md border border-border bg-background px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"download>Download'),Qe=v(`<div role=region aria-label="PDF preview unavailable"class="absolute inset-0 flex flex-col items-center justify-center gap-3 bg-card p-6 text-center"><div class="text-sm font-medium text-foreground"></div><div class="text-xs text-muted-foreground">Can't preview this PDF inline.`),Xe=v(`<div class="text-xs text-muted-foreground">Blocked: that address uses a scheme this viewer won't open.`),Ye=v('<div class="pointer-events-none absolute inset-0 flex items-center justify-center">'),Ze=v('<div class="absolute inset-0"><div role=region aria-label="PDF preview"tabindex=0 class="absolute inset-0 flex flex-col items-center gap-3 overflow-auto bg-surface-sunken p-3 kai-scrollbar-thin focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset">');const er="allow-scripts allow-forms";function E(r,t){console.warn(`[kai-artifact] blocked unsafe url in ${r}: ${t}`)}function rr(r,t){if(r.url)return r.url;if(!t)return r.path;try{return new URL(r.path,t).href}catch{return r.path}}function nr(r,t){if(!r)return!1;const e=t.find(o=>o.url===r||o.path===r);if(e?.type==="pdf")return!0;const i=r.split(/[?#]/)[0];return/\.pdf$/i.test(i)}function tr(r){const t=J({files:[],defaultTab:"preview",sandbox:er,showNav:!0,showReload:!0,showHome:!0,showPathField:!0,showTabs:!0,expandable:!1,openInTab:!1,standalone:!1,readonlyPath:!1,maximized:!1},r),[e,i]=he(t,["src","files","tab","defaultTab","activeFile","sandbox","iframeTitle","onNavigate","onTabChange","onFileSelect","maximized","onMaximizeChange","showNav","showReload","showHome","showPathField","showTabs","expandable","openInTab","standalone","readonlyPath","displayUrl","controllerRef","class"]),[o,s]=k(e.src?[e.src]:[]),[d,u]=k(e.src?0:-1),h=()=>o()[d()]??"",f=()=>d()>0,b=()=>d()<o().length-1,w=y(()=>{const n=h();return n&&ke(n)?(E("preview",n),""):n}),[P,M]=k(e.tab??e.defaultTab),[$,B]=k(e.activeFile),[ae,ie]=k(0),[S,O]=k(e.maximized??!1);F(()=>O(e.maximized??!1));const le=()=>{var n;const l=!S();O(l),(n=e.onMaximizeChange)==null||n.call(e,l)},L=y(()=>{const n=h();return!!n&&n!=="about:blank"&&ee(n)}),U=()=>{const n=h();if(!L()){n&&n!=="about:blank"&&E("openExternal",n);return}window.open(n,"_blank","noopener,noreferrer")},D=y(()=>e.expandable&&!e.standalone),oe=y(()=>e.showNav||e.showReload||e.showHome||e.showPathField||e.showTabs||D()||e.openInTab);let x;F(()=>{e.tab!==void 0&&M(e.tab)}),F(()=>B(e.activeFile)),F(Q(()=>e.src,n=>{n&&n!==h()&&T(n)},{defer:!0}));const A=n=>n===void 0?void 0:e.files.find(l=>l.path===n),V=y(()=>A($())),se=y(()=>{const n=V();return!!n&&n.type!=="image"&&n.type!=="pdf"&&typeof n.code=="string"});function T(n){if(n===h()){j();return}s(l=>[...l.slice(0,d()+1),n]),u(l=>l+1),R()}function R(){var n;x&&(x.src=w()||"about:blank"),(n=e.onNavigate)==null||n.call(e,h())}function de(n){var l;n!==P()&&(M(n),(l=e.onTabChange)==null||l.call(e,n))}function W(n,l){var m;B(n),(m=e.onFileSelect)==null||m.call(e,n),T(rr(l,e.src))}const K=()=>{f()&&(u(n=>n-1),R())},_=()=>{b()&&(u(n=>n+1),R())};function j(){var n;x&&(x.src="about:blank",x.src=w()||"about:blank"),ie(l=>l+1),(n=e.onNavigate)==null||n.call(e,h())}const q=()=>{e.src&&T(e.src)},G=n=>{var l;S()!==n&&(O(n),(l=e.onMaximizeChange)==null||l.call(e,n))};X(()=>{var n;(n=e.controllerRef)==null||n.call(e,{back:()=>K(),forward:()=>_(),reload:()=>j(),home:()=>q(),navigate:l=>T(l),selectFile:l=>{const m=A(l);m&&W(l,m)},openExternal:()=>U(),maximize:()=>G(!0),restore:()=>G(!1)})});const ue=()=>{var n,l;try{const m=(n=x?.contentWindow)==null?void 0:n.location.href;m&&m!=="about:blank"&&m!==h()&&(s(I=>[...I.slice(0,d()+1),m]),u(I=>I+1),(l=e.onNavigate)==null||l.call(e,m))}catch{}},ce=n=>{n.preventDefault();const l=n.currentTarget.elements.namedItem("kai-artifact-path");if(e.readonlyPath||e.displayUrl!=null){l&&(l.value=e.displayUrl??h());return}l&&l.value&&T(l.value)};return(()=>{var n=Le(),l=n.firstChild;return fe(n,J({get class(){return H("flex h-full w-full flex-col overflow-hidden bg-card text-card-foreground",e.standalone&&"rounded-xl border border-border",e.class)}},i),!1,!0),c(n,a(g,{get when(){return oe()},get children(){return a(ar,{url:()=>e.displayUrl??h(),tab:P,canBack:f,canForward:b,canHome:()=>!!e.src,onBack:K,onForward:_,onReload:j,onHome:q,onSubmitPath:ce,onTab:de,showNav:()=>e.showNav,showReload:()=>e.showReload,showHome:()=>e.showHome,showPathField:()=>e.showPathField,showTabs:()=>e.showTabs,showExpand:D,showOpenInTab:()=>e.openInTab,maximized:S,onToggleMaximize:le,canOpenInTab:L,onOpenInTab:U,readonlyPath:()=>e.readonlyPath||e.displayUrl!=null})}}),l),c(l,a(g,{get when(){return P()==="preview"},get fallback(){return a(lr,{get files(){return e.files},activeFile:$,activeFileObj:V,hasSource:se,onSelect:W})},get children(){return a(g,{get when(){return nr(h(),e.files)},get fallback(){return a(ir,{ref:m=>x=m,src:w,get sandbox(){return e.sandbox},get title(){return e.iframeTitle??"Artifact preview"},onLoad:ue})},get children(){return a(sr,{get url(){return h()},get reloadKey(){return ae()}})}})}})),n})()}function ar(r){return(()=>{var t=Ve();return c(t,a(g,{get when(){return r.showNav()},get children(){return[a(C,{variant:"ghost",size:"icon-sm","aria-label":"Back",get disabled(){return!r.canBack()},onClick:()=>r.onBack(),get children(){return a(ye,{size:16,"aria-hidden":"true"})}}),a(C,{variant:"ghost",size:"icon-sm","aria-label":"Forward",get disabled(){return!r.canForward()},onClick:()=>r.onForward(),get children(){return a(ze,{size:16,"aria-hidden":"true"})}})]}}),null),c(t,a(g,{get when(){return r.showReload()},get children(){return a(C,{variant:"ghost",size:"icon-sm","aria-label":"Reload",onClick:()=>r.onReload(),get children(){return a(Ce,{size:15,"aria-hidden":"true"})}})}}),null),c(t,a(g,{get when(){return r.showHome()},get children(){return a(C,{variant:"ghost",size:"icon-sm","aria-label":"Home",get disabled(){return!r.canHome()},onClick:()=>r.onHome(),get children(){return a(Te,{size:15,"aria-hidden":"true"})}})}}),null),c(t,a(g,{get when(){return r.showPathField()},get children(){var e=Ue(),i=e.firstChild,o=i.nextSibling;return e.addEventListener("submit",s=>r.onSubmitPath(s)),p(o,"spellcheck",!1),z(s=>{var d=r.readonlyPath()||void 0,u=r.readonlyPath()?"true":void 0,h=H("h-7 w-full rounded-md border border-border px-2.5 text-xs text-foreground font-mono outline-none",r.readonlyPath()?"bg-muted/40 cursor-default":"bg-background focus-visible:ring-2 focus-visible:ring-ring");return d!==s.e&&(o.readOnly=s.e=d),u!==s.t&&p(o,"aria-readonly",s.t=u),h!==s.a&&Y(o,s.a=h),s},{e:void 0,t:void 0,a:void 0}),z(()=>o.value=r.url()),e}}),null),c(t,a(g,{get when(){return!r.showPathField()},get children(){return De()}}),null),c(t,a(g,{get when(){return r.showExpand()},get children(){return a(C,{variant:"ghost",size:"icon-sm",get"aria-label"(){return r.maximized()?"Collapse":"Expand"},get"aria-expanded"(){return r.maximized()},onClick:()=>r.onToggleMaximize(),get children(){return a(g,{get when(){return r.maximized()},get fallback(){return a(je,{size:15,"aria-hidden":"true"})},get children(){return a(Re,{size:15,"aria-hidden":"true"})}})}})}}),null),c(t,a(g,{get when(){return r.showOpenInTab()},get children(){return a(C,{variant:"ghost",size:"icon-sm","aria-label":"Open in new tab",get disabled(){return!r.canOpenInTab()},onClick:()=>r.onOpenInTab(),get children(){return a(re,{size:15,"aria-hidden":"true"})}})}}),null),c(t,a(g,{get when(){return r.showTabs()},get children(){var e=Ae();return c(e,a(te,{label:"Preview",get icon(){return a(Fe,{size:14,"aria-hidden":"true"})},get selected(){return r.tab()==="preview"},onClick:()=>r.onTab("preview")}),null),c(e,a(te,{label:"Code",get icon(){return a(Pe,{size:14,"aria-hidden":"true"})},get selected(){return r.tab()==="code"},onClick:()=>r.onTab("code")}),null),e}}),null),t})()}function te(r){return(()=>{var t=We();return t.$$click=()=>r.onClick(),c(t,()=>r.icon,null),c(t,()=>r.label,null),z(e=>{var i=r.selected,o=H("inline-flex h-6 items-center gap-1.5 rounded px-2 text-xs font-medium transition-colors outline-none","focus-visible:ring-2 focus-visible:ring-ring",r.selected?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");return i!==e.e&&p(t,"aria-selected",e.e=i),o!==e.t&&Y(t,e.t=o),e},{e:void 0,t:void 0}),t})()}function ir(r){return(()=>{var t=Ke();t.addEventListener("load",()=>r.onLoad());var e=r.ref;return typeof e=="function"?Z(e,t):r.ref=t,z(i=>{var o=r.src()||"about:blank",s=r.sandbox,d=r.title;return o!==i.e&&p(t,"src",i.e=o),s!==i.t&&p(t,"sandbox",i.t=s),d!==i.a&&p(t,"title",i.a=d),i},{e:void 0,t:void 0,a:void 0}),t})()}function lr(r){return(()=>{var t=_e(),e=t.firstChild,i=e.nextSibling;return c(e,a(we,{get files(){return r.files},get activeFile(){return r.activeFile()},onSelect:(o,s)=>r.onSelect(o,s)})),c(i,a(g,{get when(){return r.activeFileObj()},get fallback(){return qe()},get children(){return a(g,{get when(){return r.hasSource()},get fallback(){return(()=>{var o=Ge(),s=o.firstChild,d=s.nextSibling;return d.nextSibling,c(o,()=>r.activeFileObj().type??"binary",d),o})()},get children(){return a(me,{class:"h-full rounded-none border-0",get children(){return a(pe,{get code(){return r.activeFileObj().code??""},get language(){return r.activeFileObj().language}})}})}})}})),t})()}function or(r){const t=()=>{const i=r.url.split(/[?#]/)[0];return i.slice(i.lastIndexOf("/")+1)||"document.pdf"},e=y(()=>{if(r.url){if(ee(r.url))return r.url;E("pdf fallback",r.url)}});return(()=>{var i=Qe(),o=i.firstChild;return o.nextSibling,c(i,a(Oe,{size:40,class:"text-muted-foreground","aria-hidden":"true"}),o),c(o,t),c(i,a(g,{get when(){return e()},get fallback(){return Xe()},get children(){var s=Je(),d=s.firstChild;d.firstChild;var u=d.nextSibling,h=u.firstChild;return c(d,a(re,{size:13,"aria-hidden":"true"}),null),c(u,a(Se,{size:13,"aria-hidden":"true"}),h),z(f=>{var b=e(),w=e();return b!==f.e&&p(d,"href",f.e=b),w!==f.t&&p(u,"href",f.t=w),f},{e:void 0,t:void 0}),s}}),null),i})()}function sr(r){const[t,e]=k("loading");let i,o=0,s;const d=async()=>{if(!i){e("error");return}const u=++o;e("loading");try{const h=i.clientWidth||600;await Be(r.url,i,h),u===o&&e("success")}catch{u===o&&e("error")}};return F(Q(()=>[r.url,r.reloadKey],()=>{d()})),X(()=>{if(!i||typeof ResizeObserver>"u")return;const u=new ResizeObserver(()=>{t()==="success"&&(clearTimeout(s),s=setTimeout(()=>{d()},200))});u.observe(i),be(()=>{u.disconnect(),clearTimeout(s),o++})}),(()=>{var u=Ze(),h=u.firstChild;return Z(f=>i=f,h),c(u,a(g,{get when(){return ge(()=>!0)()&&t()==="loading"},get children(){var f=Ye();return c(f,a(xe,{variant:"circular",size:"md"})),f}}),null),c(u,a(g,{get when(){return t()==="error"},get children(){return a(or,{get url(){return r.url}})}}),null),z(()=>p(h,"aria-busy",t()==="loading")),u})()}ve(["click"]);export{tr as A};