@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
  **/
@@ -1745,9 +1745,6 @@ function targetTypeMap(rawType) {
1745
1745
  return 0 /* INVALID */;
1746
1746
  }
1747
1747
  }
1748
- function getTargetType(value) {
1749
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1750
- }
1751
1748
  // @__NO_SIDE_EFFECTS__
1752
1749
  function reactive(target) {
1753
1750
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1805,14 +1802,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1805
1802
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1806
1803
  return target;
1807
1804
  }
1808
- const targetType = getTargetType(target);
1809
- if (targetType === 0 /* INVALID */) {
1805
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1810
1806
  return target;
1811
1807
  }
1812
1808
  const existingProxy = proxyMap.get(target);
1813
1809
  if (existingProxy) {
1814
1810
  return existingProxy;
1815
1811
  }
1812
+ const targetType = targetTypeMap(toRawType(target));
1813
+ if (targetType === 0 /* INVALID */) {
1814
+ return target;
1815
+ }
1816
1816
  const proxy = new Proxy(
1817
1817
  target,
1818
1818
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2240,8 +2240,9 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2240
2240
  if (once && cb) {
2241
2241
  const _cb = cb;
2242
2242
  cb = (...args) => {
2243
- _cb(...args);
2243
+ const res = _cb(...args);
2244
2244
  watchHandle();
2245
+ return res;
2245
2246
  };
2246
2247
  }
2247
2248
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -2251,7 +2252,7 @@ function watch$1(source, cb, options = EMPTY_OBJ) {
2251
2252
  }
2252
2253
  if (cb) {
2253
2254
  const newValue = effect.run();
2254
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2255
+ if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
2255
2256
  if (cleanup) {
2256
2257
  cleanup();
2257
2258
  }
@@ -3964,19 +3965,18 @@ const TeleportImpl = {
3964
3965
  target,
3965
3966
  props
3966
3967
  } = vnode;
3967
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3968
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3968
3969
  const pendingMount = pendingMounts.get(vnode);
3969
3970
  if (pendingMount) {
3970
3971
  pendingMount.flags |= 8;
3971
3972
  pendingMounts.delete(vnode);
3972
- shouldRemove = false;
3973
3973
  }
3974
3974
  if (target) {
3975
3975
  hostRemove(targetStart);
3976
3976
  hostRemove(targetAnchor);
3977
3977
  }
3978
3978
  doRemove && hostRemove(anchor);
3979
- if (shapeFlag & 16) {
3979
+ if (!pendingMount && shapeFlag & 16) {
3980
3980
  for (let i = 0; i < children.length; i++) {
3981
3981
  const child = children[i];
3982
3982
  unmount(
@@ -4947,20 +4947,16 @@ function createHydrationFunctions(rendererInternals) {
4947
4947
  slotScopeIds,
4948
4948
  optimized
4949
4949
  );
4950
- let hasWarned = false;
4951
- while (next) {
4952
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4953
- if (!hasWarned) {
4954
- warn$1(
4955
- `Hydration children mismatch on`,
4956
- el,
4957
- `
4950
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4951
+ warn$1(
4952
+ `Hydration children mismatch on`,
4953
+ el,
4954
+ `
4958
4955
  Server rendered element contains more child nodes than client vdom.`
4959
- );
4960
- hasWarned = true;
4961
- }
4962
- logMismatchError();
4963
- }
4956
+ );
4957
+ logMismatchError();
4958
+ }
4959
+ while (next) {
4964
4960
  const cur = next;
4965
4961
  next = next.nextSibling;
4966
4962
  remove(cur);
@@ -5023,7 +5019,7 @@ Server rendered element contains more child nodes than client vdom.`
5023
5019
  optimized = optimized || !!parentVNode.dynamicChildren;
5024
5020
  const children = parentVNode.children;
5025
5021
  const l = children.length;
5026
- let hasWarned = false;
5022
+ let hasCheckedMismatch = false;
5027
5023
  for (let i = 0; i < l; i++) {
5028
5024
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
5029
5025
  const isText = vnode.type === Text;
@@ -5051,17 +5047,17 @@ Server rendered element contains more child nodes than client vdom.`
5051
5047
  } else if (isText && !vnode.children) {
5052
5048
  insert(vnode.el = createText(""), container);
5053
5049
  } else {
5054
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5055
- if (!hasWarned) {
5050
+ if (!hasCheckedMismatch) {
5051
+ hasCheckedMismatch = true;
5052
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5056
5053
  warn$1(
5057
5054
  `Hydration children mismatch on`,
5058
5055
  container,
5059
5056
  `
5060
5057
  Server rendered element contains fewer child nodes than client vdom.`
5061
5058
  );
5062
- hasWarned = true;
5059
+ logMismatchError();
5063
5060
  }
5064
- logMismatchError();
5065
5061
  }
5066
5062
  patch(
5067
5063
  null,
@@ -5541,13 +5537,21 @@ function defineAsyncComponent(source) {
5541
5537
  const loaded = ref(false);
5542
5538
  const error = ref();
5543
5539
  const delayed = ref(!!delay);
5540
+ let timeoutTimer;
5541
+ let delayTimer;
5542
+ onUnmounted(() => {
5543
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
5544
+ if (delayTimer != null) clearTimeout(delayTimer);
5545
+ });
5544
5546
  if (delay) {
5545
- setTimeout(() => {
5547
+ delayTimer = setTimeout(() => {
5548
+ if (instance.isUnmounted) return;
5546
5549
  delayed.value = false;
5547
5550
  }, delay);
5548
5551
  }
5549
5552
  if (timeout != null) {
5550
- setTimeout(() => {
5553
+ timeoutTimer = setTimeout(() => {
5554
+ if (instance.isUnmounted) return;
5551
5555
  if (!loaded.value && !error.value) {
5552
5556
  const err = new Error(
5553
5557
  `Async component timed out after ${timeout}ms.`
@@ -5558,11 +5562,16 @@ function defineAsyncComponent(source) {
5558
5562
  }, timeout);
5559
5563
  }
5560
5564
  load().then(() => {
5565
+ if (instance.isUnmounted) return;
5561
5566
  loaded.value = true;
5562
5567
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5563
5568
  instance.parent.update();
5564
5569
  }
5565
5570
  }).catch((err) => {
5571
+ if (instance.isUnmounted) {
5572
+ pendingRequest = null;
5573
+ return;
5574
+ }
5566
5575
  onError(err);
5567
5576
  error.value = err;
5568
5577
  });
@@ -7547,7 +7556,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7547
7556
  return vm;
7548
7557
  }
7549
7558
  }
7550
- Vue.version = `2.6.14-compat:${"3.5.34"}`;
7559
+ Vue.version = `2.6.14-compat:${"3.5.36"}`;
7551
7560
  Vue.config = singletonApp.config;
7552
7561
  Vue.use = (plugin, ...options) => {
7553
7562
  if (plugin && isFunction(plugin.install)) {
@@ -7887,6 +7896,9 @@ function defineReactive(obj, key, val) {
7887
7896
  try {
7888
7897
  defineReactiveSimple(val, key2, val[key2]);
7889
7898
  } catch (e) {
7899
+ {
7900
+ warn$1(`Failed making property "${key2}" reactive:`, e);
7901
+ }
7890
7902
  }
7891
7903
  });
7892
7904
  }
@@ -8225,13 +8237,20 @@ function useModel(props, name, options = EMPTY_OBJ) {
8225
8237
  return;
8226
8238
  }
8227
8239
  const rawProps = i.vnode.props;
8228
- if (!(rawProps && // check if parent has passed v-model
8229
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
8240
+ const hasVModel = !!(rawProps && // check if parent has passed v-model
8241
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
8242
+ if (!hasVModel) {
8230
8243
  localValue = value;
8231
8244
  trigger();
8232
8245
  }
8233
8246
  i.emit(`update:${name}`, emittedValue);
8234
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
8247
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
8248
+ // event listeners. If a v-model listener emits an intermediate value
8249
+ // and a following listener restores the model to its previous prop
8250
+ // value before parent updates are flushed, the parent render can be
8251
+ // deduped as having no prop change. Force a local update so DOM state
8252
+ // such as an input's value is synchronized back to the current model.
8253
+ hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
8235
8254
  trigger();
8236
8255
  }
8237
8256
  prevSetValue = value;
@@ -10553,9 +10572,13 @@ function baseCreateRenderer(options, createHydrationFns) {
10553
10572
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10554
10573
  if (needTransition2) {
10555
10574
  if (moveType === 0) {
10556
- transition.beforeEnter(el);
10557
- hostInsert(el, container, anchor);
10558
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10575
+ if (transition.persisted && !el[leaveCbKey]) {
10576
+ hostInsert(el, container, anchor);
10577
+ } else {
10578
+ transition.beforeEnter(el);
10579
+ hostInsert(el, container, anchor);
10580
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10581
+ }
10559
10582
  } else {
10560
10583
  const { leave, delayLeave, afterLeave } = transition;
10561
10584
  const remove2 = () => {
@@ -10566,16 +10589,21 @@ function baseCreateRenderer(options, createHydrationFns) {
10566
10589
  }
10567
10590
  };
10568
10591
  const performLeave = () => {
10592
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
10569
10593
  if (el._isLeaving) {
10570
10594
  el[leaveCbKey](
10571
10595
  true
10572
10596
  /* cancelled */
10573
10597
  );
10574
10598
  }
10575
- leave(el, () => {
10599
+ if (transition.persisted && !wasLeaving) {
10576
10600
  remove2();
10577
- afterLeave && afterLeave();
10578
- });
10601
+ } else {
10602
+ leave(el, () => {
10603
+ remove2();
10604
+ afterLeave && afterLeave();
10605
+ });
10606
+ }
10579
10607
  };
10580
10608
  if (delayLeave) {
10581
10609
  delayLeave(el, remove2, performLeave);
@@ -12670,7 +12698,7 @@ function isMemoSame(cached, memo) {
12670
12698
  return true;
12671
12699
  }
12672
12700
 
12673
- const version = "3.5.34";
12701
+ const version = "3.5.36";
12674
12702
  const warn = warn$1 ;
12675
12703
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12676
12704
  const devtools = devtools$1 ;
@@ -13515,12 +13543,37 @@ function createInvoker(initialValue, instance) {
13515
13543
  } else if (e._vts <= invoker.attached) {
13516
13544
  return;
13517
13545
  }
13518
- callWithAsyncErrorHandling(
13519
- patchStopImmediatePropagation(e, invoker.value),
13520
- instance,
13521
- 5,
13522
- [e]
13523
- );
13546
+ const value = invoker.value;
13547
+ if (isArray(value)) {
13548
+ const originalStop = e.stopImmediatePropagation;
13549
+ e.stopImmediatePropagation = () => {
13550
+ originalStop.call(e);
13551
+ e._stopped = true;
13552
+ };
13553
+ const handlers = value.slice();
13554
+ const args = [e];
13555
+ for (let i = 0; i < handlers.length; i++) {
13556
+ if (e._stopped) {
13557
+ break;
13558
+ }
13559
+ const handler = handlers[i];
13560
+ if (handler) {
13561
+ callWithAsyncErrorHandling(
13562
+ handler,
13563
+ instance,
13564
+ 5,
13565
+ args
13566
+ );
13567
+ }
13568
+ }
13569
+ } else {
13570
+ callWithAsyncErrorHandling(
13571
+ value,
13572
+ instance,
13573
+ 5,
13574
+ [e]
13575
+ );
13576
+ }
13524
13577
  };
13525
13578
  invoker.value = initialValue;
13526
13579
  invoker.attached = getNow();
@@ -13536,20 +13589,6 @@ Expected function or array of functions, received type ${typeof value}.`
13536
13589
  );
13537
13590
  return NOOP;
13538
13591
  }
13539
- function patchStopImmediatePropagation(e, value) {
13540
- if (isArray(value)) {
13541
- const originalStop = e.stopImmediatePropagation;
13542
- e.stopImmediatePropagation = () => {
13543
- originalStop.call(e);
13544
- e._stopped = true;
13545
- };
13546
- return value.map(
13547
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
13548
- );
13549
- } else {
13550
- return value;
13551
- }
13552
- }
13553
13592
 
13554
13593
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
13555
13594
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -14232,7 +14271,8 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14232
14271
  if (children) {
14233
14272
  for (let i = 0; i < children.length; i++) {
14234
14273
  const child = children[i];
14235
- if (child.el && child.el instanceof Element) {
14274
+ if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
14275
+ !child.el[vShowHidden]) {
14236
14276
  prevChildren.push(child);
14237
14277
  setTransitionHooks(
14238
14278
  child,
@@ -16833,7 +16873,7 @@ const tokenizer = new Tokenizer(stack, {
16833
16873
  }
16834
16874
  },
16835
16875
  oncdata(start, end) {
16836
- if (stack[0].ns !== 0) {
16876
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) {
16837
16877
  onText(getSlice(start, end), start, end);
16838
16878
  } else {
16839
16879
  emitError(1, start - 9);
@@ -17604,6 +17644,7 @@ function createTransformContext(root, {
17604
17644
  imports: [],
17605
17645
  cached: [],
17606
17646
  constantCache: /* @__PURE__ */ new WeakMap(),
17647
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
17607
17648
  temps: 0,
17608
17649
  identifiers: /* @__PURE__ */ Object.create(null),
17609
17650
  scopes: {
@@ -18469,7 +18510,7 @@ const transformExpression = (node, context) => {
18469
18510
  const exp = dir.exp;
18470
18511
  const arg = dir.arg;
18471
18512
  if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
18472
- !(memo && arg && arg.type === 4 && arg.content === "key")) {
18513
+ !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) {
18473
18514
  dir.exp = processExpression(
18474
18515
  exp,
18475
18516
  context,
@@ -18723,7 +18764,7 @@ const transformFor = createStructuralDirectiveTransform(
18723
18764
  const keyProp = findProp(node, `key`, false, true);
18724
18765
  keyProp && keyProp.type === 7;
18725
18766
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18726
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18767
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
18727
18768
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
18728
18769
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
18729
18770
  forNode.codegenNode = createVNodeCall(