aoye 0.0.15 → 0.0.17

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
@@ -436,7 +436,7 @@
436
436
  for (const key in head) {
437
437
  head[key] = null;
438
438
  }
439
- if (line && v2.scope && v1.scope !== v2.scope && !(v1.state & State.IsScope)) {
439
+ if (line && v2.scope && v1.scope !== v2.scope && (v1.state & State.IsScope) === 0) {
440
440
  const first = v2.scope.outLink;
441
441
  if (!first) {
442
442
  v2.scope.outLink = line;
@@ -604,7 +604,7 @@
604
604
  dfs(upstream, {
605
605
  isUp: true,
606
606
  begin: ({ node }) => {
607
- if (!(node.state & State.IsScope) || node.state & ScopeAbort) return true;
607
+ if ((node.state & State.IsScope) === 0 || node.state & ScopeAbort) return true;
608
608
  },
609
609
  complete: ({ node: scope, notGoDeep }) => {
610
610
  const shouldAbort = !notGoDeep;
@@ -723,11 +723,12 @@
723
723
  }
724
724
  };
725
725
  const pullingPostprocess = (node) => {
726
- node.state &= ~State.Pulling;
727
- if (node.state & State.PullingUnknown) {
728
- node.state &= ~State.PullingUnknown;
729
- node.state |= State.Unknown;
726
+ let s = node.state;
727
+ s &= ~State.Pulling;
728
+ if (s & State.PullingUnknown) {
729
+ s = s & ~State.PullingUnknown | State.Unknown;
730
730
  }
731
+ node.state = s;
731
732
  };
732
733
  const _Signal = class _Signal {
733
734
  constructor(nextValue, customPull) {
@@ -776,7 +777,7 @@
776
777
  if (this !== downstream && // 1. 外部支持 link
777
778
  shouldLink && // 2. 有下游
778
779
  downstream && // 3. 下游是 watcher,不链接非 scope
779
- (!(downstream.state & State.LinkScopeOnly) || isScope)) {
780
+ ((downstream.state & State.LinkScopeOnly) === 0 || isScope)) {
780
781
  Line.link(this, downstream);
781
782
  }
782
783
  try {
@@ -815,7 +816,7 @@
815
816
  dfs(signal, {
816
817
  isUp: true,
817
818
  begin: ({ node }) => {
818
- if (node.state & (State.Pulling | State.Dirty) || !(node.state & DirtyState) || node.isDisabled()) {
819
+ if (node.state & (State.Pulling | State.Dirty) || (node.state & DirtyState) === 0 || node.isDisabled()) {
819
820
  return true;
820
821
  }
821
822
  node.state |= State.Pulling;
@@ -859,7 +860,7 @@
859
860
  const downstream = G.PullingSignal;
860
861
  if (this !== downstream && // 2. 有下游
861
862
  downstream && // 3. 下游是 watcher 不是 watch,或 是watcher 但 当前是 scope
862
- (!(downstream.state & State.LinkScopeOnly) || this.state & State.IsScope)) {
863
+ ((downstream.state & State.LinkScopeOnly) === 0 || this.state & State.IsScope)) {
863
864
  Line.link(this, downstream);
864
865
  }
865
866
  return this.value;
@@ -935,7 +936,8 @@
935
936
  var _a;
936
937
  const isObj = typeof target === "object" && target !== null;
937
938
  if (!isObj || target[Keys.Raw]) return target;
938
- if (rawToProxy.has(target)) return rawToProxy.get(target);
939
+ const p = rawToProxy.get(target);
940
+ if (p) return p;
939
941
  const cells = /* @__PURE__ */ new Map();
940
942
  const targetIsArray = Array.isArray(target);
941
943
  const targetIsStore = Boolean((_a = target.constructor) == null ? void 0 : _a[IsStore]);
@@ -970,11 +972,12 @@
970
972
  return value;
971
973
  }
972
974
  }
973
- if (cells.has(prop)) {
974
- return cells.get(prop).v;
975
+ let s = cells.get(prop);
976
+ if (s) {
977
+ return s.v;
975
978
  }
976
979
  const wrappedValue = deep ? deepSignal(value, scope) : value;
977
- const s = Signal.create(wrappedValue, {
980
+ s = Signal.create(wrappedValue, {
978
981
  scheduler: Scheduler.Sync,
979
982
  isScope: false,
980
983
  scope
@@ -988,8 +991,8 @@
988
991
  }
989
992
  batch.start();
990
993
  const success = Reflect.set(obj, prop, value, receiver);
991
- if (cells.has(prop)) {
992
- const cell = cells.get(prop);
994
+ const cell = cells.get(prop);
995
+ if (cell) {
993
996
  cell.v = deep ? deepSignal(value, scope) : value;
994
997
  }
995
998
  if (targetIsArray) {
@@ -1005,9 +1008,7 @@
1005
1008
  if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop) || typeof obj[prop] === "function") {
1006
1009
  return Reflect.deleteProperty(obj, prop);
1007
1010
  }
1008
- if (cells.has(prop)) {
1009
- cells.delete(prop);
1010
- }
1011
+ cells.delete(prop);
1011
1012
  triggerIter(obj, prop, void 0, proxy);
1012
1013
  return Reflect.deleteProperty(obj, prop);
1013
1014
  },
@@ -1058,10 +1059,11 @@
1058
1059
  return ignores.some((it) => typeof it === "string" && key.startsWith(it));
1059
1060
  }
1060
1061
  function handleGetterAsComputed(obj, prop, receiver, cells, scope) {
1061
- if (cells.has(prop)) {
1062
- return cells.get(prop).v;
1062
+ let s = cells.get(prop);
1063
+ if (s) {
1064
+ return s.v;
1063
1065
  }
1064
- const s = Signal.create(null, {
1066
+ s = Signal.create(null, {
1065
1067
  customPull: () => Reflect.get(obj, prop, receiver),
1066
1068
  scheduler: Scheduler.Sync,
1067
1069
  isScope: false,
@@ -1104,8 +1106,9 @@
1104
1106
  args[0] = value[Keys.Raw];
1105
1107
  result = fn.call(that, ...args);
1106
1108
  }
1107
- if (rawToProxy.has(value)) {
1108
- args[0] = rawToProxy.get(value);
1109
+ const p = rawToProxy.get(value);
1110
+ if (p) {
1111
+ args[0] = p;
1109
1112
  result = fn.call(that, ...args);
1110
1113
  }
1111
1114
  }