@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,129 @@
|
|
|
1
|
+
import { createSignal, onCleanup, onMount } from 'solid-js';
|
|
2
|
+
import { defineWebComponent } from './define';
|
|
3
|
+
import { Pane, type PaneStatus } from '../ui/pane';
|
|
4
|
+
|
|
5
|
+
interface Props extends Record<string, unknown> {
|
|
6
|
+
/** The pane title (the agent / window name). Named `headline` because `title`
|
|
7
|
+
* collides with the global `HTMLElement.title` attribute (it throws at
|
|
8
|
+
* registration). Attribute: `headline`. */
|
|
9
|
+
headline?: string;
|
|
10
|
+
/** A role / label shown under the title (e.g. "Reviewer", "claude-sonnet").
|
|
11
|
+
* Attribute: `subtitle`. */
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
/** Show the restore glyph instead of maximize, and signal the maximized
|
|
14
|
+
* view-state. Drive it yourself in response to `kai-maximize`. Attribute:
|
|
15
|
+
* `maximized`. */
|
|
16
|
+
maximized?: boolean;
|
|
17
|
+
/** Highlight the frame with a ring/border to mark the ACTIVE pane. Attribute:
|
|
18
|
+
* `focused`. */
|
|
19
|
+
focused?: boolean;
|
|
20
|
+
/** Show a split-pane window control that fires `kai-split`. Off by default.
|
|
21
|
+
* Attribute: `show-split`. */
|
|
22
|
+
showSplit?: boolean;
|
|
23
|
+
/** Show a dock-to-side window control that fires `kai-dock`. Off by default.
|
|
24
|
+
* Attribute: `show-dock`. */
|
|
25
|
+
showDock?: boolean;
|
|
26
|
+
/** A tone-colored status dot (+ optional label) in the header. An object
|
|
27
|
+
* `{ tone, label?, pulse? }` set as a JS PROPERTY (not an attribute). */
|
|
28
|
+
status?: PaneStatus;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Events fired by `<kai-pane>`. All non-bubbling — listen on the element. */
|
|
32
|
+
interface Events {
|
|
33
|
+
/** The maximize/restore control was clicked. `detail.maximized` is the
|
|
34
|
+
* intended NEXT state — drive the `maximized` prop yourself from it. */
|
|
35
|
+
'kai-maximize': { maximized: boolean };
|
|
36
|
+
/** The close (×) control was clicked. */
|
|
37
|
+
'kai-close': void;
|
|
38
|
+
/** The split control was clicked (only present when `show-split`). */
|
|
39
|
+
'kai-split': void;
|
|
40
|
+
/** The dock control was clicked (only present when `show-dock`). */
|
|
41
|
+
'kai-dock': void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Named slots whose occupancy gates a header/footer region. An empty `<slot>`
|
|
45
|
+
* is always a truthy node, so the facade tracks which are actually filled and
|
|
46
|
+
* only passes those regions to the primitive (no stray glyph slot / footer
|
|
47
|
+
* divider when unfilled). */
|
|
48
|
+
const SLOT_NAMES = ['leading', 'actions', 'footer'] as const;
|
|
49
|
+
type SlotName = (typeof SLOT_NAMES)[number];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* `<kai-pane>` — a framed panel for a multi-agent workspace: a header (leading
|
|
53
|
+
* glyph + title/subtitle + status dot + extra actions + window controls), a
|
|
54
|
+
* scrolling body, and an optional pinned footer (e.g. a composer). Composable:
|
|
55
|
+
* slots + parts + events, not a config blob.
|
|
56
|
+
*
|
|
57
|
+
* Slots: `leading` (header glyph/avatar), `actions` (extra header controls,
|
|
58
|
+
* placed before the window controls), the DEFAULT slot (body), `footer`.
|
|
59
|
+
*
|
|
60
|
+
* Window controls (right of the header): maximize/restore and close are always
|
|
61
|
+
* present; split and dock appear only with `show-split` / `show-dock`. Each
|
|
62
|
+
* fires a `kai-*` event so the consumer drives state itself (uncontrolled-
|
|
63
|
+
* friendly): listen for `kai-maximize` and set `maximized` from
|
|
64
|
+
* `event.detail.maximized`.
|
|
65
|
+
*
|
|
66
|
+
* Parts: `::part(header|body|footer|controls)`.
|
|
67
|
+
*
|
|
68
|
+
* ```html
|
|
69
|
+
* <kai-pane headline="Reviewer" subtitle="claude-sonnet" focused show-split
|
|
70
|
+
* onkai-maximize="this.maximized = event.detail.maximized">
|
|
71
|
+
* <img slot="leading" src="…" alt="" />
|
|
72
|
+
* <kai-button slot="actions" variant="ghost">Retry</kai-button>
|
|
73
|
+
* <kai-message-thread>…</kai-message-thread>
|
|
74
|
+
* <kai-prompt-input slot="footer"></kai-prompt-input>
|
|
75
|
+
* </kai-pane>
|
|
76
|
+
* <script>
|
|
77
|
+
* const pane = document.querySelector('kai-pane');
|
|
78
|
+
* pane.status = { tone: 'working', label: 'Running tests…', pulse: true };
|
|
79
|
+
* </script>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
defineWebComponent<Props, Events>('kai-pane', {
|
|
83
|
+
headline: '',
|
|
84
|
+
subtitle: undefined,
|
|
85
|
+
maximized: false,
|
|
86
|
+
focused: false,
|
|
87
|
+
showSplit: false,
|
|
88
|
+
showDock: false,
|
|
89
|
+
status: undefined,
|
|
90
|
+
}, (props, { element, dispatch, flag }) => {
|
|
91
|
+
// Track which named slots are filled. Re-read on child mutations so streamed/
|
|
92
|
+
// late content lights up its region. An unfilled region is never rendered.
|
|
93
|
+
const [filled, setFilled] = createSignal<Record<SlotName, boolean>>({
|
|
94
|
+
leading: false, actions: false, footer: false,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
onMount(() => {
|
|
98
|
+
const read = () => {
|
|
99
|
+
const next = {} as Record<SlotName, boolean>;
|
|
100
|
+
for (const name of SLOT_NAMES) next[name] = !!element.querySelector(`:scope > [slot="${name}"]`);
|
|
101
|
+
setFilled(next);
|
|
102
|
+
};
|
|
103
|
+
read();
|
|
104
|
+
const observer = new MutationObserver(read);
|
|
105
|
+
observer.observe(element, { childList: true, subtree: true, attributes: true, attributeFilter: ['slot'] });
|
|
106
|
+
onCleanup(() => observer.disconnect());
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const region = (name: SlotName) => (filled()[name] ? <slot name={name} /> : undefined);
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<Pane
|
|
113
|
+
title={props.headline as string}
|
|
114
|
+
subtitle={props.subtitle as string | undefined}
|
|
115
|
+
status={props.status as PaneStatus | undefined}
|
|
116
|
+
focused={flag('focused')}
|
|
117
|
+
maximized={flag('maximized')}
|
|
118
|
+
leading={region('leading')}
|
|
119
|
+
actions={region('actions')}
|
|
120
|
+
footer={region('footer')}
|
|
121
|
+
onMaximize={() => dispatch('kai-maximize', { maximized: !flag('maximized') })}
|
|
122
|
+
onClose={() => dispatch('kai-close')}
|
|
123
|
+
onSplit={flag('showSplit') ? () => dispatch('kai-split') : undefined}
|
|
124
|
+
onDock={flag('showDock') ? () => dispatch('kai-dock') : undefined}
|
|
125
|
+
>
|
|
126
|
+
<slot />
|
|
127
|
+
</Pane>
|
|
128
|
+
);
|
|
129
|
+
});
|
package/src/elements/popover.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineWebComponent } from './define';
|
|
2
|
-
import { Popover } from '../ui/popover';
|
|
2
|
+
import { Popover, type PopoverController } from '../ui/popover';
|
|
3
|
+
import { wireDisclosure } from './disclosure';
|
|
3
4
|
import type { Placement } from '@floating-ui/dom';
|
|
4
5
|
|
|
5
6
|
interface Props extends Record<string, unknown> {
|
|
@@ -7,14 +8,20 @@ interface Props extends Record<string, unknown> {
|
|
|
7
8
|
placement?: Placement;
|
|
8
9
|
/** Gap in px between the trigger and the panel. */
|
|
9
10
|
gutter?: number;
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
11
|
+
/** Drive/observe open state (Shoelace-style: settable + reflected to the `open`
|
|
12
|
+
* attribute, the element still self-manages on click). Set `el.open = true`,
|
|
13
|
+
* or `<kai-popover open>`; listen for `kai-open-change`. */
|
|
12
14
|
open?: boolean;
|
|
15
|
+
/** Initial open state on mount (uncontrolled seed). */
|
|
16
|
+
defaultOpen?: boolean;
|
|
17
|
+
/** Turn the popover off while keeping the trigger mounted (clicks and `show()`
|
|
18
|
+
* no longer open it). */
|
|
19
|
+
disabled?: boolean;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
/** Events fired by `<kai-popover>`. */
|
|
16
23
|
interface Events {
|
|
17
|
-
/** The popover
|
|
24
|
+
/** The popover opened or closed (click, Escape, outside-click, or a method). */
|
|
18
25
|
'kai-open-change': { open: boolean };
|
|
19
26
|
}
|
|
20
27
|
|
|
@@ -39,21 +46,36 @@ interface Events {
|
|
|
39
46
|
* The default slot is the panel; the `trigger` slot is the control. Clicking the
|
|
40
47
|
* trigger toggles the panel; Escape or an outside click closes it (clicks inside
|
|
41
48
|
* the panel do not). It fires `kai-open-change` with `{ open }` on every change,
|
|
42
|
-
*
|
|
49
|
+
* accepts an `open`/`defaultOpen` JS property, can be `disabled`, and exposes
|
|
50
|
+
* `show()`/`hide()`/`toggle()` instance methods.
|
|
43
51
|
*/
|
|
44
52
|
defineWebComponent<Props, Events>('kai-popover', {
|
|
45
53
|
placement: 'bottom-start',
|
|
46
54
|
gutter: 6,
|
|
47
55
|
open: undefined,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
defaultOpen: undefined,
|
|
57
|
+
disabled: undefined,
|
|
58
|
+
}, (props, ctx) => {
|
|
59
|
+
const { flag, element } = ctx;
|
|
60
|
+
let api: PopoverController | undefined;
|
|
61
|
+
|
|
62
|
+
// The standard overlay surface: settable+reflecting `open`, kai-open-change,
|
|
63
|
+
// show/hide/toggle, disabled-gating. The sole source of kai-open-change — the
|
|
64
|
+
// primitive's onOpenChange is intentionally NOT wired here to avoid a double
|
|
65
|
+
// dispatch. See ./disclosure.
|
|
66
|
+
wireDisclosure(ctx, () => api, () => props.open);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<Popover
|
|
70
|
+
trigger={<slot name="trigger" />}
|
|
71
|
+
placement={props.placement as Placement}
|
|
72
|
+
gutter={props.gutter}
|
|
73
|
+
defaultOpen={flag('defaultOpen')}
|
|
74
|
+
disabled={flag('disabled')}
|
|
75
|
+
controllerRef={(a) => (api = a)}
|
|
76
|
+
boundary={() => element}
|
|
77
|
+
>
|
|
78
|
+
<slot />
|
|
79
|
+
</Popover>
|
|
80
|
+
);
|
|
81
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ProgressBar, type ProgressTone } from '../ui/progress-bar';
|
|
2
|
+
import { defineWebComponent } from './define';
|
|
3
|
+
|
|
4
|
+
interface Props extends Record<string, unknown> {
|
|
5
|
+
/** Current progress value (0..max). Attribute: `value`. */
|
|
6
|
+
value?: number;
|
|
7
|
+
/** The value `value` runs to (default 100). Attribute: `max`. */
|
|
8
|
+
max?: number;
|
|
9
|
+
/** Optional caption above the track. Attribute: `label`. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Fill color: `primary` (default), `success`, `warning`, `error`, `info`. Attribute: `tone`. */
|
|
12
|
+
tone?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `<kai-progress-bar>` — a thin determinate progress bar: a rounded track with a
|
|
17
|
+
* `bg-primary` fill whose width is `value / max` (clamped to 0..100%). Set `tone`
|
|
18
|
+
* for a semantic fill hue. Scalar attributes only.
|
|
19
|
+
*
|
|
20
|
+
* ```html
|
|
21
|
+
* <kai-progress-bar value="66"></kai-progress-bar>
|
|
22
|
+
* <kai-progress-bar value="3" max="5" label="Setup"></kai-progress-bar>
|
|
23
|
+
* <kai-progress-bar value="60" tone="success"></kai-progress-bar>
|
|
24
|
+
* ```
|
|
25
|
+
* Restyle via `::part(track)` / `::part(fill)`.
|
|
26
|
+
*/
|
|
27
|
+
defineWebComponent<Props>('kai-progress-bar', {
|
|
28
|
+
value: undefined,
|
|
29
|
+
max: undefined,
|
|
30
|
+
label: undefined,
|
|
31
|
+
tone: 'primary',
|
|
32
|
+
}, (props) => (
|
|
33
|
+
<ProgressBar
|
|
34
|
+
value={props.value != null ? Number(props.value) : 0}
|
|
35
|
+
max={props.max != null ? Number(props.max) : undefined}
|
|
36
|
+
label={props.label as string | undefined}
|
|
37
|
+
tone={props.tone as ProgressTone | undefined}
|
|
38
|
+
/>
|
|
39
|
+
));
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createSignal, onCleanup, onMount } from 'solid-js';
|
|
2
|
+
import { defineWebComponent } from './define';
|
|
3
|
+
import { PromptDock, type PromptDockAppearance, type PromptDockFrame } from '../ui/prompt-dock';
|
|
4
|
+
|
|
5
|
+
interface Props extends Record<string, unknown> {
|
|
6
|
+
/** How the tray frames the input — the SPATIAL inset axis: `inset` (default,
|
|
7
|
+
* the classic recessed frame on every side) | `edge` (top/bottom inset only;
|
|
8
|
+
* the input sits flush left/right so the lips span the full width) | `none`
|
|
9
|
+
* (no inset; the lips attach directly as a plain stack). Attribute: `frame`. */
|
|
10
|
+
frame?: PromptDockFrame;
|
|
11
|
+
/** How the tray surface looks — the VISUAL axis, orthogonal to `frame`:
|
|
12
|
+
* `soft` (default, sunken surface + border + radius) | `outlined`
|
|
13
|
+
* (transparent + border + radius) | `filled` (sunken, no border, + radius) |
|
|
14
|
+
* `plain` (bare). Attribute: `appearance`. */
|
|
15
|
+
appearance?: PromptDockAppearance;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The named slots whose occupancy gates a dock lip. An empty `<slot>` is always
|
|
19
|
+
* a truthy node, so the facade tracks which are actually filled and only passes
|
|
20
|
+
* those regions to the primitive (which renders top/bottom only when truthy). */
|
|
21
|
+
const SLOT_NAMES = ['top', 'bottom'] as const;
|
|
22
|
+
type SlotName = (typeof SLOT_NAMES)[number];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `<kai-prompt-dock>` — a recessed tray that frames a prompt input and can extend
|
|
26
|
+
* with optional "lip" regions above and/or below it. The input is the raised card
|
|
27
|
+
* that floats on the tray; the lips sit in a slightly darker recessed band sharing
|
|
28
|
+
* the tray's rounding, so the whole thing reads as one cohesive control.
|
|
29
|
+
*
|
|
30
|
+
* Slots: the DEFAULT slot is the prompt input (the raised card). `slot="top"` is a
|
|
31
|
+
* recessed band ABOVE the input (a notice, a hint); `slot="bottom"` is a band BELOW
|
|
32
|
+
* it (a mode / control row). A lip renders only when its slot is filled — an empty
|
|
33
|
+
* dock shows just the input, no stray band.
|
|
34
|
+
*
|
|
35
|
+
* Styling splits into two orthogonal variant attributes: `frame` (the spatial inset)
|
|
36
|
+
* and `appearance` (the surface). `::part(tray)` / `::part(top)` / `::part(bottom)`
|
|
37
|
+
* expose the three regions for outside styling; four `--kai-prompt-dock-*` tokens
|
|
38
|
+
* tune the chrome (surface / border / radius / inset).
|
|
39
|
+
*
|
|
40
|
+
* ```html
|
|
41
|
+
* <kai-prompt-dock frame="edge" appearance="soft">
|
|
42
|
+
* <div slot="top">Working in the docs branch</div>
|
|
43
|
+
* <kai-prompt-input></kai-prompt-input>
|
|
44
|
+
* <div slot="bottom">Claude Opus 4.8 · 200k context</div>
|
|
45
|
+
* </kai-prompt-dock>
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
defineWebComponent<Props>('kai-prompt-dock', {
|
|
49
|
+
frame: 'inset',
|
|
50
|
+
appearance: 'soft',
|
|
51
|
+
}, (props, { element }) => {
|
|
52
|
+
// Track which named lip slots are filled. Re-read on child mutations so streamed
|
|
53
|
+
// / late content lights up its band. An unfilled lip is never rendered (the
|
|
54
|
+
// primitive gates on a truthy top/bottom, and a bare <slot> is always truthy).
|
|
55
|
+
const [filled, setFilled] = createSignal<Record<SlotName, boolean>>({ top: false, bottom: false });
|
|
56
|
+
|
|
57
|
+
onMount(() => {
|
|
58
|
+
const read = () => {
|
|
59
|
+
const next = {} as Record<SlotName, boolean>;
|
|
60
|
+
for (const name of SLOT_NAMES) next[name] = !!element.querySelector(`:scope > [slot="${name}"]`);
|
|
61
|
+
setFilled(next);
|
|
62
|
+
};
|
|
63
|
+
read();
|
|
64
|
+
const observer = new MutationObserver(read);
|
|
65
|
+
observer.observe(element, { childList: true });
|
|
66
|
+
onCleanup(() => observer.disconnect());
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const lip = (name: SlotName) => (filled()[name] ? <slot name={name} /> : undefined);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<PromptDock
|
|
73
|
+
frame={props.frame as PromptDockFrame}
|
|
74
|
+
appearance={props.appearance as PromptDockAppearance}
|
|
75
|
+
top={lip('top')}
|
|
76
|
+
bottom={lip('bottom')}
|
|
77
|
+
>
|
|
78
|
+
<slot />
|
|
79
|
+
</PromptDock>
|
|
80
|
+
);
|
|
81
|
+
});
|
|
@@ -2,29 +2,18 @@ import { createEffect, createSignal, onMount, onCleanup } from 'solid-js';
|
|
|
2
2
|
import { defineWebComponent } from './define';
|
|
3
3
|
import { DefaultPromptInput } from './default-input';
|
|
4
4
|
import type { AttachmentData } from '../components/attachments';
|
|
5
|
-
import type { SlashCommandItem } from '../components/slash-command';
|
|
6
5
|
import type { CustomAction } from './chat-types';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Attribute mapping:
|
|
10
|
-
* - `command` → SlashCommandItem.id (required; empty string fallback)
|
|
11
|
-
* - textContent → SlashCommandItem.label (primary); `label` attr as fallback
|
|
12
|
-
* - `description` → SlashCommandItem.description
|
|
13
|
-
* - `category` → SlashCommandItem.category
|
|
14
|
-
*/
|
|
15
|
-
export function parseKaiSlashCommandElement(n: Element): SlashCommandItem {
|
|
16
|
-
return {
|
|
17
|
-
id: n.getAttribute('command') ?? '',
|
|
18
|
-
label: n.textContent?.trim() || n.getAttribute('label') || n.getAttribute('command') || '',
|
|
19
|
-
description: n.getAttribute('description') ?? undefined,
|
|
20
|
-
category: n.getAttribute('category') ?? undefined,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
6
|
+
import type { TriggerDef, ComposerChange } from '../components/composer';
|
|
7
|
+
import { type ComposerDoc, type EntityRef, normalizeValue, serializeToText, entitiesOf } from '../primitives/composer-model';
|
|
23
8
|
|
|
24
9
|
interface Props extends Record<string, unknown> {
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
|
|
10
|
+
/** Value of the input, as a JS property. A **string** is the controlled text
|
|
11
|
+
* mirror (the host owns it and updates on `kai-value-change`). A **ComposerDoc**
|
|
12
|
+
* (array of text/entity segments) is a one-time **seed** that pre-populates
|
|
13
|
+
* pills (skills/agents/plugins); the user then edits freely. Leave unset for
|
|
14
|
+
* uncontrolled behavior. `kai-submit`/`kai-value-change` always emit `value`
|
|
15
|
+
* as the flattened string (back-compat) plus the structured `doc` + `entities`. */
|
|
16
|
+
value?: string | ComposerDoc;
|
|
28
17
|
/** Placeholder text shown in the empty input. */
|
|
29
18
|
placeholder?: string;
|
|
30
19
|
/** Disable the input and submit button entirely (non-interactive). */
|
|
@@ -38,13 +27,6 @@ interface Props extends Record<string, unknown> {
|
|
|
38
27
|
/** What clicking a suggestion does: `'submit'` (default) sends it immediately
|
|
39
28
|
* as if typed and submitted; `'fill'` just places it in the input. */
|
|
40
29
|
suggestionMode?: 'submit' | 'fill';
|
|
41
|
-
/** Slash commands — when set, typing `/` opens the command palette. Set as a
|
|
42
|
-
* JS property. */
|
|
43
|
-
slashCommands?: SlashCommandItem[];
|
|
44
|
-
/** Command ids to highlight as active. */
|
|
45
|
-
slashActiveIds?: string[];
|
|
46
|
-
/** Single-line palette rows. */
|
|
47
|
-
slashCompact?: boolean;
|
|
48
30
|
/** Show a Search (Globe) button in the left toolbar; clicking it fires a
|
|
49
31
|
* `search` event. */
|
|
50
32
|
search?: boolean;
|
|
@@ -54,22 +36,45 @@ interface Props extends Record<string, unknown> {
|
|
|
54
36
|
/** When set and `loading` is true, the send button is replaced by a Stop
|
|
55
37
|
* button (square icon, "Stop" aria-label). Clicking it fires `kai-stop`. */
|
|
56
38
|
stoppable?: boolean;
|
|
39
|
+
/** Send-button visibility. `'always'` (default) always shows it; `'auto'` shows
|
|
40
|
+
* it only when there's text/attachments (an empty composer hides it — Enter
|
|
41
|
+
* still submits). To hide it entirely (Enter-only), it's pure CSS:
|
|
42
|
+
* `::part(send){display:none}` — no prop needed. Restyle via `::part(send)`.
|
|
43
|
+
* The Stop button (`stoppable` + `loading`) is unaffected. */
|
|
44
|
+
submit?: 'always' | 'auto';
|
|
45
|
+
/** When `false`, hides the built-in paperclip attach button even though the
|
|
46
|
+
* element otherwise supports attachments. Use this when a `+` menu in
|
|
47
|
+
* `toolbar-start` already exposes "Add files", to avoid a duplicate control.
|
|
48
|
+
* Defaults to `true`. */
|
|
49
|
+
attach?: boolean;
|
|
57
50
|
/** Attachments to seed the input with (so a consumer can pre-populate staged
|
|
58
51
|
* files without an upload). Set as a JS property; the element then manages its
|
|
59
52
|
* own attachment state from there (add via the paperclip, remove per chip). */
|
|
60
53
|
attachments?: AttachmentData[];
|
|
54
|
+
/** Rich entity triggers — each `{ char, kind, items }` opens a caret-anchored
|
|
55
|
+
* menu that inserts an atomic pill. Convention: `/` → skills, `@` → agents
|
|
56
|
+
* (plugins are the grouping/provenance of those items). Set as a JS property. */
|
|
57
|
+
triggers?: TriggerDef[];
|
|
58
|
+
/** Default icon per entity kind (kind → image URL/data-URI) for pills/menu items
|
|
59
|
+
* without their own `icon`. Overrides the built-in agent/plugin glyphs. JS property. */
|
|
60
|
+
kindIcons?: Record<string, string>;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/** Events fired by `<kai-prompt-input>`. */
|
|
64
64
|
interface Events {
|
|
65
|
-
/** The user submitted the prompt (Enter or send button)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
'kai-
|
|
65
|
+
/** The user submitted the prompt (Enter or send button). `value` is the
|
|
66
|
+
* flattened text (back-compat); `doc` is the structured document and
|
|
67
|
+
* `entities` the inserted pills (skills/agents) for downstream expansion. */
|
|
68
|
+
'kai-submit': { value: string; doc: ComposerDoc; entities: EntityRef[]; attachments: AttachmentData[] };
|
|
69
|
+
/** The input changed (fires on every edit). Carries the flattened `value`
|
|
70
|
+
* plus the structured `doc` + `entities`. */
|
|
71
|
+
'kai-value-change': { value: string; doc: ComposerDoc; entities: EntityRef[] };
|
|
72
|
+
/** The staged attachments changed — a file was added (via the paperclip) or
|
|
73
|
+
* removed (per-chip ×). Carries the full current list so a consumer can react
|
|
74
|
+
* in real time (validate, show upload progress, toggle the send button). */
|
|
75
|
+
'kai-attachments-change': { attachments: AttachmentData[] };
|
|
69
76
|
/** A suggestion was clicked while `suggestion-mode="fill"`. */
|
|
70
77
|
'kai-suggestion-click': { value: string };
|
|
71
|
-
/** A slash command was chosen from the palette. */
|
|
72
|
-
'kai-slash-select': { command: SlashCommandItem };
|
|
73
78
|
/** The Search (Globe) toolbar button was clicked. */
|
|
74
79
|
'kai-search': Record<string, never>;
|
|
75
80
|
/** The Voice (Mic) toolbar button was clicked. */
|
|
@@ -88,15 +93,16 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
|
|
|
88
93
|
loading: false,
|
|
89
94
|
suggestions: undefined,
|
|
90
95
|
suggestionMode: 'submit',
|
|
91
|
-
slashCommands: undefined,
|
|
92
|
-
slashActiveIds: undefined,
|
|
93
|
-
slashCompact: false,
|
|
94
96
|
search: false,
|
|
95
97
|
voice: false,
|
|
96
98
|
stoppable: false,
|
|
99
|
+
submit: 'always',
|
|
100
|
+
attach: true,
|
|
97
101
|
attachments: undefined,
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
triggers: undefined,
|
|
103
|
+
kindIcons: undefined,
|
|
104
|
+
}, (props, { dispatch, flag, element, expose }) => {
|
|
105
|
+
const [internal, setInternal] = createSignal<string | ComposerDoc>(props.value ?? '');
|
|
100
106
|
// Seed staged attachments from the `attachments` property; the element manages
|
|
101
107
|
// its own state from there (paperclip adds, per-chip remove deletes).
|
|
102
108
|
const [attachments, setAttachments] = createSignal<AttachmentData[]>(props.attachments ?? []);
|
|
@@ -106,11 +112,10 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
|
|
|
106
112
|
if (props.attachments) setAttachments(props.attachments);
|
|
107
113
|
});
|
|
108
114
|
|
|
109
|
-
// Read declarative <kai-action>
|
|
110
|
-
//
|
|
111
|
-
//
|
|
115
|
+
// Read declarative <kai-action> children from light DOM — same pattern as
|
|
116
|
+
// kai-message. Shadow DOM with no <slot> suppresses them visually; they are
|
|
117
|
+
// invisible data carriers.
|
|
112
118
|
const [toolbarActions, setToolbarActions] = createSignal<CustomAction[]>([]);
|
|
113
|
-
const [slottedSlashCommands, setSlottedSlashCommands] = createSignal<SlashCommandItem[]>([]);
|
|
114
119
|
onMount(() => {
|
|
115
120
|
const readActions = () => {
|
|
116
121
|
const nodes = [...element.querySelectorAll('kai-action')];
|
|
@@ -121,22 +126,45 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
|
|
|
121
126
|
tooltip: n.getAttribute('tooltip') ?? undefined,
|
|
122
127
|
})));
|
|
123
128
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
setSlottedSlashCommands(nodes.map(parseKaiSlashCommandElement));
|
|
127
|
-
};
|
|
128
|
-
const readAll = () => { readActions(); readSlashCommands(); };
|
|
129
|
-
readAll();
|
|
130
|
-
const observer = new MutationObserver(readAll);
|
|
129
|
+
readActions();
|
|
130
|
+
const observer = new MutationObserver(readActions);
|
|
131
131
|
observer.observe(element, { childList: true, attributes: true, subtree: true });
|
|
132
132
|
onCleanup(() => observer.disconnect());
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
// A string `value` is controlled (the host owns it). A ComposerDoc `value` is a
|
|
136
|
+
// one-time seed: it lives in `internal` and the user's edits (which arrive as
|
|
137
|
+
// strings) replace it there, so the seed never fights the edits.
|
|
138
|
+
const current = (): string | ComposerDoc =>
|
|
139
|
+
typeof props.value === 'string' ? props.value : internal();
|
|
140
|
+
|
|
141
|
+
// Latest structured change from the composer (doc + entities). Captured before
|
|
142
|
+
// the string value-change fires (the bridge calls onComposerChange first), so
|
|
143
|
+
// the dispatched events can carry the doc. Reset to a text-only doc when a value
|
|
144
|
+
// is set that didn't come from the composer (e.g. a suggestion fill).
|
|
145
|
+
let lastChange: ComposerChange = { doc: [], text: '', entities: [] };
|
|
136
146
|
|
|
137
|
-
|
|
147
|
+
// Seed from a ComposerDoc `value`: push it into `internal` (so `current()`
|
|
148
|
+
// reflects the seed) and into `lastChange` (so a submit-WITHOUT-edit still
|
|
149
|
+
// carries the seeded doc + entities). Re-runs only when `value` is reassigned.
|
|
150
|
+
createEffect(() => {
|
|
151
|
+
const v = props.value;
|
|
152
|
+
if (v != null && typeof v !== 'string') {
|
|
153
|
+
const doc = normalizeValue(v);
|
|
154
|
+
setInternal(doc);
|
|
155
|
+
lastChange = { doc, text: serializeToText(doc), entities: entitiesOf(doc) };
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const handleChange = (v: string) => {
|
|
160
|
+
setInternal(v);
|
|
161
|
+
if (v !== lastChange.text) lastChange = { doc: normalizeValue(v), text: v, entities: [] };
|
|
162
|
+
dispatch('kai-value-change', { value: v, doc: lastChange.doc, entities: lastChange.entities });
|
|
163
|
+
};
|
|
138
164
|
const handleSubmit = () => {
|
|
139
|
-
|
|
165
|
+
// `value` is always the flattened string (back-compat); a seeded doc is
|
|
166
|
+
// serialized. The structured `doc`/`entities` carry the pills.
|
|
167
|
+
dispatch('kai-submit', { value: serializeToText(normalizeValue(current())), doc: lastChange.doc, entities: lastChange.entities, attachments: attachments() });
|
|
140
168
|
setAttachments([]);
|
|
141
169
|
};
|
|
142
170
|
const handleSuggestionClick = (v: string) => {
|
|
@@ -145,16 +173,36 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
|
|
|
145
173
|
dispatch('kai-suggestion-click', { value: v });
|
|
146
174
|
} else {
|
|
147
175
|
// Default: behave as if the user typed the suggestion and pressed submit.
|
|
148
|
-
dispatch('kai-submit', { value: v, attachments: attachments() });
|
|
176
|
+
dispatch('kai-submit', { value: v, doc: normalizeValue(v), entities: [], attachments: attachments() });
|
|
149
177
|
setAttachments([]);
|
|
150
178
|
}
|
|
151
179
|
};
|
|
152
180
|
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
181
|
+
// ── Imperative API (instance methods on the host) ──────────────────────────
|
|
182
|
+
// The input half of the interaction surface; counterpart to the kai-* events.
|
|
183
|
+
expose({
|
|
184
|
+
/** Focus the text editor inside the shadow root (not the hidden file input). */
|
|
185
|
+
focus: (options?: FocusOptions) => {
|
|
186
|
+
const root = element.shadowRoot;
|
|
187
|
+
const target =
|
|
188
|
+
root?.querySelector<HTMLElement>('[contenteditable]:not([contenteditable="false"]), textarea') ??
|
|
189
|
+
root?.querySelector<HTMLElement>('input:not([type="file"])');
|
|
190
|
+
target?.focus(options);
|
|
191
|
+
},
|
|
192
|
+
/** Blur the focused input control. */
|
|
193
|
+
blur: () =>
|
|
194
|
+
(element.shadowRoot?.activeElement as HTMLElement | null)?.blur(),
|
|
195
|
+
/** Clear the text and any staged attachments (fires kai-value-change /
|
|
196
|
+
* kai-attachments-change so a controlled consumer can react). */
|
|
197
|
+
clear: () => {
|
|
198
|
+
handleChange('');
|
|
199
|
+
if (attachments().length) { setAttachments([]); dispatch('kai-attachments-change', { attachments: [] }); }
|
|
200
|
+
},
|
|
201
|
+
/** Send the current value programmatically — same path as Enter / the send
|
|
202
|
+
* button (fires kai-submit, then clears staged attachments). Named `send`,
|
|
203
|
+
* not `submit`, to avoid colliding with the `submit` prop. */
|
|
204
|
+
send: () => handleSubmit(),
|
|
205
|
+
});
|
|
158
206
|
|
|
159
207
|
return (
|
|
160
208
|
<DefaultPromptInput
|
|
@@ -163,22 +211,23 @@ defineWebComponent<Props, Events>('kai-prompt-input', {
|
|
|
163
211
|
disabled={flag('disabled')}
|
|
164
212
|
loading={flag('loading')}
|
|
165
213
|
stoppable={flag('stoppable')}
|
|
214
|
+
submit={props.submit as 'always' | 'auto'}
|
|
215
|
+
attach={flag('attach')}
|
|
166
216
|
suggestions={props.suggestions}
|
|
167
217
|
attachments={attachments()}
|
|
168
|
-
slashCommands={allSlashCommands().length ? allSlashCommands() : undefined}
|
|
169
|
-
slashActiveIds={props.slashActiveIds}
|
|
170
|
-
slashCompact={flag('slashCompact')}
|
|
171
218
|
search={flag('search')}
|
|
172
219
|
voice={flag('voice')}
|
|
173
220
|
toolbarActions={toolbarActions()}
|
|
221
|
+
triggers={props.triggers}
|
|
222
|
+
kindIcons={props.kindIcons as Record<string, string> | undefined}
|
|
223
|
+
onComposerChange={(c) => { lastChange = c; }}
|
|
174
224
|
onValueChange={handleChange}
|
|
175
225
|
onSubmit={handleSubmit}
|
|
176
226
|
onSuggestionClick={handleSuggestionClick}
|
|
177
|
-
onAttachmentsChange={setAttachments}
|
|
227
|
+
onAttachmentsChange={(a) => { setAttachments(a); dispatch('kai-attachments-change', { attachments: a }); }}
|
|
178
228
|
onSearch={() => dispatch('kai-search')}
|
|
179
229
|
onVoice={() => dispatch('kai-voice')}
|
|
180
230
|
onStop={() => dispatch('kai-stop')}
|
|
181
|
-
onSlashSelect={(command) => dispatch('kai-slash-select', { command })}
|
|
182
231
|
onAction={(id) => dispatch('kai-toolbar-action', { action: id })}
|
|
183
232
|
/>
|
|
184
233
|
);
|