marko 6.3.52 → 6.3.54

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 (81) hide show
  1. package/cheatsheet.md +1 -0
  2. package/dist/common/constants/renderer-prop.d.ts +0 -1
  3. package/dist/common/constants/renderer-prop.debug.d.ts +0 -1
  4. package/dist/common/helpers.d.ts +1 -0
  5. package/dist/debug/dom/catch.feat.js +1 -1
  6. package/dist/debug/dom/catch.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-input.feat.js +1 -1
  8. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-open.feat.js +1 -1
  10. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-select.feat.js +1 -1
  12. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable.feat.js +1 -1
  16. package/dist/debug/dom/controllable.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.js +5 -0
  18. package/dist/debug/dom/dynamic-tag-script.feat.mjs +4 -0
  19. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  20. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  21. package/dist/debug/dom/placeholder.feat.js +1 -1
  22. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  23. package/dist/debug/{dom-BJKb8-wr.js → dom-CI0Vojyk.js} +146 -88
  24. package/dist/debug/{dom-Dq_Yu7MS.mjs → dom-tl43c2wO.mjs} +113 -85
  25. package/dist/debug/dom.js +10 -8
  26. package/dist/debug/dom.mjs +7 -8
  27. package/dist/debug/html.js +52 -26
  28. package/dist/debug/html.mjs +52 -26
  29. package/dist/dom/catch.feat.js +4 -4
  30. package/dist/dom/catch.feat.mjs +1 -1
  31. package/dist/dom/control-flow.d.ts +5 -4
  32. package/dist/dom/controllable-input.feat.js +2 -2
  33. package/dist/dom/controllable-input.feat.mjs +1 -1
  34. package/dist/dom/controllable-open.feat.js +2 -2
  35. package/dist/dom/controllable-open.feat.mjs +1 -1
  36. package/dist/dom/controllable-select.feat.js +2 -2
  37. package/dist/dom/controllable-select.feat.mjs +1 -1
  38. package/dist/dom/controllable-textarea.feat.js +2 -2
  39. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  40. package/dist/dom/controllable.feat.js +2 -2
  41. package/dist/dom/controllable.feat.mjs +1 -1
  42. package/dist/dom/dynamic-tag-script.feat.d.ts +1 -0
  43. package/dist/dom/dynamic-tag-script.feat.js +4 -0
  44. package/dist/dom/dynamic-tag-script.feat.mjs +4 -0
  45. package/dist/dom/dynamic-tag-var.feat.js +1 -2
  46. package/dist/dom/dynamic-tag-var.feat.mjs +2 -3
  47. package/dist/dom/load.d.ts +2 -2
  48. package/dist/dom/placeholder.feat.js +3 -3
  49. package/dist/dom/placeholder.feat.mjs +1 -1
  50. package/dist/dom/renderer.d.ts +2 -3
  51. package/dist/dom/resume.d.ts +1 -0
  52. package/dist/dom/signals.d.ts +1 -1
  53. package/dist/{dom-CzfddxCE.mjs → dom-4udEPZaj.mjs} +77 -58
  54. package/dist/{dom-CzGPOsST.js → dom-C1mr-TA7.js} +213 -174
  55. package/dist/dom.d.ts +2 -2
  56. package/dist/dom.js +40 -42
  57. package/dist/dom.mjs +6 -8
  58. package/dist/html/dynamic-tag.d.ts +2 -1
  59. package/dist/html/serializer.d.ts +3 -2
  60. package/dist/html/writer.d.ts +6 -5
  61. package/dist/html.js +35 -20
  62. package/dist/html.mjs +35 -20
  63. package/dist/translator/index.js +2863 -2666
  64. package/dist/translator/util/binding-has-prop.d.ts +1 -0
  65. package/dist/translator/util/branch-tag.d.ts +6 -1
  66. package/dist/translator/util/optional.d.ts +2 -0
  67. package/dist/translator/util/references.d.ts +26 -12
  68. package/dist/translator/util/runtime.d.ts +2 -1
  69. package/dist/translator/util/sections.d.ts +11 -8
  70. package/dist/translator/util/serialize-guard.d.ts +1 -7
  71. package/dist/translator/util/serialize-reasons.d.ts +3 -0
  72. package/dist/translator/util/set-tag-sections-downstream.d.ts +1 -1
  73. package/dist/translator/util/signals.d.ts +4 -1
  74. package/dist/translator/util/structure.d.ts +1 -1
  75. package/dist/translator/util/tag-name-type.d.ts +1 -1
  76. package/dist/translator/visitors/function.d.ts +1 -0
  77. package/dist/translator/visitors/import-declaration.d.ts +1 -0
  78. package/dist/translator/visitors/tag/custom-tag.d.ts +5 -0
  79. package/package.json +4 -4
  80. package/tags/try.d.marko +2 -0
  81. package/tags-html.d.ts +6 -0
