@askrjs/askr 0.0.27 → 0.0.29
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/README.md +55 -147
- package/dist/_virtual/_rolldown/runtime.js +7 -0
- package/dist/bench/components/benchmark-row.d.ts +20 -0
- package/dist/bench/components/benchmark-row.d.ts.map +1 -0
- package/dist/bench/components/benchmark-row.js +42 -0
- package/dist/bench/components/benchmark-row.js.map +1 -0
- package/dist/bench/components/benchmark-table.js +25 -0
- package/dist/bench/components/benchmark-table.js.map +1 -0
- package/dist/benchmark.d.ts +22 -0
- package/dist/benchmark.d.ts.map +1 -0
- package/dist/benchmark.js +64 -1
- package/dist/benchmark.js.map +1 -0
- package/dist/bin/askr-ssg.d.ts +28 -0
- package/dist/bin/askr-ssg.d.ts.map +1 -0
- package/dist/bin/askr-ssg.js +171 -0
- package/dist/bin/askr-ssg.js.map +1 -0
- package/dist/boot/index.d.ts +64 -42
- package/dist/boot/index.d.ts.map +1 -1
- package/dist/boot/index.js +416 -2
- package/dist/boot/index.js.map +1 -0
- package/dist/common/component.d.ts +14 -13
- package/dist/common/component.d.ts.map +1 -1
- package/dist/common/control.d.ts +13 -0
- package/dist/common/control.d.ts.map +1 -0
- package/dist/common/control.js +14 -0
- package/dist/common/control.js.map +1 -0
- package/dist/common/env.js +47 -0
- package/dist/common/env.js.map +1 -0
- package/dist/common/jsx.d.ts +17 -15
- package/dist/common/jsx.d.ts.map +1 -1
- package/dist/common/jsx.js +8 -1
- package/dist/common/jsx.js.map +1 -0
- package/dist/common/props.d.ts +14 -11
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/router.d.ts +190 -32
- package/dist/common/router.d.ts.map +1 -1
- package/dist/common/ssr-errors.d.ts +6 -3
- package/dist/common/ssr-errors.d.ts.map +1 -1
- package/dist/common/ssr-errors.js +16 -1
- package/dist/common/ssr-errors.js.map +1 -0
- package/dist/common/ssr.d.ts +12 -9
- package/dist/common/ssr.d.ts.map +1 -1
- package/dist/common/vnode.d.ts +17 -15
- package/dist/common/vnode.d.ts.map +1 -1
- package/dist/common/vnode.js +10 -1
- package/dist/common/vnode.js.map +1 -0
- package/dist/components/link.d.ts +37 -25
- package/dist/components/link.d.ts.map +1 -1
- package/dist/components/link.js +64 -1
- package/dist/components/link.js.map +1 -0
- package/dist/control/case.d.ts +17 -0
- package/dist/control/case.d.ts.map +1 -0
- package/dist/control/case.js +69 -0
- package/dist/control/case.js.map +1 -0
- package/dist/control/for.d.ts +23 -0
- package/dist/control/for.d.ts.map +1 -0
- package/dist/control/for.js +62 -0
- package/dist/control/for.js.map +1 -0
- package/dist/control/index.d.ts +4 -0
- package/dist/control/index.js +4 -0
- package/dist/control/shared.js +20 -0
- package/dist/control/shared.js.map +1 -0
- package/dist/control/show.d.ts +14 -0
- package/dist/control/show.d.ts.map +1 -0
- package/dist/control/show.js +33 -0
- package/dist/control/show.js.map +1 -0
- package/dist/dev/invariant.js +29 -2
- package/dist/dev/invariant.js.map +1 -0
- package/dist/dev/logger.js +37 -1
- package/dist/dev/logger.js.map +1 -0
- package/dist/foundations/icon/icon.d.ts +53 -0
- package/dist/foundations/icon/icon.d.ts.map +1 -0
- package/dist/foundations/icon/icon.js +88 -0
- package/dist/foundations/icon/icon.js.map +1 -0
- package/dist/foundations/icon/icon.types.d.ts +21 -0
- package/dist/foundations/icon/icon.types.d.ts.map +1 -0
- package/dist/foundations/index.d.ts +10 -3
- package/dist/foundations/index.js +9 -1
- package/dist/foundations/interactions/interaction-policy.js +93 -1
- package/dist/foundations/interactions/interaction-policy.js.map +1 -0
- package/dist/foundations/interactions/pressable.js +51 -1
- package/dist/foundations/interactions/pressable.js.map +1 -0
- package/dist/foundations/structures/collection.d.ts +25 -40
- package/dist/foundations/structures/collection.d.ts.map +1 -1
- package/dist/foundations/structures/collection.js +51 -1
- package/dist/foundations/structures/collection.js.map +1 -0
- package/dist/foundations/structures/layer.d.ts +47 -68
- package/dist/foundations/structures/layer.d.ts.map +1 -1
- package/dist/foundations/structures/layer.js +81 -1
- package/dist/foundations/structures/layer.js.map +1 -0
- package/dist/foundations/structures/layout.d.ts +6 -3
- package/dist/foundations/structures/layout.d.ts.map +1 -1
- package/dist/foundations/structures/layout.js +13 -1
- package/dist/foundations/structures/layout.js.map +1 -0
- package/dist/foundations/structures/portal.d.ts +17 -10
- package/dist/foundations/structures/portal.d.ts.map +1 -1
- package/dist/foundations/structures/portal.js +105 -1
- package/dist/foundations/structures/portal.js.map +1 -0
- package/dist/foundations/structures/presence.d.ts +11 -5
- package/dist/foundations/structures/presence.d.ts.map +1 -1
- package/dist/foundations/structures/presence.js +39 -1
- package/dist/foundations/structures/presence.js.map +1 -0
- package/dist/foundations/structures/slot.d.ts +11 -8
- package/dist/foundations/structures/slot.d.ts.map +1 -1
- package/dist/foundations/structures/slot.js +41 -1
- package/dist/foundations/structures/slot.js.map +1 -0
- package/dist/foundations/structures.d.ts +7 -14
- package/dist/foundations/structures.js +6 -1
- package/dist/foundations/utilities/aria.js +11 -1
- package/dist/foundations/utilities/aria.js.map +1 -0
- package/dist/foundations/utilities/compose-handlers.js +20 -1
- package/dist/foundations/utilities/compose-handlers.js.map +1 -0
- package/dist/foundations/utilities/compose-ref.d.ts +7 -4
- package/dist/foundations/utilities/compose-ref.d.ts.map +1 -1
- package/dist/foundations/utilities/compose-ref.js +18 -1
- package/dist/foundations/utilities/compose-ref.js.map +1 -0
- package/dist/foundations/utilities/merge-props.js +49 -1
- package/dist/foundations/utilities/merge-props.js.map +1 -0
- package/dist/fx/fx.d.ts +24 -21
- package/dist/fx/fx.d.ts.map +1 -1
- package/dist/fx/fx.js +212 -1
- package/dist/fx/fx.js.map +1 -0
- package/dist/fx/index.d.ts +4 -7
- package/dist/fx/index.js +4 -1
- package/dist/fx/noop.js +9 -1
- package/dist/fx/noop.js.map +1 -0
- package/dist/fx/timing.d.ts +24 -21
- package/dist/fx/timing.d.ts.map +1 -1
- package/dist/fx/timing.js +236 -1
- package/dist/fx/timing.js.map +1 -0
- package/dist/index.d.ts +21 -20
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -0
- package/dist/jsx/index.d.ts +1 -4
- package/dist/jsx/index.js +3 -1
- package/dist/jsx/types.d.ts +18 -25
- package/dist/jsx/types.d.ts.map +1 -1
- package/dist/jsx/types.js +1 -1
- package/dist/jsx/utils.d.ts +4 -3
- package/dist/jsx/utils.d.ts.map +1 -1
- package/dist/jsx/utils.js +19 -1
- package/dist/jsx/utils.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +8 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +32 -1
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +12 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +45 -1
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/jsx-runtime2.d.ts +2 -0
- package/dist/jsx-runtime2.js +3 -0
- package/dist/renderer/children.js +293 -0
- package/dist/renderer/children.js.map +1 -0
- package/dist/renderer/cleanup.js +150 -1
- package/dist/renderer/cleanup.js.map +1 -0
- package/dist/renderer/dom.js +2439 -1
- package/dist/renderer/dom.js.map +1 -0
- package/dist/renderer/env.js +1 -0
- package/dist/renderer/evaluate.js +450 -1
- package/dist/renderer/evaluate.js.map +1 -0
- package/dist/renderer/fastpath.js +145 -1
- package/dist/renderer/fastpath.js.map +1 -0
- package/dist/renderer/index.js +24 -1
- package/dist/renderer/index.js.map +1 -0
- package/dist/renderer/keyed.js +119 -1
- package/dist/renderer/keyed.js.map +1 -0
- package/dist/renderer/reconcile.js +359 -1
- package/dist/renderer/reconcile.js.map +1 -0
- package/dist/renderer/types.js +1 -1
- package/dist/renderer/utils.js +220 -1
- package/dist/renderer/utils.js.map +1 -0
- package/dist/resources/index.d.ts +3 -9
- package/dist/resources/index.js +3 -1
- package/dist/router/index.d.ts +6 -10
- package/dist/router/index.js +5 -1
- package/dist/router/match.js +83 -1
- package/dist/router/match.js.map +1 -0
- package/dist/router/navigate.d.ts +20 -8
- package/dist/router/navigate.d.ts.map +1 -1
- package/dist/router/navigate.js +288 -1
- package/dist/router/navigate.js.map +1 -0
- package/dist/router/policy.d.ts +22 -0
- package/dist/router/policy.d.ts.map +1 -0
- package/dist/router/policy.js +116 -0
- package/dist/router/policy.js.map +1 -0
- package/dist/router/route-context.js +79 -0
- package/dist/router/route-context.js.map +1 -0
- package/dist/router/route.d.ts +101 -33
- package/dist/router/route.d.ts.map +1 -1
- package/dist/router/route.js +599 -1
- package/dist/router/route.js.map +1 -0
- package/dist/runtime/child-scope.d.ts +21 -0
- package/dist/runtime/child-scope.d.ts.map +1 -0
- package/dist/runtime/child-scope.js +77 -0
- package/dist/runtime/child-scope.js.map +1 -0
- package/dist/runtime/component.d.ts +67 -53
- package/dist/runtime/component.d.ts.map +1 -1
- package/dist/runtime/component.js +462 -1
- package/dist/runtime/component.js.map +1 -0
- package/dist/runtime/context.d.ts +28 -42
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js +205 -1
- package/dist/runtime/context.js.map +1 -0
- package/dist/runtime/control.d.ts +43 -0
- package/dist/runtime/control.d.ts.map +1 -0
- package/dist/runtime/control.js +125 -0
- package/dist/runtime/control.js.map +1 -0
- package/dist/runtime/derive.d.ts +15 -6
- package/dist/runtime/derive.d.ts.map +1 -1
- package/dist/runtime/derive.js +134 -1
- package/dist/runtime/derive.js.map +1 -0
- package/dist/runtime/dev-namespace.js +57 -1
- package/dist/runtime/dev-namespace.js.map +1 -0
- package/dist/runtime/effect.d.ts +32 -0
- package/dist/runtime/effect.d.ts.map +1 -0
- package/dist/runtime/effect.js +146 -0
- package/dist/runtime/effect.js.map +1 -0
- package/dist/runtime/events.js +162 -1
- package/dist/runtime/events.js.map +1 -0
- package/dist/runtime/execution-model.js +15 -1
- package/dist/runtime/execution-model.js.map +1 -0
- package/dist/runtime/fastlane.js +204 -1
- package/dist/runtime/fastlane.js.map +1 -0
- package/dist/runtime/for-bench.d.ts +41 -0
- package/dist/runtime/for-bench.d.ts.map +1 -0
- package/dist/runtime/for-bench.js +173 -0
- package/dist/runtime/for-bench.js.map +1 -0
- package/dist/runtime/for.d.ts +62 -49
- package/dist/runtime/for.d.ts.map +1 -1
- package/dist/runtime/for.js +668 -1
- package/dist/runtime/for.js.map +1 -0
- package/dist/runtime/operations.d.ts +18 -15
- package/dist/runtime/operations.d.ts.map +1 -1
- package/dist/runtime/operations.js +209 -1
- package/dist/runtime/operations.js.map +1 -0
- package/dist/runtime/perf-metrics.js +64 -0
- package/dist/runtime/perf-metrics.js.map +1 -0
- package/dist/runtime/readable.d.ts +27 -0
- package/dist/runtime/readable.d.ts.map +1 -0
- package/dist/runtime/readable.js +118 -0
- package/dist/runtime/readable.js.map +1 -0
- package/dist/runtime/resource-cell.js +102 -1
- package/dist/runtime/resource-cell.js.map +1 -0
- package/dist/runtime/scheduler.d.ts +51 -35
- package/dist/runtime/scheduler.d.ts.map +1 -1
- package/dist/runtime/scheduler.js +328 -1
- package/dist/runtime/scheduler.js.map +1 -0
- package/dist/runtime/selector.d.ts +11 -0
- package/dist/runtime/selector.d.ts.map +1 -0
- package/dist/runtime/selector.js +188 -0
- package/dist/runtime/selector.js.map +1 -0
- package/dist/runtime/ssr-bridge.js +24 -1
- package/dist/runtime/ssr-bridge.js.map +1 -0
- package/dist/runtime/state.d.ts +11 -21
- package/dist/runtime/state.d.ts.map +1 -1
- package/dist/runtime/state.js +99 -1
- package/dist/runtime/state.js.map +1 -0
- package/dist/ssg/batch-render.d.ts +16 -0
- package/dist/ssg/batch-render.d.ts.map +1 -0
- package/dist/ssg/batch-render.js +84 -0
- package/dist/ssg/batch-render.js.map +1 -0
- package/dist/ssg/create-static-gen.d.ts +50 -0
- package/dist/ssg/create-static-gen.d.ts.map +1 -0
- package/dist/ssg/create-static-gen.js +282 -0
- package/dist/ssg/create-static-gen.js.map +1 -0
- package/dist/ssg/generate-metadata.d.ts +24 -0
- package/dist/ssg/generate-metadata.d.ts.map +1 -0
- package/dist/ssg/generate-metadata.js +94 -0
- package/dist/ssg/generate-metadata.js.map +1 -0
- package/dist/ssg/incremental-manifest.js +56 -0
- package/dist/ssg/incremental-manifest.js.map +1 -0
- package/dist/ssg/index.d.ts +8 -0
- package/dist/ssg/index.js +7 -0
- package/dist/ssg/resolve-ssg-data.d.ts +23 -0
- package/dist/ssg/resolve-ssg-data.d.ts.map +1 -0
- package/dist/ssg/resolve-ssg-data.js +46 -0
- package/dist/ssg/resolve-ssg-data.js.map +1 -0
- package/dist/ssg/route-utils.d.ts +16 -0
- package/dist/ssg/route-utils.d.ts.map +1 -0
- package/dist/ssg/route-utils.js +24 -0
- package/dist/ssg/route-utils.js.map +1 -0
- package/dist/ssg/types.d.ts +177 -0
- package/dist/ssg/types.d.ts.map +1 -0
- package/dist/ssg/write-static-files.d.ts +15 -0
- package/dist/ssg/write-static-files.d.ts.map +1 -0
- package/dist/ssg/write-static-files.js +73 -0
- package/dist/ssg/write-static-files.js.map +1 -0
- package/dist/ssr/attrs.js +93 -1
- package/dist/ssr/attrs.js.map +1 -0
- package/dist/ssr/context.d.ts +31 -32
- package/dist/ssr/context.d.ts.map +1 -1
- package/dist/ssr/context.js +63 -1
- package/dist/ssr/context.js.map +1 -0
- package/dist/ssr/errors.d.ts +6 -4
- package/dist/ssr/errors.d.ts.map +1 -1
- package/dist/ssr/errors.js +4 -1
- package/dist/ssr/errors.js.map +1 -0
- package/dist/ssr/escape.js +153 -1
- package/dist/ssr/escape.js.map +1 -0
- package/dist/ssr/index.d.ts +75 -46
- package/dist/ssr/index.d.ts.map +1 -1
- package/dist/ssr/index.js +543 -1
- package/dist/ssr/index.js.map +1 -0
- package/dist/ssr/render-keys.d.ts +27 -29
- package/dist/ssr/render-keys.d.ts.map +1 -1
- package/dist/ssr/render-keys.js +39 -1
- package/dist/ssr/render-keys.js.map +1 -0
- package/dist/ssr/sink.js +86 -1
- package/dist/ssr/sink.js.map +1 -0
- package/dist/ssr/stream-render.js +76 -1
- package/dist/ssr/stream-render.js.map +1 -0
- package/dist/ssr/types.d.ts +14 -13
- package/dist/ssr/types.d.ts.map +1 -1
- package/package.json +53 -48
- package/dist/_virtual/___vite-browser-external.js +0 -1
- package/dist/_virtual/__vite-browser-external.js +0 -1
- package/dist/_virtual/_commonjsHelpers.js +0 -1
- package/dist/_virtual/main.js +0 -1
- package/dist/_virtual/preload-helper.js +0 -1
- package/dist/bench/benchmark-entry.d.ts +0 -14
- package/dist/bench/benchmark-entry.d.ts.map +0 -1
- package/dist/common/errors.d.ts +0 -53
- package/dist/common/errors.d.ts.map +0 -1
- package/dist/common/index.d.ts +0 -14
- package/dist/common/index.d.ts.map +0 -1
- package/dist/dev/invariant.d.ts +0 -83
- package/dist/dev/invariant.d.ts.map +0 -1
- package/dist/dev/logger.d.ts +0 -13
- package/dist/dev/logger.d.ts.map +0 -1
- package/dist/dev/vite-plugin-askr.d.ts +0 -18
- package/dist/dev/vite-plugin-askr.d.ts.map +0 -1
- package/dist/dev/warnings.d.ts +0 -5
- package/dist/dev/warnings.d.ts.map +0 -1
- package/dist/for/for.d.ts +0 -16
- package/dist/for/for.d.ts.map +0 -1
- package/dist/for/for.js +0 -1
- package/dist/for/index.d.ts +0 -2
- package/dist/for/index.d.ts.map +0 -1
- package/dist/for/index.js +0 -1
- package/dist/foundations/core.d.ts +0 -23
- package/dist/foundations/core.d.ts.map +0 -1
- package/dist/foundations/core.js +0 -1
- package/dist/foundations/index.d.ts.map +0 -1
- package/dist/foundations/interactions/dismissable.d.ts +0 -58
- package/dist/foundations/interactions/dismissable.d.ts.map +0 -1
- package/dist/foundations/interactions/dismissable.js +0 -1
- package/dist/foundations/interactions/focusable.d.ts +0 -16
- package/dist/foundations/interactions/focusable.d.ts.map +0 -1
- package/dist/foundations/interactions/focusable.js +0 -1
- package/dist/foundations/interactions/hoverable.d.ts +0 -19
- package/dist/foundations/interactions/hoverable.d.ts.map +0 -1
- package/dist/foundations/interactions/hoverable.js +0 -1
- package/dist/foundations/interactions/index.d.ts +0 -5
- package/dist/foundations/interactions/index.d.ts.map +0 -1
- package/dist/foundations/interactions/interaction-policy.d.ts +0 -96
- package/dist/foundations/interactions/interaction-policy.d.ts.map +0 -1
- package/dist/foundations/interactions/pressable.d.ts +0 -54
- package/dist/foundations/interactions/pressable.d.ts.map +0 -1
- package/dist/foundations/interactions/roving-focus.d.ts +0 -117
- package/dist/foundations/interactions/roving-focus.d.ts.map +0 -1
- package/dist/foundations/interactions/roving-focus.js +0 -1
- package/dist/foundations/state/controllable.d.ts +0 -53
- package/dist/foundations/state/controllable.d.ts.map +0 -1
- package/dist/foundations/state/controllable.js +0 -1
- package/dist/foundations/state/index.d.ts +0 -2
- package/dist/foundations/state/index.d.ts.map +0 -1
- package/dist/foundations/structures/index.d.ts +0 -5
- package/dist/foundations/structures/index.d.ts.map +0 -1
- package/dist/foundations/structures.d.ts.map +0 -1
- package/dist/foundations/utilities/aria.d.ts +0 -13
- package/dist/foundations/utilities/aria.d.ts.map +0 -1
- package/dist/foundations/utilities/compose-handlers.d.ts +0 -34
- package/dist/foundations/utilities/compose-handlers.d.ts.map +0 -1
- package/dist/foundations/utilities/event-types.d.ts +0 -17
- package/dist/foundations/utilities/event-types.d.ts.map +0 -1
- package/dist/foundations/utilities/index.d.ts +0 -7
- package/dist/foundations/utilities/index.d.ts.map +0 -1
- package/dist/foundations/utilities/merge-props.d.ts +0 -2
- package/dist/foundations/utilities/merge-props.d.ts.map +0 -1
- package/dist/foundations/utilities/use-id.d.ts +0 -29
- package/dist/foundations/utilities/use-id.d.ts.map +0 -1
- package/dist/foundations/utilities/use-id.js +0 -1
- package/dist/fx/index.d.ts.map +0 -1
- package/dist/fx/noop.d.ts +0 -12
- package/dist/fx/noop.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/jsx/index.d.ts.map +0 -1
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -4
- package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-runtime.d.ts +0 -10
- package/dist/jsx/jsx-runtime.d.ts.map +0 -1
- package/dist/node_modules/esbuild/lib/main.js +0 -65
- package/dist/renderer/cleanup.d.ts +0 -25
- package/dist/renderer/cleanup.d.ts.map +0 -1
- package/dist/renderer/dom.d.ts +0 -62
- package/dist/renderer/dom.d.ts.map +0 -1
- package/dist/renderer/evaluate.d.ts +0 -4
- package/dist/renderer/evaluate.d.ts.map +0 -1
- package/dist/renderer/fastpath.d.ts +0 -7
- package/dist/renderer/fastpath.d.ts.map +0 -1
- package/dist/renderer/index.d.ts +0 -6
- package/dist/renderer/index.d.ts.map +0 -1
- package/dist/renderer/keyed.d.ts +0 -23
- package/dist/renderer/keyed.d.ts.map +0 -1
- package/dist/renderer/reconcile.d.ts +0 -88
- package/dist/renderer/reconcile.d.ts.map +0 -1
- package/dist/renderer/types.d.ts +0 -3
- package/dist/renderer/types.d.ts.map +0 -1
- package/dist/renderer/utils.d.ts +0 -63
- package/dist/renderer/utils.d.ts.map +0 -1
- package/dist/resources/index.d.ts.map +0 -1
- package/dist/router/index.d.ts.map +0 -1
- package/dist/router/match.d.ts +0 -22
- package/dist/router/match.d.ts.map +0 -1
- package/dist/runtime/dev-namespace.d.ts +0 -31
- package/dist/runtime/dev-namespace.d.ts.map +0 -1
- package/dist/runtime/events.d.ts +0 -52
- package/dist/runtime/events.d.ts.map +0 -1
- package/dist/runtime/execution-model.d.ts +0 -4
- package/dist/runtime/execution-model.d.ts.map +0 -1
- package/dist/runtime/fastlane.d.ts +0 -27
- package/dist/runtime/fastlane.d.ts.map +0 -1
- package/dist/runtime/hydration.d.ts +0 -25
- package/dist/runtime/hydration.d.ts.map +0 -1
- package/dist/runtime/resource-cell.d.ts +0 -35
- package/dist/runtime/resource-cell.d.ts.map +0 -1
- package/dist/runtime/snapshot.d.ts +0 -25
- package/dist/runtime/snapshot.d.ts.map +0 -1
- package/dist/runtime/ssr-bridge.d.ts +0 -10
- package/dist/runtime/ssr-bridge.d.ts.map +0 -1
- package/dist/ssr/attrs.d.ts +0 -26
- package/dist/ssr/attrs.d.ts.map +0 -1
- package/dist/ssr/create-ssr.d.ts +0 -19
- package/dist/ssr/create-ssr.d.ts.map +0 -1
- package/dist/ssr/escape.d.ts +0 -38
- package/dist/ssr/escape.d.ts.map +0 -1
- package/dist/ssr/sink.d.ts +0 -23
- package/dist/ssr/sink.d.ts.map +0 -1
- package/dist/ssr/stream-render.d.ts +0 -7
- package/dist/ssr/stream-render.d.ts.map +0 -1
- package/dist/vite/index.js +0 -3
package/dist/dev/invariant.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Invariant assertion utilities for correctness checking
|
|
3
|
-
* Production-safe: invariants are enforced at build-time or with minimal overhead
|
|
4
|
-
*
|
|
5
|
-
* Core principle: fail fast when invariants are violated
|
|
6
|
-
* All functions throw descriptive errors for debugging
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Assert a condition; throw with context if false
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare function invariant(condition: boolean, message: string, context?: Record<string, unknown>): asserts condition;
|
|
13
|
-
/**
|
|
14
|
-
* Assert object property exists and has correct type
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare function assertProperty<T extends object, K extends keyof T>(obj: T, prop: K, expectedType?: string): asserts obj is T & Required<Pick<T, K>>;
|
|
18
|
-
/**
|
|
19
|
-
* Assert a reference is not null/undefined
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export declare function assertDefined<T>(value: T | null | undefined, message: string): asserts value is T;
|
|
23
|
-
/**
|
|
24
|
-
* Assert a task runs exactly once atomically
|
|
25
|
-
* Useful for verifying lifecycle events fire precisely when expected
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
28
|
-
export declare class Once {
|
|
29
|
-
private called;
|
|
30
|
-
private calledAt;
|
|
31
|
-
readonly name: string;
|
|
32
|
-
constructor(name: string);
|
|
33
|
-
check(): boolean;
|
|
34
|
-
mark(): void;
|
|
35
|
-
reset(): void;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Assert a value falls in an enumerated set
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
export declare function assertEnum<T extends readonly unknown[]>(value: unknown, allowedValues: T, fieldName: string): asserts value is T[number];
|
|
42
|
-
/**
|
|
43
|
-
* Assert execution context (scheduler, component, etc)
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
|
-
export declare function assertContext(actual: unknown, expected: unknown, contextName: string): asserts actual is typeof expected;
|
|
47
|
-
/**
|
|
48
|
-
* Assert scheduling precondition (not reentering, not during render, etc)
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
export declare function assertSchedulingPrecondition(condition: boolean, violationMessage: string): asserts condition;
|
|
52
|
-
/**
|
|
53
|
-
* Assert state precondition
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
export declare function assertStatePrecondition(condition: boolean, violationMessage: string): asserts condition;
|
|
57
|
-
/**
|
|
58
|
-
* Verify AbortController lifecycle
|
|
59
|
-
* @internal
|
|
60
|
-
*/
|
|
61
|
-
export declare function assertAbortControllerState(signal: AbortSignal, expectedAborted: boolean, context: string): void;
|
|
62
|
-
/**
|
|
63
|
-
* Guard: throw if callback is null when it shouldn't be
|
|
64
|
-
* Used for notifyUpdate, event handlers, etc.
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
export declare function assertCallbackAvailable<T extends (...args: unknown[]) => unknown>(callback: T | null | undefined, callbackName: string): asserts callback is T;
|
|
68
|
-
/**
|
|
69
|
-
* Verify evaluation generation prevents stale evaluations
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
export declare function assertEvaluationGeneration(current: number, latest: number, context: string): void;
|
|
73
|
-
/**
|
|
74
|
-
* Verify mounted flag state
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
77
|
-
export declare function assertMountedState(mounted: boolean, expectedMounted: boolean, context: string): void;
|
|
78
|
-
/**
|
|
79
|
-
* Verify no null target when rendering
|
|
80
|
-
* @internal
|
|
81
|
-
*/
|
|
82
|
-
export declare function assertRenderTarget(target: Element | null, context: string): asserts target is Element;
|
|
83
|
-
//# sourceMappingURL=invariant.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../src/dev/invariant.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,SAAS,CAKnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAChE,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,CAAC,EACP,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAazC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,KAAK,IAAI,CAAC,CAEpB;AAED;;;;GAIG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAuB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM;IAIxB,KAAK,IAAI,OAAO;IAIhB,IAAI,IAAI,IAAI;IAUZ,KAAK,IAAI,IAAI;CAId;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EACrD,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,CAAC,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC,CAM5B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,IAAI,OAAO,QAAQ,CAMnC;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,OAAO,EAClB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,SAAS,CAEnB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,OAAO,EAClB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,SAAS,CAEnB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,OAAO,EACxB,OAAO,EAAE,MAAM,GACd,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACzC,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,CAM7E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CAMN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,OAAO,EACxB,OAAO,EAAE,MAAM,GACd,IAAI,CAMN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GAAG,IAAI,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,IAAI,OAAO,CAI3B"}
|
package/dist/dev/logger.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized logger interface
|
|
3
|
-
* - Keeps production builds silent for debug/warn/info messages
|
|
4
|
-
* - Ensures consistent behavior across the codebase
|
|
5
|
-
* - Protects against missing `console` in some environments
|
|
6
|
-
*/
|
|
7
|
-
export declare const logger: {
|
|
8
|
-
debug: (...args: unknown[]) => void;
|
|
9
|
-
info: (...args: unknown[]) => void;
|
|
10
|
-
warn: (...args: unknown[]) => void;
|
|
11
|
-
error: (...args: unknown[]) => void;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/dist/dev/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/dev/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,eAAO,MAAM,MAAM;qBACA,OAAO,EAAE;oBAKV,OAAO,EAAE;oBAKT,OAAO,EAAE;qBAKR,OAAO,EAAE;CAG3B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vite plugin for Askr
|
|
3
|
-
*
|
|
4
|
-
* Provides sensible defaults so Vite "just works" with Askr without extra config:
|
|
5
|
-
* - Configures esbuild JSX injection and `optimizeDeps.include` so the runtime is available
|
|
6
|
-
* - Optional SSR template precompilation for improved server rendering performance
|
|
7
|
-
*/
|
|
8
|
-
import type { Plugin } from 'vite';
|
|
9
|
-
export interface AskrVitePluginOptions {
|
|
10
|
-
/** Enable the built-in JSX transform that rewrites JSX to Askr's automatic runtime. */
|
|
11
|
-
transformJsx?: boolean;
|
|
12
|
-
/** Enable SSR template precompilation for improved server rendering performance. */
|
|
13
|
-
ssrPrecompile?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function askrVitePlugin(opts?: AskrVitePluginOptions): Plugin;
|
|
16
|
-
export declare const askr: typeof askrVitePlugin;
|
|
17
|
-
export default askrVitePlugin;
|
|
18
|
-
//# sourceMappingURL=vite-plugin-askr.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-askr.d.ts","sourceRoot":"","sources":["../../src/dev/vite-plugin-askr.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,WAAW,qBAAqB;IACpC,uFAAuF;IACvF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oFAAoF;IACpF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA6CD,wBAAgB,cAAc,CAAC,IAAI,GAAE,qBAA0B,GAAG,MAAM,CAsFvE;AAGD,eAAO,MAAM,IAAI,uBAAiB,CAAC;AAEnC,eAAe,cAAc,CAAC"}
|
package/dist/dev/warnings.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../../src/dev/warnings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,SAAS,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAInE"}
|
package/dist/for/for.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* For component primitive
|
|
3
|
-
*
|
|
4
|
-
* Creates a reactivity boundary for list iteration, preventing
|
|
5
|
-
* parent re-execution when individual items update.
|
|
6
|
-
*/
|
|
7
|
-
import { type State } from '../runtime/state';
|
|
8
|
-
import { type DOMElement, type VNode } from '../common/vnode';
|
|
9
|
-
/**
|
|
10
|
-
* For primitive - creates a reactivity boundary for efficient list rendering.
|
|
11
|
-
*
|
|
12
|
-
* Instead of re-executing all rows when one changes, For creates isolated
|
|
13
|
-
* component instances for each item, re-executing only items that changed.
|
|
14
|
-
*/
|
|
15
|
-
export declare function For<T>(source: State<T[]> | (() => T[]), key: (item: T, index: number) => string | number, render: (item: T, index: () => number) => VNode): DOMElement;
|
|
16
|
-
//# sourceMappingURL=for.d.ts.map
|
package/dist/for/for.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"for.d.ts","sourceRoot":"","sources":["../../src/for/for.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAoB,MAAM,iBAAiB,CAAC;AAGhF;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EACnB,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAChC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,EAChD,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,MAAM,KAAK,KAAK,GAC9C,UAAU,CAqBZ"}
|
package/dist/for/for.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{state as n}from"../runtime/state.js";import{__FOR_BOUNDARY__ as a}from"../common/vnode.js";import{createForState as f}from"../runtime/for.js";function c(t,o,r){const e=n(f(t,o,r))();return{type:a,props:{source:t},_forState:e}}export{c as For};
|
package/dist/for/index.d.ts
DELETED
package/dist/for/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/for/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/for/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{For as e}from"./for.js";export{e as For};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export { composeHandlers } from './utilities/compose-handlers';
|
|
2
|
-
export type { ComposeHandlersOptions } from './utilities/compose-handlers';
|
|
3
|
-
export { mergeProps } from './utilities/merge-props';
|
|
4
|
-
export { ariaDisabled, ariaExpanded, ariaSelected } from './utilities/aria';
|
|
5
|
-
export { composeRefs, setRef } from './utilities/compose-ref';
|
|
6
|
-
export type { Ref } from './utilities/compose-ref';
|
|
7
|
-
export { formatId } from './utilities/use-id';
|
|
8
|
-
export type { FormatIdOptions } from './utilities/use-id';
|
|
9
|
-
export { pressable } from './interactions/pressable';
|
|
10
|
-
export type { PressableOptions, PressableResult, } from './interactions/pressable';
|
|
11
|
-
export { dismissable } from './interactions/dismissable';
|
|
12
|
-
export type { DismissableOptions } from './interactions/dismissable';
|
|
13
|
-
export { focusable } from './interactions/focusable';
|
|
14
|
-
export type { FocusableOptions, FocusableResult, } from './interactions/focusable';
|
|
15
|
-
export { hoverable } from './interactions/hoverable';
|
|
16
|
-
export type { HoverableOptions, HoverableResult, } from './interactions/hoverable';
|
|
17
|
-
export { rovingFocus } from './interactions/roving-focus';
|
|
18
|
-
export type { RovingFocusOptions, RovingFocusResult, Orientation, } from './interactions/roving-focus';
|
|
19
|
-
export { applyInteractionPolicy, mergeInteractionProps, } from './interactions/interaction-policy';
|
|
20
|
-
export type { InteractionPolicyInput } from './interactions/interaction-policy';
|
|
21
|
-
export { isControlled, resolveControllable, makeControllable, controllableState, } from './state/controllable';
|
|
22
|
-
export type { ControllableState } from './state/controllable';
|
|
23
|
-
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/foundations/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,GACZ,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/foundations/core.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{composeHandlers as r}from"./utilities/compose-handlers.js";import{mergeProps as a}from"./utilities/merge-props.js";import{ariaDisabled as p,ariaExpanded as m,ariaSelected as s}from"./utilities/aria.js";import{composeRefs as x,setRef as i}from"./utilities/compose-ref.js";import{formatId as c}from"./utilities/use-id.js";import{pressable as d}from"./interactions/pressable.js";import{dismissable as v}from"./interactions/dismissable.js";import{focusable as I}from"./interactions/focusable.js";import{hoverable as u}from"./interactions/hoverable.js";import{rovingFocus as R}from"./interactions/roving-focus.js";import{applyInteractionPolicy as h,mergeInteractionProps as k}from"./interactions/interaction-policy.js";import{controllableState as E,isControlled as F,makeControllable as H,resolveControllable as j}from"./state/controllable.js";export{h as applyInteractionPolicy,p as ariaDisabled,m as ariaExpanded,s as ariaSelected,r as composeHandlers,x as composeRefs,E as controllableState,v as dismissable,I as focusable,c as formatId,u as hoverable,F as isControlled,H as makeControllable,k as mergeInteractionProps,a as mergeProps,d as pressable,j as resolveControllable,R as rovingFocus,i as setRef};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/foundations/index.ts"],"names":[],"mappings":"AAKA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* dismissable
|
|
3
|
-
*
|
|
4
|
-
* THE dismissal primitive. Handles Escape key and outside interactions.
|
|
5
|
-
*
|
|
6
|
-
* INVARIANTS:
|
|
7
|
-
* 1. Returns props that compose via mergeProps (no factories)
|
|
8
|
-
* 2. Disabled state respected exactly once, here
|
|
9
|
-
* 3. No side effects - pure props generation
|
|
10
|
-
* 4. Outside detection requires explicit node reference
|
|
11
|
-
* 5. This is the ONLY dismissal primitive - do not create alternatives
|
|
12
|
-
*
|
|
13
|
-
* DESIGN:
|
|
14
|
-
* - Returns standard event handler props (onKeyDown, onPointerDownCapture)
|
|
15
|
-
* - Composable via mergeProps with other foundations
|
|
16
|
-
* - Caller provides node reference for outside detection
|
|
17
|
-
* - Single onDismiss callback for all dismiss triggers
|
|
18
|
-
*
|
|
19
|
-
* PIT OF SUCCESS:
|
|
20
|
-
* ✓ Can't accidentally bypass (only way to get dismiss behavior)
|
|
21
|
-
* ✓ Can't duplicate (disabled checked once)
|
|
22
|
-
* ✓ Composes via mergeProps (standard props)
|
|
23
|
-
* ✓ Wrong usage is hard (no factories to misuse)
|
|
24
|
-
*
|
|
25
|
-
* USAGE:
|
|
26
|
-
* const props = dismissable({
|
|
27
|
-
* node: elementRef,
|
|
28
|
-
* disabled: false,
|
|
29
|
-
* onDismiss: () => close()
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* <div ref={elementRef} {...props}>Content</div>
|
|
33
|
-
*
|
|
34
|
-
* MISUSE EXAMPLE (PREVENTED):
|
|
35
|
-
* ❌ Can't forget to check disabled - checked inside dismissable
|
|
36
|
-
* ❌ Can't create custom escape handler - this is the only one
|
|
37
|
-
* ❌ Can't bypass via direct event listeners - mergeProps composes correctly
|
|
38
|
-
*/
|
|
39
|
-
export interface DismissableOptions {
|
|
40
|
-
/**
|
|
41
|
-
* Reference to the element for outside click detection
|
|
42
|
-
*/
|
|
43
|
-
node?: Node | null;
|
|
44
|
-
/**
|
|
45
|
-
* Whether dismiss is disabled
|
|
46
|
-
*/
|
|
47
|
-
disabled?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Called when dismiss is triggered (Escape or outside click)
|
|
50
|
-
*/
|
|
51
|
-
onDismiss?: (trigger: 'escape' | 'outside') => void;
|
|
52
|
-
}
|
|
53
|
-
import type { KeyboardLikeEvent, PointerLikeEvent } from '../utilities/event-types';
|
|
54
|
-
export declare function dismissable({ node, disabled, onDismiss }: DismissableOptions): {
|
|
55
|
-
onKeyDown: (e: KeyboardLikeEvent) => void;
|
|
56
|
-
onPointerDownCapture: (e: PointerLikeEvent) => void;
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=dismissable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dismissable.d.ts","sourceRoot":"","sources":["../../../src/foundations/interactions/dismissable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;CACrD;AAED,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,kBAAkB;mBACjD,iBAAiB;8BASN,gBAAgB;EAoBtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function u({node:t,disabled:e,onDismiss:r}){function i(n){e||n.key==="Escape"&&(n.preventDefault?.(),n.stopPropagation?.(),r?.("escape"))}function a(n){if(e)return;const o=n.target;o instanceof Node&&t&&(t.contains(o)||r?.("outside"))}return{onKeyDown:i,onPointerDownCapture:a}}export{u as dismissable};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* focusable
|
|
3
|
-
*
|
|
4
|
-
* Normalize focus-related props for hosts.
|
|
5
|
-
* - No DOM manipulation here; returns props that the runtime may attach.
|
|
6
|
-
*/
|
|
7
|
-
export interface FocusableOptions {
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
tabIndex?: number | undefined;
|
|
10
|
-
}
|
|
11
|
-
export interface FocusableResult {
|
|
12
|
-
tabIndex?: number;
|
|
13
|
-
'aria-disabled'?: 'true';
|
|
14
|
-
}
|
|
15
|
-
export declare function focusable({ disabled, tabIndex, }: FocusableOptions): FocusableResult;
|
|
16
|
-
//# sourceMappingURL=focusable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"focusable.d.ts","sourceRoot":"","sources":["../../../src/foundations/interactions/focusable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,QAAQ,GACT,EAAE,gBAAgB,GAAG,eAAe,CAKpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ariaDisabled as i}from"../utilities/aria.js";function a({disabled:o,tabIndex:r}){return{tabIndex:o?-1:r===void 0?0:r,...i(o)}}export{a as focusable};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* hoverable
|
|
3
|
-
*
|
|
4
|
-
* Produces props for pointer enter/leave handling. Pure and deterministic.
|
|
5
|
-
*/
|
|
6
|
-
export interface HoverableOptions {
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
onEnter?: (e: HoverEvent) => void;
|
|
9
|
-
onLeave?: (e: HoverEvent) => void;
|
|
10
|
-
}
|
|
11
|
-
import type { DefaultPreventable, PropagationStoppable } from '../utilities/event-types';
|
|
12
|
-
type HoverEvent = DefaultPreventable & PropagationStoppable;
|
|
13
|
-
export interface HoverableResult {
|
|
14
|
-
onPointerEnter?: (e: HoverEvent) => void;
|
|
15
|
-
onPointerLeave?: (e: HoverEvent) => void;
|
|
16
|
-
}
|
|
17
|
-
export declare function hoverable({ disabled, onEnter, onLeave, }: HoverableOptions): HoverableResult;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=hoverable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hoverable.d.ts","sourceRoot":"","sources":["../../../src/foundations/interactions/hoverable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CACnC;AAED,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAElC,KAAK,UAAU,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CAC1C;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,OAAO,EACP,OAAO,GACR,EAAE,gBAAgB,GAAG,eAAe,CAapC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function t({disabled:e,onEnter:n,onLeave:r}){return{onPointerEnter:e?void 0:o=>{n?.(o)},onPointerLeave:e?void 0:o=>{r?.(o)}}}export{t as hoverable};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundations/interactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* INTERACTION POLICY (FRAMEWORK LAW)
|
|
3
|
-
*
|
|
4
|
-
* This is THE ONLY way to create interactive elements. Components MUST NOT
|
|
5
|
-
* implement interaction logic directly.
|
|
6
|
-
*
|
|
7
|
-
* INVARIANTS (ENFORCED):
|
|
8
|
-
* 1. "Press" is the semantic. Click/touch/Enter/Space are implementation details.
|
|
9
|
-
* 2. Disabled is enforced exactly once, here. Components may not check disabled.
|
|
10
|
-
* 3. Keyboard handling is automatic. Components may not add onKeyDown for activation.
|
|
11
|
-
* 4. Native elements opt out of polyfills, not semantics.
|
|
12
|
-
* 5. asChild may replace the host element, not interaction behavior.
|
|
13
|
-
* 6. This policy is the SINGLE SOURCE OF TRUTH for interactive behavior.
|
|
14
|
-
*
|
|
15
|
-
* DESIGN:
|
|
16
|
-
* - Single public function: applyInteractionPolicy
|
|
17
|
-
* - Returns props that compose via mergeProps
|
|
18
|
-
* - Delegates to pressable for mechanics
|
|
19
|
-
* - Enforces disabled once and only once
|
|
20
|
-
* - No configuration beyond disabled and native element type
|
|
21
|
-
*
|
|
22
|
-
* PIT OF SUCCESS:
|
|
23
|
-
* ✓ Can't bypass policy (only way to get interaction behavior)
|
|
24
|
-
* ✓ Can't duplicate disabled checks (enforced once, here)
|
|
25
|
-
* ✓ Can't write custom keyboard handlers for buttons (policy owns it)
|
|
26
|
-
* ✓ Composes via mergeProps (standard props)
|
|
27
|
-
* ✓ Wrong usage is impossible (no escape hatch)
|
|
28
|
-
*
|
|
29
|
-
* USAGE:
|
|
30
|
-
* function Button({ onPress, disabled }) {
|
|
31
|
-
* const interaction = applyInteractionPolicy({
|
|
32
|
-
* isNative: true,
|
|
33
|
-
* disabled,
|
|
34
|
-
* onPress
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* return <button {...interaction}>Click me</button>;
|
|
38
|
-
* }
|
|
39
|
-
*
|
|
40
|
-
* MISUSE EXAMPLE (PREVENTED):
|
|
41
|
-
* ❌ Button checking disabled again:
|
|
42
|
-
* function Button({ disabled, onPress }) {
|
|
43
|
-
* if (disabled) return; // NO! Policy handles this
|
|
44
|
-
* const interaction = applyInteractionPolicy(...);
|
|
45
|
-
* }
|
|
46
|
-
*
|
|
47
|
-
* ❌ Custom keyboard handler:
|
|
48
|
-
* function Button({ onPress }) {
|
|
49
|
-
* const interaction = applyInteractionPolicy(...);
|
|
50
|
-
* return <button {...interaction} onKeyDown={...}>; // NO! Policy owns this
|
|
51
|
-
* }
|
|
52
|
-
*
|
|
53
|
-
* ❌ Direct event handler:
|
|
54
|
-
* <button onClick={onPress}>; // NO! Use applyInteractionPolicy
|
|
55
|
-
*/
|
|
56
|
-
import { Ref } from '../utilities/compose-ref';
|
|
57
|
-
export interface InteractionPolicyInput {
|
|
58
|
-
/** Whether the host element is a native interactive element (button, a, etc) */
|
|
59
|
-
isNative: boolean;
|
|
60
|
-
/** Disabled state - checked ONLY here, never in components */
|
|
61
|
-
disabled: boolean;
|
|
62
|
-
/** User-provided press handler - semantic action, not DOM event */
|
|
63
|
-
onPress?: (e: Event) => void;
|
|
64
|
-
/** Optional ref to compose */
|
|
65
|
-
ref?: Ref<unknown>;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* THE interaction policy. Components MUST use this, NEVER implement
|
|
69
|
-
* interaction logic directly.
|
|
70
|
-
*/
|
|
71
|
-
export declare function applyInteractionPolicy({ isNative, disabled, onPress, ref, }: InteractionPolicyInput): {
|
|
72
|
-
disabled: true | undefined;
|
|
73
|
-
onClick: (e: Event) => void;
|
|
74
|
-
ref: Ref<unknown>;
|
|
75
|
-
} | {
|
|
76
|
-
'aria-disabled': true | undefined;
|
|
77
|
-
tabIndex: number;
|
|
78
|
-
ref: Ref<unknown>;
|
|
79
|
-
onClick: (e: import("../utilities").DefaultPreventable & import("../utilities").PropagationStoppable) => void;
|
|
80
|
-
disabled?: true;
|
|
81
|
-
role?: "button";
|
|
82
|
-
onKeyDown?: (e: import("../utilities").KeyboardLikeEvent) => void;
|
|
83
|
-
onKeyUp?: (e: import("../utilities").KeyboardLikeEvent) => void;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Merge rule for Slot / asChild
|
|
87
|
-
*
|
|
88
|
-
* Precedence:
|
|
89
|
-
* policy → user → child
|
|
90
|
-
*
|
|
91
|
-
* Event handlers are composed (policy first).
|
|
92
|
-
* Refs are always composed.
|
|
93
|
-
* Policy props MUST take precedence to enforce invariants.
|
|
94
|
-
*/
|
|
95
|
-
export declare function mergeInteractionProps(childProps: Record<string, unknown>, policyProps: Record<string, unknown>, userProps?: Record<string, unknown>): Record<string, unknown>;
|
|
96
|
-
//# sourceMappingURL=interaction-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interaction-policy.d.ts","sourceRoot":"","sources":["../../../src/foundations/interactions/interaction-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAIH,OAAO,EAAe,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAG5D,MAAM,WAAW,sBAAsB;IACrC,gFAAgF;IAChF,QAAQ,EAAE,OAAO,CAAC;IAClB,8DAA8D;IAC9D,QAAQ,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAC7B,8BAA8B;IAC9B,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,GAAG,GACJ,EAAE,sBAAsB;;iBAcN,KAAK;;;;;;;;;;;EAkBvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,2BAiCpC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pressable
|
|
3
|
-
*
|
|
4
|
-
* Interaction helper that produces VNode props for 'press' semantics.
|
|
5
|
-
* - Pure and deterministic: no DOM construction or mutation here
|
|
6
|
-
* - The runtime owns event attachment and scheduling
|
|
7
|
-
* - This helper returns plain props (handlers) intended to be attached by the runtime
|
|
8
|
-
*
|
|
9
|
-
* Behaviour:
|
|
10
|
-
* - For native buttons: only an `onClick` prop is provided (no ARIA or keyboard shims)
|
|
11
|
-
* - For non-button elements: add `role="button"` and `tabIndex` and keyboard handlers
|
|
12
|
-
* - Activation: `Enter` activates on keydown, `Space` activates on keyup (matches native button)
|
|
13
|
-
* - Disabled: handlers short-circuit and `aria-disabled` is set for all hosts
|
|
14
|
-
*
|
|
15
|
-
* POLICY DECISIONS (LOCKED):
|
|
16
|
-
*
|
|
17
|
-
* 1. Activation Timing (Platform Parity)
|
|
18
|
-
* - Enter fires on keydown (immediate response)
|
|
19
|
-
* - Space fires on keyup (allows cancel by moving focus, matches native)
|
|
20
|
-
* - Space keydown prevents scroll (matches native button behavior)
|
|
21
|
-
*
|
|
22
|
-
* 2. Disabled Enforcement Strategy
|
|
23
|
-
* - Native buttons: Use HTML `disabled` attribute (platform-enforced non-interactivity)
|
|
24
|
-
* AND `aria-disabled` (consistent a11y signaling)
|
|
25
|
-
* - Non-native: Use `tabIndex=-1` (removes from tab order)
|
|
26
|
-
* AND `aria-disabled` (signals disabled state to AT)
|
|
27
|
-
* - Click handler short-circuits as defense-in-depth (prevents leaked focus issues)
|
|
28
|
-
*
|
|
29
|
-
* 3. Key Repeat Behavior
|
|
30
|
-
* - Held Enter/Space will fire onPress repeatedly (matches native button)
|
|
31
|
-
* - No debouncing or repeat prevention (platform parity)
|
|
32
|
-
*/
|
|
33
|
-
export interface PressableOptions {
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
onPress?: (e: PressEvent) => void;
|
|
36
|
-
/**
|
|
37
|
-
* Whether the host is a native button. Defaults to false.
|
|
38
|
-
*/
|
|
39
|
-
isNativeButton?: boolean;
|
|
40
|
-
}
|
|
41
|
-
import type { DefaultPreventable, KeyboardLikeEvent, PropagationStoppable } from '../utilities/event-types';
|
|
42
|
-
type PressEvent = DefaultPreventable & PropagationStoppable;
|
|
43
|
-
export interface PressableResult {
|
|
44
|
-
onClick: (e: PressEvent) => void;
|
|
45
|
-
disabled?: true;
|
|
46
|
-
role?: 'button';
|
|
47
|
-
tabIndex?: number;
|
|
48
|
-
onKeyDown?: (e: KeyboardLikeEvent) => void;
|
|
49
|
-
onKeyUp?: (e: KeyboardLikeEvent) => void;
|
|
50
|
-
'aria-disabled'?: 'true';
|
|
51
|
-
}
|
|
52
|
-
export declare function pressable({ disabled, onPress, isNativeButton, }: PressableOptions): PressableResult;
|
|
53
|
-
export {};
|
|
54
|
-
//# sourceMappingURL=pressable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pressable.d.ts","sourceRoot":"","sources":["../../../src/foundations/interactions/pressable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAGlC,KAAK,UAAU,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC3C,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,OAAO,EACP,cAAsB,GACvB,EAAE,gBAAgB,GAAG,eAAe,CAwDpC"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rovingFocus
|
|
3
|
-
*
|
|
4
|
-
* Single tab stop navigation with arrow-key control.
|
|
5
|
-
*
|
|
6
|
-
* INVARIANTS:
|
|
7
|
-
* 1. Only one item in the group is reachable via Tab (single tab stop)
|
|
8
|
-
* 2. Arrow keys move focus within the group
|
|
9
|
-
* 3. Orientation determines which arrow keys are active
|
|
10
|
-
* 4. Looping is opt-in
|
|
11
|
-
* 5. Disabled items are skipped
|
|
12
|
-
* 6. Returns props objects, never factories (composes via mergeProps)
|
|
13
|
-
*
|
|
14
|
-
* DESIGN:
|
|
15
|
-
* - Container gets onKeyDown for arrow navigation
|
|
16
|
-
* - Each item gets tabIndex based on current selection
|
|
17
|
-
* - Navigation logic is pure - caller controls focus application
|
|
18
|
-
* - Disabled check happens per-item via predicate
|
|
19
|
-
*
|
|
20
|
-
* PIT OF SUCCESS:
|
|
21
|
-
* ✓ Can't accidentally break tab order (tabIndex assigned correctly)
|
|
22
|
-
* ✓ Can't duplicate navigation logic (single source)
|
|
23
|
-
* ✓ Composes via mergeProps (all standard props)
|
|
24
|
-
* ✓ Type-safe - invalid indices caught at call site
|
|
25
|
-
*
|
|
26
|
-
* USAGE:
|
|
27
|
-
* const nav = rovingFocus({
|
|
28
|
-
* currentIndex: 0,
|
|
29
|
-
* itemCount: 3,
|
|
30
|
-
* orientation: 'horizontal',
|
|
31
|
-
* onNavigate: setIndex
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* <div {...nav.container}>
|
|
35
|
-
* <button {...nav.item(0)}>First</button>
|
|
36
|
-
* <button {...nav.item(1)}>Second</button>
|
|
37
|
-
* </div>
|
|
38
|
-
*
|
|
39
|
-
* MISUSE EXAMPLE (PREVENTED):
|
|
40
|
-
* ❌ Can't forget to set tabIndex - returned in item props
|
|
41
|
-
* ❌ Can't create conflicting arrow handlers - mergeProps composes
|
|
42
|
-
* ❌ Can't skip disabled items incorrectly - logic is internal
|
|
43
|
-
*/
|
|
44
|
-
import type { KeyboardLikeEvent } from '../utilities/event-types';
|
|
45
|
-
export type Orientation = 'horizontal' | 'vertical' | 'both';
|
|
46
|
-
export interface RovingFocusOptions {
|
|
47
|
-
/**
|
|
48
|
-
* Current focused index
|
|
49
|
-
*/
|
|
50
|
-
currentIndex: number;
|
|
51
|
-
/**
|
|
52
|
-
* Total number of items
|
|
53
|
-
*/
|
|
54
|
-
itemCount: number;
|
|
55
|
-
/**
|
|
56
|
-
* Navigation orientation
|
|
57
|
-
* - horizontal: ArrowLeft/ArrowRight
|
|
58
|
-
* - vertical: ArrowUp/ArrowDown
|
|
59
|
-
* - both: all arrow keys
|
|
60
|
-
*/
|
|
61
|
-
orientation?: Orientation;
|
|
62
|
-
/**
|
|
63
|
-
* Whether to loop when reaching the end
|
|
64
|
-
*/
|
|
65
|
-
loop?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Callback when navigation occurs
|
|
68
|
-
*/
|
|
69
|
-
onNavigate?: (index: number) => void;
|
|
70
|
-
/**
|
|
71
|
-
* Optional disabled state check per index
|
|
72
|
-
*/
|
|
73
|
-
isDisabled?: (index: number) => boolean;
|
|
74
|
-
}
|
|
75
|
-
export interface RovingFocusResult {
|
|
76
|
-
/**
|
|
77
|
-
* Props for the container element (composes via mergeProps)
|
|
78
|
-
*/
|
|
79
|
-
container: {
|
|
80
|
-
onKeyDown: (e: KeyboardLikeEvent) => void;
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Generate props for an item at the given index (composes via mergeProps)
|
|
84
|
-
*/
|
|
85
|
-
item: (index: number) => {
|
|
86
|
-
tabIndex: number;
|
|
87
|
-
'data-roving-index': number;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
export declare function rovingFocus(options: RovingFocusOptions): RovingFocusResult;
|
|
91
|
-
/**
|
|
92
|
-
* USAGE EXAMPLE:
|
|
93
|
-
*
|
|
94
|
-
* function Menu() {
|
|
95
|
-
* const [focusIndex, setFocusIndex] = state(0);
|
|
96
|
-
* const items = ['File', 'Edit', 'View'];
|
|
97
|
-
*
|
|
98
|
-
* const navigation = rovingFocus({
|
|
99
|
-
* currentIndex: focusIndex(),
|
|
100
|
-
* itemCount: items.length,
|
|
101
|
-
* orientation: 'horizontal',
|
|
102
|
-
* loop: true,
|
|
103
|
-
* onNavigate: setFocusIndex,
|
|
104
|
-
* });
|
|
105
|
-
*
|
|
106
|
-
* return (
|
|
107
|
-
* <div {...navigation.container}>
|
|
108
|
-
* {items.map((label, index) => (
|
|
109
|
-
* <button {...navigation.item(index)}>
|
|
110
|
-
* {label}
|
|
111
|
-
* </button>
|
|
112
|
-
* ))}
|
|
113
|
-
* </div>
|
|
114
|
-
* );
|
|
115
|
-
* }
|
|
116
|
-
*/
|
|
117
|
-
//# sourceMappingURL=roving-focus.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"roving-focus.d.ts","sourceRoot":"","sources":["../../../src/foundations/interactions/roving-focus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,SAAS,EAAE;QACT,SAAS,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;KAC3C,CAAC;IAEF;;OAEG;IACH,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB,CAkE1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function v(u){const{currentIndex:r,itemCount:e,orientation:o="horizontal",loop:d=!1,onNavigate:l,isDisabled:c}=u;function f(t,i){let n=t+i;if(d)n<0&&(n=e-1),n>=e&&(n=0);else if(n<0||n>=e)return;return c?.(n)?n===t?void 0:f(n,i):n}function s(t){const{key:i}=t;let n;if((o==="horizontal"||o==="both")&&(i==="ArrowRight"&&(n=1),i==="ArrowLeft"&&(n=-1)),(o==="vertical"||o==="both")&&(i==="ArrowDown"&&(n=1),i==="ArrowUp"&&(n=-1)),n===void 0)return;const a=f(r,n);a!==void 0&&(t.preventDefault?.(),t.stopPropagation?.(),l?.(a))}return{container:{onKeyDown:s},item:t=>({tabIndex:t===r?0:-1,"data-roving-index":t})}}export{v as rovingFocus};
|