@kitn.ai/ui 0.20.1 → 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 +5446 -4937
- 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 +61 -8
- 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
package/dist/elements/tasks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as xe,s as ke,x as ye,j as R,g as we,h as B,o as _,k as Ce,c as u,E as Se,S as k,n as G,i as g,u as Ie,a as T,b as D,d as m,F as W,t as y,e as Ee,f as Re}from"./chunks/define-D1din7Ld.js";import{c as U}from"./chunks/cn-CU7UAWzk.js";import{B as ue}from"./chunks/button-ZWNif3--.js";import{P as $e}from"./chunks/progress-bar-BrAIIaaJ.js";import{C as X}from"./chunks/card-BkHbp4BA.js";import{u as Te,a as Ve,D as ze}from"./chunks/use-card-resolution-BSu_XHjH.js";import{e as Ae}from"./chunks/card-routing-C986KuUA.js";import{x as Le}from"./chunks/x-GRUeeQFT.js";import{c as Ne}from"./chunks/check-B9-gn6SS.js";import{c as je}from"./chunks/circle-check-BNAS0JEy.js";import{c as De}from"./chunks/circle-0e3KJTDr.js";var Ue=y('<p class="pt-1 text-xs text-muted-foreground">Up to <!> selected.'),qe=y('<div role=group><div class="divide-y divide-border overflow-hidden rounded-lg border border-input">'),Be=y("<span class=sr-only>"),Me=y('<div class="flex w-full flex-wrap items-center justify-between gap-2"><span aria-live=polite class="text-xs text-muted-foreground"> selected</span><div class="ml-auto flex items-center gap-2">'),Fe=y("<label><input type=checkbox class=kai-checkbox><span>Select all"),ce=y('<span class="text-xs font-normal text-muted-foreground">'),Pe=y('<label><input type=checkbox class="kai-checkbox mt-0.5"><span class="flex flex-col gap-0.5"><span>'),Oe=y('<div class="flex items-center justify-between gap-3"><span class="text-sm font-medium text-foreground"></span><span aria-live=polite class="shrink-0 text-sm font-medium tabular-nums text-muted-foreground"> / '),_e=y('<p class="text-xs text-muted-foreground">Up to <!> selected.'),Ge=y('<div><ul class="flex flex-col gap-1">'),He=y('<div class="grid grid-rows-[0fr] group-hover:grid-rows-[1fr] group-focus-within:grid-rows-[1fr] motion-safe:transition-[grid-template-rows] motion-safe:duration-200"><span class="overflow-hidden text-xs font-normal text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 motion-safe:transition-opacity">'),Je=y('<li><label><input type=checkbox class=sr-only><span aria-hidden=true></span><span class="flex min-w-0 flex-col gap-0.5"><span>'),Ke=y('<ul class="list-disc pl-5 text-sm text-foreground">'),Qe=y('<div class="flex flex-col gap-2"><p class="flex items-center gap-2 text-sm font-medium text-foreground"><span>Selected <!> of '),We=y('<p class="text-sm text-muted-foreground">None selected'),Xe=y("<li>");const Ye="tasks";function Ze(e){if(!Array.isArray(e)||e.length===0)return{tasks:[],error:"This card couldn't be displayed."};const n=new Set,t=[];for(const a of e){if(!a||typeof a!="object")continue;const d=a;if(!(typeof d.id!="string"||d.id.length===0)&&!(typeof d.label!="string"||d.label.length===0)){if(n.has(d.id)){console.warn(`[kai-tasks] duplicate task id "${d.id}" ignored`);continue}n.add(d.id),t.push({id:d.id,label:d.label,description:typeof d.description=="string"?d.description:void 0,checked:d.checked===!0,disabled:d.disabled===!0})}}return t.length===0?{tasks:[],error:"This card couldn't be displayed."}:{tasks:t}}function et(e){return e.filter(n=>n.checked).map(n=>n.id)}function ge(e,n){return e.filter(t=>n.has(t.id)).map(t=>t.id)}function H(e){return e.filter(n=>!n.disabled).map(n=>n.id)}function tt(e,n){const t=H(e);if(t.length===0)return"unchecked";const a=t.filter(d=>n.has(d)).length;return a===0?"unchecked":a===t.length?"checked":"indeterminate"}function rt(e,n){if(e.selectAll!==!0)return!1;const t=H(n).length;return!(e.max!==void 0&&t>e.max)}function it(e){return e.mode==="progress"}function nt(e,n){return{done:e.filter(t=>n.has(t.id)).length,total:e.length}}function he(e,n){const t=e.min??(e.allowEmpty?0:1);return!(n<t||e.max!==void 0&&n>e.max)}function Y(e,n){return e.max!==void 0&&n>=e.max}function at(e,n){if(he(e,n))return;const t=e.min??(e.allowEmpty?0:1);if(n<t)return`Select at least ${t}.`;if(e.max!==void 0&&n>e.max)return`Select at most ${e.max}.`}const dt={tasks:[]};function st(e){const n=xe({cardId:"kai-tasks"},e),[t]=ke(n,["data","cardId","heading","host","hostElement","class","resolution","value","defaultValue","disabled","readonly","onValueChange","controllerRef"]),a=Te(),d=ye(),l=r=>{const o=t.host??a;o?o.emit(r):t.hostElement&&Ae(t.hostElement,r)},h=R(()=>{var r;return Ze((r=t.data)==null?void 0:r.tasks)}),w=R(()=>h().error===void 0),C=R(()=>h().error??""),v=R(()=>h().tasks),x=R(()=>t.data??dt),[I,A]=we(new Set),s=Ve({prop:()=>t.resolution,data:()=>t.data}),V=r=>{const o=new Set(v().map(i=>i.id));return r.filter(i=>o.has(i))};B(_(()=>t.data,()=>{const r=t.value??t.defaultValue??et(v());A(new Set(V(r)))})),B(_(()=>t.value,r=>{r&&A(new Set(V(r)))},{defer:!0})),B(_(I,r=>{var o;(o=t.onValueChange)==null||o.call(t,{value:ge(v(),r)})},{defer:!0})),B(_(w,r=>{l(r?{kind:"ready",cardId:t.cardId}:{kind:"error",cardId:t.cardId,message:C()})}));const $=()=>t.disabled===!0,S=()=>t.readonly===!0,L=R(()=>I().size),N=R(()=>it(x())),M=R(()=>nt(v(),I())),P=()=>x().confirmLabel??"Confirm",j=R(()=>tt(v(),I())),O=R(()=>rt(x(),v())),q=R(()=>at(x(),L())),J=R(()=>he(x(),L())&&!s.isResolved()&&!$()&&!S()),Z=(r,o,i)=>{if(i){if(Y(x(),r.size)&&!r.has(o))return r;r.add(o)}else r.delete(o);return r},K=(r,o)=>{s.isResolved()||$()||S()||A(Z(new Set(I()),r,o))},ee=r=>{if(s.isResolved()||$()||S())return;const o=new Set(I());for(const i of H(v()))r?o.add(i):o.delete(i);A(o)},Q=()=>{if(!J())return;const r={selected:ge(v(),I())};l({kind:"submit",cardId:t.cardId,data:r}),s.setLocal({kind:"submit",data:r})},te=()=>{s.isResolved()||(l({kind:"dismiss",cardId:t.cardId}),s.setLocal({kind:"dismissed"}))},re=()=>l({kind:"reopen",cardId:t.cardId});Ce(()=>{var r;(r=t.controllerRef)==null||r.call(t,{select:o=>{if(s.isResolved()||$()||S())return;if(o===void 0){ee(!0);return}const i=new Set,f=new Set(H(v()));for(const c of V(o))f.has(c)&&Z(i,c,!0);A(i)},toggle:(o,i)=>{const f=i??!I().has(o);K(o,f)},send:()=>Q(),focus:o=>{var i,f;const c=(((i=t.hostElement)==null?void 0:i.shadowRoot)??document).querySelector('[role="group"]');(f=c?.querySelector('input[type="checkbox"]')??c)==null||f.focus(o)},dismiss:()=>te(),reopen:()=>re()})}),B(()=>{var r;const o=t.hostElement;o&&(((r=s.resolution())==null?void 0:r.kind)==="submit"?o.setAttribute("data-kai-resolved","submitted"):o.removeAttribute("data-kai-resolved"))});const fe=R(()=>{var r;const o=s.resolution();if(!o||o.kind!=="submit")return;const i=(r=o.data)==null?void 0:r.selected,f=Array.isArray(i)?i:[],c=v(),p=c.filter(E=>f.includes(E.id)).map(E=>E.label);return{count:p.length,total:c.length,labels:p}}),ie=`kai-tl-reason-${d}`,ve=`kai-tl-count-${d}`,me=`kai-tl-progress-${d}`,pe=`kai-tl-heading-${d}`,ne=()=>{var r;return t.heading??((r=t.data)==null?void 0:r.heading)};return u(k,{get when(){return w()},get fallback(){return u(X,{get heading(){return t.heading},get errorMessage(){return C()}})},get children(){return u(Se,{fallback:()=>(l({kind:"error",cardId:t.cardId,message:"The card failed to render."}),u(X,{get heading(){return t.heading},errorMessage:"The card failed to render."})),get children(){return u(k,{get when(){return!s.isDeferred()},get fallback(){return u(ze,{type:Ye,get title(){var r;return t.heading??((r=t.data)==null?void 0:r.heading)},onReopen:re})},get children(){return u(X,{get heading(){return G(()=>!!N())()?void 0:ne()},get actions(){return G(()=>!!(N()||s.isResolved()||S()))()?void 0:(()=>{var r=Me(),o=r.firstChild,i=o.firstChild,f=o.nextSibling;return g(r,u(k,{get when(){var c;return((c=t.data)==null?void 0:c.dismissible)===!0},get children(){return u(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:te,get children(){return u(Le,{size:16,"aria-hidden":"true"})}})}}),o),m(o,"id",ve),g(o,L,i),g(f,u(k,{get when(){return q()},get children(){var c=Be();return m(c,"id",ie),g(c,q),c}}),null),g(f,u(ue,{type:"button",get disabled(){return!J()},get"aria-describedby"(){return q()?ie:void 0},onClick:Q,get children(){return P()}}),null),r})()},get children(){return u(k,{get when(){return!s.isResolved()},get fallback(){return u(lt,{get summary(){return fe()},get optimistic(){return s.isOptimistic()}})},get children(){return[u(k,{get when(){return N()},get children(){return u(ot,{get heading(){return ne()},headingId:pe,countId:me,get done(){return M().done},get total(){return M().total},get tasks(){return v()},uid:d,isChecked:r=>I().has(r),isBlocked:r=>$()||r.disabled===!0||!I().has(r.id)&&Y(x(),L()),onToggle:(r,o)=>K(r,o),get groupClass(){return t.class},get maxNote(){return G(()=>x().max!==void 0)()?x().max:void 0},get readonly(){return S()}})}}),u(k,{get when(){return!N()},get children(){var r=qe(),o=r.firstChild;return r.$$keydown=i=>{i.key!=="Enter"||i.target.tagName==="INPUT"||J()&&Q()},g(o,u(k,{get when(){return O()},get children(){return(()=>{const i=()=>j()==="indeterminate";return(()=>{var f=Fe(),c=f.firstChild;return c.addEventListener("change",p=>ee(p.currentTarget.checked)),Ie(p=>{B(()=>{p.indeterminate=i()})},c),T(p=>{var E=U("flex items-center gap-3 px-3 py-2.5 text-sm font-medium transition-colors",S()?"cursor-default":"cursor-pointer",j()==="checked"?"bg-accent text-accent-foreground":S()?"text-foreground":"text-foreground hover:bg-muted/50"),z=$()||S(),F=i()?"mixed":j()==="checked";return E!==p.e&&D(f,p.e=E),z!==p.t&&(c.disabled=p.t=z),F!==p.a&&m(c,"aria-checked",p.a=F),p},{e:void 0,t:void 0,a:void 0}),T(()=>c.checked=j()==="checked"),f})()})()}}),null),g(o,u(W,{get each(){return v()},children:i=>{const f=()=>I().has(i.id),c=()=>$()||i.disabled||!f()&&Y(x(),L()),p=`kai-tl-desc-${d}-${i.id}`;return(()=>{var E=Pe(),z=E.firstChild,F=z.nextSibling,be=F.firstChild;return z.addEventListener("change",b=>K(i.id,b.currentTarget.checked)),g(be,()=>i.label),g(F,u(k,{get when(){return i.description},get children(){var b=ce();return m(b,"id",p),g(b,()=>i.description),b}}),null),T(b=>{var ae=U("flex items-start gap-3 px-3 py-2.5 text-sm transition-colors",S()?"cursor-default":c()?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-muted/50",f()&&!c()?"bg-accent font-medium text-accent-foreground":"text-foreground"),de=i.id,se=c()||S(),oe=c()?"true":void 0,le=i.description?p:void 0;return ae!==b.e&&D(E,b.e=ae),de!==b.t&&m(E,"data-task-id",b.t=de),se!==b.a&&(z.disabled=b.a=se),oe!==b.o&&m(z,"aria-disabled",b.o=oe),le!==b.i&&m(z,"aria-describedby",b.i=le),b},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),T(()=>z.checked=f()),E})()}}),null),g(r,u(k,{get when(){return x().max!==void 0},get children(){var i=Ue(),f=i.firstChild,c=f.nextSibling;return c.nextSibling,g(i,()=>x().max,c),i}}),null),T(i=>{var f,c=t.heading??((f=t.data)==null?void 0:f.heading)??"Tasks",p=S()?"true":void 0,E=U("flex flex-col",t.class);return c!==i.e&&m(r,"aria-label",i.e=c),p!==i.t&&m(r,"aria-readonly",i.t=p),E!==i.a&&D(r,i.a=E),i},{e:void 0,t:void 0,a:void 0}),r}})]}})}})}})}})}})}function ot(e){return(()=>{var n=Ge(),t=n.firstChild;return g(n,u(k,{get when(){return e.heading},get children(){var a=Oe(),d=a.firstChild,l=d.nextSibling,h=l.firstChild;return g(d,()=>e.heading),g(l,()=>e.done,h),g(l,()=>e.total,null),T(w=>{var C=e.headingId,v=e.countId;return C!==w.e&&m(d,"id",w.e=C),v!==w.t&&m(l,"id",w.t=v),w},{e:void 0,t:void 0}),a}}),t),g(n,u($e,{get value(){return e.done},get max(){return e.total},tone:"success",get"aria-labelledby"(){return G(()=>!!e.heading)()?e.headingId:void 0},get"aria-label"(){return e.heading?void 0:"Task progress"}}),t),g(t,u(W,{get each(){return e.tasks},children:a=>{const d=()=>e.isChecked(a.id),l=()=>e.isBlocked(a),h=`kai-tl-pdesc-${e.uid}-${a.id}`;return(()=>{var w=Je(),C=w.firstChild,v=C.firstChild,x=v.nextSibling,I=x.nextSibling,A=I.firstChild;return v.addEventListener("change",s=>e.onToggle(a.id,s.currentTarget.checked)),g(x,u(k,{get when(){return d()},get fallback(){return u(De,{size:18})},get children(){return u(je,{size:18,class:"text-foreground"})}})),g(A,()=>a.label),g(I,u(k,{get when(){return a.description},get children(){return u(k,{get when(){return d()},get fallback(){return(()=>{var s=ce();return m(s,"id",h),g(s,()=>a.description),s})()},get children(){var s=He(),V=s.firstChild;return m(V,"id",h),g(V,()=>a.description),s}})}}),null),T(s=>{var V=U("group flex items-start gap-3 rounded-lg px-2.5 py-2 text-sm transition-colors",!e.readonly&&"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",e.readonly?"cursor-default":l()?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-muted/50"),$=a.id,S=!e.readonly&&d()?0:void 0,L=d()?a.label:void 0,N=d()&&a.description?h:void 0,M=l()||e.readonly,P=l()?"true":void 0,j=a.description?h:void 0,O=U("mt-0.5 shrink-0 text-muted-foreground",d()&&"motion-safe:transition-transform motion-safe:group-hover:scale-110"),q=U("font-medium text-foreground",d()&&"line-through opacity-70 motion-safe:transition-opacity motion-safe:group-hover:opacity-100");return V!==s.e&&D(C,s.e=V),$!==s.t&&m(C,"data-task-id",s.t=$),S!==s.a&&m(C,"tabindex",s.a=S),L!==s.o&&m(C,"aria-label",s.o=L),N!==s.i&&m(C,"aria-describedby",s.i=N),M!==s.n&&(v.disabled=s.n=M),P!==s.s&&m(v,"aria-disabled",s.s=P),j!==s.h&&m(v,"aria-describedby",s.h=j),O!==s.r&&D(x,s.r=O),q!==s.d&&D(A,s.d=q),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),T(()=>v.checked=d()),w})()}})),g(n,u(k,{get when(){return e.maxNote!==void 0},get children(){var a=_e(),d=a.firstChild,l=d.nextSibling;return l.nextSibling,g(a,()=>e.maxNote,l),a}}),null),T(a=>{var d=U("flex flex-col gap-3",e.groupClass),l=e.heading?e.headingId:void 0,h=e.heading?void 0:"Checklist";return d!==a.e&&D(n,a.e=d),l!==a.t&&m(t,"aria-labelledby",a.t=l),h!==a.a&&m(t,"aria-label",a.a=h),a},{e:void 0,t:void 0,a:void 0}),n})()}function lt(e){return(()=>{var n=Qe(),t=n.firstChild,a=t.firstChild,d=a.firstChild,l=d.nextSibling;return l.nextSibling,g(t,u(Ne,{size:16,"aria-hidden":"true"}),a),g(a,()=>e.summary.count,l),g(a,()=>e.summary.total,null),g(n,u(k,{get when(){return e.summary.labels.length>0},get fallback(){return We()},get children(){var h=Ke();return g(h,u(W,{get each(){return e.summary.labels},children:w=>(()=>{var C=Xe();return g(C,w),C})()})),h}}),null),T(()=>m(n,"role",e.optimistic?"status":void 0)),n})()}Ee(["keydown"]),Re("kai-tasks",{data:void 0,cardId:void 0,heading:void 0,resolution:void 0,value:void 0,defaultValue:void 0,disabled:!1,readonly:!1},(e,{element:n,dispatch:t,flag:a,expose:d})=>{let l;return d({select:h=>l?.select(h),toggle:(h,w)=>l?.toggle(h,w),send:()=>l?.send(),focus:h=>l?.focus(h),dismiss:()=>l?.dismiss(),reopen:()=>l?.reopen()}),u(st,{get data(){return e.data},get cardId(){return e.cardId??(n.id||"kai-tasks")},get heading(){return e.heading},get resolution(){return e.resolution},get value(){return e.value},get defaultValue(){return e.defaultValue},get disabled(){return a("disabled")},get readonly(){return a("readonly")},onValueChange:h=>t("kai-value-change",h),controllerRef:h=>l=h,hostElement:n})});
|
|
1
|
+
import{f as i,c as u}from"./chunks/define-BzPnNsXg.js";import{T as s}from"./chunks/tasks-card-EyoBZfpA.js";i("kai-tasks",{data:void 0,cardId:void 0,heading:void 0,resolution:void 0,value:void 0,defaultValue:void 0,disabled:!1,readonly:!1},(a,{element:t,dispatch:o,flag:d,expose:r})=>{let e;return r({select:l=>e?.select(l),toggle:(l,n)=>e?.toggle(l,n),send:()=>e?.send(),focus:l=>e?.focus(l),dismiss:()=>e?.dismiss(),reopen:()=>e?.reopen()}),u(s,{get data(){return a.data},get cardId(){return a.cardId??(t.id||"kai-tasks")},get heading(){return a.heading},get resolution(){return a.resolution},get value(){return a.value},get defaultValue(){return a.defaultValue},get disabled(){return d("disabled")},get readonly(){return d("readonly")},onValueChange:l=>o("kai-value-change",l),controllerRef:l=>e=l,hostElement:t})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as r,c as a}from"./chunks/define-
|
|
1
|
+
import{f as r,c as a}from"./chunks/define-BzPnNsXg.js";import{T as e}from"./chunks/text-shimmer-D9gRSh34.js";r("kai-text-shimmer",{text:"",as:"span",duration:4,spread:20},t=>a(e,{get as(){return t.as},get duration(){return t.duration},get spread(){return t.spread},class:"text-body",get children(){return t.text}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as p,i as o,c as r,
|
|
1
|
+
import{s as p,i as o,c as r,H as i,S as u,a as m,b,t as l,e as f,f as g}from"./chunks/define-BzPnNsXg.js";import{c as x}from"./chunks/cn-CU7UAWzk.js";import{T as c}from"./chunks/text-shimmer-D9gRSh34.js";import{c as h}from"./chunks/chevron-right-Dw4GPhwL.js";var k=l('<button type=button class="flex items-center gap-1 text-sm transition-opacity hover:opacity-80">'),v=l('<button type=button class="text-muted-foreground hover:text-foreground border-muted-foreground/50 hover:border-foreground border-b border-dotted text-sm transition-colors">'),w=l("<div>");function y(n){const[t]=p(n,["class","text","onStop","stopLabel","onClick"]),s=()=>t.text??"Thinking",d=()=>t.stopLabel??"Answer now";return(()=>{var a=w();return o(a,r(u,{get when(){return t.onClick},get fallback(){return r(c,{class:"cursor-default text-sm font-medium",get children(){return s()}})},get children(){var e=k();return i(e,"click",t.onClick,!0),o(e,r(c,{class:"text-sm font-medium",get children(){return s()}}),null),o(e,r(h,{class:"text-muted-foreground size-4"}),null),e}}),null),o(a,r(u,{get when(){return t.onStop},get children(){var e=v();return i(e,"click",t.onStop,!0),o(e,d),e}}),null),m(()=>b(a,x("flex w-full items-center justify-between",t.class))),a})()}f(["click"]),g("kai-thinking-bar",{text:"Thinking",stoppable:!1,stopLabel:"Answer now"},(n,{dispatch:t,flag:s})=>r(y,{get text(){return n.text},get stopLabel(){return n.stopLabel},get onStop(){return s("stoppable")?()=>t("kai-stop"):void 0}}));
|
package/dist/elements/thread.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as
|
|
1
|
+
import{y as B,l as M,o as w,c as r,x as R,i as h,S as o,F as H,a as T,b as k,C as z,t as c,f as $,g as A,h as j,j as C,u as F}from"./chunks/define-BzPnNsXg.js";import{r as L,T as q}from"./chunks/slots-CIw9RlAe.js";import{C as N,a as O,b as U,S as _}from"./chunks/scroll-button-Bet5NLc4.js";import{M as D,a as x,b as E}from"./chunks/message-X5NZbq-W.js";import{b as G,c as I,a as J}from"./chunks/message-CnBA2OUt.js";import{L as K}from"./chunks/loader-XmpyxyRH.js";var P=c('<div class="flex min-h-[10rem] flex-1 flex-col items-center justify-center gap-1 py-12 text-center"><p class="text-sm font-medium text-foreground">No messages yet</p><p class="text-xs text-muted-foreground">Messages will appear here as the conversation starts.'),Q=c('<div class="rounded-lg px-1 py-2">'),V=c('<div class="absolute bottom-4 left-1/2 flex w-full max-w-3xl -translate-x-1/2 justify-center px-5">'),S=c("<div>");function W(){return P()}function X(e){const d=B(),m=()=>e.actionsReveal==="hover"?"hover":"always";let n;const i=G({emit:a=>{var t;return(t=e.onMessageAction)==null?void 0:t.call(e,a)},target:()=>n}),g=()=>e.scrollButton!==!1,p=()=>e.messages.length===0&&!e.loading,f=M(()=>e.messages.map(a=>a.id));return w(()=>{var a;(a=e.controllerRef)==null||a.call(e,{scrollToBottom:t=>{const l=n?.querySelector(".overflow-y-auto");l?.scrollTo({top:l.scrollHeight,behavior:t??"smooth"})}})}),r(z,{get proseSize(){return e.proseSize},get codeTheme(){return e.codeTheme},get codeHighlight(){return e.codeHighlight!==!1},get portalMount(){return d.portalMount()},get children(){var a=S();return R(t=>n=t,a),h(a,r(N,{class:"h-full px-4 py-3",get children(){return[r(O,{class:"mx-auto w-full max-w-3xl space-y-4",get children(){return[r(o,{get when(){return p()},get children(){return r(o,{get when(){return e.empty},get fallback(){return r(W,{})},get children(){return e.empty}})}}),r(H,{get each(){return f()},children:(t,l)=>r(o,{get when(){return e.messages[l()]},children:s=>{const y=r(D,{get parts(){return s().parts},get cardTypes(){return e.cardTypes},get cardSchemas(){return e.cardSchemas},get isUser(){return s().role==="user"},get markdown(){return s().role==="assistant"},get actions(){return s().actions},get actionsReveal(){return m()},get activeFeedback(){return i.resolveFeedback(s())},get copied(){return i.isCopied(s().id)},onAction:u=>i.handleAction(s(),u)}),b=()=>m()==="hover"?"group ":"";return r(o,{get when(){return s().avatar},get fallback(){return r(x,{get role(){return s().role},get class(){return`${b()}${s().role==="user"?"flex-col items-end":"flex-col items-start"}`},children:y})},children:u=>r(x,{get role(){return s().role},get class(){return b()},get children(){return[r(E,{get src(){return u().src??""},get alt(){return u().alt??""},get fallback(){return u().fallback}}),(()=>{var v=S();return h(v,y),T(()=>k(v,`flex min-w-0 flex-1 flex-col ${s().role==="user"?"items-end":"items-start"}`)),v})()]}})})}})}),r(o,{get when(){return e.loading},get children(){return r(x,{class:"flex-col items-start",get children(){var t=Q();return h(t,r(K,{variant:"typing"})),t}})}}),r(U,{})]}}),r(o,{get when(){return g()},get children(){var t=V();return h(t,r(_,{class:"shadow-sm"})),t}})]}})),T(()=>k(a,`relative flex h-full min-h-0 flex-col bg-background ${e.class??""}`)),a}})}var Y=c("<style>:host{display:block;height:100%}"),Z=c("<slot name=empty>");$("kai-thread",{messages:void 0,loading:!1,proseSize:"sm",codeTheme:"github-dark-dimmed",codeHighlight:!0,actionsReveal:"always",scrollButton:!0,class:void 0,cardTypes:void 0,cardSchemas:void 0},(e,{element:d,dispatch:m,flag:n,expose:i})=>{let g;const p=J("kai-thread"),[f,a]=A({});return w(()=>{const t=()=>a(L(d,q));t();const l=new MutationObserver(t);l.observe(d,{childList:!0}),j(()=>l.disconnect())}),i({scrollToBottom:t=>g?.scrollToBottom(t)}),[Y(),r(X,{get class(){return e.class},get messages(){return p(e.messages)},get loading(){return n("loading")},get proseSize(){return e.proseSize},get codeTheme(){return e.codeTheme},get codeHighlight(){return n("codeHighlight")},get actionsReveal(){return e.actionsReveal},get scrollButton(){return e.scrollButton!==!1},get cardTypes(){return I(e.cardTypes,e.theme)},get cardSchemas(){return e.cardSchemas},get empty(){return C(()=>!!f().empty)()?(()=>{var t=Z();return t._$owner=F(),t})():void 0},onMessageAction:t=>m("kai-message-action",t),controllerRef:t=>g=t})]});
|
package/dist/elements/toast.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as z,j as Q,h as H,p as I,c as a,i as h,F as U,u as V,a as L,d as C,b as E,q as J,r as Z,S as b,t as $,o as _,e as ie,f as ae}from"./chunks/define-D1din7Ld.js";import{c as g}from"./chunks/cn-CU7UAWzk.js";import{c as se}from"./chunks/overlay-kD8dwRv_.js";import{r as ee,t as de}from"./chunks/toast-store-DKbQn3Wn.js";import{c as le}from"./chunks/check-B9-gn6SS.js";import{c as ce}from"./chunks/circle-x-B7faJFlY.js";import{i as ue}from"./chunks/info-CIsv92JK.js";import{t as me}from"./chunks/triangle-alert-DsHTHCPm.js";import{x as pe}from"./chunks/x-GRUeeQFT.js";var ve=$("<button type=button>"),fe=$("<button type=button aria-label=Dismiss>"),te=$("<div>"),ge=$('<div class="min-w-0 flex-1"><div class="font-medium leading-snug">'),he=$("<div role=status>"),xe=$('<span class="min-w-0 flex-1 truncate">'),be=$('<div role=region aria-label=Notifications aria-live=polite data-stack=collapsed><div class="pointer-events-auto relative transition-[height] duration-200 ease-out"style="min-width:16rem;max-width:min(30rem, calc(100vw - 2rem))">'),we=$("<div role=region aria-label=Notifications aria-live=polite data-stack=expanded>");function ke(){var t,c;const[u,f]=z(typeof window<"u"&&((t=window.matchMedia)==null?void 0:t.call(window,"(prefers-reduced-motion: reduce)").matches)===!0);if(typeof window<"u"&&window.matchMedia){const m=window.matchMedia("(prefers-reduced-motion: reduce)"),l=()=>f(m.matches);(c=m.addEventListener)==null||c.call(m,"change",l),I(()=>{var d;return(d=m.removeEventListener)==null?void 0:d.call(m,"change",l)})}return u}function re(t){const[c,u]=z(!0),f=se(c),m=()=>t.item.variant??"neutral",l=()=>t.item.dismissible!==!1,d=()=>t.item.appearance??t.appearance??"pill",v=()=>t.item.inverse??t.inverse??!1,q=()=>v()?"bg-foreground text-background border-transparent":"bg-popover text-popover-foreground border-border",W=()=>v()?"text-background/70":"text-muted-foreground",D=()=>v()?"text-background hover:text-background/80":"text-primary hover:text-primary/80",Y=()=>v()?"text-background/70 hover:text-background":"text-muted-foreground hover:text-foreground";let A=ee(t.item),S=0,k,y="timeout";const w=()=>{k!==void 0&&(clearTimeout(k),k=void 0)},R=()=>{w(),!(A<=0)&&(S=Date.now(),k=setTimeout(()=>{y="timeout",u(!1)},A))},B=()=>{k!==void 0&&(w(),A-=Date.now()-S)},[G,T]=z(!1),X=()=>t.paused===!0||G();H(_(()=>ee(t.item),e=>{A=e,X()?w():R()})),H(_(X,e=>{e?B():R()},{defer:!0})),I(w),H(()=>{!f.present()&&!c()&&t.onDismiss(y)});const P=()=>{w(),y="close",u(!1)},j=()=>{var e;const n=t.item.action;n&&((e=t.onAction)==null||e.call(t,n.label),n.onAction()===!1||(w(),y="action",u(!1)))},x=()=>d()==="card"?"mt-0.5":void 0,F=()=>[a(b,{get when(){return m()==="success"},get children(){return a(le,{get class(){return g("size-4 shrink-0 text-emerald-500",x())}})}}),a(b,{get when(){return m()==="warning"},get children(){return a(me,{get class(){return g("size-4 shrink-0 text-warning",x())}})}}),a(b,{get when(){return m()==="error"},get children(){return a(ce,{get class(){return g("size-4 shrink-0 text-destructive",x())}})}}),a(b,{get when(){return m()==="info"},get children(){return a(ue,{get class(){return g("size-4 shrink-0 text-info",x())}})}})],r=e=>a(b,{get when(){return t.item.action},children:n=>(()=>{var o=ve();return o.$$click=j,h(o,()=>n().label),L(()=>E(o,g(d()==="card"?g("inline-flex shrink-0 items-center rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",v()?"border-background/30 text-background hover:bg-background/10":"border-border text-foreground hover:bg-accent"):g("shrink-0 rounded-md text-sm font-medium underline-offset-2 hover:underline",D()),e.class))),o})()}),i=()=>a(b,{get when(){return l()},get children(){var e=fe();return e.$$click=P,h(e,a(pe,{class:"size-3.5"})),L(()=>E(e,g("-mr-1 flex size-5 shrink-0 items-center justify-center rounded-md transition-colors",Y()))),e}});return a(b,{get when(){return f.present()},get children(){var e=he();e.addEventListener("pointerleave",()=>T(!1)),e.addEventListener("pointerenter",()=>T(!0));var n=f.setRef;return typeof n=="function"?V(n,e):f.setRef=e,h(e,a(F,{}),null),h(e,a(b,{get when(){return d()==="card"},get fallback(){return[(()=>{var o=xe();return h(o,()=>t.item.message),o})(),a(r,{}),a(i,{})]},get children(){return[(()=>{var o=ge(),s=o.firstChild;return h(s,()=>t.item.message),h(o,a(b,{get when(){return t.item.description},get children(){var p=te();return h(p,()=>t.item.description),L(()=>E(p,g("mt-1 line-clamp-2 text-xs leading-snug",W()))),p}}),null),h(o,a(r,{class:"mt-2"}),null),o})(),a(i,{})]}}),null),L(o=>{var s=d(),p=v()?"":void 0,M=f.state()==="closed"?"":void 0,N=g("pointer-events-auto border text-sm shadow-lg",q(),"animate-in fade-in-0 slide-in-from-top-4","data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:slide-out-to-top-2",d()==="card"?"flex min-w-[24rem] items-start gap-3 rounded-xl p-4 shadow-xl":"flex items-center gap-3 rounded-full px-4 py-2.5");return s!==o.e&&C(e,"data-appearance",o.e=s),p!==o.t&&C(e,"data-inverse",o.t=p),M!==o.a&&C(e,"data-closed",o.a=M),N!==o.o&&E(e,o.o=N),o},{e:void 0,t:void 0,a:void 0,o:void 0}),e}})}const ne={"top-center":"top-4 left-1/2 -translate-x-1/2 items-center","top-right":"top-4 right-4 items-end","top-left":"top-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center flex-col-reverse","bottom-right":"bottom-4 right-4 items-end flex-col-reverse","bottom-left":"bottom-4 left-4 items-start flex-col-reverse"},$e={"top-center":"items-center","top-left":"items-start","top-right":"items-end","bottom-center":"items-center flex-col-reverse","bottom-left":"items-start flex-col-reverse","bottom-right":"items-end flex-col-reverse"},O=12;function oe(t,c){const u=c.left+c.width/2,f=c.top+O,m=c.bottom-O,l=c.left+O,d=c.right-O,v=`${Math.max(0,c.width-O*2)}px`;switch(t){case"top-left":return{top:`${f}px`,left:`${l}px`,transform:"none","max-width":v};case"top-right":return{top:`${f}px`,left:`${d}px`,transform:"translateX(-100%)","max-width":v};case"bottom-center":return{top:`${m}px`,left:`${u}px`,transform:"translate(-50%, -100%)","max-width":v};case"bottom-left":return{top:`${m}px`,left:`${l}px`,transform:"translateY(-100%)","max-width":v};case"bottom-right":return{top:`${m}px`,left:`${d}px`,transform:"translate(-100%, -100%)","max-width":v};default:return{top:`${f}px`,left:`${u}px`,transform:"translateX(-50%)","max-width":v}}}function ye(t){const c=()=>t.max??3,u=()=>t.position??"top-center",f=()=>t.stack??"expanded",m=ke(),l=()=>f()==="collapsed"&&!m(),[d,v]=z(!1),[q,W]=z(!1),D=()=>d()||q(),Y=20,A=.05,S=48,k=8,y=()=>u().startsWith("bottom"),w=()=>y()?-1:1,[R,B]=z(S),G=r=>{if(!r||typeof window>"u")return;const i=()=>{const n=r.offsetHeight;n&&B(n)};if(i(),typeof ResizeObserver>"u")return;const e=new ResizeObserver(i);e.observe(r),I(()=>e.disconnect())},T=r=>D()?`translateY(${w()*(R()+k)*r}px) scale(1)`:`translateY(${w()*Y*r}px) scale(${1-A*r})`,X=()=>{const r=j().length;return r?D()?r*R()+(r-1)*k:R()+(r-1)*Y:0},P=Q(()=>[...(t.toasts??[]).filter(r=>(r.target??void 0)===t.target)].reverse()),j=Q(()=>P().slice(0,c())),[x,F]=z(null);return H(()=>{const r=t.target;if(!r||typeof window>"u"){F(null);return}const i=()=>{const n=r.getBoundingClientRect();F({top:n.top,left:n.left,right:n.right,bottom:n.bottom,width:n.width})};i();const e=new ResizeObserver(i);e.observe(r),window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),I(()=>{e.disconnect(),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)})}),a(b,{get when(){return l()},get fallback(){return(()=>{var r=we();return h(r,a(U,{get each(){return j()},children:i=>a(re,{item:i,get appearance(){return t.appearance},get inverse(){return t.inverse},onDismiss:e=>{var n;return(n=t.onDismiss)==null?void 0:n.call(t,i.id,e)},onAction:e=>{var n;return(n=t.onAction)==null?void 0:n.call(t,i.id,e)}})})),L(i=>{var e=g("pointer-events-none fixed z-[100] flex flex-col gap-2",x()?$e[u()]:g("max-w-[min(30rem,calc(100vw-2rem))]",ne[u()])),n=x()?oe(u(),x()):void 0;return e!==i.e&&E(r,i.e=e),i.t=Z(r,n,i.t),i},{e:void 0,t:void 0}),r})()},get children(){var r=be(),i=r.firstChild;return r.$$focusout=()=>W(!1),r.$$focusin=()=>W(!0),r.addEventListener("pointerleave",()=>v(!1)),r.addEventListener("pointerenter",()=>v(!0)),h(i,a(U,{get each(){return j()},children:(e,n)=>(()=>{var o=te();return V(s=>{n()===0&&G(s)},o),h(o,a(re,{item:e,get paused(){return D()},get appearance(){return t.appearance},get inverse(){return t.inverse},onDismiss:s=>{var p;return(p=t.onDismiss)==null?void 0:p.call(t,e.id,s)},onAction:s=>{var p;return(p=t.onAction)==null?void 0:p.call(t,e.id,s)}})),L(s=>{var p=n(),M=g("absolute inset-x-0 flex transition-[transform,opacity] duration-200 ease-out",y()?"bottom-0 origin-bottom":"top-0 origin-top",u().endsWith("right")?"justify-end":u().endsWith("left")?"justify-start":"justify-center"),N=String(c()-n()),K=T(n());return p!==s.e&&C(o,"data-depth",s.e=p),M!==s.t&&E(o,s.t=M),N!==s.a&&J(o,"z-index",s.a=N),K!==s.o&&J(o,"transform",s.o=K),s},{e:void 0,t:void 0,a:void 0,o:void 0}),o})()})),L(e=>{var n=D()?"":void 0,o=g("pointer-events-none fixed z-[100]",!x()&&ne[u()]),s=x()?oe(u(),x()):void 0,p=`${X()}px`;return n!==e.e&&C(r,"data-expanded",e.e=n),o!==e.t&&E(r,e.t=o),e.a=Z(r,s,e.a),p!==e.o&&J(i,"height",e.o=p),e},{e:void 0,t:void 0,a:void 0,o:void 0}),r}})}ie(["click","focusin","focusout"]),ae("kai-toast-region",{toasts:[],position:"top-center",max:3,stack:"expanded",appearance:"pill",inverse:!1,target:void 0},(t,{dispatch:c,flag:u})=>{const f=()=>{const l=t.max,d=typeof l=="string"?parseInt(l,10):l;return typeof d=="number"&&!Number.isNaN(d)?d:3},m=l=>{de.dismiss(l)};return a(ye,{get toasts(){return t.toasts??[]},get position(){return t.position},get max(){return f()},get stack(){return t.stack},get appearance(){return t.appearance},get inverse(){return u("inverse")},get target(){return t.target},onDismiss:(l,d)=>{m(l),c("kai-dismiss",{id:l,reason:d})},onAction:(l,d)=>c("kai-action",{id:l,label:d})})});
|
|
1
|
+
import{g as z,l as Q,k as H,h as I,c as i,i as h,F as U,x as V,a as L,d as C,b as E,n as J,p as Z,S as b,t as $,w as _,e as ie,f as ae}from"./chunks/define-BzPnNsXg.js";import{c as g}from"./chunks/cn-CU7UAWzk.js";import{c as se}from"./chunks/overlay-Cepd-KcS.js";import{r as ee,t as de}from"./chunks/toast-store-Bm3DUEDe.js";import{c as le}from"./chunks/check-C8desc_h.js";import{c as ce}from"./chunks/circle-x-D0MEfxOM.js";import{i as ue}from"./chunks/info-CWRjZkuy.js";import{t as me}from"./chunks/triangle-alert-C1SNzTqK.js";import{x as pe}from"./chunks/x-D1qx0aLd.js";var ve=$("<button type=button>"),fe=$("<button type=button aria-label=Dismiss>"),te=$("<div>"),ge=$('<div class="min-w-0 flex-1"><div class="font-medium leading-snug">'),he=$("<div role=status>"),xe=$('<span class="min-w-0 flex-1 truncate">'),be=$('<div role=region aria-label=Notifications aria-live=polite data-stack=collapsed><div class="pointer-events-auto relative transition-[height] duration-200 ease-out"style="min-width:16rem;max-width:min(30rem, calc(100vw - 2rem))">'),we=$("<div role=region aria-label=Notifications aria-live=polite data-stack=expanded>");function ke(){var t,c;const[u,f]=z(typeof window<"u"&&((t=window.matchMedia)==null?void 0:t.call(window,"(prefers-reduced-motion: reduce)").matches)===!0);if(typeof window<"u"&&window.matchMedia){const m=window.matchMedia("(prefers-reduced-motion: reduce)"),l=()=>f(m.matches);(c=m.addEventListener)==null||c.call(m,"change",l),I(()=>{var d;return(d=m.removeEventListener)==null?void 0:d.call(m,"change",l)})}return u}function re(t){const[c,u]=z(!0),f=se(c),m=()=>t.item.variant??"neutral",l=()=>t.item.dismissible!==!1,d=()=>t.item.appearance??t.appearance??"pill",v=()=>t.item.inverse??t.inverse??!1,B=()=>v()?"bg-foreground text-background border-transparent":"bg-popover text-popover-foreground border-border",W=()=>v()?"text-background/70":"text-muted-foreground",D=()=>v()?"text-background hover:text-background/80":"text-primary hover:text-primary/80",Y=()=>v()?"text-background/70 hover:text-background":"text-muted-foreground hover:text-foreground";let A=ee(t.item),S=0,k,y="timeout";const w=()=>{k!==void 0&&(clearTimeout(k),k=void 0)},R=()=>{w(),!(A<=0)&&(S=Date.now(),k=setTimeout(()=>{y="timeout",u(!1)},A))},G=()=>{k!==void 0&&(w(),A-=Date.now()-S)},[P,T]=z(!1),X=()=>t.paused===!0||P();H(_(()=>ee(t.item),e=>{A=e,X()?w():R()})),H(_(X,e=>{e?G():R()},{defer:!0})),I(w),H(()=>{!f.present()&&!c()&&t.onDismiss(y)});const q=()=>{w(),y="close",u(!1)},M=()=>{var e;const o=t.item.action;o&&((e=t.onAction)==null||e.call(t,o.label),o.onAction()===!1||(w(),y="action",u(!1)))},x=()=>d()==="card"?"mt-0.5":void 0,F=()=>[i(b,{get when(){return m()==="success"},get children(){return i(le,{get class(){return g("size-4 shrink-0 text-emerald-500",x())}})}}),i(b,{get when(){return m()==="warning"},get children(){return i(me,{get class(){return g("size-4 shrink-0 text-warning",x())}})}}),i(b,{get when(){return m()==="error"},get children(){return i(ce,{get class(){return g("size-4 shrink-0 text-destructive",x())}})}}),i(b,{get when(){return m()==="info"},get children(){return i(ue,{get class(){return g("size-4 shrink-0 text-info",x())}})}})],n=e=>i(b,{get when(){return t.item.action},children:o=>(()=>{var r=ve();return r.$$click=M,h(r,()=>o().label),L(()=>E(r,g(d()==="card"?g("inline-flex shrink-0 items-center rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",v()?"border-background/30 text-background hover:bg-background/10":"border-border text-foreground hover:bg-accent"):g("shrink-0 rounded-md text-sm font-medium underline-offset-2 hover:underline",D()),e.class))),r})()}),a=()=>i(b,{get when(){return l()},get children(){var e=fe();return e.$$click=q,h(e,i(pe,{class:"size-3.5"})),L(()=>E(e,g("-mr-1 flex size-5 shrink-0 items-center justify-center rounded-md transition-colors",Y()))),e}});return i(b,{get when(){return f.present()},get children(){var e=he();e.addEventListener("pointerleave",()=>T(!1)),e.addEventListener("pointerenter",()=>T(!0));var o=f.setRef;return typeof o=="function"?V(o,e):f.setRef=e,h(e,i(F,{}),null),h(e,i(b,{get when(){return d()==="card"},get fallback(){return[(()=>{var r=xe();return h(r,()=>t.item.message),r})(),i(n,{}),i(a,{})]},get children(){return[(()=>{var r=ge(),s=r.firstChild;return h(s,()=>t.item.message),h(r,i(b,{get when(){return t.item.description},get children(){var p=te();return h(p,()=>t.item.description),L(()=>E(p,g("mt-1 line-clamp-2 text-xs leading-snug",W()))),p}}),null),h(r,i(n,{class:"mt-2"}),null),r})(),i(a,{})]}}),null),L(r=>{var s=d(),p=v()?"":void 0,N=f.state()==="closed"?"":void 0,j=g("pointer-events-auto border text-sm shadow-lg",B(),"animate-in fade-in-0 slide-in-from-top-4","data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:slide-out-to-top-2",d()==="card"?"flex min-w-[24rem] items-start gap-3 rounded-xl p-4 shadow-xl":"flex items-center gap-3 rounded-full px-4 py-2.5");return s!==r.e&&C(e,"data-appearance",r.e=s),p!==r.t&&C(e,"data-inverse",r.t=p),N!==r.a&&C(e,"data-closed",r.a=N),j!==r.o&&E(e,r.o=j),r},{e:void 0,t:void 0,a:void 0,o:void 0}),e}})}const ne={"top-center":"top-4 left-1/2 -translate-x-1/2 items-center","top-right":"top-4 right-4 items-end","top-left":"top-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center flex-col-reverse","bottom-right":"bottom-4 right-4 items-end flex-col-reverse","bottom-left":"bottom-4 left-4 items-start flex-col-reverse"},$e={"top-center":"items-center","top-left":"items-start","top-right":"items-end","bottom-center":"items-center flex-col-reverse","bottom-left":"items-start flex-col-reverse","bottom-right":"items-end flex-col-reverse"},O=12;function oe(t,c){const u=c.left+c.width/2,f=c.top+O,m=c.bottom-O,l=c.left+O,d=c.right-O,v=`${Math.max(0,c.width-O*2)}px`;switch(t){case"top-left":return{top:`${f}px`,left:`${l}px`,transform:"none","max-width":v};case"top-right":return{top:`${f}px`,left:`${d}px`,transform:"translateX(-100%)","max-width":v};case"bottom-center":return{top:`${m}px`,left:`${u}px`,transform:"translate(-50%, -100%)","max-width":v};case"bottom-left":return{top:`${m}px`,left:`${l}px`,transform:"translateY(-100%)","max-width":v};case"bottom-right":return{top:`${m}px`,left:`${d}px`,transform:"translate(-100%, -100%)","max-width":v};default:return{top:`${f}px`,left:`${u}px`,transform:"translateX(-50%)","max-width":v}}}function ye(t){const c=()=>t.max??3,u=()=>t.position??"top-center",f=()=>t.stack??"expanded",m=ke(),l=()=>f()==="collapsed"&&!m(),[d,v]=z(!1),[B,W]=z(!1),D=()=>d()||B(),Y=20,A=.05,S=48,k=8,y=()=>u().startsWith("bottom"),w=()=>y()?-1:1,[R,G]=z(S),P=n=>{if(!n||typeof window>"u")return;const a=()=>{const o=n.offsetHeight;o&&G(o)};if(a(),typeof ResizeObserver>"u")return;const e=new ResizeObserver(a);e.observe(n),I(()=>e.disconnect())},T=n=>D()?`translateY(${w()*(R()+k)*n}px) scale(1)`:`translateY(${w()*Y*n}px) scale(${1-A*n})`,X=()=>{const n=M().length;return n?D()?n*R()+(n-1)*k:R()+(n-1)*Y:0},q=Q(()=>[...(t.toasts??[]).filter(n=>(n.target??void 0)===t.target)].reverse()),M=Q(()=>q().slice(0,c())),[x,F]=z(null);return H(()=>{const n=t.target;if(!n||typeof window>"u"){F(null);return}const a=window,e=()=>{const r=n.getBoundingClientRect();F({top:r.top,left:r.left,right:r.right,bottom:r.bottom,width:r.width})};e();const o=new ResizeObserver(e);o.observe(n),a.addEventListener("scroll",e,!0),a.addEventListener("resize",e),I(()=>{o.disconnect(),a.removeEventListener("scroll",e,!0),a.removeEventListener("resize",e)})}),i(b,{get when(){return l()},get fallback(){return(()=>{var n=we();return h(n,i(U,{get each(){return M()},children:a=>i(re,{item:a,get appearance(){return t.appearance},get inverse(){return t.inverse},onDismiss:e=>{var o;return(o=t.onDismiss)==null?void 0:o.call(t,a.id,e)},onAction:e=>{var o;return(o=t.onAction)==null?void 0:o.call(t,a.id,e)}})})),L(a=>{var e=g("pointer-events-none fixed z-[100] flex flex-col gap-2",x()?$e[u()]:g("max-w-[min(30rem,calc(100vw-2rem))]",ne[u()])),o=x()?oe(u(),x()):void 0;return e!==a.e&&E(n,a.e=e),a.t=Z(n,o,a.t),a},{e:void 0,t:void 0}),n})()},get children(){var n=be(),a=n.firstChild;return n.$$focusout=()=>W(!1),n.$$focusin=()=>W(!0),n.addEventListener("pointerleave",()=>v(!1)),n.addEventListener("pointerenter",()=>v(!0)),h(a,i(U,{get each(){return M()},children:(e,o)=>(()=>{var r=te();return V(s=>{o()===0&&P(s)},r),h(r,i(re,{item:e,get paused(){return D()},get appearance(){return t.appearance},get inverse(){return t.inverse},onDismiss:s=>{var p;return(p=t.onDismiss)==null?void 0:p.call(t,e.id,s)},onAction:s=>{var p;return(p=t.onAction)==null?void 0:p.call(t,e.id,s)}})),L(s=>{var p=o(),N=g("absolute inset-x-0 flex transition-[transform,opacity] duration-200 ease-out",y()?"bottom-0 origin-bottom":"top-0 origin-top",u().endsWith("right")?"justify-end":u().endsWith("left")?"justify-start":"justify-center"),j=String(c()-o()),K=T(o());return p!==s.e&&C(r,"data-depth",s.e=p),N!==s.t&&E(r,s.t=N),j!==s.a&&J(r,"z-index",s.a=j),K!==s.o&&J(r,"transform",s.o=K),s},{e:void 0,t:void 0,a:void 0,o:void 0}),r})()})),L(e=>{var o=D()?"":void 0,r=g("pointer-events-none fixed z-[100]",!x()&&ne[u()]),s=x()?oe(u(),x()):void 0,p=`${X()}px`;return o!==e.e&&C(n,"data-expanded",e.e=o),r!==e.t&&E(n,e.t=r),e.a=Z(n,s,e.a),p!==e.o&&J(a,"height",e.o=p),e},{e:void 0,t:void 0,a:void 0,o:void 0}),n}})}ie(["click","focusin","focusout"]),ae("kai-toast-region",{toasts:[],position:"top-center",max:3,stack:"expanded",appearance:"pill",inverse:!1,target:void 0},(t,{dispatch:c,flag:u})=>{const f=()=>{const l=t.max,d=typeof l=="string"?parseInt(l,10):l;return typeof d=="number"&&!Number.isNaN(d)?d:3},m=l=>{de.dismiss(l)};return i(ye,{get toasts(){return t.toasts??[]},get position(){return t.position},get max(){return f()},get stack(){return t.stack},get appearance(){return t.appearance},get inverse(){return u("inverse")},get target(){return t.target},onDismiss:(l,d)=>{m(l),c("kai-dismiss",{id:l,reason:d})},onAction:(l,d)=>c("kai-action",{id:l,label:d})})});
|
package/dist/elements/tool.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as a,c as l,S as d}from"./chunks/define-
|
|
1
|
+
import{f as a,c as l,S as d}from"./chunks/define-BzPnNsXg.js";import{T as i}from"./chunks/tool-CDtW7L0z.js";import{w as f}from"./chunks/disclosure-DVKsoc1F.js";a("kai-tool",{tool:void 0,open:void 0,defaultOpen:void 0,disabled:void 0},(t,e)=>{const{flag:o}=e;let r;return f(e,()=>r,()=>t.open),l(d,{get when(){return t.tool},get children(){return l(i,{get toolPart(){return t.tool},get defaultOpen(){return o("defaultOpen")},get disabled(){return o("disabled")},controllerRef:n=>r=n})}})});
|
package/dist/elements/tooltip.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as i,c as d,
|
|
1
|
+
import{f as i,c as d,u as s,j as r,t as a}from"./chunks/define-BzPnNsXg.js";import{T as p}from"./chunks/tooltip-eB226mGK.js";import{w as u}from"./chunks/disclosure-DVKsoc1F.js";var c=a("<style>:host{display:inline-flex}"),m=a("<slot>");i("kai-tooltip",{content:"",openDelay:void 0,closeDelay:void 0,placement:void 0,open:void 0,defaultOpen:void 0,disabled:void 0},(e,o)=>{const{flag:l}=o;let n;return u(o,()=>n,()=>e.open),[c(),d(p,{get content(){return e.content??""},get openDelay(){return r(()=>e.openDelay!=null)()?Number(e.openDelay):void 0},get closeDelay(){return r(()=>e.closeDelay!=null)()?Number(e.closeDelay):void 0},get placement(){return e.placement??void 0},get defaultOpen(){return l("defaultOpen")},get disabled(){return l("disabled")},controllerRef:t=>n=t,get children(){var t=m();return t._$owner=s(),t}})]});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChatMessage } from './chat-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Boundary validation for the untyped `message` / `messages` properties.
|
|
4
|
+
*
|
|
5
|
+
* A web component's properties are an untyped boundary: nothing stops a consumer
|
|
6
|
+
* from assigning the pre-0.20.0 `{ id, role, content }` shape, and TypeScript is
|
|
7
|
+
* not there at runtime to catch it. `parts` is REQUIRED internally, so a message
|
|
8
|
+
* without one throws inside a Solid render pass (`groupMessageParts` iterating
|
|
9
|
+
* `undefined`), and an uncaught exception there blanks the WHOLE element, not
|
|
10
|
+
* just the offending message. Validating here turns that into a skipped message
|
|
11
|
+
* plus one clear console error naming the element and the expected shape.
|
|
12
|
+
*/
|
|
13
|
+
/** True when `m` carries the required `parts` array. */
|
|
14
|
+
export declare function hasParts(m: unknown): m is ChatMessage;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a per-element-instance validator for a `messages` array. Returns the
|
|
17
|
+
* INPUT array unchanged when every entry is valid (no allocation, so streaming
|
|
18
|
+
* identity checks upstream still hold), a filtered copy when some are not, and
|
|
19
|
+
* `[]` when the property itself is not an array.
|
|
20
|
+
*
|
|
21
|
+
* Logs at most one `console.error` per validation pass, and never re-logs for a
|
|
22
|
+
* message object it has already reported, so an unrelated re-render during
|
|
23
|
+
* streaming does not spam the console.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createMessagesGuard(tag: string): (messages: unknown) => ChatMessage[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as
|
|
1
|
+
import{g as w,h as C,s as z,k as L,w as P,i as I,c as g,F,n as V,S,j as M,a as D,b as U,t as T,f as $}from"./chunks/define-BzPnNsXg.js";import{c as B}from"./chunks/cn-CU7UAWzk.js";import{B as q}from"./chunks/button-CmkUkz6c.js";import{T as A}from"./chunks/tooltip-eB226mGK.js";function G(n={}){const l=n.mimeType??"audio/webm;codecs=opus",[s,p]=w(!1),[c,e]=w(null),[r,u]=w();let i,m=[],v;async function o(){e(null),m=[];try{const t=await navigator.mediaDevices.getUserMedia({audio:!0});return u(t),i=new MediaRecorder(t,{mimeType:l}),i.ondataavailable=a=>{a.data.size>0&&m.push(a.data)},i.onstop=()=>{const a=new Blob(m,{type:l});t.getTracks().forEach(h=>h.stop()),u(void 0),p(!1),v?.(a)},i.start(),p(!0),new Promise(a=>{v=a})}catch(t){const a=r();throw a&&(a.getTracks().forEach(h=>h.stop()),u(void 0)),e(t instanceof Error?t.message:"Microphone access denied"),p(!1),t}}function b(){i&&i.state==="recording"&&i.stop()}return C(()=>b()),{isRecording:s,error:c,stream:r,start:o,stop:b}}function E(){if(typeof window>"u")return;const n=window;return n.SpeechRecognition??n.webkitSpeechRecognition}function H(n={}){const[l,s]=w(!1),[p,c]=w(null),e=E()!==void 0;let r,u,i="";function m(o={}){c(null),i="";const b=E();if(!b){const t="SpeechRecognition is not supported in this browser";return c(t),Promise.reject(new Error(t))}try{return r=new b,o.lang&&(r.lang=o.lang),r.interimResults=n.interim===!0,r.continuous=!1,r.onresult=t=>{var a;let h="";for(let y=t.resultIndex;y<t.results.length;y++){const x=t.results[y],R=((a=x[0])==null?void 0:a.transcript)??"";x.isFinal?i+=R:h+=R}h&&o.onInterim&&o.onInterim(h)},r.onerror=t=>{c(t.error??"Speech recognition error")},r.onend=()=>{s(!1),u?.(i),r=void 0},r.start(),s(!0),new Promise(t=>{u=t})}catch(t){throw c(t instanceof Error?t.message:"Speech recognition failed to start"),s(!1),t}}function v(){r&&l()&&r.stop()}return C(()=>{r&&r.abort()}),{isSupported:e,isListening:l,error:p,start:m,stop:v}}var J=T('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 1a3 3 0 00-3 3v8a3 3 0 006 0V4a3 3 0 00-3-3z"></path><path d="M19 10v2a7 7 0 01-14 0v-2"></path><line x1=12 y1=19 x2=12 y2=23></line><line x1=8 y1=23 x2=16 y2=23>'),K=T('<svg width=14 height=14 viewBox="0 0 24 24"fill=currentColor><rect x=4 y=4 width=16 height=16 rx=2>'),N=T('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 class=animate-spin><path d="M21 12a9 9 0 11-6.219-8.56">'),O=T("<div>"),W=T('<div class="absolute inset-0 animate-ping rounded-full border-2 border-red-400/30"style=animation-duration:2s>');function _(n){var l;const[s]=z(n,["onTranscribe","onTranscription","disabled","class"]),{isRecording:p,start:c,stop:e}=G(),r=H({interim:n.interim}),[u,i]=w(!1),m=()=>!n.hasTranscribe&&r.isSupported,v=()=>u()?"Transcribing...":o()?"Stop recording":"Voice input",o=()=>m()?r.isListening():p();async function b(){try{const d=await r.start({lang:n.lang,onInterim:n.interim?f=>{var k;return(k=n.onInterim)==null?void 0:k.call(n,f)}:void 0});d.trim()&&s.onTranscription(d.trim())}catch{}}async function t(){try{const d=await c();i(!0);try{const f=await s.onTranscribe(d);f.trim()&&s.onTranscription(f.trim())}finally{i(!1)}}catch{i(!1)}}function a(){m()?b():t()}function h(){m()?r.stop():e()}async function y(){o()?h():a()}L(P(o,d=>{var f;(f=n.onRecordingChange)==null||f.call(n,d)},{defer:!0})),(l=n.controllerRef)==null||l.call(n,{start:()=>{o()||a()},stop:()=>h()});const x=()=>J(),R=()=>K(),j=()=>N();return(()=>{var d=O();return I(d,g(S,{get when(){return o()},get children(){return g(F,{each:[0,1,2],children:f=>(()=>{var k=W();return V(k,"animation-delay",`${f*.3}s`),k})()})}}),null),I(d,g(A,{get content(){return v()},get children(){return g(q,{variant:"ghost",size:"icon-sm",get"aria-label"(){return v()},onClick:y,get disabled(){return s.disabled||u()},get class(){return B("relative z-10 rounded-full transition-all duration-300",o()&&"bg-destructive text-white hover:bg-destructive/80")},get children(){return[g(S,{get when(){return u()},get children(){return g(j,{})}}),g(S,{get when(){return M(()=>!u())()&&o()},get children(){return g(R,{})}}),g(S,{get when(){return M(()=>!u())()&&!o()},get children(){return g(x,{})}})]}})}}),null),D(()=>U(d,B("relative inline-flex items-center justify-center",s.class))),d})()}$("kai-voice-input",{transcribe:void 0,disabled:!1,recognitionLang:void 0,interim:!1},(n,{dispatch:l,flag:s,expose:p})=>{let c;return p({start:()=>c?.start(),stop:()=>c?.stop()}),g(_,{get disabled(){return s("disabled")},get hasTranscribe(){return typeof n.transcribe=="function"},get lang(){return n.recognitionLang},get interim(){return s("interim")},onTranscribe:async e=>(l("kai-audio-captured",{blob:e}),n.transcribe?n.transcribe(e):""),onTranscription:e=>l("kai-transcription",{text:e}),onInterim:e=>l("kai-transcript-interim",{text:e}),onRecordingChange:e=>l("kai-recording-change",{recording:e}),controllerRef:e=>c=e})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as A,g as k,
|
|
1
|
+
import{s as A,g as k,k as z,w as m,h as q,i as D,c as o,S as w,j as x,a as E,b as F,t as p,f as G}from"./chunks/define-BzPnNsXg.js";import{c as b}from"./chunks/cn-CU7UAWzk.js";import{B as I}from"./chunks/button-CmkUkz6c.js";import{T as N}from"./chunks/tooltip-eB226mGK.js";var P=p('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><path d="M19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07">'),V=p('<svg width=14 height=14 viewBox="0 0 24 24"fill=currentColor><rect x=4 y=4 width=16 height=16 rx=2>'),W=p('<svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 class=animate-spin><path d="M21 12a9 9 0 11-6.219-8.56">'),_=p("<div>");function h(){return typeof window<"u"&&"speechSynthesis"in window}function $(e){var l;const[s]=A(e,["text","disabled","class"]),[a,t]=k(!1),[n,f]=k(!1);let i,u,d;const R=()=>!!e.onSynthesize||h(),v=()=>n()?"Synthesizing...":a()?"Stop":"Read aloud";function S(){u&&(URL.revokeObjectURL(u),u=void 0)}function C(){!h()||!s.text||(window.speechSynthesis.cancel(),d=new SpeechSynthesisUtterance(s.text),d.onend=()=>t(!1),d.onerror=()=>t(!1),t(!0),window.speechSynthesis.speak(d))}async function j(){var r;if(!(!e.onSynthesize||!s.text)){f(!0);try{const c=await e.onSynthesize(s.text);(r=e.onSynthesized)==null||r.call(e,c),S(),u=URL.createObjectURL(c),i??(i=new Audio),i.src=u,i.onended=()=>t(!1),i.onerror=()=>t(!1),t(!0),await i.play()}catch{t(!1)}finally{f(!1)}}}function g(){e.onSynthesize?j():C()}function y(){e.onSynthesize?i&&(i.pause(),i.currentTime=0):h()&&window.speechSynthesis.cancel(),t(!1)}function U(){e.onSynthesize?i?.pause():h()&&window.speechSynthesis.pause()}function B(){e.onSynthesize?i?.play():h()&&window.speechSynthesis.resume()}function L(){a()?y():g()}z(m(a,r=>{var c;(c=e.onSpeakingChange)==null||c.call(e,r)},{defer:!0})),z(m(()=>s.text,r=>{e.autoplay&&r&&g()},{defer:!0})),(l=e.controllerRef)==null||l.call(e,{speak:g,pause:U,resume:B,stop:y}),q(()=>{y(),S()});const M=()=>P(),O=()=>V(),T=()=>W();return(()=>{var r=_();return D(r,o(N,{get content(){return v()},get children(){return o(I,{part:"button",variant:"ghost",size:"icon-sm",get"aria-label"(){return v()},get"aria-pressed"(){return a()},onClick:L,get disabled(){return s.disabled||!R()||n()},get class(){return b("relative z-10 rounded-full transition-all duration-300")},get children(){return[o(w,{get when(){return n()},get children(){return o(T,{})}}),o(w,{get when(){return x(()=>!n())()&&a()},get children(){return o(O,{})}}),o(w,{get when(){return x(()=>!n())()&&!a()},get children(){return o(M,{})}})]}})}})),E(()=>F(r,b("relative inline-flex items-center justify-center",s.class))),r})()}G("kai-voice-output",{text:"",autoplay:!1,synthesize:void 0,disabled:!1},(e,{dispatch:l,flag:s,expose:a})=>{let t;return a({speak:()=>t?.speak(),pause:()=>t?.pause(),resume:()=>t?.resume(),stop:()=>t?.stop()}),o($,{get text(){return e.text??""},get autoplay(){return s("autoplay")},get disabled(){return s("disabled")},get onSynthesize(){return e.synthesize?n=>e.synthesize(n):void 0},onSpeakingChange:n=>l("kai-speaking-change",{speaking:n}),onSynthesized:n=>l("kai-synthesized",{blob:n}),controllerRef:n=>t=n})});
|