marko 6.0.0-next.3.50 → 6.0.0-next.3.52
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 +103 -69
- package/dist/debug/dom.mjs +103 -69
- package/dist/dom/compat.d.ts +1 -1
- package/dist/dom/renderer.d.ts +9 -6
- package/dist/dom/signals.d.ts +5 -9
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +103 -76
- package/dist/dom.mjs +103 -76
- package/dist/translator/index.js +194 -142
- 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,
|
@@ -1406,21 +1406,6 @@ function getDebugKey(index, node) {
|
|
1406
1406
|
}
|
1407
1407
|
|
1408
1408
|
// src/dom/renderer.ts
|
1409
|
-
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
1410
|
-
const branch = createBranch(
|
1411
|
-
$global,
|
1412
|
-
tagNameOrRenderer,
|
1413
|
-
parentScope,
|
1414
|
-
parentNode
|
1415
|
-
);
|
1416
|
-
if (typeof tagNameOrRenderer === "string") {
|
1417
|
-
branch[true ? `#${tagNameOrRenderer}/0` : 0] = branch.___startNode = branch.___endNode = document.createElementNS(
|
1418
|
-
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
1419
|
-
tagNameOrRenderer
|
1420
|
-
);
|
1421
|
-
}
|
1422
|
-
return branch;
|
1423
|
-
}
|
1424
1409
|
function createBranch($global, renderer, parentScope, parentNode) {
|
1425
1410
|
const branch = createScope($global);
|
1426
1411
|
const parentBranch = parentScope?.___closestBranch;
|
@@ -1433,49 +1418,76 @@ function createBranch($global, renderer, parentScope, parentNode) {
|
|
1433
1418
|
if (true) {
|
1434
1419
|
branch.___renderer = renderer;
|
1435
1420
|
}
|
1436
|
-
renderer.
|
1421
|
+
renderer.___clone?.(
|
1437
1422
|
branch,
|
1438
1423
|
parentNode.namespaceURI
|
1439
1424
|
);
|
1440
1425
|
return branch;
|
1441
1426
|
}
|
1442
|
-
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) {
|
1443
1447
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
1444
|
-
|
1445
|
-
|
1448
|
+
setup ||= void 0;
|
1449
|
+
params ||= void 0;
|
1450
|
+
closures ||= void 0;
|
1451
|
+
const clone = template ? (branch, ns) => {
|
1446
1452
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
1447
1453
|
template,
|
1448
1454
|
ns
|
1449
1455
|
))(branch, walks);
|
1450
|
-
setup && queueRender(branch, setup, -1);
|
1451
1456
|
} : (branch) => {
|
1452
1457
|
walk(
|
1453
1458
|
branch.___startNode = branch.___endNode = new Text(),
|
1454
1459
|
walks,
|
1455
1460
|
branch
|
1456
1461
|
);
|
1457
|
-
setup && queueRender(branch, setup, -1);
|
1458
1462
|
};
|
1459
1463
|
return (owner) => {
|
1460
1464
|
return {
|
1461
1465
|
___id: id,
|
1462
|
-
|
1466
|
+
___clone: clone,
|
1463
1467
|
___owner: owner,
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
+
___setup: setup,
|
1469
|
+
___params: params,
|
1470
|
+
___closures: closures,
|
1471
|
+
___accessor: dynamicScopesAccessor
|
1468
1472
|
};
|
1469
1473
|
};
|
1470
1474
|
}
|
1471
|
-
function registerContent(id, template, walks, setup,
|
1475
|
+
function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
|
1472
1476
|
return register(
|
1473
1477
|
id,
|
1474
|
-
createContent(
|
1478
|
+
createContent(
|
1479
|
+
id,
|
1480
|
+
template,
|
1481
|
+
walks,
|
1482
|
+
setup,
|
1483
|
+
params,
|
1484
|
+
closures,
|
1485
|
+
dynamicScopesAccessor
|
1486
|
+
)
|
1475
1487
|
);
|
1476
1488
|
}
|
1477
|
-
function createRenderer(template, walks, setup,
|
1478
|
-
return createContent("", template, walks, setup,
|
1489
|
+
function createRenderer(template, walks, setup, params, closures) {
|
1490
|
+
return createContent("", template, walks, setup, params, closures)();
|
1479
1491
|
}
|
1480
1492
|
var cloneCache = {};
|
1481
1493
|
function createCloneableHTML(html2, ns) {
|
@@ -1586,7 +1598,6 @@ function value(valueAccessor, fn = () => {
|
|
1586
1598
|
}
|
1587
1599
|
};
|
1588
1600
|
}
|
1589
|
-
var accessorId = 0;
|
1590
1601
|
function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "___id") {
|
1591
1602
|
return (scope) => {
|
1592
1603
|
if (scope.___pending) {
|
@@ -1649,34 +1660,39 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
1649
1660
|
);
|
1650
1661
|
}
|
1651
1662
|
}
|
1652
|
-
function dynamicClosure(
|
1653
|
-
const
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
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
|
+
);
|
1661
1677
|
}
|
1662
1678
|
}
|
1663
1679
|
}
|
1664
1680
|
};
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
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;
|
1671
1686
|
childSignal(scope);
|
1672
|
-
|
1687
|
+
subscribeToScopeSet(
|
1688
|
+
getOwnerScope ? getOwnerScope(scope) : scope._,
|
1689
|
+
closureSignal.___scopeInstancesAccessor,
|
1690
|
+
scope
|
1691
|
+
);
|
1673
1692
|
};
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
const signal = dynamicClosure(valueAccessor, fn, getOwnerScope);
|
1678
|
-
register(registryId, signal.___subscribe);
|
1679
|
-
return signal;
|
1693
|
+
closureSignal.___scopeInstancesAccessor = valueAccessor + "!" /* ClosureScopes */;
|
1694
|
+
closureSignal.___signalIndexAccessor = valueAccessor + "(" /* ClosureSignalIndex */;
|
1695
|
+
return closureSignal;
|
1680
1696
|
}
|
1681
1697
|
function closure(valueAccessor, fn, getOwnerScope) {
|
1682
1698
|
return (scope) => {
|
@@ -1733,7 +1749,7 @@ function conditional(nodeAccessor, ...branches) {
|
|
1733
1749
|
scope,
|
1734
1750
|
nodeAccessor,
|
1735
1751
|
branches[scope[branchAccessor] = newBranch],
|
1736
|
-
|
1752
|
+
createAndSetupBranch
|
1737
1753
|
);
|
1738
1754
|
}
|
1739
1755
|
};
|
@@ -1763,7 +1779,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1763
1779
|
scope[childScopeAccessor],
|
1764
1780
|
true ? `#${normalizedRenderer}/0` : 0,
|
1765
1781
|
content,
|
1766
|
-
|
1782
|
+
createAndSetupBranch
|
1767
1783
|
);
|
1768
1784
|
if (content.___accessor) {
|
1769
1785
|
subscribeToScopeSet(
|
@@ -1789,9 +1805,9 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1789
1805
|
true ? `#${normalizedRenderer}/0` : 0,
|
1790
1806
|
(inputIsArgs ? args[0] : args) || {}
|
1791
1807
|
);
|
1792
|
-
} else if (normalizedRenderer.
|
1808
|
+
} else if (normalizedRenderer.___params) {
|
1793
1809
|
if (inputIsArgs) {
|
1794
|
-
normalizedRenderer.
|
1810
|
+
normalizedRenderer.___params(
|
1795
1811
|
scope[childScopeAccessor],
|
1796
1812
|
normalizedRenderer._ ? args[0] : args
|
1797
1813
|
);
|
@@ -1800,7 +1816,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1800
1816
|
...args,
|
1801
1817
|
content: getContent(scope)
|
1802
1818
|
} : args || {};
|
1803
|
-
normalizedRenderer.
|
1819
|
+
normalizedRenderer.___params(
|
1804
1820
|
scope[childScopeAccessor],
|
1805
1821
|
normalizedRenderer._ ? inputWithContent : [inputWithContent]
|
1806
1822
|
);
|
@@ -1865,7 +1881,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
1865
1881
|
);
|
1866
1882
|
}
|
1867
1883
|
function loop(nodeAccessor, renderer, forEach) {
|
1868
|
-
const params = renderer.
|
1884
|
+
const params = renderer.___params;
|
1869
1885
|
return (scope, value2) => {
|
1870
1886
|
const referenceNode = scope[nodeAccessor];
|
1871
1887
|
const oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */];
|
@@ -1876,7 +1892,7 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
1876
1892
|
const newMap = scope[nodeAccessor + "(" /* LoopScopeMap */] = /* @__PURE__ */ new Map();
|
1877
1893
|
const newArray = scope[nodeAccessor + "!" /* LoopScopeArray */] = [];
|
1878
1894
|
forEach(value2, (key, args) => {
|
1879
|
-
const branch = oldMap?.get(key) ||
|
1895
|
+
const branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1880
1896
|
params?.(branch, args);
|
1881
1897
|
newMap.set(key, branch);
|
1882
1898
|
newArray.push(branch);
|
@@ -1896,6 +1912,23 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
1896
1912
|
reconcile(parentNode, oldArray, newArray, afterReference);
|
1897
1913
|
};
|
1898
1914
|
}
|
1915
|
+
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
1916
|
+
const branch = createBranch(
|
1917
|
+
$global,
|
1918
|
+
tagNameOrRenderer,
|
1919
|
+
parentScope,
|
1920
|
+
parentNode
|
1921
|
+
);
|
1922
|
+
if (typeof tagNameOrRenderer === "string") {
|
1923
|
+
branch[true ? `#${tagNameOrRenderer}/0` : 0] = branch.___startNode = branch.___endNode = document.createElementNS(
|
1924
|
+
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
1925
|
+
tagNameOrRenderer
|
1926
|
+
);
|
1927
|
+
} else {
|
1928
|
+
setupBranch(tagNameOrRenderer, branch);
|
1929
|
+
}
|
1930
|
+
return branch;
|
1931
|
+
}
|
1899
1932
|
function bySecondArg(_item, index) {
|
1900
1933
|
return index;
|
1901
1934
|
}
|
@@ -1918,7 +1951,7 @@ var compat = {
|
|
1918
1951
|
register(RENDERER_REGISTER_ID, fn);
|
1919
1952
|
},
|
1920
1953
|
isRenderer(renderer) {
|
1921
|
-
return renderer.
|
1954
|
+
return renderer.___clone;
|
1922
1955
|
},
|
1923
1956
|
getStartNode(branch) {
|
1924
1957
|
return branch.___startNode;
|
@@ -1947,9 +1980,9 @@ var compat = {
|
|
1947
1980
|
}
|
1948
1981
|
return value2;
|
1949
1982
|
},
|
1950
|
-
createRenderer(
|
1951
|
-
const renderer = createRenderer(0, 0, 0,
|
1952
|
-
renderer.
|
1983
|
+
createRenderer(params, clone) {
|
1984
|
+
const renderer = createRenderer(0, 0, 0, params);
|
1985
|
+
renderer.___clone = (branch) => {
|
1953
1986
|
const cloned = clone();
|
1954
1987
|
branch.___startNode = cloned.startNode;
|
1955
1988
|
branch.___endNode = cloned.endNode;
|
@@ -1976,7 +2009,7 @@ var compat = {
|
|
1976
2009
|
component.effects = prepareEffects(() => {
|
1977
2010
|
if (!branch) {
|
1978
2011
|
out.global.___nextScopeId ||= 0;
|
1979
|
-
branch = component.scope =
|
2012
|
+
branch = component.scope = createAndSetupBranch(
|
1980
2013
|
out.global,
|
1981
2014
|
renderer,
|
1982
2015
|
renderer.___owner,
|
@@ -1985,7 +2018,7 @@ var compat = {
|
|
1985
2018
|
} else {
|
1986
2019
|
existing = true;
|
1987
2020
|
}
|
1988
|
-
renderer.
|
2021
|
+
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
1989
2022
|
});
|
1990
2023
|
if (!existing) {
|
1991
2024
|
return toInsertNode(branch.___startNode, branch.___endNode);
|
@@ -2000,7 +2033,7 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
2000
2033
|
template,
|
2001
2034
|
walks,
|
2002
2035
|
setup,
|
2003
|
-
inputSignal
|
2036
|
+
inputSignal
|
2004
2037
|
)();
|
2005
2038
|
renderer.mount = mount;
|
2006
2039
|
renderer._ = renderer;
|
@@ -2046,7 +2079,7 @@ function mount(input = {}, reference, position) {
|
|
2046
2079
|
nextSibling = reference.nextSibling;
|
2047
2080
|
break;
|
2048
2081
|
}
|
2049
|
-
const args = this.
|
2082
|
+
const args = this.___params;
|
2050
2083
|
const effects = prepareEffects(() => {
|
2051
2084
|
branch = createBranch(
|
2052
2085
|
$global,
|
@@ -2054,6 +2087,7 @@ function mount(input = {}, reference, position) {
|
|
2054
2087
|
void 0,
|
2055
2088
|
parentNode
|
2056
2089
|
);
|
2090
|
+
this.___setup?.(branch);
|
2057
2091
|
args?.(branch, input);
|
2058
2092
|
});
|
2059
2093
|
insertChildNodes(
|