marko 6.3.22 → 6.3.24
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/debug/dom.js +52 -58
- package/dist/debug/dom.mjs +52 -58
- package/dist/debug/html.js +1 -1
- package/dist/debug/html.mjs +1 -1
- package/dist/dom.js +35 -33
- package/dist/dom.mjs +35 -33
- package/dist/html.js +2 -2
- package/dist/html.mjs +2 -2
- package/dist/translator/index.js +9 -9
- package/package.json +4 -4
package/dist/debug/dom.js
CHANGED
|
@@ -1496,58 +1496,59 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1496
1496
|
const promiseAccessor = Promise$1 + nodeAccessor;
|
|
1497
1497
|
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
1498
1498
|
_enable_catch();
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
promise = Promise.resolve(promise);
|
|
1499
|
+
const resolveAwait = (scope, referenceNode, value) => {
|
|
1500
|
+
const awaitBranch = scope[branchAccessor];
|
|
1501
|
+
if (awaitBranch["#DetachedAwait"]) {
|
|
1502
|
+
awaitBranch[PendingScopes] = awaitBranch[PendingScopes]?.forEach(syncGen);
|
|
1503
|
+
setupBranch(awaitBranch[DetachedAwait], awaitBranch);
|
|
1504
|
+
awaitBranch[DetachedAwait] = 0;
|
|
1505
|
+
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
1506
|
+
referenceNode.remove();
|
|
1508
1507
|
}
|
|
1508
|
+
params?.(awaitBranch, [value]);
|
|
1509
|
+
return awaitBranch;
|
|
1510
|
+
};
|
|
1511
|
+
const awaitPromise = (scope, promise) => {
|
|
1512
|
+
if (!isPromise(promise) && scope[promiseAccessor]) promise = Promise.resolve(promise);
|
|
1509
1513
|
let awaitBranch = scope[branchAccessor];
|
|
1510
1514
|
const tryPlaceholder = findBranchWithKey(scope, PlaceholderContent);
|
|
1511
1515
|
const tryBranch = tryPlaceholder || awaitBranch;
|
|
1516
|
+
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
1517
|
+
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
if (!isPromise(promise)) {
|
|
1521
|
+
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1512
1524
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1513
1525
|
placeholderShown.add(pendingEffects);
|
|
1514
|
-
if (tryPlaceholder) {
|
|
1515
|
-
if (
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
i: 0,
|
|
1522
|
-
c() {
|
|
1523
|
-
if (--awaitCounter.i) return 1;
|
|
1524
|
-
if (tryBranch === scope[branchAccessor]) {
|
|
1525
|
-
const anchor = scope[nodeAccessor];
|
|
1526
|
-
if (anchor.parentNode) {
|
|
1527
|
-
const detachedParent = scope[branchAccessor][StartNode].parentNode;
|
|
1528
|
-
if (detachedParent === anchor.parentNode) anchor.remove();
|
|
1529
|
-
else anchor.replaceWith(detachedParent);
|
|
1530
|
-
}
|
|
1531
|
-
} else dismissPlaceholder(tryBranch);
|
|
1532
|
-
queueEffect(tryBranch, runPendingEffects);
|
|
1526
|
+
if (!tryPlaceholder && !awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
1527
|
+
if (tryBranch === scope[branchAccessor]) {
|
|
1528
|
+
const anchor = scope[nodeAccessor];
|
|
1529
|
+
if (anchor.parentNode) {
|
|
1530
|
+
const detachedParent = scope[branchAccessor][StartNode].parentNode;
|
|
1531
|
+
if (detachedParent === anchor.parentNode) anchor.remove();
|
|
1532
|
+
else anchor.replaceWith(detachedParent);
|
|
1533
1533
|
}
|
|
1534
|
-
};
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1534
|
+
} else dismissPlaceholder(tryBranch);
|
|
1535
|
+
});
|
|
1536
|
+
if (!scope[promiseAccessor]) {
|
|
1537
|
+
if (awaitBranch) awaitBranch[PendingRenders] ||= [];
|
|
1538
|
+
if (tryPlaceholder) awaitCounter = addAwaitCounter(scope, tryPlaceholder);
|
|
1539
|
+
else if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
1540
|
+
if (!awaitBranch["#DetachedAwait"]) {
|
|
1541
|
+
awaitBranch["#StartNode"].parentNode.insertBefore(scope[nodeAccessor], awaitBranch["#StartNode"]);
|
|
1542
|
+
tempDetachBranch(tryBranch);
|
|
1543
|
+
}
|
|
1544
|
+
}, -1))));
|
|
1544
1545
|
}
|
|
1545
1546
|
const thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1546
1547
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1547
1548
|
const referenceNode = scope[nodeAccessor];
|
|
1548
1549
|
scope[promiseAccessor] = 0;
|
|
1549
1550
|
queueAsyncRender(scope, () => {
|
|
1550
|
-
awaitBranch = resolveAwait(scope,
|
|
1551
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1551
1552
|
const pendingRenders = awaitBranch[PendingRenders];
|
|
1552
1553
|
awaitBranch[PendingRenders] = 0;
|
|
1553
1554
|
pendingRenders?.forEach(queuePendingRender);
|
|
@@ -1579,18 +1580,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1579
1580
|
}
|
|
1580
1581
|
});
|
|
1581
1582
|
};
|
|
1582
|
-
|
|
1583
|
-
function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
|
|
1584
|
-
const awaitBranch = scope[branchAccessor];
|
|
1585
|
-
if (awaitBranch["#DetachedAwait"]) {
|
|
1586
|
-
awaitBranch[PendingScopes] = awaitBranch[PendingScopes]?.forEach(syncGen);
|
|
1587
|
-
setupBranch(awaitBranch[DetachedAwait], awaitBranch);
|
|
1588
|
-
awaitBranch[DetachedAwait] = 0;
|
|
1589
|
-
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
1590
|
-
referenceNode.remove();
|
|
1591
|
-
}
|
|
1592
|
-
params?.(awaitBranch, [value]);
|
|
1593
|
-
return awaitBranch;
|
|
1583
|
+
return awaitPromise;
|
|
1594
1584
|
}
|
|
1595
1585
|
function _await_content(nodeAccessor, template, walks, setup) {
|
|
1596
1586
|
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
@@ -1609,19 +1599,23 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1609
1599
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, PlaceholderContent)) {
|
|
1610
1600
|
if (!tryBranch) return;
|
|
1611
1601
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1612
|
-
if (!awaitCounter?.i) awaitCounter = tryBranch
|
|
1602
|
+
if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
|
|
1603
|
+
placeholderShown.add(pendingEffects);
|
|
1604
|
+
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1605
|
+
insertBranchBefore(tryBranch["#PlaceholderBranch"] = createAndSetupBranch(tryBranch["$global"], tryBranch["#PlaceholderContent"], tryBranch["_"], tryBranch["#StartNode"].parentNode), tryBranch["#StartNode"].parentNode, tryBranch["#StartNode"]);
|
|
1606
|
+
tempDetachBranch(tryBranch);
|
|
1607
|
+
}, -1))));
|
|
1608
|
+
return awaitCounter;
|
|
1609
|
+
}
|
|
1610
|
+
function createAwaitCounter(tryBranch, done) {
|
|
1611
|
+
const awaitCounter = tryBranch[AwaitCounter] = {
|
|
1613
1612
|
i: 0,
|
|
1614
1613
|
c() {
|
|
1615
1614
|
if (--awaitCounter.i) return 1;
|
|
1616
|
-
|
|
1615
|
+
done();
|
|
1617
1616
|
queueEffect(tryBranch, runPendingEffects);
|
|
1618
1617
|
}
|
|
1619
1618
|
};
|
|
1620
|
-
placeholderShown.add(pendingEffects);
|
|
1621
|
-
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1622
|
-
insertBranchBefore(tryBranch["#PlaceholderBranch"] = createAndSetupBranch(tryBranch["$global"], tryBranch["#PlaceholderContent"], tryBranch["_"], tryBranch["#StartNode"].parentNode), tryBranch["#StartNode"].parentNode, tryBranch["#StartNode"]);
|
|
1623
|
-
tempDetachBranch(tryBranch);
|
|
1624
|
-
}, -1))));
|
|
1625
1619
|
return awaitCounter;
|
|
1626
1620
|
}
|
|
1627
1621
|
function runPendingEffects(scope) {
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -1494,58 +1494,59 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1494
1494
|
const promiseAccessor = Promise$1 + nodeAccessor;
|
|
1495
1495
|
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
1496
1496
|
_enable_catch();
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
promise = Promise.resolve(promise);
|
|
1497
|
+
const resolveAwait = (scope, referenceNode, value) => {
|
|
1498
|
+
const awaitBranch = scope[branchAccessor];
|
|
1499
|
+
if (awaitBranch["#DetachedAwait"]) {
|
|
1500
|
+
awaitBranch[PendingScopes] = awaitBranch[PendingScopes]?.forEach(syncGen);
|
|
1501
|
+
setupBranch(awaitBranch[DetachedAwait], awaitBranch);
|
|
1502
|
+
awaitBranch[DetachedAwait] = 0;
|
|
1503
|
+
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
1504
|
+
referenceNode.remove();
|
|
1506
1505
|
}
|
|
1506
|
+
params?.(awaitBranch, [value]);
|
|
1507
|
+
return awaitBranch;
|
|
1508
|
+
};
|
|
1509
|
+
const awaitPromise = (scope, promise) => {
|
|
1510
|
+
if (!isPromise(promise) && scope[promiseAccessor]) promise = Promise.resolve(promise);
|
|
1507
1511
|
let awaitBranch = scope[branchAccessor];
|
|
1508
1512
|
const tryPlaceholder = findBranchWithKey(scope, PlaceholderContent);
|
|
1509
1513
|
const tryBranch = tryPlaceholder || awaitBranch;
|
|
1514
|
+
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
1515
|
+
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
if (!isPromise(promise)) {
|
|
1519
|
+
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1510
1522
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1511
1523
|
placeholderShown.add(pendingEffects);
|
|
1512
|
-
if (tryPlaceholder) {
|
|
1513
|
-
if (
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
i: 0,
|
|
1520
|
-
c() {
|
|
1521
|
-
if (--awaitCounter.i) return 1;
|
|
1522
|
-
if (tryBranch === scope[branchAccessor]) {
|
|
1523
|
-
const anchor = scope[nodeAccessor];
|
|
1524
|
-
if (anchor.parentNode) {
|
|
1525
|
-
const detachedParent = scope[branchAccessor][StartNode].parentNode;
|
|
1526
|
-
if (detachedParent === anchor.parentNode) anchor.remove();
|
|
1527
|
-
else anchor.replaceWith(detachedParent);
|
|
1528
|
-
}
|
|
1529
|
-
} else dismissPlaceholder(tryBranch);
|
|
1530
|
-
queueEffect(tryBranch, runPendingEffects);
|
|
1524
|
+
if (!tryPlaceholder && !awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
1525
|
+
if (tryBranch === scope[branchAccessor]) {
|
|
1526
|
+
const anchor = scope[nodeAccessor];
|
|
1527
|
+
if (anchor.parentNode) {
|
|
1528
|
+
const detachedParent = scope[branchAccessor][StartNode].parentNode;
|
|
1529
|
+
if (detachedParent === anchor.parentNode) anchor.remove();
|
|
1530
|
+
else anchor.replaceWith(detachedParent);
|
|
1531
1531
|
}
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1532
|
+
} else dismissPlaceholder(tryBranch);
|
|
1533
|
+
});
|
|
1534
|
+
if (!scope[promiseAccessor]) {
|
|
1535
|
+
if (awaitBranch) awaitBranch[PendingRenders] ||= [];
|
|
1536
|
+
if (tryPlaceholder) awaitCounter = addAwaitCounter(scope, tryPlaceholder);
|
|
1537
|
+
else if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
1538
|
+
if (!awaitBranch["#DetachedAwait"]) {
|
|
1539
|
+
awaitBranch["#StartNode"].parentNode.insertBefore(scope[nodeAccessor], awaitBranch["#StartNode"]);
|
|
1540
|
+
tempDetachBranch(tryBranch);
|
|
1541
|
+
}
|
|
1542
|
+
}, -1))));
|
|
1542
1543
|
}
|
|
1543
1544
|
const thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
1544
1545
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1545
1546
|
const referenceNode = scope[nodeAccessor];
|
|
1546
1547
|
scope[promiseAccessor] = 0;
|
|
1547
1548
|
queueAsyncRender(scope, () => {
|
|
1548
|
-
awaitBranch = resolveAwait(scope,
|
|
1549
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
1549
1550
|
const pendingRenders = awaitBranch[PendingRenders];
|
|
1550
1551
|
awaitBranch[PendingRenders] = 0;
|
|
1551
1552
|
pendingRenders?.forEach(queuePendingRender);
|
|
@@ -1577,18 +1578,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1577
1578
|
}
|
|
1578
1579
|
});
|
|
1579
1580
|
};
|
|
1580
|
-
|
|
1581
|
-
function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
|
|
1582
|
-
const awaitBranch = scope[branchAccessor];
|
|
1583
|
-
if (awaitBranch["#DetachedAwait"]) {
|
|
1584
|
-
awaitBranch[PendingScopes] = awaitBranch[PendingScopes]?.forEach(syncGen);
|
|
1585
|
-
setupBranch(awaitBranch[DetachedAwait], awaitBranch);
|
|
1586
|
-
awaitBranch[DetachedAwait] = 0;
|
|
1587
|
-
insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]);
|
|
1588
|
-
referenceNode.remove();
|
|
1589
|
-
}
|
|
1590
|
-
params?.(awaitBranch, [value]);
|
|
1591
|
-
return awaitBranch;
|
|
1581
|
+
return awaitPromise;
|
|
1592
1582
|
}
|
|
1593
1583
|
function _await_content(nodeAccessor, template, walks, setup) {
|
|
1594
1584
|
const branchAccessor = BranchScopes$1 + nodeAccessor;
|
|
@@ -1607,19 +1597,23 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1607
1597
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, PlaceholderContent)) {
|
|
1608
1598
|
if (!tryBranch) return;
|
|
1609
1599
|
let awaitCounter = tryBranch[AwaitCounter];
|
|
1610
|
-
if (!awaitCounter?.i) awaitCounter = tryBranch
|
|
1600
|
+
if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
|
|
1601
|
+
placeholderShown.add(pendingEffects);
|
|
1602
|
+
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1603
|
+
insertBranchBefore(tryBranch["#PlaceholderBranch"] = createAndSetupBranch(tryBranch["$global"], tryBranch["#PlaceholderContent"], tryBranch["_"], tryBranch["#StartNode"].parentNode), tryBranch["#StartNode"].parentNode, tryBranch["#StartNode"]);
|
|
1604
|
+
tempDetachBranch(tryBranch);
|
|
1605
|
+
}, -1))));
|
|
1606
|
+
return awaitCounter;
|
|
1607
|
+
}
|
|
1608
|
+
function createAwaitCounter(tryBranch, done) {
|
|
1609
|
+
const awaitCounter = tryBranch[AwaitCounter] = {
|
|
1611
1610
|
i: 0,
|
|
1612
1611
|
c() {
|
|
1613
1612
|
if (--awaitCounter.i) return 1;
|
|
1614
|
-
|
|
1613
|
+
done();
|
|
1615
1614
|
queueEffect(tryBranch, runPendingEffects);
|
|
1616
1615
|
}
|
|
1617
1616
|
};
|
|
1618
|
-
placeholderShown.add(pendingEffects);
|
|
1619
|
-
if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1620
|
-
insertBranchBefore(tryBranch["#PlaceholderBranch"] = createAndSetupBranch(tryBranch["$global"], tryBranch["#PlaceholderContent"], tryBranch["_"], tryBranch["#StartNode"].parentNode), tryBranch["#StartNode"].parentNode, tryBranch["#StartNode"]);
|
|
1621
|
-
tempDetachBranch(tryBranch);
|
|
1622
|
-
}, -1))));
|
|
1623
1617
|
return awaitCounter;
|
|
1624
1618
|
}
|
|
1625
1619
|
function runPendingEffects(scope) {
|
package/dist/debug/html.js
CHANGED
|
@@ -624,7 +624,7 @@ function writeScopesRoot(state, flushes) {
|
|
|
624
624
|
const ref = state.refs.get(scope) || newScopeReference(state, scope, scopeId);
|
|
625
625
|
const openIndex = buf.push("") - 1;
|
|
626
626
|
if (writeObjectProps(state, flush[2], ref)) {
|
|
627
|
-
buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId
|
|
627
|
+
buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId !== nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{";
|
|
628
628
|
if (fillIndex === -1) fillIndex = openIndex;
|
|
629
629
|
nextSlotId = scopeId + 1;
|
|
630
630
|
buf.push("}");
|
package/dist/debug/html.mjs
CHANGED
|
@@ -622,7 +622,7 @@ function writeScopesRoot(state, flushes) {
|
|
|
622
622
|
const ref = state.refs.get(scope) || newScopeReference(state, scope, scopeId);
|
|
623
623
|
const openIndex = buf.push("") - 1;
|
|
624
624
|
if (writeObjectProps(state, flush[2], ref)) {
|
|
625
|
-
buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId
|
|
625
|
+
buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId !== nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{";
|
|
626
626
|
if (fillIndex === -1) fillIndex = openIndex;
|
|
627
627
|
nextSlotId = scopeId + 1;
|
|
628
628
|
buf.push("}");
|
package/dist/dom.js
CHANGED
|
@@ -934,37 +934,38 @@ function toInsertNode(startNode, endNode) {
|
|
|
934
934
|
function _await_promise(nodeAccessor, params) {
|
|
935
935
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
936
936
|
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor;
|
|
937
|
-
|
|
937
|
+
_enable_catch();
|
|
938
|
+
let resolveAwait = (scope, referenceNode, value) => {
|
|
939
|
+
let awaitBranch = scope[branchAccessor];
|
|
940
|
+
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
941
|
+
}, awaitPromise = (scope, promise) => {
|
|
942
|
+
!isPromise(promise) && scope[promiseAccessor] && (promise = Promise.resolve(promise));
|
|
943
|
+
let awaitBranch = scope[branchAccessor], tryPlaceholder = findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch;
|
|
944
|
+
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
945
|
+
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
938
948
|
if (!isPromise(promise)) {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
scope[branchAccessor] ? resolve() : scope[promiseAccessor] = resolve;
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
promise = Promise.resolve(promise);
|
|
949
|
+
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
950
|
+
return;
|
|
945
951
|
}
|
|
946
|
-
let
|
|
947
|
-
placeholderShown.add(pendingEffects), tryPlaceholder
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
if (
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
957
|
-
} else dismissPlaceholder(tryBranch);
|
|
958
|
-
queueEffect(tryBranch, runPendingEffects);
|
|
959
|
-
}
|
|
960
|
-
}), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
952
|
+
let awaitCounter = tryBranch.O;
|
|
953
|
+
placeholderShown.add(pendingEffects), !tryPlaceholder && !awaitCounter?.i && (awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
954
|
+
if (tryBranch === scope[branchAccessor]) {
|
|
955
|
+
let anchor = scope[nodeAccessor];
|
|
956
|
+
if (anchor.parentNode) {
|
|
957
|
+
let detachedParent = scope[branchAccessor].S.parentNode;
|
|
958
|
+
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
959
|
+
}
|
|
960
|
+
} else dismissPlaceholder(tryBranch);
|
|
961
|
+
})), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
961
962
|
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
962
|
-
}, -1)))))
|
|
963
|
+
}, -1)))));
|
|
963
964
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
964
965
|
if (thisPromise === scope[promiseAccessor]) {
|
|
965
966
|
let referenceNode = scope[nodeAccessor];
|
|
966
967
|
scope[promiseAccessor] = 0, queueAsyncRender(scope, () => {
|
|
967
|
-
awaitBranch = resolveAwait(scope,
|
|
968
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
968
969
|
let pendingRenders = awaitBranch.W;
|
|
969
970
|
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
970
971
|
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
@@ -983,10 +984,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
983
984
|
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, tryPlaceholder && !awaitCounter.m ? awaitCounter.c() : awaitCounter.i = 0, queueAsyncRender(scope, renderCatch, error));
|
|
984
985
|
});
|
|
985
986
|
};
|
|
986
|
-
|
|
987
|
-
function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
|
|
988
|
-
let awaitBranch = scope[branchAccessor];
|
|
989
|
-
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
987
|
+
return awaitPromise;
|
|
990
988
|
}
|
|
991
989
|
function _await_content(nodeAccessor, template, walks, setup) {
|
|
992
990
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
@@ -1001,15 +999,19 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1001
999
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
|
|
1002
1000
|
if (!tryBranch) return;
|
|
1003
1001
|
let awaitCounter = tryBranch.O;
|
|
1004
|
-
return awaitCounter?.i || (awaitCounter = tryBranch.
|
|
1002
|
+
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1003
|
+
insertBranchBefore(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q, tryBranch._, tryBranch.S.parentNode), tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
|
|
1004
|
+
}, -1)))), awaitCounter;
|
|
1005
|
+
}
|
|
1006
|
+
function createAwaitCounter(tryBranch, done) {
|
|
1007
|
+
let awaitCounter = tryBranch.O = {
|
|
1005
1008
|
i: 0,
|
|
1006
1009
|
c() {
|
|
1007
1010
|
if (--awaitCounter.i) return 1;
|
|
1008
|
-
|
|
1011
|
+
done(), queueEffect(tryBranch, runPendingEffects);
|
|
1009
1012
|
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
}, -1)))), awaitCounter;
|
|
1013
|
+
};
|
|
1014
|
+
return awaitCounter;
|
|
1013
1015
|
}
|
|
1014
1016
|
function runPendingEffects(scope) {
|
|
1015
1017
|
let effects = scope.J;
|
package/dist/dom.mjs
CHANGED
|
@@ -933,37 +933,38 @@ function toInsertNode(startNode, endNode) {
|
|
|
933
933
|
function _await_promise(nodeAccessor, params) {
|
|
934
934
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
935
935
|
let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor;
|
|
936
|
-
|
|
936
|
+
_enable_catch();
|
|
937
|
+
let resolveAwait = (scope, referenceNode, value) => {
|
|
938
|
+
let awaitBranch = scope[branchAccessor];
|
|
939
|
+
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
940
|
+
}, awaitPromise = (scope, promise) => {
|
|
941
|
+
!isPromise(promise) && scope[promiseAccessor] && (promise = Promise.resolve(promise));
|
|
942
|
+
let awaitBranch = scope[branchAccessor], tryPlaceholder = findBranchWithKey(scope, "Q"), tryBranch = tryPlaceholder || awaitBranch;
|
|
943
|
+
if (!(isPromise(promise) ? tryBranch : awaitBranch)) {
|
|
944
|
+
scope[promiseAccessor] = () => awaitPromise(scope, promise);
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
937
947
|
if (!isPromise(promise)) {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
scope[branchAccessor] ? resolve() : scope[promiseAccessor] = resolve;
|
|
941
|
-
return;
|
|
942
|
-
}
|
|
943
|
-
promise = Promise.resolve(promise);
|
|
948
|
+
resolveAwait(scope, scope[nodeAccessor], promise);
|
|
949
|
+
return;
|
|
944
950
|
}
|
|
945
|
-
let
|
|
946
|
-
placeholderShown.add(pendingEffects), tryPlaceholder
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
if (
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
} else dismissPlaceholder(tryBranch);
|
|
957
|
-
queueEffect(tryBranch, runPendingEffects);
|
|
958
|
-
}
|
|
959
|
-
}), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
951
|
+
let awaitCounter = tryBranch.O;
|
|
952
|
+
placeholderShown.add(pendingEffects), !tryPlaceholder && !awaitCounter?.i && (awaitCounter = createAwaitCounter(tryBranch, () => {
|
|
953
|
+
if (tryBranch === scope[branchAccessor]) {
|
|
954
|
+
let anchor = scope[nodeAccessor];
|
|
955
|
+
if (anchor.parentNode) {
|
|
956
|
+
let detachedParent = scope[branchAccessor].S.parentNode;
|
|
957
|
+
detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
|
|
958
|
+
}
|
|
959
|
+
} else dismissPlaceholder(tryBranch);
|
|
960
|
+
})), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
|
|
960
961
|
awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
|
|
961
|
-
}, -1)))))
|
|
962
|
+
}, -1)))));
|
|
962
963
|
let thisPromise = scope[promiseAccessor] = promise.then((data) => {
|
|
963
964
|
if (thisPromise === scope[promiseAccessor]) {
|
|
964
965
|
let referenceNode = scope[nodeAccessor];
|
|
965
966
|
scope[promiseAccessor] = 0, queueAsyncRender(scope, () => {
|
|
966
|
-
awaitBranch = resolveAwait(scope,
|
|
967
|
+
awaitBranch = resolveAwait(scope, referenceNode, data);
|
|
967
968
|
let pendingRenders = awaitBranch.W;
|
|
968
969
|
if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
|
|
969
970
|
let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m([]);
|
|
@@ -982,10 +983,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
982
983
|
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, tryPlaceholder && !awaitCounter.m ? awaitCounter.c() : awaitCounter.i = 0, queueAsyncRender(scope, renderCatch, error));
|
|
983
984
|
});
|
|
984
985
|
};
|
|
985
|
-
|
|
986
|
-
function resolveAwait(scope, branchAccessor, nodeAccessor, referenceNode, params, value) {
|
|
987
|
-
let awaitBranch = scope[branchAccessor];
|
|
988
|
-
return awaitBranch.V && (awaitBranch.Y = awaitBranch.Y?.forEach(syncGen), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [value]), awaitBranch;
|
|
986
|
+
return awaitPromise;
|
|
989
987
|
}
|
|
990
988
|
function _await_content(nodeAccessor, template, walks, setup) {
|
|
991
989
|
nodeAccessor = decodeAccessor(nodeAccessor);
|
|
@@ -1000,15 +998,19 @@ function _await_content(nodeAccessor, template, walks, setup) {
|
|
|
1000
998
|
function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
|
|
1001
999
|
if (!tryBranch) return;
|
|
1002
1000
|
let awaitCounter = tryBranch.O;
|
|
1003
|
-
return awaitCounter?.i || (awaitCounter = tryBranch.
|
|
1001
|
+
return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
|
|
1002
|
+
insertBranchBefore(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q, tryBranch._, tryBranch.S.parentNode), tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
|
|
1003
|
+
}, -1)))), awaitCounter;
|
|
1004
|
+
}
|
|
1005
|
+
function createAwaitCounter(tryBranch, done) {
|
|
1006
|
+
let awaitCounter = tryBranch.O = {
|
|
1004
1007
|
i: 0,
|
|
1005
1008
|
c() {
|
|
1006
1009
|
if (--awaitCounter.i) return 1;
|
|
1007
|
-
|
|
1010
|
+
done(), queueEffect(tryBranch, runPendingEffects);
|
|
1008
1011
|
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
}, -1)))), awaitCounter;
|
|
1012
|
+
};
|
|
1013
|
+
return awaitCounter;
|
|
1012
1014
|
}
|
|
1013
1015
|
function runPendingEffects(scope) {
|
|
1014
1016
|
let effects = scope.J;
|
package/dist/html.js
CHANGED
|
@@ -262,7 +262,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
262
262
|
_html(`</${renderer}>`);
|
|
263
263
|
}
|
|
264
264
|
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
265
|
-
needsScript &&
|
|
265
|
+
needsScript && _script(branchId, "d"), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
266
266
|
})();
|
|
267
267
|
} else {
|
|
268
268
|
shouldResume && _html(state.mark("[", ""));
|
|
@@ -516,7 +516,7 @@ function writeScopesRoot(state, flushes) {
|
|
|
516
516
|
let { buf } = state, nextSlotId = -1, fillIndex = -1;
|
|
517
517
|
for (let flush of flushes) {
|
|
518
518
|
let scopeId = flush[0], scope = flush[1], ref = state.refs.get(scope) || newScopeReference(state, scope, scopeId), openIndex = buf.push("") - 1;
|
|
519
|
-
writeObjectProps(state, flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId
|
|
519
|
+
writeObjectProps(state, flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId === nextSlotId ? "" : "," + (scopeId - nextSlotId)) + ",{", fillIndex === -1 && (fillIndex = openIndex), nextSlotId = scopeId + 1, buf.push("}")) : buf.pop();
|
|
520
520
|
}
|
|
521
521
|
nextSlotId !== -1 && buf.push("]");
|
|
522
522
|
let extras = "";
|
package/dist/html.mjs
CHANGED
|
@@ -262,7 +262,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
262
262
|
_html(`</${renderer}>`);
|
|
263
263
|
}
|
|
264
264
|
let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
|
|
265
|
-
needsScript &&
|
|
265
|
+
needsScript && _script(branchId, "d"), (shouldResume || needsScript) && _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
266
266
|
})();
|
|
267
267
|
} else {
|
|
268
268
|
shouldResume && _html(state.mark("[", ""));
|
|
@@ -515,7 +515,7 @@ function writeScopesRoot(state, flushes) {
|
|
|
515
515
|
let { buf } = state, nextSlotId = -1, fillIndex = -1;
|
|
516
516
|
for (let flush of flushes) {
|
|
517
517
|
let scopeId = flush[0], scope = flush[1], ref = state.refs.get(scope) || newScopeReference(state, scope, scopeId), openIndex = buf.push("") - 1;
|
|
518
|
-
writeObjectProps(state, flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId
|
|
518
|
+
writeObjectProps(state, flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId === nextSlotId ? "" : "," + (scopeId - nextSlotId)) + ",{", fillIndex === -1 && (fillIndex = openIndex), nextSlotId = scopeId + 1, buf.push("}")) : buf.pop();
|
|
519
519
|
}
|
|
520
520
|
nextSlotId !== -1 && buf.push("]");
|
|
521
521
|
let extras = "";
|
package/dist/translator/index.js
CHANGED
|
@@ -2071,10 +2071,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2071
2071
|
}
|
|
2072
2072
|
const childScope = getScopeById(branchId);
|
|
2073
2073
|
const needsScript = childScope && (childScope["EventAttributes:a"] || childScope["ControlledHandler:a"]);
|
|
2074
|
-
if (needsScript)
|
|
2075
|
-
writeScope(branchId, { [Renderer$1]: renderer });
|
|
2076
|
-
_script(branchId, "d");
|
|
2077
|
-
}
|
|
2074
|
+
if (needsScript) _script(branchId, "d");
|
|
2078
2075
|
if (shouldResume || needsScript) _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
|
|
2079
2076
|
};
|
|
2080
2077
|
renderNative();
|
|
@@ -4658,8 +4655,12 @@ var native_tag_default = {
|
|
|
4658
4655
|
flushInto(tag);
|
|
4659
4656
|
tag.insertBefore(_marko_compiler.types.expressionStatement(callRuntime("_attr_select_value", getScopeIdIdentifier(tagSection), nodeBinding && getScopeAccessorLiteral(nodeBinding), selectArgs.value, selectArgs.valueChange, _marko_compiler.types.arrowFunctionExpression([], _marko_compiler.types.blockStatement(tag.node.body.body)), selectArgs.serializeType)));
|
|
4660
4657
|
} else if (isTextOnly) {
|
|
4661
|
-
|
|
4662
|
-
|
|
4658
|
+
const rawTextHelper = getRawTextEscapeHelper(tagName);
|
|
4659
|
+
if (rawTextHelper) {
|
|
4660
|
+
const body = bodyToTextLiteral(tag.node.body);
|
|
4661
|
+
write`${_marko_compiler.types.isStringLiteral(body) ? getHTMLRuntime()[rawTextHelper](body.value) : callRuntime(rawTextHelper, body)}`;
|
|
4662
|
+
} else for (const child of tag.node.body.body) if (_marko_compiler.types.isMarkoText(child)) write`${child.value}`;
|
|
4663
|
+
else if (_marko_compiler.types.isMarkoPlaceholder(child)) write`${callRuntime("_escape", child.value)}`;
|
|
4663
4664
|
} else tag.insertBefore(tag.node.body.body).forEach((child) => child.skip());
|
|
4664
4665
|
if (!tagExtra[kSkipEndTag] && !isOpenOnly && !selectArgs) {
|
|
4665
4666
|
if (tagName === "head" && getMarkoOpts().linkAssets) write`${callRuntime("_flush_head")}`;
|
|
@@ -5005,11 +5006,10 @@ function assertOptionInSelectWithValue(tag) {
|
|
|
5005
5006
|
parent = parent.parentPath;
|
|
5006
5007
|
}
|
|
5007
5008
|
}
|
|
5008
|
-
function
|
|
5009
|
+
function getRawTextEscapeHelper(tagName) {
|
|
5009
5010
|
switch (tagName) {
|
|
5010
5011
|
case "script": return "_escape_script";
|
|
5011
5012
|
case "style": return "_escape_style";
|
|
5012
|
-
default: return "_escape";
|
|
5013
5013
|
}
|
|
5014
5014
|
}
|
|
5015
5015
|
function buildAttrExpression(value, serialize, dynamic) {
|
|
@@ -9188,7 +9188,7 @@ function isStaticText(node) {
|
|
|
9188
9188
|
}
|
|
9189
9189
|
function getPrevStaticSibling(path) {
|
|
9190
9190
|
let prev = path.getPrevSibling();
|
|
9191
|
-
while (prev.node && (prev
|
|
9191
|
+
while (prev.node && (getNodeContentType(prev, "endType") === null || prev.isMarkoPlaceholder() && isEmptyPlaceholder(prev.node))) prev = prev.getPrevSibling();
|
|
9192
9192
|
return prev.node;
|
|
9193
9193
|
}
|
|
9194
9194
|
function isEmptyPlaceholder(placeholder) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.24",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@marko/compiler": "^5.41.
|
|
51
|
+
"@marko/compiler": "^5.41.9",
|
|
52
52
|
"csstype": "^3.2.3",
|
|
53
53
|
"fastest-levenshtein": "^1.0.16",
|
|
54
54
|
"magic-string": "^0.30.21"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@marko/runtime-tags": "npm:marko@6.3.
|
|
58
|
-
"marko": "5.39.
|
|
57
|
+
"@marko/runtime-tags": "npm:marko@6.3.24",
|
|
58
|
+
"marko": "5.39.29"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=22"
|