@askrjs/askr 0.0.52 → 0.0.53
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 +5 -1
- package/dist/{runtime/scheduler.js → access-Bg4RJNC8.js} +182 -9
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.js +103 -0
- package/dist/{common/attr-names.js → attr-names-CjhzmHOn.js} +1 -1
- package/dist/benchmark.d.ts +6 -2
- package/dist/benchmark.js +63 -11
- package/dist/boot/index.d.ts +61 -2
- package/dist/boot/index.js +1 -203
- package/dist/boot-j2KoN6ss.js +647 -0
- package/dist/cleanup-COv77su2.js +487 -0
- package/dist/component-internal-B3z7GXlD.js +614 -0
- package/dist/component-lifecycle-CO4hXlP4.js +357 -0
- package/dist/{runtime/component-scope.js → component-scope-CC3cojX9.js} +8 -1
- package/dist/component-scope-CvPba6O6.d.ts +12 -0
- package/dist/components/index.d.ts +17 -2
- package/dist/components/index.js +39 -1
- package/dist/compose-ref-Cc_YkUpM.js +92 -0
- package/dist/{foundations/utilities/compose-ref.d.ts → compose-ref-Cizq72-x.d.ts} +1 -1
- package/dist/control/index.d.ts +1 -3
- package/dist/control/index.js +1 -3
- package/dist/control-BQvNVfAd.d.ts +436 -0
- package/dist/control-BYyLTFyw.js +165 -0
- package/dist/control-Bf4Wkdvv.d.ts +9 -0
- package/dist/{common/control.js → control-DhFRTIoE.js} +1 -1
- package/dist/data/index.d.ts +2 -6
- package/dist/data/index.js +4 -5
- package/dist/data-DnxnDxD-.js +559 -0
- package/dist/{data/data-runtime.js → data-runtime-SJ1BSUvk.js} +32 -31
- package/dist/deferred-lKE8uR0z.js +386 -0
- package/dist/{runtime/effect.js → effect-BwnIvLah.js} +4 -4
- package/dist/fastlane-Dw8SOBr9.js +343 -0
- package/dist/for-internal-BKf_Tnv1.js +1563 -0
- package/dist/foundations/icon/index.d.ts +68 -2
- package/dist/foundations/icon/index.js +85 -1
- package/dist/foundations/index.d.ts +2 -5
- package/dist/foundations/index.js +2 -5
- package/dist/foundations/interactions/index.d.ts +264 -6
- package/dist/foundations/interactions/index.js +1 -6
- package/dist/foundations/state/index.d.ts +32 -1
- package/dist/foundations/state/index.js +78 -1
- package/dist/foundations/structures/index.d.ts +2 -7
- package/dist/foundations/structures/index.js +2 -7
- package/dist/foundations/utilities/index.d.ts +2 -6
- package/dist/foundations/utilities/index.js +2 -5
- package/dist/fx/index.d.ts +190 -3
- package/dist/fx/index.js +454 -4
- package/dist/index-31Uoz_NS.d.ts +239 -0
- package/dist/index-Bki2rqcr.d.ts +233 -0
- package/dist/index-BnU0NPwM.d.ts +101 -0
- package/dist/index-D73jgYx1.d.ts +48 -0
- package/dist/{runtime/runtime.d.ts → index-R2JJIbM-.d.ts} +31 -8
- package/dist/index-SJXJkssx.d.ts +44 -0
- package/dist/index.d.ts +8 -13
- package/dist/index.js +150 -15
- package/dist/interactions-w7gQN4ha.js +280 -0
- package/dist/{data/invalidation-listeners.js → invalidation-listeners-Des3AHYs.js} +1 -1
- package/dist/{common/props.d.ts → jsx-CP0gmYwJ.d.ts} +17 -5
- package/dist/{common/jsx.js → jsx-CUpRxrLH.js} +1 -1
- package/dist/jsx-dev-runtime.d.ts +2 -4
- package/dist/jsx-dev-runtime.js +7 -5
- package/dist/jsx-runtime-92bV2hSa.d.ts +34 -0
- package/dist/jsx-runtime-BVVgDSdq.d.ts +1 -0
- package/dist/jsx-runtime.d.ts +2 -35
- package/dist/jsx-runtime.js +11 -5
- package/dist/{runtime/lifecycle-operations.js → lifecycle-operations-D9va7GOU.js} +4 -5
- package/dist/navigate-BVDCzOuB.d.ts +34 -0
- package/dist/navigate-CmPLSXyw.js +1449 -0
- package/dist/{runtime/portal.js → portal-CyU3Ucf2.js} +33 -36
- package/dist/query-registry-CQIT4mXr.js +73 -0
- package/dist/{common/render-context.js → render-context-Clw3rFiO.js} +14 -6
- package/dist/renderer-DzPjeLby.js +6197 -0
- package/dist/{runtime/resource-operation.js → resource-operation-CEzfpnDk.js} +118 -15
- package/dist/resources/index.d.ts +42 -3
- package/dist/resources/index.js +3 -4
- package/dist/{common/route-activity.js → route-activity-CNJfpwx-.js} +1 -1
- package/dist/route-matching-vJpvLVbX.js +515 -0
- package/dist/router/index.d.ts +166 -14
- package/dist/router/index.js +150 -12
- package/dist/{common/router.d.ts → router-CeYvjj5_.d.ts} +72 -28
- package/dist/{common/router-internal.js → router-internal-BC0w1_xk.js} +1 -1
- package/dist/{runtime/scheduler.d.ts → scheduler-CmLO4Dfm.d.ts} +1 -3
- package/dist/{runtime/selector.js → selector-DafVYzV4.js} +34 -11
- package/dist/{runtime/snapshot-source.js → snapshot-source-BB42xgwb.js} +1 -1
- package/dist/ssg/index.d.ts +252 -4
- package/dist/ssg/index.js +857 -1
- package/dist/ssr/index.d.ts +225 -8
- package/dist/ssr/index.js +3 -6
- package/dist/{common/ssr.js → ssr-CbQO5xd3.js} +1 -1
- package/dist/ssr-D3t80Rc0.js +1413 -0
- package/dist/{runtime/state.js → state-DPl8lffD.js} +3 -5
- package/dist/structures-DUB3HchX.js +221 -0
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.js +2 -5
- package/dist/{jsx/types.d.ts → types-DnQVG4ZY.d.ts} +2 -5
- package/dist/{foundations/utilities/use-id.js → utilities-C_CGX4Dz.js} +1 -1
- package/dist/{ssr/verify-hydration.js → verify-hydration-io9ahUeq.js} +2 -2
- package/dist/{common/vnode.js → vnode-CGMJYPMB.js} +2 -2
- package/package.json +12 -7
- package/dist/bench/components/benchmark-row.d.ts +0 -20
- package/dist/bench/components/benchmark-row.js +0 -40
- package/dist/bench/components/benchmark-table.js +0 -23
- package/dist/bin/askr-ssg.d.ts +0 -27
- package/dist/bin/askr-ssg.js +0 -186
- package/dist/boot/hydration.js +0 -139
- package/dist/boot/root-lifecycle.d.ts +0 -18
- package/dist/boot/root-lifecycle.js +0 -209
- package/dist/boot/route-startup.js +0 -54
- package/dist/boot/types.d.ts +0 -61
- package/dist/common/component.d.ts +0 -18
- package/dist/common/control.d.ts +0 -12
- package/dist/common/dom-range.d.ts +0 -13
- package/dist/common/env.js +0 -41
- package/dist/common/error-boundary.d.ts +0 -15
- package/dist/common/invariant.js +0 -15
- package/dist/common/jsx.d.ts +0 -22
- package/dist/common/logger.js +0 -34
- package/dist/common/promise.js +0 -6
- package/dist/common/ssr-errors.d.ts +0 -10
- package/dist/common/ssr-errors.js +0 -14
- package/dist/common/ssr.d.ts +0 -41
- package/dist/common/vnode.d.ts +0 -21
- package/dist/components/error-boundary.d.ts +0 -14
- package/dist/components/error-boundary.js +0 -41
- package/dist/components/link.d.ts +0 -68
- package/dist/components/link.js +0 -74
- package/dist/control/case.d.ts +0 -18
- package/dist/control/case.js +0 -68
- package/dist/control/for.d.ts +0 -23
- package/dist/control/for.js +0 -61
- package/dist/control/shared.d.ts +0 -8
- package/dist/control/shared.js +0 -18
- package/dist/control/show.d.ts +0 -14
- package/dist/control/show.js +0 -32
- package/dist/data/data-runtime.d.ts +0 -27
- package/dist/data/invalidation.d.ts +0 -8
- package/dist/data/invalidation.js +0 -25
- package/dist/data/mutation-cell.d.ts +0 -27
- package/dist/data/mutation-cell.js +0 -133
- package/dist/data/query-cell.d.ts +0 -47
- package/dist/data/query-cell.js +0 -324
- package/dist/data/query-key.js +0 -40
- package/dist/data/shared.js +0 -20
- package/dist/data/testing.js +0 -2
- package/dist/data/types.d.ts +0 -160
- package/dist/foundations/icon/icon.d.ts +0 -52
- package/dist/foundations/icon/icon.js +0 -86
- package/dist/foundations/icon/icon.types.d.ts +0 -21
- package/dist/foundations/interactions/dismissable.d.ts +0 -71
- package/dist/foundations/interactions/dismissable.js +0 -24
- package/dist/foundations/interactions/focusable.d.ts +0 -21
- package/dist/foundations/interactions/focusable.js +0 -16
- package/dist/foundations/interactions/hoverable.d.ts +0 -25
- package/dist/foundations/interactions/hoverable.js +0 -13
- package/dist/foundations/interactions/interaction-policy.d.ts +0 -49
- package/dist/foundations/interactions/interaction-policy.js +0 -120
- package/dist/foundations/interactions/pressable.d.ts +0 -60
- package/dist/foundations/interactions/pressable.js +0 -49
- package/dist/foundations/interactions/roving-focus.d.ts +0 -51
- package/dist/foundations/interactions/roving-focus.js +0 -69
- package/dist/foundations/state/controllable.d.ts +0 -32
- package/dist/foundations/state/controllable.js +0 -80
- package/dist/foundations/structures/collection.d.ts +0 -51
- package/dist/foundations/structures/collection.js +0 -49
- package/dist/foundations/structures/layer.d.ts +0 -80
- package/dist/foundations/structures/layer.js +0 -79
- package/dist/foundations/structures/layout.d.ts +0 -32
- package/dist/foundations/structures/layout.js +0 -11
- package/dist/foundations/structures/portal.d.ts +0 -2
- package/dist/foundations/structures/portal.js +0 -3
- package/dist/foundations/structures/presence.d.ts +0 -36
- package/dist/foundations/structures/presence.js +0 -37
- package/dist/foundations/structures/slot.d.ts +0 -34
- package/dist/foundations/structures/slot.js +0 -39
- package/dist/foundations/utilities/aria.d.ts +0 -15
- package/dist/foundations/utilities/aria.js +0 -15
- package/dist/foundations/utilities/compose-handlers.d.ts +0 -36
- package/dist/foundations/utilities/compose-handlers.js +0 -18
- package/dist/foundations/utilities/compose-ref.js +0 -16
- package/dist/foundations/utilities/event-types.d.ts +0 -19
- package/dist/foundations/utilities/merge-props.d.ts +0 -4
- package/dist/foundations/utilities/merge-props.js +0 -47
- package/dist/foundations/utilities/use-id.d.ts +0 -31
- package/dist/fx/fx.d.ts +0 -32
- package/dist/fx/fx.js +0 -211
- package/dist/fx/noop.js +0 -7
- package/dist/fx/timing.d.ts +0 -158
- package/dist/fx/timing.js +0 -241
- package/dist/jsx/index.d.ts +0 -2
- package/dist/jsx/index.js +0 -4
- package/dist/jsx/types.js +0 -2
- package/dist/jsx/utils.d.ts +0 -4
- package/dist/jsx/utils.js +0 -17
- package/dist/jsx-runtime2.d.ts +0 -3
- package/dist/jsx-runtime2.js +0 -4
- package/dist/renderer/attributes.js +0 -254
- package/dist/renderer/boundaries.js +0 -142
- package/dist/renderer/boundary-materialization.js +0 -72
- package/dist/renderer/boundary-range-adoption.js +0 -76
- package/dist/renderer/boundary-range-sync.js +0 -101
- package/dist/renderer/boundary-state.js +0 -50
- package/dist/renderer/child-shape.js +0 -83
- package/dist/renderer/children-fastpath.js +0 -149
- package/dist/renderer/children.js +0 -158
- package/dist/renderer/cleanup.js +0 -267
- package/dist/renderer/component-host-cleanup.js +0 -143
- package/dist/renderer/component-host-instances.js +0 -116
- package/dist/renderer/component-host-replacement.js +0 -105
- package/dist/renderer/component-host-results.js +0 -138
- package/dist/renderer/component-host.js +0 -172
- package/dist/renderer/dom-host.js +0 -11
- package/dist/renderer/dom-internal.js +0 -243
- package/dist/renderer/dom-range.js +0 -161
- package/dist/renderer/dom.js +0 -11
- package/dist/renderer/element-children.js +0 -359
- package/dist/renderer/env.js +0 -2
- package/dist/renderer/error-boundary-dom.js +0 -86
- package/dist/renderer/evaluate-dom-range.js +0 -84
- package/dist/renderer/evaluate-reconcile.js +0 -257
- package/dist/renderer/evaluate.js +0 -95
- package/dist/renderer/fastpath.js +0 -142
- package/dist/renderer/for-commit-dom-map.js +0 -71
- package/dist/renderer/for-commit-removal.js +0 -27
- package/dist/renderer/for-commit-reorder.js +0 -87
- package/dist/renderer/for-commit.js +0 -442
- package/dist/renderer/hydration-boundaries.js +0 -60
- package/dist/renderer/hydration-listener-transaction.js +0 -49
- package/dist/renderer/index.js +0 -39
- package/dist/renderer/intrinsic-blueprint-analysis.js +0 -202
- package/dist/renderer/intrinsic-blueprint-bindings.js +0 -152
- package/dist/renderer/intrinsic-blueprint-materialization.js +0 -100
- package/dist/renderer/intrinsic-blueprint.js +0 -30
- package/dist/renderer/intrinsic-hydration-adoption.js +0 -66
- package/dist/renderer/keyed-children.js +0 -26
- package/dist/renderer/keyed.js +0 -167
- package/dist/renderer/namespaces.js +0 -21
- package/dist/renderer/prop-bindings.js +0 -315
- package/dist/renderer/reactive-child-dom.js +0 -139
- package/dist/renderer/reactive-child-sources.js +0 -182
- package/dist/renderer/reactive-children.js +0 -303
- package/dist/renderer/reconcile-commit.js +0 -36
- package/dist/renderer/reconcile-fastpaths.js +0 -100
- package/dist/renderer/reconcile-resolution.js +0 -163
- package/dist/renderer/reconcile.js +0 -37
- package/dist/renderer/retained-element-rollback.js +0 -288
- package/dist/renderer/stable-patch.js +0 -80
- package/dist/renderer/static-reuse.js +0 -94
- package/dist/renderer/types.js +0 -2
- package/dist/renderer/utils.js +0 -265
- package/dist/router/access.js +0 -34
- package/dist/router/activity.d.ts +0 -9
- package/dist/router/activity.js +0 -85
- package/dist/router/authoring.d.ts +0 -21
- package/dist/router/authoring.js +0 -196
- package/dist/router/internal-types.d.ts +0 -30
- package/dist/router/lazy.d.ts +0 -18
- package/dist/router/lazy.js +0 -50
- package/dist/router/manifest.d.ts +0 -9
- package/dist/router/manifest.js +0 -47
- package/dist/router/match.js +0 -120
- package/dist/router/navigate.d.ts +0 -10
- package/dist/router/navigate.js +0 -73
- package/dist/router/navigation-registry.d.ts +0 -31
- package/dist/router/navigation-registry.js +0 -103
- package/dist/router/navigation-scroll.d.ts +0 -13
- package/dist/router/navigation-scroll.js +0 -91
- package/dist/router/navigation-targets.d.ts +0 -30
- package/dist/router/navigation-targets.js +0 -634
- package/dist/router/policy.d.ts +0 -27
- package/dist/router/policy.js +0 -130
- package/dist/router/rendering.d.ts +0 -9
- package/dist/router/rendering.js +0 -47
- package/dist/router/resolution.d.ts +0 -3
- package/dist/router/resolution.js +0 -84
- package/dist/router/route-context.js +0 -77
- package/dist/router/route-matching.d.ts +0 -19
- package/dist/router/route-matching.js +0 -173
- package/dist/router/route-query.d.ts +0 -16
- package/dist/router/route-query.js +0 -45
- package/dist/router/route.d.ts +0 -8
- package/dist/router/route.js +0 -10
- package/dist/router/store.d.ts +0 -49
- package/dist/router/store.js +0 -169
- package/dist/router/testing.js +0 -4
- package/dist/runtime/access.d.ts +0 -19
- package/dist/runtime/access.js +0 -43
- package/dist/runtime/child-scope.d.ts +0 -41
- package/dist/runtime/child-scope.js +0 -134
- package/dist/runtime/component-cleanup.d.ts +0 -15
- package/dist/runtime/component-cleanup.js +0 -68
- package/dist/runtime/component-commit.js +0 -167
- package/dist/runtime/component-facade.d.ts +0 -5
- package/dist/runtime/component-facade.js +0 -6
- package/dist/runtime/component-internal.d.ts +0 -105
- package/dist/runtime/component-internal.js +0 -237
- package/dist/runtime/component-lifecycle.d.ts +0 -10
- package/dist/runtime/component-lifecycle.js +0 -33
- package/dist/runtime/component-scope.d.ts +0 -54
- package/dist/runtime/component.d.ts +0 -5
- package/dist/runtime/component.js +0 -6
- package/dist/runtime/context.d.ts +0 -72
- package/dist/runtime/context.js +0 -236
- package/dist/runtime/control.d.ts +0 -62
- package/dist/runtime/control.js +0 -239
- package/dist/runtime/derive.d.ts +0 -16
- package/dist/runtime/derive.js +0 -140
- package/dist/runtime/dev-namespace.d.ts +0 -30
- package/dist/runtime/dev-namespace.js +0 -64
- package/dist/runtime/effect.d.ts +0 -35
- package/dist/runtime/error-boundary.d.ts +0 -4
- package/dist/runtime/error-boundary.js +0 -29
- package/dist/runtime/events.d.ts +0 -58
- package/dist/runtime/events.js +0 -201
- package/dist/runtime/execution-model.d.ts +0 -6
- package/dist/runtime/execution-model.js +0 -13
- package/dist/runtime/fastlane.d.ts +0 -33
- package/dist/runtime/fastlane.js +0 -173
- package/dist/runtime/for-bench.d.ts +0 -40
- package/dist/runtime/for-bench.js +0 -13
- package/dist/runtime/for-internal.d.ts +0 -106
- package/dist/runtime/for-internal.js +0 -285
- package/dist/runtime/for-reconcile.d.ts +0 -7
- package/dist/runtime/for-reconcile.js +0 -442
- package/dist/runtime/for-scopes.d.ts +0 -26
- package/dist/runtime/for-scopes.js +0 -280
- package/dist/runtime/for-signals.d.ts +0 -39
- package/dist/runtime/for-signals.js +0 -213
- package/dist/runtime/for-types.d.ts +0 -8
- package/dist/runtime/for.d.ts +0 -4
- package/dist/runtime/for.js +0 -5
- package/dist/runtime/index.d.ts +0 -24
- package/dist/runtime/index.js +0 -33
- package/dist/runtime/lifecycle-batch.d.ts +0 -59
- package/dist/runtime/lifecycle-batch.js +0 -178
- package/dist/runtime/lifecycle-operation-settlement.d.ts +0 -5
- package/dist/runtime/lifecycle-operation-settlement.js +0 -51
- package/dist/runtime/lifecycle-operations.d.ts +0 -30
- package/dist/runtime/operations.d.ts +0 -3
- package/dist/runtime/operations.js +0 -3
- package/dist/runtime/perf-metrics.d.ts +0 -27
- package/dist/runtime/perf-metrics.js +0 -6
- package/dist/runtime/portal.d.ts +0 -21
- package/dist/runtime/readable.d.ts +0 -34
- package/dist/runtime/readable.js +0 -183
- package/dist/runtime/resource-cell.js +0 -112
- package/dist/runtime/resource-operation.d.ts +0 -12
- package/dist/runtime/runtime.js +0 -57
- package/dist/runtime/selector-store.js +0 -22
- package/dist/runtime/selector.d.ts +0 -10
- package/dist/runtime/snapshot-source.d.ts +0 -9
- package/dist/runtime/state.d.ts +0 -54
- package/dist/ssg/batch-render.js +0 -101
- package/dist/ssg/create-static-gen.d.ts +0 -66
- package/dist/ssg/create-static-gen.js +0 -250
- package/dist/ssg/generate-metadata.js +0 -92
- package/dist/ssg/generation-plan.js +0 -68
- package/dist/ssg/incremental-manifest.js +0 -54
- package/dist/ssg/resolve-ssg-data.js +0 -103
- package/dist/ssg/route-utils.js +0 -22
- package/dist/ssg/static-routes.js +0 -100
- package/dist/ssg/types.d.ts +0 -188
- package/dist/ssg/write-static-files.js +0 -77
- package/dist/ssr/attrs.js +0 -92
- package/dist/ssr/boundaries.js +0 -124
- package/dist/ssr/component-runtime.js +0 -85
- package/dist/ssr/context.d.ts +0 -49
- package/dist/ssr/context.js +0 -89
- package/dist/ssr/errors.d.ts +0 -9
- package/dist/ssr/errors.js +0 -12
- package/dist/ssr/escape.js +0 -191
- package/dist/ssr/hydration-data.js +0 -8
- package/dist/ssr/hydration-verify.d.ts +0 -11
- package/dist/ssr/hydration-verify.js +0 -171
- package/dist/ssr/index-internal.d.ts +0 -14
- package/dist/ssr/index-internal.js +0 -17
- package/dist/ssr/render-keys.js +0 -14
- package/dist/ssr/render-resolved.d.ts +0 -19
- package/dist/ssr/render-resolved.js +0 -33
- package/dist/ssr/render-sync.d.ts +0 -20
- package/dist/ssr/render-sync.js +0 -283
- package/dist/ssr/route-policy-resolution.js +0 -76
- package/dist/ssr/route-render.d.ts +0 -76
- package/dist/ssr/route-render.js +0 -118
- package/dist/ssr/sink.d.ts +0 -25
- package/dist/ssr/sink.js +0 -84
- package/dist/ssr/types.d.ts +0 -22
package/dist/runtime/derive.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { enqueueRuntimeLane, getRuntimeFlushVersion } from "./access.js";
|
|
2
|
-
import { clearDerivedDependencySubscriptions, markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, notifyReadableReaders, recordReadableRead, syncDerivedDependencySubscriptions, withDerivedReadTracking } from "./readable.js";
|
|
3
|
-
import { claimHookIndex, getCurrentInstance } from "./component-scope.js";
|
|
4
|
-
import "./component.js";
|
|
5
|
-
import { isSnapshotSource } from "./snapshot-source.js";
|
|
6
|
-
//#region src/runtime/derive.ts
|
|
7
|
-
const deriveCells = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
const dirtyDerivedCells = /* @__PURE__ */ new Set();
|
|
9
|
-
let hasPendingDerivedFlush = false;
|
|
10
|
-
function getDeriveStore(instance) {
|
|
11
|
-
let store = deriveCells.get(instance);
|
|
12
|
-
if (!store) {
|
|
13
|
-
store = /* @__PURE__ */ new Map();
|
|
14
|
-
deriveCells.set(instance, store);
|
|
15
|
-
}
|
|
16
|
-
return store;
|
|
17
|
-
}
|
|
18
|
-
function markDerivedCellDirty(cell) {
|
|
19
|
-
cell._dirty = true;
|
|
20
|
-
if (cell._scheduled) return;
|
|
21
|
-
cell._scheduled = true;
|
|
22
|
-
dirtyDerivedCells.add(cell);
|
|
23
|
-
if (!hasPendingDerivedFlush) {
|
|
24
|
-
hasPendingDerivedFlush = true;
|
|
25
|
-
enqueueRuntimeLane("derived", flushDirtyDerivedCells);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function flushDirtyDerivedCells() {
|
|
29
|
-
hasPendingDerivedFlush = false;
|
|
30
|
-
if (dirtyDerivedCells.size === 0) return;
|
|
31
|
-
const pending = dirtyDerivedCells.values();
|
|
32
|
-
let next = pending.next();
|
|
33
|
-
while (!next.done) {
|
|
34
|
-
const cell = next.value;
|
|
35
|
-
dirtyDerivedCells.delete(cell);
|
|
36
|
-
cell._scheduled = false;
|
|
37
|
-
if (!cell._dirty) {
|
|
38
|
-
next = pending.next();
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
recomputeDerivedCell(cell, true);
|
|
42
|
-
next = pending.next();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function recomputeDerivedCell(cell, notifyDownstream) {
|
|
46
|
-
if (!cell._dirty && cell._hasValue) return cell._value;
|
|
47
|
-
if (cell._evaluating) throw new Error("derive() cannot read itself recursively");
|
|
48
|
-
cell._evaluating = true;
|
|
49
|
-
cell._dirty = false;
|
|
50
|
-
cell._pendingDependencySources = /* @__PURE__ */ new Set();
|
|
51
|
-
const prevSources = cell._sources;
|
|
52
|
-
let nextValue;
|
|
53
|
-
try {
|
|
54
|
-
nextValue = withDerivedReadTracking(cell, cell._compute);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
cell._dirty = true;
|
|
57
|
-
cell._pendingDependencySources = void 0;
|
|
58
|
-
throw error;
|
|
59
|
-
} finally {
|
|
60
|
-
cell._evaluating = false;
|
|
61
|
-
}
|
|
62
|
-
const nextSources = cell._pendingDependencySources ?? /* @__PURE__ */ new Set();
|
|
63
|
-
cell._pendingDependencySources = void 0;
|
|
64
|
-
syncDerivedDependencySubscriptions(cell, prevSources, nextSources);
|
|
65
|
-
cell._sources = nextSources;
|
|
66
|
-
const valueChanged = !cell._hasValue || !Object.is(cell._value, nextValue);
|
|
67
|
-
cell._hasValue = true;
|
|
68
|
-
cell._value = nextValue;
|
|
69
|
-
cell._lastRecomputeFlushVersion = getRuntimeFlushVersion();
|
|
70
|
-
if (valueChanged && notifyDownstream) {
|
|
71
|
-
markReadableDerivedSubscribersDirty(cell);
|
|
72
|
-
markReactivePropsDirtySource(cell);
|
|
73
|
-
notifyReadableReaders(cell);
|
|
74
|
-
}
|
|
75
|
-
return cell._value;
|
|
76
|
-
}
|
|
77
|
-
function createDerivedCell(instance, hookIndex, compute) {
|
|
78
|
-
const cell = function derivedGetter() {
|
|
79
|
-
recordReadableRead(cell);
|
|
80
|
-
return recomputeDerivedCell(cell, cell._scheduled);
|
|
81
|
-
};
|
|
82
|
-
cell._owner = instance;
|
|
83
|
-
cell._hookIndex = hookIndex;
|
|
84
|
-
cell._compute = compute;
|
|
85
|
-
cell._value = void 0;
|
|
86
|
-
cell._hasValue = false;
|
|
87
|
-
cell._dirty = true;
|
|
88
|
-
cell._scheduled = false;
|
|
89
|
-
cell._evaluating = false;
|
|
90
|
-
cell._lastRecomputeFlushVersion = -1;
|
|
91
|
-
cell._sources = /* @__PURE__ */ new Set();
|
|
92
|
-
cell._markDirty = () => {
|
|
93
|
-
markDerivedCellDirty(cell);
|
|
94
|
-
};
|
|
95
|
-
cell._cleanup = () => {
|
|
96
|
-
cell._scheduled = false;
|
|
97
|
-
cell._dirty = false;
|
|
98
|
-
cell._hasValue = false;
|
|
99
|
-
dirtyDerivedCells.delete(cell);
|
|
100
|
-
clearDerivedDependencySubscriptions(cell, cell._sources);
|
|
101
|
-
cell._derivedSubscribers?.clear();
|
|
102
|
-
cell._readers?.clear();
|
|
103
|
-
};
|
|
104
|
-
(instance.cleanupFns ??= []).push(() => {
|
|
105
|
-
cell._cleanup();
|
|
106
|
-
deriveCells.get(instance)?.delete(hookIndex);
|
|
107
|
-
});
|
|
108
|
-
return cell;
|
|
109
|
-
}
|
|
110
|
-
function getOrCreateDerivedCell(instance, hookIndex, compute) {
|
|
111
|
-
const store = getDeriveStore(instance);
|
|
112
|
-
const existing = store.get(hookIndex);
|
|
113
|
-
if (existing) {
|
|
114
|
-
existing._compute = compute;
|
|
115
|
-
if (existing._lastRecomputeFlushVersion !== getRuntimeFlushVersion()) existing._dirty = true;
|
|
116
|
-
return existing;
|
|
117
|
-
}
|
|
118
|
-
const created = createDerivedCell(instance, hookIndex, compute);
|
|
119
|
-
store.set(hookIndex, created);
|
|
120
|
-
return created;
|
|
121
|
-
}
|
|
122
|
-
function createMappedSelector(source, map) {
|
|
123
|
-
return () => {
|
|
124
|
-
let value;
|
|
125
|
-
if (typeof source === "function") value = source();
|
|
126
|
-
else if (isSnapshotSource(source)) value = source.value ?? source;
|
|
127
|
-
else value = source;
|
|
128
|
-
if (value == null) return null;
|
|
129
|
-
return map(value);
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function derive(source, map) {
|
|
133
|
-
const instance = getCurrentInstance();
|
|
134
|
-
if (!instance) throw new Error("derive() can only be called during component render execution. Move derive() calls to the top level of your component function.");
|
|
135
|
-
const cell = getOrCreateDerivedCell(instance, claimHookIndex(instance, "derive"), map === void 0 ? () => source() : createMappedSelector(source, map));
|
|
136
|
-
recomputeDerivedCell(cell, false);
|
|
137
|
-
return cell;
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
export { derive };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region src/runtime/dev-namespace.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Dev-only namespace helpers for diagnostics
|
|
4
|
-
*
|
|
5
|
-
* Centralizes the repetitive globalThis.__ASKR__ access pattern
|
|
6
|
-
* used throughout runtime for dev-mode diagnostics.
|
|
7
|
-
*/
|
|
8
|
-
type DevNamespace = Record<string, unknown>;
|
|
9
|
-
/**
|
|
10
|
-
* Get or create the __ASKR__ dev namespace on globalThis.
|
|
11
|
-
* Returns empty object in production to avoid allocations.
|
|
12
|
-
*/
|
|
13
|
-
declare const getDevNamespace: () => DevNamespace;
|
|
14
|
-
/**
|
|
15
|
-
* Set a value in the dev namespace (no-op in production).
|
|
16
|
-
*/
|
|
17
|
-
declare const setDevValue: (key: string, value: unknown) => void;
|
|
18
|
-
/**
|
|
19
|
-
* Get a value from the dev namespace (returns undefined in production).
|
|
20
|
-
*/
|
|
21
|
-
declare const getDevValue: <T>(key: string) => T | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Delete a value from the dev namespace (no-op in production).
|
|
24
|
-
*/
|
|
25
|
-
declare const deleteDevValue: (key: string) => void;
|
|
26
|
-
/**
|
|
27
|
-
* Increment a counter in the dev namespace (no-op in production).
|
|
28
|
-
* Safely handles non-number values by resetting to 1.
|
|
29
|
-
*/
|
|
30
|
-
declare const incDevCounter: (key: string) => void;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { isProductionEnvironment } from "../common/env.js";
|
|
2
|
-
//#region src/runtime/dev-namespace.ts
|
|
3
|
-
/**
|
|
4
|
-
* Dev-only namespace helpers for diagnostics
|
|
5
|
-
*
|
|
6
|
-
* Centralizes the repetitive globalThis.__ASKR__ access pattern
|
|
7
|
-
* used throughout runtime for dev-mode diagnostics.
|
|
8
|
-
*/
|
|
9
|
-
const PRODUCTION_BUILD_ENABLED = isProductionEnvironment();
|
|
10
|
-
const EMPTY_DEV_NAMESPACE = {};
|
|
11
|
-
function getOrCreateDevNamespace() {
|
|
12
|
-
try {
|
|
13
|
-
const g = globalThis;
|
|
14
|
-
if (!g.__ASKR__) g.__ASKR__ = {};
|
|
15
|
-
return g.__ASKR__;
|
|
16
|
-
} catch {
|
|
17
|
-
return EMPTY_DEV_NAMESPACE;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function getDevNamespaceLive() {
|
|
21
|
-
if (isProductionEnvironment()) return EMPTY_DEV_NAMESPACE;
|
|
22
|
-
return getOrCreateDevNamespace();
|
|
23
|
-
}
|
|
24
|
-
function setDevValueLive(key, value) {
|
|
25
|
-
if (isProductionEnvironment()) return;
|
|
26
|
-
try {
|
|
27
|
-
getOrCreateDevNamespace()[key] = value;
|
|
28
|
-
} catch {}
|
|
29
|
-
}
|
|
30
|
-
function getDevValueLive(key) {
|
|
31
|
-
if (isProductionEnvironment()) return void 0;
|
|
32
|
-
try {
|
|
33
|
-
return getOrCreateDevNamespace()[key];
|
|
34
|
-
} catch {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function incDevCounterLive(key) {
|
|
39
|
-
if (isProductionEnvironment()) return;
|
|
40
|
-
try {
|
|
41
|
-
const ns = getOrCreateDevNamespace();
|
|
42
|
-
ns[key] = (typeof ns[key] === "number" ? ns[key] : 0) + 1;
|
|
43
|
-
} catch {}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Get or create the __ASKR__ dev namespace on globalThis.
|
|
47
|
-
* Returns empty object in production to avoid allocations.
|
|
48
|
-
*/
|
|
49
|
-
const getDevNamespace = PRODUCTION_BUILD_ENABLED ? () => EMPTY_DEV_NAMESPACE : getDevNamespaceLive;
|
|
50
|
-
/**
|
|
51
|
-
* Set a value in the dev namespace (no-op in production).
|
|
52
|
-
*/
|
|
53
|
-
const setDevValue = PRODUCTION_BUILD_ENABLED ? () => {} : setDevValueLive;
|
|
54
|
-
/**
|
|
55
|
-
* Get a value from the dev namespace (returns undefined in production).
|
|
56
|
-
*/
|
|
57
|
-
const getDevValue = PRODUCTION_BUILD_ENABLED ? () => void 0 : getDevValueLive;
|
|
58
|
-
/**
|
|
59
|
-
* Increment a counter in the dev namespace (no-op in production).
|
|
60
|
-
* Safely handles non-number values by resetting to 1.
|
|
61
|
-
*/
|
|
62
|
-
const incDevCounter = PRODUCTION_BUILD_ENABLED ? () => {} : incDevCounterLive;
|
|
63
|
-
//#endregion
|
|
64
|
-
export { getDevNamespace, getDevValue, incDevCounter, setDevValue };
|
package/dist/runtime/effect.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FineGrainedReadCollector, ReadableSource } from "./readable.js";
|
|
2
|
-
import { SchedulerLane } from "./scheduler.js";
|
|
3
|
-
|
|
4
|
-
//#region src/runtime/effect.d.ts
|
|
5
|
-
type EffectReadSources = ReadableSource<unknown> | ReadableSource<unknown>[] | Set<ReadableSource<unknown>> | null;
|
|
6
|
-
interface FineGrainedEffect<T> extends FineGrainedReadCollector {
|
|
7
|
-
lane: SchedulerLane;
|
|
8
|
-
compute(): T;
|
|
9
|
-
commit(value: T, previousValue: T | undefined): void;
|
|
10
|
-
equals(previousValue: T, nextValue: T): boolean;
|
|
11
|
-
readSources: EffectReadSources;
|
|
12
|
-
readSource2: ReadableSource<unknown> | null;
|
|
13
|
-
isActive: boolean;
|
|
14
|
-
hasValue: boolean;
|
|
15
|
-
lastValue: T | undefined;
|
|
16
|
-
onError?(error: unknown): void;
|
|
17
|
-
}
|
|
18
|
-
interface FineGrainedEffectHandle<T> {
|
|
19
|
-
cleanup(): void;
|
|
20
|
-
updateCompute(nextCompute: () => T): void;
|
|
21
|
-
flush(): void;
|
|
22
|
-
}
|
|
23
|
-
interface CreateFineGrainedEffectOptions<T> {
|
|
24
|
-
lane: SchedulerLane;
|
|
25
|
-
compute: () => T;
|
|
26
|
-
commit: (value: T, previousValue: T | undefined) => void;
|
|
27
|
-
equals?: (previousValue: T, nextValue: T) => boolean;
|
|
28
|
-
onError?: (error: unknown) => void;
|
|
29
|
-
}
|
|
30
|
-
declare function markFineGrainedEffectsDirtySource(source: ReadableSource<unknown>): void;
|
|
31
|
-
declare function createFineGrainedEffect<T>(options: CreateFineGrainedEffectOptions<T>): FineGrainedEffectHandle<T>;
|
|
32
|
-
/** @internal Allocation-sensitive variant for shared renderer callbacks. */
|
|
33
|
-
declare function createOwnedFineGrainedEffect<T>(lane: SchedulerLane, compute: () => T, commit: (value: T, previousValue: T | undefined) => void, equals: (previousValue: T, nextValue: T) => boolean, onError: ((error: unknown) => void) | undefined, owner: unknown): FineGrainedEffectHandle<T>;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { CreateFineGrainedEffectOptions, FineGrainedEffectHandle };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ComponentInstance } from "./component-internal.js";
|
|
2
|
-
//#region src/runtime/error-boundary.d.ts
|
|
3
|
-
declare function createBoundaryReset(instance: ComponentInstance): () => void;
|
|
4
|
-
declare function reportBoundaryError(instance: ComponentInstance, error: unknown, onError?: (error: unknown) => void): void;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { logger } from "../common/logger.js";
|
|
2
|
-
//#region src/runtime/error-boundary.ts
|
|
3
|
-
function createBoundaryReset(instance) {
|
|
4
|
-
return () => {
|
|
5
|
-
const boundaryState = instance.errorBoundaryState;
|
|
6
|
-
if (!boundaryState) return;
|
|
7
|
-
boundaryState.error = null;
|
|
8
|
-
boundaryState.notified = false;
|
|
9
|
-
queueMicrotask(() => {
|
|
10
|
-
instance._enqueueRun?.();
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function reportBoundaryError(instance, error, onError) {
|
|
15
|
-
const boundaryState = instance.errorBoundaryState;
|
|
16
|
-
if (boundaryState && Object.is(boundaryState.error, error) && boundaryState.notified) return;
|
|
17
|
-
if (boundaryState) {
|
|
18
|
-
boundaryState.error = error;
|
|
19
|
-
boundaryState.notified = true;
|
|
20
|
-
}
|
|
21
|
-
try {
|
|
22
|
-
onError?.(error);
|
|
23
|
-
} catch (hookError) {
|
|
24
|
-
logger.error("[Askr] ErrorBoundary onError handler threw:", hookError);
|
|
25
|
-
}
|
|
26
|
-
logger.error("[Askr] ErrorBoundary caught render error:", error);
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { createBoundaryReset, reportBoundaryError };
|
package/dist/runtime/events.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
//#region src/runtime/events.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Event delegation system for Askr
|
|
4
|
-
*
|
|
5
|
-
* Provides efficient event handling by attaching listeners to a container
|
|
6
|
-
* instead of individual elements. This significantly reduces memory usage
|
|
7
|
-
* and improves performance when many elements have the same event type.
|
|
8
|
-
*
|
|
9
|
-
* Delegated handling is enabled by default. Tests and internal runtime code
|
|
10
|
-
* can still disable or re-enable it when they need to exercise both modes.
|
|
11
|
-
*/
|
|
12
|
-
interface DelegatedEventMap {
|
|
13
|
-
click: MouseEvent;
|
|
14
|
-
dblclick: MouseEvent;
|
|
15
|
-
mousedown: MouseEvent;
|
|
16
|
-
mouseup: MouseEvent;
|
|
17
|
-
mouseover: MouseEvent;
|
|
18
|
-
mouseout: MouseEvent;
|
|
19
|
-
mousemove: MouseEvent;
|
|
20
|
-
focus: FocusEvent;
|
|
21
|
-
blur: FocusEvent;
|
|
22
|
-
input: InputEvent;
|
|
23
|
-
change: Event;
|
|
24
|
-
keydown: KeyboardEvent;
|
|
25
|
-
keyup: KeyboardEvent;
|
|
26
|
-
keypress: KeyboardEvent;
|
|
27
|
-
submit: Event;
|
|
28
|
-
scroll: Event;
|
|
29
|
-
wheel: WheelEvent;
|
|
30
|
-
touchstart: TouchEvent;
|
|
31
|
-
touchend: TouchEvent;
|
|
32
|
-
touchmove: TouchEvent;
|
|
33
|
-
touchcancel: TouchEvent;
|
|
34
|
-
}
|
|
35
|
-
interface DelegatedHandler {
|
|
36
|
-
handler: EventListener;
|
|
37
|
-
original: EventListener;
|
|
38
|
-
container: Element;
|
|
39
|
-
eventName: string;
|
|
40
|
-
options?: AddEventListenerOptions;
|
|
41
|
-
}
|
|
42
|
-
declare function isEventDelegationEnabled(): boolean;
|
|
43
|
-
declare function disableEventDelegation(): void;
|
|
44
|
-
declare function enableEventDelegation(container?: Element): void;
|
|
45
|
-
declare function setGlobalDelegationContainer(container: Element): void;
|
|
46
|
-
declare function addDelegatedListener(element: Element, eventName: string, handler: EventListener, originalHandler: EventListener, options?: AddEventListenerOptions): void;
|
|
47
|
-
/** @internal Attach a delegated handler to a newly cloned element. */
|
|
48
|
-
declare function addFreshDelegatedListener(element: Element, eventName: string, handler: EventListener, originalHandler: EventListener, options?: AddEventListenerOptions): void;
|
|
49
|
-
declare function updateDelegatedListener(element: Element, eventName: string, handler: EventListener, originalHandler: EventListener, options?: AddEventListenerOptions): boolean;
|
|
50
|
-
declare function removeDelegatedListener(element: Element, eventName: string): void;
|
|
51
|
-
declare function getDelegatedHandlerForElement(element: Element, eventName: string): DelegatedHandler | undefined;
|
|
52
|
-
declare function getDelegatedHandlersForElement(element: Element): Map<string, DelegatedHandler> | undefined;
|
|
53
|
-
declare function hasDelegatedHandler(element: Element, eventName: string): boolean;
|
|
54
|
-
declare function clearDelegatedHandlersForElement(element: Element): void;
|
|
55
|
-
declare function getDelegatedEventNames(): readonly (keyof DelegatedEventMap)[];
|
|
56
|
-
declare function isDelegatedEvent(eventName: string): boolean;
|
|
57
|
-
//#endregion
|
|
58
|
-
export { DelegatedEventMap };
|
package/dist/runtime/events.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { logger } from "../common/logger.js";
|
|
2
|
-
import "./perf-metrics.js";
|
|
3
|
-
import { runRuntimeHandlerScope } from "./access.js";
|
|
4
|
-
import "./dev-namespace.js";
|
|
5
|
-
const DELEGATED_EVENTS = [
|
|
6
|
-
"click",
|
|
7
|
-
"dblclick",
|
|
8
|
-
"mousedown",
|
|
9
|
-
"mouseup",
|
|
10
|
-
"mouseover",
|
|
11
|
-
"mouseout",
|
|
12
|
-
"mousemove",
|
|
13
|
-
"focus",
|
|
14
|
-
"blur",
|
|
15
|
-
"input",
|
|
16
|
-
"change",
|
|
17
|
-
"keydown",
|
|
18
|
-
"keyup",
|
|
19
|
-
"keypress",
|
|
20
|
-
"submit",
|
|
21
|
-
"scroll",
|
|
22
|
-
"wheel",
|
|
23
|
-
"touchstart",
|
|
24
|
-
"touchend",
|
|
25
|
-
"touchmove",
|
|
26
|
-
"touchcancel"
|
|
27
|
-
];
|
|
28
|
-
const DELEGATED_HANDLERS = Symbol("askr.delegated-handlers");
|
|
29
|
-
const delegatedHandlerFallback = /* @__PURE__ */ new WeakMap();
|
|
30
|
-
function getDelegatedHandlerStore(element) {
|
|
31
|
-
return element[DELEGATED_HANDLERS] ?? delegatedHandlerFallback.get(element);
|
|
32
|
-
}
|
|
33
|
-
function setDelegatedHandlerStore(element, store) {
|
|
34
|
-
const host = element;
|
|
35
|
-
try {
|
|
36
|
-
host[DELEGATED_HANDLERS] = store;
|
|
37
|
-
if (host[DELEGATED_HANDLERS] === store) return;
|
|
38
|
-
} catch {}
|
|
39
|
-
delegatedHandlerFallback.set(element, store);
|
|
40
|
-
}
|
|
41
|
-
function deleteDelegatedHandlerStore(element) {
|
|
42
|
-
const host = element;
|
|
43
|
-
if (host[DELEGATED_HANDLERS] !== void 0) try {
|
|
44
|
-
delete host[DELEGATED_HANDLERS];
|
|
45
|
-
return;
|
|
46
|
-
} catch {}
|
|
47
|
-
delegatedHandlerFallback.delete(element);
|
|
48
|
-
}
|
|
49
|
-
let eventDelegationEnabled = true;
|
|
50
|
-
const containerDelegatedListeners = /* @__PURE__ */ new Map();
|
|
51
|
-
function isEventDelegationEnabled() {
|
|
52
|
-
return eventDelegationEnabled;
|
|
53
|
-
}
|
|
54
|
-
function decrementContainerListenerUsage(entry) {
|
|
55
|
-
const listeners = containerDelegatedListeners.get(entry.container);
|
|
56
|
-
const listener = listeners?.get(entry.eventName);
|
|
57
|
-
if (!listener) return;
|
|
58
|
-
listener.usage -= 1;
|
|
59
|
-
if (listener.usage > 0) return;
|
|
60
|
-
entry.container.removeEventListener(entry.eventName, listener.handler);
|
|
61
|
-
listeners?.delete(entry.eventName);
|
|
62
|
-
if (listeners?.size === 0) containerDelegatedListeners.delete(entry.container);
|
|
63
|
-
}
|
|
64
|
-
function getDelegationContainer() {
|
|
65
|
-
if (typeof document !== "undefined") return document.body;
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
function attachDelegatedListener(container, element, eventName, handler, originalHandler, options, fresh = false) {
|
|
69
|
-
const existingStore = fresh ? void 0 : getDelegatedHandlerStore(element);
|
|
70
|
-
const hadHandler = existingStore instanceof Map ? existingStore.has(eventName) : existingStore?.eventName === eventName;
|
|
71
|
-
let containerListeners = containerDelegatedListeners.get(container);
|
|
72
|
-
if (!containerListeners) {
|
|
73
|
-
containerListeners = /* @__PURE__ */ new Map();
|
|
74
|
-
containerDelegatedListeners.set(container, containerListeners);
|
|
75
|
-
}
|
|
76
|
-
let containerListener = containerListeners.get(eventName);
|
|
77
|
-
if (!containerListener) {
|
|
78
|
-
const delegatedHandler = (e) => {
|
|
79
|
-
const target = e.target;
|
|
80
|
-
if (!target) return;
|
|
81
|
-
runRuntimeHandlerScope(() => {
|
|
82
|
-
let current = target;
|
|
83
|
-
while (current && current !== container) {
|
|
84
|
-
const store = getDelegatedHandlerStore(current);
|
|
85
|
-
const entry = !store ? void 0 : store instanceof Map ? store.get(eventName) : store.eventName === eventName ? store : void 0;
|
|
86
|
-
if (entry) try {
|
|
87
|
-
entry.handler(e);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
logger.error("[Askr] Delegated event error:", error);
|
|
90
|
-
}
|
|
91
|
-
if (e.cancelBubble) break;
|
|
92
|
-
current = current.parentElement;
|
|
93
|
-
}
|
|
94
|
-
}, "sync");
|
|
95
|
-
};
|
|
96
|
-
const listenerOptions = getPassiveOptions(eventName) ?? options;
|
|
97
|
-
container.addEventListener(eventName, delegatedHandler, listenerOptions);
|
|
98
|
-
containerListener = {
|
|
99
|
-
handler: delegatedHandler,
|
|
100
|
-
usage: 0
|
|
101
|
-
};
|
|
102
|
-
containerListeners.set(eventName, containerListener);
|
|
103
|
-
}
|
|
104
|
-
setDelegatedHandlerForElement(element, {
|
|
105
|
-
handler,
|
|
106
|
-
original: originalHandler,
|
|
107
|
-
container,
|
|
108
|
-
eventName,
|
|
109
|
-
options
|
|
110
|
-
}, existingStore);
|
|
111
|
-
if (!hadHandler) containerListener.usage += 1;
|
|
112
|
-
}
|
|
113
|
-
function setDelegatedHandlerForElement(element, entry, existing = getDelegatedHandlerStore(element)) {
|
|
114
|
-
if (!existing) {
|
|
115
|
-
setDelegatedHandlerStore(element, entry);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (existing instanceof Map) {
|
|
119
|
-
existing.set(entry.eventName, entry);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (existing.eventName === entry.eventName) {
|
|
123
|
-
setDelegatedHandlerStore(element, entry);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const next = /* @__PURE__ */ new Map();
|
|
127
|
-
next.set(existing.eventName, existing);
|
|
128
|
-
next.set(entry.eventName, entry);
|
|
129
|
-
setDelegatedHandlerStore(element, next);
|
|
130
|
-
}
|
|
131
|
-
function getPassiveOptions(eventName) {
|
|
132
|
-
if (eventName === "wheel" || eventName === "scroll" || eventName.startsWith("touch")) return { passive: true };
|
|
133
|
-
}
|
|
134
|
-
function addDelegatedListener(element, eventName, handler, originalHandler, options) {
|
|
135
|
-
const container = getDelegationContainer();
|
|
136
|
-
if (!container) return;
|
|
137
|
-
attachDelegatedListener(container, element, eventName, handler, originalHandler, options);
|
|
138
|
-
}
|
|
139
|
-
/** @internal Attach a delegated handler to a newly cloned element. */
|
|
140
|
-
function addFreshDelegatedListener(element, eventName, handler, originalHandler, options) {
|
|
141
|
-
const container = getDelegationContainer();
|
|
142
|
-
if (!container) return;
|
|
143
|
-
attachDelegatedListener(container, element, eventName, handler, originalHandler, options, true);
|
|
144
|
-
}
|
|
145
|
-
function updateDelegatedListener(element, eventName, handler, originalHandler, options) {
|
|
146
|
-
const existing = getDelegatedHandlerForElement(element, eventName);
|
|
147
|
-
if (!existing) return false;
|
|
148
|
-
const container = getDelegationContainer();
|
|
149
|
-
if (!container || existing.container !== container || !containerDelegatedListeners.get(existing.container)?.has(eventName)) {
|
|
150
|
-
removeDelegatedListener(element, eventName);
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
existing.handler = handler;
|
|
154
|
-
existing.original = originalHandler;
|
|
155
|
-
existing.options = options;
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
function removeDelegatedListener(element, eventName) {
|
|
159
|
-
const existing = getDelegatedHandlerStore(element);
|
|
160
|
-
if (!existing) return;
|
|
161
|
-
if (existing instanceof Map) {
|
|
162
|
-
if (existing.has(eventName)) decrementContainerListenerUsage(existing.get(eventName));
|
|
163
|
-
existing.delete(eventName);
|
|
164
|
-
if (existing.size === 0) {
|
|
165
|
-
deleteDelegatedHandlerStore(element);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (existing.size === 1) {
|
|
169
|
-
const only = existing.values().next().value;
|
|
170
|
-
setDelegatedHandlerStore(element, only);
|
|
171
|
-
}
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
if (existing.eventName === eventName) {
|
|
175
|
-
decrementContainerListenerUsage(existing);
|
|
176
|
-
deleteDelegatedHandlerStore(element);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function getDelegatedHandlerForElement(element, eventName) {
|
|
180
|
-
const store = getDelegatedHandlerStore(element);
|
|
181
|
-
if (!store) return void 0;
|
|
182
|
-
if (store instanceof Map) return store.get(eventName);
|
|
183
|
-
return store.eventName === eventName ? store : void 0;
|
|
184
|
-
}
|
|
185
|
-
function getDelegatedHandlersForElement(element) {
|
|
186
|
-
const store = getDelegatedHandlerStore(element);
|
|
187
|
-
if (!store) return void 0;
|
|
188
|
-
if (store instanceof Map) return store;
|
|
189
|
-
return /* @__PURE__ */ new Map([[store.eventName, store]]);
|
|
190
|
-
}
|
|
191
|
-
function clearDelegatedHandlersForElement(element) {
|
|
192
|
-
const existing = getDelegatedHandlerStore(element);
|
|
193
|
-
if (existing instanceof Map) for (const entry of existing.values()) decrementContainerListenerUsage(entry);
|
|
194
|
-
else if (existing) decrementContainerListenerUsage(existing);
|
|
195
|
-
deleteDelegatedHandlerStore(element);
|
|
196
|
-
}
|
|
197
|
-
function isDelegatedEvent(eventName) {
|
|
198
|
-
return DELEGATED_EVENTS.includes(eventName);
|
|
199
|
-
}
|
|
200
|
-
//#endregion
|
|
201
|
-
export { addDelegatedListener, addFreshDelegatedListener, clearDelegatedHandlersForElement, getDelegatedHandlerForElement, getDelegatedHandlersForElement, isDelegatedEvent, isEventDelegationEnabled, removeDelegatedListener, updateDelegatedListener };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
//#region src/runtime/execution-model.d.ts
|
|
2
|
-
type ExecutionModel = 'spa' | 'islands' | 'ssr';
|
|
3
|
-
declare function getExecutionModel(): ExecutionModel | undefined;
|
|
4
|
-
declare function assertExecutionModel(model: ExecutionModel): void;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { ExecutionModel };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region src/runtime/execution-model.ts
|
|
2
|
-
const EXECUTION_MODEL_KEY = Symbol.for("__ASKR_EXECUTION_MODEL__");
|
|
3
|
-
function getExecutionModel() {
|
|
4
|
-
return globalThis[EXECUTION_MODEL_KEY];
|
|
5
|
-
}
|
|
6
|
-
function assertExecutionModel(model) {
|
|
7
|
-
const g = globalThis;
|
|
8
|
-
const cur = g[EXECUTION_MODEL_KEY];
|
|
9
|
-
if (cur && cur !== model) throw new Error(`[Askr] mixing execution models is not allowed (current: ${cur}, attempted: ${model}). Choose exactly one: createSPA, createSSR, or createIslands.`);
|
|
10
|
-
if (!cur) g[EXECUTION_MODEL_KEY] = model;
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { assertExecutionModel, getExecutionModel };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ComponentInstance } from "./component-internal.js";
|
|
2
|
-
//#region src/runtime/fastlane.d.ts
|
|
3
|
-
declare function enterBulkCommit(): void;
|
|
4
|
-
declare function exitBulkCommit(): void;
|
|
5
|
-
declare function isBulkCommitActive(): boolean;
|
|
6
|
-
declare function markFastPathApplied(parent: Element): void;
|
|
7
|
-
declare function isFastPathApplied(parent: Element): boolean;
|
|
8
|
-
declare function classifyUpdate(instance: ComponentInstance, result: unknown): {
|
|
9
|
-
useFastPath: boolean;
|
|
10
|
-
reason: string;
|
|
11
|
-
} | {
|
|
12
|
-
useFastPath: boolean;
|
|
13
|
-
reason: string;
|
|
14
|
-
totalKeyed: number;
|
|
15
|
-
totalChildren: number;
|
|
16
|
-
currentKeyCount: number;
|
|
17
|
-
moveCount: number;
|
|
18
|
-
lisLen: number;
|
|
19
|
-
hasPropChanges: boolean;
|
|
20
|
-
isWholeKeyedList: boolean;
|
|
21
|
-
} | {
|
|
22
|
-
readonly useFastPath: true;
|
|
23
|
-
readonly totalKeyed: number;
|
|
24
|
-
readonly totalChildren: number;
|
|
25
|
-
readonly currentKeyCount: number;
|
|
26
|
-
readonly moveCount: number;
|
|
27
|
-
readonly lisLen: number;
|
|
28
|
-
readonly hasPropChanges: boolean;
|
|
29
|
-
readonly isWholeKeyedList: boolean;
|
|
30
|
-
reason?: undefined;
|
|
31
|
-
};
|
|
32
|
-
declare function commitReorderOnly(instance: ComponentInstance, result: unknown): boolean;
|
|
33
|
-
declare function tryRuntimeFastLaneSync(instance: ComponentInstance, result: unknown): boolean;
|