marko 6.0.0-next.3.70 → 6.0.0-next.3.72
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/dist/common/types.d.ts +5 -5
- package/dist/debug/dom.js +96 -91
- package/dist/debug/dom.mjs +96 -91
- package/dist/debug/html.js +4 -3
- package/dist/debug/html.mjs +4 -3
- package/dist/dom/control-flow.d.ts +1 -1
- package/dist/dom/queue.d.ts +1 -1
- package/dist/dom/resume.d.ts +1 -1
- package/dist/dom/schedule.d.ts +0 -1
- package/dist/dom.js +106 -99
- package/dist/dom.mjs +106 -99
- package/dist/html.js +4 -3
- package/dist/html.mjs +4 -3
- package/dist/translator/index.js +63 -72
- package/dist/translator/util/signals.d.ts +0 -1
- package/index.d.ts +22 -14
- package/package.json +1 -1
package/dist/common/types.d.ts
CHANGED
@@ -76,15 +76,15 @@ export interface TemplateInput extends Input {
|
|
76
76
|
$global?: $Global;
|
77
77
|
}
|
78
78
|
export interface Template {
|
79
|
-
mount(input: Input, reference: Node, position?: InsertPosition):
|
80
|
-
render(input?: Input):
|
79
|
+
mount(input: Input, reference: Node, position?: InsertPosition): MountedTemplate;
|
80
|
+
render(input?: Input): RenderedTemplate;
|
81
81
|
}
|
82
|
-
export interface
|
82
|
+
export interface MountedTemplate {
|
83
83
|
update(input: unknown): void;
|
84
84
|
destroy(): void;
|
85
85
|
}
|
86
|
-
export type
|
87
|
-
toReadable(): ReadableStream
|
86
|
+
export type RenderedTemplate = PromiseLike<string> & AsyncIterable<string> & {
|
87
|
+
toReadable(): ReadableStream<Uint8Array<ArrayBufferLike>>;
|
88
88
|
};
|
89
89
|
export declare enum ControlledType {
|
90
90
|
InputChecked = 0,
|
package/dist/debug/dom.js
CHANGED
@@ -359,7 +359,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
359
359
|
if (resumes) {
|
360
360
|
try {
|
361
361
|
render.r = [];
|
362
|
-
isResuming =
|
362
|
+
isResuming = 1;
|
363
363
|
for (let i = 0; i < resumes.length; i++) {
|
364
364
|
const serialized = resumes[i];
|
365
365
|
if (typeof serialized === "function") {
|
@@ -410,7 +410,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
410
410
|
}
|
411
411
|
}
|
412
412
|
} finally {
|
413
|
-
isResuming =
|
413
|
+
isResuming = 0;
|
414
414
|
}
|
415
415
|
}
|
416
416
|
};
|
@@ -430,7 +430,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
430
430
|
});
|
431
431
|
}
|
432
432
|
}
|
433
|
-
var isResuming
|
433
|
+
var isResuming;
|
434
434
|
function register(id, obj) {
|
435
435
|
registeredValues[id] = obj;
|
436
436
|
return obj;
|
@@ -1388,7 +1388,7 @@ var runTask;
|
|
1388
1388
|
var port2 = /* @__PURE__ */ (() => {
|
1389
1389
|
const { port1, port2: port22 } = new MessageChannel();
|
1390
1390
|
port1.onmessage = () => {
|
1391
|
-
isScheduled =
|
1391
|
+
isScheduled = 0;
|
1392
1392
|
if (true) {
|
1393
1393
|
const run2 = runTask;
|
1394
1394
|
runTask = void 0;
|
@@ -1410,7 +1410,7 @@ function schedule() {
|
|
1410
1410
|
runTask = run;
|
1411
1411
|
}
|
1412
1412
|
}
|
1413
|
-
isScheduled =
|
1413
|
+
isScheduled = 1;
|
1414
1414
|
queueMicrotask(flushAndWaitFrame);
|
1415
1415
|
}
|
1416
1416
|
}
|
@@ -1624,77 +1624,36 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1624
1624
|
scope,
|
1625
1625
|
"#PlaceholderContent" /* PlaceholderContent */
|
1626
1626
|
);
|
1627
|
-
let awaitBranch = scope[branchAccessor];
|
1628
1627
|
const referenceNode = scope[nodeAccessor];
|
1629
|
-
|
1630
|
-
const thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
1631
|
-
if (scope.___closestBranch?.___destroyed || scope[promiseAccessor] !== thisPromise) {
|
1632
|
-
return;
|
1633
|
-
}
|
1634
|
-
scope[promiseAccessor] = void 0;
|
1635
|
-
runEffects(
|
1636
|
-
prepareEffects(() => {
|
1637
|
-
if (tryWithPlaceholder) {
|
1638
|
-
placeholderShown.add(pendingEffects);
|
1639
|
-
}
|
1640
|
-
if (!awaitBranch || !tryWithPlaceholder) {
|
1641
|
-
insertBranchBefore(
|
1642
|
-
awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
|
1643
|
-
scope.$global,
|
1644
|
-
renderer,
|
1645
|
-
scope,
|
1646
|
-
namespaceNode
|
1647
|
-
),
|
1648
|
-
referenceNode.parentNode,
|
1649
|
-
referenceNode
|
1650
|
-
);
|
1651
|
-
referenceNode.remove();
|
1652
|
-
}
|
1653
|
-
renderer.___params?.(awaitBranch, [data2]);
|
1654
|
-
})
|
1655
|
-
);
|
1656
|
-
if (tryWithPlaceholder) {
|
1657
|
-
if (!--tryWithPlaceholder.___pendingAsyncCount) {
|
1658
|
-
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
1659
|
-
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = void 0;
|
1660
|
-
if (placeholderBranch) {
|
1661
|
-
insertBranchBefore(
|
1662
|
-
tryWithPlaceholder,
|
1663
|
-
placeholderBranch.___startNode.parentNode,
|
1664
|
-
placeholderBranch.___startNode
|
1665
|
-
);
|
1666
|
-
removeAndDestroyBranch(placeholderBranch);
|
1667
|
-
}
|
1668
|
-
if (tryWithPlaceholder.___effects) {
|
1669
|
-
runEffects(tryWithPlaceholder.___effects, true);
|
1670
|
-
}
|
1671
|
-
}
|
1672
|
-
}
|
1673
|
-
}).catch((error) => {
|
1674
|
-
renderCatch(scope, error, true);
|
1675
|
-
});
|
1628
|
+
let awaitBranch = scope[branchAccessor];
|
1676
1629
|
if (tryWithPlaceholder) {
|
1677
1630
|
placeholderShown.add(pendingEffects);
|
1678
|
-
if (!tryWithPlaceholder.___pendingAsyncCount) {
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1631
|
+
if (!scope[promiseAccessor] && (tryWithPlaceholder.___pendingAsyncCount = (tryWithPlaceholder.___pendingAsyncCount || 0) + 1) === 1) {
|
1632
|
+
requestAnimationFrame(
|
1633
|
+
() => tryWithPlaceholder.___pendingAsyncCount && runEffects(
|
1634
|
+
prepareEffects(
|
1635
|
+
() => queueRender(
|
1636
|
+
tryWithPlaceholder,
|
1637
|
+
() => {
|
1638
|
+
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = createAndSetupBranch(
|
1639
|
+
scope.$global,
|
1640
|
+
tryWithPlaceholder["#PlaceholderContent" /* PlaceholderContent */],
|
1641
|
+
tryWithPlaceholder._,
|
1642
|
+
tryWithPlaceholder.___startNode.parentNode
|
1643
|
+
);
|
1644
|
+
insertBranchBefore(
|
1645
|
+
placeholderBranch,
|
1646
|
+
tryWithPlaceholder.___startNode.parentNode,
|
1647
|
+
tryWithPlaceholder.___startNode
|
1648
|
+
);
|
1649
|
+
tempDetatchBranch(tryWithPlaceholder);
|
1650
|
+
},
|
1651
|
+
-1
|
1652
|
+
)
|
1653
|
+
)
|
1654
|
+
)
|
1655
|
+
);
|
1696
1656
|
}
|
1697
|
-
tryWithPlaceholder.___pendingAsyncCount++;
|
1698
1657
|
} else if (awaitBranch) {
|
1699
1658
|
awaitBranch.___startNode.parentNode.insertBefore(
|
1700
1659
|
referenceNode,
|
@@ -1702,6 +1661,60 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1702
1661
|
);
|
1703
1662
|
tempDetatchBranch(awaitBranch);
|
1704
1663
|
}
|
1664
|
+
const thisPromise = scope[promiseAccessor] = promise.then(
|
1665
|
+
(data2) => {
|
1666
|
+
if (thisPromise === scope[promiseAccessor]) {
|
1667
|
+
scope[promiseAccessor] = 0;
|
1668
|
+
schedule();
|
1669
|
+
queueRender(
|
1670
|
+
scope,
|
1671
|
+
() => {
|
1672
|
+
if (!awaitBranch || !tryWithPlaceholder) {
|
1673
|
+
insertBranchBefore(
|
1674
|
+
awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
|
1675
|
+
scope.$global,
|
1676
|
+
renderer,
|
1677
|
+
scope,
|
1678
|
+
referenceNode.parentNode
|
1679
|
+
),
|
1680
|
+
referenceNode.parentNode,
|
1681
|
+
referenceNode
|
1682
|
+
);
|
1683
|
+
referenceNode.remove();
|
1684
|
+
}
|
1685
|
+
renderer.___params?.(awaitBranch, [data2]);
|
1686
|
+
if (tryWithPlaceholder) {
|
1687
|
+
placeholderShown.add(pendingEffects);
|
1688
|
+
if (!--tryWithPlaceholder.___pendingAsyncCount) {
|
1689
|
+
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
1690
|
+
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = 0;
|
1691
|
+
if (placeholderBranch) {
|
1692
|
+
insertBranchBefore(
|
1693
|
+
tryWithPlaceholder,
|
1694
|
+
placeholderBranch.___startNode.parentNode,
|
1695
|
+
placeholderBranch.___startNode
|
1696
|
+
);
|
1697
|
+
removeAndDestroyBranch(placeholderBranch);
|
1698
|
+
}
|
1699
|
+
if (tryWithPlaceholder.___effects) {
|
1700
|
+
runEffects(tryWithPlaceholder.___effects, true);
|
1701
|
+
}
|
1702
|
+
}
|
1703
|
+
}
|
1704
|
+
},
|
1705
|
+
-1
|
1706
|
+
);
|
1707
|
+
}
|
1708
|
+
},
|
1709
|
+
(error) => {
|
1710
|
+
if (thisPromise === scope[promiseAccessor]) {
|
1711
|
+
if (tryWithPlaceholder) tryWithPlaceholder.___pendingAsyncCount = 0;
|
1712
|
+
scope[promiseAccessor] = 0;
|
1713
|
+
schedule();
|
1714
|
+
queueRender(scope, renderCatch, -1, error);
|
1715
|
+
}
|
1716
|
+
}
|
1717
|
+
);
|
1705
1718
|
};
|
1706
1719
|
}
|
1707
1720
|
function createTry(nodeAccessor, tryContent) {
|
@@ -1725,19 +1738,14 @@ function createTry(nodeAccessor, tryContent) {
|
|
1725
1738
|
}
|
1726
1739
|
};
|
1727
1740
|
}
|
1728
|
-
function renderCatch(scope, error
|
1741
|
+
function renderCatch(scope, error) {
|
1729
1742
|
const tryWithCatch = findBranchWithKey(scope, "#CatchContent" /* CatchContent */);
|
1730
1743
|
if (!tryWithCatch) {
|
1731
|
-
|
1732
|
-
setTimeout(() => {
|
1733
|
-
throw error;
|
1734
|
-
});
|
1735
|
-
} else {
|
1736
|
-
throw error;
|
1737
|
-
}
|
1744
|
+
throw error;
|
1738
1745
|
} else {
|
1739
1746
|
const placeholderBranch = tryWithCatch["#PlaceholderBranch" /* PlaceholderBranch */];
|
1740
1747
|
if (placeholderBranch) {
|
1748
|
+
tryWithCatch.___pendingAsyncCount = 0;
|
1741
1749
|
tryWithCatch._["ConditionalScope:" /* ConditionalScope */ + tryWithCatch["#BranchAccessor" /* BranchAccessor */]] = placeholderBranch;
|
1742
1750
|
destroyBranch(tryWithCatch);
|
1743
1751
|
}
|
@@ -1825,10 +1833,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1825
1833
|
normalizedRenderer._ ? args[0] : args
|
1826
1834
|
);
|
1827
1835
|
} else {
|
1828
|
-
const inputWithContent = getContent ? {
|
1829
|
-
...args,
|
1830
|
-
content: getContent(scope)
|
1831
|
-
} : args || {};
|
1836
|
+
const inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
|
1832
1837
|
normalizedRenderer.___params(
|
1833
1838
|
scope[childScopeAccessor],
|
1834
1839
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
@@ -1955,7 +1960,7 @@ var pendingRendersLookup = /* @__PURE__ */ new Map();
|
|
1955
1960
|
var caughtError = /* @__PURE__ */ new WeakSet();
|
1956
1961
|
var placeholderShown = /* @__PURE__ */ new WeakSet();
|
1957
1962
|
var pendingEffects = [];
|
1958
|
-
var rendering
|
1963
|
+
var rendering;
|
1959
1964
|
var scopeKeyOffset = 1e3;
|
1960
1965
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.___id) {
|
1961
1966
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
@@ -1987,13 +1992,13 @@ function queueEffect(scope, fn) {
|
|
1987
1992
|
function run() {
|
1988
1993
|
const effects = pendingEffects;
|
1989
1994
|
try {
|
1990
|
-
rendering =
|
1995
|
+
rendering = 1;
|
1991
1996
|
runRenders();
|
1992
1997
|
} finally {
|
1993
1998
|
pendingRenders = [];
|
1994
1999
|
pendingRendersLookup = /* @__PURE__ */ new Map();
|
1995
2000
|
pendingEffects = [];
|
1996
|
-
rendering =
|
2001
|
+
rendering = 0;
|
1997
2002
|
}
|
1998
2003
|
runEffects(effects);
|
1999
2004
|
}
|
@@ -2005,11 +2010,11 @@ function prepareEffects(fn) {
|
|
2005
2010
|
pendingRenders = [];
|
2006
2011
|
pendingRendersLookup = /* @__PURE__ */ new Map();
|
2007
2012
|
try {
|
2008
|
-
rendering =
|
2013
|
+
rendering = 1;
|
2009
2014
|
fn();
|
2010
2015
|
runRenders();
|
2011
2016
|
} finally {
|
2012
|
-
rendering =
|
2017
|
+
rendering = 0;
|
2013
2018
|
pendingRenders = prevRenders;
|
2014
2019
|
pendingRendersLookup = prevRendersLookup;
|
2015
2020
|
pendingEffects = prevEffects;
|
@@ -2178,7 +2183,7 @@ var compat = {
|
|
2178
2183
|
classIdToBranch.delete(component.id);
|
2179
2184
|
}
|
2180
2185
|
}
|
2181
|
-
let existing
|
2186
|
+
let existing;
|
2182
2187
|
if (typeof args[0] === "object" && "renderBody" in args[0]) {
|
2183
2188
|
const input = args[0];
|
2184
2189
|
const normalizedInput = args[0] = {};
|
@@ -2196,7 +2201,7 @@ var compat = {
|
|
2196
2201
|
document.body
|
2197
2202
|
);
|
2198
2203
|
} else {
|
2199
|
-
existing =
|
2204
|
+
existing = 1;
|
2200
2205
|
}
|
2201
2206
|
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
2202
2207
|
});
|
package/dist/debug/dom.mjs
CHANGED
@@ -271,7 +271,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
271
271
|
if (resumes) {
|
272
272
|
try {
|
273
273
|
render.r = [];
|
274
|
-
isResuming =
|
274
|
+
isResuming = 1;
|
275
275
|
for (let i = 0; i < resumes.length; i++) {
|
276
276
|
const serialized = resumes[i];
|
277
277
|
if (typeof serialized === "function") {
|
@@ -322,7 +322,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
322
322
|
}
|
323
323
|
}
|
324
324
|
} finally {
|
325
|
-
isResuming =
|
325
|
+
isResuming = 0;
|
326
326
|
}
|
327
327
|
}
|
328
328
|
};
|
@@ -342,7 +342,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
342
342
|
});
|
343
343
|
}
|
344
344
|
}
|
345
|
-
var isResuming
|
345
|
+
var isResuming;
|
346
346
|
function register(id, obj) {
|
347
347
|
registeredValues[id] = obj;
|
348
348
|
return obj;
|
@@ -1300,7 +1300,7 @@ var runTask;
|
|
1300
1300
|
var port2 = /* @__PURE__ */ (() => {
|
1301
1301
|
const { port1, port2: port22 } = new MessageChannel();
|
1302
1302
|
port1.onmessage = () => {
|
1303
|
-
isScheduled =
|
1303
|
+
isScheduled = 0;
|
1304
1304
|
if (true) {
|
1305
1305
|
const run2 = runTask;
|
1306
1306
|
runTask = void 0;
|
@@ -1322,7 +1322,7 @@ function schedule() {
|
|
1322
1322
|
runTask = run;
|
1323
1323
|
}
|
1324
1324
|
}
|
1325
|
-
isScheduled =
|
1325
|
+
isScheduled = 1;
|
1326
1326
|
queueMicrotask(flushAndWaitFrame);
|
1327
1327
|
}
|
1328
1328
|
}
|
@@ -1536,77 +1536,36 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1536
1536
|
scope,
|
1537
1537
|
"#PlaceholderContent" /* PlaceholderContent */
|
1538
1538
|
);
|
1539
|
-
let awaitBranch = scope[branchAccessor];
|
1540
1539
|
const referenceNode = scope[nodeAccessor];
|
1541
|
-
|
1542
|
-
const thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
1543
|
-
if (scope.___closestBranch?.___destroyed || scope[promiseAccessor] !== thisPromise) {
|
1544
|
-
return;
|
1545
|
-
}
|
1546
|
-
scope[promiseAccessor] = void 0;
|
1547
|
-
runEffects(
|
1548
|
-
prepareEffects(() => {
|
1549
|
-
if (tryWithPlaceholder) {
|
1550
|
-
placeholderShown.add(pendingEffects);
|
1551
|
-
}
|
1552
|
-
if (!awaitBranch || !tryWithPlaceholder) {
|
1553
|
-
insertBranchBefore(
|
1554
|
-
awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
|
1555
|
-
scope.$global,
|
1556
|
-
renderer,
|
1557
|
-
scope,
|
1558
|
-
namespaceNode
|
1559
|
-
),
|
1560
|
-
referenceNode.parentNode,
|
1561
|
-
referenceNode
|
1562
|
-
);
|
1563
|
-
referenceNode.remove();
|
1564
|
-
}
|
1565
|
-
renderer.___params?.(awaitBranch, [data2]);
|
1566
|
-
})
|
1567
|
-
);
|
1568
|
-
if (tryWithPlaceholder) {
|
1569
|
-
if (!--tryWithPlaceholder.___pendingAsyncCount) {
|
1570
|
-
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
1571
|
-
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = void 0;
|
1572
|
-
if (placeholderBranch) {
|
1573
|
-
insertBranchBefore(
|
1574
|
-
tryWithPlaceholder,
|
1575
|
-
placeholderBranch.___startNode.parentNode,
|
1576
|
-
placeholderBranch.___startNode
|
1577
|
-
);
|
1578
|
-
removeAndDestroyBranch(placeholderBranch);
|
1579
|
-
}
|
1580
|
-
if (tryWithPlaceholder.___effects) {
|
1581
|
-
runEffects(tryWithPlaceholder.___effects, true);
|
1582
|
-
}
|
1583
|
-
}
|
1584
|
-
}
|
1585
|
-
}).catch((error) => {
|
1586
|
-
renderCatch(scope, error, true);
|
1587
|
-
});
|
1540
|
+
let awaitBranch = scope[branchAccessor];
|
1588
1541
|
if (tryWithPlaceholder) {
|
1589
1542
|
placeholderShown.add(pendingEffects);
|
1590
|
-
if (!tryWithPlaceholder.___pendingAsyncCount) {
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1543
|
+
if (!scope[promiseAccessor] && (tryWithPlaceholder.___pendingAsyncCount = (tryWithPlaceholder.___pendingAsyncCount || 0) + 1) === 1) {
|
1544
|
+
requestAnimationFrame(
|
1545
|
+
() => tryWithPlaceholder.___pendingAsyncCount && runEffects(
|
1546
|
+
prepareEffects(
|
1547
|
+
() => queueRender(
|
1548
|
+
tryWithPlaceholder,
|
1549
|
+
() => {
|
1550
|
+
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = createAndSetupBranch(
|
1551
|
+
scope.$global,
|
1552
|
+
tryWithPlaceholder["#PlaceholderContent" /* PlaceholderContent */],
|
1553
|
+
tryWithPlaceholder._,
|
1554
|
+
tryWithPlaceholder.___startNode.parentNode
|
1555
|
+
);
|
1556
|
+
insertBranchBefore(
|
1557
|
+
placeholderBranch,
|
1558
|
+
tryWithPlaceholder.___startNode.parentNode,
|
1559
|
+
tryWithPlaceholder.___startNode
|
1560
|
+
);
|
1561
|
+
tempDetatchBranch(tryWithPlaceholder);
|
1562
|
+
},
|
1563
|
+
-1
|
1564
|
+
)
|
1565
|
+
)
|
1566
|
+
)
|
1567
|
+
);
|
1608
1568
|
}
|
1609
|
-
tryWithPlaceholder.___pendingAsyncCount++;
|
1610
1569
|
} else if (awaitBranch) {
|
1611
1570
|
awaitBranch.___startNode.parentNode.insertBefore(
|
1612
1571
|
referenceNode,
|
@@ -1614,6 +1573,60 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1614
1573
|
);
|
1615
1574
|
tempDetatchBranch(awaitBranch);
|
1616
1575
|
}
|
1576
|
+
const thisPromise = scope[promiseAccessor] = promise.then(
|
1577
|
+
(data2) => {
|
1578
|
+
if (thisPromise === scope[promiseAccessor]) {
|
1579
|
+
scope[promiseAccessor] = 0;
|
1580
|
+
schedule();
|
1581
|
+
queueRender(
|
1582
|
+
scope,
|
1583
|
+
() => {
|
1584
|
+
if (!awaitBranch || !tryWithPlaceholder) {
|
1585
|
+
insertBranchBefore(
|
1586
|
+
awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
|
1587
|
+
scope.$global,
|
1588
|
+
renderer,
|
1589
|
+
scope,
|
1590
|
+
referenceNode.parentNode
|
1591
|
+
),
|
1592
|
+
referenceNode.parentNode,
|
1593
|
+
referenceNode
|
1594
|
+
);
|
1595
|
+
referenceNode.remove();
|
1596
|
+
}
|
1597
|
+
renderer.___params?.(awaitBranch, [data2]);
|
1598
|
+
if (tryWithPlaceholder) {
|
1599
|
+
placeholderShown.add(pendingEffects);
|
1600
|
+
if (!--tryWithPlaceholder.___pendingAsyncCount) {
|
1601
|
+
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
1602
|
+
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = 0;
|
1603
|
+
if (placeholderBranch) {
|
1604
|
+
insertBranchBefore(
|
1605
|
+
tryWithPlaceholder,
|
1606
|
+
placeholderBranch.___startNode.parentNode,
|
1607
|
+
placeholderBranch.___startNode
|
1608
|
+
);
|
1609
|
+
removeAndDestroyBranch(placeholderBranch);
|
1610
|
+
}
|
1611
|
+
if (tryWithPlaceholder.___effects) {
|
1612
|
+
runEffects(tryWithPlaceholder.___effects, true);
|
1613
|
+
}
|
1614
|
+
}
|
1615
|
+
}
|
1616
|
+
},
|
1617
|
+
-1
|
1618
|
+
);
|
1619
|
+
}
|
1620
|
+
},
|
1621
|
+
(error) => {
|
1622
|
+
if (thisPromise === scope[promiseAccessor]) {
|
1623
|
+
if (tryWithPlaceholder) tryWithPlaceholder.___pendingAsyncCount = 0;
|
1624
|
+
scope[promiseAccessor] = 0;
|
1625
|
+
schedule();
|
1626
|
+
queueRender(scope, renderCatch, -1, error);
|
1627
|
+
}
|
1628
|
+
}
|
1629
|
+
);
|
1617
1630
|
};
|
1618
1631
|
}
|
1619
1632
|
function createTry(nodeAccessor, tryContent) {
|
@@ -1637,19 +1650,14 @@ function createTry(nodeAccessor, tryContent) {
|
|
1637
1650
|
}
|
1638
1651
|
};
|
1639
1652
|
}
|
1640
|
-
function renderCatch(scope, error
|
1653
|
+
function renderCatch(scope, error) {
|
1641
1654
|
const tryWithCatch = findBranchWithKey(scope, "#CatchContent" /* CatchContent */);
|
1642
1655
|
if (!tryWithCatch) {
|
1643
|
-
|
1644
|
-
setTimeout(() => {
|
1645
|
-
throw error;
|
1646
|
-
});
|
1647
|
-
} else {
|
1648
|
-
throw error;
|
1649
|
-
}
|
1656
|
+
throw error;
|
1650
1657
|
} else {
|
1651
1658
|
const placeholderBranch = tryWithCatch["#PlaceholderBranch" /* PlaceholderBranch */];
|
1652
1659
|
if (placeholderBranch) {
|
1660
|
+
tryWithCatch.___pendingAsyncCount = 0;
|
1653
1661
|
tryWithCatch._["ConditionalScope:" /* ConditionalScope */ + tryWithCatch["#BranchAccessor" /* BranchAccessor */]] = placeholderBranch;
|
1654
1662
|
destroyBranch(tryWithCatch);
|
1655
1663
|
}
|
@@ -1737,10 +1745,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1737
1745
|
normalizedRenderer._ ? args[0] : args
|
1738
1746
|
);
|
1739
1747
|
} else {
|
1740
|
-
const inputWithContent = getContent ? {
|
1741
|
-
...args,
|
1742
|
-
content: getContent(scope)
|
1743
|
-
} : args || {};
|
1748
|
+
const inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
|
1744
1749
|
normalizedRenderer.___params(
|
1745
1750
|
scope[childScopeAccessor],
|
1746
1751
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
@@ -1867,7 +1872,7 @@ var pendingRendersLookup = /* @__PURE__ */ new Map();
|
|
1867
1872
|
var caughtError = /* @__PURE__ */ new WeakSet();
|
1868
1873
|
var placeholderShown = /* @__PURE__ */ new WeakSet();
|
1869
1874
|
var pendingEffects = [];
|
1870
|
-
var rendering
|
1875
|
+
var rendering;
|
1871
1876
|
var scopeKeyOffset = 1e3;
|
1872
1877
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.___id) {
|
1873
1878
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
@@ -1899,13 +1904,13 @@ function queueEffect(scope, fn) {
|
|
1899
1904
|
function run() {
|
1900
1905
|
const effects = pendingEffects;
|
1901
1906
|
try {
|
1902
|
-
rendering =
|
1907
|
+
rendering = 1;
|
1903
1908
|
runRenders();
|
1904
1909
|
} finally {
|
1905
1910
|
pendingRenders = [];
|
1906
1911
|
pendingRendersLookup = /* @__PURE__ */ new Map();
|
1907
1912
|
pendingEffects = [];
|
1908
|
-
rendering =
|
1913
|
+
rendering = 0;
|
1909
1914
|
}
|
1910
1915
|
runEffects(effects);
|
1911
1916
|
}
|
@@ -1917,11 +1922,11 @@ function prepareEffects(fn) {
|
|
1917
1922
|
pendingRenders = [];
|
1918
1923
|
pendingRendersLookup = /* @__PURE__ */ new Map();
|
1919
1924
|
try {
|
1920
|
-
rendering =
|
1925
|
+
rendering = 1;
|
1921
1926
|
fn();
|
1922
1927
|
runRenders();
|
1923
1928
|
} finally {
|
1924
|
-
rendering =
|
1929
|
+
rendering = 0;
|
1925
1930
|
pendingRenders = prevRenders;
|
1926
1931
|
pendingRendersLookup = prevRendersLookup;
|
1927
1932
|
pendingEffects = prevEffects;
|
@@ -2090,7 +2095,7 @@ var compat = {
|
|
2090
2095
|
classIdToBranch.delete(component.id);
|
2091
2096
|
}
|
2092
2097
|
}
|
2093
|
-
let existing
|
2098
|
+
let existing;
|
2094
2099
|
if (typeof args[0] === "object" && "renderBody" in args[0]) {
|
2095
2100
|
const input = args[0];
|
2096
2101
|
const normalizedInput = args[0] = {};
|
@@ -2108,7 +2113,7 @@ var compat = {
|
|
2108
2113
|
document.body
|
2109
2114
|
);
|
2110
2115
|
} else {
|
2111
|
-
existing =
|
2116
|
+
existing = 1;
|
2112
2117
|
}
|
2113
2118
|
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
2114
2119
|
});
|
package/dist/debug/html.js
CHANGED
@@ -3071,9 +3071,9 @@ function render(input = {}) {
|
|
3071
3071
|
null
|
3072
3072
|
);
|
3073
3073
|
head.render(this, input);
|
3074
|
-
return new
|
3074
|
+
return new ServerRendered(head);
|
3075
3075
|
}
|
3076
|
-
var
|
3076
|
+
var ServerRendered = class {
|
3077
3077
|
#head;
|
3078
3078
|
#cachedPromise = null;
|
3079
3079
|
constructor(head) {
|
@@ -3161,11 +3161,12 @@ var ServerRenderResult = class {
|
|
3161
3161
|
);
|
3162
3162
|
}
|
3163
3163
|
toReadable() {
|
3164
|
+
const encoder = new TextEncoder();
|
3164
3165
|
return new ReadableStream({
|
3165
3166
|
start: (ctrl) => {
|
3166
3167
|
this.#read(
|
3167
3168
|
(html) => {
|
3168
|
-
ctrl.enqueue(html);
|
3169
|
+
ctrl.enqueue(encoder.encode(html));
|
3169
3170
|
},
|
3170
3171
|
(err) => {
|
3171
3172
|
ctrl.error(err);
|
package/dist/debug/html.mjs
CHANGED
@@ -2989,9 +2989,9 @@ function render(input = {}) {
|
|
2989
2989
|
null
|
2990
2990
|
);
|
2991
2991
|
head.render(this, input);
|
2992
|
-
return new
|
2992
|
+
return new ServerRendered(head);
|
2993
2993
|
}
|
2994
|
-
var
|
2994
|
+
var ServerRendered = class {
|
2995
2995
|
#head;
|
2996
2996
|
#cachedPromise = null;
|
2997
2997
|
constructor(head) {
|
@@ -3079,11 +3079,12 @@ var ServerRenderResult = class {
|
|
3079
3079
|
);
|
3080
3080
|
}
|
3081
3081
|
toReadable() {
|
3082
|
+
const encoder = new TextEncoder();
|
3082
3083
|
return new ReadableStream({
|
3083
3084
|
start: (ctrl) => {
|
3084
3085
|
this.#read(
|
3085
3086
|
(html) => {
|
3086
|
-
ctrl.enqueue(html);
|
3087
|
+
ctrl.enqueue(encoder.encode(html));
|
3087
3088
|
},
|
3088
3089
|
(err) => {
|
3089
3090
|
ctrl.error(err);
|
@@ -6,7 +6,7 @@ export declare function createTry(nodeAccessor: Accessor, tryContent: Renderer):
|
|
6
6
|
catch: unknown;
|
7
7
|
placeholder: unknown;
|
8
8
|
}) => void;
|
9
|
-
export declare function renderCatch(scope: Scope, error: unknown
|
9
|
+
export declare function renderCatch(scope: Scope, error: unknown): void;
|
10
10
|
export declare function conditional(nodeAccessor: Accessor, ...branches: Renderer[]): (scope: Scope, newBranch: number) => void;
|
11
11
|
export declare function patchDynamicTag(fn: <T extends typeof dynamicTag>(cond: T) => T): void;
|
12
12
|
export declare let dynamicTag: (nodeAccessor: Accessor, getContent?: ((scope: Scope) => Renderer) | 0, getTagVar?: (() => Signal<unknown>) | 0, inputIsArgs?: 1) => Signal<Renderer | string | undefined>;
|