marko 6.3.47 → 6.3.49

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 (59) hide show
  1. package/cheatsheet.md +19 -16
  2. package/dist/common/accessor.d.ts +0 -3
  3. package/dist/common/accessor.debug.d.ts +0 -3
  4. package/dist/common/constants/resume-symbol.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-var.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  19. package/dist/debug/dom/placeholder.feat.js +1 -1
  20. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  21. package/dist/debug/{dom-BheMBjYT.js → dom-BAGeiafn.js} +31 -17
  22. package/dist/debug/{dom-DyBeisho.mjs → dom-C55iHvof.mjs} +26 -18
  23. package/dist/debug/dom.js +20 -24
  24. package/dist/debug/dom.mjs +20 -24
  25. package/dist/debug/html.js +76 -37
  26. package/dist/debug/html.mjs +76 -37
  27. package/dist/dom/catch.feat.js +1 -1
  28. package/dist/dom/catch.feat.mjs +1 -1
  29. package/dist/dom/controllable-input.feat.js +1 -1
  30. package/dist/dom/controllable-input.feat.mjs +1 -1
  31. package/dist/dom/controllable-open.feat.js +1 -1
  32. package/dist/dom/controllable-open.feat.mjs +1 -1
  33. package/dist/dom/controllable-select.feat.js +1 -1
  34. package/dist/dom/controllable-select.feat.mjs +1 -1
  35. package/dist/dom/controllable-textarea.feat.js +1 -1
  36. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  37. package/dist/dom/controllable.feat.js +1 -1
  38. package/dist/dom/controllable.feat.mjs +1 -1
  39. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  40. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  41. package/dist/dom/placeholder.feat.js +1 -1
  42. package/dist/dom/placeholder.feat.mjs +1 -1
  43. package/dist/{dom-DprILxYO.js → dom-BNmfm4st.js} +31 -26
  44. package/dist/{dom-BbknkVDz.mjs → dom-BsAS26Ze.mjs} +16 -16
  45. package/dist/dom.js +20 -20
  46. package/dist/dom.mjs +14 -14
  47. package/dist/html/inlined-runtimes.d.ts +2 -2
  48. package/dist/html/inlined-runtimes.debug.d.ts +2 -2
  49. package/dist/html/writer.d.ts +3 -1
  50. package/dist/html.js +46 -36
  51. package/dist/html.mjs +46 -36
  52. package/dist/translator/index.js +108 -82
  53. package/dist/translator/util/get-compile-stage.d.ts +2 -0
  54. package/dist/translator/util/references.d.ts +4 -2
  55. package/dist/translator/util/sections.d.ts +4 -1
  56. package/dist/translator/util/serialize-reasons.d.ts +3 -2
  57. package/package.json +4 -4
  58. package/dist/common/constants/load-signal-value.d.ts +0 -5
  59. package/dist/common/constants/load-signal-value.debug.d.ts +0 -5
@@ -1,4 +1,4 @@
1
- import { N as _attr_select_value_script, z as controllableScripts } from "../dom-BbknkVDz.mjs";
1
+ import { N as _attr_select_value_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-DprILxYO.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  require_control_flow.z[2] = require_control_flow.A;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { A as _attr_input_value_script, z as controllableScripts } from "../dom-BbknkVDz.mjs";
1
+ import { A as _attr_input_value_script, z as controllableScripts } from "../dom-BsAS26Ze.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-DprILxYO.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.R.INPUT = require_control_flow.P, require_control_flow.R.TEXTAREA = require_control_flow.L, require_control_flow.R.SELECT = require_control_flow.I, require_control_flow.R.DETAILS = require_control_flow.R.DIALOG = require_control_flow.F;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-BbknkVDz.mjs";
1
+ import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-BsAS26Ze.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-DprILxYO.js"), elementGetter = (branch) => () => branch.S;
1
+ let require_control_flow = require("../dom-BNmfm4st.js"), elementGetter = (branch) => () => branch.S;
2
2
  require_control_flow.m((branch) => branch.T(elementGetter(branch))), require_control_flow.gt("_e", elementGetter);
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
1
  let elementGetter = (branch) => () => branch.S;
2
- import { gt as _resume, m as installDynamicTagVar } from "../dom-BbknkVDz.mjs";
2
+ import { gt as _resume, m as installDynamicTagVar } from "../dom-BsAS26Ze.mjs";
3
3
  installDynamicTagVar((branch) => branch.T(elementGetter(branch))), _resume("_e", elementGetter);
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-DprILxYO.js");
1
+ let require_control_flow = require("../dom-BNmfm4st.js");
2
2
  //#region src/dom/placeholder.feat.ts
3
3
  require_control_flow.Ct._f = (tryBranch) => {
4
4
  tryBranch.P &&= (require_control_flow.Kt(tryBranch.P), 0);
@@ -1,4 +1,4 @@
1
- import { Ct as registeredValues, Kt as destroyBranch } from "../dom-BbknkVDz.mjs";
1
+ import { Ct as registeredValues, Kt as destroyBranch } from "../dom-BsAS26Ze.mjs";
2
2
  //#region src/dom/placeholder.feat.ts
3
3
  registeredValues._f = (tryBranch) => {
4
4
  tryBranch.P &&= (destroyBranch(tryBranch.P), 0);
@@ -534,34 +534,34 @@ function init(runtimeId = "M") {
534
534
  if (curRenders) return;
535
535
  let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
536
536
  defineRuntime({ value: curRenders = ((renderId) => {
537
- let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
537
+ let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
538
538
  runtimeId,
539
539
  renderId
540
- }, initScope = (scope) => (scope.H = 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
540
+ }, initScope = (scope) => (scope.H ??= 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
541
541
  let scopeId = partials[0];
542
542
  for (let i = 1; i < partials.length; i++) {
543
543
  let partial = partials[i];
544
544
  typeof partial == "number" ? scopeId += partial : (scopeId ? initScope(Object.assign(scopeLookup[scopeId] ||= (partial.L = scopeId, partial), partial)) : Object.assign(initGlobal(), partial), scopeId++);
545
545
  }
546
- }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], orphanBranches = [], deferredOwners = [], curBranchScopes) => (branchId, branch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, j = deferredOwners.length) => {
547
- for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + lastToken, singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
546
+ }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope.F === scope ? scope !== branch && setParentBranch(scope, branch) : scope.F = branch) => (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
547
+ if (visitType === "*") {
548
+ for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
549
+ (reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
550
+ return;
551
+ }
552
+ for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
548
553
  if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
549
554
  for (; startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling););
550
555
  branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
551
- } else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
552
- for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
553
- for (; j && deferredOwners[j - 1].L > branchId;) {
554
- j--;
555
- let owner = deferredOwners.pop();
556
- owner.F !== owner && (owner.F = branch);
557
- }
556
+ } else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
557
+ for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
558
558
  nextToken();
559
559
  }
560
560
  if (endedBranches) {
561
- for (let ended of endedBranches) orphanBranches.push(ended);
561
+ for (let ended of endedBranches) pending.push(ended);
562
562
  singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
563
563
  }
564
- visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : deferredOwners.push(visitScope);
564
+ visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
565
565
  }, nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
566
566
  let i = 0;
567
567
  for (; i < resumes.length; i++) {
@@ -586,8 +586,8 @@ function init(runtimeId = "M") {
586
586
  }
587
587
  }
588
588
  let retained = 0;
589
- for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : visitScope[nextToken()] = visitType === "$" ? visit.previousSibling : visit.parentNode.insertBefore(new Text(), visit);
590
- return embedRenders && !embedAnchor && visit && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
589
+ for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : (visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope));
590
+ return branchesEnabled && visitBranches && (visitType = "*", lastToken = "", visitBranches()), embedRenders && !embedAnchor && visit?.parentNode && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
591
591
  }, render.w = () => {
592
592
  walk(), runResumeEffects(render);
593
593
  }, render;
