@vue/reactivity 3.6.0-rc.1 → 3.6.0-rc.11
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/reactivity.cjs.js +137 -90
- package/dist/reactivity.cjs.prod.js +120 -88
- package/dist/reactivity.d.ts +468 -467
- package/dist/reactivity.esm-browser.js +128 -92
- package/dist/reactivity.esm-browser.prod.js +2 -2
- package/dist/reactivity.esm-bundler.js +127 -91
- package/dist/reactivity.global.js +138 -91
- package/dist/reactivity.global.prod.js +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-rc.
|
|
2
|
+
* @vue/reactivity v3.6.0-rc.11
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -9,22 +9,6 @@ Object.defineProperties(exports, {
|
|
|
9
9
|
});
|
|
10
10
|
let _vue_shared = require("@vue/shared");
|
|
11
11
|
//#region packages/reactivity/src/system.ts
|
|
12
|
-
const ReactiveFlags$1 = {
|
|
13
|
-
"None": 0,
|
|
14
|
-
"0": "None",
|
|
15
|
-
"Mutable": 1,
|
|
16
|
-
"1": "Mutable",
|
|
17
|
-
"Watching": 2,
|
|
18
|
-
"2": "Watching",
|
|
19
|
-
"RecursedCheck": 4,
|
|
20
|
-
"4": "RecursedCheck",
|
|
21
|
-
"Recursed": 8,
|
|
22
|
-
"8": "Recursed",
|
|
23
|
-
"Dirty": 16,
|
|
24
|
-
"16": "Dirty",
|
|
25
|
-
"Pending": 32,
|
|
26
|
-
"32": "Pending"
|
|
27
|
-
};
|
|
28
12
|
const notifyBuffer = [];
|
|
29
13
|
let batchDepth = 0;
|
|
30
14
|
let activeSub = void 0;
|
|
@@ -162,13 +146,23 @@ function endTracking(sub, prevSub) {
|
|
|
162
146
|
sub.flags &= -5;
|
|
163
147
|
}
|
|
164
148
|
function flush() {
|
|
149
|
+
let hasError = false;
|
|
150
|
+
let error;
|
|
165
151
|
while (notifyIndex < notifyBufferLength) {
|
|
166
152
|
const effect = notifyBuffer[notifyIndex];
|
|
167
153
|
notifyBuffer[notifyIndex++] = void 0;
|
|
168
|
-
|
|
154
|
+
try {
|
|
155
|
+
effect.notify();
|
|
156
|
+
} catch (err) {
|
|
157
|
+
if (!hasError) {
|
|
158
|
+
hasError = true;
|
|
159
|
+
error = err;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
169
162
|
}
|
|
170
163
|
notifyIndex = 0;
|
|
171
164
|
notifyBufferLength = 0;
|
|
165
|
+
if (hasError) throw error;
|
|
172
166
|
}
|
|
173
167
|
function checkDirty(link, sub) {
|
|
174
168
|
let stack;
|
|
@@ -252,9 +246,27 @@ var Dep = class {
|
|
|
252
246
|
}
|
|
253
247
|
set subs(value) {
|
|
254
248
|
this._subs = value;
|
|
255
|
-
if (value === void 0) this.map.delete(this.key);
|
|
249
|
+
if (value === void 0 && this.map) this.map.delete(this.key);
|
|
256
250
|
}
|
|
257
251
|
};
|
|
252
|
+
/**
|
|
253
|
+
* Tracks a dep its owner keys on its own, outside `targetMap`.
|
|
254
|
+
* @internal
|
|
255
|
+
*/
|
|
256
|
+
function trackDep(dep, target = dep, key = "value") {
|
|
257
|
+
if (activeSub !== void 0) link(dep, activeSub);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @internal
|
|
261
|
+
*/
|
|
262
|
+
function triggerDep(dep, target = dep, key = "value", newValue, oldValue) {
|
|
263
|
+
const subs = dep.subs;
|
|
264
|
+
if (subs !== void 0) {
|
|
265
|
+
propagate(subs);
|
|
266
|
+
shallowPropagate(subs);
|
|
267
|
+
if (!batchDepth) flush();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
258
270
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
259
271
|
const ITERATE_KEY = Symbol("");
|
|
260
272
|
const MAP_KEY_ITERATE_KEY = Symbol("");
|
|
@@ -321,9 +333,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
321
333
|
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
322
334
|
}
|
|
323
335
|
break;
|
|
324
|
-
case "set":
|
|
325
|
-
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(ITERATE_KEY));
|
|
326
|
-
break;
|
|
336
|
+
case "set": if ((0, _vue_shared.isMap)(target)) run(depsMap.get(ITERATE_KEY));
|
|
327
337
|
}
|
|
328
338
|
}
|
|
329
339
|
}
|
|
@@ -338,13 +348,17 @@ function getDepFromReactive(object, key) {
|
|
|
338
348
|
/**
|
|
339
349
|
* Track array iteration and return:
|
|
340
350
|
* - if input is reactive: a cloned raw array with reactive values
|
|
341
|
-
* - if input is
|
|
351
|
+
* - if input is readonly: a cloned raw array with readonly values, preserving
|
|
352
|
+
* reactivity
|
|
353
|
+
* - if input is raw or shallow: the original raw array
|
|
342
354
|
*/
|
|
343
355
|
function reactiveReadArray(array) {
|
|
344
356
|
const raw = /* @__PURE__ */ toRaw(array);
|
|
345
357
|
if (raw === array) return raw;
|
|
346
358
|
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
347
|
-
|
|
359
|
+
if (/* @__PURE__ */ isShallow(array)) return raw;
|
|
360
|
+
if (!/* @__PURE__ */ isReadonly(array)) return raw.map(toReactive);
|
|
361
|
+
return /* @__PURE__ */ isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
|
|
348
362
|
}
|
|
349
363
|
/**
|
|
350
364
|
* Track array iteration and return raw array
|
|
@@ -520,8 +534,8 @@ function noTracking(self, method, args = []) {
|
|
|
520
534
|
}
|
|
521
535
|
//#endregion
|
|
522
536
|
//#region packages/reactivity/src/baseHandlers.ts
|
|
523
|
-
const isNonTrackableKeys =
|
|
524
|
-
const builtInSymbols = new Set(
|
|
537
|
+
const isNonTrackableKeys = /*@__PURE__*/ (0, _vue_shared.makeMap)(`__proto__,__v_isRef,__isVue`);
|
|
538
|
+
const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(_vue_shared.isSymbol));
|
|
525
539
|
function hasOwnProperty(key) {
|
|
526
540
|
if (!(0, _vue_shared.isSymbol)(key)) key = String(key);
|
|
527
541
|
const obj = /* @__PURE__ */ toRaw(this);
|
|
@@ -576,10 +590,12 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
|
576
590
|
oldValue = /* @__PURE__ */ toRaw(oldValue);
|
|
577
591
|
value = /* @__PURE__ */ toRaw(value);
|
|
578
592
|
}
|
|
579
|
-
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value))
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
593
|
+
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
|
|
594
|
+
if (isOldValueReadonly) return true;
|
|
595
|
+
else {
|
|
596
|
+
oldValue.value = value;
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
583
599
|
}
|
|
584
600
|
}
|
|
585
601
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : (0, _vue_shared.hasOwn)(target, key);
|
|
@@ -618,10 +634,10 @@ var ReadonlyReactiveHandler = class extends BaseReactiveHandler {
|
|
|
618
634
|
return true;
|
|
619
635
|
}
|
|
620
636
|
};
|
|
621
|
-
const mutableHandlers =
|
|
622
|
-
const readonlyHandlers =
|
|
623
|
-
const shallowReactiveHandlers =
|
|
624
|
-
const shallowReadonlyHandlers =
|
|
637
|
+
const mutableHandlers = /*@__PURE__*/ new MutableReactiveHandler();
|
|
638
|
+
const readonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler();
|
|
639
|
+
const shallowReactiveHandlers = /*@__PURE__*/ new MutableReactiveHandler(true);
|
|
640
|
+
const shallowReadonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler(true);
|
|
625
641
|
//#endregion
|
|
626
642
|
//#region packages/reactivity/src/collectionHandlers.ts
|
|
627
643
|
const toShallow = (value) => value;
|
|
@@ -768,10 +784,10 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
768
784
|
return Reflect.get((0, _vue_shared.hasOwn)(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
769
785
|
};
|
|
770
786
|
}
|
|
771
|
-
const mutableCollectionHandlers = { get:
|
|
772
|
-
const shallowCollectionHandlers = { get:
|
|
773
|
-
const readonlyCollectionHandlers = { get:
|
|
774
|
-
const shallowReadonlyCollectionHandlers = { get:
|
|
787
|
+
const mutableCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, false) };
|
|
788
|
+
const shallowCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, true) };
|
|
789
|
+
const readonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, false) };
|
|
790
|
+
const shallowReadonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, true) };
|
|
775
791
|
//#endregion
|
|
776
792
|
//#region packages/reactivity/src/reactive.ts
|
|
777
793
|
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -789,7 +805,7 @@ function targetTypeMap(rawType) {
|
|
|
789
805
|
default: return 0;
|
|
790
806
|
}
|
|
791
807
|
}
|
|
792
|
-
|
|
808
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
793
809
|
function reactive(target) {
|
|
794
810
|
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
795
811
|
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
@@ -824,7 +840,7 @@ function reactive(target) {
|
|
|
824
840
|
* @param target - The source object.
|
|
825
841
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
|
826
842
|
*/
|
|
827
|
-
|
|
843
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
828
844
|
function shallowReactive(target) {
|
|
829
845
|
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
830
846
|
}
|
|
@@ -857,7 +873,7 @@ function shallowReactive(target) {
|
|
|
857
873
|
* @param target - The source object.
|
|
858
874
|
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
|
859
875
|
*/
|
|
860
|
-
|
|
876
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
861
877
|
function readonly(target) {
|
|
862
878
|
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
863
879
|
}
|
|
@@ -891,7 +907,7 @@ function readonly(target) {
|
|
|
891
907
|
* @param target - The source object.
|
|
892
908
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
|
893
909
|
*/
|
|
894
|
-
|
|
910
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
895
911
|
function shallowReadonly(target) {
|
|
896
912
|
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
897
913
|
}
|
|
@@ -925,7 +941,7 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
925
941
|
* @param value - The value to check.
|
|
926
942
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
|
927
943
|
*/
|
|
928
|
-
|
|
944
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
929
945
|
function isReactive(value) {
|
|
930
946
|
if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
931
947
|
return !!(value && value["__v_isReactive"]);
|
|
@@ -941,11 +957,11 @@ function isReactive(value) {
|
|
|
941
957
|
* @param value - The value to check.
|
|
942
958
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
|
943
959
|
*/
|
|
944
|
-
|
|
960
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
945
961
|
function isReadonly(value) {
|
|
946
962
|
return !!(value && value["__v_isReadonly"]);
|
|
947
963
|
}
|
|
948
|
-
|
|
964
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
949
965
|
function isShallow(value) {
|
|
950
966
|
return !!(value && value["__v_isShallow"]);
|
|
951
967
|
}
|
|
@@ -956,7 +972,7 @@ function isShallow(value) {
|
|
|
956
972
|
* @param value - The value to check.
|
|
957
973
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
|
958
974
|
*/
|
|
959
|
-
|
|
975
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
960
976
|
function isProxy(value) {
|
|
961
977
|
return value ? !!value["__v_raw"] : false;
|
|
962
978
|
}
|
|
@@ -983,7 +999,7 @@ function isProxy(value) {
|
|
|
983
999
|
* @param observed - The object for which the "raw" value is requested.
|
|
984
1000
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
|
985
1001
|
*/
|
|
986
|
-
|
|
1002
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
987
1003
|
function toRaw(observed) {
|
|
988
1004
|
const raw = observed && observed["__v_raw"];
|
|
989
1005
|
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
@@ -1032,15 +1048,15 @@ const toReactive = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */
|
|
|
1032
1048
|
const toReadonly = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1033
1049
|
//#endregion
|
|
1034
1050
|
//#region packages/reactivity/src/ref.ts
|
|
1035
|
-
|
|
1051
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1036
1052
|
function isRef(r) {
|
|
1037
1053
|
return r ? r["__v_isRef"] === true : false;
|
|
1038
1054
|
}
|
|
1039
|
-
|
|
1055
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1040
1056
|
function ref(value) {
|
|
1041
1057
|
return createRef(value, toReactive);
|
|
1042
1058
|
}
|
|
1043
|
-
|
|
1059
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1044
1060
|
function shallowRef(value) {
|
|
1045
1061
|
return createRef(value);
|
|
1046
1062
|
}
|
|
@@ -1055,7 +1071,7 @@ var RefImpl = class {
|
|
|
1055
1071
|
constructor(value, wrap) {
|
|
1056
1072
|
this.subs = void 0;
|
|
1057
1073
|
this.subsTail = void 0;
|
|
1058
|
-
this.flags =
|
|
1074
|
+
this.flags = 1;
|
|
1059
1075
|
this.__v_isRef = true;
|
|
1060
1076
|
this.__v_isShallow = false;
|
|
1061
1077
|
this._oldValue = this._rawValue = wrap ? /* @__PURE__ */ toRaw(value) : value;
|
|
@@ -1068,7 +1084,7 @@ var RefImpl = class {
|
|
|
1068
1084
|
}
|
|
1069
1085
|
get value() {
|
|
1070
1086
|
trackRef(this);
|
|
1071
|
-
if (this.flags &
|
|
1087
|
+
if (this.flags & 16 && this.update()) {
|
|
1072
1088
|
const subs = this.subs;
|
|
1073
1089
|
if (subs !== void 0) shallowPropagate(subs);
|
|
1074
1090
|
}
|
|
@@ -1079,7 +1095,7 @@ var RefImpl = class {
|
|
|
1079
1095
|
const useDirectValue = this["__v_isShallow"] || /* @__PURE__ */ isShallow(newValue) || /* @__PURE__ */ isReadonly(newValue);
|
|
1080
1096
|
newValue = useDirectValue ? newValue : /* @__PURE__ */ toRaw(newValue);
|
|
1081
1097
|
if ((0, _vue_shared.hasChanged)(newValue, oldValue)) {
|
|
1082
|
-
this.flags |=
|
|
1098
|
+
this.flags |= 16;
|
|
1083
1099
|
this._rawValue = newValue;
|
|
1084
1100
|
this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
|
|
1085
1101
|
const subs = this.subs;
|
|
@@ -1090,7 +1106,7 @@ var RefImpl = class {
|
|
|
1090
1106
|
}
|
|
1091
1107
|
}
|
|
1092
1108
|
update() {
|
|
1093
|
-
this.flags &=
|
|
1109
|
+
this.flags &= -17;
|
|
1094
1110
|
return (0, _vue_shared.hasChanged)(this._oldValue, this._oldValue = this._rawValue);
|
|
1095
1111
|
}
|
|
1096
1112
|
};
|
|
@@ -1193,7 +1209,7 @@ var CustomRefImpl = class {
|
|
|
1193
1209
|
constructor(factory) {
|
|
1194
1210
|
this.subs = void 0;
|
|
1195
1211
|
this.subsTail = void 0;
|
|
1196
|
-
this.flags =
|
|
1212
|
+
this.flags = 0;
|
|
1197
1213
|
this["__v_isRef"] = true;
|
|
1198
1214
|
this._value = void 0;
|
|
1199
1215
|
const { get, set } = factory(() => trackRef(this), () => triggerRef(this));
|
|
@@ -1228,7 +1244,7 @@ function customRef(factory) {
|
|
|
1228
1244
|
* @param object - Reactive object to be made into an object of linked refs.
|
|
1229
1245
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
|
1230
1246
|
*/
|
|
1231
|
-
|
|
1247
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1232
1248
|
function toRefs(object) {
|
|
1233
1249
|
const ret = (0, _vue_shared.isArray)(object) ? new Array(object.length) : {};
|
|
1234
1250
|
for (const key in object) ret[key] = propertyToRef(object, key);
|
|
@@ -1279,7 +1295,7 @@ var GetterRefImpl = class {
|
|
|
1279
1295
|
return this._value = this._getter();
|
|
1280
1296
|
}
|
|
1281
1297
|
};
|
|
1282
|
-
|
|
1298
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1283
1299
|
function toRef(source, key, defaultValue) {
|
|
1284
1300
|
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1285
1301
|
else if ((0, _vue_shared.isFunction)(source)) return new GetterRefImpl(source);
|
|
@@ -1353,10 +1369,12 @@ var ReactiveEffect = class {
|
|
|
1353
1369
|
get dirty() {
|
|
1354
1370
|
const flags = this.flags;
|
|
1355
1371
|
if (flags & 16) return true;
|
|
1356
|
-
if (flags & 32)
|
|
1357
|
-
this.
|
|
1358
|
-
|
|
1359
|
-
|
|
1372
|
+
if (flags & 32) {
|
|
1373
|
+
if (checkDirty(this.deps, this)) {
|
|
1374
|
+
this.flags = flags | 16;
|
|
1375
|
+
return true;
|
|
1376
|
+
} else this.flags = flags & -33;
|
|
1377
|
+
}
|
|
1360
1378
|
return false;
|
|
1361
1379
|
}
|
|
1362
1380
|
};
|
|
@@ -1583,11 +1601,13 @@ var ComputedRefImpl = class {
|
|
|
1583
1601
|
*/
|
|
1584
1602
|
get _dirty() {
|
|
1585
1603
|
const flags = this.flags;
|
|
1586
|
-
if (flags &
|
|
1587
|
-
if (flags &
|
|
1588
|
-
this.
|
|
1589
|
-
|
|
1590
|
-
|
|
1604
|
+
if (flags & 16) return true;
|
|
1605
|
+
if (flags & 32) {
|
|
1606
|
+
if (checkDirty(this.deps, this)) {
|
|
1607
|
+
this.flags = flags | 16;
|
|
1608
|
+
return true;
|
|
1609
|
+
} else this.flags = flags & -33;
|
|
1610
|
+
}
|
|
1591
1611
|
return false;
|
|
1592
1612
|
}
|
|
1593
1613
|
/**
|
|
@@ -1595,8 +1615,8 @@ var ComputedRefImpl = class {
|
|
|
1595
1615
|
* for backwards compat
|
|
1596
1616
|
*/
|
|
1597
1617
|
set _dirty(v) {
|
|
1598
|
-
if (v) this.flags |=
|
|
1599
|
-
else this.flags &=
|
|
1618
|
+
if (v) this.flags |= 16;
|
|
1619
|
+
else this.flags &= -49;
|
|
1600
1620
|
}
|
|
1601
1621
|
constructor(fn, setter) {
|
|
1602
1622
|
this.fn = fn;
|
|
@@ -1606,18 +1626,18 @@ var ComputedRefImpl = class {
|
|
|
1606
1626
|
this.subsTail = void 0;
|
|
1607
1627
|
this.deps = void 0;
|
|
1608
1628
|
this.depsTail = void 0;
|
|
1609
|
-
this.flags =
|
|
1629
|
+
this.flags = 17;
|
|
1610
1630
|
this.__v_isRef = true;
|
|
1611
1631
|
this["__v_isReadonly"] = !setter;
|
|
1612
1632
|
}
|
|
1613
1633
|
get value() {
|
|
1614
1634
|
const flags = this.flags;
|
|
1615
|
-
if (flags &
|
|
1635
|
+
if (flags & 16 || flags & 32 && checkDirty(this.deps, this)) {
|
|
1616
1636
|
if (this.update()) {
|
|
1617
1637
|
const subs = this.subs;
|
|
1618
1638
|
if (subs !== void 0) shallowPropagate(subs);
|
|
1619
1639
|
}
|
|
1620
|
-
} else if (flags &
|
|
1640
|
+
} else if (flags & 32) this.flags = flags & -33;
|
|
1621
1641
|
if (activeSub !== void 0) link(this, activeSub);
|
|
1622
1642
|
else if (activeEffectScope !== void 0) link(this, activeEffectScope);
|
|
1623
1643
|
return this._value;
|
|
@@ -1640,7 +1660,7 @@ var ComputedRefImpl = class {
|
|
|
1640
1660
|
}
|
|
1641
1661
|
}
|
|
1642
1662
|
};
|
|
1643
|
-
|
|
1663
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1644
1664
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1645
1665
|
let getter;
|
|
1646
1666
|
let setter;
|
|
@@ -1728,25 +1748,26 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
1728
1748
|
else if (/* @__PURE__ */ isReactive(s)) return reactiveGetter(s, deep);
|
|
1729
1749
|
else if ((0, _vue_shared.isFunction)(s)) return call ? call(s, 2) : s();
|
|
1730
1750
|
});
|
|
1731
|
-
} else if ((0, _vue_shared.isFunction)(source))
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1751
|
+
} else if ((0, _vue_shared.isFunction)(source)) {
|
|
1752
|
+
if (cb) getter = call ? () => call(source, 2) : source;
|
|
1753
|
+
else getter = () => {
|
|
1754
|
+
if (this.cleanupsLength) {
|
|
1755
|
+
const prevSub = setActiveSub();
|
|
1756
|
+
try {
|
|
1757
|
+
cleanup(this);
|
|
1758
|
+
} finally {
|
|
1759
|
+
setActiveSub(prevSub);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
const currentEffect = activeWatcher;
|
|
1763
|
+
activeWatcher = this;
|
|
1735
1764
|
try {
|
|
1736
|
-
|
|
1765
|
+
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1737
1766
|
} finally {
|
|
1738
|
-
|
|
1767
|
+
activeWatcher = currentEffect;
|
|
1739
1768
|
}
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
activeWatcher = this;
|
|
1743
|
-
try {
|
|
1744
|
-
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1745
|
-
} finally {
|
|
1746
|
-
activeWatcher = currentEffect;
|
|
1747
|
-
}
|
|
1748
|
-
};
|
|
1749
|
-
else getter = _vue_shared.NOOP;
|
|
1769
|
+
};
|
|
1770
|
+
} else getter = _vue_shared.NOOP;
|
|
1750
1771
|
if (cb && deep) {
|
|
1751
1772
|
const baseGetter = getter;
|
|
1752
1773
|
const depth = deep === true ? Infinity : deep;
|
|
@@ -1825,6 +1846,7 @@ function traverse(value, depth = Infinity, seen) {
|
|
|
1825
1846
|
}
|
|
1826
1847
|
//#endregion
|
|
1827
1848
|
exports.ARRAY_ITERATE_KEY = ARRAY_ITERATE_KEY;
|
|
1849
|
+
exports.Dep = Dep;
|
|
1828
1850
|
exports.EffectFlags = EffectFlags;
|
|
1829
1851
|
exports.EffectScope = EffectScope;
|
|
1830
1852
|
exports.ITERATE_KEY = ITERATE_KEY;
|
|
@@ -1835,11 +1857,18 @@ exports.TrackOpTypes = TrackOpTypes;
|
|
|
1835
1857
|
exports.TriggerOpTypes = TriggerOpTypes;
|
|
1836
1858
|
exports.WatchErrorCodes = WatchErrorCodes;
|
|
1837
1859
|
exports.WatcherEffect = WatcherEffect;
|
|
1860
|
+
Object.defineProperty(exports, "activeSub", {
|
|
1861
|
+
enumerable: true,
|
|
1862
|
+
get: function() {
|
|
1863
|
+
return activeSub;
|
|
1864
|
+
}
|
|
1865
|
+
});
|
|
1838
1866
|
exports.computed = computed;
|
|
1839
1867
|
exports.customRef = customRef;
|
|
1840
1868
|
exports.effect = effect;
|
|
1841
1869
|
exports.effectScope = effectScope;
|
|
1842
1870
|
exports.enableTracking = enableTracking;
|
|
1871
|
+
exports.endBatch = endBatch;
|
|
1843
1872
|
exports.getCurrentScope = getCurrentScope;
|
|
1844
1873
|
exports.getCurrentWatcher = getCurrentWatcher;
|
|
1845
1874
|
exports.isProxy = isProxy;
|
|
@@ -1864,6 +1893,7 @@ exports.shallowReactive = shallowReactive;
|
|
|
1864
1893
|
exports.shallowReadArray = shallowReadArray;
|
|
1865
1894
|
exports.shallowReadonly = shallowReadonly;
|
|
1866
1895
|
exports.shallowRef = shallowRef;
|
|
1896
|
+
exports.startBatch = startBatch;
|
|
1867
1897
|
exports.stop = stop;
|
|
1868
1898
|
exports.toRaw = toRaw;
|
|
1869
1899
|
exports.toReactive = toReactive;
|
|
@@ -1872,8 +1902,10 @@ exports.toRef = toRef;
|
|
|
1872
1902
|
exports.toRefs = toRefs;
|
|
1873
1903
|
exports.toValue = toValue;
|
|
1874
1904
|
exports.track = track;
|
|
1905
|
+
exports.trackDep = trackDep;
|
|
1875
1906
|
exports.traverse = traverse;
|
|
1876
1907
|
exports.trigger = trigger;
|
|
1908
|
+
exports.triggerDep = triggerDep;
|
|
1877
1909
|
exports.triggerRef = triggerRef;
|
|
1878
1910
|
exports.unref = unref;
|
|
1879
1911
|
exports.watch = watch;
|