@kitn.ai/ui 0.25.2 → 0.27.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 +17 -6
- package/bin/mcp.js +16 -3
- package/bin/route.js +23 -0
- package/bin/route.test.js +58 -0
- package/dist/{elements/chunks/Icon-b5A8hlHs.js → Icon-BnFKqqtY.js} +1 -1
- package/dist/action-icons-CBskfBMz.js +1 -0
- package/dist/arrow-down-Br0qtpsz.js +1 -0
- package/dist/arrow-left-Dj7xgE12.js +1 -0
- package/dist/artifact-CvXEm1lS.js +1 -0
- package/dist/assets/dev-5XzXYR21.js +91 -0
- package/dist/attachments-C43ZegEq.js +1 -0
- package/dist/audio-visualizer-B-79y1Tj.js +1 -0
- package/dist/badge-BpUbq8c0.js +1 -0
- package/dist/bash-InADTalH.js +1 -6
- package/dist/bell-sn17Ip9v.js +1 -0
- package/dist/{elements/chunks/button-B9okqG73.js → button-BH6rN0U-.js} +1 -1
- package/dist/card-renderer-Cb1gQmth.js +1 -0
- package/dist/card-routing-DifQgS7n.js +1 -0
- package/dist/check-DPeeMUYx.js +1 -0
- package/dist/checkbox-Dc9Yov_B.js +1 -0
- package/dist/checkbox-group-B1kDLLYk.js +1 -0
- package/dist/chevron-down-CHSWk7ZT.js +1 -0
- package/dist/chevron-right-B7l_fMgx.js +1 -0
- package/dist/choice-card-BT3c1S8g.js +1 -0
- package/dist/circle-Bb0yOpqM.js +1 -0
- package/dist/circle-check-BGZpCiz7.js +1 -0
- package/dist/circle-x-wobWkoSx.js +1 -0
- package/dist/{elements/chunks/cn-CU7UAWzk.js → cn-DN5AWfiS.js} +1 -1
- package/dist/code-block-CUQ5mtv0.js +1 -0
- package/dist/collapsible-CPJbf6FM.js +1 -0
- package/dist/components/attachment-types.d.ts +53 -1
- package/dist/components/attachments.d.ts +31 -0
- package/dist/components/audio-visualizer/fit-scale.d.ts +50 -0
- package/dist/components/audio-visualizer/index.d.ts +15 -1
- package/dist/components/audio-visualizer/variant-bar.d.ts +24 -1
- package/dist/components/card-renderer.d.ts +13 -0
- package/dist/components/card.d.ts +4 -0
- package/dist/components/chat-thread.d.ts +49 -42
- package/dist/components/code-block.d.ts +22 -0
- package/dist/components/conversation-item.d.ts +66 -1
- package/dist/components/conversation-list.d.ts +77 -0
- package/dist/components/form-widgets.d.ts +67 -2
- package/dist/components/form.d.ts +89 -0
- package/dist/components/message.d.ts +29 -0
- package/dist/components/reasoning.d.ts +6 -0
- package/dist/components/scroll-button.d.ts +11 -0
- package/dist/components/thread.d.ts +5 -0
- package/dist/components/toast.d.ts +2 -1
- package/dist/components/tool-types.d.ts +9 -0
- package/dist/components/voice-input.d.ts +8 -0
- package/dist/components/voice-output.d.ts +12 -1
- package/dist/components/workspace-shell.d.ts +87 -0
- package/dist/composer-CjngLzal.js +106 -0
- package/dist/confirm-card-DCx_A4bU.js +1 -0
- package/dist/construct-cli.es.js +1169 -0
- package/dist/context-BY8V-Nlp.js +1 -0
- package/dist/controllable-D43BKmtX.js +1 -0
- package/dist/conversation-list-D4lLU_yS.js +1 -0
- package/dist/copy-B6DO4PqB.js +1 -0
- package/dist/core-AYMC6_lb.js +12 -5874
- package/dist/{create-tween-CUzOlaMS.js → create-tween-BPzaefTp.js} +1 -1
- package/dist/{create-tween-B5Y4Im8G.js → create-tween-CnMHviKB.js} +1 -1
- package/dist/{create-tween-4z1XYLkR.js → create-tween-D1aiGZZh.js} +1 -1
- package/dist/{elements/chunks/create-tween-CUrM6D_o.js → create-tween-DUSQUKpr.js} +2 -2
- package/dist/css-M7EaDHN_.js +1 -6
- package/dist/custom-elements.json +3468 -1927
- package/dist/default-input-CucQEOqH.js +1 -0
- package/dist/define-CGGX-7Vg.js +1 -0
- package/dist/define.d.ts +4 -0
- package/dist/define.js +510 -0
- package/dist/define.server.d.ts +5 -0
- package/dist/define.server.js +506 -0
- package/dist/diagnostics/hook.d.ts +81 -0
- package/dist/diagnostics/index.d.ts +7 -0
- package/dist/diagnostics/report-request.d.ts +61 -0
- package/dist/diagnostics.d.ts +5 -0
- package/dist/diagnostics.js +209 -0
- package/dist/disclosure-CbLtajUQ.js +1 -0
- package/dist/dropdown-BwhViJFd.js +1 -0
- 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/autoloader.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-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/checkbox-group.d.ts +1 -0
- package/dist/elements/checkbox-group.js +1 -0
- package/dist/elements/checkbox.d.ts +1 -0
- package/dist/elements/checkbox.js +1 -0
- package/dist/elements/checkpoint.js +1 -1
- package/dist/elements/choice.js +1 -1
- 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-item.d.ts +1 -0
- package/dist/elements/conversation-item.js +1 -0
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/default-input.d.ts +3 -3
- package/dist/elements/define-entry.d.ts +12 -0
- package/dist/elements/define.d.ts +27 -0
- package/dist/elements/diagnostic-events.d.ts +74 -0
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/dock.d.ts +1 -0
- package/dist/elements/dock.js +243 -0
- package/dist/elements/dropdown.d.ts +1 -0
- package/dist/elements/dropdown.js +1 -0
- package/dist/elements/editable-label.js +1 -1
- package/dist/elements/element-data-types.d.ts +37 -0
- package/dist/elements/element-diagnostics.d.ts +81 -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-grid.d.ts +1 -0
- package/dist/elements/pane-grid.js +1 -0
- 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/radio-group.d.ts +1 -0
- package/dist/elements/radio-group.js +1 -0
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/register.d.ts +2 -0
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +3 -3
- 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/select.d.ts +1 -0
- package/dist/elements/select.js +1 -0
- 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/slider.d.ts +1 -0
- package/dist/elements/slider.js +1 -0
- package/dist/elements/slots.d.ts +36 -4
- 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/voice-input.js +1 -1
- package/dist/elements/voice-output.js +1 -1
- package/dist/elements.d.ts +589 -167
- package/dist/{elements/chunks/ellipsis-CVxqfsDZ.js → ellipsis-DFr4Vqr3.js} +1 -1
- package/dist/embed-5s_vU4J0.js +1 -0
- package/dist/engine-javascript-vq0WuIJl.js +14 -2516
- package/dist/{elements/chunks/external-link-DG2sRdQL.js → external-link-u9d85ORQ.js} +1 -1
- package/dist/file-text-CX7_x42o.js +1 -0
- package/dist/{elements/chunks/file-tree-yGWNK0Js.js → file-tree-D3kBjXI5.js} +1 -1
- package/dist/folder-V-YdIL8f.js +1 -0
- package/dist/form-BRNUMCN2.js +1 -0
- package/dist/github-dark-dimmed-DUshB20C.js +1 -4
- package/dist/github-light-JYsPkUQd.js +1 -4
- package/dist/hover-card-DaeiYrTA.js +1 -0
- package/dist/html-CPZ3oZQ7.js +1 -10
- package/dist/icon-BpixdZNq.js +1 -0
- package/dist/{elements/chunks/index-BCRhi84a.js → index-xu_pdcPi.js} +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8473 -6470
- package/dist/index.server.js +6495 -4958
- package/dist/info-8mFsIjS3.js +1 -0
- package/dist/input-d1Yuu-hz.js +1 -0
- package/dist/javascript-C25yR2R2.js +1 -6
- package/dist/json-DxJze_jm.js +1 -6
- package/dist/kai-provider.es.js +40 -40
- package/dist/kai.es.js +1 -1
- package/dist/kbd-961zMPFB.js +1 -0
- package/dist/link-DlZZBGaR.js +1 -0
- package/dist/{elements/chunks/link-preview-Cf5KOP-i.js → link-preview-DIIbV2Sd.js} +1 -1
- package/dist/loader-YQszHFaW.js +1 -0
- package/dist/{elements/chunks/markdown-DbozyYqa.js → markdown-CVk1MPsj.js} +1 -1
- package/dist/mcp.es.js +3873 -544
- package/dist/message-CwKVEdZg.js +1 -0
- package/dist/message-DS8lzHc1.js +1 -0
- package/dist/message-circle-Xf8Q-vZp.js +1 -0
- package/dist/message-square-Cxnwgkns.js +1 -0
- package/dist/{elements/chunks/minimize-2-SegJ_oku.js → minimize-2-UEZmP2QT.js} +1 -1
- package/dist/{elements/chunks/model-switcher-D7JrFFHp.js → model-switcher-Kk1jEQ5t.js} +1 -1
- package/dist/{elements/chunks/overlay-CV7z2YuX.js → overlay-C1od6LOz.js} +1 -1
- package/dist/panel-right-ryET0yyn.js +1 -0
- package/dist/paperclip-BDNoZFJP.js +1 -0
- package/dist/play-OFIvYXUQ.js +1 -0
- package/dist/primitives/card-data-types.d.ts +49 -0
- package/dist/primitives/card-routing.d.ts +1 -33
- package/dist/primitives/card-validate.d.ts +2 -2
- package/dist/primitives/chat-config.d.ts +29 -2
- package/dist/primitives/field-mask.d.ts +96 -0
- package/dist/primitives/field-semantics.d.ts +36 -0
- package/dist/primitives/input-mask.d.ts +46 -0
- package/dist/primitives/url-scheme-policy.d.ts +34 -0
- package/dist/primitives/use-resize-observer.d.ts +23 -0
- package/dist/primitives/use-speech-recognition.d.ts +8 -0
- package/dist/primitives/use-text-stream.d.ts +5 -0
- package/dist/progress-bar-BvYX0aoy.js +1 -0
- package/dist/prompt-suggestion-BRFu2lcu.js +1 -0
- package/dist/radio-DcL23cNJ.js +1 -0
- package/dist/react/index.d.ts +306 -283
- package/dist/react.js +309 -247
- package/dist/reasoning-Cackq4Rh.js +1 -0
- package/dist/register-impl-C7rENvPK.js +424 -0
- package/dist/{elements/chunks/resizable-Dpzjlvp4.js → resizable-Cp9HUYih.js} +1 -1
- package/dist/rotate-ccw-0DLRDHH5.js +1 -0
- package/dist/rotate-cw-DOB9IGcU.js +1 -0
- package/dist/schemas/form.schema.json +21 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/tool-defs.d.ts +45 -0
- package/dist/schemas.js +398 -305
- package/dist/scroll-area-emVmWP4K.js +1 -0
- package/dist/scroll-button-CeP_gv1x.js +1 -0
- package/dist/select-CWmu00tS.js +1 -0
- package/dist/{elements/chunks/separator-DH2r_ZSZ.js → separator-CE6vly6z.js} +1 -1
- package/dist/{elements/chunks/settings-BFMOd6yB.js → settings-CE-78SvZ.js} +1 -1
- package/dist/{elements/chunks/settings-group-B3VZKIcz.js → settings-group-ZFWNxFQR.js} +1 -1
- package/dist/{elements/chunks/skeleton-N8BuWYmf.js → skeleton-BebdP4mf.js} +1 -1
- package/dist/slider-BAKRYUlz.js +1 -0
- package/dist/slots-DaNjX0rc.js +1 -0
- package/dist/{solid-BMuDmFo_.js → solid-BE5ui6sy.js} +10672 -8116
- package/dist/{solid-CGYNdLRR.js → solid-DFhsce3O.js} +8137 -6056
- package/dist/solid.d.ts +15 -0
- package/dist/solid.js +248 -235
- package/dist/solid.server.js +248 -235
- package/dist/source-B0FlguSx.js +1 -0
- package/dist/star-CBMZvLuN.js +1 -0
- package/dist/state/index.d.ts +5 -1
- package/dist/state/mock.d.ts +32 -2
- package/dist/state/persistence.d.ts +51 -0
- package/dist/state/stream.d.ts +50 -0
- package/dist/state/threads.d.ts +71 -0
- package/dist/state.js +297 -172
- package/dist/store-7eoadydQ.js +1 -0
- package/dist/svelte--5p79yCD.js +1 -15
- package/dist/switch-CViARZCy.js +1 -0
- package/dist/tasks-card-MjCcOhR_.js +1 -0
- package/dist/text-shimmer-DKlwRF2G.js +1 -0
- package/dist/textarea-3ay2Me2-.js +1 -0
- package/dist/theme.tokens.css +82 -13
- package/dist/{elements/chunks/thumbs-up-DQe0hvkZ.js → thumbs-up-DQcu2HMO.js} +1 -1
- package/dist/toast-store-C6yKOhbk.js +1 -0
- package/dist/{elements/chunks/tool-C1YtxwPu.js → tool-BCYNlfKy.js} +1 -1
- package/dist/{elements/chunks/tooltip-BqwnFWhn.js → tooltip-05zI4hjs.js} +1 -1
- package/dist/trash-2-BR1RxGky.js +1 -0
- package/dist/{elements/chunks/triangle-alert-B6or7F5u.js → triangle-alert-DHohDOCy.js} +1 -1
- package/dist/tsx-B8rCNbgL.js +1 -6
- package/dist/types.d.ts +4 -2
- package/dist/typescript-RycA9KXf.js +1 -6
- package/dist/ui/checkbox-group.d.ts +83 -0
- package/dist/ui/checkbox.d.ts +40 -0
- package/dist/ui/dock.d.ts +131 -0
- package/dist/ui/hover-card.d.ts +44 -0
- package/dist/ui/icon.d.ts +3 -0
- package/dist/ui/input.d.ts +48 -2
- package/dist/ui/radio.d.ts +85 -0
- package/dist/ui/select.d.ts +71 -0
- package/dist/ui/slider.d.ts +65 -0
- package/dist/ui/switch.d.ts +9 -2
- package/dist/upload-BbGW6A_u.js +1 -0
- package/dist/url-scheme-policy-DHpoTJwB.js +1 -0
- package/dist/use-card-resolution-CJW4grFa.js +1 -0
- package/dist/{variant-aurora-DwSOfraQ.js → variant-aurora-BUOVgPOB.js} +27 -27
- package/dist/{variant-aurora-wKvAQ5wp.js → variant-aurora-CUsUJvFI.js} +28 -28
- package/dist/{variant-aurora-XEkPT0_z.js → variant-aurora-CW2i4bfr.js} +2 -2
- package/dist/{elements/chunks/variant-aurora-QXTZPyST.js → variant-aurora-xiMPty8f.js} +2 -2
- package/dist/variant-custom-BQtOnmeO.js +1 -0
- package/dist/{variant-custom-BhS9wIpU.js → variant-custom-CAm9L-E5.js} +65 -65
- package/dist/{variant-custom-eFIg2XWQ.js → variant-custom-CAnzzppW.js} +40 -40
- package/dist/variant-custom-D91HjAKz.js +1 -0
- package/dist/{variant-wave-CUWGx9Bn.js → variant-wave-Ca1Ls4_y.js} +21 -21
- package/dist/{variant-wave-CbVsmgwT.js → variant-wave-CxX39DKd.js} +25 -25
- package/dist/{variant-wave-BwzrHD1s.js → variant-wave-DYyzIIZv.js} +2 -2
- package/dist/{elements/chunks/variant-wave-DDCwhLas.js → variant-wave-uY5crU_K.js} +2 -2
- package/dist/vue-BmIZj4XD.js +1 -33
- package/dist/wire/chunk.d.ts +47 -0
- package/dist/wire/diagnostics.d.ts +575 -0
- package/dist/wire/encode-probe.d.ts +70 -0
- package/dist/wire/encode.d.ts +24 -0
- package/dist/wire/index.d.ts +2 -0
- package/dist/wire/sse.d.ts +10 -2
- package/dist/wire.js +917 -480
- package/dist/x-C5m1JFgi.js +1 -0
- package/frameworks/react/index.tsx +325 -108
- package/llms-full.txt +1354 -82
- package/llms.txt +6 -3
- package/package.json +39 -6
- package/src/agent-tooling/archetypes.ts +41 -9
- package/src/agent-tooling/catalog/README.md +676 -0
- package/src/agent-tooling/catalog/catalog-types.ts +231 -0
- package/src/agent-tooling/catalog/fabrications.ts +96 -0
- package/src/agent-tooling/catalog/invariants.ts +284 -0
- package/src/agent-tooling/catalog/labs-titles.ts +114 -0
- package/src/agent-tooling/catalog/scenarios.ts +87 -0
- package/src/agent-tooling/catalog/surfaces.ts +347 -0
- package/src/agent-tooling/construct/cli-entry.ts +8 -0
- package/src/agent-tooling/construct/cli.ts +131 -0
- package/src/agent-tooling/construct/codegen.ts +1353 -0
- package/src/agent-tooling/construct/construct.v1.schema.json +250 -0
- package/src/agent-tooling/construct/dev.ts +148 -0
- package/src/agent-tooling/construct/fixtures/demo-widget.construct.json +7 -0
- package/src/agent-tooling/construct/fixtures/ops-console.construct.json +44 -0
- package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +23 -0
- package/src/agent-tooling/construct/schema.ts +371 -0
- package/src/agent-tooling/integrations/anthropic.ts +7 -1
- package/src/agent-tooling/integrations/cloudflare.ts +43 -2
- package/src/agent-tooling/integrations/langgraph.ts +7 -1
- package/src/agent-tooling/integrations/mastra.ts +7 -1
- package/src/agent-tooling/integrations/mock.ts +92 -17
- package/src/agent-tooling/integrations/ollama.ts +7 -1
- package/src/agent-tooling/integrations/openai.ts +7 -1
- package/src/agent-tooling/integrations/openrouter.ts +7 -1
- package/src/agent-tooling/integrations/pi.ts +56 -1
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +7 -1
- package/src/agent-tooling/mcp/css-raw.d.ts +12 -0
- package/src/agent-tooling/mcp/manifest.ts +100 -1
- package/src/agent-tooling/mcp/server.ts +63 -6
- package/src/agent-tooling/mcp/tools/construct.ts +130 -0
- package/src/agent-tooling/mcp/tools/debug.ts +126 -4
- package/src/agent-tooling/mcp/tools/reference.ts +542 -5
- package/src/agent-tooling/mcp/tools/scaffold.ts +1834 -307
- package/src/agent-tooling/mcp/tools/theme.ts +146 -30
- package/src/agent-tooling/mcp/validate-args.ts +141 -0
- package/src/agent-tooling/recipes/composed-thread.ts +714 -0
- package/src/agent-tooling/recipes/index.ts +22 -0
- package/src/agent-tooling/recipes/types.ts +32 -0
- package/src/agent-tooling/registry.ts +24 -7
- package/src/agent-tooling/route-emit.ts +26 -2
- package/src/components/attachment-types.ts +54 -1
- package/src/components/attachments.tsx +169 -22
- package/src/components/audio-visualizer/fit-scale.ts +112 -0
- package/src/components/audio-visualizer/index.tsx +80 -3
- package/src/components/audio-visualizer/variant-aurora.tsx +10 -4
- package/src/components/audio-visualizer/variant-bar.tsx +38 -6
- package/src/components/audio-visualizer/variant-custom.tsx +8 -2
- package/src/components/audio-visualizer/variant-grid.tsx +16 -11
- package/src/components/audio-visualizer/variant-radial.tsx +15 -10
- package/src/components/audio-visualizer/variant-wave.tsx +7 -2
- package/src/components/card-renderer.tsx +39 -8
- package/src/components/card.tsx +10 -2
- package/src/components/chat-container.tsx +4 -1
- package/src/components/chat-scope-picker.tsx +2 -2
- package/src/components/chat-thread.tsx +105 -13
- package/src/components/choice-card.tsx +102 -37
- package/src/components/coachmark.tsx +1 -1
- package/src/components/code-block.tsx +81 -5
- package/src/components/composer.tsx +89 -8
- package/src/components/confirm-card.tsx +20 -4
- package/src/components/conversation-item.tsx +138 -4
- package/src/components/conversation-list.tsx +230 -15
- package/src/components/embed.tsx +4 -0
- package/src/components/empty.tsx +14 -3
- package/src/components/file-tree.tsx +5 -1
- package/src/components/form-widgets.tsx +257 -195
- package/src/components/form.tsx +336 -21
- package/src/components/loader.tsx +12 -5
- package/src/components/message-skills.tsx +1 -1
- package/src/components/message.tsx +142 -12
- package/src/components/prompt-input.tsx +7 -1
- package/src/components/prompt-suggestion.tsx +4 -1
- package/src/components/reasoning.tsx +30 -3
- package/src/components/response-compare.tsx +2 -2
- package/src/components/response-stream.tsx +13 -7
- package/src/components/screen.tsx +5 -0
- package/src/components/scroll-button.tsx +63 -4
- package/src/components/source.tsx +6 -1
- package/src/components/tasks-card.tsx +58 -16
- package/src/components/thread.tsx +10 -1
- package/src/components/toast.tsx +11 -5
- package/src/components/tool-types.ts +9 -0
- package/src/components/voice-input.tsx +35 -3
- package/src/components/voice-output.tsx +46 -6
- package/src/components/workspace-shell.tsx +285 -0
- package/src/diagnostics/hook.ts +352 -0
- package/src/diagnostics/index.ts +82 -0
- package/src/diagnostics/report-request.ts +296 -0
- package/src/elements/attachments.tsx +9 -8
- package/src/elements/audio-visualizer.tsx +48 -4
- package/src/elements/chat-workspace.tsx +159 -287
- package/src/elements/chat.tsx +31 -10
- package/src/elements/checkbox-group.tsx +164 -0
- package/src/elements/checkbox.tsx +134 -0
- package/src/elements/code-block.tsx +19 -1
- package/src/elements/command.tsx +4 -1
- package/src/elements/compiled.css +1 -1
- package/src/elements/composer.tsx +12 -1
- package/src/elements/conversation-item.tsx +120 -0
- package/src/elements/conversation-list.tsx +60 -11
- package/src/elements/default-input.tsx +5 -5
- package/src/elements/define-entry.ts +12 -0
- package/src/elements/define.tsx +168 -8
- package/src/elements/diagnostic-events.ts +114 -0
- package/src/elements/dialog.tsx +47 -0
- package/src/elements/disclosure.ts +34 -12
- package/src/elements/dock.tsx +215 -0
- package/src/elements/dropdown.tsx +123 -0
- package/src/elements/element-data-types.ts +40 -0
- package/src/elements/element-diagnostics.ts +392 -0
- package/src/elements/element-manifest.json +36 -0
- package/src/elements/element-meta.json +1483 -560
- package/src/elements/element-nonscalar.json +185 -0
- package/src/elements/element-types.d.ts +589 -167
- package/src/elements/feedback-bar.tsx +5 -0
- package/src/elements/icon-names.json +29 -0
- package/src/elements/input.tsx +312 -23
- package/src/elements/menu.tsx +13 -0
- package/src/elements/message.tsx +2 -0
- package/src/elements/pane-grid.tsx +111 -0
- package/src/elements/prompt-dock.tsx +2 -1
- package/src/elements/prompt-input.tsx +16 -10
- package/src/elements/radio-group.tsx +129 -0
- package/src/elements/register-impl.ts +52 -0
- package/src/elements/register.ts +28 -0
- package/src/elements/resizable.tsx +52 -25
- package/src/elements/scroll-button.tsx +59 -6
- package/src/elements/select.tsx +165 -0
- package/src/elements/slider.tsx +171 -0
- package/src/elements/slots.ts +108 -13
- package/src/elements/styles.css +119 -9
- package/src/elements/thinking-bar.tsx +16 -7
- package/src/elements/thread.tsx +2 -0
- package/src/elements/toast.tsx +17 -1
- package/src/elements/tool.tsx +26 -5
- package/src/elements/voice-input.tsx +11 -2
- package/src/elements/voice-output.tsx +16 -3
- package/src/index.ts +4 -1
- package/src/primitives/card-data-types.ts +49 -0
- package/src/primitives/card-host.tsx +4 -2
- package/src/primitives/card-routing.ts +7 -56
- package/src/primitives/card-schemas/form.schema.json +21 -1
- package/src/primitives/card-validate.ts +10 -2
- package/src/primitives/chat-config.tsx +33 -6
- package/src/primitives/field-mask.ts +256 -0
- package/src/primitives/field-semantics.ts +115 -0
- package/src/primitives/input-mask.ts +853 -0
- package/src/primitives/toast-store.ts +66 -4
- package/src/primitives/url-scheme-policy.ts +70 -0
- package/src/primitives/use-resize-observer.ts +33 -0
- package/src/primitives/use-speech-recognition.ts +12 -1
- package/src/primitives/use-stick-to-bottom.ts +34 -2
- package/src/primitives/use-text-stream.ts +33 -2
- package/src/remote/provider-runtime.ts +6 -3
- package/src/schemas/index.ts +1 -0
- package/src/schemas/tool-defs.ts +307 -6
- package/src/solid.ts +15 -0
- package/src/state/index.ts +13 -1
- package/src/state/mock.ts +92 -6
- package/src/state/persistence.ts +180 -0
- package/src/state/stream.ts +71 -4
- package/src/state/threads.ts +142 -0
- package/src/types.ts +4 -2
- package/src/ui/agent-card.tsx +2 -2
- package/src/ui/avatar.tsx +1 -1
- package/src/ui/checkbox-group.tsx +153 -0
- package/src/ui/checkbox.tsx +63 -0
- package/src/ui/dialog.tsx +6 -0
- package/src/ui/dock.tsx +584 -0
- package/src/ui/dropdown.tsx +67 -23
- package/src/ui/hover-card.tsx +156 -6
- package/src/ui/icon.tsx +53 -0
- package/src/ui/input.tsx +275 -16
- package/src/ui/kbd.tsx +1 -1
- package/src/ui/nav.tsx +1 -1
- package/src/ui/pane-group.tsx +2 -2
- package/src/ui/radio.tsx +150 -0
- package/src/ui/resizable.tsx +11 -0
- package/src/ui/select.tsx +168 -0
- package/src/ui/slider.tsx +178 -0
- package/src/ui/switch.tsx +49 -18
- package/src/utils/cn.ts +11 -5
- package/src/wire/chunk.ts +47 -0
- package/src/wire/consume.ts +185 -26
- package/src/wire/diagnostics.ts +727 -0
- package/src/wire/encode-probe.ts +214 -0
- package/src/wire/encode.ts +267 -14
- package/src/wire/formats/anthropic.ts +8 -1
- package/src/wire/formats/openai.ts +5 -0
- package/src/wire/index.ts +22 -0
- package/src/wire/read.ts +250 -6
- package/src/wire/sse.ts +16 -3
- package/theme.css +84 -13
- package/dist/elements/chunks/action-icons-DW9muWrY.js +0 -1
- package/dist/elements/chunks/arrow-left-iJVnQmxA.js +0 -1
- package/dist/elements/chunks/artifact-BSuPYFHY.js +0 -1
- package/dist/elements/chunks/attachments-CL6TaqIb.js +0 -1
- package/dist/elements/chunks/audio-visualizer-BuUqQmaO.js +0 -1
- package/dist/elements/chunks/badge-TIMiJFKc.js +0 -1
- package/dist/elements/chunks/bash-InADTalH.js +0 -1
- package/dist/elements/chunks/card-renderer-CSoTL_e1.js +0 -1
- package/dist/elements/chunks/card-routing-BK09BdmL.js +0 -1
- package/dist/elements/chunks/chat-thread-DxoKaStk.js +0 -1
- package/dist/elements/chunks/check-MdLzbxrm.js +0 -1
- package/dist/elements/chunks/chevron-down-MK7IzDqe.js +0 -1
- package/dist/elements/chunks/chevron-right-C5jXhmtV.js +0 -1
- package/dist/elements/chunks/choice-card-CGMc3kek.js +0 -1
- package/dist/elements/chunks/circle-BG7VkPep.js +0 -1
- package/dist/elements/chunks/circle-check-GqvO2UBs.js +0 -1
- package/dist/elements/chunks/circle-x-mhH7pOK2.js +0 -1
- package/dist/elements/chunks/code-block-ClhQO9RW.js +0 -1
- package/dist/elements/chunks/collapsible-DBcBkFPh.js +0 -1
- package/dist/elements/chunks/composer-CZZmtYOT.js +0 -69
- package/dist/elements/chunks/confirm-card-BWjf2-xo.js +0 -1
- package/dist/elements/chunks/context-hKjNqiyQ.js +0 -1
- package/dist/elements/chunks/conversation-list-CsGJjSKG.js +0 -1
- package/dist/elements/chunks/core-AYMC6_lb.js +0 -12
- package/dist/elements/chunks/css-M7EaDHN_.js +0 -1
- package/dist/elements/chunks/default-input-B1Mem5wu.js +0 -1
- package/dist/elements/chunks/define-B_tXMYRm.js +0 -1
- package/dist/elements/chunks/disclosure-DAoYOKew.js +0 -1
- package/dist/elements/chunks/download-DnCyWFJE.js +0 -1
- package/dist/elements/chunks/dropdown-CmNna5lT.js +0 -1
- package/dist/elements/chunks/embed-CjAD2jSi.js +0 -1
- package/dist/elements/chunks/engine-javascript-vq0WuIJl.js +0 -141
- package/dist/elements/chunks/file-text-D0J9F6M7.js +0 -1
- package/dist/elements/chunks/folder-NV1pi_ud.js +0 -1
- package/dist/elements/chunks/form-Cp8Y00Wn.js +0 -1
- package/dist/elements/chunks/github-dark-dimmed-DUshB20C.js +0 -1
- package/dist/elements/chunks/github-light-JYsPkUQd.js +0 -1
- package/dist/elements/chunks/hover-card-6KtXpLwT.js +0 -1
- package/dist/elements/chunks/html-CPZ3oZQ7.js +0 -1
- package/dist/elements/chunks/icon-97R8SR2p.js +0 -1
- package/dist/elements/chunks/info-C8r5Q6cc.js +0 -1
- package/dist/elements/chunks/input-DrseEjhp.js +0 -1
- package/dist/elements/chunks/javascript-C25yR2R2.js +0 -1
- package/dist/elements/chunks/json-DxJze_jm.js +0 -1
- package/dist/elements/chunks/kbd-OGJDUT-O.js +0 -1
- package/dist/elements/chunks/link-BdsfLB7b.js +0 -1
- package/dist/elements/chunks/loader-B5QzK_8_.js +0 -1
- package/dist/elements/chunks/message-CE4k-qaj.js +0 -1
- package/dist/elements/chunks/message-DtXKPqiR.js +0 -1
- package/dist/elements/chunks/message-square-C9ovmtOo.js +0 -1
- package/dist/elements/chunks/paperclip-Bg0ITU3b.js +0 -1
- package/dist/elements/chunks/progress-bar-D1_rzt6N.js +0 -1
- package/dist/elements/chunks/prompt-suggestion-D5Sm8xF1.js +0 -1
- package/dist/elements/chunks/reasoning-BrxQfpfI.js +0 -1
- package/dist/elements/chunks/rotate-cw-DzVDJOA1.js +0 -1
- package/dist/elements/chunks/scroll-area-93A1bbeG.js +0 -1
- package/dist/elements/chunks/scroll-button-CrTo7wm4.js +0 -1
- package/dist/elements/chunks/share-DgNbkJKY.js +0 -1
- package/dist/elements/chunks/slots-CIw9RlAe.js +0 -1
- package/dist/elements/chunks/source-w9V0NnBn.js +0 -1
- package/dist/elements/chunks/star-DHvACxtm.js +0 -1
- package/dist/elements/chunks/store-HIPGhNz9.js +0 -1
- package/dist/elements/chunks/svelte--5p79yCD.js +0 -1
- package/dist/elements/chunks/tasks-card-lPxoodlA.js +0 -1
- package/dist/elements/chunks/text-shimmer-BY_rI3s5.js +0 -1
- package/dist/elements/chunks/textarea-DPfuhswM.js +0 -1
- package/dist/elements/chunks/toast-store-VUZZBhzH.js +0 -1
- package/dist/elements/chunks/tsx-B8rCNbgL.js +0 -1
- package/dist/elements/chunks/typescript-RycA9KXf.js +0 -1
- package/dist/elements/chunks/use-card-resolution-DJg32jGH.js +0 -1
- package/dist/elements/chunks/variant-custom-D5ZlmziF.js +0 -1
- package/dist/elements/chunks/video-Bb86fVYI.js +0 -1
- package/dist/elements/chunks/vue-BmIZj4XD.js +0 -1
- package/dist/elements/chunks/x-BOhjBeOd.js +0 -1
- package/dist/llms/llms-full.txt +0 -2834
- package/dist/llms/llms.txt +0 -156
- package/dist/primitives/card-validate-generator.testlib.d.ts +0 -20
- package/dist/register-impl-DGmGzrEM.js +0 -145
- package/dist/ui/stat.d.ts +0 -16
- package/dist/variant-custom-MkTNTycd.js +0 -1
- package/src/primitives/card-validate-generator.testlib.ts +0 -38
- package/src/ui/stat.tsx +0 -41
- /package/dist/{elements/chunks/card-tags-D8lZ-C_U.js → card-tags-D8lZ-C_U.js} +0 -0
- /package/dist/{elements/chunks/link-preview-DNILK391.js → link-preview-DNILK391.js} +0 -0
|
@@ -7,6 +7,7 @@ import { useAudioAnalysis } from '../../primitives/use-audio-analysis';
|
|
|
7
7
|
import { mirrorBandsCenterOut, mirrorBandsAroundRing } from '../../primitives/audio-bands';
|
|
8
8
|
import { normalizeState, type VisualizerState } from '../../primitives/visualizer-sequences';
|
|
9
9
|
import { BarVisualizer, type VariantProps } from './variant-bar';
|
|
10
|
+
import { createFitScale } from './fit-scale';
|
|
10
11
|
import { GridVisualizer } from './variant-grid';
|
|
11
12
|
import { RadialVisualizer } from './variant-radial';
|
|
12
13
|
import { defaultBarCount, defaultGridCount, defaultRadialBarCount, type VisualizerSize } from './sizes';
|
|
@@ -75,10 +76,24 @@ export interface AudioVisualizerProps {
|
|
|
75
76
|
complexity?: number;
|
|
76
77
|
/** Setting this makes the element an announced image instead of decorative. */
|
|
77
78
|
label?: string;
|
|
79
|
+
/** Live audio to analyze. NOTE: amplitude renders only while
|
|
80
|
+
* `state === 'speaking'` unless `listeningAmplitude` is set; every other
|
|
81
|
+
* state plays its scripted animation and the analysis output is unused. */
|
|
78
82
|
stream?: MediaStream;
|
|
83
|
+
/** Same speaking-only amplitude rule as `stream`: see `listeningAmplitude`. */
|
|
79
84
|
audioElement?: HTMLMediaElement;
|
|
80
|
-
/** Pre-computed levels. Set this and no AudioContext is ever constructed.
|
|
85
|
+
/** Pre-computed levels. Set this and no AudioContext is ever constructed.
|
|
86
|
+
* Same speaking-only amplitude rule as `stream`: see `listeningAmplitude`. */
|
|
81
87
|
bands?: number[];
|
|
88
|
+
/**
|
|
89
|
+
* Opt in to rendering live amplitude during `listening` as well, using the
|
|
90
|
+
* same presentation as `speaking`. Default off, which keeps LiveKit parity:
|
|
91
|
+
* amplitude (from `stream`, `audioElement` or `bands`) renders only while
|
|
92
|
+
* `state === 'speaking'`. Set this to show a real mic-level picture while
|
|
93
|
+
* the USER is the one talking. Forwarded to every variant; see
|
|
94
|
+
* `amplitudeRenderState` in variant-bar for the single mapping they share.
|
|
95
|
+
*/
|
|
96
|
+
listeningAmplitude?: boolean;
|
|
82
97
|
/**
|
|
83
98
|
* Custom fragment shader for `variant="custom"`. See `ShaderSpec` for the
|
|
84
99
|
* full contract -- most importantly, `fragment` MUST output premultiplied
|
|
@@ -371,11 +386,15 @@ export function AudioVisualizer(props: AudioVisualizerProps): JSX.Element {
|
|
|
371
386
|
// `bands={bands()}`, at every call site below, exactly like `volume`,
|
|
372
387
|
// `complexity`, etc. already are: an explicit prop gets its OWN getter,
|
|
373
388
|
// entirely independent of this one.
|
|
389
|
+
// `listeningAmplitude` is safe inside this bundle (unlike `bands`): it is a
|
|
390
|
+
// boolean a caller sets once, not a signal driven at audio cadence, so
|
|
391
|
+
// reading it through the shared getters cannot drag in a hot subscription.
|
|
374
392
|
const shared = (): Omit<VariantProps, 'bands'> => ({
|
|
375
393
|
state: state(),
|
|
376
394
|
size: size(),
|
|
377
395
|
frozen: reduced(),
|
|
378
396
|
color: props.color,
|
|
397
|
+
listeningAmplitude: props.listeningAmplitude,
|
|
379
398
|
});
|
|
380
399
|
|
|
381
400
|
// The three DOM variants (bar/grid/radial), including the bar fallback
|
|
@@ -390,9 +409,66 @@ export function AudioVisualizer(props: AudioVisualizerProps): JSX.Element {
|
|
|
390
409
|
? { role: 'img' as const, 'aria-label': props.label }
|
|
391
410
|
: { 'aria-hidden': 'true' as const };
|
|
392
411
|
|
|
412
|
+
// Fit-to-container: measured by createFitScale (see fit-scale.ts for the
|
|
413
|
+
// full design rationale). At or above the natural width this contributes
|
|
414
|
+
// nothing but the `max-width` clamp, so the designed px metrics render
|
|
415
|
+
// exactly; below it, the inner wrapper scales the whole picture down and
|
|
416
|
+
// the outer adopts the scaled height so layout follows the visual.
|
|
417
|
+
const fit = createFitScale();
|
|
418
|
+
|
|
393
419
|
return (
|
|
394
|
-
<div
|
|
395
|
-
|
|
420
|
+
<div
|
|
421
|
+
class={cn('inline-flex', props.class)}
|
|
422
|
+
{...a11y()}
|
|
423
|
+
ref={fit.observeOuter}
|
|
424
|
+
style={{
|
|
425
|
+
// What lets a narrow container actually constrain this element: the
|
|
426
|
+
// content is fixed-px, so without the clamp the host box would just
|
|
427
|
+
// overflow (and clip at the viewport edge, the reported defect).
|
|
428
|
+
'max-width': '100%',
|
|
429
|
+
// While shrunk, the inner wrapper's LAYOUT box deliberately keeps its
|
|
430
|
+
// natural size (that is what keeps the measurement honest above), so
|
|
431
|
+
// it overhangs this box below/right of the scaled visual. `hidden`
|
|
432
|
+
// clips that overhang for BOTH painting and hit-testing -- without it
|
|
433
|
+
// the stale layout box covered a sibling button and ate its pointer
|
|
434
|
+
// events (W5 live finding, mechanism 2). Nothing visible is clipped:
|
|
435
|
+
// the scaled visual is exactly this box by construction.
|
|
436
|
+
// `vertical-align: top` rides along with `overflow: hidden`, which is
|
|
437
|
+
// what makes it necessary: hidden overflow moves an inline-flex box's
|
|
438
|
+
// baseline to its bottom border edge, so the surrounding line box
|
|
439
|
+
// grows by the font strut's descent below it and the host measures
|
|
440
|
+
// ~6px taller than the box (measured in headed Chromium: 107.2 vs
|
|
441
|
+
// 101.2). Top alignment opts out of baseline layout entirely. Scoped
|
|
442
|
+
// to the scaled state so default (unscaled) inline placement beside
|
|
443
|
+
// text keeps its original baseline behavior.
|
|
444
|
+
...(fit.scaledHeight() !== undefined
|
|
445
|
+
? { height: `${fit.scaledHeight()}px`, overflow: 'hidden', 'vertical-align': 'top' }
|
|
446
|
+
: {}),
|
|
447
|
+
}}
|
|
448
|
+
>
|
|
449
|
+
<div
|
|
450
|
+
ref={fit.observeInner}
|
|
451
|
+
style={{
|
|
452
|
+
// THE FEEDBACK-LOOP GUARD (W5 live finding, mechanism 1). The inner
|
|
453
|
+
// wrapper is a flex item of the outer, and a flex item's default
|
|
454
|
+
// `align-self: stretch` makes its LAYOUT height follow the outer's
|
|
455
|
+
// -- including the scaled height this component itself adopts below.
|
|
456
|
+
// The ResizeObserver measuring this element for its NATURAL size
|
|
457
|
+
// then reads back the adopted height, k multiplies in again, and
|
|
458
|
+
// the element spirals (measured in headed Chromium: 224px -> 45.7
|
|
459
|
+
// -> 0.85 -> 0.38). `flex-start` + `flex: none` pin this box to its
|
|
460
|
+
// intrinsic content size in BOTH axes, so the measurement can never
|
|
461
|
+
// see anything this component wrote. Unconditional: at scale 1 both
|
|
462
|
+
// are visually identical to the defaults for a single item that
|
|
463
|
+
// defines its container's size.
|
|
464
|
+
flex: '0 0 auto',
|
|
465
|
+
'align-self': 'flex-start',
|
|
466
|
+
...(fit.scale() < 1
|
|
467
|
+
? { transform: `scale(${fit.scale()})`, 'transform-origin': 'top left' }
|
|
468
|
+
: {}),
|
|
469
|
+
}}
|
|
470
|
+
>
|
|
471
|
+
<Switch
|
|
396
472
|
fallback={<BarVisualizer {...domShared()} bands={bands()} barCount={props.barCount} />}
|
|
397
473
|
>
|
|
398
474
|
<Match when={variant() === 'grid'}>
|
|
@@ -446,6 +522,7 @@ export function AudioVisualizer(props: AudioVisualizerProps): JSX.Element {
|
|
|
446
522
|
</Show>
|
|
447
523
|
</Match>
|
|
448
524
|
</Switch>
|
|
525
|
+
</div>
|
|
449
526
|
</div>
|
|
450
527
|
);
|
|
451
528
|
}
|
|
@@ -3,6 +3,7 @@ import { ShaderCanvas, hexToRgb, DEFAULT_SHADER_COLOR } from './shader-canvas';
|
|
|
3
3
|
import { createTween } from '../../primitives/create-tween';
|
|
4
4
|
import type { VisualizerState } from '../../primitives/visualizer-sequences';
|
|
5
5
|
import { CONTAINER_HEIGHT } from './sizes';
|
|
6
|
+
import { amplitudeRenderState } from './variant-bar';
|
|
6
7
|
import type { ShaderVariantProps } from './index';
|
|
7
8
|
import auroraShader from './aurora.glsl';
|
|
8
9
|
|
|
@@ -175,8 +176,13 @@ export default function AuroraVisualizer(props: ShaderVariantProps & { dark?: bo
|
|
|
175
176
|
// nothing upstream resolved a theme at all (the standalone case).
|
|
176
177
|
const resolvedDark = () => props.dark ?? systemDark();
|
|
177
178
|
|
|
179
|
+
// The state the rendering follows: `listeningAmplitude` folds `listening`
|
|
180
|
+
// into the speaking presentation (live-volume uScale). See
|
|
181
|
+
// amplitudeRenderState in variant-bar. `data-kai-state` keeps the real state.
|
|
182
|
+
const renderState = () => amplitudeRenderState(props.state, props.listeningAmplitude);
|
|
183
|
+
|
|
178
184
|
createEffect(() => {
|
|
179
|
-
const t = auroraTargets(
|
|
185
|
+
const t = auroraTargets(renderState());
|
|
180
186
|
// Fact sheet section 5: "0.5 s ease-out unless noted." Frozen (reduced
|
|
181
187
|
// motion) settles on every target immediately instead.
|
|
182
188
|
const landing = props.frozen ? { duration: 0 } : { duration: 0.5, ease: 'easeOut' as const };
|
|
@@ -198,7 +204,7 @@ export default function AuroraVisualizer(props: ShaderVariantProps & { dark?: bo
|
|
|
198
204
|
// ease-out landing, and frozen collapses the spring like any tween.
|
|
199
205
|
scale.to(
|
|
200
206
|
t.scale,
|
|
201
|
-
|
|
207
|
+
renderState() === 'listening' && !props.frozen
|
|
202
208
|
? { type: 'spring', duration: 1.0, bounce: 0.35 }
|
|
203
209
|
: landing,
|
|
204
210
|
);
|
|
@@ -231,7 +237,7 @@ export default function AuroraVisualizer(props: ShaderVariantProps & { dark?: bo
|
|
|
231
237
|
// own value here would wire the self-retriggering effect loop
|
|
232
238
|
// create-tween's doc warns about.
|
|
233
239
|
createEffect(() => {
|
|
234
|
-
if (
|
|
240
|
+
if (renderState() !== 'speaking') return;
|
|
235
241
|
const volume = props.volume;
|
|
236
242
|
if (!(volume > 0)) return;
|
|
237
243
|
if (scale.animating()) return;
|
|
@@ -243,7 +249,7 @@ export default function AuroraVisualizer(props: ShaderVariantProps & { dark?: bo
|
|
|
243
249
|
// absolute time in the shader, so a nonzero value would keep the figure
|
|
244
250
|
// spinning through reduced motion.
|
|
245
251
|
const rotationValue = () =>
|
|
246
|
-
props.frozen ? 0 : (auroraTargets(
|
|
252
|
+
props.frozen ? 0 : (auroraTargets(renderState()).rotation * Math.PI) / 180;
|
|
247
253
|
|
|
248
254
|
// uTheme: 0 selects the shader's DARK colour pipeline, 1 selects LIGHT
|
|
249
255
|
// (aurora.glsl.ts, fact sheet section 4 -- a real branch in the colour
|
|
@@ -9,8 +9,18 @@ import { CONTAINER_HEIGHT, GAP, BAR_WIDTH, defaultBarCount, type VisualizerSize
|
|
|
9
9
|
export interface VariantProps {
|
|
10
10
|
state: VisualizerState;
|
|
11
11
|
size: VisualizerSize;
|
|
12
|
-
/** Multiband levels, 0..1. Only read while `state === 'speaking'
|
|
12
|
+
/** Multiband levels, 0..1. Only read while `state === 'speaking'`, or also
|
|
13
|
+
* while `'listening'` when `listeningAmplitude` is set. */
|
|
13
14
|
bands: number[];
|
|
15
|
+
/**
|
|
16
|
+
* Opt in to rendering live amplitude during `listening` as well: the
|
|
17
|
+
* variant presents `listening` exactly as it presents `speaking` (live
|
|
18
|
+
* levels, lit geometry) while the host keeps reporting the real state via
|
|
19
|
+
* `data-kai-state`. Default off, which preserves LiveKit parity: amplitude
|
|
20
|
+
* renders only while `state === 'speaking'`, and every other state plays
|
|
21
|
+
* its scripted sequence. See `amplitudeRenderState`.
|
|
22
|
+
*/
|
|
23
|
+
listeningAmplitude?: boolean;
|
|
14
24
|
/** `prefers-reduced-motion`: pin the sequencer at its first frame. */
|
|
15
25
|
frozen: boolean;
|
|
16
26
|
/** Overrides the inherited `currentColor` the bars are painted with. */
|
|
@@ -42,20 +52,42 @@ export interface VariantProps {
|
|
|
42
52
|
* `packages/shadcn/components/agents-ui/agent-audio-visualizer-bar.tsx`
|
|
43
53
|
* (Apache License 2.0).
|
|
44
54
|
*/
|
|
55
|
+
/**
|
|
56
|
+
* The state the RENDERING follows, as opposed to the state the consumer set.
|
|
57
|
+
*
|
|
58
|
+
* `listeningAmplitude` opts the `listening` state into the full speaking
|
|
59
|
+
* presentation: every variant routes its state-driven decisions (levels,
|
|
60
|
+
* highlight sequence, thresholds, volume overrides) through this ONE mapping
|
|
61
|
+
* rather than each patching its own `=== 'speaking'` gates, so the opt-in
|
|
62
|
+
* cannot half-apply within a variant. The host's `data-kai-state` deliberately
|
|
63
|
+
* keeps the REAL state, so CSS hooks and consumers observing the element are
|
|
64
|
+
* never lied to. With the flag absent or false this is the identity mapping,
|
|
65
|
+
* which is what keeps the default byte-identical to LiveKit parity.
|
|
66
|
+
*/
|
|
67
|
+
export function amplitudeRenderState(
|
|
68
|
+
state: VisualizerState,
|
|
69
|
+
listeningAmplitude: boolean | undefined,
|
|
70
|
+
): VisualizerState {
|
|
71
|
+
return listeningAmplitude === true && state === 'listening' ? 'speaking' : state;
|
|
72
|
+
}
|
|
73
|
+
|
|
45
74
|
export function BarVisualizer(props: VariantProps & { barCount?: number }): JSX.Element {
|
|
46
75
|
const count = () => props.barCount ?? defaultBarCount(props.size);
|
|
76
|
+
const renderState = () => amplitudeRenderState(props.state, props.listeningAmplitude);
|
|
47
77
|
|
|
48
78
|
// Frozen (reduced motion) parks the sequence on frame 0 rather than stopping
|
|
49
79
|
// the component: the shape still reads, it just does not move.
|
|
50
|
-
const tick = useSequencer(() => (props.frozen ? Infinity : barInterval(
|
|
80
|
+
const tick = useSequencer(() => (props.frozen ? Infinity : barInterval(renderState(), count())));
|
|
51
81
|
|
|
52
|
-
const sequence = () => barSequence(
|
|
82
|
+
const sequence = () => barSequence(renderState(), count());
|
|
53
83
|
const highlighted = () => sequence()[tick() % sequence().length] ?? [];
|
|
54
84
|
|
|
55
|
-
// Bands only mean anything while speaking
|
|
56
|
-
//
|
|
85
|
+
// Bands only mean anything while speaking (or listening under the
|
|
86
|
+
// `listeningAmplitude` opt-in, which renderState folds into 'speaking').
|
|
87
|
+
// Everywhere else the sequence is the whole story, so a stale level never
|
|
88
|
+
// leaks into a scripted state.
|
|
57
89
|
const levels = () =>
|
|
58
|
-
|
|
90
|
+
renderState() === 'speaking'
|
|
59
91
|
? normalizeVolumeBands(props.bands, count())
|
|
60
92
|
: new Array(count()).fill(0);
|
|
61
93
|
|
|
@@ -3,6 +3,7 @@ import { ShaderCanvas, hexToRgb, DEFAULT_SHADER_COLOR, type UniformSpec, type Un
|
|
|
3
3
|
import { createTween } from '../../primitives/create-tween';
|
|
4
4
|
import { shaderTargets } from '../../primitives/visualizer-sequences';
|
|
5
5
|
import { CONTAINER_HEIGHT } from './sizes';
|
|
6
|
+
import { amplitudeRenderState } from './variant-bar';
|
|
6
7
|
import type { ShaderVariantProps } from './index';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -203,6 +204,11 @@ export default function CustomVisualizer(props: ShaderVariantProps): JSX.Element
|
|
|
203
204
|
const intensity = createTween(0.3);
|
|
204
205
|
const speed = createTween(1);
|
|
205
206
|
|
|
207
|
+
// The state the rendering follows: `listeningAmplitude` folds `listening`
|
|
208
|
+
// into the speaking presentation (live-volume intensity). See
|
|
209
|
+
// amplitudeRenderState in variant-bar. `data-kai-state` keeps the real state.
|
|
210
|
+
const renderState = () => amplitudeRenderState(props.state, props.listeningAmplitude);
|
|
211
|
+
|
|
206
212
|
// Intensity has exactly ONE writer -- this effect -- on purpose. The
|
|
207
213
|
// volume override used to live in a second effect ("if speaking,
|
|
208
214
|
// intensity.to(0.3 + 0.7v, instant)") alongside this one's 0.5s tween
|
|
@@ -217,8 +223,8 @@ export default function CustomVisualizer(props: ShaderVariantProps): JSX.Element
|
|
|
217
223
|
// the Task 12 review accepted -- these two wrote the SAME tween. See the
|
|
218
224
|
// wave variant's twin comment; same effect-race class as b5795ac.
|
|
219
225
|
createEffect(() => {
|
|
220
|
-
const t = shaderTargets(
|
|
221
|
-
if (
|
|
226
|
+
const t = shaderTargets(renderState());
|
|
227
|
+
if (renderState() === 'speaking') {
|
|
222
228
|
// Live volume takes over intensity while speaking, with no easing so
|
|
223
229
|
// the picture tracks the audio exactly -- and lands immediately on
|
|
224
230
|
// re-entry regardless of effect ordering. `volume` is only tracked
|
|
@@ -4,7 +4,7 @@ import { normalizeVolumeBands } from '../../primitives/audio-bands';
|
|
|
4
4
|
import { useSequencer } from '../../primitives/use-sequencer';
|
|
5
5
|
import { gridSequence } from '../../primitives/visualizer-sequences';
|
|
6
6
|
import { GRID_CELL, GRID_GAP, defaultGridCount } from './sizes';
|
|
7
|
-
import type
|
|
7
|
+
import { amplitudeRenderState, type VariantProps } from './variant-bar';
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
10
|
* NOTE: The speaking thresholds below DIVERGE from upstream's GridCell math,
|
|
@@ -64,20 +64,25 @@ export function GridVisualizer(
|
|
|
64
64
|
const interval = () => props.interval ?? 100;
|
|
65
65
|
const items = () => Array.from({ length: rows() * cols() }, (_, i) => i);
|
|
66
66
|
|
|
67
|
+
// The state the rendering follows: `listeningAmplitude` folds `listening`
|
|
68
|
+
// into the speaking presentation. See amplitudeRenderState in variant-bar.
|
|
69
|
+
const renderState = () => amplitudeRenderState(props.state, props.listeningAmplitude);
|
|
70
|
+
|
|
67
71
|
const tick = useSequencer(() =>
|
|
68
72
|
// Speaking is driven by audio, not the clock; freezing also parks it.
|
|
69
|
-
props.frozen ||
|
|
73
|
+
props.frozen || renderState() === 'speaking' ? Infinity : interval(),
|
|
70
74
|
);
|
|
71
75
|
|
|
72
|
-
const sequence = () => gridSequence(
|
|
76
|
+
const sequence = () => gridSequence(renderState(), rows(), cols(), props.spread);
|
|
73
77
|
const active = () => sequence()[tick() % sequence().length] ?? { x: -1, y: -1 };
|
|
74
78
|
|
|
75
|
-
// Bands only mean anything while speaking
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
+
// Bands only mean anything while speaking (or listening under the
|
|
80
|
+
// `listeningAmplitude` opt-in, folded in by renderState). Everywhere else
|
|
81
|
+
// the sequence is the whole story, so a stale level never leaks into a
|
|
82
|
+
// scripted state (same guard as BarVisualizer, so the render-prop's `value`
|
|
83
|
+
// means one thing across every variant).
|
|
79
84
|
const levels = () =>
|
|
80
|
-
|
|
85
|
+
renderState() === 'speaking' ? normalizeVolumeBands(props.bands, cols()) : new Array(cols()).fill(0);
|
|
81
86
|
|
|
82
87
|
/**
|
|
83
88
|
* While speaking, a cell lights when its column's level clears a threshold
|
|
@@ -87,7 +92,7 @@ export function GridVisualizer(
|
|
|
87
92
|
* both per the divergence note at the top of this file.
|
|
88
93
|
*/
|
|
89
94
|
function isLit(index: number): boolean {
|
|
90
|
-
if (
|
|
95
|
+
if (renderState() === 'speaking') {
|
|
91
96
|
const y = Math.floor(index / cols());
|
|
92
97
|
const mid = Math.floor(rows() / 2);
|
|
93
98
|
const scaled = (Math.abs(mid - y) / (mid + 1)) * SPEECH_LEVEL_CEILING;
|
|
@@ -100,13 +105,13 @@ export function GridVisualizer(
|
|
|
100
105
|
// upstream rests one stationary centre cell here. 'disconnected' (first-
|
|
101
106
|
// class 2026-08-10) mirrors idle's dark grid for now, pending the LiveKit
|
|
102
107
|
// disconnected-state measurement.
|
|
103
|
-
if (
|
|
108
|
+
if (renderState() === 'idle' || renderState() === 'disconnected') return false;
|
|
104
109
|
return active().x === index % cols() && active().y === Math.floor(index / cols());
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
/** Snap on, fade off: highlighted cells transition 10x faster than they decay. */
|
|
108
113
|
function transition(index: number): string {
|
|
109
|
-
if (
|
|
114
|
+
if (renderState() === 'speaking') return '150ms';
|
|
110
115
|
return `${interval() / (isLit(index) ? 1000 : 100)}s`;
|
|
111
116
|
}
|
|
112
117
|
|
|
@@ -4,7 +4,7 @@ import { normalizeVolumeBands } from '../../primitives/audio-bands';
|
|
|
4
4
|
import { useSequencer } from '../../primitives/use-sequencer';
|
|
5
5
|
import { radialSequence, radialInterval } from '../../primitives/visualizer-sequences';
|
|
6
6
|
import { CONTAINER_HEIGHT, RADIAL_RADIUS, defaultRadialBarCount } from './sizes';
|
|
7
|
-
import type
|
|
7
|
+
import { amplitudeRenderState, type VariantProps } from './variant-bar';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Bars arranged around a circle, growing outward with the audio.
|
|
@@ -40,10 +40,14 @@ export function RadialVisualizer(
|
|
|
40
40
|
// many bars are on the ring.
|
|
41
41
|
const dotSize = () => (radius() * Math.PI) / count();
|
|
42
42
|
|
|
43
|
+
// The state the rendering follows: `listeningAmplitude` folds `listening`
|
|
44
|
+
// into the speaking presentation. See amplitudeRenderState in variant-bar.
|
|
45
|
+
const renderState = () => amplitudeRenderState(props.state, props.listeningAmplitude);
|
|
46
|
+
|
|
43
47
|
// Frozen (reduced motion) parks the sequence on frame 0 rather than stopping
|
|
44
48
|
// the component: the shape still reads, it just does not move.
|
|
45
|
-
const tick = useSequencer(() => (props.frozen ? Infinity : radialInterval(
|
|
46
|
-
const sequence = () => radialSequence(
|
|
49
|
+
const tick = useSequencer(() => (props.frozen ? Infinity : radialInterval(renderState())));
|
|
50
|
+
const sequence = () => radialSequence(renderState(), count());
|
|
47
51
|
|
|
48
52
|
// `thinking` parks the sequencer itself (radialInterval returns Infinity)
|
|
49
53
|
// and spins the whole ring in CSS instead, so every bar reads as lit rather
|
|
@@ -52,20 +56,21 @@ export function RadialVisualizer(
|
|
|
52
56
|
// purpose: they interleave the ring so it still looks even while rotating,
|
|
53
57
|
// not so a subset blinks).
|
|
54
58
|
const highlighted = () =>
|
|
55
|
-
|
|
59
|
+
renderState() === 'thinking'
|
|
56
60
|
? Array.from({ length: count() }, (_, i) => i)
|
|
57
61
|
: (sequence()[tick() % sequence().length] ?? []);
|
|
58
62
|
|
|
59
|
-
// Bands only mean anything while speaking
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
+
// Bands only mean anything while speaking (or listening under the
|
|
64
|
+
// `listeningAmplitude` opt-in, folded in by renderState). Everywhere else
|
|
65
|
+
// the sequence is the whole story, so a stale level never leaks into a
|
|
66
|
+
// scripted state (same guard as the other two variants, so the
|
|
67
|
+
// render-prop's `value` means one thing across every variant).
|
|
63
68
|
const levels = () =>
|
|
64
|
-
|
|
69
|
+
renderState() === 'speaking'
|
|
65
70
|
? normalizeVolumeBands(props.bands, count())
|
|
66
71
|
: new Array(count()).fill(0);
|
|
67
72
|
|
|
68
|
-
const spinning = () =>
|
|
73
|
+
const spinning = () => renderState() === 'thinking' && !props.frozen;
|
|
69
74
|
|
|
70
75
|
return (
|
|
71
76
|
<div
|
|
@@ -3,6 +3,7 @@ import { ShaderCanvas, hexToRgb, DEFAULT_SHADER_COLOR } from './shader-canvas';
|
|
|
3
3
|
import { createTween } from '../../primitives/create-tween';
|
|
4
4
|
import { waveTargets } from '../../primitives/visualizer-sequences';
|
|
5
5
|
import { CONTAINER_HEIGHT } from './sizes';
|
|
6
|
+
import { amplitudeRenderState } from './variant-bar';
|
|
6
7
|
import type { ShaderVariantProps } from './index';
|
|
7
8
|
import waveShader from './wave.glsl';
|
|
8
9
|
|
|
@@ -26,7 +27,11 @@ export default function WaveVisualizer(props: ShaderVariantProps): JSX.Element {
|
|
|
26
27
|
const frequency = createTween(0);
|
|
27
28
|
const opacity = createTween(1);
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
// The state the rendering follows: `listeningAmplitude` folds `listening`
|
|
31
|
+
// into the speaking presentation (live-volume amplitude/frequency). See
|
|
32
|
+
// amplitudeRenderState in variant-bar. `data-kai-state` keeps the real state.
|
|
33
|
+
const renderState = () => amplitudeRenderState(props.state, props.listeningAmplitude);
|
|
34
|
+
const targets = () => waveTargets(renderState());
|
|
30
35
|
|
|
31
36
|
// Reduced motion: land on the target immediately and skip every pulse.
|
|
32
37
|
const transition = () =>
|
|
@@ -61,7 +66,7 @@ export default function WaveVisualizer(props: ShaderVariantProps): JSX.Element {
|
|
|
61
66
|
// effect, one writer, ordering can no longer matter. Same effect-race
|
|
62
67
|
// class as b5795ac's shared() finding.
|
|
63
68
|
createEffect(() => {
|
|
64
|
-
if (
|
|
69
|
+
if (renderState() === 'speaking') {
|
|
65
70
|
// Live volume drives amplitude and frequency instantly while
|
|
66
71
|
// speaking, so the line never lags the audio -- and lands at the
|
|
67
72
|
// override immediately on re-entry, matching upstream's same-commit
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
// Invalid data → two-tier validation, mirroring the remote transport; see below.
|
|
6
6
|
import { createEffect, createMemo, untrack, Show, type JSX } from 'solid-js';
|
|
7
7
|
import { Dynamic } from 'solid-js/web';
|
|
8
|
-
import type { CardEnvelope } from '../primitives/card-contract';
|
|
8
|
+
import type { CardContext, CardEnvelope, CardHost } from '../primitives/card-contract';
|
|
9
9
|
import { useCardHost } from '../primitives/card-host';
|
|
10
|
+
import { emitCardEvent } from '../primitives/card-routing';
|
|
10
11
|
import { BUILTIN_CARD_COMPONENTS, mergeCardComponents, type CardComponentMap } from '../primitives/card-registry';
|
|
11
12
|
import type { JsonSchema } from '../primitives/card-validate';
|
|
12
13
|
import { cardValidationMessage, validateCardData, type CardValidationReport } from '../primitives/card-validate-cards';
|
|
@@ -63,6 +64,35 @@ export interface CardRendererProps {
|
|
|
63
64
|
* supplied through `schemas` — is never validated either way.
|
|
64
65
|
*/
|
|
65
66
|
validateCards?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The custom-element host node to emit off when no `CardProvider` is above this
|
|
69
|
+
* renderer: events leave as the bubbling, composed `kai-card` CustomEvent
|
|
70
|
+
* (`emitCardEvent`), so `listenForCardEvents(element)` — or a plain
|
|
71
|
+
* `addEventListener('kai-card', …)` on the element — receives them.
|
|
72
|
+
*
|
|
73
|
+
* This is what makes cards INSIDE `<kai-chat>`/`<kai-message>`/`<kai-thread>`
|
|
74
|
+
* interactive: those facades pass their own host element down here, and
|
|
75
|
+
* with neither this nor a `CardProvider` every emit — ready/action/submit/
|
|
76
|
+
* dismiss/reopen and the contract `error` — used to be silently discarded.
|
|
77
|
+
* An ambient `CardProvider` still wins when present.
|
|
78
|
+
*/
|
|
79
|
+
hostElement?: HTMLElement;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The effective CardHost: an ambient `CardProvider` when present, otherwise a
|
|
84
|
+
* bubbling-`kai-card` host over `hostElement`, otherwise none (a truly bare card).
|
|
85
|
+
*
|
|
86
|
+
* The fallback's `context()` mirrors the remote transport's `defaultContext()`
|
|
87
|
+
* (`remote/provider-runtime.ts`): the contract return is non-optional, but no
|
|
88
|
+
* native card reads it today — the element facades own theme/locale through
|
|
89
|
+
* `ChatConfig`, not through card context.
|
|
90
|
+
*/
|
|
91
|
+
function resolveHost(ctxHost: CardHost | undefined, hostElement: HTMLElement | undefined): CardHost | undefined {
|
|
92
|
+
if (ctxHost) return ctxHost;
|
|
93
|
+
if (!hostElement) return undefined;
|
|
94
|
+
const context = (): CardContext => ({ theme: { mode: 'light' }, locale: 'en' });
|
|
95
|
+
return { context, emit: (event) => emitCardEvent(hostElement, event) };
|
|
66
96
|
}
|
|
67
97
|
|
|
68
98
|
/**
|
|
@@ -84,7 +114,8 @@ export function hasConsumerSchema(schemas: CardSchemaMap | undefined, type: stri
|
|
|
84
114
|
}
|
|
85
115
|
|
|
86
116
|
export function CardRenderer(props: CardRendererProps): JSX.Element {
|
|
87
|
-
const
|
|
117
|
+
const ctxHost = useCardHost();
|
|
118
|
+
const host = createMemo(() => resolveHost(ctxHost, props.hostElement));
|
|
88
119
|
const map = createMemo(() => mergeCardComponents(props.types));
|
|
89
120
|
const entry = createMemo(() => map()[props.envelope.type]);
|
|
90
121
|
|
|
@@ -139,18 +170,18 @@ export function CardRenderer(props: CardRendererProps): JSX.Element {
|
|
|
139
170
|
const message = cardValidationMessage(r);
|
|
140
171
|
if (message === lastEmitted) return;
|
|
141
172
|
lastEmitted = message;
|
|
142
|
-
host?.emit({ kind: 'error', cardId: props.envelope.id, message });
|
|
173
|
+
host()?.emit({ kind: 'error', cardId: props.envelope.id, message });
|
|
143
174
|
});
|
|
144
175
|
|
|
145
176
|
return (
|
|
146
|
-
<Show when={entry()} fallback={<UnknownCard envelope={props.envelope} />}>
|
|
177
|
+
<Show when={entry()} fallback={<UnknownCard envelope={props.envelope} hostElement={props.hostElement} />}>
|
|
147
178
|
{(comp) => (
|
|
148
179
|
<Show
|
|
149
180
|
when={report()?.tier === 'hard'}
|
|
150
181
|
// SOFT and valid both take this branch: the card renders exactly as it
|
|
151
182
|
// does today. The soft failure is reported through the effect above and
|
|
152
183
|
// changes nothing on screen, which is the whole point of the tiering.
|
|
153
|
-
fallback={<Dynamic component={comp()} envelope={props.envelope} host={host} />}
|
|
184
|
+
fallback={<Dynamic component={comp()} envelope={props.envelope} host={host()} />}
|
|
154
185
|
>
|
|
155
186
|
{/* HARD: there is nothing to draw, so name the field instead. */}
|
|
156
187
|
<CardFallback type={props.envelope.type} cardId={props.envelope.id} reason={report()!.summary} />
|
|
@@ -161,10 +192,10 @@ export function CardRenderer(props: CardRendererProps): JSX.Element {
|
|
|
161
192
|
}
|
|
162
193
|
|
|
163
194
|
/** Renders the fallback and emits exactly one `error` (untracked, on first render). */
|
|
164
|
-
function UnknownCard(props: { envelope: CardEnvelope }): JSX.Element {
|
|
165
|
-
const
|
|
195
|
+
function UnknownCard(props: { envelope: CardEnvelope; hostElement?: HTMLElement }): JSX.Element {
|
|
196
|
+
const ctxHost = useCardHost();
|
|
166
197
|
untrack(() =>
|
|
167
|
-
|
|
198
|
+
resolveHost(ctxHost, props.hostElement)?.emit({
|
|
168
199
|
kind: 'error',
|
|
169
200
|
cardId: props.envelope.id,
|
|
170
201
|
message: `Unsupported card type: ${props.envelope.type}`,
|
package/src/components/card.tsx
CHANGED
|
@@ -20,6 +20,10 @@ export interface CardProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
|
20
20
|
/** Stable id for the heading (so composing cards can `aria-labelledby` it).
|
|
21
21
|
* Auto-generated when omitted. */
|
|
22
22
|
headingId?: string;
|
|
23
|
+
/** Stable id for the description (so composing cards can `aria-describedby` it
|
|
24
|
+
* — e.g. `kai-choice`'s radiogroup points at its prompt). Auto-generated when
|
|
25
|
+
* omitted, mirroring `headingId`. */
|
|
26
|
+
descriptionId?: string;
|
|
23
27
|
/** Render a dismiss (×) button that hides the card and calls `onDismiss`.
|
|
24
28
|
* Opt-in, OFF by default — the contract cards never set it, so they are
|
|
25
29
|
* unaffected. */
|
|
@@ -67,6 +71,7 @@ export function Card(props: CardProps): JSX.Element {
|
|
|
67
71
|
'errorMessage',
|
|
68
72
|
'dense',
|
|
69
73
|
'headingId',
|
|
74
|
+
'descriptionId',
|
|
70
75
|
'dismissible',
|
|
71
76
|
'onDismiss',
|
|
72
77
|
'href',
|
|
@@ -80,6 +85,7 @@ export function Card(props: CardProps): JSX.Element {
|
|
|
80
85
|
|
|
81
86
|
const autoId = createUniqueId();
|
|
82
87
|
const headingId = () => local.headingId ?? `kai-card-heading-${autoId}`;
|
|
88
|
+
const descriptionId = () => local.descriptionId ?? `kai-card-description-${autoId}`;
|
|
83
89
|
const hasError = () => local.errorMessage !== undefined && local.errorMessage !== '';
|
|
84
90
|
const hasHeader = () => Boolean(local.heading) || Boolean(local.description);
|
|
85
91
|
|
|
@@ -123,13 +129,15 @@ export function Card(props: CardProps): JSX.Element {
|
|
|
123
129
|
<Show when={local.heading}>
|
|
124
130
|
<h3
|
|
125
131
|
id={headingId()}
|
|
126
|
-
class="text-
|
|
132
|
+
class="text-title font-semibold tracking-tight text-foreground"
|
|
127
133
|
>
|
|
128
134
|
{local.heading}
|
|
129
135
|
</h3>
|
|
130
136
|
</Show>
|
|
131
137
|
<Show when={local.description}>
|
|
132
|
-
<p class="text-
|
|
138
|
+
<p id={descriptionId()} class="text-body text-muted-foreground">
|
|
139
|
+
{local.description}
|
|
140
|
+
</p>
|
|
133
141
|
</Show>
|
|
134
142
|
</div>
|
|
135
143
|
</Show>
|
|
@@ -28,7 +28,10 @@ function ChatContainerRoot(props: ChatContainerRootProps) {
|
|
|
28
28
|
<ChatContainerContext.Provider value={{ isAtBottom, scrollToBottom }}>
|
|
29
29
|
<div
|
|
30
30
|
ref={ref}
|
|
31
|
-
|
|
31
|
+
// `kai-focus-inset`: the log fills a clipping container, so the default
|
|
32
|
+
// focus outline (drawn outside the border box) was clipped away
|
|
33
|
+
// entirely — this region was tabbable with no visible indicator.
|
|
34
|
+
class={cn('flex flex-col overflow-y-auto kai-focus-inset', local.class)}
|
|
32
35
|
role="log"
|
|
33
36
|
// Keyboard users must be able to scroll the conversation even when no
|
|
34
37
|
// message contains a focusable control (WCAG 2.1.1 — axe
|
|
@@ -36,7 +36,7 @@ export function ChatScopePicker(props: ChatScopePickerProps) {
|
|
|
36
36
|
<DropdownContent class="min-w-[180px]">
|
|
37
37
|
<DropdownItem onSelect={() => local.onScopeChange(undefined)}>All Content</DropdownItem>
|
|
38
38
|
<Show when={local.availableAuthors?.length}>
|
|
39
|
-
<div class="px-2 py-1 text-
|
|
39
|
+
<div class="px-2 py-1 text-micro uppercase tracking-wider text-muted-foreground">Authors</div>
|
|
40
40
|
<For each={local.availableAuthors}>
|
|
41
41
|
{(author) => (
|
|
42
42
|
<DropdownItem onSelect={() => local.onScopeChange({ authors: [author] })}>{author}</DropdownItem>
|
|
@@ -44,7 +44,7 @@ export function ChatScopePicker(props: ChatScopePickerProps) {
|
|
|
44
44
|
</For>
|
|
45
45
|
</Show>
|
|
46
46
|
<Show when={local.availableTags?.length}>
|
|
47
|
-
<div class="px-2 py-1 text-
|
|
47
|
+
<div class="px-2 py-1 text-micro uppercase tracking-wider text-muted-foreground">Tags</div>
|
|
48
48
|
<For each={local.availableTags}>
|
|
49
49
|
{(tag) => (
|
|
50
50
|
<DropdownItem onSelect={() => local.onScopeChange({ tags: [tag] })}>{tag}</DropdownItem>
|