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
package/dist/bobe.esm.js
CHANGED
|
@@ -1429,6 +1429,14 @@ class InlineFragment {
|
|
|
1429
1429
|
}
|
|
1430
1430
|
const isUI = fn => typeof fn === 'function' && fn.__BOBE_IS_UI;
|
|
1431
1431
|
const isRenderAble = val => isStore(val) || isUI(val) || val instanceof InlineFragment;
|
|
1432
|
+
const SAFE_HANDLER = {
|
|
1433
|
+
has: () => true,
|
|
1434
|
+
get: (t, k) => {
|
|
1435
|
+
if (typeof k === 'symbol') return t[k];
|
|
1436
|
+
return k in t ? t[k] : undefined;
|
|
1437
|
+
}
|
|
1438
|
+
};
|
|
1439
|
+
const safe = data => new Proxy(data, SAFE_HANDLER);
|
|
1432
1440
|
|
|
1433
1441
|
const KEY_INDEX = '__BOBE_KEY_INDEX';
|
|
1434
1442
|
let _ctxStack;
|
|
@@ -1665,7 +1673,7 @@ class Interpreter {
|
|
|
1665
1673
|
effect: null,
|
|
1666
1674
|
textNode: null,
|
|
1667
1675
|
owner: ctx.stack.peekByType(NodeSort.TokenizerSwitcher)?.node,
|
|
1668
|
-
snapshot: this.tokenizer.snapshot(['dentStack']),
|
|
1676
|
+
snapshot: this.tokenizer.snapshot(['dentStack', 'isFirstToken']),
|
|
1669
1677
|
parentDataProvider: ctx.stack.peekByType(NodeSort.CtxProvider)?.node
|
|
1670
1678
|
};
|
|
1671
1679
|
let isUpdate = false;
|
|
@@ -1678,7 +1686,7 @@ class Interpreter {
|
|
|
1678
1686
|
oldTextNode = node.textNode;
|
|
1679
1687
|
if (oldLogicType) {
|
|
1680
1688
|
this.removeLogicNode(node);
|
|
1681
|
-
pickInPlace(node, ['realParent', 'realBefore', 'realAfter'
|
|
1689
|
+
pickInPlace(node, ['realParent', 'realBefore', 'realAfter', 'owner', 'snapshot', 'parentDataProvider']);
|
|
1682
1690
|
}
|
|
1683
1691
|
if (isRenderAble(val)) {
|
|
1684
1692
|
if (oldTextNode) {
|
|
@@ -1708,7 +1716,7 @@ class Interpreter {
|
|
|
1708
1716
|
}
|
|
1709
1717
|
if (isUpdate) {
|
|
1710
1718
|
this.tokenizer.useDedentAsEof = false;
|
|
1711
|
-
this.program(node.realParent, node
|
|
1719
|
+
this.program(node.realParent, node, node.realBefore);
|
|
1712
1720
|
} else {
|
|
1713
1721
|
this.tokenizer.useDedentAsEof = true;
|
|
1714
1722
|
this.tokenizer.initIndentWhenUseDedentAsEof();
|
|
@@ -1853,7 +1861,8 @@ class Interpreter {
|
|
|
1853
1861
|
i: 0
|
|
1854
1862
|
};
|
|
1855
1863
|
if (keyExp) {
|
|
1856
|
-
|
|
1864
|
+
const rawGetKey = new Function('data', `with(data){return (${keyExp})}`);
|
|
1865
|
+
forNode.getKey = data => rawGetKey(safe(data));
|
|
1857
1866
|
}
|
|
1858
1867
|
window['for1'] = forNode;
|
|
1859
1868
|
const data = this.getData();
|
|
@@ -2225,7 +2234,7 @@ class Interpreter {
|
|
|
2225
2234
|
return node;
|
|
2226
2235
|
}
|
|
2227
2236
|
getFn(data, expression) {
|
|
2228
|
-
return new Function('data', `
|
|
2237
|
+
return new Function('data', `with(data){return (${expression})}`).bind(undefined, safe(data));
|
|
2229
2238
|
}
|
|
2230
2239
|
getAssignFn(data, expression) {
|
|
2231
2240
|
const valueId = `value_bobe_${date32()}`;
|
|
@@ -2575,6 +2584,7 @@ function bobe(fragments, ...values) {
|
|
|
2575
2584
|
return tokenizer;
|
|
2576
2585
|
};
|
|
2577
2586
|
ui.boundStore = Store.Current;
|
|
2587
|
+
ui[Keys.ProxyFreeObject] = true;
|
|
2578
2588
|
ui.__BOBE_IS_UI = true;
|
|
2579
2589
|
return ui;
|
|
2580
2590
|
}
|