@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
  **/
@@ -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
  }
@@ -1333,6 +1333,7 @@ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1333
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`;
1334
1334
  class ComputedRefImpl {
1335
1335
  constructor(getter, _setter, isReadonly, isSSR) {
1336
+ this.getter = getter;
1336
1337
  this._setter = _setter;
1337
1338
  this.dep = void 0;
1338
1339
  this.__v_isRef = true;
@@ -1355,7 +1356,11 @@ class ComputedRefImpl {
1355
1356
  }
1356
1357
  trackRefValue(self);
1357
1358
  if (self.effect._dirtyLevel >= 2) {
1358
- warn$2(COMPUTED_SIDE_EFFECT_WARN);
1359
+ if (this._warnRecursive) {
1360
+ warn$2(COMPUTED_SIDE_EFFECT_WARN, `
1361
+
1362
+ getter: `, this.getter);
1363
+ }
1359
1364
  triggerRefValue(self, 2);
1360
1365
  }
1361
1366
  return self._value;
@@ -1511,7 +1516,7 @@ function customRef(factory) {
1511
1516
  }
1512
1517
  function toRefs(object) {
1513
1518
  if (!isProxy(object)) {
1514
- 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.`);
1515
1520
  }
1516
1521
  const ret = isArray(object) ? new Array(object.length) : {};
