@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
  **/
@@ -337,6 +337,7 @@ var Vue = (function () {
337
337
 
338
338
  let activeEffectScope;
339
339
  class EffectScope {
340
+ // TODO isolatedDeclarations "__v_skip"
340
341
  constructor(detached = false) {
341
342
  this.detached = detached;
342
343
  /**
@@ -356,6 +357,7 @@ var Vue = (function () {
356
357
  */
357
358
  this.cleanups = [];
358
359
  this._isPaused = false;
360
+ this.__v_skip = true;
359
361
  this.parent = activeEffectScope;
360
362
  if (!detached && activeEffectScope) {
361
363
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -3881,7 +3883,22 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3881
3883
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3882
3884
  o: { nextSibling, parentNode, querySelector, insert, createText }
3883
3885
  }, hydrateChildren) {
3884
- function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
3886
+ function hydrateAnchor(target2, targetNode) {
3887
+ let targetAnchor = targetNode;
3888
+ while (targetAnchor) {
3889
+ if (targetAnchor && targetAnchor.nodeType === 8) {
3890
+ if (targetAnchor.data === "teleport start anchor") {
3891
+ vnode.targetStart = targetAnchor;
3892
+ } else if (targetAnchor.data === "teleport anchor") {
3893
+ vnode.targetAnchor = targetAnchor;
3894
+ target2._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3895
+ break;
3896
+ }
3897
+ }
3898
+ targetAnchor = nextSibling(targetAnchor);
3899
+ }
3900
+ }
3901
+ function hydrateDisabledTeleport(node2, vnode2) {
3885
3902
  vnode2.anchor = hydrateChildren(
3886
3903
  nextSibling(node2),
3887
3904
  vnode2,
@@ -3891,8 +3908,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3891
3908
  slotScopeIds,
3892
3909
  optimized
3893
3910
  );
3894
- vnode2.targetStart = targetStart;
3895
- vnode2.targetAnchor = targetAnchor;
3896
3911
  }
3897
3912
  const target = vnode.target = resolveTarget(
3898
3913
  vnode.props,
@@ -3903,27 +3918,22 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3903
3918
  const targetNode = target._lpa || target.firstChild;
3904
3919
  if (vnode.shapeFlag & 16) {
3905
3920
  if (disabled) {
3906
- hydrateDisabledTeleport(
3907
- node,
3908
- vnode,
3909
- targetNode,
3910
- targetNode && nextSibling(targetNode)
3911
- );
3921
+ hydrateDisabledTeleport(node, vnode);
3922
+ hydrateAnchor(target, targetNode);
3923
+ if (!vnode.targetAnchor) {
3924
+ prepareAnchor(
3925
+ target,
3926
+ vnode,
3927
+ createText,
3928
+ insert,
3929
+ // if target is the same as the main view, insert anchors before current node
3930
+ // to avoid hydrating mismatch
3931
+ parentNode(node) === target ? node : null
3932
+ );
3933
+ }
3912
3934
  } else {
3913
3935
  vnode.anchor = nextSibling(node);
3914
- let targetAnchor = targetNode;
3915
- while (targetAnchor) {
3916
- if (targetAnchor && targetAnchor.nodeType === 8) {
3917
- if (targetAnchor.data === "teleport start anchor") {
3918
- vnode.targetStart = targetAnchor;
3919
- } else if (targetAnchor.data === "teleport anchor") {
3920
- vnode.targetAnchor = targetAnchor;
3921
- target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
3922
- break;
3923
- }
3924
- }
3925
- targetAnchor = nextSibling(targetAnchor);
3926
- }
3936
+ hydrateAnchor(target, targetNode);
3927
3937
  if (!vnode.targetAnchor) {
3928
3938
  prepareAnchor(target, vnode, createText, insert);
3929
3939
  }
@@ -3941,7 +3951,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3941
3951
  updateCssVars(vnode, disabled);
3942
3952
  } else if (disabled) {
3943
3953
  if (vnode.shapeFlag & 16) {
3944
- hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
3954
+ hydrateDisabledTeleport(node, vnode);
3955
+ vnode.targetStart = node;
3956
+ vnode.targetAnchor = nextSibling(node);
3945
3957
  }
3946
3958
  }
3947
3959
  return vnode.anchor && nextSibling(vnode.anchor);
@@ -3965,13 +3977,13 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3965
3977
  ctx.ut();
3966
3978
  }
3967
3979
  }
3968
- function prepareAnchor(target, vnode, createText, insert) {
3980
+ function prepareAnchor(target, vnode, createText, insert, anchor = null) {
3969
3981
  const targetStart = vnode.targetStart = createText("");
3970
3982
  const targetAnchor = vnode.targetAnchor = createText("");
3971
3983
  targetStart[TeleportEndKey] = targetAnchor;
3972
3984
  if (target) {
3973
- insert(targetStart, target);
3974
- insert(targetAnchor, target);
3985
+ insert(targetStart, target, anchor);
3986
+ insert(targetAnchor, target, anchor);
3975
3987
  }
3976
3988
  return targetAnchor;
3977
3989
  }
@@ -4209,7 +4221,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4209
4221
  }
4210
4222
  }
4211
4223
  let called = false;
4212
- const done = el[enterCbKey$1] = (cancelled) => {
4224
+ el[enterCbKey$1] = (cancelled) => {
4213
4225
  if (called) return;
4214
4226
  called = true;
4215
4227
  if (cancelled) {
@@ -4222,6 +4234,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4222
4234
  }
4223
4235
  el[enterCbKey$1] = void 0;
4224
4236
  };
4237
+ const done = el[enterCbKey$1].bind(null, false);
4225
4238
  if (hook) {
4226
4239
  callAsyncHook(hook, [el, done]);
4227
4240
  } else {
@@ -4241,7 +4254,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4241
4254
  }
4242
4255
  callHook(onBeforeLeave, [el]);
4243
4256
  let called = false;
4244
- const done = el[leaveCbKey] = (cancelled) => {
4257
+ el[leaveCbKey] = (cancelled) => {
4245
4258
  if (called) return;
4246
4259
  called = true;
4247
4260
  remove();
@@ -4255,6 +4268,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4255
4268
  delete leavingVNodesCache[key2];
4256
4269
  }
4257
4270
  };
4271
+ const done = el[leaveCbKey].bind(null, false);
4258
4272
  leavingVNodesCache[key2] = vnode;
4259
4273
  if (onLeave) {
4260
4274
  callAsyncHook(onLeave, [el, done]);
@@ -4367,8 +4381,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4367
4381
  const r = shallowRef(null);
4368
4382
  if (i) {
4369
4383
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4370
- let desc;
4371
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4384
+ if (isTemplateRefKey(refs, key)) {
4372
4385
  warn$1(`useTemplateRef('${key}') already exists.`);
4373
4386
  } else {
4374
4387
  Object.defineProperty(refs, key, {
@@ -4388,6 +4401,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4388
4401
  }
4389
4402
  return ret;
4390
4403
  }
4404
+ function isTemplateRefKey(refs, key) {
4405
+ let desc;
4406
+ return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
4407
+ }
4391
4408
 
4392
4409
  const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4393
4410
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
@@ -4433,10 +4450,19 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4433
4450
  return false;
4434
4451
  }
4435
4452
  }
4453
+ if (isTemplateRefKey(refs, key)) {
4454
+ return false;
4455
+ }
4436
4456
  return hasOwn(rawSetupState, key);
4437
4457
  };
4438
- const canSetRef = (ref2) => {
4439
- return !knownTemplateRefs.has(ref2);
4458
+ const canSetRef = (ref2, key) => {
4459
+ if (knownTemplateRefs.has(ref2)) {
4460
+ return false;
4461
+ }
4462
+ if (key && isTemplateRefKey(refs, key)) {
4463
+ return false;
4464
+ }
4465
+ return true;
4440
4466
  };
4441
4467
  if (oldRef != null && oldRef !== ref) {
4442
4468
  invalidatePendingSetRef(oldRawRef);
@@ -4446,10 +4472,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4446
4472
  setupState[oldRef] = null;
4447
4473
  }
4448
4474
  } else if (isRef(oldRef)) {
4449
- if (canSetRef(oldRef)) {
4475
+ const oldRawRefAtom = oldRawRef;
4476
+ if (canSetRef(oldRef, oldRawRefAtom.k)) {
4450
4477
  oldRef.value = null;
4451
4478
  }
4452
- const oldRawRefAtom = oldRawRef;
4453
4479
  if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4454
4480
  }
4455
4481
  }
@@ -4473,7 +4499,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4473
4499
  }
4474
4500
  } else {
4475
4501
  const newVal = [refValue];
4476
- if (canSetRef(ref)) {
4502
+ if (canSetRef(ref, rawRef.k)) {
4477
4503
  ref.value = newVal;
4478
4504
  }
4479
4505
  if (rawRef.k) refs[rawRef.k] = newVal;
@@ -4488,7 +4514,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4488
4514
  setupState[ref] = value;
4489
4515
  }
4490
4516
  } else if (_isRef) {
4491
- if (canSetRef(ref)) {
4517
+ if (canSetRef(ref, rawRef.k)) {
4492
4518
  ref.value = value;
4493
4519
  }
4494
4520
  if (rawRef.k) refs[rawRef.k] = value;
@@ -7342,7 +7368,7 @@ If this is a native custom element, make sure to exclude it from component resol
7342
7368
  return vm;
7343
7369
  }
7344
7370
  }
7345
- Vue.version = `2.6.14-compat:${"3.5.27"}`;
7371
+ Vue.version = `2.6.14-compat:${"3.5.28"}`;
7346
7372
  Vue.config = singletonApp.config;
7347
7373
  Vue.use = (plugin, ...options) => {
7348
7374
  if (plugin && isFunction(plugin.install)) {
@@ -8456,7 +8482,7 @@ If you want to remount the same app, move your app creation logic into a factory
8456
8482
  const dynamicProps = nextVNode.dynamicProps;
8457
8483
  for (let i = 0; i < dynamicProps.length; i++) {
8458
8484
  const key = dynamicProps[i];
8459
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
8485
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) {
8460
8486
  return true;
8461
8487
  }
8462
8488
  }
@@ -8487,12 +8513,20 @@ If you want to remount the same app, move your app creation logic into a factory
8487
8513
  }
8488
8514
  for (let i = 0; i < nextKeys.length; i++) {
8489
8515
  const key = nextKeys[i];
8490
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
8516
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
8491
8517
  return true;
8492
8518
  }
8493
8519
  }
8494
8520
  return false;
8495
8521
  }
