@kitn.ai/ui 0.16.0 → 0.18.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 +55 -17
- package/dist/components/artifact.d.ts +39 -1
- package/dist/components/attachment-types.d.ts +12 -0
- package/dist/components/attachments.d.ts +2 -10
- package/dist/components/card.d.ts +27 -0
- package/dist/components/chain-of-thought.d.ts +78 -2
- package/dist/components/chat-scope-picker.d.ts +7 -0
- package/dist/components/chat-thread.d.ts +39 -16
- package/dist/components/choice-card.d.ts +27 -0
- package/dist/components/coachmark.d.ts +49 -0
- package/dist/components/composer-dom.d.ts +35 -0
- package/dist/components/composer-highlight.d.ts +48 -0
- package/dist/components/composer-history.d.ts +34 -0
- package/dist/components/composer.d.ts +86 -0
- package/dist/components/confirm-card.d.ts +17 -0
- package/dist/components/conversation-item.d.ts +9 -0
- package/dist/components/conversation-list.d.ts +36 -1
- package/dist/components/dismissed-stub.d.ts +22 -0
- package/dist/components/file-tree.d.ts +15 -0
- package/dist/components/form.d.ts +34 -0
- package/dist/components/markdown.d.ts +3 -0
- package/dist/components/message.d.ts +71 -2
- package/dist/components/model-switcher.d.ts +7 -0
- package/dist/components/prompt-input.d.ts +13 -4
- package/dist/components/prompt-suggestion.d.ts +9 -1
- package/dist/components/reasoning.d.ts +14 -1
- package/dist/components/response-compare-types.d.ts +66 -0
- package/dist/components/response-compare.d.ts +65 -0
- package/dist/components/screen.d.ts +46 -0
- package/dist/components/tasks-card.d.ts +50 -1
- package/dist/components/toast.d.ts +58 -0
- package/dist/components/tool-types.d.ts +10 -0
- package/dist/components/tool.d.ts +8 -8
- package/dist/components/use-card-resolution.d.ts +10 -6
- package/dist/components/voice-input.d.ts +27 -0
- package/dist/components/voice-output.d.ts +33 -0
- package/dist/core-C8fzo39E.js +12 -0
- package/dist/custom-elements.json +8472 -1691
- package/dist/elements/agent-card.d.ts +1 -0
- package/dist/elements/agent-card.js +1 -0
- package/dist/elements/artifact.js +1 -0
- package/dist/elements/attachments.js +1 -0
- package/dist/elements/autoloader.d.ts +2 -0
- package/dist/elements/autoloader.js +1 -0
- package/dist/elements/avatar.d.ts +1 -0
- package/dist/elements/avatar.js +1 -0
- package/dist/elements/badge.d.ts +1 -0
- package/dist/elements/badge.js +1 -0
- package/dist/elements/button.d.ts +1 -0
- package/dist/elements/button.js +1 -0
- package/dist/elements/card.js +1 -0
- package/dist/elements/cards.d.ts +1 -0
- package/dist/elements/cards.js +1 -0
- package/dist/elements/chain-of-thought.d.ts +0 -12
- package/dist/elements/chain-of-thought.js +1 -0
- package/dist/elements/chat-scope-picker.js +1 -0
- package/dist/elements/chat-types.d.ts +8 -2
- package/dist/elements/chat-workspace.js +1 -0
- package/dist/elements/chat.js +1 -0
- package/dist/elements/checkpoint.js +1 -0
- package/dist/elements/choice.js +1 -0
- package/dist/elements/chunks/Icon-DLLBeLG5.js +1 -0
- package/dist/elements/chunks/action-icons-UB4V5FNq.js +1 -0
- package/dist/elements/chunks/arrow-left-C-gwlUmx.js +1 -0
- package/dist/elements/chunks/attachments-CgbErf1r.js +1 -0
- package/dist/elements/chunks/badge-DTQpgB6N.js +1 -0
- package/dist/elements/chunks/bash-InADTalH.js +1 -0
- package/dist/elements/chunks/button-XDUM6lXs.js +1 -0
- package/dist/elements/chunks/card-CBlFZ-7I.js +1 -0
- package/dist/elements/chunks/card-routing-C986KuUA.js +1 -0
- package/dist/elements/chunks/chat-thread-BIhmqwNL.js +1 -0
- package/dist/elements/chunks/check-hGUoVIKb.js +1 -0
- package/dist/elements/chunks/chevron-down-DDoaSUtO.js +1 -0
- package/dist/elements/chunks/chevron-right-CdGEUakB.js +1 -0
- package/dist/elements/chunks/circle-BKAZdmzb.js +1 -0
- package/dist/elements/chunks/circle-check-CmYG-y3I.js +1 -0
- package/dist/elements/chunks/circle-x-DewgAEym.js +1 -0
- package/dist/elements/chunks/cn-CU7UAWzk.js +1 -0
- package/dist/elements/chunks/code-block-DedwxwFI.js +1 -0
- package/dist/elements/chunks/collapsible-FfgmTHtM.js +1 -0
- package/dist/elements/chunks/composer-Cfbw5HKT.js +65 -0
- package/dist/elements/chunks/context-DwJmxlRE.js +1 -0
- package/dist/elements/chunks/conversation-list-DsCQMfPq.js +1 -0
- package/dist/elements/chunks/core-AYMC6_lb.js +12 -0
- package/dist/elements/chunks/css-M7EaDHN_.js +1 -0
- package/dist/elements/chunks/default-input-BuqsoENC.js +1 -0
- package/dist/elements/chunks/define-rGsaWsLL.js +1 -0
- package/dist/elements/chunks/disclosure-CwoAkpMH.js +1 -0
- package/dist/elements/chunks/download-DJ06G3Bz.js +1 -0
- package/dist/elements/chunks/dropdown-BFg8ri_R.js +1 -0
- package/dist/elements/chunks/ellipsis-dlN6YvGw.js +1 -0
- package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +141 -0
- package/dist/elements/chunks/external-link-DBX2lc_R.js +1 -0
- package/dist/elements/chunks/file-text-HfwUx4F9.js +1 -0
- package/dist/elements/chunks/file-tree-C6Toj71u.js +1 -0
- package/dist/elements/chunks/folder-MYuqa9Xp.js +1 -0
- package/dist/elements/chunks/github-dark-dimmed-DUshB20C.js +1 -0
- package/dist/elements/chunks/github-light-JYsPkUQd.js +1 -0
- package/dist/elements/chunks/hover-card-gE7iyXdW.js +1 -0
- package/dist/elements/chunks/html-CPZ3oZQ7.js +1 -0
- package/dist/elements/chunks/icon-Vqz4ivrY.js +1 -0
- package/dist/elements/chunks/index-BCRhi84a.js +1 -0
- package/dist/elements/chunks/info-B_toFS0l.js +1 -0
- package/dist/elements/chunks/input-gzbHYZvQ.js +1 -0
- package/dist/elements/chunks/javascript-C25yR2R2.js +1 -0
- package/dist/elements/chunks/json-DxJze_jm.js +1 -0
- package/dist/elements/chunks/kbd-n49c4KZm.js +1 -0
- package/dist/elements/chunks/link-CKPs9yM0.js +1 -0
- package/dist/elements/chunks/loader-q6MamGus.js +1 -0
- package/dist/elements/chunks/markdown-DBrcqq4S.js +64 -0
- package/dist/elements/chunks/message-CTqaYI0s.js +1 -0
- package/dist/elements/chunks/message-feedback-Cvzm03w0.js +1 -0
- package/dist/elements/chunks/message-square-CUg9eRCi.js +1 -0
- package/dist/elements/chunks/minimize-2-l2klxP6K.js +1 -0
- package/dist/elements/chunks/model-switcher-CmyjiHO1.js +1 -0
- package/dist/elements/chunks/overlay-C8sOYqjT.js +1 -0
- package/dist/elements/chunks/paperclip-42Ia7xHD.js +1 -0
- package/dist/elements/chunks/progress-bar-tzKMWAwO.js +1 -0
- package/dist/elements/chunks/prompt-suggestion-D3F6vP_A.js +1 -0
- package/dist/elements/chunks/reasoning-BJNmmyov.js +1 -0
- package/dist/elements/chunks/resizable-BRsk19qI.js +1 -0
- package/dist/elements/chunks/rotate-cw-BgcggLHC.js +1 -0
- package/dist/elements/chunks/scroll-area-CgGbFFbT.js +1 -0
- package/dist/elements/chunks/separator-8hM4GdHE.js +1 -0
- package/dist/elements/chunks/settings-CaUIYOg-.js +1 -0
- package/dist/elements/chunks/settings-group-CYjOVIZQ.js +1 -0
- package/dist/elements/chunks/share-BTYM3Ddt.js +1 -0
- package/dist/elements/chunks/skeleton-DsTYrPUe.js +1 -0
- package/dist/elements/chunks/slots-DkZ-Cmha.js +1 -0
- package/dist/elements/chunks/star-9R3LBQ9n.js +1 -0
- package/dist/elements/chunks/store-CYl5Y0_u.js +1 -0
- package/dist/elements/chunks/svelte--5p79yCD.js +1 -0
- package/dist/elements/chunks/text-shimmer-CaYGv8Se.js +1 -0
- package/dist/elements/chunks/textarea-NEr2SLcD.js +1 -0
- package/dist/elements/chunks/thumbs-up-DZYZkFfc.js +1 -0
- package/dist/elements/chunks/toast-store-ClxVZRcc.js +1 -0
- package/dist/elements/chunks/tool-CHZOmoe9.js +1 -0
- package/dist/elements/chunks/tooltip-WpHElELC.js +1 -0
- package/dist/elements/chunks/triangle-alert-BlS80PUg.js +1 -0
- package/dist/elements/chunks/tsx-B8rCNbgL.js +1 -0
- package/dist/elements/chunks/typescript-RycA9KXf.js +1 -0
- package/dist/elements/chunks/use-card-resolution-VSVoxDeJ.js +1 -0
- package/dist/elements/chunks/video-DxTPZqT8.js +1 -0
- package/dist/elements/chunks/vue-BmIZj4XD.js +1 -0
- package/dist/elements/chunks/x-C1qtndxn.js +1 -0
- package/dist/elements/coachmark.d.ts +1 -0
- package/dist/elements/coachmark.js +1 -0
- package/dist/elements/code-block.js +1 -0
- package/dist/elements/command.d.ts +1 -0
- package/dist/elements/command.js +1 -0
- package/dist/elements/compare.d.ts +1 -0
- package/dist/elements/compare.js +1 -0
- package/dist/elements/composer.d.ts +1 -0
- package/dist/elements/composer.js +1 -0
- package/dist/elements/confirm-card.js +1 -0
- package/dist/elements/context-meter.js +1 -0
- package/dist/elements/conversation-list.d.ts +1 -11
- package/dist/elements/conversation-list.js +1 -0
- package/dist/elements/default-input.d.ts +20 -9
- package/dist/elements/define.d.ts +11 -0
- package/dist/elements/dialog.d.ts +1 -0
- package/dist/elements/dialog.js +1 -0
- package/dist/elements/disclosure.d.ts +37 -0
- package/dist/elements/editable-label.d.ts +1 -0
- package/dist/elements/editable-label.js +1 -0
- package/dist/elements/embed.js +1 -0
- package/dist/elements/empty.js +1 -0
- package/dist/elements/feedback-bar.js +1 -0
- package/dist/elements/file-tree.js +1 -0
- package/dist/elements/file-upload.js +1 -0
- package/dist/elements/form.js +1 -0
- package/dist/elements/hover-card.d.ts +1 -0
- package/dist/elements/hover-card.js +1 -0
- package/dist/elements/icon.d.ts +1 -0
- package/dist/elements/icon.js +1 -0
- package/dist/elements/image.js +1 -0
- package/dist/elements/input.d.ts +1 -0
- package/dist/elements/input.js +1 -0
- package/dist/elements/kbd.d.ts +1 -0
- package/dist/elements/kbd.js +1 -0
- package/dist/elements/link-preview.js +1 -0
- package/dist/elements/loader.js +1 -0
- package/dist/elements/markdown.js +1 -0
- package/dist/elements/menu.d.ts +1 -0
- package/dist/elements/menu.js +1 -0
- package/dist/elements/message-skills.d.ts +0 -16
- package/dist/elements/message-skills.js +1 -0
- package/dist/elements/message.js +1 -0
- package/dist/elements/model-switcher.d.ts +1 -11
- package/dist/elements/model-switcher.js +1 -0
- package/dist/elements/nav.d.ts +1 -0
- package/dist/elements/nav.js +1 -0
- package/dist/elements/notice.d.ts +1 -0
- package/dist/elements/notice.js +1 -0
- package/dist/elements/pane-group.d.ts +1 -0
- package/dist/elements/pane-group.js +1 -0
- package/dist/elements/pane.d.ts +1 -0
- package/dist/elements/pane.js +1 -0
- package/dist/elements/popover.js +1 -0
- package/dist/elements/progress-bar.d.ts +1 -0
- package/dist/elements/progress-bar.js +1 -0
- package/dist/elements/prompt-dock.d.ts +1 -0
- package/dist/elements/prompt-dock.js +1 -0
- package/dist/elements/prompt-input.d.ts +1 -9
- package/dist/elements/prompt-input.js +1 -0
- package/dist/elements/prompt-suggestions.d.ts +0 -6
- package/dist/elements/prompt-suggestions.js +1 -0
- package/dist/elements/reasoning.js +1 -0
- package/dist/elements/register.d.ts +10 -0
- package/dist/elements/remote.js +1 -0
- package/dist/elements/resizable.d.ts +1 -17
- package/dist/elements/resizable.js +1 -0
- package/dist/elements/response-stream.js +14 -0
- package/dist/elements/screen.d.ts +1 -0
- package/dist/elements/screen.js +1 -0
- package/dist/elements/scroll-area.d.ts +1 -0
- package/dist/elements/scroll-area.js +1 -0
- package/dist/elements/scroll-button.js +1 -0
- package/dist/elements/search.d.ts +1 -0
- package/dist/elements/search.js +1 -0
- package/dist/elements/segmented.d.ts +1 -0
- package/dist/elements/segmented.js +1 -0
- package/dist/elements/separator.d.ts +1 -0
- package/dist/elements/separator.js +1 -0
- package/dist/elements/setting-item.d.ts +1 -0
- package/dist/elements/setting-item.js +1 -0
- package/dist/elements/settings-group.d.ts +1 -0
- package/dist/elements/settings-group.js +1 -0
- package/dist/elements/skeleton.d.ts +1 -0
- package/dist/elements/skeleton.js +1 -0
- package/dist/elements/slots.d.ts +176 -0
- package/dist/elements/source.d.ts +0 -17
- package/dist/elements/source.js +1 -0
- package/dist/elements/status.d.ts +1 -0
- package/dist/elements/status.js +1 -0
- package/dist/elements/switch.js +1 -0
- package/dist/elements/tabs.d.ts +1 -0
- package/dist/elements/tabs.js +1 -0
- package/dist/elements/tasks.js +1 -0
- package/dist/elements/text-shimmer.js +1 -0
- package/dist/elements/thinking-bar.js +1 -0
- package/dist/elements/toast.d.ts +1 -0
- package/dist/elements/toast.js +1 -0
- package/dist/elements/tool.js +1 -0
- package/dist/elements/tooltip.d.ts +1 -0
- package/dist/elements/tooltip.js +1 -0
- package/dist/elements/voice-input.js +1 -0
- package/dist/elements/voice-output.d.ts +1 -0
- package/dist/elements/voice-output.js +1 -0
- package/dist/elements.d.ts +772 -61
- package/dist/engine-javascript-C1x7zo1_.js +141 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +14405 -9810
- package/dist/kai.es.js +1 -0
- package/dist/llms/llms-full.txt +1234 -107
- package/dist/llms/llms.txt +4 -4
- package/dist/mcp.es.js +217 -6
- package/dist/primitives/card-contract.d.ts +20 -4
- package/dist/primitives/card-recovery.d.ts +55 -0
- package/dist/primitives/composer-model.d.ts +22 -0
- package/dist/primitives/composer-triggers.d.ts +19 -0
- package/dist/primitives/create-kai-chat.d.ts +38 -0
- package/dist/primitives/message-feedback.d.ts +35 -0
- package/dist/primitives/toast-store.d.ts +118 -0
- package/dist/primitives/use-speech-recognition.d.ts +26 -0
- package/dist/react/index.d.ts +1166 -98
- package/dist/react/runtime.d.ts +9 -2
- package/dist/react/use-kai-chat.d.ts +41 -0
- package/dist/react.js +575 -186
- package/dist/register-impl-CYWGkgbI.js +141 -0
- package/dist/schemas/choice.schema.json +5 -0
- package/dist/schemas/tasks.schema.json +7 -2
- package/dist/state/index.d.ts +4 -0
- package/dist/state/messages.d.ts +11 -0
- package/dist/state/stream.d.ts +22 -0
- package/dist/state/suggestions.d.ts +4 -0
- package/dist/state.js +117 -0
- package/dist/theme.tokens.css +87 -0
- package/dist/types.d.ts +4 -0
- package/dist/ui/agent-card.d.ts +61 -0
- package/dist/ui/button.d.ts +5 -2
- package/dist/ui/card.d.ts +61 -0
- package/dist/ui/collapsible.d.ts +15 -1
- package/dist/ui/command.d.ts +33 -0
- package/dist/ui/dialog.d.ts +42 -0
- package/dist/ui/dropdown.d.ts +95 -1
- package/dist/ui/editable-label.d.ts +26 -0
- package/dist/ui/hover-card.d.ts +13 -1
- package/dist/ui/icon.d.ts +18 -0
- package/dist/ui/input.d.ts +33 -0
- package/dist/ui/kbd.d.ts +21 -0
- package/dist/ui/nav.d.ts +62 -0
- package/dist/ui/notice.d.ts +31 -0
- package/dist/ui/overlay.d.ts +12 -0
- package/dist/ui/pane-grid.d.ts +58 -0
- package/dist/ui/pane-group.d.ts +75 -0
- package/dist/ui/pane.d.ts +78 -0
- package/dist/ui/popover.d.ts +11 -1
- package/dist/ui/progress-bar.d.ts +23 -0
- package/dist/ui/prompt-dock.d.ts +96 -0
- package/dist/ui/resizable.d.ts +12 -0
- package/dist/ui/scroll-area.d.ts +4 -0
- package/dist/ui/segmented.d.ts +28 -0
- package/dist/ui/settings-group.d.ts +32 -0
- package/dist/ui/skeleton.d.ts +12 -0
- package/dist/ui/stat.d.ts +16 -0
- package/dist/ui/status.d.ts +13 -0
- package/dist/ui/switch.d.ts +8 -1
- package/dist/ui/tabs.d.ts +35 -0
- package/dist/ui/tooltip.d.ts +20 -1
- package/frameworks/react/index.tsx +1100 -163
- package/frameworks/react/runtime.tsx +30 -1
- package/frameworks/react/use-kai-chat.tsx +87 -0
- package/llms-full.txt +1234 -107
- package/llms.txt +4 -4
- package/package.json +36 -12
- package/src/agent-tooling/mcp/manifest.ts +14 -0
- package/src/agent-tooling/mcp/tools/debug.ts +194 -6
- package/src/agent-tooling/mcp/tools/reference.ts +32 -0
- package/src/agent-tooling/mcp/tools/scaffold.ts +162 -1
- package/src/components/artifact.tsx +98 -13
- package/src/components/attachment-types.ts +13 -0
- package/src/components/attachments.tsx +4 -14
- package/src/components/card.tsx +109 -15
- package/src/components/chain-of-thought.tsx +210 -1
- package/src/components/chat-scope-picker.tsx +13 -3
- package/src/components/chat-thread.tsx +238 -137
- package/src/components/choice-card.tsx +136 -15
- package/src/components/coachmark.tsx +245 -0
- package/src/components/component-meta.json +921 -108
- package/src/components/composer-dom.ts +159 -0
- package/src/components/composer-highlight.ts +242 -0
- package/src/components/composer-history.ts +82 -0
- package/src/components/composer.tsx +979 -0
- package/src/components/confirm-card.tsx +69 -2
- package/src/components/conversation-item.tsx +69 -7
- package/src/components/conversation-list.tsx +134 -37
- package/src/components/dismissed-stub.tsx +80 -0
- package/src/components/file-tree.tsx +197 -47
- package/src/components/form-widgets.tsx +9 -7
- package/src/components/form.tsx +161 -20
- package/src/components/image.tsx +3 -5
- package/src/components/link-preview.tsx +5 -4
- package/src/components/markdown.tsx +5 -2
- package/src/components/message.tsx +174 -14
- package/src/components/model-switcher.tsx +19 -4
- package/src/components/prompt-input.tsx +46 -75
- package/src/components/prompt-suggestion.tsx +48 -16
- package/src/components/reasoning.tsx +29 -6
- package/src/components/response-compare-types.ts +127 -0
- package/src/components/response-compare.tsx +460 -0
- package/src/components/screen.tsx +176 -0
- package/src/components/tasks-card.tsx +374 -23
- package/src/components/toast.tsx +486 -0
- package/src/components/tool-types.ts +10 -0
- package/src/components/tool.tsx +22 -16
- package/src/components/use-card-resolution.ts +24 -8
- package/src/components/voice-input.tsx +102 -19
- package/src/components/voice-output.tsx +202 -0
- package/src/elements/agent-card.tsx +67 -0
- package/src/elements/artifact.tsx +53 -4
- package/src/elements/attachments.tsx +1 -0
- package/src/elements/autoloader.ts +89 -0
- package/src/elements/avatar.tsx +33 -0
- package/src/elements/badge.tsx +32 -0
- package/src/elements/button.tsx +126 -0
- package/src/elements/card-media.jpg +0 -0
- package/src/elements/card.tsx +124 -31
- package/src/elements/cards.tsx +81 -7
- package/src/elements/chain-of-thought.tsx +77 -32
- package/src/elements/chat-scope-picker.tsx +35 -8
- package/src/elements/chat-types.ts +9 -2
- package/src/elements/chat-workspace.tsx +157 -43
- package/src/elements/chat.tsx +49 -25
- package/src/elements/choice.tsx +71 -19
- package/src/elements/coachmark.tsx +90 -0
- package/src/elements/command.tsx +209 -0
- package/src/elements/compare.tsx +110 -0
- package/src/elements/compiled.css +1 -1
- package/src/elements/composer.tsx +151 -0
- package/src/elements/confirm-card.tsx +36 -11
- package/src/elements/conversation-list.tsx +80 -11
- package/src/elements/default-input.tsx +75 -53
- package/src/elements/define.tsx +47 -6
- package/src/elements/dialog.tsx +98 -0
- package/src/elements/disclosure.ts +73 -0
- package/src/elements/editable-label.tsx +125 -0
- package/src/elements/element-manifest.json +310 -0
- package/src/elements/element-meta.json +5954 -1605
- package/src/elements/element-types.d.ts +771 -60
- package/src/elements/file-tree.tsx +12 -2
- package/src/elements/file-upload.tsx +1 -1
- package/src/elements/form.tsx +54 -11
- package/src/elements/hover-card.tsx +80 -0
- package/src/elements/icon-names.json +48 -0
- package/src/elements/icon.tsx +41 -0
- package/src/elements/input.tsx +203 -0
- package/src/elements/kbd.tsx +45 -0
- package/src/elements/menu.tsx +217 -0
- package/src/elements/message.tsx +84 -55
- package/src/elements/model-switcher.tsx +27 -1
- package/src/elements/nav.tsx +87 -0
- package/src/elements/notice.tsx +53 -0
- package/src/elements/pane-group.tsx +119 -0
- package/src/elements/pane.tsx +129 -0
- package/src/elements/popover.tsx +39 -17
- package/src/elements/progress-bar.tsx +39 -0
- package/src/elements/prompt-dock.tsx +81 -0
- package/src/elements/prompt-input.tsx +112 -63
- package/src/elements/prompt-suggestions.tsx +25 -9
- package/src/elements/reasoning.tsx +30 -9
- package/src/elements/register-impl.ts +41 -3
- package/src/elements/register.ts +20 -3
- package/src/elements/remote.tsx +4 -0
- package/src/elements/resizable.tsx +48 -11
- package/src/elements/screen.tsx +90 -0
- package/src/elements/scroll-area.tsx +33 -0
- package/src/elements/search.tsx +180 -0
- package/src/elements/segmented.tsx +135 -0
- package/src/elements/separator.tsx +36 -0
- package/src/elements/setting-item.tsx +50 -0
- package/src/elements/settings-group.tsx +37 -0
- package/src/elements/skeleton.tsx +45 -0
- package/src/elements/slots.ts +607 -0
- package/src/elements/source.tsx +13 -6
- package/src/elements/status.tsx +42 -0
- package/src/elements/styles.css +19 -0
- package/src/elements/switch.tsx +89 -14
- package/src/elements/tabs.tsx +95 -0
- package/src/elements/tasks.tsx +70 -14
- package/src/elements/toast.tsx +89 -0
- package/src/elements/tool.tsx +43 -9
- package/src/elements/tooltip.tsx +85 -0
- package/src/elements/video-poster.jpg +0 -0
- package/src/elements/voice-input.tsx +66 -16
- package/src/elements/voice-output.tsx +69 -0
- package/src/index.ts +35 -2
- package/src/primitives/card-contract.ts +14 -5
- package/src/primitives/card-recovery.ts +149 -0
- package/src/primitives/card-routing.ts +3 -0
- package/src/primitives/card-schemas/choice.schema.json +5 -0
- package/src/primitives/card-schemas/tasks.schema.json +7 -2
- package/src/primitives/composer-model.ts +49 -0
- package/src/primitives/composer-triggers.ts +35 -0
- package/src/primitives/create-kai-chat.ts +66 -0
- package/src/primitives/message-feedback.ts +123 -0
- package/src/primitives/toast-store.ts +276 -0
- package/src/primitives/use-speech-recognition.ts +135 -0
- package/src/state/index.ts +6 -0
- package/src/state/messages.ts +36 -0
- package/src/state/stream.ts +92 -0
- package/src/state/suggestions.ts +9 -0
- package/src/types.ts +4 -0
- package/src/ui/agent-card.tsx +212 -0
- package/src/ui/button.tsx +16 -5
- package/src/ui/card.tsx +245 -0
- package/src/ui/collapsible.tsx +30 -4
- package/src/ui/command.tsx +99 -0
- package/src/ui/dialog.tsx +217 -0
- package/src/ui/dropdown.tsx +375 -13
- package/src/ui/editable-label.tsx +112 -0
- package/src/ui/hover-card.tsx +28 -5
- package/src/ui/icon.tsx +110 -0
- package/src/ui/input.tsx +132 -0
- package/src/ui/kbd.tsx +118 -0
- package/src/ui/nav.tsx +282 -0
- package/src/ui/notice.tsx +84 -0
- package/src/ui/overlay.tsx +108 -2
- package/src/ui/pane-grid.tsx +116 -0
- package/src/ui/pane-group.tsx +280 -0
- package/src/ui/pane.tsx +193 -0
- package/src/ui/popover.tsx +16 -2
- package/src/ui/progress-bar.tsx +83 -0
- package/src/ui/prompt-dock.tsx +145 -0
- package/src/ui/resizable.tsx +69 -1
- package/src/ui/scroll-area.tsx +14 -3
- package/src/ui/segmented.tsx +109 -0
- package/src/ui/settings-group.tsx +67 -0
- package/src/ui/skeleton.tsx +62 -5
- package/src/ui/stat.tsx +41 -0
- package/src/ui/status.tsx +48 -0
- package/src/ui/switch.tsx +49 -23
- package/src/ui/tabs.tsx +168 -0
- package/src/ui/tooltip.tsx +57 -7
- package/theme.css +113 -0
- package/dist/components/slash-command.d.ts +0 -15
- package/dist/kitn-chat.es.js +0 -1
- package/dist/register-impl-wCsFPoh9.js +0 -77
- package/dist/register-ujhr1nBS.js +0 -1
- package/src/components/slash-command.tsx +0 -232
- package/src/elements/framework-usage.json +0 -563
- /package/dist/{kitn-chat-provider.d.ts → kai-provider.d.ts} +0 -0
- /package/dist/{kitn-chat-provider.es.js → kai-provider.es.js} +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type JSX, Show, createSignal } from 'solid-js';
|
|
2
|
+
import { Info, TriangleAlert, CircleAlert, CircleCheck, X } from 'lucide-solid';
|
|
3
|
+
import { cn } from '../utils/cn';
|
|
4
|
+
import { renderIcon } from './icon';
|
|
5
|
+
|
|
6
|
+
export type NoticeSeverity = 'neutral' | 'info' | 'warning' | 'error' | 'success';
|
|
7
|
+
|
|
8
|
+
const SEVERITY_ICON = { neutral: Info, info: Info, warning: TriangleAlert, error: CircleAlert, success: CircleCheck };
|
|
9
|
+
|
|
10
|
+
/** Icon tint per severity. Neutral stays muted; the rest use the kit's tool hues
|
|
11
|
+
* (the same on-brand, AA-checked colors used by tool/status chips). */
|
|
12
|
+
const ICON_TONE: Record<NoticeSeverity, string> = {
|
|
13
|
+
neutral: 'text-muted-foreground',
|
|
14
|
+
info: 'text-tool-blue',
|
|
15
|
+
warning: 'text-tool-amber',
|
|
16
|
+
error: 'text-tool-red',
|
|
17
|
+
success: 'text-tool-green',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** The default leading icon for a notice: `null` when `icon="none"`, the named
|
|
21
|
+
* icon when one is given, else the severity glyph. Exported so the `kai-notice`
|
|
22
|
+
* facade can use it as the fallback inside a `slot="icon"` escape hatch. */
|
|
23
|
+
export function noticeIconNode(severity: NoticeSeverity, icon?: string): JSX.Element {
|
|
24
|
+
if (icon === 'none') return null;
|
|
25
|
+
if (icon) return renderIcon(icon, { class: cn('size-4 shrink-0', ICON_TONE[severity]) });
|
|
26
|
+
const I = SEVERITY_ICON[severity];
|
|
27
|
+
return <I class={cn('size-4 shrink-0', ICON_TONE[severity])} aria-hidden="true" />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface NoticeProps {
|
|
31
|
+
severity?: NoticeSeverity;
|
|
32
|
+
/** Leading icon: omit for the severity default, `"none"` to hide it, or a named
|
|
33
|
+
* icon to override. */
|
|
34
|
+
icon?: string;
|
|
35
|
+
/** A custom icon node that replaces the icon region entirely (the `kai-notice`
|
|
36
|
+
* facade passes a `slot="icon"` here, with the default icon as its fallback). */
|
|
37
|
+
iconSlot?: JSX.Element;
|
|
38
|
+
/** Render a dismiss (×) button that hides the notice and calls `onDismiss`. */
|
|
39
|
+
dismissible?: boolean;
|
|
40
|
+
/** Called after the notice is dismissed. */
|
|
41
|
+
onDismiss?: () => void;
|
|
42
|
+
/** The message. */
|
|
43
|
+
children: JSX.Element;
|
|
44
|
+
/** Optional trailing action (e.g. a link). */
|
|
45
|
+
action?: JSX.Element;
|
|
46
|
+
class?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A self-contained inline notice / alert: a leading severity icon, a message, an
|
|
51
|
+
* optional trailing action, and an optional dismiss. Carries the right a11y role
|
|
52
|
+
* (`alert` for errors, `status` otherwise). Placement is the consumer's — this is
|
|
53
|
+
* just the notice box.
|
|
54
|
+
*/
|
|
55
|
+
export function Notice(props: NoticeProps) {
|
|
56
|
+
const [open, setOpen] = createSignal(true);
|
|
57
|
+
const severity = (): NoticeSeverity => props.severity ?? 'neutral';
|
|
58
|
+
const dismiss = () => { setOpen(false); props.onDismiss?.(); };
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Show when={open()}>
|
|
62
|
+
<div
|
|
63
|
+
role={severity() === 'error' ? 'alert' : 'status'}
|
|
64
|
+
class={cn('flex items-center gap-2.5 rounded-lg bg-surface px-3.5 py-2.5 text-sm', props.class)}
|
|
65
|
+
>
|
|
66
|
+
<Show when={props.iconSlot} fallback={noticeIconNode(severity(), props.icon)}>
|
|
67
|
+
{props.iconSlot}
|
|
68
|
+
</Show>
|
|
69
|
+
<div class="flex-1 leading-snug text-muted-foreground">{props.children}</div>
|
|
70
|
+
<Show when={props.action}>{props.action}</Show>
|
|
71
|
+
<Show when={props.dismissible}>
|
|
72
|
+
<button
|
|
73
|
+
type="button"
|
|
74
|
+
aria-label="Dismiss"
|
|
75
|
+
onClick={dismiss}
|
|
76
|
+
class="-my-1 -mr-1.5 shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
|
77
|
+
>
|
|
78
|
+
<X class="size-3.5" aria-hidden="true" />
|
|
79
|
+
</button>
|
|
80
|
+
</Show>
|
|
81
|
+
</div>
|
|
82
|
+
</Show>
|
|
83
|
+
);
|
|
84
|
+
}
|
package/src/ui/overlay.tsx
CHANGED
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
} from 'solid-js';
|
|
4
4
|
import { Dynamic } from 'solid-js/web';
|
|
5
5
|
import {
|
|
6
|
-
computePosition, autoUpdate, offset, flip, shift, arrow, hide,
|
|
6
|
+
computePosition, autoUpdate, offset, flip, shift, arrow, hide,
|
|
7
|
+
getOverflowAncestors, type Placement,
|
|
7
8
|
} from '@floating-ui/dom';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -72,6 +73,84 @@ export interface UsePositionOptions {
|
|
|
72
73
|
placement?: Placement;
|
|
73
74
|
gutter?: number;
|
|
74
75
|
arrowEl?: Accessor<HTMLElement | undefined>;
|
|
76
|
+
/**
|
|
77
|
+
* Fired ONCE when the reference (anchor) "goes away" — either removed from the
|
|
78
|
+
* document OR hidden behind an `inert` ancestor (e.g. a modal/takeover that
|
|
79
|
+
* inert-s the background while open). In both cases the anchor is no longer a
|
|
80
|
+
* valid, interactive target, so the caller should close the overlay and unmount
|
|
81
|
+
* its portal instead of leaving it orphaned (floating over an inert background or
|
|
82
|
+
* anchored to a node that no longer exists). Anchored overlays portal OUT of the
|
|
83
|
+
* trigger's subtree, so Solid's onCleanup does not catch an anchor that is
|
|
84
|
+
* removed/inerted independently of the overlay component. Wire this to set the
|
|
85
|
+
* overlay's open state to false.
|
|
86
|
+
*/
|
|
87
|
+
onDisconnect?: () => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* True if `node` sits inside an `inert` subtree. Climbs ACROSS shadow boundaries:
|
|
92
|
+
* an anchor often lives inside a web component's shadow root (kai-coachmark renders
|
|
93
|
+
* its anchor span in its own shadow) while `inert` lands on a LIGHT-DOM ancestor of
|
|
94
|
+
* the host (kai-screen inert-s its siblings, e.g. kai-workspace). `closest('[inert]')`
|
|
95
|
+
* alone cannot see that because it halts at the shadow root, so after each tree we
|
|
96
|
+
* hop to the host of the containing ShadowRoot and keep climbing.
|
|
97
|
+
*/
|
|
98
|
+
function inInertSubtree(node: Node | null): boolean {
|
|
99
|
+
let n: Node | null = node;
|
|
100
|
+
while (n) {
|
|
101
|
+
if (n instanceof Element && n.closest('[inert]')) return true;
|
|
102
|
+
const root = n.getRootNode();
|
|
103
|
+
n = root instanceof ShadowRoot ? root.host : null;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Watch for the reference element "going away" and fire `onDisconnect` exactly
|
|
110
|
+
* once. The anchor is gone when it is either removed from the document OR hidden
|
|
111
|
+
* behind an `inert` ancestor (`inInertSubtree(reference)`, which crosses shadow
|
|
112
|
+
* boundaries) — the latter is how a modal/takeover (e.g. kai-screen) makes the
|
|
113
|
+
* background non-interactive while leaving it in the DOM. Either way the anchor is
|
|
114
|
+
* no longer a valid target and the overlay must close.
|
|
115
|
+
*
|
|
116
|
+
* Uses a MutationObserver on BOTH the document and the anchor's root node: the
|
|
117
|
+
* document catches the anchor's host being removed and any ancestor gaining
|
|
118
|
+
* `inert` (and light-DOM removals), while the anchor's root node — a ShadowRoot
|
|
119
|
+
* for kai-* elements — catches removals INSIDE the shadow tree, which a
|
|
120
|
+
* document-level observer can't see through encapsulation. We observe childList
|
|
121
|
+
* (DOM removals) AND the `inert` attribute, then re-check the anchor after any
|
|
122
|
+
* mutation. Guarded for environments without MutationObserver. Returns a teardown
|
|
123
|
+
* that disconnects the observer.
|
|
124
|
+
*/
|
|
125
|
+
function watchAnchorGone(ref: HTMLElement, onDisconnect: () => void): () => void {
|
|
126
|
+
if (typeof MutationObserver !== 'function') return () => {};
|
|
127
|
+
let fired = false;
|
|
128
|
+
// "Live" = connected AND not buried under an inert ancestor (across shadow roots).
|
|
129
|
+
const isLive = () => ref.isConnected && !inInertSubtree(ref);
|
|
130
|
+
// Only fire after the anchor has actually been live, so a one-off setup while
|
|
131
|
+
// detached/inert can never trigger a false disconnect.
|
|
132
|
+
let everLive = isLive();
|
|
133
|
+
const check = () => {
|
|
134
|
+
if (fired) return;
|
|
135
|
+
if (isLive()) { everLive = true; return; }
|
|
136
|
+
if (!everLive) return;
|
|
137
|
+
fired = true;
|
|
138
|
+
obs.disconnect();
|
|
139
|
+
onDisconnect();
|
|
140
|
+
};
|
|
141
|
+
const obs = new MutationObserver(check);
|
|
142
|
+
const roots = new Set<Node>();
|
|
143
|
+
if (typeof document !== 'undefined') roots.add(document);
|
|
144
|
+
const rootNode = ref.getRootNode();
|
|
145
|
+
if (rootNode) roots.add(rootNode);
|
|
146
|
+
for (const root of roots) {
|
|
147
|
+
try {
|
|
148
|
+
obs.observe(root, {
|
|
149
|
+
childList: true, subtree: true, attributes: true, attributeFilter: ['inert'],
|
|
150
|
+
});
|
|
151
|
+
} catch { /* unobservable root */ }
|
|
152
|
+
}
|
|
153
|
+
return () => obs.disconnect();
|
|
75
154
|
}
|
|
76
155
|
|
|
77
156
|
/**
|
|
@@ -116,8 +195,35 @@ export function usePosition(
|
|
|
116
195
|
setHidden(!!middlewareData.hide?.referenceHidden);
|
|
117
196
|
});
|
|
118
197
|
};
|
|
198
|
+
// autoUpdate tracks scroll, window resize, reference/floating ResizeObserver,
|
|
199
|
+
// and reference layout-shifts (IntersectionObserver). But its `ancestorResize`
|
|
200
|
+
// only listens for DOM `resize` events (which ONLY `window` fires), so an
|
|
201
|
+
// ANCESTOR element resizing (e.g. a sibling resizable sidebar reflowing the
|
|
202
|
+
// anchor's container without resizing the anchor itself) is caught only by the
|
|
203
|
+
// threshold-based layoutShift, which lags during a continuous drag. Add a
|
|
204
|
+
// ResizeObserver across the reference and its overflow ancestors so the
|
|
205
|
+
// floating node follows the anchor on any layout resize. Both are torn down
|
|
206
|
+
// on unmount via onCleanup.
|
|
119
207
|
const cleanup = autoUpdate(ref, float, update);
|
|
120
|
-
|
|
208
|
+
let ro: ResizeObserver | undefined;
|
|
209
|
+
if (typeof ResizeObserver === 'function') {
|
|
210
|
+
ro = new ResizeObserver(update);
|
|
211
|
+
ro.observe(ref);
|
|
212
|
+
for (const ancestor of getOverflowAncestors(ref)) {
|
|
213
|
+
if (ancestor instanceof Element) ro.observe(ancestor);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// When the anchor goes away (removed from the DOM or buried under an inert
|
|
217
|
+
// ancestor), close the overlay so its portal unmounts instead of floating
|
|
218
|
+
// orphaned. Independent of autoUpdate/ResizeObserver.
|
|
219
|
+
const disconnectWatch = options.onDisconnect
|
|
220
|
+
? watchAnchorGone(ref, options.onDisconnect)
|
|
221
|
+
: undefined;
|
|
222
|
+
onCleanup(() => {
|
|
223
|
+
cleanup();
|
|
224
|
+
ro?.disconnect();
|
|
225
|
+
disconnectWatch?.();
|
|
226
|
+
});
|
|
121
227
|
});
|
|
122
228
|
|
|
123
229
|
return { pos, arrowPos, hidden };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type JSX, For, children as resolveChildren } from 'solid-js';
|
|
2
|
+
import { cn } from '../utils/cn';
|
|
3
|
+
|
|
4
|
+
export interface PaneGridProps {
|
|
5
|
+
/** The panes - arbitrary N. Each top-level child is one tile in the grid. */
|
|
6
|
+
children: JSX.Element;
|
|
7
|
+
/** Minimum width of every pane, in px, before columns drop / the grid scrolls.
|
|
8
|
+
* Defaults to `280`. */
|
|
9
|
+
minPaneWidth?: number;
|
|
10
|
+
/** Minimum height of every pane, in px, before the grid scrolls vertically.
|
|
11
|
+
* Defaults to `200`. */
|
|
12
|
+
minPaneHeight?: number;
|
|
13
|
+
/** Column cap when the container is wide. Columns fill up to this many, then drop
|
|
14
|
+
* to fewer as the container narrows. Defaults to `3`. */
|
|
15
|
+
maxColumns?: number;
|
|
16
|
+
/** Gap between panes - any CSS length. Defaults to the kit gap
|
|
17
|
+
* (`var(--kai-pane-grid-gap, 0.5rem)`). */
|
|
18
|
+
gap?: string;
|
|
19
|
+
/** When set to a valid child index, render ONLY that pane full-bleed (a single
|
|
20
|
+
* filling cell) - a simple maximize hook the consumer drives. `null`/`undefined`
|
|
21
|
+
* (or an out-of-range index) shows the full tiled grid. */
|
|
22
|
+
maximizedIndex?: number | null;
|
|
23
|
+
/** Extra classes for the grid container. */
|
|
24
|
+
class?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* PaneGrid - an N-pane responsive tiling grid with a min-size + scroll floor.
|
|
29
|
+
*
|
|
30
|
+
* Lays an arbitrary number of panes out in a CSS grid that fills up to
|
|
31
|
+
* `maxColumns` columns when wide, then DROPS columns (maxColumns -> ... -> 1) as
|
|
32
|
+
* the container narrows - so panes never squish below their minimums. Once even one
|
|
33
|
+
* column can't hold a pane at `minPaneWidth`, the grid SCROLLS instead of shrinking
|
|
34
|
+
* the panes; rows are kept at least `minPaneHeight` tall the same way. Because new
|
|
35
|
+
* rows stack downward, the overflow is preferentially VERTICAL - horizontal scroll
|
|
36
|
+
* only appears when the container is narrower than a single pane's minimum.
|
|
37
|
+
*
|
|
38
|
+
* This generalizes the hand-rolled center grid from the Split Workspace demo, where
|
|
39
|
+
* `kai-resizable` (capped at 3 panes) couldn't express an arbitrary-N tiled grid.
|
|
40
|
+
*
|
|
41
|
+
* Column track (computed from the props):
|
|
42
|
+
*
|
|
43
|
+
* repeat(auto-fit, minmax(max(<minPaneWidth>px, (100% - <gaps>) / <maxColumns>), 1fr))
|
|
44
|
+
*
|
|
45
|
+
* where `<gaps>` is the total inter-column gap at the cap, `(maxColumns - 1) * gap`.
|
|
46
|
+
* The inner `max()` is the floor: each track is at least `minPaneWidth`, and at most
|
|
47
|
+
* `1fr`; the `(100% - gaps) / maxColumns` term is the per-column width WHEN the cap is
|
|
48
|
+
* filled, so `auto-fit` never packs in more than `maxColumns` columns. As the
|
|
49
|
+
* container shrinks past the point where a column can be `minPaneWidth` wide, a column
|
|
50
|
+
* drops; below one pane's minimum, the `overflow:auto` + `min-w-0`/`min-h-0` container
|
|
51
|
+
* scrolls.
|
|
52
|
+
*
|
|
53
|
+
* Maximize: when `maximizedIndex` points at a child, only that pane renders, in a
|
|
54
|
+
* single `1fr` x `1fr` cell that fills the grid. Restore by clearing the prop.
|
|
55
|
+
*
|
|
56
|
+
* The gap default reads `--kai-pane-grid-gap` (fallback `0.5rem`), so a consumer can
|
|
57
|
+
* retune spacing from outside without passing the prop. Everything is tokenized
|
|
58
|
+
* (surface/border come from whatever the panes use) - no hardcoded colors, so it
|
|
59
|
+
* reads correctly in light and dark.
|
|
60
|
+
*/
|
|
61
|
+
export function PaneGrid(props: PaneGridProps) {
|
|
62
|
+
const minPaneWidth = () => props.minPaneWidth ?? 280;
|
|
63
|
+
const minPaneHeight = () => props.minPaneHeight ?? 200;
|
|
64
|
+
const maxColumns = () => Math.max(1, props.maxColumns ?? 3);
|
|
65
|
+
const gap = () => props.gap ?? 'var(--kai-pane-grid-gap, 0.5rem)';
|
|
66
|
+
|
|
67
|
+
// Resolve children to their rendered nodes so a single pane can be picked out for
|
|
68
|
+
// the maximize hook (mirrors how Resizable reads its panels).
|
|
69
|
+
const resolved = resolveChildren(() => props.children);
|
|
70
|
+
const items = (): JSX.Element[] => resolved.toArray() as JSX.Element[];
|
|
71
|
+
|
|
72
|
+
// A valid maximize target, or null for the full grid.
|
|
73
|
+
const maxIndex = (): number | null => {
|
|
74
|
+
const m = props.maximizedIndex;
|
|
75
|
+
if (m == null) return null;
|
|
76
|
+
return m >= 0 && m < items().length ? m : null;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const shown = (): JSX.Element[] => {
|
|
80
|
+
const m = maxIndex();
|
|
81
|
+
return m == null ? items() : [items()[m]];
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const gridStyle = (): JSX.CSSProperties => {
|
|
85
|
+
const g = gap();
|
|
86
|
+
if (maxIndex() != null) {
|
|
87
|
+
// One filling cell.
|
|
88
|
+
return {
|
|
89
|
+
'grid-template-columns': '1fr',
|
|
90
|
+
'grid-auto-rows': '1fr',
|
|
91
|
+
gap: g,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const cols = maxColumns();
|
|
95
|
+
// The per-column width when the cap is filled: (container - all gaps) / cols.
|
|
96
|
+
// Inside max() this is a math sub-expression, so the var/number arithmetic is valid.
|
|
97
|
+
const capped = `(100% - ${cols - 1} * ${g}) / ${cols}`;
|
|
98
|
+
return {
|
|
99
|
+
'grid-template-columns': `repeat(auto-fit, minmax(max(${minPaneWidth()}px, ${capped}), 1fr))`,
|
|
100
|
+
'grid-auto-rows': `minmax(${minPaneHeight()}px, 1fr)`,
|
|
101
|
+
gap: g,
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div
|
|
107
|
+
data-pane-grid
|
|
108
|
+
// min-w-0 / min-h-0 let the grid shrink inside a flex/grid parent so its own
|
|
109
|
+
// overflow:auto (not the parent) takes over once panes hit their minimums.
|
|
110
|
+
class={cn('grid h-full w-full min-h-0 min-w-0 overflow-auto', props.class)}
|
|
111
|
+
style={gridStyle()}
|
|
112
|
+
>
|
|
113
|
+
<For each={shown()}>{(pane) => pane}</For>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { type JSX, For, Show } from 'solid-js';
|
|
2
|
+
import { MoreHorizontal, X } from 'lucide-solid';
|
|
3
|
+
import { type PaneStatusTone } from './pane';
|
|
4
|
+
import { cn } from '../utils/cn';
|
|
5
|
+
|
|
6
|
+
/** The work state of a tab's agent/process, mapped to the kit's tool / status
|
|
7
|
+
* hues — the SAME vocabulary as {@link './pane'.PaneStatus} and the AgentCard:
|
|
8
|
+
* working = blue, idle = muted, done = green, error = red, blocked = amber. */
|
|
9
|
+
export interface PaneTabStatus {
|
|
10
|
+
/** Which hue the numbered badge takes. */
|
|
11
|
+
tone: PaneStatusTone;
|
|
12
|
+
/** Optional status word shown on the active tab, on hover, and always for a
|
|
13
|
+
* needs-attention / error tab. Without it only the badge color carries state. */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** Animate a ping ring around the badge — for the live `working` state.
|
|
16
|
+
* Respects prefers-reduced-motion. */
|
|
17
|
+
pulse?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** One tab in a {@link PaneGroup}: an agent/window shown in the strip. */
|
|
21
|
+
export interface PaneTab {
|
|
22
|
+
/** Stable id, emitted as the selected value throughout. */
|
|
23
|
+
id: string;
|
|
24
|
+
/** The tab name (the agent / window title). */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Run status — drives the numbered badge color + the status word. Defaults to
|
|
27
|
+
* an `idle` (muted) badge with no word. */
|
|
28
|
+
status?: PaneTabStatus;
|
|
29
|
+
/** Raise the attention treatment: an amber ring + the status word always shown.
|
|
30
|
+
* The "this one wants you" signal. */
|
|
31
|
+
needsAttention?: boolean;
|
|
32
|
+
/** The keyboard NUMBER shown inside the badge (the ⌥-jump hint). Defaults to the
|
|
33
|
+
* tab's 1-based position in the strip. */
|
|
34
|
+
number?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PaneGroupProps {
|
|
38
|
+
/** The tabs, left → right. Each is one agent/window in the group. */
|
|
39
|
+
tabs: PaneTab[];
|
|
40
|
+
/** The active tab id. Defaults to the first tab. Drive it from `onTabChange`. */
|
|
41
|
+
active?: string;
|
|
42
|
+
/** A tab was selected (click, Enter/Space, or arrow-key move). */
|
|
43
|
+
onTabChange?: (id: string) => void;
|
|
44
|
+
/** A tab's close (×) was clicked. The consumer drops the tab from `tabs`. */
|
|
45
|
+
onTabClose?: (id: string) => void;
|
|
46
|
+
/** A tab's "…" overflow was clicked. The consumer wires the actual menu; the
|
|
47
|
+
* group only surfaces the affordance. Omit to hide the "…" button. */
|
|
48
|
+
onTabMenu?: (id: string) => void;
|
|
49
|
+
/** Highlight the frame with a ring/border to mark this as the ACTIVE group in a
|
|
50
|
+
* multi-group layout. */
|
|
51
|
+
focused?: boolean;
|
|
52
|
+
/** The active pane's body — the consumer owns it and swaps it on `onTabChange`. */
|
|
53
|
+
children?: JSX.Element;
|
|
54
|
+
/** Extra classes for the outer frame. */
|
|
55
|
+
class?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** tone → numbered-badge background (the kit's tool hues + muted for idle). */
|
|
59
|
+
const TONE_BG: Record<PaneStatusTone, string> = {
|
|
60
|
+
working: 'bg-tool-blue',
|
|
61
|
+
idle: 'bg-muted-foreground',
|
|
62
|
+
done: 'bg-tool-green',
|
|
63
|
+
error: 'bg-tool-red',
|
|
64
|
+
blocked: 'bg-tool-amber',
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** tone → badge digit color (contrasts the solid badge fill). */
|
|
68
|
+
const TONE_BADGE_FG: Record<PaneStatusTone, string> = {
|
|
69
|
+
working: 'text-white',
|
|
70
|
+
idle: 'text-background',
|
|
71
|
+
done: 'text-white',
|
|
72
|
+
error: 'text-white',
|
|
73
|
+
blocked: 'text-white',
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** tone → matching text color for the inline status word. */
|
|
77
|
+
const TONE_TEXT: Record<PaneStatusTone, string> = {
|
|
78
|
+
working: 'text-tool-blue',
|
|
79
|
+
idle: 'text-muted-foreground',
|
|
80
|
+
done: 'text-tool-green',
|
|
81
|
+
error: 'text-tool-red',
|
|
82
|
+
blocked: 'text-tool-amber',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* PaneGroup — an editor group: a TAB STRIP (numbered-status-badge tabs) over a
|
|
87
|
+
* single CONTENT area showing the active tab's pane body. The reusable "one column
|
|
88
|
+
* = a group of agents shown as tabs" primitive from the Multi-Agent Workspace,
|
|
89
|
+
* extracted from the hand-rolled group in the Split Workspace demo.
|
|
90
|
+
*
|
|
91
|
+
* Each tab leads with a small TONE-COLORED NUMBERED BADGE — the color encodes the
|
|
92
|
+
* agent's run status, the digit is its keyboard (⌥-jump) number, unifying status +
|
|
93
|
+
* hint into one element — then the name, then the status WORD (shown on the active
|
|
94
|
+
* tab, on hover, and always for a needs-attention / error tab), an optional "…"
|
|
95
|
+
* overflow, and a close "×". The active tab is highlighted; a needs-attention tab
|
|
96
|
+
* carries an amber ring even when inactive.
|
|
97
|
+
*
|
|
98
|
+
* Composition: the group owns the tab UX; the CONSUMER owns the pane content. It
|
|
99
|
+
* renders `children` as the active pane's body and swaps it in response to
|
|
100
|
+
* `onTabChange`. Selection-only — it never routes content itself.
|
|
101
|
+
*
|
|
102
|
+
* Accessibility: `role="tablist"` strip, `role="tab"` tabs with roving tabindex
|
|
103
|
+
* and Arrow/Home/End navigation, the body as `role="tabpanel"`. Colors are all
|
|
104
|
+
* token-backed (surface / border / ring / tool-*), so it reads in light and dark.
|
|
105
|
+
* The strip, each tab, and the body are exposed via `::part(tabs|tab|body)` for
|
|
106
|
+
* the `kai-pane-group` facade. Give the group a bounded height for the body scroll.
|
|
107
|
+
*/
|
|
108
|
+
export function PaneGroup(props: PaneGroupProps) {
|
|
109
|
+
const tabs = () => props.tabs ?? [];
|
|
110
|
+
const activeId = () => props.active ?? tabs()[0]?.id;
|
|
111
|
+
|
|
112
|
+
// Roving tabindex needs exactly one tab in the tab order: the active tab gets it,
|
|
113
|
+
// else the first, so the strip is always reachable by Tab.
|
|
114
|
+
const rovingId = () => {
|
|
115
|
+
const a = activeId();
|
|
116
|
+
if (a !== undefined && tabs().some((t) => t.id === a)) return a;
|
|
117
|
+
return tabs()[0]?.id;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const tabEls: Record<string, HTMLElement> = {};
|
|
121
|
+
const select = (id: string) => props.onTabChange?.(id);
|
|
122
|
+
|
|
123
|
+
// Arrow/Home/End move + select (activate on focus move); Enter/Space select.
|
|
124
|
+
// Only handled from the tab itself, never from its nested ×/… buttons.
|
|
125
|
+
const onKeyDown = (e: KeyboardEvent, tab: PaneTab) => {
|
|
126
|
+
if (e.currentTarget !== e.target) return;
|
|
127
|
+
const list = tabs();
|
|
128
|
+
if (list.length === 0) return;
|
|
129
|
+
const i = list.findIndex((t) => t.id === tab.id);
|
|
130
|
+
let next: PaneTab | undefined;
|
|
131
|
+
switch (e.key) {
|
|
132
|
+
case 'ArrowRight':
|
|
133
|
+
case 'ArrowDown':
|
|
134
|
+
next = list[(i + 1) % list.length];
|
|
135
|
+
break;
|
|
136
|
+
case 'ArrowLeft':
|
|
137
|
+
case 'ArrowUp':
|
|
138
|
+
next = list[(i - 1 + list.length) % list.length];
|
|
139
|
+
break;
|
|
140
|
+
case 'Home':
|
|
141
|
+
next = list[0];
|
|
142
|
+
break;
|
|
143
|
+
case 'End':
|
|
144
|
+
next = list[list.length - 1];
|
|
145
|
+
break;
|
|
146
|
+
case 'Enter':
|
|
147
|
+
case ' ':
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
select(tab.id);
|
|
150
|
+
return;
|
|
151
|
+
default:
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (next) {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
select(next.id);
|
|
157
|
+
tabEls[next.id]?.focus();
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const TabItem = (p: { tab: PaneTab; index: number }) => {
|
|
162
|
+
const tab = () => p.tab;
|
|
163
|
+
const tone = (): PaneStatusTone => tab().status?.tone ?? 'idle';
|
|
164
|
+
const isActive = () => tab().id === activeId();
|
|
165
|
+
const num = () => tab().number ?? p.index + 1;
|
|
166
|
+
// The status word shows on the active tab, on hover, and always when the tab
|
|
167
|
+
// needs attention or has errored.
|
|
168
|
+
const alwaysWord = () => isActive() || !!tab().needsAttention || tone() === 'error';
|
|
169
|
+
return (
|
|
170
|
+
<div
|
|
171
|
+
ref={(el) => { tabEls[tab().id] = el; }}
|
|
172
|
+
part="tab"
|
|
173
|
+
role="tab"
|
|
174
|
+
tabindex={tab().id === rovingId() ? 0 : -1}
|
|
175
|
+
aria-selected={isActive() ? 'true' : 'false'}
|
|
176
|
+
data-active={isActive() ? '' : undefined}
|
|
177
|
+
data-needs-attention={tab().needsAttention ? '' : undefined}
|
|
178
|
+
onClick={() => select(tab().id)}
|
|
179
|
+
onKeyDown={(e) => onKeyDown(e, tab())}
|
|
180
|
+
class={cn(
|
|
181
|
+
'group/tab relative flex shrink-0 cursor-pointer items-center gap-1.5 rounded-md py-1 pl-1.5 pr-1 text-xs',
|
|
182
|
+
'outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring',
|
|
183
|
+
isActive()
|
|
184
|
+
? 'bg-background text-foreground shadow-sm ring-1 ring-border'
|
|
185
|
+
: 'text-muted-foreground hover:bg-hover hover:text-foreground',
|
|
186
|
+
tab().needsAttention && !isActive() && 'ring-1 ring-tool-amber/50',
|
|
187
|
+
)}
|
|
188
|
+
>
|
|
189
|
+
{/* Numbered status badge: color = status, digit = the ⌥-jump number. */}
|
|
190
|
+
<span class="relative flex size-[18px] shrink-0" aria-hidden="true">
|
|
191
|
+
<Show when={tab().status?.pulse}>
|
|
192
|
+
<span class={cn('absolute inset-0 animate-ping rounded opacity-60 motion-reduce:hidden', TONE_BG[tone()])} />
|
|
193
|
+
</Show>
|
|
194
|
+
<span
|
|
195
|
+
class={cn(
|
|
196
|
+
'relative flex size-[18px] items-center justify-center rounded text-[11px] font-bold leading-none tabular-nums',
|
|
197
|
+
TONE_BG[tone()],
|
|
198
|
+
TONE_BADGE_FG[tone()],
|
|
199
|
+
)}
|
|
200
|
+
>
|
|
201
|
+
{num()}
|
|
202
|
+
</span>
|
|
203
|
+
</span>
|
|
204
|
+
|
|
205
|
+
<span class="max-w-[8rem] truncate font-medium">{tab().name}</span>
|
|
206
|
+
|
|
207
|
+
<Show when={tab().status?.label}>
|
|
208
|
+
<span
|
|
209
|
+
class={cn(
|
|
210
|
+
'truncate text-[10px] font-medium',
|
|
211
|
+
TONE_TEXT[tone()],
|
|
212
|
+
alwaysWord() ? 'inline' : 'hidden group-hover/tab:inline',
|
|
213
|
+
)}
|
|
214
|
+
>
|
|
215
|
+
{tab().status!.label}
|
|
216
|
+
</span>
|
|
217
|
+
</Show>
|
|
218
|
+
|
|
219
|
+
<span class="ml-0.5 flex shrink-0 items-center">
|
|
220
|
+
<Show when={props.onTabMenu}>
|
|
221
|
+
<button
|
|
222
|
+
type="button"
|
|
223
|
+
part="menu"
|
|
224
|
+
aria-label={`${tab().name} tab actions`}
|
|
225
|
+
aria-haspopup="menu"
|
|
226
|
+
onClick={(e) => { e.stopPropagation(); props.onTabMenu?.(tab().id); }}
|
|
227
|
+
class={cn(
|
|
228
|
+
'flex size-5 items-center justify-center rounded text-muted-foreground transition-colors',
|
|
229
|
+
'hover:bg-surface-sunken hover:text-foreground',
|
|
230
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring',
|
|
231
|
+
isActive() ? 'opacity-100' : 'opacity-0 group-hover/tab:opacity-100',
|
|
232
|
+
)}
|
|
233
|
+
>
|
|
234
|
+
<MoreHorizontal class="size-3.5" aria-hidden="true" />
|
|
235
|
+
</button>
|
|
236
|
+
</Show>
|
|
237
|
+
<Show when={props.onTabClose}>
|
|
238
|
+
<button
|
|
239
|
+
type="button"
|
|
240
|
+
part="close"
|
|
241
|
+
aria-label={`Close ${tab().name}`}
|
|
242
|
+
onClick={(e) => { e.stopPropagation(); props.onTabClose?.(tab().id); }}
|
|
243
|
+
class={cn(
|
|
244
|
+
'flex size-5 items-center justify-center rounded text-muted-foreground transition-colors',
|
|
245
|
+
'hover:bg-surface-sunken hover:text-foreground',
|
|
246
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring',
|
|
247
|
+
isActive() ? 'opacity-100' : 'opacity-0 group-hover/tab:opacity-100',
|
|
248
|
+
)}
|
|
249
|
+
>
|
|
250
|
+
<X class="size-3.5" aria-hidden="true" />
|
|
251
|
+
</button>
|
|
252
|
+
</Show>
|
|
253
|
+
</span>
|
|
254
|
+
</div>
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<div
|
|
260
|
+
data-pane-group
|
|
261
|
+
class={cn(
|
|
262
|
+
'flex h-full min-h-0 flex-col overflow-hidden rounded-xl border bg-surface',
|
|
263
|
+
props.focused ? 'border-ring ring-2 ring-inset ring-ring/35' : 'border-border',
|
|
264
|
+
props.class,
|
|
265
|
+
)}
|
|
266
|
+
>
|
|
267
|
+
<div
|
|
268
|
+
part="tabs"
|
|
269
|
+
role="tablist"
|
|
270
|
+
class="flex shrink-0 items-center gap-1 overflow-x-auto border-b border-border px-1.5 py-1"
|
|
271
|
+
>
|
|
272
|
+
<For each={tabs()}>{(tab, i) => <TabItem tab={tab} index={i()} />}</For>
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
<div part="body" role="tabpanel" class="min-h-0 flex-1 overflow-y-auto">
|
|
276
|
+
{props.children}
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
);
|
|
280
|
+
}
|