marko 6.3.48 → 6.3.49

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 (54) hide show
  1. package/dist/common/constants/resume-symbol.d.ts +1 -0
  2. package/dist/debug/dom/catch.feat.js +1 -1
  3. package/dist/debug/dom/catch.feat.mjs +1 -1
  4. package/dist/debug/dom/controllable-input.feat.js +1 -1
  5. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  6. package/dist/debug/dom/controllable-open.feat.js +1 -1
  7. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-select.feat.js +1 -1
  9. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable.feat.js +1 -1
  13. package/dist/debug/dom/controllable.feat.mjs +1 -1
  14. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  15. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  16. package/dist/debug/dom/placeholder.feat.js +1 -1
  17. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  18. package/dist/debug/{dom-CA_HiiES.js → dom-BAGeiafn.js} +25 -17
  19. package/dist/debug/{dom-DBMLPLeE.mjs → dom-C55iHvof.mjs} +25 -17
  20. package/dist/debug/dom.js +1 -1
  21. package/dist/debug/dom.mjs +1 -1
  22. package/dist/debug/html.js +76 -37
  23. package/dist/debug/html.mjs +76 -37
  24. package/dist/dom/catch.feat.js +1 -1
  25. package/dist/dom/catch.feat.mjs +1 -1
  26. package/dist/dom/controllable-input.feat.js +1 -1
  27. package/dist/dom/controllable-input.feat.mjs +1 -1
  28. package/dist/dom/controllable-open.feat.js +1 -1
  29. package/dist/dom/controllable-open.feat.mjs +1 -1
  30. package/dist/dom/controllable-select.feat.js +1 -1
  31. package/dist/dom/controllable-select.feat.mjs +1 -1
  32. package/dist/dom/controllable-textarea.feat.js +1 -1
  33. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  34. package/dist/dom/controllable.feat.js +1 -1
  35. package/dist/dom/controllable.feat.mjs +1 -1
  36. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  37. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  38. package/dist/dom/placeholder.feat.js +1 -1
  39. package/dist/dom/placeholder.feat.mjs +1 -1
  40. package/dist/{dom-BfydlrCq.js → dom-BNmfm4st.js} +15 -15
  41. package/dist/{dom-UwNQ-AXt.mjs → dom-BsAS26Ze.mjs} +15 -15
  42. package/dist/dom.js +1 -1
  43. package/dist/dom.mjs +1 -1
  44. package/dist/html/inlined-runtimes.d.ts +2 -2
  45. package/dist/html/inlined-runtimes.debug.d.ts +2 -2
  46. package/dist/html/writer.d.ts +3 -1
  47. package/dist/html.js +46 -36
  48. package/dist/html.mjs +46 -36
  49. package/dist/translator/index.js +108 -82
  50. package/dist/translator/util/get-compile-stage.d.ts +2 -0
  51. package/dist/translator/util/references.d.ts +4 -2
  52. package/dist/translator/util/sections.d.ts +4 -1
  53. package/dist/translator/util/serialize-reasons.d.ts +3 -2
  54. package/package.json +4 -4
@@ -26,7 +26,6 @@ const ControlledHandler = "ControlledHandler:";
26
26
  const ControlledType = "ControlledType:";
27
27
  const ControlledValue = "ControlledValue:";
28
28
  const EventAttributes = "EventAttributes:";
29
- const BranchAccessor = "#BranchAccessor";
30
29
  const CatchContent = "#CatchContent";
31
30
  const ClosestBranchId = "#ClosestBranchId";
32
31
  const LoopKey = "#LoopKey";
