@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
  **/
@@ -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 if (!!(process.env.NODE_ENV !== "production")) {
489
+ } else if (!!(process.env.NODE_ENV !== "production") && 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() {
@@ -1739,9 +1749,6 @@ function targetTypeMap(rawType) {
1739
1749
  return 0 /* INVALID */;
1740
1750
  }
1741
1751
  }
1742
- function getTargetType(value) {
1743
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1744
- }
1745
1752
  // @__NO_SIDE_EFFECTS__
1746
1753
  function reactive(target) {
1747
1754
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1799,14 +1806,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1799
1806
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1800
1807
  return target;
1801
1808
  }
1802
- const targetType = getTargetType(target);
1803
- if (targetType === 0 /* INVALID */) {
1809
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1804
1810
  return target;
1805
1811
  }
1806
1812
  const existingProxy = proxyMap.get(target);
1807
1813
  if (existingProxy) {
1808
1814
  return existingProxy;
1809
1815
  }
1816
+ const targetType = targetTypeMap(toRawType(target));
1817
+ if (targetType === 0 /* INVALID */) {
1818
+ return target;
1819
+ }
1810
1820
  const proxy = new Proxy(
1811
1821
  target,
1812
1822
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -3972,19 +3982,18 @@ const TeleportImpl = {
3972
3982
  target,
3973
3983
  props
3974
3984
  } = vnode;
3975
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3985
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3976
3986
  const pendingMount = pendingMounts.get(vnode);
3977
3987
  if (pendingMount) {
3978
3988
  pendingMount.flags |= 8;
3979
3989
  pendingMounts.delete(vnode);
3980
- shouldRemove = false;
3981
3990
  }
3982
3991
  if (target) {
3983
3992
  hostRemove(targetStart);
3984
3993
  hostRemove(targetAnchor);
3985
3994
  }
3986
3995
  doRemove && hostRemove(anchor);
3987
- if (shapeFlag & 16) {
3996
+ if (!pendingMount && shapeFlag & 16) {
3988
3997
  for (let i = 0; i < children.length; i++) {
3989
3998
  const child = children[i];
3990
3999
  unmount(
@@ -4956,20 +4965,16 @@ function createHydrationFunctions(rendererInternals) {
4956
4965
  slotScopeIds,
4957
4966
  optimized
4958
4967
  );
4959
- let hasWarned = false;
4960
- while (next) {
4961
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4962
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
4963
- warn$1(
4964
- `Hydration children mismatch on`,
4965
- el,
4966
- `
4968
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4969
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
4970
+ `Hydration children mismatch on`,
4971
+ el,
4972
+ `
4967
4973
  Server rendered element contains more child nodes than client vdom.`
4968
- );
4969
- hasWarned = true;
4970
- }
4971
- logMismatchError();
4972
- }
4974
+ );
4975
+ logMismatchError();
4976
+ }
4977
+ while (next) {
4973
4978
  const cur = next;
4974
4979
  next = next.nextSibling;
4975
4980
  remove(cur);
@@ -5043,7 +5048,7 @@ Server rendered element contains more child nodes than client vdom.`
5043
5048
  optimized = optimized || !!parentVNode.dynamicChildren;
5044
5049
  const children = parentVNode.children;
5045
5050
  const l = children.length;
5046
- let hasWarned = false;
5051
+ let hasCheckedMismatch = false;
5047
5052
  for (let i = 0; i < l; i++) {
5048
5053
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
5049
5054
  const isText = vnode.type === Text;
@@ -5071,17 +5076,17 @@ Server rendered element contains more child nodes than client vdom.`
5071
5076
  } else if (isText && !vnode.children) {
5072
5077
  insert(vnode.el = createText(""), container);
5073
5078
  } else {
5074
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5075
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
5076
- warn$1(
5079
+ if (!hasCheckedMismatch) {
5080
+ hasCheckedMismatch = true;
5081
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5082
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
5077
5083
  `Hydration children mismatch on`,
5078
5084
  container,
5079
5085
  `
5080
5086
  Server rendered element contains fewer child nodes than client vdom.`
5081
5087
  );
5082
- hasWarned = true;
5088
+ logMismatchError();
5083
5089
  }
5084
- logMismatchError();
5085
5090
  }
5086
5091
  patch(
5087
5092
  null,
@@ -7569,7 +7574,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7569
7574
  return vm;
7570
7575
  }
7571
7576
  }
7572
- Vue.version = `2.6.14-compat:${"3.5.33"}`;
7577
+ Vue.version = `2.6.14-compat:${"3.5.35"}`;
7573
7578
  Vue.config = singletonApp.config;
7574
7579
  Vue.use = (plugin, ...options) => {
7575
7580
  if (plugin && isFunction(plugin.install)) {
@@ -9206,7 +9211,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
9206
9211
  const receivedType = toRawType(value);
9207
9212
  const expectedValue = styleValue(value, expectedType);
9208
9213
  const receivedValue = styleValue(value, receivedType);
9209
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
9214
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) {
9210
9215
  message += ` with value ${expectedValue}`;
9211
9216
  }
9212
9217
  message += `, got ${receivedType} `;
@@ -9216,7 +9221,9 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
9216
9221
  return message;
9217
9222
  }
9218
9223
  function styleValue(value, type) {
9219
- if (type === "String") {
9224
+ if (isSymbol(value)) {
9225
+ return value.toString();
9226
+ } else if (type === "String") {
9220
9227
  return `"${value}"`;
9221
9228
  } else if (type === "Number") {
9222
9229
  return `${Number(value)}`;
@@ -9228,8 +9235,11 @@ function isExplicable(type) {
9228
9235
  const explicitTypes = ["string", "number", "boolean"];
9229
9236
  return explicitTypes.some((elem) => type.toLowerCase() === elem);
9230
9237
  }
9231
- function isBoolean(...args) {
9232
- return args.some((elem) => elem.toLowerCase() === "boolean");
9238
+ function isCoercible(...args) {
9239
+ return args.every((elem) => {
9240
+ const value = elem.toLowerCase();
9241
+ return value !== "boolean" && value !== "symbol";
9242
+ });
9233
9243
  }
9234
9244
 
9235
9245
  const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
@@ -10610,9 +10620,13 @@ function baseCreateRenderer(options, createHydrationFns) {
10610
10620
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10611
10621
  if (needTransition2) {
10612
10622
  if (moveType === 0) {
10613
- transition.beforeEnter(el);
10614
- hostInsert(el, container, anchor);
10615
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10623
+ if (transition.persisted && !el[leaveCbKey]) {
10624
+ hostInsert(el, container, anchor);
10625
+ } else {
10626
+ transition.beforeEnter(el);
10627
+ hostInsert(el, container, anchor);
10628
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10629
+ }
10616
10630
  } else {
10617
10631
  const { leave, delayLeave, afterLeave } = transition;
10618
10632
  const remove2 = () => {
@@ -10623,16 +10637,21 @@ function baseCreateRenderer(options, createHydrationFns) {
10623
10637
  }
10624
10638
  };
10625
10639
  const performLeave = () => {
10640
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
10626
10641
  if (el._isLeaving) {
10627
10642
  el[leaveCbKey](
10628
10643
  true
10629
10644
  /* cancelled */
10630
10645
  );
10631
10646
  }
10632
- leave(el, () => {
10647
+ if (transition.persisted && !wasLeaving) {
10633
10648
  remove2();
10634
- afterLeave && afterLeave();
10635
- });
10649
+ } else {
10650
+ leave(el, () => {
10651
+ remove2();
10652
+ afterLeave && afterLeave();
10653
+ });
10654
+ }
10636
10655
  };
10637
10656
  if (delayLeave) {
10638
10657
  delayLeave(el, remove2, performLeave);
@@ -11321,13 +11340,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11321
11340
  suspense.isHydrating = false;
11322
11341
  } else if (!resume) {
11323
11342
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
11343
+ let hasUpdatedAnchor = false;
11324
11344
  if (delayEnter) {
11325
11345
  activeBranch.transition.afterLeave = () => {
11326
11346
  if (pendingId === suspense.pendingId) {
11327
11347
  move(
11328
11348
  pendingBranch,
11329
11349
  container2,
11330
- anchor === initialAnchor ? next(activeBranch) : anchor,
11350
+ anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor,
11331
11351
  0
11332
11352
  );
11333
11353
  queuePostFlushCb(effects);
@@ -11340,6 +11360,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11340
11360
  if (activeBranch && !suspense.isFallbackMountPending) {
11341
11361
  if (parentNode(activeBranch.el) === container2) {
11342
11362
  anchor = next(activeBranch);
11363
+ hasUpdatedAnchor = true;
11343
11364
  }
11344
11365
  unmount(activeBranch, parentComponent2, suspense, true);
11345
11366
  if (!delayEnter && isInFallback && vnode2.ssFallback) {
@@ -12739,7 +12760,7 @@ function isMemoSame(cached, memo) {
12739
12760
  return true;
12740
12761
  }
12741
12762
 
12742
- const version = "3.5.33";
12763
+ const version = "3.5.35";
12743
12764
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12744
12765
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12745
12766
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13584,12 +13605,37 @@ function createInvoker(initialValue, instance) {
13584
13605
  } else if (e._vts <= invoker.attached) {
13585
13606
  return;
13586
13607
  }
13587
- callWithAsyncErrorHandling(
13588
- patchStopImmediatePropagation(e, invoker.value),
13589
- instance,
13590
- 5,
13591
- [e]
13592
- );
13608
+ const value = invoker.value;
13609
+ if (isArray(value)) {
13610
+ const originalStop = e.stopImmediatePropagation;
13611
+ e.stopImmediatePropagation = () => {
13612
+ originalStop.call(e);
13613
+ e._stopped = true;
13614
+ };
13615
+ const handlers = value.slice();
13616
+ const args = [e];
13617
+ for (let i = 0; i < handlers.length; i++) {
13618
+ if (e._stopped) {
13619
+ break;
13620
+ }
13621
+ const handler = handlers[i];
13622
+ if (handler) {
13623
+ callWithAsyncErrorHandling(
13624
+ handler,
13625
+ instance,
13626
+ 5,
13627
+ args
13628
+ );
13629
+ }
13630
+ }
13631
+ } else {
13632
+ callWithAsyncErrorHandling(
13633
+ value,
13634
+ instance,
13635
+ 5,
13636
+ [e]
13637
+ );
13638
+ }
13593
13639
  };
13594
13640
  invoker.value = initialValue;
13595
13641
  invoker.attached = getNow();
@@ -13605,20 +13651,6 @@ Expected function or array of functions, received type ${typeof value}.`
13605
13651
  );
13606
13652
  return NOOP;
13607
13653
  }
13608
- function patchStopImmediatePropagation(e, value) {
13609
- if (isArray(value)) {
13610
- const originalStop = e.stopImmediatePropagation;
13611
- e.stopImmediatePropagation = () => {
13612
- originalStop.call(e);
13613
- e._stopped = true;
13614
- };
13615
- return value.map(
13616
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
13617
- );
13618
- } else {
13619
- return value;
13620
- }
13621
- }
13622
13654
 
13623
13655
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
13624
13656
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -18789,7 +18821,7 @@ const transformFor = createStructuralDirectiveTransform(
18789
18821
  const keyProp = findProp(node, `key`, false, true);
18790
18822
  keyProp && keyProp.type === 7;
18791
18823
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18792
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18824
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
18793
18825
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
18794
18826
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
18795
18827
  forNode.codegenNode = createVNodeCall(