@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
  **/
@@ -1749,9 +1749,6 @@ function targetTypeMap(rawType) {
1749
1749
  return 0 /* INVALID */;
1750
1750
  }
1751
1751
  }
1752
- function getTargetType(value) {
1753
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1754
- }
1755
1752
  // @__NO_SIDE_EFFECTS__
1756
1753
  function reactive(target) {
1757
1754
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1809,14 +1806,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1809
1806
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1810
1807
  return target;
1811
1808
  }
1812
- const targetType = getTargetType(target);
1813
- if (targetType === 0 /* INVALID */) {
1809
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1814
1810
  return target;
1815
1811
  }
1816
1812
  const existingProxy = proxyMap.get(target);
1817
1813
  if (existingProxy) {
1818
1814
  return existingProxy;
1819
1815
  }
1816
+ const targetType = targetTypeMap(toRawType(target));
1817
+ if (targetType === 0 /* INVALID */) {
1818
+ return target;
1819
+ }
1820
1820
  const proxy = new Proxy(
1821
1821
  target,
1822
1822
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2250,8 +2250,9 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2250
2250
  if (once && cb) {
2251
2251
  const _cb = cb;
2252
2252
  cb = (...args) => {
2253
- _cb(...args);
2253
+ const res = _cb(...args);
2254
2254
  watchHandle();
2255
+ return res;
2255
2256
  };
2256
2257
  }
2257
2258
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -2261,7 +2262,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2261
2262
  }
