vue 3.2.31 → 3.2.32

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.
@@ -427,8 +427,17 @@ function warn(msg, ...args) {
427
427
  let activeEffectScope;
428
428
  class EffectScope {
429
429
  constructor(detached = false) {
430
+ /**
431
+ * @internal
432
+ */
430
433
  this.active = true;
434
+ /**
435
+ * @internal
436
+ */
431
437
  this.effects = [];
438
+ /**
439
+ * @internal
440
+ */
432
441
  this.cleanups = [];
433
442
  if (!detached && activeEffectScope) {
434
443
  this.parent = activeEffectScope;
@@ -438,21 +447,30 @@ class EffectScope {
438
447
  }
439
448
  run(fn) {
440
449
  if (this.active) {
450
+ const currentEffectScope = activeEffectScope;
441
451
  try {
442
452
  activeEffectScope = this;
443
453
  return fn();
444
454
  }
445
455
  finally {
446
- activeEffectScope = this.parent;
456
+ activeEffectScope = currentEffectScope;
447
457
  }
448
458
  }
449
459
  else {
450
460
  warn(`cannot run an inactive effect scope.`);
451
461
  }
452
462
  }
463
+ /**
464
+ * This should only be called on non-detached scopes
465
+ * @internal
466
+ */
453
467
  on() {
454
468
  activeEffectScope = this;
455
469
  }
470
+ /**
471
+ * This should only be called on non-detached scopes
472
+ * @internal
473
+ */
456
474
  off() {
457
475
  activeEffectScope = this.parent;
458
476
  }
@@ -676,9 +694,7 @@ function trackEffects(dep, debuggerEventExtraInfo) {
676
694
  dep.add(activeEffect);
677
695
  activeEffect.deps.push(dep);
678
696
  if (activeEffect.onTrack) {
679
- activeEffect.onTrack(Object.assign({
680
- effect: activeEffect
681
- }, debuggerEventExtraInfo));
697
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
682
698
  }
683
699
  }
684
700
  }
@@ -3163,12 +3179,10 @@ function watchEffect(effect, options) {
3163
3179
  return doWatch(effect, null, options);
3164
3180
  }
3165
3181
  function watchPostEffect(effect, options) {
3166
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'post' })
3167
- ));
3182
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'post' }) ));
3168
3183
  }
3169
3184
  function watchSyncEffect(effect, options) {
3170
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'sync' })
3171
- ));
3185
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'sync' }) ));
3172
3186
  }
3173
3187
  // initial value for watchers to trigger on undefined initial values
3174
3188
  const INITIAL_WATCHER_VALUE = {};
@@ -3465,7 +3479,9 @@ const BaseTransitionImpl = {
3465
3479
  const { mode } = rawProps;
3466
3480
  // check mode
3467
3481
  if (mode &&
3468
- mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3482
+ mode !== 'in-out' &&
3483
+ mode !== 'out-in' &&
3484
+ mode !== 'default') {
3469
3485
  warn$1(`invalid <transition> mode: ${mode}`);
3470
3486
  }
3471
3487
  // at this point children has a guaranteed length of 1.
@@ -3692,20 +3708,24 @@ function setTransitionHooks(vnode, hooks) {
3692
3708
  vnode.transition = hooks;
3693
3709
  }
3694
3710
  }
