bobe 0.0.61 → 0.0.63
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 +40 -20
- package/dist/bobe.cjs.js.map +1 -1
- package/dist/bobe.compiler.cjs.js +40 -20
- package/dist/bobe.compiler.cjs.js.map +1 -1
- package/dist/bobe.compiler.esm.js +42 -22
- package/dist/bobe.compiler.esm.js.map +1 -1
- package/dist/bobe.esm.js +42 -22
- package/dist/bobe.esm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.umd.js +40 -20
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/bobe.cjs.js
CHANGED
|
@@ -1435,7 +1435,7 @@ const SAFE_HANDLER = {
|
|
|
1435
1435
|
has: () => true,
|
|
1436
1436
|
get: (t, k) => {
|
|
1437
1437
|
if (typeof k === 'symbol') return t[k];
|
|
1438
|
-
return
|
|
1438
|
+
return t[k];
|
|
1439
1439
|
}
|
|
1440
1440
|
};
|
|
1441
1441
|
const safe = data => new Proxy(data, SAFE_HANDLER);
|
|
@@ -1495,7 +1495,7 @@ class Interpreter {
|
|
|
1495
1495
|
stack.push({
|
|
1496
1496
|
node: ctx.current,
|
|
1497
1497
|
prev: ctx.prevSibling
|
|
1498
|
-
}, !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 & CtxProviderBit ? NodeSort.CtxProvider : 0));
|
|
1498
|
+
}, !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));
|
|
1499
1499
|
if (ctx.current.__logicType) {
|
|
1500
1500
|
this.beforeLogicIndent?.(ctx.current);
|
|
1501
1501
|
if (isEffectNode) {
|
|
@@ -1504,7 +1504,9 @@ class Interpreter {
|
|
|
1504
1504
|
ctx.prevSibling = ctx.current.realBefore;
|
|
1505
1505
|
}
|
|
1506
1506
|
if (ctx.current.__logicType & FakeType.Tp) {
|
|
1507
|
-
|
|
1507
|
+
aoye.runWithPulling(() => {
|
|
1508
|
+
ctx.realParent = ctx.current.tpData.node;
|
|
1509
|
+
}, null);
|
|
1508
1510
|
ctx.prevSibling = ctx.current.contentBefore;
|
|
1509
1511
|
}
|
|
1510
1512
|
}
|
|
@@ -1540,7 +1542,12 @@ class Interpreter {
|
|
|
1540
1542
|
sort = _stack$pop2[1];
|
|
1541
1543
|
if (!parent.__logicType) {
|
|
1542
1544
|
const prevSameType = stack.peekByType(NodeSort.Real);
|
|
1543
|
-
|
|
1545
|
+
const sameNode = prevSameType?.node;
|
|
1546
|
+
if (sameNode) {
|
|
1547
|
+
ctx.realParent = sameNode.__logicType === FakeType.Tp ? aoye.runWithPulling(() => sameNode.tpData.node, null) : sameNode;
|
|
1548
|
+
} else {
|
|
1549
|
+
ctx.realParent = root;
|
|
1550
|
+
}
|
|
1544
1551
|
} else {
|
|
1545
1552
|
if (sort & NodeSort.EffectNode) {
|
|
1546
1553
|
const parentLogic = stack.peekByType(NodeSort.EffectNode)?.node;
|
|
@@ -1677,7 +1684,7 @@ class Interpreter {
|
|
|
1677
1684
|
return _node;
|
|
1678
1685
|
}
|
|
1679
1686
|
dynamicDeclaration(pData, value, ctx) {
|
|
1680
|
-
const valueIsMapKey =
|
|
1687
|
+
const valueIsMapKey = Boolean(aoye.getProxyHasKey(pData, value));
|
|
1681
1688
|
let node = {
|
|
1682
1689
|
__logicType: null,
|
|
1683
1690
|
realParent: null,
|
|
@@ -1761,10 +1768,7 @@ class Interpreter {
|
|
|
1761
1768
|
this.removeLogicNode(node);
|
|
1762
1769
|
}
|
|
1763
1770
|
};
|
|
1764
|
-
}, [() => {
|
|
1765
|
-
const val = valueIsMapKey ? pData[value] : this.getFn(pData, value)();
|
|
1766
|
-
return val;
|
|
1767
|
-
}], {
|
|
1771
|
+
}, [valueIsMapKey ? () => pData[value] : this.getFn(pData, value)], {
|
|
1768
1772
|
type: 'render'
|
|
1769
1773
|
});
|
|
1770
1774
|
return node;
|
|
@@ -1792,7 +1796,13 @@ class Interpreter {
|
|
|
1792
1796
|
const before = node.contentBefore = this.createAnchor('tp-content-before', true);
|
|
1793
1797
|
const after = node.contentAfter = this.createAnchor('tp-content-after', true);
|
|
1794
1798
|
let firstRender = true;
|
|
1795
|
-
|
|
1799
|
+
let scope = new aoye.Scope(() => {});
|
|
1800
|
+
scope.scope = null;
|
|
1801
|
+
aoye.runWithPulling(() => {
|
|
1802
|
+
scope.get();
|
|
1803
|
+
}, null);
|
|
1804
|
+
node.effect = scope;
|
|
1805
|
+
this.effect(({
|
|
1796
1806
|
old: oldDom,
|
|
1797
1807
|
val: dom
|
|
1798
1808
|
}) => {
|
|
@@ -1836,19 +1846,29 @@ class Interpreter {
|
|
|
1836
1846
|
} else {
|
|
1837
1847
|
this.handleInsert(dom, after, null);
|
|
1838
1848
|
this.handleInsert(dom, before, null);
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1849
|
+
aoye.runWithPulling(() => {
|
|
1850
|
+
this.tokenizer = node.owner.tokenizer;
|
|
1851
|
+
this.tokenizer.resume(node.snapshot);
|
|
1852
|
+
this.tokenizer.useDedentAsEof = false;
|
|
1853
|
+
this.program(dom, node.owner, before, node);
|
|
1854
|
+
}, scope);
|
|
1843
1855
|
}
|
|
1844
1856
|
} else {
|
|
1845
1857
|
removeTpChild();
|
|
1858
|
+
scope.dispose();
|
|
1859
|
+
scope = new aoye.Scope(() => {});
|
|
1860
|
+
scope.scope = null;
|
|
1861
|
+
aoye.runWithPulling(() => {
|
|
1862
|
+
scope.get();
|
|
1863
|
+
}, null);
|
|
1864
|
+
node.effect = scope;
|
|
1846
1865
|
}
|
|
1847
1866
|
}
|
|
1848
1867
|
firstRender = false;
|
|
1849
1868
|
return isDestroy => {
|
|
1850
1869
|
if (isDestroy) {
|
|
1851
1870
|
removeTpChild();
|
|
1871
|
+
scope.dispose();
|
|
1852
1872
|
}
|
|
1853
1873
|
};
|
|
1854
1874
|
}, [() => child.node], {
|
|
@@ -1860,7 +1880,7 @@ class Interpreter {
|
|
|
1860
1880
|
const child = aoye.deepSignal({}, aoye.getPulling());
|
|
1861
1881
|
const parentContext = this.ctx.stack.peekByType(NodeSort.Context)?.node?.context;
|
|
1862
1882
|
if (parentContext) {
|
|
1863
|
-
|
|
1883
|
+
aoye.backupSignal(child, parentContext);
|
|
1864
1884
|
}
|
|
1865
1885
|
this.onePropParsed = createStoreOnePropParsed(child);
|
|
1866
1886
|
const node = {
|
|
@@ -2248,7 +2268,7 @@ class Interpreter {
|
|
|
2248
2268
|
cells.set(name, new aoye.Computed(() => computedData.get()[name]));
|
|
2249
2269
|
}
|
|
2250
2270
|
}
|
|
2251
|
-
|
|
2271
|
+
aoye.backupSignal(data, parentData);
|
|
2252
2272
|
return data;
|
|
2253
2273
|
}
|
|
2254
2274
|
getData() {
|
|
@@ -2289,7 +2309,7 @@ class Interpreter {
|
|
|
2289
2309
|
} else if (ComponentOrRender instanceof InlineFragment) {
|
|
2290
2310
|
const conf = ComponentOrRender;
|
|
2291
2311
|
child = aoye.deepSignal({}, aoye.getPulling(), true);
|
|
2292
|
-
|
|
2312
|
+
aoye.backupSignal(child, conf.data);
|
|
2293
2313
|
tokenizer = conf.tokenizer;
|
|
2294
2314
|
fragmentSnapshot = conf.snapshot;
|
|
2295
2315
|
__logicType = FakeType.Fragment;
|
|
@@ -2299,7 +2319,7 @@ class Interpreter {
|
|
|
2299
2319
|
const boundStore = render.boundStore;
|
|
2300
2320
|
child = aoye.deepSignal({}, aoye.getPulling(), true);
|
|
2301
2321
|
if (boundStore) {
|
|
2302
|
-
|
|
2322
|
+
aoye.backupSignal(child, boundStore);
|
|
2303
2323
|
}
|
|
2304
2324
|
tokenizer = render(true);
|
|
2305
2325
|
__logicType = FakeType.Fragment;
|
|
@@ -2547,7 +2567,7 @@ class Interpreter {
|
|
|
2547
2567
|
prevKeys.delete(k);
|
|
2548
2568
|
if (isComponent) {
|
|
2549
2569
|
const savedK = savedDefaults.has(k);
|
|
2550
|
-
if (!savedK &&
|
|
2570
|
+
if (!savedK && bobeShared.hasOwn(rawTarget, k)) {
|
|
2551
2571
|
savedDefaults.set(k, rawTarget[k]);
|
|
2552
2572
|
}
|
|
2553
2573
|
const val = props[k];
|
|
@@ -2580,7 +2600,7 @@ class Interpreter {
|
|
|
2580
2600
|
}).get();
|
|
2581
2601
|
}
|
|
2582
2602
|
} else if (hookType === 'dynamic') {
|
|
2583
|
-
const valueIsMapKey =
|
|
2603
|
+
const valueIsMapKey = Boolean(aoye.getProxyHasKey(data, value));
|
|
2584
2604
|
const fn = isFn ? rawVal : valueIsMapKey ? value : this.getFn(data, value);
|
|
2585
2605
|
this.onePropParsed(data, _node, key, fn, valueIsMapKey, isFn, hookI);
|
|
2586
2606
|
} else if (hookType === 'static') {
|