@vue/reactivity 3.6.0-rc.5 → 3.6.0-rc.7
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
package/dist/reactivity.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-rc.
|
|
2
|
+
* @vue/reactivity v3.6.0-rc.7
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -376,9 +376,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
376
376
|
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
377
377
|
}
|
|
378
378
|
break;
|
|
379
|
-
case "set":
|
|
380
|
-
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(ITERATE_KEY));
|
|
381
|
-
break;
|
|
379
|
+
case "set": if ((0, _vue_shared.isMap)(target)) run(depsMap.get(ITERATE_KEY));
|
|
382
380
|
}
|
|
383
381
|
}
|
|
384
382
|
}
|
|
@@ -575,8 +573,8 @@ function noTracking(self, method, args = []) {
|
|
|
575
573
|
}
|
|
576
574
|
//#endregion
|
|
577
575
|
//#region packages/reactivity/src/baseHandlers.ts
|
|
578
|
-
const isNonTrackableKeys =
|
|
579
|
-
const builtInSymbols = new Set(
|
|
576
|
+
const isNonTrackableKeys = /*@__PURE__*/ (0, _vue_shared.makeMap)(`__proto__,__v_isRef,__isVue`);
|
|
577
|
+
const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(_vue_shared.isSymbol));
|
|
580
578
|
function hasOwnProperty(key) {
|
|
581
579
|
if (!(0, _vue_shared.isSymbol)(key)) key = String(key);
|
|
582
580
|
const obj = /* @__PURE__ */ toRaw(this);
|
|
@@ -631,12 +629,14 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
|
631
629
|
oldValue = /* @__PURE__ */ toRaw(oldValue);
|
|
632
630
|
value = /* @__PURE__ */ toRaw(value);
|
|
633
631
|
}
|
|
634
|
-
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value))
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
632
|
+
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
|
|
633
|
+
if (isOldValueReadonly) {
|
|
634
|
+
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target[key]);
|
|
635
|
+
return true;
|
|
636
|
+
} else {
|
|
637
|
+
oldValue.value = value;
|
|
638
|
+
return true;
|
|
639
|
+
}
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : (0, _vue_shared.hasOwn)(target, key);
|
|
@@ -677,10 +677,10 @@ var ReadonlyReactiveHandler = class extends BaseReactiveHandler {
|
|
|
677
677
|
return true;
|
|
678
678
|
}
|
|
679
679
|
};
|
|
680
|
-
const mutableHandlers =
|
|
681
|
-
const readonlyHandlers =
|
|
682
|
-
const shallowReactiveHandlers =
|
|
683
|
-
const shallowReadonlyHandlers =
|
|
680
|
+
const mutableHandlers = /*@__PURE__*/ new MutableReactiveHandler();
|
|
681
|
+
const readonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler();
|
|
682
|
+
const shallowReactiveHandlers = /*@__PURE__*/ new MutableReactiveHandler(true);
|
|
683
|
+
const shallowReadonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler(true);
|
|
684
684
|
//#endregion
|
|
685
685
|
//#region packages/reactivity/src/collectionHandlers.ts
|
|
686
686
|
const toShallow = (value) => value;
|
|
@@ -831,10 +831,10 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
831
831
|
return Reflect.get((0, _vue_shared.hasOwn)(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
832
832
|
};
|
|
833
833
|
}
|
|
834
|
-
const mutableCollectionHandlers = { get:
|
|
835
|
-
const shallowCollectionHandlers = { get:
|
|
836
|
-
const readonlyCollectionHandlers = { get:
|
|
837
|
-
const shallowReadonlyCollectionHandlers = { get:
|
|
834
|
+
const mutableCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, false) };
|
|
835
|
+
const shallowCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, true) };
|
|
836
|
+
const readonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, false) };
|
|
837
|
+
const shallowReadonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, true) };
|
|
838
838
|
function checkIdentityKeys(target, has, key) {
|
|
839
839
|
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
840
840
|
if (rawKey !== key && has.call(target, rawKey)) {
|
|
@@ -859,7 +859,7 @@ function targetTypeMap(rawType) {
|
|
|
859
859
|
default: return 0;
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
|
|
862
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
863
863
|
function reactive(target) {
|
|
864
864
|
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
865
865
|
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
@@ -894,7 +894,7 @@ function reactive(target) {
|
|
|
894
894
|
* @param target - The source object.
|
|
895
895
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
|
896
896
|
*/
|
|
897
|
-
|
|
897
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
898
898
|
function shallowReactive(target) {
|
|
899
899
|
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
900
900
|
}
|
|
@@ -927,7 +927,7 @@ function shallowReactive(target) {
|
|
|
927
927
|
* @param target - The source object.
|
|
928
928
|
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
|
929
929
|
*/
|
|
930
|
-
|
|
930
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
931
931
|
function readonly(target) {
|
|
932
932
|
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
933
933
|
}
|
|
@@ -961,7 +961,7 @@ function readonly(target) {
|
|
|
961
961
|
* @param target - The source object.
|
|
962
962
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
|
963
963
|
*/
|
|
964
|
-
|
|
964
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
965
965
|
function shallowReadonly(target) {
|
|
966
966
|
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
967
967
|
}
|
|
@@ -998,7 +998,7 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
998
998
|
* @param value - The value to check.
|
|
999
999
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
|
1000
1000
|
*/
|
|
1001
|
-
|
|
1001
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1002
1002
|
function isReactive(value) {
|
|
1003
1003
|
if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
1004
1004
|
return !!(value && value["__v_isReactive"]);
|
|
@@ -1014,11 +1014,11 @@ function isReactive(value) {
|
|
|
1014
1014
|
* @param value - The value to check.
|
|
1015
1015
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
|
1016
1016
|
*/
|
|
1017
|
-
|
|
1017
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1018
1018
|
function isReadonly(value) {
|
|
1019
1019
|
return !!(value && value["__v_isReadonly"]);
|
|
1020
1020
|
}
|
|
1021
|
-
|
|
1021
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1022
1022
|
function isShallow(value) {
|
|
1023
1023
|
return !!(value && value["__v_isShallow"]);
|
|
1024
1024
|
}
|
|
@@ -1029,7 +1029,7 @@ function isShallow(value) {
|
|
|
1029
1029
|
* @param value - The value to check.
|
|
1030
1030
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
|
1031
1031
|
*/
|
|
1032
|
-
|
|
1032
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1033
1033
|
function isProxy(value) {
|
|
1034
1034
|
return value ? !!value["__v_raw"] : false;
|
|
1035
1035
|
}
|
|
@@ -1056,7 +1056,7 @@ function isProxy(value) {
|
|
|
1056
1056
|
* @param observed - The object for which the "raw" value is requested.
|
|
1057
1057
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
|
1058
1058
|
*/
|
|
1059
|
-
|
|
1059
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1060
1060
|
function toRaw(observed) {
|
|
1061
1061
|
const raw = observed && observed["__v_raw"];
|
|
1062
1062
|
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
@@ -1105,15 +1105,15 @@ const toReactive = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */
|
|
|
1105
1105
|
const toReadonly = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1106
1106
|
//#endregion
|
|
1107
1107
|
//#region packages/reactivity/src/ref.ts
|
|
1108
|
-
|
|
1108
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1109
1109
|
function isRef(r) {
|
|
1110
1110
|
return r ? r["__v_isRef"] === true : false;
|
|
1111
1111
|
}
|
|
1112
|
-
|
|
1112
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1113
1113
|
function ref(value) {
|
|
1114
1114
|
return createRef(value, toReactive);
|
|
1115
1115
|
}
|
|
1116
|
-
|
|
1116
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1117
1117
|
function shallowRef(value) {
|
|
1118
1118
|
return createRef(value);
|
|
1119
1119
|
}
|
|
@@ -1316,7 +1316,7 @@ function customRef(factory) {
|
|
|
1316
1316
|
* @param object - Reactive object to be made into an object of linked refs.
|
|
1317
1317
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
|
1318
1318
|
*/
|
|
1319
|
-
|
|
1319
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1320
1320
|
function toRefs(object) {
|
|
1321
1321
|
const ret = (0, _vue_shared.isArray)(object) ? new Array(object.length) : {};
|
|
1322
1322
|
for (const key in object) ret[key] = propertyToRef(object, key);
|
|
@@ -1367,7 +1367,7 @@ var GetterRefImpl = class {
|
|
|
1367
1367
|
return this._value = this._getter();
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
1370
|
-
|
|
1370
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1371
1371
|
function toRef(source, key, defaultValue) {
|
|
1372
1372
|
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1373
1373
|
else if ((0, _vue_shared.isFunction)(source)) return new GetterRefImpl(source);
|
|
@@ -1441,10 +1441,12 @@ var ReactiveEffect = class {
|
|
|
1441
1441
|
get dirty() {
|
|
1442
1442
|
const flags = this.flags;
|
|
1443
1443
|
if (flags & 16) return true;
|
|
1444
|
-
if (flags & 32)
|
|
1445
|
-
this.
|
|
1446
|
-
|
|
1447
|
-
|
|
1444
|
+
if (flags & 32) {
|
|
1445
|
+
if (checkDirty(this.deps, this)) {
|
|
1446
|
+
this.flags = flags | 16;
|
|
1447
|
+
return true;
|
|
1448
|
+
} else this.flags = flags & -33;
|
|
1449
|
+
}
|
|
1448
1450
|
return false;
|
|
1449
1451
|
}
|
|
1450
1452
|
};
|
|
@@ -1676,10 +1678,12 @@ var ComputedRefImpl = class {
|
|
|
1676
1678
|
get _dirty() {
|
|
1677
1679
|
const flags = this.flags;
|
|
1678
1680
|
if (flags & ReactiveFlags$1.Dirty) return true;
|
|
1679
|
-
if (flags & ReactiveFlags$1.Pending)
|
|
1680
|
-
this.
|
|
1681
|
-
|
|
1682
|
-
|
|
1681
|
+
if (flags & ReactiveFlags$1.Pending) {
|
|
1682
|
+
if (checkDirty(this.deps, this)) {
|
|
1683
|
+
this.flags = flags | ReactiveFlags$1.Dirty;
|
|
1684
|
+
return true;
|
|
1685
|
+
} else this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1686
|
+
}
|
|
1683
1687
|
return false;
|
|
1684
1688
|
}
|
|
1685
1689
|
/**
|
|
@@ -1740,7 +1744,7 @@ var ComputedRefImpl = class {
|
|
|
1740
1744
|
}
|
|
1741
1745
|
};
|
|
1742
1746
|
setupOnTrigger(ComputedRefImpl);
|
|
1743
|
-
|
|
1747
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1744
1748
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1745
1749
|
let getter;
|
|
1746
1750
|
let setter;
|
|
@@ -1834,25 +1838,26 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
1834
1838
|
else if ((0, _vue_shared.isFunction)(s)) return call ? call(s, 2) : s();
|
|
1835
1839
|
else warnInvalidSource(s, onWarn);
|
|
1836
1840
|
});
|
|
1837
|
-
} else if ((0, _vue_shared.isFunction)(source))
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
+
} else if ((0, _vue_shared.isFunction)(source)) {
|
|
1842
|
+
if (cb) getter = call ? () => call(source, 2) : source;
|
|
1843
|
+
else getter = () => {
|
|
1844
|
+
if (this.cleanupsLength) {
|
|
1845
|
+
const prevSub = setActiveSub();
|
|
1846
|
+
try {
|
|
1847
|
+
cleanup(this);
|
|
1848
|
+
} finally {
|
|
1849
|
+
setActiveSub(prevSub);
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
const currentEffect = activeWatcher;
|
|
1853
|
+
activeWatcher = this;
|
|
1841
1854
|
try {
|
|
1842
|
-
|
|
1855
|
+
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1843
1856
|
} finally {
|
|
1844
|
-
|
|
1857
|
+
activeWatcher = currentEffect;
|
|
1845
1858
|
}
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
activeWatcher = this;
|
|
1849
|
-
try {
|
|
1850
|
-
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1851
|
-
} finally {
|
|
1852
|
-
activeWatcher = currentEffect;
|
|
1853
|
-
}
|
|
1854
|
-
};
|
|
1855
|
-
else {
|
|
1859
|
+
};
|
|
1860
|
+
} else {
|
|
1856
1861
|
getter = _vue_shared.NOOP;
|
|
1857
1862
|
warnInvalidSource(source, onWarn);
|
|
1858
1863
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/reactivity v3.6.0-rc.
|
|
2
|
+
* @vue/reactivity v3.6.0-rc.7
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -321,9 +321,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
321
321
|
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
322
322
|
}
|
|
323
323
|
break;
|
|
324
|
-
case "set":
|
|
325
|
-
if ((0, _vue_shared.isMap)(target)) run(depsMap.get(ITERATE_KEY));
|
|
326
|
-
break;
|
|
324
|
+
case "set": if ((0, _vue_shared.isMap)(target)) run(depsMap.get(ITERATE_KEY));
|
|
327
325
|
}
|
|
328
326
|
}
|
|
329
327
|
}
|
|
@@ -520,8 +518,8 @@ function noTracking(self, method, args = []) {
|
|
|
520
518
|
}
|
|
521
519
|
//#endregion
|
|
522
520
|
//#region packages/reactivity/src/baseHandlers.ts
|
|
523
|
-
const isNonTrackableKeys =
|
|
524
|
-
const builtInSymbols = new Set(
|
|
521
|
+
const isNonTrackableKeys = /*@__PURE__*/ (0, _vue_shared.makeMap)(`__proto__,__v_isRef,__isVue`);
|
|
522
|
+
const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(_vue_shared.isSymbol));
|
|
525
523
|
function hasOwnProperty(key) {
|
|
526
524
|
if (!(0, _vue_shared.isSymbol)(key)) key = String(key);
|
|
527
525
|
const obj = /* @__PURE__ */ toRaw(this);
|
|
@@ -576,10 +574,12 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
|
576
574
|
oldValue = /* @__PURE__ */ toRaw(oldValue);
|
|
577
575
|
value = /* @__PURE__ */ toRaw(value);
|
|
578
576
|
}
|
|
579
|
-
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value))
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
577
|
+
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
|
|
578
|
+
if (isOldValueReadonly) return true;
|
|
579
|
+
else {
|
|
580
|
+
oldValue.value = value;
|
|
581
|
+
return true;
|
|
582
|
+
}
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : (0, _vue_shared.hasOwn)(target, key);
|
|
@@ -618,10 +618,10 @@ var ReadonlyReactiveHandler = class extends BaseReactiveHandler {
|
|
|
618
618
|
return true;
|
|
619
619
|
}
|
|
620
620
|
};
|
|
621
|
-
const mutableHandlers =
|
|
622
|
-
const readonlyHandlers =
|
|
623
|
-
const shallowReactiveHandlers =
|
|
624
|
-
const shallowReadonlyHandlers =
|
|
621
|
+
const mutableHandlers = /*@__PURE__*/ new MutableReactiveHandler();
|
|
622
|
+
const readonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler();
|
|
623
|
+
const shallowReactiveHandlers = /*@__PURE__*/ new MutableReactiveHandler(true);
|
|
624
|
+
const shallowReadonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler(true);
|
|
625
625
|
//#endregion
|
|
626
626
|
//#region packages/reactivity/src/collectionHandlers.ts
|
|
627
627
|
const toShallow = (value) => value;
|
|
@@ -768,10 +768,10 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
768
768
|
return Reflect.get((0, _vue_shared.hasOwn)(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
769
769
|
};
|
|
770
770
|
}
|
|
771
|
-
const mutableCollectionHandlers = { get:
|
|
772
|
-
const shallowCollectionHandlers = { get:
|
|
773
|
-
const readonlyCollectionHandlers = { get:
|
|
774
|
-
const shallowReadonlyCollectionHandlers = { get:
|
|
771
|
+
const mutableCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, false) };
|
|
772
|
+
const shallowCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, true) };
|
|
773
|
+
const readonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, false) };
|
|
774
|
+
const shallowReadonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, true) };
|
|
775
775
|
//#endregion
|
|
776
776
|
//#region packages/reactivity/src/reactive.ts
|
|
777
777
|
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -789,7 +789,7 @@ function targetTypeMap(rawType) {
|
|
|
789
789
|
default: return 0;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
|
-
|
|
792
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
793
793
|
function reactive(target) {
|
|
794
794
|
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
795
795
|
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
@@ -824,7 +824,7 @@ function reactive(target) {
|
|
|
824
824
|
* @param target - The source object.
|
|
825
825
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
|
826
826
|
*/
|
|
827
|
-
|
|
827
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
828
828
|
function shallowReactive(target) {
|
|
829
829
|
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
830
830
|
}
|
|
@@ -857,7 +857,7 @@ function shallowReactive(target) {
|
|
|
857
857
|
* @param target - The source object.
|
|
858
858
|
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
|
859
859
|
*/
|
|
860
|
-
|
|
860
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
861
861
|
function readonly(target) {
|
|
862
862
|
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
863
863
|
}
|
|
@@ -891,7 +891,7 @@ function readonly(target) {
|
|
|
891
891
|
* @param target - The source object.
|
|
892
892
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
|
893
893
|
*/
|
|
894
|
-
|
|
894
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
895
895
|
function shallowReadonly(target) {
|
|
896
896
|
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
897
897
|
}
|
|
@@ -925,7 +925,7 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
925
925
|
* @param value - The value to check.
|
|
926
926
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
|
927
927
|
*/
|
|
928
|
-
|
|
928
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
929
929
|
function isReactive(value) {
|
|
930
930
|
if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
931
931
|
return !!(value && value["__v_isReactive"]);
|
|
@@ -941,11 +941,11 @@ function isReactive(value) {
|
|
|
941
941
|
* @param value - The value to check.
|
|
942
942
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
|
943
943
|
*/
|
|
944
|
-
|
|
944
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
945
945
|
function isReadonly(value) {
|
|
946
946
|
return !!(value && value["__v_isReadonly"]);
|
|
947
947
|
}
|
|
948
|
-
|
|
948
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
949
949
|
function isShallow(value) {
|
|
950
950
|
return !!(value && value["__v_isShallow"]);
|
|
951
951
|
}
|
|
@@ -956,7 +956,7 @@ function isShallow(value) {
|
|
|
956
956
|
* @param value - The value to check.
|
|
957
957
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
|
958
958
|
*/
|
|
959
|
-
|
|
959
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
960
960
|
function isProxy(value) {
|
|
961
961
|
return value ? !!value["__v_raw"] : false;
|
|
962
962
|
}
|
|
@@ -983,7 +983,7 @@ function isProxy(value) {
|
|
|
983
983
|
* @param observed - The object for which the "raw" value is requested.
|
|
984
984
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
|
985
985
|
*/
|
|
986
|
-
|
|
986
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
987
987
|
function toRaw(observed) {
|
|
988
988
|
const raw = observed && observed["__v_raw"];
|
|
989
989
|
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
@@ -1032,15 +1032,15 @@ const toReactive = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */
|
|
|
1032
1032
|
const toReadonly = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1033
1033
|
//#endregion
|
|
1034
1034
|
//#region packages/reactivity/src/ref.ts
|
|
1035
|
-
|
|
1035
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1036
1036
|
function isRef(r) {
|
|
1037
1037
|
return r ? r["__v_isRef"] === true : false;
|
|
1038
1038
|
}
|
|
1039
|
-
|
|
1039
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1040
1040
|
function ref(value) {
|
|
1041
1041
|
return createRef(value, toReactive);
|
|
1042
1042
|
}
|
|
1043
|
-
|
|
1043
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1044
1044
|
function shallowRef(value) {
|
|
1045
1045
|
return createRef(value);
|
|
1046
1046
|
}
|
|
@@ -1228,7 +1228,7 @@ function customRef(factory) {
|
|
|
1228
1228
|
* @param object - Reactive object to be made into an object of linked refs.
|
|
1229
1229
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
|
1230
1230
|
*/
|
|
1231
|
-
|
|
1231
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1232
1232
|
function toRefs(object) {
|
|
1233
1233
|
const ret = (0, _vue_shared.isArray)(object) ? new Array(object.length) : {};
|
|
1234
1234
|
for (const key in object) ret[key] = propertyToRef(object, key);
|
|
@@ -1279,7 +1279,7 @@ var GetterRefImpl = class {
|
|
|
1279
1279
|
return this._value = this._getter();
|
|
1280
1280
|
}
|
|
1281
1281
|
};
|
|
1282
|
-
|
|
1282
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1283
1283
|
function toRef(source, key, defaultValue) {
|
|
1284
1284
|
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1285
1285
|
else if ((0, _vue_shared.isFunction)(source)) return new GetterRefImpl(source);
|
|
@@ -1353,10 +1353,12 @@ var ReactiveEffect = class {
|
|
|
1353
1353
|
get dirty() {
|
|
1354
1354
|
const flags = this.flags;
|
|
1355
1355
|
if (flags & 16) return true;
|
|
1356
|
-
if (flags & 32)
|
|
1357
|
-
this.
|
|
1358
|
-
|
|
1359
|
-
|
|
1356
|
+
if (flags & 32) {
|
|
1357
|
+
if (checkDirty(this.deps, this)) {
|
|
1358
|
+
this.flags = flags | 16;
|
|
1359
|
+
return true;
|
|
1360
|
+
} else this.flags = flags & -33;
|
|
1361
|
+
}
|
|
1360
1362
|
return false;
|
|
1361
1363
|
}
|
|
1362
1364
|
};
|
|
@@ -1584,10 +1586,12 @@ var ComputedRefImpl = class {
|
|
|
1584
1586
|
get _dirty() {
|
|
1585
1587
|
const flags = this.flags;
|
|
1586
1588
|
if (flags & ReactiveFlags$1.Dirty) return true;
|
|
1587
|
-
if (flags & ReactiveFlags$1.Pending)
|
|
1588
|
-
this.
|
|
1589
|
-
|
|
1590
|
-
|
|
1589
|
+
if (flags & ReactiveFlags$1.Pending) {
|
|
1590
|
+
if (checkDirty(this.deps, this)) {
|
|
1591
|
+
this.flags = flags | ReactiveFlags$1.Dirty;
|
|
1592
|
+
return true;
|
|
1593
|
+
} else this.flags = flags & ~ReactiveFlags$1.Pending;
|
|
1594
|
+
}
|
|
1591
1595
|
return false;
|
|
1592
1596
|
}
|
|
1593
1597
|
/**
|
|
@@ -1640,7 +1644,7 @@ var ComputedRefImpl = class {
|
|
|
1640
1644
|
}
|
|
1641
1645
|
}
|
|
1642
1646
|
};
|
|
1643
|
-
|
|
1647
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1644
1648
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1645
1649
|
let getter;
|
|
1646
1650
|
let setter;
|
|
@@ -1728,25 +1732,26 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
1728
1732
|
else if (/* @__PURE__ */ isReactive(s)) return reactiveGetter(s, deep);
|
|
1729
1733
|
else if ((0, _vue_shared.isFunction)(s)) return call ? call(s, 2) : s();
|
|
1730
1734
|
});
|
|
1731
|
-
} else if ((0, _vue_shared.isFunction)(source))
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
+
} else if ((0, _vue_shared.isFunction)(source)) {
|
|
1736
|
+
if (cb) getter = call ? () => call(source, 2) : source;
|
|
1737
|
+
else getter = () => {
|
|
1738
|
+
if (this.cleanupsLength) {
|
|
1739
|
+
const prevSub = setActiveSub();
|
|
1740
|
+
try {
|
|
1741
|
+
cleanup(this);
|
|
1742
|
+
} finally {
|
|
1743
|
+
setActiveSub(prevSub);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
const currentEffect = activeWatcher;
|
|
1747
|
+
activeWatcher = this;
|
|
1735
1748
|
try {
|
|
1736
|
-
|
|
1749
|
+
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
1737
1750
|
} finally {
|
|
1738
|
-
|
|
1751
|
+
activeWatcher = currentEffect;
|
|
1739
1752
|
}
|
|
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;
|
|
1753
|
+
};
|
|
1754
|
+
} else getter = _vue_shared.NOOP;
|
|
1750
1755
|
if (cb && deep) {
|
|
1751
1756
|
const baseGetter = getter;
|
|
1752
1757
|
const depth = deep === true ? Infinity : deep;
|