aoye 0.0.16 → 0.0.18
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 +27 -23
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +27 -24
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.umd.js +27 -23
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/aoye.esm.js
CHANGED
|
@@ -432,7 +432,7 @@ class Line {
|
|
|
432
432
|
for (const key in head) {
|
|
433
433
|
head[key] = null;
|
|
434
434
|
}
|
|
435
|
-
if (line && v2.scope && v1.scope !== v2.scope &&
|
|
435
|
+
if (line && v2.scope && v1.scope !== v2.scope && (v1.state & State.IsScope) === 0) {
|
|
436
436
|
const first = v2.scope.outLink;
|
|
437
437
|
if (!first) {
|
|
438
438
|
v2.scope.outLink = line;
|
|
@@ -600,7 +600,7 @@ function dispose() {
|
|
|
600
600
|
dfs(upstream, {
|
|
601
601
|
isUp: true,
|
|
602
602
|
begin: ({ node }) => {
|
|
603
|
-
if (
|
|
603
|
+
if ((node.state & State.IsScope) === 0 || node.state & ScopeAbort) return true;
|
|
604
604
|
},
|
|
605
605
|
complete: ({ node: scope, notGoDeep }) => {
|
|
606
606
|
const shouldAbort = !notGoDeep;
|
|
@@ -719,11 +719,12 @@ const markDeep = (signal) => {
|
|
|
719
719
|
}
|
|
720
720
|
};
|
|
721
721
|
const pullingPostprocess = (node) => {
|
|
722
|
-
node.state
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
722
|
+
let s = node.state;
|
|
723
|
+
s &= ~State.Pulling;
|
|
724
|
+
if (s & State.PullingUnknown) {
|
|
725
|
+
s = s & ~State.PullingUnknown | State.Unknown;
|
|
726
726
|
}
|
|
727
|
+
node.state = s;
|
|
727
728
|
};
|
|
728
729
|
const _Signal = class _Signal {
|
|
729
730
|
constructor(nextValue, customPull) {
|
|
@@ -772,7 +773,7 @@ const _Signal = class _Signal {
|
|
|
772
773
|
if (this !== downstream && // 1. 外部支持 link
|
|
773
774
|
shouldLink && // 2. 有下游
|
|
774
775
|
downstream && // 3. 下游是 watcher,不链接非 scope
|
|
775
|
-
(
|
|
776
|
+
((downstream.state & State.LinkScopeOnly) === 0 || isScope)) {
|
|
776
777
|
Line.link(this, downstream);
|
|
777
778
|
}
|
|
778
779
|
try {
|
|
@@ -811,7 +812,7 @@ const _Signal = class _Signal {
|
|
|
811
812
|
dfs(signal, {
|
|
812
813
|
isUp: true,
|
|
813
814
|
begin: ({ node }) => {
|
|
814
|
-
if (node.state & (State.Pulling | State.Dirty) ||
|
|
815
|
+
if (node.state & (State.Pulling | State.Dirty) || (node.state & DirtyState) === 0 || node.isDisabled()) {
|
|
815
816
|
return true;
|
|
816
817
|
}
|
|
817
818
|
node.state |= State.Pulling;
|
|
@@ -855,7 +856,7 @@ const _Signal = class _Signal {
|
|
|
855
856
|
const downstream = G.PullingSignal;
|
|
856
857
|
if (this !== downstream && // 2. 有下游
|
|
857
858
|
downstream && // 3. 下游是 watcher 不是 watch,或 是watcher 但 当前是 scope
|
|
858
|
-
(
|
|
859
|
+
((downstream.state & State.LinkScopeOnly) === 0 || this.state & State.IsScope)) {
|
|
859
860
|
Line.link(this, downstream);
|
|
860
861
|
}
|
|
861
862
|
return this.value;
|
|
@@ -931,7 +932,8 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
931
932
|
var _a;
|
|
932
933
|
const isObj = typeof target === "object" && target !== null;
|
|
933
934
|
if (!isObj || target[Keys.Raw]) return target;
|
|
934
|
-
|
|
935
|
+
const p = rawToProxy.get(target);
|
|
936
|
+
if (p) return p;
|
|
935
937
|
const cells = /* @__PURE__ */ new Map();
|
|
936
938
|
const targetIsArray = Array.isArray(target);
|
|
937
939
|
const targetIsStore = Boolean((_a = target.constructor) == null ? void 0 : _a[IsStore]);
|
|
@@ -966,11 +968,12 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
966
968
|
return value;
|
|
967
969
|
}
|
|
968
970
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
+
let s = cells.get(prop);
|
|
972
|
+
if (s) {
|
|
973
|
+
return s.v;
|
|
971
974
|
}
|
|
972
975
|
const wrappedValue = deep ? deepSignal(value, scope) : value;
|
|
973
|
-
|
|
976
|
+
s = Signal.create(wrappedValue, {
|
|
974
977
|
scheduler: Scheduler.Sync,
|
|
975
978
|
isScope: false,
|
|
976
979
|
scope
|
|
@@ -984,8 +987,8 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
984
987
|
}
|
|
985
988
|
batch.start();
|
|
986
989
|
const success = Reflect.set(obj, prop, value, receiver);
|
|
987
|
-
|
|
988
|
-
|
|
990
|
+
const cell = cells.get(prop);
|
|
991
|
+
if (cell) {
|
|
989
992
|
cell.v = deep ? deepSignal(value, scope) : value;
|
|
990
993
|
}
|
|
991
994
|
if (targetIsArray) {
|
|
@@ -1001,9 +1004,7 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
1001
1004
|
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop) || typeof obj[prop] === "function") {
|
|
1002
1005
|
return Reflect.deleteProperty(obj, prop);
|
|
1003
1006
|
}
|
|
1004
|
-
|
|
1005
|
-
cells.delete(prop);
|
|
1006
|
-
}
|
|
1007
|
+
cells.delete(prop);
|
|
1007
1008
|
triggerIter(obj, prop, void 0, proxy);
|
|
1008
1009
|
return Reflect.deleteProperty(obj, prop);
|
|
1009
1010
|
},
|
|
@@ -1054,10 +1055,11 @@ function isIgnoreKey(ignores, key) {
|
|
|
1054
1055
|
return ignores.some((it) => typeof it === "string" && key.startsWith(it));
|
|
1055
1056
|
}
|
|
1056
1057
|
function handleGetterAsComputed(obj, prop, receiver, cells, scope) {
|
|
1057
|
-
|
|
1058
|
-
|
|
1058
|
+
let s = cells.get(prop);
|
|
1059
|
+
if (s) {
|
|
1060
|
+
return s.v;
|
|
1059
1061
|
}
|
|
1060
|
-
|
|
1062
|
+
s = Signal.create(null, {
|
|
1061
1063
|
customPull: () => Reflect.get(obj, prop, receiver),
|
|
1062
1064
|
scheduler: Scheduler.Sync,
|
|
1063
1065
|
isScope: false,
|
|
@@ -1100,8 +1102,9 @@ const arrayMethodReWrites = {};
|
|
|
1100
1102
|
args[0] = value[Keys.Raw];
|
|
1101
1103
|
result = fn.call(that, ...args);
|
|
1102
1104
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
+
const p = rawToProxy.get(value);
|
|
1106
|
+
if (p) {
|
|
1107
|
+
args[0] = p;
|
|
1105
1108
|
result = fn.call(that, ...args);
|
|
1106
1109
|
}
|
|
1107
1110
|
}
|
|
@@ -1528,5 +1531,5 @@ const isScope = (value) => {
|
|
|
1528
1531
|
return value instanceof Signal;
|
|
1529
1532
|
};
|
|
1530
1533
|
|
|
1531
|
-
export { $, IsStore, Keys, Scheduler, Store, StoreIgnoreKeys, TaskQueue, batch, clean, customEffect, effect, getPulling, isScope, isSignal, registerScheduler, runWithPulling, scope, setPulling, shareSignal };
|
|
1534
|
+
export { $, IsStore, Keys, Scheduler, Store, StoreIgnoreKeys, TaskQueue, batch, clean, customEffect, deepSignal, effect, getPulling, isScope, isSignal, registerScheduler, runWithPulling, scope, setPulling, shareSignal };
|
|
1532
1535
|
//# sourceMappingURL=aoye.esm.js.map
|