1517
1522
  for (const key in object) {
@@ -1593,7 +1598,10 @@ function warn$1(msg, ...args) {
1593
1598
  instance,
1594
1599
  11,
1595
1600
  [
1596
- msg + args.join(""),
1601
+ msg + args.map((a) => {
1602
+ var _a, _b;
1603
+ return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1604
+ }).join(""),
1597
1605
  instance && instance.proxy,
1598
1606
  trace.map(
1599
1607
  ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -3281,8 +3289,10 @@ const SuspenseImpl = {
3281
3289
  rendererInternals
3282
3290
  );
3283
3291
  } else {
3284
- if (parentSuspense && parentSuspense.deps > 0) {
3292
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
3285
3293
  n2.suspense = n1.suspense;
3294
+ n2.suspense.vnode = n2;
3295
+ n2.el = n1.el;
3286
3296
  return;
3287
3297
  }
3288
3298
  patchSuspense(
@@ -4266,7 +4276,6 @@ const BaseTransitionImpl = {
4266
4276
  setup(props, { slots }) {
4267
4277
  const instance = getCurrentInstance();
4268
4278
  const state = useTransitionState();
4269
- let prevTransitionKey;
4270
4279
  return () => {
4271
4280
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4272
4281
  if (!children || !children.length) {
@@ -4309,18 +4318,7 @@ const BaseTransitionImpl = {
4309
4318
  setTransitionHooks(innerChild, enterHooks);
4310
4319
  const oldChild = instance.subTree;
4311
4320
  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)) {
4321
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4324
4322
  const leavingHooks = resolveTransitionHooks(
4325
4323
  oldInnerChild,
4326
4324
  rawProps,
@@ -6502,7 +6500,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6502
6500
  return vm;
6503
6501
  }
6504
6502
  }
6505
- Vue.version = `2.6.14-compat:${"3.4.19"}`;
6503
+ Vue.version = `2.6.14-compat:${"3.4.21"}`;
6506
6504
  Vue.config = singletonApp.config;
6507
6505
  Vue.use = (p, ...options) => {
6508
6506
  if (p && isFunction(p.install)) {
@@ -10750,9 +10748,8 @@ const unsetCurrentInstance = () => {
10750
10748
  internalSetCurrentInstance(null);
10751
10749
  };
10752
10750
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10753
- function validateComponentName(name, config) {
10754
- const appIsNativeTag = config.isNativeTag || NO;
10755
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10751
+ function validateComponentName(name, { isNativeTag }) {
10752
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10756
10753
  warn$1(
10757
10754
  "Do not use built-in or reserved HTML elements as component id: " + name
10758
10755
  );
@@ -11057,7 +11054,14 @@ function isClassComponent(value) {
11057
11054
  }
11058
11055
 
11059
11056
  const computed = (getterOrOptions, debugOptions) => {
11060
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11057
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11058
+ {
11059
+ const i = getCurrentInstance();
11060
+ if (i && i.appContext.config.warnRecursiveComputed) {
11061
+ c._warnRecursive = true;
11062
+ }
11063
+ }
11064
+ return c;
11061
11065
  };
11062
11066
 
11063
11067
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11335,7 +11339,7 @@ function isMemoSame(cached, memo) {
11335
11339
  return true;
11336
11340
  }
11337
11341
 
11338
- const version = "3.4.19";
11342
+ const version = "3.4.21";
11339
11343
  const warn = warn$1 ;
11340
11344
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11341
11345
  const devtools = devtools$1 ;
@@ -11740,10 +11744,11 @@ function patchClass(el, value, isSVG) {
11740
11744
  }
11741
11745
  }
11742
11746
 
11743
- const vShowOldKey = Symbol("_vod");
11747
+ const vShowOriginalDisplay = Symbol("_vod");
11748
+ const vShowHidden = Symbol("_vsh");
11744
11749
  const vShow = {
11745
11750
  beforeMount(el, { value }, { transition }) {
11746
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11751
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11747
11752
  if (transition && value) {
11748
11753
  transition.beforeEnter(el);
11749
11754
  } else {
@@ -11756,7 +11761,7 @@ const vShow = {
11756
11761
  }
11757
11762
  },
11758
11763
  updated(el, { value, oldValue }, { transition }) {
11759
- if (!value === !oldValue && (el.style.display === el[vShowOldKey] || !value))
11764
+ if (!value === !oldValue)
11760
11765
  return;
11761
11766
  if (transition) {
11762
11767
  if (value) {
@@ -11780,7 +11785,8 @@ const vShow = {
11780
11785
  vShow.name = "show";
11781
11786
  }
11782
11787
  function setDisplay(el, value) {
11783
- el.style.display = value ? el[vShowOldKey] : "none";
11788
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11789
+ el[vShowHidden] = !value;
11784
11790
  }
11785
11791
 
11786
11792
  const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT" );
@@ -11853,13 +11859,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11853
11859
  function patchStyle(el, prev, next) {
11854
11860
  const style = el.style;
11855
11861
  const isCssString = isString(next);
11856
- const currentDisplay = style.display;
11857
11862
  let hasControlledDisplay = false;
11858
11863
  if (next && !isCssString) {
11859
- if (prev && !isString(prev)) {
11860
- for (const key in prev) {
11861
- if (next[key] == null) {
11862
- setStyle(style, key, "");
11864
+ if (prev) {
11865
+ if (!isString(prev)) {
11866
+ for (const key in prev) {
11867
+ if (next[key] == null) {
11868
+ setStyle(style, key, "");
11869
+ }
11870
+ }
11871
+ } else {
11872
+ for (const prevStyle of prev.split(";")) {
11873
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
11874
+ if (next[key] == null) {
11875
+ setStyle(style, key, "");
11876
+ }
11863
11877
  }
11864
11878
  }
11865
11879
  }
@@ -11883,9 +11897,11 @@ function patchStyle(el, prev, next) {
11883
11897
  el.removeAttribute("style");
11884
11898
  }
11885
11899
  }
11886
- if (vShowOldKey in el) {
11887
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
11888
- style.display = currentDisplay;
11900
+ if (vShowOriginalDisplay in el) {
11901
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
11902
+ if (el[vShowHidden]) {
11903
+ style.display = "none";
11904
+ }
11889
11905
  }
11890
11906
  }
11891
11907
  const semicolonRE = /[^\\];\s*$/;
@@ -11996,15 +12012,15 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
11996
12012
  const tag = el.tagName;
11997
12013
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
11998
12014
  !tag.includes("-")) {
11999
- el._value = value;
12000
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
12015
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12001
12016
  const newValue = value == null ? "" : value;
12002
- if (oldValue !== newValue) {
12017
+ if (oldValue !== newValue || !("_value" in el)) {
12003
12018
  el.value = newValue;
12004
12019
  }
12005
12020
  if (value == null) {
12006
12021
  el.removeAttribute(key);
12007
12022
  }
12023
+ el._value = value;
12008
12024
  return;
12009
12025
  }
12010
12026
  let needRemove = false;
@@ -12713,19 +12729,19 @@ const vModelSelect = {
12713
12729
  },
12714
12730
  // set value in mounted & updated because <select> relies on its children
12715
12731
  // <option>s.
12716
- mounted(el, { value, oldValue, modifiers: { number } }) {
12717
- setSelected(el, value, oldValue, number);
12732
+ mounted(el, { value, modifiers: { number } }) {
12733
+ setSelected(el, value, number);
12718
12734
  },
12719
12735
  beforeUpdate(el, _binding, vnode) {
12720
12736
  el[assignKey] = getModelAssigner(vnode);
12721
12737
  },
12722
- updated(el, { value, oldValue, modifiers: { number } }) {
12738
+ updated(el, { value, modifiers: { number } }) {
12723
12739
  if (!el._assigning) {
12724
- setSelected(el, value, oldValue, number);
12740
+ setSelected(el, value, number);
12725
12741
  }
12726
12742
  }
12727
12743
  };
12728
- function setSelected(el, value, oldValue, number) {
12744
+ function setSelected(el, value, number) {
12729
12745
  const isMultiple = el.multiple;
12730
12746
  const isArrayValue = isArray(value);
12731
12747
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12750,12 +12766,10 @@ function setSelected(el, value, oldValue, number) {
12750
12766
  } else {
12751
12767
  option.selected = value.has(optionValue);
12752
12768
  }
12753
- } else {
12754
- if (looseEqual(getValue(option), value)) {
12755
- if (el.selectedIndex !== i)
12756
- el.selectedIndex = i;
12757
- return;
12758
- }
12769
+ } else if (looseEqual(getValue(option), value)) {
12770
+ if (el.selectedIndex !== i)
12771
+ el.selectedIndex = i;
12772
+ return;
12759
12773
  }
12760
12774
  }
12761
12775
  if (!isMultiple && el.selectedIndex !== -1) {
@@ -13764,11 +13778,10 @@ class Tokenizer {
13764
13778
  } else if (this.inSFCRoot) {
13765
13779
  this.state = 34;
13766
13780
  } else if (!this.inXML) {
13767
- const lower = c | 32;
13768
- if (lower === 116) {
13781
+ if (c === 116) {
13769
13782
  this.state = 30;
13770
13783
  } else {
13771
- this.state = lower === 115 ? 29 : 6;
13784
+ this.state = c === 115 ? 29 : 6;
13772
13785
  }
13773
13786
  } else {
13774
13787
  this.state = 6;
@@ -14040,10 +14053,9 @@ class Tokenizer {
14040
14053
  }
14041
14054
  }
14042
14055
  stateBeforeSpecialS(c) {
14043
- const lower = c | 32;
14044
- if (lower === Sequences.ScriptEnd[3]) {
14056
+ if (c === Sequences.ScriptEnd[3]) {
14045
14057
  this.startSpecial(Sequences.ScriptEnd, 4);
14046
- } else if (lower === Sequences.StyleEnd[3]) {
14058
+ } else if (c === Sequences.StyleEnd[3]) {
14047
14059
  this.startSpecial(Sequences.StyleEnd, 4);
14048
14060
  } else {
14049
14061
  this.state = 6;
@@ -14051,10 +14063,9 @@ class Tokenizer {
14051
14063
  }
14052
14064
  }
14053
14065
  stateBeforeSpecialT(c) {
14054
- const lower = c | 32;
14055
- if (lower === Sequences.TitleEnd[3]) {
14066
+ if (c === Sequences.TitleEnd[3]) {
14056
14067
  this.startSpecial(Sequences.TitleEnd, 4);
14057
- } else if (lower === Sequences.TextareaEnd[3]) {
14068
+ } else if (c === Sequences.TextareaEnd[3]) {
14058
14069
  this.startSpecial(Sequences.TextareaEnd, 4);
14059
14070
  } else {
14060
14071
  this.state = 6;