vue 3.5.33 → 3.5.35

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.33
2
+ * vue v3.5.35
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.33
2
+ * vue v3.5.35
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.33
2
+ * vue v3.5.35
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -427,12 +427,18 @@ class EffectScope {
427
427
  */
428
428
  this.cleanups = [];
429
429
  this._isPaused = false;
430
+ this._warnOnRun = true;
430
431
  this.__v_skip = true;
431
- this.parent = activeEffectScope;
432
432
  if (!detached && activeEffectScope) {
433
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
434
- this
435
- ) - 1;
433
+ if (activeEffectScope.active) {
434
+ this.parent = activeEffectScope;
435
+ this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
436
+ this
437
+ ) - 1;
438
+ } else {
439
+ this._active = false;
440
+ this._warnOnRun = false;
441
+ }
436
442
  }
437
443
  }
438
444
  get active() {
@@ -480,7 +486,7 @@ class EffectScope {
480
486
  } finally {
481
487
  activeEffectScope = currentEffectScope;
482
488
  }
483
- } else {
489
+ } else if (this._warnOnRun) {
484
490
  warn$2(`cannot run an inactive effect scope.`);
485
491
  }
486
492
  }
@@ -586,8 +592,12 @@ class ReactiveEffect {
586
592
  */
587
593
  this.cleanup = void 0;
588
594
  this.scheduler = void 0;
589
- if (activeEffectScope && activeEffectScope.active) {
590
- activeEffectScope.effects.push(this);
595
+ if (activeEffectScope) {
596
+ if (activeEffectScope.active) {
597
+ activeEffectScope.effects.push(this);
598
+ } else {
599
+ this.flags &= -2;
600
+ }
591
601
  }
592
602
  }
593
603
  pause() {
@@ -1735,9 +1745,6 @@ function targetTypeMap(rawType) {
1735
1745
  return 0 /* INVALID */;
1736
1746
  }
1737
1747
  }
1738
- function getTargetType(value) {
1739
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1740
- }
1741
1748
  // @__NO_SIDE_EFFECTS__
1742
1749
  function reactive(target) {
1743
1750
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1795,14 +1802,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1795
1802
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1796
1803
  return target;
1797
1804
  }
1798
- const targetType = getTargetType(target);
1799
- if (targetType === 0 /* INVALID */) {
1805
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1800
1806
  return target;
1801
1807
  }
1802
1808
  const existingProxy = proxyMap.get(target);
1803
1809
  if (existingProxy) {
1804
1810
  return existingProxy;
1805
1811
  }
1812
+ const targetType = targetTypeMap(toRawType(target));
1813
+ if (targetType === 0 /* INVALID */) {
1814
+ return target;
1815
+ }
1806
1816
  const proxy = new Proxy(
1807
1817
  target,
1808
1818
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -3485,19 +3495,18 @@ const TeleportImpl = {
3485
3495
  target,
3486
3496
  props
3487
3497
  } = vnode;
3488
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3498
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3489
3499
  const pendingMount = pendingMounts.get(vnode);
3490
3500
  if (pendingMount) {
3491
3501
  pendingMount.flags |= 8;
3492
3502
  pendingMounts.delete(vnode);
3493
- shouldRemove = false;
3494
3503
  }
3495
3504
  if (target) {
3496
3505
  hostRemove(targetStart);
3497
3506
  hostRemove(targetAnchor);
3498
3507
  }
3499
3508
  doRemove && hostRemove(anchor);
3500
- if (shapeFlag & 16) {
3509
+ if (!pendingMount && shapeFlag & 16) {
3501
3510
  for (let i = 0; i < children.length; i++) {
3502
3511
  const child = children[i];
3503
3512
  unmount(
@@ -4465,20 +4474,16 @@ function createHydrationFunctions(rendererInternals) {
4465
4474
  slotScopeIds,
4466
4475
  optimized
4467
4476
  );
4468
- let hasWarned = false;
4469
- while (next) {
4470
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4471
- if (!hasWarned) {
4472
- warn$1(
4473
- `Hydration children mismatch on`,
4474
- el,
4475
- `
4477
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4478
+ warn$1(
4479
+ `Hydration children mismatch on`,
4480
+ el,
4481
+ `
4476
4482
  Server rendered element contains more child nodes than client vdom.`
4477
- );
4478
- hasWarned = true;
4479
- }
4480
- logMismatchError();
4481
- }
4483
+ );
4484
+ logMismatchError();
4485
+ }
4486
+ while (next) {
4482
4487
  const cur = next;
4483
4488
  next = next.nextSibling;
4484
4489
  remove(cur);
@@ -4541,7 +4546,7 @@ Server rendered element contains more child nodes than client vdom.`
4541
4546
  optimized = optimized || !!parentVNode.dynamicChildren;
4542
4547
  const children = parentVNode.children;
4543
4548
  const l = children.length;
4544
- let hasWarned = false;
4549
+ let hasCheckedMismatch = false;
4545
4550
  for (let i = 0; i < l; i++) {
4546
4551
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4547
4552
  const isText = vnode.type === Text;
@@ -4569,17 +4574,17 @@ Server rendered element contains more child nodes than client vdom.`
4569
4574
  } else if (isText && !vnode.children) {
4570
4575
  insert(vnode.el = createText(""), container);
4571
4576
  } else {
4572
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4573
- if (!hasWarned) {
4577
+ if (!hasCheckedMismatch) {
4578
+ hasCheckedMismatch = true;
4579
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4574
4580
  warn$1(
4575
4581
  `Hydration children mismatch on`,
4576
4582
  container,
4577
4583
  `
4578
4584
  Server rendered element contains fewer child nodes than client vdom.`
4579
4585
  );
4580
- hasWarned = true;
4586
+ logMismatchError();
4581
4587
  }
4582
- logMismatchError();
4583
4588
  }
4584
4589
  patch(
4585
4590
  null,
@@ -7515,7 +7520,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7515
7520
  const receivedType = toRawType(value);
7516
7521
  const expectedValue = styleValue(value, expectedType);
7517
7522
  const receivedValue = styleValue(value, receivedType);
7518
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7523
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) {
7519
7524
  message += ` with value ${expectedValue}`;
7520
7525
  }
7521
7526
  message += `, got ${receivedType} `;
@@ -7525,7 +7530,9 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
7525
7530
  return message;
7526
7531
  }
7527
7532
  function styleValue(value, type) {
7528
- if (type === "String") {
7533
+ if (isSymbol(value)) {
7534
+ return value.toString();
7535
+ } else if (type === "String") {
7529
7536
  return `"${value}"`;
7530
7537
  } else if (type === "Number") {
7531
7538
  return `${Number(value)}`;
@@ -7537,8 +7544,11 @@ function isExplicable(type) {
7537
7544
  const explicitTypes = ["string", "number", "boolean"];
7538
7545
  return explicitTypes.some((elem) => type.toLowerCase() === elem);
7539
7546
  }
7540
- function isBoolean(...args) {
7541
- return args.some((elem) => elem.toLowerCase() === "boolean");
7547
+ function isCoercible(...args) {
7548
+ return args.every((elem) => {
7549
+ const value = elem.toLowerCase();
7550
+ return value !== "boolean" && value !== "symbol";
7551
+ });
7542
7552
  }
7543
7553
 
7544
7554
  const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
@@ -8856,9 +8866,13 @@ function baseCreateRenderer(options, createHydrationFns) {
8856
8866
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
8857
8867
  if (needTransition2) {
8858
8868
  if (moveType === 0) {
8859
- transition.beforeEnter(el);
8860
- hostInsert(el, container, anchor);
8861
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8869
+ if (transition.persisted && !el[leaveCbKey]) {
8870
+ hostInsert(el, container, anchor);
8871
+ } else {
8872
+ transition.beforeEnter(el);
8873
+ hostInsert(el, container, anchor);
8874
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
8875
+ }
8862
8876
  } else {
8863
8877
  const { leave, delayLeave, afterLeave } = transition;
8864
8878
  const remove2 = () => {
@@ -8869,16 +8883,21 @@ function baseCreateRenderer(options, createHydrationFns) {
8869
8883
  }
8870
8884
  };
8871
8885
  const performLeave = () => {
8886
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
8872
8887
  if (el._isLeaving) {
8873
8888
  el[leaveCbKey](
8874
8889
  true
8875
8890
  /* cancelled */
8876
8891
  );
8877
8892
  }
8878
- leave(el, () => {
8893
+ if (transition.persisted && !wasLeaving) {
8879
8894
  remove2();
8880
- afterLeave && afterLeave();
8881
- });
8895
+ } else {
8896
+ leave(el, () => {
8897
+ remove2();
8898
+ afterLeave && afterLeave();
8899
+ });
8900
+ }
8882
8901
  };
8883
8902
  if (delayLeave) {
8884
8903
  delayLeave(el, remove2, performLeave);
@@ -9558,13 +9577,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9558
9577
  suspense.isHydrating = false;
9559
9578
  } else if (!resume) {
9560
9579
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
9580
+ let hasUpdatedAnchor = false;
9561
9581
  if (delayEnter) {
9562
9582
  activeBranch.transition.afterLeave = () => {
9563
9583
  if (pendingId === suspense.pendingId) {
9564
9584
  move(
9565
9585
  pendingBranch,
9566
9586
  container2,
9567
- anchor === initialAnchor ? next(activeBranch) : anchor,
9587
+ anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor,
9568
9588
  0
9569
9589
  );
9570
9590
  queuePostFlushCb(effects);
@@ -9577,6 +9597,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9577
9597
  if (activeBranch && !suspense.isFallbackMountPending) {
9578
9598
  if (parentNode(activeBranch.el) === container2) {
9579
9599
  anchor = next(activeBranch);
9600
+ hasUpdatedAnchor = true;
9580
9601
  }
9581
9602
  unmount(activeBranch, parentComponent2, suspense, true);
9582
9603
  if (!delayEnter && isInFallback && vnode2.ssFallback) {
@@ -10883,7 +10904,7 @@ function isMemoSame(cached, memo) {
10883
10904
  return true;
10884
10905
  }
10885
10906
 
10886
- const version = "3.5.33";
10907
+ const version = "3.5.35";
10887
10908
  const warn = warn$1 ;
10888
10909
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10889
10910
  const devtools = devtools$1 ;
@@ -11640,12 +11661,37 @@ function createInvoker(initialValue, instance) {
11640
11661
  } else if (e._vts <= invoker.attached) {
11641
11662
  return;
11642
11663
  }
11643
- callWithAsyncErrorHandling(
11644
- patchStopImmediatePropagation(e, invoker.value),
11645
- instance,
11646
- 5,
11647
- [e]
11648
- );
11664
+ const value = invoker.value;
11665
+ if (isArray(value)) {
11666
+ const originalStop = e.stopImmediatePropagation;
11667
+ e.stopImmediatePropagation = () => {
11668
+ originalStop.call(e);
11669
+ e._stopped = true;
11670
+ };
11671
+ const handlers = value.slice();
11672
+ const args = [e];
11673
+ for (let i = 0; i < handlers.length; i++) {
11674
+ if (e._stopped) {
11675
+ break;
11676
+ }
11677
+ const handler = handlers[i];
11678
+ if (handler) {
11679
+ callWithAsyncErrorHandling(
11680
+ handler,
11681
+ instance,
11682
+ 5,
11683
+ args
11684
+ );
11685
+ }
11686
+ }
11687
+ } else {
11688
+ callWithAsyncErrorHandling(
11689
+ value,
11690
+ instance,
11691
+ 5,
11692
+ [e]
11693
+ );
11694
+ }
11649
11695
  };
11650
11696
  invoker.value = initialValue;
11651
11697
  invoker.attached = getNow();
@@ -11661,20 +11707,6 @@ Expected function or array of functions, received type ${typeof value}.`
11661
11707
  );
11662
11708
  return NOOP;
11663
11709
  }
11664
- function patchStopImmediatePropagation(e, value) {
11665
- if (isArray(value)) {
11666
- const originalStop = e.stopImmediatePropagation;
11667
- e.stopImmediatePropagation = () => {
11668
- originalStop.call(e);
11669
- e._stopped = true;
11670
- };
11671
- return value.map(
11672
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
11673
- );
11674
- } else {
11675
- return value;
11676
- }
11677
- }
11678
11710
 
11679
11711
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11680
11712
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -16607,7 +16639,7 @@ const transformFor = createStructuralDirectiveTransform(
16607
16639
  const keyProp = findProp(node, `key`, false, true);
16608
16640
  keyProp && keyProp.type === 7;
16609
16641
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16610
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
16642
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
16611
16643
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
16612
16644
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
16613
16645
  forNode.codegenNode = createVNodeCall(