@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
  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
  }
@@ -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
- !!(process.env.NODE_ENV !== "production") && warn$2(COMPUTED_SIDE_EFFECT_WARN);
1359
+ if (!!(process.env.NODE_ENV !== "production") && 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 (!!(process.env.NODE_ENV !== "production") && !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)}>`
@@ -3288,8 +3296,10 @@ const SuspenseImpl = {
3288
3296
  rendererInternals
3289
3297
  );
3290
3298
  } else {
3291
- if (parentSuspense && parentSuspense.deps > 0) {
3299
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
3292
3300
  n2.suspense = n1.suspense;
3301
+ n2.suspense.vnode = n2;
3302
+ n2.el = n1.el;
3293
3303
  return;
3294
3304
  }
3295
3305
  patchSuspense(
@@ -4294,7 +4304,6 @@ const BaseTransitionImpl = {
4294
4304
  setup(props, { slots }) {
4295
4305
  const instance = getCurrentInstance();
4296
4306
  const state = useTransitionState();
4297
- let prevTransitionKey;
4298
4307
  return () => {
4299
4308
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
4300
4309
  if (!children || !children.length) {
@@ -4339,18 +4348,7 @@ const BaseTransitionImpl = {
4339
4348
  setTransitionHooks(innerChild, enterHooks);
4340
4349
  const oldChild = instance.subTree;
4341
4350
  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)) {
4351
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
4354
4352
  const leavingHooks = resolveTransitionHooks(
4355
4353
  oldInnerChild,
4356
4354
  rawProps,
@@ -6540,7 +6538,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6540
6538
  return vm;
6541
6539
  }
6542
6540
  }
6543
- Vue.version = `2.6.14-compat:${"3.4.19"}`;
6541
+ Vue.version = `2.6.14-compat:${"3.4.21"}`;
6544
6542
  Vue.config = singletonApp.config;
6545
6543
  Vue.use = (p, ...options) => {
6546
6544
  if (p && isFunction(p.install)) {
@@ -10856,9 +10854,8 @@ const unsetCurrentInstance = () => {
10856
10854
  internalSetCurrentInstance(null);
10857
10855
  };
10858
10856
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10859
- function validateComponentName(name, config) {
10860
- const appIsNativeTag = config.isNativeTag || NO;
10861
- if (isBuiltInTag(name) || appIsNativeTag(name)) {
10857
+ function validateComponentName(name, { isNativeTag }) {
10858
+ if (isBuiltInTag(name) || isNativeTag(name)) {
10862
10859
  warn$1(
10863
10860
  "Do not use built-in or reserved HTML elements as component id: " + name
10864
10861
  );
@@ -11179,7 +11176,14 @@ function isClassComponent(value) {
11179
11176
  }
11180
11177
 
11181
11178
  const computed = (getterOrOptions, debugOptions) => {
11182
- return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11179
+ const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11180
+ if (!!(process.env.NODE_ENV !== "production")) {
11181
+ const i = getCurrentInstance();
11182
+ if (i && i.appContext.config.warnRecursiveComputed) {
11183
+ c._warnRecursive = true;
11184
+ }
11185
+ }
11186
+ return c;
11183
11187
  };
11184
11188
 
11185
11189
  function useModel(props, name, options = EMPTY_OBJ) {
@@ -11457,7 +11461,7 @@ function isMemoSame(cached, memo) {
11457
11461
  return true;
11458
11462
  }
11459
11463
 
11460
- const version = "3.4.19";
11464
+ const version = "3.4.21";
11461
11465
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11462
11466
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11463
11467
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -11870,10 +11874,11 @@ function patchClass(el, value, isSVG) {
11870
11874
  }
11871
11875
  }
11872
11876
 
11873
- const vShowOldKey = Symbol("_vod");
11877
+ const vShowOriginalDisplay = Symbol("_vod");
11878
+ const vShowHidden = Symbol("_vsh");
11874
11879
  const vShow = {
11875
11880
  beforeMount(el, { value }, { transition }) {
11876
- el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
11881
+ el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11877
11882
  if (transition && value) {
11878
11883
  transition.beforeEnter(el);
11879
11884
  } else {
@@ -11886,7 +11891,7 @@ const vShow = {
11886
11891
  }
11887
11892
  },
11888
11893
  updated(el, { value, oldValue }, { transition }) {
11889
- if (!value === !oldValue && (el.style.display === el[vShowOldKey] || !value))
11894
+ if (!value === !oldValue)
11890
11895
  return;
11891
11896
  if (transition) {
11892
11897
  if (value) {
@@ -11910,7 +11915,8 @@ if (!!(process.env.NODE_ENV !== "production")) {
11910
11915
  vShow.name = "show";
11911
11916
  }
11912
11917
  function setDisplay(el, value) {
11913
- el.style.display = value ? el[vShowOldKey] : "none";
11918
+ el.style.display = value ? el[vShowOriginalDisplay] : "none";
11919
+ el[vShowHidden] = !value;
11914
11920
  }
11915
11921
  function initVShowForSSR() {
11916
11922
  vShow.getSSRProps = ({ value }) => {
@@ -11990,13 +11996,21 @@ const displayRE = /(^|;)\s*display\s*:/;
11990
11996
  function patchStyle(el, prev, next) {
11991
11997
  const style = el.style;
11992
11998
  const isCssString = isString(next);
11993
- const currentDisplay = style.display;
11994
11999
  let hasControlledDisplay = false;
11995
12000
  if (next && !isCssString) {
11996
- if (prev && !isString(prev)) {
11997
- for (const key in prev) {
11998
- if (next[key] == null) {
11999
- setStyle(style, key, "");
12001
+ if (prev) {
12002
+ if (!isString(prev)) {
12003
+ for (const key in prev) {
12004
+ if (next[key] == null) {
12005
+ setStyle(style, key, "");
12006
+ }
12007
+ }
12008
+ } else {
12009
+ for (const prevStyle of prev.split(";")) {
12010
+ const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
12011
+ if (next[key] == null) {
12012
+ setStyle(style, key, "");
12013
+ }
12000
12014
  }
12001
12015
  }
12002
12016
  }
@@ -12020,9 +12034,11 @@ function patchStyle(el, prev, next) {
12020
12034
  el.removeAttribute("style");
12021
12035
  }
12022
12036
  }
12023
- if (vShowOldKey in el) {
12024
- el[vShowOldKey] = hasControlledDisplay ? style.display : "";
12025
- style.display = currentDisplay;
12037
+ if (vShowOriginalDisplay in el) {
12038
+ el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
12039
+ if (el[vShowHidden]) {
12040
+ style.display = "none";
12041
+ }
12026
12042
  }
12027
12043
  }
12028
12044
  const semicolonRE = /[^\\];\s*$/;
@@ -12133,15 +12149,15 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
12133
12149
  const tag = el.tagName;
12134
12150
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12135
12151
  !tag.includes("-")) {
12136
- el._value = value;
12137
- const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
12152
+ const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12138
12153
  const newValue = value == null ? "" : value;
12139
- if (oldValue !== newValue) {
12154
+ if (oldValue !== newValue || !("_value" in el)) {
12140
12155
  el.value = newValue;
12141
12156
  }
12142
12157
  if (value == null) {
12143
12158
  el.removeAttribute(key);
12144
12159
  }
12160
+ el._value = value;
12145
12161
  return;
12146
12162
  }
12147
12163
  let needRemove = false;
@@ -12850,19 +12866,19 @@ const vModelSelect = {
12850
12866
  },
12851
12867
  // set value in mounted & updated because <select> relies on its children
12852
12868
  // <option>s.
12853
- mounted(el, { value, oldValue, modifiers: { number } }) {
12854
- setSelected(el, value, oldValue, number);
12869
+ mounted(el, { value, modifiers: { number } }) {
12870
+ setSelected(el, value, number);
12855
12871
  },
12856
12872
  beforeUpdate(el, _binding, vnode) {
12857
12873
  el[assignKey] = getModelAssigner(vnode);
12858
12874
  },
12859
- updated(el, { value, oldValue, modifiers: { number } }) {
12875
+ updated(el, { value, modifiers: { number } }) {
12860
12876
  if (!el._assigning) {
12861
- setSelected(el, value, oldValue, number);
12877
+ setSelected(el, value, number);
12862
12878
  }
12863
12879
  }
12864
12880
  };
12865
- function setSelected(el, value, oldValue, number) {
12881
+ function setSelected(el, value, number) {
12866
12882
  const isMultiple = el.multiple;
12867
12883
  const isArrayValue = isArray(value);
12868
12884
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -12887,12 +12903,10 @@ function setSelected(el, value, oldValue, number) {
12887
12903
  } else {
12888
12904
  option.selected = value.has(optionValue);
12889
12905
  }
12890
- } else {
12891
- if (looseEqual(getValue(option), value)) {
12892
- if (el.selectedIndex !== i)
12893
- el.selectedIndex = i;
12894
- return;
12895
- }
12906
+ } else if (looseEqual(getValue(option), value)) {
12907
+ if (el.selectedIndex !== i)
12908
+ el.selectedIndex = i;
12909
+ return;
12896
12910
  }
12897
12911
  }
12898
12912
  if (!isMultiple && el.selectedIndex !== -1) {
@@ -13936,11 +13950,10 @@ class Tokenizer {
13936
13950
  } else if (this.inSFCRoot) {
13937
13951
  this.state = 34;
13938
13952
  } else if (!this.inXML) {
13939
- const lower = c | 32;
13940
- if (lower === 116) {
13953
+ if (c === 116) {
13941
13954
  this.state = 30;
13942
13955
  } else {
13943
- this.state = lower === 115 ? 29 : 6;
13956
+ this.state = c === 115 ? 29 : 6;
13944
13957
  }
13945
13958
  } else {
13946
13959
  this.state = 6;
@@ -14212,10 +14225,9 @@ class Tokenizer {
14212
14225
  }
14213
14226
  }
14214
14227
  stateBeforeSpecialS(c) {
14215
- const lower = c | 32;
14216
- if (lower === Sequences.ScriptEnd[3]) {
14228
+ if (c === Sequences.ScriptEnd[3]) {
14217
14229
  this.startSpecial(Sequences.ScriptEnd, 4);
14218
- } else if (lower === Sequences.StyleEnd[3]) {
14230
+ } else if (c === Sequences.StyleEnd[3]) {
14219
14231
  this.startSpecial(Sequences.StyleEnd, 4);
14220
14232
  } else {
14221
14233
  this.state = 6;
@@ -14223,10 +14235,9 @@ class Tokenizer {
14223
14235
  }
14224
14236
  }
14225
14237
  stateBeforeSpecialT(c) {
14226
- const lower = c | 32;
14227
- if (lower === Sequences.TitleEnd[3]) {
14238
+ if (c === Sequences.TitleEnd[3]) {
14228
14239
  this.startSpecial(Sequences.TitleEnd, 4);
14229
- } else if (lower === Sequences.TextareaEnd[3]) {
14240
+ } else if (c === Sequences.TextareaEnd[3]) {
14230
14241
  this.startSpecial(Sequences.TextareaEnd, 4);
14231
14242
  } else {
14232
14243
  this.state = 6;