@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -846,20 +846,20 @@ function hasOwnProperty(key) {
846
846
  return obj.hasOwnProperty(key);
847
847
  }
848
848
  class BaseReactiveHandler {
849
- constructor(_isReadonly = false, _shallow = false) {
849
+ constructor(_isReadonly = false, _isShallow = false) {
850
850
  this._isReadonly = _isReadonly;
851
- this._shallow = _shallow;
851
+ this._isShallow = _isShallow;
852
852
  }
853
853
  get(target, key, receiver) {
854
- const isReadonly2 = this._isReadonly, shallow = this._shallow;
854
+ const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
855
855
  if (key === "__v_isReactive") {
856
856
  return !isReadonly2;
857
857
  } else if (key === "__v_isReadonly") {
858
858
  return isReadonly2;
859
859
  } else if (key === "__v_isShallow") {
860
- return shallow;
860
+ return isShallow2;
861
861
  } else if (key === "__v_raw") {
862
- if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
862
+ if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
863
863
  // this means the reciever is a user proxy of the reactive proxy
864
864
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
865
865
  return target;
@@ -882,7 +882,7 @@ class BaseReactiveHandler {
882
882
  if (!isReadonly2) {
883
883
  track(target, "get", key);
884
884
  }
885
- if (shallow) {
885
+ if (isShallow2) {
886
886
  return res;
887
887
  }
888
888
  if (isRef(res)) {
@@ -895,12 +895,12 @@ class BaseReactiveHandler {
895
895
  }
896
896
  }
897
897
  class MutableReactiveHandler extends BaseReactiveHandler {
898
- constructor(shallow = false) {
899
- super(false, shallow);
898
+ constructor(isShallow2 = false) {
899
+ super(false, isShallow2);
900
900
  }
901
901
  set(target, key, value, receiver) {
902
902
  let oldValue = target[key];
903
- if (!this._shallow) {
903
+ if (!this._isShallow) {
904
904
  const isOldValueReadonly = isReadonly(oldValue);
905
905
  if (!isShallow(value) && !isReadonly(value)) {
906
906
  oldValue = toRaw(oldValue);
@@ -952,8 +952,8 @@ class MutableReactiveHandler extends BaseReactiveHandler {
952
952
  }
953
953
  }
954
954
  class ReadonlyReactiveHandler extends BaseReactiveHandler {
955
- constructor(shallow = false) {
956
- super(true, shallow);
955
+ constructor(isShallow2 = false) {
956
+ super(true, isShallow2);
957
957
  }
958
958
  set(target, key) {
959
959
  {
@@ -1124,7 +1124,7 @@ function createReadonlyMethod(type) {
1124
1124
  return function(...args) {
1125
1125
  {
1126
1126
  const key = args[0] ? `on key "${args[0]}" ` : ``;
1127
- console.warn(
1127
+ warn$2(
1128
1128
  `${capitalize(type)} operation ${key}failed: target is readonly.`,
1129
1129
  toRaw(this)
1130
1130
  );
@@ -1262,7 +1262,7 @@ function checkIdentityKeys(target, has2, key) {
1262
1262
  const rawKey = toRaw(key);
1263
1263
  if (rawKey !== key && has2.call(target, rawKey)) {
1264
1264
  const type = toRawType(target);
1265
- console.warn(
1265
+ warn$2(
1266
1266
  `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.`
1267
1267
  );
1268
1268
  }
@@ -1331,7 +1331,7 @@ function shallowReadonly(target) {
1331
1331
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1332
1332
  if (!isObject(target)) {
1333
1333
  {
1334
- console.warn(`value cannot be made reactive: ${String(target)}`);
1334
+ warn$2(`value cannot be made reactive: ${String(target)}`);
1335
1335
  }
1336
1336
  return target;
1337
1337
  }
@@ -1381,8 +1381,10 @@ function markRaw(value) {
1381
1381
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1382
1382
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1383
1383
 
1384
+ 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`;
1384
1385
  class ComputedRefImpl {
1385
1386
  constructor(getter, _setter, isReadonly, isSSR) {
1387
+ this.getter = getter;
1386
1388
  this._setter = _setter;
1387
1389
  this.dep = void 0;
1388
1390
  this.__v_isRef = true;
@@ -1405,6 +1407,11 @@ class ComputedRefImpl {
1405
1407
  }
1406
1408
  trackRefValue(self);
1407
1409
  if (self.effect._dirtyLevel >= 2) {
1410
+ if (this._warnRecursive) {
1411
+ warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1412
+
1413
+ getter: `, this.getter);
1414
+ }
1408
1415
  triggerRefValue(self, 2);
1409
1416
  }
1410
1417
  return self._value;
@@ -1428,7 +1435,7 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1428
1435
  if (onlyGetter) {
1429
1436
  getter = getterOrOptions;
1430
1437
  setter = () => {
1431
- console.warn("Write operation failed: computed value is readonly");
1438
+ warn$2("Write operation failed: computed value is readonly");
1432
1439
  } ;
1433
1440
  } else {
1434
1441
  getter = getterOrOptions.get;
@@ -1560,7 +1567,7 @@ function customRef(factory) {
1560
1567
  }
1561
1568
  function toRefs(object) {
1562
1569
  if (!isProxy(object)) {
1563
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
1570
+ warn$2(`toRefs() expects a reactive object but received a plain one.`);
1564
1571
  }
1565
1572
  const ret = isArray(object) ? new Array(object.length) : {};
1566
1573
  for (const key in object) {
@@ -1802,13 +1809,11 @@ const ErrorTypeStrings$1 = {
1802
1809
  [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1803
1810
  };
1804
1811
  function callWithErrorHandling(fn, instance, type, args) {
1805
- let res;
1806
1812
  try {
1807
- res = args ? fn(...args) : fn();
1813
+ return args ? fn(...args) : fn();
1808
1814
  } catch (err) {
1809
1815
  handleError(err, instance, type);
1810
1816
  }
1811
- return res;
1812
1817
  }
1813
1818
  function callWithAsyncErrorHandling(fn, instance, type, args) {
1814
1819
  if (isFunction(fn)) {
@@ -3334,6 +3339,8 @@ const SuspenseImpl = {
3334
3339
  } else {
3335
3340
  if (parentSuspense && parentSuspense.deps > 0) {
3336
3341
  n2.suspense = n1.suspense;
3342
+ n2.suspense.vnode = n2;
3343
+ n2.el = n1.el;
3337
3344
  return;
3338
3345
  }
3339
3346
  patchSuspense(
@@ -4338,7 +4345,6 @@ const BaseTransitionImpl = {
4338
4345
  setup(props, { slots }) {
4339
4346
  const instance = getCurrentInstance();
4340
4347
  const state = useTransitionState();
4341
- let prevTransitionKey;
4342
4348
  return () => {
4343
4349
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4344
4350
  if (!children || !children.length) {
@@ -4381,18 +4387,7 @@ const BaseTransitionImpl = {
4381
4387
  setTransitionHooks(innerChild, enterHooks);
4382
4388
  const oldChild = instance.subTree;
4383
4389
  const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4384
- let transitionKeyChanged = false;
4385
- const { getTransitionKey } = innerChild.type;
4386
- if (getTransitionKey) {
4387
- const key = getTransitionKey();
4388
- if (prevTransitionKey === void 0) {
4389
- prevTransitionKey = key;
4390
- } else if (key !== prevTransitionKey) {
4391
- prevTransitionKey = key;
4392
- transitionKeyChanged = true;
4393
- }
4394
- }
4395
- if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
4390
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4396
4391
  const leavingHooks = resolveTransitionHooks(
4397
4392
  oldInnerChild,
4398
4393
  rawProps,
@@ -6580,7 +6575,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6580
6575
  return vm;
6581
6576
  }
6582
6577
  }
6583
- Vue.version = `2.6.14-compat:${"3.4.18"}`;
6578
+ Vue.version = `2.6.14-compat:${"3.4.20"}`;
6584
6579
  Vue.config = singletonApp.config;
6585
6580
  Vue.use = (p, ...options) => {
6586
6581
  if (p && isFunction(p.install)) {
@@ -7525,8 +7520,16 @@ function validatePropName(key) {
7525
7520
  return false;
7526
7521
  }
7527
7522
  function getType(ctor) {
7528
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7529
- return match ? match[2] : ctor === null ? "null" : "";
7523
+ if (ctor === null) {
7524
+ return "null";
7525
+ }
7526
+ if (typeof ctor === "function") {
7527
+ return ctor.name || "";
7528
+ } else if (typeof ctor === "object") {
7529
+ const name = ctor.constructor && ctor.constructor.name;
7530
+ return name || "";
7531
+ }
7532
+ return "";
7530
7533
  }
7531
7534
  function isSameType(a, b) {
7532
7535
  return getType(a) === getType(b);
@@ -8325,9 +8328,12 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
8325
8328
  }
8326
8329
  }
8327
8330
  }
8328
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8329
- for (const key2 in cssVars) {
8330
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
8331
+ const root = instance == null ? void 0 : instance.subTree;
8332
+ if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
8333
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8334
+ for (const key2 in cssVars) {
8335
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8336
+ }
8331
8337
  }
8332
8338
  if (!isMapEqual(actualMap, expectedMap)) {
8333
8339
  mismatchType = mismatchKey = "style";
@@ -10832,9 +10838,8 @@ const unsetCurrentInstance = () => {
10832
10838
  internalSetCurrentInstance(null);
10833
10839
  };
10834
10840
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10835
- function validateComponentName(name, config) {
10836
- const appIsNativeTag = config.isNativeTag || NO;
10837
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10841
+ function validateComponentName(name, { isNativeTag }) {
10842
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10838
10843
  warn$1(
10839
10844
  "Do not use built-in or reserved HTML elements as component id: " + name
10840
10845
  );
@@ -11141,7 +11146,14 @@ function isClassComponent(value) {
11141
11146
  }
11142
11147
 
11143
11148
  const computed = (getterOrOptions, debugOptions) => {
11144
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11149
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11150
+ {
11151
+ const i = getCurrentInstance();
11152
+ if (i && i.appContext.config.warnRecursiveComputed) {
11153
+ c._warnRecursive = true;
11154
+ }
11155
+ }
11156
+ return c;
11145
11157
  };
11146
11158
 
11147
11159
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11419,7 +11431,7 @@ function isMemoSame(cached, memo) {
11419
11431
  return true;
11420
11432
  }
11421
11433
 
11422
- const version = "3.4.18";
11434
+ const version = "3.4.20";
11423
11435
  const warn = warn$1 ;
11424
11436
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11425
11437
  const devtools = devtools$1 ;
@@ -11832,10 +11844,11 @@ function patchClass(el, value, isSVG) {
11832
11844
  }
11833
11845
  }
11834
11846
 
11835
- const vShowOldKey = Symbol("_vod");
11847
+ const vShowOriginalDisplay = Symbol("_vod");
11848
+ const vShowHidden = Symbol("_vsh");
11836
11849
  const vShow = {
11837
11850
  beforeMount(el, { value }, { transition }) {
11838
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11851
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11839
11852
  if (transition && value) {
11840
11853
  transition.beforeEnter(el);
11841
11854
  } else {
@@ -11848,7 +11861,7 @@ const vShow = {
11848
11861
  }
11849
11862
  },
11850
11863
  updated(el, { value, oldValue }, { transition }) {
11851
- if (!value === !oldValue && el.style.display === el[vShowOldKey])
11864
+ if (!value === !oldValue)
11852
11865
  return;
11853
11866
  if (transition) {
11854
11867
  if (value) {
@@ -11872,7 +11885,8 @@ const vShow = {
11872
11885
  vShow.name = "show";
11873
11886
  }
11874
11887
  function setDisplay(el, value) {
11875
- el.style.display = value ? el[vShowOldKey] : "none";
11888
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11889
+ el[vShowHidden] = !value;
11876
11890
  }
11877
11891
  function initVShowForSSR() {
11878
11892
  vShow.getSSRProps = ({ value }) => {
@@ -11891,13 +11905,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11891
11905
  function patchStyle(el, prev, next) {
11892
11906
  const style = el.style;
11893
11907
  const isCssString = isString(next);
11894
- const currentDisplay = style.display;
11895
11908
  let hasControlledDisplay = false;
11896
11909
  if (next && !isCssString) {
11897
- if (prev && !isString(prev)) {
11898
- for (const key in prev) {
11899
- if (next[key] == null) {
11900
- setStyle(style, key, "");
11910
+ if (prev) {
11911
+ if (!isString(prev)) {
11912
+ for (const key in prev) {
11913
+ if (next[key] == null) {
11914
+ setStyle(style, key, "");
11915
+ }
11916
+ }
11917
+ } else {
11918
+ for (const prevStyle of prev.split(";")) {
11919
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11920
+ if (next[key] == null) {
11921
+ setStyle(style, key, "");
11922
+ }
11901
11923
  }
11902
11924
  }
11903
11925
  }
@@ -11921,9 +11943,11 @@ function patchStyle(el, prev, next) {
11921
11943
  el.removeAttribute("style");
11922
11944
  }
11923
11945
  }
11924
- if (vShowOldKey in el) {
11925
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11926
- style.display = currentDisplay;
11946
+ if (vShowOriginalDisplay in el) {
11947
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11948
+ if (el[vShowHidden]) {
11949
+ style.display = "none";
11950
+ }
11927
11951
  }
11928
11952
  }
11929
11953
  const semicolonRE = /[^\\];\s*$/;
@@ -12035,7 +12059,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
12035
12059
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12036
12060
  !tag.includes("-")) {
12037
12061
  el._value = value;
12038
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
12062
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12039
12063
  const newValue = value == null ? "" : value;
12040
12064
  if (oldValue !== newValue) {
12041
12065
  el.value = newValue;
@@ -12751,19 +12775,19 @@ const vModelSelect = {
12751
12775
  },
12752
12776
  // set value in mounted & updated because <select> relies on its children
12753
12777
  // <option>s.
12754
- mounted(el, { value, oldValue, modifiers: { number } }) {
12755
- setSelected(el, value, oldValue, number);
12778
+ mounted(el, { value, modifiers: { number } }) {
12779
+ setSelected(el, value, number);
12756
12780
  },
12757
12781
  beforeUpdate(el, _binding, vnode) {
12758
12782
  el[assignKey] = getModelAssigner(vnode);
12759
12783
  },
12760
- updated(el, { value, oldValue, modifiers: { number } }) {
12784
+ updated(el, { value, modifiers: { number } }) {
12761
12785
  if (!el._assigning) {
12762
- setSelected(el, value, oldValue, number);
12786
+ setSelected(el, value, number);
12763
12787
  }
12764
12788
  }
12765
12789
  };
12766
- function setSelected(el, value, oldValue, number) {
12790
+ function setSelected(el, value, number) {
12767
12791
  const isMultiple = el.multiple;
12768
12792
  const isArrayValue = isArray(value);
12769
12793
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12788,12 +12812,10 @@ function setSelected(el, value, oldValue, number) {
12788
12812
  } else {
12789
12813
  option.selected = value.has(optionValue);
12790
12814
  }
12791
- } else {
12792
- if (looseEqual(getValue(option), value)) {
12793
- if (el.selectedIndex !== i)
12794
- el.selectedIndex = i;
12795
- return;
12796
- }
12815
+ } else if (looseEqual(getValue(option), value)) {
12816
+ if (el.selectedIndex !== i)
12817
+ el.selectedIndex = i;
12818
+ return;
12797
12819
  }
12798
12820
  }
12799
12821
  if (!isMultiple && el.selectedIndex !== -1) {
@@ -13838,11 +13860,10 @@ class Tokenizer {
13838
13860
  } else if (this.inSFCRoot) {
13839
13861
  this.state = 34;
13840
13862
  } else if (!this.inXML) {
13841
- const lower = c | 32;
13842
- if (lower === 116) {
13863
+ if (c === 116) {
13843
13864
  this.state = 30;
13844
13865
  } else {
13845
- this.state = lower === 115 ? 29 : 6;
13866
+ this.state = c === 115 ? 29 : 6;
13846
13867
  }
13847
13868
  } else {
13848
13869
  this.state = 6;
@@ -14118,10 +14139,9 @@ class Tokenizer {
14118
14139
  }
14119
14140
  }
14120
14141
  stateBeforeSpecialS(c) {
14121
- const lower = c | 32;
14122
- if (lower === Sequences.ScriptEnd[3]) {
14142
+ if (c === Sequences.ScriptEnd[3]) {
14123
14143
  this.startSpecial(Sequences.ScriptEnd, 4);
14124
- } else if (lower === Sequences.StyleEnd[3]) {
14144
+ } else if (c === Sequences.StyleEnd[3]) {
14125
14145
  this.startSpecial(Sequences.StyleEnd, 4);
14126
14146
  } else {
14127
14147
  this.state = 6;
@@ -14129,10 +14149,9 @@ class Tokenizer {
14129
14149
  }
14130
14150
  }
14131
14151
  stateBeforeSpecialT(c) {
14132
- const lower = c | 32;
14133
- if (lower === Sequences.TitleEnd[3]) {
14152
+ if (c === Sequences.TitleEnd[3]) {
14134
14153
  this.startSpecial(Sequences.TitleEnd, 4);
14135
- } else if (lower === Sequences.TextareaEnd[3]) {
14154
+ } else if (c === Sequences.TextareaEnd[3]) {
14136
14155
  this.startSpecial(Sequences.TextareaEnd, 4);
14137
14156
  } else {
14138
14157
  this.state = 6;