bobe 0.0.59 → 0.0.60
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 +15 -5
- package/dist/bobe.cjs.js.map +1 -1
- package/dist/bobe.compiler.cjs.js +15 -5
- package/dist/bobe.compiler.cjs.js.map +1 -1
- package/dist/bobe.compiler.esm.js +15 -5
- package/dist/bobe.compiler.esm.js.map +1 -1
- package/dist/bobe.esm.js +15 -5
- package/dist/bobe.esm.js.map +1 -1
- package/dist/index.umd.js +15 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
|
@@ -1457,6 +1457,14 @@ class InlineFragment {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
const isUI = fn => typeof fn === 'function' && fn.__BOBE_IS_UI;
|
|
1459
1459
|
const isRenderAble = val => aoye.isStore(val) || isUI(val) || val instanceof InlineFragment;
|
|
1460
|
+
const SAFE_HANDLER = {
|
|
1461
|
+
has: () => true,
|
|
1462
|
+
get: (t, k) => {
|
|
1463
|
+
if (typeof k === 'symbol') return t[k];
|
|
1464
|
+
return k in t ? t[k] : undefined;
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
const safe = data => new Proxy(data, SAFE_HANDLER);
|
|
1460
1468
|
|
|
1461
1469
|
const KEY_INDEX = '__BOBE_KEY_INDEX';
|
|
1462
1470
|
let _ctxStack;
|
|
@@ -1693,7 +1701,7 @@ class Interpreter {
|
|
|
1693
1701
|
effect: null,
|
|
1694
1702
|
textNode: null,
|
|
1695
1703
|
owner: ctx.stack.peekByType(NodeSort.TokenizerSwitcher)?.node,
|
|
1696
|
-
snapshot: this.tokenizer.snapshot(['dentStack']),
|
|
1704
|
+
snapshot: this.tokenizer.snapshot(['dentStack', 'isFirstToken']),
|
|
1697
1705
|
parentDataProvider: ctx.stack.peekByType(NodeSort.CtxProvider)?.node
|
|
1698
1706
|
};
|
|
1699
1707
|
let isUpdate = false;
|
|
@@ -1706,7 +1714,7 @@ class Interpreter {
|
|
|
1706
1714
|
oldTextNode = node.textNode;
|
|
1707
1715
|
if (oldLogicType) {
|
|
1708
1716
|
this.removeLogicNode(node);
|
|
1709
|
-
bobeShared.pickInPlace(node, ['realParent', 'realBefore', 'realAfter'
|
|
1717
|
+
bobeShared.pickInPlace(node, ['realParent', 'realBefore', 'realAfter', 'owner', 'snapshot', 'parentDataProvider']);
|
|
1710
1718
|
}
|
|
1711
1719
|
if (isRenderAble(val)) {
|
|
1712
1720
|
if (oldTextNode) {
|
|
@@ -1736,7 +1744,7 @@ class Interpreter {
|
|
|
1736
1744
|
}
|
|
1737
1745
|
if (isUpdate) {
|
|
1738
1746
|
this.tokenizer.useDedentAsEof = false;
|
|
1739
|
-
this.program(node.realParent, node
|
|
1747
|
+
this.program(node.realParent, node, node.realBefore);
|
|
1740
1748
|
} else {
|
|
1741
1749
|
this.tokenizer.useDedentAsEof = true;
|
|
1742
1750
|
this.tokenizer.initIndentWhenUseDedentAsEof();
|
|
@@ -1881,7 +1889,8 @@ class Interpreter {
|
|
|
1881
1889
|
i: 0
|
|
1882
1890
|
};
|
|
1883
1891
|
if (keyExp) {
|
|
1884
|
-
|
|
1892
|
+
const rawGetKey = new Function('data', `with(data){return (${keyExp})}`);
|
|
1893
|
+
forNode.getKey = data => rawGetKey(safe(data));
|
|
1885
1894
|
}
|
|
1886
1895
|
window['for1'] = forNode;
|
|
1887
1896
|
const data = this.getData();
|
|
@@ -2253,7 +2262,7 @@ class Interpreter {
|
|
|
2253
2262
|
return node;
|
|
2254
2263
|
}
|
|
2255
2264
|
getFn(data, expression) {
|
|
2256
|
-
return new Function('data', `
|
|
2265
|
+
return new Function('data', `with(data){return (${expression})}`).bind(undefined, safe(data));
|
|
2257
2266
|
}
|
|
2258
2267
|
getAssignFn(data, expression) {
|
|
2259
2268
|
const valueId = `value_bobe_${bobeShared.date32()}`;
|
|
@@ -2603,6 +2612,7 @@ function bobe(fragments, ...values) {
|
|
|
2603
2612
|
return tokenizer;
|
|
2604
2613
|
};
|
|
2605
2614
|
ui.boundStore = aoye.Store.Current;
|
|
2615
|
+
ui[aoye.Keys.ProxyFreeObject] = true;
|
|
2606
2616
|
ui.__BOBE_IS_UI = true;
|
|
2607
2617
|
return ui;
|
|
2608
2618
|
}
|