@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,12 +1,26 @@
|
|
|
1
1
|
import { IntrinsicFallbackProps, KnownIntrinsicElementProps, Props } from "./common/props.js";
|
|
2
2
|
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "./common/jsx.js";
|
|
3
3
|
import { EagerControlPrimitive } from "./common/control.js";
|
|
4
|
+
|
|
4
5
|
//#region src/jsx/jsx-dev-runtime.d.ts
|
|
6
|
+
declare namespace JSX {
|
|
7
|
+
interface Element extends JSXElement {
|
|
8
|
+
readonly __askrJsxElementBrand?: never;
|
|
9
|
+
}
|
|
10
|
+
interface IntrinsicElements extends KnownIntrinsicElementProps {
|
|
11
|
+
[elem: string]: IntrinsicFallbackProps | KnownIntrinsicElementProps[keyof KnownIntrinsicElementProps];
|
|
12
|
+
}
|
|
13
|
+
interface ElementAttributesProperty {
|
|
14
|
+
props: Props;
|
|
15
|
+
}
|
|
16
|
+
interface ElementChildrenAttribute {
|
|
17
|
+
children: unknown;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
5
20
|
declare function jsxDEV(type: EagerControlPrimitive, props: Props | null, key?: string | number, isStaticChildren?: boolean): unknown;
|
|
6
21
|
declare function jsxDEV<TTag extends keyof KnownIntrinsicElementProps>(type: TTag, props: KnownIntrinsicElementProps[TTag] | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
7
22
|
declare function jsxDEV<TTag extends string>(type: Exclude<TTag, keyof KnownIntrinsicElementProps>, props: IntrinsicFallbackProps | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
8
23
|
declare function jsxDEV<TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
9
24
|
declare function jsxDEV(type: symbol, props: Props | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
10
25
|
//#endregion
|
|
11
|
-
export { Fragment, type JSXComponent, type JSXElement, type JSXElementType, jsxDEV };
|
|
12
|
-
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
26
|
+
export { Fragment, JSX, type JSXComponent, type JSXElement, type JSXElementType, jsxDEV };
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { isEagerControlPrimitive } from "./common/control.js";
|
|
2
|
-
import { ELEMENT_TYPE, Fragment
|
|
3
|
-
import
|
|
2
|
+
import { ELEMENT_TYPE, Fragment } from "./common/jsx.js";
|
|
3
|
+
import "./runtime/readable.js";
|
|
4
|
+
import "./runtime/index.js";
|
|
4
5
|
import "./jsx/types.js";
|
|
5
|
-
//#region src/jsx/jsx-dev-runtime.ts
|
|
6
6
|
function annotatePropsUsage(props) {
|
|
7
|
-
|
|
8
|
-
for (const value of Object.values(normalizedProps)) markReadableUsage(value);
|
|
9
|
-
return normalizedProps;
|
|
7
|
+
return props ?? {};
|
|
10
8
|
}
|
|
11
9
|
function markStaticChildren(props) {
|
|
12
|
-
if (Array.isArray(props.children)) Object.defineProperty(props.children, STATIC_CHILDREN, {
|
|
13
|
-
value: true,
|
|
14
|
-
configurable: true
|
|
15
|
-
});
|
|
16
10
|
return props;
|
|
17
11
|
}
|
|
18
12
|
function jsxDEV(type, props, key, isStaticChildren = false) {
|
|
@@ -28,5 +22,3 @@ function jsxDEV(type, props, key, isStaticChildren = false) {
|
|
|
28
22
|
}
|
|
29
23
|
//#endregion
|
|
30
24
|
export { Fragment, jsxDEV };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=jsx-dev-runtime.js.map
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import { IntrinsicFallbackProps, KnownIntrinsicElementProps, Props } from "./common/props.js";
|
|
2
2
|
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "./common/jsx.js";
|
|
3
3
|
import { EagerControlPrimitive } from "./common/control.js";
|
|
4
|
+
|
|
4
5
|
//#region src/jsx/jsx-runtime.d.ts
|
|
6
|
+
declare namespace JSX {
|
|
7
|
+
interface Element extends JSXElement {
|
|
8
|
+
readonly __askrJsxElementBrand?: never;
|
|
9
|
+
}
|
|
10
|
+
interface IntrinsicElements extends KnownIntrinsicElementProps {
|
|
11
|
+
[elem: string]: IntrinsicFallbackProps | KnownIntrinsicElementProps[keyof KnownIntrinsicElementProps];
|
|
12
|
+
}
|
|
13
|
+
interface ElementAttributesProperty {
|
|
14
|
+
props: Props;
|
|
15
|
+
}
|
|
16
|
+
interface ElementChildrenAttribute {
|
|
17
|
+
children: unknown;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
5
20
|
declare function jsxDEV(type: EagerControlPrimitive, props: Props | null, key?: string | number, isStaticChildren?: boolean): unknown;
|
|
6
21
|
declare function jsxDEV<TTag extends keyof KnownIntrinsicElementProps>(type: TTag, props: KnownIntrinsicElementProps[TTag] | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
7
22
|
declare function jsxDEV<TTag extends string>(type: Exclude<TTag, keyof KnownIntrinsicElementProps>, props: IntrinsicFallbackProps | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
@@ -18,5 +33,4 @@ declare function jsxs<TTag extends string>(type: Exclude<TTag, keyof KnownIntrin
|
|
|
18
33
|
declare function jsxs<TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number): JSXElement;
|
|
19
34
|
declare function jsxs(type: symbol, props: Props | null, key?: string | number): JSXElement;
|
|
20
35
|
//#endregion
|
|
21
|
-
export { Fragment, type JSXComponent, type JSXElement, type JSXElementType, jsx, jsxDEV, jsxs };
|
|
22
|
-
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
36
|
+
export { Fragment, JSX, type JSXComponent, type JSXElement, type JSXElementType, jsx, jsxDEV, jsxs };
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,37 +1,31 @@
|
|
|
1
1
|
import { isEagerControlPrimitive } from "./common/control.js";
|
|
2
|
-
import { ELEMENT_TYPE, Fragment
|
|
3
|
-
import
|
|
2
|
+
import { ELEMENT_TYPE, Fragment } from "./common/jsx.js";
|
|
3
|
+
import "./runtime/readable.js";
|
|
4
|
+
import "./runtime/index.js";
|
|
4
5
|
import "./jsx/types.js";
|
|
5
|
-
//#region src/jsx/jsx-runtime.ts
|
|
6
|
-
function annotatePropsUsage(props) {
|
|
7
|
-
const normalizedProps = props ?? {};
|
|
8
|
-
for (const value of Object.values(normalizedProps)) markReadableUsage(value);
|
|
9
|
-
return normalizedProps;
|
|
10
|
-
}
|
|
11
|
-
function markStaticChildren(props) {
|
|
12
|
-
if (Array.isArray(props.children)) Object.defineProperty(props.children, STATIC_CHILDREN, {
|
|
13
|
-
value: true,
|
|
14
|
-
configurable: true
|
|
15
|
-
});
|
|
16
|
-
return props;
|
|
17
|
-
}
|
|
18
6
|
function jsxDEV(type, props, key, isStaticChildren = false) {
|
|
19
|
-
const normalizedProps =
|
|
20
|
-
|
|
21
|
-
if (isEagerControlPrimitive(type)) return type(preparedProps);
|
|
7
|
+
const normalizedProps = props ?? {};
|
|
8
|
+
if (typeof type === "function" && isEagerControlPrimitive(type)) return type(normalizedProps);
|
|
22
9
|
return {
|
|
23
10
|
$$typeof: ELEMENT_TYPE,
|
|
24
11
|
type,
|
|
25
|
-
props:
|
|
12
|
+
props: normalizedProps,
|
|
26
13
|
key: key ?? null
|
|
27
14
|
};
|
|
28
15
|
}
|
|
29
16
|
function jsx(type, props, key) {
|
|
30
|
-
|
|
17
|
+
const normalizedProps = props ?? {};
|
|
18
|
+
if (typeof type === "function" && isEagerControlPrimitive(type)) return type(normalizedProps);
|
|
19
|
+
return {
|
|
20
|
+
$$typeof: ELEMENT_TYPE,
|
|
21
|
+
type,
|
|
22
|
+
props: normalizedProps,
|
|
23
|
+
key: key ?? null
|
|
24
|
+
};
|
|
31
25
|
}
|
|
32
26
|
function jsxs(type, props, key) {
|
|
33
|
-
const normalizedProps =
|
|
34
|
-
if (isEagerControlPrimitive(type)) return type(normalizedProps);
|
|
27
|
+
const normalizedProps = props ?? {};
|
|
28
|
+
if (typeof type === "function" && isEagerControlPrimitive(type)) return type(normalizedProps);
|
|
35
29
|
return {
|
|
36
30
|
$$typeof: ELEMENT_TYPE,
|
|
37
31
|
type,
|
|
@@ -41,5 +35,3 @@ function jsxs(type, props, key) {
|
|
|
41
35
|
}
|
|
42
36
|
//#endregion
|
|
43
37
|
export { Fragment, jsx, jsxDEV, jsxs };
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=jsx-runtime.js.map
|
package/dist/jsx-runtime2.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { incrementPerfMetric } from "../runtime/perf-metrics.js";
|
|
2
|
+
import "../runtime/index.js";
|
|
2
3
|
import { extractKey, getRenderedAttributeName, isSkippedProp, parseEventName, readElementClassName, removeRenderedAttribute, setRenderedAttribute, tagNamesEqualIgnoreCase, writeElementClassName } from "./utils.js";
|
|
3
4
|
function applyFormControlProp(el, key, value, tagName) {
|
|
4
5
|
if (key === "value") {
|
|
@@ -173,7 +174,10 @@ function applyScalarPropValue(el, key, value, tagName, previousValue, descriptor
|
|
|
173
174
|
}
|
|
174
175
|
function removeStaleAttributes(el, vnode, props) {
|
|
175
176
|
const desiredAttributes = /* @__PURE__ */ new Set();
|
|
176
|
-
if (extractKey(vnode) !== void 0)
|
|
177
|
+
if (extractKey(vnode) !== void 0) {
|
|
178
|
+
desiredAttributes.add("data-key");
|
|
179
|
+
desiredAttributes.add("data-askr-key-kind");
|
|
180
|
+
}
|
|
177
181
|
for (const propName in props) {
|
|
178
182
|
if (isSkippedProp(propName)) continue;
|
|
179
183
|
if (parseEventName(propName)) continue;
|
|
@@ -189,15 +193,30 @@ function materializeKey(el, vnode, props) {
|
|
|
189
193
|
if (vnodeKey !== void 0) {
|
|
190
194
|
const nextKey = String(vnodeKey);
|
|
191
195
|
if (el.getAttribute("data-key") !== nextKey) el.setAttribute("data-key", nextKey);
|
|
196
|
+
const keyKind = typeof vnodeKey;
|
|
197
|
+
if (el.getAttribute("data-askr-key-kind") !== keyKind) el.setAttribute("data-askr-key-kind", keyKind);
|
|
192
198
|
}
|
|
193
199
|
}
|
|
194
|
-
|
|
200
|
+
/** @internal Materialize keyed metadata on a newly created or cloned node. */
|
|
201
|
+
function materializeFreshKey(el, vnode, props) {
|
|
202
|
+
const rawKey = vnode.key ?? props.key;
|
|
203
|
+
if (rawKey === null || rawKey === void 0) return;
|
|
204
|
+
const vnodeKey = typeof rawKey === "symbol" ? String(rawKey) : rawKey;
|
|
205
|
+
el.setAttribute("data-key", String(vnodeKey));
|
|
206
|
+
const keyKind = typeof vnodeKey;
|
|
207
|
+
if (el.getAttribute("data-askr-key-kind") !== keyKind) el.setAttribute("data-askr-key-kind", keyKind);
|
|
208
|
+
}
|
|
209
|
+
function hasMatchingStaticPropsInternal(el, props, vnodeType, ignoreEventProps) {
|
|
195
210
|
let staticPropCount = 0;
|
|
196
211
|
for (const key in props) {
|
|
197
212
|
if (isSkippedProp(key)) continue;
|
|
198
213
|
const value = props[key];
|
|
199
214
|
if (value === void 0 || value === null || value === false) return false;
|
|
200
|
-
if (parseEventName(key)
|
|
215
|
+
if (parseEventName(key)) {
|
|
216
|
+
if (ignoreEventProps) continue;
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
if (typeof value === "function") return false;
|
|
201
220
|
if (key === "class" || key === "className") {
|
|
202
221
|
if (readElementClassName(el) !== String(value)) return false;
|
|
203
222
|
staticPropCount += 1;
|
|
@@ -225,7 +244,11 @@ function hasMatchingStaticProps(el, props, vnodeType) {
|
|
|
225
244
|
}
|
|
226
245
|
return el.attributes.length === staticPropCount;
|
|
227
246
|
}
|
|
247
|
+
function hasMatchingStaticProps(el, props, vnodeType) {
|
|
248
|
+
return hasMatchingStaticPropsInternal(el, props, vnodeType, false);
|
|
249
|
+
}
|
|
250
|
+
function hasMatchingStaticPropsIgnoringEvents(el, props, vnodeType) {
|
|
251
|
+
return hasMatchingStaticPropsInternal(el, props, vnodeType, true);
|
|
252
|
+
}
|
|
228
253
|
//#endregion
|
|
229
|
-
export { applyClassPropValue, applyFormControlProp, applyScalarPropValue, applyStaticScalarPropsToElement, applyStylePropValue, hasMatchingStaticProps, materializeKey, removeStaleAttributes };
|
|
230
|
-
|
|
231
|
-
//# sourceMappingURL=attributes.js.map
|
|
254
|
+
export { applyClassPropValue, applyFormControlProp, applyScalarPropValue, applyStaticScalarPropsToElement, applyStylePropValue, hasMatchingStaticProps, hasMatchingStaticPropsIgnoringEvents, materializeFreshKey, materializeKey, removeStaleAttributes };
|
|
@@ -1,87 +1,29 @@
|
|
|
1
|
-
import { __FOR_BOUNDARY__
|
|
2
|
-
import "./types.js";
|
|
1
|
+
import { __FOR_BOUNDARY__ } from "../common/vnode.js";
|
|
3
2
|
import { getRuntimeEnv } from "../common/env.js";
|
|
4
|
-
import { logger } from "../dev/logger.js";
|
|
5
3
|
import { enqueueRuntimeTask } from "../runtime/access.js";
|
|
4
|
+
import { beginLifecycleCommitBatch, discardLifecycleCommitBatch, flushLifecycleCommitBatch } from "../runtime/lifecycle-batch.js";
|
|
5
|
+
import { recordBenchEvent } from "../runtime/for-bench.js";
|
|
6
|
+
import "../runtime/index.js";
|
|
6
7
|
import { teardownNodeSubtree } from "./cleanup.js";
|
|
7
8
|
import "./env.js";
|
|
8
|
-
import { tagNamesEqualIgnoreCase } from "./utils.js";
|
|
9
9
|
import { keyedElements } from "./keyed.js";
|
|
10
|
-
import {
|
|
11
|
-
import { clearForDomUpdateState, evaluateForState } from "../runtime/for-internal.js";
|
|
12
|
-
import "../runtime/for.js";
|
|
13
|
-
import { clearCaseDomUpdateState, clearShowDomUpdateState, evaluateCaseState, evaluateShowState } from "../runtime/control.js";
|
|
10
|
+
import { getRangeNodes, insertRangeBefore, rangeContains, removeRange } from "./dom-range.js";
|
|
14
11
|
import { commitForStateBoundaryChildren } from "./for-commit.js";
|
|
15
|
-
import {
|
|
12
|
+
import { configureBoundaryRangeHost } from "./boundary-range-adoption.js";
|
|
13
|
+
import { syncControlBoundaryInMixedParent, syncControlBoundaryScopeDom, syncControlBoundaryScopeNode } from "./boundary-range-sync.js";
|
|
14
|
+
import { clearControlBoundaryDomUpdateState, evaluateControlBoundaryState, getControlBoundaryCommitChildren, getControlBoundaryState, getDirectControlBoundaryVNode } from "./boundary-state.js";
|
|
15
|
+
import { createForBoundary } from "./boundary-materialization.js";
|
|
16
16
|
//#region src/renderer/boundaries.ts
|
|
17
17
|
let boundaryDOMHost = null;
|
|
18
18
|
const controlBoundaryOwners = /* @__PURE__ */ new WeakMap();
|
|
19
19
|
function configureBoundaryDOMHost(host) {
|
|
20
20
|
boundaryDOMHost = host;
|
|
21
|
+
configureBoundaryRangeHost(host);
|
|
21
22
|
}
|
|
22
23
|
function getBoundaryDOMHost() {
|
|
23
24
|
if (!boundaryDOMHost) throw new Error("[askr] Control boundary DOM host is not configured.");
|
|
24
25
|
return boundaryDOMHost;
|
|
25
26
|
}
|
|
26
|
-
function checkVNodeShapeChanged(dom, vnode) {
|
|
27
|
-
if (!_isDOMElement(vnode)) return true;
|
|
28
|
-
if (!(dom instanceof Element)) return true;
|
|
29
|
-
const vnodeType = vnode.type;
|
|
30
|
-
if (typeof vnodeType !== "string") return true;
|
|
31
|
-
return dom.tagName.toLowerCase() !== vnodeType.toLowerCase();
|
|
32
|
-
}
|
|
33
|
-
function materializeChildScopeDom(vnode, parentNamespace) {
|
|
34
|
-
if (vnode === null || vnode === void 0 || vnode === false) return document.createComment("");
|
|
35
|
-
const dom = getBoundaryDOMHost().createDOMNode(vnode, parentNamespace);
|
|
36
|
-
if (!(dom instanceof DocumentFragment)) return dom;
|
|
37
|
-
const firstChild = dom.firstChild;
|
|
38
|
-
const secondChild = firstChild?.nextSibling ?? null;
|
|
39
|
-
if (!firstChild) return document.createComment("");
|
|
40
|
-
if (secondChild) throw new Error("[askr] Child scopes must render a single DOM root node.");
|
|
41
|
-
return firstChild;
|
|
42
|
-
}
|
|
43
|
-
function evaluateControlBoundaryState(controlState) {
|
|
44
|
-
if (controlState.kind === "for") return evaluateForState(controlState);
|
|
45
|
-
if (controlState.kind === "show") return evaluateShowState(controlState);
|
|
46
|
-
return evaluateCaseState(controlState);
|
|
47
|
-
}
|
|
48
|
-
function clearControlBoundaryDomUpdateState(controlState) {
|
|
49
|
-
if (controlState.kind === "for") {
|
|
50
|
-
clearForDomUpdateState(controlState);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (controlState.kind === "show") {
|
|
54
|
-
clearShowDomUpdateState(controlState);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
clearCaseDomUpdateState(controlState);
|
|
58
|
-
}
|
|
59
|
-
function getControlBoundaryState(node) {
|
|
60
|
-
return node._controlState ?? node._forState ?? null;
|
|
61
|
-
}
|
|
62
|
-
function getDirectControlBoundaryVNode(children) {
|
|
63
|
-
if (!Array.isArray(children) && _isDOMElement(children) && children.type === __FOR_BOUNDARY__) return children;
|
|
64
|
-
if (Array.isArray(children) && children.length === 1 && _isDOMElement(children[0]) && children[0].type === __FOR_BOUNDARY__) return children[0];
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
function getControlBoundaryCommitChildren(controlState) {
|
|
68
|
-
if (controlState.kind === "for" && controlState._needsSourceReconcile) return evaluateForState(controlState);
|
|
69
|
-
if (controlState.kind !== "for") {
|
|
70
|
-
const activeVNode = controlState.activeScope?.vnode;
|
|
71
|
-
return activeVNode == null || activeVNode === false ? [] : [activeVNode];
|
|
72
|
-
}
|
|
73
|
-
if (controlState.orderedKeys.length === 0) {
|
|
74
|
-
const fallbackVNode = controlState.fallbackScope?.vnode;
|
|
75
|
-
return fallbackVNode == null || fallbackVNode === false ? [] : [fallbackVNode];
|
|
76
|
-
}
|
|
77
|
-
const childrenVNodes = [];
|
|
78
|
-
for (let index = 0; index < controlState.orderedKeys.length; index += 1) {
|
|
79
|
-
const itemKey = controlState.orderedKeys[index];
|
|
80
|
-
const itemInstance = controlState.items.get(itemKey);
|
|
81
|
-
childrenVNodes.push(itemInstance?.scope.vnode ?? null);
|
|
82
|
-
}
|
|
83
|
-
return childrenVNodes;
|
|
84
|
-
}
|
|
85
27
|
function clearControlBoundaryCommitOwner(parent) {
|
|
86
28
|
const owner = controlBoundaryOwners.get(parent);
|
|
87
29
|
if (owner) {
|
|
@@ -109,110 +51,30 @@ function registerControlBoundaryCommitOwner(parent, controlState) {
|
|
|
109
51
|
enqueueRuntimeTask(() => {
|
|
110
52
|
controlState._hasPendingBoundaryCommit = false;
|
|
111
53
|
if (controlBoundaryOwners.get(parent) !== controlState) return;
|
|
112
|
-
|
|
54
|
+
const lifecycleBatch = beginLifecycleCommitBatch();
|
|
55
|
+
try {
|
|
56
|
+
commitForBoundaryChildren(parent, controlState, getControlBoundaryCommitChildren(controlState));
|
|
57
|
+
flushLifecycleCommitBatch(lifecycleBatch);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
discardLifecycleCommitBatch(lifecycleBatch);
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
113
62
|
});
|
|
114
63
|
};
|
|
115
64
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Create DOM from For/Show/Case control boundaries.
|
|
118
|
-
*
|
|
119
|
-
* DOM order is reconstructed from the current vnode list on every render.
|
|
120
|
-
* Reusing DOM nodes never implies preserving their position; appending an
|
|
121
|
-
* existing node to the fragment expresses reordering per the DOM spec.
|
|
122
|
-
*/
|
|
123
|
-
function createForBoundary(node, props, parentNamespace) {
|
|
124
|
-
const controlState = getControlBoundaryState(node);
|
|
125
|
-
if (!controlState) {
|
|
126
|
-
if (getRuntimeEnv().NODE_ENV !== "production") logger.warn("[Askr] Control boundary missing state");
|
|
127
|
-
return document.createDocumentFragment();
|
|
128
|
-
}
|
|
129
|
-
const childrenVNodes = evaluateControlBoundaryState(controlState);
|
|
130
|
-
const fragment = document.createDocumentFragment();
|
|
131
|
-
if (controlState.kind !== "for") {
|
|
132
|
-
const activeScope = controlState.activeScope;
|
|
133
|
-
const vnode = childrenVNodes[0];
|
|
134
|
-
if (activeScope && vnode !== void 0) {
|
|
135
|
-
const dom = materializeChildScopeDom(vnode, parentNamespace);
|
|
136
|
-
activeScope.dom = dom ?? void 0;
|
|
137
|
-
if (dom) fragment.appendChild(dom);
|
|
138
|
-
}
|
|
139
|
-
clearControlBoundaryDomUpdateState(controlState);
|
|
140
|
-
return fragment;
|
|
141
|
-
}
|
|
142
|
-
const forState = controlState;
|
|
143
|
-
if (forState.orderedKeys.length === 0) {
|
|
144
|
-
const fallbackScope = forState.fallbackScope;
|
|
145
|
-
const fallbackVNode = childrenVNodes[0];
|
|
146
|
-
if (fallbackScope && fallbackVNode !== void 0) {
|
|
147
|
-
const dom = materializeChildScopeDom(fallbackVNode, parentNamespace);
|
|
148
|
-
fallbackScope.dom = dom ?? void 0;
|
|
149
|
-
if (dom) fragment.appendChild(dom);
|
|
150
|
-
}
|
|
151
|
-
clearControlBoundaryDomUpdateState(controlState);
|
|
152
|
-
return fragment;
|
|
153
|
-
}
|
|
154
|
-
for (let i = 0; i < childrenVNodes.length; i++) {
|
|
155
|
-
const childVNode = childrenVNodes[i];
|
|
156
|
-
const itemKey = forState.orderedKeys[i];
|
|
157
|
-
const itemInstance = itemKey != null ? forState.items.get(itemKey) : null;
|
|
158
|
-
let dom = null;
|
|
159
|
-
if (itemInstance && itemInstance.scope.dom) {
|
|
160
|
-
const cachedDom = itemInstance.scope.dom;
|
|
161
|
-
if (!checkVNodeShapeChanged(cachedDom, childVNode)) dom = cachedDom;
|
|
162
|
-
}
|
|
163
|
-
if (!dom) {
|
|
164
|
-
dom = materializeChildScopeDom(childVNode, parentNamespace);
|
|
165
|
-
if (itemInstance) itemInstance.scope.dom = dom ?? void 0;
|
|
166
|
-
}
|
|
167
|
-
if (dom) fragment.appendChild(dom);
|
|
168
|
-
}
|
|
169
|
-
clearControlBoundaryDomUpdateState(controlState);
|
|
170
|
-
return fragment;
|
|
171
|
-
}
|
|
172
|
-
function syncControlBoundaryScopeDom(parent, scope, vnode) {
|
|
173
|
-
let dom = scope.dom ?? null;
|
|
174
|
-
const parentNamespace = getParentNamespace(parent);
|
|
175
|
-
const host = getBoundaryDOMHost();
|
|
176
|
-
if (_isDOMElement(vnode) && typeof vnode.type === "function") {
|
|
177
|
-
const syncedComponentDom = host.syncComponentElement(dom, vnode, vnode.type, vnode.props ?? {}, parentNamespace);
|
|
178
|
-
if (syncedComponentDom) {
|
|
179
|
-
scope.dom = syncedComponentDom ?? void 0;
|
|
180
|
-
return syncedComponentDom;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (!dom) {
|
|
184
|
-
dom = materializeChildScopeDom(vnode, parentNamespace);
|
|
185
|
-
scope.dom = dom ?? void 0;
|
|
186
|
-
return dom;
|
|
187
|
-
}
|
|
188
|
-
if (dom.nodeType === 3 && (typeof vnode === "string" || typeof vnode === "number")) {
|
|
189
|
-
dom.data = String(vnode);
|
|
190
|
-
return dom;
|
|
191
|
-
}
|
|
192
|
-
if (dom.nodeType === 8 && (vnode === null || vnode === void 0 || vnode === false)) return dom;
|
|
193
|
-
if (dom instanceof Element && _isDOMElement(vnode) && typeof vnode.type === "string" && tagNamesEqualIgnoreCase(dom.tagName, vnode.type)) {
|
|
194
|
-
host.updateElementFromVnode(dom, vnode, true);
|
|
195
|
-
return dom;
|
|
196
|
-
}
|
|
197
|
-
const nextDom = materializeChildScopeDom(vnode, parentNamespace);
|
|
198
|
-
if (!nextDom) {
|
|
199
|
-
if (dom.parentNode === parent) {
|
|
200
|
-
teardownNodeSubtree(dom);
|
|
201
|
-
dom.parentNode.removeChild(dom);
|
|
202
|
-
}
|
|
203
|
-
scope.dom = void 0;
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
if (dom.parentNode === parent) parent.replaceChild(nextDom, dom);
|
|
207
|
-
teardownNodeSubtree(dom);
|
|
208
|
-
scope.dom = nextDom;
|
|
209
|
-
return nextDom;
|
|
210
|
-
}
|
|
211
65
|
function commitForBoundaryChildren(parent, controlState, childrenVNodes) {
|
|
212
66
|
if (controlState.kind !== "for") {
|
|
213
67
|
const activeScope = controlState.activeScope;
|
|
214
68
|
const activeVNode = childrenVNodes[0];
|
|
215
|
-
const nextDom = activeScope && activeVNode !== void 0 ? syncControlBoundaryScopeDom(parent, activeScope, activeVNode) : null;
|
|
69
|
+
const nextDom = activeScope && activeVNode !== void 0 ? syncControlBoundaryScopeDom(parent, activeScope, activeVNode, parent.firstChild, controlState.lastRemovedRanges.length === 0) : null;
|
|
70
|
+
for (const removedRange of controlState.lastRemovedRanges) removeRange(removedRange, (node) => {
|
|
71
|
+
if (!removedRange.single && (node === removedRange.start || node === removedRange.end)) {
|
|
72
|
+
node.parentNode?.removeChild(node);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
teardownNodeSubtree(node);
|
|
76
|
+
node.parentNode?.removeChild(node);
|
|
77
|
+
});
|
|
216
78
|
for (let i = 0; i < controlState.lastRemovedNodes.length; i++) {
|
|
217
79
|
const removedNode = controlState.lastRemovedNodes[i];
|
|
218
80
|
if (removedNode instanceof Element) teardownNodeSubtree(removedNode);
|
|
@@ -222,7 +84,14 @@ function commitForBoundaryChildren(parent, controlState, childrenVNodes) {
|
|
|
222
84
|
}
|
|
223
85
|
}
|
|
224
86
|
if (nextDom) {
|
|
225
|
-
if (parent.childNodes.length !== 1 || parent.firstChild !== nextDom || controlState.lastRemovedNodes.length > 0
|
|
87
|
+
if (parent.childNodes.length !== (nextDom.single ? 1 : getRangeNodes(nextDom).length + 2) || parent.firstChild !== nextDom.start || controlState.lastRemovedNodes.length > 0 || controlState.lastRemovedRanges.length > 0) {
|
|
88
|
+
const nodes = nextDom.single ? [nextDom.start] : [
|
|
89
|
+
nextDom.start,
|
|
90
|
+
...getRangeNodes(nextDom),
|
|
91
|
+
nextDom.end
|
|
92
|
+
];
|
|
93
|
+
parent.replaceChildren(...nodes);
|
|
94
|
+
}
|
|
226
95
|
} else if (parent.firstChild) parent.textContent = "";
|
|
227
96
|
keyedElements.delete(parent);
|
|
228
97
|
clearControlBoundaryDomUpdateState(controlState);
|
|
@@ -230,7 +99,7 @@ function commitForBoundaryChildren(parent, controlState, childrenVNodes) {
|
|
|
230
99
|
}
|
|
231
100
|
commitForStateBoundaryChildren(parent, controlState, childrenVNodes, {
|
|
232
101
|
isProduction: () => getRuntimeEnv().NODE_ENV === "production",
|
|
233
|
-
syncForItemDom:
|
|
102
|
+
syncForItemDom: syncControlBoundaryScopeNode,
|
|
234
103
|
tryPatchStableForDirtyItem: (scope) => getBoundaryDOMHost().tryPatchStableForDirtyItem(scope)
|
|
235
104
|
});
|
|
236
105
|
}
|
|
@@ -242,17 +111,26 @@ function trySyncControlBoundaryChild(parent, currentNode, next) {
|
|
|
242
111
|
const activeScope = controlState.activeScope;
|
|
243
112
|
const activeVNode = childrenVNodes[0];
|
|
244
113
|
const nextDom = activeScope && activeVNode !== void 0 ? syncControlBoundaryScopeDom(parent, activeScope, activeVNode) : null;
|
|
114
|
+
for (const removedRange of controlState.lastRemovedRanges) removeRange(removedRange, (node) => {
|
|
115
|
+
if (!removedRange.single && (node === removedRange.start || node === removedRange.end)) {
|
|
116
|
+
node.parentNode?.removeChild(node);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
teardownNodeSubtree(node);
|
|
120
|
+
node.parentNode?.removeChild(node);
|
|
121
|
+
});
|
|
245
122
|
for (let i = 0; i < controlState.lastRemovedNodes.length; i++) {
|
|
246
123
|
const removedNode = controlState.lastRemovedNodes[i];
|
|
247
124
|
if (removedNode.parentNode !== parent) continue;
|
|
248
125
|
teardownNodeSubtree(removedNode);
|
|
249
|
-
if (nextDom && nextDom
|
|
126
|
+
if (nextDom && !rangeContains(nextDom, removedNode) && !nextDom.start.parentNode) insertRangeBefore(parent, nextDom, removedNode);
|
|
250
127
|
else parent.removeChild(removedNode);
|
|
251
128
|
}
|
|
252
|
-
if (nextDom &&
|
|
129
|
+
if (nextDom && nextDom.start.parentNode !== parent) if (currentNode?.parentNode === parent && !rangeContains(nextDom, currentNode)) {
|
|
253
130
|
teardownNodeSubtree(currentNode);
|
|
254
|
-
parent
|
|
255
|
-
|
|
131
|
+
insertRangeBefore(parent, nextDom, currentNode);
|
|
132
|
+
currentNode.parentNode?.removeChild(currentNode);
|
|
133
|
+
} else insertRangeBefore(parent, nextDom);
|
|
256
134
|
else if (!nextDom && currentNode?.parentNode === parent) {
|
|
257
135
|
teardownNodeSubtree(currentNode);
|
|
258
136
|
parent.removeChild(currentNode);
|
|
@@ -261,6 +139,4 @@ function trySyncControlBoundaryChild(parent, currentNode, next) {
|
|
|
261
139
|
return true;
|
|
262
140
|
}
|
|
263
141
|
//#endregion
|
|
264
|
-
export { clearControlBoundaryCommitOwner, commitForBoundaryChildren, configureBoundaryDOMHost, createForBoundary, evaluateControlBoundaryState, getControlBoundaryState, getDirectControlBoundaryVNode, registerControlBoundaryCommitOwner, syncControlBoundaryScopeDom, trySyncControlBoundaryChild };
|
|
265
|
-
|
|
266
|
-
//# sourceMappingURL=boundaries.js.map
|
|
142
|
+
export { clearControlBoundaryCommitOwner, commitForBoundaryChildren, configureBoundaryDOMHost, createForBoundary, evaluateControlBoundaryState, getControlBoundaryState, getDirectControlBoundaryVNode, registerControlBoundaryCommitOwner, syncControlBoundaryInMixedParent, syncControlBoundaryScopeDom, trySyncControlBoundaryChild };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { getRuntimeEnv } from "../common/env.js";
|
|
2
|
+
import { logger } from "../common/logger.js";
|
|
3
|
+
import "./env.js";
|
|
4
|
+
import { appendRange } from "./dom-range.js";
|
|
5
|
+
import { assignScopeRange, checkVNodeShapeChanged, materializeChildScopeRange } from "./boundary-range-adoption.js";
|
|
6
|
+
import { clearControlBoundaryDomUpdateState, evaluateControlBoundaryState, getControlBoundaryState } from "./boundary-state.js";
|
|
7
|
+
//#region src/renderer/boundary-materialization.ts
|
|
8
|
+
/**
|
|
9
|
+
* Create DOM from For/Show/Case control boundaries.
|
|
10
|
+
*
|
|
11
|
+
* DOM order is reconstructed from the current vnode list on every render.
|
|
12
|
+
* Reusing DOM nodes never implies preserving their position; appending an
|
|
13
|
+
* existing node to the fragment expresses reordering per the DOM spec.
|
|
14
|
+
*/
|
|
15
|
+
function createForBoundary(node, props, parentNamespace) {
|
|
16
|
+
const controlState = getControlBoundaryState(node);
|
|
17
|
+
if (!controlState) {
|
|
18
|
+
if (getRuntimeEnv().NODE_ENV !== "production") logger.warn("[Askr] Control boundary missing state");
|
|
19
|
+
return document.createDocumentFragment();
|
|
20
|
+
}
|
|
21
|
+
const childrenVNodes = evaluateControlBoundaryState(controlState);
|
|
22
|
+
const fragment = document.createDocumentFragment();
|
|
23
|
+
if (controlState.kind !== "for") {
|
|
24
|
+
const activeScope = controlState.activeScope;
|
|
25
|
+
const vnode = childrenVNodes[0];
|
|
26
|
+
if (activeScope && vnode !== void 0) {
|
|
27
|
+
const range = materializeChildScopeRange(vnode, parentNamespace, activeScope);
|
|
28
|
+
assignScopeRange(activeScope, range);
|
|
29
|
+
activeScope.hydrationPending = false;
|
|
30
|
+
appendRange(fragment, range);
|
|
31
|
+
}
|
|
32
|
+
clearControlBoundaryDomUpdateState(controlState);
|
|
33
|
+
return fragment;
|
|
34
|
+
}
|
|
35
|
+
const forState = controlState;
|
|
36
|
+
if (forState.orderedKeys.length === 0) {
|
|
37
|
+
const fallbackScope = forState.fallbackScope;
|
|
38
|
+
const fallbackVNode = childrenVNodes[0];
|
|
39
|
+
if (fallbackScope && fallbackVNode !== void 0) {
|
|
40
|
+
const range = materializeChildScopeRange(fallbackVNode, parentNamespace, fallbackScope);
|
|
41
|
+
assignScopeRange(fallbackScope, range);
|
|
42
|
+
fallbackScope.hydrationPending = false;
|
|
43
|
+
appendRange(fragment, range);
|
|
44
|
+
}
|
|
45
|
+
clearControlBoundaryDomUpdateState(controlState);
|
|
46
|
+
return fragment;
|
|
47
|
+
}
|
|
48
|
+
for (let i = 0; i < childrenVNodes.length; i++) {
|
|
49
|
+
const childVNode = childrenVNodes[i];
|
|
50
|
+
const itemKey = forState.orderedKeys[i];
|
|
51
|
+
const itemInstance = itemKey != null ? forState.items.get(itemKey) : null;
|
|
52
|
+
let range = null;
|
|
53
|
+
if (itemInstance && itemInstance.scope.range) {
|
|
54
|
+
const cachedRange = itemInstance.scope.range;
|
|
55
|
+
const cachedDom = cachedRange.single ? cachedRange.start : null;
|
|
56
|
+
if (!cachedDom || !checkVNodeShapeChanged(cachedDom, childVNode)) range = cachedRange;
|
|
57
|
+
}
|
|
58
|
+
if (!range) {
|
|
59
|
+
const materializedRange = materializeChildScopeRange(childVNode, parentNamespace, itemInstance?.scope);
|
|
60
|
+
if (itemInstance) {
|
|
61
|
+
assignScopeRange(itemInstance.scope, materializedRange);
|
|
62
|
+
itemInstance.scope.hydrationPending = false;
|
|
63
|
+
}
|
|
64
|
+
range = materializedRange;
|
|
65
|
+
}
|
|
66
|
+
appendRange(fragment, range);
|
|
67
|
+
}
|
|
68
|
+
clearControlBoundaryDomUpdateState(controlState);
|
|
69
|
+
return fragment;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { createForBoundary };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { _isDOMElement } from "../common/vnode.js";
|
|
2
|
+
import "./types.js";
|
|
3
|
+
import { Fragment } from "../common/jsx.js";
|
|
4
|
+
import { enterDomCommitScope, restoreDomCommitScope } from "../runtime/component-scope.js";
|
|
5
|
+
import "../runtime/index.js";
|
|
6
|
+
import { createDetachedRange, createEmptyRange, createSingleNodeRange, findRangeEnd, getRangeNodes, isRangeStart } from "./dom-range.js";
|
|
7
|
+
import { getParentNamespace } from "./namespaces.js";
|
|
8
|
+
import "../jsx/index.js";
|
|
9
|
+
//#region src/renderer/boundary-range-adoption.ts
|
|
10
|
+
let boundaryRangeHost = null;
|
|
11
|
+
function configureBoundaryRangeHost(host) {
|
|
12
|
+
boundaryRangeHost = host;
|
|
13
|
+
}
|
|
14
|
+
function getBoundaryRangeHost() {
|
|
15
|
+
if (!boundaryRangeHost) throw new Error("[askr] Control boundary DOM host is not configured.");
|
|
16
|
+
return boundaryRangeHost;
|
|
17
|
+
}
|
|
18
|
+
function assignScopeRange(scope, range) {
|
|
19
|
+
scope.range = range;
|
|
20
|
+
scope.dom = range.single ? range.start : void 0;
|
|
21
|
+
}
|
|
22
|
+
function checkVNodeShapeChanged(dom, vnode) {
|
|
23
|
+
if (!_isDOMElement(vnode) || !(dom instanceof Element)) return true;
|
|
24
|
+
if (typeof vnode.type !== "string") return true;
|
|
25
|
+
return dom.tagName.toLowerCase() !== vnode.type.toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
function adoptHydratedRange(parent, scope, before, vnode) {
|
|
28
|
+
if (!scope.hydrationPending || !before || !isRangeStart(before)) return null;
|
|
29
|
+
const end = findRangeEnd(before);
|
|
30
|
+
if (!end || end.parentNode !== parent) return null;
|
|
31
|
+
const range = {
|
|
32
|
+
start: before,
|
|
33
|
+
end,
|
|
34
|
+
single: false
|
|
35
|
+
};
|
|
36
|
+
const contentNodes = getRangeNodes(range);
|
|
37
|
+
const expectedChildren = _isDOMElement(vnode) && vnode.type === Fragment ? vnode.props?.children ?? [] : [vnode];
|
|
38
|
+
if (contentNodes.length !== expectedChildren.length) return null;
|
|
39
|
+
for (let index = 0; index < expectedChildren.length; index += 1) {
|
|
40
|
+
const expected = expectedChildren[index];
|
|
41
|
+
const actual = contentNodes[index];
|
|
42
|
+
if (_isDOMElement(expected) && typeof expected.type === "string" && (!(actual instanceof Element) || actual.tagName.toLowerCase() !== expected.type.toLowerCase())) return null;
|
|
43
|
+
}
|
|
44
|
+
assignScopeRange(scope, range);
|
|
45
|
+
scope.hydrationPending = false;
|
|
46
|
+
return range;
|
|
47
|
+
}
|
|
48
|
+
function getScopeRange(scope) {
|
|
49
|
+
if (scope.range) return scope.range;
|
|
50
|
+
if (!scope.dom) return null;
|
|
51
|
+
const range = {
|
|
52
|
+
start: scope.dom,
|
|
53
|
+
end: scope.dom,
|
|
54
|
+
single: true
|
|
55
|
+
};
|
|
56
|
+
scope.range = range;
|
|
57
|
+
return range;
|
|
58
|
+
}
|
|
59
|
+
function materializeChildScopeRange(vnode, parentNamespace, scope, scopeAlreadyActive = false) {
|
|
60
|
+
const previousInstance = scope && !scopeAlreadyActive ? enterDomCommitScope(scope.componentInstance) : null;
|
|
61
|
+
let dom;
|
|
62
|
+
try {
|
|
63
|
+
const host = getBoundaryRangeHost();
|
|
64
|
+
dom = scope?.blueprintOwner && _isDOMElement(vnode) && typeof vnode.type === "string" ? host.createResultNodeWithBlueprint(scope.blueprintOwner, vnode, parentNamespace) : host.createDOMNode(vnode, parentNamespace);
|
|
65
|
+
} finally {
|
|
66
|
+
if (scope && !scopeAlreadyActive) restoreDomCommitScope(previousInstance);
|
|
67
|
+
}
|
|
68
|
+
if (!dom) return createEmptyRange(document, scope).range;
|
|
69
|
+
if (!(dom instanceof DocumentFragment)) return createSingleNodeRange(dom, scope);
|
|
70
|
+
return createDetachedRange(dom, scope).range;
|
|
71
|
+
}
|
|
72
|
+
function getBoundaryParentNamespace(parent) {
|
|
73
|
+
return getParentNamespace(parent);
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { adoptHydratedRange, assignScopeRange, checkVNodeShapeChanged, configureBoundaryRangeHost, getBoundaryParentNamespace, getBoundaryRangeHost, getScopeRange, materializeChildScopeRange };
|