@askrjs/askr 0.0.70 → 0.0.71

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.
Files changed (64) hide show
  1. package/capabilities.json +66 -0
  2. package/dist/actions/index.d.ts +1 -1
  3. package/dist/actions/index.js +9 -2
  4. package/dist/activity-C2tPn9Fr.js +152 -0
  5. package/dist/activity-DZ-NCYr8.d.ts +10 -0
  6. package/dist/{authoring-uaJ556aG.js → authoring-CXmUcaCe.js} +2 -2
  7. package/dist/benchmark.d.ts +1 -1
  8. package/dist/benchmark.js +6 -6
  9. package/dist/boot/index.d.ts +2 -2
  10. package/dist/boot/index.js +1 -1
  11. package/dist/{boot-8gP6mB3c.js → boot-DIKbEA4Y.js} +11 -10
  12. package/dist/{cleanup-B4BiQHx-.js → cleanup-D8Ufd9Ix.js} +16 -2
  13. package/dist/components/index.d.ts +1 -0
  14. package/dist/components/index.js +1 -0
  15. package/dist/control/index.d.ts +1 -1
  16. package/dist/control/index.js +1 -1
  17. package/dist/{control-CA45Yvvu.js → control-DVRBkN2X.js} +7 -2
  18. package/dist/{csp-nonce-HGZ0vbqT.js → csp-nonce-CwSRP3Jl.js} +16 -1
  19. package/dist/css-BuPaTOfe.js +70 -0
  20. package/dist/data/index.js +3 -3
  21. package/dist/{data-DHt_zO1G.js → data-DFcSmGvN.js} +2 -2
  22. package/dist/{data-runtime-SJ1BSUvk.js → data-runtime-rpV6-3XW.js} +13 -2
  23. package/dist/{deferred-zHtUheIQ.js → deferred-Cr58yIQD.js} +3 -4
  24. package/dist/foundations/index.d.ts +1 -1
  25. package/dist/foundations/index.js +1 -1
  26. package/dist/foundations/structures/index.d.ts +1 -1
  27. package/dist/foundations/structures/index.js +1 -1
  28. package/dist/{index-BFnTM1a8.d.ts → index-BOBtoY_r.d.ts} +34 -2
  29. package/dist/{index-DSClfSoC.d.ts → index-DxYJPVC4.d.ts} +1 -1
  30. package/dist/{index-Dh6ZF9yW.d.ts → index-UmwPZ8ZN.d.ts} +5 -0
  31. package/dist/{index-DjusBb1I.d.ts → index-u3KYoHlM.d.ts} +1 -1
  32. package/dist/index.d.ts +4 -5
  33. package/dist/index.js +12 -7
  34. package/dist/jsx-dev-runtime.d.ts +1 -0
  35. package/dist/jsx-runtime-C6Fs8Mmc.d.ts +2 -0
  36. package/dist/{jsx-runtime-aYZ8zb4q.d.ts → jsx-runtime-CL2r2HHQ.d.ts} +1 -0
  37. package/dist/jsx-runtime.d.ts +1 -1
  38. package/dist/{lifecycle-operations-SlPEK68H.js → lifecycle-operations-Db-_MG-O.js} +9 -12
  39. package/dist/{navigate-CV-RDqYP.d.ts → navigate-Cbq6QHVl.d.ts} +1 -1
  40. package/dist/{navigate-BTPrVhqI.js → navigate-CuGQzS_Y.js} +8 -104
  41. package/dist/{portal-D7TC986A.js → portal-wY3j0vvp.js} +59 -1
  42. package/dist/{query-registry-CQIT4mXr.js → query-registry-Bu_cuMch.js} +1 -1
  43. package/dist/{renderer-DF0hyjEr.js → renderer-BJYY2Y8s.js} +91 -10
  44. package/dist/resources/index.d.ts +27 -8
  45. package/dist/resources/index.js +218 -4
  46. package/dist/{route-matching-DLBWDeXX.js → route-matching-M-f1VQRu.js} +276 -2
  47. package/dist/router/index.d.ts +7 -7
  48. package/dist/router/index.js +28 -17
  49. package/dist/{router-C0XQA62W.d.ts → router-C3vENhUh.d.ts} +1 -1
  50. package/dist/{selector-DueeR6Oz.js → selector-DEfqO1rA.js} +8 -0
  51. package/dist/ssg/index.d.ts +8 -1
  52. package/dist/ssg/index.js +53 -17
  53. package/dist/ssr/index.d.ts +15 -1
  54. package/dist/ssr/index.js +1 -1
  55. package/dist/{ssr-vE-KUgDV.js → ssr-BSUA9Y64.js} +72 -78
  56. package/dist/testing/index.d.ts +35 -2
  57. package/dist/testing/index.js +182 -3
  58. package/dist/{verify-hydration-ChyEiBAn.js → verify-hydration-CVSGv6Vs.js} +1 -1
  59. package/package.json +4 -2
  60. package/dist/attr-names-CjhzmHOn.js +0 -15
  61. package/dist/component-scope-CvPba6O6.d.ts +0 -12
  62. package/dist/invalidation-listeners-Des3AHYs.js +0 -13
  63. package/dist/jsx-runtime-X2SX2y8V.d.ts +0 -2
  64. package/dist/resource-operation-BJiLoLYZ.js +0 -276
@@ -1,3 +1,3 @@
1
1
  import { r as JSXElement } from "../../jsx-Dvr2SGRG.js";
2
- import { _ as definePortal, a as Collection, c as Presence, d as SlotProps, f as LayoutComponent, g as PortalProps, h as Portal, i as createLayer, l as PresenceProps, m as DefaultPortal, n as LayerManager, o as CollectionItem, p as layout, r as LayerOptions, s as createCollection, t as Layer, u as Slot } from "../../index-DjusBb1I.js";
2
+ import { _ as definePortal, a as Collection, c as Presence, d as SlotProps, f as LayoutComponent, g as PortalProps, h as Portal, i as createLayer, l as PresenceProps, m as DefaultPortal, n as LayerManager, o as CollectionItem, p as layout, r as LayerOptions, s as createCollection, t as Layer, u as Slot } from "../../index-u3KYoHlM.js";
3
3
  export { type Collection, type CollectionItem, DefaultPortal, type JSXElement, type Layer, type LayerManager, type LayerOptions, type LayoutComponent, Portal, type PortalProps, Presence, type PresenceProps, Slot, type SlotProps, createCollection, createLayer, definePortal, layout };
