@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntrinsicFallbackProps, KnownIntrinsicElementProps, Props } from "./common/props.js";
|
|
2
|
-
import { Fragment, JSXElement } from "./common/jsx.js";
|
|
2
|
+
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "./common/jsx.js";
|
|
3
3
|
import { EagerControlPrimitive } from "./common/control.js";
|
|
4
4
|
//#region src/jsx/jsx-dev-runtime.d.ts
|
|
5
5
|
declare function jsxDEV(type: EagerControlPrimitive, props: Props | null, key?: string | number, isStaticChildren?: boolean): unknown;
|
|
@@ -8,5 +8,5 @@ declare function jsxDEV<TTag extends string>(type: Exclude<TTag, keyof KnownIntr
|
|
|
8
8
|
declare function jsxDEV<TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
9
9
|
declare function jsxDEV(type: symbol, props: Props | null, key?: string | number, isStaticChildren?: boolean): JSXElement;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { Fragment, type JSXElement, jsxDEV };
|
|
11
|
+
export { Fragment, type JSXComponent, type JSXElement, type JSXElementType, jsxDEV };
|
|
12
12
|
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.d.ts","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"mappings":";;;;iBA2CgB,MAAA,CACd,IAAA,EAAM,qBAAA,EACN,KAAA,EAAO,KAAK,SACZ,GAAA,oBACA,gBAAA;AAAA,iBAEc,MAAA,oBAA0B,0BAAA,EACxC,IAAA,EAAM,IAAA,EACN,KAAA,EAAO,0BAAA,CAA2B,IAAA,UAClC,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,sBACd,IAAA,EAAM,OAAA,CAAQ,IAAA,QAAY,0BAAA,GAC1B,KAAA,EAAO,sBAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,wBACd,IAAA,GAAO,KAAA,EAAO,MAAA,cACd,KAAA,EAAO,MAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAA;AAAA,iBACa,MAAA,CACd,IAAA,UACA,KAAA,EAAO,KAAA,SACP,GAAA,oBACA,gBAAA,aACC,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.js","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime factory\n * Same element shape as production runtime, with room for dev warnings.\n */\nimport type {\n IntrinsicFallbackProps,\n KnownIntrinsicElementProps,\n Props,\n} from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime/readable';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: symbol,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","names":[],"sources":["../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * JSX dev runtime factory\n * Same element shape as production runtime, with room for dev warnings.\n */\nimport type {\n IntrinsicFallbackProps,\n KnownIntrinsicElementProps,\n Props,\n} from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElementType,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime/readable';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: symbol,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as JSXElementType,\n props: preparedProps,\n key: key ?? null,\n };\n}\n\n// Re-export Fragment for JSX\nexport { Fragment };\nexport type { JSXComponent, JSXElement, JSXElementType } from './types';\n"],"mappings":";;;;;AAsBA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,kBAAmB,SAAS,CAAC;CAEnC,KAAK,MAAM,SAAS,OAAO,OAAO,eAAe,GAC/C,kBAAkB,KAAK;CAGzB,OAAO;AACT;AAEA,SAAS,mBAAmB,OAAqB;CAC/C,IAAI,MAAM,QAAQ,MAAM,QAAQ,GAC9B,OAAO,eAAe,MAAM,UAAU,iBAAiB;EACrD,OAAO;EACP,cAAc;CAChB,CAAC;CAGH,OAAO;AACT;AAgCA,SAAgB,OACd,MACA,OACA,KACA,mBAAmB,OACG;CACtB,MAAM,kBAAkB,mBAAmB,KAAK;CAChD,MAAM,gBAAgB,mBAClB,mBAAmB,eAAe,IAClC;CAEJ,IAAI,wBAAwB,IAAI,GAC9B,OAAO,KAAK,aAAa;CAG3B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;CACd;AACF"}
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IntrinsicFallbackProps, KnownIntrinsicElementProps, Props } from "./common/props.js";
|
|
2
|
-
import { Fragment, JSXElement } from "./common/jsx.js";
|
|
2
|
+
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "./common/jsx.js";
|
|
3
3
|
import { EagerControlPrimitive } from "./common/control.js";
|
|
4
4
|
//#region src/jsx/jsx-runtime.d.ts
|
|
5
5
|
declare function jsxDEV(type: EagerControlPrimitive, props: Props | null, key?: string | number, isStaticChildren?: boolean): unknown;
|
|
@@ -18,5 +18,5 @@ declare function jsxs<TTag extends string>(type: Exclude<TTag, keyof KnownIntrin
|
|
|
18
18
|
declare function jsxs<TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number): JSXElement;
|
|
19
19
|
declare function jsxs(type: symbol, props: Props | null, key?: string | number): JSXElement;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { Fragment, type JSXElement, jsx, jsxDEV, jsxs };
|
|
21
|
+
export { Fragment, type JSXComponent, type JSXElement, type JSXElementType, jsx, jsxDEV, jsxs };
|
|
22
22
|
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.d.ts","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"mappings":";;;;iBA4CgB,MAAA,CACd,IAAA,EAAM,qBAAA,EACN,KAAA,EAAO,KAAK,SACZ,GAAA,oBACA,gBAAA;AAAA,iBAEc,MAAA,oBAA0B,0BAAA,EACxC,IAAA,EAAM,IAAA,EACN,KAAA,EAAO,0BAA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AO,MAAA,cACd,KAAA,EAAO,MAAA,SACP,GAAA,qBACC,UAAA;AAAA,iBACa,IAAA,CACd,IAAA,UACA,KAAA,EAAO,KAAA,SACP,GAAA,qBACC,UAAU"}
|
package/dist/jsx-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"sourcesContent":["/**\n * JSX runtime factory\n * Same element shape as production runtime.\n */\n\nimport type {\n IntrinsicFallbackProps,\n KnownIntrinsicElementProps,\n Props,\n} from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime/readable';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: symbol,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx/jsx-runtime.ts"],"sourcesContent":["/**\n * JSX runtime factory\n * Same element shape as production runtime.\n */\n\nimport type {\n IntrinsicFallbackProps,\n KnownIntrinsicElementProps,\n Props,\n} from '../common/props';\nimport {\n isEagerControlPrimitive,\n type EagerControlPrimitive,\n} from '../common/control';\nimport {\n ELEMENT_TYPE,\n Fragment,\n STATIC_CHILDREN,\n type JSXElementType,\n type JSXElement,\n} from './types';\nimport { markReadableUsage } from '../runtime/readable';\n\nfunction annotatePropsUsage(props: Record<string, unknown> | null): Props {\n const normalizedProps = (props ?? {}) as Props;\n\n for (const value of Object.values(normalizedProps)) {\n markReadableUsage(value);\n }\n\n return normalizedProps;\n}\n\nfunction markStaticChildren(props: Props): Props {\n if (Array.isArray(props.children)) {\n Object.defineProperty(props.children, STATIC_CHILDREN, {\n value: true,\n configurable: true,\n });\n }\n\n return props;\n}\n\nexport function jsxDEV(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): unknown;\nexport function jsxDEV<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: symbol,\n props: Props | null,\n key?: string | number,\n isStaticChildren?: boolean\n): JSXElement;\nexport function jsxDEV(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number,\n isStaticChildren = false\n): JSXElement | unknown {\n const normalizedProps = annotatePropsUsage(props);\n const preparedProps = isStaticChildren\n ? markStaticChildren(normalizedProps)\n : normalizedProps;\n\n if (isEagerControlPrimitive(type)) {\n return type(preparedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as JSXElementType,\n props: preparedProps,\n key: key ?? null,\n };\n}\n\n// Production-style helpers: alias to the DEV factory for now\nexport function jsx(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number\n): unknown;\nexport function jsx<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number\n): JSXElement;\nexport function jsx<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number\n): JSXElement;\nexport function jsx<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number\n): JSXElement;\nexport function jsx(\n type: symbol,\n props: Props | null,\n key?: string | number\n): JSXElement;\nexport function jsx(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n) {\n return jsxDEV(type as never, props, key);\n}\n\nexport function jsxs(\n type: EagerControlPrimitive,\n props: Props | null,\n key?: string | number\n): unknown;\nexport function jsxs<TTag extends keyof KnownIntrinsicElementProps>(\n type: TTag,\n props: KnownIntrinsicElementProps[TTag] | null,\n key?: string | number\n): JSXElement;\nexport function jsxs<TTag extends string>(\n type: Exclude<TTag, keyof KnownIntrinsicElementProps>,\n props: IntrinsicFallbackProps | null,\n key?: string | number\n): JSXElement;\nexport function jsxs<TProps extends object>(\n type: (props: TProps) => unknown,\n props: TProps | null,\n key?: string | number\n): JSXElement;\nexport function jsxs(\n type: symbol,\n props: Props | null,\n key?: string | number\n): JSXElement;\nexport function jsxs(\n type: unknown,\n props: Record<string, unknown> | null,\n key?: string | number\n) {\n const normalizedProps = markStaticChildren(annotatePropsUsage(props));\n\n if (isEagerControlPrimitive(type)) {\n return type(normalizedProps);\n }\n\n return {\n $$typeof: ELEMENT_TYPE,\n type: type as JSXElementType,\n props: normalizedProps,\n key: key ?? null,\n } as JSXElement;\n}\n\n// Re-export Fragment for JSX.\nexport { Fragment };\nexport type { JSXComponent, JSXElement, JSXElementType } from './types';\n"],"mappings":";;;;;AAuBA,SAAS,mBAAmB,OAA8C;CACxE,MAAM,kBAAmB,SAAS,CAAC;CAEnC,KAAK,MAAM,SAAS,OAAO,OAAO,eAAe,GAC/C,kBAAkB,KAAK;CAGzB,OAAO;AACT;AAEA,SAAS,mBAAmB,OAAqB;CAC/C,IAAI,MAAM,QAAQ,MAAM,QAAQ,GAC9B,OAAO,eAAe,MAAM,UAAU,iBAAiB;EACrD,OAAO;EACP,cAAc;CAChB,CAAC;CAGH,OAAO;AACT;AAgCA,SAAgB,OACd,MACA,OACA,KACA,mBAAmB,OACG;CACtB,MAAM,kBAAkB,mBAAmB,KAAK;CAChD,MAAM,gBAAgB,mBAClB,mBAAmB,eAAe,IAClC;CAEJ,IAAI,wBAAwB,IAAI,GAC9B,OAAO,KAAK,aAAa;CAG3B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;CACd;AACF;AA4BA,SAAgB,IACd,MACA,OACA,KACA;CACA,OAAO,OAAO,MAAe,OAAO,GAAG;AACzC;AA2BA,SAAgB,KACd,MACA,OACA,KACA;CACA,MAAM,kBAAkB,mBAAmB,mBAAmB,KAAK,CAAC;CAEpE,IAAI,wBAAwB,IAAI,GAC9B,OAAO,KAAK,eAAe;CAG7B,OAAO;EACL,UAAU;EACJ;EACN,OAAO;EACP,KAAK,OAAO;CACd;AACF"}
|
package/dist/jsx-runtime2.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { Fragment, JSXElement } from "./common/jsx.js";
|
|
2
|
-
import { jsx, jsxDEV, jsxs } from "./jsx-runtime.js";
|
|
1
|
+
import { Fragment, JSXComponent, JSXElement, JSXElementType } from "./common/jsx.js";
|
|
2
|
+
import { jsx, jsxDEV, jsxs } from "./jsx-runtime.js";
|
|
3
|
+
export { Fragment, jsx, jsxs };
|
package/dist/jsx-runtime2.js
CHANGED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { incrementPerfMetric } from "../runtime/perf-metrics.js";
|
|
2
|
+
import { extractKey, getRenderedAttributeName, isSkippedProp, parseEventName, readElementClassName, removeRenderedAttribute, setRenderedAttribute, tagNamesEqualIgnoreCase, writeElementClassName } from "./utils.js";
|
|
3
|
+
function applyFormControlProp(el, key, value, tagName) {
|
|
4
|
+
if (key === "value") {
|
|
5
|
+
if (tagNamesEqualIgnoreCase(tagName, "input") || tagNamesEqualIgnoreCase(tagName, "textarea") || tagNamesEqualIgnoreCase(tagName, "select")) {
|
|
6
|
+
el.value = String(value);
|
|
7
|
+
el.setAttribute("value", String(value));
|
|
8
|
+
} else el.setAttribute("value", String(value));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (key === "checked") if (tagNamesEqualIgnoreCase(tagName, "input")) {
|
|
12
|
+
const checked = Boolean(value);
|
|
13
|
+
el.checked = checked;
|
|
14
|
+
if (checked) el.setAttribute("checked", "");
|
|
15
|
+
else el.removeAttribute("checked");
|
|
16
|
+
} else if (value) el.setAttribute("checked", "");
|
|
17
|
+
else el.removeAttribute("checked");
|
|
18
|
+
}
|
|
19
|
+
function normalizeStylePropertyName(propertyName) {
|
|
20
|
+
if (propertyName.startsWith("--")) return propertyName;
|
|
21
|
+
return propertyName.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
22
|
+
}
|
|
23
|
+
function collectCurrentStyleEntries(el) {
|
|
24
|
+
const entries = /* @__PURE__ */ new Map();
|
|
25
|
+
const style = el.style;
|
|
26
|
+
if (!style) return entries;
|
|
27
|
+
for (let index = 0; index < style.length; index += 1) {
|
|
28
|
+
const propertyName = style.item(index);
|
|
29
|
+
entries.set(propertyName, style.getPropertyValue(propertyName));
|
|
30
|
+
}
|
|
31
|
+
return entries;
|
|
32
|
+
}
|
|
33
|
+
function normalizeStyleEntries(value) {
|
|
34
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
35
|
+
const entries = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const [key, entryValue] of Object.entries(value)) {
|
|
37
|
+
if (entryValue === void 0 || entryValue === null || entryValue === false) continue;
|
|
38
|
+
entries.set(normalizeStylePropertyName(key), String(entryValue));
|
|
39
|
+
}
|
|
40
|
+
return entries;
|
|
41
|
+
}
|
|
42
|
+
function applyStylePropValue(el, value) {
|
|
43
|
+
const style = el.style;
|
|
44
|
+
if (!style) {
|
|
45
|
+
if (value === null || value === void 0 || value === false) {
|
|
46
|
+
el.removeAttribute("style");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
el.setAttribute("style", String(value));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (value === null || value === void 0 || value === false) {
|
|
53
|
+
if (!el.getAttribute("style")) {
|
|
54
|
+
incrementPerfMetric("skippedDomPropWrites");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
style.cssText = "";
|
|
58
|
+
el.removeAttribute("style");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (typeof value === "string") {
|
|
62
|
+
if ((el.getAttribute("style") ?? "") === value) {
|
|
63
|
+
incrementPerfMetric("skippedDomPropWrites");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
style.cssText = value;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const nextEntries = normalizeStyleEntries(value);
|
|
70
|
+
if (!nextEntries) {
|
|
71
|
+
const nextText = String(value);
|
|
72
|
+
if ((el.getAttribute("style") ?? "") === nextText) {
|
|
73
|
+
incrementPerfMetric("skippedDomPropWrites");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
style.cssText = nextText;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const previousEntries = collectCurrentStyleEntries(el);
|
|
80
|
+
let didWrite = false;
|
|
81
|
+
for (const [propertyName] of previousEntries) {
|
|
82
|
+
if (nextEntries.has(propertyName)) continue;
|
|
83
|
+
style.removeProperty(propertyName);
|
|
84
|
+
didWrite = true;
|
|
85
|
+
}
|
|
86
|
+
for (const [propertyName, propertyValue] of nextEntries) {
|
|
87
|
+
if (previousEntries.get(propertyName) === propertyValue) continue;
|
|
88
|
+
style.setProperty(propertyName, propertyValue);
|
|
89
|
+
didWrite = true;
|
|
90
|
+
}
|
|
91
|
+
if (!didWrite) incrementPerfMetric("skippedDomPropWrites");
|
|
92
|
+
}
|
|
93
|
+
function applyStaticScalarPropsToElement(el, props, tagName) {
|
|
94
|
+
for (const key in props) {
|
|
95
|
+
if (isSkippedProp(key)) continue;
|
|
96
|
+
const value = props[key];
|
|
97
|
+
if (value === void 0 || value === null || value === false) continue;
|
|
98
|
+
if (key === "class" || key === "className") writeElementClassName(el, String(value));
|
|
99
|
+
else if (key === "style") applyStylePropValue(el, value);
|
|
100
|
+
else if (key === "value" || key === "checked") applyFormControlProp(el, key, value, tagName);
|
|
101
|
+
else setRenderedAttribute(el, key, String(value));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function tokenizeClassValue(value) {
|
|
105
|
+
if (typeof value !== "string") return null;
|
|
106
|
+
const trimmed = value.trim();
|
|
107
|
+
if (trimmed.length === 0) return [];
|
|
108
|
+
return trimmed.split(/\s+/);
|
|
109
|
+
}
|
|
110
|
+
function patchClassList(el, previousTokens, nextTokens) {
|
|
111
|
+
if (previousTokens.length === nextTokens.length) {
|
|
112
|
+
let identical = true;
|
|
113
|
+
for (let index = 0; index < previousTokens.length; index += 1) if (previousTokens[index] !== nextTokens[index]) {
|
|
114
|
+
identical = false;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (identical) return;
|
|
118
|
+
}
|
|
119
|
+
if (previousTokens.length === 0) {
|
|
120
|
+
if (nextTokens.length === 0) return;
|
|
121
|
+
el.classList.add(...nextTokens);
|
|
122
|
+
incrementPerfMetric("classListPatchOps");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (nextTokens.length === 0) {
|
|
126
|
+
el.classList.remove(...previousTokens);
|
|
127
|
+
incrementPerfMetric("classListPatchOps");
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (previousTokens.length === 1 && nextTokens.length === 1) {
|
|
131
|
+
el.classList.remove(previousTokens[0]);
|
|
132
|
+
el.classList.add(nextTokens[0]);
|
|
133
|
+
incrementPerfMetric("classListPatchOps");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const nextSet = new Set(nextTokens);
|
|
137
|
+
const previousSet = new Set(previousTokens);
|
|
138
|
+
for (const token of previousTokens) if (!nextSet.has(token)) el.classList.remove(token);
|
|
139
|
+
for (const token of nextTokens) if (!previousSet.has(token)) el.classList.add(token);
|
|
140
|
+
incrementPerfMetric("classListPatchOps");
|
|
141
|
+
}
|
|
142
|
+
function applyClassPropValue(el, value, previousValue, descriptor) {
|
|
143
|
+
const nextString = String(value);
|
|
144
|
+
const nextTokens = tokenizeClassValue(nextString);
|
|
145
|
+
const previousTokens = descriptor?.lastClassTokens ?? tokenizeClassValue(previousValue);
|
|
146
|
+
if (nextTokens && previousTokens) {
|
|
147
|
+
patchClassList(el, previousTokens, nextTokens);
|
|
148
|
+
if (descriptor) descriptor.lastClassTokens = nextTokens;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
writeElementClassName(el, nextString);
|
|
152
|
+
if (descriptor) descriptor.lastClassTokens = nextTokens;
|
|
153
|
+
}
|
|
154
|
+
function applyScalarPropValue(el, key, value, tagName, previousValue, descriptor) {
|
|
155
|
+
if (value === void 0 || value === null || value === false) {
|
|
156
|
+
if (key === "class" || key === "className") {
|
|
157
|
+
const previousTokens = descriptor?.lastClassTokens;
|
|
158
|
+
if (previousTokens && previousTokens.length > 0) {
|
|
159
|
+
el.classList.remove(...previousTokens);
|
|
160
|
+
incrementPerfMetric("classListPatchOps");
|
|
161
|
+
} else writeElementClassName(el, "");
|
|
162
|
+
if (descriptor) descriptor.lastClassTokens = [];
|
|
163
|
+
} else if (key === "value") applyFormControlProp(el, key, "", tagName);
|
|
164
|
+
else if (key === "checked") applyFormControlProp(el, key, false, tagName);
|
|
165
|
+
else if (key === "style") applyStylePropValue(el, null);
|
|
166
|
+
else removeRenderedAttribute(el, key);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (key === "class" || key === "className") applyClassPropValue(el, value, previousValue, descriptor);
|
|
170
|
+
else if (key === "style") applyStylePropValue(el, value);
|
|
171
|
+
else if (key === "value" || key === "checked") applyFormControlProp(el, key, value, tagName);
|
|
172
|
+
else setRenderedAttribute(el, key, String(value));
|
|
173
|
+
}
|
|
174
|
+
function removeStaleAttributes(el, vnode, props) {
|
|
175
|
+
const desiredAttributes = /* @__PURE__ */ new Set();
|
|
176
|
+
if (extractKey(vnode) !== void 0) desiredAttributes.add("data-key");
|
|
177
|
+
for (const propName in props) {
|
|
178
|
+
if (isSkippedProp(propName)) continue;
|
|
179
|
+
if (parseEventName(propName)) continue;
|
|
180
|
+
const value = props[propName];
|
|
181
|
+
if (value === void 0 || value === null || value === false) continue;
|
|
182
|
+
desiredAttributes.add(getRenderedAttributeName(el, propName));
|
|
183
|
+
}
|
|
184
|
+
for (const attribute of Array.from(el.attributes)) if (!desiredAttributes.has(getRenderedAttributeName(el, attribute.name))) removeRenderedAttribute(el, attribute.name);
|
|
185
|
+
}
|
|
186
|
+
function materializeKey(el, vnode, props) {
|
|
187
|
+
const rawKey = vnode.key ?? props.key;
|
|
188
|
+
const vnodeKey = rawKey === null || rawKey === void 0 ? void 0 : typeof rawKey === "symbol" ? String(rawKey) : rawKey;
|
|
189
|
+
if (vnodeKey !== void 0) {
|
|
190
|
+
const nextKey = String(vnodeKey);
|
|
191
|
+
if (el.getAttribute("data-key") !== nextKey) el.setAttribute("data-key", nextKey);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function hasMatchingStaticProps(el, props, vnodeType) {
|
|
195
|
+
let staticPropCount = 0;
|
|
196
|
+
for (const key in props) {
|
|
197
|
+
if (isSkippedProp(key)) continue;
|
|
198
|
+
const value = props[key];
|
|
199
|
+
if (value === void 0 || value === null || value === false) return false;
|
|
200
|
+
if (parseEventName(key) || typeof value === "function") return false;
|
|
201
|
+
if (key === "class" || key === "className") {
|
|
202
|
+
if (readElementClassName(el) !== String(value)) return false;
|
|
203
|
+
staticPropCount += 1;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (key === "style") {
|
|
207
|
+
const styleValue = typeof value === "string" ? value.trim().replace(/;$/, "") : null;
|
|
208
|
+
const domStyle = el.getAttribute("style")?.trim().replace(/;$/, "") ?? "";
|
|
209
|
+
if (styleValue === null || domStyle !== styleValue) return false;
|
|
210
|
+
staticPropCount += 1;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (key === "value" || key === "checked") {
|
|
214
|
+
if (el[key] !== value) return false;
|
|
215
|
+
staticPropCount += 1;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (key === "selected" && vnodeType === "option") {
|
|
219
|
+
if (el.selected !== Boolean(value)) return false;
|
|
220
|
+
staticPropCount += 1;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (el.getAttribute(getRenderedAttributeName(el, key)) !== String(value)) return false;
|
|
224
|
+
staticPropCount += 1;
|
|
225
|
+
}
|
|
226
|
+
return el.attributes.length === staticPropCount;
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
export { applyClassPropValue, applyFormControlProp, applyScalarPropValue, applyStaticScalarPropsToElement, applyStylePropValue, hasMatchingStaticProps, materializeKey, removeStaleAttributes };
|
|
230
|
+
|
|
231
|
+
//# sourceMappingURL=attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.js","names":[],"sources":["../../src/renderer/attributes.ts"],"sourcesContent":["import type { Props } from '../common/props';\nimport { incrementPerfMetric } from '../runtime/perf-metrics';\nimport {\n extractKey,\n getRenderedAttributeName,\n isSkippedProp,\n parseEventName,\n readElementClassName,\n removeRenderedAttribute,\n setRenderedAttribute,\n tagNamesEqualIgnoreCase,\n writeElementClassName,\n} from './utils';\n\ntype ClassTokenDescriptor = {\n lastClassTokens: string[] | null;\n};\n\ntype StyleEntries = Map<string, string>;\n\ntype Ref<T> =\n | ((value: T | null) => void)\n | { current: T | null }\n | null\n | undefined;\n\nexport function applyRef<T>(el: T, ref: unknown): void {\n const resolvedRef = ref as Ref<T>;\n if (!resolvedRef) return;\n if (typeof resolvedRef === 'function') {\n resolvedRef(el);\n return;\n }\n\n if (Object.isExtensible(resolvedRef)) {\n (resolvedRef as { current: T | null }).current = el;\n }\n}\n\nexport function applyFormControlProp(\n el: Element,\n key: string,\n value: unknown,\n tagName: string\n): void {\n if (key === 'value') {\n if (\n tagNamesEqualIgnoreCase(tagName, 'input') ||\n tagNamesEqualIgnoreCase(tagName, 'textarea') ||\n tagNamesEqualIgnoreCase(tagName, 'select')\n ) {\n (el as HTMLInputElement & Props).value = String(value);\n el.setAttribute('value', String(value));\n } else {\n el.setAttribute('value', String(value));\n }\n return;\n }\n\n if (key === 'checked') {\n if (tagNamesEqualIgnoreCase(tagName, 'input')) {\n const checked = Boolean(value);\n (el as HTMLInputElement & Props).checked = checked;\n if (checked) {\n el.setAttribute('checked', '');\n } else {\n el.removeAttribute('checked');\n }\n } else if (value) {\n el.setAttribute('checked', '');\n } else {\n el.removeAttribute('checked');\n }\n }\n}\n\nfunction normalizeStylePropertyName(propertyName: string): string {\n if (propertyName.startsWith('--')) {\n return propertyName;\n }\n\n return propertyName.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);\n}\n\nfunction collectCurrentStyleEntries(el: Element): StyleEntries {\n const entries: StyleEntries = new Map();\n const style = (el as HTMLElement | SVGElement).style;\n\n if (!style) {\n return entries;\n }\n\n for (let index = 0; index < style.length; index += 1) {\n const propertyName = style.item(index);\n entries.set(propertyName, style.getPropertyValue(propertyName));\n }\n\n return entries;\n}\n\nfunction normalizeStyleEntries(value: unknown): StyleEntries | null {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return null;\n }\n\n const entries: StyleEntries = new Map();\n for (const [key, entryValue] of Object.entries(\n value as Record<string, unknown>\n )) {\n if (\n entryValue === undefined ||\n entryValue === null ||\n entryValue === false\n ) {\n continue;\n }\n\n entries.set(normalizeStylePropertyName(key), String(entryValue));\n }\n\n return entries;\n}\n\nexport function applyStylePropValue(el: Element, value: unknown): void {\n const style = (el as HTMLElement | SVGElement).style;\n if (!style) {\n if (value === null || value === undefined || value === false) {\n el.removeAttribute('style');\n return;\n }\n\n el.setAttribute('style', String(value));\n return;\n }\n\n if (value === null || value === undefined || value === false) {\n if (!el.getAttribute('style')) {\n incrementPerfMetric('skippedDomPropWrites');\n return;\n }\n\n style.cssText = '';\n el.removeAttribute('style');\n return;\n }\n\n if (typeof value === 'string') {\n if ((el.getAttribute('style') ?? '') === value) {\n incrementPerfMetric('skippedDomPropWrites');\n return;\n }\n\n style.cssText = value;\n return;\n }\n\n const nextEntries = normalizeStyleEntries(value);\n if (!nextEntries) {\n const nextText = String(value);\n if ((el.getAttribute('style') ?? '') === nextText) {\n incrementPerfMetric('skippedDomPropWrites');\n return;\n }\n\n style.cssText = nextText;\n return;\n }\n\n const previousEntries = collectCurrentStyleEntries(el);\n let didWrite = false;\n\n for (const [propertyName] of previousEntries) {\n if (nextEntries.has(propertyName)) {\n continue;\n }\n\n style.removeProperty(propertyName);\n didWrite = true;\n }\n\n for (const [propertyName, propertyValue] of nextEntries) {\n if (previousEntries.get(propertyName) === propertyValue) {\n continue;\n }\n\n style.setProperty(propertyName, propertyValue);\n didWrite = true;\n }\n\n if (!didWrite) {\n incrementPerfMetric('skippedDomPropWrites');\n }\n}\n\nexport function applyStaticScalarPropsToElement(\n el: Element,\n props: Record<string, unknown>,\n tagName: string\n): void {\n for (const key in props) {\n if (isSkippedProp(key)) {\n continue;\n }\n\n const value = props[key];\n if (value === undefined || value === null || value === false) {\n continue;\n }\n\n if (key === 'class' || key === 'className') {\n writeElementClassName(el, String(value));\n } else if (key === 'style') {\n applyStylePropValue(el, value);\n } else if (key === 'value' || key === 'checked') {\n applyFormControlProp(el, key, value, tagName);\n } else {\n setRenderedAttribute(el, key, String(value));\n }\n }\n}\n\nfunction tokenizeClassValue(value: unknown): string[] | null {\n if (typeof value !== 'string') {\n return null;\n }\n\n const trimmed = value.trim();\n if (trimmed.length === 0) {\n return [];\n }\n\n return trimmed.split(/\\s+/);\n}\n\nfunction patchClassList(\n el: Element,\n previousTokens: string[],\n nextTokens: string[]\n): void {\n if (previousTokens.length === nextTokens.length) {\n let identical = true;\n for (let index = 0; index < previousTokens.length; index += 1) {\n if (previousTokens[index] !== nextTokens[index]) {\n identical = false;\n break;\n }\n }\n if (identical) {\n return;\n }\n }\n\n if (previousTokens.length === 0) {\n if (nextTokens.length === 0) {\n return;\n }\n el.classList.add(...nextTokens);\n incrementPerfMetric('classListPatchOps');\n return;\n }\n\n if (nextTokens.length === 0) {\n el.classList.remove(...previousTokens);\n incrementPerfMetric('classListPatchOps');\n return;\n }\n\n if (previousTokens.length === 1 && nextTokens.length === 1) {\n el.classList.remove(previousTokens[0]);\n el.classList.add(nextTokens[0]);\n incrementPerfMetric('classListPatchOps');\n return;\n }\n\n const nextSet = new Set(nextTokens);\n const previousSet = new Set(previousTokens);\n\n for (const token of previousTokens) {\n if (!nextSet.has(token)) {\n el.classList.remove(token);\n }\n }\n\n for (const token of nextTokens) {\n if (!previousSet.has(token)) {\n el.classList.add(token);\n }\n }\n\n incrementPerfMetric('classListPatchOps');\n}\n\nexport function applyClassPropValue(\n el: Element,\n value: unknown,\n previousValue: unknown,\n descriptor?: ClassTokenDescriptor\n): void {\n const nextString = String(value);\n const nextTokens = tokenizeClassValue(nextString);\n const previousTokens =\n descriptor?.lastClassTokens ?? tokenizeClassValue(previousValue);\n\n if (nextTokens && previousTokens) {\n patchClassList(el, previousTokens, nextTokens);\n if (descriptor) {\n descriptor.lastClassTokens = nextTokens;\n }\n return;\n }\n\n writeElementClassName(el, nextString);\n if (descriptor) {\n descriptor.lastClassTokens = nextTokens;\n }\n}\n\nexport function applyScalarPropValue(\n el: Element,\n key: string,\n value: unknown,\n tagName: string,\n previousValue?: unknown,\n descriptor?: ClassTokenDescriptor\n): void {\n if (value === undefined || value === null || value === false) {\n if (key === 'class' || key === 'className') {\n const previousTokens = descriptor?.lastClassTokens;\n if (previousTokens && previousTokens.length > 0) {\n el.classList.remove(...previousTokens);\n incrementPerfMetric('classListPatchOps');\n } else {\n writeElementClassName(el, '');\n }\n if (descriptor) {\n descriptor.lastClassTokens = [];\n }\n } else if (key === 'value') {\n applyFormControlProp(el, key, '', tagName);\n } else if (key === 'checked') {\n applyFormControlProp(el, key, false, tagName);\n } else if (key === 'style') {\n applyStylePropValue(el, null);\n } else {\n removeRenderedAttribute(el, key);\n }\n return;\n }\n\n if (key === 'class' || key === 'className') {\n applyClassPropValue(el, value, previousValue, descriptor);\n } else if (key === 'style') {\n applyStylePropValue(el, value);\n } else if (key === 'value' || key === 'checked') {\n applyFormControlProp(el, key, value, tagName);\n } else {\n setRenderedAttribute(el, key, String(value));\n }\n}\n\nexport function removeStaleAttributes(\n el: Element,\n vnode: unknown,\n props: Record<string, unknown>\n): void {\n const desiredAttributes = new Set<string>();\n const key = extractKey(vnode);\n\n if (key !== undefined) {\n desiredAttributes.add('data-key');\n }\n\n for (const propName in props) {\n if (isSkippedProp(propName)) continue;\n if (parseEventName(propName)) continue;\n\n const value = props[propName];\n if (value === undefined || value === null || value === false) continue;\n\n desiredAttributes.add(getRenderedAttributeName(el, propName));\n }\n\n for (const attribute of Array.from(el.attributes)) {\n if (!desiredAttributes.has(getRenderedAttributeName(el, attribute.name))) {\n removeRenderedAttribute(el, attribute.name);\n }\n }\n}\n\nexport function materializeKey(\n el: Element,\n vnode: { key?: unknown },\n props: Record<string, unknown>\n): void {\n const rawKey = vnode.key ?? props.key;\n const vnodeKey =\n rawKey === null || rawKey === undefined\n ? undefined\n : typeof rawKey === 'symbol'\n ? String(rawKey)\n : (rawKey as string | number);\n if (vnodeKey !== undefined) {\n const nextKey = String(vnodeKey);\n if (el.getAttribute('data-key') !== nextKey) {\n el.setAttribute('data-key', nextKey);\n }\n }\n}\n\nexport function hasMatchingStaticProps(\n el: Element,\n props: Record<string, unknown>,\n vnodeType: string\n): boolean {\n let staticPropCount = 0;\n\n for (const key in props) {\n if (isSkippedProp(key)) continue;\n\n const value = props[key];\n if (value === undefined || value === null || value === false) {\n return false;\n }\n\n const eventName = parseEventName(key);\n if (eventName || typeof value === 'function') {\n return false;\n }\n\n if (key === 'class' || key === 'className') {\n if (readElementClassName(el) !== String(value)) {\n return false;\n }\n staticPropCount += 1;\n continue;\n }\n\n if (key === 'style') {\n const styleValue =\n typeof value === 'string' ? value.trim().replace(/;$/, '') : null;\n const domStyle = el.getAttribute('style')?.trim().replace(/;$/, '') ?? '';\n if (styleValue === null || domStyle !== styleValue) {\n return false;\n }\n staticPropCount += 1;\n continue;\n }\n\n if (key === 'value' || key === 'checked') {\n if ((el as HTMLElement & Record<string, unknown>)[key] !== value) {\n return false;\n }\n staticPropCount += 1;\n continue;\n }\n\n if (key === 'selected' && vnodeType === 'option') {\n if ((el as HTMLOptionElement).selected !== Boolean(value)) {\n return false;\n }\n staticPropCount += 1;\n continue;\n }\n\n if (el.getAttribute(getRenderedAttributeName(el, key)) !== String(value)) {\n return false;\n }\n\n staticPropCount += 1;\n }\n\n return el.attributes.length === staticPropCount;\n}\n"],"mappings":";;AAuCA,SAAgB,qBACd,IACA,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A,IAAI,QAAQ,SAAS;GACnB,MAAM,aACJ,OAAO,UAAU,WAAW,MAAM,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE,IAAI;GAC/D,MAAM,WAAW,GAAG,aAAa,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC,QAAQ,MAAM,EAAE,KAAK;GACvE,IAAI,eAAe,QAAQ,aAAa,YACtC,OAAO;GAET,mBAAmB;GACnB;EACF;EAEA,IAAI,QAAQ,WAAW,QAAQ,WAAW;GACxC,IAAK,GAA6C,SAAS,OACzD,OAAO;GAET,mBAAmB;GACnB;EACF;EAEA,IAAI,QAAQ,cAAc,cAAc,UAAU;GAChD,IAAK,GAAyB,aAAa,QAAQ,KAAK,GACtD,OAAO;GAET,mBAAmB;GACnB;EACF;EAEA,IAAI,GAAG,aAAa,yBAAyB,IAAI,GAAG,CAAC,MAAM,OAAO,KAAK,GACrE,OAAO;EAGT,mBAAmB;CACrB;CAEA,OAAO,GAAG,WAAW,WAAW;AAClC"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { __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 { enqueueRuntimeTask } from "../runtime/access.js";
|
|
6
|
+
import { teardownNodeSubtree } from "./cleanup.js";
|
|
7
|
+
import "./env.js";
|
|
8
|
+
import { tagNamesEqualIgnoreCase } from "./utils.js";
|
|
9
|
+
import { keyedElements } from "./keyed.js";
|
|
10
|
+
import { recordBenchEvent } from "../runtime/for-bench.js";
|
|
11
|
+
import { clearForDomUpdateState, evaluateForState } from "../runtime/for-internal.js";
|
|
12
|
+
import "../runtime/for.js";
|
|
13
|
+
import { clearCaseDomUpdateState, clearShowDomUpdateState, evaluateCaseState, evaluateShowState } from "../runtime/control.js";
|
|
14
|
+
import { commitForStateBoundaryChildren } from "./for-commit.js";
|
|
15
|
+
import { getParentNamespace } from "./namespaces.js";
|
|
16
|
+
//#region src/renderer/boundaries.ts
|
|
17
|
+
let boundaryDOMHost = null;
|
|
18
|
+
const controlBoundaryOwners = /* @__PURE__ */ new WeakMap();
|
|
19
|
+
function configureBoundaryDOMHost(host) {
|
|
20
|
+
boundaryDOMHost = host;
|
|
21
|
+
}
|
|
22
|
+
function getBoundaryDOMHost() {
|
|
23
|
+
if (!boundaryDOMHost) throw new Error("[askr] Control boundary DOM host is not configured.");
|
|
24
|
+
return boundaryDOMHost;
|
|
25
|
+
}
|
|
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
|
+
function clearControlBoundaryCommitOwner(parent) {
|
|
86
|
+
const owner = controlBoundaryOwners.get(parent);
|
|
87
|
+
if (owner) {
|
|
88
|
+
owner._enqueueBoundaryCommit = null;
|
|
89
|
+
owner._hasPendingBoundaryCommit = false;
|
|
90
|
+
if (owner._commitOwner === parent) owner._commitOwner = null;
|
|
91
|
+
}
|
|
92
|
+
controlBoundaryOwners.delete(parent);
|
|
93
|
+
}
|
|
94
|
+
function registerControlBoundaryCommitOwner(parent, controlState) {
|
|
95
|
+
const ownerState = controlState;
|
|
96
|
+
const previousParent = ownerState._commitOwner;
|
|
97
|
+
if (previousParent && previousParent !== parent && controlBoundaryOwners.get(previousParent) === controlState) controlBoundaryOwners.delete(previousParent);
|
|
98
|
+
const previousOwner = controlBoundaryOwners.get(parent);
|
|
99
|
+
if (previousOwner && previousOwner !== controlState) {
|
|
100
|
+
previousOwner._enqueueBoundaryCommit = null;
|
|
101
|
+
previousOwner._hasPendingBoundaryCommit = false;
|
|
102
|
+
if (previousOwner._commitOwner === parent) previousOwner._commitOwner = null;
|
|
103
|
+
}
|
|
104
|
+
controlBoundaryOwners.set(parent, controlState);
|
|
105
|
+
ownerState._commitOwner = parent;
|
|
106
|
+
controlState._enqueueBoundaryCommit = () => {
|
|
107
|
+
if (controlState._hasPendingBoundaryCommit) return;
|
|
108
|
+
controlState._hasPendingBoundaryCommit = true;
|
|
109
|
+
enqueueRuntimeTask(() => {
|
|
110
|
+
controlState._hasPendingBoundaryCommit = false;
|
|
111
|
+
if (controlBoundaryOwners.get(parent) !== controlState) return;
|
|
112
|
+
commitForBoundaryChildren(parent, controlState, getControlBoundaryCommitChildren(controlState));
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
}
|
|
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
|
+
function commitForBoundaryChildren(parent, controlState, childrenVNodes) {
|
|
212
|
+
if (controlState.kind !== "for") {
|
|
213
|
+
const activeScope = controlState.activeScope;
|
|
214
|
+
const activeVNode = childrenVNodes[0];
|
|
215
|
+
const nextDom = activeScope && activeVNode !== void 0 ? syncControlBoundaryScopeDom(parent, activeScope, activeVNode) : null;
|
|
216
|
+
for (let i = 0; i < controlState.lastRemovedNodes.length; i++) {
|
|
217
|
+
const removedNode = controlState.lastRemovedNodes[i];
|
|
218
|
+
if (removedNode instanceof Element) teardownNodeSubtree(removedNode);
|
|
219
|
+
if (removedNode.parentNode === parent) {
|
|
220
|
+
recordBenchEvent("domRemove");
|
|
221
|
+
parent.removeChild(removedNode);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (nextDom) {
|
|
225
|
+
if (parent.childNodes.length !== 1 || parent.firstChild !== nextDom || controlState.lastRemovedNodes.length > 0) parent.replaceChildren(nextDom);
|
|
226
|
+
} else if (parent.firstChild) parent.textContent = "";
|
|
227
|
+
keyedElements.delete(parent);
|
|
228
|
+
clearControlBoundaryDomUpdateState(controlState);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
commitForStateBoundaryChildren(parent, controlState, childrenVNodes, {
|
|
232
|
+
isProduction: () => getRuntimeEnv().NODE_ENV === "production",
|
|
233
|
+
syncForItemDom: syncControlBoundaryScopeDom,
|
|
234
|
+
tryPatchStableForDirtyItem: (scope) => getBoundaryDOMHost().tryPatchStableForDirtyItem(scope)
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function trySyncControlBoundaryChild(parent, currentNode, next) {
|
|
238
|
+
if (next.type !== __FOR_BOUNDARY__) return false;
|
|
239
|
+
const controlState = getControlBoundaryState(next);
|
|
240
|
+
if (!controlState || controlState.kind === "for") return false;
|
|
241
|
+
const childrenVNodes = evaluateControlBoundaryState(controlState);
|
|
242
|
+
const activeScope = controlState.activeScope;
|
|
243
|
+
const activeVNode = childrenVNodes[0];
|
|
244
|
+
const nextDom = activeScope && activeVNode !== void 0 ? syncControlBoundaryScopeDom(parent, activeScope, activeVNode) : null;
|
|
245
|
+
for (let i = 0; i < controlState.lastRemovedNodes.length; i++) {
|
|
246
|
+
const removedNode = controlState.lastRemovedNodes[i];
|
|
247
|
+
if (removedNode.parentNode !== parent) continue;
|
|
248
|
+
teardownNodeSubtree(removedNode);
|
|
249
|
+
if (nextDom && nextDom !== removedNode && !nextDom.parentNode) parent.replaceChild(nextDom, removedNode);
|
|
250
|
+
else parent.removeChild(removedNode);
|
|
251
|
+
}
|
|
252
|
+
if (nextDom && !nextDom.parentNode) if (currentNode?.parentNode === parent) {
|
|
253
|
+
teardownNodeSubtree(currentNode);
|
|
254
|
+
parent.replaceChild(nextDom, currentNode);
|
|
255
|
+
} else parent.appendChild(nextDom);
|
|
256
|
+
else if (!nextDom && currentNode?.parentNode === parent) {
|
|
257
|
+
teardownNodeSubtree(currentNode);
|
|
258
|
+
parent.removeChild(currentNode);
|
|
259
|
+
}
|
|
260
|
+
clearControlBoundaryDomUpdateState(controlState);
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
export { clearControlBoundaryCommitOwner, commitForBoundaryChildren, configureBoundaryDOMHost, createForBoundary, evaluateControlBoundaryState, getControlBoundaryState, getDirectControlBoundaryVNode, registerControlBoundaryCommitOwner, syncControlBoundaryScopeDom, trySyncControlBoundaryChild };
|
|
265
|
+
|
|
266
|
+
//# sourceMappingURL=boundaries.js.map
|