@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
  **/
@@ -798,20 +798,20 @@ var Vue = (function () {
798
798
  return obj.hasOwnProperty(key);
799
799
  }
800
800
  class BaseReactiveHandler {
801
- constructor(_isReadonly = false, _shallow = false) {
801
+ constructor(_isReadonly = false, _isShallow = false) {
802
802
  this._isReadonly = _isReadonly;
803
- this._shallow = _shallow;
803
+ this._isShallow = _isShallow;
804
804
  }
805
805
  get(target, key, receiver) {
806
- const isReadonly2 = this._isReadonly, shallow = this._shallow;
806
+ const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
807
807
  if (key === "__v_isReactive") {
808
808
  return !isReadonly2;
809
809
  } else if (key === "__v_isReadonly") {
810
810
  return isReadonly2;
811
811
  } else if (key === "__v_isShallow") {
812
- return shallow;
812
+ return isShallow2;
813
813
  } else if (key === "__v_raw") {
814
- if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
814
+ if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
815
815
  // this means the reciever is a user proxy of the reactive proxy
816
816
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
817
817
  return target;
@@ -834,7 +834,7 @@ var Vue = (function () {
834
834
  if (!isReadonly2) {
835
835
  track(target, "get", key);
836
836
  }
837
- if (shallow) {
837
+ if (isShallow2) {
838
838
  return res;
839
839
  }
840
840
  if (isRef(res)) {
@@ -847,12 +847,12 @@ var Vue = (function () {
847
847
  }
848
848
  }
849
849
  class MutableReactiveHandler extends BaseReactiveHandler {
850
- constructor(shallow = false) {
851
- super(false, shallow);
850
+ constructor(isShallow2 = false) {
851
+ super(false, isShallow2);
852
852
  }
853
853
  set(target, key, value, receiver) {
854
854
  let oldValue = target[key];
855
- if (!this._shallow) {
855
+ if (!this._isShallow) {
856
856
  const isOldValueReadonly = isReadonly(oldValue);
857
857
  if (!isShallow(value) && !isReadonly(value)) {
858
858
  oldValue = toRaw(oldValue);
@@ -904,8 +904,8 @@ var Vue = (function () {
904
904
  }
905
905
  }
906
906
  class ReadonlyReactiveHandler extends BaseReactiveHandler {
907
- constructor(shallow = false) {
908
- super(true, shallow);
907
+ constructor(isShallow2 = false) {
908
+ super(true, isShallow2);
909
909
  }
910
910
  set(target, key) {
911
911
  {
@@ -1076,7 +1076,7 @@ var Vue = (function () {
1076
1076
  return function(...args) {
1077
1077
  {
1078
1078
  const key = args[0] ? `on key "${args[0]}" ` : ``;
1079
- console.warn(
1079
+ warn$2(
1080
1080
  `${capitalize(type)} operation ${key}failed: target is readonly.`,
1081
1081
  toRaw(this)
1082
1082
  );
@@ -1214,7 +1214,7 @@ var Vue = (function () {
1214
1214
  const rawKey = toRaw(key);
1215
1215
  if (rawKey !== key && has2.call(target, rawKey)) {
1216
1216
  const type = toRawType(target);
1217
- console.warn(
1217
+ warn$2(
1218
1218
  `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.`
1219
1219
  );
1220
1220
  }
@@ -1283,7 +1283,7 @@ var Vue = (function () {
1283
1283
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1284
1284
  if (!isObject(target)) {
1285
1285
  {
1286
- console.warn(`value cannot be made reactive: ${String(target)}`);
1286
+ warn$2(`value cannot be made reactive: ${String(target)}`);
1287
1287
  }
1288
1288
  return target;
1289
1289
  }
@@ -1333,8 +1333,10 @@ var Vue = (function () {
1333
1333
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1334
1334
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1335
1335
 
1336
+ 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`;
1336
1337
  class ComputedRefImpl {
1337
1338
  constructor(getter, _setter, isReadonly, isSSR) {
1339
+ this.getter = getter;
1338
1340
  this._setter = _setter;
1339
1341
  this.dep = void 0;
1340
1342
  this.__v_isRef = true;
@@ -1357,6 +1359,11 @@ var Vue = (function () {
1357
1359
  }
1358
1360
  trackRefValue(self);
1359
1361
  if (self.effect._dirtyLevel >= 2) {
1362
+ if (this._warnRecursive) {
1363
+ warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1364
+
1365
+ getter: `, this.getter);
1366
+ }
1360
1367
  triggerRefValue(self, 2);
1361
1368
  }
1362
1369
  return self._value;
@@ -1380,7 +1387,7 @@ var Vue = (function () {
1380
1387
  if (onlyGetter) {
1381
1388
  getter = getterOrOptions;
1382
1389
  setter = () => {
1383
- console.warn("Write operation failed: computed value is readonly");
1390
+ warn$2("Write operation failed: computed value is readonly");
1384
1391
  } ;
1385
1392
  } else {
1386
1393
  getter = getterOrOptions.get;
@@ -1512,7 +1519,7 @@ var Vue = (function () {
1512
1519
  }
1513
1520
  function toRefs(object) {
1514
1521
  if (!isProxy(object)) {
1515
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
1522
+ warn$2(`toRefs() expects a reactive object but received a plain one.`);
1516
1523
  }
1517
1524
  const ret = isArray(object) ? new Array(object.length) : {};
1518
1525
  for (const key in object) {
@@ -1754,13 +1761,11 @@ var Vue = (function () {
1754
1761
  [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1755
1762
  };
1756
1763
  function callWithErrorHandling(fn, instance, type, args) {
1757
- let res;
1758
1764
  try {
1759
- res = args ? fn(...args) : fn();
1765
+ return args ? fn(...args) : fn();
1760
1766
  } catch (err) {
1761
1767
  handleError(err, instance, type);
1762
1768
  }
1763
- return res;
1764
1769
  }
1765
1770
  function callWithAsyncErrorHandling(fn, instance, type, args) {
1766
1771
  if (isFunction(fn)) {
@@ -3286,6 +3291,8 @@ If this is a native custom element, make sure to exclude it from component resol
3286
3291
  } else {
3287
3292
  if (parentSuspense && parentSuspense.deps > 0) {
3288
3293
  n2.suspense = n1.suspense;
3294
+ n2.suspense.vnode = n2;
3295
+ n2.el = n1.el;
3289
3296
  return;
3290
3297
  }
3291
3298
  patchSuspense(
@@ -4263,7 +4270,6 @@ If this is a native custom element, make sure to exclude it from component resol
4263
4270
  setup(props, { slots }) {
4264
4271
  const instance = getCurrentInstance();
4265
4272
  const state = useTransitionState();
4266
- let prevTransitionKey;
4267
4273
  return () => {
4268
4274
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4269
4275
  if (!children || !children.length) {
@@ -4306,18 +4312,7 @@ If this is a native custom element, make sure to exclude it from component resol
4306
4312
  setTransitionHooks(innerChild, enterHooks);
4307
4313
  const oldChild = instance.subTree;
4308
4314
  const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4309
- let transitionKeyChanged = false;
4310
- const { getTransitionKey } = innerChild.type;
4311
- if (getTransitionKey) {
4312
- const key = getTransitionKey();
4313
- if (prevTransitionKey === void 0) {
4314
- prevTransitionKey = key;
4315
- } else if (key !== prevTransitionKey) {
4316
- prevTransitionKey = key;
4317
- transitionKeyChanged = true;
4318
- }
4319
- }
4320
- if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
4315
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4321
4316
  const leavingHooks = resolveTransitionHooks(
4322
4317
  oldInnerChild,
4323
4318
  rawProps,
@@ -6499,7 +6494,7 @@ If this is a native custom element, make sure to exclude it from component resol
6499
6494
  return vm;
6500
6495
  }
6501
6496
  }
6502
- Vue.version = `2.6.14-compat:${"3.4.18"}`;
6497
+ Vue.version = `2.6.14-compat:${"3.4.20"}`;
6503
6498
  Vue.config = singletonApp.config;
6504
6499
  Vue.use = (p, ...options) => {
6505
6500
  if (p && isFunction(p.install)) {
@@ -7444,8 +7439,16 @@ If you want to remount the same app, move your app creation logic into a factory
7444
7439
  return false;
7445
7440
  }
7446
7441
  function getType(ctor) {
7447
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7448
- return match ? match[2] : ctor === null ? "null" : "";
7442
+ if (ctor === null) {
7443
+ return "null";
7444
+ }
7445
+ if (typeof ctor === "function") {
7446
+ return ctor.name || "";
7447
+ } else if (typeof ctor === "object") {
7448
+ const name = ctor.constructor && ctor.constructor.name;
7449
+ return name || "";
7450
+ }
7451
+ return "";
7449
7452
  }
7450
7453
  function isSameType(a, b) {
7451
7454
  return getType(a) === getType(b);
@@ -8244,9 +8247,12 @@ Server rendered element contains fewer child nodes than client vdom.`
8244
8247
  }
8245
8248
  }
8246
8249
  }
8247
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8248
- for (const key2 in cssVars) {
8249
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
8250
+ const root = instance == null ? void 0 : instance.subTree;
8251
+ if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
8252
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8253
+ for (const key2 in cssVars) {
8254
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8255
+ }
8250
8256
  }
8251
8257
  if (!isMapEqual(actualMap, expectedMap)) {
8252
8258
  mismatchType = mismatchKey = "style";
@@ -10736,9 +10742,8 @@ Component that was made reactive: `,
10736
10742
  internalSetCurrentInstance(null);
10737
10743
  };
10738
10744
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10739
- function validateComponentName(name, config) {
10740
- const appIsNativeTag = config.isNativeTag || NO;
10741
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10745
+ function validateComponentName(name, { isNativeTag }) {
10746
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10742
10747
  warn$1(
10743
10748
  "Do not use built-in or reserved HTML elements as component id: " + name
10744
10749
  );
@@ -11043,7 +11048,14 @@ Component that was made reactive: `,
11043
11048
  }
11044
11049
 
11045
11050
  const computed = (getterOrOptions, debugOptions) => {
11046
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11051
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11052
+ {
11053
+ const i = getCurrentInstance();
11054
+ if (i && i.appContext.config.warnRecursiveComputed) {
11055
+ c._warnRecursive = true;
11056
+ }
11057
+ }
11058
+ return c;
11047
11059
  };
11048
11060
 
11049
11061
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11321,7 +11333,7 @@ Component that was made reactive: `,
11321
11333
  return true;
11322
11334
  }
11323
11335
 
11324
- const version = "3.4.18";
11336
+ const version = "3.4.20";
11325
11337
  const warn = warn$1 ;
11326
11338
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11327
11339
  const devtools = devtools$1 ;
@@ -11726,10 +11738,11 @@ Component that was made reactive: `,
11726
11738
  }
11727
11739
  }
11728
11740
 
11729
- const vShowOldKey = Symbol("_vod");
11741
+ const vShowOriginalDisplay = Symbol("_vod");
11742
+ const vShowHidden = Symbol("_vsh");
11730
11743
  const vShow = {
11731
11744
  beforeMount(el, { value }, { transition }) {
11732
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11745
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11733
11746
  if (transition && value) {
11734
11747
  transition.beforeEnter(el);
11735
11748
  } else {
@@ -11742,7 +11755,7 @@ Component that was made reactive: `,
11742
11755
  }
11743
11756
  },
11744
11757
  updated(el, { value, oldValue }, { transition }) {
11745
- if (!value === !oldValue && el.style.display === el[vShowOldKey])
11758
+ if (!value === !oldValue)
11746
11759
  return;
11747
11760
  if (transition) {
11748
11761
  if (value) {
@@ -11766,7 +11779,8 @@ Component that was made reactive: `,
11766
11779
  vShow.name = "show";
11767
11780
  }
11768
11781
  function setDisplay(el, value) {
11769
- el.style.display = value ? el[vShowOldKey] : "none";
11782
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11783
+ el[vShowHidden] = !value;
11770
11784
  }
11771
11785
 
11772
11786
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
@@ -11839,13 +11853,21 @@ Component that was made reactive: `,
11839
11853
  function patchStyle(el, prev, next) {
11840
11854
  const style = el.style;
11841
11855
  const isCssString = isString(next);
11842
- const currentDisplay = style.display;
11843
11856
  let hasControlledDisplay = false;
11844
11857
  if (next && !isCssString) {
11845
- if (prev && !isString(prev)) {
11846
- for (const key in prev) {
11847
- if (next[key] == null) {
11848
- setStyle(style, key, "");
11858
+ if (prev) {
11859
+ if (!isString(prev)) {
11860
+ for (const key in prev) {
11861
+ if (next[key] == null) {
11862
+ setStyle(style, key, "");
11863
+ }
11864
+ }
11865
+ } else {
11866
+ for (const prevStyle of prev.split(";")) {
11867
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11868
+ if (next[key] == null) {
11869
+ setStyle(style, key, "");
11870
+ }
11849
11871
  }
11850
11872
  }
11851
11873
  }
@@ -11869,9 +11891,11 @@ Component that was made reactive: `,
11869
11891
  el.removeAttribute("style");
11870
11892
  }
11871
11893
  }
11872
- if (vShowOldKey in el) {
11873
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11874
- style.display = currentDisplay;
11894
+ if (vShowOriginalDisplay in el) {
11895
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11896
+ if (el[vShowHidden]) {
11897
+ style.display = "none";
11898
+ }
11875
11899
  }
11876
11900
  }
11877
11901
  const semicolonRE = /[^\\];\s*$/;
@@ -11983,7 +12007,7 @@ Component that was made reactive: `,
11983
12007
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11984
12008
  !tag.includes("-")) {
11985
12009
  el._value = value;
11986
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
12010
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11987
12011
  const newValue = value == null ? "" : value;
11988
12012
  if (oldValue !== newValue) {
11989
12013
  el.value = newValue;
@@ -12687,19 +12711,19 @@ Component that was made reactive: `,
12687
12711
  },
12688
12712
  // set value in mounted & updated because <select> relies on its children
12689
12713
  // <option>s.
12690
- mounted(el, { value, oldValue, modifiers: { number } }) {
12691
- setSelected(el, value, oldValue, number);
12714
+ mounted(el, { value, modifiers: { number } }) {
12715
+ setSelected(el, value, number);
12692
12716
  },
12693
12717
  beforeUpdate(el, _binding, vnode) {
12694
12718
  el[assignKey] = getModelAssigner(vnode);
12695
12719
  },
12696
- updated(el, { value, oldValue, modifiers: { number } }) {
12720
+ updated(el, { value, modifiers: { number } }) {
12697
12721
  if (!el._assigning) {
12698
- setSelected(el, value, oldValue, number);
12722
+ setSelected(el, value, number);
12699
12723
  }
12700
12724
  }
12701
12725
  };
12702
- function setSelected(el, value, oldValue, number) {
12726
+ function setSelected(el, value, number) {
12703
12727
  const isMultiple = el.multiple;
12704
12728
  const isArrayValue = isArray(value);
12705
12729
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12724,12 +12748,10 @@ Component that was made reactive: `,
12724
12748
  } else {
12725
12749
  option.selected = value.has(optionValue);
12726
12750
  }
12727
- } else {
12728
- if (looseEqual(getValue(option), value)) {
12729
- if (el.selectedIndex !== i)
12730
- el.selectedIndex = i;
12731
- return;
12732
- }
12751
+ } else if (looseEqual(getValue(option), value)) {
12752
+ if (el.selectedIndex !== i)
12753
+ el.selectedIndex = i;
12754
+ return;
12733
12755
  }
12734
12756
  }
12735
12757
  if (!isMultiple && el.selectedIndex !== -1) {
@@ -13738,11 +13760,10 @@ Make sure to use the production build (*.prod.js) when deploying for production.
13738
13760
  } else if (this.inSFCRoot) {
13739
13761
  this.state = 34;
13740
13762
  } else if (!this.inXML) {
13741
- const lower = c | 32;
13742
- if (lower === 116) {
13763
+ if (c === 116) {
13743
13764
  this.state = 30;
13744
13765
  } else {
13745
- this.state = lower === 115 ? 29 : 6;
13766
+ this.state = c === 115 ? 29 : 6;
13746
13767
  }
13747
13768
  } else {
13748
13769
  this.state = 6;
@@ -14014,10 +14035,9 @@ Make sure to use the production build (*.prod.js) when deploying for production.
14014
14035
  }
14015
14036
  }
14016
14037
  stateBeforeSpecialS(c) {
14017
- const lower = c | 32;
14018
- if (lower === Sequences.ScriptEnd[3]) {
14038
+ if (c === Sequences.ScriptEnd[3]) {
14019
14039
  this.startSpecial(Sequences.ScriptEnd, 4);
14020
- } else if (lower === Sequences.StyleEnd[3]) {
14040
+ } else if (c === Sequences.StyleEnd[3]) {
14021
14041
  this.startSpecial(Sequences.StyleEnd, 4);
14022
14042
  } else {
14023
14043
  this.state = 6;
@@ -14025,10 +14045,9 @@ Make sure to use the production build (*.prod.js) when deploying for production.
14025
14045
  }
14026
14046
  }
14027
14047
  stateBeforeSpecialT(c) {
14028
- const lower = c | 32;
14029
- if (lower === Sequences.TitleEnd[3]) {
14048
+ if (c === Sequences.TitleEnd[3]) {
14030
14049
  this.startSpecial(Sequences.TitleEnd, 4);
14031
- } else if (lower === Sequences.TextareaEnd[3]) {
14050
+ } else if (c === Sequences.TextareaEnd[3]) {
14032
14051
  this.startSpecial(Sequences.TextareaEnd, 4);
14033
14052
  } else {
14034
14053
  this.state = 6;