@vue/compat 3.5.27 → 3.5.28

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.28
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
  }
@@ -4282,7 +4294,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4282
4294
  }
4283
4295
  }
4284
4296
  let called = false;
4285
- const done = el[enterCbKey$1] = (cancelled) => {
4297
+ el[enterCbKey$1] = (cancelled) => {
4286
4298
  if (called) return;
4287
4299
  called = true;
4288
4300
  if (cancelled) {
@@ -4295,6 +4307,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4295
4307
  }
4296
4308
  el[enterCbKey$1] = void 0;
4297
4309
  };
4310
+ const done = el[enterCbKey$1].bind(null, false);
4298
4311
  if (hook) {
4299
4312
  callAsyncHook(hook, [el, done]);
4300
4313
  } else {
@@ -4314,7 +4327,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4314
4327
  }
4315
4328
  callHook(onBeforeLeave, [el]);
4316
4329
  let called = false;
4317
- const done = el[leaveCbKey] = (cancelled) => {
4330
+ el[leaveCbKey] = (cancelled) => {
4318
4331
  if (called) return;
4319
4332
  called = true;
4320
4333
  remove();
@@ -4328,6 +4341,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4328
4341
  delete leavingVNodesCache[key2];
4329
4342
  }
4330
4343
  };
4344
+ const done = el[leaveCbKey].bind(null, false);
4331
4345
  leavingVNodesCache[key2] = vnode;
4332
4346
  if (onLeave) {
4333
4347
  callAsyncHook(onLeave, [el, done]);
@@ -4440,8 +4454,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4440
4454
  const r = shallowRef(null);
4441
4455
  if (i) {
4442
4456
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4443
- let desc;
4444
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4457
+ if (isTemplateRefKey(refs, key)) {
4445
4458
  warn$1(`useTemplateRef('${key}') already exists.`);
4446
4459
  } else {
4447
4460
  Object.defineProperty(refs, key, {
@@ -4461,6 +4474,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4461
4474
  }
4462
4475
  return ret;
4463
4476
  }
4477
+ function isTemplateRefKey(refs, key) {
4478
+ let desc;
4479
+ return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
4480
+ }
4464
4481
 
4465
4482
  const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4466
4483
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
@@ -4506,10 +4523,19 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4506
4523
  return false;
4507
4524
  }
4508
4525
  }
4526
+ if (isTemplateRefKey(refs, key)) {
4527
+ return false;
4528
+ }
4509
4529
  return hasOwn(rawSetupState, key);
4510
4530
  };
4511
- const canSetRef = (ref2) => {
4512
- return !knownTemplateRefs.has(ref2);
4531
+ const canSetRef = (ref2, key) => {
4532
+ if (knownTemplateRefs.has(ref2)) {
4533
+ return false;
4534
+ }
4535
+ if (key && isTemplateRefKey(refs, key)) {
4536
+ return false;
4537
+ }
4538
+ return true;
4513
4539
  };
4514
4540
  if (oldRef != null && oldRef !== ref) {
4515
4541
  invalidatePendingSetRef(oldRawRef);
@@ -4519,10 +4545,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4519
4545
  setupState[oldRef] = null;
4520
4546
  }
4521
4547
  } else if (isRef(oldRef)) {
4522
- if (canSetRef(oldRef)) {
4548
+ const oldRawRefAtom = oldRawRef;
4549
+ if (canSetRef(oldRef, oldRawRefAtom.k)) {
4523
4550
  oldRef.value = null;
4524
4551
  }
4525
- const oldRawRefAtom = oldRawRef;
4526
4552
  if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4527
4553
  }
4528
4554
  }
@@ -4546,7 +4572,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4546
4572
  }
