@kitn.ai/ui 0.17.0 → 0.18.1
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-C2LTALdM.js +1 -0
- package/dist/elements/chunks/action-icons-Dtl8Ox5D.js +1 -0
- package/dist/elements/chunks/arrow-left-GbBceGBE.js +1 -0
- package/dist/elements/chunks/attachments-DLJcWCDV.js +1 -0
- package/dist/elements/chunks/badge-BTNZTODL.js +1 -0
- package/dist/elements/chunks/button-DBDZebGr.js +1 -0
- package/dist/elements/chunks/card-YfCyI4fH.js +1 -0
- package/dist/elements/chunks/chat-thread-Dz2qbzvI.js +1 -0
- package/dist/elements/chunks/check-fhmRksq_.js +1 -0
- package/dist/elements/chunks/chevron-down-DcRg1aRU.js +1 -0
- package/dist/elements/chunks/chevron-right-ChzBcNJ-.js +1 -0
- package/dist/elements/chunks/circle-B4fTe9v6.js +1 -0
- package/dist/elements/chunks/circle-check-CJV-3Rem.js +1 -0
- package/dist/elements/chunks/circle-x-pDtzlghQ.js +1 -0
- package/dist/elements/chunks/cn-CU7UAWzk.js +1 -0
- package/dist/elements/chunks/code-block-DZ6mz6vs.js +1 -0
- package/dist/elements/chunks/collapsible-CWUAShMC.js +1 -0
- package/dist/elements/chunks/composer-BZyPU6gD.js +65 -0
- package/dist/elements/chunks/context-Cx6eQA_G.js +1 -0
- package/dist/elements/chunks/conversation-list-C4xTQSpT.js +1 -0
- package/dist/elements/chunks/default-input-BZcwyKcP.js +1 -0
- package/dist/elements/chunks/define-CNSKFZCd.js +1 -0
- package/dist/elements/chunks/disclosure-BcBs--Jf.js +1 -0
- package/dist/elements/chunks/download-BDQwcFav.js +1 -0
- package/dist/elements/chunks/dropdown-wgs8xCJZ.js +1 -0
- package/dist/elements/chunks/ellipsis-CUiEJ6R1.js +1 -0
- package/dist/elements/chunks/external-link-DJUmC7g2.js +1 -0
- package/dist/elements/chunks/file-text-DOYfYvrh.js +1 -0
- package/dist/elements/chunks/file-tree-DQzNQrbr.js +1 -0
- package/dist/elements/chunks/folder-DBDUBANz.js +1 -0
- package/dist/elements/chunks/hover-card-BQGdGAQ3.js +1 -0
- package/dist/elements/chunks/icon-CAyRqVrg.js +1 -0
- package/dist/elements/chunks/{index-CTBEJeo6.js → index-BCRhi84a.js} +1 -1
- package/dist/elements/chunks/info-DBQl-m6e.js +1 -0
- package/dist/elements/chunks/input-DZD67EvW.js +1 -0
- package/dist/elements/chunks/kbd-DbyVrlnU.js +1 -0
- package/dist/elements/chunks/link-vko7AttA.js +1 -0
- package/dist/elements/chunks/loader-Cg6rO8tQ.js +1 -0
- package/dist/elements/chunks/{markdown-CMTGx9r8.js → markdown-n3Xbj3PR.js} +9 -9
- package/dist/elements/chunks/message-CgKytiSB.js +1 -0
- package/dist/elements/chunks/message-feedback-Ds3-US0e.js +1 -0
- package/dist/elements/chunks/message-square-MmRkvc-M.js +1 -0
- package/dist/elements/chunks/minimize-2-3kCdE0q3.js +1 -0
- package/dist/elements/chunks/model-switcher-BMtXGwLU.js +1 -0
- package/dist/elements/chunks/overlay-B1-MBI6h.js +1 -0
- package/dist/elements/chunks/paperclip-DDEfmkHc.js +1 -0
- package/dist/elements/chunks/progress-bar-Dwbiyv3s.js +1 -0
- package/dist/elements/chunks/prompt-suggestion-9lvgFcEa.js +1 -0
- package/dist/elements/chunks/reasoning-DzHWsdAJ.js +1 -0
- package/dist/elements/chunks/resizable-Bq_eHxUm.js +1 -0
- package/dist/elements/chunks/rotate-cw-jpisOdOV.js +1 -0
- package/dist/elements/chunks/scroll-area-g5Ze3K6f.js +1 -0
- package/dist/elements/chunks/separator-Bmjc5XyX.js +1 -0
- package/dist/elements/chunks/settings-Cz1bMJP9.js +1 -0
- package/dist/elements/chunks/settings-group-9imY3kRA.js +1 -0
- package/dist/elements/chunks/share-BdenF0wQ.js +1 -0
- package/dist/elements/chunks/skeleton-Pjc5jiaY.js +1 -0
- package/dist/elements/chunks/slots-DkZ-Cmha.js +1 -0
- package/dist/elements/chunks/star-DY6z1UUH.js +1 -0
- package/dist/elements/chunks/store-th4VyJXM.js +1 -0
- package/dist/elements/chunks/text-shimmer-CEi-tlXr.js +1 -0
- package/dist/elements/chunks/textarea-CboigarR.js +1 -0
- package/dist/elements/chunks/thumbs-up-BR33KLfA.js +1 -0
- package/dist/elements/chunks/toast-store-BEMda0fv.js +1 -0
- package/dist/elements/chunks/tool-TMued3WO.js +1 -0
- package/dist/elements/chunks/tooltip-Cft_Rxiw.js +1 -0
- package/dist/elements/chunks/triangle-alert-B07fX3Q8.js +1 -0
- package/dist/elements/chunks/use-card-resolution-M36zVciB.js +1 -0
- package/dist/elements/chunks/video-MKp3LmNT.js +1 -0
- package/dist/elements/chunks/x-Ckwicf6g.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 +8255 -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-cKscku5m.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 +77 -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 +31 -10
- package/src/agent-tooling/mcp/manifest.ts +14 -0
- package/src/agent-tooling/mcp/tools/debug.ts +11 -7
- 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 +249 -0
- package/src/components/component-meta.json +699 -110
- 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 +341 -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 +2 -2
- 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 +87 -7
- 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 +218 -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 +117 -0
- package/src/ui/pane-group.tsx +291 -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
package/src/ui/pane.tsx
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { type JSX, Show } from 'solid-js';
|
|
2
|
+
import { Maximize2, Minimize2, X, Columns2, PanelRight } from 'lucide-solid';
|
|
3
|
+
import { cn } from '../utils/cn';
|
|
4
|
+
|
|
5
|
+
/** The work state of the pane's agent/process. Drives a tone-colored status dot
|
|
6
|
+
* (and optional label) in the header. */
|
|
7
|
+
export type PaneStatusTone = 'working' | 'idle' | 'done' | 'error' | 'blocked';
|
|
8
|
+
|
|
9
|
+
export interface PaneStatus {
|
|
10
|
+
/** The tone — maps to a semantic status hue (see {@link PANE_STATUS_BG}). */
|
|
11
|
+
tone: PaneStatusTone;
|
|
12
|
+
/** Optional text beside the dot (e.g. "Running tests…"). Without it the dot is
|
|
13
|
+
* decorative and only the color carries meaning. */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** Animate a ping ring on the dot — for the live `working` state. Respects
|
|
16
|
+
* prefers-reduced-motion. */
|
|
17
|
+
pulse?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** tone → status-dot color utility, backed by the kit's tool-* / muted tokens so
|
|
21
|
+
* it reads correctly in BOTH light and dark without hardcoded colors.
|
|
22
|
+
* - `working` → blue (in-flight)
|
|
23
|
+
* - `idle` → neutral muted (waiting)
|
|
24
|
+
* - `done` → green (complete)
|
|
25
|
+
* - `error` → red (failed)
|
|
26
|
+
* - `blocked` → amber (needs input / stalled) */
|
|
27
|
+
export const PANE_STATUS_BG: Record<PaneStatusTone, string> = {
|
|
28
|
+
working: 'bg-tool-blue',
|
|
29
|
+
idle: 'bg-muted-foreground',
|
|
30
|
+
done: 'bg-tool-green',
|
|
31
|
+
error: 'bg-tool-red',
|
|
32
|
+
blocked: 'bg-tool-amber',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface PaneProps {
|
|
36
|
+
/** A glyph/avatar shown before the title (an agent icon, a model avatar). */
|
|
37
|
+
leading?: JSX.Element;
|
|
38
|
+
/** The pane title — the agent / window name. */
|
|
39
|
+
title: string;
|
|
40
|
+
/** A role / label shown under the title (e.g. "Reviewer", "claude-sonnet"). */
|
|
41
|
+
subtitle?: string;
|
|
42
|
+
/** A tone-colored status dot (+ optional label) in the header. */
|
|
43
|
+
status?: PaneStatus;
|
|
44
|
+
/** Extra header controls, placed BEFORE the built-in window controls. */
|
|
45
|
+
actions?: JSX.Element;
|
|
46
|
+
/** The pane body — scrolls inside a `min-h-0 flex-1 overflow-y-auto` region. */
|
|
47
|
+
children?: JSX.Element;
|
|
48
|
+
/** A pinned row below the body (e.g. a composer). Stays put while the body scrolls. */
|
|
49
|
+
footer?: JSX.Element;
|
|
50
|
+
/** Highlight the frame with a ring/border to signal the ACTIVE pane. */
|
|
51
|
+
focused?: boolean;
|
|
52
|
+
/** Show the restore glyph (Minimize2) instead of maximize (Maximize2). */
|
|
53
|
+
maximized?: boolean;
|
|
54
|
+
/** Maximize/restore window control. */
|
|
55
|
+
onMaximize?: () => void;
|
|
56
|
+
/** Close window control. */
|
|
57
|
+
onClose?: () => void;
|
|
58
|
+
/** Optional split control — the button only renders when this is provided. */
|
|
59
|
+
onSplit?: () => void;
|
|
60
|
+
/** Optional dock-to-side control — the button only renders when this is provided. */
|
|
61
|
+
onDock?: () => void;
|
|
62
|
+
/** Extra classes for the outer frame. */
|
|
63
|
+
class?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A header window-control: a square, muted icon button. */
|
|
67
|
+
function ControlButton(props: { label: string; onClick?: () => void; children: JSX.Element }) {
|
|
68
|
+
return (
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
aria-label={props.label}
|
|
72
|
+
onClick={() => props.onClick?.()}
|
|
73
|
+
class="flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-80 transition-colors hover:bg-hover hover:text-foreground hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
74
|
+
>
|
|
75
|
+
{props.children}
|
|
76
|
+
</button>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Pane — a reusable framed panel for a multi-agent workspace: a header (leading
|
|
82
|
+
* glyph + title/subtitle + status dot + actions + window controls), a scrolling
|
|
83
|
+
* body, and an optional pinned footer (e.g. a composer). It is the "pane frame"
|
|
84
|
+
* every agent tile otherwise re-hand-rolls.
|
|
85
|
+
*
|
|
86
|
+
* Layout: the outer frame is a column flexbox; the header and footer hold their
|
|
87
|
+
* height (`shrink-0`) while the body takes the rest (`min-h-0 flex-1
|
|
88
|
+
* overflow-y-auto`) so content scrolls INSIDE the pane. Give the pane a bounded
|
|
89
|
+
* height (a fixed parent, or `h-full` inside a grid/flex track) for the scroll to
|
|
90
|
+
* engage; the body imposes no padding so content controls its own.
|
|
91
|
+
*
|
|
92
|
+
* Window controls (right side of the header): maximize/restore (Maximize2 ↔
|
|
93
|
+
* Minimize2, toggled by `maximized`) and close (X) are always present; split
|
|
94
|
+
* (Columns2) and dock (PanelRight) only render when `onSplit` / `onDock` are
|
|
95
|
+
* passed. Each fires its callback prop.
|
|
96
|
+
*
|
|
97
|
+
* States: `focused` paints a ring + accent border to mark the active pane;
|
|
98
|
+
* `maximized` swaps the maximize glyph for restore.
|
|
99
|
+
*
|
|
100
|
+
* Colors come entirely from design tokens (surface / border / ring / tool-*),
|
|
101
|
+
* so it reads correctly in light and dark with no hardcoded values. The header,
|
|
102
|
+
* body, footer, and window-control cluster are exposed via
|
|
103
|
+
* `::part(header|body|footer|controls)` for the `kai-pane` facade.
|
|
104
|
+
*/
|
|
105
|
+
export function Pane(props: PaneProps) {
|
|
106
|
+
return (
|
|
107
|
+
<div
|
|
108
|
+
data-pane
|
|
109
|
+
class={cn(
|
|
110
|
+
'flex h-full min-h-0 flex-col overflow-hidden rounded-xl border bg-surface',
|
|
111
|
+
props.focused ? 'border-ring ring-2 ring-inset ring-ring/35' : 'border-border',
|
|
112
|
+
props.class,
|
|
113
|
+
)}
|
|
114
|
+
>
|
|
115
|
+
<div
|
|
116
|
+
part="header"
|
|
117
|
+
class="flex shrink-0 items-center gap-2.5 border-b border-border px-3 py-2"
|
|
118
|
+
>
|
|
119
|
+
<Show when={props.leading}>
|
|
120
|
+
<span class="flex shrink-0 items-center text-muted-foreground">{props.leading}</span>
|
|
121
|
+
</Show>
|
|
122
|
+
<div class="flex min-w-0 flex-col">
|
|
123
|
+
<span class="truncate text-sm font-medium leading-tight text-foreground">{props.title}</span>
|
|
124
|
+
<Show when={props.subtitle}>
|
|
125
|
+
<span class="truncate text-xs leading-tight text-muted-foreground">{props.subtitle}</span>
|
|
126
|
+
</Show>
|
|
127
|
+
</div>
|
|
128
|
+
<Show when={props.status}>
|
|
129
|
+
{(status) => (
|
|
130
|
+
<span
|
|
131
|
+
class="flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground"
|
|
132
|
+
role={status().label ? 'status' : undefined}
|
|
133
|
+
aria-label={status().label}
|
|
134
|
+
>
|
|
135
|
+
<span class="relative flex size-2">
|
|
136
|
+
<Show when={status().pulse}>
|
|
137
|
+
<span
|
|
138
|
+
aria-hidden="true"
|
|
139
|
+
class={cn(
|
|
140
|
+
'absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 motion-reduce:hidden',
|
|
141
|
+
PANE_STATUS_BG[status().tone],
|
|
142
|
+
)}
|
|
143
|
+
/>
|
|
144
|
+
</Show>
|
|
145
|
+
<span
|
|
146
|
+
aria-hidden="true"
|
|
147
|
+
class={cn('relative inline-flex size-2 rounded-full', PANE_STATUS_BG[status().tone])}
|
|
148
|
+
/>
|
|
149
|
+
</span>
|
|
150
|
+
<Show when={status().label}>
|
|
151
|
+
<span class="truncate">{status().label}</span>
|
|
152
|
+
</Show>
|
|
153
|
+
</span>
|
|
154
|
+
)}
|
|
155
|
+
</Show>
|
|
156
|
+
<div part="controls" class="ml-auto flex shrink-0 items-center gap-0.5">
|
|
157
|
+
{props.actions}
|
|
158
|
+
<Show when={props.onSplit}>
|
|
159
|
+
<ControlButton label="Split pane" onClick={props.onSplit}>
|
|
160
|
+
<Columns2 class="size-4" aria-hidden="true" />
|
|
161
|
+
</ControlButton>
|
|
162
|
+
</Show>
|
|
163
|
+
<Show when={props.onDock}>
|
|
164
|
+
<ControlButton label="Dock pane" onClick={props.onDock}>
|
|
165
|
+
<PanelRight class="size-4" aria-hidden="true" />
|
|
166
|
+
</ControlButton>
|
|
167
|
+
</Show>
|
|
168
|
+
<ControlButton
|
|
169
|
+
label={props.maximized ? 'Restore pane' : 'Maximize pane'}
|
|
170
|
+
onClick={props.onMaximize}
|
|
171
|
+
>
|
|
172
|
+
<Show when={props.maximized} fallback={<Maximize2 class="size-4" aria-hidden="true" />}>
|
|
173
|
+
<Minimize2 class="size-4" aria-hidden="true" />
|
|
174
|
+
</Show>
|
|
175
|
+
</ControlButton>
|
|
176
|
+
<ControlButton label="Close pane" onClick={props.onClose}>
|
|
177
|
+
<X class="size-4" aria-hidden="true" />
|
|
178
|
+
</ControlButton>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<div part="body" class="min-h-0 flex-1 overflow-y-auto" tabindex={0}>
|
|
183
|
+
{props.children}
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<Show when={props.footer}>
|
|
187
|
+
<div part="footer" class="shrink-0 border-t border-border">
|
|
188
|
+
{props.footer}
|
|
189
|
+
</div>
|
|
190
|
+
</Show>
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
}
|
package/src/ui/popover.tsx
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { createSignal, Show, type JSX } from 'solid-js';
|
|
1
|
+
import { createSignal, Show, type JSX, type Accessor } from 'solid-js';
|
|
2
2
|
import type { Placement } from '@floating-ui/dom';
|
|
3
3
|
import { cn } from '../utils/cn';
|
|
4
4
|
import { createPresence, usePosition, useDismiss } from './overlay';
|
|
5
5
|
|
|
6
|
+
/** Imperative open controller, handed to a parent (e.g. the kai-popover facade)
|
|
7
|
+
* via `controllerRef` so it can drive/observe open state. */
|
|
8
|
+
export interface PopoverController { open: Accessor<boolean>; setOpen: (v: boolean) => void; }
|
|
9
|
+
|
|
6
10
|
export interface PopoverProps {
|
|
7
11
|
/** The trigger content (e.g. a button). Clicking it toggles the popover. */
|
|
8
12
|
trigger: JSX.Element;
|
|
@@ -17,8 +21,12 @@ export interface PopoverProps {
|
|
|
17
21
|
open?: boolean;
|
|
18
22
|
/** Initial open state when uncontrolled. */
|
|
19
23
|
defaultOpen?: boolean;
|
|
24
|
+
/** When true, clicking the trigger never opens the popover. */
|
|
25
|
+
disabled?: boolean;
|
|
20
26
|
/** Fires whenever the popover wants to open or close. */
|
|
21
27
|
onOpenChange?: (open: boolean) => void;
|
|
28
|
+
/** Receive the open controller (open accessor + setOpen) once mounted. */
|
|
29
|
+
controllerRef?: (api: PopoverController) => void;
|
|
22
30
|
/** Extra elements counted as "inside" for outside-click dismissal — e.g. the
|
|
23
31
|
* custom-element host, so clicks on slotted panel content don't dismiss. */
|
|
24
32
|
boundary?: () => HTMLElement | undefined;
|
|
@@ -45,10 +53,16 @@ export function Popover(props: PopoverProps) {
|
|
|
45
53
|
props.onOpenChange?.(v);
|
|
46
54
|
};
|
|
47
55
|
|
|
56
|
+
// Hand the open controller up to a parent (e.g. the kai-popover facade) so it
|
|
57
|
+
// can drive/observe open state via wireDisclosure.
|
|
58
|
+
props.controllerRef?.({ open: isOpen, setOpen });
|
|
59
|
+
|
|
48
60
|
const presence = createPresence(isOpen);
|
|
49
61
|
const position = usePosition(trigger, panel, {
|
|
50
62
|
placement: props.placement ?? 'bottom-start',
|
|
51
63
|
gutter: props.gutter ?? 6,
|
|
64
|
+
// Trigger removed from the DOM -> close so the panel portal doesn't orphan.
|
|
65
|
+
onDisconnect: () => setOpen(false),
|
|
52
66
|
});
|
|
53
67
|
useDismiss({
|
|
54
68
|
enabled: isOpen,
|
|
@@ -61,7 +75,7 @@ export function Popover(props: PopoverProps) {
|
|
|
61
75
|
<span
|
|
62
76
|
ref={setTrigger}
|
|
63
77
|
style={{ display: 'inline-flex' }}
|
|
64
|
-
onClick={() => setOpen(!isOpen())}
|
|
78
|
+
onClick={() => { if (!props.disabled) setOpen(!isOpen()); }}
|
|
65
79
|
>
|
|
66
80
|
{props.trigger}
|
|
67
81
|
</span>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type JSX, Show, splitProps, createUniqueId } from 'solid-js';
|
|
2
|
+
import { cn } from '../utils/cn';
|
|
3
|
+
|
|
4
|
+
export type ProgressTone = 'primary' | 'success' | 'warning' | 'error' | 'info';
|
|
5
|
+
|
|
6
|
+
/** Fill hue per `tone`. `primary` is the theme accent; the rest use the kit's
|
|
7
|
+
* tool hues (the same colors as kai-status / kai-notice). */
|
|
8
|
+
export const TONE_FILL: Record<ProgressTone, string> = {
|
|
9
|
+
primary: 'bg-primary',
|
|
10
|
+
success: 'bg-tool-green',
|
|
11
|
+
warning: 'bg-tool-amber',
|
|
12
|
+
error: 'bg-tool-red',
|
|
13
|
+
info: 'bg-tool-blue',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export interface ProgressBarProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
/** Current progress value (0..max). */
|
|
18
|
+
value: number;
|
|
19
|
+
/** The value `value` runs to. Defaults to 100. */
|
|
20
|
+
max?: number;
|
|
21
|
+
/** Optional caption above the track. */
|
|
22
|
+
label?: string;
|
|
23
|
+
/** Fill color. Defaults to `primary`. Override via `::part(fill)` for custom hues. */
|
|
24
|
+
tone?: ProgressTone;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A thin determinate progress bar: a rounded track with a `bg-primary` fill whose
|
|
29
|
+
* width is `value / max`, clamped to 0..100%. Theme-aware (track = `bg-surface-strong`,
|
|
30
|
+
* fill = `bg-primary`). Set `tone` for a semantic fill hue. Restyle via
|
|
31
|
+
* `::part(track)` / `::part(fill)`. The fill width transitions smoothly under
|
|
32
|
+
* `prefers-reduced-motion: no-preference`.
|
|
33
|
+
*/
|
|
34
|
+
export function ProgressBar(props: ProgressBarProps) {
|
|
35
|
+
const [local, rest] = splitProps(props, [
|
|
36
|
+
'value', 'max', 'label', 'tone', 'class', 'aria-label', 'aria-labelledby',
|
|
37
|
+
]);
|
|
38
|
+
const labelId = createUniqueId();
|
|
39
|
+
const max = () => local.max ?? 100;
|
|
40
|
+
// Clamp value into [0, max]; drive both the fill width and aria-valuenow off it
|
|
41
|
+
// so the bar and the announced value stay consistent.
|
|
42
|
+
const clamped = () => {
|
|
43
|
+
const m = max();
|
|
44
|
+
if (!(m > 0)) return 0;
|
|
45
|
+
return Math.max(0, Math.min(local.value, m));
|
|
46
|
+
};
|
|
47
|
+
const percent = () => {
|
|
48
|
+
const m = max();
|
|
49
|
+
return m > 0 ? (clamped() / m) * 100 : 0;
|
|
50
|
+
};
|
|
51
|
+
// The progressbar must always carry an accessible name. Prefer the rendered
|
|
52
|
+
// visible label; else a caller-supplied aria-labelledby/aria-label; else a
|
|
53
|
+
// generic default so the bar is never nameless (axe `aria-progressbar-name`).
|
|
54
|
+
const labelledBy = () => (local.label ? labelId : local['aria-labelledby']);
|
|
55
|
+
const ariaLabel = () =>
|
|
56
|
+
local.label || local['aria-labelledby'] ? undefined : local['aria-label'] ?? 'Progress';
|
|
57
|
+
return (
|
|
58
|
+
<div class={cn('flex flex-col gap-1', local.class)} {...rest}>
|
|
59
|
+
<Show when={local.label}>
|
|
60
|
+
<span id={labelId} class="text-xs text-muted-foreground">{local.label}</span>
|
|
61
|
+
</Show>
|
|
62
|
+
<div
|
|
63
|
+
part="track"
|
|
64
|
+
role="progressbar"
|
|
65
|
+
aria-valuenow={clamped()}
|
|
66
|
+
aria-valuemin={0}
|
|
67
|
+
aria-valuemax={max()}
|
|
68
|
+
aria-labelledby={labelledBy()}
|
|
69
|
+
aria-label={ariaLabel()}
|
|
70
|
+
class="h-1.5 w-full overflow-hidden rounded-full bg-surface-strong"
|
|
71
|
+
>
|
|
72
|
+
<div
|
|
73
|
+
part="fill"
|
|
74
|
+
class={cn(
|
|
75
|
+
'h-full rounded-full motion-safe:transition-[width] motion-safe:duration-500 motion-safe:ease-out',
|
|
76
|
+
TONE_FILL[local.tone ?? 'primary'],
|
|
77
|
+
)}
|
|
78
|
+
style={{ width: `${percent()}%` }}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { type JSX, Show } from 'solid-js';
|
|
2
|
+
import { cn } from '../utils/cn';
|
|
3
|
+
|
|
4
|
+
/** How the tray frames the input — the SPATIAL axis (padding/inset only).
|
|
5
|
+
* Orthogonal to {@link PromptDockAppearance}, which controls the surface.
|
|
6
|
+
* - `inset` (default) — uniform inset frames the input on ALL edges (the classic look).
|
|
7
|
+
* - `edge` — top/bottom inset only; the input sits FLUSH left/right so the lips span
|
|
8
|
+
* the full width.
|
|
9
|
+
* - `none` — no inset at all; the lips attach directly to the input as a plain stack. */
|
|
10
|
+
export type PromptDockFrame = 'inset' | 'edge' | 'none';
|
|
11
|
+
|
|
12
|
+
/** How the tray surface looks — the VISUAL axis (background / border / radius only).
|
|
13
|
+
* Orthogonal to {@link PromptDockFrame}, which controls the spatial inset. Works like
|
|
14
|
+
* a button variant.
|
|
15
|
+
* - `soft` (default) — sunken surface + border + radius (the classic look).
|
|
16
|
+
* - `outlined` — transparent surface + border + radius.
|
|
17
|
+
* - `filled` — sunken surface, no border, + radius.
|
|
18
|
+
* - `plain` — transparent surface, no border, no radius (truly bare). */
|
|
19
|
+
export type PromptDockAppearance = 'soft' | 'outlined' | 'filled' | 'plain';
|
|
20
|
+
|
|
21
|
+
export interface PromptDockProps {
|
|
22
|
+
/** Optional content for the recessed band ABOVE the input (a notice, a hint).
|
|
23
|
+
* When omitted, no top lip renders and only the input shows. */
|
|
24
|
+
top?: JSX.Element;
|
|
25
|
+
/** Optional content for the recessed band BELOW the input (a mode / control row).
|
|
26
|
+
* When omitted, no bottom lip renders. */
|
|
27
|
+
bottom?: JSX.Element;
|
|
28
|
+
/** Extra classes for the TOP lip wrapper, merged over the default band styling.
|
|
29
|
+
* Use this to give the top region its own surface (e.g. a tinted notice) without
|
|
30
|
+
* affecting the bottom. The eventual `kai-prompt-dock` element will expose the
|
|
31
|
+
* same region via `::part(top)`. */
|
|
32
|
+
topClass?: string;
|
|
33
|
+
/** Extra classes for the BOTTOM lip wrapper, merged over the default band styling.
|
|
34
|
+
* The eventual `kai-prompt-dock` element will expose this region via
|
|
35
|
+
* `::part(bottom)`. */
|
|
36
|
+
bottomClass?: string;
|
|
37
|
+
/** How the tray frames the input — the SPATIAL inset only. Defaults to `'inset'`
|
|
38
|
+
* (the classic recessed look), so existing consumers are unaffected.
|
|
39
|
+
* See {@link PromptDockFrame}. */
|
|
40
|
+
frame?: PromptDockFrame;
|
|
41
|
+
/** How the tray surface looks — the VISUAL axis (background / border / radius),
|
|
42
|
+
* orthogonal to `frame`. Defaults to `'soft'` (the classic look), so existing
|
|
43
|
+
* consumers are unaffected. See {@link PromptDockAppearance}. */
|
|
44
|
+
appearance?: PromptDockAppearance;
|
|
45
|
+
/** The prompt input - the raised card that floats on the tray. */
|
|
46
|
+
children: JSX.Element;
|
|
47
|
+
/** Extra classes for the outer tray. */
|
|
48
|
+
class?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Shared base styling for a lip region; per-region classes append/override it. */
|
|
52
|
+
const LIP_BASE = 'px-3 py-2 text-sm leading-snug text-muted-foreground';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* PromptDock - a recessed tray that frames a prompt input and can extend with
|
|
56
|
+
* optional "lip" regions above and/or below it.
|
|
57
|
+
*
|
|
58
|
+
* The model: the input stays the prominent, fully-rounded RAISED card; the lips
|
|
59
|
+
* sit in a slightly darker, RECESSED band tucked above and/or below it, sharing
|
|
60
|
+
* the tray's outer rounding so the whole thing reads as one cohesive control.
|
|
61
|
+
* When nothing is slotted top or bottom, only the input shows: no visible lip.
|
|
62
|
+
*
|
|
63
|
+
* Styling splits into two ORTHOGONAL axes so the spatial framing and the surface
|
|
64
|
+
* can be set independently (like a button's size vs. its variant):
|
|
65
|
+
*
|
|
66
|
+
* `frame` - the SPATIAL inset (padding only):
|
|
67
|
+
* - `inset` (default) - a small, uniform inset frames the input on EVERY side
|
|
68
|
+
* (the tray padding plus the flex gap give a ~6px frame). The classic look.
|
|
69
|
+
* - `edge` - top/bottom inset only; the input is FLUSH on the left / right so the
|
|
70
|
+
* lips span the full width. Matches the Claude Code / Codex references, where the
|
|
71
|
+
* lip is a top/bottom phenomenon.
|
|
72
|
+
* - `none` - no inset at all; the lips attach directly to the input as a plain
|
|
73
|
+
* vertical stack. The lips keep their own internal padding so content still has
|
|
74
|
+
* breathing room.
|
|
75
|
+
*
|
|
76
|
+
* `appearance` - the SURFACE (background / border / radius):
|
|
77
|
+
* - `soft` (default) - sunken surface + border + radius (the classic look).
|
|
78
|
+
* - `outlined` - transparent surface + border + radius.
|
|
79
|
+
* - `filled` - sunken surface, no border, + radius.
|
|
80
|
+
* - `plain` - transparent surface, no border, no radius (truly bare).
|
|
81
|
+
*
|
|
82
|
+
* The two are independent: e.g. `frame="none" appearance="plain"` is a bare stack,
|
|
83
|
+
* while `frame="inset" appearance="outlined"` keeps the inset but drops the fill.
|
|
84
|
+
*
|
|
85
|
+
* Surface, border, radius and inset come from four CSS custom-property TOKENS, so
|
|
86
|
+
* a consumer can fine-tune the chrome without touching internals (override the var
|
|
87
|
+
* from outside; the variant chooses the structure). Each is referenced with a
|
|
88
|
+
* fallback so it resolves stand-alone:
|
|
89
|
+
* - `--kai-prompt-dock-surface` - tray background (default `var(--color-surface-sunken)`)
|
|
90
|
+
* - `--kai-prompt-dock-border` - tray border color (default `var(--color-border)`)
|
|
91
|
+
* - `--kai-prompt-dock-radius` - outer radius (default `1.25rem`)
|
|
92
|
+
* - `--kai-prompt-dock-inset` - frame thickness around the input (default `0.375rem`)
|
|
93
|
+
*
|
|
94
|
+
* Colors default to the surface tokens (surface-sunken for the tray and lips; the
|
|
95
|
+
* input brings its own raised bg-surface), so it reads correctly in both light and
|
|
96
|
+
* dark themes without hardcoded colors. The top and bottom lips are independently
|
|
97
|
+
* styleable via `topClass` / `bottomClass` (e.g. a tinted notice up top over a
|
|
98
|
+
* neutral control row below).
|
|
99
|
+
*
|
|
100
|
+
* The eventual `kai-prompt-dock` element will expose the same three regions via
|
|
101
|
+
* `::part(tray)` / `::part(top)` / `::part(bottom)`; the primitive's equivalent
|
|
102
|
+
* hooks are the `class` / `topClass` / `bottomClass` props.
|
|
103
|
+
*/
|
|
104
|
+
export function PromptDock(props: PromptDockProps) {
|
|
105
|
+
const frame = (): PromptDockFrame => props.frame ?? 'inset';
|
|
106
|
+
const appearance = (): PromptDockAppearance => props.appearance ?? 'soft';
|
|
107
|
+
// `appearance` drives the surface (background / border / radius); `frame` drives the
|
|
108
|
+
// inset (padding). The two axes are independent.
|
|
109
|
+
const filled = () => appearance() === 'soft' || appearance() === 'filled';
|
|
110
|
+
const bordered = () => appearance() === 'soft' || appearance() === 'outlined';
|
|
111
|
+
return (
|
|
112
|
+
<div
|
|
113
|
+
data-prompt-dock
|
|
114
|
+
part="tray"
|
|
115
|
+
// Surface / border / radius / inset live in the tokenized inline style so the
|
|
116
|
+
// var fallbacks resolve and external overrides win; only the structural
|
|
117
|
+
// flex + gap stay in classes.
|
|
118
|
+
class={cn('flex flex-col gap-1.5', props.class)}
|
|
119
|
+
style={{
|
|
120
|
+
background: filled()
|
|
121
|
+
? 'var(--kai-prompt-dock-surface, var(--color-surface-sunken))'
|
|
122
|
+
: 'transparent',
|
|
123
|
+
border: bordered()
|
|
124
|
+
? '1px solid var(--kai-prompt-dock-border, var(--color-border))'
|
|
125
|
+
: '0',
|
|
126
|
+
'border-radius':
|
|
127
|
+
appearance() === 'plain' ? '0' : 'var(--kai-prompt-dock-radius, 1.25rem)',
|
|
128
|
+
padding:
|
|
129
|
+
frame() === 'none'
|
|
130
|
+
? '0'
|
|
131
|
+
: frame() === 'edge'
|
|
132
|
+
? 'var(--kai-prompt-dock-inset, 0.375rem) 0'
|
|
133
|
+
: 'var(--kai-prompt-dock-inset, 0.375rem)',
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<Show when={props.top}>
|
|
137
|
+
<div part="top" class={cn(LIP_BASE, props.topClass)}>{props.top}</div>
|
|
138
|
+
</Show>
|
|
139
|
+
{props.children}
|
|
140
|
+
<Show when={props.bottom}>
|
|
141
|
+
<div part="bottom" class={cn(LIP_BASE, props.bottomClass)}>{props.bottom}</div>
|
|
142
|
+
</Show>
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
}
|
package/src/ui/resizable.tsx
CHANGED
|
@@ -53,6 +53,51 @@ export function resolveToPx(value: SizeValue | undefined, containerPx: number):
|
|
|
53
53
|
return Number.isFinite(n) ? (n / 100) * containerPx : undefined;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/** Parse a CSS length we can statically clamp (`px` or `%` only). */
|
|
57
|
+
function parseStaticLen(v: string): { n: number; unit: 'px' | '%' } | null {
|
|
58
|
+
const m = /^\s*(-?\d*\.?\d+)(px|%)\s*$/.exec(v);
|
|
59
|
+
return m ? { n: parseFloat(m[1]), unit: m[2] as 'px' | '%' } : null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Build a panel's INITIAL `flex-basis`, clamped into its `[min, max]` bounds so
|
|
64
|
+
* it never PAINTS past its max (or below its min). The drag handler already
|
|
65
|
+
* clamps, but only once a drag begins — without this, a percentage default on a
|
|
66
|
+
* wide container (e.g. `40%` against a `480px` max) renders wider than max and
|
|
67
|
+
* then SNAPS to max on the first resize. Uses CSS `clamp()`/`min()`/`max()` so
|
|
68
|
+
* the bound is enforced at layout time against the live container size, with
|
|
69
|
+
* MIXED units (a `%` default vs a `px` max) resolving correctly — no JS measure.
|
|
70
|
+
* `basis`/`min`/`max` are already-normalized CSS lengths (see `normalizeSize`);
|
|
71
|
+
* an undefined `basis` stays undefined → the caller falls back to flexible.
|
|
72
|
+
*/
|
|
73
|
+
export function clampBasis(
|
|
74
|
+
basis: string | undefined,
|
|
75
|
+
min: string | undefined,
|
|
76
|
+
max: string | undefined,
|
|
77
|
+
): string | undefined {
|
|
78
|
+
if (basis === undefined) return undefined;
|
|
79
|
+
// Static fast-path: when the basis and every present bound share ONE unit
|
|
80
|
+
// (all px or all %), the clamp is computable at author time, so emit a bare
|
|
81
|
+
// value. This avoids a needless clamp()/min()/max() wrapper (and keeps jsdom
|
|
82
|
+
// from reducing an all-px clamp() to calc()). MIXED units (e.g. a `%` basis
|
|
83
|
+
// against a `px` max) can only resolve against the live container, so they
|
|
84
|
+
// keep the CSS function and clamp at layout time.
|
|
85
|
+
const b = parseStaticLen(basis);
|
|
86
|
+
const lo = min === undefined ? undefined : parseStaticLen(min);
|
|
87
|
+
const hi = max === undefined ? undefined : parseStaticLen(max);
|
|
88
|
+
if (b && (min === undefined || lo?.unit === b.unit) && (max === undefined || hi?.unit === b.unit)) {
|
|
89
|
+
// CSS clamp(MIN, VAL, MAX) === max(MIN, min(VAL, MAX)).
|
|
90
|
+
let n = b.n;
|
|
91
|
+
if (hi) n = Math.min(n, hi.n);
|
|
92
|
+
if (lo) n = Math.max(n, lo.n);
|
|
93
|
+
return `${n}${b.unit}`;
|
|
94
|
+
}
|
|
95
|
+
if (min !== undefined && max !== undefined) return `clamp(${min}, ${basis}, ${max})`;
|
|
96
|
+
if (max !== undefined) return `min(${basis}, ${max})`;
|
|
97
|
+
if (min !== undefined) return `max(${min}, ${basis})`;
|
|
98
|
+
return basis;
|
|
99
|
+
}
|
|
100
|
+
|
|
56
101
|
// --- ResizablePanelGroup ---
|
|
57
102
|
|
|
58
103
|
export interface ResizablePanelGroupProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
@@ -112,8 +157,31 @@ function ResizablePanel(props: ResizablePanelProps) {
|
|
|
112
157
|
// main axis to content size — the bug this replaces.) Mirrors the
|
|
113
158
|
// `<kai-resizable>` web-component panel and the Shoelace/Web Awesome grid layout.
|
|
114
159
|
// min:0 on BOTH axes enables shrink-to-scroll; overflow hidden.
|
|
160
|
+
// Effective min/max as CSS lengths, sourced from the typed `minSize`/`maxSize`
|
|
161
|
+
// props OR — when absent — from the `data-min-size`/`-pct` (and `-max-`)
|
|
162
|
+
// attributes a consumer may pass directly. The `kai-workspace` rail does the
|
|
163
|
+
// latter (`<ResizablePanel data-min-size="240" data-max-size="420">`). A bare
|
|
164
|
+
// `data-*-size` is pixels, `data-*-size-pct` is percent — the same convention
|
|
165
|
+
// the handle reads at drag time, so the initial clamp matches the drag clamp.
|
|
166
|
+
const effectiveBound = (
|
|
167
|
+
localVal: SizeValue | undefined,
|
|
168
|
+
pxAttr: unknown,
|
|
169
|
+
pctAttr: unknown,
|
|
170
|
+
): string | undefined => {
|
|
171
|
+
const fromProp = normalizeSize(localVal);
|
|
172
|
+
if (fromProp !== undefined) return fromProp;
|
|
173
|
+
const px = pxAttr == null ? '' : String(pxAttr).trim();
|
|
174
|
+
if (px !== '') { const n = parseFloat(px); if (Number.isFinite(n)) return `${n}px`; }
|
|
175
|
+
const pct = pctAttr == null ? '' : String(pctAttr).trim();
|
|
176
|
+
if (pct !== '') { const n = parseFloat(pct); if (Number.isFinite(n)) return `${n}%`; }
|
|
177
|
+
return undefined;
|
|
178
|
+
};
|
|
179
|
+
|
|
115
180
|
const sizeStyle = (): Record<string, string> => {
|
|
116
|
-
const
|
|
181
|
+
const r = rest as Record<string, unknown>;
|
|
182
|
+
const minB = effectiveBound(local.minSize, r['data-min-size'], r['data-min-size-pct']);
|
|
183
|
+
const maxB = effectiveBound(local.maxSize, r['data-max-size'], r['data-max-size-pct']);
|
|
184
|
+
const basis = clampBasis(normalizeSize(local.defaultSize), minB, maxB);
|
|
117
185
|
const base: Record<string, string> = basis !== undefined
|
|
118
186
|
? { 'flex-basis': basis, 'flex-grow': '0', 'flex-shrink': '0' }
|
|
119
187
|
: { flex: '1 1 0%' };
|
package/src/ui/scroll-area.tsx
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { type JSX, splitProps } from 'solid-js';
|
|
2
2
|
import { cn } from '../utils/cn';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export type ScrollOrientation = 'vertical' | 'horizontal' | 'both';
|
|
5
|
+
|
|
6
|
+
export interface ScrollAreaProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
children: JSX.Element;
|
|
8
|
+
/** Which axis scrolls. `vertical` (default) · `horizontal` · `both`. The cross
|
|
9
|
+
* axis is clamped to `hidden` so content can't overflow it. */
|
|
10
|
+
orientation?: ScrollOrientation;
|
|
11
|
+
}
|
|
5
12
|
|
|
6
13
|
export function ScrollArea(props: ScrollAreaProps) {
|
|
7
|
-
const [local, rest] = splitProps(props, ['children', 'class']);
|
|
14
|
+
const [local, rest] = splitProps(props, ['children', 'class', 'orientation']);
|
|
15
|
+
const overflow = () =>
|
|
16
|
+
local.orientation === 'horizontal' ? 'overflow-x-auto overflow-y-hidden'
|
|
17
|
+
: local.orientation === 'both' ? 'overflow-auto'
|
|
18
|
+
: 'overflow-y-auto overflow-x-hidden';
|
|
8
19
|
return (
|
|
9
20
|
// tabindex=0 keeps the scroll region reachable by keyboard when it has no
|
|
10
21
|
// focusable descendants (WCAG 2.1.1 — axe `scrollable-region-focusable`).
|
|
11
|
-
<div tabindex={0} class={cn(
|
|
22
|
+
<div tabindex={0} class={cn(overflow(), 'scrollbar-thin', local.class)} {...rest}>
|
|
12
23
|
{local.children}
|
|
13
24
|
</div>
|
|
14
25
|
);
|