aoye 0.0.12 → 0.0.14
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 +58 -49
- package/dist/aoye.cjs.js.map +1 -1
- package/dist/aoye.esm.js +58 -49
- package/dist/aoye.esm.js.map +1 -1
- package/dist/index.umd.js +58 -49
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -4
package/dist/aoye.esm.js
CHANGED
|
@@ -767,21 +767,19 @@ const _Signal = class _Signal {
|
|
|
767
767
|
pullRecurse(shouldLink = true) {
|
|
768
768
|
var _a, _b;
|
|
769
769
|
G.PullingRecurseDeep++;
|
|
770
|
-
|
|
770
|
+
const downstream = G.PullingSignal;
|
|
771
771
|
const isScope = this.state & State.IsScope;
|
|
772
|
-
if (
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
!(downstream.state & State.LinkScopeOnly && !isScope)
|
|
777
|
-
) {
|
|
772
|
+
if (this !== downstream && // 1. 外部支持 link
|
|
773
|
+
shouldLink && // 2. 有下游
|
|
774
|
+
downstream && // 3. 下游是 watcher,不链接非 scope
|
|
775
|
+
(!(downstream.state & State.LinkScopeOnly) || isScope)) {
|
|
778
776
|
Line.link(this, downstream);
|
|
779
777
|
}
|
|
780
778
|
try {
|
|
781
779
|
if (this.version === G.version) {
|
|
782
780
|
return this.value;
|
|
783
781
|
}
|
|
784
|
-
this.recEnd = null;
|
|
782
|
+
if (this.pull !== this.DEFAULT_PULL) this.recEnd = null;
|
|
785
783
|
this.state |= State.Pulling;
|
|
786
784
|
G.PullingSignal = this;
|
|
787
785
|
(_a = this.clean) == null ? void 0 : _a.call(this);
|
|
@@ -792,7 +790,6 @@ const _Signal = class _Signal {
|
|
|
792
790
|
this.clean = () => runWithPulling(fn, null);
|
|
793
791
|
v = this.value;
|
|
794
792
|
}
|
|
795
|
-
this.pull = this.customPull || this.DEFAULT_PULL;
|
|
796
793
|
this.value = v;
|
|
797
794
|
this.version = G.version;
|
|
798
795
|
return this.value;
|
|
@@ -800,6 +797,7 @@ const _Signal = class _Signal {
|
|
|
800
797
|
console.error("\u8BA1\u7B97\u5C5E\u6027\u62A5\u9519\u8FD9\u6B21\u4E0D\u89E6\u53D1\uFF0C\u540E\u7EED\u72B6\u6001\u53EF\u80FD\u51FA\u9519", error);
|
|
801
798
|
return this.value;
|
|
802
799
|
} finally {
|
|
800
|
+
this.pull = this.customPull || this.DEFAULT_PULL;
|
|
803
801
|
pullingPostprocess(this);
|
|
804
802
|
const toDel = (_b = this.recEnd) == null ? void 0 : _b.nextRecLine;
|
|
805
803
|
unlinkRecWithScope(toDel);
|
|
@@ -809,54 +807,64 @@ const _Signal = class _Signal {
|
|
|
809
807
|
}
|
|
810
808
|
pullDeep() {
|
|
811
809
|
const signal = this;
|
|
812
|
-
if (
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
}
|
|
821
|
-
node
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
node.
|
|
832
|
-
return;
|
|
833
|
-
} else {
|
|
834
|
-
const prevPulling = G.PullingSignal;
|
|
835
|
-
G.PullingSignal = downstream;
|
|
836
|
-
const prevValue = node.value;
|
|
837
|
-
node.pullRecurse(false);
|
|
838
|
-
if (prevValue !== node.value) {
|
|
810
|
+
if (signal.state & DirtyState) {
|
|
811
|
+
dfs(signal, {
|
|
812
|
+
isUp: true,
|
|
813
|
+
begin: ({ node }) => {
|
|
814
|
+
if (node.state & (State.Pulling | State.Dirty) || !(node.state & DirtyState) || node.isDisabled()) {
|
|
815
|
+
return true;
|
|
816
|
+
}
|
|
817
|
+
node.state |= State.Pulling;
|
|
818
|
+
},
|
|
819
|
+
complete: ({ node, notGoDeep: cleanOrDirty, walkedLine }) => {
|
|
820
|
+
const isDirty = node.state & State.Dirty;
|
|
821
|
+
let currentClean = cleanOrDirty && !isDirty;
|
|
822
|
+
if (cleanOrDirty && node.state & State.Pulling) {
|
|
823
|
+
currentClean = true;
|
|
824
|
+
}
|
|
825
|
+
let noGoSibling = false;
|
|
826
|
+
const last = walkedLine[walkedLine.length - 1];
|
|
827
|
+
const downstream2 = last == null ? void 0 : last.downstream;
|
|
828
|
+
if (currentClean) ; else if (isDirty) {
|
|
829
|
+
if (node.pull === node.DEFAULT_PULL && node.value !== node.nextValue) {
|
|
839
830
|
node.markDownStreamsDirty();
|
|
831
|
+
node.state &= ~State.Dirty;
|
|
832
|
+
node.state &= ~State.Pulling;
|
|
833
|
+
return;
|
|
834
|
+
} else {
|
|
835
|
+
const prevPulling = G.PullingSignal;
|
|
836
|
+
G.PullingSignal = downstream2;
|
|
837
|
+
const prevValue = node.value;
|
|
838
|
+
node.pullRecurse(false);
|
|
839
|
+
if (prevValue !== node.value) {
|
|
840
|
+
node.markDownStreamsDirty();
|
|
841
|
+
}
|
|
842
|
+
node.state &= ~State.Dirty;
|
|
843
|
+
G.PullingSignal = prevPulling;
|
|
844
|
+
noGoSibling = true;
|
|
840
845
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
noGoSibling = true;
|
|
846
|
+
} else if (node.state & State.Unknown) {
|
|
847
|
+
node.state &= ~State.Unknown;
|
|
844
848
|
}
|
|
845
|
-
|
|
846
|
-
node
|
|
849
|
+
node.version = G.version;
|
|
850
|
+
pullingPostprocess(node);
|
|
851
|
+
return noGoSibling;
|
|
847
852
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
const downstream = G.PullingSignal;
|
|
856
|
+
if (this !== downstream && // 2. 有下游
|
|
857
|
+
downstream && // 3. 下游是 watcher 不是 watch,或 是watcher 但 当前是 scope
|
|
858
|
+
(!(downstream.state & State.LinkScopeOnly) || this.state & State.IsScope)) {
|
|
859
|
+
Line.link(this, downstream);
|
|
860
|
+
}
|
|
853
861
|
return this.value;
|
|
854
862
|
}
|
|
855
863
|
get v() {
|
|
856
864
|
if (this.isDisabled()) {
|
|
857
865
|
return this.value;
|
|
858
866
|
}
|
|
859
|
-
if (!this.recStart) {
|
|
867
|
+
if (!this.recStart || this.pull === this.DEFAULT_PULL) {
|
|
860
868
|
return this.pullRecurse(true);
|
|
861
869
|
}
|
|
862
870
|
return this.pullDeep();
|
|
@@ -940,6 +948,7 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
940
948
|
case Keys.Meta:
|
|
941
949
|
return meta;
|
|
942
950
|
}
|
|
951
|
+
if (prop === Symbol.unscopables) return Reflect.get(obj, prop, receiver);
|
|
943
952
|
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
|
|
944
953
|
return Reflect.get(obj, prop, receiver);
|
|
945
954
|
}
|
|
@@ -970,7 +979,7 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
970
979
|
return s.v;
|
|
971
980
|
},
|
|
972
981
|
set(obj, prop, value, receiver) {
|
|
973
|
-
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
|
|
982
|
+
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop) || typeof value === "function") {
|
|
974
983
|
return Reflect.set(obj, prop, value, receiver);
|
|
975
984
|
}
|
|
976
985
|
batch.start();
|
|
@@ -989,7 +998,7 @@ const deepSignal = (target, scope, deep = true) => {
|
|
|
989
998
|
},
|
|
990
999
|
// 【核心修改】拦截 delete 操作
|
|
991
1000
|
deleteProperty(obj, prop) {
|
|
992
|
-
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop)) {
|
|
1001
|
+
if (targetIsStore && isIgnoreKey(obj.constructor[StoreIgnoreKeys], prop) || typeof obj[prop] === "function") {
|
|
993
1002
|
return Reflect.deleteProperty(obj, prop);
|
|
994
1003
|
}
|
|
995
1004
|
if (cells.has(prop)) {
|