@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
  **/
@@ -1672,9 +1672,6 @@ function targetTypeMap(rawType) {
1672
1672
  return 0 /* INVALID */;
1673
1673
  }
1674
1674
  }
1675
- function getTargetType(value) {
1676
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1677
- }
1678
1675
  // @__NO_SIDE_EFFECTS__
1679
1676
  function reactive(target) {
1680
1677
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1732,14 +1729,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1732
1729
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1733
1730
  return target;
1734
1731
  }
1735
- const targetType = getTargetType(target);
1736
- if (targetType === 0 /* INVALID */) {
1732
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1737
1733
  return target;
1738
1734
  }
1739
1735
  const existingProxy = proxyMap.get(target);
1740
1736
  if (existingProxy) {
1741
1737
  return existingProxy;
1742
1738
  }
1739
+ const targetType = targetTypeMap(toRawType(target));
1740
+ if (targetType === 0 /* INVALID */) {
1741
+ return target;
1742
+ }
1743
1743
  const proxy = new Proxy(
1744
1744
  target,
1745
1745
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2167,8 +2167,9 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2167
2167
  if (once && cb) {
2168
2168
  const _cb = cb;
2169
2169
  cb = (...args) => {
2170
- _cb(...args);
2170
+ const res = _cb(...args);
2171
2171
  watchHandle();
2172
+ return res;
2172
2173
  };
2173
2174
  }
2174
2175
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -2178,7 +2179,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2178
2179
  }