2262
2263
  if (cb) {
2263
2264
  const newValue = effect.run();
2264
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2265
+ if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2265
2266
  if (cleanup) {
2266
2267
  cleanup();
2267
2268
  }
@@ -3982,19 +3983,18 @@ const TeleportImpl = {
3982
3983
  target,
3983
3984
  props
3984
3985
  } = vnode;
3985
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3986
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3986
3987
  const pendingMount = pendingMounts.get(vnode);
3987
3988
  if (pendingMount) {
3988
3989
  pendingMount.flags |= 8;
3989
3990
  pendingMounts.delete(vnode);
3990
- shouldRemove = false;
3991
3991
  }
3992
3992
  if (target) {
3993
3993
  hostRemove(targetStart);
3994
3994
  hostRemove(targetAnchor);
3995
3995
  }
3996
3996
  doRemove && hostRemove(anchor);
3997
- if (shapeFlag & 16) {
3997
+ if (!pendingMount && shapeFlag & 16) {
3998
3998
  for (let i = 0; i < children.length; i++) {
3999
3999
  const child = children[i];
4000
4000
  unmount(
@@ -4966,20 +4966,16 @@ function createHydrationFunctions(rendererInternals) {
4966
4966
  slotScopeIds,
4967
4967
  optimized
4968
4968
  );
4969
- let hasWarned = false;
4970
- while (next) {
4971
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4972
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
4973
- warn$1(
4974
- `Hydration children mismatch on`,
4975
- el,
4976
- `
4969
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4970
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
4971
+ `Hydration children mismatch on`,
4972
+ el,
4973
+ `
4977
4974
  Server rendered element contains more child nodes than client vdom.`
4978
- );
4979
- hasWarned = true;
4980
- }
4981
- logMismatchError();
4982
- }
4975
+ );
4976
+ logMismatchError();
4977
+ }
4978
+ while (next) {
4983
4979
  const cur = next;
4984
4980
  next = next.nextSibling;
4985
4981
  remove(cur);
@@ -5053,7 +5049,7 @@ Server rendered element contains more child nodes than client vdom.`
5053
5049
  optimized = optimized || !!parentVNode.dynamicChildren;
5054
5050
  const children = parentVNode.children;
5055
5051
  const l = children.length;
5056
- let hasWarned = false;
5052
+ let hasCheckedMismatch = false;
5057
5053
  for (let i = 0; i < l; i++) {
5058
5054
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
5059
5055
  const isText = vnode.type === Text;
@@ -5081,17 +5077,17 @@ Server rendered element contains more child nodes than client vdom.`
5081
5077
  } else if (isText && !vnode.children) {
5082
5078
  insert(vnode.el = createText(""), container);
5083
5079
  } else {
5084
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5085
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
5086
- warn$1(
5080
+ if (!hasCheckedMismatch) {
5081
+ hasCheckedMismatch = true;
5082
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5083
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
5087
5084
  `Hydration children mismatch on`,
5088
5085
  container,
5089
5086
  `
5090
5087
  Server rendered element contains fewer child nodes than client vdom.`
5091
5088
  );
5092
- hasWarned = true;
5089
+ logMismatchError();
5093
5090
  }
5094
- logMismatchError();
5095
5091
  }
5096
5092
  patch(
5097
5093
  null,
@@ -5571,13 +5567,21 @@ function defineAsyncComponent(source) {
5571
5567
  const loaded = ref(false);
5572
5568
  const error = ref();
5573
5569
  const delayed = ref(!!delay);
5570
+ let timeoutTimer;
5571
+ let delayTimer;
5572
+ onUnmounted(() => {
5573
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
5574
+ if (delayTimer != null) clearTimeout(delayTimer);
5575
+ });
5574
5576
  if (delay) {
5575
- setTimeout(() => {
5577
+ delayTimer = setTimeout(() => {
5578
+ if (instance.isUnmounted) return;
5576
5579
  delayed.value = false;
5577
5580
  }, delay);
5578
5581
  }
5579
5582
  if (timeout != null) {
5580
- setTimeout(() => {
5583
+ timeoutTimer = setTimeout(() => {
5584
+ if (instance.isUnmounted) return;
5581
5585
  if (!loaded.value && !error.value) {
5582
5586
  const err = new Error(
5583
5587
  `Async component timed out after ${timeout}ms.`
@@ -5588,11 +5592,16 @@ function defineAsyncComponent(source) {
5588
5592
  }, timeout);
5589
5593
  }
5590
5594
  load().then(() => {
5595
+ if (instance.isUnmounted) return;
5591
5596
  loaded.value = true;
5592
5597
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5593
5598
  instance.parent.update();
5594
5599
  }
5595
5600
  }).catch((err) => {
5601
+ if (instance.isUnmounted) {
5602
+ pendingRequest = null;
5603
+ return;
5604
+ }
5596
5605
  onError(err);
5597
5606
  error.value = err;
5598
5607
  });
@@ -7579,7 +7588,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7579
7588
  return vm;
7580
7589
  }
7581
7590
  }
7582
- Vue.version = `2.6.14-compat:${"3.5.34"}`;
7591
+ Vue.version = `2.6.14-compat:${"3.5.36"}`;
7583
7592
  Vue.config = singletonApp.config;
7584
7593
  Vue.use = (plugin, ...options) => {
7585
7594
  if (plugin && isFunction(plugin.install)) {
@@ -7919,6 +7928,9 @@ function defineReactive(obj, key, val) {
7919
7928
  try {
7920
7929
  defineReactiveSimple(val, key2, val[key2]);
7921
7930
  } catch (e) {
7931
+ if (!!(process.env.NODE_ENV !== "production")) {
7932
+ warn$1(`Failed making property "${key2}" reactive:`, e);
7933
+ }
7922
7934
  }
7923
7935
  });
7924
7936
  }
@@ -8259,13 +8271,20 @@ function useModel(props, name, options = EMPTY_OBJ) {
8259
8271
  return;
8260
8272
  }
8261
8273
  const rawProps = i.vnode.props;
8262
- if (!(rawProps && // check if parent has passed v-model
8263
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8274
+ const hasVModel = !!(rawProps && // check if parent has passed v-model
8275
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
8276
+ if (!hasVModel) {
8264
8277
  localValue = value;
8265
8278
  trigger();
8266
8279
  }
8267
8280
  i.emit(`update:${name}`, emittedValue);
8268
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8281
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
8282
+ // event listeners. If a v-model listener emits an intermediate value
8283
+ // and a following listener restores the model to its previous prop
8284
+ // value before parent updates are flushed, the parent render can be
8285
+ // deduped as having no prop change. Force a local update so DOM state
8286
+ // such as an input's value is synchronized back to the current model.
8287
+ hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
8269
8288
  trigger();
8270
8289
  }
8271
8290
  prevSetValue = value;
@@ -10625,9 +10644,13 @@ function baseCreateRenderer(options, createHydrationFns) {
10625
10644
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10626
10645
  if (needTransition2) {
10627
10646
  if (moveType === 0) {
10628
- transition.beforeEnter(el);
10629
- hostInsert(el, container, anchor);
10630
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10647
+ if (transition.persisted && !el[leaveCbKey]) {
10648
+ hostInsert(el, container, anchor);
10649
+ } else {
10650
+ transition.beforeEnter(el);
10651
+ hostInsert(el, container, anchor);
10652
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10653
+ }
10631
10654
  } else {
10632
10655
  const { leave, delayLeave, afterLeave } = transition;
10633
10656
  const remove2 = () => {
@@ -10638,16 +10661,21 @@ function baseCreateRenderer(options, createHydrationFns) {
10638
10661
  }
10639
10662
  };
10640
10663
  const performLeave = () => {
10664
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
10641
10665
  if (el._isLeaving) {
10642
10666
  el[leaveCbKey](
10643
10667
  true
10644
10668
  /* cancelled */
10645
10669
  );
10646
10670
  }
10647
- leave(el, () => {
10671
+ if (transition.persisted && !wasLeaving) {
10648
10672
  remove2();
10649
- afterLeave && afterLeave();
10650
- });
10673
+ } else {
10674
+ leave(el, () => {
10675
+ remove2();
10676
+ afterLeave && afterLeave();
10677
+ });
10678
+ }
10651
10679
  };
10652
10680
  if (delayLeave) {
10653
10681
  delayLeave(el, remove2, performLeave);
@@ -12756,7 +12784,7 @@ function isMemoSame(cached, memo) {
12756
12784
  return true;
12757
12785
  }
12758
12786
 
12759
- const version = "3.5.34";
12787
+ const version = "3.5.36";
12760
12788
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12761
12789
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12762
12790
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13601,12 +13629,37 @@ function createInvoker(initialValue, instance) {
13601
13629
  } else if (e._vts <= invoker.attached) {
13602
13630
  return;
13603
13631
  }
13604
- callWithAsyncErrorHandling(
13605
- patchStopImmediatePropagation(e, invoker.value),
13606
- instance,
13607
- 5,
13608
- [e]
13609
- );
13632
+ const value = invoker.value;
13633
+ if (isArray(value)) {
13634
+ const originalStop = e.stopImmediatePropagation;
13635
+ e.stopImmediatePropagation = () => {
13636
+ originalStop.call(e);
13637
+ e._stopped = true;
13638
+ };
13639
+ const handlers = value.slice();
13640
+ const args = [e];
13641
+ for (let i = 0; i < handlers.length; i++) {
13642
+ if (e._stopped) {
13643
+ break;
13644
+ }
13645
+ const handler = handlers[i];
13646
+ if (handler) {
13647
+ callWithAsyncErrorHandling(
13648
+ handler,
13649
+ instance,
13650
+ 5,
13651
+ args
13652
+ );
13653
+ }
13654
+ }
13655
+ } else {
13656
+ callWithAsyncErrorHandling(
13657
+ value,
13658
+ instance,
13659
+ 5,
13660
+ [e]
13661
+ );
13662
+ }
13610
13663
  };
13611
13664
  invoker.value = initialValue;
13612
13665
  invoker.attached = getNow();
@@ -13622,20 +13675,6 @@ Expected function or array of functions, received type ${typeof value}.`
13622
13675
  );
13623
13676
  return NOOP;
13624
13677
  }
13625
- function patchStopImmediatePropagation(e, value) {
13626
- if (isArray(value)) {
13627
- const originalStop = e.stopImmediatePropagation;
13628
- e.stopImmediatePropagation = () => {
13629
- originalStop.call(e);
13630
- e._stopped = true;
13631
- };
13632
- return value.map(
13633
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
13634
- );
13635
- } else {
13636
- return value;
13637
- }
13638
- }
13639
13678
 
13640
13679
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
13641
13680
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -14318,7 +14357,8 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14318
14357
  if (children) {
14319
14358
  for (let i = 0; i < children.length; i++) {
14320
14359
  const child = children[i];
14321
- if (child.el && child.el instanceof Element) {
14360
+ if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
14361
+ !child.el[vShowHidden]) {
14322
14362
  prevChildren.push(child);
14323
14363
  setTransitionHooks(
14324
14364
  child,
@@ -16913,7 +16953,7 @@ const tokenizer = new Tokenizer(stack, {
16913
16953
  }
16914
16954
  },
16915
16955
  oncdata(start, end) {
16916
- if (stack[0].ns !== 0) {
16956
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) {
16917
16957
  onText(getSlice(start, end), start, end);
16918
16958
  } else {
16919
16959
  emitError(1, start - 9);
@@ -17685,6 +17725,7 @@ function createTransformContext(root, {
17685
17725
  imports: [],
17686
17726
  cached: [],
17687
17727
  constantCache: /* @__PURE__ */ new WeakMap(),
17728
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
17688
17729
  temps: 0,
17689
17730
  identifiers: /* @__PURE__ */ Object.create(null),
17690
17731
  scopes: {
@@ -18552,7 +18593,7 @@ const transformExpression = (node, context) => {
18552
18593
  const exp = dir.exp;
18553
18594
  const arg = dir.arg;
18554
18595
  if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
18555
- !(memo && arg && arg.type === 4 && arg.content === "key")) {
18596
+ !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) {
18556
18597
  dir.exp = processExpression(
18557
18598
  exp,
18558
18599
  context,
@@ -18806,7 +18847,7 @@ const transformFor = createStructuralDirectiveTransform(
18806
18847
  const keyProp = findProp(node, `key`, false, true);
18807
18848
  keyProp && keyProp.type === 7;
18808
18849
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18809
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18850
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
18810
18851
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
18811
18852
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
18812
18853
  forNode.codegenNode = createVNodeCall(