@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
  **/
@@ -1602,9 +1602,6 @@ function targetTypeMap(rawType) {
1602
1602
  return 0 /* INVALID */;
1603
1603
  }
1604
1604
  }
1605
- function getTargetType(value) {
1606
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1607
- }
1608
1605
  // @__NO_SIDE_EFFECTS__
1609
1606
  function reactive(target) {
1610
1607
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1655,14 +1652,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1655
1652
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1656
1653
  return target;
1657
1654
  }
1658
- const targetType = getTargetType(target);
1659
- if (targetType === 0 /* INVALID */) {
1655
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1660
1656
  return target;
1661
1657
  }
1662
1658
  const existingProxy = proxyMap.get(target);
1663
1659
  if (existingProxy) {
1664
1660
  return existingProxy;
1665
1661
  }
1662
+ const targetType = targetTypeMap(toRawType(target));
1663
+ if (targetType === 0 /* INVALID */) {
1664
+ return target;
1665
+ }
1666
1666
  const proxy = new Proxy(
1667
1667
  target,
1668
1668
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2048,8 +2048,9 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2048
2048
  if (once && cb) {
2049
2049
  const _cb = cb;
2050
2050
  cb = (...args) => {
2051
- _cb(...args);
2051
+ const res = _cb(...args);
2052
2052
  watchHandle();
2053
+ return res;
2053
2054
  };
2054
2055
  }
2055
2056
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -2059,7 +2060,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2059
2060
  }
