marko 6.4.3 → 6.4.5

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 (74) hide show
  1. package/cheatsheet.md +2 -2
  2. package/dist/common/constants/renderer-prop.d.ts +2 -0
  3. package/dist/common/constants/renderer-prop.debug.d.ts +2 -0
  4. package/dist/debug/dom/catch.feat.js +1 -1
  5. package/dist/debug/dom/catch.feat.mjs +1 -1
  6. package/dist/debug/dom/controllable-input.feat.js +1 -1
  7. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-open.feat.js +1 -1
  9. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-select.feat.js +1 -1
  11. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable.feat.js +1 -1
  15. package/dist/debug/dom/controllable.feat.mjs +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.js +5 -1
  19. package/dist/debug/dom/dynamic-tag-var.feat.mjs +5 -1
  20. package/dist/debug/dom/lazy.feat.js +1 -1
  21. package/dist/debug/dom/lazy.feat.mjs +1 -1
  22. package/dist/debug/dom/placeholder.feat.js +1 -1
  23. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  24. package/dist/debug/{dom-uEY0J_H9.mjs → dom-BeY1nGUb.mjs} +15 -12
  25. package/dist/debug/{dom-C7F3yZTh.js → dom-CUxvM4i9.js} +32 -23
  26. package/dist/debug/dom.js +3 -10
  27. package/dist/debug/dom.mjs +3 -10
  28. package/dist/debug/html.js +30 -24
  29. package/dist/debug/html.mjs +30 -24
  30. package/dist/dom/catch.feat.js +4 -4
  31. package/dist/dom/catch.feat.mjs +1 -1
  32. package/dist/dom/control-flow.d.ts +2 -2
  33. package/dist/dom/controllable-input.feat.js +2 -2
  34. package/dist/dom/controllable-input.feat.mjs +1 -1
  35. package/dist/dom/controllable-open.feat.js +2 -2
  36. package/dist/dom/controllable-open.feat.mjs +1 -1
  37. package/dist/dom/controllable-select.feat.js +2 -2
  38. package/dist/dom/controllable-select.feat.mjs +1 -1
  39. package/dist/dom/controllable-textarea.feat.js +2 -2
  40. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  41. package/dist/dom/controllable.feat.js +2 -2
  42. package/dist/dom/controllable.feat.mjs +1 -1
  43. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  44. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  45. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  46. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  47. package/dist/dom/lazy.feat.js +1 -1
  48. package/dist/dom/lazy.feat.mjs +1 -1
  49. package/dist/dom/load.d.ts +0 -1
  50. package/dist/dom/placeholder.feat.js +3 -3
  51. package/dist/dom/placeholder.feat.mjs +1 -1
  52. package/dist/dom/renderer.d.ts +9 -2
  53. package/dist/{dom-DHg9YChM.mjs → dom-DefWmvQB.mjs} +10 -7
  54. package/dist/{dom-CtIT8Mpr.js → dom-Diu8MpmL.js} +124 -126
  55. package/dist/dom.d.ts +2 -2
  56. package/dist/dom.js +31 -37
  57. package/dist/dom.mjs +2 -8
  58. package/dist/html/assets.d.ts +1 -1
  59. package/dist/html/content.d.ts +1 -0
  60. package/dist/html/dynamic-tag.d.ts +1 -1
  61. package/dist/html/template.d.ts +1 -0
  62. package/dist/html.js +12 -11
  63. package/dist/html.mjs +12 -11
  64. package/dist/translator/index.js +202 -109
  65. package/dist/translator/util/entry-builder.d.ts +10 -3
  66. package/dist/translator/util/module-registrations.d.ts +1 -1
  67. package/dist/translator/util/references.d.ts +2 -1
  68. package/dist/translator/util/signals.d.ts +10 -1
  69. package/dist/translator/util/solve-reasons.d.ts +1 -0
  70. package/dist/translator/util/write-guard.d.ts +4 -0
  71. package/dist/translator/visitors/function.d.ts +15 -10
  72. package/dist/translator/visitors/import-declaration.d.ts +3 -4
  73. package/package.json +4 -4
  74. package/tags-html.d.ts +3 -2
@@ -37,6 +37,7 @@ const Renderer = "#Renderer";
37
37
  const TagVariable = "#TagVariable";
38
38
  const Owner = "owner";
39
39
  const Embed = "embed";
40
+ const Lazy = "lazy";
40
41
  //#endregion
41
42
  //#region src/common/helpers.ts
