brumate 0.8.0 → 0.8.1

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 (45) hide show
  1. package/dist/{boot-BkUdiYOF.d.ts → boot-DQuAhAd5.d.ts} +2 -2
  2. package/dist/cli.js +2 -2
  3. package/dist/{client-Cq6aTiDs.d.ts → client-4eabQtYJ.d.ts} +25 -7
  4. package/dist/{client-B0FXW5Kw.js → client-CwVcmymi.js} +102 -19
  5. package/dist/client-CwVcmymi.js.map +1 -0
  6. package/dist/{defer-BMIMP4Hq.js → defer-BaXWydb0.js} +2 -2
  7. package/dist/{defer-BMIMP4Hq.js.map → defer-BaXWydb0.js.map} +1 -1
  8. package/dist/{devtools-B4prrxht.js → devtools-CMuj12yR.js} +4 -4
  9. package/dist/{devtools-B4prrxht.js.map → devtools-CMuj12yR.js.map} +1 -1
  10. package/dist/{devtools-panel-B1nF1KB7.js → devtools-panel-Cq8LpsyW.js} +2 -2
  11. package/dist/{devtools-panel-B1nF1KB7.js.map → devtools-panel-Cq8LpsyW.js.map} +1 -1
  12. package/dist/{files-D5GtxwEQ.js → files-DXS8RAtZ.js} +2 -2
  13. package/dist/{files-D5GtxwEQ.js.map → files-DXS8RAtZ.js.map} +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/{inspect-CGl5Y8q6.js → inspect-B5AoHh5O.js} +59 -14
  16. package/dist/inspect-B5AoHh5O.js.map +1 -0
  17. package/dist/{loader-BsaSuIoG.js → loader-CTeT6ie9.js} +4 -4
  18. package/dist/{loader-BsaSuIoG.js.map → loader-CTeT6ie9.js.map} +1 -1
  19. package/dist/{navigate-BlowKvhB.js → navigate-Bj73X4ZS.js} +10 -3
  20. package/dist/navigate-Bj73X4ZS.js.map +1 -0
  21. package/dist/{rpc-C1jYVNAe.js → rpc-kVB0Ujdx.js} +2 -2
  22. package/dist/{rpc-C1jYVNAe.js.map → rpc-kVB0Ujdx.js.map} +1 -1
  23. package/dist/runtime/bundles.d.ts +3 -2
  24. package/dist/runtime/bundles.js +14 -3
  25. package/dist/runtime/bundles.js.map +1 -1
  26. package/dist/runtime/client.d.ts +2 -2
  27. package/dist/runtime/client.js +2 -2
  28. package/dist/runtime/devtools.d.ts +1 -1
  29. package/dist/runtime/devtools.js +1 -1
  30. package/dist/runtime/hot.d.ts +1 -1
  31. package/dist/runtime/loader.d.ts +2 -2
  32. package/dist/runtime/loader.js +2 -2
  33. package/dist/runtime/static-loader.d.ts +2 -2
  34. package/dist/runtime/static-loader.js +1 -1
  35. package/dist/runtime/testing.d.ts +1 -1
  36. package/dist/runtime/testing.js +1 -1
  37. package/dist/{static-loader-C_en-4v8.js → static-loader-BM0-wdIc.js} +2 -2
  38. package/dist/{static-loader-C_en-4v8.js.map → static-loader-BM0-wdIc.js.map} +1 -1
  39. package/dist/{static-loader-UKnK11Em.d.ts → static-loader-BSAyFqG0.d.ts} +2 -2
  40. package/dist/vite.d.ts +1 -1
  41. package/dist/vite.js +2 -2
  42. package/package.json +1 -1
  43. package/dist/client-B0FXW5Kw.js.map +0 -1
  44. package/dist/inspect-CGl5Y8q6.js.map +0 -1
  45. package/dist/navigate-BlowKvhB.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { r as SerialEntry } from "./values-B8C7CLvG.js";
2
- import { qt as ClientModule } from "./client-Cq6aTiDs.js";
2
+ import { Yt as ClientModule } from "./client-4eabQtYJ.js";
3
3
  //#region src/runtime/boot.d.ts
