@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
  **/
@@ -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
  }
@@ -4196,6 +4208,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4196
4208
  callHook(hook, [el]);
4197
4209
  },
4198
4210
  enter(el) {
4211
+ if (leavingVNodesCache[key] === vnode) return;
4199
4212
  let hook = onEnter;
4200
4213
  let afterHook = onAfterEnter;
4201
4214
  let cancelHook = onEnterCancelled;
@@ -4209,7 +4222,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4209
4222
  }
4210
4223
  }
4211
4224
  let called = false;
4212
- const done = el[enterCbKey$1] = (cancelled) => {
4225
+ el[enterCbKey$1] = (cancelled) => {
4213
4226
  if (called) return;
4214
4227
  called = true;
4215
4228
  if (cancelled) {
@@ -4222,6 +4235,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4222
4235
  }
4223
4236
  el[enterCbKey$1] = void 0;
4224
4237
  };
4238
+ const done = el[enterCbKey$1].bind(null, false);
4225
4239
  if (hook) {
4226
4240
  callAsyncHook(hook, [el, done]);
4227
4241
  } else {
@@ -4241,7 +4255,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4241
4255
  }
4242
4256
  callHook(onBeforeLeave, [el]);
4243
4257
  let called = false;
4244
- const done = el[leaveCbKey] = (cancelled) => {
4258
+ el[leaveCbKey] = (cancelled) => {
4245
4259
  if (called) return;
4246
4260
  called = true;
4247
4261
  remove();
@@ -4255,6 +4269,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4255
4269
  delete leavingVNodesCache[key2];
4256
4270
  }
4257
4271
  };
4272
+ const done = el[leaveCbKey].bind(null, false);
4258
4273
  leavingVNodesCache[key2] = vnode;
4259
4274
  if (onLeave) {
4260
4275
  callAsyncHook(onLeave, [el, done]);
@@ -4367,8 +4382,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4367
4382
  const r = shallowRef(null);
4368
4383
  if (i) {
4369
4384
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4370
- let desc;
4371
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4385
+ if (isTemplateRefKey(refs, key)) {
4372
4386
  warn$1(`useTemplateRef('${key}') already exists.`);
4373
4387
  } else {
4374
4388
  Object.defineProperty(refs, key, {
@@ -4388,6 +4402,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4388
4402
  }
4389
4403
  return ret;
4390
4404
  }
4405
+ function isTemplateRefKey(refs, key) {
4406
+ let desc;
4407
+ return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
4408
+ }
4391
4409
 
4392
4410
  const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4393
4411
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
@@ -4433,10 +4451,19 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4433
4451
  return false;
4434
4452
  }
4435
4453
  }
4454
+ if (isTemplateRefKey(refs, key)) {
4455
+ return false;
4456
+ }
4436
4457
  return hasOwn(rawSetupState, key);
4437
4458
  };
4438
- const canSetRef = (ref2) => {
4439
- return !knownTemplateRefs.has(ref2);
4459
+ const canSetRef = (ref2, key) => {
4460
+ if (knownTemplateRefs.has(ref2)) {
4461
+ return false;
4462
+ }
4463
+ if (key && isTemplateRefKey(refs, key)) {
4464
+ return false;
4465
+ }
4466
+ return true;
4440
4467
  };
4441
4468
  if (oldRef != null && oldRef !== ref) {
4442
4469
  invalidatePendingSetRef(oldRawRef);
@@ -4446,10 +4473,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4446
4473
  setupState[oldRef] = null;
4447
4474
  }
4448
4475
  } else if (isRef(oldRef)) {
4449
- if (canSetRef(oldRef)) {
4476
+ const oldRawRefAtom = oldRawRef;
4477
+ if (canSetRef(oldRef, oldRawRefAtom.k)) {
4450
4478
  oldRef.value = null;
4451
4479
  }
4452
- const oldRawRefAtom = oldRawRef;
4453
4480
  if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4454
4481
  }
4455
4482
  }
@@ -4473,7 +4500,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4473
4500
  }
