@uniqbit/mate-core 1.0.0-canary.3 → 1.0.0-canary.6
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/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/claude-capability-plugins/companion-mentions/hooks/register.ts +1 -1
- package/claude-plugin/hooks/hooks.json +61 -1
- package/claude-plugin/hooks/rtk-worktree-git.mjs +58 -0
- package/claude-plugin/hooks/session-attention.mjs +10 -0
- package/claude-plugin/hooks/session-end.mjs +9 -0
- package/claude-plugin/hooks/session-guidance.mjs +1 -1
- package/claude-plugin/hooks/workflow-turn.mjs +68 -0
- package/opencode-plugin/src/companion.ts +6 -0
- package/opencode-plugin/src/server.ts +46 -4
- package/package.json +5 -2
- package/src/cli/commands/artifact/apply-context.ts +1 -0
- package/src/cli/commands/artifact/artifact.ts +16 -0
- package/src/cli/commands/artifact/delivery/archive.ts +37 -112
- package/src/cli/commands/artifact/delivery/branch-flags.ts +19 -1
- package/src/cli/commands/artifact/delivery/environment.ts +32 -72
- package/src/cli/commands/artifact/delivery/link.ts +69 -33
- package/src/cli/commands/artifact/delivery/output.ts +34 -5
- package/src/cli/commands/artifact/delivery/resolve.ts +101 -0
- package/src/cli/commands/artifact/delivery/submit.ts +164 -0
- package/src/cli/commands/artifact/delivery/take.ts +45 -0
- package/src/cli/commands/artifact/extract-repo-name.ts +1 -1
- package/src/cli/commands/artifact/finish/command.ts +455 -43
- package/src/cli/commands/artifact/finish/engine.ts +79 -61
- package/src/cli/commands/artifact/finish/finisher.ts +5 -12
- package/src/cli/commands/artifact/finish/git.ts +9 -10
- package/src/cli/commands/artifact/finish/openspec.ts +22 -177
- package/src/cli/commands/artifact/finish/secret-scan.ts +5 -43
- package/src/cli/commands/artifact/finish/worktree-cleanup.ts +57 -7
- package/src/cli/commands/artifact/pending/command.ts +119 -6
- package/src/cli/commands/artifact/pending/discovery.ts +7 -11
- package/src/cli/commands/artifact/project/command.ts +60 -0
- package/src/cli/commands/companion/companion.ts +1 -1
- package/src/cli/commands/companion/link.ts +36 -4
- package/src/cli/commands/companion/list.ts +70 -14
- package/src/cli/commands/companion/open.ts +40 -12
- package/src/cli/commands/companion/sync.ts +18 -0
- package/src/cli/commands/companion/update.ts +4 -19
- package/src/cli/commands/doctor.ts +122 -0
- package/src/cli/commands/install.ts +48 -36
- package/src/cli/commands/launch/claude.ts +2 -0
- package/src/cli/commands/launch/shared.ts +33 -6
- package/src/cli/commands/plugin/install.ts +27 -11
- package/src/cli/commands/report/index.ts +180 -184
- package/src/cli/commands/report/markdown.ts +67 -72
- package/src/cli/commands/session/prepare.ts +32 -4
- package/src/cli/commands/session/registry.ts +90 -0
- package/src/cli/commands/shared/companion-selection.ts +3 -1
- package/src/cli/commands/studio/access.ts +6 -14
- package/src/cli/commands/studio/areas.ts +112 -33
- package/src/cli/commands/studio/companion-add.ts +72 -0
- package/src/cli/commands/studio/companion-removal.ts +86 -0
- package/src/cli/commands/studio/graph-model.ts +61 -0
- package/src/cli/commands/studio/graph.ts +336 -0
- package/src/cli/commands/studio/index.ts +4 -4
- package/src/{lib/factory/outcomes/sessions.ts → cli/commands/studio/live-sessions.ts} +26 -2
- package/src/cli/commands/studio/mate-inventory.ts +1 -1
- package/src/cli/commands/studio/payload.ts +223 -30
- package/src/cli/commands/studio/reports.ts +19 -18
- package/src/cli/commands/studio/routes.ts +5 -18
- package/src/cli/commands/studio/selection.ts +12 -5
- package/src/cli/commands/studio/server.ts +321 -198
- package/src/cli/commands/studio/service-host.ts +266 -0
- package/src/cli/commands/studio/services.ts +54 -16
- package/src/cli/commands/studio/skill-files.ts +133 -0
- package/src/cli/commands/studio/studio-app.ts +1 -0
- package/src/cli/commands/studio/terminal.ts +45 -3
- package/src/cli/commands/studio/vault.ts +259 -84
- package/src/cli/commands/studio/views/model.ts +1 -14
- package/src/cli/commands/studio/views/vault/markdown-tree.ts +343 -10
- package/src/cli/commands/unwrap.ts +11 -0
- package/src/cli/commands/update.ts +28 -8
- package/src/cli/commands/vscode/release-vsix.json +4 -0
- package/src/cli/commands/vscode/setup.ts +213 -0
- package/src/cli/commands/vscode/vsix.ts +114 -0
- package/src/cli/commands/workflow/workflow.ts +516 -0
- package/src/cli/commands/working/cleanup.ts +73 -17
- package/src/cli/commands/working/worktree.ts +227 -36
- package/src/cli/commands/wrap.ts +33 -7
- package/src/cli/main.ts +48 -12
- package/src/cli/repo-list-table.tsx +73 -37
- package/src/cli/usage.ts +25 -9
- package/src/factory-host.ts +69 -0
- package/src/hooks/companion-instructions.ts +35 -16
- package/src/hooks/hook-io.ts +18 -1
- package/src/hooks/rtk-worktree-git.ts +48 -0
- package/src/hooks/session-banner.ts +30 -3
- package/src/hooks/session-end.ts +10 -0
- package/src/hooks/session-guidance.ts +10 -6
- package/src/hooks/session-prepare.ts +47 -31
- package/src/hooks/session-register.ts +199 -0
- package/src/hooks/tokensave-route.ts +7 -3
- package/src/hooks/validate-artifact-path.ts +53 -14
- package/src/hooks/workflow-turn.ts +219 -0
- package/src/lib/apply-context/fingerprint.ts +2 -1
- package/src/lib/apply-context/protocol.ts +2 -2
- package/src/lib/artifact-trailer.ts +27 -0
- package/src/lib/change-layout.ts +83 -38
- package/src/lib/delivery/branch-template.ts +114 -0
- package/src/lib/delivery/branches.ts +34 -14
- package/src/lib/delivery/checkout.ts +103 -0
- package/src/lib/delivery/environment.ts +131 -7
- package/src/lib/delivery/merge-git.ts +282 -26
- package/src/lib/delivery/overlap.ts +68 -16
- package/src/lib/delivery/record-delivery.ts +253 -57
- package/src/lib/delivery/record.ts +229 -53
- package/src/lib/delivery/refresh.ts +222 -141
- package/src/lib/delivery/remote.ts +66 -0
- package/src/lib/delivery/repository-access.ts +19 -60
- package/src/lib/delivery/resolve-branch.ts +318 -50
- package/src/lib/delivery/stages.ts +83 -50
- package/src/lib/delivery/staging/apply-chain.ts +164 -0
- package/src/lib/delivery/staging/artifact-type.ts +101 -0
- package/src/lib/delivery/staging/declared-type.ts +277 -0
- package/src/lib/delivery/staging/naming.ts +64 -0
- package/src/lib/delivery/staging/openspec-type.ts +135 -0
- package/src/lib/delivery/staging/pending-edit.ts +291 -0
- package/src/lib/delivery/staging/pending.ts +780 -0
- package/src/lib/delivery/staging/project.ts +373 -0
- package/src/lib/delivery/staging/publish.ts +1024 -0
- package/src/lib/delivery/staging/refs.ts +258 -0
- package/src/lib/delivery/staging/registry.ts +73 -0
- package/src/lib/delivery/staging/replay.ts +308 -0
- package/src/lib/delivery/staging/requirement-blocks.ts +10 -0
- package/src/lib/delivery/staging/resolve.ts +264 -0
- package/src/lib/delivery/staging/settle-linked.ts +290 -0
- package/src/lib/delivery/staging/submit.ts +929 -0
- package/src/lib/delivery/staging/worktree.ts +130 -0
- package/src/lib/delivery/submit-change.ts +443 -0
- package/src/lib/git-key.ts +15 -0
- package/src/lib/install.ts +2 -0
- package/src/lib/opencode-server.ts +238 -0
- package/src/lib/openspec-canonical-frontmatter.ts +159 -0
- package/src/lib/orchestrator/adapters/base.ts +31 -20
- package/src/lib/orchestrator/adapters/claude.ts +162 -4
- package/src/lib/orchestrator/adapters/opencode.ts +55 -2
- package/src/lib/orchestrator/checkout-adoption.ts +125 -0
- package/src/lib/orchestrator/companion-git-sync.ts +152 -16
- package/src/lib/orchestrator/companion-hub.ts +6 -1
- package/src/lib/orchestrator/companion-registry-store.ts +6 -2
- package/src/lib/orchestrator/editor.ts +2 -2
- package/src/lib/orchestrator/engine-floor.ts +48 -0
- package/src/lib/orchestrator/framework-context.ts +41 -15
- package/src/lib/orchestrator/global-config-store.ts +11 -0
- package/src/lib/orchestrator/launcher.ts +49 -3
- package/src/lib/orchestrator/projection-claude-commands.ts +2 -2
- package/src/lib/orchestrator/projection-claude-entry.ts +42 -21
- package/src/lib/orchestrator/projection-claude-links.ts +83 -11
- package/src/lib/orchestrator/projection-claude-skills.ts +30 -4
- package/src/lib/orchestrator/projection-companion-link.ts +12 -1
- package/src/lib/orchestrator/projection-entries.ts +22 -18
- package/src/lib/orchestrator/projection-opencode-copies.ts +65 -21
- package/src/lib/orchestrator/projection-runtime-documents.ts +66 -43
- package/src/lib/orchestrator/projection-types.ts +28 -1
- package/src/lib/orchestrator/refresh-working-claude-links.ts +4 -1
- package/src/lib/orchestrator/registry-checkouts.ts +177 -0
- package/src/lib/orchestrator/repository-link.ts +216 -57
- package/src/lib/orchestrator/serving-claude-wrap.ts +43 -0
- package/src/lib/orchestrator/session-context-link.ts +11 -5
- package/src/lib/orchestrator/session-prepare.ts +53 -8
- package/src/lib/orchestrator/setup-compatibilities.ts +1 -1
- package/src/lib/orchestrator/types.ts +9 -0
- package/src/lib/orchestrator/umbrella-checkouts.ts +102 -0
- package/src/lib/orchestrator/working-repo-projection.ts +24 -4
- package/src/lib/orchestrator/workspace-inventory.ts +5 -1
- package/src/lib/orchestrator/wrap-pass.ts +1 -0
- package/src/lib/prebuilt-workspace-prepare.ts +2 -1
- package/src/lib/prebuilt-workspace.ts +1 -0
- package/src/lib/public-npm.ts +105 -43
- package/src/lib/session-attribution.ts +52 -0
- package/src/lib/session-state.ts +356 -0
- package/src/lib/session-stop.ts +64 -0
- package/src/lib/update-checker.ts +7 -1
- package/src/lib/usage/aggregate.ts +202 -0
- package/src/lib/usage/cache.ts +87 -0
- package/src/lib/usage/claude-pricing.ts +71 -0
- package/src/lib/usage/claude.ts +189 -0
- package/src/lib/usage/collect.ts +56 -0
- package/src/lib/usage/opencode.ts +188 -0
- package/src/lib/usage/records.ts +80 -0
- package/src/lib/usage/rtk-database.ts +72 -0
- package/src/lib/usage/savings.ts +209 -0
- package/src/lib/usage/scope.ts +182 -0
- package/src/lib/usage/source.ts +102 -0
- package/src/lib/usage/types.ts +143 -0
- package/src/lib/usage/window.ts +37 -0
- package/src/lib/workflow/declaration.ts +6 -0
- package/src/lib/workflow/handoff.ts +90 -0
- package/src/lib/workflow/hook-trust.ts +108 -0
- package/src/lib/workflow/position.ts +524 -0
- package/src/lib/workflow/report.ts +79 -0
- package/src/lib/workflow/work.ts +106 -0
- package/src/lib/workset/factory-local.ts +157 -0
- package/src/lib/workset/record.ts +45 -11
- package/src/lib/workset/repositories.ts +118 -25
- package/src/lib/workset/stage.ts +4 -2
- package/src/lib/workset/stages.ts +64 -4
- package/src/lib/workset/worktree-include.ts +161 -0
- package/src/lib/workset/worktree-index.ts +6 -2
- package/src/lib/workset/worktree.ts +665 -89
- package/src/opencode/background-server.ts +145 -0
- package/src/opencode/companion-hooks.ts +55 -14
- package/src/opencode/companion-policy.ts +20 -7
- package/src/opencode/enter-worktree.ts +254 -6
- package/src/opencode/projected-guidance.ts +7 -3
- package/src/opencode/session-register.ts +176 -0
- package/src/opencode/turn-hook.ts +241 -0
- package/src/playbooks/companion-guidance.ts +6 -3
- package/src/plugin-api.ts +42 -0
- package/src/runtime/artifact-trailers.ts +63 -0
- package/src/runtime/claude-bg-isolation.ts +138 -0
- package/src/runtime/claude-delivery-plan.ts +14 -3
- package/src/runtime/claude-hook-group.ts +2 -0
- package/src/runtime/companion-git-state.ts +155 -10
- package/src/runtime/companion-git.ts +96 -13
- package/src/runtime/companion-guidance.ts +107 -8
- package/src/runtime/companion-instructions.ts +1 -1
- package/src/runtime/companion-sync.ts +109 -21
- package/src/runtime/current-branch.ts +24 -0
- package/src/runtime/entered-worktree.ts +24 -0
- package/src/runtime/env-names.ts +2 -2
- package/src/runtime/env.ts +16 -9
- package/src/runtime/forge-remote.ts +48 -0
- package/src/runtime/git-layout.ts +185 -24
- package/src/runtime/git-tracked.ts +60 -0
- package/src/runtime/json-fields.ts +8 -0
- package/src/runtime/launch-env-guard.ts +65 -0
- package/src/runtime/opencode-server-record.ts +136 -0
- package/src/runtime/pending-records.ts +533 -0
- package/src/runtime/projected-guidance.ts +6 -2
- package/src/runtime/projection.ts +40 -6
- package/src/runtime/publication-secret-scan.ts +45 -0
- package/src/runtime/repo-destination.ts +72 -0
- package/src/runtime/repo-local.ts +29 -2
- package/src/runtime/rtk-git-guard.ts +66 -0
- package/src/runtime/runtime-document-manifest.ts +229 -19
- package/src/runtime/runtime-document-manifest.typecheck.ts +10 -0
- package/src/runtime/secret-guard.ts +9 -2
- package/src/runtime/secret-patterns.ts +3 -2
- package/src/runtime/secret-policy-weakening.ts +122 -0
- package/src/runtime/serving-claude-wrap.ts +41 -0
- package/src/runtime/session-context.ts +4 -3
- package/src/runtime/session-registry.ts +434 -0
- package/src/runtime/skill-prefix.ts +75 -0
- package/src/runtime/submitted-arrivals.ts +547 -0
- package/src/runtime/tokensave-route.ts +10 -5
- package/src/runtime/turn-state.d.mts +14 -0
- package/src/runtime/turn-state.mjs +93 -0
- package/src/runtime/umbrella-children.ts +52 -0
- package/src/runtime/umbrella-folder.ts +84 -0
- package/src/runtime/workflow/change-folders.ts +66 -0
- package/src/runtime/workflow/declaration.ts +720 -0
- package/src/runtime/workflow/globs.ts +85 -0
- package/src/runtime/workflow/next-handoff-process.ts +98 -0
- package/src/runtime/workflow/turn.ts +309 -0
- package/src/runtime/workflow/workflow.ts +262 -0
- package/src/runtime/wrap-state.ts +36 -13
- package/src/studio.ts +73 -19
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/schema.yaml +3 -3
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/design.md +1 -1
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/proposal.md +1 -1
- package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/tasks.md +1 -1
- package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +3 -3
- package/src/templates/mate-skills/agents/mate-apply-change/SKILL.md +147 -46
- package/src/templates/mate-skills/agents/mate-apply-change/references/openspec-apply-change.md +1 -1
- package/src/templates/mate-skills/agents/mate-archive-change/SKILL.md +7 -75
- package/src/templates/mate-skills/agents/mate-clarify-intent/SKILL.md +13 -7
- package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +10 -0
- package/src/templates/mate-skills/agents/mate-explore-change/SKILL.md +46 -14
- package/src/templates/mate-skills/agents/mate-propose-change/SKILL.md +51 -38
- package/src/templates/mate-skills/agents/mate-propose-change/references/mate-revise.md +14 -10
- package/src/templates/mate-skills/agents/mate-propose-change/references/openspec-update-change.md +1 -1
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +113 -87
- package/src/templates/mate-skills/agents/mate-publish-artifact/references/openspec.md +111 -100
- package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +11 -5
- package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +16 -6
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +114 -0
- package/src/templates/mate-skills/claude/mate-apply-change/SKILL.md +147 -46
- package/src/templates/mate-skills/claude/mate-apply-change/references/openspec-apply-change.md +1 -1
- package/src/templates/mate-skills/claude/mate-archive-change/SKILL.md +7 -75
- package/src/templates/mate-skills/claude/mate-clarify-intent/SKILL.md +13 -7
- package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +10 -0
- package/src/templates/mate-skills/claude/mate-explore-change/SKILL.md +46 -14
- package/src/templates/mate-skills/claude/mate-propose-change/SKILL.md +51 -38
- package/src/templates/mate-skills/claude/mate-propose-change/references/mate-revise.md +14 -10
- package/src/templates/mate-skills/claude/mate-propose-change/references/openspec-update-change.md +1 -1
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +113 -87
- package/src/templates/mate-skills/claude/mate-publish-artifact/references/openspec.md +111 -100
- package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +11 -5
- package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +16 -6
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +114 -0
- package/src/templates/mate-skills/openspec-references.ts +3 -2
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +1301 -154
- package/src/tools/setup/capabilities/openspec.ts +54 -15
- package/src/tools/setup/capabilities/rtk.ts +98 -5
- package/src/tools/setup/capabilities/tokensave.ts +3 -2
- package/src/tools/setup/dynamic-plugins/api.ts +38 -0
- package/src/tools/setup/dynamic-plugins/audiences.ts +65 -21
- package/src/tools/setup/dynamic-plugins/frozen.ts +32 -13
- package/src/tools/setup/dynamic-plugins/host.ts +2 -32
- package/src/tools/setup/dynamic-plugins/hydrate.ts +8 -7
- package/src/tools/setup/dynamic-plugins/install.ts +24 -22
- package/src/tools/setup/dynamic-plugins/loader.ts +11 -7
- package/src/tools/setup/dynamic-plugins/paths.ts +30 -10
- package/src/tools/setup/dynamic-plugins/verify.ts +10 -7
- package/src/tools/setup/dynamic-plugins/workspaces.ts +153 -0
- package/src/tools/setup/engine.ts +20 -1
- package/src/tools/setup/mate.ts +5 -3
- package/src/tools/setup/package-managers/bun.ts +8 -8
- package/src/tools/setup/plugin.ts +9 -1
- package/src/tools/setup/plugins/gitignore.ts +15 -9
- package/src/tools/setup/plugins/guidance.ts +4 -2
- package/src/tools/setup/providers/claude-plugin-hooks.ts +56 -0
- package/src/tools/setup/providers/claude.ts +64 -7
- package/src/tools/setup/service-registry.ts +69 -0
- package/src/tools/setup/service.ts +233 -0
- package/src/tools/setup/utils.ts +28 -5
- package/src/tools/setup/working-repo-cleanup.ts +2 -2
- package/src/tools/setup/working-repo-local-state.ts +2 -0
- package/src/tools/setup.ts +25 -14
- package/studio-dist/client/assets/app-BFVyWHGo.css +2 -0
- package/studio-dist/client/assets/button-D6LrRkOG.js +1 -0
- package/studio-dist/client/assets/combobox-Dk2MMZWE.js +1 -0
- package/studio-dist/client/assets/companion-view-BVaZNtiI.js +1 -0
- package/studio-dist/client/assets/fields-D_FYhxQr.js +1 -0
- package/studio-dist/client/assets/getting-started-ByWRg7hC.js +1 -0
- package/studio-dist/client/assets/getting-started-DZSjYC-b.js +1 -0
- package/studio-dist/client/assets/getting-started._topic-C6OyQ4G6.js +1 -0
- package/studio-dist/client/assets/getting-started.index-BkmPHdEm.js +1 -0
- package/studio-dist/client/assets/graph-7jm2XzyL.js +2 -0
- package/studio-dist/client/assets/graph-canvas-DDuzsNSx.js +3242 -0
- package/studio-dist/client/assets/guides-D9VTjWXP.js +1 -0
- package/studio-dist/client/assets/index-BBmFpG4y.js +40 -0
- package/studio-dist/client/assets/jsx-runtime-MZURdZre.js +1 -0
- package/studio-dist/client/assets/markdown-view-RL5YvfZg.js +1 -0
- package/studio-dist/client/assets/panel-B8F8sOKQ.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-CynxTbMx.js +1 -0
- package/studio-dist/client/assets/queries-axYk2u9L.js +1 -0
- package/studio-dist/client/assets/react-r45OnJCw.js +27 -0
- package/studio-dist/client/assets/reports-BCAyXh6p.js +1 -0
- package/studio-dist/client/assets/routes-BFPqq89E.js +1 -0
- package/studio-dist/client/assets/skills-DTks_uBx.js +1 -0
- package/studio-dist/client/assets/specs-DU1kqcp5.js +1 -0
- package/studio-dist/client/assets/specs-view-omrd_5P3.js +1 -0
- package/studio-dist/client/assets/steps-DhIFuAZy.js +1 -0
- package/studio-dist/client/assets/store-DJ5cncKA.js +1 -0
- package/studio-dist/client/assets/studio-BR9j15J0.js +100 -0
- package/studio-dist/client/assets/studio-queries-CFP_yTpr.js +2 -0
- package/studio-dist/client/assets/usage-CHmwtkoM.js +55 -0
- package/studio-dist/client/assets/useBaseQuery-BlC-AZ35.js +1 -0
- package/studio-dist/client/assets/useSelector-AYcH7lB0.js +2 -0
- package/studio-dist/client/assets/vault-DRg8MScm.js +1 -0
- package/studio-dist/client/assets/warnings-UHFy6HAp.js +1 -0
- package/studio-dist/client/assets/workflow-Bv9vSfVV.js +1 -0
- package/studio-dist/server/assets/__23tanstack-start-server-fn-resolver-DAbZ6fzY.js +106 -0
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +86 -31
- package/studio-dist/server/assets/button-BfoNadNR.js +8193 -0
- package/studio-dist/server/assets/combobox-oxUI6r4V.js +2089 -0
- package/studio-dist/server/assets/{companion-view-aBady57v.js → companion-view-DHUjPpA0.js} +13 -7
- package/studio-dist/server/assets/companions-kBrJZAd6.js +31 -0
- package/studio-dist/server/assets/{createServerRpc-tK2lE9R2.js → createServerRpc-bFKFpGFG.js} +1 -1
- package/studio-dist/server/assets/fields-BD_c65T1.js +1190 -0
- package/studio-dist/server/assets/getting-started-7P0oyWaM.js +67 -0
- package/studio-dist/server/assets/getting-started-B136TP57.js +4 -0
- package/studio-dist/server/assets/getting-started._topic-B1mV0kGz.js +13 -0
- package/studio-dist/server/assets/getting-started.index-CeGtvUsm.js +13 -0
- package/studio-dist/server/assets/graph-BWtmJOH2.js +16 -0
- package/studio-dist/server/assets/graph-DSDVEELZ.js +801 -0
- package/studio-dist/server/assets/graph-canvas-CID9Nksc.js +21066 -0
- package/studio-dist/server/assets/graph-wire-BdSUx0G5.js +58 -0
- package/studio-dist/server/assets/guides-BLJenHwQ.js +5 -0
- package/studio-dist/server/assets/guides-Bm3RbUB-.js +13 -0
- package/studio-dist/server/assets/guides.server-rHHqRuzV.js +66 -0
- package/studio-dist/server/assets/jsx-runtime-Bt0s0YKS.js +451 -0
- package/studio-dist/server/assets/markdown-view-D3v9x-cM.js +105 -0
- package/studio-dist/server/assets/panel-yqOl5GMU.js +169 -0
- package/studio-dist/server/assets/plugins._service._view-DwqJX7s9.js +92 -0
- package/studio-dist/server/assets/queries-DYmGrhNO.js +32 -0
- package/studio-dist/server/assets/react-BO0uMhpm.js +89 -0
- package/studio-dist/server/assets/redirect-BaZ_QyqF.js +39 -0
- package/studio-dist/server/assets/reports-7yaPz7aP.js +147 -0
- package/studio-dist/server/assets/reports-C4Y_Jd-x.js +18 -0
- package/studio-dist/server/assets/router-Dnoq5auE.js +12844 -0
- package/studio-dist/server/assets/routes-Cok4p3mK.js +768 -0
- package/studio-dist/server/assets/{search-JAKurDNh.js → search-DUK7Jl6f.js} +21 -2
- package/studio-dist/server/assets/{shell-CboT2f66.js → shell-DNVXedgE.js} +16 -6
- package/studio-dist/server/assets/skills-D8qdXSku.js +267 -0
- package/studio-dist/server/assets/skills-pKmuAs0F.js +28 -0
- package/studio-dist/server/assets/specs-DeHYUNFp.js +51 -0
- package/studio-dist/server/assets/specs-view-BGn-5Ik_.js +425 -0
- package/studio-dist/server/assets/{start-BW5ovN0k.js → start-h3ICWwd2.js} +4 -1
- package/studio-dist/server/assets/steps-CV7Yk7L7.js +224 -0
- package/studio-dist/server/assets/store-CWDGIp6x.js +280 -0
- package/studio-dist/server/assets/studio-CB94np48.js +10437 -0
- package/studio-dist/server/assets/studio-queries-BqZGBE70.js +1335 -0
- package/studio-dist/server/assets/usage-M6Gi6Km7.js +25584 -0
- package/studio-dist/server/assets/usage-j5jR9gX9.js +24 -0
- package/studio-dist/server/assets/{studio-queries-CLnP9kGu.js → useBaseQuery-Tv_QJt9r.js} +4 -1318
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-BQKuMdJW.js → useSelector-DUmCUXAs.js} +4 -498
- package/studio-dist/server/assets/vault-PqVmssmW.js +1035 -0
- package/studio-dist/server/assets/{vault-BGulVoNh.js → vault-lBlvSyD4.js} +19 -4
- package/studio-dist/server/assets/{views-Bd7cRr27.js → views-CsFp1i1G.js} +10 -9
- package/studio-dist/server/assets/warnings-BDs34j_m.js +24 -0
- package/studio-dist/server/assets/workflow-T0eEldsa.js +687 -0
- package/studio-dist/server/server.js +429 -9
- package/src/cli/commands/factory/factory.ts +0 -301
- package/src/cli/commands/report/collector.ts +0 -288
- package/src/cli/commands/studio/factory-credential.ts +0 -49
- package/src/cli/commands/studio/workset-session.ts +0 -131
- package/src/lib/delivery/archive-change.ts +0 -166
- package/src/lib/delivery/forge.ts +0 -279
- package/src/lib/delivery/token.ts +0 -24
- package/src/lib/factory/attach-client.ts +0 -113
- package/src/lib/factory/attach.ts +0 -178
- package/src/lib/factory/broker.ts +0 -190
- package/src/lib/factory/bun-commands.ts +0 -39
- package/src/lib/factory/client.ts +0 -92
- package/src/lib/factory/command.ts +0 -61
- package/src/lib/factory/credential-store.ts +0 -153
- package/src/lib/factory/frames.ts +0 -77
- package/src/lib/factory/ids.ts +0 -58
- package/src/lib/factory/outcomes/actions.ts +0 -114
- package/src/lib/factory/outcomes/index.ts +0 -381
- package/src/lib/factory/outcomes/lifecycle.ts +0 -205
- package/src/lib/factory/outcomes/runs.ts +0 -81
- package/src/lib/factory/prepare.ts +0 -49
- package/src/lib/factory/pty.ts +0 -103
- package/src/lib/factory/runner/companion-context.ts +0 -178
- package/src/lib/factory/runner/control.ts +0 -92
- package/src/lib/factory/runner/harness-agent.ts +0 -250
- package/src/lib/factory/runner/live.ts +0 -159
- package/src/lib/factory/runner/questions.ts +0 -22
- package/src/lib/factory/runner/rank.ts +0 -26
- package/src/lib/factory/runner/run-policy.ts +0 -12
- package/src/lib/factory/runner/run.ts +0 -199
- package/src/lib/factory/runner/scheduler.ts +0 -416
- package/src/lib/factory/runner/state.ts +0 -233
- package/src/lib/factory/runner/workflow.ts +0 -542
- package/src/lib/factory/runtime.ts +0 -972
- package/src/lib/factory/sandbox.ts +0 -292
- package/src/lib/factory/worktree-branch.ts +0 -17
- package/src/templates/capabilities/openspec-cap/mate-v1/templates/explore-brief.md +0 -25
- package/studio-dist/client/assets/companion-view-Csva26Ir.js +0 -1
- package/studio-dist/client/assets/delivery-path-DJMpRmiY.js +0 -1
- package/studio-dist/client/assets/factory-B7l9ZQyx.js +0 -4
- package/studio-dist/client/assets/index-n6uo_92S.js +0 -40
- package/studio-dist/client/assets/prepaint-CD5OpmTM.js +0 -24
- package/studio-dist/client/assets/queries-CN3JwMBX.js +0 -1
- package/studio-dist/client/assets/react-CabXf2Ds.js +0 -1
- package/studio-dist/client/assets/report-time-Dc-KOqQu.js +0 -1
- package/studio-dist/client/assets/reports-C01RsnMA.js +0 -1
- package/studio-dist/client/assets/rolldown-runtime-WkwZ5CU-.js +0 -1
- package/studio-dist/client/assets/routes-4pbC-2Hj.js +0 -1
- package/studio-dist/client/assets/skills-CihQganl.js +0 -1
- package/studio-dist/client/assets/spec-areas-C2L48N4C.js +0 -1
- package/studio-dist/client/assets/specs-D24_35_K.js +0 -1
- package/studio-dist/client/assets/studio-DKxfi691.css +0 -1
- package/studio-dist/client/assets/studio-queries-rvbJupCy.js +0 -3
- package/studio-dist/client/assets/vault-Bd4CQiTK.js +0 -1
- package/studio-dist/client/assets/warnings-V_Ys51wJ.js +0 -1
- package/studio-dist/client/assets/workflow-BJejeVwQ.js +0 -1
- package/studio-dist/server/assets/actions-Bvgj9eb8.js +0 -54
- package/studio-dist/server/assets/createServerFn-F5sAOF8V.js +0 -459
- package/studio-dist/server/assets/delivery-path-BkKNjgkf.js +0 -778
- package/studio-dist/server/assets/factory-D6xnjedJ.js +0 -2385
- package/studio-dist/server/assets/factory-DT3UzHlh.js +0 -68
- package/studio-dist/server/assets/prepaint-BMke0fo1.js +0 -41
- package/studio-dist/server/assets/queries-Ag2iL8q2.js +0 -107
- package/studio-dist/server/assets/react-COs0LHn-.js +0 -51
- package/studio-dist/server/assets/report-time-DAfzln-N.js +0 -8
- package/studio-dist/server/assets/reports-BnUNJVtx.js +0 -126
- package/studio-dist/server/assets/rolldown-runtime-DYf_mQCB.js +0 -34
- package/studio-dist/server/assets/router-BH--drIx.js +0 -4298
- package/studio-dist/server/assets/routes-khSDK1bV.js +0 -361
- package/studio-dist/server/assets/skills-MWYnWoKs.js +0 -106
- package/studio-dist/server/assets/spec-areas-DcnO6vW-.js +0 -16
- package/studio-dist/server/assets/specs-DE3w8hZP.js +0 -155
- package/studio-dist/server/assets/studio-BeltxxKt.js +0 -216
- package/studio-dist/server/assets/vault-CuyyhLyB.js +0 -832
- package/studio-dist/server/assets/warnings-BH05rOuG.js +0 -15
- package/studio-dist/server/assets/workflow-BSuIKWqH.js +0 -42
- /package/src/lib/{factory/keyed-serial.ts → keyed-serial.ts} +0 -0
- /package/src/templates/capabilities/openspec-cap/{mate-v1 → mate-full}/templates/spec.md +0 -0
|
@@ -0,0 +1,1190 @@
|
|
|
1
|
+
import { n as require_react, o as __toESM, t as require_jsx_runtime } from "./jsx-runtime-Bt0s0YKS.js";
|
|
2
|
+
import { B as FocusGuard, Bt as stopEvent, Dn as focusOut, E as resolveRef, Fn as none, G as useValueAsRef, Hn as createChangeEventDetails, Ht as getNodeChildren, J as Timeout, Jn as useIsoLayoutEffect, K as mergeCleanups, Kn as ownerDocument, Kt as isTypeableCombobox, P as usePortalContext, Rt as isVirtualClick, Sr as useBaseUiId, Tr as cn, U as AnimationFrame, Ut as getFloatingFocusElement, Vt as getNodeAncestors, W as useAnimationFrame, Y as useTimeout, Yn as useStableCallback, _n as webkit, _r as EMPTY_OBJECT, at as getNextTabbable, br as useMergedRefs, ct as isOutsideEvent, dn as activeElement, er as getNodeName, fn as closest, ht as isElementVisible, ir as getWindow, it as focusable, j as useFloatingTree, lr as isOverflowElement, lt as isTabbable, mn as getTarget, mr as useRenderElement, ot as getPreviousTabbable, pn as contains, q as addEventListener, qn as formatErrorMessage, qt as isTypeableElement, sr as isHTMLElement, ur as isShadowRoot, ut as tabbable, vr as NOOP, xr as useRefWithInit, yn as ios, yr as isReactVersionAtLeast, z as createAttribute, zt as isVirtualPointerEvent } from "./button-BfoNadNR.js";
|
|
3
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs
|
|
4
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
5
|
+
var rafId = 0;
|
|
6
|
+
function enqueueFocus(el, options = {}) {
|
|
7
|
+
const { preventScroll = false, sync = false, shouldFocus } = options;
|
|
8
|
+
cancelAnimationFrame(rafId);
|
|
9
|
+
function exec() {
|
|
10
|
+
if (shouldFocus && !shouldFocus()) return;
|
|
11
|
+
el?.focus({ preventScroll });
|
|
12
|
+
}
|
|
13
|
+
if (sync) {
|
|
14
|
+
exec();
|
|
15
|
+
return NOOP;
|
|
16
|
+
}
|
|
17
|
+
const currentRafId = requestAnimationFrame(exec);
|
|
18
|
+
rafId = currentRafId;
|
|
19
|
+
return () => {
|
|
20
|
+
if (rafId === currentRafId) {
|
|
21
|
+
cancelAnimationFrame(currentRafId);
|
|
22
|
+
rafId = 0;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs
|
|
27
|
+
var markerName = "data-base-ui-inert";
|
|
28
|
+
var ariaHiddenCounterMap = /* @__PURE__ */ new WeakMap();
|
|
29
|
+
var uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
|
|
30
|
+
var markerCounterMap = /* @__PURE__ */ new WeakMap();
|
|
31
|
+
var lockCount = 0;
|
|
32
|
+
function unwrapHost(node) {
|
|
33
|
+
if (!node) return null;
|
|
34
|
+
return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);
|
|
35
|
+
}
|
|
36
|
+
var correctElements = (parent, targets) => targets.map((target) => {
|
|
37
|
+
if (parent.contains(target)) return target;
|
|
38
|
+
const correctedTarget = unwrapHost(target);
|
|
39
|
+
if (parent.contains(correctedTarget)) return correctedTarget;
|
|
40
|
+
return null;
|
|
41
|
+
}).filter((x) => x != null);
|
|
42
|
+
var buildKeepSet = (targets) => {
|
|
43
|
+
const keep = /* @__PURE__ */ new Set();
|
|
44
|
+
targets.forEach((target) => {
|
|
45
|
+
let node = target;
|
|
46
|
+
while (node && !keep.has(node)) {
|
|
47
|
+
keep.add(node);
|
|
48
|
+
node = node.parentNode;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return keep;
|
|
52
|
+
};
|
|
53
|
+
var collectOutsideElements = (root, keepElements, stopElements) => {
|
|
54
|
+
const outside = [];
|
|
55
|
+
const walk = (parent) => {
|
|
56
|
+
if (!parent || stopElements.has(parent)) return;
|
|
57
|
+
Array.from(parent.children).forEach((node) => {
|
|
58
|
+
if (getNodeName(node) === "script") return;
|
|
59
|
+
if (keepElements.has(node)) walk(node);
|
|
60
|
+
else outside.push(node);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
walk(root);
|
|
64
|
+
return outside;
|
|
65
|
+
};
|
|
66
|
+
function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, { mark = true }) {
|
|
67
|
+
const avoidElements = correctElements(body, uncorrectedAvoidElements);
|
|
68
|
+
const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];
|
|
69
|
+
const hiddenElements = [];
|
|
70
|
+
const markedElements = [];
|
|
71
|
+
if (ariaHidden) {
|
|
72
|
+
const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll("[aria-live]")));
|
|
73
|
+
const controlElements = avoidElements.concat(ariaLiveElements);
|
|
74
|
+
collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements)).forEach((node) => {
|
|
75
|
+
const attr = node.getAttribute("aria-hidden");
|
|
76
|
+
const alreadyHidden = attr !== null && attr !== "false";
|
|
77
|
+
const counterValue = (ariaHiddenCounterMap.get(node) || 0) + 1;
|
|
78
|
+
ariaHiddenCounterMap.set(node, counterValue);
|
|
79
|
+
hiddenElements.push(node);
|
|
80
|
+
if (counterValue === 1 && alreadyHidden) uncontrolledElementsSet.add(node);
|
|
81
|
+
if (!alreadyHidden) node.setAttribute("aria-hidden", "true");
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (mark) markerTargets.forEach((node) => {
|
|
85
|
+
const markerValue = (markerCounterMap.get(node) || 0) + 1;
|
|
86
|
+
markerCounterMap.set(node, markerValue);
|
|
87
|
+
markedElements.push(node);
|
|
88
|
+
if (markerValue === 1) node.setAttribute(markerName, "");
|
|
89
|
+
});
|
|
90
|
+
lockCount += 1;
|
|
91
|
+
return () => {
|
|
92
|
+
hiddenElements.forEach((element) => {
|
|
93
|
+
const counterValue = (ariaHiddenCounterMap.get(element) || 0) - 1;
|
|
94
|
+
ariaHiddenCounterMap.set(element, counterValue);
|
|
95
|
+
if (!counterValue) {
|
|
96
|
+
if (!uncontrolledElementsSet.has(element)) element.removeAttribute("aria-hidden");
|
|
97
|
+
uncontrolledElementsSet.delete(element);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (mark) markedElements.forEach((element) => {
|
|
101
|
+
const markerValue = (markerCounterMap.get(element) || 0) - 1;
|
|
102
|
+
markerCounterMap.set(element, markerValue);
|
|
103
|
+
if (!markerValue) element.removeAttribute(markerName);
|
|
104
|
+
});
|
|
105
|
+
lockCount -= 1;
|
|
106
|
+
if (!lockCount) {
|
|
107
|
+
ariaHiddenCounterMap = /* @__PURE__ */ new WeakMap();
|
|
108
|
+
uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
|
|
109
|
+
markerCounterMap = /* @__PURE__ */ new WeakMap();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function markOthers(avoidElements, options = {}) {
|
|
114
|
+
const { ariaHidden = false, mark = true } = options;
|
|
115
|
+
const body = ownerDocument(avoidElements[0]).body;
|
|
116
|
+
return applyAttributeToOthers(avoidElements, body, ariaHidden, { mark });
|
|
117
|
+
}
|
|
118
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs
|
|
119
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
120
|
+
function getEventType(event, lastInteractionType) {
|
|
121
|
+
const win = getWindow(getTarget(event));
|
|
122
|
+
if (event instanceof win.KeyboardEvent) return "keyboard";
|
|
123
|
+
if (event instanceof win.FocusEvent) return lastInteractionType || "keyboard";
|
|
124
|
+
if ("pointerType" in event) return event.pointerType || (isVirtualClick(event) ? "keyboard" : lastInteractionType || "mouse");
|
|
125
|
+
if ("touches" in event) return "touch";
|
|
126
|
+
if (event instanceof win.MouseEvent) return lastInteractionType || (event.detail === 0 ? "keyboard" : "mouse");
|
|
127
|
+
return "";
|
|
128
|
+
}
|
|
129
|
+
var LIST_LIMIT = 20;
|
|
130
|
+
var previouslyFocusedElements = [];
|
|
131
|
+
function clearDisconnectedPreviouslyFocusedElements() {
|
|
132
|
+
previouslyFocusedElements = previouslyFocusedElements.filter((entry) => {
|
|
133
|
+
return entry.deref()?.isConnected;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function addPreviouslyFocusedElement(element) {
|
|
137
|
+
clearDisconnectedPreviouslyFocusedElements();
|
|
138
|
+
if (element && getNodeName(element) !== "body") {
|
|
139
|
+
previouslyFocusedElements.push(new WeakRef(element));
|
|
140
|
+
if (previouslyFocusedElements.length > LIST_LIMIT) previouslyFocusedElements = previouslyFocusedElements.slice(-20);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function getPreviouslyFocusedElement() {
|
|
144
|
+
clearDisconnectedPreviouslyFocusedElements();
|
|
145
|
+
return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();
|
|
146
|
+
}
|
|
147
|
+
function getFirstTabbableElement(container) {
|
|
148
|
+
if (!container) return null;
|
|
149
|
+
if (isTabbable(container)) return container;
|
|
150
|
+
return tabbable(container)[0] || container;
|
|
151
|
+
}
|
|
152
|
+
function handleTabIndex(floatingFocusElement) {
|
|
153
|
+
if (floatingFocusElement.hasAttribute("tabindex") && !floatingFocusElement.hasAttribute("data-tabindex")) return;
|
|
154
|
+
if (!floatingFocusElement.getAttribute("role")?.includes("dialog")) return;
|
|
155
|
+
const tabbableContent = focusable(floatingFocusElement).filter((element) => {
|
|
156
|
+
const dataTabIndex = element.getAttribute("data-tabindex") || "";
|
|
157
|
+
return isTabbable(element) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-");
|
|
158
|
+
});
|
|
159
|
+
const tabIndex = floatingFocusElement.getAttribute("tabindex");
|
|
160
|
+
if (tabbableContent.length === 0) {
|
|
161
|
+
if (tabIndex !== "0") {
|
|
162
|
+
floatingFocusElement.setAttribute("tabindex", "0");
|
|
163
|
+
floatingFocusElement.setAttribute("data-tabindex", "0");
|
|
164
|
+
}
|
|
165
|
+
} else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") {
|
|
166
|
+
floatingFocusElement.setAttribute("tabindex", "-1");
|
|
167
|
+
floatingFocusElement.setAttribute("data-tabindex", "-1");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Provides focus management for the floating element.
|
|
172
|
+
* @see https://floating-ui.com/docs/FloatingFocusManager
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
function FloatingFocusManager(props) {
|
|
176
|
+
const { context: store, children, disabled = false, initialFocus = true, returnFocus = true, explicitReturnFocus, restoreFocus = false, modal = true, closeOnFocusOut = true, openInteractionType = "", nextFocusableElement, previousFocusableElement, beforeContentFocusGuardRef, externalTree, getInsideElements } = props;
|
|
177
|
+
const open = store.useState("open");
|
|
178
|
+
const domReference = store.useState("domReferenceElement");
|
|
179
|
+
const floating = store.useState("floatingElement");
|
|
180
|
+
const { events, dataRef } = store.context;
|
|
181
|
+
const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);
|
|
182
|
+
const ignoreInitialFocus = initialFocus === false;
|
|
183
|
+
const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;
|
|
184
|
+
const initialFocusRef = useValueAsRef(initialFocus);
|
|
185
|
+
const returnFocusRef = useValueAsRef(returnFocus);
|
|
186
|
+
const explicitReturnFocusRef = useValueAsRef(explicitReturnFocus);
|
|
187
|
+
const openInteractionTypeRef = useValueAsRef(openInteractionType);
|
|
188
|
+
const openRef = useValueAsRef(open);
|
|
189
|
+
const tree = useFloatingTree(externalTree);
|
|
190
|
+
const portalContext = usePortalContext();
|
|
191
|
+
const preventReturnFocusRef = import_react.useRef(false);
|
|
192
|
+
const isPointerDownRef = import_react.useRef(false);
|
|
193
|
+
const pointerDownOutsideRef = import_react.useRef(false);
|
|
194
|
+
const lastFocusedTabbableRef = import_react.useRef(null);
|
|
195
|
+
const closeTypeRef = import_react.useRef("");
|
|
196
|
+
const lastInteractionTypeRef = import_react.useRef("");
|
|
197
|
+
const beforeGuardRef = import_react.useRef(null);
|
|
198
|
+
const afterGuardRef = import_react.useRef(null);
|
|
199
|
+
const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);
|
|
200
|
+
const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);
|
|
201
|
+
const blurTimeout = useTimeout();
|
|
202
|
+
const pointerDownTimeout = useTimeout();
|
|
203
|
+
const restoreFocusFrame = useAnimationFrame();
|
|
204
|
+
const isInsidePortal = portalContext != null;
|
|
205
|
+
const floatingFocusElement = getFloatingFocusElement(floating);
|
|
206
|
+
const getTabbableContent = useStableCallback((container = floatingFocusElement) => {
|
|
207
|
+
return container ? tabbable(container) : [];
|
|
208
|
+
});
|
|
209
|
+
const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter((element) => element != null) ?? []);
|
|
210
|
+
import_react.useEffect(() => {
|
|
211
|
+
if (disabled || !modal) return;
|
|
212
|
+
function onKeyDown(event) {
|
|
213
|
+
if (event.key === "Tab") {
|
|
214
|
+
if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) stopEvent(event);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
218
|
+
return addEventListener(doc, "keydown", onKeyDown);
|
|
219
|
+
}, [
|
|
220
|
+
disabled,
|
|
221
|
+
floatingFocusElement,
|
|
222
|
+
modal,
|
|
223
|
+
isUntrappedTypeableCombobox,
|
|
224
|
+
getTabbableContent
|
|
225
|
+
]);
|
|
226
|
+
import_react.useEffect(() => {
|
|
227
|
+
if (disabled || !open) return;
|
|
228
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
229
|
+
function clearPointerDownOutside() {
|
|
230
|
+
pointerDownOutsideRef.current = false;
|
|
231
|
+
}
|
|
232
|
+
function onPointerDown(event) {
|
|
233
|
+
const target = getTarget(event);
|
|
234
|
+
const insideElements = getResolvedInsideElements();
|
|
235
|
+
const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element) => element === target || contains(element, target));
|
|
236
|
+
pointerDownOutsideRef.current = !pointerTargetInside;
|
|
237
|
+
lastInteractionTypeRef.current = event.pointerType || "keyboard";
|
|
238
|
+
if (closest(target, `[data-base-ui-click-trigger]`)) {
|
|
239
|
+
isPointerDownRef.current = true;
|
|
240
|
+
pointerDownTimeout.start(0, () => {
|
|
241
|
+
isPointerDownRef.current = false;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function onKeyDown() {
|
|
246
|
+
lastInteractionTypeRef.current = "keyboard";
|
|
247
|
+
}
|
|
248
|
+
return mergeCleanups(addEventListener(doc, "pointerdown", onPointerDown, true), addEventListener(doc, "pointerup", clearPointerDownOutside, true), addEventListener(doc, "pointercancel", clearPointerDownOutside, true), addEventListener(doc, "keydown", onKeyDown, true), clearPointerDownOutside);
|
|
249
|
+
}, [
|
|
250
|
+
disabled,
|
|
251
|
+
floating,
|
|
252
|
+
domReference,
|
|
253
|
+
floatingFocusElement,
|
|
254
|
+
open,
|
|
255
|
+
portalContext,
|
|
256
|
+
pointerDownTimeout,
|
|
257
|
+
getResolvedInsideElements
|
|
258
|
+
]);
|
|
259
|
+
import_react.useEffect(() => {
|
|
260
|
+
if (disabled || !closeOnFocusOut) return;
|
|
261
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
262
|
+
function handlePointerDown() {
|
|
263
|
+
isPointerDownRef.current = true;
|
|
264
|
+
pointerDownTimeout.start(0, () => {
|
|
265
|
+
isPointerDownRef.current = false;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function handleFocusIn(event) {
|
|
269
|
+
const target = getTarget(event);
|
|
270
|
+
if (isTabbable(target)) lastFocusedTabbableRef.current = target;
|
|
271
|
+
}
|
|
272
|
+
function handleFocusOutside(event) {
|
|
273
|
+
const relatedTarget = event.relatedTarget;
|
|
274
|
+
const currentTarget = event.currentTarget;
|
|
275
|
+
const target = getTarget(event);
|
|
276
|
+
if (modal && relatedTarget == null && target != null && contains(floating, target)) addPreviouslyFocusedElement(target);
|
|
277
|
+
queueMicrotask(() => {
|
|
278
|
+
const nodeId = getNodeId();
|
|
279
|
+
const triggers = store.context.triggerElements;
|
|
280
|
+
const insideElements = getResolvedInsideElements();
|
|
281
|
+
const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute("focus-guard")) && [
|
|
282
|
+
beforeGuardRef.current,
|
|
283
|
+
afterGuardRef.current,
|
|
284
|
+
portalContext?.beforeInsideRef.current,
|
|
285
|
+
portalContext?.afterInsideRef.current,
|
|
286
|
+
portalContext?.beforeOutsideRef.current,
|
|
287
|
+
portalContext?.afterOutsideRef.current,
|
|
288
|
+
resolveRef(previousFocusableElement),
|
|
289
|
+
resolveRef(nextFocusableElement)
|
|
290
|
+
].includes(relatedTarget);
|
|
291
|
+
const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element) => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement((trigger) => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node) => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node) => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));
|
|
292
|
+
if (currentTarget === domReference && floatingFocusElement) handleTabIndex(floatingFocusElement);
|
|
293
|
+
if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {
|
|
294
|
+
if (isHTMLElement(floatingFocusElement)) {
|
|
295
|
+
floatingFocusElement.focus();
|
|
296
|
+
if (restoreFocus === "popup") {
|
|
297
|
+
restoreFocusFrame.request(() => {
|
|
298
|
+
floatingFocusElement.focus();
|
|
299
|
+
});
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const tabbableContent = getTabbableContent();
|
|
304
|
+
const prevTabbable = lastFocusedTabbableRef.current;
|
|
305
|
+
const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
|
|
306
|
+
if (isHTMLElement(nodeToFocus)) nodeToFocus.focus();
|
|
307
|
+
}
|
|
308
|
+
if (dataRef.current.insideReactTree) {
|
|
309
|
+
dataRef.current.insideReactTree = false;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && (isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {
|
|
313
|
+
preventReturnFocusRef.current = true;
|
|
314
|
+
store.setOpen(false, createChangeEventDetails(focusOut, event));
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
function markInsideReactTree() {
|
|
319
|
+
if (pointerDownOutsideRef.current) return;
|
|
320
|
+
dataRef.current.insideReactTree = true;
|
|
321
|
+
blurTimeout.start(0, () => {
|
|
322
|
+
dataRef.current.insideReactTree = false;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
const domReferenceElement = isHTMLElement(domReference) ? domReference : null;
|
|
326
|
+
if (!floating && !domReferenceElement) return;
|
|
327
|
+
return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, "focusout", handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, "pointerdown", handlePointerDown), floating && addEventListener(floating, "focusin", handleFocusIn), floating && addEventListener(floating, "focusout", handleFocusOutside), floating && portalContext && addEventListener(floating, "focusout", markInsideReactTree, true));
|
|
328
|
+
}, [
|
|
329
|
+
disabled,
|
|
330
|
+
domReference,
|
|
331
|
+
floating,
|
|
332
|
+
floatingFocusElement,
|
|
333
|
+
modal,
|
|
334
|
+
tree,
|
|
335
|
+
portalContext,
|
|
336
|
+
store,
|
|
337
|
+
closeOnFocusOut,
|
|
338
|
+
restoreFocus,
|
|
339
|
+
getTabbableContent,
|
|
340
|
+
isUntrappedTypeableCombobox,
|
|
341
|
+
getNodeId,
|
|
342
|
+
dataRef,
|
|
343
|
+
blurTimeout,
|
|
344
|
+
pointerDownTimeout,
|
|
345
|
+
restoreFocusFrame,
|
|
346
|
+
nextFocusableElement,
|
|
347
|
+
previousFocusableElement,
|
|
348
|
+
getResolvedInsideElements
|
|
349
|
+
]);
|
|
350
|
+
import_react.useEffect(() => {
|
|
351
|
+
if (disabled || !floating || !open) return;
|
|
352
|
+
const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute("portal")}]`) || []);
|
|
353
|
+
const rootAncestorComboboxDomReference = (tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : []).find((node) => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;
|
|
354
|
+
const ariaHiddenCleanup = markOthers([
|
|
355
|
+
...[
|
|
356
|
+
floating,
|
|
357
|
+
...portalNodes,
|
|
358
|
+
beforeGuardRef.current,
|
|
359
|
+
afterGuardRef.current,
|
|
360
|
+
portalContext?.beforeOutsideRef.current,
|
|
361
|
+
portalContext?.afterOutsideRef.current,
|
|
362
|
+
...getResolvedInsideElements()
|
|
363
|
+
],
|
|
364
|
+
rootAncestorComboboxDomReference,
|
|
365
|
+
resolveRef(previousFocusableElement),
|
|
366
|
+
resolveRef(nextFocusableElement),
|
|
367
|
+
isUntrappedTypeableCombobox ? domReference : null
|
|
368
|
+
].filter((x) => x != null), {
|
|
369
|
+
ariaHidden: modal || isUntrappedTypeableCombobox,
|
|
370
|
+
mark: false
|
|
371
|
+
});
|
|
372
|
+
const markerCleanup = markOthers([floating, ...portalNodes].filter((x) => x != null));
|
|
373
|
+
return () => {
|
|
374
|
+
markerCleanup();
|
|
375
|
+
ariaHiddenCleanup();
|
|
376
|
+
};
|
|
377
|
+
}, [
|
|
378
|
+
open,
|
|
379
|
+
disabled,
|
|
380
|
+
domReference,
|
|
381
|
+
floating,
|
|
382
|
+
modal,
|
|
383
|
+
portalContext,
|
|
384
|
+
isUntrappedTypeableCombobox,
|
|
385
|
+
tree,
|
|
386
|
+
getNodeId,
|
|
387
|
+
nextFocusableElement,
|
|
388
|
+
previousFocusableElement,
|
|
389
|
+
getResolvedInsideElements
|
|
390
|
+
]);
|
|
391
|
+
useIsoLayoutEffect(() => {
|
|
392
|
+
if (!open || disabled || !isHTMLElement(floatingFocusElement)) return;
|
|
393
|
+
closeTypeRef.current = "";
|
|
394
|
+
lastInteractionTypeRef.current = "";
|
|
395
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
396
|
+
const previouslyFocusedElement = activeElement(doc);
|
|
397
|
+
queueMicrotask(() => {
|
|
398
|
+
const initialFocusValueOrFn = initialFocusRef.current;
|
|
399
|
+
const resolvedInitialFocus = typeof initialFocusValueOrFn === "function" ? initialFocusValueOrFn(openInteractionTypeRef.current || "") : initialFocusValueOrFn;
|
|
400
|
+
if (resolvedInitialFocus === void 0 || resolvedInitialFocus === false) return;
|
|
401
|
+
if (contains(floatingFocusElement, previouslyFocusedElement)) return;
|
|
402
|
+
let focusableElements = null;
|
|
403
|
+
const getDefaultFocusElement = () => {
|
|
404
|
+
if (focusableElements == null) focusableElements = getTabbableContent(floatingFocusElement);
|
|
405
|
+
return focusableElements[0] || floatingFocusElement;
|
|
406
|
+
};
|
|
407
|
+
let elToFocus;
|
|
408
|
+
if (resolvedInitialFocus === true || resolvedInitialFocus === null) elToFocus = getDefaultFocusElement();
|
|
409
|
+
else elToFocus = resolveRef(resolvedInitialFocus);
|
|
410
|
+
elToFocus = elToFocus || getDefaultFocusElement();
|
|
411
|
+
const hadFocusInside = contains(floatingFocusElement, activeElement(doc));
|
|
412
|
+
const openEvent = dataRef.current.openEvent;
|
|
413
|
+
const openedByVirtualPress = openEvent?.type === "mousedown" && isVirtualClick(openEvent);
|
|
414
|
+
enqueueFocus(elToFocus, {
|
|
415
|
+
sync: openedByVirtualPress,
|
|
416
|
+
preventScroll: elToFocus === floatingFocusElement,
|
|
417
|
+
shouldFocus() {
|
|
418
|
+
if (!openRef.current) return false;
|
|
419
|
+
if (hadFocusInside) return true;
|
|
420
|
+
const currentActiveElement = activeElement(doc);
|
|
421
|
+
return !(currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement));
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
}, [
|
|
426
|
+
disabled,
|
|
427
|
+
open,
|
|
428
|
+
floatingFocusElement,
|
|
429
|
+
getTabbableContent,
|
|
430
|
+
initialFocusRef,
|
|
431
|
+
openInteractionTypeRef,
|
|
432
|
+
openRef,
|
|
433
|
+
dataRef
|
|
434
|
+
]);
|
|
435
|
+
const pendingReturnFocusRef = import_react.useRef(null);
|
|
436
|
+
useIsoLayoutEffect(() => {
|
|
437
|
+
if (disabled || !floatingFocusElement) {
|
|
438
|
+
pendingReturnFocusRef.current = null;
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (pendingReturnFocusRef.current) {
|
|
442
|
+
pendingReturnFocusRef.current.cancelled = true;
|
|
443
|
+
pendingReturnFocusRef.current = null;
|
|
444
|
+
}
|
|
445
|
+
const doc = ownerDocument(floatingFocusElement);
|
|
446
|
+
const elementFocusedBeforeOpen = activeElement(doc);
|
|
447
|
+
const preferPreviousFocus = openInteractionTypeRef.current == null;
|
|
448
|
+
addPreviouslyFocusedElement(elementFocusedBeforeOpen);
|
|
449
|
+
function onOpenChangeLocal(details) {
|
|
450
|
+
if (!details.open) closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);
|
|
451
|
+
if (details.reason === "focus-out" && details.triggerElement?.hasAttribute(createAttribute("focus-guard")) || details.reason === "trigger-hover" && details.nativeEvent.type === "mouseleave") preventReturnFocusRef.current = true;
|
|
452
|
+
if (details.reason !== "outside-press") return;
|
|
453
|
+
if (details.nested) preventReturnFocusRef.current = false;
|
|
454
|
+
else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) preventReturnFocusRef.current = false;
|
|
455
|
+
else {
|
|
456
|
+
let isPreventScrollSupported = false;
|
|
457
|
+
ownerDocument(floatingFocusElement).createElement("div").focus({ get preventScroll() {
|
|
458
|
+
isPreventScrollSupported = true;
|
|
459
|
+
return false;
|
|
460
|
+
} });
|
|
461
|
+
if (isPreventScrollSupported) preventReturnFocusRef.current = false;
|
|
462
|
+
else preventReturnFocusRef.current = true;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
events.on("openchange", onOpenChangeLocal);
|
|
466
|
+
function getReturnElement(closeType) {
|
|
467
|
+
const returnFocusValueOrFn = returnFocusRef.current;
|
|
468
|
+
let resolvedReturnFocusValue = typeof returnFocusValueOrFn === "function" ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;
|
|
469
|
+
if (resolvedReturnFocusValue === void 0 || resolvedReturnFocusValue === false) return null;
|
|
470
|
+
if (resolvedReturnFocusValue === null) resolvedReturnFocusValue = true;
|
|
471
|
+
const referenceReturnElement = domReference?.isConnected ? domReference : null;
|
|
472
|
+
const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== "body" ? elementFocusedBeforeOpen : null;
|
|
473
|
+
let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;
|
|
474
|
+
if (!defaultReturnElement) defaultReturnElement = getPreviouslyFocusedElement() || null;
|
|
475
|
+
if (typeof resolvedReturnFocusValue === "boolean") return defaultReturnElement;
|
|
476
|
+
return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;
|
|
477
|
+
}
|
|
478
|
+
return () => {
|
|
479
|
+
events.off("openchange", onOpenChangeLocal);
|
|
480
|
+
const activeEl = activeElement(doc);
|
|
481
|
+
const insideElements = getResolvedInsideElements();
|
|
482
|
+
const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some((element) => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node) => contains(node.context?.elements.floating, activeEl));
|
|
483
|
+
const returnFocusValueOrFn = returnFocusRef.current;
|
|
484
|
+
const closeType = closeTypeRef.current;
|
|
485
|
+
const returnElement = getReturnElement(closeType);
|
|
486
|
+
const job = { cancelled: false };
|
|
487
|
+
pendingReturnFocusRef.current = job;
|
|
488
|
+
queueMicrotask(() => {
|
|
489
|
+
if (pendingReturnFocusRef.current === job) pendingReturnFocusRef.current = null;
|
|
490
|
+
const tabbableReturnElement = getFirstTabbableElement(returnElement);
|
|
491
|
+
const hasExplicitReturnFocus = explicitReturnFocusRef.current ?? typeof returnFocusValueOrFn !== "boolean";
|
|
492
|
+
if (!job.cancelled && returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (!hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {
|
|
493
|
+
const focusOptions = { preventScroll: true };
|
|
494
|
+
if (closeType === "keyboard") focusOptions.focusVisible = true;
|
|
495
|
+
tabbableReturnElement.focus(focusOptions);
|
|
496
|
+
}
|
|
497
|
+
preventReturnFocusRef.current = false;
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
}, [
|
|
501
|
+
disabled,
|
|
502
|
+
floating,
|
|
503
|
+
floatingFocusElement,
|
|
504
|
+
returnFocusRef,
|
|
505
|
+
explicitReturnFocusRef,
|
|
506
|
+
openInteractionTypeRef,
|
|
507
|
+
events,
|
|
508
|
+
tree,
|
|
509
|
+
domReference,
|
|
510
|
+
getNodeId,
|
|
511
|
+
getResolvedInsideElements
|
|
512
|
+
]);
|
|
513
|
+
useIsoLayoutEffect(() => {
|
|
514
|
+
if (!webkit || open || !floating) return;
|
|
515
|
+
const activeEl = activeElement(ownerDocument(floating));
|
|
516
|
+
if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) return;
|
|
517
|
+
if (contains(floating, activeEl)) activeEl.blur();
|
|
518
|
+
}, [open, floating]);
|
|
519
|
+
useIsoLayoutEffect(() => {
|
|
520
|
+
if (disabled || !portalContext) return;
|
|
521
|
+
portalContext.setFocusManagerState({
|
|
522
|
+
modal,
|
|
523
|
+
closeOnFocusOut,
|
|
524
|
+
open,
|
|
525
|
+
onOpenChange: store.setOpen,
|
|
526
|
+
domReference
|
|
527
|
+
});
|
|
528
|
+
return () => {
|
|
529
|
+
portalContext.setFocusManagerState(null);
|
|
530
|
+
};
|
|
531
|
+
}, [
|
|
532
|
+
disabled,
|
|
533
|
+
portalContext,
|
|
534
|
+
modal,
|
|
535
|
+
open,
|
|
536
|
+
store,
|
|
537
|
+
closeOnFocusOut,
|
|
538
|
+
domReference
|
|
539
|
+
]);
|
|
540
|
+
useIsoLayoutEffect(() => {
|
|
541
|
+
if (disabled || !floatingFocusElement) return;
|
|
542
|
+
handleTabIndex(floatingFocusElement);
|
|
543
|
+
return () => {
|
|
544
|
+
queueMicrotask(clearDisconnectedPreviouslyFocusedElements);
|
|
545
|
+
};
|
|
546
|
+
}, [disabled, floatingFocusElement]);
|
|
547
|
+
const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);
|
|
548
|
+
return /*#__PURE__*/ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
549
|
+
shouldRenderGuards && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FocusGuard, {
|
|
550
|
+
"data-type": "inside",
|
|
551
|
+
ref: mergedBeforeGuardRef,
|
|
552
|
+
onFocus: (event) => {
|
|
553
|
+
if (modal) {
|
|
554
|
+
const els = getTabbableContent();
|
|
555
|
+
enqueueFocus(els[els.length - 1]);
|
|
556
|
+
} else if (portalContext?.portalNode) {
|
|
557
|
+
preventReturnFocusRef.current = false;
|
|
558
|
+
if (isOutsideEvent(event, portalContext.portalNode)) getNextTabbable(domReference)?.focus();
|
|
559
|
+
else resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}),
|
|
563
|
+
children,
|
|
564
|
+
shouldRenderGuards && /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FocusGuard, {
|
|
565
|
+
"data-type": "inside",
|
|
566
|
+
ref: mergedAfterGuardRef,
|
|
567
|
+
onFocus: (event) => {
|
|
568
|
+
if (modal) enqueueFocus(getTabbableContent()[0]);
|
|
569
|
+
else if (portalContext?.portalNode) {
|
|
570
|
+
if (closeOnFocusOut) preventReturnFocusRef.current = true;
|
|
571
|
+
if (isOutsideEvent(event, portalContext.portalNode)) getPreviousTabbable(domReference)?.focus();
|
|
572
|
+
else resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
})
|
|
576
|
+
] });
|
|
577
|
+
}
|
|
578
|
+
// ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/inertValue.mjs
|
|
579
|
+
function inertValue(value) {
|
|
580
|
+
if (isReactVersionAtLeast(19)) return value;
|
|
581
|
+
return value ? "true" : void 0;
|
|
582
|
+
}
|
|
583
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs
|
|
584
|
+
/**
|
|
585
|
+
* Present when the field is in a valid state.
|
|
586
|
+
*/
|
|
587
|
+
var valid = "data-valid";
|
|
588
|
+
/**
|
|
589
|
+
* Present when the field is in an invalid state.
|
|
590
|
+
*/
|
|
591
|
+
var invalid = "data-invalid";
|
|
592
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-constants/constants.mjs
|
|
593
|
+
var DEFAULT_VALIDITY_STATE = {
|
|
594
|
+
badInput: false,
|
|
595
|
+
customError: false,
|
|
596
|
+
patternMismatch: false,
|
|
597
|
+
rangeOverflow: false,
|
|
598
|
+
rangeUnderflow: false,
|
|
599
|
+
stepMismatch: false,
|
|
600
|
+
tooLong: false,
|
|
601
|
+
tooShort: false,
|
|
602
|
+
typeMismatch: false,
|
|
603
|
+
valid: null,
|
|
604
|
+
valueMissing: false
|
|
605
|
+
};
|
|
606
|
+
var DEFAULT_FIELD_STATE_ATTRIBUTES = {
|
|
607
|
+
valid: null,
|
|
608
|
+
touched: false,
|
|
609
|
+
dirty: false,
|
|
610
|
+
filled: false,
|
|
611
|
+
focused: false
|
|
612
|
+
};
|
|
613
|
+
var DEFAULT_FIELD_ROOT_STATE = {
|
|
614
|
+
disabled: false,
|
|
615
|
+
...DEFAULT_FIELD_STATE_ATTRIBUTES
|
|
616
|
+
};
|
|
617
|
+
var fieldValidityMapping = { valid(value) {
|
|
618
|
+
if (value === null) return null;
|
|
619
|
+
if (value) return { [valid]: "" };
|
|
620
|
+
return { [invalid]: "" };
|
|
621
|
+
} };
|
|
622
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
|
|
623
|
+
var DEFAULT_FIELD_ROOT_CONTEXT = {
|
|
624
|
+
invalid: void 0,
|
|
625
|
+
name: void 0,
|
|
626
|
+
validityData: {
|
|
627
|
+
state: DEFAULT_VALIDITY_STATE,
|
|
628
|
+
errors: [],
|
|
629
|
+
error: "",
|
|
630
|
+
value: "",
|
|
631
|
+
initialValue: null
|
|
632
|
+
},
|
|
633
|
+
setValidityData: NOOP,
|
|
634
|
+
disabled: void 0,
|
|
635
|
+
setTouched: NOOP,
|
|
636
|
+
setDirty: NOOP,
|
|
637
|
+
setFilled: NOOP,
|
|
638
|
+
setFocused: NOOP,
|
|
639
|
+
focusOwnerRef: { current: void 0 },
|
|
640
|
+
validationMode: "onSubmit",
|
|
641
|
+
shouldValidateOnChange: () => false,
|
|
642
|
+
state: DEFAULT_FIELD_ROOT_STATE,
|
|
643
|
+
registerFieldControl: NOOP,
|
|
644
|
+
validation: {
|
|
645
|
+
getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,
|
|
646
|
+
inputRef: { current: null },
|
|
647
|
+
registeredInputs: /* @__PURE__ */ new Map(),
|
|
648
|
+
registerInput: NOOP,
|
|
649
|
+
getInputControl: () => null,
|
|
650
|
+
commit: async () => {},
|
|
651
|
+
change: NOOP
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
var FieldRootContext = /*#__PURE__*/ import_react.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
|
|
655
|
+
function useFieldRootContext(optional = true) {
|
|
656
|
+
const context = import_react.useContext(FieldRootContext);
|
|
657
|
+
if (context.setValidityData === NOOP && !optional) throw new Error(formatErrorMessage(28));
|
|
658
|
+
return context;
|
|
659
|
+
}
|
|
660
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs
|
|
661
|
+
function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {
|
|
662
|
+
const { registerFieldControl } = useFieldRootContext();
|
|
663
|
+
const sourceRef = useRefWithInit(() => Symbol());
|
|
664
|
+
useIsoLayoutEffect(() => {
|
|
665
|
+
const source = sourceRef.current;
|
|
666
|
+
if (!enabled) {
|
|
667
|
+
registerFieldControl(source, void 0);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
registerFieldControl(source, {
|
|
671
|
+
controlRef,
|
|
672
|
+
getValue: getFormValueOverride,
|
|
673
|
+
id,
|
|
674
|
+
name,
|
|
675
|
+
value
|
|
676
|
+
});
|
|
677
|
+
}, [
|
|
678
|
+
controlRef,
|
|
679
|
+
enabled,
|
|
680
|
+
getFormValueOverride,
|
|
681
|
+
id,
|
|
682
|
+
name,
|
|
683
|
+
registerFieldControl,
|
|
684
|
+
sourceRef,
|
|
685
|
+
value
|
|
686
|
+
]);
|
|
687
|
+
useIsoLayoutEffect(() => {
|
|
688
|
+
const source = sourceRef.current;
|
|
689
|
+
return () => {
|
|
690
|
+
registerFieldControl(source, void 0);
|
|
691
|
+
};
|
|
692
|
+
}, [registerFieldControl, sourceRef]);
|
|
693
|
+
}
|
|
694
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/form-context/FormContext.mjs
|
|
695
|
+
var FormContext = /*#__PURE__*/ import_react.createContext({
|
|
696
|
+
elementRef: { current: null },
|
|
697
|
+
formRef: { current: { fields: /* @__PURE__ */ new Map() } },
|
|
698
|
+
errors: {},
|
|
699
|
+
clearErrors: NOOP,
|
|
700
|
+
validationMode: "onSubmit",
|
|
701
|
+
submitCountRef: { current: 0 }
|
|
702
|
+
});
|
|
703
|
+
function useFormContext() {
|
|
704
|
+
return import_react.useContext(FormContext);
|
|
705
|
+
}
|
|
706
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs
|
|
707
|
+
/**
|
|
708
|
+
* A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\
|
|
709
|
+
* with an accessible name (label) and description.
|
|
710
|
+
*/
|
|
711
|
+
var LabelableContext = /*#__PURE__*/ import_react.createContext({
|
|
712
|
+
controlId: void 0,
|
|
713
|
+
registerControlId: NOOP,
|
|
714
|
+
resetControlId: NOOP,
|
|
715
|
+
labelId: void 0,
|
|
716
|
+
setLabelId: NOOP,
|
|
717
|
+
messageIds: [],
|
|
718
|
+
setMessageIds: NOOP,
|
|
719
|
+
getDescriptionProps: (externalProps) => externalProps
|
|
720
|
+
});
|
|
721
|
+
function useLabelableContext() {
|
|
722
|
+
return import_react.useContext(LabelableContext);
|
|
723
|
+
}
|
|
724
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
|
|
725
|
+
function useLabelableId(params = {}) {
|
|
726
|
+
const { id, enabled = true } = params;
|
|
727
|
+
const { controlId, registerControlId, resetControlId } = useLabelableContext();
|
|
728
|
+
const defaultId = useBaseUiId();
|
|
729
|
+
const controlSourceRef = useRefWithInit(() => Symbol());
|
|
730
|
+
const hasRegisteredRef = import_react.useRef(false);
|
|
731
|
+
const hadExplicitIdRef = import_react.useRef(false);
|
|
732
|
+
const unregisterControlId = useStableCallback(() => {
|
|
733
|
+
if (!hasRegisteredRef.current || registerControlId === NOOP) return;
|
|
734
|
+
hasRegisteredRef.current = false;
|
|
735
|
+
registerControlId(controlSourceRef.current, void 0);
|
|
736
|
+
});
|
|
737
|
+
useIsoLayoutEffect(() => {
|
|
738
|
+
if (!enabled || registerControlId === NOOP) {
|
|
739
|
+
unregisterControlId();
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
let nextId;
|
|
743
|
+
if (id !== void 0) {
|
|
744
|
+
hadExplicitIdRef.current = true;
|
|
745
|
+
nextId = id;
|
|
746
|
+
} else if (hadExplicitIdRef.current) nextId = defaultId;
|
|
747
|
+
else {
|
|
748
|
+
resetControlId();
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
if (nextId === void 0) {
|
|
752
|
+
unregisterControlId();
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
hasRegisteredRef.current = true;
|
|
756
|
+
registerControlId(controlSourceRef.current, nextId);
|
|
757
|
+
}, [
|
|
758
|
+
id,
|
|
759
|
+
enabled,
|
|
760
|
+
registerControlId,
|
|
761
|
+
resetControlId,
|
|
762
|
+
defaultId,
|
|
763
|
+
controlSourceRef,
|
|
764
|
+
unregisterControlId
|
|
765
|
+
]);
|
|
766
|
+
useIsoLayoutEffect(() => {
|
|
767
|
+
return unregisterControlId;
|
|
768
|
+
}, [unregisterControlId]);
|
|
769
|
+
return (enabled ? controlId : void 0) ?? id ?? defaultId;
|
|
770
|
+
}
|
|
771
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/useValueChanged.mjs
|
|
772
|
+
function useValueChanged(value, onChange) {
|
|
773
|
+
const valueRef = import_react.useRef(value);
|
|
774
|
+
const onChangeCallback = useStableCallback(onChange);
|
|
775
|
+
useIsoLayoutEffect(() => {
|
|
776
|
+
if (valueRef.current !== value) onChangeCallback(valueRef.current);
|
|
777
|
+
valueRef.current = value;
|
|
778
|
+
}, [value, onChangeCallback]);
|
|
779
|
+
}
|
|
780
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/internals/field-root-context/useSetFieldFocused.mjs
|
|
781
|
+
/**
|
|
782
|
+
* Returns the field's `setFocused`, recording which control the focused state belongs to.
|
|
783
|
+
*
|
|
784
|
+
* Disabling or unmounting a focused control moves focus away without firing `blur`, so the focused
|
|
785
|
+
* state would otherwise stay latched. A field can have several focus targets, so a control only
|
|
786
|
+
* clears the shared state when focus last landed on itself. The stable callback doubles as that
|
|
787
|
+
* identity.
|
|
788
|
+
*/
|
|
789
|
+
function useSetFieldFocused(disabled, focusTargetRef, onFocusedChange) {
|
|
790
|
+
const { setFocused, focusOwnerRef } = useFieldRootContext();
|
|
791
|
+
const setFieldFocused = useStableCallback((focused) => {
|
|
792
|
+
if (focused ? !disabled : focusOwnerRef.current === setFieldFocused) {
|
|
793
|
+
focusOwnerRef.current = focused && setFieldFocused;
|
|
794
|
+
onFocusedChange?.(focused);
|
|
795
|
+
setFocused(focused);
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
useIsoLayoutEffect(() => {
|
|
799
|
+
const el = focusTargetRef.current;
|
|
800
|
+
if ((el?.getRootNode())?.activeElement === el) setFieldFocused(true);
|
|
801
|
+
return () => setFieldFocused(false);
|
|
802
|
+
}, [
|
|
803
|
+
disabled,
|
|
804
|
+
focusTargetRef,
|
|
805
|
+
setFieldFocused
|
|
806
|
+
]);
|
|
807
|
+
return setFieldFocused;
|
|
808
|
+
}
|
|
809
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/utils/InternalBackdrop.mjs
|
|
810
|
+
/**
|
|
811
|
+
* @internal
|
|
812
|
+
*/
|
|
813
|
+
var InternalBackdrop = /*#__PURE__*/ import_react.forwardRef(function InternalBackdrop(props, ref) {
|
|
814
|
+
const { cutout, ...otherProps } = props;
|
|
815
|
+
let clipPath;
|
|
816
|
+
if (cutout) {
|
|
817
|
+
const rect = cutout.getBoundingClientRect();
|
|
818
|
+
clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;
|
|
819
|
+
}
|
|
820
|
+
return /*#__PURE__*/ (0, import_jsx_runtime.jsx)("div", {
|
|
821
|
+
ref,
|
|
822
|
+
role: "presentation",
|
|
823
|
+
"data-base-ui-inert": "",
|
|
824
|
+
...otherProps,
|
|
825
|
+
style: {
|
|
826
|
+
position: "fixed",
|
|
827
|
+
inset: 0,
|
|
828
|
+
userSelect: "none",
|
|
829
|
+
WebkitUserSelect: "none",
|
|
830
|
+
clipPath
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
// ../../node_modules/.bun/@base-ui+utils@0.5.0+9e489665888c9e4a/node_modules/@base-ui/utils/useScrollLock.mjs
|
|
835
|
+
var originalHtmlStyles = {};
|
|
836
|
+
var originalBodyStyles = {};
|
|
837
|
+
var originalHtmlScrollBehavior = "";
|
|
838
|
+
function getViewportScroller(html, body) {
|
|
839
|
+
return isOverflowElement(html) ? html : body;
|
|
840
|
+
}
|
|
841
|
+
function isPageScrollLocked(win, html, body) {
|
|
842
|
+
return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);
|
|
843
|
+
}
|
|
844
|
+
function hasInsetScrollbars(referenceElement) {
|
|
845
|
+
if (typeof document === "undefined") return false;
|
|
846
|
+
const doc = ownerDocument(referenceElement);
|
|
847
|
+
return getWindow(doc).innerWidth - doc.documentElement.clientWidth > 0;
|
|
848
|
+
}
|
|
849
|
+
function supportsStableScrollbarGutter(referenceElement) {
|
|
850
|
+
if (!(typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable")) || typeof document === "undefined") return false;
|
|
851
|
+
const doc = ownerDocument(referenceElement);
|
|
852
|
+
const html = doc.documentElement;
|
|
853
|
+
const body = doc.body;
|
|
854
|
+
const scrollContainer = getViewportScroller(html, body);
|
|
855
|
+
const originalScrollContainerOverflowY = scrollContainer.style.overflowY;
|
|
856
|
+
const originalHtmlStyleGutter = html.style.scrollbarGutter;
|
|
857
|
+
html.style.scrollbarGutter = "stable";
|
|
858
|
+
scrollContainer.style.overflowY = "scroll";
|
|
859
|
+
const before = scrollContainer.offsetWidth;
|
|
860
|
+
scrollContainer.style.overflowY = "hidden";
|
|
861
|
+
const after = scrollContainer.offsetWidth;
|
|
862
|
+
scrollContainer.style.overflowY = originalScrollContainerOverflowY;
|
|
863
|
+
html.style.scrollbarGutter = originalHtmlStyleGutter;
|
|
864
|
+
return before === after;
|
|
865
|
+
}
|
|
866
|
+
function preventScrollOverlayScrollbars(referenceElement) {
|
|
867
|
+
const doc = ownerDocument(referenceElement);
|
|
868
|
+
const html = doc.documentElement;
|
|
869
|
+
const body = doc.body;
|
|
870
|
+
const elementToLock = getViewportScroller(html, body);
|
|
871
|
+
const originalElementToLockStyles = {
|
|
872
|
+
overflowY: elementToLock.style.overflowY,
|
|
873
|
+
overflowX: elementToLock.style.overflowX
|
|
874
|
+
};
|
|
875
|
+
Object.assign(elementToLock.style, {
|
|
876
|
+
overflowY: "hidden",
|
|
877
|
+
overflowX: "hidden"
|
|
878
|
+
});
|
|
879
|
+
return () => {
|
|
880
|
+
Object.assign(elementToLock.style, originalElementToLockStyles);
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function preventScrollInsetScrollbars(referenceElement) {
|
|
884
|
+
const doc = ownerDocument(referenceElement);
|
|
885
|
+
const html = doc.documentElement;
|
|
886
|
+
const body = doc.body;
|
|
887
|
+
const win = getWindow(html);
|
|
888
|
+
let scrollTop = 0;
|
|
889
|
+
let scrollLeft = 0;
|
|
890
|
+
let updateGutterOnly = false;
|
|
891
|
+
const resizeFrame = AnimationFrame.create();
|
|
892
|
+
if (webkit && (win.visualViewport?.scale ?? 1) !== 1) return () => {};
|
|
893
|
+
function lockScroll() {
|
|
894
|
+
const htmlStyles = win.getComputedStyle(html);
|
|
895
|
+
const bodyStyles = win.getComputedStyle(body);
|
|
896
|
+
const scrollbarGutterValue = (htmlStyles.scrollbarGutter || "").includes("both-edges") ? "stable both-edges" : "stable";
|
|
897
|
+
scrollTop = html.scrollTop;
|
|
898
|
+
scrollLeft = html.scrollLeft;
|
|
899
|
+
originalHtmlStyles = {
|
|
900
|
+
scrollbarGutter: html.style.scrollbarGutter,
|
|
901
|
+
overflowY: html.style.overflowY,
|
|
902
|
+
overflowX: html.style.overflowX
|
|
903
|
+
};
|
|
904
|
+
originalHtmlScrollBehavior = html.style.scrollBehavior;
|
|
905
|
+
originalBodyStyles = {
|
|
906
|
+
position: body.style.position,
|
|
907
|
+
height: body.style.height,
|
|
908
|
+
width: body.style.width,
|
|
909
|
+
boxSizing: body.style.boxSizing,
|
|
910
|
+
overflowY: body.style.overflowY,
|
|
911
|
+
overflowX: body.style.overflowX,
|
|
912
|
+
scrollBehavior: body.style.scrollBehavior
|
|
913
|
+
};
|
|
914
|
+
const isScrollableY = html.scrollHeight > html.clientHeight;
|
|
915
|
+
const isScrollableX = html.scrollWidth > html.clientWidth;
|
|
916
|
+
const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll";
|
|
917
|
+
const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll";
|
|
918
|
+
const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);
|
|
919
|
+
const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);
|
|
920
|
+
const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);
|
|
921
|
+
const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);
|
|
922
|
+
const elementToLock = getViewportScroller(html, body);
|
|
923
|
+
updateGutterOnly = supportsStableScrollbarGutter(referenceElement);
|
|
924
|
+
if (updateGutterOnly) {
|
|
925
|
+
html.style.scrollbarGutter = scrollbarGutterValue;
|
|
926
|
+
elementToLock.style.overflowY = "hidden";
|
|
927
|
+
elementToLock.style.overflowX = "hidden";
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
Object.assign(html.style, {
|
|
931
|
+
scrollbarGutter: scrollbarGutterValue,
|
|
932
|
+
overflowY: "hidden",
|
|
933
|
+
overflowX: "hidden"
|
|
934
|
+
});
|
|
935
|
+
if (isScrollableY || hasConstantOverflowY) html.style.overflowY = "scroll";
|
|
936
|
+
if (isScrollableX || hasConstantOverflowX) html.style.overflowX = "scroll";
|
|
937
|
+
Object.assign(body.style, {
|
|
938
|
+
position: "relative",
|
|
939
|
+
height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : "100dvh",
|
|
940
|
+
width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : "100vw",
|
|
941
|
+
boxSizing: "border-box",
|
|
942
|
+
overflowY: "hidden",
|
|
943
|
+
overflowX: "hidden",
|
|
944
|
+
scrollBehavior: "unset"
|
|
945
|
+
});
|
|
946
|
+
body.scrollTop = scrollTop;
|
|
947
|
+
body.scrollLeft = scrollLeft;
|
|
948
|
+
html.setAttribute("data-base-ui-scroll-locked", "");
|
|
949
|
+
html.style.scrollBehavior = "unset";
|
|
950
|
+
}
|
|
951
|
+
function cleanup() {
|
|
952
|
+
Object.assign(html.style, originalHtmlStyles);
|
|
953
|
+
Object.assign(body.style, originalBodyStyles);
|
|
954
|
+
if (!updateGutterOnly) {
|
|
955
|
+
html.scrollTop = scrollTop;
|
|
956
|
+
html.scrollLeft = scrollLeft;
|
|
957
|
+
html.removeAttribute("data-base-ui-scroll-locked");
|
|
958
|
+
html.style.scrollBehavior = originalHtmlScrollBehavior;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
function handleResize() {
|
|
962
|
+
cleanup();
|
|
963
|
+
resizeFrame.request(lockScroll);
|
|
964
|
+
}
|
|
965
|
+
lockScroll();
|
|
966
|
+
const unsubscribeResize = addEventListener(win, "resize", handleResize);
|
|
967
|
+
return () => {
|
|
968
|
+
resizeFrame.cancel();
|
|
969
|
+
cleanup();
|
|
970
|
+
if (typeof win.removeEventListener === "function") unsubscribeResize();
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
var ScrollLocker = class {
|
|
974
|
+
lockCount = 0;
|
|
975
|
+
restore = null;
|
|
976
|
+
timeoutLock = Timeout.create();
|
|
977
|
+
timeoutUnlock = Timeout.create();
|
|
978
|
+
acquire(referenceElement) {
|
|
979
|
+
this.lockCount += 1;
|
|
980
|
+
if (this.lockCount === 1 && this.restore === null) this.timeoutLock.start(0, () => this.lock(referenceElement));
|
|
981
|
+
return this.release;
|
|
982
|
+
}
|
|
983
|
+
release = () => {
|
|
984
|
+
this.lockCount -= 1;
|
|
985
|
+
if (this.lockCount === 0 && this.restore) this.timeoutUnlock.start(0, this.unlock);
|
|
986
|
+
};
|
|
987
|
+
unlock = () => {
|
|
988
|
+
if (this.lockCount === 0 && this.restore) {
|
|
989
|
+
this.restore?.();
|
|
990
|
+
this.restore = null;
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
lock(referenceElement) {
|
|
994
|
+
if (this.lockCount === 0 || this.restore !== null) return;
|
|
995
|
+
const doc = ownerDocument(referenceElement);
|
|
996
|
+
const html = doc.documentElement;
|
|
997
|
+
const body = doc.body;
|
|
998
|
+
const win = getWindow(html);
|
|
999
|
+
if (isPageScrollLocked(win, html, body)) {
|
|
1000
|
+
const observer = new win.MutationObserver(() => {
|
|
1001
|
+
if (isPageScrollLocked(win, html, body)) return;
|
|
1002
|
+
observer.disconnect();
|
|
1003
|
+
this.restore = null;
|
|
1004
|
+
this.lock(referenceElement);
|
|
1005
|
+
});
|
|
1006
|
+
const options = { attributes: true };
|
|
1007
|
+
observer.observe(html, options);
|
|
1008
|
+
observer.observe(body, options);
|
|
1009
|
+
this.restore = () => observer.disconnect();
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
const hasOverlayScrollbars = ios || !hasInsetScrollbars(referenceElement);
|
|
1013
|
+
this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
var SCROLL_LOCKER = new ScrollLocker();
|
|
1017
|
+
/**
|
|
1018
|
+
* Locks the scroll of the document when enabled.
|
|
1019
|
+
*
|
|
1020
|
+
* @param enabled - Whether to enable the scroll lock.
|
|
1021
|
+
* @param referenceElement - Element to use as a reference for lock calculations.
|
|
1022
|
+
*/
|
|
1023
|
+
function useScrollLock(enabled = true, referenceElement = null) {
|
|
1024
|
+
useIsoLayoutEffect(() => {
|
|
1025
|
+
if (!enabled) return;
|
|
1026
|
+
return SCROLL_LOCKER.acquire(referenceElement);
|
|
1027
|
+
}, [enabled, referenceElement]);
|
|
1028
|
+
}
|
|
1029
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/field/control/FieldControl.mjs
|
|
1030
|
+
/**
|
|
1031
|
+
* The form control to label and validate.
|
|
1032
|
+
* Renders an `<input>` element.
|
|
1033
|
+
*
|
|
1034
|
+
* You can omit this part and use any Base UI input component instead. For example,
|
|
1035
|
+
* [Input](https://base-ui.com/react/components/input), [Checkbox](https://base-ui.com/react/components/checkbox),
|
|
1036
|
+
* or [Select](https://base-ui.com/react/components/select), among others, will work with Field out of the box.
|
|
1037
|
+
*
|
|
1038
|
+
* Documentation: [Base UI Field](https://base-ui.com/react/components/field)
|
|
1039
|
+
*/
|
|
1040
|
+
var FieldControl = /*#__PURE__*/ import_react.forwardRef(function FieldControl(componentProps, forwardedRef) {
|
|
1041
|
+
const { render, className, id: idProp, name: nameProp, value, disabled: disabledProp = false, onValueChange, defaultValue, autoFocus = false, style, ...elementProps } = componentProps;
|
|
1042
|
+
const { state: fieldState, name: fieldName, disabled: fieldDisabled, setTouched, setDirty, validityData, setFilled, validationMode, validation } = useFieldRootContext();
|
|
1043
|
+
const { clearErrors, elementRef: formElementRef, submitCountRef } = useFormContext();
|
|
1044
|
+
const disabled = fieldDisabled || disabledProp;
|
|
1045
|
+
const name = fieldName ?? nameProp;
|
|
1046
|
+
const state = {
|
|
1047
|
+
...fieldState,
|
|
1048
|
+
disabled
|
|
1049
|
+
};
|
|
1050
|
+
const { labelId } = useLabelableContext();
|
|
1051
|
+
const id = useLabelableId({ id: idProp });
|
|
1052
|
+
const isControlled = value !== void 0;
|
|
1053
|
+
const serializedValue = value == null ? void 0 : String(value);
|
|
1054
|
+
const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);
|
|
1055
|
+
useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled, nameProp);
|
|
1056
|
+
useIsoLayoutEffect(() => {
|
|
1057
|
+
const currentValue = serializedValue ?? validation.inputRef.current?.value;
|
|
1058
|
+
if (currentValue !== void 0) setFilled(currentValue !== "");
|
|
1059
|
+
}, [
|
|
1060
|
+
serializedValue,
|
|
1061
|
+
defaultValue,
|
|
1062
|
+
validation.inputRef,
|
|
1063
|
+
setFilled
|
|
1064
|
+
]);
|
|
1065
|
+
useValueChanged(serializedValue, () => {
|
|
1066
|
+
if (serializedValue === void 0) return;
|
|
1067
|
+
clearErrors(name);
|
|
1068
|
+
setDirty(serializedValue !== (validityData.initialValue ?? ""));
|
|
1069
|
+
validation.change(serializedValue);
|
|
1070
|
+
});
|
|
1071
|
+
const inputRef = import_react.useRef(null);
|
|
1072
|
+
const setFocused = useSetFieldFocused(disabled, inputRef);
|
|
1073
|
+
const enterValidationTimeout = useTimeout();
|
|
1074
|
+
return useRenderElement("input", componentProps, {
|
|
1075
|
+
ref: [forwardedRef, inputRef],
|
|
1076
|
+
state,
|
|
1077
|
+
props: [
|
|
1078
|
+
{
|
|
1079
|
+
id,
|
|
1080
|
+
disabled,
|
|
1081
|
+
name,
|
|
1082
|
+
ref: validation.inputRef,
|
|
1083
|
+
"aria-labelledby": labelId,
|
|
1084
|
+
autoFocus,
|
|
1085
|
+
...isControlled ? { value } : { defaultValue },
|
|
1086
|
+
onChange(event) {
|
|
1087
|
+
const inputValue = event.currentTarget.value;
|
|
1088
|
+
const details = createChangeEventDetails(none, event.nativeEvent);
|
|
1089
|
+
onValueChange?.(inputValue, details);
|
|
1090
|
+
if (isControlled) return;
|
|
1091
|
+
setDirty(inputValue !== (validityData.initialValue ?? ""));
|
|
1092
|
+
setFilled(inputValue !== "");
|
|
1093
|
+
if (!event.nativeEvent.defaultPrevented && !details.isCanceled) {
|
|
1094
|
+
clearErrors(name);
|
|
1095
|
+
validation.change(inputValue);
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
onFocus() {
|
|
1099
|
+
setFocused(true);
|
|
1100
|
+
},
|
|
1101
|
+
onBlur(event) {
|
|
1102
|
+
setTouched(true);
|
|
1103
|
+
setFocused(false);
|
|
1104
|
+
if (validationMode === "onBlur") {
|
|
1105
|
+
const inputValue = event.currentTarget.value;
|
|
1106
|
+
validation.commit(inputValue);
|
|
1107
|
+
if (isControlled) queueMicrotask(() => {
|
|
1108
|
+
const nextValue = validation.inputRef.current?.value;
|
|
1109
|
+
if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) validation.commit(nextValue);
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
onKeyDown(event) {
|
|
1114
|
+
if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") {
|
|
1115
|
+
setTouched(true);
|
|
1116
|
+
const value = event.currentTarget.value;
|
|
1117
|
+
const form = event.currentTarget.form;
|
|
1118
|
+
if (form && form === formElementRef.current && !event.defaultPrevented) {
|
|
1119
|
+
const input = event.currentTarget;
|
|
1120
|
+
const submitCount = submitCountRef.current;
|
|
1121
|
+
enterValidationTimeout.start(0, () => {
|
|
1122
|
+
if (submitCountRef.current === submitCount) validation.commit(input.value);
|
|
1123
|
+
});
|
|
1124
|
+
} else validation.commit(value);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
},
|
|
1128
|
+
elementProps,
|
|
1129
|
+
(props) => validation.getValidationProps(disabled, props)
|
|
1130
|
+
],
|
|
1131
|
+
stateAttributesMapping: fieldValidityMapping
|
|
1132
|
+
});
|
|
1133
|
+
});
|
|
1134
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/input/Input.mjs
|
|
1135
|
+
/**
|
|
1136
|
+
* A native input element that automatically works with [Field](https://base-ui.com/react/components/field).
|
|
1137
|
+
* Renders an `<input>` element.
|
|
1138
|
+
*
|
|
1139
|
+
* Documentation: [Base UI Input](https://base-ui.com/react/components/input)
|
|
1140
|
+
*/
|
|
1141
|
+
var Input$1 = /*#__PURE__*/ import_react.forwardRef(function Input(props, forwardedRef) {
|
|
1142
|
+
return /*#__PURE__*/ (0, import_jsx_runtime.jsx)(FieldControl, {
|
|
1143
|
+
ref: forwardedRef,
|
|
1144
|
+
...props
|
|
1145
|
+
});
|
|
1146
|
+
});
|
|
1147
|
+
// ../../node_modules/.bun/@base-ui+react@1.9.0+9e489665888c9e4a/node_modules/@base-ui/react/separator/Separator.mjs
|
|
1148
|
+
/**
|
|
1149
|
+
* A separator element accessible to screen readers.
|
|
1150
|
+
* Renders a `<div>` element.
|
|
1151
|
+
*
|
|
1152
|
+
* Documentation: [Base UI Separator](https://base-ui.com/react/components/separator)
|
|
1153
|
+
*/
|
|
1154
|
+
var Separator$1 = /*#__PURE__*/ import_react.forwardRef(function SeparatorComponent(componentProps, forwardedRef) {
|
|
1155
|
+
const { className, render, orientation = "horizontal", style, ...elementProps } = componentProps;
|
|
1156
|
+
return useRenderElement("div", componentProps, {
|
|
1157
|
+
state: { orientation },
|
|
1158
|
+
ref: forwardedRef,
|
|
1159
|
+
props: [{
|
|
1160
|
+
role: "separator",
|
|
1161
|
+
"aria-orientation": orientation
|
|
1162
|
+
}, elementProps]
|
|
1163
|
+
});
|
|
1164
|
+
});
|
|
1165
|
+
// src/components/ui/fields.tsx
|
|
1166
|
+
/** A key name, as the viewer presses it. */
|
|
1167
|
+
function Kbd({ className, ...props }) {
|
|
1168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", {
|
|
1169
|
+
"data-slot": "kbd",
|
|
1170
|
+
className: cn("inline-grid h-[18px] min-w-[18px] place-items-center rounded-[4px] border border-b-2 border-rule bg-page px-1 font-mono text-[0.66rem] leading-none font-semibold text-muted select-none", className),
|
|
1171
|
+
...props
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
var FIELD = "w-full min-w-0 rounded-control border border-rule bg-page px-3 text-sm text-text outline-none transition-colors placeholder:text-muted focus:border-accent disabled:cursor-not-allowed disabled:opacity-60";
|
|
1175
|
+
function Input({ className, ...props }) {
|
|
1176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input$1, {
|
|
1177
|
+
"data-slot": "input",
|
|
1178
|
+
className: cn(FIELD, "h-9", className),
|
|
1179
|
+
...props
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
function Separator({ className, orientation = "horizontal", ...props }) {
|
|
1183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator$1, {
|
|
1184
|
+
"data-slot": "separator",
|
|
1185
|
+
orientation,
|
|
1186
|
+
className: cn("shrink-0 bg-rule-soft data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch", className),
|
|
1187
|
+
...props
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
export { inertValue as _, InternalBackdrop as a, useLabelableId as c, useRegisterFieldControl as d, DEFAULT_FIELD_ROOT_CONTEXT as f, fieldValidityMapping as g, DEFAULT_FIELD_STATE_ATTRIBUTES as h, useScrollLock as i, useLabelableContext as l, useFieldRootContext as m, Kbd as n, useSetFieldFocused as o, FieldRootContext as p, Separator as r, useValueChanged as s, Input as t, useFormContext as u, FloatingFocusManager as v, enqueueFocus as y };
|