@@ -1848,11 +1847,16 @@ const WALKER_RUNTIME_CODE = `((runtimeId) => (self[runtimeId] ||= (
1848
1847
  x() {},
1849
1848
  w(node, op, id) {
1850
1849
  while ((node = walker.nextNode())) {
1850
+ // Only reorder markers ("#", "!") are ever looked up, so only they are
1851
+ // kept: the lookup lives as long as the page, and every node marker
1852
+ // would otherwise stay referenced in it after resume consumed it.
1851
1853
  doc.x(
1852
1854
  (op =
1853
1855
  (op = node.data) &&
1854
1856
  !op.indexOf(prefix) &&
1855
- ((lookup[(id = op.slice(prefixLen + 1))] = node), op[prefixLen])),
1857
+ ((id = op.slice(prefixLen + 1)),
1858
+ (op = op[prefixLen]) > "#" || (lookup[id] = node),
1859
+ op)),
1856
1860
  id,
1857
1861
  node,
1858
1862
  );
@@ -1896,6 +1900,7 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
1896
1900
  (placeholderRoot = placeholders[id] =
1897
1901
  {
1898
1902
  i: runtime.l[id] ? 1 : 2,
1903
+ r: id,
1899
1904
  // Resume may still walk markers inside the dropped placeholder, so
1900
1905
  // park it in any detached parent (a bare <t> clone is the cheapest).
1901
1906
  c(start = runtime.l["^" + id], removed = node.cloneNode()) {
@@ -1911,6 +1916,9 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
1911
1916
  replace(id, node);
1912
1917
  },
1913
1918
  });
1919
+ // Opens the chunk's visits for resume to parent to the root's branch; the
1920
+ // walk that this chunk's own script triggers closes it.
1921
+ runtime.v.push({ data: runtime.i + "*" + placeholder.r });
1914
1922
  // repurpose "op" for callbacks ...carefully
1915
1923
  if ((op = runtime.j[id])) {
1916
1924
  placeholderCb = placeholder.c;
@@ -1981,8 +1989,8 @@ const kIsAsync = Symbol("Is Async");
1981
1989
  function isInResumedBranch() {
1982
1990
  return $chunk?.context?.[kBranchId] !== void 0;
1983
1991
  }
1984
- function withBranchId(branchId, cb) {
1985
- return withContext(kBranchId, branchId, cb);
1992
+ function withBranchId(branchId, cb, cbValue) {
1993
+ return withContext(kBranchId, branchId, cb, cbValue);
1986
1994
  }
1987
1995
  function withIsAsync(cb, value) {
1988
1996
  return withContext(kIsAsync, true, cb, value);
@@ -1993,8 +2001,8 @@ function _html(html) {
1993
2001
  function writeScript(script) {
1994
2002
  $chunk.writeScript(script);
1995
2003
  }
1996
- function _script(scopeId, registryId) {
1997
- if ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync]) _resume_branch(scopeId);
2004
+ function _script(scopeId, registryId, serializeMarker) {
2005
+ if (serializeMarker === 0 && ($chunk.serializeState.readyId || $chunk.context?.[kIsAsync])) _resume_branch(scopeId);
1998
2006
  $chunk.boundary.state.needsMainRuntime = true;
1999
2007
  $chunk.writeEffect(scopeId, registryId);
2000
2008
  }
@@ -2184,6 +2192,7 @@ let writeScope = (scopeId, partialScope) => {
2184
2192
  const scope = scopeWithId(state, scopeId);
2185
2193
  const pending = target.writeScopes[scopeId];
2186
2194
  state.needsMainRuntime = true;
2195
+ countResumeWrite($chunk.boundary);
2187
2196
  Object.assign(scope, partialScope);
2188
2197
  if (pending && pending !== partialScope) Object.assign(pending, partialScope);
2189
2198
  else target.writeScopes[scopeId] = partialScope;
@@ -2255,7 +2264,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
2255
2264
  if (resumeMarker) {
2256
2265
  const branchId = _peek_scope_id();
2257
2266
  $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
2258
- content(promise);
2267
+ withBranchId(branchId, content, promise);
2259
2268
  $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
2260
2269
  } else content(promise);
2261
2270
  return;
@@ -2277,7 +2286,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
2277
2286
  if (resumeMarker) {
2278
2287
  const branchId = _peek_scope_id();
2279
2288
  $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
2280
- withIsAsync(content, value);
2289
+ withBranchId(branchId, () => withIsAsync(content, value));
2281
2290
  $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
2282
2291
  } else withIsAsync(content, value);
2283
2292
  });
@@ -2294,16 +2303,19 @@ function _try(scopeId, accessor, content, input) {
2294
2303
  const placeholderContent = normalizeDynamicRenderer(input.placeholder);
2295
2304
  const placeholderBranchId = placeholderContent ? _scope_id() : 0;
2296
2305
  const branchId = _peek_scope_id();
2297
- $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
2298
- if (catchContent !== void 0) tryCatch(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent || (() => {}));
2299
- else if (placeholderContent) tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId);
2300
- else content();
2301
- writeScope(branchId, {
2302
- [BranchAccessor]: accessor,
2303
- [CatchContent]: catchContent,
2304
- [PlaceholderContent]: placeholderContent
2305
- });
2306
- $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
2306
+ const chunk = $chunk;
2307
+ const { boundary } = chunk;
2308
+ const { state } = boundary;
2309
+ const { resumeWrites } = boundary;
2310
+ const beforeBranch = deferBranchStart(chunk);
2311
+ let renderersAtSettle = false;
2312
+ if (catchContent !== void 0 || placeholderContent) renderersAtSettle = tryBoundary(placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId, scopeId, placeholderBranchId) : content, catchContent, placeholderContent, branchId);
2313
+ else withBranchId(branchId, content);
2314
+ const rendered = chunk !== $chunk || boundary.resumeWrites !== resumeWrites;
2315
+ applyBranchStart(chunk, beforeBranch, rendered);
2316
+ if (!rendered) return;
2317
+ if (!renderersAtSettle) writeTryRenderers(branchId, catchContent, placeholderContent);
2318
+ $chunk.writeHTML(state.mark("]", scopeId + " " + accessor + " " + branchId));
2307
2319
  }
2308
2320
  function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
2309
2321
  const chunk = $chunk;
@@ -2322,31 +2334,39 @@ function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBran
2322
2334
  placeholderBranchId
2323
2335
  };
2324
2336
  }
2325
- function tryCatch(content, catchContent) {
2337
+ function tryBoundary(content, catchContent, placeholderContent, branchId) {
2326
2338
  const chunk = $chunk;
2327
2339
  const { boundary } = chunk;
2328
2340
  const { state } = boundary;
2329
2341
  const catchBoundary = new Boundary(state, boundary.signal, boundary);
2330
2342
  const body = chunk.fork(catchBoundary, null);
2331
- const bodyEnd = body.render(content);
2343
+ const bodyEnd = withBranchId(branchId, () => body.render(content));
2332
2344
  if (catchBoundary.signal.aborted) {
2333
- catchContent(catchBoundary.signal.reason);
2334
- return;
2345
+ if (catchContent === void 0) boundary.abort(catchBoundary.signal.reason);
2346
+ else if (catchContent) catchContent(catchBoundary.signal.reason);
2347
+ return false;
2335
2348
  }
2336
2349
  if (body === bodyEnd) {
2337
2350
  chunk.append(body);
2338
- return;
2351
+ return false;
2339
2352
  }
2340
- const reorderId = state.nextReorderId();
2341
- const endMarker = state.mark("!", reorderId);
2342
- const bodyNext = bodyEnd.next = $chunk = body.fork(boundary, chunk.next);
2353
+ const renderersAtSettle = !catchBoundary.resumeWrites;
2354
+ const bodyNext = bodyEnd.next = $chunk = chunk.fork(boundary, chunk.next);
2343
2355
  chunk.next = body;
2344
- chunk.writeHTML(state.mark("!^", reorderId));
2345
- bodyEnd.writeHTML(endMarker);
2346
2356
  boundary.startAsync();
2357
+ const reorderId = catchContent === void 0 ? "" : state.nextReorderId();
2358
+ const endMarker = reorderId && state.mark("!", reorderId);
2359
+ if (reorderId) {
2360
+ chunk.writeHTML(state.mark("!^", reorderId));
2361
+ bodyEnd.writeHTML(endMarker);
2362
+ }
2347
2363
  catchBoundary.onNext = () => {
2348
2364
  if (boundary.signal.aborted) return;
2349
2365
  if (catchBoundary.signal.aborted) {
2366
+ if (!reorderId) {
2367
+ boundary.abort(catchBoundary.signal.reason);
2368
+ return;
2369
+ }
2350
2370
  if (!bodyEnd.consumed) {
2351
2371
  let cur = body;
2352
2372
  let writeMarker = true;
@@ -2366,15 +2386,28 @@ function tryCatch(content, catchContent) {
2366
2386
  } while (cur !== bodyNext);
2367
2387
  }
2368
2388
  const catchChunk = chunk.fork(boundary, null);
2389
+ const { resumeWrites } = boundary;
2369
2390
  catchChunk.reorderId = reorderId;
2370
- catchChunk.render(catchContent, catchBoundary.signal.reason);
2391
+ if ((catchChunk.render(catchContent || NOOP$2, catchBoundary.signal.reason) !== catchChunk || boundary.resumeWrites !== resumeWrites) && renderersAtSettle) catchChunk.render(() => writeTryRenderers(branchId, catchContent, placeholderContent));
2371
2392
  state.reorder(catchChunk);
2372
2393
  boundary.endAsync();
2373
- } else if (!catchBoundary.count) boundary.endAsync();
2374
- else boundary.onNext();
2394
+ } else if (!catchBoundary.count) {
2395
+ if (renderersAtSettle && catchBoundary.resumeWrites) bodyEnd.render(() => writeTryRenderers(branchId, catchContent, placeholderContent));
2396
+ boundary.endAsync();
2397
+ } else boundary.onNext();
2375
2398
  };
2399
+ return renderersAtSettle;
2400
+ }
2401
+ function writeTryRenderers(branchId, catchContent, placeholderContent) {
2402
+ writeScope(branchId, {
2403
+ [CatchContent]: catchContent,
2404
+ [PlaceholderContent]: placeholderContent
2405
+ });
2376
2406
  }
2377
2407
  const NOOP$2 = () => {};
2408
+ function countResumeWrite(boundary) {
2409
+ for (; boundary; boundary = boundary.parent) boundary.resumeWrites++;
2410
+ }
2378
2411
  var State = class {
2379
2412
  tagId = 1;
2380
2413
  scopeId = 1;
@@ -2442,6 +2475,7 @@ var State = class {
2442
2475
  var Boundary = class extends AbortController {
2443
2476
  onNext = NOOP$2;
2444
2477
  count = 0;
2478
+ resumeWrites = 0;
2445
2479
  state;
2446
2480
  parent;
2447
2481
  constructor(state, signal, parent) {
@@ -2500,6 +2534,7 @@ var Chunk = class Chunk {
2500
2534
  this.html += html;
2501
2535
  }
2502
2536
  writeEffect(scopeId, registryId) {
2537
+ countResumeWrite(this.boundary);
2503
2538
  if (this.lastEffect === registryId) this.effects += " " + scopeId;
2504
2539
  else {
2505
2540
  this.lastEffect = registryId;
@@ -2658,6 +2693,8 @@ var Chunk = class Chunk {
2658
2693
  needsWalk = true;
2659
2694
  state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"";
2660
2695
  }
2696
+ let reordered = "";
2697
+ let needsResumeArray = false;
2661
2698
  if (state.writeReorders) {
2662
2699
  let carried = null;
2663
2700
  for (const reorderedChunk of state.writeReorders) {
@@ -2701,14 +2738,11 @@ var Chunk = class Chunk {
2701
2738
  else break;
2702
2739
  }
2703
2740
  if (reorderEffects) {
2704
- if (!state.hasWrittenResume) {
2705
- state.hasWrittenResume = true;
2706
- scripts = concatScripts(scripts, runtimePrefix + ".r=[]");
2707
- }
2741
+ needsResumeArray = true;
2708
2742
  reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")");
2709
2743
  }
2710
- for (const reservation of readyReservations) scripts = concatScripts(scripts, reservation);
2711
- scripts = concatScripts(scripts, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}");
2744
+ for (const reservation of readyReservations) reordered = concatScripts(reordered, reservation);
2745
+ reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}");
2712
2746
  html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
2713
2747
  }
2714
2748
  state.writeReorders = carried;
@@ -2719,6 +2753,11 @@ var Chunk = class Chunk {
2719
2753
  state.hasWrittenResume = true;
2720
2754
  scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]");
2721
2755
  }
2756
+ else if (needsResumeArray && !state.hasWrittenResume) {
2757
+ state.hasWrittenResume = true;
2758
+ scripts = concatScripts(scripts, runtimePrefix + ".r=[]");
2759
+ }
2760
+ scripts = concatScripts(scripts, reordered);
2722
2761
  if (needsWalk) scripts = concatScripts(scripts, runtimePrefix + ".w()");
2723
2762
  this.html = html;
2724
2763
  this.scripts = scripts;
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-BfydlrCq.js"), handlePendingTry = (fn, scope, branch) => {
1
+ let require_control_flow = require("../dom-BNmfm4st.js"), handlePendingTry = (fn, scope, branch) => {
2
2
  for (; branch;) {
3
3
  if (branch.O?.i) return (branch.J ||= []).push(fn, scope);
4
4
  branch = branch.N;
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { $t as caughtError, en as installCatch, g as renderCatch, tn as placeholderShown } from "../dom-UwNQ-AXt.mjs";
7
+ import { $t as caughtError, en as installCatch, g as renderCatch, tn as placeholderShown } from "../dom-BsAS26Ze.mjs";
8
8
  //#region src/dom/catch.feat.ts
9
9
  installCatch((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
10
10
  if (checkPending || caughtError.has(effects)) {
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-BfydlrCq.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  require_control_flow.z[0] = require_control_flow.T, require_control_flow.z[1] = require_control_flow.C, require_control_flow.z[2] = require_control_flow.A;
3
3
  //#endregion
@@ -1,3 +1,3 @@
1
- import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-UwNQ-AXt.mjs";
1
+ import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
2
2
  controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-BfydlrCq.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  require_control_flow.z[4] = require_control_flow.y;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-UwNQ-AXt.mjs";
1
+ import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-BfydlrCq.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  require_control_flow.z[3] = require_control_flow.N;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { N as _attr_select_value_script, z as controllableScripts } from "../dom-UwNQ-AXt.mjs";
1
+ import { N as _attr_select_value_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-BfydlrCq.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  require_control_flow.z[2] = require_control_flow.A;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { A as _attr_input_value_script, z as controllableScripts } from "../dom-UwNQ-AXt.mjs";
1
+ import { A as _attr_input_value_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-BfydlrCq.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.R.INPUT = require_control_flow.P, require_control_flow.R.TEXTAREA = require_control_flow.L, require_control_flow.R.SELECT = require_control_flow.I, require_control_flow.R.DETAILS = require_control_flow.R.DIALOG = require_control_flow.F;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-UwNQ-AXt.mjs";
1
+ import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-BsAS26Ze.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-BfydlrCq.js"), elementGetter = (branch) => () => branch.S;
1
+ let require_control_flow = require("../dom-BNmfm4st.js"), elementGetter = (branch) => () => branch.S;
2
2
  require_control_flow.m((branch) => branch.T(elementGetter(branch))), require_control_flow.gt("_e", elementGetter);
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
1
  let elementGetter = (branch) => () => branch.S;
2
- import { gt as _resume, m as installDynamicTagVar } from "../dom-UwNQ-AXt.mjs";
2
+ import { gt as _resume, m as installDynamicTagVar } from "../dom-BsAS26Ze.mjs";
3
3
  installDynamicTagVar((branch) => branch.T(elementGetter(branch))), _resume("_e", elementGetter);
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-BfydlrCq.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  //#region src/dom/placeholder.feat.ts
3
3
  require_control_flow.Ct._f = (tryBranch) => {
4
4
  tryBranch.P &&= (require_control_flow.Kt(tryBranch.P), 0);
@@ -1,4 +1,4 @@
1
- import { Ct as registeredValues, Kt as destroyBranch } from "../dom-UwNQ-AXt.mjs";
1
+ import { Ct as registeredValues, Kt as destroyBranch } from "../dom-BsAS26Ze.mjs";
2
2
  //#region src/dom/placeholder.feat.ts
3
3
  registeredValues._f = (tryBranch) => {
4
4
  tryBranch.P &&= (destroyBranch(tryBranch.P), 0);
@@ -534,34 +534,34 @@ function init(runtimeId = "M") {
534
534
  if (curRenders) return;
535
535
  let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
536
536
  defineRuntime({ value: curRenders = ((renderId) => {
537
- let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
537
+ let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
538
538
  runtimeId,
539
539
  renderId
540
- }, initScope = (scope) => (scope.H = 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
540
+ }, initScope = (scope) => (scope.H ??= 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
541
541
  let scopeId = partials[0];
542
542
  for (let i = 1; i < partials.length; i++) {
543
543
  let partial = partials[i];
544
544
  typeof partial == "number" ? scopeId += partial : (scopeId ? initScope(Object.assign(scopeLookup[scopeId] ||= (partial.L = scopeId, partial), partial)) : Object.assign(initGlobal(), partial), scopeId++);
545
545
  }
546
- }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], orphanBranches = [], deferredOwners = [], curBranchScopes) => (branchId, branch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, j = deferredOwners.length) => {
547
- for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + lastToken, singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
546
+ }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope.F === scope ? scope !== branch && setParentBranch(scope, branch) : scope.F = branch) => (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
547
+ if (visitType === "*") {
548
+ for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
549
+ (reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
550
+ return;
551
+ }
552
+ for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
548
553
  if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
549
554
  for (; startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling););
550
555
  branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
551
- } else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
552
- for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
553
- for (; j && deferredOwners[j - 1].L > branchId;) {
554
- j--;
555
- let owner = deferredOwners.pop();
556
- owner.F !== owner && (owner.F = branch);
557
- }
556
+ } else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
557
+ for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
558
558
  nextToken();
559
559
  }
560
560
  if (endedBranches) {
561
- for (let ended of endedBranches) orphanBranches.push(ended);
561
+ for (let ended of endedBranches) pending.push(ended);
562
562
  singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
563
563
  }
564
- visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : deferredOwners.push(visitScope);
564
+ visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
565
565
  }, nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
566
566
  let i = 0;
567
567
  for (; i < resumes.length; i++) {
@@ -586,8 +586,8 @@ function init(runtimeId = "M") {
586
586
  }
587
587
  }
588
588
  let retained = 0;
589
- for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : visitScope[nextToken()] = visitType === "$" ? visit.previousSibling : visit.parentNode.insertBefore(new Text(), visit);
590
- return embedRenders && !embedAnchor && visit && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
589
+ for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : (visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope));
590
+ return branchesEnabled && visitBranches && (visitType = "*", lastToken = "", visitBranches()), embedRenders && !embedAnchor && visit?.parentNode && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
591
591
  }, render.w = () => {
592
592
  walk(), runResumeEffects(render);
593
593
  }, render;
@@ -534,34 +534,34 @@ function init(runtimeId = "M") {
534
534
  if (curRenders) return;
535
535
  let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
536
536
  defineRuntime({ value: curRenders = ((renderId) => {
537
- let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
537
+ let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
538
538
  runtimeId,
539
539
  renderId
540
- }, initScope = (scope) => (scope.H = 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
540
+ }, initScope = (scope) => (scope.H ??= 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
541
541
  let scopeId = partials[0];
542
542
  for (let i = 1; i < partials.length; i++) {
543
543
  let partial = partials[i];
544
544
  typeof partial == "number" ? scopeId += partial : (scopeId ? initScope(Object.assign(scopeLookup[scopeId] ||= (partial.L = scopeId, partial), partial)) : Object.assign(initGlobal(), partial), scopeId++);
545
545
  }
546
- }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], orphanBranches = [], deferredOwners = [], curBranchScopes) => (branchId, branch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, j = deferredOwners.length) => {
547
- for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + lastToken, singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
546
+ }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope.F === scope ? scope !== branch && setParentBranch(scope, branch) : scope.F = branch) => (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
547
+ if (visitType === "*") {
548
+ for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
549
+ (reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
550
+ return;
551
+ }
552
+ for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
548
553
  if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
549
554
  for (; startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling););
550
555
  branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
551
- } else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
552
- for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
553
- for (; j && deferredOwners[j - 1].L > branchId;) {
554
- j--;
555
- let owner = deferredOwners.pop();
556
- owner.F !== owner && (owner.F = branch);
557
- }
556
+ } else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
557
+ for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
558
558
  nextToken();
559
559
  }
560
560
  if (endedBranches) {
561
- for (let ended of endedBranches) orphanBranches.push(ended);
561
+ for (let ended of endedBranches) pending.push(ended);
562
562
  singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
563
563
  }
564
- visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : deferredOwners.push(visitScope);
564
+ visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
565
565
  }, nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
566
566
  let i = 0;
567
567
  for (; i < resumes.length; i++) {
@@ -586,8 +586,8 @@ function init(runtimeId = "M") {
586
586
  }
587
587
  }
588
588
  let retained = 0;
589
- for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : visitScope[nextToken()] = visitType === "$" ? visit.previousSibling : visit.parentNode.insertBefore(new Text(), visit);
590
- return embedRenders && !embedAnchor && visit && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
589
+ for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : (visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope));
590
+ return branchesEnabled && visitBranches && (visitType = "*", lastToken = "", visitBranches()), embedRenders && !embedAnchor && visit?.parentNode && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
591
591
  }, render.w = () => {
592
592
  walk(), runResumeEffects(render);
593
593
  }, render;
package/dist/dom.js CHANGED
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("./dom-BfydlrCq.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
1
+ let require_control_flow = require("./dom-BNmfm4st.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
2
  require_control_flow.yt($global.runtimeId);
3
3
  let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
4
4
  return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
package/dist/dom.mjs CHANGED
@@ -94,7 +94,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
94
94
  };
95
95
  return apply;
96
96
  });
97
- import { $ as _attrs_script, A as _attr_input_value_script, At as _for_closure, B as _attr, Bt as _return, C as _attr_input_checkedValue_script, D as _attr_input_value_attribute_default, Dt as _closure_get, E as _attr_input_value, Et as _closure, F as _controllable_open, Ft as _id, G as _attr_nonce, Gt as _assert_init, H as _attr_class_item, Ht as _script, I as _controllable_select, It as _if_closure, J as _attr_style_items, Jt as removeAndDestroyBranch, K as _attr_style, Kt as destroyBranch, L as _controllable_textarea, Lt as _let, M as _attr_select_value_default, Mt as _global_read, N as _attr_select_value_script, Nt as _hoist, O as _attr_input_value_default, Ot as _const, P as _controllable_input, Pt as _hoist_resume, Q as _attrs_partial_content, Qt as $signalReset, Rt as _let_change, S as _attr_input_checkedValue_default, St as readyFailed, T as _attr_input_checked_script, Tt as _child_setup, U as _attr_class_items, Ut as _var, V as _attr_class, Vt as _return_change, W as _attr_content, Wt as _var_change, X as _attrs_content, Xt as _on, Y as _attrs, Yt as syncGen, Z as _attrs_partial, Zt as $signal, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as queueRender, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as runId, ct as toInsertNode, d as _show, dn as forTo, dt as _content_resume, et as _html, f as _try, fn as forUntil, ft as createAndSetupBranch, g as renderCatch, gn as decodeAccessor, gt as _resume, h as patchDynamicTag, hn as _call, ht as _el, i as _dynamic_tag_content, in as queueEffect, it as _text, j as _attr_select_value, jt as _for_selector, k as _attr_input_value_dynamic_default, kt as _el_read, l as _if, ln as forIn, lt as _content, mn as _hoist_read_error, mt as setupBranch, n as _await_promise, nn as prepareEffects, nt as _style_rule_item, o as _for_of, on as run, ot as _to_text, p as addAwaitCounter, pn as _assert_hoist, pt as createBranch, q as _attr_style_item, qt as insertBranchBefore, r as _dynamic_tag, rn as queueAsyncRender, rt as _style_shell, s as _for_to, sn as runEffects, st as insertChildNodes, t as _await_content, tt as _lifecycle, u as _resume_dynamic_tag, un as forOf, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as withLazy, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _or } from "./dom-UwNQ-AXt.mjs";
97
+ import { $ as _attrs_script, A as _attr_input_value_script, At as _for_closure, B as _attr, Bt as _return, C as _attr_input_checkedValue_script, D as _attr_input_value_attribute_default, Dt as _closure_get, E as _attr_input_value, Et as _closure, F as _controllable_open, Ft as _id, G as _attr_nonce, Gt as _assert_init, H as _attr_class_item, Ht as _script, I as _controllable_select, It as _if_closure, J as _attr_style_items, Jt as removeAndDestroyBranch, K as _attr_style, Kt as destroyBranch, L as _controllable_textarea, Lt as _let, M as _attr_select_value_default, Mt as _global_read, N as _attr_select_value_script, Nt as _hoist, O as _attr_input_value_default, Ot as _const, P as _controllable_input, Pt as _hoist_resume, Q as _attrs_partial_content, Qt as $signalReset, Rt as _let_change, S as _attr_input_checkedValue_default, St as readyFailed, T as _attr_input_checked_script, Tt as _child_setup, U as _attr_class_items, Ut as _var, V as _attr_class, Vt as _return_change, W as _attr_content, Wt as _var_change, X as _attrs_content, Xt as _on, Y as _attrs, Yt as syncGen, Z as _attrs_partial, Zt as $signal, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as queueRender, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as runId, ct as toInsertNode, d as _show, dn as forTo, dt as _content_resume, et as _html, f as _try, fn as forUntil, ft as createAndSetupBranch, g as renderCatch, gn as decodeAccessor, gt as _resume, h as patchDynamicTag, hn as _call, ht as _el, i as _dynamic_tag_content, in as queueEffect, it as _text, j as _attr_select_value, jt as _for_selector, k as _attr_input_value_dynamic_default, kt as _el_read, l as _if, ln as forIn, lt as _content, mn as _hoist_read_error, mt as setupBranch, n as _await_promise, nn as prepareEffects, nt as _style_rule_item, o as _for_of, on as run, ot as _to_text, p as addAwaitCounter, pn as _assert_hoist, pt as createBranch, q as _attr_style_item, qt as insertBranchBefore, r as _dynamic_tag, rn as queueAsyncRender, rt as _style_shell, s as _for_to, sn as runEffects, st as insertChildNodes, t as _await_content, tt as _lifecycle, u as _resume_dynamic_tag, un as forOf, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as withLazy, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _or } from "./dom-BsAS26Ze.mjs";
98
98
  //#region src/common/attr-tag.ts
99
99
  function attrTag(attrs) {
100
100
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
@@ -1,2 +1,2 @@
1
- export declare const WALKER_RUNTIME_CODE = "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))";
2
- export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
1
+ export declare const WALKER_RUNTIME_CODE = "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))";
2
+ export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
@@ -1,2 +1,2 @@
1
- export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n d: doc,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((lookup[(id = op.slice(prefixLen + 1))] = node), op[prefixLen])),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n, self[runtimeId]))";
2
- export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
1
+ export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n d: doc,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n // Only reorder markers (\"#\", \"!\") are ever looked up, so only they are\n // kept: the lookup lives as long as the page, and every node marker\n // would otherwise stay referenced in it after resume consumed it.\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((id = op.slice(prefixLen + 1)),\n (op = op[prefixLen]) > \"#\" || (lookup[id] = node),\n op)),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n, self[runtimeId]))";
2
+ export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n r: id,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // Opens the chunk's visits for resume to parent to the root's branch; the\n // walk that this chunk's own script triggers closes it.\n runtime.v.push({ data: runtime.i + \"*\" + placeholder.r });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
@@ -35,9 +35,10 @@ export declare function withContext<T>(key: PropertyKey, value: unknown, cb: ()
35
35
  export declare function withContext<T, U>(key: PropertyKey, value: unknown, cb: (value: U) => T, cbValue: U): T;
36
36
  export declare function isInResumedBranch(): boolean;
37
37
  export declare function withBranchId<T>(branchId: number, cb: () => T): T;
38
+ export declare function withBranchId<T, U>(branchId: number, cb: (value: U) => T, cbValue: U): T;
38
39
  export declare function _html(html: string): void;
39
40
  export declare function writeScript(script: string): void;
40
- export declare function _script(scopeId: number, registryId: string): void;
41
+ export declare function _script(scopeId: number, registryId: string, serializeMarker?: number): void;
41
42
  export declare function _trailers(html: string): void;
42
43
  export declare function _resume<T extends WeakKey>(val: T, id: string, scopeId?: number): T;
43
44
  export declare function _resume_locals<T extends WeakKey>(val: T, id: string, locals: Record<string, unknown>, ownerScopeId?: number): T;
@@ -126,6 +127,7 @@ export { FlushStatus };
126
127
  export declare class Boundary extends AbortController {
127
128
  onNext: typeof NOOP;
128
129
  count: number;
130
+ resumeWrites: number;
129
131
  state: State;
130
132
  parent?: Boundary;
131
133
  constructor(state: State, signal?: AbortSignal, parent?: Boundary);