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