@askrjs/askr 0.0.48 → 0.0.50
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/benchmark.js +6 -6
- package/dist/benchmark.js.map +1 -1
- package/dist/boot/hydration.js +140 -0
- package/dist/boot/hydration.js.map +1 -0
- package/dist/boot/index.d.ts +3 -56
- package/dist/boot/index.d.ts.map +1 -1
- package/dist/boot/index.js +62 -410
- package/dist/boot/index.js.map +1 -1
- package/dist/boot/root-lifecycle.d.ts +15 -0
- package/dist/boot/root-lifecycle.d.ts.map +1 -0
- package/dist/boot/root-lifecycle.js +205 -0
- package/dist/boot/root-lifecycle.js.map +1 -0
- package/dist/boot/route-startup.js +45 -0
- package/dist/boot/route-startup.js.map +1 -0
- package/dist/boot/types.d.ts +62 -0
- package/dist/boot/types.d.ts.map +1 -0
- package/dist/common/component.d.ts +3 -1
- package/dist/common/component.d.ts.map +1 -1
- package/dist/common/jsx.d.ts +6 -2
- package/dist/common/jsx.d.ts.map +1 -1
- package/dist/common/jsx.js.map +1 -1
- package/dist/common/props.d.ts +1 -1
- package/dist/common/render-context.js +55 -0
- package/dist/common/render-context.js.map +1 -0
- package/dist/common/router.d.ts +5 -1
- package/dist/common/router.d.ts.map +1 -1
- package/dist/common/ssr.d.ts +1 -1
- package/dist/common/ssr.js.map +1 -1
- package/dist/common/vnode.d.ts +5 -4
- package/dist/common/vnode.d.ts.map +1 -1
- package/dist/common/vnode.js.map +1 -1
- package/dist/components/error-boundary.d.ts +1 -1
- package/dist/components/error-boundary.js +2 -1
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/link.js.map +1 -1
- package/dist/control/for.js +2 -1
- package/dist/control/for.js.map +1 -1
- package/dist/data/data-runtime.d.ts +28 -0
- package/dist/data/data-runtime.d.ts.map +1 -0
- package/dist/data/data-runtime.js +114 -0
- package/dist/data/data-runtime.js.map +1 -0
- package/dist/data/index.d.ts +6 -142
- package/dist/data/index.js +5 -539
- package/dist/data/invalidation.d.ts +9 -0
- package/dist/data/invalidation.d.ts.map +1 -0
- package/dist/data/invalidation.js +27 -0
- package/dist/data/invalidation.js.map +1 -0
- package/dist/data/mutation-cell.d.ts +28 -0
- package/dist/data/mutation-cell.d.ts.map +1 -0
- package/dist/data/mutation-cell.js +132 -0
- package/dist/data/mutation-cell.js.map +1 -0
- package/dist/data/query-cell.d.ts +46 -0
- package/dist/data/query-cell.d.ts.map +1 -0
- package/dist/data/query-cell.js +290 -0
- package/dist/data/query-cell.js.map +1 -0
- package/dist/data/query-key.js +42 -0
- package/dist/data/query-key.js.map +1 -0
- package/dist/data/shared.js +20 -0
- package/dist/data/shared.js.map +1 -0
- package/dist/data/types.d.ts +161 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/foundations/icon/icon.d.ts.map +1 -1
- package/dist/foundations/icon/icon.js.map +1 -1
- package/dist/foundations/structures/portal.d.ts +1 -1
- package/dist/foundations/structures/portal.d.ts.map +1 -1
- package/dist/foundations/structures/portal.js +2 -1
- package/dist/foundations/structures/portal.js.map +1 -1
- package/dist/fx/fx.d.ts +1 -1
- package/dist/fx/fx.js +5 -4
- package/dist/fx/fx.js.map +1 -1
- package/dist/fx/timing.d.ts.map +1 -1
- package/dist/fx/timing.js +10 -6
- package/dist/fx/timing.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/jsx/index.d.ts +2 -1
- package/dist/jsx/index.js +3 -2
- package/dist/jsx/types.d.ts +3 -1
- package/dist/jsx/types.d.ts.map +1 -1
- package/dist/jsx/types.js +2 -1
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/jsx-dev-runtime.d.ts.map +1 -1
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/jsx-runtime2.d.ts +3 -2
- package/dist/jsx-runtime2.js +3 -2
- package/dist/renderer/attributes.js +231 -0
- package/dist/renderer/attributes.js.map +1 -0
- package/dist/renderer/boundaries.js +266 -0
- package/dist/renderer/boundaries.js.map +1 -0
- package/dist/renderer/child-shape.js +85 -0
- package/dist/renderer/child-shape.js.map +1 -0
- package/dist/renderer/children.js +3 -2
- package/dist/renderer/children.js.map +1 -1
- package/dist/renderer/cleanup.js +2 -1
- package/dist/renderer/cleanup.js.map +1 -1
- package/dist/renderer/component-host-cleanup.js +68 -0
- package/dist/renderer/component-host-cleanup.js.map +1 -0
- package/dist/renderer/component-host-instances.js +65 -0
- package/dist/renderer/component-host-instances.js.map +1 -0
- package/dist/renderer/component-host.js +247 -0
- package/dist/renderer/component-host.js.map +1 -0
- package/dist/renderer/dom-host.js +13 -0
- package/dist/renderer/dom-host.js.map +1 -0
- package/dist/renderer/dom-internal.js +185 -0
- package/dist/renderer/dom-internal.js.map +1 -0
- package/dist/renderer/dom.js +9 -2356
- package/dist/renderer/element-children.js +279 -0
- package/dist/renderer/element-children.js.map +1 -0
- package/dist/renderer/env.js +2 -1
- package/dist/renderer/error-boundary-dom.js +29 -0
- package/dist/renderer/error-boundary-dom.js.map +1 -0
- package/dist/renderer/evaluate-dom-range.js +85 -0
- package/dist/renderer/evaluate-dom-range.js.map +1 -0
- package/dist/renderer/evaluate-reconcile.js +281 -0
- package/dist/renderer/evaluate-reconcile.js.map +1 -0
- package/dist/renderer/evaluate.js +13 -399
- package/dist/renderer/evaluate.js.map +1 -1
- package/dist/renderer/fastpath.js +6 -5
- package/dist/renderer/fastpath.js.map +1 -1
- package/dist/renderer/for-commit-dom-map.js +83 -0
- package/dist/renderer/for-commit-dom-map.js.map +1 -0
- package/dist/renderer/for-commit-removal.js +36 -0
- package/dist/renderer/for-commit-removal.js.map +1 -0
- package/dist/renderer/for-commit-reorder.js +89 -0
- package/dist/renderer/for-commit-reorder.js.map +1 -0
- package/dist/renderer/for-commit.js +6 -188
- package/dist/renderer/for-commit.js.map +1 -1
- package/dist/renderer/index.js +28 -16
- package/dist/renderer/index.js.map +1 -1
- package/dist/renderer/keyed-children.js +32 -0
- package/dist/renderer/keyed-children.js.map +1 -0
- package/dist/renderer/keyed.js +2 -15
- package/dist/renderer/keyed.js.map +1 -1
- package/dist/renderer/namespaces.js +23 -0
- package/dist/renderer/namespaces.js.map +1 -0
- package/dist/renderer/prop-bindings.js +280 -0
- package/dist/renderer/prop-bindings.js.map +1 -0
- package/dist/renderer/reactive-child-dom.js +133 -0
- package/dist/renderer/reactive-child-dom.js.map +1 -0
- package/dist/renderer/reactive-child-sources.js +184 -0
- package/dist/renderer/reactive-child-sources.js.map +1 -0
- package/dist/renderer/reactive-children.js +294 -0
- package/dist/renderer/reactive-children.js.map +1 -0
- package/dist/renderer/reconcile-commit.js +38 -0
- package/dist/renderer/reconcile-commit.js.map +1 -0
- package/dist/renderer/reconcile-fastpaths.js +106 -0
- package/dist/renderer/reconcile-fastpaths.js.map +1 -0
- package/dist/renderer/reconcile-resolution.js +187 -0
- package/dist/renderer/reconcile-resolution.js.map +1 -0
- package/dist/renderer/reconcile.js +9 -371
- package/dist/renderer/reconcile.js.map +1 -1
- package/dist/renderer/retained-element-rollback.js +276 -0
- package/dist/renderer/retained-element-rollback.js.map +1 -0
- package/dist/renderer/stable-patch.js +82 -0
- package/dist/renderer/stable-patch.js.map +1 -0
- package/dist/renderer/static-reuse.js +96 -0
- package/dist/renderer/static-reuse.js.map +1 -0
- package/dist/renderer/types.js +2 -1
- package/dist/renderer/utils.js +4 -4
- package/dist/renderer/utils.js.map +1 -1
- package/dist/resources/index.d.ts +3 -2
- package/dist/resources/index.js +5 -2
- package/dist/router/access.js +36 -0
- package/dist/router/access.js.map +1 -0
- package/dist/router/activity.d.ts +10 -0
- package/dist/router/activity.d.ts.map +1 -0
- package/dist/router/activity.js +89 -0
- package/dist/router/activity.js.map +1 -0
- package/dist/router/authoring.d.ts +22 -0
- package/dist/router/authoring.d.ts.map +1 -0
- package/dist/router/authoring.js +198 -0
- package/dist/router/authoring.js.map +1 -0
- package/dist/router/index.d.ts +12 -4
- package/dist/router/index.js +10 -3
- package/dist/router/internal-types.d.ts +31 -0
- package/dist/router/internal-types.d.ts.map +1 -0
- package/dist/router/lazy.d.ts +19 -0
- package/dist/router/lazy.d.ts.map +1 -0
- package/dist/router/lazy.js +52 -0
- package/dist/router/lazy.js.map +1 -0
- package/dist/router/manifest.d.ts +10 -0
- package/dist/router/manifest.d.ts.map +1 -0
- package/dist/router/manifest.js +49 -0
- package/dist/router/manifest.js.map +1 -0
- package/dist/router/navigate.d.ts +4 -51
- package/dist/router/navigate.d.ts.map +1 -1
- package/dist/router/navigate.js +16 -459
- package/dist/router/navigate.js.map +1 -1
- package/dist/router/navigation-registry.d.ts +32 -0
- package/dist/router/navigation-registry.d.ts.map +1 -0
- package/dist/router/navigation-registry.js +105 -0
- package/dist/router/navigation-registry.js.map +1 -0
- package/dist/router/navigation-scroll.d.ts +14 -0
- package/dist/router/navigation-scroll.d.ts.map +1 -0
- package/dist/router/navigation-scroll.js +93 -0
- package/dist/router/navigation-scroll.js.map +1 -0
- package/dist/router/navigation-targets.d.ts +31 -0
- package/dist/router/navigation-targets.d.ts.map +1 -0
- package/dist/router/navigation-targets.js +253 -0
- package/dist/router/navigation-targets.js.map +1 -0
- package/dist/router/policy.d.ts +7 -1
- package/dist/router/policy.d.ts.map +1 -1
- package/dist/router/policy.js +27 -9
- package/dist/router/policy.js.map +1 -1
- package/dist/router/rendering.d.ts +10 -0
- package/dist/router/rendering.d.ts.map +1 -0
- package/dist/router/rendering.js +45 -0
- package/dist/router/rendering.js.map +1 -0
- package/dist/router/resolution.d.ts +17 -0
- package/dist/router/resolution.d.ts.map +1 -0
- package/dist/router/resolution.js +253 -0
- package/dist/router/resolution.js.map +1 -0
- package/dist/router/route-query.d.ts +17 -0
- package/dist/router/route-query.d.ts.map +1 -0
- package/dist/router/route-query.js +47 -0
- package/dist/router/route-query.js.map +1 -0
- package/dist/router/route.d.ts +8 -149
- package/dist/router/route.js +8 -854
- package/dist/router/store.d.ts +50 -0
- package/dist/router/store.d.ts.map +1 -0
- package/dist/router/store.js +171 -0
- package/dist/router/store.js.map +1 -0
- package/dist/runtime/access.js +45 -0
- package/dist/runtime/access.js.map +1 -0
- package/dist/runtime/child-scope.d.ts +1 -1
- package/dist/runtime/child-scope.js +4 -1
- package/dist/runtime/child-scope.js.map +1 -1
- package/dist/runtime/component-cleanup.d.ts +16 -0
- package/dist/runtime/component-cleanup.d.ts.map +1 -0
- package/dist/runtime/component-cleanup.js +70 -0
- package/dist/runtime/component-cleanup.js.map +1 -0
- package/dist/runtime/component-commit.js +165 -0
- package/dist/runtime/component-commit.js.map +1 -0
- package/dist/runtime/component-contracts.js +5 -0
- package/dist/runtime/component-facade.d.ts +5 -0
- package/dist/runtime/component-facade.js +4 -0
- package/dist/runtime/component-internal.d.ts +100 -0
- package/dist/runtime/component-internal.d.ts.map +1 -0
- package/dist/runtime/component-internal.js +219 -0
- package/dist/runtime/component-internal.js.map +1 -0
- package/dist/runtime/component-lifecycle.d.ts +49 -0
- package/dist/runtime/component-lifecycle.d.ts.map +1 -0
- package/dist/runtime/component-lifecycle.js +176 -0
- package/dist/runtime/component-lifecycle.js.map +1 -0
- package/dist/runtime/component-scope.d.ts +55 -0
- package/dist/runtime/component-scope.d.ts.map +1 -0
- package/dist/runtime/component-scope.js +154 -0
- package/dist/runtime/component-scope.js.map +1 -0
- package/dist/runtime/component.d.ts +4 -152
- package/dist/runtime/component.js +4 -692
- package/dist/runtime/context.d.ts +1 -1
- package/dist/runtime/context.js +6 -4
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/control.d.ts +3 -3
- package/dist/runtime/control.js +2 -1
- package/dist/runtime/control.js.map +1 -1
- package/dist/runtime/derive.d.ts.map +1 -1
- package/dist/runtime/derive.js +6 -5
- package/dist/runtime/derive.js.map +1 -1
- package/dist/runtime/effect.d.ts +1 -1
- package/dist/runtime/effect.d.ts.map +1 -1
- package/dist/runtime/effect.js +2 -2
- package/dist/runtime/effect.js.map +1 -1
- package/dist/runtime/events.js +3 -3
- package/dist/runtime/events.js.map +1 -1
- package/dist/runtime/fastlane.js +13 -27
- package/dist/runtime/fastlane.js.map +1 -1
- package/dist/runtime/for-bench.d.ts +1 -1
- package/dist/runtime/for-bench.js +1 -4
- package/dist/runtime/for-bench.js.map +1 -1
- package/dist/runtime/for-internal.d.ts +43 -0
- package/dist/runtime/for-internal.d.ts.map +1 -0
- package/dist/runtime/for-internal.js +98 -0
- package/dist/runtime/for-internal.js.map +1 -0
- package/dist/runtime/for-reconcile.d.ts +8 -0
- package/dist/runtime/for-reconcile.d.ts.map +1 -0
- package/dist/runtime/for-reconcile.js +389 -0
- package/dist/runtime/for-reconcile.js.map +1 -0
- package/dist/runtime/for-scopes.d.ts +26 -0
- package/dist/runtime/for-scopes.d.ts.map +1 -0
- package/dist/runtime/for-scopes.js +160 -0
- package/dist/runtime/for-scopes.js.map +1 -0
- package/dist/runtime/for-signals.d.ts +30 -0
- package/dist/runtime/for-signals.d.ts.map +1 -0
- package/dist/runtime/for-signals.js +139 -0
- package/dist/runtime/for-signals.js.map +1 -0
- package/dist/runtime/for.d.ts +4 -66
- package/dist/runtime/for.js +5 -773
- package/dist/runtime/lifecycle-operations.d.ts +31 -0
- package/dist/runtime/lifecycle-operations.d.ts.map +1 -0
- package/dist/runtime/lifecycle-operations.js +195 -0
- package/dist/runtime/lifecycle-operations.js.map +1 -0
- package/dist/runtime/operations.d.ts +3 -40
- package/dist/runtime/operations.js +2 -357
- package/dist/runtime/readable.d.ts +2 -3
- package/dist/runtime/readable.d.ts.map +1 -1
- package/dist/runtime/readable.js +6 -5
- package/dist/runtime/readable.js.map +1 -1
- package/dist/runtime/resource-cell.js +2 -2
- package/dist/runtime/resource-cell.js.map +1 -1
- package/dist/runtime/resource-operation.d.ts +13 -0
- package/dist/runtime/resource-operation.d.ts.map +1 -0
- package/dist/runtime/resource-operation.js +170 -0
- package/dist/runtime/resource-operation.js.map +1 -0
- package/dist/runtime/runtime.d.ts +42 -0
- package/dist/runtime/runtime.d.ts.map +1 -0
- package/dist/runtime/runtime.js +59 -0
- package/dist/runtime/runtime.js.map +1 -0
- package/dist/runtime/scheduler.d.ts +5 -1
- package/dist/runtime/scheduler.d.ts.map +1 -1
- package/dist/runtime/scheduler.js +17 -17
- package/dist/runtime/scheduler.js.map +1 -1
- package/dist/runtime/selector.js +4 -3
- package/dist/runtime/selector.js.map +1 -1
- package/dist/runtime/snapshot-source.d.ts +1 -1
- package/dist/runtime/snapshot-source.js +1 -1
- package/dist/runtime/state.js +2 -1
- package/dist/runtime/state.js.map +1 -1
- package/dist/ssg/batch-render.js +2 -1
- package/dist/ssg/batch-render.js.map +1 -1
- package/dist/ssg/create-static-gen.d.ts +9 -3
- package/dist/ssg/create-static-gen.d.ts.map +1 -1
- package/dist/ssg/create-static-gen.js +12 -99
- package/dist/ssg/create-static-gen.js.map +1 -1
- package/dist/ssg/generation-plan.js +70 -0
- package/dist/ssg/generation-plan.js.map +1 -0
- package/dist/ssg/incremental-manifest.js +1 -1
- package/dist/ssg/static-routes.js +101 -0
- package/dist/ssg/static-routes.js.map +1 -0
- package/dist/ssg/types.d.ts +15 -7
- package/dist/ssg/types.d.ts.map +1 -1
- package/dist/ssr/boundaries.js +113 -0
- package/dist/ssr/boundaries.js.map +1 -0
- package/dist/ssr/component-runtime.js +111 -0
- package/dist/ssr/component-runtime.js.map +1 -0
- package/dist/ssr/context.d.ts +3 -1
- package/dist/ssr/context.d.ts.map +1 -1
- package/dist/ssr/context.js +9 -2
- package/dist/ssr/context.js.map +1 -1
- package/dist/ssr/errors.d.ts +2 -0
- package/dist/ssr/errors.js +11 -1
- package/dist/ssr/errors.js.map +1 -1
- package/dist/ssr/escape.js +3 -3
- package/dist/ssr/escape.js.map +1 -1
- package/dist/ssr/hydration-data.js +10 -0
- package/dist/ssr/hydration-data.js.map +1 -0
- package/dist/ssr/hydration-verify.d.ts +12 -0
- package/dist/ssr/hydration-verify.d.ts.map +1 -0
- package/dist/ssr/hydration-verify.js +144 -0
- package/dist/ssr/hydration-verify.js.map +1 -0
- package/dist/ssr/index-internal.d.ts +15 -0
- package/dist/ssr/index-internal.d.ts.map +1 -0
- package/dist/ssr/index-internal.js +19 -0
- package/dist/ssr/index-internal.js.map +1 -0
- package/dist/ssr/index.d.ts +5 -57
- package/dist/ssr/index.js +3 -738
- package/dist/ssr/render-keys.js +9 -32
- package/dist/ssr/render-keys.js.map +1 -1
- package/dist/ssr/render-resolved.d.ts +1 -1
- package/dist/ssr/render-resolved.d.ts.map +1 -1
- package/dist/ssr/render-resolved.js +4 -2
- package/dist/ssr/render-resolved.js.map +1 -1
- package/dist/ssr/render-sync.d.ts +21 -0
- package/dist/ssr/render-sync.d.ts.map +1 -0
- package/dist/ssr/render-sync.js +275 -0
- package/dist/ssr/render-sync.js.map +1 -0
- package/dist/ssr/route-policy-resolution.js +77 -0
- package/dist/ssr/route-policy-resolution.js.map +1 -0
- package/dist/ssr/route-render.d.ts +77 -0
- package/dist/ssr/route-render.d.ts.map +1 -0
- package/dist/ssr/route-render.js +119 -0
- package/dist/ssr/route-render.js.map +1 -0
- package/dist/ssr/sink.d.ts +26 -0
- package/dist/ssr/sink.d.ts.map +1 -0
- package/dist/ssr/types.d.ts +1 -0
- package/dist/ssr/types.d.ts.map +1 -1
- package/dist/ssr/verify-hydration.js.map +1 -1
- package/dist/testing/index.d.ts +1 -2
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2 -1
- package/dist/testing/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/data/index.d.ts.map +0 -1
- package/dist/data/index.js.map +0 -1
- package/dist/renderer/dom.js.map +0 -1
- package/dist/router/route.d.ts.map +0 -1
- package/dist/router/route.js.map +0 -1
- package/dist/runtime/component.d.ts.map +0 -1
- package/dist/runtime/component.js.map +0 -1
- package/dist/runtime/for.d.ts.map +0 -1
- package/dist/runtime/for.js.map +0 -1
- package/dist/runtime/operations.d.ts.map +0 -1
- package/dist/runtime/operations.js.map +0 -1
- package/dist/runtime/ssr-bridge.js +0 -24
- package/dist/runtime/ssr-bridge.js.map +0 -1
- package/dist/ssr/index.d.ts.map +0 -1
- package/dist/ssr/index.js.map +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { _isDOMElement } from "../common/vnode.js";
|
|
2
|
+
import "./types.js";
|
|
3
|
+
import { getCurrentContextFrame, 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/component-contracts.js";
|
|
9
|
+
import { tagNamesEqualIgnoreCase } from "./utils.js";
|
|
10
|
+
import { materializeKey } from "./attributes.js";
|
|
11
|
+
import { normalizeComponentChildren } from "./child-shape.js";
|
|
12
|
+
import { cleanupDetachedComponentHost, pruneComponentHostInstances } from "./component-host-cleanup.js";
|
|
13
|
+
import { getRendererDOMHost } from "./dom-host.js";
|
|
14
|
+
import { findHostInstanceByType, getVNodeComponentInstance, inheritComponentCleanupStrict, inheritComponentKey, isRouteRootComponentVNode, nextComponentInstanceId, setVNodeComponentInstance } from "./component-host-instances.js";
|
|
15
|
+
//#region src/renderer/component-host.ts
|
|
16
|
+
function materializeComponentResultNode(childInstance, result, parentNamespace) {
|
|
17
|
+
const dom = getRendererDOMHost().createDOMNode(result, parentNamespace);
|
|
18
|
+
if (dom instanceof Element) {
|
|
19
|
+
mountInstanceInline(childInstance, dom);
|
|
20
|
+
return dom;
|
|
21
|
+
}
|
|
22
|
+
if (!dom) {
|
|
23
|
+
const placeholder = document.createComment("");
|
|
24
|
+
try {
|
|
25
|
+
placeholder.__ASKR_INSTANCE = childInstance;
|
|
26
|
+
} catch {}
|
|
27
|
+
childInstance._placeholder = placeholder;
|
|
28
|
+
mountInstanceInline(childInstance, null);
|
|
29
|
+
return placeholder;
|
|
30
|
+
}
|
|
31
|
+
const host = document.createElement("div");
|
|
32
|
+
host.appendChild(dom);
|
|
33
|
+
host.__ASKR_WRAPPER_HOST = true;
|
|
34
|
+
mountInstanceInline(childInstance, host);
|
|
35
|
+
return host;
|
|
36
|
+
}
|
|
37
|
+
function resolveNestedComponentResult(result, snapshot, parentInstance) {
|
|
38
|
+
let currentResult = result;
|
|
39
|
+
let activeSnapshot = snapshot;
|
|
40
|
+
let depth = 0;
|
|
41
|
+
while (_isDOMElement(currentResult) && typeof currentResult.type === "function" && depth < 16) {
|
|
42
|
+
const nestedSnapshot = getVNodeContextFrame(currentResult) ?? activeSnapshot;
|
|
43
|
+
const nestedInstance = createComponentInstance(nextComponentInstanceId(), currentResult.type, currentResult.props ?? {}, null);
|
|
44
|
+
nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);
|
|
45
|
+
nestedInstance.parentInstance = parentInstance;
|
|
46
|
+
nestedInstance.portalScope = parentInstance?.portalScope ?? nestedInstance.portalScope;
|
|
47
|
+
inheritComponentCleanupStrict(nestedInstance);
|
|
48
|
+
if (nestedSnapshot) nestedInstance.ownerFrame = nestedSnapshot;
|
|
49
|
+
const nextResult = withContext(nestedSnapshot ?? null, () => renderComponentInline(nestedInstance));
|
|
50
|
+
cleanupComponent(nestedInstance);
|
|
51
|
+
if (isPromiseLike(nextResult)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
52
|
+
activeSnapshot = nestedSnapshot ?? null;
|
|
53
|
+
currentResult = nextResult;
|
|
54
|
+
depth += 1;
|
|
55
|
+
}
|
|
56
|
+
return currentResult;
|
|
57
|
+
}
|
|
58
|
+
function resolveHostNestedComponentResult(host, retainedInstance, result, snapshot, retainedHostInstances) {
|
|
59
|
+
let currentResult = result;
|
|
60
|
+
let activeSnapshot = snapshot;
|
|
61
|
+
let depth = 0;
|
|
62
|
+
const retainedInstances = /* @__PURE__ */ new Set([retainedInstance]);
|
|
63
|
+
if (retainedHostInstances) for (const instance of retainedHostInstances) retainedInstances.add(instance);
|
|
64
|
+
const createdInstances = [];
|
|
65
|
+
while (_isDOMElement(currentResult) && typeof currentResult.type === "function" && depth < 16) {
|
|
66
|
+
const nestedSnapshot = getVNodeContextFrame(currentResult) ?? activeSnapshot;
|
|
67
|
+
let nestedInstance = findHostInstanceByType(host, currentResult.type);
|
|
68
|
+
const hadNestedInstance = !!nestedInstance;
|
|
69
|
+
if (!nestedInstance) {
|
|
70
|
+
nestedInstance = createComponentInstance(nextComponentInstanceId(), currentResult.type, currentResult.props ?? {}, null);
|
|
71
|
+
createdInstances.push(nestedInstance);
|
|
72
|
+
}
|
|
73
|
+
if (hadNestedInstance) captureInlineRenderSnapshot(nestedInstance);
|
|
74
|
+
setVNodeComponentInstance(currentResult, nestedInstance);
|
|
75
|
+
nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);
|
|
76
|
+
nestedInstance.parentInstance = retainedInstance;
|
|
77
|
+
nestedInstance.portalScope = retainedInstance.portalScope ?? nestedInstance.portalScope;
|
|
78
|
+
inheritComponentCleanupStrict(nestedInstance);
|
|
79
|
+
nestedInstance.props = (currentResult.props ?? {}) || {};
|
|
80
|
+
if (nestedSnapshot) nestedInstance.ownerFrame = nestedSnapshot;
|
|
81
|
+
const nextResult = withContext(nestedSnapshot ?? null, () => renderComponentInline(nestedInstance));
|
|
82
|
+
if (isPromiseLike(nextResult)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
83
|
+
retainedInstances.add(nestedInstance);
|
|
84
|
+
warnUnusedStateReads(nestedInstance);
|
|
85
|
+
activeSnapshot = nestedSnapshot ?? null;
|
|
86
|
+
currentResult = markVNodeTreeWithContextFrame(nextResult, activeSnapshot);
|
|
87
|
+
depth += 1;
|
|
88
|
+
}
|
|
89
|
+
const previousInstances = host.__ASKR_INSTANCES ?? [];
|
|
90
|
+
for (const instance of previousInstances) if (!retainedInstances.has(instance)) cleanupComponent(instance);
|
|
91
|
+
const nextHostInstances = previousInstances.filter((instance) => retainedInstances.has(instance));
|
|
92
|
+
for (const instance of retainedInstances) if (instance.target === host && !nextHostInstances.includes(instance)) nextHostInstances.push(instance);
|
|
93
|
+
host.__ASKR_INSTANCES = nextHostInstances;
|
|
94
|
+
host.__ASKR_INSTANCE = host.__ASKR_INSTANCES[0] ?? retainedInstance;
|
|
95
|
+
for (const instance of createdInstances) mountInstanceInline(instance, host);
|
|
96
|
+
return currentResult;
|
|
97
|
+
}
|
|
98
|
+
function resolveWrapperHostResult(host, result, snapshot) {
|
|
99
|
+
let currentResult = result;
|
|
100
|
+
let activeSnapshot = snapshot;
|
|
101
|
+
let depth = 0;
|
|
102
|
+
while (_isDOMElement(currentResult) && typeof currentResult.type === "function" && depth < 16) {
|
|
103
|
+
const nestedSnapshot = getVNodeContextFrame(currentResult) ?? activeSnapshot;
|
|
104
|
+
const nestedInstance = findHostInstanceByType(host, currentResult.type);
|
|
105
|
+
if (!nestedInstance) break;
|
|
106
|
+
captureInlineRenderSnapshot(nestedInstance);
|
|
107
|
+
nestedInstance.props = (currentResult.props ?? {}) || {};
|
|
108
|
+
nestedInstance.parentInstance = getCurrentInstance();
|
|
109
|
+
nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);
|
|
110
|
+
nestedInstance.portalScope = getCurrentInstance()?.portalScope ?? nestedInstance.portalScope;
|
|
111
|
+
inheritComponentCleanupStrict(nestedInstance);
|
|
112
|
+
if (nestedSnapshot) nestedInstance.ownerFrame = nestedSnapshot;
|
|
113
|
+
const nextResult = withContext(nestedSnapshot ?? null, () => renderComponentInline(nestedInstance));
|
|
114
|
+
if (isPromiseLike(nextResult)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
115
|
+
warnUnusedStateReads(nestedInstance);
|
|
116
|
+
activeSnapshot = nestedSnapshot ?? null;
|
|
117
|
+
currentResult = nextResult;
|
|
118
|
+
depth += 1;
|
|
119
|
+
}
|
|
120
|
+
return markVNodeTreeWithContextFrame(currentResult, activeSnapshot);
|
|
121
|
+
}
|
|
122
|
+
function syncComponentElement(currentDom, node, type, props, parentNamespace, forceChildrenUpdate = false, retainedHostInstances) {
|
|
123
|
+
const existingHost = currentDom instanceof Element ? currentDom : null;
|
|
124
|
+
const existingInstance = existingHost ? findHostInstanceByType(existingHost, type) : null;
|
|
125
|
+
if (!existingHost) return null;
|
|
126
|
+
const domHost = getRendererDOMHost();
|
|
127
|
+
if (!existingInstance || existingInstance.fn !== type) {
|
|
128
|
+
const snapshot = getVNodeContextFrame(node) || getCurrentContextFrame() || null;
|
|
129
|
+
const hydrationInstance = createComponentInstance(nextComponentInstanceId(), type, props || {}, existingHost);
|
|
130
|
+
hydrationInstance.isRoot = isRouteRootComponentVNode(node);
|
|
131
|
+
hydrationInstance.portalScope = getCurrentInstance()?.portalScope ?? hydrationInstance.portalScope;
|
|
132
|
+
inheritComponentCleanupStrict(hydrationInstance);
|
|
133
|
+
setVNodeComponentInstance(node, hydrationInstance);
|
|
134
|
+
if (snapshot) hydrationInstance.ownerFrame = snapshot;
|
|
135
|
+
const result = withContext(snapshot, () => renderComponentInline(hydrationInstance));
|
|
136
|
+
if (isPromiseLike(result)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
137
|
+
const scopedResult = markVNodeTreeWithContextFrame(result, snapshot ?? null);
|
|
138
|
+
if (scopedResult && typeof scopedResult === "object" && "type" in scopedResult && typeof scopedResult.type === "string" && tagNamesEqualIgnoreCase(existingHost.tagName, scopedResult.type)) {
|
|
139
|
+
pruneComponentHostInstances(existingHost, retainedHostInstances ? [hydrationInstance, ...retainedHostInstances] : [hydrationInstance]);
|
|
140
|
+
withContext(snapshot, () => {
|
|
141
|
+
domHost.updateElementFromVnode(existingHost, inheritComponentKey(scopedResult, node), true, forceChildrenUpdate || hydrationInstance.mounted === false);
|
|
142
|
+
materializeKey(existingHost, node, props);
|
|
143
|
+
});
|
|
144
|
+
mountInstanceInline(hydrationInstance, existingHost);
|
|
145
|
+
itemInstanceHydrationComplete(existingHost);
|
|
146
|
+
warnUnusedStateReads(hydrationInstance);
|
|
147
|
+
return existingHost;
|
|
148
|
+
}
|
|
149
|
+
const resolvedResult = resolveHostNestedComponentResult(existingHost, hydrationInstance, scopedResult, snapshot ?? null, retainedHostInstances);
|
|
150
|
+
if (_isDOMElement(resolvedResult) && typeof resolvedResult.type === "string" && tagNamesEqualIgnoreCase(existingHost.tagName, resolvedResult.type)) {
|
|
151
|
+
withContext(snapshot, () => {
|
|
152
|
+
domHost.updateElementFromVnode(existingHost, inheritComponentKey(resolvedResult, node), true, forceChildrenUpdate || hydrationInstance.mounted === false);
|
|
153
|
+
materializeKey(existingHost, node, props);
|
|
154
|
+
});
|
|
155
|
+
mountInstanceInline(hydrationInstance, existingHost);
|
|
156
|
+
itemInstanceHydrationComplete(existingHost);
|
|
157
|
+
warnUnusedStateReads(hydrationInstance);
|
|
158
|
+
return existingHost;
|
|
159
|
+
}
|
|
160
|
+
const nextDom = materializeComponentResultNode(hydrationInstance, scopedResult, parentNamespace);
|
|
161
|
+
if (nextDom instanceof Element) materializeKey(nextDom, node, props);
|
|
162
|
+
if (nextDom !== existingHost && existingHost.parentNode) {
|
|
163
|
+
existingHost.parentNode.replaceChild(nextDom, existingHost);
|
|
164
|
+
cleanupDetachedComponentHost(existingHost, hydrationInstance);
|
|
165
|
+
}
|
|
166
|
+
warnUnusedStateReads(hydrationInstance);
|
|
167
|
+
return nextDom;
|
|
168
|
+
}
|
|
169
|
+
const snapshot = getVNodeContextFrame(node) || getCurrentContextFrame() || existingInstance.ownerFrame || null;
|
|
170
|
+
captureInlineRenderSnapshot(existingInstance);
|
|
171
|
+
existingInstance.props = props || {};
|
|
172
|
+
existingInstance.isRoot = isRouteRootComponentVNode(node);
|
|
173
|
+
existingInstance.portalScope = getCurrentInstance()?.portalScope ?? existingInstance.portalScope;
|
|
174
|
+
inheritComponentCleanupStrict(existingInstance);
|
|
175
|
+
if (snapshot) existingInstance.ownerFrame = snapshot;
|
|
176
|
+
const result = withContext(snapshot, () => renderComponentInline(existingInstance));
|
|
177
|
+
if (isPromiseLike(result)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
178
|
+
const scopedResult = markVNodeTreeWithContextFrame(result, snapshot ?? null);
|
|
179
|
+
if (existingHost.__ASKR_WRAPPER_HOST) {
|
|
180
|
+
const wrapperResult = resolveWrapperHostResult(existingHost, scopedResult, snapshot ?? null);
|
|
181
|
+
domHost.updateElementChildren(existingHost, normalizeComponentChildren(wrapperResult));
|
|
182
|
+
warnUnusedStateReads(existingInstance);
|
|
183
|
+
return existingHost;
|
|
184
|
+
}
|
|
185
|
+
if (scopedResult && typeof scopedResult === "object" && "type" in scopedResult && typeof scopedResult.type === "string" && tagNamesEqualIgnoreCase(existingHost.tagName, scopedResult.type)) {
|
|
186
|
+
pruneComponentHostInstances(existingHost, retainedHostInstances ? [existingInstance, ...retainedHostInstances] : [existingInstance]);
|
|
187
|
+
withContext(snapshot, () => {
|
|
188
|
+
domHost.updateElementFromVnode(existingHost, inheritComponentKey(scopedResult, node), true, forceChildrenUpdate || existingInstance.mounted === false);
|
|
189
|
+
materializeKey(existingHost, node, props);
|
|
190
|
+
});
|
|
191
|
+
warnUnusedStateReads(existingInstance);
|
|
192
|
+
return existingHost;
|
|
193
|
+
}
|
|
194
|
+
const resolvedResult = resolveHostNestedComponentResult(existingHost, existingInstance, scopedResult, snapshot ?? null, retainedHostInstances);
|
|
195
|
+
if (_isDOMElement(resolvedResult) && typeof resolvedResult.type === "string" && tagNamesEqualIgnoreCase(existingHost.tagName, resolvedResult.type)) {
|
|
196
|
+
withContext(snapshot, () => {
|
|
197
|
+
domHost.updateElementFromVnode(existingHost, inheritComponentKey(resolvedResult, node), true, forceChildrenUpdate || existingInstance.mounted === false);
|
|
198
|
+
materializeKey(existingHost, node, props);
|
|
199
|
+
});
|
|
200
|
+
warnUnusedStateReads(existingInstance);
|
|
201
|
+
return existingHost;
|
|
202
|
+
}
|
|
203
|
+
const nextDom = materializeComponentResultNode(existingInstance, scopedResult, parentNamespace);
|
|
204
|
+
if (nextDom instanceof Element) materializeKey(nextDom, node, props);
|
|
205
|
+
if (nextDom !== existingHost && existingHost.parentNode) {
|
|
206
|
+
existingHost.parentNode.replaceChild(nextDom, existingHost);
|
|
207
|
+
cleanupDetachedComponentHost(existingHost, existingInstance);
|
|
208
|
+
}
|
|
209
|
+
warnUnusedStateReads(existingInstance);
|
|
210
|
+
return nextDom;
|
|
211
|
+
}
|
|
212
|
+
function itemInstanceHydrationComplete(host) {
|
|
213
|
+
const instance = host.__ASKR_INSTANCE;
|
|
214
|
+
if (instance) {
|
|
215
|
+
const scope = instance.scope;
|
|
216
|
+
if (scope) scope.hydrationPending = false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function createComponentElement(node, type, props, parentNamespace) {
|
|
220
|
+
const snapshot = getVNodeContextFrame(node) || getCurrentContextFrame();
|
|
221
|
+
const componentFn = type;
|
|
222
|
+
if (componentFn.constructor.name === "AsyncFunction") throw new Error("Async components are not supported. Use resource() for async work.");
|
|
223
|
+
let childInstance = getVNodeComponentInstance(node);
|
|
224
|
+
const hadChildInstance = !!childInstance;
|
|
225
|
+
if (!childInstance) {
|
|
226
|
+
childInstance = createComponentInstance(nextComponentInstanceId(), componentFn, props || {}, null);
|
|
227
|
+
setVNodeComponentInstance(node, childInstance);
|
|
228
|
+
}
|
|
229
|
+
if (hadChildInstance) captureInlineRenderSnapshot(childInstance);
|
|
230
|
+
childInstance.portalScope = getCurrentInstance()?.portalScope ?? childInstance.portalScope;
|
|
231
|
+
childInstance.parentInstance = getCurrentInstance();
|
|
232
|
+
childInstance.props = props || {};
|
|
233
|
+
childInstance.isRoot = isRouteRootComponentVNode(node);
|
|
234
|
+
inheritComponentCleanupStrict(childInstance);
|
|
235
|
+
if (snapshot) childInstance.ownerFrame = snapshot;
|
|
236
|
+
const result = withContext(snapshot, () => renderComponentInline(childInstance));
|
|
237
|
+
if (isPromiseLike(result)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
238
|
+
const scopedResult = markVNodeTreeWithContextFrame(result, snapshot ?? null);
|
|
239
|
+
const dom = withContext(snapshot, () => materializeComponentResultNode(childInstance, scopedResult, parentNamespace));
|
|
240
|
+
warnUnusedStateReads(childInstance);
|
|
241
|
+
if (dom instanceof Element) materializeKey(dom, node, props);
|
|
242
|
+
return dom;
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
export { createComponentElement, findHostInstanceByType, inheritComponentCleanupStrict, inheritComponentKey, isRouteRootComponentVNode, resolveNestedComponentResult, syncComponentElement };
|
|
246
|
+
|
|
247
|
+
//# sourceMappingURL=component-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-host.js","names":[],"sources":["../../src/renderer/component-host.ts"],"sourcesContent":["import { isPromiseLike } from '../common/promise';\nimport type { Props } from '../common/props';\nimport {\n captureInlineRenderSnapshot,\n cleanupComponent,\n createComponentInstance,\n getCurrentInstance,\n mountInstanceInline,\n renderComponentInline,\n warnUnusedStateReads,\n type ComponentFunction,\n type ComponentInstance,\n} from '../runtime/component-contracts';\nimport {\n getCurrentContextFrame,\n getVNodeContextFrame,\n markVNodeTreeWithContextFrame,\n withContext,\n type ContextFrame,\n} from '../runtime/context';\nimport { materializeKey } from './attributes';\nimport { normalizeComponentChildren } from './child-shape';\nimport {\n cleanupDetachedComponentHost,\n pruneComponentHostInstances,\n} from './component-host-cleanup';\nimport {\n getRendererDOMHost,\n type ElementWithContext,\n type InstanceHostElement,\n} from './dom-host';\nimport {\n findHostInstanceByType,\n getVNodeComponentInstance,\n inheritComponentCleanupStrict,\n inheritComponentKey,\n isRouteRootComponentVNode,\n nextComponentInstanceId,\n setVNodeComponentInstance,\n} from './component-host-instances';\nimport { _isDOMElement, type DOMElement, type JSXComponent, type VNode } from './types';\nimport { tagNamesEqualIgnoreCase } from './utils';\nexport {\n findHostInstanceByType,\n inheritComponentCleanupStrict,\n inheritComponentKey,\n isRouteRootComponentVNode,\n nextComponentInstanceId,\n} from './component-host-instances';\nfunction materializeComponentResultNode(\n childInstance: ComponentInstance,\n result: unknown,\n parentNamespace?: string\n): Node {\n const dom = getRendererDOMHost().createDOMNode(result, parentNamespace);\n\n if (dom instanceof Element) {\n mountInstanceInline(childInstance, dom);\n return dom;\n }\n\n if (!dom) {\n const placeholder = document.createComment('');\n try {\n (\n placeholder as Comment & { __ASKR_INSTANCE?: ComponentInstance }\n ).__ASKR_INSTANCE = childInstance;\n } catch {\n // Ignore placeholder metadata failures.\n }\n childInstance._placeholder = placeholder;\n mountInstanceInline(childInstance, null);\n return placeholder;\n }\n\n const host = document.createElement('div') as InstanceHostElement;\n host.appendChild(dom);\n host.__ASKR_WRAPPER_HOST = true;\n mountInstanceInline(childInstance, host);\n return host;\n}\n\nexport function resolveNestedComponentResult(\n result: unknown,\n snapshot: ContextFrame | null,\n parentInstance: ComponentInstance | null\n): VNode {\n let currentResult = result as VNode;\n let activeSnapshot = snapshot;\n let depth = 0;\n\n while (\n _isDOMElement(currentResult) &&\n typeof currentResult.type === 'function' &&\n depth < 16\n ) {\n const nestedSnapshot =\n getVNodeContextFrame(currentResult) ?? activeSnapshot;\n const nestedInstance = createComponentInstance(\n nextComponentInstanceId(),\n currentResult.type as ComponentFunction,\n ((currentResult as DOMElement).props ?? {}) as Props,\n null\n );\n nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);\n nestedInstance.parentInstance = parentInstance;\n nestedInstance.portalScope =\n parentInstance?.portalScope ?? nestedInstance.portalScope;\n inheritComponentCleanupStrict(nestedInstance);\n\n if (nestedSnapshot) {\n nestedInstance.ownerFrame = nestedSnapshot;\n }\n\n const nextResult = withContext(nestedSnapshot ?? null, () =>\n renderComponentInline(nestedInstance)\n );\n cleanupComponent(nestedInstance);\n\n if (isPromiseLike(nextResult)) {\n throw new Error(\n 'Async components are not supported. Components must return synchronously.'\n );\n }\n\n activeSnapshot = nestedSnapshot ?? null;\n currentResult = nextResult as VNode;\n depth += 1;\n }\n\n return currentResult;\n}\n\nfunction resolveHostNestedComponentResult(\n host: InstanceHostElement,\n retainedInstance: ComponentInstance,\n result: unknown,\n snapshot: ContextFrame | null,\n retainedHostInstances?: Iterable<ComponentInstance>\n): VNode {\n let currentResult = result as VNode;\n let activeSnapshot = snapshot;\n let depth = 0;\n const retainedInstances = new Set<ComponentInstance>([retainedInstance]);\n if (retainedHostInstances) {\n for (const instance of retainedHostInstances) {\n retainedInstances.add(instance);\n }\n }\n const createdInstances: ComponentInstance[] = [];\n\n while (\n _isDOMElement(currentResult) &&\n typeof currentResult.type === 'function' &&\n depth < 16\n ) {\n const nestedSnapshot =\n getVNodeContextFrame(currentResult) ?? activeSnapshot;\n let nestedInstance = findHostInstanceByType(\n host,\n currentResult.type as ComponentFunction\n );\n const hadNestedInstance = !!nestedInstance;\n\n if (!nestedInstance) {\n nestedInstance = createComponentInstance(\n nextComponentInstanceId(),\n currentResult.type as ComponentFunction,\n ((currentResult as DOMElement).props ?? {}) as Props,\n null\n );\n createdInstances.push(nestedInstance);\n }\n\n if (hadNestedInstance) {\n captureInlineRenderSnapshot(nestedInstance);\n }\n\n setVNodeComponentInstance(currentResult, nestedInstance);\n nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);\n nestedInstance.parentInstance = retainedInstance;\n nestedInstance.portalScope =\n retainedInstance.portalScope ?? nestedInstance.portalScope;\n inheritComponentCleanupStrict(nestedInstance);\n nestedInstance.props =\n (((currentResult as DOMElement).props ?? {}) as Props) || {};\n\n if (nestedSnapshot) {\n nestedInstance.ownerFrame = nestedSnapshot;\n }\n\n const nextResult = withContext(nestedSnapshot ?? null, () =>\n renderComponentInline(nestedInstance)\n );\n\n if (isPromiseLike(nextResult)) {\n throw new Error(\n 'Async components are not supported. Components must return synchronously.'\n );\n }\n\n retainedInstances.add(nestedInstance);\n warnUnusedStateReads(nestedInstance);\n activeSnapshot = nestedSnapshot ?? null;\n currentResult = markVNodeTreeWithContextFrame(\n nextResult,\n activeSnapshot\n ) as VNode;\n depth += 1;\n }\n\n const previousInstances = host.__ASKR_INSTANCES ?? [];\n for (const instance of previousInstances) {\n if (!retainedInstances.has(instance)) {\n cleanupComponent(instance);\n }\n }\n\n const nextHostInstances = previousInstances.filter((instance) =>\n retainedInstances.has(instance)\n );\n for (const instance of retainedInstances) {\n if (instance.target === host && !nextHostInstances.includes(instance)) {\n nextHostInstances.push(instance);\n }\n }\n\n host.__ASKR_INSTANCES = nextHostInstances;\n host.__ASKR_INSTANCE = host.__ASKR_INSTANCES[0] ?? retainedInstance;\n\n for (const instance of createdInstances) {\n mountInstanceInline(instance, host);\n }\n\n return currentResult;\n}\n\nfunction resolveWrapperHostResult(\n host: InstanceHostElement,\n result: unknown,\n snapshot: ContextFrame | null\n): unknown {\n let currentResult = result;\n let activeSnapshot = snapshot;\n let depth = 0;\n\n while (\n _isDOMElement(currentResult) &&\n typeof currentResult.type === 'function' &&\n depth < 16\n ) {\n const nestedSnapshot =\n getVNodeContextFrame(currentResult) ?? activeSnapshot;\n const nestedInstance = findHostInstanceByType(\n host,\n currentResult.type as ComponentFunction\n );\n\n if (!nestedInstance) {\n break;\n }\n\n captureInlineRenderSnapshot(nestedInstance);\n\n nestedInstance.props =\n (((currentResult as DOMElement).props ?? {}) as Props) || {};\n nestedInstance.parentInstance = getCurrentInstance();\n nestedInstance.isRoot = isRouteRootComponentVNode(currentResult);\n nestedInstance.portalScope =\n getCurrentInstance()?.portalScope ?? nestedInstance.portalScope;\n inheritComponentCleanupStrict(nestedInstance);\n\n if (nestedSnapshot) {\n nestedInstance.ownerFrame = nestedSnapshot;\n }\n\n const nextResult = withContext(nestedSnapshot ?? null, () =>\n renderComponentInline(nestedInstance)\n );\n\n if (isPromiseLike(nextResult)) {\n throw new Error(\n 'Async components are not supported. Components must return synchronously.'\n );\n }\n\n warnUnusedStateReads(nestedInstance);\n activeSnapshot = nestedSnapshot ?? null;\n currentResult = nextResult;\n depth += 1;\n }\n\n return markVNodeTreeWithContextFrame(currentResult, activeSnapshot);\n}\n\nexport function syncComponentElement(\n currentDom: Node | null,\n node: ElementWithContext,\n type: ComponentFunction,\n props: Record<string, unknown>,\n parentNamespace?: string,\n forceChildrenUpdate = false,\n retainedHostInstances?: Iterable<ComponentInstance>\n): Node | null {\n const existingHost =\n currentDom instanceof Element ? (currentDom as InstanceHostElement) : null;\n const existingInstance = existingHost\n ? findHostInstanceByType(existingHost, type)\n : null;\n if (!existingHost) {\n return null;\n }\n\n const domHost = getRendererDOMHost();\n\n if (!existingInstance || existingInstance.fn !== type) {\n const snapshot =\n getVNodeContextFrame(node) || getCurrentContextFrame() || null;\n const hydrationInstance = createComponentInstance(\n nextComponentInstanceId(),\n type,\n props || {},\n existingHost\n );\n hydrationInstance.isRoot = isRouteRootComponentVNode(node);\n hydrationInstance.portalScope =\n getCurrentInstance()?.portalScope ?? hydrationInstance.portalScope;\n inheritComponentCleanupStrict(hydrationInstance);\n\n setVNodeComponentInstance(node, hydrationInstance);\n\n if (snapshot) {\n hydrationInstance.ownerFrame = snapshot;\n }\n\n const result = withContext(snapshot, () =>\n renderComponentInline(hydrationInstance)\n );\n if (isPromiseLike(result)) {\n throw new Error(\n 'Async components are not supported. Components must return synchronously.'\n );\n }\n\n const scopedResult = markVNodeTreeWithContextFrame(\n result,\n snapshot ?? null\n );\n\n if (\n scopedResult &&\n typeof scopedResult === 'object' &&\n 'type' in (scopedResult as DOMElement) &&\n typeof (scopedResult as DOMElement).type === 'string' &&\n tagNamesEqualIgnoreCase(\n existingHost.tagName,\n (scopedResult as DOMElement).type as string\n )\n ) {\n pruneComponentHostInstances(\n existingHost,\n retainedHostInstances\n ? [hydrationInstance, ...retainedHostInstances]\n : [hydrationInstance]\n );\n withContext(snapshot, () => {\n domHost.updateElementFromVnode(\n existingHost,\n inheritComponentKey(scopedResult as DOMElement, node),\n true,\n forceChildrenUpdate || hydrationInstance.mounted === false\n );\n materializeKey(existingHost, node, props);\n });\n mountInstanceInline(hydrationInstance, existingHost);\n itemInstanceHydrationComplete(existingHost);\n warnUnusedStateReads(hydrationInstance);\n return existingHost;\n }\n\n const resolvedResult = resolveHostNestedComponentResult(\n existingHost,\n hydrationInstance,\n scopedResult,\n snapshot ?? null,\n retainedHostInstances\n );\n if (\n _isDOMElement(resolvedResult) &&\n typeof resolvedResult.type === 'string' &&\n tagNamesEqualIgnoreCase(existingHost.tagName, resolvedResult.type)\n ) {\n withContext(snapshot, () => {\n domHost.updateElementFromVnode(\n existingHost,\n inheritComponentKey(resolvedResult, node),\n true,\n forceChildrenUpdate || hydrationInstance.mounted === false\n );\n materializeKey(existingHost, node, props);\n });\n mountInstanceInline(hydrationInstance, existingHost);\n itemInstanceHydrationComplete(existingHost);\n warnUnusedStateReads(hydrationInstance);\n return existingHost;\n }\n\n const nextDom = materializeComponentResultNode(\n hydrationInstance,\n scopedResult,\n parentNamespace\n );\n\n if (nextDom instanceof Element) {\n materializeKey(nextDom, node, props);\n }\n\n if (nextDom !== existingHost && existingHost.parentNode) {\n existingHost.parentNode.replaceChild(nextDom, existingHost);\n cleanupDetachedComponentHost(existingHost, hydrationInstance);\n }\n\n warnUnusedStateReads(hydrationInstance);\n return nextDom;\n }\n\n const snapshot =\n getVNodeContextFrame(node) ||\n getCurrentContextFrame() ||\n existingInstance.ownerFrame ||\n null;\n captureInlineRenderSnapshot(existingInstance);\n existingInstance.props = props || {};\n existingInstance.isRoot = isRouteRootComponentVNode(node);\n existingInstance.portalScope =\n getCurrentInstance()?.portalScope ?? existingInstance.portalScope;\n inheritComponentCleanupStrict(existingInstance);\n\n if (snapshot) {\n existingInstance.ownerFrame = snapshot;\n }\n\n const result = withContext(snapshot, () =>\n renderComponentInline(existingInstance)\n );\n if (isPromiseLike(result)) {\n throw new Error(\n 'Async components are not supported. Components must return synchronously.'\n );\n }\n const scopedResult = markVNodeTreeWithContextFrame(result, snapshot ?? null);\n\n if (existingHost.__ASKR_WRAPPER_HOST) {\n const wrapperResult = resolveWrapperHostResult(\n existingHost,\n scopedResult,\n snapshot ?? null\n );\n domHost.updateElementChildren(\n existingHost,\n normalizeComponentChildren(wrapperResult) as VNode[]\n );\n warnUnusedStateReads(existingInstance);\n return existingHost;\n }\n\n if (\n scopedResult &&\n typeof scopedResult === 'object' &&\n 'type' in (scopedResult as DOMElement) &&\n typeof (scopedResult as DOMElement).type === 'string' &&\n tagNamesEqualIgnoreCase(\n existingHost.tagName,\n (scopedResult as DOMElement).type as string\n )\n ) {\n pruneComponentHostInstances(\n existingHost,\n retainedHostInstances\n ? [existingInstance, ...retainedHostInstances]\n : [existingInstance]\n );\n withContext(snapshot, () => {\n domHost.updateElementFromVnode(\n existingHost,\n inheritComponentKey(scopedResult as DOMElement, node),\n true,\n forceChildrenUpdate || existingInstance.mounted === false\n );\n materializeKey(existingHost, node, props);\n });\n warnUnusedStateReads(existingInstance);\n return existingHost;\n }\n\n const resolvedResult = resolveHostNestedComponentResult(\n existingHost,\n existingInstance,\n scopedResult,\n snapshot ?? null,\n retainedHostInstances\n );\n if (\n _isDOMElement(resolvedResult) &&\n typeof resolvedResult.type === 'string' &&\n tagNamesEqualIgnoreCase(existingHost.tagName, resolvedResult.type)\n ) {\n withContext(snapshot, () => {\n domHost.updateElementFromVnode(\n existingHost,\n inheritComponentKey(resolvedResult, node),\n true,\n forceChildrenUpdate || existingInstance.mounted === false\n );\n materializeKey(existingHost, node, props);\n });\n warnUnusedStateReads(existingInstance);\n return existingHost;\n }\n\n const nextDom = materializeComponentResultNode(\n existingInstance,\n scopedResult,\n parentNamespace\n );\n\n if (nextDom instanceof Element) {\n materializeKey(nextDom, node, props);\n }\n\n if (nextDom !== existingHost && existingHost.parentNode) {\n existingHost.parentNode.replaceChild(nextDom, existingHost);\n cleanupDetachedComponentHost(existingHost, existingInstance);\n }\n\n warnUnusedStateReads(existingInstance);\n return nextDom;\n}\n\nfunction itemInstanceHydrationComplete(host: InstanceHostElement): void {\n const instance = host.__ASKR_INSTANCE;\n if (instance) {\n const scope = (\n instance as unknown as { scope?: { hydrationPending?: boolean } }\n ).scope;\n if (scope) {\n scope.hydrationPending = false;\n }\n }\n}\n\nexport function createComponentElement(\n node: ElementWithContext,\n type: JSXComponent,\n props: Record<string, unknown>,\n parentNamespace?: string\n): Node {\n const frame = getVNodeContextFrame(node);\n const snapshot = frame || getCurrentContextFrame();\n\n const componentFn = type as unknown as (props: Props) => unknown;\n const isAsync = componentFn.constructor.name === 'AsyncFunction';\n\n if (isAsync) {\n throw new Error(\n 'Async components are not supported. Use resource() for async work.'\n );\n }\n\n let childInstance = getVNodeComponentInstance(node);\n const hadChildInstance = !!childInstance;\n if (!childInstance) {\n childInstance = createComponentInstance(\n nextComponentInstanceId(),\n componentFn as ComponentFunction,\n props || {},\n null\n );\n setVNodeComponentInstance(node, childInstance);\n }\n\n if (hadChildInstance) {\n captureInlineRenderSnapshot(childInstance);\n }\n\n childInstance.portalScope =\n getCurrentInstance()?.portalScope ?? childInstance.portalScope;\n childInstance.parentInstance = getCurrentInstance();\n childInstance.props = props || {};\n childInstance.isRoot = isRouteRootComponentVNode(node);\n inheritComponentCleanupStrict(childInstance);\n\n if (snapshot) {\n childInstance.ownerFrame = snapshot;\n }\n\n const result = withContext(snapshot, () =>\n renderComponentInline(childInstance)\n );\n\n if (isPromiseLike(result)) {\n throw new Error(\n 'Async components are not supported. Components must return synchronously.'\n );\n }\n\n const scopedResult = markVNodeTreeWithContextFrame(result, snapshot ?? null);\n\n const dom = withContext(snapshot, () =>\n materializeComponentResultNode(childInstance, scopedResult, parentNamespace)\n );\n\n warnUnusedStateReads(childInstance);\n\n if (dom instanceof Element) {\n materializeKey(dom, node, props);\n }\n return dom;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiDA,SAAS,+BACP,eACA,QACA,iBACM;CACN,MAAM,MAAM,mBAAmB,CAAC,CAAC,cAAc,QAAQ,eAAe;CAEtE,IAAI,eAAe,SAAS;EAC1B,oBAAoB,e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,gBACtB,+BAA+B,eAAe,cAAc,eAAe,CAC7E;CAEA,qBAAqB,aAAa;CAElC,IAAI,eAAe,SACjB,eAAe,KAAK,MAAM,KAAK;CAEjC,OAAO;AACT"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/renderer/dom-host.ts
|
|
2
|
+
let rendererDOMHost = null;
|
|
3
|
+
function configureRendererDOMHost(host) {
|
|
4
|
+
rendererDOMHost = host;
|
|
5
|
+
}
|
|
6
|
+
function getRendererDOMHost() {
|
|
7
|
+
if (!rendererDOMHost) throw new Error("[askr] Renderer DOM host is not configured.");
|
|
8
|
+
return rendererDOMHost;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { configureRendererDOMHost, getRendererDOMHost };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=dom-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-host.js","names":[],"sources":["../../src/renderer/dom-host.ts"],"sourcesContent":["import type {\n ComponentFunction,\n ComponentInstance,\n} from '../runtime/component-contracts';\nimport type { ContextFrame } from '../runtime/context';\nimport type { DOMElement, VNode } from './types';\n\nexport type ElementWithContext = DOMElement & {\n [key: symbol]: ContextFrame | boolean | undefined;\n __instance?: ComponentInstance;\n};\n\nexport type InstanceHostElement = Element & {\n __ASKR_INSTANCE?: ComponentInstance;\n __ASKR_INSTANCES?: ComponentInstance[];\n __ASKR_WRAPPER_HOST?: boolean;\n};\n\nexport interface RendererDOMHost {\n createDOMNode(node: unknown, parentNamespace?: string): Node | null;\n syncComponentElement(\n currentDom: Node | null,\n node: ElementWithContext,\n type: ComponentFunction,\n props: Record<string, unknown>,\n parentNamespace?: string,\n forceChildrenUpdate?: boolean,\n retainedHostInstances?: Iterable<ComponentInstance>\n ): Node | null;\n updateElementFromVnode(\n el: Element,\n vnode: VNode,\n updateChildren?: boolean,\n forceChildrenUpdate?: boolean\n ): void;\n updateElementChildren(\n el: Element,\n children: VNode | VNode[] | undefined,\n forceUpdate?: boolean\n ): void;\n tryPatchStableForDirtyItem(scope: { dom?: Node; vnode?: VNode }): boolean;\n}\n\nlet rendererDOMHost: RendererDOMHost | null = null;\n\nexport function configureRendererDOMHost(host: RendererDOMHost): void {\n rendererDOMHost = host;\n}\n\nexport function getRendererDOMHost(): RendererDOMHost {\n if (!rendererDOMHost) {\n throw new Error('[askr] Renderer DOM host is not configured.');\n }\n return rendererDOMHost;\n}\n"],"mappings":";AA2CA,IAAI,kBAA0C;AAE9C,SAAgB,yBAAyB,MAA6B;CACpE,kBAAkB;AACpB;AAEA,SAAgB,qBAAsC;CACpD,IAAI,CAAC,iBACH,MAAM,IAAI,MAAM,6CAA6C;CAE/D,OAAO;AACT"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { __ERROR_BOUNDARY__, __FOR_BOUNDARY__, _isDOMElement } from "../common/vnode.js";
|
|
2
|
+
import "./types.js";
|
|
3
|
+
import { getRuntimeEnv } from "../common/env.js";
|
|
4
|
+
import { logger } from "../dev/logger.js";
|
|
5
|
+
import { Fragment } from "../common/jsx.js";
|
|
6
|
+
import { removeAllListeners, removeElementReactiveProps, teardownNodeSubtree, updateElementRef } from "./cleanup.js";
|
|
7
|
+
import "./env.js";
|
|
8
|
+
import "../jsx-runtime.js";
|
|
9
|
+
import { isBenchMetricScopeActive, recordBenchCounter } from "../runtime/for-bench.js";
|
|
10
|
+
import "../runtime/for.js";
|
|
11
|
+
import { applyStaticScalarPropsToElement, hasMatchingStaticProps, materializeKey } from "./attributes.js";
|
|
12
|
+
import { createElementForNamespace, resolveChildNamespace } from "./namespaces.js";
|
|
13
|
+
import { configureBoundaryDOMHost, createForBoundary, getControlBoundaryState, getDirectControlBoundaryVNode, registerControlBoundaryCommitOwner } from "./boundaries.js";
|
|
14
|
+
import { isBulkTextFastPathEligible, performBulkPositionalKeyedTextUpdate, performBulkTextReplace } from "./children.js";
|
|
15
|
+
import { maybeWarnMissingKeys, tryGetStaticCreateFastPathShape } from "./child-shape.js";
|
|
16
|
+
import { configureRendererDOMHost } from "./dom-host.js";
|
|
17
|
+
import { createComponentElement, syncComponentElement } from "./component-host.js";
|
|
18
|
+
import { syncReactiveScalarChild } from "./reactive-children.js";
|
|
19
|
+
import { canReuseStaticSubtree, setStaticChildSlotsCacheEnabled } from "./static-reuse.js";
|
|
20
|
+
import { rendererReactiveChildDOMHost, updateElementChildren, updateUnkeyedChildren } from "./element-children.js";
|
|
21
|
+
import { createErrorBoundaryElement } from "./error-boundary-dom.js";
|
|
22
|
+
import { applyPropsToElement, hasTrackedElementPropBindings, markReactivePropsDirtySource, syncElementPropBindings } from "./prop-bindings.js";
|
|
23
|
+
import { runRetainedElementUpdate } from "./retained-element-rollback.js";
|
|
24
|
+
import { tryPatchStableForDirtyItem } from "./stable-patch.js";
|
|
25
|
+
//#region src/renderer/dom-internal.ts
|
|
26
|
+
const IS_DOM_AVAILABLE = typeof document !== "undefined";
|
|
27
|
+
function getHydrationSkipBoundary(el) {
|
|
28
|
+
return el.closest("[data-skip-hydrate=\"true\"]");
|
|
29
|
+
}
|
|
30
|
+
function isHydrationSkipped(el) {
|
|
31
|
+
return getHydrationSkipBoundary(el) !== null;
|
|
32
|
+
}
|
|
33
|
+
function clearHydrationDeferredSubtree(el) {
|
|
34
|
+
const boundary = getHydrationSkipBoundary(el);
|
|
35
|
+
if (!boundary) return;
|
|
36
|
+
if (boundary === el) {
|
|
37
|
+
removeAllListeners(el);
|
|
38
|
+
removeElementReactiveProps(el);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function createDOMNode(node, parentNamespace) {
|
|
42
|
+
if (!IS_DOM_AVAILABLE) {
|
|
43
|
+
if (getRuntimeEnv().NODE_ENV !== "production") try {
|
|
44
|
+
logger.warn("[Askr] createDOMNode called in non-DOM environment");
|
|
45
|
+
} catch {}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (typeof node === "string") {
|
|
49
|
+
if (isBenchMetricScopeActive("coldCreate")) recordBenchCounter("domNodesCreated");
|
|
50
|
+
return document.createTextNode(node);
|
|
51
|
+
}
|
|
52
|
+
if (typeof node === "number") {
|
|
53
|
+
if (isBenchMetricScopeActive("coldCreate")) recordBenchCounter("domNodesCreated");
|
|
54
|
+
return document.createTextNode(String(node));
|
|
55
|
+
}
|
|
56
|
+
if (!node) return null;
|
|
57
|
+
if (Array.isArray(node)) {
|
|
58
|
+
maybeWarnMissingKeys(node);
|
|
59
|
+
const fragment = document.createDocumentFragment();
|
|
60
|
+
for (const child of node) {
|
|
61
|
+
const dom = createDOMNode(child, parentNamespace);
|
|
62
|
+
if (dom) fragment.appendChild(dom);
|
|
63
|
+
}
|
|
64
|
+
return fragment;
|
|
65
|
+
}
|
|
66
|
+
if (typeof node === "object" && node !== null && "type" in node) {
|
|
67
|
+
const type = node.type;
|
|
68
|
+
const props = node.props || {};
|
|
69
|
+
if (typeof type === "string") return createIntrinsicElement(node, type, props, parentNamespace);
|
|
70
|
+
if (typeof type === "function") return createComponentElement(node, type, props, parentNamespace);
|
|
71
|
+
if (type === __FOR_BOUNDARY__) return createForBoundary(node, props, parentNamespace);
|
|
72
|
+
if (type === __ERROR_BOUNDARY__) return createErrorBoundaryElement(node, props, parentNamespace);
|
|
73
|
+
if (typeof type === "symbol" && (type === Fragment || String(type) === "Symbol(Fragment)")) return createFragmentElement(node, props, parentNamespace);
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function createIntrinsicElement(node, type, props, parentNamespace) {
|
|
78
|
+
const children = props.children ?? node.children;
|
|
79
|
+
const elementNamespace = resolveChildNamespace(type, parentNamespace);
|
|
80
|
+
const el = createElementForNamespace(type, parentNamespace);
|
|
81
|
+
if (isBenchMetricScopeActive("coldCreate")) recordBenchCounter("domNodesCreated");
|
|
82
|
+
materializeKey(el, node, props);
|
|
83
|
+
const staticCreateFastPath = tryGetStaticCreateFastPathShape(props, children);
|
|
84
|
+
if (staticCreateFastPath) {
|
|
85
|
+
applyStaticScalarPropsToElement(el, props, type);
|
|
86
|
+
if (staticCreateFastPath.textContent !== null) {
|
|
87
|
+
el.textContent = staticCreateFastPath.textContent;
|
|
88
|
+
if (isBenchMetricScopeActive("coldCreate")) recordBenchCounter("domNodesCreated");
|
|
89
|
+
}
|
|
90
|
+
return el;
|
|
91
|
+
}
|
|
92
|
+
applyPropsToElement(el, props, type, isHydrationSkipped);
|
|
93
|
+
if (children !== null && children !== void 0) {
|
|
94
|
+
const controlBoundaryVNode = getDirectControlBoundaryVNode(children);
|
|
95
|
+
if (controlBoundaryVNode) {
|
|
96
|
+
const controlState = getControlBoundaryState(controlBoundaryVNode);
|
|
97
|
+
if (!controlState) throw new Error("[createIntrinsicElement] Control boundary missing internal state");
|
|
98
|
+
registerControlBoundaryCommitOwner(el, controlState);
|
|
99
|
+
}
|
|
100
|
+
if (syncReactiveScalarChild(el, children, rendererReactiveChildDOMHost)) return el;
|
|
101
|
+
if (Array.isArray(children)) {
|
|
102
|
+
maybeWarnMissingKeys(children);
|
|
103
|
+
if (children.length > 1) {
|
|
104
|
+
const childFrag = document.createDocumentFragment();
|
|
105
|
+
for (const child of children) {
|
|
106
|
+
const dom = createDOMNode(child, elementNamespace);
|
|
107
|
+
if (dom) childFrag.appendChild(dom);
|
|
108
|
+
}
|
|
109
|
+
el.appendChild(childFrag);
|
|
110
|
+
} else if (children.length === 1) {
|
|
111
|
+
const dom = createDOMNode(children[0], elementNamespace);
|
|
112
|
+
if (dom) el.appendChild(dom);
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
const dom = createDOMNode(children, elementNamespace);
|
|
116
|
+
if (dom) el.appendChild(dom);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return el;
|
|
120
|
+
}
|
|
121
|
+
function createFragmentElement(node, props, parentNamespace) {
|
|
122
|
+
const fragment = document.createDocumentFragment();
|
|
123
|
+
const children = props.children ?? node.children;
|
|
124
|
+
if (children) if (Array.isArray(children)) {
|
|
125
|
+
maybeWarnMissingKeys(children);
|
|
126
|
+
for (const child of children) {
|
|
127
|
+
const dom = createDOMNode(child, parentNamespace);
|
|
128
|
+
if (dom) fragment.appendChild(dom);
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
const dom = createDOMNode(children, parentNamespace);
|
|
132
|
+
if (dom) fragment.appendChild(dom);
|
|
133
|
+
}
|
|
134
|
+
return fragment;
|
|
135
|
+
}
|
|
136
|
+
function updateElementFromVnode(el, vnode, updateChildren = true, forceChildrenUpdate = false) {
|
|
137
|
+
runRetainedElementUpdate(el, teardownNodeSubtree, () => {
|
|
138
|
+
applyElementUpdateFromVnode(el, vnode, updateChildren, forceChildrenUpdate);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function applyElementUpdateFromVnode(el, vnode, updateChildren, forceChildrenUpdate) {
|
|
142
|
+
if (!_isDOMElement(vnode)) return;
|
|
143
|
+
const props = vnode.props || {};
|
|
144
|
+
const domVNode = vnode;
|
|
145
|
+
if (isHydrationSkipped(el)) {
|
|
146
|
+
clearHydrationDeferredSubtree(el);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
materializeKey(el, vnode, props);
|
|
150
|
+
updateElementRef(el, props.ref);
|
|
151
|
+
if (!hasTrackedElementPropBindings(el)) {
|
|
152
|
+
if (!forceChildrenUpdate && hasMatchingStaticProps(el, props, vnode.type)) {
|
|
153
|
+
if (updateChildren) {
|
|
154
|
+
const children = props.children ?? vnode.children;
|
|
155
|
+
if (!forceChildrenUpdate && canReuseStaticSubtree(el, domVNode)) return;
|
|
156
|
+
updateElementChildren(el, children, forceChildrenUpdate);
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const usesReactiveChildren = syncReactiveScalarChild(el, props.children ?? domVNode.children, rendererReactiveChildDOMHost);
|
|
162
|
+
syncElementPropBindings(el, domVNode, props, usesReactiveChildren);
|
|
163
|
+
if (updateChildren) {
|
|
164
|
+
const children = props.children ?? vnode.children;
|
|
165
|
+
if (usesReactiveChildren) return;
|
|
166
|
+
updateElementChildren(el, children, forceChildrenUpdate);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
configureRendererDOMHost({
|
|
170
|
+
createDOMNode,
|
|
171
|
+
syncComponentElement,
|
|
172
|
+
updateElementFromVnode,
|
|
173
|
+
updateElementChildren,
|
|
174
|
+
tryPatchStableForDirtyItem
|
|
175
|
+
});
|
|
176
|
+
configureBoundaryDOMHost({
|
|
177
|
+
createDOMNode,
|
|
178
|
+
syncComponentElement,
|
|
179
|
+
updateElementFromVnode,
|
|
180
|
+
tryPatchStableForDirtyItem
|
|
181
|
+
});
|
|
182
|
+
//#endregion
|
|
183
|
+
export { IS_DOM_AVAILABLE, createDOMNode, isBulkTextFastPathEligible, markReactivePropsDirtySource, performBulkPositionalKeyedTextUpdate, performBulkTextReplace, setStaticChildSlotsCacheEnabled, syncComponentElement, tryPatchStableForDirtyItem, updateElementChildren, updateElementFromVnode, updateUnkeyedChildren };
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=dom-internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-internal.js","names":[],"sources":["../../src/renderer/dom-internal.ts"],"sourcesContent":["import { logger } from '../dev/logger';\nimport { Fragment } from '../jsx/jsx-runtime';\nimport { isBenchMetricScopeActive, recordBenchCounter } from '../runtime/for';\nimport { __ERROR_BOUNDARY__, __FOR_BOUNDARY__ } from '../common/vnode';\nimport {\n applyStaticScalarPropsToElement,\n hasMatchingStaticProps,\n materializeKey,\n} from './attributes';\nimport {\n configureBoundaryDOMHost,\n createForBoundary,\n getControlBoundaryState,\n getDirectControlBoundaryVNode,\n registerControlBoundaryCommitOwner,\n} from './boundaries';\nimport {\n isBulkTextFastPathEligible,\n performBulkPositionalKeyedTextUpdate,\n performBulkTextReplace,\n} from './children';\nimport {\n maybeWarnMissingKeys,\n tryGetStaticCreateFastPathShape,\n} from './child-shape';\nimport {\n removeAllListeners,\n removeElementReactiveProps,\n teardownNodeSubtree,\n updateElementRef,\n} from './cleanup';\nimport { createComponentElement, syncComponentElement } from './component-host';\nimport { configureRendererDOMHost, type ElementWithContext } from './dom-host';\nimport {\n rendererReactiveChildDOMHost,\n updateElementChildren,\n updateUnkeyedChildren,\n} from './element-children';\nimport {\n createErrorBoundaryElement,\n type ErrorBoundaryVNode,\n} from './error-boundary-dom';\nimport { getRuntimeEnv } from './env';\nimport { createElementForNamespace, resolveChildNamespace } from './namespaces';\nimport {\n applyPropsToElement,\n hasTrackedElementPropBindings,\n syncElementPropBindings,\n} from './prop-bindings';\nimport { syncReactiveScalarChild } from './reactive-children';\nimport { runRetainedElementUpdate } from './retained-element-rollback';\nimport { canReuseStaticSubtree } from './static-reuse';\nimport { tryPatchStableForDirtyItem } from './stable-patch';\nimport { _isDOMElement, type DOMElement, type JSXComponent, type VNode } from './types';\n\nexport { createForBoundary, commitForBoundaryChildren } from './boundaries';\nexport { markReactivePropsDirtySource } from './prop-bindings';\nexport { setStaticChildSlotsCacheEnabled } from './static-reuse';\nexport {\n isBulkTextFastPathEligible,\n performBulkPositionalKeyedTextUpdate,\n performBulkTextReplace,\n};\nexport {\n syncComponentElement,\n updateElementChildren,\n updateUnkeyedChildren,\n tryPatchStableForDirtyItem,\n};\n\nexport const IS_DOM_AVAILABLE = typeof document !== 'undefined';\n\nfunction getHydrationSkipBoundary(el: Element): Element | null {\n return el.closest('[data-skip-hydrate=\"true\"]');\n}\n\nfunction isHydrationSkipped(el: Element): boolean {\n return getHydrationSkipBoundary(el) !== null;\n}\n\nfunction clearHydrationDeferredSubtree(el: Element): void {\n const boundary = getHydrationSkipBoundary(el);\n if (!boundary) return;\n if (boundary === el) {\n removeAllListeners(el);\n removeElementReactiveProps(el);\n }\n}\n\nexport function createDOMNode(\n node: unknown,\n parentNamespace?: string\n): Node | null {\n if (!IS_DOM_AVAILABLE) {\n if (getRuntimeEnv().NODE_ENV !== 'production') {\n try {\n logger.warn('[Askr] createDOMNode called in non-DOM environment');\n } catch {\n // ignore\n }\n }\n return null;\n }\n\n if (typeof node === 'string') {\n if (isBenchMetricScopeActive('coldCreate')) {\n recordBenchCounter('domNodesCreated');\n }\n return document.createTextNode(node);\n }\n if (typeof node === 'number') {\n if (isBenchMetricScopeActive('coldCreate')) {\n recordBenchCounter('domNodesCreated');\n }\n return document.createTextNode(String(node));\n }\n\n if (!node) {\n return null;\n }\n\n if (Array.isArray(node)) {\n maybeWarnMissingKeys(node);\n const fragment = document.createDocumentFragment();\n for (const child of node) {\n const dom = createDOMNode(child, parentNamespace);\n if (dom) fragment.appendChild(dom);\n }\n return fragment;\n }\n\n if (typeof node === 'object' && node !== null && 'type' in node) {\n const type = (node as DOMElement).type;\n const props = ((node as DOMElement).props || {}) as Record<string, unknown>;\n\n if (typeof type === 'string') {\n return createIntrinsicElement(\n node as DOMElement,\n type,\n props,\n parentNamespace\n );\n }\n\n if (typeof type === 'function') {\n return createComponentElement(\n node as ElementWithContext,\n type as JSXComponent,\n props,\n parentNamespace\n );\n }\n\n if (type === __FOR_BOUNDARY__) {\n return createForBoundary(node as DOMElement, props, parentNamespace);\n }\n\n if (type === __ERROR_BOUNDARY__) {\n return createErrorBoundaryElement(\n node as ErrorBoundaryVNode,\n props,\n parentNamespace\n );\n }\n\n if (\n typeof type === 'symbol' &&\n (type === Fragment || String(type) === 'Symbol(Fragment)')\n ) {\n return createFragmentElement(node as DOMElement, props, parentNamespace);\n }\n }\n\n return null;\n}\n\nfunction createIntrinsicElement(\n node: DOMElement,\n type: string,\n props: Record<string, unknown>,\n parentNamespace?: string\n): Element {\n const children = props.children ?? node.children;\n const elementNamespace = resolveChildNamespace(type, parentNamespace);\n const el = createElementForNamespace(type, parentNamespace);\n\n if (isBenchMetricScopeActive('coldCreate')) {\n recordBenchCounter('domNodesCreated');\n }\n\n materializeKey(el, node, props);\n\n const staticCreateFastPath = tryGetStaticCreateFastPathShape(props, children);\n\n if (staticCreateFastPath) {\n applyStaticScalarPropsToElement(el, props, type);\n if (staticCreateFastPath.textContent !== null) {\n el.textContent = staticCreateFastPath.textContent;\n if (isBenchMetricScopeActive('coldCreate')) {\n recordBenchCounter('domNodesCreated');\n }\n }\n return el;\n }\n\n applyPropsToElement(el, props, type, isHydrationSkipped);\n\n if (children !== null && children !== undefined) {\n const controlBoundaryVNode = getDirectControlBoundaryVNode(children);\n if (controlBoundaryVNode) {\n const controlState = getControlBoundaryState(controlBoundaryVNode);\n if (!controlState) {\n throw new Error(\n '[createIntrinsicElement] Control boundary missing internal state'\n );\n }\n registerControlBoundaryCommitOwner(el, controlState);\n }\n\n if (syncReactiveScalarChild(el, children, rendererReactiveChildDOMHost)) {\n return el;\n }\n\n if (Array.isArray(children)) {\n maybeWarnMissingKeys(children);\n if (children.length > 1) {\n const childFrag = document.createDocumentFragment();\n for (const child of children) {\n const dom = createDOMNode(child, elementNamespace);\n if (dom) childFrag.appendChild(dom);\n }\n el.appendChild(childFrag);\n } else if (children.length === 1) {\n const dom = createDOMNode(children[0], elementNamespace);\n if (dom) el.appendChild(dom);\n }\n } else {\n const dom = createDOMNode(children, elementNamespace);\n if (dom) el.appendChild(dom);\n }\n }\n return el;\n}\n\nfunction createFragmentElement(\n node: DOMElement,\n props: Record<string, unknown>,\n parentNamespace?: string\n): DocumentFragment {\n const fragment = document.createDocumentFragment();\n const children = props.children ?? node.children;\n if (children) {\n if (Array.isArray(children)) {\n maybeWarnMissingKeys(children);\n for (const child of children) {\n const dom = createDOMNode(child, parentNamespace);\n if (dom) fragment.appendChild(dom);\n }\n } else {\n const dom = createDOMNode(children, parentNamespace);\n if (dom) fragment.appendChild(dom);\n }\n }\n return fragment;\n}\n\nexport function updateElementFromVnode(\n el: Element,\n vnode: VNode,\n updateChildren = true,\n forceChildrenUpdate = false\n): void {\n runRetainedElementUpdate(el, teardownNodeSubtree, () => {\n applyElementUpdateFromVnode(el, vnode, updateChildren, forceChildrenUpdate);\n });\n}\n\nfunction applyElementUpdateFromVnode(\n el: Element,\n vnode: VNode,\n updateChildren: boolean,\n forceChildrenUpdate: boolean\n): void {\n if (!_isDOMElement(vnode)) {\n return;\n }\n\n const props = (vnode.props || {}) as Record<string, unknown>;\n const domVNode = vnode as DOMElement;\n\n if (isHydrationSkipped(el)) {\n clearHydrationDeferredSubtree(el);\n return;\n }\n\n materializeKey(el, vnode, props);\n updateElementRef(el, props.ref);\n\n if (!hasTrackedElementPropBindings(el)) {\n if (\n !forceChildrenUpdate &&\n hasMatchingStaticProps(el, props, vnode.type as string)\n ) {\n if (updateChildren) {\n const children =\n (props.children as VNode | VNode[] | undefined) ?? vnode.children;\n if (!forceChildrenUpdate && canReuseStaticSubtree(el, domVNode)) {\n return;\n }\n updateElementChildren(el, children, forceChildrenUpdate);\n }\n return;\n }\n }\n\n const nextChildren = props.children ?? domVNode.children;\n const usesReactiveChildren = syncReactiveScalarChild(\n el,\n nextChildren,\n rendererReactiveChildDOMHost\n );\n syncElementPropBindings(el, domVNode, props, usesReactiveChildren);\n\n if (updateChildren) {\n const children =\n (props.children as VNode | VNode[] | undefined) ?? vnode.children;\n if (usesReactiveChildren) {\n return;\n }\n updateElementChildren(el, children, forceChildrenUpdate);\n }\n}\n\nconfigureRendererDOMHost({\n createDOMNode,\n syncComponentElement,\n updateElementFromVnode,\n updateElementChildren,\n tryPatchStableForDirtyItem,\n});\n\nconfigureBoundaryDOMHost({\n createDOMNode,\n syncComponentElement,\n updateElementFromVnode,\n tryPatchStableForDirtyItem,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,MAAa,mBAAmB,OAAO,aAAa;AAEpD,SAAS,yBAAyB,IAA6B;CAC7D,OAAO,GAAG,QAAQ,8BAA4B;AAChD;AAEA,SAAS,mBAAmB,IAAsB;CAChD,OAAO,yBAAyB,EAAE,MAAM;AAC1C;AAEA,SAAS,8BAA8B,IAAmB;CACxD,MAAM,WAAW,yBAAyB,EAAE;CAC5C,IAAI,CAAC,UAAU;CACf,IA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