@vue/compat 3.4.19 → 3.4.21

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.4.19
2
+ * @vue/compat v3.4.21
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -730,20 +730,20 @@ function hasOwnProperty(key) {
730
730
  return obj.hasOwnProperty(key);
731
731
  }
732
732
  class BaseReactiveHandler {
733
- constructor(_isReadonly = false, _shallow = false) {
733
+ constructor(_isReadonly = false, _isShallow = false) {
734
734
  this._isReadonly = _isReadonly;
735
- this._shallow = _shallow;
735
+ this._isShallow = _isShallow;
736
736
  }
737
737
  get(target, key, receiver) {
738
- const isReadonly2 = this._isReadonly, shallow = this._shallow;
738
+ const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
739
739
  if (key === "__v_isReactive") {
740
740
  return !isReadonly2;
741
741
  } else if (key === "__v_isReadonly") {
742
742
  return isReadonly2;
743
743
  } else if (key === "__v_isShallow") {
744
- return shallow;
744
+ return isShallow2;
745
745
  } else if (key === "__v_raw") {
746
- if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
746
+ if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
747
747
  // this means the reciever is a user proxy of the reactive proxy
748
748
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
749
749
  return target;
@@ -766,7 +766,7 @@ class BaseReactiveHandler {
766
766
  if (!isReadonly2) {
767
767
  track(target, "get", key);
768
768
  }
769
- if (shallow) {
769
+ if (isShallow2) {
770
770
  return res;
771
771
  }
772
772
  if (isRef(res)) {
@@ -779,12 +779,12 @@ class BaseReactiveHandler {
779
779
  }
780
780
  }
781
781
  class MutableReactiveHandler extends BaseReactiveHandler {
782
- constructor(shallow = false) {
783
- super(false, shallow);
782
+ constructor(isShallow2 = false) {
783
+ super(false, isShallow2);
784
784
  }
785
785
  set(target, key, value, receiver) {
786
786
  let oldValue = target[key];
787
- if (!this._shallow) {
787
+ if (!this._isShallow) {
788
788
  const isOldValueReadonly = isReadonly(oldValue);
789
789
  if (!isShallow(value) && !isReadonly(value)) {
790
790
  oldValue = toRaw(oldValue);
@@ -836,8 +836,8 @@ class MutableReactiveHandler extends BaseReactiveHandler {
836
836
  }
837
837
  }
838
838
  class ReadonlyReactiveHandler extends BaseReactiveHandler {
839
- constructor(shallow = false) {
840
- super(true, shallow);
839
+ constructor(isShallow2 = false) {
840
+ super(true, isShallow2);
841
841
  }
842
842
  set(target, key) {
843
843
  {
@@ -1008,7 +1008,7 @@ function createReadonlyMethod(type) {
1008
1008
  return function(...args) {
1009
1009
  {
1010
1010
  const key = args[0] ? `on key "${args[0]}" ` : ``;
1011
- console.warn(
1011
+ warn$2(
1012
1012
  `${capitalize(type)} operation ${key}failed: target is readonly.`,
1013
1013
  toRaw(this)
1014
1014
  );
@@ -1146,7 +1146,7 @@ function checkIdentityKeys(target, has2, key) {
1146
1146
  const rawKey = toRaw(key);
1147
1147
  if (rawKey !== key && has2.call(target, rawKey)) {
1148
1148
  const type = toRawType(target);
1149
- console.warn(
1149
+ warn$2(
1150
1150
  `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
1151
1151
  );
1152
1152
  }
@@ -1215,7 +1215,7 @@ function shallowReadonly(target) {
1215
1215
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1216
1216
  if (!isObject(target)) {
1217
1217
  {
1218
- console.warn(`value cannot be made reactive: ${String(target)}`);
1218
+ warn$2(`value cannot be made reactive: ${String(target)}`);
1219
1219
  }
1220
1220
  return target;
1221
1221
  }
@@ -1268,6 +1268,7 @@ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1268
1268
  const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
1269
1269
  class ComputedRefImpl {
1270
1270
  constructor(getter, _setter, isReadonly, isSSR) {
1271
+ this.getter = getter;
1271
1272
  this._setter = _setter;
1272
1273
  this.dep = void 0;
1273
1274
  this.__v_isRef = true;
@@ -1290,7 +1291,11 @@ class ComputedRefImpl {
1290
1291
  }
1291
1292
  trackRefValue(self);
1292
1293
  if (self.effect._dirtyLevel >= 2) {
1293
- warn$2(COMPUTED_SIDE_EFFECT_WARN);
1294
+ if (this._warnRecursive) {
1295
+ warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1296
+
1297
+ getter: `, this.getter);
1298
+ }
1294
1299
  triggerRefValue(self, 2);
1295
1300
  }
1296
1301
  return self._value;
@@ -1446,7 +1451,7 @@ function customRef(factory) {
1446
1451
  }
1447
1452
  function toRefs(object) {
1448
1453
  if (!isProxy(object)) {
1449
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
1454
+ warn$2(`toRefs() expects a reactive object but received a plain one.`);
1450
1455
  }
1451
1456
  const ret = isArray(object) ? new Array(object.length) : {};
1452
1457
  for (const key in object) {
@@ -1528,7 +1533,10 @@ function warn$1(msg, ...args) {
1528
1533
  instance,
1529
1534
  11,
1530
1535
  [
1531
- msg + args.join(""),
1536
+ msg + args.map((a) => {
1537
+ var _a, _b;
1538
+ return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1539
+ }).join(""),
1532
1540
  instance && instance.proxy,
1533
1541
  trace.map(
1534
1542
  ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -3216,8 +3224,10 @@ const SuspenseImpl = {
3216
3224
  rendererInternals
3217
3225
  );
3218
3226
  } else {
3219
- if (parentSuspense && parentSuspense.deps > 0) {
3227
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
3220
3228
  n2.suspense = n1.suspense;
3229
+ n2.suspense.vnode = n2;
3230
+ n2.el = n1.el;
3221
3231
  return;
3222
3232
  }
3223
3233
  patchSuspense(
@@ -4201,7 +4211,6 @@ const BaseTransitionImpl = {
4201
4211
  setup(props, { slots }) {
4202
4212
  const instance = getCurrentInstance();
4203
4213
  const state = useTransitionState();
4204
- let prevTransitionKey;
4205
4214
  return () => {
4206
4215
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4207
4216
  if (!children || !children.length) {
@@ -4244,18 +4253,7 @@ const BaseTransitionImpl = {
4244
4253
  setTransitionHooks(innerChild, enterHooks);
4245
4254
  const oldChild = instance.subTree;
4246
4255
  const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4247
- let transitionKeyChanged = false;
4248
- const { getTransitionKey } = innerChild.type;
4249
- if (getTransitionKey) {
4250
- const key = getTransitionKey();
4251
- if (prevTransitionKey === void 0) {
4252
- prevTransitionKey = key;
4253
- } else if (key !== prevTransitionKey) {
4254
- prevTransitionKey = key;
4255
- transitionKeyChanged = true;
4256
- }
4257
- }
4258
- if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
4256
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4259
4257
  const leavingHooks = resolveTransitionHooks(
4260
4258
  oldInnerChild,
4261
4259
  rawProps,
@@ -6437,7 +6435,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6437
6435
  return vm;
6438
6436
  }
6439
6437
  }
6440
- Vue.version = `2.6.14-compat:${"3.4.19"}`;
6438
+ Vue.version = `2.6.14-compat:${"3.4.21"}`;
6441
6439
  Vue.config = singletonApp.config;
6442
6440
  Vue.use = (p, ...options) => {
6443
6441
  if (p && isFunction(p.install)) {
@@ -10685,9 +10683,8 @@ const unsetCurrentInstance = () => {
10685
10683
  internalSetCurrentInstance(null);
10686
10684
  };
10687
10685
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10688
- function validateComponentName(name, config) {
10689
- const appIsNativeTag = config.isNativeTag || NO;
10690
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10686
+ function validateComponentName(name, { isNativeTag }) {
10687
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10691
10688
  warn$1(
10692
10689
  "Do not use built-in or reserved HTML elements as component id: " + name
10693
10690
  );
@@ -10992,7 +10989,14 @@ function isClassComponent(value) {
10992
10989
  }
10993
10990
 
10994
10991
  const computed = (getterOrOptions, debugOptions) => {
10995
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10992
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10993
+ {
10994
+ const i = getCurrentInstance();
10995
+ if (i && i.appContext.config.warnRecursiveComputed) {
10996
+ c._warnRecursive = true;
10997
+ }
10998
+ }
10999
+ return c;
10996
11000
  };
10997
11001
 
10998
11002
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11270,7 +11274,7 @@ function isMemoSame(cached, memo) {
11270
11274
  return true;
11271
11275
  }
11272
11276
 
11273
- const version = "3.4.19";
11277
+ const version = "3.4.21";
11274
11278
  const warn = warn$1 ;
11275
11279
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11276
11280
  const devtools = devtools$1 ;
@@ -11675,10 +11679,11 @@ function patchClass(el, value, isSVG) {
11675
11679
  }
11676
11680
  }
11677
11681
 
11678
- const vShowOldKey = Symbol("_vod");
11682
+ const vShowOriginalDisplay = Symbol("_vod");
11683
+ const vShowHidden = Symbol("_vsh");
11679
11684
  const vShow = {
11680
11685
  beforeMount(el, { value }, { transition }) {
11681
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11686
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11682
11687
  if (transition && value) {
11683
11688
  transition.beforeEnter(el);
11684
11689
  } else {
@@ -11691,7 +11696,7 @@ const vShow = {
11691
11696
  }
11692
11697
  },
11693
11698
  updated(el, { value, oldValue }, { transition }) {
11694
- if (!value === !oldValue && (el.style.display === el[vShowOldKey] || !value))
11699
+ if (!value === !oldValue)
11695
11700
  return;
11696
11701
  if (transition) {
11697
11702
  if (value) {
@@ -11715,7 +11720,8 @@ const vShow = {
11715
11720
  vShow.name = "show";
11716
11721
  }
11717
11722
  function setDisplay(el, value) {
11718
- el.style.display = value ? el[vShowOldKey] : "none";
11723
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11724
+ el[vShowHidden] = !value;
11719
11725
  }
11720
11726
 
11721
11727
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
@@ -11788,13 +11794,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11788
11794
  function patchStyle(el, prev, next) {
11789
11795
  const style = el.style;
11790
11796
  const isCssString = isString(next);
11791
- const currentDisplay = style.display;
11792
11797
  let hasControlledDisplay = false;
11793
11798
  if (next && !isCssString) {
11794
- if (prev && !isString(prev)) {
11795
- for (const key in prev) {
11796
- if (next[key] == null) {
11797
- setStyle(style, key, "");
11799
+ if (prev) {
11800
+ if (!isString(prev)) {
11801
+ for (const key in prev) {
11802
+ if (next[key] == null) {
11803
+ setStyle(style, key, "");
11804
+ }
11805
+ }
11806
+ } else {
11807
+ for (const prevStyle of prev.split(";")) {
11808
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11809
+ if (next[key] == null) {
11810
+ setStyle(style, key, "");
11811
+ }
11798
11812
  }
11799
11813
  }
11800
11814
  }
@@ -11818,9 +11832,11 @@ function patchStyle(el, prev, next) {
11818
11832
  el.removeAttribute("style");
11819
11833
  }
11820
11834
  }
11821
- if (vShowOldKey in el) {
11822
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11823
- style.display = currentDisplay;
11835
+ if (vShowOriginalDisplay in el) {
11836
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11837
+ if (el[vShowHidden]) {
11838
+ style.display = "none";
11839
+ }
11824
11840
  }
11825
11841
  }
11826
11842
  const semicolonRE = /[^\\];\s*$/;
@@ -11931,15 +11947,15 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
11931
11947
  const tag = el.tagName;
11932
11948
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11933
11949
  !tag.includes("-")) {
11934
- el._value = value;
11935
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
11950
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11936
11951
  const newValue = value == null ? "" : value;
11937
- if (oldValue !== newValue) {
11952
+ if (oldValue !== newValue || !("_value" in el)) {
11938
11953
  el.value = newValue;
11939
11954
  }
11940
11955
  if (value == null) {
11941
11956
  el.removeAttribute(key);
11942
11957
  }
11958
+ el._value = value;
11943
11959
  return;
11944
11960
  }
11945
11961
  let needRemove = false;
@@ -12648,19 +12664,19 @@ const vModelSelect = {
12648
12664
  },
12649
12665
  // set value in mounted & updated because <select> relies on its children
12650
12666
  // <option>s.
12651
- mounted(el, { value, oldValue, modifiers: { number } }) {
12652
- setSelected(el, value, oldValue, number);
12667
+ mounted(el, { value, modifiers: { number } }) {
12668
+ setSelected(el, value, number);
12653
12669
  },
12654
12670
  beforeUpdate(el, _binding, vnode) {
12655
12671
  el[assignKey] = getModelAssigner(vnode);
12656
12672
  },
12657
- updated(el, { value, oldValue, modifiers: { number } }) {
12673
+ updated(el, { value, modifiers: { number } }) {
12658
12674
  if (!el._assigning) {
12659
- setSelected(el, value, oldValue, number);
12675
+ setSelected(el, value, number);
12660
12676
  }
12661
12677
  }
12662
12678
  };
12663
- function setSelected(el, value, oldValue, number) {
12679
+ function setSelected(el, value, number) {
12664
12680
  const isMultiple = el.multiple;
12665
12681
  const isArrayValue = isArray(value);
12666
12682
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12685,12 +12701,10 @@ function setSelected(el, value, oldValue, number) {
12685
12701
  } else {
12686
12702
  option.selected = value.has(optionValue);
12687
12703
  }
12688
- } else {
12689
- if (looseEqual(getValue(option), value)) {
12690
- if (el.selectedIndex !== i)
12691
- el.selectedIndex = i;
12692
- return;
12693
- }
12704
+ } else if (looseEqual(getValue(option), value)) {
12705
+ if (el.selectedIndex !== i)
12706
+ el.selectedIndex = i;
12707
+ return;
12694
12708
  }
12695
12709
  }
12696
12710
  if (!isMultiple && el.selectedIndex !== -1) {