@vue/compat 3.4.19 → 3.4.20

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.20
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) {
@@ -3218,6 +3223,8 @@ const SuspenseImpl = {
3218
3223
  } else {
3219
3224
  if (parentSuspense && parentSuspense.deps > 0) {
3220
3225
  n2.suspense = n1.suspense;
3226
+ n2.suspense.vnode = n2;
3227
+ n2.el = n1.el;
3221
3228
  return;
3222
3229
  }
3223
3230
  patchSuspense(
@@ -4201,7 +4208,6 @@ const BaseTransitionImpl = {
4201
4208
  setup(props, { slots }) {
4202
4209
  const instance = getCurrentInstance();
4203
4210
  const state = useTransitionState();
4204
- let prevTransitionKey;
4205
4211
  return () => {
4206
4212
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4207
4213
  if (!children || !children.length) {
@@ -4244,18 +4250,7 @@ const BaseTransitionImpl = {
4244
4250
  setTransitionHooks(innerChild, enterHooks);
4245
4251
  const oldChild = instance.subTree;
4246
4252
  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)) {
4253
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4259
4254
  const leavingHooks = resolveTransitionHooks(
4260
4255
  oldInnerChild,
4261
4256
  rawProps,
@@ -6437,7 +6432,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6437
6432
  return vm;
6438
6433
  }
6439
6434
  }
6440
- Vue.version = `2.6.14-compat:${"3.4.19"}`;
6435
+ Vue.version = `2.6.14-compat:${"3.4.20"}`;
6441
6436
  Vue.config = singletonApp.config;
6442
6437
  Vue.use = (p, ...options) => {
6443
6438
  if (p && isFunction(p.install)) {
@@ -10685,9 +10680,8 @@ const unsetCurrentInstance = () => {
10685
10680
  internalSetCurrentInstance(null);
10686
10681
  };
10687
10682
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10688
- function validateComponentName(name, config) {
10689
- const appIsNativeTag = config.isNativeTag || NO;
10690
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10683
+ function validateComponentName(name, { isNativeTag }) {
10684
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10691
10685
  warn$1(
10692
10686
  "Do not use built-in or reserved HTML elements as component id: " + name
10693
10687
  );
@@ -10992,7 +10986,14 @@ function isClassComponent(value) {
10992
10986
  }
10993
10987
 
10994
10988
  const computed = (getterOrOptions, debugOptions) => {
10995
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10989
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10990
+ {
10991
+ const i = getCurrentInstance();
10992
+ if (i && i.appContext.config.warnRecursiveComputed) {
10993
+ c._warnRecursive = true;
10994
+ }
10995
+ }
10996
+ return c;
10996
10997
  };
10997
10998
 
10998
10999
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11270,7 +11271,7 @@ function isMemoSame(cached, memo) {
11270
11271
  return true;
11271
11272
  }
11272
11273
 
11273
- const version = "3.4.19";
11274
+ const version = "3.4.20";
11274
11275
  const warn = warn$1 ;
11275
11276
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11276
11277
  const devtools = devtools$1 ;
@@ -11675,10 +11676,11 @@ function patchClass(el, value, isSVG) {
11675
11676
  }
11676
11677
  }
11677
11678
 
11678
- const vShowOldKey = Symbol("_vod");
11679
+ const vShowOriginalDisplay = Symbol("_vod");
11680
+ const vShowHidden = Symbol("_vsh");
11679
11681
  const vShow = {
11680
11682
  beforeMount(el, { value }, { transition }) {
11681
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11683
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11682
11684
  if (transition && value) {
11683
11685
  transition.beforeEnter(el);
11684
11686
  } else {
@@ -11691,7 +11693,7 @@ const vShow = {
11691
11693
  }
11692
11694
  },
11693
11695
  updated(el, { value, oldValue }, { transition }) {
11694
- if (!value === !oldValue && (el.style.display === el[vShowOldKey] || !value))
11696
+ if (!value === !oldValue)
11695
11697
  return;
11696
11698
  if (transition) {
11697
11699
  if (value) {
@@ -11715,7 +11717,8 @@ const vShow = {
11715
11717
  vShow.name = "show";
11716
11718
  }
11717
11719
  function setDisplay(el, value) {
11718
- el.style.display = value ? el[vShowOldKey] : "none";
11720
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11721
+ el[vShowHidden] = !value;
11719
11722
  }
11720
11723
 
11721
11724
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
@@ -11788,13 +11791,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11788
11791
  function patchStyle(el, prev, next) {
11789
11792
  const style = el.style;
11790
11793
  const isCssString = isString(next);
11791
- const currentDisplay = style.display;
11792
11794
  let hasControlledDisplay = false;
11793
11795
  if (next && !isCssString) {
11794
- if (prev && !isString(prev)) {
11795
- for (const key in prev) {
11796
- if (next[key] == null) {
11797
- setStyle(style, key, "");
11796
+ if (prev) {
11797
+ if (!isString(prev)) {
11798
+ for (const key in prev) {
11799
+ if (next[key] == null) {
11800
+ setStyle(style, key, "");
11801
+ }
11802
+ }
11803
+ } else {
11804
+ for (const prevStyle of prev.split(";")) {
11805
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11806
+ if (next[key] == null) {
11807
+ setStyle(style, key, "");
11808
+ }
11798
11809
  }
11799
11810
  }
11800
11811
  }
@@ -11818,9 +11829,11 @@ function patchStyle(el, prev, next) {
11818
11829
  el.removeAttribute("style");
11819
11830
  }
11820
11831
  }
11821
- if (vShowOldKey in el) {
11822
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11823
- style.display = currentDisplay;
11832
+ if (vShowOriginalDisplay in el) {
11833
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11834
+ if (el[vShowHidden]) {
11835
+ style.display = "none";
11836
+ }
11824
11837
  }
11825
11838
  }
11826
11839
  const semicolonRE = /[^\\];\s*$/;
@@ -11932,7 +11945,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
11932
11945
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11933
11946
  !tag.includes("-")) {
11934
11947
  el._value = value;
11935
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
11948
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11936
11949
  const newValue = value == null ? "" : value;
11937
11950
  if (oldValue !== newValue) {
11938
11951
  el.value = newValue;
@@ -12648,19 +12661,19 @@ const vModelSelect = {
12648
12661
  },
12649
12662
  // set value in mounted & updated because <select> relies on its children
12650
12663
  // <option>s.
12651
- mounted(el, { value, oldValue, modifiers: { number } }) {
12652
- setSelected(el, value, oldValue, number);
12664
+ mounted(el, { value, modifiers: { number } }) {
12665
+ setSelected(el, value, number);
12653
12666
  },
12654
12667
  beforeUpdate(el, _binding, vnode) {
12655
12668
  el[assignKey] = getModelAssigner(vnode);
12656
12669
  },
12657
- updated(el, { value, oldValue, modifiers: { number } }) {
12670
+ updated(el, { value, modifiers: { number } }) {
12658
12671
  if (!el._assigning) {
12659
- setSelected(el, value, oldValue, number);
12672
+ setSelected(el, value, number);
12660
12673
  }
12661
12674
  }
12662
12675
  };
12663
- function setSelected(el, value, oldValue, number) {
12676
+ function setSelected(el, value, number) {
12664
12677
  const isMultiple = el.multiple;
12665
12678
  const isArrayValue = isArray(value);
12666
12679
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12685,12 +12698,10 @@ function setSelected(el, value, oldValue, number) {
12685
12698
  } else {
12686
12699
  option.selected = value.has(optionValue);
12687
12700
  }
12688
- } else {
12689
- if (looseEqual(getValue(option), value)) {
12690
- if (el.selectedIndex !== i)
12691
- el.selectedIndex = i;
12692
- return;
12693
- }
12701
+ } else if (looseEqual(getValue(option), value)) {
12702
+ if (el.selectedIndex !== i)
12703
+ el.selectedIndex = i;
12704
+ return;
12694
12705
  }
12695
12706
  }
12696
12707
  if (!isMultiple && el.selectedIndex !== -1) {