4
4
  interface LoaderOptions {
5
5
  /**
@@ -51,4 +51,4 @@ interface NavigateOptions {
51
51
  }
52
52
  //#endregion
53
53
  export { NavigateOptions as n, LoaderOptions as t };
54
- //# sourceMappingURL=boot-BkUdiYOF.d.ts.map
54
+ //# sourceMappingURL=boot-DQuAhAd5.d.ts.map
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as findError } from "./error-catalog-DakxjSgj.js";
3
- import { A as analyzeProjectProps, C as resolveFromDisk, Q as getLocation, W as BRIDGE_EXPORT, Y as scriptBridges, Z as BrumateError, o as CompileError, r as inspect, s as compile } from "./inspect-CGl5Y8q6.js";
4
- import { _ as findPackages, a as findScripts, b as resolveComponentPackage, c as findServerImport, n as defaultExclude, s as findPackageServerFile, t as collectSources } from "./files-D5GtxwEQ.js";
3
+ import { A as analyzeProjectProps, C as resolveFromDisk, Q as getLocation, W as BRIDGE_EXPORT, Y as scriptBridges, Z as BrumateError, o as CompileError, r as inspect, s as compile } from "./inspect-B5AoHh5O.js";
4
+ import { _ as findPackages, a as findScripts, b as resolveComponentPackage, c as findServerImport, n as defaultExclude, s as findPackageServerFile, t as collectSources } from "./files-DXS8RAtZ.js";
5
5
  import { createRequire } from "node:module";
6
6
  import { existsSync, readFileSync, statSync } from "node:fs";
7
7
  import { cp, readdir } from "node:fs/promises";
@@ -71,9 +71,9 @@ interface HiddenBody {
71
71
  //#region src/runtime/client/children.d.ts
72
72
  /**
73
73
  * A call of a `#template` of the file, which an insert can update in place. `render` is the
74
- * template's code, and `owner` the scope that holds the template. The call finds its contexts
75
- * where the template is written, as the output of a template does, so it does not render as
76
- * children of the owner.
74
+ * template's code, and `owner` the scope that holds the template. The call renders as children
75
+ * of its owner, where the component that gets it inserts it, so it reads the contexts there, as
76
+ * on the server.
77
77
  */
78
78
  declare function templateCall(ref: string, owner: Scope | undefined, render: (...args: unknown[]) => unknown, args: unknown[]): TemplateCall;
79
79
  /** Renders a value inserted in markup. Children render here, at `scope`, for their contexts. */
@@ -97,7 +97,7 @@ declare class TemplateCall extends Children {
97
97
  /** The scope of the component that wrote the template. */
98
98
  readonly owner: Scope | undefined;
99
99
  readonly args: unknown[];
100
- constructor(ref: string, owner: Scope | undefined, args: unknown[], html: (at?: Scope) => string, lexical?: boolean);
100
+ constructor(ref: string, owner: Scope | undefined, args: unknown[], html: (at?: Scope) => string);
101
101
  }
102
102
  /** The children of a component that the client renders. See `Children`. */
103
103
  declare function children(from: Scope | ScopeId | undefined, html: () => string | DocumentFragment): Children;
@@ -132,7 +132,10 @@ declare function memoNow(value: unknown): unknown;
132
132
  * of a memo until a read.
133
133
  */
134
134
  declare function renderMemo(compute: () => unknown): unknown;
135
- /** Reads a memo of a render: the error that a throw held is thrown at the read. */
135
+ /**
136
+ * Reads a memo of a render: the error that a throw held is thrown at the read. A memo that is
137
+ * still loading stops the code that reads it, which waits for the memo.
138
+ */
136
139
  declare function readMemo(value: unknown): unknown;
137
140
  declare function setSlots(id: ScopeId, values: unknown[]): void;
138
141
  declare function setItem(id: ScopeId, value: unknown): void;
@@ -178,6 +181,8 @@ interface Scope {
178
181
  /** The component ID, for a component's root scope. */
179
182
  m?: string;
180
183
  s: unknown[];
184
+ /** True once the scope is removed, so a wait that ends later computes nothing. */
185
+ gone?: boolean;
181
186
  /** The item of a list item scope. */
182
187
  i?: unknown;
183
188
  c?: Record<number, ScopeId>;
@@ -460,6 +465,12 @@ declare function attempt(body: () => Out): DocumentFragment;
460
465
  * A scope that goes during the wait ends it with `leave`.
461
466
  */
462
467
  declare function fillSettled(id: ScopeId | Scope, values: unknown[], write: (...values: unknown[]) => void): void;
468
+ /**
469
+ * A write of cloned markup whose values come from code that can read a memo that is still
470
+ * loading, such as a block header or a prop that calls a function. The write waits for the memo,
471
+ * and runs again with its value. It counts in the boundary of the render, as `fillSettled` does.
472
+ */
473
+ declare function fillPend(id: ScopeId | Scope, write: () => void): void;
463
474
  /**
464
475
  * A value of markup that the browser writes, in text or an attribute, which can be a promise.
465
476
  * A value that is not one is written at once. A promise counts in the boundary of the render, as
@@ -779,6 +790,13 @@ declare function unreadMemo(scope: Scope | ScopeId, value: unknown): void;
779
790
  * keeps its value, and `pending` is true. Only the latest load is written.
780
791
  */
781
792
  declare function asyncMemo(scope: Scope, slot: number, promise: Promise<unknown>): number;
793
+ /**
794
+ * Computes a value of a render that can read a memo that is still loading, as an update does:
795
+ * the value is a promise that computes again once the memo settles, so what reads it waits.
796
+ * A second stop at the same wait is no wait for it, so it throws. A scope that goes, `owner`,
797
+ * computes nothing more. The scopes and the work that a stopped compute started are dropped.
798
+ */
799
+ declare function pend(compute: () => unknown, owner?: Scope | ScopeId, last?: PromiseLike<unknown>): unknown;
782
800
  /**
783
801
  * `$resolve(memo, { timeout, signal })`: resolves with the value of the memo once it is no longer
784
802
  * pending, also after a load that its inputs started. `isLoading` tells whether the memo or a
@@ -833,5 +851,5 @@ declare const loader: {
833
851
  updateRoute: typeof updateRoute;
834
852
  };
835
853
  //#endregion
836
- export { list as $, hooks as $t, nodes as A, leavePage as At, descendants as B, consumeContext as Bt, clone as C, offscreen as Cn, wait as Ct, keepText as D, NavigationReport as Dn, dispose as Dt, keep as E, retag as En, nameComment as Et, setOn as F, handle as Ft, sink as G, toStore as Gt, makeId as H, provideValue as Ht, setSpread as I, handlerProp as It, addHead as J, CoreOptions as Jt, prop as K, updateRoute as Kt, template as L, rpc as Lt, setAttr as M, remount as Mt, setAttrText as N, removeRoot as Nt, listNodes as O, forget as Ot, setContent as P, action as Pt, setVar as Q, build as Qt, afterInsert as R, spread as Rt, branchNodes as S, held as Sn, started as St, fillList as T, reset as Tn, loadModule as Tt, removeScope as U, setGlobal as Ut, getScope as V, consumeStore as Vt, setOwner as W, storeUpdate as Wt, addStyle as X, DevtoolsHooks as Xt, addPortal as Y, DEVTOOLS as Yt, deferInBrowser as Z, Scope as Zt, updated as _, insert as _n, fillSpread as _t, cells as a, componentNodes as an, content as at, searchParam as b, branch as bn, loading as bt, get as c, elementAt as cn, text as ct, pending as d, place as dn, track as dt, rpcPrefix as en, toList as et, resolve as f, readMemo as fn, after as ft, update as g, children as gn, fillSettled as gt, unreadMemo as h, setSlots as hn, fillAttrs as ht, bindings as i, component as in, attrs as it, putText as j, leaveRoutes as jt, markBlock as k, init as kt, isBound as l, foreignNodes as ln, writeText as lt, timed as m, setItem as mn, countLoads as mt, asyncMemo as n, skew as nn, windowStart as nt, effect as o, dynamic as on, portalTo as ot, set as p, renderMemo as pn, attempt as pt, spreadProps as q, ClientModule as qt, binding as r, Component as rn, attr as rt, gate as s, dynamicNodes as sn, restRef as st, loader as t, scopes as tn, windowList as tt, memo as u, memoNow as un, guess as ut, title as v, templateCall as vn, fillValue as vt, fillBranch as w, rekey as wn, fail as wt, appendText as x, fill as xn, reveal as xt, paramEffect as y, HiddenBody as yn, keepValue as yt, createScope as z, submitAction as zt };
837
- //# sourceMappingURL=client-Cq6aTiDs.d.ts.map
854
+ export { setVar as $, Scope as $t, markBlock as A, forget as At, createScope as B, spread as Bt, branchNodes as C, fill as Cn, reveal as Ct, keep as D, reset as Dn, loadModule as Dt, fillList as E, rekey as En, fail as Et, setContent as F, removeRoot as Ft, setOwner as G, setGlobal as Gt, getScope as H, consumeContext as Ht, setOn as I, action as It, spreadProps as J, updateRoute as Jt, sink as K, storeUpdate as Kt, setSpread as L, handle as Lt, putText as M, leavePage as Mt, setAttr as N, leaveRoutes as Nt, keepText as O, retag as On, nameComment as Ot, setAttrText as P, remount as Pt, deferInBrowser as Q, DevtoolsHooks as Qt, template as R, handlerProp as Rt, appendText as S, branch as Sn, loading as St, fillBranch as T, offscreen as Tn, wait as Tt, makeId as U, consumeStore as Ut, descendants as V, submitAction as Vt, removeScope as W, provideValue as Wt, addPortal as X, CoreOptions as Xt, addHead as Y, ClientModule as Yt, addStyle as Z, DEVTOOLS as Zt, update as _, setSlots as _n, fillPend as _t, cells as a, Component as an, attrs as at, paramEffect as b, templateCall as bn, fillValue as bt, get as c, dynamic as cn, restRef as ct, pend as d, foreignNodes as dn, guess as dt, build as en, list as et, pending as f, memoNow as fn, track as ft, unreadMemo as g, setItem as gn, fillAttrs as gt, timed as h, renderMemo as hn, countLoads as ht, bindings as i, skew as in, attr as it, nodes as j, init as jt, listNodes as k, NavigationReport as kn, dispose as kt, isBound as l, dynamicNodes as ln, text as lt, set as m, readMemo as mn, attempt as mt, asyncMemo as n, rpcPrefix as nn, windowList as nt, effect as o, component as on, content as ot, resolve as p, place as pn, after as pt, prop as q, toStore as qt, binding as r, scopes as rn, windowStart as rt, gate as s, componentNodes as sn, portalTo as st, loader as t, hooks as tn, toList as tt, memo as u, elementAt as un, writeText as ut, updated as v, children as vn, fillSettled as vt, clone as w, held as wn, started as wt, searchParam as x, HiddenBody as xn, keepValue as xt, title as y, insert as yn, fillSpread as yt, afterInsert as z, rpc as zt };
855
+ //# sourceMappingURL=client-4eabQtYJ.d.ts.map
@@ -397,6 +397,7 @@ function removeScope(scope) {
397
397
  }
398
398
  if (scope.h) hiding?.bodies.delete(scope.h);
399
399
  scopes.delete(scope.id);
400
+ scope.gone = true;
400
401
  for (const [check, owner] of waiters) if (owner === scope) check();
401
402
  scope.p?.children?.delete(scope);
402
403
  scope.o?.owned?.delete(scope);
@@ -862,12 +863,12 @@ function templateReference(ref, scope) {
862
863
  }
863
864
  /**
864
865
  * A call of a `#template` of the file, which an insert can update in place. `render` is the
865
- * template's code, and `owner` the scope that holds the template. The call finds its contexts
866
- * where the template is written, as the output of a template does, so it does not render as
867
- * children of the owner.
866
+ * template's code, and `owner` the scope that holds the template. The call renders as children
867
+ * of its owner, where the component that gets it inserts it, so it reads the contexts there, as
868
+ * on the server.
868
869
  */
869
870
  function templateCall(ref, owner, render, args) {
870
- return new TemplateCall(ref, owner, args, (at) => insert(render(...args), void 0, at), true);
871
+ return new TemplateCall(ref, owner, args, (at) => insert(render(...args), void 0, at));
871
872
  }
872
873
  /** Renders a value inserted in markup. Children render here, at `scope`, for their contexts. */
873
874
  function insert(value, _ctx, scope) {
@@ -937,8 +938,8 @@ var TemplateCall = class extends Children {
937
938
  /** The scope of the component that wrote the template. */
938
939
  owner;
939
940
  args;
940
- constructor(ref, owner, args, html, lexical = false) {
941
- super(lexical ? void 0 : owner, html);
941
+ constructor(ref, owner, args, html) {
942
+ super(owner, html);
942
943
  this.ref = ref;
943
944
  this.owner = owner;
944
945
  this.args = args;
@@ -1115,9 +1116,14 @@ async function catchInto(owner, body, module, [, anchor, , fallback, kinds, hold
1115
1116
  function get(scope, slot) {
1116
1117
  if (dirty.size > 0 && !draining) settle(scope);
1117
1118
  const value = scope.s[slot];
1118
- if (value === void 0 && exempt > 0 && !(slot in scope.s)) throw new NotReady(Promise.resolve());
1119
+ if (value === void 0 && (exempt > 0 || reading > 0) && !(slot in scope.s)) throw new NotReady(unreached);
1119
1120
  if (value instanceof Promise && !scope.plain?.has(slot)) {
1120
1121
  if (computing > 0) throw new NotReady(value);
1122
+ if (reading > 0 && loadingValues.has(value)) {
1123
+ const result = memoResults.get(value);
1124
+ if (result) return result.value;
1125
+ throw new NotReady(value);
1126
+ }
1121
1127
  if (loadingValues.has(value)) {
1122
1128
  if (runningEffects > 0) throw new NotReady(value);
1123
1129
  if (exempt === 0) throw new Error("This value is still loading. Wait for it with await $resolve(memo), or check $isPending(memo) first");
@@ -1370,6 +1376,41 @@ var NotReady = class extends Error {
1370
1376
  this.source = source;
1371
1377
  }
1372
1378
  };
1379
+ /** The values of the promises of memos of a render that settled, which a read of the memo gives. */
1380
+ const memoResults = /* @__PURE__ */ new WeakMap();
1381
+ let reading = 0;
1382
+ function isReading() {
1383
+ return reading > 0;
1384
+ }
1385
+ const unreached = Promise.resolve();
1386
+ /**
1387
+ * Computes a value of a render that can read a memo that is still loading, as an update does:
1388
+ * the value is a promise that computes again once the memo settles, so what reads it waits.
1389
+ * A second stop at the same wait is no wait for it, so it throws. A scope that goes, `owner`,
1390
+ * computes nothing more. The scopes and the work that a stopped compute started are dropped.
1391
+ */
1392
+ function pend(compute, owner, last) {
1393
+ const at = owner === void 0 || typeof owner === "object" ? owner : scopes.get(owner) ?? findRendered(owner);
1394
+ const made = rendered.length;
1395
+ const queued = afterInsert.length;
1396
+ reading++;
1397
+ try {
1398
+ return compute();
1399
+ } catch (error) {
1400
+ if (error instanceof NotReady && error.source !== last) {
1401
+ rendered.length = made;
1402
+ afterInsert.length = queued;
1403
+ const source = error.source;
1404
+ return Promise.resolve(source).then(() => at?.gone ? void 0 : pend(compute, at, source));
1405
+ }
1406
+ throw error;
1407
+ } finally {
1408
+ reading--;
1409
+ }
1410
+ }
1411
+ function findRendered(id) {
1412
+ return rendered.find((scope) => scope.id === id);
1413
+ }
1373
1414
  let computing = 0;
1374
1415
  let origin;
1375
1416
  let viaContext = false;
@@ -2195,12 +2236,12 @@ function action(name, id, method, result) {
2195
2236
  * call loads, so the core holds only this.
2196
2237
  */
2197
2238
  function submitAction(form, submitter) {
2198
- import("./rpc-C1jYVNAe.js").then((module) => module.sendAction(form, submitter));
2239
+ import("./rpc-kVB0Ujdx.js").then((module) => module.sendAction(form, submitter));
2199
2240
  }
2200
2241
  /** Calls a server function. */
2201
2242
  async function rpc(id, args) {
2202
2243
  const signal = memoSignal();
2203
- return track(import("./rpc-C1jYVNAe.js").then((module) => module.call(rpcPrefix, id, args, signal)));
2244
+ return track(import("./rpc-kVB0Ujdx.js").then((module) => module.call(rpcPrefix, id, args, signal)));
2204
2245
  }
2205
2246
  /** A function prop rendered on the client calls the parent's exported handler. */
2206
2247
  function handlerProp(value, ref, scope, bound = [], modifiers) {
@@ -2912,6 +2953,7 @@ const memoLoads = /* @__PURE__ */ new WeakMap();
2912
2953
  */
2913
2954
  function memoNow(value) {
2914
2955
  if (isThenable(value) || isAsyncIterable(value)) memoLoads.set(value, (memoLoads.get(value) ?? 0) + 1);
2956
+ if (isThenable(value)) value.then((result) => memoResults.set(value, { value: result }), noop$1);
2915
2957
  return value;
2916
2958
  }
2917
2959
  /**
@@ -2920,14 +2962,22 @@ function memoNow(value) {
2920
2962
  */
2921
2963
  function renderMemo(compute) {
2922
2964
  try {
2923
- return memoNow(compute());
2965
+ return memoNow(pend(compute, rendered.at(-1)));
2924
2966
  } catch (error) {
2925
2967
  return new MemoError(error);
2926
2968
  }
2927
2969
  }
2928
- /** Reads a memo of a render: the error that a throw held is thrown at the read. */
2970
+ /**
2971
+ * Reads a memo of a render: the error that a throw held is thrown at the read. A memo that is
2972
+ * still loading stops the code that reads it, which waits for the memo.
2973
+ */
2929
2974
  function readMemo(value) {
2930
2975
  if (value instanceof MemoError) throw value.error;
2976
+ if (isThenable(value) && memoLoads.has(value)) {
2977
+ const result = memoResults.get(value);
2978
+ if (result) return result.value;
2979
+ if (isReading()) throw new NotReady(value);
2980
+ }
2931
2981
  return value;
2932
2982
  }
2933
2983
  function setSlots(id, values) {
@@ -3131,7 +3181,7 @@ const writtenInserts = /* @__PURE__ */ new WeakSet();
3131
3181
  function renderedTemplate(call, at, k, first, end) {
3132
3182
  if (k === void 0) return;
3133
3183
  let found;
3134
- for (const scope of scopes.values()) if (call.owner && scope.p === call.owner && scope.k === k && (scope.t === at || scope.l === at && inRange(scope, first, end))) {
3184
+ for (const scope of scopes.values()) if (call.owner && scope.p === call.owner && scope.k === k && (scope.t === at || scope.l === at) && inRange(scope, first, end)) {
3135
3185
  if (found) return;
3136
3186
  found = scope;
3137
3187
  }
@@ -3140,17 +3190,39 @@ function renderedTemplate(call, at, k, first, end) {
3140
3190
  scope: found
3141
3191
  };
3142
3192
  }
3143
- /** True if an anchor of the scope, a comment, an element or a kept node, is in the range. */
3193
+ /**
3194
+ * True if the range holds markup of the scope or of a scope inside it: an anchor, a comment or an
3195
+ * element, or a kept node. A template that only renders a component has no anchor of its own, so
3196
+ * the anchors of the scopes it made count too.
3197
+ */
3144
3198
  function inRange(scope, first, end) {
3145
- const comment = `t${scope.id}:`;
3146
- const element = `${scope.id}:`;
3199
+ const kept = keptNodes(scope, []);
3147
3200
  for (let node = first; node && node !== end; node = node.nextSibling) {
3148
3201
  const walker = document.createTreeWalker(node, 129);
3149
- for (let item = node; item; item = walker.nextNode()) if (item.nodeType === 8 ? item.data.startsWith(comment) : item.nodeType === 1 && item.getAttribute("b-b")?.startsWith(element)) return true;
3150
- for (const kept of scope.n ?? []) if (kept && (kept === node || node.contains(kept))) return true;
3202
+ for (let item = node; item; item = walker.nextNode()) {
3203
+ let id;
3204
+ if (item.nodeType === 8) {
3205
+ const data = item.data;
3206
+ id = MARKER.test(data) ? data.slice(1).split(":")[0] : void 0;
3207
+ } else if (item.nodeType === 1) id = item.getAttribute("b-b")?.split(":")[0];
3208
+ if (id !== void 0 && isInside(scopes.get(parseId(id)), scope)) return true;
3209
+ }
3210
+ for (const item of kept) if (item === node || node.contains(item)) return true;
3151
3211
  }
3152
3212
  return false;
3153
3213
  }
3214
+ /** True if `found` is `scope` or a scope that it made, by its parents and owners. */
3215
+ function isInside(found, scope) {
3216
+ for (let current = found; current; current = current.p ?? current.o) if (current === scope) return true;
3217
+ return false;
3218
+ }
3219
+ /** Adds the nodes that the scope and the scopes inside it keep, of markup the browser cloned. */
3220
+ function keptNodes(scope, nodes) {
3221
+ for (const node of scope.n ?? []) if (node) nodes.push(node);
3222
+ for (const child of scope.children ?? []) keptNodes(child, nodes);
3223
+ for (const child of scope.owned ?? []) keptNodes(child, nodes);
3224
+ return nodes;
3225
+ }
3154
3226
  /** The `value` and `checked` that updates last wrote to each field. */
3155
3227
  const fieldValues = /* @__PURE__ */ new WeakMap();
3156
3228
  function setAttribute(element, name, value, spread = false) {
@@ -3412,6 +3484,17 @@ function fillSettled(id, values, write) {
3412
3484
  }, (error) => failOnce(scope, own, error));
3413
3485
  }
3414
3486
  /**
3487
+ * A write of cloned markup whose values come from code that can read a memo that is still
3488
+ * loading, such as a block header or a prop that calls a function. The write waits for the memo,
3489
+ * and runs again with its value. It counts in the boundary of the render, as `fillSettled` does.
3490
+ */
3491
+ function fillPend(id, write) {
3492
+ const waiting = pend(() => {
3493
+ write();
3494
+ }, id);
3495
+ if (isThenable(waiting)) fillSettled(id, [waiting], noop$1);
3496
+ }
3497
+ /**
3415
3498
  * A value of markup that the browser writes, in text or an attribute, which can be a promise.
3416
3499
  * A value that is not one is written at once. A promise counts in the boundary of the render, as
3417
3500
  * a memo of `fillSettled` does, and `write` gets its value once it settles. The scope keeps the
@@ -4656,6 +4739,6 @@ const loader = {
4656
4739
  };
4657
4740
  function noop() {}
4658
4741
  //#endregion
4659
- export { appendText as $, updated as $t, started as A, track as At, spreadProps as B, bindings as Bt, fillAttrs as C, action as Ct, keepValue as D, spread as Dt, fillValue as E, rpc as Et, portalTo as F, storeUpdate as Ft, elementAt as G, isBound as Gt, componentNodes as H, effect as Ht, restRef as I, toStore as It, place as J, resolve as Jt, foreignNodes as K, memo as Kt, text as L, updateRoute as Lt, attr as M, consumeStore as Mt, attrs as N, provideValue as Nt, loading as O, submitAction as Ot, content as P, setGlobal as Pt, setSlots as Q, update as Qt, writeText as R, asyncMemo as Rt, countLoads as S, removeRoot as St, fillSpread as T, handlerProp as Tt, dynamic as U, gate as Ut, component as V, cells as Vt, dynamicNodes as W, get as Wt, renderMemo as X, timed as Xt, readMemo as Y, set as Yt, setItem as Z, unreadMemo as Zt, rekey as _, hooks as _n, forget as _t, addPortal as a, afterInsert as an, keepText as at, after as b, skew as bn, leaveRoutes as bt, setVar as c, getScope as cn, nodes as ct, windowList as d, setOwner as dn, setAttrText as dt, fail as en, branchNodes as et, windowStart as f, sink as fn, setContent as ft, offscreen as g, build as gn, dispose as gt, held as h, DEVTOOLS as hn, template as ht, addHead as i, title as in, keep as it, wait as j, consumeContext as jt, reveal as k, guess as kt, list as l, makeId as ln, putText as lt, fill as m, loadModule as mn, setSpread as mt, paramEffect as n, insert as nn, fillBranch as nt, addStyle as o, createScope as on, listNodes as ot, branch as p, nameComment as pn, setOn as pt, memoNow as q, pending as qt, searchParam as r, templateCall as rn, fillList as rt, deferInBrowser as s, descendants as sn, markBlock as st, loader as t, children as tn, clone as tt, toList as u, removeScope as un, setAttr as ut, reset as v, rpcPrefix as vn, init as vt, fillSettled as w, handle as wt, attempt as x, remount as xt, retag as y, scopes as yn, leavePage as yt, prop as z, binding as zt };
4742
+ export { setSlots as $, unreadMemo as $t, reveal as A, guess as At, prop as B, binding as Bt, fillAttrs as C, removeRoot as Ct, fillValue as D, rpc as Dt, fillSpread as E, handlerProp as Et, content as F, setGlobal as Ft, dynamicNodes as G, get as Gt, component as H, cells as Ht, portalTo as I, storeUpdate as It, memoNow as J, pend as Jt, elementAt as K, isBound as Kt, restRef as L, toStore as Lt, wait as M, consumeContext as Mt, attr as N, consumeStore as Nt, keepValue as O, spread as Ot, attrs as P, provideValue as Pt, setItem as Q, timed as Qt, text as R, updateRoute as Rt, countLoads as S, skew as Sn, remount as St, fillSettled as T, handle as Tt, componentNodes as U, effect as Ut, spreadProps as V, bindings as Vt, dynamic as W, gate as Wt, readMemo as X, resolve as Xt, place as Y, pending as Yt, renderMemo as Z, set as Zt, rekey as _, DEVTOOLS as _n, dispose as _t, addPortal as a, templateCall as an, keep as at, after as b, rpcPrefix as bn, leavePage as bt, setVar as c, createScope as cn, markBlock as ct, windowList as d, makeId as dn, setAttr as dt, update as en, appendText as et, windowStart as f, removeScope as fn, setAttrText as ft, offscreen as g, loadModule as gn, template as gt, held as h, nameComment as hn, setSpread as ht, addHead as i, insert as in, fillList as it, started as j, track as jt, loading as k, submitAction as kt, list as l, descendants as ln, nodes as lt, fill as m, sink as mn, setOn as mt, paramEffect as n, fail as nn, clone as nt, addStyle as o, title as on, keepText as ot, branch as p, setOwner as pn, setContent as pt, foreignNodes as q, memo as qt, searchParam as r, children as rn, fillBranch as rt, deferInBrowser as s, afterInsert as sn, listNodes as st, loader as t, updated as tn, branchNodes as tt, toList as u, getScope as un, putText as ut, reset as v, build as vn, forget as vt, fillPend as w, action as wt, attempt as x, scopes as xn, leaveRoutes as xt, retag as y, hooks as yn, init as yt, writeText as z, asyncMemo as zt };
4660
4743
 
4661
- //# sourceMappingURL=client-B0FXW5Kw.js.map
4744
+ //# sourceMappingURL=client-CwVcmymi.js.map