marko 6.4.6 → 6.4.8

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 (88) hide show
  1. package/cheatsheet.md +2 -1
  2. package/dist/common/errors.d.ts +1 -0
  3. package/dist/debug/dom/catch.feat.js +2 -2
  4. package/dist/debug/dom/catch.feat.mjs +2 -2
  5. package/dist/debug/dom/controllable-input.feat.js +1 -1
  6. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-open.feat.js +1 -1
  8. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-select.feat.js +1 -1
  10. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable.feat.js +1 -1
  14. package/dist/debug/dom/controllable.feat.mjs +1 -1
  15. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -2
  18. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -2
  19. package/dist/debug/dom/lazy.feat.js +1 -1
  20. package/dist/debug/dom/lazy.feat.mjs +1 -1
  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-o9jQjchF.mjs → dom-CFCBDift.mjs} +97 -99
  24. package/dist/debug/{dom-CNgQ6lj9.js → dom-D8znnhpf.js} +102 -104
  25. package/dist/debug/dom.js +18 -19
  26. package/dist/debug/dom.mjs +19 -19
  27. package/dist/debug/html.js +15 -12
  28. package/dist/debug/html.mjs +15 -13
  29. package/dist/dom/catch.feat.js +3 -3
  30. package/dist/dom/catch.feat.mjs +2 -2
  31. package/dist/dom/control-flow.d.ts +1 -1
  32. package/dist/dom/controllable-input.feat.js +1 -1
  33. package/dist/dom/controllable-input.feat.mjs +1 -1
  34. package/dist/dom/controllable-open.feat.js +1 -1
  35. package/dist/dom/controllable-open.feat.mjs +1 -1
  36. package/dist/dom/controllable-select.feat.js +1 -1
  37. package/dist/dom/controllable-select.feat.mjs +1 -1
  38. package/dist/dom/controllable-textarea.feat.js +1 -1
  39. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  40. package/dist/dom/controllable.feat.js +1 -1
  41. package/dist/dom/controllable.feat.mjs +1 -1
  42. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  43. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  44. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  45. package/dist/dom/dynamic-tag-var.feat.mjs +2 -2
  46. package/dist/dom/lazy.feat.js +1 -1
  47. package/dist/dom/lazy.feat.mjs +1 -1
  48. package/dist/dom/placeholder.feat.js +2 -2
  49. package/dist/dom/placeholder.feat.mjs +1 -1
  50. package/dist/dom/renderer.d.ts +1 -3
  51. package/dist/dom/resume.d.ts +2 -3
  52. package/dist/dom/signals.d.ts +2 -7
  53. package/dist/{dom-60R4bRWD.js → dom-Bpkm72vV.js} +123 -132
  54. package/dist/{dom-Ci2W4l1P.mjs → dom-CVAevsbz.mjs} +77 -81
  55. package/dist/dom.d.ts +1 -1
  56. package/dist/dom.js +33 -33
  57. package/dist/dom.mjs +19 -19
  58. package/dist/html/assets.d.ts +1 -1
  59. package/dist/html/control-flow.d.ts +1 -1
  60. package/dist/html/inlined-runtimes.d.ts +2 -2
  61. package/dist/html/inlined-runtimes.debug.d.ts +2 -2
  62. package/dist/html/template.d.ts +1 -1
  63. package/dist/html.d.ts +1 -1
  64. package/dist/html.js +16 -19
  65. package/dist/html.mjs +16 -19
  66. package/dist/translator/index.js +6201 -5997
  67. package/dist/translator/util/assert.d.ts +7 -0
  68. package/dist/translator/util/bindings.d.ts +11 -3
  69. package/dist/translator/util/cyclic-memo.d.ts +6 -2
  70. package/dist/translator/util/entry-builder.d.ts +0 -1
  71. package/dist/translator/util/finalize-references.d.ts +4 -2
  72. package/dist/translator/util/for-selector.d.ts +1 -1
  73. package/dist/translator/util/generate-uid.d.ts +1 -0
  74. package/dist/translator/util/known-tag.d.ts +10 -3
  75. package/dist/translator/util/optional.d.ts +1 -1
  76. package/dist/translator/util/reasons.d.ts +5 -3
  77. package/dist/translator/util/references.d.ts +4 -0
  78. package/dist/translator/util/sections.d.ts +10 -9
  79. package/dist/translator/util/signals.d.ts +3 -3
  80. package/dist/translator/util/slots.d.ts +2 -2
  81. package/dist/translator/util/solve-reasons.d.ts +1 -0
  82. package/dist/translator/util/state.d.ts +4 -2
  83. package/dist/translator/util/write-guard.d.ts +2 -1
  84. package/dist/translator/visitors/import-declaration.d.ts +2 -0
  85. package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
  86. package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
  87. package/package.json +4 -4
  88. package/tags-html.d.ts +3 -0