@@ -1,3 +1,3 @@
1
- import { i as definePortal, n as Portal, t as DefaultPortal } from "../../portal-D7TC986A.js";
1
+ import { i as definePortal, n as Portal, t as DefaultPortal } from "../../portal-wY3j0vvp.js";
2
2
  import { a as layout, i as Slot, n as createCollection, r as Presence, t as createLayer } from "../../structures-DUB3HchX.js";
3
3
  export { DefaultPortal, Portal, Presence, Slot, createCollection, createLayer, definePortal, layout };
@@ -1,6 +1,17 @@
1
1
  import { i as Scope, n as ReadableSource, r as ComponentInstance } from "./control-DO-iBEtV.js";
2
2
  import { t as Scheduler } from "./scheduler-CmLO4Dfm.js";
3
- import "./jsx-runtime-X2SX2y8V.js";
3
+ import "./jsx-runtime-C6Fs8Mmc.js";
4
+ //#region src/runtime/component-scope.d.ts
5
+ /**
6
+ * Get the abort signal for the current component.
7
+ *
8
+ * The signal is guaranteed to be aborted when:
9
+ * - Component unmounts
10
+ * - Navigation occurs (different route)
11
+ * - Parent is destroyed
12
+ */
13
+ declare function getSignal(): AbortSignal;
14
+ //#endregion
4
15
  //#region src/runtime/runtime.d.ts
