vue 2.7.6 → 2.7.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.7.6
2
+ * Vue.js v2.7.7
3
3
  * (c) 2014-2022 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -2358,7 +2358,9 @@ function initRender(vm) {
2358
2358
  const parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
2359
2359
  const renderContext = parentVnode && parentVnode.context;
2360
2360
  vm.$slots = resolveSlots(options._renderChildren, renderContext);
2361
- vm.$scopedSlots = emptyObject;
2361
+ vm.$scopedSlots = parentVnode
2362
+ ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
2363
+ : emptyObject;
2362
2364
  // bind the createElement fn to this instance
2363
2365
  // so that we get proper render context inside it.
2364
2366
  // args order: tag, data, children, normalizationType, alwaysNormalize
@@ -2392,7 +2394,7 @@ function renderMixin(Vue) {
2392
2394
  Vue.prototype._render = function () {
2393
2395
  const vm = this;
2394
2396
  const { render, _parentVnode } = vm.$options;
2395
- if (_parentVnode) {
2397
+ if (_parentVnode && vm._isMounted) {
2396
2398
  vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
2397
2399
  if (vm._slotsProxy) {
2398
2400
  syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
@@ -3051,6 +3053,16 @@ if (inBrowser && !isIE) {
3051
3053
  getNow = () => performance.now();
3052
3054
  }
3053
3055
  }
3056
+ const sortCompareFn = (a, b) => {
3057
+ if (a.post) {
3058
+ if (!b.post)
3059
+ return 1;
3060
+ }
3061
+ else if (b.post) {
3062
+ return -1;
3063
+ }
3064
+ return a.id - b.id;
3065
+ };
3054
3066
  /**
3055
3067
  * Flush both queues and run the watchers.
3056
3068
  */
@@ -3066,7 +3078,7 @@ function flushSchedulerQueue() {
3066
3078
  // user watchers are created before the render watcher)
3067
3079
  // 3. If a component is destroyed during a parent component's watcher run,
3068
3080
  // its watchers can be skipped.
3069
- queue.sort((a, b) => a.id - b.id);
3081
+ queue.sort(sortCompareFn);
3070
3082
  // do not cache length because more watchers might be pushed
3071
3083
  // as we run existing watchers
3072
3084
  for (index$1 = 0; index$1 < queue.length; index$1++) {
@@ -3329,7 +3341,7 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
3329
3341
  watcher.update = watcher.run;
3330
3342
  }
3331
3343
  else if (flush === 'post') {
3332
- watcher.id = Infinity;
3344
+ watcher.post = true;
3333
3345
  watcher.update = () => queueWatcher(watcher);
3334
3346
  }
3335
3347
  else {
@@ -3478,18 +3490,23 @@ function provide(key, value) {
3478
3490
  }
3479
3491
  }
3480
3492
  else {
3481
- let provides = currentInstance._provided;
3482
- // by default an instance inherits its parent's provides object
3483
- // but when it needs to provide values of its own, it creates its
3484
- // own provides object using parent provides object as prototype.
3485
- // this way in `inject` we can simply look up injections from direct
3486
- // parent and let the prototype chain do the work.
3487
- const parentProvides = currentInstance.$parent && currentInstance.$parent._provided;
3488
- if (parentProvides === provides) {
3489
- provides = currentInstance._provided = Object.create(parentProvides);
3490
- }
3491
3493
  // TS doesn't allow symbol as index type
3492
- provides[key] = value;
3494
+ resolveProvided(currentInstance)[key] = value;
3495
+ }
3496
+ }
3497
+ function resolveProvided(vm) {
3498
+ // by default an instance inherits its parent's provides object
3499
+ // but when it needs to provide values of its own, it creates its
3500
+ // own provides object using parent provides object as prototype.
3501
+ // this way in `inject` we can simply look up injections from direct
3502
+ // parent and let the prototype chain do the work.
3503
+ const existing = vm._provided;
3504
+ const parentProvides = vm.$parent && vm.$parent._provided;
3505
+ if (parentProvides === existing) {
3506
+ return (vm._provided = Object.create(parentProvides));
3507
+ }
3508
+ else {
3509
+ return existing;
3493
3510
  }
3494
3511
  }
3495
3512
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
@@ -3856,7 +3873,7 @@ const onRenderTriggered = createLifeCycle('renderTriggered');
3856
3873
  /**
3857
3874
  * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
3858
3875
  */
3859
- const version = '2.7.6';
3876
+ const version = '2.7.7';
3860
3877
  /**
3861
3878
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
3862
3879
  */
@@ -3939,6 +3956,7 @@ class Watcher {
3939
3956
  this.cb = cb;
3940
3957
  this.id = ++uid$1; // uid for batching
3941
3958
  this.active = true;
3959
+ this.post = false;
3942
3960
  this.dirty = this.lazy; // for lazy watchers
3943
3961
  this.deps = [];
3944
3962
  this.newDeps = [];
@@ -4403,12 +4421,14 @@ function initProvide(vm) {
4403
4421
  if (!isObject(provided)) {
4404
4422
  return;
4405
4423
  }
4424
+ const source = resolveProvided(vm);
4425
+ // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
4426
+ // iterate the keys ourselves.
4406
4427
  const keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
4407
- setCurrentInstance(vm);
4408
4428
  for (let i = 0; i < keys.length; i++) {
4409
- provide(keys[i], provided[keys[i]]);
4429
+ const key = keys[i];
4430
+ Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
4410
4431
  }
4411
- setCurrentInstance();
4412
4432
  }
4413
4433
  }
4414
4434
  function initInjections(vm) {
@@ -10741,13 +10761,14 @@ function genElement(el, state) {
10741
10761
  }
10742
10762
  else {
10743
10763
  let data;
10744
- if (!el.plain || (el.pre && state.maybeComponent(el))) {
10764
+ const maybeComponent = state.maybeComponent(el);
10765
+ if (!el.plain || (el.pre && maybeComponent)) {
10745
10766
  data = genData(el, state);
10746
10767
  }
10747
10768
  let tag;
10748
10769
  // check if this is a component in <script setup>
10749
10770
  const bindings = state.options.bindings;
10750
- if (bindings && bindings.__isScriptSetup !== false) {
10771
+ if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
10751
10772
  tag =
10752
10773
  checkBindingType(bindings, el.tag) ||
10753
10774
  checkBindingType(bindings, camelize(el.tag)) ||