marko 6.4.8 → 6.4.10

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 (93) hide show
  1. package/cheatsheet.md +1 -1
  2. package/dist/common/constants/closure-signal-prop.d.ts +1 -1
  3. package/dist/common/constants/closure-signal-prop.debug.d.ts +1 -1
  4. package/dist/debug/dom/catch.feat.js +2 -3
  5. package/dist/debug/dom/catch.feat.mjs +2 -3
  6. package/dist/debug/dom/controllable-input.feat.js +2 -3
  7. package/dist/debug/dom/controllable-input.feat.mjs +2 -3
  8. package/dist/debug/dom/controllable-open.feat.js +2 -3
  9. package/dist/debug/dom/controllable-open.feat.mjs +2 -3
  10. package/dist/debug/dom/controllable-select.feat.js +2 -3
  11. package/dist/debug/dom/controllable-select.feat.mjs +2 -3
  12. package/dist/debug/dom/controllable-textarea.feat.js +2 -3
  13. package/dist/debug/dom/controllable-textarea.feat.mjs +2 -3
  14. package/dist/debug/dom/controllable.feat.js +2 -3
  15. package/dist/debug/dom/controllable.feat.mjs +2 -3
  16. package/dist/debug/dom/dynamic-tag-script.feat.js +2 -3
  17. package/dist/debug/dom/dynamic-tag-script.feat.mjs +2 -3
  18. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  19. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  20. package/dist/debug/dom/lazy.feat.js +2 -3
  21. package/dist/debug/dom/lazy.feat.mjs +2 -3
  22. package/dist/debug/dom/placeholder.feat.js +2 -3
  23. package/dist/debug/dom/placeholder.feat.mjs +2 -3
  24. package/dist/debug/{dom-CFCBDift.mjs → dom-C1V5vpFs.mjs} +60 -98
  25. package/dist/debug/{dom-D8znnhpf.js → dom-DNB5yq3U.js} +59 -109
  26. package/dist/debug/dom.js +9 -14
  27. package/dist/debug/dom.mjs +9 -14
  28. package/dist/debug/html.js +39 -51
  29. package/dist/debug/html.mjs +37 -49
  30. package/dist/dom/catch.feat.js +4 -5
  31. package/dist/dom/catch.feat.mjs +2 -3
  32. package/dist/dom/compat.d.ts +1 -1
  33. package/dist/dom/control-flow.d.ts +1 -1
  34. package/dist/dom/controllable-input.feat.js +1 -2
  35. package/dist/dom/controllable-input.feat.mjs +1 -2
  36. package/dist/dom/controllable-open.feat.js +2 -3
  37. package/dist/dom/controllable-open.feat.mjs +2 -3
  38. package/dist/dom/controllable-select.feat.js +2 -3
  39. package/dist/dom/controllable-select.feat.mjs +2 -3
  40. package/dist/dom/controllable-textarea.feat.js +2 -3
  41. package/dist/dom/controllable-textarea.feat.mjs +2 -3
  42. package/dist/dom/controllable.feat.js +1 -2
  43. package/dist/dom/controllable.feat.mjs +1 -2
  44. package/dist/dom/dom.d.ts +2 -3
  45. package/dist/dom/dynamic-tag-script.feat.js +3 -4
  46. package/dist/dom/dynamic-tag-script.feat.mjs +2 -3
  47. package/dist/dom/dynamic-tag-var.feat.js +3 -4
  48. package/dist/dom/dynamic-tag-var.feat.mjs +1 -2
  49. package/dist/dom/lazy.feat.js +2 -3
  50. package/dist/dom/lazy.feat.mjs +2 -3
  51. package/dist/dom/placeholder.feat.js +4 -5
  52. package/dist/dom/placeholder.feat.mjs +2 -3
  53. package/dist/dom/resume.d.ts +1 -1
  54. package/dist/dom/scope.d.ts +1 -1
  55. package/dist/dom/signals.d.ts +1 -1
  56. package/dist/{dom-Bpkm72vV.js → dom-C2-Flitp.js} +122 -166
  57. package/dist/{dom-CVAevsbz.mjs → dom-DsHYWMCR.mjs} +59 -94
  58. package/dist/dom.js +36 -40
  59. package/dist/dom.mjs +9 -14
  60. package/dist/html/serializer.d.ts +1 -1
  61. package/dist/html/writer.d.ts +3 -3
  62. package/dist/html.d.ts +1 -1
  63. package/dist/html.js +60 -74
  64. package/dist/html.mjs +60 -75
  65. package/dist/translator/core/show.d.ts +3 -4
  66. package/dist/translator/index.js +1193 -1295
  67. package/dist/translator/util/assert.d.ts +9 -2
  68. package/dist/translator/util/bindings.d.ts +6 -5
  69. package/dist/translator/util/branch-tag.d.ts +1 -1
  70. package/dist/translator/util/constants/slot-kind.d.ts +1 -1
  71. package/dist/translator/util/known-tag.d.ts +3 -0
  72. package/dist/translator/util/module-registrations.d.ts +1 -1
  73. package/dist/translator/util/optional.d.ts +1 -0
  74. package/dist/translator/util/params-tree.d.ts +3 -3
  75. package/dist/translator/util/reasons.d.ts +2 -2
  76. package/dist/translator/util/references.d.ts +13 -10
  77. package/dist/translator/util/replace-with-statements.d.ts +4 -0
  78. package/dist/translator/util/runtime.d.ts +1 -0
  79. package/dist/translator/util/scope-accessor.d.ts +1 -1
  80. package/dist/translator/util/sections.d.ts +38 -14
  81. package/dist/translator/util/signals.d.ts +3 -11
  82. package/dist/translator/util/slots.d.ts +1 -1
  83. package/dist/translator/util/solve-reasons.d.ts +5 -0
  84. package/dist/translator/util/sources.d.ts +1 -1
  85. package/dist/translator/util/static-text.d.ts +1 -0
  86. package/dist/translator/util/structure.d.ts +3 -2
  87. package/dist/translator/util/tag-import.d.ts +0 -2
  88. package/dist/translator/util/tag-name-type.d.ts +3 -0
  89. package/dist/translator/util/write-guard.d.ts +2 -0
  90. package/dist/translator/visitors/placeholder.d.ts +4 -4
  91. package/package.json +6 -6
  92. package/tags/lifecycle.d.marko +2 -0
  93. package/dist/translator/visitors/constants/sibling-text.d.ts +0 -6
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- //#region src/common/attr-tag.ts
3
+ // src/common/attr-tag.ts
4
4
  const empty = [];