@@ -129,6 +129,10 @@ function isEventHandler(name) {
129
129
  function getEventHandlerName(name) {
130
130
  return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
131
131
  }
132
+ function hasKeys(obj) {
133
+ for (const _ in obj) return true;
134
+ return false;
135
+ }
132
136
  function isVoid(value) {
133
137
  return value == null || value === false;
134
138
  }
@@ -631,10 +635,11 @@ var Serializer = class {
631
635
  });
632
636
  }
633
637
  };
634
- function register(id, val, scope) {
638
+ function register(id, val, scope, locals) {
635
639
  REGISTRY.set(val, {
636
640
  id,
637
641
  scope,
642
+ locals,
638
643
  access: "_._" + toAccess(toObjectKey(id))
639
644
  });
640
645
  return val;
@@ -817,6 +822,9 @@ function newScopeReference(state, val, scopeId) {
817
822
  ref.debug = DEBUG.get(val);
818
823
  return ref;
819
824
  }
825
+ function quoteRegisterId(id) {
826
+ return quote(id, 0);
827
+ }
820
828
  function writeRegistered(state, val, parent, accessor, registered) {
821
829
  const { scope } = registered;
822
830
  if (scope) {
@@ -826,7 +834,16 @@ function writeRegistered(state, val, parent, accessor, registered) {
826
834
  ref.debug = DEBUG.get(val);
827
835
  const scopeId = scope[K_SCOPE_ID];
828
836
  trackScope(state, scope, scopeId);
829
- state.buf.push("_(" + scopeId + "," + quote(registered.id, 0) + ")");
837
+ const locals = registered.locals?.(state.boundary.state.scope);
838
+ if (locals) {
839
+ state.buf.push(registered.access + "(_(" + scopeId + ")");
840
+ for (const local of locals) {
841
+ state.buf.push(",");
842
+ if (local) writePlainObject(state, local, new Reference(ref, null, state.flushId, state.buf.length));
843
+ else state.buf.push("0");
844
+ }
845
+ } else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
846
+ state.buf.push(")");
830
847
  } else state.buf.push(registered.access);
831
848
  return true;
832
849
  }
@@ -2018,8 +2035,8 @@ function _script(scopeId, registryId, serializeMarker) {
2018
2035
  function _trailers(html) {
2019
2036
  $chunk.boundary.state.trailerHTML += html;
2020
2037
  }
2021
- function _resume(val, id, scopeId) {
2022
- return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
2038
+ function _resume(val, id, scopeId, locals) {
2039
+ return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId), locals);
2023
2040
  }
2024
2041
  function _resume_locals(val, id, locals, ownerScopeId) {
2025
2042
  if (ownerScopeId !== void 0) locals["_"] = _scope_with_id(ownerScopeId);
@@ -2131,13 +2148,17 @@ function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch,
2131
2148
  }, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
2132
2149
  }
2133
2150
  function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
2134
- var seenKeys = /* @__PURE__ */ new Set();
2135
- if (serializeBranch === 0) {
2136
- if (by) iterate((itemKey, _sameAsIndex, render) => {
2151
+ if (by) {
2152
+ const run = iterate;
2153
+ const seenKeys = /* @__PURE__ */ new Set();
2154
+ iterate = (each) => run((itemKey, sameAsIndex, render) => {
2137
2155
  assertValidLoopKey(itemKey, seenKeys);
2138
- render();
2156
+ if (each) each(itemKey, sameAsIndex, render);
2157
+ else render();
2139
2158
  });
2140
- else iterate(0);
2159
+ }
2160
+ if (serializeBranch === 0) {
2161
+ iterate(0);
2141
2162
  writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, "");
2142
2163
  return;
2143
2164
  }
@@ -2148,7 +2169,6 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
2148
2169
  let loopScopes;
2149
2170
  iterate((itemKey, sameAsIndex, render) => {
2150
2171
  const branchId = _peek_scope_id();
2151
- if (by) assertValidLoopKey(itemKey, seenKeys);
2152
2172
  if (resumeMarker) if (singleNode) flushBranchIds = " " + branchId + flushBranchIds;
2153
2173
  else {
2154
2174
  $chunk.writeHTML(state.mark("[", flushBranchIds));
@@ -2225,17 +2245,18 @@ function scopeWithId(state, scopeId) {
2225
2245
  if (!scope) scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId });
2226
2246
  return scope;
2227
2247
  }
2228
- function _subscribe(subscribers, scope) {
2248
+ function _subscribe(subscribers, scope, resumeId, serializeMarker) {
2229
2249
  if (subscribers) {
2230
2250
  const { serializer } = $chunk.boundary.state;
2231
2251
  if (!$chunk.serializeState.readyId && !serializer.written(subscribers)) subscribers.add(scope);
2252
+ else if (resumeId) _script(scope[K_SCOPE_ID], resumeId, serializeMarker);
2232
2253
  else serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
2233
2254
  }
2234
2255
  return scope;
2235
2256
  }
2236
- const CLIENT_ALL = 715827882;
2257
+ const CLIENT_ALL = 715827883;
2237
2258
  function maskGroup(mask, group) {
2238
- return mask === 715827882 ? 1 : typeof mask === "number" ? mask >>> 1 + 2 * group & 3 : mask[group] ?? 0;
2259
+ return mask === 715827883 ? 1 : typeof mask === "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
2239
2260
  }
2240
2261
  function _set_serialize_reason(reason) {
2241
2262
  $chunk.boundary.state.serializeReason = reason;
@@ -2439,6 +2460,7 @@ var State = class {
2439
2460
  serializer = new Serializer();
2440
2461
  writeReorders = null;
2441
2462
  scopes = /* @__PURE__ */ new Map();
2463
+ scope = (scopeId) => scopeWithId(this, scopeId);
2442
2464
  flushScopes = false;
2443
2465
  writeScopes = {};
2444
2466
  readyIds = null;
@@ -2670,23 +2692,23 @@ var Chunk = class Chunk {
2670
2692
  $chunk = prev;
2671
2693
  }
2672
2694
  }
2673
- flushReadyScripts(reservations) {
2695
+ flushReadyScripts(reservations, holdEffects) {
2674
2696
  const { boundary, serializeState } = this;
2675
2697
  const { readyId } = serializeState;
2676
2698
  let scripts = "";
2677
2699
  forEach(this.takeDeferredReady(), (chunk) => {
2678
- scripts = concatScripts(scripts, chunk.flushReadyScripts(reservations));
2700
+ scripts = concatScripts(scripts, chunk.flushReadyScripts(reservations, holdEffects));
2701
+ if (chunk.effects || chunk.deferredReady) this.deferredReady = push(this.deferredReady, chunk);
2679
2702
  });
2680
2703
  if (readyId && !this.async) {
2681
2704
  const { state } = boundary;
2682
2705
  flushSerializer(boundary, serializeState);
2683
2706
  const deps = state.serializer.takeChannelDeps();
2684
- const { effects } = this;
2707
+ const effects = holdEffects ? "" : this.effects;
2685
2708
  const { resumes } = serializeState;
2686
2709
  const chunkScripts = this.scripts;
2687
- serializeState.resumes = "";
2688
- this.effects = this.scripts = "";
2689
- this.lastEffect = "";
2710
+ serializeState.resumes = this.scripts = "";
2711
+ if (effects) this.effects = this.lastEffect = "";
2690
2712
  if (resumes || effects) {
2691
2713
  state.needsMainRuntime = true;
2692
2714
  const batch = concatSequence(depsMarker(deps), concatSequence(resumes, effects && `"${effects}"`));
@@ -2706,7 +2728,7 @@ var Chunk = class Chunk {
2706
2728
  const { $global, runtimePrefix } = state;
2707
2729
  let needsWalk = state.walkOnNextFlush;
2708
2730
  if (needsWalk) state.walkOnNextFlush = false;
2709
- let readyResumeScripts = this.flushReadyScripts();
2731
+ let readyResumeScripts = this.flushReadyScripts(void 0, this.async);
2710
2732
  for (let channel; channel = state.serializer.pendingReadyChannel();) {
2711
2733
  const resumes = state.serializer.stringifyScopes([], boundary, channel);
2712
2734
  const deps = state.serializer.takeChannelDeps();
@@ -2755,7 +2777,8 @@ var Chunk = class Chunk {
2755
2777
  cur.flushPlaceholder();
2756
2778
  cur.deferOwnReady();
2757
2779
  const { next } = cur;
2758
- const readyResumeScripts = cur.flushReadyScripts(readyReservations);
2780
+ const readyResumeScripts = cur.flushReadyScripts(readyReservations, this.async);
2781
+ this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady());
2759
2782
  cur.consumed = true;
2760
2783
  reorderHTML += cur.html;
2761
2784
  reorderEffects = concatEffects(reorderEffects, cur.effects);
@@ -2769,7 +2792,10 @@ var Chunk = class Chunk {
2769
2792
  if (next) cur = next;
2770
2793
  else break;
2771
2794
  }
2772
- if (reorderEffects) {
2795
+ if (reorderEffects) if (this.async) {
2796
+ this.effects = concatEffects(this.effects, reorderEffects);
2797
+ this.lastEffect = "";
2798
+ } else {
2773
2799
  needsResumeArray = true;
2774
2800
  reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")");
2775
2801
  }
@@ -2829,7 +2855,7 @@ function flushSerializer(boundary, serializeState) {
2829
2855
  for (const key in writeScopes) {
2830
2856
  const scopeId = +key;
2831
2857
  const props = writeScopes[scopeId];
2832
- if (Object.getOwnPropertyNames(props).length) flushes.push([
2858
+ if (hasKeys(props)) flushes.push([
2833
2859
  scopeId,
2834
2860
  state.scopes.get(scopeId),
2835
2861
  props
@@ -3179,7 +3205,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
3179
3205
  if (shouldResume || needsScript) _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
3180
3206
  };
3181
3207
  renderNative();
3182
- result = _el(branchId, DYNAMIC_TAG_VAR_REGISTER_ID);
3208
+ result = _el(scopeId, DYNAMIC_TAG_VAR_REGISTER_ID + accessor);
3183
3209
  } else {
3184
3210
  const chunk = getChunk();
3185
3211
  const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
@@ -3212,8 +3238,8 @@ function _content(id, fn, scopeId) {
3212
3238
  fn[Owner] = scopeId;
3213
3239
  return fn;
3214
3240
  }
3215
- function _content_resume(id, fn, scopeId) {
3216
- return _resume(_content(id, fn, scopeId), id, scopeId);
3241
+ function _content_resume(id, fn, scopeId, locals) {
3242
+ return _resume(_content(id, fn, scopeId), id, scopeId, locals);
3217
3243
  }
3218
3244
  const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
3219
3245
  _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
@@ -127,6 +127,10 @@ function isEventHandler(name) {
127
127
  function getEventHandlerName(name) {
128
128
  return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
129
129
  }
130
+ function hasKeys(obj) {
131
+ for (const _ in obj) return true;
132
+ return false;
133
+ }
130
134
  function isVoid(value) {
131
135
  return value == null || value === false;
132
136
  }
@@ -629,10 +633,11 @@ var Serializer = class {
629
633
  });
630
634
  }
631
635
  };
632
- function register(id, val, scope) {
636
+ function register(id, val, scope, locals) {
633
637
  REGISTRY.set(val, {
634
638
  id,
635
639
  scope,
640
+ locals,
636
641
  access: "_._" + toAccess(toObjectKey(id))
637
642
  });
638
643
  return val;
@@ -815,6 +820,9 @@ function newScopeReference(state, val, scopeId) {
815
820
  ref.debug = DEBUG.get(val);
816
821
  return ref;
817
822
  }
823
+ function quoteRegisterId(id) {
824
+ return quote(id, 0);
825
+ }
818
826
  function writeRegistered(state, val, parent, accessor, registered) {
819
827
  const { scope } = registered;
820
828
  if (scope) {
@@ -824,7 +832,16 @@ function writeRegistered(state, val, parent, accessor, registered) {
824
832
  ref.debug = DEBUG.get(val);
825
833
  const scopeId = scope[K_SCOPE_ID];
826
834
  trackScope(state, scope, scopeId);
827
- state.buf.push("_(" + scopeId + "," + quote(registered.id, 0) + ")");
835
+ const locals = registered.locals?.(state.boundary.state.scope);
836
+ if (locals) {
837
+ state.buf.push(registered.access + "(_(" + scopeId + ")");
838
+ for (const local of locals) {
839
+ state.buf.push(",");
840
+ if (local) writePlainObject(state, local, new Reference(ref, null, state.flushId, state.buf.length));
841
+ else state.buf.push("0");
842
+ }
843
+ } else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
844
+ state.buf.push(")");
828
845
  } else state.buf.push(registered.access);
829
846
  return true;
830
847
  }
@@ -2016,8 +2033,8 @@ function _script(scopeId, registryId, serializeMarker) {
2016
2033
  function _trailers(html) {
2017
2034
  $chunk.boundary.state.trailerHTML += html;
2018
2035
  }
2019
- function _resume(val, id, scopeId) {
2020
- return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
2036
+ function _resume(val, id, scopeId, locals) {
2037
+ return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId), locals);
2021
2038
  }
2022
2039
  function _resume_locals(val, id, locals, ownerScopeId) {
2023
2040
  if (ownerScopeId !== void 0) locals["_"] = _scope_with_id(ownerScopeId);
@@ -2129,13 +2146,17 @@ function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch,
2129
2146
  }, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode);
2130
2147
  }
2131
2148
  function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
2132
- var seenKeys = /* @__PURE__ */ new Set();
2133
- if (serializeBranch === 0) {
2134
- if (by) iterate((itemKey, _sameAsIndex, render) => {
2149
+ if (by) {
2150
+ const run = iterate;
2151
+ const seenKeys = /* @__PURE__ */ new Set();
2152
+ iterate = (each) => run((itemKey, sameAsIndex, render) => {
2135
2153
  assertValidLoopKey(itemKey, seenKeys);
2136
- render();
2154
+ if (each) each(itemKey, sameAsIndex, render);
2155
+ else render();
2137
2156
  });
2138
- else iterate(0);
2157
+ }
2158
+ if (serializeBranch === 0) {
2159
+ iterate(0);
2139
2160
  writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, "");
2140
2161
  return;
2141
2162
  }
@@ -2146,7 +2167,6 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
2146
2167
  let loopScopes;
2147
2168
  iterate((itemKey, sameAsIndex, render) => {
2148
2169
  const branchId = _peek_scope_id();
2149
- if (by) assertValidLoopKey(itemKey, seenKeys);
2150
2170
  if (resumeMarker) if (singleNode) flushBranchIds = " " + branchId + flushBranchIds;
2151
2171
  else {
2152
2172
  $chunk.writeHTML(state.mark("[", flushBranchIds));
@@ -2223,17 +2243,18 @@ function scopeWithId(state, scopeId) {
2223
2243
  if (!scope) scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId });
2224
2244
  return scope;
2225
2245
  }
2226
- function _subscribe(subscribers, scope) {
2246
+ function _subscribe(subscribers, scope, resumeId, serializeMarker) {
2227
2247
  if (subscribers) {
2228
2248
  const { serializer } = $chunk.boundary.state;
2229
2249
  if (!$chunk.serializeState.readyId && !serializer.written(subscribers)) subscribers.add(scope);
2250
+ else if (resumeId) _script(scope[K_SCOPE_ID], resumeId, serializeMarker);
2230
2251
  else serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
2231
2252
  }
2232
2253
  return scope;
2233
2254
  }
2234
- const CLIENT_ALL = 715827882;
2255
+ const CLIENT_ALL = 715827883;
2235
2256
  function maskGroup(mask, group) {
2236
- return mask === 715827882 ? 1 : typeof mask === "number" ? mask >>> 1 + 2 * group & 3 : mask[group] ?? 0;
2257
+ return mask === 715827883 ? 1 : typeof mask === "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
2237
2258
  }
2238
2259
  function _set_serialize_reason(reason) {
2239
2260
  $chunk.boundary.state.serializeReason = reason;
@@ -2437,6 +2458,7 @@ var State = class {
2437
2458
  serializer = new Serializer();
2438
2459
  writeReorders = null;
2439
2460
  scopes = /* @__PURE__ */ new Map();
2461
+ scope = (scopeId) => scopeWithId(this, scopeId);
2440
2462
  flushScopes = false;
2441
2463
  writeScopes = {};
2442
2464
  readyIds = null;
@@ -2668,23 +2690,23 @@ var Chunk = class Chunk {
2668
2690
  $chunk = prev;
2669
2691
  }
2670
2692
  }
2671
- flushReadyScripts(reservations) {
2693
+ flushReadyScripts(reservations, holdEffects) {
2672
2694
  const { boundary, serializeState } = this;
2673
2695
  const { readyId } = serializeState;
2674
2696
  let scripts = "";
2675
2697
  forEach(this.takeDeferredReady(), (chunk) => {
2676
- scripts = concatScripts(scripts, chunk.flushReadyScripts(reservations));
2698
+ scripts = concatScripts(scripts, chunk.flushReadyScripts(reservations, holdEffects));
2699
+ if (chunk.effects || chunk.deferredReady) this.deferredReady = push(this.deferredReady, chunk);
2677
2700
  });
2678
2701
  if (readyId && !this.async) {
2679
2702
  const { state } = boundary;
2680
2703
  flushSerializer(boundary, serializeState);
2681
2704
  const deps = state.serializer.takeChannelDeps();
2682
- const { effects } = this;
2705
+ const effects = holdEffects ? "" : this.effects;
2683
2706
  const { resumes } = serializeState;
2684
2707
  const chunkScripts = this.scripts;
2685
- serializeState.resumes = "";
2686
- this.effects = this.scripts = "";
2687
- this.lastEffect = "";
2708
+ serializeState.resumes = this.scripts = "";
2709
+ if (effects) this.effects = this.lastEffect = "";
2688
2710
  if (resumes || effects) {
2689
2711
  state.needsMainRuntime = true;
2690
2712
  const batch = concatSequence(depsMarker(deps), concatSequence(resumes, effects && `"${effects}"`));
@@ -2704,7 +2726,7 @@ var Chunk = class Chunk {
2704
2726
  const { $global, runtimePrefix } = state;
2705
2727
  let needsWalk = state.walkOnNextFlush;
2706
2728
  if (needsWalk) state.walkOnNextFlush = false;
2707
- let readyResumeScripts = this.flushReadyScripts();
2729
+ let readyResumeScripts = this.flushReadyScripts(void 0, this.async);
2708
2730
  for (let channel; channel = state.serializer.pendingReadyChannel();) {
2709
2731
  const resumes = state.serializer.stringifyScopes([], boundary, channel);
2710
2732
  const deps = state.serializer.takeChannelDeps();
@@ -2753,7 +2775,8 @@ var Chunk = class Chunk {
2753
2775
  cur.flushPlaceholder();
2754
2776
  cur.deferOwnReady();
2755
2777
  const { next } = cur;
2756
- const readyResumeScripts = cur.flushReadyScripts(readyReservations);
2778
+ const readyResumeScripts = cur.flushReadyScripts(readyReservations, this.async);
2779
+ this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady());
2757
2780
  cur.consumed = true;
2758
2781
  reorderHTML += cur.html;
2759
2782
  reorderEffects = concatEffects(reorderEffects, cur.effects);
@@ -2767,7 +2790,10 @@ var Chunk = class Chunk {
2767
2790
  if (next) cur = next;
2768
2791
  else break;
2769
2792
  }
2770
- if (reorderEffects) {
2793
+ if (reorderEffects) if (this.async) {
2794
+ this.effects = concatEffects(this.effects, reorderEffects);
2795
+ this.lastEffect = "";
2796
+ } else {
2771
2797
  needsResumeArray = true;
2772
2798
  reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")");
2773
2799
  }
@@ -2827,7 +2853,7 @@ function flushSerializer(boundary, serializeState) {
2827
2853
  for (const key in writeScopes) {
2828
2854
  const scopeId = +key;
2829
2855
  const props = writeScopes[scopeId];
2830
- if (Object.getOwnPropertyNames(props).length) flushes.push([
2856
+ if (hasKeys(props)) flushes.push([
2831
2857
  scopeId,
2832
2858
  state.scopes.get(scopeId),
2833
2859
  props
@@ -3177,7 +3203,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
3177
3203
  if (shouldResume || needsScript) _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
3178
3204
  };
3179
3205
  renderNative();
3180
- result = _el(branchId, DYNAMIC_TAG_VAR_REGISTER_ID);
3206
+ result = _el(scopeId, DYNAMIC_TAG_VAR_REGISTER_ID + accessor);
3181
3207
  } else {
3182
3208
  const chunk = getChunk();
3183
3209
  const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
@@ -3210,8 +3236,8 @@ function _content(id, fn, scopeId) {
3210
3236
  fn[Owner] = scopeId;
3211
3237
  return fn;
3212
3238
  }
3213
- function _content_resume(id, fn, scopeId) {
3214
- return _resume(_content(id, fn, scopeId), id, scopeId);
3239
+ function _content_resume(id, fn, scopeId, locals) {
3240
+ return _resume(_content(id, fn, scopeId), id, scopeId, locals);
3215
3241
  }
3216
3242
  const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
3217
3243
  _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
@@ -1,12 +1,12 @@
1
- let require_control_flow = require("../dom-CzGPOsST.js"), handlePendingTry = (fn, scope, branch) => {
1
+ let require_control_flow = require("../dom-C1mr-TA7.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;
5
5
  }
6
6
  };
7
7
  //#region src/dom/catch.feat.ts
8
- require_control_flow.$t((runEffects) => (effects, checkPending = require_control_flow.en.has(effects)) => {
9
- if (checkPending || require_control_flow.Qt.has(effects)) {
8
+ require_control_flow.rn((runEffects) => (effects, checkPending = require_control_flow.in.has(effects)) => {
9
+ if (checkPending || require_control_flow.nn.has(effects)) {
10
10
  let i = 0, fn, scope, branch;
11
11
  for (; i < effects.length;) fn = effects[i++], scope = effects[i++], (branch = scope.F)?.H !== 0 && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope);
12
12
  } else runEffects(effects);
@@ -19,7 +19,7 @@ require_control_flow.$t((runEffects) => (effects, checkPending = require_control
19
19
  }
20
20
  render.f = 0, runRender(render);
21
21
  } catch (error) {
22
- require_control_flow.g(render.b, error);
22
+ require_control_flow.y(render.b, error);
23
23
  }
24
24
  });
25
25
  //#endregion
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { $t as installCatch, Qt as caughtError, en as placeholderShown, g as renderCatch } from "../dom-CzfddxCE.mjs";
7
+ import { in as placeholderShown, nn as caughtError, rn as installCatch, y as renderCatch } from "../dom-4udEPZaj.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,7 +1,7 @@
1
1
  import { type Accessor, AccessorProp, type AwaitCounter, type BranchScope, type EncodedAccessor, type Scope } from "../common/types";
2
2
  import { type Renderer, type SetupFn } from "./renderer";
3
3
  import { type Signal } from "./signals";
4
- export declare function _await_promise(nodeAccessor: EncodedAccessor, params?: Signal<unknown>): (scope: Scope, promise: Promise<unknown>) => void;
4
+ export declare function _await_promise(nodeAccessor: EncodedAccessor, params?: Signal<unknown>): (scope: Scope, promise: unknown) => unknown;
5
5
  export declare function _await_content(nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0): (scope: Scope) => void;
6
6
  export declare function addAwaitCounter(scope: Scope, tryBranch?: BranchScope | undefined): AwaitCounter | undefined;
7
7
  export declare function _try(nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0): (scope: Scope, input: {
@@ -17,11 +17,12 @@ export declare let _dynamic_tag: (nodeAccessor: EncodedAccessor, getContent?: ((
17
17
  export declare const _dynamic_tag_content: (nodeAccessor: EncodedAccessor) => Signal<Renderer | undefined>;
18
18
  export declare let bindNativeTagVar: undefined | ((branch: Scope) => void);
19
19
  export declare function installDynamicTagVar(bind: typeof bindNativeTagVar): void;
20
- export declare const _resume_dynamic_tag: () => typeof dynamicTagScript;
21
- declare function dynamicTagScript(branch: Scope): void;
20
+ export declare function dynamicTagScript(branch: Scope): void;
22
21
  export declare function setConditionalRenderer<T>(scope: Scope, nodeAccessor: Accessor, newRenderer: T, createBranch: ($global: Scope[typeof AccessorProp.Global], renderer: NonNullable<T>, parentScope: Scope, parentNode: ParentNode) => BranchScope): void;
23
22
  export declare const _for_of: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [all: unknown[], by?: ((item: unknown, index: number) => unknown) | undefined]) => void;
24
23
  export declare const _for_in: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [obj: {}, by?: ((key: string, v: unknown) => unknown) | undefined]) => void;
25
24
  export declare const _for_to: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [to: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
26
25
  export declare const _for_until: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [until: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
27
- export {};
26
+ export declare const _for_of_unkeyed: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [all: unknown[]]) => void;
27
+ export declare const _for_to_unkeyed: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [to: number, from: number, step: number]) => void;
28
+ export declare const _for_until_unkeyed: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [until: number, from: number, step: number]) => void;
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-CzGPOsST.js");
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;
1
+ let require_control_flow = require("../dom-C1mr-TA7.js");
2
+ require_control_flow.H[0] = require_control_flow.O, require_control_flow.H[1] = require_control_flow.E, require_control_flow.H[2] = require_control_flow.N;
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-CzfddxCE.mjs";
1
+ import { E as _attr_input_checkedValue_script, H as controllableScripts, N as _attr_input_value_script, O as _attr_input_checked_script } from "../dom-4udEPZaj.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-CzGPOsST.js");
1
+ let require_control_flow = require("../dom-C1mr-TA7.js");
2
2
  //#region src/dom/controllable-open.feat.ts
3
- require_control_flow.z[4] = require_control_flow.y;
3
+ require_control_flow.H[4] = require_control_flow.S;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-CzfddxCE.mjs";
1
+ import { H as controllableScripts, S as _attr_details_or_dialog_open_script } from "../dom-4udEPZaj.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-CzGPOsST.js");
1
+ let require_control_flow = require("../dom-C1mr-TA7.js");
2
2
  //#region src/dom/controllable-select.feat.ts
3
- require_control_flow.z[3] = require_control_flow.N;
3
+ require_control_flow.H[3] = require_control_flow.I;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { N as _attr_select_value_script, z as controllableScripts } from "../dom-CzfddxCE.mjs";
1
+ import { H as controllableScripts, I as _attr_select_value_script } from "../dom-4udEPZaj.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-CzGPOsST.js");
1
+ let require_control_flow = require("../dom-C1mr-TA7.js");
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
- require_control_flow.z[2] = require_control_flow.A;
3
+ require_control_flow.H[2] = require_control_flow.N;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { A as _attr_input_value_script, z as controllableScripts } from "../dom-CzfddxCE.mjs";
1
+ import { H as controllableScripts, N as _attr_input_value_script } from "../dom-4udEPZaj.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-CzGPOsST.js");
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;
1
+ let require_control_flow = require("../dom-C1mr-TA7.js");
2
+ require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.V.INPUT = require_control_flow.L, require_control_flow.V.TEXTAREA = require_control_flow.B, require_control_flow.V.SELECT = require_control_flow.z, require_control_flow.V.DETAILS = require_control_flow.V.DIALOG = require_control_flow.R;
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-CzfddxCE.mjs";
1
+ import { B as _controllable_textarea, L as _controllable_input, R as _controllable_open, V as controllableRenders, z as _controllable_select } from "../dom-4udEPZaj.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ let require_control_flow = require("../dom-C1mr-TA7.js");
2
+ //#region src/dom/dynamic-tag-script.feat.ts
3
+ require_control_flow.bt._d = require_control_flow.yn(require_control_flow.g);
4
+ //#endregion
@@ -0,0 +1,4 @@
1
+ import { bt as _resumed, g as dynamicTagScript, yn as withBranches } from "../dom-4udEPZaj.mjs";
2
+ //#region src/dom/dynamic-tag-script.feat.ts
3
+ _resumed._d = withBranches(dynamicTagScript);
4
+ //#endregion
@@ -1,4 +1,3 @@
1
- let require_control_flow = require("../dom-CzGPOsST.js"), elementGetter = require_control_flow.gt._e = (branch) => () => branch.S;
2
1
  //#region src/dom/dynamic-tag-var.feat.ts
3
- require_control_flow.m((branch) => branch.T(elementGetter(branch)));
2
+ require("../dom-C1mr-TA7.js")._((branch) => branch.T(() => branch.S));
4
3
  //#endregion
@@ -1,5 +1,4 @@
1
- let elementGetter = _resumed._e = (branch) => () => branch.S;
2
- import { gt as _resumed, m as installDynamicTagVar } from "../dom-CzfddxCE.mjs";
1
+ import { _ as installDynamicTagVar } from "../dom-4udEPZaj.mjs";
3
2
  //#region src/dom/dynamic-tag-var.feat.ts
4
- installDynamicTagVar((branch) => branch.T(elementGetter(branch)));
3
+ installDynamicTagVar((branch) => branch.T(() => branch.S));
5
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { type EncodedAccessor, type Scope, type Template } from "../common/types";
1
+ import { type BranchScope, type Scope, type Template } from "../common/types";
2
2
  import { type Renderer, type SetupFn } from "./renderer";
3
3
  import type { Signal } from "./signals";
4
4
  interface LoadModule {
@@ -11,7 +11,7 @@ export interface LoadTrigger {
11
11
  <T>(load: () => Promise<T>): () => Promise<T>;
12
12
  }
13
13
  export declare const _load_template: (id: string, load: () => Promise<Renderer>) => Template & Renderer;
14
- export declare const _load_setup: (nodeAccessor: EncodedAccessor, childScopeAccessor: EncodedAccessor, load: () => Promise<LoadModule>) => (owner: Scope) => void;
14
+ export declare const _load_setup: (load: () => Promise<LoadModule>) => (owner: Scope, child: BranchScope, marker: ChildNode) => void;
15
15
  export declare const _load_signal: (load: () => Promise<LoadSignal>) => Signal;
16
16
  export declare function _load_visible_trigger(selector: string, options?: IntersectionObserverInit): LoadTrigger;
17
17
  export declare function _load_idle_trigger(options?: {
@@ -1,6 +1,6 @@
1
- let require_control_flow = require("../dom-CzGPOsST.js");
1
+ let require_control_flow = require("../dom-C1mr-TA7.js");
2
2
  //#region src/dom/placeholder.feat.ts
3
- require_control_flow.gt._f = (tryBranch) => {
4
- tryBranch.P &&= (require_control_flow.Gt(tryBranch.P), 0);
3
+ require_control_flow.bt._f = (tryBranch) => {
4
+ tryBranch.P &&= (require_control_flow.Yt(tryBranch.P), 0);
5
5
  };
6
6
  //#endregion
@@ -1,4 +1,4 @@
1
- import { Gt as destroyBranch, gt as _resumed } from "../dom-CzfddxCE.mjs";
1
+ import { Yt as destroyBranch, bt as _resumed } from "../dom-4udEPZaj.mjs";
2
2
  //#region src/dom/placeholder.feat.ts
3
3
  _resumed._f = (tryBranch) => {
4
4
  tryBranch.P &&= (destroyBranch(tryBranch.P), 0);
@@ -7,8 +7,7 @@ export type Renderer = {
7
7
  [RendererProp.Params]: Signal<unknown> | undefined;
8
8
  [RendererProp.Owner]: Scope | undefined;
9
9
  [RendererProp.Accessor]: Accessor | undefined;
10
- [RendererProp.LocalClosures]?: Record<Accessor, Signal<unknown>>;
11
- [RendererProp.LocalClosureValues]?: Record<Accessor, unknown>;
10
+ [RendererProp.LocalClosures]?: SetupFn;
12
11
  };
13
12
  export type SetupFn = (scope: Scope) => void;
14
13
  export declare function createBranch($global: Scope[typeof AccessorProp.Global], renderer: Renderer | string, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
@@ -18,5 +17,5 @@ export declare function setupBranch(renderer: Renderer, branch: BranchScope): Br
18
17
  export declare function _content(id: string, template?: string | 0, walks?: string | 0, setup?: {
19
18
  _: Signal<unknown>;
20
19
  } | SetupFn | 0, params?: Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
21
- export declare function _content_resume(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
20
+ export declare function _content_resume(renderer: (owner?: Scope, localValues?: Record<Accessor, unknown>) => Renderer, hasLocalValues?: number): (owner: Scope, ...values: Scope[]) => Renderer;
22
21
  export declare function _content_closures(renderer: ReturnType<typeof _content>, closureFns: Record<Accessor, SignalFn>): (owner: Scope, closureValues: Record<Accessor, unknown>) => Renderer;