@vue/compat 3.4.19 → 3.4.21

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.19
2
+ * @vue/compat v3.4.21
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -730,20 +730,20 @@ function hasOwnProperty(key) {
730
730
  return obj.hasOwnProperty(key);
731
731
  }
732
732
  class BaseReactiveHandler {
733
- constructor(_isReadonly = false, _shallow = false) {
733
+ constructor(_isReadonly = false, _isShallow = false) {
734
734
  this._isReadonly = _isReadonly;
735
- this._shallow = _shallow;
735
+ this._isShallow = _isShallow;
736
736
  }
737
737
  get(target, key, receiver) {
738
- const isReadonly2 = this._isReadonly, shallow = this._shallow;
738
+ const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
739
739
  if (key === "__v_isReactive") {
740
740
  return !isReadonly2;
741
741
  } else if (key === "__v_isReadonly") {
742
742
  return isReadonly2;
743
743
  } else if (key === "__v_isShallow") {
744
- return shallow;
744
+ return isShallow2;
745
745
  } else if (key === "__v_raw") {
746
- if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
746
+ if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
747
747
  // this means the reciever is a user proxy of the reactive proxy
748
748
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
749
749
  return target;
@@ -766,7 +766,7 @@ class BaseReactiveHandler {
766
766
  if (!isReadonly2) {
767
767
  track(target, "get", key);
768
768
  }
769
- if (shallow) {
769
+ if (isShallow2) {
770
770
  return res;
771
771
  }
772
772
  if (isRef(res)) {
@@ -779,12 +779,12 @@ class BaseReactiveHandler {
779
779
  }
780
780
  }
781
781
  class MutableReactiveHandler extends BaseReactiveHandler {
782
- constructor(shallow = false) {
783
- super(false, shallow);
782
+ constructor(isShallow2 = false) {
783
+ super(false, isShallow2);
784
784
  }
785
785
  set(target, key, value, receiver) {
786
786
  let oldValue = target[key];
787
- if (!this._shallow) {
787
+ if (!this._isShallow) {
788
788
  const isOldValueReadonly = isReadonly(oldValue);
789
789
  if (!isShallow(value) && !isReadonly(value)) {
790
790
  oldValue = toRaw(oldValue);
@@ -836,8 +836,8 @@ class MutableReactiveHandler extends BaseReactiveHandler {
836
836
  }
837
837
  }
838
838
  class ReadonlyReactiveHandler extends BaseReactiveHandler {
839
- constructor(shallow = false) {
840
- super(true, shallow);
839
+ constructor(isShallow2 = false) {
840
+ super(true, isShallow2);
841
841
  }
842
842
  set(target, key) {
843
843
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -1008,7 +1008,7 @@ function createReadonlyMethod(type) {
1008
1008
  return function(...args) {
1009
1009
  if (!!(process.env.NODE_ENV !== "production")) {
1010
1010
  const key = args[0] ? `on key "${args[0]}" ` : ``;
1011
- console.warn(
1011
+ warn$2(
1012
1012
  `${capitalize(type)} operation ${key}failed: target is readonly.`,
1013
1013
  toRaw(this)
1014
1014
  );
@@ -1146,7 +1146,7 @@ function checkIdentityKeys(target, has2, key) {
1146
1146
  const rawKey = toRaw(key);
1147
1147
  if (rawKey !== key && has2.call(target, rawKey)) {
1148
1148
  const type = toRawType(target);
1149
- console.warn(
1149
+ warn$2(
1150
1150
  `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.`
1151
1151
  );
1152
1152
  }
@@ -1215,7 +1215,7 @@ function shallowReadonly(target) {
1215
1215
  function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
1216
1216
  if (!isObject(target)) {
1217
1217
  if (!!(process.env.NODE_ENV !== "production")) {
1218
- console.warn(`value cannot be made reactive: ${String(target)}`);
1218
+ warn$2(`value cannot be made reactive: ${String(target)}`);
1219
1219
  }
1220
1220
  return target;
1221
1221
  }
@@ -1268,6 +1268,7 @@ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1268
1268
  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`;
1269
1269
  class ComputedRefImpl {
1270
1270
  constructor(getter, _setter, isReadonly, isSSR) {
1271
+ this.getter = getter;
1271
1272
  this._setter = _setter;
1272
1273
  this.dep = void 0;
1273
1274
  this.__v_isRef = true;
@@ -1290,7 +1291,11 @@ class ComputedRefImpl {
1290
1291
  }
1291
1292
  trackRefValue(self);
1292
1293
  if (self.effect._dirtyLevel >= 2) {
1293
- !!(process.env.NODE_ENV !== "production") && warn$2(COMPUTED_SIDE_EFFECT_WARN);
1294
+ if (!!(process.env.NODE_ENV !== "production") && this._warnRecursive) {
1295
+ warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1296
+
1297
+ getter: `, this.getter);
1298
+ }
1294
1299
  triggerRefValue(self, 2);
1295
1300
  }
1296
1301
  return self._value;
@@ -1446,7 +1451,7 @@ function customRef(factory) {
1446
1451
  }
1447
1452
  function toRefs(object) {
1448
1453
  if (!!(process.env.NODE_ENV !== "production") && !isProxy(object)) {
1449
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
1454
+ warn$2(`toRefs() expects a reactive object but received a plain one.`);
1450
1455
  }
1451
1456
  const ret = isArray(object) ? new Array(object.length) : {};
1452
1457
  for (const key in object) {
@@ -1528,7 +1533,10 @@ function warn$1(msg, ...args) {
1528
1533
  instance,
1529
1534
  11,
1530
1535
  [
1531
- msg + args.join(""),
1536
+ msg + args.map((a) => {
1537
+ var _a, _b;
1538
+ return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1539
+ }).join(""),
1532
1540
  instance && instance.proxy,
1533
1541
  trace.map(
1534
1542
  ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -3223,8 +3231,10 @@ const SuspenseImpl = {
3223
3231
  rendererInternals
3224
3232
  );
3225
3233
  } else {
3226
- if (parentSuspense && parentSuspense.deps > 0) {
3234
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
3227
3235
  n2.suspense = n1.suspense;
3236
+ n2.suspense.vnode = n2;
3237
+ n2.el = n1.el;
3228
3238
  return;
3229
3239
  }
3230
3240
  patchSuspense(
@@ -4229,7 +4239,6 @@ const BaseTransitionImpl = {
4229
4239
  setup(props, { slots }) {
4230
4240
  const instance = getCurrentInstance();
4231
4241
  const state = useTransitionState();
4232
- let prevTransitionKey;
4233
4242
  return () => {
4234
4243
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4235
4244
  if (!children || !children.length) {
@@ -4274,18 +4283,7 @@ const BaseTransitionImpl = {
4274
4283
  setTransitionHooks(innerChild, enterHooks);
4275
4284
  const oldChild = instance.subTree;
4276
4285
  const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
4277
- let transitionKeyChanged = false;
4278
- const { getTransitionKey } = innerChild.type;
4279
- if (getTransitionKey) {
4280
- const key = getTransitionKey();
4281
- if (prevTransitionKey === void 0) {
4282
- prevTransitionKey = key;
4283
- } else if (key !== prevTransitionKey) {
4284
- prevTransitionKey = key;
4285
- transitionKeyChanged = true;
4286
- }
4287
- }
4288
- if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
4286
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4289
4287
  const leavingHooks = resolveTransitionHooks(
4290
4288
  oldInnerChild,
4291
4289
  rawProps,
@@ -6475,7 +6473,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6475
6473
  return vm;
6476
6474
  }
6477
6475
  }
6478
- Vue.version = `2.6.14-compat:${"3.4.19"}`;
6476
+ Vue.version = `2.6.14-compat:${"3.4.21"}`;
6479
6477
  Vue.config = singletonApp.config;
6480
6478
  Vue.use = (p, ...options) => {
6481
6479
  if (p && isFunction(p.install)) {
@@ -10791,9 +10789,8 @@ const unsetCurrentInstance = () => {
10791
10789
  internalSetCurrentInstance(null);
10792
10790
  };
10793
10791
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10794
- function validateComponentName(name, config) {
10795
- const appIsNativeTag = config.isNativeTag || NO;
10796
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10792
+ function validateComponentName(name, { isNativeTag }) {
10793
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10797
10794
  warn$1(
10798
10795
  "Do not use built-in or reserved HTML elements as component id: " + name
10799
10796
  );
@@ -11114,7 +11111,14 @@ function isClassComponent(value) {
11114
11111
  }
11115
11112
 
11116
11113
  const computed = (getterOrOptions, debugOptions) => {
11117
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11114
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11115
+ if (!!(process.env.NODE_ENV !== "production")) {
11116
+ const i = getCurrentInstance();
11117
+ if (i && i.appContext.config.warnRecursiveComputed) {
11118
+ c._warnRecursive = true;
11119
+ }
11120
+ }
11121
+ return c;
11118
11122
  };
11119
11123
 
11120
11124
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11392,7 +11396,7 @@ function isMemoSame(cached, memo) {
11392
11396
  return true;
11393
11397
  }
11394
11398
 
11395
- const version = "3.4.19";
11399
+ const version = "3.4.21";
11396
11400
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11397
11401
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11398
11402
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -11805,10 +11809,11 @@ function patchClass(el, value, isSVG) {
11805
11809
  }
11806
11810
  }
11807
11811
 
11808
- const vShowOldKey = Symbol("_vod");
11812
+ const vShowOriginalDisplay = Symbol("_vod");
11813
+ const vShowHidden = Symbol("_vsh");
11809
11814
  const vShow = {
11810
11815
  beforeMount(el, { value }, { transition }) {
11811
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11816
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11812
11817
  if (transition && value) {
11813
11818
  transition.beforeEnter(el);
11814
11819
  } else {
@@ -11821,7 +11826,7 @@ const vShow = {
11821
11826
  }
11822
11827
  },
11823
11828
  updated(el, { value, oldValue }, { transition }) {
11824
- if (!value === !oldValue && (el.style.display === el[vShowOldKey] || !value))
11829
+ if (!value === !oldValue)
11825
11830
  return;
11826
11831
  if (transition) {
11827
11832
  if (value) {
@@ -11845,7 +11850,8 @@ if (!!(process.env.NODE_ENV !== "production")) {
11845
11850
  vShow.name = "show";
11846
11851
  }
11847
11852
  function setDisplay(el, value) {
11848
- el.style.display = value ? el[vShowOldKey] : "none";
11853
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11854
+ el[vShowHidden] = !value;
11849
11855
  }
11850
11856
  function initVShowForSSR() {
11851
11857
  vShow.getSSRProps = ({ value }) => {
@@ -11925,13 +11931,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11925
11931
  function patchStyle(el, prev, next) {
11926
11932
  const style = el.style;
11927
11933
  const isCssString = isString(next);
11928
- const currentDisplay = style.display;
11929
11934
  let hasControlledDisplay = false;
11930
11935
  if (next && !isCssString) {
11931
- if (prev && !isString(prev)) {
11932
- for (const key in prev) {
11933
- if (next[key] == null) {
11934
- setStyle(style, key, "");
11936
+ if (prev) {
11937
+ if (!isString(prev)) {
11938
+ for (const key in prev) {
11939
+ if (next[key] == null) {
11940
+ setStyle(style, key, "");
11941
+ }
11942
+ }
11943
+ } else {
11944
+ for (const prevStyle of prev.split(";")) {
11945
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11946
+ if (next[key] == null) {
11947
+ setStyle(style, key, "");
11948
+ }
11935
11949
  }
11936
11950
  }
11937
11951
  }
@@ -11955,9 +11969,11 @@ function patchStyle(el, prev, next) {
11955
11969
  el.removeAttribute("style");
11956
11970
  }
11957
11971
  }
11958
- if (vShowOldKey in el) {
11959
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11960
- style.display = currentDisplay;
11972
+ if (vShowOriginalDisplay in el) {
11973
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11974
+ if (el[vShowHidden]) {
11975
+ style.display = "none";
11976
+ }
11961
11977
  }
11962
11978
  }
11963
11979
  const semicolonRE = /[^\\];\s*$/;
@@ -12068,15 +12084,15 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
12068
12084
  const tag = el.tagName;
12069
12085
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12070
12086
  !tag.includes("-")) {
12071
- el._value = value;
12072
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
12087
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12073
12088
  const newValue = value == null ? "" : value;
12074
- if (oldValue !== newValue) {
12089
+ if (oldValue !== newValue || !("_value" in el)) {
12075
12090
  el.value = newValue;
12076
12091
  }
12077
12092
  if (value == null) {
12078
12093
  el.removeAttribute(key);
12079
12094
  }
12095
+ el._value = value;
12080
12096
  return;
12081
12097
  }
12082
12098
  let needRemove = false;
@@ -12785,19 +12801,19 @@ const vModelSelect = {
12785
12801
  },
12786
12802
  // set value in mounted & updated because <select> relies on its children
12787
12803
  // <option>s.
12788
- mounted(el, { value, oldValue, modifiers: { number } }) {
12789
- setSelected(el, value, oldValue, number);
12804
+ mounted(el, { value, modifiers: { number } }) {
12805
+ setSelected(el, value, number);
12790
12806
  },
12791
12807
  beforeUpdate(el, _binding, vnode) {
12792
12808
  el[assignKey] = getModelAssigner(vnode);
12793
12809
  },
12794
- updated(el, { value, oldValue, modifiers: { number } }) {
12810
+ updated(el, { value, modifiers: { number } }) {
12795
12811
  if (!el._assigning) {
12796
- setSelected(el, value, oldValue, number);
12812
+ setSelected(el, value, number);
12797
12813
  }
12798
12814
  }
12799
12815
  };
12800
- function setSelected(el, value, oldValue, number) {
12816
+ function setSelected(el, value, number) {
12801
12817
  const isMultiple = el.multiple;
12802
12818
  const isArrayValue = isArray(value);
12803
12819
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12822,12 +12838,10 @@ function setSelected(el, value, oldValue, number) {
12822
12838
  } else {
12823
12839
  option.selected = value.has(optionValue);
12824
12840
  }
12825
- } else {
12826
- if (looseEqual(getValue(option), value)) {
12827
- if (el.selectedIndex !== i)
12828
- el.selectedIndex = i;
12829
- return;
12830
- }
12841
+ } else if (looseEqual(getValue(option), value)) {
12842
+ if (el.selectedIndex !== i)
12843
+ el.selectedIndex = i;
12844
+ return;
12831
12845
  }
12832
12846
  }
12833
12847
  if (!isMultiple && el.selectedIndex !== -1) {