@elabs-ai/components-ai 4.1.0 → 5.0.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 +3 -3
- package/dist/{_audio-player-media-chrome-T3XVXWRZ.js → _audio-player-media-chrome.js} +1 -1
- package/dist/_code-block-theme.js +12 -0
- package/dist/_code-block-theme.js.map +1 -0
- package/dist/{_flow-boundary-SHNWLQG5.js → _flow-boundary.js} +1 -1
- package/dist/_flow-boundary.js.map +1 -0
- package/dist/_flow-lazy.js +8 -0
- package/dist/_flow-lazy.js.map +1 -0
- package/dist/_lazy-boundary-conformance.js +2 -0
- package/dist/_lazy-boundary-conformance.js.map +1 -0
- package/dist/_lazy-cjk.js +13 -0
- package/dist/_lazy-cjk.js.map +1 -0
- package/dist/_lazy-engine-boundary.js +9 -0
- package/dist/_lazy-engine-boundary.js.map +1 -0
- package/dist/_lazy-math.js +13 -0
- package/dist/_lazy-math.js.map +1 -0
- package/dist/_lazy-mermaid.js +12 -0
- package/dist/_lazy-mermaid.js.map +1 -0
- package/dist/_mermaid-error-panel.js +9 -0
- package/dist/_mermaid-error-panel.js.map +1 -0
- package/dist/{_persona-rive-JEG44YHX.js → _persona-rive.js} +19 -24
- package/dist/_persona-rive.js.map +1 -0
- package/dist/_streamdown-i18n.js +21 -0
- package/dist/_streamdown-i18n.js.map +1 -0
- package/dist/_streamdown-safety.js +10 -0
- package/dist/_streamdown-safety.js.map +1 -0
- package/dist/_theme-scope-store.js +13 -0
- package/dist/_theme-scope-store.js.map +1 -0
- package/dist/a2ui/a2ui-surface.js +17 -0
- package/dist/a2ui/a2ui-surface.js.map +1 -0
- package/dist/a2ui/core/catalog.generated.js +10 -0
- package/dist/a2ui/core/catalog.generated.js.map +1 -0
- package/dist/a2ui/core/complete-json.js +10 -0
- package/dist/a2ui/core/complete-json.js.map +1 -0
- package/dist/a2ui/core/index.js +37 -0
- package/dist/a2ui/core/index.js.map +1 -0
- package/dist/a2ui/core/schema.js +11 -0
- package/dist/a2ui/core/schema.js.map +1 -0
- package/dist/a2ui/core/spec.js +10 -0
- package/dist/a2ui/core/spec.js.map +1 -0
- package/dist/a2ui/core/validate.js +16 -0
- package/dist/a2ui/core/validate.js.map +1 -0
- package/dist/a2ui/index.js +54 -0
- package/dist/a2ui/index.js.map +1 -0
- package/dist/a2ui/ui-catalog.js +18 -0
- package/dist/a2ui/ui-catalog.js.map +1 -0
- package/dist/agent-event.js +10 -0
- package/dist/agent-event.js.map +1 -0
- package/dist/agent-timeline.js +11 -0
- package/dist/agent-timeline.js.map +1 -0
- package/dist/agent.js +25 -0
- package/dist/agent.js.map +1 -0
- package/dist/artifact.js +23 -0
- package/dist/artifact.js.map +1 -0
- package/dist/asset-preview.js +22 -0
- package/dist/asset-preview.js.map +1 -0
- package/dist/attachments.js +33 -0
- package/dist/attachments.js.map +1 -0
- package/dist/audio-player.js +30 -0
- package/dist/audio-player.js.map +1 -0
- package/dist/audio-visualizer.js +9 -0
- package/dist/audio-visualizer.js.map +1 -0
- package/dist/canvas.js +10 -0
- package/dist/canvas.js.map +1 -0
- package/dist/chain-of-thought.js +22 -0
- package/dist/chain-of-thought.js.map +1 -0
- package/dist/chat-greeting.js +8 -0
- package/dist/chat-greeting.js.map +1 -0
- package/dist/chat-shell.js +9 -0
- package/dist/chat-shell.js.map +1 -0
- package/dist/checkpoint.js +13 -0
- package/dist/checkpoint.js.map +1 -0
- package/dist/chunk-2XOIG5TG.js +72 -0
- package/dist/chunk-2XOIG5TG.js.map +1 -0
- package/dist/chunk-34CQ2VHM.js +172 -0
- package/dist/chunk-34CQ2VHM.js.map +1 -0
- package/dist/chunk-3TDHPXZZ.js +60 -0
- package/dist/chunk-3TDHPXZZ.js.map +1 -0
- package/dist/chunk-3XNPMDZY.js +478 -0
- package/dist/chunk-3XNPMDZY.js.map +1 -0
- package/dist/chunk-3YPT3V7L.js +56 -0
- package/dist/chunk-3YPT3V7L.js.map +1 -0
- package/dist/chunk-475UEU2Q.js +87 -0
- package/dist/chunk-475UEU2Q.js.map +1 -0
- package/dist/chunk-4CBTII2I.js +95 -0
- package/dist/chunk-4CBTII2I.js.map +1 -0
- package/dist/chunk-4XRNIZMG.js +22 -0
- package/dist/chunk-4XRNIZMG.js.map +1 -0
- package/dist/chunk-5NNWUKK5.js +2 -0
- package/dist/chunk-5NNWUKK5.js.map +1 -0
- package/dist/chunk-5UOMU27Z.js +164 -0
- package/dist/chunk-5UOMU27Z.js.map +1 -0
- package/dist/chunk-5VGYZ62I.js +264 -0
- package/dist/chunk-5VGYZ62I.js.map +1 -0
- package/dist/chunk-6IQPH2OS.js +21 -0
- package/dist/chunk-6IQPH2OS.js.map +1 -0
- package/dist/chunk-6PB2MXCI.js +482 -0
- package/dist/chunk-6PB2MXCI.js.map +1 -0
- package/dist/chunk-7FD5CZEU.js +215 -0
- package/dist/chunk-7FD5CZEU.js.map +1 -0
- package/dist/chunk-7RL6KZDF.js +266 -0
- package/dist/chunk-7RL6KZDF.js.map +1 -0
- package/dist/chunk-ADOYAGGK.js +482 -0
- package/dist/chunk-ADOYAGGK.js.map +1 -0
- package/dist/chunk-AXMNJMMH.js +984 -0
- package/dist/chunk-AXMNJMMH.js.map +1 -0
- package/dist/chunk-BA3AEMOU.js +21 -0
- package/dist/chunk-BA3AEMOU.js.map +1 -0
- package/dist/chunk-BBHFOYML.js +336 -0
- package/dist/chunk-BBHFOYML.js.map +1 -0
- package/dist/chunk-BHUVISIY.js +221 -0
- package/dist/chunk-BHUVISIY.js.map +1 -0
- package/dist/chunk-BM2LWERA.js +100 -0
- package/dist/chunk-BM2LWERA.js.map +1 -0
- package/dist/chunk-CMOYXNPJ.js +211 -0
- package/dist/chunk-CMOYXNPJ.js.map +1 -0
- package/dist/chunk-CZP3RHC4.js +74 -0
- package/dist/chunk-CZP3RHC4.js.map +1 -0
- package/dist/chunk-DDG5JHQT.js +112 -0
- package/dist/chunk-DDG5JHQT.js.map +1 -0
- package/dist/chunk-DJODXO7I.js +38 -0
- package/dist/chunk-DJODXO7I.js.map +1 -0
- package/dist/chunk-DWJDJLPU.js +192 -0
- package/dist/chunk-DWJDJLPU.js.map +1 -0
- package/dist/chunk-DZW6LM22.js +45 -0
- package/dist/chunk-DZW6LM22.js.map +1 -0
- package/dist/chunk-ELGCZLZF.js +305 -0
- package/dist/chunk-ELGCZLZF.js.map +1 -0
- package/dist/chunk-EV3U6ZZB.js +209 -0
- package/dist/chunk-EV3U6ZZB.js.map +1 -0
- package/dist/chunk-EY7LVUKQ.js +87 -0
- package/dist/chunk-EY7LVUKQ.js.map +1 -0
- package/dist/chunk-F4C74F7M.js +230 -0
- package/dist/chunk-F4C74F7M.js.map +1 -0
- package/dist/chunk-FERYDFZA.js +108 -0
- package/dist/chunk-FERYDFZA.js.map +1 -0
- package/dist/chunk-FUIYG2DS.js +166 -0
- package/dist/chunk-FUIYG2DS.js.map +1 -0
- package/dist/chunk-GKYZT3LA.js +136 -0
- package/dist/chunk-GKYZT3LA.js.map +1 -0
- package/dist/chunk-H42LRUQ4.js +102 -0
- package/dist/chunk-H42LRUQ4.js.map +1 -0
- package/dist/chunk-HVXM2G5F.js +222 -0
- package/dist/chunk-HVXM2G5F.js.map +1 -0
- package/dist/chunk-I4RDAGVY.js +53 -0
- package/dist/chunk-I4RDAGVY.js.map +1 -0
- package/dist/chunk-IQJG4IDX.js +208 -0
- package/dist/chunk-IQJG4IDX.js.map +1 -0
- package/dist/chunk-IX2PXG4Y.js +144 -0
- package/dist/chunk-IX2PXG4Y.js.map +1 -0
- package/dist/chunk-IXICSOOP.js +287 -0
- package/dist/chunk-IXICSOOP.js.map +1 -0
- package/dist/chunk-JY5HSN4D.js +84 -0
- package/dist/chunk-JY5HSN4D.js.map +1 -0
- package/dist/chunk-LMNSBOBG.js +19 -0
- package/dist/chunk-LMNSBOBG.js.map +1 -0
- package/dist/chunk-MBI7D6IL.js +42 -0
- package/dist/chunk-MBI7D6IL.js.map +1 -0
- package/dist/chunk-MLFMYCPH.js +192 -0
- package/dist/chunk-MLFMYCPH.js.map +1 -0
- package/dist/chunk-MOK66734.js +33 -0
- package/dist/chunk-MOK66734.js.map +1 -0
- package/dist/chunk-MXTAWPYM.js +196 -0
- package/dist/chunk-MXTAWPYM.js.map +1 -0
- package/dist/chunk-NCL2UZKI.js +96 -0
- package/dist/chunk-NCL2UZKI.js.map +1 -0
- package/dist/chunk-NET4YLRY.js +107 -0
- package/dist/chunk-NET4YLRY.js.map +1 -0
- package/dist/chunk-NIG67CFM.js +329 -0
- package/dist/chunk-NIG67CFM.js.map +1 -0
- package/dist/chunk-NMVNNO3L.js +10 -0
- package/dist/chunk-NMVNNO3L.js.map +1 -0
- package/dist/chunk-NP7VID4K.js +2 -0
- package/dist/chunk-NP7VID4K.js.map +1 -0
- package/dist/chunk-NPUCMAG2.js +382 -0
- package/dist/chunk-NPUCMAG2.js.map +1 -0
- package/dist/chunk-NSCLRHES.js +102 -0
- package/dist/chunk-NSCLRHES.js.map +1 -0
- package/dist/chunk-OEUXHVFW.js +86 -0
- package/dist/chunk-OEUXHVFW.js.map +1 -0
- package/dist/chunk-ONBHFIMZ.js +137 -0
- package/dist/chunk-ONBHFIMZ.js.map +1 -0
- package/dist/chunk-OPH2HHL2.js +228 -0
- package/dist/chunk-OPH2HHL2.js.map +1 -0
- package/dist/chunk-OQERHIQP.js +287 -0
- package/dist/chunk-OQERHIQP.js.map +1 -0
- package/dist/chunk-P6YJAZFG.js +103 -0
- package/dist/chunk-P6YJAZFG.js.map +1 -0
- package/dist/chunk-PG7ERDOD.js +65 -0
- package/dist/chunk-PG7ERDOD.js.map +1 -0
- package/dist/chunk-PIB5JBMA.js +90 -0
- package/dist/chunk-PIB5JBMA.js.map +1 -0
- package/dist/chunk-PQ5BPIWQ.js +22 -0
- package/dist/chunk-PQ5BPIWQ.js.map +1 -0
- package/dist/chunk-PQBF6ZIQ.js +55 -0
- package/dist/chunk-PQBF6ZIQ.js.map +1 -0
- package/dist/chunk-PTWCTSZL.js +173 -0
- package/dist/chunk-PTWCTSZL.js.map +1 -0
- package/dist/chunk-QJUNPVOS.js +101 -0
- package/dist/chunk-QJUNPVOS.js.map +1 -0
- package/dist/chunk-QUDZOTRV.js +43 -0
- package/dist/chunk-QUDZOTRV.js.map +1 -0
- package/dist/chunk-RB7G65JC.js +213 -0
- package/dist/chunk-RB7G65JC.js.map +1 -0
- package/dist/chunk-RPHAOR7P.js +45 -0
- package/dist/chunk-RPHAOR7P.js.map +1 -0
- package/dist/chunk-RTCSH2AN.js +331 -0
- package/dist/chunk-RTCSH2AN.js.map +1 -0
- package/dist/chunk-S3ISPW3A.js +28 -0
- package/dist/chunk-S3ISPW3A.js.map +1 -0
- package/dist/chunk-SEVN656N.js +36 -0
- package/dist/chunk-SEVN656N.js.map +1 -0
- package/dist/chunk-SKVG672B.js +64 -0
- package/dist/chunk-SKVG672B.js.map +1 -0
- package/dist/chunk-SPQIU7GA.js +236 -0
- package/dist/chunk-SPQIU7GA.js.map +1 -0
- package/dist/chunk-SSGJ6MEM.js +1076 -0
- package/dist/chunk-SSGJ6MEM.js.map +1 -0
- package/dist/chunk-SSKZ2AED.js +118 -0
- package/dist/chunk-SSKZ2AED.js.map +1 -0
- package/dist/chunk-T56JFGXI.js +561 -0
- package/dist/chunk-T56JFGXI.js.map +1 -0
- package/dist/chunk-TCB6O74A.js +137 -0
- package/dist/chunk-TCB6O74A.js.map +1 -0
- package/dist/chunk-TTEYPO6X.js +57 -0
- package/dist/chunk-TTEYPO6X.js.map +1 -0
- package/dist/chunk-TWPHAJNM.js +462 -0
- package/dist/chunk-TWPHAJNM.js.map +1 -0
- package/dist/chunk-TXJJLP4O.js +336 -0
- package/dist/chunk-TXJJLP4O.js.map +1 -0
- package/dist/chunk-TZ6TB7VM.js +245 -0
- package/dist/chunk-TZ6TB7VM.js.map +1 -0
- package/dist/chunk-UBLKJJ7K.js +278 -0
- package/dist/chunk-UBLKJJ7K.js.map +1 -0
- package/dist/chunk-UCJ6IUFS.js +52 -0
- package/dist/chunk-UCJ6IUFS.js.map +1 -0
- package/dist/chunk-UCKFJ3QF.js +197 -0
- package/dist/chunk-UCKFJ3QF.js.map +1 -0
- package/dist/chunk-UPXSLILN.js +20 -0
- package/dist/chunk-UPXSLILN.js.map +1 -0
- package/dist/chunk-V4DORGWJ.js +92 -0
- package/dist/chunk-V4DORGWJ.js.map +1 -0
- package/dist/chunk-V6E5DYZD.js +80 -0
- package/dist/chunk-V6E5DYZD.js.map +1 -0
- package/dist/chunk-VLLYKF3P.js +96 -0
- package/dist/chunk-VLLYKF3P.js.map +1 -0
- package/dist/chunk-VLNBTOH6.js +43 -0
- package/dist/chunk-VLNBTOH6.js.map +1 -0
- package/dist/chunk-WMDSMSPL.js +303 -0
- package/dist/chunk-WMDSMSPL.js.map +1 -0
- package/dist/chunk-WU5BLGTF.js +149 -0
- package/dist/chunk-WU5BLGTF.js.map +1 -0
- package/dist/chunk-WYTZVSGK.js +245 -0
- package/dist/chunk-WYTZVSGK.js.map +1 -0
- package/dist/chunk-X47QMM6K.js +187 -0
- package/dist/chunk-X47QMM6K.js.map +1 -0
- package/dist/chunk-XNBKO32Y.js +174 -0
- package/dist/chunk-XNBKO32Y.js.map +1 -0
- package/dist/chunk-YHUSW7D2.js +40 -0
- package/dist/chunk-YHUSW7D2.js.map +1 -0
- package/dist/chunk-YSKD7UXX.js +126 -0
- package/dist/chunk-YSKD7UXX.js.map +1 -0
- package/dist/chunk-YYRDGWOU.js +72 -0
- package/dist/chunk-YYRDGWOU.js.map +1 -0
- package/dist/chunk-ZIGZMWM7.js +19 -0
- package/dist/chunk-ZIGZMWM7.js.map +1 -0
- package/dist/chunk-ZKRTUKNP.js +40 -0
- package/dist/chunk-ZKRTUKNP.js.map +1 -0
- package/dist/code-block.js +38 -0
- package/dist/code-block.js.map +1 -0
- package/dist/commit.js +51 -0
- package/dist/commit.js.map +1 -0
- package/dist/composer.js +15 -0
- package/dist/composer.js.map +1 -0
- package/dist/confirmation.js +53 -0
- package/dist/confirmation.js.map +1 -0
- package/dist/connection.js +8 -0
- package/dist/connection.js.map +1 -0
- package/dist/context-panel.js +25 -0
- package/dist/context-panel.js.map +1 -0
- package/dist/controls.js +10 -0
- package/dist/controls.js.map +1 -0
- package/dist/conversation.js +19 -0
- package/dist/conversation.js.map +1 -0
- package/dist/diff-view.js +15 -0
- package/dist/diff-view.js.map +1 -0
- package/dist/edge.js +10 -0
- package/dist/edge.js.map +1 -0
- package/dist/environment-variables.js +29 -0
- package/dist/environment-variables.js.map +1 -0
- package/dist/file-tree.js +23 -0
- package/dist/file-tree.js.map +1 -0
- package/dist/gallery.js +9 -0
- package/dist/gallery.js.map +1 -0
- package/dist/grouped-parts.js +21 -0
- package/dist/grouped-parts.js.map +1 -0
- package/dist/image.js +9 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +403 -108
- package/dist/index.js +671 -13205
- package/dist/index.js.map +1 -1
- package/dist/inline-citation.js +39 -0
- package/dist/inline-citation.js.map +1 -0
- package/dist/jsx-preview.js +17 -0
- package/dist/jsx-preview.js.map +1 -0
- package/dist/markdown-view.js +17 -0
- package/dist/markdown-view.js.map +1 -0
- package/dist/message-compare.js +12 -0
- package/dist/message-compare.js.map +1 -0
- package/dist/message-edit.js +19 -0
- package/dist/message-edit.js.map +1 -0
- package/dist/message-feedback.js +11 -0
- package/dist/message-feedback.js.map +1 -0
- package/dist/message-form-spec.js +38 -0
- package/dist/message-form-spec.js.map +1 -0
- package/dist/message-form.js +26 -0
- package/dist/message-form.js.map +1 -0
- package/dist/message-table-spec.js +26 -0
- package/dist/message-table-spec.js.map +1 -0
- package/dist/message-table.js +12 -0
- package/dist/message-table.js.map +1 -0
- package/dist/message.js +51 -0
- package/dist/message.js.map +1 -0
- package/dist/mic-selector.js +27 -0
- package/dist/mic-selector.js.map +1 -0
- package/dist/model-provider-logo.js +13 -0
- package/dist/model-provider-logo.js.map +1 -0
- package/dist/motion-config.js +9 -0
- package/dist/motion-config.js.map +1 -0
- package/dist/node.js +22 -0
- package/dist/node.js.map +1 -0
- package/dist/open-in-chat.js +31 -0
- package/dist/open-in-chat.js.map +1 -0
- package/dist/package-info.js +25 -0
- package/dist/package-info.js.map +1 -0
- package/dist/panel.js +10 -0
- package/dist/panel.js.map +1 -0
- package/dist/part-groups.js +18 -0
- package/dist/part-groups.js.map +1 -0
- package/dist/permission-mode-select.js +9 -0
- package/dist/permission-mode-select.js.map +1 -0
- package/dist/persona-sources.js +8 -0
- package/dist/persona-sources.js.map +1 -0
- package/dist/persona.js +14 -0
- package/dist/persona.js.map +1 -0
- package/dist/plan.js +32 -0
- package/dist/plan.js.map +1 -0
- package/dist/prompt-input-effort.js +9 -0
- package/dist/prompt-input-effort.js.map +1 -0
- package/dist/prompt-input-mode.js +10 -0
- package/dist/prompt-input-mode.js.map +1 -0
- package/dist/prompt-input-slash.js +12 -0
- package/dist/prompt-input-slash.js.map +1 -0
- package/dist/prompt-input.js +89 -0
- package/dist/prompt-input.js.map +1 -0
- package/dist/queue.js +37 -0
- package/dist/queue.js.map +1 -0
- package/dist/reasoning.js +23 -0
- package/dist/reasoning.js.map +1 -0
- package/dist/sandbox.js +28 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/schema-display.js +33 -0
- package/dist/schema-display.js.map +1 -0
- package/dist/selection-toolbar.js +11 -0
- package/dist/selection-toolbar.js.map +1 -0
- package/dist/session-header.js +9 -0
- package/dist/session-header.js.map +1 -0
- package/dist/session-status-bar.js +9 -0
- package/dist/session-status-bar.js.map +1 -0
- package/dist/shimmer.js +9 -0
- package/dist/shimmer.js.map +1 -0
- package/dist/snippet.js +17 -0
- package/dist/snippet.js.map +1 -0
- package/dist/sources.js +17 -0
- package/dist/sources.js.map +1 -0
- package/dist/speech-input.js +9 -0
- package/dist/speech-input.js.map +1 -0
- package/dist/stack-trace.js +27 -0
- package/dist/stack-trace.js.map +1 -0
- package/dist/suggestion.js +16 -0
- package/dist/suggestion.js.map +1 -0
- package/dist/task.js +18 -0
- package/dist/task.js.map +1 -0
- package/dist/test-results.js +43 -0
- package/dist/test-results.js.map +1 -0
- package/dist/token-usage.js +27 -0
- package/dist/token-usage.js.map +1 -0
- package/dist/tool-result-card.js +9 -0
- package/dist/tool-result-card.js.map +1 -0
- package/dist/tool.js +27 -0
- package/dist/tool.js.map +1 -0
- package/dist/toolbar.js +10 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/transcription.js +11 -0
- package/dist/transcription.js.map +1 -0
- package/dist/turn-status.js +9 -0
- package/dist/turn-status.js.map +1 -0
- package/dist/use-audio-level.js +9 -0
- package/dist/use-audio-level.js.map +1 -0
- package/dist/voice-selector.js +47 -0
- package/dist/voice-selector.js.map +1 -0
- package/dist/web-preview.js +19 -0
- package/dist/web-preview.js.map +1 -0
- package/package.json +12 -10
- package/schemas/a2ui-surface.v1.schema.json +5425 -0
- package/src/__contract__/audio-visualizer.contract.test.tsx +49 -0
- package/src/__contract__/chat-shell.contract.test.tsx +49 -0
- package/src/__contract__/grouped-parts.contract.test.tsx +49 -0
- package/src/__contract__/image.contract.test.tsx +49 -0
- package/src/__contract__/markdown-view.contract.test.tsx +49 -0
- package/src/__contract__/message-feedback.contract.test.tsx +49 -0
- package/src/__contract__/message-form.contract.test.tsx +49 -0
- package/src/__contract__/message-table.contract.test.tsx +49 -0
- package/src/__contract__/model-provider-logo.contract.test.tsx +49 -0
- package/src/__contract__/persona.contract.test.tsx +49 -0
- package/src/__contract__/prompt-input-effort.contract.test.tsx +49 -0
- package/src/__contract__/prompt-input-mode.contract.test.tsx +49 -0
- package/src/_chat-shell-rail.tsx +4 -2
- package/src/_flow-boundary.tsx +2 -2
- package/src/_lazy-cjk.test.ts +43 -0
- package/src/_lazy-cjk.ts +73 -0
- package/src/_lazy-math.test.ts +63 -0
- package/src/_lazy-math.ts +90 -0
- package/src/_persona-rive.tsx +27 -41
- package/src/_streamdown-i18n.ts +73 -21
- package/src/_streamdown-safety.ts +2 -2
- package/src/_theme-scope-store.test.ts +83 -0
- package/src/_theme-scope-store.ts +103 -0
- package/src/a2ui/a2ui-surface.stories.tsx +662 -0
- package/src/a2ui/a2ui-surface.test.tsx +201 -0
- package/src/a2ui/a2ui-surface.tsx +354 -0
- package/src/a2ui/catalog.source.json +772 -0
- package/src/a2ui/core/a2ui-core.test.ts +178 -0
- package/src/a2ui/core/catalog.generated.ts +1006 -0
- package/src/a2ui/core/complete-json.ts +81 -0
- package/src/a2ui/core/index.ts +10 -0
- package/src/a2ui/core/schema.ts +111 -0
- package/src/a2ui/core/spec.ts +148 -0
- package/src/a2ui/core/validate.ts +266 -0
- package/src/a2ui/index.ts +7 -0
- package/src/a2ui/ui-catalog.tsx +225 -0
- package/src/a2ui/wave1-chart-spec.test.ts +87 -0
- package/src/a2ui/wave2-chart-spec.test.ts +108 -0
- package/src/agent-event.tsx +1 -1
- package/src/agent.tsx +18 -13
- package/src/agentic-workspace.stories.tsx +6 -45
- package/src/artifact.tsx +2 -2
- package/src/asset-preview.test.tsx +40 -0
- package/src/asset-preview.tsx +83 -12
- package/src/attachments.tsx +7 -4
- package/src/chat-shell.test.tsx +40 -10
- package/src/chat-shell.tsx +90 -44
- package/src/chat.stories.tsx +47 -42
- package/src/code-block.test.tsx +100 -1
- package/src/code-block.tsx +166 -103
- package/src/commit.tsx +30 -41
- package/src/composer.stories.tsx +4 -5
- package/src/composer.test.tsx +45 -0
- package/src/composer.tsx +104 -21
- package/src/confirmation.tsx +1 -1
- package/src/context-panel.stories.tsx +1 -1
- package/src/context-panel.tsx +2 -2
- package/src/conversation.stories.tsx +24 -0
- package/src/conversation.test.tsx +69 -0
- package/src/conversation.tsx +47 -8
- package/src/diff-view.stories.tsx +79 -0
- package/src/diff-view.test.tsx +52 -2
- package/src/diff-view.tsx +92 -36
- package/src/environment-variables.tsx +20 -37
- package/src/file-tree.test.tsx +21 -0
- package/src/file-tree.tsx +33 -16
- package/src/gallery.stories.tsx +42 -0
- package/src/gallery.tsx +2 -2
- package/src/grouped-parts.stories.tsx +23 -0
- package/src/grouped-parts.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/inline-citation.tsx +5 -5
- package/src/jsx-preview.tsx +151 -43
- package/src/markdown-view.test.tsx +7 -3
- package/src/markdown-view.tsx +8 -1
- package/src/message-compare.stories.tsx +40 -0
- package/src/message-compare.tsx +2 -1
- package/src/message-form.stories.tsx +36 -3
- package/src/message-form.test.tsx +8 -2
- package/src/message-form.tsx +16 -8
- package/src/message-table.stories.tsx +26 -2
- package/src/message-table.test.tsx +7 -0
- package/src/message-table.tsx +9 -5
- package/src/message.test.tsx +73 -3
- package/src/message.tsx +36 -12
- package/src/model-provider-logo.test.tsx +57 -3
- package/src/model-provider-logo.tsx +45 -11
- package/src/open-in-chat.tsx +50 -29
- package/src/package-info.tsx +23 -20
- package/src/prompt-input-slash.stories.tsx +1 -1
- package/src/prompt-input.test.tsx +67 -1
- package/src/prompt-input.tsx +42 -4
- package/src/queue.tsx +4 -4
- package/src/reasoning.stories.tsx +27 -0
- package/src/reasoning.tsx +17 -6
- package/src/sandbox.tsx +3 -3
- package/src/schema-display.test.tsx +56 -0
- package/src/schema-display.tsx +68 -37
- package/src/session-header.stories.tsx +35 -1
- package/src/session-header.tsx +1 -1
- package/src/snippet.test.tsx +6 -2
- package/src/snippet.tsx +14 -34
- package/src/sources.stories.tsx +30 -0
- package/src/sources.tsx +4 -1
- package/src/speech-input.test.tsx +109 -0
- package/src/speech-input.tsx +31 -3
- package/src/stack-trace.tsx +20 -36
- package/src/streamdown-i18n.test.tsx +23 -0
- package/src/templates-ai-assistant.stories.tsx +151 -87
- package/src/test-results.tsx +47 -27
- package/src/token-usage.tsx +6 -6
- package/src/tool.stories.tsx +39 -0
- package/src/tool.test.tsx +65 -0
- package/src/tool.tsx +61 -25
- package/src/toolbar.tsx +0 -10
- package/src/transcription.tsx +1 -1
- package/src/voice-selector.tsx +5 -5
- package/src/web-preview.test.tsx +51 -1
- package/src/web-preview.tsx +39 -8
- package/dist/_flow-boundary-SHNWLQG5.js.map +0 -1
- package/dist/_persona-rive-JEG44YHX.js.map +0 -1
- /package/dist/{_audio-player-media-chrome-T3XVXWRZ.js.map → _audio-player-media-chrome.js.map} +0 -0
package/dist/artifact.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
Artifact,
|
|
5
|
+
ArtifactAction,
|
|
6
|
+
ArtifactActions,
|
|
7
|
+
ArtifactClose,
|
|
8
|
+
ArtifactContent,
|
|
9
|
+
ArtifactDescription,
|
|
10
|
+
ArtifactHeader,
|
|
11
|
+
ArtifactTitle
|
|
12
|
+
} from "./chunk-DDG5JHQT.js";
|
|
13
|
+
export {
|
|
14
|
+
Artifact,
|
|
15
|
+
ArtifactAction,
|
|
16
|
+
ArtifactActions,
|
|
17
|
+
ArtifactClose,
|
|
18
|
+
ArtifactContent,
|
|
19
|
+
ArtifactDescription,
|
|
20
|
+
ArtifactHeader,
|
|
21
|
+
ArtifactTitle
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
AssetPreview
|
|
5
|
+
} from "./chunk-RB7G65JC.js";
|
|
6
|
+
import "./chunk-V4DORGWJ.js";
|
|
7
|
+
import "./chunk-NPUCMAG2.js";
|
|
8
|
+
import "./chunk-TWPHAJNM.js";
|
|
9
|
+
import "./chunk-3YPT3V7L.js";
|
|
10
|
+
import "./chunk-DDG5JHQT.js";
|
|
11
|
+
import "./chunk-PQBF6ZIQ.js";
|
|
12
|
+
import "./chunk-VLNBTOH6.js";
|
|
13
|
+
import "./chunk-PG7ERDOD.js";
|
|
14
|
+
import "./chunk-SEVN656N.js";
|
|
15
|
+
import "./chunk-DZW6LM22.js";
|
|
16
|
+
import "./chunk-3TDHPXZZ.js";
|
|
17
|
+
import "./chunk-SSKZ2AED.js";
|
|
18
|
+
import "./chunk-QUDZOTRV.js";
|
|
19
|
+
export {
|
|
20
|
+
AssetPreview
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=asset-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
Attachment,
|
|
5
|
+
AttachmentEmpty,
|
|
6
|
+
AttachmentHoverCard,
|
|
7
|
+
AttachmentHoverCardContent,
|
|
8
|
+
AttachmentHoverCardTrigger,
|
|
9
|
+
AttachmentInfo,
|
|
10
|
+
AttachmentPreview,
|
|
11
|
+
AttachmentRemove,
|
|
12
|
+
Attachments,
|
|
13
|
+
getAttachmentLabel,
|
|
14
|
+
getMediaCategory,
|
|
15
|
+
useAttachmentContext,
|
|
16
|
+
useAttachmentsContext
|
|
17
|
+
} from "./chunk-7RL6KZDF.js";
|
|
18
|
+
export {
|
|
19
|
+
Attachment,
|
|
20
|
+
AttachmentEmpty,
|
|
21
|
+
AttachmentHoverCard,
|
|
22
|
+
AttachmentHoverCardContent,
|
|
23
|
+
AttachmentHoverCardTrigger,
|
|
24
|
+
AttachmentInfo,
|
|
25
|
+
AttachmentPreview,
|
|
26
|
+
AttachmentRemove,
|
|
27
|
+
Attachments,
|
|
28
|
+
getAttachmentLabel,
|
|
29
|
+
getMediaCategory,
|
|
30
|
+
useAttachmentContext,
|
|
31
|
+
useAttachmentsContext
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=attachments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
AudioPlayer,
|
|
5
|
+
AudioPlayerControlBar,
|
|
6
|
+
AudioPlayerDurationDisplay,
|
|
7
|
+
AudioPlayerElement,
|
|
8
|
+
AudioPlayerMuteButton,
|
|
9
|
+
AudioPlayerPlayButton,
|
|
10
|
+
AudioPlayerSeekBackwardButton,
|
|
11
|
+
AudioPlayerSeekForwardButton,
|
|
12
|
+
AudioPlayerTimeDisplay,
|
|
13
|
+
AudioPlayerTimeRange,
|
|
14
|
+
AudioPlayerVolumeRange
|
|
15
|
+
} from "./chunk-NSCLRHES.js";
|
|
16
|
+
import "./chunk-S3ISPW3A.js";
|
|
17
|
+
export {
|
|
18
|
+
AudioPlayer,
|
|
19
|
+
AudioPlayerControlBar,
|
|
20
|
+
AudioPlayerDurationDisplay,
|
|
21
|
+
AudioPlayerElement,
|
|
22
|
+
AudioPlayerMuteButton,
|
|
23
|
+
AudioPlayerPlayButton,
|
|
24
|
+
AudioPlayerSeekBackwardButton,
|
|
25
|
+
AudioPlayerSeekForwardButton,
|
|
26
|
+
AudioPlayerTimeDisplay,
|
|
27
|
+
AudioPlayerTimeRange,
|
|
28
|
+
AudioPlayerVolumeRange
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=audio-player.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/canvas.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
ChainOfThought,
|
|
5
|
+
ChainOfThoughtContent,
|
|
6
|
+
ChainOfThoughtHeader,
|
|
7
|
+
ChainOfThoughtImage,
|
|
8
|
+
ChainOfThoughtSearchResult,
|
|
9
|
+
ChainOfThoughtSearchResults,
|
|
10
|
+
ChainOfThoughtStep
|
|
11
|
+
} from "./chunk-TCB6O74A.js";
|
|
12
|
+
import "./chunk-UCJ6IUFS.js";
|
|
13
|
+
export {
|
|
14
|
+
ChainOfThought,
|
|
15
|
+
ChainOfThoughtContent,
|
|
16
|
+
ChainOfThoughtHeader,
|
|
17
|
+
ChainOfThoughtImage,
|
|
18
|
+
ChainOfThoughtSearchResult,
|
|
19
|
+
ChainOfThoughtSearchResults,
|
|
20
|
+
ChainOfThoughtStep
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chain-of-thought.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/model-provider-logo.tsx
|
|
4
|
+
import { cn } from "@elabs-ai/components-ui/lib/cn";
|
|
5
|
+
import { resolveThemeIsDark } from "@elabs-ai/components-tokens";
|
|
6
|
+
import { BotIcon } from "lucide-react";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
9
|
+
function useIsDarkTheme() {
|
|
10
|
+
const [isDark, setIsDark] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (typeof document === "undefined") return;
|
|
13
|
+
const el = document.documentElement;
|
|
14
|
+
const read = () => setIsDark(resolveThemeIsDark(el));
|
|
15
|
+
read();
|
|
16
|
+
const obs = new MutationObserver(read);
|
|
17
|
+
obs.observe(el, { attributes: true, attributeFilter: ["data-theme"] });
|
|
18
|
+
return () => obs.disconnect();
|
|
19
|
+
}, []);
|
|
20
|
+
return isDark;
|
|
21
|
+
}
|
|
22
|
+
var MODEL_PROVIDER_LOGO_BASE_URL = "https://models.dev/logos";
|
|
23
|
+
var ModelProviderLogo = ({
|
|
24
|
+
provider,
|
|
25
|
+
className,
|
|
26
|
+
src,
|
|
27
|
+
fallback,
|
|
28
|
+
onError,
|
|
29
|
+
...props
|
|
30
|
+
}) => {
|
|
31
|
+
const [failed, setFailed] = useState(false);
|
|
32
|
+
const isDark = useIsDarkTheme();
|
|
33
|
+
if (failed) {
|
|
34
|
+
return /* @__PURE__ */ jsx(Fragment, { children: fallback ?? /* @__PURE__ */ jsx(BotIcon, { "aria-label": `${provider} logo`, className: cn("size-3", className), role: "img" }) });
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"img",
|
|
38
|
+
{
|
|
39
|
+
...props,
|
|
40
|
+
alt: `${provider} logo`,
|
|
41
|
+
className: cn("size-3", isDark && "invert", className),
|
|
42
|
+
height: 12,
|
|
43
|
+
onError: (event) => {
|
|
44
|
+
setFailed(true);
|
|
45
|
+
onError?.(event);
|
|
46
|
+
},
|
|
47
|
+
src: src ?? `${MODEL_PROVIDER_LOGO_BASE_URL}/${provider}.svg`,
|
|
48
|
+
width: 12
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
var ModelProviderLogoGroup = ({ className, ...props }) => {
|
|
53
|
+
const isDark = useIsDarkTheme();
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: cn(
|
|
58
|
+
"flex shrink-0 items-center -space-x-1 [&>img]:rounded-full [&>img]:p-px [&>img]:ring-1",
|
|
59
|
+
isDark ? "[&>img]:bg-foreground" : "[&>img]:bg-background",
|
|
60
|
+
className
|
|
61
|
+
),
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
MODEL_PROVIDER_LOGO_BASE_URL,
|
|
69
|
+
ModelProviderLogo,
|
|
70
|
+
ModelProviderLogoGroup
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=chunk-2XOIG5TG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/model-provider-logo.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@elabs-ai/components-ui/lib/cn\";\nimport { resolveThemeIsDark } from \"@elabs-ai/components-tokens\";\nimport { BotIcon } from \"lucide-react\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { useEffect, useState } from \"react\";\n\n/**\n * Tracks the ACTIVE theme's own `color-scheme` (`resolveThemeIsDark`), not the\n * two shipped `light`/`dark` themes — a consumer-authored dark theme still\n * gets an inverted (visible) logo with no registration step (theming.md:\n * \"Use semantic tokens, not `dark:` — `@custom-variant dark` covers only the\n * themes shipped HERE\"). Mirrors `Toaster`'s `useDocumentThemeMode`\n * (`packages/ui/src/components/sonner/sonner.tsx`).\n */\nfunction useIsDarkTheme(): boolean {\n const [isDark, setIsDark] = useState(false);\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const el = document.documentElement;\n const read = () => setIsDark(resolveThemeIsDark(el));\n read();\n const obs = new MutationObserver(read);\n obs.observe(el, { attributes: true, attributeFilter: [\"data-theme\"] });\n return () => obs.disconnect();\n }, []);\n return isDark;\n}\n\n/**\n * Where provider logos are fetched from by default.\n *\n * This is a REMOTE origin: a deployment with a restrictive `img-src` blocks it.\n * Self-host the SVGs and pass `src` (or set a `fallback`) — see\n * `docs/CSP-AND-NETWORK.md`.\n */\nexport const MODEL_PROVIDER_LOGO_BASE_URL = \"https://models.dev/logos\";\n\nexport type ModelProviderLogoProps = Omit<ComponentProps<\"img\">, \"alt\"> & {\n /**\n * Override the logo URL — point at a self-hosted or bundled asset when a CSP\n * blocks `models.dev`. Defaults to `${MODEL_PROVIDER_LOGO_BASE_URL}/<provider>.svg`.\n */\n src?: string;\n /**\n * Rendered when the logo fails to load (blocked, offline, or unknown\n * provider). Defaults to a neutral Lucide glyph, so the row never collapses\n * to a broken image.\n */\n fallback?: ReactNode;\n provider:\n | \"moonshotai-cn\"\n | \"lucidquery\"\n | \"moonshotai\"\n | \"zai-coding-plan\"\n | \"alibaba\"\n | \"xai\"\n | \"vultr\"\n | \"nvidia\"\n | \"upstage\"\n | \"groq\"\n | \"github-copilot\"\n | \"mistral\"\n | \"vercel\"\n | \"nebius\"\n | \"deepseek\"\n | \"alibaba-cn\"\n | \"google-vertex-anthropic\"\n | \"venice\"\n | \"chutes\"\n | \"cortecs\"\n | \"github-models\"\n | \"togetherai\"\n | \"azure\"\n | \"baseten\"\n | \"huggingface\"\n | \"opencode\"\n | \"fastrouter\"\n | \"google\"\n | \"google-vertex\"\n | \"cloudflare-workers-ai\"\n | \"inception\"\n | \"wandb\"\n | \"openai\"\n | \"zhipuai-coding-plan\"\n | \"perplexity\"\n | \"openrouter\"\n | \"zenmux\"\n | \"v0\"\n | \"iflowcn\"\n | \"synthetic\"\n | \"deepinfra\"\n | \"zhipuai\"\n | \"submodel\"\n | \"zai\"\n | \"inference\"\n | \"requesty\"\n | \"morph\"\n | \"lmstudio\"\n | \"anthropic\"\n | \"aihubmix\"\n | \"fireworks-ai\"\n | \"modelscope\"\n | \"llama\"\n | \"scaleway\"\n | \"amazon-bedrock\"\n | \"cerebras\"\n // oxlint-disable-next-line typescript-eslint(ban-types) -- intentional pattern for autocomplete-friendly string union\n | (string & {});\n};\n\n/**\n * The mark of an AI model provider (`anthropic`, `openai`, `google`, …), sized\n * for a row in a model list.\n *\n * **`ModelProviderLogo` vs `ServiceLogo` (`@elabs-ai/components-icons`).** An AI\n * provider mark with a zero-config remote default — name the provider and a logo\n * appears, no registration step — is this component. Any other third-party\n * service mark, resolved from a registry the app supplies and never fetched, is\n * `ServiceLogo`. The two are not interchangeable: `ServiceLogo` has no\n * per-instance `src` and no `onError`, and this one reaches a remote origin by\n * default (see `docs/CSP-AND-NETWORK.md`).\n */\nexport const ModelProviderLogo = ({\n provider,\n className,\n src,\n fallback,\n onError,\n ...props\n}: ModelProviderLogoProps) => {\n const [failed, setFailed] = useState(false);\n const isDark = useIsDarkTheme();\n\n // A blocked/missing logo must not leave a broken-image glyph in the row.\n if (failed) {\n return (\n <>\n {fallback ?? (\n <BotIcon aria-label={`${provider} logo`} className={cn(\"size-3\", className)} role=\"img\" />\n )}\n </>\n );\n }\n\n return (\n <img\n {...props}\n alt={`${provider} logo`}\n className={cn(\"size-3\", isDark && \"invert\", className)}\n height={12}\n onError={(event) => {\n setFailed(true);\n onError?.(event);\n }}\n // AFTER the spread, so the caller's `src` wins via the destructured\n // default rather than being silently overwritten.\n src={src ?? `${MODEL_PROVIDER_LOGO_BASE_URL}/${provider}.svg`}\n width={12}\n />\n );\n};\n\nexport type ModelProviderLogoGroupProps = ComponentProps<\"div\">;\n\nexport const ModelProviderLogoGroup = ({ className, ...props }: ModelProviderLogoGroupProps) => {\n // Same active-theme signal as the single logo above (not the two shipped\n // `light`/`dark` themes) — the backdrop swaps to `--foreground` so a\n // transparent-background SVG still reads against a dark chip in ANY dark\n // theme a consumer registers.\n const isDark = useIsDarkTheme();\n return (\n <div\n className={cn(\n \"flex shrink-0 items-center -space-x-1 [&>img]:rounded-full [&>img]:p-px [&>img]:ring-1\",\n isDark ? \"[&>img]:bg-foreground\" : \"[&>img]:bg-background\",\n className,\n )}\n {...props}\n />\n );\n};\n"],"mappings":";;;AAEA,SAAS,UAAU;AACnB,SAAS,0BAA0B;AACnC,SAAS,eAAe;AAExB,SAAS,WAAW,gBAAgB;AAoI9B,mBAEI,WAFJ;AA1HN,SAAS,iBAA0B;AACjC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,YAAU,MAAM;AACd,QAAI,OAAO,aAAa,YAAa;AACrC,U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
|
|
3
|
+
// src/queue.tsx
|
|
4
|
+
import { Button } from "@elabs-ai/components-ui";
|
|
5
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@elabs-ai/components-ui";
|
|
6
|
+
import { ScrollArea } from "@elabs-ai/components-ui";
|
|
7
|
+
import { cn } from "@elabs-ai/components-ui/lib/cn";
|
|
8
|
+
import { ChevronDownIcon, PaperclipIcon } from "lucide-react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var QueueItem = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
11
|
+
"li",
|
|
12
|
+
{
|
|
13
|
+
className: cn(
|
|
14
|
+
"group flex flex-col gap-1 rounded-md px-3 py-1 text-body transition-colors hover:bg-muted",
|
|
15
|
+
className
|
|
16
|
+
),
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
var QueueItemIndicator = ({
|
|
21
|
+
completed = false,
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}) => /* @__PURE__ */ jsx(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
className: cn(
|
|
28
|
+
"mt-0.5 inline-block size-2.5 rounded-full border",
|
|
29
|
+
completed ? "border-muted-foreground/20 bg-muted-foreground/10" : "border-muted-foreground/50",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
var QueueItemContent = ({
|
|
36
|
+
completed = false,
|
|
37
|
+
className,
|
|
38
|
+
...props
|
|
39
|
+
}) => /* @__PURE__ */ jsx(
|
|
40
|
+
"span",
|
|
41
|
+
{
|
|
42
|
+
className: cn(
|
|
43
|
+
"line-clamp-1 grow break-words",
|
|
44
|
+
completed ? "text-muted-foreground/50 line-through" : "text-muted-foreground",
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
var QueueItemDescription = ({
|
|
51
|
+
completed = false,
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}) => /* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: cn(
|
|
58
|
+
"ms-6 text-meta",
|
|
59
|
+
completed ? "text-muted-foreground/40 line-through" : "text-muted-foreground",
|
|
60
|
+
className
|
|
61
|
+
),
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
var QueueItemActions = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("flex gap-1", className), ...props });
|
|
66
|
+
var QueueItemAction = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
67
|
+
Button,
|
|
68
|
+
{
|
|
69
|
+
className: cn(
|
|
70
|
+
"size-auto rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-muted-foreground/10 hover:text-foreground group-hover:opacity-100",
|
|
71
|
+
className
|
|
72
|
+
),
|
|
73
|
+
size: "icon",
|
|
74
|
+
type: "button",
|
|
75
|
+
variant: "ghost",
|
|
76
|
+
...props
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
var QueueItemAttachment = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("mt-1 flex flex-wrap gap-2", className), ...props });
|
|
80
|
+
var QueueItemImage = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
81
|
+
"img",
|
|
82
|
+
{
|
|
83
|
+
alt: "",
|
|
84
|
+
className: cn("h-8 w-8 rounded border object-cover", className),
|
|
85
|
+
height: 32,
|
|
86
|
+
width: 32,
|
|
87
|
+
...props
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
var QueueItemFile = ({ children, className, ...props }) => /* @__PURE__ */ jsxs(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
className: cn("flex items-center gap-1 rounded border bg-muted px-2 py-1 text-meta", className),
|
|
94
|
+
...props,
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx(PaperclipIcon, { size: 12 }),
|
|
97
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[100px] truncate", children })
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
var QueueList = ({ children, className, ...props }) => /* @__PURE__ */ jsx(ScrollArea, { className: cn("mt-2 -mb-1", className), ...props, children: /* @__PURE__ */ jsx("div", { className: "max-h-40 pe-4", children: /* @__PURE__ */ jsx("ul", { children }) }) });
|
|
102
|
+
var QueueSection = ({ className, defaultOpen = true, ...props }) => /* @__PURE__ */ jsx(Collapsible, { className: cn(className), defaultOpen, ...props });
|
|
103
|
+
var QueueSectionTrigger = ({
|
|
104
|
+
children,
|
|
105
|
+
className,
|
|
106
|
+
...props
|
|
107
|
+
}) => /* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
className: cn(
|
|
111
|
+
"group flex w-full items-center justify-between rounded-md bg-muted/40 px-3 py-2 text-start font-medium text-muted-foreground text-body transition-colors hover:bg-muted",
|
|
112
|
+
className
|
|
113
|
+
),
|
|
114
|
+
type: "button",
|
|
115
|
+
...props,
|
|
116
|
+
children
|
|
117
|
+
}
|
|
118
|
+
) });
|
|
119
|
+
var QueueSectionLabel = ({
|
|
120
|
+
count,
|
|
121
|
+
label,
|
|
122
|
+
icon,
|
|
123
|
+
className,
|
|
124
|
+
...props
|
|
125
|
+
}) => /* @__PURE__ */ jsxs("span", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
126
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 transition-transform group-data-[state=closed]:-rotate-90" }),
|
|
127
|
+
icon,
|
|
128
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
129
|
+
count,
|
|
130
|
+
" ",
|
|
131
|
+
label
|
|
132
|
+
] })
|
|
133
|
+
] });
|
|
134
|
+
var QueueSectionContent = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
135
|
+
CollapsibleContent,
|
|
136
|
+
{
|
|
137
|
+
className: cn(
|
|
138
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:slide-in-from-top-2 data-[state=closed]:slide-out-to-top-2 data-[state=closed]:fade-out-0 data-[state=open]:[--tw-ease:var(--ease-entrance)] data-[state=closed]:[--tw-ease:var(--ease-exit)] outline-none",
|
|
139
|
+
className
|
|
140
|
+
),
|
|
141
|
+
...props
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
var Queue = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
className: cn(
|
|
148
|
+
"flex flex-col gap-2 rounded-xl border border-border bg-background px-3 pt-2 pb-2 shadow-xs",
|
|
149
|
+
className
|
|
150
|
+
),
|
|
151
|
+
...props
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
QueueItem,
|
|
157
|
+
QueueItemIndicator,
|
|
158
|
+
QueueItemContent,
|
|
159
|
+
QueueItemDescription,
|
|
160
|
+
QueueItemActions,
|
|
161
|
+
QueueItemAction,
|
|
162
|
+
QueueItemAttachment,
|
|
163
|
+
QueueItemImage,
|
|
164
|
+
QueueItemFile,
|
|
165
|
+
QueueList,
|
|
166
|
+
QueueSection,
|
|
167
|
+
QueueSectionTrigger,
|
|
168
|
+
QueueSectionLabel,
|
|
169
|
+
QueueSectionContent,
|
|
170
|
+
Queue
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=chunk-34CQ2VHM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/queue.tsx"],"sourcesContent":["\"use client\";\n\nimport { Button } from \"@elabs-ai/components-ui\";\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from \"@elabs-ai/components-ui\";\nimport { ScrollArea } from \"@elabs-ai/components-ui\";\nimport { cn } from \"@elabs-ai/components-ui/lib/cn\";\nimport { ChevronDownIcon, PaperclipIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\n\nexport interface QueueMessagePart {\n type: string;\n text?: string;\n url?: string;\n filename?: string;\n mediaType?: string;\n}\n\nexport interface QueueMessage {\n id: string;\n parts: QueueMessagePart[];\n}\n\nexport interface QueueTodo {\n id: string;\n title: string;\n description?: string;\n status?: \"pending\" | \"completed\";\n}\n\nexport type QueueItemProps = ComponentProps<\"li\">;\n\nexport const QueueItem = ({ className, ...props }: QueueItemProps) => (\n <li\n className={cn(\n \"group flex flex-col gap-1 rounded-md px-3 py-1 text-body transition-colors hover:bg-muted\",\n className,\n )}\n {...props}\n />\n);\n\nexport type QueueItemIndicatorProps = ComponentProps<\"span\"> & {\n completed?: boolean;\n};\n\nexport const QueueItemIndicator = ({\n completed = false,\n className,\n ...props\n}: QueueItemIndicatorProps) => (\n <span\n className={cn(\n \"mt-0.5 inline-block size-2.5 rounded-full border\",\n completed\n ? \"border-muted-foreground/20 bg-muted-foreground/10\"\n : \"border-muted-foreground/50\",\n className,\n )}\n {...props}\n />\n);\n\nexport type QueueItemContentProps = ComponentProps<\"span\"> & {\n completed?: boolean;\n};\n\nexport const QueueItemContent = ({\n completed = false,\n className,\n ...props\n}: QueueItemContentProps) => (\n <span\n className={cn(\n \"line-clamp-1 grow break-words\",\n completed ? \"text-muted-foreground/50 line-through\" : \"text-muted-foreground\",\n className,\n )}\n {...props}\n />\n);\n\nexport type QueueItemDescriptionProps = ComponentProps<\"div\"> & {\n completed?: boolean;\n};\n\nexport const QueueItemDescription = ({\n completed = false,\n className,\n ...props\n}: QueueItemDescriptionProps) => (\n <div\n className={cn(\n \"ms-6 text-meta\",\n completed ? \"text-muted-foreground/40 line-through\" : \"text-muted-foreground\",\n className,\n )}\n {...props}\n />\n);\n\nexport type QueueItemActionsProps = ComponentProps<\"div\">;\n\nexport const QueueItemActions = ({ className, ...props }: QueueItemActionsProps) => (\n <div className={cn(\"flex gap-1\", className)} {...props} />\n);\n\nexport type QueueItemActionProps = Omit<ComponentProps<typeof Button>, \"variant\" | \"size\">;\n\nexport const QueueItemAction = ({ className, ...props }: QueueItemActionProps) => (\n <Button\n className={cn(\n \"size-auto rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-muted-foreground/10 hover:text-foreground group-hover:opacity-100\",\n className,\n )}\n size=\"icon\"\n type=\"button\"\n variant=\"ghost\"\n {...props}\n />\n);\n\nexport type QueueItemAttachmentProps = ComponentProps<\"div\">;\n\nexport const QueueItemAttachment = ({ className, ...props }: QueueItemAttachmentProps) => (\n <div className={cn(\"mt-1 flex flex-wrap gap-2\", className)} {...props} />\n);\n\nexport type QueueItemImageProps = ComponentProps<\"img\">;\n\nexport const QueueItemImage = ({ className, ...props }: QueueItemImageProps) => (\n <img\n alt=\"\"\n className={cn(\"h-8 w-8 rounded border object-cover\", className)}\n height={32}\n width={32}\n {...props}\n />\n);\n\nexport type QueueItemFileProps = ComponentProps<\"span\">;\n\nexport const QueueItemFile = ({ children, className, ...props }: QueueItemFileProps) => (\n <span\n className={cn(\"flex items-center gap-1 rounded border bg-muted px-2 py-1 text-meta\", className)}\n {...props}\n >\n <PaperclipIcon size={12} />\n <span className=\"max-w-[100px] truncate\">{children}</span>\n </span>\n);\n\nexport type QueueListProps = ComponentProps<typeof ScrollArea>;\n\nexport const QueueList = ({ children, className, ...props }: QueueListProps) => (\n <ScrollArea className={cn(\"mt-2 -mb-1\", className)} {...props}>\n <div className=\"max-h-40 pe-4\">\n <ul>{children}</ul>\n </div>\n </ScrollArea>\n);\n\n// QueueSection - collapsible section container\nexport type QueueSectionProps = ComponentProps<typeof Collapsible>;\n\nexport const QueueSection = ({ className, defaultOpen = true, ...props }: QueueSectionProps) => (\n <Collapsible className={cn(className)} defaultOpen={defaultOpen} {...props} />\n);\n\n// QueueSectionTrigger - section header/trigger\nexport type QueueSectionTriggerProps = ComponentProps<\"button\">;\n\nexport const QueueSectionTrigger = ({\n children,\n className,\n ...props\n}: QueueSectionTriggerProps) => (\n <CollapsibleTrigger asChild>\n <button\n className={cn(\n \"group flex w-full items-center justify-between rounded-md bg-muted/40 px-3 py-2 text-start font-medium text-muted-foreground text-body transition-colors hover:bg-muted\",\n className,\n )}\n type=\"button\"\n {...props}\n >\n {children}\n </button>\n </CollapsibleTrigger>\n);\n\n// QueueSectionLabel - label content with icon and count\nexport type QueueSectionLabelProps = ComponentProps<\"span\"> & {\n count?: number;\n label: string;\n icon?: React.ReactNode;\n};\n\nexport const QueueSectionLabel = ({\n count,\n label,\n icon,\n className,\n ...props\n}: QueueSectionLabelProps) => (\n <span className={cn(\"flex items-center gap-2\", className)} {...props}>\n <ChevronDownIcon className=\"size-4 transition-transform group-data-[state=closed]:-rotate-90\" />\n {icon}\n <span>\n {count} {label}\n </span>\n </span>\n);\n\n// QueueSectionContent - collapsible content area\nexport type QueueSectionContentProps = ComponentProps<typeof CollapsibleContent>;\n\nexport const QueueSectionContent = ({ className, ...props }: QueueSectionContentProps) => (\n <CollapsibleContent\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:slide-in-from-top-2 data-[state=closed]:slide-out-to-top-2 data-[state=closed]:fade-out-0 data-[state=open]:[--tw-ease:var(--ease-entrance)] data-[state=closed]:[--tw-ease:var(--ease-exit)] outline-none\",\n className,\n )}\n {...props}\n />\n);\n\nexport type QueueProps = ComponentProps<\"div\">;\n\nexport const Queue = ({ className, ...props }: QueueProps) => (\n <div\n className={cn(\n \"flex flex-col gap-2 rounded-xl border border-border bg-background px-3 pt-2 pb-2 shadow-xs\",\n className,\n )}\n {...props}\n />\n);\n"],"mappings":";;;AAEA,SAAS,cAAc;AACvB,SAAS,aAAa,oBAAoB,0BAA0B;AACpE,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,iBAAiB,qBAAqB;AA0B7C,cA8GA,YA9GA;AADK,IAAM,YAAY,CAAC,EAAE,WAAW,GAAG,MAAM,MAC9C;AAAA,EAAC;AAA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;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN;AAKK,IAAM,QAAQ,CAAC,EAAE,WAAW,GAAG,MAAM,MAC1C;AAAA,EAAC;AAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN;","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/_theme-scope-store.ts
|
|
4
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
5
|
+
function getThemeScope(el) {
|
|
6
|
+
return el?.closest("[data-theme]") ?? (typeof document !== "undefined" ? document.documentElement : null);
|
|
7
|
+
}
|
|
8
|
+
var scopes = /* @__PURE__ */ new Map();
|
|
9
|
+
function subscribe(scope, onStoreChange) {
|
|
10
|
+
if (!scope) return () => {
|
|
11
|
+
};
|
|
12
|
+
let entry = scopes.get(scope);
|
|
13
|
+
if (!entry) {
|
|
14
|
+
const created = {
|
|
15
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
16
|
+
observer: new MutationObserver(() => {
|
|
17
|
+
created.revision += 1;
|
|
18
|
+
for (const listener of created.listeners) listener();
|
|
19
|
+
}),
|
|
20
|
+
revision: 0
|
|
21
|
+
};
|
|
22
|
+
created.observer.observe(scope, { attributeFilter: ["data-theme"], attributes: true });
|
|
23
|
+
scopes.set(scope, created);
|
|
24
|
+
entry = created;
|
|
25
|
+
}
|
|
26
|
+
entry.listeners.add(onStoreChange);
|
|
27
|
+
return () => {
|
|
28
|
+
const current = scopes.get(scope);
|
|
29
|
+
if (!current) return;
|
|
30
|
+
current.listeners.delete(onStoreChange);
|
|
31
|
+
if (current.listeners.size === 0) {
|
|
32
|
+
current.observer.disconnect();
|
|
33
|
+
scopes.delete(scope);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getSnapshot(scope) {
|
|
38
|
+
if (!scope) return 0;
|
|
39
|
+
return scopes.get(scope)?.revision ?? 0;
|
|
40
|
+
}
|
|
41
|
+
var getServerSnapshot = () => 0;
|
|
42
|
+
function useThemeScopeRevision(el) {
|
|
43
|
+
const scope = getThemeScope(el);
|
|
44
|
+
const subscribeToScope = useCallback(
|
|
45
|
+
(onStoreChange) => subscribe(scope, onStoreChange),
|
|
46
|
+
[scope]
|
|
47
|
+
);
|
|
48
|
+
const getScopeSnapshot = useCallback(() => getSnapshot(scope), [scope]);
|
|
49
|
+
return useSyncExternalStore(subscribeToScope, getScopeSnapshot, getServerSnapshot);
|
|
50
|
+
}
|
|
51
|
+
function _debugActiveThemeScopeCount() {
|
|
52
|
+
return scopes.size;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
getThemeScope,
|
|
57
|
+
useThemeScopeRevision,
|
|
58
|
+
_debugActiveThemeScopeCount
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=chunk-3TDHPXZZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/_theme-scope-store.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Shared, ref-counted `data-theme` observation (perf review §3.3).\n *\n * `code-block.tsx`'s `CodeBlockContent` and `_streamdown-i18n.ts`'s\n * `useReactiveCodePlugin` each used to instantiate their OWN\n * `MutationObserver` to notice a `data-theme` flip and re-derive the Shiki\n * theme — one observer PER rendered `CodeBlock`/`MessageResponse`/\n * `MarkdownView` instance, all typically watching the exact same ancestor. In\n * a message-dense conversation that is dozens of redundant observers doing\n * the same job.\n *\n * This module keeps exactly ONE `MutationObserver` per distinct scope\n * element (ref-counted: the observer is created on the first subscriber and\n * disconnected when the last one unsubscribes), and exposes it through\n * `useSyncExternalStore` so React's own re-render batching applies.\n */\nimport { useCallback, useSyncExternalStore } from \"react\";\n\n/**\n * Nearest ancestor (inclusive) carrying `data-theme`, defaulting to `<html>`.\n * Lets a themed surface rendered inside a region-scoped\n * `<div data-theme=\"…\">` (a supported `ThemeProvider`/decorator pattern —\n * see @.claude/rules/theming.md) resolve THAT region's tokens instead of\n * always the document root's.\n */\nexport function getThemeScope(el: Element | null): Element | null {\n return (\n el?.closest(\"[data-theme]\") ??\n (typeof document !== \"undefined\" ? document.documentElement : null)\n );\n}\n\ninterface ScopeEntry {\n observer: MutationObserver;\n revision: number;\n listeners: Set<() => void>;\n}\n\nconst scopes = new Map<Element, ScopeEntry>();\n\nfunction subscribe(scope: Element | null, onStoreChange: () => void): () => void {\n if (!scope) return () => {};\n\n let entry = scopes.get(scope);\n if (!entry) {\n // `entry` is assigned before `observer` fires, but TypeScript can't see\n // that through the closure — the callback only ever runs after this\n // function returns and `entry` has been set, and every existing\n // subscriber to this scope uses the SAME entry.\n const created: ScopeEntry = {\n listeners: new Set(),\n observer: new MutationObserver(() => {\n created.revision += 1;\n for (const listener of created.listeners) listener();\n }),\n revision: 0,\n };\n created.observer.observe(scope, { attributeFilter: [\"data-theme\"], attributes: true });\n scopes.set(scope, created);\n entry = created;\n }\n\n entry.listeners.add(onStoreChange);\n return () => {\n const current = scopes.get(scope);\n if (!current) return;\n current.listeners.delete(onStoreChange);\n if (current.listeners.size === 0) {\n current.observer.disconnect();\n scopes.delete(scope);\n }\n };\n}\n\nfunction getSnapshot(scope: Element | null): number {\n if (!scope) return 0;\n return scopes.get(scope)?.revision ?? 0;\n}\n\nconst getServerSnapshot = () => 0;\n\n/**\n * Subscribes to `data-theme` mutations on `el`'s closest `[data-theme]`\n * ancestor (default `<html>`) and returns a revision number that increments\n * on each mutation. Any number of callers scoped to the SAME ancestor share\n * one `MutationObserver`.\n */\nexport function useThemeScopeRevision(el: Element | null): number {\n const scope = getThemeScope(el);\n const subscribeToScope = useCallback(\n (onStoreChange: () => void) => subscribe(scope, onStoreChange),\n [scope],\n );\n const getScopeSnapshot = useCallback(() => getSnapshot(scope), [scope]);\n return useSyncExternalStore(subscribeToScope, getScopeSnapshot, getServerSnapshot);\n}\n\n/** Test-only: the number of scope elements currently under observation. */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