@vue/reactivity 3.6.0-beta.7 → 3.6.0-beta.9

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.
@@ -1,11 +1,13 @@
1
1
  /**
2
- * @vue/reactivity v3.6.0-beta.7
2
+ * @vue/reactivity v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
6
+ Object.defineProperties(exports, {
7
+ __esModule: { value: true },
8
+ [Symbol.toStringTag]: { value: "Module" }
9
+ });
7
10
  let _vue_shared = require("@vue/shared");
8
-
9
11
  //#region packages/reactivity/src/debug.ts
10
12
  const triggerEventInfos = [];
11
13
  function onTrack(sub, debugInfo) {
@@ -40,13 +42,11 @@ function setupFlagsHandler(target) {
40
42
  }
41
43
  });
42
44
  }
43
-
44
45
  //#endregion
45
46
  //#region packages/reactivity/src/warning.ts
46
47
  function warn(msg, ...args) {
47
48
  console.warn(`[Vue warn] ${msg}`, ...args);
48
49
  }
49
-
50
50
  //#endregion
51
51
  //#region packages/reactivity/src/system.ts
52
52
  const ReactiveFlags$1 = {
@@ -272,7 +272,6 @@ function isValidLink(checkLink, sub) {
272
272
  }
273
273
  return false;
274
274
  }
275
-
276
275
  //#endregion
277
276
  //#region packages/reactivity/src/dep.ts
278
277
  var Dep = class {
@@ -383,7 +382,6 @@ function getDepFromReactive(object, key) {
383
382
  const depMap = targetMap.get(object);
384
383
  return depMap && depMap.get(key);
385
384
  }
386
-
387
385
  //#endregion
388
386
  //#region packages/reactivity/src/arrayInstrumentations.ts
389
387
  /**
@@ -531,16 +529,25 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
531
529
  }
532
530
  function reduce(self, method, fn, args) {
533
531
  const arr = shallowReadArray(self);
532
+ const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);
534
533
  let wrappedFn = fn;
534
+ let wrapInitialAccumulator = false;
535
535
  if (arr !== self) {
536
- if (!/* @__PURE__ */ isShallow(self)) wrappedFn = function(acc, item, index) {
537
- return fn.call(this, acc, toWrapped(self, item), index, self);
538
- };
539
- else if (fn.length > 3) wrappedFn = function(acc, item, index) {
536
+ if (needsWrap) {
537
+ wrapInitialAccumulator = args.length === 0;
538
+ wrappedFn = function(acc, item, index) {
539
+ if (wrapInitialAccumulator) {
540
+ wrapInitialAccumulator = false;
541
+ acc = toWrapped(self, acc);
542
+ }
543
+ return fn.call(this, acc, toWrapped(self, item), index, self);
544
+ };
545
+ } else if (fn.length > 3) wrappedFn = function(acc, item, index) {
540
546
  return fn.call(this, acc, item, index, self);
541
547
  };
542
548
  }
543
- return arr[method](wrappedFn, ...args);
549
+ const result = arr[method](wrappedFn, ...args);
550
+ return wrapInitialAccumulator ? toWrapped(self, result) : result;
544
551
  }