2060
2061
  if (cb) {
2061
2062
  const newValue = effect.run();
2062
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2063
+ if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2063
2064
  if (cleanup) {
2064
2065
  cleanup();
2065
2066
  }
@@ -3049,19 +3050,18 @@ const TeleportImpl = {
3049
3050
  target,
3050
3051
  props
3051
3052
  } = vnode;
3052
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3053
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3053
3054
  const pendingMount = pendingMounts.get(vnode);
3054
3055
  if (pendingMount) {
3055
3056
  pendingMount.flags |= 8;
3056
3057
  pendingMounts.delete(vnode);
3057
- shouldRemove = false;
3058
3058
  }
3059
3059
  if (target) {
3060
3060
  hostRemove(targetStart);
3061
3061
  hostRemove(targetAnchor);
3062
3062
  }
3063
3063
  doRemove && hostRemove(anchor);
3064
- if (shapeFlag & 16) {
3064
+ if (!pendingMount && shapeFlag & 16) {
3065
3065
  for (let i = 0; i < children.length; i++) {
3066
3066
  const child = children[i];
3067
3067
  unmount(
@@ -3967,10 +3967,10 @@ function createHydrationFunctions(rendererInternals) {
3967
3967
  slotScopeIds,
3968
3968
  optimized
3969
3969
  );
3970
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
3971
+ logMismatchError();
3972
+ }
3970
3973
  while (next) {
3971
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
3972
- logMismatchError();
3973
- }
3974
3974
  const cur = next;
3975
3975
  next = next.nextSibling;
3976
3976
  remove(cur);
@@ -4032,6 +4032,7 @@ function createHydrationFunctions(rendererInternals) {
4032
4032
  optimized = optimized || !!parentVNode.dynamicChildren;
4033
4033
  const children = parentVNode.children;
4034
4034
  const l = children.length;
4035
+ let hasCheckedMismatch = false;
4035
4036
  for (let i = 0; i < l; i++) {
4036
4037
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4037
4038
  const isText = vnode.type === Text;
@@ -4059,8 +4060,11 @@ function createHydrationFunctions(rendererInternals) {
4059
4060
  } else if (isText && !vnode.children) {
4060
4061
  insert(vnode.el = createText(""), container);
4061
4062
  } else {
4062
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4063
- logMismatchError();
4063
+ if (!hasCheckedMismatch) {
4064
+ hasCheckedMismatch = true;
4065
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4066
+ logMismatchError();
4067
+ }
4064
4068
  }
4065
4069
  patch(
4066
4070
  null,
@@ -4395,13 +4399,21 @@ function defineAsyncComponent(source) {
4395
4399
  const loaded = ref(false);
4396
4400
  const error = ref();
4397
4401
  const delayed = ref(!!delay);
4402
+ let timeoutTimer;
4403
+ let delayTimer;
4404
+ onUnmounted(() => {
4405
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
4406
+ if (delayTimer != null) clearTimeout(delayTimer);
4407
+ });
4398
4408
  if (delay) {
4399
- setTimeout(() => {
4409
+ delayTimer = setTimeout(() => {
4410
+ if (instance.isUnmounted) return;
4400
4411
  delayed.value = false;
4401
4412
  }, delay);
4402
4413
  }
4403
4414
  if (timeout != null) {
4404
- setTimeout(() => {
4415
+ timeoutTimer = setTimeout(() => {
4416
+ if (instance.isUnmounted) return;
4405
4417
  if (!loaded.value && !error.value) {
4406
4418
  const err = new Error(
4407
4419
  `Async component timed out after ${timeout}ms.`
@@ -4412,11 +4424,16 @@ function defineAsyncComponent(source) {
4412
4424
  }, timeout);
4413
4425
  }
4414
4426
  load().then(() => {
4427
+ if (instance.isUnmounted) return;
4415
4428
  loaded.value = true;
4416
4429
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
4417
4430
  instance.parent.update();
4418
4431
  }
4419
4432
  }).catch((err) => {
4433
+ if (instance.isUnmounted) {
4434
+ pendingRequest = null;
4435
+ return;
4436
+ }
4420
4437
  onError(err);
4421
4438
  error.value = err;
4422
4439
  });
@@ -6108,7 +6125,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6108
6125
  return vm;
6109
6126
  }
6110
6127
  }
6111
- Vue.version = `2.6.14-compat:${"3.5.34"}`;
6128
+ Vue.version = `2.6.14-compat:${"3.5.36"}`;
6112
6129
  Vue.config = singletonApp.config;
6113
6130
  Vue.use = (plugin, ...options) => {
6114
6131
  if (plugin && isFunction(plugin.install)) {
@@ -6654,13 +6671,20 @@ function useModel(props, name, options = EMPTY_OBJ) {
6654
6671
  return;
6655
6672
  }
6656
6673
  const rawProps = i.vnode.props;
6657
- if (!(rawProps && // check if parent has passed v-model
6658
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
6674
+ const hasVModel = !!(rawProps && // check if parent has passed v-model
6675
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
6676
+ if (!hasVModel) {
6659
6677
  localValue = value;
6660
6678
  trigger();
6661
6679
  }
6662
6680
  i.emit(`update:${name}`, emittedValue);
6663
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
6681
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
6682
+ // event listeners. If a v-model listener emits an intermediate value
6683
+ // and a following listener restores the model to its previous prop
6684
+ // value before parent updates are flushed, the parent render can be
6685
+ // deduped as having no prop change. Force a local update so DOM state
6686
+ // such as an input's value is synchronized back to the current model.
6687
+ hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
6664
6688
  trigger();
6665
6689
  }
6666
6690
  prevSetValue = value;
@@ -8535,9 +8559,13 @@ function baseCreateRenderer(options, createHydrationFns) {
8535
8559
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
8536
8560
  if (needTransition2) {
8537
8561
  if (moveType === 0) {
8538
- transition.beforeEnter(el);
8539
- hostInsert(el, container, anchor);
8540
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8562
+ if (transition.persisted && !el[leaveCbKey]) {
8563
+ hostInsert(el, container, anchor);
8564
+ } else {
8565
+ transition.beforeEnter(el);
8566
+ hostInsert(el, container, anchor);
8567
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8568
+ }
8541
8569
  } else {
8542
8570
  const { leave, delayLeave, afterLeave } = transition;
8543
8571
  const remove2 = () => {
@@ -8548,16 +8576,21 @@ function baseCreateRenderer(options, createHydrationFns) {
8548
8576
  }
8549
8577
  };
8550
8578
  const performLeave = () => {
8579
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
8551
8580
  if (el._isLeaving) {
8552
8581
  el[leaveCbKey](
8553
8582
  true
8554
8583
  /* cancelled */
8555
8584
  );
8556
8585
  }
8557
- leave(el, () => {
8586
+ if (transition.persisted && !wasLeaving) {
8558
8587
  remove2();
8559
- afterLeave && afterLeave();
8560
- });
8588
+ } else {
8589
+ leave(el, () => {
8590
+ remove2();
8591
+ afterLeave && afterLeave();
8592
+ });
8593
+ }
8561
8594
  };
8562
8595
  if (delayLeave) {
8563
8596
  delayLeave(el, remove2, performLeave);
@@ -10246,7 +10279,7 @@ function isMemoSame(cached, memo) {
10246
10279
  return true;
10247
10280
  }
10248
10281
 
10249
- const version = "3.5.34";
10282
+ const version = "3.5.36";
10250
10283
  const warn$1 = NOOP;
10251
10284
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10252
10285
  const devtools = void 0;
@@ -11000,31 +11033,42 @@ function createInvoker(initialValue, instance) {
11000
11033
  } else if (e._vts <= invoker.attached) {
11001
11034
  return;
11002
11035
  }
11003
- callWithAsyncErrorHandling(
11004
- patchStopImmediatePropagation(e, invoker.value),
11005
- instance,
11006
- 5,
11007
- [e]
11008
- );
11036
+ const value = invoker.value;
11037
+ if (isArray(value)) {
11038
+ const originalStop = e.stopImmediatePropagation;
11039
+ e.stopImmediatePropagation = () => {
11040
+ originalStop.call(e);
11041
+ e._stopped = true;
11042
+ };
11043
+ const handlers = value.slice();
11044
+ const args = [e];
11045
+ for (let i = 0; i < handlers.length; i++) {
11046
+ if (e._stopped) {
11047
+ break;
11048
+ }
11049
+ const handler = handlers[i];
11050
+ if (handler) {
11051
+ callWithAsyncErrorHandling(
11052
+ handler,
11053
+ instance,
11054
+ 5,
11055
+ args
11056
+ );
11057
+ }
11058
+ }
11059
+ } else {
11060
+ callWithAsyncErrorHandling(
11061
+ value,
11062
+ instance,
11063
+ 5,
11064
+ [e]
11065
+ );
11066
+ }
11009
11067
  };
11010
11068
  invoker.value = initialValue;
11011
11069
  invoker.attached = getNow();
11012
11070
  return invoker;
11013
11071
  }
11014
- function patchStopImmediatePropagation(e, value) {
11015
- if (isArray(value)) {
11016
- const originalStop = e.stopImmediatePropagation;
11017
- e.stopImmediatePropagation = () => {
11018
- originalStop.call(e);
11019
- e._stopped = true;
11020
- };
11021
- return value.map(
11022
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
11023
- );
11024
- } else {
11025
- return value;
11026
- }
11027
- }
11028
11072
 
11029
11073
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11030
11074
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -11643,7 +11687,8 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11643
11687
  if (children) {
11644
11688
  for (let i = 0; i < children.length; i++) {
11645
11689
  const child = children[i];
11646
- if (child.el && child.el instanceof Element) {
11690
+ if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
11691
+ !child.el[vShowHidden]) {
11647
11692
  prevChildren.push(child);
11648
11693
  setTransitionHooks(
11649
11694
  child,
@@ -14585,7 +14630,7 @@ const tokenizer = new Tokenizer(stack, {
14585
14630
  }
14586
14631
  },
14587
14632
  oncdata(start, end) {
14588
- if (stack[0].ns !== 0) {
14633
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) {
14589
14634
  onText(getSlice(start, end), start, end);
14590
14635
  } else {
14591
14636
  emitError(1, start - 9);
@@ -15335,6 +15380,7 @@ function createTransformContext(root, {
15335
15380
  imports: [],
15336
15381
  cached: [],
15337
15382
  constantCache: /* @__PURE__ */ new WeakMap(),
15383
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
15338
15384
  temps: 0,
15339
15385
  identifiers: /* @__PURE__ */ Object.create(null),
15340
15386
  scopes: {
@@ -16359,7 +16405,7 @@ const transformExpression = (node, context) => {
16359
16405
  const exp = dir.exp;
16360
16406
  const arg = dir.arg;
16361
16407
  if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
16362
- !(memo && arg && arg.type === 4 && arg.content === "key")) {
16408
+ !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) {
16363
16409
  dir.exp = processExpression(
16364
16410
  exp,
16365
16411
  context,
@@ -16792,27 +16838,22 @@ const transformFor = createStructuralDirectiveTransform(
16792
16838
  const keyProp = findProp(node, `key`, false, true);
16793
16839
  const isDirKey = keyProp && keyProp.type === 7;
16794
16840
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16795
- if (memo && keyExp && isDirKey) {
16796
- {
16797
- keyProp.exp = keyExp = processExpression(
16798
- keyExp,
16799
- context
16800
- );
16801
- }
16802
- }
16803
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
16804
- if (isTemplate) {
16805
- if (memo) {
16841
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
16842
+ {
16843
+ if (isTemplate && memo) {
16806
16844
  memo.exp = processExpression(
16807
16845
  memo.exp,
16808
16846
  context
16809
16847
  );
16810
16848
  }
16811
- if (keyProperty && keyProp.type !== 6) {
16812
- keyProperty.value = processExpression(
16849
+ if ((isTemplate || memo) && keyProperty && isDirKey) {
16850
+ keyExp = keyProp.exp = keyProperty.value = processExpression(
16813
16851
  keyProperty.value,
16814
16852
  context
16815
16853
  );
16854
+ if (memo) {
16855
+ context.vForMemoKeyedNodes.add(node);
16856
+ }
16816
16857
  }
16817
16858
  }
16818
16859
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;