veryfront 0.1.1237 → 0.1.1239
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/esm/cli/auth/login.d.ts +24 -2
- package/esm/cli/auth/login.d.ts.map +1 -1
- package/esm/cli/auth/login.js +444 -35
- package/esm/cli/commands/build/error-handler.d.ts.map +1 -1
- package/esm/cli/commands/build/error-handler.js +41 -3
- package/esm/cli/commands/build/handler.d.ts.map +1 -1
- package/esm/cli/commands/build/handler.js +1 -1
- package/esm/cli/commands/dev/command.d.ts.map +1 -1
- package/esm/cli/commands/dev/command.js +14 -1
- package/esm/cli/commands/dev/inference-status.d.ts +6 -0
- package/esm/cli/commands/dev/inference-status.d.ts.map +1 -1
- package/esm/cli/commands/dev/inference-status.js +14 -2
- package/esm/cli/commands/generate/command.d.ts.map +1 -1
- package/esm/cli/commands/generate/command.js +61 -0
- package/esm/cli/commands/init/init-command.d.ts.map +1 -1
- package/esm/cli/commands/init/init-command.js +23 -31
- package/esm/cli/commands/install/registry.d.ts.map +1 -1
- package/esm/cli/commands/install/registry.js +6 -9
- package/esm/cli/commands/login/command-help.d.ts.map +1 -1
- package/esm/cli/commands/login/command-help.js +3 -1
- package/esm/cli/commands/pull/command.d.ts +1 -0
- package/esm/cli/commands/pull/command.d.ts.map +1 -1
- package/esm/cli/commands/pull/command.js +49 -6
- package/esm/cli/commands/push/command-help.d.ts.map +1 -1
- package/esm/cli/commands/push/command-help.js +7 -0
- package/esm/cli/commands/push/command.d.ts +23 -12
- package/esm/cli/commands/push/command.d.ts.map +1 -1
- package/esm/cli/commands/push/command.js +461 -44
- package/esm/cli/commands/push/plan.d.ts +35 -0
- package/esm/cli/commands/push/plan.d.ts.map +1 -0
- package/esm/cli/commands/push/plan.js +96 -0
- package/esm/cli/commands/schedule/handler.d.ts +21 -2
- package/esm/cli/commands/schedule/handler.d.ts.map +1 -1
- package/esm/cli/commands/schedule/handler.js +74 -27
- package/esm/cli/commands/schema/command-help.js +1 -1
- package/esm/cli/commands/up/command.js +1 -1
- package/esm/cli/commands/webhook/handler.d.ts.map +1 -1
- package/esm/cli/commands/webhook/handler.js +3 -1
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +27 -5
- package/esm/cli/shared/args.d.ts +15 -1
- package/esm/cli/shared/args.d.ts.map +1 -1
- package/esm/cli/shared/args.js +56 -3
- package/esm/cli/shared/config.d.ts +11 -2
- package/esm/cli/shared/config.d.ts.map +1 -1
- package/esm/cli/shared/config.js +72 -27
- package/esm/cli/shared/project-creation.js +1 -1
- package/esm/cli/sync/state.d.ts +20 -0
- package/esm/cli/sync/state.d.ts.map +1 -0
- package/esm/cli/sync/state.js +193 -0
- package/esm/deno.js +2 -2
- package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.d.ts.map +1 -1
- package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.js +852 -21
- package/esm/extensions/ext-observability-sentry/src/policy.d.ts +2 -0
- package/esm/extensions/ext-observability-sentry/src/policy.d.ts.map +1 -1
- package/esm/extensions/ext-observability-sentry/src/policy.js +214 -3
- package/esm/src/agent/conversation/delegation-policy.d.ts +2 -0
- package/esm/src/agent/conversation/delegation-policy.d.ts.map +1 -1
- package/esm/src/agent/conversation/delegation-policy.js +13 -3
- package/esm/src/agent/conversation/hosted-terminal.d.ts.map +1 -1
- package/esm/src/agent/conversation/hosted-terminal.js +6 -2
- package/esm/src/agent/conversation/run-chunk-mirror.d.ts.map +1 -1
- package/esm/src/agent/conversation/run-chunk-mirror.js +14 -2
- package/esm/src/agent/factory.d.ts.map +1 -1
- package/esm/src/agent/factory.js +22 -11
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +2 -0
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +6 -1
- package/esm/src/agent/hosted/child-fork-execution-runner.d.ts +2 -1
- package/esm/src/agent/hosted/child-fork-execution-runner.d.ts.map +1 -1
- package/esm/src/agent/hosted/child-fork-execution-runner.js +6 -3
- package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts +12 -3
- package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -1
- package/esm/src/agent/hosted/child-fork-step-message-preparation.js +16 -3
- package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts +1 -1
- package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-agent-chat-execution.js +3 -3
- package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts +11 -0
- package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-agent-child-tools.js +2 -3
- package/esm/src/agent/hosted/cloud-agent-config.d.ts +1 -0
- package/esm/src/agent/hosted/cloud-agent-config.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts +16 -1
- package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-runtime-system-messages.js +13 -3
- package/esm/src/agent/hosted/default-chat-runtime.d.ts +2 -1
- package/esm/src/agent/hosted/default-chat-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted/default-chat-runtime.js +18 -7
- package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts +2 -1
- package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts.map +1 -1
- package/esm/src/agent/hosted/default-invoke-agent-tool.js +11 -3
- package/esm/src/agent/hosted/default-project-steering-refresh.d.ts +2 -1
- package/esm/src/agent/hosted/default-project-steering-refresh.d.ts.map +1 -1
- package/esm/src/agent/hosted/default-project-steering-refresh.js +4 -1
- package/esm/src/agent/hosted/runtime-state-resolver.d.ts +6 -4
- package/esm/src/agent/hosted/runtime-state-resolver.d.ts.map +1 -1
- package/esm/src/agent/hosted/runtime-state-resolver.js +8 -11
- package/esm/src/agent/index.d.ts +3 -3
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/project/agent-runtime.d.ts.map +1 -1
- package/esm/src/agent/project/agent-runtime.js +6 -3
- package/esm/src/agent/runtime/agent-definition.d.ts +68 -66
- package/esm/src/agent/runtime/agent-definition.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-definition.js +15 -2
- package/esm/src/agent/runtime/agent-invocation-contract.d.ts +2 -0
- package/esm/src/agent/runtime/agent-invocation-contract.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-markdown-adapter.js +1 -1
- package/esm/src/agent/runtime/agent-runtime-step.d.ts +11 -5
- package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-runtime-step.js +23 -6
- package/esm/src/agent/runtime/call-context.d.ts +42 -11
- package/esm/src/agent/runtime/call-context.d.ts.map +1 -1
- package/esm/src/agent/runtime/call-context.js +480 -42
- package/esm/src/agent/runtime/chat-stream-handler.d.ts +18 -0
- package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/chat-stream-handler.js +38 -18
- package/esm/src/agent/runtime/effective-agent-system.d.ts +13 -4
- package/esm/src/agent/runtime/effective-agent-system.d.ts.map +1 -1
- package/esm/src/agent/runtime/effective-agent-system.js +29 -0
- package/esm/src/agent/runtime/index.d.ts +1 -0
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +638 -53
- package/esm/src/agent/runtime/load-skill-tool.d.ts +33 -3
- package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
- package/esm/src/agent/runtime/load-skill-tool.js +152 -21
- package/esm/src/agent/runtime/model-resolution.d.ts +3 -0
- package/esm/src/agent/runtime/model-resolution.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-resolution.js +14 -0
- package/esm/src/agent/runtime/model-transport.d.ts +1 -0
- package/esm/src/agent/runtime/model-transport.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-transport.js +5 -2
- package/esm/src/agent/runtime/run-runtime-context.d.ts +4 -0
- package/esm/src/agent/runtime/run-runtime-context.d.ts.map +1 -1
- package/esm/src/agent/runtime/run-runtime-context.js +9 -3
- package/esm/src/agent/runtime/runtime-tool-config.d.ts +1 -0
- package/esm/src/agent/runtime/runtime-tool-config.d.ts.map +1 -1
- package/esm/src/agent/runtime/skill-prompt.d.ts +3 -0
- package/esm/src/agent/runtime/skill-prompt.d.ts.map +1 -1
- package/esm/src/agent/runtime/skill-prompt.js +113 -25
- package/esm/src/agent/runtime/streamed-assistant-message.d.ts +22 -2
- package/esm/src/agent/runtime/streamed-assistant-message.d.ts.map +1 -1
- package/esm/src/agent/runtime/streamed-assistant-message.js +26 -5
- package/esm/src/agent/runtime/tool-inventory.d.ts.map +1 -1
- package/esm/src/agent/runtime/tool-inventory.js +13 -9
- package/esm/src/agent/runtime/tool-result-continuation.d.ts +4 -2
- package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -1
- package/esm/src/agent/runtime/tool-result-continuation.js +24 -20
- package/esm/src/agent/schemas/agent.schema.d.ts +2 -2
- package/esm/src/agent/service/runtime.js +1 -1
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts +5 -4
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
- package/esm/src/agent/types.d.ts +14 -1
- package/esm/src/agent/types.d.ts.map +1 -1
- package/esm/src/chat/chat-ui-message-helpers.d.ts.map +1 -1
- package/esm/src/chat/chat-ui-message-helpers.js +75 -16
- package/esm/src/config/loader.d.ts.map +1 -1
- package/esm/src/config/loader.js +37 -1
- package/esm/src/errors/catalog/build-errors.d.ts.map +1 -1
- package/esm/src/errors/catalog/build-errors.js +14 -0
- package/esm/src/errors/error-registry/build.d.ts +2 -0
- package/esm/src/errors/error-registry/build.d.ts.map +1 -1
- package/esm/src/errors/error-registry/build.js +8 -0
- package/esm/src/errors/error-registry/deploy.d.ts +4 -0
- package/esm/src/errors/error-registry/deploy.d.ts.map +1 -1
- package/esm/src/errors/error-registry/deploy.js +16 -0
- package/esm/src/errors/error-registry.d.ts +3 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/errors/index.d.ts +2 -1
- package/esm/src/errors/index.d.ts.map +1 -1
- package/esm/src/errors/index.js +4 -3
- package/esm/src/errors/tenant-classification.d.ts +25 -0
- package/esm/src/errors/tenant-classification.d.ts.map +1 -0
- package/esm/src/errors/tenant-classification.js +61 -0
- package/esm/src/extensions/builtin-extensions.d.ts +10 -15
- package/esm/src/extensions/builtin-extensions.d.ts.map +1 -1
- package/esm/src/extensions/builtin-extensions.js +32 -26
- package/esm/src/extensions/deferred-extension.d.ts +4 -4
- package/esm/src/extensions/deferred-extension.js +4 -4
- package/esm/src/extensions/index.d.ts +1 -0
- package/esm/src/extensions/index.d.ts.map +1 -1
- package/esm/src/extensions/index.js +1 -0
- package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
- package/esm/src/integrations/_data.d.ts.map +1 -1
- package/esm/src/integrations/_data.js +6 -0
- package/esm/src/integrations/schema.d.ts +8 -0
- package/esm/src/integrations/schema.d.ts.map +1 -1
- package/esm/src/integrations/schema.js +3 -0
- package/esm/src/integrations/types.d.ts +2 -0
- package/esm/src/integrations/types.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.js +35 -20
- package/esm/src/internal-agents/run-system-prompt.d.ts +7 -2
- package/esm/src/internal-agents/run-system-prompt.d.ts.map +1 -1
- package/esm/src/internal-agents/run-system-prompt.js +19 -13
- package/esm/src/internal-agents/schema.d.ts +2 -0
- package/esm/src/internal-agents/schema.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.js +2 -18
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts +11 -0
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.js +53 -6
- package/esm/src/observability/application-error-contract.d.ts +4 -0
- package/esm/src/observability/application-error-contract.d.ts.map +1 -1
- package/esm/src/observability/application-errors.d.ts.map +1 -1
- package/esm/src/observability/application-errors.js +64 -3
- package/esm/src/platform/adapters/runtime/deno/http-server.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/deno/http-server.js +2 -10
- package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts +14 -0
- package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/shared/request-peer.js +82 -0
- package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
- package/esm/src/provider/runtime-loader/provider-http.d.ts +5 -1
- package/esm/src/provider/runtime-loader/provider-http.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader/provider-http.js +55 -17
- package/esm/src/provider/shared/index.d.ts +1 -0
- package/esm/src/provider/shared/index.d.ts.map +1 -1
- package/esm/src/provider/shared/index.js +2 -0
- package/esm/src/provider/types.d.ts +1 -0
- package/esm/src/provider/types.d.ts.map +1 -1
- package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/combobox.js +204 -0
- package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/dialog.js +20 -0
- package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/drawer.js +21 -0
- package/esm/src/react/components/ui/adapter/builtin/index.d.ts.map +1 -1
- package/esm/src/react/components/ui/adapter/builtin/index.js +10 -0
- package/esm/src/react/components/ui/adapter/builtin/popover.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/popover.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/popover.js +28 -0
- package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/tabs.js +73 -0
- package/esm/src/react/components/ui/adapter/context.d.ts.map +1 -1
- package/esm/src/react/components/ui/adapter/context.js +10 -0
- package/esm/src/react/components/ui/adapter/contract.d.ts +212 -0
- package/esm/src/react/components/ui/adapter/contract.d.ts.map +1 -1
- package/esm/src/react/components/ui/adapter/token-scope.d.ts +24 -0
- package/esm/src/react/components/ui/adapter/token-scope.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/token-scope.js +26 -0
- package/esm/src/react/components/ui/alert-dialog.d.ts +101 -0
- package/esm/src/react/components/ui/alert-dialog.d.ts.map +1 -0
- package/esm/src/react/components/ui/alert-dialog.js +181 -0
- package/esm/src/react/components/ui/aspect-ratio.d.ts +18 -0
- package/esm/src/react/components/ui/aspect-ratio.d.ts.map +1 -0
- package/esm/src/react/components/ui/aspect-ratio.js +13 -0
- package/esm/src/react/components/ui/autocomplete.d.ts +67 -0
- package/esm/src/react/components/ui/autocomplete.d.ts.map +1 -0
- package/esm/src/react/components/ui/autocomplete.js +59 -0
- package/esm/src/react/components/ui/breadcrumb.d.ts +86 -0
- package/esm/src/react/components/ui/breadcrumb.d.ts.map +1 -0
- package/esm/src/react/components/ui/breadcrumb.js +67 -0
- package/esm/src/react/components/ui/calendar.d.ts +40 -0
- package/esm/src/react/components/ui/calendar.d.ts.map +1 -0
- package/esm/src/react/components/ui/calendar.js +170 -0
- package/esm/src/react/components/ui/combobox.d.ts +74 -0
- package/esm/src/react/components/ui/combobox.d.ts.map +1 -0
- package/esm/src/react/components/ui/combobox.js +100 -0
- package/esm/src/react/components/ui/context-menu.d.ts +116 -0
- package/esm/src/react/components/ui/context-menu.d.ts.map +1 -0
- package/esm/src/react/components/ui/context-menu.js +168 -0
- package/esm/src/react/components/ui/date-picker.d.ts +69 -0
- package/esm/src/react/components/ui/date-picker.d.ts.map +1 -0
- package/esm/src/react/components/ui/date-picker.js +96 -0
- package/esm/src/react/components/ui/dialog.d.ts +41 -11
- package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
- package/esm/src/react/components/ui/dialog.js +47 -28
- package/esm/src/react/components/ui/drawer.d.ts +31 -8
- package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
- package/esm/src/react/components/ui/drawer.js +33 -22
- package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
- package/esm/src/react/components/ui/dropdown-menu.js +7 -75
- package/esm/src/react/components/ui/field.d.ts +70 -0
- package/esm/src/react/components/ui/field.d.ts.map +1 -0
- package/esm/src/react/components/ui/field.js +161 -0
- package/esm/src/react/components/ui/file-type.d.ts +9 -8
- package/esm/src/react/components/ui/file-type.d.ts.map +1 -1
- package/esm/src/react/components/ui/file-type.js +8 -8
- package/esm/src/react/components/ui/hover-card.d.ts +82 -0
- package/esm/src/react/components/ui/hover-card.d.ts.map +1 -0
- package/esm/src/react/components/ui/hover-card.js +140 -0
- package/esm/src/react/components/ui/index.d.ts +23 -2
- package/esm/src/react/components/ui/index.d.ts.map +1 -1
- package/esm/src/react/components/ui/index.js +21 -0
- package/esm/src/react/components/ui/input-otp.d.ts +37 -0
- package/esm/src/react/components/ui/input-otp.d.ts.map +1 -0
- package/esm/src/react/components/ui/input-otp.js +42 -0
- package/esm/src/react/components/ui/menu-keyboard.d.ts +8 -0
- package/esm/src/react/components/ui/menu-keyboard.d.ts.map +1 -0
- package/esm/src/react/components/ui/menu-keyboard.js +76 -0
- package/esm/src/react/components/ui/menubar.d.ts +98 -0
- package/esm/src/react/components/ui/menubar.d.ts.map +1 -0
- package/esm/src/react/components/ui/menubar.js +173 -0
- package/esm/src/react/components/ui/meter.d.ts +45 -0
- package/esm/src/react/components/ui/meter.d.ts.map +1 -0
- package/esm/src/react/components/ui/meter.js +59 -0
- package/esm/src/react/components/ui/modal-surface.d.ts +7 -1
- package/esm/src/react/components/ui/modal-surface.d.ts.map +1 -1
- package/esm/src/react/components/ui/modal-surface.js +23 -6
- package/esm/src/react/components/ui/navigation-menu.d.ts +101 -0
- package/esm/src/react/components/ui/navigation-menu.d.ts.map +1 -0
- package/esm/src/react/components/ui/navigation-menu.js +195 -0
- package/esm/src/react/components/ui/number-field.d.ts +46 -0
- package/esm/src/react/components/ui/number-field.d.ts.map +1 -0
- package/esm/src/react/components/ui/number-field.js +121 -0
- package/esm/src/react/components/ui/pagination.d.ts +77 -0
- package/esm/src/react/components/ui/pagination.d.ts.map +1 -0
- package/esm/src/react/components/ui/pagination.js +62 -0
- package/esm/src/react/components/ui/popover.d.ts +42 -13
- package/esm/src/react/components/ui/popover.d.ts.map +1 -1
- package/esm/src/react/components/ui/popover.js +25 -12
- package/esm/src/react/components/ui/scroll-area.d.ts +38 -0
- package/esm/src/react/components/ui/scroll-area.d.ts.map +1 -0
- package/esm/src/react/components/ui/scroll-area.js +35 -0
- package/esm/src/react/components/ui/separator.d.ts +20 -0
- package/esm/src/react/components/ui/separator.d.ts.map +1 -0
- package/esm/src/react/components/ui/separator.js +13 -0
- package/esm/src/react/components/ui/slider.d.ts +44 -0
- package/esm/src/react/components/ui/slider.d.ts.map +1 -0
- package/esm/src/react/components/ui/slider.js +46 -0
- package/esm/src/react/components/ui/status.d.ts +6 -5
- package/esm/src/react/components/ui/status.d.ts.map +1 -1
- package/esm/src/react/components/ui/status.js +4 -4
- package/esm/src/react/components/ui/tabs.d.ts +32 -9
- package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
- package/esm/src/react/components/ui/tabs.js +46 -22
- package/esm/src/react/components/ui/toggle.d.ts +26 -0
- package/esm/src/react/components/ui/toggle.d.ts.map +1 -0
- package/esm/src/react/components/ui/toggle.js +29 -0
- package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts +2 -1
- package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts.map +1 -1
- package/esm/src/react/components/ui/use-isomorphic-layout-effect.js +6 -3
- package/esm/src/rendering/chunk-optimizer/source-imports.d.ts.map +1 -1
- package/esm/src/rendering/chunk-optimizer/source-imports.js +4 -114
- package/esm/src/rendering/orchestrator/css-candidate-manifest.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/css-candidate-manifest.js +30 -1
- package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts +10 -0
- package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/build-failure.js +50 -3
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts +2 -0
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +21 -6
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts +2 -1
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +190 -7
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +4 -0
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +374 -7
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +12 -1
- package/esm/src/runs/runs-client.d.ts +2 -4
- package/esm/src/runs/runs-client.d.ts.map +1 -1
- package/esm/src/runs/schemas.d.ts +18 -8
- package/esm/src/runs/schemas.d.ts.map +1 -1
- package/esm/src/runs/schemas.js +26 -0
- package/esm/src/runtime/model-call-context.d.ts +6 -1
- package/esm/src/runtime/model-call-context.d.ts.map +1 -1
- package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
- package/esm/src/runtime/runtime-bridge.js +133 -15
- package/esm/src/schedule/factory.d.ts +8 -2
- package/esm/src/schedule/factory.d.ts.map +1 -1
- package/esm/src/schedule/factory.js +0 -8
- package/esm/src/schedule/index.d.ts +10 -1
- package/esm/src/schedule/index.d.ts.map +1 -1
- package/esm/src/schedule/index.js +9 -0
- package/esm/src/schedule/types.d.ts +30 -11
- package/esm/src/schedule/types.d.ts.map +1 -1
- package/esm/src/schedule/validation.d.ts +17 -0
- package/esm/src/schedule/validation.d.ts.map +1 -1
- package/esm/src/schedule/validation.js +93 -5
- package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-pool.js +6 -1
- package/esm/src/server/bootstrap.d.ts.map +1 -1
- package/esm/src/server/bootstrap.js +6 -0
- package/esm/src/server/dev-server/index.d.ts +1 -1
- package/esm/src/server/dev-server/index.d.ts.map +1 -1
- package/esm/src/server/dev-server/server.d.ts +7 -3
- package/esm/src/server/dev-server/server.d.ts.map +1 -1
- package/esm/src/server/dev-server/server.js +12 -3
- package/esm/src/server/dev-server/types.d.ts +7 -1
- package/esm/src/server/dev-server/types.d.ts.map +1 -1
- package/esm/src/server/dev-server.d.ts +1 -1
- package/esm/src/server/dev-server.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +2509 -34
- package/esm/src/server/handlers/dev/projects/index.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/projects/index.js +3 -0
- package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/agent-stream.handler.js +29 -24
- package/esm/src/server/index.d.ts +3 -3
- package/esm/src/server/index.d.ts.map +1 -1
- package/esm/src/server/index.js +10 -5
- package/esm/src/server/node-handler.d.ts.map +1 -1
- package/esm/src/server/node-handler.js +4 -1
- package/esm/src/server/production-server.d.ts.map +1 -1
- package/esm/src/server/production-server.js +2 -1
- package/esm/src/server/project-env/cache.d.ts +17 -0
- package/esm/src/server/project-env/cache.d.ts.map +1 -1
- package/esm/src/server/project-env/cache.js +78 -2
- package/esm/src/server/project-env/fetcher.d.ts.map +1 -1
- package/esm/src/server/project-env/fetcher.js +24 -14
- package/esm/src/server/project-env/index.d.ts +1 -1
- package/esm/src/server/project-env/index.d.ts.map +1 -1
- package/esm/src/server/project-env/index.js +1 -1
- package/esm/src/server/project-env/internal-authorization.d.ts +7 -0
- package/esm/src/server/project-env/internal-authorization.d.ts.map +1 -0
- package/esm/src/server/project-env/internal-authorization.js +32 -0
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +1 -1
- package/esm/src/server/runtime-handler/projects-handler.d.ts +1 -1
- package/esm/src/server/runtime-handler/projects-handler.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/projects-handler.js +4 -2
- package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-bundler.js +6 -5
- package/esm/src/transforms/esm/http-cache-helpers.d.ts +11 -0
- package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache-helpers.js +35 -0
- package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache.js +16 -10
- package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
- package/esm/src/transforms/esm/specifier-resolver.js +87 -7
- package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts +2 -0
- package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/strategies/alias-strategy.js +11 -6
- package/esm/src/transforms/md/compiler/md-compiler.d.ts.map +1 -1
- package/esm/src/transforms/md/compiler/md-compiler.js +12 -5
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts +2 -0
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +33 -1
- package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/mdx-compiler.js +46 -7
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +8 -2
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +3 -0
- package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts +4 -0
- package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.js +44 -8
- package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts +2 -0
- package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/missing-module.js +4 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +5 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts +2 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.js +50 -11
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts +24 -12
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.js +201 -18
- package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +5 -0
- package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts +22 -2
- package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.js +2080 -129
- package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts +11 -1
- package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.js +32 -15
- package/esm/src/transforms/pipeline/stages/compile.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/compile.js +44 -0
- package/esm/src/transforms/shared/specifier-suffix.d.ts +25 -0
- package/esm/src/transforms/shared/specifier-suffix.d.ts.map +1 -0
- package/esm/src/transforms/shared/specifier-suffix.js +43 -0
- package/esm/src/trigger/index.d.ts +2 -2
- package/esm/src/trigger/index.d.ts.map +1 -1
- package/esm/src/trigger/index.js +1 -1
- package/esm/src/trigger/local-runner.d.ts +2 -2
- package/esm/src/trigger/local-runner.d.ts.map +1 -1
- package/esm/src/trigger/local-runner.js +11 -4
- package/esm/src/trigger/target.d.ts +97 -5
- package/esm/src/trigger/target.d.ts.map +1 -1
- package/esm/src/trigger/target.js +175 -5
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/webhook/types.d.ts +21 -6
- package/esm/src/webhook/types.d.ts.map +1 -1
- package/esm/src/webhook/validation.d.ts.map +1 -1
- package/esm/src/webhook/validation.js +27 -39
- package/esm/templates/index.d.ts +1 -1
- package/esm/templates/index.d.ts.map +1 -1
- package/esm/templates/loader.d.ts +6 -6
- package/esm/templates/loader.d.ts.map +1 -1
- package/esm/templates/loader.js +34 -18
- package/esm/templates/manifest.generated.d.ts +3 -0
- package/esm/templates/manifest.generated.d.ts.map +1 -0
- package/esm/templates/manifest.generated.js +2 -0
- package/package.json +8 -8
- package/esm/templates/manifest.d.ts +0 -664
- package/esm/templates/manifest.d.ts.map +0 -1
- package/esm/templates/manifest.js +0 -662
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meter: a semantic gauge for a known, bounded measurement (disk usage, a
|
|
3
|
+
* score, remaining quota). A leaf: one root `role="meter"` node carrying the
|
|
4
|
+
* ARIA value range, containing a single fill `<div>` whose width reflects the
|
|
5
|
+
* clamped percentage. Unlike a ProgressBar (task completion), a Meter reports a
|
|
6
|
+
* static reading. Colour tokens follow the repo's `--status-*` semantic palette
|
|
7
|
+
* (matching `Status`) so `success`/`warning`/`danger` read consistently.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { Meter } from "veryfront/ui";
|
|
12
|
+
*
|
|
13
|
+
* <Meter value={82} variant="warning" label="Disk 82% full" />;
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @module react/components/ui/meter
|
|
17
|
+
*/
|
|
18
|
+
import * as React from "react";
|
|
19
|
+
import { cva, cx as cn } from "./cva.js";
|
|
20
|
+
/** Fill colour by semantic variant: token-pure, keyed to the repo palette. */
|
|
21
|
+
const meterFill = cva("h-full rounded-full transition-all duration-500 ease-out", {
|
|
22
|
+
variants: {
|
|
23
|
+
variant: {
|
|
24
|
+
default: "bg-[var(--primary)]",
|
|
25
|
+
success: "bg-[var(--status-success)]",
|
|
26
|
+
warning: "bg-[var(--status-warning)]",
|
|
27
|
+
// --status-error, not --destructive: this keeps the whole variant set on
|
|
28
|
+
// the same --status-* palette Status uses.
|
|
29
|
+
danger: "bg-[var(--status-error)]",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: "default",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
/** Clamp `value` into `[min, max]` and return the fill percentage, guarding `max === min`. */
|
|
37
|
+
function toPercent(value, min, max) {
|
|
38
|
+
const lo = Math.min(min, max);
|
|
39
|
+
const hi = Math.max(min, max);
|
|
40
|
+
const clamped = Math.min(hi, Math.max(lo, Number.isFinite(value) ? value : lo));
|
|
41
|
+
if (hi === lo)
|
|
42
|
+
return 0;
|
|
43
|
+
return ((clamped - lo) / (hi - lo)) * 100;
|
|
44
|
+
}
|
|
45
|
+
/** Clamp `value` into `[min, max]`, guarding non-finite input. */
|
|
46
|
+
function clampValue(value, min, max) {
|
|
47
|
+
const lo = Math.min(min, max);
|
|
48
|
+
const hi = Math.max(min, max);
|
|
49
|
+
return Math.min(hi, Math.max(lo, Number.isFinite(value) ? value : lo));
|
|
50
|
+
}
|
|
51
|
+
/** Render a semantic gauge with a fill sized to the clamped value. */
|
|
52
|
+
export function Meter({ value, min = 0, max = 100, variant = "default", label, className, ref, ...props }) {
|
|
53
|
+
const percent = toPercent(value, min, max);
|
|
54
|
+
const now = clampValue(value, min, max);
|
|
55
|
+
const lo = Math.min(min, max);
|
|
56
|
+
const hi = Math.max(min, max);
|
|
57
|
+
return (React.createElement("div", { ref: ref, role: "meter", "aria-valuenow": now, "aria-valuemin": lo, "aria-valuemax": hi, "aria-valuetext": label, "data-variant": variant, className: cn("w-full h-2.5 overflow-hidden rounded-full bg-[var(--muted)]", className), ...props },
|
|
58
|
+
React.createElement("div", { className: meterFill({ variant }), style: { width: `${percent}%` } })));
|
|
59
|
+
}
|
|
@@ -28,11 +28,17 @@ export interface ModalState {
|
|
|
28
28
|
export interface ModalContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
29
29
|
/** Extra node rendered before `children` -- used by Drawer for the drag handle. */
|
|
30
30
|
lead?: React.ReactNode;
|
|
31
|
+
/** React 19: ref is a regular prop, forwarded to (merged onto) the panel node. */
|
|
32
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
31
33
|
}
|
|
32
34
|
type ModalBtnProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
33
35
|
asChild?: boolean;
|
|
34
36
|
ref?: React.Ref<HTMLButtonElement>;
|
|
35
37
|
};
|
|
38
|
+
/** Run the shared modal focus, stack, scroll-lock, and dismissal lifecycle. */
|
|
39
|
+
export declare function useModalContentEffect(open: boolean, setOpen: (open: boolean) => void, ref: React.RefObject<HTMLElement | null>, triggerRef: React.RefObject<HTMLButtonElement | null>, dismissOnEscape?: boolean): void;
|
|
40
|
+
/** Resolve a token scope outside any clipping modal panel for a modal portal. */
|
|
41
|
+
export declare function getModalTokenScope(document: Document, anchor: HTMLElement | null): HTMLElement;
|
|
36
42
|
/**
|
|
37
43
|
* Creates a fresh context instance plus the Root, useModal, ModalTrigger,
|
|
38
44
|
* ModalClose, and ModalContent parts -- all bound to that context.
|
|
@@ -51,7 +57,7 @@ export declare function createModalSurfaceParts(name: string): {
|
|
|
51
57
|
useModal: () => ModalState;
|
|
52
58
|
ModalTrigger: ({ children, asChild, disabled, id, onClick, ref, type, ...props }: ModalBtnProps) => React.ReactElement;
|
|
53
59
|
ModalClose: ({ children, asChild, disabled, onClick, ref, type, ...props }: ModalBtnProps) => React.ReactElement;
|
|
54
|
-
ModalContent: ({ className, children, lead, id, "aria-label": ariaLabel, "aria-labelledby": labelledBy, ...props }: ModalContentProps) => React.ReactElement | null;
|
|
60
|
+
ModalContent: ({ className, children, lead, id, ref, "aria-label": ariaLabel, "aria-labelledby": labelledBy, ...props }: ModalContentProps) => React.ReactElement | null;
|
|
55
61
|
};
|
|
56
62
|
export {};
|
|
57
63
|
//# sourceMappingURL=modal-surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-surface.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/ui/modal-surface.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAMxE,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,C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K,IAAI,EAChC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACxC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,EACrD,eAAe,UAAO,GACrB,IAAI,CA2DN;AAED,iFAAiF;AACjF,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,WAAW,GAAG,IAAI,GACzB,WAAW,CAQb;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM;+DAKD,iBAAiB,GAAG;QACjE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;KAC3B,KACA,KAAK,CAAC,YAAY;oBAkDA,UAAU;sFAQsC,aAAa,KAC/E,KAAK,CAAC,YAAY;gFAoC4C,aAAa,KAC3E,KAAK,CAAC,YAAY;6HA+BhB,iBAAiB,KACnB,KAAK,CAAC,YAAY,GAAG,IAAI;EA0D7B"}
|
|
@@ -42,7 +42,8 @@ function lockDocumentScroll(document) {
|
|
|
42
42
|
function isFocusableElement(value) {
|
|
43
43
|
return value !== null && typeof value.focus === "function";
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
/** Run the shared modal focus, stack, scroll-lock, and dismissal lifecycle. */
|
|
46
|
+
export function useModalContentEffect(open, setOpen, ref, triggerRef, dismissOnEscape = true) {
|
|
46
47
|
React.useEffect(() => {
|
|
47
48
|
const panel = ref.current;
|
|
48
49
|
if (!open || !panel)
|
|
@@ -56,7 +57,10 @@ function useModalContentEffect(open, setOpen, ref, triggerRef) {
|
|
|
56
57
|
: null;
|
|
57
58
|
const unlockScroll = lockDocumentScroll(document);
|
|
58
59
|
const isTopModal = () => stack.at(-1) === panel;
|
|
59
|
-
const unregisterDismissableLayer = registerDismissableLayer(document, () => ref.current, () =>
|
|
60
|
+
const unregisterDismissableLayer = registerDismissableLayer(document, () => ref.current, () => {
|
|
61
|
+
if (dismissOnEscape)
|
|
62
|
+
setOpen(false);
|
|
63
|
+
});
|
|
60
64
|
const onKey = (e) => {
|
|
61
65
|
if (!isTopModal() || e.defaultPrevented)
|
|
62
66
|
return;
|
|
@@ -97,7 +101,17 @@ function useModalContentEffect(open, setOpen, ref, triggerRef) {
|
|
|
97
101
|
if (restoreTarget)
|
|
98
102
|
focusWithoutScroll(restoreTarget);
|
|
99
103
|
};
|
|
100
|
-
}, [open, ref, setOpen, triggerRef]);
|
|
104
|
+
}, [dismissOnEscape, open, ref, setOpen, triggerRef]);
|
|
105
|
+
}
|
|
106
|
+
/** Resolve a token scope outside any clipping modal panel for a modal portal. */
|
|
107
|
+
export function getModalTokenScope(document, anchor) {
|
|
108
|
+
const activeScope = document.activeElement?.closest(UI_SCOPE_SELECTOR);
|
|
109
|
+
const scopes = document.querySelectorAll(UI_SCOPE_SELECTOR);
|
|
110
|
+
return anchor?.closest(UI_SCOPE_SELECTOR) ??
|
|
111
|
+
modalStacks.get(document)?.at(-1)?.closest(UI_SCOPE_SELECTOR) ??
|
|
112
|
+
activeScope ??
|
|
113
|
+
(scopes.length === 1 ? scopes[0] : undefined) ??
|
|
114
|
+
document.body;
|
|
101
115
|
}
|
|
102
116
|
/**
|
|
103
117
|
* Creates a fresh context instance plus the Root, useModal, ModalTrigger,
|
|
@@ -192,9 +206,12 @@ export function createModalSurfaceParts(name) {
|
|
|
192
206
|
} }, children));
|
|
193
207
|
}
|
|
194
208
|
/** Fixed overlay + panel shell. Skins supply panel layout via `className`. */
|
|
195
|
-
function ModalContent({ className, children, lead, id, "aria-label": ariaLabel, "aria-labelledby": labelledBy, ...props }) {
|
|
209
|
+
function ModalContent({ className, children, lead, id, ref, "aria-label": ariaLabel, "aria-labelledby": labelledBy, ...props }) {
|
|
196
210
|
const ctx = useModal();
|
|
197
211
|
const panelRef = React.useRef(null);
|
|
212
|
+
// Merge the internal panel ref (read by the focus/dismiss effects) with any
|
|
213
|
+
// consumer ref, so `<DialogContent ref={...}>` reaches the panel node too.
|
|
214
|
+
const setPanelNode = React.useMemo(() => composeRefs(panelRef, ref), [ref]);
|
|
198
215
|
const resolvedId = id ?? ctx.defaultContentId;
|
|
199
216
|
const [portalReady, setPortalReady] = React.useState(false);
|
|
200
217
|
React.useEffect(() => setPortalReady(true), []);
|
|
@@ -212,10 +229,10 @@ export function createModalSurfaceParts(name) {
|
|
|
212
229
|
if (!document?.body)
|
|
213
230
|
return null;
|
|
214
231
|
const container = trigger?.closest("[data-vf-modal-content]") ??
|
|
215
|
-
trigger
|
|
232
|
+
getModalTokenScope(document, trigger);
|
|
216
233
|
return createPortal(React.createElement("div", { className: "fixed inset-0 z-50" },
|
|
217
234
|
React.createElement("div", { "aria-hidden": "true", className: "fixed inset-0 bg-[var(--overlay)]", onClick: () => ctx.setOpen(false) }),
|
|
218
|
-
React.createElement("div", { ...props, ref:
|
|
235
|
+
React.createElement("div", { ...props, ref: setPanelNode, id: resolvedId, "data-vf-modal-content": "", role: "dialog", "aria-modal": "true", "aria-label": ariaLabel ?? (!labelledBy && !ctx.titlePresent ? name : undefined), "aria-labelledby": labelledBy ?? (ctx.titlePresent ? ctx.titleId : undefined), tabIndex: -1, className: className },
|
|
219
236
|
lead,
|
|
220
237
|
children)), container);
|
|
221
238
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NavigationMenu: a horizontal site-navigation bar whose items can open a
|
|
3
|
+
* dropdown panel of links. Self-contained (context + `aria-expanded` triggers,
|
|
4
|
+
* no floating engine): the root owns which item's panel is open and only one is
|
|
5
|
+
* open at a time. A `NavigationMenuTrigger` toggles its panel on click and opens
|
|
6
|
+
* it on pointer-enter; its `NavigationMenuContent` renders absolutely under the
|
|
7
|
+
* trigger while open (`data-state="open"`). Plain `NavigationMenuLink` items with
|
|
8
|
+
* no panel are supported for simple top-level links. Skinned with veryfront
|
|
9
|
+
* theme tokens.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import {
|
|
14
|
+
* NavigationMenu,
|
|
15
|
+
* NavigationMenuContent,
|
|
16
|
+
* NavigationMenuItem,
|
|
17
|
+
* NavigationMenuLink,
|
|
18
|
+
* NavigationMenuList,
|
|
19
|
+
* NavigationMenuTrigger,
|
|
20
|
+
* } from "veryfront/ui";
|
|
21
|
+
*
|
|
22
|
+
* <NavigationMenu>
|
|
23
|
+
* <NavigationMenuList>
|
|
24
|
+
* <NavigationMenuItem value="products">
|
|
25
|
+
* <NavigationMenuTrigger>Products</NavigationMenuTrigger>
|
|
26
|
+
* <NavigationMenuContent>
|
|
27
|
+
* <NavigationMenuLink href="/analytics">Analytics</NavigationMenuLink>
|
|
28
|
+
* <NavigationMenuLink href="/automation">Automation</NavigationMenuLink>
|
|
29
|
+
* </NavigationMenuContent>
|
|
30
|
+
* </NavigationMenuItem>
|
|
31
|
+
* <NavigationMenuItem value="docs">
|
|
32
|
+
* <NavigationMenuLink href="/docs">Docs</NavigationMenuLink>
|
|
33
|
+
* </NavigationMenuItem>
|
|
34
|
+
* </NavigationMenuList>
|
|
35
|
+
* </NavigationMenu>;
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @module react/components/ui/navigation-menu
|
|
39
|
+
*/
|
|
40
|
+
import * as React from "react";
|
|
41
|
+
/** Props accepted by `<NavigationMenu>`. */
|
|
42
|
+
export interface NavigationMenuProps extends React.HTMLAttributes<HTMLElement> {
|
|
43
|
+
/** Accessible name for the navigation landmark. @default "Main" */
|
|
44
|
+
label?: string;
|
|
45
|
+
/** The `NavigationMenuList` (and its items) that make up the nav. */
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
/** React 19: ref is a regular prop, points at the `<nav>` landmark. */
|
|
48
|
+
ref?: React.Ref<HTMLElement>;
|
|
49
|
+
}
|
|
50
|
+
/** Navigation root: a `<nav>` landmark that owns which item's panel is open. */
|
|
51
|
+
export declare function NavigationMenu({ label, className, children, ref, onBlur, onKeyDown, ...props }: NavigationMenuProps): React.ReactElement;
|
|
52
|
+
/** Props accepted by `<NavigationMenuList>`. */
|
|
53
|
+
export interface NavigationMenuListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
54
|
+
/** The `NavigationMenuItem` children of the bar. */
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
/** React 19: ref is a regular prop, points at the `<ul>`. */
|
|
57
|
+
ref?: React.Ref<HTMLUListElement>;
|
|
58
|
+
}
|
|
59
|
+
/** The horizontal list container: a flex `<ul>` of items. */
|
|
60
|
+
export declare function NavigationMenuList({ className, children, ref, ...props }: NavigationMenuListProps): React.ReactElement;
|
|
61
|
+
/** Props accepted by `<NavigationMenuItem>`. */
|
|
62
|
+
export interface NavigationMenuItemProps extends React.LiHTMLAttributes<HTMLLIElement> {
|
|
63
|
+
/** Stable identifier linking this item's trigger to its panel and open state. */
|
|
64
|
+
value: string;
|
|
65
|
+
/** The `NavigationMenuTrigger` + `NavigationMenuContent` (or a plain `NavigationMenuLink`). */
|
|
66
|
+
children: React.ReactNode;
|
|
67
|
+
/** React 19: ref is a regular prop, points at the `<li>`. */
|
|
68
|
+
ref?: React.Ref<HTMLLIElement>;
|
|
69
|
+
}
|
|
70
|
+
/** One item in the bar: an `<li>` that provides its value to its trigger/panel. */
|
|
71
|
+
export declare function NavigationMenuItem({ value, className, children, ref, ...props }: NavigationMenuItemProps): React.ReactElement;
|
|
72
|
+
/** Props accepted by `<NavigationMenuTrigger>`. */
|
|
73
|
+
export interface NavigationMenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
74
|
+
/** The trigger label (usually a nav word like "Products"). */
|
|
75
|
+
children: React.ReactNode;
|
|
76
|
+
/** React 19: ref is a regular prop, points at the trigger button. */
|
|
77
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
78
|
+
}
|
|
79
|
+
/** The button that toggles its item's panel: `aria-expanded` + `aria-controls`, with a caret. */
|
|
80
|
+
export declare function NavigationMenuTrigger({ className, onClick, onPointerEnter, onPointerLeave, children, ref, ...props }: NavigationMenuTriggerProps): React.ReactElement;
|
|
81
|
+
/** Props accepted by `<NavigationMenuContent>`. */
|
|
82
|
+
export interface NavigationMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
83
|
+
/** The `NavigationMenuLink`s (or other content) for this item's dropdown panel. */
|
|
84
|
+
children: React.ReactNode;
|
|
85
|
+
/** React 19: ref is a regular prop, points at the panel. */
|
|
86
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
87
|
+
}
|
|
88
|
+
/** The dropdown panel for one item: absolutely positioned, rendered only while open. */
|
|
89
|
+
export declare function NavigationMenuContent({ className, children, ref, onPointerEnter, onPointerLeave, ...props }: NavigationMenuContentProps): React.ReactElement | null;
|
|
90
|
+
/** Props accepted by `<NavigationMenuLink>`. */
|
|
91
|
+
export interface NavigationMenuLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
92
|
+
/** Marks this link as the current page (`aria-current="page"` + active styling). @default false */
|
|
93
|
+
active?: boolean;
|
|
94
|
+
/** The link label / content. */
|
|
95
|
+
children: React.ReactNode;
|
|
96
|
+
/** React 19: ref is a regular prop, points at the `<a>`. */
|
|
97
|
+
ref?: React.Ref<HTMLAnchorElement>;
|
|
98
|
+
}
|
|
99
|
+
/** A single navigable link: used inside a panel or as a plain top-level item. */
|
|
100
|
+
export declare function NavigationMenuLink({ active, className, children, ref, ...props }: NavigationMenuLinkProps): React.ReactElement;
|
|
101
|
+
//# sourceMappingURL=navigation-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-menu.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/ui/navigation-menu.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6C/B,4CAA4C;AAC5C,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CA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|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NavigationMenu: a horizontal site-navigation bar whose items can open a
|
|
3
|
+
* dropdown panel of links. Self-contained (context + `aria-expanded` triggers,
|
|
4
|
+
* no floating engine): the root owns which item's panel is open and only one is
|
|
5
|
+
* open at a time. A `NavigationMenuTrigger` toggles its panel on click and opens
|
|
6
|
+
* it on pointer-enter; its `NavigationMenuContent` renders absolutely under the
|
|
7
|
+
* trigger while open (`data-state="open"`). Plain `NavigationMenuLink` items with
|
|
8
|
+
* no panel are supported for simple top-level links. Skinned with veryfront
|
|
9
|
+
* theme tokens.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import {
|
|
14
|
+
* NavigationMenu,
|
|
15
|
+
* NavigationMenuContent,
|
|
16
|
+
* NavigationMenuItem,
|
|
17
|
+
* NavigationMenuLink,
|
|
18
|
+
* NavigationMenuList,
|
|
19
|
+
* NavigationMenuTrigger,
|
|
20
|
+
* } from "veryfront/ui";
|
|
21
|
+
*
|
|
22
|
+
* <NavigationMenu>
|
|
23
|
+
* <NavigationMenuList>
|
|
24
|
+
* <NavigationMenuItem value="products">
|
|
25
|
+
* <NavigationMenuTrigger>Products</NavigationMenuTrigger>
|
|
26
|
+
* <NavigationMenuContent>
|
|
27
|
+
* <NavigationMenuLink href="/analytics">Analytics</NavigationMenuLink>
|
|
28
|
+
* <NavigationMenuLink href="/automation">Automation</NavigationMenuLink>
|
|
29
|
+
* </NavigationMenuContent>
|
|
30
|
+
* </NavigationMenuItem>
|
|
31
|
+
* <NavigationMenuItem value="docs">
|
|
32
|
+
* <NavigationMenuLink href="/docs">Docs</NavigationMenuLink>
|
|
33
|
+
* </NavigationMenuItem>
|
|
34
|
+
* </NavigationMenuList>
|
|
35
|
+
* </NavigationMenu>;
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @module react/components/ui/navigation-menu
|
|
39
|
+
*/
|
|
40
|
+
import * as React from "react";
|
|
41
|
+
import { cx as cn } from "./cva.js";
|
|
42
|
+
import { focusWithoutScroll } from "./focus-management.js";
|
|
43
|
+
import { composeRefs } from "./slot.js";
|
|
44
|
+
const CLOSE_DELAY_MS = 100;
|
|
45
|
+
const NavigationMenuContext = React.createContext(null);
|
|
46
|
+
/** Per-item context carrying the identity that links a trigger to its panel. */
|
|
47
|
+
const NavigationMenuItemContext = React.createContext(null);
|
|
48
|
+
function useNavigationMenuContext(part) {
|
|
49
|
+
const ctx = React.useContext(NavigationMenuContext);
|
|
50
|
+
if (!ctx)
|
|
51
|
+
throw new Error(`<${part}> must be used within <NavigationMenu>`);
|
|
52
|
+
return ctx;
|
|
53
|
+
}
|
|
54
|
+
function useNavigationMenuItem(part) {
|
|
55
|
+
const identity = React.useContext(NavigationMenuItemContext);
|
|
56
|
+
if (identity == null)
|
|
57
|
+
throw new Error(`<${part}> must be used within <NavigationMenuItem>`);
|
|
58
|
+
return identity;
|
|
59
|
+
}
|
|
60
|
+
/** Navigation root: a `<nav>` landmark that owns which item's panel is open. */
|
|
61
|
+
export function NavigationMenu({ label = "Main", className, children, ref, onBlur, onKeyDown, ...props }) {
|
|
62
|
+
const [openItemId, setOpenItemIdState] = React.useState(null);
|
|
63
|
+
const closeTimerRef = React.useRef(null);
|
|
64
|
+
const triggerRefs = React.useRef(new Map());
|
|
65
|
+
const cancelClose = React.useCallback(() => {
|
|
66
|
+
if (closeTimerRef.current != null) {
|
|
67
|
+
clearTimeout(closeTimerRef.current);
|
|
68
|
+
closeTimerRef.current = null;
|
|
69
|
+
}
|
|
70
|
+
}, []);
|
|
71
|
+
const setOpenItemId = React.useCallback((itemId) => {
|
|
72
|
+
cancelClose();
|
|
73
|
+
setOpenItemIdState(itemId);
|
|
74
|
+
}, [cancelClose]);
|
|
75
|
+
const scheduleClose = React.useCallback((itemId) => {
|
|
76
|
+
cancelClose();
|
|
77
|
+
closeTimerRef.current = setTimeout(() => {
|
|
78
|
+
closeTimerRef.current = null;
|
|
79
|
+
setOpenItemIdState((current) => current === itemId ? null : current);
|
|
80
|
+
}, CLOSE_DELAY_MS);
|
|
81
|
+
}, [cancelClose]);
|
|
82
|
+
const registerTrigger = React.useCallback((itemId, element) => {
|
|
83
|
+
if (element)
|
|
84
|
+
triggerRefs.current.set(itemId, element);
|
|
85
|
+
else
|
|
86
|
+
triggerRefs.current.delete(itemId);
|
|
87
|
+
}, []);
|
|
88
|
+
const getTrigger = React.useCallback((itemId) => {
|
|
89
|
+
return triggerRefs.current.get(itemId) ?? null;
|
|
90
|
+
}, []);
|
|
91
|
+
const closeAndRestoreTrigger = React.useCallback(() => {
|
|
92
|
+
const itemId = openItemId;
|
|
93
|
+
if (itemId == null)
|
|
94
|
+
return;
|
|
95
|
+
const trigger = getTrigger(itemId);
|
|
96
|
+
setOpenItemId(null);
|
|
97
|
+
queueMicrotask(() => {
|
|
98
|
+
if (trigger?.isConnected)
|
|
99
|
+
focusWithoutScroll(trigger);
|
|
100
|
+
});
|
|
101
|
+
}, [getTrigger, openItemId, setOpenItemId]);
|
|
102
|
+
React.useEffect(() => cancelClose, [cancelClose]);
|
|
103
|
+
const ctx = React.useMemo(() => ({ openItemId, setOpenItemId, cancelClose, scheduleClose, registerTrigger, getTrigger }), [openItemId, setOpenItemId, cancelClose, scheduleClose, registerTrigger, getTrigger]);
|
|
104
|
+
return (React.createElement(NavigationMenuContext.Provider, { value: ctx },
|
|
105
|
+
React.createElement("nav", { ref: ref, "aria-label": label, "data-state": openItemId == null ? "closed" : "open", className: cn("relative inline-flex max-w-max items-center", className), onBlur: (event) => {
|
|
106
|
+
onBlur?.(event);
|
|
107
|
+
if (event.defaultPrevented)
|
|
108
|
+
return;
|
|
109
|
+
const next = event.relatedTarget;
|
|
110
|
+
if (!(next instanceof HTMLElement) || !event.currentTarget.contains(next)) {
|
|
111
|
+
setOpenItemId(null);
|
|
112
|
+
}
|
|
113
|
+
}, onKeyDown: (event) => {
|
|
114
|
+
onKeyDown?.(event);
|
|
115
|
+
if (event.defaultPrevented)
|
|
116
|
+
return;
|
|
117
|
+
if (event.key !== "Escape" || openItemId == null)
|
|
118
|
+
return;
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
closeAndRestoreTrigger();
|
|
121
|
+
}, ...props }, children)));
|
|
122
|
+
}
|
|
123
|
+
/** The horizontal list container: a flex `<ul>` of items. */
|
|
124
|
+
export function NavigationMenuList({ className, children, ref, ...props }) {
|
|
125
|
+
return (React.createElement("ul", { ref: ref, className: cn("flex flex-1 list-none items-center gap-1", className), ...props }, children));
|
|
126
|
+
}
|
|
127
|
+
/** One item in the bar: an `<li>` that provides its value to its trigger/panel. */
|
|
128
|
+
export function NavigationMenuItem({ value, className, children, ref, ...props }) {
|
|
129
|
+
const ctx = React.useContext(NavigationMenuContext);
|
|
130
|
+
// Identity is per instance, not per `value`. Two items may legitimately carry
|
|
131
|
+
// the same `value`; keying open state on it would open both panels at once
|
|
132
|
+
// and mint duplicate panel ids, making aria-controls ambiguous.
|
|
133
|
+
const reactId = React.useId();
|
|
134
|
+
const itemId = `vf-navigation-menu-${reactId}`;
|
|
135
|
+
const open = ctx?.openItemId === itemId;
|
|
136
|
+
const identity = React.useMemo(() => ({ value, itemId }), [value, itemId]);
|
|
137
|
+
return (React.createElement(NavigationMenuItemContext.Provider, { value: identity },
|
|
138
|
+
React.createElement("li", { ref: ref, "data-value": value, "data-state": open ? "open" : "closed", className: cn("relative", className), ...props }, children)));
|
|
139
|
+
}
|
|
140
|
+
/** The button that toggles its item's panel: `aria-expanded` + `aria-controls`, with a caret. */
|
|
141
|
+
export function NavigationMenuTrigger({ className, onClick, onPointerEnter, onPointerLeave, children, ref, ...props }) {
|
|
142
|
+
const ctx = useNavigationMenuContext("NavigationMenuTrigger");
|
|
143
|
+
const { itemId } = useNavigationMenuItem("NavigationMenuTrigger");
|
|
144
|
+
const open = ctx.openItemId === itemId;
|
|
145
|
+
const panelId = `${itemId}-panel`;
|
|
146
|
+
const triggerRef = React.useCallback((element) => {
|
|
147
|
+
ctx.registerTrigger(itemId, element);
|
|
148
|
+
}, [ctx, itemId]);
|
|
149
|
+
const composedRef = React.useMemo(() => composeRefs(triggerRef, ref), [ref, triggerRef]);
|
|
150
|
+
return (React.createElement("button", { ref: composedRef, type: "button", "aria-expanded": open, "aria-controls": open ? panelId : undefined, "data-state": open ? "open" : "closed", onClick: (event) => {
|
|
151
|
+
onClick?.(event);
|
|
152
|
+
if (!event.defaultPrevented)
|
|
153
|
+
ctx.setOpenItemId(open ? null : itemId);
|
|
154
|
+
}, onPointerEnter: (event) => {
|
|
155
|
+
onPointerEnter?.(event);
|
|
156
|
+
if (!event.defaultPrevented && !event.currentTarget.disabled) {
|
|
157
|
+
ctx.setOpenItemId(itemId);
|
|
158
|
+
}
|
|
159
|
+
}, onPointerLeave: (event) => {
|
|
160
|
+
onPointerLeave?.(event);
|
|
161
|
+
if (!event.defaultPrevented && open)
|
|
162
|
+
ctx.scheduleClose(itemId);
|
|
163
|
+
}, className: cn("inline-flex h-9 select-none items-center gap-1 rounded-md px-3 text-sm font-medium", "text-[var(--foreground)] outline-none transition-colors", "hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]", "focus-visible:ring-2 focus-visible:ring-[var(--ring)]", "data-[state=open]:bg-[var(--accent)] data-[state=open]:text-[var(--accent-foreground)]", className), ...props },
|
|
164
|
+
children,
|
|
165
|
+
React.createElement("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", className: "h-3 w-3 transition-transform duration-200 data-[state=open]:rotate-180", "data-state": open ? "open" : "closed", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
166
|
+
React.createElement("polyline", { points: "6 9 12 15 18 9" }))));
|
|
167
|
+
}
|
|
168
|
+
/** The dropdown panel for one item: absolutely positioned, rendered only while open. */
|
|
169
|
+
export function NavigationMenuContent({ className, children, ref, onPointerEnter, onPointerLeave, ...props }) {
|
|
170
|
+
const ctx = useNavigationMenuContext("NavigationMenuContent");
|
|
171
|
+
const { itemId } = useNavigationMenuItem("NavigationMenuContent");
|
|
172
|
+
const open = ctx.openItemId === itemId;
|
|
173
|
+
if (!open)
|
|
174
|
+
return null;
|
|
175
|
+
// Deliberately not role="menu". That role declares an application-menu
|
|
176
|
+
// keyboard model (arrows, Home/End, Escape, roving focus) which site
|
|
177
|
+
// navigation does not implement and does not want. A plain disclosure panel
|
|
178
|
+
// of links is the accessible pattern here.
|
|
179
|
+
return (React.createElement("div", { ref: ref, id: `${itemId}-panel`, "data-slot": "navigation-menu-content", "data-state": "open", className: cn("absolute left-0 top-full z-50 mt-1 flex min-w-[12rem] flex-col gap-1 p-1", "rounded-md border border-[var(--border)] bg-[var(--popover)] text-[var(--popover-foreground)] shadow-md", className), onPointerEnter: (event) => {
|
|
180
|
+
onPointerEnter?.(event);
|
|
181
|
+
if (!event.defaultPrevented)
|
|
182
|
+
ctx.cancelClose();
|
|
183
|
+
}, onPointerLeave: (event) => {
|
|
184
|
+
onPointerLeave?.(event);
|
|
185
|
+
if (!event.defaultPrevented)
|
|
186
|
+
ctx.scheduleClose(itemId);
|
|
187
|
+
}, ...props }, children));
|
|
188
|
+
}
|
|
189
|
+
/** A single navigable link: used inside a panel or as a plain top-level item. */
|
|
190
|
+
export function NavigationMenuLink({ active = false, className, children, ref, ...props }) {
|
|
191
|
+
return (
|
|
192
|
+
// No role="menuitem": it is only meaningful inside a real menu/menubar, and
|
|
193
|
+
// a plain top-level link has no menu owner at all. A bare <a> is correct.
|
|
194
|
+
React.createElement("a", { ref: ref, "aria-current": active ? "page" : undefined, "data-active": active ? "" : undefined, className: cn("block select-none rounded-md px-3 py-2 text-sm font-medium no-underline outline-none transition-colors", "text-[var(--foreground)]", "hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]", "focus-visible:ring-2 focus-visible:ring-[var(--ring)]", "data-[active]:bg-[var(--accent)] data-[active]:text-[var(--accent-foreground)]", className), ...props }, children));
|
|
195
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NumberField - a numeric text input with clamping and keyboard stepping.
|
|
3
|
+
*
|
|
4
|
+
* A single `<input>` that keeps its value within
|
|
5
|
+
* `[min, max]`, rounds to `step`, and steps with ArrowUp/ArrowDown. Controlled
|
|
6
|
+
* via `value`/`onValueChange` or uncontrolled via `defaultValue`. Skinned with
|
|
7
|
+
* the veryfront theme tokens; no adapter or engine required.
|
|
8
|
+
*
|
|
9
|
+
* @example Uncontrolled, clamped 0-10
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { NumberField } from "veryfront/ui";
|
|
12
|
+
*
|
|
13
|
+
* <NumberField defaultValue={1} min={0} max={10} aria-label="Quantity" />;
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Controlled
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const [qty, setQty] = React.useState(1);
|
|
19
|
+
* <NumberField value={qty} onValueChange={setQty} min={1} step={1} />;
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @module react/components/ui/number-field
|
|
23
|
+
*/
|
|
24
|
+
import * as React from "react";
|
|
25
|
+
/** Props accepted by `<NumberField>`. */
|
|
26
|
+
export interface NumberFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange"> {
|
|
27
|
+
/** Controlled value (pair with `onValueChange`). `null` means empty. */
|
|
28
|
+
value?: number | null;
|
|
29
|
+
/** Initial value when uncontrolled. */
|
|
30
|
+
defaultValue?: number;
|
|
31
|
+
/** Fires with the next value (`null` when the field is cleared). */
|
|
32
|
+
onValueChange?: (value: number | null) => void;
|
|
33
|
+
/** Smallest allowed value; also the floor for ArrowDown stepping. */
|
|
34
|
+
min?: number;
|
|
35
|
+
/** Largest allowed value; also the ceiling for ArrowUp stepping. */
|
|
36
|
+
max?: number;
|
|
37
|
+
/** Increment applied on ArrowUp/ArrowDown and used to round input. @default 1 */
|
|
38
|
+
step?: number;
|
|
39
|
+
/** React 19: ref is a regular prop. */
|
|
40
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
41
|
+
}
|
|
42
|
+
/** Quantize a value to the nearest positive step, using `min` as the step base. */
|
|
43
|
+
export declare function quantizeNumberFieldValue(value: number, step: number, min?: number): number;
|
|
44
|
+
/** Render a numeric input that clamps to `[min, max]` and steps by `step`. */
|
|
45
|
+
export declare function NumberField({ value, defaultValue, onValueChange, min, max, step, className, disabled, inputMode, onKeyDown, onBlur, ref, ...props }: NumberFieldProps): React.ReactElement;
|
|
46
|
+
//# sourceMappingURL=number-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-field.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/ui/number-field.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,yCAAyC;AACzC,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC;IAChG,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACnC;AAeD,mFAAmF;AACnF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAM1F;AAWD,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,YAAY,EACZ,aAAa,EACb,GAAG,EACH,GAAG,EACH,IAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,MAAM,EACN,GAAG,EACH,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CA8FvC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NumberField - a numeric text input with clamping and keyboard stepping.
|
|
3
|
+
*
|
|
4
|
+
* A single `<input>` that keeps its value within
|
|
5
|
+
* `[min, max]`, rounds to `step`, and steps with ArrowUp/ArrowDown. Controlled
|
|
6
|
+
* via `value`/`onValueChange` or uncontrolled via `defaultValue`. Skinned with
|
|
7
|
+
* the veryfront theme tokens; no adapter or engine required.
|
|
8
|
+
*
|
|
9
|
+
* @example Uncontrolled, clamped 0-10
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { NumberField } from "veryfront/ui";
|
|
12
|
+
*
|
|
13
|
+
* <NumberField defaultValue={1} min={0} max={10} aria-label="Quantity" />;
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Controlled
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const [qty, setQty] = React.useState(1);
|
|
19
|
+
* <NumberField value={qty} onValueChange={setQty} min={1} step={1} />;
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @module react/components/ui/number-field
|
|
23
|
+
*/
|
|
24
|
+
import * as React from "react";
|
|
25
|
+
import { cx as cn } from "./cva.js";
|
|
26
|
+
const COMPLETE_NUMBER_PATTERN = /^[+-]?(?:\d+|\d*\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
27
|
+
const NUMERIC_PREFIX_PATTERN = /^[+-]?(?:(?:\d+\.?\d*)|(?:\.\d*))?(?:[eE][+-]?\d*)?$/;
|
|
28
|
+
function clamp(n, min, max) {
|
|
29
|
+
if (min != null && n < min)
|
|
30
|
+
return min;
|
|
31
|
+
if (max != null && n > max)
|
|
32
|
+
return max;
|
|
33
|
+
return n;
|
|
34
|
+
}
|
|
35
|
+
function decimalPlaces(value) {
|
|
36
|
+
const [coefficient, exponentText] = value.toString().toLowerCase().split("e");
|
|
37
|
+
const fractionLength = coefficient?.split(".")[1]?.length ?? 0;
|
|
38
|
+
const exponent = Number(exponentText ?? 0);
|
|
39
|
+
return Math.max(0, fractionLength - exponent);
|
|
40
|
+
}
|
|
41
|
+
/** Quantize a value to the nearest positive step, using `min` as the step base. */
|
|
42
|
+
export function quantizeNumberFieldValue(value, step, min) {
|
|
43
|
+
if (!Number.isFinite(step) || step <= 0)
|
|
44
|
+
return value;
|
|
45
|
+
const base = min ?? 0;
|
|
46
|
+
const quantized = base + Math.round((value - base) / step) * step;
|
|
47
|
+
const precision = Math.min(12, Math.max(decimalPlaces(base), decimalPlaces(step)));
|
|
48
|
+
return Number(quantized.toFixed(precision));
|
|
49
|
+
}
|
|
50
|
+
function normalizeNumberFieldValue(value, step, min, max) {
|
|
51
|
+
return clamp(quantizeNumberFieldValue(value, step, min), min, max);
|
|
52
|
+
}
|
|
53
|
+
/** Render a numeric input that clamps to `[min, max]` and steps by `step`. */
|
|
54
|
+
export function NumberField({ value, defaultValue, onValueChange, min, max, step = 1, className, disabled, inputMode, onKeyDown, onBlur, ref, ...props }) {
|
|
55
|
+
const isControlled = value !== undefined;
|
|
56
|
+
const [internal, setInternal] = React.useState(() => defaultValue == null ? null : normalizeNumberFieldValue(defaultValue, step, min, max));
|
|
57
|
+
const [draft, setDraft] = React.useState(null);
|
|
58
|
+
const current = isControlled ? value : internal;
|
|
59
|
+
const controlledValueRef = React.useRef(value);
|
|
60
|
+
const resolvedInputMode = inputMode ?? (Number.isInteger(step) ? "numeric" : "decimal");
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
if (isControlled && !Object.is(controlledValueRef.current, value))
|
|
63
|
+
setDraft(null);
|
|
64
|
+
controlledValueRef.current = value;
|
|
65
|
+
}, [isControlled, value]);
|
|
66
|
+
const commit = (next) => {
|
|
67
|
+
if (!isControlled)
|
|
68
|
+
setInternal(next);
|
|
69
|
+
onValueChange?.(next);
|
|
70
|
+
};
|
|
71
|
+
const handleChange = (event) => {
|
|
72
|
+
const raw = event.target.value.trim();
|
|
73
|
+
if (raw === "") {
|
|
74
|
+
setDraft(null);
|
|
75
|
+
return commit(null);
|
|
76
|
+
}
|
|
77
|
+
if (NUMERIC_PREFIX_PATTERN.test(raw) && !COMPLETE_NUMBER_PATTERN.test(raw)) {
|
|
78
|
+
setDraft(event.target.value);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const parsed = Number(raw);
|
|
82
|
+
if (Number.isNaN(parsed))
|
|
83
|
+
return;
|
|
84
|
+
setDraft(null);
|
|
85
|
+
commit(normalizeNumberFieldValue(parsed, step, min, max));
|
|
86
|
+
};
|
|
87
|
+
const handleBlur = (event) => {
|
|
88
|
+
onBlur?.(event);
|
|
89
|
+
if (event.defaultPrevented || draft == null)
|
|
90
|
+
return;
|
|
91
|
+
const parsed = Number(draft.trim());
|
|
92
|
+
setDraft(null);
|
|
93
|
+
if (!Number.isNaN(parsed)) {
|
|
94
|
+
commit(normalizeNumberFieldValue(parsed, step, min, max));
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const nudge = (direction) => {
|
|
98
|
+
const parsedDraft = draft == null ? Number.NaN : Number(draft.trim());
|
|
99
|
+
const draftBase = Number.isNaN(parsedDraft)
|
|
100
|
+
? null
|
|
101
|
+
: normalizeNumberFieldValue(parsedDraft, step, min, max);
|
|
102
|
+
const base = draftBase ?? current ??
|
|
103
|
+
(direction === 1 ? (min ?? 0) - step : (max ?? 0) + step);
|
|
104
|
+
setDraft(null);
|
|
105
|
+
commit(clamp(base + direction * step, min, max));
|
|
106
|
+
};
|
|
107
|
+
const handleKeyDown = (event) => {
|
|
108
|
+
onKeyDown?.(event);
|
|
109
|
+
if (event.defaultPrevented || disabled)
|
|
110
|
+
return;
|
|
111
|
+
if (event.key === "ArrowUp") {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
nudge(1);
|
|
114
|
+
}
|
|
115
|
+
else if (event.key === "ArrowDown") {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
nudge(-1);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
return (React.createElement("input", { ref: ref, inputMode: resolvedInputMode, role: "spinbutton", "aria-valuenow": current ?? undefined, "aria-valuemin": min, "aria-valuemax": max, disabled: disabled, value: draft ?? current ?? "", onChange: handleChange, onBlur: handleBlur, onKeyDown: handleKeyDown, "data-disabled": disabled ? "" : undefined, className: cn("h-[38px] w-full rounded-md px-3 text-base tabular-nums", "bg-[var(--input-bg)] text-[var(--foreground)]", "border border-[var(--outline-border)]", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--edge-medium)]", "disabled:cursor-not-allowed disabled:opacity-50", className), ...props }));
|
|
121
|
+
}
|