545
552
  function searchProxy(self, method, args) {
546
553
  const arr = /* @__PURE__ */ toRaw(self);
@@ -560,7 +567,6 @@ function noTracking(self, method, args = []) {
560
567
  endBatch();
561
568
  return res;
562
569
  }
563
-
564
570
  //#endregion
565
571
  //#region packages/reactivity/src/baseHandlers.ts
566
572
  const isNonTrackableKeys = /* @__PURE__ */ (0, _vue_shared.makeMap)(`__proto__,__v_isRef,__isVue`);
@@ -669,7 +675,6 @@ const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
669
675
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
670
676
  const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
671
677
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
672
-
673
678
  //#endregion
674
679
  //#region packages/reactivity/src/collectionHandlers.ts
675
680
  const toShallow = (value) => value;
@@ -754,11 +759,13 @@ function createInstrumentations(readonly, shallow) {
754
759
  clear: createReadonlyMethod("clear")
755
760
  } : {
756
761
  add(value) {
757
- if (!shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) value = /* @__PURE__ */ toRaw(value);
758
762
  const target = /* @__PURE__ */ toRaw(this);
759
- if (!getProto(target).has.call(target, value)) {
760
- target.add(value);
761
- trigger(target, "add", value, value);
763
+ const proto = getProto(target);
764
+ const rawValue = /* @__PURE__ */ toRaw(value);
765
+ const valueToAdd = !shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value) ? rawValue : value;
766
+ if (!(proto.has.call(target, valueToAdd) || (0, _vue_shared.hasChanged)(value, valueToAdd) && proto.has.call(target, value) || (0, _vue_shared.hasChanged)(rawValue, valueToAdd) && proto.has.call(target, rawValue))) {
767
+ target.add(valueToAdd);
768
+ trigger(target, "add", valueToAdd, valueToAdd);
762
769
  }
763
770
  return this;
764
771
  },
@@ -829,7 +836,6 @@ function checkIdentityKeys(target, has, key) {
829
836
  warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
830
837
  }
831
838
  }
832
-
833
839
  //#endregion
834
840
  //#region packages/reactivity/src/reactive.ts
835
841
  const reactiveMap = /* @__PURE__ */ new WeakMap();
@@ -1093,7 +1099,6 @@ const toReactive = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */
1093
1099
  * @param value - The value for which a readonly proxy shall be created.
1094
1100
  */
1095
1101
  const toReadonly = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */ readonly(value) : value;
1096
-
1097
1102
  //#endregion
1098
1103
  //#region packages/reactivity/src/ref.ts
1099
1104
  /* @__NO_SIDE_EFFECTS__ */
@@ -1314,16 +1319,16 @@ function toRefs(object) {
1314
1319
  return ret;
1315
1320
  }
1316
1321
  var ObjectRefImpl = class {
1317
- constructor(_object, _key, _defaultValue) {
1322
+ constructor(_object, key, _defaultValue) {
1318
1323
  this._object = _object;
1319
- this._key = _key;
1320
1324
  this._defaultValue = _defaultValue;
1321
1325
  this["__v_isRef"] = true;
1322
1326
  this._value = void 0;
1327
+ this._key = (0, _vue_shared.isSymbol)(key) ? key : String(key);
1323
1328
  this._raw = /* @__PURE__ */ toRaw(_object);
1324
1329
  let shallow = true;
1325
1330
  let obj = _object;
1326
- if (!(0, _vue_shared.isArray)(_object) || !(0, _vue_shared.isIntegerKey)(String(_key))) do
1331
+ if (!(0, _vue_shared.isArray)(_object) || (0, _vue_shared.isSymbol)(this._key) || !(0, _vue_shared.isIntegerKey)(this._key)) do
1327
1332
  shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
1328
1333
  while (shallow && (obj = obj["__v_raw"]));
1329
1334
  this._shallow = shallow;
@@ -1368,7 +1373,6 @@ function toRef(source, key, defaultValue) {
1368
1373
  function propertyToRef(source, key, defaultValue) {
1369
1374
  return new ObjectRefImpl(source, key, defaultValue);
1370
1375
  }
1371
-
1372
1376
  //#endregion
1373
1377
  //#region packages/reactivity/src/effect.ts
1374
1378
  const EffectFlags = {
@@ -1538,7 +1542,6 @@ function cleanupEffect(fn) {
1538
1542
  setActiveSub(prevSub);
1539
1543
  }
1540
1544
  }
1541
-
1542
1545
  //#endregion
1543
1546
  //#region packages/reactivity/src/effectScope.ts
1544
1547
  let activeEffectScope;
@@ -1647,7 +1650,6 @@ function onScopeDispose(fn, failSilently = false) {
1647
1650
  if (activeEffectScope !== void 0) activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1648
1651
  else if (!failSilently) warn("onScopeDispose() is called when there is no active effect scope to be associated with.");
1649
1652
  }
1650
-
1651
1653
  //#endregion
1652
1654
  //#region packages/reactivity/src/computed.ts
1653
1655
  /**
@@ -1748,7 +1750,6 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1748
1750
  }
1749
1751
  return cRef;
1750
1752
  }
1751
-
1752
1753
  //#endregion
1753
1754
  //#region packages/reactivity/src/constants.ts
1754
1755
  const TrackOpTypes = {
@@ -1770,7 +1771,6 @@ const ReactiveFlags = {
1770
1771
  "RAW": "__v_raw",
1771
1772
  "IS_REF": "__v_isRef"
1772
1773
  };
1773
-
1774
1774
  //#endregion
1775
1775
  //#region packages/reactivity/src/watch.ts
1776
1776
  const WatchErrorCodes = {
@@ -1930,7 +1930,6 @@ function traverse(value, depth = Infinity, seen) {
1930
1930
  }
1931
1931
  return value;
1932
1932
  }
1933
-
1934
1933
  //#endregion
1935
1934
  exports.ARRAY_ITERATE_KEY = ARRAY_ITERATE_KEY;
1936
1935
  exports.EffectFlags = EffectFlags;
@@ -1984,4 +1983,4 @@ exports.traverse = traverse;
1984
1983
  exports.trigger = trigger;
1985
1984
  exports.triggerRef = triggerRef;
1986
1985
  exports.unref = unref;
1987
- exports.watch = watch;
1986
+ exports.watch = watch;
@@ -1,11 +1,13 @@
1
1
  /**
2
- * @vue/reactivity v3.6.0-beta.7
2
+ * @vue/reactivity v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
6
+ Object.defineProperties(exports, {
7
+ __esModule: { value: true },
8
+ [Symbol.toStringTag]: { value: "Module" }
9
+ });
7
10
  let _vue_shared = require("@vue/shared");
8
-
9
11
  //#region packages/reactivity/src/system.ts
10
12
  const ReactiveFlags$1 = {
11
13
  "None": 0,
@@ -229,7 +231,6 @@ function isValidLink(checkLink, sub) {
229
231
  }
230
232
  return false;
231
233
  }
232
-
233
234
  //#endregion
234
235
  //#region packages/reactivity/src/dep.ts
235
236
  var Dep = class {
@@ -326,7 +327,6 @@ function getDepFromReactive(object, key) {
326
327
  const depMap = targetMap.get(object);
327
328
  return depMap && depMap.get(key);
328
329
  }
329
-
330
330
  //#endregion
331
331
  //#region packages/reactivity/src/arrayInstrumentations.ts
332
332
  /**
@@ -474,16 +474,25 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
474
474
  }
475
475
  function reduce(self, method, fn, args) {
476
476
  const arr = shallowReadArray(self);
477
+ const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);
477
478
  let wrappedFn = fn;
479
+ let wrapInitialAccumulator = false;
478
480
  if (arr !== self) {
479
- if (!/* @__PURE__ */ isShallow(self)) wrappedFn = function(acc, item, index) {
480
- return fn.call(this, acc, toWrapped(self, item), index, self);
481
- };
482
- else if (fn.length > 3) wrappedFn = function(acc, item, index) {
481
+ if (needsWrap) {
482
+ wrapInitialAccumulator = args.length === 0;
483
+ wrappedFn = function(acc, item, index) {
484
+ if (wrapInitialAccumulator) {
485
+ wrapInitialAccumulator = false;
486
+ acc = toWrapped(self, acc);
487
+ }
488
+ return fn.call(this, acc, toWrapped(self, item), index, self);
489
+ };
490
+ } else if (fn.length > 3) wrappedFn = function(acc, item, index) {
483
491
  return fn.call(this, acc, item, index, self);
484
492
  };
485
493
  }
486
- return arr[method](wrappedFn, ...args);
494
+ const result = arr[method](wrappedFn, ...args);
495
+ return wrapInitialAccumulator ? toWrapped(self, result) : result;
487
496
  }
488
497
  function searchProxy(self, method, args) {
489
498
  const arr = /* @__PURE__ */ toRaw(self);
@@ -503,7 +512,6 @@ function noTracking(self, method, args = []) {
503
512
  endBatch();
504
513
  return res;
505
514
  }
506
-
507
515
  //#endregion
508
516
  //#region packages/reactivity/src/baseHandlers.ts
509
517
  const isNonTrackableKeys = /* @__PURE__ */ (0, _vue_shared.makeMap)(`__proto__,__v_isRef,__isVue`);
@@ -608,7 +616,6 @@ const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
608
616
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
609
617
  const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
610
618
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
611
-
612
619
  //#endregion
613
620
  //#region packages/reactivity/src/collectionHandlers.ts
614
621
  const toShallow = (value) => value;
@@ -689,11 +696,13 @@ function createInstrumentations(readonly, shallow) {
689
696
  clear: createReadonlyMethod("clear")
690
697
  } : {
691
698
  add(value) {
692
- if (!shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) value = /* @__PURE__ */ toRaw(value);
693
699
  const target = /* @__PURE__ */ toRaw(this);
694
- if (!getProto(target).has.call(target, value)) {
695
- target.add(value);
696
- trigger(target, "add", value, value);
700
+ const proto = getProto(target);
701
+ const rawValue = /* @__PURE__ */ toRaw(value);
702
+ const valueToAdd = !shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value) ? rawValue : value;
703
+ if (!(proto.has.call(target, valueToAdd) || (0, _vue_shared.hasChanged)(value, valueToAdd) && proto.has.call(target, value) || (0, _vue_shared.hasChanged)(rawValue, valueToAdd) && proto.has.call(target, rawValue))) {
704
+ target.add(valueToAdd);
705
+ trigger(target, "add", valueToAdd, valueToAdd);
697
706
  }
698
707
  return this;
699
708
  },
@@ -757,7 +766,6 @@ const mutableCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGe
757
766
  const shallowCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(false, true) };
758
767
  const readonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, false) };
759
768
  const shallowReadonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, true) };
760
-
761
769
  //#endregion
762
770
  //#region packages/reactivity/src/reactive.ts
763
771
  const reactiveMap = /* @__PURE__ */ new WeakMap();
@@ -1018,7 +1026,6 @@ const toReactive = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */
1018
1026
  * @param value - The value for which a readonly proxy shall be created.
1019
1027
  */
1020
1028
  const toReadonly = (value) => (0, _vue_shared.isObject)(value) ? /* @__PURE__ */ readonly(value) : value;
1021
-
1022
1029
  //#endregion
1023
1030
  //#region packages/reactivity/src/ref.ts
1024
1031
  /* @__NO_SIDE_EFFECTS__ */
@@ -1224,16 +1231,16 @@ function toRefs(object) {
1224
1231
  return ret;
1225
1232
  }
1226
1233
  var ObjectRefImpl = class {
1227
- constructor(_object, _key, _defaultValue) {
1234
+ constructor(_object, key, _defaultValue) {
1228
1235
  this._object = _object;
1229
- this._key = _key;
1230
1236
  this._defaultValue = _defaultValue;
1231
1237
  this["__v_isRef"] = true;
1232
1238
  this._value = void 0;
1239
+ this._key = (0, _vue_shared.isSymbol)(key) ? key : String(key);
1233
1240
  this._raw = /* @__PURE__ */ toRaw(_object);
1234
1241
  let shallow = true;
1235
1242
  let obj = _object;
1236
- if (!(0, _vue_shared.isArray)(_object) || !(0, _vue_shared.isIntegerKey)(String(_key))) do
1243
+ if (!(0, _vue_shared.isArray)(_object) || (0, _vue_shared.isSymbol)(this._key) || !(0, _vue_shared.isIntegerKey)(this._key)) do
1237
1244
  shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
1238
1245
  while (shallow && (obj = obj["__v_raw"]));
1239
1246
  this._shallow = shallow;
@@ -1278,7 +1285,6 @@ function toRef(source, key, defaultValue) {
1278
1285
  function propertyToRef(source, key, defaultValue) {
1279
1286
  return new ObjectRefImpl(source, key, defaultValue);
1280
1287
  }
1281
-
1282
1288
  //#endregion
1283
1289
  //#region packages/reactivity/src/effect.ts
1284
1290
  const EffectFlags = {
@@ -1445,7 +1451,6 @@ function cleanupEffect(fn) {
1445
1451
  setActiveSub(prevSub);
1446
1452
  }
1447
1453
  }
1448
-
1449
1454
  //#endregion
1450
1455
  //#region packages/reactivity/src/effectScope.ts
1451
1456
  let activeEffectScope;
@@ -1553,7 +1558,6 @@ function setCurrentScope(scope) {
1553
1558
  function onScopeDispose(fn, failSilently = false) {
1554
1559
  if (activeEffectScope !== void 0) activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1555
1560
  }
1556
-
1557
1561
  //#endregion
1558
1562
  //#region packages/reactivity/src/computed.ts
1559
1563
  /**
@@ -1641,7 +1645,6 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1641
1645
  }
1642
1646
  return new ComputedRefImpl(getter, setter);
1643
1647
  }
1644
-
1645
1648
  //#endregion
1646
1649
  //#region packages/reactivity/src/constants.ts
1647
1650
  const TrackOpTypes = {
@@ -1663,7 +1666,6 @@ const ReactiveFlags = {
1663
1666
  "RAW": "__v_raw",
1664
1667
  "IS_REF": "__v_isRef"
1665
1668
  };
1666
-
1667
1669
  //#endregion
1668
1670
  //#region packages/reactivity/src/watch.ts
1669
1671
  const WatchErrorCodes = {
@@ -1814,7 +1816,6 @@ function traverse(value, depth = Infinity, seen) {
1814
1816
  }
1815
1817
  return value;
1816
1818
  }
1817
-
1818
1819
  //#endregion
1819
1820
  exports.ARRAY_ITERATE_KEY = ARRAY_ITERATE_KEY;
1820
1821
  exports.EffectFlags = EffectFlags;
@@ -1868,4 +1869,4 @@ exports.traverse = traverse;
1868
1869
  exports.trigger = trigger;
1869
1870
  exports.triggerRef = triggerRef;
1870
1871
  exports.unref = unref;
1871
- exports.watch = watch;
1872
+ exports.watch = watch;
@@ -279,7 +279,7 @@ export type Reactive<T> = UnwrapNestedRefs<T> & (T extends readonly any[] ? Reac
279
279
  export declare function reactive<T extends object>(target: T): Reactive<T>;
280
280
  declare const ShallowReactiveMarker: unique symbol;
281
281
  export type ShallowReactive<T> = T & {
282
- [ShallowReactiveMarker]?: true;
282
+ [ShallowReactiveMarker]: never;
283
283
  };
284
284
  /**
285
285
  * Shallow version of {@link reactive}.
@@ -619,6 +619,9 @@ export type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
619
619
  */
620
620
  export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
621
621
  export type ToRefs<T = any> = { [K in keyof T]: ToRef<T[K]> };
622
+ type ArrayStringKey<T> = T extends readonly any[] ? number extends T["length"] ? `${number}` : never : never;
623
+ type ToRefKey<T> = keyof T | ArrayStringKey<T>;
624
+ type ToRefValue<T extends object, K extends ToRefKey<T>> = K extends keyof T ? T[K] : T extends readonly (infer V)[] ? K extends ArrayStringKey<T> ? V : never : never;
622
625
  /**
623
626
  * Converts a reactive object to a plain object where each property of the
624
627
  * resulting object is a ref pointing to the corresponding property of the
@@ -673,8 +676,8 @@ export type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
673
676
  * @see {@link https://vuejs.org/api/reactivity-utilities.html#toref}
674
677
  */
675
678
  export declare function toRef<T>(value: T): T extends (() => infer R) ? Readonly<Ref<R>> : T extends Ref ? T : Ref<UnwrapRef<T>>;
676
- export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
677
- export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
679
+ export declare function toRef<T extends object, K extends ToRefKey<T>>(object: T, key: K): ToRef<ToRefValue<T, K>>;
680
+ export declare function toRef<T extends object, K extends ToRefKey<T>>(object: T, key: K, defaultValue: ToRefValue<T, K>): ToRef<Exclude<ToRefValue<T, K>, undefined>>;
678
681
  /**
679
682
  * This is a special exported interface for other packages to declare
680
683
  * additional types that should bail out for ref unwrapping. For example
@@ -695,8 +698,8 @@ export type UnwrapRef<T> = T extends ShallowRef<infer V, unknown> ? V : T extend
695
698
  type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
696
699
  [RawSymbol]?: true;
697
700
  } ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? { [K in keyof T]: UnwrapRefSimple<T[K]> } : T extends object & {
698
- [ShallowReactiveMarker]?: never;
699
- } ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]> } : T;
701
+ [ShallowReactiveMarker]: never;
702
+ } ? T : T extends object ? { [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]> } : T;
700
703
  //#endregion
701
704
  //#region temp/packages/reactivity/src/dep.d.ts
702
705
  export declare const ITERATE_KEY: unique symbol;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/reactivity v3.6.0-beta.7
2
+ * @vue/reactivity v3.6.0-beta.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -17,11 +17,10 @@ function makeMap(str) {
17
17
  for (const key of str.split(",")) map[key] = 1;
18
18
  return (val) => val in map;
19
19
  }
20
-
21
20
  //#endregion
22
21
  //#region packages/shared/src/general.ts
23
22
  const EMPTY_OBJ = Object.freeze({});
24
- const EMPTY_ARR = Object.freeze([]);
23
+ Object.freeze([]);
25
24
  const NOOP = () => {};
26
25
  const extend = Object.assign;
27
26
  const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
@@ -48,25 +47,16 @@ const cacheStringFunction = (fn) => {
48
47
  };
49
48
  const camelizeRE = /-(\w)/g;
50
49
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
51
- /**
52
- * @private
53
- */
54
- const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
50
+ cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
55
51
  const hyphenateRE = /\B([A-Z])/g;
56
- /**
57
- * @private
58
- */
59
- const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
52
+ cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
60
53
  /**
61
54
  * @private
62
55
  */
63
56
  const capitalize = cacheStringFunction((str) => {
64
57
  return str.charAt(0).toUpperCase() + str.slice(1);
65
58
  });
66
- /**
67
- * @private
68
- */
69
- const toHandlerKey = cacheStringFunction((str) => {
59
+ cacheStringFunction((str) => {
70
60
  return str ? `on${capitalize(str)}` : ``;
71
61
  });
72
62
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
@@ -78,7 +68,6 @@ const def = (obj, key, value, writable = false) => {
78
68
  value
79
69
  });
80
70
  };
81
-
82
71
  //#endregion
83
72
  //#region packages/reactivity/src/debug.ts
84
73
  const triggerEventInfos = [];
@@ -114,13 +103,11 @@ function setupFlagsHandler(target) {
114
103
  }
115
104
  });
116
105
  }
117
-
118
106
  //#endregion
119
107
  //#region packages/reactivity/src/warning.ts
120
108
  function warn(msg, ...args) {
121
109
  console.warn(`[Vue warn] ${msg}`, ...args);
122
110
  }
123
-
124
111
  //#endregion
125
112
  //#region packages/reactivity/src/system.ts
126
113
  const ReactiveFlags$1 = {
@@ -346,7 +333,6 @@ function isValidLink(checkLink, sub) {
346
333
  }
347
334
  return false;
348
335
  }
349
-
350
336
  //#endregion
351
337
  //#region packages/reactivity/src/dep.ts
352
338
  var Dep = class {
@@ -457,7 +443,6 @@ function getDepFromReactive(object, key) {
457
443
  const depMap = targetMap.get(object);
458
444
  return depMap && depMap.get(key);
459
445
  }
460
-
461
446
  //#endregion
462
447
  //#region packages/reactivity/src/arrayInstrumentations.ts
463
448
  /**
@@ -605,16 +590,25 @@ function apply(self, method, fn, thisArg, wrappedRetFn, args) {
605
590
  }
606
591
  function reduce(self, method, fn, args) {
607
592
  const arr = shallowReadArray(self);
593
+ const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);
608
594
  let wrappedFn = fn;
595
+ let wrapInitialAccumulator = false;
609
596
  if (arr !== self) {
610
- if (!/* @__PURE__ */ isShallow(self)) wrappedFn = function(acc, item, index) {
611
- return fn.call(this, acc, toWrapped(self, item), index, self);
612
- };
613
- else if (fn.length > 3) wrappedFn = function(acc, item, index) {
597
+ if (needsWrap) {
598
+ wrapInitialAccumulator = args.length === 0;
599
+ wrappedFn = function(acc, item, index) {
600
+ if (wrapInitialAccumulator) {
601
+ wrapInitialAccumulator = false;
602
+ acc = toWrapped(self, acc);
603
+ }
604
+ return fn.call(this, acc, toWrapped(self, item), index, self);
605
+ };
606
+ } else if (fn.length > 3) wrappedFn = function(acc, item, index) {
614
607
  return fn.call(this, acc, item, index, self);
615
608
  };
616
609
  }
617
- return arr[method](wrappedFn, ...args);
610
+ const result = arr[method](wrappedFn, ...args);
611
+ return wrapInitialAccumulator ? toWrapped(self, result) : result;
618
612
  }
619
613
  function searchProxy(self, method, args) {
620
614
  const arr = /* @__PURE__ */ toRaw(self);
@@ -634,7 +628,6 @@ function noTracking(self, method, args = []) {
634
628
  endBatch();
635
629
  return res;
636
630
  }
637
-
638
631
  //#endregion
639
632
  //#region packages/reactivity/src/baseHandlers.ts
640
633
  const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
@@ -743,7 +736,6 @@ const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
743
736
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
744
737
  const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
745
738
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
746
-
747
739
  //#endregion
748
740
  //#region packages/reactivity/src/collectionHandlers.ts
749
741
  const toShallow = (value) => value;
@@ -828,11 +820,13 @@ function createInstrumentations(readonly, shallow) {
828
820
  clear: createReadonlyMethod("clear")
829
821
  } : {
830
822
  add(value) {
831
- if (!shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) value = /* @__PURE__ */ toRaw(value);
832
823
  const target = /* @__PURE__ */ toRaw(this);
833
- if (!getProto(target).has.call(target, value)) {
834
- target.add(value);
835
- trigger(target, "add", value, value);
824
+ const proto = getProto(target);
825
+ const rawValue = /* @__PURE__ */ toRaw(value);
826
+ const valueToAdd = !shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value) ? rawValue : value;
827
+ if (!(proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue))) {
828
+ target.add(valueToAdd);
829
+ trigger(target, "add", valueToAdd, valueToAdd);
836
830
  }
837
831
  return this;
838
832
  },
@@ -903,7 +897,6 @@ function checkIdentityKeys(target, has, key) {
903
897
  warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
904
898
  }
905
899
  }
906
-
907
900
  //#endregion
908
901
  //#region packages/reactivity/src/reactive.ts
909
902
  const reactiveMap = /* @__PURE__ */ new WeakMap();
@@ -1167,7 +1160,6 @@ const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value)
1167
1160
  * @param value - The value for which a readonly proxy shall be created.
