@kitn.ai/ui 0.20.1 → 0.22.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 +44 -45
- package/dist/components/artifact-card.d.ts +51 -0
- package/dist/components/artifact.d.ts +1 -1
- package/dist/components/attachments.d.ts +2 -2
- package/dist/components/audio-visualizer/index.d.ts +3 -3
- package/dist/components/audio-visualizer/labs/lab-choreography.d.ts +59 -0
- package/dist/components/audio-visualizer/labs/lab-shaders.d.ts +22 -0
- package/dist/components/audio-visualizer/labs/lab-visualizer.d.ts +18 -0
- package/dist/components/audio-visualizer/variant-aurora.d.ts +2 -2
- package/dist/components/audio-visualizer/variant-bar.d.ts +2 -2
- package/dist/components/audio-visualizer/variant-custom.d.ts +2 -2
- package/dist/components/audio-visualizer/variant-grid.d.ts +1 -1
- package/dist/components/audio-visualizer/variant-radial.d.ts +1 -1
- package/dist/components/audio-visualizer/variant-wave.d.ts +1 -1
- package/dist/components/card-fallback.d.ts +12 -2
- package/dist/components/card-renderer.d.ts +63 -2
- package/dist/components/chat-container.d.ts +3 -0
- package/dist/components/chat-scope-picker.d.ts +2 -2
- package/dist/components/chat-thread.d.ts +77 -18
- package/dist/components/choice-card.d.ts +3 -28
- package/dist/components/composer-dom.d.ts +1 -1
- package/dist/components/composer-highlight.d.ts +1 -1
- package/dist/components/composer-history.d.ts +1 -1
- package/dist/components/composer.d.ts +1 -1
- package/dist/components/confirm-card.d.ts +3 -18
- package/dist/components/context.d.ts +8 -4
- package/dist/components/conversation-item.d.ts +1 -1
- package/dist/components/conversation-list.d.ts +4 -3
- package/dist/components/embed.d.ts +3 -3
- package/dist/components/file-tree.d.ts +11 -22
- package/dist/components/form-widgets.d.ts +1 -1
- package/dist/components/form.d.ts +3 -44
- package/dist/components/link-preview.d.ts +3 -3
- package/dist/components/loader.d.ts +30 -48
- package/dist/components/message-skills.d.ts +4 -0
- package/dist/components/message.d.ts +84 -21
- package/dist/components/model-switcher.d.ts +2 -2
- package/dist/components/prompt-input.d.ts +2 -2
- package/dist/components/response-compare-types.d.ts +11 -2
- package/dist/components/response-compare.d.ts +3 -3
- package/dist/components/source.d.ts +12 -3
- package/dist/components/tasks-card.d.ts +3 -31
- package/dist/components/thread.d.ts +17 -5
- package/dist/components/toast.d.ts +2 -2
- package/dist/components/tool-classify.d.ts +8 -0
- package/dist/components/tool-types.d.ts +29 -1
- package/dist/components/tool.d.ts +3 -3
- package/dist/components/use-card-resolution.d.ts +1 -1
- package/dist/create-tween-COnPwAQN.js +338 -0
- package/dist/create-tween-DmTUaXWE.js +341 -0
- package/dist/create-tween-qs-jjvNA.js +7 -0
- package/dist/custom-elements.json +1726 -463
- package/dist/elements/agent-card.js +1 -1
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/attachments.js +1 -1
- package/dist/elements/audio-visualizer.js +1 -1
- package/dist/elements/avatar.js +1 -1
- package/dist/elements/badge.js +1 -1
- package/dist/elements/button.js +1 -1
- package/dist/elements/card.js +1 -1
- package/dist/elements/cards.js +1 -1
- package/dist/elements/chain-of-thought.js +1 -1
- package/dist/elements/chat-scope-picker.js +1 -1
- package/dist/elements/chat-types.d.ts +70 -10
- 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-Tj58ES_d.js → Icon-CHG5z5L7.js} +1 -1
- package/dist/elements/chunks/{action-icons-ns1Fnedj.js → action-icons-BAtCEEgg.js} +1 -1
- package/dist/elements/chunks/arrow-left-CFPTeL1Y.js +1 -0
- package/dist/elements/chunks/artifact-fBZOE4SO.js +1 -0
- package/dist/elements/chunks/{attachments-mCB5F1Fq.js → attachments-DpYMe5VQ.js} +1 -1
- package/dist/elements/chunks/audio-visualizer-DFwzAcuL.js +1 -0
- package/dist/elements/chunks/{badge-B4Zuajl2.js → badge-D6zodm6E.js} +1 -1
- package/dist/elements/chunks/{button-ZWNif3--.js → button-C42vrGvO.js} +1 -1
- package/dist/elements/chunks/card-renderer-DMZsSuvU.js +1 -0
- package/dist/elements/chunks/card-tags-D8lZ-C_U.js +1 -0
- package/dist/elements/chunks/chat-thread-CNNEhol-.js +1 -0
- package/dist/elements/chunks/check-7Q3K-iXE.js +1 -0
- package/dist/elements/chunks/chevron-down-CpNYLn7E.js +1 -0
- package/dist/elements/chunks/chevron-right-DrH85Fha.js +1 -0
- package/dist/elements/chunks/choice-card-YoWjpsFV.js +1 -0
- package/dist/elements/chunks/circle-C9KRjKYv.js +1 -0
- package/dist/elements/chunks/circle-check-Dmi7Y4zw.js +1 -0
- package/dist/elements/chunks/{circle-x-B7faJFlY.js → circle-x-QIxXda6k.js} +1 -1
- package/dist/elements/chunks/code-block-CqeugReY.js +1 -0
- package/dist/elements/chunks/{collapsible-DM1Ckd4e.js → collapsible-sTv-_5lF.js} +1 -1
- package/dist/elements/chunks/{composer-BguS0QL_.js → composer-ldQyeVEB.js} +2 -2
- package/dist/elements/chunks/confirm-card-C0RNOwfn.js +1 -0
- package/dist/elements/chunks/context-5qgypNHC.js +1 -0
- package/dist/elements/chunks/conversation-list-DLzOacXz.js +1 -0
- package/dist/elements/chunks/create-tween-V4TXZ93X.js +7 -0
- package/dist/elements/chunks/default-input-DeeRSDHc.js +1 -0
- package/dist/elements/chunks/define-lE-QvQFn.js +1 -0
- package/dist/elements/chunks/{disclosure-CIZ5c8nO.js → disclosure-DZSa9jog.js} +1 -1
- package/dist/elements/chunks/{download-Dsbg3ste.js → download-B2ZmnGqW.js} +1 -1
- package/dist/elements/chunks/{dropdown-BDd1-Zgi.js → dropdown-R3B7cSRE.js} +1 -1
- package/dist/elements/chunks/{ellipsis-Dw6qrss-.js → ellipsis-BmxceY4l.js} +1 -1
- package/dist/elements/chunks/embed-BVrtTZPo.js +1 -0
- package/dist/elements/chunks/{external-link-Vt74zAoL.js → external-link-BbdR7YO7.js} +1 -1
- package/dist/elements/chunks/{file-text-CZrZF6_v.js → file-text-D7dijo1A.js} +1 -1
- package/dist/elements/chunks/{file-tree-DF4okKyo.js → file-tree-0upJ5jeb.js} +1 -1
- package/dist/elements/chunks/{folder-glP5rha4.js → folder-D8z58t7B.js} +1 -1
- package/dist/elements/chunks/form-p5BKJNw5.js +1 -0
- package/dist/elements/chunks/hover-card-CN9s2md5.js +1 -0
- package/dist/elements/chunks/{icon-BLb8beoi.js → icon-CNiKP37E.js} +1 -1
- package/dist/elements/chunks/{info-CIsv92JK.js → info-BSnuJiHI.js} +1 -1
- package/dist/elements/chunks/{input-Dds1kFyt.js → input-BauDmzxX.js} +1 -1
- package/dist/elements/chunks/{kbd-De_xbgi9.js → kbd-BlHJaP9b.js} +1 -1
- package/dist/elements/chunks/{link-i4r_k7z4.js → link-DEi5iUWC.js} +1 -1
- package/dist/elements/chunks/link-preview-BaHyM6W4.js +1 -0
- package/dist/elements/chunks/{loader-BmQH4s3V.js → loader-CmJG_Fkq.js} +1 -1
- package/dist/elements/chunks/{markdown-Zi21WhUz.js → markdown-D2jaMpCN.js} +1 -1
- package/dist/elements/chunks/message-C5UfXZ2Z.js +1 -0
- package/dist/elements/chunks/message-CXWLmmLn.js +1 -0
- package/dist/elements/chunks/message-square-hXylwsy0.js +1 -0
- package/dist/elements/chunks/{minimize-2--ifeCGrl.js → minimize-2-C9ytZFMU.js} +1 -1
- package/dist/elements/chunks/model-switcher-CivGfD7-.js +1 -0
- package/dist/elements/chunks/{overlay-kD8dwRv_.js → overlay-DJL_sbOm.js} +1 -1
- package/dist/elements/chunks/{paperclip-q21dYOSK.js → paperclip-CFaB8naM.js} +1 -1
- package/dist/elements/chunks/{progress-bar-BrAIIaaJ.js → progress-bar-Br5SksfR.js} +1 -1
- package/dist/elements/chunks/{prompt-suggestion-Bjn2K-fR.js → prompt-suggestion-CMIvtAhU.js} +1 -1
- package/dist/elements/chunks/reasoning-DpZcNzLq.js +1 -0
- package/dist/elements/chunks/{resizable-Dp4JExql.js → resizable-Q8i3T9a_.js} +1 -1
- package/dist/elements/chunks/{rotate-cw-CFWWkpj2.js → rotate-cw-B5IHCBFV.js} +1 -1
- package/dist/elements/chunks/{scroll-area-Bb0kHH1j.js → scroll-area-eLeydBje.js} +1 -1
- package/dist/elements/chunks/scroll-button-DWbz0yA1.js +1 -0
- package/dist/elements/chunks/{separator-9kRgr1X9.js → separator-Xic78AD_.js} +1 -1
- package/dist/elements/chunks/{settings-B8lmec4D.js → settings-B8H51pAx.js} +1 -1
- package/dist/elements/chunks/{settings-group-I0hEuXiN.js → settings-group-CsG9eYLe.js} +1 -1
- package/dist/elements/chunks/{share-C3lTiYGt.js → share-CNTx0z__.js} +1 -1
- package/dist/elements/chunks/skeleton-CLlHTcMI.js +1 -0
- package/dist/elements/chunks/slots-CIw9RlAe.js +1 -0
- package/dist/elements/chunks/source-BoVcU5ok.js +1 -0
- package/dist/elements/chunks/{star-CSJtGxgv.js → star-CxQVTVhI.js} +1 -1
- package/dist/elements/chunks/{store-CHyW95TP.js → store-CLtS5CUG.js} +1 -1
- package/dist/elements/chunks/tasks-card-CzlkLmUt.js +1 -0
- package/dist/elements/chunks/{text-shimmer-Cn9TmNpI.js → text-shimmer-D5NhpIQ1.js} +1 -1
- package/dist/elements/chunks/textarea-x5Uxsmtm.js +1 -0
- package/dist/elements/chunks/{thumbs-up-PNVVThEF.js → thumbs-up-UobcJnx9.js} +1 -1
- package/dist/elements/chunks/{toast-store-DKbQn3Wn.js → toast-store-BOfs9eXq.js} +1 -1
- package/dist/elements/chunks/{tool-DjTRpIpl.js → tool-Be6Dh_dt.js} +1 -1
- package/dist/elements/chunks/tooltip-RxMxyCLF.js +1 -0
- package/dist/elements/chunks/{triangle-alert-DsHTHCPm.js → triangle-alert-C4yxH2XN.js} +1 -1
- package/dist/elements/chunks/use-card-resolution-jva9ehH6.js +1 -0
- package/dist/elements/chunks/{variant-aurora-Dc4nQUia.js → variant-aurora-Dx4VRcjS.js} +2 -2
- package/dist/elements/chunks/{variant-custom-y_3kVQhS.js → variant-custom-Y1ZTWgEa.js} +1 -1
- package/dist/elements/chunks/{variant-wave-D5OR1-9Z.js → variant-wave-B9gml9Cg.js} +2 -2
- package/dist/elements/chunks/{video-B7vmenoC.js → video-CrPHsytT.js} +1 -1
- package/dist/elements/chunks/x-_-OPHept.js +1 -0
- package/dist/elements/coachmark.js +1 -1
- package/dist/elements/code-block.js +1 -1
- package/dist/elements/command.js +1 -1
- package/dist/elements/compare.js +1 -1
- package/dist/elements/composer.js +1 -1
- package/dist/elements/confirm-card.js +1 -1
- package/dist/elements/context-meter.js +1 -1
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/default-input.d.ts +34 -7
- package/dist/elements/define.d.ts +1 -0
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/disclosure.d.ts +1 -1
- package/dist/elements/editable-label.js +1 -1
- package/dist/elements/element-data-types.d.ts +107 -0
- package/dist/elements/embed.js +1 -1
- package/dist/elements/empty.js +1 -1
- package/dist/elements/feedback-bar.js +1 -1
- package/dist/elements/file-tree.js +1 -1
- package/dist/elements/file-upload.js +1 -1
- package/dist/elements/form.js +1 -1
- package/dist/elements/hover-card.js +1 -1
- package/dist/elements/icon.js +1 -1
- package/dist/elements/image.js +1 -1
- package/dist/elements/input.js +1 -1
- package/dist/elements/kbd.js +1 -1
- package/dist/elements/link-preview.js +1 -1
- package/dist/elements/loader.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/menu.js +1 -1
- package/dist/elements/message-skills.js +1 -1
- package/dist/elements/message.js +1 -1
- package/dist/elements/model-switcher.js +1 -1
- package/dist/elements/nav.js +1 -1
- package/dist/elements/notice.js +1 -1
- package/dist/elements/pane-group.js +1 -1
- package/dist/elements/pane.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/progress-bar.js +1 -1
- package/dist/elements/prompt-dock.js +1 -1
- package/dist/elements/prompt-input.js +1 -1
- package/dist/elements/prompt-suggestions.js +1 -1
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/register.d.ts +8 -6
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +1 -1
- package/dist/elements/screen.js +1 -1
- package/dist/elements/scroll-area.js +1 -1
- package/dist/elements/scroll-button.js +1 -1
- package/dist/elements/search.js +1 -1
- package/dist/elements/segmented.js +1 -1
- package/dist/elements/separator.js +1 -1
- package/dist/elements/setting-item.js +1 -1
- package/dist/elements/settings-group.js +1 -1
- package/dist/elements/skeleton.js +1 -1
- package/dist/elements/slot-text.d.ts +51 -0
- package/dist/elements/slots.d.ts +21 -0
- package/dist/elements/source.js +1 -1
- package/dist/elements/status.js +1 -1
- package/dist/elements/switch.js +1 -1
- package/dist/elements/tabs.js +1 -1
- package/dist/elements/tasks.js +1 -1
- package/dist/elements/text-shimmer.js +1 -1
- package/dist/elements/thinking-bar.js +1 -1
- package/dist/elements/thread.js +1 -1
- package/dist/elements/toast.js +1 -1
- package/dist/elements/tool.js +1 -1
- package/dist/elements/tooltip.js +1 -1
- package/dist/elements/validate-messages.d.ts +25 -0
- package/dist/elements/voice-input.js +1 -1
- package/dist/elements/voice-output.js +1 -1
- package/dist/elements.d.ts +2734 -217
- package/dist/index.d.ts +163 -125
- package/dist/index.js +6572 -5990
- package/dist/index.server.d.ts +5 -0
- package/dist/index.server.js +5403 -4860
- package/dist/kai-provider.es.d.ts +5 -0
- package/dist/kai-provider.es.js +79 -77
- package/dist/kai.es.d.ts +5 -0
- package/dist/kai.es.js +1 -1
- package/dist/llms/llms-full.txt +774 -151
- package/dist/llms/llms.txt +57 -5
- package/dist/mcp.es.js +4756 -782
- package/dist/primitives/card-component-types.d.ts +11 -0
- package/dist/primitives/card-data-types.d.ts +196 -0
- package/dist/primitives/card-host.d.ts +1 -1
- package/dist/primitives/card-recovery.d.ts +3 -3
- package/dist/primitives/card-registry.d.ts +4 -14
- package/dist/primitives/card-resolution.d.ts +1 -1
- package/dist/primitives/card-routing.d.ts +1 -1
- package/dist/primitives/card-tags.d.ts +11 -0
- package/dist/primitives/card-validate-cards.d.ts +57 -0
- package/dist/primitives/card-validate-generator.testlib.d.ts +20 -0
- package/dist/primitives/card-validate-schemas.d.ts +17 -0
- package/dist/primitives/card-validate.d.ts +24 -0
- package/dist/primitives/create-kai-chat.d.ts +3 -3
- package/dist/primitives/embed-providers.d.ts +1 -1
- package/dist/primitives/link-preview.d.ts +1 -1
- package/dist/primitives/message-feedback.d.ts +2 -2
- package/dist/primitives/toast-store.d.ts +1 -1
- package/dist/react/index.d.ts +730 -302
- package/dist/react/use-kai-chat.d.ts +8 -4
- package/dist/react.d.ts +5 -0
- package/dist/react.js +418 -317
- package/dist/register-impl-AxIlqjo7.js +145 -0
- package/dist/remote/host-embed.d.ts +1 -1
- package/dist/remote/index.d.ts +2 -2
- package/dist/remote/provider-runtime.d.ts +2 -2
- package/dist/remote/provider.d.ts +2 -2
- package/dist/remote/validate.d.ts +1 -1
- package/dist/remote/wire.d.ts +1 -1
- package/dist/schemas/artifact.schema.json +92 -0
- package/dist/schemas/embed.schema.json +0 -2
- package/dist/schemas/from-tool-call.d.ts +48 -0
- package/dist/schemas/index.d.ts +48 -0
- package/dist/schemas/link.schema.json +0 -2
- package/dist/schemas/provider-subsets.d.ts +136 -0
- package/dist/schemas/registry.d.ts +140 -0
- package/dist/schemas/tool-defs.d.ts +121 -0
- package/dist/schemas.d.ts +5 -0
- package/dist/schemas.js +717 -0
- package/dist/solid-BGYSJyHG.js +22960 -0
- package/dist/solid-Dt2nEwfl.js +20194 -0
- package/dist/solid.d.ts +66 -0
- package/dist/solid.js +261 -0
- package/dist/solid.server.d.ts +5 -0
- package/dist/solid.server.js +261 -0
- package/dist/state/index.d.ts +14 -4
- package/dist/state/messages.d.ts +8 -3
- package/dist/state/mock.d.ts +46 -0
- package/dist/state/parts.d.ts +85 -0
- package/dist/state/stream.d.ts +15 -9
- package/dist/state.d.ts +5 -0
- package/dist/state.js +253 -84
- package/dist/ui/action-icons.d.ts +1 -1
- package/dist/ui/collapsible.d.ts +11 -6
- package/dist/ui/dropdown.d.ts +47 -42
- package/dist/ui/pane-group.d.ts +1 -1
- package/dist/{variant-aurora-DVtGqVH6.js → variant-aurora-B44X69AG.js} +1 -1
- package/dist/variant-aurora-BRhV8Flk.js +391 -0
- package/dist/variant-aurora-Ds5ou9BH.js +381 -0
- package/dist/variant-custom-B20FhtYj.js +170 -0
- package/dist/{variant-custom-Dif-IV4u.js → variant-custom-BvA1Schl.js} +1 -1
- package/dist/variant-custom-D6Rtvneb.js +200 -0
- package/dist/{variant-wave-DbfNdvSi.js → variant-wave-BUQtkryq.js} +1 -1
- package/dist/variant-wave-BVYnqy9L.js +218 -0
- package/dist/variant-wave-DXC6_LcH.js +208 -0
- package/dist/wire/chunk.d.ts +171 -0
- package/dist/wire/consume.d.ts +26 -0
- package/dist/wire/encode.d.ts +221 -0
- package/dist/wire/files.d.ts +116 -0
- package/dist/wire/formats/anthropic.d.ts +2 -0
- package/dist/wire/formats/openai.d.ts +5 -0
- package/dist/wire/index.d.ts +16 -0
- package/dist/wire/media-types.d.ts +106 -0
- package/dist/wire/read.d.ts +26 -0
- package/dist/wire/sink-helpers.d.ts +21 -0
- package/dist/wire/sse.d.ts +33 -0
- package/dist/wire.d.ts +5 -53
- package/dist/wire.js +1126 -0
- package/frameworks/react/index.tsx +191 -158
- package/frameworks/react/runtime.tsx +21 -1
- package/frameworks/react/use-kai-chat.tsx +11 -1
- package/llms-full.txt +774 -151
- package/llms.txt +57 -5
- package/package.json +62 -8
- package/src/agent-tooling/archetypes.ts +127 -0
- package/src/agent-tooling/integrations/anthropic.ts +436 -0
- package/src/agent-tooling/integrations/cloudflare.ts +141 -52
- package/src/agent-tooling/integrations/langgraph.ts +80 -13
- package/src/agent-tooling/integrations/mastra.ts +161 -12
- package/src/agent-tooling/integrations/mock.ts +47 -8
- package/src/agent-tooling/integrations/ollama.ts +68 -24
- package/src/agent-tooling/integrations/openai.ts +89 -0
- package/src/agent-tooling/integrations/openrouter.ts +58 -8
- package/src/agent-tooling/integrations/pi.ts +104 -23
- package/src/agent-tooling/integrations/pydantic-ai.ts +61 -5
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +120 -13
- package/src/agent-tooling/mcp/manifest.ts +206 -25
- package/src/agent-tooling/mcp/tools/debug.ts +13 -7
- package/src/agent-tooling/mcp/tools/reference.ts +285 -6
- package/src/agent-tooling/mcp/tools/scaffold.ts +4152 -661
- package/src/agent-tooling/registry.ts +74 -0
- package/src/agent-tooling/types.ts +361 -1
- package/src/components/artifact-card.tsx +120 -0
- package/src/components/audio-visualizer/index.tsx +9 -0
- package/src/components/audio-visualizer/labs/lab-choreography.ts +187 -0
- package/src/components/audio-visualizer/labs/lab-shaders.ts +363 -0
- package/src/components/audio-visualizer/labs/lab-visualizer.tsx +102 -0
- package/src/components/audio-visualizer/shader-canvas.tsx +31 -1
- package/src/components/card-fallback.tsx +42 -10
- package/src/components/card-renderer.tsx +146 -9
- package/src/components/chat-container.tsx +4 -0
- package/src/components/chat-thread.tsx +128 -52
- package/src/components/choice-card.tsx +17 -29
- package/src/components/composer.tsx +12 -2
- package/src/components/confirm-card.tsx +24 -20
- package/src/components/context.tsx +30 -16
- package/src/components/conversation-item.tsx +6 -0
- package/src/components/conversation-list.tsx +18 -2
- package/src/components/file-tree.tsx +11 -22
- package/src/components/file-upload.tsx +14 -8
- package/src/components/form.tsx +14 -47
- package/src/components/loader.tsx +39 -12
- package/src/components/message-skills.tsx +4 -0
- package/src/components/message.tsx +294 -46
- package/src/components/model-switcher.tsx +38 -8
- package/src/components/reasoning.tsx +92 -5
- package/src/components/response-compare-types.ts +25 -0
- package/src/components/response-compare.tsx +4 -9
- package/src/components/source.tsx +50 -24
- package/src/components/tasks-card.tsx +10 -33
- package/src/components/thread.tsx +84 -42
- package/src/components/toast.tsx +17 -6
- package/src/components/tool-classify.ts +26 -0
- package/src/components/tool-types.ts +31 -1
- package/src/elements/agent-card.tsx +11 -11
- package/src/elements/artifact.tsx +15 -7
- package/src/elements/attachments.tsx +6 -4
- package/src/elements/avatar.tsx +1 -1
- package/src/elements/button.tsx +29 -6
- package/src/elements/card.tsx +2 -2
- package/src/elements/cards.tsx +109 -14
- package/src/elements/chain-of-thought.tsx +14 -10
- package/src/elements/chat-scope-picker.tsx +9 -7
- package/src/elements/chat-types.ts +59 -6
- package/src/elements/chat-workspace.tsx +50 -9
- package/src/elements/chat.tsx +90 -3
- package/src/elements/choice.tsx +8 -8
- package/src/elements/coachmark.tsx +1 -1
- package/src/elements/command.tsx +8 -23
- package/src/elements/compare.tsx +7 -6
- package/src/elements/compiled.css +1 -1
- package/src/elements/composer.tsx +8 -8
- package/src/elements/confirm-card.tsx +9 -9
- package/src/elements/context-meter.tsx +4 -18
- package/src/elements/conversation-list.tsx +14 -9
- package/src/elements/default-input.tsx +131 -8
- package/src/elements/define.tsx +178 -43
- package/src/elements/editable-label.tsx +17 -2
- package/src/elements/element-data-types.ts +112 -0
- package/src/elements/element-meta.json +1624 -306
- package/src/elements/element-types.d.ts +2645 -214
- package/src/elements/feedback-bar.tsx +1 -1
- package/src/elements/file-tree.tsx +1 -1
- package/src/elements/file-upload.tsx +1 -1
- package/src/elements/form.tsx +14 -6
- package/src/elements/input.tsx +1 -1
- package/src/elements/kbd.tsx +1 -1
- package/src/elements/menu.tsx +40 -32
- package/src/elements/message-skills.tsx +7 -9
- package/src/elements/message.tsx +200 -32
- package/src/elements/model-switcher.tsx +5 -3
- package/src/elements/pane.tsx +1 -1
- package/src/elements/prompt-dock.tsx +8 -8
- package/src/elements/prompt-input.tsx +10 -10
- package/src/elements/prompt-suggestions.tsx +7 -4
- package/src/elements/reasoning.tsx +1 -1
- package/src/elements/register.ts +9 -0
- package/src/elements/resizable.globals.d.ts +36 -0
- package/src/elements/resizable.tsx +24 -13
- package/src/elements/response-stream.tsx +1 -1
- package/src/elements/scroll-button.tsx +1 -1
- package/src/elements/search.tsx +6 -1
- package/src/elements/segmented.tsx +5 -11
- package/src/elements/separator.tsx +1 -1
- package/src/elements/slot-text.ts +73 -0
- package/src/elements/slots.ts +67 -24
- package/src/elements/source.tsx +21 -22
- package/src/elements/switch.tsx +3 -3
- package/src/elements/tasks.tsx +5 -4
- package/src/elements/thread.tsx +36 -4
- package/src/elements/toast.tsx +3 -2
- package/src/elements/tool.tsx +1 -1
- package/src/elements/validate-messages.ts +76 -0
- package/src/elements/voice-input.tsx +7 -7
- package/src/elements/voice-output.tsx +4 -4
- package/src/index.ts +145 -6
- package/src/primitives/card-component-types.ts +63 -0
- package/src/primitives/card-data-types.ts +312 -0
- package/src/primitives/card-recovery.ts +13 -2
- package/src/primitives/card-registry.tsx +34 -23
- package/src/primitives/card-schemas/artifact.schema.json +92 -0
- package/src/primitives/card-schemas/embed.schema.json +0 -2
- package/src/primitives/card-schemas/link.schema.json +0 -2
- package/src/primitives/card-tags.ts +61 -0
- package/src/primitives/card-validate-cards.ts +255 -0
- package/src/primitives/card-validate-generator.testlib.ts +38 -0
- package/src/primitives/card-validate-schemas.ts +58 -0
- package/src/primitives/card-validate.ts +48 -20
- package/src/primitives/create-tween.ts +54 -2
- package/src/primitives/message-feedback.ts +3 -2
- package/src/primitives/use-audio-analysis.ts +20 -1
- package/src/primitives/use-sequencer.ts +20 -1
- package/src/schemas/from-tool-call.ts +151 -0
- package/src/schemas/index.ts +340 -0
- package/src/schemas/provider-subsets.ts +538 -0
- package/src/schemas/registry.ts +355 -0
- package/src/schemas/tool-defs.ts +492 -0
- package/src/solid.ts +150 -0
- package/src/state/index.ts +27 -1
- package/src/state/messages.ts +21 -4
- package/src/state/mock.ts +211 -0
- package/src/state/parts.ts +295 -0
- package/src/state/stream.ts +56 -58
- package/src/ui/collapsible.tsx +17 -5
- package/src/ui/dropdown.tsx +46 -12
- package/src/ui/overlay.tsx +10 -4
- package/src/wire/chunk.ts +201 -0
- package/src/wire/consume.ts +440 -0
- package/src/wire/encode.ts +689 -0
- package/src/wire/files.ts +342 -0
- package/src/wire/formats/anthropic.ts +267 -0
- package/src/wire/formats/openai.ts +187 -0
- package/src/wire/index.ts +73 -0
- package/src/wire/media-types.ts +344 -0
- package/src/wire/read.ts +152 -0
- package/src/wire/sink-helpers.ts +50 -0
- package/src/wire/sse.ts +140 -0
- package/dist/create-tween-hvpmSuwW.js +0 -7
- package/dist/elements/chunks/arrow-left-DQocUFvy.js +0 -1
- package/dist/elements/chunks/audio-visualizer-BqNy7dfm.js +0 -1
- package/dist/elements/chunks/card-BkHbp4BA.js +0 -1
- package/dist/elements/chunks/chat-thread-CkRN6pZ7.js +0 -1
- package/dist/elements/chunks/check-B9-gn6SS.js +0 -1
- package/dist/elements/chunks/chevron-down-BNsxc2hk.js +0 -1
- package/dist/elements/chunks/chevron-right-Hv00StBO.js +0 -1
- package/dist/elements/chunks/circle-0e3KJTDr.js +0 -1
- package/dist/elements/chunks/circle-check-BNAS0JEy.js +0 -1
- package/dist/elements/chunks/code-block-BFUHn6Va.js +0 -1
- package/dist/elements/chunks/context-Cb7k4F-v.js +0 -1
- package/dist/elements/chunks/conversation-list-CvoAkWhN.js +0 -1
- package/dist/elements/chunks/create-tween-oVvAIG8r.js +0 -7
- package/dist/elements/chunks/default-input-Cqqilg9t.js +0 -1
- package/dist/elements/chunks/define-D1din7Ld.js +0 -1
- package/dist/elements/chunks/hover-card-Cmm6Q53m.js +0 -1
- package/dist/elements/chunks/message-BqyXDN3-.js +0 -1
- package/dist/elements/chunks/message-feedback-Djr3z6Yb.js +0 -1
- package/dist/elements/chunks/message-square-vFAgbDaX.js +0 -1
- package/dist/elements/chunks/model-switcher-B94YAKsM.js +0 -1
- package/dist/elements/chunks/reasoning-DTpCGtnY.js +0 -1
- package/dist/elements/chunks/scroll-button-B0cH5fXf.js +0 -1
- package/dist/elements/chunks/skeleton-DSXW5Yya.js +0 -1
- package/dist/elements/chunks/slots--V19HwUb.js +0 -1
- package/dist/elements/chunks/textarea-CUwqAX0G.js +0 -1
- package/dist/elements/chunks/tooltip-CgBZCVKp.js +0 -1
- package/dist/elements/chunks/use-card-resolution-BSu_XHjH.js +0 -1
- package/dist/elements/chunks/x-GRUeeQFT.js +0 -1
- package/dist/host-embed.d.ts +0 -33
- package/dist/kai-provider.d.ts +0 -2
- package/dist/origin.d.ts +0 -5
- package/dist/provider-runtime.d.ts +0 -27
- package/dist/register-impl-DQyejdfb.js +0 -145
- package/dist/validate.d.ts +0 -4
- package/dist/version.d.ts +0 -4
- package/src/components/component-meta.json +0 -4550
- package/src/elements/card-media.jpg +0 -0
- package/src/elements/resizable.d.ts +0 -27
- package/src/elements/video-poster.jpg +0 -0
package/dist/elements/nav.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as
|
|
1
|
+
import{s as V,g as j,q as D,m as F,i as l,c as s,t as v,S as m,a as k,b as x,j as E,d as I,p as L,F as G,e as H,f as J}from"./chunks/define-lE-QvQFn.js";import{c as f}from"./chunks/cn-CU7UAWzk.js";import{r as C}from"./chunks/icon-CNiKP37E.js";import{B as K}from"./chunks/badge-D6zodm6E.js";import{c as M}from"./chunks/chevron-right-DrH85Fha.js";var N=v("<nav>"),O=v("<span part=chevron aria-hidden=true>"),P=v("<span>"),Q=v('<span class="text-xs text-muted-foreground">'),T=v('<span part=status class="flex shrink-0 items-center gap-1.5"aria-hidden=true><span class="relative inline-flex"><span>'),U=v('<span part=meta class="shrink-0 text-xs tabular-nums text-muted-foreground"aria-hidden=true>'),W=v("<button part=item-action data-nav-action=action type=button>"),X=v("<button part=item-action data-nav-action=close type=button>"),Y=v('<div><button part=item type=button><span class="min-w-0 flex-1 truncate">'),Z=v("<div part=group role=group>"),_=v('<span class="size-4 shrink-0"aria-hidden=true>');const R={primary:"bg-primary",info:"bg-tool-blue",success:"bg-tool-green",warning:"bg-tool-amber",error:"bg-tool-red",neutral:"bg-muted-foreground"};function ee(r){const[d,e]=V(r,["items","value","onItemSelect","onItemAction","onItemClose","defaultCollapsed","class"]),[c,p]=j(new Set(d.defaultCollapsed??[]),{equals:!1}),h=a=>!c().has(a),b=a=>p(w=>{const y=new Set(w);return y.has(a)?y.delete(a):y.add(a),y});return(()=>{var a=N();return D(a,F(e,{get class(){return f("flex flex-col gap-0.5",d.class)}}),!1,!0),l(a,s(q,{get items(){return d.items??[]},depth:0,get value(){return d.value},get onItemSelect(){return d.onItemSelect},get onItemAction(){return d.onItemAction},get onItemClose(){return d.onItemClose},isExpanded:h,toggle:b})),a})()}function q(r){const d=()=>r.items.some(e=>{var c;return(((c=e.children)==null?void 0:c.length)??0)>0});return s(G,{get each(){return r.items},children:e=>{const c=()=>{var n;return(((n=e.children)==null?void 0:n.length)??0)>0},p=()=>r.isExpanded(e.id),h=()=>r.value===e.id,b=()=>{var n;return((n=e.status)==null?void 0:n.tone)??"neutral"},a=()=>{var n,o;if(!(!((n=e.status)!=null&&n.label)&&!e.meta))return[e.label,(o=e.status)==null?void 0:o.label,e.meta].filter(Boolean).join(", ")},w=()=>{var n;e.disabled||(c()?r.toggle(e.id):(n=r.onItemSelect)==null||n.call(r,e.id))},y=n=>{!c()||e.disabled||(n.key==="ArrowRight"&&!p()||n.key==="ArrowLeft"&&p())&&(n.preventDefault(),r.toggle(e.id))};return[(()=>{var n=Y(),o=n.firstChild,S=o.firstChild;return o.$$keydown=y,o.$$click=w,l(o,s(m,{get when(){return c()},get fallback(){return E(()=>!!d())()?_():null},get children(){var t=O();return l(t,s(M,{size:16})),k(()=>x(t,f("flex shrink-0 items-center opacity-60 transition-transform",p()&&"rotate-90"))),t}}),S),l(o,s(m,{get when(){return e.icon},get children(){return C(e.icon,{class:"size-4 shrink-0"})}}),S),l(S,()=>e.label),l(o,s(m,{get when(){return e.status},get children(){var t=T(),i=t.firstChild,g=i.firstChild;return l(i,s(m,{get when(){return e.status.pulse},get children(){var u=P();return k(()=>x(u,f("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 motion-reduce:hidden",R[b()]))),u}}),g),l(t,s(m,{get when(){return e.status.label},get children(){var u=Q();return l(u,()=>e.status.label),u}}),null),k(()=>x(g,f("relative inline-block size-2 rounded-full",R[b()]))),t}}),null),l(o,s(m,{get when(){return e.meta},get children(){var t=U();return l(t,()=>e.meta),t}}),null),l(o,s(m,{get when(){return e.badge},get children(){return s(K,{variant:"default",class:"px-1.5 py-0 text-[0.625rem] font-medium uppercase tracking-wide",get children(){return e.badge}})}}),null),l(o,s(m,{get when(){return e.trailing},get children(){return C(e.trailing,{class:"size-4 shrink-0 opacity-0 transition-opacity group-hover:opacity-60"})}}),null),l(n,s(m,{get when(){return e.action},get children(){var t=W();return t.$$click=()=>{var i;return(i=r.onItemAction)==null?void 0:i.call(r,e.id,e.action)},l(t,()=>C(e.action.icon,{class:"size-4"})),k(i=>{var g=e.action.label,u=f("mr-1 flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground","opacity-0 transition-opacity hover:bg-background/70 hover:text-foreground","focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","group-hover:opacity-100");return g!==i.e&&I(t,"aria-label",i.e=g),u!==i.t&&x(t,i.t=u),i},{e:void 0,t:void 0}),t}}),null),l(n,s(m,{get when(){return e.closable},get children(){var t=X();return t.$$click=()=>{var i;return(i=r.onItemClose)==null?void 0:i.call(r,e.id)},l(t,()=>C("x",{class:"size-4"})),k(i=>{var g=e.label?`Remove ${e.label}`:"Remove",u=f("mr-1 flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground","opacity-0 transition-opacity hover:bg-background/70 hover:text-foreground","focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","group-hover:opacity-100");return g!==i.e&&I(t,"aria-label",i.e=g),u!==i.t&&x(t,i.t=u),i},{e:void 0,t:void 0}),t}}),null),k(t=>{var i=f("group relative flex items-center rounded-md transition-colors","hover:bg-accent",h()&&"bg-accent",e.disabled&&"pointer-events-none opacity-50"),g=e.disabled,u=h()?"page":void 0,$=c()?p():void 0,z=a(),B=r.depth>0?{"padding-left":`${10+r.depth*16}px`}:void 0,A=f("flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors","text-muted-foreground group-hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none",h()&&"font-medium text-foreground");return i!==t.e&&x(n,t.e=i),g!==t.t&&(o.disabled=t.t=g),u!==t.a&&I(o,"aria-current",t.a=u),$!==t.o&&I(o,"aria-expanded",t.o=$),z!==t.i&&I(o,"aria-label",t.i=z),t.n=L(o,B,t.n),A!==t.s&&x(o,t.s=A),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),n})(),s(m,{get when(){return E(()=>!!c())()&&p()},get children(){var n=Z();return l(n,s(q,{get items(){return e.children},get depth(){return r.depth+1},get value(){return r.value},get onItemSelect(){return r.onItemSelect},get onItemAction(){return r.onItemAction},get onItemClose(){return r.onItemClose},get isExpanded(){return r.isExpanded},get toggle(){return r.toggle}})),n}})]}})}H(["click","keydown"]),J("kai-nav",{items:void 0,value:void 0,defaultValue:void 0,defaultCollapsed:void 0},(r,{dispatch:d,expose:e})=>{const[c,p]=j(r.defaultValue),h=()=>r.value??c(),b=a=>{p(a),d("kai-nav-select",{id:a})};return e({select:a=>b(a)}),s(ee,{get items(){return r.items},get value(){return h()},get defaultCollapsed(){return r.defaultCollapsed},onItemSelect:b,onItemAction:(a,w)=>d("kai-nav-item-action",{value:a,action:w}),onItemClose:a=>d("kai-nav-item-close",{value:a}),part:"nav"})});
|
package/dist/elements/notice.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as i,m as p,g as b,i as o,S as c,a as k,d as w,b as $,t as l,e as S,f as z,
|
|
1
|
+
import{c as i,m as p,g as b,i as o,S as c,a as k,d as w,b as $,t as l,e as S,f as z,u}from"./chunks/define-lE-QvQFn.js";import{c as d}from"./chunks/cn-CU7UAWzk.js";import{r as D}from"./chunks/icon-CNiKP37E.js";import{c as _}from"./chunks/circle-check-Dmi7Y4zw.js";import{I as C}from"./chunks/Icon-CHG5z5L7.js";import{i as v}from"./chunks/info-BSnuJiHI.js";import{t as q}from"./chunks/triangle-alert-C4yxH2XN.js";import{x as A}from"./chunks/x-_-OPHept.js";var I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],N=r=>i(C,p(r,{name:"CircleAlert",iconNode:I})),j=N,E=l('<button type=button aria-label=Dismiss class="-my-1 -mr-1.5 shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground">'),O=l('<div><div class="flex-1 leading-snug text-muted-foreground">');const P={neutral:v,info:v,warning:q,error:j,success:_},h={neutral:"text-muted-foreground",info:"text-tool-blue",warning:"text-tool-amber",error:"text-tool-red",success:"text-tool-green"};function x(r,s){if(s==="none")return null;if(s)return D(s,{class:d("size-4 shrink-0",h[r])});const a=P[r];return i(a,{get class(){return d("size-4 shrink-0",h[r])},"aria-hidden":"true"})}function R(r){const[s,a]=b(!0),e=()=>r.severity??"neutral",y=()=>{var t;a(!1),(t=r.onDismiss)==null||t.call(r)};return i(c,{get when(){return s()},get children(){var t=O(),m=t.firstChild;return o(t,i(c,{get when(){return r.iconSlot},get fallback(){return x(e(),r.icon)},get children(){return r.iconSlot}}),m),o(m,()=>r.children),o(t,i(c,{get when(){return r.action},get children(){return r.action}}),null),o(t,i(c,{get when(){return r.dismissible},get children(){var n=E();return n.$$click=y,o(n,i(A,{class:"size-3.5","aria-hidden":"true"})),n}}),null),k(n=>{var g=e()==="error"?"alert":"status",f=d("flex items-center gap-2.5 rounded-lg bg-surface px-3.5 py-2.5 text-sm",r.class);return g!==n.e&&w(t,"role",n.e=g),f!==n.t&&$(t,n.t=f),n},{e:void 0,t:void 0}),t}})}S(["click"]);var T=l("<slot>"),V=l("<slot name=icon>"),W=l("<slot name=action>");z("kai-notice",{severity:"neutral",icon:void 0,dismissible:!1},(r,{dispatch:s,flag:a})=>i(R,{get severity(){return r.severity??"neutral"},get iconSlot(){return(()=>{var e=V();return e._$owner=u(),o(e,()=>x(r.severity??"neutral",r.icon)),e})()},get dismissible(){return a("dismissible")},onDismiss:()=>s("kai-dismiss"),get action(){return(()=>{var e=W();return e._$owner=u(),e})()},get children(){var e=T();return e._$owner=u(),e}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as l,c as d,F as I,a as p,b as h,t as y,
|
|
1
|
+
import{i as l,c as d,F as I,a as p,b as h,t as y,v as L,S as $,d as x,e as O,f as U,g as B,k as G,u as R}from"./chunks/define-lE-QvQFn.js";import{c as m}from"./chunks/cn-CU7UAWzk.js";import{e as J}from"./chunks/ellipsis-BmxceY4l.js";import{x as K}from"./chunks/x-_-OPHept.js";var _=y("<span>"),N=y("<button type=button part=menu aria-haspopup=menu>"),Q=y("<button type=button part=close>"),V=y('<div><button type=button part=tab class="flex cursor-pointer items-center gap-1.5 py-1 pl-1.5 outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"><span class="relative flex size-[18px] shrink-0"aria-hidden=true><span></span></span><span class="max-w-[8rem] truncate font-medium"></span></button><span class="ml-0.5 flex shrink-0 items-center pr-1">'),W=y('<div data-pane-group><div part=tabs role=group aria-label="Open panes"class="flex shrink-0 items-center gap-1 overflow-x-auto border-b border-border px-1.5 py-1"></div><div part=body role=tabpanel class="min-h-0 flex-1 overflow-y-auto">');const q={working:"bg-tool-blue",idle:"bg-muted-foreground",done:"bg-tool-green",error:"bg-tool-red",blocked:"bg-tool-amber"},X={working:"text-white",idle:"text-background",done:"text-white",error:"text-white",blocked:"text-white"},Y={working:"text-tool-blue",idle:"text-muted-foreground",done:"text-tool-green",error:"text-tool-red",blocked:"text-tool-amber"};function Z(a){const b=()=>a.tabs??[],k=()=>{var i;return a.active??((i=b()[0])==null?void 0:i.id)},T=()=>{var i;const r=k();return r!==void 0&&b().some(t=>t.id===r)?r:(i=b()[0])==null?void 0:i.id},C={},f=i=>{var r;return(r=a.onTabChange)==null?void 0:r.call(a,i)},A=(i,r)=>{var t;if(i.currentTarget!==i.target)return;const n=b();if(n.length===0)return;const w=n.findIndex(u=>u.id===r.id);let c;switch(i.key){case"ArrowRight":case"ArrowDown":c=n[(w+1)%n.length];break;case"ArrowLeft":case"ArrowUp":c=n[(w-1+n.length)%n.length];break;case"Home":c=n[0];break;case"End":c=n[n.length-1];break;case"Enter":case" ":i.preventDefault(),f(r.id);return;default:return}c&&(i.preventDefault(),f(c.id),(t=C[c.id])==null||t.focus())},z=i=>{const r=()=>i.tab,t=()=>{var u;return((u=r().status)==null?void 0:u.tone)??"idle"},n=()=>r().id===k(),w=()=>r().number??i.index+1,c=()=>n()||!!r().needsAttention||t()==="error";return(()=>{var u=V(),v=u.firstChild,S=v.firstChild,j=S.firstChild,H=S.nextSibling,D=v.nextSibling;return v.$$keydown=e=>A(e,r()),v.$$click=()=>f(r().id),L(e=>{C[r().id]=e},v),l(S,d($,{get when(){var e;return(e=r().status)==null?void 0:e.pulse},get children(){var e=_();return p(()=>h(e,m("absolute inset-0 animate-ping rounded opacity-60 motion-reduce:hidden",q[t()]))),e}}),j),l(j,w),l(H,()=>r().name),l(v,d($,{get when(){var e;return(e=r().status)==null?void 0:e.label},get children(){var e=_();return l(e,()=>r().status.label),p(()=>h(e,m("truncate text-[10px] font-medium",Y[t()],c()?"inline":"hidden group-hover/tab:inline"))),e}}),null),l(D,d($,{get when(){return a.onTabMenu},get children(){var e=N();return e.$$click=o=>{var s;o.stopPropagation(),(s=a.onTabMenu)==null||s.call(a,r().id)},l(e,d(J,{class:"size-3.5","aria-hidden":"true"})),p(o=>{var s=`${r().name} tab actions`,g=m("flex size-5 items-center justify-center rounded text-muted-foreground transition-colors","hover:bg-surface-sunken hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",n()?"opacity-100":"opacity-0 group-hover/tab:opacity-100");return s!==o.e&&x(e,"aria-label",o.e=s),g!==o.t&&h(e,o.t=g),o},{e:void 0,t:void 0}),e}}),null),l(D,d($,{get when(){return a.onTabClose},get children(){var e=Q();return e.$$click=o=>{var s;o.stopPropagation(),(s=a.onTabClose)==null||s.call(a,r().id)},l(e,d(K,{class:"size-3.5","aria-hidden":"true"})),p(o=>{var s=`Close ${r().name}`,g=m("flex size-5 items-center justify-center rounded text-muted-foreground transition-colors","hover:bg-surface-sunken hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",n()?"opacity-100":"opacity-0 group-hover/tab:opacity-100");return s!==o.e&&x(e,"aria-label",o.e=s),g!==o.t&&h(e,o.t=g),o},{e:void 0,t:void 0}),e}}),null),p(e=>{var o=m("group/tab relative flex shrink-0 items-center rounded-md text-xs",n()?"bg-background text-foreground shadow-sm ring-1 ring-border":"text-muted-foreground hover:bg-hover hover:text-foreground",r().needsAttention&&!n()&&"ring-1 ring-tool-amber/50"),s=n()?"":void 0,g=r().needsAttention?"":void 0,E=r().id===T()?0:-1,M=n()?"true":void 0,P=m("relative flex size-[18px] items-center justify-center rounded text-[11px] font-bold leading-none tabular-nums",q[t()],X[t()]);return o!==e.e&&h(u,e.e=o),s!==e.t&&x(u,"data-active",e.t=s),g!==e.a&&x(u,"data-needs-attention",e.a=g),E!==e.o&&x(v,"tabindex",e.o=E),M!==e.i&&x(v,"aria-current",e.i=M),P!==e.n&&h(j,e.n=P),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),u})()};return(()=>{var i=W(),r=i.firstChild,t=r.nextSibling;return l(r,d(I,{get each(){return b()},children:(n,w)=>d(z,{tab:n,get index(){return w()}})})),l(t,()=>a.children),p(()=>h(i,m("flex h-full min-h-0 flex-col overflow-hidden rounded-xl border bg-surface",a.focused?"border-ring ring-2 ring-inset ring-ring/35":"border-border",a.class))),i})()}O(["click","keydown"]);var F=y("<slot>");U("kai-pane-group",{tabs:void 0,active:void 0,focused:!1},(a,{element:b,dispatch:k,flag:T,expose:C})=>{const f=()=>a.tabs??[],[A,z]=B(a.active),i=()=>{var t;return a.active??A()??((t=f()[0])==null?void 0:t.id)},r=t=>{z(t),k("kai-tab-change",{id:t})};return G(()=>{const t=i();t!=null&&b.setAttribute("active",t)}),C({select:t=>{f().some(n=>n.id===t)&&r(t)},focus:()=>{var t,n;(n=(t=b.shadowRoot)==null?void 0:t.querySelector('[part="tab"][tabindex="0"]'))==null||n.focus()}}),d(Z,{get tabs(){return f()},get active(){return i()},get focused(){return T("focused")},onTabChange:r,onTabClose:t=>k("kai-tab-close",{id:t}),onTabMenu:t=>k("kai-tab-menu",{id:t}),get children(){return[d($,{get when(){return i()},children:t=>(()=>{var n=F();return n._$owner=R(),p(()=>x(n,"name",t())),n})()}),(()=>{var t=F();return t._$owner=R(),t})()]}})});
|
package/dist/elements/pane.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r,m as C,i as n,S as d,a as m,b as x,d as b,t as u,e as N,f as R,g as _,
|
|
1
|
+
import{c as r,m as C,i as n,S as d,a as m,b as x,d as b,t as u,e as N,f as R,g as _,o as j,h as q,u as S}from"./chunks/define-lE-QvQFn.js";import{c as k}from"./chunks/cn-CU7UAWzk.js";import{I as D}from"./chunks/Icon-CHG5z5L7.js";import{m as F,a as I}from"./chunks/minimize-2-C9ytZFMU.js";import{x as L}from"./chunks/x-_-OPHept.js";var O=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],P=e=>r(D,C(e,{name:"Columns2",iconNode:O})),A=P,B=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],E=e=>r(D,C(e,{name:"PanelRight",iconNode:B})),G=E,H=u('<button type=button 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">'),J=u('<span class="flex shrink-0 items-center text-muted-foreground">'),K=u('<span class="truncate text-xs leading-tight text-muted-foreground">'),Q=u('<div part=footer class="shrink-0 border-t border-border">'),T=u('<div data-pane><div part=header class="flex shrink-0 items-center gap-2.5 border-b border-border px-3 py-2"><div class="flex min-w-0 flex-col"><span class="truncate text-sm font-medium leading-tight text-foreground"></span></div><div part=controls class="ml-auto flex shrink-0 items-center gap-0.5"></div></div><div part=body class="min-h-0 flex-1 overflow-y-auto"tabindex=0>'),U=u("<span aria-hidden=true>"),V=u("<span class=truncate>"),W=u('<span class="flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground"><span class="relative flex size-2"><span aria-hidden=true>');const M={working:"bg-tool-blue",idle:"bg-muted-foreground",done:"bg-tool-green",error:"bg-tool-red",blocked:"bg-tool-amber"};function v(e){return(()=>{var l=H();return l.$$click=()=>{var o;return(o=e.onClick)==null?void 0:o.call(e)},n(l,()=>e.children),m(()=>b(l,"aria-label",e.label)),l})()}function X(e){return(()=>{var l=T(),o=l.firstChild,s=o.firstChild,p=s.firstChild,c=s.nextSibling,g=o.nextSibling;return n(o,r(d,{get when(){return e.leading},get children(){var t=J();return n(t,()=>e.leading),t}}),s),n(p,()=>e.title),n(s,r(d,{get when(){return e.subtitle},get children(){var t=K();return n(t,()=>e.subtitle),t}}),null),n(o,r(d,{get when(){return e.status},children:t=>(()=>{var a=W(),h=a.firstChild,f=h.firstChild;return n(h,r(d,{get when(){return t().pulse},get children(){var i=U();return m(()=>x(i,k("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 motion-reduce:hidden",M[t().tone]))),i}}),f),n(a,r(d,{get when(){return t().label},get children(){var i=V();return n(i,()=>t().label),i}}),null),m(i=>{var w=t().label?"status":void 0,z=t().label,y=k("relative inline-flex size-2 rounded-full",M[t().tone]);return w!==i.e&&b(a,"role",i.e=w),z!==i.t&&b(a,"aria-label",i.t=z),y!==i.a&&x(f,i.a=y),i},{e:void 0,t:void 0,a:void 0}),a})()}),c),n(c,()=>e.actions,null),n(c,r(d,{get when(){return e.onSplit},get children(){return r(v,{label:"Split pane",get onClick(){return e.onSplit},get children(){return r(A,{class:"size-4","aria-hidden":"true"})}})}}),null),n(c,r(d,{get when(){return e.onDock},get children(){return r(v,{label:"Dock pane",get onClick(){return e.onDock},get children(){return r(G,{class:"size-4","aria-hidden":"true"})}})}}),null),n(c,r(v,{get label(){return e.maximized?"Restore pane":"Maximize pane"},get onClick(){return e.onMaximize},get children(){return r(d,{get when(){return e.maximized},get fallback(){return r(I,{class:"size-4","aria-hidden":"true"})},get children(){return r(F,{class:"size-4","aria-hidden":"true"})}})}}),null),n(c,r(v,{label:"Close pane",get onClick(){return e.onClose},get children(){return r(L,{class:"size-4","aria-hidden":"true"})}}),null),n(g,()=>e.children),n(l,r(d,{get when(){return e.footer},get children(){var t=Q();return n(t,()=>e.footer),t}}),null),m(()=>x(l,k("flex h-full min-h-0 flex-col overflow-hidden rounded-xl border bg-surface",e.focused?"border-ring ring-2 ring-inset ring-ring/35":"border-border",e.class))),l})()}N(["click"]);var $=u("<slot>");const Y=["leading","actions","footer"];R("kai-pane",{headline:"",subtitle:void 0,maximized:!1,focused:!1,showSplit:!1,showDock:!1,status:void 0},(e,{element:l,dispatch:o,flag:s})=>{const[p,c]=_({leading:!1,actions:!1,footer:!1});j(()=>{const t=()=>{const h={};for(const f of Y)h[f]=!!l.querySelector(`:scope > [slot="${f}"]`);c(h)};t();const a=new MutationObserver(t);a.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}),q(()=>a.disconnect())});const g=t=>p()[t]?(()=>{var a=$();return b(a,"name",t),a._$owner=S(),a})():void 0;return r(X,{get title(){return e.headline},get subtitle(){return e.subtitle},get status(){return e.status},get focused(){return s("focused")},get maximized(){return s("maximized")},get leading(){return g("leading")},get actions(){return g("actions")},get footer(){return g("footer")},onMaximize:()=>o("kai-maximize",{maximized:!s("maximized")}),onClose:()=>o("kai-close"),get onSplit(){return s("showSplit")?()=>o("kai-split"):void 0},get onDock(){return s("showDock")?()=>o("kai-dock"):void 0},get children(){var t=$();return t._$owner=S(),t}})});
|
package/dist/elements/popover.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as m,
|
|
1
|
+
import{g as m,v as k,i as z,c as R,a as S,d as D,n as p,b as j,S as q,t as c,e as A,f as B,u as _}from"./chunks/define-lE-QvQFn.js";import{c as E}from"./chunks/cn-CU7UAWzk.js";import{c as F,u as G,a as H}from"./chunks/overlay-DJL_sbOm.js";import{w as I}from"./chunks/disclosure-DZSa9jog.js";var J=c("<span style=display:inline-flex>"),K=c("<div role=dialog style=position:fixed>");function N(a){var r;const[i,v]=m(a.defaultOpen??!1),[n,o]=m(),[g,C]=m(),f=()=>a.open!==void 0,d=()=>f()?!!a.open:i(),l=e=>{var t;f()||v(e),(t=a.onOpenChange)==null||t.call(a,e)};(r=a.controllerRef)==null||r.call(a,{open:d,setOpen:l});const s=F(d),u=G(n,g,{placement:a.placement??"bottom-start",gutter:a.gutter??6,onDisconnect:()=>l(!1)});return H({enabled:d,onDismiss:()=>l(!1),refs:()=>{var e;return[n(),g(),(e=a.boundary)==null?void 0:e.call(a)]}}),[(()=>{var e=J();return e.$$click=()=>{a.disabled||l(!d())},k(o,e),z(e,()=>a.trigger),e})(),R(q,{get when(){return s.present()},get children(){var e=K();return k(t=>{C(t),s.setRef(t)},e),z(e,()=>a.children),S(t=>{var b=s.state()==="open"?"":void 0,h=s.state()==="closed"?"":void 0,x=`${u.pos().x}px`,y=`${u.pos().y}px`,O=u.hidden()?"hidden":"visible",$=u.hidden()?"none":void 0,w=E("z-50 min-w-[12rem] rounded-lg bg-card p-1 text-sm kai-elevation","animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",a.class);return b!==t.e&&D(e,"data-expanded",t.e=b),h!==t.t&&D(e,"data-closed",t.t=h),x!==t.a&&p(e,"left",t.a=x),y!==t.o&&p(e,"top",t.o=y),O!==t.i&&p(e,"visibility",t.i=O),$!==t.n&&p(e,"pointer-events",t.n=$),w!==t.s&&j(e,t.s=w),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),e}})]}A(["click"]);var P=c("<slot>"),T=c("<slot name=trigger>");B("kai-popover",{placement:"bottom-start",gutter:6,open:void 0,defaultOpen:void 0,disabled:void 0},(a,r)=>{const{flag:i,element:v}=r;let n;return I(r,()=>n,()=>a.open),R(N,{get trigger(){return(()=>{var o=T();return o._$owner=_(),o})()},get placement(){return a.placement},get gutter(){return a.gutter},get defaultOpen(){return i("defaultOpen")},get disabled(){return i("disabled")},controllerRef:o=>n=o,boundary:()=>v,get children(){var o=P();return o._$owner=_(),o}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,c as l,
|
|
1
|
+
import{f as e,c as l,j as a}from"./chunks/define-lE-QvQFn.js";import{P as t}from"./chunks/progress-bar-Br5SksfR.js";e("kai-progress-bar",{value:void 0,max:void 0,label:void 0,tone:"primary"},r=>l(t,{get value(){return a(()=>r.value!=null)()?Number(r.value):0},get max(){return a(()=>r.max!=null)()?Number(r.max):void 0},get label(){return r.label},get tone(){return r.tone}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i
|
|
1
|
+
import{i,c as u,a as l,b as v,S as h,n as d,t as c,f as $,g as C,o as S,h as _,u as x,d as L}from"./chunks/define-lE-QvQFn.js";import{c as f}from"./chunks/cn-CU7UAWzk.js";var M=c("<div part=top>"),O=c("<div part=bottom>"),q=c("<div data-prompt-dock part=tray>");const w="px-3 py-2 text-sm leading-snug text-muted-foreground";function A(r){const a=()=>r.frame??"inset",e=()=>r.appearance??"soft",m=()=>e()==="soft"||e()==="filled",p=()=>e()==="soft"||e()==="outlined";return(()=>{var o=q();return i(o,u(h,{get when(){return r.top},get children(){var t=M();return i(t,()=>r.top),l(()=>v(t,f(w,r.topClass))),t}}),null),i(o,()=>r.children,null),i(o,u(h,{get when(){return r.bottom},get children(){var t=O();return i(t,()=>r.bottom),l(()=>v(t,f(w,r.bottomClass))),t}}),null),l(t=>{var n=f("flex flex-col gap-1.5",r.class),s=m()?"var(--kai-prompt-dock-surface, var(--color-surface-sunken))":"transparent",g=p()?"1px solid var(--kai-prompt-dock-border, var(--color-border))":"0",b=e()==="plain"?"0":"var(--kai-prompt-dock-radius, 1.25rem)",k=a()==="none"?"0":a()==="edge"?"var(--kai-prompt-dock-inset, 0.375rem) 0":"var(--kai-prompt-dock-inset, 0.375rem)";return n!==t.e&&v(o,t.e=n),s!==t.t&&d(o,"background",t.t=s),g!==t.a&&d(o,"border",t.a=g),b!==t.o&&d(o,"border-radius",t.o=b),k!==t.i&&d(o,"padding",t.i=k),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),o})()}var y=c("<slot>");const E=["top","bottom"];$("kai-prompt-dock",{frame:"inset",appearance:"soft"},(r,{element:a})=>{const[e,m]=C({top:!1,bottom:!1});S(()=>{const o=()=>{const n={};for(const s of E)n[s]=!!a.querySelector(`:scope > [slot="${s}"]`);m(n)};o();const t=new MutationObserver(o);t.observe(a,{childList:!0}),_(()=>t.disconnect())});const p=o=>e()[o]?(()=>{var t=y();return L(t,"name",o),t._$owner=x(),t})():void 0;return u(A,{get frame(){return r.frame},get appearance(){return r.appearance},get top(){return p("top")},get bottom(){return p("bottom")},get children(){var o=y();return o._$owner=x(),o}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as w,g as h,
|
|
1
|
+
import{f as w,g as h,k,o as q,h as I,c as M}from"./chunks/define-lE-QvQFn.js";import{D as V}from"./chunks/default-input-DeeRSDHc.js";import{n as g,e as R,s as f}from"./chunks/composer-ldQyeVEB.js";w("kai-prompt-input",{value:void 0,placeholder:"Send a message...",disabled:!1,loading:!1,suggestions:void 0,suggestionMode:"submit",search:!1,voice:!1,stoppable:!1,submit:"always",attach:!0,attachments:void 0,triggers:void 0,kindIcons:void 0},(o,{dispatch:i,flag:s,element:c,expose:A})=>{const[S,m]=h(o.value??""),[l,r]=h(o.attachments??[]);k(()=>{o.attachments&&r(o.attachments)});const[x,y]=h([]);q(()=>{const t=()=>{const u=[...c.querySelectorAll("kai-action")];y(u.map(n=>{var p;return{id:n.id||n.getAttribute("action")||"",label:((p=n.textContent)==null?void 0:p.trim())||n.getAttribute("label")||n.id||"",icon:n.getAttribute("icon")??void 0,tooltip:n.getAttribute("tooltip")??void 0}}))};t();const e=new MutationObserver(t);e.observe(c,{childList:!0,attributes:!0,subtree:!0}),I(()=>e.disconnect())});const v=()=>typeof o.value=="string"?o.value:S();let a={doc:[],text:"",entities:[]};k(()=>{const t=o.value;if(t!=null&&typeof t!="string"){const e=g(t);m(e),a={doc:e,text:f(e),entities:R(e)}}});const d=t=>{m(t),t!==a.text&&(a={doc:g(t),text:t,entities:[]}),i("kai-value-change",{value:t,doc:a.doc,entities:a.entities})},b=()=>{i("kai-submit",{value:f(g(v())),doc:a.doc,entities:a.entities,attachments:l()}),r([])},C=t=>{(o.suggestionMode??"submit")==="fill"?(d(t),i("kai-suggestion-click",{value:t})):(i("kai-submit",{value:t,doc:g(t),entities:[],attachments:l()}),r([]))};return A({focus:t=>{const e=c.shadowRoot,u=e?.querySelector('[contenteditable]:not([contenteditable="false"]), textarea')??e?.querySelector('input:not([type="file"])');u?.focus(t)},blur:()=>{var t,e;return(e=(t=c.shadowRoot)==null?void 0:t.activeElement)==null?void 0:e.blur()},clear:()=>{d(""),l().length&&(r([]),i("kai-attachments-change",{attachments:[]}))},send:()=>b()}),M(V,{get value(){return v()},get placeholder(){return o.placeholder},get disabled(){return s("disabled")},get loading(){return s("loading")},get stoppable(){return s("stoppable")},get submit(){return o.submit},get attach(){return s("attach")},get suggestions(){return o.suggestions},get attachments(){return l()},get search(){return s("search")},get voice(){return s("voice")},get toolbarActions(){return x()},get triggers(){return o.triggers},get kindIcons(){return o.kindIcons},onComposerChange:t=>{a=t},onValueChange:d,onSubmit:b,onSuggestionClick:C,onAttachmentsChange:t=>{r(t),i("kai-attachments-change",{attachments:t})},onSearch:()=>i("kai-search"),onVoice:()=>i("kai-voice"),onStop:()=>i("kai-stop"),onAction:t=>i("kai-toolbar-action",{action:t})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as b,g as f,o as p,h as d,i as k,c as a,F as m,a as x,b as y,t as z}from"./chunks/define-lE-QvQFn.js";import{P as A}from"./chunks/prompt-suggestion-CMIvtAhU.js";var w=z("<div>");const C=e=>typeof e=="string"?e:e.label,S=e=>typeof e=="string"?e:e.value??e.label,O=e=>typeof e=="string"?void 0:e.icon;function l(e){var s;const r=((s=e.textContent)==null?void 0:s.trim())??"",n=e.getAttribute("value")??r;return{label:r,value:n,icon:e.getAttribute("icon")??void 0}}b("kai-suggestions",{suggestions:[],variant:"outline",size:"md",layout:"chips",block:!1,highlight:void 0},(e,{dispatch:s,flag:r,element:n})=>{const[g,u]=f([]);p(()=>{const t=()=>{const h=[...n.querySelectorAll("kai-suggestion")];u(h.map(l))};t();const i=new MutationObserver(t);i.observe(n,{childList:!0,attributes:!0,subtree:!0}),d(()=>i.disconnect())});const c=()=>[...e.suggestions??[],...g()],o=()=>e.layout==="list",v=()=>o()?"flex flex-col gap-0.5":r("block")?"flex flex-col gap-2":"flex flex-wrap gap-2";return(()=>{var t=w();return k(t,a(m,{get each(){return c()},children:i=>a(A,{get variant(){return e.variant},get size(){return e.size},get icon(){return O(i)},get block(){return r("block")},get list(){return o()},get highlight(){return e.highlight},onClick:()=>s("kai-select",{value:S(i)}),get children(){return C(i)}})})),x(()=>y(t,v())),t})()});export{l as parseSuggestionNode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as d,y as i,c as r,C as s}from"./chunks/define-
|
|
1
|
+
import{f as d,y as i,c as r,C as s}from"./chunks/define-lE-QvQFn.js";import{R as g,a as u,b as m}from"./chunks/reasoning-DpZcNzLq.js";import{w as f}from"./chunks/disclosure-DZSa9jog.js";d("kai-reasoning",{text:"",label:"Reasoning",open:void 0,defaultOpen:void 0,streaming:!1,markdown:!0,disabled:void 0},(t,n)=>{const{flag:e}=n,o=i();let a;return f(n,()=>a,()=>t.open),r(s,{get portalMount(){return o.portalMount()},get children(){return r(g,{get defaultOpen(){return e("defaultOpen")},get isStreaming(){return e("streaming")},get disabled(){return e("disabled")},controllerRef:l=>a=l,get children(){return[r(u,{get children(){return t.label}}),r(m,{get markdown(){return e("markdown")},get children(){return t.text}})]}})}})});
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/** Resolves once the kai-* elements are registered (browser); inert on the server.
|
|
2
2
|
* Await this instead of customElements.whenDefined for a single ready signal.
|
|
3
3
|
*
|
|
4
|
-
* NOTE: this MUST stay an exported binding. A bare `void import('./register-impl')`
|
|
4
|
+
* NOTE: this MUST stay an exported binding. A bare `void import('./register-impl.js')`
|
|
5
5
|
* is a result-unused dynamic import that the single-entry register-all build
|
|
6
6
|
* (vite.config.ts → dist/kai.es.js) tree-shakes away as dead code, leaving the
|
|
7
7
|
* bundle with NOTHING registered. Exporting the promise keeps the import live. */
|
|
8
8
|
export declare const elementsReady: Promise<unknown>;
|
|
9
|
-
export type { ChatMessage, ChatMessageAction } from './chat-types';
|
|
10
|
-
export { configureCodeHighlighting, isCodeHighlightingEnabled } from '../primitives/highlighter';
|
|
11
|
-
export type { CodeHighlightingOptions } from '../primitives/highlighter';
|
|
12
|
-
export {
|
|
13
|
-
export type {
|
|
9
|
+
export type { ChatMessage, ChatMessageAction } from './chat-types.js';
|
|
10
|
+
export { configureCodeHighlighting, isCodeHighlightingEnabled } from '../primitives/highlighter.js';
|
|
11
|
+
export type { CodeHighlightingOptions } from '../primitives/highlighter.js';
|
|
12
|
+
export { classifyTool } from '../components/tool-classify.js';
|
|
13
|
+
export type { ToolKind } from '../components/tool-classify.js';
|
|
14
|
+
export { toast, configureToasts } from '../primitives/toast-store.js';
|
|
15
|
+
export type { ToastConfig, ToastItem, ToastVariant, ToastAction, ToastOptions, ToastHandle, } from '../primitives/toast-store.js';
|
package/dist/elements/remote.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as J,g as K,
|
|
1
|
+
import{f as J,g as K,h as T,o as Q,k as X}from"./chunks/define-lE-QvQFn.js";import{r as Y,e as Z}from"./chunks/card-routing-C986KuUA.js";const q="kitn-card";function M(n,e){return function(o){return{protocol:q,version:n,nonce:e,message:o}}}function ee(n,e){if(typeof n!="object"||n===null)return!1;const o=n,t=o.message;return o.protocol===q&&typeof o.version=="string"&&typeof o.nonce=="string"&&typeof t=="object"&&t!==null&&t.dir===e}function ne(n,e,o){const t=new URL(n).origin;if(e===o)throw new Error("[kai-remote] providerOrigin must be cross-origin to the host");if(t===o)throw new Error("[kai-remote] src must not be same-origin as the host");if(t!==e)throw new Error("[kai-remote] src origin must equal providerOrigin")}const te=new Set(["protocol","version","dir","kind","mode","locale","edge","code","acceptedVersion","supportedVersions","cardId","type","id","height","target"]),oe=new Set(["authToken","nonce"]);function O(n){if(Array.isArray(n))return n.map(O);if(n&&typeof n=="object"){const e={};for(const[o,t]of Object.entries(n))oe.has(o)?e[o]="[redacted]":typeof t=="object"&&t!==null?e[o]=O(t):e[o]=te.has(o)?t:"[redacted]";return e}return n}function re(n){return/^[0-9]+$/.test(n)}const ie=new Set(["__proto__","constructor","prototype"]);function R(n){if(Array.isArray(n))return n.some(R);if(n&&typeof n=="object"){for(const e of Object.keys(n))if(ie.has(e)||R(n[e]))return!0}return!1}const ce=new Set(["ready","submit","action","send-prompt","open","resize","state","dismiss","error"]);function ae(n){return typeof n=="string"&&ce.has(n)}const V=["1"],le="allow-scripts allow-forms allow-same-origin",de=5e3;function se(n){try{return new URL(n).host}catch{return n}}function ue(n){const{container:e,providerOrigin:o,src:t,policy:r,maxHeight:d}=n,s=typeof window<"u"?window.location.origin:"";ne(t,o,s);const g=n.handshakeTimeoutMs??de;let m=0,w=P(),k=M("1",w),l="connecting",b=pe(n.context),v=n.envelope,p=null,u=null,c=null,I,y=null;function $(i){try{console.warn("[kai-remote]",O(i))}catch{}}function x(i){const a=c?.contentWindow;if(a)try{a.postMessage(k(i),o)}catch{}}function S(){I!==void 0&&(clearTimeout(I),I=void 0)}function U(i){l==="open"?x({dir:"down",kind:"context",context:i}):l==="connecting"&&(p=i)}function _(i){l==="open"?x({dir:"down",kind:"render",envelope:i}):l==="connecting"&&(u=i)}function z(){p&&(x({dir:"down",kind:"context",context:p}),p=null),u&&(x({dir:"down",kind:"render",envelope:u}),u=null)}function D(i){const a=document.createElement("div");a.setAttribute("role","alert"),a.dataset.kaiRemoteFallback="";const E=document.createElement("p");E.textContent=i,a.appendChild(E);const h=document.createElement("button");h.type="button",h.textContent="Retry",h.addEventListener("click",()=>W()),a.appendChild(h),c&&c.parentNode===e?e.replaceChild(a,c):e.appendChild(a),c=null}function L(i){l!=="closed"&&(S(),l="error",p=null,u=null,D(i))}function j(){const i=m,a=document.createElement("iframe");a.setAttribute("sandbox",n.sandbox??le),a.setAttribute("referrerpolicy","no-referrer"),a.setAttribute("allow","");const E=v.title??v.type;a.setAttribute("title",`${E} \u2014 provided by ${se(o)}`),a.style.border="0",a.style.width="100%",a.addEventListener("load",()=>{m!==i||l!=="connecting"||(k=M("1",w),x({dir:"down",kind:"hello",supportedVersions:V}),S(),I=setTimeout(()=>{var h;m!==i||l!=="connecting"||(L("[timeout] The card took too long to load."),(h=r?.onError)==null||h.call(r,v.id,"[timeout] handshake timed out"))},g))}),y=h=>N(h,i),window.addEventListener("message",y),c=a,e.appendChild(a),a.setAttribute("src",t)}function W(){l==="error"&&(m+=1,w=P(),k=M("1",w),l="connecting",p=null,u=null,S(),y&&(window.removeEventListener("message",y),y=null),c&&(c.remove(),c=null),p=b,u=v,e.querySelectorAll("[data-kai-remote-fallback]").forEach(i=>i.remove()),j())}function F(i){if(!c)return;const a=Math.min(i,d??1/0);c.style.height=`${a}px`}function H(){if(c)try{c.blur()}catch{}}function N(i,a){var E,h;if(a!==m||l==="closed"||l==="error")return;const A=i.data;if(i.origin===o&&i.source===c?.contentWindow&&ee(A,"up")&&A.nonce===w)try{const C=A.message;switch(C.kind){case"ready":{if(l!=="connecting")return;const f=C.acceptedVersion;if(!re(f)||!V.includes(f)){L("[version-unsupported] This card needs a different host version."),(E=r?.onError)==null||E.call(r,v.id,"[version-unsupported] no compatible protocol version");return}k=M(f,w),S(),l="open",p||(p=b),u||(u=v),z();return}case"event":{if(l!=="open")return;const f=C.event;if(f.cardId!==v.id)return;if(f.kind==="resize"){F(f.height);return}if(!ae(f.kind)||R(f)){$(A);return}Y(r??{},f);return}case"focus-edge":{H();return}case"fault":{const f=C.code,G=C.message;L(`[${f}] The card reported a problem.`),(h=r?.onError)==null||h.call(r,v.id,`[${f}] ${G}`);return}default:return}}catch{$(A)}}const B={updateContext(i){l!=="closed"&&(b=fe(b,i),U(b))},update(i){l!=="closed"&&(v=i,_(i))},destroy(){l!=="closed"&&(m+=1,l==="open"&&x({dir:"down",kind:"teardown"}),l="closed",S(),y&&(window.removeEventListener("message",y),y=null),c&&(c.remove(),c=null),e.querySelectorAll("[data-kai-remote-fallback]").forEach(i=>i.remove()))},state(){return l}};return j(),B}function P(){const n=new Uint8Array(16);crypto.getRandomValues(n);let e="";for(const o of n)e+=o.toString(16).padStart(2,"0");return e}function pe(n){return{...n}}function fe(n,e){return{...n,...e}}function me(n){if(!n||n==="*"||n.includes(","))return!1;let e;try{e=new URL(n)}catch{return!1}return e.pathname!=="/"||e.search!==""||e.hash!==""?!1:e.protocol==="https:"?!0:e.protocol==="http:"?e.hostname==="localhost"||e.hostname==="127.0.0.1":!1}function he(n,e){function o(t){Z(n,t)}return{onSubmit(t,r){var d;o({kind:"submit",cardId:t,data:r}),(d=e?.onSubmit)==null||d.call(e,t,r)},onAction(t,r,d){var s;o({kind:"action",cardId:t,action:r,payload:d}),(s=e?.onAction)==null||s.call(e,t,r,d)},onSendPrompt(t,r){var d;o({kind:"send-prompt",cardId:"",text:t,mode:r.mode,context:r.context}),(d=e?.onSendPrompt)==null||d.call(e,t,r)},onOpen(t,r){var d;o({kind:"open",cardId:"",url:t,target:r}),(d=e?.onOpen)==null||d.call(e,t,r)},onState(t,r){var d;o({kind:"state",cardId:t,patch:r}),(d=e?.onState)==null||d.call(e,t,r)},onDismiss(t){var r;o({kind:"dismiss",cardId:t}),(r=e?.onDismiss)==null||r.call(e,t)},onReopen(t){var r;o({kind:"reopen",cardId:t}),(r=e?.onReopen)==null||r.call(e,t)},onError(t,r){var d;o({kind:"error",cardId:t,message:r}),(d=e?.onError)==null||d.call(e,t,r)},maxSendPromptMode:e?.maxSendPromptMode}}J("kai-remote",{src:void 0,providerOrigin:void 0,envelope:void 0,policy:void 0},(n,{element:e})=>{let o;const[t,r]=K(!1);if(typeof window<"u"&&typeof window.matchMedia=="function"){const s=window.matchMedia("(prefers-color-scheme: dark)");r(s.matches);const g=m=>r(m.matches);s.addEventListener("change",g),T(()=>s.removeEventListener("change",g))}const d=()=>{const s=n.theme??"auto";return s==="dark"||s==="auto"&&t()};return Q(()=>{const s=e.shadowRoot;if(!s)return;function g(u){const c=document.createElement("div");c.setAttribute("role","alert"),c.textContent=u,s.appendChild(c)}const m=n.providerOrigin;if(!me(m)){g(`[kai-remote] Invalid provider-origin "${m??""}". Must be an absolute https: origin, or http://localhost / http://127.0.0.1 for local dev.`);return}const w=n.src;if(!w){g('[kai-remote] Missing required "src" attribute.');return}const k=n.envelope;if(!k){g('[kai-remote] Missing required "envelope" property.');return}const l={theme:{mode:d()?"dark":"light"},locale:typeof navigator<"u"&&navigator.language||"en"},b=n.policy,v=he(e,b),p=document.createElement("div");s.appendChild(p);try{o=ue({container:p,providerOrigin:m,src:w,envelope:k,context:l,policy:v})}catch(u){const c=u instanceof Error?u.message:String(u);g(`[kai-remote] Mount failed: ${c}`),p.remove();return}T(()=>{o?.destroy(),o=void 0})}),X(()=>{const s=d()?"dark":"light";o?.updateContext({theme:{mode:s}})}),[]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as j,k as C,g as D,o as ie,h as ne,x as ae,i as re,c as L,S as le,u as G,a as J,d as f,p as se,F as oe,n as de,t as k}from"./chunks/define-lE-QvQFn.js";import{c as ue,n as q,b as ce}from"./chunks/resizable-Q8i3T9a_.js";var me=k("<style>:host{display:block;height:100%}"),he=k("<div data-resizable-root style=display:flex;width:100%;height:100%>"),fe=k('<div data-panel style="display:grid;grid-template-rows:minmax(0, 1fr);grid-template-columns:minmax(0, 1fr);min-width:0;min-height:0;overflow:hidden"><slot>'),be=k("<style>:host{display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:auto}"),pe=k('<div style="display:grid;grid-template-rows:minmax(0, 1fr);grid-template-columns:minmax(0, 1fr);width:100%;height:100%;min-width:0;min-height:0"><slot>');const ve="kai-maximize-intent",ge="kai-maximize-state",I=3;function _(d){if(d===void 0||d==="")return{};const r=d.trim();return r.endsWith("px")?{pxAttr:String(parseFloat(r))}:r.endsWith("%")?{pctAttr:String(parseFloat(r))}:Number.isFinite(Number(r))?{pctAttr:r}:{}}j("kai-resizable",{orientation:"horizontal",maximizedIndex:null,handle:"line"},(d,{element:r,dispatch:b,expose:z})=>{const[c,m]=D([]),v=()=>d.orientation==="vertical"?"vertical":"horizontal";function h(){const t=Array.from(r.children).filter(e=>e.tagName.toLowerCase()==="kai-resizable-item");t.length>I&&console.warn(`<kai-resizable>: only the first ${I} <kai-resizable-item> children are laid out (got ${t.length}). Nest <kai-resizable> for more.`);const i=t.slice(0,I).map(e=>{e.hasAttribute("data-kai-default-size")||e.setAttribute("data-kai-default-size",e.getAttribute("size")??"");const a=e.getAttribute("data-kai-default-size")||void 0,l=e.hasAttribute("collapsed")&&e.getAttribute("collapsed")!=="false";return{el:e,size:e.getAttribute("size")??void 0,defaultSize:a,min:e.getAttribute("min")??void 0,max:e.getAttribute("max")??void 0,locked:e.hasAttribute("locked")&&e.getAttribute("locked")!=="false",hidden:e.hidden||e.hasAttribute("hidden")&&e.getAttribute("hidden")!=="false",collapsed:l}});let n=0;for(const e of i)e.hidden||e.collapsed?e.el.removeAttribute("slot"):(e.el.setAttribute("slot",`p${n}`),n++);for(const e of t.slice(I))e.removeAttribute("slot");N(c(),i)&&m(i)}function N(t,i){if(t.length!==i.length)return!0;for(let n=0;n<t.length;n++){const e=t[n],a=i[n];if(e.el!==a.el||e.size!==a.size||e.min!==a.min||e.max!==a.max||e.locked!==a.locked||e.hidden!==a.hidden||e.collapsed!==a.collapsed)return!0}return!1}const w=()=>c().filter(t=>!t.hidden&&!t.collapsed);function S(){return w().map(t=>{var i;const n=((i=t.el.assignedSlot)==null?void 0:i.closest("[data-panel]"))??t.el,e=n.parentElement,a=v()==="horizontal"?"width":"height",l=e?e.getBoundingClientRect()[a]:0,p=n.getBoundingClientRect()[a];return l>0?Math.round(p/l*100):0})}function E(){b("kai-change",{sizes:S()})}let $=!1;function U(){const t=w(),i=S();t.length===i.length&&($=!0,t.forEach((n,e)=>{const a=i[e];Number.isFinite(a)&&a>0&&n.el.setAttribute("size",`${a}%`)}),queueMicrotask(()=>{$=!1}))}const[y,T]=D(null);let x=!1;function V(t){let i=t instanceof Element?t:t?.parentElement??null;const n=c().map(e=>e.el);for(;i;){if(i instanceof HTMLElement&&n.includes(i))return i;i=i.parentElement??i.getRootNode().host??null}return null}function Y(t){return{size:t.getAttribute("size"),hidden:t.hidden||t.hasAttribute("hidden")&&t.getAttribute("hidden")!=="false",locked:t.hasAttribute("locked")&&t.getAttribute("locked")!=="false"}}function M(t,i,n){n?t.setAttribute(i,""):t.removeAttribute(i)}function F(t){const i=c(),n=i.findIndex(u=>u.el===t);if(n<0)return;const e=y();if(e){if(e.item===t)return;A()}x=!0;const a=S();let l=0;const p=i.map(u=>{const g=Y(u.el);if(!g.hidden){const o=a[l++];Number.isFinite(o)&&o>0&&u.el.setAttribute("size",`${o}%`)}return{el:u.el,size:u.el.getAttribute("size"),hidden:g.hidden,locked:g.locked}});i.forEach((u,g)=>{g===n?(u.el.removeAttribute("size"),u.el.removeAttribute("locked"),M(u.el,"hidden",!1)):M(u.el,"hidden",!0)}),T({item:t,saved:p}),r.setAttribute("data-maximized",""),t.setAttribute("data-maximized-panel",""),h(),E(),queueMicrotask(()=>{x=!1}),t.dispatchEvent(new CustomEvent("kai-maximize-state",{detail:{maximized:!0},bubbles:!1,composed:!0})),b("kai-maximize-change",{maximized:!0,index:n})}function A(){const t=y();if(!t)return;x=!0;for(const n of t.saved)n.el.isConnected&&(n.size===null?n.el.removeAttribute("size"):n.el.setAttribute("size",n.size),M(n.el,"hidden",n.hidden),M(n.el,"locked",n.locked),n.el.removeAttribute("data-maximized-panel"));const i=t.item;T(null),r.removeAttribute("data-maximized"),h(),E(),queueMicrotask(()=>{x=!1}),r.dispatchEvent(new CustomEvent("kai-maximize-state",{detail:{maximized:!1},bubbles:!1,composed:!0})),i?.dispatchEvent(new CustomEvent("kai-maximize-state",{detail:{maximized:!1},bubbles:!1,composed:!0})),b("kai-maximize-change",{maximized:!1,index:null})}ie(()=>{h();const t=e=>{const a=e;e.stopPropagation();const l=V(a.target);l&&(a.detail.requested?F(l):A())};r.addEventListener("kai-maximize-intent",t);const i=e=>{e.key!=="Escape"||!y()||(e.stopPropagation(),A())};r.addEventListener("keydown",i,!0);const n=new MutationObserver(()=>{if($)return;h();const e=y();if(e){const a=e.item,l=a.isConnected&&r.contains(a),p=l&&!(a.hidden||a.hasAttribute("hidden"))&&!(a.hasAttribute("collapsed")&&a.getAttribute("collapsed")!=="false");if(!l||!p){A();return}}x||queueMicrotask(E)});n.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["size","locked","min","max","hidden","collapsed"]}),ne(()=>{n.disconnect(),r.removeEventListener("kai-maximize-intent",t),r.removeEventListener("keydown",i,!0)}),z({maximize:e=>{var a;const l=(a=c()[e])==null?void 0:a.el;l&&F(l)},restore:()=>A()}),C(ae(()=>d.maximizedIndex,e=>{var a;if(e==null)A();else{const l=(a=c()[e])==null?void 0:a.el;l&&F(l)}},{defer:!0}))});const ee=()=>v()==="horizontal";return[me(),(()=>{var t=he();return re(t,L(oe,{get each(){return w()},children:(i,n)=>{const e=_(i.min),a=_(i.max),l=_(i.defaultSize),p=ue(q(i.size),q(i.min),q(i.max)),u=()=>w()[n()-1],g=()=>{var o;return!!(i.locked||(o=u())!=null&&o.locked)};return[L(le,{get when(){return n()>0},get children(){return L(ce,{get handle(){return d.handle??"line"},get orientation(){return v()},get static(){return g()},onPanelResize:()=>{U(),queueMicrotask(E)}})}}),(()=>{var o=fe(),R=o.firstChild;return R._$owner=G(),J(s=>{var P=i.locked?"":void 0,B=e.pxAttr,K=e.pctAttr,W=a.pxAttr,X=a.pctAttr,Z=l.pxAttr,H=l.pctAttr,te={...p!==void 0?{"flex-basis":p,"flex-grow":"0","flex-shrink":"0"}:{flex:"1 1 0%"}},O=`p${n()}`;return P!==s.e&&f(o,"data-locked",s.e=P),B!==s.t&&f(o,"data-min-size",s.t=B),K!==s.a&&f(o,"data-min-size-pct",s.a=K),W!==s.o&&f(o,"data-max-size",s.o=W),X!==s.i&&f(o,"data-max-size-pct",s.i=X),Z!==s.n&&f(o,"data-default-size",s.n=Z),H!==s.s&&f(o,"data-default-size-pct",s.s=H),s.h=se(o,te,s.h),O!==s.r&&f(R,"name",s.r=O),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),o})()]}})),J(i=>{var n=v(),e=ee()?"row":"column";return n!==i.e&&f(t,"data-orientation",i.e=n),e!==i.t&&de(t,"flex-direction",i.t=e),i},{e:void 0,t:void 0}),t})()]});function Q(d,r,b){const z=m=>m==null||m===""?null:String(m),c=m=>{let v;C(()=>{const h=z(r[m]);if(h===v)return;const N=d.getAttribute(m);h!==N&&(v=h,h===null?d.removeAttribute(m):d.setAttribute(m,h))})};c("size"),c("min"),c("max"),C(()=>{d.toggleAttribute("locked",b("locked"))})}j("kai-resizable-item",{size:void 0,min:void 0,max:void 0,locked:!1,hidden:!1,collapsed:!1},(d,{element:r,flag:b})=>(C(()=>{r.toggleAttribute("collapsed",b("collapsed"))}),Q(r,d,b),[be(),(()=>{var z=pe(),c=z.firstChild;return c._$owner=G(),z})()]));export{ve as KAI_MAXIMIZE_INTENT,ge as KAI_MAXIMIZE_STATE,Q as reflectItemConfig};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as
|
|
1
|
+
import{g as M,h as B,s as A,k as b,x as D,i as v,c as C,F as E,a as I,b as z,n as F,j as G,S as H,t as x,f as J}from"./chunks/define-lE-QvQFn.js";import{c as K}from"./chunks/cn-CU7UAWzk.js";function L(t){const e=t.speed??20,y=t.characterChunkSize??3,[f,i]=M(""),[S,u]=M(!0),[a,n]=M([]);let s="",d=0,m,o=!1,r;function l(){m!==void 0&&(clearInterval(m),m=void 0)}function p(){if(!o){if(d>=s.length){r||(l(),u(!0));return}d=Math.min(d+y,s.length),i(s.slice(0,d))}}async function $(c){r=c[Symbol.asyncIterator]();try{for(;;){const{value:h,done:k}=await r.next();if(k)break;h&&(s+=h,n(g=>[...g,{text:h,index:g.length}]))}}finally{r=void 0}}function q(c){if(w(),u(!1),typeof c=="string")if(s=c,t.mode==="typewriter")m=setInterval(p,e);else{const h=c.split(/(\s+)/).filter(Boolean);n(h.map((k,g)=>({text:k,index:g}))),i(c)}else t.mode==="typewriter"&&(m=setInterval(p,e)),$(c).then(()=>{t.mode==="fade"&&(i(s),u(!0))})}function T(){o=!0}function j(){o=!1}function w(){l(),s="",d=0,o=!1,r=void 0,i(""),u(!0),n([])}return B(()=>l()),{displayedText:f,isComplete:S,segments:a,startStreaming:q,pause:T,resume:j,reset:w}}var N=x("<style>"),P=x("<div class=relative>"),R=x("<div>"),W=x("<span>");function _(t){const[e]=A(t,["textStream","mode","speed","class","onComplete","as","fadeDuration","segmentDelay","characterChunkSize"]),y=()=>e.mode??"typewriter",f=()=>e.speed??20,i=L({mode:y(),speed:f(),characterChunkSize:e.characterChunkSize,fadeDuration:e.fadeDuration});b(D(()=>e.textStream,a=>{a&&i.startStreaming(a)})),b(D(()=>i.isComplete(),a=>{var n;a&&((n=e.onComplete)==null||n.call(e))}));const S=()=>`
|
|
2
2
|
@keyframes fadeIn {
|
|
3
3
|
from { opacity: 0; }
|
|
4
4
|
to { opacity: 1; }
|
package/dist/elements/screen.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as E,
|
|
1
|
+
import{g as E,k as _,h as q,c as g,v as H,d as k,i as s,S,a as M,b as j,t as f,e as P,f as D,u as y}from"./chunks/define-lE-QvQFn.js";import{c as F}from"./chunks/cn-CU7UAWzk.js";import{c as G}from"./chunks/overlay-DJL_sbOm.js";import{a as J}from"./chunks/arrow-left-CFPTeL1Y.js";import{w as K}from"./chunks/disclosure-DZSa9jog.js";var L=f('<button part=back type=button aria-label=Back class="inline-flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">'),N=f('<div part=body role=dialog aria-modal=true tabindex=-1><header part=header class="flex shrink-0 items-center gap-2 border-b border-border px-3 py-2"><h2 part=title class="min-w-0 flex-1 truncate text-sm font-semibold text-foreground"></h2><div class="flex shrink-0 items-center gap-1"></div></header><div class="min-h-0 flex-1 overflow-auto">');let Q=0;function T(t){var d;const[v,b]=E(t.defaultOpen??!1),h=`kai-screen-title-${++Q}`,m=()=>t.open!==void 0,l=()=>m()?!!t.open:v(),u=e=>{var r;m()||b(e),(r=t.onOpenChange)==null||r.call(t,e)};(d=t.controllerRef)==null||d.call(t,{open:l,setOpen:u});const n=G(l);let x,A=null,w=[];const C=()=>t.back!==!1,$=()=>{var e;return(e=t.onBack)==null?void 0:e.call(t)},z=()=>{var e;if(t.noInert)return;const r=(e=t.host)==null?void 0:e.call(t),o=r?.parentElement;if(!(!r||!o))for(const p of Array.from(o.children)){if(p===r)continue;const i=p;w.push({el:i,hadInert:i.hasAttribute("inert"),hadAriaHidden:i.getAttribute("aria-hidden")}),i.setAttribute("inert",""),i.setAttribute("aria-hidden","true")}},I=()=>{for(const{el:e,hadInert:r,hadAriaHidden:o}of w)r||e.removeAttribute("inert"),o===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",o);w=[]};_(e=>{const r=l();if(r&&!e)A=document.activeElement??null,z(),queueMicrotask(()=>x?.focus());else if(!r&&e){I();const o=A;A=null,o&&o.isConnected&&queueMicrotask(()=>o.focus())}return r},!1),q(I);const B=e=>{e.key==="Escape"&&(e.stopPropagation(),$())};return g(S,{get when(){return n.present()},get children(){var e=N(),r=e.firstChild,o=r.firstChild,p=o.nextSibling,i=r.nextSibling;return e.$$keydown=B,H(a=>{var c;x=a,n.setRef(a),(c=t.surfaceRef)==null||c.call(t,a)},e),k(e,"aria-labelledby",h),s(r,g(S,{get when(){return C()},get children(){var a=L();return a.$$click=$,s(a,g(J,{size:16,"aria-hidden":"true"})),a}}),o),k(o,"id",h),s(o,()=>t.titleSlot??t.title),s(p,()=>t.actions),s(i,()=>t.children),M(a=>{var c=n.state()==="open"?"":void 0,O=n.state()==="closed"?"":void 0,R=F("absolute inset-0 z-40 flex flex-col bg-background text-foreground outline-none","animate-in fade-in-0 slide-in-from-bottom-2 motion-reduce:animate-none","data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:slide-out-to-bottom-2");return c!==a.e&&k(e,"data-expanded",a.e=c),O!==a.t&&k(e,"data-closed",a.t=O),R!==a.a&&j(e,a.a=R),a},{e:void 0,t:void 0,a:void 0}),e}})}P(["keydown","click"]);var U=f("<slot>"),V=f("<slot name=title>"),W=f("<slot name=actions>");D("kai-screen",{open:void 0,defaultOpen:void 0,headline:void 0,back:void 0,noInert:void 0},(t,d)=>{const{flag:v,element:b,dispatch:h,expose:m}=d;let l,u;return K(d,()=>l,()=>t.open),m({focus:n=>u?.focus(n)}),g(T,{get defaultOpen(){return v("defaultOpen")},get back(){return!(t.back===!1||b.getAttribute("back")==="false")},get noInert(){return v("noInert")},host:()=>b,get titleSlot(){return(()=>{var n=V();return n._$owner=y(),s(n,()=>t.headline),n})()},get actions(){return(()=>{var n=W();return n._$owner=y(),n})()},onBack:()=>{h("kai-back",{})},controllerRef:n=>l=n,surfaceRef:n=>u=n,get children(){var n=U();return n._$owner=y(),n}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as l,c as o,
|
|
1
|
+
import{f as l,c as o,u as i,t as a}from"./chunks/define-lE-QvQFn.js";import{S as e}from"./chunks/scroll-area-eLeydBje.js";var n=a("<style>:host{display:block;min-height:0}"),s=a("<slot>");l("kai-scroll-area",{orientation:"vertical"},r=>[n(),o(e,{class:"h-full max-h-full w-full max-w-full",part:"viewport",get orientation(){return r.orientation},get children(){var t=s();return t._$owner=i(),t}})]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as h,g,o as v,h as E,c as a}from"./chunks/define-lE-QvQFn.js";import{c as y}from"./chunks/cn-CU7UAWzk.js";import{B as H}from"./chunks/button-C42vrGvO.js";import{c as b}from"./chunks/chevron-down-CpNYLn7E.js";const w=50;function k(r){let t=r.parentElement;for(;t&&t!==document.documentElement;){const n=getComputedStyle(t),l=n.overflow+n.overflowY;if(/auto|scroll/.test(l)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}h("kai-scroll-button",{for:void 0,variant:"outline",size:"icon"},(r,{element:t,dispatch:n})=>{const[l,c]=g(!0);let o=null,i=[];function s(){if(!o)return;const{scrollTop:e,scrollHeight:p,clientHeight:d}=o;c(p-e-d<w)}function u(){o&&(o.scrollTo({top:o.scrollHeight,behavior:"smooth"}),c(!0))}function f(e){o=e,e.addEventListener("scroll",s,{passive:!0}),s(),i.push(()=>e.removeEventListener("scroll",s))}function m(){i.forEach(e=>e()),i=[],o=null}return v(()=>{const e=r.for?document.getElementById(r.for):k(t);e&&f(e)}),E(m),a(H,{get variant(){return r.variant??"outline"},get size(){return r.size??"icon"},"aria-label":"Scroll to bottom",get class(){return y("rounded-full transition-all duration-150 ease-out",l()?"pointer-events-none translate-y-4 scale-95 opacity-0":"translate-y-0 scale-100 opacity-100")},onClick:()=>{u(),n("kai-scroll")},get children(){return a(b,{class:"h-5 w-5"})}})});
|
package/dist/elements/search.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as C,e as S,g as j,
|
|
1
|
+
import{f as C,e as S,g as j,B as h,k as T,c as i,S as u,i as I,j as K,t as v}from"./chunks/define-lE-QvQFn.js";import{I as V}from"./chunks/input-BauDmzxX.js";import{K as $}from"./chunks/kbd-BlHJaP9b.js";import{L as E}from"./chunks/loader-CmJG_Fkq.js";import{r as m}from"./chunks/icon-CNiKP37E.js";var L=v('<button type=button part=clear aria-label=Clear class="inline-flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">'),N=v("<style>:host{display:block}");C("kai-search",{value:void 0,placeholder:"Search\u2026",icon:"search",debounce:200,loading:!1,shortcut:void 0},(a,d)=>{const{element:t,dispatch:n,flag:b,expose:f}=d,[r,l]=j(a.value??t.getAttribute("value")??""),p=e=>e==null?t.getAttribute("value")??"":String(e);Object.defineProperty(t,"value",{get:()=>r(),set:e=>{const g=p(e);h(r)!==g&&l(g)},configurable:!0,enumerable:!0}),T(()=>{const e=r();e?t.getAttribute("value")!==e&&t.setAttribute("value",e):t.hasAttribute("value")&&t.removeAttribute("value")});let s;const k=()=>{const e=Number(a.debounce??200);return Number.isFinite(e)&&e>=0?e:200},y=e=>{s&&clearTimeout(s),s=setTimeout(()=>n("kai-search",{value:e}),k())},o=()=>{var e;return((e=t.shadowRoot)==null?void 0:e.querySelector("input"))??null},z=e=>{l(e),y(e)},c=()=>{var e;s&&clearTimeout(s),l(""),n("kai-search",{value:""}),(e=o())==null||e.focus()},x=e=>{e.key==="Enter"&&n("kai-submit",{value:h(r)})};f({focus:()=>{var e;return(e=o())==null?void 0:e.focus()},clear:c});const A=i(u,{get when(){return b("loading")},get fallback(){return m(a.icon??"search",{class:"size-4 shrink-0",imgClass:"size-4 shrink-0",spanClass:"inline-flex size-4 shrink-0 items-center justify-center",ariaHidden:!0})},get children(){return i(E,{variant:"circular",size:"sm"})}}),w=[i(u,{get when(){return r()},get children(){var e=L();return e.$$click=c,I(e,()=>m("x",{class:"size-4",imgClass:"size-4"})),e}}),i(u,{get when(){return K(()=>!r())()&&a.shortcut},get children(){return i($,{get keys(){return a.shortcut},size:"sm"})}})];return[N(),i(V,{type:"search",get value(){return r()},get placeholder(){return a.placeholder??"Search\u2026"},leading:A,trailing:w,onValueInput:z,onValueChange:e=>n("kai-change",{value:e}),onKeyDown:x})]}),S(["click"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as C,i as g,c as m,
|
|
1
|
+
import{m as C,i as g,c as m,v as D,S as $,a as x,d as y,b as A,F as j,t as f,e as H,f as M,g as S,B as w,k as B}from"./chunks/define-lE-QvQFn.js";import{c as z}from"./chunks/cn-CU7UAWzk.js";import{r as E}from"./chunks/icon-CNiKP37E.js";var F=f("<div role=group part=track>"),I=f('<span class="inline-flex shrink-0 items-center"aria-hidden=true>'),P=f("<button type=button part=segment><span>");const R={sm:"h-7 px-2 text-xs",md:"h-8 px-3 text-sm"};function K(u){const r=C({size:"md"},u),i=[],c=()=>r.options.findIndex(t=>t.value===r.value),s=t=>{var n;const o=r.options[t];o&&(r.onChange(o.value),(n=i[t])==null||n.focus())},d=t=>{const n=r.options.length;if(n===0)return;const o=c();t.key==="ArrowRight"||t.key==="ArrowDown"?(t.preventDefault(),s((Math.max(o,0)+1)%n)):t.key==="ArrowLeft"||t.key==="ArrowUp"?(t.preventDefault(),s((Math.max(o,0)-1+n)%n)):t.key==="Home"?(t.preventDefault(),s(0)):t.key==="End"&&(t.preventDefault(),s(n-1))};return(()=>{var t=F();return t.$$keydown=d,g(t,m(j,{get each(){return r.options},children:(n,o)=>{const e=()=>n.value===r.value,v=()=>e()||c()===-1&&o()===0;return(()=>{var l=P(),p=l.firstChild;return l.$$click=()=>r.onChange(n.value),D(a=>{i[o()]=a},l),g(l,m($,{get when(){return n.icon},get children(){var a=I();return g(a,()=>n.icon),a}}),p),g(p,()=>n.label),x(a=>{var h=e(),b=v()?0:-1,k=z("inline-flex items-center justify-center gap-1.5 rounded-md font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",R[r.size],e()?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");return h!==a.e&&y(l,"aria-pressed",a.e=h),b!==a.t&&y(l,"tabindex",a.t=b),k!==a.a&&A(l,a.a=k),a},{e:void 0,t:void 0,a:void 0}),l})()}})),x(()=>A(t,z("inline-flex items-center gap-0.5 rounded-lg bg-surface-sunken p-0.5",r.class))),t})()}H(["keydown","click"]);var L=f("<style>:host{display:inline-flex}");M("kai-segmented",{options:[],value:void 0,size:"md"},(u,r)=>{const{element:i,dispatch:c}=r,[s,d]=S(u.value??i.getAttribute("value")??""),t=e=>e==null?i.getAttribute("value")??"":String(e),n=e=>{w(s)!==e&&(d(e),c("kai-change",{value:e}))};Object.defineProperty(i,"value",{get:()=>s(),set:e=>{const v=t(e);w(s)!==v&&d(v)},configurable:!0,enumerable:!0}),B(()=>{const e=s();e?i.getAttribute("value")!==e&&i.setAttribute("value",e):i.hasAttribute("value")&&i.removeAttribute("value")});const o=()=>(u.options??[]).map(e=>({value:e.value,label:e.label,icon:e.icon?E(e.icon,{class:"size-4 shrink-0",imgClass:"size-4 shrink-0",spanClass:"inline-flex size-4 shrink-0 items-center justify-center",ariaHidden:!0}):void 0}));return[L(),m(K,{get options(){return o()},get value(){return s()},get size(){return u.size??"md"},onChange:e=>n(e)})]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as o,i,c as e,t as n}from"./chunks/define-
|
|
1
|
+
import{f as o,i,c as e,t as n}from"./chunks/define-lE-QvQFn.js";import{S as s}from"./chunks/separator-Xic78AD_.js";var l=n("<style>");o("kai-separator",{orientation:"horizontal"},a=>{const t=()=>a.orientation==="vertical";return[(()=>{var r=l();return i(r,()=>t()?":host{display:inline-block;align-self:stretch}":":host{display:block}"),r})(),e(s,{get orientation(){return t()?"vertical":"horizontal"},part:"separator"})]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as a,g as i,
|
|
1
|
+
import{f as a,g as i,o as c,h as l,c as u,j as b,u as d,t as m}from"./chunks/define-lE-QvQFn.js";import{S as p}from"./chunks/settings-group-CsG9eYLe.js";var g=m("<slot name=control>");a("kai-setting-item",{label:"",description:void 0},(t,{element:r})=>{const[s,n]=i(!1);return c(()=>{const e=()=>n(!!r.querySelector(':scope > [slot="control"]'));e();const o=new MutationObserver(e);o.observe(r,{childList:!0,attributes:!0,subtree:!0}),l(()=>o.disconnect())}),u(p,{get label(){return t.label??""},get description(){return t.description},get control(){return b(()=>!!s())()?(()=>{var e=g();return e._$owner=d(),e})():void 0}})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as t,c as e,
|
|
1
|
+
import{f as t,c as e,u as n,t as o}from"./chunks/define-lE-QvQFn.js";import{a}from"./chunks/settings-group-CsG9eYLe.js";var s=o("<slot>");t("kai-settings-group",{heading:"",description:void 0},r=>e(a,{get heading(){return r.heading??""},get description(){return r.description},get children(){var i=s();return i._$owner=n(),i}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,c as i,
|
|
1
|
+
import{f as e,c as i,j as r,t as a}from"./chunks/define-lE-QvQFn.js";import{S as n}from"./chunks/skeleton-CLlHTcMI.js";var s=a("<style>:host{display:block}");e("kai-skeleton",{variant:"text",width:void 0,height:void 0,lines:void 0},t=>[s(),i(n,{get variant(){return t.variant??"text"},get width(){return t.width},get height(){return t.height},get lines(){return r(()=>t.lines!=null)()?Number(t.lines):void 0}})]);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* Track whether a `<slot>` is projecting VISIBLE TEXT, so a facade can tell
|
|
4
|
+
* "this control shows its own name" from "this control is icon-only and needs
|
|
5
|
+
* one".
|
|
6
|
+
*
|
|
7
|
+
* WHY IT EXISTS. Slotted light-DOM text is part of the flattened tree, so it
|
|
8
|
+
* names the shadow `<button>` all by itself — measured, not assumed:
|
|
9
|
+
* `scripts/probe-button-accessible-name.mjs` reads chromium's AX tree and
|
|
10
|
+
* `<kai-button>Save</kai-button>` computes the name "Save" from `contents`,
|
|
11
|
+
* with no `aria-label` anywhere. An `aria-label` on top of that does not add a
|
|
12
|
+
* name, it REPLACES one, and a replacement that disagrees with the visible text
|
|
13
|
+
* is a WCAG 2.5.3 (Label in Name) failure: speech-input users say what they
|
|
14
|
+
* see, so a button reading "Save" whose accessible name is "Submit" cannot be
|
|
15
|
+
* activated by voice at all. `kai-checkpoint` already resolved this the same
|
|
16
|
+
* way; this is the reusable form of that decision.
|
|
17
|
+
*
|
|
18
|
+
* WHY A SIGNAL AND NOT A ONE-OFF READ. The facade renders while the HTML parser
|
|
19
|
+
* is still inside the element's own tag, so the light DOM is usually EMPTY at
|
|
20
|
+
* that moment and any synchronous read of `element.childNodes` reports "no text"
|
|
21
|
+
* for the most common case there is. `slotchange` is the event that tells the
|
|
22
|
+
* truth, and it fires on the initial assignment too.
|
|
23
|
+
*
|
|
24
|
+
* The initial value is therefore `false`, meaning "assume icon-only", which
|
|
25
|
+
* makes the pre-`slotchange` frame emit the `aria-label`. That direction is
|
|
26
|
+
* deliberate: an overridden name is a defect, an ABSENT name is a worse one, so
|
|
27
|
+
* the transient state is the named one. `slotchange` is queued as a mutation
|
|
28
|
+
* observer microtask, so it lands before paint and no assistive technology
|
|
29
|
+
* observes the transient.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createSlotText(options?: {
|
|
32
|
+
/**
|
|
33
|
+
* Follow `assignedNodes({ flatten: true })`, which descends into nested
|
|
34
|
+
* light-DOM `<slot>` elements (a consumer wrapping the element in their OWN
|
|
35
|
+
* component and forwarding a slot) — and, when nothing is assigned, returns
|
|
36
|
+
* the slot's FALLBACK content.
|
|
37
|
+
*
|
|
38
|
+
* Only safe on a slot whose fallback is exactly the visible label. Do NOT set
|
|
39
|
+
* it on a slot whose fallback can render a non-name (an icon that happens to
|
|
40
|
+
* be plain text, say): the fallback would count as visible text and suppress
|
|
41
|
+
* the very `aria-label` that names the control. `kai-button`'s default slot
|
|
42
|
+
* has no fallback at all, so flatten there only buys the nested case;
|
|
43
|
+
* `kai-menu`'s trigger slot falls back to an icon, so it must not use it.
|
|
44
|
+
*/
|
|
45
|
+
flatten?: boolean;
|
|
46
|
+
}): {
|
|
47
|
+
/** Whether the slot is currently showing text. */
|
|
48
|
+
hasText: Accessor<boolean>;
|
|
49
|
+
/** `ref` for the `<slot>`. Re-reads on every `slotchange`. */
|
|
50
|
+
ref: (slot: HTMLSlotElement) => void;
|
|
51
|
+
};
|
package/dist/elements/slots.d.ts
CHANGED
|
@@ -111,6 +111,11 @@ export declare const COACHMARK_SLOTS: SlotDef[];
|
|
|
111
111
|
export declare const COACHMARK_PARTS: PartDef[];
|
|
112
112
|
/** Styleable `::part`s of `<kai-progress-bar>`. */
|
|
113
113
|
export declare const PROGRESS_BAR_PARTS: PartDef[];
|
|
114
|
+
/** Styleable `::part`s of `<kai-context>`. The usage meter is the same shared
|
|
115
|
+
* ProgressBar `<kai-progress-bar>` renders, mounted inside this element's own
|
|
116
|
+
* shadow root, so `kai-context` exposes the same two names. Both sit inside the
|
|
117
|
+
* hover-card breakdown and are in the DOM only while that card is open. */
|
|
118
|
+
export declare const CONTEXT_PARTS: PartDef[];
|
|
114
119
|
/** Styleable `::part`s of `<kai-file-tree>` — the changed-files / diff bits, shown
|
|
115
120
|
* only when a file carries diff metadata (or the `summary` attribute is set). */
|
|
116
121
|
export declare const FILE_TREE_PARTS: PartDef[];
|
|
@@ -128,6 +133,17 @@ export declare const FILE_TREE_PARTS: PartDef[];
|
|
|
128
133
|
export interface ElementComposition {
|
|
129
134
|
slots?: SlotDef[];
|
|
130
135
|
parts?: PartDef[];
|
|
136
|
+
/**
|
|
137
|
+
* What the element's DEFAULT (unnamed) `<slot>` projects — i.e. what a consumer
|
|
138
|
+
* puts between the tags. Kept OUT of `slots` on purpose: those arrays are also
|
|
139
|
+
* read at runtime by `readSlots()`, which would query a meaningless `[slot=""]`.
|
|
140
|
+
* scripts/gen-element-api.mjs merges it back in as a slot with the empty name,
|
|
141
|
+
* which is how the Custom Elements Manifest spells the default slot.
|
|
142
|
+
*
|
|
143
|
+
* Every facade that renders a bare `<slot />` needs one; guarded by
|
|
144
|
+
* tests/elements/slot-registry-coverage.test.ts.
|
|
145
|
+
*/
|
|
146
|
+
children?: string;
|
|
131
147
|
}
|
|
132
148
|
/** Slots + styleable `::part`s of `<kai-prompt-dock>`. */
|
|
133
149
|
export declare const PROMPT_DOCK_SLOTS: SlotDef[];
|
|
@@ -169,6 +185,11 @@ export declare const MENU_PARTS: PartDef[];
|
|
|
169
185
|
/** Slots of `<kai-thread>` (the standalone scrolling message list; messages come
|
|
170
186
|
* from the `messages` prop). */
|
|
171
187
|
export declare const THREAD_SLOTS: SlotDef[];
|
|
188
|
+
/** Slots of `<kai-empty>`. The body is the default slot; `media` is the named seam. */
|
|
189
|
+
export declare const EMPTY_SLOTS: SlotDef[];
|
|
190
|
+
/** Slots of `<kai-popover>`. The panel body is the default slot; `trigger` is the
|
|
191
|
+
* control the panel anchors to and opens from. */
|
|
192
|
+
export declare const POPOVER_SLOTS: SlotDef[];
|
|
172
193
|
/** Styleable `::part`s of `<kai-audio-visualizer>`. Every DOM variant (`bar`,
|
|
173
194
|
* `grid`, `radial`) shares the `bar`/`cell` markup pattern; the shader variants
|
|
174
195
|
* (`wave`, `aurora`) share the `canvas` part. Lit items ALSO carry the
|
package/dist/elements/source.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as o,c as t,S as v,g as p,o as w,h as m,F,j as A,t as S}from"./chunks/define-lE-QvQFn.js";import{a,b as c,c as l,S as k}from"./chunks/source-BoVcU5ok.js";var y=S("<style>:host{display:inline-flex}");o("kai-source",{href:"",label:void 0,headline:"",description:"",showFavicon:!1},(e,{flag:n})=>[y(),t(v,{get when(){return e.href},get children(){return t(a,{get href(){return e.href},get children(){return[t(c,{get label(){return e.label},get showFavicon(){return n("showFavicon")}}),t(l,{get title(){return e.headline??""},get description(){return e.description??""}})]}})}})]);function u(e){return{href:e.getAttribute("href")??"",label:e.getAttribute("label")??void 0,title:e.getAttribute("headline")??void 0,description:e.getAttribute("description")??void 0,showFavicon:e.hasAttribute("show-favicon")&&e.getAttribute("show-favicon")!=="false"}}o("kai-sources",{sources:[],showFavicon:!1,numbered:!1},(e,{element:n,flag:s})=>{const[h,d]=p([]);w(()=>{const r=()=>{const f=[...n.querySelectorAll("kai-source")];d(f.map(u))};r();const i=new MutationObserver(r);i.observe(n,{childList:!0,attributes:!0,subtree:!0}),m(()=>i.disconnect())});const g=()=>[...e.sources??[],...h()],b=()=>s("numbered");return t(k,{get children(){return t(F,{get each(){return g()},children:(r,i)=>t(a,{get href(){return r.href},get children(){return[t(c,{get label(){return A(()=>!!b())()?i()+1:r.label},get showFavicon(){return r.showFavicon??s("showFavicon")}}),t(l,{get title(){return r.title??""},get description(){return r.description??""}})]}})})}})});export{u as parseKaiSourceElement};
|