marko 6.0.112 → 6.0.114
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.
- package/README.md +1 -1
- package/dist/common/accessor.d.ts +2 -2
- package/dist/common/accessor.debug.d.ts +2 -2
- package/dist/common/types.d.ts +6 -1
- package/dist/debug/dom.js +140 -90
- package/dist/debug/dom.mjs +140 -90
- package/dist/debug/html.js +34 -24
- package/dist/debug/html.mjs +34 -24
- package/dist/dom/control-flow.d.ts +2 -1
- package/dist/dom/queue.d.ts +1 -1
- package/dist/dom/resume.d.ts +21 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +120 -95
- package/dist/dom.mjs +120 -95
- package/dist/html/writer.d.ts +2 -0
- package/dist/html.js +28 -24
- package/dist/html.mjs +28 -24
- package/dist/translator/index.js +35 -13
- package/dist/translator/util/sections.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/dom.mjs
CHANGED
|
@@ -512,60 +512,64 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
512
512
|
let lastScopeId = 0;
|
|
513
513
|
const nextToken = () => lastToken = visitText.slice(
|
|
514
514
|
lastTokenIndex,
|
|
515
|
-
|
|
516
|
-
(lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1) ? lastTokenIndex - 1 : visitText.length
|
|
515
|
+
(lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1
|
|
517
516
|
);
|
|
518
|
-
render.
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
[
|
|
530
|
-
|
|
531
|
-
);
|
|
532
|
-
} else {
|
|
533
|
-
for (const scope of serialized(serializeContext)) {
|
|
534
|
-
if (!$global) {
|
|
535
|
-
$global = scope || {};
|
|
536
|
-
$global.runtimeId = runtimeId;
|
|
537
|
-
$global.renderId = renderId;
|
|
538
|
-
} else if (typeof scope === "number") {
|
|
539
|
-
lastScopeId += scope;
|
|
540
|
-
} else {
|
|
541
|
-
scopeLookup[scope["#Id" /* Id */] = ++lastScopeId] = scope;
|
|
542
|
-
scope["$global" /* Global */] = $global;
|
|
543
|
-
if (branchesEnabled) {
|
|
544
|
-
scope["#ClosestBranch" /* ClosestBranch */] = scopeLookup[scope["#ClosestBranchId" /* ClosestBranchId */]];
|
|
517
|
+
render.m = (effects = []) => {
|
|
518
|
+
for (const serialized of resumes = render.r || []) {
|
|
519
|
+
if (typeof serialized === "string") {
|
|
520
|
+
lastTokenIndex = 0;
|
|
521
|
+
visitText = serialized;
|
|
522
|
+
while (nextToken()) {
|
|
523
|
+
if (/\D/.test(lastToken)) {
|
|
524
|
+
lastEffect = registeredValues[lastToken];
|
|
525
|
+
} else {
|
|
526
|
+
effects.push(
|
|
527
|
+
lastEffect,
|
|
528
|
+
scopeLookup[lastToken] ||= {
|
|
529
|
+
["#Id" /* Id */]: +lastToken
|
|
545
530
|
}
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
} else {
|
|
535
|
+
for (const scope of serialized(serializeContext)) {
|
|
536
|
+
if (!$global) {
|
|
537
|
+
$global = scope || {};
|
|
538
|
+
$global.runtimeId = runtimeId;
|
|
539
|
+
$global.renderId = renderId;
|
|
540
|
+
} else if (typeof scope === "number") {
|
|
541
|
+
lastScopeId += scope;
|
|
542
|
+
} else {
|
|
543
|
+
scopeLookup[scope["#Id" /* Id */] = ++lastScopeId] = scope;
|
|
544
|
+
scope["$global" /* Global */] = $global;
|
|
545
|
+
if (branchesEnabled) {
|
|
546
|
+
scope["#ClosestBranch" /* ClosestBranch */] = scopeLookup[scope["#ClosestBranchId" /* ClosestBranchId */]];
|
|
546
547
|
}
|
|
547
548
|
}
|
|
548
549
|
}
|
|
549
550
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
551
|
+
}
|
|
552
|
+
for (visit of visits = render.v) {
|
|
553
|
+
lastTokenIndex = render.i.length;
|
|
554
|
+
visitText = visit.data;
|
|
555
|
+
visitType = visitText[lastTokenIndex++];
|
|
556
|
+
visitScope = scopeLookup[+nextToken(
|
|
557
|
+
/* read scope id */
|
|
558
|
+
)] ||= {
|
|
559
|
+
["#Id" /* Id */]: +lastToken
|
|
560
|
+
};
|
|
561
|
+
if (visitType === "*" /* Node */) {
|
|
562
|
+
visitScope["Getter:" /* Getter */ + nextToken()] = /* @__PURE__ */ ((node) => () => node)(visitScope[lastToken] = visit.previousSibling);
|
|
563
|
+
} else if (branchesEnabled) {
|
|
564
|
+
visitBranches();
|
|
564
565
|
}
|
|
565
|
-
runEffects(effects);
|
|
566
|
-
} finally {
|
|
567
|
-
isResuming = visits.length = resumes.length = 0;
|
|
568
566
|
}
|
|
567
|
+
visits.length = resumes.length = 0;
|
|
568
|
+
return effects;
|
|
569
|
+
};
|
|
570
|
+
render.w = () => {
|
|
571
|
+
walk2();
|
|
572
|
+
runResumeEffects(render);
|
|
569
573
|
};
|
|
570
574
|
return render;
|
|
571
575
|
})
|
|
@@ -574,7 +578,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
574
578
|
if (renders) {
|
|
575
579
|
initRuntime(renders);
|
|
576
580
|
for (const renderId in renders) {
|
|
577
|
-
resumeRender(renderId)
|
|
581
|
+
runResumeEffects(resumeRender(renderId));
|
|
578
582
|
}
|
|
579
583
|
} else {
|
|
580
584
|
defineRuntime({
|
|
@@ -584,6 +588,14 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
584
588
|
}
|
|
585
589
|
}
|
|
586
590
|
var isResuming;
|
|
591
|
+
function runResumeEffects(render) {
|
|
592
|
+
try {
|
|
593
|
+
isResuming = 1;
|
|
594
|
+
runEffects(render.m(), 1);
|
|
595
|
+
} finally {
|
|
596
|
+
isResuming = 0;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
587
599
|
function getRegisteredWithScope(id, scope) {
|
|
588
600
|
const val = registeredValues[id];
|
|
589
601
|
return scope ? val(scope) : val;
|
|
@@ -1670,24 +1682,52 @@ function longestIncreasingSubsequence(a) {
|
|
|
1670
1682
|
}
|
|
1671
1683
|
|
|
1672
1684
|
// src/dom/control-flow.ts
|
|
1673
|
-
function
|
|
1685
|
+
function _await_promise(nodeAccessor, params) {
|
|
1674
1686
|
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1675
1687
|
const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
|
|
1676
1688
|
const branchAccessor = "BranchScopes:" /* BranchScopes */ + nodeAccessor;
|
|
1677
|
-
const
|
|
1678
|
-
|
|
1689
|
+
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
|
1690
|
+
_enable_catch();
|
|
1679
1691
|
return (scope, promise) => {
|
|
1680
|
-
|
|
1692
|
+
let awaitCounter;
|
|
1693
|
+
let renderData;
|
|
1681
1694
|
const tryWithPlaceholder = findBranchWithKey(
|
|
1682
1695
|
scope,
|
|
1683
1696
|
"#PlaceholderContent" /* PlaceholderContent */
|
|
1684
1697
|
);
|
|
1685
|
-
let awaitBranch = scope[branchAccessor];
|
|
1686
1698
|
if (tryWithPlaceholder) {
|
|
1699
|
+
renderData = self[tryWithPlaceholder["$global" /* Global */].runtimeId]?.[tryWithPlaceholder["$global" /* Global */].renderId];
|
|
1700
|
+
awaitCounter = tryWithPlaceholder["#AwaitCounter" /* AwaitCounter */] ||= renderData?.p?.[tryWithPlaceholder["#Id" /* Id */]];
|
|
1701
|
+
if (!awaitCounter?.i) {
|
|
1702
|
+
awaitCounter = tryWithPlaceholder["#AwaitCounter" /* AwaitCounter */] = {
|
|
1703
|
+
d: 1,
|
|
1704
|
+
i: 0,
|
|
1705
|
+
c() {
|
|
1706
|
+
if (!--awaitCounter.i) {
|
|
1707
|
+
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
|
1708
|
+
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = 0;
|
|
1709
|
+
if (placeholderBranch) {
|
|
1710
|
+
placeholderBranch["#StartNode" /* StartNode */].parentNode.insertBefore(
|
|
1711
|
+
tryWithPlaceholder["#StartNode" /* StartNode */].parentNode,
|
|
1712
|
+
placeholderBranch["#StartNode" /* StartNode */]
|
|
1713
|
+
);
|
|
1714
|
+
removeAndDestroyBranch(placeholderBranch);
|
|
1715
|
+
}
|
|
1716
|
+
queueEffect(tryWithPlaceholder, (scope2) => {
|
|
1717
|
+
const pendingEffects2 = scope2["#PendingEffects" /* PendingEffects */];
|
|
1718
|
+
if (pendingEffects2) {
|
|
1719
|
+
scope2["#PendingEffects" /* PendingEffects */] = [];
|
|
1720
|
+
runEffects(pendingEffects2, true);
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1687
1727
|
placeholderShown.add(pendingEffects);
|
|
1688
|
-
if (!scope[promiseAccessor] &&
|
|
1728
|
+
if (!scope[promiseAccessor] && !awaitCounter.i++) {
|
|
1689
1729
|
requestAnimationFrame(
|
|
1690
|
-
() =>
|
|
1730
|
+
() => awaitCounter.i && runEffects(
|
|
1691
1731
|
prepareEffects(
|
|
1692
1732
|
() => queueRender(
|
|
1693
1733
|
tryWithPlaceholder,
|
|
@@ -1710,12 +1750,12 @@ function _await(nodeAccessor, template, walks, setup, params) {
|
|
|
1710
1750
|
)
|
|
1711
1751
|
);
|
|
1712
1752
|
}
|
|
1713
|
-
} else if (
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1753
|
+
} else if (scope[branchAccessor] && !scope[promiseAccessor]) {
|
|
1754
|
+
scope[branchAccessor]["#StartNode" /* StartNode */].parentNode.insertBefore(
|
|
1755
|
+
scope[nodeAccessor],
|
|
1756
|
+
scope[branchAccessor]["#StartNode" /* StartNode */]
|
|
1717
1757
|
);
|
|
1718
|
-
tempDetachBranch(
|
|
1758
|
+
tempDetachBranch(scope[branchAccessor]);
|
|
1719
1759
|
}
|
|
1720
1760
|
const thisPromise = scope[promiseAccessor] = promise.then(
|
|
1721
1761
|
(data) => {
|
|
@@ -1725,45 +1765,47 @@ function _await(nodeAccessor, template, walks, setup, params) {
|
|
|
1725
1765
|
queueRender(
|
|
1726
1766
|
scope,
|
|
1727
1767
|
() => {
|
|
1728
|
-
if (
|
|
1768
|
+
if (scope[branchAccessor]) {
|
|
1729
1769
|
if (!tryWithPlaceholder) {
|
|
1730
|
-
|
|
1731
|
-
|
|
1770
|
+
scope[nodeAccessor].replaceWith(
|
|
1771
|
+
scope[branchAccessor]["#StartNode" /* StartNode */].parentNode
|
|
1732
1772
|
);
|
|
1733
1773
|
}
|
|
1734
1774
|
} else {
|
|
1735
1775
|
insertBranchBefore(
|
|
1736
|
-
|
|
1776
|
+
scope[branchAccessor] = createAndSetupBranch(
|
|
1737
1777
|
scope["$global" /* Global */],
|
|
1738
|
-
|
|
1778
|
+
scope[rendererAccessor],
|
|
1739
1779
|
scope,
|
|
1740
|
-
|
|
1780
|
+
scope[nodeAccessor].parentNode
|
|
1741
1781
|
),
|
|
1742
|
-
|
|
1743
|
-
|
|
1782
|
+
scope[nodeAccessor].parentNode,
|
|
1783
|
+
scope[nodeAccessor]
|
|
1744
1784
|
);
|
|
1745
|
-
|
|
1785
|
+
scope[nodeAccessor].remove();
|
|
1746
1786
|
}
|
|
1747
|
-
params?.(
|
|
1748
|
-
if (
|
|
1787
|
+
params?.(scope[branchAccessor], [data]);
|
|
1788
|
+
if (awaitCounter) {
|
|
1749
1789
|
placeholderShown.add(pendingEffects);
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
)
|
|
1758
|
-
|
|
1790
|
+
awaitCounter.c();
|
|
1791
|
+
if (!awaitCounter.d) {
|
|
1792
|
+
const fnScopes = /* @__PURE__ */ new Map();
|
|
1793
|
+
const effects = renderData.m();
|
|
1794
|
+
for (let i = 0; i < pendingEffects.length; ) {
|
|
1795
|
+
const fn = pendingEffects[i++];
|
|
1796
|
+
let scopes = fnScopes.get(fn);
|
|
1797
|
+
if (!scopes) {
|
|
1798
|
+
fnScopes.set(fn, scopes = /* @__PURE__ */ new Set());
|
|
1799
|
+
}
|
|
1800
|
+
scopes.add(pendingEffects[i++]);
|
|
1759
1801
|
}
|
|
1760
|
-
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1802
|
+
for (let i = 0; i < effects.length; ) {
|
|
1803
|
+
const fn = effects[i++];
|
|
1804
|
+
const scope2 = effects[i++];
|
|
1805
|
+
if (!fnScopes.get(fn)?.has(scope2)) {
|
|
1806
|
+
queueEffect(scope2, fn);
|
|
1765
1807
|
}
|
|
1766
|
-
}
|
|
1808
|
+
}
|
|
1767
1809
|
}
|
|
1768
1810
|
}
|
|
1769
1811
|
},
|
|
@@ -1773,8 +1815,7 @@ function _await(nodeAccessor, template, walks, setup, params) {
|
|
|
1773
1815
|
},
|
|
1774
1816
|
(error) => {
|
|
1775
1817
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1776
|
-
if (
|
|
1777
|
-
tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] = 0;
|
|
1818
|
+
if (awaitCounter) awaitCounter.i = 0;
|
|
1778
1819
|
scope[promiseAccessor] = 0;
|
|
1779
1820
|
schedule();
|
|
1780
1821
|
queueRender(scope, renderCatch, -1, error);
|
|
@@ -1783,6 +1824,13 @@ function _await(nodeAccessor, template, walks, setup, params) {
|
|
|
1783
1824
|
);
|
|
1784
1825
|
};
|
|
1785
1826
|
}
|
|
1827
|
+
function _await_content(nodeAccessor, template, walks, setup) {
|
|
1828
|
+
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + (true ? nodeAccessor : decodeAccessor4(nodeAccessor));
|
|
1829
|
+
const renderer = _content("", template, walks, setup)();
|
|
1830
|
+
return (scope) => {
|
|
1831
|
+
scope[rendererAccessor] = renderer;
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1786
1834
|
function _try(nodeAccessor, template, walks, setup) {
|
|
1787
1835
|
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1788
1836
|
const branchAccessor = "BranchScopes:" /* BranchScopes */ + nodeAccessor;
|
|
@@ -1814,7 +1862,8 @@ function renderCatch(scope, error) {
|
|
|
1814
1862
|
const owner = tryWithCatch["_" /* Owner */];
|
|
1815
1863
|
const placeholderBranch = tryWithCatch["#PlaceholderBranch" /* PlaceholderBranch */];
|
|
1816
1864
|
if (placeholderBranch) {
|
|
1817
|
-
tryWithCatch["#
|
|
1865
|
+
if (tryWithCatch["#AwaitCounter" /* AwaitCounter */])
|
|
1866
|
+
tryWithCatch["#AwaitCounter" /* AwaitCounter */].i = 0;
|
|
1818
1867
|
owner["BranchScopes:" /* BranchScopes */ + tryWithCatch["#BranchAccessor" /* BranchAccessor */]] = placeholderBranch;
|
|
1819
1868
|
destroyBranch(tryWithCatch);
|
|
1820
1869
|
}
|
|
@@ -2191,7 +2240,7 @@ var _enable_catch = () => {
|
|
|
2191
2240
|
enableBranches();
|
|
2192
2241
|
const handlePendingTry = (fn, scope, branch) => {
|
|
2193
2242
|
while (branch) {
|
|
2194
|
-
if (branch["#
|
|
2243
|
+
if (branch["#AwaitCounter" /* AwaitCounter */]?.i) {
|
|
2195
2244
|
return (branch["#PendingEffects" /* PendingEffects */] ||= []).push(fn, scope);
|
|
2196
2245
|
}
|
|
2197
2246
|
branch = branch["#ParentBranch" /* ParentBranch */];
|
|
@@ -2472,7 +2521,8 @@ export {
|
|
|
2472
2521
|
_attrs_partial,
|
|
2473
2522
|
_attrs_partial_content,
|
|
2474
2523
|
_attrs_script,
|
|
2475
|
-
|
|
2524
|
+
_await_content,
|
|
2525
|
+
_await_promise,
|
|
2476
2526
|
_call,
|
|
2477
2527
|
_child_setup,
|
|
2478
2528
|
_closure,
|
package/dist/debug/html.js
CHANGED
|
@@ -374,7 +374,7 @@ var REORDER_RUNTIME_CODE = true ? (
|
|
|
374
374
|
let onNextSibling,
|
|
375
375
|
placeholder,
|
|
376
376
|
nextSibling,
|
|
377
|
-
placeholders = {},
|
|
377
|
+
placeholders = runtime.p = {},
|
|
378
378
|
replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);
|
|
379
379
|
runtime.d.head.append(
|
|
380
380
|
runtime.d.querySelector("style[" + runtime.i + "]") || ""
|
|
@@ -424,7 +424,7 @@ var REORDER_RUNTIME_CODE = true ? (
|
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
426
|
})`
|
|
427
|
-
) : `(e=>{if(e.j)return;let i,l,r,t={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),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]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})`;
|
|
427
|
+
) : `(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),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]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})`;
|
|
428
428
|
|
|
429
429
|
// src/html/serializer.ts
|
|
430
430
|
var kTouchedIterator = Symbol();
|
|
@@ -1792,6 +1792,9 @@ function writeScript(script) {
|
|
|
1792
1792
|
$chunk.writeScript(script);
|
|
1793
1793
|
}
|
|
1794
1794
|
function _script(scopeId, registryId) {
|
|
1795
|
+
if ($chunk.context?.[kIsAsync]) {
|
|
1796
|
+
_resume_branch(scopeId);
|
|
1797
|
+
}
|
|
1795
1798
|
$chunk.boundary.state.needsMainRuntime = true;
|
|
1796
1799
|
$chunk.writeEffect(scopeId, registryId);
|
|
1797
1800
|
}
|
|
@@ -1831,13 +1834,13 @@ function normalizeServerRender(value) {
|
|
|
1831
1834
|
}
|
|
1832
1835
|
}
|
|
1833
1836
|
var kPendingContexts = Symbol("Pending Contexts");
|
|
1834
|
-
function withContext(key, value, cb) {
|
|
1837
|
+
function withContext(key, value, cb, cbValue) {
|
|
1835
1838
|
const ctx = $chunk.context ||= { [kPendingContexts]: 0 };
|
|
1836
1839
|
const prev = ctx[key];
|
|
1837
1840
|
ctx[kPendingContexts]++;
|
|
1838
1841
|
ctx[key] = value;
|
|
1839
1842
|
try {
|
|
1840
|
-
return cb();
|
|
1843
|
+
return cb(cbValue);
|
|
1841
1844
|
} finally {
|
|
1842
1845
|
ctx[kPendingContexts]--;
|
|
1843
1846
|
ctx[key] = prev;
|
|
@@ -1906,17 +1909,21 @@ function _hoist(scopeId, id) {
|
|
|
1906
1909
|
return _resume(getter, id, scopeId);
|
|
1907
1910
|
}
|
|
1908
1911
|
function _resume_branch(scopeId) {
|
|
1909
|
-
const branchId = $chunk.context?.[
|
|
1912
|
+
const branchId = $chunk.context?.[kBranchId];
|
|
1910
1913
|
if (branchId !== void 0 && branchId !== scopeId) {
|
|
1911
1914
|
writeScope(scopeId, { ["#ClosestBranchId" /* ClosestBranchId */]: branchId });
|
|
1912
1915
|
}
|
|
1913
1916
|
}
|
|
1914
|
-
var
|
|
1917
|
+
var kBranchId = Symbol("Branch Id");
|
|
1918
|
+
var kIsAsync = Symbol("Is Async");
|
|
1915
1919
|
function isInResumedBranch() {
|
|
1916
|
-
return $chunk?.context?.[
|
|
1920
|
+
return $chunk?.context?.[kBranchId] !== void 0;
|
|
1917
1921
|
}
|
|
1918
1922
|
function withBranchId(branchId, cb) {
|
|
1919
|
-
return withContext(
|
|
1923
|
+
return withContext(kBranchId, branchId, cb);
|
|
1924
|
+
}
|
|
1925
|
+
function withIsAsync(cb, value) {
|
|
1926
|
+
return withContext(kIsAsync, true, cb, value);
|
|
1920
1927
|
}
|
|
1921
1928
|
function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
|
|
1922
1929
|
const { state } = $chunk.boundary;
|
|
@@ -2300,7 +2307,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
2300
2307
|
$chunk.writeHTML(
|
|
2301
2308
|
$chunk.boundary.state.mark("[" /* BranchStart */, "")
|
|
2302
2309
|
);
|
|
2303
|
-
content
|
|
2310
|
+
withIsAsync(content, value);
|
|
2304
2311
|
$chunk.writeHTML(
|
|
2305
2312
|
$chunk.boundary.state.mark(
|
|
2306
2313
|
"]" /* BranchEnd */,
|
|
@@ -2308,7 +2315,7 @@ function _await(scopeId, accessor, promise, content, serializeMarker) {
|
|
|
2308
2315
|
)
|
|
2309
2316
|
);
|
|
2310
2317
|
} else {
|
|
2311
|
-
content
|
|
2318
|
+
withIsAsync(content, value);
|
|
2312
2319
|
}
|
|
2313
2320
|
});
|
|
2314
2321
|
boundary.endAsync(chunk);
|
|
@@ -2328,11 +2335,11 @@ function _try(scopeId, accessor, content, input) {
|
|
|
2328
2335
|
const placeholderContent = normalizeDynamicRenderer(input.placeholder);
|
|
2329
2336
|
if (catchContent) {
|
|
2330
2337
|
tryCatch(
|
|
2331
|
-
placeholderContent ? () => tryPlaceholder(content, placeholderContent) : content,
|
|
2338
|
+
placeholderContent ? () => tryPlaceholder(content, placeholderContent, branchId) : content,
|
|
2332
2339
|
catchContent
|
|
2333
2340
|
);
|
|
2334
2341
|
} else if (placeholderContent) {
|
|
2335
|
-
tryPlaceholder(content, placeholderContent);
|
|
2342
|
+
tryPlaceholder(content, placeholderContent, branchId);
|
|
2336
2343
|
} else {
|
|
2337
2344
|
content();
|
|
2338
2345
|
}
|
|
@@ -2348,7 +2355,7 @@ function _try(scopeId, accessor, content, input) {
|
|
|
2348
2355
|
)
|
|
2349
2356
|
);
|
|
2350
2357
|
}
|
|
2351
|
-
function tryPlaceholder(content, placeholder) {
|
|
2358
|
+
function tryPlaceholder(content, placeholder, branchId) {
|
|
2352
2359
|
const chunk = $chunk;
|
|
2353
2360
|
const { boundary } = chunk;
|
|
2354
2361
|
const body = new Chunk(boundary, null, chunk.context);
|
|
@@ -2356,9 +2363,10 @@ function tryPlaceholder(content, placeholder) {
|
|
|
2356
2363
|
chunk.append(body);
|
|
2357
2364
|
return;
|
|
2358
2365
|
}
|
|
2359
|
-
chunk.next = $chunk = new Chunk(boundary, chunk.next,
|
|
2366
|
+
chunk.next = $chunk = new Chunk(boundary, chunk.next, chunk.context);
|
|
2360
2367
|
chunk.placeholderBody = body;
|
|
2361
2368
|
chunk.placeholderRender = placeholder;
|
|
2369
|
+
chunk.placeholderBranchId = branchId;
|
|
2362
2370
|
}
|
|
2363
2371
|
function tryCatch(content, catchContent) {
|
|
2364
2372
|
const chunk = $chunk;
|
|
@@ -2534,18 +2542,16 @@ var Chunk = class {
|
|
|
2534
2542
|
reorderId = null;
|
|
2535
2543
|
placeholderBody = null;
|
|
2536
2544
|
placeholderRender = null;
|
|
2545
|
+
placeholderBranchId = null;
|
|
2537
2546
|
writeHTML(html) {
|
|
2538
2547
|
this.html += html;
|
|
2539
2548
|
}
|
|
2540
2549
|
writeEffect(scopeId, registryId) {
|
|
2541
2550
|
if (this.lastEffect === registryId) {
|
|
2542
|
-
this.effects += "
|
|
2551
|
+
this.effects += " " + scopeId;
|
|
2543
2552
|
} else {
|
|
2544
2553
|
this.lastEffect = registryId;
|
|
2545
|
-
this.effects = concatEffects(
|
|
2546
|
-
this.effects,
|
|
2547
|
-
'"' + registryId + '",' + scopeId
|
|
2548
|
-
);
|
|
2554
|
+
this.effects = concatEffects(this.effects, registryId + " " + scopeId);
|
|
2549
2555
|
}
|
|
2550
2556
|
}
|
|
2551
2557
|
writeScript(script) {
|
|
@@ -2562,7 +2568,8 @@ var Chunk = class {
|
|
|
2562
2568
|
const body = this.placeholderBody.consume();
|
|
2563
2569
|
if (body.async) {
|
|
2564
2570
|
const { state } = this.boundary;
|
|
2565
|
-
const reorderId = body.reorderId = state.nextReorderId();
|
|
2571
|
+
const reorderId = body.reorderId = this.placeholderBranchId ? this.placeholderBranchId + "" : state.nextReorderId();
|
|
2572
|
+
this.placeholderBranchId = null;
|
|
2566
2573
|
this.writeHTML(state.mark("!^" /* Placeholder */, reorderId));
|
|
2567
2574
|
const after = this.render(this.placeholderRender);
|
|
2568
2575
|
if (after !== this) {
|
|
@@ -2634,7 +2641,7 @@ var Chunk = class {
|
|
|
2634
2641
|
}
|
|
2635
2642
|
if (effects) {
|
|
2636
2643
|
needsWalk = true;
|
|
2637
|
-
state.resumes = state.resumes ? state.resumes +
|
|
2644
|
+
state.resumes = state.resumes ? state.resumes + ',"' + effects + '"' : '"' + effects + '"';
|
|
2638
2645
|
}
|
|
2639
2646
|
if (state.resumes) {
|
|
2640
2647
|
if (state.hasWrittenResume) {
|
|
@@ -2698,12 +2705,12 @@ var Chunk = class {
|
|
|
2698
2705
|
}
|
|
2699
2706
|
reorderScripts = concatScripts(
|
|
2700
2707
|
reorderScripts,
|
|
2701
|
-
|
|
2708
|
+
'_.push("' + reorderEffects + '")'
|
|
2702
2709
|
);
|
|
2703
2710
|
}
|
|
2704
2711
|
scripts = concatScripts(
|
|
2705
2712
|
scripts,
|
|
2706
|
-
reorderScripts && runtimePrefix + ".j
|
|
2713
|
+
reorderScripts && runtimePrefix + ".j" /* Scripts */ + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"
|
|
2707
2714
|
);
|
|
2708
2715
|
html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
|
|
2709
2716
|
}
|
|
@@ -2762,7 +2769,7 @@ function flushSerializer(boundary) {
|
|
|
2762
2769
|
if (scopeIdDelta) serializeData.push(scopeIdDelta);
|
|
2763
2770
|
serializeData.push(scope);
|
|
2764
2771
|
}
|
|
2765
|
-
state.resumes =
|
|
2772
|
+
state.resumes = concatSequence(
|
|
2766
2773
|
state.resumes,
|
|
2767
2774
|
serializer.stringify(serializeData, boundary)
|
|
2768
2775
|
);
|
|
@@ -2777,6 +2784,9 @@ function _trailers(html) {
|
|
|
2777
2784
|
$chunk.boundary.state.trailerHTML += html;
|
|
2778
2785
|
}
|
|
2779
2786
|
function concatEffects(a, b) {
|
|
2787
|
+
return a ? b ? a + " " + b : a : b;
|
|
2788
|
+
}
|
|
2789
|
+
function concatSequence(a, b) {
|
|
2780
2790
|
return a ? b ? a + "," + b : a : b;
|
|
2781
2791
|
}
|
|
2782
2792
|
function concatScripts(a, b) {
|