bobe 0.0.60 → 0.0.62
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/bobe.cjs.js +160 -35
- package/dist/bobe.cjs.js.map +1 -1
- package/dist/bobe.compiler.cjs.js +160 -35
- package/dist/bobe.compiler.cjs.js.map +1 -1
- package/dist/bobe.compiler.esm.js +162 -37
- package/dist/bobe.compiler.esm.js.map +1 -1
- package/dist/bobe.esm.js +162 -37
- package/dist/bobe.esm.js.map +1 -1
- package/dist/index.d.ts +18 -5
- package/dist/index.umd.js +160 -35
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/bobe.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Queue, isNum, matchIdStart2, matchId, escapeMap, pickInPlace, jsVarRegexp, date32 } from 'bobe-shared';
|
|
2
|
-
import { Signal, Computed, Keys, isStore, getPulling, setPulling, deepSignal,
|
|
1
|
+
import { Queue, isNum, matchIdStart2, matchId, escapeMap, pickInPlace, jsVarRegexp, date32, hasOwn } from 'bobe-shared';
|
|
2
|
+
import { Signal, Computed, Keys, isStore, getPulling, setPulling, runWithPulling, getProxyHasKey, deepSignal, Scope, backupSignal, toRaw, ScheduleType, Store, noopEffect, NoopEffect, Effect, effect as effect$1, shareSignal, flushMicroEffectManual } from 'aoye';
|
|
3
3
|
export { Store } from 'aoye';
|
|
4
4
|
|
|
5
5
|
let TokenType = function (TokenType) {
|
|
@@ -33,15 +33,15 @@ let FakeType = function (FakeType) {
|
|
|
33
33
|
FakeType[FakeType["ForItem"] = 64] = "ForItem";
|
|
34
34
|
FakeType[FakeType["Context"] = 128] = "Context";
|
|
35
35
|
FakeType[FakeType["DynamicText"] = 256] = "DynamicText";
|
|
36
|
+
FakeType[FakeType["Tp"] = 512] = "Tp";
|
|
36
37
|
return FakeType;
|
|
37
38
|
}({});
|
|
38
39
|
const CondBit = FakeType.If | FakeType.Fail | FakeType.Else;
|
|
39
|
-
const LogicalBit = FakeType.If | FakeType.Fail | FakeType.Else | FakeType.For | FakeType.ForItem;
|
|
40
40
|
const CtxProviderBit = FakeType.If | FakeType.Fail | FakeType.Else | FakeType.For | FakeType.ForItem | FakeType.Component | FakeType.Fragment | FakeType.DynamicText;
|
|
41
|
-
const ContextBit = FakeType.If | FakeType.Fail | FakeType.Else | FakeType.ForItem | FakeType.Context;
|
|
41
|
+
const ContextBit = FakeType.If | FakeType.Fail | FakeType.Else | FakeType.ForItem | FakeType.Context | FakeType.Tp;
|
|
42
42
|
const TokenizerSwitcherBit = FakeType.Component | FakeType.Fragment;
|
|
43
43
|
let NodeSort = function (NodeSort) {
|
|
44
|
-
NodeSort[NodeSort["
|
|
44
|
+
NodeSort[NodeSort["EffectNode"] = 1] = "EffectNode";
|
|
45
45
|
NodeSort[NodeSort["Real"] = 2] = "Real";
|
|
46
46
|
NodeSort[NodeSort["Component"] = 4] = "Component";
|
|
47
47
|
NodeSort[NodeSort["CtxProvider"] = 8] = "CtxProvider";
|
|
@@ -54,6 +54,7 @@ let NodeSort = function (NodeSort) {
|
|
|
54
54
|
TerpEvt["HandledComponentNode"] = "handled-component-node";
|
|
55
55
|
return TerpEvt;
|
|
56
56
|
})({});
|
|
57
|
+
const FakeNode = Symbol('fake-node');
|
|
57
58
|
let ParseErrorCode = function (ParseErrorCode) {
|
|
58
59
|
ParseErrorCode[ParseErrorCode["UNCLOSED_BRACE"] = 9001] = "UNCLOSED_BRACE";
|
|
59
60
|
ParseErrorCode[ParseErrorCode["UNCLOSED_STRING"] = 9002] = "UNCLOSED_STRING";
|
|
@@ -1433,7 +1434,7 @@ const SAFE_HANDLER = {
|
|
|
1433
1434
|
has: () => true,
|
|
1434
1435
|
get: (t, k) => {
|
|
1435
1436
|
if (typeof k === 'symbol') return t[k];
|
|
1436
|
-
return
|
|
1437
|
+
return t[k];
|
|
1437
1438
|
}
|
|
1438
1439
|
};
|
|
1439
1440
|
const safe = data => new Proxy(data, SAFE_HANDLER);
|
|
@@ -1448,9 +1449,6 @@ class Interpreter {
|
|
|
1448
1449
|
constructor(tokenizer) {
|
|
1449
1450
|
this.tokenizer = tokenizer;
|
|
1450
1451
|
}
|
|
1451
|
-
isLogicNode(node) {
|
|
1452
|
-
return node && node.__logicType & LogicalBit;
|
|
1453
|
-
}
|
|
1454
1452
|
rootComponent = null;
|
|
1455
1453
|
program(root, componentNode, before, ctxProvider) {
|
|
1456
1454
|
this.rootComponent = componentNode;
|
|
@@ -1469,7 +1467,7 @@ class Interpreter {
|
|
|
1469
1467
|
stack.push({
|
|
1470
1468
|
node: ctxProvider,
|
|
1471
1469
|
prev: null
|
|
1472
|
-
}, (ctxProvider.__logicType
|
|
1470
|
+
}, (ctxProvider.__logicType && ctxProvider.effect ? NodeSort.EffectNode : 0) | NodeSort.CtxProvider);
|
|
1473
1471
|
}
|
|
1474
1472
|
const rootLen = stack.length;
|
|
1475
1473
|
const ctx = this.ctx = {
|
|
@@ -1492,18 +1490,24 @@ class Interpreter {
|
|
|
1492
1490
|
const token = this.tokenizer.token;
|
|
1493
1491
|
if (token.type & TokenType.Indent) {
|
|
1494
1492
|
this.tokenizer.nextToken();
|
|
1495
|
-
const
|
|
1493
|
+
const isEffectNode = ctx.current && ctx.current.__logicType && ctx.current.effect;
|
|
1496
1494
|
stack.push({
|
|
1497
1495
|
node: ctx.current,
|
|
1498
1496
|
prev: ctx.prevSibling
|
|
1499
|
-
}, !ctx.current.__logicType ? NodeSort.Real : (ctx.current.__logicType &
|
|
1497
|
+
}, !ctx.current.__logicType ? NodeSort.Real : (isEffectNode ? NodeSort.EffectNode : 0) | (ctx.current.__logicType & TokenizerSwitcherBit ? NodeSort.TokenizerSwitcher : 0) | (ctx.current.__logicType & ContextBit ? NodeSort.Context : 0) | (ctx.current.__logicType === FakeType.Component ? NodeSort.Component : 0) | (ctx.current.__logicType === FakeType.Tp ? NodeSort.Real : 0) | (ctx.current.__logicType & CtxProviderBit ? NodeSort.CtxProvider : 0));
|
|
1500
1498
|
if (ctx.current.__logicType) {
|
|
1501
1499
|
this.beforeLogicIndent?.(ctx.current);
|
|
1502
|
-
if (
|
|
1500
|
+
if (isEffectNode) {
|
|
1503
1501
|
setPulling(ctx.current.effect);
|
|
1504
1502
|
if (ctx.current.__logicType & FakeType.ForItem) {
|
|
1505
1503
|
ctx.prevSibling = ctx.current.realBefore;
|
|
1506
1504
|
}
|
|
1505
|
+
if (ctx.current.__logicType & FakeType.Tp) {
|
|
1506
|
+
runWithPulling(() => {
|
|
1507
|
+
ctx.realParent = ctx.current.tpData.node;
|
|
1508
|
+
}, null);
|
|
1509
|
+
ctx.prevSibling = ctx.current.contentBefore;
|
|
1510
|
+
}
|
|
1507
1511
|
}
|
|
1508
1512
|
} else {
|
|
1509
1513
|
if (ctx.current) {
|
|
@@ -1537,16 +1541,24 @@ class Interpreter {
|
|
|
1537
1541
|
sort = _stack$pop2[1];
|
|
1538
1542
|
if (!parent.__logicType) {
|
|
1539
1543
|
const prevSameType = stack.peekByType(NodeSort.Real);
|
|
1540
|
-
|
|
1544
|
+
const sameNode = prevSameType?.node;
|
|
1545
|
+
if (sameNode) {
|
|
1546
|
+
ctx.realParent = sameNode.__logicType === FakeType.Tp ? runWithPulling(() => sameNode.tpData.node, null) : sameNode;
|
|
1547
|
+
} else {
|
|
1548
|
+
ctx.realParent = root;
|
|
1549
|
+
}
|
|
1541
1550
|
} else {
|
|
1542
|
-
if (sort & NodeSort.
|
|
1543
|
-
const parentLogic = stack.peekByType(NodeSort.
|
|
1551
|
+
if (sort & NodeSort.EffectNode) {
|
|
1552
|
+
const parentLogic = stack.peekByType(NodeSort.EffectNode)?.node;
|
|
1544
1553
|
if (parentLogic) {
|
|
1545
1554
|
setPulling(parentLogic.effect);
|
|
1546
1555
|
} else {
|
|
1547
1556
|
setPulling(rootPulling);
|
|
1548
1557
|
}
|
|
1549
1558
|
}
|
|
1559
|
+
if (parent.__logicType === FakeType.Tp) {
|
|
1560
|
+
ctx.realParent = parent.realParent;
|
|
1561
|
+
}
|
|
1550
1562
|
if (sort & NodeSort.TokenizerSwitcher) {
|
|
1551
1563
|
const switcher = stack.peekByType(NodeSort.TokenizerSwitcher)?.node;
|
|
1552
1564
|
if (parent.resumeSnapshot) {
|
|
@@ -1583,13 +1595,17 @@ class Interpreter {
|
|
|
1583
1595
|
}
|
|
1584
1596
|
return componentNode;
|
|
1585
1597
|
}
|
|
1586
|
-
insertAnchor(name = 'anchor', isBefore = false) {
|
|
1598
|
+
insertAnchor(node, name = 'anchor', isBefore = false) {
|
|
1587
1599
|
const _this$ctx = this.ctx,
|
|
1588
1600
|
realParent = _this$ctx.realParent,
|
|
1589
1601
|
prevSibling = _this$ctx.prevSibling,
|
|
1590
1602
|
stack = _this$ctx.stack,
|
|
1591
1603
|
before = _this$ctx.before;
|
|
1604
|
+
_this$ctx.current;
|
|
1592
1605
|
const afterAnchor = this.createAnchor(name, isBefore);
|
|
1606
|
+
if (!isBefore) {
|
|
1607
|
+
this.anchorRefBack(afterAnchor, node);
|
|
1608
|
+
}
|
|
1593
1609
|
this.ctx.prevSibling = stack.length === 2 && !prevSibling ? before : prevSibling;
|
|
1594
1610
|
this.handleInsert(realParent, afterAnchor, prevSibling);
|
|
1595
1611
|
return afterAnchor;
|
|
@@ -1634,6 +1650,8 @@ class Interpreter {
|
|
|
1634
1650
|
return this.condDeclaration(ctx);
|
|
1635
1651
|
} else if (value === 'context') {
|
|
1636
1652
|
_node = this.createContextNode();
|
|
1653
|
+
} else if (value === 'tp') {
|
|
1654
|
+
return this.createTpNode();
|
|
1637
1655
|
} else if (value === 'for') {
|
|
1638
1656
|
return this.forDeclaration();
|
|
1639
1657
|
} else if (hookType) {
|
|
@@ -1665,7 +1683,7 @@ class Interpreter {
|
|
|
1665
1683
|
return _node;
|
|
1666
1684
|
}
|
|
1667
1685
|
dynamicDeclaration(pData, value, ctx) {
|
|
1668
|
-
const valueIsMapKey =
|
|
1686
|
+
const valueIsMapKey = Boolean(getProxyHasKey(pData, value));
|
|
1669
1687
|
let node = {
|
|
1670
1688
|
__logicType: null,
|
|
1671
1689
|
realParent: null,
|
|
@@ -1677,7 +1695,7 @@ class Interpreter {
|
|
|
1677
1695
|
parentDataProvider: ctx.stack.peekByType(NodeSort.CtxProvider)?.node
|
|
1678
1696
|
};
|
|
1679
1697
|
let isUpdate = false;
|
|
1680
|
-
node.realAfter = this.insertAnchor(`dynamic-after`);
|
|
1698
|
+
node.realAfter = this.insertAnchor(node, `dynamic-after`);
|
|
1681
1699
|
node.effect = this.effect(({
|
|
1682
1700
|
old,
|
|
1683
1701
|
val
|
|
@@ -1749,10 +1767,110 @@ class Interpreter {
|
|
|
1749
1767
|
this.removeLogicNode(node);
|
|
1750
1768
|
}
|
|
1751
1769
|
};
|
|
1752
|
-
}, [() => {
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1770
|
+
}, [valueIsMapKey ? () => pData[value] : this.getFn(pData, value)], {
|
|
1771
|
+
type: 'render'
|
|
1772
|
+
});
|
|
1773
|
+
return node;
|
|
1774
|
+
}
|
|
1775
|
+
createTpNode() {
|
|
1776
|
+
const child = deepSignal({}, getPulling());
|
|
1777
|
+
const node = {
|
|
1778
|
+
__logicType: FakeType.Tp,
|
|
1779
|
+
data: this.getData(),
|
|
1780
|
+
realParent: null,
|
|
1781
|
+
realBefore: null,
|
|
1782
|
+
realAfter: null,
|
|
1783
|
+
contentBefore: null,
|
|
1784
|
+
contentAfter: null,
|
|
1785
|
+
effect: null,
|
|
1786
|
+
snapshot: null,
|
|
1787
|
+
tpData: child,
|
|
1788
|
+
owner: this.ctx.stack.peekByType(NodeSort.TokenizerSwitcher)?.node
|
|
1789
|
+
};
|
|
1790
|
+
this.onePropParsed = createStoreOnePropParsed(child);
|
|
1791
|
+
this.tokenizer.nextToken();
|
|
1792
|
+
this.headerLineAndExtensions(node);
|
|
1793
|
+
this.onePropParsed = this.oneRealPropParsed;
|
|
1794
|
+
node.realAfter = this.insertAnchor(node, 'tp-after');
|
|
1795
|
+
const before = node.contentBefore = this.createAnchor('tp-content-before', true);
|
|
1796
|
+
const after = node.contentAfter = this.createAnchor('tp-content-after', true);
|
|
1797
|
+
let firstRender = true;
|
|
1798
|
+
let scope = new Scope(() => {});
|
|
1799
|
+
scope.scope = null;
|
|
1800
|
+
runWithPulling(() => {
|
|
1801
|
+
scope.get();
|
|
1802
|
+
}, null);
|
|
1803
|
+
node.effect = scope;
|
|
1804
|
+
this.effect(({
|
|
1805
|
+
old: oldDom,
|
|
1806
|
+
val: dom
|
|
1807
|
+
}) => {
|
|
1808
|
+
const removeTpChild = () => {
|
|
1809
|
+
if (oldDom) {
|
|
1810
|
+
let point = before;
|
|
1811
|
+
do {
|
|
1812
|
+
const next = this.nextSib(point);
|
|
1813
|
+
this.remove(point, oldDom, null);
|
|
1814
|
+
if (point === after) break;
|
|
1815
|
+
point = next;
|
|
1816
|
+
} while (true);
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
1819
|
+
if (firstRender) {
|
|
1820
|
+
if (dom) {
|
|
1821
|
+
this.handleInsert(dom, after, null);
|
|
1822
|
+
this.handleInsert(dom, before, null);
|
|
1823
|
+
} else {
|
|
1824
|
+
if (this.tokenizer.token.type === TokenType.Indent) {
|
|
1825
|
+
const dentLen = this.tokenizer.dentStack[this.tokenizer.dentStack.length - 2] ?? 0;
|
|
1826
|
+
this.tokenizer.skip(dentLen);
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
} else {
|
|
1830
|
+
if (dom) {
|
|
1831
|
+
if (oldDom) {
|
|
1832
|
+
let point = before,
|
|
1833
|
+
lastInsert = null;
|
|
1834
|
+
do {
|
|
1835
|
+
const next = this.nextSib(point);
|
|
1836
|
+
const fakeNode = point[FakeNode];
|
|
1837
|
+
if (fakeNode) {
|
|
1838
|
+
fakeNode.realParent = dom;
|
|
1839
|
+
}
|
|
1840
|
+
this.handleInsert(dom, point, lastInsert);
|
|
1841
|
+
if (point === after) break;
|
|
1842
|
+
lastInsert = point;
|
|
1843
|
+
point = next;
|
|
1844
|
+
} while (true);
|
|
1845
|
+
} else {
|
|
1846
|
+
this.handleInsert(dom, after, null);
|
|
1847
|
+
this.handleInsert(dom, before, null);
|
|
1848
|
+
runWithPulling(() => {
|
|
1849
|
+
this.tokenizer = node.owner.tokenizer;
|
|
1850
|
+
this.tokenizer.resume(node.snapshot);
|
|
1851
|
+
this.tokenizer.useDedentAsEof = false;
|
|
1852
|
+
this.program(dom, node.owner, before, node);
|
|
1853
|
+
}, scope);
|
|
1854
|
+
}
|
|
1855
|
+
} else {
|
|
1856
|
+
removeTpChild();
|
|
1857
|
+
scope.dispose();
|
|
1858
|
+
scope = new Scope(() => {});
|
|
1859
|
+
scope.scope = null;
|
|
1860
|
+
runWithPulling(() => {
|
|
1861
|
+
scope.get();
|
|
1862
|
+
}, null);
|
|
1863
|
+
node.effect = scope;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
firstRender = false;
|
|
1867
|
+
return isDestroy => {
|
|
1868
|
+
if (isDestroy) {
|
|
1869
|
+
removeTpChild();
|
|
1870
|
+
scope.dispose();
|
|
1871
|
+
}
|
|
1872
|
+
};
|
|
1873
|
+
}, [() => child.node], {
|
|
1756
1874
|
type: 'render'
|
|
1757
1875
|
});
|
|
1758
1876
|
return node;
|
|
@@ -1761,7 +1879,7 @@ class Interpreter {
|
|
|
1761
1879
|
const child = deepSignal({}, getPulling());
|
|
1762
1880
|
const parentContext = this.ctx.stack.peekByType(NodeSort.Context)?.node?.context;
|
|
1763
1881
|
if (parentContext) {
|
|
1764
|
-
|
|
1882
|
+
backupSignal(child, parentContext);
|
|
1765
1883
|
}
|
|
1766
1884
|
this.onePropParsed = createStoreOnePropParsed(child);
|
|
1767
1885
|
const node = {
|
|
@@ -1771,7 +1889,7 @@ class Interpreter {
|
|
|
1771
1889
|
realBefore: null,
|
|
1772
1890
|
realAfter: null
|
|
1773
1891
|
};
|
|
1774
|
-
node.realAfter = this.insertAnchor('context-after');
|
|
1892
|
+
node.realAfter = this.insertAnchor(node, 'context-after');
|
|
1775
1893
|
return node;
|
|
1776
1894
|
}
|
|
1777
1895
|
formatForCollection(collection) {
|
|
@@ -1864,13 +1982,12 @@ class Interpreter {
|
|
|
1864
1982
|
const rawGetKey = new Function('data', `with(data){return (${keyExp})}`);
|
|
1865
1983
|
forNode.getKey = data => rawGetKey(safe(data));
|
|
1866
1984
|
}
|
|
1867
|
-
window['for1'] = forNode;
|
|
1868
1985
|
const data = this.getData();
|
|
1869
1986
|
const cells = data[Keys.Meta].cells;
|
|
1870
1987
|
const hasArrExpKey = Reflect.has(data[Keys.Raw], arrExp);
|
|
1871
1988
|
const arrSignal = hasArrExpKey ? (data[arrExp], cells.get(arrExp)) : new Computed(this.getFn(data, arrExp));
|
|
1872
1989
|
forNode.arrSignal = arrSignal;
|
|
1873
|
-
forNode.realAfter = this.insertAnchor('for-after');
|
|
1990
|
+
forNode.realAfter = this.insertAnchor(forNode, 'for-after');
|
|
1874
1991
|
const _forNode$snapshot = forNode.snapshot;
|
|
1875
1992
|
_forNode$snapshot.dentStack;
|
|
1876
1993
|
_forNode$snapshot.isFirstToken;
|
|
@@ -1893,8 +2010,8 @@ class Interpreter {
|
|
|
1893
2010
|
const len = arr.length;
|
|
1894
2011
|
for (let i = len; i--;) {
|
|
1895
2012
|
const item = this.createForItem(forNode, i, data);
|
|
1896
|
-
item.realAfter = this.insertAnchor('for-item-after');
|
|
1897
|
-
item.realBefore = this.insertAnchor('for-item-before', true);
|
|
2013
|
+
item.realAfter = this.insertAnchor(item, 'for-item-after');
|
|
2014
|
+
item.realBefore = this.insertAnchor(item, 'for-item-before', true);
|
|
1898
2015
|
item.realParent = forNode.realParent;
|
|
1899
2016
|
children[i] = item;
|
|
1900
2017
|
}
|
|
@@ -2056,10 +2173,14 @@ class Interpreter {
|
|
|
2056
2173
|
}, ScheduleType.Render);
|
|
2057
2174
|
return forNode.children[0] || forNode;
|
|
2058
2175
|
}
|
|
2176
|
+
anchorRefBack(anchor, node) {
|
|
2177
|
+
anchor[FakeNode] = node;
|
|
2178
|
+
}
|
|
2059
2179
|
insertForItem(forNode, i, parentData, newChildren, before, snapshotForUpdate) {
|
|
2060
2180
|
const item = this.createForItem(forNode, i, parentData);
|
|
2061
2181
|
newChildren[i] = item;
|
|
2062
2182
|
let realAfter = this.createAnchor('for-item-after');
|
|
2183
|
+
this.anchorRefBack(realAfter, item);
|
|
2063
2184
|
this.handleInsert(forNode.realParent, realAfter, before);
|
|
2064
2185
|
let realBefore = this.createAnchor('for-item-before', true);
|
|
2065
2186
|
this.handleInsert(forNode.realParent, realBefore, before);
|
|
@@ -2146,7 +2267,7 @@ class Interpreter {
|
|
|
2146
2267
|
cells.set(name, new Computed(() => computedData.get()[name]));
|
|
2147
2268
|
}
|
|
2148
2269
|
}
|
|
2149
|
-
|
|
2270
|
+
backupSignal(data, parentData);
|
|
2150
2271
|
return data;
|
|
2151
2272
|
}
|
|
2152
2273
|
getData() {
|
|
@@ -2187,7 +2308,7 @@ class Interpreter {
|
|
|
2187
2308
|
} else if (ComponentOrRender instanceof InlineFragment) {
|
|
2188
2309
|
const conf = ComponentOrRender;
|
|
2189
2310
|
child = deepSignal({}, getPulling(), true);
|
|
2190
|
-
|
|
2311
|
+
backupSignal(child, conf.data);
|
|
2191
2312
|
tokenizer = conf.tokenizer;
|
|
2192
2313
|
fragmentSnapshot = conf.snapshot;
|
|
2193
2314
|
__logicType = FakeType.Fragment;
|
|
@@ -2197,7 +2318,7 @@ class Interpreter {
|
|
|
2197
2318
|
const boundStore = render.boundStore;
|
|
2198
2319
|
child = deepSignal({}, getPulling(), true);
|
|
2199
2320
|
if (boundStore) {
|
|
2200
|
-
|
|
2321
|
+
backupSignal(child, boundStore);
|
|
2201
2322
|
}
|
|
2202
2323
|
tokenizer = render(true);
|
|
2203
2324
|
__logicType = FakeType.Fragment;
|
|
@@ -2230,7 +2351,7 @@ class Interpreter {
|
|
|
2230
2351
|
resumeSnapshot
|
|
2231
2352
|
};
|
|
2232
2353
|
this.onePropParsed = onePropParsed;
|
|
2233
|
-
node.realAfter = this.insertAnchor('component-after');
|
|
2354
|
+
node.realAfter = this.insertAnchor(node, 'component-after');
|
|
2234
2355
|
return node;
|
|
2235
2356
|
}
|
|
2236
2357
|
getFn(data, expression) {
|
|
@@ -2325,7 +2446,7 @@ class Interpreter {
|
|
|
2325
2446
|
break;
|
|
2326
2447
|
}
|
|
2327
2448
|
ifNode.condition = signal;
|
|
2328
|
-
ifNode.realAfter = this.insertAnchor(`${keyWord.value}-after`);
|
|
2449
|
+
ifNode.realAfter = this.insertAnchor(ifNode, `${keyWord.value}-after`);
|
|
2329
2450
|
const ef = this.effect(({
|
|
2330
2451
|
val
|
|
2331
2452
|
}) => {
|
|
@@ -2368,10 +2489,11 @@ class Interpreter {
|
|
|
2368
2489
|
const tokenizer = this.tokenizer;
|
|
2369
2490
|
do {
|
|
2370
2491
|
const isComponent = _node.__logicType & TokenizerSwitcherBit;
|
|
2492
|
+
const isTp = _node.__logicType === FakeType.Tp;
|
|
2371
2493
|
let snapshot, dentLen;
|
|
2372
2494
|
const data = this.getData();
|
|
2373
2495
|
const unHandledKey = this.attributeList(_node, data);
|
|
2374
|
-
if (isComponent) {
|
|
2496
|
+
if (isComponent || isTp) {
|
|
2375
2497
|
snapshot = tokenizer.snapshot(undefined, -1);
|
|
2376
2498
|
dentLen = tokenizer.dentStack[tokenizer.dentStack.length - 1];
|
|
2377
2499
|
}
|
|
@@ -2383,6 +2505,9 @@ class Interpreter {
|
|
|
2383
2505
|
if ((tokenizer.token.type & TokenType.Pipe) === 0) {
|
|
2384
2506
|
break;
|
|
2385
2507
|
}
|
|
2508
|
+
} else if (isTp) {
|
|
2509
|
+
_node.snapshot = snapshot;
|
|
2510
|
+
break;
|
|
2386
2511
|
} else {
|
|
2387
2512
|
break;
|
|
2388
2513
|
}
|
|
@@ -2441,7 +2566,7 @@ class Interpreter {
|
|
|
2441
2566
|
prevKeys.delete(k);
|
|
2442
2567
|
if (isComponent) {
|
|
2443
2568
|
const savedK = savedDefaults.has(k);
|
|
2444
|
-
if (!savedK &&
|
|
2569
|
+
if (!savedK && hasOwn(rawTarget, k)) {
|
|
2445
2570
|
savedDefaults.set(k, rawTarget[k]);
|
|
2446
2571
|
}
|
|
2447
2572
|
const val = props[k];
|
|
@@ -2474,7 +2599,7 @@ class Interpreter {
|
|
|
2474
2599
|
}).get();
|
|
2475
2600
|
}
|
|
2476
2601
|
} else if (hookType === 'dynamic') {
|
|
2477
|
-
const valueIsMapKey =
|
|
2602
|
+
const valueIsMapKey = Boolean(getProxyHasKey(data, value));
|
|
2478
2603
|
const fn = isFn ? rawVal : valueIsMapKey ? value : this.getFn(data, value);
|
|
2479
2604
|
this.onePropParsed(data, _node, key, fn, valueIsMapKey, isFn, hookI);
|
|
2480
2605
|
} else if (hookType === 'static') {
|