4547
4573
  } else {
4548
4574
  const newVal = [refValue];
4549
- if (canSetRef(ref)) {
4575
+ if (canSetRef(ref, rawRef.k)) {
4550
4576
  ref.value = newVal;
4551
4577
  }
4552
4578
  if (rawRef.k) refs[rawRef.k] = newVal;
@@ -4561,7 +4587,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4561
4587
  setupState[ref] = value;
4562
4588
  }
4563
4589
  } else if (_isRef) {
4564
- if (canSetRef(ref)) {
4590
+ if (canSetRef(ref, rawRef.k)) {
4565
4591
  ref.value = value;
4566
4592
  }
4567
4593
  if (rawRef.k) refs[rawRef.k] = value;
@@ -7415,7 +7441,7 @@ If this is a native custom element, make sure to exclude it from component resol
7415
7441
  return vm;
7416
7442
  }
7417
7443
  }
7418
- Vue.version = `2.6.14-compat:${"3.5.27"}`;
7444
+ Vue.version = `2.6.14-compat:${"3.5.28"}`;
7419
7445
  Vue.config = singletonApp.config;
7420
7446
  Vue.use = (plugin, ...options) => {
7421
7447
  if (plugin && isFunction(plugin.install)) {
@@ -8529,7 +8555,7 @@ If you want to remount the same app, move your app creation logic into a factory
8529
8555
  const dynamicProps = nextVNode.dynamicProps;
8530
8556
  for (let i = 0; i < dynamicProps.length; i++) {
8531
8557
  const key = dynamicProps[i];
8532
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
8558
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) {
8533
8559
  return true;
8534
8560
  }
8535
8561
  }
@@ -8560,12 +8586,20 @@ If you want to remount the same app, move your app creation logic into a factory
8560
8586
  }
8561
8587
  for (let i = 0; i < nextKeys.length; i++) {
8562
8588
  const key = nextKeys[i];
8563
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
8589
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
8564
8590
  return true;
8565
8591
  }
8566
8592
  }
8567
8593
  return false;
8568
8594
  }
8595
+ function hasPropValueChanged(nextProps, prevProps, key) {
8596
+ const nextProp = nextProps[key];
8597
+ const prevProp = prevProps[key];
8598
+ if (key === "style" && isObject(nextProp) && isObject(prevProp)) {
8599
+ return !looseEqual(nextProp, prevProp);
8600
+ }
8601
+ return nextProp !== prevProp;
8602
+ }
8569
8603
  function updateHOCHostEl({ vnode, parent }, el) {
8570
8604
  while (parent) {
8571
8605
  const root = parent.subTree;
@@ -9341,15 +9375,7 @@ If you want to remount the same app, move your app creation logic into a factory
9341
9375
  } else {
9342
9376
  const el = n2.el = n1.el;
9343
9377
  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
- }
9378
+ hostSetText(el, n2.children);
9353
9379
  }
9354
9380
  }
9355
9381
  };
@@ -9425,7 +9451,7 @@ If you want to remount the same app, move your app creation logic into a factory
9425
9451
  optimized
9426
9452
  );
9427
9453
  } else {
9428
- const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
9454
+ const customElement = n1.el && n1.el._isVueCE ? n1.el : null;
9429
9455
  try {
9430
9456
  if (customElement) {
9431
9457
  customElement._beginPatch();
@@ -9911,8 +9937,7 @@ If you want to remount the same app, move your app creation logic into a factory
9911
9937
  hydrateSubTree();
9912
9938
  }
9913
9939
  } else {
9914
- if (root.ce && // @ts-expect-error _def is private
9915
- root.ce._def.shadowRoot !== false) {
9940
+ if (root.ce && root.ce._hasShadowRoot()) {
9916
9941
  root.ce._injectChildStyle(type);
9917
9942
  }
9918
9943
  {
@@ -9979,9 +10004,9 @@ If you want to remount the same app, move your app creation logic into a factory
9979
10004
  updateComponentPreRender(instance, next, optimized);
9980
10005
  }
9981
10006
  nonHydratedAsyncRoot.asyncDep.then(() => {
9982
- if (!instance.isUnmounted) {
9983
- componentUpdateFn();
9984
- }
10007
+ queuePostRenderEffect(() => {
10008
+ if (!instance.isUnmounted) update();
10009
+ }, parentSuspense);
9985
10010
  });
9986
10011
  return;
9987
10012
  }
@@ -10696,12 +10721,10 @@ If you want to remount the same app, move your app creation logic into a factory
10696
10721
  traverseStaticChildren(c1, c2);
10697
10722
  }
10698
10723
  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);
