marko 6.0.0-next.3.37 → 6.0.0-next.3.39
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 +180 -168
- package/dist/debug/dom.mjs +180 -168
- package/dist/dom/compat.d.ts +2 -2
- package/dist/dom/control-flow.d.ts +4 -5
- package/dist/dom/queue.d.ts +2 -2
- package/dist/dom/resume.d.ts +0 -1
- package/dist/dom/scope.d.ts +1 -1
- package/dist/dom/signals.d.ts +14 -7
- package/dist/dom.d.ts +3 -3
- package/dist/dom.js +154 -138
- package/dist/dom.mjs +154 -138
- package/dist/translator/core/for.d.ts +0 -9
- package/dist/translator/core/if.d.ts +0 -8
- package/dist/translator/index.js +580 -574
- package/dist/translator/util/is-only-child-in-parent.d.ts +14 -0
- package/dist/translator/util/signals.d.ts +2 -3
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
@@ -29,7 +29,6 @@ __export(dom_exports, {
|
|
29
29
|
compat: () => compat,
|
30
30
|
conditional: () => conditional,
|
31
31
|
conditionalClosure: () => conditionalClosure,
|
32
|
-
conditionalOnlyChild: () => conditionalOnlyChild,
|
33
32
|
controllable_detailsOrDialog_open: () => controllable_detailsOrDialog_open,
|
34
33
|
controllable_detailsOrDialog_open_effect: () => controllable_detailsOrDialog_open_effect,
|
35
34
|
controllable_input_checked: () => controllable_input_checked,
|
@@ -47,6 +46,7 @@ __export(dom_exports, {
|
|
47
46
|
createTemplate: () => createTemplate,
|
48
47
|
data: () => data,
|
49
48
|
dynamicClosure: () => dynamicClosure,
|
49
|
+
dynamicTag: () => dynamicTag,
|
50
50
|
dynamicTagAttrs: () => dynamicTagAttrs,
|
51
51
|
effect: () => effect,
|
52
52
|
forIn: () => forIn,
|
@@ -70,7 +70,7 @@ __export(dom_exports, {
|
|
70
70
|
props: () => props,
|
71
71
|
register: () => register,
|
72
72
|
registerBoundSignal: () => registerBoundSignal,
|
73
|
-
|
73
|
+
registerDynamicClosure: () => registerDynamicClosure,
|
74
74
|
resetAbortSignal: () => resetAbortSignal,
|
75
75
|
run: () => run,
|
76
76
|
setTagVar: () => setTagVar,
|
@@ -130,49 +130,6 @@ function forTo(to, from, step, cb) {
|
|
130
130
|
}
|
131
131
|
}
|
132
132
|
|
133
|
-
// src/dom/schedule.ts
|
134
|
-
var runTask;
|
135
|
-
var port2 = /* @__PURE__ */ (() => {
|
136
|
-
const { port1, port2: port22 } = new MessageChannel();
|
137
|
-
port1.onmessage = () => {
|
138
|
-
isScheduled = false;
|
139
|
-
if (true) {
|
140
|
-
const run2 = runTask;
|
141
|
-
runTask = void 0;
|
142
|
-
run2();
|
143
|
-
} else {
|
144
|
-
run();
|
145
|
-
}
|
146
|
-
};
|
147
|
-
return port22;
|
148
|
-
})();
|
149
|
-
var isScheduled;
|
150
|
-
function schedule() {
|
151
|
-
if (!isScheduled) {
|
152
|
-
if (true) {
|
153
|
-
if (console.createTask) {
|
154
|
-
const task = console.createTask("queue");
|
155
|
-
runTask = () => task.run(run);
|
156
|
-
} else {
|
157
|
-
runTask = run;
|
158
|
-
}
|
159
|
-
}
|
160
|
-
isScheduled = true;
|
161
|
-
queueMicrotask(flushAndWaitFrame);
|
162
|
-
}
|
163
|
-
}
|
164
|
-
function flushAndWaitFrame() {
|
165
|
-
if (true) {
|
166
|
-
runTask();
|
167
|
-
} else {
|
168
|
-
run();
|
169
|
-
}
|
170
|
-
requestAnimationFrame(triggerMacroTask);
|
171
|
-
}
|
172
|
-
function triggerMacroTask() {
|
173
|
-
port2.postMessage(0);
|
174
|
-
}
|
175
|
-
|
176
133
|
// src/common/helpers.ts
|
177
134
|
function classValue(value2) {
|
178
135
|
return toDelimitedString(value2, " ", stringifyClassObject);
|
@@ -503,10 +460,6 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
503
460
|
});
|
504
461
|
}
|
505
462
|
}
|
506
|
-
function registerSubscriber(id, signal) {
|
507
|
-
register(id, signal.___subscribe);
|
508
|
-
return signal;
|
509
|
-
}
|
510
463
|
function nodeRef(id, key) {
|
511
464
|
return register(id, (scope) => () => scope[key]);
|
512
465
|
}
|
@@ -1057,9 +1010,10 @@ function toInsertNode(startNode, endNode) {
|
|
1057
1010
|
// src/dom/scope.ts
|
1058
1011
|
var pendingScopes = [];
|
1059
1012
|
var debugID = 0;
|
1060
|
-
function createScope($global) {
|
1013
|
+
function createScope($global, closestBranch) {
|
1061
1014
|
const scope = {
|
1062
1015
|
___pending: 1,
|
1016
|
+
___closestBranch: closestBranch,
|
1063
1017
|
$global
|
1064
1018
|
};
|
1065
1019
|
if (true) {
|
@@ -1281,10 +1235,10 @@ function trimWalkString(walkString) {
|
|
1281
1235
|
}
|
1282
1236
|
function walk(startNode, walkCodes, branch) {
|
1283
1237
|
walker.currentNode = startNode;
|
1284
|
-
walkInternal(walkCodes, branch
|
1238
|
+
walkInternal(0, walkCodes, branch);
|
1285
1239
|
walker.currentNode = document;
|
1286
1240
|
}
|
1287
|
-
function walkInternal(walkCodes, scope
|
1241
|
+
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
1288
1242
|
let value2;
|
1289
1243
|
let storedMultiplier = 0;
|
1290
1244
|
let currentMultiplier = 0;
|
@@ -1311,9 +1265,11 @@ function walkInternal(walkCodes, scope, currentWalkIndex) {
|
|
1311
1265
|
walker.nextNode();
|
1312
1266
|
}
|
1313
1267
|
} else if (value2 === 47 /* BeginChild */) {
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1268
|
+
currentWalkIndex = walkInternal(
|
1269
|
+
currentWalkIndex,
|
1270
|
+
walkCodes,
|
1271
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
|
1272
|
+
);
|
1317
1273
|
} else if (value2 === 38 /* EndChild */) {
|
1318
1274
|
return currentWalkIndex;
|
1319
1275
|
} else if (value2 === 32 /* Get */) {
|
@@ -1390,9 +1346,14 @@ function createBranch($global, ownerScope, parentScope) {
|
|
1390
1346
|
function initBranch(renderer, branch, parentNode) {
|
1391
1347
|
const clone = renderer.___clone(parentNode.namespaceURI);
|
1392
1348
|
const cloneParent = clone.parentNode;
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1349
|
+
if (cloneParent) {
|
1350
|
+
walk(cloneParent.firstChild, renderer.___walks, branch);
|
1351
|
+
branch.___startNode = cloneParent.firstChild;
|
1352
|
+
branch.___endNode = cloneParent.lastChild;
|
1353
|
+
} else {
|
1354
|
+
walk(clone, renderer.___walks, branch);
|
1355
|
+
branch.___startNode = branch.___endNode = clone;
|
1356
|
+
}
|
1396
1357
|
if (renderer.___setup) {
|
1397
1358
|
queueRender(branch, renderer.___setup);
|
1398
1359
|
}
|
@@ -1415,7 +1376,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
|
|
1415
1376
|
"A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
|
1416
1377
|
);
|
1417
1378
|
}
|
1418
|
-
setConditionalRendererOnlyChild(
|
1379
|
+
setConditionalRendererOnlyChild(
|
1380
|
+
childScope,
|
1381
|
+
nodeAccessor2,
|
1382
|
+
content,
|
1383
|
+
createBranchScopeWithTagNameOrRenderer
|
1384
|
+
);
|
1419
1385
|
attrs(childScope, nodeAccessor2, attrsOrOp());
|
1420
1386
|
} else if (renderer.___args) {
|
1421
1387
|
const attributes = attrsOrOp();
|
@@ -1467,11 +1433,23 @@ function createCloneableHTML(html2, ns) {
|
|
1467
1433
|
}
|
1468
1434
|
|
1469
1435
|
// src/dom/control-flow.ts
|
1470
|
-
function
|
1471
|
-
|
1472
|
-
|
1436
|
+
function conditional(nodeAccessor, ...branches) {
|
1437
|
+
const branchAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
1438
|
+
return (scope, newBranchIndexOrOp) => {
|
1439
|
+
if (newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN) {
|
1440
|
+
(scope[nodeAccessor].nodeType > 1 /* Element */ ? setConditionalRenderer : setConditionalRendererOnlyChild)(
|
1441
|
+
scope,
|
1442
|
+
nodeAccessor,
|
1443
|
+
branches[scope[branchAccessor] = newBranchIndexOrOp],
|
1444
|
+
createBranchScopeWithRenderer
|
1445
|
+
);
|
1446
|
+
}
|
1447
|
+
};
|
1448
|
+
}
|
1449
|
+
function patchDynamicTag(fn) {
|
1450
|
+
dynamicTag = fn(dynamicTag);
|
1473
1451
|
}
|
1474
|
-
var
|
1452
|
+
var dynamicTag = function dynamicTag2(nodeAccessor, fn, getIntersection) {
|
1475
1453
|
const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
1476
1454
|
let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
1477
1455
|
return (scope, newRendererOrOp) => {
|
@@ -1482,7 +1460,12 @@ var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
|
|
1482
1460
|
const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
|
1483
1461
|
if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
|
1484
1462
|
scope[rendererAccessor] = normalizedRenderer;
|
1485
|
-
setConditionalRenderer(
|
1463
|
+
setConditionalRenderer(
|
1464
|
+
scope,
|
1465
|
+
nodeAccessor,
|
1466
|
+
normalizedRenderer,
|
1467
|
+
createBranchScopeWithTagNameOrRenderer
|
1468
|
+
);
|
1486
1469
|
fn && fn(scope);
|
1487
1470
|
op = DIRTY;
|
1488
1471
|
} else {
|
@@ -1492,56 +1475,28 @@ var conditional = function conditional2(nodeAccessor, fn, getIntersection) {
|
|
1492
1475
|
intersection2?.(scope, op);
|
1493
1476
|
};
|
1494
1477
|
};
|
1495
|
-
function setConditionalRenderer(scope, nodeAccessor, newRenderer) {
|
1478
|
+
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
1496
1479
|
const prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] || getEmptyBranch(scope[nodeAccessor]);
|
1497
|
-
const newBranch = newRenderer ?
|
1480
|
+
const newBranch = newRenderer ? createBranch2(
|
1498
1481
|
newRenderer,
|
1499
1482
|
scope.$global,
|
1500
1483
|
scope,
|
1501
1484
|
prevBranch.___endNode.parentNode
|
1502
1485
|
) : getEmptyBranch(scope[nodeAccessor]);
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1486
|
+
if (prevBranch !== newBranch) {
|
1487
|
+
insertBranchBefore(
|
1488
|
+
newBranch,
|
1489
|
+
prevBranch.___endNode.parentNode,
|
1490
|
+
prevBranch.___endNode.nextSibling
|
1491
|
+
);
|
1492
|
+
removeAndDestroyBranch(prevBranch);
|
1493
|
+
scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch;
|
1494
|
+
}
|
1510
1495
|
}
|
1511
|
-
|
1512
|
-
const rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
|
1513
|
-
let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
|
1514
|
-
return (scope, newRendererOrOp) => {
|
1515
|
-
if (newRendererOrOp === DIRTY) return;
|
1516
|
-
let currentRenderer = scope[rendererAccessor];
|
1517
|
-
let op = newRendererOrOp;
|
1518
|
-
if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
|
1519
|
-
const normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
|
1520
|
-
if (isDifferentRenderer(normalizedRenderer, currentRenderer)) {
|
1521
|
-
currentRenderer = scope[rendererAccessor] = normalizedRenderer;
|
1522
|
-
setConditionalRendererOnlyChild(
|
1523
|
-
scope,
|
1524
|
-
nodeAccessor,
|
1525
|
-
normalizedRenderer
|
1526
|
-
);
|
1527
|
-
fn && fn(scope);
|
1528
|
-
op = DIRTY;
|
1529
|
-
} else {
|
1530
|
-
op = CLEAN;
|
1531
|
-
}
|
1532
|
-
}
|
1533
|
-
intersection2?.(scope, op);
|
1534
|
-
};
|
1535
|
-
};
|
1536
|
-
function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
|
1496
|
+
function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer, createBranch2) {
|
1537
1497
|
const prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */];
|
1538
1498
|
const referenceNode = scope[nodeAccessor];
|
1539
|
-
const newBranch = newRenderer &&
|
1540
|
-
newRenderer,
|
1541
|
-
scope.$global,
|
1542
|
-
scope,
|
1543
|
-
referenceNode
|
1544
|
-
);
|
1499
|
+
const newBranch = newRenderer && createBranch2(newRenderer, scope.$global, scope, referenceNode);
|
1545
1500
|
referenceNode.textContent = "";
|
1546
1501
|
if (newBranch) {
|
1547
1502
|
insertBranchBefore(newBranch, referenceNode, null);
|
@@ -1671,6 +1626,49 @@ function isDifferentRenderer(a, b) {
|
|
1671
1626
|
return a !== b && (a?.___id || 0) !== b?.___id;
|
1672
1627
|
}
|
1673
1628
|
|
1629
|
+
// src/dom/schedule.ts
|
1630
|
+
var runTask;
|
1631
|
+
var port2 = /* @__PURE__ */ (() => {
|
1632
|
+
const { port1, port2: port22 } = new MessageChannel();
|
1633
|
+
port1.onmessage = () => {
|
1634
|
+
isScheduled = false;
|
1635
|
+
if (true) {
|
1636
|
+
const run2 = runTask;
|
1637
|
+
runTask = void 0;
|
1638
|
+
run2();
|
1639
|
+
} else {
|
1640
|
+
run();
|
1641
|
+
}
|
1642
|
+
};
|
1643
|
+
return port22;
|
1644
|
+
})();
|
1645
|
+
var isScheduled;
|
1646
|
+
function schedule() {
|
1647
|
+
if (!isScheduled) {
|
1648
|
+
if (true) {
|
1649
|
+
if (console.createTask) {
|
1650
|
+
const task = console.createTask("queue");
|
1651
|
+
runTask = () => task.run(run);
|
1652
|
+
} else {
|
1653
|
+
runTask = run;
|
1654
|
+
}
|
1655
|
+
}
|
1656
|
+
isScheduled = true;
|
1657
|
+
queueMicrotask(flushAndWaitFrame);
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
function flushAndWaitFrame() {
|
1661
|
+
if (true) {
|
1662
|
+
runTask();
|
1663
|
+
} else {
|
1664
|
+
run();
|
1665
|
+
}
|
1666
|
+
requestAnimationFrame(triggerMacroTask);
|
1667
|
+
}
|
1668
|
+
function triggerMacroTask() {
|
1669
|
+
port2.postMessage(0);
|
1670
|
+
}
|
1671
|
+
|
1674
1672
|
// src/dom/signals.ts
|
1675
1673
|
var MARK = true ? Symbol("mark") : {};
|
1676
1674
|
var CLEAN = true ? Symbol("clean") : {};
|
@@ -1689,6 +1687,7 @@ function state(valueAccessor, fn, getIntersection) {
|
|
1689
1687
|
} else if (scope[valueChangeAccessor]) {
|
1690
1688
|
scope[valueChangeAccessor](valueOrOp);
|
1691
1689
|
} else {
|
1690
|
+
schedule();
|
1692
1691
|
queueSource(scope, valueSignal, valueOrOp);
|
1693
1692
|
}
|
1694
1693
|
return valueOrOp;
|
@@ -1696,21 +1695,21 @@ function state(valueAccessor, fn, getIntersection) {
|
|
1696
1695
|
}
|
1697
1696
|
function value(valueAccessor, fn, getIntersection) {
|
1698
1697
|
const markAccessor = valueAccessor + "#" /* Mark */;
|
1699
|
-
let intersection2
|
1698
|
+
let intersection2;
|
1700
1699
|
return (scope, valueOrOp) => {
|
1701
1700
|
if (valueOrOp === MARK) {
|
1702
1701
|
if ((scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1) {
|
1703
|
-
intersection2
|
1702
|
+
getIntersection && (intersection2 ||= getIntersection())(scope, MARK);
|
1704
1703
|
}
|
1705
1704
|
} else if (valueOrOp !== DIRTY) {
|
1706
1705
|
const existing = scope[markAccessor] !== void 0;
|
1707
1706
|
if ((scope[markAccessor] ||= 1) === 1) {
|
1708
1707
|
if (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp) {
|
1709
|
-
intersection2
|
1708
|
+
getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN);
|
1710
1709
|
} else {
|
1711
1710
|
scope[valueAccessor] = valueOrOp;
|
1712
1711
|
fn && fn(scope, valueOrOp);
|
1713
|
-
intersection2
|
1712
|
+
getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY);
|
1714
1713
|
}
|
1715
1714
|
}
|
1716
1715
|
scope[markAccessor]--;
|
@@ -1721,11 +1720,11 @@ var accessorId = 0;
|
|
1721
1720
|
function intersection(count, fn, getIntersection) {
|
1722
1721
|
const dirtyAccessor = "?" /* Dynamic */ + accessorId++;
|
1723
1722
|
const markAccessor = dirtyAccessor + "#" /* Mark */;
|
1724
|
-
let intersection2
|
1723
|
+
let intersection2;
|
1725
1724
|
return (scope, op) => {
|
1726
1725
|
if (op === MARK) {
|
1727
1726
|
if ((scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1) {
|
1728
|
-
intersection2
|
1727
|
+
getIntersection && (intersection2 ||= getIntersection())(scope, MARK);
|
1729
1728
|
}
|
1730
1729
|
} else if (scope[markAccessor] === void 0) {
|
1731
1730
|
scope[markAccessor] = count - 1;
|
@@ -1733,84 +1732,101 @@ function intersection(count, fn, getIntersection) {
|
|
1733
1732
|
} else if (--scope[markAccessor] === 0) {
|
1734
1733
|
if (op === DIRTY || scope[dirtyAccessor]) {
|
1735
1734
|
scope[dirtyAccessor] = false;
|
1736
|
-
fn(scope
|
1737
|
-
intersection2
|
1735
|
+
fn(scope);
|
1736
|
+
getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY);
|
1738
1737
|
} else {
|
1739
|
-
intersection2
|
1738
|
+
getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN);
|
1740
1739
|
}
|
1741
1740
|
} else {
|
1742
1741
|
scope[dirtyAccessor] ||= op === DIRTY;
|
1743
1742
|
}
|
1744
1743
|
};
|
1745
1744
|
}
|
1746
|
-
function
|
1747
|
-
|
1748
|
-
return (scope, valueOrOp) => {
|
1749
|
-
if (valueOrOp === MARK) {
|
1750
|
-
intersection2?.(scope, MARK);
|
1751
|
-
} else {
|
1752
|
-
fn && fn(scope, valueOrOp);
|
1753
|
-
intersection2?.(scope, DIRTY);
|
1754
|
-
}
|
1755
|
-
};
|
1756
|
-
}
|
1757
|
-
function loopClosure(ownerLoopNodeAccessor, fn, getIntersection) {
|
1758
|
-
const signal = closure(fn, getIntersection);
|
1745
|
+
function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn, getIntersection) {
|
1746
|
+
const childSignal = closure(valueAccessor, fn, getIntersection);
|
1759
1747
|
const loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */;
|
1760
1748
|
const loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */;
|
1761
|
-
const
|
1749
|
+
const ownerSignal = (ownerScope) => {
|
1762
1750
|
const loopScopes = ownerScope[loopScopeAccessor] ?? ownerScope[loopScopeMapAccessor]?.values() ?? [];
|
1763
1751
|
if (loopScopes !== emptyMarkerArray) {
|
1764
1752
|
for (const scope of loopScopes) {
|
1765
1753
|
if (!scope.___pending) {
|
1766
|
-
queueSource(scope,
|
1754
|
+
queueSource(scope, childSignal);
|
1767
1755
|
}
|
1768
1756
|
}
|
1769
1757
|
}
|
1770
1758
|
};
|
1771
|
-
|
1772
|
-
return
|
1759
|
+
ownerSignal._ = childSignal;
|
1760
|
+
return ownerSignal;
|
1773
1761
|
}
|
1774
|
-
function conditionalClosure(ownerConditionalNodeAccessor,
|
1775
|
-
const
|
1762
|
+
function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn, getIntersection) {
|
1763
|
+
const childSignal = closure(valueAccessor, fn, getIntersection);
|
1776
1764
|
const scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */;
|
1777
|
-
const
|
1778
|
-
const
|
1779
|
-
const
|
1780
|
-
if (
|
1781
|
-
queueSource(
|
1765
|
+
const branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */;
|
1766
|
+
const ownerSignal = (scope) => {
|
1767
|
+
const ifScope = scope[scopeAccessor];
|
1768
|
+
if (ifScope && !ifScope.___pending && scope[branchAccessor] === branch) {
|
1769
|
+
queueSource(ifScope, childSignal);
|
1782
1770
|
}
|
1783
1771
|
};
|
1784
|
-
|
1785
|
-
return
|
1786
|
-
}
|
1787
|
-
|
1788
|
-
|
1789
|
-
const
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1772
|
+
ownerSignal._ = childSignal;
|
1773
|
+
return ownerSignal;
|
1774
|
+
}
|
1775
|
+
function dynamicClosure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
1776
|
+
const subscribersAccessor = "?" /* Dynamic */ + accessorId++;
|
1777
|
+
const childSignal = closure(
|
1778
|
+
valueAccessor,
|
1779
|
+
fn,
|
1780
|
+
getIntersection,
|
1781
|
+
getOwnerScope
|
1782
|
+
);
|
1783
|
+
const ownerSignal = (ownerScope) => {
|
1784
|
+
const subscribers = ownerScope[subscribersAccessor];
|
1793
1785
|
if (subscribers) {
|
1794
1786
|
for (const subscriber of subscribers) {
|
1795
1787
|
if (!subscriber.___pending) {
|
1796
|
-
queueSource(subscriber,
|
1788
|
+
queueSource(subscriber, childSignal);
|
1797
1789
|
}
|
1798
1790
|
}
|
1799
1791
|
}
|
1800
1792
|
};
|
1801
|
-
const
|
1802
|
-
|
1793
|
+
const subscribe = (scope) => {
|
1794
|
+
const owner = getOwnerScope ? getOwnerScope(scope) : scope._;
|
1795
|
+
const subscribers = owner[subscribersAccessor] ||= /* @__PURE__ */ new Set();
|
1796
|
+
if (!subscribers.has(scope)) {
|
1797
|
+
subscribers.add(scope);
|
1798
|
+
getAbortSignal(scope, -1).addEventListener(
|
1799
|
+
"abort",
|
1800
|
+
() => owner[subscribersAccessor].delete(scope)
|
1801
|
+
);
|
1802
|
+
}
|
1803
|
+
};
|
1804
|
+
ownerSignal.___subscribe = subscribe;
|
1805
|
+
ownerSignal._ = (scope) => {
|
1806
|
+
childSignal(scope);
|
1803
1807
|
subscribe(scope);
|
1804
1808
|
};
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1809
|
+
return ownerSignal;
|
1810
|
+
}
|
1811
|
+
function registerDynamicClosure(id, valueAccessor, fn, getIntersection, getOwnerScope) {
|
1812
|
+
const signal = dynamicClosure(
|
1813
|
+
valueAccessor,
|
1814
|
+
fn,
|
1815
|
+
getIntersection,
|
1816
|
+
getOwnerScope
|
1817
|
+
);
|
1818
|
+
register(id, signal.___subscribe);
|
1819
|
+
return signal;
|
1820
|
+
}
|
1821
|
+
function closure(valueAccessor, fn, getIntersection, getOwnerScope) {
|
1822
|
+
let intersection2;
|
1823
|
+
return (scope, op) => {
|
1824
|
+
op || fn && fn(
|
1825
|
+
scope,
|
1826
|
+
(getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
|
1827
|
+
);
|
1828
|
+
getIntersection && (intersection2 ||= getIntersection())(scope, op ? MARK : DIRTY);
|
1810
1829
|
};
|
1811
|
-
helperSignal._ = setupSignal;
|
1812
|
-
helperSignal.___subscribe = subscribe;
|
1813
|
-
return helperSignal;
|
1814
1830
|
}
|
1815
1831
|
function setTagVar(scope, childAccessor, tagVarSignal2) {
|
1816
1832
|
scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
|
@@ -1850,13 +1866,11 @@ var pendingRenders = [];
|
|
1850
1866
|
var pendingEffects = [];
|
1851
1867
|
var rendering = false;
|
1852
1868
|
function queueSource(scope, signal, value2) {
|
1853
|
-
schedule();
|
1854
1869
|
const prevRendering = rendering;
|
1855
1870
|
rendering = true;
|
1856
1871
|
signal(scope, MARK);
|
1857
1872
|
rendering = prevRendering;
|
1858
1873
|
queueRender(scope, signal, value2);
|
1859
|
-
return value2;
|
1860
1874
|
}
|
1861
1875
|
function queueRender(scope, signal, value2) {
|
1862
1876
|
let i = pendingRenders.length;
|
@@ -1864,6 +1878,7 @@ function queueRender(scope, signal, value2) {
|
|
1864
1878
|
___scope: scope,
|
1865
1879
|
___signal: signal,
|
1866
1880
|
___value: value2,
|
1881
|
+
___depth: scope.___closestBranch?.___branchDepth || 0,
|
1867
1882
|
___index: i
|
1868
1883
|
};
|
1869
1884
|
pendingRenders.push(render);
|
@@ -1907,7 +1922,7 @@ function prepareEffects(fn) {
|
|
1907
1922
|
}
|
1908
1923
|
return preparedEffects;
|
1909
1924
|
}
|
1910
|
-
function runEffects(effects
|
1925
|
+
function runEffects(effects) {
|
1911
1926
|
for (let i = 0; i < effects.length; i += 2 /* Total */) {
|
1912
1927
|
const scope = effects[i];
|
1913
1928
|
const fn = effects[i + 1];
|
@@ -1947,10 +1962,7 @@ function runRenders() {
|
|
1947
1962
|
finishPendingScopes();
|
1948
1963
|
}
|
1949
1964
|
function comparePendingRenders(a, b) {
|
1950
|
-
return
|
1951
|
-
}
|
1952
|
-
function getBranchDepth(render) {
|
1953
|
-
return render.___scope.___closestBranch?.___branchDepth || 0;
|
1965
|
+
return a.___depth - b.___depth || a.___index - b.___index;
|
1954
1966
|
}
|
1955
1967
|
|
1956
1968
|
// src/dom/abort-signal.ts
|
@@ -1980,7 +1992,7 @@ var RENDER_BODY_ID = prefix + (true ? "renderBody" : "b");
|
|
1980
1992
|
// src/dom/compat.ts
|
1981
1993
|
var classIdToBranch = /* @__PURE__ */ new Map();
|
1982
1994
|
var compat = {
|
1983
|
-
patchConditionals,
|
1995
|
+
patchConditionals: patchDynamicTag,
|
1984
1996
|
queueEffect,
|
1985
1997
|
init(warp10Noop) {
|
1986
1998
|
register(SET_SCOPE_REGISTER_ID, (branch) => {
|
@@ -2125,7 +2137,7 @@ function mount(input = {}, reference, position) {
|
|
2125
2137
|
);
|
2126
2138
|
runEffects(effects);
|
2127
2139
|
return {
|
2128
|
-
update
|
2140
|
+
update(newInput) {
|
2129
2141
|
if (args) {
|
2130
2142
|
runEffects(
|
2131
2143
|
prepareEffects(() => {
|
@@ -2135,7 +2147,7 @@ function mount(input = {}, reference, position) {
|
|
2135
2147
|
);
|
2136
2148
|
}
|
2137
2149
|
},
|
2138
|
-
destroy
|
2150
|
+
destroy() {
|
2139
2151
|
removeAndDestroyBranch(branch);
|
2140
2152
|
}
|
2141
2153
|
};
|