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