5
5
  const rest = Symbol("Attribute Tag");
6
6
  function attrTag(attrs) {
@@ -20,8 +20,7 @@ function* attrTagIterator() {
20
20
  yield this;
21
21
  yield* this[rest];
22
22
  }
23
- //#endregion
24
- //#region src/common/constants/accessor-prefix.debug.ts
23
+ // src/common/constants/accessor-prefix.debug.ts
25
24
  const BranchScopes = "BranchScopes:";
26
25
  const ConditionalRenderer = "ConditionalRenderer:";
27
26
  const ControlledHandler = "ControlledHandler:";
@@ -38,8 +37,7 @@ const TagVariable = "#TagVariable";
38
37
  const Owner = "owner";
39
38
  const Embed = "embed";
40
39
  const Lazy = "lazy";
41
- //#endregion
42
- //#region src/common/helpers.ts
40
+ // src/common/helpers.ts
43
41
  const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
44
42
  const knownWrongAttrs = {
45
43
  className: "class",
@@ -156,8 +154,7 @@ function normalizeDynamicRenderer(value) {
156
154
  if ("id" in normalized) return normalized;
157
155
  }
158
156
  }
159
- //#endregion
160
- //#region src/common/errors.ts
157
+ // src/common/errors.ts
161
158
  const lowercaseOnAttrReg = /^on[a-z]/;
162
159
  function assertValidAttrValue(name, value) {
163
160
  if (value && typeof value !== "string" && lowercaseOnAttrReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
@@ -275,13 +272,11 @@ function joinWithAnd(a) {
275
272
  default: return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
276
273
  }
277
274
  }
278
- //#endregion
279
- //#region src/common/meta.ts
275
+ // src/common/meta.ts
280
276
  const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
281
277
  const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
282
278
  const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
283
- //#endregion
284
- //#region src/common/opt.ts
279
+ // src/common/opt.ts
285
280
  function reduce(opt, cb, acc) {
286
281
  if (opt) {
287
282
  if (Array.isArray(opt)) for (const item of opt) acc = cb(acc, item);
@@ -302,8 +297,7 @@ function concat(opt, other) {
302
297
  }
303
298
  return Array.isArray(other) ? [opt, ...other] : [opt, other];
304
299
  }
305
- //#endregion
306
- //#region src/html/serializer.ts
300
+ // src/html/serializer.ts
307
301
  const K_SCOPE_ID = Symbol("Scope ID");
308
302
  const kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator");
309
303
  const { hasOwnProperty } = {};
@@ -600,7 +594,7 @@ var State$1 = class {
600
594
  this.buf.push(",");
601
595
  writePlainObject(this, local, newArgReference(this, ref, local));
602
596
  }
603
- } else this.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
597
+ } else this.buf.push("_(" + scopeId + "," + quoteRegistryId(registered.id));
604
598
  this.buf.push(")");
605
599
  }
606
600
  };
@@ -864,7 +858,7 @@ function newScopeReference(state, val, scopeId) {
864
858
  ref.debug = DEBUG.get(val);
865
859
  return ref;
866
860
  }