8522
+ function hasPropValueChanged(nextProps, prevProps, key) {
8523
+ const nextProp = nextProps[key];
8524
+ const prevProp = prevProps[key];
8525
+ if (key === "style" && isObject(nextProp) && isObject(prevProp)) {
8526
+ return !looseEqual(nextProp, prevProp);
8527
+ }
8528
+ return nextProp !== prevProp;
8529
+ }
8496
8530
  function updateHOCHostEl({ vnode, parent }, el) {
8497
8531
  while (parent) {
8498
8532
  const root = parent.subTree;
@@ -9268,15 +9302,7 @@ If you want to remount the same app, move your app creation logic into a factory
9268
9302
  } else {
9269
9303
  const el = n2.el = n1.el;
9270
9304
  if (n2.children !== n1.children) {
9271
- if (isHmrUpdating && n2.patchFlag === -1 && "__elIndex" in n1) {
9272
- const childNodes = container.childNodes;
9273
- const newChild = hostCreateText(n2.children);
9274
- const oldChild = childNodes[n2.__elIndex = n1.__elIndex];
9275
- hostInsert(newChild, container, oldChild);
9276
- hostRemove(oldChild);
9277
- } else {
9278
- hostSetText(el, n2.children);
9279
- }
9305
+ hostSetText(el, n2.children);
9280
9306
  }
9281
9307
  }
9282
9308
  };
