marko 6.4.8 → 6.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/cheatsheet.md +1 -1
  2. package/dist/common/constants/closure-signal-prop.d.ts +1 -1
  3. package/dist/common/constants/closure-signal-prop.debug.d.ts +1 -1
  4. package/dist/debug/dom/catch.feat.js +2 -3
  5. package/dist/debug/dom/catch.feat.mjs +2 -3
  6. package/dist/debug/dom/controllable-input.feat.js +2 -3
  7. package/dist/debug/dom/controllable-input.feat.mjs +2 -3
  8. package/dist/debug/dom/controllable-open.feat.js +2 -3
  9. package/dist/debug/dom/controllable-open.feat.mjs +2 -3
  10. package/dist/debug/dom/controllable-select.feat.js +2 -3
  11. package/dist/debug/dom/controllable-select.feat.mjs +2 -3
  12. package/dist/debug/dom/controllable-textarea.feat.js +2 -3
  13. package/dist/debug/dom/controllable-textarea.feat.mjs +2 -3
  14. package/dist/debug/dom/controllable.feat.js +2 -3
  15. package/dist/debug/dom/controllable.feat.mjs +2 -3
  16. package/dist/debug/dom/dynamic-tag-script.feat.js +2 -3
  17. package/dist/debug/dom/dynamic-tag-script.feat.mjs +2 -3
  18. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  19. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  20. package/dist/debug/dom/lazy.feat.js +2 -3
  21. package/dist/debug/dom/lazy.feat.mjs +2 -3
  22. package/dist/debug/dom/placeholder.feat.js +2 -3
  23. package/dist/debug/dom/placeholder.feat.mjs +2 -3
  24. package/dist/debug/{dom-CFCBDift.mjs → dom-C1V5vpFs.mjs} +60 -98
  25. package/dist/debug/{dom-D8znnhpf.js → dom-DNB5yq3U.js} +59 -109
  26. package/dist/debug/dom.js +9 -14
  27. package/dist/debug/dom.mjs +9 -14
  28. package/dist/debug/html.js +39 -51
  29. package/dist/debug/html.mjs +37 -49
  30. package/dist/dom/catch.feat.js +4 -5
  31. package/dist/dom/catch.feat.mjs +2 -3
  32. package/dist/dom/compat.d.ts +1 -1
  33. package/dist/dom/control-flow.d.ts +1 -1
  34. package/dist/dom/controllable-input.feat.js +1 -2
  35. package/dist/dom/controllable-input.feat.mjs +1 -2
  36. package/dist/dom/controllable-open.feat.js +2 -3
  37. package/dist/dom/controllable-open.feat.mjs +2 -3
  38. package/dist/dom/controllable-select.feat.js +2 -3
  39. package/dist/dom/controllable-select.feat.mjs +2 -3
  40. package/dist/dom/controllable-textarea.feat.js +2 -3
  41. package/dist/dom/controllable-textarea.feat.mjs +2 -3
  42. package/dist/dom/controllable.feat.js +1 -2
  43. package/dist/dom/controllable.feat.mjs +1 -2
  44. package/dist/dom/dom.d.ts +2 -3
  45. package/dist/dom/dynamic-tag-script.feat.js +3 -4
  46. package/dist/dom/dynamic-tag-script.feat.mjs +2 -3
  47. package/dist/dom/dynamic-tag-var.feat.js +3 -4
  48. package/dist/dom/dynamic-tag-var.feat.mjs +1 -2
  49. package/dist/dom/lazy.feat.js +2 -3
  50. package/dist/dom/lazy.feat.mjs +2 -3
  51. package/dist/dom/placeholder.feat.js +4 -5
  52. package/dist/dom/placeholder.feat.mjs +2 -3
  53. package/dist/dom/resume.d.ts +1 -1
  54. package/dist/dom/scope.d.ts +1 -1
  55. package/dist/dom/signals.d.ts +1 -1
  56. package/dist/{dom-Bpkm72vV.js → dom-C2-Flitp.js} +122 -166
  57. package/dist/{dom-CVAevsbz.mjs → dom-DsHYWMCR.mjs} +59 -94
  58. package/dist/dom.js +36 -40
  59. package/dist/dom.mjs +9 -14
  60. package/dist/html/serializer.d.ts +1 -1
  61. package/dist/html/writer.d.ts +3 -3
  62. package/dist/html.d.ts +1 -1
  63. package/dist/html.js +60 -74
  64. package/dist/html.mjs +60 -75
  65. package/dist/translator/core/show.d.ts +3 -4
  66. package/dist/translator/index.js +1193 -1295
  67. package/dist/translator/util/assert.d.ts +9 -2
  68. package/dist/translator/util/bindings.d.ts +6 -5
  69. package/dist/translator/util/branch-tag.d.ts +1 -1
  70. package/dist/translator/util/constants/slot-kind.d.ts +1 -1
  71. package/dist/translator/util/known-tag.d.ts +3 -0
  72. package/dist/translator/util/module-registrations.d.ts +1 -1
  73. package/dist/translator/util/optional.d.ts +1 -0
  74. package/dist/translator/util/params-tree.d.ts +3 -3
  75. package/dist/translator/util/reasons.d.ts +2 -2
  76. package/dist/translator/util/references.d.ts +13 -10
  77. package/dist/translator/util/replace-with-statements.d.ts +4 -0
  78. package/dist/translator/util/runtime.d.ts +1 -0
  79. package/dist/translator/util/scope-accessor.d.ts +1 -1
  80. package/dist/translator/util/sections.d.ts +38 -14
  81. package/dist/translator/util/signals.d.ts +3 -11
  82. package/dist/translator/util/slots.d.ts +1 -1
  83. package/dist/translator/util/solve-reasons.d.ts +5 -0
  84. package/dist/translator/util/sources.d.ts +1 -1
  85. package/dist/translator/util/static-text.d.ts +1 -0
  86. package/dist/translator/util/structure.d.ts +3 -2
  87. package/dist/translator/util/tag-import.d.ts +0 -2
  88. package/dist/translator/util/tag-name-type.d.ts +3 -0
  89. package/dist/translator/util/write-guard.d.ts +2 -0
  90. package/dist/translator/visitors/placeholder.d.ts +4 -4
  91. package/package.json +6 -6
  92. package/tags/lifecycle.d.marko +2 -0
  93. package/dist/translator/visitors/constants/sibling-text.d.ts +0 -6
