@kitn.ai/ui 0.17.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 +28 -5
- 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 +37 -12
- package/dist/components/choice-card.d.ts +26 -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/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 +12 -0
- 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.d.ts +14 -0
- package/dist/components/screen.d.ts +46 -0
- package/dist/components/tasks-card.d.ts +49 -1
- package/dist/components/toast.d.ts +12 -2
- package/dist/components/tool-types.d.ts +10 -0
- package/dist/components/tool.d.ts +8 -8
- 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 +8392 -1860
- package/dist/elements/agent-card.d.ts +1 -0
- package/dist/elements/agent-card.js +1 -0
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/attachments.js +1 -1
- package/dist/elements/autoloader.js +1 -1
- 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 -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-types.d.ts +47 -0
- package/dist/elements/chat-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/checkpoint.js +1 -1
- package/dist/elements/choice.js +1 -1
- 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/button-XDUM6lXs.js +1 -0
- package/dist/elements/chunks/card-CBlFZ-7I.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/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/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/hover-card-gE7iyXdW.js +1 -0
- package/dist/elements/chunks/icon-Vqz4ivrY.js +1 -0
- package/dist/elements/chunks/{index-CTBEJeo6.js → index-BCRhi84a.js} +1 -1
- package/dist/elements/chunks/info-B_toFS0l.js +1 -0
- package/dist/elements/chunks/input-gzbHYZvQ.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-CMTGx9r8.js → markdown-DBrcqq4S.js} +9 -9
- 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/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/use-card-resolution-VSVoxDeJ.js +1 -0
- package/dist/elements/chunks/video-DxTPZqT8.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 -1
- package/dist/elements/command.d.ts +1 -0
- package/dist/elements/command.js +1 -0
- package/dist/elements/compare.js +1 -1
- package/dist/elements/composer.d.ts +1 -0
- package/dist/elements/composer.js +1 -0
- package/dist/elements/confirm-card.js +1 -1
- package/dist/elements/context-meter.js +1 -1
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/css.d.ts +1 -0
- package/dist/elements/default-input.d.ts +51 -0
- package/dist/elements/define.d.ts +53 -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 -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.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 -1
- 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 -1
- package/dist/elements/loader.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/menu.d.ts +1 -0
- package/dist/elements/menu.js +1 -0
- 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.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 -1
- 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.js +1 -1
- package/dist/elements/prompt-suggestions.js +1 -1
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/register-impl.d.ts +0 -0
- package/dist/elements/register.d.ts +13 -0
- package/dist/elements/remote.d.ts +1 -0
- package/dist/elements/remote.js +1 -0
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +2 -2
- 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 -1
- 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.js +1 -1
- package/dist/elements/status.d.ts +1 -0
- package/dist/elements/status.js +1 -0
- package/dist/elements/switch.js +1 -1
- package/dist/elements/tabs.d.ts +1 -0
- package/dist/elements/tabs.js +1 -0
- 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/toast.js +1 -1
- package/dist/elements/tool.js +1 -1
- package/dist/elements/tooltip.d.ts +1 -0
- package/dist/elements/tooltip.js +1 -0
- package/dist/elements/voice-input.js +1 -1
- package/dist/elements/voice-output.d.ts +1 -0
- package/dist/elements/voice-output.js +1 -0
- package/dist/elements.d.ts +733 -58
- package/dist/engine-javascript-C1x7zo1_.js +141 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +8256 -5703
- package/dist/kai.es.js +1 -0
- package/dist/llms/llms-full.txt +1146 -64
- package/dist/llms/llms.txt +4 -4
- package/dist/mcp.es.js +62 -7
- 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/toast-store.d.ts +32 -2
- package/dist/primitives/use-speech-recognition.d.ts +26 -0
- package/dist/react/index.d.ts +1085 -97
- package/dist/react/runtime.d.ts +9 -2
- package/dist/react/use-kai-chat.d.ts +41 -0
- package/dist/react.js +572 -193
- package/dist/register-impl-CYWGkgbI.js +141 -0
- package/dist/schemas/tasks.schema.json +2 -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 +19 -1
- package/frameworks/react/index.tsx +1042 -157
- package/frameworks/react/runtime.tsx +30 -1
- package/frameworks/react/use-kai-chat.tsx +87 -0
- package/llms-full.txt +1146 -64
- package/llms.txt +4 -4
- package/package.json +23 -8
- package/src/agent-tooling/mcp/manifest.ts +14 -0
- package/src/agent-tooling/mcp/tools/debug.ts +10 -6
- package/src/agent-tooling/mcp/tools/reference.ts +32 -0
- package/src/agent-tooling/mcp/tools/scaffold.ts +30 -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 +225 -116
- package/src/components/choice-card.tsx +103 -11
- package/src/components/coachmark.tsx +245 -0
- package/src/components/component-meta.json +691 -102
- 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 +54 -1
- package/src/components/conversation-item.tsx +69 -7
- package/src/components/conversation-list.tsx +134 -37
- package/src/components/file-tree.tsx +197 -47
- package/src/components/form-widgets.tsx +9 -7
- package/src/components/form.tsx +140 -17
- 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 +23 -4
- 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.tsx +31 -2
- package/src/components/screen.tsx +176 -0
- package/src/components/tasks-card.tsx +342 -21
- package/src/components/toast.tsx +119 -31
- package/src/components/tool-types.ts +10 -0
- package/src/components/tool.tsx +22 -16
- 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/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 +2 -2
- package/src/elements/chat-workspace.tsx +153 -41
- package/src/elements/chat.tsx +45 -23
- 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 +24 -2
- 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 +129 -1
- package/src/elements/element-meta.json +5562 -1336
- package/src/elements/element-types.d.ts +732 -57
- 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 +58 -11
- 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 +38 -3
- package/src/elements/register.ts +11 -3
- 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/switch.tsx +89 -14
- package/src/elements/tabs.tsx +95 -0
- package/src/elements/tasks.tsx +70 -14
- package/src/elements/toast.tsx +17 -2
- 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 +5 -2
- package/src/primitives/card-schemas/tasks.schema.json +2 -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/toast-store.ts +43 -2
- 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 +52 -8
- package/theme.css +113 -0
- package/dist/components/slash-command.d.ts +0 -15
- package/dist/elements/chunks/Icon-D_Zmwmwh.js +0 -1
- package/dist/elements/chunks/action-icons-PVfIvcuG.js +0 -1
- package/dist/elements/chunks/attachments-Dp6vqtrc.js +0 -1
- package/dist/elements/chunks/button-CKyYD9G4.js +0 -1
- package/dist/elements/chunks/card-Cjho-PYk.js +0 -1
- package/dist/elements/chunks/chat-thread-RT808iPf.js +0 -1
- package/dist/elements/chunks/check-CDYaMYrM.js +0 -1
- package/dist/elements/chunks/chevron-down-3SBiq8HF.js +0 -1
- package/dist/elements/chunks/chevron-right-k2UFlIVK.js +0 -1
- package/dist/elements/chunks/cn-Dogu6PbV.js +0 -1
- package/dist/elements/chunks/code-block-BYUmfFSd.js +0 -1
- package/dist/elements/chunks/collapsible-BiNwdOn6.js +0 -1
- package/dist/elements/chunks/context-18g6oi4J.js +0 -1
- package/dist/elements/chunks/conversation-list-D9Y0NVdo.js +0 -1
- package/dist/elements/chunks/default-input-CSAoYYMd.js +0 -1
- package/dist/elements/chunks/download-D8K0Je8r.js +0 -1
- package/dist/elements/chunks/dropdown-bUs2iTia.js +0 -1
- package/dist/elements/chunks/external-link-6mA0wxab.js +0 -1
- package/dist/elements/chunks/file-text-DnaYk3Dm.js +0 -1
- package/dist/elements/chunks/file-tree-CgtRLlxK.js +0 -1
- package/dist/elements/chunks/hover-card-CIGw62gP.js +0 -1
- package/dist/elements/chunks/link-BlGSeoPy.js +0 -1
- package/dist/elements/chunks/loader-DvhR4qa0.js +0 -1
- package/dist/elements/chunks/message-CDZwXjhL.js +0 -1
- package/dist/elements/chunks/message-feedback-CYx81QiA.js +0 -1
- package/dist/elements/chunks/model-switcher-O_tUhoOT.js +0 -1
- package/dist/elements/chunks/overlay-DydXYMQW.js +0 -1
- package/dist/elements/chunks/prompt-suggestion-ldlWV5kd.js +0 -1
- package/dist/elements/chunks/reasoning-2PUnHlmr.js +0 -1
- package/dist/elements/chunks/resizable-B5WNbSeb.js +0 -1
- package/dist/elements/chunks/star-t9tI-P0q.js +0 -1
- package/dist/elements/chunks/store-C6rIooZz.js +0 -1
- package/dist/elements/chunks/text-shimmer-uh9V_KUh.js +0 -1
- package/dist/elements/chunks/textarea-3nm6Ia9U.js +0 -1
- package/dist/elements/chunks/thumbs-up-BBtguGld.js +0 -1
- package/dist/elements/chunks/toast-store-D8cL3fWl.js +0 -1
- package/dist/elements/chunks/tool-GJ3vwp1U.js +0 -1
- package/dist/elements/chunks/tooltip-DwKAz4XR.js +0 -1
- package/dist/elements/chunks/triangle-alert-Ct1zt2JL.js +0 -1
- package/dist/elements/chunks/use-card-resolution-D-_0Alzy.js +0 -1
- package/dist/elements/chunks/video-mVYiM99-.js +0 -1
- package/dist/elements/chunks/x-CzxL27Ch.js +0 -1
- package/dist/kitn-chat.es.js +0 -1
- package/dist/register-JyTglR6m.js +0 -1
- package/dist/register-impl-C6wlSsts.js +0 -77
- package/src/components/slash-command.tsx +0 -232
- package/src/elements/framework-usage.json +0 -588
- /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,42 @@
|
|
|
1
|
+
import { defineWebComponent } from './define';
|
|
2
|
+
import { Status, type StatusKind } from '../ui/status';
|
|
3
|
+
|
|
4
|
+
interface Props extends Record<string, unknown> {
|
|
5
|
+
/** Presence/notification state → color. `new` (default) maps to the blue hue. */
|
|
6
|
+
status?: StatusKind;
|
|
7
|
+
/** Animated ping ring (off by default; respects prefers-reduced-motion). */
|
|
8
|
+
pulse?: boolean;
|
|
9
|
+
/** Accessible name. Without it the dot is decorative. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** `sm` (default) or `md`. */
|
|
12
|
+
size?: 'sm' | 'md';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `<kai-status>` — a small presence / new dot.
|
|
17
|
+
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <kai-status status="online" label="Online"></kai-status>
|
|
20
|
+
* <kai-status status="new" pulse></kai-status>
|
|
21
|
+
* ```
|
|
22
|
+
* Recolor via `::part(dot)`.
|
|
23
|
+
*/
|
|
24
|
+
defineWebComponent<Props>('kai-status', {
|
|
25
|
+
status: 'new',
|
|
26
|
+
pulse: false,
|
|
27
|
+
label: undefined,
|
|
28
|
+
size: 'sm',
|
|
29
|
+
}, (props, { flag }) => (
|
|
30
|
+
<>
|
|
31
|
+
{/* Base sets `:host{display:block}`; a presence dot sits inline beside an
|
|
32
|
+
avatar/label, so inline-flex like kai-button. */}
|
|
33
|
+
<style>{':host{display:inline-flex}'}</style>
|
|
34
|
+
<Status
|
|
35
|
+
status={(props.status as StatusKind) ?? 'new'}
|
|
36
|
+
size={(props.size as 'sm' | 'md') ?? 'sm'}
|
|
37
|
+
pulse={flag('pulse')}
|
|
38
|
+
label={props.label as string | undefined}
|
|
39
|
+
part="dot"
|
|
40
|
+
/>
|
|
41
|
+
</>
|
|
42
|
+
));
|
package/src/elements/switch.tsx
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
+
import { createEffect, createSignal, untrack } from 'solid-js';
|
|
1
2
|
import { defineWebComponent } from './define';
|
|
2
3
|
import { Switch } from '../ui/switch';
|
|
3
4
|
|
|
4
5
|
interface Props extends Record<string, unknown> {
|
|
5
|
-
/**
|
|
6
|
+
/** Controlled checked state — settable and reflected to the `checked`
|
|
7
|
+
* attribute. `el.checked = true` (or `<kai-switch checked>`) drives it; the
|
|
8
|
+
* toggle UI updates it and fires `kai-change`. Read `el.checked` for live state. */
|
|
6
9
|
checked?: boolean;
|
|
10
|
+
/** Initial checked state on mount (uncontrolled seed). Bare attribute
|
|
11
|
+
* (`<kai-switch default-checked>`) turns it on. */
|
|
12
|
+
defaultChecked?: boolean;
|
|
7
13
|
/** Disable interaction. */
|
|
8
14
|
disabled?: boolean;
|
|
9
15
|
/** Accessible label. */
|
|
10
16
|
label?: string;
|
|
17
|
+
/** Form-control name (paired with `value`). */
|
|
18
|
+
name?: string;
|
|
19
|
+
/** Submitted value when checked (paired with `name`). Defaults to `'on'`. */
|
|
20
|
+
value?: string;
|
|
11
21
|
}
|
|
12
22
|
|
|
13
23
|
/** Events fired by `<kai-switch>`. */
|
|
@@ -17,27 +27,92 @@ interface Events {
|
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
/**
|
|
20
|
-
* `<kai-switch>` — a toggle switch.
|
|
21
|
-
*
|
|
30
|
+
* `<kai-switch>` — a toggle switch. Drive/read its state with the `checked`
|
|
31
|
+
* property (settable + reflected to the `checked` attribute, so `:host([checked])`
|
|
32
|
+
* and `el.checked` see live state); seed the initial state with `default-checked`
|
|
33
|
+
* and read changes from `kai-change`.
|
|
22
34
|
*
|
|
23
35
|
* ```html
|
|
24
|
-
* <kai-switch checked label="Temporary chat"></kai-switch>
|
|
36
|
+
* <kai-switch default-checked label="Temporary chat"></kai-switch>
|
|
25
37
|
* <script type="module">
|
|
26
38
|
* import '@kitn.ai/ui/elements';
|
|
27
|
-
* document.querySelector('kai-switch')
|
|
28
|
-
*
|
|
39
|
+
* const sw = document.querySelector('kai-switch');
|
|
40
|
+
* sw.addEventListener('kai-change', (e) => console.log(e.detail.checked));
|
|
41
|
+
* sw.checked = false; // drive it (no kai-change — the host already knows)
|
|
42
|
+
* sw.toggle(); // flip it (fires kai-change)
|
|
29
43
|
* </script>
|
|
30
44
|
* ```
|
|
31
45
|
*/
|
|
32
46
|
defineWebComponent<Props, Events>('kai-switch', {
|
|
33
47
|
checked: undefined,
|
|
48
|
+
defaultChecked: undefined,
|
|
34
49
|
disabled: undefined,
|
|
35
50
|
label: undefined,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
51
|
+
name: undefined,
|
|
52
|
+
value: undefined,
|
|
53
|
+
}, (props, ctx) => {
|
|
54
|
+
const { element, dispatch, flag, expose } = ctx;
|
|
55
|
+
|
|
56
|
+
// Lift the on/off state into the facade and drive the Switch CONTROLLED so the
|
|
57
|
+
// host can read it (`el.checked` / `:host([checked])`) and set it after mount.
|
|
58
|
+
// Seed from `defaultChecked` (or a bare `checked` attribute present on mount).
|
|
59
|
+
const [checked, setChecked] = createSignal(flag('defaultChecked') || flag('checked'));
|
|
60
|
+
|
|
61
|
+
// Coerce any value coming through the `checked` setter (a JS assignment, or the
|
|
62
|
+
// write-back from `attributeChangedCallback` when the attribute changes) to a
|
|
63
|
+
// boolean — falling back to attribute presence, matching `flag`'s semantics. An
|
|
64
|
+
// `undefined` write-back (which `toggleAttribute` triggers) thus resolves to the
|
|
65
|
+
// attribute we just wrote, so it equals the signal and the equality guard below
|
|
66
|
+
// absorbs it — no attr⇄prop feedback loop (the pattern hover-card uses for `open`).
|
|
67
|
+
const coerce = (v: unknown): boolean =>
|
|
68
|
+
v === true ? true
|
|
69
|
+
: v === false ? false
|
|
70
|
+
: element.hasAttribute('checked') && element.getAttribute('checked') !== 'false';
|
|
71
|
+
|
|
72
|
+
// Apply a new checked state and fire kai-change once (the toggle UI / `toggle()`
|
|
73
|
+
// path). No-op while disabled.
|
|
74
|
+
const apply = (next: boolean) => {
|
|
75
|
+
if (flag('disabled')) return;
|
|
76
|
+
if (untrack(checked) === next) return;
|
|
77
|
+
setChecked(next);
|
|
78
|
+
dispatch('kai-change', { checked: next });
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Override the `checked` property so reads return LIVE state (the signal) and
|
|
82
|
+
// host writes (`el.checked = …`) drive it WITHOUT firing kai-change — distinct
|
|
83
|
+
// from the user-toggle path. The equality guard kills the reflect write-back loop.
|
|
84
|
+
Object.defineProperty(element, 'checked', {
|
|
85
|
+
get: () => checked(),
|
|
86
|
+
set: (v: unknown) => { const next = coerce(v); if (untrack(checked) !== next) setChecked(next); },
|
|
87
|
+
configurable: true,
|
|
88
|
+
enumerable: true,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Reflect internal checked → the `[checked]` host attribute (for `:host([checked])`).
|
|
92
|
+
// The equality guard against the live attribute keeps the write-back the toggle
|
|
93
|
+
// triggers (attributeChangedCallback → setter) from looping (mirrors
|
|
94
|
+
// wireDisclosure's reflect structure).
|
|
95
|
+
createEffect(() => {
|
|
96
|
+
const c = checked();
|
|
97
|
+
if (c !== element.hasAttribute('checked')) element.toggleAttribute('checked', c);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
expose({
|
|
101
|
+
/** Flip the switch and fire `kai-change` (no-op while disabled). */
|
|
102
|
+
toggle: () => apply(!untrack(checked)),
|
|
103
|
+
/** Focus the inner `role="switch"` button (the host element can't reach it). */
|
|
104
|
+
focus: (options?: FocusOptions) =>
|
|
105
|
+
element.shadowRoot?.querySelector<HTMLButtonElement>('button[role="switch"]')?.focus(options),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Switch
|
|
110
|
+
checked={checked()}
|
|
111
|
+
disabled={flag('disabled')}
|
|
112
|
+
label={props.label as string | undefined}
|
|
113
|
+
name={props.name as string | undefined}
|
|
114
|
+
value={props.value as string | undefined}
|
|
115
|
+
onChange={(next) => apply(next)}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createSignal } from 'solid-js';
|
|
2
|
+
import { defineWebComponent } from './define';
|
|
3
|
+
import { Tabs, type KaiTabItem, type TabsVariant } from '../ui/tabs';
|
|
4
|
+
|
|
5
|
+
interface Props extends Record<string, unknown> {
|
|
6
|
+
/** Tabs to render. Set as a JS property, not an HTML attribute. */
|
|
7
|
+
items?: KaiTabItem[];
|
|
8
|
+
/** Controlled selected id. Set as a JS property (or the `value` attribute);
|
|
9
|
+
* drive it from your app in response to `kai-tab-change`. Omit for uncontrolled. */
|
|
10
|
+
value?: string;
|
|
11
|
+
/** Initial selected id when uncontrolled (use the `default-value` attribute in plain HTML). */
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
/** `segmented` (default, a pill group) or `underline` (an underlined row). */
|
|
14
|
+
variant?: TabsVariant;
|
|
15
|
+
/** Stretch the strip to full width, each tab sharing the space equally. */
|
|
16
|
+
block?: boolean;
|
|
17
|
+
/** Disable the whole strip. */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Events {
|
|
22
|
+
/** A tab was selected (click, Enter/Space, or arrow-key move). `value` is the item's id. */
|
|
23
|
+
'kai-tab-change': { value: string };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `<kai-tabs>`, an accessible tab strip. Selection only: it emits the chosen id;
|
|
28
|
+
* you render what each tab shows (this is not a content router).
|
|
29
|
+
*
|
|
30
|
+
* Set the `items` property in JavaScript (array, not attribute):
|
|
31
|
+
*
|
|
32
|
+
* ```html
|
|
33
|
+
* <kai-tabs default-value="chat"></kai-tabs>
|
|
34
|
+
* <script type="module">
|
|
35
|
+
* import '@kitn.ai/ui/elements';
|
|
36
|
+
* const tabs = document.querySelector('kai-tabs');
|
|
37
|
+
* tabs.items = [
|
|
38
|
+
* { id: 'chat', label: 'Chat', icon: 'message-circle' },
|
|
39
|
+
* { id: 'cowork', label: 'Cowork' },
|
|
40
|
+
* { id: 'code', label: 'Code', icon: 'code' },
|
|
41
|
+
* ];
|
|
42
|
+
* tabs.addEventListener('kai-tab-change', (e) => console.log(e.detail.value));
|
|
43
|
+
* </script>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Each tab carries a stable `id`, so you can wire `aria-controls` on the tab and
|
|
47
|
+
* `aria-labelledby` on your own panel. Style the active tab via `::part(tab)[data-active]`.
|
|
48
|
+
*/
|
|
49
|
+
defineWebComponent<Props, Events>('kai-tabs', {
|
|
50
|
+
items: undefined,
|
|
51
|
+
value: undefined,
|
|
52
|
+
defaultValue: undefined,
|
|
53
|
+
variant: 'segmented',
|
|
54
|
+
block: undefined,
|
|
55
|
+
disabled: undefined,
|
|
56
|
+
}, (props, { dispatch, flag, expose }) => {
|
|
57
|
+
// Controlled/uncontrolled selection: `value` (when set) wins; otherwise the
|
|
58
|
+
// element manages its own, seeded from `defaultValue`. `setValueTo` always
|
|
59
|
+
// writes the internal value (a no-op visually while controlled) and emits
|
|
60
|
+
// `kai-tab-change` so a controlling app can update its own state.
|
|
61
|
+
const [internal, setInternal] = createSignal(props.defaultValue as string | undefined);
|
|
62
|
+
const value = () => (props.value as string | undefined) ?? internal();
|
|
63
|
+
const setValueTo = (next: string) => {
|
|
64
|
+
setInternal(next);
|
|
65
|
+
dispatch('kai-tab-change', { value: next });
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
let listRef: HTMLDivElement | undefined;
|
|
69
|
+
expose({
|
|
70
|
+
/** Select a tab by id (fires `kai-tab-change`). Ignores unknown/disabled ids. */
|
|
71
|
+
select: (id: string) => {
|
|
72
|
+
const item = (props.items as KaiTabItem[] | undefined)?.find((it) => it.id === id);
|
|
73
|
+
if (!item || item.disabled || flag('disabled')) return;
|
|
74
|
+
setValueTo(id);
|
|
75
|
+
},
|
|
76
|
+
/** Focus the active tab (or the first focusable tab). */
|
|
77
|
+
focus: () => {
|
|
78
|
+
listRef
|
|
79
|
+
?.querySelector<HTMLButtonElement>('[role="tab"][tabindex="0"]:not([disabled])')
|
|
80
|
+
?.focus();
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Tabs
|
|
86
|
+
items={props.items as KaiTabItem[] | undefined}
|
|
87
|
+
value={value()}
|
|
88
|
+
variant={(props.variant as TabsVariant) ?? 'segmented'}
|
|
89
|
+
block={flag('block')}
|
|
90
|
+
disabled={flag('disabled')}
|
|
91
|
+
onChange={setValueTo}
|
|
92
|
+
ref={(el) => (listRef = el)}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
});
|
package/src/elements/tasks.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineWebComponent } from './define';
|
|
2
|
-
import { TasksCard, type TasksCardData } from '../components/tasks-card';
|
|
2
|
+
import { TasksCard, type TasksCardController, type TasksCardData } from '../components/tasks-card';
|
|
3
3
|
import type { CardResolution } from '../primitives/card-contract';
|
|
4
4
|
|
|
5
5
|
interface Props extends Record<string, unknown> {
|
|
@@ -14,6 +14,23 @@ interface Props extends Record<string, unknown> {
|
|
|
14
14
|
/** Set when the user resolved this card; renders the read-only view. Property:
|
|
15
15
|
* `el.resolution = { kind:'submit', data:{ selected:[…] } }`. */
|
|
16
16
|
resolution?: Record<string, unknown>;
|
|
17
|
+
/** Controlled selection (task ids; JS property). When set, it wins over local state. */
|
|
18
|
+
value?: string[];
|
|
19
|
+
/** Uncontrolled initial selection (task ids; JS property), overlaying per-task `checked`. */
|
|
20
|
+
defaultValue?: string[];
|
|
21
|
+
/** Freeze the whole list + Confirm. Attribute: `disabled`. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Display-only: rows can't be toggled and show the default cursor (no pointer,
|
|
24
|
+
* hover, or focus affordances). Keeps the look as-is. Attribute: `readonly`. */
|
|
25
|
+
readonly?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Events fired by `<kai-tasks>`. (Resolution still flows up the bubbling `kai-card`
|
|
29
|
+
* contract event — `kai-value-change` is the live selection signal, distinct from
|
|
30
|
+
* the terminal submit.) */
|
|
31
|
+
interface Events {
|
|
32
|
+
/** The selection changed on a toggle — the selected ids in input order. */
|
|
33
|
+
'kai-value-change': { value: string[] };
|
|
17
34
|
}
|
|
18
35
|
|
|
19
36
|
/**
|
|
@@ -22,25 +39,64 @@ interface Props extends Record<string, unknown> {
|
|
|
22
39
|
* UI state; only the final confirm emits the Card contract's **`submit`** verb
|
|
23
40
|
* up a bubbling **`kai-card`** CustomEvent (`{ kind:'submit', cardId,
|
|
24
41
|
* data:{ selected } }`) with the checked ids in input order. Also emits `ready` on
|
|
25
|
-
* mount and `error` for a malformed definition (inline error).
|
|
26
|
-
*
|
|
27
|
-
*
|
|
42
|
+
* mount and `error` for a malformed definition (inline error). Routes through a
|
|
43
|
+
* `CardProvider` when present, else the bubbling `kai-card` event. Isolated in
|
|
44
|
+
* Shadow DOM; theme-aware via the shared kit tokens.
|
|
45
|
+
*
|
|
46
|
+
* Two looks, one selection model. Default `mode:'select'` = the approval list above.
|
|
47
|
+
* `mode:'progress'` = the onboarding-checklist look (e.g. "Get started 0 / 2"): a
|
|
48
|
+
* header `done / total` count + circular indicators + per-item title/description,
|
|
49
|
+
* and NO confirm button (checking a row IS the action, so the live
|
|
50
|
+
* `kai-value-change` is the signal). The `max` gate, `toggle`/`select` methods, and
|
|
51
|
+
* events all still apply.
|
|
28
52
|
*/
|
|
29
|
-
defineWebComponent<Props>(
|
|
53
|
+
defineWebComponent<Props, Events>(
|
|
30
54
|
'kai-tasks',
|
|
31
55
|
{
|
|
32
56
|
data: undefined,
|
|
33
57
|
cardId: undefined,
|
|
34
58
|
heading: undefined,
|
|
35
59
|
resolution: undefined,
|
|
60
|
+
value: undefined,
|
|
61
|
+
defaultValue: undefined,
|
|
62
|
+
disabled: false,
|
|
63
|
+
readonly: false,
|
|
64
|
+
},
|
|
65
|
+
(props, { element, dispatch, flag, expose }) => {
|
|
66
|
+
// Pattern C: the TasksCard component owns the selection set + confirm gating and
|
|
67
|
+
// hands up a controller; the facade captures it and exposes delegating methods.
|
|
68
|
+
let controller: TasksCardController | undefined;
|
|
69
|
+
expose({
|
|
70
|
+
/** Set the checked task ids (local-only, no emit), respecting disabled/max.
|
|
71
|
+
* With no arg, select all toggleable rows. */
|
|
72
|
+
select: (taskIds?: string[]) => controller?.select(taskIds),
|
|
73
|
+
/** Toggle one task by id, honoring the max gate (no `checked` = flip). */
|
|
74
|
+
toggle: (taskId: string, checked?: boolean) => controller?.toggle(taskId, checked),
|
|
75
|
+
/** Confirm the current selection — emits the `submit` CardEvent + resolves
|
|
76
|
+
* (only when the min/max gate passes). Named `send`, not `submit`. */
|
|
77
|
+
send: () => controller?.send(),
|
|
78
|
+
/** Focus the task group (select-all checkbox if shown, else the first row). */
|
|
79
|
+
focus: (options?: FocusOptions) => controller?.focus(options),
|
|
80
|
+
/** Trigger the dismiss path (emit `dismiss` + collapse to the re-openable stub). */
|
|
81
|
+
dismiss: () => controller?.dismiss(),
|
|
82
|
+
/** Re-open a dismissed card from its stub (emit `reopen`). */
|
|
83
|
+
reopen: () => controller?.reopen(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<TasksCard
|
|
88
|
+
data={props.data as TasksCardData | undefined}
|
|
89
|
+
cardId={props.cardId ?? (element.id || 'kai-tasks')}
|
|
90
|
+
heading={props.heading}
|
|
91
|
+
resolution={props.resolution as CardResolution | undefined}
|
|
92
|
+
value={props.value as string[] | undefined}
|
|
93
|
+
defaultValue={props.defaultValue as string[] | undefined}
|
|
94
|
+
disabled={flag('disabled')}
|
|
95
|
+
readonly={flag('readonly')}
|
|
96
|
+
onValueChange={(payload) => dispatch('kai-value-change', payload)}
|
|
97
|
+
controllerRef={(c) => (controller = c)}
|
|
98
|
+
hostElement={element}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
36
101
|
},
|
|
37
|
-
(props, { element }) => (
|
|
38
|
-
<TasksCard
|
|
39
|
-
data={props.data as TasksCardData | undefined}
|
|
40
|
-
cardId={props.cardId ?? (element.id || 'kai-tasks')}
|
|
41
|
-
heading={props.heading}
|
|
42
|
-
resolution={props.resolution as CardResolution | undefined}
|
|
43
|
-
hostElement={element}
|
|
44
|
-
/>
|
|
45
|
-
),
|
|
46
102
|
);
|
package/src/elements/toast.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineWebComponent } from './define';
|
|
2
|
-
import { ToastRegion, type ToastDismissReason, type ToastPosition } from '../components/toast';
|
|
2
|
+
import { ToastRegion, type ToastDismissReason, type ToastPosition, type ToastAppearance } from '../components/toast';
|
|
3
3
|
import { toast as toastStore, type ToastItem } from '../primitives/toast-store';
|
|
4
4
|
|
|
5
5
|
interface Props extends Record<string, unknown> {
|
|
@@ -13,6 +13,13 @@ interface Props extends Record<string, unknown> {
|
|
|
13
13
|
/** Stacking: 'expanded' (default, full column) | 'collapsed' (Sonner-style
|
|
14
14
|
* pile that expands on hover/focus). Attribute: stack. */
|
|
15
15
|
stack?: 'expanded' | 'collapsed';
|
|
16
|
+
/** Default appearance for this region's toasts: `'pill'` (default, compact) |
|
|
17
|
+
* `'card'` (richer, with a description line). A per-toast `appearance` wins.
|
|
18
|
+
* Attribute: `appearance`. */
|
|
19
|
+
appearance?: ToastAppearance;
|
|
20
|
+
/** Default high-contrast inverse treatment for this region's toasts. A per-toast
|
|
21
|
+
* `inverse` wins. Off by default. Attribute: `inverse`. */
|
|
22
|
+
inverse?: boolean;
|
|
16
23
|
/** Container element to anchor this region to (JS property). Set by the store
|
|
17
24
|
* for a scoped region; unset = the global viewport region. */
|
|
18
25
|
target?: HTMLElement;
|
|
@@ -35,14 +42,20 @@ interface Events {
|
|
|
35
42
|
*
|
|
36
43
|
* Because it is a real `kai-*` element it carries its own shadow root + the
|
|
37
44
|
* shared kit stylesheet, so it is viewport-positioned AND kit-styled.
|
|
45
|
+
*
|
|
46
|
+
* Stack-level defaults are also declarative: `<kai-toast-region appearance="card"
|
|
47
|
+
* inverse>` makes every toast that doesn't set its own `appearance`/`inverse`
|
|
48
|
+
* render as an inverted card. A per-toast value always wins.
|
|
38
49
|
*/
|
|
39
50
|
defineWebComponent<Props, Events>('kai-toast-region', {
|
|
40
51
|
toasts: [],
|
|
41
52
|
position: 'top-center',
|
|
42
53
|
max: 3,
|
|
43
54
|
stack: 'expanded',
|
|
55
|
+
appearance: 'pill',
|
|
56
|
+
inverse: false,
|
|
44
57
|
target: undefined,
|
|
45
|
-
}, (props, { dispatch }) => {
|
|
58
|
+
}, (props, { dispatch, flag }) => {
|
|
46
59
|
// `max` may arrive as a string attribute (`<kai-toast-region max="2">`).
|
|
47
60
|
const max = () => {
|
|
48
61
|
const raw = props.max as unknown;
|
|
@@ -63,6 +76,8 @@ defineWebComponent<Props, Events>('kai-toast-region', {
|
|
|
63
76
|
position={props.position}
|
|
64
77
|
max={max()}
|
|
65
78
|
stack={props.stack as 'expanded' | 'collapsed' | undefined}
|
|
79
|
+
appearance={props.appearance as ToastAppearance | undefined}
|
|
80
|
+
inverse={flag('inverse')}
|
|
66
81
|
target={props.target as HTMLElement | undefined}
|
|
67
82
|
onDismiss={(id, reason) => {
|
|
68
83
|
remove(id);
|
package/src/elements/tool.tsx
CHANGED
|
@@ -1,23 +1,57 @@
|
|
|
1
1
|
import { Show } from 'solid-js';
|
|
2
2
|
import { defineWebComponent } from './define';
|
|
3
3
|
import { Tool, type ToolPart } from '../components/tool';
|
|
4
|
+
import { wireDisclosure } from './disclosure';
|
|
5
|
+
import type { CollapsibleController } from '../ui/collapsible';
|
|
4
6
|
|
|
5
7
|
interface Props extends Record<string, unknown> {
|
|
6
8
|
/** The tool-call to display. Set as a JS property. */
|
|
7
9
|
tool?: ToolPart;
|
|
8
|
-
/**
|
|
10
|
+
/** Drive/observe open state (Shoelace-style: settable + reflected to the `open`
|
|
11
|
+
* attribute; the element still self-manages on trigger click). Set
|
|
12
|
+
* `el.open = true`, or `<kai-tool open>`; listen for `kai-open-change`. */
|
|
9
13
|
open?: boolean;
|
|
14
|
+
/** Initial open state on mount (uncontrolled seed). */
|
|
15
|
+
defaultOpen?: boolean;
|
|
16
|
+
/** Gate the disclosure trigger — programmatic `show()/hide()/toggle()` still
|
|
17
|
+
* work, but the trigger click no longer toggles. */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Events fired by `<kai-tool>`. */
|
|
22
|
+
interface Events {
|
|
23
|
+
/** The panel expanded or collapsed (by trigger click or a method). */
|
|
24
|
+
'kai-open-change': { open: boolean };
|
|
10
25
|
}
|
|
11
26
|
|
|
12
27
|
/**
|
|
13
28
|
* `<kai-tool>` — a collapsible tool-call panel (input/output inspection with a
|
|
14
|
-
* state badge). Data via the `tool` property
|
|
29
|
+
* state badge). Data via the `tool` property. Open state is the standard overlay
|
|
30
|
+
* surface: settable+reflecting `open`, `kai-open-change`, and
|
|
31
|
+
* `show()`/`hide()`/`toggle()` (gated by `disabled`); seed with `defaultOpen`.
|
|
15
32
|
*/
|
|
16
|
-
defineWebComponent<Props>('kai-tool', {
|
|
33
|
+
defineWebComponent<Props, Events>('kai-tool', {
|
|
17
34
|
tool: undefined,
|
|
18
|
-
open:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
open: undefined,
|
|
36
|
+
defaultOpen: undefined,
|
|
37
|
+
disabled: undefined,
|
|
38
|
+
}, (props, ctx) => {
|
|
39
|
+
const { flag } = ctx;
|
|
40
|
+
let api: CollapsibleController | undefined;
|
|
41
|
+
|
|
42
|
+
// The standard disclosure surface: settable+reflecting `open`, kai-open-change,
|
|
43
|
+
// show/hide/toggle, disabled-gating. See ./disclosure. This is the SOLE emitter
|
|
44
|
+
// of kai-open-change — the Tool/Collapsible no longer wires its own.
|
|
45
|
+
wireDisclosure(ctx, () => api, () => props.open);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Show when={props.tool}>
|
|
49
|
+
<Tool
|
|
50
|
+
toolPart={props.tool!}
|
|
51
|
+
defaultOpen={flag('defaultOpen')}
|
|
52
|
+
disabled={flag('disabled')}
|
|
53
|
+
controllerRef={(a) => (api = a)}
|
|
54
|
+
/>
|
|
55
|
+
</Show>
|
|
56
|
+
);
|
|
57
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type Placement } from '@floating-ui/dom';
|
|
2
|
+
import { Tooltip, type TooltipController } from '../ui/tooltip';
|
|
3
|
+
import { defineWebComponent } from './define';
|
|
4
|
+
import { wireDisclosure } from './disclosure';
|
|
5
|
+
|
|
6
|
+
interface Props extends Record<string, unknown> {
|
|
7
|
+
/** The hint text shown on hover/focus of the slotted trigger. */
|
|
8
|
+
content?: string;
|
|
9
|
+
/** Delay (ms) before the tooltip appears on hover. Defaults to 600. Focus
|
|
10
|
+
* shows it immediately regardless. */
|
|
11
|
+
openDelay?: number;
|
|
12
|
+
/** Delay (ms) before it hides after the pointer leaves. Defaults to 0 (hides
|
|
13
|
+
* immediately). */
|
|
14
|
+
closeDelay?: number;
|
|
15
|
+
/** Preferred placement: `'top' | 'bottom' | 'left' | 'right'` (+ optional
|
|
16
|
+
* `-start`/`-end`). Defaults to `'top'`; flips to stay in view. */
|
|
17
|
+
placement?: string;
|
|
18
|
+
/** Drive/observe open state (Shoelace-style: settable + reflected to the `open`
|
|
19
|
+
* attribute, the element still self-manages on hover/focus). Set `el.open = true`,
|
|
20
|
+
* or `<kai-tooltip open>`; listen for `kai-open-change`. */
|
|
21
|
+
open?: boolean;
|
|
22
|
+
/** Initial open state on mount (uncontrolled seed). */
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
|
+
/** Turn the tooltip off while keeping the trigger mounted (hover/focus and
|
|
25
|
+
* `show()` no longer open it). */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Events fired by `<kai-tooltip>`. */
|
|
30
|
+
interface Events {
|
|
31
|
+
/** The tooltip opened or closed (by hover/focus, outside-click, or a method). */
|
|
32
|
+
'kai-open-change': { open: boolean };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* `<kai-tooltip>` — wraps a trigger and shows a hint on hover/focus. Put the
|
|
37
|
+
* trigger as light-DOM content; set the text via `content`. Positions itself and
|
|
38
|
+
* dismisses on Escape/outside-click; the content is portaled inside the shadow
|
|
39
|
+
* root so it isn't clipped.
|
|
40
|
+
*
|
|
41
|
+
* ```html
|
|
42
|
+
* <kai-tooltip content="Voice input">
|
|
43
|
+
* <kai-button variant="subtle" size="icon" icon="mic" label="Voice input"></kai-button>
|
|
44
|
+
* </kai-tooltip>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
defineWebComponent<Props, Events>('kai-tooltip', {
|
|
48
|
+
content: '',
|
|
49
|
+
openDelay: undefined,
|
|
50
|
+
closeDelay: undefined,
|
|
51
|
+
placement: undefined,
|
|
52
|
+
open: undefined,
|
|
53
|
+
defaultOpen: undefined,
|
|
54
|
+
disabled: undefined,
|
|
55
|
+
}, (props, ctx) => {
|
|
56
|
+
const { flag } = ctx;
|
|
57
|
+
let api: TooltipController | undefined;
|
|
58
|
+
|
|
59
|
+
// The standard overlay surface: settable+reflecting `open`, kai-open-change,
|
|
60
|
+
// show/hide/toggle, disabled-gating. See ./disclosure.
|
|
61
|
+
wireDisclosure(ctx, () => api, () => props.open);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
{/* The shared element base sets `:host{display:block}` (styles.css). A block
|
|
66
|
+
host wraps the inline-flex trigger in a line box, so the font-descender
|
|
67
|
+
strut makes the host taller than the control and pins the control to the
|
|
68
|
+
top, so it reads off-center beside non-tooltipped siblings in a
|
|
69
|
+
flex-items-center row. inline-flex (like kai-button) drops the line box so
|
|
70
|
+
the host hugs the trigger and their centers line up. */}
|
|
71
|
+
<style>{':host{display:inline-flex}'}</style>
|
|
72
|
+
<Tooltip
|
|
73
|
+
content={props.content ?? ''}
|
|
74
|
+
openDelay={props.openDelay != null ? Number(props.openDelay) : undefined}
|
|
75
|
+
closeDelay={props.closeDelay != null ? Number(props.closeDelay) : undefined}
|
|
76
|
+
placement={(props.placement as Placement | undefined) ?? undefined}
|
|
77
|
+
defaultOpen={flag('defaultOpen')}
|
|
78
|
+
disabled={flag('disabled')}
|
|
79
|
+
controllerRef={(a) => (api = a)}
|
|
80
|
+
>
|
|
81
|
+
<slot />
|
|
82
|
+
</Tooltip>
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
});
|
|
Binary file
|