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