867
- function quoteRegisterId(id) {
861
+ function quoteRegistryId(id) {
868
862
  return quote(id, 0);
869
863
  }
870
864
  function writeRegistered(state, val, parent, accessor, registered) {
@@ -1842,8 +1836,7 @@ function patchIteratorNext(proto) {
1842
1836
  };
1843
1837
  proto.next[kTouchedIterator] = true;
1844
1838
  }
1845
- //#endregion
1846
- //#region src/html/attrs.ts
1839
+ // src/html/attrs.ts
1847
1840
  function _attr_class(value) {
1848
1841
  return stringAttr("class", toDelimitedString(value, " ", stringifyClassEntry));
1849
1842
  }
@@ -2075,8 +2068,7 @@ function normalizedValueMatches(a, b) {
2075
2068
  function normalizeStrAttrValue(value) {
2076
2069
  return isNotNullishOrFalse(value) && value !== true ? value + "" : "";
2077
2070
  }
2078
- //#endregion
2079
- //#region src/html/inlined-runtimes.debug.ts
2071
+ // src/html/inlined-runtimes.debug.ts
2080
2072
  const WALKER_RUNTIME_CODE = `((runtimeId) => (self[runtimeId] ||= (
2081
2073
  renderId,
2082
2074
  prefix = runtimeId + renderId,
@@ -2172,8 +2164,7 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
2172
2164
  }
2173
2165
  };
2174
2166
  })`;
2175
- //#endregion
2176
- //#region src/html/writer.ts
2167
+ // src/html/writer.ts
2177
2168
  let $chunk;
2178
2169
  function getChunk() {
2179
2170
  return $chunk;
@@ -2283,16 +2274,16 @@ function _hoist(scopeId, id) {
2283
2274
  getter[Symbol.iterator] = _hoist_read_error;
2284
2275
  return _resume(getter, id, scopeId);
2285
2276
  }
2286
- function _el_resume(scopeId, accessor, markerGuard) {
2277
+ function _el_mark(scopeId, accessor, markerGuard) {
2287
2278
  if (markerGuard === 0) return "";
2288
2279
  const { state } = $chunk.boundary;
2289
2280
  state.needsWalkerRuntime = true;
2290
2281
  return state.mark("$", scopeId + " " + accessor);
2291
2282
  }
2292
- function _text_resume(scopeId, accessor, val, markerGuard) {
2283
+ function _text_mark(scopeId, accessor, val, markerGuard) {
2293
2284
  return markText(scopeId, accessor, _escape(val), markerGuard);
2294
2285
  }
2295
- function _html_resume(scopeId, accessor, val, markerGuard) {
2286
+ function _html_mark(scopeId, accessor, val, markerGuard) {
2296
2287
  const html = _unescaped(val);
2297
2288
  if (markerGuard === 0 || !~html.indexOf("<")) return markText(scopeId, accessor, html, markerGuard);
2298
2289
  const { state } = $chunk.boundary;
@@ -2837,9 +2828,10 @@ var Chunk = class Chunk {
2837
2828
  }
2838
2829
  if (readyId && !this.async) {
2839
2830
  const { state } = boundary;
2831
+ const effects = holdEffects ? "" : this.effects;
2832
+ if (effects) flushSerializerGlobals(boundary);
2840
2833
  flushSerializer(boundary, channel);
2841
2834
  const deps = takeChannelDeps(state.serializer);
2842
- const effects = holdEffects ? "" : this.effects;
2843
2835
  const { resumes } = channel;
2844
2836
  const chunkScripts = this.scripts;
2845
2837
  channel.resumes = this.scripts = "";
@@ -2881,6 +2873,7 @@ var Chunk = class Chunk {
2881
2873
  scripts = concatScripts(scripts, readyResumeScripts);
2882
2874
  if (effects) {
2883
2875
  needsWalk = true;
2876
+ flushSerializerGlobals(boundary);
2884
2877
  state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"";
2885
2878
  }
2886
2879
  let reordered = "";
@@ -3034,7 +3027,7 @@ function flushSerializer(boundary, channel) {
3034
3027
  ]);
3035
3028
  }
3036
3029
  if (flushes.length || pending) {
3037
- if (channel.readyId && !state.hasWrittenGlobals) flushSerializerGlobals(boundary);
3030
+ if (channel.readyId) flushSerializerGlobals(boundary);
3038
3031
  state.addResumes(channel, stringifyScopes(serializer, flushes, boundary, channel));
3039
3032
  }
3040
3033
  channel.writeScopes = {};
@@ -3044,9 +3037,10 @@ function flushSerializer(boundary, channel) {
3044
3037
  }
3045
3038
  function flushSerializerGlobals(boundary) {
3046
3039
  const { state } = boundary;
3040
+ if (state.hasWrittenGlobals) return;
3041
+ state.hasWrittenGlobals = true;
3047
3042
  const globals = getFilteredGlobals(state.$global);
3048
3043
  if (globals) {
3049
- state.hasWrittenGlobals = true;
3050
3044
  state.needsWalkerRuntime = true;
3051
3045
  state.resumes = concatSequence(state.resumes, stringifyScopes(state.serializer, [[
3052
3046
  0,
@@ -3116,8 +3110,7 @@ function flushTickQueue() {
3116
3110
  });
3117
3111
  }
3118
3112
  }
3119
- //#endregion
3120
- //#region src/html/content.ts
3113
+ // src/html/content.ts
3121
3114
  function _to_text(val) {
3122
3115
  assertValidTextValue(val);
3123
3116
  return val || val === 0 ? val + "" : "";
@@ -3161,8 +3154,7 @@ function _escape_comment(val) {
3161
3154
  assertValidTextValue(val);
3162
3155
  return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
3163
3156
  }
3164
- //#endregion
3165
- //#region src/html/dynamic-tag.ts
3157
+ // src/html/dynamic-tag.ts
3166
3158
  const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
3167
3159
  let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) => {
3168
3160
  const shouldResume = markerGuard !== 0;
@@ -3244,8 +3236,7 @@ const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
3244
3236
  return originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, markerGuard, tagVar);
3245
3237
  };
3246
3238
  })(_dynamic_tag);
3247
- //#endregion
3248
- //#region src/html/template.ts
3239
+ // src/html/template.ts
3249
3240
  const CONSUMED_RESULT_MESSAGE = "Cannot read from a consumed render result";
3250
3241
  const _template = (templateId, renderer, page) => {
3251
3242
  renderer.render = render;
@@ -3509,8 +3500,7 @@ function settle(boundary) {
3509
3500
  boundary.state.$global.signal?.removeEventListener("abort", boundary);
3510
3501
  }
3511
3502
  function NOOP$1() {}
3512
- //#endregion
3513
- //#region src/html/assets.ts
3503
+ // src/html/assets.ts
3514
3504
  const kAssets = Symbol();
3515
3505
  const kHead = Symbol();
3516
3506
  function withLoadAssets(template, id, flush, assetId, triggers) {
@@ -3630,12 +3620,10 @@ function toObjectExpression(options) {
3630
3620
  }
3631
3621
  return result + "}";
3632
3622
  }
3633
- //#endregion
3634
- //#region src/common/compat-meta.ts
3623
+ // src/common/compat-meta.ts
3635
3624
  const SET_SCOPE_REGISTER_ID = "$compat_setScope";
3636
3625
  const RENDER_BODY_ID = "$compat_renderBody";
3637
- //#endregion
3638
- //#region src/common/for.ts
3626
+ // src/common/for.ts
3639
3627
  function forIn(obj, cb) {
3640
3628
  for (const key in obj) cb(key, obj[key]);
3641
3629
  }
@@ -3662,8 +3650,7 @@ function forUntil(until, from, step, cb) {
3662
3650
  const delta = step || 1;
3663
3651
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
3664
3652
  }
3665
- //#endregion
3666
- //#region src/html/for.ts
3653
+ // src/html/for.ts
3667
3654
  function forOfBy(by, item, index) {
3668
3655
  return by ? typeof by === "string" ? item[by] : by(item, index) : index;
3669
3656
  }
@@ -3673,8 +3660,7 @@ function forInBy(by, name, value) {
3673
3660
  function forStepBy(by, index) {
3674
3661
  return by ? by(index) : index;
3675
3662
  }
3676
- //#endregion
3677
- //#region src/html/control-flow.ts
3663
+ // src/html/control-flow.ts
3678
3664
  function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
3679
3665
  if (display) {
3680
3666
  if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
@@ -3787,7 +3773,7 @@ function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentE
3787
3773
  const { state } = $chunk.boundary;
3788
3774
  const mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
3789
3775
  $chunk.writeHTML(mark + endTag);
3790
- } else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
3776
+ } else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
3791
3777
  else $chunk.writeHTML(endTag);
3792
3778
  }
3793
3779
  function _await(scopeId, accessor, promise, content, markerGuard) {
@@ -3954,14 +3940,17 @@ function writeTryRenderers(branchId, catchContent, placeholderContent) {
3954
3940
  [PlaceholderContent]: placeholderContent
3955
3941
  });
3956
3942
  }
3957
- //#endregion
3958
- //#region src/html/compat.ts
3943
+ // src/html/compat.ts
3959
3944
  const K_TAGS_API_STATE = Symbol();
3960
3945
  const COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
3961
3946
  const compat = {
3962
3947
  $global,
3963
3948
  writeLoadAsset,
3964
- fork: _await,
3949
+ fork: ((scopeId, accessor, promise, content) => _await(scopeId, accessor, promise, (value) => {
3950
+ const branchId = _peek_scope_id();
3951
+ content(value);
3952
+ if (_peek_scope_id() === branchId) _scope_id();
3953
+ })),
3965
3954
  write: _html,
3966
3955
  writeScript,
3967
3956
  nextScopeId: _scope_id,
@@ -4162,7 +4151,6 @@ function swapReorders(state, reorders) {
4162
4151
  return writeReorders;
4163
4152
  }
4164
4153
  function NOOP() {}
4165
- //#endregion
4166
4154
  exports.$global = $global;
4167
4155
  exports._assert_class_toggles = _assert_class_toggles;
4168
4156
  exports._assert_hoist = _assert_hoist;
@@ -4198,8 +4186,8 @@ Object.defineProperty(exports, "_dynamic_tag", {
4198
4186
  }
4199
4187
  });
4200
4188
  exports._el = _el;
4189
+ exports._el_mark = _el_mark;
4201
4190
  exports._el_read_error = _el_read_error;
4202
- exports._el_resume = _el_resume;
4203
4191
  exports._escape = _escape;
4204
4192
  exports._escape_comment = _escape_comment;
4205
4193
  exports._escape_script = _escape_script;
@@ -4214,7 +4202,7 @@ exports._for_until = _for_until;
4214
4202
  exports._hoist = _hoist;
4215
4203
  exports._hoist_read_error = _hoist_read_error;
4216
4204
  exports._html = _html;
4217
- exports._html_resume = _html_resume;
4205
+ exports._html_mark = _html_mark;
4218
4206
  exports._id = _id;
4219
4207
  exports._if = _if;
4220
4208
  exports._peek_scope_id = _peek_scope_id;
@@ -4238,7 +4226,7 @@ exports._signal_read_error = _signal_read_error;
4238
4226
  exports._style_html = _style_html;
4239
4227
  exports._subscribe = _subscribe;
4240
4228
  exports._template = _template;
4241
- exports._text_resume = _text_resume;
4229
+ exports._text_mark = _text_mark;
4242
4230
  exports._textarea_value = _textarea_value;
4243
4231
  exports._to_text = _to_text;
4244
4232
  exports._trailers = _trailers;
@@ -1,4 +1,4 @@
1
- //#region src/common/attr-tag.ts
1
+ // src/common/attr-tag.ts
2
2
  const empty = [];
3
3
  const rest = Symbol("Attribute Tag");
4
4
  function attrTag(attrs) {
@@ -18,8 +18,7 @@ function* attrTagIterator() {
18
18
  yield this;
19
19
  yield* this[rest];
20
20
  }
21
- //#endregion
22
- //#region src/common/constants/accessor-prefix.debug.ts
21
+ // src/common/constants/accessor-prefix.debug.ts
23
22
  const BranchScopes = "BranchScopes:";
24
23
  const ConditionalRenderer = "ConditionalRenderer:";
25
24
  const ControlledHandler = "ControlledHandler:";
@@ -36,8 +35,7 @@ const TagVariable = "#TagVariable";
36
35
  const Owner = "owner";
37
36
  const Embed = "embed";
38
37
  const Lazy = "lazy";
39
- //#endregion
40
- //#region src/common/helpers.ts
38
+ // src/common/helpers.ts
41
39
  const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
42
40
  const knownWrongAttrs = {
43
41
  className: "class",
@@ -154,8 +152,7 @@ function normalizeDynamicRenderer(value) {
154
152
  if ("id" in normalized) return normalized;
155
153
  }
156
154
  }
157
- //#endregion
158
- //#region src/common/errors.ts
155
+ // src/common/errors.ts
159
156
  const lowercaseOnAttrReg = /^on[a-z]/;
160
157
  function assertValidAttrValue(name, value) {
161
158
  if (value && typeof value !== "string" && lowercaseOnAttrReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
@@ -273,13 +270,11 @@ function joinWithAnd(a) {
273
270
  default: return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
274
271
  }
275
272
  }
276
- //#endregion
277
- //#region src/common/meta.ts
273
+ // src/common/meta.ts
278
274
  const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
279
275
  const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
280
276
  const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
281
- //#endregion
282
- //#region src/common/opt.ts
277
+ // src/common/opt.ts
283
278
  function reduce(opt, cb, acc) {
284
279
  if (opt) {
285
280
  if (Array.isArray(opt)) for (const item of opt) acc = cb(acc, item);
@@ -300,8 +295,7 @@ function concat(opt, other) {
300
295
  }
301
296
  return Array.isArray(other) ? [opt, ...other] : [opt, other];
302
297
  }
303
- //#endregion
304
- //#region src/html/serializer.ts
298
+ // src/html/serializer.ts
305
299
  const K_SCOPE_ID = Symbol("Scope ID");
306
300
  const kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator");
307
301
  const { hasOwnProperty } = {};
@@ -598,7 +592,7 @@ var State$1 = class {
598
592
  this.buf.push(",");
599
593
  writePlainObject(this, local, newArgReference(this, ref, local));
600
594
  }
601
- } else this.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
595
+ } else this.buf.push("_(" + scopeId + "," + quoteRegistryId(registered.id));
602
596
  this.buf.push(")");
603
597
  }
604
598
  };
@@ -862,7 +856,7 @@ function newScopeReference(state, val, scopeId) {
862
856
  ref.debug = DEBUG.get(val);
863
857
  return ref;
864
858
  }
865
- function quoteRegisterId(id) {
859
+ function quoteRegistryId(id) {
866
860
  return quote(id, 0);
867
861
  }
868
862
  function writeRegistered(state, val, parent, accessor, registered) {
@@ -1840,8 +1834,7 @@ function patchIteratorNext(proto) {
1840
1834
  };
1841
1835
  proto.next[kTouchedIterator] = true;
1842
1836
  }
1843
- //#endregion
1844
- //#region src/html/attrs.ts
1837
+ // src/html/attrs.ts
1845
1838
  function _attr_class(value) {
1846
1839
  return stringAttr("class", toDelimitedString(value, " ", stringifyClassEntry));
1847
1840
  }
@@ -2073,8 +2066,7 @@ function normalizedValueMatches(a, b) {
2073
2066
  function normalizeStrAttrValue(value) {
2074
2067
  return isNotNullishOrFalse(value) && value !== true ? value + "" : "";
2075
2068
  }
2076
- //#endregion
2077
- //#region src/html/inlined-runtimes.debug.ts
2069
+ // src/html/inlined-runtimes.debug.ts
2078
2070
  const WALKER_RUNTIME_CODE = `((runtimeId) => (self[runtimeId] ||= (
2079
2071
  renderId,
2080
2072
  prefix = runtimeId + renderId,
@@ -2170,8 +2162,7 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
2170
2162
  }
2171
2163
  };
2172
2164
  })`;
2173
- //#endregion
2174
- //#region src/html/writer.ts
2165
+ // src/html/writer.ts
2175
2166
  let $chunk;
2176
2167
  function getChunk() {
2177
2168
  return $chunk;
@@ -2281,16 +2272,16 @@ function _hoist(scopeId, id) {
2281
2272
  getter[Symbol.iterator] = _hoist_read_error;
2282
2273
  return _resume(getter, id, scopeId);
2283
2274
  }
2284
- function _el_resume(scopeId, accessor, markerGuard) {
2275
+ function _el_mark(scopeId, accessor, markerGuard) {
2285
2276
  if (markerGuard === 0) return "";
2286
2277
  const { state } = $chunk.boundary;
2287
2278
  state.needsWalkerRuntime = true;
2288
2279
  return state.mark("$", scopeId + " " + accessor);
2289
2280
  }
2290
- function _text_resume(scopeId, accessor, val, markerGuard) {
2281
+ function _text_mark(scopeId, accessor, val, markerGuard) {
2291
2282
  return markText(scopeId, accessor, _escape(val), markerGuard);
2292
2283
  }
2293
- function _html_resume(scopeId, accessor, val, markerGuard) {
2284
+ function _html_mark(scopeId, accessor, val, markerGuard) {
2294
2285
  const html = _unescaped(val);
2295
2286
  if (markerGuard === 0 || !~html.indexOf("<")) return markText(scopeId, accessor, html, markerGuard);
2296
2287
  const { state } = $chunk.boundary;
@@ -2835,9 +2826,10 @@ var Chunk = class Chunk {
2835
2826
  }
2836
2827
  if (readyId && !this.async) {
2837
2828
  const { state } = boundary;
2829
+ const effects = holdEffects ? "" : this.effects;
2830
+ if (effects) flushSerializerGlobals(boundary);
2838
2831
  flushSerializer(boundary, channel);
2839
2832
  const deps = takeChannelDeps(state.serializer);
2840
- const effects = holdEffects ? "" : this.effects;
2841
2833
  const { resumes } = channel;
2842
2834
  const chunkScripts = this.scripts;
2843
2835
  channel.resumes = this.scripts = "";
@@ -2879,6 +2871,7 @@ var Chunk = class Chunk {
2879
2871
  scripts = concatScripts(scripts, readyResumeScripts);
2880
2872
  if (effects) {
2881
2873
  needsWalk = true;
2874
+ flushSerializerGlobals(boundary);
2882
2875
  state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"";
2883
2876
  }
2884
2877
  let reordered = "";
@@ -3032,7 +3025,7 @@ function flushSerializer(boundary, channel) {
3032
3025
  ]);
3033
3026
  }
3034
3027
  if (flushes.length || pending) {
3035
- if (channel.readyId && !state.hasWrittenGlobals) flushSerializerGlobals(boundary);
3028
+ if (channel.readyId) flushSerializerGlobals(boundary);
3036
3029
  state.addResumes(channel, stringifyScopes(serializer, flushes, boundary, channel));
3037
3030
  }
3038
3031
  channel.writeScopes = {};
@@ -3042,9 +3035,10 @@ function flushSerializer(boundary, channel) {
3042
3035
  }
3043
3036
  function flushSerializerGlobals(boundary) {
3044
3037
  const { state } = boundary;
3038
+ if (state.hasWrittenGlobals) return;
3039
+ state.hasWrittenGlobals = true;
3045
3040
  const globals = getFilteredGlobals(state.$global);
3046
3041
  if (globals) {
3047
- state.hasWrittenGlobals = true;
3048
3042
  state.needsWalkerRuntime = true;
3049
3043
  state.resumes = concatSequence(state.resumes, stringifyScopes(state.serializer, [[
3050
3044
  0,
@@ -3114,8 +3108,7 @@ function flushTickQueue() {
3114
3108
  });
3115
3109
  }
3116
3110
  }
3117
- //#endregion
3118
- //#region src/html/content.ts
3111
+ // src/html/content.ts
3119
3112
  function _to_text(val) {
3120
3113
  assertValidTextValue(val);
3121
3114
  return val || val === 0 ? val + "" : "";
@@ -3159,8 +3152,7 @@ function _escape_comment(val) {
3159
3152
  assertValidTextValue(val);
3160
3153
  return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
3161
3154
  }
3162
- //#endregion
3163
- //#region src/html/dynamic-tag.ts
3155
+ // src/html/dynamic-tag.ts
3164
3156
  const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
3165
3157
  let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) => {
3166
3158
  const shouldResume = markerGuard !== 0;
@@ -3242,8 +3234,7 @@ const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
3242
3234
  return originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, markerGuard, tagVar);
3243
3235
  };
3244
3236
  })(_dynamic_tag);
3245
- //#endregion
3246
- //#region src/html/template.ts
3237
+ // src/html/template.ts
3247
3238
  const CONSUMED_RESULT_MESSAGE = "Cannot read from a consumed render result";
3248
3239
  const _template = (templateId, renderer, page) => {
3249
3240
  renderer.render = render;
@@ -3507,8 +3498,7 @@ function settle(boundary) {
3507
3498
  boundary.state.$global.signal?.removeEventListener("abort", boundary);
3508
3499
  }
3509
3500
  function NOOP$1() {}
3510
- //#endregion
3511
- //#region src/html/assets.ts
3501
+ // src/html/assets.ts
3512
3502
  const kAssets = Symbol();
3513
3503
  const kHead = Symbol();
3514
3504
  function withLoadAssets(template, id, flush, assetId, triggers) {
@@ -3628,12 +3618,10 @@ function toObjectExpression(options) {
3628
3618
  }
3629
3619
  return result + "}";
3630
3620
  }
3631
- //#endregion
3632
- //#region src/common/compat-meta.ts
3621
+ // src/common/compat-meta.ts
3633
3622
  const SET_SCOPE_REGISTER_ID = "$compat_setScope";
3634
3623
  const RENDER_BODY_ID = "$compat_renderBody";
3635
- //#endregion
3636
- //#region src/common/for.ts
3624
+ // src/common/for.ts
3637
3625
  function forIn(obj, cb) {
3638
3626
  for (const key in obj) cb(key, obj[key]);
3639
3627
  }
@@ -3660,8 +3648,7 @@ function forUntil(until, from, step, cb) {
3660
3648
  const delta = step || 1;
3661
3649
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
3662
3650
  }
3663
- //#endregion
3664
- //#region src/html/for.ts
3651
+ // src/html/for.ts
3665
3652
  function forOfBy(by, item, index) {
3666
3653
  return by ? typeof by === "string" ? item[by] : by(item, index) : index;
3667
3654
  }
@@ -3671,8 +3658,7 @@ function forInBy(by, name, value) {
3671
3658
  function forStepBy(by, index) {
3672
3659
  return by ? by(index) : index;
3673
3660
  }
3674
- //#endregion
3675
- //#region src/html/control-flow.ts
3661
+ // src/html/control-flow.ts
3676
3662
  function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
3677
3663
  if (display) {
3678
3664
  if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) $chunk.writeHTML($chunk.boundary.state.mark("[", ""));
@@ -3785,7 +3771,7 @@ function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentE
3785
3771
  const { state } = $chunk.boundary;
3786
3772
  const mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
3787
3773
  $chunk.writeHTML(mark + endTag);
3788
- } else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
3774
+ } else if (markerGuard !== 0) $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
3789
3775
  else $chunk.writeHTML(endTag);
3790
3776
  }
3791
3777
  function _await(scopeId, accessor, promise, content, markerGuard) {
@@ -3952,14 +3938,17 @@ function writeTryRenderers(branchId, catchContent, placeholderContent) {
3952
3938
  [PlaceholderContent]: placeholderContent
3953
3939
  });
3954
3940
  }
3955
- //#endregion
3956
- //#region src/html/compat.ts
3941
+ // src/html/compat.ts
3957
3942
  const K_TAGS_API_STATE = Symbol();
3958
3943
  const COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
3959
3944
  const compat = {
3960
3945
  $global,
3961
3946
  writeLoadAsset,
3962
- fork: _await,
3947
+ fork: ((scopeId, accessor, promise, content) => _await(scopeId, accessor, promise, (value) => {
3948
+ const branchId = _peek_scope_id();
3949
+ content(value);
3950
+ if (_peek_scope_id() === branchId) _scope_id();
3951
+ })),
3963
3952
  write: _html,
3964
3953
  writeScript,
3965
3954
  nextScopeId: _scope_id,
@@ -4160,5 +4149,4 @@ function swapReorders(state, reorders) {
4160
4149
  return writeReorders;
4161
4150
  }
4162
4151
  function NOOP() {}
4163
- //#endregion
4164
- export { $global, _assert_class_toggles, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_resume, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _set_scope_reason, _show_end, _show_start, _signal_read_error, _style_html, _subscribe, _template, _text_resume, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
4152
+ export { $global, _assert_class_toggles, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_mark, _el_read_error, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_mark, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _set_scope_reason, _show_end, _show_start, _signal_read_error, _style_html, _subscribe, _template, _text_mark, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-Bpkm72vV.js"), deferToPendingTry = (fn, scope, branch) => {
2
+ let require_control_flow = require("../dom-C2-Flitp.js"), deferToPendingTry = (fn, scope, branch) => {
3
3
  for (; branch;) {
4
- if (branch.O?.i) return (scope.J ||= ((branch.JS ||= (branch.O.m && ((complete) => branch.O.c = (_) => complete() || require_control_flow.cn(branch, require_control_flow.ln, require_control_flow.y))(branch.O.c), [])).push(scope), /* @__PURE__ */ new Set())).add(fn);
4
+ if (branch.O?.i) return (scope.J ||= ((branch.JS ||= (branch.O.m && ((complete) => branch.O.c = (_) => complete() || require_control_flow.on(branch, require_control_flow.sn, require_control_flow.y))(branch.O.c), [])).push(scope), /* @__PURE__ */ new Set())).add(fn);
5
5
  branch = branch.N;
6
6
  }
7
7
  };
8
- //#region src/dom/catch.feat.ts
9
- require_control_flow.on((effects) => {
8
+ // src/dom/catch.feat.ts
9
+ require_control_flow.in((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 && !deferToPendingTry(fn, scope, branch) && fn(scope);
12
12
  }, (runRender) => (render) => {
@@ -21,4 +21,3 @@ require_control_flow.on((effects) => {
21
21
  require_control_flow.v(render.b, error);
22
22
  }
23
23
  });
24
- //#endregion
@@ -4,8 +4,8 @@ let deferToPendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { cn as queueAsyncRender, ln as queueEffect, on as installCatch, v as renderCatch, y as runPendingEffects } from "../dom-CVAevsbz.mjs";
8
- //#region src/dom/catch.feat.ts
7
+ import { in as installCatch, on as queueAsyncRender, sn as queueEffect, v as renderCatch, y as runPendingEffects } from "../dom-DsHYWMCR.mjs";
8
+ // src/dom/catch.feat.ts
9
9
  installCatch((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 && !deferToPendingTry(fn, scope, branch) && fn(scope);
@@ -21,4 +21,3 @@ installCatch((effects) => {
21
21
  renderCatch(render.b, error);
22
22
  }
23
23
  });
24
- //#endregion
@@ -24,5 +24,5 @@ export declare const compat: {
24
24
  startNode: ChildNode;
25
25
  endNode: ChildNode;
26
26
  }): Renderer;
27
- render(out: any, component: any, renderer: Renderer, args: any): Node | undefined;
27
+ render(out: any, component: any, renderer: Renderer, args: any): ChildNode | ParentNode | undefined;
28
28
  };
@@ -8,7 +8,7 @@ export declare function runPendingEffects(tryBranch: BranchScope): void;
8
8
  export declare function _try(nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, placeholderContent?: ReturnType<typeof _content> | 0, catchContent?: ReturnType<typeof _content>): (scope: Scope) => void;
9
9
  export declare function renderCatch(scope: Scope, error?: unknown): void;
10
10
  export declare const _if: (nodeAccessor: EncodedAccessor, ...branchesArgs: (string | SetupFn | 0)[]) => (scope: Scope, newBranch: number) => void;
11
- export declare const _show: (nodeAccessor: EncodedAccessor, startNodeAccessor?: EncodedAccessor, endNodeAccessor?: EncodedAccessor) => (scope: Scope, display: unknown) => void;
11
+ export declare const _show: (nodeAccessor: EncodedAccessor, startNodeAccessor?: EncodedAccessor) => (scope: Scope, display: unknown) => void;
12
12
  export declare function rendererKey(renderer: Renderer | string | undefined): string | Renderer | undefined;
13
13
  export declare function patchDynamicTag(fn: <T extends typeof _dynamic_tag>(cond: T) => T): void;
14
14
  export declare let _dynamic_tag: (nodeAccessor: EncodedAccessor, getContent?: ((scope: Scope) => Renderer) | 0, getTagVar?: (() => (scope: Scope, value?: unknown) => void) | 0, inputIsArgs?: 1) => Signal<Renderer | string | undefined>;
@@ -1,4 +1,3 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-Bpkm72vV.js");
2
+ let require_control_flow = require("../dom-C2-Flitp.js");
3
3
  require_control_flow.H[0] = require_control_flow.k, require_control_flow.H[1] = require_control_flow.D, require_control_flow.H[2] = require_control_flow.P;
4
- //#endregion
@@ -1,3 +1,2 @@
1
- import { D as _attr_input_checkedValue_script, H as controllableScripts, P as _attr_input_value_script, k as _attr_input_checked_script } from "../dom-CVAevsbz.mjs";
1
+ import { D as _attr_input_checkedValue_script, H as controllableScripts, P as _attr_input_value_script, k as _attr_input_checked_script } from "../dom-DsHYWMCR.mjs";
2
2
  controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
3
- //#endregion
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-Bpkm72vV.js");
3
- //#region src/dom/controllable-open.feat.ts
2
+ let require_control_flow = require("../dom-C2-Flitp.js");
3
+ // src/dom/controllable-open.feat.ts
4
4
  require_control_flow.H[4] = require_control_flow.C;
5
- //#endregion
@@ -1,4 +1,3 @@
1
- import { C as _attr_details_or_dialog_open_script, H as controllableScripts } from "../dom-CVAevsbz.mjs";
2
- //#region src/dom/controllable-open.feat.ts
1
+ import { C as _attr_details_or_dialog_open_script, H as controllableScripts } from "../dom-DsHYWMCR.mjs";
2
+ // src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
- //#endregion