marko 6.3.53 → 6.3.55

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 (79) hide show
  1. package/cheatsheet.md +1 -0
  2. package/dist/common/constants/renderer-prop.d.ts +0 -1
  3. package/dist/common/constants/renderer-prop.debug.d.ts +0 -1
  4. package/dist/common/helpers.d.ts +1 -0
  5. package/dist/debug/dom/catch.feat.js +1 -1
  6. package/dist/debug/dom/catch.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-input.feat.js +1 -1
  8. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-open.feat.js +1 -1
  10. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-select.feat.js +1 -1
  12. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable.feat.js +1 -1
  16. package/dist/debug/dom/controllable.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  19. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  20. package/dist/debug/dom/dynamic-tag-var.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-CBLlE8L-.js → dom-CI0Vojyk.js} +119 -78
  24. package/dist/debug/{dom-DQCODUa1.mjs → dom-tl43c2wO.mjs} +102 -79
  25. package/dist/debug/dom.js +9 -7
  26. package/dist/debug/dom.mjs +7 -8
  27. package/dist/debug/html.js +51 -25
  28. package/dist/debug/html.mjs +51 -25
  29. package/dist/dom/catch.feat.js +4 -4
  30. package/dist/dom/catch.feat.mjs +1 -1
  31. package/dist/dom/control-flow.d.ts +4 -1
  32. package/dist/dom/controllable-input.feat.js +2 -2
  33. package/dist/dom/controllable-input.feat.mjs +1 -1
  34. package/dist/dom/controllable-open.feat.js +2 -2
  35. package/dist/dom/controllable-open.feat.mjs +1 -1
  36. package/dist/dom/controllable-select.feat.js +2 -2
  37. package/dist/dom/controllable-select.feat.mjs +1 -1
  38. package/dist/dom/controllable-textarea.feat.js +2 -2
  39. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  40. package/dist/dom/controllable.feat.js +2 -2
  41. package/dist/dom/controllable.feat.mjs +1 -1
  42. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  43. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  44. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  45. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  46. package/dist/dom/load.d.ts +2 -2
  47. package/dist/dom/placeholder.feat.js +3 -3
  48. package/dist/dom/placeholder.feat.mjs +1 -1
  49. package/dist/dom/renderer.d.ts +2 -3
  50. package/dist/dom/signals.d.ts +1 -1
  51. package/dist/{dom-z4IMlmeO.mjs → dom-4udEPZaj.mjs} +71 -58
  52. package/dist/{dom-vuB05Hnj.js → dom-C1mr-TA7.js} +199 -176
  53. package/dist/dom.d.ts +1 -1
  54. package/dist/dom.js +40 -42
  55. package/dist/dom.mjs +6 -8
  56. package/dist/html/dynamic-tag.d.ts +2 -1
  57. package/dist/html/serializer.d.ts +3 -2
  58. package/dist/html/writer.d.ts +6 -5
  59. package/dist/html.js +34 -19
  60. package/dist/html.mjs +34 -19
  61. package/dist/translator/index.js +2890 -2688
  62. package/dist/translator/util/binding-has-prop.d.ts +1 -0
  63. package/dist/translator/util/branch-tag.d.ts +6 -1
  64. package/dist/translator/util/optional.d.ts +2 -0
  65. package/dist/translator/util/references.d.ts +20 -9
  66. package/dist/translator/util/runtime.d.ts +1 -0
  67. package/dist/translator/util/sections.d.ts +11 -6
  68. package/dist/translator/util/serialize-guard.d.ts +1 -1
  69. package/dist/translator/util/serialize-reasons.d.ts +3 -0
  70. package/dist/translator/util/set-tag-sections-downstream.d.ts +1 -1
  71. package/dist/translator/util/signals.d.ts +4 -1
  72. package/dist/translator/util/structure.d.ts +1 -1
  73. package/dist/translator/util/tag-name-type.d.ts +1 -1
  74. package/dist/translator/visitors/function.d.ts +1 -0
  75. package/dist/translator/visitors/import-declaration.d.ts +1 -0
  76. package/dist/translator/visitors/tag/custom-tag.d.ts +5 -0
  77. package/package.json +4 -4
  78. package/tags/try.d.marko +2 -0
  79. package/tags-html.d.ts +6 -0
