@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
|
@@ -36,6 +36,11 @@ interface Events {
|
|
|
36
36
|
* vote (`collect-detail`), then confirms with a thank-you — all in place. Emits
|
|
37
37
|
* `kai-feedback` (`{ value }`), `kai-feedback-detail` (`{ value, category?, comment? }`),
|
|
38
38
|
* and `kai-close`.
|
|
39
|
+
*
|
|
40
|
+
* Placement and lifecycle are the app's call: the component is designed as a
|
|
41
|
+
* THREAD-level bar (its events carry no message id), and when to show it —
|
|
42
|
+
* e.g. revealed after a settled turn, hidden again on submit — is product
|
|
43
|
+
* behavior the host decides.
|
|
39
44
|
*/
|
|
40
45
|
defineWebComponent<Props, Events>('kai-feedback-bar', {
|
|
41
46
|
barTitle: 'Was this helpful?',
|
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
[
|
|
2
2
|
"archive",
|
|
3
|
+
"arrow-down",
|
|
3
4
|
"arrow-left",
|
|
5
|
+
"arrow-right",
|
|
4
6
|
"arrow-up",
|
|
5
7
|
"audio-lines",
|
|
8
|
+
"bell",
|
|
6
9
|
"book-open",
|
|
7
10
|
"bookmark",
|
|
8
11
|
"box",
|
|
9
12
|
"briefcase",
|
|
13
|
+
"check",
|
|
10
14
|
"chevron-down",
|
|
11
15
|
"chevron-left",
|
|
16
|
+
"chevron-right",
|
|
17
|
+
"chevron-up",
|
|
12
18
|
"circle",
|
|
19
|
+
"circle-alert",
|
|
20
|
+
"circle-check",
|
|
21
|
+
"circle-x",
|
|
13
22
|
"clock",
|
|
14
23
|
"code",
|
|
15
24
|
"copy",
|
|
25
|
+
"desktop",
|
|
26
|
+
"download",
|
|
16
27
|
"ellipsis",
|
|
17
28
|
"external-link",
|
|
29
|
+
"eye",
|
|
30
|
+
"eye-off",
|
|
18
31
|
"file-text",
|
|
19
32
|
"flag",
|
|
20
33
|
"folder",
|
|
@@ -24,27 +37,43 @@
|
|
|
24
37
|
"globe",
|
|
25
38
|
"home",
|
|
26
39
|
"image",
|
|
40
|
+
"info",
|
|
41
|
+
"laptop",
|
|
42
|
+
"link",
|
|
27
43
|
"list-filter",
|
|
28
44
|
"lock",
|
|
45
|
+
"maximize-2",
|
|
29
46
|
"message-circle",
|
|
30
47
|
"message-square",
|
|
31
48
|
"mic",
|
|
49
|
+
"minimize-2",
|
|
50
|
+
"minus",
|
|
51
|
+
"mobile",
|
|
32
52
|
"monitor",
|
|
33
53
|
"moon",
|
|
34
54
|
"more-horizontal",
|
|
35
55
|
"panel-left",
|
|
56
|
+
"panel-right",
|
|
36
57
|
"paperclip",
|
|
37
58
|
"pencil",
|
|
59
|
+
"play",
|
|
38
60
|
"plus",
|
|
61
|
+
"rotate-ccw",
|
|
39
62
|
"rotate-cw",
|
|
40
63
|
"search",
|
|
41
64
|
"settings",
|
|
42
65
|
"share",
|
|
43
66
|
"sliders-horizontal",
|
|
67
|
+
"smartphone",
|
|
44
68
|
"smile",
|
|
45
69
|
"sparkles",
|
|
70
|
+
"square",
|
|
46
71
|
"square-pen",
|
|
47
72
|
"sun",
|
|
73
|
+
"tablet",
|
|
74
|
+
"trash",
|
|
75
|
+
"triangle-alert",
|
|
76
|
+
"upload",
|
|
48
77
|
"workflow",
|
|
49
78
|
"x"
|
|
50
79
|
]
|
package/src/elements/input.tsx
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { createEffect, createSignal, onCleanup, onMount, untrack } from 'solid-js';
|
|
2
2
|
import { defineWebComponent } from './define';
|
|
3
|
-
import { Input, type InputProps } from '../ui/input';
|
|
3
|
+
import { DEFAULT_FORMAT, Input, type InputProps } from '../ui/input';
|
|
4
|
+
import {
|
|
5
|
+
compileMask,
|
|
6
|
+
formatForDisplay,
|
|
7
|
+
formatRaw,
|
|
8
|
+
normalizeToRaw,
|
|
9
|
+
type CaseMode,
|
|
10
|
+
} from '../primitives/field-mask';
|
|
11
|
+
import { canonicalize, fieldSemantics, type FieldSemanticType } from '../primitives/field-semantics';
|
|
12
|
+
import type { CopyPolicy, InputMaskRejectReason } from '../primitives/input-mask';
|
|
4
13
|
|
|
5
14
|
interface Props extends Record<string, unknown> {
|
|
6
15
|
/** Native input type: `text` (default) · `email` · `url` · `search` · `tel` ·
|
|
7
16
|
* `password` · `number`. Single-line only. */
|
|
8
17
|
type?: string;
|
|
9
|
-
/** Controlled value
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
18
|
+
/** Controlled value, and always the CANONICAL one when a mask is active: digits
|
|
19
|
+
* for `tel` / `ssn` / `credit-card`, the formatted text for `custom`.
|
|
20
|
+
* Settable and reflected to the `value` attribute. `el.value = '5551234567'`
|
|
21
|
+
* drives it (no event) and is re-fitted to the mask on the way in, so the field
|
|
22
|
+
* shows `555-123-4567`. Read `el.value` for live state; the formatted text rides
|
|
23
|
+
* along on every `kai-input` / `kai-change` detail as `formattedValue`. */
|
|
12
24
|
value?: string;
|
|
13
25
|
/** Placeholder shown when empty. */
|
|
14
26
|
placeholder?: string;
|
|
@@ -34,6 +46,35 @@ interface Props extends Record<string, unknown> {
|
|
|
34
46
|
autocomplete?: string;
|
|
35
47
|
/** Virtual-keyboard hint forwarded to the inner input (e.g. `numeric`, `email`). */
|
|
36
48
|
inputmode?: string;
|
|
49
|
+
|
|
50
|
+
// --- Form-field formats (spec §7.2). Five SCALARS, which is exactly why they work as
|
|
51
|
+
// HTML attributes under the kai- contract. With `format` AND `semantic` both absent the
|
|
52
|
+
// element behaves as it always did: no mask, no extra attributes, nothing.
|
|
53
|
+
|
|
54
|
+
/** Mask pattern: `#` a digit, `@` a letter or digit, `*` an obscurable letter or
|
|
55
|
+
* digit, and every other character a positional literal (`@@@-####` → `CHG-4821`).
|
|
56
|
+
*
|
|
57
|
+
* The literal `default` is the opt-in sentinel: it resolves to the default format of
|
|
58
|
+
* `semantic` (`tel` → `###-###-####`). A bare `semantic` never starts masking on its
|
|
59
|
+
* own, so an opt-in token is what turns tier 2 on. */
|
|
60
|
+
format?: string;
|
|
61
|
+
/** Placeholder guide shown at unfilled positions, aligned position for position with
|
|
62
|
+
* `format`: `mm/dd/yyyy` against `##/##/####`. Spaces are a valid guide character, so
|
|
63
|
+
* a guide of blanks and separators is how a phone field shows its shape without
|
|
64
|
+
* showing letters. Without a guide the field shows only up to the last typed
|
|
65
|
+
* character. A guide is a visual aid, never an accessible name: keep the `hint` text
|
|
66
|
+
* as well. */
|
|
67
|
+
guide?: string;
|
|
68
|
+
/** Semantic field type: `tel` · `ssn` · `credit-card` · `custom`. On its own it sets
|
|
69
|
+
* `inputmode` / `autocomplete` / `spellcheck` / `autocorrect` / `autocapitalize` and
|
|
70
|
+
* decides the canonical value; it never starts masking by itself. */
|
|
71
|
+
semantic?: FieldSemanticType;
|
|
72
|
+
/** Case folding applied to typed and pasted text: `preserve` (default) · `upper` ·
|
|
73
|
+
* `lower`. Attribute: `case-mode`. */
|
|
74
|
+
caseMode?: CaseMode;
|
|
75
|
+
/** What a copy or cut of a masked field puts on the clipboard: `canonical` (default)
|
|
76
|
+
* · `formatted` · `obscured` · `blocked`. Attribute: `copy-policy`. */
|
|
77
|
+
copyPolicy?: CopyPolicy;
|
|
37
78
|
// NOTE: `autocapitalize` is forwarded too, but NOT as a declared prop — see the
|
|
38
79
|
// attribute read in the facade body (it is a global reflected HTMLElement IDL
|
|
39
80
|
// attribute and would break the element constructor as a component-register prop).
|
|
@@ -41,10 +82,22 @@ interface Props extends Record<string, unknown> {
|
|
|
41
82
|
|
|
42
83
|
/** Events fired by `<kai-input>`. */
|
|
43
84
|
interface Events {
|
|
44
|
-
/** The value changed per keystroke.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
85
|
+
/** The value changed per keystroke. `value` is the canonical value (what a backend
|
|
86
|
+
* wants); `formattedValue` is the text on screen. With no mask the two are equal. */
|
|
87
|
+
'kai-input': { value: string; formattedValue: string };
|
|
88
|
+
/** The value was committed (blur). Same detail shape as `kai-input`. */
|
|
89
|
+
'kai-change': { value: string; formattedValue: string };
|
|
90
|
+
/** A mask refused, or partly refused, some content. The reasons are `full` (no free
|
|
91
|
+
* position left), `wrong-class` (a letter into a digit position), `over-capacity` (a
|
|
92
|
+
* paste longer than the mask holds; what fits was kept), and `format-change-clipped`
|
|
93
|
+
* (the `format` changed under a value that no longer fits). `data` is the content
|
|
94
|
+
* that was refused.
|
|
95
|
+
*
|
|
96
|
+
* The first three are USER-INPUT errors, and are the ones worth announcing in a
|
|
97
|
+
* polite live region. `format-change-clipped` is not one: it follows the app changing
|
|
98
|
+
* its own configuration, so it reports and nothing more. None of the four touches
|
|
99
|
+
* validity, so `invalid` and `error` stay the consumer decision. */
|
|
100
|
+
'kai-input-rejected': { reason: InputMaskRejectReason; data: string };
|
|
48
101
|
}
|
|
49
102
|
|
|
50
103
|
/** Named slots whose occupancy gates an affix. An empty `<slot>` is always a
|
|
@@ -72,8 +125,52 @@ type SlotName = (typeof SLOT_NAMES)[number];
|
|
|
72
125
|
* </script>
|
|
73
126
|
* ```
|
|
74
127
|
*
|
|
75
|
-
* Methods: `focus()`, `select()`, `clear()
|
|
128
|
+
* Methods: `focus()`, `select()`, `clear()`, `getRawValue()`, `getFormattedValue()`.
|
|
129
|
+
* Restyle via `::part(field)`,
|
|
76
130
|
* `::part(input)`, `::part(label)`, `::part(hint)`.
|
|
131
|
+
*
|
|
132
|
+
* ## Masked and formatted fields
|
|
133
|
+
*
|
|
134
|
+
* `format` turns the field into a mask; `guide`, `semantic`, `case-mode` and
|
|
135
|
+
* `copy-policy` tune it. All five are scalars, so all five are plain attributes.
|
|
136
|
+
*
|
|
137
|
+
* ```html
|
|
138
|
+
* <kai-input label="Ticket" format="@@@-####" case-mode="upper"
|
|
139
|
+
* hint="Three letters, a dash, four digits."></kai-input>
|
|
140
|
+
* <kai-input label="Phone" semantic="tel" format="default"
|
|
141
|
+
* guide=" - - "></kai-input>
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* `el.value` is the CANONICAL value — digits for `tel` / `ssn` / `credit-card`, the
|
|
145
|
+
* formatted text for `custom`. The text on screen rides along as
|
|
146
|
+
* `formattedValue` on the `kai-input` / `kai-change` details. Refusals report on
|
|
147
|
+
* `kai-input-rejected` and never touch validity.
|
|
148
|
+
*
|
|
149
|
+
* TWO THINGS THIS DELIBERATELY DOES NOT DO, both recorded rather than smuggled:
|
|
150
|
+
*
|
|
151
|
+
* 1. **Not form-associated.** There is no `ElementInternals` and no
|
|
152
|
+
* `setFormValue()`, so a `<kai-input>` inside a `<form>` contributes nothing to
|
|
153
|
+
* `FormData` and takes no part in native validation, with or without a mask.
|
|
154
|
+
* That is a KNOWN GAP: form association lands later, with its own migration.
|
|
155
|
+
* Read the value off the element.
|
|
156
|
+
* 2. **No `value-type` prop.** Canonical-form-per-semantic-type is the whole
|
|
157
|
+
* contract; a per-field raw-or-formatted switch would make
|
|
158
|
+
* the same field round-trip differently depending on who set it.
|
|
159
|
+
*
|
|
160
|
+
* ### The controlled-value rule, stated
|
|
161
|
+
*
|
|
162
|
+
* A write to `el.value` after mount is re-fitted through the masker, so it lands
|
|
163
|
+
* FORMATTED on screen and canonical on the property, and fires no event. What that
|
|
164
|
+
* covers is any write that reaches this element: `el.value = x`, the `value`
|
|
165
|
+
* attribute, and a React/Vue/Svelte wrapper prop, since every wrapper drives this
|
|
166
|
+
* element by writing the property. A value present at first render is masked by the
|
|
167
|
+
* same rule, and so is a change to `format` / `guide` / `semantic` / `case-mode`
|
|
168
|
+
* AFTER mount: the canonical value is re-derived, so `el.value` never serves a
|
|
169
|
+
* reading that disagrees with the configuration in force. An over-long write is
|
|
170
|
+
* clipped to what the mask holds and says so on `kai-input-rejected`.
|
|
171
|
+
*
|
|
172
|
+
* The one thing none of that reaches is a consumer that writes the inner `<input>`
|
|
173
|
+
* inside the shadow root directly, behind both this element and its mask.
|
|
77
174
|
*/
|
|
78
175
|
defineWebComponent<Props, Events>('kai-input', {
|
|
79
176
|
type: 'text',
|
|
@@ -90,15 +187,76 @@ defineWebComponent<Props, Events>('kai-input', {
|
|
|
90
187
|
name: undefined,
|
|
91
188
|
autocomplete: undefined,
|
|
92
189
|
inputmode: undefined,
|
|
190
|
+
format: undefined,
|
|
191
|
+
guide: undefined,
|
|
192
|
+
semantic: undefined,
|
|
193
|
+
caseMode: undefined,
|
|
194
|
+
copyPolicy: undefined,
|
|
93
195
|
}, (props, ctx) => {
|
|
94
196
|
const { element, dispatch, flag, expose } = ctx;
|
|
95
197
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
198
|
+
/** Is a mask configured at all? An empty `format` means no, same as an absent one. */
|
|
199
|
+
const masked = (): boolean => {
|
|
200
|
+
const format = props.format as string | undefined;
|
|
201
|
+
return format !== undefined && format !== '';
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Resolve a seed value through the SAME pure engine the masker runs on, so the two
|
|
206
|
+
* signals below start out agreeing with what the field will actually show.
|
|
207
|
+
*
|
|
208
|
+
* WHY THE FACADE DERIVES THIS INSTEAD OF ASKING THE MASKER. A seeded value is the one
|
|
209
|
+
* case the masker cannot report: it normalizes the text at attach time WITHOUT
|
|
210
|
+
* notifying, because attaching is not an edit the consumer made. Nor can the facade
|
|
211
|
+
* provoke it afterwards -- an edit whose raw value comes out unchanged commits nothing
|
|
212
|
+
* and notifies nobody (`applyEdit` returns early on `nextRaw === raw`), which is
|
|
213
|
+
* exactly what re-writing the seed is. So without this, a
|
|
214
|
+
* `<kai-input format="@@@-####" value="chg4821">` would SHOW `CHG-4821` while
|
|
215
|
+
* `el.value` still read `chg4821`.
|
|
216
|
+
*
|
|
217
|
+
* This is a derivation, not a second policy -- `field-mask`, `field-semantics` and the
|
|
218
|
+
* `DEFAULT_FORMAT` sentinel are all read from where `ui/input.tsx` reads them, so
|
|
219
|
+
* nothing about the resolution is restated here. A bad format or an unresolvable
|
|
220
|
+
* `default` falls through unmasked exactly as it does there (the widget is the one
|
|
221
|
+
* that warns; warning twice for one misconfiguration would be noise).
|
|
222
|
+
*/
|
|
223
|
+
const throughMask = (text: string): { canonical: string; formatted: string } => {
|
|
224
|
+
const plain = { canonical: text, formatted: text };
|
|
225
|
+
if (text === '' || !masked()) return plain;
|
|
226
|
+
const semantic = (props.semantic as FieldSemanticType | undefined) ?? 'custom';
|
|
227
|
+
const format = props.format as string;
|
|
228
|
+
const resolved = format === DEFAULT_FORMAT ? fieldSemantics(semantic).defaultFormat : format;
|
|
229
|
+
if (resolved === undefined) return plain;
|
|
230
|
+
try {
|
|
231
|
+
const pattern = compileMask(resolved, props.guide as string | undefined);
|
|
232
|
+
const raw = normalizeToRaw(pattern, text, (props.caseMode as CaseMode | undefined) ?? 'preserve');
|
|
233
|
+
return {
|
|
234
|
+
canonical: canonicalize(pattern, formatRaw(pattern, raw), semantic),
|
|
235
|
+
formatted: formatForDisplay(pattern, raw),
|
|
236
|
+
};
|
|
237
|
+
} catch {
|
|
238
|
+
return plain;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// TWO signals, and the split is the whole controlled-value story.
|
|
243
|
+
//
|
|
244
|
+
// `value` is the CANONICAL value: what `el.value` reads, what reflects to the `[value]`
|
|
245
|
+
// attribute, what every event detail carries. `display` is the text the inner input
|
|
246
|
+
// shows, which under a mask is the FORMATTED text and is not the same string.
|
|
247
|
+
//
|
|
248
|
+
// Before the split there was one signal driving both, and it fought the masker: the
|
|
249
|
+
// masker writes `555-123-4567` into the input, the facade stores the canonical
|
|
250
|
+
// `5551234567`, and the controlled `value` prop then writes THAT back over the input on
|
|
251
|
+
// the next flush -- the field un-formats itself one keystroke behind the user. Feeding
|
|
252
|
+
// Input the display text means the value it writes is the text already there, which the
|
|
253
|
+
// HTML value setter treats as a no-op (caret included).
|
|
254
|
+
|
|
255
|
+
const seed = throughMask(
|
|
100
256
|
(props.value as string | undefined) ?? element.getAttribute('value') ?? '',
|
|
101
257
|
);
|
|
258
|
+
const [value, setValue] = createSignal(seed.canonical);
|
|
259
|
+
const [display, setDisplay] = createSignal(seed.formatted);
|
|
102
260
|
|
|
103
261
|
// Coerce any value coming through the `value` setter (a JS assignment, or the
|
|
104
262
|
// write-back from `attributeChangedCallback`) to a string — falling back to the
|
|
@@ -107,18 +265,115 @@ defineWebComponent<Props, Events>('kai-input', {
|
|
|
107
265
|
const coerce = (v: unknown): string =>
|
|
108
266
|
v == null ? (element.getAttribute('value') ?? '') : String(v);
|
|
109
267
|
|
|
110
|
-
// Set
|
|
111
|
-
const
|
|
268
|
+
// Set both WITHOUT firing an event (the unmasked path: canonical IS the display text).
|
|
269
|
+
const setBothQuiet = (next: string) => {
|
|
270
|
+
if (untrack(value) !== next) setValue(next);
|
|
271
|
+
if (untrack(display) !== next) setDisplay(next);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const innerInput = () => element.shadowRoot?.querySelector<HTMLInputElement>('input') ?? null;
|
|
275
|
+
|
|
276
|
+
/** Set while the facade is driving the field itself, so the masker callback it
|
|
277
|
+
* provokes updates state without firing `kai-input`. A programmatic write is not a
|
|
278
|
+
* keystroke, and the host that performed it already knows what it wrote. */
|
|
279
|
+
let programmatic = false;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* The single external-write path: `el.value = …`, the `value` attribute, and `clear()`
|
|
283
|
+
* all land here.
|
|
284
|
+
*
|
|
285
|
+
* WITH A MASK it goes THROUGH the masker rather than around it. The masker owns
|
|
286
|
+
* `input.value`, its own stored value, its undo stack and its caret; writing the input
|
|
287
|
+
* behind its back leaves it holding a stale string, and the next keystroke reconciles
|
|
288
|
+
* against that stale string rather than against what is on screen. So: put the text in
|
|
289
|
+
* the field, then fire the `input` event the masker already listens for, which is its
|
|
290
|
+
* documented reconcile path (spec §5.1) and ends in the same normalize-format-commit
|
|
291
|
+
* every edit takes. The masker calls back with the canonical value and the formatted
|
|
292
|
+
* text is then in the DOM, so both signals come from IT, not from the caller.
|
|
293
|
+
*
|
|
294
|
+
* A refusal (wrong characters, over capacity) reports on `kai-input-rejected` and leaves
|
|
295
|
+
* the field as it was, which is the same contract typing gets.
|
|
296
|
+
*/
|
|
297
|
+
const writeValue = (next: string, force = false): void => {
|
|
298
|
+
// The reflect effect below writes `[value]`, which component-register writes back
|
|
299
|
+
// through this setter. Without this guard that write-back would re-enter the masker on
|
|
300
|
+
// every value change. `force` is for the one caller that must re-run an equal value.
|
|
301
|
+
if (!force && untrack(value) === next) return;
|
|
302
|
+
|
|
303
|
+
const input = innerInput();
|
|
304
|
+
if (input === null || !masked()) {
|
|
305
|
+
setBothQuiet(next);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
programmatic = true;
|
|
310
|
+
try {
|
|
311
|
+
input.value = next;
|
|
312
|
+
input.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
|
313
|
+
} finally {
|
|
314
|
+
programmatic = false;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
112
317
|
|
|
113
318
|
// Override `value` so reads return LIVE state and host writes (`el.value = …`)
|
|
114
319
|
// drive it WITHOUT firing events — distinct from the typing path.
|
|
115
320
|
Object.defineProperty(element, 'value', {
|
|
116
321
|
get: () => value(),
|
|
117
|
-
set: (v: unknown) =>
|
|
322
|
+
set: (v: unknown) => writeValue(coerce(v)),
|
|
118
323
|
configurable: true,
|
|
119
324
|
enumerable: true,
|
|
120
325
|
});
|
|
121
326
|
|
|
327
|
+
// A CONFIGURATION CHANGE AFTER MOUNT re-derives the canonical value.
|
|
328
|
+
//
|
|
329
|
+
// The masker cannot report this one, in either of the two shapes it takes:
|
|
330
|
+
//
|
|
331
|
+
// - `format` ARRIVING on a live field attaches a fresh masker, and attaching seeds
|
|
332
|
+
// with `notify: false` on purpose. The display re-formats, `el.value` does not.
|
|
333
|
+
// - `update()` notifies only when the FORMATTED text changed, so a reconfiguration
|
|
334
|
+
// that moves the canonical value WITHOUT moving the display is silent by design:
|
|
335
|
+
// flipping `semantic` from `custom` to `tel` under `###-###-####` turns
|
|
336
|
+
// `555-123-4567` into `5551234567` on the wire and changes nothing on screen.
|
|
337
|
+
//
|
|
338
|
+
// Either way `el.value` would go on serving a stale canonical value indefinitely -- and
|
|
339
|
+
// an external write does NOT repair it, because an edit whose raw value comes out
|
|
340
|
+
// unchanged commits nothing and notifies nobody. Only a keystroke did. So the facade
|
|
341
|
+
// re-derives, from the text the masker has settled on.
|
|
342
|
+
//
|
|
343
|
+
// WHAT IT RE-FITS, and why not simply the text on screen. While a mask is on, the text
|
|
344
|
+
// on screen can carry GUIDE characters at the unfilled positions, and a guide character
|
|
345
|
+
// that happens to fit the position class would be absorbed as content on the way back
|
|
346
|
+
// in. The previous CANONICAL value has no guide in it and is the faithful record of what
|
|
347
|
+
// the user actually entered, so that is the input -- the same thing `update()` re-fits
|
|
348
|
+
// from. With no mask there is no canonical form to speak of, so the field text is it.
|
|
349
|
+
//
|
|
350
|
+
// WHY A MICROTASK. This effect is created before the JSX below, so on any flush it runs
|
|
351
|
+
// BEFORE the mask effect inside `Input`: reading or writing here would race the masker
|
|
352
|
+
// it is trying to agree with. One microtask puts the whole thing after the flush. Where
|
|
353
|
+
// the masker DID notify (a clipping format change), it has already set the right value
|
|
354
|
+
// by then and this recomputes the same answer.
|
|
355
|
+
{
|
|
356
|
+
let first = true;
|
|
357
|
+
createEffect(() => {
|
|
358
|
+
// Tracked deliberately, and these four only: the inputs `throughMask` reads.
|
|
359
|
+
void props.format;
|
|
360
|
+
void props.guide;
|
|
361
|
+
void props.semantic;
|
|
362
|
+
void props.caseMode;
|
|
363
|
+
if (first) {
|
|
364
|
+
// The seed above already did this, synchronously and with no DOM to wait for.
|
|
365
|
+
first = false;
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
queueMicrotask(() => {
|
|
369
|
+
const source = masked() ? untrack(value) : (innerInput()?.value ?? untrack(display));
|
|
370
|
+
const next = throughMask(source);
|
|
371
|
+
if (untrack(value) !== next.canonical) setValue(next.canonical);
|
|
372
|
+
if (untrack(display) !== next.formatted) setDisplay(next.formatted);
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
122
377
|
// Reflect internal value → the `[value]` host attribute (for `:host([value])`).
|
|
123
378
|
// The guard against the live attribute keeps the write-back the reflect triggers
|
|
124
379
|
// (attributeChangedCallback → setter) from looping.
|
|
@@ -163,15 +418,30 @@ defineWebComponent<Props, Events>('kai-input', {
|
|
|
163
418
|
});
|
|
164
419
|
const region = (name: SlotName) => (filled()[name] ? <slot name={name} /> : undefined);
|
|
165
420
|
|
|
166
|
-
const innerInput = () => element.shadowRoot?.querySelector<HTMLInputElement>('input') ?? null;
|
|
167
|
-
|
|
168
421
|
expose({
|
|
169
422
|
/** Focus the inner input (the host can't reach into the shadow root). */
|
|
170
423
|
focus: (options?: FocusOptions) => innerInput()?.focus(options),
|
|
171
424
|
/** Select the inner input's text. */
|
|
172
425
|
select: () => innerInput()?.select(),
|
|
173
|
-
/**
|
|
174
|
-
|
|
426
|
+
/** The canonical value: digits for `tel` / `ssn` / `credit-card`, the formatted text
|
|
427
|
+
* for `custom`, and the field text when no mask is on. Identical to reading
|
|
428
|
+
* `el.value`, under the name backends use for the submitted form of a masked
|
|
429
|
+
* field. The mask engine has a third,
|
|
430
|
+
* narrower notion of raw (the fill characters with no literals at all) and that one
|
|
431
|
+
* is internal: it is not what any backend wants and it is not exposed here. */
|
|
432
|
+
getRawValue: (): string => untrack(value),
|
|
433
|
+
/** The text on screen, literals and guide included. The counterpart to
|
|
434
|
+
* `formattedValue` on the `kai-input` / `kai-change` details, for a consumer that
|
|
435
|
+
* needs it outside an event. */
|
|
436
|
+
getFormattedValue: (): string => innerInput()?.value ?? untrack(display),
|
|
437
|
+
/** Empty the value and fire `kai-change` with `''`. On a masked field this resets the
|
|
438
|
+
* mask itself, not just the text on screen, so the next character starts over. */
|
|
439
|
+
clear: () => {
|
|
440
|
+
writeValue('', true);
|
|
441
|
+
// From the signals, not from the DOM: unmasked, the input has not been re-rendered
|
|
442
|
+
// yet at this point, so the DOM still holds the text that was just cleared.
|
|
443
|
+
dispatch('kai-change', { value: untrack(value), formattedValue: untrack(display) });
|
|
444
|
+
},
|
|
175
445
|
});
|
|
176
446
|
|
|
177
447
|
return (
|
|
@@ -179,7 +449,7 @@ defineWebComponent<Props, Events>('kai-input', {
|
|
|
179
449
|
<style>{':host{display:block}'}</style>
|
|
180
450
|
<Input
|
|
181
451
|
type={(props.type as string) ?? 'text'}
|
|
182
|
-
value={
|
|
452
|
+
value={display()}
|
|
183
453
|
placeholder={props.placeholder as string | undefined}
|
|
184
454
|
label={props.label as string | undefined}
|
|
185
455
|
hint={props.hint as string | undefined}
|
|
@@ -193,10 +463,29 @@ defineWebComponent<Props, Events>('kai-input', {
|
|
|
193
463
|
autocomplete={props.autocomplete as InputProps['autocomplete']}
|
|
194
464
|
inputmode={props.inputmode as InputProps['inputmode']}
|
|
195
465
|
autocapitalize={autocapitalize() as InputProps['autocapitalize']}
|
|
466
|
+
format={props.format as string | undefined}
|
|
467
|
+
guide={props.guide as string | undefined}
|
|
468
|
+
semantic={props.semantic as FieldSemanticType | undefined}
|
|
469
|
+
caseMode={props.caseMode as CaseMode | undefined}
|
|
470
|
+
copyPolicy={props.copyPolicy as CopyPolicy | undefined}
|
|
196
471
|
leading={region('leading')}
|
|
197
472
|
trailing={region('trailing')}
|
|
198
|
-
onValueInput={(v) => {
|
|
199
|
-
|
|
473
|
+
onValueInput={(v) => {
|
|
474
|
+
// `v` is already canonical (the widget reads it off the masker). The formatted
|
|
475
|
+
// text is whatever the masker just put in the DOM, so read it from there rather
|
|
476
|
+
// than re-deriving it -- there is only one thing that knows it.
|
|
477
|
+
setValue(v);
|
|
478
|
+
setDisplay(innerInput()?.value ?? v);
|
|
479
|
+
if (!programmatic) {
|
|
480
|
+
dispatch('kai-input', { value: v, formattedValue: untrack(display) });
|
|
481
|
+
}
|
|
482
|
+
}}
|
|
483
|
+
onValueChange={(v) => {
|
|
484
|
+
setValue(v);
|
|
485
|
+
if (!masked()) setDisplay(v);
|
|
486
|
+
dispatch('kai-change', { value: v, formattedValue: innerInput()?.value ?? v });
|
|
487
|
+
}}
|
|
488
|
+
onMaskReject={(detail) => dispatch('kai-input-rejected', detail)}
|
|
200
489
|
/>
|
|
201
490
|
</>
|
|
202
491
|
);
|
package/src/elements/menu.tsx
CHANGED
|
@@ -51,6 +51,10 @@ interface Props extends Record<string, unknown> {
|
|
|
51
51
|
* and an accessible name has to contain the visible text. Then either drop
|
|
52
52
|
* `label` or make it contain the word you slotted. */
|
|
53
53
|
label?: string;
|
|
54
|
+
/** Stretch the trigger to the full width of the menu's container (a block
|
|
55
|
+
* row), e.g. a sidebar-footer account row. Same affordance as
|
|
56
|
+
* `<kai-button full>`. Attribute: `full`. */
|
|
57
|
+
full?: boolean;
|
|
54
58
|
/** Drive/observe open state (Shoelace-style: settable + reflected to the `open`
|
|
55
59
|
* attribute, the menu still self-manages on click/keyboard). Set `el.open = true`,
|
|
56
60
|
* or `<kai-menu open>`; listen for `kai-open-change`. */
|
|
@@ -105,6 +109,7 @@ defineWebComponent<Props, Events>('kai-menu', {
|
|
|
105
109
|
triggerLabel: undefined,
|
|
106
110
|
triggerIconTrailing: undefined,
|
|
107
111
|
label: undefined,
|
|
112
|
+
full: false,
|
|
108
113
|
open: undefined,
|
|
109
114
|
defaultOpen: undefined,
|
|
110
115
|
disabled: undefined,
|
|
@@ -187,6 +192,12 @@ defineWebComponent<Props, Events>('kai-menu', {
|
|
|
187
192
|
}
|
|
188
193
|
|
|
189
194
|
return (
|
|
195
|
+
<>
|
|
196
|
+
{/* The host shrinks to the trigger by default (UA inline); `full` makes it
|
|
197
|
+
a block whose trigger button fills the width — the kai-button pattern
|
|
198
|
+
(`:host([full])`), for sidebar-footer account rows and other stretched
|
|
199
|
+
placements. */}
|
|
200
|
+
<style>{':host([full]){display:block}'}</style>
|
|
190
201
|
<Dropdown
|
|
191
202
|
defaultOpen={flag('defaultOpen')}
|
|
192
203
|
disabled={flag('disabled')}
|
|
@@ -198,6 +209,7 @@ defineWebComponent<Props, Events>('kai-menu', {
|
|
|
198
209
|
props.triggerLabel
|
|
199
210
|
? 'gap-1.5 px-2 py-1.5 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground'
|
|
200
211
|
: 'justify-center p-1.5 text-foreground hover:bg-muted',
|
|
212
|
+
flag('full') && 'w-full',
|
|
201
213
|
)}
|
|
202
214
|
// A visible `triggerLabel` IS the name (name-from-contents reaches the
|
|
203
215
|
// slotted/shadow text), so `label` must not be layered over it: aria-label
|
|
@@ -224,5 +236,6 @@ defineWebComponent<Props, Events>('kai-menu', {
|
|
|
224
236
|
{renderItems((props.items as KaiMenuItem[] | undefined) ?? [])}
|
|
225
237
|
</DropdownContent>
|
|
226
238
|
</Dropdown>
|
|
239
|
+
</>
|
|
227
240
|
);
|
|
228
241
|
});
|
package/src/elements/message.tsx
CHANGED
|
@@ -285,6 +285,8 @@ defineWebComponent<Props, Events>('kai-message', {
|
|
|
285
285
|
parts={msg().parts}
|
|
286
286
|
cardTypes={cardComponentsFromTags(props.cardTypes, (props as { theme?: string }).theme)}
|
|
287
287
|
cardSchemas={props.cardSchemas}
|
|
288
|
+
/* F-26: card parts emit off THIS element as the bubbling `kai-card` event. */
|
|
289
|
+
cardHostElement={element}
|
|
288
290
|
isUser={isUser()}
|
|
289
291
|
markdown={useMarkdown()}
|
|
290
292
|
actions={mergedActions()}
|