bobe 0.0.62 → 0.0.64

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
@@ -36,13 +36,13 @@ declare class Interpreter {
36
36
  * */
37
37
  declaration(ctx: ProgramCtx): any;
38
38
  dynamicDeclaration(pData: any, value: string, ctx: ProgramCtx): DynamicNode;
39
- createTpNode(): TpNode;
40
- createContextNode(): ContextNode;
39
+ createTpNode(ctx: ProgramCtx): TpNode;
40
+ createContextNode(ctx: ProgramCtx): ContextNode;
41
41
  formatForCollection(collection: any): {
42
42
  arr: any[];
43
43
  keys: string[] | null;
44
44
  };
45
- forDeclaration(): ForNode | ForItemNode;
45
+ forDeclaration(ctx: ProgramCtx): ForNode | ForItemNode;
46
46
  /** after 锚点,对 fake 节点反引用
47
47
  * 用于 tp 节点 移动时,可以通过 after 锚点找到 fake 节点并做 realParent 的修正
48
48
  */
package/dist/index.umd.js CHANGED
@@ -1651,11 +1651,11 @@
1651
1651
  if (value === 'if' || value === 'else' || value === 'fail') {
1652
1652
  return this.condDeclaration(ctx);
1653
1653
  } else if (value === 'context') {
1654
- _node = this.createContextNode();
1654
+ _node = this.createContextNode(ctx);
1655
1655
  } else if (value === 'tp') {
1656
- return this.createTpNode();
1656
+ return this.createTpNode(ctx);
1657
1657
  } else if (value === 'for') {
1658
- return this.forDeclaration();
1658
+ return this.forDeclaration(ctx);
1659
1659
  } else if (hookType) {
1660
1660
  const data = this.getData();
1661
1661
  if (hookType === 'static') {
@@ -1688,7 +1688,7 @@
1688
1688
  const valueIsMapKey = Boolean(aoye.getProxyHasKey(pData, value));
1689
1689
  let node = {
1690
1690
  __logicType: null,
1691
- realParent: null,
1691
+ realParent: ctx.realParent,
1692
1692
  tokenizer: null,
1693
1693
  effect: null,
1694
1694
  textNode: null,
@@ -1774,12 +1774,12 @@
1774
1774
  });
1775
1775
  return node;
1776
1776
  }
1777
- createTpNode() {
1777
+ createTpNode(ctx) {
1778
1778
  const child = aoye.deepSignal({}, aoye.getPulling());
1779
1779
  const node = {
1780
1780
  __logicType: FakeType.Tp,
1781
1781
  data: this.getData(),
1782
- realParent: null,
1782
+ realParent: ctx.realParent,
1783
1783
  realBefore: null,
1784
1784
  realAfter: null,
1785
1785
  contentBefore: null,
@@ -1787,7 +1787,7 @@
1787
1787
  effect: null,
1788
1788
  snapshot: null,
1789
1789
  tpData: child,
1790
- owner: this.ctx.stack.peekByType(NodeSort.TokenizerSwitcher)?.node
1790
+ owner: ctx.stack.peekByType(NodeSort.TokenizerSwitcher)?.node
1791
1791
  };
1792
1792
  this.onePropParsed = createStoreOnePropParsed(child);
1793
1793
  this.tokenizer.nextToken();
@@ -1877,9 +1877,9 @@
1877
1877
  });
1878
1878
  return node;
1879
1879
  }
1880
- createContextNode() {
1880
+ createContextNode(ctx) {
1881
1881
  const child = aoye.deepSignal({}, aoye.getPulling());
1882
- const parentContext = this.ctx.stack.peekByType(NodeSort.Context)?.node?.context;
1882
+ const parentContext = ctx.stack.peekByType(NodeSort.Context)?.node?.context;
1883
1883
  if (parentContext) {
1884
1884
  aoye.backupSignal(child, parentContext);
1885
1885
  }
@@ -1887,7 +1887,7 @@
1887
1887
  const node = {
1888
1888
  __logicType: FakeType.Context,
1889
1889
  context: child,
1890
- realParent: null,
1890
+ realParent: ctx.realParent,
1891
1891
  realBefore: null,
1892
1892
  realAfter: null
1893
1893
  };
@@ -1932,7 +1932,7 @@
1932
1932
  }
1933
1933
  return res;
1934
1934
  }
1935
- forDeclaration() {
1935
+ forDeclaration(ctx) {
1936
1936
  const arrExp = this.tokenizer.jsExp().value;
1937
1937
  this.tokenizer.nextToken();
1938
1938
  const itemToken = this.tokenizer.nextToken();
@@ -1958,12 +1958,12 @@
1958
1958
  if (this.tokenizer.peekChar() !== '\n') keyExp = this.tokenizer.jsExp().value;
1959
1959
  }
1960
1960
  }
1961
- const owner = this.ctx.stack.peekByType(NodeSort.TokenizerSwitcher)?.node;
1962
- const prevSibling = this.ctx.prevSibling;
1961
+ const owner = ctx.stack.peekByType(NodeSort.TokenizerSwitcher)?.node;
1962
+ const prevSibling = ctx.prevSibling;
1963
1963
  const forNode = {
1964
1964
  __logicType: FakeType.For,
1965
1965
  snapshot: this.tokenizer.snapshot(['dentStack', 'isFirstToken']),
1966
- realParent: this.ctx.realParent,
1966
+ realParent: ctx.realParent,
1967
1967
  prevSibling,
1968
1968
  realBefore: prevSibling?.realAfter || prevSibling,
1969
1969
  realAfter: null,
@@ -2227,7 +2227,7 @@
2227
2227
  forItemNode = {
2228
2228
  id: this.forItemId++,
2229
2229
  __logicType: FakeType.ForItem,
2230
- realParent: null,
2230
+ realParent: this.ctx.realParent,
2231
2231
  realBefore: null,
2232
2232
  realAfter: null,
2233
2233
  forNode,
@@ -2379,7 +2379,7 @@
2379
2379
  const ifNode = {
2380
2380
  __logicType: isElse ? FakeType.Else : isIf ? FakeType.If : FakeType.Fail,
2381
2381
  snapshot: this.tokenizer.snapshot(),
2382
- realParent: null,
2382
+ realParent: ctx.realParent,
2383
2383
  realBefore: null,
2384
2384
  realAfter: null,
2385
2385
  condition: null,