@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
  **/
@@ -733,20 +733,20 @@ var Vue = (function () {
733
733
  return obj.hasOwnProperty(key);
734
734
  }
735
735
  class BaseReactiveHandler {
736
- constructor(_isReadonly = false, _shallow = false) {
736
+ constructor(_isReadonly = false, _isShallow = false) {
737
737
  this._isReadonly = _isReadonly;
738
- this._shallow = _shallow;
738
+ this._isShallow = _isShallow;
739
739
  }
740
740
  get(target, key, receiver) {
741
- const isReadonly2 = this._isReadonly, shallow = this._shallow;
741
+ const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
742
742
  if (key === "__v_isReactive") {
743
743
  return !isReadonly2;
744
744
  } else if (key === "__v_isReadonly") {
745
745
  return isReadonly2;
746
746
  } else if (key === "__v_isShallow") {
747
- return shallow;
747
+ return isShallow2;
748
748
  } else if (key === "__v_raw") {
749
- if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
749
+ if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
750
750
  // this means the reciever is a user proxy of the reactive proxy
751
751
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
752
752
  return target;
@@ -769,7 +769,7 @@ var Vue = (function () {
769
769
  if (!isReadonly2) {
770
770
  track(target, "get", key);
771
771
  }
772
- if (shallow) {
772
+ if (isShallow2) {
773
773
  return res;
774
774
  }
775
775
  if (isRef(res)) {
@@ -782,12 +782,12 @@ var Vue = (function () {
782
782
  }
783
783
  }
784
784
  class MutableReactiveHandler extends BaseReactiveHandler {
785
- constructor(shallow = false) {
786
- super(false, shallow);
785
+ constructor(isShallow2 = false) {
786
+ super(false, isShallow2);
787
787
  }
788
788
  set(target, key, value, receiver) {
789
789
  let oldValue = target[key];
790
- if (!this._shallow) {
790
+ if (!this._isShallow) {
791
791
  const isOldValueReadonly = isReadonly(oldValue);
792
792
  if (!isShallow(value) && !isReadonly(value)) {
793
793
  oldValue = toRaw(oldValue);
@@ -839,8 +839,8 @@ var Vue = (function () {
839
839
  }
840
840
  }
841
841
  class ReadonlyReactiveHandler extends BaseReactiveHandler {
842
- constructor(shallow = false) {
843
- super(true, shallow);
842
+ constructor(isShallow2 = false) {
843
+ super(true, isShallow2);
844
844
  }
845
845
  set(target, key) {
846
846
  {
@@ -1011,7 +1011,7 @@ var Vue = (function () {
1011
1011
  return function(...args) {
1012
1012
  {
1013
1013
  const key = args[0] ? `on key "${args[0]}" ` : ``;
1014
- console.warn(
1014
+ warn$2(
1015
1015
  `${capitalize(type)} operation ${key}failed: target is readonly.`,
1016
1016
  toRaw(this)
1017
1017
  );
@@ -1149,7 +1149,7 @@ var Vue = (function () {
1149
1149
  const rawKey = toRaw(key);
1150
1150
  if (rawKey !== key && has2.call(target, rawKey)) {
1151
1151
  const type = toRawType(target);
1152
- console.warn(
1152
+ warn$2(
1153
1153
  `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.`
1154
1154
  );
1155
1155
  }
@@ -1218,7 +1218,7 @@ var Vue = (function () {
1218
1218
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1219
1219
  if (!isObject(target)) {
1220
1220
  {
1221
- console.warn(`value cannot be made reactive: ${String(target)}`);
1221
+ warn$2(`value cannot be made reactive: ${String(target)}`);
1222
1222
  }
1223
1223
  return target;
1224
1224
  }
@@ -1268,8 +1268,10 @@ var Vue = (function () {
1268
1268
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1269
1269
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1270
1270
 
1271
+ 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`;
1271
1272
  class ComputedRefImpl {
1272
1273
  constructor(getter, _setter, isReadonly, isSSR) {
1274
+ this.getter = getter;
1273
1275
  this._setter = _setter;
1274
1276
  this.dep = void 0;
1275
1277
  this.__v_isRef = true;
@@ -1292,6 +1294,11 @@ var Vue = (function () {
1292
1294
  }
1293
1295
  trackRefValue(self);
1294
1296
  if (self.effect._dirtyLevel >= 2) {
1297
+ if (this._warnRecursive) {
1298
+ warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1299
+
1300
+ getter: `, this.getter);
1301
+ }
1295
1302
  triggerRefValue(self, 2);
1296
1303
  }
1297
1304
  return self._value;
@@ -1315,7 +1322,7 @@ var Vue = (function () {
1315
1322
  if (onlyGetter) {
1316
1323
  getter = getterOrOptions;
1317
1324
  setter = () => {
1318
- console.warn("Write operation failed: computed value is readonly");
1325
+ warn$2("Write operation failed: computed value is readonly");
1319
1326
  } ;
1320
1327
  } else {
1321
1328
  getter = getterOrOptions.get;
@@ -1447,7 +1454,7 @@ var Vue = (function () {
1447
1454
  }
1448
1455
  function toRefs(object) {
1449
1456
  if (!isProxy(object)) {
1450
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
1457
+ warn$2(`toRefs() expects a reactive object but received a plain one.`);
1451
1458
  }
1452
1459
  const ret = isArray(object) ? new Array(object.length) : {};
1453
1460
  for (const key in object) {
@@ -1689,13 +1696,11 @@ var Vue = (function () {
1689
1696
  [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1690
1697
  };
1691
1698
  function callWithErrorHandling(fn, instance, type, args) {
1692
- let res;
1693
1699
  try {
1694
- res = args ? fn(...args) : fn();
1700
+ return args ? fn(...args) : fn();
1695
1701
  } catch (err) {
1696
1702
  handleError(err, instance, type);
1697
1703
  }
1698
- return res;
1699
1704
  }
1700
1705
  function callWithAsyncErrorHandling(fn, instance, type, args) {
1701
1706
  if (isFunction(fn)) {
@@ -3221,6 +3226,8 @@ If this is a native custom element, make sure to exclude it from component resol
3221
3226
  } else {
3222
3227
  if (parentSuspense && parentSuspense.deps > 0) {
3223
3228
  n2.suspense = n1.suspense;
3229
+ n2.suspense.vnode = n2;
3230
+ n2.el = n1.el;
3224
3231
  return;
3225
3232
  }
3226
3233
  patchSuspense(
@@ -4198,7 +4205,6 @@ If this is a native custom element, make sure to exclude it from component resol
4198
4205
  setup(props, { slots }) {
4199
4206
  const instance = getCurrentInstance();
4200
4207
  const state = useTransitionState();
4201
- let prevTransitionKey;
4202
4208
  return () => {
4203
4209
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4204
4210
  if (!children || !children.length) {
@@ -4241,18 +4247,7 @@ If this is a native custom element, make sure to exclude it from component resol
4241
4247
  setTransitionHooks(innerChild, enterHooks);
4242
4248
  const oldChild = instance.subTree;
4243
4249
  const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4244
- let transitionKeyChanged = false;
4245
- const { getTransitionKey } = innerChild.type;
4246
- if (getTransitionKey) {
4247
- const key = getTransitionKey();
4248
- if (prevTransitionKey === void 0) {
4249
- prevTransitionKey = key;
4250
- } else if (key !== prevTransitionKey) {
4251
- prevTransitionKey = key;
4252
- transitionKeyChanged = true;
4253
- }
4254
- }
4255
- if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
4250
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4256
4251
  const leavingHooks = resolveTransitionHooks(
4257
4252
  oldInnerChild,
4258
4253
  rawProps,
@@ -6434,7 +6429,7 @@ If this is a native custom element, make sure to exclude it from component resol
6434
6429
  return vm;
6435
6430
  }
6436
6431
  }
6437
- Vue.version = `2.6.14-compat:${"3.4.18"}`;
6432
+ Vue.version = `2.6.14-compat:${"3.4.20"}`;
6438
6433
  Vue.config = singletonApp.config;
6439
6434
  Vue.use = (p, ...options) => {
6440
6435
  if (p && isFunction(p.install)) {
@@ -7379,8 +7374,16 @@ If you want to remount the same app, move your app creation logic into a factory
7379
7374
  return false;
7380
7375
  }
7381
7376
  function getType(ctor) {
7382
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7383
- return match ? match[2] : ctor === null ? "null" : "";
7377
+ if (ctor === null) {
7378
+ return "null";
7379
+ }
7380
+ if (typeof ctor === "function") {
7381
+ return ctor.name || "";
7382
+ } else if (typeof ctor === "object") {
7383
+ const name = ctor.constructor && ctor.constructor.name;
7384
+ return name || "";
7385
+ }
7386
+ return "";
7384
7387
  }
7385
7388
  function isSameType(a, b) {
7386
7389
  return getType(a) === getType(b);
@@ -8179,9 +8182,12 @@ Server rendered element contains fewer child nodes than client vdom.`
8179
8182
  }
8180
8183
  }
8181
8184
  }
8182
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8183
- for (const key2 in cssVars) {
8184
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
8185
+ const root = instance == null ? void 0 : instance.subTree;
8186
+ if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
8187
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8188
+ for (const key2 in cssVars) {
8189
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8190
+ }
8185
8191
  }
8186
8192
  if (!isMapEqual(actualMap, expectedMap)) {
8187
8193
  mismatchType = mismatchKey = "style";
@@ -10671,9 +10677,8 @@ Component that was made reactive: `,
10671
10677
  internalSetCurrentInstance(null);
10672
10678
  };
10673
10679
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10674
- function validateComponentName(name, config) {
10675
- const appIsNativeTag = config.isNativeTag || NO;
10676
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10680
+ function validateComponentName(name, { isNativeTag }) {
10681
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10677
10682
  warn$1(
10678
10683
  "Do not use built-in or reserved HTML elements as component id: " + name
10679
10684
  );
@@ -10978,7 +10983,14 @@ Component that was made reactive: `,
10978
10983
  }
10979
10984
 
10980
10985
  const computed = (getterOrOptions, debugOptions) => {
10981
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10986
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10987
+ {
10988
+ const i = getCurrentInstance();
10989
+ if (i && i.appContext.config.warnRecursiveComputed) {
10990
+ c._warnRecursive = true;
10991
+ }
10992
+ }
10993
+ return c;
10982
10994
  };
10983
10995
 
10984
10996
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11256,7 +11268,7 @@ Component that was made reactive: `,
11256
11268
  return true;
11257
11269
  }
11258
11270
 
11259
- const version = "3.4.18";
11271
+ const version = "3.4.20";
11260
11272
  const warn = warn$1 ;
11261
11273
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11262
11274
  const devtools = devtools$1 ;
@@ -11661,10 +11673,11 @@ Component that was made reactive: `,
11661
11673
  }
11662
11674
  }
11663
11675
 
11664
- const vShowOldKey = Symbol("_vod");
11676
+ const vShowOriginalDisplay = Symbol("_vod");
11677
+ const vShowHidden = Symbol("_vsh");
11665
11678
  const vShow = {
11666
11679
  beforeMount(el, { value }, { transition }) {
11667
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11680
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11668
11681
  if (transition && value) {
11669
11682
  transition.beforeEnter(el);
11670
11683
  } else {
@@ -11677,7 +11690,7 @@ Component that was made reactive: `,
11677
11690
  }
11678
11691
  },
11679
11692
  updated(el, { value, oldValue }, { transition }) {
11680
- if (!value === !oldValue && el.style.display === el[vShowOldKey])
11693
+ if (!value === !oldValue)
11681
11694
  return;
11682
11695
  if (transition) {
11683
11696
  if (value) {
@@ -11701,7 +11714,8 @@ Component that was made reactive: `,
11701
11714
  vShow.name = "show";
11702
11715
  }
11703
11716
  function setDisplay(el, value) {
11704
- el.style.display = value ? el[vShowOldKey] : "none";
11717
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11718
+ el[vShowHidden] = !value;
11705
11719
  }
11706
11720
 
11707
11721
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
@@ -11774,13 +11788,21 @@ Component that was made reactive: `,
11774
11788
  function patchStyle(el, prev, next) {
11775
11789
  const style = el.style;
11776
11790
  const isCssString = isString(next);
11777
- const currentDisplay = style.display;
11778
11791
  let hasControlledDisplay = false;
11779
11792
  if (next && !isCssString) {
11780
- if (prev && !isString(prev)) {
11781
- for (const key in prev) {
11782
- if (next[key] == null) {
11783
- setStyle(style, key, "");
11793
+ if (prev) {
11794
+ if (!isString(prev)) {
11795
+ for (const key in prev) {
11796
+ if (next[key] == null) {
11797
+ setStyle(style, key, "");
11798
+ }
11799
+ }
11800
+ } else {
11801
+ for (const prevStyle of prev.split(";")) {
11802
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11803
+ if (next[key] == null) {
11804
+ setStyle(style, key, "");
11805
+ }
11784
11806
  }
11785
11807
  }
11786
11808
  }
@@ -11804,9 +11826,11 @@ Component that was made reactive: `,
11804
11826
  el.removeAttribute("style");
11805
11827
  }
11806
11828
  }
11807
- if (vShowOldKey in el) {
11808
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11809
- style.display = currentDisplay;
11829
+ if (vShowOriginalDisplay in el) {
11830
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11831
+ if (el[vShowHidden]) {
11832
+ style.display = "none";
11833
+ }
11810
11834
  }
11811
11835
  }
11812
11836
  const semicolonRE = /[^\\];\s*$/;
@@ -11918,7 +11942,7 @@ Component that was made reactive: `,
11918
11942
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11919
11943
  !tag.includes("-")) {
11920
11944
  el._value = value;
11921
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
11945
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11922
11946
  const newValue = value == null ? "" : value;
11923
11947
  if (oldValue !== newValue) {
11924
11948
  el.value = newValue;
@@ -12622,19 +12646,19 @@ Component that was made reactive: `,
12622
12646
  },
12623
12647
  // set value in mounted & updated because <select> relies on its children
12624
12648
  // <option>s.
12625
- mounted(el, { value, oldValue, modifiers: { number } }) {
12626
- setSelected(el, value, oldValue, number);
12649
+ mounted(el, { value, modifiers: { number } }) {
12650
+ setSelected(el, value, number);
12627
12651
  },
12628
12652
  beforeUpdate(el, _binding, vnode) {
12629
12653
  el[assignKey] = getModelAssigner(vnode);
12630
12654
  },
12631
- updated(el, { value, oldValue, modifiers: { number } }) {
12655
+ updated(el, { value, modifiers: { number } }) {
12632
12656
  if (!el._assigning) {
12633
- setSelected(el, value, oldValue, number);
12657
+ setSelected(el, value, number);
12634
12658
  }
12635
12659
  }
12636
12660
  };
12637
- function setSelected(el, value, oldValue, number) {
12661
+ function setSelected(el, value, number) {
12638
12662
  const isMultiple = el.multiple;
12639
12663
  const isArrayValue = isArray(value);
12640
12664
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12659,12 +12683,10 @@ Component that was made reactive: `,
12659
12683
  } else {
12660
12684
  option.selected = value.has(optionValue);
12661
12685
  }
12662
- } else {
12663
- if (looseEqual(getValue(option), value)) {
12664
- if (el.selectedIndex !== i)
12665
- el.selectedIndex = i;
12666
- return;
12667
- }
12686
+ } else if (looseEqual(getValue(option), value)) {
12687
+ if (el.selectedIndex !== i)
12688
+ el.selectedIndex = i;
12689
+ return;
12668
12690
  }
12669
12691
  }
12670
12692
  if (!isMultiple && el.selectedIndex !== -1) {