@vue/compat 3.5.27 → 3.5.29

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.27
2
+ * @vue/compat v3.5.29
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -410,6 +410,7 @@ var Vue = (function () {
410
410
 
411
411
  let activeEffectScope;
412
412
  class EffectScope {
413
+ // TODO isolatedDeclarations "__v_skip"
413
414
  constructor(detached = false) {
414
415
  this.detached = detached;
415
416
  /**
@@ -429,6 +430,7 @@ var Vue = (function () {
429
430
  */
430
431
  this.cleanups = [];
431
432
  this._isPaused = false;
433
+ this.__v_skip = true;
432
434
  this.parent = activeEffectScope;
433
435
  if (!detached && activeEffectScope) {
434
436
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -3954,7 +3956,22 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3954
3956
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3955
3957
  o: { nextSibling, parentNode, querySelector, insert, createText }
3956
3958
  }, hydrateChildren) {
3957
- function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
3959
+ function hydrateAnchor(target2, targetNode) {
3960
+ let targetAnchor = targetNode;
3961
+ while (targetAnchor) {
3962
+ if (targetAnchor && targetAnchor.nodeType === 8) {
3963
+ if (targetAnchor.data === "teleport start anchor") {
3964
+ vnode.targetStart = targetAnchor;
3965
+ } else if (targetAnchor.data === "teleport anchor") {
3966
+ vnode.targetAnchor = targetAnchor;
3967
+ target2._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3968
+ break;
3969
+ }
3970
+ }
3971
+ targetAnchor = nextSibling(targetAnchor);
3972
+ }
3973
+ }
3974
+ function hydrateDisabledTeleport(node2, vnode2) {
3958
3975
  vnode2.anchor = hydrateChildren(
3959
3976
  nextSibling(node2),
3960
3977
  vnode2,
@@ -3964,8 +3981,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3964
3981
  slotScopeIds,
3965
3982
  optimized
3966
3983
  );
3967
- vnode2.targetStart = targetStart;
3968
- vnode2.targetAnchor = targetAnchor;
3969
3984
  }
3970
3985
  const target = vnode.target = resolveTarget(
3971
3986
  vnode.props,
@@ -3976,27 +3991,22 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3976
3991
  const targetNode = target._lpa || target.firstChild;
3977
3992
  if (vnode.shapeFlag & 16) {
3978
3993
  if (disabled) {
3979
- hydrateDisabledTeleport(
3980
- node,
3981
- vnode,
3982
- targetNode,
3983
- targetNode && nextSibling(targetNode)
3984
- );
3994
+ hydrateDisabledTeleport(node, vnode);
3995
+ hydrateAnchor(target, targetNode);
3996
+ if (!vnode.targetAnchor) {
3997
+ prepareAnchor(
3998
+ target,
3999
+ vnode,
4000
+ createText,
4001
+ insert,
4002
+ // if target is the same as the main view, insert anchors before current node
4003
+ // to avoid hydrating mismatch
4004
+ parentNode(node) === target ? node : null
4005
+ );
4006
+ }
3985
4007
  } else {
3986
4008
  vnode.anchor = nextSibling(node);
3987
- let targetAnchor = targetNode;
3988
- while (targetAnchor) {
3989
- if (targetAnchor && targetAnchor.nodeType === 8) {
3990
- if (targetAnchor.data === "teleport start anchor") {
3991
- vnode.targetStart = targetAnchor;
3992
- } else if (targetAnchor.data === "teleport anchor") {
3993
- vnode.targetAnchor = targetAnchor;
3994
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3995
- break;
3996
- }
3997
- }
3998
- targetAnchor = nextSibling(targetAnchor);
3999
- }
4009
+ hydrateAnchor(target, targetNode);
4000
4010
  if (!vnode.targetAnchor) {
4001
4011
  prepareAnchor(target, vnode, createText, insert);
4002
4012
  }
@@ -4014,7 +4024,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4014
4024
  updateCssVars(vnode, disabled);
4015
4025
  } else if (disabled) {
4016
4026
  if (vnode.shapeFlag & 16) {
4017
- hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
4027
+ hydrateDisabledTeleport(node, vnode);
4028
+ vnode.targetStart = node;
4029
+ vnode.targetAnchor = nextSibling(node);
4018
4030
  }
4019
4031
  }
4020
4032
  return vnode.anchor && nextSibling(vnode.anchor);
@@ -4038,13 +4050,13 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4038
4050
  ctx.ut();
4039
4051
  }
4040
4052
  }
4041
- function prepareAnchor(target, vnode, createText, insert) {
4053
+ function prepareAnchor(target, vnode, createText, insert, anchor = null) {
4042
4054
  const targetStart = vnode.targetStart = createText("");
4043
4055
  const targetAnchor = vnode.targetAnchor = createText("");
4044
4056
  targetStart[TeleportEndKey] = targetAnchor;
4045
4057
  if (target) {
4046
- insert(targetStart, target);
4047
- insert(targetAnchor, target);
4058
+ insert(targetStart, target, anchor);
4059
+ insert(targetAnchor, target, anchor);
4048
4060
  }
4049
4061
  return targetAnchor;
4050
4062
  }
@@ -4269,6 +4281,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4269
4281
  callHook(hook, [el]);
4270
4282
  },
4271
4283
  enter(el) {
4284
+ if (leavingVNodesCache[key] === vnode) return;
4272
4285
  let hook = onEnter;
4273
4286
  let afterHook = onAfterEnter;
4274
4287
  let cancelHook = onEnterCancelled;
@@ -4282,7 +4295,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4282
4295
  }
4283
4296
  }
4284
4297
  let called = false;
4285
- const done = el[enterCbKey$1] = (cancelled) => {
4298
+ el[enterCbKey$1] = (cancelled) => {
4286
4299
  if (called) return;
4287
4300
  called = true;
4288
4301
  if (cancelled) {
@@ -4295,6 +4308,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4295
4308
  }
4296
4309
  el[enterCbKey$1] = void 0;
4297
4310
  };
4311
+ const done = el[enterCbKey$1].bind(null, false);
4298
4312
  if (hook) {
4299
4313
  callAsyncHook(hook, [el, done]);
4300
4314
  } else {
@@ -4314,7 +4328,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4314
4328
  }
4315
4329
  callHook(onBeforeLeave, [el]);
4316
4330
  let called = false;
4317
- const done = el[leaveCbKey] = (cancelled) => {
4331
+ el[leaveCbKey] = (cancelled) => {
4318
4332
  if (called) return;
4319
4333
  called = true;
4320
4334
  remove();
@@ -4328,6 +4342,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4328
4342
  delete leavingVNodesCache[key2];
4329
4343
  }
4330
4344
  };
4345
+ const done = el[leaveCbKey].bind(null, false);
4331
4346
  leavingVNodesCache[key2] = vnode;
4332
4347
  if (onLeave) {
4333
4348
  callAsyncHook(onLeave, [el, done]);
@@ -4440,8 +4455,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4440
4455
  const r = shallowRef(null);
4441
4456
  if (i) {
4442
4457
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4443
- let desc;
4444
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4458
+ if (isTemplateRefKey(refs, key)) {
4445
4459
  warn$1(`useTemplateRef('${key}') already exists.`);
4446
4460
  } else {
4447
4461
  Object.defineProperty(refs, key, {
@@ -4461,6 +4475,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4461
4475
  }
4462
4476
  return ret;
4463
4477
  }
4478
+ function isTemplateRefKey(refs, key) {
4479
+ let desc;
4480
+ return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
4481
+ }
4464
4482
 
4465
4483
  const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4466
4484
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
@@ -4506,10 +4524,19 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4506
4524
  return false;
4507
4525
  }
4508
4526
  }
4527
+ if (isTemplateRefKey(refs, key)) {
4528
+ return false;
4529
+ }
4509
4530
  return hasOwn(rawSetupState, key);
4510
4531
  };
4511
- const canSetRef = (ref2) => {
4512
- return !knownTemplateRefs.has(ref2);
4532
+ const canSetRef = (ref2, key) => {
4533
+ if (knownTemplateRefs.has(ref2)) {
4534
+ return false;
4535
+ }
4536
+ if (key && isTemplateRefKey(refs, key)) {
4537
+ return false;
4538
+ }
4539
+ return true;
4513
4540
  };
4514
4541
  if (oldRef != null && oldRef !== ref) {
4515
4542
  invalidatePendingSetRef(oldRawRef);
@@ -4519,10 +4546,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4519
4546
  setupState[oldRef] = null;
4520
4547
  }
4521
4548
  } else if (isRef(oldRef)) {
4522
- if (canSetRef(oldRef)) {
4549
+ const oldRawRefAtom = oldRawRef;
4550
+ if (canSetRef(oldRef, oldRawRefAtom.k)) {
4523
4551
  oldRef.value = null;
4524
4552
  }
4525
- const oldRawRefAtom = oldRawRef;
4526
4553
  if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4527
4554
  }
4528
4555
  }
@@ -4546,7 +4573,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4546
4573
  }
4547
4574
  } else {
4548
4575
  const newVal = [refValue];
4549
- if (canSetRef(ref)) {
4576
+ if (canSetRef(ref, rawRef.k)) {
4550
4577
  ref.value = newVal;
4551
4578
  }
4552
4579
  if (rawRef.k) refs[rawRef.k] = newVal;
@@ -4561,7 +4588,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4561
4588
  setupState[ref] = value;
4562
4589
  }
4563
4590
  } else if (_isRef) {
4564
- if (canSetRef(ref)) {
4591
+ if (canSetRef(ref, rawRef.k)) {
4565
4592
  ref.value = value;
4566
4593
  }
4567
4594
  if (rawRef.k) refs[rawRef.k] = value;
@@ -6891,13 +6918,24 @@ If this is a native custom element, make sure to exclude it from component resol
6891
6918
  }
6892
6919
  let awaitable = getAwaitable();
6893
6920
  unsetCurrentInstance();
6921
+ const cleanup = () => {
6922
+ if (getCurrentInstance() !== ctx) ctx.scope.off();
6923
+ unsetCurrentInstance();
6924
+ };
6894
6925
  if (isPromise(awaitable)) {
6895
6926
  awaitable = awaitable.catch((e) => {
6896
6927
  setCurrentInstance(ctx);
6928
+ Promise.resolve().then(() => Promise.resolve().then(cleanup));
6897
6929
  throw e;
6898
6930
  });
6899
6931
  }
6900
- return [awaitable, () => setCurrentInstance(ctx)];
6932
+ return [
6933
+ awaitable,
6934
+ () => {
6935
+ setCurrentInstance(ctx);
6936
+ Promise.resolve().then(cleanup);
6937
+ }
6938
+ ];
6901
6939
  }
6902
6940
 
6903
6941
  function createDuplicateChecker() {
@@ -7415,7 +7453,7 @@ If this is a native custom element, make sure to exclude it from component resol
7415
7453
  return vm;
7416
7454
  }
7417
7455
  }
7418
- Vue.version = `2.6.14-compat:${"3.5.27"}`;
7456
+ Vue.version = `2.6.14-compat:${"3.5.29"}`;
7419
7457
  Vue.config = singletonApp.config;
7420
7458
  Vue.use = (plugin, ...options) => {
7421
7459
  if (plugin && isFunction(plugin.install)) {
@@ -8529,7 +8567,7 @@ If you want to remount the same app, move your app creation logic into a factory
8529
8567
  const dynamicProps = nextVNode.dynamicProps;
8530
8568
  for (let i = 0; i < dynamicProps.length; i++) {
8531
8569
  const key = dynamicProps[i];
8532
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
8570
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) {
8533
8571
  return true;
8534
8572
  }
8535
8573
  }
@@ -8560,12 +8598,20 @@ If you want to remount the same app, move your app creation logic into a factory
8560
8598
  }
8561
8599
  for (let i = 0; i < nextKeys.length; i++) {
8562
8600
  const key = nextKeys[i];
8563
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
8601
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
8564
8602
  return true;
8565
8603
  }
8566
8604
  }
