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/index.umd.js
CHANGED
|
@@ -1431,6 +1431,14 @@
|
|
|
1431
1431
|
}
|
|
1432
1432
|
const isUI = fn => typeof fn === 'function' && fn.__BOBE_IS_UI;
|
|
1433
1433
|
const isRenderAble = val => aoye.isStore(val) || isUI(val) || val instanceof InlineFragment;
|
|
1434
|
+
const SAFE_HANDLER = {
|
|
1435
|
+
has: () => true,
|
|
1436
|
+
get: (t, k) => {
|
|
1437
|
+
if (typeof k === 'symbol') return t[k];
|
|
1438
|
+
return k in t ? t[k] : undefined;
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
const safe = data => new Proxy(data, SAFE_HANDLER);
|
|
1434
1442
|
|
|
1435
1443
|
const KEY_INDEX = '__BOBE_KEY_INDEX';
|
|
1436
1444
|
let _ctxStack;
|
|
@@ -1667,7 +1675,7 @@
|
|
|
1667
1675
|
effect: null,
|
|
1668
1676
|
textNode: null,
|
|
1669
1677
|
owner: ctx.stack.peekByType(NodeSort.TokenizerSwitcher)?.node,
|
|
1670
|
-
snapshot: this.tokenizer.snapshot(['dentStack']),
|
|
1678
|
+
snapshot: this.tokenizer.snapshot(['dentStack', 'isFirstToken']),
|
|
1671
1679
|
parentDataProvider: ctx.stack.peekByType(NodeSort.CtxProvider)?.node
|
|
1672
1680
|
};
|
|
1673
1681
|
let isUpdate = false;
|
|
@@ -1680,7 +1688,7 @@
|
|
|
1680
1688
|
oldTextNode = node.textNode;
|
|
1681
1689
|
if (oldLogicType) {
|
|
1682
1690
|
this.removeLogicNode(node);
|
|
1683
|
-
bobeShared.pickInPlace(node, ['realParent', 'realBefore', 'realAfter'
|
|
1691
|
+
bobeShared.pickInPlace(node, ['realParent', 'realBefore', 'realAfter', 'owner', 'snapshot', 'parentDataProvider']);
|
|
1684
1692
|
}
|
|
1685
1693
|
if (isRenderAble(val)) {
|
|
1686
1694
|
if (oldTextNode) {
|
|
@@ -1710,7 +1718,7 @@
|
|
|
1710
1718
|
}
|
|
1711
1719
|
if (isUpdate) {
|
|
1712
1720
|
this.tokenizer.useDedentAsEof = false;
|
|
1713
|
-
this.program(node.realParent, node
|
|
1721
|
+
this.program(node.realParent, node, node.realBefore);
|
|
1714
1722
|
} else {
|
|
1715
1723
|
this.tokenizer.useDedentAsEof = true;
|
|
1716
1724
|
this.tokenizer.initIndentWhenUseDedentAsEof();
|
|
@@ -1855,7 +1863,8 @@
|
|
|
1855
1863
|
i: 0
|
|
1856
1864
|
};
|
|
1857
1865
|
if (keyExp) {
|
|
1858
|
-
|
|
1866
|
+
const rawGetKey = new Function('data', `with(data){return (${keyExp})}`);
|
|
1867
|
+
forNode.getKey = data => rawGetKey(safe(data));
|
|
1859
1868
|
}
|
|
1860
1869
|
window['for1'] = forNode;
|
|
1861
1870
|
const data = this.getData();
|
|
@@ -2227,7 +2236,7 @@
|
|
|
2227
2236
|
return node;
|
|
2228
2237
|
}
|
|
2229
2238
|
getFn(data, expression) {
|
|
2230
|
-
return new Function('data', `
|
|
2239
|
+
return new Function('data', `with(data){return (${expression})}`).bind(undefined, safe(data));
|
|
2231
2240
|
}
|
|
2232
2241
|
getAssignFn(data, expression) {
|
|
2233
2242
|
const valueId = `value_bobe_${bobeShared.date32()}`;
|
|
@@ -2577,6 +2586,7 @@
|
|
|
2577
2586
|
return tokenizer;
|
|
2578
2587
|
};
|
|
2579
2588
|
ui.boundStore = aoye.Store.Current;
|
|
2589
|
+
ui[aoye.Keys.ProxyFreeObject] = true;
|
|
2580
2590
|
ui.__BOBE_IS_UI = true;
|
|
2581
2591
|
return ui;
|
|
2582
2592
|
}
|