marko 6.4.6 → 6.4.7

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 (85) 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 +6946 -6830
  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 +4 -1
  75. package/dist/translator/util/optional.d.ts +1 -1
  76. package/dist/translator/util/reasons.d.ts +4 -1
  77. package/dist/translator/util/references.d.ts +2 -0
  78. package/dist/translator/util/sections.d.ts +5 -5
  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/state.d.ts +4 -2
  82. package/dist/translator/visitors/import-declaration.d.ts +2 -0
  83. package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
  84. package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
  85. package/package.json +4 -4
@@ -532,7 +532,7 @@ function push(opt, item) {
532
532
  //#region src/dom/event.ts
533
533
  function _on(element, type, handler) {
534
534
  assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
535
- if (element[1 + type] === void 0) delegate(type, handleDelegated);
535
+ delegate(type, handleDelegated);
536
536
  element[1 + type] = handler || null;
537
537
  }
538
538
  const delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, true), 1);
@@ -641,7 +641,7 @@ function schedule() {
641
641
  if (!isScheduled) {
642
642
  if (console.createTask) {
643
643
  const task = console.createTask("queue");
644
- runTask = () => task.run(run);
644
+ runTask = (_) => task.run(run);
645
645
  } else runTask = run;
646
646
  isScheduled = 1;
647
647
  queueMicrotask(flushAndWaitFrame);
@@ -654,7 +654,7 @@ function flushAndWaitFrame() {
654
654
  function triggerMacroTask() {
655
655
  if (!channel) {
656
656
  channel = new MessageChannel();
657
- channel.port1.onmessage = () => {
657
+ channel.port1.onmessage = (_) => {
658
658
  isScheduled = 0;
659
659
  {
660
660
  const run = runTask;
@@ -719,22 +719,22 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
719
719
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
720
720
  const ownerSignal = (ownerScope) => {
721
721
  const scopes = toArray(ownerScope[scopeAccessor]);
722
- queueRender(ownerScope, () => {
722
+ queueRender(ownerScope, (_) => {
723
723
  for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
724
724
  }, -1);
725
725
  };
726
- ownerSignal._ = fn;
726
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
727
727
  return ownerSignal;
728
728
  }
729
- function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccessor, fn) {
729
+ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
730
730
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
731
731
  const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
732
732
  const prevKeyProp = `${PreviousKey}${ownerValueAccessor}`;
733
733
  const ownerSignal = (ownerScope) => {
734
734
  if (ownerScope["#Gen"] < runId) {
735
735
  const nextKey = ownerScope[ownerValueAccessor];
736
- queueRender(ownerScope, () => {
737
- const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor);
736
+ queueRender(ownerScope, (_) => {
737
+ const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
738
738
  if (map && prevKeyProp in map) {
739
739
  const prevScope = map.get(map[prevKeyProp]);
740
740
  const nextScope = map.get(nextKey);
@@ -747,15 +747,14 @@ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccess
747
747
  }, -1);
748
748
  }
749
749
  };
750
- ownerSignal._ = fn;
750
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
751
751
  return ownerSignal;
752
752
  }
753
- function keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor) {
753
+ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
754
754
  const map = ownerScope[mapAccessor] ||= /* @__PURE__ */ new Map();
755
755
  if (!map.size) for (const scope of toArray(ownerScope[scopeAccessor])) {
756
- const key = scope["#LoopKey"] ?? scope[keyValueAccessor];
756
+ const key = scope[LoopKey];
757
757
  if (key === void 0) return ownerScope[mapAccessor] = null;
758
- scope[LoopKey] = key;
759
758
  map.set(key, scope);
760
759
  }
761
760
  return map;
@@ -770,11 +769,11 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
770
769
  const ifScope = scope[scopeAccessor];
771
770
  if (ifScope && ifScope["#Gen"] > 0 && ifScope["#Gen"] < runId && (scope[branchAccessor] || 0) === branch) queueRender(ifScope, fn, -1);
772
771
  };
773
- ownerSignal._ = fn;
772
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
774
773
  return ownerSignal;
775
774
  }
776
- function subscribeToScopeSet(ownerScope, accessor, scope) {
777
- const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
775
+ function subscribeToScopeSet(owner, accessor, scope) {
776
+ const subscribers = owner[accessor] ||= /* @__PURE__ */ new Set();
778
777
  const { size } = subscribers;
779
778
  if (subscribers.add(scope).size !== size) trackCleanup(scope, subscribers);
780
779
  }
@@ -786,7 +785,7 @@ function _closure(...closureSignals) {
786
785
  return (scope) => {
787
786
  if (scope[scopeInstances]) {
788
787
  scope[scopeInstances][Changed] = 1;
789
- for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
788
+ for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) closureSignals[childScope[signalIndex] || 0](childScope);
790
789
  }
791
790
  };
792
791
  }
@@ -794,22 +793,15 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
794
793
  const closureSignal = ((scope, resumed) => {
795
794
  const ownerScope = getOwnerScope ? getOwnerScope(scope) : scope["_"];
796
795
  scope[closureSignal[SignalIndexAccessor]] = closureSignal[Index];
797
- if (!resumed) fn(scope);
798
- else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, closureSignal);
799
796
  subscribeToScopeSet(ownerScope, closureSignal[ScopeInstancesAccessor], scope);
797
+ if (!resumed) queueRender(scope, fn, -1);
798
+ else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, fn);
800
799
  });
801
800
  closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
802
801
  closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
803
802
  if (resumeId) _resumed[resumeId] = (scope) => closureSignal(scope, 1);
804
803
  return closureSignal;
805
804
  }
806
- function _child_setup(setup) {
807
- setup._ = (scope, owner) => {
808
- scope["_"] ||= owner;
809
- queueRender(scope, setup, -1);
810
- };
811
- return setup;
812
- }
813
805
  function _var(scope, childAccessor, signal) {
814
806
  const childScope = scope[childAccessor];
815
807
  childScope[TagVariable] = (value) => signal(scope, value);
@@ -825,13 +817,13 @@ const _var_change = (scope, value, name = "This") => {
825
817
  };
826
818
  const tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
827
819
  function _id(scope, accessor) {
828
- let id = accessor !== void 0 && scope[accessor];
820
+ let id = accessor && scope[accessor];
829
821
  if (!id) {
830
822
  const $global = scope[Global];
831
823
  const n = tagIdsByGlobal.get($global) || 0;
832
824
  tagIdsByGlobal.set($global, n + 1);
833
825
  id = "c" + $global.runtimeId + $global.renderId + n.toString(36);
834
- if (accessor !== void 0) scope[accessor] = id;
826
+ if (accessor) scope[accessor] = id;
835
827
  }
836
828
  return id;
837
829
  }
@@ -865,7 +857,7 @@ function* traverse(scope, path, args, i = path.length - 1) {
865
857
  function _hoist(...path) {
866
858
  return (scope) => {
867
859
  const fn = (...args) => traverse(scope, path, args).next().value;
868
- fn[Symbol.iterator] = () => traverse(scope, path, []);
860
+ fn[Symbol.iterator] = (_) => traverse(scope, path, []);
869
861
  return fn;
870
862
  };
871
863
  }
@@ -899,7 +891,11 @@ const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
899
891
  if (value === 48) scope[getDebugKey(currentScopeIndex++, "#scopeOffset")] = skipScope();
900
892
  } else if (value < 92) {
901
893
  value = 25 * currentMultiplier + value - 67;
902
- while (value--) walkNextNode();
894
+ while (value--) if (currentNode.firstChild) currentNode = currentNode.firstChild;
895
+ else {
896
+ while (!currentNode.nextSibling && currentNode.parentNode) currentNode = currentNode.parentNode;
897
+ walkNextSibling();
898
+ }
903
899
  } else if (value < 107) {
904
900
  value = 10 * currentMultiplier + value - 97;
905
901
  while (value--) walkNextSibling();
@@ -920,12 +916,7 @@ function getDebugKey(index, node) {
920
916
  else if (node.nodeType === 1) return `#${node.tagName.toLowerCase()}/${index}`;
921
917
  return index;
922
918
  }
923
- const walkNextNode = () => {
924
- if (currentNode.firstChild) return currentNode = currentNode.firstChild;
925
- while (!currentNode.nextSibling && currentNode.parentNode) currentNode = currentNode.parentNode;
926
- walkNextSibling();
927
- };
928
- const walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode;
919
+ const walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode;
929
920
  //#endregion
930
921
  //#region src/dom/resume.ts
931
922
  const _resumed = {};
@@ -949,7 +940,7 @@ function withLazy() {
949
940
  function initEmbedded(readyId, runtimeId) {
950
941
  if (!embedRenders) {
951
942
  embedRenders = /* @__PURE__ */ new Map();
952
- new MutationObserver(() => {
943
+ new MutationObserver((_) => {
953
944
  for (const [anchor, [renderId, scopes]] of embedRenders) if (!anchor.isConnected) {
954
945
  embedRenders.delete(anchor);
955
946
  delete curRenders[renderId];
@@ -977,7 +968,7 @@ function init(runtimeId = "M") {
977
968
  const scopeLookup = {};
978
969
  const pending = [];
979
970
  const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
980
- const initGlobal = () => scopeLookup[0] ||= {
971
+ const initGlobal = (_) => scopeLookup[0] ||= {
981
972
  runtimeId,
982
973
  renderId
983
974
  };
@@ -1051,7 +1042,7 @@ function init(runtimeId = "M") {
1051
1042
  } else pending.push(visitScope);
1052
1043
  };
1053
1044
  };
1054
- const nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1045
+ const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1055
1046
  const processResumes = (resumes = [], effects) => {
1056
1047
  let i = 0;
1057
1048
  for (; i < resumes.length; i++) {
@@ -1125,7 +1116,7 @@ function init(runtimeId = "M") {
1125
1116
  visits.length = retained;
1126
1117
  return effects;
1127
1118
  };
1128
- render.w = () => {
1119
+ render.w = (_) => {
1129
1120
  walk();
1130
1121
  runResumeEffects(render);
1131
1122
  };
@@ -1157,10 +1148,10 @@ function _var_resume(id, signal) {
1157
1148
  return signal;
1158
1149
  }
1159
1150
  function _el(id, accessor) {
1160
- return _resumed[id] = (scope) => () => _el_read(scope[accessor]);
1151
+ return _resumed[id] = (scope) => (_) => _el_read(scope[accessor]);
1161
1152
  }
1162
1153
  function _dynamic_tag_var_resume(accessor) {
1163
- _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => () => {
1154
+ _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => (_) => {
1164
1155
  const node = scope[accessor];
1165
1156
  return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1166
1157
  };
@@ -1186,11 +1177,11 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1186
1177
  return setupBranch(renderer, createBranch($global, renderer, parentScope, parentNode));
1187
1178
  }
1188
1179
  function setupBranch(renderer, branch) {
1189
- if (renderer["setup"]) queueRender(branch, renderer[Setup], -1);
1180
+ renderer[Setup]?.(branch);
1190
1181
  return branch;
1191
1182
  }
1192
1183
  function _return_setup(setup) {
1193
- (setup._ || setup)[Returns] = 1;
1184
+ setup[Returns] = 1;
1194
1185
  return setup;
1195
1186
  }
1196
1187
  function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
@@ -1229,14 +1220,15 @@ function _content_closures(renderer, closureFns) {
1229
1220
  for (const key in closureFns) closureSignals[key] = _const(key, closureFns[key]);
1230
1221
  return (owner, closureValues) => {
1231
1222
  const instance = renderer(owner);
1232
- const clone = instance[Clone];
1223
+ const setup = instance[Setup];
1233
1224
  const setClosures = instance[LocalClosures] = (branch) => {
1234
1225
  for (const key in closureSignals) closureSignals[key](branch, closureValues[key]);
1235
1226
  };
1236
- instance[Clone] = (branch, ns) => {
1237
- clone(branch, ns);
1227
+ instance[Setup] = (branch) => {
1228
+ setup?.(branch);
1238
1229
  setClosures(branch);
1239
1230
  };
1231
+ instance[Setup][Returns] = (setup || instance["params"])?.[Returns];
1240
1232
  return instance;
1241
1233
  };
1242
1234
  }
@@ -1443,7 +1435,7 @@ function _lifecycle(scope, thisObj, index = 0) {
1443
1435
  Object.assign(thisObj, thisObj.onMount?.());
1444
1436
  for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
1445
1437
  }
1446
- trackAbort(scope, accessor, () => thisObj.onDestroy?.());
1438
+ trackAbort(scope, accessor, (_) => thisObj.onDestroy?.());
1447
1439
  }
1448
1440
  }
1449
1441
  function removeChildNodes(startNode, endNode) {
@@ -1514,7 +1506,7 @@ function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
1514
1506
  }
1515
1507
  function _attr_input_checked_script(scope, nodeAccessor) {
1516
1508
  const el = scope[nodeAccessor];
1517
- syncControllableFormInput(el, hasCheckboxChanged, () => {
1509
+ syncControllableFormInput(el, hasCheckboxChanged, (_) => {
1518
1510
  const checkedChange = scope[ControlledHandler + nodeAccessor];
1519
1511
  if (checkedChange) {
1520
1512
  const newValue = el.checked;
@@ -1549,7 +1541,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
1549
1541
  if (scope["ControlledValue:" + nodeAccessor]) scope[ControlledValue + nodeAccessor].push(el.value);
1550
1542
  else scope[ControlledValue + nodeAccessor] = el.value;
1551
1543
  }
1552
- syncControllableFormInput(el, hasCheckboxChanged, () => {
1544
+ syncControllableFormInput(el, hasCheckboxChanged, (_) => {
1553
1545
  const checkedValueChange = scope[ControlledHandler + nodeAccessor];
1554
1546
  if (checkedValueChange) {
1555
1547
  const controlledValueKey = ControlledValue + nodeAccessor;
@@ -1621,7 +1613,7 @@ function _attr_select_value_default(scope, nodeAccessor, value) {
1621
1613
  const live = scope[Gen$1] < runId;
1622
1614
  const multiple = Array.isArray(value);
1623
1615
  const normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
1624
- pendingEffects.unshift(() => {
1616
+ pendingEffects.unshift((_) => {
1625
1617
  for (const opt of el.options) {
1626
1618
  const selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
1627
1619
  if (opt.defaultSelected !== selected) {
@@ -1640,13 +1632,13 @@ function _attr_select_value(scope, nodeAccessor, value, valueChange) {
1640
1632
  assertHandlerIsFunction("valueChange", valueChange);
1641
1633
  scope[ControlledHandler + nodeAccessor] = valueChange;
1642
1634
  scope[ControlledType + nodeAccessor] = valueChange ? 3 : 5;
1643
- if (valueChange) pendingEffects.unshift(() => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
1644
- if (valueChange && existing) pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope);
1635
+ if (valueChange) pendingEffects.unshift((_) => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
1636
+ if (valueChange && existing) pendingEffects.unshift((_) => setSelectValue(el, normalizedValue, multiple), scope);
1645
1637
  else _attr_select_value_default(scope, nodeAccessor, normalizedValue);
1646
1638
  }
1647
1639
  function _attr_select_value_script(scope, nodeAccessor) {
1648
1640
  const el = scope[nodeAccessor];
1649
- const onChange = () => {
1641
+ const onChange = (_) => {
1650
1642
  const valueChange = scope[ControlledHandler + nodeAccessor];
1651
1643
  if (valueChange) {
1652
1644
  const oldValue = scope[ControlledValue + nodeAccessor];
@@ -1673,7 +1665,7 @@ function _attr_select_value_script(scope, nodeAccessor) {
1673
1665
  observeControlled(scope, nodeAccessor, {
1674
1666
  childList: true,
1675
1667
  subtree: true
1676
- }, () => {
1668
+ }, (_) => {
1677
1669
  const value = scope[ControlledValue + nodeAccessor];
1678
1670
  if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) onChange();
1679
1671
  });
@@ -1705,7 +1697,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
1705
1697
  observeControlled(scope, nodeAccessor, {
1706
1698
  attributes: true,
1707
1699
  attributeFilter: ["open"]
1708
- }, () => {
1700
+ }, (_) => {
1709
1701
  const openChange = scope[ControlledHandler + nodeAccessor];
1710
1702
  if (openChange && el.open === !scope["ControlledValue:" + nodeAccessor]) {
1711
1703
  const newValue = el.open;
@@ -1731,7 +1723,7 @@ function handleChange(ev) {
1731
1723
  function handleFormReset(ev) {
1732
1724
  const handlers = [];
1733
1725
  for (const el of ev.target.elements || []) if (el._ && el.c(el)) handlers.push(el._);
1734
- requestAnimationFrame(() => {
1726
+ requestAnimationFrame((_) => {
1735
1727
  if (!ev.defaultPrevented) for (const change of handlers) change();
1736
1728
  });
1737
1729
  }
@@ -1803,11 +1795,11 @@ function _await_promise(nodeAccessor, params) {
1803
1795
  let awaitBranch = scope[branchAccessor];
1804
1796
  const tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
1805
1797
  if (!tryBranch) {
1806
- const deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1798
+ const deferred = scope[promiseAccessor] = (_) => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1807
1799
  const awaitCounter = findTryWithPlaceholder(scope)?.[AwaitCounter];
1808
1800
  if (awaitCounter?.i) {
1809
1801
  const complete = awaitCounter.c;
1810
- awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
1802
+ awaitCounter.c = (_) => complete() || queueAsyncRender(scope, deferred);
1811
1803
  }
1812
1804
  return;
1813
1805
  }
@@ -1815,14 +1807,14 @@ function _await_promise(nodeAccessor, params) {
1815
1807
  let awaitCounter = tryBranch[AwaitCounter];
1816
1808
  if (!scope[tryAccessor]) {
1817
1809
  scope[tryAccessor] = tryBranch;
1818
- trackAbort(scope, promiseAccessor, () => {
1810
+ trackAbort(scope, promiseAccessor, (_) => {
1819
1811
  scope[promiseAccessor] = 0;
1820
1812
  if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
1821
1813
  });
1822
1814
  if (awaitBranch) awaitBranch[PendingRenders] ||= [];
1823
1815
  if (tryBranch !== awaitBranch) awaitCounter = startAwait(scope, tryBranch);
1824
1816
  else {
1825
- if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
1817
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, (_) => {
1826
1818
  if (tryBranch === scope[branchAccessor]) {
1827
1819
  const anchor = scope[nodeAccessor];
1828
1820
  if (anchor.parentNode) {
@@ -1832,7 +1824,7 @@ function _await_promise(nodeAccessor, params) {
1832
1824
  }
1833
1825
  }
1834
1826
  });
1835
- countAwait(awaitCounter, scope, () => {
1827
+ countAwait(awaitCounter, scope, (_) => {
1836
1828
  if (!awaitBranch["#DetachedAwait"]) {
1837
1829
  awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
1838
1830
  tempDetachBranch(tryBranch);
@@ -1849,7 +1841,7 @@ function _await_promise(nodeAccessor, params) {
1849
1841
  awaitPromise(scope, data);
1850
1842
  awaitCounter.c();
1851
1843
  run();
1852
- } else queueAsyncRender(scope, () => {
1844
+ } else queueAsyncRender(scope, (_) => {
1853
1845
  if (!scope[promiseAccessor]) {
1854
1846
  awaitBranch = resolveAwait(scope, referenceNode, data);
1855
1847
  const pendingRenders = awaitBranch[PendingRenders];
@@ -1875,19 +1867,17 @@ function _await_promise(nodeAccessor, params) {
1875
1867
  }
1876
1868
  function _await_content(nodeAccessor, template, walks, setup) {
1877
1869
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1878
- const promiseAccessor = Promise$1 + nodeAccessor;
1879
1870
  const renderer = _content("", template, walks, setup)();
1880
1871
  return (scope) => {
1881
- const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
1872
+ const pendingScopes = collectScopes((_) => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
1882
1873
  scope[branchAccessor][PendingScopes] = pendingScopes;
1883
- if (typeof scope[promiseAccessor] === "function") scope[promiseAccessor]();
1884
1874
  };
1885
1875
  }
1886
1876
  function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1887
1877
  if (!tryBranch) return;
1888
1878
  let awaitCounter = tryBranch[AwaitCounter];
1889
- if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
1890
- countAwait(awaitCounter, tryBranch, () => {
1879
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, (_) => dismissPlaceholder(tryBranch));
1880
+ countAwait(awaitCounter, tryBranch, (_) => {
1891
1881
  (tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent](), tryBranch["_"], tryBranch[StartNode].parentNode))[TryBranch] = tryBranch;
1892
1882
  insertBranchBefore(tryBranch[PlaceholderBranch], tryBranch[StartNode].parentNode, tryBranch[StartNode]);
1893
1883
  tempDetachBranch(tryBranch);
@@ -1895,7 +1885,7 @@ function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1895
1885
  return awaitCounter;
1896
1886
  }
1897
1887
  function countAwait(awaitCounter, scope, render) {
1898
- if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
1888
+ if (!awaitCounter.i++) requestAnimationFrame((_) => awaitCounter.i && runEffects(prepareEffects((_) => queueRender(scope, render, -1))));
1899
1889
  }
1900
1890
  function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
1901
1891
  queueRender(tryBranch, completeAwaitCounter, -1, awaitCounter, tryBranch["#Id"] + 1e9);
@@ -1943,13 +1933,14 @@ function dismissPlaceholder(tryBranch) {
1943
1933
  }
1944
1934
  function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
1945
1935
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1946
- const renderer = _content("", template, walks, setup)();
1936
+ const renderer = _content("", template, walks)();
1947
1937
  return (scope) => {
1948
- setBranch(scope, nodeAccessor, renderer, createAndSetupBranch);
1938
+ setBranch(scope, nodeAccessor, renderer, createBranch);
1949
1939
  const branch = scope[branchAccessor];
1950
1940
  branch[BranchAccessor] = nodeAccessor;
1951
1941
  branch[CatchContent] = catchContent;
1952
1942
  branch[PlaceholderContent] = placeholderContent || void 0;
1943
+ if (setup) queueRender(branch, setup, -1);
1953
1944
  };
1954
1945
  }
1955
1946
  function renderCatch(scope, error) {
@@ -1964,8 +1955,11 @@ function renderCatch(scope, error) {
1964
1955
  destroyBranch(tryWithCatch);
1965
1956
  }
1966
1957
  const catchContent = tryWithCatch[CatchContent]();
1967
- setBranch(owner, tryWithCatch[BranchAccessor], catchContent, createAndSetupBranch);
1968
- catchContent[Params]?.(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], [error]);
1958
+ setBranch(owner, tryWithCatch[BranchAccessor], catchContent, createBranch);
1959
+ queueRender(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], (branch) => {
1960
+ setupBranch(catchContent, branch);
1961
+ catchContent[Params]?.(branch, [error]);
1962
+ }, -1);
1969
1963
  }
1970
1964
  }
1971
1965
  function findTryWithPlaceholder(scope) {
@@ -2030,27 +2024,33 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
2030
2024
  const scopeOffsetAccessor = getTagVar && getDebugKey(+nodeAccessor.slice(nodeAccessor.lastIndexOf("/") + 1) + 1, "#scopeOffset");
2031
2025
  const childScopeAccessor = BranchScopes$1 + nodeAccessor;
2032
2026
  const rendererAccessor = ConditionalRenderer + nodeAccessor;
2027
+ const createTagBranch = ($global, tagNameOrRenderer, scope, parentNode) => {
2028
+ if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
2029
+ const branch = createBranch($global, tagNameOrRenderer, scope, parentNode);
2030
+ 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);
2031
+ if (getTagVar) {
2032
+ branch[TagVariable] = (value) => getTagVar()(scope, value);
2033
+ bindTagVar(scope, branch, scope[scopeOffsetAccessor], tagNameOrRenderer);
2034
+ }
2035
+ if (typeof tagNameOrRenderer !== "string") setupBranch(tagNameOrRenderer, branch);
2036
+ else if (getContent) {
2037
+ const content = getContent(scope);
2038
+ const elementAccessor = `#${tagNameOrRenderer.toLowerCase()}/0`;
2039
+ setBranch(branch, elementAccessor, content, createAndSetupBranch);
2040
+ if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], branch[BranchScopes$1 + elementAccessor]);
2041
+ }
2042
+ return branch;
2043
+ };
2033
2044
  return (scope, newRenderer, getInput) => {
2034
2045
  const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
2035
2046
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer) || (getContent ? void 0 : 0)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
2036
- const renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
2037
- setBranch(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer);
2038
- if (getTagVar) {
2039
- if (normalizedRenderer) {
2040
- scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
2041
- bindTagVar(scope, scope[childScopeAccessor], scope[scopeOffsetAccessor], normalizedRenderer);
2042
- } else getTagVar()(scope);
2043
- }
2044
- if (typeof renderer === "string") {
2045
- if (getContent) {
2046
- const content = getContent(scope);
2047
- setBranch(scope[childScopeAccessor], `#${renderer.toLowerCase()}/0`, content, createAndSetupBranch);
2048
- if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${renderer.toLowerCase()}/0`]);
2049
- }
2050
- } else if (renderer) {
2051
- setupBranch(renderer, scope[childScopeAccessor]);
2052
- if (renderer["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2047
+ let renderer = normalizedRenderer;
2048
+ if (renderer) setBranch(scope, nodeAccessor, renderer, createTagBranch);
2049
+ else {
2050
+ if (getTagVar) getTagVar()(scope);
2051
+ setBranch(scope, nodeAccessor, renderer = getContent ? getContent(scope) : void 0, createAndSetupBranch);
2053
2052
  }
2053
+ if (typeof renderer !== "string" && renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2054
2054
  }
2055
2055
  if (normalizedRenderer) {
2056
2056
  const childScope = scope[childScopeAccessor];
@@ -2120,7 +2120,7 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2120
2120
  return (scope, value) => {
2121
2121
  const referenceNode = scope[nodeAccessor];
2122
2122
  const oldScopes = toArray(scope[scopesAccessor]);
2123
- const newScopes = scope[scopesAccessor] = [];
2123
+ const newScopes = [];
2124
2124
  scope[keyedScopesAccessor] = null;
2125
2125
  const oldLen = oldScopes.length;
2126
2126
  const parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.["#StartNode"].parentNode : referenceNode;
@@ -2136,11 +2136,15 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2136
2136
  if (branch) {
2137
2137
  hasPotentialMoves = true;
2138
2138
  oldScopesByKey?.delete(key);
2139
- } else branch = createAndSetupBranch(scope[Global], renderer, scope, parentNode);
2140
- branch[LoopKey] = key;
2139
+ branch[LoopKey] = key;
2140
+ } else {
2141
+ (branch = createBranch(scope[Global], renderer, scope, parentNode))[LoopKey] = key;
2142
+ setupBranch(renderer, branch);
2143
+ }
2141
2144
  newScopes.push(branch);
2142
2145
  params?.(branch, args);
2143
2146
  });
2147
+ scope[scopesAccessor] = newScopes;
2144
2148
  const newLen = newScopes.length;
2145
2149
  const hasSiblings = referenceNode !== parentNode;
2146
2150
  let afterReference = null;
@@ -2237,12 +2241,6 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
2237
2241
  afterReference = newScopes[start + i][StartNode];
2238
2242
  }
2239
2243
  }
2240
- function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
2241
- if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
2242
- const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
2243
- 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);
2244
- return branch;
2245
- }
2246
2244
  function bySecondArg(_item, index) {
2247
2245
  return index;
2248
2246
  }
@@ -2250,4 +2248,4 @@ function byFirstArg(name) {
2250
2248
  return name;
2251
2249
  }
2252
2250
  //#endregion
2253
- export { _attr_style_items as $, insertBranchBefore as $t, _attr_input_value as A, Params as An, withLazy as At, _controllable_select as B, Global as Bn, _hoist_resume as Bt, _attr_details_or_dialog_open_script as C, _assert_hoist as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, Clone as Dn, initEmbedded as Dt, _attr_input_checkedValue_default as E, withBranches as En, init as Et, _attr_select_value as F, AwaitCounter as Fn, _el_read as Ft, _attr_class as G, PendingRenders as Gn, _or as Gt, controllableScripts as H, ParentBranch as Hn, _if_closure as Ht, _attr_select_value_default as I, BranchRenders as In, _for_closure as It, _attr_class_names as J, TagVariable as Jn, _script as Jt, _attr_class_item as K, PlaceholderBranch as Kn, _return as Kt, _attr_select_value_script as L, ClosestBranch as Ln, _for_selector as Lt, _attr_input_value_default as M, Setup as Mn, _closure as Mt, _attr_input_value_dynamic_default as N, Pending as Nn, _closure_get as Nt, _attr_input_checked_default as O, Lazy as On, ready as Ot, _attr_input_value_script as P, Scope as Pn, _const as Pt, _attr_style_item as Q, destroyBranch as Qt, _controllable_input as R, EndNode as Rn, _global_read as Rt, _attr_details_or_dialog_open_default as S, _assert_class_toggles as Sn, _el as St, _attr_input_checkedValue as T, _call as Tn, getRegisteredWithScope as Tt, controllableSpreadHelpers as U, PendingEffectScopes as Un, _let as Ut, _controllable_textarea as V, Load as Vn, _id as Vt, _attr as W, PendingEffects as Wn, _let_change as Wt, _attr_nonce as X, _var_change as Xt, _attr_content as Y, _var as Yt, _attr_style as Z, _assert_init as Zt, patchDynamicTag as _, runId as _n, _return_setup as _t, _for_in as a, $signal as an, _html as at, startAwait as b, forTo as bn, setupBranch as bt, _for_to as c, installBranchRenders as cn, _style_shell as ct, _for_until_unkeyed as d, queueAsyncRender as dn, _to_text as dt, removeAndDestroyBranch as en, _attrs as et, _if as f, queueEffect as fn, insertChildNodes as ft, installDynamicTagVar as g, runEffects as gn, _content_resume as gt, dynamicTagScript as h, run as hn, _content_closures as ht, _dynamic_tag_content as i, _on as in, _attrs_script as it, _attr_input_value_attribute_default as j, Returns as jn, _child_setup as jt, _attr_input_checked_script as k, Owner as kn, readyFailed as kt, _for_to_unkeyed as l, installCatch as ln, _text as lt, _try as m, rendering as mn, _content as mt, _await_promise as n, DYNAMIC_TAG_SCRIPT_REGISTER_ID as nn, _attrs_partial as nt, _for_of as o, $signalReset as on, _lifecycle as ot, _show as p, queueRender as pn, toInsertNode as pt, _attr_class_items as q, StartNode as qn, _return_change as qt, _dynamic_tag as r, PLACEHOLDER_DISMISS_REGISTER_ID as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, createBranchRenders as sn, _style_rule_item as st, _await_content as t, syncGen as tn, _attrs_content as tt, _for_until as u, prepareEffects as un, _text_content as ut, renderCatch as v, forIn as vn, createAndSetupBranch as vt, _attr_input_checked as w, _hoist_read_error as wn, _var_resume as wt, _attr_details_or_dialog_open as x, forUntil as xn, _dynamic_tag_var_resume as xt, runPendingEffects as y, forOf as yn, createBranch as yt, _controllable_open as z, Gen$1 as zn, _hoist as zt };
2251
+ export { _attr_style_items as $, removeAndDestroyBranch as $t, _attr_input_value as A, Params as An, withLazy as At, _controllable_select as B, Global as Bn, _id as Bt, _attr_details_or_dialog_open_script as C, _hoist_read_error as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, Lazy as Dn, initEmbedded as Dt, _attr_input_checkedValue_default as E, Clone as En, init as Et, _attr_select_value as F, AwaitCounter as Fn, _for_closure as Ft, _attr_class as G, PendingRenders as Gn, _return as Gt, controllableScripts as H, ParentBranch as Hn, _let as Ht, _attr_select_value_default as I, BranchRenders as In, _for_selector as It, _attr_class_names as J, TagVariable as Jn, _var as Jt, _attr_class_item as K, PlaceholderBranch as Kn, _return_change as Kt, _attr_select_value_script as L, ClosestBranch as Ln, _global_read as Lt, _attr_input_value_default as M, Setup as Mn, _closure_get as Mt, _attr_input_value_dynamic_default as N, Pending as Nn, _const as Nt, _attr_input_checked_default as O, LocalClosures as On, ready as Ot, _attr_input_value_script as P, Scope as Pn, _el_read as Pt, _attr_style_item as Q, insertBranchBefore as Qt, _controllable_input as R, EndNode as Rn, _hoist as Rt, _attr_details_or_dialog_open_default as S, _assert_hoist as Sn, _el as St, _attr_input_checkedValue as T, withBranches as Tn, getRegisteredWithScope as Tt, controllableSpreadHelpers as U, PendingEffectScopes as Un, _let_change as Ut, _controllable_textarea as V, Load as Vn, _if_closure as Vt, _attr as W, PendingEffects as Wn, _or as Wt, _attr_nonce as X, _assert_init as Xt, _attr_content as Y, _var_change as Yt, _attr_style as Z, destroyBranch as Zt, patchDynamicTag as _, forIn as _n, _return_setup as _t, _for_in as a, $signalReset as an, _html as at, startAwait as b, forUntil as bn, setupBranch as bt, _for_to as c, installCatch as cn, _style_shell as ct, _for_until_unkeyed as d, queueEffect as dn, _to_text as dt, syncGen as en, _attrs as et, _if as f, queueRender as fn, insertChildNodes as ft, installDynamicTagVar as g, runId as gn, _content_resume as gt, dynamicTagScript as h, runEffects as hn, _content_closures as ht, _dynamic_tag_content as i, $signal as in, _attrs_script as it, _attr_input_value_attribute_default as j, Returns as jn, _closure as jt, _attr_input_checked_script as k, Owner as kn, readyFailed as kt, _for_to_unkeyed as l, prepareEffects as ln, _text as lt, _try as m, run as mn, _content as mt, _await_promise as n, PLACEHOLDER_DISMISS_REGISTER_ID as nn, _attrs_partial as nt, _for_of as o, createBranchRenders as on, _lifecycle as ot, _show as p, rendering as pn, toInsertNode as pt, _attr_class_items as q, StartNode as qn, _script as qt, _dynamic_tag as r, _on as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, installBranchRenders as sn, _style_rule_item as st, _await_content as t, DYNAMIC_TAG_SCRIPT_REGISTER_ID as tn, _attrs_content as tt, _for_until as u, queueAsyncRender as un, _text_content as ut, renderCatch as v, forOf as vn, createAndSetupBranch as vt, _attr_input_checked as w, _call as wn, _var_resume as wt, _attr_details_or_dialog_open as x, _assert_class_toggles as xn, _dynamic_tag_var_resume as xt, runPendingEffects as y, forTo as yn, createBranch as yt, _controllable_open as z, Gen$1 as zn, _hoist_resume as zt };