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