clawmini 0.0.1
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/.gemini/settings.json +46 -0
- package/.prettierrc +7 -0
- package/GEMINI.md +11 -0
- package/README.md +137 -0
- package/dist/adapter-discord/index.d.mts +5 -0
- package/dist/adapter-discord/index.d.mts.map +1 -0
- package/dist/adapter-discord/index.mjs +456 -0
- package/dist/adapter-discord/index.mjs.map +1 -0
- package/dist/chats-DKgTeU7i.mjs +91 -0
- package/dist/chats-DKgTeU7i.mjs.map +1 -0
- package/dist/chats-Zd_HXDHx.mjs +29 -0
- package/dist/chats-Zd_HXDHx.mjs.map +1 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +850 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/cli/lite.d.mts +1 -0
- package/dist/cli/lite.mjs +4434 -0
- package/dist/cli/lite.mjs.map +1 -0
- package/dist/daemon/index.d.mts +5 -0
- package/dist/daemon/index.d.mts.map +1 -0
- package/dist/daemon/index.mjs +1222 -0
- package/dist/daemon/index.mjs.map +1 -0
- package/dist/fetch-BjZVyU3Z.mjs +37 -0
- package/dist/fetch-BjZVyU3Z.mjs.map +1 -0
- package/dist/fs-B5wW0oaH.mjs +14 -0
- package/dist/fs-B5wW0oaH.mjs.map +1 -0
- package/dist/lite-Dl7WXyaH.mjs +80 -0
- package/dist/lite-Dl7WXyaH.mjs.map +1 -0
- package/dist/rolldown-runtime-95iHPtFO.mjs +18 -0
- package/dist/web/_app/env.js +1 -0
- package/dist/web/_app/immutable/assets/0.GI4C4dpV.css +1 -0
- package/dist/web/_app/immutable/chunks/B5abRDXp.js +1 -0
- package/dist/web/_app/immutable/chunks/B8yYFADm.js +1 -0
- package/dist/web/_app/immutable/chunks/BPy8HLo7.js +5 -0
- package/dist/web/_app/immutable/chunks/Bi0jeV7Q.js +1 -0
- package/dist/web/_app/immutable/chunks/BmUXQ3wy.js +2 -0
- package/dist/web/_app/immutable/chunks/C3k55nDF.js +1 -0
- package/dist/web/_app/immutable/chunks/COekwvP2.js +1 -0
- package/dist/web/_app/immutable/chunks/CSvS_NwK.js +1 -0
- package/dist/web/_app/immutable/chunks/CpaGRn9L.js +1 -0
- package/dist/web/_app/immutable/chunks/CyNaE55B.js +1 -0
- package/dist/web/_app/immutable/chunks/DG5RZBw-.js +2 -0
- package/dist/web/_app/immutable/chunks/Dc-UOHw9.js +1 -0
- package/dist/web/_app/immutable/chunks/DcrmIfTj.js +1 -0
- package/dist/web/_app/immutable/chunks/ZkLyk0mE.js +1 -0
- package/dist/web/_app/immutable/entry/app.B-vZe7PN.js +2 -0
- package/dist/web/_app/immutable/entry/start.oP1AgKhs.js +1 -0
- package/dist/web/_app/immutable/nodes/0.B5WFN0zw.js +1 -0
- package/dist/web/_app/immutable/nodes/1.D1wtJb2k.js +1 -0
- package/dist/web/_app/immutable/nodes/2.CK3CLC0f.js +1 -0
- package/dist/web/_app/immutable/nodes/3.BB5wCoBf.js +4 -0
- package/dist/web/_app/immutable/nodes/4.Dr2jvAXK.js +1 -0
- package/dist/web/_app/immutable/nodes/5.BJl7oM3b.js +1 -0
- package/dist/web/_app/version.json +1 -0
- package/dist/web/index.html +37 -0
- package/dist/web/robots.txt +3 -0
- package/dist/workspace-CSgfo_2J.mjs +383 -0
- package/dist/workspace-CSgfo_2J.mjs.map +1 -0
- package/docs/01_chats/development_log.md +36 -0
- package/docs/01_chats/notes.md +27 -0
- package/docs/01_chats/prd.md +47 -0
- package/docs/01_chats/questions.md +19 -0
- package/docs/01_chats/tickets.md +67 -0
- package/docs/02_sessions/development_log.md +79 -0
- package/docs/02_sessions/notes.md +40 -0
- package/docs/02_sessions/prd.md +75 -0
- package/docs/02_sessions/questions.md +7 -0
- package/docs/02_sessions/tickets.md +68 -0
- package/docs/03_web_interface/development_log.md +60 -0
- package/docs/03_web_interface/notes.md +29 -0
- package/docs/03_web_interface/prd.md +42 -0
- package/docs/03_web_interface/questions.md +8 -0
- package/docs/03_web_interface/tickets.md +59 -0
- package/docs/04_agents/development_log.md +54 -0
- package/docs/04_agents/notes.md +45 -0
- package/docs/04_agents/prd.md +47 -0
- package/docs/04_agents/questions.md +13 -0
- package/docs/04_agents/tickets.md +107 -0
- package/docs/05_routers/development_log.md +13 -0
- package/docs/05_routers/notes.md +40 -0
- package/docs/05_routers/prd.md +55 -0
- package/docs/05_routers/questions.md +21 -0
- package/docs/05_routers/tickets.md +109 -0
- package/docs/06_agent_templates/development_log.md +38 -0
- package/docs/06_agent_templates/notes.md +25 -0
- package/docs/06_agent_templates/prd.md +34 -0
- package/docs/06_agent_templates/questions.md +11 -0
- package/docs/06_agent_templates/tickets.md +49 -0
- package/docs/06_cron/development_log.md +51 -0
- package/docs/06_cron/notes.md +14 -0
- package/docs/06_cron/prd.md +92 -0
- package/docs/06_cron/questions.md +15 -0
- package/docs/06_cron/tickets.md +75 -0
- package/docs/07_web_chat_ux/development_log.md +30 -0
- package/docs/07_web_chat_ux/notes.md +25 -0
- package/docs/07_web_chat_ux/prd.md +46 -0
- package/docs/07_web_chat_ux/questions.md +7 -0
- package/docs/07_web_chat_ux/tickets.md +48 -0
- package/docs/08_agent_api/development_log.md +52 -0
- package/docs/08_agent_api/notes.md +31 -0
- package/docs/08_agent_api/prd.md +56 -0
- package/docs/08_agent_api/questions.md +14 -0
- package/docs/08_agent_api/tickets.md +104 -0
- package/docs/09_agent_fallbacks/development_log.md +52 -0
- package/docs/09_agent_fallbacks/notes.md +40 -0
- package/docs/09_agent_fallbacks/prd.md +55 -0
- package/docs/09_agent_fallbacks/questions.md +10 -0
- package/docs/09_agent_fallbacks/tickets.md +88 -0
- package/docs/09_discord_adapter/development_log.md +95 -0
- package/docs/09_discord_adapter/notes.md +18 -0
- package/docs/09_discord_adapter/prd.md +57 -0
- package/docs/09_discord_adapter/questions.md +16 -0
- package/docs/09_discord_adapter/tickets.md +116 -0
- package/docs/10_file_attachments/development_log.md +55 -0
- package/docs/10_file_attachments/notes.md +59 -0
- package/docs/10_file_attachments/prd.md +73 -0
- package/docs/10_file_attachments/questions.md +15 -0
- package/docs/10_file_attachments/tickets.md +88 -0
- package/docs/11_message_verbosity/development_log.md +43 -0
- package/docs/11_message_verbosity/notes.md +26 -0
- package/docs/11_message_verbosity/prd.md +44 -0
- package/docs/11_message_verbosity/questions.md +8 -0
- package/docs/11_message_verbosity/tickets.md +33 -0
- package/docs/12_environments/development_log.md +43 -0
- package/docs/12_environments/notes.md +45 -0
- package/docs/12_environments/prd.md +113 -0
- package/docs/12_environments/questions.md +17 -0
- package/docs/12_environments/tickets.md +87 -0
- package/docs/12_setup_flow_improvements/development_log.md +40 -0
- package/docs/12_setup_flow_improvements/notes.md +34 -0
- package/docs/12_setup_flow_improvements/prd.md +35 -0
- package/docs/12_setup_flow_improvements/questions.md +8 -0
- package/docs/12_setup_flow_improvements/tickets.md +122 -0
- package/docs/13_discord_typing_indicators/development_log.md +38 -0
- package/docs/13_discord_typing_indicators/notes.md +18 -0
- package/docs/13_discord_typing_indicators/prd.md +41 -0
- package/docs/13_discord_typing_indicators/questions.md +6 -0
- package/docs/13_discord_typing_indicators/tickets.md +60 -0
- package/docs/14_interruptions/development_log.md +50 -0
- package/docs/14_interruptions/notes.md +38 -0
- package/docs/14_interruptions/prd.md +46 -0
- package/docs/14_interruptions/questions.md +12 -0
- package/docs/14_interruptions/tickets.md +69 -0
- package/docs/15_sandbox_policies/development_log.md +95 -0
- package/docs/15_sandbox_policies/notes.md +33 -0
- package/docs/15_sandbox_policies/prd.md +163 -0
- package/docs/15_sandbox_policies/questions.md +10 -0
- package/docs/15_sandbox_policies/tickets.md +196 -0
- package/docs/CHECKS.md +9 -0
- package/docs/guides/discord_adapter_setup.md +69 -0
- package/docs/guides/sandbox_policies.md +76 -0
- package/eslint.config.js +47 -0
- package/napkin.md +21 -0
- package/package.json +50 -0
- package/scripts/create_worktree.sh +49 -0
- package/scripts/get_pr_comments.sh +36 -0
- package/src/adapter-discord/client.test.ts +65 -0
- package/src/adapter-discord/client.ts +41 -0
- package/src/adapter-discord/config.test.ts +156 -0
- package/src/adapter-discord/config.ts +61 -0
- package/src/adapter-discord/forwarder.test.ts +493 -0
- package/src/adapter-discord/forwarder.ts +246 -0
- package/src/adapter-discord/index.test.ts +399 -0
- package/src/adapter-discord/index.ts +147 -0
- package/src/adapter-discord/state.test.ts +65 -0
- package/src/adapter-discord/state.ts +44 -0
- package/src/cli/client.ts +46 -0
- package/src/cli/commands/agents.ts +138 -0
- package/src/cli/commands/chats.ts +79 -0
- package/src/cli/commands/down.ts +32 -0
- package/src/cli/commands/environments.ts +39 -0
- package/src/cli/commands/export-lite.ts +62 -0
- package/src/cli/commands/init.ts +79 -0
- package/src/cli/commands/jobs.ts +141 -0
- package/src/cli/commands/messages.ts +103 -0
- package/src/cli/commands/up.ts +26 -0
- package/src/cli/commands/web-api/agents.ts +138 -0
- package/src/cli/commands/web-api/chats.ts +213 -0
- package/src/cli/commands/web-api/utils.ts +27 -0
- package/src/cli/commands/web.ts +105 -0
- package/src/cli/e2e/adapter-discord.test.ts +76 -0
- package/src/cli/e2e/agents.test.ts +140 -0
- package/src/cli/e2e/basic.test.ts +43 -0
- package/src/cli/e2e/cron.test.ts +132 -0
- package/src/cli/e2e/daemon.test.ts +293 -0
- package/src/cli/e2e/environments.test.ts +66 -0
- package/src/cli/e2e/export-lite-func.test.ts +155 -0
- package/src/cli/e2e/export-lite.test.ts +51 -0
- package/src/cli/e2e/fallbacks.test.ts +169 -0
- package/src/cli/e2e/global-setup.ts +15 -0
- package/src/cli/e2e/init.test.ts +70 -0
- package/src/cli/e2e/messages.test.ts +294 -0
- package/src/cli/e2e/requests.test.ts +165 -0
- package/src/cli/e2e/utils.ts +66 -0
- package/src/cli/index.test.ts +7 -0
- package/src/cli/index.ts +29 -0
- package/src/cli/lite.ts +247 -0
- package/src/cli/utils.ts +4 -0
- package/src/daemon/auth.test.ts +50 -0
- package/src/daemon/auth.ts +69 -0
- package/src/daemon/chats.ts +26 -0
- package/src/daemon/cron.test.ts +28 -0
- package/src/daemon/cron.ts +159 -0
- package/src/daemon/events.ts +15 -0
- package/src/daemon/index.ts +212 -0
- package/src/daemon/message-agent.test.ts +132 -0
- package/src/daemon/message-extraction.test.ts +166 -0
- package/src/daemon/message-fallbacks.test.ts +313 -0
- package/src/daemon/message-interruption.test.ts +125 -0
- package/src/daemon/message-queue.test.ts +143 -0
- package/src/daemon/message-router.test.ts +106 -0
- package/src/daemon/message-session.test.ts +127 -0
- package/src/daemon/message-test-utils.ts +41 -0
- package/src/daemon/message-typing.test.ts +93 -0
- package/src/daemon/message-verbosity.test.ts +127 -0
- package/src/daemon/message.ts +600 -0
- package/src/daemon/observation.test.ts +118 -0
- package/src/daemon/policy-request-service.test.ts +87 -0
- package/src/daemon/policy-request-service.ts +62 -0
- package/src/daemon/policy-utils.test.ts +138 -0
- package/src/daemon/policy-utils.ts +152 -0
- package/src/daemon/queue.test.ts +89 -0
- package/src/daemon/queue.ts +87 -0
- package/src/daemon/request-store.test.ts +103 -0
- package/src/daemon/request-store.ts +96 -0
- package/src/daemon/router-policy-request.test.ts +99 -0
- package/src/daemon/router.test.ts +380 -0
- package/src/daemon/router.ts +510 -0
- package/src/daemon/routers/slash-command.test.ts +145 -0
- package/src/daemon/routers/slash-command.ts +58 -0
- package/src/daemon/routers/slash-interrupt.test.ts +30 -0
- package/src/daemon/routers/slash-interrupt.ts +7 -0
- package/src/daemon/routers/slash-new.test.ts +59 -0
- package/src/daemon/routers/slash-new.ts +14 -0
- package/src/daemon/routers/slash-policies.test.ts +167 -0
- package/src/daemon/routers/slash-policies.ts +131 -0
- package/src/daemon/routers/slash-stop.test.ts +30 -0
- package/src/daemon/routers/slash-stop.ts +3 -0
- package/src/daemon/routers/types.ts +10 -0
- package/src/daemon/routers/utils.ts +22 -0
- package/src/daemon/routers.test.ts +141 -0
- package/src/daemon/routers.ts +115 -0
- package/src/daemon/utils/spawn.ts +61 -0
- package/src/shared/agent-utils.ts +30 -0
- package/src/shared/chats.test.ts +112 -0
- package/src/shared/chats.ts +164 -0
- package/src/shared/config.test.ts +90 -0
- package/src/shared/config.ts +100 -0
- package/src/shared/event-source.ts +121 -0
- package/src/shared/fetch.ts +45 -0
- package/src/shared/lite.ts +129 -0
- package/src/shared/policies.ts +24 -0
- package/src/shared/utils/env.ts +27 -0
- package/src/shared/utils/fs.ts +13 -0
- package/src/shared/workspace.test.ts +345 -0
- package/src/shared/workspace.ts +500 -0
- package/templates/environments/cladding/env.json +7 -0
- package/templates/environments/macos/env.json +8 -0
- package/templates/environments/macos/sandbox.sb +21 -0
- package/templates/environments/macos-proxy/allowlist.txt +1 -0
- package/templates/environments/macos-proxy/env.json +14 -0
- package/templates/environments/macos-proxy/proxy.mjs +86 -0
- package/templates/environments/macos-proxy/sandbox.sb +34 -0
- package/templates/gemini/settings.json +11 -0
- package/templates/gemini-claw/.gemini/hooks/clawmini-logging.sh +17 -0
- package/templates/gemini-claw/.gemini/settings.json +24 -0
- package/templates/gemini-claw/.gemini/skills/clawmini-jobs/SKILL.md +40 -0
- package/templates/gemini-claw/.gemini/system.md +98 -0
- package/templates/gemini-claw/BOOTSTRAP.md +54 -0
- package/templates/gemini-claw/GEMINI.md +107 -0
- package/templates/gemini-claw/HEARTBEAT.md +3 -0
- package/templates/gemini-claw/MEMORY.md +2 -0
- package/templates/gemini-claw/SOUL.md +42 -0
- package/templates/gemini-claw/TOOLS.md +38 -0
- package/templates/gemini-claw/USER.md +15 -0
- package/templates/gemini-claw/memory/.gitkeep +0 -0
- package/templates/gemini-claw/settings.json +24 -0
- package/templates/opencode/settings.json +11 -0
- package/tsconfig.json +42 -0
- package/tsdown.config.ts +19 -0
- package/vitest.config.ts +9 -0
- package/web/.svelte-kit/ambient.d.ts +382 -0
- package/web/.svelte-kit/generated/client/app.js +35 -0
- package/web/.svelte-kit/generated/client/matchers.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/0.js +3 -0
- package/web/.svelte-kit/generated/client/nodes/1.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/2.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/3.js +1 -0
- package/web/.svelte-kit/generated/client/nodes/4.js +3 -0
- package/web/.svelte-kit/generated/client/nodes/5.js +3 -0
- package/web/.svelte-kit/generated/client-optimized/app.js +35 -0
- package/web/.svelte-kit/generated/client-optimized/matchers.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/0.js +3 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/1.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/2.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/3.js +1 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/4.js +3 -0
- package/web/.svelte-kit/generated/client-optimized/nodes/5.js +3 -0
- package/web/.svelte-kit/generated/root.js +3 -0
- package/web/.svelte-kit/generated/root.svelte +68 -0
- package/web/.svelte-kit/generated/server/internal.js +53 -0
- package/web/.svelte-kit/non-ambient.d.ts +46 -0
- package/web/.svelte-kit/output/client/.vite/manifest.json +251 -0
- package/web/.svelte-kit/output/client/_app/immutable/assets/0.GI4C4dpV.css +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/B5abRDXp.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/B8yYFADm.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BPy8HLo7.js +5 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Bi0jeV7Q.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BmUXQ3wy.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/C3k55nDF.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/COekwvP2.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CSvS_NwK.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CpaGRn9L.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CyNaE55B.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DG5RZBw-.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Dc-UOHw9.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DcrmIfTj.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/ZkLyk0mE.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/entry/app.B-vZe7PN.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.oP1AgKhs.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/0.B5WFN0zw.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.D1wtJb2k.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/2.CK3CLC0f.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/3.BB5wCoBf.js +4 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.Dr2jvAXK.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/5.BJl7oM3b.js +1 -0
- package/web/.svelte-kit/output/client/_app/version.json +1 -0
- package/web/.svelte-kit/output/client/robots.txt +3 -0
- package/web/.svelte-kit/output/prerendered/dependencies/_app/env.js +1 -0
- package/web/.svelte-kit/output/server/.vite/manifest.json +215 -0
- package/web/.svelte-kit/output/server/_app/immutable/assets/_layout.GI4C4dpV.css +1 -0
- package/web/.svelte-kit/output/server/chunks/Icon.js +153 -0
- package/web/.svelte-kit/output/server/chunks/bot.js +2753 -0
- package/web/.svelte-kit/output/server/chunks/client.js +47 -0
- package/web/.svelte-kit/output/server/chunks/environment.js +34 -0
- package/web/.svelte-kit/output/server/chunks/exports.js +231 -0
- package/web/.svelte-kit/output/server/chunks/false.js +4 -0
- package/web/.svelte-kit/output/server/chunks/index-server.js +20 -0
- package/web/.svelte-kit/output/server/chunks/index.js +24 -0
- package/web/.svelte-kit/output/server/chunks/internal.js +133 -0
- package/web/.svelte-kit/output/server/chunks/plus.js +81 -0
- package/web/.svelte-kit/output/server/chunks/root.js +4076 -0
- package/web/.svelte-kit/output/server/chunks/shared.js +789 -0
- package/web/.svelte-kit/output/server/chunks/utils.js +43 -0
- package/web/.svelte-kit/output/server/entries/fallbacks/error.svelte.js +11 -0
- package/web/.svelte-kit/output/server/entries/pages/_layout.svelte.js +3944 -0
- package/web/.svelte-kit/output/server/entries/pages/_layout.ts.js +28 -0
- package/web/.svelte-kit/output/server/entries/pages/_page.svelte.js +7 -0
- package/web/.svelte-kit/output/server/entries/pages/agents/_page.svelte.js +379 -0
- package/web/.svelte-kit/output/server/entries/pages/chats/_id_/_page.svelte.js +292 -0
- package/web/.svelte-kit/output/server/entries/pages/chats/_id_/_page.ts.js +17 -0
- package/web/.svelte-kit/output/server/entries/pages/chats/_id_/settings/_page.svelte.js +259 -0
- package/web/.svelte-kit/output/server/entries/pages/chats/_id_/settings/_page.ts.js +17 -0
- package/web/.svelte-kit/output/server/index.js +3748 -0
- package/web/.svelte-kit/output/server/internal.js +14 -0
- package/web/.svelte-kit/output/server/manifest-full.js +63 -0
- package/web/.svelte-kit/output/server/manifest.js +63 -0
- package/web/.svelte-kit/output/server/nodes/0.js +13 -0
- package/web/.svelte-kit/output/server/nodes/1.js +8 -0
- package/web/.svelte-kit/output/server/nodes/2.js +8 -0
- package/web/.svelte-kit/output/server/nodes/3.js +8 -0
- package/web/.svelte-kit/output/server/nodes/4.js +13 -0
- package/web/.svelte-kit/output/server/nodes/5.js +13 -0
- package/web/.svelte-kit/output/server/remote-entry.js +557 -0
- package/web/.svelte-kit/tsconfig.json +67 -0
- package/web/.svelte-kit/types/route_meta_data.json +17 -0
- package/web/.svelte-kit/types/src/routes/$types.d.ts +26 -0
- package/web/.svelte-kit/types/src/routes/agents/$types.d.ts +18 -0
- package/web/.svelte-kit/types/src/routes/chats/[id]/$types.d.ts +21 -0
- package/web/.svelte-kit/types/src/routes/chats/[id]/proxy+page.ts +20 -0
- package/web/.svelte-kit/types/src/routes/chats/[id]/settings/$types.d.ts +21 -0
- package/web/.svelte-kit/types/src/routes/chats/[id]/settings/proxy+page.ts +19 -0
- package/web/.svelte-kit/types/src/routes/proxy+layout.ts +35 -0
- package/web/README.md +42 -0
- package/web/components.json +16 -0
- package/web/package.json +41 -0
- package/web/src/app.css +121 -0
- package/web/src/app.d.ts +13 -0
- package/web/src/app.html +11 -0
- package/web/src/demo.spec.ts +7 -0
- package/web/src/lib/app-state.svelte.ts +3 -0
- package/web/src/lib/assets/favicon.svg +1 -0
- package/web/src/lib/components/app/app-sidebar-test-wrapper.svelte +10 -0
- package/web/src/lib/components/app/app-sidebar.svelte +171 -0
- package/web/src/lib/components/app/app-sidebar.svelte.spec.ts +13 -0
- package/web/src/lib/components/ui/button/button.svelte +82 -0
- package/web/src/lib/components/ui/button/index.ts +17 -0
- package/web/src/lib/components/ui/dialog/dialog-close.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog-content.svelte +45 -0
- package/web/src/lib/components/ui/dialog/dialog-description.svelte +17 -0
- package/web/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-overlay.svelte +20 -0
- package/web/src/lib/components/ui/dialog/dialog-portal.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog-title.svelte +17 -0
- package/web/src/lib/components/ui/dialog/dialog-trigger.svelte +7 -0
- package/web/src/lib/components/ui/dialog/dialog.svelte +7 -0
- package/web/src/lib/components/ui/dialog/index.ts +34 -0
- package/web/src/lib/components/ui/input/index.ts +7 -0
- package/web/src/lib/components/ui/input/input.svelte +52 -0
- package/web/src/lib/components/ui/separator/index.ts +7 -0
- package/web/src/lib/components/ui/separator/separator.svelte +21 -0
- package/web/src/lib/components/ui/sheet/index.ts +34 -0
- package/web/src/lib/components/ui/sheet/sheet-close.svelte +7 -0
- package/web/src/lib/components/ui/sheet/sheet-content.svelte +60 -0
- package/web/src/lib/components/ui/sheet/sheet-description.svelte +17 -0
- package/web/src/lib/components/ui/sheet/sheet-footer.svelte +20 -0
- package/web/src/lib/components/ui/sheet/sheet-header.svelte +20 -0
- package/web/src/lib/components/ui/sheet/sheet-overlay.svelte +20 -0
- package/web/src/lib/components/ui/sheet/sheet-portal.svelte +7 -0
- package/web/src/lib/components/ui/sheet/sheet-title.svelte +17 -0
- package/web/src/lib/components/ui/sheet/sheet-trigger.svelte +7 -0
- package/web/src/lib/components/ui/sheet/sheet.svelte +7 -0
- package/web/src/lib/components/ui/sidebar/constants.ts +6 -0
- package/web/src/lib/components/ui/sidebar/context.svelte.ts +79 -0
- package/web/src/lib/components/ui/sidebar/index.ts +75 -0
- package/web/src/lib/components/ui/sidebar/sidebar-content.svelte +24 -0
- package/web/src/lib/components/ui/sidebar/sidebar-footer.svelte +21 -0
- package/web/src/lib/components/ui/sidebar/sidebar-group-action.svelte +36 -0
- package/web/src/lib/components/ui/sidebar/sidebar-group-content.svelte +21 -0
- package/web/src/lib/components/ui/sidebar/sidebar-group-label.svelte +34 -0
- package/web/src/lib/components/ui/sidebar/sidebar-group.svelte +21 -0
- package/web/src/lib/components/ui/sidebar/sidebar-header.svelte +21 -0
- package/web/src/lib/components/ui/sidebar/sidebar-input.svelte +21 -0
- package/web/src/lib/components/ui/sidebar/sidebar-inset.svelte +24 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu-action.svelte +43 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu-badge.svelte +29 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu-button.svelte +103 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu-item.svelte +21 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu-skeleton.svelte +36 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu-sub-button.svelte +43 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu-sub-item.svelte +21 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu-sub.svelte +25 -0
- package/web/src/lib/components/ui/sidebar/sidebar-menu.svelte +21 -0
- package/web/src/lib/components/ui/sidebar/sidebar-provider.svelte +53 -0
- package/web/src/lib/components/ui/sidebar/sidebar-rail.svelte +36 -0
- package/web/src/lib/components/ui/sidebar/sidebar-separator.svelte +19 -0
- package/web/src/lib/components/ui/sidebar/sidebar-trigger.svelte +35 -0
- package/web/src/lib/components/ui/sidebar/sidebar.svelte +104 -0
- package/web/src/lib/components/ui/skeleton/index.ts +7 -0
- package/web/src/lib/components/ui/skeleton/skeleton.svelte +17 -0
- package/web/src/lib/components/ui/switch/index.ts +7 -0
- package/web/src/lib/components/ui/switch/switch.svelte +29 -0
- package/web/src/lib/components/ui/textarea/index.ts +7 -0
- package/web/src/lib/components/ui/textarea/textarea.svelte +23 -0
- package/web/src/lib/components/ui/tooltip/index.ts +19 -0
- package/web/src/lib/components/ui/tooltip/tooltip-content.svelte +52 -0
- package/web/src/lib/components/ui/tooltip/tooltip-portal.svelte +7 -0
- package/web/src/lib/components/ui/tooltip/tooltip-provider.svelte +7 -0
- package/web/src/lib/components/ui/tooltip/tooltip-trigger.svelte +7 -0
- package/web/src/lib/components/ui/tooltip/tooltip.svelte +7 -0
- package/web/src/lib/hooks/is-mobile.svelte.ts +9 -0
- package/web/src/lib/index.ts +1 -0
- package/web/src/lib/types.ts +23 -0
- package/web/src/lib/utils.ts +13 -0
- package/web/src/routes/+layout.svelte +67 -0
- package/web/src/routes/+layout.ts +34 -0
- package/web/src/routes/+page.svelte +7 -0
- package/web/src/routes/agents/+page.svelte +206 -0
- package/web/src/routes/chats/[id]/+page.svelte +406 -0
- package/web/src/routes/chats/[id]/+page.ts +19 -0
- package/web/src/routes/chats/[id]/page.svelte.spec.ts +102 -0
- package/web/src/routes/chats/[id]/settings/+page.svelte +165 -0
- package/web/src/routes/chats/[id]/settings/+page.ts +18 -0
- package/web/src/routes/page.svelte.spec.ts +13 -0
- package/web/static/robots.txt +3 -0
- package/web/svelte.config.js +21 -0
- package/web/tsconfig.json +20 -0
- package/web/vite.config.ts +41 -0
|
@@ -0,0 +1,2753 @@
|
|
|
1
|
+
import { A as ATTACHMENT_KEY, d as derived, n as hasContext, g as getContext, s as setContext, q as run, p as props_id, a as attributes, b as bind_props, t as getAllContexts, o as on, f as spread_props, c as clsx$1, m as ensure_array_like, u as element, k as sanitize_props, l as slot } from "./root.js";
|
|
2
|
+
import { c as cn, I as Icon$1 } from "./Icon.js";
|
|
3
|
+
import { t as tick, m as mount, u as unmount } from "./index-server.js";
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { tabbable, focusable, isFocusable } from "tabbable";
|
|
6
|
+
import parse from "style-to-object";
|
|
7
|
+
function createAttachmentKey() {
|
|
8
|
+
return Symbol(ATTACHMENT_KEY);
|
|
9
|
+
}
|
|
10
|
+
const SvelteMap = globalThis.Map;
|
|
11
|
+
class MediaQuery {
|
|
12
|
+
current;
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} query
|
|
15
|
+
* @param {boolean} [matches]
|
|
16
|
+
*/
|
|
17
|
+
constructor(query, matches = false) {
|
|
18
|
+
this.current = matches;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function createSubscriber(_) {
|
|
22
|
+
return () => {
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function isObject(value) {
|
|
26
|
+
return value !== null && typeof value === "object";
|
|
27
|
+
}
|
|
28
|
+
const CLASS_VALUE_PRIMITIVE_TYPES = ["string", "number", "bigint", "boolean"];
|
|
29
|
+
function isClassValue(value) {
|
|
30
|
+
if (value === null || value === void 0)
|
|
31
|
+
return true;
|
|
32
|
+
if (CLASS_VALUE_PRIMITIVE_TYPES.includes(typeof value))
|
|
33
|
+
return true;
|
|
34
|
+
if (Array.isArray(value))
|
|
35
|
+
return value.every((item) => isClassValue(item));
|
|
36
|
+
if (typeof value === "object") {
|
|
37
|
+
if (Object.getPrototypeOf(value) !== Object.prototype)
|
|
38
|
+
return false;
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const BoxSymbol = /* @__PURE__ */ Symbol("box");
|
|
44
|
+
const isWritableSymbol = /* @__PURE__ */ Symbol("is-writable");
|
|
45
|
+
function boxWith(getter, setter) {
|
|
46
|
+
const derived$1 = derived(getter);
|
|
47
|
+
if (setter) {
|
|
48
|
+
return {
|
|
49
|
+
[BoxSymbol]: true,
|
|
50
|
+
[isWritableSymbol]: true,
|
|
51
|
+
get current() {
|
|
52
|
+
return derived$1();
|
|
53
|
+
},
|
|
54
|
+
set current(v) {
|
|
55
|
+
setter(v);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
[BoxSymbol]: true,
|
|
61
|
+
get current() {
|
|
62
|
+
return getter();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function isBox(value) {
|
|
67
|
+
return isObject(value) && BoxSymbol in value;
|
|
68
|
+
}
|
|
69
|
+
function simpleBox(initialValue) {
|
|
70
|
+
let current = initialValue;
|
|
71
|
+
return {
|
|
72
|
+
[BoxSymbol]: true,
|
|
73
|
+
[isWritableSymbol]: true,
|
|
74
|
+
get current() {
|
|
75
|
+
return current;
|
|
76
|
+
},
|
|
77
|
+
set current(v) {
|
|
78
|
+
current = v;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function composeHandlers(...handlers) {
|
|
83
|
+
return function(e) {
|
|
84
|
+
for (const handler of handlers) {
|
|
85
|
+
if (!handler)
|
|
86
|
+
continue;
|
|
87
|
+
if (e.defaultPrevented)
|
|
88
|
+
return;
|
|
89
|
+
if (typeof handler === "function") {
|
|
90
|
+
handler.call(this, e);
|
|
91
|
+
} else {
|
|
92
|
+
handler.current?.call(this, e);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const NUMBER_CHAR_RE = /\d/;
|
|
98
|
+
const STR_SPLITTERS = ["-", "_", "/", "."];
|
|
99
|
+
function isUppercase(char = "") {
|
|
100
|
+
if (NUMBER_CHAR_RE.test(char))
|
|
101
|
+
return void 0;
|
|
102
|
+
return char !== char.toLowerCase();
|
|
103
|
+
}
|
|
104
|
+
function splitByCase(str) {
|
|
105
|
+
const parts = [];
|
|
106
|
+
let buff = "";
|
|
107
|
+
let previousUpper;
|
|
108
|
+
let previousSplitter;
|
|
109
|
+
for (const char of str) {
|
|
110
|
+
const isSplitter = STR_SPLITTERS.includes(char);
|
|
111
|
+
if (isSplitter === true) {
|
|
112
|
+
parts.push(buff);
|
|
113
|
+
buff = "";
|
|
114
|
+
previousUpper = void 0;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const isUpper = isUppercase(char);
|
|
118
|
+
if (previousSplitter === false) {
|
|
119
|
+
if (previousUpper === false && isUpper === true) {
|
|
120
|
+
parts.push(buff);
|
|
121
|
+
buff = char;
|
|
122
|
+
previousUpper = isUpper;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
|
126
|
+
const lastChar = buff.at(-1);
|
|
127
|
+
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
|
128
|
+
buff = lastChar + char;
|
|
129
|
+
previousUpper = isUpper;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
buff += char;
|
|
134
|
+
previousUpper = isUpper;
|
|
135
|
+
previousSplitter = isSplitter;
|
|
136
|
+
}
|
|
137
|
+
parts.push(buff);
|
|
138
|
+
return parts;
|
|
139
|
+
}
|
|
140
|
+
function pascalCase(str) {
|
|
141
|
+
if (!str)
|
|
142
|
+
return "";
|
|
143
|
+
return splitByCase(str).map((p) => upperFirst(p)).join("");
|
|
144
|
+
}
|
|
145
|
+
function camelCase(str) {
|
|
146
|
+
return lowerFirst(pascalCase(str || ""));
|
|
147
|
+
}
|
|
148
|
+
function upperFirst(str) {
|
|
149
|
+
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
|
150
|
+
}
|
|
151
|
+
function lowerFirst(str) {
|
|
152
|
+
return str ? str[0].toLowerCase() + str.slice(1) : "";
|
|
153
|
+
}
|
|
154
|
+
function cssToStyleObj(css) {
|
|
155
|
+
if (!css)
|
|
156
|
+
return {};
|
|
157
|
+
const styleObj = {};
|
|
158
|
+
function iterator(name, value) {
|
|
159
|
+
if (name.startsWith("-moz-") || name.startsWith("-webkit-") || name.startsWith("-ms-") || name.startsWith("-o-")) {
|
|
160
|
+
styleObj[pascalCase(name)] = value;
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (name.startsWith("--")) {
|
|
164
|
+
styleObj[name] = value;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
styleObj[camelCase(name)] = value;
|
|
168
|
+
}
|
|
169
|
+
parse(css, iterator);
|
|
170
|
+
return styleObj;
|
|
171
|
+
}
|
|
172
|
+
function executeCallbacks(...callbacks) {
|
|
173
|
+
return (...args) => {
|
|
174
|
+
for (const callback of callbacks) {
|
|
175
|
+
if (typeof callback === "function") {
|
|
176
|
+
callback(...args);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function createParser(matcher, replacer) {
|
|
182
|
+
const regex = RegExp(matcher, "g");
|
|
183
|
+
return (str) => {
|
|
184
|
+
if (typeof str !== "string") {
|
|
185
|
+
throw new TypeError(`expected an argument of type string, but got ${typeof str}`);
|
|
186
|
+
}
|
|
187
|
+
if (!str.match(regex))
|
|
188
|
+
return str;
|
|
189
|
+
return str.replace(regex, replacer);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const camelToKebab = createParser(/[A-Z]/, (match) => `-${match.toLowerCase()}`);
|
|
193
|
+
function styleToCSS(styleObj) {
|
|
194
|
+
if (!styleObj || typeof styleObj !== "object" || Array.isArray(styleObj)) {
|
|
195
|
+
throw new TypeError(`expected an argument of type object, but got ${typeof styleObj}`);
|
|
196
|
+
}
|
|
197
|
+
return Object.keys(styleObj).map((property) => `${camelToKebab(property)}: ${styleObj[property]};`).join("\n");
|
|
198
|
+
}
|
|
199
|
+
function styleToString(style = {}) {
|
|
200
|
+
return styleToCSS(style).replace("\n", " ");
|
|
201
|
+
}
|
|
202
|
+
const EVENT_LIST = [
|
|
203
|
+
"onabort",
|
|
204
|
+
"onanimationcancel",
|
|
205
|
+
"onanimationend",
|
|
206
|
+
"onanimationiteration",
|
|
207
|
+
"onanimationstart",
|
|
208
|
+
"onauxclick",
|
|
209
|
+
"onbeforeinput",
|
|
210
|
+
"onbeforetoggle",
|
|
211
|
+
"onblur",
|
|
212
|
+
"oncancel",
|
|
213
|
+
"oncanplay",
|
|
214
|
+
"oncanplaythrough",
|
|
215
|
+
"onchange",
|
|
216
|
+
"onclick",
|
|
217
|
+
"onclose",
|
|
218
|
+
"oncompositionend",
|
|
219
|
+
"oncompositionstart",
|
|
220
|
+
"oncompositionupdate",
|
|
221
|
+
"oncontextlost",
|
|
222
|
+
"oncontextmenu",
|
|
223
|
+
"oncontextrestored",
|
|
224
|
+
"oncopy",
|
|
225
|
+
"oncuechange",
|
|
226
|
+
"oncut",
|
|
227
|
+
"ondblclick",
|
|
228
|
+
"ondrag",
|
|
229
|
+
"ondragend",
|
|
230
|
+
"ondragenter",
|
|
231
|
+
"ondragleave",
|
|
232
|
+
"ondragover",
|
|
233
|
+
"ondragstart",
|
|
234
|
+
"ondrop",
|
|
235
|
+
"ondurationchange",
|
|
236
|
+
"onemptied",
|
|
237
|
+
"onended",
|
|
238
|
+
"onerror",
|
|
239
|
+
"onfocus",
|
|
240
|
+
"onfocusin",
|
|
241
|
+
"onfocusout",
|
|
242
|
+
"onformdata",
|
|
243
|
+
"ongotpointercapture",
|
|
244
|
+
"oninput",
|
|
245
|
+
"oninvalid",
|
|
246
|
+
"onkeydown",
|
|
247
|
+
"onkeypress",
|
|
248
|
+
"onkeyup",
|
|
249
|
+
"onload",
|
|
250
|
+
"onloadeddata",
|
|
251
|
+
"onloadedmetadata",
|
|
252
|
+
"onloadstart",
|
|
253
|
+
"onlostpointercapture",
|
|
254
|
+
"onmousedown",
|
|
255
|
+
"onmouseenter",
|
|
256
|
+
"onmouseleave",
|
|
257
|
+
"onmousemove",
|
|
258
|
+
"onmouseout",
|
|
259
|
+
"onmouseover",
|
|
260
|
+
"onmouseup",
|
|
261
|
+
"onpaste",
|
|
262
|
+
"onpause",
|
|
263
|
+
"onplay",
|
|
264
|
+
"onplaying",
|
|
265
|
+
"onpointercancel",
|
|
266
|
+
"onpointerdown",
|
|
267
|
+
"onpointerenter",
|
|
268
|
+
"onpointerleave",
|
|
269
|
+
"onpointermove",
|
|
270
|
+
"onpointerout",
|
|
271
|
+
"onpointerover",
|
|
272
|
+
"onpointerup",
|
|
273
|
+
"onprogress",
|
|
274
|
+
"onratechange",
|
|
275
|
+
"onreset",
|
|
276
|
+
"onresize",
|
|
277
|
+
"onscroll",
|
|
278
|
+
"onscrollend",
|
|
279
|
+
"onsecuritypolicyviolation",
|
|
280
|
+
"onseeked",
|
|
281
|
+
"onseeking",
|
|
282
|
+
"onselect",
|
|
283
|
+
"onselectionchange",
|
|
284
|
+
"onselectstart",
|
|
285
|
+
"onslotchange",
|
|
286
|
+
"onstalled",
|
|
287
|
+
"onsubmit",
|
|
288
|
+
"onsuspend",
|
|
289
|
+
"ontimeupdate",
|
|
290
|
+
"ontoggle",
|
|
291
|
+
"ontouchcancel",
|
|
292
|
+
"ontouchend",
|
|
293
|
+
"ontouchmove",
|
|
294
|
+
"ontouchstart",
|
|
295
|
+
"ontransitioncancel",
|
|
296
|
+
"ontransitionend",
|
|
297
|
+
"ontransitionrun",
|
|
298
|
+
"ontransitionstart",
|
|
299
|
+
"onvolumechange",
|
|
300
|
+
"onwaiting",
|
|
301
|
+
"onwebkitanimationend",
|
|
302
|
+
"onwebkitanimationiteration",
|
|
303
|
+
"onwebkitanimationstart",
|
|
304
|
+
"onwebkittransitionend",
|
|
305
|
+
"onwheel"
|
|
306
|
+
];
|
|
307
|
+
const EVENT_LIST_SET = new Set(EVENT_LIST);
|
|
308
|
+
function isEventHandler(key) {
|
|
309
|
+
return EVENT_LIST_SET.has(key);
|
|
310
|
+
}
|
|
311
|
+
function mergeProps(...args) {
|
|
312
|
+
const result = { ...args[0] };
|
|
313
|
+
for (let i = 1; i < args.length; i++) {
|
|
314
|
+
const props = args[i];
|
|
315
|
+
if (!props)
|
|
316
|
+
continue;
|
|
317
|
+
for (const key of Object.keys(props)) {
|
|
318
|
+
const a = result[key];
|
|
319
|
+
const b = props[key];
|
|
320
|
+
const aIsFunction = typeof a === "function";
|
|
321
|
+
const bIsFunction = typeof b === "function";
|
|
322
|
+
if (aIsFunction && typeof bIsFunction && isEventHandler(key)) {
|
|
323
|
+
const aHandler = a;
|
|
324
|
+
const bHandler = b;
|
|
325
|
+
result[key] = composeHandlers(aHandler, bHandler);
|
|
326
|
+
} else if (aIsFunction && bIsFunction) {
|
|
327
|
+
result[key] = executeCallbacks(a, b);
|
|
328
|
+
} else if (key === "class") {
|
|
329
|
+
const aIsClassValue = isClassValue(a);
|
|
330
|
+
const bIsClassValue = isClassValue(b);
|
|
331
|
+
if (aIsClassValue && bIsClassValue) {
|
|
332
|
+
result[key] = clsx(a, b);
|
|
333
|
+
} else if (aIsClassValue) {
|
|
334
|
+
result[key] = clsx(a);
|
|
335
|
+
} else if (bIsClassValue) {
|
|
336
|
+
result[key] = clsx(b);
|
|
337
|
+
}
|
|
338
|
+
} else if (key === "style") {
|
|
339
|
+
const aIsObject = typeof a === "object";
|
|
340
|
+
const bIsObject = typeof b === "object";
|
|
341
|
+
const aIsString = typeof a === "string";
|
|
342
|
+
const bIsString = typeof b === "string";
|
|
343
|
+
if (aIsObject && bIsObject) {
|
|
344
|
+
result[key] = { ...a, ...b };
|
|
345
|
+
} else if (aIsObject && bIsString) {
|
|
346
|
+
const parsedStyle = cssToStyleObj(b);
|
|
347
|
+
result[key] = { ...a, ...parsedStyle };
|
|
348
|
+
} else if (aIsString && bIsObject) {
|
|
349
|
+
const parsedStyle = cssToStyleObj(a);
|
|
350
|
+
result[key] = { ...parsedStyle, ...b };
|
|
351
|
+
} else if (aIsString && bIsString) {
|
|
352
|
+
const parsedStyleA = cssToStyleObj(a);
|
|
353
|
+
const parsedStyleB = cssToStyleObj(b);
|
|
354
|
+
result[key] = { ...parsedStyleA, ...parsedStyleB };
|
|
355
|
+
} else if (aIsObject) {
|
|
356
|
+
result[key] = a;
|
|
357
|
+
} else if (bIsObject) {
|
|
358
|
+
result[key] = b;
|
|
359
|
+
} else if (aIsString) {
|
|
360
|
+
result[key] = a;
|
|
361
|
+
} else if (bIsString) {
|
|
362
|
+
result[key] = b;
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
result[key] = b !== void 0 ? b : a;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
for (const key of Object.getOwnPropertySymbols(props)) {
|
|
369
|
+
const a = result[key];
|
|
370
|
+
const b = props[key];
|
|
371
|
+
result[key] = b !== void 0 ? b : a;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (typeof result.style === "object") {
|
|
375
|
+
result.style = styleToString(result.style).replaceAll("\n", " ");
|
|
376
|
+
}
|
|
377
|
+
if (result.hidden === false) {
|
|
378
|
+
result.hidden = void 0;
|
|
379
|
+
delete result.hidden;
|
|
380
|
+
}
|
|
381
|
+
if (result.disabled === false) {
|
|
382
|
+
result.disabled = void 0;
|
|
383
|
+
delete result.disabled;
|
|
384
|
+
}
|
|
385
|
+
return result;
|
|
386
|
+
}
|
|
387
|
+
const defaultWindow = void 0;
|
|
388
|
+
function getActiveElement$1(document2) {
|
|
389
|
+
let activeElement = document2.activeElement;
|
|
390
|
+
while (activeElement?.shadowRoot) {
|
|
391
|
+
const node = activeElement.shadowRoot.activeElement;
|
|
392
|
+
if (node === activeElement)
|
|
393
|
+
break;
|
|
394
|
+
else
|
|
395
|
+
activeElement = node;
|
|
396
|
+
}
|
|
397
|
+
return activeElement;
|
|
398
|
+
}
|
|
399
|
+
class ActiveElement {
|
|
400
|
+
#document;
|
|
401
|
+
#subscribe;
|
|
402
|
+
constructor(options = {}) {
|
|
403
|
+
const { window: window2 = defaultWindow, document: document2 = window2?.document } = options;
|
|
404
|
+
if (window2 === void 0) return;
|
|
405
|
+
this.#document = document2;
|
|
406
|
+
this.#subscribe = createSubscriber();
|
|
407
|
+
}
|
|
408
|
+
get current() {
|
|
409
|
+
this.#subscribe?.();
|
|
410
|
+
if (!this.#document) return null;
|
|
411
|
+
return getActiveElement$1(this.#document);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
new ActiveElement();
|
|
415
|
+
class Context {
|
|
416
|
+
#name;
|
|
417
|
+
#key;
|
|
418
|
+
/**
|
|
419
|
+
* @param name The name of the context.
|
|
420
|
+
* This is used for generating the context key and error messages.
|
|
421
|
+
*/
|
|
422
|
+
constructor(name) {
|
|
423
|
+
this.#name = name;
|
|
424
|
+
this.#key = Symbol(name);
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* The key used to get and set the context.
|
|
428
|
+
*
|
|
429
|
+
* It is not recommended to use this value directly.
|
|
430
|
+
* Instead, use the methods provided by this class.
|
|
431
|
+
*/
|
|
432
|
+
get key() {
|
|
433
|
+
return this.#key;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Checks whether this has been set in the context of a parent component.
|
|
437
|
+
*
|
|
438
|
+
* Must be called during component initialisation.
|
|
439
|
+
*/
|
|
440
|
+
exists() {
|
|
441
|
+
return hasContext(this.#key);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Retrieves the context that belongs to the closest parent component.
|
|
445
|
+
*
|
|
446
|
+
* Must be called during component initialisation.
|
|
447
|
+
*
|
|
448
|
+
* @throws An error if the context does not exist.
|
|
449
|
+
*/
|
|
450
|
+
get() {
|
|
451
|
+
const context = getContext(this.#key);
|
|
452
|
+
if (context === void 0) {
|
|
453
|
+
throw new Error(`Context "${this.#name}" not found`);
|
|
454
|
+
}
|
|
455
|
+
return context;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Retrieves the context that belongs to the closest parent component,
|
|
459
|
+
* or the given fallback value if the context does not exist.
|
|
460
|
+
*
|
|
461
|
+
* Must be called during component initialisation.
|
|
462
|
+
*/
|
|
463
|
+
getOr(fallback) {
|
|
464
|
+
const context = getContext(this.#key);
|
|
465
|
+
if (context === void 0) {
|
|
466
|
+
return fallback;
|
|
467
|
+
}
|
|
468
|
+
return context;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Associates the given value with the current component and returns it.
|
|
472
|
+
*
|
|
473
|
+
* Must be called during component initialisation.
|
|
474
|
+
*/
|
|
475
|
+
set(context) {
|
|
476
|
+
return setContext(this.#key, context);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function runWatcher(sources, flush, effect, options = {}) {
|
|
480
|
+
const { lazy = false } = options;
|
|
481
|
+
}
|
|
482
|
+
function watch(sources, effect, options) {
|
|
483
|
+
runWatcher(sources, "post", effect, options);
|
|
484
|
+
}
|
|
485
|
+
function watchPre(sources, effect, options) {
|
|
486
|
+
runWatcher(sources, "pre", effect, options);
|
|
487
|
+
}
|
|
488
|
+
watch.pre = watchPre;
|
|
489
|
+
function afterSleep(ms, cb) {
|
|
490
|
+
return setTimeout(cb, ms);
|
|
491
|
+
}
|
|
492
|
+
function afterTick(fn) {
|
|
493
|
+
tick().then(fn);
|
|
494
|
+
}
|
|
495
|
+
const ELEMENT_NODE = 1;
|
|
496
|
+
const DOCUMENT_NODE = 9;
|
|
497
|
+
const DOCUMENT_FRAGMENT_NODE = 11;
|
|
498
|
+
function isHTMLElement$1(node) {
|
|
499
|
+
return isObject(node) && node.nodeType === ELEMENT_NODE && typeof node.nodeName === "string";
|
|
500
|
+
}
|
|
501
|
+
function isDocument(node) {
|
|
502
|
+
return isObject(node) && node.nodeType === DOCUMENT_NODE;
|
|
503
|
+
}
|
|
504
|
+
function isWindow(node) {
|
|
505
|
+
return isObject(node) && node.constructor?.name === "VisualViewport";
|
|
506
|
+
}
|
|
507
|
+
function isNode(node) {
|
|
508
|
+
return isObject(node) && node.nodeType !== void 0;
|
|
509
|
+
}
|
|
510
|
+
function isShadowRoot(node) {
|
|
511
|
+
return isNode(node) && node.nodeType === DOCUMENT_FRAGMENT_NODE && "host" in node;
|
|
512
|
+
}
|
|
513
|
+
function contains(parent, child) {
|
|
514
|
+
if (!parent || !child)
|
|
515
|
+
return false;
|
|
516
|
+
if (!isHTMLElement$1(parent) || !isHTMLElement$1(child))
|
|
517
|
+
return false;
|
|
518
|
+
const rootNode = child.getRootNode?.();
|
|
519
|
+
if (parent === child)
|
|
520
|
+
return true;
|
|
521
|
+
if (parent.contains(child))
|
|
522
|
+
return true;
|
|
523
|
+
if (rootNode && isShadowRoot(rootNode)) {
|
|
524
|
+
let next = child;
|
|
525
|
+
while (next) {
|
|
526
|
+
if (parent === next)
|
|
527
|
+
return true;
|
|
528
|
+
next = next.parentNode || next.host;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
function getDocument(node) {
|
|
534
|
+
if (isDocument(node))
|
|
535
|
+
return node;
|
|
536
|
+
if (isWindow(node))
|
|
537
|
+
return node.document;
|
|
538
|
+
return node?.ownerDocument ?? document;
|
|
539
|
+
}
|
|
540
|
+
function getWindow(node) {
|
|
541
|
+
if (isShadowRoot(node))
|
|
542
|
+
return getWindow(node.host);
|
|
543
|
+
if (isDocument(node))
|
|
544
|
+
return node.defaultView ?? window;
|
|
545
|
+
if (isHTMLElement$1(node))
|
|
546
|
+
return node.ownerDocument?.defaultView ?? window;
|
|
547
|
+
return window;
|
|
548
|
+
}
|
|
549
|
+
function getActiveElement(rootNode) {
|
|
550
|
+
let activeElement = rootNode.activeElement;
|
|
551
|
+
while (activeElement?.shadowRoot) {
|
|
552
|
+
const el = activeElement.shadowRoot.activeElement;
|
|
553
|
+
if (el === activeElement)
|
|
554
|
+
break;
|
|
555
|
+
else
|
|
556
|
+
activeElement = el;
|
|
557
|
+
}
|
|
558
|
+
return activeElement;
|
|
559
|
+
}
|
|
560
|
+
class DOMContext {
|
|
561
|
+
element;
|
|
562
|
+
#root = derived(() => {
|
|
563
|
+
if (!this.element.current) return document;
|
|
564
|
+
const rootNode = this.element.current.getRootNode() ?? document;
|
|
565
|
+
return rootNode;
|
|
566
|
+
});
|
|
567
|
+
get root() {
|
|
568
|
+
return this.#root();
|
|
569
|
+
}
|
|
570
|
+
set root($$value) {
|
|
571
|
+
return this.#root($$value);
|
|
572
|
+
}
|
|
573
|
+
constructor(element2) {
|
|
574
|
+
if (typeof element2 === "function") {
|
|
575
|
+
this.element = boxWith(element2);
|
|
576
|
+
} else {
|
|
577
|
+
this.element = element2;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
getDocument = () => {
|
|
581
|
+
return getDocument(this.root);
|
|
582
|
+
};
|
|
583
|
+
getWindow = () => {
|
|
584
|
+
return this.getDocument().defaultView ?? window;
|
|
585
|
+
};
|
|
586
|
+
getActiveElement = () => {
|
|
587
|
+
return getActiveElement(this.root);
|
|
588
|
+
};
|
|
589
|
+
isActiveElement = (node) => {
|
|
590
|
+
return node === this.getActiveElement();
|
|
591
|
+
};
|
|
592
|
+
getElementById(id) {
|
|
593
|
+
return this.root.getElementById(id);
|
|
594
|
+
}
|
|
595
|
+
querySelector = (selector) => {
|
|
596
|
+
if (!this.root) return null;
|
|
597
|
+
return this.root.querySelector(selector);
|
|
598
|
+
};
|
|
599
|
+
querySelectorAll = (selector) => {
|
|
600
|
+
if (!this.root) return [];
|
|
601
|
+
return this.root.querySelectorAll(selector);
|
|
602
|
+
};
|
|
603
|
+
setTimeout = (callback, delay) => {
|
|
604
|
+
return this.getWindow().setTimeout(callback, delay);
|
|
605
|
+
};
|
|
606
|
+
clearTimeout = (timeoutId) => {
|
|
607
|
+
return this.getWindow().clearTimeout(timeoutId);
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
function attachRef(ref, onChange) {
|
|
611
|
+
return {
|
|
612
|
+
[createAttachmentKey()]: (node) => {
|
|
613
|
+
if (isBox(ref)) {
|
|
614
|
+
ref.current = node;
|
|
615
|
+
run(() => onChange?.(node));
|
|
616
|
+
return () => {
|
|
617
|
+
if ("isConnected" in node && node.isConnected)
|
|
618
|
+
return;
|
|
619
|
+
ref.current = null;
|
|
620
|
+
onChange?.(null);
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
ref(node);
|
|
624
|
+
run(() => onChange?.(node));
|
|
625
|
+
return () => {
|
|
626
|
+
if ("isConnected" in node && node.isConnected)
|
|
627
|
+
return;
|
|
628
|
+
ref(null);
|
|
629
|
+
onChange?.(null);
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
function boolToStr(condition) {
|
|
635
|
+
return condition ? "true" : "false";
|
|
636
|
+
}
|
|
637
|
+
function boolToEmptyStrOrUndef(condition) {
|
|
638
|
+
return condition ? "" : void 0;
|
|
639
|
+
}
|
|
640
|
+
function getDataOpenClosed(condition) {
|
|
641
|
+
return condition ? "open" : "closed";
|
|
642
|
+
}
|
|
643
|
+
class BitsAttrs {
|
|
644
|
+
#variant;
|
|
645
|
+
#prefix;
|
|
646
|
+
attrs;
|
|
647
|
+
constructor(config) {
|
|
648
|
+
this.#variant = config.getVariant ? config.getVariant() : null;
|
|
649
|
+
this.#prefix = this.#variant ? `data-${this.#variant}-` : `data-${config.component}-`;
|
|
650
|
+
this.getAttr = this.getAttr.bind(this);
|
|
651
|
+
this.selector = this.selector.bind(this);
|
|
652
|
+
this.attrs = Object.fromEntries(config.parts.map((part) => [part, this.getAttr(part)]));
|
|
653
|
+
}
|
|
654
|
+
getAttr(part, variantOverride) {
|
|
655
|
+
if (variantOverride)
|
|
656
|
+
return `data-${variantOverride}-${part}`;
|
|
657
|
+
return `${this.#prefix}${part}`;
|
|
658
|
+
}
|
|
659
|
+
selector(part, variantOverride) {
|
|
660
|
+
return `[${this.getAttr(part, variantOverride)}]`;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function createBitsAttrs(config) {
|
|
664
|
+
const bitsAttrs = new BitsAttrs(config);
|
|
665
|
+
return {
|
|
666
|
+
...bitsAttrs.attrs,
|
|
667
|
+
selector: bitsAttrs.selector,
|
|
668
|
+
getAttr: bitsAttrs.getAttr
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
const ENTER = "Enter";
|
|
672
|
+
const ESCAPE = "Escape";
|
|
673
|
+
const SPACE = " ";
|
|
674
|
+
const isBrowser = typeof document !== "undefined";
|
|
675
|
+
const isIOS = getIsIOS();
|
|
676
|
+
function getIsIOS() {
|
|
677
|
+
return isBrowser && window?.navigator?.userAgent && (/iP(ad|hone|od)/.test(window.navigator.userAgent) || // The new iPad Pro Gen3 does not identify itself as iPad, but as Macintosh.
|
|
678
|
+
window?.navigator?.maxTouchPoints > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
|
|
679
|
+
}
|
|
680
|
+
function isHTMLElement(element2) {
|
|
681
|
+
return element2 instanceof HTMLElement;
|
|
682
|
+
}
|
|
683
|
+
function isElement(element2) {
|
|
684
|
+
return element2 instanceof Element;
|
|
685
|
+
}
|
|
686
|
+
function isElementOrSVGElement(element2) {
|
|
687
|
+
return element2 instanceof Element || element2 instanceof SVGElement;
|
|
688
|
+
}
|
|
689
|
+
function isFocusVisible(element2) {
|
|
690
|
+
return element2.matches(":focus-visible");
|
|
691
|
+
}
|
|
692
|
+
function isNotNull(value) {
|
|
693
|
+
return value !== null;
|
|
694
|
+
}
|
|
695
|
+
class AnimationsComplete {
|
|
696
|
+
#opts;
|
|
697
|
+
#currentFrame = null;
|
|
698
|
+
constructor(opts) {
|
|
699
|
+
this.#opts = opts;
|
|
700
|
+
}
|
|
701
|
+
#cleanup() {
|
|
702
|
+
if (!this.#currentFrame)
|
|
703
|
+
return;
|
|
704
|
+
window.cancelAnimationFrame(this.#currentFrame);
|
|
705
|
+
this.#currentFrame = null;
|
|
706
|
+
}
|
|
707
|
+
run(fn) {
|
|
708
|
+
this.#cleanup();
|
|
709
|
+
const node = this.#opts.ref.current;
|
|
710
|
+
if (!node)
|
|
711
|
+
return;
|
|
712
|
+
if (typeof node.getAnimations !== "function") {
|
|
713
|
+
this.#executeCallback(fn);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
this.#currentFrame = window.requestAnimationFrame(() => {
|
|
717
|
+
const animations = node.getAnimations();
|
|
718
|
+
if (animations.length === 0) {
|
|
719
|
+
this.#executeCallback(fn);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
Promise.allSettled(animations.map((animation) => animation.finished)).then(() => {
|
|
723
|
+
this.#executeCallback(fn);
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
#executeCallback(fn) {
|
|
728
|
+
const execute = () => {
|
|
729
|
+
fn();
|
|
730
|
+
};
|
|
731
|
+
if (this.#opts.afterTick) {
|
|
732
|
+
afterTick(execute);
|
|
733
|
+
} else {
|
|
734
|
+
execute();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
class PresenceManager {
|
|
739
|
+
#opts;
|
|
740
|
+
#enabled;
|
|
741
|
+
#afterAnimations;
|
|
742
|
+
#shouldRender = false;
|
|
743
|
+
constructor(opts) {
|
|
744
|
+
this.#opts = opts;
|
|
745
|
+
this.#shouldRender = opts.open.current;
|
|
746
|
+
this.#enabled = opts.enabled ?? true;
|
|
747
|
+
this.#afterAnimations = new AnimationsComplete({ ref: this.#opts.ref, afterTick: this.#opts.open });
|
|
748
|
+
watch(() => this.#opts.open.current, (isOpen) => {
|
|
749
|
+
if (isOpen) this.#shouldRender = true;
|
|
750
|
+
if (!this.#enabled) return;
|
|
751
|
+
this.#afterAnimations.run(() => {
|
|
752
|
+
if (isOpen === this.#opts.open.current) {
|
|
753
|
+
if (!this.#opts.open.current) {
|
|
754
|
+
this.#shouldRender = false;
|
|
755
|
+
}
|
|
756
|
+
this.#opts.onComplete?.();
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
get shouldRender() {
|
|
762
|
+
return this.#shouldRender;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
function noop() {
|
|
766
|
+
}
|
|
767
|
+
function createId(prefixOrUid, uid) {
|
|
768
|
+
return `bits-${prefixOrUid}`;
|
|
769
|
+
}
|
|
770
|
+
const dialogAttrs = createBitsAttrs({
|
|
771
|
+
component: "dialog",
|
|
772
|
+
parts: [
|
|
773
|
+
"content",
|
|
774
|
+
"trigger",
|
|
775
|
+
"overlay",
|
|
776
|
+
"title",
|
|
777
|
+
"description",
|
|
778
|
+
"close",
|
|
779
|
+
"cancel",
|
|
780
|
+
"action"
|
|
781
|
+
]
|
|
782
|
+
});
|
|
783
|
+
const DialogRootContext = new Context("Dialog.Root | AlertDialog.Root");
|
|
784
|
+
class DialogRootState {
|
|
785
|
+
static create(opts) {
|
|
786
|
+
const parent = DialogRootContext.getOr(null);
|
|
787
|
+
return DialogRootContext.set(new DialogRootState(opts, parent));
|
|
788
|
+
}
|
|
789
|
+
opts;
|
|
790
|
+
triggerNode = null;
|
|
791
|
+
contentNode = null;
|
|
792
|
+
overlayNode = null;
|
|
793
|
+
descriptionNode = null;
|
|
794
|
+
contentId = void 0;
|
|
795
|
+
titleId = void 0;
|
|
796
|
+
triggerId = void 0;
|
|
797
|
+
descriptionId = void 0;
|
|
798
|
+
cancelNode = null;
|
|
799
|
+
nestedOpenCount = 0;
|
|
800
|
+
depth;
|
|
801
|
+
parent;
|
|
802
|
+
contentPresence;
|
|
803
|
+
overlayPresence;
|
|
804
|
+
constructor(opts, parent) {
|
|
805
|
+
this.opts = opts;
|
|
806
|
+
this.parent = parent;
|
|
807
|
+
this.depth = parent ? parent.depth + 1 : 0;
|
|
808
|
+
this.handleOpen = this.handleOpen.bind(this);
|
|
809
|
+
this.handleClose = this.handleClose.bind(this);
|
|
810
|
+
this.contentPresence = new PresenceManager({
|
|
811
|
+
ref: boxWith(() => this.contentNode),
|
|
812
|
+
open: this.opts.open,
|
|
813
|
+
enabled: true,
|
|
814
|
+
onComplete: () => {
|
|
815
|
+
this.opts.onOpenChangeComplete.current(this.opts.open.current);
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
this.overlayPresence = new PresenceManager({
|
|
819
|
+
ref: boxWith(() => this.overlayNode),
|
|
820
|
+
open: this.opts.open,
|
|
821
|
+
enabled: true
|
|
822
|
+
});
|
|
823
|
+
watch(
|
|
824
|
+
() => this.opts.open.current,
|
|
825
|
+
(isOpen) => {
|
|
826
|
+
if (!this.parent) return;
|
|
827
|
+
if (isOpen) {
|
|
828
|
+
this.parent.incrementNested();
|
|
829
|
+
} else {
|
|
830
|
+
this.parent.decrementNested();
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
{ lazy: true }
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
handleOpen() {
|
|
837
|
+
if (this.opts.open.current) return;
|
|
838
|
+
this.opts.open.current = true;
|
|
839
|
+
}
|
|
840
|
+
handleClose() {
|
|
841
|
+
if (!this.opts.open.current) return;
|
|
842
|
+
this.opts.open.current = false;
|
|
843
|
+
}
|
|
844
|
+
getBitsAttr = (part) => {
|
|
845
|
+
return dialogAttrs.getAttr(part, this.opts.variant.current);
|
|
846
|
+
};
|
|
847
|
+
incrementNested() {
|
|
848
|
+
this.nestedOpenCount++;
|
|
849
|
+
this.parent?.incrementNested();
|
|
850
|
+
}
|
|
851
|
+
decrementNested() {
|
|
852
|
+
if (this.nestedOpenCount === 0) return;
|
|
853
|
+
this.nestedOpenCount--;
|
|
854
|
+
this.parent?.decrementNested();
|
|
855
|
+
}
|
|
856
|
+
#sharedProps = derived(() => ({ "data-state": getDataOpenClosed(this.opts.open.current) }));
|
|
857
|
+
get sharedProps() {
|
|
858
|
+
return this.#sharedProps();
|
|
859
|
+
}
|
|
860
|
+
set sharedProps($$value) {
|
|
861
|
+
return this.#sharedProps($$value);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
class DialogTriggerState {
|
|
865
|
+
static create(opts) {
|
|
866
|
+
return new DialogTriggerState(opts, DialogRootContext.get());
|
|
867
|
+
}
|
|
868
|
+
opts;
|
|
869
|
+
root;
|
|
870
|
+
attachment;
|
|
871
|
+
constructor(opts, root) {
|
|
872
|
+
this.opts = opts;
|
|
873
|
+
this.root = root;
|
|
874
|
+
this.attachment = attachRef(this.opts.ref, (v) => {
|
|
875
|
+
this.root.triggerNode = v;
|
|
876
|
+
this.root.triggerId = v?.id;
|
|
877
|
+
});
|
|
878
|
+
this.onclick = this.onclick.bind(this);
|
|
879
|
+
this.onkeydown = this.onkeydown.bind(this);
|
|
880
|
+
}
|
|
881
|
+
onclick(e) {
|
|
882
|
+
if (this.opts.disabled.current) return;
|
|
883
|
+
if (e.button > 0) return;
|
|
884
|
+
this.root.handleOpen();
|
|
885
|
+
}
|
|
886
|
+
onkeydown(e) {
|
|
887
|
+
if (this.opts.disabled.current) return;
|
|
888
|
+
if (e.key === SPACE || e.key === ENTER) {
|
|
889
|
+
e.preventDefault();
|
|
890
|
+
this.root.handleOpen();
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
#props = derived(() => ({
|
|
894
|
+
id: this.opts.id.current,
|
|
895
|
+
"aria-haspopup": "dialog",
|
|
896
|
+
"aria-expanded": boolToStr(this.root.opts.open.current),
|
|
897
|
+
"aria-controls": this.root.contentId,
|
|
898
|
+
[this.root.getBitsAttr("trigger")]: "",
|
|
899
|
+
onkeydown: this.onkeydown,
|
|
900
|
+
onclick: this.onclick,
|
|
901
|
+
disabled: this.opts.disabled.current ? true : void 0,
|
|
902
|
+
...this.root.sharedProps,
|
|
903
|
+
...this.attachment
|
|
904
|
+
}));
|
|
905
|
+
get props() {
|
|
906
|
+
return this.#props();
|
|
907
|
+
}
|
|
908
|
+
set props($$value) {
|
|
909
|
+
return this.#props($$value);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
class DialogCloseState {
|
|
913
|
+
static create(opts) {
|
|
914
|
+
return new DialogCloseState(opts, DialogRootContext.get());
|
|
915
|
+
}
|
|
916
|
+
opts;
|
|
917
|
+
root;
|
|
918
|
+
attachment;
|
|
919
|
+
constructor(opts, root) {
|
|
920
|
+
this.opts = opts;
|
|
921
|
+
this.root = root;
|
|
922
|
+
this.attachment = attachRef(this.opts.ref);
|
|
923
|
+
this.onclick = this.onclick.bind(this);
|
|
924
|
+
this.onkeydown = this.onkeydown.bind(this);
|
|
925
|
+
}
|
|
926
|
+
onclick(e) {
|
|
927
|
+
if (this.opts.disabled.current) return;
|
|
928
|
+
if (e.button > 0) return;
|
|
929
|
+
this.root.handleClose();
|
|
930
|
+
}
|
|
931
|
+
onkeydown(e) {
|
|
932
|
+
if (this.opts.disabled.current) return;
|
|
933
|
+
if (e.key === SPACE || e.key === ENTER) {
|
|
934
|
+
e.preventDefault();
|
|
935
|
+
this.root.handleClose();
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
#props = derived(() => ({
|
|
939
|
+
id: this.opts.id.current,
|
|
940
|
+
[this.root.getBitsAttr(this.opts.variant.current)]: "",
|
|
941
|
+
onclick: this.onclick,
|
|
942
|
+
onkeydown: this.onkeydown,
|
|
943
|
+
disabled: this.opts.disabled.current ? true : void 0,
|
|
944
|
+
tabindex: 0,
|
|
945
|
+
...this.root.sharedProps,
|
|
946
|
+
...this.attachment
|
|
947
|
+
}));
|
|
948
|
+
get props() {
|
|
949
|
+
return this.#props();
|
|
950
|
+
}
|
|
951
|
+
set props($$value) {
|
|
952
|
+
return this.#props($$value);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
class DialogTitleState {
|
|
956
|
+
static create(opts) {
|
|
957
|
+
return new DialogTitleState(opts, DialogRootContext.get());
|
|
958
|
+
}
|
|
959
|
+
opts;
|
|
960
|
+
root;
|
|
961
|
+
attachment;
|
|
962
|
+
constructor(opts, root) {
|
|
963
|
+
this.opts = opts;
|
|
964
|
+
this.root = root;
|
|
965
|
+
this.root.titleId = this.opts.id.current;
|
|
966
|
+
this.attachment = attachRef(this.opts.ref);
|
|
967
|
+
watch.pre(() => this.opts.id.current, (id) => {
|
|
968
|
+
this.root.titleId = id;
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
#props = derived(() => ({
|
|
972
|
+
id: this.opts.id.current,
|
|
973
|
+
role: "heading",
|
|
974
|
+
"aria-level": this.opts.level.current,
|
|
975
|
+
[this.root.getBitsAttr("title")]: "",
|
|
976
|
+
...this.root.sharedProps,
|
|
977
|
+
...this.attachment
|
|
978
|
+
}));
|
|
979
|
+
get props() {
|
|
980
|
+
return this.#props();
|
|
981
|
+
}
|
|
982
|
+
set props($$value) {
|
|
983
|
+
return this.#props($$value);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
class DialogDescriptionState {
|
|
987
|
+
static create(opts) {
|
|
988
|
+
return new DialogDescriptionState(opts, DialogRootContext.get());
|
|
989
|
+
}
|
|
990
|
+
opts;
|
|
991
|
+
root;
|
|
992
|
+
attachment;
|
|
993
|
+
constructor(opts, root) {
|
|
994
|
+
this.opts = opts;
|
|
995
|
+
this.root = root;
|
|
996
|
+
this.root.descriptionId = this.opts.id.current;
|
|
997
|
+
this.attachment = attachRef(this.opts.ref, (v) => {
|
|
998
|
+
this.root.descriptionNode = v;
|
|
999
|
+
});
|
|
1000
|
+
watch.pre(() => this.opts.id.current, (id) => {
|
|
1001
|
+
this.root.descriptionId = id;
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
#props = derived(() => ({
|
|
1005
|
+
id: this.opts.id.current,
|
|
1006
|
+
[this.root.getBitsAttr("description")]: "",
|
|
1007
|
+
...this.root.sharedProps,
|
|
1008
|
+
...this.attachment
|
|
1009
|
+
}));
|
|
1010
|
+
get props() {
|
|
1011
|
+
return this.#props();
|
|
1012
|
+
}
|
|
1013
|
+
set props($$value) {
|
|
1014
|
+
return this.#props($$value);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
class DialogContentState {
|
|
1018
|
+
static create(opts) {
|
|
1019
|
+
return new DialogContentState(opts, DialogRootContext.get());
|
|
1020
|
+
}
|
|
1021
|
+
opts;
|
|
1022
|
+
root;
|
|
1023
|
+
attachment;
|
|
1024
|
+
constructor(opts, root) {
|
|
1025
|
+
this.opts = opts;
|
|
1026
|
+
this.root = root;
|
|
1027
|
+
this.attachment = attachRef(this.opts.ref, (v) => {
|
|
1028
|
+
this.root.contentNode = v;
|
|
1029
|
+
this.root.contentId = v?.id;
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
#snippetProps = derived(() => ({ open: this.root.opts.open.current }));
|
|
1033
|
+
get snippetProps() {
|
|
1034
|
+
return this.#snippetProps();
|
|
1035
|
+
}
|
|
1036
|
+
set snippetProps($$value) {
|
|
1037
|
+
return this.#snippetProps($$value);
|
|
1038
|
+
}
|
|
1039
|
+
#props = derived(() => ({
|
|
1040
|
+
id: this.opts.id.current,
|
|
1041
|
+
role: this.root.opts.variant.current === "alert-dialog" ? "alertdialog" : "dialog",
|
|
1042
|
+
"aria-modal": "true",
|
|
1043
|
+
"aria-describedby": this.root.descriptionId,
|
|
1044
|
+
"aria-labelledby": this.root.titleId,
|
|
1045
|
+
[this.root.getBitsAttr("content")]: "",
|
|
1046
|
+
style: {
|
|
1047
|
+
pointerEvents: "auto",
|
|
1048
|
+
outline: this.root.opts.variant.current === "alert-dialog" ? "none" : void 0,
|
|
1049
|
+
"--bits-dialog-depth": this.root.depth,
|
|
1050
|
+
"--bits-dialog-nested-count": this.root.nestedOpenCount,
|
|
1051
|
+
contain: "layout style"
|
|
1052
|
+
},
|
|
1053
|
+
tabindex: this.root.opts.variant.current === "alert-dialog" ? -1 : void 0,
|
|
1054
|
+
"data-nested-open": boolToEmptyStrOrUndef(this.root.nestedOpenCount > 0),
|
|
1055
|
+
"data-nested": boolToEmptyStrOrUndef(this.root.parent !== null),
|
|
1056
|
+
...this.root.sharedProps,
|
|
1057
|
+
...this.attachment
|
|
1058
|
+
}));
|
|
1059
|
+
get props() {
|
|
1060
|
+
return this.#props();
|
|
1061
|
+
}
|
|
1062
|
+
set props($$value) {
|
|
1063
|
+
return this.#props($$value);
|
|
1064
|
+
}
|
|
1065
|
+
get shouldRender() {
|
|
1066
|
+
return this.root.contentPresence.shouldRender;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
class DialogOverlayState {
|
|
1070
|
+
static create(opts) {
|
|
1071
|
+
return new DialogOverlayState(opts, DialogRootContext.get());
|
|
1072
|
+
}
|
|
1073
|
+
opts;
|
|
1074
|
+
root;
|
|
1075
|
+
attachment;
|
|
1076
|
+
constructor(opts, root) {
|
|
1077
|
+
this.opts = opts;
|
|
1078
|
+
this.root = root;
|
|
1079
|
+
this.attachment = attachRef(this.opts.ref, (v) => this.root.overlayNode = v);
|
|
1080
|
+
}
|
|
1081
|
+
#snippetProps = derived(() => ({ open: this.root.opts.open.current }));
|
|
1082
|
+
get snippetProps() {
|
|
1083
|
+
return this.#snippetProps();
|
|
1084
|
+
}
|
|
1085
|
+
set snippetProps($$value) {
|
|
1086
|
+
return this.#snippetProps($$value);
|
|
1087
|
+
}
|
|
1088
|
+
#props = derived(() => ({
|
|
1089
|
+
id: this.opts.id.current,
|
|
1090
|
+
[this.root.getBitsAttr("overlay")]: "",
|
|
1091
|
+
style: {
|
|
1092
|
+
pointerEvents: "auto",
|
|
1093
|
+
"--bits-dialog-depth": this.root.depth,
|
|
1094
|
+
"--bits-dialog-nested-count": this.root.nestedOpenCount
|
|
1095
|
+
},
|
|
1096
|
+
"data-nested-open": boolToEmptyStrOrUndef(this.root.nestedOpenCount > 0),
|
|
1097
|
+
"data-nested": boolToEmptyStrOrUndef(this.root.parent !== null),
|
|
1098
|
+
...this.root.sharedProps,
|
|
1099
|
+
...this.attachment
|
|
1100
|
+
}));
|
|
1101
|
+
get props() {
|
|
1102
|
+
return this.#props();
|
|
1103
|
+
}
|
|
1104
|
+
set props($$value) {
|
|
1105
|
+
return this.#props($$value);
|
|
1106
|
+
}
|
|
1107
|
+
get shouldRender() {
|
|
1108
|
+
return this.root.overlayPresence.shouldRender;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
function Dialog_title$1($$renderer, $$props) {
|
|
1112
|
+
$$renderer.component(($$renderer2) => {
|
|
1113
|
+
const uid = props_id($$renderer2);
|
|
1114
|
+
let {
|
|
1115
|
+
id = createId(uid),
|
|
1116
|
+
ref = null,
|
|
1117
|
+
child,
|
|
1118
|
+
children,
|
|
1119
|
+
level = 2,
|
|
1120
|
+
$$slots,
|
|
1121
|
+
$$events,
|
|
1122
|
+
...restProps
|
|
1123
|
+
} = $$props;
|
|
1124
|
+
const titleState = DialogTitleState.create({
|
|
1125
|
+
id: boxWith(() => id),
|
|
1126
|
+
level: boxWith(() => level),
|
|
1127
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
1128
|
+
});
|
|
1129
|
+
const mergedProps = derived(() => mergeProps(restProps, titleState.props));
|
|
1130
|
+
if (child) {
|
|
1131
|
+
$$renderer2.push("<!--[0-->");
|
|
1132
|
+
child($$renderer2, { props: mergedProps() });
|
|
1133
|
+
$$renderer2.push(`<!---->`);
|
|
1134
|
+
} else {
|
|
1135
|
+
$$renderer2.push("<!--[-1-->");
|
|
1136
|
+
$$renderer2.push(`<div${attributes({ ...mergedProps() })}>`);
|
|
1137
|
+
children?.($$renderer2);
|
|
1138
|
+
$$renderer2.push(`<!----></div>`);
|
|
1139
|
+
}
|
|
1140
|
+
$$renderer2.push(`<!--]-->`);
|
|
1141
|
+
bind_props($$props, { ref });
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
const BitsConfigContext = new Context("BitsConfig");
|
|
1145
|
+
function getBitsConfig() {
|
|
1146
|
+
const fallback = new BitsConfigState(null, {});
|
|
1147
|
+
return BitsConfigContext.getOr(fallback).opts;
|
|
1148
|
+
}
|
|
1149
|
+
class BitsConfigState {
|
|
1150
|
+
opts;
|
|
1151
|
+
constructor(parent, opts) {
|
|
1152
|
+
const resolveConfigOption = createConfigResolver(parent, opts);
|
|
1153
|
+
this.opts = {
|
|
1154
|
+
defaultPortalTo: resolveConfigOption((config) => config.defaultPortalTo),
|
|
1155
|
+
defaultLocale: resolveConfigOption((config) => config.defaultLocale)
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
function createConfigResolver(parent, currentOpts) {
|
|
1160
|
+
return (getter) => {
|
|
1161
|
+
const configOption = boxWith(() => {
|
|
1162
|
+
const value = getter(currentOpts)?.current;
|
|
1163
|
+
if (value !== void 0)
|
|
1164
|
+
return value;
|
|
1165
|
+
if (parent === null)
|
|
1166
|
+
return void 0;
|
|
1167
|
+
return getter(parent.opts)?.current;
|
|
1168
|
+
});
|
|
1169
|
+
return configOption;
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
function createPropResolver(configOption, fallback) {
|
|
1173
|
+
return (getProp) => {
|
|
1174
|
+
const config = getBitsConfig();
|
|
1175
|
+
return boxWith(() => {
|
|
1176
|
+
const propValue = getProp();
|
|
1177
|
+
if (propValue !== void 0)
|
|
1178
|
+
return propValue;
|
|
1179
|
+
const option = configOption(config).current;
|
|
1180
|
+
if (option !== void 0)
|
|
1181
|
+
return option;
|
|
1182
|
+
return fallback;
|
|
1183
|
+
});
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
const resolvePortalToProp = createPropResolver((config) => config.defaultPortalTo, "body");
|
|
1187
|
+
function Portal($$renderer, $$props) {
|
|
1188
|
+
$$renderer.component(($$renderer2) => {
|
|
1189
|
+
let { to: toProp, children, disabled } = $$props;
|
|
1190
|
+
const to = resolvePortalToProp(() => toProp);
|
|
1191
|
+
getAllContexts();
|
|
1192
|
+
let target = derived(getTarget);
|
|
1193
|
+
function getTarget() {
|
|
1194
|
+
if (!isBrowser || disabled) return null;
|
|
1195
|
+
let localTarget = null;
|
|
1196
|
+
if (typeof to.current === "string") {
|
|
1197
|
+
const target2 = document.querySelector(to.current);
|
|
1198
|
+
localTarget = target2;
|
|
1199
|
+
} else {
|
|
1200
|
+
localTarget = to.current;
|
|
1201
|
+
}
|
|
1202
|
+
return localTarget;
|
|
1203
|
+
}
|
|
1204
|
+
let instance;
|
|
1205
|
+
function unmountInstance() {
|
|
1206
|
+
if (instance) {
|
|
1207
|
+
unmount();
|
|
1208
|
+
instance = null;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
watch([() => target(), () => disabled], ([target2, disabled2]) => {
|
|
1212
|
+
if (!target2 || disabled2) {
|
|
1213
|
+
unmountInstance();
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
instance = mount();
|
|
1217
|
+
return () => {
|
|
1218
|
+
unmountInstance();
|
|
1219
|
+
};
|
|
1220
|
+
});
|
|
1221
|
+
if (disabled) {
|
|
1222
|
+
$$renderer2.push("<!--[0-->");
|
|
1223
|
+
children?.($$renderer2);
|
|
1224
|
+
$$renderer2.push(`<!---->`);
|
|
1225
|
+
} else {
|
|
1226
|
+
$$renderer2.push("<!--[-1-->");
|
|
1227
|
+
}
|
|
1228
|
+
$$renderer2.push(`<!--]-->`);
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
function debounce(fn, wait = 500) {
|
|
1232
|
+
let timeout = null;
|
|
1233
|
+
const debounced = (...args) => {
|
|
1234
|
+
if (timeout !== null) {
|
|
1235
|
+
clearTimeout(timeout);
|
|
1236
|
+
}
|
|
1237
|
+
timeout = setTimeout(() => {
|
|
1238
|
+
fn(...args);
|
|
1239
|
+
}, wait);
|
|
1240
|
+
};
|
|
1241
|
+
debounced.destroy = () => {
|
|
1242
|
+
if (timeout !== null) {
|
|
1243
|
+
clearTimeout(timeout);
|
|
1244
|
+
timeout = null;
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
return debounced;
|
|
1248
|
+
}
|
|
1249
|
+
function isOrContainsTarget(node, target) {
|
|
1250
|
+
return node === target || node.contains(target);
|
|
1251
|
+
}
|
|
1252
|
+
function getOwnerDocument(el) {
|
|
1253
|
+
return el?.ownerDocument ?? document;
|
|
1254
|
+
}
|
|
1255
|
+
function isClickTrulyOutside(event, contentNode) {
|
|
1256
|
+
const { clientX, clientY } = event;
|
|
1257
|
+
const rect = contentNode.getBoundingClientRect();
|
|
1258
|
+
return clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom;
|
|
1259
|
+
}
|
|
1260
|
+
const CONTEXT_MENU_TRIGGER_ATTR = "data-context-menu-trigger";
|
|
1261
|
+
const CONTEXT_MENU_CONTENT_ATTR = "data-context-menu-content";
|
|
1262
|
+
createBitsAttrs({
|
|
1263
|
+
component: "menu",
|
|
1264
|
+
parts: [
|
|
1265
|
+
"trigger",
|
|
1266
|
+
"content",
|
|
1267
|
+
"sub-trigger",
|
|
1268
|
+
"item",
|
|
1269
|
+
"group",
|
|
1270
|
+
"group-heading",
|
|
1271
|
+
"checkbox-group",
|
|
1272
|
+
"checkbox-item",
|
|
1273
|
+
"radio-group",
|
|
1274
|
+
"radio-item",
|
|
1275
|
+
"separator",
|
|
1276
|
+
"sub-content",
|
|
1277
|
+
"arrow"
|
|
1278
|
+
]
|
|
1279
|
+
});
|
|
1280
|
+
globalThis.bitsDismissableLayers ??= /* @__PURE__ */ new Map();
|
|
1281
|
+
class DismissibleLayerState {
|
|
1282
|
+
static create(opts) {
|
|
1283
|
+
return new DismissibleLayerState(opts);
|
|
1284
|
+
}
|
|
1285
|
+
opts;
|
|
1286
|
+
#interactOutsideProp;
|
|
1287
|
+
#behaviorType;
|
|
1288
|
+
#interceptedEvents = { pointerdown: false };
|
|
1289
|
+
#isResponsibleLayer = false;
|
|
1290
|
+
#isFocusInsideDOMTree = false;
|
|
1291
|
+
#documentObj = void 0;
|
|
1292
|
+
#onFocusOutside;
|
|
1293
|
+
#unsubClickListener = noop;
|
|
1294
|
+
constructor(opts) {
|
|
1295
|
+
this.opts = opts;
|
|
1296
|
+
this.#behaviorType = opts.interactOutsideBehavior;
|
|
1297
|
+
this.#interactOutsideProp = opts.onInteractOutside;
|
|
1298
|
+
this.#onFocusOutside = opts.onFocusOutside;
|
|
1299
|
+
let unsubEvents = noop;
|
|
1300
|
+
const cleanup = () => {
|
|
1301
|
+
this.#resetState();
|
|
1302
|
+
globalThis.bitsDismissableLayers.delete(this);
|
|
1303
|
+
this.#handleInteractOutside.destroy();
|
|
1304
|
+
unsubEvents();
|
|
1305
|
+
};
|
|
1306
|
+
watch([() => this.opts.enabled.current, () => this.opts.ref.current], () => {
|
|
1307
|
+
if (!this.opts.enabled.current || !this.opts.ref.current) return;
|
|
1308
|
+
afterSleep(1, () => {
|
|
1309
|
+
if (!this.opts.ref.current) return;
|
|
1310
|
+
globalThis.bitsDismissableLayers.set(this, this.#behaviorType);
|
|
1311
|
+
unsubEvents();
|
|
1312
|
+
unsubEvents = this.#addEventListeners();
|
|
1313
|
+
});
|
|
1314
|
+
return cleanup;
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
#handleFocus = (event) => {
|
|
1318
|
+
if (event.defaultPrevented) return;
|
|
1319
|
+
if (!this.opts.ref.current) return;
|
|
1320
|
+
afterTick(() => {
|
|
1321
|
+
if (!this.opts.ref.current || this.#isTargetWithinLayer(event.target)) return;
|
|
1322
|
+
if (event.target && !this.#isFocusInsideDOMTree) {
|
|
1323
|
+
this.#onFocusOutside.current?.(event);
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
};
|
|
1327
|
+
#addEventListeners() {
|
|
1328
|
+
return executeCallbacks(
|
|
1329
|
+
/**
|
|
1330
|
+
* CAPTURE INTERACTION START
|
|
1331
|
+
* mark interaction-start event as intercepted.
|
|
1332
|
+
* mark responsible layer during interaction start
|
|
1333
|
+
* to avoid checking if is responsible layer during interaction end
|
|
1334
|
+
* when a new floating element may have been opened.
|
|
1335
|
+
*/
|
|
1336
|
+
on(this.#documentObj, "pointerdown", executeCallbacks(this.#markInterceptedEvent, this.#markResponsibleLayer), { capture: true }),
|
|
1337
|
+
/**
|
|
1338
|
+
* BUBBLE INTERACTION START
|
|
1339
|
+
* Mark interaction-start event as non-intercepted. Debounce `onInteractOutsideStart`
|
|
1340
|
+
* to avoid prematurely checking if other events were intercepted.
|
|
1341
|
+
*/
|
|
1342
|
+
on(this.#documentObj, "pointerdown", executeCallbacks(this.#markNonInterceptedEvent, this.#handleInteractOutside)),
|
|
1343
|
+
/**
|
|
1344
|
+
* HANDLE FOCUS OUTSIDE
|
|
1345
|
+
*/
|
|
1346
|
+
on(this.#documentObj, "focusin", this.#handleFocus)
|
|
1347
|
+
);
|
|
1348
|
+
}
|
|
1349
|
+
#handleDismiss = (e) => {
|
|
1350
|
+
let event = e;
|
|
1351
|
+
if (event.defaultPrevented) {
|
|
1352
|
+
event = createWrappedEvent(e);
|
|
1353
|
+
}
|
|
1354
|
+
this.#interactOutsideProp.current(e);
|
|
1355
|
+
};
|
|
1356
|
+
#handleInteractOutside = debounce(
|
|
1357
|
+
(e) => {
|
|
1358
|
+
if (!this.opts.ref.current) {
|
|
1359
|
+
this.#unsubClickListener();
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
const isEventValid = this.opts.isValidEvent.current(e, this.opts.ref.current) || isValidEvent(e, this.opts.ref.current);
|
|
1363
|
+
if (!this.#isResponsibleLayer || this.#isAnyEventIntercepted() || !isEventValid) {
|
|
1364
|
+
this.#unsubClickListener();
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
let event = e;
|
|
1368
|
+
if (event.defaultPrevented) {
|
|
1369
|
+
event = createWrappedEvent(event);
|
|
1370
|
+
}
|
|
1371
|
+
if (this.#behaviorType.current !== "close" && this.#behaviorType.current !== "defer-otherwise-close") {
|
|
1372
|
+
this.#unsubClickListener();
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
if (e.pointerType === "touch") {
|
|
1376
|
+
this.#unsubClickListener();
|
|
1377
|
+
this.#unsubClickListener = on(this.#documentObj, "click", this.#handleDismiss, { once: true });
|
|
1378
|
+
} else {
|
|
1379
|
+
this.#interactOutsideProp.current(event);
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
10
|
|
1383
|
+
);
|
|
1384
|
+
#markInterceptedEvent = (e) => {
|
|
1385
|
+
this.#interceptedEvents[e.type] = true;
|
|
1386
|
+
};
|
|
1387
|
+
#markNonInterceptedEvent = (e) => {
|
|
1388
|
+
this.#interceptedEvents[e.type] = false;
|
|
1389
|
+
};
|
|
1390
|
+
#markResponsibleLayer = () => {
|
|
1391
|
+
if (!this.opts.ref.current) return;
|
|
1392
|
+
this.#isResponsibleLayer = isResponsibleLayer(this.opts.ref.current);
|
|
1393
|
+
};
|
|
1394
|
+
#isTargetWithinLayer = (target) => {
|
|
1395
|
+
if (!this.opts.ref.current) return false;
|
|
1396
|
+
return isOrContainsTarget(this.opts.ref.current, target);
|
|
1397
|
+
};
|
|
1398
|
+
#resetState = debounce(
|
|
1399
|
+
() => {
|
|
1400
|
+
for (const eventType in this.#interceptedEvents) {
|
|
1401
|
+
this.#interceptedEvents[eventType] = false;
|
|
1402
|
+
}
|
|
1403
|
+
this.#isResponsibleLayer = false;
|
|
1404
|
+
},
|
|
1405
|
+
20
|
|
1406
|
+
);
|
|
1407
|
+
#isAnyEventIntercepted() {
|
|
1408
|
+
const i = Object.values(this.#interceptedEvents).some(Boolean);
|
|
1409
|
+
return i;
|
|
1410
|
+
}
|
|
1411
|
+
#onfocuscapture = () => {
|
|
1412
|
+
this.#isFocusInsideDOMTree = true;
|
|
1413
|
+
};
|
|
1414
|
+
#onblurcapture = () => {
|
|
1415
|
+
this.#isFocusInsideDOMTree = false;
|
|
1416
|
+
};
|
|
1417
|
+
props = {
|
|
1418
|
+
onfocuscapture: this.#onfocuscapture,
|
|
1419
|
+
onblurcapture: this.#onblurcapture
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
|
+
function getTopMostDismissableLayer(layersArr = [...globalThis.bitsDismissableLayers]) {
|
|
1423
|
+
return layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
|
|
1424
|
+
}
|
|
1425
|
+
function isResponsibleLayer(node) {
|
|
1426
|
+
const layersArr = [...globalThis.bitsDismissableLayers];
|
|
1427
|
+
const topMostLayer = getTopMostDismissableLayer(layersArr);
|
|
1428
|
+
if (topMostLayer) return topMostLayer[0].opts.ref.current === node;
|
|
1429
|
+
const [firstLayerNode] = layersArr[0];
|
|
1430
|
+
return firstLayerNode.opts.ref.current === node;
|
|
1431
|
+
}
|
|
1432
|
+
function isValidEvent(e, node) {
|
|
1433
|
+
const target = e.target;
|
|
1434
|
+
if (!isElementOrSVGElement(target)) return false;
|
|
1435
|
+
const targetIsContextMenuTrigger = Boolean(target.closest(`[${CONTEXT_MENU_TRIGGER_ATTR}]`));
|
|
1436
|
+
if ("button" in e && e.button > 0 && !targetIsContextMenuTrigger) return false;
|
|
1437
|
+
if ("button" in e && e.button === 0 && targetIsContextMenuTrigger) return true;
|
|
1438
|
+
const nodeIsContextMenu = Boolean(node.closest(`[${CONTEXT_MENU_CONTENT_ATTR}]`));
|
|
1439
|
+
if (targetIsContextMenuTrigger && nodeIsContextMenu) return false;
|
|
1440
|
+
const ownerDocument = getOwnerDocument(target);
|
|
1441
|
+
const isValid = ownerDocument.documentElement.contains(target) && !isOrContainsTarget(node, target) && isClickTrulyOutside(e, node);
|
|
1442
|
+
return isValid;
|
|
1443
|
+
}
|
|
1444
|
+
function createWrappedEvent(e) {
|
|
1445
|
+
const capturedCurrentTarget = e.currentTarget;
|
|
1446
|
+
const capturedTarget = e.target;
|
|
1447
|
+
let newEvent;
|
|
1448
|
+
if (e instanceof PointerEvent) {
|
|
1449
|
+
newEvent = new PointerEvent(e.type, e);
|
|
1450
|
+
} else {
|
|
1451
|
+
newEvent = new PointerEvent("pointerdown", e);
|
|
1452
|
+
}
|
|
1453
|
+
let isPrevented = false;
|
|
1454
|
+
const wrappedEvent = new Proxy(newEvent, {
|
|
1455
|
+
get: (target, prop) => {
|
|
1456
|
+
if (prop === "currentTarget") {
|
|
1457
|
+
return capturedCurrentTarget;
|
|
1458
|
+
}
|
|
1459
|
+
if (prop === "target") {
|
|
1460
|
+
return capturedTarget;
|
|
1461
|
+
}
|
|
1462
|
+
if (prop === "preventDefault") {
|
|
1463
|
+
return () => {
|
|
1464
|
+
isPrevented = true;
|
|
1465
|
+
if (typeof target.preventDefault === "function") {
|
|
1466
|
+
target.preventDefault();
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
if (prop === "defaultPrevented") {
|
|
1471
|
+
return isPrevented;
|
|
1472
|
+
}
|
|
1473
|
+
if (prop in target) {
|
|
1474
|
+
return target[prop];
|
|
1475
|
+
}
|
|
1476
|
+
return e[prop];
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
return wrappedEvent;
|
|
1480
|
+
}
|
|
1481
|
+
function Dismissible_layer($$renderer, $$props) {
|
|
1482
|
+
$$renderer.component(($$renderer2) => {
|
|
1483
|
+
let {
|
|
1484
|
+
interactOutsideBehavior = "close",
|
|
1485
|
+
onInteractOutside = noop,
|
|
1486
|
+
onFocusOutside = noop,
|
|
1487
|
+
id,
|
|
1488
|
+
children,
|
|
1489
|
+
enabled,
|
|
1490
|
+
isValidEvent: isValidEvent2 = () => false,
|
|
1491
|
+
ref
|
|
1492
|
+
} = $$props;
|
|
1493
|
+
const dismissibleLayerState = DismissibleLayerState.create({
|
|
1494
|
+
id: boxWith(() => id),
|
|
1495
|
+
interactOutsideBehavior: boxWith(() => interactOutsideBehavior),
|
|
1496
|
+
onInteractOutside: boxWith(() => onInteractOutside),
|
|
1497
|
+
enabled: boxWith(() => enabled),
|
|
1498
|
+
onFocusOutside: boxWith(() => onFocusOutside),
|
|
1499
|
+
isValidEvent: boxWith(() => isValidEvent2),
|
|
1500
|
+
ref
|
|
1501
|
+
});
|
|
1502
|
+
children?.($$renderer2, { props: dismissibleLayerState.props });
|
|
1503
|
+
$$renderer2.push(`<!---->`);
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
globalThis.bitsEscapeLayers ??= /* @__PURE__ */ new Map();
|
|
1507
|
+
class EscapeLayerState {
|
|
1508
|
+
static create(opts) {
|
|
1509
|
+
return new EscapeLayerState(opts);
|
|
1510
|
+
}
|
|
1511
|
+
opts;
|
|
1512
|
+
domContext;
|
|
1513
|
+
constructor(opts) {
|
|
1514
|
+
this.opts = opts;
|
|
1515
|
+
this.domContext = new DOMContext(this.opts.ref);
|
|
1516
|
+
let unsubEvents = noop;
|
|
1517
|
+
watch(() => opts.enabled.current, (enabled) => {
|
|
1518
|
+
if (enabled) {
|
|
1519
|
+
globalThis.bitsEscapeLayers.set(this, opts.escapeKeydownBehavior);
|
|
1520
|
+
unsubEvents = this.#addEventListener();
|
|
1521
|
+
}
|
|
1522
|
+
return () => {
|
|
1523
|
+
unsubEvents();
|
|
1524
|
+
globalThis.bitsEscapeLayers.delete(this);
|
|
1525
|
+
};
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
#addEventListener = () => {
|
|
1529
|
+
return on(this.domContext.getDocument(), "keydown", this.#onkeydown, { passive: false });
|
|
1530
|
+
};
|
|
1531
|
+
#onkeydown = (e) => {
|
|
1532
|
+
if (e.key !== ESCAPE || !isResponsibleEscapeLayer(this)) return;
|
|
1533
|
+
const clonedEvent = new KeyboardEvent(e.type, e);
|
|
1534
|
+
e.preventDefault();
|
|
1535
|
+
const behaviorType = this.opts.escapeKeydownBehavior.current;
|
|
1536
|
+
if (behaviorType !== "close" && behaviorType !== "defer-otherwise-close") return;
|
|
1537
|
+
this.opts.onEscapeKeydown.current(clonedEvent);
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
function isResponsibleEscapeLayer(instance) {
|
|
1541
|
+
const layersArr = [...globalThis.bitsEscapeLayers];
|
|
1542
|
+
const topMostLayer = layersArr.findLast(([_, { current: behaviorType }]) => behaviorType === "close" || behaviorType === "ignore");
|
|
1543
|
+
if (topMostLayer) return topMostLayer[0] === instance;
|
|
1544
|
+
const [firstLayerNode] = layersArr[0];
|
|
1545
|
+
return firstLayerNode === instance;
|
|
1546
|
+
}
|
|
1547
|
+
function Escape_layer($$renderer, $$props) {
|
|
1548
|
+
$$renderer.component(($$renderer2) => {
|
|
1549
|
+
let {
|
|
1550
|
+
escapeKeydownBehavior = "close",
|
|
1551
|
+
onEscapeKeydown = noop,
|
|
1552
|
+
children,
|
|
1553
|
+
enabled,
|
|
1554
|
+
ref
|
|
1555
|
+
} = $$props;
|
|
1556
|
+
EscapeLayerState.create({
|
|
1557
|
+
escapeKeydownBehavior: boxWith(() => escapeKeydownBehavior),
|
|
1558
|
+
onEscapeKeydown: boxWith(() => onEscapeKeydown),
|
|
1559
|
+
enabled: boxWith(() => enabled),
|
|
1560
|
+
ref
|
|
1561
|
+
});
|
|
1562
|
+
children?.($$renderer2);
|
|
1563
|
+
$$renderer2.push(`<!---->`);
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
class FocusScopeManager {
|
|
1567
|
+
static instance;
|
|
1568
|
+
#scopeStack = simpleBox([]);
|
|
1569
|
+
#focusHistory = /* @__PURE__ */ new WeakMap();
|
|
1570
|
+
#preFocusHistory = /* @__PURE__ */ new WeakMap();
|
|
1571
|
+
static getInstance() {
|
|
1572
|
+
if (!this.instance) {
|
|
1573
|
+
this.instance = new FocusScopeManager();
|
|
1574
|
+
}
|
|
1575
|
+
return this.instance;
|
|
1576
|
+
}
|
|
1577
|
+
register(scope) {
|
|
1578
|
+
const current = this.getActive();
|
|
1579
|
+
if (current && current !== scope) {
|
|
1580
|
+
current.pause();
|
|
1581
|
+
}
|
|
1582
|
+
const activeElement = document.activeElement;
|
|
1583
|
+
if (activeElement && activeElement !== document.body) {
|
|
1584
|
+
this.#preFocusHistory.set(scope, activeElement);
|
|
1585
|
+
}
|
|
1586
|
+
this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope);
|
|
1587
|
+
this.#scopeStack.current.unshift(scope);
|
|
1588
|
+
}
|
|
1589
|
+
unregister(scope) {
|
|
1590
|
+
this.#scopeStack.current = this.#scopeStack.current.filter((s) => s !== scope);
|
|
1591
|
+
const next = this.getActive();
|
|
1592
|
+
if (next) {
|
|
1593
|
+
next.resume();
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
getActive() {
|
|
1597
|
+
return this.#scopeStack.current[0];
|
|
1598
|
+
}
|
|
1599
|
+
setFocusMemory(scope, element2) {
|
|
1600
|
+
this.#focusHistory.set(scope, element2);
|
|
1601
|
+
}
|
|
1602
|
+
getFocusMemory(scope) {
|
|
1603
|
+
return this.#focusHistory.get(scope);
|
|
1604
|
+
}
|
|
1605
|
+
isActiveScope(scope) {
|
|
1606
|
+
return this.getActive() === scope;
|
|
1607
|
+
}
|
|
1608
|
+
setPreFocusMemory(scope, element2) {
|
|
1609
|
+
this.#preFocusHistory.set(scope, element2);
|
|
1610
|
+
}
|
|
1611
|
+
getPreFocusMemory(scope) {
|
|
1612
|
+
return this.#preFocusHistory.get(scope);
|
|
1613
|
+
}
|
|
1614
|
+
clearPreFocusMemory(scope) {
|
|
1615
|
+
this.#preFocusHistory.delete(scope);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
class FocusScope {
|
|
1619
|
+
#paused = false;
|
|
1620
|
+
#container = null;
|
|
1621
|
+
#manager = FocusScopeManager.getInstance();
|
|
1622
|
+
#cleanupFns = [];
|
|
1623
|
+
#opts;
|
|
1624
|
+
constructor(opts) {
|
|
1625
|
+
this.#opts = opts;
|
|
1626
|
+
}
|
|
1627
|
+
get paused() {
|
|
1628
|
+
return this.#paused;
|
|
1629
|
+
}
|
|
1630
|
+
pause() {
|
|
1631
|
+
this.#paused = true;
|
|
1632
|
+
}
|
|
1633
|
+
resume() {
|
|
1634
|
+
this.#paused = false;
|
|
1635
|
+
}
|
|
1636
|
+
#cleanup() {
|
|
1637
|
+
for (const fn of this.#cleanupFns) {
|
|
1638
|
+
fn();
|
|
1639
|
+
}
|
|
1640
|
+
this.#cleanupFns = [];
|
|
1641
|
+
}
|
|
1642
|
+
mount(container) {
|
|
1643
|
+
if (this.#container) {
|
|
1644
|
+
this.unmount();
|
|
1645
|
+
}
|
|
1646
|
+
this.#container = container;
|
|
1647
|
+
this.#manager.register(this);
|
|
1648
|
+
this.#setupEventListeners();
|
|
1649
|
+
this.#handleOpenAutoFocus();
|
|
1650
|
+
}
|
|
1651
|
+
unmount() {
|
|
1652
|
+
if (!this.#container) return;
|
|
1653
|
+
this.#cleanup();
|
|
1654
|
+
this.#handleCloseAutoFocus();
|
|
1655
|
+
this.#manager.unregister(this);
|
|
1656
|
+
this.#manager.clearPreFocusMemory(this);
|
|
1657
|
+
this.#container = null;
|
|
1658
|
+
}
|
|
1659
|
+
#handleOpenAutoFocus() {
|
|
1660
|
+
if (!this.#container) return;
|
|
1661
|
+
const event = new CustomEvent("focusScope.onOpenAutoFocus", { bubbles: false, cancelable: true });
|
|
1662
|
+
this.#opts.onOpenAutoFocus.current(event);
|
|
1663
|
+
if (!event.defaultPrevented) {
|
|
1664
|
+
requestAnimationFrame(() => {
|
|
1665
|
+
if (!this.#container) return;
|
|
1666
|
+
const firstTabbable = this.#getFirstTabbable();
|
|
1667
|
+
if (firstTabbable) {
|
|
1668
|
+
firstTabbable.focus();
|
|
1669
|
+
this.#manager.setFocusMemory(this, firstTabbable);
|
|
1670
|
+
} else {
|
|
1671
|
+
this.#container.focus();
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
#handleCloseAutoFocus() {
|
|
1677
|
+
const event = new CustomEvent("focusScope.onCloseAutoFocus", { bubbles: false, cancelable: true });
|
|
1678
|
+
this.#opts.onCloseAutoFocus.current?.(event);
|
|
1679
|
+
if (!event.defaultPrevented) {
|
|
1680
|
+
const preFocusedElement = this.#manager.getPreFocusMemory(this);
|
|
1681
|
+
if (preFocusedElement && document.contains(preFocusedElement)) {
|
|
1682
|
+
try {
|
|
1683
|
+
preFocusedElement.focus();
|
|
1684
|
+
} catch {
|
|
1685
|
+
document.body.focus();
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
#setupEventListeners() {
|
|
1691
|
+
if (!this.#container || !this.#opts.trap.current) return;
|
|
1692
|
+
const container = this.#container;
|
|
1693
|
+
const doc = container.ownerDocument;
|
|
1694
|
+
const handleFocus = (e) => {
|
|
1695
|
+
if (this.#paused || !this.#manager.isActiveScope(this)) return;
|
|
1696
|
+
const target = e.target;
|
|
1697
|
+
if (!target) return;
|
|
1698
|
+
const isInside = container.contains(target);
|
|
1699
|
+
if (isInside) {
|
|
1700
|
+
this.#manager.setFocusMemory(this, target);
|
|
1701
|
+
} else {
|
|
1702
|
+
const lastFocused = this.#manager.getFocusMemory(this);
|
|
1703
|
+
if (lastFocused && container.contains(lastFocused) && isFocusable(lastFocused)) {
|
|
1704
|
+
e.preventDefault();
|
|
1705
|
+
lastFocused.focus();
|
|
1706
|
+
} else {
|
|
1707
|
+
const firstTabbable = this.#getFirstTabbable();
|
|
1708
|
+
const firstFocusable = this.#getAllFocusables()[0];
|
|
1709
|
+
(firstTabbable || firstFocusable || container).focus();
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1713
|
+
const handleKeydown = (e) => {
|
|
1714
|
+
if (!this.#opts.loop || this.#paused || e.key !== "Tab") return;
|
|
1715
|
+
if (!this.#manager.isActiveScope(this)) return;
|
|
1716
|
+
const tabbables = this.#getTabbables();
|
|
1717
|
+
if (tabbables.length === 0) return;
|
|
1718
|
+
const first = tabbables[0];
|
|
1719
|
+
const last = tabbables[tabbables.length - 1];
|
|
1720
|
+
if (!e.shiftKey && doc.activeElement === last) {
|
|
1721
|
+
e.preventDefault();
|
|
1722
|
+
first.focus();
|
|
1723
|
+
} else if (e.shiftKey && doc.activeElement === first) {
|
|
1724
|
+
e.preventDefault();
|
|
1725
|
+
last.focus();
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
this.#cleanupFns.push(on(doc, "focusin", handleFocus, { capture: true }), on(container, "keydown", handleKeydown));
|
|
1729
|
+
const observer = new MutationObserver(() => {
|
|
1730
|
+
const lastFocused = this.#manager.getFocusMemory(this);
|
|
1731
|
+
if (lastFocused && !container.contains(lastFocused)) {
|
|
1732
|
+
const firstTabbable = this.#getFirstTabbable();
|
|
1733
|
+
const firstFocusable = this.#getAllFocusables()[0];
|
|
1734
|
+
const elementToFocus = firstTabbable || firstFocusable;
|
|
1735
|
+
if (elementToFocus) {
|
|
1736
|
+
elementToFocus.focus();
|
|
1737
|
+
this.#manager.setFocusMemory(this, elementToFocus);
|
|
1738
|
+
} else {
|
|
1739
|
+
container.focus();
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1743
|
+
observer.observe(container, { childList: true, subtree: true });
|
|
1744
|
+
this.#cleanupFns.push(() => observer.disconnect());
|
|
1745
|
+
}
|
|
1746
|
+
#getTabbables() {
|
|
1747
|
+
if (!this.#container) return [];
|
|
1748
|
+
return tabbable(this.#container, { includeContainer: false, getShadowRoot: true });
|
|
1749
|
+
}
|
|
1750
|
+
#getFirstTabbable() {
|
|
1751
|
+
const tabbables = this.#getTabbables();
|
|
1752
|
+
return tabbables[0] || null;
|
|
1753
|
+
}
|
|
1754
|
+
#getAllFocusables() {
|
|
1755
|
+
if (!this.#container) return [];
|
|
1756
|
+
return focusable(this.#container, { includeContainer: false, getShadowRoot: true });
|
|
1757
|
+
}
|
|
1758
|
+
static use(opts) {
|
|
1759
|
+
let scope = null;
|
|
1760
|
+
watch([() => opts.ref.current, () => opts.enabled.current], ([ref, enabled]) => {
|
|
1761
|
+
if (ref && enabled) {
|
|
1762
|
+
if (!scope) {
|
|
1763
|
+
scope = new FocusScope(opts);
|
|
1764
|
+
}
|
|
1765
|
+
scope.mount(ref);
|
|
1766
|
+
} else if (scope) {
|
|
1767
|
+
scope.unmount();
|
|
1768
|
+
scope = null;
|
|
1769
|
+
}
|
|
1770
|
+
});
|
|
1771
|
+
return {
|
|
1772
|
+
get props() {
|
|
1773
|
+
return { tabindex: -1 };
|
|
1774
|
+
}
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
function Focus_scope($$renderer, $$props) {
|
|
1779
|
+
$$renderer.component(($$renderer2) => {
|
|
1780
|
+
let {
|
|
1781
|
+
enabled = false,
|
|
1782
|
+
trapFocus = false,
|
|
1783
|
+
loop = false,
|
|
1784
|
+
onCloseAutoFocus = noop,
|
|
1785
|
+
onOpenAutoFocus = noop,
|
|
1786
|
+
focusScope,
|
|
1787
|
+
ref
|
|
1788
|
+
} = $$props;
|
|
1789
|
+
const focusScopeState = FocusScope.use({
|
|
1790
|
+
enabled: boxWith(() => enabled),
|
|
1791
|
+
trap: boxWith(() => trapFocus),
|
|
1792
|
+
loop,
|
|
1793
|
+
onCloseAutoFocus: boxWith(() => onCloseAutoFocus),
|
|
1794
|
+
onOpenAutoFocus: boxWith(() => onOpenAutoFocus),
|
|
1795
|
+
ref
|
|
1796
|
+
});
|
|
1797
|
+
focusScope?.($$renderer2, { props: focusScopeState.props });
|
|
1798
|
+
$$renderer2.push(`<!---->`);
|
|
1799
|
+
});
|
|
1800
|
+
}
|
|
1801
|
+
globalThis.bitsTextSelectionLayers ??= /* @__PURE__ */ new Map();
|
|
1802
|
+
class TextSelectionLayerState {
|
|
1803
|
+
static create(opts) {
|
|
1804
|
+
return new TextSelectionLayerState(opts);
|
|
1805
|
+
}
|
|
1806
|
+
opts;
|
|
1807
|
+
domContext;
|
|
1808
|
+
#unsubSelectionLock = noop;
|
|
1809
|
+
constructor(opts) {
|
|
1810
|
+
this.opts = opts;
|
|
1811
|
+
this.domContext = new DOMContext(opts.ref);
|
|
1812
|
+
let unsubEvents = noop;
|
|
1813
|
+
watch(() => this.opts.enabled.current, (isEnabled) => {
|
|
1814
|
+
if (isEnabled) {
|
|
1815
|
+
globalThis.bitsTextSelectionLayers.set(this, this.opts.enabled);
|
|
1816
|
+
unsubEvents();
|
|
1817
|
+
unsubEvents = this.#addEventListeners();
|
|
1818
|
+
}
|
|
1819
|
+
return () => {
|
|
1820
|
+
unsubEvents();
|
|
1821
|
+
this.#resetSelectionLock();
|
|
1822
|
+
globalThis.bitsTextSelectionLayers.delete(this);
|
|
1823
|
+
};
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
#addEventListeners() {
|
|
1827
|
+
return executeCallbacks(on(this.domContext.getDocument(), "pointerdown", this.#pointerdown), on(this.domContext.getDocument(), "pointerup", composeHandlers(this.#resetSelectionLock, this.opts.onPointerUp.current)));
|
|
1828
|
+
}
|
|
1829
|
+
#pointerdown = (e) => {
|
|
1830
|
+
const node = this.opts.ref.current;
|
|
1831
|
+
const target = e.target;
|
|
1832
|
+
if (!isHTMLElement(node) || !isHTMLElement(target) || !this.opts.enabled.current) return;
|
|
1833
|
+
if (!isHighestLayer(this) || !contains(node, target)) return;
|
|
1834
|
+
this.opts.onPointerDown.current(e);
|
|
1835
|
+
if (e.defaultPrevented) return;
|
|
1836
|
+
this.#unsubSelectionLock = preventTextSelectionOverflow(node, this.domContext.getDocument().body);
|
|
1837
|
+
};
|
|
1838
|
+
#resetSelectionLock = () => {
|
|
1839
|
+
this.#unsubSelectionLock();
|
|
1840
|
+
this.#unsubSelectionLock = noop;
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
const getUserSelect = (node) => node.style.userSelect || node.style.webkitUserSelect;
|
|
1844
|
+
function preventTextSelectionOverflow(node, body) {
|
|
1845
|
+
const originalBodyUserSelect = getUserSelect(body);
|
|
1846
|
+
const originalNodeUserSelect = getUserSelect(node);
|
|
1847
|
+
setUserSelect(body, "none");
|
|
1848
|
+
setUserSelect(node, "text");
|
|
1849
|
+
return () => {
|
|
1850
|
+
setUserSelect(body, originalBodyUserSelect);
|
|
1851
|
+
setUserSelect(node, originalNodeUserSelect);
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
function setUserSelect(node, value) {
|
|
1855
|
+
node.style.userSelect = value;
|
|
1856
|
+
node.style.webkitUserSelect = value;
|
|
1857
|
+
}
|
|
1858
|
+
function isHighestLayer(instance) {
|
|
1859
|
+
const layersArr = [...globalThis.bitsTextSelectionLayers];
|
|
1860
|
+
if (!layersArr.length) return false;
|
|
1861
|
+
const highestLayer = layersArr.at(-1);
|
|
1862
|
+
if (!highestLayer) return false;
|
|
1863
|
+
return highestLayer[0] === instance;
|
|
1864
|
+
}
|
|
1865
|
+
function Text_selection_layer($$renderer, $$props) {
|
|
1866
|
+
$$renderer.component(($$renderer2) => {
|
|
1867
|
+
let {
|
|
1868
|
+
preventOverflowTextSelection = true,
|
|
1869
|
+
onPointerDown = noop,
|
|
1870
|
+
onPointerUp = noop,
|
|
1871
|
+
id,
|
|
1872
|
+
children,
|
|
1873
|
+
enabled,
|
|
1874
|
+
ref
|
|
1875
|
+
} = $$props;
|
|
1876
|
+
TextSelectionLayerState.create({
|
|
1877
|
+
id: boxWith(() => id),
|
|
1878
|
+
onPointerDown: boxWith(() => onPointerDown),
|
|
1879
|
+
onPointerUp: boxWith(() => onPointerUp),
|
|
1880
|
+
enabled: boxWith(() => enabled && preventOverflowTextSelection),
|
|
1881
|
+
ref
|
|
1882
|
+
});
|
|
1883
|
+
children?.($$renderer2);
|
|
1884
|
+
$$renderer2.push(`<!---->`);
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
globalThis.bitsIdCounter ??= { current: 0 };
|
|
1888
|
+
function useId(prefix = "bits") {
|
|
1889
|
+
globalThis.bitsIdCounter.current++;
|
|
1890
|
+
return `${prefix}-${globalThis.bitsIdCounter.current}`;
|
|
1891
|
+
}
|
|
1892
|
+
class SharedState {
|
|
1893
|
+
#factory;
|
|
1894
|
+
#subscribers = 0;
|
|
1895
|
+
#state;
|
|
1896
|
+
#scope;
|
|
1897
|
+
constructor(factory) {
|
|
1898
|
+
this.#factory = factory;
|
|
1899
|
+
}
|
|
1900
|
+
#dispose() {
|
|
1901
|
+
this.#subscribers -= 1;
|
|
1902
|
+
if (this.#scope && this.#subscribers <= 0) {
|
|
1903
|
+
this.#scope();
|
|
1904
|
+
this.#state = void 0;
|
|
1905
|
+
this.#scope = void 0;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
get(...args) {
|
|
1909
|
+
this.#subscribers += 1;
|
|
1910
|
+
if (this.#state === void 0) {
|
|
1911
|
+
this.#scope = () => {
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
return this.#state;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
const lockMap = new SvelteMap();
|
|
1918
|
+
let initialBodyStyle = null;
|
|
1919
|
+
let cleanupTimeoutId = null;
|
|
1920
|
+
let isInCleanupTransition = false;
|
|
1921
|
+
const anyLocked = boxWith(() => {
|
|
1922
|
+
for (const value of lockMap.values()) {
|
|
1923
|
+
if (value) return true;
|
|
1924
|
+
}
|
|
1925
|
+
return false;
|
|
1926
|
+
});
|
|
1927
|
+
let cleanupScheduledAt = null;
|
|
1928
|
+
const bodyLockStackCount = new SharedState(() => {
|
|
1929
|
+
function resetBodyStyle() {
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
function cancelPendingCleanup() {
|
|
1933
|
+
if (cleanupTimeoutId === null) return;
|
|
1934
|
+
window.clearTimeout(cleanupTimeoutId);
|
|
1935
|
+
cleanupTimeoutId = null;
|
|
1936
|
+
}
|
|
1937
|
+
function scheduleCleanupIfNoNewLocks(delay, callback) {
|
|
1938
|
+
cancelPendingCleanup();
|
|
1939
|
+
isInCleanupTransition = true;
|
|
1940
|
+
cleanupScheduledAt = Date.now();
|
|
1941
|
+
const currentCleanupId = cleanupScheduledAt;
|
|
1942
|
+
const cleanupFn = () => {
|
|
1943
|
+
cleanupTimeoutId = null;
|
|
1944
|
+
if (cleanupScheduledAt !== currentCleanupId) return;
|
|
1945
|
+
if (!isAnyLocked(lockMap)) {
|
|
1946
|
+
isInCleanupTransition = false;
|
|
1947
|
+
callback();
|
|
1948
|
+
} else {
|
|
1949
|
+
isInCleanupTransition = false;
|
|
1950
|
+
}
|
|
1951
|
+
};
|
|
1952
|
+
const actualDelay = delay === null ? 24 : delay;
|
|
1953
|
+
cleanupTimeoutId = window.setTimeout(cleanupFn, actualDelay);
|
|
1954
|
+
}
|
|
1955
|
+
function ensureInitialStyleCaptured() {
|
|
1956
|
+
if (initialBodyStyle === null && lockMap.size === 0 && !isInCleanupTransition) {
|
|
1957
|
+
initialBodyStyle = document.body.getAttribute("style");
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
watch(() => anyLocked.current, () => {
|
|
1961
|
+
if (!anyLocked.current) return;
|
|
1962
|
+
ensureInitialStyleCaptured();
|
|
1963
|
+
isInCleanupTransition = false;
|
|
1964
|
+
const htmlStyle = getComputedStyle(document.documentElement);
|
|
1965
|
+
const bodyStyle = getComputedStyle(document.body);
|
|
1966
|
+
const hasStableGutter = htmlStyle.scrollbarGutter?.includes("stable") || bodyStyle.scrollbarGutter?.includes("stable");
|
|
1967
|
+
const verticalScrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
1968
|
+
const paddingRight = Number.parseInt(bodyStyle.paddingRight ?? "0", 10);
|
|
1969
|
+
const config = {
|
|
1970
|
+
padding: paddingRight + verticalScrollbarWidth,
|
|
1971
|
+
margin: Number.parseInt(bodyStyle.marginRight ?? "0", 10)
|
|
1972
|
+
};
|
|
1973
|
+
if (verticalScrollbarWidth > 0 && !hasStableGutter) {
|
|
1974
|
+
document.body.style.paddingRight = `${config.padding}px`;
|
|
1975
|
+
document.body.style.marginRight = `${config.margin}px`;
|
|
1976
|
+
document.body.style.setProperty("--scrollbar-width", `${verticalScrollbarWidth}px`);
|
|
1977
|
+
}
|
|
1978
|
+
document.body.style.overflow = "hidden";
|
|
1979
|
+
if (isIOS) {
|
|
1980
|
+
on(
|
|
1981
|
+
document,
|
|
1982
|
+
"touchmove",
|
|
1983
|
+
(e) => {
|
|
1984
|
+
if (e.target !== document.documentElement) return;
|
|
1985
|
+
if (e.touches.length > 1) return;
|
|
1986
|
+
e.preventDefault();
|
|
1987
|
+
},
|
|
1988
|
+
{ passive: false }
|
|
1989
|
+
);
|
|
1990
|
+
}
|
|
1991
|
+
afterTick(() => {
|
|
1992
|
+
document.body.style.pointerEvents = "none";
|
|
1993
|
+
document.body.style.overflow = "hidden";
|
|
1994
|
+
});
|
|
1995
|
+
});
|
|
1996
|
+
return {
|
|
1997
|
+
get lockMap() {
|
|
1998
|
+
return lockMap;
|
|
1999
|
+
},
|
|
2000
|
+
resetBodyStyle,
|
|
2001
|
+
scheduleCleanupIfNoNewLocks,
|
|
2002
|
+
cancelPendingCleanup,
|
|
2003
|
+
ensureInitialStyleCaptured
|
|
2004
|
+
};
|
|
2005
|
+
});
|
|
2006
|
+
class BodyScrollLock {
|
|
2007
|
+
#id = useId();
|
|
2008
|
+
#initialState;
|
|
2009
|
+
#restoreScrollDelay = () => null;
|
|
2010
|
+
#countState;
|
|
2011
|
+
locked;
|
|
2012
|
+
constructor(initialState, restoreScrollDelay = () => null) {
|
|
2013
|
+
this.#initialState = initialState;
|
|
2014
|
+
this.#restoreScrollDelay = restoreScrollDelay;
|
|
2015
|
+
this.#countState = bodyLockStackCount.get();
|
|
2016
|
+
if (!this.#countState) return;
|
|
2017
|
+
this.#countState.cancelPendingCleanup();
|
|
2018
|
+
this.#countState.ensureInitialStyleCaptured();
|
|
2019
|
+
this.#countState.lockMap.set(this.#id, this.#initialState ?? false);
|
|
2020
|
+
this.locked = boxWith(() => this.#countState.lockMap.get(this.#id) ?? false, (v) => this.#countState.lockMap.set(this.#id, v));
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
function isAnyLocked(map) {
|
|
2024
|
+
for (const [_, value] of map) {
|
|
2025
|
+
if (value) return true;
|
|
2026
|
+
}
|
|
2027
|
+
return false;
|
|
2028
|
+
}
|
|
2029
|
+
function Scroll_lock($$renderer, $$props) {
|
|
2030
|
+
$$renderer.component(($$renderer2) => {
|
|
2031
|
+
let { preventScroll = true, restoreScrollDelay = null } = $$props;
|
|
2032
|
+
if (preventScroll) {
|
|
2033
|
+
new BodyScrollLock(preventScroll, () => restoreScrollDelay);
|
|
2034
|
+
}
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
function Dialog_overlay$1($$renderer, $$props) {
|
|
2038
|
+
$$renderer.component(($$renderer2) => {
|
|
2039
|
+
const uid = props_id($$renderer2);
|
|
2040
|
+
let {
|
|
2041
|
+
id = createId(uid),
|
|
2042
|
+
forceMount = false,
|
|
2043
|
+
child,
|
|
2044
|
+
children,
|
|
2045
|
+
ref = null,
|
|
2046
|
+
$$slots,
|
|
2047
|
+
$$events,
|
|
2048
|
+
...restProps
|
|
2049
|
+
} = $$props;
|
|
2050
|
+
const overlayState = DialogOverlayState.create({
|
|
2051
|
+
id: boxWith(() => id),
|
|
2052
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
2053
|
+
});
|
|
2054
|
+
const mergedProps = derived(() => mergeProps(restProps, overlayState.props));
|
|
2055
|
+
if (overlayState.shouldRender || forceMount) {
|
|
2056
|
+
$$renderer2.push("<!--[0-->");
|
|
2057
|
+
if (child) {
|
|
2058
|
+
$$renderer2.push("<!--[0-->");
|
|
2059
|
+
child($$renderer2, {
|
|
2060
|
+
props: mergeProps(mergedProps()),
|
|
2061
|
+
...overlayState.snippetProps
|
|
2062
|
+
});
|
|
2063
|
+
$$renderer2.push(`<!---->`);
|
|
2064
|
+
} else {
|
|
2065
|
+
$$renderer2.push("<!--[-1-->");
|
|
2066
|
+
$$renderer2.push(`<div${attributes({ ...mergeProps(mergedProps()) })}>`);
|
|
2067
|
+
children?.($$renderer2, overlayState.snippetProps);
|
|
2068
|
+
$$renderer2.push(`<!----></div>`);
|
|
2069
|
+
}
|
|
2070
|
+
$$renderer2.push(`<!--]-->`);
|
|
2071
|
+
} else {
|
|
2072
|
+
$$renderer2.push("<!--[-1-->");
|
|
2073
|
+
}
|
|
2074
|
+
$$renderer2.push(`<!--]-->`);
|
|
2075
|
+
bind_props($$props, { ref });
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
function Dialog_description$1($$renderer, $$props) {
|
|
2079
|
+
$$renderer.component(($$renderer2) => {
|
|
2080
|
+
const uid = props_id($$renderer2);
|
|
2081
|
+
let {
|
|
2082
|
+
id = createId(uid),
|
|
2083
|
+
children,
|
|
2084
|
+
child,
|
|
2085
|
+
ref = null,
|
|
2086
|
+
$$slots,
|
|
2087
|
+
$$events,
|
|
2088
|
+
...restProps
|
|
2089
|
+
} = $$props;
|
|
2090
|
+
const descriptionState = DialogDescriptionState.create({
|
|
2091
|
+
id: boxWith(() => id),
|
|
2092
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
2093
|
+
});
|
|
2094
|
+
const mergedProps = derived(() => mergeProps(restProps, descriptionState.props));
|
|
2095
|
+
if (child) {
|
|
2096
|
+
$$renderer2.push("<!--[0-->");
|
|
2097
|
+
child($$renderer2, { props: mergedProps() });
|
|
2098
|
+
$$renderer2.push(`<!---->`);
|
|
2099
|
+
} else {
|
|
2100
|
+
$$renderer2.push("<!--[-1-->");
|
|
2101
|
+
$$renderer2.push(`<div${attributes({ ...mergedProps() })}>`);
|
|
2102
|
+
children?.($$renderer2);
|
|
2103
|
+
$$renderer2.push(`<!----></div>`);
|
|
2104
|
+
}
|
|
2105
|
+
$$renderer2.push(`<!--]-->`);
|
|
2106
|
+
bind_props($$props, { ref });
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
function Dialog$1($$renderer, $$props) {
|
|
2110
|
+
$$renderer.component(($$renderer2) => {
|
|
2111
|
+
let {
|
|
2112
|
+
open = false,
|
|
2113
|
+
onOpenChange = noop,
|
|
2114
|
+
onOpenChangeComplete = noop,
|
|
2115
|
+
children
|
|
2116
|
+
} = $$props;
|
|
2117
|
+
DialogRootState.create({
|
|
2118
|
+
variant: boxWith(() => "dialog"),
|
|
2119
|
+
open: boxWith(() => open, (v) => {
|
|
2120
|
+
open = v;
|
|
2121
|
+
onOpenChange(v);
|
|
2122
|
+
}),
|
|
2123
|
+
onOpenChangeComplete: boxWith(() => onOpenChangeComplete)
|
|
2124
|
+
});
|
|
2125
|
+
children?.($$renderer2);
|
|
2126
|
+
$$renderer2.push(`<!---->`);
|
|
2127
|
+
bind_props($$props, { open });
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
function Dialog_close($$renderer, $$props) {
|
|
2131
|
+
$$renderer.component(($$renderer2) => {
|
|
2132
|
+
const uid = props_id($$renderer2);
|
|
2133
|
+
let {
|
|
2134
|
+
children,
|
|
2135
|
+
child,
|
|
2136
|
+
id = createId(uid),
|
|
2137
|
+
ref = null,
|
|
2138
|
+
disabled = false,
|
|
2139
|
+
$$slots,
|
|
2140
|
+
$$events,
|
|
2141
|
+
...restProps
|
|
2142
|
+
} = $$props;
|
|
2143
|
+
const closeState = DialogCloseState.create({
|
|
2144
|
+
variant: boxWith(() => "close"),
|
|
2145
|
+
id: boxWith(() => id),
|
|
2146
|
+
ref: boxWith(() => ref, (v) => ref = v),
|
|
2147
|
+
disabled: boxWith(() => Boolean(disabled))
|
|
2148
|
+
});
|
|
2149
|
+
const mergedProps = derived(() => mergeProps(restProps, closeState.props));
|
|
2150
|
+
if (child) {
|
|
2151
|
+
$$renderer2.push("<!--[0-->");
|
|
2152
|
+
child($$renderer2, { props: mergedProps() });
|
|
2153
|
+
$$renderer2.push(`<!---->`);
|
|
2154
|
+
} else {
|
|
2155
|
+
$$renderer2.push("<!--[-1-->");
|
|
2156
|
+
$$renderer2.push(`<button${attributes({ ...mergedProps() })}>`);
|
|
2157
|
+
children?.($$renderer2);
|
|
2158
|
+
$$renderer2.push(`<!----></button>`);
|
|
2159
|
+
}
|
|
2160
|
+
$$renderer2.push(`<!--]-->`);
|
|
2161
|
+
bind_props($$props, { ref });
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
function Dialog_content$1($$renderer, $$props) {
|
|
2165
|
+
$$renderer.component(($$renderer2) => {
|
|
2166
|
+
const uid = props_id($$renderer2);
|
|
2167
|
+
let {
|
|
2168
|
+
id = createId(uid),
|
|
2169
|
+
children,
|
|
2170
|
+
child,
|
|
2171
|
+
ref = null,
|
|
2172
|
+
forceMount = false,
|
|
2173
|
+
onCloseAutoFocus = noop,
|
|
2174
|
+
onOpenAutoFocus = noop,
|
|
2175
|
+
onEscapeKeydown = noop,
|
|
2176
|
+
onInteractOutside = noop,
|
|
2177
|
+
trapFocus = true,
|
|
2178
|
+
preventScroll = true,
|
|
2179
|
+
restoreScrollDelay = null,
|
|
2180
|
+
$$slots,
|
|
2181
|
+
$$events,
|
|
2182
|
+
...restProps
|
|
2183
|
+
} = $$props;
|
|
2184
|
+
const contentState = DialogContentState.create({
|
|
2185
|
+
id: boxWith(() => id),
|
|
2186
|
+
ref: boxWith(() => ref, (v) => ref = v)
|
|
2187
|
+
});
|
|
2188
|
+
const mergedProps = derived(() => mergeProps(restProps, contentState.props));
|
|
2189
|
+
if (contentState.shouldRender || forceMount) {
|
|
2190
|
+
$$renderer2.push("<!--[0-->");
|
|
2191
|
+
{
|
|
2192
|
+
let focusScope = function($$renderer3, { props: focusScopeProps }) {
|
|
2193
|
+
Escape_layer($$renderer3, spread_props([
|
|
2194
|
+
mergedProps(),
|
|
2195
|
+
{
|
|
2196
|
+
enabled: contentState.root.opts.open.current,
|
|
2197
|
+
ref: contentState.opts.ref,
|
|
2198
|
+
onEscapeKeydown: (e) => {
|
|
2199
|
+
onEscapeKeydown(e);
|
|
2200
|
+
if (e.defaultPrevented) return;
|
|
2201
|
+
contentState.root.handleClose();
|
|
2202
|
+
},
|
|
2203
|
+
children: ($$renderer4) => {
|
|
2204
|
+
Dismissible_layer($$renderer4, spread_props([
|
|
2205
|
+
mergedProps(),
|
|
2206
|
+
{
|
|
2207
|
+
ref: contentState.opts.ref,
|
|
2208
|
+
enabled: contentState.root.opts.open.current,
|
|
2209
|
+
onInteractOutside: (e) => {
|
|
2210
|
+
onInteractOutside(e);
|
|
2211
|
+
if (e.defaultPrevented) return;
|
|
2212
|
+
contentState.root.handleClose();
|
|
2213
|
+
},
|
|
2214
|
+
children: ($$renderer5) => {
|
|
2215
|
+
Text_selection_layer($$renderer5, spread_props([
|
|
2216
|
+
mergedProps(),
|
|
2217
|
+
{
|
|
2218
|
+
ref: contentState.opts.ref,
|
|
2219
|
+
enabled: contentState.root.opts.open.current,
|
|
2220
|
+
children: ($$renderer6) => {
|
|
2221
|
+
if (child) {
|
|
2222
|
+
$$renderer6.push("<!--[0-->");
|
|
2223
|
+
if (contentState.root.opts.open.current) {
|
|
2224
|
+
$$renderer6.push("<!--[0-->");
|
|
2225
|
+
Scroll_lock($$renderer6, { preventScroll, restoreScrollDelay });
|
|
2226
|
+
} else {
|
|
2227
|
+
$$renderer6.push("<!--[-1-->");
|
|
2228
|
+
}
|
|
2229
|
+
$$renderer6.push(`<!--]--> `);
|
|
2230
|
+
child($$renderer6, {
|
|
2231
|
+
props: mergeProps(mergedProps(), focusScopeProps),
|
|
2232
|
+
...contentState.snippetProps
|
|
2233
|
+
});
|
|
2234
|
+
$$renderer6.push(`<!---->`);
|
|
2235
|
+
} else {
|
|
2236
|
+
$$renderer6.push("<!--[-1-->");
|
|
2237
|
+
Scroll_lock($$renderer6, { preventScroll });
|
|
2238
|
+
$$renderer6.push(`<!----> <div${attributes({ ...mergeProps(mergedProps(), focusScopeProps) })}>`);
|
|
2239
|
+
children?.($$renderer6);
|
|
2240
|
+
$$renderer6.push(`<!----></div>`);
|
|
2241
|
+
}
|
|
2242
|
+
$$renderer6.push(`<!--]-->`);
|
|
2243
|
+
},
|
|
2244
|
+
$$slots: { default: true }
|
|
2245
|
+
}
|
|
2246
|
+
]));
|
|
2247
|
+
},
|
|
2248
|
+
$$slots: { default: true }
|
|
2249
|
+
}
|
|
2250
|
+
]));
|
|
2251
|
+
},
|
|
2252
|
+
$$slots: { default: true }
|
|
2253
|
+
}
|
|
2254
|
+
]));
|
|
2255
|
+
};
|
|
2256
|
+
Focus_scope($$renderer2, {
|
|
2257
|
+
ref: contentState.opts.ref,
|
|
2258
|
+
loop: true,
|
|
2259
|
+
trapFocus,
|
|
2260
|
+
enabled: contentState.root.opts.open.current,
|
|
2261
|
+
onOpenAutoFocus,
|
|
2262
|
+
onCloseAutoFocus,
|
|
2263
|
+
focusScope
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
} else {
|
|
2267
|
+
$$renderer2.push("<!--[-1-->");
|
|
2268
|
+
}
|
|
2269
|
+
$$renderer2.push(`<!--]-->`);
|
|
2270
|
+
bind_props($$props, { ref });
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
const defaultAttributes = {
|
|
2274
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2275
|
+
width: 24,
|
|
2276
|
+
height: 24,
|
|
2277
|
+
viewBox: "0 0 24 24",
|
|
2278
|
+
fill: "none",
|
|
2279
|
+
stroke: "currentColor",
|
|
2280
|
+
"stroke-width": 2,
|
|
2281
|
+
"stroke-linecap": "round",
|
|
2282
|
+
"stroke-linejoin": "round"
|
|
2283
|
+
};
|
|
2284
|
+
function Icon($$renderer, $$props) {
|
|
2285
|
+
$$renderer.component(($$renderer2) => {
|
|
2286
|
+
const {
|
|
2287
|
+
name,
|
|
2288
|
+
color = "currentColor",
|
|
2289
|
+
size = 24,
|
|
2290
|
+
strokeWidth = 2,
|
|
2291
|
+
absoluteStrokeWidth = false,
|
|
2292
|
+
iconNode = [],
|
|
2293
|
+
children,
|
|
2294
|
+
$$slots,
|
|
2295
|
+
$$events,
|
|
2296
|
+
...props
|
|
2297
|
+
} = $$props;
|
|
2298
|
+
$$renderer2.push(`<svg${attributes(
|
|
2299
|
+
{
|
|
2300
|
+
...defaultAttributes,
|
|
2301
|
+
...props,
|
|
2302
|
+
width: size,
|
|
2303
|
+
height: size,
|
|
2304
|
+
stroke: color,
|
|
2305
|
+
"stroke-width": absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
2306
|
+
class: clsx$1(["lucide-icon lucide", name && `lucide-${name}`, props.class])
|
|
2307
|
+
},
|
|
2308
|
+
void 0,
|
|
2309
|
+
void 0,
|
|
2310
|
+
void 0,
|
|
2311
|
+
3
|
|
2312
|
+
)}><!--[-->`);
|
|
2313
|
+
const each_array = ensure_array_like(iconNode);
|
|
2314
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
2315
|
+
let [tag, attrs] = each_array[$$index];
|
|
2316
|
+
element($$renderer2, tag, () => {
|
|
2317
|
+
$$renderer2.push(`${attributes({ ...attrs }, void 0, void 0, void 0, 3)}`);
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
$$renderer2.push(`<!--]-->`);
|
|
2321
|
+
children?.($$renderer2);
|
|
2322
|
+
$$renderer2.push(`<!----></svg>`);
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2325
|
+
function X($$renderer, $$props) {
|
|
2326
|
+
$$renderer.component(($$renderer2) => {
|
|
2327
|
+
let { $$slots, $$events, ...props } = $$props;
|
|
2328
|
+
const iconNode = [
|
|
2329
|
+
["path", { "d": "M18 6 6 18" }],
|
|
2330
|
+
["path", { "d": "m6 6 12 12" }]
|
|
2331
|
+
];
|
|
2332
|
+
Icon($$renderer2, spread_props([
|
|
2333
|
+
{ name: "x" },
|
|
2334
|
+
/**
|
|
2335
|
+
* @component @name X
|
|
2336
|
+
* @description Lucide SVG icon component, renders SVG Element with children.
|
|
2337
|
+
*
|
|
2338
|
+
* @preview  - https://lucide.dev/icons/x
|
|
2339
|
+
* @see https://lucide.dev/guide/packages/lucide-svelte - Documentation
|
|
2340
|
+
*
|
|
2341
|
+
* @param {Object} props - Lucide icons props and any valid SVG attribute
|
|
2342
|
+
* @returns {FunctionalComponent} Svelte component
|
|
2343
|
+
*
|
|
2344
|
+
*/
|
|
2345
|
+
props,
|
|
2346
|
+
{
|
|
2347
|
+
iconNode,
|
|
2348
|
+
children: ($$renderer3) => {
|
|
2349
|
+
props.children?.($$renderer3);
|
|
2350
|
+
$$renderer3.push(`<!---->`);
|
|
2351
|
+
},
|
|
2352
|
+
$$slots: { default: true }
|
|
2353
|
+
}
|
|
2354
|
+
]));
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
function Dialog($$renderer, $$props) {
|
|
2358
|
+
$$renderer.component(($$renderer2) => {
|
|
2359
|
+
let { open = false, $$slots, $$events, ...restProps } = $$props;
|
|
2360
|
+
let $$settled = true;
|
|
2361
|
+
let $$inner_renderer;
|
|
2362
|
+
function $$render_inner($$renderer3) {
|
|
2363
|
+
if (Dialog$1) {
|
|
2364
|
+
$$renderer3.push("<!--[-->");
|
|
2365
|
+
Dialog$1($$renderer3, spread_props([
|
|
2366
|
+
restProps,
|
|
2367
|
+
{
|
|
2368
|
+
get open() {
|
|
2369
|
+
return open;
|
|
2370
|
+
},
|
|
2371
|
+
set open($$value) {
|
|
2372
|
+
open = $$value;
|
|
2373
|
+
$$settled = false;
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
]));
|
|
2377
|
+
$$renderer3.push("<!--]-->");
|
|
2378
|
+
} else {
|
|
2379
|
+
$$renderer3.push("<!--[!-->");
|
|
2380
|
+
$$renderer3.push("<!--]-->");
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
do {
|
|
2384
|
+
$$settled = true;
|
|
2385
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2386
|
+
$$render_inner($$inner_renderer);
|
|
2387
|
+
} while (!$$settled);
|
|
2388
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2389
|
+
bind_props($$props, { open });
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
function Dialog_portal($$renderer, $$props) {
|
|
2393
|
+
let { $$slots, $$events, ...restProps } = $$props;
|
|
2394
|
+
if (Portal) {
|
|
2395
|
+
$$renderer.push("<!--[-->");
|
|
2396
|
+
Portal($$renderer, spread_props([restProps]));
|
|
2397
|
+
$$renderer.push("<!--]-->");
|
|
2398
|
+
} else {
|
|
2399
|
+
$$renderer.push("<!--[!-->");
|
|
2400
|
+
$$renderer.push("<!--]-->");
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
function Dialog_title($$renderer, $$props) {
|
|
2404
|
+
$$renderer.component(($$renderer2) => {
|
|
2405
|
+
let {
|
|
2406
|
+
ref = null,
|
|
2407
|
+
class: className,
|
|
2408
|
+
$$slots,
|
|
2409
|
+
$$events,
|
|
2410
|
+
...restProps
|
|
2411
|
+
} = $$props;
|
|
2412
|
+
let $$settled = true;
|
|
2413
|
+
let $$inner_renderer;
|
|
2414
|
+
function $$render_inner($$renderer3) {
|
|
2415
|
+
if (Dialog_title$1) {
|
|
2416
|
+
$$renderer3.push("<!--[-->");
|
|
2417
|
+
Dialog_title$1($$renderer3, spread_props([
|
|
2418
|
+
{
|
|
2419
|
+
"data-slot": "dialog-title",
|
|
2420
|
+
class: cn("text-lg leading-none font-semibold", className)
|
|
2421
|
+
},
|
|
2422
|
+
restProps,
|
|
2423
|
+
{
|
|
2424
|
+
get ref() {
|
|
2425
|
+
return ref;
|
|
2426
|
+
},
|
|
2427
|
+
set ref($$value) {
|
|
2428
|
+
ref = $$value;
|
|
2429
|
+
$$settled = false;
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
]));
|
|
2433
|
+
$$renderer3.push("<!--]-->");
|
|
2434
|
+
} else {
|
|
2435
|
+
$$renderer3.push("<!--[!-->");
|
|
2436
|
+
$$renderer3.push("<!--]-->");
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
do {
|
|
2440
|
+
$$settled = true;
|
|
2441
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2442
|
+
$$render_inner($$inner_renderer);
|
|
2443
|
+
} while (!$$settled);
|
|
2444
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2445
|
+
bind_props($$props, { ref });
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
function Dialog_footer($$renderer, $$props) {
|
|
2449
|
+
$$renderer.component(($$renderer2) => {
|
|
2450
|
+
let {
|
|
2451
|
+
ref = null,
|
|
2452
|
+
class: className,
|
|
2453
|
+
children,
|
|
2454
|
+
$$slots,
|
|
2455
|
+
$$events,
|
|
2456
|
+
...restProps
|
|
2457
|
+
} = $$props;
|
|
2458
|
+
$$renderer2.push(`<div${attributes({
|
|
2459
|
+
"data-slot": "dialog-footer",
|
|
2460
|
+
class: clsx$1(cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)),
|
|
2461
|
+
...restProps
|
|
2462
|
+
})}>`);
|
|
2463
|
+
children?.($$renderer2);
|
|
2464
|
+
$$renderer2.push(`<!----></div>`);
|
|
2465
|
+
bind_props($$props, { ref });
|
|
2466
|
+
});
|
|
2467
|
+
}
|
|
2468
|
+
function Dialog_header($$renderer, $$props) {
|
|
2469
|
+
$$renderer.component(($$renderer2) => {
|
|
2470
|
+
let {
|
|
2471
|
+
ref = null,
|
|
2472
|
+
class: className,
|
|
2473
|
+
children,
|
|
2474
|
+
$$slots,
|
|
2475
|
+
$$events,
|
|
2476
|
+
...restProps
|
|
2477
|
+
} = $$props;
|
|
2478
|
+
$$renderer2.push(`<div${attributes({
|
|
2479
|
+
"data-slot": "dialog-header",
|
|
2480
|
+
class: clsx$1(cn("flex flex-col gap-2 text-center sm:text-start", className)),
|
|
2481
|
+
...restProps
|
|
2482
|
+
})}>`);
|
|
2483
|
+
children?.($$renderer2);
|
|
2484
|
+
$$renderer2.push(`<!----></div>`);
|
|
2485
|
+
bind_props($$props, { ref });
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2488
|
+
function Dialog_overlay($$renderer, $$props) {
|
|
2489
|
+
$$renderer.component(($$renderer2) => {
|
|
2490
|
+
let {
|
|
2491
|
+
ref = null,
|
|
2492
|
+
class: className,
|
|
2493
|
+
$$slots,
|
|
2494
|
+
$$events,
|
|
2495
|
+
...restProps
|
|
2496
|
+
} = $$props;
|
|
2497
|
+
let $$settled = true;
|
|
2498
|
+
let $$inner_renderer;
|
|
2499
|
+
function $$render_inner($$renderer3) {
|
|
2500
|
+
if (Dialog_overlay$1) {
|
|
2501
|
+
$$renderer3.push("<!--[-->");
|
|
2502
|
+
Dialog_overlay$1($$renderer3, spread_props([
|
|
2503
|
+
{
|
|
2504
|
+
"data-slot": "dialog-overlay",
|
|
2505
|
+
class: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className)
|
|
2506
|
+
},
|
|
2507
|
+
restProps,
|
|
2508
|
+
{
|
|
2509
|
+
get ref() {
|
|
2510
|
+
return ref;
|
|
2511
|
+
},
|
|
2512
|
+
set ref($$value) {
|
|
2513
|
+
ref = $$value;
|
|
2514
|
+
$$settled = false;
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
]));
|
|
2518
|
+
$$renderer3.push("<!--]-->");
|
|
2519
|
+
} else {
|
|
2520
|
+
$$renderer3.push("<!--[!-->");
|
|
2521
|
+
$$renderer3.push("<!--]-->");
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
do {
|
|
2525
|
+
$$settled = true;
|
|
2526
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2527
|
+
$$render_inner($$inner_renderer);
|
|
2528
|
+
} while (!$$settled);
|
|
2529
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2530
|
+
bind_props($$props, { ref });
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
function Dialog_content($$renderer, $$props) {
|
|
2534
|
+
$$renderer.component(($$renderer2) => {
|
|
2535
|
+
let {
|
|
2536
|
+
ref = null,
|
|
2537
|
+
class: className,
|
|
2538
|
+
portalProps,
|
|
2539
|
+
children,
|
|
2540
|
+
showCloseButton = true,
|
|
2541
|
+
$$slots,
|
|
2542
|
+
$$events,
|
|
2543
|
+
...restProps
|
|
2544
|
+
} = $$props;
|
|
2545
|
+
let $$settled = true;
|
|
2546
|
+
let $$inner_renderer;
|
|
2547
|
+
function $$render_inner($$renderer3) {
|
|
2548
|
+
Dialog_portal($$renderer3, spread_props([
|
|
2549
|
+
portalProps,
|
|
2550
|
+
{
|
|
2551
|
+
children: ($$renderer4) => {
|
|
2552
|
+
if (Dialog_overlay) {
|
|
2553
|
+
$$renderer4.push("<!--[-->");
|
|
2554
|
+
Dialog_overlay($$renderer4, {});
|
|
2555
|
+
$$renderer4.push("<!--]-->");
|
|
2556
|
+
} else {
|
|
2557
|
+
$$renderer4.push("<!--[!-->");
|
|
2558
|
+
$$renderer4.push("<!--]-->");
|
|
2559
|
+
}
|
|
2560
|
+
$$renderer4.push(` `);
|
|
2561
|
+
if (Dialog_content$1) {
|
|
2562
|
+
$$renderer4.push("<!--[-->");
|
|
2563
|
+
Dialog_content$1($$renderer4, spread_props([
|
|
2564
|
+
{
|
|
2565
|
+
"data-slot": "dialog-content",
|
|
2566
|
+
class: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", className)
|
|
2567
|
+
},
|
|
2568
|
+
restProps,
|
|
2569
|
+
{
|
|
2570
|
+
get ref() {
|
|
2571
|
+
return ref;
|
|
2572
|
+
},
|
|
2573
|
+
set ref($$value) {
|
|
2574
|
+
ref = $$value;
|
|
2575
|
+
$$settled = false;
|
|
2576
|
+
},
|
|
2577
|
+
children: ($$renderer5) => {
|
|
2578
|
+
children?.($$renderer5);
|
|
2579
|
+
$$renderer5.push(`<!----> `);
|
|
2580
|
+
if (showCloseButton) {
|
|
2581
|
+
$$renderer5.push("<!--[0-->");
|
|
2582
|
+
if (Dialog_close) {
|
|
2583
|
+
$$renderer5.push("<!--[-->");
|
|
2584
|
+
Dialog_close($$renderer5, {
|
|
2585
|
+
class: "ring-offset-background focus:ring-ring absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
2586
|
+
children: ($$renderer6) => {
|
|
2587
|
+
X($$renderer6, {});
|
|
2588
|
+
$$renderer6.push(`<!----> <span class="sr-only">Close</span>`);
|
|
2589
|
+
},
|
|
2590
|
+
$$slots: { default: true }
|
|
2591
|
+
});
|
|
2592
|
+
$$renderer5.push("<!--]-->");
|
|
2593
|
+
} else {
|
|
2594
|
+
$$renderer5.push("<!--[!-->");
|
|
2595
|
+
$$renderer5.push("<!--]-->");
|
|
2596
|
+
}
|
|
2597
|
+
} else {
|
|
2598
|
+
$$renderer5.push("<!--[-1-->");
|
|
2599
|
+
}
|
|
2600
|
+
$$renderer5.push(`<!--]-->`);
|
|
2601
|
+
},
|
|
2602
|
+
$$slots: { default: true }
|
|
2603
|
+
}
|
|
2604
|
+
]));
|
|
2605
|
+
$$renderer4.push("<!--]-->");
|
|
2606
|
+
} else {
|
|
2607
|
+
$$renderer4.push("<!--[!-->");
|
|
2608
|
+
$$renderer4.push("<!--]-->");
|
|
2609
|
+
}
|
|
2610
|
+
},
|
|
2611
|
+
$$slots: { default: true }
|
|
2612
|
+
}
|
|
2613
|
+
]));
|
|
2614
|
+
}
|
|
2615
|
+
do {
|
|
2616
|
+
$$settled = true;
|
|
2617
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2618
|
+
$$render_inner($$inner_renderer);
|
|
2619
|
+
} while (!$$settled);
|
|
2620
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2621
|
+
bind_props($$props, { ref });
|
|
2622
|
+
});
|
|
2623
|
+
}
|
|
2624
|
+
function Dialog_description($$renderer, $$props) {
|
|
2625
|
+
$$renderer.component(($$renderer2) => {
|
|
2626
|
+
let {
|
|
2627
|
+
ref = null,
|
|
2628
|
+
class: className,
|
|
2629
|
+
$$slots,
|
|
2630
|
+
$$events,
|
|
2631
|
+
...restProps
|
|
2632
|
+
} = $$props;
|
|
2633
|
+
let $$settled = true;
|
|
2634
|
+
let $$inner_renderer;
|
|
2635
|
+
function $$render_inner($$renderer3) {
|
|
2636
|
+
if (Dialog_description$1) {
|
|
2637
|
+
$$renderer3.push("<!--[-->");
|
|
2638
|
+
Dialog_description$1($$renderer3, spread_props([
|
|
2639
|
+
{
|
|
2640
|
+
"data-slot": "dialog-description",
|
|
2641
|
+
class: cn("text-muted-foreground text-sm", className)
|
|
2642
|
+
},
|
|
2643
|
+
restProps,
|
|
2644
|
+
{
|
|
2645
|
+
get ref() {
|
|
2646
|
+
return ref;
|
|
2647
|
+
},
|
|
2648
|
+
set ref($$value) {
|
|
2649
|
+
ref = $$value;
|
|
2650
|
+
$$settled = false;
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
]));
|
|
2654
|
+
$$renderer3.push("<!--]-->");
|
|
2655
|
+
} else {
|
|
2656
|
+
$$renderer3.push("<!--[!-->");
|
|
2657
|
+
$$renderer3.push("<!--]-->");
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
do {
|
|
2661
|
+
$$settled = true;
|
|
2662
|
+
$$inner_renderer = $$renderer2.copy();
|
|
2663
|
+
$$render_inner($$inner_renderer);
|
|
2664
|
+
} while (!$$settled);
|
|
2665
|
+
$$renderer2.subsume($$inner_renderer);
|
|
2666
|
+
bind_props($$props, { ref });
|
|
2667
|
+
});
|
|
2668
|
+
}
|
|
2669
|
+
function Bot($$renderer, $$props) {
|
|
2670
|
+
const $$sanitized_props = sanitize_props($$props);
|
|
2671
|
+
const iconNode = [
|
|
2672
|
+
["path", { "d": "M12 8V4H8" }],
|
|
2673
|
+
[
|
|
2674
|
+
"rect",
|
|
2675
|
+
{ "width": "16", "height": "12", "x": "4", "y": "8", "rx": "2" }
|
|
2676
|
+
],
|
|
2677
|
+
["path", { "d": "M2 14h2" }],
|
|
2678
|
+
["path", { "d": "M20 14h2" }],
|
|
2679
|
+
["path", { "d": "M15 13v2" }],
|
|
2680
|
+
["path", { "d": "M9 13v2" }]
|
|
2681
|
+
];
|
|
2682
|
+
Icon$1($$renderer, spread_props([
|
|
2683
|
+
{ name: "bot" },
|
|
2684
|
+
$$sanitized_props,
|
|
2685
|
+
{
|
|
2686
|
+
/**
|
|
2687
|
+
* @component @name Bot
|
|
2688
|
+
* @description Lucide SVG icon component, renders SVG Element with children.
|
|
2689
|
+
*
|
|
2690
|
+
* @preview  - https://lucide.dev/icons/bot
|
|
2691
|
+
* @see https://lucide.dev/guide/packages/lucide-svelte - Documentation
|
|
2692
|
+
*
|
|
2693
|
+
* @param {Object} props - Lucide icons props and any valid SVG attribute
|
|
2694
|
+
* @returns {FunctionalComponent} Svelte component
|
|
2695
|
+
*
|
|
2696
|
+
*/
|
|
2697
|
+
iconNode,
|
|
2698
|
+
children: ($$renderer2) => {
|
|
2699
|
+
$$renderer2.push(`<!--[-->`);
|
|
2700
|
+
slot($$renderer2, $$props, "default", {});
|
|
2701
|
+
$$renderer2.push(`<!--]-->`);
|
|
2702
|
+
},
|
|
2703
|
+
$$slots: { default: true }
|
|
2704
|
+
}
|
|
2705
|
+
]));
|
|
2706
|
+
}
|
|
2707
|
+
export {
|
|
2708
|
+
Dialog_title$1 as A,
|
|
2709
|
+
Dialog_description$1 as B,
|
|
2710
|
+
Context as C,
|
|
2711
|
+
DialogTriggerState as D,
|
|
2712
|
+
Escape_layer as E,
|
|
2713
|
+
Focus_scope as F,
|
|
2714
|
+
Bot as G,
|
|
2715
|
+
Dialog as H,
|
|
2716
|
+
Icon as I,
|
|
2717
|
+
Dialog_content as J,
|
|
2718
|
+
Dialog_header as K,
|
|
2719
|
+
Dialog_title as L,
|
|
2720
|
+
MediaQuery as M,
|
|
2721
|
+
Dialog_description as N,
|
|
2722
|
+
Dialog_footer as O,
|
|
2723
|
+
PresenceManager as P,
|
|
2724
|
+
Scroll_lock as S,
|
|
2725
|
+
Text_selection_layer as T,
|
|
2726
|
+
X,
|
|
2727
|
+
createId as a,
|
|
2728
|
+
boxWith as b,
|
|
2729
|
+
createSubscriber as c,
|
|
2730
|
+
defaultWindow as d,
|
|
2731
|
+
attachRef as e,
|
|
2732
|
+
cssToStyleObj as f,
|
|
2733
|
+
styleToString as g,
|
|
2734
|
+
getWindow as h,
|
|
2735
|
+
isNotNull as i,
|
|
2736
|
+
Dismissible_layer as j,
|
|
2737
|
+
getDocument as k,
|
|
2738
|
+
isElement as l,
|
|
2739
|
+
mergeProps as m,
|
|
2740
|
+
DOMContext as n,
|
|
2741
|
+
isFocusVisible as o,
|
|
2742
|
+
boolToEmptyStrOrUndef as p,
|
|
2743
|
+
createBitsAttrs as q,
|
|
2744
|
+
noop as r,
|
|
2745
|
+
simpleBox as s,
|
|
2746
|
+
Portal as t,
|
|
2747
|
+
useId as u,
|
|
2748
|
+
Dialog$1 as v,
|
|
2749
|
+
watch as w,
|
|
2750
|
+
Dialog_overlay$1 as x,
|
|
2751
|
+
Dialog_content$1 as y,
|
|
2752
|
+
Dialog_close as z
|
|
2753
|
+
};
|