@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
  **/
@@ -1748,9 +1748,6 @@ var Vue = (function () {
1748
1748
  return 0 /* INVALID */;
1749
1749
  }
1750
1750
  }
1751
- function getTargetType(value) {
1752
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1753
- }
1754
1751
  // @__NO_SIDE_EFFECTS__
1755
1752
  function reactive(target) {
1756
1753
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1808,14 +1805,17 @@ var Vue = (function () {
1808
1805
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1809
1806
  return target;
1810
1807
  }
1811
- const targetType = getTargetType(target);
1812
- if (targetType === 0 /* INVALID */) {
1808
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1813
1809
  return target;
1814
1810
  }
1815
1811
  const existingProxy = proxyMap.get(target);
1816
1812
  if (existingProxy) {
1817
1813
  return existingProxy;
1818
1814
  }
1815
+ const targetType = targetTypeMap(toRawType(target));
1816
+ if (targetType === 0 /* INVALID */) {
1817
+ return target;
1818
+ }
1819
1819
  const proxy = new Proxy(
1820
1820
  target,
1821
1821
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2243,8 +2243,9 @@ var Vue = (function () {
2243
2243
  if (once && cb) {
2244
2244
  const _cb = cb;
2245
2245
  cb = (...args) => {
2246
- _cb(...args);
2246
+ const res = _cb(...args);
2247
2247
  watchHandle();
2248
+ return res;
2248
2249
  };
2249
2250
  }
2250
2251
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -2254,7 +2255,7 @@ var Vue = (function () {
2254
2255
  }
2255
2256
  if (cb) {
2256
2257
  const newValue = effect.run();
2257
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2258
+ if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2258
2259
  if (cleanup) {
2259
2260
  cleanup();
2260
2261
  }
@@ -3939,19 +3940,18 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3939
3940
  target,
3940
3941
  props
3941
3942
  } = vnode;
3942
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3943
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3943
3944
  const pendingMount = pendingMounts.get(vnode);
3944
3945
  if (pendingMount) {
3945
3946
  pendingMount.flags |= 8;
3946
3947
  pendingMounts.delete(vnode);
3947
- shouldRemove = false;
3948
3948
  }
3949
3949
  if (target) {
3950
3950
  hostRemove(targetStart);
3951
3951
  hostRemove(targetAnchor);
3952
3952
  }
3953
3953
  doRemove && hostRemove(anchor);
3954
- if (shapeFlag & 16) {
3954
+ if (!pendingMount && shapeFlag & 16) {
3955
3955
  for (let i = 0; i < children.length; i++) {
3956
3956
  const child = children[i];
3957
3957
  unmount(
@@ -4922,20 +4922,16 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4922
4922
  slotScopeIds,
4923
4923
  optimized
4924
4924
  );
4925
- let hasWarned = false;
4926
- while (next) {
4927
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4928
- if (!hasWarned) {
4929
- warn$1(
4930
- `Hydration children mismatch on`,
4931
- el,
4932
- `
4925
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4926
+ warn$1(
4927
+ `Hydration children mismatch on`,
4928
+ el,
4929
+ `
4933
4930
  Server rendered element contains more child nodes than client vdom.`
4934
- );
4935
- hasWarned = true;
4936
- }
4937
- logMismatchError();
4938
- }
4931
+ );
4932
+ logMismatchError();
4933
+ }
4934
+ while (next) {
4939
4935
  const cur = next;
4940
4936
  next = next.nextSibling;
4941
4937
  remove(cur);
@@ -4998,7 +4994,7 @@ Server rendered element contains more child nodes than client vdom.`
4998
4994
  optimized = optimized || !!parentVNode.dynamicChildren;
4999
4995
  const children = parentVNode.children;
5000
4996
  const l = children.length;
5001
- let hasWarned = false;
4997
+ let hasCheckedMismatch = false;
5002
4998
  for (let i = 0; i < l; i++) {
5003
4999
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
5004
5000
  const isText = vnode.type === Text;
@@ -5026,17 +5022,17 @@ Server rendered element contains more child nodes than client vdom.`
5026
5022
  } else if (isText && !vnode.children) {
5027
5023
  insert(vnode.el = createText(""), container);
5028
5024
  } else {
5029
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5030
- if (!hasWarned) {
5025
+ if (!hasCheckedMismatch) {
5026
+ hasCheckedMismatch = true;
5027
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5031
5028
  warn$1(
5032
5029
  `Hydration children mismatch on`,
5033
5030
  container,
5034
5031
  `
5035
5032
  Server rendered element contains fewer child nodes than client vdom.`
5036
5033
  );
5037
- hasWarned = true;
5034
+ logMismatchError();
5038
5035
  }
5039
- logMismatchError();
5040
5036
  }
5041
5037
  patch(
5042
5038
  null,
@@ -5516,13 +5512,21 @@ Server rendered element contains fewer child nodes than client vdom.`
5516
5512
  const loaded = ref(false);
5517
5513
  const error = ref();
5518
5514
  const delayed = ref(!!delay);
5515
+ let timeoutTimer;
5516
+ let delayTimer;
5517
+ onUnmounted(() => {
5518
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
5519
+ if (delayTimer != null) clearTimeout(delayTimer);
5520
+ });
5519
5521
  if (delay) {
5520
- setTimeout(() => {
5522
+ delayTimer = setTimeout(() => {
5523
+ if (instance.isUnmounted) return;
5521
5524
  delayed.value = false;
5522
5525
  }, delay);
5523
5526
  }
5524
5527
  if (timeout != null) {
5525
- setTimeout(() => {
5528
+ timeoutTimer = setTimeout(() => {
5529
+ if (instance.isUnmounted) return;
5526
5530
  if (!loaded.value && !error.value) {
5527
5531
  const err = new Error(
5528
5532
  `Async component timed out after ${timeout}ms.`
@@ -5533,11 +5537,16 @@ Server rendered element contains fewer child nodes than client vdom.`
5533
5537
  }, timeout);
5534
5538
  }
5535
5539
  load().then(() => {
5540
+ if (instance.isUnmounted) return;
5536
5541
  loaded.value = true;
5537
5542
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5538
5543
  instance.parent.update();
5539
5544
  }
5540
5545
  }).catch((err) => {
5546
+ if (instance.isUnmounted) {
5547
+ pendingRequest = null;
5548
+ return;
5549
+ }
5541
5550
  onError(err);
5542
5551
  error.value = err;
5543
5552
  });
@@ -7513,7 +7522,7 @@ If this is a native custom element, make sure to exclude it from component resol
7513
7522
  return vm;
7514
7523
  }
7515
7524
  }
7516
- Vue.version = `2.6.14-compat:${"3.5.34"}`;
7525
+ Vue.version = `2.6.14-compat:${"3.5.36"}`;
7517
7526
  Vue.config = singletonApp.config;
7518
7527
  Vue.use = (plugin, ...options) => {
7519
7528
  if (plugin && isFunction(plugin.install)) {
@@ -7853,6 +7862,9 @@ If this is a native custom element, make sure to exclude it from component resol
7853
7862
  try {
7854
7863
  defineReactiveSimple(val, key2, val[key2]);
7855
7864
  } catch (e) {
7865
+ {
7866
+ warn$1(`Failed making property "${key2}" reactive:`, e);
7867
+ }
7856
7868
  }
7857
7869
  });
7858
7870
  }
@@ -8191,13 +8203,20 @@ If you want to remount the same app, move your app creation logic into a factory
8191
8203
  return;
8192
8204
  }
8193
8205
  const rawProps = i.vnode.props;
8194
- if (!(rawProps && // check if parent has passed v-model
8195
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8206
+ const hasVModel = !!(rawProps && // check if parent has passed v-model
8207
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
8208
+ if (!hasVModel) {
8196
8209
  localValue = value;
8197
8210
  trigger();
8198
8211
  }
8199
8212
  i.emit(`update:${name}`, emittedValue);
8200
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8213
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
8214
+ // event listeners. If a v-model listener emits an intermediate value
8215
+ // and a following listener restores the model to its previous prop
8216
+ // value before parent updates are flushed, the parent render can be
8217
+ // deduped as having no prop change. Force a local update so DOM state
8218
+ // such as an input's value is synchronized back to the current model.
8219
+ hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
8201
8220
  trigger();
8202
8221
  }
8203
8222
  prevSetValue = value;
@@ -10519,9 +10538,13 @@ If you want to remount the same app, move your app creation logic into a factory
10519
10538
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10520
10539
  if (needTransition2) {
10521
10540
  if (moveType === 0) {
10522
- transition.beforeEnter(el);
10523
- hostInsert(el, container, anchor);
10524
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10541
+ if (transition.persisted && !el[leaveCbKey]) {
10542
+ hostInsert(el, container, anchor);
10543
+ } else {
10544
+ transition.beforeEnter(el);
10545
+ hostInsert(el, container, anchor);
10546
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10547
+ }
10525
10548
  } else {
10526
10549
  const { leave, delayLeave, afterLeave } = transition;
10527
10550
  const remove2 = () => {
@@ -10532,16 +10555,21 @@ If you want to remount the same app, move your app creation logic into a factory
10532
10555
  }
10533
10556
  };
10534
10557
  const performLeave = () => {
10558
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
10535
10559
  if (el._isLeaving) {
10536
10560
  el[leaveCbKey](
10537
10561
  true
10538
10562
  /* cancelled */
10539
10563
  );
10540
10564
  }
10541
- leave(el, () => {
10565
+ if (transition.persisted && !wasLeaving) {
10542
10566
  remove2();
10543
- afterLeave && afterLeave();
10544
- });
10567
+ } else {
10568
+ leave(el, () => {
10569
+ remove2();
10570
+ afterLeave && afterLeave();
10571
+ });
10572
+ }
10545
10573
  };
10546
10574
  if (delayLeave) {
10547
10575
  delayLeave(el, remove2, performLeave);
@@ -12622,7 +12650,7 @@ Component that was made reactive: `,
12622
12650
  return true;
12623
12651
  }
12624
12652
 
12625
- const version = "3.5.34";
12653
+ const version = "3.5.36";
12626
12654
  const warn = warn$1 ;
12627
12655
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12628
12656
  const devtools = devtools$1 ;
@@ -13448,12 +13476,37 @@ Component that was made reactive: `,
13448
13476
  } else if (e._vts <= invoker.attached) {
13449
13477
  return;
13450
13478
  }
13451
- callWithAsyncErrorHandling(
13452
- patchStopImmediatePropagation(e, invoker.value),
13453
- instance,
13454
- 5,
13455
- [e]
13456
- );
13479
+ const value = invoker.value;
13480
+ if (isArray(value)) {
13481
+ const originalStop = e.stopImmediatePropagation;
13482
+ e.stopImmediatePropagation = () => {
13483
+ originalStop.call(e);
13484
+ e._stopped = true;
13485
+ };
13486
+ const handlers = value.slice();
13487
+ const args = [e];
13488
+ for (let i = 0; i < handlers.length; i++) {
13489
+ if (e._stopped) {
13490
+ break;
13491
+ }
13492
+ const handler = handlers[i];
13493
+ if (handler) {
13494
+ callWithAsyncErrorHandling(
13495
+ handler,
13496
+ instance,
13497
+ 5,
13498
+ args
13499
+ );
13500
+ }
13501
+ }
13502
+ } else {
13503
+ callWithAsyncErrorHandling(
13504
+ value,
13505
+ instance,
13506
+ 5,
13507
+ [e]
13508
+ );
13509
+ }
13457
13510
  };
13458
13511
  invoker.value = initialValue;
13459
13512
  invoker.attached = getNow();
@@ -13469,20 +13522,6 @@ Expected function or array of functions, received type ${typeof value}.`
13469
13522
  );
13470
13523
  return NOOP;
13471
13524
  }
13472
- function patchStopImmediatePropagation(e, value) {
13473
- if (isArray(value)) {
13474
- const originalStop = e.stopImmediatePropagation;
13475
- e.stopImmediatePropagation = () => {
13476
- originalStop.call(e);
13477
- e._stopped = true;
13478
- };
13479
- return value.map(
13480
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
13481
- );
13482
- } else {
13483
- return value;
13484
- }
13485
- }
13486
13525
 
13487
13526
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
13488
13527
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -14153,7 +14192,8 @@ Expected function or array of functions, received type ${typeof value}.`
14153
14192
  if (children) {
14154
14193
  for (let i = 0; i < children.length; i++) {
14155
14194
  const child = children[i];
14156
- if (child.el && child.el instanceof Element) {
14195
+ if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
14196
+ !child.el[vShowHidden]) {
14157
14197
  prevChildren.push(child);
14158
14198
  setTransitionHooks(
14159
14199
  child,
@@ -16713,7 +16753,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16713
16753
  }
16714
16754
  },
16715
16755
  oncdata(start, end) {
16716
- if (stack[0].ns !== 0) {
16756
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) {
16717
16757
  onText(getSlice(start, end), start, end);
16718
16758
  } else {
16719
16759
  emitError(1, start - 9);
@@ -17484,6 +17524,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17484
17524
  imports: [],
17485
17525
  cached: [],
17486
17526
  constantCache: /* @__PURE__ */ new WeakMap(),
17527
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
17487
17528
  temps: 0,
17488
17529
  identifiers: /* @__PURE__ */ Object.create(null),
17489
17530
  scopes: {
@@ -18349,7 +18390,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18349
18390
  const exp = dir.exp;
18350
18391
  const arg = dir.arg;
18351
18392
  if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
18352
- !(memo && arg && arg.type === 4 && arg.content === "key")) {
18393
+ !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) {
18353
18394
  dir.exp = processExpression(
18354
18395
  exp,
18355
18396
  context,
@@ -18603,7 +18644,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18603
18644
  const keyProp = findProp(node, `key`, false, true);
18604
18645
  keyProp && keyProp.type === 7;
18605
18646
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18606
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18647
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
18607
18648
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
18608
18649
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
18609
18650
  forNode.codegenNode = createVNodeCall(