@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
  {
@@ -1073,7 +1073,7 @@ function createReadonlyMethod(type) {
1073
1073
  return function(...args) {
1074
1074
  {
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
  {
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 (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 = () => {
1380
- console.warn("Write operation failed: computed value is readonly");
1387
+ warn$2("Write operation failed: computed value is readonly");
1381
1388
  } ;
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 (!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) {
@@ -1751,13 +1758,11 @@ const ErrorTypeStrings$1 = {
1751
1758
  [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1752
1759
  };
1753
1760
  function callWithErrorHandling(fn, instance, type, args) {
1754
- let res;
1755
1761
  try {
1756
- res = args ? fn(...args) : fn();
1762
+ return args ? fn(...args) : fn();
1757
1763
  } catch (err) {
1758
1764
  handleError(err, instance, type);
1759
1765
  }
1760
- return res;
1761
1766
  }
1762
1767
  function callWithAsyncErrorHandling(fn, instance, type, args) {
1763
1768
  if (isFunction(fn)) {
@@ -3283,6 +3288,8 @@ const SuspenseImpl = {
3283
3288
  } else {
3284
3289
  if (parentSuspense && parentSuspense.deps > 0) {
3285
3290
  n2.suspense = n1.suspense;
3291
+ n2.suspense.vnode = n2;
3292
+ n2.el = n1.el;
3286
3293
  return;
3287
3294
  }
3288
3295
  patchSuspense(
@@ -4266,7 +4273,6 @@ const BaseTransitionImpl = {
4266
4273
  setup(props, { slots }) {
4267
4274
  const instance = getCurrentInstance();
4268
4275
  const state = useTransitionState();
4269
- let prevTransitionKey;
4270
4276
  return () => {
4271
4277
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4272
4278
  if (!children || !children.length) {
@@ -4309,18 +4315,7 @@ const BaseTransitionImpl = {
4309
4315
  setTransitionHooks(innerChild, enterHooks);
4310
4316
  const oldChild = instance.subTree;
4311
4317
  const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4312
- let transitionKeyChanged = false;
4313
- const { getTransitionKey } = innerChild.type;
4314
- if (getTransitionKey) {
4315
- const key = getTransitionKey();
4316
- if (prevTransitionKey === void 0) {
4317
- prevTransitionKey = key;
4318
- } else if (key !== prevTransitionKey) {
4319
- prevTransitionKey = key;
4320
- transitionKeyChanged = true;
4321
- }
4322
- }
4323
- if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
4318
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4324
4319
  const leavingHooks = resolveTransitionHooks(
4325
4320
  oldInnerChild,
4326
4321
  rawProps,
@@ -6502,7 +6497,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6502
6497
  return vm;
6503
6498
  }
6504
6499
  }
6505
- Vue.version = `2.6.14-compat:${"3.4.18"}`;
6500
+ Vue.version = `2.6.14-compat:${"3.4.20"}`;
6506
6501
  Vue.config = singletonApp.config;
6507
6502
  Vue.use = (p, ...options) => {
6508
6503
  if (p && isFunction(p.install)) {
@@ -7447,8 +7442,16 @@ function validatePropName(key) {
7447
7442
  return false;
7448
7443
  }
7449
7444
  function getType(ctor) {
7450
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7451
- return match ? match[2] : ctor === null ? "null" : "";
7445
+ if (ctor === null) {
7446
+ return "null";
7447
+ }
7448
+ if (typeof ctor === "function") {
7449
+ return ctor.name || "";
7450
+ } else if (typeof ctor === "object") {
7451
+ const name = ctor.constructor && ctor.constructor.name;
7452
+ return name || "";
7453
+ }
7454
+ return "";
7452
7455
  }
7453
7456
  function isSameType(a, b) {
7454
7457
  return getType(a) === getType(b);
@@ -8247,9 +8250,12 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
8247
8250
  }
8248
8251
  }
8249
8252
  }
8250
- const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8251
- for (const key2 in cssVars) {
8252
- expectedMap.set(`--${key2}`, String(cssVars[key2]));
8253
+ const root = instance == null ? void 0 : instance.subTree;
8254
+ if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
8255
+ const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
8256
+ for (const key2 in cssVars) {
8257
+ expectedMap.set(`--${key2}`, String(cssVars[key2]));
8258
+ }
8253
8259
  }
8254
8260
  if (!isMapEqual(actualMap, expectedMap)) {
8255
8261
  mismatchType = mismatchKey = "style";
@@ -10739,9 +10745,8 @@ const unsetCurrentInstance = () => {
10739
10745
  internalSetCurrentInstance(null);
10740
10746
  };
10741
10747
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10742
- function validateComponentName(name, config) {
10743
- const appIsNativeTag = config.isNativeTag || NO;
10744
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10748
+ function validateComponentName(name, { isNativeTag }) {
10749
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10745
10750
  warn$1(
10746
10751
  "Do not use built-in or reserved HTML elements as component id: " + name
10747
10752
  );
@@ -11046,7 +11051,14 @@ function isClassComponent(value) {
11046
11051
  }
11047
11052
 
11048
11053
  const computed = (getterOrOptions, debugOptions) => {
11049
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11054
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11055
+ {
11056
+ const i = getCurrentInstance();
11057
+ if (i && i.appContext.config.warnRecursiveComputed) {
11058
+ c._warnRecursive = true;
11059
+ }
11060
+ }
11061
+ return c;
11050
11062
  };
11051
11063
 
11052
11064
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11324,7 +11336,7 @@ function isMemoSame(cached, memo) {
11324
11336
  return true;
11325
11337
  }
11326
11338
 
11327
- const version = "3.4.18";
11339
+ const version = "3.4.20";
11328
11340
  const warn = warn$1 ;
11329
11341
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11330
11342
  const devtools = devtools$1 ;
@@ -11729,10 +11741,11 @@ function patchClass(el, value, isSVG) {
11729
11741
  }
11730
11742
  }
11731
11743
 
11732
- const vShowOldKey = Symbol("_vod");
11744
+ const vShowOriginalDisplay = Symbol("_vod");
11745
+ const vShowHidden = Symbol("_vsh");
11733
11746
  const vShow = {
11734
11747
  beforeMount(el, { value }, { transition }) {
11735
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11748
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11736
11749
  if (transition && value) {
11737
11750
  transition.beforeEnter(el);
11738
11751
  } else {
@@ -11745,7 +11758,7 @@ const vShow = {
11745
11758
  }
11746
11759
  },
11747
11760
  updated(el, { value, oldValue }, { transition }) {
11748
- if (!value === !oldValue && el.style.display === el[vShowOldKey])
11761
+ if (!value === !oldValue)
11749
11762
  return;
11750
11763
  if (transition) {
11751
11764
  if (value) {
@@ -11769,7 +11782,8 @@ const vShow = {
11769
11782
  vShow.name = "show";
11770
11783
  }
11771
11784
  function setDisplay(el, value) {
11772
- el.style.display = value ? el[vShowOldKey] : "none";
11785
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11786
+ el[vShowHidden] = !value;
11773
11787
  }
11774
11788
 
11775
11789
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
@@ -11842,13 +11856,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11842
11856
  function patchStyle(el, prev, next) {
11843
11857
  const style = el.style;
11844
11858
  const isCssString = isString(next);
11845
- const currentDisplay = style.display;
11846
11859
  let hasControlledDisplay = false;
11847
11860
  if (next && !isCssString) {
11848
- if (prev && !isString(prev)) {
11849
- for (const key in prev) {
11850
- if (next[key] == null) {
11851
- setStyle(style, key, "");
11861
+ if (prev) {
11862
+ if (!isString(prev)) {
11863
+ for (const key in prev) {
11864
+ if (next[key] == null) {
11865
+ setStyle(style, key, "");
11866
+ }
11867
+ }
11868
+ } else {
11869
+ for (const prevStyle of prev.split(";")) {
11870
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11871
+ if (next[key] == null) {
11872
+ setStyle(style, key, "");
11873
+ }
11852
11874
  }
11853
11875
  }
11854
11876
  }
@@ -11872,9 +11894,11 @@ function patchStyle(el, prev, next) {
11872
11894
  el.removeAttribute("style");
11873
11895
  }
11874
11896
  }
11875
- if (vShowOldKey in el) {
11876
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11877
- style.display = currentDisplay;
11897
+ if (vShowOriginalDisplay in el) {
11898
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11899
+ if (el[vShowHidden]) {
11900
+ style.display = "none";
11901
+ }
11878
11902
  }
11879
11903
  }
11880
11904
  const semicolonRE = /[^\\];\s*$/;
@@ -11986,7 +12010,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
11986
12010
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11987
12011
  !tag.includes("-")) {
11988
12012
  el._value = value;
11989
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
12013
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
11990
12014
  const newValue = value == null ? "" : value;
11991
12015
  if (oldValue !== newValue) {
11992
12016
  el.value = newValue;
@@ -12702,19 +12726,19 @@ const vModelSelect = {
12702
12726
  },
12703
12727
  // set value in mounted & updated because <select> relies on its children
12704
12728
  // <option>s.
12705
- mounted(el, { value, oldValue, modifiers: { number } }) {
12706
- setSelected(el, value, oldValue, number);
12729
+ mounted(el, { value, modifiers: { number } }) {
12730
+ setSelected(el, value, number);
12707
12731
  },
12708
12732
  beforeUpdate(el, _binding, vnode) {
12709
12733
  el[assignKey] = getModelAssigner(vnode);
12710
12734
  },
12711
- updated(el, { value, oldValue, modifiers: { number } }) {
12735
+ updated(el, { value, modifiers: { number } }) {
12712
12736
  if (!el._assigning) {
12713
- setSelected(el, value, oldValue, number);
12737
+ setSelected(el, value, number);
12714
12738
  }
12715
12739
  }
12716
12740
  };
12717
- function setSelected(el, value, oldValue, number) {
12741
+ function setSelected(el, value, number) {
12718
12742
  const isMultiple = el.multiple;
12719
12743
  const isArrayValue = isArray(value);
12720
12744
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12739,12 +12763,10 @@ function setSelected(el, value, oldValue, number) {
12739
12763
  } else {
12740
12764
  option.selected = value.has(optionValue);
12741
12765
  }
12742
- } else {
12743
- if (looseEqual(getValue(option), value)) {
12744
- if (el.selectedIndex !== i)
12745
- el.selectedIndex = i;
12746
- return;
12747
- }
12766
+ } else if (looseEqual(getValue(option), value)) {
12767
+ if (el.selectedIndex !== i)
12768
+ el.selectedIndex = i;
12769
+ return;
12748
12770
  }
12749
12771
  }
12750
12772
  if (!isMultiple && el.selectedIndex !== -1) {
@@ -13753,11 +13775,10 @@ class Tokenizer {
13753
13775
  } else if (this.inSFCRoot) {
13754
13776
  this.state = 34;
13755
13777
  } else if (!this.inXML) {
13756
- const lower = c | 32;
13757
- if (lower === 116) {
13778
+ if (c === 116) {
13758
13779
  this.state = 30;
13759
13780
  } else {
13760
- this.state = lower === 115 ? 29 : 6;
13781
+ this.state = c === 115 ? 29 : 6;
13761
13782
  }
13762
13783
  } else {
13763
13784
  this.state = 6;
@@ -14029,10 +14050,9 @@ class Tokenizer {
14029
14050
  }
14030
14051
  }
14031
14052
  stateBeforeSpecialS(c) {
14032
- const lower = c | 32;
14033
- if (lower === Sequences.ScriptEnd[3]) {
14053
+ if (c === Sequences.ScriptEnd[3]) {
14034
14054
  this.startSpecial(Sequences.ScriptEnd, 4);
14035
- } else if (lower === Sequences.StyleEnd[3]) {
14055
+ } else if (c === Sequences.StyleEnd[3]) {
14036
14056
  this.startSpecial(Sequences.StyleEnd, 4);
14037
14057
  } else {
14038
14058
  this.state = 6;
@@ -14040,10 +14060,9 @@ class Tokenizer {
14040
14060
  }
14041
14061
  }
14042
14062
  stateBeforeSpecialT(c) {
14043
- const lower = c | 32;
14044
- if (lower === Sequences.TitleEnd[3]) {
14063
+ if (c === Sequences.TitleEnd[3]) {
14045
14064
  this.startSpecial(Sequences.TitleEnd, 4);
14046
- } else if (lower === Sequences.TextareaEnd[3]) {
14065
+ } else if (c === Sequences.TextareaEnd[3]) {
14047
14066
  this.startSpecial(Sequences.TextareaEnd, 4);
14048
14067
  } else {
14049
14068
  this.state = 6;