@@ -9352,7 +9378,7 @@ If you want to remount the same app, move your app creation logic into a factory
9352
9378
  optimized
9353
9379
  );
9354
9380
  } else {
9355
- const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
9381
+ const customElement = n1.el && n1.el._isVueCE ? n1.el : null;
9356
9382
  try {
9357
9383
  if (customElement) {
9358
9384
  customElement._beginPatch();
@@ -9838,8 +9864,7 @@ If you want to remount the same app, move your app creation logic into a factory
9838
9864
  hydrateSubTree();
9839
9865
  }
9840
9866
  } else {
9841
- if (root.ce && // @ts-expect-error _def is private
9842
- root.ce._def.shadowRoot !== false) {
9867
+ if (root.ce && root.ce._hasShadowRoot()) {
9843
9868
  root.ce._injectChildStyle(type);
9844
9869
  }
9845
9870
  {
@@ -9906,9 +9931,9 @@ If you want to remount the same app, move your app creation logic into a factory
9906
9931
  updateComponentPreRender(instance, next, optimized);
9907
9932
  }
9908
9933
  nonHydratedAsyncRoot.asyncDep.then(() => {
9909
- if (!instance.isUnmounted) {
9910
- componentUpdateFn();
9911
- }
9934
+ queuePostRenderEffect(() => {
9935
+ if (!instance.isUnmounted) update();
9936
+ }, parentSuspense);
9912
9937
  });
9913
9938
  return;
9914
9939
  }
@@ -10623,12 +10648,10 @@ If you want to remount the same app, move your app creation logic into a factory
10623
10648
  traverseStaticChildren(c1, c2);
10624
10649
  }
10625
10650
  if (c2.type === Text) {
10626
- if (c2.patchFlag !== -1) {
10627
- c2.el = c1.el;
10628
- } else {
10629
- c2.__elIndex = i + // take fragment start anchor into account
10630
- (n1.type === Fragment ? 1 : 0);
10651
+ if (c2.patchFlag === -1) {
10652
+ c2 = ch2[i] = cloneIfMounted(c2);
10631
10653
  }
10654
+ c2.el = c1.el;
10632
10655
  }
10633
10656
  if (c2.type === Comment && !c2.el) {
10634
10657
  c2.el = c1.el;
@@ -12419,7 +12442,7 @@ Component that was made reactive: `,
12419
12442
  return true;
12420
12443
  }
12421
12444
 
12422
- const version = "3.5.27";
12445
+ const version = "3.5.28";
12423
12446
  const warn = warn$1 ;
12424
12447
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12425
12448
  const devtools = devtools$1 ;
@@ -13762,6 +13785,12 @@ Expected function or array of functions, received type ${typeof value}.`
13762
13785
  this._update();
13763
13786
  }
13764
13787
  }
13788
+ /**
13789
+ * @internal
13790
+ */
13791
+ _hasShadowRoot() {
13792
+ return this._def.shadowRoot !== false;
13793
+ }
13765
13794
  /**
13766
13795
  * @internal
13767
13796
  */
@@ -13893,10 +13922,7 @@ Expected function or array of functions, received type ${typeof value}.`
13893
13922
  instance
13894
13923
  )
13895
13924
  );
13896
- positionMap.set(child, {
13897
- left: child.el.offsetLeft,
13898
- top: child.el.offsetTop
13899
- });
13925
+ positionMap.set(child, getPosition(child.el));
13900
13926
  }
13901
13927
  }
13902
13928
  }
@@ -13927,10 +13953,7 @@ Expected function or array of functions, received type ${typeof value}.`
13927
13953
  }
