@vue/compat 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.
@@ -348,8 +348,17 @@ function warn(msg, ...args) {
348
348
  let activeEffectScope;
349
349
  class EffectScope {
350
350
  constructor(detached = false) {
351
+ /**
352
+ * @internal
353
+ */
351
354
  this.active = true;
355
+ /**
356
+ * @internal
357
+ */
352
358
  this.effects = [];
359
+ /**
360
+ * @internal
361
+ */
353
362
  this.cleanups = [];
354
363
  if (!detached && activeEffectScope) {
355
364
  this.parent = activeEffectScope;
@@ -359,21 +368,30 @@ class EffectScope {
359
368
  }
360
369
  run(fn) {
361
370
  if (this.active) {
371
+ const currentEffectScope = activeEffectScope;
362
372
  try {
363
373
  activeEffectScope = this;
364
374
  return fn();
365
375
  }
366
376
  finally {
367
- activeEffectScope = this.parent;
377
+ activeEffectScope = currentEffectScope;
368
378
  }
369
379
  }
370
380
  else {
371
381
  warn(`cannot run an inactive effect scope.`);
372
382
  }
373
383
  }
384
+ /**
385
+ * This should only be called on non-detached scopes
386
+ * @internal
387
+ */
374
388
  on() {
375
389
  activeEffectScope = this;
376
390
  }
391
+ /**
392
+ * This should only be called on non-detached scopes
393
+ * @internal
394
+ */
377
395
  off() {
378
396
  activeEffectScope = this.parent;
379
397
  }
@@ -597,9 +615,7 @@ function trackEffects(dep, debuggerEventExtraInfo) {
597
615
  dep.add(activeEffect);
598
616
  activeEffect.deps.push(dep);
599
617
  if (activeEffect.onTrack) {
600
- activeEffect.onTrack(Object.assign({
601
- effect: activeEffect
602
- }, debuggerEventExtraInfo));
618
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
603
619
  }
604
620
  }
605
621
  }
@@ -3632,12 +3648,10 @@ function watchEffect(effect, options) {
3632
3648
  return doWatch(effect, null, options);
3633
3649
  }
3634
3650
  function watchPostEffect(effect, options) {
3635
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'post' })
3636
- ));
3651
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'post' }) ));
3637
3652
  }
3638
3653
  function watchSyncEffect(effect, options) {
3639
- return doWatch(effect, null, (Object.assign(options || {}, { flush: 'sync' })
3640
- ));
3654
+ return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'sync' }) ));
3641
3655
  }
3642
3656
  // initial value for watchers to trigger on undefined initial values
3643
3657
  const INITIAL_WATCHER_VALUE = {};
@@ -3947,7 +3961,9 @@ const BaseTransitionImpl = {
3947
3961
  const { mode } = rawProps;
3948
3962
  // check mode
3949
3963
  if (mode &&
3950
- mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3964
+ mode !== 'in-out' &&
3965
+ mode !== 'out-in' &&
3966
+ mode !== 'default') {
3951
3967
  warn$1(`invalid <transition> mode: ${mode}`);
3952
3968
  }
3953
3969
  // at this point children has a guaranteed length of 1.
@@ -4177,20 +4193,24 @@ function setTransitionHooks(vnode, hooks) {
4177
4193
  vnode.transition = hooks;
4178
4194
  }
4179
4195
  }
