@kitn.ai/ui 0.20.0 → 0.21.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 +68 -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-D3Y5qiij.js +338 -0
- package/dist/create-tween-DGKY1FDY.js +341 -0
- package/dist/create-tween-paho5Rh-.js +7 -0
- package/dist/custom-elements.json +1681 -454
- 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-C-2LvGDG.js} +1 -1
- package/dist/elements/chunks/{action-icons-ns1Fnedj.js → action-icons-CaYoImEk.js} +1 -1
- package/dist/elements/chunks/arrow-left-Bb46H7w9.js +1 -0
- package/dist/elements/chunks/artifact-BBIscOxJ.js +1 -0
- package/dist/elements/chunks/{attachments-mCB5F1Fq.js → attachments-BB56zoji.js} +1 -1
- package/dist/elements/chunks/audio-visualizer-BxOx4THz.js +1 -0
- package/dist/elements/chunks/{badge-B4Zuajl2.js → badge-SxLSZ19R.js} +1 -1
- package/dist/elements/chunks/{button-ZWNif3--.js → button-CmkUkz6c.js} +1 -1
- package/dist/elements/chunks/card-renderer-Db4ffkWv.js +1 -0
- package/dist/elements/chunks/card-tags-D8lZ-C_U.js +1 -0
- package/dist/elements/chunks/chat-thread-B3Ks-cKr.js +1 -0
- package/dist/elements/chunks/check-C8desc_h.js +1 -0
- package/dist/elements/chunks/chevron-down-DKtc2HNB.js +1 -0
- package/dist/elements/chunks/chevron-right-Dw4GPhwL.js +1 -0
- package/dist/elements/chunks/choice-card-Q9cYYDyM.js +1 -0
- package/dist/elements/chunks/circle-BeokBsvB.js +1 -0
- package/dist/elements/chunks/circle-check-wJSqt859.js +1 -0
- package/dist/elements/chunks/{circle-x-B7faJFlY.js → circle-x-D0MEfxOM.js} +1 -1
- package/dist/elements/chunks/code-block-C8VzAraE.js +1 -0
- package/dist/elements/chunks/{collapsible-DM1Ckd4e.js → collapsible-Cvj61obE.js} +1 -1
- package/dist/elements/chunks/{composer-BguS0QL_.js → composer-D86ztyL0.js} +2 -2
- package/dist/elements/chunks/confirm-card-BdyDAGLw.js +1 -0
- package/dist/elements/chunks/context-WHDl-xSx.js +1 -0
- package/dist/elements/chunks/conversation-list-CdR14_Y4.js +1 -0
- package/dist/elements/chunks/create-tween-C_A_B638.js +7 -0
- package/dist/elements/chunks/{default-input-Cqqilg9t.js → default-input-CSZqUM81.js} +1 -1
- package/dist/elements/chunks/define-BzPnNsXg.js +1 -0
- package/dist/elements/chunks/{disclosure-CIZ5c8nO.js → disclosure-DVKsoc1F.js} +1 -1
- package/dist/elements/chunks/{download-Dsbg3ste.js → download-BjA54IMJ.js} +1 -1
- package/dist/elements/chunks/{dropdown-BDd1-Zgi.js → dropdown-BjVVHWXH.js} +1 -1
- package/dist/elements/chunks/{ellipsis-Dw6qrss-.js → ellipsis-BNedmqfi.js} +1 -1
- package/dist/elements/chunks/embed-DQsl4XEq.js +1 -0
- package/dist/elements/chunks/{external-link-Vt74zAoL.js → external-link-Di-dw2CU.js} +1 -1
- package/dist/elements/chunks/{file-text-CZrZF6_v.js → file-text-B3sAODCV.js} +1 -1
- package/dist/elements/chunks/{file-tree-DF4okKyo.js → file-tree-Dgto-bMn.js} +1 -1
- package/dist/elements/chunks/{folder-glP5rha4.js → folder-D6rMadFV.js} +1 -1
- package/dist/elements/chunks/form-CILxvhQ7.js +1 -0
- package/dist/elements/chunks/hover-card-BtiF4XiU.js +1 -0
- package/dist/elements/chunks/{icon-BLb8beoi.js → icon-DKkmze3y.js} +1 -1
- package/dist/elements/chunks/{info-CIsv92JK.js → info-CWRjZkuy.js} +1 -1
- package/dist/elements/chunks/{input-Dds1kFyt.js → input--QJBK6BA.js} +1 -1
- package/dist/elements/chunks/{kbd-De_xbgi9.js → kbd-C3zuKh8R.js} +1 -1
- package/dist/elements/chunks/{link-i4r_k7z4.js → link-BL5JA7Q0.js} +1 -1
- package/dist/elements/chunks/link-preview-CU37bbXh.js +1 -0
- package/dist/elements/chunks/{loader-BmQH4s3V.js → loader-XmpyxyRH.js} +1 -1
- package/dist/elements/chunks/{markdown-Zi21WhUz.js → markdown-3Gv5UZ_o.js} +1 -1
- package/dist/elements/chunks/message-CnBA2OUt.js +1 -0
- package/dist/elements/chunks/message-X5NZbq-W.js +1 -0
- package/dist/elements/chunks/message-square-CnpAm_P0.js +1 -0
- package/dist/elements/chunks/{minimize-2--ifeCGrl.js → minimize-2-DwyrUTcM.js} +1 -1
- package/dist/elements/chunks/{model-switcher-B94YAKsM.js → model-switcher-CclaJEHt.js} +1 -1
- package/dist/elements/chunks/{overlay-kD8dwRv_.js → overlay-Cepd-KcS.js} +1 -1
- package/dist/elements/chunks/{paperclip-q21dYOSK.js → paperclip-CdwKjrlu.js} +1 -1
- package/dist/elements/chunks/{progress-bar-BrAIIaaJ.js → progress-bar-DMVXBD3b.js} +1 -1
- package/dist/elements/chunks/{prompt-suggestion-Bjn2K-fR.js → prompt-suggestion-Di_WZE_5.js} +1 -1
- package/dist/elements/chunks/reasoning-D0jMch5u.js +1 -0
- package/dist/elements/chunks/{resizable-Dp4JExql.js → resizable-1znbL1Gv.js} +1 -1
- package/dist/elements/chunks/{rotate-cw-CFWWkpj2.js → rotate-cw-DVhhgx8n.js} +1 -1
- package/dist/elements/chunks/{scroll-area-Bb0kHH1j.js → scroll-area-Bs4bFS1P.js} +1 -1
- package/dist/elements/chunks/scroll-button-Bet5NLc4.js +1 -0
- package/dist/elements/chunks/{separator-9kRgr1X9.js → separator-C5Gh8qGC.js} +1 -1
- package/dist/elements/chunks/{settings-B8lmec4D.js → settings-5vmEFg0K.js} +1 -1
- package/dist/elements/chunks/{settings-group-I0hEuXiN.js → settings-group-BWLB38kz.js} +1 -1
- package/dist/elements/chunks/{share-C3lTiYGt.js → share-BZ3G_DaB.js} +1 -1
- package/dist/elements/chunks/skeleton-DafPJQTp.js +1 -0
- package/dist/elements/chunks/slots-CIw9RlAe.js +1 -0
- package/dist/elements/chunks/source-D_qj_6uJ.js +1 -0
- package/dist/elements/chunks/{star-CSJtGxgv.js → star-Cuv7j2IE.js} +1 -1
- package/dist/elements/chunks/{store-CHyW95TP.js → store-C1StPHfW.js} +1 -1
- package/dist/elements/chunks/tasks-card-EyoBZfpA.js +1 -0
- package/dist/elements/chunks/{text-shimmer-Cn9TmNpI.js → text-shimmer-D9gRSh34.js} +1 -1
- package/dist/elements/chunks/textarea-DuhtHfcm.js +1 -0
- package/dist/elements/chunks/{thumbs-up-PNVVThEF.js → thumbs-up-B9hwv43w.js} +1 -1
- package/dist/elements/chunks/{toast-store-DKbQn3Wn.js → toast-store-Bm3DUEDe.js} +1 -1
- package/dist/elements/chunks/{tool-DjTRpIpl.js → tool-CDtW7L0z.js} +1 -1
- package/dist/elements/chunks/tooltip-eB226mGK.js +1 -0
- package/dist/elements/chunks/{triangle-alert-DsHTHCPm.js → triangle-alert-C1SNzTqK.js} +1 -1
- package/dist/elements/chunks/use-card-resolution-YZh2MvI5.js +1 -0
- package/dist/elements/chunks/{variant-aurora-Dc4nQUia.js → variant-aurora-Cj1F7D0l.js} +2 -2
- package/dist/elements/chunks/{variant-custom-y_3kVQhS.js → variant-custom-T9gpt7QE.js} +1 -1
- package/dist/elements/chunks/{variant-wave-D5OR1-9Z.js → variant-wave-CxU9z-TE.js} +2 -2
- package/dist/elements/chunks/{video-B7vmenoC.js → video-CK4R7Rus.js} +1 -1
- package/dist/elements/chunks/x-D1qx0aLd.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 +7 -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 +2 -2
- 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/slots.d.ts +16 -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 +2725 -214
- package/dist/index.d.ts +163 -125
- package/dist/index.js +6336 -5802
- package/dist/index.server.d.ts +5 -0
- package/dist/index.server.js +16913 -0
- 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 +762 -148
- package/dist/llms/llms.txt +57 -5
- package/dist/mcp.es.js +4010 -770
- 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 +717 -299
- package/dist/react/use-kai-chat.d.ts +8 -4
- package/dist/react.d.ts +5 -0
- package/dist/react.js +417 -316
- package/dist/register-impl-bzrZ44ft.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-BCJUQqwS.js +22750 -0
- package/dist/solid-BdENBcEq.js +20108 -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-1wMcXRUS.js +381 -0
- package/dist/variant-aurora-BKHHiOgL.js +391 -0
- package/dist/{variant-aurora-DVtGqVH6.js → variant-aurora-DOb_o4pC.js} +1 -1
- package/dist/{variant-custom-Dif-IV4u.js → variant-custom-CJGB0Kbw.js} +1 -1
- package/dist/variant-custom-Co0CkXJF.js +200 -0
- package/dist/variant-custom-DWSSgmd2.js +170 -0
- package/dist/variant-wave-C3-45cL6.js +218 -0
- package/dist/{variant-wave-DbfNdvSi.js → variant-wave-CEODq-9q.js} +1 -1
- package/dist/variant-wave-jdXBnCUZ.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 +148 -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 +14 -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 +898 -0
- package/frameworks/react/index.tsx +183 -154
- package/frameworks/react/runtime.tsx +21 -1
- package/frameworks/react/use-kai-chat.tsx +11 -1
- package/llms-full.txt +762 -148
- package/llms.txt +57 -5
- package/package.json +65 -7
- package/src/agent-tooling/archetypes.ts +96 -0
- package/src/agent-tooling/integrations/anthropic.ts +412 -0
- package/src/agent-tooling/integrations/cloudflare.ts +136 -52
- package/src/agent-tooling/integrations/langgraph.ts +67 -13
- package/src/agent-tooling/integrations/mastra.ts +120 -12
- package/src/agent-tooling/integrations/mock.ts +43 -8
- package/src/agent-tooling/integrations/ollama.ts +61 -24
- package/src/agent-tooling/integrations/openai.ts +87 -0
- package/src/agent-tooling/integrations/openrouter.ts +56 -8
- package/src/agent-tooling/integrations/pi.ts +79 -23
- package/src/agent-tooling/integrations/pydantic-ai.ts +24 -2
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +84 -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 +3345 -675
- package/src/agent-tooling/registry.ts +17 -0
- package/src/agent-tooling/types.ts +229 -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 +118 -51
- 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 +12 -4
- 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/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 +11 -5
- 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 +3 -3
- 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 +64 -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 +3 -3
- 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 +1596 -304
- package/src/elements/element-types.d.ts +2636 -211
- 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 +10 -29
- 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/slots.ts +57 -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 +141 -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 +474 -0
- package/src/wire/formats/anthropic.ts +267 -0
- package/src/wire/formats/openai.ts +187 -0
- package/src/wire/index.ts +52 -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/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/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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSX } from 'solid-js';
|
|
2
|
-
import { TriggerDef, ComposerChange } from './composer';
|
|
3
|
-
import { ComposerDoc } from '../primitives/composer-model';
|
|
2
|
+
import { TriggerDef, ComposerChange } from './composer.js';
|
|
3
|
+
import { ComposerDoc } from '../primitives/composer-model.js';
|
|
4
4
|
interface PromptInputContextType {
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
value: () => string | ComposerDoc;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ToolPart } from './tool';
|
|
2
|
-
import { AttachmentData } from './attachments';
|
|
1
|
+
import { ToolPart } from './tool.js';
|
|
2
|
+
import { AttachmentData } from './attachments.js';
|
|
3
|
+
import { MessagePart } from '../elements/chat-types.js';
|
|
3
4
|
/** One assistant response in a comparison. Rendered identically to an assistant
|
|
4
5
|
* message (reasoning + tools + attachments + markdown content) via `MessageBody`. */
|
|
5
6
|
export interface CompareCandidate {
|
|
@@ -64,3 +65,11 @@ export declare function normalizeCandidates(candidates: unknown): {
|
|
|
64
65
|
export declare function buildSelection(pair: ComparePair, chosenId: string): CompareSelection;
|
|
65
66
|
/** Whether any candidate in the pair is still streaming (pick stays disabled). */
|
|
66
67
|
export declare function isAnyStreaming(pair: ComparePair | null): boolean;
|
|
68
|
+
/** Map a `CompareCandidate`'s flat legacy fields (content/reasoning/tools/
|
|
69
|
+
* attachments) into the ordered `MessagePart[]` `MessageBody` now renders.
|
|
70
|
+
* `CompareCandidate` stays its own independent shape (it is `<kai-compare>`'s
|
|
71
|
+
* public `data` JSON, not a `ChatMessage`). This is purely a render-time
|
|
72
|
+
* adapter, applied at each `MessageBody` call site. Order: reasoning (the
|
|
73
|
+
* thinking trace) → tool calls (the actions taken) → attachments (anything
|
|
74
|
+
* produced) → the final text answer, mirroring how an assistant turn reads. */
|
|
75
|
+
export declare function candidateToParts(candidate: CompareCandidate): MessagePart[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSX, Accessor } from 'solid-js';
|
|
2
|
-
import { CompareSelection, ResponseCompareData } from './response-compare-types';
|
|
3
|
-
export type { CompareCandidate, ComparePair, CompareCollapse, ResponseCompareData, CompareSelection, } from './response-compare-types';
|
|
4
|
-
export { normalizeCandidates, buildSelection, isAnyStreaming } from './response-compare-types';
|
|
2
|
+
import { CompareSelection, ResponseCompareData } from './response-compare-types.js';
|
|
3
|
+
export type { CompareCandidate, ComparePair, CompareCollapse, ResponseCompareData, CompareSelection, } from './response-compare-types.js';
|
|
4
|
+
export { normalizeCandidates, buildSelection, isAnyStreaming, candidateToParts } from './response-compare-types.js';
|
|
5
5
|
export type CompareLayout = 'auto' | 'columns' | 'tabs';
|
|
6
6
|
/** Imperative handle exposed via `controllerRef` — surfaces the compare's latent
|
|
7
7
|
* capabilities (commit a pick by candidate id, focus the roving tab stop) so the
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { JSX } from 'solid-js';
|
|
2
2
|
export interface SourceProps {
|
|
3
|
-
|
|
3
|
+
/** The citation's URL. OPTIONAL: every field of a model-produced citation is,
|
|
4
|
+
* so a source can arrive with a title and no url. In that case the chip
|
|
5
|
+
* renders as a plain, inert `<a>` with NO `href` attribute — which is valid
|
|
6
|
+
* HTML and simply not a link — rather than `<a href="">`, which would
|
|
7
|
+
* navigate to the current page. */
|
|
8
|
+
href?: string;
|
|
4
9
|
children: JSX.Element;
|
|
5
10
|
}
|
|
6
11
|
declare function Source(props: SourceProps): JSX.Element;
|
|
@@ -16,8 +21,12 @@ export interface SourceContentProps {
|
|
|
16
21
|
class?: string;
|
|
17
22
|
}
|
|
18
23
|
declare function SourceContent(props: SourceContentProps): JSX.Element;
|
|
19
|
-
|
|
24
|
+
export interface SourceListProps {
|
|
20
25
|
children: JSX.Element;
|
|
21
26
|
class?: string;
|
|
22
|
-
|
|
27
|
+
/** `::part` name(s) exposed on the row. The message body passes `"citations"`
|
|
28
|
+
* so consumers can target the citation row from outside the shadow boundary. */
|
|
29
|
+
part?: string;
|
|
30
|
+
}
|
|
31
|
+
declare function SourceList(props: SourceListProps): JSX.Element;
|
|
23
32
|
export { Source, SourceTrigger, SourceContent, SourceList };
|
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
import { JSX } from 'solid-js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
label: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
checked?: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface TasksCardData {
|
|
11
|
-
/**
|
|
12
|
-
* `select` (default) = checkbox rows + a confirm button that emits the contract
|
|
13
|
-
* `submit`. `progress` = an onboarding/checklist look: a header `done / total`
|
|
14
|
-
* count, circular indicators, per-item title + muted description, and NO confirm
|
|
15
|
-
* button (checking a row is itself the terminal action). Both share the same
|
|
16
|
-
* selection model (toggle by id, the `max` gate, `kai-value-change`); `progress`
|
|
17
|
-
* is purely a presentational variant.
|
|
18
|
-
*/
|
|
19
|
-
mode?: 'select' | 'progress';
|
|
20
|
-
heading?: string;
|
|
21
|
-
tasks: TasksTask[];
|
|
22
|
-
selectAll?: boolean;
|
|
23
|
-
confirmLabel?: string;
|
|
24
|
-
allowEmpty?: boolean;
|
|
25
|
-
min?: number;
|
|
26
|
-
max?: number;
|
|
27
|
-
dismissible?: boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface TasksCardResult {
|
|
30
|
-
selected: string[];
|
|
31
|
-
}
|
|
32
|
-
export type TasksCardEnvelope = CardEnvelope<'tasks', TasksCardData>;
|
|
2
|
+
import { CardHost, CardResolution } from '../primitives/card-contract.js';
|
|
3
|
+
import { TasksCardData, TasksTask } from '../primitives/card-data-types.js';
|
|
4
|
+
export type { TasksCardData, TasksCardEnvelope, TasksCardResult, TasksTask, } from '../primitives/card-data-types.js';
|
|
33
5
|
export declare const TASKS_CARD_TYPE: "tasks";
|
|
34
6
|
/** De-dupe tasks by id (first wins). Returns the usable list + an optional error. */
|
|
35
7
|
export declare function normalizeTasks(tasks: unknown): {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { JSX } from 'solid-js';
|
|
2
|
-
import { MessageActionDetail } from '../primitives/message-feedback';
|
|
3
|
-
import { ChatMessage } from '../elements/chat-types';
|
|
4
|
-
import { ProseSize } from '../primitives/chat-config';
|
|
2
|
+
import { MessageActionDetail } from '../primitives/message-feedback.js';
|
|
3
|
+
import { ChatMessage } from '../elements/chat-types.js';
|
|
4
|
+
import { ProseSize } from '../primitives/chat-config.js';
|
|
5
|
+
import { CardComponentMap } from '../primitives/card-registry.js';
|
|
6
|
+
import { CardSchemaMap } from './card-renderer.js';
|
|
5
7
|
/** Imperative handle exposed via `controllerRef` — the thread's scroll control,
|
|
6
8
|
* forwarded onto `<kai-thread>` as the `scrollToBottom()` instance method. */
|
|
7
9
|
export interface ThreadController {
|
|
@@ -12,9 +14,19 @@ export interface ThreadProps {
|
|
|
12
14
|
/** Extra classes for the thread root (e.g. `rounded-xl`). */
|
|
13
15
|
class?: string;
|
|
14
16
|
/** The full message thread to render, newest last. Each entry carries its role,
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* ordered `parts`, and optional actions/avatar/feedback. A new array reference
|
|
18
|
+
* per streaming chunk re-renders (mutating in place does not). */
|
|
17
19
|
messages: ChatMessage[];
|
|
20
|
+
/** Add/override card type -> component entries, forwarded to `CardRenderer`
|
|
21
|
+
* for `card` parts. */
|
|
22
|
+
cardTypes?: CardComponentMap;
|
|
23
|
+
/** JSON Schemas for the card types this app renders, keyed by envelope type,
|
|
24
|
+
* forwarded to `CardRenderer` for `card` parts. The companion of `cardTypes`:
|
|
25
|
+
* that says what DRAWS a card, this says what a VALID one looks like.
|
|
26
|
+
* `createCardRegistry(...).validationSchemas` is exactly this shape. Without it
|
|
27
|
+
* the kit checks its own seven built-ins and leaves your own card type
|
|
28
|
+
* unvalidated. A schema here WINS over a built-in of the same name. */
|
|
29
|
+
cardSchemas?: CardSchemaMap;
|
|
18
30
|
/** Show a typing indicator on the pending assistant turn — use while awaiting
|
|
19
31
|
* the assistant's reply. */
|
|
20
32
|
loading?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToastItem, ToastVariant, ToastAppearance } from '../primitives/toast-store';
|
|
1
|
+
import { ToastItem, ToastVariant, ToastAppearance } from '../primitives/toast-store.js';
|
|
2
2
|
export type { ToastItem, ToastVariant, ToastAppearance };
|
|
3
3
|
/** Why a toast went away — surfaced to `onDismiss` (and the facade event). */
|
|
4
4
|
export type ToastDismissReason = 'timeout' | 'close' | 'action';
|
|
@@ -30,7 +30,7 @@ export interface ToastRegionProps {
|
|
|
30
30
|
/** Fired when a toast's action button is pressed. */
|
|
31
31
|
onAction?: (id: string, label: string) => void;
|
|
32
32
|
}
|
|
33
|
-
interface ToastProps {
|
|
33
|
+
export interface ToastProps {
|
|
34
34
|
item: ToastItem;
|
|
35
35
|
onDismiss: (reason: ToastDismissReason) => void;
|
|
36
36
|
onAction?: (label: string) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Semantic classification of a tool call, used to pick a rendering. Derived from
|
|
2
|
+
* the provider-chosen tool NAME, which is arbitrary, so this stays conservative and
|
|
3
|
+
* prefers 'generic' over a confident wrong answer. */
|
|
4
|
+
export type ToolKind = 'command' | 'file-change' | 'search' | 'fetch' | 'mcp' | 'image' | 'generic';
|
|
5
|
+
/** Total, deterministic, side-effect free. ALWAYS terminates in 'generic' so an
|
|
6
|
+
* unrecognized tool still renders a panel instead of a blank. Order matters:
|
|
7
|
+
* 'search' is tested before 'fetch' so `web_search` classifies as a search. */
|
|
8
|
+
export declare function classifyTool(name: string): ToolKind;
|
|
@@ -1,10 +1,38 @@
|
|
|
1
|
+
import { ToolKind } from './tool-classify.js';
|
|
2
|
+
/** The untranslated provider payload a part was normalized from.
|
|
3
|
+
*
|
|
4
|
+
* Optional in the type but REQUIRED in practice for round-trip fidelity. Anthropic
|
|
5
|
+
* returns a 400 invalid_request_error if `thinking` blocks are modified, reordered,
|
|
6
|
+
* filtered or RECONSTRUCTED, so an encoder must send `raw.payload` back verbatim
|
|
7
|
+
* rather than rebuilding a block from `text` + `signature`. */
|
|
8
|
+
export interface RawOrigin {
|
|
9
|
+
/** Tagged origin, e.g. 'anthropic.content_block', 'openai.delta', `custom.${string}`. */
|
|
10
|
+
source: string;
|
|
11
|
+
payload: unknown;
|
|
12
|
+
}
|
|
1
13
|
/** A tool-call part rendered by <Tool>. Pure type — kept JSX-free so it can be
|
|
2
|
-
* imported by the framework-neutral state core and the React typecheck pass.
|
|
14
|
+
* imported by the framework-neutral state core and the React typecheck pass.
|
|
15
|
+
*
|
|
16
|
+
* Adding a field here also requires adding it to `TOOL_KEYS` (and a comparator
|
|
17
|
+
* in `TOOL_COMPARATORS`) in `state/parts.ts`, or `tsc` fails to compile: those
|
|
18
|
+
* drive `upsertToolPart`'s dedupe check, and a field missing from them would
|
|
19
|
+
* silently make that check ignore the new field, keeping a stale array
|
|
20
|
+
* reference alive when only that field changed. */
|
|
3
21
|
export interface ToolPart {
|
|
22
|
+
/** The tool name exactly as the provider reported it. */
|
|
4
23
|
type: string;
|
|
24
|
+
/** Semantic classification for rendering. Derive with classifyTool(type). */
|
|
25
|
+
kind?: ToolKind;
|
|
5
26
|
state: 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
27
|
+
/** Last VALID parsed snapshot, fingerprint-deduped. The primary channel: this is
|
|
28
|
+
* what the kit renders. */
|
|
6
29
|
input?: Record<string, unknown>;
|
|
30
|
+
/** Raw accumulated argument fragments, for consumers wanting character-level
|
|
31
|
+
* streaming. Most consumers should read `input` instead. */
|
|
32
|
+
rawInput?: string;
|
|
7
33
|
output?: Record<string, unknown>;
|
|
8
34
|
toolCallId?: string;
|
|
9
35
|
errorText?: string;
|
|
36
|
+
/** The untranslated provider payload this was normalized from. */
|
|
37
|
+
raw?: RawOrigin;
|
|
10
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSX } from 'solid-js';
|
|
2
|
-
import { CollapsibleController } from '../ui/collapsible';
|
|
3
|
-
import { ToolPart } from './tool-types';
|
|
4
|
-
export type { ToolPart } from './tool-types';
|
|
2
|
+
import { CollapsibleController } from '../ui/collapsible.js';
|
|
3
|
+
import { ToolPart } from './tool-types.js';
|
|
4
|
+
export type { ToolPart } from './tool-types.js';
|
|
5
5
|
export interface ToolProps {
|
|
6
6
|
toolPart: ToolPart;
|
|
7
7
|
defaultOpen?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
|
-
import { CardResolution } from '../primitives/card-contract';
|
|
2
|
+
import { CardResolution } from '../primitives/card-contract.js';
|
|
3
3
|
export interface ResolutionController<R extends CardResolution = CardResolution> {
|
|
4
4
|
resolution: Accessor<R | undefined>;
|
|
5
5
|
isResolved: Accessor<boolean>;
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { ssr as Le, ssrAttribute as we, escape as ye } from "solid-js/web";
|
|
2
|
+
import { createMemo as U, onCleanup as G, createEffect as ue, untrack as ve, createSignal as le } from "solid-js";
|
|
3
|
+
import { c as Re } from "./solid-BdENBcEq.js";
|
|
4
|
+
var _e = ['<canvas part="canvas"', "></canvas>"];
|
|
5
|
+
const Ce = "#1FD5F9";
|
|
6
|
+
function Ie(e) {
|
|
7
|
+
const n = e.trim().match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
|
|
8
|
+
if (!n) return Ie(Ce);
|
|
9
|
+
const [, o, a, s] = n;
|
|
10
|
+
return [parseInt(o, 16) / 255, parseInt(a, 16) / 255, parseInt(s, 16) / 255];
|
|
11
|
+
}
|
|
12
|
+
const Te = {
|
|
13
|
+
"1f": "float",
|
|
14
|
+
"1i": "int",
|
|
15
|
+
"1fv": "float",
|
|
16
|
+
"2f": "vec2",
|
|
17
|
+
"3f": "vec3",
|
|
18
|
+
"3fv": "vec3",
|
|
19
|
+
"4f": "vec4",
|
|
20
|
+
"4fv": "vec4",
|
|
21
|
+
Matrix2fv: "mat2",
|
|
22
|
+
Matrix3fv: "mat3",
|
|
23
|
+
Matrix4fv: "mat4"
|
|
24
|
+
}, Oe = {
|
|
25
|
+
"1fv": 1,
|
|
26
|
+
"3fv": 3,
|
|
27
|
+
"4fv": 4,
|
|
28
|
+
Matrix2fv: 4,
|
|
29
|
+
Matrix3fv: 9,
|
|
30
|
+
Matrix4fv: 16
|
|
31
|
+
};
|
|
32
|
+
function Pe(e) {
|
|
33
|
+
const n = Oe[e.type];
|
|
34
|
+
if (!n || !Array.isArray(e.value)) return;
|
|
35
|
+
const o = e.value.length / n;
|
|
36
|
+
return o > 1 && Number.isInteger(o) ? o : void 0;
|
|
37
|
+
}
|
|
38
|
+
function he(e) {
|
|
39
|
+
return e.arraySize ?? Pe(e);
|
|
40
|
+
}
|
|
41
|
+
const ke = ["uniform float iTime;", "uniform vec2 iResolution;", "uniform vec4 iMouse;", "uniform int iFrame;", "uniform vec4 iDate;"].join(`
|
|
42
|
+
`), De = `
|
|
43
|
+
attribute vec3 aVertexPosition;
|
|
44
|
+
void main() { gl_Position = vec4(aVertexPosition, 1.0); }
|
|
45
|
+
`;
|
|
46
|
+
function Ne(e, n, o) {
|
|
47
|
+
const a = Object.entries(n).map(([s, i]) => {
|
|
48
|
+
const u = he(i), m = u ? `[${u}]` : "";
|
|
49
|
+
return `uniform ${Te[i.type]} ${s}${m};`;
|
|
50
|
+
}).join(`
|
|
51
|
+
`);
|
|
52
|
+
return [`precision ${o} float;`, ke, a, e, "void main() { mainImage(gl_FragColor, gl_FragCoord.xy); }"].join(`
|
|
53
|
+
`);
|
|
54
|
+
}
|
|
55
|
+
function Ue(e) {
|
|
56
|
+
return Object.keys(e).sort().map((n) => {
|
|
57
|
+
const o = e[n];
|
|
58
|
+
return `${n}:${o.type}:${he(o) ?? ""}`;
|
|
59
|
+
}).join("|");
|
|
60
|
+
}
|
|
61
|
+
function me(e, n, o) {
|
|
62
|
+
const a = e.createShader(n);
|
|
63
|
+
if (!a) return "Could not create a WebGL shader.";
|
|
64
|
+
if (e.shaderSource(a, o), e.compileShader(a), !e.getShaderParameter(a, e.COMPILE_STATUS)) {
|
|
65
|
+
const s = e.getShaderInfoLog(a) ?? "Unknown shader compile error.";
|
|
66
|
+
return e.deleteShader(a), s;
|
|
67
|
+
}
|
|
68
|
+
return a;
|
|
69
|
+
}
|
|
70
|
+
function Be(e, n, o) {
|
|
71
|
+
const a = o.value;
|
|
72
|
+
switch (o.type) {
|
|
73
|
+
case "1f":
|
|
74
|
+
e.uniform1f(n, a);
|
|
75
|
+
break;
|
|
76
|
+
case "1i":
|
|
77
|
+
e.uniform1i(n, a);
|
|
78
|
+
break;
|
|
79
|
+
case "1fv":
|
|
80
|
+
e.uniform1fv(n, a);
|
|
81
|
+
break;
|
|
82
|
+
case "2f":
|
|
83
|
+
e.uniform2fv(n, a);
|
|
84
|
+
break;
|
|
85
|
+
case "3f":
|
|
86
|
+
case "3fv":
|
|
87
|
+
e.uniform3fv(n, a);
|
|
88
|
+
break;
|
|
89
|
+
case "4f":
|
|
90
|
+
case "4fv":
|
|
91
|
+
e.uniform4fv(n, a);
|
|
92
|
+
break;
|
|
93
|
+
case "Matrix2fv":
|
|
94
|
+
e.uniformMatrix2fv(n, !1, a);
|
|
95
|
+
break;
|
|
96
|
+
case "Matrix3fv":
|
|
97
|
+
e.uniformMatrix3fv(n, !1, a);
|
|
98
|
+
break;
|
|
99
|
+
case "Matrix4fv":
|
|
100
|
+
e.uniformMatrix4fv(n, !1, a);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function Ve(e) {
|
|
105
|
+
let n;
|
|
106
|
+
const o = U(() => Ue(e.uniforms ?? {})), a = U(() => e.fragment), s = U(() => e.precision ?? "highp");
|
|
107
|
+
let i = "none", u = null, m = null, r = null, l = null, f = 0;
|
|
108
|
+
const d = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : () => {
|
|
109
|
+
};
|
|
110
|
+
let v = null, b = !1, M = !1, E = !1, L = !1, S, x = !1, w = !0, _ = !1, C = 0, I = 0, W = 0;
|
|
111
|
+
const ge = () => {
|
|
112
|
+
var c;
|
|
113
|
+
return u || (u = n.getContext("webgl") ?? n.getContext("experimental-webgl"), u && (i = "live", m = ((c = u.getExtension) == null ? void 0 : c.call(u, "WEBGL_lose_context")) ?? null), u);
|
|
114
|
+
}, $ = () => {
|
|
115
|
+
f !== 0 || !l || L || (I = performance.now(), f = requestAnimationFrame(l));
|
|
116
|
+
}, V = () => {
|
|
117
|
+
f !== 0 && (d(f), f = 0, C += Math.max(0, performance.now() - I));
|
|
118
|
+
}, N = () => {
|
|
119
|
+
V();
|
|
120
|
+
const c = r;
|
|
121
|
+
r = null, c == null || c();
|
|
122
|
+
}, be = () => {
|
|
123
|
+
!m || i !== "live" || (i = "losing", m.loseContext());
|
|
124
|
+
}, j = () => {
|
|
125
|
+
m && (i = "restoring", m.restoreContext());
|
|
126
|
+
}, D = () => {
|
|
127
|
+
if (!(L || M || E))
|
|
128
|
+
if (w || _) {
|
|
129
|
+
if (i === "losing" || i === "restoring") return;
|
|
130
|
+
if (i === "lost") {
|
|
131
|
+
j();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
Ae();
|
|
135
|
+
} else m && i === "live" ? (N(), be()) : V();
|
|
136
|
+
}, Se = (c) => {
|
|
137
|
+
c === w || L || (w = c, D());
|
|
138
|
+
}, H = (c) => {
|
|
139
|
+
var y;
|
|
140
|
+
c.preventDefault();
|
|
141
|
+
const t = i === "losing";
|
|
142
|
+
if (i = "lost", N(), t) {
|
|
143
|
+
D();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
E = !0, (y = e.onError) == null || y.call(e, "WebGL context was lost.");
|
|
147
|
+
}, Y = () => {
|
|
148
|
+
i = "live", D();
|
|
149
|
+
}, xe = () => {
|
|
150
|
+
x || (x = !0, n.addEventListener("webglcontextlost", H, !1), n.addEventListener("webglcontextrestored", Y, !1), !(typeof IntersectionObserver > "u") && (w = !1, S = new IntersectionObserver((c) => {
|
|
151
|
+
const t = c[c.length - 1];
|
|
152
|
+
t && Se(t.isIntersecting);
|
|
153
|
+
}, {
|
|
154
|
+
threshold: 0
|
|
155
|
+
}), S.observe(n)));
|
|
156
|
+
}, Ae = () => {
|
|
157
|
+
var re, oe, ae, ie, se;
|
|
158
|
+
if (L || M || E || b) return;
|
|
159
|
+
const c = v;
|
|
160
|
+
if (!c) return;
|
|
161
|
+
if (r) {
|
|
162
|
+
$();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const t = ge();
|
|
166
|
+
if (!t) {
|
|
167
|
+
M = !0, (re = e.onError) == null || re.call(e, "WebGL is not available in this browser.");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (t.isContextLost()) {
|
|
171
|
+
j();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const {
|
|
175
|
+
source: y,
|
|
176
|
+
uniforms: Fe
|
|
177
|
+
} = c, R = me(t, t.VERTEX_SHADER, De);
|
|
178
|
+
if (typeof R == "string") {
|
|
179
|
+
b = !0, (oe = e.onError) == null || oe.call(e, R);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const T = me(t, t.FRAGMENT_SHADER, y);
|
|
183
|
+
if (typeof T == "string") {
|
|
184
|
+
t.deleteShader(R), b = !0, (ae = e.onError) == null || ae.call(e, T);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const g = t.createProgram();
|
|
188
|
+
if (!g) {
|
|
189
|
+
t.deleteShader(R), t.deleteShader(T), b = !0, (ie = e.onError) == null || ie.call(e, "Could not create a WebGL program.");
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (t.attachShader(g, R), t.attachShader(g, T), t.linkProgram(g), !t.getProgramParameter(g, t.LINK_STATUS)) {
|
|
193
|
+
const h = t.getProgramInfoLog(g) ?? "Shader program failed to link.";
|
|
194
|
+
t.deleteProgram(g), t.deleteShader(R), t.deleteShader(T), b = !0, (se = e.onError) == null || se.call(e, h);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
t.useProgram(g);
|
|
198
|
+
const K = t.createBuffer();
|
|
199
|
+
t.bindBuffer(t.ARRAY_BUFFER, K), t.bufferData(t.ARRAY_BUFFER, new Float32Array([-1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0]), t.STATIC_DRAW);
|
|
200
|
+
const X = t.getAttribLocation(g, "aVertexPosition");
|
|
201
|
+
t.enableVertexAttribArray(X), t.vertexAttribPointer(X, 3, t.FLOAT, !1, 0, 0), t.enable(t.BLEND), t.blendFunc(t.ONE, t.ONE_MINUS_SRC_ALPHA);
|
|
202
|
+
const O = (h) => t.getUniformLocation(g, h), Z = O("iTime"), J = O("iResolution"), Q = O("iMouse"), p = O("iFrame"), ee = O("iDate"), Ee = Object.keys(Fe).map((h) => [h, O(h)]), B = [0, 0, 0, 0], te = (h) => {
|
|
203
|
+
const A = n.getBoundingClientRect();
|
|
204
|
+
B[0] = h.clientX - A.left, B[1] = A.height - (h.clientY - A.top);
|
|
205
|
+
};
|
|
206
|
+
n.addEventListener("pointermove", te, {
|
|
207
|
+
passive: !0
|
|
208
|
+
});
|
|
209
|
+
const q = () => {
|
|
210
|
+
const h = globalThis.devicePixelRatio ?? 1, A = Math.max(1, Math.floor(n.clientWidth * h)), k = Math.max(1, Math.floor(n.clientHeight * h));
|
|
211
|
+
(n.width !== A || n.height !== k) && (n.width = A, n.height = k, t.viewport(0, 0, A, k));
|
|
212
|
+
}, P = typeof ResizeObserver < "u" ? new ResizeObserver(q) : void 0;
|
|
213
|
+
P == null || P.observe(n), q();
|
|
214
|
+
const ne = (h) => {
|
|
215
|
+
var k;
|
|
216
|
+
if (E || t.isContextLost()) return;
|
|
217
|
+
q();
|
|
218
|
+
const A = Math.max(0, (C + (h - I)) / 1e3);
|
|
219
|
+
if (Z && t.uniform1f(Z, A), J && t.uniform2fv(J, [n.width, n.height]), Q && t.uniform4fv(Q, B), p && t.uniform1i(p, W), ee) {
|
|
220
|
+
const F = /* @__PURE__ */ new Date();
|
|
221
|
+
t.uniform4fv(ee, [F.getFullYear(), F.getMonth(), F.getDate(), F.getHours() * 3600 + F.getMinutes() * 60 + F.getSeconds()]);
|
|
222
|
+
}
|
|
223
|
+
for (const [F, ce] of Ee) {
|
|
224
|
+
const fe = (k = e.uniforms) == null ? void 0 : k[F];
|
|
225
|
+
fe && ce && Be(t, ce, fe);
|
|
226
|
+
}
|
|
227
|
+
t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLE_STRIP, 0, 4), W++, f = requestAnimationFrame(ne);
|
|
228
|
+
};
|
|
229
|
+
r = () => {
|
|
230
|
+
l = null, P == null || P.disconnect(), n.removeEventListener("pointermove", te), t.deleteProgram(g), t.deleteShader(R), t.deleteShader(T), t.deleteBuffer(K);
|
|
231
|
+
}, l = ne, $();
|
|
232
|
+
};
|
|
233
|
+
G(() => {
|
|
234
|
+
L = !0, S == null || S.disconnect(), x && (n.removeEventListener("webglcontextlost", H), n.removeEventListener("webglcontextrestored", Y)), N(), m && i === "live" && m.loseContext();
|
|
235
|
+
});
|
|
236
|
+
const Me = U(() => e.animateWhenNotVisible ?? !1);
|
|
237
|
+
return ue(() => {
|
|
238
|
+
_ = Me(), D();
|
|
239
|
+
}), ue(() => {
|
|
240
|
+
const c = a(), t = s();
|
|
241
|
+
o();
|
|
242
|
+
const y = ve(() => e.uniforms ?? {});
|
|
243
|
+
v = {
|
|
244
|
+
source: Ne(c, y, t),
|
|
245
|
+
uniforms: y
|
|
246
|
+
}, b = !1, xe(), D(), G(N);
|
|
247
|
+
}), Le(_e, we("class", ye(Re("block h-full w-full", e.class), !0), !1));
|
|
248
|
+
}
|
|
249
|
+
function z(e, n, o, a) {
|
|
250
|
+
const s = (r) => 3 * (1 - r) * (1 - r) * r * e + 3 * (1 - r) * r * r * o + r * r * r, i = (r) => 3 * (1 - r) * (1 - r) * r * n + 3 * (1 - r) * r * r * a + r * r * r, u = (r) => 3 * (1 - r) * (1 - r) * e + 6 * (1 - r) * r * (o - e) + 3 * r * r * (1 - o);
|
|
251
|
+
function m(r) {
|
|
252
|
+
let l = 0, f = 1;
|
|
253
|
+
for (let d = 0; d < 30; d++) {
|
|
254
|
+
const v = (l + f) / 2;
|
|
255
|
+
s(v) < r ? l = v : f = v;
|
|
256
|
+
}
|
|
257
|
+
return (l + f) / 2;
|
|
258
|
+
}
|
|
259
|
+
return (r) => {
|
|
260
|
+
if (r <= 0) return 0;
|
|
261
|
+
if (r >= 1) return 1;
|
|
262
|
+
let l = r;
|
|
263
|
+
for (let f = 0; f < 8; f++) {
|
|
264
|
+
const d = u(l);
|
|
265
|
+
if (Math.abs(d) < 1e-6) return i(m(r));
|
|
266
|
+
const v = l - (s(l) - r) / d;
|
|
267
|
+
if (v <= 0 || v >= 1) return i(m(r));
|
|
268
|
+
l = v;
|
|
269
|
+
}
|
|
270
|
+
return i(l);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
const qe = {
|
|
274
|
+
linear: (e) => Math.min(1, Math.max(0, e)),
|
|
275
|
+
easeIn: z(0.42, 0, 1, 1),
|
|
276
|
+
easeOut: z(0, 0, 0.58, 1),
|
|
277
|
+
easeInOut: z(0.42, 0, 0.58, 1)
|
|
278
|
+
};
|
|
279
|
+
function ze(e, n) {
|
|
280
|
+
e = Math.max(0, e);
|
|
281
|
+
const o = Math.max(0.05, 1 - Math.min(0.95, n)), a = 10, s = a * Math.sqrt(Math.max(0, 1 - o * o));
|
|
282
|
+
return 1 - Math.exp(-o * a * e) * (Math.cos(s * e) + o * a / (s || 1) * Math.sin(s * e));
|
|
283
|
+
}
|
|
284
|
+
function de(e) {
|
|
285
|
+
return "type" in e && e.type === "spring";
|
|
286
|
+
}
|
|
287
|
+
function je(e) {
|
|
288
|
+
const [n, o] = le(e), [a, s] = le(!1);
|
|
289
|
+
let i = 0, u = !1;
|
|
290
|
+
const m = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : () => {
|
|
291
|
+
}, r = () => {
|
|
292
|
+
i && m(i), i = 0;
|
|
293
|
+
};
|
|
294
|
+
G(() => {
|
|
295
|
+
u = !0, r(), s(!1);
|
|
296
|
+
});
|
|
297
|
+
function l(f, d) {
|
|
298
|
+
if (r(), u) return;
|
|
299
|
+
const v = Array.isArray(f), [b, M] = v ? f : [ve(n), f];
|
|
300
|
+
if (!d || !de(d) && d.duration === 0) {
|
|
301
|
+
s(!1), o(v ? b : M);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const E = d.duration * 1e3;
|
|
305
|
+
if (E <= 0) {
|
|
306
|
+
s(!1), o(M);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (typeof requestAnimationFrame > "u") {
|
|
310
|
+
s(!1), o(M);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const L = de(d) ? (C) => ze(C, d.bounce) : qe[d.ease ?? "easeOut"];
|
|
314
|
+
let S = b, x = M;
|
|
315
|
+
v && o(b);
|
|
316
|
+
let w = performance.now();
|
|
317
|
+
const _ = (C) => {
|
|
318
|
+
const I = Math.min(1, (C - w) / E);
|
|
319
|
+
if (o(S + (x - S) * L(I)), I < 1) {
|
|
320
|
+
i = requestAnimationFrame(_);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (!v) {
|
|
324
|
+
o(x), i = 0, s(!1);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
o(x), [S, x] = [x, S], w = performance.now(), i = requestAnimationFrame(_);
|
|
328
|
+
};
|
|
329
|
+
s(!0), i = requestAnimationFrame(_);
|
|
330
|
+
}
|
|
331
|
+
return { value: n, animating: a, to: l };
|
|
332
|
+
}
|
|
333
|
+
export {
|
|
334
|
+
Ce as D,
|
|
335
|
+
Ve as S,
|
|
336
|
+
je as c,
|
|
337
|
+
Ie as h
|
|
338
|
+
};
|