5
16
  interface RuntimeKeyedReorderDecision {
6
17
  useFastPath: boolean;
@@ -51,6 +62,7 @@ type SnapshotSource<T> = {
51
62
  pending?: boolean;
52
63
  error?: Error | null;
53
64
  } & SnapshotSourceBrand;
65
+ /** Creates a render-scoped derived value; must be called during component render. */
54
66
  declare function derive<TOut>(fn: () => TOut): Derived<TOut>;
55
67
  declare function derive<TIn, TOut>(source: SnapshotSource<TIn> | TIn | (() => TIn), map: (value: TIn) => TOut): Derived<TOut | null>;
56
68
  //#endregion
@@ -61,10 +73,30 @@ interface Selector<T> {
61
73
  type SelectorEquals<T> = {
62
74
  bivarianceHack(a: T, b: T): boolean;
63
75
  }['bivarianceHack'];
76
+ /**
77
+ * Creates a render-scoped predicate for keyed membership in reactive list rows.
78
+ *
79
+ * Use this when a `<For>` child needs to compare each stable item with a
80
+ * changing selected value. Unlike a plain closure capture, the predicate
81
+ * subscribes the affected rows and updates them without rebuilding the list.
82
+ * Must be called during component render.
83
+ */
64
84
  declare function selector<T>(source: () => T, equals?: SelectorEquals<T>): Selector<T>;
65
85
  //#endregion
66
86
  //#region src/csp-nonce.d.ts
67
87
  declare const CspNonceScope: Scope<string | undefined>;
68
88
  declare function cspNonce(): string | undefined;
69
89
  //#endregion
70
- export { Derived as a, AskrRuntimeOptions as c, createRuntime as d, getDefaultRuntime as f, selector as i, RuntimeKeyedReorderDecision as l, cspNonce as n, derive as o, Selector as r, AskrRuntime as s, CspNonceScope as t, RuntimeRendererHost as u };
90
+ //#region src/ref.d.ts
91
+ /**
92
+ * Creates a stable holder for an intrinsic element ref.
93
+ *
94
+ * The renderer mutates `current` during commit and clears it during cleanup.
95
+ * Updating the holder never schedules a render.
96
+ */
97
+ interface Ref<T extends Element = Element> {
98
+ current: T | null;
99
+ }
100
+ declare function createRef<T extends Element = Element>(): Ref<T>;
101
+ //#endregion
102
+ export { Selector as a, derive as c, RuntimeKeyedReorderDecision as d, RuntimeRendererHost as f, getSignal as h, cspNonce as i, AskrRuntime as l, getDefaultRuntime as m, createRef as n, selector as o, createRuntime as p, CspNonceScope as r, Derived as s, Ref as t, AskrRuntimeOptions as u };
@@ -1,6 +1,6 @@
1
1
  import { c as RenderableChild, g as StateTuple } from "./control-DO-iBEtV.js";
2
2
  import { r as JSXElement } from "./jsx-Dvr2SGRG.js";
3
- import "./index-BFnTM1a8.js";
3
+ import "./index-BOBtoY_r.js";
4
4
  import { ObjectSchema } from "@askrjs/schema";
5
5
  //#region src/actions/index.d.ts
6
6
  interface ActionDescriptor<TInput extends Record<string, unknown> = Record<string, unknown>> {
@@ -7,6 +7,11 @@ type BoundaryChild = RenderableChild;
7
7
  type ForBaseProps<T> = {
8
8
  each: ForEachSource<T>;
9
9
  fallback?: BoundaryChild;
10
+ /**
11
+ * Row renderer. Parent reactive reads must use `selector()` or thunk props;
12
+ * closure-captured values are snapshotted when the row is created or
13
+ * reconciled; changing the parent source does not rerun an existing row.
14
+ */
10
15
  children: (item: T, index: () => number) => VNode;
11
16
  };
12
17
  type KeyedForProps<T, K extends string | number> = ForBaseProps<T> & {
@@ -3,7 +3,7 @@ import { r as JSXElement } from "./jsx-Dvr2SGRG.js";
3
3
  import "./types-DEhT-Nrv.js";
4
4
  //#region src/runtime/portal.d.ts
5
5
  interface Portal<T extends RenderableChild = RenderableChild> {
6
- (): unknown;
6
+ (): T | JSXElement | null | undefined;
7
7
  render(props: {
8
8
  children?: T;
9
9
  }): unknown;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { _ as state, a as defineScope, g as StateTuple, h as StateSetter, i as Scope, m as State, o as readScope } from "./control-DO-iBEtV.js";
2
2
  import { s as Props, t as Fragment } from "./jsx-Dvr2SGRG.js";
3
- import { t as getSignal } from "./component-scope-CvPba6O6.js";
4
- import { a as Derived, c as AskrRuntimeOptions, d as createRuntime, f as getDefaultRuntime, i as selector, l as RuntimeKeyedReorderDecision, n as cspNonce, o as derive, r as Selector, s as AskrRuntime, t as CspNonceScope, u as RuntimeRendererHost } from "./index-BFnTM1a8.js";
5
- import { a as Show, c as ForProps, i as MatchProps, n as CaseProps, o as ShowProps, r as Match, s as For, t as Case } from "./index-Dh6ZF9yW.js";
6
- import { i as jsxs, n as jsx } from "./jsx-runtime-aYZ8zb4q.js";
3
+ import { a as Selector, c as derive, d as RuntimeKeyedReorderDecision, f as RuntimeRendererHost, h as getSignal, i as cspNonce, l as AskrRuntime, m as getDefaultRuntime, n as createRef, o as selector, p as createRuntime, r as CspNonceScope, s as Derived, t as Ref, u as AskrRuntimeOptions } from "./index-BOBtoY_r.js";
4
+ import { a as Show, c as ForProps, i as MatchProps, n as CaseProps, o as ShowProps, r as Match, s as For, t as Case } from "./index-UmwPZ8ZN.js";
5
+ import { i as jsxs, n as jsx } from "./jsx-runtime-CL2r2HHQ.js";
7
6
  import { A as ServerQueryHandler, D as QueryPrefetchContext, T as QueryDefinition, a as defineServerQueries, c as prefetchQuery, g as createQuery, i as defineQuery, l as serveQuery, o as dehydrateDataRuntime, s as hydrateDataRuntime, v as DataRuntime } from "./index-Bki2rqcr.js";
8
- export { AskrRuntime, type AskrRuntimeOptions, Case, type CaseProps, CspNonceScope, type DataRuntime, type Derived, For, type ForProps, Fragment, Match, type MatchProps, type Props, type QueryDefinition, type QueryPrefetchContext, type RuntimeKeyedReorderDecision, type RuntimeRendererHost, type Scope, type Selector, type ServerQueryHandler, Show, type ShowProps, type State, type StateSetter, type StateTuple, createQuery, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, selector, serveQuery, state };
7
+ export { AskrRuntime, type AskrRuntimeOptions, Case, type CaseProps, CspNonceScope, type DataRuntime, type Derived, For, type ForProps, Fragment, Match, type MatchProps, type Props, type QueryDefinition, type QueryPrefetchContext, type Ref, type RuntimeKeyedReorderDecision, type RuntimeRendererHost, type Scope, type Selector, type ServerQueryHandler, Show, type ShowProps, type State, type StateSetter, type StateTuple, createQuery, createRef, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, selector, serveQuery, state };
package/dist/index.js CHANGED
@@ -4,14 +4,14 @@ import { h as readScope, u as defineScope } from "./component-internal-CPjM4n8M.
4
4
  import { f as syncDerivedDependencySubscriptions, l as notifyReadableReaders, o as markReactivePropsDirtySource, p as withDerivedReadTracking, r as clearDerivedDependencySubscriptions, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BYSoWJSv.js";
5
5
  import { g as getSignal, i as claimHookIndex, p as getCurrentInstance } from "./component-scope-CC3cojX9.js";
6
6
  import { n as isSnapshotSource } from "./snapshot-source-BB42xgwb.js";
7
- import { t as installRendererBridge } from "./renderer-DF0hyjEr.js";
7
+ import { t as installRendererBridge } from "./renderer-BJYY2Y8s.js";
8
8
  import { t as state } from "./state-CVuQVjvK.js";
9
- import { t as selector } from "./selector-DueeR6Oz.js";
9
+ import { t as selector } from "./selector-DEfqO1rA.js";
10
10
  import { jsx, jsxs } from "./jsx-runtime.js";
11
- import { n as cspNonce, t as CspNonceScope } from "./csp-nonce-HGZ0vbqT.js";
12
- import { i as For, n as Match, r as Show, t as Case } from "./control-CA45Yvvu.js";
13
- import { t as createQuery } from "./data-DHt_zO1G.js";
14
- import { a as hydrateDataRuntime, i as dehydrateDataRuntime, n as defineQuery, o as prefetchQuery, r as defineServerQueries, s as serveQuery } from "./query-registry-CQIT4mXr.js";
11
+ import { n as cspNonce, t as CspNonceScope } from "./csp-nonce-CwSRP3Jl.js";
12
+ import { i as For, n as Match, r as Show, t as Case } from "./control-DVRBkN2X.js";
13
+ import { t as createQuery } from "./data-DFcSmGvN.js";
14
+ import { a as hydrateDataRuntime, i as dehydrateDataRuntime, n as defineQuery, o as prefetchQuery, r as defineServerQueries, s as serveQuery } from "./query-registry-Bu_cuMch.js";
15
15
  //#region src/runtime/derive.ts
16
16
  const deriveCells = /* @__PURE__ */ new WeakMap();
17
17
  const dirtyDerivedCells = /* @__PURE__ */ new Set();
@@ -149,6 +149,11 @@ function derive(source, map) {
149
149
  return cell;
150
150
  }
151
151
  //#endregion
152
+ //#region src/ref.ts
153
+ function createRef() {
154
+ return { current: null };
155
+ }
156
+ //#endregion
152
157
  //#region src/index.ts
153
158
  /**
154
159
  * Askr: Actor-backed deterministic UI framework
@@ -157,4 +162,4 @@ function derive(source, map) {
157
162
  */
158
163
  installRendererBridge();
159
164
  //#endregion
160
- export { AskrRuntime, Case, CspNonceScope, For, Fragment, Match, Show, createQuery, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, selector, serveQuery, state };
165
+ export { AskrRuntime, Case, CspNonceScope, For, Fragment, Match, Show, createQuery, createRef, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, selector, serveQuery, state };
@@ -3,6 +3,7 @@ import { t as EagerControlPrimitive } from "./control-BjYBlytA.js";
3
3
  import "./types-DEhT-Nrv.js";
4
4
  //#region src/jsx/jsx-dev-runtime.d.ts
5
5
  declare namespace JSX {
6
+ type ElementType = string | symbol | ((props: never) => unknown);
6
7
  interface Element extends JSXElement {
7
8
  readonly __askrJsxElementBrand?: never;
8
9
  }
@@ -0,0 +1,2 @@
1
+ import "./types-DEhT-Nrv.js";
2
+ import "./jsx-runtime-CL2r2HHQ.js";
@@ -3,6 +3,7 @@ import { t as EagerControlPrimitive } from "./control-BjYBlytA.js";
3
3
  import "./types-DEhT-Nrv.js";
4
4
  //#region src/jsx/jsx-runtime.d.ts
5
5
  declare namespace JSX {
6
+ type ElementType = string | symbol | ((props: never) => unknown);
6
7
  interface Element extends JSXElement {
7
8
  readonly __askrJsxElementBrand?: never;
8
9
  }
@@ -1,3 +1,3 @@
1
1
  import { i as JSXElementType, n as JSXComponent, r as JSXElement, t as Fragment } from "./jsx-Dvr2SGRG.js";
2
- import { i as jsxs, n as jsx, r as jsxDEV, t as JSX } from "./jsx-runtime-aYZ8zb4q.js";
2
+ import { i as jsxs, n as jsx, r as jsxDEV, t as JSX } from "./jsx-runtime-CL2r2HHQ.js";
3
3
  export { Fragment, JSX, type JSXComponent, type JSXElement, type JSXElementType, jsx, jsxDEV, jsxs };
@@ -53,13 +53,16 @@ function detachListenerSlot(slot) {
53
53
  }
54
54
  function commitListenerSlot(instance, slot) {
55
55
  slot.handler = slot.pendingHandler;
56
- if (!slot.attached || slot.target !== slot.pendingTarget || slot.event !== slot.pendingEvent || !listenerOptionsEqual(slot.options, slot.pendingOptions)) {
56
+ const resolvedTarget = typeof slot.pendingTarget === "function" ? typeof window === "undefined" ? null : slot.pendingTarget() ?? null : slot.pendingTarget;
57
+ if (!slot.attached || slot.target !== resolvedTarget || slot.event !== slot.pendingEvent || !listenerOptionsEqual(slot.options, slot.pendingOptions)) {
57
58
  detachListenerSlot(slot);
58
- slot.target = slot.pendingTarget;
59
+ slot.target = resolvedTarget;
59
60
  slot.event = slot.pendingEvent;
60
61
  slot.options = slot.pendingOptions;
61
- slot.target.addEventListener(slot.event, slot.listener, slot.options);
62
- slot.attached = true;
62
+ if (slot.target) {
63
+ slot.target.addEventListener(slot.event, slot.listener, slot.options);
64
+ slot.attached = true;
65
+ }
63
66
  }
64
67
  if (!slot.cleanupRegistered) {
65
68
  slot.cleanupRegistered = true;
@@ -151,13 +154,7 @@ function timer(intervalMs, fn, options) {
151
154
  commitTimerSlot(instance, slot);
152
155
  });
153
156
  }
154
- function stream(_source, _options) {
155
- return {
156
- value: null,
157
- pending: true,
158
- error: null
159
- };
160
- }
157
+ /** Runs an owned task after commit. */
161
158
  function task(fn) {
162
159
  const instance = getCurrentComponentInstance();
163
160
  if (!instance) return;
@@ -190,4 +187,4 @@ function capture(fn) {
190
187
  return () => value;
191
188
  }
192
189
  //#endregion
193
- export { stream as a, windowFocused as c, routeActive as i, documentVisible as n, task as o, on as r, timer as s, capture as t };
190
+ export { task as a, routeActive as i, documentVisible as n, timer as o, on as r, windowFocused as s, capture as t };
@@ -1,4 +1,4 @@
1
- import "./router-C0XQA62W.js";
1
+ import "./router-C3vENhUh.js";
2
2
  //#region src/router/navigation-scroll.d.ts
3
3
  type NavigationScrollBehavior = 'top' | 'preserve';
4
4
  type HistoryScrollBehavior = 'restore' | 'top' | 'preserve';
@@ -1,111 +1,15 @@
1
1
  import { b as isDevelopmentEnvironment, r as flushRuntimeScheduler, v as logger, x as isProductionEnvironment } from "./access-ePqdQqkV.js";
2
2
  import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-CUpRxrLH.js";
3
3
  import { r as executeComponent } from "./component-internal-CPjM4n8M.js";
4
- import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, t as cleanupReadableSubscriptionSources, u as recordReadableRead } from "./readable-BYSoWJSv.js";
5
- import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance } from "./component-scope-CC3cojX9.js";
4
+ import { t as cleanupReadableSubscriptionSources } from "./readable-BYSoWJSv.js";
6
5
  import { n as cleanupComponentGeneration, t as cleanupComponent } from "./component-cleanup-1ZFoLLHt.js";
7
6
  import { i as drainLifecycleCommitErrors, p as isPromiseLike, r as discardLifecycleCommitBatch, s as flushLifecycleCommitBatch, t as beginLifecycleCommitBatch } from "./lifecycle-batch-COgl8jMS.js";
8
- import { _ as teardownNodeSubtree } from "./cleanup-B4BiQHx-.js";
9
- import { d as getRouteRenderContext, f as getRouteRenderData, m as resolveRouteRequest, p as hasRouteRenderData } from "./deferred-zHtUheIQ.js";
10
- import { n as getActiveRenderContext } from "./render-context-Clw3rFiO.js";
11
- import { n as syncRouteActivitySnapshot } from "./route-activity-CNJfpwx-.js";
12
- import { r as clearDefaultPortalForInstance, t as DefaultPortal } from "./portal-D7TC986A.js";
13
- import { t as CspNonceScope } from "./csp-nonce-HGZ0vbqT.js";
14
- import { c as deepFreeze, g as getActiveRoutes, j as lockRouteRegistration, l as makeQuery, n as computeMatchesFromRoutes, r as computeRouteActivityMatches, u as parseLocation } from "./route-matching-DLBWDeXX.js";
15
- //#region src/common/app-render-runtime.ts
16
- const stagedRouteLocations = /* @__PURE__ */ new WeakMap();
17
- function createAppRenderRuntime(input = {}) {
18
- return {
19
- framework: Object.freeze({ ...input.framework }),
20
- route: input.route,
21
- hasRoute: input.hasRoute ?? false
22
- };
23
- }
24
- function stageAppRenderRouteLocation(runtime, href) {
25
- stagedRouteLocations.set(runtime, href);
26
- }
27
- function getStagedAppRenderRouteLocation(runtime) {
28
- return runtime ? stagedRouteLocations.get(runtime) : void 0;
29
- }
30
- function clearStagedAppRenderRouteLocation(runtime) {
31
- if (runtime) stagedRouteLocations.delete(runtime);
32
- }
33
- //#endregion
34
- //#region src/router/activity.ts
35
- let currentRouteSnapshot = buildRouteSnapshot("/", "", "");
36
- const currentRouteSource = (() => currentRouteSnapshot);
37
- currentRouteSource._readers = /* @__PURE__ */ new Map();
38
- let serverLocation = null;
39
- function setServerLocation(url) {
40
- serverLocation = url;
41
- if (url) {
42
- const parsed = parseLocation(url);
43
- syncRouteActivitySnapshot(parsed.pathname, computeMatchesFromRoutes(parsed.pathname, getActiveRoutes()));
44
- return;
45
- }
46
- syncRouteActivitySnapshot(currentRouteSnapshot.path, currentRouteSnapshot.matches);
47
- }
48
- function buildRouteSnapshot(pathname, search, hash) {
49
- const query = makeQuery(search);
50
- const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
51
- return Object.freeze({
52
- path: pathname,
53
- params: deepFreeze({ ...matches[0]?.params }),
54
- query,
55
- hash: hash || null,
56
- matches: Object.freeze(matches)
57
- });
58
- }
59
- function setCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
60
- currentRouteSnapshot = buildRouteSnapshot(pathname, search, hash);
61
- syncRouteActivitySnapshot(pathname, activityMatches ?? currentRouteSnapshot.matches);
62
- const instance = getCurrentComponentInstance();
63
- markReadableDerivedSubscribersDirty(currentRouteSource);
64
- markReactivePropsDirtySource(currentRouteSource);
65
- notifyReadableReaders(currentRouteSource, instance);
66
- }
67
- function readCurrentRouteLocation() {
68
- const renderContext = getActiveRenderContext();
69
- if (renderContext?.url) return parseLocation(renderContext.url);
70
- const stagedRouteLocation = getStagedAppRenderRouteLocation(getCurrentAppRenderRuntime());
71
- if (stagedRouteLocation) return parseLocation(stagedRouteLocation);
72
- if (typeof window !== "undefined" && window.location) return {
73
- pathname: window.location.pathname || "/",
74
- search: window.location.search || "",
75
- hash: window.location.hash || ""
76
- };
77
- if (serverLocation) return parseLocation(serverLocation);
78
- return {
79
- pathname: currentRouteSnapshot.path,
80
- search: "",
81
- hash: currentRouteSnapshot.hash ?? ""
82
- };
83
- }
84
- function readCurrentRouteSnapshot() {
85
- if (!getCurrentComponentInstance()) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
86
- const { pathname, search, hash } = readCurrentRouteLocation();
87
- const query = makeQuery(search);
88
- const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
89
- const params = deepFreeze({ ...getActiveRenderContext()?.params ?? matches[0]?.params ?? {} });
90
- return Object.freeze({
91
- path: pathname,
92
- params,
93
- query,
94
- hash: hash || null,
95
- matches: Object.freeze(matches)
96
- });
97
- }
98
- function currentRoute() {
99
- const instance = getCurrentComponentInstance();
100
- if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
101
- if (typeof window === "undefined" || instance.ssr) return readCurrentRouteSnapshot();
102
- recordReadableRead(currentRouteSource);
103
- return readCurrentRouteSnapshot();
104
- }
105
- function syncCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
106
- setCurrentRouteSnapshot(pathname, search, hash, activityMatches);
107
- }
108
- //#endregion
7
+ import { _ as teardownNodeSubtree } from "./cleanup-D8Ufd9Ix.js";
8
+ import { d as getRouteRenderContext, f as getRouteRenderData, m as resolveRouteRequest, p as hasRouteRenderData } from "./deferred-Cr58yIQD.js";
9
+ import { j as lockRouteRegistration, r as computeRouteActivityMatches } from "./route-matching-M-f1VQRu.js";
10
+ import { r as clearDefaultPortalForInstance, t as DefaultPortal } from "./portal-wY3j0vvp.js";
11
+ import { t as CspNonceScope } from "./csp-nonce-CwSRP3Jl.js";
12
+ import { a as clearStagedAppRenderRouteLocation, i as syncCurrentRouteSnapshot, o as createAppRenderRuntime, s as stageAppRenderRouteLocation } from "./activity-C2tPn9Fr.js";
109
13
  //#region src/router/navigation-registry.ts
110
14
  let currentInstance = null;
111
15
  let currentPathname = "/";
@@ -1139,4 +1043,4 @@ function initializeNavigation() {
1139
1043
  window.addEventListener("popstate", handlePopState);
1140
1044
  }
1141
1045
  //#endregion
1142
- export { currentRoute as _, serializeRouteMeta as a, getCurrentHref as c, parseTargetUrl as d, registerAppInstance as f, unregisterAppInstance as g, syncRegisteredRouteSnapshot as h, resolveRouteMeta as i, getRegisteredAppsSnapshot as l, syncAppRegistrationLocation as m, navigate as n, configureScrollRestoration as o, setCurrentRouteLocation as p, reconcileRouteMeta as r, saveScrollPosition as s, initializeNavigation as t, getWindowHref$1 as u, setServerLocation as v, createAppRenderRuntime as y };
1046
+ export { serializeRouteMeta as a, getCurrentHref as c, parseTargetUrl as d, registerAppInstance as f, unregisterAppInstance as g, syncRegisteredRouteSnapshot as h, resolveRouteMeta as i, getRegisteredAppsSnapshot as l, syncAppRegistrationLocation as m, navigate as n, configureScrollRestoration as o, setCurrentRouteLocation as p, reconcileRouteMeta as r, saveScrollPosition as s, initializeNavigation as t, getWindowHref$1 as u };
@@ -1,9 +1,59 @@
1
1
  import { o as getRuntimeRenderer } from "./access-ePqdQqkV.js";
2
+ import { t as ELEMENT_TYPE } from "./jsx-CUpRxrLH.js";
2
3
  import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BYSoWJSv.js";
3
4
  import { f as getCurrentComponentInstance, m as getCurrentPortalScope } from "./component-scope-CC3cojX9.js";
4
5
  import { t as cleanupComponent } from "./component-cleanup-1ZFoLLHt.js";
5
6
  import { c as getCurrentLifecycleCommitBatch, u as registerLifecycleTransaction } from "./lifecycle-batch-COgl8jMS.js";
7
+ import { n as getActiveRenderContext } from "./render-context-Clw3rFiO.js";
8
+ //#region src/common/portal.ts
9
+ /**
10
+ * Internal marker used to defer server portal host output until all writes in
11
+ * the current render root are known.
12
+ *
13
+ * @internal
14
+ */
15
+ const SSR_PORTAL_HOST = Symbol.for("askr.ssr-portal-host");
16
+ //#endregion
6
17
  //#region src/runtime/portal.ts
18
+ const DEFAULT_SSR_PORTAL_KEY = {};
19
+ function getSSRPortalSlot(key) {
20
+ const context = getActiveRenderContext();
21
+ if (context?.mode !== "ssr") return null;
22
+ let slot = context.ssrPortals.slots.get(key);
23
+ if (!slot) {
24
+ slot = {
25
+ hasValue: false,
26
+ value: void 0,
27
+ hosts: []
28
+ };
29
+ context.ssrPortals.slots.set(key, slot);
30
+ }
31
+ return {
32
+ context,
33
+ slot
34
+ };
35
+ }
36
+ function createSSRPortalHost(key, automatic) {
37
+ const current = getSSRPortalSlot(key);
38
+ if (!current) return null;
39
+ const token = `<!--askr-portal:${current.context.ssrPortals.nextHostId++}-->`;
40
+ current.slot.hosts.push({
41
+ token,
42
+ automatic
43
+ });
44
+ return {
45
+ $$typeof: ELEMENT_TYPE,
46
+ type: SSR_PORTAL_HOST,
47
+ props: { token }
48
+ };
49
+ }
50
+ function writeSSRPortal(key, children) {
51
+ const current = getSSRPortalSlot(key);
52
+ if (!current) return false;
53
+ current.slot.hasValue = true;
54
+ current.slot.value = children;
55
+ return true;
56
+ }
7
57
  function createPortalSlot() {
8
58
  let currentValue;
9
59
  const source = (() => {
@@ -24,12 +74,16 @@ function createPortalSlot() {
24
74
  };
25
75
  }
26
76
  function definePortal() {
77
+ const ssrPortalKey = {};
27
78
  if (typeof createPortalSlot === "function") {
28
79
  const slot = createPortalSlot();
29
80
  function PortalHost() {
81
+ const serverHost = createSSRPortalHost(ssrPortalKey, false);
82
+ if (serverHost) return serverHost;
30
83
  return slot.read();
31
84
  }
32
85
  PortalHost.render = function PortalRender(props) {
86
+ if (writeSSRPortal(ssrPortalKey, props.children)) return null;
33
87
  slot.write(props.children);
34
88
  return null;
35
89
  };
@@ -306,6 +360,8 @@ function clearDefaultPortalForInstance(instance) {
306
360
  }
307
361
  const DefaultPortal = (() => {
308
362
  function Host(props) {
363
+ const serverHost = createSSRPortalHost(DEFAULT_SSR_PORTAL_KEY, props?.__askrAutoDefaultPortal === true);
364
+ if (serverHost) return serverHost;
309
365
  const owner = getCurrentComponentInstance();
310
366
  const scope = resolveDefaultPortalScope(owner);
311
367
  if (!scope) return null;
@@ -321,16 +377,18 @@ const DefaultPortal = (() => {
321
377
  return value === void 0 ? null : value;
322
378
  }
323
379
  Host.render = function Render(props) {
380
+ if (writeSSRPortal(DEFAULT_SSR_PORTAL_KEY, props.children)) return null;
324
381
  writeDefaultPortal(props, getCurrentComponentInstance());
325
382
  return null;
326
383
  };
327
384
  return Host;
328
385
  })();
329
386
  function Portal(props) {
387
+ if (writeSSRPortal(DEFAULT_SSR_PORTAL_KEY, props.children)) return null;
330
388
  const owner = getCurrentComponentInstance();
331
389
  if (owner) registerDefaultPortalOwner(owner);
332
390
  writeDefaultPortal(props, owner);
333
391
  return null;
334
392
  }
335
393
  //#endregion
336
- export { disposeDefaultPortalScope as a, definePortal as i, Portal as n, clearDefaultPortalForInstance as r, DefaultPortal as t };
394
+ export { disposeDefaultPortalScope as a, definePortal as i, Portal as n, SSR_PORTAL_HOST as o, clearDefaultPortalForInstance as r, DefaultPortal as t };
@@ -1,4 +1,4 @@
1
- import { i as getDefaultDataRuntime, t as createDataRuntime } from "./data-runtime-SJ1BSUvk.js";
1
+ import { i as getDefaultDataRuntime, t as createDataRuntime } from "./data-runtime-rpV6-3XW.js";
2
2
  //#region src/common/telemetry.ts
3
3
  function withTelemetry(span, fields, work) {
4
4
  return span ? span(fields, work) : work();
@@ -9,9 +9,9 @@ import { t as cleanupComponent } from "./component-cleanup-1ZFoLLHt.js";
9
9
  import { c as getCurrentLifecycleCommitBatch, l as registerLifecycleRollback, p as isPromiseLike, r as discardLifecycleCommitBatch, s as flushLifecycleCommitBatch, t as beginLifecycleCommitBatch, u as registerLifecycleTransaction } from "./lifecycle-batch-COgl8jMS.js";
10
10
  import { _ as createChildScope, a as registerForStateTransaction, c as captureForFallbackTransactionSnapshot, d as clearCaseDomUpdateState, f as clearShowDomUpdateState, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, l as captureForItemTransactionSnapshot, n as clearForDomUpdateState, o as rollbackForStateTransaction, t as beginForStateTransaction, v as disposeChildScope, y as rerenderChildScope } from "./for-internal-BtK9Htl0.js";
11
11
  import { n as createOwnedFineGrainedEffect, r as markFineGrainedEffectsDirtySource, t as createFineGrainedEffect } from "./effect-CFUzIpqX.js";
12
- import { C as getDelegatedHandlersForElement, D as updateDelegatedListener, E as removeDelegatedListener, S as getDelegatedHandlerForElement, T as isEventDelegationEnabled, _ as teardownNodeSubtree, a as elementReactivePropsCleanup, b as addFreshDelegatedListener, c as forEachElementReactivePropCleanup, d as removeAllListeners, f as removeElementReactiveProps, g as setFreshElementReactivePropCleanup, h as setDirectElementReactivePropCleanup, i as elementListeners, l as getElementReactivePropCleanupSize, m as replaceElementRefBookkeeping, n as cleanupInstanceIfPresent, o as elementRefs, p as removeElementRef, r as cleanupInstancesUnder, s as forEachDescendantNode, t as REACTIVE_CHILDREN_KEY, u as getElementReactivePropsCleanupMap, v as updateElementRef, w as isDelegatedEvent, x as clearDelegatedHandlersForElement, y as addDelegatedListener } from "./cleanup-B4BiQHx-.js";
13
- import { t as getPublicAttributeName } from "./attr-names-CjhzmHOn.js";
14
- import { i as ROUTE_ROOT_COMPONENT } from "./csp-nonce-HGZ0vbqT.js";
12
+ import { C as getDelegatedHandlersForElement, D as updateDelegatedListener, E as removeDelegatedListener, S as getDelegatedHandlerForElement, T as isEventDelegationEnabled, _ as teardownNodeSubtree, a as elementReactivePropsCleanup, b as addFreshDelegatedListener, c as forEachElementReactivePropCleanup, d as removeAllListeners, f as removeElementReactiveProps, g as setFreshElementReactivePropCleanup, h as setDirectElementReactivePropCleanup, i as elementListeners, l as getElementReactivePropCleanupSize, m as replaceElementRefBookkeeping, n as cleanupInstanceIfPresent, o as elementRefs, p as removeElementRef, r as cleanupInstancesUnder, s as forEachDescendantNode, t as REACTIVE_CHILDREN_KEY, u as getElementReactivePropsCleanupMap, v as updateElementRef, w as isDelegatedEvent, x as clearDelegatedHandlersForElement, y as addDelegatedListener } from "./cleanup-D8Ufd9Ix.js";
13
+ import { n as getPublicAttributeName, t as sanitizeCssValue } from "./css-BuPaTOfe.js";
14
+ import { a as isSafeHref, i as ROUTE_ROOT_COMPONENT } from "./csp-nonce-CwSRP3Jl.js";
15
15
  //#region src/runtime/error-boundary.ts
16
16
  function createBoundaryReset(instance) {
17
17
  return () => {
@@ -500,7 +500,8 @@ function normalizeStyleEntries(value) {
500
500
  const entries = /* @__PURE__ */ new Map();
501
501
  for (const [key, entryValue] of Object.entries(value)) {
502
502
  if (entryValue === void 0 || entryValue === null || entryValue === false) continue;
503
- entries.set(normalizeStylePropertyName(key), String(entryValue));
503
+ const safeValue = sanitizeCssValue(String(entryValue));
504
+ if (safeValue) entries.set(normalizeStylePropertyName(key), safeValue);
504
505
  }
505
506
  return entries;
506
507
  }
@@ -554,6 +555,7 @@ function applyStaticScalarPropsToElement(el, props, tagName) {
554
555
  if (key === "class" || key === "className") writeElementClassName(el, String(value));
555
556
  else if (key === "style") applyStylePropValue(el, value);
556
557
  else if (key === "value" || key === "checked") applyFormControlProp(el, key, value, tagName);
558
+ else if (key.toLowerCase() === "href" && !isSafeHref(String(value))) removeRenderedAttribute(el, key);
557
559
  else setRenderedAttribute(el, key, String(value));
558
560
  }
559
561
  }
@@ -619,6 +621,7 @@ function applyScalarPropValue(el, key, value, tagName, previousValue, descriptor
619
621
  if (key === "class" || key === "className") applyClassPropValue(el, value, previousValue, descriptor);
620
622
  else if (key === "style") applyStylePropValue(el, value);
621
623
  else if (key === "value" || key === "checked") applyFormControlProp(el, key, value, tagName);
624
+ else if (key.toLowerCase() === "href" && !isSafeHref(String(value))) removeRenderedAttribute(el, key);
622
625
  else setRenderedAttribute(el, key, String(value));
623
626
  }
624
627
  function removeStaleAttributes(el, vnode, props) {
@@ -2549,10 +2552,7 @@ function updateElementChildren$1(el, children, forceUpdate = false) {
2549
2552
  keyedElements.delete(el);
2550
2553
  return;
2551
2554
  }
2552
- if (normalizedChildren.some(isControlBoundaryVNode) && normalizedChildren.every((child) => {
2553
- if (!isControlBoundaryVNode(child)) return true;
2554
- return getControlBoundaryState(child)?.kind !== "for";
2555
- })) {
2555
+ if (normalizedChildren.some(isControlBoundaryVNode)) {
2556
2556
  updateMixedControlChildren(el, normalizedChildren, forceUpdate);
2557
2557
  keyedElements.delete(el);
2558
2558
  return;
@@ -2611,6 +2611,7 @@ function removeRangeAtCursor(parent, cursor) {
2611
2611
  return next;
2612
2612
  }
2613
2613
  function updateMixedControlChildren(parent, children, forceUpdate) {
2614
+ clearControlBoundaryCommitOwner(parent);
2614
2615
  const parentNamespace = getParentNamespace(parent);
2615
2616
  const domHost = getRendererDOMHost();
2616
2617
  let cursor = parent.firstChild;
@@ -2618,10 +2619,14 @@ function updateMixedControlChildren(parent, children, forceUpdate) {
2618
2619
  if (isControlBoundaryVNode(child)) {
2619
2620
  const controlState = getControlBoundaryState(child);
2620
2621
  if (!controlState) throw new Error("[updateElementChildren] Control boundary missing internal state");
2621
- registerControlBoundaryCommitOwner(parent, controlState);
2622
2622
  const childVNodes = evaluateControlBoundaryState(controlState);
2623
2623
  const cursorAfterBoundary = cursor ? isRangeStart(cursor) ? findRangeEnd(cursor)?.nextSibling ?? cursor.nextSibling : cursor.nextSibling : null;
2624
2624
  const ranges = syncControlBoundaryInMixedParent(parent, controlState, childVNodes, cursor);
2625
+ if (controlState.kind === "for") {
2626
+ const last = ranges[ranges.length - 1];
2627
+ cursor = last ? last.end.nextSibling : cursorAfterBoundary?.parentNode === parent ? cursorAfterBoundary : cursor?.parentNode === parent ? cursor : null;
2628
+ continue;
2629
+ }
2625
2630
  for (const range of ranges) if (range.start.parentNode !== parent) moveRange(parent, range, cursor?.parentNode === parent ? cursor : null);
2626
2631
  else if (cursor?.parentNode === parent) moveRange(parent, range, cursor);
2627
2632
  const last = ranges[ranges.length - 1];
@@ -3738,6 +3743,11 @@ function updateElementChildren(element, vnodeChildren, cleanupRangeNode) {
3738
3743
  updateForBoundaryChildren(element, vnodeChildren[0]);
3739
3744
  return;
3740
3745
  }
3746
+ if (vnodeChildren.some((child) => _isDOMElement(child) && child.type === __CONTROL_BOUNDARY__)) {
3747
+ updateMixedControlChildren(element, vnodeChildren, false);
3748
+ keyedElements.delete(element);
3749
+ return;
3750
+ }
3741
3751
  if (hasKeyedChildren(vnodeChildren)) reconcileKeyed(element, vnodeChildren, getOrBuildKeyMap(element));
3742
3752
  else reconcileUnkeyed(element, vnodeChildren);
3743
3753
  }
@@ -4398,7 +4408,78 @@ function syncControlBoundaryScopeNode(parent, scope, vnode) {
4398
4408
  return range?.single ? range.start : null;
4399
4409
  }
4400
4410
  function syncControlBoundaryInMixedParent(parent, controlState, childrenVNodes, before) {
4401
- if (controlState.kind === "for") throw new Error("[askr] For ranges require the keyed boundary commit path.");
4411
+ if (controlState.kind === "for") {
4412
+ const ownedNodes = /* @__PURE__ */ new Set();
4413
+ const collectRangeNodes = (range) => {
4414
+ if (range.start.parentNode !== parent) return;
4415
+ ownedNodes.add(range.start);
4416
+ if (!range.single) {
4417
+ let current = range.start.nextSibling;
4418
+ while (current) {
4419
+ ownedNodes.add(current);
4420
+ if (current === range.end) break;
4421
+ current = current.nextSibling;
4422
+ }
4423
+ }
4424
+ };
4425
+ for (const item of controlState.orderedItems) if (item?.scope.range) collectRangeNodes(item.scope.range);
4426
+ if (controlState.fallbackScope?.range) collectRangeNodes(controlState.fallbackScope.range);
4427
+ for (const range of controlState.lastRemovedRanges) collectRangeNodes(range);
4428
+ for (const node of controlState.lastRemovedNodes) if (node.parentNode === parent) ownedNodes.add(node);
4429
+ let afterBoundary = before;
4430
+ while (afterBoundary && ownedNodes.has(afterBoundary)) afterBoundary = afterBoundary.nextSibling;
4431
+ const nextRanges = [];
4432
+ let syncBefore = before;
4433
+ if (controlState.orderedKeys.length === 0) {
4434
+ const fallbackScope = controlState.fallbackScope;
4435
+ const fallbackVNode = childrenVNodes[0];
4436
+ if (fallbackScope && fallbackVNode !== void 0) {
4437
+ if (fallbackScope.hydrationPending && !fallbackScope.range && syncBefore instanceof Element && !checkVNodeShapeChanged(syncBefore, fallbackVNode)) {
4438
+ assignScopeRange(fallbackScope, {
4439
+ start: syncBefore,
4440
+ end: syncBefore,
4441
+ single: true
4442
+ });
4443
+ fallbackScope.hydrationPending = false;
4444
+ }
4445
+ const range = syncControlBoundaryScopeDom(parent, fallbackScope, fallbackVNode, syncBefore, controlState.lastRemovedRanges.length === 0, false);
4446
+ if (range) {
4447
+ nextRanges.push(range);
4448
+ syncBefore = range.end.nextSibling;
4449
+ }
4450
+ }
4451
+ } else for (let index = 0; index < controlState.orderedItems.length; index += 1) {
4452
+ const item = controlState.orderedItems[index];
4453
+ const vnode = childrenVNodes[index];
4454
+ if (!item || vnode === void 0) continue;
4455
+ if (item.scope.hydrationPending && !item.scope.range && syncBefore instanceof Element && getMaterializedKey(syncBefore) === controlState.orderedKeys[index] && !checkVNodeShapeChanged(syncBefore, vnode)) {
4456
+ assignScopeRange(item.scope, {
4457
+ start: syncBefore,
4458
+ end: syncBefore,
4459
+ single: true
4460
+ });
4461
+ item.scope.hydrationPending = false;
4462
+ }
4463
+ const range = syncControlBoundaryScopeDom(parent, item.scope, vnode, syncBefore, controlState.lastRemovedRanges.length === 0, false);
4464
+ if (range) {
4465
+ nextRanges.push(range);
4466
+ syncBefore = range.end.nextSibling;
4467
+ }
4468
+ }
4469
+ const previousAfterBoundary = afterBoundary;
4470
+ if (previousAfterBoundary && nextRanges.some((range) => rangeContains(range, previousAfterBoundary))) afterBoundary = nextRanges[nextRanges.length - 1]?.end.nextSibling ?? null;
4471
+ const nextRangeSet = new Set(nextRanges);
4472
+ for (const range of controlState.lastRemovedRanges) if (!nextRangeSet.has(range)) removeRange(range, teardownBoundaryRangeNode);
4473
+ for (const node of controlState.lastRemovedNodes) if (node.parentNode === parent && !nextRanges.some((range) => rangeContains(range, node))) teardownBoundaryRangeNode(node);
4474
+ let anchor = afterBoundary?.parentNode === parent ? afterBoundary : null;
4475
+ for (let index = nextRanges.length - 1; index >= 0; index -= 1) {
4476
+ const range = nextRanges[index];
4477
+ insertRangeBefore(parent, range, anchor);
4478
+ anchor = range.start;
4479
+ }
4480
+ clearBoundaryState(controlState);
4481
+ return nextRanges;
4482
+ }
4402
4483
  const activeScope = controlState.activeScope;
4403
4484
  const activeVNode = childrenVNodes[0];
4404
4485
  const nextRange = activeScope && activeVNode !== void 0 ? syncControlBoundaryScopeDom(parent, activeScope, activeVNode, before, controlState.lastRemovedRanges.length === 0) : null;