vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.34
2
+ * vue v3.5.36
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.34
2
+ * vue v3.5.36
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.34
2
+ * vue 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
  }
@@ -3495,19 +3496,18 @@ const TeleportImpl = {
3495
3496
  target,
3496
3497
  props
3497
3498
  } = vnode;
3498
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3499
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3499
3500
  const pendingMount = pendingMounts.get(vnode);
3500
3501
  if (pendingMount) {
3501
3502
  pendingMount.flags |= 8;
3502
3503
  pendingMounts.delete(vnode);
3503
- shouldRemove = false;
3504
3504
  }
3505
3505
  if (target) {
3506
3506
  hostRemove(targetStart);
3507
3507
  hostRemove(targetAnchor);
3508
3508
  }
3509
3509
  doRemove && hostRemove(anchor);
3510
- if (shapeFlag & 16) {
3510
+ if (!pendingMount && shapeFlag & 16) {
3511
3511
  for (let i = 0; i < children.length; i++) {
3512
3512
  const child = children[i];
3513
3513
  unmount(
@@ -4475,20 +4475,16 @@ function createHydrationFunctions(rendererInternals) {
4475
4475
  slotScopeIds,
4476
4476
  optimized
4477
4477
  );
4478
- let hasWarned = false;
4479
- while (next) {
4480
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4481
- if (!hasWarned) {
4482
- warn$1(
4483
- `Hydration children mismatch on`,
4484
- el,
4485
- `
4478
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4479
+ warn$1(
4480
+ `Hydration children mismatch on`,
4481
+ el,
4482
+ `
4486
4483
  Server rendered element contains more child nodes than client vdom.`
4487
- );
4488
- hasWarned = true;
4489
- }
4490
- logMismatchError();
4491
- }
4484
+ );
4485
+ logMismatchError();
4486
+ }
4487
+ while (next) {
4492
4488
  const cur = next;
4493
4489
  next = next.nextSibling;
4494
4490
  remove(cur);
@@ -4551,7 +4547,7 @@ Server rendered element contains more child nodes than client vdom.`
4551
4547
  optimized = optimized || !!parentVNode.dynamicChildren;
4552
4548
  const children = parentVNode.children;
4553
4549
  const l = children.length;
4554
- let hasWarned = false;
4550
+ let hasCheckedMismatch = false;
4555
4551
  for (let i = 0; i < l; i++) {
4556
4552
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4557
4553
  const isText = vnode.type === Text;
@@ -4579,17 +4575,17 @@ Server rendered element contains more child nodes than client vdom.`
4579
4575
  } else if (isText && !vnode.children) {
4580
4576
  insert(vnode.el = createText(""), container);
4581
4577
  } else {
4582
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4583
- if (!hasWarned) {
4578
+ if (!hasCheckedMismatch) {
4579
+ hasCheckedMismatch = true;
4580
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4584
4581
  warn$1(
4585
4582
  `Hydration children mismatch on`,
4586
4583
  container,
4587
4584
  `
4588
4585
  Server rendered element contains fewer child nodes than client vdom.`
4589
4586
  );
4590
- hasWarned = true;
4587
+ logMismatchError();
4591
4588
  }
4592
- logMismatchError();
4593
4589
  }
4594
4590
  patch(
4595
4591
  null,
@@ -5069,13 +5065,21 @@ function defineAsyncComponent(source) {
5069
5065
  const loaded = ref(false);
5070
5066
  const error = ref();
5071
5067
  const delayed = ref(!!delay);
5068
+ let timeoutTimer;
5069
+ let delayTimer;
5070
+ onUnmounted(() => {
5071
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
5072
+ if (delayTimer != null) clearTimeout(delayTimer);
5073
+ });
5072
5074
  if (delay) {
5073
- setTimeout(() => {
5075
+ delayTimer = setTimeout(() => {
5076
+ if (instance.isUnmounted) return;
5074
5077
  delayed.value = false;
5075
5078
  }, delay);
5076
5079
  }
5077
5080
  if (timeout != null) {
5078
- setTimeout(() => {
5081
+ timeoutTimer = setTimeout(() => {
5082
+ if (instance.isUnmounted) return;
5079
5083
  if (!loaded.value && !error.value) {
5080
5084
  const err = new Error(
5081
5085
  `Async component timed out after ${timeout}ms.`
@@ -5086,11 +5090,16 @@ function defineAsyncComponent(source) {
5086
5090
  }, timeout);
5087
5091
  }
5088
5092
  load().then(() => {
5093
+ if (instance.isUnmounted) return;
5089
5094
  loaded.value = true;
5090
5095
  if (instance.parent && isKeepAlive(instance.parent.vnode)) {
5091
5096
  instance.parent.update();
5092
5097
  }
5093
5098
  }).catch((err) => {
5099
+ if (instance.isUnmounted) {
5100
+ pendingRequest = null;
5101
+ return;
5102
+ }
5094
5103
  onError(err);
5095
5104
  error.value = err;
5096
5105
  });
@@ -6669,13 +6678,20 @@ function useModel(props, name, options = EMPTY_OBJ) {
6669
6678
  return;
6670
6679
  }
6671
6680
  const rawProps = i.vnode.props;
6672
- if (!(rawProps && // check if parent has passed v-model
6673
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
6681
+ const hasVModel = !!(rawProps && // check if parent has passed v-model
6682
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps));
6683
+ if (!hasVModel) {
6674
6684
  localValue = value;
6675
6685
  trigger();
6676
6686
  }
6677
6687
  i.emit(`update:${name}`, emittedValue);
6678
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
6688
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || // #13524: browsers differ in when they flush microtasks between
6689
+ // event listeners. If a v-model listener emits an intermediate value
6690
+ // and a following listener restores the model to its previous prop
6691
+ // value before parent updates are flushed, the parent render can be
6692
+ // deduped as having no prop change. Force a local update so DOM state
6693
+ // such as an input's value is synchronized back to the current model.
6694
+ hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) {
6679
6695
  trigger();
6680
6696
  }
6681
6697
  prevSetValue = value;
@@ -8871,9 +8887,13 @@ function baseCreateRenderer(options, createHydrationFns) {
8871
8887
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
8872
8888
  if (needTransition2) {
8873
8889
  if (moveType === 0) {
8874
- transition.beforeEnter(el);
8875
- hostInsert(el, container, anchor);
8876
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8890
+ if (transition.persisted && !el[leaveCbKey]) {
8891
+ hostInsert(el, container, anchor);
8892
+ } else {
8893
+ transition.beforeEnter(el);
8894
+ hostInsert(el, container, anchor);
8895
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8896
+ }
8877
8897
  } else {
8878
8898
  const { leave, delayLeave, afterLeave } = transition;
8879
8899
  const remove2 = () => {
@@ -8884,16 +8904,21 @@ function baseCreateRenderer(options, createHydrationFns) {
8884
8904
  }
8885
8905
  };
8886
8906
  const performLeave = () => {
8907
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
8887
8908
  if (el._isLeaving) {
8888
8909
  el[leaveCbKey](
8889
8910
  true
8890
8911
  /* cancelled */
8891
8912
  );
8892
8913
  }
8893
- leave(el, () => {
8914
+ if (transition.persisted && !wasLeaving) {
8894
8915
  remove2();
8895
- afterLeave && afterLeave();
8896
- });
8916
+ } else {
8917
+ leave(el, () => {
8918
+ remove2();
8919
+ afterLeave && afterLeave();
8920
+ });
8921
+ }
8897
8922
  };
8898
8923
  if (delayLeave) {
8899
8924
  delayLeave(el, remove2, performLeave);
@@ -10900,7 +10925,7 @@ function isMemoSame(cached, memo) {
10900
10925
  return true;
10901
10926
  }
10902
10927
 
10903
- const version = "3.5.34";
10928
+ const version = "3.5.36";
10904
10929
  const warn = warn$1 ;
10905
10930
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10906
10931
  const devtools = devtools$1 ;
@@ -11657,12 +11682,37 @@ function createInvoker(initialValue, instance) {
11657
11682
  } else if (e._vts <= invoker.attached) {
11658
11683
  return;
11659
11684
  }
11660
- callWithAsyncErrorHandling(
11661
- patchStopImmediatePropagation(e, invoker.value),
11662
- instance,
11663
- 5,
11664
- [e]
11665
- );
11685
+ const value = invoker.value;
11686
+ if (isArray(value)) {
11687
+ const originalStop = e.stopImmediatePropagation;
11688
+ e.stopImmediatePropagation = () => {
11689
+ originalStop.call(e);
11690
+ e._stopped = true;
11691
+ };
11692
+ const handlers = value.slice();
11693
+ const args = [e];
11694
+ for (let i = 0; i < handlers.length; i++) {
11695
+ if (e._stopped) {
11696
+ break;
11697
+ }
11698
+ const handler = handlers[i];
11699
+ if (handler) {
11700
+ callWithAsyncErrorHandling(
11701
+ handler,
11702
+ instance,
11703
+ 5,
11704
+ args
11705
+ );
11706
+ }
11707
+ }
11708
+ } else {
11709
+ callWithAsyncErrorHandling(
11710
+ value,
11711
+ instance,
11712
+ 5,
11713
+ [e]
11714
+ );
11715
+ }
11666
11716
  };
11667
11717
  invoker.value = initialValue;
11668
11718
  invoker.attached = getNow();
@@ -11678,20 +11728,6 @@ Expected function or array of functions, received type ${typeof value}.`
11678
11728
  );
11679
11729
  return NOOP;
11680
11730
  }
11681
- function patchStopImmediatePropagation(e, value) {
11682
- if (isArray(value)) {
11683
- const originalStop = e.stopImmediatePropagation;
11684
- e.stopImmediatePropagation = () => {
11685
- originalStop.call(e);
11686
- e._stopped = true;
11687
- };
11688
- return value.map(
11689
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
11690
- );
11691
- } else {
11692
- return value;
11693
- }
11694
- }
11695
11731
 
11696
11732
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11697
11733
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -12365,7 +12401,8 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
12365
12401
  if (children) {
12366
12402
  for (let i = 0; i < children.length; i++) {
12367
12403
  const child = children[i];
12368
- if (child.el && child.el instanceof Element) {
12404
+ if (child.el && child.el instanceof Element && // Hidden v-show nodes have no previous layout box to animate from.
12405
+ !child.el[vShowHidden]) {
12369
12406
  prevChildren.push(child);
12370
12407
  setTransitionHooks(
12371
12408
  child,
@@ -14819,7 +14856,7 @@ const tokenizer = new Tokenizer(stack, {
14819
14856
  }
14820
14857
  },
14821
14858
  oncdata(start, end) {
14822
- if (stack[0].ns !== 0) {
14859
+ if ((stack[0] ? stack[0].ns : currentOptions.ns) !== 0) {
14823
14860
  onText(getSlice(start, end), start, end);
14824
14861
  } else {
14825
14862
  emitError(1, start - 9);
@@ -15519,6 +15556,7 @@ function createTransformContext(root, {
15519
15556
  imports: [],
15520
15557
  cached: [],
15521
15558
  constantCache: /* @__PURE__ */ new WeakMap(),
15559
+ vForMemoKeyedNodes: /* @__PURE__ */ new WeakSet(),
15522
15560
  temps: 0,
15523
15561
  identifiers: /* @__PURE__ */ Object.create(null),
15524
15562
  scopes: {
@@ -16370,7 +16408,7 @@ const transformExpression = (node, context) => {
16370
16408
  const exp = dir.exp;
16371
16409
  const arg = dir.arg;
16372
16410
  if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor)
16373
- !(memo && arg && arg.type === 4 && arg.content === "key")) {
16411
+ !(memo && context.vForMemoKeyedNodes.has(node) && arg && arg.type === 4 && arg.content === "key")) {
16374
16412
  dir.exp = processExpression(
16375
16413
  exp,
16376
16414
  context,
@@ -16624,7 +16662,7 @@ const transformFor = createStructuralDirectiveTransform(
16624
16662
  const keyProp = findProp(node, `key`, false, true);
16625
16663
  keyProp && keyProp.type === 7;
16626
16664
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16627
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
16665
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
16628
16666
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
16629
16667
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
16630
16668
  forNode.codegenNode = createVNodeCall(