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.
@@ -1462,7 +1462,7 @@ const SAFE_HANDLER = {
1462
1462
  has: () => true,
1463
1463
  get: (t, k) => {
1464
1464
  if (typeof k === 'symbol') return t[k];
1465
- return k in t ? t[k] : undefined;
1465
+ return t[k];
1466
1466
  }
1467
1467
  };
1468
1468
  const safe = data => new Proxy(data, SAFE_HANDLER);
@@ -1522,7 +1522,7 @@ class Interpreter {
1522
1522
  stack.push({
1523
1523
  node: ctx.current,
1524
1524
  prev: ctx.prevSibling
1525
- }, !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));
1525
+ }, !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));
1526
1526
  if (ctx.current.__logicType) {
1527
1527
  this.beforeLogicIndent?.(ctx.current);
1528
1528
  if (isEffectNode) {
@@ -1531,7 +1531,9 @@ class Interpreter {
1531
1531
  ctx.prevSibling = ctx.current.realBefore;
1532
1532
  }
1533
1533
  if (ctx.current.__logicType & FakeType.Tp) {
1534
- ctx.realParent = ctx.current.tpData[aoye.Keys.Raw].node;
1534
+ aoye.runWithPulling(() => {
1535
+ ctx.realParent = ctx.current.tpData.node;
1536
+ }, null);
1535
1537
  ctx.prevSibling = ctx.current.contentBefore;
1536
1538
  }
1537
1539
  }
@@ -1567,7 +1569,12 @@ class Interpreter {
1567
1569
  sort = _stack$pop2[1];
1568
1570
  if (!parent.__logicType) {
1569
1571
  const prevSameType = stack.peekByType(NodeSort.Real);
1570
- ctx.realParent = prevSameType?.node || root;
1572
+ const sameNode = prevSameType?.node;
1573
+ if (sameNode) {
1574
+ ctx.realParent = sameNode.__logicType === FakeType.Tp ? aoye.runWithPulling(() => sameNode.tpData.node, null) : sameNode;
1575
+ } else {
1576
+ ctx.realParent = root;
1577
+ }
1571
1578
  } else {
1572
1579
  if (sort & NodeSort.EffectNode) {
1573
1580
  const parentLogic = stack.peekByType(NodeSort.EffectNode)?.node;
@@ -1704,7 +1711,7 @@ class Interpreter {
1704
1711
  return _node;
1705
1712
  }
1706
1713
  dynamicDeclaration(pData, value, ctx) {
1707
- const valueIsMapKey = Reflect.has(pData[aoye.Keys.Raw], value);
1714
+ const valueIsMapKey = Boolean(aoye.getProxyHasKey(pData, value));
1708
1715
  let node = {
1709
1716
  __logicType: null,
1710
1717
  realParent: null,
@@ -1788,10 +1795,7 @@ class Interpreter {
1788
1795
  this.removeLogicNode(node);
1789
1796
  }
1790
1797
  };
1791
- }, [() => {
1792
- const val = valueIsMapKey ? pData[value] : this.getFn(pData, value)();
1793
- return val;
1794
- }], {
1798
+ }, [valueIsMapKey ? () => pData[value] : this.getFn(pData, value)], {
1795
1799
  type: 'render'
1796
1800
  });
1797
1801
  return node;
@@ -1819,7 +1823,13 @@ class Interpreter {
1819
1823
  const before = node.contentBefore = this.createAnchor('tp-content-before', true);
1820
1824
  const after = node.contentAfter = this.createAnchor('tp-content-after', true);
1821
1825
  let firstRender = true;
1822
- node.effect = this.effect(({
1826
+ let scope = new aoye.Scope(() => {});
1827
+ scope.scope = null;
1828
+ aoye.runWithPulling(() => {
1829
+ scope.get();
1830
+ }, null);
1831
+ node.effect = scope;
1832
+ this.effect(({
1823
1833
  old: oldDom,
1824
1834
  val: dom
1825
1835
  }) => {
@@ -1863,19 +1873,29 @@ class Interpreter {
1863
1873
  } else {
1864
1874
  this.handleInsert(dom, after, null);
1865
1875
  this.handleInsert(dom, before, null);
1866
- this.tokenizer = node.owner.tokenizer;
1867
- this.tokenizer.resume(node.snapshot);
1868
- this.tokenizer.useDedentAsEof = false;
1869
- this.program(dom, node.owner, before, node);
1876
+ aoye.runWithPulling(() => {
1877
+ this.tokenizer = node.owner.tokenizer;
1878
+ this.tokenizer.resume(node.snapshot);
1879
+ this.tokenizer.useDedentAsEof = false;
1880
+ this.program(dom, node.owner, before, node);
1881
+ }, scope);
1870
1882
  }
1871
1883
  } else {
1872
1884
  removeTpChild();
1885
+ scope.dispose();
1886
+ scope = new aoye.Scope(() => {});
1887
+ scope.scope = null;
1888
+ aoye.runWithPulling(() => {
1889
+ scope.get();
1890
+ }, null);
1891
+ node.effect = scope;
1873
1892
  }
1874
1893
  }
1875
1894
  firstRender = false;
1876
1895
  return isDestroy => {
1877
1896
  if (isDestroy) {
1878
1897
  removeTpChild();
1898
+ scope.dispose();
1879
1899
  }
1880
1900
  };
1881
1901
  }, [() => child.node], {
@@ -1887,7 +1907,7 @@ class Interpreter {
1887
1907
  const child = aoye.deepSignal({}, aoye.getPulling());
1888
1908
  const parentContext = this.ctx.stack.peekByType(NodeSort.Context)?.node?.context;
1889
1909
  if (parentContext) {
1890
- Object.setPrototypeOf(child, parentContext);
1910
+ aoye.backupSignal(child, parentContext);
1891
1911
  }
1892
1912
  this.onePropParsed = createStoreOnePropParsed(child);
1893
1913
  const node = {
@@ -2275,7 +2295,7 @@ class Interpreter {
2275
2295
  cells.set(name, new aoye.Computed(() => computedData.get()[name]));
2276
2296
  }
2277
2297
  }
2278
- Object.setPrototypeOf(data, parentData);
2298
+ aoye.backupSignal(data, parentData);
2279
2299
  return data;
2280
2300
  }
2281
2301
  getData() {
@@ -2316,7 +2336,7 @@ class Interpreter {
2316
2336
  } else if (ComponentOrRender instanceof InlineFragment) {
2317
2337
  const conf = ComponentOrRender;
2318
2338
  child = aoye.deepSignal({}, aoye.getPulling(), true);
2319
- Object.setPrototypeOf(child, conf.data);
2339
+ aoye.backupSignal(child, conf.data);
2320
2340
  tokenizer = conf.tokenizer;
2321
2341
  fragmentSnapshot = conf.snapshot;
2322
2342
  __logicType = FakeType.Fragment;
@@ -2326,7 +2346,7 @@ class Interpreter {
2326
2346
  const boundStore = render.boundStore;
2327
2347
  child = aoye.deepSignal({}, aoye.getPulling(), true);
2328
2348
  if (boundStore) {
2329
- Object.setPrototypeOf(child, boundStore);
2349
+ aoye.backupSignal(child, boundStore);
2330
2350
  }
2331
2351
  tokenizer = render(true);
2332
2352
  __logicType = FakeType.Fragment;
@@ -2574,7 +2594,7 @@ class Interpreter {
2574
2594
  prevKeys.delete(k);
2575
2595
  if (isComponent) {
2576
2596
  const savedK = savedDefaults.has(k);
2577
- if (!savedK && Object.prototype.hasOwnProperty.call(rawTarget, k)) {
2597
+ if (!savedK && bobeShared.hasOwn(rawTarget, k)) {
2578
2598
  savedDefaults.set(k, rawTarget[k]);
2579
2599
  }
2580
2600
  const val = props[k];
@@ -2607,7 +2627,7 @@ class Interpreter {
2607
2627
  }).get();
2608
2628
  }
2609
2629
  } else if (hookType === 'dynamic') {
2610
- const valueIsMapKey = Reflect.has(data[aoye.Keys.Raw], value);
2630
+ const valueIsMapKey = Boolean(aoye.getProxyHasKey(data, value));
2611
2631
  const fn = isFn ? rawVal : valueIsMapKey ? value : this.getFn(data, value);
2612
2632
  this.onePropParsed(data, _node, key, fn, valueIsMapKey, isFn, hookI);
2613
2633
  } else if (hookType === 'static') {