8567
8605
  return false;
8568
8606
  }
8607
+ function hasPropValueChanged(nextProps, prevProps, key) {
8608
+ const nextProp = nextProps[key];
8609
+ const prevProp = prevProps[key];
8610
+ if (key === "style" && isObject(nextProp) && isObject(prevProp)) {
8611
+ return !looseEqual(nextProp, prevProp);
8612
+ }
8613
+ return nextProp !== prevProp;
8614
+ }
8569
8615
  function updateHOCHostEl({ vnode, parent }, el) {
8570
8616
  while (parent) {
8571
8617
  const root = parent.subTree;
@@ -9341,15 +9387,7 @@ If you want to remount the same app, move your app creation logic into a factory
9341
9387
  } else {
9342
9388
  const el = n2.el = n1.el;
9343
9389
  if (n2.children !== n1.children) {
9344
- if (isHmrUpdating && n2.patchFlag === -1 && "__elIndex" in n1) {
9345
- const childNodes = container.childNodes;
9346
- const newChild = hostCreateText(n2.children);
9347
- const oldChild = childNodes[n2.__elIndex = n1.__elIndex];
9348
- hostInsert(newChild, container, oldChild);
9349
- hostRemove(oldChild);
9350
- } else {
9351
- hostSetText(el, n2.children);
9352
- }
9390
+ hostSetText(el, n2.children);
9353
9391
  }
9354
9392
  }
9355
9393
  };
@@ -9425,7 +9463,7 @@ If you want to remount the same app, move your app creation logic into a factory
9425
9463
  optimized
9426
9464
  );
9427
9465
  } else {
9428
- const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
9466
+ const customElement = n1.el && n1.el._isVueCE ? n1.el : null;
9429
9467
  try {
9430
9468
  if (customElement) {
9431
9469
  customElement._beginPatch();
@@ -9911,8 +9949,7 @@ If you want to remount the same app, move your app creation logic into a factory
9911
9949
  hydrateSubTree();
9912
9950
  }
9913
9951
  } else {
9914
- if (root.ce && // @ts-expect-error _def is private
9915
- root.ce._def.shadowRoot !== false) {
9952
+ if (root.ce && root.ce._hasShadowRoot()) {
9916
9953
  root.ce._injectChildStyle(type);
9917
9954
  }
9918
9955
  {
@@ -9979,9 +10016,9 @@ If you want to remount the same app, move your app creation logic into a factory
9979
10016
  updateComponentPreRender(instance, next, optimized);
9980
10017
  }
9981
10018
  nonHydratedAsyncRoot.asyncDep.then(() => {
9982
- if (!instance.isUnmounted) {
9983
- componentUpdateFn();
9984
- }
10019
+ queuePostRenderEffect(() => {
10020
+ if (!instance.isUnmounted) update();
10021
+ }, parentSuspense);
9985
10022
  });
9986
10023
  return;
9987
10024
  }
@@ -10696,12 +10733,10 @@ If you want to remount the same app, move your app creation logic into a factory
10696
10733
  traverseStaticChildren(c1, c2);
10697
10734
  }
10698
10735
  if (c2.type === Text) {
10699
- if (c2.patchFlag !== -1) {
10700
- c2.el = c1.el;
10701
- } else {
10702
- c2.__elIndex = i + // take fragment start anchor into account
10703
- (n1.type === Fragment ? 1 : 0);
10736
+ if (c2.patchFlag === -1) {
10737
+ c2 = ch2[i] = cloneIfMounted(c2);
10704
10738
  }
10739
+ c2.el = c1.el;
10705
10740
  }
10706
10741
  if (c2.type === Comment && !c2.el) {
10707
10742
  c2.el = c1.el;
@@ -12492,7 +12527,7 @@ Component that was made reactive: `,
12492
12527
  return true;
12493
12528
  }
12494
12529
 
12495
- const version = "3.5.27";
12530
+ const version = "3.5.29";
12496
12531
  const warn = warn$1 ;
12497
12532
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12498
12533
  const devtools = devtools$1 ;
@@ -13835,6 +13870,12 @@ Expected function or array of functions, received type ${typeof value}.`
13835
13870
  this._update();
13836
13871
  }
13837
13872
  }
13873
+ /**
13874
+ * @internal
13875
+ */
13876
+ _hasShadowRoot() {
13877
+ return this._def.shadowRoot !== false;
13878
+ }
13838
13879
  /**
13839
13880
  * @internal
13840
13881
  */
@@ -13966,10 +14007,7 @@ Expected function or array of functions, received type ${typeof value}.`
13966
14007
  instance
13967
14008
  )
13968
14009
  );
13969
- positionMap.set(child, {
13970
- left: child.el.offsetLeft,
13971
- top: child.el.offsetTop
13972
- });
14010
+ positionMap.set(child, getPosition(child.el));
13973
14011
  }
13974
14012
  }
13975
14013
  }
@@ -14000,10 +14038,7 @@ Expected function or array of functions, received type ${typeof value}.`
14000
14038
  }
14001
14039
  }
14002
14040
  function recordPosition(c) {
14003
- newPositionMap.set(c, {
14004
- left: c.el.offsetLeft,
14005
- top: c.el.offsetTop
14006
- });
14041
+ newPositionMap.set(c, getPosition(c.el));
14007
14042
  }
14008
14043
  function applyTranslation(c) {
14009
14044
  const oldPos = positionMap.get(c);
@@ -14011,12 +14046,29 @@ Expected function or array of functions, received type ${typeof value}.`
14011
14046
  const dx = oldPos.left - newPos.left;
14012
14047
  const dy = oldPos.top - newPos.top;
14013
14048
  if (dx || dy) {
14014
- const s = c.el.style;
14015
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
14049
+ const el = c.el;
14050
+ const s = el.style;
14051
+ const rect = el.getBoundingClientRect();
14052
+ let scaleX = 1;
14053
+ let scaleY = 1;
14054
+ if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
14055
+ if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
14056
+ if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
14057
+ if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
14058
+ if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
14059
+ if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
14060
+ s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
14016
14061
  s.transitionDuration = "0s";
14017
14062
  return c;
14018
14063
  }
14019
14064
  }
14065
+ function getPosition(el) {
14066
+ const rect = el.getBoundingClientRect();
14067
+ return {
14068
+ left: rect.left,
14069
+ top: rect.top
14070
+ };
14071
+ }
14020
14072
  function hasCSSTransform(el, root, moveClass) {
14021
14073
  const clone = el.cloneNode();
14022
14074
  const _vtc = el[vtcKey];
@@ -14293,6 +14345,7 @@ Expected function or array of functions, received type ${typeof value}.`
14293
14345
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
14294
14346
  };
14295
14347
  const withModifiers = (fn, modifiers) => {
14348
+ if (!fn) return fn;
14296
14349
  const cache = fn._withMods || (fn._withMods = {});
14297
14350
  const cacheKey = modifiers.join(".");
14298
14351
  return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {