marko 6.0.0-next.3.63 → 6.0.0-next.3.65
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/accessor.d.ts +2 -1
- package/dist/common/accessor.debug.d.ts +2 -1
- package/dist/common/types.d.ts +3 -3
- package/dist/debug/dom.js +140 -110
- package/dist/debug/dom.mjs +140 -110
- package/dist/debug/html.js +5 -5
- package/dist/debug/html.mjs +5 -5
- package/dist/dom/control-flow.d.ts +1 -0
- package/dist/dom/queue.d.ts +4 -2
- package/dist/dom/scope.d.ts +1 -0
- package/dist/dom.js +188 -185
- package/dist/dom.mjs +188 -185
- package/dist/html.js +7 -7
- package/dist/html.mjs +7 -7
- package/dist/translator/index.js +2 -0
- package/package.json +1 -1
package/dist/debug/dom.mjs
CHANGED
@@ -181,15 +181,14 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
181
181
|
const render = resumeRender[renderId] = renders2[renderId] || renders2(renderId);
|
182
182
|
const walk2 = render.w;
|
183
183
|
const commentPrefixLen = render.i.length;
|
184
|
-
const
|
184
|
+
const branchStack = [];
|
185
185
|
const scopeLookup = render.s = {};
|
186
186
|
const serializeContext = {
|
187
187
|
_: registeredValues
|
188
188
|
};
|
189
189
|
const branchIds = /* @__PURE__ */ new Set();
|
190
190
|
const parentBranchIds = /* @__PURE__ */ new Map();
|
191
|
-
|
192
|
-
let currentScopeId;
|
191
|
+
let currentBranchId;
|
193
192
|
render.w = () => {
|
194
193
|
walk2.call(render);
|
195
194
|
const visits = render.v;
|
@@ -197,8 +196,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
197
196
|
if (visits.length) {
|
198
197
|
const visitNodes = new Set(visits);
|
199
198
|
let lastEndNode;
|
200
|
-
|
201
|
-
const branchEnd = (branchId,
|
199
|
+
visits.length = 0;
|
200
|
+
const branchEnd = (branchId, reference) => {
|
202
201
|
const branch = scopeLookup[branchId] ||= {};
|
203
202
|
let endNode = reference;
|
204
203
|
while (visitNodes.has(endNode = endNode.previousSibling)) ;
|
@@ -210,17 +209,10 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
210
209
|
}
|
211
210
|
branch.___endNode = lastEndNode = endNode;
|
212
211
|
branch.___startNode ||= endNode;
|
213
|
-
for (const [markerScopeId, markerNode] of closestBranchMarkers) {
|
214
|
-
if (branch.___startNode.compareDocumentPosition(markerNode) & 4 && reference.compareDocumentPosition(markerNode) & 2) {
|
215
|
-
parentBranchIds.set(markerScopeId, branchId);
|
216
|
-
closestBranchMarkers.delete(markerScopeId);
|
217
|
-
}
|
218
|
-
}
|
219
212
|
branchIds.add(branchId);
|
220
|
-
closestBranchMarkers.set(branchId, visit);
|
221
213
|
return branch;
|
222
214
|
};
|
223
|
-
for (const visit of
|
215
|
+
for (const visit of visitNodes) {
|
224
216
|
const commentText = visit.data;
|
225
217
|
const dataIndex = commentText.indexOf(" ") + 1;
|
226
218
|
const scopeId = commentText.slice(
|
@@ -235,29 +227,28 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
235
227
|
if (token === "*" /* Node */) {
|
236
228
|
const node = scope[data2] = visit.previousSibling;
|
237
229
|
scope["Getter:" /* Getter */ + data2] = () => node;
|
238
|
-
} else if (token === "$" /* ClosestBranch */) {
|
239
|
-
closestBranchMarkers.set(scopeId, visit);
|
240
230
|
} else if (token === "[" /* BranchStart */) {
|
241
|
-
if (
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
231
|
+
if (currentBranchId && dataIndex) {
|
232
|
+
branchEnd(currentBranchId, visit);
|
233
|
+
currentBranchId = branchStack.pop();
|
234
|
+
}
|
235
|
+
if (currentBranchId) {
|
236
|
+
branchStack.push(currentBranchId);
|
237
|
+
parentBranchIds.set(scopeId, currentBranchId);
|
246
238
|
}
|
247
|
-
|
239
|
+
currentBranchId = scopeId;
|
248
240
|
scope.___startNode = visit;
|
249
241
|
} else if (token === "]" /* BranchEnd */) {
|
250
242
|
scope[data2] = visit;
|
251
243
|
const curParent = visit.parentNode;
|
252
244
|
const startNode = branchEnd(
|
253
|
-
|
254
|
-
visit,
|
245
|
+
currentBranchId,
|
255
246
|
visit
|
256
247
|
).___startNode;
|
257
248
|
if (curParent !== startNode.parentNode) {
|
258
249
|
curParent.prepend(startNode);
|
259
250
|
}
|
260
|
-
|
251
|
+
currentBranchId = branchStack.pop();
|
261
252
|
} else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
|
262
253
|
let next = data2.indexOf(" ");
|
263
254
|
let curNode = visit;
|
@@ -269,7 +260,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
269
260
|
start,
|
270
261
|
~next ? next : data2.length
|
271
262
|
);
|
272
|
-
curNode = branchEnd(childScopeId,
|
263
|
+
curNode = branchEnd(childScopeId, curNode).___endNode;
|
264
|
+
parentBranchIds.set(childScopeId, scopeId);
|
273
265
|
}
|
274
266
|
}
|
275
267
|
}
|
@@ -301,7 +293,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
301
293
|
prevScope
|
302
294
|
);
|
303
295
|
}
|
304
|
-
const parentBranchId = parentBranchIds.get(scopeId);
|
296
|
+
const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
|
305
297
|
if (parentBranchId) {
|
306
298
|
scope.___closestBranch = scopes[parentBranchId];
|
307
299
|
}
|
@@ -902,7 +894,7 @@ var pendingScopes = [];
|
|
902
894
|
function createScope($global, closestBranch) {
|
903
895
|
const scope = {
|
904
896
|
___id: $global.___nextScopeId++,
|
905
|
-
|
897
|
+
___creating: 1,
|
906
898
|
___closestBranch: closestBranch,
|
907
899
|
$global
|
908
900
|
};
|
@@ -914,10 +906,17 @@ function skipScope(scope) {
|
|
914
906
|
}
|
915
907
|
function finishPendingScopes() {
|
916
908
|
for (const scope of pendingScopes) {
|
917
|
-
scope.
|
909
|
+
scope.___creating = 0;
|
918
910
|
}
|
919
911
|
pendingScopes = [];
|
920
912
|
}
|
913
|
+
function findBranchWithKey(scope, key) {
|
914
|
+
let branch = scope.___closestBranch;
|
915
|
+
while (branch && !branch[key]) {
|
916
|
+
branch = branch.___parentBranch;
|
917
|
+
}
|
918
|
+
return branch;
|
919
|
+
}
|
921
920
|
function destroyBranch(branch) {
|
922
921
|
branch.___parentBranch?.___branchScopes?.delete(branch);
|
923
922
|
destroyNestedBranches(branch);
|
@@ -1387,7 +1386,7 @@ function value(valueAccessor, fn = () => {
|
|
1387
1386
|
}
|
1388
1387
|
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "___id") {
|
1389
1388
|
return (scope) => {
|
1390
|
-
if (scope.
|
1389
|
+
if (scope.___creating) {
|
1391
1390
|
if (scope[id] === void 0) {
|
1392
1391
|
scope[id] = defaultPending;
|
1393
1392
|
} else if (!--scope[id]) {
|
@@ -1410,7 +1409,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
1410
1409
|
ownerScope,
|
1411
1410
|
() => {
|
1412
1411
|
for (const scope of scopes) {
|
1413
|
-
if (!scope.
|
1412
|
+
if (!scope.___creating && !scope.___destroyed) {
|
1414
1413
|
childSignal(scope);
|
1415
1414
|
}
|
1416
1415
|
}
|
@@ -1430,7 +1429,7 @@ function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch,
|
|
1430
1429
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + ownerConditionalNodeAccessor;
|
1431
1430
|
const ownerSignal = (scope) => {
|
1432
1431
|
const ifScope = scope[scopeAccessor];
|
1433
|
-
if (ifScope && !ifScope.
|
1432
|
+
if (ifScope && !ifScope.___creating && scope[branchAccessor] === branch) {
|
1434
1433
|
queueRender(ifScope, childSignal, -1);
|
1435
1434
|
}
|
1436
1435
|
};
|
@@ -1455,7 +1454,7 @@ function dynamicClosure(...closureSignals) {
|
|
1455
1454
|
return (scope) => {
|
1456
1455
|
if (scope[___scopeInstancesAccessor]) {
|
1457
1456
|
for (const childScope of scope[___scopeInstancesAccessor]) {
|
1458
|
-
if (!childScope.
|
1457
|
+
if (!childScope.___creating) {
|
1459
1458
|
queueRender(
|
1460
1459
|
childScope,
|
1461
1460
|
closureSignals[childScope[___signalIndexAccessor]],
|
@@ -1532,98 +1531,88 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1532
1531
|
const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
|
1533
1532
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1534
1533
|
return (scope, promise) => {
|
1535
|
-
|
1534
|
+
const tryWithPlaceholder = findBranchWithKey(
|
1535
|
+
scope,
|
1536
|
+
"#PlaceholderContent" /* PlaceholderContent */
|
1537
|
+
);
|
1536
1538
|
let awaitBranch = scope[branchAccessor];
|
1537
1539
|
const referenceNode = scope[nodeAccessor];
|
1538
1540
|
const namespaceNode = (awaitBranch?.___startNode ?? referenceNode).parentNode;
|
1539
|
-
while (tryBranch && !tryBranch["#PlaceholderContent" /* PlaceholderContent */]) {
|
1540
|
-
tryBranch = tryBranch.___parentBranch;
|
1541
|
-
}
|
1542
1541
|
const thisPromise = scope[promiseAccessor] = promise.then((data2) => {
|
1543
1542
|
if (scope.___closestBranch?.___destroyed || scope[promiseAccessor] !== thisPromise) {
|
1544
1543
|
return;
|
1545
1544
|
}
|
1546
1545
|
scope[promiseAccessor] = void 0;
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1546
|
+
runEffects(
|
1547
|
+
prepareEffects(() => {
|
1548
|
+
if (tryWithPlaceholder) {
|
1549
|
+
placeholderShown.add(pendingEffects);
|
1550
|
+
}
|
1551
|
+
if (!awaitBranch || !tryWithPlaceholder) {
|
1552
|
+
insertBranchBefore(
|
1553
|
+
awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
|
1554
|
+
scope.$global,
|
1555
|
+
renderer,
|
1556
|
+
scope,
|
1557
|
+
namespaceNode
|
1558
|
+
),
|
1559
|
+
referenceNode.parentNode,
|
1560
|
+
referenceNode
|
1561
|
+
);
|
1562
|
+
referenceNode.remove();
|
1563
|
+
}
|
1564
|
+
renderer.___params?.(awaitBranch, [data2]);
|
1565
|
+
})
|
1566
|
+
);
|
1567
|
+
if (tryWithPlaceholder) {
|
1568
|
+
tryWithPlaceholder;
|
1569
|
+
if (!--tryWithPlaceholder.___pendingAsyncCount) {
|
1570
|
+
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
1571
|
+
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = void 0;
|
1566
1572
|
if (placeholderBranch) {
|
1567
1573
|
insertBranchBefore(
|
1568
|
-
|
1574
|
+
tryWithPlaceholder,
|
1569
1575
|
placeholderBranch.___startNode.parentNode,
|
1570
1576
|
placeholderBranch.___startNode
|
1571
1577
|
);
|
1572
1578
|
removeAndDestroyBranch(placeholderBranch);
|
1573
1579
|
} else {
|
1574
1580
|
insertBranchBefore(
|
1575
|
-
|
1581
|
+
tryWithPlaceholder,
|
1576
1582
|
referenceNode.parentNode,
|
1577
1583
|
referenceNode
|
1578
1584
|
);
|
1579
1585
|
}
|
1586
|
+
if (tryWithPlaceholder.___effects) {
|
1587
|
+
runEffects(tryWithPlaceholder.___effects, true);
|
1588
|
+
}
|
1580
1589
|
}
|
1581
|
-
} else {
|
1582
|
-
runEffects(effects);
|
1583
1590
|
}
|
1584
1591
|
}).catch((error) => {
|
1585
|
-
|
1586
|
-
while (tryBranch2 && !tryBranch2["#CatchContent" /* CatchContent */]) {
|
1587
|
-
tryBranch2 = tryBranch2.___parentBranch;
|
1588
|
-
}
|
1589
|
-
if (!tryBranch2) {
|
1590
|
-
setTimeout(() => {
|
1591
|
-
throw error;
|
1592
|
-
});
|
1593
|
-
} else {
|
1594
|
-
setConditionalRenderer(
|
1595
|
-
tryBranch2._,
|
1596
|
-
tryBranch2["#BranchAccessor" /* BranchAccessor */],
|
1597
|
-
tryBranch2["#CatchContent" /* CatchContent */],
|
1598
|
-
createAndSetupBranch
|
1599
|
-
);
|
1600
|
-
tryBranch2["#CatchContent" /* CatchContent */].___params?.(
|
1601
|
-
tryBranch2._["ConditionalScope:" /* ConditionalScope */ + tryBranch2["#BranchAccessor" /* BranchAccessor */]],
|
1602
|
-
[error]
|
1603
|
-
);
|
1604
|
-
}
|
1592
|
+
renderCatch(scope, error, true);
|
1605
1593
|
});
|
1606
|
-
if (
|
1607
|
-
|
1608
|
-
|
1594
|
+
if (tryWithPlaceholder) {
|
1595
|
+
placeholderShown.add(pendingEffects);
|
1596
|
+
if (!tryWithPlaceholder.___pendingAsyncCount) {
|
1597
|
+
tryWithPlaceholder.___pendingAsyncCount = 0;
|
1609
1598
|
requestAnimationFrame(() => {
|
1610
|
-
if (
|
1611
|
-
const placeholderBranch =
|
1599
|
+
if (tryWithPlaceholder.___pendingAsyncCount && !tryWithPlaceholder.___destroyed) {
|
1600
|
+
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = createAndSetupBranch(
|
1612
1601
|
scope.$global,
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1602
|
+
tryWithPlaceholder["#PlaceholderContent" /* PlaceholderContent */],
|
1603
|
+
tryWithPlaceholder._,
|
1604
|
+
tryWithPlaceholder.___startNode.parentNode
|
1616
1605
|
);
|
1617
1606
|
insertBranchBefore(
|
1618
1607
|
placeholderBranch,
|
1619
|
-
|
1620
|
-
|
1608
|
+
tryWithPlaceholder.___startNode.parentNode,
|
1609
|
+
tryWithPlaceholder.___startNode
|
1621
1610
|
);
|
1622
|
-
tempDetatchBranch(
|
1611
|
+
tempDetatchBranch(tryWithPlaceholder);
|
1623
1612
|
}
|
1624
1613
|
});
|
1625
1614
|
}
|
1626
|
-
|
1615
|
+
tryWithPlaceholder.___pendingAsyncCount++;
|
1627
1616
|
} else if (awaitBranch) {
|
1628
1617
|
awaitBranch.___startNode.parentNode.insertBefore(
|
1629
1618
|
referenceNode,
|
@@ -1654,6 +1643,35 @@ function createTry(nodeAccessor, tryContent) {
|
|
1654
1643
|
}
|
1655
1644
|
};
|
1656
1645
|
}
|
1646
|
+
function renderCatch(scope, error, async) {
|
1647
|
+
const tryWithCatch = findBranchWithKey(scope, "#CatchContent" /* CatchContent */);
|
1648
|
+
if (!tryWithCatch) {
|
1649
|
+
if (async) {
|
1650
|
+
setTimeout(() => {
|
1651
|
+
throw error;
|
1652
|
+
});
|
1653
|
+
} else {
|
1654
|
+
throw error;
|
1655
|
+
}
|
1656
|
+
} else {
|
1657
|
+
const placeholderBranch = tryWithCatch["#PlaceholderBranch" /* PlaceholderBranch */];
|
1658
|
+
if (placeholderBranch) {
|
1659
|
+
tryWithCatch._["ConditionalScope:" /* ConditionalScope */ + tryWithCatch["#BranchAccessor" /* BranchAccessor */]] = placeholderBranch;
|
1660
|
+
destroyBranch(tryWithCatch);
|
1661
|
+
}
|
1662
|
+
caughtError.add(pendingEffects);
|
1663
|
+
setConditionalRenderer(
|
1664
|
+
tryWithCatch._,
|
1665
|
+
tryWithCatch["#BranchAccessor" /* BranchAccessor */],
|
1666
|
+
tryWithCatch["#CatchContent" /* CatchContent */],
|
1667
|
+
createAndSetupBranch
|
1668
|
+
);
|
1669
|
+
tryWithCatch["#CatchContent" /* CatchContent */].___params?.(
|
1670
|
+
tryWithCatch._["ConditionalScope:" /* ConditionalScope */ + tryWithCatch["#BranchAccessor" /* BranchAccessor */]],
|
1671
|
+
[error]
|
1672
|
+
);
|
1673
|
+
}
|
1674
|
+
}
|
1657
1675
|
function conditional(nodeAccessor, ...branches) {
|
1658
1676
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1659
1677
|
return (scope, newBranch) => {
|
@@ -1852,6 +1870,8 @@ function byFirstArg(name) {
|
|
1852
1870
|
// src/dom/queue.ts
|
1853
1871
|
var pendingRenders = [];
|
1854
1872
|
var pendingRendersLookup = /* @__PURE__ */ new Map();
|
1873
|
+
var caughtError = /* @__PURE__ */ new WeakSet();
|
1874
|
+
var placeholderShown = /* @__PURE__ */ new WeakSet();
|
1855
1875
|
var pendingEffects = [];
|
1856
1876
|
var rendering = false;
|
1857
1877
|
var scopeKeyOffset = 1e3;
|
@@ -1914,14 +1934,14 @@ function prepareEffects(fn) {
|
|
1914
1934
|
}
|
1915
1935
|
return preparedEffects;
|
1916
1936
|
}
|
1917
|
-
|
1937
|
+
var runEffects = (effects) => {
|
1918
1938
|
for (let i = 0, scope; i < effects.length; ) {
|
1919
1939
|
effects[i++](
|
1920
1940
|
scope = effects[i++],
|
1921
1941
|
scope
|
1922
1942
|
);
|
1923
1943
|
}
|
1924
|
-
}
|
1944
|
+
};
|
1925
1945
|
function runRenders() {
|
1926
1946
|
while (pendingRenders.length) {
|
1927
1947
|
const render = pendingRenders[0];
|
@@ -1955,27 +1975,37 @@ var runRender = (render) => render.___signal(render.___scope, render.___value);
|
|
1955
1975
|
var enableCatch = () => {
|
1956
1976
|
enableCatch = () => {
|
1957
1977
|
};
|
1978
|
+
const handlePendingTry = (fn, scope, branch) => {
|
1979
|
+
while (branch) {
|
1980
|
+
if (branch.___pendingAsyncCount) {
|
1981
|
+
return (branch.___effects ||= []).push(fn, scope);
|
1982
|
+
}
|
1983
|
+
branch = branch.___parentBranch;
|
1984
|
+
}
|
1985
|
+
};
|
1986
|
+
runEffects = /* @__PURE__ */ ((runEffects2) => (effects, checkPending = placeholderShown.has(effects)) => {
|
1987
|
+
if (checkPending || caughtError.has(effects)) {
|
1988
|
+
let i = 0;
|
1989
|
+
let fn;
|
1990
|
+
let scope;
|
1991
|
+
let branch;
|
1992
|
+
for (; i < effects.length; ) {
|
1993
|
+
fn = effects[i++];
|
1994
|
+
scope = effects[i++];
|
1995
|
+
branch = scope.___closestBranch;
|
1996
|
+
if (!branch?.___destroyed && !(checkPending && handlePendingTry(fn, scope, branch))) {
|
1997
|
+
fn(scope, scope);
|
1998
|
+
}
|
1999
|
+
}
|
2000
|
+
} else {
|
2001
|
+
runEffects2(effects);
|
2002
|
+
}
|
2003
|
+
})(runEffects);
|
1958
2004
|
runRender = /* @__PURE__ */ ((runRender2) => (render) => {
|
1959
2005
|
try {
|
1960
2006
|
runRender2(render);
|
1961
2007
|
} catch (error) {
|
1962
|
-
|
1963
|
-
while (branch && !branch["#CatchContent" /* CatchContent */])
|
1964
|
-
branch = branch.___parentBranch;
|
1965
|
-
if (!branch) {
|
1966
|
-
throw error;
|
1967
|
-
} else {
|
1968
|
-
setConditionalRenderer(
|
1969
|
-
branch._,
|
1970
|
-
branch["#BranchAccessor" /* BranchAccessor */],
|
1971
|
-
branch["#CatchContent" /* CatchContent */],
|
1972
|
-
createAndSetupBranch
|
1973
|
-
);
|
1974
|
-
branch["#CatchContent" /* CatchContent */].___params?.(
|
1975
|
-
branch._["ConditionalScope:" /* ConditionalScope */ + branch["#BranchAccessor" /* BranchAccessor */]],
|
1976
|
-
[error]
|
1977
|
-
);
|
1978
|
-
}
|
2008
|
+
renderCatch(render.___scope, error);
|
1979
2009
|
}
|
1980
2010
|
})(runRender);
|
1981
2011
|
};
|
package/dist/debug/html.js
CHANGED
@@ -305,12 +305,12 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
|
|
305
305
|
// repurpose "op" for callbacks ...carefully
|
306
306
|
if (op = runtime.j[id]) {
|
307
307
|
placeholderCallback = placeholder.c;
|
308
|
-
placeholder.c = () => placeholderCallback() + op(runtime);
|
308
|
+
placeholder.c = () => placeholderCallback() + op(runtime.r);
|
309
309
|
}
|
310
310
|
}
|
311
311
|
};
|
312
312
|
})`
|
313
|
-
) : `(e=>{let i,t,r,l={},o=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,n,a,c,p)=>{"#"==d?(l[n]=t).i++:a==r&&i(),"T"==a.tagName&&(n=a.getAttribute(e.i))&&((c=e.l["^"+n])&&(l[n]={i:1,c(i=e.l[n]||a){for(;i.parentNode!==c.parentNode;)i=i.parentNode;for(;i!=r;(r=c.nextSibling).remove());o(c,a)}}),r=a.nextSibling,t=l[n],i=()=>{c||o(e.l[n],a),--t.i||t.c()},(d=e.j[n])&&(p=t.c,t.c=()=>p()+d(e)))}})`;
|
313
|
+
) : `(e=>{let i,t,r,l={},o=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,n,a,c,p)=>{"#"==d?(l[n]=t).i++:a==r&&i(),"T"==a.tagName&&(n=a.getAttribute(e.i))&&((c=e.l["^"+n])&&(l[n]={i:1,c(i=e.l[n]||a){for(;i.parentNode!==c.parentNode;)i=i.parentNode;for(;i!=r;(r=c.nextSibling).remove());o(c,a)}}),r=a.nextSibling,t=l[n],i=()=>{c||o(e.l[n],a),--t.i||t.c()},(d=e.j[n])&&(p=t.c,t.c=()=>p()+d(e.r)))}})`;
|
314
314
|
|
315
315
|
// src/html/serializer.ts
|
316
316
|
var { hasOwnProperty } = {};
|
@@ -1742,9 +1742,9 @@ function hoist(scopeId, id) {
|
|
1742
1742
|
function resumeClosestBranch(scopeId) {
|
1743
1743
|
const branchId = $chunk.context?.[branchIdKey];
|
1744
1744
|
if (branchId !== void 0 && branchId !== scopeId) {
|
1745
|
-
|
1746
|
-
|
1747
|
-
);
|
1745
|
+
writeScope(scopeId, {
|
1746
|
+
["#ClosestBranchId" /* ClosestBranchId */]: branchId
|
1747
|
+
});
|
1748
1748
|
}
|
1749
1749
|
}
|
1750
1750
|
var branchIdKey = Symbol();
|
package/dist/debug/html.mjs
CHANGED
@@ -221,12 +221,12 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
|
|
221
221
|
// repurpose "op" for callbacks ...carefully
|
222
222
|
if (op = runtime.j[id]) {
|
223
223
|
placeholderCallback = placeholder.c;
|
224
|
-
placeholder.c = () => placeholderCallback() + op(runtime);
|
224
|
+
placeholder.c = () => placeholderCallback() + op(runtime.r);
|
225
225
|
}
|
226
226
|
}
|
227
227
|
};
|
228
228
|
})`
|
229
|
-
) : `(e=>{let i,t,r,l={},o=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,n,a,c,p)=>{"#"==d?(l[n]=t).i++:a==r&&i(),"T"==a.tagName&&(n=a.getAttribute(e.i))&&((c=e.l["^"+n])&&(l[n]={i:1,c(i=e.l[n]||a){for(;i.parentNode!==c.parentNode;)i=i.parentNode;for(;i!=r;(r=c.nextSibling).remove());o(c,a)}}),r=a.nextSibling,t=l[n],i=()=>{c||o(e.l[n],a),--t.i||t.c()},(d=e.j[n])&&(p=t.c,t.c=()=>p()+d(e)))}})`;
|
229
|
+
) : `(e=>{let i,t,r,l={},o=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,n,a,c,p)=>{"#"==d?(l[n]=t).i++:a==r&&i(),"T"==a.tagName&&(n=a.getAttribute(e.i))&&((c=e.l["^"+n])&&(l[n]={i:1,c(i=e.l[n]||a){for(;i.parentNode!==c.parentNode;)i=i.parentNode;for(;i!=r;(r=c.nextSibling).remove());o(c,a)}}),r=a.nextSibling,t=l[n],i=()=>{c||o(e.l[n],a),--t.i||t.c()},(d=e.j[n])&&(p=t.c,t.c=()=>p()+d(e.r)))}})`;
|
230
230
|
|
231
231
|
// src/html/serializer.ts
|
232
232
|
var { hasOwnProperty } = {};
|
@@ -1658,9 +1658,9 @@ function hoist(scopeId, id) {
|
|
1658
1658
|
function resumeClosestBranch(scopeId) {
|
1659
1659
|
const branchId = $chunk.context?.[branchIdKey];
|
1660
1660
|
if (branchId !== void 0 && branchId !== scopeId) {
|
1661
|
-
|
1662
|
-
|
1663
|
-
);
|
1661
|
+
writeScope(scopeId, {
|
1662
|
+
["#ClosestBranchId" /* ClosestBranchId */]: branchId
|
1663
|
+
});
|
1664
1664
|
}
|
1665
1665
|
}
|
1666
1666
|
var branchIdKey = Symbol();
|
@@ -6,6 +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, async?: boolean): void;
|
9
10
|
export declare function conditional(nodeAccessor: Accessor, ...branches: Renderer[]): (scope: Scope, newBranch: number) => void;
|
10
11
|
export declare function patchDynamicTag(fn: <T extends typeof dynamicTag>(cond: T) => T): void;
|
11
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
@@ -1,12 +1,14 @@
|
|
1
|
-
import {
|
1
|
+
import type { Scope } from "../common/types";
|
2
2
|
import type { Signal } from "./signals";
|
3
3
|
type ExecFn<S extends Scope = Scope> = (scope: S, arg?: any) => void;
|
4
|
+
export declare const caughtError: WeakSet<unknown[]>;
|
5
|
+
export declare const placeholderShown: WeakSet<unknown[]>;
|
4
6
|
export declare let pendingEffects: unknown[];
|
5
7
|
export declare let rendering: boolean;
|
6
8
|
export declare function queueRender<T>(scope: Scope, signal: Signal<T>, signalKey: number, value?: T, scopeKey?: number): void;
|
7
9
|
export declare function queueEffect<S extends Scope, T extends ExecFn<S>>(scope: S, fn: T): void;
|
8
10
|
export declare function run(): void;
|
9
11
|
export declare function prepareEffects(fn: () => void): unknown[];
|
10
|
-
export declare
|
12
|
+
export declare let runEffects: (effects: unknown[]) => void;
|
11
13
|
export declare let enableCatch: () => void;
|
12
14
|
export {};
|
package/dist/dom/scope.d.ts
CHANGED
@@ -2,6 +2,7 @@ import type { BranchScope, Scope } from "../common/types";
|
|
2
2
|
export declare function createScope($global: Scope["$global"], closestBranch?: BranchScope): Scope;
|
3
3
|
export declare function skipScope(scope: Scope): number;
|
4
4
|
export declare function finishPendingScopes(): void;
|
5
|
+
export declare function findBranchWithKey(scope: Scope, key: string): BranchScope | undefined;
|
5
6
|
export declare function destroyBranch(branch: BranchScope): void;
|
6
7
|
export declare function removeAndDestroyBranch(branch: BranchScope): void;
|
7
8
|
export declare function insertBranchBefore(branch: BranchScope, parentNode: ParentNode, nextSibling: Node | null): void;
|