@@ -55,25 +55,25 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
55
55
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
56
56
  return (scope, newRenderer, getInput) => {
57
57
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
58
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor] ? (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value), typeof normalizedRenderer == "string" && bindNativeTagVar?.(scope[childScopeAccessor])) : getTagVar()(scope, void 0)), typeof normalizedRenderer == "string") {
59
- if (getContent) {
60
- let content = getContent(scope);
61
- setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
62
- }
63
- } else normalizedRenderer?.f && subscribeToScopeSet(normalizedRenderer.e, normalizedRenderer.f, scope[childScopeAccessor]);
58
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
59
+ let renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
60
+ if (setConditionalRenderer(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor] ? (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value), typeof normalizedRenderer == "string" && bindNativeTagVar?.(scope[childScopeAccessor])) : getTagVar()(scope, void 0)), typeof renderer == "string") {
61
+ if (getContent) {
62
+ let content = getContent(scope);
63
+ setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
64
+ }
65
+ } else renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor]);
66
+ }
64
67
  if (normalizedRenderer) {
65
68
  let childScope = scope[childScopeAccessor], args = getInput?.();
66
69
  if (typeof normalizedRenderer == "string") (getContent ? _attrs : _attrs_content)(childScope, "a", (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope.a.tagName]), (childScope.Ia || childScope.Ea) && queueEffect(childScope, dynamicTagScript);
70
+ else if (normalizedRenderer.g?.(childScope), normalizedRenderer.d) if (inputIsArgs) normalizedRenderer.d(childScope, normalizedRenderer._ ? args[0] : args);
67
71
  else {
68
- for (let accessor in normalizedRenderer.g) normalizedRenderer.g[accessor](childScope, normalizedRenderer.h[accessor]);
69
- if (normalizedRenderer.d) if (inputIsArgs) normalizedRenderer.d(childScope, normalizedRenderer._ ? args[0] : args);
70
- else {
71
- let inputWithContent = getContent ? {
72
- ...args,
73
- content: getContent(scope)
74
- } : args || {};
75
- normalizedRenderer.d(childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
76
- }
72
+ let inputWithContent = getContent ? {
73
+ ...args,
74
+ content: getContent(scope)
75
+ } : args || {};
76
+ normalizedRenderer.d(childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
77
77
  }
78
78
  }
79
79
  };
@@ -81,9 +81,9 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
81
81
  nodeAccessor = decodeAccessor(nodeAccessor);
82
82
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
83
83
  return (scope, renderer) => {
84
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
84
+ scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer?.g?.(scope[childScopeAccessor]);
85
85
  };
86
- }), bindNativeTagVar, loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
86
+ }), bindNativeTagVar, loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, template, walks, setup, params) => {
87
87
  nodeAccessor = decodeAccessor(nodeAccessor);
88
88
  let scopesAccessor = "A" + nodeAccessor, keyedScopesAccessor = "O" + nodeAccessor, renderer = _content("", template, walks, setup)();
89
89
  return (scope, value) => {
@@ -107,25 +107,17 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
107
107
  for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
108
108
  return;
109
109
  }
110
- let diffLen = newEnd - start + 1, sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
111
- for (let i = diffLen; i--;) sources[i] = newScopes[start + i].I ?? -1;
112
- for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
113
- else {
114
- for (lo = 0, hi = tail; lo < hi;) mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
115
- sources[i] < sources[tails[lo]] && (lo > 0 && (pred[i] = tails[lo - 1]), tails[lo] = i);
116
- }
117
- for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
118
- for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
110
+ reorder(newScopes, start, newEnd, parentNode, afterReference);
119
111
  };
120
112
  }), _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
121
113
  by ||= bySecondArg, typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
122
- }), _for_in = /*@__PURE__*/ loop(([obj, by], cb) => {
114
+ }, reorderKeyed), _for_in = /*@__PURE__*/ loop(([obj, by], cb) => {
123
115
  by ||= byFirstArg, forIn(obj, (key, value) => cb(by(key, value), [key, value]));
124
- }), _for_to = /*@__PURE__*/ loop(([to, from, step, by], cb) => {
116
+ }, reorderKeyed), _for_to = /*@__PURE__*/ loop(([to, from, step, by], cb) => {
125
117
  by ||= byFirstArg, forTo(to, from, step, (v) => cb(by(v), [v]));
126
- }), _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
118
+ }, reorderKeyed), _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
127
119
  by ||= byFirstArg, forUntil(until, from, step, (v) => cb(by(v), [v]));
128
- });
120
+ }, reorderKeyed), _for_of_unkeyed = /*@__PURE__*/ loop(([all], cb) => forOf(all, (item, i) => cb(i, [item, i]))), _for_to_unkeyed = /*@__PURE__*/ loop(([to, from, step], cb) => forTo(to, from, step, (v) => cb(v, [v]))), _for_until_unkeyed = /*@__PURE__*/ loop(([until, from, step], cb) => forUntil(until, from, step, (v) => cb(v, [v])));
129
121
  //#region src/common/helpers.ts
130
122
  function _call(fn, v) {
131
123
  return fn(v), v;
@@ -450,16 +442,17 @@ function _closure(...closureSignals) {
450
442
  if (scope[scopeInstances]) for (let childScope of scope[scopeInstances]) childScope.H > 0 && childScope.H < runId && queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
451
443
  };
452
444
  }
453
- function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
445
+ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId, ownerValueAccessor) {
454
446
  valueAccessor = decodeAccessor(valueAccessor);
455
- let closureSignal = ((scope) => {
456
- scope[closureSignal.b] = closureSignal.c, fn(scope), subscribeToScopeSet(getOwnerScope ? getOwnerScope(scope) : scope._, closureSignal.a, scope);
447
+ let closureSignal = ((scope, resumed) => {
448
+ let ownerScope = getOwnerScope ? getOwnerScope(scope) : scope._;
449
+ scope[closureSignal.b] = closureSignal.c, (!resumed || ownerValueAccessor in ownerScope) && fn(scope), subscribeToScopeSet(ownerScope, closureSignal.a, scope);
457
450
  });
458
- return closureSignal.a = valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && (_resumed[resumeId] = closureSignal), closureSignal;
451
+ return closureSignal.a = valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && (ownerValueAccessor = decodeAccessor(ownerValueAccessor), _resumed[resumeId] = (scope) => closureSignal(scope, 1)), closureSignal;
459
452
  }
460
453
  function _child_setup(setup) {
461
454
  return setup._ = (scope, owner) => {
462
- scope._ = owner, queueRender(scope, setup, -1);
455
+ scope._ ||= owner, queueRender(scope, setup, -1);
463
456
  }, setup;
464
457
  }
465
458
  function _var(scope, childAccessor, signal) {
@@ -488,7 +481,7 @@ function _el_read(value) {
488
481
  return value;
489
482
  }
490
483
  function* traverse(scope, path, args, i = path.length - 1) {
491
- if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, args, i);
484
+ if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) childScope.H !== 0 && (yield* traverse(childScope, path, args, i));
492
485
  else {
493
486
  let item = scope[path[i]];
494
487
  i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
@@ -645,7 +638,7 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
645
638
  } : (branch) => {
646
639
  walk(branch.S = branch.K = new Text(), walks, branch);
647
640
  };
648
- return (owner) => ({
641
+ return _resumed[id] = (owner) => ({
649
642
  a: id,
650
643
  b: clone,
651
644
  e: owner,
@@ -654,15 +647,26 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
654
647
  f: dynamicScopesAccessor
655
648
  });
656
649
  }
657
- function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
658
- return _resumed[id] = _content(id, template, walks, setup, params, dynamicScopesAccessor);
650
+ function _content_resume(renderer, hasLocalValues = 0) {
651
+ return _resumed[renderer().a] = (owner, ...values) => {
652
+ for (let i = values.length, scope = owner; i > hasLocalValues;) {
653
+ let closures = values[--i];
654
+ for (let key in closures) key in scope || (scope[key] = closures[key]);
655
+ scope = scope._;
656
+ }
657
+ return renderer(owner, values[hasLocalValues - 1]);
658
+ };
659
659
  }
660
660
  function _content_closures(renderer, closureFns) {
661
661
  let closureSignals = {};
662
662
  for (let key in closureFns) closureSignals[key] = _const(+key, closureFns[key]);
663
663
  return (owner, closureValues) => {
664
- let instance = renderer(owner);
665
- return instance.g = closureSignals, instance.h = closureValues, instance;
664
+ let instance = renderer(owner), clone = instance.b, setClosures = instance.g = (branch) => {
665
+ for (let key in closureSignals) closureSignals[key](branch, closureValues[key]);
666
+ };
667
+ return instance.b = (branch, ns) => {
668
+ clone(branch, ns), setClosures(branch);
669
+ }, instance;
666
670
  };
667
671
  }
668
672
  function createCloneableHTML(html, ns) {
@@ -772,8 +776,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
772
776
  }
773
777
  function _attr_content(scope, nodeAccessor, value) {
774
778
  let content = normalizeClientRender(value);
775
- scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
776
- for (let accessor in content?.g) content.g[accessor](scope["A" + nodeAccessor], content.h[accessor]);
779
+ scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor])), content?.g?.(scope["A" + nodeAccessor]);
777
780
  }