42
43
  const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
@@ -699,19 +700,18 @@ function writeScopesRoot(state, flushes) {
699
700
  const ref = state.refs.get(scope) || newScopeReference(state, scope, scopeId);
700
701
  const openIndex = buf.push("") - 1;
701
702
  if (writeObjectProps(state, flush[2], ref)) {
702
- buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId !== nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{";
703
+ buf[openIndex] = nextSlotId === -1 ? scopeId + ",{" : (scopeId !== nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{";
703
704
  if (fillIndex === -1) fillIndex = openIndex;
704
705
  nextSlotId = scopeId + 1;
705
706
  buf.push("}");
706
707
  } else buf.pop();
707
708
  }
708
- if (nextSlotId !== -1) buf.push("]");
709
709
  let extras = "";
710
710
  if (state.pendingAssignments.size || hasChannelMutations(state)) {
711
711
  extras = ",0)";
712
712
  if (fillIndex !== -1) {
713
- buf[fillIndex] = "_(" + buf[fillIndex];
714
- buf.push(")");
713
+ buf[fillIndex] = "_([" + buf[fillIndex];
714
+ buf.push("])");
715
715
  }
716
716
  writeAssigned(state);
717
717
  }
@@ -719,10 +719,9 @@ function writeScopesRoot(state, flushes) {
719
719
  for (const chunk of buf) result += chunk;
720
720
  result += extras;
721
721
  if (!result) return "";
722
- if (state.wroteUndefined) {
723
- state.wroteUndefined = false;
724
- return "(_,$)=>" + result;
725
- } else return "_=>" + result;
722
+ const arrow = state.wroteUndefined ? "(_,$)=>" : "_=>";
723
+ state.wroteUndefined = false;
724
+ return extras ? arrow + result : arrow + "[" + result + "]";
726
725
  }
727
726
  function writeAssigned(state) {
728
727
  let sep = state.buf.length ? "," : "";
@@ -1853,10 +1852,7 @@ function _attr_option_value(value) {
1853
1852
  const valueAttr = _attr("value", value);
1854
1853
  const selectedValue = getContext(kSelectedValue);
1855
1854
  if (selectedValue !== void 0 && normalizedValueMatches(selectedValue, value)) {
1856
- {
1857
- const matched = getContext(kSelectedValueMatched);
1858
- if (matched) matched.value = true;
1859
- }
1855
+ getContext(kSelectedValueMatched)?.add(normalizeStrAttrValue(value));
1860
1856
  return valueAttr + " selected";
1861
1857
  }
1862
1858
  return valueAttr;
@@ -1868,9 +1864,12 @@ function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content,
1868
1864
  if (content) {
1869
1865
  const selectedValue = value ?? "";
1870
1866
  if (valueChange) {
1871
- const matched = { value: false };
1867
+ const matched = /* @__PURE__ */ new Set();
1872
1868
  withContext(kSelectedValue, selectedValue, () => withContext(kSelectedValueMatched, matched, content));
1873
- if (!matched.value && (Array.isArray(value) ? value.some((v) => normalizeStrAttrValue(v) !== "") : normalizeStrAttrValue(value) !== "")) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
1869
+ if ((Array.isArray(value) ? value : [value]).some((v) => {
1870
+ const str = normalizeStrAttrValue(v);
1871
+ return str !== "" && !matched.has(str);
1872
+ })) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
1874
1873
  } else withContext(kSelectedValue, selectedValue, content);
1875
1874
  }
1876
1875
  }
@@ -3384,11 +3383,14 @@ function _escape(val) {
3384
3383
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
3385
3384
  }
3386
3385
  const unsafeScriptReg = /<(\/?script|!--)/gi;
3387
- const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str;
3386
+ const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\u003C$1") : str;
3388
3387
  function _escape_script(val) {
3389
3388
  assertValidTextValue(val);
3390
3389
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
3391
3390
  }
3391
+ const unsafeScriptTemplateLiteralReg = /[`\\\r]|\$\{|<(?=\/?script|!--)/gi;
3392
+ const replaceUnsafeScriptTemplateLiteral = (c) => c === "<" ? "\\x3C" : c === "\r" ? "\\r" : "\\" + c;
3393
+ const quoteScriptTemplateLiteral = (str) => "`" + (unsafeScriptTemplateLiteralReg.test(str) ? str.replace(unsafeScriptTemplateLiteralReg, replaceUnsafeScriptTemplateLiteral) : str) + "`";
3392
3394
  const unsafeStyleReg = /<(\/style)/gi;
3393
3395
  const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str;
3394
3396
  function _escape_style(val) {
@@ -3411,7 +3413,7 @@ function _escape_comment(val) {
3411
3413
  //#endregion
3412
3414
  //#region src/html/dynamic-tag.ts
3413
3415
  const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
3414
- let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard) => {
3416
+ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) => {
3415
3417
  const shouldResume = markerGuard !== 0;
3416
3418
  const renderer = normalizeDynamicRenderer(tag);
3417
3419
  const state = getState();
@@ -3448,6 +3450,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, m
3448
3450
  renderNative();
3449
3451
  result = _el(scopeId, DYNAMIC_TAG_VAR_REGISTER_ID + accessor);
3450
3452
  } else {
3453
+ if (tagVar && renderer?.["lazy"]) throw new Error(`A dynamic tag with a [tag variable](https://markojs.com/docs/reference/language#tag-variables) rendered \`${renderer["id"]}\`, which is lazily loaded, so it does not support one. Import it without \`load\`, or remove the variable.`);
3451
3454
  const chunk = getChunk();
3452
3455
  const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
3453
3456
  const render = () => {
@@ -3460,7 +3463,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, m
3460
3463
  } finally {
3461
3464
  _set_scope_reason(void 0);
3462
3465
  }
3463
- else if (content) return content();
3466
+ else if (content) content();
3464
3467
  };
3465
3468
  result = shouldResume ? withBranchId(branchId, render) : render();
3466
3469
  rendered = _peek_scope_id() !== branchId;
@@ -3484,10 +3487,10 @@ function _content_resume(id, fn, scopeId, locals) {
3484
3487
  return _resume(_content(id, fn, scopeId), id, scopeId, locals);
3485
3488
  }
3486
3489
  const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
3487
- _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
3490
+ _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume, tagVar) => {
3488
3491
  const patched = patch(tag, scopeId, accessor);
3489
3492
  if (patched !== tag) patched["id"] = tag;
3490
- return originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
3493
+ return originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume, tagVar);
3491
3494
  };
3492
3495
  })(_dynamic_tag);
3493
3496
  //#endregion
@@ -3760,10 +3763,13 @@ function NOOP$1() {}
3760
3763
  const kAssets = Symbol();
3761
3764
  const kHead = Symbol();
3762
3765
  function withLoadAssets(renderer, flush, assetId, triggers) {
3763
- return Object.assign((input) => {
3766
+ return register(renderer["id"], Object.assign((input) => {
3764
3767
  writeLoadAsset(assetId, flush, triggers);
3765
3768
  return writeWaitReady(assetId, renderer, input);
3766
- }, renderer);
3769
+ }, {
3770
+ ...renderer,
3771
+ [Lazy]: 1
3772
+ }));
3767
3773
  }
3768
3774
  function writeLoadAsset(assetId, flush, triggers) {
3769
3775
  const g = $global();
@@ -3812,7 +3818,7 @@ function writeAsset(g, asset) {
3812
3818
  if (g[kHead] || g.__flush__ !== flushPage) {
3813
3819
  const block = blockHTML(g, asset);
3814
3820
  _html(block + (asset.triggers ? "" : deferHTML(g, asset)));
3815
- if (block && isInResumedBranch()) writeScript(`document.head.insertAdjacentHTML("beforeend",${_escape_script(JSON.stringify(block))})`);
3821
+ if (block && isInResumedBranch()) writeScript(`document.head.insertAdjacentHTML("beforeend",${quoteScriptTemplateLiteral(block)})`);
3816
3822
  asset.htmlAt = catchableBoundary();
3817
3823
  }
3818
3824
  }
@@ -3848,8 +3854,8 @@ function addAsset(g, id, flush, triggers) {
3848
3854
  return asset;
3849
3855
  }
3850
3856
  function triggerScript(id, html, triggers) {
3851
- const htmlStr = _escape_script(JSON.stringify(html));
3852
- const insert = `(d=new Range().createContextualFragment(h),d.querySelectorAll("script").forEach(s=>s.onerror=()=>console.error(${_escape_script(JSON.stringify(`The lazy module for "${id}" failed to load; its server-rendered content cannot become interactive.`))})),document.head.append(d))`;
3857
+ const htmlStr = quoteScriptTemplateLiteral(html);
3858
+ const insert = `(d=new Range().createContextualFragment(h),d.querySelectorAll("script").forEach(s=>s.onerror=()=>console.error(${quoteScriptTemplateLiteral(`The lazy module for "${id}" failed to load; its server-rendered content cannot become interactive.`)})),document.head.append(d))`;
3853
3859
  const exprs = triggers.map((trigger) => {
3854
3860
  const options = trigger.options && toObjectExpression(trigger.options);
3855
3861
  switch (trigger.type) {
@@ -35,6 +35,7 @@ const Renderer = "#Renderer";
35
35
  const TagVariable = "#TagVariable";
36
36
  const Owner = "owner";
37
37
  const Embed = "embed";
38
+ const Lazy = "lazy";
38
39
  //#endregion
39
40
  //#region src/common/helpers.ts
40
41
  const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
@@ -697,19 +698,18 @@ function writeScopesRoot(state, flushes) {
697
698
  const ref = state.refs.get(scope) || newScopeReference(state, scope, scopeId);
698
699
  const openIndex = buf.push("") - 1;
699
700
  if (writeObjectProps(state, flush[2], ref)) {
700
- buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId !== nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{";
701
+ buf[openIndex] = nextSlotId === -1 ? scopeId + ",{" : (scopeId !== nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{";
701
702
  if (fillIndex === -1) fillIndex = openIndex;
702
703
  nextSlotId = scopeId + 1;
703
704
  buf.push("}");
704
705
  } else buf.pop();
705
706
  }
706
- if (nextSlotId !== -1) buf.push("]");
707
707
  let extras = "";
708
708
  if (state.pendingAssignments.size || hasChannelMutations(state)) {
709
709
  extras = ",0)";
710
710
  if (fillIndex !== -1) {
711
- buf[fillIndex] = "_(" + buf[fillIndex];
712
- buf.push(")");
711
+ buf[fillIndex] = "_([" + buf[fillIndex];
712
+ buf.push("])");
713
713
  }
714
714
  writeAssigned(state);
715
715
  }
@@ -717,10 +717,9 @@ function writeScopesRoot(state, flushes) {
717
717
  for (const chunk of buf) result += chunk;
718
718
  result += extras;
719
719
  if (!result) return "";
720
- if (state.wroteUndefined) {
721
- state.wroteUndefined = false;
722
- return "(_,$)=>" + result;
723
- } else return "_=>" + result;
720
+ const arrow = state.wroteUndefined ? "(_,$)=>" : "_=>";
721
+ state.wroteUndefined = false;
722
+ return extras ? arrow + result : arrow + "[" + result + "]";
724
723
  }
725
724
  function writeAssigned(state) {
726
725
  let sep = state.buf.length ? "," : "";
@@ -1851,10 +1850,7 @@ function _attr_option_value(value) {
1851
1850
  const valueAttr = _attr("value", value);
1852
1851
  const selectedValue = getContext(kSelectedValue);
1853
1852
  if (selectedValue !== void 0 && normalizedValueMatches(selectedValue, value)) {
1854
- {
1855
- const matched = getContext(kSelectedValueMatched);
1856
- if (matched) matched.value = true;
1857
- }
1853
+ getContext(kSelectedValueMatched)?.add(normalizeStrAttrValue(value));
1858
1854
  return valueAttr + " selected";
1859
1855
  }
1860
1856
  return valueAttr;
@@ -1866,9 +1862,12 @@ function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content,
1866
1862
  if (content) {
1867
1863
  const selectedValue = value ?? "";
1868
1864
  if (valueChange) {
1869
- const matched = { value: false };
1865
+ const matched = /* @__PURE__ */ new Set();
1870
1866
  withContext(kSelectedValue, selectedValue, () => withContext(kSelectedValueMatched, matched, content));
1871
- if (!matched.value && (Array.isArray(value) ? value.some((v) => normalizeStrAttrValue(v) !== "") : normalizeStrAttrValue(value) !== "")) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
1867
+ if ((Array.isArray(value) ? value : [value]).some((v) => {
1868
+ const str = normalizeStrAttrValue(v);
1869
+ return str !== "" && !matched.has(str);
1870
+ })) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
1872
1871
  } else withContext(kSelectedValue, selectedValue, content);
1873
1872
  }
1874
1873
  }
@@ -3382,11 +3381,14 @@ function _escape(val) {
3382
3381
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
3383
3382
  }
3384
3383
  const unsafeScriptReg = /<(\/?script|!--)/gi;
3385
- const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str;
3384
+ const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\u003C$1") : str;
3386
3385
  function _escape_script(val) {
3387
3386
  assertValidTextValue(val);
3388
3387
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
3389
3388
  }
3389
+ const unsafeScriptTemplateLiteralReg = /[`\\\r]|\$\{|<(?=\/?script|!--)/gi;
3390
+ const replaceUnsafeScriptTemplateLiteral = (c) => c === "<" ? "\\x3C" : c === "\r" ? "\\r" : "\\" + c;
3391
+ const quoteScriptTemplateLiteral = (str) => "`" + (unsafeScriptTemplateLiteralReg.test(str) ? str.replace(unsafeScriptTemplateLiteralReg, replaceUnsafeScriptTemplateLiteral) : str) + "`";
3390
3392
  const unsafeStyleReg = /<(\/style)/gi;
3391
3393
  const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str;
3392
3394
  function _escape_style(val) {
@@ -3409,7 +3411,7 @@ function _escape_comment(val) {
3409
3411
  //#endregion
3410
3412
  //#region src/html/dynamic-tag.ts
3411
3413
  const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
3412
- let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard) => {
3414
+ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) => {
3413
3415
  const shouldResume = markerGuard !== 0;
3414
3416
  const renderer = normalizeDynamicRenderer(tag);
3415
3417
  const state = getState();
@@ -3446,6 +3448,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, m
3446
3448
  renderNative();
3447
3449
  result = _el(scopeId, DYNAMIC_TAG_VAR_REGISTER_ID + accessor);
3448
3450
  } else {
3451
+ if (tagVar && renderer?.["lazy"]) throw new Error(`A dynamic tag with a [tag variable](https://markojs.com/docs/reference/language#tag-variables) rendered \`${renderer["id"]}\`, which is lazily loaded, so it does not support one. Import it without \`load\`, or remove the variable.`);
3449
3452
  const chunk = getChunk();
3450
3453
  const beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0;
3451
3454
  const render = () => {
@@ -3458,7 +3461,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, m
3458
3461
  } finally {
3459
3462
  _set_scope_reason(void 0);
3460
3463
  }
3461
- else if (content) return content();
3464
+ else if (content) content();
3462
3465
  };
3463
3466
  result = shouldResume ? withBranchId(branchId, render) : render();
3464
3467
  rendered = _peek_scope_id() !== branchId;
@@ -3482,10 +3485,10 @@ function _content_resume(id, fn, scopeId, locals) {
3482
3485
  return _resume(_content(id, fn, scopeId), id, scopeId, locals);
3483
3486
  }
3484
3487
  const patchDynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (patch) => {
3485
- _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
3488
+ _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume, tagVar) => {
3486
3489
  const patched = patch(tag, scopeId, accessor);
3487
3490
  if (patched !== tag) patched["id"] = tag;
3488
- return originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
3491
+ return originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume, tagVar);
3489
3492
  };
3490
3493
  })(_dynamic_tag);
3491
3494
  //#endregion
@@ -3758,10 +3761,13 @@ function NOOP$1() {}
3758
3761
  const kAssets = Symbol();
3759
3762
  const kHead = Symbol();
3760
3763
  function withLoadAssets(renderer, flush, assetId, triggers) {
3761
- return Object.assign((input) => {
3764
+ return register(renderer["id"], Object.assign((input) => {
3762
3765
  writeLoadAsset(assetId, flush, triggers);
3763
3766
  return writeWaitReady(assetId, renderer, input);
3764
- }, renderer);
3767
+ }, {
3768
+ ...renderer,
3769
+ [Lazy]: 1
3770
+ }));
3765
3771
  }
3766
3772
  function writeLoadAsset(assetId, flush, triggers) {
3767
3773
  const g = $global();
@@ -3810,7 +3816,7 @@ function writeAsset(g, asset) {
3810
3816
  if (g[kHead] || g.__flush__ !== flushPage) {
3811
3817
  const block = blockHTML(g, asset);
3812
3818
  _html(block + (asset.triggers ? "" : deferHTML(g, asset)));
3813
- if (block && isInResumedBranch()) writeScript(`document.head.insertAdjacentHTML("beforeend",${_escape_script(JSON.stringify(block))})`);
3819
+ if (block && isInResumedBranch()) writeScript(`document.head.insertAdjacentHTML("beforeend",${quoteScriptTemplateLiteral(block)})`);
3814
3820
  asset.htmlAt = catchableBoundary();
3815
3821
  }
3816
3822
  }
@@ -3846,8 +3852,8 @@ function addAsset(g, id, flush, triggers) {
3846
3852
  return asset;
3847
3853
  }
3848
3854
  function triggerScript(id, html, triggers) {
3849
- const htmlStr = _escape_script(JSON.stringify(html));
3850
- const insert = `(d=new Range().createContextualFragment(h),d.querySelectorAll("script").forEach(s=>s.onerror=()=>console.error(${_escape_script(JSON.stringify(`The lazy module for "${id}" failed to load; its server-rendered content cannot become interactive.`))})),document.head.append(d))`;
3855
+ const htmlStr = quoteScriptTemplateLiteral(html);
3856
+ const insert = `(d=new Range().createContextualFragment(h),d.querySelectorAll("script").forEach(s=>s.onerror=()=>console.error(${quoteScriptTemplateLiteral(`The lazy module for "${id}" failed to load; its server-rendered content cannot become interactive.`)})),document.head.append(d))`;
3851
3857
  const exprs = triggers.map((trigger) => {
3852
3858
  const options = trigger.options && toObjectExpression(trigger.options);
3853
3859
  switch (trigger.type) {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js"), handlePendingTry = (fn, scope, branch) => {
2
+ let require_control_flow = require("../dom-Diu8MpmL.js"), handlePendingTry = (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.un(branch, require_control_flow.dn, require_control_flow.x))(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.ln(branch, require_control_flow.un, require_control_flow.b))(branch.O.c), [])).push(scope), /* @__PURE__ */ new Set())).add(fn);
5
5
  branch = branch.N;
6
6
  }
7
7
  };
8
8
  //#region src/dom/catch.feat.ts
9
- require_control_flow.cn((effects) => {
9
+ require_control_flow.sn((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 && !handlePendingTry(fn, scope, branch) && fn(scope);
12
12
  }, (runRender) => (render) => {
@@ -18,7 +18,7 @@ require_control_flow.cn((effects) => {
18
18
  }
19
19
  render.f = 0, runRender(render);
20
20
  } catch (error) {
21
- require_control_flow.b(render.b, error);
21
+ require_control_flow.y(render.b, error);
22
22
  }
23
23
  });
24
24
  //#endregion
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { b as renderCatch, cn as installCatch, dn as queueEffect, un as queueAsyncRender, x as runPendingEffects } from "../dom-DHg9YChM.mjs";
7
+ import { b as runPendingEffects, ln as queueAsyncRender, sn as installCatch, un as queueEffect, y as renderCatch } from "../dom-DefWmvQB.mjs";
8
8
  //#region src/dom/catch.feat.ts
9
9
  installCatch((effects) => {
10
10
  let i = 0, fn, scope, branch;
@@ -11,9 +11,9 @@ export declare const _if: (nodeAccessor: EncodedAccessor, ...branchesArgs: (stri
11
11
  export declare const _show: (nodeAccessor: EncodedAccessor, startNodeAccessor?: EncodedAccessor, endNodeAccessor?: 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
- export declare let _dynamic_tag: (nodeAccessor: EncodedAccessor, getContent?: ((scope: Scope) => Renderer) | 0, getTagVar?: (() => Signal<unknown>) | 0, inputIsArgs?: 1) => Signal<Renderer | string | undefined>;
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>;
15
15
  export declare const _dynamic_tag_content: (nodeAccessor: EncodedAccessor) => Signal<Renderer | undefined>;
16
- export declare let bindTagVar: undefined | ((scope: Scope, branch: BranchScope, scopeKey: number, renderer?: Renderer | string) => void);
16
+ export declare let bindTagVar: undefined | ((scope: Scope, branch: BranchScope, scopeKey: number, renderer: Renderer | string) => void);
17
17
  export declare function installDynamicTagVar(bind: NonNullable<typeof bindTagVar>): void;
18
18
  export declare function dynamicTagScript(branch: Scope): void;
19
19
  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;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js");
3
- require_control_flow.W[0] = require_control_flow.A, require_control_flow.W[1] = require_control_flow.O, require_control_flow.W[2] = require_control_flow.F;
2
+ let require_control_flow = require("../dom-Diu8MpmL.js");
3
+ require_control_flow.U[0] = require_control_flow.k, require_control_flow.U[1] = require_control_flow.D, require_control_flow.U[2] = require_control_flow.P;
4
4
  //#endregion
@@ -1,3 +1,3 @@
1
- import { A as _attr_input_checked_script, F as _attr_input_value_script, O as _attr_input_checkedValue_script, W as controllableScripts } from "../dom-DHg9YChM.mjs";
1
+ import { D as _attr_input_checkedValue_script, P as _attr_input_value_script, U as controllableScripts, k as _attr_input_checked_script } from "../dom-DefWmvQB.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,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js");
2
+ let require_control_flow = require("../dom-Diu8MpmL.js");
3
3
  //#region src/dom/controllable-open.feat.ts
4
- require_control_flow.W[4] = require_control_flow.w;
4
+ require_control_flow.U[4] = require_control_flow.C;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { W as controllableScripts, w as _attr_details_or_dialog_open_script } from "../dom-DHg9YChM.mjs";
1
+ import { C as _attr_details_or_dialog_open_script, U as controllableScripts } from "../dom-DefWmvQB.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js");
2
+ let require_control_flow = require("../dom-Diu8MpmL.js");
3
3
  //#region src/dom/controllable-select.feat.ts
4
- require_control_flow.W[3] = require_control_flow.R;
4
+ require_control_flow.U[3] = require_control_flow.L;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { R as _attr_select_value_script, W as controllableScripts } from "../dom-DHg9YChM.mjs";
1
+ import { L as _attr_select_value_script, U as controllableScripts } from "../dom-DefWmvQB.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js");
2
+ let require_control_flow = require("../dom-Diu8MpmL.js");
3
3
  //#region src/dom/controllable-textarea.feat.ts
4
- require_control_flow.W[2] = require_control_flow.F;
4
+ require_control_flow.U[2] = require_control_flow.P;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { F as _attr_input_value_script, W as controllableScripts } from "../dom-DHg9YChM.mjs";
1
+ import { P as _attr_input_value_script, U as controllableScripts } from "../dom-DefWmvQB.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js");
3
- require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.U.INPUT = require_control_flow.z, require_control_flow.U.TEXTAREA = require_control_flow.H, require_control_flow.U.SELECT = require_control_flow.V, require_control_flow.U.DETAILS = require_control_flow.U.DIALOG = require_control_flow.B;
2
+ let require_control_flow = require("../dom-Diu8MpmL.js");
3
+ require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.H.INPUT = require_control_flow.R, require_control_flow.H.TEXTAREA = require_control_flow.V, require_control_flow.H.SELECT = require_control_flow.B, require_control_flow.H.DETAILS = require_control_flow.H.DIALOG = require_control_flow.z;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { B as _controllable_open, H as _controllable_textarea, U as controllableRenders, V as _controllable_select, z as _controllable_input } from "../dom-DHg9YChM.mjs";
1
+ import { B as _controllable_select, H as controllableRenders, R as _controllable_input, V as _controllable_textarea, z as _controllable_open } from "../dom-DefWmvQB.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js");
2
+ let require_control_flow = require("../dom-Diu8MpmL.js");
3
3
  //#region src/dom/dynamic-tag-script.feat.ts
4
- require_control_flow.wt._d = require_control_flow.Tn(require_control_flow._);
4
+ require_control_flow.Ct._d = require_control_flow.wn(require_control_flow.g);
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { Tn as withBranches, _ as dynamicTagScript, wt as _resumed } from "../dom-DHg9YChM.mjs";
1
+ import { Ct as _resumed, g as dynamicTagScript, wn as withBranches } from "../dom-DefWmvQB.mjs";
2
2
  //#region src/dom/dynamic-tag-script.feat.ts
3
3
  _resumed._d = withBranches(dynamicTagScript);
4
4
  //#endregion
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js");
3
- require_control_flow.sn(), require_control_flow.v((scope, branch, scopeKey, renderer) => {
4
- branch.BR = require_control_flow.on(scope, scopeKey), typeof renderer == "string" && branch.T(() => branch.S);
2
+ let require_control_flow = require("../dom-Diu8MpmL.js");
3
+ require_control_flow.on(), require_control_flow._((scope, branch, scopeKey, renderer) => {
4
+ branch.BR = require_control_flow.an(scope, scopeKey), typeof renderer == "string" && branch.T(() => branch.S);
5
5
  });
6
6
  //#endregion
@@ -1,4 +1,4 @@
1
- import { on as createBranchRenders, sn as installBranchRenders, v as installDynamicTagVar } from "../dom-DHg9YChM.mjs";
1
+ import { _ as installDynamicTagVar, an as createBranchRenders, on as installBranchRenders } from "../dom-DefWmvQB.mjs";
2
2
  installBranchRenders(), installDynamicTagVar((scope, branch, scopeKey, renderer) => {
3
3
  branch.BR = createBranchRenders(scope, scopeKey), typeof renderer == "string" && branch.T(() => branch.S);
4
4
  });
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  //#region src/dom/lazy.feat.ts
3
- require("../dom-CtIT8Mpr.js").jt();
3
+ require("../dom-Diu8MpmL.js").At();
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { jt as withLazy } from "../dom-DHg9YChM.mjs";
1
+ import { At as withLazy } from "../dom-DefWmvQB.mjs";
2
2
  //#region src/dom/lazy.feat.ts
3
3
  withLazy();
4
4
  //#endregion
@@ -12,7 +12,6 @@ export interface LoadTrigger {
12
12
  }
13
13
  export declare function _load_template(id: string, load: () => Promise<Renderer>): Template & Renderer;
14
14
  export declare function _load_setup(load: () => Promise<LoadModule>): (owner: Scope, child: BranchScope, marker: ChildNode) => void;
15
- export declare function _load_setup_var(load: () => Promise<LoadModule>): (owner: Scope, child: BranchScope, marker: ChildNode) => void;
16
15
  export declare function _load_signal(load: () => Promise<LoadSignal>): Signal;
17
16
  export declare function _load_visible_trigger(selector: string, options?: IntersectionObserverInit): LoadTrigger;
18
17
  export declare function _load_idle_trigger(options?: {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- let require_control_flow = require("../dom-CtIT8Mpr.js");
2
+ let require_control_flow = require("../dom-Diu8MpmL.js");
3
3
  //#region src/dom/placeholder.feat.ts
4
- require_control_flow.wt._f = (tryBranch) => {
5
- tryBranch.P &&= (require_control_flow.$t(tryBranch.P), 0);
4
+ require_control_flow.Ct._f = (tryBranch) => {
5
+ tryBranch.P &&= (require_control_flow.Qt(tryBranch.P), 0);
6
6
  };
7
7
  //#endregion
@@ -1,4 +1,4 @@
1
- import { $t as destroyBranch, wt as _resumed } from "../dom-DHg9YChM.mjs";
1
+ import { Ct as _resumed, Qt as destroyBranch } from "../dom-DefWmvQB.mjs";
2
2
  //#region src/dom/placeholder.feat.ts
3
3
  _resumed._f = (tryBranch) => {
4
4
  tryBranch.P &&= (destroyBranch(tryBranch.P), 0);
@@ -4,16 +4,23 @@ export type Renderer = {
4
4
  [RendererProp.Id]: string;
5
5
  [RendererProp.Setup]: undefined | SetupFn;
6
6
  [RendererProp.Clone]: (branch: BranchScope, ns: string) => void;
7
- [RendererProp.Params]: Signal<unknown> | undefined;
7
+ [RendererProp.Params]: (Signal<unknown> & ReturnMark) | undefined;
8
8
  [RendererProp.Owner]: Scope | undefined;
9
9
  [RendererProp.Accessor]: Accessor | undefined;
10
10
  [RendererProp.LocalClosures]?: SetupFn;
11
+ [RendererProp.Lazy]?: 1;
12
+ };
13
+ export type SetupFn = ((scope: Scope) => void) & ReturnMark;
14
+ export type ReturnMark = {
15
+ [RendererProp.Returns]?: 1;
11
16
  };
12
- export type SetupFn = (scope: Scope) => void;
13
17
  export declare function createBranch($global: Scope[typeof AccessorProp.Global], renderer: Renderer | string, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
14
18
  export declare function setParentBranch(branch: BranchScope, parentBranch: BranchScope | undefined): void;
15
19
  export declare function createAndSetupBranch($global: Scope[typeof AccessorProp.Global], renderer: Renderer, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
16
20
  export declare function setupBranch(renderer: Renderer, branch: BranchScope): BranchScope;
21
+ export declare function _return_setup<T extends ((...args: any[]) => unknown) | {
22
+ _: SetupFn;
23
+ }>(setup: T): T;
17
24
  export declare function _content(id: string, template?: string | 0, walks?: string | 0, setup?: {
18
25
  _: Signal<unknown>;
19
26
  } | SetupFn | 0, params?: Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;