bobe 0.0.74 → 0.0.76

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
@@ -70,6 +70,7 @@ declare class Interpreter {
70
70
  private createComponentData;
71
71
  componentOrFragmentDeclaration(ComponentOrRender: UI | typeof Store | InlineFragment, ctx: ProgramCtx): ComponentNode$1;
72
72
  getFn(data: any, expression: string | number): any;
73
+ getBoolFn(data: any, expression: string | number): any;
73
74
  getAssignFn(data: any, expression: string | number): any;
74
75
  condDeclaration(ctx: ProgramCtx): IfNode;
75
76
  removeLogicNode(node: LogicNode): void;
package/dist/index.umd.js CHANGED
@@ -339,9 +339,7 @@
339
339
  return this.token;
340
340
  } catch (error) {
341
341
  throw error;
342
- } finally {
343
- this.handledTokens.push(this.token);
344
- }
342
+ } finally {}
345
343
  }
346
344
  locStart() {
347
345
  }
@@ -377,7 +375,6 @@
377
375
  }
378
376
  const trimmed = value.replace(/\/\/[\s\S]+/, '').trim();
379
377
  this.setToken(TokenType.Identifier, trimmed ? trimmed : true, 0);
380
- this.handledTokens.push(this.token);
381
378
  this.locEnd();
382
379
  return this.token;
383
380
  }
@@ -398,7 +395,6 @@
398
395
  char = this.code[this.i];
399
396
  }
400
397
  this.setToken(TokenType.Identifier, value, 0);
401
- this.handledTokens.push(this.token);
402
398
  this.locEnd();
403
399
  return this.token;
404
400
  }
@@ -2339,10 +2335,19 @@
2339
2335
  }
2340
2336
  removeForItem(children, i) {
2341
2337
  const child = children[i];
2338
+ const after = child.realAfter;
2342
2339
  this.removeLogicNode(child);
2343
2340
  this.remove(child.realBefore);
2344
2341
  this.remove(child.realAfter);
2345
2342
  child.effect.dispose();
2343
+ child.effect = undefined;
2344
+ child.data = undefined;
2345
+ child.context = undefined;
2346
+ after[FakeNode] = undefined;
2347
+ child.forNode = undefined;
2348
+ child.realParent = undefined;
2349
+ child.realAfter = undefined;
2350
+ child.realBefore = undefined;
2346
2351
  }
2347
2352
  reuseForItem(child, data, itemExp, i, indexName, indexValue) {
2348
2353
  if (typeof itemExp === 'string') {
@@ -2501,6 +2506,11 @@
2501
2506
  getFn(data, expression) {
2502
2507
  return new Function('data', `with(data){return (${expression})}`).bind(undefined, safe(data));
2503
2508
  }
2509
+ getBoolFn(data, expression) {
2510
+ return new Function('data', `with(data){return Boolean(${expression})}`).bind(undefined, safeExclude(data, {
2511
+ 'Boolean': true
2512
+ }));
2513
+ }
2504
2514
  getAssignFn(data, expression) {
2505
2515
  const valueId = `value_bobe_${bobeShared.date32()}`;
2506
2516
  return new Function('data', valueId, `with(data){${expression}=${valueId}};`).bind(undefined, safeExclude(data, {
@@ -2538,11 +2548,9 @@
2538
2548
  switch (keyWord.value) {
2539
2549
  case 'if':
2540
2550
  if (valueIsMapKey) {
2541
- aoye.runWithPulling(() => data[value], null);
2542
- const cells = data[aoye.Keys.Meta].cells;
2543
- signal = cells.get(value);
2551
+ signal = new aoye.Computed(() => Boolean(data[value]));
2544
2552
  } else {
2545
- const fn = this.getFn(data, value);
2553
+ const fn = this.getBoolFn(data, value);
2546
2554
  signal = new aoye.Computed(fn);
2547
2555
  }
2548
2556
  break;
@@ -2562,7 +2570,7 @@
2562
2570
  return true;
2563
2571
  });
2564
2572
  } else {
2565
- const fn = valueIsMapKey ? null : this.getFn(data, value);
2573
+ const fn = valueIsMapKey ? null : this.getBoolFn(data, value);
2566
2574
  signal = new aoye.Computed(() => {
2567
2575
  let point = ifNode.preCond;
2568
2576
  while (point) {
@@ -2574,7 +2582,7 @@
2574
2582
  }
2575
2583
  point = point.preCond;
2576
2584
  }
2577
- return valueIsMapKey ? data[value] : fn();
2585
+ return valueIsMapKey ? Boolean(data[value]) : fn();
2578
2586
  });
2579
2587
  }
2580
2588
  break;