@vue/reactivity 3.6.0-rc.5 → 3.6.0-rc.6
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 +64 -59
- package/dist/reactivity.cjs.prod.js +62 -57
- package/dist/reactivity.d.ts +466 -467
- package/dist/reactivity.esm-browser.js +65 -60
- package/dist/reactivity.esm-browser.prod.js +2 -2
- package/dist/reactivity.esm-bundler.js +64 -59
- package/dist/reactivity.global.js +65 -60
- 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.6
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -375,9 +375,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
375
375
|
if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
376
376
|
}
|
|
377
377
|
break;
|
|
378
|
-
case "set":
|
|
379
|
-
if (isMap(target)) run(depsMap.get(ITERATE_KEY));
|
|
380
|
-
break;
|
|
378
|
+
case "set": if (isMap(target)) run(depsMap.get(ITERATE_KEY));
|
|
381
379
|
}
|
|
382
380
|
}
|
|
383
381
|
}
|
|
@@ -574,8 +572,8 @@ function noTracking(self, method, args = []) {
|
|
|
574
572
|
}
|
|
575
573
|
//#endregion
|
|
576
574
|
//#region packages/reactivity/src/baseHandlers.ts
|
|
577
|
-
const isNonTrackableKeys =
|
|
578
|
-
const builtInSymbols = new Set(
|
|
575
|
+
const isNonTrackableKeys = /*@__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
576
|
+
const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
|
|
579
577
|
function hasOwnProperty(key) {
|
|
580
578
|
if (!isSymbol(key)) key = String(key);
|
|
581
579
|
const obj = /* @__PURE__ */ toRaw(this);
|
|
@@ -630,12 +628,14 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
|
630
628
|
oldValue = /* @__PURE__ */ toRaw(oldValue);
|
|
631
629
|
value = /* @__PURE__ */ toRaw(value);
|
|
632
630
|
}
|
|
633
|
-
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value))
|
|
634
|
-
if (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
631
|
+
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
|
|
632
|
+
if (isOldValueReadonly) {
|
|
633
|
+
if (!!(process.env.NODE_ENV !== "production")) warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target[key]);
|
|
634
|
+
return true;
|
|
635
|
+
} else {
|
|
636
|
+
oldValue.value = value;
|
|
637
|
+
return true;
|
|
638
|
+
}
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
@@ -676,10 +676,10 @@ var ReadonlyReactiveHandler = class extends BaseReactiveHandler {
|
|
|
676
676
|
return true;
|
|
677
677
|
}
|
|
678
678
|
};
|
|
679
|
-
const mutableHandlers =
|
|
680
|
-
const readonlyHandlers =
|
|
681
|
-
const shallowReactiveHandlers =
|
|
682
|
-
const shallowReadonlyHandlers =
|
|
679
|
+
const mutableHandlers = /*@__PURE__*/ new MutableReactiveHandler();
|
|
680
|
+
const readonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler();
|
|
681
|
+
const shallowReactiveHandlers = /*@__PURE__*/ new MutableReactiveHandler(true);
|
|
682
|
+
const shallowReadonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler(true);
|
|
683
683
|
//#endregion
|
|
684
684
|
//#region packages/reactivity/src/collectionHandlers.ts
|
|
685
685
|
const toShallow = (value) => value;
|
|
@@ -830,10 +830,10 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
830
830
|
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
|
-
const mutableCollectionHandlers = { get:
|
|
834
|
-
const shallowCollectionHandlers = { get:
|
|
835
|
-
const readonlyCollectionHandlers = { get:
|
|
836
|
-
const shallowReadonlyCollectionHandlers = { get:
|
|
833
|
+
const mutableCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, false) };
|
|
834
|
+
const shallowCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, true) };
|
|
835
|
+
const readonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, false) };
|
|
836
|
+
const shallowReadonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, true) };
|
|
837
837
|
function checkIdentityKeys(target, has, key) {
|
|
838
838
|
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
839
839
|
if (rawKey !== key && has.call(target, rawKey)) {
|
|
@@ -858,7 +858,7 @@ function targetTypeMap(rawType) {
|
|
|
858
858
|
default: return 0;
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
|
-
|
|
861
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
862
862
|
function reactive(target) {
|
|
863
863
|
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
864
864
|
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
@@ -893,7 +893,7 @@ function reactive(target) {
|
|
|
893
893
|
* @param target - The source object.
|
|
894
894
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
|
895
895
|
*/
|
|
896
|
-
|
|
896
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
897
897
|
function shallowReactive(target) {
|
|
898
898
|
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
899
899
|
}
|
|
@@ -926,7 +926,7 @@ function shallowReactive(target) {
|
|
|
926
926
|
* @param target - The source object.
|
|
927
927
|
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
|
928
928
|
*/
|
|
929
|
-
|
|
929
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
930
930
|
function readonly(target) {
|
|
931
931
|
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
932
932
|
}
|
|
@@ -960,7 +960,7 @@ function readonly(target) {
|
|
|
960
960
|
* @param target - The source object.
|
|
961
961
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
|
962
962
|
*/
|
|
963
|
-
|
|
963
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
964
964
|
function shallowReadonly(target) {
|
|
965
965
|
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
966
966
|
}
|
|
@@ -997,7 +997,7 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
997
997
|
* @param value - The value to check.
|
|
998
998
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
|
999
999
|
*/
|
|
1000
|
-
|
|
1000
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1001
1001
|
function isReactive(value) {
|
|
1002
1002
|
if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
1003
1003
|
return !!(value && value["__v_isReactive"]);
|
|
@@ -1013,11 +1013,11 @@ function isReactive(value) {
|
|
|
1013
1013
|
* @param value - The value to check.
|
|
1014
1014
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
|
1015
1015
|
*/
|
|
1016
|
-
|
|
1016
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1017
1017
|
function isReadonly(value) {
|
|
1018
1018
|
return !!(value && value["__v_isReadonly"]);
|
|
1019
1019
|
}
|
|
1020
|
-
|
|
1020
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1021
1021
|
function isShallow(value) {
|
|
1022
1022
|
return !!(value && value["__v_isShallow"]);
|
|
1023
1023
|
}
|
|
@@ -1028,7 +1028,7 @@ function isShallow(value) {
|
|
|
1028
1028
|
* @param value - The value to check.
|
|
1029
1029
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
|
1030
1030
|
*/
|
|
1031
|
-
|
|
1031
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1032
1032
|
function isProxy(value) {
|
|
1033
1033
|
return value ? !!value["__v_raw"] : false;
|
|
1034
1034
|
}
|
|
@@ -1055,7 +1055,7 @@ function isProxy(value) {
|
|
|
1055
1055
|
* @param observed - The object for which the "raw" value is requested.
|
|
1056
1056
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
|
1057
1057
|
*/
|
|
1058
|
-
|
|
1058
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1059
1059
|
function toRaw(observed) {
|
|
1060
1060
|
const raw = observed && observed["__v_raw"];
|
|
1061
1061
|
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
@@ -1104,15 +1104,15 @@ const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value)
|
|
|
1104
1104
|
const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1105
1105
|
//#endregion
|
|
1106
1106
|
//#region packages/reactivity/src/ref.ts
|
|
1107
|
-
|
|
1107
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1108
1108
|
function isRef(r) {
|
|
1109
1109
|
return r ? r["__v_isRef"] === true : false;
|
|
1110
1110
|
}
|
|
1111
|
-
|
|
1111
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1112
1112
|
function ref(value) {
|
|
1113
1113
|
return createRef(value, toReactive);
|
|
1114
1114
|
}
|
|
1115
|
-
|
|
1115
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1116
1116
|
function shallowRef(value) {
|
|
1117
1117
|
return createRef(value);
|
|
1118
1118
|
}
|
|
@@ -1315,7 +1315,7 @@ function customRef(factory) {
|
|
|
1315
1315
|
* @param object - Reactive object to be made into an object of linked refs.
|
|
1316
1316
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
|
1317
1317
|
*/
|
|
1318
|
-
|
|
1318
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1319
1319
|
function toRefs(object) {
|
|
1320
1320
|
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1321
1321
|
for (const key in object) ret[key] = propertyToRef(object, key);
|
|
@@ -1366,7 +1366,7 @@ var GetterRefImpl = class {
|
|
|
1366
1366
|
return this._value = this._getter();
|
|
1367
1367
|
}
|
|
1368
1368
|
};
|
|
1369
|
-
|
|
1369
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1370
1370
|
function toRef(source, key, defaultValue) {
|
|
1371
1371
|
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1372
1372
|
else if (isFunction(source)) return new GetterRefImpl(source);
|
|
@@ -1440,10 +1440,12 @@ var ReactiveEffect = class {
|
|
|
1440
1440
|
get dirty() {
|
|
1441
1441
|
const flags = this.flags;
|
|
1442
1442
|
if (flags & 16) return true;
|
|
1443
|
-
if (flags & 32)
|
|
1444
|
-
this.
|
|
1445
|
-
|
|
1446
|
-
|
|
1443
|
+
if (flags & 32) {
|
|
1444
|
+
if (checkDirty(this.deps, this)) {
|
|
1445
|
+
this.flags = flags | 16;
|
|
1446
|
+
return true;
|
|
1447
|
+
} else this.flags = flags & -33;
|
|
1448
|
+
}
|
|
1447
1449
|
return false;
|
|
1448
1450
|
}
|
|
1449
1451
|
};
|
|
@@ -1675,10 +1677,12 @@ var ComputedRefImpl = class {
|
|
|
1675
1677
|
get _dirty() {
|
|
1676
1678
|
const flags = this.flags;
|
|
1677
1679
|
if (flags & ReactiveFlags$1.Dirty) return true;
|
|
1678
|
-
if (flags & ReactiveFlags$1.Pending)
|
|
1679
|
-
this.
|
|
1680
|
-
|
|
1681
|
-
|
|
1680
|
+
if (flags & ReactiveFlags$1.Pending) {
|
|
1681
|
+
if (checkDirty(this.deps, this)) {
|
|
1682
|
+
this.flags = flags | ReactiveFlags$1.Dirty;
|
|
1683
|
+
return true;
|
|
1684
|
+
} else this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1685
|
+
}
|
|
1682
1686
|
return false;
|
|
1683
1687
|
}
|
|
1684
1688
|
/**
|
|
@@ -1739,7 +1743,7 @@ var ComputedRefImpl = class {
|
|
|
1739
1743
|
}
|
|
1740
1744
|
};
|
|
1741
1745
|
if (!!(process.env.NODE_ENV !== "production")) setupOnTrigger(ComputedRefImpl);
|
|
1742
|
-
|
|
1746
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1743
1747
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1744
1748
|
let getter;
|
|
1745
1749
|
let setter;
|
|
@@ -1833,25 +1837,26 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
1833
1837
|
else if (isFunction(s)) return call ? call(s, 2) : s();
|
|
1834
1838
|
else process.env.NODE_ENV !== "production" && warnInvalidSource(s, onWarn);
|
|
1835
1839
|
});
|
|
1836
|
-
} else if (isFunction(source))
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
+
} else if (isFunction(source)) {
|
|
1841
|
+
if (cb) getter = call ? () => call(source, 2) : source;
|
|
1842
|
+
else getter = () => {
|
|
1843
|
+
if (this.cleanupsLength) {
|
|
1844
|
+
const prevSub = setActiveSub();
|
|
1845
|
+
try {
|
|
1846
|
+
cleanup(this);
|
|
1847
|
+
} finally {
|
|
1848
|
+
setActiveSub(prevSub);
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
const currentEffect = activeWatcher;
|
|
1852
|
+
activeWatcher = this;
|
|
1840
1853
|
try {
|
|
1841
|
-
|
|
1854
|
+
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1842
1855
|
} finally {
|
|
1843
|
-
|
|
1856
|
+
activeWatcher = currentEffect;
|
|
1844
1857
|
}
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
activeWatcher = this;
|
|
1848
|
-
try {
|
|
1849
|
-
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1850
|
-
} finally {
|
|
1851
|
-
activeWatcher = currentEffect;
|
|
1852
|
-
}
|
|
1853
|
-
};
|
|
1854
|
-
else {
|
|
1858
|
+
};
|
|
1859
|
+
} else {
|
|
1855
1860
|
getter = NOOP;
|
|
1856
1861
|
process.env.NODE_ENV !== "production" && warnInvalidSource(source, onWarn);
|
|
1857
1862
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-rc.
|
|
2
|
+
* @vue/reactivity v3.6.0-rc.6
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -13,7 +13,7 @@ var VueReactivity = (function(exports) {
|
|
|
13
13
|
* \/\*#\_\_PURE\_\_\*\/
|
|
14
14
|
* So that they can be tree-shaken if necessary.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
17
17
|
function makeMap(str) {
|
|
18
18
|
const map = Object.create(null);
|
|
19
19
|
for (const key of str.split(",")) map[key] = 1;
|
|
@@ -431,9 +431,7 @@ var VueReactivity = (function(exports) {
|
|
|
431
431
|
if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
432
432
|
}
|
|
433
433
|
break;
|
|
434
|
-
case "set":
|
|
435
|
-
if (isMap(target)) run(depsMap.get(ITERATE_KEY));
|
|
436
|
-
break;
|
|
434
|
+
case "set": if (isMap(target)) run(depsMap.get(ITERATE_KEY));
|
|
437
435
|
}
|
|
438
436
|
}
|
|
439
437
|
}
|
|
@@ -630,8 +628,8 @@ var VueReactivity = (function(exports) {
|
|
|
630
628
|
}
|
|
631
629
|
//#endregion
|
|
632
630
|
//#region packages/reactivity/src/baseHandlers.ts
|
|
633
|
-
const isNonTrackableKeys =
|
|
634
|
-
const builtInSymbols = new Set(
|
|
631
|
+
const isNonTrackableKeys = /*@__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
632
|
+
const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
|
|
635
633
|
function hasOwnProperty(key) {
|
|
636
634
|
if (!isSymbol(key)) key = String(key);
|
|
637
635
|
const obj = /* @__PURE__ */ toRaw(this);
|
|
@@ -686,12 +684,14 @@ var VueReactivity = (function(exports) {
|
|
|
686
684
|
oldValue = /* @__PURE__ */ toRaw(oldValue);
|
|
687
685
|
value = /* @__PURE__ */ toRaw(value);
|
|
688
686
|
}
|
|
689
|
-
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value))
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
687
|
+
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
|
|
688
|
+
if (isOldValueReadonly) {
|
|
689
|
+
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target[key]);
|
|
690
|
+
return true;
|
|
691
|
+
} else {
|
|
692
|
+
oldValue.value = value;
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
697
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
@@ -732,10 +732,10 @@ var VueReactivity = (function(exports) {
|
|
|
732
732
|
return true;
|
|
733
733
|
}
|
|
734
734
|
};
|
|
735
|
-
const mutableHandlers =
|
|
736
|
-
const readonlyHandlers =
|
|
737
|
-
const shallowReactiveHandlers =
|
|
738
|
-
const shallowReadonlyHandlers =
|
|
735
|
+
const mutableHandlers = /*@__PURE__*/ new MutableReactiveHandler();
|
|
736
|
+
const readonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler();
|
|
737
|
+
const shallowReactiveHandlers = /*@__PURE__*/ new MutableReactiveHandler(true);
|
|
738
|
+
const shallowReadonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler(true);
|
|
739
739
|
//#endregion
|
|
740
740
|
//#region packages/reactivity/src/collectionHandlers.ts
|
|
741
741
|
const toShallow = (value) => value;
|
|
@@ -886,10 +886,10 @@ var VueReactivity = (function(exports) {
|
|
|
886
886
|
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
887
887
|
};
|
|
888
888
|
}
|
|
889
|
-
const mutableCollectionHandlers = { get:
|
|
890
|
-
const shallowCollectionHandlers = { get:
|
|
891
|
-
const readonlyCollectionHandlers = { get:
|
|
892
|
-
const shallowReadonlyCollectionHandlers = { get:
|
|
889
|
+
const mutableCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, false) };
|
|
890
|
+
const shallowCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, true) };
|
|
891
|
+
const readonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, false) };
|
|
892
|
+
const shallowReadonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, true) };
|
|
893
893
|
function checkIdentityKeys(target, has, key) {
|
|
894
894
|
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
895
895
|
if (rawKey !== key && has.call(target, rawKey)) {
|
|
@@ -914,7 +914,7 @@ var VueReactivity = (function(exports) {
|
|
|
914
914
|
default: return 0;
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
|
|
917
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
918
918
|
function reactive(target) {
|
|
919
919
|
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
920
920
|
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
@@ -949,7 +949,7 @@ var VueReactivity = (function(exports) {
|
|
|
949
949
|
* @param target - The source object.
|
|
950
950
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
|
951
951
|
*/
|
|
952
|
-
|
|
952
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
953
953
|
function shallowReactive(target) {
|
|
954
954
|
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
955
955
|
}
|
|
@@ -982,7 +982,7 @@ var VueReactivity = (function(exports) {
|
|
|
982
982
|
* @param target - The source object.
|
|
983
983
|
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
|
984
984
|
*/
|
|
985
|
-
|
|
985
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
986
986
|
function readonly(target) {
|
|
987
987
|
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
988
988
|
}
|
|
@@ -1016,7 +1016,7 @@ var VueReactivity = (function(exports) {
|
|
|
1016
1016
|
* @param target - The source object.
|
|
1017
1017
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
|
1018
1018
|
*/
|
|
1019
|
-
|
|
1019
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1020
1020
|
function shallowReadonly(target) {
|
|
1021
1021
|
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
1022
1022
|
}
|
|
@@ -1053,7 +1053,7 @@ var VueReactivity = (function(exports) {
|
|
|
1053
1053
|
* @param value - The value to check.
|
|
1054
1054
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
|
1055
1055
|
*/
|
|
1056
|
-
|
|
1056
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1057
1057
|
function isReactive(value) {
|
|
1058
1058
|
if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
1059
1059
|
return !!(value && value["__v_isReactive"]);
|
|
@@ -1069,11 +1069,11 @@ var VueReactivity = (function(exports) {
|
|
|
1069
1069
|
* @param value - The value to check.
|
|
1070
1070
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
|
1071
1071
|
*/
|
|
1072
|
-
|
|
1072
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1073
1073
|
function isReadonly(value) {
|
|
1074
1074
|
return !!(value && value["__v_isReadonly"]);
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1076
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1077
1077
|
function isShallow(value) {
|
|
1078
1078
|
return !!(value && value["__v_isShallow"]);
|
|
1079
1079
|
}
|
|
@@ -1084,7 +1084,7 @@ var VueReactivity = (function(exports) {
|
|
|
1084
1084
|
* @param value - The value to check.
|
|
1085
1085
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
|
1086
1086
|
*/
|
|
1087
|
-
|
|
1087
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1088
1088
|
function isProxy(value) {
|
|
1089
1089
|
return value ? !!value["__v_raw"] : false;
|
|
1090
1090
|
}
|
|
@@ -1111,7 +1111,7 @@ var VueReactivity = (function(exports) {
|
|
|
1111
1111
|
* @param observed - The object for which the "raw" value is requested.
|
|
1112
1112
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
|
1113
1113
|
*/
|
|
1114
|
-
|
|
1114
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1115
1115
|
function toRaw(observed) {
|
|
1116
1116
|
const raw = observed && observed["__v_raw"];
|
|
1117
1117
|
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
@@ -1160,15 +1160,15 @@ var VueReactivity = (function(exports) {
|
|
|
1160
1160
|
const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1161
1161
|
//#endregion
|
|
1162
1162
|
//#region packages/reactivity/src/ref.ts
|
|
1163
|
-
|
|
1163
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1164
1164
|
function isRef(r) {
|
|
1165
1165
|
return r ? r["__v_isRef"] === true : false;
|
|
1166
1166
|
}
|
|
1167
|
-
|
|
1167
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1168
1168
|
function ref(value) {
|
|
1169
1169
|
return createRef(value, toReactive);
|
|
1170
1170
|
}
|
|
1171
|
-
|
|
1171
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1172
1172
|
function shallowRef(value) {
|
|
1173
1173
|
return createRef(value);
|
|
1174
1174
|
}
|
|
@@ -1371,7 +1371,7 @@ var VueReactivity = (function(exports) {
|
|
|
1371
1371
|
* @param object - Reactive object to be made into an object of linked refs.
|
|
1372
1372
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
|
1373
1373
|
*/
|
|
1374
|
-
|
|
1374
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1375
1375
|
function toRefs(object) {
|
|
1376
1376
|
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1377
1377
|
for (const key in object) ret[key] = propertyToRef(object, key);
|
|
@@ -1422,7 +1422,7 @@ var VueReactivity = (function(exports) {
|
|
|
1422
1422
|
return this._value = this._getter();
|
|
1423
1423
|
}
|
|
1424
1424
|
};
|
|
1425
|
-
|
|
1425
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1426
1426
|
function toRef(source, key, defaultValue) {
|
|
1427
1427
|
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1428
1428
|
else if (isFunction(source)) return new GetterRefImpl(source);
|
|
@@ -1496,10 +1496,12 @@ var VueReactivity = (function(exports) {
|
|
|
1496
1496
|
get dirty() {
|
|
1497
1497
|
const flags = this.flags;
|
|
1498
1498
|
if (flags & 16) return true;
|
|
1499
|
-
if (flags & 32)
|
|
1500
|
-
this.
|
|
1501
|
-
|
|
1502
|
-
|
|
1499
|
+
if (flags & 32) {
|
|
1500
|
+
if (checkDirty(this.deps, this)) {
|
|
1501
|
+
this.flags = flags | 16;
|
|
1502
|
+
return true;
|
|
1503
|
+
} else this.flags = flags & -33;
|
|
1504
|
+
}
|
|
1503
1505
|
return false;
|
|
1504
1506
|
}
|
|
1505
1507
|
};
|
|
@@ -1731,10 +1733,12 @@ var VueReactivity = (function(exports) {
|
|
|
1731
1733
|
get _dirty() {
|
|
1732
1734
|
const flags = this.flags;
|
|
1733
1735
|
if (flags & ReactiveFlags$1.Dirty) return true;
|
|
1734
|
-
if (flags & ReactiveFlags$1.Pending)
|
|
1735
|
-
this.
|
|
1736
|
-
|
|
1737
|
-
|
|
1736
|
+
if (flags & ReactiveFlags$1.Pending) {
|
|
1737
|
+
if (checkDirty(this.deps, this)) {
|
|
1738
|
+
this.flags = flags | ReactiveFlags$1.Dirty;
|
|
1739
|
+
return true;
|
|
1740
|
+
} else this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1741
|
+
}
|
|
1738
1742
|
return false;
|
|
1739
1743
|
}
|
|
1740
1744
|
/**
|
|
@@ -1795,7 +1799,7 @@ var VueReactivity = (function(exports) {
|
|
|
1795
1799
|
}
|
|
1796
1800
|
};
|
|
1797
1801
|
setupOnTrigger(ComputedRefImpl);
|
|
1798
|
-
|
|
1802
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1799
1803
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1800
1804
|
let getter;
|
|
1801
1805
|
let setter;
|
|
@@ -1889,25 +1893,26 @@ var VueReactivity = (function(exports) {
|
|
|
1889
1893
|
else if (isFunction(s)) return call ? call(s, 2) : s();
|
|
1890
1894
|
else warnInvalidSource(s, onWarn);
|
|
1891
1895
|
});
|
|
1892
|
-
} else if (isFunction(source))
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
+
} else if (isFunction(source)) {
|
|
1897
|
+
if (cb) getter = call ? () => call(source, 2) : source;
|
|
1898
|
+
else getter = () => {
|
|
1899
|
+
if (this.cleanupsLength) {
|
|
1900
|
+
const prevSub = setActiveSub();
|
|
1901
|
+
try {
|
|
1902
|
+
cleanup(this);
|
|
1903
|
+
} finally {
|
|
1904
|
+
setActiveSub(prevSub);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
const currentEffect = activeWatcher;
|
|
1908
|
+
activeWatcher = this;
|
|
1896
1909
|
try {
|
|
1897
|
-
|
|
1910
|
+
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1898
1911
|
} finally {
|
|
1899
|
-
|
|
1912
|
+
activeWatcher = currentEffect;
|
|
1900
1913
|
}
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
activeWatcher = this;
|
|
1904
|
-
try {
|
|
1905
|
-
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1906
|
-
} finally {
|
|
1907
|
-
activeWatcher = currentEffect;
|
|
1908
|
-
}
|
|
1909
|
-
};
|
|
1910
|
-
else {
|
|
1914
|
+
};
|
|
1915
|
+
} else {
|
|
1911
1916
|
getter = NOOP;
|
|
1912
1917
|
warnInvalidSource(source, onWarn);
|
|
1913
1918
|
}
|