@vue/compat 3.5.34 → 3.5.36

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/compat v3.5.34
2
+ * @vue/compat v3.5.36
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1676,9 +1676,6 @@ function targetTypeMap(rawType) {
1676
1676
  return 0 /* INVALID */;
1677
1677
  }
1678
1678
  }
1679
- function getTargetType(value) {
1680
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1681
- }
1682
1679
  // @__NO_SIDE_EFFECTS__
1683
1680
  function reactive(target) {
1684
1681
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1736,14 +1733,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1736
1733
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1737
1734
  return target;
1738
1735
  }
1739
- const targetType = getTargetType(target);
1740
- if (targetType === 0 /* INVALID */) {
1736
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1741
1737
  return target;
1742
1738
  }
1743
1739
  const existingProxy = proxyMap.get(target);
1744
1740
  if (existingProxy) {
1745
1741
  return existingProxy;
1746
1742
  }
1743
+ const targetType = targetTypeMap(toRawType(target));
1744
+ if (targetType === 0 /* INVALID */) {
1745
+ return target;
1746
+ }
1747
1747
  const proxy = new Proxy(
1748
1748
  target,
1749
1749
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2177,8 +2177,9 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2177
2177
  if (once && cb) {
2178
2178
  const _cb = cb;
2179
2179
  cb = (...args) => {
2180
- _cb(...args);
2180
+ const res = _cb(...args);
2181
2181
  watchHandle();
2182
+ return res;
2182
2183
  };
2183
2184
  }
2184
2185
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -2188,7 +2189,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2188
2189
  }