@@ -533,7 +533,7 @@ function push(opt, item) {
533
533
  //#region src/dom/event.ts
534
534
  function _on(element, type, handler) {
535
535
  assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
536
- if (element[1 + type] === void 0) delegate(type, handleDelegated);
536
+ delegate(type, handleDelegated);
537
537
  element[1 + type] = handler || null;
538
538
  }
539
539
  const delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, true), 1);
@@ -642,7 +642,7 @@ function schedule() {
642
642
  if (!isScheduled) {
643
643
  if (console.createTask) {
644
644
  const task = console.createTask("queue");
645
- runTask = () => task.run(run);
645
+ runTask = (_) => task.run(run);
646
646
  } else runTask = run;
647
647
  isScheduled = 1;
648
648
  queueMicrotask(flushAndWaitFrame);
@@ -655,7 +655,7 @@ function flushAndWaitFrame() {
655
655
  function triggerMacroTask() {
656
656
  if (!channel) {
657
657
  channel = new MessageChannel();
658
- channel.port1.onmessage = () => {
658
+ channel.port1.onmessage = (_) => {
659
659
  isScheduled = 0;
660
660
  {
661
661
  const run = runTask;
@@ -720,22 +720,22 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
720
720
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
721
721
  const ownerSignal = (ownerScope) => {
722
722
  const scopes = toArray(ownerScope[scopeAccessor]);
723
- queueRender(ownerScope, () => {
723
+ queueRender(ownerScope, (_) => {
724
724
  for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
725
725
  }, -1);
726
726
  };
727
- ownerSignal._ = fn;
727
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
728
728
  return ownerSignal;
729
729
  }
730
- function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccessor, fn) {
730
+ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
731
731
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
732
732
  const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
733
733
  const prevKeyProp = `${PreviousKey}${ownerValueAccessor}`;
734
734
  const ownerSignal = (ownerScope) => {
735
735
  if (ownerScope["#Gen"] < runId) {
736
736
  const nextKey = ownerScope[ownerValueAccessor];
737
- queueRender(ownerScope, () => {
738
- const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor);
737
+ queueRender(ownerScope, (_) => {
738
+ const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
739
739
  if (map && prevKeyProp in map) {
740
740
  const prevScope = map.get(map[prevKeyProp]);
741
741
  const nextScope = map.get(nextKey);
@@ -748,15 +748,14 @@ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccess
748
748
  }, -1);
749
749
  }
750
750
  };
751
- ownerSignal._ = fn;
751
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
752
752
  return ownerSignal;
753
753
  }
754
- function keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor) {
754
+ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
755
755
  const map = ownerScope[mapAccessor] ||= /* @__PURE__ */ new Map();
756
756
  if (!map.size) for (const scope of toArray(ownerScope[scopeAccessor])) {
757
- const key = scope["#LoopKey"] ?? scope[keyValueAccessor];
757
+ const key = scope[LoopKey];
758
758
  if (key === void 0) return ownerScope[mapAccessor] = null;
759
- scope[LoopKey] = key;
760
759
  map.set(key, scope);
761
760
  }
762
761
  return map;
@@ -771,11 +770,11 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
771
770
  const ifScope = scope[scopeAccessor];
772
771
  if (ifScope && ifScope["#Gen"] > 0 && ifScope["#Gen"] < runId && (scope[branchAccessor] || 0) === branch) queueRender(ifScope, fn, -1);
773
772
  };
774
- ownerSignal._ = fn;
773
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
775
774
  return ownerSignal;
776
775
  }
777
- function subscribeToScopeSet(ownerScope, accessor, scope) {
778
- const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
776
+ function subscribeToScopeSet(owner, accessor, scope) {
777
+ const subscribers = owner[accessor] ||= /* @__PURE__ */ new Set();
779
778
  const { size } = subscribers;
780
779
  if (subscribers.add(scope).size !== size) trackCleanup(scope, subscribers);
781
780
  }
@@ -787,7 +786,7 @@ function _closure(...closureSignals) {
787
786
  return (scope) => {
788
787
  if (scope[scopeInstances]) {
789
788
  scope[scopeInstances][Changed] = 1;
790
- for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
789
+ for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) closureSignals[childScope[signalIndex] || 0](childScope);
791
790
  }
792
791
  };
793
792
  }
@@ -795,22 +794,15 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
795
794
  const closureSignal = ((scope, resumed) => {
796
795
  const ownerScope = getOwnerScope ? getOwnerScope(scope) : scope["_"];
797
796
  scope[closureSignal[SignalIndexAccessor]] = closureSignal[Index];
798
- if (!resumed) fn(scope);
799
- else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, closureSignal);
800
797
  subscribeToScopeSet(ownerScope, closureSignal[ScopeInstancesAccessor], scope);
798
+ if (!resumed) queueRender(scope, fn, -1);
799
+ else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, fn);
801
800
  });
802
801
  closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
803
802
  closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
804
803
  if (resumeId) _resumed[resumeId] = (scope) => closureSignal(scope, 1);
805
804
  return closureSignal;
806
805
  }
807
- function _child_setup(setup) {
808
- setup._ = (scope, owner) => {
809
- scope["_"] ||= owner;
810
- queueRender(scope, setup, -1);
811
- };
812
- return setup;
813
- }
814
806
  function _var(scope, childAccessor, signal) {
815
807
  const childScope = scope[childAccessor];
816
808
  childScope[TagVariable] = (value) => signal(scope, value);
@@ -826,13 +818,13 @@ const _var_change = (scope, value, name = "This") => {
826
818
  };
827
819
  const tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
828
820
  function _id(scope, accessor) {
829
- let id = accessor !== void 0 && scope[accessor];
821
+ let id = accessor && scope[accessor];
830
822
  if (!id) {
831
823
  const $global = scope[Global];
832
824
  const n = tagIdsByGlobal.get($global) || 0;
833
825
  tagIdsByGlobal.set($global, n + 1);
834
826
  id = "c" + $global.runtimeId + $global.renderId + n.toString(36);
835
- if (accessor !== void 0) scope[accessor] = id;
827
+ if (accessor) scope[accessor] = id;
836
828
  }
837
829
  return id;
838
830
  }
@@ -866,7 +858,7 @@ function* traverse(scope, path, args, i = path.length - 1) {
866
858
  function _hoist(...path) {
867
859
  return (scope) => {
868
860
  const fn = (...args) => traverse(scope, path, args).next().value;
869
- fn[Symbol.iterator] = () => traverse(scope, path, []);
861
+ fn[Symbol.iterator] = (_) => traverse(scope, path, []);
870
862
  return fn;
871
863
  };
872
864
  }
@@ -900,7 +892,11 @@ const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
900
892
  if (value === 48) scope[getDebugKey(currentScopeIndex++, "#scopeOffset")] = skipScope();
901
893
  } else if (value < 92) {
902
894
  value = 25 * currentMultiplier + value - 67;
903
- while (value--) walkNextNode();
895
+ while (value--) if (currentNode.firstChild) currentNode = currentNode.firstChild;
896
+ else {
897
+ while (!currentNode.nextSibling && currentNode.parentNode) currentNode = currentNode.parentNode;
898
+ walkNextSibling();
899
+ }
904
900
  } else if (value < 107) {
905
901
  value = 10 * currentMultiplier + value - 97;
906
902
  while (value--) walkNextSibling();
@@ -921,12 +917,7 @@ function getDebugKey(index, node) {
921
917
  else if (node.nodeType === 1) return `#${node.tagName.toLowerCase()}/${index}`;
922
918
  return index;
923
919
  }
924
- const walkNextNode = () => {
925
- if (currentNode.firstChild) return currentNode = currentNode.firstChild;
926
- while (!currentNode.nextSibling && currentNode.parentNode) currentNode = currentNode.parentNode;
927
- walkNextSibling();
928
- };
929
- const walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode;
920
+ const walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode;
930
921
  //#endregion
931
922
  //#region src/dom/resume.ts
932
923
  const _resumed = {};
@@ -950,7 +941,7 @@ function withLazy() {
950
941
  function initEmbedded(readyId, runtimeId) {
951
942
  if (!embedRenders) {
952
943
  embedRenders = /* @__PURE__ */ new Map();
953
- new MutationObserver(() => {
944
+ new MutationObserver((_) => {
954
945
  for (const [anchor, [renderId, scopes]] of embedRenders) if (!anchor.isConnected) {
955
946
  embedRenders.delete(anchor);
956
947
  delete curRenders[renderId];
@@ -978,7 +969,7 @@ function init(runtimeId = "M") {
978
969
  const scopeLookup = {};
979
970
  const pending = [];
980
971
  const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
981
- const initGlobal = () => scopeLookup[0] ||= {
972
+ const initGlobal = (_) => scopeLookup[0] ||= {
982
973
  runtimeId,
983
974
  renderId
984
975
  };
@@ -1052,7 +1043,7 @@ function init(runtimeId = "M") {
1052
1043
  } else pending.push(visitScope);
1053
1044
  };
1054
1045
  };
1055
- const nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1046
+ const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1056
1047
  const processResumes = (resumes = [], effects) => {
1057
1048
  let i = 0;
1058
1049
  for (; i < resumes.length; i++) {
@@ -1126,7 +1117,7 @@ function init(runtimeId = "M") {
1126
1117
  visits.length = retained;
1127
1118
  return effects;
1128
1119
  };
1129
- render.w = () => {
1120
+ render.w = (_) => {
1130
1121
  walk();
1131
1122
  runResumeEffects(render);
1132
1123
  };
@@ -1158,10 +1149,10 @@ function _var_resume(id, signal) {
1158
1149
  return signal;
1159
1150
  }
1160
1151
  function _el(id, accessor) {
1161
- return _resumed[id] = (scope) => () => _el_read(scope[accessor]);
1152
+ return _resumed[id] = (scope) => (_) => _el_read(scope[accessor]);
1162
1153
  }
1163
1154
  function _dynamic_tag_var_resume(accessor) {
1164
- _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => () => {
1155
+ _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => (_) => {
1165
1156
  const node = scope[accessor];
1166
1157
  return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1167
1158
  };
@@ -1187,11 +1178,11 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1187
1178
  return setupBranch(renderer, createBranch($global, renderer, parentScope, parentNode));
1188
1179
  }
1189
1180
  function setupBranch(renderer, branch) {
1190
- if (renderer["setup"]) queueRender(branch, renderer[Setup], -1);
1181
+ renderer[Setup]?.(branch);
1191
1182
  return branch;
1192
1183
  }
1193
1184
  function _return_setup(setup) {
1194
- (setup._ || setup)[Returns] = 1;
1185
+ setup[Returns] = 1;
1195
1186
  return setup;
1196
1187
  }
1197
1188
  function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
@@ -1230,14 +1221,15 @@ function _content_closures(renderer, closureFns) {
1230
1221
  for (const key in closureFns) closureSignals[key] = _const(key, closureFns[key]);
1231
1222
  return (owner, closureValues) => {
1232
1223
  const instance = renderer(owner);
1233
- const clone = instance[Clone];
1224
+ const setup = instance[Setup];
1234
1225
  const setClosures = instance[LocalClosures] = (branch) => {
1235
1226
  for (const key in closureSignals) closureSignals[key](branch, closureValues[key]);
1236
1227
  };
1237
- instance[Clone] = (branch, ns) => {
1238
- clone(branch, ns);
1228
+ instance[Setup] = (branch) => {
1229
+ setup?.(branch);
1239
1230
  setClosures(branch);
1240
1231
  };
1232
+ instance[Setup][Returns] = (setup || instance["params"])?.[Returns];
1241
1233
  return instance;
1242
1234
  };
1243
1235
  }
@@ -1444,7 +1436,7 @@ function _lifecycle(scope, thisObj, index = 0) {
1444
1436
  Object.assign(thisObj, thisObj.onMount?.());
1445
1437
  for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
1446
1438
  }
1447
- trackAbort(scope, accessor, () => thisObj.onDestroy?.());
1439
+ trackAbort(scope, accessor, (_) => thisObj.onDestroy?.());
1448
1440
  }
1449
1441
  }
1450
1442
  function removeChildNodes(startNode, endNode) {
@@ -1515,7 +1507,7 @@ function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
1515
1507
  }
1516
1508
  function _attr_input_checked_script(scope, nodeAccessor) {
1517
1509
  const el = scope[nodeAccessor];
1518
- syncControllableFormInput(el, hasCheckboxChanged, () => {
1510
+ syncControllableFormInput(el, hasCheckboxChanged, (_) => {
1519
1511
  const checkedChange = scope[ControlledHandler + nodeAccessor];
1520
1512
  if (checkedChange) {
1521
1513
  const newValue = el.checked;
@@ -1550,7 +1542,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
1550
1542
  if (scope["ControlledValue:" + nodeAccessor]) scope[ControlledValue + nodeAccessor].push(el.value);
1551
1543
  else scope[ControlledValue + nodeAccessor] = el.value;
1552
1544
  }
1553
- syncControllableFormInput(el, hasCheckboxChanged, () => {
1545
+ syncControllableFormInput(el, hasCheckboxChanged, (_) => {
1554
1546
  const checkedValueChange = scope[ControlledHandler + nodeAccessor];
1555
1547
  if (checkedValueChange) {
1556
1548
  const controlledValueKey = ControlledValue + nodeAccessor;
@@ -1622,7 +1614,7 @@ function _attr_select_value_default(scope, nodeAccessor, value) {
1622
1614
  const live = scope[Gen$1] < runId;
1623
1615
  const multiple = Array.isArray(value);
1624
1616
  const normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
1625
- pendingEffects.unshift(() => {
1617
+ pendingEffects.unshift((_) => {
1626
1618
  for (const opt of el.options) {
1627
1619
  const selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
1628
1620
  if (opt.defaultSelected !== selected) {
@@ -1641,13 +1633,13 @@ function _attr_select_value(scope, nodeAccessor, value, valueChange) {
1641
1633
  assertHandlerIsFunction("valueChange", valueChange);
1642
1634
  scope[ControlledHandler + nodeAccessor] = valueChange;
1643
1635
  scope[ControlledType + nodeAccessor] = valueChange ? 3 : 5;
1644
- if (valueChange) pendingEffects.unshift(() => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
1645
- if (valueChange && existing) pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope);
1636
+ if (valueChange) pendingEffects.unshift((_) => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
1637
+ if (valueChange && existing) pendingEffects.unshift((_) => setSelectValue(el, normalizedValue, multiple), scope);
1646
1638
  else _attr_select_value_default(scope, nodeAccessor, normalizedValue);
1647
1639
  }
1648
1640
  function _attr_select_value_script(scope, nodeAccessor) {
1649
1641
  const el = scope[nodeAccessor];
1650
- const onChange = () => {
1642
+ const onChange = (_) => {
1651
1643
  const valueChange = scope[ControlledHandler + nodeAccessor];
1652
1644
  if (valueChange) {
1653
1645
  const oldValue = scope[ControlledValue + nodeAccessor];
@@ -1674,7 +1666,7 @@ function _attr_select_value_script(scope, nodeAccessor) {
1674
1666
  observeControlled(scope, nodeAccessor, {
1675
1667
  childList: true,
1676
1668
  subtree: true
1677
- }, () => {
1669
+ }, (_) => {
1678
1670
  const value = scope[ControlledValue + nodeAccessor];
1679
1671
  if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) onChange();
1680
1672
  });
@@ -1706,7 +1698,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
1706
1698
  observeControlled(scope, nodeAccessor, {
1707
1699
  attributes: true,
1708
1700
  attributeFilter: ["open"]
1709
- }, () => {
1701
+ }, (_) => {
1710
1702
  const openChange = scope[ControlledHandler + nodeAccessor];
1711
1703
  if (openChange && el.open === !scope["ControlledValue:" + nodeAccessor]) {
1712
1704
  const newValue = el.open;
@@ -1732,7 +1724,7 @@ function handleChange(ev) {
1732
1724
  function handleFormReset(ev) {
1733
1725
  const handlers = [];
1734
1726
  for (const el of ev.target.elements || []) if (el._ && el.c(el)) handlers.push(el._);
1735
- requestAnimationFrame(() => {
1727
+ requestAnimationFrame((_) => {
1736
1728
  if (!ev.defaultPrevented) for (const change of handlers) change();
1737
1729
  });
1738
1730
  }
@@ -1804,11 +1796,11 @@ function _await_promise(nodeAccessor, params) {
1804
1796
  let awaitBranch = scope[branchAccessor];
1805
1797
  const tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
1806
1798
  if (!tryBranch) {
1807
- const deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1799
+ const deferred = scope[promiseAccessor] = (_) => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1808
1800
  const awaitCounter = findTryWithPlaceholder(scope)?.[AwaitCounter];
1809
1801
  if (awaitCounter?.i) {
1810
1802
  const complete = awaitCounter.c;
1811
- awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
1803
+ awaitCounter.c = (_) => complete() || queueAsyncRender(scope, deferred);
1812
1804
  }
1813
1805
  return;
1814
1806
  }
@@ -1816,14 +1808,14 @@ function _await_promise(nodeAccessor, params) {
1816
1808
  let awaitCounter = tryBranch[AwaitCounter];
1817
1809
  if (!scope[tryAccessor]) {
1818
1810
  scope[tryAccessor] = tryBranch;
1819
- trackAbort(scope, promiseAccessor, () => {
1811
+ trackAbort(scope, promiseAccessor, (_) => {
1820
1812
  scope[promiseAccessor] = 0;
1821
1813
  if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
1822
1814
  });
1823
1815
  if (awaitBranch) awaitBranch[PendingRenders] ||= [];
1824
1816
  if (tryBranch !== awaitBranch) awaitCounter = startAwait(scope, tryBranch);
1825
1817
  else {
1826
- if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
1818
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, (_) => {
1827
1819
  if (tryBranch === scope[branchAccessor]) {
1828
1820
  const anchor = scope[nodeAccessor];
1829
1821
  if (anchor.parentNode) {
@@ -1833,7 +1825,7 @@ function _await_promise(nodeAccessor, params) {
1833
1825
  }
1834
1826
  }
1835
1827
  });
1836
- countAwait(awaitCounter, scope, () => {
1828
+ countAwait(awaitCounter, scope, (_) => {
1837
1829
  if (!awaitBranch["#DetachedAwait"]) {
1838
1830
  awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
1839
1831
  tempDetachBranch(tryBranch);
@@ -1850,7 +1842,7 @@ function _await_promise(nodeAccessor, params) {
1850
1842
  awaitPromise(scope, data);
1851
1843
  awaitCounter.c();
1852
1844
  run();
1853
- } else queueAsyncRender(scope, () => {
1845
+ } else queueAsyncRender(scope, (_) => {
1854
1846
  if (!scope[promiseAccessor]) {
1855
1847
  awaitBranch = resolveAwait(scope, referenceNode, data);
1856
1848
  const pendingRenders = awaitBranch[PendingRenders];
@@ -1876,19 +1868,17 @@ function _await_promise(nodeAccessor, params) {
1876
1868
  }
1877
1869
  function _await_content(nodeAccessor, template, walks, setup) {
1878
1870
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1879
- const promiseAccessor = Promise$1 + nodeAccessor;
1880
1871
  const renderer = _content("", template, walks, setup)();
1881
1872
  return (scope) => {
1882
- const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
1873
+ const pendingScopes = collectScopes((_) => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
1883
1874
  scope[branchAccessor][PendingScopes] = pendingScopes;
1884
- if (typeof scope[promiseAccessor] === "function") scope[promiseAccessor]();
1885
1875
  };
1886
1876
  }
1887
1877
  function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1888
1878
  if (!tryBranch) return;
1889
1879
  let awaitCounter = tryBranch[AwaitCounter];
1890
- if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
1891
- countAwait(awaitCounter, tryBranch, () => {
1880
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, (_) => dismissPlaceholder(tryBranch));
1881
+ countAwait(awaitCounter, tryBranch, (_) => {
1892
1882
  (tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent](), tryBranch["_"], tryBranch[StartNode].parentNode))[TryBranch] = tryBranch;
1893
1883
  insertBranchBefore(tryBranch[PlaceholderBranch], tryBranch[StartNode].parentNode, tryBranch[StartNode]);
1894
1884
  tempDetachBranch(tryBranch);
@@ -1896,7 +1886,7 @@ function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1896
1886
  return awaitCounter;
1897
1887
  }
1898
1888
  function countAwait(awaitCounter, scope, render) {
1899
- if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
1889
+ if (!awaitCounter.i++) requestAnimationFrame((_) => awaitCounter.i && runEffects(prepareEffects((_) => queueRender(scope, render, -1))));
1900
1890
  }
1901
1891
  function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
1902
1892
  queueRender(tryBranch, completeAwaitCounter, -1, awaitCounter, tryBranch["#Id"] + 1e9);
@@ -1944,13 +1934,14 @@ function dismissPlaceholder(tryBranch) {
1944
1934
  }
1945
1935
  function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
1946
1936
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1947
- const renderer = _content("", template, walks, setup)();
1937
+ const renderer = _content("", template, walks)();
1948
1938
  return (scope) => {
1949
- setBranch(scope, nodeAccessor, renderer, createAndSetupBranch);
1939
+ setBranch(scope, nodeAccessor, renderer, createBranch);
1950
1940
  const branch = scope[branchAccessor];
1951
1941
  branch[BranchAccessor] = nodeAccessor;
1952
1942
  branch[CatchContent] = catchContent;
1953
1943
  branch[PlaceholderContent] = placeholderContent || void 0;
1944
+ if (setup) queueRender(branch, setup, -1);
1954
1945
  };
1955
1946
  }
1956
1947
  function renderCatch(scope, error) {
@@ -1965,8 +1956,11 @@ function renderCatch(scope, error) {
1965
1956
  destroyBranch(tryWithCatch);
1966
1957
  }
1967
1958
  const catchContent = tryWithCatch[CatchContent]();
1968
- setBranch(owner, tryWithCatch[BranchAccessor], catchContent, createAndSetupBranch);
1969
- catchContent[Params]?.(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], [error]);
1959
+ setBranch(owner, tryWithCatch[BranchAccessor], catchContent, createBranch);
1960
+ queueRender(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], (branch) => {
1961
+ setupBranch(catchContent, branch);
1962
+ catchContent[Params]?.(branch, [error]);
1963
+ }, -1);
1970
1964
  }
1971
1965
  }
1972
1966
  function findTryWithPlaceholder(scope) {
@@ -2031,27 +2025,33 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
2031
2025
  const scopeOffsetAccessor = getTagVar && getDebugKey(+nodeAccessor.slice(nodeAccessor.lastIndexOf("/") + 1) + 1, "#scopeOffset");
2032
2026
  const childScopeAccessor = BranchScopes$1 + nodeAccessor;
2033
2027
  const rendererAccessor = ConditionalRenderer + nodeAccessor;
2028
+ const createTagBranch = ($global, tagNameOrRenderer, scope, parentNode) => {
2029
+ if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
2030
+ const branch = createBranch($global, tagNameOrRenderer, scope, parentNode);
2031
+ if (typeof tagNameOrRenderer === "string") branch[`#${tagNameOrRenderer.toLowerCase()}/0`] = branch[StartNode] = branch[EndNode] = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer);
2032
+ if (getTagVar) {
2033
+ branch[TagVariable] = (value) => getTagVar()(scope, value);
2034
+ bindTagVar(scope, branch, scope[scopeOffsetAccessor], tagNameOrRenderer);
2035
+ }
2036
+ if (typeof tagNameOrRenderer !== "string") setupBranch(tagNameOrRenderer, branch);
2037
+ else if (getContent) {
2038
+ const content = getContent(scope);
2039
+ const elementAccessor = `#${tagNameOrRenderer.toLowerCase()}/0`;
2040
+ setBranch(branch, elementAccessor, content, createAndSetupBranch);
2041
+ if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], branch[BranchScopes$1 + elementAccessor]);
2042
+ }
2043
+ return branch;
2044
+ };
2034
2045
  return (scope, newRenderer, getInput) => {
2035
2046
  const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
2036
2047
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer) || (getContent ? void 0 : 0)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
2037
- const renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
2038
- setBranch(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer);
2039
- if (getTagVar) {
2040
- if (normalizedRenderer) {
2041
- scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
2042
- bindTagVar(scope, scope[childScopeAccessor], scope[scopeOffsetAccessor], normalizedRenderer);
2043
- } else getTagVar()(scope);
2044
- }
2045
- if (typeof renderer === "string") {
2046
- if (getContent) {
2047
- const content = getContent(scope);
2048
- setBranch(scope[childScopeAccessor], `#${renderer.toLowerCase()}/0`, content, createAndSetupBranch);
2049
- if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${renderer.toLowerCase()}/0`]);
2050
- }
2051
- } else if (renderer) {
2052
- setupBranch(renderer, scope[childScopeAccessor]);
2053
- if (renderer["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2048
+ let renderer = normalizedRenderer;
2049
+ if (renderer) setBranch(scope, nodeAccessor, renderer, createTagBranch);
2050
+ else {
2051
+ if (getTagVar) getTagVar()(scope);
2052
+ setBranch(scope, nodeAccessor, renderer = getContent ? getContent(scope) : void 0, createAndSetupBranch);
2054
2053
  }
2054
+ if (typeof renderer !== "string" && renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2055
2055
  }
2056
2056
  if (normalizedRenderer) {
2057
2057
  const childScope = scope[childScopeAccessor];
@@ -2121,7 +2121,7 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2121
2121
  return (scope, value) => {
2122
2122
  const referenceNode = scope[nodeAccessor];
2123
2123
  const oldScopes = toArray(scope[scopesAccessor]);
2124
- const newScopes = scope[scopesAccessor] = [];
2124
+ const newScopes = [];
2125
2125
  scope[keyedScopesAccessor] = null;
2126
2126
  const oldLen = oldScopes.length;
2127
2127
  const parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.["#StartNode"].parentNode : referenceNode;
@@ -2137,11 +2137,15 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2137
2137
  if (branch) {
2138
2138
  hasPotentialMoves = true;
2139
2139
  oldScopesByKey?.delete(key);
2140
- } else branch = createAndSetupBranch(scope[Global], renderer, scope, parentNode);
2141
- branch[LoopKey] = key;
2140
+ branch[LoopKey] = key;
2141
+ } else {
2142
+ (branch = createBranch(scope[Global], renderer, scope, parentNode))[LoopKey] = key;
2143
+ setupBranch(renderer, branch);
2144
+ }
2142
2145
  newScopes.push(branch);
2143
2146
  params?.(branch, args);
2144
2147
  });
2148
+ scope[scopesAccessor] = newScopes;
2145
2149
  const newLen = newScopes.length;
2146
2150
  const hasSiblings = referenceNode !== parentNode;
2147
2151
  let afterReference = null;
@@ -2238,12 +2242,6 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
2238
2242
  afterReference = newScopes[start + i][StartNode];
2239
2243
  }
2240
2244
  }
2241
- function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
2242
- if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
2243
- const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
2244
- if (typeof tagNameOrRenderer === "string") branch[`#${tagNameOrRenderer.toLowerCase()}/0`] = branch[StartNode] = branch[EndNode] = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer);
2245
- return branch;
2246
- }
2247
2245
  function bySecondArg(_item, index) {
2248
2246
  return index;
2249
2247
  }
@@ -2323,6 +2321,12 @@ Object.defineProperty(exports, "Load", {
2323
2321
  return Load;
2324
2322
  }
2325
2323
  });
2324
+ Object.defineProperty(exports, "LocalClosures", {
2325
+ enumerable: true,
2326
+ get: function() {
2327
+ return LocalClosures;
2328
+ }
2329
+ });
2326
2330
  Object.defineProperty(exports, "Owner", {
2327
2331
  enumerable: true,
2328
2332
  get: function() {
@@ -2635,12 +2639,6 @@ Object.defineProperty(exports, "_call", {
2635
2639
  return _call;
2636
2640
  }
2637
2641
  });
2638
- Object.defineProperty(exports, "_child_setup", {
2639
- enumerable: true,
2640
- get: function() {
2641
- return _child_setup;
2642
- }
2643
- });
2644
2642
  Object.defineProperty(exports, "_closure", {
2645
2643
  enumerable: true,
2646
2644
  get: function() {