13928
13954
  }
13929
13955
  function recordPosition(c) {
13930
- newPositionMap.set(c, {
13931
- left: c.el.offsetLeft,
13932
- top: c.el.offsetTop
13933
- });
13956
+ newPositionMap.set(c, getPosition(c.el));
13934
13957
  }
13935
13958
  function applyTranslation(c) {
13936
13959
  const oldPos = positionMap.get(c);
@@ -13938,12 +13961,29 @@ Expected function or array of functions, received type ${typeof value}.`
13938
13961
  const dx = oldPos.left - newPos.left;
13939
13962
  const dy = oldPos.top - newPos.top;
13940
13963
  if (dx || dy) {
13941
- const s = c.el.style;
13942
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
13964
+ const el = c.el;
13965
+ const s = el.style;
13966
+ const rect = el.getBoundingClientRect();
13967
+ let scaleX = 1;
13968
+ let scaleY = 1;
13969
+ if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
13970
+ if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
13971
+ if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
13972
+ if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
13973
+ if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
13974
+ if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
13975
+ s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
13943
13976
  s.transitionDuration = "0s";
13944
13977
  return c;
13945
13978
  }
13946
13979
  }
13980
+ function getPosition(el) {
13981
+ const rect = el.getBoundingClientRect();
13982
+ return {
13983
+ left: rect.left,
13984
+ top: rect.top
13985
+ };
13986
+ }
13947
13987
  function hasCSSTransform(el, root, moveClass) {
13948
13988
  const clone = el.cloneNode();
13949
13989
  const _vtc = el[vtcKey];
@@ -14220,6 +14260,7 @@ Expected function or array of functions, received type ${typeof value}.`
14220
14260
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
14221
14261
  };
14222
14262
  const withModifiers = (fn, modifiers) => {
14263
+ if (!fn) return fn;
14223
14264
  const cache = fn._withMods || (fn._withMods = {});
14224
14265
  const cacheKey = modifiers.join(".");
14225
14266
  return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {