@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
  {
@@ -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
  }
@@ -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 (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 = () => {
1315
- console.warn("Write operation failed: computed value is readonly");
1322
+ warn$2("Write operation failed: computed value is readonly");
1316
1323
  } ;
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 (!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) {
@@ -1686,13 +1693,11 @@ const ErrorTypeStrings$1 = {
1686
1693
  [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1687
1694
  };
1688
1695
  function callWithErrorHandling(fn, instance, type, args) {
1689
- let res;
1690
1696
  try {
1691
- res = args ? fn(...args) : fn();
1697
+ return args ? fn(...args) : fn();
1692
1698
  } catch (err) {
1693
1699
  handleError(err, instance, type);
1694
1700
  }
1695
- return res;
1696
1701
  }
1697
1702
  function callWithAsyncErrorHandling(fn, instance, type, args) {
1698
1703
  if (isFunction(fn)) {
@@ -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.18"}`;
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)) {
@@ -7382,8 +7377,16 @@ function validatePropName(key) {
7382
7377
  return false;
7383
7378
  }
7384
7379
  function getType(ctor) {
7385
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7386
- return match ? match[2] : ctor === null ? "null" : "";
7380
+ if (ctor === null) {
7381
+ return "null";
7382
+ }
7383
+ if (typeof ctor === "function") {
7384
+ return ctor.name || "";
7385
+ } else if (typeof ctor === "object") {
7386
+ const name = ctor.constructor && ctor.constructor.name;
7387
+ return name || "";
7388
+ }
7389
+ return "";
7387
7390
  }
7388
7391
  function isSameType(a, b) {
7389
7392
  return getType(a) === getType(b);
@@ -8182,9 +8185,12 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
8182
8185
  }
8183
8186
  }
8184
8187
  }
8185
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8186
- for (const key2 in cssVars) {
8187
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
8188
+ const root = instance == null ? void 0 : instance.subTree;
8189
+ if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
8190
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8191
+ for (const key2 in cssVars) {
8192
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8193
+ }
8188
8194
  }
8189
8195
  if (!isMapEqual(actualMap, expectedMap)) {
8190
8196
  mismatchType = mismatchKey = "style";
@@ -10674,9 +10680,8 @@ const unsetCurrentInstance = () => {
10674
10680
  internalSetCurrentInstance(null);
10675
10681
  };
10676
10682
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10677
- function validateComponentName(name, config) {
10678
- const appIsNativeTag = config.isNativeTag || NO;
10679
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10683
+ function validateComponentName(name, { isNativeTag }) {
10684
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10680
10685
  warn$1(
10681
10686
  "Do not use built-in or reserved HTML elements as component id: " + name
10682
10687
  );
@@ -10981,7 +10986,14 @@ function isClassComponent(value) {
10981
10986
  }
10982
10987
 
10983
10988
  const computed = (getterOrOptions, debugOptions) => {
10984
- 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;
10985
10997
  };
10986
10998
 
10987
10999
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11259,7 +11271,7 @@ function isMemoSame(cached, memo) {
11259
11271
  return true;
11260
11272
  }
11261
11273
 
11262
- const version = "3.4.18";
11274
+ const version = "3.4.20";
11263
11275
  const warn = warn$1 ;
11264
11276
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11265
11277
  const devtools = devtools$1 ;
@@ -11664,10 +11676,11 @@ function patchClass(el, value, isSVG) {
11664
11676
  }
11665
11677
  }
11666
11678
 
11667
- const vShowOldKey = Symbol("_vod");
11679
+ const vShowOriginalDisplay = Symbol("_vod");
11680
+ const vShowHidden = Symbol("_vsh");
11668
11681
  const vShow = {
11669
11682
  beforeMount(el, { value }, { transition }) {
11670
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11683
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11671
11684
  if (transition && value) {
11672
11685
  transition.beforeEnter(el);
11673
11686
  } else {
@@ -11680,7 +11693,7 @@ const vShow = {
11680
11693
  }
11681
11694
  },
11682
11695
  updated(el, { value, oldValue }, { transition }) {
11683
- if (!value === !oldValue && el.style.display === el[vShowOldKey])
11696
+ if (!value === !oldValue)
11684
11697
  return;
11685
11698
  if (transition) {
11686
11699
  if (value) {
@@ -11704,7 +11717,8 @@ const vShow = {
11704
11717
  vShow.name = "show";
11705
11718
  }
11706
11719
  function setDisplay(el, value) {
11707
- el.style.display = value ? el[vShowOldKey] : "none";
11720
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11721
+ el[vShowHidden] = !value;
11708
11722
  }
11709
11723
 
11710
11724
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
@@ -11777,13 +11791,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11777
11791
  function patchStyle(el, prev, next) {
11778
11792
  const style = el.style;
11779
11793
  const isCssString = isString(next);
11780
- const currentDisplay = style.display;
11781
11794
  let hasControlledDisplay = false;
11782
11795
  if (next && !isCssString) {
11783
- if (prev && !isString(prev)) {
11784
- for (const key in prev) {
11785
- if (next[key] == null) {
11786
- 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
+ }
11787
11809
  }
11788
11810
  }
11789
11811
  }
@@ -11807,9 +11829,11 @@ function patchStyle(el, prev, next) {
11807
11829
  el.removeAttribute("style");
11808
11830
  }
11809
11831
  }
11810
- if (vShowOldKey in el) {
11811
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11812
- style.display = currentDisplay;
11832
+ if (vShowOriginalDisplay in el) {
11833
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11834
+ if (el[vShowHidden]) {
11835
+ style.display = "none";
11836
+ }
11813
11837
  }
11814
11838
  }
11815
11839
  const semicolonRE = /[^\\];\s*$/;
@@ -11921,7 +11945,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
11921
11945
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11922
11946
  !tag.includes("-")) {
11923
11947
  el._value = value;
11924
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
11948
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11925
11949
  const newValue = value == null ? "" : value;
11926
11950
  if (oldValue !== newValue) {
11927
11951
  el.value = newValue;
@@ -12637,19 +12661,19 @@ const vModelSelect = {
12637
12661
  },
12638
12662
  // set value in mounted & updated because <select> relies on its children
12639
12663
  // <option>s.
12640
- mounted(el, { value, oldValue, modifiers: { number } }) {
12641
- setSelected(el, value, oldValue, number);
12664
+ mounted(el, { value, modifiers: { number } }) {
12665
+ setSelected(el, value, number);
12642
12666
  },
12643
12667
  beforeUpdate(el, _binding, vnode) {
12644
12668
  el[assignKey] = getModelAssigner(vnode);
12645
12669
  },
12646
- updated(el, { value, oldValue, modifiers: { number } }) {
12670
+ updated(el, { value, modifiers: { number } }) {
12647
12671
  if (!el._assigning) {
12648
- setSelected(el, value, oldValue, number);
12672
+ setSelected(el, value, number);
12649
12673
  }
12650
12674
  }
12651
12675
  };
12652
- function setSelected(el, value, oldValue, number) {
12676
+ function setSelected(el, value, number) {
12653
12677
  const isMultiple = el.multiple;
12654
12678
  const isArrayValue = isArray(value);
12655
12679
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12674,12 +12698,10 @@ function setSelected(el, value, oldValue, number) {
12674
12698
  } else {
12675
12699
  option.selected = value.has(optionValue);
12676
12700
  }
12677
- } else {
12678
- if (looseEqual(getValue(option), value)) {
12679
- if (el.selectedIndex !== i)
12680
- el.selectedIndex = i;
12681
- return;
12682
- }
12701
+ } else if (looseEqual(getValue(option), value)) {
12702
+ if (el.selectedIndex !== i)
12703
+ el.selectedIndex = i;
12704
+ return;
12683
12705
  }
12684
12706
  }
12685
12707
  if (!isMultiple && el.selectedIndex !== -1) {