4474
4501
  } else {
4475
4502
  const newVal = [refValue];
4476
- if (canSetRef(ref)) {
4503
+ if (canSetRef(ref, rawRef.k)) {
4477
4504
  ref.value = newVal;
4478
4505
  }
4479
4506
  if (rawRef.k) refs[rawRef.k] = newVal;
@@ -4488,7 +4515,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4488
4515
  setupState[ref] = value;
4489
4516
  }
4490
4517
  } else if (_isRef) {
4491
- if (canSetRef(ref)) {
4518
+ if (canSetRef(ref, rawRef.k)) {
4492
4519
  ref.value = value;
4493
4520
  }
4494
4521
  if (rawRef.k) refs[rawRef.k] = value;
@@ -6818,13 +6845,24 @@ If this is a native custom element, make sure to exclude it from component resol
6818
6845
  }
6819
6846
  let awaitable = getAwaitable();
6820
6847
  unsetCurrentInstance();
6848
+ const cleanup = () => {
6849
+ if (getCurrentInstance() !== ctx) ctx.scope.off();
6850
+ unsetCurrentInstance();
6851
+ };
6821
6852
  if (isPromise(awaitable)) {
6822
6853
  awaitable = awaitable.catch((e) => {
6823
6854
  setCurrentInstance(ctx);
6855
+ Promise.resolve().then(() => Promise.resolve().then(cleanup));
6824
6856
  throw e;
6825
6857
  });
6826
6858
  }
6827
- return [awaitable, () => setCurrentInstance(ctx)];
6859
+ return [
6860
+ awaitable,
6861
+ () => {
6862
+ setCurrentInstance(ctx);
6863
+ Promise.resolve().then(cleanup);
6864
+ }
6865
+ ];
6828
6866
  }
6829
6867
 
6830
6868
  function createDuplicateChecker() {
@@ -7342,7 +7380,7 @@ If this is a native custom element, make sure to exclude it from component resol
7342
7380
  return vm;
7343
7381
  }
7344
7382
  }
7345
- Vue.version = `2.6.14-compat:${"3.5.27"}`;
7383
+ Vue.version = `2.6.14-compat:${"3.5.29"}`;
7346
7384
  Vue.config = singletonApp.config;
7347
7385
  Vue.use = (plugin, ...options) => {
7348
7386
  if (plugin && isFunction(plugin.install)) {
@@ -8456,7 +8494,7 @@ If you want to remount the same app, move your app creation logic into a factory
8456
8494
  const dynamicProps = nextVNode.dynamicProps;
8457
8495
  for (let i = 0; i < dynamicProps.length; i++) {
8458
8496
  const key = dynamicProps[i];
8459
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
8497
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) {
8460
8498
  return true;
8461
8499
  }
8462
8500
  }
@@ -8487,12 +8525,20 @@ If you want to remount the same app, move your app creation logic into a factory
8487
8525
  }
8488
8526
  for (let i = 0; i < nextKeys.length; i++) {
8489
8527
  const key = nextKeys[i];
8490
- if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
8528
+ if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
8491
8529
  return true;
8492
8530
  }
8493
8531
  }
8494
8532
  return false;
8495
8533
  }
8534
+ function hasPropValueChanged(nextProps, prevProps, key) {
8535
+ const nextProp = nextProps[key];
8536
+ const prevProp = prevProps[key];
8537
+ if (key === "style" && isObject(nextProp) && isObject(prevProp)) {
8538
+ return !looseEqual(nextProp, prevProp);
8539
+ }
8540
+ return nextProp !== prevProp;
8541
+ }
8496
8542
  function updateHOCHostEl({ vnode, parent }, el) {
8497
8543
  while (parent) {
8498
8544
  const root = parent.subTree;
@@ -9268,15 +9314,7 @@ If you want to remount the same app, move your app creation logic into a factory
9268
9314
  } else {
9269
9315
  const el = n2.el = n1.el;
9270
9316
  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
- }
9317
+ hostSetText(el, n2.children);
9280
9318
  }
9281
9319
  }
9282
9320
  };
@@ -9352,7 +9390,7 @@ If you want to remount the same app, move your app creation logic into a factory
9352
9390
  optimized
9353
9391
  );