4180
- function getTransitionRawChildren(children, keepComment = false) {
4196
+ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4181
4197
  let ret = [];
4182
4198
  let keyedFragmentCount = 0;
4183
4199
  for (let i = 0; i < children.length; i++) {
4184
- const child = children[i];
4200
+ let child = children[i];
4201
+ // #5360 inherit parent key in case of <template v-for>
4202
+ const key = parentKey == null
4203
+ ? child.key
4204
+ : String(parentKey) + String(child.key != null ? child.key : i);
4185
4205
  // handle fragment children case, e.g. v-for
4186
4206
  if (child.type === Fragment) {
4187
4207
  if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
4188
4208
  keyedFragmentCount++;
4189
- ret = ret.concat(getTransitionRawChildren(child.children, keepComment));
4209
+ ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
4190
4210
  }
4191
4211
  // comment placeholders should be skipped, e.g. v-if
4192
4212
  else if (keepComment || child.type !== Comment) {
4193
- ret.push(child);
4213
+ ret.push(key != null ? cloneVNode(child, { key }) : child);
4194
4214
  }
4195
4215
  }
4196
4216
  // #1126 if a transition children list contains multiple sub fragments, these
@@ -5248,6 +5268,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5248
5268
  const propsToUpdate = instance.vnode.dynamicProps;
5249
5269
  for (let i = 0; i < propsToUpdate.length; i++) {
5250
5270
  let key = propsToUpdate[i];
5271
+ // skip if the prop key is a declared emit event listener
5272
+ if (isEmitListener(instance.emitsOptions, key)) {
5273
+ continue;
5274
+ }
5251
5275
  // PROPS flag guarantees rawProps to be non-null
5252
5276
  const value = rawProps[key];
5253
5277
  if (options) {
@@ -5833,7 +5857,8 @@ function withDirectives(vnode, directives) {
5833
5857
  warn$1(`withDirectives can only be used inside render functions.`);
5834
5858
  return vnode;
5835
5859
  }
5836
- const instance = internalInstance.proxy;
5860
+ const instance = getExposeProxy(internalInstance) ||
5861
+ internalInstance.proxy;
5837
5862
  const bindings = vnode.dirs || (vnode.dirs = []);
5838
5863
  for (let i = 0; i < directives.length; i++) {
5839
5864
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -5953,7 +5978,7 @@ function createCompatVue(createApp, createSingletonApp) {
5953
5978
  return vm;
5954
5979
  }
5955
5980
  }
5956
- Vue.version = `2.6.14-compat:${"3.2.31"}`;
5981
+ Vue.version = `2.6.14-compat:${"3.2.32"}`;
5957
5982
  Vue.config = singletonApp.config;
5958
5983
  Vue.use = (p, ...options) => {
5959
5984
  if (p && isFunction(p.install)) {
@@ -6380,6 +6405,9 @@ function createAppContext() {
6380
6405
  let uid = 0;
6381
6406
  function createAppAPI(render, hydrate) {
6382
6407
  return function createApp(rootComponent, rootProps = null) {
6408
+ if (!isFunction(rootComponent)) {
6409
+ rootComponent = Object.assign({}, rootComponent);
6410
+ }
6383
6411
  if (rootProps != null && !isObject(rootProps)) {
6384
6412
  warn$1(`root props passed to app.mount() must be an object.`);
6385
6413
  rootProps = null;
@@ -6579,6 +6607,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
6579
6607
  if (!isArray(existing)) {
6580
6608
  if (_isString) {
6581
6609
  refs[ref] = [refValue];
6610
+ if (hasOwn(setupState, ref)) {
6611
+ setupState[ref] = refs[ref];
6612
+ }
6582
6613
  }
6583
6614
  else {
6584
6615
  ref.value = [refValue];
@@ -6951,7 +6982,7 @@ function startMeasure(instance, type) {
6951
6982
  perf.mark(`vue-${type}-${instance.uid}`);
6952
6983
  }
6953
6984
  {
6954
- devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now());
6985
+ devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
6955
6986
  }
6956
6987
  }
6957
6988
  function endMeasure(instance, type) {
@@ -6964,7 +6995,7 @@ function endMeasure(instance, type) {
6964
6995
  perf.clearMarks(endTag);
6965
6996
  }
6966
6997
  {
6967
- devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now());
6998
+ devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
6968
6999
  }
6969
7000
  }
6970
7001
  function isSupported() {
@@ -9973,9 +10004,10 @@ const PublicInstanceProxyHandlers = {
9973
10004
  },
9974
10005
  defineProperty(target, key, descriptor) {
9975
10006
  if (descriptor.get != null) {
9976
- this.set(target, key, descriptor.get(), null);
10007
+ // invalidate key cache of a getter based property #5417
10008
+ target.$.accessCache[key] = 0;
9977
10009
  }
9978
- else if (descriptor.value != null) {
10010
+ else if (hasOwn(descriptor, 'value')) {
9979
10011
  this.set(target, key, descriptor.value, null);
9980
10012
  }
9981
10013
  return Reflect.defineProperty(target, key, descriptor);
@@ -10869,7 +10901,7 @@ function isMemoSame(cached, memo) {
10869
10901
  }
10870
10902
 
10871
10903
  // Core API ------------------------------------------------------------------
10872
- const version = "3.2.31";
10904
+ const version = "3.2.32";
10873
10905
  /**
10874
10906
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10875
10907
  * @internal