3695
- function getTransitionRawChildren(children, keepComment = false) {
3711
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3696
3712
  let ret = [];
3697
3713
  let keyedFragmentCount = 0;
3698
3714
  for (let i = 0; i < children.length; i++) {
3699
- const child = children[i];
3715
+ let child = children[i];
3716
+ // #5360 inherit parent key in case of <template v-for>
3717
+ const key = parentKey == null
3718
+ ? child.key
3719
+ : String(parentKey) + String(child.key != null ? child.key : i);
3700
3720
  // handle fragment children case, e.g. v-for
3701
3721
  if (child.type === Fragment) {
3702
3722
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
3703
3723
  keyedFragmentCount++;
3704
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
3724
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
3705
3725
  }
3706
3726
  // comment placeholders should be skipped, e.g. v-if
3707
3727
  else if (keepComment || child.type !== Comment) {
3708
- ret.push(child);
3728
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
3709
3729
  }
3710
3730
  }
3711
3731
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -4671,6 +4691,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
4671
4691
  const propsToUpdate = instance.vnode.dynamicProps;
4672
4692
  for (let i = 0; i < propsToUpdate.length; i++) {
4673
4693
  let key = propsToUpdate[i];
4694
+ // skip if the prop key is a declared emit event listener
4695
+ if (isEmitListener(instance.emitsOptions, key)) {
4696
+ continue;
4697
+ }
4674
4698
  // PROPS flag guarantees rawProps to be non-null
4675
4699
  const value = rawProps[key];
4676
4700
  if (options) {
@@ -5195,7 +5219,8 @@ function withDirectives(vnode, directives) {
5195
5219
  warn$1(`withDirectives can only be used inside render functions.`);
5196
5220
  return vnode;
5197
5221
  }
5198
- const instance = internalInstance.proxy;
5222
+ const instance = getExposeProxy(internalInstance) ||
5223
+ internalInstance.proxy;
5199
5224
  const bindings = vnode.dirs || (vnode.dirs = []);
5200
5225
  for (let i = 0; i < directives.length; i++) {
5201
5226
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -5267,6 +5292,9 @@ function createAppContext() {
5267
5292
  let uid = 0;
5268
5293
  function createAppAPI(render, hydrate) {
5269
5294
  return function createApp(rootComponent, rootProps = null) {
5295
+ if (!isFunction(rootComponent)) {
5296
+ rootComponent = Object.assign({}, rootComponent);
5297
+ }
5270
5298
  if (rootProps != null && !isObject(rootProps)) {
5271
5299
  warn$1(`root props passed to app.mount() must be an object.`);
5272
5300
  rootProps = null;
@@ -5463,6 +5491,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5463
5491
  if (!isArray(existing)) {
5464
5492
  if (_isString) {
5465
5493
  refs[ref] = [refValue];
5494
+ if (hasOwn(setupState, ref)) {
5495
+ setupState[ref] = refs[ref];
5496
+ }
5466
5497
  }
5467
5498
  else {
5468
5499
  ref.value = [refValue];
@@ -5835,7 +5866,7 @@ function startMeasure(instance, type) {
5835
5866
  perf.mark(`vue-${type}-${instance.uid}`);
5836
5867
  }
5837
5868
  {
5838
- devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
5869
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
5839
5870
  }
5840
5871
  }
5841
5872
  function endMeasure(instance, type) {
@@ -5848,7 +5879,7 @@ function endMeasure(instance, type) {
5848
5879
  perf.clearMarks(endTag);
5849
5880
  }
5850
5881
  {
5851
- devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
5882
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
5852
5883
  }
5853
5884
  }
5854
5885
  function isSupported() {
@@ -8237,9 +8268,10 @@ const PublicInstanceProxyHandlers = {
8237
8268
  },
8238
8269
  defineProperty(target, key, descriptor) {
8239
8270
  if (descriptor.get != null) {
8240
- this.set(target, key, descriptor.get(), null);
8271
+ // invalidate key cache of a getter based property #5417
8272
+ target.$.accessCache[key] = 0;
8241
8273
  }
8242
- else if (descriptor.value != null) {
8274
+ else if (hasOwn(descriptor, 'value')) {
8243
8275
  this.set(target, key, descriptor.value, null);
8244
8276
  }
8245
8277
  return Reflect.defineProperty(target, key, descriptor);
@@ -9118,7 +9150,7 @@ function isMemoSame(cached, memo) {
9118
9150
  }
9119
9151
 
9120
9152
  // Core API ------------------------------------------------------------------
9121
- const version = "3.2.31";
9153
+ const version = "3.2.32";
9122
9154
  /**
9123
9155
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9124
9156
  * @internal