@vue/compat 3.4.18 → 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.18
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
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -1008,7 +1008,7 @@ function createReadonlyMethod(type) {
1008
1008
  return function(...args) {
1009
1009
  if (!!(process.env.NODE_ENV !== "production")) {
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
  if (!!(process.env.NODE_ENV !== "production")) {
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
  }
@@ -1265,8 +1265,10 @@ function markRaw(value) {
1265
1265
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1266
1266
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1267
1267
 
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`;
1268
1269
  class ComputedRefImpl {
1269
1270
  constructor(getter, _setter, isReadonly, isSSR) {
1271
+ this.getter = getter;
1270
1272
  this._setter = _setter;
1271
1273
  this.dep = void 0;
1272
1274
  this.__v_isRef = true;
@@ -1289,6 +1291,11 @@ class ComputedRefImpl {
1289
1291
  }
1290
1292
  trackRefValue(self);
1291
1293
  if (self.effect._dirtyLevel >= 2) {
1294
+ if (!!(process.env.NODE_ENV !== "production") && this._warnRecursive) {
1295
+ warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1296
+
1297
+ getter: `, this.getter);
1298
+ }
1292
1299
  triggerRefValue(self, 2);
1293
1300
  }
1294
1301
  return self._value;
@@ -1312,7 +1319,7 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1312
1319
  if (onlyGetter) {
1313
1320
  getter = getterOrOptions;
1314
1321
  setter = !!(process.env.NODE_ENV !== "production") ? () => {
1315
- console.warn("Write operation failed: computed value is readonly");
1322
+ warn$2("Write operation failed: computed value is readonly");
1316
1323
  } : NOOP;
1317
1324
  } else {
1318
1325
  getter = getterOrOptions.get;
@@ -1444,7 +1451,7 @@ function customRef(factory) {
1444
1451
  }
1445
1452
  function toRefs(object) {
1446
1453
  if (!!(process.env.NODE_ENV !== "production") && !isProxy(object)) {
1447
- 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.`);
1448
1455
  }
1449
1456
  const ret = isArray(object) ? new Array(object.length) : {};
1450
1457
  for (const key in object) {
@@ -1688,13 +1695,11 @@ const ErrorTypeStrings$1 = {
1688
1695
  [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1689
1696
  };
1690
1697
  function callWithErrorHandling(fn, instance, type, args) {
1691
- let res;
1692
1698
  try {
1693
- res = args ? fn(...args) : fn();
1699
+ return args ? fn(...args) : fn();
1694
1700
  } catch (err) {
1695
1701
  handleError(err, instance, type);
1696
1702
  }
1697
- return res;
1698
1703
  }
1699
1704
  function callWithAsyncErrorHandling(fn, instance, type, args) {
1700
1705
  if (isFunction(fn)) {
@@ -3225,6 +3230,8 @@ const SuspenseImpl = {
3225
3230
  } else {
3226
3231
  if (parentSuspense && parentSuspense.deps > 0) {
3227
3232
  n2.suspense = n1.suspense;
3233
+ n2.suspense.vnode = n2;
3234
+ n2.el = n1.el;
3228
3235
  return;
3229
3236
  }
3230
3237
  patchSuspense(
@@ -4229,7 +4236,6 @@ const BaseTransitionImpl = {
4229
4236
  setup(props, { slots }) {
4230
4237
  const instance = getCurrentInstance();
4231
4238
  const state = useTransitionState();
4232
- let prevTransitionKey;
4233
4239
  return () => {
4234
4240
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4235
4241
  if (!children || !children.length) {
@@ -4274,18 +4280,7 @@ const BaseTransitionImpl = {
4274
4280
  setTransitionHooks(innerChild, enterHooks);
4275
4281
  const oldChild = instance.subTree;
4276
4282
  const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4277
- let transitionKeyChanged = false;
4278
- const { getTransitionKey } = innerChild.type;
4279
- if (getTransitionKey) {
4280
- const key = getTransitionKey();
4281
- if (prevTransitionKey === void 0) {
4282
- prevTransitionKey = key;
4283
- } else if (key !== prevTransitionKey) {
4284
- prevTransitionKey = key;
4285
- transitionKeyChanged = true;
4286
- }
4287
- }
4288
- if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
4283
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4289
4284
  const leavingHooks = resolveTransitionHooks(
4290
4285
  oldInnerChild,
4291
4286
  rawProps,
@@ -6475,7 +6470,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6475
6470
  return vm;
6476
6471
  }
6477
6472
  }
6478
- Vue.version = `2.6.14-compat:${"3.4.18"}`;
6473
+ Vue.version = `2.6.14-compat:${"3.4.20"}`;
6479
6474
  Vue.config = singletonApp.config;
6480
6475
  Vue.use = (p, ...options) => {
6481
6476
  if (p && isFunction(p.install)) {
@@ -7423,8 +7418,16 @@ function validatePropName(key) {
7423
7418
  return false;
7424
7419
  }
7425
7420
  function getType(ctor) {
7426
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7427
- return match ? match[2] : ctor === null ? "null" : "";
7421
+ if (ctor === null) {
7422
+ return "null";
7423
+ }
7424
+ if (typeof ctor === "function") {
7425
+ return ctor.name || "";
7426
+ } else if (typeof ctor === "object") {
7427
+ const name = ctor.constructor && ctor.constructor.name;
7428
+ return name || "";
7429
+ }
7430
+ return "";
7428
7431
  }
7429
7432
  function isSameType(a, b) {
7430
7433
  return getType(a) === getType(b);
@@ -8233,9 +8236,12 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
8233
8236
  }
8234
8237
  }
8235
8238
  }
8236
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8237
- for (const key2 in cssVars) {
8238
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
8239
+ const root = instance == null ? void 0 : instance.subTree;
8240
+ if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
8241
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8242
+ for (const key2 in cssVars) {
8243
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8244
+ }
8239
8245
  }
8240
8246
  if (!isMapEqual(actualMap, expectedMap)) {
8241
8247
  mismatchType = mismatchKey = "style";
@@ -10780,9 +10786,8 @@ const unsetCurrentInstance = () => {
10780
10786
  internalSetCurrentInstance(null);
10781
10787
  };
10782
10788
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10783
- function validateComponentName(name, config) {
10784
- const appIsNativeTag = config.isNativeTag || NO;
10785
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10789
+ function validateComponentName(name, { isNativeTag }) {
10790
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10786
10791
  warn$1(
10787
10792
  "Do not use built-in or reserved HTML elements as component id: " + name
10788
10793
  );
@@ -11103,7 +11108,14 @@ function isClassComponent(value) {
11103
11108
  }
11104
11109
 
11105
11110
  const computed = (getterOrOptions, debugOptions) => {
11106
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11111
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11112
+ if (!!(process.env.NODE_ENV !== "production")) {
11113
+ const i = getCurrentInstance();
11114
+ if (i && i.appContext.config.warnRecursiveComputed) {
11115
+ c._warnRecursive = true;
11116
+ }
11117
+ }
11118
+ return c;
11107
11119
  };
11108
11120
 
11109
11121
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11381,7 +11393,7 @@ function isMemoSame(cached, memo) {
11381
11393
  return true;
11382
11394
  }
11383
11395
 
11384
- const version = "3.4.18";
11396
+ const version = "3.4.20";
11385
11397
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11386
11398
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11387
11399
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -11794,10 +11806,11 @@ function patchClass(el, value, isSVG) {
11794
11806
  }
11795
11807
  }
11796
11808
 
11797
- const vShowOldKey = Symbol("_vod");
11809
+ const vShowOriginalDisplay = Symbol("_vod");
11810
+ const vShowHidden = Symbol("_vsh");
11798
11811
  const vShow = {
11799
11812
  beforeMount(el, { value }, { transition }) {
11800
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11813
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11801
11814
  if (transition && value) {
11802
11815
  transition.beforeEnter(el);
11803
11816
  } else {
@@ -11810,7 +11823,7 @@ const vShow = {
11810
11823
  }
11811
11824
  },
11812
11825
  updated(el, { value, oldValue }, { transition }) {
11813
- if (!value === !oldValue && el.style.display === el[vShowOldKey])
11826
+ if (!value === !oldValue)
11814
11827
  return;
11815
11828
  if (transition) {
11816
11829
  if (value) {
@@ -11834,7 +11847,8 @@ if (!!(process.env.NODE_ENV !== "production")) {
11834
11847
  vShow.name = "show";
11835
11848
  }
11836
11849
  function setDisplay(el, value) {
11837
- el.style.display = value ? el[vShowOldKey] : "none";
11850
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11851
+ el[vShowHidden] = !value;
11838
11852
  }
11839
11853
  function initVShowForSSR() {
11840
11854
  vShow.getSSRProps = ({ value }) => {
@@ -11914,13 +11928,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11914
11928
  function patchStyle(el, prev, next) {
11915
11929
  const style = el.style;
11916
11930
  const isCssString = isString(next);
11917
- const currentDisplay = style.display;
11918
11931
  let hasControlledDisplay = false;
11919
11932
  if (next && !isCssString) {
11920
- if (prev && !isString(prev)) {
11921
- for (const key in prev) {
11922
- if (next[key] == null) {
11923
- setStyle(style, key, "");
11933
+ if (prev) {
11934
+ if (!isString(prev)) {
11935
+ for (const key in prev) {
11936
+ if (next[key] == null) {
11937
+ setStyle(style, key, "");
11938
+ }
11939
+ }
11940
+ } else {
11941
+ for (const prevStyle of prev.split(";")) {
11942
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11943
+ if (next[key] == null) {
11944
+ setStyle(style, key, "");
11945
+ }
11924
11946
  }
11925
11947
  }
11926
11948
  }
@@ -11944,9 +11966,11 @@ function patchStyle(el, prev, next) {
11944
11966
  el.removeAttribute("style");
11945
11967
  }
11946
11968
  }
11947
- if (vShowOldKey in el) {
11948
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11949
- style.display = currentDisplay;
11969
+ if (vShowOriginalDisplay in el) {
11970
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11971
+ if (el[vShowHidden]) {
11972
+ style.display = "none";
11973
+ }
11950
11974
  }
11951
11975
  }
11952
11976
  const semicolonRE = /[^\\];\s*$/;
@@ -12058,7 +12082,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
12058
12082
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12059
12083
  !tag.includes("-")) {
12060
12084
  el._value = value;
12061
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
12085
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12062
12086
  const newValue = value == null ? "" : value;
12063
12087
  if (oldValue !== newValue) {
12064
12088
  el.value = newValue;
@@ -12774,19 +12798,19 @@ const vModelSelect = {
12774
12798
  },
12775
12799
  // set value in mounted & updated because <select> relies on its children
12776
12800
  // <option>s.
12777
- mounted(el, { value, oldValue, modifiers: { number } }) {
12778
- setSelected(el, value, oldValue, number);
12801
+ mounted(el, { value, modifiers: { number } }) {
12802
+ setSelected(el, value, number);
12779
12803
  },
12780
12804
  beforeUpdate(el, _binding, vnode) {
12781
12805
  el[assignKey] = getModelAssigner(vnode);
12782
12806
  },
12783
- updated(el, { value, oldValue, modifiers: { number } }) {
12807
+ updated(el, { value, modifiers: { number } }) {
12784
12808
  if (!el._assigning) {
12785
- setSelected(el, value, oldValue, number);
12809
+ setSelected(el, value, number);
12786
12810
  }
12787
12811
  }
12788
12812
  };
12789
- function setSelected(el, value, oldValue, number) {
12813
+ function setSelected(el, value, number) {
12790
12814
  const isMultiple = el.multiple;
12791
12815
  const isArrayValue = isArray(value);
12792
12816
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12811,12 +12835,10 @@ function setSelected(el, value, oldValue, number) {
12811
12835
  } else {
12812
12836
  option.selected = value.has(optionValue);
12813
12837
  }
12814
- } else {
12815
- if (looseEqual(getValue(option), value)) {
12816
- if (el.selectedIndex !== i)
12817
- el.selectedIndex = i;
12818
- return;
12819
- }
12838
+ } else if (looseEqual(getValue(option), value)) {
12839
+ if (el.selectedIndex !== i)
12840
+ el.selectedIndex = i;
12841
+ return;
12820
12842
  }
12821
12843
  }
12822
12844
  if (!isMultiple && el.selectedIndex !== -1) {