bobe 0.0.27 → 0.0.28

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.umd.js CHANGED
@@ -197,6 +197,8 @@
197
197
  return candyLast;
198
198
  }
199
199
 
200
+ const KEY_INDEX = '__BOBE_KEY_INDEX';
201
+
200
202
  const _excluded = ["dentStack", "isFirstToken"];
201
203
  class Interpreter {
202
204
  constructor(tokenizer) {
@@ -541,9 +543,9 @@
541
543
  }
542
544
  if (s > e1) {
543
545
  if (s <= e2) {
544
- const lastAfter = children.at(-1)?.realAfter || forNode.realBefore;
546
+ const firstBefore = s > 0 ? children.at(-1)?.realAfter || forNode.realBefore : forNode.realBefore;
545
547
  for (let i = e2; i >= s; i--) {
546
- this.insertForItem(forNode, i, data, newChildren, lastAfter, snapshotForUpdate);
548
+ this.insertForItem(forNode, i, data, newChildren, firstBefore, snapshotForUpdate);
547
549
  }
548
550
  }
549
551
  } else if (s > e2) {
@@ -666,6 +668,9 @@
666
668
  if (indexName) {
667
669
  child.data[indexName] = i;
668
670
  }
671
+ } else {
672
+ indexName = indexName || KEY_INDEX;
673
+ child.data[indexName] = i;
669
674
  }
670
675
  }
671
676
  forItemId = 0;
@@ -695,9 +700,10 @@
695
700
  getItemData(forNode, i, parentData) {
696
701
  const arr = forNode.arr,
697
702
  itemExp = forNode.itemExp,
698
- indexName = forNode.indexName,
699
703
  vars = forNode.vars,
700
- arrSignal = forNode.arrSignal;
704
+ arrSignal = forNode.arrSignal,
705
+ getKey = forNode.getKey;
706
+ let indexName = forNode.indexName;
701
707
  let data;
702
708
  if (typeof itemExp === 'string') {
703
709
  data = aoye.deepSignal(indexName ? {
@@ -707,13 +713,16 @@
707
713
  [itemExp]: arr[i]
708
714
  }, aoye.getPulling());
709
715
  } else {
710
- data = aoye.deepSignal(indexName ? {
716
+ indexName = indexName ?? KEY_INDEX;
717
+ const rawData = {
711
718
  [indexName]: i
712
- } : {}, aoye.getPulling());
713
- const computedData = new aoye.Computed(() => itemExp(arrSignal.get()[i]));
719
+ };
720
+ data = aoye.deepSignal(rawData, aoye.getPulling());
721
+ const computedData = new aoye.Computed(() => itemExp(arrSignal.get()[getKey ? data[indexName] : i]));
714
722
  const cells = data[aoye.Keys.Meta].cells;
715
723
  for (let i = 0; i < vars.length; i++) {
716
724
  const name = vars[i];
725
+ rawData[name] = undefined;
717
726
  cells.set(name, new aoye.Computed(() => computedData.get()[name]));
718
727
  }
719
728
  }