aoye 0.0.55 → 0.0.57

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/aoye.esm.js CHANGED
@@ -983,7 +983,17 @@ const deepSignal = (target, scope, deep = true) => {
983
983
  if (targetIsArray) {
984
984
  return arrayMethodReWrites[prop] || value;
985
985
  } else {
986
- return value;
986
+ if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
987
+ return value;
988
+ }
989
+ let s = cells.get(prop);
990
+ if (s) {
991
+ return s.get();
992
+ }
993
+ s = new Signal(value);
994
+ s.scope = scope;
995
+ cells.set(prop, s);
996
+ return s.get();
987
997
  }
988
998
  }
989
999
  let s = cells.get(prop);
@@ -997,7 +1007,7 @@ const deepSignal = (target, scope, deep = true) => {
997
1007
  return s.get();
998
1008
  },
999
1009
  set(obj, prop, value, receiver) {
1000
- if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop) || typeof value === 'function') {
1010
+ if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
1001
1011
  return Reflect.set(obj, prop, value, receiver);
1002
1012
  }
1003
1013
  const isNewKey = !Reflect.has(obj, prop);
@@ -1005,7 +1015,7 @@ const deepSignal = (target, scope, deep = true) => {
1005
1015
  const success = Reflect.set(obj, prop, value, receiver);
1006
1016
  const cell = cells.get(prop);
1007
1017
  if (cell) {
1008
- cell.set(deep ? deepSignal(value, scope) : value);
1018
+ cell.set(typeof value === 'function' || !deep ? value : deepSignal(value, scope));
1009
1019
  }
1010
1020
  if (targetIsArray) {
1011
1021
  handleArraySet(obj, prop, value, receiver);
@@ -1016,7 +1026,10 @@ const deepSignal = (target, scope, deep = true) => {
1016
1026
  return success;
1017
1027
  },
1018
1028
  deleteProperty(obj, prop) {
1019
- if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop) || typeof obj[prop] === 'function') {
1029
+ if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
1030
+ return Reflect.deleteProperty(obj, prop);
1031
+ }
1032
+ if (typeof obj[prop] === 'function' && !Object.prototype.hasOwnProperty.call(obj, prop)) {
1020
1033
  return Reflect.deleteProperty(obj, prop);
1021
1034
  }
1022
1035
  cells.delete(prop);
@@ -1461,6 +1474,7 @@ class Store {
1461
1474
  this.parent = null;
1462
1475
  }
1463
1476
  }
1477
+ const isStore = s => typeof s === 'function' && s[IsStore];
1464
1478
 
1465
1479
  function $(data) {
1466
1480
  if (typeof data === 'object' && data !== null) {
@@ -1578,5 +1592,5 @@ function scope(...args) {
1578
1592
  return run;
1579
1593
  }
1580
1594
 
1581
- export { $, Computed, Effect, EffectStrType2Enum, IsStore, Keys, NoopEffect, ScheduleStatus, ScheduleType, Scope, Signal, Store, StoreIgnoreKeys, batchDeep, batchEnd, batchStart, clean, deepSignal, effect, effectUt, execId, execIdInc, flushMicroEffectManual, getPulling, ide, macro, micro, noopEffect, now, runWithPulling, scope, setExecId, setPulling, shareSignal, toRaw };
1595
+ export { $, Computed, Effect, EffectStrType2Enum, IsStore, Keys, NoopEffect, ScheduleStatus, ScheduleType, Scope, Signal, Store, StoreIgnoreKeys, batchDeep, batchEnd, batchStart, clean, deepSignal, effect, effectUt, execId, execIdInc, flushMicroEffectManual, getPulling, ide, isStore, macro, micro, noopEffect, now, runWithPulling, scope, setExecId, setPulling, shareSignal, toRaw };
1582
1596
  //# sourceMappingURL=aoye.esm.js.map