vue 2.7.7 → 2.7.8

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.7
2
+ * Vue.js v2.7.8
3
3
  * (c) 2014-2022 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -920,7 +920,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
920
920
  // #7981: for accessor properties without setter
921
921
  return;
922
922
  }
923
- else if (isRef(value) && !isRef(newVal)) {
923
+ else if (!shallow && isRef(value) && !isRef(newVal)) {
924
924
  value.value = newVal;
925
925
  return;
926
926
  }
@@ -2453,7 +2453,19 @@ function createSetupContext(vm) {
2453
2453
  var exposeCalled = false;
2454
2454
  return {
2455
2455
  get attrs() {
2456
- return initAttrsProxy(vm);
2456
+ if (!vm._attrsProxy) {
2457
+ var proxy = (vm._attrsProxy = {});
2458
+ def(proxy, '_v_attr_proxy', true);
2459
+ syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
2460
+ }
2461
+ return vm._attrsProxy;
2462
+ },
2463
+ get listeners() {
2464
+ if (!vm._listenersProxy) {
2465
+ var proxy = (vm._listenersProxy = {});
2466
+ syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
2467
+ }
2468
+ return vm._listenersProxy;
2457
2469
  },
2458
2470
  get slots() {
2459
2471
  return initSlotsProxy(vm);
@@ -2474,20 +2486,12 @@ function createSetupContext(vm) {
2474
2486
  }
2475
2487
  };
2476
2488
  }
2477
- function initAttrsProxy(vm) {
2478
- if (!vm._attrsProxy) {
2479
- var proxy = (vm._attrsProxy = {});
2480
- def(proxy, '_v_attr_proxy', true);
2481
- syncSetupAttrs(proxy, vm.$attrs, emptyObject, vm);
2482
- }
2483
- return vm._attrsProxy;
2484
- }
2485
- function syncSetupAttrs(to, from, prev, instance) {
2489
+ function syncSetupProxy(to, from, prev, instance, type) {
2486
2490
  var changed = false;
2487
2491
  for (var key in from) {
2488
2492
  if (!(key in to)) {
2489
2493
  changed = true;
2490
- defineProxyAttr(to, key, instance);
2494
+ defineProxyAttr(to, key, instance, type);
2491
2495
  }
2492
2496
  else if (from[key] !== prev[key]) {
2493
2497
  changed = true;
@@ -2501,12 +2505,12 @@ function syncSetupAttrs(to, from, prev, instance) {
2501
2505
  }
2502
2506
  return changed;
2503
2507
  }
2504
- function defineProxyAttr(proxy, key, instance) {
2508
+ function defineProxyAttr(proxy, key, instance, type) {
2505
2509
  Object.defineProperty(proxy, key, {
2506
2510
  enumerable: true,
2507
2511
  configurable: true,
2508
2512
  get: function () {
2509
- return instance.$attrs[key];
2513
+ return instance[type][key];
2510
2514
  }
2511
2515
  });
2512
2516
  }
@@ -2527,17 +2531,27 @@ function syncSetupSlots(to, from) {
2527
2531
  }
2528
2532
  }
2529
2533
  /**
2530
- * @internal use manual type def
2534
+ * @internal use manual type def because public setup context type relies on
2535
+ * legacy VNode types
2531
2536
  */
2532
2537
  function useSlots() {
2533
2538
  return getContext().slots;
2534
2539
  }
2535
2540
  /**
2536
- * @internal use manual type def
2541
+ * @internal use manual type def because public setup context type relies on
2542
+ * legacy VNode types
2537
2543
  */
2538
2544
  function useAttrs() {
2539
2545
  return getContext().attrs;
2540
2546
  }
2547
+ /**
2548
+ * Vue 2 only
2549
+ * @internal use manual type def because public setup context type relies on
2550
+ * legacy VNode types
2551
+ */
2552
+ function useListeners() {
2553
+ return getContext().listeners;
2554
+ }
2541
2555
  function getContext() {
2542
2556
  if (process.env.NODE_ENV !== 'production' && !currentInstance) {
2543
2557
  warn("useContext() called without active instance.");
@@ -3276,7 +3290,7 @@ var onRenderTriggered = createLifeCycle('renderTriggered');
3276
3290
  /**
3277
3291
  * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
3278
3292
  */
3279
- var version = '2.7.7';
3293
+ var version = '2.7.8';
3280
3294
  /**
3281
3295
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
3282
3296
  */
@@ -3884,12 +3898,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
3884
3898
  if (vm._attrsProxy) {
3885
3899
  // force update if attrs are accessed and has changed since it may be
3886
3900
  // passed to a child component.
3887
- if (syncSetupAttrs(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm)) {
3901
+ if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
3888
3902
  needsForceUpdate = true;
3889
3903
  }
3890
3904
  }
3891
3905
  vm.$attrs = attrs;
3892
- vm.$listeners = listeners || emptyObject;
3906
+ // update listeners
3907
+ listeners = listeners || emptyObject;
3908
+ var prevListeners = vm.$options._parentListeners;
3909
+ if (vm._listenersProxy) {
3910
+ syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
3911
+ }
3912
+ vm.$listeners = vm.$options._parentListeners = listeners;
3913
+ updateComponentListeners(vm, listeners, prevListeners);
3893
3914
  // update props
3894
3915
  if (propsData && vm.$options.props) {
3895
3916
  toggleObserving(false);
@@ -3904,11 +3925,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
3904
3925
  // keep a copy of raw propsData
3905
3926
  vm.$options.propsData = propsData;
3906
3927
  }
3907
- // update listeners
3908
- listeners = listeners || emptyObject;
3909
- var oldListeners = vm.$options._parentListeners;
3910
- vm.$options._parentListeners = listeners;
3911
- updateComponentListeners(vm, listeners, oldListeners);
3912
3928
  // resolve slots + force update if has children
3913
3929
  if (needsForceUpdate) {
3914
3930
  vm.$slots = resolveSlots(renderChildren, parentVnode.context);
@@ -8713,4 +8729,4 @@ if (inBrowser) {
8713
8729
  }, 0);
8714
8730
  }
8715
8731
 
8716
- export { EffectScope, computed, customRef, Vue as default, defineAsyncComponent, 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 };
8732
+ export { EffectScope, computed, customRef, Vue as default, defineAsyncComponent, 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, useListeners, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.7.7
2
+ * Vue.js v2.7.8
3
3
  * (c) 2014-2022 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -920,7 +920,7 @@
920
920
  // #7981: for accessor properties without setter
921
921
  return;
922
922
  }
923
- else if (isRef(value) && !isRef(newVal)) {
923
+ else if (!shallow && isRef(value) && !isRef(newVal)) {
924
924
  value.value = newVal;
925
925
  return;
926
926
  }
@@ -2426,7 +2426,19 @@
2426
2426
  var exposeCalled = false;
2427
2427
  return {
2428
2428
  get attrs() {
2429
- return initAttrsProxy(vm);
2429
+ if (!vm._attrsProxy) {
2430
+ var proxy = (vm._attrsProxy = {});
2431
+ def(proxy, '_v_attr_proxy', true);
2432
+ syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
2433
+ }
2434
+ return vm._attrsProxy;
2435
+ },
2436
+ get listeners() {
2437
+ if (!vm._listenersProxy) {
2438
+ var proxy = (vm._listenersProxy = {});
2439
+ syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
2440
+ }
2441
+ return vm._listenersProxy;
2430
2442
  },
2431
2443
  get slots() {
2432
2444
  return initSlotsProxy(vm);
@@ -2447,20 +2459,12 @@
2447
2459
  }
2448
2460
  };
2449
2461
  }
2450
- function initAttrsProxy(vm) {
2451
- if (!vm._attrsProxy) {
2452
- var proxy = (vm._attrsProxy = {});
2453
- def(proxy, '_v_attr_proxy', true);
2454
- syncSetupAttrs(proxy, vm.$attrs, emptyObject, vm);
2455
- }
2456
- return vm._attrsProxy;
2457
- }
2458
- function syncSetupAttrs(to, from, prev, instance) {
2462
+ function syncSetupProxy(to, from, prev, instance, type) {
2459
2463
  var changed = false;
2460
2464
  for (var key in from) {
2461
2465
  if (!(key in to)) {
2462
2466
  changed = true;
2463
- defineProxyAttr(to, key, instance);
2467
+ defineProxyAttr(to, key, instance, type);
2464
2468
  }
2465
2469
  else if (from[key] !== prev[key]) {
2466
2470
  changed = true;
@@ -2474,12 +2478,12 @@
2474
2478
  }
2475
2479
  return changed;
2476
2480
  }
2477
- function defineProxyAttr(proxy, key, instance) {
2481
+ function defineProxyAttr(proxy, key, instance, type) {
2478
2482
  Object.defineProperty(proxy, key, {
2479
2483
  enumerable: true,
2480
2484
  configurable: true,
2481
2485
  get: function () {
2482
- return instance.$attrs[key];
2486
+ return instance[type][key];
2483
2487
  }
2484
2488
  });
2485
2489
  }
@@ -2500,17 +2504,27 @@
2500
2504
  }
2501
2505
  }
2502
2506
  /**
2503
- * @internal use manual type def
2507
+ * @internal use manual type def because public setup context type relies on
2508
+ * legacy VNode types
2504
2509
  */
2505
2510
  function useSlots() {
2506
2511
  return getContext().slots;
2507
2512
  }
2508
2513
  /**
2509
- * @internal use manual type def
2514
+ * @internal use manual type def because public setup context type relies on
2515
+ * legacy VNode types
2510
2516
  */
2511
2517
  function useAttrs() {
2512
2518
  return getContext().attrs;
2513
2519
  }
2520
+ /**
2521
+ * Vue 2 only
2522
+ * @internal use manual type def because public setup context type relies on
2523
+ * legacy VNode types
2524
+ */
2525
+ function useListeners() {
2526
+ return getContext().listeners;
2527
+ }
2514
2528
  function getContext() {
2515
2529
  if (!currentInstance) {
2516
2530
  warn("useContext() called without active instance.");
@@ -3231,7 +3245,7 @@
3231
3245
  /**
3232
3246
  * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
3233
3247
  */
3234
- var version = '2.7.7';
3248
+ var version = '2.7.8';
3235
3249
  /**
3236
3250
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
3237
3251
  */
@@ -3277,6 +3291,7 @@
3277
3291
  getCurrentInstance: getCurrentInstance,
3278
3292
  useSlots: useSlots,
3279
3293
  useAttrs: useAttrs,
3294
+ useListeners: useListeners,
3280
3295
  mergeDefaults: mergeDefaults,
3281
3296
  nextTick: nextTick,
3282
3297
  set: set,
@@ -3897,12 +3912,19 @@
3897
3912
  if (vm._attrsProxy) {
3898
3913
  // force update if attrs are accessed and has changed since it may be
3899
3914
  // passed to a child component.
3900
- if (syncSetupAttrs(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm)) {
3915
+ if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
3901
3916
  needsForceUpdate = true;
3902
3917
  }
3903
3918
  }
3904
3919
  vm.$attrs = attrs;
3905
- vm.$listeners = listeners || emptyObject;
3920
+ // update listeners
3921
+ listeners = listeners || emptyObject;
3922
+ var prevListeners = vm.$options._parentListeners;
3923
+ if (vm._listenersProxy) {
3924
+ syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
3925
+ }
3926
+ vm.$listeners = vm.$options._parentListeners = listeners;
3927
+ updateComponentListeners(vm, listeners, prevListeners);
3906
3928
  // update props
3907
3929
  if (propsData && vm.$options.props) {
3908
3930
  toggleObserving(false);
@@ -3917,11 +3939,6 @@
3917
3939
  // keep a copy of raw propsData
3918
3940
  vm.$options.propsData = propsData;
3919
3941
  }
3920
- // update listeners
3921
- listeners = listeners || emptyObject;
3922
- var oldListeners = vm.$options._parentListeners;
3923
- vm.$options._parentListeners = listeners;
3924
- updateComponentListeners(vm, listeners, oldListeners);
3925
3942
  // resolve slots + force update if has children
3926
3943
  if (needsForceUpdate) {
3927
3944
  vm.$slots = resolveSlots(renderChildren, parentVnode.context);