1168
1161
  */
1169
1162
  const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
1170
-
1171
1163
  //#endregion
1172
1164
  //#region packages/reactivity/src/ref.ts
1173
1165
  /* @__NO_SIDE_EFFECTS__ */
@@ -1388,16 +1380,16 @@ function toRefs(object) {
1388
1380
  return ret;
1389
1381
  }
1390
1382
  var ObjectRefImpl = class {
1391
- constructor(_object, _key, _defaultValue) {
1383
+ constructor(_object, key, _defaultValue) {
1392
1384
  this._object = _object;
1393
- this._key = _key;
1394
1385
  this._defaultValue = _defaultValue;
1395
1386
  this["__v_isRef"] = true;
1396
1387
  this._value = void 0;
1388
+ this._key = isSymbol(key) ? key : String(key);
1397
1389
  this._raw = /* @__PURE__ */ toRaw(_object);
1398
1390
  let shallow = true;
1399
1391
  let obj = _object;
1400
- if (!isArray(_object) || !isIntegerKey(String(_key))) do
1392
+ if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) do
1401
1393
  shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
1402
1394
  while (shallow && (obj = obj["__v_raw"]));
1403
1395
  this._shallow = shallow;
@@ -1442,7 +1434,6 @@ function toRef(source, key, defaultValue) {
1442
1434
  function propertyToRef(source, key, defaultValue) {
1443
1435
  return new ObjectRefImpl(source, key, defaultValue);
1444
1436
  }
1445
-
1446
1437
  //#endregion
1447
1438
  //#region packages/reactivity/src/effect.ts
1448
1439
  const EffectFlags = {
@@ -1612,7 +1603,6 @@ function cleanupEffect(fn) {
1612
1603
  setActiveSub(prevSub);
1613
1604
  }
1614
1605
  }
1615
-
1616
1606
  //#endregion
1617
1607
  //#region packages/reactivity/src/effectScope.ts
1618
1608
  let activeEffectScope;
@@ -1721,7 +1711,6 @@ function onScopeDispose(fn, failSilently = false) {
1721
1711
  if (activeEffectScope !== void 0) activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1722
1712
  else if (!failSilently) warn("onScopeDispose() is called when there is no active effect scope to be associated with.");
1723
1713
  }
1724
-
1725
1714
  //#endregion
1726
1715
  //#region packages/reactivity/src/computed.ts
1727
1716
  /**
@@ -1822,7 +1811,6 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1822
1811
  }
1823
1812
  return cRef;
1824
1813
  }
1825
-
1826
1814
  //#endregion
1827
1815
  //#region packages/reactivity/src/constants.ts
1828
1816
  const TrackOpTypes = {
@@ -1844,7 +1832,6 @@ const ReactiveFlags = {
1844
1832
  "RAW": "__v_raw",
1845
1833
  "IS_REF": "__v_isRef"
1846
1834
  };
1847
-
1848
1835
  //#endregion
1849
1836
  //#region packages/reactivity/src/watch.ts
1850
1837
  const WatchErrorCodes = {
@@ -2004,6 +1991,5 @@ function traverse(value, depth = Infinity, seen) {
2004
1991
  }
2005
1992
  return value;
2006
1993
  }
2007
-
2008
1994
  //#endregion
2009
- export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, WatcherEffect, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, setActiveSub, setCurrentScope, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch };
1995
+ export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, WatcherEffect, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, setActiveSub, setCurrentScope, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch };