@vue/compat 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.33
2
+ * @vue/compat v3.5.35
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -354,12 +354,18 @@ class EffectScope {
354
354
  */
355
355
  this.cleanups = [];
356
356
  this._isPaused = false;
357
+ this._warnOnRun = true;
357
358
  this.__v_skip = true;
358
- this.parent = activeEffectScope;
359
359
  if (!detached && activeEffectScope) {
360
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
361
- this
362
- ) - 1;
360
+ if (activeEffectScope.active) {
361
+ this.parent = activeEffectScope;
362
+ this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
363
+ this
364
+ ) - 1;
365
+ } else {
366
+ this._active = false;
367
+ this._warnOnRun = false;
368
+ }
363
369
  }
364
370
  }
365
371
  get active() {
@@ -407,7 +413,7 @@ class EffectScope {
407
413
  } finally {
408
414
  activeEffectScope = currentEffectScope;
409
415
  }
410
- } else {
416
+ } else if (this._warnOnRun) {
411
417
  warn$2(`cannot run an inactive effect scope.`);
412
418
  }
413
419
  }
@@ -513,8 +519,12 @@ class ReactiveEffect {
513
519
  */
514
520
  this.cleanup = void 0;
515
521
  this.scheduler = void 0;
516
- if (activeEffectScope && activeEffectScope.active) {
517
- activeEffectScope.effects.push(this);
522
+ if (activeEffectScope) {
523
+ if (activeEffectScope.active) {
524
+ activeEffectScope.effects.push(this);
525
+ } else {
526
+ this.flags &= -2;
527
+ }
518
528
  }
519
529
  }
520
530
  pause() {
@@ -1662,9 +1672,6 @@ function targetTypeMap(rawType) {
1662
1672
  return 0 /* INVALID */;
1663
1673
  }
1664
1674
  }
1665
- function getTargetType(value) {
1666
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1667
- }
1668
1675
  // @__NO_SIDE_EFFECTS__
1669
1676
  function reactive(target) {
1670
1677
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1722,14 +1729,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1722
1729
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1723
1730
  return target;
1724
1731
  }
1725
- const targetType = getTargetType(target);
1726
- if (targetType === 0 /* INVALID */) {
1732
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1727
1733
  return target;
1728
1734
  }
1729
1735
  const existingProxy = proxyMap.get(target);
1730
1736
  if (existingProxy) {
1731
1737
  return existingProxy;
1732
1738
  }
1739
+ const targetType = targetTypeMap(toRawType(target));
1740
+ if (targetType === 0 /* INVALID */) {
1741
+ return target;
1742
+ }
1733
1743
  const proxy = new Proxy(
1734
1744
  target,
1735
1745
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -3881,19 +3891,18 @@ const TeleportImpl = {
3881
3891
  target,
3882
3892
  props
3883
3893
  } = vnode;
3884
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3894
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3885
3895
  const pendingMount = pendingMounts.get(vnode);
3886
3896
  if (pendingMount) {
3887
3897
  pendingMount.flags |= 8;
3888
3898
  pendingMounts.delete(vnode);
3889
- shouldRemove = false;
3890
3899
  }
3891
3900
  if (target) {
3892
3901
  hostRemove(targetStart);
3893
3902
  hostRemove(targetAnchor);
3894
3903
  }
3895
3904
  doRemove && hostRemove(anchor);
3896
- if (shapeFlag & 16) {
3905
+ if (!pendingMount && shapeFlag & 16) {
3897
3906
  for (let i = 0; i < children.length; i++) {
3898
3907
  const child = children[i];
3899
3908
  unmount(
@@ -4864,20 +4873,16 @@ function createHydrationFunctions(rendererInternals) {
4864
4873
  slotScopeIds,
4865
4874
  optimized
4866
4875
  );
4867
- let hasWarned = false;
4868
- while (next) {
4869
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4870
- if (!hasWarned) {
4871
- warn$1(
4872
- `Hydration children mismatch on`,
4873
- el,
4874
- `
4876
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4877
+ warn$1(
4878
+ `Hydration children mismatch on`,
4879
+ el,
4880
+ `
4875
4881
  Server rendered element contains more child nodes than client vdom.`
4876
- );
4877
- hasWarned = true;
4878
- }
4879
- logMismatchError();
4880
- }
4882
+ );
4883
+ logMismatchError();
4884
+ }
4885
+ while (next) {
4881
4886
  const cur = next;
4882
4887
  next = next.nextSibling;
4883
4888
  remove(cur);
@@ -4940,7 +4945,7 @@ Server rendered element contains more child nodes than client vdom.`
4940
4945
  optimized = optimized || !!parentVNode.dynamicChildren;
4941
4946
  const children = parentVNode.children;
4942
4947
  const l = children.length;
4943
- let hasWarned = false;
4948
+ let hasCheckedMismatch = false;
4944
4949
  for (let i = 0; i < l; i++) {
4945
4950
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4946
4951
  const isText = vnode.type === Text;
@@ -4968,17 +4973,17 @@ Server rendered element contains more child nodes than client vdom.`
4968
4973
  } else if (isText && !vnode.children) {
4969
4974
  insert(vnode.el = createText(""), container);
4970
4975
  } else {
4971
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4972
- if (!hasWarned) {
4976
+ if (!hasCheckedMismatch) {
4977
+ hasCheckedMismatch = true;
4978
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4973
4979
  warn$1(
4974
4980
  `Hydration children mismatch on`,
4975
4981
  container,
4976
4982
  `
4977
4983
  Server rendered element contains fewer child nodes than client vdom.`
4978
4984
  );
4979
- hasWarned = true;
4985
+ logMismatchError();
4980
4986
  }
4981
- logMismatchError();
4982
4987
  }
4983
4988
  patch(
4984
4989
  null,
@@ -7464,7 +7469,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7464
7469
  return vm;
7465
7470
  }
7466
7471
  }
7467
- Vue.version = `2.6.14-compat:${"3.5.33"}`;
7472
+ Vue.version = `2.6.14-compat:${"3.5.35"}`;
7468
7473
  Vue.config = singletonApp.config;
7469
7474
  Vue.use = (plugin, ...options) => {
7470
7475
  if (plugin && isFunction(plugin.install)) {
@@ -9099,7 +9104,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
9099
9104
  const receivedType = toRawType(value);
9100
9105
  const expectedValue = styleValue(value, expectedType);
9101
9106
  const receivedValue = styleValue(value, receivedType);
9102
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
9107
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) {
9103
9108
  message += ` with value ${expectedValue}`;
9104
9109
  }
9105
9110
  message += `, got ${receivedType} `;
@@ -9109,7 +9114,9 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
9109
9114
  return message;
9110
9115
  }
9111
9116
  function styleValue(value, type) {
9112
- if (type === "String") {
9117
+ if (isSymbol(value)) {
9118
+ return value.toString();
9119
+ } else if (type === "String") {
9113
9120
  return `"${value}"`;
9114
9121
  } else if (type === "Number") {
9115
9122
  return `${Number(value)}`;
@@ -9121,8 +9128,11 @@ function isExplicable(type) {
9121
9128
  const explicitTypes = ["string", "number", "boolean"];
9122
9129
  return explicitTypes.some((elem) => type.toLowerCase() === elem);
9123
9130
  }
9124
- function isBoolean(...args) {
9125
- return args.some((elem) => elem.toLowerCase() === "boolean");
9131
+ function isCoercible(...args) {
9132
+ return args.every((elem) => {
9133
+ const value = elem.toLowerCase();
9134
+ return value !== "boolean" && value !== "symbol";
9135
+ });
9126
9136
  }
9127
9137
 
9128
9138
  const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
@@ -10465,9 +10475,13 @@ function baseCreateRenderer(options, createHydrationFns) {
10465
10475
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10466
10476
  if (needTransition2) {
10467
10477
  if (moveType === 0) {
10468
- transition.beforeEnter(el);
10469
- hostInsert(el, container, anchor);
10470
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10478
+ if (transition.persisted && !el[leaveCbKey]) {
10479
+ hostInsert(el, container, anchor);
10480
+ } else {
10481
+ transition.beforeEnter(el);
10482
+ hostInsert(el, container, anchor);
10483
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10484
+ }
10471
10485
  } else {
10472
10486
  const { leave, delayLeave, afterLeave } = transition;
10473
10487
  const remove2 = () => {
@@ -10478,16 +10492,21 @@ function baseCreateRenderer(options, createHydrationFns) {
10478
10492
  }
10479
10493
  };
10480
10494
  const performLeave = () => {
10495
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
10481
10496
  if (el._isLeaving) {
10482
10497
  el[leaveCbKey](
10483
10498
  true
10484
10499
  /* cancelled */
10485
10500
  );
10486
10501
  }
10487
- leave(el, () => {
10502
+ if (transition.persisted && !wasLeaving) {
10488
10503
  remove2();
10489
- afterLeave && afterLeave();
10490
- });
10504
+ } else {
10505
+ leave(el, () => {
10506
+ remove2();
10507
+ afterLeave && afterLeave();
10508
+ });
10509
+ }
10491
10510
  };
10492
10511
  if (delayLeave) {
10493
10512
  delayLeave(el, remove2, performLeave);
@@ -11176,13 +11195,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11176
11195
  suspense.isHydrating = false;
11177
11196
  } else if (!resume) {
11178
11197
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
11198
+ let hasUpdatedAnchor = false;
11179
11199
  if (delayEnter) {
11180
11200
  activeBranch.transition.afterLeave = () => {
11181
11201
  if (pendingId === suspense.pendingId) {
11182
11202
  move(
11183
11203
  pendingBranch,
11184
11204
  container2,
11185
- anchor === initialAnchor ? next(activeBranch) : anchor,
11205
+ anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor,
11186
11206
  0
11187
11207
  );
11188
11208
  queuePostFlushCb(effects);
@@ -11195,6 +11215,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11195
11215
  if (activeBranch && !suspense.isFallbackMountPending) {
11196
11216
  if (parentNode(activeBranch.el) === container2) {
11197
11217
  anchor = next(activeBranch);
11218
+ hasUpdatedAnchor = true;
11198
11219
  }
11199
11220
  unmount(activeBranch, parentComponent2, suspense, true);
11200
11221
  if (!delayEnter && isInFallback && vnode2.ssFallback) {
@@ -12580,7 +12601,7 @@ function isMemoSame(cached, memo) {
12580
12601
  return true;
12581
12602
  }
12582
12603
 
12583
- const version = "3.5.33";
12604
+ const version = "3.5.35";
12584
12605
  const warn = warn$1 ;
12585
12606
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12586
12607
  const devtools = devtools$1 ;
@@ -13425,12 +13446,37 @@ function createInvoker(initialValue, instance) {
13425
13446
  } else if (e._vts <= invoker.attached) {
13426
13447
  return;
13427
13448
  }
13428
- callWithAsyncErrorHandling(
13429
- patchStopImmediatePropagation(e, invoker.value),
13430
- instance,
13431
- 5,
13432
- [e]
13433
- );
13449
+ const value = invoker.value;
13450
+ if (isArray(value)) {
13451
+ const originalStop = e.stopImmediatePropagation;
13452
+ e.stopImmediatePropagation = () => {
13453
+ originalStop.call(e);
13454
+ e._stopped = true;
13455
+ };
13456
+ const handlers = value.slice();
13457
+ const args = [e];
13458
+ for (let i = 0; i < handlers.length; i++) {
13459
+ if (e._stopped) {
13460
+ break;
13461
+ }
13462
+ const handler = handlers[i];
13463
+ if (handler) {
13464
+ callWithAsyncErrorHandling(
13465
+ handler,
13466
+ instance,
13467
+ 5,
13468
+ args
13469
+ );
13470
+ }
13471
+ }
13472
+ } else {
13473
+ callWithAsyncErrorHandling(
13474
+ value,
13475
+ instance,
13476
+ 5,
13477
+ [e]
13478
+ );
13479
+ }
13434
13480
  };
13435
13481
  invoker.value = initialValue;
13436
13482
  invoker.attached = getNow();
@@ -13446,20 +13492,6 @@ Expected function or array of functions, received type ${typeof value}.`
13446
13492
  );
13447
13493
  return NOOP;
13448
13494
  }
13449
- function patchStopImmediatePropagation(e, value) {
13450
- if (isArray(value)) {
13451
- const originalStop = e.stopImmediatePropagation;
13452
- e.stopImmediatePropagation = () => {
13453
- originalStop.call(e);
13454
- e._stopped = true;
13455
- };
13456
- return value.map(
13457
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
13458
- );
13459
- } else {
13460
- return value;
13461
- }
13462
- }
13463
13495
 
13464
13496
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
13465
13497
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;