@kitn.ai/ui 0.27.0 → 0.29.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 +10 -2
- package/dist/{Icon-BnFKqqtY.js → Icon-DObhsRtm.js} +1 -1
- package/dist/{action-icons-CBskfBMz.js → action-icons-CcgNN2oT.js} +1 -1
- package/dist/agent-tooling/construct/public.d.ts +15 -0
- package/dist/agent-tooling/construct/schema.d.ts +111 -0
- package/dist/arrow-down-CjRU3JgV.js +1 -0
- package/dist/arrow-left-Bnpb1UEW.js +1 -0
- package/dist/{artifact-CvXEm1lS.js → artifact-Bwt7OgcR.js} +1 -1
- package/dist/{attachments-C43ZegEq.js → attachments-Qr4kg-2b.js} +1 -1
- package/dist/{audio-visualizer-B-79y1Tj.js → audio-visualizer-DToYdfSc.js} +1 -1
- package/dist/{badge-BpUbq8c0.js → badge-CdEu_jn2.js} +1 -1
- package/dist/{bell-sn17Ip9v.js → bell-DQAAOpDz.js} +1 -1
- package/dist/{button-BH6rN0U-.js → button-DkuOnGLy.js} +1 -1
- package/dist/{card-renderer-Cb1gQmth.js → card-renderer-Jx70m6_l.js} +1 -1
- package/dist/{card-routing-DifQgS7n.js → card-routing-0YidER_3.js} +1 -1
- package/dist/check-njkVdZu2.js +1 -0
- package/dist/{checkbox-Dc9Yov_B.js → checkbox-D7iRB3nL.js} +1 -1
- package/dist/{checkbox-group-B1kDLLYk.js → checkbox-group-B2_rpoPM.js} +1 -1
- package/dist/chevron-down-B72s6PXR.js +1 -0
- package/dist/chevron-right-BatuHzUm.js +1 -0
- package/dist/{choice-card-BT3c1S8g.js → choice-card-m0BYqqOK.js} +1 -1
- package/dist/circle-check-B62pODB3.js +1 -0
- package/dist/{circle-x-wobWkoSx.js → circle-x-BPG0iPst.js} +1 -1
- package/dist/circle-zx0ByzY9.js +1 -0
- package/dist/code-block-ClMLKb7C.js +1 -0
- package/dist/{collapsible-CPJbf6FM.js → collapsible-B4DlWicL.js} +1 -1
- package/dist/components/chat-thread.d.ts +89 -1
- package/dist/components/conversation-item.d.ts +16 -0
- package/dist/components/conversation-panel.d.ts +29 -0
- package/dist/components/home-panel.d.ts +34 -0
- package/dist/components/widget-tab-bar.d.ts +16 -0
- package/dist/{composer-CjngLzal.js → composer-sQ0HcvyG.js} +3 -3
- package/dist/{confirm-card-DCx_A4bU.js → confirm-card-rQWDQsnC.js} +1 -1
- package/dist/construct-cli.es.js +185 -17
- package/dist/construct.d.ts +5 -0
- package/dist/construct.js +327 -0
- package/dist/{context-BY8V-Nlp.js → context-0kg4ZX1J.js} +1 -1
- package/dist/controllable-CnGpMF6r.js +1 -0
- package/dist/conversation-item-BxwQLaFJ.js +1 -0
- package/dist/conversation-list-BCfGN1JU.js +1 -0
- package/dist/{copy-B6DO4PqB.js → copy-n9u9rqpi.js} +1 -1
- package/dist/core-C8fzo39E.js +1 -12
- package/dist/{create-tween-CnMHviKB.js → create-tween-C-q-JCM-.js} +1 -1
- package/dist/{create-tween-D1aiGZZh.js → create-tween-CRrJXxBd.js} +1 -1
- package/dist/{create-tween-BPzaefTp.js → create-tween-DZ3RRDHD.js} +1 -1
- package/dist/{create-tween-DUSQUKpr.js → create-tween-uPkArjIG.js} +1 -1
- package/dist/custom-elements.json +51 -2
- package/dist/{default-input-CucQEOqH.js → default-input-CaMrJkgH.js} +1 -1
- package/dist/define-By-uL588.js +1 -0
- package/dist/define.js +2 -2
- package/dist/define.server.js +2 -2
- package/dist/{disclosure-CbLtajUQ.js → disclosure-WUImBbDv.js} +1 -1
- package/dist/{dropdown-BwhViJFd.js → dropdown-wZVeJOMd.js} +1 -1
- package/dist/elements/agent-card.js +1 -1
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/attachments.js +1 -1
- package/dist/elements/audio-visualizer.js +1 -1
- package/dist/elements/avatar.js +1 -1
- package/dist/elements/badge.js +1 -1
- package/dist/elements/button.js +1 -1
- package/dist/elements/card.js +1 -1
- package/dist/elements/cards.js +1 -1
- package/dist/elements/chain-of-thought.js +1 -1
- package/dist/elements/chat-scope-picker.js +1 -1
- package/dist/elements/chat-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/checkbox-group.js +1 -1
- package/dist/elements/checkbox.js +1 -1
- 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.js +1 -1
- package/dist/elements/conversation-list.js +1 -1
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/dock.js +3 -3
- package/dist/elements/dropdown.js +1 -1
- package/dist/elements/editable-label.js +1 -1
- 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.js +1 -1
- package/dist/elements/pane-group.js +1 -1
- package/dist/elements/pane.js +1 -1
- package/dist/elements/popover.js +1 -1
- package/dist/elements/progress-bar.js +1 -1
- package/dist/elements/prompt-dock.js +1 -1
- package/dist/elements/prompt-input.js +1 -1
- package/dist/elements/prompt-suggestions.js +1 -1
- package/dist/elements/radio-group.js +1 -1
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/remote.js +1 -1
- package/dist/elements/resizable.js +1 -1
- package/dist/elements/response-stream.js +1 -1
- package/dist/elements/screen.js +1 -1
- package/dist/elements/scroll-area.js +1 -1
- package/dist/elements/scroll-button.js +1 -1
- package/dist/elements/search.js +1 -1
- package/dist/elements/segmented.js +1 -1
- package/dist/elements/select.js +1 -1
- package/dist/elements/separator.js +1 -1
- package/dist/elements/setting-item.js +1 -1
- package/dist/elements/settings-group.js +1 -1
- package/dist/elements/skeleton.js +1 -1
- package/dist/elements/slider.js +1 -1
- 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 +20 -4
- package/dist/{ellipsis-DFr4Vqr3.js → ellipsis-CbOpJnU3.js} +1 -1
- package/dist/{embed-5s_vU4J0.js → embed-CrfjkbUG.js} +1 -1
- package/dist/engine-javascript-C1x7zo1_.js +1 -141
- package/dist/{external-link-u9d85ORQ.js → external-link-ByXAwBBQ.js} +1 -1
- package/dist/{file-text-CX7_x42o.js → file-text-DMib2qwt.js} +1 -1
- package/dist/{file-tree-D3kBjXI5.js → file-tree-CJqM2aP7.js} +1 -1
- package/dist/{folder-V-YdIL8f.js → folder-_BAb929C.js} +1 -1
- package/dist/{form-BRNUMCN2.js → form-DSZgZQZk.js} +1 -1
- package/dist/{hover-card-DaeiYrTA.js → hover-card-BQbul9eq.js} +1 -1
- package/dist/{icon-BpixdZNq.js → icon-CdcfRhYI.js} +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2842 -2703
- package/dist/index.server.js +2820 -2681
- package/dist/{info-8mFsIjS3.js → info-DsFjGuI_.js} +1 -1
- package/dist/{input-d1Yuu-hz.js → input-DKbmkMos.js} +1 -1
- package/dist/kai.es.js +1 -1
- package/dist/{kbd-961zMPFB.js → kbd-PvdGhX4s.js} +1 -1
- package/dist/{link-preview-DIIbV2Sd.js → link-preview-DbM1866N.js} +1 -1
- package/dist/{link-DlZZBGaR.js → link-zF8PzWfF.js} +1 -1
- package/dist/{loader-YQszHFaW.js → loader-BM4CEz4G.js} +1 -1
- package/dist/{markdown-CVk1MPsj.js → markdown-LMvmAyBk.js} +7 -7
- package/dist/mcp.es.js +79 -5
- package/dist/{message-CwKVEdZg.js → message-BSsgvHvf.js} +1 -1
- package/dist/{message-DS8lzHc1.js → message-BYZECyek.js} +1 -1
- package/dist/message-circle-DruwObfX.js +1 -0
- package/dist/message-square-BG6q6mlm.js +1 -0
- package/dist/{minimize-2-UEZmP2QT.js → minimize-2-BQRoBV1V.js} +1 -1
- package/dist/{model-switcher-Kk1jEQ5t.js → model-switcher-CMpCOYcB.js} +1 -1
- package/dist/{overlay-C1od6LOz.js → overlay-Cb-MkyDa.js} +1 -1
- package/dist/{panel-right-ryET0yyn.js → panel-right-i8warFxT.js} +1 -1
- package/dist/{paperclip-BDNoZFJP.js → paperclip-ByY3UVO6.js} +1 -1
- package/dist/play-BvKKq3fX.js +1 -0
- package/dist/primitives/conversation-store.d.ts +54 -0
- package/dist/{progress-bar-BvYX0aoy.js → progress-bar-jVAHvMUf.js} +1 -1
- package/dist/{prompt-suggestion-BRFu2lcu.js → prompt-suggestion-CD-qtNgC.js} +1 -1
- package/dist/{radio-DcL23cNJ.js → radio-BsoBMhkF.js} +1 -1
- package/dist/react/index.d.ts +393 -0
- package/dist/react.js +20 -20
- package/dist/{reasoning-Cackq4Rh.js → reasoning-4kBPtlTx.js} +1 -1
- package/dist/register-impl-B1hLkrI8.js +424 -0
- package/dist/{resizable-Cp9HUYih.js → resizable-uPmY9VY-.js} +1 -1
- package/dist/{rotate-ccw-0DLRDHH5.js → rotate-ccw-B2xn93py.js} +1 -1
- package/dist/{rotate-cw-DOB9IGcU.js → rotate-cw-CMVLoCyH.js} +1 -1
- package/dist/{scroll-area-emVmWP4K.js → scroll-area-BqLUo8ZZ.js} +1 -1
- package/dist/{scroll-button-CeP_gv1x.js → scroll-button-DslXiJyL.js} +1 -1
- package/dist/{select-CWmu00tS.js → select-2cLRtPGT.js} +1 -1
- package/dist/{separator-CE6vly6z.js → separator-BWQtNJcM.js} +1 -1
- package/dist/{settings-CE-78SvZ.js → settings-BBR63jLg.js} +1 -1
- package/dist/{settings-group-ZFWNxFQR.js → settings-group-B2ciy-Iw.js} +1 -1
- package/dist/{skeleton-BebdP4mf.js → skeleton-CkHI-HgC.js} +1 -1
- package/dist/{slider-BAKRYUlz.js → slider-DDR9U-i0.js} +1 -1
- package/dist/{solid-BE5ui6sy.js → solid-BzCFdL25.js} +7720 -7058
- package/dist/{solid-DFhsce3O.js → solid-DruVOXnf.js} +5864 -5283
- package/dist/solid.d.ts +6 -2
- package/dist/solid.js +217 -210
- package/dist/solid.server.js +217 -210
- package/dist/{source-B0FlguSx.js → source-GEnFF528.js} +1 -1
- package/dist/{star-CBMZvLuN.js → star-CilHq8GP.js} +1 -1
- package/dist/store-Ciyk6eZG.js +1 -0
- package/dist/{switch-CViARZCy.js → switch-KkeQIbuH.js} +1 -1
- package/dist/{tasks-card-MjCcOhR_.js → tasks-card-BrN4bggJ.js} +1 -1
- package/dist/{text-shimmer-DKlwRF2G.js → text-shimmer-Dcj1MHuq.js} +1 -1
- package/dist/{textarea-3ay2Me2-.js → textarea-Dpvbngbg.js} +1 -1
- package/dist/theme.tokens.css +28 -0
- package/dist/{thumbs-up-DQcu2HMO.js → thumbs-up-CsT9Wzb9.js} +1 -1
- package/dist/{toast-store-C6yKOhbk.js → toast-store-tgK6MuMv.js} +1 -1
- package/dist/{tool-BCYNlfKy.js → tool-DzUjIBT8.js} +1 -1
- package/dist/{tooltip-05zI4hjs.js → tooltip-Bkkg_4t0.js} +1 -1
- package/dist/{trash-2-BR1RxGky.js → trash-2-jBKxjGGQ.js} +1 -1
- package/dist/{triangle-alert-DHohDOCy.js → triangle-alert-DlQ68ppf.js} +1 -1
- package/dist/types.d.ts +48 -3
- package/dist/ui/dock.d.ts +29 -0
- package/dist/{upload-BbGW6A_u.js → upload-TcAHXv9W.js} +1 -1
- package/dist/{url-scheme-policy-DHpoTJwB.js → url-scheme-policy-DR5DgvkM.js} +1 -1
- package/dist/{use-card-resolution-CJW4grFa.js → use-card-resolution-DaZqAdWf.js} +1 -1
- package/dist/{variant-aurora-xiMPty8f.js → variant-aurora-BhLuYxJR.js} +1 -1
- package/dist/{variant-aurora-BUOVgPOB.js → variant-aurora-CNmfHhcx.js} +2 -2
- package/dist/{variant-aurora-CUsUJvFI.js → variant-aurora-D6GsdTPA.js} +2 -2
- package/dist/{variant-aurora-CW2i4bfr.js → variant-aurora-DbW_OWL2.js} +1 -1
- package/dist/{variant-custom-D91HjAKz.js → variant-custom-BRvaNHSi.js} +1 -1
- package/dist/{variant-custom-BQtOnmeO.js → variant-custom-BvYHR62b.js} +1 -1
- package/dist/{variant-custom-CAnzzppW.js → variant-custom-DMTrEO5w.js} +2 -2
- package/dist/{variant-custom-CAm9L-E5.js → variant-custom-DV2x254s.js} +2 -2
- package/dist/{variant-wave-Ca1Ls4_y.js → variant-wave-BNMGrDfj.js} +2 -2
- package/dist/{variant-wave-uY5crU_K.js → variant-wave-BpDd8t3Z.js} +1 -1
- package/dist/{variant-wave-CxX39DKd.js → variant-wave-CyBueXj9.js} +2 -2
- package/dist/{variant-wave-DYyzIIZv.js → variant-wave-sp-qwsdI.js} +1 -1
- package/dist/x-Z5UntkIJ.js +1 -0
- package/frameworks/react/index.tsx +14 -4
- package/llms-full.txt +7 -2
- package/package.json +16 -16
- package/src/elements/element-meta.json +49 -6
- package/theme.css +28 -0
- package/bin/route.test.js +0 -58
- package/dist/arrow-down-Br0qtpsz.js +0 -1
- package/dist/arrow-left-Dj7xgE12.js +0 -1
- package/dist/check-DPeeMUYx.js +0 -1
- package/dist/chevron-down-CHSWk7ZT.js +0 -1
- package/dist/chevron-right-B7l_fMgx.js +0 -1
- package/dist/circle-Bb0yOpqM.js +0 -1
- package/dist/circle-check-BGZpCiz7.js +0 -1
- package/dist/code-block-CUQ5mtv0.js +0 -1
- package/dist/controllable-D43BKmtX.js +0 -1
- package/dist/conversation-list-D4lLU_yS.js +0 -1
- package/dist/define-CGGX-7Vg.js +0 -1
- package/dist/message-circle-Xf8Q-vZp.js +0 -1
- package/dist/message-square-Cxnwgkns.js +0 -1
- package/dist/play-OFIvYXUQ.js +0 -1
- package/dist/register-impl-C7rENvPK.js +0 -424
- package/dist/store-7eoadydQ.js +0 -1
- package/dist/x-C5m1JFgi.js +0 -1
- package/src/agent-tooling/archetypes.ts +0 -205
- package/src/agent-tooling/catalog/README.md +0 -676
- package/src/agent-tooling/catalog/catalog-types.ts +0 -231
- package/src/agent-tooling/catalog/fabrications.ts +0 -96
- package/src/agent-tooling/catalog/invariants.ts +0 -284
- package/src/agent-tooling/catalog/labs-titles.ts +0 -114
- package/src/agent-tooling/catalog/scenarios.ts +0 -87
- package/src/agent-tooling/catalog/surfaces.ts +0 -347
- package/src/agent-tooling/construct/cli-entry.ts +0 -8
- package/src/agent-tooling/construct/cli.ts +0 -131
- package/src/agent-tooling/construct/codegen.ts +0 -1353
- package/src/agent-tooling/construct/construct.v1.schema.json +0 -250
- package/src/agent-tooling/construct/dev.ts +0 -148
- package/src/agent-tooling/construct/fixtures/demo-widget.construct.json +0 -7
- package/src/agent-tooling/construct/fixtures/ops-console.construct.json +0 -44
- package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +0 -23
- package/src/agent-tooling/construct/schema.ts +0 -371
- package/src/agent-tooling/integrations/anthropic.ts +0 -442
- package/src/agent-tooling/integrations/cloudflare.ts +0 -218
- package/src/agent-tooling/integrations/langgraph.ts +0 -133
- package/src/agent-tooling/integrations/mastra.ts +0 -182
- package/src/agent-tooling/integrations/mock.ts +0 -148
- package/src/agent-tooling/integrations/ollama.ts +0 -97
- package/src/agent-tooling/integrations/openai.ts +0 -95
- package/src/agent-tooling/integrations/openrouter.ts +0 -82
- package/src/agent-tooling/integrations/pi.ts +0 -176
- package/src/agent-tooling/integrations/pydantic-ai.ts +0 -108
- package/src/agent-tooling/integrations/vercel-ai-sdk.ts +0 -398
- package/src/agent-tooling/mcp/css-raw.d.ts +0 -12
- package/src/agent-tooling/mcp/manifest.ts +0 -422
- package/src/agent-tooling/mcp/server.ts +0 -116
- package/src/agent-tooling/mcp/stdio.ts +0 -18
- package/src/agent-tooling/mcp/tools/construct.ts +0 -130
- package/src/agent-tooling/mcp/tools/debug.ts +0 -621
- package/src/agent-tooling/mcp/tools/reference.ts +0 -980
- package/src/agent-tooling/mcp/tools/scaffold.ts +0 -6708
- package/src/agent-tooling/mcp/tools/theme.ts +0 -456
- package/src/agent-tooling/mcp/tools/types.ts +0 -14
- package/src/agent-tooling/mcp/validate-args.ts +0 -141
- package/src/agent-tooling/recipes/composed-thread.ts +0 -714
- package/src/agent-tooling/recipes/index.ts +0 -22
- package/src/agent-tooling/recipes/types.ts +0 -32
- package/src/agent-tooling/registry.ts +0 -132
- package/src/agent-tooling/route-emit.ts +0 -305
- package/src/agent-tooling/types.ts +0 -390
- package/src/components/artifact-card.tsx +0 -120
- package/src/components/artifact.tsx +0 -914
- package/src/components/attachment-types.ts +0 -66
- package/src/components/attachments.tsx +0 -536
- package/src/components/audio-visualizer/audio-visualizer.voice-fixture.ts +0 -257
- package/src/components/audio-visualizer/aurora.glsl.ts +0 -330
- package/src/components/audio-visualizer/fit-scale.ts +0 -112
- package/src/components/audio-visualizer/index.tsx +0 -528
- package/src/components/audio-visualizer/labs/lab-choreography.ts +0 -187
- package/src/components/audio-visualizer/labs/lab-shaders.ts +0 -363
- package/src/components/audio-visualizer/labs/lab-visualizer.tsx +0 -102
- package/src/components/audio-visualizer/shader-canvas.tsx +0 -876
- package/src/components/audio-visualizer/sizes.ts +0 -54
- package/src/components/audio-visualizer/variant-aurora.tsx +0 -305
- package/src/components/audio-visualizer/variant-bar.tsx +0 -175
- package/src/components/audio-visualizer/variant-custom.tsx +0 -344
- package/src/components/audio-visualizer/variant-grid.tsx +0 -175
- package/src/components/audio-visualizer/variant-radial.tsx +0 -163
- package/src/components/audio-visualizer/variant-wave.tsx +0 -130
- package/src/components/audio-visualizer/wave.glsl.ts +0 -130
- package/src/components/card-fallback.tsx +0 -60
- package/src/components/card-renderer.tsx +0 -220
- package/src/components/card.tsx +0 -212
- package/src/components/chain-of-thought.tsx +0 -348
- package/src/components/chat-container.tsx +0 -89
- package/src/components/chat-scope-picker.tsx +0 -57
- package/src/components/chat-thread.tsx +0 -518
- package/src/components/checkpoint.tsx +0 -88
- package/src/components/choice-card.tsx +0 -743
- package/src/components/coachmark.tsx +0 -249
- package/src/components/code-block.tsx +0 -181
- package/src/components/composer-dom.ts +0 -159
- package/src/components/composer-highlight.ts +0 -242
- package/src/components/composer-history.ts +0 -82
- package/src/components/composer.tsx +0 -1075
- package/src/components/confirm-card.tsx +0 -402
- package/src/components/context.tsx +0 -377
- package/src/components/conversation-item.tsx +0 -218
- package/src/components/conversation-list.tsx +0 -429
- package/src/components/dismissed-stub.tsx +0 -80
- package/src/components/embed.tsx +0 -200
- package/src/components/empty.tsx +0 -177
- package/src/components/feedback-bar.tsx +0 -166
- package/src/components/file-tree.tsx +0 -530
- package/src/components/file-upload.tsx +0 -167
- package/src/components/form-widgets.tsx +0 -525
- package/src/components/form.tsx +0 -1296
- package/src/components/image.tsx +0 -65
- package/src/components/link-preview.tsx +0 -195
- package/src/components/loader.tsx +0 -367
- package/src/components/markdown.tsx +0 -162
- package/src/components/message-skills.tsx +0 -40
- package/src/components/message.tsx +0 -765
- package/src/components/model-switcher.tsx +0 -132
- package/src/components/prompt-input.tsx +0 -188
- package/src/components/prompt-suggestion.tsx +0 -150
- package/src/components/reasoning.tsx +0 -293
- package/src/components/response-compare-types.ts +0 -152
- package/src/components/response-compare.tsx +0 -455
- package/src/components/response-stream.tsx +0 -109
- package/src/components/screen.tsx +0 -181
- package/src/components/scroll-button.tsx +0 -93
- package/src/components/source.tsx +0 -192
- package/src/components/tasks-card.tsx +0 -801
- package/src/components/text-shimmer.tsx +0 -37
- package/src/components/thinking-bar.tsx +0 -50
- package/src/components/thread.tsx +0 -228
- package/src/components/toast.tsx +0 -503
- package/src/components/tool-classify.ts +0 -26
- package/src/components/tool-types.ts +0 -49
- package/src/components/tool.tsx +0 -190
- package/src/components/use-card-resolution.ts +0 -44
- package/src/components/voice-input.tsx +0 -222
- package/src/components/voice-output.tsx +0 -242
- package/src/components/workspace-shell.tsx +0 -285
- package/src/diagnostics/hook.ts +0 -352
- package/src/diagnostics/index.ts +0 -82
- package/src/diagnostics/report-request.ts +0 -296
- package/src/elements/agent-card.tsx +0 -67
- package/src/elements/artifact.tsx +0 -194
- package/src/elements/attachments.tsx +0 -140
- package/src/elements/audio-visualizer.tsx +0 -227
- package/src/elements/autoloader.ts +0 -89
- package/src/elements/avatar.tsx +0 -33
- package/src/elements/badge.tsx +0 -32
- package/src/elements/button.tsx +0 -149
- package/src/elements/card.tsx +0 -133
- package/src/elements/cards.tsx +0 -266
- package/src/elements/chain-of-thought.tsx +0 -141
- package/src/elements/chat-scope-picker.tsx +0 -65
- package/src/elements/chat-types.ts +0 -102
- package/src/elements/chat-workspace.tsx +0 -188
- package/src/elements/chat.tsx +0 -212
- package/src/elements/checkbox-group.tsx +0 -164
- package/src/elements/checkbox.tsx +0 -134
- package/src/elements/checkpoint.tsx +0 -47
- package/src/elements/choice.tsx +0 -100
- package/src/elements/coachmark.tsx +0 -90
- package/src/elements/code-block.tsx +0 -60
- package/src/elements/command.tsx +0 -197
- package/src/elements/compare.tsx +0 -111
- package/src/elements/compiled.css +0 -2
- package/src/elements/composer.tsx +0 -162
- package/src/elements/confirm-card.tsx +0 -76
- package/src/elements/context-meter.tsx +0 -107
- package/src/elements/conversation-item.tsx +0 -120
- package/src/elements/conversation-list.tsx +0 -203
- package/src/elements/css.ts +0 -5
- package/src/elements/default-input.tsx +0 -392
- package/src/elements/define-entry.ts +0 -12
- package/src/elements/define.tsx +0 -563
- package/src/elements/diagnostic-events.ts +0 -114
- package/src/elements/dialog.tsx +0 -145
- package/src/elements/disclosure.ts +0 -95
- package/src/elements/dock.tsx +0 -215
- package/src/elements/dropdown.tsx +0 -123
- package/src/elements/editable-label.tsx +0 -140
- package/src/elements/element-data-types.ts +0 -152
- package/src/elements/element-diagnostics.ts +0 -392
- package/src/elements/element-manifest.json +0 -354
- package/src/elements/element-nonscalar.json +0 -185
- package/src/elements/element-types.d.ts +0 -4337
- package/src/elements/embed.tsx +0 -35
- package/src/elements/empty.tsx +0 -29
- package/src/elements/feedback-bar.tsx +0 -66
- package/src/elements/file-tree.tsx +0 -62
- package/src/elements/file-upload.tsx +0 -44
- package/src/elements/form.tsx +0 -94
- package/src/elements/hover-card.tsx +0 -80
- package/src/elements/icon.tsx +0 -41
- package/src/elements/image.tsx +0 -32
- package/src/elements/input.tsx +0 -492
- package/src/elements/kbd.tsx +0 -45
- package/src/elements/link-preview.tsx +0 -34
- package/src/elements/loader.tsx +0 -25
- package/src/elements/markdown.tsx +0 -38
- package/src/elements/menu.tsx +0 -241
- package/src/elements/message-skills.tsx +0 -83
- package/src/elements/message.tsx +0 -361
- package/src/elements/model-switcher.tsx +0 -121
- package/src/elements/nav.tsx +0 -87
- package/src/elements/notice.tsx +0 -53
- package/src/elements/pane-grid.tsx +0 -111
- package/src/elements/pane-group.tsx +0 -119
- package/src/elements/pane.tsx +0 -129
- package/src/elements/popover.tsx +0 -81
- package/src/elements/progress-bar.tsx +0 -39
- package/src/elements/prompt-dock.tsx +0 -82
- package/src/elements/prompt-input.tsx +0 -240
- package/src/elements/prompt-suggestions.tsx +0 -113
- package/src/elements/radio-group.tsx +0 -129
- package/src/elements/reasoning.tsx +0 -71
- package/src/elements/register-impl.ts +0 -148
- package/src/elements/register.ts +0 -76
- package/src/elements/remote.tsx +0 -225
- package/src/elements/resizable.globals.d.ts +0 -36
- package/src/elements/resizable.tsx +0 -704
- package/src/elements/response-stream.tsx +0 -40
- package/src/elements/screen.tsx +0 -90
- package/src/elements/scroll-area.tsx +0 -33
- package/src/elements/scroll-button.tsx +0 -179
- package/src/elements/search.tsx +0 -185
- package/src/elements/segmented.tsx +0 -129
- package/src/elements/select.tsx +0 -165
- package/src/elements/separator.tsx +0 -36
- package/src/elements/setting-item.tsx +0 -50
- package/src/elements/settings-group.tsx +0 -37
- package/src/elements/skeleton.tsx +0 -45
- package/src/elements/slider.tsx +0 -171
- package/src/elements/slot-text.ts +0 -73
- package/src/elements/slots.ts +0 -787
- package/src/elements/source.tsx +0 -126
- package/src/elements/status.tsx +0 -42
- package/src/elements/styles.css +0 -328
- package/src/elements/switch.tsx +0 -118
- package/src/elements/tabs.tsx +0 -95
- package/src/elements/tasks.tsx +0 -103
- package/src/elements/text-shimmer.tsx +0 -28
- package/src/elements/thinking-bar.tsx +0 -43
- package/src/elements/thread.tsx +0 -139
- package/src/elements/toast.tsx +0 -106
- package/src/elements/tool.tsx +0 -78
- package/src/elements/tooltip.tsx +0 -85
- package/src/elements/validate-messages.ts +0 -76
- package/src/elements/voice-input.tsx +0 -100
- package/src/elements/voice-output.tsx +0 -82
- package/src/index.ts +0 -428
- package/src/primitives/audio-bands.ts +0 -174
- package/src/primitives/card-component-types.ts +0 -63
- package/src/primitives/card-contract.ts +0 -80
- package/src/primitives/card-data-types.ts +0 -361
- package/src/primitives/card-host.tsx +0 -37
- package/src/primitives/card-recovery.ts +0 -160
- package/src/primitives/card-registry.tsx +0 -78
- package/src/primitives/card-resolution.ts +0 -36
- package/src/primitives/card-routing.ts +0 -85
- package/src/primitives/card-schemas/artifact.schema.json +0 -92
- package/src/primitives/card-schemas/card-envelope.schema.json +0 -14
- package/src/primitives/card-schemas/card-event.schema.json +0 -12
- package/src/primitives/card-schemas/choice.schema.json +0 -75
- package/src/primitives/card-schemas/confirm.schema.json +0 -65
- package/src/primitives/card-schemas/embed.schema.json +0 -63
- package/src/primitives/card-schemas/form.result.schema.json +0 -7
- package/src/primitives/card-schemas/form.schema.json +0 -53
- package/src/primitives/card-schemas/link.schema.json +0 -54
- package/src/primitives/card-schemas/tasks.result.schema.json +0 -16
- package/src/primitives/card-schemas/tasks.schema.json +0 -83
- package/src/primitives/card-tags.ts +0 -61
- package/src/primitives/card-validate-cards.ts +0 -255
- package/src/primitives/card-validate-schemas.ts +0 -58
- package/src/primitives/card-validate.ts +0 -131
- package/src/primitives/chat-config.tsx +0 -103
- package/src/primitives/composer-model.ts +0 -49
- package/src/primitives/composer-triggers.ts +0 -35
- package/src/primitives/controllable.ts +0 -21
- package/src/primitives/create-kai-chat.ts +0 -66
- package/src/primitives/create-tween.ts +0 -266
- package/src/primitives/embed-providers.ts +0 -254
- package/src/primitives/field-mask.ts +0 -256
- package/src/primitives/field-semantics.ts +0 -115
- package/src/primitives/highlighter.ts +0 -157
- package/src/primitives/input-mask.ts +0 -853
- package/src/primitives/link-preview.ts +0 -87
- package/src/primitives/message-feedback.ts +0 -124
- package/src/primitives/pdf-preview.ts +0 -121
- package/src/primitives/toast-store.ts +0 -338
- package/src/primitives/url-scheme-policy.ts +0 -70
- package/src/primitives/use-audio-analysis.ts +0 -340
- package/src/primitives/use-auto-resize.ts +0 -31
- package/src/primitives/use-resize-observer.ts +0 -45
- package/src/primitives/use-sequencer.ts +0 -72
- package/src/primitives/use-speech-recognition.ts +0 -146
- package/src/primitives/use-stick-to-bottom.ts +0 -75
- package/src/primitives/use-text-stream.ts +0 -143
- package/src/primitives/use-voice-recorder.ts +0 -62
- package/src/primitives/visualizer-sequences.ts +0 -350
- package/src/remote/host-embed.ts +0 -345
- package/src/remote/index.ts +0 -2
- package/src/remote/origin.ts +0 -30
- package/src/remote/provider-runtime.ts +0 -262
- package/src/remote/provider.ts +0 -2
- package/src/remote/validate.ts +0 -22
- package/src/remote/version.ts +0 -12
- package/src/remote/wire.ts +0 -48
- package/src/schemas/from-tool-call.ts +0 -151
- package/src/schemas/index.ts +0 -341
- package/src/schemas/provider-subsets.ts +0 -538
- package/src/schemas/registry.ts +0 -355
- package/src/schemas/tool-defs.ts +0 -793
- package/src/solid.ts +0 -165
- package/src/state/index.ts +0 -44
- package/src/state/messages.ts +0 -53
- package/src/state/mock.ts +0 -297
- package/src/state/parts.ts +0 -295
- package/src/state/persistence.ts +0 -180
- package/src/state/stream.ts +0 -246
- package/src/state/suggestions.ts +0 -9
- package/src/state/threads.ts +0 -142
- package/src/test-utils/fake-clock.ts +0 -88
- package/src/types.ts +0 -53
- package/src/ui/action-icons.ts +0 -53
- package/src/ui/agent-card.tsx +0 -218
- package/src/ui/avatar.tsx +0 -23
- package/src/ui/badge.tsx +0 -21
- package/src/ui/button.tsx +0 -49
- package/src/ui/card.tsx +0 -245
- package/src/ui/checkbox-group.tsx +0 -153
- package/src/ui/checkbox.tsx +0 -63
- package/src/ui/collapsible.tsx +0 -163
- package/src/ui/command.tsx +0 -103
- package/src/ui/dialog.tsx +0 -223
- package/src/ui/dock.tsx +0 -584
- package/src/ui/dropdown.tsx +0 -636
- package/src/ui/editable-label.tsx +0 -112
- package/src/ui/hover-card.tsx +0 -345
- package/src/ui/icon.tsx +0 -167
- package/src/ui/input.tsx +0 -391
- package/src/ui/kbd.tsx +0 -118
- package/src/ui/nav.tsx +0 -282
- package/src/ui/notice.tsx +0 -84
- package/src/ui/overlay.tsx +0 -277
- package/src/ui/pane-grid.tsx +0 -117
- package/src/ui/pane-group.tsx +0 -291
- package/src/ui/pane.tsx +0 -193
- package/src/ui/popover.tsx +0 -106
- package/src/ui/progress-bar.tsx +0 -83
- package/src/ui/prompt-dock.tsx +0 -145
- package/src/ui/radio.tsx +0 -150
- package/src/ui/resizable.tsx +0 -693
- package/src/ui/scroll-area.tsx +0 -26
- package/src/ui/segmented.tsx +0 -109
- package/src/ui/select.tsx +0 -168
- package/src/ui/separator.tsx +0 -10
- package/src/ui/settings-group.tsx +0 -67
- package/src/ui/skeleton.tsx +0 -73
- package/src/ui/slider.tsx +0 -178
- package/src/ui/status.tsx +0 -48
- package/src/ui/switch.tsx +0 -119
- package/src/ui/tabs.tsx +0 -168
- package/src/ui/textarea.tsx +0 -21
- package/src/ui/tooltip.tsx +0 -118
- package/src/utils/cn.ts +0 -30
- package/src/wire/chunk.ts +0 -248
- package/src/wire/consume.ts +0 -599
- package/src/wire/diagnostics.ts +0 -727
- package/src/wire/encode-probe.ts +0 -214
- package/src/wire/encode.ts +0 -947
- package/src/wire/files.ts +0 -342
- package/src/wire/formats/anthropic.ts +0 -274
- package/src/wire/formats/openai.ts +0 -228
- package/src/wire/index.ts +0 -95
- package/src/wire/media-types.ts +0 -344
- package/src/wire/read.ts +0 -396
- package/src/wire/sink-helpers.ts +0 -50
- package/src/wire/sse.ts +0 -153
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as ve,s as fe,k,g as H,j as U,x as ee,o as he,c as l,E as be,S as f,i as u,F as ye,a as w,d as h,b as O,u as re,w as ke,t as m,m as E,e as xe}from"./define-CGGX-7Vg.js";import{c as _}from"./cn-DN5AWfiS.js";import{B as te}from"./button-BH6rN0U-.js";import{a as we}from"./radio-DcL23cNJ.js";import{c as Ie}from"./hover-card-DaeiYrTA.js";import{u as De,a as Ae,C as G,D as Re}from"./use-card-resolution-CJW4grFa.js";import{e as $e}from"./card-routing-DifQgS7n.js";import{c as Ce}from"./check-DPeeMUYx.js";var Ee=m("<div role=radiogroup>"),je=m('<div class="flex flex-col gap-2"><label class=sr-only></label><input type=text class="w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60">'),Se=m('<div class="flex w-full flex-wrap items-center justify-between gap-2">'),Te=m("<div>"),Le=m('<span class="inline-flex items-center rounded-full bg-[var(--color-primary)] px-1.5 py-0.5 text-micro font-medium uppercase leading-none tracking-wide text-[var(--color-primary-foreground,white)]">Recommended'),Me=m("<img>"),Ve=m('<span aria-hidden=true class="flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-muted text-sm font-medium text-muted-foreground">'),Fe=m('<img class="max-h-80 max-w-80 rounded-md object-contain">'),Oe=m('<span class="text-xs font-normal text-muted-foreground">'),_e=m('<span class="ml-auto shrink-0 text-xs font-normal text-muted-foreground">'),qe=m('<label><span class="flex min-w-0 flex-col gap-0.5"><span class="flex items-center gap-2"><span class=truncate>'),Pe=m("<span>"),ze=m('<span class="ml-auto text-xs font-normal text-muted-foreground">'),Be=m('<div class="flex items-center gap-3 rounded-lg border border-border bg-accent px-3 py-2.5 text-sm font-medium text-accent-foreground">'),He=m("<span>Other: ");const Ue="choice",I="__other__",J="Other\u2026";function Ge(r){if(!Array.isArray(r)||r.length===0)return{options:[],error:"This card couldn't be displayed."};const d=new Set,t=[];for(const i of r){if(!i||typeof i!="object")continue;const o=i;if(typeof o.id!="string"||o.id.length===0||typeof o.label!="string"||o.label.length===0)continue;if(d.has(o.id)){console.warn(`[kai-choice] duplicate option id "${o.id}" ignored`);continue}d.add(o.id);const c=o.media&&typeof o.media=="object"?{image:typeof o.media.image=="string"?o.media.image:void 0,imageAlt:typeof o.media.imageAlt=="string"?o.media.imageAlt:void 0,icon:typeof o.media.icon=="string"?o.media.icon:void 0}:void 0;t.push({id:o.id,label:o.label,description:typeof o.description=="string"?o.description:void 0,media:c,meta:typeof o.meta=="string"?o.meta:void 0,recommended:o.recommended===!0,disabled:o.disabled===!0,payload:o.payload})}return t.length===0?{options:[],error:"This card couldn't be displayed."}:{options:t}}function Je(r){return r?r===!0?{label:J,placeholder:void 0}:typeof r=="object"?{label:typeof r.label=="string"&&r.label.length>0?r.label:J,placeholder:typeof r.placeholder=="string"?r.placeholder:void 0}:null:null}function ne(r,d,t){const i=r.length;if(i===0)return d;for(let o=1;o<=i;o+=1){const c=((d+t*o)%i+i)%i;if(!r[c].disabled)return c}return d}function oe(r){return r.findIndex(d=>!d.disabled)}function Ke(r){const d=ve({cardId:"kai-choice"},r),[t]=fe(d,["data","cardId","heading","host","hostElement","class","resolution","value","defaultValue","disabled","onValueChange","controllerRef"]),i=De(),o=ke(),c=e=>{const n=t.host??i;n?n.emit(e):t.hostElement&&$e(t.hostElement,e)},T=k(()=>{var e;return Ge((e=t.data)==null?void 0:e.options)}),g=k(()=>T().error===void 0),b=k(()=>T().error??""),D=k(()=>T().options),j=k(()=>{var e;return Je((e=t.data)==null?void 0:e.allowOther)}),M=k(()=>{const e=j();return e?[...D(),{id:I,label:e.label}]:D()}),v=Ae({prop:()=>t.resolution,data:()=>t.data}),ae=k(()=>{const e=v.resolution();return e&&e.kind==="action"?e.action:void 0}),[q,A]=H(0),[ie,K]=H(r.defaultValue),L=k(()=>t.value??ie()),de=e=>{var n;L()!==e&&(K(e),(n=t.onValueChange)==null||n.call(t,e))},[P,N]=H(""),x=()=>t.disabled===!0;let V,S;const Q=k(()=>L()===I);U(ee(()=>t.data,()=>{K(t.defaultValue),N(""),A(Math.max(0,oe(M())))}));const le=k(()=>{var e;const n=v.resolution();return!n||n.kind!=="action"?void 0:n.action===I?{other:!0,text:((e=n.payload)==null?void 0:e.text)??""}:{other:!1,opt:D().find(s=>s.id===n.action),id:n.action}});U(ee(g,e=>{c(e?{kind:"ready",cardId:t.cardId}:{kind:"error",cardId:t.cardId,message:b()})})),U(()=>{const e=t.hostElement;if(!e)return;const n=ae();n!==void 0?e.setAttribute("data-kai-resolved",n):e.removeAttribute("data-kai-resolved")});const se=e=>e.id===I,z=e=>{v.isResolved()||x()||e.disabled||(de(e.id),se(e)&&queueMicrotask(()=>S?.focus()))},ce=k(()=>{if(v.isResolved()||x())return!1;const e=L();return e===void 0?!1:e===I?P().trim().length>0:!0}),ue=()=>{var e;return((e=t.data)==null?void 0:e.submitLabel)??"Submit"},B=()=>{if(v.isResolved()||x())return;const e=L();if(e===void 0)return;if(e===I){const s=P().trim();if(s.length===0)return;c({kind:"action",cardId:t.cardId,action:I,payload:{text:s}}),v.setLocal({kind:"action",action:I,payload:{text:s}});return}const n=D().find(s=>s.id===e);n&&(c({kind:"action",cardId:t.cardId,action:n.id,...n.payload!==void 0?{payload:n.payload}:{}}),v.setLocal({kind:"action",action:n.id,...n.payload!==void 0?{payload:n.payload}:{}}))},W=()=>{v.isResolved()||(c({kind:"dismiss",cardId:t.cardId}),v.setLocal({kind:"dismissed"}))},Y=()=>c({kind:"reopen",cardId:t.cardId}),F=(e,n)=>{var s;const a=V?.querySelectorAll('[role="radio"]');(s=a?.[e])==null||s.focus(n)};he(()=>{var e;(e=t.controllerRef)==null||e.call(t,{focus:n=>{Q()&&S?S.focus(n):F(q(),n)},select:n=>{const s=M(),a=s.findIndex(y=>y.id===n);a!==-1&&(A(a),z(s[a]))},send:()=>B(),dismiss:()=>W(),reopen:()=>Y()})});const ge=e=>{if(v.isResolved()||x())return;const n=M(),s=q();if(e.key==="ArrowDown"||e.key==="ArrowRight"){e.preventDefault();const a=ne(n,s,1);A(a),F(a)}else if(e.key==="ArrowUp"||e.key==="ArrowLeft"){e.preventDefault();const a=ne(n,s,-1);A(a),F(a)}else if(e.key==="Home"){e.preventDefault();const a=Math.max(0,oe(n));A(a),F(a)}else if(e.key===" "||e.key==="Enter"){e.preventDefault();const a=n[s];a&&z(a)}},pe=()=>{var e;return t.heading??((e=t.data)==null?void 0:e.prompt)??"Choose an option"},X=`kai-choice-prompt-${o}`,Z=`kai-choice-other-${o}`,me=`kai-choice-${o}`;return l(f,{get when(){return g()},get fallback(){return l(G,{get heading(){return t.heading},get errorMessage(){return b()}})},get children(){return l(be,{fallback:()=>(c({kind:"error",cardId:t.cardId,message:"The card failed to render."}),l(G,{get heading(){return t.heading},errorMessage:"The card failed to render."})),get children(){return l(f,{get when(){return!v.isDeferred()},get fallback(){return l(Re,{type:Ue,get title(){return t.heading},onReopen:Y})},get children(){return l(G,{get heading(){return t.heading},get description(){var e;return(e=t.data)==null?void 0:e.prompt},descriptionId:X,get children(){var e=Te();return u(e,l(f,{get when(){return!v.isResolved()},get fallback(){return l(Xe,{get choice(){return le()},get optimistic(){return v.isOptimistic()}})},get children(){return[(()=>{var n=Ee();n.$$keydown=ge;var s=V;return typeof s=="function"?re(s,n):V=n,u(n,l(ye,{get each(){return M()},children:(a,y)=>{const p=()=>L()===a.id,R=()=>!a.disabled&&!x()&&y()===q()&&!v.isResolved(),$=`kai-choice-desc-${o}-${a.id}`,C=()=>!!a.description;return l(Ye,{opt:a,name:me,get checked(){return p()},get tabStop(){return R()},get groupDisabled(){return x()},descId:$,get hasDesc(){return C()},onPick:()=>{A(y()),z(a)},onFocus:()=>A(y())})}})),w(a=>{var y,p=pe(),R=(y=t.data)!=null&&y.prompt?X:void 0,$=x()?"true":void 0,C=_("divide-y divide-border overflow-hidden rounded-lg border border-border",x()&&"cursor-not-allowed opacity-60");return p!==a.e&&h(n,"aria-label",a.e=p),R!==a.t&&h(n,"aria-describedby",a.t=R),$!==a.a&&h(n,"aria-disabled",a.a=$),C!==a.o&&O(n,a.o=C),a},{e:void 0,t:void 0,a:void 0,o:void 0}),n})(),l(f,{get when(){return Q()},get children(){var n=je(),s=n.firstChild,a=s.nextSibling;h(s,"for",Z),u(s,()=>{var p;return((p=j())==null?void 0:p.label)??J}),a.$$keydown=p=>{p.key==="Enter"&&(p.preventDefault(),B())},a.$$input=p=>N(p.currentTarget.value);var y=S;return typeof y=="function"?re(y,a):S=a,h(a,"id",Z),w(p=>{var R,$=x(),C=(R=j())==null?void 0:R.placeholder;return $!==p.e&&(a.disabled=p.e=$),C!==p.t&&h(a,"placeholder",p.t=C),p},{e:void 0,t:void 0}),w(()=>a.value=P()),n}}),(()=>{var n=Se();return u(n,l(f,{get when(){var s;return((s=t.data)==null?void 0:s.dismissible)===!0},get children(){return l(te,{type:"button",variant:"ghost","aria-label":"Dismiss",onClick:W,children:"Dismiss"})}}),null),u(n,l(te,{type:"button",class:"ml-auto",get disabled(){return!ce()},onClick:B,get children(){return ue()}}),null),n})()]}})),w(()=>O(e,_("flex flex-col gap-3",t.class))),e}})}})}})}})}function Ne(){return Le()}function Qe(r){return(()=>{var d=Me();return w(t=>{var i=r.media.image,o=r.media.imageAlt??"",c=_("shrink-0 rounded-md object-cover",r.class);return i!==t.e&&h(d,"src",t.e=i),o!==t.t&&h(d,"alt",t.t=o),c!==t.a&&O(d,t.a=c),t},{e:void 0,t:void 0,a:void 0}),d})()}function We(r){return(()=>{var d=Ve();return u(d,()=>r.name.slice(0,2)),d})()}function Ye(r){const d=()=>r.opt.disabled===!0||r.groupDisabled,t=()=>{d()||r.onPick()};return(()=>{var i=qe(),o=i.firstChild,c=o.firstChild,T=c.firstChild;return i.$$click=t,u(i,l(we,{role:"radio",get name(){return r.name},get value(){return r.opt.id},get checked(){return r.checked},get disabled(){return d()},get"aria-checked"(){return r.checked},get"aria-disabled"(){return r.opt.disabled?"true":void 0},get"aria-describedby"(){return E(()=>!!r.hasDesc)()?r.descId:void 0},get"data-option-id"(){return r.opt.id},get tabindex(){return E(()=>!!r.opt.disabled)()?-1:r.tabStop?0:-1},class:"focus-visible:outline-none",onChange:t,get onFocus(){return r.onFocus}}),o),u(i,l(f,{get when(){var g;return(g=r.opt.media)==null?void 0:g.image},get children(){return l(Ie,{openDelay:150,class:"p-1 w-auto",placement:"right-start",get trigger(){return l(Qe,{get media(){return r.opt.media},class:"h-9 w-9"})},get children(){var g=Fe();return w(b=>{var D=r.opt.media.image,j=r.opt.media.imageAlt??"";return D!==b.e&&h(g,"src",b.e=D),j!==b.t&&h(g,"alt",b.t=j),b},{e:void 0,t:void 0}),g}})}}),o),u(i,l(f,{get when(){var g;return E(()=>{var b;return!((b=r.opt.media)!=null&&b.image)})()&&((g=r.opt.media)==null?void 0:g.icon)},get children(){return l(We,{get name(){return r.opt.media.icon}})}}),o),u(T,()=>r.opt.label),u(c,l(f,{get when(){return r.opt.recommended},get children(){return l(Ne,{})}}),null),u(o,l(f,{get when(){return r.opt.description},get children(){var g=Oe();return u(g,()=>r.opt.description),w(()=>h(g,"id",r.descId)),g}}),null),u(i,l(f,{get when(){return r.opt.meta},get children(){var g=_e();return u(g,()=>r.opt.meta),g}}),null),w(()=>O(i,_("flex items-center gap-3 px-3 py-2.5 text-sm transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-inset has-[:focus-visible]:ring-ring",r.opt.disabled?"cursor-not-allowed opacity-60 text-foreground":"cursor-pointer hover:bg-muted/50",r.checked?"bg-accent font-medium text-accent-foreground":"text-foreground"))),i})()}function Xe(r){const d=r.choice;return(()=>{var t=Be();return u(t,l(Ce,{size:16,"aria-hidden":"true"}),null),u(t,l(f,{get when(){return!d.other},get fallback(){return(()=>{var i=He();return i.firstChild,u(i,(()=>{var o=E(()=>!!d.other);return()=>o()?d.text:""})(),null),i})()},get children(){return[(()=>{var i=Pe();return u(i,(()=>{var o=E(()=>!d.other);return()=>{var c;return o()?((c=d.opt)==null?void 0:c.label)??d.id:""}})()),i})(),l(f,{get when(){var i;return E(()=>!d.other)()&&((i=d.opt)==null?void 0:i.meta)},get children(){var i=ze();return u(i,(()=>{var o=E(()=>!d.other);return()=>{var c;return o()?(c=d.opt)==null?void 0:c.meta:""}})()),i}})]}}),null),w(()=>h(t,"role",r.optimistic?"status":void 0)),t})()}xe(["keydown","input","click"]);export{Ke as C};
|
|
1
|
+
import{q as ve,s as fe,k,g as H,j as U,x as ee,o as he,c as l,E as be,S as f,i as u,F as ye,a as w,d as h,b as O,u as re,w as ke,t as m,m as E,e as xe}from"./define-By-uL588.js";import{c as _}from"./cn-DN5AWfiS.js";import{B as te}from"./button-DkuOnGLy.js";import{a as we}from"./radio-BsoBMhkF.js";import{c as Ie}from"./hover-card-BQbul9eq.js";import{u as De,a as Ae,C as G,D as Re}from"./use-card-resolution-DaZqAdWf.js";import{e as $e}from"./card-routing-0YidER_3.js";import{c as Ce}from"./check-njkVdZu2.js";var Ee=m("<div role=radiogroup>"),je=m('<div class="flex flex-col gap-2"><label class=sr-only></label><input type=text class="w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60">'),Se=m('<div class="flex w-full flex-wrap items-center justify-between gap-2">'),Te=m("<div>"),Le=m('<span class="inline-flex items-center rounded-full bg-[var(--color-primary)] px-1.5 py-0.5 text-micro font-medium uppercase leading-none tracking-wide text-[var(--color-primary-foreground,white)]">Recommended'),Me=m("<img>"),Ve=m('<span aria-hidden=true class="flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-muted text-sm font-medium text-muted-foreground">'),Fe=m('<img class="max-h-80 max-w-80 rounded-md object-contain">'),Oe=m('<span class="text-xs font-normal text-muted-foreground">'),_e=m('<span class="ml-auto shrink-0 text-xs font-normal text-muted-foreground">'),qe=m('<label><span class="flex min-w-0 flex-col gap-0.5"><span class="flex items-center gap-2"><span class=truncate>'),Pe=m("<span>"),ze=m('<span class="ml-auto text-xs font-normal text-muted-foreground">'),Be=m('<div class="flex items-center gap-3 rounded-lg border border-border bg-accent px-3 py-2.5 text-sm font-medium text-accent-foreground">'),He=m("<span>Other: ");const Ue="choice",I="__other__",J="Other\u2026";function Ge(r){if(!Array.isArray(r)||r.length===0)return{options:[],error:"This card couldn't be displayed."};const d=new Set,t=[];for(const i of r){if(!i||typeof i!="object")continue;const o=i;if(typeof o.id!="string"||o.id.length===0||typeof o.label!="string"||o.label.length===0)continue;if(d.has(o.id)){console.warn(`[kai-choice] duplicate option id "${o.id}" ignored`);continue}d.add(o.id);const c=o.media&&typeof o.media=="object"?{image:typeof o.media.image=="string"?o.media.image:void 0,imageAlt:typeof o.media.imageAlt=="string"?o.media.imageAlt:void 0,icon:typeof o.media.icon=="string"?o.media.icon:void 0}:void 0;t.push({id:o.id,label:o.label,description:typeof o.description=="string"?o.description:void 0,media:c,meta:typeof o.meta=="string"?o.meta:void 0,recommended:o.recommended===!0,disabled:o.disabled===!0,payload:o.payload})}return t.length===0?{options:[],error:"This card couldn't be displayed."}:{options:t}}function Je(r){return r?r===!0?{label:J,placeholder:void 0}:typeof r=="object"?{label:typeof r.label=="string"&&r.label.length>0?r.label:J,placeholder:typeof r.placeholder=="string"?r.placeholder:void 0}:null:null}function ne(r,d,t){const i=r.length;if(i===0)return d;for(let o=1;o<=i;o+=1){const c=((d+t*o)%i+i)%i;if(!r[c].disabled)return c}return d}function oe(r){return r.findIndex(d=>!d.disabled)}function Ke(r){const d=ve({cardId:"kai-choice"},r),[t]=fe(d,["data","cardId","heading","host","hostElement","class","resolution","value","defaultValue","disabled","onValueChange","controllerRef"]),i=De(),o=ke(),c=e=>{const n=t.host??i;n?n.emit(e):t.hostElement&&$e(t.hostElement,e)},T=k(()=>{var e;return Ge((e=t.data)==null?void 0:e.options)}),g=k(()=>T().error===void 0),b=k(()=>T().error??""),D=k(()=>T().options),j=k(()=>{var e;return Je((e=t.data)==null?void 0:e.allowOther)}),M=k(()=>{const e=j();return e?[...D(),{id:I,label:e.label}]:D()}),v=Ae({prop:()=>t.resolution,data:()=>t.data}),ae=k(()=>{const e=v.resolution();return e&&e.kind==="action"?e.action:void 0}),[q,A]=H(0),[ie,K]=H(r.defaultValue),L=k(()=>t.value??ie()),de=e=>{var n;L()!==e&&(K(e),(n=t.onValueChange)==null||n.call(t,e))},[P,N]=H(""),x=()=>t.disabled===!0;let V,S;const Q=k(()=>L()===I);U(ee(()=>t.data,()=>{K(t.defaultValue),N(""),A(Math.max(0,oe(M())))}));const le=k(()=>{var e;const n=v.resolution();return!n||n.kind!=="action"?void 0:n.action===I?{other:!0,text:((e=n.payload)==null?void 0:e.text)??""}:{other:!1,opt:D().find(s=>s.id===n.action),id:n.action}});U(ee(g,e=>{c(e?{kind:"ready",cardId:t.cardId}:{kind:"error",cardId:t.cardId,message:b()})})),U(()=>{const e=t.hostElement;if(!e)return;const n=ae();n!==void 0?e.setAttribute("data-kai-resolved",n):e.removeAttribute("data-kai-resolved")});const se=e=>e.id===I,z=e=>{v.isResolved()||x()||e.disabled||(de(e.id),se(e)&&queueMicrotask(()=>S?.focus()))},ce=k(()=>{if(v.isResolved()||x())return!1;const e=L();return e===void 0?!1:e===I?P().trim().length>0:!0}),ue=()=>{var e;return((e=t.data)==null?void 0:e.submitLabel)??"Submit"},B=()=>{if(v.isResolved()||x())return;const e=L();if(e===void 0)return;if(e===I){const s=P().trim();if(s.length===0)return;c({kind:"action",cardId:t.cardId,action:I,payload:{text:s}}),v.setLocal({kind:"action",action:I,payload:{text:s}});return}const n=D().find(s=>s.id===e);n&&(c({kind:"action",cardId:t.cardId,action:n.id,...n.payload!==void 0?{payload:n.payload}:{}}),v.setLocal({kind:"action",action:n.id,...n.payload!==void 0?{payload:n.payload}:{}}))},W=()=>{v.isResolved()||(c({kind:"dismiss",cardId:t.cardId}),v.setLocal({kind:"dismissed"}))},Y=()=>c({kind:"reopen",cardId:t.cardId}),F=(e,n)=>{var s;const a=V?.querySelectorAll('[role="radio"]');(s=a?.[e])==null||s.focus(n)};he(()=>{var e;(e=t.controllerRef)==null||e.call(t,{focus:n=>{Q()&&S?S.focus(n):F(q(),n)},select:n=>{const s=M(),a=s.findIndex(y=>y.id===n);a!==-1&&(A(a),z(s[a]))},send:()=>B(),dismiss:()=>W(),reopen:()=>Y()})});const ge=e=>{if(v.isResolved()||x())return;const n=M(),s=q();if(e.key==="ArrowDown"||e.key==="ArrowRight"){e.preventDefault();const a=ne(n,s,1);A(a),F(a)}else if(e.key==="ArrowUp"||e.key==="ArrowLeft"){e.preventDefault();const a=ne(n,s,-1);A(a),F(a)}else if(e.key==="Home"){e.preventDefault();const a=Math.max(0,oe(n));A(a),F(a)}else if(e.key===" "||e.key==="Enter"){e.preventDefault();const a=n[s];a&&z(a)}},pe=()=>{var e;return t.heading??((e=t.data)==null?void 0:e.prompt)??"Choose an option"},X=`kai-choice-prompt-${o}`,Z=`kai-choice-other-${o}`,me=`kai-choice-${o}`;return l(f,{get when(){return g()},get fallback(){return l(G,{get heading(){return t.heading},get errorMessage(){return b()}})},get children(){return l(be,{fallback:()=>(c({kind:"error",cardId:t.cardId,message:"The card failed to render."}),l(G,{get heading(){return t.heading},errorMessage:"The card failed to render."})),get children(){return l(f,{get when(){return!v.isDeferred()},get fallback(){return l(Re,{type:Ue,get title(){return t.heading},onReopen:Y})},get children(){return l(G,{get heading(){return t.heading},get description(){var e;return(e=t.data)==null?void 0:e.prompt},descriptionId:X,get children(){var e=Te();return u(e,l(f,{get when(){return!v.isResolved()},get fallback(){return l(Xe,{get choice(){return le()},get optimistic(){return v.isOptimistic()}})},get children(){return[(()=>{var n=Ee();n.$$keydown=ge;var s=V;return typeof s=="function"?re(s,n):V=n,u(n,l(ye,{get each(){return M()},children:(a,y)=>{const p=()=>L()===a.id,R=()=>!a.disabled&&!x()&&y()===q()&&!v.isResolved(),$=`kai-choice-desc-${o}-${a.id}`,C=()=>!!a.description;return l(Ye,{opt:a,name:me,get checked(){return p()},get tabStop(){return R()},get groupDisabled(){return x()},descId:$,get hasDesc(){return C()},onPick:()=>{A(y()),z(a)},onFocus:()=>A(y())})}})),w(a=>{var y,p=pe(),R=(y=t.data)!=null&&y.prompt?X:void 0,$=x()?"true":void 0,C=_("divide-y divide-border overflow-hidden rounded-lg border border-border",x()&&"cursor-not-allowed opacity-60");return p!==a.e&&h(n,"aria-label",a.e=p),R!==a.t&&h(n,"aria-describedby",a.t=R),$!==a.a&&h(n,"aria-disabled",a.a=$),C!==a.o&&O(n,a.o=C),a},{e:void 0,t:void 0,a:void 0,o:void 0}),n})(),l(f,{get when(){return Q()},get children(){var n=je(),s=n.firstChild,a=s.nextSibling;h(s,"for",Z),u(s,()=>{var p;return((p=j())==null?void 0:p.label)??J}),a.$$keydown=p=>{p.key==="Enter"&&(p.preventDefault(),B())},a.$$input=p=>N(p.currentTarget.value);var y=S;return typeof y=="function"?re(y,a):S=a,h(a,"id",Z),w(p=>{var R,$=x(),C=(R=j())==null?void 0:R.placeholder;return $!==p.e&&(a.disabled=p.e=$),C!==p.t&&h(a,"placeholder",p.t=C),p},{e:void 0,t:void 0}),w(()=>a.value=P()),n}}),(()=>{var n=Se();return u(n,l(f,{get when(){var s;return((s=t.data)==null?void 0:s.dismissible)===!0},get children(){return l(te,{type:"button",variant:"ghost","aria-label":"Dismiss",onClick:W,children:"Dismiss"})}}),null),u(n,l(te,{type:"button",class:"ml-auto",get disabled(){return!ce()},onClick:B,get children(){return ue()}}),null),n})()]}})),w(()=>O(e,_("flex flex-col gap-3",t.class))),e}})}})}})}})}function Ne(){return Le()}function Qe(r){return(()=>{var d=Me();return w(t=>{var i=r.media.image,o=r.media.imageAlt??"",c=_("shrink-0 rounded-md object-cover",r.class);return i!==t.e&&h(d,"src",t.e=i),o!==t.t&&h(d,"alt",t.t=o),c!==t.a&&O(d,t.a=c),t},{e:void 0,t:void 0,a:void 0}),d})()}function We(r){return(()=>{var d=Ve();return u(d,()=>r.name.slice(0,2)),d})()}function Ye(r){const d=()=>r.opt.disabled===!0||r.groupDisabled,t=()=>{d()||r.onPick()};return(()=>{var i=qe(),o=i.firstChild,c=o.firstChild,T=c.firstChild;return i.$$click=t,u(i,l(we,{role:"radio",get name(){return r.name},get value(){return r.opt.id},get checked(){return r.checked},get disabled(){return d()},get"aria-checked"(){return r.checked},get"aria-disabled"(){return r.opt.disabled?"true":void 0},get"aria-describedby"(){return E(()=>!!r.hasDesc)()?r.descId:void 0},get"data-option-id"(){return r.opt.id},get tabindex(){return E(()=>!!r.opt.disabled)()?-1:r.tabStop?0:-1},class:"focus-visible:outline-none",onChange:t,get onFocus(){return r.onFocus}}),o),u(i,l(f,{get when(){var g;return(g=r.opt.media)==null?void 0:g.image},get children(){return l(Ie,{openDelay:150,class:"p-1 w-auto",placement:"right-start",get trigger(){return l(Qe,{get media(){return r.opt.media},class:"h-9 w-9"})},get children(){var g=Fe();return w(b=>{var D=r.opt.media.image,j=r.opt.media.imageAlt??"";return D!==b.e&&h(g,"src",b.e=D),j!==b.t&&h(g,"alt",b.t=j),b},{e:void 0,t:void 0}),g}})}}),o),u(i,l(f,{get when(){var g;return E(()=>{var b;return!((b=r.opt.media)!=null&&b.image)})()&&((g=r.opt.media)==null?void 0:g.icon)},get children(){return l(We,{get name(){return r.opt.media.icon}})}}),o),u(T,()=>r.opt.label),u(c,l(f,{get when(){return r.opt.recommended},get children(){return l(Ne,{})}}),null),u(o,l(f,{get when(){return r.opt.description},get children(){var g=Oe();return u(g,()=>r.opt.description),w(()=>h(g,"id",r.descId)),g}}),null),u(i,l(f,{get when(){return r.opt.meta},get children(){var g=_e();return u(g,()=>r.opt.meta),g}}),null),w(()=>O(i,_("flex items-center gap-3 px-3 py-2.5 text-sm transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-inset has-[:focus-visible]:ring-ring",r.opt.disabled?"cursor-not-allowed opacity-60 text-foreground":"cursor-pointer hover:bg-muted/50",r.checked?"bg-accent font-medium text-accent-foreground":"text-foreground"))),i})()}function Xe(r){const d=r.choice;return(()=>{var t=Be();return u(t,l(Ce,{size:16,"aria-hidden":"true"}),null),u(t,l(f,{get when(){return!d.other},get fallback(){return(()=>{var i=He();return i.firstChild,u(i,(()=>{var o=E(()=>!!d.other);return()=>o()?d.text:""})(),null),i})()},get children(){return[(()=>{var i=Pe();return u(i,(()=>{var o=E(()=>!d.other);return()=>{var c;return o()?((c=d.opt)==null?void 0:c.label)??d.id:""}})()),i})(),l(f,{get when(){var i;return E(()=>!d.other)()&&((i=d.opt)==null?void 0:i.meta)},get children(){var i=ze();return u(i,(()=>{var o=E(()=>!d.other);return()=>{var c;return o()?(c=d.opt)==null?void 0:c.meta:""}})()),i}})]}}),null),w(()=>h(t,"role",r.optimistic?"status":void 0)),t})()}xe(["keydown","input","click"]);export{Ke as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as m}from"./Icon-DObhsRtm.js";import{c as r,q as a}from"./define-By-uL588.js";var e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],o=c=>r(m,a(c,{name:"CircleCheck",iconNode:e})),i=o;export{i as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as a}from"./Icon-
|
|
1
|
+
import{I as a}from"./Icon-DObhsRtm.js";import{c,q as m}from"./define-By-uL588.js";var e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],o=r=>c(a,m(r,{name:"CircleX",iconNode:e})),i=o;export{i as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as c}from"./Icon-DObhsRtm.js";import{c as o,q as a}from"./define-By-uL588.js";var e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],m=r=>o(c,a(r,{name:"Circle",iconNode:e})),i=m;export{i as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as f,p as d,q as p,i as u,c as s,S as b,A as $,K as L,t as g,g as P,h as q,a as A,d as E,b as J,e as K}from"./define-By-uL588.js";import{c as m}from"./cn-DN5AWfiS.js";import{c as M}from"./check-njkVdZu2.js";import{c as R}from"./copy-n9u9rqpi.js";const B={bash:()=>import("./bash-InADTalH.js"),javascript:()=>import("./javascript-C25yR2R2.js"),typescript:()=>import("./typescript-RycA9KXf.js"),tsx:()=>import("./tsx-B8rCNbgL.js"),html:()=>import("./html-CPZ3oZQ7.js"),css:()=>import("./css-M7EaDHN_.js"),json:()=>import("./json-DxJze_jm.js"),vue:()=>import("./vue-BmIZj4XD.js"),svelte:()=>import("./svelte--5p79yCD.js")},D={"github-dark-dimmed":()=>import("./github-dark-dimmed-DUshB20C.js"),"github-light":()=>import("./github-light-JYsPkUQd.js")},F={js:"javascript",ts:"typescript",jsx:"tsx",sh:"bash",shell:"bash"},w="github-dark-dimmed";let G={...B},I={...D},N={...F},v=null;const y=new Set,T=new Set;function O(){return v||(v=(async()=>{const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t}]=await Promise.all([import("./core-AYMC6_lb.js"),import("./engine-javascript-vq0WuIJl.js")]);return e({themes:[],langs:[],engine:t()})})()),v}function j(e){return N[e]??e}async function Q(e,t){const n=j(t);if(y.has(n))return!0;const r=G[n];return r?(await e.loadLanguage(r()),y.add(n),!0):!1}async function k(e,t){if(T.has(t))return!0;const n=I[t];return n?(await e.loadTheme(n()),T.add(t),!0):!1}function U(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function h(e){return`<pre><code>${U(e)}</code></pre>`}async function V(e,t,n){if(!e)return h(e);try{const r=await O();if(!await Q(r,t))return h(e);const a=await k(r,n)?n:await k(r,w)?w:null;return a?r.codeToHtml(e,{lang:j(t),theme:a}):h(e)}catch{return h(e)}}var W=g("<button type=button part=copy>"),C=g("<div>"),X=g("<div tabindex=0>"),Y=g("<div tabindex=0><pre><code>");const Z=2e3;function _(e){const[t,n]=P(!1);let r;return q(()=>clearTimeout(r)),(()=>{var a=W();return a.$$click=()=>{var i;Promise.resolve((i=navigator.clipboard)==null?void 0:i.writeText(e.text)).catch(()=>{}),n(!0),clearTimeout(r),r=setTimeout(()=>n(!1),Z)},u(a,s(b,{get when(){return t()},get fallback(){return s(R,{size:14,"aria-hidden":"true"})},get children(){return s(M,{size:14,"aria-hidden":"true",class:"text-emerald-500"})}})),A(i=>{var l=t()?"Copied":"Copy code",c=m("inline-flex items-center justify-center rounded-md p-1.5","text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring");return l!==i.e&&E(a,"aria-label",i.e=l),c!==i.t&&J(a,i.t=c),i},{e:void 0,t:void 0}),a})()}function ee(e){const[t,n]=f(e,["children","class","copy","copyText"]);return(()=>{var r=C();return d(r,p({get class(){return m("not-prose flex w-full flex-col overflow-clip border","border-border bg-card text-card-foreground","rounded-[var(--kai-code-radius,0.75rem)]",t.class)}},n),!1,!0),u(r,s(b,{get when(){return t.copy},get children(){return s(re,{class:"justify-end border-b border-border px-2 py-1",get children(){return s(_,{get text(){return t.copyText??""}})}})}}),null),u(r,()=>t.children,null),r})()}function te(e){const[t,n]=f(e,["code","language","theme","class"]),r=$(),a=()=>t.language??"tsx",i=()=>t.theme??r.codeTheme(),l=()=>r.codeHighlight(),[c]=L(()=>l()?{code:t.code,lang:a(),theme:i()}:null,o=>V(o.code,o.lang,o.theme)),S=()=>{switch(r.proseSize()){case"xs":return"text-caption";case"sm":return"text-compact";case"base":return"text-sm";case"lg":return"text-base"}},x=()=>m("w-full overflow-x-auto kai-focus-inset [&>pre]:px-4 [&>pre]:py-4",S(),t.class);return s(b,{get when(){return c()},get fallback(){return(()=>{var o=Y(),H=o.firstChild,z=H.firstChild;return d(o,p({get class(){return x()}},n),!1,!0),u(z,()=>t.code),o})()},get children(){var o=X();return d(o,p({get class(){return x()},get innerHTML(){return c()}},n),!1,!1),o}})}function re(e){const[t,n]=f(e,["children","class"]);return(()=>{var r=C();return d(r,p({get class(){return m("flex items-center justify-between",t.class)}},n),!1,!0),u(r,()=>t.children),r})()}K(["click"]);export{ee as C,te as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as c,g as k,w as I,c as y,p,q as u,i as v,m as h,a as R,
|
|
1
|
+
import{s as c,g as k,w as I,c as y,p,q as u,i as v,m as h,a as R,J as q,b as E,t as g,G as H,H as J}from"./define-By-uL588.js";import{c as C}from"./cn-DN5AWfiS.js";var P=g("<div>"),A=g("<button>"),G=g("<div><div>");const w=H(),m=()=>{const o=J(w);if(!o)throw new Error("Collapsible parts must be used within <Collapsible>");return o};function N(o){var n;const[e,l]=c(o,["open","defaultOpen","onOpenChange","disabled","controllerRef","children","class"]),[r,a]=k(e.defaultOpen??!1),s=()=>e.open!==void 0,t=()=>s()?!!e.open:r(),i=()=>!!e.disabled,f=d=>{var b;t()!==d&&(s()||a(d),(b=e.onOpenChange)==null||b.call(e,d))},x=()=>{i()||f(!t())};(n=e.controllerRef)==null||n.call(e,{open:t,setOpen:f});const O=I();return y(w.Provider,{value:{open:t,toggle:x,contentId:O,disabled:i},get children(){var d=P();return p(d,u({get class(){return e.class}},l,{get"data-expanded"(){return t()?"":void 0},get"data-closed"(){return t()?void 0:""},get"data-state"(){return t()?"open":"closed"}}),!1,!0),v(d,()=>e.children),d}})}function U(o){const n=m(),[e,l]=c(o,["children","class","as","onClick"]),r=()=>({type:"button","aria-expanded":n.open(),"aria-controls":n.contentId,disabled:n.disabled()||void 0,"data-expanded":n.open()?"":void 0,"data-closed":n.open()?void 0:"","data-state":n.open()?"open":"closed",onClick:a=>{n.disabled()||(typeof e.onClick=="function"&&e.onClick(a),n.toggle())},class:e.class,...l});return h(()=>h(()=>!!e.as)()?e.as(r()):(()=>{var a=A();return p(a,u(r),!1,!0),v(a,()=>e.children),a})())}function _(o){const n=m(),[e,l]=c(o,["children","class"]);return(()=>{var r=G(),a=r.firstChild;return p(r,u(l,{get id(){return n.contentId},get"data-expanded"(){return n.open()?"":void 0},get"data-closed"(){return n.open()?void 0:""},get class(){return C("grid transition-[grid-template-rows] duration-200 ease-out",n.open()?"grid-rows-[1fr]":"grid-rows-[0fr]")}}),!1,!0),v(a,()=>e.children),R(s=>{var t=!n.open(),i=C("overflow-hidden",e.class);return t!==s.e&&q(r,"inert",s.e=t),i!==s.t&&E(a,s.t=i),s},{e:void 0,t:void 0}),r})()}export{N as C,U as a,_ as b};
|
|
@@ -6,10 +6,11 @@ import { MediaTypeFilter } from '../wire/media-types.js';
|
|
|
6
6
|
import { TriggerDef } from './composer.js';
|
|
7
7
|
import { ChatMessage } from '../elements/chat-types.js';
|
|
8
8
|
import { ProseSize } from '../primitives/chat-config.js';
|
|
9
|
-
import { ModelOption } from '../types.js';
|
|
9
|
+
import { ModelOption, HomeConfig, HomeLinkEntry } from '../types.js';
|
|
10
10
|
import { CardComponentMap } from '../primitives/card-registry.js';
|
|
11
11
|
import { CardSchemaMap } from './card-renderer.js';
|
|
12
12
|
import { JSX } from 'solid-js';
|
|
13
|
+
import { ConversationStore } from '../primitives/conversation-store.js';
|
|
13
14
|
export interface ChatThreadContextUsage {
|
|
14
15
|
usedTokens: number;
|
|
15
16
|
maxTokens: number;
|
|
@@ -108,6 +109,79 @@ export interface ChatThreadProps {
|
|
|
108
109
|
* toward `showHeader()` the same as `headerEnd`, so a construct with no title
|
|
109
110
|
* and only this content still gets a header row to sit in. */
|
|
110
111
|
headerEndContent?: JSX.Element;
|
|
112
|
+
/** Turns on the prior-conversations list: a list-toggle button appears in
|
|
113
|
+
* the header row and the panel gains a second, list, view (C-1 — one
|
|
114
|
+
* panel, two states, never a persistent sidebar). Off by default, same
|
|
115
|
+
* convention as every other capability in this file. Requires BOTH
|
|
116
|
+
* `store` AND `onConversationLoad` — the second is the only path a caller
|
|
117
|
+
* has to actually receive a loaded conversation's messages back (this
|
|
118
|
+
* component never mutates `props.messages` itself). Set with either
|
|
119
|
+
* missing, the feature decides loudly (one `console.error` on mount) and
|
|
120
|
+
* stays visually off rather than throwing or silently going inert: a
|
|
121
|
+
* `store` with no `onConversationLoad` would otherwise make row-select/
|
|
122
|
+
* new/restore fire and do nothing visible, and mount's own auto-restore
|
|
123
|
+
* would still stamp an active conversation id that the save effect could
|
|
124
|
+
* then clobber with whatever `props.messages` the caller drives in next. */
|
|
125
|
+
conversations?: boolean;
|
|
126
|
+
/** The adapter this thread persists through when `conversations` is on:
|
|
127
|
+
* `list()` on mount and on every list-view open, `load(id)` on row select,
|
|
128
|
+
* `save(id, messages)` on every message-array change for the active
|
|
129
|
+
* conversation. A kit-owned INTERFACE (C-3) — the dev owns invocation,
|
|
130
|
+
* transport, auth and retention entirely; `localStorageStore`/`fetchStore`
|
|
131
|
+
* (`@kitn.ai/ui`'s `primitives/conversation-store`) are the shipped
|
|
132
|
+
* built-ins. Set as a JS property; never expressible as an attribute (an
|
|
133
|
+
* adapter is a live object of functions, not scalar data). */
|
|
134
|
+
store?: ConversationStore;
|
|
135
|
+
/** Fires whenever `load(id)` resolves and this thread's `messages` are
|
|
136
|
+
* about to be replaced with that conversation's history — the hook a
|
|
137
|
+
* caller uses to actually own and re-render `messages` (this component
|
|
138
|
+
* does not mutate `props.messages` itself; C-8 keeps the state machine
|
|
139
|
+
* here but the message ARRAY stays the caller's own state, matching every
|
|
140
|
+
* other prop in this file). The second argument is the conversation's id
|
|
141
|
+
* — `undefined` for the "new conversation" case (C-6: no id exists until
|
|
142
|
+
* the first message mints one). Required whenever `conversations` is on;
|
|
143
|
+
* see that prop's own doc for the guard this component runs without it. */
|
|
144
|
+
onConversationLoad?: (messages: ChatMessage[], id?: string) => void;
|
|
145
|
+
/** Whether the surrounding chrome that HOSTS this thread is currently
|
|
146
|
+
* VISIBLE to the visitor — e.g. a docked widget's open/closed state.
|
|
147
|
+
* `ChatThread` has no knowledge of whatever hosts it (a `Dock`, a plain
|
|
148
|
+
* page, anything — same boundary `closeConversationsList` documents), so
|
|
149
|
+
* this is the seam: a host that can hide itself sets it, everyone else
|
|
150
|
+
* leaves it unset.
|
|
151
|
+
*
|
|
152
|
+
* Meaningful only when `conversations` is on, where it's the third leg of
|
|
153
|
+
* "seen" (owner round, 2026-08-26 — unread indicators): the active
|
|
154
|
+
* conversation counts as seen, and gets `store.markRead` called for it,
|
|
155
|
+
* only while it's ALSO the active conversation AND the chat view (not the
|
|
156
|
+
* list) is showing AND this is true. Undeclared/`true` (the default) means
|
|
157
|
+
* "always visible" — correct for every layout with no show/hide concept at
|
|
158
|
+
* all (fullscreen/aside/split/custom) and for any widget consumer that
|
|
159
|
+
* doesn't wire it, which just means unread never distinguishes "closed"
|
|
160
|
+
* from "open" for them (a smaller inaccuracy than the alternative: without
|
|
161
|
+
* this leg, a message arriving to the active conversation while the
|
|
162
|
+
* widget is actually closed would get silently marked read behind the
|
|
163
|
+
* visitor's back, purely because it happened to be the active id). */
|
|
164
|
+
hostOpen?: boolean;
|
|
165
|
+
/** Fires whenever "is any OTHER conversation (not the active one) unread"
|
|
166
|
+
* changes — the value this thread already renders as a dot on its own
|
|
167
|
+
* header toggle, reported outward so a sibling control with no view into
|
|
168
|
+
* `ChatThread`'s internal conversation-summary state (a `Dock`'s own
|
|
169
|
+
* `unread` prop, say) can mirror it. Only meaningful with `conversations`
|
|
170
|
+
* on; never fires otherwise. */
|
|
171
|
+
onUnreadChange?: (unread: boolean) => void;
|
|
172
|
+
/** Turns on the widget home screen (Intercom-pattern, H-1/H-2): the panel
|
|
173
|
+
* boots into a `home` view — greeting, most-recent-conversation card, a
|
|
174
|
+
* "new conversation" CTA, and host-defined links — with a Home/Messages
|
|
175
|
+
* tab bar beneath the content area. The prior-conversations list moves
|
|
176
|
+
* from the header toggle onto the Messages tab (H-2); a drilled-into chat
|
|
177
|
+
* (from a list row, the recent card, or "new conversation") hides the tab
|
|
178
|
+
* bar and shows a back arrow in the header instead. Off by default: unset,
|
|
179
|
+
* the widget renders byte-for-byte as it does today. */
|
|
180
|
+
home?: HomeConfig;
|
|
181
|
+
/** Fires when a `home.links` entry with no `href` is activated (an
|
|
182
|
+
* `href`-bearing entry navigates as a real anchor instead — see
|
|
183
|
+
* `HomePanelProps.onLink`). Meaningful only when `home` is set. */
|
|
184
|
+
onHomeLink?: (entry: HomeLinkEntry) => void;
|
|
111
185
|
/** REPLACE: full custom header in place of the built-in title/model/context bar. */
|
|
112
186
|
headerFull?: boolean;
|
|
113
187
|
/** INJECT: left sidebar column (e.g. a conversation list / your own nav). */
|
|
@@ -178,5 +252,19 @@ export interface ChatThreadController {
|
|
|
178
252
|
clear(): void;
|
|
179
253
|
send(): void;
|
|
180
254
|
scrollToBottom(behavior?: ScrollBehavior): void;
|
|
255
|
+
/** Force the widget back to its default landing view — `'home'` when the
|
|
256
|
+
* `home` prop is set (H-5), `'chat'` otherwise (a no-op if already there,
|
|
257
|
+
* or if neither `home` nor `conversations` is on). ChatThread has no knowledge of
|
|
258
|
+
* whatever chrome hosts it — a `Dock`, a plain page, anything — so it
|
|
259
|
+
* cannot know when that host closes. The seam is this one imperative
|
|
260
|
+
* call: a host that can go from visible to hidden and back (the `kai-dock`
|
|
261
|
+
* widget being the motivating case) calls it on every hide, so the NEXT
|
|
262
|
+
* open always lands on the chat view rather than wherever the list was
|
|
263
|
+
* left (owner: reopening the widget should show the default screen, not
|
|
264
|
+
* a stale list view). `Dock`'s own `onOpenChange` already fires on every
|
|
265
|
+
* close path — header X, the launcher toggle, and Escape — so a single
|
|
266
|
+
* `onOpenChange={(open) => !open && controller.closeConversationsList()}`
|
|
267
|
+
* at the call site covers all three with no per-path wiring. */
|
|
268
|
+
closeConversationsList(): void;
|
|
181
269
|
}
|
|
182
270
|
export declare function ChatThread(props: ChatThreadProps): JSX.Element;
|
|
@@ -15,6 +15,22 @@ export interface ConversationItemProps {
|
|
|
15
15
|
* ticking clock. Returns '' for a missing or unparseable date.
|
|
16
16
|
*/
|
|
17
17
|
export declare function relativeTimeShort(iso?: string, now?: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether a conversation should show an unread indicator (owner round,
|
|
20
|
+
* 2026-08-26). `lastReadAt`'s own doc (`types.ts`) has the full contract;
|
|
21
|
+
* this is the one place that reads it, so both list surfaces (this file's
|
|
22
|
+
* `ConversationItem` and the widget-box `ConversationPanel`) derive it
|
|
23
|
+
* identically rather than each restating the comparison.
|
|
24
|
+
*
|
|
25
|
+
* Absent `lastReadAt` reads as NOT unread — the decide-loudly default for a
|
|
26
|
+
* store that never implements `ConversationStore.markRead` at all (every
|
|
27
|
+
* summary it returns leaves the field undefined forever, so this always
|
|
28
|
+
* returns `false` for it) rather than guessing "probably unread" from a
|
|
29
|
+
* signal the store never actually provided. Defensive `Date.parse`, same
|
|
30
|
+
* pattern as `relativeTimeShort` above: an unparsable date reads as not
|
|
31
|
+
* unread rather than throwing.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isConversationUnread(conv: Pick<ConversationSummary, 'updatedAt' | 'lastReadAt'>): boolean;
|
|
18
34
|
/**
|
|
19
35
|
* The slotted-item shape rendered by `<kai-conversation-item>` — the composed
|
|
20
36
|
* row of the consumer-owned loop. Distinct from the
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ConversationSummary } from '../types.js';
|
|
2
|
+
export interface ConversationPanelProps {
|
|
3
|
+
conversations: ConversationSummary[];
|
|
4
|
+
activeId?: string;
|
|
5
|
+
onSelect: (id: string) => void;
|
|
6
|
+
onNewChat: () => void;
|
|
7
|
+
/** Wording for the floating new-conversation pill. Defaults to "New conversation". */
|
|
8
|
+
newChatLabel?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The widget-box list view (owner rework, 2026-08-26 — the earlier retrofit
|
|
13
|
+
* of the desktop `ConversationList` into this box was rejected at the live
|
|
14
|
+
* demo). NOT `ConversationList`, which stays the desktop-sidebar surface
|
|
15
|
+
* unchanged: no search box, no group headers, no per-row menu, no full-width
|
|
16
|
+
* footer bar, no second "+" beside the header toggle. A row is a
|
|
17
|
+
* conversation, full stop — bold title, right-aligned relative time, one
|
|
18
|
+
* truncated line of the last message. The ONE way to start a new
|
|
19
|
+
* conversation is the floating pill near the bottom.
|
|
20
|
+
*
|
|
21
|
+
* Modeled directly on Intercom's Messenger "Messages" tab (first-hand
|
|
22
|
+
* research: `.superpowers/sdd/2026-08-26-conversations/
|
|
23
|
+
* research-intercom-messages-view.md`) — a box this size gets one job at a
|
|
24
|
+
* time: browsing conversations OR having one, never both, and the list
|
|
25
|
+
* replaces the ENTIRE content area (`ChatThread` hides the thread,
|
|
26
|
+
* suggestions and composer while this renders — see its `view() === 'list'`
|
|
27
|
+
* branch).
|
|
28
|
+
*/
|
|
29
|
+
export declare function ConversationPanel(props: ConversationPanelProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ConversationSummary, HomeLinkEntry } from '../types.js';
|
|
2
|
+
export interface HomePanelProps {
|
|
3
|
+
greeting?: {
|
|
4
|
+
title?: string;
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
};
|
|
7
|
+
/** The most-recent conversation, host-derived. `undefined` hides the card
|
|
8
|
+
* entirely — this component never fetches or picks one itself. */
|
|
9
|
+
recent?: ConversationSummary;
|
|
10
|
+
/** Defaults to `true`. */
|
|
11
|
+
showNewConversation?: boolean;
|
|
12
|
+
/** Defaults to `'Send us a message'`. */
|
|
13
|
+
newChatLabel?: string;
|
|
14
|
+
links?: HomeLinkEntry[];
|
|
15
|
+
onSelectRecent?: (id: string) => void;
|
|
16
|
+
onNewChat: () => void;
|
|
17
|
+
/** Fired only for href-less link entries — an entry with a safe `href`
|
|
18
|
+
* navigates as a real anchor instead. */
|
|
19
|
+
onLink?: (entry: HomeLinkEntry) => void;
|
|
20
|
+
class?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The widget home screen (Intercom-pattern, H-1): greeting, the most-recent
|
|
24
|
+
* conversation, a "start a new conversation" CTA, and a list of host-defined
|
|
25
|
+
* links. Pure props in, events out — no fetching, no routing; a later task
|
|
26
|
+
* wires this behind `ChatThread`'s Home/Messages tab bar.
|
|
27
|
+
*
|
|
28
|
+
* Unsafe-href rule: a `links` entry with an `href` that fails `isSafeUrl`
|
|
29
|
+
* (e.g. `javascript:`) is NOT silently promoted into a button/event-emitter —
|
|
30
|
+
* that would let a host-authored-but-attacker-influenced config still fire a
|
|
31
|
+
* handler off a scheme SAFE_SCHEMES rejects. It renders as a plain,
|
|
32
|
+
* non-interactive row: label visible, no anchor, no button, no click handler.
|
|
33
|
+
*/
|
|
34
|
+
export declare function HomePanel(props: HomePanelProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WidgetTabBarProps {
|
|
2
|
+
active: 'home' | 'messages';
|
|
3
|
+
onChange: (tab: 'home' | 'messages') => void;
|
|
4
|
+
/** Whether the Messages tab has unread activity. Reaches BOTH the visible
|
|
5
|
+
* dot and the tab's accessible name (`aria-label`) — a dot alone is
|
|
6
|
+
* invisible to assistive tech, the #336 lesson this test pins. */
|
|
7
|
+
unread?: boolean;
|
|
8
|
+
homeLabel?: string;
|
|
9
|
+
messagesLabel?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The widget's Home/Messages tab bar (Intercom-pattern chrome, H-2/H-6). Real
|
|
13
|
+
* `tablist`/`tab` semantics — this is a persistent view switch within the
|
|
14
|
+
* widget, not page navigation, so it is not `<Nav>`'s `role="page"` dialect.
|
|
15
|
+
*/
|
|
16
|
+
export declare function WidgetTabBar(props: WidgetTabBarProps): import("solid-js").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as Ye,g as z,w as Je,k as
|
|
1
|
+
import{A as Ye,g as z,w as Je,k as Q,j as de,o as ue,x as De,h as Qe,i as N,u as Ne,a as H,d as O,b as Z,l as ee,c as $,F as Oe,S as G,t as S,Q as Ze,e as et}from"./define-By-uL588.js";import{c as P}from"./cn-DN5AWfiS.js";import{u as tt,c as nt,a as rt}from"./overlay-Cb-MkyDa.js";function M(n){if(n==null)return[];if(typeof n=="string")return n.length?[{type:"text",text:n}]:[];const l=[];for(const t of n)if(t.type==="text"){if(!t.text)continue;const i=l[l.length-1];i&&i.type==="text"?l[l.length-1]={type:"text",text:i.text+t.text}:l.push({type:"text",text:t.text})}else l.push({type:"entity",entity:t.entity});return l}function te(n,l){let t="";for(const i of n)i.type==="text"?t+=i.text:t+=i.entity.promptText??i.entity.label;return t}function he(n){return n.filter(l=>l.type==="entity").map(l=>l.entity)}function ne(n){return n.every(l=>l.type==="text"&&l.text.length===0)}const C="\u200B",pe="data-kai-entity",fe=new WeakMap;function U(n){return!!n&&n.nodeType===1&&n.hasAttribute(pe)}function re(n){return n.ownerDocument.createTreeWalker(n,NodeFilter.SHOW_TEXT,{acceptNode(l){let t=l.parentElement;for(;t&&t!==n;){if(t.hasAttribute(pe))return NodeFilter.FILTER_REJECT;t=t.parentElement}return NodeFilter.FILTER_ACCEPT}})}function ot(n){switch(n){case"skill":return"/";case"agent":return"@";default:return""}}function Le(n){const l=t=>`<svg viewBox="0 0 24 24" width="1em" height="1em" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${t}</svg>`;switch(n){case"agent":return l('<rect x="4" y="8" width="16" height="12" rx="3"/><path d="M12 4.5V8M9.5 13.5v1.5M14.5 13.5v1.5"/><circle cx="12" cy="3" r="1.2"/>');case"plugin":return l('<path d="M9 2v4M15 2v4M6 6h12v5a6 6 0 0 1-12 0zM12 17v5"/>');default:return""}}function Ie(n,l,t){const i=n.createElement("span");i.setAttribute(pe,""),i.setAttribute("contenteditable","false"),i.dataset.kind=l.kind,i.dataset.id=l.id,i.className="kai-composer-pill";const u=ot(l.kind);if(u){const s=n.createElement("span");s.className="kai-composer-pill-sigil",s.setAttribute("aria-hidden","true"),s.textContent=u,i.appendChild(s)}else{const s=l.icon??t?.[l.kind];if(s){const h=n.createElement("img");h.src=s,h.alt="",h.className="kai-composer-pill-icon",i.appendChild(h)}else{const h=Le(l.kind);if(h){const f=n.createElement("span");f.className="kai-composer-pill-icon kai-composer-pill-glyph",f.setAttribute("aria-hidden","true"),f.innerHTML=h,i.appendChild(f)}}}return i.appendChild(n.createTextNode(l.label)),fe.set(i,l),i}function L(n){const l=[],t=n.childNodes;return t.forEach((i,u)=>{if(U(i)){const s=fe.get(i),h=i;l.push({type:"entity",entity:s??{kind:h.dataset.kind??"",id:h.dataset.id??"",label:h.textContent??""}})}else if(i.nodeType===1&&i.tagName==="BR"){if(u===t.length-1)return;l.push({type:"text",text:`
|
|
2
2
|
`})}else i.nodeType===3&&l.push({type:"text",text:(i.textContent??"").split(C).join("")})}),M(l)}function oe(n,l,t=document,i){n.textContent="";for(const u of l)u.type==="text"?n.appendChild(t.createTextNode(u.text)):(n.appendChild(Ie(t,u.entity,i)),n.appendChild(t.createTextNode(C)))}function it(n,l,t){if(l<0||l>n.length)return null;for(let i=l-1;i>=0;i--){const u=n[i];if(/\s/.test(u))return null;if(t.includes(u))return i===0||/\s/.test(n[i-1])?{char:u,query:n.slice(i+1,l),start:i}:null}return null}function at(n,l,t){if(!t.length)return null;const i=t.map(h=>h.char),u=it(n,l,i);if(!u)return null;const s=t.find(h=>h.char===u.char);return s?{def:s,query:u.query,start:u.start}:null}function lt(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function st(n,l){const t=[];for(const s of l){let h,f;typeof s=="string"?(h=new RegExp(lt(s),"gi"),f=void 0):(h=new RegExp(s.pattern,s.flags??"gi"),f=s.class),h.lastIndex=0;let k;for(;(k=h.exec(n))!==null;){const x=k.index,w=x+k[0].length;if(w===x){h.lastIndex=x+1;continue}t.push({start:x,end:w,class:f})}}t.sort((s,h)=>s.start-h.start);const i=[];let u=-1;for(const s of t)s.start>=u&&(i.push(s),u=s.end);return i}function ct(){try{return typeof CSS<"u"&&typeof CSS.highlights<"u"&&typeof Highlight<"u"}catch{return!1}}const dt="kai-composer-highlight";function ut(n,l,t,i=dt){if(!ct())return;const u=CSS.highlights;if(l.length===0){u.delete(i);return}const s=[];let h=0;const f=n.ownerDocument,k=re(n);let x=k.nextNode();for(;x;){const v=x.textContent??"",b=[];for(let p=0;p<v.length;p++)v[p]!==t&&b.push(p);if(b.length>0){const p=new Int32Array(b.length);for(let m=0;m<b.length;m++)p[m]=b[m];s.push({node:x,strippedStart:h,strippedToRaw:p}),h+=b.length}x=k.nextNode()}function w(v){let b=0,p=s.length-1;for(;b<=p;){const m=b+p>>1,T=s[m],q=T.strippedStart+T.strippedToRaw.length;if(v<T.strippedStart)p=m-1;else if(v>=q)b=m+1;else{const R=v-T.strippedStart;return{node:T.node,rawOffset:T.strippedToRaw[R]}}}if(s.length>0){const m=s[s.length-1];if(v-m.strippedStart===m.strippedToRaw.length)return{node:m.node,rawOffset:m.strippedToRaw[m.strippedToRaw.length-1]+1}}return null}const y=[];for(const v of l){const b=w(v.start),p=w(v.end);if(!b||!p)continue;const m=f.createRange();m.setStart(b.node,b.rawOffset),m.setEnd(p.node,p.rawOffset),y.push(m)}if(y.length===0){u.delete(i);return}const A=new Highlight(...y);u.set(i,A)}function ht(n,l=200){let t=[n],i=0;return{record(u,s){if(s&&i===t.length-1){t[i]=u;return}t=t.slice(0,i+1),t.push(u),t.length>l?t.shift():i++},undo(){return i===0?null:(i--,t[i])},redo(){return i>=t.length-1?null:(i++,t[i])},reset(u){t=[u],i=0},canUndo(){return i>0},canRedo(){return i<t.length-1},size(){return t.length}}}var pt=S("<style>"),ft=S(`<style>
|
|
3
3
|
.kai-composer-pill {
|
|
4
4
|
display: inline-flex; align-items: center; gap: 0.2rem;
|
|
@@ -78,7 +78,7 @@ import{A as Ye,g as z,w as Je,k as Z,j as de,o as ue,x as De,h as Ze,i as N,u as
|
|
|
78
78
|
color: var(--color-muted-foreground, #9ca3af);
|
|
79
79
|
pointer-events: none;
|
|
80
80
|
}
|
|
81
|
-
`),gt=S("<div class=relative><div data-kai-composer-editable role=textbox aria-multiline=true>"),mt=S("<div role=listbox aria-label=Suggestions style=position:fixed>"),kt=S('<div class="px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground select-none">'),yt=S('<span class="text-muted-foreground truncate min-w-0">'),vt=S('<button role=option><span class="font-medium whitespace-nowrap shrink-0">'),bt=S('<span class="kai-composer-pill-glyph w-4 h-4 shrink-0"aria-hidden=true>'),xt=S('<img alt class="w-4 h-4 rounded object-cover shrink-0">'),wt=S("<div>");function E(n){var l;const t=n.getRootNode();return typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&typeof t.getSelection=="function"?t.getSelection():((l=n.ownerDocument)==null?void 0:l.getSelection())??null}function $e(n){let l="";const t=re(n);let i=t.nextNode();for(;i;)l+=(i.textContent??"").split(C).join(""),i=t.nextNode();return l}function ge(n){const l=E(n);if(!l||l.rangeCount===0)return 0;const t=l.getRangeAt(0);if(!t.collapsed)return 0;const{startContainer:i,startOffset:u}=t;let s=0;const h=re(n);let f=h.nextNode();for(;f;){if(f===i){const k=(f.textContent??"").slice(0,u);return s+=k.split(C).join("").length,s}s+=(f.textContent??"").split(C).join("").length,f=h.nextNode()}return s}function Ct(n){const l=n.ownerDocument,t=E(n);if(!t||t.rangeCount===0)return null;const i=t.getRangeAt(0).cloneRange();i.collapse(!0);const u=i.getClientRects();if(u.length>0&&(u[0].width>0||u[0].height>0))return u[0];const s=l.createElement("span");s.textContent="\u200B",s.style.position="absolute",s.style.visibility="hidden",i.insertNode(s);const h=s.getBoundingClientRect();return s.remove(),h.width>0||h.height>0?h:null}function Tt(n,l){const t=E(n);if(!t)return;const i=n.ownerDocument.createRange(),u=re(n);let s=l,h=u.nextNode(),f=!1;for(;h;){const k=h.textContent??"",x=k.split(C).join("").length;if(s<=x){let w=0,y=0;for(;w<k.length&&y<s;)k[w]!==C&&y++,w++;for(;w<k.length&&k[w]===C;)w++;i.setStart(h,w),f=!0;break}s-=x,h=u.nextNode()}f?i.collapse(!0):(i.selectNodeContents(n),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}function Rt(n){const l=Ye();let t;const[i,u]=z(),s=`kai-composer-highlight-${Je()}`,[h,f]=z(ne(M(n.value))),[k,x]=z(null),w=e=>{const r=k();r&&r!==e&&r.removeAttribute("data-selected"),e.setAttribute("data-selected",""),x(e)},y=()=>{const e=k();e&&(e.removeAttribute("data-selected"),x(null))},A=ht({doc:M(n.value),caret:0});let v=0;const b=500,[p,m]=z(null),[T,q]=z(0),R=
|
|
81
|
+
`),gt=S("<div class=relative><div data-kai-composer-editable role=textbox aria-multiline=true>"),mt=S("<div role=listbox aria-label=Suggestions style=position:fixed>"),kt=S('<div class="px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground select-none">'),yt=S('<span class="text-muted-foreground truncate min-w-0">'),vt=S('<button role=option><span class="font-medium whitespace-nowrap shrink-0">'),bt=S('<span class="kai-composer-pill-glyph w-4 h-4 shrink-0"aria-hidden=true>'),xt=S('<img alt class="w-4 h-4 rounded object-cover shrink-0">'),wt=S("<div>");function E(n){var l;const t=n.getRootNode();return typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&typeof t.getSelection=="function"?t.getSelection():((l=n.ownerDocument)==null?void 0:l.getSelection())??null}function $e(n){let l="";const t=re(n);let i=t.nextNode();for(;i;)l+=(i.textContent??"").split(C).join(""),i=t.nextNode();return l}function ge(n){const l=E(n);if(!l||l.rangeCount===0)return 0;const t=l.getRangeAt(0);if(!t.collapsed)return 0;const{startContainer:i,startOffset:u}=t;let s=0;const h=re(n);let f=h.nextNode();for(;f;){if(f===i){const k=(f.textContent??"").slice(0,u);return s+=k.split(C).join("").length,s}s+=(f.textContent??"").split(C).join("").length,f=h.nextNode()}return s}function Ct(n){const l=n.ownerDocument,t=E(n);if(!t||t.rangeCount===0)return null;const i=t.getRangeAt(0).cloneRange();i.collapse(!0);const u=i.getClientRects();if(u.length>0&&(u[0].width>0||u[0].height>0))return u[0];const s=l.createElement("span");s.textContent="\u200B",s.style.position="absolute",s.style.visibility="hidden",i.insertNode(s);const h=s.getBoundingClientRect();return s.remove(),h.width>0||h.height>0?h:null}function Tt(n,l){const t=E(n);if(!t)return;const i=n.ownerDocument.createRange(),u=re(n);let s=l,h=u.nextNode(),f=!1;for(;h;){const k=h.textContent??"",x=k.split(C).join("").length;if(s<=x){let w=0,y=0;for(;w<k.length&&y<s;)k[w]!==C&&y++,w++;for(;w<k.length&&k[w]===C;)w++;i.setStart(h,w),f=!0;break}s-=x,h=u.nextNode()}f?i.collapse(!0):(i.selectNodeContents(n),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}function Rt(n){const l=Ye();let t;const[i,u]=z(),s=`kai-composer-highlight-${Je()}`,[h,f]=z(ne(M(n.value))),[k,x]=z(null),w=e=>{const r=k();r&&r!==e&&r.removeAttribute("data-selected"),e.setAttribute("data-selected",""),x(e)},y=()=>{const e=k();e&&(e.removeAttribute("data-selected"),x(null))},A=ht({doc:M(n.value),caret:0});let v=0;const b=500,[p,m]=z(null),[T,q]=z(0),R=Q(()=>{const e=p();if(!(e!=null&&e.def.items))return[];const r=new Set(he(L(t)).map(o=>`${o.kind}:${o.id}`)),a=e.query.toLowerCase();return e.def.items.filter(o=>{var c;const d=o.kind??e.def.kind;return r.has(`${d}:${o.id}`)?!1:a===""?!0:o.label.toLowerCase().includes(a)||(((c=o.description)==null?void 0:c.toLowerCase().includes(a))??!1)})}),Me=Q(()=>{const e=[];return R().forEach((r,a)=>{let o=e.find(c=>c.group===r.group);o||(o={group:r.group,items:[]},e.push(o)),o.items.push({item:r,index:a})}),e}),ie=Q(()=>R().length>0),me=e=>{var r;return e.kind??((r=p())==null?void 0:r.def.kind)??""},qe=e=>{var r;return e.icon??((r=n.kindIcons)==null?void 0:r[me(e)])};de(()=>{const e=R().length;T()>=e&&q(Math.max(0,e-1))});const Be=Q(()=>{const e=p();if(!e)return;const r=e.caretRect;return{getBoundingClientRect:()=>r}}),{pos:ke,hidden:Ke}=tt(Be,i,{placement:"bottom-start",gutter:4}),{present:je,state:He,setRef:Fe}=nt(ie);rt({enabled:ie,onDismiss:()=>B(),refs:()=>[t,i()]});function B(){var e;p()&&(m(null),(e=n.onTriggerClose)==null||e.call(n))}const K=()=>{const e=L(t);return{doc:e,text:te(e),entities:he(e)}};function X(){const e=n.highlights,r=e!=null&&e.length?st($e(t),e):[];ut(t,r,C,s)}ue(()=>{oe(t,M(n.value),t.ownerDocument,n.kindIcons),f(ne(L(t))),X(),A.reset({doc:L(t),caret:0})}),de(De(()=>n.value,e=>{te(M(e))!==te(L(t))&&(y(),oe(t,M(e),t.ownerDocument,n.kindIcons),f(ne(L(t))),X(),A.reset({doc:L(t),caret:0}))},{defer:!0})),de(De(()=>n.highlights,()=>X(),{defer:!0}));function ye(){var e;const r=n.triggers;if(!(r!=null&&r.length)){p()&&B();return}const a=$e(t),o=ge(t),c=at(a,o,r);if(c){const d=Ct(t);if(d){const g=p();m({def:c.def,query:c.query,start:c.start,caretRect:d}),(!g||g.def.char!==c.def.char||g.query!==c.query)&&((e=n.onTrigger)==null||e.call(n,{char:c.def.char,query:c.query,rect:d}))}}else p()&&B()}const W=e=>{var r;f(ne(e.doc)),(r=n.onChange)==null||r.call(n,e),ye(),X()},_e=()=>{y();const e=K();W(e);const r=Date.now();A.record({doc:e.doc,caret:ge(t)},r-v<b),v=r},ve=()=>{const e=K();W(e),A.record({doc:e.doc,caret:ge(t)},!1),v=0},be=e=>{y(),oe(t,e.doc,t.ownerDocument,n.kindIcons),Tt(t,e.caret),W(K()),v=0},ze=()=>{const e=A.undo();e&&be(e)},xe=()=>{const e=A.redo();e&&be(e)};let ae=!1;const Ge=e=>{var r;ae=!0,(r=n.onFocus)==null||r.call(n,e)},Pe=e=>{var r;ae=!1,y(),(r=n.onBlur)==null||r.call(n,e)};ue(()=>{const e=t.ownerDocument,r=()=>{ae&&ye()};e.addEventListener("selectionchange",r),Qe(()=>e.removeEventListener("selectionchange",r))}),ue(()=>{var e;(e=n.controllerRef)==null||e.call(n,{focus:r=>t.focus(r),blur:()=>t.blur(),clear:()=>{y(),oe(t,[],t.ownerDocument,n.kindIcons),W(K()),A.reset({doc:L(t),caret:0}),v=0},send:()=>{var r;return(r=n.onSubmit)==null?void 0:r.call(n,K())},insertEntity:r=>Ce(r)})});function we(e){const r=p();if(!r)return;const a={kind:e.kind??r.def.kind,id:e.id,label:e.label,icon:e.icon,promptText:e.promptText,data:e.data};Ce(a,{deleteBefore:1+r.query.length}),B()}const Ce=(e,r)=>{var a;const o=t.ownerDocument,c=E(t);if(!c||c.rangeCount===0)return;const d=c.getRangeAt(0);if(r!=null&&r.deleteBefore&&d.collapsed){let Y=r.deleteBefore,j=d.startContainer,_=d.startOffset;for(;Y>0&&j&&j.nodeType===3;){const Ve=j.textContent??"";for(;_>0&&Y>0;)_--,Ve[_]!==C&&Y--;if(Y>0){const J=j.previousSibling;if(J&&J.nodeType===3)j=J,_=(J.textContent??"").length;else break}}const ce=o.createRange();ce.setStart(j,_),ce.setEnd(d.startContainer,d.startOffset),ce.deleteContents()}const g=c.getRangeAt(0);g.collapsed||g.deleteContents();const I=Ie(o,e,n.kindIcons),D=o.createTextNode(C);g.insertNode(D),g.insertNode(I);const se=o.createRange();se.setStartAfter(D),se.collapse(!0),c.removeAllRanges(),c.addRange(se),(a=n.onEntityAdd)==null||a.call(n,e),ve()},V=e=>(e??"").split("").every(r=>r===C),F=e=>!!e&&e.nodeType===Node.TEXT_NODE&&V(e.textContent),Te=e=>{const{startContainer:r,startOffset:a}=e;if(r===t){let o=a-1;for(;F(t.childNodes[o]);)o--;const c=t.childNodes[o];return U(c)?c:null}if(r.nodeType===Node.TEXT_NODE){if(!V((r.textContent??"").slice(0,a)))return null;let o=r.previousSibling;for(;F(o);)o=o.previousSibling;return U(o)?o:null}return null},Re=e=>{const{startContainer:r,startOffset:a}=e;if(r===t){let o=a;for(;F(t.childNodes[o]);)o++;const c=t.childNodes[o];return U(c)?c:null}if(r.nodeType===Node.TEXT_NODE){if(!V((r.textContent??"").slice(a)))return null;let o=r.nextSibling;for(;F(o);)o=o.nextSibling;return U(o)?o:null}return null},Se=e=>{var r;const a=fe.get(e),o=e.nextSibling;o?.nodeType===Node.TEXT_NODE&&V(o.textContent)&&o.remove(),e.remove(),a&&((r=n.onEntityRemove)==null||r.call(n,a)),ve()},Ue=e=>{const r=E(t);if(!r)return;const a=t.ownerDocument.createRange();a.setStartBefore(e),a.collapse(!0),r.removeAllRanges(),r.addRange(a)},Ae=e=>{const r=E(t);if(!r)return;let a=e;for(;F(a.nextSibling);)a=a.nextSibling;const o=t.ownerDocument.createRange();o.setStartAfter(a),o.collapse(!0),r.removeAllRanges(),r.addRange(o)},Xe=e=>{var r;if((e.metaKey||e.ctrlKey)&&(e.key==="z"||e.key==="Z")){e.preventDefault(),e.shiftKey?xe():ze();return}if((e.metaKey||e.ctrlKey)&&(e.key==="y"||e.key==="Y")){e.preventDefault(),xe();return}if(ie()&&R().length>0){if(e.key==="ArrowDown"){e.preventDefault(),q(o=>(o+1)%R().length);return}if(e.key==="ArrowUp"){e.preventDefault(),q(o=>(o-1+R().length)%R().length);return}if(e.key==="Enter"||e.key==="Tab"){const o=R();if(o.length>0){e.preventDefault(),e.stopPropagation(),we(o[T()]);return}}if(e.key==="Escape"){e.preventDefault(),B();return}}else if(p()&&e.key==="Escape"){e.preventDefault(),B();return}const a=k();if(a&&a.isConnected){if(e.key==="ArrowLeft"){e.preventDefault(),Ue(a),y();return}if(e.key==="ArrowRight"){e.preventDefault(),Ae(a),y();return}if(e.key==="Backspace"||e.key==="Delete"){e.preventDefault();const o=a.previousSibling;y(),Se(a);const c=E(t);if(c){const d=t.ownerDocument.createRange();o&&o.isConnected?d.setStartAfter(o):d.setStart(t,0),d.collapse(!0),c.removeAllRanges(),c.addRange(d)}return}if(e.key==="Escape"){e.preventDefault(),y();return}if(e.key==="Shift"||e.key==="Meta"||e.key==="Control"||e.key==="Alt")return;Ae(a),y()}if(!k()&&(e.key==="ArrowLeft"||e.key==="ArrowRight")&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey){const o=E(t);if(o&&o.rangeCount>0){const c=o.getRangeAt(0);if(c.collapsed){const d=e.key==="ArrowLeft"?Te(c):Re(c);if(d){e.preventDefault(),w(d);return}}}}if(e.key==="Backspace"||e.key==="Delete"){const o=E(t);if(!o||o.rangeCount===0)return;const c=o.getRangeAt(0);if(!c.collapsed)return;const d=e.key==="Backspace"?Te(c):Re(c);if(d){e.preventDefault(),Se(d);return}}if(e.key==="Enter"&&!e.shiftKey&&n.submitOnEnter!==!1){if(e.preventDefault(),n.disabled||n.loading)return;(r=n.onSubmit)==null||r.call(n,K())}},le=()=>n.maxHeight??240,We=()=>n.editableClass??P("text-foreground min-h-[44px] w-full text-start overflow-y-auto whitespace-pre-wrap break-words",Ze(l.proseSize()),n.bare?"kai-focus-inset":"outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"),Ee=[(()=>{var e=pt();return N(e,`
|
|
82
82
|
/* MARKED text, not selected text. Reads --color-highlight (overridable via
|
|
83
83
|
--kai-color-highlight), a warm <mark> yellow. It used to be a 22% tint of
|
|
84
84
|
--color-primary with a #6366f1 indigo fallback \u2014 but the kit's
|
|
@@ -103,4 +103,4 @@ import{A as Ye,g as z,w as Je,k as Z,j as de,o as ue,x as De,h as Ze,i as N,u as
|
|
|
103
103
|
light one: an unstyled page is a white page, and guessing from the OS is
|
|
104
104
|
exactly the failure above. */
|
|
105
105
|
::highlight(${s}) { background-color: var(--color-highlight, hsl(45 96% 78%)); }
|
|
106
|
-
`),e})(),ft(),(()=>{var e=gt(),r=e.firstChild;return r.addEventListener("blur",Pe),r.addEventListener("focus",Ge),r.$$mousedown=y,r.$$keydown=Xe,r.$$input=_e,Ne(a=>{var o;t=a,(o=n.editableRef)==null||o.call(n,a)},r),H(a=>{var o=k()?"":void 0,c=n.placeholder??"",d=n.disabled?!1:"plaintext-only",g=n.ariaLabel||n.placeholder||"Message input",I=P(We(),h()&&n.placeholder?"kai-composer-empty":""),D=typeof le()=="number"?`${le()}px`:String(le());return o!==a.e&&O(r,"data-pill-selected",a.e=o),c!==a.t&&O(r,"data-placeholder",a.t=c),d!==a.a&&O(r,"contenteditable",a.a=d),g!==a.o&&O(r,"aria-label",a.o=g),I!==a.i&&
|
|
106
|
+
`),e})(),ft(),(()=>{var e=gt(),r=e.firstChild;return r.addEventListener("blur",Pe),r.addEventListener("focus",Ge),r.$$mousedown=y,r.$$keydown=Xe,r.$$input=_e,Ne(a=>{var o;t=a,(o=n.editableRef)==null||o.call(n,a)},r),H(a=>{var o=k()?"":void 0,c=n.placeholder??"",d=n.disabled?!1:"plaintext-only",g=n.ariaLabel||n.placeholder||"Message input",I=P(We(),h()&&n.placeholder?"kai-composer-empty":""),D=typeof le()=="number"?`${le()}px`:String(le());return o!==a.e&&O(r,"data-pill-selected",a.e=o),c!==a.t&&O(r,"data-placeholder",a.t=c),d!==a.a&&O(r,"contenteditable",a.a=d),g!==a.o&&O(r,"aria-label",a.o=g),I!==a.i&&Z(r,a.i=I),D!==a.n&&ee(r,"max-height",a.n=D),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),e})(),$(G,{get when(){return je()},get children(){var e=mt();return Ne(r=>{u(r),Fe(r)},e),N(e,$(Oe,{get each(){return Me()},children:r=>[$(G,{get when(){return r.group},get children(){var a=kt();return N(a,()=>r.group),a}}),$(Oe,{get each(){return r.items},children:a=>(()=>{var o=vt(),c=o.firstChild;return o.$$click=d=>{d.preventDefault(),we(a.item)},o.$$mousedown=d=>d.preventDefault(),o.addEventListener("mouseenter",()=>q(a.index)),N(o,$(G,{get when(){return qe(a.item)},get fallback(){return $(G,{get when(){return Le(me(a.item))},children:d=>(()=>{var g=bt();return H(()=>g.innerHTML=d()),g})()})},children:d=>(()=>{var g=xt();return H(()=>O(g,"src",d())),g})()}),c),N(c,()=>a.item.label),N(o,$(G,{get when(){return a.item.description},get children(){var d=yt();return N(d,()=>a.item.description),d}}),null),H(d=>{var g=T()===a.index,I=a.index,D=P("w-full flex items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors",T()===a.index?"bg-muted text-foreground":"text-foreground hover:bg-muted");return g!==d.e&&O(o,"aria-selected",d.e=g),I!==d.t&&O(o,"data-index",d.t=I),D!==d.a&&Z(o,d.a=D),d},{e:void 0,t:void 0,a:void 0}),o})()})]})),H(r=>{var a=He(),o=P("absolute z-50 min-w-[240px] max-w-[420px] max-h-[320px] overflow-y-auto rounded-lg bg-card shadow-lg py-1","border border-border"),c=`${ke().x}px`,d=`${ke().y}px`,g=Ke()?"hidden":"visible";return a!==r.e&&O(e,"data-state",r.e=a),o!==r.t&&Z(e,r.t=o),c!==r.a&&ee(e,"left",r.a=c),d!==r.o&&ee(e,"top",r.o=d),g!==r.i&&ee(e,"visibility",r.i=g),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e}})];return n.bare?Ee:(()=>{var e=wt();return N(e,Ee),H(()=>Z(e,P("kai-composer relative rounded-xl bg-surface p-2","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-0",n.disabled&&"cursor-not-allowed opacity-60"))),e})()}et(["input","keydown","mousedown","click"]);export{Rt as C,he as e,M as n,te as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as L,s as N,k as v,j as T,x as O,o as H,c as d,E as U,S as f,i as l,a as $,b as F,d as q,F as G,u as A,t as h,e as J}from"./define-
|
|
1
|
+
import{q as L,s as N,k as v,j as T,x as O,o as H,c as d,E as U,S as f,i as l,a as $,b as F,d as q,F as G,u as A,t as h,e as J}from"./define-By-uL588.js";import{c as K}from"./cn-DN5AWfiS.js";import{B as D}from"./button-DkuOnGLy.js";import{u as P,a as Q,C as x,D as V}from"./use-card-resolution-DaZqAdWf.js";import{e as W}from"./card-routing-0YidER_3.js";import{t as X}from"./triangle-alert-DlQ68ppf.js";import{c as Y}from"./check-njkVdZu2.js";var Z=h('<div class="flex items-center gap-2 text-sm font-medium text-destructive dark:text-red-400"><span>Heads up'),_=h('<p class="text-sm font-semibold text-foreground">'),ee=h('<p class="text-sm text-muted-foreground">'),te=h("<div>"),re=h('<div class="flex w-full flex-wrap items-center justify-between gap-2"><div class="ml-auto flex flex-wrap items-center gap-2">'),ae=h('<div class="ml-auto flex items-center gap-2 text-sm font-medium text-foreground"><span>');const ne="confirm",ie=new Set(["primary","default","destructive"]);function de(o){switch(o){case"primary":return"default";case"destructive":return"destructive";case"default":case void 0:return"outline";default:return console.warn(`[kai-confirm] unknown action style "${o}"; using default`),"outline"}}function oe(o){if(!Array.isArray(o)||o.length===0)return{actions:[],error:"This card couldn't be displayed."};const c=new Set,r=[];for(const m of o){if(!m||typeof m!="object")continue;const i=m;if(typeof i.id!="string"||i.id.length===0||typeof i.label!="string"||i.label.length===0)continue;if(c.has(i.id)){console.warn(`[kai-confirm] duplicate action id "${i.id}" ignored`);continue}c.add(i.id);const g=ie.has(i.style)?i.style:void 0;i.style!==void 0&&g===void 0&&console.warn(`[kai-confirm] unknown action style "${String(i.style)}"; using default`),r.push({id:i.id,label:i.label,style:g,payload:i.payload,default:i.default===!0})}return r.length===0?{actions:[],error:"This card couldn't be displayed."}:{actions:r}}function se(o){var c;return(c=o.find(r=>r.default))==null?void 0:c.id}function le(o){const c=L({cardId:"kai-confirm",autofocus:!1},o),[r]=N(c,["data","cardId","heading","host","hostElement","autofocus","class","resolution","controllerRef"]),m=P(),i=e=>{const n=r.host??m;n?n.emit(e):r.hostElement&&W(r.hostElement,e)},g=v(()=>{var e;return oe((e=r.data)==null?void 0:e.actions)}),I=v(()=>g().error===void 0),C=v(()=>g().error??""),p=v(()=>g().actions),j=()=>{var e;return((e=r.data)==null?void 0:e.tone)??"default"},M=()=>j()==="danger",k=v(()=>se(p())),u=Q({prop:()=>r.resolution,data:()=>r.data}),z=v(()=>{const e=u.resolution();if(!e||e.kind!=="action")return;const n=p().find(t=>t.id===e.action);return{label:n?.label??e.action}});T(O(I,e=>{i(e?{kind:"ready",cardId:r.cardId}:{kind:"error",cardId:r.cardId,message:C()})}));const b=e=>{u.isResolved()||(i({kind:"action",cardId:r.cardId,action:e.id,...e.payload!==void 0?{payload:e.payload}:{}}),u.setLocal({kind:"action",action:e.id,...e.payload!==void 0?{payload:e.payload}:{}}))},E=()=>{u.isResolved()||(i({kind:"dismiss",cardId:r.cardId}),u.setLocal({kind:"dismissed"}))},R=()=>i({kind:"reopen",cardId:r.cardId});let S,y;const B=()=>y?y.querySelector('button[data-kai-default="true"]')??y.querySelector("button[data-action-id]"):null;return H(()=>{var e;(e=r.controllerRef)==null||e.call(r,{focus:n=>{var t;return(t=B())==null?void 0:t.focus(n)},confirm:n=>{const t=p(),a=n??k();if(a===void 0)return;const s=t.find(w=>w.id===a);s&&b(s)},dismiss:()=>E(),reopen:()=>R()})}),T(()=>{const e=r.hostElement;if(!e)return;const n=u.resolution();n&&n.kind==="action"?e.setAttribute("data-kai-resolved",n.action):e.removeAttribute("data-kai-resolved")}),d(f,{get when(){return I()},get fallback(){return d(x,{get heading(){return r.heading},get errorMessage(){return C()}})},get children(){return d(U,{fallback:()=>(i({kind:"error",cardId:r.cardId,message:"The card failed to render."}),d(x,{get heading(){return r.heading},errorMessage:"The card failed to render."})),get children(){return d(f,{get when(){return!u.isDeferred()},get fallback(){return d(V,{type:ne,get title(){return r.heading},onReopen:R})},get children(){return d(x,{get heading(){return r.heading},get actions(){return d(f,{get when(){return!u.isResolved()},get fallback(){return(()=>{var e=ae(),n=e.firstChild;return l(e,d(Y,{size:16,"aria-hidden":"true"}),n),l(n,()=>{var t;return(t=z())==null?void 0:t.label}),$(()=>q(e,"role",u.isOptimistic()?"status":void 0)),e})()},get children(){var e=re(),n=e.firstChild;l(e,d(f,{get when(){var a;return((a=r.data)==null?void 0:a.dismissible)===!0},get children(){return d(D,{type:"button",variant:"ghost","aria-label":"Dismiss",onClick:E,children:"Dismiss"})}}),n);var t=y;return typeof t=="function"?A(t,n):y=n,l(n,d(G,{get each(){return p()},children:a=>d(D,{type:"button",get variant(){return de(a.style)},get"data-action-id"(){return a.id},get"data-kai-default"(){return a.default?"true":void 0},ref:s=>{r.autofocus&&a.id===k()&&queueMicrotask(()=>s.focus())},onClick:()=>b(a),get children(){return a.label}})})),e}})},get children(){var e=te();e.$$keydown=t=>{if(t.key!=="Enter"||t.target.tagName==="BUTTON")return;const a=k();if(a===void 0)return;const s=p().find(w=>w.id===a);s&&b(s)};var n=S;return typeof n=="function"?A(n,e):S=e,l(e,d(f,{get when(){return M()},get children(){var t=Z(),a=t.firstChild;return l(t,d(X,{size:16,class:"shrink-0","aria-hidden":"true"}),a),t}}),null),l(e,d(f,{get when(){var t;return(t=r.data)==null?void 0:t.heading},get children(){var t=_();return l(t,()=>{var a;return(a=r.data)==null?void 0:a.heading}),t}}),null),l(e,d(f,{get when(){var t;return(t=r.data)==null?void 0:t.body},get children(){var t=ee();return l(t,()=>{var a;return(a=r.data)==null?void 0:a.body}),t}}),null),$(t=>{var a=K("flex flex-col gap-2",r.class),s=k()!==void 0?0:void 0;return a!==t.e&&F(e,t.e=a),s!==t.t&&q(e,"tabindex",t.t=s),t},{e:void 0,t:void 0}),e}})}})}})}})}J(["keydown"]);export{le as C};
|