9354
9392
  } else {
9355
- const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
9393
+ const customElement = n1.el && n1.el._isVueCE ? n1.el : null;
9356
9394
  try {
9357
9395
  if (customElement) {
9358
9396
  customElement._beginPatch();
@@ -9838,8 +9876,7 @@ If you want to remount the same app, move your app creation logic into a factory
9838
9876
  hydrateSubTree();
9839
9877
  }
9840
9878
  } else {
9841
- if (root.ce && // @ts-expect-error _def is private
9842
- root.ce._def.shadowRoot !== false) {
9879
+ if (root.ce && root.ce._hasShadowRoot()) {
9843
9880
  root.ce._injectChildStyle(type);
9844
9881
  }
9845
9882
  {
@@ -9906,9 +9943,9 @@ If you want to remount the same app, move your app creation logic into a factory
9906
9943
  updateComponentPreRender(instance, next, optimized);
9907
9944
  }
9908
9945
  nonHydratedAsyncRoot.asyncDep.then(() => {
9909
- if (!instance.isUnmounted) {
9910
- componentUpdateFn();
9911
- }
9946
+ queuePostRenderEffect(() => {
9947
+ if (!instance.isUnmounted) update();
9948
+ }, parentSuspense);
9912
9949
  });
9913
9950
  return;
9914
9951
  }
@@ -10623,12 +10660,10 @@ If you want to remount the same app, move your app creation logic into a factory
10623
10660
  traverseStaticChildren(c1, c2);
10624
10661
  }
10625
10662
  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);
10663
+ if (c2.patchFlag === -1) {
10664
+ c2 = ch2[i] = cloneIfMounted(c2);
10631
10665
  }
10666
+ c2.el = c1.el;
10632
10667
  }
10633
10668
  if (c2.type === Comment && !c2.el) {
10634
10669
  c2.el = c1.el;
@@ -12419,7 +12454,7 @@ Component that was made reactive: `,
12419
12454
  return true;
12420
12455
  }
12421
12456
 
12422
- const version = "3.5.27";
12457
+ const version = "3.5.29";
12423
12458
  const warn = warn$1 ;
12424
12459
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12425
12460
  const devtools = devtools$1 ;
@@ -13762,6 +13797,12 @@ Expected function or array of functions, received type ${typeof value}.`
13762
13797
  this._update();
13763
13798
  }
13764
13799
  }
13800
+ /**
13801
+ * @internal
13802
+ */
13803
+ _hasShadowRoot() {
13804
+ return this._def.shadowRoot !== false;
13805
+ }
13765
13806
  /**
13766
13807
  * @internal
13767
13808
  */
@@ -13893,10 +13934,7 @@ Expected function or array of functions, received type ${typeof value}.`
13893
13934
  instance
13894
13935
  )
13895
13936
  );
13896
- positionMap.set(child, {
13897
- left: child.el.offsetLeft,
13898
- top: child.el.offsetTop
13899
- });
13937
+ positionMap.set(child, getPosition(child.el));
13900
13938
  }
13901
13939
  }
13902
13940
  }
@@ -13927,10 +13965,7 @@ Expected function or array of functions, received type ${typeof value}.`
13927
13965
  }
13928
13966
  }
13929
13967
  function recordPosition(c) {
13930
- newPositionMap.set(c, {
13931
- left: c.el.offsetLeft,
13932
- top: c.el.offsetTop
13933
- });
13968
+ newPositionMap.set(c, getPosition(c.el));
13934
13969
  }
13935
13970
  function applyTranslation(c) {
13936
13971
  const oldPos = positionMap.get(c);
@@ -13938,12 +13973,29 @@ Expected function or array of functions, received type ${typeof value}.`
13938
13973
  const dx = oldPos.left - newPos.left;
13939
13974
  const dy = oldPos.top - newPos.top;
13940
13975
  if (dx || dy) {
13941
- const s = c.el.style;
13942
- s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
13976
+ const el = c.el;
13977
+ const s = el.style;
13978
+ const rect = el.getBoundingClientRect();
13979
+ let scaleX = 1;
13980
+ let scaleY = 1;
13981
+ if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
13982
+ if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
13983
+ if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
13984
+ if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
13985
+ if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
13986
+ if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
13987
+ s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
13943
13988
  s.transitionDuration = "0s";
13944
13989
  return c;
13945
13990
  }
13946
13991
  }
13992
+ function getPosition(el) {
13993
+ const rect = el.getBoundingClientRect();
13994
+ return {
13995
+ left: rect.left,
13996
+ top: rect.top
13997
+ };
13998
+ }
13947
13999
  function hasCSSTransform(el, root, moveClass) {
13948
14000
  const clone = el.cloneNode();
13949
14001
  const _vtc = el[vtcKey];
@@ -14220,6 +14272,7 @@ Expected function or array of functions, received type ${typeof value}.`
14220
14272
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
14221
14273
  };
14222
14274
  const withModifiers = (fn, modifiers) => {
14275
+ if (!fn) return fn;
14223
14276
  const cache = fn._withMods || (fn._withMods = {});
14224
14277
  const cacheKey = modifiers.join(".");
14225
14278
  return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {