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
  */
@@ -2360,7 +2360,9 @@ function initRender(vm) {
2360
2360
  const parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
2361
2361
  const renderContext = parentVnode && parentVnode.context;
2362
2362
  vm.$slots = resolveSlots(options._renderChildren, renderContext);
2363
- vm.$scopedSlots = emptyObject;
2363
+ vm.$scopedSlots = parentVnode
2364
+ ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
2365
+ : emptyObject;
2364
2366
  // bind the createElement fn to this instance
2365
2367
  // so that we get proper render context inside it.
2366
2368
  // args order: tag, data, children, normalizationType, alwaysNormalize
@@ -2394,7 +2396,7 @@ function renderMixin(Vue) {
2394
2396
  Vue.prototype._render = function () {
2395
2397
  const vm = this;
2396
2398
  const { render, _parentVnode } = vm.$options;
2397
- if (_parentVnode) {
2399
+ if (_parentVnode && vm._isMounted) {
2398
2400
  vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
2399
2401
  if (vm._slotsProxy) {
2400
2402
  syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
@@ -3053,6 +3055,16 @@ if (inBrowser && !isIE) {
3053
3055
  getNow = () => performance.now();
3054
3056
  }
3055
3057
  }
3058
+ const sortCompareFn = (a, b) => {
3059
+ if (a.post) {
3060
+ if (!b.post)
3061
+ return 1;
3062
+ }
3063
+ else if (b.post) {
3064
+ return -1;
3065
+ }
3066
+ return a.id - b.id;
3067
+ };
3056
3068
  /**
3057
3069
  * Flush both queues and run the watchers.
3058
3070
  */
@@ -3068,7 +3080,7 @@ function flushSchedulerQueue() {
3068
3080
  // user watchers are created before the render watcher)
3069
3081
  // 3. If a component is destroyed during a parent component's watcher run,
3070
3082
  // its watchers can be skipped.
3071
- queue.sort((a, b) => a.id - b.id);
3083
+ queue.sort(sortCompareFn);
3072
3084
  // do not cache length because more watchers might be pushed
3073
3085
  // as we run existing watchers
3074
3086
  for (index$1 = 0; index$1 < queue.length; index$1++) {
@@ -3331,7 +3343,7 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
3331
3343
  watcher.update = watcher.run;
3332
3344
  }
3333
3345
  else if (flush === 'post') {
3334
- watcher.id = Infinity;
3346
+ watcher.post = true;
3335
3347
  watcher.update = () => queueWatcher(watcher);
3336
3348
  }
3337
3349
  else {
@@ -3480,18 +3492,23 @@ function provide(key, value) {
3480
3492
  }
3481
3493
  }
3482
3494
  else {
3483
- let provides = currentInstance._provided;
3484
- // by default an instance inherits its parent's provides object
3485
- // but when it needs to provide values of its own, it creates its
3486
- // own provides object using parent provides object as prototype.
3487
- // this way in `inject` we can simply look up injections from direct
3488
- // parent and let the prototype chain do the work.
3489
- const parentProvides = currentInstance.$parent && currentInstance.$parent._provided;
3490
- if (parentProvides === provides) {
3491
- provides = currentInstance._provided = Object.create(parentProvides);
3492
- }
3493
3495
  // TS doesn't allow symbol as index type
3494
- provides[key] = value;
3496
+ resolveProvided(currentInstance)[key] = value;
3497
+ }
3498
+ }
3499
+ function resolveProvided(vm) {
3500
+ // by default an instance inherits its parent's provides object
3501
+ // but when it needs to provide values of its own, it creates its
3502
+ // own provides object using parent provides object as prototype.
3503
+ // this way in `inject` we can simply look up injections from direct
3504
+ // parent and let the prototype chain do the work.
3505
+ const existing = vm._provided;
3506
+ const parentProvides = vm.$parent && vm.$parent._provided;
3507
+ if (parentProvides === existing) {
3508
+ return (vm._provided = Object.create(parentProvides));
3509
+ }
3510
+ else {
3511
+ return existing;
3495
3512
  }
3496
3513
  }
3497
3514
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
@@ -3864,7 +3881,7 @@ const onRenderTriggered = createLifeCycle('renderTriggered');
3864
3881
  /**
3865
3882
  * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
3866
3883
  */
3867
- const version = '2.7.6';
3884
+ const version = '2.7.7';
3868
3885
  /**
3869
3886
  * @internal type is manually declared in <root>/types/v3-define-component.d.ts
3870
3887
  */
@@ -4006,6 +4023,7 @@ class Watcher {
4006
4023
  this.cb = cb;
4007
4024
  this.id = ++uid$1; // uid for batching
4008
4025
  this.active = true;
4026
+ this.post = false;
4009
4027
  this.dirty = this.lazy; // for lazy watchers
4010
4028
  this.deps = [];
4011
4029
  this.newDeps = [];
@@ -4470,12 +4488,14 @@ function initProvide(vm) {
4470
4488
  if (!isObject(provided)) {
4471
4489
  return;
4472
4490
  }
4491
+ const source = resolveProvided(vm);
4492
+ // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
4493
+ // iterate the keys ourselves.
4473
4494
  const keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
4474
- setCurrentInstance(vm);
4475
4495
  for (let i = 0; i < keys.length; i++) {
4476
- provide(keys[i], provided[keys[i]]);
4496
+ const key = keys[i];
4497
+ Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
4477
4498
  }
4478
- setCurrentInstance();
4479
4499
  }
4480
4500
  }
4481
4501
  function initInjections(vm) {
@@ -10808,13 +10828,14 @@ function genElement(el, state) {
10808
10828
  }
10809
10829
  else {
10810
10830
  let data;
10811
- if (!el.plain || (el.pre && state.maybeComponent(el))) {
10831
+ const maybeComponent = state.maybeComponent(el);
10832
+ if (!el.plain || (el.pre && maybeComponent)) {
10812
10833
  data = genData(el, state);
10813
10834
  }
10814
10835
  let tag;
10815
10836
  // check if this is a component in <script setup>
10816
10837
  const bindings = state.options.bindings;
10817
- if (bindings && bindings.__isScriptSetup !== false) {
10838
+ if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
10818
10839
  tag =
10819
10840
  checkBindingType(bindings, el.tag) ||
10820
10841
  checkBindingType(bindings, camelize(el.tag)) ||