10724
+ if (c2.patchFlag === -1) {
10725
+ c2 = ch2[i] = cloneIfMounted(c2);
10704
10726
  }
10727
+ c2.el = c1.el;
10705
10728
  }
10706
10729
  if (c2.type === Comment && !c2.el) {
10707
10730
  c2.el = c1.el;
@@ -12492,7 +12515,7 @@ Component that was made reactive: `,
12492
12515
  return true;
12493
12516
  }
12494
12517
 
12495
- const version = "3.5.27";
12518
+ const version = "3.5.28";
12496
12519
  const warn = warn$1 ;
12497
12520
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12498
12521
  const devtools = devtools$1 ;
@@ -13835,6 +13858,12 @@ Expected function or array of functions, received type ${typeof value}.`
13835
13858
  this._update();
13836
13859
  }
13837
13860
  }
13861
+ /**
13862
+ * @internal
13863
+ */
13864
+ _hasShadowRoot() {
13865
+ return this._def.shadowRoot !== false;
13866
+ }
13838
13867
  /**
13839
13868
  * @internal
13840
13869
  */
@@ -13966,10 +13995,7 @@ Expected function or array of functions, received type ${typeof value}.`
13966
13995
  instance
13967
13996
  )
13968
13997
  );
13969
- positionMap.set(child, {
13970
- left: child.el.offsetLeft,
13971
- top: child.el.offsetTop
13972
- });
13998
+ positionMap.set(child, getPosition(child.el));
13973
13999
  }
13974
14000
  }
13975
14001
  }
@@ -14000,10 +14026,7 @@ Expected function or array of functions, received type ${typeof value}.`
14000
14026
  }
14001
14027
  }
14002
14028
  function recordPosition(c) {
14003
- newPositionMap.set(c, {
14004
- left: c.el.offsetLeft,
14005
- top: c.el.offsetTop
14006
- });
14029
+ newPositionMap.set(c, getPosition(c.el));
14007
14030
  }
14008
14031
  function applyTranslation(c) {
14009
14032
  const oldPos = positionMap.get(c);
@@ -14011,12 +14034,29 @@ Expected function or array of functions, received type ${typeof value}.`
14011
14034
  const dx = oldPos.left - newPos.left;
14012
14035
  const dy = oldPos.top - newPos.top;
14013
14036
  if (dx || dy) {
14014
- const s = c.el.style;
14015
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
14037
+ const el = c.el;
14038
+ const s = el.style;
14039
+ const rect = el.getBoundingClientRect();
14040
+ let scaleX = 1;
14041
+ let scaleY = 1;
14042
+ if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
14043
+ if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
14044
+ if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
14045
+ if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
14046
+ if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
14047
+ if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
14048
+ s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
14016
14049
  s.transitionDuration = "0s";
14017
14050
  return c;
14018
14051
  }
14019
14052
  }
14053
+ function getPosition(el) {
14054
+ const rect = el.getBoundingClientRect();
14055
+ return {
14056
+ left: rect.left,
14057
+ top: rect.top
14058
+ };
14059
+ }
14020
14060
  function hasCSSTransform(el, root, moveClass) {
14021
14061
  const clone = el.cloneNode();
14022
14062
  const _vtc = el[vtcKey];
@@ -14293,6 +14333,7 @@ Expected function or array of functions, received type ${typeof value}.`
14293
14333
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
14294
14334
  };
14295
14335
  const withModifiers = (fn, modifiers) => {
14336
+ if (!fn) return fn;
14296
14337
  const cache = fn._withMods || (fn._withMods = {});
14297
14338
  const cacheKey = modifiers.join(".");
14298
14339
  return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {