@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
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { createComponent as d, insert as A, effect as m, setAttribute as c, className as y, style as b, template as C } from "solid-js/web";
|
|
2
|
+
import { createEffect as g, createMemo as E, Show as x } from "solid-js";
|
|
3
|
+
import { c as S, D as N, S as k, h as w } from "./create-tween-DmTUaXWE.js";
|
|
4
|
+
import { s as M, C as T } from "./solid-BGYSJyHG.js";
|
|
5
|
+
var h = /* @__PURE__ */ C("<div>");
|
|
6
|
+
const O = {
|
|
7
|
+
"1f": !0,
|
|
8
|
+
"1i": !0,
|
|
9
|
+
"1fv": !0,
|
|
10
|
+
"2f": !0,
|
|
11
|
+
"3f": !0,
|
|
12
|
+
"3fv": !0,
|
|
13
|
+
"4f": !0,
|
|
14
|
+
"4fv": !0,
|
|
15
|
+
Matrix2fv: !0,
|
|
16
|
+
Matrix3fv: !0,
|
|
17
|
+
Matrix4fv: !0
|
|
18
|
+
}, R = /* @__PURE__ */ new Set(["1f", "1i"]), $ = {
|
|
19
|
+
"2f": 2,
|
|
20
|
+
"3f": 3,
|
|
21
|
+
"4f": 4,
|
|
22
|
+
Matrix2fv: 4,
|
|
23
|
+
Matrix3fv: 9,
|
|
24
|
+
Matrix4fv: 16
|
|
25
|
+
};
|
|
26
|
+
function I(e, t) {
|
|
27
|
+
if (t == null || typeof t != "object")
|
|
28
|
+
return `uniform "${e}" is not a valid declaration (expected an object with "type" and "value").`;
|
|
29
|
+
if (O[t.type] !== !0)
|
|
30
|
+
return `uniform "${e}" has an unrecognized type "${String(t.type)}".`;
|
|
31
|
+
if (R.has(t.type))
|
|
32
|
+
return typeof t.value != "number" || !Number.isFinite(t.value) ? `uniform "${e}" is declared "${t.type}" (a number) but its value is not a finite number.` : void 0;
|
|
33
|
+
if (!Array.isArray(t.value) || t.value.some((u) => typeof u != "number" || !Number.isFinite(u)))
|
|
34
|
+
return `uniform "${e}" is declared "${t.type}" (an array) but its value is not an array of finite numbers.`;
|
|
35
|
+
const o = $[t.type];
|
|
36
|
+
if (o !== void 0 && t.value.length !== o)
|
|
37
|
+
return `uniform "${e}" is declared "${t.type}", which takes exactly ${o} numbers, but its value has ${t.value.length}.`;
|
|
38
|
+
}
|
|
39
|
+
function F(e, t) {
|
|
40
|
+
const o = e.bands.length ? e.bands : [0], u = {
|
|
41
|
+
uColor: {
|
|
42
|
+
type: "3fv",
|
|
43
|
+
value: w(e.color)
|
|
44
|
+
},
|
|
45
|
+
uIntensity: {
|
|
46
|
+
type: "1f",
|
|
47
|
+
value: e.intensity
|
|
48
|
+
},
|
|
49
|
+
uSpeed: {
|
|
50
|
+
type: "1f",
|
|
51
|
+
value: e.speed
|
|
52
|
+
},
|
|
53
|
+
uComplexity: {
|
|
54
|
+
type: "1f",
|
|
55
|
+
value: e.complexity
|
|
56
|
+
},
|
|
57
|
+
uVolume: {
|
|
58
|
+
type: "1f",
|
|
59
|
+
value: e.volume
|
|
60
|
+
},
|
|
61
|
+
uBands: {
|
|
62
|
+
type: "1fv",
|
|
63
|
+
value: o,
|
|
64
|
+
arraySize: o.length
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
if (!t) return u;
|
|
68
|
+
for (const [l, f] of Object.entries(t)) {
|
|
69
|
+
const r = I(l, f);
|
|
70
|
+
if (r) throw new Error(r);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
...u,
|
|
74
|
+
...t
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function H(e) {
|
|
78
|
+
const t = S(0.3), o = S(1);
|
|
79
|
+
g(() => {
|
|
80
|
+
const r = M(e.state);
|
|
81
|
+
if (e.state === "speaking")
|
|
82
|
+
t.to(0.3 + 0.7 * e.volume, {
|
|
83
|
+
duration: 0
|
|
84
|
+
});
|
|
85
|
+
else {
|
|
86
|
+
const a = e.frozen ? {
|
|
87
|
+
duration: 0
|
|
88
|
+
} : {
|
|
89
|
+
duration: 0.5,
|
|
90
|
+
ease: "easeOut"
|
|
91
|
+
};
|
|
92
|
+
t.to(Array.isArray(r.intensity) && e.frozen ? r.intensity[0] : r.intensity, a);
|
|
93
|
+
}
|
|
94
|
+
o.to(e.frozen ? 0 : r.speed, {
|
|
95
|
+
duration: 0
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
const u = E(() => {
|
|
99
|
+
var r;
|
|
100
|
+
try {
|
|
101
|
+
return {
|
|
102
|
+
uniforms: F({
|
|
103
|
+
color: e.color ?? N,
|
|
104
|
+
intensity: t.value(),
|
|
105
|
+
speed: o.value(),
|
|
106
|
+
complexity: e.complexity ?? 0.5,
|
|
107
|
+
volume: e.volume,
|
|
108
|
+
bands: e.bands
|
|
109
|
+
}, (r = e.shader) == null ? void 0 : r.uniforms)
|
|
110
|
+
};
|
|
111
|
+
} catch (a) {
|
|
112
|
+
return {
|
|
113
|
+
error: a instanceof Error ? a.message : String(a)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
let l = !1;
|
|
118
|
+
g(() => {
|
|
119
|
+
const {
|
|
120
|
+
error: r
|
|
121
|
+
} = u();
|
|
122
|
+
if (!r) {
|
|
123
|
+
l = !1;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
l || (l = !0, console.error(`<kai-audio-visualizer variant="custom">: ${r}`), e.onUnavailable());
|
|
127
|
+
});
|
|
128
|
+
const f = () => ({
|
|
129
|
+
height: `${T[e.size]}px`,
|
|
130
|
+
"aspect-ratio": "1"
|
|
131
|
+
});
|
|
132
|
+
return d(x, {
|
|
133
|
+
get when() {
|
|
134
|
+
var r;
|
|
135
|
+
return (r = e.shader) == null ? void 0 : r.fragment;
|
|
136
|
+
},
|
|
137
|
+
get fallback() {
|
|
138
|
+
return (() => {
|
|
139
|
+
var r = h();
|
|
140
|
+
return m((a) => {
|
|
141
|
+
var i = e.state, n = e.class, s = f();
|
|
142
|
+
return i !== a.e && c(r, "data-kai-state", a.e = i), n !== a.t && y(r, a.t = n), a.a = b(r, s, a.a), a;
|
|
143
|
+
}, {
|
|
144
|
+
e: void 0,
|
|
145
|
+
t: void 0,
|
|
146
|
+
a: void 0
|
|
147
|
+
}), r;
|
|
148
|
+
})();
|
|
149
|
+
},
|
|
150
|
+
children: (r) => d(x, {
|
|
151
|
+
get when() {
|
|
152
|
+
return u().uniforms;
|
|
153
|
+
},
|
|
154
|
+
get fallback() {
|
|
155
|
+
return (() => {
|
|
156
|
+
var a = h();
|
|
157
|
+
return m((i) => {
|
|
158
|
+
var n = e.state, s = e.class, v = f();
|
|
159
|
+
return n !== i.e && c(a, "data-kai-state", i.e = n), s !== i.t && y(a, i.t = s), i.a = b(a, v, i.a), i;
|
|
160
|
+
}, {
|
|
161
|
+
e: void 0,
|
|
162
|
+
t: void 0,
|
|
163
|
+
a: void 0
|
|
164
|
+
}), a;
|
|
165
|
+
})();
|
|
166
|
+
},
|
|
167
|
+
children: (a) => (() => {
|
|
168
|
+
var i = h();
|
|
169
|
+
return A(i, d(k, {
|
|
170
|
+
get fragment() {
|
|
171
|
+
return r();
|
|
172
|
+
},
|
|
173
|
+
get precision() {
|
|
174
|
+
return e.size === "icon" || e.size === "sm" ? "mediump" : "highp";
|
|
175
|
+
},
|
|
176
|
+
get uniforms() {
|
|
177
|
+
return a();
|
|
178
|
+
},
|
|
179
|
+
get animateWhenNotVisible() {
|
|
180
|
+
return e.animateWhenNotVisible;
|
|
181
|
+
},
|
|
182
|
+
onError: (n) => {
|
|
183
|
+
/not available/i.test(n) ? console.warn('<kai-audio-visualizer variant="custom">: shader unavailable', n) : console.error('<kai-audio-visualizer variant="custom">: shader error', n), e.onUnavailable();
|
|
184
|
+
}
|
|
185
|
+
})), m((n) => {
|
|
186
|
+
var s = e.state, v = e.class, z = f();
|
|
187
|
+
return s !== n.e && c(i, "data-kai-state", n.e = s), v !== n.t && y(i, n.t = v), n.a = b(i, z, n.a), n;
|
|
188
|
+
}, {
|
|
189
|
+
e: void 0,
|
|
190
|
+
t: void 0,
|
|
191
|
+
a: void 0
|
|
192
|
+
}), i;
|
|
193
|
+
})()
|
|
194
|
+
})
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
export {
|
|
198
|
+
F as customUniforms,
|
|
199
|
+
H as default
|
|
200
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as p,s as m,c as h,a as x,C as g,t as y,w as b}from"./register-impl-
|
|
1
|
+
import{i as p,s as m,c as h,a as x,C as g,t as y,w as b}from"./register-impl-AxIlqjo7.js";import{d as v,j as w,b as C}from"./kai.es.js";import{c as r,h as z,S,D as U}from"./create-tween-qs-jjvNA.js";const F=`
|
|
2
2
|
const float TAU = 6.28318530718;
|
|
3
3
|
|
|
4
4
|
// Noise for dithering
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { insert as m, createComponent as h, effect as p, setAttribute as x, className as g, setStyleProperty as y, template as b } from "solid-js/web";
|
|
2
|
+
import { createEffect as v } from "solid-js";
|
|
3
|
+
import { c as r, S as w, h as C, D as S } from "./create-tween-DmTUaXWE.js";
|
|
4
|
+
import { C as z, w as U } from "./solid-BGYSJyHG.js";
|
|
5
|
+
const A = `
|
|
6
|
+
const float TAU = 6.28318530718;
|
|
7
|
+
|
|
8
|
+
// Noise for dithering
|
|
9
|
+
vec2 randFibo(vec2 p) {
|
|
10
|
+
p = fract(p * vec2(443.897, 441.423));
|
|
11
|
+
p += dot(p, p.yx + 19.19);
|
|
12
|
+
return fract((p.xx + p.yx) * p.xy);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Luma for alpha
|
|
16
|
+
float luma(vec3 color) {
|
|
17
|
+
return dot(color, vec3(0.299, 0.587, 0.114));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// RGB to HSV
|
|
21
|
+
vec3 rgb2hsv(vec3 c) {
|
|
22
|
+
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
23
|
+
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
24
|
+
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
25
|
+
float d = q.x - min(q.w, q.y);
|
|
26
|
+
float e = 1.0e-10;
|
|
27
|
+
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// HSV to RGB
|
|
31
|
+
vec3 hsv2rgb(vec3 c) {
|
|
32
|
+
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
33
|
+
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
34
|
+
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Bell curve function for attenuation from center with rounded top
|
|
38
|
+
float bellCurve(float distanceFromCenter, float maxDistance) {
|
|
39
|
+
float normalizedDistance = distanceFromCenter / maxDistance;
|
|
40
|
+
// Use cosine with high power for smooth rounded top
|
|
41
|
+
return pow(cos(normalizedDistance * (3.14159265359 / 4.0)), 16.0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Calculate the sine wave
|
|
45
|
+
float oscilloscopeWave(float x, float centerX, float time) {
|
|
46
|
+
float relativeX = x - centerX;
|
|
47
|
+
float maxDistance = centerX;
|
|
48
|
+
float distanceFromCenter = abs(relativeX);
|
|
49
|
+
|
|
50
|
+
// Apply bell curve for amplitude attenuation
|
|
51
|
+
float bell = bellCurve(distanceFromCenter, maxDistance);
|
|
52
|
+
|
|
53
|
+
// Calculate wave with uniforms and bell curve attenuation
|
|
54
|
+
float wave = sin(relativeX * uFrequency + time * uSpeed) * uAmplitude * bell;
|
|
55
|
+
|
|
56
|
+
return wave;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
60
|
+
vec2 uv = fragCoord / iResolution.xy;
|
|
61
|
+
vec2 pos = uv - 0.5;
|
|
62
|
+
|
|
63
|
+
// Calculate center and positions
|
|
64
|
+
float centerX = 0.5;
|
|
65
|
+
float centerY = 0.5;
|
|
66
|
+
float x = uv.x;
|
|
67
|
+
float y = uv.y;
|
|
68
|
+
|
|
69
|
+
// Convert line width from pixels to UV space
|
|
70
|
+
// Use the average of width and height to handle aspect ratio
|
|
71
|
+
float pixelSize = 2.0 / (iResolution.x + iResolution.y);
|
|
72
|
+
float lineWidthUV = uLineWidth * pixelSize;
|
|
73
|
+
float smoothingUV = uSmoothing * pixelSize;
|
|
74
|
+
|
|
75
|
+
// Find minimum distance to the wave by sampling nearby points
|
|
76
|
+
// This gives us consistent line width without high-frequency artifacts
|
|
77
|
+
const int NUM_SAMPLES = 50; // Must be const for GLSL loop
|
|
78
|
+
float minDist = 1000.0;
|
|
79
|
+
float sampleRange = 0.02; // Range to search for closest point
|
|
80
|
+
|
|
81
|
+
for(int i = 0; i < NUM_SAMPLES; i++) {
|
|
82
|
+
float offset = (float(i) / float(NUM_SAMPLES - 1) - 0.5) * sampleRange;
|
|
83
|
+
float sampleX = x + offset;
|
|
84
|
+
float waveY = centerY + oscilloscopeWave(sampleX, centerX, iTime);
|
|
85
|
+
|
|
86
|
+
// Calculate distance from current pixel to this point on the wave
|
|
87
|
+
vec2 wavePoint = vec2(sampleX, waveY);
|
|
88
|
+
vec2 currentPoint = vec2(x, y);
|
|
89
|
+
float dist = distance(currentPoint, wavePoint);
|
|
90
|
+
|
|
91
|
+
minDist = min(minDist, dist);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Solid line with smooth edges using minimum distance
|
|
95
|
+
float line = smoothstep(lineWidthUV + smoothingUV, lineWidthUV - smoothingUV, minDist);
|
|
96
|
+
|
|
97
|
+
vec3 color = uColor;
|
|
98
|
+
if(abs(uColorShift) > 0.01) {
|
|
99
|
+
// Keep the center 50% at base color, then ramp shift across outer 25% on each side.
|
|
100
|
+
float centerBandHalfWidth = 0.2;
|
|
101
|
+
float edgeBandWidth = 0.5;
|
|
102
|
+
float distanceFromCenter = abs(x - centerX);
|
|
103
|
+
float edgeFactor = clamp((distanceFromCenter - centerBandHalfWidth) / edgeBandWidth, 0.0, 1.0);
|
|
104
|
+
vec3 hsv = rgb2hsv(color);
|
|
105
|
+
// Hue shift is zero in the center band and strongest at far edges.
|
|
106
|
+
hsv.x = fract(hsv.x + edgeFactor * uColorShift * 0.3);
|
|
107
|
+
color = hsv2rgb(hsv);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Apply line intensity
|
|
111
|
+
color *= line;
|
|
112
|
+
|
|
113
|
+
// Add dithering for smoother gradients
|
|
114
|
+
// color += (randFibo(fragCoord).x - 0.5) / 255.0;
|
|
115
|
+
|
|
116
|
+
// Calculate alpha based on line intensity
|
|
117
|
+
float alpha = line * uMix;
|
|
118
|
+
|
|
119
|
+
fragColor = vec4(color * uMix, alpha);
|
|
120
|
+
}`;
|
|
121
|
+
var F = /* @__PURE__ */ b('<div style="aspect-ratio:1;mask-image:linear-gradient(90deg, transparent 0%, black 20%, black 80%, transparent 100%)">');
|
|
122
|
+
const W = 0.5, q = 0.05;
|
|
123
|
+
function X(e) {
|
|
124
|
+
const o = r(0), i = r(0), l = r(1), n = () => U(e.state), c = () => e.frozen ? {
|
|
125
|
+
duration: 0
|
|
126
|
+
} : {
|
|
127
|
+
duration: 0.2,
|
|
128
|
+
ease: "easeOut"
|
|
129
|
+
};
|
|
130
|
+
v(() => {
|
|
131
|
+
const a = n(), t = Array.isArray(a.opacity) && e.frozen ? a.opacity[0] : a.opacity;
|
|
132
|
+
l.to(t, e.frozen ? {
|
|
133
|
+
duration: 0
|
|
134
|
+
} : {
|
|
135
|
+
duration: a.pulseDuration || 0.2
|
|
136
|
+
});
|
|
137
|
+
}), v(() => {
|
|
138
|
+
if (e.state === "speaking") {
|
|
139
|
+
const t = e.volume;
|
|
140
|
+
o.to(0.015 + 0.4 * t, {
|
|
141
|
+
duration: 0
|
|
142
|
+
}), i.to(20 + 60 * t, {
|
|
143
|
+
duration: 0
|
|
144
|
+
});
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const a = n();
|
|
148
|
+
o.to(a.amplitude, c()), i.to(a.frequency, c());
|
|
149
|
+
});
|
|
150
|
+
const d = () => e.size === "icon" || e.size === "sm" ? 2 : 1;
|
|
151
|
+
return (() => {
|
|
152
|
+
var a = F();
|
|
153
|
+
return m(a, h(w, {
|
|
154
|
+
fragment: A,
|
|
155
|
+
get precision() {
|
|
156
|
+
return e.size === "icon" || e.size === "sm" ? "mediump" : "highp";
|
|
157
|
+
},
|
|
158
|
+
get uniforms() {
|
|
159
|
+
return {
|
|
160
|
+
// uSpeed drives the shader's own time-based phase animation, not a
|
|
161
|
+
// tween -- so frozen (prefers-reduced-motion) must zero it directly
|
|
162
|
+
// rather than relying on any tween's instant-landing logic. uAmplitude
|
|
163
|
+
// and uFrequency stay as their frozen-collapsed values: they shape a
|
|
164
|
+
// static wave, they do not move it, so the result is a still picture
|
|
165
|
+
// of the wave rather than a flat line.
|
|
166
|
+
uSpeed: {
|
|
167
|
+
type: "1f",
|
|
168
|
+
value: e.frozen ? 0 : n().speed
|
|
169
|
+
},
|
|
170
|
+
uAmplitude: {
|
|
171
|
+
type: "1f",
|
|
172
|
+
value: o.value()
|
|
173
|
+
},
|
|
174
|
+
uFrequency: {
|
|
175
|
+
type: "1f",
|
|
176
|
+
value: i.value()
|
|
177
|
+
},
|
|
178
|
+
uMix: {
|
|
179
|
+
type: "1f",
|
|
180
|
+
value: l.value()
|
|
181
|
+
},
|
|
182
|
+
uLineWidth: {
|
|
183
|
+
type: "1f",
|
|
184
|
+
value: d()
|
|
185
|
+
},
|
|
186
|
+
uSmoothing: {
|
|
187
|
+
type: "1f",
|
|
188
|
+
value: W
|
|
189
|
+
},
|
|
190
|
+
uColor: {
|
|
191
|
+
type: "3fv",
|
|
192
|
+
value: C(e.color ?? S)
|
|
193
|
+
},
|
|
194
|
+
uColorShift: {
|
|
195
|
+
type: "1f",
|
|
196
|
+
value: q
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
get animateWhenNotVisible() {
|
|
201
|
+
return e.animateWhenNotVisible;
|
|
202
|
+
},
|
|
203
|
+
onError: (t) => {
|
|
204
|
+
console.warn('<kai-audio-visualizer variant="wave">: shader error', t), e.onUnavailable();
|
|
205
|
+
}
|
|
206
|
+
})), p((t) => {
|
|
207
|
+
var s = e.state, u = e.class, f = `${z[e.size]}px`;
|
|
208
|
+
return s !== t.e && x(a, "data-kai-state", t.e = s), u !== t.t && g(a, t.t = u), f !== t.a && y(a, "height", t.a = f), t;
|
|
209
|
+
}, {
|
|
210
|
+
e: void 0,
|
|
211
|
+
t: void 0,
|
|
212
|
+
a: void 0
|
|
213
|
+
}), a;
|
|
214
|
+
})();
|
|
215
|
+
}
|
|
216
|
+
export {
|
|
217
|
+
X as default
|
|
218
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { ssr as m, ssrAttribute as f, escape as o, ssrStyleProperty as l, createComponent as h } from "solid-js/web";
|
|
2
|
+
import { createEffect as d } from "solid-js";
|
|
3
|
+
import { c, S as p, h as x, D as g } from "./create-tween-COnPwAQN.js";
|
|
4
|
+
import { C as y, w as b } from "./solid-Dt2nEwfl.js";
|
|
5
|
+
const w = `
|
|
6
|
+
const float TAU = 6.28318530718;
|
|
7
|
+
|
|
8
|
+
// Noise for dithering
|
|
9
|
+
vec2 randFibo(vec2 p) {
|
|
10
|
+
p = fract(p * vec2(443.897, 441.423));
|
|
11
|
+
p += dot(p, p.yx + 19.19);
|
|
12
|
+
return fract((p.xx + p.yx) * p.xy);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Luma for alpha
|
|
16
|
+
float luma(vec3 color) {
|
|
17
|
+
return dot(color, vec3(0.299, 0.587, 0.114));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// RGB to HSV
|
|
21
|
+
vec3 rgb2hsv(vec3 c) {
|
|
22
|
+
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
23
|
+
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
24
|
+
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
25
|
+
float d = q.x - min(q.w, q.y);
|
|
26
|
+
float e = 1.0e-10;
|
|
27
|
+
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// HSV to RGB
|
|
31
|
+
vec3 hsv2rgb(vec3 c) {
|
|
32
|
+
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
33
|
+
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
34
|
+
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Bell curve function for attenuation from center with rounded top
|
|
38
|
+
float bellCurve(float distanceFromCenter, float maxDistance) {
|
|
39
|
+
float normalizedDistance = distanceFromCenter / maxDistance;
|
|
40
|
+
// Use cosine with high power for smooth rounded top
|
|
41
|
+
return pow(cos(normalizedDistance * (3.14159265359 / 4.0)), 16.0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Calculate the sine wave
|
|
45
|
+
float oscilloscopeWave(float x, float centerX, float time) {
|
|
46
|
+
float relativeX = x - centerX;
|
|
47
|
+
float maxDistance = centerX;
|
|
48
|
+
float distanceFromCenter = abs(relativeX);
|
|
49
|
+
|
|
50
|
+
// Apply bell curve for amplitude attenuation
|
|
51
|
+
float bell = bellCurve(distanceFromCenter, maxDistance);
|
|
52
|
+
|
|
53
|
+
// Calculate wave with uniforms and bell curve attenuation
|
|
54
|
+
float wave = sin(relativeX * uFrequency + time * uSpeed) * uAmplitude * bell;
|
|
55
|
+
|
|
56
|
+
return wave;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
60
|
+
vec2 uv = fragCoord / iResolution.xy;
|
|
61
|
+
vec2 pos = uv - 0.5;
|
|
62
|
+
|
|
63
|
+
// Calculate center and positions
|
|
64
|
+
float centerX = 0.5;
|
|
65
|
+
float centerY = 0.5;
|
|
66
|
+
float x = uv.x;
|
|
67
|
+
float y = uv.y;
|
|
68
|
+
|
|
69
|
+
// Convert line width from pixels to UV space
|
|
70
|
+
// Use the average of width and height to handle aspect ratio
|
|
71
|
+
float pixelSize = 2.0 / (iResolution.x + iResolution.y);
|
|
72
|
+
float lineWidthUV = uLineWidth * pixelSize;
|
|
73
|
+
float smoothingUV = uSmoothing * pixelSize;
|
|
74
|
+
|
|
75
|
+
// Find minimum distance to the wave by sampling nearby points
|
|
76
|
+
// This gives us consistent line width without high-frequency artifacts
|
|
77
|
+
const int NUM_SAMPLES = 50; // Must be const for GLSL loop
|
|
78
|
+
float minDist = 1000.0;
|
|
79
|
+
float sampleRange = 0.02; // Range to search for closest point
|
|
80
|
+
|
|
81
|
+
for(int i = 0; i < NUM_SAMPLES; i++) {
|
|
82
|
+
float offset = (float(i) / float(NUM_SAMPLES - 1) - 0.5) * sampleRange;
|
|
83
|
+
float sampleX = x + offset;
|
|
84
|
+
float waveY = centerY + oscilloscopeWave(sampleX, centerX, iTime);
|
|
85
|
+
|
|
86
|
+
// Calculate distance from current pixel to this point on the wave
|
|
87
|
+
vec2 wavePoint = vec2(sampleX, waveY);
|
|
88
|
+
vec2 currentPoint = vec2(x, y);
|
|
89
|
+
float dist = distance(currentPoint, wavePoint);
|
|
90
|
+
|
|
91
|
+
minDist = min(minDist, dist);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Solid line with smooth edges using minimum distance
|
|
95
|
+
float line = smoothstep(lineWidthUV + smoothingUV, lineWidthUV - smoothingUV, minDist);
|
|
96
|
+
|
|
97
|
+
vec3 color = uColor;
|
|
98
|
+
if(abs(uColorShift) > 0.01) {
|
|
99
|
+
// Keep the center 50% at base color, then ramp shift across outer 25% on each side.
|
|
100
|
+
float centerBandHalfWidth = 0.2;
|
|
101
|
+
float edgeBandWidth = 0.5;
|
|
102
|
+
float distanceFromCenter = abs(x - centerX);
|
|
103
|
+
float edgeFactor = clamp((distanceFromCenter - centerBandHalfWidth) / edgeBandWidth, 0.0, 1.0);
|
|
104
|
+
vec3 hsv = rgb2hsv(color);
|
|
105
|
+
// Hue shift is zero in the center band and strongest at far edges.
|
|
106
|
+
hsv.x = fract(hsv.x + edgeFactor * uColorShift * 0.3);
|
|
107
|
+
color = hsv2rgb(hsv);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Apply line intensity
|
|
111
|
+
color *= line;
|
|
112
|
+
|
|
113
|
+
// Add dithering for smoother gradients
|
|
114
|
+
// color += (randFibo(fragCoord).x - 0.5) / 255.0;
|
|
115
|
+
|
|
116
|
+
// Calculate alpha based on line intensity
|
|
117
|
+
float alpha = line * uMix;
|
|
118
|
+
|
|
119
|
+
fragColor = vec4(color * uMix, alpha);
|
|
120
|
+
}`;
|
|
121
|
+
var C = ["<div", ' style="', '">', "</div>"];
|
|
122
|
+
const S = 0.5, z = 0.05;
|
|
123
|
+
function q(e) {
|
|
124
|
+
const i = c(0), n = c(0), s = c(1), r = () => b(e.state), u = () => e.frozen ? {
|
|
125
|
+
duration: 0
|
|
126
|
+
} : {
|
|
127
|
+
duration: 0.2,
|
|
128
|
+
ease: "easeOut"
|
|
129
|
+
};
|
|
130
|
+
d(() => {
|
|
131
|
+
const t = r(), a = Array.isArray(t.opacity) && e.frozen ? t.opacity[0] : t.opacity;
|
|
132
|
+
s.to(a, e.frozen ? {
|
|
133
|
+
duration: 0
|
|
134
|
+
} : {
|
|
135
|
+
duration: t.pulseDuration || 0.2
|
|
136
|
+
});
|
|
137
|
+
}), d(() => {
|
|
138
|
+
if (e.state === "speaking") {
|
|
139
|
+
const a = e.volume;
|
|
140
|
+
i.to(0.015 + 0.4 * a, {
|
|
141
|
+
duration: 0
|
|
142
|
+
}), n.to(20 + 60 * a, {
|
|
143
|
+
duration: 0
|
|
144
|
+
});
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const t = r();
|
|
148
|
+
i.to(t.amplitude, u()), n.to(t.frequency, u());
|
|
149
|
+
});
|
|
150
|
+
const v = () => e.size === "icon" || e.size === "sm" ? 2 : 1;
|
|
151
|
+
return m(C, f("data-kai-state", o(e.state, !0), !1) + f("class", o(e.class, !0), !1), l("height:", `${o(y[e.size], !0)}px`) + l(";aspect-ratio:", "1") + l(";mask-image:", "linear-gradient(90deg, transparent 0%, black 20%, black 80%, transparent 100%)"), o(h(p, {
|
|
152
|
+
fragment: w,
|
|
153
|
+
get precision() {
|
|
154
|
+
return e.size === "icon" || e.size === "sm" ? "mediump" : "highp";
|
|
155
|
+
},
|
|
156
|
+
get uniforms() {
|
|
157
|
+
return {
|
|
158
|
+
// uSpeed drives the shader's own time-based phase animation, not a
|
|
159
|
+
// tween -- so frozen (prefers-reduced-motion) must zero it directly
|
|
160
|
+
// rather than relying on any tween's instant-landing logic. uAmplitude
|
|
161
|
+
// and uFrequency stay as their frozen-collapsed values: they shape a
|
|
162
|
+
// static wave, they do not move it, so the result is a still picture
|
|
163
|
+
// of the wave rather than a flat line.
|
|
164
|
+
uSpeed: {
|
|
165
|
+
type: "1f",
|
|
166
|
+
value: e.frozen ? 0 : r().speed
|
|
167
|
+
},
|
|
168
|
+
uAmplitude: {
|
|
169
|
+
type: "1f",
|
|
170
|
+
value: i.value()
|
|
171
|
+
},
|
|
172
|
+
uFrequency: {
|
|
173
|
+
type: "1f",
|
|
174
|
+
value: n.value()
|
|
175
|
+
},
|
|
176
|
+
uMix: {
|
|
177
|
+
type: "1f",
|
|
178
|
+
value: s.value()
|
|
179
|
+
},
|
|
180
|
+
uLineWidth: {
|
|
181
|
+
type: "1f",
|
|
182
|
+
value: v()
|
|
183
|
+
},
|
|
184
|
+
uSmoothing: {
|
|
185
|
+
type: "1f",
|
|
186
|
+
value: S
|
|
187
|
+
},
|
|
188
|
+
uColor: {
|
|
189
|
+
type: "3fv",
|
|
190
|
+
value: x(e.color ?? g)
|
|
191
|
+
},
|
|
192
|
+
uColorShift: {
|
|
193
|
+
type: "1f",
|
|
194
|
+
value: z
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
get animateWhenNotVisible() {
|
|
199
|
+
return e.animateWhenNotVisible;
|
|
200
|
+
},
|
|
201
|
+
onError: (t) => {
|
|
202
|
+
console.warn('<kai-audio-visualizer variant="wave">: shader error', t), e.onUnavailable();
|
|
203
|
+
}
|
|
204
|
+
})));
|
|
205
|
+
}
|
|
206
|
+
export {
|
|
207
|
+
q as default
|
|
208
|
+
};
|