@kitn.ai/ui 0.26.0 → 0.27.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.
- package/README.md +16 -5
- package/bin/mcp.js +16 -3
- package/bin/route.js +23 -0
- package/bin/route.test.js +58 -0
- package/dist/{elements/chunks/Icon--Y8vsFal.js → Icon-BnFKqqtY.js} +1 -1
- package/dist/action-icons-CBskfBMz.js +1 -0
- package/dist/arrow-down-Br0qtpsz.js +1 -0
- package/dist/arrow-left-Dj7xgE12.js +1 -0
- package/dist/artifact-CvXEm1lS.js +1 -0
- package/dist/assets/dev-5XzXYR21.js +91 -0
- package/dist/attachments-C43ZegEq.js +1 -0
- package/dist/{elements/chunks/audio-visualizer-D7lB6mvR.js → audio-visualizer-B-79y1Tj.js} +1 -1
- package/dist/badge-BpUbq8c0.js +1 -0
- package/dist/bash-InADTalH.js +1 -6
- package/dist/bell-sn17Ip9v.js +1 -0
- package/dist/{elements/chunks/button-flUbeufF.js → button-BH6rN0U-.js} +1 -1
- package/dist/card-renderer-Cb1gQmth.js +1 -0
- package/dist/card-routing-DifQgS7n.js +1 -0
- package/dist/check-DPeeMUYx.js +1 -0
- package/dist/checkbox-Dc9Yov_B.js +1 -0
- package/dist/checkbox-group-B1kDLLYk.js +1 -0
- package/dist/chevron-down-CHSWk7ZT.js +1 -0
- package/dist/chevron-right-B7l_fMgx.js +1 -0
- package/dist/choice-card-BT3c1S8g.js +1 -0
- package/dist/circle-Bb0yOpqM.js +1 -0
- package/dist/circle-check-BGZpCiz7.js +1 -0
- package/dist/circle-x-wobWkoSx.js +1 -0
- package/dist/{elements/chunks/cn-CU7UAWzk.js → cn-DN5AWfiS.js} +1 -1
- package/dist/{elements/chunks/code-block-BdLiTitd.js → code-block-CUQ5mtv0.js} +1 -1
- package/dist/{elements/chunks/collapsible-BzbXpPzr.js → collapsible-CPJbf6FM.js} +1 -1
- package/dist/components/attachment-types.d.ts +7 -0
- package/dist/components/audio-visualizer/fit-scale.d.ts +1 -1
- package/dist/components/card-renderer.d.ts +13 -0
- package/dist/components/card.d.ts +4 -0
- package/dist/components/chat-thread.d.ts +46 -1
- package/dist/components/conversation-item.d.ts +19 -7
- package/dist/components/conversation-list.d.ts +17 -5
- package/dist/components/form-widgets.d.ts +67 -2
- package/dist/components/form.d.ts +48 -1
- package/dist/components/message.d.ts +25 -3
- package/dist/components/reasoning.d.ts +6 -0
- package/dist/components/scroll-button.d.ts +11 -0
- package/dist/components/thread.d.ts +5 -0
- package/dist/components/tool-types.d.ts +9 -0
- package/dist/composer-CjngLzal.js +106 -0
- package/dist/confirm-card-DCx_A4bU.js +1 -0
- package/dist/construct-cli.es.js +1169 -0
- package/dist/{elements/chunks/context-VLIL3sJ-.js → context-BY8V-Nlp.js} +1 -1
- package/dist/controllable-D43BKmtX.js +1 -0
- package/dist/conversation-list-D4lLU_yS.js +1 -0
- package/dist/copy-B6DO4PqB.js +1 -0
- package/dist/core-AYMC6_lb.js +12 -5874
- package/dist/{create-tween-CQED4T0g.js → create-tween-BPzaefTp.js} +1 -1
- package/dist/{create-tween-BFT6c-Y8.js → create-tween-CnMHviKB.js} +1 -1
- package/dist/{create-tween-CJNlzoaO.js → create-tween-D1aiGZZh.js} +1 -1
- package/dist/{elements/chunks/create-tween-c4Z8TDYz.js → create-tween-DUSQUKpr.js} +2 -2
- package/dist/css-M7EaDHN_.js +1 -6
- package/dist/custom-elements.json +1400 -218
- package/dist/default-input-CucQEOqH.js +1 -0
- package/dist/define-CGGX-7Vg.js +1 -0
- package/dist/define.d.ts +4 -0
- package/dist/define.js +510 -0
- package/dist/define.server.d.ts +5 -0
- package/dist/define.server.js +506 -0
- package/dist/{elements/chunks/disclosure-CcNbyLy0.js → disclosure-CbLtajUQ.js} +1 -1
- package/dist/{elements/chunks/dropdown-BgWTthUx.js → dropdown-BwhViJFd.js} +1 -1
- package/dist/elements/agent-card.js +1 -1
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/attachments.js +1 -1
- package/dist/elements/audio-visualizer.js +1 -1
- package/dist/elements/autoloader.js +1 -1
- package/dist/elements/avatar.js +1 -1
- package/dist/elements/badge.js +1 -1
- package/dist/elements/button.js +1 -1
- package/dist/elements/card.js +1 -1
- package/dist/elements/cards.js +1 -1
- package/dist/elements/chain-of-thought.js +1 -1
- package/dist/elements/chat-scope-picker.js +1 -1
- package/dist/elements/chat-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/checkbox-group.d.ts +1 -0
- package/dist/elements/checkbox-group.js +1 -0
- package/dist/elements/checkbox.d.ts +1 -0
- package/dist/elements/checkbox.js +1 -0
- package/dist/elements/checkpoint.js +1 -1
- package/dist/elements/choice.js +1 -1
- package/dist/elements/coachmark.js +1 -1
- package/dist/elements/code-block.js +1 -1
- package/dist/elements/command.js +1 -1
- package/dist/elements/compare.js +1 -1
- package/dist/elements/composer.js +1 -1
- package/dist/elements/confirm-card.js +1 -1
- package/dist/elements/context-meter.js +1 -1
- package/dist/elements/conversation-item.js +1 -1
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/define-entry.d.ts +12 -0
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/dock.js +101 -7
- package/dist/elements/dropdown.js +1 -1
- package/dist/elements/editable-label.js +1 -1
- package/dist/elements/element-data-types.d.ts +37 -0
- package/dist/elements/embed.js +1 -1
- package/dist/elements/empty.js +1 -1
- package/dist/elements/feedback-bar.js +1 -1
- package/dist/elements/file-tree.js +1 -1
- package/dist/elements/file-upload.js +1 -1
- package/dist/elements/form.js +1 -1
- package/dist/elements/hover-card.js +1 -1
- package/dist/elements/icon.js +1 -1
- package/dist/elements/image.js +1 -1
- package/dist/elements/input.js +1 -1
- package/dist/elements/kbd.js +1 -1
- package/dist/elements/link-preview.js +1 -1
- package/dist/elements/loader.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/menu.js +1 -1
- package/dist/elements/message-skills.js +1 -1
- package/dist/elements/message.js +1 -1
- package/dist/elements/model-switcher.js +1 -1
- package/dist/elements/nav.js +1 -1
- package/dist/elements/notice.js +1 -1
- package/dist/elements/pane-grid.d.ts +1 -0
- package/dist/elements/pane-grid.js +1 -0
- package/dist/elements/pane-group.js +1 -1
- package/dist/elements/pane.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/progress-bar.js +1 -1
- package/dist/elements/prompt-dock.js +1 -1
- package/dist/elements/prompt-input.js +1 -1
- package/dist/elements/prompt-suggestions.js +1 -1
- package/dist/elements/radio-group.d.ts +1 -0
- package/dist/elements/radio-group.js +1 -0
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +2 -2
- package/dist/elements/screen.js +1 -1
- package/dist/elements/scroll-area.js +1 -1
- package/dist/elements/scroll-button.js +1 -1
- package/dist/elements/search.js +1 -1
- package/dist/elements/segmented.js +1 -1
- package/dist/elements/select.d.ts +1 -0
- package/dist/elements/select.js +1 -0
- package/dist/elements/separator.js +1 -1
- package/dist/elements/setting-item.js +1 -1
- package/dist/elements/settings-group.js +1 -1
- package/dist/elements/skeleton.js +1 -1
- package/dist/elements/slider.d.ts +1 -0
- package/dist/elements/slider.js +1 -0
- package/dist/elements/slots.d.ts +1 -1
- package/dist/elements/source.js +1 -1
- package/dist/elements/status.js +1 -1
- package/dist/elements/switch.js +1 -1
- package/dist/elements/tabs.js +1 -1
- package/dist/elements/tasks.js +1 -1
- package/dist/elements/text-shimmer.js +1 -1
- package/dist/elements/thinking-bar.js +1 -1
- package/dist/elements/thread.js +1 -1
- package/dist/elements/toast.js +1 -1
- package/dist/elements/tool.js +1 -1
- package/dist/elements/tooltip.js +1 -1
- package/dist/elements/voice-input.js +1 -1
- package/dist/elements/voice-output.js +1 -1
- package/dist/elements.d.ts +362 -24
- package/dist/{elements/chunks/ellipsis-7gU33mL2.js → ellipsis-DFr4Vqr3.js} +1 -1
- package/dist/embed-5s_vU4J0.js +1 -0
- package/dist/engine-javascript-vq0WuIJl.js +14 -2516
- package/dist/{elements/chunks/external-link-CSOEsNlx.js → external-link-u9d85ORQ.js} +1 -1
- package/dist/file-text-CX7_x42o.js +1 -0
- package/dist/{elements/chunks/file-tree-zvB2i7P9.js → file-tree-D3kBjXI5.js} +1 -1
- package/dist/folder-V-YdIL8f.js +1 -0
- package/dist/form-BRNUMCN2.js +1 -0
- package/dist/github-dark-dimmed-DUshB20C.js +1 -4
- package/dist/github-light-JYsPkUQd.js +1 -4
- package/dist/hover-card-DaeiYrTA.js +1 -0
- package/dist/html-CPZ3oZQ7.js +1 -10
- package/dist/icon-BpixdZNq.js +1 -0
- package/dist/{elements/chunks/index-BCRhi84a.js → index-xu_pdcPi.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7330 -5852
- package/dist/index.server.js +5823 -4759
- package/dist/info-8mFsIjS3.js +1 -0
- package/dist/input-d1Yuu-hz.js +1 -0
- package/dist/javascript-C25yR2R2.js +1 -6
- package/dist/json-DxJze_jm.js +1 -6
- package/dist/kai.es.js +1 -1
- package/dist/kbd-961zMPFB.js +1 -0
- package/dist/link-DlZZBGaR.js +1 -0
- package/dist/{elements/chunks/link-preview-OQ9IEq0f.js → link-preview-DIIbV2Sd.js} +1 -1
- package/dist/loader-YQszHFaW.js +1 -0
- package/dist/{elements/chunks/markdown-DgBFaGAz.js → markdown-CVk1MPsj.js} +1 -1
- package/dist/mcp.es.js +1285 -79
- package/dist/message-CwKVEdZg.js +1 -0
- package/dist/message-DS8lzHc1.js +1 -0
- package/dist/message-circle-Xf8Q-vZp.js +1 -0
- package/dist/message-square-Cxnwgkns.js +1 -0
- package/dist/{elements/chunks/minimize-2-DPIUKTrT.js → minimize-2-UEZmP2QT.js} +1 -1
- package/dist/{elements/chunks/model-switcher-DsT8tFB0.js → model-switcher-Kk1jEQ5t.js} +1 -1
- package/dist/{elements/chunks/overlay-DuiwdXjm.js → overlay-C1od6LOz.js} +1 -1
- package/dist/panel-right-ryET0yyn.js +1 -0
- package/dist/paperclip-BDNoZFJP.js +1 -0
- package/dist/play-OFIvYXUQ.js +1 -0
- package/dist/primitives/card-data-types.d.ts +49 -0
- package/dist/primitives/card-routing.d.ts +1 -33
- package/dist/primitives/card-validate.d.ts +2 -2
- package/dist/primitives/chat-config.d.ts +29 -2
- package/dist/primitives/field-mask.d.ts +96 -0
- package/dist/primitives/field-semantics.d.ts +36 -0
- package/dist/primitives/input-mask.d.ts +46 -0
- package/dist/primitives/url-scheme-policy.d.ts +34 -0
- package/dist/primitives/use-resize-observer.d.ts +2 -2
- package/dist/progress-bar-BvYX0aoy.js +1 -0
- package/dist/prompt-suggestion-BRFu2lcu.js +1 -0
- package/dist/radio-DcL23cNJ.js +1 -0
- package/dist/react/index.d.ts +193 -19
- package/dist/react.js +216 -180
- package/dist/reasoning-Cackq4Rh.js +1 -0
- package/dist/register-impl-C7rENvPK.js +424 -0
- package/dist/{elements/chunks/resizable-D181b4fM.js → resizable-Cp9HUYih.js} +1 -1
- package/dist/rotate-ccw-0DLRDHH5.js +1 -0
- package/dist/rotate-cw-DOB9IGcU.js +1 -0
- package/dist/schemas/form.schema.json +21 -1
- package/dist/schemas/tool-defs.d.ts +11 -1
- package/dist/schemas.js +81 -81
- package/dist/scroll-area-emVmWP4K.js +1 -0
- package/dist/scroll-button-CeP_gv1x.js +1 -0
- package/dist/select-CWmu00tS.js +1 -0
- package/dist/{elements/chunks/separator-CeJHQqLW.js → separator-CE6vly6z.js} +1 -1
- package/dist/{elements/chunks/settings-CqaHgJF9.js → settings-CE-78SvZ.js} +1 -1
- package/dist/{elements/chunks/settings-group-CjqjLCOn.js → settings-group-ZFWNxFQR.js} +1 -1
- package/dist/{elements/chunks/skeleton-D8akBnKS.js → skeleton-BebdP4mf.js} +1 -1
- package/dist/slider-BAKRYUlz.js +1 -0
- package/dist/{solid-BtdqNZI7.js → solid-BE5ui6sy.js} +8727 -7212
- package/dist/{solid-CnavwBye.js → solid-DFhsce3O.js} +7015 -5886
- package/dist/solid.d.ts +10 -0
- package/dist/solid.js +240 -234
- package/dist/solid.server.js +240 -234
- package/dist/source-B0FlguSx.js +1 -0
- package/dist/star-CBMZvLuN.js +1 -0
- package/dist/state/index.d.ts +1 -1
- package/dist/state/mock.d.ts +32 -2
- package/dist/state.js +133 -108
- package/dist/{elements/chunks/store-Cjq0qwYN.js → store-7eoadydQ.js} +1 -1
- package/dist/svelte--5p79yCD.js +1 -15
- package/dist/switch-CViARZCy.js +1 -0
- package/dist/tasks-card-MjCcOhR_.js +1 -0
- package/dist/text-shimmer-DKlwRF2G.js +1 -0
- package/dist/textarea-3ay2Me2-.js +1 -0
- package/dist/theme.tokens.css +82 -13
- package/dist/{elements/chunks/thumbs-up-DX2Ijk3H.js → thumbs-up-DQcu2HMO.js} +1 -1
- package/dist/toast-store-C6yKOhbk.js +1 -0
- package/dist/{elements/chunks/tool-DKQ2D1DP.js → tool-BCYNlfKy.js} +1 -1
- package/dist/{elements/chunks/tooltip-B0G99y8w.js → tooltip-05zI4hjs.js} +1 -1
- package/dist/trash-2-BR1RxGky.js +1 -0
- package/dist/{elements/chunks/triangle-alert-F9cyUEyy.js → triangle-alert-DHohDOCy.js} +1 -1
- package/dist/tsx-B8rCNbgL.js +1 -6
- package/dist/typescript-RycA9KXf.js +1 -6
- package/dist/ui/checkbox-group.d.ts +83 -0
- package/dist/ui/checkbox.d.ts +40 -0
- package/dist/ui/dock.d.ts +22 -0
- package/dist/ui/icon.d.ts +3 -0
- package/dist/ui/input.d.ts +48 -2
- package/dist/ui/radio.d.ts +85 -0
- package/dist/ui/select.d.ts +71 -0
- package/dist/ui/slider.d.ts +65 -0
- package/dist/ui/switch.d.ts +9 -2
- package/dist/upload-BbGW6A_u.js +1 -0
- package/dist/url-scheme-policy-DHpoTJwB.js +1 -0
- package/dist/use-card-resolution-CJW4grFa.js +1 -0
- package/dist/{variant-aurora-B8II3-I1.js → variant-aurora-BUOVgPOB.js} +2 -2
- package/dist/{variant-aurora-CMNWOSJR.js → variant-aurora-CUsUJvFI.js} +2 -2
- package/dist/{variant-aurora-CcuDMWwQ.js → variant-aurora-CW2i4bfr.js} +1 -1
- package/dist/{elements/chunks/variant-aurora-qt6Zct8M.js → variant-aurora-xiMPty8f.js} +1 -1
- package/dist/{variant-custom-L16JLLZy.js → variant-custom-BQtOnmeO.js} +1 -1
- package/dist/{variant-custom-C714mqKl.js → variant-custom-CAm9L-E5.js} +2 -2
- package/dist/{variant-custom-BdvYC7af.js → variant-custom-CAnzzppW.js} +2 -2
- package/dist/{elements/chunks/variant-custom-tJp22_BQ.js → variant-custom-D91HjAKz.js} +1 -1
- package/dist/{variant-wave-ecwykeyL.js → variant-wave-Ca1Ls4_y.js} +2 -2
- package/dist/{variant-wave-D7ruiA1W.js → variant-wave-CxX39DKd.js} +2 -2
- package/dist/{elements/chunks/variant-wave-CaQ5ti39.js → variant-wave-DYyzIIZv.js} +1 -1
- package/dist/{variant-wave-2S4La2Ka.js → variant-wave-uY5crU_K.js} +1 -1
- package/dist/vue-BmIZj4XD.js +1 -33
- package/dist/x-C5m1JFgi.js +1 -0
- package/frameworks/react/index.tsx +198 -20
- package/llms-full.txt +1178 -21
- package/llms.txt +6 -3
- package/package.json +17 -4
- package/src/agent-tooling/catalog/invariants.ts +1 -1
- package/src/agent-tooling/catalog/surfaces.ts +72 -0
- package/src/agent-tooling/construct/cli-entry.ts +8 -0
- package/src/agent-tooling/construct/cli.ts +131 -0
- package/src/agent-tooling/construct/codegen.ts +1353 -0
- package/src/agent-tooling/construct/construct.v1.schema.json +250 -0
- package/src/agent-tooling/construct/dev.ts +148 -0
- package/src/agent-tooling/construct/fixtures/demo-widget.construct.json +7 -0
- package/src/agent-tooling/construct/fixtures/ops-console.construct.json +44 -0
- package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +23 -0
- package/src/agent-tooling/construct/schema.ts +371 -0
- package/src/agent-tooling/mcp/server.ts +2 -1
- package/src/agent-tooling/mcp/tools/construct.ts +130 -0
- package/src/agent-tooling/mcp/tools/debug.ts +126 -4
- package/src/agent-tooling/mcp/tools/reference.ts +104 -3
- package/src/agent-tooling/recipes/composed-thread.ts +714 -0
- package/src/agent-tooling/recipes/index.ts +22 -0
- package/src/agent-tooling/recipes/types.ts +32 -0
- package/src/agent-tooling/registry.ts +5 -0
- package/src/components/attachment-types.ts +7 -0
- package/src/components/audio-visualizer/fit-scale.ts +1 -1
- package/src/components/card-renderer.tsx +39 -8
- package/src/components/card.tsx +10 -2
- package/src/components/chat-scope-picker.tsx +2 -2
- package/src/components/chat-thread.tsx +72 -9
- package/src/components/choice-card.tsx +102 -37
- package/src/components/coachmark.tsx +1 -1
- package/src/components/code-block.tsx +2 -2
- package/src/components/composer.tsx +89 -15
- package/src/components/confirm-card.tsx +20 -4
- package/src/components/conversation-item.tsx +33 -9
- package/src/components/conversation-list.tsx +25 -10
- package/src/components/empty.tsx +14 -3
- package/src/components/file-tree.tsx +5 -1
- package/src/components/form-widgets.tsx +257 -195
- package/src/components/form.tsx +297 -9
- package/src/components/loader.tsx +12 -5
- package/src/components/message-skills.tsx +1 -1
- package/src/components/message.tsx +71 -11
- package/src/components/prompt-input.tsx +7 -1
- package/src/components/prompt-suggestion.tsx +4 -1
- package/src/components/reasoning.tsx +30 -3
- package/src/components/response-compare.tsx +2 -2
- package/src/components/scroll-button.tsx +56 -4
- package/src/components/source.tsx +6 -1
- package/src/components/tasks-card.tsx +58 -16
- package/src/components/thread.tsx +10 -1
- package/src/components/toast.tsx +1 -1
- package/src/components/tool-types.ts +9 -0
- package/src/elements/attachments.tsx +3 -1
- package/src/elements/chat-workspace.tsx +1 -1
- package/src/elements/chat.tsx +22 -4
- package/src/elements/checkbox-group.tsx +164 -0
- package/src/elements/checkbox.tsx +134 -0
- package/src/elements/compiled.css +1 -1
- package/src/elements/composer.tsx +12 -1
- package/src/elements/conversation-item.tsx +62 -22
- package/src/elements/conversation-list.tsx +2 -2
- package/src/elements/define-entry.ts +12 -0
- package/src/elements/dock.tsx +11 -0
- package/src/elements/element-data-types.ts +40 -0
- package/src/elements/element-manifest.json +24 -0
- package/src/elements/element-meta.json +736 -46
- package/src/elements/element-nonscalar.json +15 -0
- package/src/elements/element-types.d.ts +362 -24
- package/src/elements/feedback-bar.tsx +5 -0
- package/src/elements/icon-names.json +29 -0
- package/src/elements/input.tsx +312 -23
- package/src/elements/message.tsx +2 -0
- package/src/elements/pane-grid.tsx +111 -0
- package/src/elements/prompt-input.tsx +8 -2
- package/src/elements/radio-group.tsx +129 -0
- package/src/elements/register-impl.ts +6 -0
- package/src/elements/scroll-button.tsx +54 -6
- package/src/elements/select.tsx +165 -0
- package/src/elements/slider.tsx +171 -0
- package/src/elements/slots.ts +1 -1
- package/src/elements/styles.css +89 -3
- package/src/elements/thread.tsx +2 -0
- package/src/elements/toast.tsx +14 -1
- package/src/index.ts +2 -1
- package/src/primitives/card-data-types.ts +49 -0
- package/src/primitives/card-host.tsx +4 -2
- package/src/primitives/card-routing.ts +7 -56
- package/src/primitives/card-schemas/form.schema.json +21 -1
- package/src/primitives/card-validate.ts +10 -2
- package/src/primitives/chat-config.tsx +33 -6
- package/src/primitives/field-mask.ts +256 -0
- package/src/primitives/field-semantics.ts +115 -0
- package/src/primitives/input-mask.ts +853 -0
- package/src/primitives/toast-store.ts +66 -4
- package/src/primitives/url-scheme-policy.ts +70 -0
- package/src/primitives/use-resize-observer.ts +2 -2
- package/src/schemas/tool-defs.ts +12 -2
- package/src/solid.ts +10 -0
- package/src/state/index.ts +1 -1
- package/src/state/mock.ts +92 -6
- package/src/ui/agent-card.tsx +2 -2
- package/src/ui/avatar.tsx +1 -1
- package/src/ui/checkbox-group.tsx +153 -0
- package/src/ui/checkbox.tsx +63 -0
- package/src/ui/dock.tsx +145 -6
- package/src/ui/icon.tsx +53 -0
- package/src/ui/input.tsx +249 -9
- package/src/ui/kbd.tsx +1 -1
- package/src/ui/nav.tsx +1 -1
- package/src/ui/pane-group.tsx +2 -2
- package/src/ui/radio.tsx +150 -0
- package/src/ui/select.tsx +168 -0
- package/src/ui/slider.tsx +178 -0
- package/src/ui/switch.tsx +49 -18
- package/src/utils/cn.ts +11 -5
- package/theme.css +84 -13
- package/dist/elements/chunks/action-icons-D9u3OzYW.js +0 -1
- package/dist/elements/chunks/arrow-left-CVh1TeN7.js +0 -1
- package/dist/elements/chunks/artifact-BkYcfIlZ.js +0 -1
- package/dist/elements/chunks/attachments-DwfNlubq.js +0 -1
- package/dist/elements/chunks/badge-Q0-Cmwzz.js +0 -1
- package/dist/elements/chunks/bash-InADTalH.js +0 -1
- package/dist/elements/chunks/card-renderer-3Dyl-FpN.js +0 -1
- package/dist/elements/chunks/card-routing-BK09BdmL.js +0 -1
- package/dist/elements/chunks/check-B5kBPKeo.js +0 -1
- package/dist/elements/chunks/chevron-down-DZ1GS39h.js +0 -1
- package/dist/elements/chunks/chevron-right-CvP7OUd2.js +0 -1
- package/dist/elements/chunks/choice-card-D4QUIOWZ.js +0 -1
- package/dist/elements/chunks/circle-CDf9g6MQ.js +0 -1
- package/dist/elements/chunks/circle-check-CA47Nqbz.js +0 -1
- package/dist/elements/chunks/circle-x-CJ_HVbC8.js +0 -1
- package/dist/elements/chunks/composer-Byve-n8K.js +0 -69
- package/dist/elements/chunks/confirm-card-B0flE3MN.js +0 -1
- package/dist/elements/chunks/controllable-DTwTIlwp.js +0 -1
- package/dist/elements/chunks/conversation-item-BDztezOG.js +0 -1
- package/dist/elements/chunks/copy-Nf-kqxXH.js +0 -1
- package/dist/elements/chunks/core-AYMC6_lb.js +0 -12
- package/dist/elements/chunks/css-M7EaDHN_.js +0 -1
- package/dist/elements/chunks/default-input-C2iLFq0b.js +0 -1
- package/dist/elements/chunks/define-wjHR1MkU.js +0 -1
- package/dist/elements/chunks/download-C4V7tBdb.js +0 -1
- package/dist/elements/chunks/embed-D3KewsIJ.js +0 -1
- package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +0 -141
- package/dist/elements/chunks/file-text-D1G8khle.js +0 -1
- package/dist/elements/chunks/folder-WW2LGLid.js +0 -1
- package/dist/elements/chunks/form-CQirdC4W.js +0 -1
- package/dist/elements/chunks/github-dark-dimmed-DUshB20C.js +0 -1
- package/dist/elements/chunks/github-light-JYsPkUQd.js +0 -1
- package/dist/elements/chunks/hover-card-CJJkfHTK.js +0 -1
- package/dist/elements/chunks/html-CPZ3oZQ7.js +0 -1
- package/dist/elements/chunks/icon-Cfgmf4fa.js +0 -1
- package/dist/elements/chunks/info-DX3YMOt6.js +0 -1
- package/dist/elements/chunks/input-BtW9U6Sq.js +0 -1
- package/dist/elements/chunks/javascript-C25yR2R2.js +0 -1
- package/dist/elements/chunks/json-DxJze_jm.js +0 -1
- package/dist/elements/chunks/kbd-LGXwuT_V.js +0 -1
- package/dist/elements/chunks/link-2My69BqT.js +0 -1
- package/dist/elements/chunks/loader-iOxc_Tu-.js +0 -1
- package/dist/elements/chunks/message-VMZohrXx.js +0 -1
- package/dist/elements/chunks/message-circle-CpXMM-_n.js +0 -1
- package/dist/elements/chunks/message-square-DxcWtETQ.js +0 -1
- package/dist/elements/chunks/message-tZmV2A3p.js +0 -1
- package/dist/elements/chunks/paperclip-CRZVp4z_.js +0 -1
- package/dist/elements/chunks/progress-bar-DNy66e_E.js +0 -1
- package/dist/elements/chunks/prompt-suggestion-Bn64Nl7L.js +0 -1
- package/dist/elements/chunks/reasoning-Emn9N4-T.js +0 -1
- package/dist/elements/chunks/rotate-cw-CPWe37D9.js +0 -1
- package/dist/elements/chunks/scroll-area-ClZkZxIk.js +0 -1
- package/dist/elements/chunks/scroll-button-DPE-t3x_.js +0 -1
- package/dist/elements/chunks/share-CyfnNEqp.js +0 -1
- package/dist/elements/chunks/source-UWCvmVak.js +0 -1
- package/dist/elements/chunks/star-DoHFAikQ.js +0 -1
- package/dist/elements/chunks/svelte--5p79yCD.js +0 -1
- package/dist/elements/chunks/tasks-card-CmZ5xh6v.js +0 -1
- package/dist/elements/chunks/text-shimmer-DYn09zrz.js +0 -1
- package/dist/elements/chunks/textarea-skiGHURM.js +0 -1
- package/dist/elements/chunks/toast-store-CFnQpThX.js +0 -1
- package/dist/elements/chunks/tsx-B8rCNbgL.js +0 -1
- package/dist/elements/chunks/typescript-RycA9KXf.js +0 -1
- package/dist/elements/chunks/use-card-resolution-DoA2f_EU.js +0 -1
- package/dist/elements/chunks/vue-BmIZj4XD.js +0 -1
- package/dist/elements/chunks/x-B6UnOiLw.js +0 -1
- package/dist/llms/llms-full.txt +0 -2949
- package/dist/llms/llms.txt +0 -156
- package/dist/register-impl-DpE7icIb.js +0 -293
- package/dist/ui/stat.d.ts +0 -16
- package/src/ui/stat.tsx +0 -41
- /package/dist/{elements/chunks/card-tags-D8lZ-C_U.js → card-tags-D8lZ-C_U.js} +0 -0
- /package/dist/{elements/chunks/link-preview-DNILK391.js → link-preview-DNILK391.js} +0 -0
- /package/dist/{elements/chunks/slots-DaNjX0rc.js → slots-DaNjX0rc.js} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSX } from 'solid-js';
|
|
2
2
|
import { CardHost, CardResolution } from '../primitives/card-contract.js';
|
|
3
|
+
import { FieldSemanticType } from '../primitives/field-semantics.js';
|
|
3
4
|
import { FormDefinition, FormField } from '../primitives/card-data-types.js';
|
|
4
5
|
export type { FormCardEnvelope, FormDefinition, FormField, } from '../primitives/card-data-types.js';
|
|
5
6
|
/** The internal widget identifiers `widgetFor` resolves to. */
|
|
@@ -8,6 +9,49 @@ export declare const DEFAULT_INLINE_MAX = 4;
|
|
|
8
9
|
/** Resolve the widget for a field. An explicit valid `x-kai-widget` always wins;
|
|
9
10
|
* otherwise the type/format/enum/constraint combination selects the widget. */
|
|
10
11
|
export declare function widgetFor(field: FormField, inlineMax: number): WidgetKind;
|
|
12
|
+
/**
|
|
13
|
+
* What one field's `x-kai-*` format hints resolve to.
|
|
14
|
+
*
|
|
15
|
+
* The three props on the left are `Input`'s masking surface verbatim;
|
|
16
|
+
* `hint` is the TEXT statement of the expected format, which `FieldRow` renders and
|
|
17
|
+
* links through its EXISTING `aria-describedby` chain (no third channel).
|
|
18
|
+
* Every field is `undefined` when the field carries no hints, which is what "byte for
|
|
19
|
+
* byte the behavior of today" means here.
|
|
20
|
+
*/
|
|
21
|
+
export interface FieldMaskHint {
|
|
22
|
+
/** The compiled-clean mask pattern handed to `Input`'s `format`. */
|
|
23
|
+
format?: string;
|
|
24
|
+
/** An explicit, aligned display guide. Absent = the pattern derives its own. */
|
|
25
|
+
guide?: string;
|
|
26
|
+
/** The tier-1 semantic type: `inputmode`, `autocomplete`, and the canonical form. */
|
|
27
|
+
semantic?: FieldSemanticType;
|
|
28
|
+
/** The expected format, stated in text for the description chain. */
|
|
29
|
+
hint?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Everything that was ignored and why, as DATA rather than as a side effect.
|
|
32
|
+
*
|
|
33
|
+
* Resolution runs inside a memo on a render path, so it must never throw and must
|
|
34
|
+
* not warn twice for the same reason on a re-render. Returning the messages lets
|
|
35
|
+
* `FieldRow` own the once-per-row discipline and lets the pure tests assert the
|
|
36
|
+
* wording without a console spy.
|
|
37
|
+
*/
|
|
38
|
+
warnings: string[];
|
|
39
|
+
}
|
|
40
|
+
/** The resolution of a field with no format hints: shared, frozen, and the default
|
|
41
|
+
* every non-text widget carries so the prop bag has one shape. */
|
|
42
|
+
export declare const EMPTY_MASK_HINT: FieldMaskHint;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve a field's `x-kai-format` / `x-kai-mask` / `x-kai-mask-guide` into the
|
|
45
|
+
* masking props `Input` takes, or into nothing at all.
|
|
46
|
+
*
|
|
47
|
+
* EVERY INPUT HERE IS MODEL OUTPUT and therefore untrusted. The hints are
|
|
48
|
+
* display-only — they produce text and caret positions, never HTML, a URL or an
|
|
49
|
+
* attribute on a navigable element — so this is about denial of service and
|
|
50
|
+
* confusion, not injection: an unknown token, a pattern the engine refuses and a
|
|
51
|
+
* misaligned guide each degrade to the largest thing that still works, and say so.
|
|
52
|
+
* A THROW here would take out the whole card, including the fields that were fine.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveFieldMask(field: FormField, fieldKey?: string): FieldMaskHint;
|
|
11
55
|
/** Humanize a camelCase / snake_case property key into a label. */
|
|
12
56
|
export declare function humanize(key: string): string;
|
|
13
57
|
/** Field order: `x-kai-order` (filtered to known keys, missing appended) if
|
|
@@ -122,10 +166,11 @@ interface FieldRowProps {
|
|
|
122
166
|
* signal behind the prop it read. The object identity is constant, so the
|
|
123
167
|
* `WidgetSwitch` prop below never changes either.
|
|
124
168
|
*/
|
|
125
|
-
export declare function fieldCommon(props: FieldRowProps, id: string, placeholder: () => string | undefined, label: () => string, describedBy?: () => string | undefined): ReturnType<FieldRowCommon>;
|
|
169
|
+
export declare function fieldCommon(props: FieldRowProps, id: string, placeholder: () => string | undefined, label: () => string, describedBy?: () => string | undefined, mask?: () => FieldMaskHint, labelledBy?: () => string | undefined): ReturnType<FieldRowCommon>;
|
|
126
170
|
type FieldRowCommon = () => {
|
|
127
171
|
id: string;
|
|
128
172
|
value: unknown;
|
|
173
|
+
mask: FieldMaskHint;
|
|
129
174
|
field: FormField;
|
|
130
175
|
disabled: boolean;
|
|
131
176
|
placeholder?: string;
|
|
@@ -133,6 +178,8 @@ type FieldRowCommon = () => {
|
|
|
133
178
|
invalid: boolean;
|
|
134
179
|
describedBy?: string;
|
|
135
180
|
label: string;
|
|
181
|
+
/** The id of the row's visible <label>, for widgets that name a GROUP. */
|
|
182
|
+
labelledBy?: string;
|
|
136
183
|
onInput: (v: unknown) => void;
|
|
137
184
|
onBlur: () => void;
|
|
138
185
|
};
|
|
@@ -105,6 +105,12 @@ export interface MessageBodyProps {
|
|
|
105
105
|
* the kit checks its own seven built-ins and leaves your own card type
|
|
106
106
|
* unvalidated. A schema here WINS over a built-in of the same name. */
|
|
107
107
|
cardSchemas?: CardSchemaMap;
|
|
108
|
+
/** The custom-element host node to emit card events off when no `CardProvider`
|
|
109
|
+
* is above this body, forwarded to `CardRenderer` as `hostElement`. The
|
|
110
|
+
* `<kai-chat>`/`<kai-message>`/`<kai-thread>` facades pass their own element,
|
|
111
|
+
* so a `card` part's events leave as the bubbling `kai-card` CustomEvent
|
|
112
|
+
* instead of being silently discarded. */
|
|
113
|
+
cardHostElement?: HTMLElement;
|
|
108
114
|
/** Whether this is a user message (right-aligned bubble) vs an assistant
|
|
109
115
|
* message (full-width transparent). */
|
|
110
116
|
isUser: boolean;
|
|
@@ -125,11 +131,27 @@ export interface MessageBodyProps {
|
|
|
125
131
|
copied?: boolean;
|
|
126
132
|
/** Whether this message is the one currently streaming. Forwarded to each
|
|
127
133
|
* reasoning part's `<Reasoning>` so the disclosure auto-opens while the
|
|
128
|
-
* model is thinking and settles back once the stream ends
|
|
129
|
-
*
|
|
130
|
-
*
|
|
134
|
+
* model is thinking and settles back once the stream ends. Without it the
|
|
135
|
+
* user watches a static collapsed "Reasoning" label for the whole thinking
|
|
136
|
+
* window. The caller owns the definition of "streaming" — for
|
|
131
137
|
* `ChatThread` that is `loading` + being the last assistant message. */
|
|
132
138
|
isStreaming?: boolean;
|
|
139
|
+
/** How a `reasoning` part renders. `'full'` (default) is the current
|
|
140
|
+
* behavior: the collapsible `<Reasoning>` disclosure, with the "Thinking…"
|
|
141
|
+
* shimmer on its trigger while `isStreaming`. `'compact'` drops the
|
|
142
|
+
* disclosure entirely and shows only a shimmer loader while the part is
|
|
143
|
+
* streaming — nothing once it settles, so there is no expandable detail to
|
|
144
|
+
* open. `'off'` renders the part not at all, in either state. Kit-decides-
|
|
145
|
+
* HOW: this is a display-mode fact about the medium, not a per-message
|
|
146
|
+
* toggle, so it applies uniformly to every reasoning part in the body. */
|
|
147
|
+
reasoningMode?: 'full' | 'compact' | 'off';
|
|
148
|
+
/** Seeds the reasoning disclosure open AND keeps it tracking the stream
|
|
149
|
+
* (open while streaming, closes when it settles): the pre-Task-19f `full`
|
|
150
|
+
* behavior. Default false/absent: the panel starts closed (just the
|
|
151
|
+
* "Thinking" shimmer chip) and only opens on click, the current default
|
|
152
|
+
* (owner ruling, 2026-08-26). Meaningless when `reasoningMode` is
|
|
153
|
+
* `'compact'`/`'off'` (no disclosure exists to open). */
|
|
154
|
+
reasoningDefaultOpen?: boolean;
|
|
133
155
|
/** INJECT slot projected at the TOP of the body — above the reasoning / tools /
|
|
134
156
|
* content. A per-message header: a model-name label, a role + timestamp line.
|
|
135
157
|
* In the `<kai-message>` shadow this is `<slot name="before-body" />`. */
|
|
@@ -18,6 +18,12 @@ export interface ReasoningProps {
|
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
/** Receive the open controller (open accessor + setOpen) once mounted. */
|
|
20
20
|
controllerRef?: (api: ReasoningController) => void;
|
|
21
|
+
/** Keep auto-opening while streaming and auto-closing when it settles (the
|
|
22
|
+
* pre-Task-19f `full` behavior). Default false: the panel starts per
|
|
23
|
+
* `defaultOpen` and stays exactly where the user leaves it — streaming only
|
|
24
|
+
* changes the trigger's label (shimmer), never the open state, matching the
|
|
25
|
+
* "closed chip, expand on click" default (owner ruling, 2026-08-26). */
|
|
26
|
+
openOnStream?: boolean;
|
|
21
27
|
}
|
|
22
28
|
declare function Reasoning(props: ReasoningProps): JSX.Element;
|
|
23
29
|
export interface ReasoningTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -2,6 +2,17 @@ export interface ScrollButtonProps {
|
|
|
2
2
|
class?: string;
|
|
3
3
|
variant?: 'outline' | 'ghost' | 'default';
|
|
4
4
|
size?: 'sm' | 'md' | 'lg' | 'icon' | 'icon-sm';
|
|
5
|
+
/**
|
|
6
|
+
* The button's accessible name. Used whether or not the label is visible, so
|
|
7
|
+
* the announced text is always localisable. Defaults to `"Scroll to bottom"`.
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Also render `label` visibly beside the icon. Defaults to `false` (icon
|
|
12
|
+
* only). When it is visible the text IS the accessible name, so nothing is
|
|
13
|
+
* announced twice.
|
|
14
|
+
*/
|
|
15
|
+
showLabel?: boolean;
|
|
5
16
|
}
|
|
6
17
|
declare function ScrollButton(props: ScrollButtonProps): import("solid-js").JSX.Element;
|
|
7
18
|
export { ScrollButton };
|
|
@@ -27,6 +27,11 @@ export interface ThreadProps {
|
|
|
27
27
|
* the kit checks its own seven built-ins and leaves your own card type
|
|
28
28
|
* unvalidated. A schema here WINS over a built-in of the same name. */
|
|
29
29
|
cardSchemas?: CardSchemaMap;
|
|
30
|
+
/** The custom-element host node to emit card events off when no `CardProvider`
|
|
31
|
+
* is present, forwarded through `MessageBody` to `CardRenderer`. The
|
|
32
|
+
* element facades pass their own host element so card events leave as the
|
|
33
|
+
* bubbling `kai-card` CustomEvent. */
|
|
34
|
+
cardHostElement?: HTMLElement;
|
|
30
35
|
/** Show a typing indicator on the pending assistant turn — use while awaiting
|
|
31
36
|
* the assistant's reply. */
|
|
32
37
|
loading?: boolean;
|
|
@@ -23,6 +23,15 @@ export interface ToolPart {
|
|
|
23
23
|
type: string;
|
|
24
24
|
/** Semantic classification for rendering. Derive with classifyTool(type). */
|
|
25
25
|
kind?: ToolKind;
|
|
26
|
+
/** The call's lifecycle. A provider stream (real or `createMockResponder`)
|
|
27
|
+
* only ever ANNOUNCES a call: arguments stream in (`input-streaming`), then
|
|
28
|
+
* the part parks at `input-available` — and stays there. The kit parses and
|
|
29
|
+
* renders the call; EXECUTING it and answering is the host's side of the
|
|
30
|
+
* seam: after the read settles, run the tool and patch the part forward with
|
|
31
|
+
* `stream.upsertTool(id, { state: 'output-available', output })` (or
|
|
32
|
+
* `upsertToolPart`), or `output-error` + `errorText` on failure. The one
|
|
33
|
+
* exception is a call the provider ran itself (`raw` carries the result and
|
|
34
|
+
* the wire sets `output` directly) — never re-execute those. */
|
|
26
35
|
state: 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
27
36
|
/** Last VALID parsed snapshot, fingerprint-deduped. The primary channel: this is
|
|
28
37
|
* what the kit renders. */
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import{A as Ye,g as z,w as Je,k as Z,j as de,o as ue,x as De,h as Ze,i as N,u as Ne,a as H,d as O,b as Q,l as ee,c as $,F as Oe,S as G,t as S,O as Qe,e as et}from"./define-CGGX-7Vg.js";import{c as P}from"./cn-DN5AWfiS.js";import{u as tt,c as nt,a as rt}from"./overlay-C1od6LOz.js";function M(n){if(n==null)return[];if(typeof n=="string")return n.length?[{type:"text",text:n}]:[];const l=[];for(const t of n)if(t.type==="text"){if(!t.text)continue;const i=l[l.length-1];i&&i.type==="text"?l[l.length-1]={type:"text",text:i.text+t.text}:l.push({type:"text",text:t.text})}else l.push({type:"entity",entity:t.entity});return l}function te(n,l){let t="";for(const i of n)i.type==="text"?t+=i.text:t+=i.entity.promptText??i.entity.label;return t}function he(n){return n.filter(l=>l.type==="entity").map(l=>l.entity)}function ne(n){return n.every(l=>l.type==="text"&&l.text.length===0)}const C="\u200B",pe="data-kai-entity",fe=new WeakMap;function U(n){return!!n&&n.nodeType===1&&n.hasAttribute(pe)}function re(n){return n.ownerDocument.createTreeWalker(n,NodeFilter.SHOW_TEXT,{acceptNode(l){let t=l.parentElement;for(;t&&t!==n;){if(t.hasAttribute(pe))return NodeFilter.FILTER_REJECT;t=t.parentElement}return NodeFilter.FILTER_ACCEPT}})}function ot(n){switch(n){case"skill":return"/";case"agent":return"@";default:return""}}function Le(n){const l=t=>`<svg viewBox="0 0 24 24" width="1em" height="1em" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`;switch(n){case"agent":return l('<rect x="4" y="8" width="16" height="12" rx="3"/><path d="M12 4.5V8M9.5 13.5v1.5M14.5 13.5v1.5"/><circle cx="12" cy="3" r="1.2"/>');case"plugin":return l('<path d="M9 2v4M15 2v4M6 6h12v5a6 6 0 0 1-12 0zM12 17v5"/>');default:return""}}function Ie(n,l,t){const i=n.createElement("span");i.setAttribute(pe,""),i.setAttribute("contenteditable","false"),i.dataset.kind=l.kind,i.dataset.id=l.id,i.className="kai-composer-pill";const u=ot(l.kind);if(u){const s=n.createElement("span");s.className="kai-composer-pill-sigil",s.setAttribute("aria-hidden","true"),s.textContent=u,i.appendChild(s)}else{const s=l.icon??t?.[l.kind];if(s){const h=n.createElement("img");h.src=s,h.alt="",h.className="kai-composer-pill-icon",i.appendChild(h)}else{const h=Le(l.kind);if(h){const f=n.createElement("span");f.className="kai-composer-pill-icon kai-composer-pill-glyph",f.setAttribute("aria-hidden","true"),f.innerHTML=h,i.appendChild(f)}}}return i.appendChild(n.createTextNode(l.label)),fe.set(i,l),i}function L(n){const l=[],t=n.childNodes;return t.forEach((i,u)=>{if(U(i)){const s=fe.get(i),h=i;l.push({type:"entity",entity:s??{kind:h.dataset.kind??"",id:h.dataset.id??"",label:h.textContent??""}})}else if(i.nodeType===1&&i.tagName==="BR"){if(u===t.length-1)return;l.push({type:"text",text:`
|
|
2
|
+
`})}else i.nodeType===3&&l.push({type:"text",text:(i.textContent??"").split(C).join("")})}),M(l)}function oe(n,l,t=document,i){n.textContent="";for(const u of l)u.type==="text"?n.appendChild(t.createTextNode(u.text)):(n.appendChild(Ie(t,u.entity,i)),n.appendChild(t.createTextNode(C)))}function it(n,l,t){if(l<0||l>n.length)return null;for(let i=l-1;i>=0;i--){const u=n[i];if(/\s/.test(u))return null;if(t.includes(u))return i===0||/\s/.test(n[i-1])?{char:u,query:n.slice(i+1,l),start:i}:null}return null}function at(n,l,t){if(!t.length)return null;const i=t.map(h=>h.char),u=it(n,l,i);if(!u)return null;const s=t.find(h=>h.char===u.char);return s?{def:s,query:u.query,start:u.start}:null}function lt(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function st(n,l){const t=[];for(const s of l){let h,f;typeof s=="string"?(h=new RegExp(lt(s),"gi"),f=void 0):(h=new RegExp(s.pattern,s.flags??"gi"),f=s.class),h.lastIndex=0;let k;for(;(k=h.exec(n))!==null;){const x=k.index,w=x+k[0].length;if(w===x){h.lastIndex=x+1;continue}t.push({start:x,end:w,class:f})}}t.sort((s,h)=>s.start-h.start);const i=[];let u=-1;for(const s of t)s.start>=u&&(i.push(s),u=s.end);return i}function ct(){try{return typeof CSS<"u"&&typeof CSS.highlights<"u"&&typeof Highlight<"u"}catch{return!1}}const dt="kai-composer-highlight";function ut(n,l,t,i=dt){if(!ct())return;const u=CSS.highlights;if(l.length===0){u.delete(i);return}const s=[];let h=0;const f=n.ownerDocument,k=re(n);let x=k.nextNode();for(;x;){const v=x.textContent??"",b=[];for(let p=0;p<v.length;p++)v[p]!==t&&b.push(p);if(b.length>0){const p=new Int32Array(b.length);for(let m=0;m<b.length;m++)p[m]=b[m];s.push({node:x,strippedStart:h,strippedToRaw:p}),h+=b.length}x=k.nextNode()}function w(v){let b=0,p=s.length-1;for(;b<=p;){const m=b+p>>1,T=s[m],q=T.strippedStart+T.strippedToRaw.length;if(v<T.strippedStart)p=m-1;else if(v>=q)b=m+1;else{const R=v-T.strippedStart;return{node:T.node,rawOffset:T.strippedToRaw[R]}}}if(s.length>0){const m=s[s.length-1];if(v-m.strippedStart===m.strippedToRaw.length)return{node:m.node,rawOffset:m.strippedToRaw[m.strippedToRaw.length-1]+1}}return null}const y=[];for(const v of l){const b=w(v.start),p=w(v.end);if(!b||!p)continue;const m=f.createRange();m.setStart(b.node,b.rawOffset),m.setEnd(p.node,p.rawOffset),y.push(m)}if(y.length===0){u.delete(i);return}const A=new Highlight(...y);u.set(i,A)}function ht(n,l=200){let t=[n],i=0;return{record(u,s){if(s&&i===t.length-1){t[i]=u;return}t=t.slice(0,i+1),t.push(u),t.length>l?t.shift():i++},undo(){return i===0?null:(i--,t[i])},redo(){return i>=t.length-1?null:(i++,t[i])},reset(u){t=[u],i=0},canUndo(){return i>0},canRedo(){return i<t.length-1},size(){return t.length}}}var pt=S("<style>"),ft=S(`<style>
|
|
3
|
+
.kai-composer-pill {
|
|
4
|
+
display: inline-flex; align-items: center; gap: 0.2rem;
|
|
5
|
+
/* middle (not baseline): a flex pill's baseline differs with/without an
|
|
6
|
+
icon, which misaligns adjacent pills \u2014 middle aligns them consistently. */
|
|
7
|
+
vertical-align: middle; height: 1.5em;
|
|
8
|
+
/* Asymmetric margin: a roomier trailing gap (so typed text isn't flush
|
|
9
|
+
after a pill) + a smaller leading gap. */
|
|
10
|
+
margin: 0 0.3rem 0 0.1rem;
|
|
11
|
+
border-radius: 0.375rem;
|
|
12
|
+
font-weight: 500; white-space: nowrap; user-select: none; cursor: default;
|
|
13
|
+
box-sizing: border-box; line-height: 1;
|
|
14
|
+
}
|
|
15
|
+
/* Skills + agents: LIGHT \u2014 decorated inline text led by a sigil, NOT a
|
|
16
|
+
chip. A distinct colour per kind (overridable); the sigil is dimmer
|
|
17
|
+
than the label. (A GUI affords this richer-but-light look; a CLI can't.) */
|
|
18
|
+
.kai-composer-pill[data-kind="skill"],
|
|
19
|
+
.kai-composer-pill[data-kind="agent"] {
|
|
20
|
+
padding: 0 0.1rem; background: transparent;
|
|
21
|
+
/* Read like a command, not a title \u2014 lowercase the DISPLAY only; the
|
|
22
|
+
entity label + emitted payload keep the consumer's original casing. */
|
|
23
|
+
text-transform: lowercase;
|
|
24
|
+
}
|
|
25
|
+
.kai-composer-pill[data-kind="skill"] { color: var(--kai-pill-skill, #2563eb); }
|
|
26
|
+
.kai-composer-pill[data-kind="agent"] { color: var(--kai-pill-agent, #7c3aed); }
|
|
27
|
+
/* Brighter hues on dark so they don't muddy against a dark field. The
|
|
28
|
+
consumer's --kai-pill-* override still wins (it's the var value); only
|
|
29
|
+
the FALLBACK shifts per scheme.
|
|
30
|
+
|
|
31
|
+
Keyed on the kit's RESOLVED theme (the \`.dark\` wrapper an element
|
|
32
|
+
facade puts inside its shadow root, and the \`.dark\` class the docs /
|
|
33
|
+
Storybook put on <html>) \u2014 NOT \`prefers-color-scheme\`. Those are
|
|
34
|
+
different questions: \`theme="light"\` on a machine whose OS is dark is
|
|
35
|
+
an ordinary, common configuration, and the media query answered the OS
|
|
36
|
+
while the surface under the pill answered the attribute. That painted
|
|
37
|
+
the DARK hue (#6ea8fe) on the LIGHT field: 2.33:1, under both the
|
|
38
|
+
4.5:1 text floor (SC 1.4.3) and even 3:1. Matched pairs looked fine,
|
|
39
|
+
which is why it survived \u2014 never scheme-match a colour whose backdrop
|
|
40
|
+
is chosen by the theme attribute. */
|
|
41
|
+
.dark .kai-composer-pill[data-kind="skill"] { color: var(--kai-pill-skill, #6ea8fe); }
|
|
42
|
+
.dark .kai-composer-pill[data-kind="agent"] { color: var(--kai-pill-agent, #c4a7fc); }
|
|
43
|
+
/* Dimmer than the label, but the sigil is what makes a pill read as
|
|
44
|
+
\`/skill\` vs \`@agent\`, so it is a meaningful glyph and owes 3:1
|
|
45
|
+
(SC 1.4.11). At 0.6 the light-mode composite was 2.52:1. */
|
|
46
|
+
.kai-composer-pill-sigil { opacity: 0.8; font-weight: 600; }
|
|
47
|
+
/* Plugins (and any other/unknown kind): the richer CHIP \u2014 background +
|
|
48
|
+
icon \u2014 so a composite bundle reads differently at a glance. */
|
|
49
|
+
.kai-composer-pill:not([data-kind="skill"]):not([data-kind="agent"]) {
|
|
50
|
+
padding: 0 0.4rem;
|
|
51
|
+
background-color: color-mix(in srgb, currentColor 10%, transparent);
|
|
52
|
+
}
|
|
53
|
+
/* Selected (caret arrowed onto the pill): a highlight box, like Claude
|
|
54
|
+
Code web. Tinted by the pill's own colour via currentColor. */
|
|
55
|
+
.kai-composer-pill[data-selected] {
|
|
56
|
+
background-color: color-mix(in srgb, currentColor 18%, transparent);
|
|
57
|
+
box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 30%, transparent);
|
|
58
|
+
}
|
|
59
|
+
/* Fixed height + an icon never taller than the box \u2192 iconed and iconless
|
|
60
|
+
pills are exactly the same height (no baseline shift in the line). */
|
|
61
|
+
.kai-composer-pill-icon { width: 1em; height: 1em; flex-shrink: 0; }
|
|
62
|
+
img.kai-composer-pill-icon { border-radius: 9999px; object-fit: cover; }
|
|
63
|
+
.kai-composer-pill-glyph { display: inline-flex; align-items: center; justify-content: center; opacity: 0.8; }
|
|
64
|
+
.kai-composer-pill-glyph svg { width: 1em; height: 1em; display: block; }
|
|
65
|
+
/* The editable is the containing block for the placeholder pseudo-element. */
|
|
66
|
+
[data-kai-composer-editable] { position: relative; }
|
|
67
|
+
/* While a pill is arrow-selected the pill IS the selection, so hide the text
|
|
68
|
+
caret so a blinking cursor doesn't sit beside the highlight box. Returns
|
|
69
|
+
the moment the pill selection clears (arrow off, type, click, backspace). */
|
|
70
|
+
[data-kai-composer-editable][data-pill-selected] { caret-color: transparent; }
|
|
71
|
+
/* Placeholder via pseudo-element \u2014 exempt from axe color-contrast like a
|
|
72
|
+
native <textarea> placeholder. position:absolute (with auto offsets =
|
|
73
|
+
its static text-origin spot) takes it OUT of flow, so the caret sits at
|
|
74
|
+
the START of the field instead of after the placeholder text. */
|
|
75
|
+
[data-kai-composer-editable].kai-composer-empty::before {
|
|
76
|
+
content: attr(data-placeholder);
|
|
77
|
+
position: absolute;
|
|
78
|
+
color: var(--color-muted-foreground, #9ca3af);
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
}
|
|
81
|
+
`),gt=S("<div class=relative><div data-kai-composer-editable role=textbox aria-multiline=true>"),mt=S("<div role=listbox aria-label=Suggestions style=position:fixed>"),kt=S('<div class="px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground select-none">'),yt=S('<span class="text-muted-foreground truncate min-w-0">'),vt=S('<button role=option><span class="font-medium whitespace-nowrap shrink-0">'),bt=S('<span class="kai-composer-pill-glyph w-4 h-4 shrink-0"aria-hidden=true>'),xt=S('<img alt class="w-4 h-4 rounded object-cover shrink-0">'),wt=S("<div>");function E(n){var l;const t=n.getRootNode();return typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&typeof t.getSelection=="function"?t.getSelection():((l=n.ownerDocument)==null?void 0:l.getSelection())??null}function $e(n){let l="";const t=re(n);let i=t.nextNode();for(;i;)l+=(i.textContent??"").split(C).join(""),i=t.nextNode();return l}function ge(n){const l=E(n);if(!l||l.rangeCount===0)return 0;const t=l.getRangeAt(0);if(!t.collapsed)return 0;const{startContainer:i,startOffset:u}=t;let s=0;const h=re(n);let f=h.nextNode();for(;f;){if(f===i){const k=(f.textContent??"").slice(0,u);return s+=k.split(C).join("").length,s}s+=(f.textContent??"").split(C).join("").length,f=h.nextNode()}return s}function Ct(n){const l=n.ownerDocument,t=E(n);if(!t||t.rangeCount===0)return null;const i=t.getRangeAt(0).cloneRange();i.collapse(!0);const u=i.getClientRects();if(u.length>0&&(u[0].width>0||u[0].height>0))return u[0];const s=l.createElement("span");s.textContent="\u200B",s.style.position="absolute",s.style.visibility="hidden",i.insertNode(s);const h=s.getBoundingClientRect();return s.remove(),h.width>0||h.height>0?h:null}function Tt(n,l){const t=E(n);if(!t)return;const i=n.ownerDocument.createRange(),u=re(n);let s=l,h=u.nextNode(),f=!1;for(;h;){const k=h.textContent??"",x=k.split(C).join("").length;if(s<=x){let w=0,y=0;for(;w<k.length&&y<s;)k[w]!==C&&y++,w++;for(;w<k.length&&k[w]===C;)w++;i.setStart(h,w),f=!0;break}s-=x,h=u.nextNode()}f?i.collapse(!0):(i.selectNodeContents(n),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}function Rt(n){const l=Ye();let t;const[i,u]=z(),s=`kai-composer-highlight-${Je()}`,[h,f]=z(ne(M(n.value))),[k,x]=z(null),w=e=>{const r=k();r&&r!==e&&r.removeAttribute("data-selected"),e.setAttribute("data-selected",""),x(e)},y=()=>{const e=k();e&&(e.removeAttribute("data-selected"),x(null))},A=ht({doc:M(n.value),caret:0});let v=0;const b=500,[p,m]=z(null),[T,q]=z(0),R=Z(()=>{const e=p();if(!(e!=null&&e.def.items))return[];const r=new Set(he(L(t)).map(o=>`${o.kind}:${o.id}`)),a=e.query.toLowerCase();return e.def.items.filter(o=>{var c;const d=o.kind??e.def.kind;return r.has(`${d}:${o.id}`)?!1:a===""?!0:o.label.toLowerCase().includes(a)||(((c=o.description)==null?void 0:c.toLowerCase().includes(a))??!1)})}),Me=Z(()=>{const e=[];return R().forEach((r,a)=>{let o=e.find(c=>c.group===r.group);o||(o={group:r.group,items:[]},e.push(o)),o.items.push({item:r,index:a})}),e}),ie=Z(()=>R().length>0),me=e=>{var r;return e.kind??((r=p())==null?void 0:r.def.kind)??""},qe=e=>{var r;return e.icon??((r=n.kindIcons)==null?void 0:r[me(e)])};de(()=>{const e=R().length;T()>=e&&q(Math.max(0,e-1))});const Be=Z(()=>{const e=p();if(!e)return;const r=e.caretRect;return{getBoundingClientRect:()=>r}}),{pos:ke,hidden:Ke}=tt(Be,i,{placement:"bottom-start",gutter:4}),{present:je,state:He,setRef:Fe}=nt(ie);rt({enabled:ie,onDismiss:()=>B(),refs:()=>[t,i()]});function B(){var e;p()&&(m(null),(e=n.onTriggerClose)==null||e.call(n))}const K=()=>{const e=L(t);return{doc:e,text:te(e),entities:he(e)}};function X(){const e=n.highlights,r=e!=null&&e.length?st($e(t),e):[];ut(t,r,C,s)}ue(()=>{oe(t,M(n.value),t.ownerDocument,n.kindIcons),f(ne(L(t))),X(),A.reset({doc:L(t),caret:0})}),de(De(()=>n.value,e=>{te(M(e))!==te(L(t))&&(y(),oe(t,M(e),t.ownerDocument,n.kindIcons),f(ne(L(t))),X(),A.reset({doc:L(t),caret:0}))},{defer:!0})),de(De(()=>n.highlights,()=>X(),{defer:!0}));function ye(){var e;const r=n.triggers;if(!(r!=null&&r.length)){p()&&B();return}const a=$e(t),o=ge(t),c=at(a,o,r);if(c){const d=Ct(t);if(d){const g=p();m({def:c.def,query:c.query,start:c.start,caretRect:d}),(!g||g.def.char!==c.def.char||g.query!==c.query)&&((e=n.onTrigger)==null||e.call(n,{char:c.def.char,query:c.query,rect:d}))}}else p()&&B()}const W=e=>{var r;f(ne(e.doc)),(r=n.onChange)==null||r.call(n,e),ye(),X()},_e=()=>{y();const e=K();W(e);const r=Date.now();A.record({doc:e.doc,caret:ge(t)},r-v<b),v=r},ve=()=>{const e=K();W(e),A.record({doc:e.doc,caret:ge(t)},!1),v=0},be=e=>{y(),oe(t,e.doc,t.ownerDocument,n.kindIcons),Tt(t,e.caret),W(K()),v=0},ze=()=>{const e=A.undo();e&&be(e)},xe=()=>{const e=A.redo();e&&be(e)};let ae=!1;const Ge=e=>{var r;ae=!0,(r=n.onFocus)==null||r.call(n,e)},Pe=e=>{var r;ae=!1,y(),(r=n.onBlur)==null||r.call(n,e)};ue(()=>{const e=t.ownerDocument,r=()=>{ae&&ye()};e.addEventListener("selectionchange",r),Ze(()=>e.removeEventListener("selectionchange",r))}),ue(()=>{var e;(e=n.controllerRef)==null||e.call(n,{focus:r=>t.focus(r),blur:()=>t.blur(),clear:()=>{y(),oe(t,[],t.ownerDocument,n.kindIcons),W(K()),A.reset({doc:L(t),caret:0}),v=0},send:()=>{var r;return(r=n.onSubmit)==null?void 0:r.call(n,K())},insertEntity:r=>Ce(r)})});function we(e){const r=p();if(!r)return;const a={kind:e.kind??r.def.kind,id:e.id,label:e.label,icon:e.icon,promptText:e.promptText,data:e.data};Ce(a,{deleteBefore:1+r.query.length}),B()}const Ce=(e,r)=>{var a;const o=t.ownerDocument,c=E(t);if(!c||c.rangeCount===0)return;const d=c.getRangeAt(0);if(r!=null&&r.deleteBefore&&d.collapsed){let Y=r.deleteBefore,j=d.startContainer,_=d.startOffset;for(;Y>0&&j&&j.nodeType===3;){const Ve=j.textContent??"";for(;_>0&&Y>0;)_--,Ve[_]!==C&&Y--;if(Y>0){const J=j.previousSibling;if(J&&J.nodeType===3)j=J,_=(J.textContent??"").length;else break}}const ce=o.createRange();ce.setStart(j,_),ce.setEnd(d.startContainer,d.startOffset),ce.deleteContents()}const g=c.getRangeAt(0);g.collapsed||g.deleteContents();const I=Ie(o,e,n.kindIcons),D=o.createTextNode(C);g.insertNode(D),g.insertNode(I);const se=o.createRange();se.setStartAfter(D),se.collapse(!0),c.removeAllRanges(),c.addRange(se),(a=n.onEntityAdd)==null||a.call(n,e),ve()},V=e=>(e??"").split("").every(r=>r===C),F=e=>!!e&&e.nodeType===Node.TEXT_NODE&&V(e.textContent),Te=e=>{const{startContainer:r,startOffset:a}=e;if(r===t){let o=a-1;for(;F(t.childNodes[o]);)o--;const c=t.childNodes[o];return U(c)?c:null}if(r.nodeType===Node.TEXT_NODE){if(!V((r.textContent??"").slice(0,a)))return null;let o=r.previousSibling;for(;F(o);)o=o.previousSibling;return U(o)?o:null}return null},Re=e=>{const{startContainer:r,startOffset:a}=e;if(r===t){let o=a;for(;F(t.childNodes[o]);)o++;const c=t.childNodes[o];return U(c)?c:null}if(r.nodeType===Node.TEXT_NODE){if(!V((r.textContent??"").slice(a)))return null;let o=r.nextSibling;for(;F(o);)o=o.nextSibling;return U(o)?o:null}return null},Se=e=>{var r;const a=fe.get(e),o=e.nextSibling;o?.nodeType===Node.TEXT_NODE&&V(o.textContent)&&o.remove(),e.remove(),a&&((r=n.onEntityRemove)==null||r.call(n,a)),ve()},Ue=e=>{const r=E(t);if(!r)return;const a=t.ownerDocument.createRange();a.setStartBefore(e),a.collapse(!0),r.removeAllRanges(),r.addRange(a)},Ae=e=>{const r=E(t);if(!r)return;let a=e;for(;F(a.nextSibling);)a=a.nextSibling;const o=t.ownerDocument.createRange();o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o)},Xe=e=>{var r;if((e.metaKey||e.ctrlKey)&&(e.key==="z"||e.key==="Z")){e.preventDefault(),e.shiftKey?xe():ze();return}if((e.metaKey||e.ctrlKey)&&(e.key==="y"||e.key==="Y")){e.preventDefault(),xe();return}if(ie()&&R().length>0){if(e.key==="ArrowDown"){e.preventDefault(),q(o=>(o+1)%R().length);return}if(e.key==="ArrowUp"){e.preventDefault(),q(o=>(o-1+R().length)%R().length);return}if(e.key==="Enter"||e.key==="Tab"){const o=R();if(o.length>0){e.preventDefault(),e.stopPropagation(),we(o[T()]);return}}if(e.key==="Escape"){e.preventDefault(),B();return}}else if(p()&&e.key==="Escape"){e.preventDefault(),B();return}const a=k();if(a&&a.isConnected){if(e.key==="ArrowLeft"){e.preventDefault(),Ue(a),y();return}if(e.key==="ArrowRight"){e.preventDefault(),Ae(a),y();return}if(e.key==="Backspace"||e.key==="Delete"){e.preventDefault();const o=a.previousSibling;y(),Se(a);const c=E(t);if(c){const d=t.ownerDocument.createRange();o&&o.isConnected?d.setStartAfter(o):d.setStart(t,0),d.collapse(!0),c.removeAllRanges(),c.addRange(d)}return}if(e.key==="Escape"){e.preventDefault(),y();return}if(e.key==="Shift"||e.key==="Meta"||e.key==="Control"||e.key==="Alt")return;Ae(a),y()}if(!k()&&(e.key==="ArrowLeft"||e.key==="ArrowRight")&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey){const o=E(t);if(o&&o.rangeCount>0){const c=o.getRangeAt(0);if(c.collapsed){const d=e.key==="ArrowLeft"?Te(c):Re(c);if(d){e.preventDefault(),w(d);return}}}}if(e.key==="Backspace"||e.key==="Delete"){const o=E(t);if(!o||o.rangeCount===0)return;const c=o.getRangeAt(0);if(!c.collapsed)return;const d=e.key==="Backspace"?Te(c):Re(c);if(d){e.preventDefault(),Se(d);return}}if(e.key==="Enter"&&!e.shiftKey&&n.submitOnEnter!==!1){if(e.preventDefault(),n.disabled||n.loading)return;(r=n.onSubmit)==null||r.call(n,K())}},le=()=>n.maxHeight??240,We=()=>n.editableClass??P("text-foreground min-h-[44px] w-full text-start overflow-y-auto whitespace-pre-wrap break-words",Qe(l.proseSize()),n.bare?"kai-focus-inset":"outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"),Ee=[(()=>{var e=pt();return N(e,`
|
|
82
|
+
/* MARKED text, not selected text. Reads --color-highlight (overridable via
|
|
83
|
+
--kai-color-highlight), a warm <mark> yellow. It used to be a 22% tint of
|
|
84
|
+
--color-primary with a #6366f1 indigo fallback \u2014 but the kit's
|
|
85
|
+
--color-primary is a NEUTRAL (near-black in light, near-white in dark),
|
|
86
|
+
so the indigo the fallback implied never appeared and the highlight
|
|
87
|
+
rendered plain grey in both themes.
|
|
88
|
+
|
|
89
|
+
NO \`prefers-color-scheme\` here, deliberately \u2014 the same trap that put
|
|
90
|
+
the pill hues below at 2.33:1. The OS scheme and the kit's RESOLVED
|
|
91
|
+
theme are different questions, and \`theme="light"\` on a dark-OS machine
|
|
92
|
+
is an ordinary configuration; a scheme-keyed value would paint the dark
|
|
93
|
+
amber on the light field. The pills answer this by scoping to \`.dark\`,
|
|
94
|
+
which is NOT available here: \`::highlight()\` names a document-registered
|
|
95
|
+
highlight, so there is no wrapper to hang a descendant selector on.
|
|
96
|
+
|
|
97
|
+
It does not need one. \`--color-highlight\` reaches this pseudo through
|
|
98
|
+
highlight inheritance from the ORIGINATING element \u2014 the text inside the
|
|
99
|
+
\`.dark\` wrapper \u2014 so the token already answers the resolved theme,
|
|
100
|
+
verified by rendering the dark amber under \`theme="dark"\` with only the
|
|
101
|
+
LIGHT literal below as a fallback. The literal is therefore reachable
|
|
102
|
+
only when no kit stylesheet is loaded at all, and it is deliberately the
|
|
103
|
+
light one: an unstyled page is a white page, and guessing from the OS is
|
|
104
|
+
exactly the failure above. */
|
|
105
|
+
::highlight(${s}) { background-color: var(--color-highlight, hsl(45 96% 78%)); }
|
|
106
|
+
`),e})(),ft(),(()=>{var e=gt(),r=e.firstChild;return r.addEventListener("blur",Pe),r.addEventListener("focus",Ge),r.$$mousedown=y,r.$$keydown=Xe,r.$$input=_e,Ne(a=>{var o;t=a,(o=n.editableRef)==null||o.call(n,a)},r),H(a=>{var o=k()?"":void 0,c=n.placeholder??"",d=n.disabled?!1:"plaintext-only",g=n.ariaLabel||n.placeholder||"Message input",I=P(We(),h()&&n.placeholder?"kai-composer-empty":""),D=typeof le()=="number"?`${le()}px`:String(le());return o!==a.e&&O(r,"data-pill-selected",a.e=o),c!==a.t&&O(r,"data-placeholder",a.t=c),d!==a.a&&O(r,"contenteditable",a.a=d),g!==a.o&&O(r,"aria-label",a.o=g),I!==a.i&&Q(r,a.i=I),D!==a.n&&ee(r,"max-height",a.n=D),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),e})(),$(G,{get when(){return je()},get children(){var e=mt();return Ne(r=>{u(r),Fe(r)},e),N(e,$(Oe,{get each(){return Me()},children:r=>[$(G,{get when(){return r.group},get children(){var a=kt();return N(a,()=>r.group),a}}),$(Oe,{get each(){return r.items},children:a=>(()=>{var o=vt(),c=o.firstChild;return o.$$click=d=>{d.preventDefault(),we(a.item)},o.$$mousedown=d=>d.preventDefault(),o.addEventListener("mouseenter",()=>q(a.index)),N(o,$(G,{get when(){return qe(a.item)},get fallback(){return $(G,{get when(){return Le(me(a.item))},children:d=>(()=>{var g=bt();return H(()=>g.innerHTML=d()),g})()})},children:d=>(()=>{var g=xt();return H(()=>O(g,"src",d())),g})()}),c),N(c,()=>a.item.label),N(o,$(G,{get when(){return a.item.description},get children(){var d=yt();return N(d,()=>a.item.description),d}}),null),H(d=>{var g=T()===a.index,I=a.index,D=P("w-full flex items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors",T()===a.index?"bg-muted text-foreground":"text-foreground hover:bg-muted");return g!==d.e&&O(o,"aria-selected",d.e=g),I!==d.t&&O(o,"data-index",d.t=I),D!==d.a&&Q(o,d.a=D),d},{e:void 0,t:void 0,a:void 0}),o})()})]})),H(r=>{var a=He(),o=P("absolute z-50 min-w-[240px] max-w-[420px] max-h-[320px] overflow-y-auto rounded-lg bg-card shadow-lg py-1","border border-border"),c=`${ke().x}px`,d=`${ke().y}px`,g=Ke()?"hidden":"visible";return a!==r.e&&O(e,"data-state",r.e=a),o!==r.t&&Q(e,r.t=o),c!==r.a&&ee(e,"left",r.a=c),d!==r.o&&ee(e,"top",r.o=d),g!==r.i&&ee(e,"visibility",r.i=g),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}})];return n.bare?Ee:(()=>{var e=wt();return N(e,Ee),H(()=>Q(e,P("kai-composer relative rounded-xl bg-surface p-2","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-0",n.disabled&&"cursor-not-allowed opacity-60"))),e})()}et(["input","keydown","mousedown","click"]);export{Rt as C,he as e,M as n,te as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as L,s as N,k as v,j as T,x as O,o as H,c as d,E as U,S as f,i as l,a as $,b as F,d as q,F as G,u as A,t as h,e as J}from"./define-CGGX-7Vg.js";import{c as K}from"./cn-DN5AWfiS.js";import{B as D}from"./button-BH6rN0U-.js";import{u as P,a as Q,C as x,D as V}from"./use-card-resolution-CJW4grFa.js";import{e as W}from"./card-routing-DifQgS7n.js";import{t as X}from"./triangle-alert-DHohDOCy.js";import{c as Y}from"./check-DPeeMUYx.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};
|