2179
2180
  if (cb) {
2180
2181
  const newValue = effect.run();
2181
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2182
+ if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2182
2183
  if (cleanup) {
2183
2184
  cleanup();
2184
2185
  }
@@ -3891,19 +3892,18 @@ const TeleportImpl = {
3891
3892
  target,
3892
3893
  props
3893
3894
  } = vnode;
3894
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3895
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3895
3896
  const pendingMount = pendingMounts.get(vnode);
3896
3897
  if (pendingMount) {
3897
3898
  pendingMount.flags |= 8;
3898
3899
  pendingMounts.delete(vnode);
3899
- shouldRemove = false;
3900
3900
  }
3901
3901
  if (target) {
3902
3902
  hostRemove(targetStart);
3903
3903
  hostRemove(targetAnchor);
3904
3904
  }
3905
3905
  doRemove && hostRemove(anchor);
3906
- if (shapeFlag & 16) {
3906
+ if (!pendingMount && shapeFlag & 16) {
3907
3907
  for (let i = 0; i < children.length; i++) {
3908
3908
  const child = children[i];
3909
3909
  unmount(
@@ -4874,20 +4874,16 @@ function createHydrationFunctions(rendererInternals) {
4874
4874
  slotScopeIds,
4875
4875
  optimized
4876
4876
  );
4877
- let hasWarned = false;
4878
- while (next) {
4879
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4880
- if (!hasWarned) {
4881
- warn$1(
4882
- `Hydration children mismatch on`,
4883
- el,
4884
- `
4877
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4878
+ warn$1(
4879
+ `Hydration children mismatch on`,
4880
+ el,
4881
+ `
4885
4882
  Server rendered element contains more child nodes than client vdom.`
4886
- );
4887
- hasWarned = true;
4888
- }
4889
- logMismatchError();
4890
- }
4883
+ );
4884
+ logMismatchError();
4885
+ }
4886
+ while (next) {
4891
4887
  const cur = next;
4892
4888
  next = next.nextSibling;
4893
4889
  remove(cur);
@@ -4950,7 +4946,7 @@ Server rendered element contains more child nodes than client vdom.`
4950
4946
  optimized = optimized || !!parentVNode.dynamicChildren;
4951
4947
  const children = parentVNode.children;
4952
4948
  const l = children.length;
4953
- let hasWarned = false;
4949
+ let hasCheckedMismatch = false;
4954
4950
  for (let i = 0; i < l; i++) {
4955
4951
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4956
4952
  const isText = vnode.type === Text;
@@ -4978,17 +4974,17 @@ Server rendered element contains more child nodes than client vdom.`
4978
4974
  } else if (isText && !vnode.children) {
4979
4975
  insert(vnode.el = createText(""), container);
4980
4976
  } else {
4981
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4982
- if (!hasWarned) {
4977
+ if (!hasCheckedMismatch) {
4978
+ hasCheckedMismatch = true;
4979
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4983
4980
  warn$1(
4984
4981
  `Hydration children mismatch on`,
4985
4982
  container,
4986
4983
  `
4987
4984
  Server rendered element contains fewer child nodes than client vdom.`
4988
4985
  );
4989
- hasWarned = true;
4986
+ logMismatchError();
4990
4987
  }
4991
- logMismatchError();
4992
4988
  }
4993
4989
  patch(
4994
4990
  null,
@@ -5468,13 +5464,21 @@ function defineAsyncComponent(source) {
5468
5464
  const loaded = ref(false);
5469
5465
  const error = ref();
5470
5466
  const delayed = ref(!!delay);
5467
+ let timeoutTimer;
5468
+ let delayTimer;
5469
+ onUnmounted(() => {
5470
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
5471
+ if (delayTimer != null) clearTimeout(delayTimer);
5472
+ });
5471
5473
  if (delay) {
5472
- setTimeout(() => {
5474
+ delayTimer = setTimeout(() => {
5475
+ if (instance.isUnmounted) return;
5473
5476
  delayed.value = false;
5474
5477
  }, delay);
5475
5478
  }
5476
5479
  if (timeout != null) {
5477
- setTimeout(() => {
5480
+ timeoutTimer = setTimeout(() => {
5481
+ if (instance.isUnmounted) return;
5478
5482
  if (!loaded.value && !error.value) {
5479
5483
  const err = new Error(
5480
5484
  `Async component timed out after ${timeout}ms.`
@@ -5485,11 +5489,16 @@ function defineAsyncComponent(source) {
5485
5489
  }, timeout);
5486
5490
  }
5487
5491
  load().then(() => {
5492
+ if (instance.isUnmounted) return;
5488
5493
  loaded.value = true;
5489
5494
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5490
5495
  instance.parent.update();
5491
5496
  }
5492
5497
  }).catch((err) => {
5498
+ if (instance.isUnmounted) {
5499
+ pendingRequest = null;
5500
+ return;
5501
+ }
5493
5502
  onError(err);
5494
5503
  error.value = err;
5495
5504
  });
@@ -7474,7 +7483,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7474
7483
  return vm;
7475
7484
  }
7476
7485
  }
7477
- Vue.version = `2.6.14-compat:${"3.5.34"}`;
7486
+ Vue.version = `2.6.14-compat:${"3.5.36"}`;
7478
7487
  Vue.config = singletonApp.config;
7479
7488
  Vue.use = (plugin, ...options) => {
7480
7489
  if (plugin && isFunction(plugin.install)) {
@@ -7814,6 +7823,9 @@ function defineReactive(obj, key, val) {
7814
7823
  try {
7815
7824
  defineReactiveSimple(val, key2, val[key2]);
7816
7825
  } catch (e) {
7826
+ {
7827
+ warn$1(`Failed making property "${key2}" reactive:`, e);
7828
+ }
7817
7829
  }
7818
7830
  });
7819
7831
  }
@@ -8152,13 +8164,20 @@ function useModel(props, name, options = EMPTY_OBJ) {
8152
8164
  return;
8153
8165
  }
8154
8166
  const rawProps = i.vnode.props;
8155
- if (!(rawProps && // check if parent has passed v-model
8156
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8167
+ const hasVModel = !!(rawProps && // check if parent has passed v-model
8168
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
8169
+ if (!hasVModel) {
8157
8170
  localValue = value;
8158
8171
  trigger();
8159
8172
  }
8160
8173
  i.emit(`update:${name}`, emittedValue);
8161
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8174
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
8175
+ // event listeners. If a v-model listener emits an intermediate value
8176
+ // and a following listener restores the model to its previous prop
8177
+ // value before parent updates are flushed, the parent render can be
8178
+ // deduped as having no prop change. Force a local update so DOM state
8179
+ // such as an input's value is synchronized back to the current model.
8180
+ hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
8162
8181
  trigger();
8163
8182
  }
8164
8183
  prevSetValue = value;
@@ -10480,9 +10499,13 @@ function baseCreateRenderer(options, createHydrationFns) {
10480
10499
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10481
10500
  if (needTransition2) {
10482
10501
  if (moveType === 0) {
10483
- transition.beforeEnter(el);
10484
- hostInsert(el, container, anchor);
10485
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10502
+ if (transition.persisted && !el[leaveCbKey]) {
10503
+ hostInsert(el, container, anchor);
10504
+ } else {
10505
+ transition.beforeEnter(el);
10506
+ hostInsert(el, container, anchor);
10507
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10508
+ }
10486
10509
  } else {
10487
10510
  const { leave, delayLeave, afterLeave } = transition;
10488
10511
  const remove2 = () => {
@@ -10493,16 +10516,21 @@ function baseCreateRenderer(options, createHydrationFns) {
10493
10516
  }
10494
10517
  };
10495
10518
  const performLeave = () => {
10519
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
10496
10520
  if (el._isLeaving) {
10497
10521
  el[leaveCbKey](
10498
10522
  true
10499
10523
  /* cancelled */
10500
10524
  );
10501
10525
  }
10502
- leave(el, () => {
10526
+ if (transition.persisted && !wasLeaving) {
10503
10527
  remove2();
10504
- afterLeave && afterLeave();
10505
- });
10528
+ } else {
10529
+ leave(el, () => {
10530
+ remove2();
10531
+ afterLeave && afterLeave();
10532
+ });
10533
+ }
10506
10534
  };
10507
10535
  if (delayLeave) {
10508
10536
  delayLeave(el, remove2, performLeave);
@@ -12597,7 +12625,7 @@ function isMemoSame(cached, memo) {
12597
12625
  return true;
12598
12626
  }
12599
12627
 
12600
- const version = "3.5.34";
12628
+ const version = "3.5.36";
12601
12629
  const warn = warn$1 ;
12602
12630
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12603
12631
  const devtools = devtools$1 ;
@@ -13442,12 +13470,37 @@ function createInvoker(initialValue, instance) {
13442
13470
  } else if (e._vts <= invoker.attached) {
13443
13471
  return;
13444
13472
  }
13445
- callWithAsyncErrorHandling(
13446
- patchStopImmediatePropagation(e, invoker.value),
13447
- instance,
13448
- 5,
13449
- [e]
13450
- );
13473
+ const value = invoker.value;
13474
+ if (isArray(value)) {
13475
+ const originalStop = e.stopImmediatePropagation;
13476
+ e.stopImmediatePropagation = () => {
13477
+ originalStop.call(e);
13478
+ e._stopped = true;
13479
+ };
13480
+ const handlers = value.slice();
13481
+ const args = [e];
13482
+ for (let i = 0; i < handlers.length; i++) {
13483
+ if (e._stopped) {
13484
+ break;
13485
+ }
13486
+ const handler = handlers[i];
13487
+ if (handler) {
13488
+ callWithAsyncErrorHandling(
13489
+ handler,
13490
+ instance,
13491
+ 5,
13492
+ args
13493
+ );
13494
+ }
13495
+ }
13496
+ } else {
13497
+ callWithAsyncErrorHandling(
13498
+ value,
13499
+ instance,
13500
+ 5,
13501
+ [e]
13502
+ );
13503
+ }
13451
13504
  };
13452
13505
  invoker.value = initialValue;
13453
13506
  invoker.attached = getNow();
@@ -13463,20 +13516,6 @@ Expected function or array of functions, received type ${typeof value}.`
13463
13516
  );
13464
13517
  return NOOP;
13465
13518
  }
13466
- function patchStopImmediatePropagation(e, value) {
13467
- if (isArray(value)) {
13468
- const originalStop = e.stopImmediatePropagation;
13469
- e.stopImmediatePropagation = () => {
13470
- originalStop.call(e);
13471
- e._stopped = true;
13472
- };
13473
- return value.map(
13474
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
13475
- );
13476
- } else {
13477
- return value;
13478
- }
13479
- }
13480
13519
 
13481
13520
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
13482
13521
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -14159,7 +14198,8 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14159
14198
  if (children) {
14160
14199
  for (let i = 0; i < children.length; i++) {
14161
14200
  const child = children[i];
14162
- if (child.el && child.el instanceof Element) {
14201
+ if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
14202
+ !child.el[vShowHidden]) {
14163
14203
  prevChildren.push(child);
14164
14204
  setTransitionHooks(
14165
14205
  child,