@@ -1,4 +1,4 @@
1
- //#region src/common/constants/accessor-prefix.debug.ts
1
+ // src/common/constants/accessor-prefix.debug.ts
2
2
  const BranchScopes$1 = "BranchScopes:";
3
3
  const ClosureScopes = "ClosureScopes:";
4
4
  const ClosureSignalIndex = "ClosureSignalIndex:";
@@ -15,8 +15,7 @@ const Lifecycle = "Lifecycle:";
15
15
  const Promise$1 = "Promise:";
16
16
  const TagVariableChange$1 = "TagVariableChange:";
17
17
  const TryBranch$1 = "TryBranch:";
18
- //#endregion
19
- //#region src/common/constants/accessor-prop.debug.ts
18
+ // src/common/constants/accessor-prop.debug.ts
20
19
  const Global = "$global";
21
20
  const AbortControllers = "#AbortControllers";
22
21
  const AbortScopes = "#AbortScopes";
@@ -46,16 +45,13 @@ const Subscriptions = "#Subscriptions";
46
45
  const TagVariable = "#TagVariable";
47
46
  const TagVariableChange = "#TagVariableChange";
48
47
  const TryBranch = "#TryBranch";
49
- //#endregion
50
- //#region src/common/constants/closure-scopes-prop.debug.ts
48
+ // src/common/constants/closure-scopes-prop.debug.ts
51
49
  const Changed = "Changed";
52
- //#endregion
53
- //#region src/common/constants/closure-signal-prop.debug.ts
54
- const ScopeInstancesAccessor = "scopeInstancesAccessor";
50
+ // src/common/constants/closure-signal-prop.debug.ts
51
+ const ScopesAccessor = "scopesAccessor";
55
52
  const SignalIndexAccessor = "signalIndexAccessor";
56
53
  const Index = "index";
57
- //#endregion
58
- //#region src/common/constants/keyed-scopes-prop.debug.ts
54
+ // src/common/constants/keyed-scopes-prop.debug.ts
59
55
  const PreviousKey = "PreviousKey:";
60
56
  const Scope = "scope";
61
57
  const Signal = "signal";
@@ -69,8 +65,7 @@ const Accessor = "accessor";
69
65
  const LocalClosures = "localClosures";
70
66
  const Returns = "returns";