2189
2190
  if (cb) {
2190
2191
  const newValue = effect.run();
2191
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2192
+ if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2192
2193
  if (cleanup) {
2193
2194
  cleanup();
2194
2195
  }
@@ -3909,19 +3910,18 @@ const TeleportImpl = {
3909
3910
  target,
3910
3911
  props
3911
3912
  } = vnode;
3912
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3913
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3913
3914
  const pendingMount = pendingMounts.get(vnode);
3914
3915
  if (pendingMount) {
3915
3916
  pendingMount.flags |= 8;
3916
3917
  pendingMounts.delete(vnode);
3917
- shouldRemove = false;
3918
3918
  }
3919
3919
  if (target) {
3920
3920
  hostRemove(targetStart);
3921
3921
  hostRemove(targetAnchor);
3922
3922
  }
3923
3923
  doRemove && hostRemove(anchor);
3924
- if (shapeFlag & 16) {
3924
+ if (!pendingMount && shapeFlag & 16) {
3925
3925
  for (let i = 0; i < children.length; i++) {
3926
3926
  const child = children[i];
3927
3927
  unmount(
@@ -4893,20 +4893,16 @@ function createHydrationFunctions(rendererInternals) {
4893
4893
  slotScopeIds,
4894
4894
  optimized
4895
4895
  );
4896
- let hasWarned = false;
4897
- while (next) {
4898
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4899
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
4900
- warn$1(
4901
- `Hydration children mismatch on`,
4902
- el,
4903
- `
4896
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4897
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
4898
+ `Hydration children mismatch on`,
4899
+ el,
4900
+ `
4904
4901
  Server rendered element contains more child nodes than client vdom.`
4905
- );
4906
- hasWarned = true;
4907
- }
4908
- logMismatchError();
4909
- }
4902
+ );
4903
+ logMismatchError();
4904
+ }
4905
+ while (next) {
4910
4906
  const cur = next;
4911
4907
  next = next.nextSibling;
4912
4908
  remove(cur);
@@ -4980,7 +4976,7 @@ Server rendered element contains more child nodes than client vdom.`
4980
4976
  optimized = optimized || !!parentVNode.dynamicChildren;
4981
4977
  const children = parentVNode.children;
4982
4978
  const l = children.length;
4983
- let hasWarned = false;
4979
+ let hasCheckedMismatch = false;
4984
4980
  for (let i = 0; i < l; i++) {
4985
4981
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4986
4982
  const isText = vnode.type === Text;
@@ -5008,17 +5004,17 @@ Server rendered element contains more child nodes than client vdom.`
5008
5004
  } else if (isText && !vnode.children) {
5009
5005
  insert(vnode.el = createText(""), container);
5010
5006
  } else {
5011
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5012
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
5013
- warn$1(
5007
+ if (!hasCheckedMismatch) {
5008
+ hasCheckedMismatch = true;
5009
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5010
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
5014
5011
  `Hydration children mismatch on`,
5015
5012
  container,
5016
5013
  `
5017
5014
  Server rendered element contains fewer child nodes than client vdom.`
5018
5015
  );
5019
- hasWarned = true;
5016
+ logMismatchError();
5020
5017
  }
5021
- logMismatchError();
5022
5018
  }
5023
5019
  patch(
5024
5020
  null,
@@ -5498,13 +5494,21 @@ function defineAsyncComponent(source) {
5498
5494
  const loaded = ref(false);
5499
5495
  const error = ref();
5500
5496
  const delayed = ref(!!delay);
5497
+ let timeoutTimer;
5498
+ let delayTimer;
5499
+ onUnmounted(() => {
5500
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
5501
+ if (delayTimer != null) clearTimeout(delayTimer);
5502
+ });
5501
5503
  if (delay) {
5502
- setTimeout(() => {
5504
+ delayTimer = setTimeout(() => {
5505
+ if (instance.isUnmounted) return;
5503
5506
  delayed.value = false;
5504
5507
  }, delay);
5505
5508
  }
5506
5509
  if (timeout != null) {
5507
- setTimeout(() => {
5510
+ timeoutTimer = setTimeout(() => {
5511
+ if (instance.isUnmounted) return;
5508
5512
  if (!loaded.value && !error.value) {
5509
5513
  const err = new Error(
5510
5514
  `Async component timed out after ${timeout}ms.`
@@ -5515,11 +5519,16 @@ function defineAsyncComponent(source) {
5515
5519
  }, timeout);
5516
5520
  }
5517
5521
  load().then(() => {
5522
+ if (instance.isUnmounted) return;
5518
5523
  loaded.value = true;
5519
5524
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5520
5525
  instance.parent.update();
5521
5526
  }
5522
5527
  }).catch((err) => {
5528
+ if (instance.isUnmounted) {
5529
+ pendingRequest = null;
5530
+ return;
5531
+ }
5523
5532
  onError(err);
5524
5533
  error.value = err;
5525
5534
  });
@@ -7506,7 +7515,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7506
7515
  return vm;
7507
7516
  }
7508
7517
  }
7509
- Vue.version = `2.6.14-compat:${"3.5.34"}`;
7518
+ Vue.version = `2.6.14-compat:${"3.5.36"}`;
7510
7519
  Vue.config = singletonApp.config;
7511
7520
  Vue.use = (plugin, ...options) => {
7512
7521
  if (plugin && isFunction(plugin.install)) {
@@ -7846,6 +7855,9 @@ function defineReactive(obj, key, val) {
7846
7855
  try {
7847
7856
  defineReactiveSimple(val, key2, val[key2]);
7848
7857
  } catch (e) {
7858
+ if (!!(process.env.NODE_ENV !== "production")) {
7859
+ warn$1(`Failed making property "${key2}" reactive:`, e);
7860
+ }
7849
7861
  }
7850
7862
  });
7851
7863
  }
@@ -8186,13 +8198,20 @@ function useModel(props, name, options = EMPTY_OBJ) {
8186
8198
  return;
8187
8199
  }
8188
8200
  const rawProps = i.vnode.props;
8189
- if (!(rawProps && // check if parent has passed v-model
8190
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8201
+ const hasVModel = !!(rawProps && // check if parent has passed v-model
8202
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
8203
+ if (!hasVModel) {
8191
8204
  localValue = value;
8192
8205
  trigger();
8193
8206
  }
8194
8207
  i.emit(`update:${name}`, emittedValue);
8195
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8208
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
8209
+ // event listeners. If a v-model listener emits an intermediate value
8210
+ // and a following listener restores the model to its previous prop
8211
+ // value before parent updates are flushed, the parent render can be
8212
+ // deduped as having no prop change. Force a local update so DOM state
8213
+ // such as an input's value is synchronized back to the current model.
8214
+ hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
8196
8215
  trigger();
8197
8216
  }
8198
8217
  prevSetValue = value;
@@ -10552,9 +10571,13 @@ function baseCreateRenderer(options, createHydrationFns) {
10552
10571
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10553
10572
  if (needTransition2) {
10554
10573
  if (moveType === 0) {
10555
- transition.beforeEnter(el);
10556
- hostInsert(el, container, anchor);
10557
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10574
+ if (transition.persisted && !el[leaveCbKey]) {
10575
+ hostInsert(el, container, anchor);
10576
+ } else {
10577
+ transition.beforeEnter(el);
10578
+ hostInsert(el, container, anchor);
10579
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10580
+ }
10558
10581
  } else {
10559
10582
  const { leave, delayLeave, afterLeave } = transition;
10560
10583
  const remove2 = () => {
@@ -10565,16 +10588,21 @@ function baseCreateRenderer(options, createHydrationFns) {
10565
10588
  }
10566
10589
  };
10567
10590
  const performLeave = () => {
10591
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
10568
10592
  if (el._isLeaving) {
10569
10593
  el[leaveCbKey](
10570
10594
  true
10571
10595
  /* cancelled */
10572
10596
  );
10573
10597
  }
10574
- leave(el, () => {
10598
+ if (transition.persisted && !wasLeaving) {
10575
10599
  remove2();
10576
- afterLeave && afterLeave();
10577
- });
10600
+ } else {
10601
+ leave(el, () => {
10602
+ remove2();
10603
+ afterLeave && afterLeave();
10604
+ });
10605
+ }
10578
10606
  };
10579
10607
  if (delayLeave) {
10580
10608
  delayLeave(el, remove2, performLeave);
@@ -12683,7 +12711,7 @@ function isMemoSame(cached, memo) {
12683
12711
  return true;
12684
12712
  }
12685
12713
 
12686
- const version = "3.5.34";
12714
+ const version = "3.5.36";
12687
12715
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12688
12716
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12689
12717
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13528,12 +13556,37 @@ function createInvoker(initialValue, instance) {
13528
13556
  } else if (e._vts <= invoker.attached) {
13529
13557
  return;
13530
13558
  }
13531
- callWithAsyncErrorHandling(
13532
- patchStopImmediatePropagation(e, invoker.value),
13533
- instance,
13534
- 5,
13535
- [e]
13536
- );
13559
+ const value = invoker.value;
13560
+ if (isArray(value)) {
13561
+ const originalStop = e.stopImmediatePropagation;
13562
+ e.stopImmediatePropagation = () => {
13563
+ originalStop.call(e);
13564
+ e._stopped = true;
13565
+ };
13566
+ const handlers = value.slice();
13567
+ const args = [e];
13568
+ for (let i = 0; i < handlers.length; i++) {
13569
+ if (e._stopped) {
13570
+ break;
13571
+ }
13572
+ const handler = handlers[i];
13573
+ if (handler) {
13574
+ callWithAsyncErrorHandling(
13575
+ handler,
13576
+ instance,
13577
+ 5,
13578
+ args
13579
+ );
13580
+ }
13581
+ }
13582
+ } else {
13583
+ callWithAsyncErrorHandling(
13584
+ value,
13585
+ instance,
13586
+ 5,
13587
+ [e]
13588
+ );
13589
+ }
13537
13590
  };
13538
13591
  invoker.value = initialValue;
13539
13592
  invoker.attached = getNow();
@@ -13549,20 +13602,6 @@ Expected function or array of functions, received type ${typeof value}.`
13549
13602
  );
13550
13603
  return NOOP;
13551
13604
  }
13552
- function patchStopImmediatePropagation(e, value) {
13553
- if (isArray(value)) {
13554
- const originalStop = e.stopImmediatePropagation;
13555
- e.stopImmediatePropagation = () => {
13556
- originalStop.call(e);
13557
- e._stopped = true;
13558
- };
13559
- return value.map(
13560
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
13561
- );
13562
- } else {
13563
- return value;
13564
- }
13565
- }
13566
13605
 
13567
13606
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
13568
13607
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -14245,7 +14284,8 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14245
14284
  if (children) {
14246
14285
  for (let i = 0; i < children.length; i++) {
14247
14286
  const child = children[i];
14248
- if (child.el && child.el instanceof Element) {
14287
+ if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
14288
+ !child.el[vShowHidden]) {
14249
14289
  prevChildren.push(child);
14250
14290
  setTransitionHooks(
14251
14291
  child,