@askrjs/askr 0.0.50 → 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 +5 -6
- 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 +21 -11
- package/dist/boot/root-lifecycle.d.ts +6 -3
- package/dist/boot/root-lifecycle.js +18 -14
- 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 +15 -0
- package/dist/common/invariant.js +15 -0
- package/dist/common/jsx.d.ts +1 -2
- package/dist/common/jsx.js +0 -2
- package/dist/{dev → common}/logger.js +5 -8
- 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 +2 -16
- package/dist/components/error-boundary.js +2 -76
- package/dist/components/index.d.ts +2 -1
- package/dist/components/link.d.ts +2 -2
- package/dist/components/link.js +2 -2
- package/dist/control/case.d.ts +1 -2
- package/dist/control/case.js +1 -2
- package/dist/control/for.d.ts +3 -4
- package/dist/control/for.js +2 -4
- 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 +1 -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 +2 -4
- package/dist/data/mutation-cell.d.ts +1 -2
- package/dist/data/mutation-cell.js +7 -6
- package/dist/data/query-cell.d.ts +3 -2
- package/dist/data/query-cell.js +45 -11
- package/dist/data/query-key.js +0 -2
- package/dist/data/shared.js +3 -3
- package/dist/data/testing.js +2 -0
- 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/index.d.ts +1 -1
- package/dist/foundations/index.js +1 -1
- 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 -3
- package/dist/foundations/state/controllable.js +1 -2
- package/dist/foundations/structures/collection.d.ts +1 -2
- package/dist/foundations/structures/collection.js +0 -2
- package/dist/foundations/structures/index.d.ts +1 -1
- package/dist/foundations/structures/index.js +2 -1
- 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/portal.d.ts +2 -24
- package/dist/foundations/structures/portal.js +3 -187
- 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 +2 -4
- package/dist/fx/index.js +1 -0
- 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 +4 -4
- package/dist/index.js +4 -6
- 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 +4 -12
- package/dist/jsx-runtime.d.ts +16 -2
- package/dist/jsx-runtime.js +16 -24
- package/dist/jsx-runtime2.d.ts +1 -1
- package/dist/renderer/attributes.js +29 -6
- package/dist/renderer/boundaries.js +50 -174
- 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 +2 -4
- package/dist/renderer/children-fastpath.js +149 -0
- package/dist/renderer/children.js +3 -140
- package/dist/renderer/cleanup.js +72 -15
- package/dist/renderer/component-host-cleanup.js +124 -49
- package/dist/renderer/component-host-instances.js +60 -9
- package/dist/renderer/component-host-replacement.js +105 -0
- package/dist/renderer/component-host-results.js +138 -0
- package/dist/renderer/component-host.js +95 -170
- package/dist/renderer/dom-host.js +0 -2
- package/dist/renderer/dom-internal.js +115 -57
- package/dist/renderer/dom-range.js +161 -0
- package/dist/renderer/dom.js +7 -5
- package/dist/renderer/element-children.js +112 -32
- package/dist/renderer/error-boundary-dom.js +70 -13
- package/dist/renderer/evaluate-dom-range.js +3 -4
- package/dist/renderer/evaluate-reconcile.js +18 -42
- package/dist/renderer/evaluate.js +14 -3
- package/dist/renderer/fastpath.js +7 -14
- package/dist/renderer/for-commit-dom-map.js +6 -18
- package/dist/renderer/for-commit-removal.js +8 -17
- package/dist/renderer/for-commit-reorder.js +2 -4
- package/dist/renderer/for-commit.js +173 -45
- package/dist/renderer/hydration-boundaries.js +60 -0
- package/dist/renderer/hydration-listener-transaction.js +49 -0
- package/dist/renderer/index.js +11 -8
- 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 +59 -24
- package/dist/renderer/reactive-child-dom.js +10 -4
- package/dist/renderer/reactive-child-sources.js +0 -2
- package/dist/renderer/reactive-children.js +33 -24
- package/dist/renderer/reconcile-commit.js +0 -2
- package/dist/renderer/reconcile-fastpaths.js +6 -12
- package/dist/renderer/reconcile-resolution.js +32 -56
- package/dist/renderer/reconcile.js +0 -2
- package/dist/renderer/retained-element-rollback.js +161 -149
- package/dist/renderer/stable-patch.js +5 -7
- package/dist/renderer/static-reuse.js +0 -2
- package/dist/renderer/utils.js +20 -10
- package/dist/resources/index.js +1 -2
- package/dist/router/access.js +0 -2
- package/dist/router/activity.d.ts +1 -2
- package/dist/router/activity.js +20 -24
- package/dist/router/authoring.d.ts +1 -2
- package/dist/router/authoring.js +1 -3
- package/dist/router/index.d.ts +1 -1
- 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 +5 -8
- package/dist/router/navigation-registry.d.ts +1 -2
- package/dist/router/navigation-registry.js +1 -3
- 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 +425 -44
- 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 +5 -3
- package/dist/router/resolution.d.ts +2 -16
- package/dist/router/resolution.js +6 -175
- package/dist/router/route-context.js +0 -2
- package/dist/router/route-matching.d.ts +19 -0
- package/dist/router/route-matching.js +173 -0
- package/dist/router/route-query.d.ts +1 -2
- package/dist/router/route-query.js +1 -3
- package/dist/router/route.js +4 -2
- package/dist/router/store.d.ts +1 -2
- package/dist/router/store.js +0 -2
- package/dist/router/testing.js +4 -0
- package/dist/runtime/access.d.ts +19 -0
- 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 +3 -5
- package/dist/runtime/component-commit.js +26 -24
- package/dist/runtime/component-facade.js +5 -3
- package/dist/runtime/component-internal.d.ts +12 -7
- package/dist/runtime/component-internal.js +64 -46
- package/dist/runtime/component-lifecycle.d.ts +2 -41
- package/dist/runtime/component-lifecycle.js +6 -149
- package/dist/runtime/component-scope.d.ts +4 -5
- 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 +30 -0
- 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 +4 -0
- package/dist/runtime/error-boundary.js +29 -0
- package/dist/runtime/events.d.ts +58 -0
- package/dist/runtime/events.js +67 -70
- package/dist/runtime/execution-model.d.ts +6 -0
- package/dist/runtime/execution-model.js +0 -2
- package/dist/runtime/fastlane.d.ts +33 -0
- 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 +73 -10
- 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 +14 -5
- package/dist/runtime/for-signals.js +157 -83
- package/dist/runtime/for-types.d.ts +8 -0
- package/dist/runtime/for.d.ts +2 -2
- package/dist/runtime/for.js +3 -3
- package/dist/runtime/index.d.ts +24 -0
- package/dist/runtime/index.js +33 -0
- 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 +27 -0
- package/dist/runtime/perf-metrics.js +4 -68
- package/dist/runtime/portal.d.ts +21 -0
- package/dist/runtime/portal.js +305 -0
- package/dist/runtime/readable.d.ts +9 -4
- package/dist/runtime/readable.js +41 -17
- package/dist/runtime/resource-cell.js +3 -5
- package/dist/runtime/resource-operation.d.ts +1 -2
- package/dist/runtime/resource-operation.js +38 -35
- package/dist/runtime/runtime.d.ts +2 -3
- package/dist/runtime/runtime.js +0 -2
- package/dist/runtime/scheduler.d.ts +1 -2
- package/dist/runtime/scheduler.js +10 -13
- package/dist/runtime/selector-store.js +22 -0
- package/dist/runtime/selector.d.ts +1 -2
- package/dist/runtime/selector.js +6 -29
- 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 +66 -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 +1 -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 +17 -6
- package/dist/ssr/component-runtime.js +4 -30
- 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 +1 -3
- package/dist/ssr/render-sync.d.ts +1 -2
- package/dist/ssr/render-sync.js +28 -20
- package/dist/ssr/route-policy-resolution.js +2 -3
- package/dist/ssr/route-render.d.ts +1 -2
- package/dist/ssr/route-render.js +2 -3
- 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 +3 -4
- package/package.json +60 -47
- 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/jsx.d.ts.map +0 -1
- package/dist/common/jsx.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/dev/invariant.js +0 -29
- package/dist/dev/invariant.js.map +0 -1
- package/dist/dev/logger.js.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/portal.d.ts.map +0 -1
- package/dist/foundations/structures/portal.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.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-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.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-contracts.js +0 -5
- 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.js.map +0 -1
- package/dist/runtime/effect.d.ts.map +0 -1
- package/dist/runtime/effect.js.map +0 -1
- package/dist/runtime/events.js.map +0 -1
- package/dist/runtime/execution-model.js.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/lifecycle-operations.d.ts.map +0 -1
- package/dist/runtime/lifecycle-operations.js.map +0 -1
- package/dist/runtime/perf-metrics.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.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,68 +1,143 @@
|
|
|
1
|
+
import { incDevCounter } from "../runtime/dev-namespace.js";
|
|
1
2
|
import { cleanupComponent } from "../runtime/component-cleanup.js";
|
|
2
|
-
import "../runtime/
|
|
3
|
-
import {
|
|
3
|
+
import { registerLifecycleTransaction } from "../runtime/lifecycle-batch.js";
|
|
4
|
+
import { clearDelegatedHandlersForElement, removeDelegatedListener } from "../runtime/events.js";
|
|
5
|
+
import "../runtime/index.js";
|
|
6
|
+
import { elementListeners, elementReactivePropsCleanup, elementRefs, forEachElementReactivePropCleanup, removeElementRef } from "./cleanup.js";
|
|
4
7
|
//#region src/renderer/component-host-cleanup.ts
|
|
5
8
|
function cleanupDetachedComponentHost(host, retainedInstance) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const retainedInstances = retainedInstance instanceof Object && typeof retainedInstance[Symbol.iterator] === "function" ? new Set(retainedInstance) : /* @__PURE__ */ new Set([retainedInstance]);
|
|
10
|
+
const cleanupErrors = [];
|
|
11
|
+
const cleanedInstances = /* @__PURE__ */ new Set();
|
|
12
|
+
const elements = [host];
|
|
13
|
+
try {
|
|
14
|
+
const descendants = host.querySelectorAll("*");
|
|
15
|
+
for (let index = 0; index < descendants.length; index += 1) elements.push(descendants[index]);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
cleanupErrors.push(error);
|
|
18
|
+
}
|
|
19
|
+
for (const element of elements) {
|
|
20
|
+
cleanupElementListeners(element, cleanupErrors);
|
|
21
|
+
cleanupElementReactiveProps(element, cleanupErrors);
|
|
22
|
+
cleanupElementRef(element, cleanupErrors);
|
|
23
|
+
cleanupElementInstances(element, retainedInstances, cleanedInstances, cleanupErrors);
|
|
24
|
+
clearHostMetadata(element, cleanupErrors);
|
|
12
25
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} catch {}
|
|
27
|
-
} else if (descendant.__ASKR_INSTANCE && descendant.__ASKR_INSTANCE !== retainedInstance) {
|
|
28
|
-
cleanupComponent(descendant.__ASKR_INSTANCE);
|
|
29
|
-
try {
|
|
30
|
-
delete descendant.__ASKR_INSTANCE;
|
|
31
|
-
} catch {}
|
|
26
|
+
if (cleanupErrors.length > 0) throw new AggregateError(cleanupErrors, "Detached component host cleanup failed");
|
|
27
|
+
}
|
|
28
|
+
function cleanupElementListeners(element, cleanupErrors) {
|
|
29
|
+
const listenerMap = elementListeners.get(element);
|
|
30
|
+
if (listenerMap) {
|
|
31
|
+
elementListeners.delete(element);
|
|
32
|
+
for (const entry of listenerMap.values()) try {
|
|
33
|
+
incDevCounter("listenerRemoves");
|
|
34
|
+
if (entry.isDelegated) removeDelegatedListener(element, entry.eventName);
|
|
35
|
+
else if (entry.options !== void 0) element.removeEventListener(entry.eventName, entry.handler, entry.options);
|
|
36
|
+
else element.removeEventListener(entry.eventName, entry.handler);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
cleanupErrors.push(error);
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
41
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
42
|
+
clearDelegatedHandlersForElement(element);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
cleanupErrors.push(error);
|
|
45
|
+
}
|
|
39
46
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
function cleanupElementReactiveProps(element, cleanupErrors) {
|
|
48
|
+
if (!elementReactivePropsCleanup.has(element)) return;
|
|
49
|
+
const entries = [];
|
|
50
|
+
forEachElementReactivePropCleanup(element, (entry) => entries.push(entry));
|
|
51
|
+
elementReactivePropsCleanup.delete(element);
|
|
52
|
+
for (const entry of entries) try {
|
|
53
|
+
entry.cleanup();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
cleanupErrors.push(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function cleanupElementRef(element, cleanupErrors) {
|
|
59
|
+
try {
|
|
60
|
+
removeElementRef(element);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
elementRefs.delete(element);
|
|
63
|
+
cleanupErrors.push(error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function cleanupElementInstances(element, retainedInstances, cleanedInstances, cleanupErrors) {
|
|
67
|
+
const instances = new Set(element.__ASKR_INSTANCES ?? []);
|
|
68
|
+
if (element.__ASKR_INSTANCE) instances.add(element.__ASKR_INSTANCE);
|
|
69
|
+
for (const instance of instances) {
|
|
70
|
+
if (retainedInstances.has(instance) || cleanedInstances.has(instance)) continue;
|
|
71
|
+
cleanedInstances.add(instance);
|
|
72
|
+
try {
|
|
73
|
+
cleanupComponent(instance);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
cleanupErrors.push(error);
|
|
49
76
|
}
|
|
50
|
-
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function clearHostMetadata(element, cleanupErrors) {
|
|
80
|
+
for (const property of [
|
|
81
|
+
"__ASKR_INSTANCE",
|
|
82
|
+
"__ASKR_INSTANCES",
|
|
83
|
+
"__ASKR_WRAPPER_HOST"
|
|
84
|
+
]) try {
|
|
85
|
+
delete element[property];
|
|
86
|
+
} catch (error) {
|
|
87
|
+
cleanupErrors.push(error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function pruneComponentHostInstances(host, retainedInstances) {
|
|
91
|
+
const hadInstanceList = Object.prototype.hasOwnProperty.call(host, "__ASKR_INSTANCES");
|
|
92
|
+
const hadPrimaryInstance = Object.prototype.hasOwnProperty.call(host, "__ASKR_INSTANCE");
|
|
93
|
+
const previousInstanceList = host.__ASKR_INSTANCES?.slice();
|
|
94
|
+
const previousPrimaryInstance = host.__ASKR_INSTANCE;
|
|
95
|
+
const previousInstances = collectHostInstances(host);
|
|
96
|
+
const commit = () => {
|
|
97
|
+
const retained = new Set(retainedInstances);
|
|
98
|
+
const currentInstances = collectHostInstances(host);
|
|
99
|
+
const nextInstances = Array.from(currentInstances).filter((instance) => retained.has(instance));
|
|
100
|
+
for (const instance of retained) if (instance.target === host && !nextInstances.includes(instance)) nextInstances.push(instance);
|
|
101
|
+
writeHostInstances(host, nextInstances);
|
|
102
|
+
cleanupHostInstances(Array.from(currentInstances).filter((instance) => !retained.has(instance)), "Component host pruning failed");
|
|
103
|
+
};
|
|
104
|
+
const rollback = () => {
|
|
105
|
+
const currentInstances = collectHostInstances(host);
|
|
106
|
+
try {
|
|
107
|
+
if (hadInstanceList) host.__ASKR_INSTANCES = previousInstanceList;
|
|
108
|
+
else delete host.__ASKR_INSTANCES;
|
|
109
|
+
if (hadPrimaryInstance) host.__ASKR_INSTANCE = previousPrimaryInstance;
|
|
110
|
+
else delete host.__ASKR_INSTANCE;
|
|
111
|
+
} catch {}
|
|
112
|
+
cleanupHostInstances(Array.from(currentInstances).filter((instance) => !previousInstances.has(instance)), "Provisional component host cleanup failed");
|
|
51
113
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
114
|
+
if (!registerLifecycleTransaction({}, commit, rollback)) commit();
|
|
115
|
+
}
|
|
116
|
+
function collectHostInstances(host) {
|
|
117
|
+
const instances = /* @__PURE__ */ new Set();
|
|
118
|
+
for (const instance of host.__ASKR_INSTANCES ?? []) instances.add(instance);
|
|
119
|
+
if (host.__ASKR_INSTANCE) instances.add(host.__ASKR_INSTANCE);
|
|
120
|
+
return instances;
|
|
121
|
+
}
|
|
122
|
+
function writeHostInstances(host, instances) {
|
|
55
123
|
try {
|
|
56
|
-
if (
|
|
57
|
-
host.__ASKR_INSTANCES =
|
|
58
|
-
host.__ASKR_INSTANCE =
|
|
124
|
+
if (instances.length > 0) {
|
|
125
|
+
host.__ASKR_INSTANCES = instances;
|
|
126
|
+
host.__ASKR_INSTANCE = instances[0];
|
|
59
127
|
} else {
|
|
60
128
|
delete host.__ASKR_INSTANCES;
|
|
61
129
|
delete host.__ASKR_INSTANCE;
|
|
62
130
|
}
|
|
63
131
|
} catch {}
|
|
64
132
|
}
|
|
133
|
+
function cleanupHostInstances(instances, message) {
|
|
134
|
+
const cleanupErrors = [];
|
|
135
|
+
for (const instance of instances) try {
|
|
136
|
+
cleanupComponent(instance);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
cleanupErrors.push(error);
|
|
139
|
+
}
|
|
140
|
+
if (cleanupErrors.length > 0) throw new AggregateError(cleanupErrors, message);
|
|
141
|
+
}
|
|
65
142
|
//#endregion
|
|
66
143
|
export { cleanupDetachedComponentHost, pruneComponentHostInstances };
|
|
67
|
-
|
|
68
|
-
//# sourceMappingURL=component-host-cleanup.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { isProductionEnvironment } from "../common/env.js";
|
|
1
2
|
import { getDevValue, incDevCounter } from "../runtime/dev-namespace.js";
|
|
2
3
|
import { getCurrentInstance } from "../runtime/component-scope.js";
|
|
3
|
-
import "../runtime/
|
|
4
|
+
import "../runtime/index.js";
|
|
4
5
|
import { extractKey } from "./utils.js";
|
|
5
6
|
import { ROUTE_ROOT_COMPONENT } from "../common/router-internal.js";
|
|
6
7
|
//#region src/renderer/component-host-instances.ts
|
|
@@ -19,6 +20,7 @@ function getVNodeComponentInstance(node) {
|
|
|
19
20
|
function setVNodeComponentInstance(node, instance) {
|
|
20
21
|
if (typeof node !== "object" || node === null) return;
|
|
21
22
|
const objectNode = node;
|
|
23
|
+
vnodeComponentInstances.delete(objectNode);
|
|
22
24
|
if (Object.prototype.hasOwnProperty.call(objectNode, "__instance")) try {
|
|
23
25
|
objectNode.__instance = instance;
|
|
24
26
|
return;
|
|
@@ -29,8 +31,30 @@ function setVNodeComponentInstance(node, instance) {
|
|
|
29
31
|
} catch {}
|
|
30
32
|
vnodeComponentInstances.set(objectNode, instance);
|
|
31
33
|
}
|
|
34
|
+
/** @internal Restore component ownership after provisional creation fails. */
|
|
35
|
+
function restoreVNodeComponentInstance(node, instance) {
|
|
36
|
+
if (typeof node !== "object" || node === null) return;
|
|
37
|
+
const objectNode = node;
|
|
38
|
+
vnodeComponentInstances.delete(objectNode);
|
|
39
|
+
if (instance) {
|
|
40
|
+
setVNodeComponentInstance(objectNode, instance);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
delete objectNode.__instance;
|
|
45
|
+
} catch {
|
|
46
|
+
try {
|
|
47
|
+
objectNode.__instance = void 0;
|
|
48
|
+
} catch {}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
32
51
|
let fallbackComponentInstanceId = 0;
|
|
52
|
+
const PRODUCTION_BUILD_ENABLED = isProductionEnvironment();
|
|
33
53
|
function nextComponentInstanceId() {
|
|
54
|
+
if (PRODUCTION_BUILD_ENABLED || isProductionEnvironment()) {
|
|
55
|
+
fallbackComponentInstanceId++;
|
|
56
|
+
return `comp-${fallbackComponentInstanceId}`;
|
|
57
|
+
}
|
|
34
58
|
const key = "__COMPONENT_INSTANCE_ID";
|
|
35
59
|
try {
|
|
36
60
|
incDevCounter(key);
|
|
@@ -48,18 +72,45 @@ function inheritComponentKey(target, source) {
|
|
|
48
72
|
if (!target.props) target.props = {};
|
|
49
73
|
const props = target.props;
|
|
50
74
|
if (props["data-key"] === void 0) props["data-key"] = String(inheritedKey);
|
|
75
|
+
if (props["data-askr-key-kind"] === void 0) props["data-askr-key-kind"] = typeof inheritedKey;
|
|
51
76
|
}
|
|
52
77
|
return target;
|
|
53
78
|
}
|
|
54
|
-
function
|
|
79
|
+
function setComponentOwnershipIdentity(instance, node, parent, wrapperDepth = 0, position) {
|
|
80
|
+
instance._vnodeOwner = typeof node === "object" && node !== null ? node : void 0;
|
|
81
|
+
instance._vnodeParent = parent;
|
|
82
|
+
const key = extractKey(node);
|
|
83
|
+
if (key === void 0) delete instance._vnodeKey;
|
|
84
|
+
else instance._vnodeKey = key;
|
|
85
|
+
instance._vnodePosition = position;
|
|
86
|
+
instance._wrapperDepth = wrapperDepth;
|
|
87
|
+
}
|
|
88
|
+
function findHostInstanceByType(host, type, node, parent, wrapperDepth) {
|
|
55
89
|
const instances = host.__ASKR_INSTANCES;
|
|
56
|
-
if (instances && instances.length > 0)
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
90
|
+
if (instances && instances.length > 0) {
|
|
91
|
+
const vnodeOwner = getVNodeComponentInstance(node);
|
|
92
|
+
if (vnodeOwner && vnodeOwner.fn === type && instances.includes(vnodeOwner)) return vnodeOwner;
|
|
93
|
+
const key = extractKey(node);
|
|
94
|
+
const identityMatches = instances.filter((instance) => {
|
|
95
|
+
if (instance.fn !== type) return false;
|
|
96
|
+
if (parent !== void 0 && instance._vnodeParent !== parent) return false;
|
|
97
|
+
if (key !== void 0 && instance._vnodeKey !== key) return false;
|
|
98
|
+
if (wrapperDepth !== void 0 && instance._wrapperDepth !== wrapperDepth) return false;
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
if (identityMatches.length === 1) return identityMatches[0];
|
|
102
|
+
if (identityMatches.length > 1 && key !== void 0) return identityMatches[identityMatches.length - 1];
|
|
103
|
+
const sameType = instances.filter((instance) => instance.fn === type);
|
|
104
|
+
if (sameType.length === 1) return sameType[0];
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
if (host.__ASKR_INSTANCE?.fn === type) {
|
|
108
|
+
const instance = host.__ASKR_INSTANCE;
|
|
109
|
+
const key = extractKey(node);
|
|
110
|
+
if ((parent === void 0 || instance._vnodeParent === parent) && (key === void 0 || instance._vnodeKey === key) && (wrapperDepth === void 0 || instance._wrapperDepth === wrapperDepth)) return instance;
|
|
111
|
+
if (node === void 0 && parent === void 0 && wrapperDepth === void 0) return instance;
|
|
59
112
|
}
|
|
60
|
-
return
|
|
113
|
+
return null;
|
|
61
114
|
}
|
|
62
115
|
//#endregion
|
|
63
|
-
export { findHostInstanceByType, getVNodeComponentInstance, inheritComponentCleanupStrict, inheritComponentKey, isRouteRootComponentVNode, nextComponentInstanceId, setVNodeComponentInstance };
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=component-host-instances.js.map
|
|
116
|
+
export { findHostInstanceByType, getVNodeComponentInstance, inheritComponentCleanupStrict, inheritComponentKey, isRouteRootComponentVNode, nextComponentInstanceId, restoreVNodeComponentInstance, setComponentOwnershipIdentity, setVNodeComponentInstance };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { cleanupComponent } from "../runtime/component-cleanup.js";
|
|
2
|
+
import { registerLifecycleRollback, registerLifecycleTransaction } from "../runtime/lifecycle-batch.js";
|
|
3
|
+
import "../runtime/index.js";
|
|
4
|
+
import { elementRefs, removeElementRef, updateElementRef } from "./cleanup.js";
|
|
5
|
+
import { cleanupDetachedComponentHost } from "./component-host-cleanup.js";
|
|
6
|
+
import { restoreVNodeComponentInstance } from "./component-host-instances.js";
|
|
7
|
+
//#region src/renderer/component-host-replacement.ts
|
|
8
|
+
function cleanupProvisionalComponentInstance(instance) {
|
|
9
|
+
try {
|
|
10
|
+
cleanupComponent(instance);
|
|
11
|
+
} catch {}
|
|
12
|
+
}
|
|
13
|
+
function cleanupProvisionalComponentInstances(instances) {
|
|
14
|
+
for (let index = instances.length - 1; index >= 0; index -= 1) cleanupProvisionalComponentInstance(instances[index]);
|
|
15
|
+
}
|
|
16
|
+
function createRetainedHostInstanceSet(owner, additional) {
|
|
17
|
+
const retained = /* @__PURE__ */ new Set([owner]);
|
|
18
|
+
for (const instance of additional ?? []) retained.add(instance);
|
|
19
|
+
return retained;
|
|
20
|
+
}
|
|
21
|
+
function cleanupReplacementNode(node, retainedInstance) {
|
|
22
|
+
if (node instanceof Element) {
|
|
23
|
+
cleanupDetachedComponentHost(node, retainedInstance);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
delete node.__ASKR_INSTANCE;
|
|
28
|
+
} catch {}
|
|
29
|
+
}
|
|
30
|
+
function beginComponentHostReplacement(existingHost, retainedInstance, previousTarget, retainedInstances = [retainedInstance], disposeOnRollback = false) {
|
|
31
|
+
const parent = existingHost.parentNode;
|
|
32
|
+
const previousRef = elementRefs.get(existingHost);
|
|
33
|
+
let previousRefDetached = false;
|
|
34
|
+
let nextDom = null;
|
|
35
|
+
let didReplace = false;
|
|
36
|
+
let replacementAttempted = false;
|
|
37
|
+
let finished = false;
|
|
38
|
+
const commit = () => {
|
|
39
|
+
if (finished) return;
|
|
40
|
+
finished = true;
|
|
41
|
+
if (replacementAttempted && didReplace) cleanupDetachedComponentHost(existingHost, retainedInstances);
|
|
42
|
+
};
|
|
43
|
+
const rollback = () => {
|
|
44
|
+
if (finished) return;
|
|
45
|
+
finished = true;
|
|
46
|
+
if (!replacementAttempted) return;
|
|
47
|
+
const rollbackErrors = [];
|
|
48
|
+
if (nextDom && nextDom !== existingHost) try {
|
|
49
|
+
cleanupReplacementNode(nextDom, retainedInstance);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
rollbackErrors.push(error);
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
if (disposeOnRollback) cleanupComponent(retainedInstance);
|
|
55
|
+
else retainedInstance.target = previousTarget;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
rollbackErrors.push(error);
|
|
58
|
+
}
|
|
59
|
+
if (previousRefDetached && previousRef) try {
|
|
60
|
+
updateElementRef(existingHost, previousRef);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
rollbackErrors.push(error);
|
|
63
|
+
}
|
|
64
|
+
if (rollbackErrors.length > 0) throw new AggregateError(rollbackErrors, "Component host replacement rollback failed");
|
|
65
|
+
};
|
|
66
|
+
const staged = registerLifecycleTransaction({}, commit, rollback);
|
|
67
|
+
const replace = (materialize, prepareNextDom) => {
|
|
68
|
+
replacementAttempted = true;
|
|
69
|
+
if (!staged && previousRef) {
|
|
70
|
+
removeElementRef(existingHost);
|
|
71
|
+
previousRefDetached = true;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
nextDom = materialize();
|
|
75
|
+
prepareNextDom(nextDom);
|
|
76
|
+
if (parent && nextDom !== existingHost) {
|
|
77
|
+
parent.replaceChild(nextDom, existingHost);
|
|
78
|
+
didReplace = true;
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (!staged) try {
|
|
82
|
+
rollback();
|
|
83
|
+
} catch {}
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
if (!staged) commit();
|
|
87
|
+
return nextDom;
|
|
88
|
+
};
|
|
89
|
+
return { replace };
|
|
90
|
+
}
|
|
91
|
+
function registerVNodeComponentInstanceRollback(node, previousInstance, provisionalInstance) {
|
|
92
|
+
let restored = false;
|
|
93
|
+
const restoreOwnership = () => {
|
|
94
|
+
if (restored) return;
|
|
95
|
+
restored = true;
|
|
96
|
+
restoreVNodeComponentInstance(node, previousInstance);
|
|
97
|
+
};
|
|
98
|
+
(provisionalInstance.cleanupFns ??= []).push(restoreOwnership);
|
|
99
|
+
registerLifecycleRollback(() => {
|
|
100
|
+
restoreOwnership();
|
|
101
|
+
cleanupProvisionalComponentInstance(provisionalInstance);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { beginComponentHostReplacement, cleanupProvisionalComponentInstance, cleanupProvisionalComponentInstances, createRetainedHostInstanceSet, registerVNodeComponentInstanceRollback };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { _isDOMElement } from "../common/vnode.js";
|
|
2
|
+
import "./types.js";
|
|
3
|
+
import { getVNodeContextFrame, markVNodeTreeWithContextFrame, withContext } from "../runtime/context.js";
|
|
4
|
+
import { getCurrentInstance } from "../runtime/component-scope.js";
|
|
5
|
+
import { cleanupComponent } from "../runtime/component-cleanup.js";
|
|
6
|
+
import { isPromiseLike } from "../common/promise.js";
|
|
7
|
+
import { captureInlineRenderSnapshot, createComponentInstance, mountInstanceInline, renderComponentInline, warnUnusedStateReads } from "../runtime/component-internal.js";
|
|
8
|
+
import "../runtime/index.js";
|
|
9
|
+
import { getRendererDOMHost } from "./dom-host.js";
|
|
10
|
+
import { findHostInstanceByType, getVNodeComponentInstance, inheritComponentCleanupStrict, isRouteRootComponentVNode, nextComponentInstanceId, restoreVNodeComponentInstance, setComponentOwnershipIdentity, setVNodeComponentInstance } from "./component-host-instances.js";
|
|
11
|
+
import { cleanupProvisionalComponentInstance, cleanupProvisionalComponentInstances, registerVNodeComponentInstanceRollback } from "./component-host-replacement.js";
|
|
12
|
+
//#region src/renderer/component-host-results.ts
|
|
13
|
+
function materializeComponentResultNode(childInstance, result, parentNamespace) {
|
|
14
|
+
const dom = getRendererDOMHost().createComponentResultNode(childInstance.fn, result, parentNamespace);
|
|
15
|
+
if (dom instanceof Element) {
|
|
16
|
+
mountInstanceInline(childInstance, dom);
|
|
17
|
+
return dom;
|
|
18
|
+
}
|
|
19
|
+
if (!dom) {
|
|
20
|
+
const placeholder = document.createComment("");
|
|
21
|
+
try {
|
|
22
|
+
placeholder.__ASKR_INSTANCE = childInstance;
|
|
23
|
+
} catch {}
|
|
24
|
+
childInstance._placeholder = placeholder;
|
|
25
|
+
mountInstanceInline(childInstance, null);
|
|
26
|
+
return placeholder;
|
|
27
|
+
}
|
|
28
|
+
const host = document.createElement("div");
|
|
29
|
+
host.appendChild(dom);
|
|
30
|
+
host.__ASKR_WRAPPER_HOST = true;
|
|
31
|
+
mountInstanceInline(childInstance, host);
|
|
32
|
+
return host;
|
|
33
|
+
}
|
|
34
|
+
function resolveNestedComponentResult(result, snapshot, parentInstance) {
|
|
35
|
+
let currentResult = result;
|
|
36
|
+
let activeSnapshot = snapshot;
|
|
37
|
+
let depth = 0;
|
|
38
|
+
while (_isDOMElement(currentResult) && typeof currentResult.type === "function" && depth < 16) {
|
|
39
|
+
const nestedSnapshot = getVNodeContextFrame(currentResult) ?? activeSnapshot;
|
|
40
|
+
const nestedInstance = createComponentInstance(nextComponentInstanceId(), currentResult.type, currentResult.props ?? {}, null);
|
|
41
|
+
nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);
|
|
42
|
+
nestedInstance.parentInstance = parentInstance;
|
|
43
|
+
nestedInstance.portalScope = parentInstance?.portalScope ?? nestedInstance.portalScope;
|
|
44
|
+
inheritComponentCleanupStrict(nestedInstance);
|
|
45
|
+
if (nestedSnapshot) nestedInstance.ownerFrame = nestedSnapshot;
|
|
46
|
+
let nextResult;
|
|
47
|
+
try {
|
|
48
|
+
nextResult = withContext(nestedSnapshot ?? null, () => renderComponentInline(nestedInstance));
|
|
49
|
+
if (isPromiseLike(nextResult)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
50
|
+
} catch (error) {
|
|
51
|
+
cleanupProvisionalComponentInstance(nestedInstance);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
cleanupComponent(nestedInstance);
|
|
55
|
+
activeSnapshot = nestedSnapshot ?? null;
|
|
56
|
+
currentResult = nextResult;
|
|
57
|
+
depth += 1;
|
|
58
|
+
}
|
|
59
|
+
return currentResult;
|
|
60
|
+
}
|
|
61
|
+
function resolveHostNestedComponentResult(host, retainedInstance, result, snapshot, retainedInstances) {
|
|
62
|
+
let currentResult = result;
|
|
63
|
+
let activeSnapshot = snapshot;
|
|
64
|
+
let depth = 0;
|
|
65
|
+
const createdInstances = [];
|
|
66
|
+
const createdVNodeOwners = [];
|
|
67
|
+
try {
|
|
68
|
+
while (_isDOMElement(currentResult) && typeof currentResult.type === "function" && depth < 16) {
|
|
69
|
+
const nestedVNode = currentResult;
|
|
70
|
+
const nestedSnapshot = getVNodeContextFrame(currentResult) ?? activeSnapshot;
|
|
71
|
+
let nestedInstance = findHostInstanceByType(host, currentResult.type, nestedVNode, retainedInstance, depth);
|
|
72
|
+
const hadNestedInstance = !!nestedInstance;
|
|
73
|
+
if (!nestedInstance) {
|
|
74
|
+
nestedInstance = createComponentInstance(nextComponentInstanceId(), currentResult.type, nestedVNode.props ?? {}, null);
|
|
75
|
+
createdInstances.push(nestedInstance);
|
|
76
|
+
const previous = getVNodeComponentInstance(nestedVNode);
|
|
77
|
+
createdVNodeOwners.push({
|
|
78
|
+
node: nestedVNode,
|
|
79
|
+
previous
|
|
80
|
+
});
|
|
81
|
+
registerVNodeComponentInstanceRollback(nestedVNode, previous, nestedInstance);
|
|
82
|
+
}
|
|
83
|
+
setComponentOwnershipIdentity(nestedInstance, nestedVNode, retainedInstance, depth);
|
|
84
|
+
if (hadNestedInstance) captureInlineRenderSnapshot(nestedInstance);
|
|
85
|
+
setVNodeComponentInstance(currentResult, nestedInstance);
|
|
86
|
+
nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);
|
|
87
|
+
nestedInstance.parentInstance = retainedInstance;
|
|
88
|
+
nestedInstance.portalScope = retainedInstance.portalScope ?? nestedInstance.portalScope;
|
|
89
|
+
inheritComponentCleanupStrict(nestedInstance);
|
|
90
|
+
nestedInstance.props = (nestedVNode.props ?? {}) || {};
|
|
91
|
+
if (nestedSnapshot) nestedInstance.ownerFrame = nestedSnapshot;
|
|
92
|
+
const nextResult = withContext(nestedSnapshot ?? null, () => renderComponentInline(nestedInstance));
|
|
93
|
+
if (isPromiseLike(nextResult)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
94
|
+
retainedInstances.add(nestedInstance);
|
|
95
|
+
warnUnusedStateReads(nestedInstance);
|
|
96
|
+
activeSnapshot = nestedSnapshot ?? null;
|
|
97
|
+
currentResult = markVNodeTreeWithContextFrame(nextResult, activeSnapshot);
|
|
98
|
+
depth += 1;
|
|
99
|
+
}
|
|
100
|
+
for (const instance of createdInstances) mountInstanceInline(instance, host);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
for (let index = createdVNodeOwners.length - 1; index >= 0; index -= 1) {
|
|
103
|
+
const owner = createdVNodeOwners[index];
|
|
104
|
+
restoreVNodeComponentInstance(owner.node, owner.previous);
|
|
105
|
+
}
|
|
106
|
+
cleanupProvisionalComponentInstances(createdInstances);
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
return currentResult;
|
|
110
|
+
}
|
|
111
|
+
function resolveWrapperHostResult(host, result, snapshot, retainedInstances) {
|
|
112
|
+
let currentResult = result;
|
|
113
|
+
let activeSnapshot = snapshot;
|
|
114
|
+
let depth = 0;
|
|
115
|
+
while (_isDOMElement(currentResult) && typeof currentResult.type === "function" && depth < 16) {
|
|
116
|
+
const nestedSnapshot = getVNodeContextFrame(currentResult) ?? activeSnapshot;
|
|
117
|
+
const nestedInstance = findHostInstanceByType(host, currentResult.type, currentResult, getCurrentInstance(), depth);
|
|
118
|
+
if (!nestedInstance) break;
|
|
119
|
+
captureInlineRenderSnapshot(nestedInstance);
|
|
120
|
+
setComponentOwnershipIdentity(nestedInstance, currentResult, getCurrentInstance(), depth);
|
|
121
|
+
nestedInstance.props = (currentResult.props ?? {}) || {};
|
|
122
|
+
nestedInstance.parentInstance = getCurrentInstance();
|
|
123
|
+
nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);
|
|
124
|
+
nestedInstance.portalScope = getCurrentInstance()?.portalScope ?? nestedInstance.portalScope;
|
|
125
|
+
inheritComponentCleanupStrict(nestedInstance);
|
|
126
|
+
if (nestedSnapshot) nestedInstance.ownerFrame = nestedSnapshot;
|
|
127
|
+
const nextResult = withContext(nestedSnapshot ?? null, () => renderComponentInline(nestedInstance));
|
|
128
|
+
if (isPromiseLike(nextResult)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
129
|
+
retainedInstances.add(nestedInstance);
|
|
130
|
+
warnUnusedStateReads(nestedInstance);
|
|
131
|
+
activeSnapshot = nestedSnapshot ?? null;
|
|
132
|
+
currentResult = nextResult;
|
|
133
|
+
depth += 1;
|
|
134
|
+
}
|
|
135
|
+
return markVNodeTreeWithContextFrame(currentResult, activeSnapshot);
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { materializeComponentResultNode, resolveHostNestedComponentResult, resolveNestedComponentResult, resolveWrapperHostResult };
|