openplanr 2.2640.8 → 2.2640.9
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/CHANGELOG.md +8 -0
- package/dist/dashboard/.vite/manifest.json +1 -1
- package/dist/dashboard/assets/{index-COZ36pFn.js → index-D7R6tnlX.js} +2 -2
- package/dist/dashboard/assets/{index-COZ36pFn.js.map → index-D7R6tnlX.js.map} +1 -1
- package/dist/dashboard/dashboard-manifest.json +8 -8
- package/dist/dashboard/index.html +1 -1
- package/lib/host-packages/adapter-registry.json +5 -5
- package/lib/host-packages/capability-map.json +1 -1
- package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
- package/lib/host-packages/claude/openplanr/.openplanr-content.json +165 -33
- package/lib/host-packages/claude/openplanr/README.md +22 -1
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-artifact-shell.mjs +3 -11
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +555 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/{design-pako-esm.mjs → design-compression.mjs} +2 -1521
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-document.mjs +133 -12
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +647 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-entities.mjs +17 -67
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-handoff.mjs +14 -16
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/{design-planr-home.mjs → design-loopback-server.mjs} +15 -36
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-owner-custody.mjs +121 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-resource-pack.mjs +698 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-review.mjs +798 -796
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-home.mjs +39 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-runtime-support-5cb7531bede8.mjs +24 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-share.mjs +138 -765
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/{design-escape.mjs → design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs} +158 -156
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-artifact-sources.mjs → claude/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs} +1 -1
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-bounded-json-data.mjs → claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-31a760fc.mjs} +241 -454
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +222 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-upload-spool.mjs +198 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design.mjs +12 -5
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +18 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +809 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +5193 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +4175 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +65 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +1755 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +62 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +2600 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +123 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +34 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +992 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +2513 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +1919 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +1759 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +1551 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +1121 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +2183 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +705 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +27 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +13 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-design-review-experience.js +3561 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-studio-shell.js +184 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +5045 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +1698 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-studio-shell.js +455 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-design-studio.js +1844 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +257 -0
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +4966 -0
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/design.mjs +240 -5192
- package/lib/host-packages/claude/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/claude/openplanr/skills/delegate/scripts/backend-diagnostics.mjs +6 -2
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +164 -32
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-delegate/scripts/backend-diagnostics.mjs +6 -2
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-artifact-shell.mjs +3 -11
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +555 -0
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-pako-esm.mjs → cursor/openplanr/runtime/design/scripts/design-compression.mjs} +2 -1521
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-document.mjs +133 -12
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +647 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-entities.mjs +17 -67
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-handoff.mjs +14 -16
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-planr-home.mjs → cursor/openplanr/runtime/design/scripts/design-loopback-server.mjs} +15 -36
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-owner-custody.mjs +121 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-resource-pack.mjs +698 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-review.mjs +798 -796
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-home.mjs +39 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-runtime-support-5cb7531bede8.mjs +24 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-share.mjs +138 -765
- package/lib/host-packages/{openai/openplanr/runtime/design/scripts/design-escape.mjs → cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs} +158 -156
- package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-artifact-sources.mjs → cursor/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs} +1 -1
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/{design-bounded-json-data.mjs → design-shared-protocol-contracts-31a760fc.mjs} +241 -454
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +222 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-upload-spool.mjs +198 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design.mjs +12 -5
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +18 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +809 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +5193 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +4175 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +65 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +1755 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +62 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +2600 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +123 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +34 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +992 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +2513 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +1919 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +1759 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +1551 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +1121 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +2183 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +705 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +27 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +13 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-design-review-experience.js +3561 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-studio-shell.js +184 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +5045 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +1698 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-studio-shell.js +455 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-design-studio.js +1844 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +257 -0
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +4966 -0
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/design.mjs +240 -5192
- package/lib/host-packages/cursor/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
- package/lib/host-packages/openai/openplanr/.openplanr-content.json +164 -32
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-artifact-shell.mjs +3 -11
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-chunked-workspace-client.mjs +555 -0
- package/lib/host-packages/{cursor/openplanr/runtime/design/scripts/design-pako-esm.mjs → openai/openplanr/runtime/design/scripts/design-compression.mjs} +2 -1521
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-document.mjs +133 -12
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-encrypted-workspace-client.mjs +647 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-entities.mjs +17 -67
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-handoff.mjs +14 -16
- package/lib/host-packages/{cursor/openplanr/runtime/design/scripts/design-planr-home.mjs → openai/openplanr/runtime/design/scripts/design-loopback-server.mjs} +15 -36
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-owner-custody.mjs +121 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-resource-pack.mjs +698 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-review.mjs +798 -796
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-home.mjs +39 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-runtime-support-5cb7531bede8.mjs +24 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-share.mjs +138 -765
- package/lib/host-packages/{cursor/openplanr/runtime/design/scripts/design-escape.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-dependencies-design-support-protocol-contracts-3d9b1a86.mjs} +158 -156
- package/lib/host-packages/{cursor/openplanr/runtime/design/scripts/design-artifact-sources.mjs → openai/openplanr/runtime/design/scripts/design-shared-artifact-support-protocol-contracts-ea2cd15e.mjs} +1 -1
- package/lib/host-packages/{claude/openplanr/runtime/design/scripts/design-bounded-json-data.mjs → openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-31a760fc.mjs} +241 -454
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-shared-protocol-contracts-75a938cc.mjs +222 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-upload-spool.mjs +198 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design.mjs +12 -5
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/01-module-runtime.js +18 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/02-artifact-review-ui.js +809 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/03-protocol-contracts.js +5193 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/04-compression.js +4175 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/05-artifact-sharing.js +65 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/06-artifact-review-ui.js +1755 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/07-artifact-sharing.js +62 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources/08-artifact-review-ui.js +2600 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js.sources.json +123 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/package.json +3 -3
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/01-module-runtime.js +34 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/02-react.js +992 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/03-react-dom-client-fiber-foundations.js +2513 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/04-react-dom-client-reconciliation-hooks.js +1919 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/05-react-dom-client-render-phases.js +1759 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/06-react-dom-client-commit-effects.js +1551 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/07-react-dom-client-work-loop-scheduling.js +1121 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/08-react-dom-client-dom-events-properties-hydration.js +2183 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/09-react-dom-client-public-roots.js +705 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/10-react.js +27 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/11-artifact-review-ui.js +13 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/12-design-review-experience.js +3561 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/13-studio-shell.js +184 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/14-interface-primitives.js +5045 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/15-interface-primitives.js +1698 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/16-studio-shell.js +455 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources/17-design-studio.js +1844 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js.sources.json +257 -0
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design-protocol-contracts.mjs +4966 -0
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/design.mjs +240 -5192
- package/lib/host-packages/openai/openplanr/runtime/plan/scripts/runtime/packages/protocol/package.json +1 -1
- package/lib/host-packages/openai/openplanr/skills/delegate/scripts/backend-diagnostics.mjs +6 -2
- package/package.json +2 -2
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/design-generated-b0798298053515fd.mjs +0 -18
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js +0 -5
- package/lib/host-packages/claude/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js +0 -25597
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/design-generated-b0798298053515fd.mjs +0 -18
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js +0 -5
- package/lib/host-packages/cursor/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js +0 -25597
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/design-generated-b0798298053515fd.mjs +0 -18
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/artifact/templates/artifact-review-stage.js +0 -5
- package/lib/host-packages/openai/openplanr/runtime/design/scripts/runtime/packages/design/templates/studio/studio.js +0 -25597
|
@@ -0,0 +1,1698 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// ../../node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
4
|
+
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
5
|
+
var __defProp21 = Object.defineProperty;
|
|
6
|
+
var __name20 = (target, value) => __defProp21(target, "name", { value, configurable: true });
|
|
7
|
+
var POPPER_NAME = "Popper";
|
|
8
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
9
|
+
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
10
|
+
var Popper = /* @__PURE__ */ __name20((props) => {
|
|
11
|
+
const { __scopePopper, children } = props;
|
|
12
|
+
const [anchor, setAnchor] = React31.useState(null);
|
|
13
|
+
const [placementState, setPlacementState] = React31.useState(void 0);
|
|
14
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
15
|
+
PopperProvider,
|
|
16
|
+
{
|
|
17
|
+
scope: __scopePopper,
|
|
18
|
+
anchor,
|
|
19
|
+
onAnchorChange: setAnchor,
|
|
20
|
+
placementState,
|
|
21
|
+
setPlacementState,
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}, "Popper");
|
|
26
|
+
var ANCHOR_NAME = "PopperAnchor";
|
|
27
|
+
var PopperAnchor = /* @__PURE__ */ React31.forwardRef(
|
|
28
|
+
/* @__PURE__ */ __name20(function PopperAnchor2(props, forwardedRef) {
|
|
29
|
+
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
30
|
+
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
31
|
+
const ref = React31.useRef(null);
|
|
32
|
+
const onAnchorChange = context.onAnchorChange;
|
|
33
|
+
const callbackRef = React31.useCallback(
|
|
34
|
+
(node) => {
|
|
35
|
+
ref.current = node;
|
|
36
|
+
if (node) {
|
|
37
|
+
onAnchorChange(node);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[onAnchorChange]
|
|
41
|
+
);
|
|
42
|
+
const composedRefs = useComposedRefs(forwardedRef, callbackRef);
|
|
43
|
+
const anchorRef = React31.useRef(null);
|
|
44
|
+
React31.useEffect(() => {
|
|
45
|
+
if (!virtualRef) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const previousAnchor = anchorRef.current;
|
|
49
|
+
anchorRef.current = virtualRef.current;
|
|
50
|
+
if (previousAnchor !== anchorRef.current) {
|
|
51
|
+
onAnchorChange(anchorRef.current);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState);
|
|
55
|
+
const placedSide = sideAndAlign?.[0];
|
|
56
|
+
const placedAlign = sideAndAlign?.[1];
|
|
57
|
+
return virtualRef ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
58
|
+
Primitive.div,
|
|
59
|
+
{
|
|
60
|
+
"data-radix-popper-side": placedSide,
|
|
61
|
+
"data-radix-popper-align": placedAlign,
|
|
62
|
+
...anchorProps,
|
|
63
|
+
ref: composedRefs
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}, "PopperAnchor")
|
|
67
|
+
);
|
|
68
|
+
var CONTENT_NAME2 = "PopperContent";
|
|
69
|
+
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME2);
|
|
70
|
+
var PopperContent = /* @__PURE__ */ React31.forwardRef(
|
|
71
|
+
/* @__PURE__ */ __name20(function PopperContent2(props, forwardedRef) {
|
|
72
|
+
const {
|
|
73
|
+
__scopePopper,
|
|
74
|
+
side = "bottom",
|
|
75
|
+
sideOffset = 0,
|
|
76
|
+
align = "center",
|
|
77
|
+
alignOffset = 0,
|
|
78
|
+
arrowPadding = 0,
|
|
79
|
+
avoidCollisions = true,
|
|
80
|
+
collisionBoundary = [],
|
|
81
|
+
collisionPadding: collisionPaddingProp = 0,
|
|
82
|
+
sticky = "partial",
|
|
83
|
+
hideWhenDetached = false,
|
|
84
|
+
updatePositionStrategy = "optimized",
|
|
85
|
+
onPlaced,
|
|
86
|
+
...contentProps
|
|
87
|
+
} = props;
|
|
88
|
+
const context = usePopperContext(CONTENT_NAME2, __scopePopper);
|
|
89
|
+
const [content, setContent] = React31.useState(null);
|
|
90
|
+
const composedRefs = useComposedRefs(forwardedRef, setContent);
|
|
91
|
+
const [arrow4, setArrow] = React31.useState(null);
|
|
92
|
+
const arrowSize = useSize(arrow4);
|
|
93
|
+
const arrowWidth = arrowSize?.width ?? 0;
|
|
94
|
+
const arrowHeight = arrowSize?.height ?? 0;
|
|
95
|
+
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
96
|
+
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
97
|
+
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
98
|
+
const hasExplicitBoundaries = boundary.length > 0;
|
|
99
|
+
const detectOverflowOptions = {
|
|
100
|
+
padding: collisionPadding,
|
|
101
|
+
boundary: boundary.filter(isNotNull),
|
|
102
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
103
|
+
altBoundary: hasExplicitBoundaries
|
|
104
|
+
};
|
|
105
|
+
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
106
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
107
|
+
strategy: "fixed",
|
|
108
|
+
placement: desiredPlacement,
|
|
109
|
+
whileElementsMounted: /* @__PURE__ */ __name20((...args) => {
|
|
110
|
+
const cleanup = autoUpdate(...args, {
|
|
111
|
+
animationFrame: updatePositionStrategy === "always"
|
|
112
|
+
});
|
|
113
|
+
return cleanup;
|
|
114
|
+
}, "whileElementsMounted"),
|
|
115
|
+
elements: {
|
|
116
|
+
reference: context.anchor
|
|
117
|
+
},
|
|
118
|
+
middleware: [
|
|
119
|
+
offset3({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
120
|
+
avoidCollisions && shift3({
|
|
121
|
+
mainAxis: true,
|
|
122
|
+
crossAxis: false,
|
|
123
|
+
limiter: sticky === "partial" ? limitShift3() : void 0,
|
|
124
|
+
...detectOverflowOptions
|
|
125
|
+
}),
|
|
126
|
+
avoidCollisions && flip3({ ...detectOverflowOptions }),
|
|
127
|
+
size3({
|
|
128
|
+
...detectOverflowOptions,
|
|
129
|
+
apply: /* @__PURE__ */ __name20(({ elements, rects, availableWidth, availableHeight }) => {
|
|
130
|
+
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
131
|
+
const contentStyle = elements.floating.style;
|
|
132
|
+
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
133
|
+
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
134
|
+
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
135
|
+
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
136
|
+
}, "apply")
|
|
137
|
+
}),
|
|
138
|
+
arrow4 && arrow3({ element: arrow4, padding: arrowPadding }),
|
|
139
|
+
transformOrigin({ arrowWidth, arrowHeight }),
|
|
140
|
+
hideWhenDetached && hide3({
|
|
141
|
+
strategy: "referenceHidden",
|
|
142
|
+
...detectOverflowOptions,
|
|
143
|
+
// `hide` detects whether the anchor (reference) is clipped, so when
|
|
144
|
+
// no explicit `collisionBoundary` is set we fall back to Floating
|
|
145
|
+
// UI's default clipping ancestors (e.g. a scrollable menu). This
|
|
146
|
+
// lets an occluded submenu hide once its anchor scrolls out of view
|
|
147
|
+
// (#3237). The collision/size middlewares deliberately keep the
|
|
148
|
+
// viewport-based default to avoid clamping content rendered inside
|
|
149
|
+
// transformed or overflow-clipping portal containers.
|
|
150
|
+
boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : void 0
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
});
|
|
154
|
+
const setPlacementState = context.setPlacementState;
|
|
155
|
+
useLayoutEffect2(() => {
|
|
156
|
+
setPlacementState(placement);
|
|
157
|
+
return () => {
|
|
158
|
+
setPlacementState(void 0);
|
|
159
|
+
};
|
|
160
|
+
}, [placement, setPlacementState]);
|
|
161
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
162
|
+
const handlePlaced = useCallbackRef(onPlaced);
|
|
163
|
+
useLayoutEffect2(() => {
|
|
164
|
+
if (isPositioned) {
|
|
165
|
+
handlePlaced?.();
|
|
166
|
+
}
|
|
167
|
+
}, [isPositioned, handlePlaced]);
|
|
168
|
+
const arrowX = middlewareData.arrow?.x;
|
|
169
|
+
const arrowY = middlewareData.arrow?.y;
|
|
170
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
171
|
+
const [contentZIndex, setContentZIndex] = React31.useState();
|
|
172
|
+
useLayoutEffect2(() => {
|
|
173
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
174
|
+
}, [content]);
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
ref: refs.setFloating,
|
|
179
|
+
"data-radix-popper-content-wrapper": "",
|
|
180
|
+
style: {
|
|
181
|
+
...floatingStyles,
|
|
182
|
+
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
183
|
+
// keep off the page when measuring
|
|
184
|
+
minWidth: "max-content",
|
|
185
|
+
zIndex: contentZIndex,
|
|
186
|
+
"--radix-popper-transform-origin": [
|
|
187
|
+
middlewareData.transformOrigin?.x,
|
|
188
|
+
middlewareData.transformOrigin?.y
|
|
189
|
+
].join(" "),
|
|
190
|
+
// hide the content if using the hide middleware and should be hidden
|
|
191
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
192
|
+
// as if the PopperContent isn't there at all
|
|
193
|
+
...middlewareData.hide?.referenceHidden && {
|
|
194
|
+
visibility: "hidden",
|
|
195
|
+
pointerEvents: "none"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
dir: props.dir,
|
|
199
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
200
|
+
PopperContentProvider,
|
|
201
|
+
{
|
|
202
|
+
scope: __scopePopper,
|
|
203
|
+
placedSide,
|
|
204
|
+
placedAlign,
|
|
205
|
+
onArrowChange: setArrow,
|
|
206
|
+
arrowX,
|
|
207
|
+
arrowY,
|
|
208
|
+
shouldHideArrow: cannotCenterArrow,
|
|
209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
210
|
+
Primitive.div,
|
|
211
|
+
{
|
|
212
|
+
"data-side": placedSide,
|
|
213
|
+
"data-align": placedAlign,
|
|
214
|
+
...contentProps,
|
|
215
|
+
ref: composedRefs,
|
|
216
|
+
style: {
|
|
217
|
+
...contentProps.style,
|
|
218
|
+
// if the PopperContent hasn't been placed yet (not all
|
|
219
|
+
// measurements done) we prevent animations so that users'
|
|
220
|
+
// animations don't kick in too early from the wrong sides.
|
|
221
|
+
animation: !isPositioned ? "none" : contentProps.style?.animation
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
}, "PopperContent")
|
|
230
|
+
);
|
|
231
|
+
var ARROW_NAME = "PopperArrow";
|
|
232
|
+
var OPPOSITE_SIDE = {
|
|
233
|
+
top: "bottom",
|
|
234
|
+
right: "left",
|
|
235
|
+
bottom: "top",
|
|
236
|
+
left: "right"
|
|
237
|
+
};
|
|
238
|
+
var PopperArrow = /* @__PURE__ */ React31.forwardRef(
|
|
239
|
+
/* @__PURE__ */ __name20(function PopperArrow2(props, forwardedRef) {
|
|
240
|
+
const { __scopePopper, ...arrowProps } = props;
|
|
241
|
+
const contentContext = useContentContext(ARROW_NAME, __scopePopper);
|
|
242
|
+
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
243
|
+
return (
|
|
244
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
245
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
246
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
247
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
248
|
+
"span",
|
|
249
|
+
{
|
|
250
|
+
ref: contentContext.onArrowChange,
|
|
251
|
+
style: {
|
|
252
|
+
position: "absolute",
|
|
253
|
+
left: contentContext.arrowX,
|
|
254
|
+
top: contentContext.arrowY,
|
|
255
|
+
[baseSide]: 0,
|
|
256
|
+
transformOrigin: {
|
|
257
|
+
top: "",
|
|
258
|
+
right: "0 0",
|
|
259
|
+
bottom: "center 0",
|
|
260
|
+
left: "100% 0"
|
|
261
|
+
}[contentContext.placedSide],
|
|
262
|
+
transform: {
|
|
263
|
+
top: "translateY(100%)",
|
|
264
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
265
|
+
bottom: `rotate(180deg)`,
|
|
266
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
267
|
+
}[contentContext.placedSide],
|
|
268
|
+
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
269
|
+
},
|
|
270
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
271
|
+
Root,
|
|
272
|
+
{
|
|
273
|
+
...arrowProps,
|
|
274
|
+
ref: forwardedRef,
|
|
275
|
+
style: {
|
|
276
|
+
...arrowProps.style,
|
|
277
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
278
|
+
display: "block"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
}, "PopperArrow")
|
|
286
|
+
);
|
|
287
|
+
function isNotNull(value) {
|
|
288
|
+
return value !== null;
|
|
289
|
+
}
|
|
290
|
+
__name20(isNotNull, "isNotNull");
|
|
291
|
+
var transformOrigin = /* @__PURE__ */ __name20((options2) => ({
|
|
292
|
+
name: "transformOrigin",
|
|
293
|
+
options: options2,
|
|
294
|
+
fn(data) {
|
|
295
|
+
const { placement, rects, middlewareData } = data;
|
|
296
|
+
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
297
|
+
const isArrowHidden = cannotCenterArrow;
|
|
298
|
+
const arrowWidth = isArrowHidden ? 0 : options2.arrowWidth;
|
|
299
|
+
const arrowHeight = isArrowHidden ? 0 : options2.arrowHeight;
|
|
300
|
+
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
301
|
+
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
302
|
+
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
303
|
+
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
304
|
+
let x = "";
|
|
305
|
+
let y = "";
|
|
306
|
+
if (placedSide === "bottom") {
|
|
307
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
308
|
+
y = `${-arrowHeight}px`;
|
|
309
|
+
} else if (placedSide === "top") {
|
|
310
|
+
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
311
|
+
y = `${rects.floating.height + arrowHeight}px`;
|
|
312
|
+
} else if (placedSide === "right") {
|
|
313
|
+
x = `${-arrowHeight}px`;
|
|
314
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
315
|
+
} else if (placedSide === "left") {
|
|
316
|
+
x = `${rects.floating.width + arrowHeight}px`;
|
|
317
|
+
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
318
|
+
}
|
|
319
|
+
return { data: { x, y } };
|
|
320
|
+
}
|
|
321
|
+
}), "transformOrigin");
|
|
322
|
+
function getSideAndAlignFromPlacement(placement) {
|
|
323
|
+
const [side, align = "center"] = placement.split("-");
|
|
324
|
+
return [side, align];
|
|
325
|
+
}
|
|
326
|
+
__name20(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
|
|
327
|
+
var Root2 = Popper;
|
|
328
|
+
var Anchor = PopperAnchor;
|
|
329
|
+
var Content = PopperContent;
|
|
330
|
+
var Arrow3 = PopperArrow;
|
|
331
|
+
|
|
332
|
+
// ../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
333
|
+
var React33 = __toESM(require_react(), 1);
|
|
334
|
+
|
|
335
|
+
// ../../node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs
|
|
336
|
+
var React210 = __toESM(require_react(), 1);
|
|
337
|
+
var React32 = __toESM(require_react(), 1);
|
|
338
|
+
var __defProp22 = Object.defineProperty;
|
|
339
|
+
var __name21 = (target, value) => __defProp22(target, "name", { value, configurable: true });
|
|
340
|
+
var _isHydrated = false;
|
|
341
|
+
function useIsHydrated() {
|
|
342
|
+
const [isHydrated, setIsHydrated] = React32.useState(_isHydrated);
|
|
343
|
+
React32.useEffect(() => {
|
|
344
|
+
if (!_isHydrated) {
|
|
345
|
+
_isHydrated = true;
|
|
346
|
+
setIsHydrated(true);
|
|
347
|
+
}
|
|
348
|
+
}, []);
|
|
349
|
+
return isHydrated;
|
|
350
|
+
}
|
|
351
|
+
__name21(useIsHydrated, "useIsHydrated");
|
|
352
|
+
var useReactSyncExternalStore = React210[" useSyncExternalStore ".trim().toString()];
|
|
353
|
+
function subscribe() {
|
|
354
|
+
return () => {
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
__name21(subscribe, "subscribe");
|
|
358
|
+
function useIsHydratedModern() {
|
|
359
|
+
return useReactSyncExternalStore(
|
|
360
|
+
subscribe,
|
|
361
|
+
() => true,
|
|
362
|
+
() => false
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
__name21(useIsHydratedModern, "useIsHydratedModern");
|
|
366
|
+
var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
|
|
367
|
+
|
|
368
|
+
// ../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
369
|
+
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
|
|
370
|
+
var __defProp23 = Object.defineProperty;
|
|
371
|
+
var __name22 = (target, value) => __defProp23(target, "name", { value, configurable: true });
|
|
372
|
+
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
373
|
+
var EVENT_OPTIONS2 = { bubbles: false, cancelable: true };
|
|
374
|
+
var GROUP_NAME = "RovingFocusGroup";
|
|
375
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
376
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
377
|
+
GROUP_NAME,
|
|
378
|
+
[createCollectionScope]
|
|
379
|
+
);
|
|
380
|
+
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
381
|
+
var RovingFocusGroup = /* @__PURE__ */ React33.forwardRef(
|
|
382
|
+
// blank line to reduce diff noise
|
|
383
|
+
/* @__PURE__ */ __name22(function RovingFocusGroup2(props, forwardedRef) {
|
|
384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
385
|
+
}, "RovingFocusGroup")
|
|
386
|
+
);
|
|
387
|
+
var RovingFocusGroupImpl = /* @__PURE__ */ React33.forwardRef(/* @__PURE__ */ __name22(function RovingFocusGroupImpl2(props, forwardedRef) {
|
|
388
|
+
const {
|
|
389
|
+
__scopeRovingFocusGroup,
|
|
390
|
+
orientation,
|
|
391
|
+
loop = false,
|
|
392
|
+
dir,
|
|
393
|
+
currentTabStopId: currentTabStopIdProp,
|
|
394
|
+
defaultCurrentTabStopId,
|
|
395
|
+
onCurrentTabStopIdChange,
|
|
396
|
+
onEntryFocus,
|
|
397
|
+
preventScrollOnEntryFocus = false,
|
|
398
|
+
...groupProps
|
|
399
|
+
} = props;
|
|
400
|
+
const ref = React33.useRef(null);
|
|
401
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
402
|
+
const direction = useDirection(dir);
|
|
403
|
+
const [currentTabStopId, setCurrentTabStopId] = useControllableState({
|
|
404
|
+
prop: currentTabStopIdProp,
|
|
405
|
+
defaultProp: defaultCurrentTabStopId ?? null,
|
|
406
|
+
onChange: onCurrentTabStopIdChange,
|
|
407
|
+
caller: GROUP_NAME
|
|
408
|
+
});
|
|
409
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React33.useState(false);
|
|
410
|
+
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
411
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
412
|
+
const isClickFocusRef = React33.useRef(false);
|
|
413
|
+
const [focusableItemsCount, setFocusableItemsCount] = React33.useState(0);
|
|
414
|
+
React33.useEffect(() => {
|
|
415
|
+
const node = ref.current;
|
|
416
|
+
if (node) {
|
|
417
|
+
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
418
|
+
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
419
|
+
}
|
|
420
|
+
}, [handleEntryFocus]);
|
|
421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
422
|
+
RovingFocusProvider,
|
|
423
|
+
{
|
|
424
|
+
scope: __scopeRovingFocusGroup,
|
|
425
|
+
orientation,
|
|
426
|
+
dir: direction,
|
|
427
|
+
loop,
|
|
428
|
+
currentTabStopId,
|
|
429
|
+
onItemFocus: React33.useCallback(
|
|
430
|
+
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
431
|
+
[setCurrentTabStopId]
|
|
432
|
+
),
|
|
433
|
+
onItemShiftTab: React33.useCallback(() => setIsTabbingBackOut(true), []),
|
|
434
|
+
onFocusableItemAdd: React33.useCallback(
|
|
435
|
+
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
436
|
+
[]
|
|
437
|
+
),
|
|
438
|
+
onFocusableItemRemove: React33.useCallback(
|
|
439
|
+
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
440
|
+
[]
|
|
441
|
+
),
|
|
442
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
443
|
+
Primitive.div,
|
|
444
|
+
{
|
|
445
|
+
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
446
|
+
"data-orientation": orientation,
|
|
447
|
+
...groupProps,
|
|
448
|
+
ref: composedRefs,
|
|
449
|
+
style: { outline: "none", ...props.style },
|
|
450
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
451
|
+
isClickFocusRef.current = true;
|
|
452
|
+
}),
|
|
453
|
+
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
454
|
+
const isKeyboardFocus = !isClickFocusRef.current;
|
|
455
|
+
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
456
|
+
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS2);
|
|
457
|
+
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
458
|
+
if (!entryFocusEvent.defaultPrevented) {
|
|
459
|
+
const items = getItems().filter((item) => item.focusable);
|
|
460
|
+
const activeItem = items.find((item) => item.active);
|
|
461
|
+
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
462
|
+
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
463
|
+
Boolean
|
|
464
|
+
);
|
|
465
|
+
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
466
|
+
focusFirst2(candidateNodes, preventScrollOnEntryFocus);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
isClickFocusRef.current = false;
|
|
470
|
+
}),
|
|
471
|
+
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
472
|
+
}
|
|
473
|
+
)
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
}, "RovingFocusGroupImpl"));
|
|
477
|
+
var ITEM_NAME = "RovingFocusGroupItem";
|
|
478
|
+
var RovingFocusGroupItem = /* @__PURE__ */ React33.forwardRef(
|
|
479
|
+
// blank line to reduce diff noise
|
|
480
|
+
/* @__PURE__ */ __name22(function RovingFocusGroupItem2(props, forwardedRef) {
|
|
481
|
+
const {
|
|
482
|
+
__scopeRovingFocusGroup,
|
|
483
|
+
focusable = true,
|
|
484
|
+
active = false,
|
|
485
|
+
tabStopId,
|
|
486
|
+
children,
|
|
487
|
+
...itemProps
|
|
488
|
+
} = props;
|
|
489
|
+
const autoId = useId();
|
|
490
|
+
const id = tabStopId || autoId;
|
|
491
|
+
const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
492
|
+
const isCurrentTabStop = context.currentTabStopId === id;
|
|
493
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
494
|
+
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
|
|
495
|
+
const isHydrated = useIsHydrated2();
|
|
496
|
+
useLayoutEffect2(() => {
|
|
497
|
+
if (!isHydrated || !focusable) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
onFocusableItemAdd();
|
|
501
|
+
return () => onFocusableItemRemove();
|
|
502
|
+
}, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
503
|
+
React33.useEffect(() => {
|
|
504
|
+
if (isHydrated || !focusable) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
onFocusableItemAdd();
|
|
508
|
+
return () => onFocusableItemRemove();
|
|
509
|
+
}, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
511
|
+
Collection.ItemSlot,
|
|
512
|
+
{
|
|
513
|
+
scope: __scopeRovingFocusGroup,
|
|
514
|
+
id,
|
|
515
|
+
focusable,
|
|
516
|
+
active,
|
|
517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
518
|
+
Primitive.span,
|
|
519
|
+
{
|
|
520
|
+
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
521
|
+
"data-orientation": context.orientation,
|
|
522
|
+
...itemProps,
|
|
523
|
+
ref: forwardedRef,
|
|
524
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
525
|
+
if (!focusable) event.preventDefault();
|
|
526
|
+
else context.onItemFocus(id);
|
|
527
|
+
}),
|
|
528
|
+
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
529
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
530
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
531
|
+
context.onItemShiftTab();
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (event.target !== event.currentTarget) return;
|
|
535
|
+
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
536
|
+
if (focusIntent !== void 0) {
|
|
537
|
+
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
538
|
+
event.preventDefault();
|
|
539
|
+
const items = getItems().filter((item) => item.focusable);
|
|
540
|
+
let candidateNodes = items.map((item) => item.ref.current);
|
|
541
|
+
if (focusIntent === "last") candidateNodes.reverse();
|
|
542
|
+
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
543
|
+
if (focusIntent === "prev") candidateNodes.reverse();
|
|
544
|
+
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
545
|
+
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
546
|
+
}
|
|
547
|
+
setTimeout(() => focusFirst2(candidateNodes));
|
|
548
|
+
}
|
|
549
|
+
}),
|
|
550
|
+
children: typeof children === "function" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
}, "RovingFocusGroupItem")
|
|
556
|
+
);
|
|
557
|
+
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
558
|
+
ArrowLeft: "prev",
|
|
559
|
+
ArrowUp: "prev",
|
|
560
|
+
ArrowRight: "next",
|
|
561
|
+
ArrowDown: "next",
|
|
562
|
+
PageUp: "first",
|
|
563
|
+
Home: "first",
|
|
564
|
+
PageDown: "last",
|
|
565
|
+
End: "last"
|
|
566
|
+
};
|
|
567
|
+
function getDirectionAwareKey(key, dir) {
|
|
568
|
+
if (dir !== "rtl") return key;
|
|
569
|
+
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
570
|
+
}
|
|
571
|
+
__name22(getDirectionAwareKey, "getDirectionAwareKey");
|
|
572
|
+
function getFocusIntent(event, orientation, dir) {
|
|
573
|
+
const key = getDirectionAwareKey(event.key, dir);
|
|
574
|
+
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
575
|
+
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
576
|
+
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
577
|
+
}
|
|
578
|
+
__name22(getFocusIntent, "getFocusIntent");
|
|
579
|
+
function focusFirst2(candidates, preventScroll = false) {
|
|
580
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
581
|
+
for (const candidate of candidates) {
|
|
582
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
583
|
+
candidate.focus({ preventScroll });
|
|
584
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
__name22(focusFirst2, "focusFirst");
|
|
588
|
+
function wrapArray(array, startIndex) {
|
|
589
|
+
return array.map((_, index2) => array[(startIndex + index2) % array.length]);
|
|
590
|
+
}
|
|
591
|
+
__name22(wrapArray, "wrapArray");
|
|
592
|
+
var Root3 = RovingFocusGroup;
|
|
593
|
+
var Item = RovingFocusGroupItem;
|
|
594
|
+
|
|
595
|
+
// ../../node_modules/@radix-ui/react-menu/dist/index.mjs
|
|
596
|
+
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
|
|
597
|
+
var __defProp24 = Object.defineProperty;
|
|
598
|
+
var __name23 = (target, value) => __defProp24(target, "name", { value, configurable: true });
|
|
599
|
+
var SELECTION_KEYS = ["Enter", " "];
|
|
600
|
+
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
601
|
+
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
602
|
+
var FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
|
|
603
|
+
var SUB_OPEN_KEYS = {
|
|
604
|
+
ltr: [...SELECTION_KEYS, "ArrowRight"],
|
|
605
|
+
rtl: [...SELECTION_KEYS, "ArrowLeft"]
|
|
606
|
+
};
|
|
607
|
+
var SUB_CLOSE_KEYS = {
|
|
608
|
+
ltr: ["ArrowLeft"],
|
|
609
|
+
rtl: ["ArrowRight"]
|
|
610
|
+
};
|
|
611
|
+
var MENU_NAME = "Menu";
|
|
612
|
+
var [Collection2, useCollection2, createCollectionScope2] = createCollection(MENU_NAME);
|
|
613
|
+
var [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [
|
|
614
|
+
createCollectionScope2,
|
|
615
|
+
createPopperScope,
|
|
616
|
+
createRovingFocusGroupScope
|
|
617
|
+
]);
|
|
618
|
+
var usePopperScope = createPopperScope();
|
|
619
|
+
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
620
|
+
var [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);
|
|
621
|
+
var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);
|
|
622
|
+
var Menu = /* @__PURE__ */ __name23((props) => {
|
|
623
|
+
const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;
|
|
624
|
+
const popperScope = usePopperScope(__scopeMenu);
|
|
625
|
+
const [content, setContent] = React34.useState(null);
|
|
626
|
+
const isUsingKeyboardRef = React34.useRef(false);
|
|
627
|
+
const handleOpenChange = useCallbackRef(onOpenChange);
|
|
628
|
+
const direction = useDirection(dir);
|
|
629
|
+
React34.useEffect(() => {
|
|
630
|
+
const handleKeyDown = /* @__PURE__ */ __name23(() => {
|
|
631
|
+
isUsingKeyboardRef.current = true;
|
|
632
|
+
document.addEventListener("pointerdown", handlePointer, { capture: true, once: true });
|
|
633
|
+
document.addEventListener("pointermove", handlePointer, { capture: true, once: true });
|
|
634
|
+
}, "handleKeyDown");
|
|
635
|
+
const handlePointer = /* @__PURE__ */ __name23(() => isUsingKeyboardRef.current = false, "handlePointer");
|
|
636
|
+
document.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
637
|
+
return () => {
|
|
638
|
+
document.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
639
|
+
document.removeEventListener("pointerdown", handlePointer, { capture: true });
|
|
640
|
+
document.removeEventListener("pointermove", handlePointer, { capture: true });
|
|
641
|
+
};
|
|
642
|
+
}, []);
|
|
643
|
+
React34.useEffect(() => {
|
|
644
|
+
if (!open) {
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
const handleBlur = /* @__PURE__ */ __name23(() => handleOpenChange(false), "handleBlur");
|
|
648
|
+
window.addEventListener("blur", handleBlur);
|
|
649
|
+
return () => window.removeEventListener("blur", handleBlur);
|
|
650
|
+
}, [open, handleOpenChange]);
|
|
651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Root2, { ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
652
|
+
MenuProvider,
|
|
653
|
+
{
|
|
654
|
+
scope: __scopeMenu,
|
|
655
|
+
open,
|
|
656
|
+
onOpenChange: handleOpenChange,
|
|
657
|
+
content,
|
|
658
|
+
onContentChange: setContent,
|
|
659
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
660
|
+
MenuRootProvider,
|
|
661
|
+
{
|
|
662
|
+
scope: __scopeMenu,
|
|
663
|
+
onClose: React34.useCallback(() => handleOpenChange(false), [handleOpenChange]),
|
|
664
|
+
isUsingKeyboardRef,
|
|
665
|
+
dir: direction,
|
|
666
|
+
modal,
|
|
667
|
+
children
|
|
668
|
+
}
|
|
669
|
+
)
|
|
670
|
+
}
|
|
671
|
+
) });
|
|
672
|
+
}, "Menu");
|
|
673
|
+
var MenuAnchor = /* @__PURE__ */ React34.forwardRef(
|
|
674
|
+
/* @__PURE__ */ __name23(function MenuAnchor2(props, forwardedRef) {
|
|
675
|
+
const { __scopeMenu, ...anchorProps } = props;
|
|
676
|
+
const popperScope = usePopperScope(__scopeMenu);
|
|
677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
678
|
+
}, "MenuAnchor")
|
|
679
|
+
);
|
|
680
|
+
var PORTAL_NAME2 = "MenuPortal";
|
|
681
|
+
var [PortalProvider2, usePortalContext2] = createMenuContext(PORTAL_NAME2, {
|
|
682
|
+
forceMount: void 0
|
|
683
|
+
});
|
|
684
|
+
var MenuPortal = /* @__PURE__ */ __name23((props) => {
|
|
685
|
+
const { __scopeMenu, forceMount, children, container } = props;
|
|
686
|
+
const context = useMenuContext(PORTAL_NAME2, __scopeMenu);
|
|
687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PortalProvider2, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Portal, { asChild: true, container, children }) }) });
|
|
688
|
+
}, "MenuPortal");
|
|
689
|
+
var CONTENT_NAME3 = "MenuContent";
|
|
690
|
+
var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME3);
|
|
691
|
+
var MenuContent = /* @__PURE__ */ React34.forwardRef(
|
|
692
|
+
/* @__PURE__ */ __name23(function MenuContent2(props, forwardedRef) {
|
|
693
|
+
const portalContext = usePortalContext2(CONTENT_NAME3, props.__scopeMenu);
|
|
694
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
695
|
+
const context = useMenuContext(CONTENT_NAME3, props.__scopeMenu);
|
|
696
|
+
const rootContext = useMenuRootContext(CONTENT_NAME3, props.__scopeMenu);
|
|
697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Collection2.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
|
|
698
|
+
}, "MenuContent")
|
|
699
|
+
);
|
|
700
|
+
var MenuRootContentModal = /* @__PURE__ */ React34.forwardRef(
|
|
701
|
+
// blank line to reduce diff noise
|
|
702
|
+
/* @__PURE__ */ __name23(function MenuRootContentModal2(props, forwardedRef) {
|
|
703
|
+
const context = useMenuContext(CONTENT_NAME3, props.__scopeMenu);
|
|
704
|
+
const ref = React34.useRef(null);
|
|
705
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
706
|
+
React34.useEffect(() => {
|
|
707
|
+
const content = ref.current;
|
|
708
|
+
if (content) return hideOthers(content);
|
|
709
|
+
}, []);
|
|
710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
711
|
+
MenuContentImpl,
|
|
712
|
+
{
|
|
713
|
+
...props,
|
|
714
|
+
ref: composedRefs,
|
|
715
|
+
trapFocus: context.open,
|
|
716
|
+
disableOutsidePointerEvents: context.open,
|
|
717
|
+
disableOutsideScroll: true,
|
|
718
|
+
onFocusOutside: composeEventHandlers(
|
|
719
|
+
props.onFocusOutside,
|
|
720
|
+
(event) => event.preventDefault(),
|
|
721
|
+
{ checkForDefaultPrevented: false }
|
|
722
|
+
),
|
|
723
|
+
onDismiss: () => context.onOpenChange(false)
|
|
724
|
+
}
|
|
725
|
+
);
|
|
726
|
+
}, "MenuRootContentModal")
|
|
727
|
+
);
|
|
728
|
+
var MenuRootContentNonModal = /* @__PURE__ */ React34.forwardRef(/* @__PURE__ */ __name23(function MenuRootContentNonModal2(props, forwardedRef) {
|
|
729
|
+
const context = useMenuContext(CONTENT_NAME3, props.__scopeMenu);
|
|
730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
731
|
+
MenuContentImpl,
|
|
732
|
+
{
|
|
733
|
+
...props,
|
|
734
|
+
ref: forwardedRef,
|
|
735
|
+
trapFocus: false,
|
|
736
|
+
disableOutsidePointerEvents: false,
|
|
737
|
+
disableOutsideScroll: false,
|
|
738
|
+
onDismiss: () => context.onOpenChange(false)
|
|
739
|
+
}
|
|
740
|
+
);
|
|
741
|
+
}, "MenuRootContentNonModal"));
|
|
742
|
+
var Slot2 = createSlot("MenuContent.ScrollLock");
|
|
743
|
+
var MenuContentImpl = /* @__PURE__ */ React34.forwardRef(
|
|
744
|
+
// blank line to reduce diff noise
|
|
745
|
+
/* @__PURE__ */ __name23(function MenuContentImpl2(props, forwardedRef) {
|
|
746
|
+
const {
|
|
747
|
+
__scopeMenu,
|
|
748
|
+
loop = false,
|
|
749
|
+
trapFocus,
|
|
750
|
+
onOpenAutoFocus,
|
|
751
|
+
onCloseAutoFocus,
|
|
752
|
+
disableOutsidePointerEvents,
|
|
753
|
+
onEntryFocus,
|
|
754
|
+
onEscapeKeyDown,
|
|
755
|
+
onPointerDownOutside,
|
|
756
|
+
onFocusOutside,
|
|
757
|
+
onInteractOutside,
|
|
758
|
+
onDismiss,
|
|
759
|
+
disableOutsideScroll,
|
|
760
|
+
...contentProps
|
|
761
|
+
} = props;
|
|
762
|
+
const context = useMenuContext(CONTENT_NAME3, __scopeMenu);
|
|
763
|
+
const rootContext = useMenuRootContext(CONTENT_NAME3, __scopeMenu);
|
|
764
|
+
const popperScope = usePopperScope(__scopeMenu);
|
|
765
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
766
|
+
const getItems = useCollection2(__scopeMenu);
|
|
767
|
+
const [currentItemId, setCurrentItemId] = React34.useState(null);
|
|
768
|
+
const contentRef = React34.useRef(null);
|
|
769
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);
|
|
770
|
+
const timerRef = React34.useRef(0);
|
|
771
|
+
const searchRef = React34.useRef("");
|
|
772
|
+
const pointerGraceTimerRef = React34.useRef(0);
|
|
773
|
+
const pointerGraceIntentRef = React34.useRef(null);
|
|
774
|
+
const pointerDirRef = React34.useRef("right");
|
|
775
|
+
const lastPointerXRef = React34.useRef(0);
|
|
776
|
+
const ScrollLockWrapper = disableOutsideScroll ? Combination_default : React34.Fragment;
|
|
777
|
+
const scrollLockWrapperProps = disableOutsideScroll ? { as: Slot2, allowPinchZoom: true } : void 0;
|
|
778
|
+
const handleTypeaheadSearch = /* @__PURE__ */ __name23((key) => {
|
|
779
|
+
const search = searchRef.current + key;
|
|
780
|
+
const items = getItems().filter((item) => !item.disabled);
|
|
781
|
+
const currentItem = document.activeElement;
|
|
782
|
+
const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;
|
|
783
|
+
const values = items.map((item) => item.textValue);
|
|
784
|
+
const nextMatch = getNextMatch(values, search, currentMatch);
|
|
785
|
+
const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;
|
|
786
|
+
(/* @__PURE__ */ __name23((function updateSearch(value) {
|
|
787
|
+
searchRef.current = value;
|
|
788
|
+
window.clearTimeout(timerRef.current);
|
|
789
|
+
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
790
|
+
}), "updateSearch"))(search);
|
|
791
|
+
if (newItem) {
|
|
792
|
+
setTimeout(() => newItem.focus());
|
|
793
|
+
}
|
|
794
|
+
}, "handleTypeaheadSearch");
|
|
795
|
+
React34.useEffect(() => {
|
|
796
|
+
return () => window.clearTimeout(timerRef.current);
|
|
797
|
+
}, []);
|
|
798
|
+
useFocusGuards();
|
|
799
|
+
const isPointerMovingToSubmenu = React34.useCallback((event) => {
|
|
800
|
+
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
801
|
+
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
802
|
+
}, []);
|
|
803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
804
|
+
MenuContentProvider,
|
|
805
|
+
{
|
|
806
|
+
scope: __scopeMenu,
|
|
807
|
+
searchRef,
|
|
808
|
+
onItemEnter: React34.useCallback(
|
|
809
|
+
(event) => {
|
|
810
|
+
if (isPointerMovingToSubmenu(event)) event.preventDefault();
|
|
811
|
+
},
|
|
812
|
+
[isPointerMovingToSubmenu]
|
|
813
|
+
),
|
|
814
|
+
onItemLeave: React34.useCallback(
|
|
815
|
+
(event) => {
|
|
816
|
+
if (isPointerMovingToSubmenu(event)) return;
|
|
817
|
+
contentRef.current?.focus();
|
|
818
|
+
setCurrentItemId(null);
|
|
819
|
+
},
|
|
820
|
+
[isPointerMovingToSubmenu]
|
|
821
|
+
),
|
|
822
|
+
onTriggerLeave: React34.useCallback(
|
|
823
|
+
(event) => {
|
|
824
|
+
if (isPointerMovingToSubmenu(event)) event.preventDefault();
|
|
825
|
+
},
|
|
826
|
+
[isPointerMovingToSubmenu]
|
|
827
|
+
),
|
|
828
|
+
pointerGraceTimerRef,
|
|
829
|
+
onPointerGraceIntentChange: React34.useCallback((intent) => {
|
|
830
|
+
pointerGraceIntentRef.current = intent;
|
|
831
|
+
}, []),
|
|
832
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
833
|
+
FocusScope,
|
|
834
|
+
{
|
|
835
|
+
asChild: true,
|
|
836
|
+
trapped: trapFocus,
|
|
837
|
+
onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, (event) => {
|
|
838
|
+
event.preventDefault();
|
|
839
|
+
contentRef.current?.focus({ preventScroll: true });
|
|
840
|
+
}),
|
|
841
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
843
|
+
DismissableLayer,
|
|
844
|
+
{
|
|
845
|
+
asChild: true,
|
|
846
|
+
disableOutsidePointerEvents,
|
|
847
|
+
onEscapeKeyDown,
|
|
848
|
+
onPointerDownOutside,
|
|
849
|
+
onFocusOutside,
|
|
850
|
+
onInteractOutside,
|
|
851
|
+
onDismiss,
|
|
852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
853
|
+
Root3,
|
|
854
|
+
{
|
|
855
|
+
asChild: true,
|
|
856
|
+
...rovingFocusGroupScope,
|
|
857
|
+
dir: rootContext.dir,
|
|
858
|
+
orientation: "vertical",
|
|
859
|
+
loop,
|
|
860
|
+
currentTabStopId: currentItemId,
|
|
861
|
+
onCurrentTabStopIdChange: setCurrentItemId,
|
|
862
|
+
onEntryFocus: composeEventHandlers(onEntryFocus, (event) => {
|
|
863
|
+
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
864
|
+
}),
|
|
865
|
+
preventScrollOnEntryFocus: true,
|
|
866
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
867
|
+
Content,
|
|
868
|
+
{
|
|
869
|
+
role: "menu",
|
|
870
|
+
"aria-orientation": "vertical",
|
|
871
|
+
"data-state": getOpenState(context.open),
|
|
872
|
+
"data-radix-menu-content": "",
|
|
873
|
+
dir: rootContext.dir,
|
|
874
|
+
...popperScope,
|
|
875
|
+
...contentProps,
|
|
876
|
+
ref: composedRefs,
|
|
877
|
+
style: { outline: "none", ...contentProps.style },
|
|
878
|
+
onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {
|
|
879
|
+
const target = event.target;
|
|
880
|
+
const isKeyDownInside = target.closest("[data-radix-menu-content]") === event.currentTarget;
|
|
881
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
882
|
+
const isCharacterKey = event.key.length === 1;
|
|
883
|
+
if (isKeyDownInside) {
|
|
884
|
+
if (event.key === "Tab") event.preventDefault();
|
|
885
|
+
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
|
|
886
|
+
}
|
|
887
|
+
const content = contentRef.current;
|
|
888
|
+
if (event.target !== content) return;
|
|
889
|
+
if (!FIRST_LAST_KEYS.includes(event.key)) return;
|
|
890
|
+
event.preventDefault();
|
|
891
|
+
const items = getItems().filter((item) => !item.disabled);
|
|
892
|
+
const candidateNodes = items.map((item) => item.ref.current);
|
|
893
|
+
if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();
|
|
894
|
+
focusFirst3(candidateNodes);
|
|
895
|
+
}),
|
|
896
|
+
onBlur: composeEventHandlers(props.onBlur, (event) => {
|
|
897
|
+
if (!event.currentTarget.contains(event.target)) {
|
|
898
|
+
window.clearTimeout(timerRef.current);
|
|
899
|
+
searchRef.current = "";
|
|
900
|
+
}
|
|
901
|
+
}),
|
|
902
|
+
onPointerMove: composeEventHandlers(
|
|
903
|
+
props.onPointerMove,
|
|
904
|
+
whenMouse((event) => {
|
|
905
|
+
const target = event.target;
|
|
906
|
+
const pointerXHasChanged = lastPointerXRef.current !== event.clientX;
|
|
907
|
+
if (event.currentTarget.contains(target) && pointerXHasChanged) {
|
|
908
|
+
const newDir = event.clientX > lastPointerXRef.current ? "right" : "left";
|
|
909
|
+
pointerDirRef.current = newDir;
|
|
910
|
+
lastPointerXRef.current = event.clientX;
|
|
911
|
+
}
|
|
912
|
+
})
|
|
913
|
+
)
|
|
914
|
+
}
|
|
915
|
+
)
|
|
916
|
+
}
|
|
917
|
+
)
|
|
918
|
+
}
|
|
919
|
+
)
|
|
920
|
+
}
|
|
921
|
+
) })
|
|
922
|
+
}
|
|
923
|
+
);
|
|
924
|
+
}, "MenuContentImpl")
|
|
925
|
+
);
|
|
926
|
+
var MenuGroup = /* @__PURE__ */ React34.forwardRef(
|
|
927
|
+
/* @__PURE__ */ __name23(function MenuGroup2(props, forwardedRef) {
|
|
928
|
+
const { __scopeMenu, ...groupProps } = props;
|
|
929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
930
|
+
}, "MenuGroup")
|
|
931
|
+
);
|
|
932
|
+
var MenuLabel = /* @__PURE__ */ React34.forwardRef(
|
|
933
|
+
/* @__PURE__ */ __name23(function MenuLabel2(props, forwardedRef) {
|
|
934
|
+
const { __scopeMenu, ...labelProps } = props;
|
|
935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
936
|
+
}, "MenuLabel")
|
|
937
|
+
);
|
|
938
|
+
var ITEM_NAME2 = "MenuItem";
|
|
939
|
+
var ITEM_SELECT = "menu.itemSelect";
|
|
940
|
+
var MenuItem = /* @__PURE__ */ React34.forwardRef(
|
|
941
|
+
// blank line to reduce diff noise
|
|
942
|
+
/* @__PURE__ */ __name23(function MenuItem2(props, forwardedRef) {
|
|
943
|
+
const { disabled = false, onSelect, ...itemProps } = props;
|
|
944
|
+
const ref = React34.useRef(null);
|
|
945
|
+
const rootContext = useMenuRootContext(ITEM_NAME2, props.__scopeMenu);
|
|
946
|
+
const contentContext = useMenuContentContext(ITEM_NAME2, props.__scopeMenu);
|
|
947
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
948
|
+
const isPointerDownRef = React34.useRef(false);
|
|
949
|
+
const handleSelect = /* @__PURE__ */ __name23(() => {
|
|
950
|
+
const menuItem = ref.current;
|
|
951
|
+
if (!disabled && menuItem) {
|
|
952
|
+
const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });
|
|
953
|
+
menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });
|
|
954
|
+
dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);
|
|
955
|
+
if (itemSelectEvent.defaultPrevented) {
|
|
956
|
+
isPointerDownRef.current = false;
|
|
957
|
+
} else {
|
|
958
|
+
rootContext.onClose();
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}, "handleSelect");
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
963
|
+
MenuItemImpl,
|
|
964
|
+
{
|
|
965
|
+
...itemProps,
|
|
966
|
+
ref: composedRefs,
|
|
967
|
+
disabled,
|
|
968
|
+
onClick: composeEventHandlers(props.onClick, handleSelect),
|
|
969
|
+
onPointerDown: (event) => {
|
|
970
|
+
props.onPointerDown?.(event);
|
|
971
|
+
isPointerDownRef.current = true;
|
|
972
|
+
},
|
|
973
|
+
onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
|
|
974
|
+
if (!isPointerDownRef.current) event.currentTarget?.click();
|
|
975
|
+
}),
|
|
976
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
977
|
+
if (disabled || event.target !== event.currentTarget) {
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
981
|
+
if (isTypingAhead && event.key === " ") {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
if (SELECTION_KEYS.includes(event.key)) {
|
|
985
|
+
event.currentTarget.click();
|
|
986
|
+
event.preventDefault();
|
|
987
|
+
}
|
|
988
|
+
})
|
|
989
|
+
}
|
|
990
|
+
);
|
|
991
|
+
}, "MenuItem")
|
|
992
|
+
);
|
|
993
|
+
var MenuItemImpl = /* @__PURE__ */ React34.forwardRef(
|
|
994
|
+
/* @__PURE__ */ __name23(function MenuItemImpl2(props, forwardedRef) {
|
|
995
|
+
const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;
|
|
996
|
+
const contentContext = useMenuContentContext(ITEM_NAME2, __scopeMenu);
|
|
997
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
998
|
+
const ref = React34.useRef(null);
|
|
999
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
1000
|
+
const [isFocused, setIsFocused] = React34.useState(false);
|
|
1001
|
+
const [textContent, setTextContent] = React34.useState("");
|
|
1002
|
+
React34.useEffect(() => {
|
|
1003
|
+
const menuItem = ref.current;
|
|
1004
|
+
if (menuItem) {
|
|
1005
|
+
setTextContent((menuItem.textContent ?? "").trim());
|
|
1006
|
+
}
|
|
1007
|
+
}, [itemProps.children]);
|
|
1008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1009
|
+
Collection2.ItemSlot,
|
|
1010
|
+
{
|
|
1011
|
+
scope: __scopeMenu,
|
|
1012
|
+
disabled,
|
|
1013
|
+
textValue: textValue ?? textContent,
|
|
1014
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1015
|
+
Primitive.div,
|
|
1016
|
+
{
|
|
1017
|
+
role: "menuitem",
|
|
1018
|
+
"data-highlighted": isFocused ? "" : void 0,
|
|
1019
|
+
"aria-disabled": disabled || void 0,
|
|
1020
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1021
|
+
...itemProps,
|
|
1022
|
+
ref: composedRefs,
|
|
1023
|
+
onPointerMove: composeEventHandlers(
|
|
1024
|
+
props.onPointerMove,
|
|
1025
|
+
whenMouse((event) => {
|
|
1026
|
+
if (disabled) {
|
|
1027
|
+
contentContext.onItemLeave(event);
|
|
1028
|
+
} else {
|
|
1029
|
+
contentContext.onItemEnter(event);
|
|
1030
|
+
if (!event.defaultPrevented) {
|
|
1031
|
+
const item = event.currentTarget;
|
|
1032
|
+
item.focus({ preventScroll: true });
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
})
|
|
1036
|
+
),
|
|
1037
|
+
onPointerLeave: composeEventHandlers(
|
|
1038
|
+
props.onPointerLeave,
|
|
1039
|
+
whenMouse((event) => contentContext.onItemLeave(event))
|
|
1040
|
+
),
|
|
1041
|
+
onFocus: composeEventHandlers(props.onFocus, () => setIsFocused(true)),
|
|
1042
|
+
onBlur: composeEventHandlers(props.onBlur, () => setIsFocused(false))
|
|
1043
|
+
}
|
|
1044
|
+
) })
|
|
1045
|
+
}
|
|
1046
|
+
);
|
|
1047
|
+
}, "MenuItemImpl")
|
|
1048
|
+
);
|
|
1049
|
+
var MenuCheckboxItem = /* @__PURE__ */ React34.forwardRef(
|
|
1050
|
+
// blank line to reduce diff noise
|
|
1051
|
+
/* @__PURE__ */ __name23(function MenuCheckboxItem2(props, forwardedRef) {
|
|
1052
|
+
const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
|
|
1053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1054
|
+
MenuItem,
|
|
1055
|
+
{
|
|
1056
|
+
role: "menuitemcheckbox",
|
|
1057
|
+
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
|
|
1058
|
+
...checkboxItemProps,
|
|
1059
|
+
ref: forwardedRef,
|
|
1060
|
+
"data-state": getCheckedState(checked),
|
|
1061
|
+
onSelect: composeEventHandlers(
|
|
1062
|
+
checkboxItemProps.onSelect,
|
|
1063
|
+
() => onCheckedChange?.(isIndeterminate(checked) ? true : !checked),
|
|
1064
|
+
{ checkForDefaultPrevented: false }
|
|
1065
|
+
)
|
|
1066
|
+
}
|
|
1067
|
+
) });
|
|
1068
|
+
}, "MenuCheckboxItem")
|
|
1069
|
+
);
|
|
1070
|
+
var RADIO_GROUP_NAME = "MenuRadioGroup";
|
|
1071
|
+
var [RadioGroupProvider, useRadioGroupContext] = createMenuContext(
|
|
1072
|
+
RADIO_GROUP_NAME,
|
|
1073
|
+
{ value: void 0, onValueChange: /* @__PURE__ */ __name23(() => {
|
|
1074
|
+
}, "onValueChange") }
|
|
1075
|
+
);
|
|
1076
|
+
var MenuRadioGroup = /* @__PURE__ */ React34.forwardRef(
|
|
1077
|
+
/* @__PURE__ */ __name23(function MenuRadioGroup2(props, forwardedRef) {
|
|
1078
|
+
const { value, onValueChange, ...groupProps } = props;
|
|
1079
|
+
const handleValueChange = useCallbackRef(onValueChange);
|
|
1080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuGroup, { ...groupProps, ref: forwardedRef }) });
|
|
1081
|
+
}, "MenuRadioGroup")
|
|
1082
|
+
);
|
|
1083
|
+
var RADIO_ITEM_NAME = "MenuRadioItem";
|
|
1084
|
+
var MenuRadioItem = /* @__PURE__ */ React34.forwardRef(
|
|
1085
|
+
/* @__PURE__ */ __name23(function MenuRadioItem2(props, forwardedRef) {
|
|
1086
|
+
const { value, ...radioItemProps } = props;
|
|
1087
|
+
const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);
|
|
1088
|
+
const checked = value === context.value;
|
|
1089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1090
|
+
MenuItem,
|
|
1091
|
+
{
|
|
1092
|
+
role: "menuitemradio",
|
|
1093
|
+
"aria-checked": checked,
|
|
1094
|
+
...radioItemProps,
|
|
1095
|
+
ref: forwardedRef,
|
|
1096
|
+
"data-state": getCheckedState(checked),
|
|
1097
|
+
onSelect: composeEventHandlers(
|
|
1098
|
+
radioItemProps.onSelect,
|
|
1099
|
+
() => context.onValueChange?.(value),
|
|
1100
|
+
{ checkForDefaultPrevented: false }
|
|
1101
|
+
)
|
|
1102
|
+
}
|
|
1103
|
+
) });
|
|
1104
|
+
}, "MenuRadioItem")
|
|
1105
|
+
);
|
|
1106
|
+
var ITEM_INDICATOR_NAME = "MenuItemIndicator";
|
|
1107
|
+
var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(
|
|
1108
|
+
ITEM_INDICATOR_NAME,
|
|
1109
|
+
{ checked: false }
|
|
1110
|
+
);
|
|
1111
|
+
var MenuItemIndicator = /* @__PURE__ */ React34.forwardRef(
|
|
1112
|
+
// blank line to reduce diff noise
|
|
1113
|
+
/* @__PURE__ */ __name23(function MenuItemIndicator2(props, forwardedRef) {
|
|
1114
|
+
const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;
|
|
1115
|
+
const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);
|
|
1116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1117
|
+
Presence,
|
|
1118
|
+
{
|
|
1119
|
+
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
|
|
1120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1121
|
+
Primitive.span,
|
|
1122
|
+
{
|
|
1123
|
+
...itemIndicatorProps,
|
|
1124
|
+
ref: forwardedRef,
|
|
1125
|
+
"data-state": getCheckedState(indicatorContext.checked)
|
|
1126
|
+
}
|
|
1127
|
+
)
|
|
1128
|
+
}
|
|
1129
|
+
);
|
|
1130
|
+
}, "MenuItemIndicator")
|
|
1131
|
+
);
|
|
1132
|
+
var MenuSeparator = /* @__PURE__ */ React34.forwardRef(
|
|
1133
|
+
/* @__PURE__ */ __name23(function MenuSeparator2(props, forwardedRef) {
|
|
1134
|
+
const { __scopeMenu, ...separatorProps } = props;
|
|
1135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1136
|
+
Primitive.div,
|
|
1137
|
+
{
|
|
1138
|
+
role: "separator",
|
|
1139
|
+
"aria-orientation": "horizontal",
|
|
1140
|
+
...separatorProps,
|
|
1141
|
+
ref: forwardedRef
|
|
1142
|
+
}
|
|
1143
|
+
);
|
|
1144
|
+
}, "MenuSeparator")
|
|
1145
|
+
);
|
|
1146
|
+
var MenuArrow = /* @__PURE__ */ React34.forwardRef(
|
|
1147
|
+
/* @__PURE__ */ __name23(function MenuArrow2(props, forwardedRef) {
|
|
1148
|
+
const { __scopeMenu, ...arrowProps } = props;
|
|
1149
|
+
const popperScope = usePopperScope(__scopeMenu);
|
|
1150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Arrow3, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
1151
|
+
}, "MenuArrow")
|
|
1152
|
+
);
|
|
1153
|
+
var SUB_NAME = "MenuSub";
|
|
1154
|
+
var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);
|
|
1155
|
+
var MenuSub = /* @__PURE__ */ __name23((props) => {
|
|
1156
|
+
const { __scopeMenu, children, open = false, onOpenChange } = props;
|
|
1157
|
+
const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
|
|
1158
|
+
const popperScope = usePopperScope(__scopeMenu);
|
|
1159
|
+
const [trigger, setTrigger] = React34.useState(null);
|
|
1160
|
+
const [content, setContent] = React34.useState(null);
|
|
1161
|
+
const handleOpenChange = useCallbackRef(onOpenChange);
|
|
1162
|
+
React34.useEffect(() => {
|
|
1163
|
+
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
1164
|
+
return () => handleOpenChange(false);
|
|
1165
|
+
}, [parentMenuContext.open, handleOpenChange]);
|
|
1166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Root2, { ...popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1167
|
+
MenuProvider,
|
|
1168
|
+
{
|
|
1169
|
+
scope: __scopeMenu,
|
|
1170
|
+
open,
|
|
1171
|
+
onOpenChange: handleOpenChange,
|
|
1172
|
+
content,
|
|
1173
|
+
onContentChange: setContent,
|
|
1174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1175
|
+
MenuSubProvider,
|
|
1176
|
+
{
|
|
1177
|
+
scope: __scopeMenu,
|
|
1178
|
+
contentId: useId(),
|
|
1179
|
+
triggerId: useId(),
|
|
1180
|
+
trigger,
|
|
1181
|
+
onTriggerChange: setTrigger,
|
|
1182
|
+
children
|
|
1183
|
+
}
|
|
1184
|
+
)
|
|
1185
|
+
}
|
|
1186
|
+
) });
|
|
1187
|
+
}, "MenuSub");
|
|
1188
|
+
var SUB_TRIGGER_NAME = "MenuSubTrigger";
|
|
1189
|
+
var MenuSubTrigger = /* @__PURE__ */ React34.forwardRef(
|
|
1190
|
+
/* @__PURE__ */ __name23(function MenuSubTrigger2(props, forwardedRef) {
|
|
1191
|
+
const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
1192
|
+
const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
1193
|
+
const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
1194
|
+
const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
1195
|
+
const openTimerRef = React34.useRef(null);
|
|
1196
|
+
const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;
|
|
1197
|
+
const scope = { __scopeMenu: props.__scopeMenu };
|
|
1198
|
+
const clearOpenTimer = React34.useCallback(() => {
|
|
1199
|
+
if (openTimerRef.current) window.clearTimeout(openTimerRef.current);
|
|
1200
|
+
openTimerRef.current = null;
|
|
1201
|
+
}, []);
|
|
1202
|
+
React34.useEffect(() => clearOpenTimer, [clearOpenTimer]);
|
|
1203
|
+
React34.useEffect(() => {
|
|
1204
|
+
const pointerGraceTimer = pointerGraceTimerRef.current;
|
|
1205
|
+
return () => {
|
|
1206
|
+
window.clearTimeout(pointerGraceTimer);
|
|
1207
|
+
onPointerGraceIntentChange(null);
|
|
1208
|
+
};
|
|
1209
|
+
}, [pointerGraceTimerRef, onPointerGraceIntentChange]);
|
|
1210
|
+
const composedRefs = useComposedRefs(forwardedRef, subContext.onTriggerChange);
|
|
1211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1212
|
+
MenuItemImpl,
|
|
1213
|
+
{
|
|
1214
|
+
id: subContext.triggerId,
|
|
1215
|
+
"aria-haspopup": "menu",
|
|
1216
|
+
"aria-expanded": context.open,
|
|
1217
|
+
"aria-controls": context.open ? subContext.contentId : void 0,
|
|
1218
|
+
"data-state": getOpenState(context.open),
|
|
1219
|
+
...props,
|
|
1220
|
+
ref: composedRefs,
|
|
1221
|
+
onClick: (event) => {
|
|
1222
|
+
props.onClick?.(event);
|
|
1223
|
+
if (props.disabled || event.defaultPrevented) return;
|
|
1224
|
+
event.currentTarget.focus();
|
|
1225
|
+
if (!context.open) context.onOpenChange(true);
|
|
1226
|
+
},
|
|
1227
|
+
onPointerMove: composeEventHandlers(
|
|
1228
|
+
props.onPointerMove,
|
|
1229
|
+
whenMouse((event) => {
|
|
1230
|
+
contentContext.onItemEnter(event);
|
|
1231
|
+
if (event.defaultPrevented) return;
|
|
1232
|
+
if (!props.disabled && !context.open && !openTimerRef.current) {
|
|
1233
|
+
contentContext.onPointerGraceIntentChange(null);
|
|
1234
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
1235
|
+
context.onOpenChange(true);
|
|
1236
|
+
clearOpenTimer();
|
|
1237
|
+
}, 100);
|
|
1238
|
+
}
|
|
1239
|
+
})
|
|
1240
|
+
),
|
|
1241
|
+
onPointerLeave: composeEventHandlers(
|
|
1242
|
+
props.onPointerLeave,
|
|
1243
|
+
whenMouse((event) => {
|
|
1244
|
+
clearOpenTimer();
|
|
1245
|
+
const contentRect = context.content?.getBoundingClientRect();
|
|
1246
|
+
if (contentRect) {
|
|
1247
|
+
const side = context.content?.dataset.side;
|
|
1248
|
+
const rightSide = side === "right";
|
|
1249
|
+
const bleed = rightSide ? -5 : 5;
|
|
1250
|
+
const contentNearEdge = contentRect[rightSide ? "left" : "right"];
|
|
1251
|
+
const contentFarEdge = contentRect[rightSide ? "right" : "left"];
|
|
1252
|
+
contentContext.onPointerGraceIntentChange({
|
|
1253
|
+
area: [
|
|
1254
|
+
// Apply a bleed on clientX to ensure that our exit point is
|
|
1255
|
+
// consistently within polygon bounds
|
|
1256
|
+
{ x: event.clientX + bleed, y: event.clientY },
|
|
1257
|
+
{ x: contentNearEdge, y: contentRect.top },
|
|
1258
|
+
{ x: contentFarEdge, y: contentRect.top },
|
|
1259
|
+
{ x: contentFarEdge, y: contentRect.bottom },
|
|
1260
|
+
{ x: contentNearEdge, y: contentRect.bottom }
|
|
1261
|
+
],
|
|
1262
|
+
side
|
|
1263
|
+
});
|
|
1264
|
+
window.clearTimeout(pointerGraceTimerRef.current);
|
|
1265
|
+
pointerGraceTimerRef.current = window.setTimeout(
|
|
1266
|
+
() => contentContext.onPointerGraceIntentChange(null),
|
|
1267
|
+
300
|
|
1268
|
+
);
|
|
1269
|
+
} else {
|
|
1270
|
+
contentContext.onTriggerLeave(event);
|
|
1271
|
+
if (event.defaultPrevented) return;
|
|
1272
|
+
contentContext.onPointerGraceIntentChange(null);
|
|
1273
|
+
}
|
|
1274
|
+
})
|
|
1275
|
+
),
|
|
1276
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
1277
|
+
if (props.disabled || event.target !== event.currentTarget) {
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
1281
|
+
if (isTypingAhead && event.key === " ") {
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {
|
|
1285
|
+
context.onOpenChange(true);
|
|
1286
|
+
context.content?.focus();
|
|
1287
|
+
event.preventDefault();
|
|
1288
|
+
}
|
|
1289
|
+
})
|
|
1290
|
+
}
|
|
1291
|
+
) });
|
|
1292
|
+
}, "MenuSubTrigger")
|
|
1293
|
+
);
|
|
1294
|
+
var SUB_CONTENT_NAME = "MenuSubContent";
|
|
1295
|
+
var MenuSubContent = /* @__PURE__ */ React34.forwardRef(
|
|
1296
|
+
/* @__PURE__ */ __name23(function MenuSubContent2(props, forwardedRef) {
|
|
1297
|
+
const portalContext = usePortalContext2(CONTENT_NAME3, props.__scopeMenu);
|
|
1298
|
+
const { forceMount = portalContext.forceMount, align = "start", ...subContentProps } = props;
|
|
1299
|
+
const context = useMenuContext(CONTENT_NAME3, props.__scopeMenu);
|
|
1300
|
+
const rootContext = useMenuRootContext(CONTENT_NAME3, props.__scopeMenu);
|
|
1301
|
+
const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);
|
|
1302
|
+
const ref = React34.useRef(null);
|
|
1303
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
1304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Collection2.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1305
|
+
MenuContentImpl,
|
|
1306
|
+
{
|
|
1307
|
+
id: subContext.contentId,
|
|
1308
|
+
"aria-labelledby": subContext.triggerId,
|
|
1309
|
+
...subContentProps,
|
|
1310
|
+
ref: composedRefs,
|
|
1311
|
+
align,
|
|
1312
|
+
side: rootContext.dir === "rtl" ? "left" : "right",
|
|
1313
|
+
disableOutsidePointerEvents: false,
|
|
1314
|
+
disableOutsideScroll: false,
|
|
1315
|
+
trapFocus: false,
|
|
1316
|
+
onOpenAutoFocus: (event) => {
|
|
1317
|
+
if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();
|
|
1318
|
+
event.preventDefault();
|
|
1319
|
+
},
|
|
1320
|
+
onCloseAutoFocus: (event) => event.preventDefault(),
|
|
1321
|
+
onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => {
|
|
1322
|
+
if (event.target !== subContext.trigger) context.onOpenChange(false);
|
|
1323
|
+
}),
|
|
1324
|
+
onEscapeKeyDown: composeEventHandlers(props.onEscapeKeyDown, (event) => {
|
|
1325
|
+
rootContext.onClose();
|
|
1326
|
+
event.preventDefault();
|
|
1327
|
+
}),
|
|
1328
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
1329
|
+
const isKeyDownInside = event.currentTarget.contains(event.target);
|
|
1330
|
+
const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);
|
|
1331
|
+
if (isKeyDownInside && isCloseKey) {
|
|
1332
|
+
context.onOpenChange(false);
|
|
1333
|
+
subContext.trigger?.focus();
|
|
1334
|
+
event.preventDefault();
|
|
1335
|
+
}
|
|
1336
|
+
})
|
|
1337
|
+
}
|
|
1338
|
+
) }) }) });
|
|
1339
|
+
}, "MenuSubContent")
|
|
1340
|
+
);
|
|
1341
|
+
function getOpenState(open) {
|
|
1342
|
+
return open ? "open" : "closed";
|
|
1343
|
+
}
|
|
1344
|
+
__name23(getOpenState, "getOpenState");
|
|
1345
|
+
function isIndeterminate(checked) {
|
|
1346
|
+
return checked === "indeterminate";
|
|
1347
|
+
}
|
|
1348
|
+
__name23(isIndeterminate, "isIndeterminate");
|
|
1349
|
+
function getCheckedState(checked) {
|
|
1350
|
+
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
1351
|
+
}
|
|
1352
|
+
__name23(getCheckedState, "getCheckedState");
|
|
1353
|
+
function focusFirst3(candidates) {
|
|
1354
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
1355
|
+
for (const candidate of candidates) {
|
|
1356
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
1357
|
+
candidate.focus();
|
|
1358
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
__name23(focusFirst3, "focusFirst");
|
|
1362
|
+
function wrapArray2(array, startIndex) {
|
|
1363
|
+
return array.map((_, index2) => array[(startIndex + index2) % array.length]);
|
|
1364
|
+
}
|
|
1365
|
+
__name23(wrapArray2, "wrapArray");
|
|
1366
|
+
function getNextMatch(values, search, currentMatch) {
|
|
1367
|
+
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
1368
|
+
const normalizedSearch = isRepeated ? search[0] : search;
|
|
1369
|
+
const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
|
|
1370
|
+
let wrappedValues = wrapArray2(values, Math.max(currentMatchIndex, 0));
|
|
1371
|
+
const excludeCurrentMatch = normalizedSearch.length === 1;
|
|
1372
|
+
if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);
|
|
1373
|
+
const nextMatch = wrappedValues.find(
|
|
1374
|
+
(value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase())
|
|
1375
|
+
);
|
|
1376
|
+
return nextMatch !== currentMatch ? nextMatch : void 0;
|
|
1377
|
+
}
|
|
1378
|
+
__name23(getNextMatch, "getNextMatch");
|
|
1379
|
+
function isPointInPolygon(point, polygon) {
|
|
1380
|
+
const { x, y } = point;
|
|
1381
|
+
let inside = false;
|
|
1382
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
1383
|
+
const ii = polygon[i];
|
|
1384
|
+
const jj = polygon[j];
|
|
1385
|
+
const xi = ii.x;
|
|
1386
|
+
const yi = ii.y;
|
|
1387
|
+
const xj = jj.x;
|
|
1388
|
+
const yj = jj.y;
|
|
1389
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
1390
|
+
if (intersect) inside = !inside;
|
|
1391
|
+
}
|
|
1392
|
+
return inside;
|
|
1393
|
+
}
|
|
1394
|
+
__name23(isPointInPolygon, "isPointInPolygon");
|
|
1395
|
+
function isPointerInGraceArea(event, area) {
|
|
1396
|
+
if (!area) return false;
|
|
1397
|
+
const cursorPos = { x: event.clientX, y: event.clientY };
|
|
1398
|
+
return isPointInPolygon(cursorPos, area);
|
|
1399
|
+
}
|
|
1400
|
+
__name23(isPointerInGraceArea, "isPointerInGraceArea");
|
|
1401
|
+
function whenMouse(handler) {
|
|
1402
|
+
return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
|
|
1403
|
+
}
|
|
1404
|
+
__name23(whenMouse, "whenMouse");
|
|
1405
|
+
var Root32 = Menu;
|
|
1406
|
+
var Anchor2 = MenuAnchor;
|
|
1407
|
+
var Portal3 = MenuPortal;
|
|
1408
|
+
var Content2 = MenuContent;
|
|
1409
|
+
var Group = MenuGroup;
|
|
1410
|
+
var Label = MenuLabel;
|
|
1411
|
+
var Item2 = MenuItem;
|
|
1412
|
+
var CheckboxItem = MenuCheckboxItem;
|
|
1413
|
+
var RadioGroup = MenuRadioGroup;
|
|
1414
|
+
var RadioItem = MenuRadioItem;
|
|
1415
|
+
var ItemIndicator = MenuItemIndicator;
|
|
1416
|
+
var Separator = MenuSeparator;
|
|
1417
|
+
var Arrow22 = MenuArrow;
|
|
1418
|
+
var Sub = MenuSub;
|
|
1419
|
+
var SubTrigger = MenuSubTrigger;
|
|
1420
|
+
var SubContent = MenuSubContent;
|
|
1421
|
+
|
|
1422
|
+
// ../../node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
1423
|
+
var dist_exports5 = {};
|
|
1424
|
+
__export(dist_exports5, {
|
|
1425
|
+
Arrow: () => Arrow23,
|
|
1426
|
+
CheckboxItem: () => CheckboxItem2,
|
|
1427
|
+
Content: () => Content22,
|
|
1428
|
+
DropdownMenu: () => DropdownMenu,
|
|
1429
|
+
DropdownMenuArrow: () => DropdownMenuArrow,
|
|
1430
|
+
DropdownMenuCheckboxItem: () => DropdownMenuCheckboxItem,
|
|
1431
|
+
DropdownMenuContent: () => DropdownMenuContent,
|
|
1432
|
+
DropdownMenuGroup: () => DropdownMenuGroup,
|
|
1433
|
+
DropdownMenuItem: () => DropdownMenuItem,
|
|
1434
|
+
DropdownMenuItemIndicator: () => DropdownMenuItemIndicator,
|
|
1435
|
+
DropdownMenuLabel: () => DropdownMenuLabel,
|
|
1436
|
+
DropdownMenuPortal: () => DropdownMenuPortal,
|
|
1437
|
+
DropdownMenuRadioGroup: () => DropdownMenuRadioGroup,
|
|
1438
|
+
DropdownMenuRadioItem: () => DropdownMenuRadioItem,
|
|
1439
|
+
DropdownMenuSeparator: () => DropdownMenuSeparator,
|
|
1440
|
+
DropdownMenuSub: () => DropdownMenuSub,
|
|
1441
|
+
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
1442
|
+
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
1443
|
+
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
1444
|
+
Group: () => Group2,
|
|
1445
|
+
Item: () => Item22,
|
|
1446
|
+
ItemIndicator: () => ItemIndicator2,
|
|
1447
|
+
Label: () => Label2,
|
|
1448
|
+
Portal: () => Portal22,
|
|
1449
|
+
RadioGroup: () => RadioGroup2,
|
|
1450
|
+
RadioItem: () => RadioItem2,
|
|
1451
|
+
Root: () => Root22,
|
|
1452
|
+
Separator: () => Separator2,
|
|
1453
|
+
Sub: () => Sub2,
|
|
1454
|
+
SubContent: () => SubContent2,
|
|
1455
|
+
SubTrigger: () => SubTrigger2,
|
|
1456
|
+
Trigger: () => Trigger,
|
|
1457
|
+
createDropdownMenuScope: () => createDropdownMenuScope
|
|
1458
|
+
});
|
|
1459
|
+
var React35 = __toESM(require_react(), 1);
|
|
1460
|
+
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
1461
|
+
var __defProp25 = Object.defineProperty;
|
|
1462
|
+
var __name24 = (target, value) => __defProp25(target, "name", { value, configurable: true });
|
|
1463
|
+
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1464
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(
|
|
1465
|
+
DROPDOWN_MENU_NAME,
|
|
1466
|
+
[createMenuScope]
|
|
1467
|
+
);
|
|
1468
|
+
var useMenuScope = createMenuScope();
|
|
1469
|
+
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
1470
|
+
var DropdownMenu = /* @__PURE__ */ __name24((props) => {
|
|
1471
|
+
const {
|
|
1472
|
+
__scopeDropdownMenu,
|
|
1473
|
+
children,
|
|
1474
|
+
dir,
|
|
1475
|
+
open: openProp,
|
|
1476
|
+
defaultOpen,
|
|
1477
|
+
onOpenChange,
|
|
1478
|
+
modal = true
|
|
1479
|
+
} = props;
|
|
1480
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1481
|
+
const triggerRef = React35.useRef(null);
|
|
1482
|
+
const [open, setOpen] = useControllableState({
|
|
1483
|
+
prop: openProp,
|
|
1484
|
+
defaultProp: defaultOpen ?? false,
|
|
1485
|
+
onChange: onOpenChange,
|
|
1486
|
+
caller: DROPDOWN_MENU_NAME
|
|
1487
|
+
});
|
|
1488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1489
|
+
DropdownMenuProvider,
|
|
1490
|
+
{
|
|
1491
|
+
scope: __scopeDropdownMenu,
|
|
1492
|
+
triggerId: useId(),
|
|
1493
|
+
triggerRef,
|
|
1494
|
+
contentId: useId(),
|
|
1495
|
+
open,
|
|
1496
|
+
onOpenChange: setOpen,
|
|
1497
|
+
onOpenToggle: React35.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
1498
|
+
modal,
|
|
1499
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Root32, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
|
|
1500
|
+
}
|
|
1501
|
+
);
|
|
1502
|
+
}, "DropdownMenu");
|
|
1503
|
+
var TRIGGER_NAME2 = "DropdownMenuTrigger";
|
|
1504
|
+
var DropdownMenuTrigger = /* @__PURE__ */ React35.forwardRef(
|
|
1505
|
+
// blank line to reduce diff noise
|
|
1506
|
+
/* @__PURE__ */ __name24(function DropdownMenuTrigger2(props, forwardedRef) {
|
|
1507
|
+
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
1508
|
+
const context = useDropdownMenuContext(TRIGGER_NAME2, __scopeDropdownMenu);
|
|
1509
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1510
|
+
const composedRefs = useComposedRefs(forwardedRef, context.triggerRef);
|
|
1511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1512
|
+
Primitive.button,
|
|
1513
|
+
{
|
|
1514
|
+
type: "button",
|
|
1515
|
+
id: context.triggerId,
|
|
1516
|
+
"aria-haspopup": "menu",
|
|
1517
|
+
"aria-expanded": context.open,
|
|
1518
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
|
1519
|
+
"data-state": context.open ? "open" : "closed",
|
|
1520
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1521
|
+
disabled,
|
|
1522
|
+
...triggerProps,
|
|
1523
|
+
ref: composedRefs,
|
|
1524
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
1525
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
1526
|
+
context.onOpenToggle();
|
|
1527
|
+
if (!context.open) event.preventDefault();
|
|
1528
|
+
}
|
|
1529
|
+
}),
|
|
1530
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
1531
|
+
if (disabled) return;
|
|
1532
|
+
if (["Enter", " "].includes(event.key)) context.onOpenToggle();
|
|
1533
|
+
if (event.key === "ArrowDown") context.onOpenChange(true);
|
|
1534
|
+
if (["Enter", " ", "ArrowDown"].includes(event.key)) event.preventDefault();
|
|
1535
|
+
})
|
|
1536
|
+
}
|
|
1537
|
+
) });
|
|
1538
|
+
}, "DropdownMenuTrigger")
|
|
1539
|
+
);
|
|
1540
|
+
var DropdownMenuPortal = /* @__PURE__ */ __name24((props) => {
|
|
1541
|
+
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
1542
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Portal3, { ...menuScope, ...portalProps });
|
|
1544
|
+
}, "DropdownMenuPortal");
|
|
1545
|
+
var CONTENT_NAME4 = "DropdownMenuContent";
|
|
1546
|
+
var DropdownMenuContent = /* @__PURE__ */ React35.forwardRef(
|
|
1547
|
+
// blank line to reduce diff noise
|
|
1548
|
+
/* @__PURE__ */ __name24(function DropdownMenuContent2(props, forwardedRef) {
|
|
1549
|
+
const { __scopeDropdownMenu, ...contentProps } = props;
|
|
1550
|
+
const context = useDropdownMenuContext(CONTENT_NAME4, __scopeDropdownMenu);
|
|
1551
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1552
|
+
const hasInteractedOutsideRef = React35.useRef(false);
|
|
1553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1554
|
+
Content2,
|
|
1555
|
+
{
|
|
1556
|
+
id: context.contentId,
|
|
1557
|
+
"aria-labelledby": context.triggerId,
|
|
1558
|
+
...menuScope,
|
|
1559
|
+
...contentProps,
|
|
1560
|
+
ref: forwardedRef,
|
|
1561
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1562
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
1563
|
+
hasInteractedOutsideRef.current = false;
|
|
1564
|
+
event.preventDefault();
|
|
1565
|
+
}),
|
|
1566
|
+
onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {
|
|
1567
|
+
const originalEvent = event.detail.originalEvent;
|
|
1568
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
1569
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
1570
|
+
if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;
|
|
1571
|
+
}),
|
|
1572
|
+
style: {
|
|
1573
|
+
...props.style,
|
|
1574
|
+
// re-namespace exposed content custom properties
|
|
1575
|
+
...{
|
|
1576
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1577
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1578
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1579
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1580
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
);
|
|
1585
|
+
}, "DropdownMenuContent")
|
|
1586
|
+
);
|
|
1587
|
+
var DropdownMenuGroup = /* @__PURE__ */ React35.forwardRef(
|
|
1588
|
+
// blank line to reduce diff noise
|
|
1589
|
+
/* @__PURE__ */ __name24(function DropdownMenuGroup2(props, forwardedRef) {
|
|
1590
|
+
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
1591
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
1593
|
+
}, "DropdownMenuGroup")
|
|
1594
|
+
);
|
|
1595
|
+
var DropdownMenuLabel = /* @__PURE__ */ React35.forwardRef(
|
|
1596
|
+
// blank line to reduce diff noise
|
|
1597
|
+
/* @__PURE__ */ __name24(function DropdownMenuLabel2(props, forwardedRef) {
|
|
1598
|
+
const { __scopeDropdownMenu, ...labelProps } = props;
|
|
1599
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
1601
|
+
}, "DropdownMenuLabel")
|
|
1602
|
+
);
|
|
1603
|
+
var DropdownMenuItem = /* @__PURE__ */ React35.forwardRef(
|
|
1604
|
+
// blank line to reduce diff noise
|
|
1605
|
+
/* @__PURE__ */ __name24(function DropdownMenuItem2(props, forwardedRef) {
|
|
1606
|
+
const { __scopeDropdownMenu, ...itemProps } = props;
|
|
1607
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Item2, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
1609
|
+
}, "DropdownMenuItem")
|
|
1610
|
+
);
|
|
1611
|
+
var DropdownMenuCheckboxItem = /* @__PURE__ */ React35.forwardRef(/* @__PURE__ */ __name24(function DropdownMenuCheckboxItem2(props, forwardedRef) {
|
|
1612
|
+
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
|
1613
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
1615
|
+
}, "DropdownMenuCheckboxItem"));
|
|
1616
|
+
var DropdownMenuRadioGroup = /* @__PURE__ */ React35.forwardRef(/* @__PURE__ */ __name24(function DropdownMenuRadioGroup2(props, forwardedRef) {
|
|
1617
|
+
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
1618
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
1620
|
+
}, "DropdownMenuRadioGroup"));
|
|
1621
|
+
var DropdownMenuRadioItem = /* @__PURE__ */ React35.forwardRef(/* @__PURE__ */ __name24(function DropdownMenuRadioItem2(props, forwardedRef) {
|
|
1622
|
+
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
1623
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
1625
|
+
}, "DropdownMenuRadioItem"));
|
|
1626
|
+
var DropdownMenuItemIndicator = /* @__PURE__ */ React35.forwardRef(/* @__PURE__ */ __name24(function DropdownMenuItemIndicator2(props, forwardedRef) {
|
|
1627
|
+
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
1628
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
1630
|
+
}, "DropdownMenuItemIndicator"));
|
|
1631
|
+
var DropdownMenuSeparator = /* @__PURE__ */ React35.forwardRef(/* @__PURE__ */ __name24(function DropdownMenuSeparator2(props, forwardedRef) {
|
|
1632
|
+
const { __scopeDropdownMenu, ...separatorProps } = props;
|
|
1633
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
1635
|
+
}, "DropdownMenuSeparator"));
|
|
1636
|
+
var DropdownMenuArrow = /* @__PURE__ */ React35.forwardRef(
|
|
1637
|
+
// blank line to reduce diff noise
|
|
1638
|
+
/* @__PURE__ */ __name24(function DropdownMenuArrow2(props, forwardedRef) {
|
|
1639
|
+
const { __scopeDropdownMenu, ...arrowProps } = props;
|
|
1640
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Arrow22, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
1642
|
+
}, "DropdownMenuArrow")
|
|
1643
|
+
);
|
|
1644
|
+
var DropdownMenuSub = /* @__PURE__ */ __name24((props) => {
|
|
1645
|
+
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
1646
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1647
|
+
const [open, setOpen] = useControllableState({
|
|
1648
|
+
prop: openProp,
|
|
1649
|
+
defaultProp: defaultOpen ?? false,
|
|
1650
|
+
onChange: onOpenChange,
|
|
1651
|
+
caller: "DropdownMenuSub"
|
|
1652
|
+
});
|
|
1653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
1654
|
+
}, "DropdownMenuSub");
|
|
1655
|
+
var DropdownMenuSubTrigger = /* @__PURE__ */ React35.forwardRef(/* @__PURE__ */ __name24(function DropdownMenuSubTrigger2(props, forwardedRef) {
|
|
1656
|
+
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
1657
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
|
|
1659
|
+
}, "DropdownMenuSubTrigger"));
|
|
1660
|
+
var DropdownMenuSubContent = /* @__PURE__ */ React35.forwardRef(/* @__PURE__ */ __name24(function DropdownMenuSubContent2(props, forwardedRef) {
|
|
1661
|
+
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
1662
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1664
|
+
SubContent,
|
|
1665
|
+
{
|
|
1666
|
+
...menuScope,
|
|
1667
|
+
...subContentProps,
|
|
1668
|
+
ref: forwardedRef,
|
|
1669
|
+
style: {
|
|
1670
|
+
...props.style,
|
|
1671
|
+
// re-namespace exposed content custom properties
|
|
1672
|
+
...{
|
|
1673
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1674
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1675
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1676
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1677
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
);
|
|
1682
|
+
}, "DropdownMenuSubContent"));
|
|
1683
|
+
var Root22 = DropdownMenu;
|
|
1684
|
+
var Trigger = DropdownMenuTrigger;
|
|
1685
|
+
var Portal22 = DropdownMenuPortal;
|
|
1686
|
+
var Content22 = DropdownMenuContent;
|
|
1687
|
+
var Group2 = DropdownMenuGroup;
|
|
1688
|
+
var Label2 = DropdownMenuLabel;
|
|
1689
|
+
var Item22 = DropdownMenuItem;
|
|
1690
|
+
var CheckboxItem2 = DropdownMenuCheckboxItem;
|
|
1691
|
+
var RadioGroup2 = DropdownMenuRadioGroup;
|
|
1692
|
+
var RadioItem2 = DropdownMenuRadioItem;
|
|
1693
|
+
var ItemIndicator2 = DropdownMenuItemIndicator;
|
|
1694
|
+
var Separator2 = DropdownMenuSeparator;
|
|
1695
|
+
var Arrow23 = DropdownMenuArrow;
|
|
1696
|
+
var Sub2 = DropdownMenuSub;
|
|
1697
|
+
var SubTrigger2 = DropdownMenuSubTrigger;
|
|
1698
|
+
var SubContent2 = DropdownMenuSubContent;
|