@@ -1440,7 +1440,7 @@ Object.defineProperty(exports, "$", {
1440
1440
  }), Object.defineProperty(exports, "an", {
1441
1441
  enumerable: !0,
1442
1442
  get: function() {
1443
- return run;
1443
+ return queueRender;
1444
1444
  }
1445
1445
  }), Object.defineProperty(exports, "at", {
1446
1446
  enumerable: !0,
@@ -1465,7 +1465,7 @@ Object.defineProperty(exports, "$", {
1465
1465
  }), Object.defineProperty(exports, "cn", {
1466
1466
  enumerable: !0,
1467
1467
  get: function() {
1468
- return forIn;
1468
+ return runId;
1469
1469
  }
1470
1470
  }), Object.defineProperty(exports, "ct", {
1471
1471
  enumerable: !0,
@@ -1480,7 +1480,7 @@ Object.defineProperty(exports, "$", {
1480
1480
  }), Object.defineProperty(exports, "dn", {
1481
1481
  enumerable: !0,
1482
1482
  get: function() {
1483
- return forUntil;
1483
+ return forTo;
1484
1484
  }
1485
1485
  }), Object.defineProperty(exports, "dt", {
1486
1486
  enumerable: !0,
@@ -1505,7 +1505,7 @@ Object.defineProperty(exports, "$", {
1505
1505
  }), Object.defineProperty(exports, "fn", {
1506
1506
  enumerable: !0,
1507
1507
  get: function() {
1508
- return _assert_hoist;
1508
+ return forUntil;
1509
1509
  }
1510
1510
  }), Object.defineProperty(exports, "ft", {
1511
1511
  enumerable: !0,
@@ -1517,6 +1517,11 @@ Object.defineProperty(exports, "$", {
1517
1517
  get: function() {
1518
1518
  return renderCatch;
1519
1519
  }
1520
+ }), Object.defineProperty(exports, "gn", {
1521
+ enumerable: !0,
1522
+ get: function() {
1523
+ return decodeAccessor;
1524
+ }
1520
1525
  }), Object.defineProperty(exports, "gt", {
1521
1526
  enumerable: !0,
1522
1527
  get: function() {
@@ -1530,7 +1535,7 @@ Object.defineProperty(exports, "$", {
1530
1535
  }), Object.defineProperty(exports, "hn", {
1531
1536
  enumerable: !0,
1532
1537
  get: function() {
1533
- return decodeAccessor;
1538
+ return _call;
1534
1539
  }
1535
1540
  }), Object.defineProperty(exports, "ht", {
1536
1541
  enumerable: !0,
@@ -1580,7 +1585,7 @@ Object.defineProperty(exports, "$", {
1580
1585
  }), Object.defineProperty(exports, "ln", {
1581
1586
  enumerable: !0,
1582
1587
  get: function() {
1583
- return forOf;
1588
+ return forIn;
1584
1589
  }
1585
1590
  }), Object.defineProperty(exports, "lt", {
1586
1591
  enumerable: !0,
@@ -1595,7 +1600,7 @@ Object.defineProperty(exports, "$", {
1595
1600
  }), Object.defineProperty(exports, "mn", {
1596
1601
  enumerable: !0,
1597
1602
  get: function() {
1598
- return _call;
1603
+ return _hoist_read_error;
1599
1604
  }
1600
1605
  }), Object.defineProperty(exports, "mt", {
1601
1606
  enumerable: !0,
@@ -1625,7 +1630,7 @@ Object.defineProperty(exports, "$", {
1625
1630
  }), Object.defineProperty(exports, "on", {
1626
1631
  enumerable: !0,
1627
1632
  get: function() {
1628
- return runEffects;
1633
+ return run;
1629
1634
  }
1630
1635
  }), Object.defineProperty(exports, "ot", {
1631
1636
  enumerable: !0,
@@ -1640,7 +1645,7 @@ Object.defineProperty(exports, "$", {
1640
1645
  }), Object.defineProperty(exports, "pn", {
1641
1646
  enumerable: !0,
1642
1647
  get: function() {
1643
- return _hoist_read_error;
1648
+ return _assert_hoist;
1644
1649
  }
1645
1650
  }), Object.defineProperty(exports, "pt", {
1646
1651
  enumerable: !0,
@@ -1680,7 +1685,7 @@ Object.defineProperty(exports, "$", {
1680
1685
  }), Object.defineProperty(exports, "sn", {
1681
1686
  enumerable: !0,
1682
1687
  get: function() {
1683
- return runId;
1688
+ return runEffects;
1684
1689
  }
1685
1690
  }), Object.defineProperty(exports, "st", {
1686
1691
  enumerable: !0,
@@ -1710,7 +1715,7 @@ Object.defineProperty(exports, "$", {
1710
1715
  }), Object.defineProperty(exports, "un", {
1711
1716
  enumerable: !0,
1712
1717
  get: function() {
1713
- return forTo;
1718
+ return forOf;
1714
1719
  }
1715
1720
  }), Object.defineProperty(exports, "ut", {
1716
1721
  enumerable: !0,
@@ -534,34 +534,34 @@ function init(runtimeId = "M") {
534
534
  if (curRenders) return;
535
535
  let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
536
536
  defineRuntime({ value: curRenders = ((renderId) => {
537
- let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
537
+ let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
538
538
  runtimeId,
539
539
  renderId
540
- }, initScope = (scope) => (scope.H = 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
540
+ }, initScope = (scope) => (scope.H ??= 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
541
541
  let scopeId = partials[0];
542
542
  for (let i = 1; i < partials.length; i++) {
543
543
  let partial = partials[i];
544
544
  typeof partial == "number" ? scopeId += partial : (scopeId ? initScope(Object.assign(scopeLookup[scopeId] ||= (partial.L = scopeId, partial), partial)) : Object.assign(initGlobal(), partial), scopeId++);
545
545
  }
546
- }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], orphanBranches = [], deferredOwners = [], curBranchScopes) => (branchId, branch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length, j = deferredOwners.length) => {
547
- for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + lastToken, singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
546
+ }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? registeredValues[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope.F === scope ? scope !== branch && setParentBranch(scope, branch) : scope.F = branch) => (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
547
+ if (visitType === "*") {
548
+ for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
549
+ (reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
550
+ return;
551
+ }
552
+ for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
548
553
  if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
549
554
  for (; startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling););
550
555
  branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
551
- } else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
552
- for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
553
- for (; j && deferredOwners[j - 1].L > branchId;) {
554
- j--;
555
- let owner = deferredOwners.pop();
556
- owner.F !== owner && (owner.F = branch);
557
- }
556
+ } else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
557
+ for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
558
558
  nextToken();
559
559
  }
560
560
  if (endedBranches) {
561
- for (let ended of endedBranches) orphanBranches.push(ended);
561
+ for (let ended of endedBranches) pending.push(ended);
562
562
  singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
563
563
  }
564
- visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : deferredOwners.push(visitScope);
564
+ visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
565
565
  }, nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
566
566
  let i = 0;
567
567
  for (; i < resumes.length; i++) {
@@ -586,8 +586,8 @@ function init(runtimeId = "M") {
586
586
  }
587
587
  }
588
588
  let retained = 0;
589
- for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : visitScope[nextToken()] = visitType === "$" ? visit.previousSibling : visit.parentNode.insertBefore(new Text(), visit);
590
- return embedRenders && !embedAnchor && visit && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
589
+ for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : (visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope));
590
+ return branchesEnabled && visitBranches && (visitType = "*", lastToken = "", visitBranches()), embedRenders && !embedAnchor && visit?.parentNode && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]), visits.length = retained, effects;
591
591
  }, render.w = () => {
592
592
  walk(), runResumeEffects(render);
593
593
  }, render;
@@ -1153,4 +1153,4 @@ function byFirstArg(name) {
1153
1153
  return name;
1154
1154
  }
1155
1155
  //#endregion
1156
- 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, registeredValues 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, readyFailed 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 _, _var_resume as _t, _for_in as a, run as an, _text_content as at, _attr_input_checked as b, initEmbedded as bt, _for_until as c, forIn as cn, toInsertNode as ct, _show as d, forUntil as dn, _content_resume as dt, installCatch as en, _html as et, _try as f, _assert_hoist as fn, createAndSetupBranch as ft, renderCatch as g, _resume as gt, patchDynamicTag as h, decodeAccessor 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, forOf as ln, _content as lt, installDynamicTagVar as m, _call as mn, setupBranch as mt, _await_promise as n, prepareEffects as nn, _style_rule_item as nt, _for_of as o, runEffects as on, _to_text as ot, addAwaitCounter as p, _hoist_read_error 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, runId as sn, insertChildNodes as st, _await_content as t, placeholderShown as tn, _lifecycle as tt, _resume_dynamic_tag as u, forTo as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, getRegisteredWithScope as vt, _attr_input_checked_default as w, withLazy as wt, _attr_input_checkedValue as x, ready as xt, _attr_details_or_dialog_open_script as y, init as yt, controllableScripts as z, _or as zt };
1156
+ 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, registeredValues 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, readyFailed 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 _, _var_resume as _t, _for_in as a, queueRender as an, _text_content as at, _attr_input_checked as b, initEmbedded as bt, _for_until as c, runId as cn, toInsertNode as ct, _show as d, forTo as dn, _content_resume as dt, installCatch as en, _html as et, _try as f, forUntil as fn, createAndSetupBranch as ft, renderCatch as g, decodeAccessor as gn, _resume 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, addAwaitCounter 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, _resume_dynamic_tag as u, forOf as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, getRegisteredWithScope as vt, _attr_input_checked_default as w, withLazy as wt, _attr_input_checkedValue as x, ready as xt, _attr_details_or_dialog_open_script as y, init as yt, controllableScripts as z, _or as zt };
package/dist/dom.js CHANGED
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("./dom-DprILxYO.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
1
+ let require_control_flow = require("./dom-BNmfm4st.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
2
  require_control_flow.yt($global.runtimeId);
3
3
  let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
4
4
  return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
@@ -38,7 +38,7 @@ let require_control_flow = require("./dom-DprILxYO.js"), empty = [], rest = Symb
38
38
  branch.S = startNode, branch.K = endNode;
39
39
  },
40
40
  runComponentEffects() {
41
- this.effects && require_control_flow.on(this.effects);
41
+ this.effects && require_control_flow.sn(this.effects);
42
42
  },
43
43
  runComponentDestroy() {
44
44
  this.scope && require_control_flow.Kt(this.scope);
@@ -76,11 +76,11 @@ let require_control_flow = require("./dom-DprILxYO.js"), empty = [], rest = Symb
76
76
  }, _load_signal(() => (pending ||= load()).then((r) => ({ _: r.d }))));
77
77
  return lazyTemplate;
78
78
  }), _load_setup = /*@__PURE__*/ require_control_flow.wt((nodeAccessor, childScopeAccessor, load) => {
79
- nodeAccessor = require_control_flow.hn(nodeAccessor), childScopeAccessor = require_control_flow.hn(childScopeAccessor);
80
- let pending, renderer;
79
+ nodeAccessor = require_control_flow.gn(nodeAccessor), childScopeAccessor = require_control_flow.gn(childScopeAccessor);
80
+ let pending, renderer, insertCached = (child, marker) => insertLoaded(renderer, child, marker);
81
81
  return (owner) => {
82
82
  let child = owner[childScopeAccessor];
83
- if (renderer) insertLoaded(renderer, child, owner[nodeAccessor]);
83
+ if (renderer) require_control_flow.an(child, insertCached, -1, owner[nodeAccessor]);
84
84
  else {
85
85
  let awaitCounter = require_control_flow.p(owner);
86
86
  child.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((mod) => {
@@ -89,10 +89,10 @@ let require_control_flow = require("./dom-DprILxYO.js"), empty = [], rest = Symb
89
89
  }
90
90
  };
91
91
  }), _load_signal = /*@__PURE__*/ require_control_flow.wt((load) => {
92
- let pending, signal;
93
- return (scope, value) => {
94
- pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.sn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => require_control_flow.rn(scope, signal = mod._, value), () => 0);
92
+ let pending, apply = (scope, value) => {
93
+ pending ||= load(), scope.X || !("X" in scope) && scope.H === require_control_flow.cn ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => require_control_flow.rn(scope, apply._ = mod._, value), () => 0);
95
94
  };
95
+ return apply;
96
96
  });
97
97
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
98
98
  //#region src/common/attr-tag.ts
@@ -136,7 +136,7 @@ function mount(input = {}, reference, position) {
136
136
  curValue = newValue;
137
137
  }, this.c?.(branch), args?.(branch, input);
138
138
  });
139
- return require_control_flow.st(parentNode, nextSibling, branch.S, branch.K), require_control_flow.on(effects), {
139
+ return require_control_flow.st(parentNode, nextSibling, branch.S, branch.K), require_control_flow.sn(effects), {
140
140
  get value() {
141
141
  return curValue;
142
142
  },
@@ -144,7 +144,7 @@ function mount(input = {}, reference, position) {
144
144
  require_control_flow.Wt(branch, newValue);
145
145
  },
146
146
  update(newInput = {}) {
147
- args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.on(require_control_flow.nn(() => {
147
+ args && (newInput.$global && ({$global, ...newInput} = newInput), require_control_flow.sn(require_control_flow.nn(() => {
148
148
  args(branch, newInput);
149
149
  })));
150
150
  },
@@ -156,17 +156,17 @@ function mount(input = {}, reference, position) {
156
156
  //#endregion
157
157
  //#region src/dom/load.ts
158
158
  function insertLoaded(renderer, branch, marker, awaitCounter) {
159
- let parent = marker.parentNode, values = branch.X, insert = () => {
159
+ let parent = marker.parentNode, values = branch.X, clone = () => {
160
+ require_control_flow.Yt(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0;
161
+ }, insert = () => {
160
162
  require_control_flow.qt(branch, parent, marker), marker.remove(), awaitCounter?.c();
161
163
  }, remaining;
162
- if (require_control_flow.Yt(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0, remaining = values?.size) {
164
+ if (remaining = values?.size) {
163
165
  let fail = loadFailed(branch, awaitCounter);
164
- for (let [promise, entry] of values) promise.then((signal) => {
165
- entry.b = signal, --remaining || require_control_flow.rn(branch, (branch) => {
166
- require_control_flow.Yt(branch), renderer.c?.(branch), values.forEach((e) => e.b._(branch, e.a)), insert();
167
- });
168
- }, (error) => remaining > 0 && (remaining = 0, fail(error)));
169
- } else require_control_flow.mt(renderer, branch), insert();
166
+ values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.rn(branch, (branch) => {
167
+ clone(), renderer.c?.(branch), values.forEach(([value, apply]) => apply(branch, value)), insert();
168
+ }), (error) => remaining > 0 && (remaining = 0, fail(error))));
169
+ } else clone(), require_control_flow.mt(renderer, branch), insert();
170
170
  }
171
171
  function loadFailed(scope, awaitCounter) {
172
172
  return (error) => {
@@ -196,9 +196,9 @@ function _load_race_trigger(...triggers) {
196
196
  function getSelectorOrResolve(selector, resolve) {
197
197
  return document.querySelector(selector) || resolve();
198
198
  }
199
- exports.$signal = require_control_flow.Zt, exports.$signalReset = require_control_flow.Qt, exports._assert_hoist = require_control_flow.fn, exports._assert_init = require_control_flow.Gt, exports._attr = require_control_flow.B, exports._attr_class = require_control_flow.V, exports._attr_class_item = require_control_flow.H, exports._attr_class_items = require_control_flow.U, exports._attr_content = require_control_flow.W, exports._attr_details_open = require_control_flow._, exports._attr_dialog_open = require_control_flow._, exports._attr_details_open_default = require_control_flow.v, exports._attr_dialog_open_default = require_control_flow.v, exports._attr_details_open_script = require_control_flow.y, exports._attr_dialog_open_script = require_control_flow.y, exports._attr_input_checked = require_control_flow.b, exports._attr_input_checkedValue = require_control_flow.x, exports._attr_input_checkedValue_default = require_control_flow.S, exports._attr_input_checkedValue_script = require_control_flow.C, exports._attr_input_checked_default = require_control_flow.w, exports._attr_input_checked_script = require_control_flow.T, exports._attr_input_value = require_control_flow.E, exports._attr_textarea_value = require_control_flow.E, exports._attr_input_value_attribute_default = require_control_flow.D, exports._attr_input_value_default = require_control_flow.O, exports._attr_textarea_value_default = require_control_flow.O, exports._attr_input_value_dynamic_default = require_control_flow.k, exports._attr_input_value_script = require_control_flow.A, exports._attr_textarea_value_script = require_control_flow.A, exports._attr_nonce = require_control_flow.G, exports._attr_select_value = require_control_flow.j, exports._attr_select_value_default = require_control_flow.M, exports._attr_select_value_script = require_control_flow.N, exports._attr_style = require_control_flow.K, exports._attr_style_item = require_control_flow.q, exports._attr_style_items = require_control_flow.J, exports._attrs = require_control_flow.Y, exports._attrs_content = require_control_flow.X, exports._attrs_partial = require_control_flow.Z, exports._attrs_partial_content = require_control_flow.Q, exports._attrs_script = require_control_flow.$, exports._await_content = require_control_flow.t, exports._await_promise = require_control_flow.n, exports._call = require_control_flow.mn, exports._child_setup = require_control_flow.Tt, exports._closure = require_control_flow.Et, exports._closure_get = require_control_flow.Dt, exports._const = require_control_flow.Ot, exports._content = require_control_flow.lt, exports._content_closures = require_control_flow.ut, exports._content_resume = require_control_flow.dt, exports._controllable_input = require_control_flow.P, exports._controllable_open = require_control_flow.F, exports._controllable_select = require_control_flow.I, exports._controllable_textarea = require_control_flow.L, Object.defineProperty(exports, "_dynamic_tag", {
199
+ exports.$signal = require_control_flow.Zt, exports.$signalReset = require_control_flow.Qt, exports._assert_hoist = require_control_flow.pn, exports._assert_init = require_control_flow.Gt, exports._attr = require_control_flow.B, exports._attr_class = require_control_flow.V, exports._attr_class_item = require_control_flow.H, exports._attr_class_items = require_control_flow.U, exports._attr_content = require_control_flow.W, exports._attr_details_open = require_control_flow._, exports._attr_dialog_open = require_control_flow._, exports._attr_details_open_default = require_control_flow.v, exports._attr_dialog_open_default = require_control_flow.v, exports._attr_details_open_script = require_control_flow.y, exports._attr_dialog_open_script = require_control_flow.y, exports._attr_input_checked = require_control_flow.b, exports._attr_input_checkedValue = require_control_flow.x, exports._attr_input_checkedValue_default = require_control_flow.S, exports._attr_input_checkedValue_script = require_control_flow.C, exports._attr_input_checked_default = require_control_flow.w, exports._attr_input_checked_script = require_control_flow.T, exports._attr_input_value = require_control_flow.E, exports._attr_textarea_value = require_control_flow.E, exports._attr_input_value_attribute_default = require_control_flow.D, exports._attr_input_value_default = require_control_flow.O, exports._attr_textarea_value_default = require_control_flow.O, exports._attr_input_value_dynamic_default = require_control_flow.k, exports._attr_input_value_script = require_control_flow.A, exports._attr_textarea_value_script = require_control_flow.A, exports._attr_nonce = require_control_flow.G, exports._attr_select_value = require_control_flow.j, exports._attr_select_value_default = require_control_flow.M, exports._attr_select_value_script = require_control_flow.N, exports._attr_style = require_control_flow.K, exports._attr_style_item = require_control_flow.q, exports._attr_style_items = require_control_flow.J, exports._attrs = require_control_flow.Y, exports._attrs_content = require_control_flow.X, exports._attrs_partial = require_control_flow.Z, exports._attrs_partial_content = require_control_flow.Q, exports._attrs_script = require_control_flow.$, exports._await_content = require_control_flow.t, exports._await_promise = require_control_flow.n, exports._call = require_control_flow.hn, exports._child_setup = require_control_flow.Tt, exports._closure = require_control_flow.Et, exports._closure_get = require_control_flow.Dt, exports._const = require_control_flow.Ot, exports._content = require_control_flow.lt, exports._content_closures = require_control_flow.ut, exports._content_resume = require_control_flow.dt, exports._controllable_input = require_control_flow.P, exports._controllable_open = require_control_flow.F, exports._controllable_select = require_control_flow.I, exports._controllable_textarea = require_control_flow.L, Object.defineProperty(exports, "_dynamic_tag", {
200
200
  enumerable: !0,
201
201
  get: function() {
202
202
  return require_control_flow.r;
203
203
  }
204
- }), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.ht, exports._el_read = require_control_flow.kt, exports._for_closure = require_control_flow.At, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_selector = require_control_flow.jt, exports._for_to = require_control_flow.s, exports._for_until = require_control_flow.c, exports._global_read = require_control_flow.Mt, exports._hoist = require_control_flow.Nt, exports._hoist_read_error = require_control_flow.pn, exports._hoist_resume = require_control_flow.Pt, exports._html = require_control_flow.et, exports._id = require_control_flow.Ft, exports._if = require_control_flow.l, exports._if_closure = require_control_flow.It, exports._let = require_control_flow.Lt, exports._let_change = require_control_flow.Rt, exports._lifecycle = require_control_flow.tt, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = require_control_flow.Xt, exports._or = require_control_flow.zt, exports._resume = require_control_flow.gt, exports._resume_dynamic_tag = require_control_flow.u, exports._return = require_control_flow.Bt, exports._return_change = require_control_flow.Vt, exports._script = require_control_flow.Ht, exports._show = require_control_flow.d, exports._style_rule_item = require_control_flow.nt, exports._style_shell = require_control_flow.rt, exports._template = _template, exports._text = require_control_flow.it, exports._text_content = require_control_flow.at, exports._to_text = require_control_flow.ot, exports._try = require_control_flow.f, exports._var = require_control_flow.Ut, exports._var_change = require_control_flow.Wt, exports._var_resume = require_control_flow._t, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.cn, exports.forOf = require_control_flow.ln, exports.forTo = require_control_flow.un, exports.forUntil = require_control_flow.dn, exports.init = require_control_flow.yt, exports.initEmbedded = require_control_flow.bt, exports.ready = require_control_flow.xt, exports.readyFailed = require_control_flow.St, exports.run = require_control_flow.an;
204
+ }), exports._dynamic_tag_content = require_control_flow.i, exports._el = require_control_flow.ht, exports._el_read = require_control_flow.kt, exports._for_closure = require_control_flow.At, exports._for_in = require_control_flow.a, exports._for_of = require_control_flow.o, exports._for_selector = require_control_flow.jt, exports._for_to = require_control_flow.s, exports._for_until = require_control_flow.c, exports._global_read = require_control_flow.Mt, exports._hoist = require_control_flow.Nt, exports._hoist_read_error = require_control_flow.mn, exports._hoist_resume = require_control_flow.Pt, exports._html = require_control_flow.et, exports._id = require_control_flow.Ft, exports._if = require_control_flow.l, exports._if_closure = require_control_flow.It, exports._let = require_control_flow.Lt, exports._let_change = require_control_flow.Rt, exports._lifecycle = require_control_flow.tt, exports._load_event_trigger = _load_event_trigger, exports._load_idle_trigger = _load_idle_trigger, exports._load_media_trigger = _load_media_trigger, exports._load_race_trigger = _load_race_trigger, exports._load_setup = _load_setup, exports._load_signal = _load_signal, exports._load_template = _load_template, exports._load_visible_trigger = _load_visible_trigger, exports._on = require_control_flow.Xt, exports._or = require_control_flow.zt, exports._resume = require_control_flow.gt, exports._resume_dynamic_tag = require_control_flow.u, exports._return = require_control_flow.Bt, exports._return_change = require_control_flow.Vt, exports._script = require_control_flow.Ht, exports._show = require_control_flow.d, exports._style_rule_item = require_control_flow.nt, exports._style_shell = require_control_flow.rt, exports._template = _template, exports._text = require_control_flow.it, exports._text_content = require_control_flow.at, exports._to_text = require_control_flow.ot, exports._try = require_control_flow.f, exports._var = require_control_flow.Ut, exports._var_change = require_control_flow.Wt, exports._var_resume = require_control_flow._t, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = require_control_flow.ln, exports.forOf = require_control_flow.un, exports.forTo = require_control_flow.dn, exports.forUntil = require_control_flow.fn, exports.init = require_control_flow.yt, exports.initEmbedded = require_control_flow.bt, exports.ready = require_control_flow.xt, exports.readyFailed = require_control_flow.St, exports.run = require_control_flow.on;
package/dist/dom.mjs CHANGED
@@ -77,10 +77,10 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
77
77
  return lazyTemplate;
78
78
  }), _load_setup = /*@__PURE__*/ withLazy((nodeAccessor, childScopeAccessor, load) => {
79
79
  nodeAccessor = decodeAccessor(nodeAccessor), childScopeAccessor = decodeAccessor(childScopeAccessor);
80
- let pending, renderer;
80
+ let pending, renderer, insertCached = (child, marker) => insertLoaded(renderer, child, marker);
81
81
  return (owner) => {
82
82
  let child = owner[childScopeAccessor];
83
- if (renderer) insertLoaded(renderer, child, owner[nodeAccessor]);
83
+ if (renderer) queueRender(child, insertCached, -1, owner[nodeAccessor]);
84
84
  else {
85
85
  let awaitCounter = addAwaitCounter(owner);
86
86
  child.X ||= /* @__PURE__ */ new Map(), (pending ||= load()).then((mod) => {
@@ -89,12 +89,12 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
89
89
  }
90
90
  };
91
91
  }), _load_signal = /*@__PURE__*/ withLazy((load) => {
92
- let pending, signal;
93
- return (scope, value) => {
94
- pending ||= load(), scope.X || !("X" in scope) && scope.H === runId ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, { a: value }) : signal ? signal(scope, value) : pending.then((mod) => queueAsyncRender(scope, signal = mod._, value), () => 0);
92
+ let pending, apply = (scope, value) => {
93
+ pending ||= load(), scope.X || !("X" in scope) && scope.H === runId ? (scope.X ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]) : apply._ ? apply._(scope, value) : pending.then((mod) => queueAsyncRender(scope, apply._ = mod._, value), () => 0);
95
94
  };
95
+ return apply;
96
96
  });
97
- import { $ as _attrs_script, A as _attr_input_value_script, At as _for_closure, B as _attr, Bt as _return, C as _attr_input_checkedValue_script, D as _attr_input_value_attribute_default, Dt as _closure_get, E as _attr_input_value, Et as _closure, F as _controllable_open, Ft as _id, G as _attr_nonce, Gt as _assert_init, H as _attr_class_item, Ht as _script, I as _controllable_select, It as _if_closure, J as _attr_style_items, Jt as removeAndDestroyBranch, K as _attr_style, Kt as destroyBranch, L as _controllable_textarea, Lt as _let, M as _attr_select_value_default, Mt as _global_read, N as _attr_select_value_script, Nt as _hoist, O as _attr_input_value_default, Ot as _const, P as _controllable_input, Pt as _hoist_resume, Q as _attrs_partial_content, Qt as $signalReset, Rt as _let_change, S as _attr_input_checkedValue_default, St as readyFailed, T as _attr_input_checked_script, Tt as _child_setup, U as _attr_class_items, Ut as _var, V as _attr_class, Vt as _return_change, W as _attr_content, Wt as _var_change, X as _attrs_content, Xt as _on, Y as _attrs, Yt as syncGen, Z as _attrs_partial, Zt as $signal, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as run, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as forIn, ct as toInsertNode, d as _show, dn as forUntil, dt as _content_resume, et as _html, f as _try, fn as _assert_hoist, ft as createAndSetupBranch, g as renderCatch, gt as _resume, h as patchDynamicTag, hn as decodeAccessor, ht as _el, i as _dynamic_tag_content, in as queueEffect, it as _text, j as _attr_select_value, jt as _for_selector, k as _attr_input_value_dynamic_default, kt as _el_read, l as _if, ln as forOf, lt as _content, mn as _call, mt as setupBranch, n as _await_promise, nn as prepareEffects, nt as _style_rule_item, o as _for_of, on as runEffects, ot as _to_text, p as addAwaitCounter, pn as _hoist_read_error, pt as createBranch, q as _attr_style_item, qt as insertBranchBefore, r as _dynamic_tag, rn as queueAsyncRender, rt as _style_shell, s as _for_to, sn as runId, st as insertChildNodes, t as _await_content, tt as _lifecycle, u as _resume_dynamic_tag, un as forTo, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as withLazy, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _or } from "./dom-BbknkVDz.mjs";
97
+ import { $ as _attrs_script, A as _attr_input_value_script, At as _for_closure, B as _attr, Bt as _return, C as _attr_input_checkedValue_script, D as _attr_input_value_attribute_default, Dt as _closure_get, E as _attr_input_value, Et as _closure, F as _controllable_open, Ft as _id, G as _attr_nonce, Gt as _assert_init, H as _attr_class_item, Ht as _script, I as _controllable_select, It as _if_closure, J as _attr_style_items, Jt as removeAndDestroyBranch, K as _attr_style, Kt as destroyBranch, L as _controllable_textarea, Lt as _let, M as _attr_select_value_default, Mt as _global_read, N as _attr_select_value_script, Nt as _hoist, O as _attr_input_value_default, Ot as _const, P as _controllable_input, Pt as _hoist_resume, Q as _attrs_partial_content, Qt as $signalReset, Rt as _let_change, S as _attr_input_checkedValue_default, St as readyFailed, T as _attr_input_checked_script, Tt as _child_setup, U as _attr_class_items, Ut as _var, V as _attr_class, Vt as _return_change, W as _attr_content, Wt as _var_change, X as _attrs_content, Xt as _on, Y as _attrs, Yt as syncGen, Z as _attrs_partial, Zt as $signal, _ as _attr_details_or_dialog_open, _t as _var_resume, a as _for_in, an as queueRender, at as _text_content, b as _attr_input_checked, bt as initEmbedded, c as _for_until, cn as runId, ct as toInsertNode, d as _show, dn as forTo, dt as _content_resume, et as _html, f as _try, fn as forUntil, ft as createAndSetupBranch, g as renderCatch, gn as decodeAccessor, gt as _resume, h as patchDynamicTag, hn as _call, ht as _el, i as _dynamic_tag_content, in as queueEffect, it as _text, j as _attr_select_value, jt as _for_selector, k as _attr_input_value_dynamic_default, kt as _el_read, l as _if, ln as forIn, lt as _content, mn as _hoist_read_error, mt as setupBranch, n as _await_promise, nn as prepareEffects, nt as _style_rule_item, o as _for_of, on as run, ot as _to_text, p as addAwaitCounter, pn as _assert_hoist, pt as createBranch, q as _attr_style_item, qt as insertBranchBefore, r as _dynamic_tag, rn as queueAsyncRender, rt as _style_shell, s as _for_to, sn as runEffects, st as insertChildNodes, t as _await_content, tt as _lifecycle, u as _resume_dynamic_tag, un as forOf, ut as _content_closures, v as _attr_details_or_dialog_open_default, vt as getRegisteredWithScope, w as _attr_input_checked_default, wt as withLazy, x as _attr_input_checkedValue, xt as ready, y as _attr_details_or_dialog_open_script, yt as init, zt as _or } from "./dom-BsAS26Ze.mjs";
98
98
  //#region src/common/attr-tag.ts
99
99
  function attrTag(attrs) {
100
100
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
@@ -156,17 +156,17 @@ function mount(input = {}, reference, position) {
156
156
  //#endregion
157
157
  //#region src/dom/load.ts
158
158
  function insertLoaded(renderer, branch, marker, awaitCounter) {
159
- let parent = marker.parentNode, values = branch.X, insert = () => {
159
+ let parent = marker.parentNode, values = branch.X, clone = () => {
160
+ syncGen(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0;
161
+ }, insert = () => {
160
162
  insertBranchBefore(branch, parent, marker), marker.remove(), awaitCounter?.c();
161
163
  }, remaining;
162
- if (syncGen(branch), renderer.b(branch, parent.namespaceURI), branch.X = 0, remaining = values?.size) {
164
+ if (remaining = values?.size) {
163
165
  let fail = loadFailed(branch, awaitCounter);
164
- for (let [promise, entry] of values) promise.then((signal) => {
165
- entry.b = signal, --remaining || queueAsyncRender(branch, (branch) => {
166
- syncGen(branch), renderer.c?.(branch), values.forEach((e) => e.b._(branch, e.a)), insert();
167
- });
168
- }, (error) => remaining > 0 && (remaining = 0, fail(error)));
169
- } else setupBranch(renderer, branch), insert();
166
+ values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && queueAsyncRender(branch, (branch) => {
167
+ clone(), renderer.c?.(branch), values.forEach(([value, apply]) => apply(branch, value)), insert();
168
+ }), (error) => remaining > 0 && (remaining = 0, fail(error))));
169
+ } else clone(), setupBranch(renderer, branch), insert();
170
170
  }
171
171
  function loadFailed(scope, awaitCounter) {
172
172
  return (error) => {
@@ -1,2 +1,2 @@
1
- export declare const WALKER_RUNTIME_CODE = "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))";
2
- export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
1
+ export declare const WALKER_RUNTIME_CODE = "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))";
2
+ export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
@@ -1,2 +1,2 @@
1
- export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n d: doc,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((lookup[(id = op.slice(prefixLen + 1))] = node), op[prefixLen])),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n, self[runtimeId]))";
2
- export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
1
+ export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n d: doc,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n // Only reorder markers (\"#\", \"!\") are ever looked up, so only they are\n // kept: the lookup lives as long as the page, and every node marker\n // would otherwise stay referenced in it after resume consumed it.\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((id = op.slice(prefixLen + 1)),\n (op = op[prefixLen]) > \"#\" || (lookup[id] = node),\n op)),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n, self[runtimeId]))";
2
+ export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n r: id,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // Opens the chunk's visits for resume to parent to the root's branch; the\n // walk that this chunk's own script triggers closes it.\n runtime.v.push({ data: runtime.i + \"*\" + placeholder.r });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
@@ -35,9 +35,10 @@ export declare function withContext<T>(key: PropertyKey, value: unknown, cb: ()
35
35
  export declare function withContext<T, U>(key: PropertyKey, value: unknown, cb: (value: U) => T, cbValue: U): T;
36
36
  export declare function isInResumedBranch(): boolean;
37
37
  export declare function withBranchId<T>(branchId: number, cb: () => T): T;
38
+ export declare function withBranchId<T, U>(branchId: number, cb: (value: U) => T, cbValue: U): T;
38
39
  export declare function _html(html: string): void;
39
40
  export declare function writeScript(script: string): void;
40
- export declare function _script(scopeId: number, registryId: string): void;
41
+ export declare function _script(scopeId: number, registryId: string, serializeMarker?: number): void;
41
42
  export declare function _trailers(html: string): void;
42
43
  export declare function _resume<T extends WeakKey>(val: T, id: string, scopeId?: number): T;
43
44
  export declare function _resume_locals<T extends WeakKey>(val: T, id: string, locals: Record<string, unknown>, ownerScopeId?: number): T;
@@ -126,6 +127,7 @@ export { FlushStatus };
126
127
  export declare class Boundary extends AbortController {
127
128
  onNext: typeof NOOP;
128
129
  count: number;
130
+ resumeWrites: number;
129
131
  state: State;
130
132
  parent?: Boundary;
131
133
  constructor(state: State, signal?: AbortSignal, parent?: Boundary);