aoye 0.0.56 → 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.cjs.js +19 -4
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +19 -5
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.umd.js +19 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/aoye.cjs.js
CHANGED
|
@@ -985,7 +985,17 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
985
985
|
if (targetIsArray) {
|
|
986
986
|
return arrayMethodReWrites[prop] || value;
|
|
987
987
|
} else {
|
|
988
|
-
|
|
988
|
+
if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
|
|
989
|
+
return value;
|
|
990
|
+
}
|
|
991
|
+
let s = cells.get(prop);
|
|
992
|
+
if (s) {
|
|
993
|
+
return s.get();
|
|
994
|
+
}
|
|
995
|
+
s = new Signal(value);
|
|
996
|
+
s.scope = scope;
|
|
997
|
+
cells.set(prop, s);
|
|
998
|
+
return s.get();
|
|
989
999
|
}
|
|
990
1000
|
}
|
|
991
1001
|
let s = cells.get(prop);
|
|
@@ -999,7 +1009,7 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
999
1009
|
return s.get();
|
|
1000
1010
|
},
|
|
1001
1011
|
set(obj, prop, value, receiver) {
|
|
1002
|
-
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)
|
|
1012
|
+
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
|
|
1003
1013
|
return Reflect.set(obj, prop, value, receiver);
|
|
1004
1014
|
}
|
|
1005
1015
|
const isNewKey = !Reflect.has(obj, prop);
|
|
@@ -1007,7 +1017,7 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
1007
1017
|
const success = Reflect.set(obj, prop, value, receiver);
|
|
1008
1018
|
const cell = cells.get(prop);
|
|
1009
1019
|
if (cell) {
|
|
1010
|
-
cell.set(deep ? deepSignal(value, scope)
|
|
1020
|
+
cell.set(typeof value === 'function' || !deep ? value : deepSignal(value, scope));
|
|
1011
1021
|
}
|
|
1012
1022
|
if (targetIsArray) {
|
|
1013
1023
|
handleArraySet(obj, prop, value, receiver);
|
|
@@ -1018,7 +1028,10 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
1018
1028
|
return success;
|
|
1019
1029
|
},
|
|
1020
1030
|
deleteProperty(obj, prop) {
|
|
1021
|
-
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)
|
|
1031
|
+
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
|
|
1032
|
+
return Reflect.deleteProperty(obj, prop);
|
|
1033
|
+
}
|
|
1034
|
+
if (typeof obj[prop] === 'function' && !Object.prototype.hasOwnProperty.call(obj, prop)) {
|
|
1022
1035
|
return Reflect.deleteProperty(obj, prop);
|
|
1023
1036
|
}
|
|
1024
1037
|
cells.delete(prop);
|
|
@@ -1463,6 +1476,7 @@ class Store {
|
|
|
1463
1476
|
this.parent = null;
|
|
1464
1477
|
}
|
|
1465
1478
|
}
|
|
1479
|
+
const isStore = s => typeof s === 'function' && s[IsStore];
|
|
1466
1480
|
|
|
1467
1481
|
function $(data) {
|
|
1468
1482
|
if (typeof data === 'object' && data !== null) {
|
|
@@ -1605,6 +1619,7 @@ exports.execIdInc = execIdInc;
|
|
|
1605
1619
|
exports.flushMicroEffectManual = flushMicroEffectManual;
|
|
1606
1620
|
exports.getPulling = getPulling;
|
|
1607
1621
|
exports.ide = ide;
|
|
1622
|
+
exports.isStore = isStore;
|
|
1608
1623
|
exports.macro = macro;
|
|
1609
1624
|
exports.micro = micro;
|
|
1610
1625
|
exports.noopEffect = noopEffect;
|