71
67
  const Lazy = "lazy";
72
- //#endregion
73
- //#region src/common/helpers.ts
68
+ // src/common/helpers.ts
74
69
  const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
75
70
  const knownWrongAttrs = {
76
71
  className: "class",
@@ -194,8 +189,7 @@ function withDynamicHtml(runtime) {
194
189
  dynamicHtmlEnabled = 1;
195
190
  return runtime;
196
191
  }
197
- //#endregion
198
- //#region src/common/errors.ts
192
+ // src/common/errors.ts
199
193
  const lowercaseOnAttrReg = /^on[a-z]/;
200
194
  function assertValidAttrValue(name, value) {
201
195
  if (value && typeof value !== "string" && lowercaseOnAttrReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
@@ -310,8 +304,7 @@ function joinWithAnd(a) {
310
304
  default: return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
311
305
  }
312
306
  }
313
- //#endregion
314
- //#region src/common/for.ts
307
+ // src/common/for.ts
315
308
  function forIn(obj, cb) {
316
309
  for (const key in obj) cb(key, obj[key]);
317
310
  }
@@ -338,8 +331,7 @@ function forUntil(until, from, step, cb) {
338
331
  const delta = step || 1;
339
332
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
340
333
  }
341
- //#endregion
342
- //#region src/dom/queue.ts
334
+ // src/dom/queue.ts
343
335
  let rendering;
344
336
  let runId = 2;
345
337
  let pendingEffects = [];
@@ -479,8 +471,7 @@ function runRenders(renders = pendingRenders) {
479
471
  runRender(render);
480
472
  }
481
473
  }
482
- //#endregion
483
- //#region src/dom/abort-signal.ts
474
+ // src/dom/abort-signal.ts
484
475
  function $signalReset(scope, id) {
485
476
  const ctrl = scope[AbortControllers]?.[id];
486
477
  if (ctrl) {
@@ -514,8 +505,7 @@ let subscriptionsEnabled;
514
505
  function abort(ctrl) {
515
506
  ctrl.abort();
516
507
  }
517
- //#endregion
518
- //#region src/common/opt.ts
508
+ // src/common/opt.ts
519
509
  function toArray(opt) {
520
510
  return opt ? Array.isArray(opt) ? opt : [opt] : [];
521
511
  }
@@ -528,8 +518,7 @@ function forEach(opt, cb) {
528
518
  function push(opt, item) {
529
519
  return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
530
520
  }
531
- //#endregion
532
- //#region src/dom/event.ts
521
+ // src/dom/event.ts
533
522
  function _on(element, type, handler) {
534
523
  assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
535
524
  delegate(type, handleDelegated);
@@ -551,21 +540,18 @@ function handleDelegated(ev) {
551
540
  }
552
541
  delete ev.currentTarget;
553
542
  }
554
- //#endregion
555
- //#region src/dom/parse-html.ts
543
+ // src/dom/parse-html.ts
556
544
  const parsers = {};
557
545
  function parseHTML(html, ns) {
558
546
  const parser = parsers[ns] ||= document.createElementNS(ns, "template");
559
547
  parser.innerHTML = html;
560
548
  return parser.content || parser;
561
549
  }
562
- //#endregion
563
- //#region src/common/meta.ts
550
+ // src/common/meta.ts
564
551
  const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
565
552
  const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
566
553
  const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
567
- //#endregion
568
- //#region src/dom/scope.ts
554
+ // src/dom/scope.ts
569
555
  let nextScopeId = 1e6;
570
556
  let collectingScopes;
571
557
  function createScope($global, closestBranch) {
@@ -625,15 +611,14 @@ function removeAndDestroyBranch(branch) {
625
611
  removeChildNodes(branch[StartNode], branch[EndNode]);
626
612
  }
627
613
  function insertBranchBefore(branch, parentNode, nextSibling) {
628
- insertChildNodes(parentNode, nextSibling, branch[StartNode], branch[EndNode]);
614
+ parentNode.insertBefore(branch["#StartNode"].parentNode || branch["#StartNode"], nextSibling);
629
615
  }
630
- function tempDetachBranch(branch) {
616
+ function detachBranch(branch) {
631
617
  const fragment = new DocumentFragment();
632
618
  fragment.namespaceURI = branch[StartNode].parentNode.namespaceURI;
633
619
  insertChildNodes(fragment, null, branch[StartNode], branch[EndNode]);
634
620
  }
635
- //#endregion
636
- //#region src/dom/schedule.ts
621
+ // src/dom/schedule.ts
637
622
  let runTask;
638
623
  let isScheduled;
639
624
  let channel;
@@ -665,8 +650,7 @@ function triggerMacroTask() {
665
650
  }
666
651
  channel.port2.postMessage(0);
667
652
  }
668
- //#endregion
669
- //#region src/dom/signals.ts
653
+ // src/dom/signals.ts
670
654
  function _let(id, fn) {
671
655
  const valueAccessor = id.slice(0, id.lastIndexOf("/"));
672
656
  id = +id.slice(id.lastIndexOf("/") + 1);
@@ -779,7 +763,7 @@ function subscribeToScopeSet(owner, accessor, scope) {
779
763
  }
780
764
  function _closure(...closureSignals) {
781
765
  const [firstSignal] = closureSignals;
782
- const scopeInstances = firstSignal[ScopeInstancesAccessor];
766
+ const scopeInstances = firstSignal[ScopesAccessor];
783
767
  const signalIndex = firstSignal[SignalIndexAccessor];
784
768
  for (let i = closureSignals.length; i--;) closureSignals[i][Index] = i;
785
769
  return (scope) => {
@@ -793,11 +777,11 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
793
777
  const closureSignal = ((scope, resumed) => {
794
778
  const ownerScope = getOwnerScope ? getOwnerScope(scope) : scope["_"];
795
779
  scope[closureSignal[SignalIndexAccessor]] = closureSignal[Index];
796
- subscribeToScopeSet(ownerScope, closureSignal[ScopeInstancesAccessor], scope);
780
+ subscribeToScopeSet(ownerScope, closureSignal[ScopesAccessor], scope);
797
781
  if (!resumed) queueRender(scope, fn, -1);
798
- else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, fn);
782
+ else if (ownerScope[closureSignal["scopesAccessor"]]["Changed"]) queueAsyncRender(scope, fn);
799
783
  });
800
- closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
784
+ closureSignal[ScopesAccessor] = ClosureScopes + valueAccessor;
801
785
  closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
802
786
  if (resumeId) _resumed[resumeId] = (scope) => closureSignal(scope, 1);
803
787
  return closureSignal;
@@ -864,8 +848,7 @@ function _hoist(...path) {
864
848
  function _hoist_resume(id, ...path) {
865
849
  return _resumed[id] = _hoist(...path);
866
850
  }
867
- //#endregion
868
- //#region src/dom/walker.ts
851
+ // src/dom/walker.ts
869
852
  /** Cloned templates are small, where a TreeWalker's per-step cost dominates. */
870
853
  let currentNode;
871
854
  function walk(startNode, walkCodes, branch) {
@@ -917,8 +900,7 @@ function getDebugKey(index, node) {
917
900
  return index;
918
901
  }
919
902
  const walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode;
920
- //#endregion
921
- //#region src/dom/resume.ts
903
+ // src/dom/resume.ts
922
904
  const _resumed = {};
923
905
  let curRenders;
924
906
  let embedRenders;
@@ -1140,7 +1122,7 @@ function runResumeEffects(render) {
1140
1122
  isResuming = 0;
1141
1123
  }
1142
1124
  }
1143
- function getRegisteredWithScope(id, scope) {
1125
+ function getRegisteredWithScope(scope, id) {
1144
1126
  return scope ? _resumed[id](scope) : _resumed[id];
1145
1127
  }
1146
1128
  function _var_resume(id, signal) {
@@ -1156,8 +1138,7 @@ function _dynamic_tag_var_resume(accessor) {
1156
1138
  return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1157
1139
  };
1158
1140
  }
1159
- //#endregion
1160
- //#region src/dom/renderer.ts
1141
+ // src/dom/renderer.ts
1161
1142
  function createBranch($global, renderer, parentScope, parentNode) {
1162
1143
  const branch = createScope($global);
1163
1144
  branch["_"] = renderer["owner"] || parentScope;
@@ -1235,19 +1216,19 @@ function _content_closures(renderer, closureFns) {
1235
1216
  const cloneCache = {};
1236
1217
  function createCloneableHTML(html, ns) {
1237
1218
  const { firstChild, lastChild } = parseHTML(html, ns);
1238
- const parent = document.createElementNS(ns, "t");
1219
+ const parent = new DocumentFragment();
1239
1220
  insertChildNodes(parent, null, firstChild, lastChild);
1240
1221
  return firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
1241
1222
  walk(branch[StartNode] = branch[EndNode] = firstChild.cloneNode(true), walks, branch);
1242
1223
  } : (branch, walks) => {
1243
1224
  const clone = parent.cloneNode(true);
1225
+ clone.namespaceURI = ns;
1244
1226
  walk(clone.firstChild, walks, branch);
1245
1227
  branch[StartNode] = clone.firstChild;
1246
1228
  branch[EndNode] = clone.lastChild;
1247
1229
  };
1248
1230
  }
1249
- //#endregion
1250
- //#region src/dom/dom.ts
1231
+ // src/dom/dom.ts
1251
1232
  function _to_text(value) {
1252
1233
  assertValidTextValue(value);
1253
1234
  return value || value === 0 ? value + "" : "";
@@ -1408,7 +1389,7 @@ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accesso
1408
1389
  const branch = scope[ClosestBranch];
1409
1390
  if (branch?.["#StartNode"] === firstChild) branch[StartNode] = newFirstChild;
1410
1391
  if (branch?.["#EndNode"] === lastChild) branch[EndNode] = newLastChild;
1411
- insertChildNodes(parentNode, firstChild, newFirstChild, newLastChild);
1392
+ firstChild.before(...newContent.childNodes);
1412
1393
  removeChildNodes(firstChild, lastChild);
1413
1394
  }
1414
1395
  });
@@ -1439,30 +1420,22 @@ function _lifecycle(scope, thisObj, index = 0) {
1439
1420
  }
1440
1421
  }
1441
1422
  function removeChildNodes(startNode, endNode) {
1442
- const stop = endNode.nextSibling;
1443
- while (startNode !== stop) {
1423
+ endNode = endNode.nextSibling;
1424
+ while (startNode !== endNode) {
1444
1425
  const next = startNode.nextSibling;
1445
1426
  startNode.remove();
1446
1427
  startNode = next;
1447
1428
  }
1448
1429
  }
1449
1430
  function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
1450
- if (parentNode.isConnected) parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
1451
- else {
1452
- const stop = endNode.nextSibling;
1453
- while (startNode !== stop) {
1454
- const next = startNode.nextSibling;
1455
- parentNode.insertBefore(startNode, referenceNode);
1456
- startNode = next;
1457
- }
1431
+ endNode = endNode.nextSibling;
1432
+ while (startNode !== endNode) {
1433
+ const next = startNode.nextSibling;
1434
+ parentNode.insertBefore(startNode, referenceNode);
1435
+ startNode = next;
1458
1436
  }
1459
- return parentNode;
1460
- }
1461
- function toInsertNode(startNode, endNode) {
1462
- return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
1463
1437
  }
1464
- //#endregion
1465
- //#region src/dom/resolve-cursor-position.ts
1438
+ // src/dom/resolve-cursor-position.ts
1466
1439
  const R = /[\p{L}\p{N}]/gu;
1467
1440
  function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
1468
1441
  if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
@@ -1476,8 +1449,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
1476
1449
  }
1477
1450
  return -1;
1478
1451
  }
1479
- //#endregion
1480
- //#region src/dom/controllable.ts
1452
+ // src/dom/controllable.ts
1481
1453
  let inputType = "";
1482
1454
  function _attr_input_checked_default(scope, nodeAccessor, checked) {
1483
1455
  const el = scope[nodeAccessor];
@@ -1772,8 +1744,7 @@ function _controllable_open(scope, nodeAccessor, nextAttrs) {
1772
1744
  return /^open(?:Change)?$/;
1773
1745
  }
1774
1746
  }
1775
- //#endregion
1776
- //#region src/dom/control-flow.ts
1747
+ // src/dom/control-flow.ts
1777
1748
  function _await_promise(nodeAccessor, params) {
1778
1749
  const promiseAccessor = Promise$1 + nodeAccessor;
1779
1750
  const branchAccessor = BranchScopes$1 + nodeAccessor;
@@ -1827,7 +1798,7 @@ function _await_promise(nodeAccessor, params) {
1827
1798
  countAwait(awaitCounter, scope, (_) => {
1828
1799
  if (!awaitBranch["#DetachedAwait"]) {
1829
1800
  awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
1830
- tempDetachBranch(tryBranch);
1801
+ detachBranch(tryBranch);
1831
1802
  }
1832
1803
  });
1833
1804
  }
@@ -1880,7 +1851,7 @@ function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1880
1851
  countAwait(awaitCounter, tryBranch, (_) => {
1881
1852
  (tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent](), tryBranch["_"], tryBranch[StartNode].parentNode))[TryBranch] = tryBranch;
1882
1853
  insertBranchBefore(tryBranch[PlaceholderBranch], tryBranch[StartNode].parentNode, tryBranch[StartNode]);
1883
- tempDetachBranch(tryBranch);
1854
+ detachBranch(tryBranch);
1884
1855
  });
1885
1856
  return awaitCounter;
1886
1857
  }
@@ -1927,7 +1898,7 @@ function dismissPlaceholder(tryBranch) {
1927
1898
  const placeholderBranch = tryBranch[PlaceholderBranch];
1928
1899
  if (placeholderBranch) {
1929
1900
  tryBranch[PlaceholderBranch] = 0;
1930
- placeholderBranch[StartNode].parentNode.insertBefore(tryBranch[StartNode].parentNode, placeholderBranch[StartNode]);
1901
+ insertBranchBefore(tryBranch, placeholderBranch[StartNode].parentNode, placeholderBranch[StartNode]);
1931
1902
  removeAndDestroyBranch(placeholderBranch);
1932
1903
  }
1933
1904
  }
@@ -1981,7 +1952,7 @@ const _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
1981
1952
  if (newBranch !== (scope[branchAccessor] ?? (scope["BranchScopes:" + nodeAccessor] && 0))) setBranch(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
1982
1953
  };
1983
1954
  });
1984
- const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNodeAccessor) => {
1955
+ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
1985
1956
  const rangeAccessor = BranchScopes$1 + nodeAccessor;
1986
1957
  return (scope, display) => {
1987
1958
  const referenceNode = scope[nodeAccessor];
@@ -1990,27 +1961,16 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNo
1990
1961
  let range = scope[rangeAccessor];
1991
1962
  if (!range) {
1992
1963
  range = scope[rangeAccessor] = {};
1993
- range[StartNode] = onlyChild ? parentNode.firstChild : scope[startNodeAccessor];
1994
- range[EndNode] = onlyChild ? parentNode.lastChild : endNodeAccessor === void 0 ? referenceNode.previousSibling : scope[endNodeAccessor];
1964
+ range[StartNode] = onlyChild ? parentNode.insertBefore(new Text(), parentNode.firstChild) : startNodeAccessor ? scope[startNodeAccessor] : referenceNode.previousSibling;
1995
1965
  }
1996
- let startNode = range[StartNode];
1997
- if (range["#Id"] && startNode === range["#EndNode"] && startNode.tagName === "T") {
1998
- const wrapper = startNode;
1999
- if (!wrapper.firstChild) wrapper.appendChild(new Text());
2000
- range = scope[rangeAccessor] = {};
2001
- range[StartNode] = startNode = wrapper.firstChild;
2002
- range[EndNode] = wrapper.lastChild;
2003
- wrapper.replaceWith(...wrapper.childNodes);
2004
- }
2005
- const inDom = onlyChild ? !!parentNode.firstChild : startNode.parentNode === parentNode;
2006
- if (display) {
2007
- if (!inDom) insertBranchBefore(range, parentNode, onlyChild ? null : referenceNode);
2008
- } else if (inDom) {
2009
- if (onlyChild) {
2010
- range[StartNode] = parentNode.firstChild;
2011
- range[EndNode] = parentNode.lastChild;
2012
- }
2013
- tempDetachBranch(range);
1966
+ const startNode = range[StartNode];
1967
+ if (range["#Id"] && startNode.tagName === "T") {
1968
+ if (display) startNode.replaceWith(range[StartNode] = new Text(), ...startNode.childNodes);
1969
+ } else if (display) {
1970
+ if (startNode.parentNode !== parentNode) parentNode.insertBefore(startNode.parentNode, onlyChild ? null : referenceNode);
1971
+ } else if (startNode.parentNode === parentNode) {
1972
+ range[EndNode] = onlyChild ? parentNode.lastChild : referenceNode.previousSibling;
1973
+ detachBranch(range);
2014
1974
  }
2015
1975
  };
2016
1976
  });
@@ -2237,7 +2197,10 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
2237
2197
  }
2238
2198
  for (let i = diffLen; i--;) {
2239
2199
  if (~tail && i === tails[tail]) tail--;
2240
- else insertBranchBefore(newScopes[start + i], parentNode, afterReference);
2200
+ else {
2201
+ if (~sources[i]) detachBranch(newScopes[start + i]);
2202
+ insertBranchBefore(newScopes[start + i], parentNode, afterReference);
2203
+ }
2241
2204
  afterReference = newScopes[start + i][StartNode];
2242
2205
  }
2243
2206
  }
@@ -2247,5 +2210,4 @@ function bySecondArg(_item, index) {
2247
2210
  function byFirstArg(name) {
2248
2211
  return name;
2249
2212
  }
2250
- //#endregion
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 };
2213
+ export { _attr_style_items as $, DYNAMIC_TAG_SCRIPT_REGISTER_ID as $t, _attr_input_value as A, Setup as An, _closure_get as At, _controllable_select as B, ParentBranch as Bn, _let as Bt, _attr_details_or_dialog_open_script as C, withBranches as Cn, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, Owner as Dn, readyFailed as Dt, _attr_input_checkedValue_default as E, LocalClosures as En, ready as Et, _attr_select_value as F, ClosestBranch as Fn, _global_read as Ft, _attr_class as G, StartNode as Gn, _script as Gt, controllableScripts as H, PendingEffects as Hn, _or as Ht, _attr_select_value_default as I, EndNode as In, _hoist as It, _attr_class_names as J, _assert_init as Jt, _attr_class_item as K, TagVariable as Kn, _var as Kt, _attr_select_value_script as L, Gen$1 as Ln, _hoist_resume as Lt, _attr_input_value_default as M, Scope as Mn, _el_read as Mt, _attr_input_value_dynamic_default as N, AwaitCounter as Nn, _for_closure as Nt, _attr_input_checked_default as O, Params as On, withLazy as Ot, _attr_input_value_script as P, BranchRenders as Pn, _for_selector as Pt, _attr_style_item as Q, syncGen as Qt, _controllable_input as R, Global as Rn, _id as Rt, _attr_details_or_dialog_open_default as S, _call as Sn, _var_resume as St, _attr_input_checkedValue as T, Lazy as Tn, initEmbedded as Tt, controllableSpreadHelpers as U, PendingRenders as Un, _return as Ut, _controllable_textarea as V, PendingEffectScopes as Vn, _let_change as Vt, _attr as W, PlaceholderBranch as Wn, _return_change as Wt, _attr_nonce as X, insertBranchBefore as Xt, _attr_content as Y, destroyBranch as Yt, _attr_style as Z, removeAndDestroyBranch as Zt, patchDynamicTag as _, forTo as _n, createBranch as _t, _for_in as a, installBranchRenders as an, _html as at, startAwait as b, _assert_hoist as bn, _el as bt, _for_to as c, queueAsyncRender as cn, _style_shell as ct, _for_until_unkeyed as d, rendering as dn, _to_text as dt, PLACEHOLDER_DISMISS_REGISTER_ID as en, _attrs as et, _if as f, run as fn, _content as ft, installDynamicTagVar as g, forOf as gn, createAndSetupBranch as gt, dynamicTagScript as h, forIn as hn, _return_setup as ht, _dynamic_tag_content as i, createBranchRenders as in, _attrs_script as it, _attr_input_value_attribute_default as j, Pending as jn, _const as jt, _attr_input_checked_script as k, Returns as kn, _closure as kt, _for_to_unkeyed as l, queueEffect as ln, _text as lt, _try as m, runId as mn, _content_resume as mt, _await_promise as n, $signal as nn, _attrs_partial as nt, _for_of as o, installCatch as on, _lifecycle as ot, _show as p, runEffects as pn, _content_closures as pt, _attr_class_items as q, _var_change as qt, _dynamic_tag as r, $signalReset as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, prepareEffects as sn, _style_rule_item as st, _await_content as t, _on as tn, _attrs_content as tt, _for_until as u, queueRender as un, _text_content as ut, renderCatch as v, forUntil as vn, setupBranch as vt, _attr_input_checked as w, Clone as wn, init as wt, _attr_details_or_dialog_open as x, _hoist_read_error as xn, _resumed as xt, runPendingEffects as y, _assert_class_toggles as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, Load as zn, _if_closure as zt };