marko 6.0.0-next.3.51 → 6.0.0-next.3.53
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 +6 -7
- package/dist/debug/dom.js +81 -55
- package/dist/debug/dom.mjs +81 -55
- package/dist/dom/compat.d.ts +1 -1
- package/dist/dom/renderer.d.ts +8 -5
- package/dist/dom/signals.d.ts +5 -9
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +117 -95
- package/dist/dom.mjs +117 -95
- package/dist/translator/index.js +199 -146
- package/dist/translator/util/references.d.ts +3 -2
- package/dist/translator/util/sections.d.ts +6 -1
- package/dist/translator/util/signals.d.ts +2 -3
- package/package.json +1 -1
package/dist/common/types.d.ts
CHANGED
@@ -31,17 +31,16 @@ export declare enum ResumeSymbol {
|
|
31
31
|
ClosestBranch = "$"
|
32
32
|
}
|
33
33
|
export declare enum AccessorChar {
|
34
|
-
|
35
|
-
|
36
|
-
Subscribers = "*",
|
37
|
-
LifecycleAbortController = "-",
|
38
|
-
DynamicPlaceholderLastChild = "-",
|
39
|
-
TagVariable = "/",
|
40
|
-
TagVariableChange = "@",
|
34
|
+
ClosureScopes = "!",
|
35
|
+
ClosureSignalIndex = "(",
|
41
36
|
ConditionalScope = "!",
|
42
37
|
ConditionalRenderer = "(",
|
43
38
|
LoopScopeArray = "!",
|
44
39
|
LoopScopeMap = "(",
|
40
|
+
LifecycleAbortController = "-",
|
41
|
+
DynamicPlaceholderLastChild = "-",
|
42
|
+
TagVariable = "/",
|
43
|
+
TagVariableChange = "@",
|
45
44
|
EventAttributes = "~",
|
46
45
|
ControlledValue = ":",
|
47
46
|
ControlledHandler = ";",
|
package/dist/debug/dom.js
CHANGED
@@ -46,6 +46,7 @@ __export(dom_exports, {
|
|
46
46
|
createTemplate: () => createTemplate,
|
47
47
|
data: () => data,
|
48
48
|
dynamicClosure: () => dynamicClosure,
|
49
|
+
dynamicClosureRead: () => dynamicClosureRead,
|
49
50
|
dynamicTag: () => dynamicTag,
|
50
51
|
effect: () => effect,
|
51
52
|
forIn: () => forIn,
|
@@ -69,7 +70,6 @@ __export(dom_exports, {
|
|
69
70
|
register: () => register,
|
70
71
|
registerBoundSignal: () => registerBoundSignal,
|
71
72
|
registerContent: () => registerContent,
|
72
|
-
registerDynamicClosure: () => registerDynamicClosure,
|
73
73
|
resetAbortSignal: () => resetAbortSignal,
|
74
74
|
run: () => run,
|
75
75
|
setTagVar: () => setTagVar,
|
@@ -1424,9 +1424,30 @@ function createBranch($global, renderer, parentScope, parentNode) {
|
|
1424
1424
|
);
|
1425
1425
|
return branch;
|
1426
1426
|
}
|
1427
|
-
function
|
1427
|
+
function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
1428
|
+
return setupBranch(
|
1429
|
+
renderer,
|
1430
|
+
createBranch($global, renderer, parentScope, parentNode)
|
1431
|
+
);
|
1432
|
+
}
|
1433
|
+
function setupBranch(renderer, branch) {
|
1434
|
+
if (renderer.___setup || renderer.___closures) {
|
1435
|
+
queueRender(
|
1436
|
+
branch,
|
1437
|
+
(branch2) => {
|
1438
|
+
renderer.___setup?.(branch2);
|
1439
|
+
renderer.___closures?.(branch2);
|
1440
|
+
},
|
1441
|
+
-1
|
1442
|
+
);
|
1443
|
+
}
|
1444
|
+
return branch;
|
1445
|
+
}
|
1446
|
+
function createContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
1428
1447
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
1429
|
-
|
1448
|
+
setup ||= void 0;
|
1449
|
+
params ||= void 0;
|
1450
|
+
closures ||= void 0;
|
1430
1451
|
const clone = template ? (branch, ns) => {
|
1431
1452
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
1432
1453
|
template,
|
@@ -1443,23 +1464,30 @@ function createContent(id, template, walks, setup, getArgs, dynamicScopesAccesso
|
|
1443
1464
|
return {
|
1444
1465
|
___id: id,
|
1445
1466
|
___clone: clone,
|
1446
|
-
___setup: setup,
|
1447
1467
|
___owner: owner,
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1468
|
+
___setup: setup,
|
1469
|
+
___params: params,
|
1470
|
+
___closures: closures,
|
1471
|
+
___accessor: dynamicScopesAccessor
|
1452
1472
|
};
|
1453
1473
|
};
|
1454
1474
|
}
|
1455
|
-
function registerContent(id, template, walks, setup,
|
1475
|
+
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
1456
1476
|
return register(
|
1457
1477
|
id,
|
1458
|
-
createContent(
|
1478
|
+
createContent(
|
1479
|
+
id,
|
1480
|
+
template,
|
1481
|
+
walks,
|
1482
|
+
setup,
|
1483
|
+
params,
|
1484
|
+
closures,
|
1485
|
+
dynamicScopesAccessor
|
1486
|
+
)
|
1459
1487
|
);
|
1460
1488
|
}
|
1461
|
-
function createRenderer(template, walks, setup,
|
1462
|
-
return createContent("", template, walks, setup,
|
1489
|
+
function createRenderer(template, walks, setup, params, closures) {
|
1490
|
+
return createContent("", template, walks, setup, params, closures)();
|
1463
1491
|
}
|
1464
1492
|
var cloneCache = {};
|
1465
1493
|
function createCloneableHTML(html2, ns) {
|
@@ -1570,7 +1598,6 @@ function value(valueAccessor, fn = () => {
|
|
1570
1598
|
}
|
1571
1599
|
};
|
1572
1600
|
}
|
1573
|
-
var accessorId = 0;
|
1574
1601
|
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "___id") {
|
1575
1602
|
return (scope) => {
|
1576
1603
|
if (scope.___pending) {
|
@@ -1633,34 +1660,39 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
1633
1660
|
);
|
1634
1661
|
}
|
1635
1662
|
}
|
1636
|
-
function dynamicClosure(
|
1637
|
-
const
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1663
|
+
function dynamicClosure(...closureSignals) {
|
1664
|
+
const [{ ___scopeInstancesAccessor, ___signalIndexAccessor }] = closureSignals;
|
1665
|
+
for (let i = closureSignals.length; i--; ) {
|
1666
|
+
closureSignals[i].___index = i;
|
1667
|
+
}
|
1668
|
+
return (scope) => {
|
1669
|
+
if (scope[___scopeInstancesAccessor]) {
|
1670
|
+
for (const childScope of scope[___scopeInstancesAccessor]) {
|
1671
|
+
if (!childScope.___pending) {
|
1672
|
+
queueRender(
|
1673
|
+
childScope,
|
1674
|
+
closureSignals[childScope[___signalIndexAccessor]],
|
1675
|
+
-1
|
1676
|
+
);
|
1645
1677
|
}
|
1646
1678
|
}
|
1647
1679
|
}
|
1648
1680
|
};
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
ownerSignal._ = (scope) => {
|
1681
|
+
}
|
1682
|
+
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
1683
|
+
const childSignal = closure(valueAccessor, fn, getOwnerScope);
|
1684
|
+
const closureSignal = (scope) => {
|
1685
|
+
scope[closureSignal.___signalIndexAccessor] = closureSignal.___index;
|
1655
1686
|
childSignal(scope);
|
1656
|
-
|
1687
|
+
subscribeToScopeSet(
|
1688
|
+
getOwnerScope ? getOwnerScope(scope) : scope._,
|
1689
|
+
closureSignal.___scopeInstancesAccessor,
|
1690
|
+
scope
|
1691
|
+
);
|
1657
1692
|
};
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
const signal = dynamicClosure(valueAccessor, fn, getOwnerScope);
|
1662
|
-
register(registryId, signal.___subscribe);
|
1663
|
-
return signal;
|
1693
|
+
closureSignal.___scopeInstancesAccessor = valueAccessor + "!" /* ClosureScopes */;
|
1694
|
+
closureSignal.___signalIndexAccessor = valueAccessor + "(" /* ClosureSignalIndex */;
|
1695
|
+
return closureSignal;
|
1664
1696
|
}
|
1665
1697
|
function closure(valueAccessor, fn, getOwnerScope) {
|
1666
1698
|
return (scope) => {
|
@@ -1773,9 +1805,9 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1773
1805
|
true ? `#${normalizedRenderer}/0` : 0,
|
1774
1806
|
(inputIsArgs ? args[0] : args) || {}
|
1775
1807
|
);
|
1776
|
-
} else if (normalizedRenderer.
|
1808
|
+
} else if (normalizedRenderer.___params) {
|
1777
1809
|
if (inputIsArgs) {
|
1778
|
-
normalizedRenderer.
|
1810
|
+
normalizedRenderer.___params(
|
1779
1811
|
scope[childScopeAccessor],
|
1780
1812
|
normalizedRenderer._ ? args[0] : args
|
1781
1813
|
);
|
@@ -1784,7 +1816,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1784
1816
|
...args,
|
1785
1817
|
content: getContent(scope)
|
1786
1818
|
} : args || {};
|
1787
|
-
normalizedRenderer.
|
1819
|
+
normalizedRenderer.___params(
|
1788
1820
|
scope[childScopeAccessor],
|
1789
1821
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
1790
1822
|
);
|
@@ -1849,7 +1881,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
1849
1881
|
);
|
1850
1882
|
}
|
1851
1883
|
function loop(nodeAccessor, renderer, forEach) {
|
1852
|
-
const params = renderer.
|
1884
|
+
const params = renderer.___params;
|
1853
1885
|
return (scope, value2) => {
|
1854
1886
|
const referenceNode = scope[nodeAccessor];
|
1855
1887
|
const oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */];
|
@@ -1880,11 +1912,6 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
1880
1912
|
reconcile(parentNode, oldArray, newArray, afterReference);
|
1881
1913
|
};
|
1882
1914
|
}
|
1883
|
-
function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
1884
|
-
const branch = createBranch($global, renderer, parentScope, parentNode);
|
1885
|
-
renderer.___setup && queueRender(branch, renderer.___setup, -1);
|
1886
|
-
return branch;
|
1887
|
-
}
|
1888
1915
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
1889
1916
|
const branch = createBranch(
|
1890
1917
|
$global,
|
@@ -1897,8 +1924,8 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
1897
1924
|
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
1898
1925
|
tagNameOrRenderer
|
1899
1926
|
);
|
1900
|
-
} else
|
1901
|
-
|
1927
|
+
} else {
|
1928
|
+
setupBranch(tagNameOrRenderer, branch);
|
1902
1929
|
}
|
1903
1930
|
return branch;
|
1904
1931
|
}
|
@@ -1953,8 +1980,8 @@ var compat = {
|
|
1953
1980
|
}
|
1954
1981
|
return value2;
|
1955
1982
|
},
|
1956
|
-
createRenderer(
|
1957
|
-
const renderer = createRenderer(0, 0, 0,
|
1983
|
+
createRenderer(params, clone) {
|
1984
|
+
const renderer = createRenderer(0, 0, 0, params);
|
1958
1985
|
renderer.___clone = (branch) => {
|
1959
1986
|
const cloned = clone();
|
1960
1987
|
branch.___startNode = cloned.startNode;
|
@@ -1982,17 +2009,16 @@ var compat = {
|
|
1982
2009
|
component.effects = prepareEffects(() => {
|
1983
2010
|
if (!branch) {
|
1984
2011
|
out.global.___nextScopeId ||= 0;
|
1985
|
-
branch = component.scope =
|
2012
|
+
branch = component.scope = createAndSetupBranch(
|
1986
2013
|
out.global,
|
1987
2014
|
renderer,
|
1988
2015
|
renderer.___owner,
|
1989
2016
|
document.body
|
1990
2017
|
);
|
1991
|
-
renderer.___setup && renderer.___setup(branch);
|
1992
2018
|
} else {
|
1993
2019
|
existing = true;
|
1994
2020
|
}
|
1995
|
-
renderer.
|
2021
|
+
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
1996
2022
|
});
|
1997
2023
|
if (!existing) {
|
1998
2024
|
return toInsertNode(branch.___startNode, branch.___endNode);
|
@@ -2007,7 +2033,7 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
2007
2033
|
template,
|
2008
2034
|
walks,
|
2009
2035
|
setup,
|
2010
|
-
inputSignal
|
2036
|
+
inputSignal
|
2011
2037
|
)();
|
2012
2038
|
renderer.mount = mount;
|
2013
2039
|
renderer._ = renderer;
|
@@ -2053,7 +2079,7 @@ function mount(input = {}, reference, position) {
|
|
2053
2079
|
nextSibling = reference.nextSibling;
|
2054
2080
|
break;
|
2055
2081
|
}
|
2056
|
-
const args = this.
|
2082
|
+
const args = this.___params;
|
2057
2083
|
const effects = prepareEffects(() => {
|
2058
2084
|
branch = createBranch(
|
2059
2085
|
$global,
|
@@ -2061,8 +2087,8 @@ function mount(input = {}, reference, position) {
|
|
2061
2087
|
void 0,
|
2062
2088
|
parentNode
|
2063
2089
|
);
|
2064
|
-
this.___setup
|
2065
|
-
args
|
2090
|
+
this.___setup?.(branch);
|
2091
|
+
args?.(branch, input);
|
2066
2092
|
});
|
2067
2093
|
insertChildNodes(
|
2068
2094
|
parentNode,
|
package/dist/debug/dom.mjs
CHANGED
@@ -1339,9 +1339,30 @@ function createBranch($global, renderer, parentScope, parentNode) {
|
|
1339
1339
|
);
|
1340
1340
|
return branch;
|
1341
1341
|
}
|
1342
|
-
function
|
1342
|
+
function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
1343
|
+
return setupBranch(
|
1344
|
+
renderer,
|
1345
|
+
createBranch($global, renderer, parentScope, parentNode)
|
1346
|
+
);
|
1347
|
+
}
|
1348
|
+
function setupBranch(renderer, branch) {
|
1349
|
+
if (renderer.___setup || renderer.___closures) {
|
1350
|
+
queueRender(
|
1351
|
+
branch,
|
1352
|
+
(branch2) => {
|
1353
|
+
renderer.___setup?.(branch2);
|
1354
|
+
renderer.___closures?.(branch2);
|
1355
|
+
},
|
1356
|
+
-1
|
1357
|
+
);
|
1358
|
+
}
|
1359
|
+
return branch;
|
1360
|
+
}
|
1361
|
+
function createContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
1343
1362
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
1344
|
-
|
1363
|
+
setup ||= void 0;
|
1364
|
+
params ||= void 0;
|
1365
|
+
closures ||= void 0;
|
1345
1366
|
const clone = template ? (branch, ns) => {
|
1346
1367
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
1347
1368
|
template,
|
@@ -1358,23 +1379,30 @@ function createContent(id, template, walks, setup, getArgs, dynamicScopesAccesso
|
|
1358
1379
|
return {
|
1359
1380
|
___id: id,
|
1360
1381
|
___clone: clone,
|
1361
|
-
___setup: setup,
|
1362
1382
|
___owner: owner,
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1383
|
+
___setup: setup,
|
1384
|
+
___params: params,
|
1385
|
+
___closures: closures,
|
1386
|
+
___accessor: dynamicScopesAccessor
|
1367
1387
|
};
|
1368
1388
|
};
|
1369
1389
|
}
|
1370
|
-
function registerContent(id, template, walks, setup,
|
1390
|
+
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
1371
1391
|
return register(
|
1372
1392
|
id,
|
1373
|
-
createContent(
|
1393
|
+
createContent(
|
1394
|
+
id,
|
1395
|
+
template,
|
1396
|
+
walks,
|
1397
|
+
setup,
|
1398
|
+
params,
|
1399
|
+
closures,
|
1400
|
+
dynamicScopesAccessor
|
1401
|
+
)
|
1374
1402
|
);
|
1375
1403
|
}
|
1376
|
-
function createRenderer(template, walks, setup,
|
1377
|
-
return createContent("", template, walks, setup,
|
1404
|
+
function createRenderer(template, walks, setup, params, closures) {
|
1405
|
+
return createContent("", template, walks, setup, params, closures)();
|
1378
1406
|
}
|
1379
1407
|
var cloneCache = {};
|
1380
1408
|
function createCloneableHTML(html2, ns) {
|
@@ -1485,7 +1513,6 @@ function value(valueAccessor, fn = () => {
|
|
1485
1513
|
}
|
1486
1514
|
};
|
1487
1515
|
}
|
1488
|
-
var accessorId = 0;
|
1489
1516
|
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "___id") {
|
1490
1517
|
return (scope) => {
|
1491
1518
|
if (scope.___pending) {
|
@@ -1548,34 +1575,39 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
1548
1575
|
);
|
1549
1576
|
}
|
1550
1577
|
}
|
1551
|
-
function dynamicClosure(
|
1552
|
-
const
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1578
|
+
function dynamicClosure(...closureSignals) {
|
1579
|
+
const [{ ___scopeInstancesAccessor, ___signalIndexAccessor }] = closureSignals;
|
1580
|
+
for (let i = closureSignals.length; i--; ) {
|
1581
|
+
closureSignals[i].___index = i;
|
1582
|
+
}
|
1583
|
+
return (scope) => {
|
1584
|
+
if (scope[___scopeInstancesAccessor]) {
|
1585
|
+
for (const childScope of scope[___scopeInstancesAccessor]) {
|
1586
|
+
if (!childScope.___pending) {
|
1587
|
+
queueRender(
|
1588
|
+
childScope,
|
1589
|
+
closureSignals[childScope[___signalIndexAccessor]],
|
1590
|
+
-1
|
1591
|
+
);
|
1560
1592
|
}
|
1561
1593
|
}
|
1562
1594
|
}
|
1563
1595
|
};
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
ownerSignal._ = (scope) => {
|
1596
|
+
}
|
1597
|
+
function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
|
1598
|
+
const childSignal = closure(valueAccessor, fn, getOwnerScope);
|
1599
|
+
const closureSignal = (scope) => {
|
1600
|
+
scope[closureSignal.___signalIndexAccessor] = closureSignal.___index;
|
1570
1601
|
childSignal(scope);
|
1571
|
-
|
1602
|
+
subscribeToScopeSet(
|
1603
|
+
getOwnerScope ? getOwnerScope(scope) : scope._,
|
1604
|
+
closureSignal.___scopeInstancesAccessor,
|
1605
|
+
scope
|
1606
|
+
);
|
1572
1607
|
};
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
const signal = dynamicClosure(valueAccessor, fn, getOwnerScope);
|
1577
|
-
register(registryId, signal.___subscribe);
|
1578
|
-
return signal;
|
1608
|
+
closureSignal.___scopeInstancesAccessor = valueAccessor + "!" /* ClosureScopes */;
|
1609
|
+
closureSignal.___signalIndexAccessor = valueAccessor + "(" /* ClosureSignalIndex */;
|
1610
|
+
return closureSignal;
|
1579
1611
|
}
|
1580
1612
|
function closure(valueAccessor, fn, getOwnerScope) {
|
1581
1613
|
return (scope) => {
|
@@ -1688,9 +1720,9 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1688
1720
|
true ? `#${normalizedRenderer}/0` : 0,
|
1689
1721
|
(inputIsArgs ? args[0] : args) || {}
|
1690
1722
|
);
|
1691
|
-
} else if (normalizedRenderer.
|
1723
|
+
} else if (normalizedRenderer.___params) {
|
1692
1724
|
if (inputIsArgs) {
|
1693
|
-
normalizedRenderer.
|
1725
|
+
normalizedRenderer.___params(
|
1694
1726
|
scope[childScopeAccessor],
|
1695
1727
|
normalizedRenderer._ ? args[0] : args
|
1696
1728
|
);
|
@@ -1699,7 +1731,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1699
1731
|
...args,
|
1700
1732
|
content: getContent(scope)
|
1701
1733
|
} : args || {};
|
1702
|
-
normalizedRenderer.
|
1734
|
+
normalizedRenderer.___params(
|
1703
1735
|
scope[childScopeAccessor],
|
1704
1736
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
1705
1737
|
);
|
@@ -1764,7 +1796,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
1764
1796
|
);
|
1765
1797
|
}
|
1766
1798
|
function loop(nodeAccessor, renderer, forEach) {
|
1767
|
-
const params = renderer.
|
1799
|
+
const params = renderer.___params;
|
1768
1800
|
return (scope, value2) => {
|
1769
1801
|
const referenceNode = scope[nodeAccessor];
|
1770
1802
|
const oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */];
|
@@ -1795,11 +1827,6 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
1795
1827
|
reconcile(parentNode, oldArray, newArray, afterReference);
|
1796
1828
|
};
|
1797
1829
|
}
|
1798
|
-
function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
1799
|
-
const branch = createBranch($global, renderer, parentScope, parentNode);
|
1800
|
-
renderer.___setup && queueRender(branch, renderer.___setup, -1);
|
1801
|
-
return branch;
|
1802
|
-
}
|
1803
1830
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
1804
1831
|
const branch = createBranch(
|
1805
1832
|
$global,
|
@@ -1812,8 +1839,8 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
1812
1839
|
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
1813
1840
|
tagNameOrRenderer
|
1814
1841
|
);
|
1815
|
-
} else
|
1816
|
-
|
1842
|
+
} else {
|
1843
|
+
setupBranch(tagNameOrRenderer, branch);
|
1817
1844
|
}
|
1818
1845
|
return branch;
|
1819
1846
|
}
|
@@ -1868,8 +1895,8 @@ var compat = {
|
|
1868
1895
|
}
|
1869
1896
|
return value2;
|
1870
1897
|
},
|
1871
|
-
createRenderer(
|
1872
|
-
const renderer = createRenderer(0, 0, 0,
|
1898
|
+
createRenderer(params, clone) {
|
1899
|
+
const renderer = createRenderer(0, 0, 0, params);
|
1873
1900
|
renderer.___clone = (branch) => {
|
1874
1901
|
const cloned = clone();
|
1875
1902
|
branch.___startNode = cloned.startNode;
|
@@ -1897,17 +1924,16 @@ var compat = {
|
|
1897
1924
|
component.effects = prepareEffects(() => {
|
1898
1925
|
if (!branch) {
|
1899
1926
|
out.global.___nextScopeId ||= 0;
|
1900
|
-
branch = component.scope =
|
1927
|
+
branch = component.scope = createAndSetupBranch(
|
1901
1928
|
out.global,
|
1902
1929
|
renderer,
|
1903
1930
|
renderer.___owner,
|
1904
1931
|
document.body
|
1905
1932
|
);
|
1906
|
-
renderer.___setup && renderer.___setup(branch);
|
1907
1933
|
} else {
|
1908
1934
|
existing = true;
|
1909
1935
|
}
|
1910
|
-
renderer.
|
1936
|
+
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
1911
1937
|
});
|
1912
1938
|
if (!existing) {
|
1913
1939
|
return toInsertNode(branch.___startNode, branch.___endNode);
|
@@ -1922,7 +1948,7 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
1922
1948
|
template,
|
1923
1949
|
walks,
|
1924
1950
|
setup,
|
1925
|
-
inputSignal
|
1951
|
+
inputSignal
|
1926
1952
|
)();
|
1927
1953
|
renderer.mount = mount;
|
1928
1954
|
renderer._ = renderer;
|
@@ -1968,7 +1994,7 @@ function mount(input = {}, reference, position) {
|
|
1968
1994
|
nextSibling = reference.nextSibling;
|
1969
1995
|
break;
|
1970
1996
|
}
|
1971
|
-
const args = this.
|
1997
|
+
const args = this.___params;
|
1972
1998
|
const effects = prepareEffects(() => {
|
1973
1999
|
branch = createBranch(
|
1974
2000
|
$global,
|
@@ -1976,8 +2002,8 @@ function mount(input = {}, reference, position) {
|
|
1976
2002
|
void 0,
|
1977
2003
|
parentNode
|
1978
2004
|
);
|
1979
|
-
this.___setup
|
1980
|
-
args
|
2005
|
+
this.___setup?.(branch);
|
2006
|
+
args?.(branch, input);
|
1981
2007
|
});
|
1982
2008
|
insertChildNodes(
|
1983
2009
|
parentNode,
|
@@ -2028,6 +2054,7 @@ export {
|
|
2028
2054
|
createTemplate,
|
2029
2055
|
data,
|
2030
2056
|
dynamicClosure,
|
2057
|
+
dynamicClosureRead,
|
2031
2058
|
dynamicTag,
|
2032
2059
|
effect,
|
2033
2060
|
forIn,
|
@@ -2051,7 +2078,6 @@ export {
|
|
2051
2078
|
register,
|
2052
2079
|
registerBoundSignal,
|
2053
2080
|
registerContent,
|
2054
|
-
registerDynamicClosure,
|
2055
2081
|
resetAbortSignal,
|
2056
2082
|
run,
|
2057
2083
|
setTagVar,
|
package/dist/dom/compat.d.ts
CHANGED
@@ -15,7 +15,7 @@ export declare const compat: {
|
|
15
15
|
runtimeId: string;
|
16
16
|
componentIdPrefix: string;
|
17
17
|
}): any;
|
18
|
-
createRenderer(
|
18
|
+
createRenderer(params: NonNullable<Renderer["___params"]>, clone: () => {
|
19
19
|
startNode: ChildNode;
|
20
20
|
endNode: ChildNode;
|
21
21
|
}): Renderer;
|
package/dist/dom/renderer.d.ts
CHANGED
@@ -2,15 +2,18 @@ import { type Accessor, type BranchScope, type Scope } from "../common/types";
|
|
2
2
|
import type { Signal } from "./signals";
|
3
3
|
export type Renderer = {
|
4
4
|
___id: string;
|
5
|
-
___setup: undefined |
|
5
|
+
___setup: undefined | ((branch: BranchScope) => void);
|
6
6
|
___clone: (branch: BranchScope, ns: string) => void;
|
7
|
-
|
7
|
+
___params: Signal<unknown> | undefined;
|
8
|
+
___closures: SetupFn | undefined;
|
8
9
|
___owner: Scope | undefined;
|
9
10
|
___accessor: Accessor | undefined;
|
10
11
|
};
|
11
12
|
type SetupFn = (scope: Scope) => void;
|
12
13
|
export declare function createBranch($global: Scope["$global"], renderer: Renderer | string, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
|
13
|
-
export declare function
|
14
|
-
export declare function
|
15
|
-
export declare function
|
14
|
+
export declare function createAndSetupBranch($global: Scope["$global"], renderer: Renderer, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
|
15
|
+
export declare function setupBranch(renderer: Renderer, branch: BranchScope): BranchScope;
|
16
|
+
export declare function createContent(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, closures?: Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
|
17
|
+
export declare function registerContent(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, closures?: Signal<unknown> | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
|
18
|
+
export declare function createRenderer(template: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown> | 0, closures?: Signal<unknown> | 0): Renderer;
|
16
19
|
export {};
|
package/dist/dom/signals.d.ts
CHANGED
@@ -9,15 +9,11 @@ export declare function intersection(id: number, fn: SignalFn<never>, defaultPen
|
|
9
9
|
export declare function loopClosure<T>(valueAccessor: Accessor, ownerLoopNodeAccessor: Accessor, fn: SignalFn<T>): SignalFn<T>;
|
10
10
|
export declare function conditionalClosure<T>(valueAccessor: Accessor, ownerConditionalNodeAccessor: Accessor, branch: number, fn: SignalFn<T>): SignalFn<T>;
|
11
11
|
export declare function subscribeToScopeSet(ownerScope: Scope, accessor: Accessor, scope: Scope): void;
|
12
|
-
export declare function dynamicClosure
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
export declare function registerDynamicClosure<T>(registryId: string, valueAccessor: Accessor, fn: Signal<T>, getOwnerScope?: (scope: Scope) => Scope): {
|
18
|
-
(ownerScope: Scope): void;
|
19
|
-
___subscribe(scope: Scope): void;
|
20
|
-
_(scope: Scope): void;
|
12
|
+
export declare function dynamicClosure(...closureSignals: ReturnType<typeof dynamicClosureRead>[]): (scope: Scope) => void;
|
13
|
+
export declare function dynamicClosureRead<T>(valueAccessor: Accessor, fn: Signal<T>, getOwnerScope?: (scope: Scope) => Scope): ((scope: Scope) => void) & {
|
14
|
+
___scopeInstancesAccessor: string;
|
15
|
+
___signalIndexAccessor: string;
|
16
|
+
___index: number;
|
21
17
|
};
|
22
18
|
export declare function setTagVar(scope: Scope, childAccessor: Accessor, tagVarSignal: Signal<unknown>): void;
|
23
19
|
export declare const tagVarSignal: (scope: Scope, value: unknown) => any;
|
package/dist/dom.d.ts
CHANGED
@@ -9,5 +9,5 @@ export { on } from "./dom/event";
|
|
9
9
|
export { run } from "./dom/queue";
|
10
10
|
export { createContent, createRenderer, registerContent } from "./dom/renderer";
|
11
11
|
export { init, nodeRef, register, registerBoundSignal } from "./dom/resume";
|
12
|
-
export { conditionalClosure, dynamicClosure, effect, hoist, intersection, loopClosure, nextTagId,
|
12
|
+
export { conditionalClosure, dynamicClosure, dynamicClosureRead, effect, hoist, intersection, loopClosure, nextTagId, setTagVar, setTagVarChange, state, tagVarSignal, tagVarSignalChange, value, } from "./dom/signals";
|
13
13
|
export { createTemplate } from "./dom/template";
|