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
  */
@@ -316,7 +316,7 @@ function hasChanged(x, y) {
316
316
  return x === 0 && 1 / x !== 1 / y;
317
317
  }
318
318
  else {
319
- return x === x && y === y;
319
+ return x === x || y === y;
320
320
  }
321
321
  }
322
322
 
@@ -923,6 +923,33 @@ function triggerRef(ref) {
923
923
  function unref(ref) {
924
924
  return isRef(ref) ? ref.value : ref;
925
925
  }
926
+ function proxyRefs(objectWithRefs) {
927
+ if (isReactive(objectWithRefs)) {
928
+ return objectWithRefs;
929
+ }
930
+ const proxy = {};
931
+ const keys = Object.keys(objectWithRefs);
932
+ for (let i = 0; i < keys.length; i++) {
933
+ proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
934
+ }
935
+ return proxy;
936
+ }
937
+ function proxyWithRefUnwrap(target, source, key) {
938
+ Object.defineProperty(target, key, {
939
+ enumerable: true,
940
+ configurable: true,
941
+ get: () => unref(source[key]),
942
+ set: value => {
943
+ const oldValue = source[key];
944
+ if (isRef(oldValue) && !isRef(value)) {
945
+ oldValue.value = value;
946
+ }
947
+ else {
948
+ source[key] = value;
949
+ }
950
+ }
951
+ });
952
+ }
926
953
  function customRef(factory) {
927
954
  const dep = new Dep();
928
955
  const { get, set } = factory(() => {
@@ -1459,7 +1486,9 @@ function initSetup(vm) {
1459
1486
  // exposed for compiled render fn
1460
1487
  const proxy = (vm._setupProxy = {});
1461
1488
  for (const key in setupResult) {
1462
- proxyWithRefUnwrap(proxy, setupResult, key);
1489
+ if (key !== '__sfc') {
1490
+ proxyWithRefUnwrap(proxy, setupResult, key);
1491
+ }
1463
1492
  }
1464
1493
  }
1465
1494
  }
@@ -1468,20 +1497,6 @@ function initSetup(vm) {
1468
1497
  }
1469
1498
  }
1470
1499
  }
1471
- function proxyWithRefUnwrap(target, source, key) {
1472
- Object.defineProperty(target, key, {
1473
- enumerable: true,
1474
- configurable: true,
1475
- get: () => {
1476
- const raw = source[key];
1477
- return isRef(raw) ? raw.value : raw;
1478
- },
1479
- set: newVal => {
1480
- const raw = source[key];
1481
- isRef(raw) ? (raw.value = newVal) : (source[key] = newVal);
1482
- }
1483
- });
1484
- }
1485
1500
  function createSetupContext(vm) {
1486
1501
  let exposeCalled = false;
1487
1502
  return {
@@ -4580,7 +4595,7 @@ const onServerPrefetch = createLifeCycle('serverPrefetch');
4580
4595
  const onRenderTracked = createLifeCycle('renderTracked');
4581
4596
  const onRenderTriggered = createLifeCycle('renderTriggered');
4582
4597
 
4583
- const version = '2.7.0';
4598
+ const version = '2.7.1';
4584
4599
  /**
4585
4600
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
4586
4601
  */
@@ -4728,7 +4743,7 @@ function defineReactive(obj, key, val, customSetter, shallow) {
4728
4743
  }
4729
4744
  }
4730
4745
  }
4731
- return isRef(value) ? value.value : value;
4746
+ return isRef(value) && !shallow ? value.value : value;
4732
4747
  },
4733
4748
  set: function reactiveSetter(newVal) {
4734
4749
  const value = getter ? getter.call(obj) : val;
@@ -11488,4 +11503,4 @@ function getOuterHTML(el) {
11488
11503
  }
11489
11504
  Vue.compile = compileToFunctions;
11490
11505
 
11491
- export { EffectScope, computed, customRef, Vue as default, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, reactive, readonly, ref$1 as ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };
11506
+ export { EffectScope, computed, customRef, Vue as default, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref$1 as ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };