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