@askrjs/askr 0.0.51 → 0.0.52
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/dist/bench/components/benchmark-row.d.ts +2 -2
- package/dist/bench/components/benchmark-row.js +0 -2
- package/dist/bench/components/benchmark-table.js +0 -2
- package/dist/benchmark.d.ts +1 -2
- package/dist/benchmark.js +2 -4
- package/dist/bin/askr-ssg.d.ts +1 -2
- package/dist/bin/askr-ssg.js +21 -6
- package/dist/boot/hydration.js +10 -11
- package/dist/boot/index.d.ts +1 -2
- package/dist/boot/index.js +20 -11
- package/dist/boot/root-lifecycle.d.ts +6 -3
- package/dist/boot/root-lifecycle.js +14 -10
- package/dist/boot/route-startup.js +13 -4
- package/dist/boot/types.d.ts +1 -2
- package/dist/common/attr-names.js +0 -2
- package/dist/common/component.d.ts +1 -2
- package/dist/common/control.d.ts +1 -2
- package/dist/common/control.js +0 -2
- package/dist/common/dom-range.d.ts +13 -0
- package/dist/common/env.js +1 -7
- package/dist/common/error-boundary.d.ts +1 -2
- package/dist/common/invariant.js +0 -2
- package/dist/common/jsx.d.ts +1 -2
- package/dist/common/jsx.js +0 -2
- package/dist/common/logger.js +0 -2
- package/dist/common/promise.js +0 -2
- package/dist/common/props.d.ts +1 -2
- package/dist/common/render-context.js +0 -2
- package/dist/common/route-activity.js +0 -2
- package/dist/common/router-internal.js +0 -2
- package/dist/common/router.d.ts +1 -2
- package/dist/common/ssr-errors.d.ts +1 -2
- package/dist/common/ssr-errors.js +0 -2
- package/dist/common/ssr.d.ts +1 -2
- package/dist/common/ssr.js +0 -2
- package/dist/common/vnode.d.ts +1 -2
- package/dist/common/vnode.js +0 -2
- package/dist/components/error-boundary.d.ts +1 -2
- package/dist/components/error-boundary.js +0 -2
- package/dist/components/link.d.ts +2 -2
- package/dist/components/link.js +0 -2
- package/dist/control/case.d.ts +1 -2
- package/dist/control/case.js +0 -2
- package/dist/control/for.d.ts +1 -2
- package/dist/control/for.js +0 -2
- package/dist/control/shared.d.ts +1 -2
- package/dist/control/shared.js +0 -2
- package/dist/control/show.d.ts +1 -2
- package/dist/control/show.js +0 -2
- package/dist/data/data-runtime.d.ts +1 -2
- package/dist/data/data-runtime.js +3 -5
- package/dist/data/invalidation-listeners.js +0 -2
- package/dist/data/invalidation.d.ts +1 -2
- package/dist/data/invalidation.js +0 -2
- package/dist/data/mutation-cell.d.ts +1 -2
- package/dist/data/mutation-cell.js +6 -5
- package/dist/data/query-cell.d.ts +3 -2
- package/dist/data/query-cell.js +43 -9
- package/dist/data/query-key.js +0 -2
- package/dist/data/shared.js +2 -3
- package/dist/data/types.d.ts +1 -2
- package/dist/foundations/icon/icon.d.ts +1 -2
- package/dist/foundations/icon/icon.js +0 -2
- package/dist/foundations/icon/icon.types.d.ts +1 -2
- package/dist/foundations/interactions/dismissable.d.ts +1 -2
- package/dist/foundations/interactions/dismissable.js +0 -2
- package/dist/foundations/interactions/focusable.d.ts +1 -2
- package/dist/foundations/interactions/focusable.js +0 -2
- package/dist/foundations/interactions/hoverable.d.ts +1 -2
- package/dist/foundations/interactions/hoverable.js +0 -2
- package/dist/foundations/interactions/interaction-policy.d.ts +1 -2
- package/dist/foundations/interactions/interaction-policy.js +0 -2
- package/dist/foundations/interactions/pressable.d.ts +1 -2
- package/dist/foundations/interactions/pressable.js +0 -2
- package/dist/foundations/interactions/roving-focus.d.ts +1 -2
- package/dist/foundations/interactions/roving-focus.js +0 -2
- package/dist/foundations/state/controllable.d.ts +1 -2
- package/dist/foundations/state/controllable.js +0 -2
- package/dist/foundations/structures/collection.d.ts +1 -2
- package/dist/foundations/structures/collection.js +0 -2
- package/dist/foundations/structures/layer.d.ts +1 -2
- package/dist/foundations/structures/layer.js +0 -2
- package/dist/foundations/structures/layout.d.ts +1 -2
- package/dist/foundations/structures/layout.js +0 -2
- package/dist/foundations/structures/presence.d.ts +1 -2
- package/dist/foundations/structures/presence.js +0 -2
- package/dist/foundations/structures/slot.d.ts +1 -2
- package/dist/foundations/structures/slot.js +0 -2
- package/dist/foundations/utilities/aria.d.ts +1 -2
- package/dist/foundations/utilities/aria.js +0 -2
- package/dist/foundations/utilities/compose-handlers.d.ts +1 -2
- package/dist/foundations/utilities/compose-handlers.js +0 -2
- package/dist/foundations/utilities/compose-ref.d.ts +1 -2
- package/dist/foundations/utilities/compose-ref.js +0 -2
- package/dist/foundations/utilities/event-types.d.ts +1 -2
- package/dist/foundations/utilities/merge-props.d.ts +1 -2
- package/dist/foundations/utilities/merge-props.js +0 -2
- package/dist/foundations/utilities/use-id.d.ts +1 -2
- package/dist/foundations/utilities/use-id.js +0 -2
- package/dist/fx/fx.d.ts +1 -2
- package/dist/fx/fx.js +0 -2
- package/dist/fx/noop.js +0 -2
- package/dist/fx/timing.d.ts +1 -2
- package/dist/fx/timing.js +0 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -2
- package/dist/jsx/types.d.ts +1 -2
- package/dist/jsx/utils.d.ts +1 -2
- package/dist/jsx/utils.js +0 -2
- package/dist/jsx-dev-runtime.d.ts +16 -2
- package/dist/jsx-dev-runtime.js +3 -12
- package/dist/jsx-runtime.d.ts +16 -2
- package/dist/jsx-runtime.js +15 -24
- package/dist/jsx-runtime2.d.ts +1 -1
- package/dist/renderer/attributes.js +28 -6
- package/dist/renderer/boundaries.js +48 -172
- package/dist/renderer/boundary-materialization.js +72 -0
- package/dist/renderer/boundary-range-adoption.js +76 -0
- package/dist/renderer/boundary-range-sync.js +101 -0
- package/dist/renderer/boundary-state.js +50 -0
- package/dist/renderer/child-shape.js +0 -2
- package/dist/renderer/children-fastpath.js +3 -3
- package/dist/renderer/children.js +0 -2
- package/dist/renderer/cleanup.js +70 -13
- package/dist/renderer/component-host-cleanup.js +123 -48
- package/dist/renderer/component-host-instances.js +59 -8
- package/dist/renderer/component-host-replacement.js +105 -0
- package/dist/renderer/component-host-results.js +138 -0
- package/dist/renderer/component-host.js +94 -169
- package/dist/renderer/dom-host.js +0 -2
- package/dist/renderer/dom-internal.js +110 -53
- package/dist/renderer/dom-range.js +161 -0
- package/dist/renderer/dom.js +5 -4
- package/dist/renderer/element-children.js +112 -32
- package/dist/renderer/error-boundary-dom.js +19 -11
- package/dist/renderer/evaluate-dom-range.js +3 -4
- package/dist/renderer/evaluate-reconcile.js +12 -37
- package/dist/renderer/evaluate.js +14 -3
- package/dist/renderer/fastpath.js +4 -12
- package/dist/renderer/for-commit-dom-map.js +6 -18
- package/dist/renderer/for-commit-removal.js +7 -16
- package/dist/renderer/for-commit-reorder.js +0 -2
- package/dist/renderer/for-commit.js +172 -44
- package/dist/renderer/hydration-boundaries.js +60 -0
- package/dist/renderer/hydration-listener-transaction.js +49 -0
- package/dist/renderer/index.js +8 -7
- package/dist/renderer/intrinsic-blueprint-analysis.js +202 -0
- package/dist/renderer/intrinsic-blueprint-bindings.js +152 -0
- package/dist/renderer/intrinsic-blueprint-materialization.js +100 -0
- package/dist/renderer/intrinsic-blueprint.js +30 -0
- package/dist/renderer/intrinsic-hydration-adoption.js +66 -0
- package/dist/renderer/keyed-children.js +3 -9
- package/dist/renderer/keyed.js +10 -10
- package/dist/renderer/namespaces.js +0 -2
- package/dist/renderer/prop-bindings.js +56 -21
- package/dist/renderer/reactive-child-dom.js +10 -4
- package/dist/renderer/reactive-child-sources.js +0 -2
- package/dist/renderer/reactive-children.js +29 -20
- package/dist/renderer/reconcile-commit.js +0 -2
- package/dist/renderer/reconcile-fastpaths.js +4 -11
- package/dist/renderer/reconcile-resolution.js +31 -55
- package/dist/renderer/reconcile.js +0 -2
- package/dist/renderer/retained-element-rollback.js +159 -148
- package/dist/renderer/stable-patch.js +3 -4
- package/dist/renderer/static-reuse.js +0 -2
- package/dist/renderer/utils.js +18 -9
- package/dist/router/access.js +0 -2
- package/dist/router/activity.d.ts +1 -2
- package/dist/router/activity.js +0 -2
- package/dist/router/authoring.d.ts +1 -2
- package/dist/router/authoring.js +0 -2
- package/dist/router/internal-types.d.ts +1 -2
- package/dist/router/lazy.d.ts +1 -2
- package/dist/router/lazy.js +0 -2
- package/dist/router/manifest.d.ts +1 -2
- package/dist/router/manifest.js +0 -2
- package/dist/router/match.js +0 -2
- package/dist/router/navigate.d.ts +1 -2
- package/dist/router/navigate.js +4 -7
- package/dist/router/navigation-registry.d.ts +1 -2
- package/dist/router/navigation-registry.js +0 -2
- package/dist/router/navigation-scroll.d.ts +1 -2
- package/dist/router/navigation-scroll.js +0 -2
- package/dist/router/navigation-targets.d.ts +3 -4
- package/dist/router/navigation-targets.js +419 -40
- package/dist/router/policy.d.ts +1 -2
- package/dist/router/policy.js +0 -2
- package/dist/router/rendering.d.ts +1 -2
- package/dist/router/rendering.js +4 -3
- package/dist/router/resolution.d.ts +1 -2
- package/dist/router/resolution.js +0 -2
- package/dist/router/route-context.js +0 -2
- package/dist/router/route-matching.d.ts +1 -2
- package/dist/router/route-matching.js +0 -2
- package/dist/router/route-query.d.ts +1 -2
- package/dist/router/route-query.js +1 -3
- package/dist/router/store.d.ts +1 -2
- package/dist/router/store.js +0 -2
- package/dist/runtime/access.d.ts +1 -2
- package/dist/runtime/access.js +0 -2
- package/dist/runtime/child-scope.d.ts +21 -2
- package/dist/runtime/child-scope.js +101 -54
- package/dist/runtime/component-cleanup.d.ts +1 -2
- package/dist/runtime/component-cleanup.js +2 -4
- package/dist/runtime/component-commit.js +25 -23
- package/dist/runtime/component-facade.js +5 -3
- package/dist/runtime/component-internal.d.ts +11 -6
- package/dist/runtime/component-internal.js +63 -45
- package/dist/runtime/component-lifecycle.d.ts +2 -41
- package/dist/runtime/component-lifecycle.js +6 -149
- package/dist/runtime/component-scope.d.ts +3 -4
- package/dist/runtime/component-scope.js +27 -8
- package/dist/runtime/component.js +4 -3
- package/dist/runtime/context.d.ts +5 -2
- package/dist/runtime/context.js +29 -3
- package/dist/runtime/control.d.ts +22 -3
- package/dist/runtime/control.js +168 -55
- package/dist/runtime/derive.d.ts +1 -2
- package/dist/runtime/derive.js +0 -2
- package/dist/runtime/dev-namespace.d.ts +5 -6
- package/dist/runtime/dev-namespace.js +32 -25
- package/dist/runtime/effect.d.ts +8 -5
- package/dist/runtime/effect.js +158 -75
- package/dist/runtime/error-boundary.d.ts +1 -2
- package/dist/runtime/error-boundary.js +0 -2
- package/dist/runtime/events.d.ts +3 -3
- package/dist/runtime/events.js +66 -69
- package/dist/runtime/execution-model.d.ts +1 -2
- package/dist/runtime/execution-model.js +0 -2
- package/dist/runtime/fastlane.d.ts +1 -2
- package/dist/runtime/fastlane.js +0 -2
- package/dist/runtime/for-bench.d.ts +1 -2
- package/dist/runtime/for-bench.js +9 -167
- package/dist/runtime/for-internal.d.ts +68 -5
- package/dist/runtime/for-internal.js +201 -14
- package/dist/runtime/for-reconcile.d.ts +1 -2
- package/dist/runtime/for-reconcile.js +76 -23
- package/dist/runtime/for-scopes.d.ts +5 -5
- package/dist/runtime/for-scopes.js +168 -48
- package/dist/runtime/for-signals.d.ts +13 -4
- package/dist/runtime/for-signals.js +155 -81
- package/dist/runtime/for-types.d.ts +1 -2
- package/dist/runtime/for.d.ts +2 -2
- package/dist/runtime/for.js +3 -3
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime/index.js +12 -10
- package/dist/runtime/lifecycle-batch.d.ts +59 -0
- package/dist/runtime/lifecycle-batch.js +178 -0
- package/dist/runtime/lifecycle-operation-settlement.d.ts +5 -0
- package/dist/runtime/lifecycle-operation-settlement.js +51 -0
- package/dist/runtime/lifecycle-operations.d.ts +1 -2
- package/dist/runtime/lifecycle-operations.js +5 -6
- package/dist/runtime/perf-metrics.d.ts +8 -7
- package/dist/runtime/perf-metrics.js +4 -68
- package/dist/runtime/portal.d.ts +1 -2
- package/dist/runtime/portal.js +103 -11
- package/dist/runtime/readable.d.ts +9 -4
- package/dist/runtime/readable.js +41 -17
- package/dist/runtime/resource-cell.js +2 -4
- package/dist/runtime/resource-operation.d.ts +1 -2
- package/dist/runtime/resource-operation.js +37 -34
- package/dist/runtime/runtime.d.ts +1 -2
- package/dist/runtime/runtime.js +0 -2
- package/dist/runtime/scheduler.d.ts +1 -2
- package/dist/runtime/scheduler.js +8 -11
- package/dist/runtime/selector-store.js +0 -2
- package/dist/runtime/selector.d.ts +1 -2
- package/dist/runtime/selector.js +3 -11
- package/dist/runtime/snapshot-source.d.ts +1 -2
- package/dist/runtime/snapshot-source.js +0 -2
- package/dist/runtime/state.d.ts +1 -2
- package/dist/runtime/state.js +1 -3
- package/dist/ssg/batch-render.js +0 -2
- package/dist/ssg/create-static-gen.d.ts +4 -2
- package/dist/ssg/create-static-gen.js +65 -14
- package/dist/ssg/generate-metadata.js +0 -2
- package/dist/ssg/generation-plan.js +0 -2
- package/dist/ssg/incremental-manifest.js +1 -3
- package/dist/ssg/resolve-ssg-data.js +0 -2
- package/dist/ssg/route-utils.js +0 -2
- package/dist/ssg/static-routes.js +0 -2
- package/dist/ssg/types.d.ts +2 -3
- package/dist/ssg/write-static-files.js +16 -12
- package/dist/ssr/attrs.js +0 -2
- package/dist/ssr/boundaries.js +16 -5
- package/dist/ssr/component-runtime.js +1 -27
- package/dist/ssr/context.d.ts +1 -2
- package/dist/ssr/context.js +0 -2
- package/dist/ssr/errors.d.ts +1 -2
- package/dist/ssr/errors.js +0 -2
- package/dist/ssr/escape.js +0 -2
- package/dist/ssr/hydration-data.js +0 -2
- package/dist/ssr/hydration-verify.d.ts +1 -2
- package/dist/ssr/hydration-verify.js +34 -7
- package/dist/ssr/index-internal.d.ts +1 -2
- package/dist/ssr/index-internal.js +0 -2
- package/dist/ssr/render-keys.js +0 -2
- package/dist/ssr/render-resolved.d.ts +1 -2
- package/dist/ssr/render-resolved.js +0 -2
- package/dist/ssr/render-sync.d.ts +1 -2
- package/dist/ssr/render-sync.js +27 -19
- package/dist/ssr/route-policy-resolution.js +0 -2
- package/dist/ssr/route-render.d.ts +1 -2
- package/dist/ssr/route-render.js +0 -2
- package/dist/ssr/sink.d.ts +1 -2
- package/dist/ssr/sink.js +0 -2
- package/dist/ssr/types.d.ts +1 -2
- package/dist/ssr/verify-hydration.js +0 -2
- package/dist/testing/index.d.ts +1 -2
- package/dist/testing/index.js +0 -2
- package/package.json +57 -44
- package/dist/bench/components/benchmark-row.d.ts.map +0 -1
- package/dist/bench/components/benchmark-row.js.map +0 -1
- package/dist/bench/components/benchmark-table.js.map +0 -1
- package/dist/benchmark.d.ts.map +0 -1
- package/dist/benchmark.js.map +0 -1
- package/dist/bin/askr-ssg.d.ts.map +0 -1
- package/dist/bin/askr-ssg.js.map +0 -1
- package/dist/boot/hydration.js.map +0 -1
- package/dist/boot/index.d.ts.map +0 -1
- package/dist/boot/index.js.map +0 -1
- package/dist/boot/root-lifecycle.d.ts.map +0 -1
- package/dist/boot/root-lifecycle.js.map +0 -1
- package/dist/boot/route-startup.js.map +0 -1
- package/dist/boot/types.d.ts.map +0 -1
- package/dist/common/attr-names.js.map +0 -1
- package/dist/common/component.d.ts.map +0 -1
- package/dist/common/control.d.ts.map +0 -1
- package/dist/common/control.js.map +0 -1
- package/dist/common/env.js.map +0 -1
- package/dist/common/error-boundary.d.ts.map +0 -1
- package/dist/common/invariant.js.map +0 -1
- package/dist/common/jsx.d.ts.map +0 -1
- package/dist/common/jsx.js.map +0 -1
- package/dist/common/logger.js.map +0 -1
- package/dist/common/promise.js.map +0 -1
- package/dist/common/props.d.ts.map +0 -1
- package/dist/common/render-context.js.map +0 -1
- package/dist/common/route-activity.js.map +0 -1
- package/dist/common/router-internal.js.map +0 -1
- package/dist/common/router.d.ts.map +0 -1
- package/dist/common/ssr-errors.d.ts.map +0 -1
- package/dist/common/ssr-errors.js.map +0 -1
- package/dist/common/ssr.d.ts.map +0 -1
- package/dist/common/ssr.js.map +0 -1
- package/dist/common/vnode.d.ts.map +0 -1
- package/dist/common/vnode.js.map +0 -1
- package/dist/components/error-boundary.d.ts.map +0 -1
- package/dist/components/error-boundary.js.map +0 -1
- package/dist/components/link.d.ts.map +0 -1
- package/dist/components/link.js.map +0 -1
- package/dist/control/case.d.ts.map +0 -1
- package/dist/control/case.js.map +0 -1
- package/dist/control/for.d.ts.map +0 -1
- package/dist/control/for.js.map +0 -1
- package/dist/control/shared.d.ts.map +0 -1
- package/dist/control/shared.js.map +0 -1
- package/dist/control/show.d.ts.map +0 -1
- package/dist/control/show.js.map +0 -1
- package/dist/data/data-runtime.d.ts.map +0 -1
- package/dist/data/data-runtime.js.map +0 -1
- package/dist/data/invalidation-listeners.js.map +0 -1
- package/dist/data/invalidation.d.ts.map +0 -1
- package/dist/data/invalidation.js.map +0 -1
- package/dist/data/mutation-cell.d.ts.map +0 -1
- package/dist/data/mutation-cell.js.map +0 -1
- package/dist/data/query-cell.d.ts.map +0 -1
- package/dist/data/query-cell.js.map +0 -1
- package/dist/data/query-key.js.map +0 -1
- package/dist/data/shared.js.map +0 -1
- package/dist/data/types.d.ts.map +0 -1
- package/dist/foundations/icon/icon.d.ts.map +0 -1
- package/dist/foundations/icon/icon.js.map +0 -1
- package/dist/foundations/icon/icon.types.d.ts.map +0 -1
- package/dist/foundations/interactions/dismissable.d.ts.map +0 -1
- package/dist/foundations/interactions/dismissable.js.map +0 -1
- package/dist/foundations/interactions/focusable.d.ts.map +0 -1
- package/dist/foundations/interactions/focusable.js.map +0 -1
- package/dist/foundations/interactions/hoverable.d.ts.map +0 -1
- package/dist/foundations/interactions/hoverable.js.map +0 -1
- package/dist/foundations/interactions/interaction-policy.d.ts.map +0 -1
- package/dist/foundations/interactions/interaction-policy.js.map +0 -1
- package/dist/foundations/interactions/pressable.d.ts.map +0 -1
- package/dist/foundations/interactions/pressable.js.map +0 -1
- package/dist/foundations/interactions/roving-focus.d.ts.map +0 -1
- package/dist/foundations/interactions/roving-focus.js.map +0 -1
- package/dist/foundations/state/controllable.d.ts.map +0 -1
- package/dist/foundations/state/controllable.js.map +0 -1
- package/dist/foundations/structures/collection.d.ts.map +0 -1
- package/dist/foundations/structures/collection.js.map +0 -1
- package/dist/foundations/structures/layer.d.ts.map +0 -1
- package/dist/foundations/structures/layer.js.map +0 -1
- package/dist/foundations/structures/layout.d.ts.map +0 -1
- package/dist/foundations/structures/layout.js.map +0 -1
- package/dist/foundations/structures/presence.d.ts.map +0 -1
- package/dist/foundations/structures/presence.js.map +0 -1
- package/dist/foundations/structures/slot.d.ts.map +0 -1
- package/dist/foundations/structures/slot.js.map +0 -1
- package/dist/foundations/utilities/aria.d.ts.map +0 -1
- package/dist/foundations/utilities/aria.js.map +0 -1
- package/dist/foundations/utilities/compose-handlers.d.ts.map +0 -1
- package/dist/foundations/utilities/compose-handlers.js.map +0 -1
- package/dist/foundations/utilities/compose-ref.d.ts.map +0 -1
- package/dist/foundations/utilities/compose-ref.js.map +0 -1
- package/dist/foundations/utilities/event-types.d.ts.map +0 -1
- package/dist/foundations/utilities/merge-props.d.ts.map +0 -1
- package/dist/foundations/utilities/merge-props.js.map +0 -1
- package/dist/foundations/utilities/use-id.d.ts.map +0 -1
- package/dist/foundations/utilities/use-id.js.map +0 -1
- package/dist/fx/fx.d.ts.map +0 -1
- package/dist/fx/fx.js.map +0 -1
- package/dist/fx/noop.js.map +0 -1
- package/dist/fx/timing.d.ts.map +0 -1
- package/dist/fx/timing.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/jsx/types.d.ts.map +0 -1
- package/dist/jsx/utils.d.ts.map +0 -1
- package/dist/jsx/utils.js.map +0 -1
- package/dist/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/jsx-dev-runtime.js.map +0 -1
- package/dist/jsx-runtime.d.ts.map +0 -1
- package/dist/jsx-runtime.js.map +0 -1
- package/dist/renderer/attributes.js.map +0 -1
- package/dist/renderer/boundaries.js.map +0 -1
- package/dist/renderer/child-shape.js.map +0 -1
- package/dist/renderer/children-fastpath.js.map +0 -1
- package/dist/renderer/children.js.map +0 -1
- package/dist/renderer/cleanup.js.map +0 -1
- package/dist/renderer/component-host-cleanup.js.map +0 -1
- package/dist/renderer/component-host-instances.js.map +0 -1
- package/dist/renderer/component-host.js.map +0 -1
- package/dist/renderer/dom-host.js.map +0 -1
- package/dist/renderer/dom-internal.js.map +0 -1
- package/dist/renderer/element-children.js.map +0 -1
- package/dist/renderer/error-boundary-dom.js.map +0 -1
- package/dist/renderer/evaluate-dom-range.js.map +0 -1
- package/dist/renderer/evaluate-reconcile.js.map +0 -1
- package/dist/renderer/evaluate.js.map +0 -1
- package/dist/renderer/fastpath.js.map +0 -1
- package/dist/renderer/for-commit-dom-map.js.map +0 -1
- package/dist/renderer/for-commit-removal.js.map +0 -1
- package/dist/renderer/for-commit-reorder.js.map +0 -1
- package/dist/renderer/for-commit.js.map +0 -1
- package/dist/renderer/index.js.map +0 -1
- package/dist/renderer/keyed-children.js.map +0 -1
- package/dist/renderer/keyed.js.map +0 -1
- package/dist/renderer/namespaces.js.map +0 -1
- package/dist/renderer/prop-bindings.js.map +0 -1
- package/dist/renderer/reactive-child-dom.js.map +0 -1
- package/dist/renderer/reactive-child-sources.js.map +0 -1
- package/dist/renderer/reactive-children.js.map +0 -1
- package/dist/renderer/reconcile-commit.js.map +0 -1
- package/dist/renderer/reconcile-fastpaths.js.map +0 -1
- package/dist/renderer/reconcile-resolution.js.map +0 -1
- package/dist/renderer/reconcile.js.map +0 -1
- package/dist/renderer/retained-element-rollback.js.map +0 -1
- package/dist/renderer/stable-patch.js.map +0 -1
- package/dist/renderer/static-reuse.js.map +0 -1
- package/dist/renderer/utils.js.map +0 -1
- package/dist/router/access.js.map +0 -1
- package/dist/router/activity.d.ts.map +0 -1
- package/dist/router/activity.js.map +0 -1
- package/dist/router/authoring.d.ts.map +0 -1
- package/dist/router/authoring.js.map +0 -1
- package/dist/router/internal-types.d.ts.map +0 -1
- package/dist/router/lazy.d.ts.map +0 -1
- package/dist/router/lazy.js.map +0 -1
- package/dist/router/manifest.d.ts.map +0 -1
- package/dist/router/manifest.js.map +0 -1
- package/dist/router/match.js.map +0 -1
- package/dist/router/navigate.d.ts.map +0 -1
- package/dist/router/navigate.js.map +0 -1
- package/dist/router/navigation-registry.d.ts.map +0 -1
- package/dist/router/navigation-registry.js.map +0 -1
- package/dist/router/navigation-scroll.d.ts.map +0 -1
- package/dist/router/navigation-scroll.js.map +0 -1
- package/dist/router/navigation-targets.d.ts.map +0 -1
- package/dist/router/navigation-targets.js.map +0 -1
- package/dist/router/policy.d.ts.map +0 -1
- package/dist/router/policy.js.map +0 -1
- package/dist/router/rendering.d.ts.map +0 -1
- package/dist/router/rendering.js.map +0 -1
- package/dist/router/resolution.d.ts.map +0 -1
- package/dist/router/resolution.js.map +0 -1
- package/dist/router/route-context.js.map +0 -1
- package/dist/router/route-matching.d.ts.map +0 -1
- package/dist/router/route-matching.js.map +0 -1
- package/dist/router/route-query.d.ts.map +0 -1
- package/dist/router/route-query.js.map +0 -1
- package/dist/router/store.d.ts.map +0 -1
- package/dist/router/store.js.map +0 -1
- package/dist/runtime/access.d.ts.map +0 -1
- package/dist/runtime/access.js.map +0 -1
- package/dist/runtime/child-scope.d.ts.map +0 -1
- package/dist/runtime/child-scope.js.map +0 -1
- package/dist/runtime/component-cleanup.d.ts.map +0 -1
- package/dist/runtime/component-cleanup.js.map +0 -1
- package/dist/runtime/component-commit.js.map +0 -1
- package/dist/runtime/component-internal.d.ts.map +0 -1
- package/dist/runtime/component-internal.js.map +0 -1
- package/dist/runtime/component-lifecycle.d.ts.map +0 -1
- package/dist/runtime/component-lifecycle.js.map +0 -1
- package/dist/runtime/component-scope.d.ts.map +0 -1
- package/dist/runtime/component-scope.js.map +0 -1
- package/dist/runtime/context.d.ts.map +0 -1
- package/dist/runtime/context.js.map +0 -1
- package/dist/runtime/control.d.ts.map +0 -1
- package/dist/runtime/control.js.map +0 -1
- package/dist/runtime/derive.d.ts.map +0 -1
- package/dist/runtime/derive.js.map +0 -1
- package/dist/runtime/dev-namespace.d.ts.map +0 -1
- package/dist/runtime/dev-namespace.js.map +0 -1
- package/dist/runtime/effect.d.ts.map +0 -1
- package/dist/runtime/effect.js.map +0 -1
- package/dist/runtime/error-boundary.d.ts.map +0 -1
- package/dist/runtime/error-boundary.js.map +0 -1
- package/dist/runtime/events.d.ts.map +0 -1
- package/dist/runtime/events.js.map +0 -1
- package/dist/runtime/execution-model.d.ts.map +0 -1
- package/dist/runtime/execution-model.js.map +0 -1
- package/dist/runtime/fastlane.d.ts.map +0 -1
- package/dist/runtime/fastlane.js.map +0 -1
- package/dist/runtime/for-bench.d.ts.map +0 -1
- package/dist/runtime/for-bench.js.map +0 -1
- package/dist/runtime/for-internal.d.ts.map +0 -1
- package/dist/runtime/for-internal.js.map +0 -1
- package/dist/runtime/for-reconcile.d.ts.map +0 -1
- package/dist/runtime/for-reconcile.js.map +0 -1
- package/dist/runtime/for-scopes.d.ts.map +0 -1
- package/dist/runtime/for-scopes.js.map +0 -1
- package/dist/runtime/for-signals.d.ts.map +0 -1
- package/dist/runtime/for-signals.js.map +0 -1
- package/dist/runtime/for-types.d.ts.map +0 -1
- package/dist/runtime/lifecycle-operations.d.ts.map +0 -1
- package/dist/runtime/lifecycle-operations.js.map +0 -1
- package/dist/runtime/perf-metrics.d.ts.map +0 -1
- package/dist/runtime/perf-metrics.js.map +0 -1
- package/dist/runtime/portal.d.ts.map +0 -1
- package/dist/runtime/portal.js.map +0 -1
- package/dist/runtime/readable.d.ts.map +0 -1
- package/dist/runtime/readable.js.map +0 -1
- package/dist/runtime/resource-cell.js.map +0 -1
- package/dist/runtime/resource-operation.d.ts.map +0 -1
- package/dist/runtime/resource-operation.js.map +0 -1
- package/dist/runtime/runtime.d.ts.map +0 -1
- package/dist/runtime/runtime.js.map +0 -1
- package/dist/runtime/scheduler.d.ts.map +0 -1
- package/dist/runtime/scheduler.js.map +0 -1
- package/dist/runtime/selector-store.js.map +0 -1
- package/dist/runtime/selector.d.ts.map +0 -1
- package/dist/runtime/selector.js.map +0 -1
- package/dist/runtime/snapshot-source.d.ts.map +0 -1
- package/dist/runtime/snapshot-source.js.map +0 -1
- package/dist/runtime/state.d.ts.map +0 -1
- package/dist/runtime/state.js.map +0 -1
- package/dist/ssg/batch-render.js.map +0 -1
- package/dist/ssg/create-static-gen.d.ts.map +0 -1
- package/dist/ssg/create-static-gen.js.map +0 -1
- package/dist/ssg/generate-metadata.js.map +0 -1
- package/dist/ssg/generation-plan.js.map +0 -1
- package/dist/ssg/incremental-manifest.js.map +0 -1
- package/dist/ssg/resolve-ssg-data.js.map +0 -1
- package/dist/ssg/route-utils.js.map +0 -1
- package/dist/ssg/static-routes.js.map +0 -1
- package/dist/ssg/types.d.ts.map +0 -1
- package/dist/ssg/write-static-files.js.map +0 -1
- package/dist/ssr/attrs.js.map +0 -1
- package/dist/ssr/boundaries.js.map +0 -1
- package/dist/ssr/component-runtime.js.map +0 -1
- package/dist/ssr/context.d.ts.map +0 -1
- package/dist/ssr/context.js.map +0 -1
- package/dist/ssr/errors.d.ts.map +0 -1
- package/dist/ssr/errors.js.map +0 -1
- package/dist/ssr/escape.js.map +0 -1
- package/dist/ssr/hydration-data.js.map +0 -1
- package/dist/ssr/hydration-verify.d.ts.map +0 -1
- package/dist/ssr/hydration-verify.js.map +0 -1
- package/dist/ssr/index-internal.d.ts.map +0 -1
- package/dist/ssr/index-internal.js.map +0 -1
- package/dist/ssr/render-keys.js.map +0 -1
- package/dist/ssr/render-resolved.d.ts.map +0 -1
- package/dist/ssr/render-resolved.js.map +0 -1
- package/dist/ssr/render-sync.d.ts.map +0 -1
- package/dist/ssr/render-sync.js.map +0 -1
- package/dist/ssr/route-policy-resolution.js.map +0 -1
- package/dist/ssr/route-render.d.ts.map +0 -1
- package/dist/ssr/route-render.js.map +0 -1
- package/dist/ssr/sink.d.ts.map +0 -1
- package/dist/ssr/sink.js.map +0 -1
- package/dist/ssr/types.d.ts.map +0 -1
- package/dist/ssr/verify-hydration.js.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js.map +0 -1
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
import { markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, notifyReadableReaders, recordReadableRead } from "./readable.js";
|
|
1
|
+
import { markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, notifyReadableReaders, recordReadableRead, shouldCoalesceFineGrainedItemReads } from "./readable.js";
|
|
2
2
|
//#region src/runtime/for-signals.ts
|
|
3
|
-
function
|
|
3
|
+
function peekForSignal() {
|
|
4
|
+
return this._value;
|
|
5
|
+
}
|
|
6
|
+
function setForValueSignal(newValue, notifyReaders = true) {
|
|
7
|
+
if (Object.is(this._value, newValue)) return;
|
|
8
|
+
this._value = newValue;
|
|
9
|
+
if (notifyReaders) notifyForSignalReaders(this);
|
|
10
|
+
}
|
|
11
|
+
function setForIndexValue(newValue, notifyReaders = true) {
|
|
12
|
+
const nextValue = typeof newValue === "function" ? newValue(this._value) : newValue;
|
|
13
|
+
if (nextValue === this._value) return;
|
|
14
|
+
this._value = nextValue;
|
|
15
|
+
if (notifyReaders) notifyForSignalReaders(this);
|
|
16
|
+
}
|
|
17
|
+
function notifyForSignalReaders(source, skipInstance, skipOwnedBy) {
|
|
4
18
|
markReadableDerivedSubscribersDirty(source);
|
|
5
19
|
markReactivePropsDirtySource(source);
|
|
6
|
-
notifyReadableReaders(source, skipInstance);
|
|
20
|
+
notifyReadableReaders(source, skipInstance, skipOwnedBy);
|
|
7
21
|
}
|
|
8
22
|
function createForIndexSignal(initialIndex) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
indexSignal.
|
|
17
|
-
indexSignal.peek =
|
|
18
|
-
indexSignal.set =
|
|
19
|
-
const nextValue = typeof newValue === "function" ? newValue(indexValue) : newValue;
|
|
20
|
-
if (nextValue !== indexValue) {
|
|
21
|
-
indexValue = nextValue;
|
|
22
|
-
if (notifyReaders) notifyForSignalReaders(indexSignal);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
23
|
+
function readIndexSignal() {
|
|
24
|
+
const signal = readIndexSignal;
|
|
25
|
+
signal._hasBeenRead = true;
|
|
26
|
+
recordReadableRead(signal);
|
|
27
|
+
return signal._value;
|
|
28
|
+
}
|
|
29
|
+
const indexSignal = readIndexSignal;
|
|
30
|
+
indexSignal._value = initialIndex;
|
|
31
|
+
indexSignal.peek = peekForSignal;
|
|
32
|
+
indexSignal.set = setForIndexValue;
|
|
25
33
|
indexSignal._hasBeenRead = false;
|
|
26
34
|
return indexSignal;
|
|
27
35
|
}
|
|
@@ -31,38 +39,30 @@ function syncForIndexSignal(indexSignal, nextIndex) {
|
|
|
31
39
|
return indexSignal._hasBeenRead === true;
|
|
32
40
|
}
|
|
33
41
|
function createForItemSignal(initialItem) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
itemSignal.
|
|
42
|
-
itemSignal.peek =
|
|
43
|
-
itemSignal.set =
|
|
44
|
-
if (Object.is(itemValue, newValue)) return;
|
|
45
|
-
itemValue = newValue;
|
|
46
|
-
if (notifyReaders) notifyForSignalReaders(itemSignal);
|
|
47
|
-
};
|
|
42
|
+
function readItemSignal() {
|
|
43
|
+
const signal = readItemSignal;
|
|
44
|
+
signal._hasBeenRead = true;
|
|
45
|
+
recordReadableRead(signal);
|
|
46
|
+
return signal._value;
|
|
47
|
+
}
|
|
48
|
+
const itemSignal = readItemSignal;
|
|
49
|
+
itemSignal._value = initialItem;
|
|
50
|
+
itemSignal.peek = peekForSignal;
|
|
51
|
+
itemSignal.set = setForValueSignal;
|
|
48
52
|
itemSignal._hasBeenRead = false;
|
|
49
53
|
return itemSignal;
|
|
50
54
|
}
|
|
51
55
|
function createForItemPropertySignal(initialValue) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
propertySignal.
|
|
60
|
-
propertySignal.peek =
|
|
61
|
-
propertySignal.set =
|
|
62
|
-
if (Object.is(propertyValue, newValue)) return;
|
|
63
|
-
propertyValue = newValue;
|
|
64
|
-
if (notifyReaders) notifyForSignalReaders(propertySignal);
|
|
65
|
-
};
|
|
56
|
+
function readPropertySignal() {
|
|
57
|
+
const signal = readPropertySignal;
|
|
58
|
+
signal._hasBeenRead = true;
|
|
59
|
+
recordReadableRead(signal);
|
|
60
|
+
return signal._value;
|
|
61
|
+
}
|
|
62
|
+
const propertySignal = readPropertySignal;
|
|
63
|
+
propertySignal._value = initialValue;
|
|
64
|
+
propertySignal.peek = peekForSignal;
|
|
65
|
+
propertySignal.set = setForValueSignal;
|
|
66
66
|
propertySignal._hasBeenRead = false;
|
|
67
67
|
return propertySignal;
|
|
68
68
|
}
|
|
@@ -77,6 +77,18 @@ function haveSameOwnKeys(previousItem, nextItem) {
|
|
|
77
77
|
return true;
|
|
78
78
|
}
|
|
79
79
|
function scopeReadsSource(scope, source) {
|
|
80
|
+
const readers = source._readers;
|
|
81
|
+
if (!readers || readers.size === 0) return false;
|
|
82
|
+
for (const reader of readers.keys()) {
|
|
83
|
+
let current = reader;
|
|
84
|
+
while (current) {
|
|
85
|
+
if (current === scope.componentInstance) return true;
|
|
86
|
+
current = current.parentInstance;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
function scopeDirectlyReadsSource(scope, source) {
|
|
80
92
|
return source._readers?.has(scope.componentInstance) ?? false;
|
|
81
93
|
}
|
|
82
94
|
function isForParentReader(parentInstance, reader) {
|
|
@@ -92,7 +104,9 @@ function removeForParentReaders(parentInstance, source) {
|
|
|
92
104
|
if (!readers || readers.size === 0) return;
|
|
93
105
|
for (const reader of readers.keys()) if (isForParentReader(parentInstance, reader)) readers.delete(reader);
|
|
94
106
|
}
|
|
95
|
-
function getOrCreateForItemPropertySignal(
|
|
107
|
+
function getOrCreateForItemPropertySignal(state, prop) {
|
|
108
|
+
const item = state.currentItem;
|
|
109
|
+
const propertySignals = state.propertySignals ?? (state.propertySignals = /* @__PURE__ */ new Map());
|
|
96
110
|
const existingSignal = propertySignals.get(prop);
|
|
97
111
|
if (existingSignal) return existingSignal;
|
|
98
112
|
const propertySignal = createForItemPropertySignal(readForItemProperty(item, prop));
|
|
@@ -102,38 +116,98 @@ function getOrCreateForItemPropertySignal(item, propertySignals, prop) {
|
|
|
102
116
|
function canProxyForItem(item) {
|
|
103
117
|
return typeof item === "function" || typeof item === "object" && item !== null && !Array.isArray(item);
|
|
104
118
|
}
|
|
105
|
-
function createReactiveForItem(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
recordReadableRead(itemSignal);
|
|
120
|
-
const keys = new Set(Reflect.ownKeys(target));
|
|
121
|
-
for (const key of Reflect.ownKeys(Object(itemSignal.peek()))) keys.add(key);
|
|
122
|
-
return Array.from(keys);
|
|
123
|
-
},
|
|
124
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
125
|
-
recordReadableRead(itemSignal);
|
|
126
|
-
const ownDescriptor = Reflect.getOwnPropertyDescriptor(target, prop);
|
|
127
|
-
if (ownDescriptor) return ownDescriptor;
|
|
128
|
-
return Object.getOwnPropertyDescriptor(Object(itemSignal.peek()), prop);
|
|
129
|
-
},
|
|
130
|
-
getPrototypeOf() {
|
|
131
|
-
recordReadableRead(itemSignal);
|
|
132
|
-
return Object.getPrototypeOf(Object(itemSignal.peek()));
|
|
133
|
-
}
|
|
134
|
-
});
|
|
119
|
+
function createReactiveForItem(item) {
|
|
120
|
+
const target = Object.create(null);
|
|
121
|
+
const state = {
|
|
122
|
+
currentItem: item,
|
|
123
|
+
itemSignal: null,
|
|
124
|
+
propertySignals: null,
|
|
125
|
+
coalescedProperties: null,
|
|
126
|
+
coalescedProperty2: null,
|
|
127
|
+
wholeItemRead: false,
|
|
128
|
+
proxy: void 0
|
|
129
|
+
};
|
|
130
|
+
target[REACTIVE_FOR_ITEM_STATE] = state;
|
|
131
|
+
state.proxy = new Proxy(target, REACTIVE_FOR_ITEM_PROXY_HANDLER);
|
|
132
|
+
return state;
|
|
135
133
|
}
|
|
134
|
+
const REACTIVE_FOR_ITEM_STATE = Symbol("askr.reactive-for-item-state");
|
|
135
|
+
function getReactiveForItemState(target) {
|
|
136
|
+
return target[REACTIVE_FOR_ITEM_STATE];
|
|
137
|
+
}
|
|
138
|
+
function getWholeItemSignal(state) {
|
|
139
|
+
let signal = state.itemSignal;
|
|
140
|
+
if (!signal) {
|
|
141
|
+
signal = createForItemSignal(state.currentItem);
|
|
142
|
+
state.itemSignal = signal;
|
|
143
|
+
}
|
|
144
|
+
return signal;
|
|
145
|
+
}
|
|
146
|
+
const REACTIVE_FOR_ITEM_PROXY_HANDLER = {
|
|
147
|
+
get(target, prop, receiver) {
|
|
148
|
+
if (prop !== REACTIVE_FOR_ITEM_STATE && prop in target) return Reflect.get(target, prop, receiver);
|
|
149
|
+
const metadata = getReactiveForItemState(target);
|
|
150
|
+
const currentItem = metadata.currentItem;
|
|
151
|
+
if (typeof prop !== "symbol") {
|
|
152
|
+
if (shouldCoalesceFineGrainedItemReads()) {
|
|
153
|
+
const properties = metadata.coalescedProperties;
|
|
154
|
+
if (properties === null) metadata.coalescedProperties = prop;
|
|
155
|
+
else if (Array.isArray(properties)) {
|
|
156
|
+
if (!properties.includes(prop)) properties.push(prop);
|
|
157
|
+
} else if (properties !== prop && metadata.coalescedProperty2 !== prop) if (metadata.coalescedProperty2 === null) metadata.coalescedProperty2 = prop;
|
|
158
|
+
else {
|
|
159
|
+
metadata.coalescedProperties = [
|
|
160
|
+
properties,
|
|
161
|
+
metadata.coalescedProperty2,
|
|
162
|
+
prop
|
|
163
|
+
];
|
|
164
|
+
metadata.coalescedProperty2 = null;
|
|
165
|
+
}
|
|
166
|
+
let itemSignal = metadata.itemSignal;
|
|
167
|
+
if (!itemSignal) {
|
|
168
|
+
itemSignal = createForItemSignal(currentItem);
|
|
169
|
+
metadata.itemSignal = itemSignal;
|
|
170
|
+
}
|
|
171
|
+
itemSignal();
|
|
172
|
+
return readForItemProperty(currentItem, prop);
|
|
173
|
+
}
|
|
174
|
+
return getOrCreateForItemPropertySignal(metadata, prop)();
|
|
175
|
+
}
|
|
176
|
+
metadata.wholeItemRead = true;
|
|
177
|
+
recordReadableRead(getWholeItemSignal(metadata));
|
|
178
|
+
return Reflect.get(Object(currentItem), prop, receiver);
|
|
179
|
+
},
|
|
180
|
+
has(target, prop) {
|
|
181
|
+
if (prop === REACTIVE_FOR_ITEM_STATE) return false;
|
|
182
|
+
const metadata = getReactiveForItemState(target);
|
|
183
|
+
metadata.wholeItemRead = true;
|
|
184
|
+
recordReadableRead(getWholeItemSignal(metadata));
|
|
185
|
+
return prop in target || prop in Object(metadata.currentItem);
|
|
186
|
+
},
|
|
187
|
+
ownKeys(target) {
|
|
188
|
+
const metadata = getReactiveForItemState(target);
|
|
189
|
+
metadata.wholeItemRead = true;
|
|
190
|
+
recordReadableRead(getWholeItemSignal(metadata));
|
|
191
|
+
const keys = /* @__PURE__ */ new Set();
|
|
192
|
+
for (const key of Reflect.ownKeys(target)) if (key !== REACTIVE_FOR_ITEM_STATE) keys.add(key);
|
|
193
|
+
for (const key of Reflect.ownKeys(Object(metadata.currentItem))) keys.add(key);
|
|
194
|
+
return Array.from(keys);
|
|
195
|
+
},
|
|
196
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
197
|
+
if (prop === REACTIVE_FOR_ITEM_STATE) return;
|
|
198
|
+
const metadata = getReactiveForItemState(target);
|
|
199
|
+
metadata.wholeItemRead = true;
|
|
200
|
+
recordReadableRead(getWholeItemSignal(metadata));
|
|
201
|
+
const ownDescriptor = Reflect.getOwnPropertyDescriptor(target, prop);
|
|
202
|
+
if (ownDescriptor) return ownDescriptor;
|
|
203
|
+
return Object.getOwnPropertyDescriptor(Object(metadata.currentItem), prop);
|
|
204
|
+
},
|
|
205
|
+
getPrototypeOf(target) {
|
|
206
|
+
const metadata = getReactiveForItemState(target);
|
|
207
|
+
metadata.wholeItemRead = true;
|
|
208
|
+
recordReadableRead(getWholeItemSignal(metadata));
|
|
209
|
+
return Object.getPrototypeOf(Object(metadata.currentItem));
|
|
210
|
+
}
|
|
211
|
+
};
|
|
136
212
|
//#endregion
|
|
137
|
-
export { canProxyForItem, createForIndexSignal, createForItemSignal, createReactiveForItem, haveSameOwnKeys, notifyForSignalReaders, readForItemProperty, removeForParentReaders, scopeReadsSource, syncForIndexSignal };
|
|
138
|
-
|
|
139
|
-
//# sourceMappingURL=for-signals.js.map
|
|
213
|
+
export { canProxyForItem, createForIndexSignal, createForItemSignal, createReactiveForItem, haveSameOwnKeys, notifyForSignalReaders, readForItemProperty, removeForParentReaders, scopeDirectlyReadsSource, scopeReadsSource, syncForIndexSignal };
|
|
@@ -5,5 +5,4 @@ type ForEachSource<T> = T[] | (() => T[]);
|
|
|
5
5
|
type ForKeySelector<T> = (item: T, index: number) => string | number;
|
|
6
6
|
type ForRenderItem<T> = (item: T, index: () => number) => VNode;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { ForEachSource, ForKeySelector, ForRenderItem };
|
|
9
|
-
//# sourceMappingURL=for-types.d.ts.map
|
|
8
|
+
export { ForEachSource, ForKeySelector, ForRenderItem };
|
package/dist/runtime/for.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ForItemInstance } from "./for-scopes.js";
|
|
2
2
|
import { reconcileForItems } from "./for-reconcile.js";
|
|
3
|
-
import { ForCommitStrategy, ForState } from "./for-internal.js";
|
|
4
|
-
export { ForCommitStrategy, ForState, reconcileForItems };
|
|
3
|
+
import { ForCommitStrategy, ForItemTransactionSnapshot, ForState, ForTransaction } from "./for-internal.js";
|
|
4
|
+
export { ForCommitStrategy, ForItemTransactionSnapshot, ForState, ForTransaction, reconcileForItems };
|
package/dist/runtime/for.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isBenchMetricScopeActive, recordBenchCounter, recordBenchEvent, recordBenchTiming, withBenchMetricScope } from "./for-bench.js";
|
|
2
|
-
import "./for-scopes.js";
|
|
2
|
+
import { captureForFallbackTransactionSnapshot, captureForItemTransactionSnapshot } from "./for-scopes.js";
|
|
3
3
|
import { reconcileForItems } from "./for-reconcile.js";
|
|
4
|
-
import { clearForDomUpdateState, createForState, evaluateForState, useForState } from "./for-internal.js";
|
|
5
|
-
export { clearForDomUpdateState, createForState, evaluateForState, isBenchMetricScopeActive, reconcileForItems, recordBenchCounter, recordBenchEvent, recordBenchTiming, useForState, withBenchMetricScope };
|
|
4
|
+
import { beginForStateTransaction, clearForDomUpdateState, commitForStateTransaction, createForState, evaluateForState, registerForStateTransaction, rollbackForStateTransaction, useForState } from "./for-internal.js";
|
|
5
|
+
export { beginForStateTransaction, captureForFallbackTransactionSnapshot, captureForItemTransactionSnapshot, clearForDomUpdateState, commitForStateTransaction, createForState, evaluateForState, isBenchMetricScopeActive, reconcileForItems, recordBenchCounter, recordBenchEvent, recordBenchTiming, registerForStateTransaction, rollbackForStateTransaction, useForState, withBenchMetricScope };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -3,16 +3,16 @@ import { Context, ContextFrame, ContextKey, defineContext, readContext } from ".
|
|
|
3
3
|
import { cleanupComponent, registerOwnedChildScope, unregisterOwnedChildScope } from "./component-cleanup.js";
|
|
4
4
|
import { ComponentInstance } from "./component-internal.js";
|
|
5
5
|
import { getSignal } from "./component-scope.js";
|
|
6
|
-
import { DerivedSubscriber, ReadableSource } from "./readable.js";
|
|
6
|
+
import { DerivedSubscriber, FineGrainedReadCollector, ReadableSource } from "./readable.js";
|
|
7
7
|
import { Scheduler, SchedulerLane, scheduleEventHandler } from "./scheduler.js";
|
|
8
8
|
import { AskrRuntime, AskrRuntimeOptions, RuntimeKeyedReorderDecision, RuntimeRendererHost, createRuntime, getDefaultRuntime } from "./runtime.js";
|
|
9
|
-
import { ChildScope } from "./child-scope.js";
|
|
9
|
+
import { ChildScope, ChildScopeTransactionSnapshot } from "./child-scope.js";
|
|
10
10
|
import { ForItemInstance } from "./for-scopes.js";
|
|
11
11
|
import { CreateFineGrainedEffectOptions, FineGrainedEffectHandle } from "./effect.js";
|
|
12
12
|
import { ForEachSource, ForKeySelector, ForRenderItem } from "./for-types.js";
|
|
13
13
|
import { reconcileForItems } from "./for-reconcile.js";
|
|
14
|
-
import { ForCommitStrategy, ForState } from "./for-internal.js";
|
|
15
|
-
import { CaseState, ControlBoundaryState, MatchBranch, ShowState } from "./control.js";
|
|
14
|
+
import { ForCommitStrategy, ForItemTransactionSnapshot, ForState, ForTransaction } from "./for-internal.js";
|
|
15
|
+
import { CaseState, ControlBoundaryState, ControlTransaction, MatchBranch, ShowState } from "./control.js";
|
|
16
16
|
import { Derived, derive } from "./derive.js";
|
|
17
17
|
import { DelegatedEventMap } from "./events.js";
|
|
18
18
|
import { ExecutionModel } from "./execution-model.js";
|
|
@@ -21,4 +21,4 @@ import { ActivityPredicate, TimerOptions, capture, documentVisible, on, routeAct
|
|
|
21
21
|
import { DefaultPortal, Portal, PortalProps, definePortal } from "./portal.js";
|
|
22
22
|
import { Selector, selector } from "./selector.js";
|
|
23
23
|
import { ComponentFunction } from "../common/component.js";
|
|
24
|
-
export { type ActivityPredicate, AskrRuntime, AskrRuntimeOptions, CaseState, ChildScope, type ComponentFunction, type ComponentInstance, Context, ContextFrame, ContextKey, ControlBoundaryState, CreateFineGrainedEffectOptions, DefaultPortal, DelegatedEventMap, Derived, DerivedSubscriber, ExecutionModel, FineGrainedEffectHandle, ForCommitStrategy, type ForEachSource, ForState, MatchBranch, Portal, PortalProps, ReadableSource, type ResourceResult, RuntimeKeyedReorderDecision, RuntimeRendererHost, Selector, ShowState, State, StateSetter, StateTuple, type TimerOptions, capture, createRuntime, defineContext, definePortal, derive, documentVisible, getDefaultRuntime, getSignal, on, readContext, reconcileForItems, resource, routeActive, scheduleEventHandler, selector, state, stream, task, timer, windowFocused };
|
|
24
|
+
export { type ActivityPredicate, AskrRuntime, AskrRuntimeOptions, CaseState, ChildScope, ChildScopeTransactionSnapshot, type ComponentFunction, type ComponentInstance, Context, ContextFrame, ContextKey, ControlBoundaryState, ControlTransaction, CreateFineGrainedEffectOptions, DefaultPortal, DelegatedEventMap, Derived, DerivedSubscriber, ExecutionModel, FineGrainedEffectHandle, FineGrainedReadCollector, ForCommitStrategy, type ForEachSource, ForItemTransactionSnapshot, ForState, ForTransaction, MatchBranch, Portal, PortalProps, ReadableSource, type ResourceResult, RuntimeKeyedReorderDecision, RuntimeRendererHost, Selector, ShowState, State, StateSetter, StateTuple, type TimerOptions, capture, createRuntime, defineContext, definePortal, derive, documentVisible, getDefaultRuntime, getSignal, on, readContext, reconcileForItems, resource, routeActive, scheduleEventHandler, selector, state, stream, task, timer, windowFocused };
|
package/dist/runtime/index.js
CHANGED
|
@@ -2,25 +2,27 @@ import { addPerfDuration, getPerfMetricsStore, incrementPerfMetric, recordSchedu
|
|
|
2
2
|
import { scheduleEventHandler } from "./scheduler.js";
|
|
3
3
|
import { AskrRuntime, configureRuntimeRenderer, createRuntime, defaultRuntime, getDefaultRuntime } from "./runtime.js";
|
|
4
4
|
import { enqueueRuntimeLane, enqueueRuntimeTask, flushRuntimeScheduler, getDefaultRuntimeInstance, getRuntimeFlushVersion, getRuntimeRenderer, getRuntimeScheduler, getRuntimeSchedulerState, isRuntimeSchedulerExecuting, markRuntimeReactivePropsDirtySource, runRuntimeHandlerScope, runRuntimeWithSyncProgress, setRuntimeBulkCommitProbe } from "./access.js";
|
|
5
|
-
import { CONTEXT_FRAME_SYMBOL, defineContext, getCurrentContextFrame, getVNodeContextFrame, markVNodeTreeWithContextFrame, markVNodeWithContextFrame, readContext, withAsyncResourceContext, withContext } from "./context.js";
|
|
6
|
-
import { cleanupReadableSubscriptions, clearDerivedDependencySubscriptions, finalizeReadableSubscriptions, finalizeReadableSubscriptionsFromSnapshot, markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, markReadableUsage, notifyReadableReaders, recordReadableRead, syncDerivedDependencySubscriptions, withDerivedReadTracking, withFineGrainedReadTracking } from "./readable.js";
|
|
5
|
+
import { CONTEXT_FRAME_SYMBOL, callWithContext, defineContext, getCurrentContextFrame, getExecutionContextFrame, getVNodeContextFrame, markVNodeTreeWithContextFrame, markVNodeWithContextFrame, readContext, withAsyncResourceContext, withContext } from "./context.js";
|
|
6
|
+
import { cleanupReadableSubscriptions, clearDerivedDependencySubscriptions, finalizeReadableSubscriptions, finalizeReadableSubscriptionsFromSnapshot, markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, markReadableUsage, notifyReadableReaders, recordReadableRead, shouldCoalesceFineGrainedItemReads, syncDerivedDependencySubscriptions, withDerivedReadTracking, withFineGrainedReadTracking } from "./readable.js";
|
|
7
7
|
import { getDevNamespace, getDevValue, incDevCounter, setDevValue } from "./dev-namespace.js";
|
|
8
|
-
import { claimHookIndex, getCurrentComponentInstance, getCurrentInstance, getCurrentPortalScope, getCurrentStateIndex, getSignal, setCurrentComponentInstance } from "./component-scope.js";
|
|
8
|
+
import { claimHookIndex, enterDomCommitScope, getCurrentComponentInstance, getCurrentInstance, getCurrentPortalScope, getCurrentStateIndex, getSignal, restoreDomCommitScope, setCurrentComponentInstance } from "./component-scope.js";
|
|
9
9
|
import { cleanupComponent, registerOwnedChildScope, unregisterOwnedChildScope } from "./component-cleanup.js";
|
|
10
10
|
import { classifyUpdate, commitReorderOnly, enterBulkCommit, exitBulkCommit, isBulkCommitActive, markFastPathApplied, tryRuntimeFastLaneSync } from "./fastlane.js";
|
|
11
|
-
import {
|
|
11
|
+
import { beginLifecycleCommitBatch, discardLifecycleCommitBatch, drainLifecycleCommitErrors, flushLifecycleCommitBatch, getCurrentLifecycleCommitBatch, registerLifecycleRollback, registerLifecycleTransaction } from "./lifecycle-batch.js";
|
|
12
|
+
import "./component-lifecycle.js";
|
|
13
|
+
import { captureInlineRenderSnapshot, createComponentInstance, mountComponent, mountInstanceInline, registerCommitOperation, renderComponentInline, renderScopedComponent, warnUnusedStateReads } from "./component-internal.js";
|
|
12
14
|
import "./component.js";
|
|
13
|
-
import { createChildScope, disposeChildScope, rerenderChildScope } from "./child-scope.js";
|
|
15
|
+
import { captureChildScopeTransactionSnapshot, createChildScope, disposeChildScope, rerenderChildScope, restoreChildScopeTransactionSnapshot } from "./child-scope.js";
|
|
14
16
|
import { clearCaseDomUpdateState, clearShowDomUpdateState, createCaseState, createShowState, evaluateCaseState, evaluateShowState } from "./control.js";
|
|
15
17
|
import { derive } from "./derive.js";
|
|
16
|
-
import { createFineGrainedEffect, markFineGrainedEffectsDirtySource } from "./effect.js";
|
|
18
|
+
import { createFineGrainedEffect, createOwnedFineGrainedEffect, markFineGrainedEffectsDirtySource } from "./effect.js";
|
|
17
19
|
import { createBoundaryReset, reportBoundaryError } from "./error-boundary.js";
|
|
18
|
-
import { addDelegatedListener, clearDelegatedHandlersForElement, getDelegatedHandlerForElement, getDelegatedHandlersForElement, isDelegatedEvent, isEventDelegationEnabled, removeDelegatedListener, updateDelegatedListener } from "./events.js";
|
|
20
|
+
import { addDelegatedListener, addFreshDelegatedListener, clearDelegatedHandlersForElement, getDelegatedHandlerForElement, getDelegatedHandlersForElement, isDelegatedEvent, isEventDelegationEnabled, removeDelegatedListener, updateDelegatedListener } from "./events.js";
|
|
19
21
|
import { assertExecutionModel, getExecutionModel } from "./execution-model.js";
|
|
20
22
|
import { isBenchMetricScopeActive, recordBenchCounter, recordBenchEvent, recordBenchTiming, withBenchMetricScope } from "./for-bench.js";
|
|
21
|
-
import "./for-scopes.js";
|
|
23
|
+
import { captureForFallbackTransactionSnapshot, captureForItemTransactionSnapshot } from "./for-scopes.js";
|
|
22
24
|
import { reconcileForItems } from "./for-reconcile.js";
|
|
23
|
-
import { clearForDomUpdateState, createForState, evaluateForState, useForState } from "./for-internal.js";
|
|
25
|
+
import { beginForStateTransaction, clearForDomUpdateState, commitForStateTransaction, createForState, evaluateForState, registerForStateTransaction, rollbackForStateTransaction, useForState } from "./for-internal.js";
|
|
24
26
|
import "./for.js";
|
|
25
27
|
import { state } from "./state.js";
|
|
26
28
|
import { resource } from "./resource-operation.js";
|
|
@@ -28,4 +30,4 @@ import { capture, documentVisible, on, routeActive, stream, task, timer, windowF
|
|
|
28
30
|
import "./operations.js";
|
|
29
31
|
import { DefaultPortal, Portal, clearDefaultPortalForInstance, definePortal, disposeDefaultPortalScope } from "./portal.js";
|
|
30
32
|
import { selector } from "./selector.js";
|
|
31
|
-
export { AskrRuntime, CONTEXT_FRAME_SYMBOL, DefaultPortal, Portal, addDelegatedListener, addPerfDuration, assertExecutionModel, capture, captureInlineRenderSnapshot, claimHookIndex, classifyUpdate, cleanupComponent, cleanupReadableSubscriptions, clearCaseDomUpdateState, clearDefaultPortalForInstance, clearDelegatedHandlersForElement, clearDerivedDependencySubscriptions, clearForDomUpdateState, clearShowDomUpdateState, commitReorderOnly, configureRuntimeRenderer, createBoundaryReset, createCaseState, createChildScope, createComponentInstance, createFineGrainedEffect, createForState, createRuntime, createShowState, defaultRuntime, defineContext, definePortal, derive, disposeChildScope, disposeDefaultPortalScope, documentVisible, enqueueRuntimeLane, enqueueRuntimeTask, enterBulkCommit, evaluateCaseState, evaluateForState, evaluateShowState, exitBulkCommit,
|
|
33
|
+
export { AskrRuntime, CONTEXT_FRAME_SYMBOL, DefaultPortal, Portal, addDelegatedListener, addFreshDelegatedListener, addPerfDuration, assertExecutionModel, beginForStateTransaction, beginLifecycleCommitBatch, callWithContext, capture, captureChildScopeTransactionSnapshot, captureForFallbackTransactionSnapshot, captureForItemTransactionSnapshot, captureInlineRenderSnapshot, claimHookIndex, classifyUpdate, cleanupComponent, cleanupReadableSubscriptions, clearCaseDomUpdateState, clearDefaultPortalForInstance, clearDelegatedHandlersForElement, clearDerivedDependencySubscriptions, clearForDomUpdateState, clearShowDomUpdateState, commitForStateTransaction, commitReorderOnly, configureRuntimeRenderer, createBoundaryReset, createCaseState, createChildScope, createComponentInstance, createFineGrainedEffect, createForState, createOwnedFineGrainedEffect, createRuntime, createShowState, defaultRuntime, defineContext, definePortal, derive, discardLifecycleCommitBatch, disposeChildScope, disposeDefaultPortalScope, documentVisible, drainLifecycleCommitErrors, enqueueRuntimeLane, enqueueRuntimeTask, enterBulkCommit, enterDomCommitScope, evaluateCaseState, evaluateForState, evaluateShowState, exitBulkCommit, finalizeReadableSubscriptions, finalizeReadableSubscriptionsFromSnapshot, flushLifecycleCommitBatch, flushRuntimeScheduler, getCurrentComponentInstance, getCurrentContextFrame, getCurrentInstance, getCurrentLifecycleCommitBatch, getCurrentPortalScope, getCurrentStateIndex, getDefaultRuntime, getDefaultRuntimeInstance, getDelegatedHandlerForElement, getDelegatedHandlersForElement, getDevNamespace, getDevValue, getExecutionContextFrame, getExecutionModel, getPerfMetricsStore, getRuntimeFlushVersion, getRuntimeRenderer, getRuntimeScheduler, getRuntimeSchedulerState, getSignal, getVNodeContextFrame, incDevCounter, incrementPerfMetric, isBenchMetricScopeActive, isBulkCommitActive, isDelegatedEvent, isEventDelegationEnabled, isRuntimeSchedulerExecuting, markFastPathApplied, markFineGrainedEffectsDirtySource, markReactivePropsDirtySource, markReadableDerivedSubscribersDirty, markReadableUsage, markRuntimeReactivePropsDirtySource, markVNodeTreeWithContextFrame, markVNodeWithContextFrame, mountComponent, mountInstanceInline, notifyReadableReaders, on, readContext, reconcileForItems, recordBenchCounter, recordBenchEvent, recordBenchTiming, recordReadableRead, recordSchedulerFlushTaskCount, registerCommitOperation, registerForStateTransaction, registerLifecycleRollback, registerLifecycleTransaction, registerOwnedChildScope, removeDelegatedListener, renderComponentInline, renderScopedComponent, reportBoundaryError, rerenderChildScope, resource, restoreChildScopeTransactionSnapshot, restoreDomCommitScope, rollbackForStateTransaction, routeActive, runRuntimeHandlerScope, runRuntimeWithSyncProgress, scheduleEventHandler, selector, setCurrentComponentInstance, setDevValue, setRuntimeBulkCommitProbe, shouldCoalesceFineGrainedItemReads, state, stream, syncDerivedDependencySubscriptions, task, timer, tryRuntimeFastLaneSync, unregisterOwnedChildScope, updateDelegatedListener, useForState, warnUnusedStateReads, windowFocused, withAsyncResourceContext, withBenchMetricScope, withContext, withDerivedReadTracking, withFineGrainedReadTracking };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Props } from "../common/props.js";
|
|
2
|
+
import { ContextFrame } from "./context.js";
|
|
3
|
+
import { ComponentInstance } from "./component-internal.js";
|
|
4
|
+
import { ReadableSource } from "./readable.js";
|
|
5
|
+
|
|
6
|
+
//#region src/runtime/lifecycle-batch.d.ts
|
|
7
|
+
type LifecycleOperation = () => void | (() => void) | PromiseLike<void | (() => void)>;
|
|
8
|
+
type LifecycleCommitBatchEntry = {
|
|
9
|
+
instance: ComponentInstance;
|
|
10
|
+
wasFirstMount: boolean;
|
|
11
|
+
};
|
|
12
|
+
type ReadSubscriptionCommit = {
|
|
13
|
+
instance: ComponentInstance;
|
|
14
|
+
token: number;
|
|
15
|
+
pendingReadSources: Set<ReadableSource<unknown>> | undefined;
|
|
16
|
+
pendingReadSourceVersions: Map<ReadableSource<unknown>, number> | undefined;
|
|
17
|
+
};
|
|
18
|
+
type InlineRenderSnapshot = {
|
|
19
|
+
instance: ComponentInstance;
|
|
20
|
+
props: Props;
|
|
21
|
+
ownerFrame: ContextFrame | null;
|
|
22
|
+
portalScope: object | null;
|
|
23
|
+
parentInstance: ComponentInstance | null;
|
|
24
|
+
isRoot: boolean | undefined;
|
|
25
|
+
};
|
|
26
|
+
type LifecycleTransaction = {
|
|
27
|
+
key: object;
|
|
28
|
+
commit(): void;
|
|
29
|
+
rollback(): void;
|
|
30
|
+
merge?(parentTransaction: LifecycleTransaction): void;
|
|
31
|
+
};
|
|
32
|
+
type LifecycleRollback = () => void;
|
|
33
|
+
type LifecycleTransactionEntry = LifecycleTransaction | LifecycleRollback;
|
|
34
|
+
type LifecycleCommitBatch = {
|
|
35
|
+
parent: LifecycleCommitBatch | null;
|
|
36
|
+
entries: LifecycleCommitBatchEntry[];
|
|
37
|
+
entriesByInstance: Map<ComponentInstance, LifecycleCommitBatchEntry>;
|
|
38
|
+
readCommits: ReadSubscriptionCommit[];
|
|
39
|
+
readCommitsByInstance: Map<ComponentInstance, ReadSubscriptionCommit>;
|
|
40
|
+
renderSnapshots: InlineRenderSnapshot[];
|
|
41
|
+
renderSnapshotsByInstance: Map<ComponentInstance, InlineRenderSnapshot>;
|
|
42
|
+
transactions: LifecycleTransactionEntry[];
|
|
43
|
+
transactionsByKey: Map<object, LifecycleTransaction>;
|
|
44
|
+
retainedElementSnapshots: Map<Element, unknown>;
|
|
45
|
+
active: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** @internal Drain commit-time cleanup errors for transaction owners such as the router. */
|
|
48
|
+
declare function drainLifecycleCommitErrors(): unknown[];
|
|
49
|
+
declare function beginLifecycleCommitBatch(): LifecycleCommitBatch;
|
|
50
|
+
declare function getCurrentLifecycleCommitBatch(): LifecycleCommitBatch | null;
|
|
51
|
+
declare function registerLifecycleTransaction(key: object, commit: () => void, rollback: () => void, merge?: (parentTransaction: LifecycleTransaction) => void): boolean;
|
|
52
|
+
declare function registerLifecycleRollback(rollback: LifecycleRollback): boolean;
|
|
53
|
+
declare function enqueueLifecycleCommitForInstance(instance: ComponentInstance, wasFirstMount: boolean): boolean;
|
|
54
|
+
declare function captureInlineRenderSnapshot(instance: ComponentInstance): void;
|
|
55
|
+
declare function finalizeInlineReadSubscriptions(instance: ComponentInstance, token: number, pendingReadSources: Set<ReadableSource<unknown>> | undefined, pendingReadSourceVersions: Map<ReadableSource<unknown>, number> | undefined): void;
|
|
56
|
+
declare function flushLifecycleCommitBatch(batch: LifecycleCommitBatch): void;
|
|
57
|
+
declare function discardLifecycleCommitBatch(batch: LifecycleCommitBatch): void;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { LifecycleCommitBatch, LifecycleOperation, LifecycleTransaction };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { logger } from "../common/logger.js";
|
|
2
|
+
import { finalizeReadableSubscriptionsFromSnapshot } from "./readable.js";
|
|
3
|
+
import { discardCommitOperations, executeCommittedLifecycleOperations } from "./lifecycle-operation-settlement.js";
|
|
4
|
+
//#region src/runtime/lifecycle-batch.ts
|
|
5
|
+
let currentLifecycleCommitBatch = null;
|
|
6
|
+
const pendingLifecycleCommitErrors = [];
|
|
7
|
+
/** @internal Drain commit-time cleanup errors for transaction owners such as the router. */
|
|
8
|
+
function drainLifecycleCommitErrors() {
|
|
9
|
+
if (pendingLifecycleCommitErrors.length === 0) return [];
|
|
10
|
+
return pendingLifecycleCommitErrors.splice(0);
|
|
11
|
+
}
|
|
12
|
+
function beginLifecycleCommitBatch() {
|
|
13
|
+
const batch = {
|
|
14
|
+
parent: currentLifecycleCommitBatch,
|
|
15
|
+
entries: [],
|
|
16
|
+
entriesByInstance: /* @__PURE__ */ new Map(),
|
|
17
|
+
readCommits: [],
|
|
18
|
+
readCommitsByInstance: /* @__PURE__ */ new Map(),
|
|
19
|
+
renderSnapshots: [],
|
|
20
|
+
renderSnapshotsByInstance: /* @__PURE__ */ new Map(),
|
|
21
|
+
transactions: [],
|
|
22
|
+
transactionsByKey: /* @__PURE__ */ new Map(),
|
|
23
|
+
retainedElementSnapshots: /* @__PURE__ */ new Map(),
|
|
24
|
+
active: true
|
|
25
|
+
};
|
|
26
|
+
currentLifecycleCommitBatch = batch;
|
|
27
|
+
return batch;
|
|
28
|
+
}
|
|
29
|
+
function getCurrentLifecycleCommitBatch() {
|
|
30
|
+
return currentLifecycleCommitBatch?.active ? currentLifecycleCommitBatch : null;
|
|
31
|
+
}
|
|
32
|
+
function enqueueLifecycleTransaction(batch, transaction) {
|
|
33
|
+
if (batch.transactionsByKey.has(transaction.key)) return;
|
|
34
|
+
batch.transactionsByKey.set(transaction.key, transaction);
|
|
35
|
+
batch.transactions.push(transaction);
|
|
36
|
+
}
|
|
37
|
+
function registerLifecycleTransaction(key, commit, rollback, merge) {
|
|
38
|
+
if (!currentLifecycleCommitBatch?.active) return false;
|
|
39
|
+
enqueueLifecycleTransaction(currentLifecycleCommitBatch, {
|
|
40
|
+
key,
|
|
41
|
+
commit,
|
|
42
|
+
rollback,
|
|
43
|
+
merge
|
|
44
|
+
});
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
function registerLifecycleRollback(rollback) {
|
|
48
|
+
if (!currentLifecycleCommitBatch?.active) return false;
|
|
49
|
+
currentLifecycleCommitBatch.transactions.push(rollback);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
function closeLifecycleCommitBatch(batch) {
|
|
53
|
+
if (!batch.active) return false;
|
|
54
|
+
batch.active = false;
|
|
55
|
+
currentLifecycleCommitBatch = batch.parent;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
function enqueueLifecycleCommit(batch, instance, wasFirstMount) {
|
|
59
|
+
const existing = batch.entriesByInstance.get(instance);
|
|
60
|
+
if (existing) {
|
|
61
|
+
existing.wasFirstMount = existing.wasFirstMount || wasFirstMount;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const entry = {
|
|
65
|
+
instance,
|
|
66
|
+
wasFirstMount
|
|
67
|
+
};
|
|
68
|
+
batch.entriesByInstance.set(instance, entry);
|
|
69
|
+
batch.entries.push(entry);
|
|
70
|
+
}
|
|
71
|
+
function enqueueLifecycleCommitForInstance(instance, wasFirstMount) {
|
|
72
|
+
if (!currentLifecycleCommitBatch?.active) return false;
|
|
73
|
+
enqueueLifecycleCommit(currentLifecycleCommitBatch, instance, wasFirstMount);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
function enqueueReadSubscriptionCommit(batch, instance, token, pendingReadSources, pendingReadSourceVersions) {
|
|
77
|
+
const existing = batch.readCommitsByInstance.get(instance);
|
|
78
|
+
const commit = existing ?? {
|
|
79
|
+
instance,
|
|
80
|
+
token,
|
|
81
|
+
pendingReadSources,
|
|
82
|
+
pendingReadSourceVersions
|
|
83
|
+
};
|
|
84
|
+
commit.token = token;
|
|
85
|
+
commit.pendingReadSources = pendingReadSources ? new Set(pendingReadSources) : void 0;
|
|
86
|
+
commit.pendingReadSourceVersions = pendingReadSourceVersions ? new Map(pendingReadSourceVersions) : void 0;
|
|
87
|
+
if (!existing) {
|
|
88
|
+
batch.readCommitsByInstance.set(instance, commit);
|
|
89
|
+
batch.readCommits.push(commit);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function enqueueInlineRenderSnapshot(batch, snapshot) {
|
|
93
|
+
if (batch.renderSnapshotsByInstance.has(snapshot.instance)) return;
|
|
94
|
+
batch.renderSnapshotsByInstance.set(snapshot.instance, snapshot);
|
|
95
|
+
batch.renderSnapshots.push(snapshot);
|
|
96
|
+
}
|
|
97
|
+
function captureInlineRenderSnapshot(instance) {
|
|
98
|
+
if (!currentLifecycleCommitBatch?.active) return;
|
|
99
|
+
enqueueInlineRenderSnapshot(currentLifecycleCommitBatch, {
|
|
100
|
+
instance,
|
|
101
|
+
props: instance.props,
|
|
102
|
+
ownerFrame: instance.ownerFrame,
|
|
103
|
+
portalScope: instance.portalScope,
|
|
104
|
+
parentInstance: instance.parentInstance,
|
|
105
|
+
isRoot: instance.isRoot
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function finalizeInlineReadSubscriptions(instance, token, pendingReadSources, pendingReadSourceVersions) {
|
|
109
|
+
if ((!pendingReadSources || pendingReadSources.size === 0) && (!instance._lastReadSources || instance._lastReadSources.size === 0)) return;
|
|
110
|
+
if (currentLifecycleCommitBatch?.active) {
|
|
111
|
+
enqueueReadSubscriptionCommit(currentLifecycleCommitBatch, instance, token, pendingReadSources, pendingReadSourceVersions);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
finalizeReadableSubscriptionsFromSnapshot(instance, token, pendingReadSources, pendingReadSourceVersions);
|
|
115
|
+
}
|
|
116
|
+
function flushLifecycleCommitBatch(batch) {
|
|
117
|
+
if (!closeLifecycleCommitBatch(batch)) return;
|
|
118
|
+
if (batch.parent?.active) {
|
|
119
|
+
for (const [element, snapshot] of batch.retainedElementSnapshots) if (!batch.parent.retainedElementSnapshots.has(element)) batch.parent.retainedElementSnapshots.set(element, snapshot);
|
|
120
|
+
for (const entry of batch.transactions) if (typeof entry === "function") batch.parent.transactions.push(entry);
|
|
121
|
+
else {
|
|
122
|
+
const existing = batch.parent.transactionsByKey.get(entry.key);
|
|
123
|
+
if (existing && entry.merge) entry.merge(existing);
|
|
124
|
+
else enqueueLifecycleTransaction(batch.parent, entry);
|
|
125
|
+
}
|
|
126
|
+
for (const snapshot of batch.renderSnapshots) enqueueInlineRenderSnapshot(batch.parent, snapshot);
|
|
127
|
+
for (const commit of batch.readCommits) enqueueReadSubscriptionCommit(batch.parent, commit.instance, commit.token, commit.pendingReadSources, commit.pendingReadSourceVersions);
|
|
128
|
+
for (const entry of batch.entries) enqueueLifecycleCommit(batch.parent, entry.instance, entry.wasFirstMount);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const commitErrors = [];
|
|
132
|
+
for (const commit of batch.readCommits) try {
|
|
133
|
+
finalizeReadableSubscriptionsFromSnapshot(commit.instance, commit.token, commit.pendingReadSources, commit.pendingReadSourceVersions);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
commitErrors.push(error);
|
|
136
|
+
}
|
|
137
|
+
for (const transaction of batch.transactions) {
|
|
138
|
+
if (typeof transaction === "function") continue;
|
|
139
|
+
try {
|
|
140
|
+
transaction.commit();
|
|
141
|
+
} catch (error) {
|
|
142
|
+
commitErrors.push(error);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
for (const entry of batch.entries) try {
|
|
146
|
+
executeCommittedLifecycleOperations(entry.instance, entry.wasFirstMount);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
commitErrors.push(error);
|
|
149
|
+
}
|
|
150
|
+
if (commitErrors.length > 0) {
|
|
151
|
+
pendingLifecycleCommitErrors.push(...commitErrors);
|
|
152
|
+
logger.error("[Askr] committed lifecycle work failed:", new AggregateError(commitErrors, "Committed lifecycle work failed"));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function discardLifecycleCommitBatch(batch) {
|
|
156
|
+
if (!closeLifecycleCommitBatch(batch)) return;
|
|
157
|
+
for (let index = batch.transactions.length - 1; index >= 0; index -= 1) try {
|
|
158
|
+
const transaction = batch.transactions[index];
|
|
159
|
+
if (typeof transaction === "function") transaction();
|
|
160
|
+
else transaction.rollback();
|
|
161
|
+
} catch (error) {
|
|
162
|
+
logger.error("[Askr] transaction rollback failed:", error);
|
|
163
|
+
}
|
|
164
|
+
for (let index = batch.renderSnapshots.length - 1; index >= 0; index -= 1) {
|
|
165
|
+
const snapshot = batch.renderSnapshots[index];
|
|
166
|
+
snapshot.instance.props = snapshot.props;
|
|
167
|
+
snapshot.instance.ownerFrame = snapshot.ownerFrame;
|
|
168
|
+
snapshot.instance.portalScope = snapshot.portalScope;
|
|
169
|
+
snapshot.instance.parentInstance = snapshot.parentInstance;
|
|
170
|
+
snapshot.instance.isRoot = snapshot.isRoot;
|
|
171
|
+
}
|
|
172
|
+
for (const entry of batch.entries) {
|
|
173
|
+
if (entry.wasFirstMount) entry.instance.mountOperations = [];
|
|
174
|
+
discardCommitOperations(entry.instance);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
export { beginLifecycleCommitBatch, captureInlineRenderSnapshot, discardLifecycleCommitBatch, drainLifecycleCommitErrors, enqueueLifecycleCommitForInstance, finalizeInlineReadSubscriptions, flushLifecycleCommitBatch, getCurrentLifecycleCommitBatch, registerLifecycleRollback, registerLifecycleTransaction };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentInstance } from "./component-internal.js";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/lifecycle-operation-settlement.d.ts
|
|
4
|
+
declare function discardCommitOperations(instance: ComponentInstance): void;
|
|
5
|
+
declare function executeCommittedLifecycleOperations(instance: ComponentInstance, wasFirstMount: boolean): void;
|