@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
  **/
@@ -795,20 +795,20 @@ function hasOwnProperty(key) {
795
795
  return obj.hasOwnProperty(key);
796
796
  }
797
797
  class BaseReactiveHandler {
798
- constructor(_isReadonly = false, _shallow = false) {
798
+ constructor(_isReadonly = false, _isShallow = false) {
799
799
  this._isReadonly = _isReadonly;
800
- this._shallow = _shallow;
800
+ this._isShallow = _isShallow;
801
801
  }
802
802
  get(target, key, receiver) {
803
- const isReadonly2 = this._isReadonly, shallow = this._shallow;
803
+ const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
804
804
  if (key === "__v_isReactive") {
805
805
  return !isReadonly2;
806
806
  } else if (key === "__v_isReadonly") {
807
807
  return isReadonly2;
808
808
  } else if (key === "__v_isShallow") {
809
- return shallow;
809
+ return isShallow2;
810
810
  } else if (key === "__v_raw") {
811
- if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
811
+ if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
812
812
  // this means the reciever is a user proxy of the reactive proxy
813
813
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
814
814
  return target;
@@ -831,7 +831,7 @@ class BaseReactiveHandler {
831
831
  if (!isReadonly2) {
832
832
  track(target, "get", key);
833
833
  }
834
- if (shallow) {
834
+ if (isShallow2) {
835
835
  return res;
836
836
  }
837
837
  if (isRef(res)) {
@@ -844,12 +844,12 @@ class BaseReactiveHandler {
844
844
  }
845
845
  }
846
846
  class MutableReactiveHandler extends BaseReactiveHandler {
847
- constructor(shallow = false) {
848
- super(false, shallow);
847
+ constructor(isShallow2 = false) {
848
+ super(false, isShallow2);
849
849
  }
850
850
  set(target, key, value, receiver) {
851
851
  let oldValue = target[key];
852
- if (!this._shallow) {
852
+ if (!this._isShallow) {
853
853
  const isOldValueReadonly = isReadonly(oldValue);
854
854
  if (!isShallow(value) && !isReadonly(value)) {
855
855
  oldValue = toRaw(oldValue);
@@ -901,8 +901,8 @@ class MutableReactiveHandler extends BaseReactiveHandler {
901
901
  }
902
902
  }
903
903
  class ReadonlyReactiveHandler extends BaseReactiveHandler {
904
- constructor(shallow = false) {
905
- super(true, shallow);
904
+ constructor(isShallow2 = false) {
905
+ super(true, isShallow2);
906
906
  }
907
907
  set(target, key) {
908
908
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -1073,7 +1073,7 @@ function createReadonlyMethod(type) {
1073
1073
  return function(...args) {
1074
1074
  if (!!(process.env.NODE_ENV !== "production")) {
1075
1075
  const key = args[0] ? `on key "${args[0]}" ` : ``;
1076
- console.warn(
1076
+ warn$2(
1077
1077
  `${capitalize(type)} operation ${key}failed: target is readonly.`,
1078
1078
  toRaw(this)
1079
1079
  );
@@ -1211,7 +1211,7 @@ function checkIdentityKeys(target, has2, key) {
1211
1211
  const rawKey = toRaw(key);
1212
1212
  if (rawKey !== key && has2.call(target, rawKey)) {
1213
1213
  const type = toRawType(target);
1214
- console.warn(
1214
+ warn$2(
1215
1215
  `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.`
1216
1216
  );
1217
1217
  }
@@ -1280,7 +1280,7 @@ function shallowReadonly(target) {
1280
1280
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1281
1281
  if (!isObject(target)) {
1282
1282
  if (!!(process.env.NODE_ENV !== "production")) {
1283
- console.warn(`value cannot be made reactive: ${String(target)}`);
1283
+ warn$2(`value cannot be made reactive: ${String(target)}`);
1284
1284
  }
1285
1285
  return target;
1286
1286
  }
@@ -1330,8 +1330,10 @@ function markRaw(value) {
1330
1330
  const toReactive = (value) => isObject(value) ? reactive(value) : value;
1331
1331
  const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1332
1332
 
1333
+ 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`;
1333
1334
  class ComputedRefImpl {
1334
1335
  constructor(getter, _setter, isReadonly, isSSR) {
1336
+ this.getter = getter;
1335
1337
  this._setter = _setter;
1336
1338
  this.dep = void 0;
1337
1339
  this.__v_isRef = true;
@@ -1354,6 +1356,11 @@ class ComputedRefImpl {
1354
1356
  }
1355
1357
  trackRefValue(self);
1356
1358
  if (self.effect._dirtyLevel >= 2) {
1359
+ if (!!(process.env.NODE_ENV !== "production") && this._warnRecursive) {
1360
+ warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1361
+
1362
+ getter: `, this.getter);
1363
+ }
1357
1364
  triggerRefValue(self, 2);
1358
1365
  }
1359
1366
  return self._value;
@@ -1377,7 +1384,7 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
1377
1384
  if (onlyGetter) {
1378
1385
  getter = getterOrOptions;
1379
1386
  setter = !!(process.env.NODE_ENV !== "production") ? () => {
1380
- console.warn("Write operation failed: computed value is readonly");
1387
+ warn$2("Write operation failed: computed value is readonly");
1381
1388
  } : NOOP;
1382
1389
  } else {
1383
1390
  getter = getterOrOptions.get;
@@ -1509,7 +1516,7 @@ function customRef(factory) {
1509
1516
  }
1510
1517
  function toRefs(object) {
1511
1518
  if (!!(process.env.NODE_ENV !== "production") && !isProxy(object)) {
1512
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
1519
+ warn$2(`toRefs() expects a reactive object but received a plain one.`);
1513
1520
  }
1514
1521
  const ret = isArray(object) ? new Array(object.length) : {};
1515
1522
  for (const key in object) {
@@ -1753,13 +1760,11 @@ const ErrorTypeStrings$1 = {
1753
1760
  [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1754
1761
  };
1755
1762
  function callWithErrorHandling(fn, instance, type, args) {
1756
- let res;
1757
1763
  try {
1758
- res = args ? fn(...args) : fn();
1764
+ return args ? fn(...args) : fn();
1759
1765
  } catch (err) {
1760
1766
  handleError(err, instance, type);
1761
1767
  }
1762
- return res;
1763
1768
  }
1764
1769
  function callWithAsyncErrorHandling(fn, instance, type, args) {
1765
1770
  if (isFunction(fn)) {
@@ -3290,6 +3295,8 @@ const SuspenseImpl = {
3290
3295
  } else {
3291
3296
  if (parentSuspense && parentSuspense.deps > 0) {
3292
3297
  n2.suspense = n1.suspense;
3298
+ n2.suspense.vnode = n2;
3299
+ n2.el = n1.el;
3293
3300
  return;
3294
3301
  }
3295
3302
  patchSuspense(
@@ -4294,7 +4301,6 @@ const BaseTransitionImpl = {
4294
4301
  setup(props, { slots }) {
4295
4302
  const instance = getCurrentInstance();
4296
4303
  const state = useTransitionState();
4297
- let prevTransitionKey;
4298
4304
  return () => {
4299
4305
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4300
4306
  if (!children || !children.length) {
@@ -4339,18 +4345,7 @@ const BaseTransitionImpl = {
4339
4345
  setTransitionHooks(innerChild, enterHooks);
4340
4346
  const oldChild = instance.subTree;
4341
4347
  const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4342
- let transitionKeyChanged = false;
4343
- const { getTransitionKey } = innerChild.type;
4344
- if (getTransitionKey) {
4345
- const key = getTransitionKey();
4346
- if (prevTransitionKey === void 0) {
4347
- prevTransitionKey = key;
4348
- } else if (key !== prevTransitionKey) {
4349
- prevTransitionKey = key;
4350
- transitionKeyChanged = true;
4351
- }
4352
- }
4353
- if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
4348
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4354
4349
  const leavingHooks = resolveTransitionHooks(
4355
4350
  oldInnerChild,
4356
4351
  rawProps,
@@ -6540,7 +6535,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6540
6535
  return vm;
6541
6536
  }
6542
6537
  }
6543
- Vue.version = `2.6.14-compat:${"3.4.18"}`;
6538
+ Vue.version = `2.6.14-compat:${"3.4.20"}`;
6544
6539
  Vue.config = singletonApp.config;
6545
6540
  Vue.use = (p, ...options) => {
6546
6541
  if (p && isFunction(p.install)) {
@@ -7488,8 +7483,16 @@ function validatePropName(key) {
7488
7483
  return false;
7489
7484
  }
7490
7485
  function getType(ctor) {
7491
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7492
- return match ? match[2] : ctor === null ? "null" : "";
7486
+ if (ctor === null) {
7487
+ return "null";
7488
+ }
7489
+ if (typeof ctor === "function") {
7490
+ return ctor.name || "";
7491
+ } else if (typeof ctor === "object") {
7492
+ const name = ctor.constructor && ctor.constructor.name;
7493
+ return name || "";
7494
+ }
7495
+ return "";
7493
7496
  }
7494
7497
  function isSameType(a, b) {
7495
7498
  return getType(a) === getType(b);
@@ -8298,9 +8301,12 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
8298
8301
  }
8299
8302
  }
8300
8303
  }
8301
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8302
- for (const key2 in cssVars) {
8303
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
8304
+ const root = instance == null ? void 0 : instance.subTree;
8305
+ if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
8306
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8307
+ for (const key2 in cssVars) {
8308
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8309
+ }
8304
8310
  }
8305
8311
  if (!isMapEqual(actualMap, expectedMap)) {
8306
8312
  mismatchType = mismatchKey = "style";
@@ -10845,9 +10851,8 @@ const unsetCurrentInstance = () => {
10845
10851
  internalSetCurrentInstance(null);
10846
10852
  };
10847
10853
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10848
- function validateComponentName(name, config) {
10849
- const appIsNativeTag = config.isNativeTag || NO;
10850
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10854
+ function validateComponentName(name, { isNativeTag }) {
10855
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10851
10856
  warn$1(
10852
10857
  "Do not use built-in or reserved HTML elements as component id: " + name
10853
10858
  );
@@ -11168,7 +11173,14 @@ function isClassComponent(value) {
11168
11173
  }
11169
11174
 
11170
11175
  const computed = (getterOrOptions, debugOptions) => {
11171
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11176
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11177
+ if (!!(process.env.NODE_ENV !== "production")) {
11178
+ const i = getCurrentInstance();
11179
+ if (i && i.appContext.config.warnRecursiveComputed) {
11180
+ c._warnRecursive = true;
11181
+ }
11182
+ }
11183
+ return c;
11172
11184
  };
11173
11185
 
11174
11186
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11446,7 +11458,7 @@ function isMemoSame(cached, memo) {
11446
11458
  return true;
11447
11459
  }
11448
11460
 
11449
- const version = "3.4.18";
11461
+ const version = "3.4.20";
11450
11462
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11451
11463
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11452
11464
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -11859,10 +11871,11 @@ function patchClass(el, value, isSVG) {
11859
11871
  }
11860
11872
  }
11861
11873
 
11862
- const vShowOldKey = Symbol("_vod");
11874
+ const vShowOriginalDisplay = Symbol("_vod");
11875
+ const vShowHidden = Symbol("_vsh");
11863
11876
  const vShow = {
11864
11877
  beforeMount(el, { value }, { transition }) {
11865
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11878
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11866
11879
  if (transition && value) {
11867
11880
  transition.beforeEnter(el);
11868
11881
  } else {
@@ -11875,7 +11888,7 @@ const vShow = {
11875
11888
  }
11876
11889
  },
11877
11890
  updated(el, { value, oldValue }, { transition }) {
11878
- if (!value === !oldValue && el.style.display === el[vShowOldKey])
11891
+ if (!value === !oldValue)
11879
11892
  return;
11880
11893
  if (transition) {
11881
11894
  if (value) {
@@ -11899,7 +11912,8 @@ if (!!(process.env.NODE_ENV !== "production")) {
11899
11912
  vShow.name = "show";
11900
11913
  }
11901
11914
  function setDisplay(el, value) {
11902
- el.style.display = value ? el[vShowOldKey] : "none";
11915
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11916
+ el[vShowHidden] = !value;
11903
11917
  }
11904
11918
  function initVShowForSSR() {
11905
11919
  vShow.getSSRProps = ({ value }) => {
@@ -11979,13 +11993,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11979
11993
  function patchStyle(el, prev, next) {
11980
11994
  const style = el.style;
11981
11995
  const isCssString = isString(next);
11982
- const currentDisplay = style.display;
11983
11996
  let hasControlledDisplay = false;
11984
11997
  if (next && !isCssString) {
11985
- if (prev && !isString(prev)) {
11986
- for (const key in prev) {
11987
- if (next[key] == null) {
11988
- setStyle(style, key, "");
11998
+ if (prev) {
11999
+ if (!isString(prev)) {
12000
+ for (const key in prev) {
12001
+ if (next[key] == null) {
12002
+ setStyle(style, key, "");
12003
+ }
12004
+ }
12005
+ } else {
12006
+ for (const prevStyle of prev.split(";")) {
12007
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
12008
+ if (next[key] == null) {
12009
+ setStyle(style, key, "");
12010
+ }
11989
12011
  }
11990
12012
  }
11991
12013
  }
@@ -12009,9 +12031,11 @@ function patchStyle(el, prev, next) {
12009
12031
  el.removeAttribute("style");
12010
12032
  }
12011
12033
  }
12012
- if (vShowOldKey in el) {
12013
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
12014
- style.display = currentDisplay;
12034
+ if (vShowOriginalDisplay in el) {
12035
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
12036
+ if (el[vShowHidden]) {
12037
+ style.display = "none";
12038
+ }
12015
12039
  }
12016
12040
  }
12017
12041
  const semicolonRE = /[^\\];\s*$/;
@@ -12123,7 +12147,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
12123
12147
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12124
12148
  !tag.includes("-")) {
12125
12149
  el._value = value;
12126
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
12150
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12127
12151
  const newValue = value == null ? "" : value;
12128
12152
  if (oldValue !== newValue) {
12129
12153
  el.value = newValue;
@@ -12839,19 +12863,19 @@ const vModelSelect = {
12839
12863
  },
12840
12864
  // set value in mounted & updated because <select> relies on its children
12841
12865
  // <option>s.
12842
- mounted(el, { value, oldValue, modifiers: { number } }) {
12843
- setSelected(el, value, oldValue, number);
12866
+ mounted(el, { value, modifiers: { number } }) {
12867
+ setSelected(el, value, number);
12844
12868
  },
12845
12869
  beforeUpdate(el, _binding, vnode) {
12846
12870
  el[assignKey] = getModelAssigner(vnode);
12847
12871
  },
12848
- updated(el, { value, oldValue, modifiers: { number } }) {
12872
+ updated(el, { value, modifiers: { number } }) {
12849
12873
  if (!el._assigning) {
12850
- setSelected(el, value, oldValue, number);
12874
+ setSelected(el, value, number);
12851
12875
  }
12852
12876
  }
12853
12877
  };
12854
- function setSelected(el, value, oldValue, number) {
12878
+ function setSelected(el, value, number) {
12855
12879
  const isMultiple = el.multiple;
12856
12880
  const isArrayValue = isArray(value);
12857
12881
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12876,12 +12900,10 @@ function setSelected(el, value, oldValue, number) {
12876
12900
  } else {
12877
12901
  option.selected = value.has(optionValue);
12878
12902
  }
12879
- } else {
12880
- if (looseEqual(getValue(option), value)) {
12881
- if (el.selectedIndex !== i)
12882
- el.selectedIndex = i;
12883
- return;
12884
- }
12903
+ } else if (looseEqual(getValue(option), value)) {
12904
+ if (el.selectedIndex !== i)
12905
+ el.selectedIndex = i;
12906
+ return;
12885
12907
  }
12886
12908
  }
12887
12909
  if (!isMultiple && el.selectedIndex !== -1) {
@@ -13925,11 +13947,10 @@ class Tokenizer {
13925
13947
  } else if (this.inSFCRoot) {
13926
13948
  this.state = 34;
13927
13949
  } else if (!this.inXML) {
13928
- const lower = c | 32;
13929
- if (lower === 116) {
13950
+ if (c === 116) {
13930
13951
  this.state = 30;
13931
13952
  } else {
13932
- this.state = lower === 115 ? 29 : 6;
13953
+ this.state = c === 115 ? 29 : 6;
13933
13954
  }
13934
13955
  } else {
13935
13956
  this.state = 6;
@@ -14201,10 +14222,9 @@ class Tokenizer {
14201
14222
  }
14202
14223
  }
14203
14224
  stateBeforeSpecialS(c) {
14204
- const lower = c | 32;
14205
- if (lower === Sequences.ScriptEnd[3]) {
14225
+ if (c === Sequences.ScriptEnd[3]) {
14206
14226
  this.startSpecial(Sequences.ScriptEnd, 4);
14207
- } else if (lower === Sequences.StyleEnd[3]) {
14227
+ } else if (c === Sequences.StyleEnd[3]) {
14208
14228
  this.startSpecial(Sequences.StyleEnd, 4);
14209
14229
  } else {
14210
14230
  this.state = 6;
@@ -14212,10 +14232,9 @@ class Tokenizer {
14212
14232
  }
14213
14233
  }
14214
14234
  stateBeforeSpecialT(c) {
14215
- const lower = c | 32;
14216
- if (lower === Sequences.TitleEnd[3]) {
14235
+ if (c === Sequences.TitleEnd[3]) {
14217
14236
  this.startSpecial(Sequences.TitleEnd, 4);
14218
- } else if (lower === Sequences.TextareaEnd[3]) {
14237
+ } else if (c === Sequences.TextareaEnd[3]) {
14219
14238
  this.startSpecial(Sequences.TextareaEnd, 4);
14220
14239
  } else {
14221
14240
  this.state = 6;