778
781
  function _attrs_script(scope, nodeAccessor) {
779
782
  let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
@@ -1023,16 +1026,17 @@ function _await_promise(nodeAccessor, params) {
1023
1026
  let awaitBranch = scope[branchAccessor];
1024
1027
  return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
1025
1028
  }, awaitPromise = (scope, promise) => {
1026
- !isPromise(promise) && scope[promiseAccessor] && (promise = Promise.resolve(promise));
1027
- let awaitBranch = scope[branchAccessor], tryPlaceholder = findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch;
1028
- if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
1029
- scope[promiseAccessor] = () => awaitPromise(scope, promise);
1030
- return;
1031
- }
1032
- if (!isPromise(promise)) {
1033
- resolveAwait(scope, scope[nodeAccessor], promise);
1029
+ isPromise(scope[promiseAccessor]) || (scope[promiseAccessor] = 0);
1030
+ let awaitBranch = scope[branchAccessor], tryPlaceholder = (isPromise(promise) || scope[promiseAccessor]) && findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch;
1031
+ if (!tryBranch) {
1032
+ let replay = scope[promiseAccessor] = () => replay === scope[promiseAccessor] && awaitPromise(scope, promise), awaitCounter = findBranchWithKey(scope, "Q")?.O;
1033
+ if (awaitCounter?.i) {
1034
+ let complete = awaitCounter.c;
1035
+ awaitCounter.c = () => complete() || queueAsyncRender(scope, replay);
1036
+ }
1034
1037
  return;
1035
1038
  }
1039
+ if (!isPromise(promise)) return scope[promiseAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
1036
1040
  let awaitCounter = tryBranch.O;
1037
1041
  placeholderShown.add(pendingEffects), !tryPlaceholder && !awaitCounter?.i && (awaitCounter = createAwaitCounter(tryBranch, () => {
1038
1042
  if (tryBranch === scope[branchAccessor]) {
@@ -1041,15 +1045,15 @@ function _await_promise(nodeAccessor, params) {
1041
1045
  let detachedParent = scope[branchAccessor].S.parentNode;
1042
1046
  detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
1043
1047
  }
1044
- } else dismissPlaceholder(tryBranch);
1048
+ }
1045
1049
  })), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : scheduleAwaitFrame(awaitCounter, scope, () => {
1046
1050
  awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
1047
1051
  }));
1048
1052
  let thisPromise = scope[promiseAccessor] = promise.then((data) => {
1049
1053
  if (thisPromise === scope[promiseAccessor]) {
1050
1054
  let referenceNode = scope[nodeAccessor];
1051
- if (scope[promiseAccessor] = 0, scope.F?.H === 0) {
1052
- awaitCounter.c(), run();
1055
+ if (scope[promiseAccessor] = 0, !scope[branchAccessor] || scope.F?.H === 0) {
1056
+ scope[branchAccessor] || awaitPromise(scope, data), awaitCounter.c(), run();
1053
1057
  return;
1054
1058
  }
1055
1059
  queueAsyncRender(scope, () => {
@@ -1079,9 +1083,7 @@ function _await_content(nodeAccessor, template, walks, setup) {
1079
1083
  let branchAccessor = "A" + nodeAccessor, promiseAccessor = "L" + nodeAccessor, renderer = _content("", template, walks, setup)();
1080
1084
  return (scope) => {
1081
1085
  let pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer);
1082
- scope[branchAccessor].Y = pendingScopes;
1083
- let resolveSync = scope[promiseAccessor];
1084
- typeof resolveSync == "function" && (scope[promiseAccessor] = 0, resolveSync());
1086
+ scope[branchAccessor].Y = pendingScopes, typeof scope[promiseAccessor] == "function" && scope[promiseAccessor]();
1085
1087
  };
1086
1088
  }
1087
1089
  function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
@@ -1144,6 +1146,17 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch)
1144
1146
  let referenceNode = scope[nodeAccessor], prevBranch = scope["A" + nodeAccessor], parentNode = referenceNode.nodeType > 1 ? (prevBranch?.S || referenceNode).parentNode : referenceNode, newBranch = scope["A" + nodeAccessor] = newRenderer && createBranch(scope.$, newRenderer, scope, parentNode);
1145
1147
  referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.S) : parentNode.insertBefore(referenceNode, prevBranch.S), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
1146
1148
  }
1149
+ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
1150
+ let diffLen = newEnd - start + 1, sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
1151
+ for (let i = diffLen; i--;) sources[i] = newScopes[start + i].I ?? -1;
1152
+ for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
1153
+ else {
1154
+ for (lo = 0, hi = tail; lo < hi;) mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
1155
+ sources[i] < sources[tails[lo]] && (lo > 0 && (pred[i] = tails[lo - 1]), tails[lo] = i);
1156
+ }
1157
+ for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
1158
+ for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
1159
+ }
1147
1160
  function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
1148
1161
  let branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
1149
1162
  return typeof tagNameOrRenderer == "string" ? branch.a = branch.S = branch.K = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer) : setupBranch(tagNameOrRenderer, branch), branch;
@@ -1155,4 +1168,4 @@ function byFirstArg(name) {
1155
1168
  return name;
1156
1169
  }
1157
1170
  //#endregion
1158
- export { _attrs_script as $, caughtError as $t, _attr_input_value_script as A, _for_closure as At, _attr as B, _return as Bt, _attr_input_checkedValue_script as C, readyFailed as Ct, _attr_input_value_attribute_default as D, _closure_get as Dt, _attr_input_value as E, _closure as Et, _controllable_open as F, _id as Ft, _attr_nonce as G, _assert_init as Gt, _attr_class_item as H, _script as Ht, _controllable_select as I, _if_closure as It, _attr_style_items as J, removeAndDestroyBranch as Jt, _attr_style as K, destroyBranch as Kt, _controllable_textarea as L, _let as Lt, _attr_select_value_default as M, _global_read as Mt, _attr_select_value_script as N, _hoist as Nt, _attr_input_value_default as O, _const as Ot, _controllable_input as P, _hoist_resume as Pt, _attrs_partial_content as Q, $signalReset as Qt, controllableRenders as R, _let_change as Rt, _attr_input_checkedValue_default as S, ready as St, _attr_input_checked_script as T, _child_setup as Tt, _attr_class_items as U, _var as Ut, _attr_class as V, _return_change as Vt, _attr_content as W, _var_change as Wt, _attrs_content as X, _on as Xt, _attrs as Y, syncGen as Yt, _attrs_partial as Z, $signal as Zt, _attr_details_or_dialog_open as _, withBranches as _n, _resumed as _t, _for_in as a, queueRender as an, _text_content as at, _attr_input_checked as b, init as bt, _for_until as c, runId as cn, toInsertNode as ct, _try as d, forTo as dn, _content_resume as dt, installCatch as en, _html as et, addAwaitCounter as f, forUntil as fn, createAndSetupBranch as ft, renderCatch as g, decodeAccessor as gn, _resume_dynamic_tag_var as gt, patchDynamicTag as h, _call as hn, _el as ht, _dynamic_tag_content as i, queueEffect as in, _text as it, _attr_select_value as j, _for_selector as jt, _attr_input_value_dynamic_default as k, _el_read as kt, _if as l, forIn as ln, _content as lt, installDynamicTagVar as m, _hoist_read_error as mn, setupBranch as mt, _await_promise as n, prepareEffects as nn, _style_rule_item as nt, _for_of as o, run as on, _to_text as ot, dynamicTagScript as p, _assert_hoist as pn, createBranch as pt, _attr_style_item as q, insertBranchBefore as qt, _dynamic_tag as r, queueAsyncRender as rn, _style_shell as rt, _for_to as s, runEffects as sn, insertChildNodes as st, _await_content as t, placeholderShown as tn, _lifecycle as tt, _show as u, forOf as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, _var_resume as vt, _attr_input_checked_default as w, withLazy as wt, _attr_input_checkedValue as x, initEmbedded as xt, _attr_details_or_dialog_open_script as y, getRegisteredWithScope as yt, controllableScripts as z, _or as zt };
1171
+ export { _attrs_content as $, _on as $t, _attr_input_value_attribute_default as A, _closure_get as At, _controllable_textarea as B, _let as Bt, _attr_input_checked as C, init as Ct, _attr_input_checked_default as D, withLazy as Dt, _attr_input_checkedValue_script as E, readyFailed as Et, _attr_select_value_default as F, _global_read as Ft, _attr_class_item as G, _script as Gt, controllableScripts as H, _or as Ht, _attr_select_value_script as I, _hoist as It, _attr_nonce as J, _assert_init as Jt, _attr_class_items as K, _var as Kt, _controllable_input as L, _hoist_resume as Lt, _attr_input_value_dynamic_default as M, _el_read as Mt, _attr_input_value_script as N, _for_closure as Nt, _attr_input_checked_script as O, _child_setup as Ot, _attr_select_value as P, _for_selector as Pt, _attrs as Q, syncGen as Qt, _controllable_open as R, _id as Rt, _attr_details_or_dialog_open_script as S, getRegisteredWithScope as St, _attr_input_checkedValue_default as T, ready as Tt, _attr as U, _return as Ut, controllableRenders as V, _let_change as Vt, _attr_class as W, _return_change as Wt, _attr_style_item as X, insertBranchBefore as Xt, _attr_style as Y, destroyBranch as Yt, _attr_style_items as Z, removeAndDestroyBranch as Zt, installDynamicTagVar as _, _hoist_read_error as _n, setupBranch as _t, _for_in as a, prepareEffects as an, _style_rule_item as at, _attr_details_or_dialog_open as b, _resumed as bt, _for_to as c, queueRender as cn, _text_content as ct, _for_until_unkeyed as d, runId as dn, toInsertNode as dt, $signal as en, _attrs_partial as et, _if as f, forIn as fn, _content as ft, dynamicTagScript as g, _assert_hoist as gn, createBranch as gt, addAwaitCounter as h, forUntil as hn, createAndSetupBranch as ht, _dynamic_tag_content as i, placeholderShown as in, _lifecycle as it, _attr_input_value_default as j, _const as jt, _attr_input_value as k, _closure as kt, _for_to_unkeyed as l, run as ln, _to_text as lt, _try as m, forTo as mn, _content_resume as mt, _await_promise as n, caughtError as nn, _attrs_script as nt, _for_of as o, queueAsyncRender as on, _style_shell as ot, _show as p, forOf as pn, _content_closures as pt, _attr_content as q, _var_change as qt, _dynamic_tag as r, installCatch as rn, _html as rt, _for_of_unkeyed as s, queueEffect as sn, _text as st, _await_content as t, $signalReset as tn, _attrs_partial_content as tt, _for_until as u, runEffects as un, insertChildNodes as ut, patchDynamicTag as v, _call as vn, _el as vt, _attr_input_checkedValue as w, initEmbedded as wt, _attr_details_or_dialog_open_default as x, _var_resume as xt, renderCatch as y, withBranches as yn, _resume_dynamic_tag_var as yt, _controllable_select as z, _if_closure as zt };