vue 2.7.0 → 2.7.1

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,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.7.0
2
+ * Vue.js v2.7.1
3
3
  * (c) 2014-2022 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -318,7 +318,7 @@ function hasChanged(x, y) {
318
318
  return x === 0 && 1 / x !== 1 / y;
319
319
  }
320
320
  else {
321
- return x === x && y === y;
321
+ return x === x || y === y;
322
322
  }
323
323
  }
324
324
 
@@ -925,6 +925,33 @@ function triggerRef(ref) {
925
925
  function unref(ref) {
926
926
  return isRef(ref) ? ref.value : ref;
927
927
  }
928
+ function proxyRefs(objectWithRefs) {
929
+ if (isReactive(objectWithRefs)) {
930
+ return objectWithRefs;
931
+ }
932
+ const proxy = {};
933
+ const keys = Object.keys(objectWithRefs);
934
+ for (let i = 0; i < keys.length; i++) {
935
+ proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
936
+ }
937
+ return proxy;
938
+ }
939
+ function proxyWithRefUnwrap(target, source, key) {
940
+ Object.defineProperty(target, key, {
941
+ enumerable: true,
942
+ configurable: true,
943
+ get: () => unref(source[key]),
944
+ set: value => {
945
+ const oldValue = source[key];
946
+ if (isRef(oldValue) && !isRef(value)) {
947
+ oldValue.value = value;
948
+ }
949
+ else {
950
+ source[key] = value;
951
+ }
952
+ }
953
+ });
954
+ }
928
955
  function customRef(factory) {
929
956
  const dep = new Dep();
930
957
  const { get, set } = factory(() => {
@@ -1461,7 +1488,9 @@ function initSetup(vm) {
1461
1488
  // exposed for compiled render fn
1462
1489
  const proxy = (vm._setupProxy = {});
1463
1490
  for (const key in setupResult) {
1464
- proxyWithRefUnwrap(proxy, setupResult, key);
1491
+ if (key !== '__sfc') {
1492
+ proxyWithRefUnwrap(proxy, setupResult, key);
1493
+ }
1465
1494
  }
1466
1495
  }
1467
1496
  }
@@ -1470,20 +1499,6 @@ function initSetup(vm) {
1470
1499
  }
1471
1500
  }
1472
1501
  }
1473
- function proxyWithRefUnwrap(target, source, key) {
1474
- Object.defineProperty(target, key, {
1475
- enumerable: true,
1476
- configurable: true,
1477
- get: () => {
1478
- const raw = source[key];
1479
- return isRef(raw) ? raw.value : raw;
1480
- },
1481
- set: newVal => {
1482
- const raw = source[key];
1483
- isRef(raw) ? (raw.value = newVal) : (source[key] = newVal);
1484
- }
1485
- });
1486
- }
1487
1502
  function createSetupContext(vm) {
1488
1503
  let exposeCalled = false;
1489
1504
  return {
@@ -4588,7 +4603,7 @@ const onServerPrefetch = createLifeCycle('serverPrefetch');
4588
4603
  const onRenderTracked = createLifeCycle('renderTracked');
4589
4604
  const onRenderTriggered = createLifeCycle('renderTriggered');
4590
4605
 
4591
- const version = '2.7.0';
4606
+ const version = '2.7.1';
4592
4607
  /**
4593
4608
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
4594
4609
  */
@@ -4606,6 +4621,7 @@ var vca = /*#__PURE__*/Object.freeze({
4606
4621
  toRef: toRef,
4607
4622
  toRefs: toRefs,
4608
4623
  unref: unref,
4624
+ proxyRefs: proxyRefs,
4609
4625
  customRef: customRef,
4610
4626
  triggerRef: triggerRef,
4611
4627
  reactive: reactive,
@@ -4793,7 +4809,7 @@ function defineReactive(obj, key, val, customSetter, shallow) {
4793
4809
  }
4794
4810
  }
4795
4811
  }
4796
- return isRef(value) ? value.value : value;
4812
+ return isRef(value) && !shallow ? value.value : value;
4797
4813
  },
4798
4814
  set: function reactiveSetter(newVal) {
4799
4815
  const value = getter ? getter.call(obj) : val;