marko 6.0.0-next.3.71 → 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 +93 -85
- package/dist/debug/dom.mjs +93 -85
- 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 +105 -98
- package/dist/dom.mjs +105 -98
- 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,74 +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 (thisPromise === scope[promiseAccessor] && !scope.___closestBranch?.___destroyed) {
|
1632
|
-
scope[promiseAccessor] = 0;
|
1633
|
-
renderImmediate(() => {
|
1634
|
-
if (tryWithPlaceholder) {
|
1635
|
-
placeholderShown.add(pendingEffects);
|
1636
|
-
}
|
1637
|
-
if (!awaitBranch || !tryWithPlaceholder) {
|
1638
|
-
insertBranchBefore(
|
1639
|
-
awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
|
1640
|
-
scope.$global,
|
1641
|
-
renderer,
|
1642
|
-
scope,
|
1643
|
-
namespaceNode
|
1644
|
-
),
|
1645
|
-
referenceNode.parentNode,
|
1646
|
-
referenceNode
|
1647
|
-
);
|
1648
|
-
referenceNode.remove();
|
1649
|
-
}
|
1650
|
-
renderer.___params?.(awaitBranch, [data2]);
|
1651
|
-
});
|
1652
|
-
if (tryWithPlaceholder && !--tryWithPlaceholder.___pendingAsyncCount) {
|
1653
|
-
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
1654
|
-
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = 0;
|
1655
|
-
if (placeholderBranch) {
|
1656
|
-
insertBranchBefore(
|
1657
|
-
tryWithPlaceholder,
|
1658
|
-
placeholderBranch.___startNode.parentNode,
|
1659
|
-
placeholderBranch.___startNode
|
1660
|
-
);
|
1661
|
-
removeAndDestroyBranch(placeholderBranch);
|
1662
|
-
}
|
1663
|
-
if (tryWithPlaceholder.___effects) {
|
1664
|
-
runEffects(tryWithPlaceholder.___effects, true);
|
1665
|
-
}
|
1666
|
-
}
|
1667
|
-
}
|
1668
|
-
}).catch(
|
1669
|
-
(error) => renderImmediate(() => renderCatch(scope, error, true))
|
1670
|
-
);
|
1628
|
+
let awaitBranch = scope[branchAccessor];
|
1671
1629
|
if (tryWithPlaceholder) {
|
1672
1630
|
placeholderShown.add(pendingEffects);
|
1673
|
-
if (!tryWithPlaceholder.___pendingAsyncCount) {
|
1674
|
-
tryWithPlaceholder.___pendingAsyncCount = 0;
|
1631
|
+
if (!scope[promiseAccessor] && (tryWithPlaceholder.___pendingAsyncCount = (tryWithPlaceholder.___pendingAsyncCount || 0) + 1) === 1) {
|
1675
1632
|
requestAnimationFrame(
|
1676
|
-
() =>
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
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
|
+
)
|
1692
1655
|
);
|
1693
1656
|
}
|
1694
|
-
tryWithPlaceholder.___pendingAsyncCount++;
|
1695
1657
|
} else if (awaitBranch) {
|
1696
1658
|
awaitBranch.___startNode.parentNode.insertBefore(
|
1697
1659
|
referenceNode,
|
@@ -1699,11 +1661,62 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1699
1661
|
);
|
1700
1662
|
tempDetatchBranch(awaitBranch);
|
1701
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
|
+
);
|
1702
1718
|
};
|
1703
1719
|
}
|
1704
|
-
function renderImmediate(cb) {
|
1705
|
-
return runEffects(prepareEffects(cb));
|
1706
|
-
}
|
1707
1720
|
function createTry(nodeAccessor, tryContent) {
|
1708
1721
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1709
1722
|
return (scope, input) => {
|
@@ -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
|
}
|
@@ -1952,7 +1960,7 @@ var pendingRendersLookup = /* @__PURE__ */ new Map();
|
|
1952
1960
|
var caughtError = /* @__PURE__ */ new WeakSet();
|
1953
1961
|
var placeholderShown = /* @__PURE__ */ new WeakSet();
|
1954
1962
|
var pendingEffects = [];
|
1955
|
-
var rendering
|
1963
|
+
var rendering;
|
1956
1964
|
var scopeKeyOffset = 1e3;
|
1957
1965
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.___id) {
|
1958
1966
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
@@ -1984,13 +1992,13 @@ function queueEffect(scope, fn) {
|
|
1984
1992
|
function run() {
|
1985
1993
|
const effects = pendingEffects;
|
1986
1994
|
try {
|
1987
|
-
rendering =
|
1995
|
+
rendering = 1;
|
1988
1996
|
runRenders();
|
1989
1997
|
} finally {
|
1990
1998
|
pendingRenders = [];
|
1991
1999
|
pendingRendersLookup = /* @__PURE__ */ new Map();
|
1992
2000
|
pendingEffects = [];
|
1993
|
-
rendering =
|
2001
|
+
rendering = 0;
|
1994
2002
|
}
|
1995
2003
|
runEffects(effects);
|
1996
2004
|
}
|
@@ -2002,11 +2010,11 @@ function prepareEffects(fn) {
|
|
2002
2010
|
pendingRenders = [];
|
2003
2011
|
pendingRendersLookup = /* @__PURE__ */ new Map();
|
2004
2012
|
try {
|
2005
|
-
rendering =
|
2013
|
+
rendering = 1;
|
2006
2014
|
fn();
|
2007
2015
|
runRenders();
|
2008
2016
|
} finally {
|
2009
|
-
rendering =
|
2017
|
+
rendering = 0;
|
2010
2018
|
pendingRenders = prevRenders;
|
2011
2019
|
pendingRendersLookup = prevRendersLookup;
|
2012
2020
|
pendingEffects = prevEffects;
|
@@ -2175,7 +2183,7 @@ var compat = {
|
|
2175
2183
|
classIdToBranch.delete(component.id);
|
2176
2184
|
}
|
2177
2185
|
}
|
2178
|
-
let existing
|
2186
|
+
let existing;
|
2179
2187
|
if (typeof args[0] === "object" && "renderBody" in args[0]) {
|
2180
2188
|
const input = args[0];
|
2181
2189
|
const normalizedInput = args[0] = {};
|
@@ -2193,7 +2201,7 @@ var compat = {
|
|
2193
2201
|
document.body
|
2194
2202
|
);
|
2195
2203
|
} else {
|
2196
|
-
existing =
|
2204
|
+
existing = 1;
|
2197
2205
|
}
|
2198
2206
|
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
2199
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,74 +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 (thisPromise === scope[promiseAccessor] && !scope.___closestBranch?.___destroyed) {
|
1544
|
-
scope[promiseAccessor] = 0;
|
1545
|
-
renderImmediate(() => {
|
1546
|
-
if (tryWithPlaceholder) {
|
1547
|
-
placeholderShown.add(pendingEffects);
|
1548
|
-
}
|
1549
|
-
if (!awaitBranch || !tryWithPlaceholder) {
|
1550
|
-
insertBranchBefore(
|
1551
|
-
awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
|
1552
|
-
scope.$global,
|
1553
|
-
renderer,
|
1554
|
-
scope,
|
1555
|
-
namespaceNode
|
1556
|
-
),
|
1557
|
-
referenceNode.parentNode,
|
1558
|
-
referenceNode
|
1559
|
-
);
|
1560
|
-
referenceNode.remove();
|
1561
|
-
}
|
1562
|
-
renderer.___params?.(awaitBranch, [data2]);
|
1563
|
-
});
|
1564
|
-
if (tryWithPlaceholder && !--tryWithPlaceholder.___pendingAsyncCount) {
|
1565
|
-
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
1566
|
-
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = 0;
|
1567
|
-
if (placeholderBranch) {
|
1568
|
-
insertBranchBefore(
|
1569
|
-
tryWithPlaceholder,
|
1570
|
-
placeholderBranch.___startNode.parentNode,
|
1571
|
-
placeholderBranch.___startNode
|
1572
|
-
);
|
1573
|
-
removeAndDestroyBranch(placeholderBranch);
|
1574
|
-
}
|
1575
|
-
if (tryWithPlaceholder.___effects) {
|
1576
|
-
runEffects(tryWithPlaceholder.___effects, true);
|
1577
|
-
}
|
1578
|
-
}
|
1579
|
-
}
|
1580
|
-
}).catch(
|
1581
|
-
(error) => renderImmediate(() => renderCatch(scope, error, true))
|
1582
|
-
);
|
1540
|
+
let awaitBranch = scope[branchAccessor];
|
1583
1541
|
if (tryWithPlaceholder) {
|
1584
1542
|
placeholderShown.add(pendingEffects);
|
1585
|
-
if (!tryWithPlaceholder.___pendingAsyncCount) {
|
1586
|
-
tryWithPlaceholder.___pendingAsyncCount = 0;
|
1543
|
+
if (!scope[promiseAccessor] && (tryWithPlaceholder.___pendingAsyncCount = (tryWithPlaceholder.___pendingAsyncCount || 0) + 1) === 1) {
|
1587
1544
|
requestAnimationFrame(
|
1588
|
-
() =>
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
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
|
+
)
|
1604
1567
|
);
|
1605
1568
|
}
|
1606
|
-
tryWithPlaceholder.___pendingAsyncCount++;
|
1607
1569
|
} else if (awaitBranch) {
|
1608
1570
|
awaitBranch.___startNode.parentNode.insertBefore(
|
1609
1571
|
referenceNode,
|
@@ -1611,11 +1573,62 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1611
1573
|
);
|
1612
1574
|
tempDetatchBranch(awaitBranch);
|
1613
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
|
+
);
|
1614
1630
|
};
|
1615
1631
|
}
|
1616
|
-
function renderImmediate(cb) {
|
1617
|
-
return runEffects(prepareEffects(cb));
|
1618
|
-
}
|
1619
1632
|
function createTry(nodeAccessor, tryContent) {
|
1620
1633
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1621
1634
|
return (scope, input) => {
|
@@ -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
|
}
|
@@ -1864,7 +1872,7 @@ var pendingRendersLookup = /* @__PURE__ */ new Map();
|
|
1864
1872
|
var caughtError = /* @__PURE__ */ new WeakSet();
|
1865
1873
|
var placeholderShown = /* @__PURE__ */ new WeakSet();
|
1866
1874
|
var pendingEffects = [];
|
1867
|
-
var rendering
|
1875
|
+
var rendering;
|
1868
1876
|
var scopeKeyOffset = 1e3;
|
1869
1877
|
function queueRender(scope, signal, signalKey, value2, scopeKey = scope.___id) {
|
1870
1878
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
@@ -1896,13 +1904,13 @@ function queueEffect(scope, fn) {
|
|
1896
1904
|
function run() {
|
1897
1905
|
const effects = pendingEffects;
|
1898
1906
|
try {
|
1899
|
-
rendering =
|
1907
|
+
rendering = 1;
|
1900
1908
|
runRenders();
|
1901
1909
|
} finally {
|
1902
1910
|
pendingRenders = [];
|
1903
1911
|
pendingRendersLookup = /* @__PURE__ */ new Map();
|
1904
1912
|
pendingEffects = [];
|
1905
|
-
rendering =
|
1913
|
+
rendering = 0;
|
1906
1914
|
}
|
1907
1915
|
runEffects(effects);
|
1908
1916
|
}
|
@@ -1914,11 +1922,11 @@ function prepareEffects(fn) {
|
|
1914
1922
|
pendingRenders = [];
|
1915
1923
|
pendingRendersLookup = /* @__PURE__ */ new Map();
|
1916
1924
|
try {
|
1917
|
-
rendering =
|
1925
|
+
rendering = 1;
|
1918
1926
|
fn();
|
1919
1927
|
runRenders();
|
1920
1928
|
} finally {
|
1921
|
-
rendering =
|
1929
|
+
rendering = 0;
|
1922
1930
|
pendingRenders = prevRenders;
|
1923
1931
|
pendingRendersLookup = prevRendersLookup;
|
1924
1932
|
pendingEffects = prevEffects;
|
@@ -2087,7 +2095,7 @@ var compat = {
|
|
2087
2095
|
classIdToBranch.delete(component.id);
|
2088
2096
|
}
|
2089
2097
|
}
|
2090
|
-
let existing
|
2098
|
+
let existing;
|
2091
2099
|
if (typeof args[0] === "object" && "renderBody" in args[0]) {
|
2092
2100
|
const input = args[0];
|
2093
2101
|
const normalizedInput = args[0] = {};
|
@@ -2105,7 +2113,7 @@ var compat = {
|
|
2105
2113
|
document.body
|
2106
2114
|
);
|
2107
2115
|
} else {
|
2108
|
-
existing =
|
2116
|
+
existing = 1;
|
2109
2117
|
}
|
2110
2118
|
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
2111
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>;
|
package/dist/dom/queue.d.ts
CHANGED
@@ -4,7 +4,7 @@ type ExecFn<S extends Scope = Scope> = (scope: S, arg?: any) => void;
|
|
4
4
|
export declare const caughtError: WeakSet<unknown[]>;
|
5
5
|
export declare const placeholderShown: WeakSet<unknown[]>;
|
6
6
|
export declare let pendingEffects: unknown[];
|
7
|
-
export declare let rendering:
|
7
|
+
export declare let rendering: undefined | 0 | 1;
|
8
8
|
export declare function queueRender<T>(scope: Scope, signal: Signal<T>, signalKey: number, value?: T, scopeKey?: number): void;
|
9
9
|
export declare function queueEffect<S extends Scope, T extends ExecFn<S>>(scope: S, fn: T): void;
|
10
10
|
export declare function run(): void;
|
package/dist/dom/resume.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type Scope } from "../common/types";
|
2
2
|
import type { Signal } from "./signals";
|
3
3
|
export declare function init(runtimeId?: string): void;
|
4
|
-
export declare let isResuming:
|
4
|
+
export declare let isResuming: undefined | 0 | 1;
|
5
5
|
export declare function register<T>(id: string, obj: T): T;
|
6
6
|
export declare function registerBoundSignal<T extends Signal<unknown>>(id: string, signal: T): T;
|
7
7
|
export declare function getRegisteredWithScope(id: string, scope?: Scope): unknown;
|
package/dist/dom/schedule.d.ts
CHANGED