vue 3.4.20 → 3.4.22

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 v3.4.20
2
+ * vue v3.4.22
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,11 +1,13 @@
1
1
  /**
2
- * vue v3.4.20
2
+ * vue v3.4.22
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
6
  var Vue = (function (exports) {
7
7
  'use strict';
8
8
 
9
+ /*! #__NO_SIDE_EFFECTS__ */
10
+ // @__NO_SIDE_EFFECTS__
9
11
  function makeMap(str, expectsLowerCase) {
10
12
  const set = new Set(str.split(","));
11
13
  return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
@@ -357,7 +359,11 @@ var Vue = (function (exports) {
357
359
  };
358
360
  const stringifySymbol = (v, i = "") => {
359
361
  var _a;
360
- return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
362
+ return (
363
+ // Symbol.description in es2019+ so we need to cast here to pass
364
+ // the lib: es2016 check
365
+ isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
366
+ );
361
367
  };
362
368
 
363
369
  function warn$2(msg, ...args) {
@@ -793,6 +799,8 @@ var Vue = (function (exports) {
793
799
  return instrumentations;
794
800
  }
795
801
  function hasOwnProperty(key) {
802
+ if (!isSymbol(key))
803
+ key = String(key);
796
804
  const obj = toRaw(this);
797
805
  track(obj, "has", key);
798
806
  return obj.hasOwnProperty(key);
@@ -1145,23 +1153,16 @@ var Vue = (function (exports) {
1145
1153
  clear: createReadonlyMethod("clear"),
1146
1154
  forEach: createForEach(true, true)
1147
1155
  };
1148
- const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
1156
+ const iteratorMethods = [
1157
+ "keys",
1158
+ "values",
1159
+ "entries",
1160
+ Symbol.iterator
1161
+ ];
1149
1162
  iteratorMethods.forEach((method) => {
1150
- mutableInstrumentations2[method] = createIterableMethod(
1151
- method,
1152
- false,
1153
- false
1154
- );
1155
- readonlyInstrumentations2[method] = createIterableMethod(
1156
- method,
1157
- true,
1158
- false
1159
- );
1160
- shallowInstrumentations2[method] = createIterableMethod(
1161
- method,
1162
- false,
1163
- true
1164
- );
1163
+ mutableInstrumentations2[method] = createIterableMethod(method, false, false);
1164
+ readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
1165
+ shallowInstrumentations2[method] = createIterableMethod(method, false, true);
1165
1166
  shallowReadonlyInstrumentations2[method] = createIterableMethod(
1166
1167
  method,
1167
1168
  true,
@@ -1318,7 +1319,7 @@ var Vue = (function (exports) {
1318
1319
  return !!(value && value["__v_isShallow"]);
1319
1320
  }
1320
1321
  function isProxy(value) {
1321
- return isReactive(value) || isReadonly(value);
1322
+ return value ? !!value["__v_raw"] : false;
1322
1323
  }
1323
1324
  function toRaw(observed) {
1324
1325
  const raw = observed && observed["__v_raw"];
@@ -1601,7 +1602,10 @@ getter: `, this.getter);
1601
1602
  instance,
1602
1603
  11,
1603
1604
  [
1604
- msg + args.join(""),
1605
+ msg + args.map((a) => {
1606
+ var _a, _b;
1607
+ return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1608
+ }).join(""),
1605
1609
  instance && instance.proxy,
1606
1610
  trace.map(
1607
1611
  ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -1777,11 +1781,17 @@ getter: `, this.getter);
1777
1781
  }
1778
1782
  return res;
1779
1783
  }
1780
- const values = [];
1781
- for (let i = 0; i < fn.length; i++) {
1782
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1784
+ if (isArray(fn)) {
1785
+ const values = [];
1786
+ for (let i = 0; i < fn.length; i++) {
1787
+ values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1788
+ }
1789
+ return values;
1790
+ } else {
1791
+ warn$1(
1792
+ `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
1793
+ );
1783
1794
  }
1784
- return values;
1785
1795
  }
1786
1796
  function handleError(err, instance, type, throwInDev = true) {
1787
1797
  const contextVNode = instance ? instance.vnode : null;
@@ -1802,12 +1812,14 @@ getter: `, this.getter);
1802
1812
  }
1803
1813
  const appErrorHandler = instance.appContext.config.errorHandler;
1804
1814
  if (appErrorHandler) {
1815
+ pauseTracking();
1805
1816
  callWithErrorHandling(
1806
1817
  appErrorHandler,
1807
1818
  null,
1808
1819
  10,
1809
1820
  [err, exposedInstance, errorInfo]
1810
1821
  );
1822
+ resetTracking();
1811
1823
  return;
1812
1824
  }
1813
1825
  }
@@ -2183,6 +2195,8 @@ getter: `, this.getter);
2183
2195
  _devtoolsComponentRemoved(component);
2184
2196
  }
2185
2197
  };
2198
+ /*! #__NO_SIDE_EFFECTS__ */
2199
+ // @__NO_SIDE_EFFECTS__
2186
2200
  function createDevtoolsComponentHook(hook) {
2187
2201
  return (component) => {
2188
2202
  emit$1(
@@ -2768,7 +2782,7 @@ If this is a native custom element, make sure to exclude it from component resol
2768
2782
  rendererInternals
2769
2783
  );
2770
2784
  } else {
2771
- if (parentSuspense && parentSuspense.deps > 0) {
2785
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
2772
2786
  n2.suspense = n1.suspense;
2773
2787
  n2.suspense.vnode = n2;
2774
2788
  n2.el = n1.el;
@@ -4253,7 +4267,7 @@ If this is a native custom element, make sure to exclude it from component resol
4253
4267
  return () => {
4254
4268
  pendingCacheKey = null;
4255
4269
  if (!slots.default) {
4256
- return null;
4270
+ return current = null;
4257
4271
  }
4258
4272
  const children = slots.default();
4259
4273
  const rawVNode = children[0];
@@ -4566,6 +4580,9 @@ If this is a native custom element, make sure to exclude it from component resol
4566
4580
  const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4567
4581
  const PublicInstanceProxyHandlers = {
4568
4582
  get({ _: instance }, key) {
4583
+ if (key === "__v_skip") {
4584
+ return true;
4585
+ }
4569
4586
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4570
4587
  if (key === "__isVue") {
4571
4588
  return true;
@@ -5533,10 +5550,10 @@ If you want to remount the same app, move your app creation logic into a factory
5533
5550
  return !!(currentInstance || currentRenderingInstance || currentApp);
5534
5551
  }
5535
5552
 
5553
+ const attrsProto = {};
5536
5554
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5537
5555
  const props = {};
5538
- const attrs = {};
5539
- def(attrs, InternalObjectKey, 1);
5556
+ const attrs = Object.create(attrsProto);
5540
5557
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5541
5558
  setFullProps(instance, rawProps, props, attrs);
5542
5559
  for (const key in instance.propsOptions[0]) {
@@ -5651,7 +5668,7 @@ If you want to remount the same app, move your app creation logic into a factory
5651
5668
  }
5652
5669
  }
5653
5670
  if (hasAttrsChanged) {
5654
- trigger(instance, "set", "$attrs");
5671
+ trigger(instance.attrs, "set", "");
5655
5672
  }
5656
5673
  {
5657
5674
  validateProps(rawProps || {}, props, instance);
@@ -5987,7 +6004,7 @@ If you want to remount the same app, move your app creation logic into a factory
5987
6004
  const type = children._;
5988
6005
  if (type) {
5989
6006
  instance.slots = toRaw(children);
5990
- def(children, "_", type);
6007
+ def(instance.slots, "_", type);
5991
6008
  } else {
5992
6009
  normalizeObjectSlots(
5993
6010
  children,
@@ -5999,7 +6016,6 @@ If you want to remount the same app, move your app creation logic into a factory
5999
6016
  normalizeVNodeSlots(instance, children);
6000
6017
  }
6001
6018
  }
6002
- def(instance.slots, InternalObjectKey, 1);
6003
6019
  };
6004
6020
  const updateSlots = (instance, children, optimized) => {
6005
6021
  const { vnode, slots } = instance;
@@ -6171,6 +6187,7 @@ If you want to remount the same app, move your app creation logic into a factory
6171
6187
  }
6172
6188
  };
6173
6189
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6190
+ optimized = optimized || !!vnode.dynamicChildren;
6174
6191
  const isFragmentStart = isComment(node) && node.data === "[";
6175
6192
  const onMismatch = () => handleMismatch(
6176
6193
  node,
@@ -8605,7 +8622,6 @@ Server rendered element contains fewer child nodes than client vdom.`
8605
8622
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8606
8623
  );
8607
8624
  };
8608
- const InternalObjectKey = `__vInternal`;
8609
8625
  const normalizeKey = ({ key }) => key != null ? key : null;
8610
8626
  const normalizeRef = ({
8611
8627
  ref,
@@ -8738,7 +8754,7 @@ Component that was made reactive: `,
8738
8754
  function guardReactiveProps(props) {
8739
8755
  if (!props)
8740
8756
  return null;
8741
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8757
+ return isProxy(props) || Object.getPrototypeOf(props) === attrsProto ? extend({}, props) : props;
8742
8758
  }
8743
8759
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8744
8760
  const { props, ref, patchFlag, children } = vnode;
@@ -8843,7 +8859,7 @@ Component that was made reactive: `,
8843
8859
  } else {
8844
8860
  type = 32;
8845
8861
  const slotFlag = children._;
8846
- if (!slotFlag && !(InternalObjectKey in children)) {
8862
+ if (!slotFlag) {
8847
8863
  children._ctx = currentRenderingInstance;
8848
8864
  } else if (slotFlag === 3 && currentRenderingInstance) {
8849
8865
  if (currentRenderingInstance.slots._ === 1) {
@@ -9064,7 +9080,7 @@ Component that was made reactive: `,
9064
9080
  }
9065
9081
  }
9066
9082
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9067
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9083
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9068
9084
  {
9069
9085
  exposePropsOnRenderContext(instance);
9070
9086
  }
@@ -9196,26 +9212,21 @@ Component that was made reactive: `,
9196
9212
  }
9197
9213
  }
9198
9214
  }
9199
- function getAttrsProxy(instance) {
9200
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
9201
- instance.attrs,
9202
- {
9203
- get(target, key) {
9204
- markAttrsAccessed();
9205
- track(instance, "get", "$attrs");
9206
- return target[key];
9207
- },
9208
- set() {
9209
- warn$1(`setupContext.attrs is readonly.`);
9210
- return false;
9211
- },
9212
- deleteProperty() {
9213
- warn$1(`setupContext.attrs is readonly.`);
9214
- return false;
9215
- }
9216
- }
9217
- ));
9218
- }
9215
+ const attrsProxyHandlers = {
9216
+ get(target, key) {
9217
+ markAttrsAccessed();
9218
+ track(target, "get", "");
9219
+ return target[key];
9220
+ },
9221
+ set() {
9222
+ warn$1(`setupContext.attrs is readonly.`);
9223
+ return false;
9224
+ },
9225
+ deleteProperty() {
9226
+ warn$1(`setupContext.attrs is readonly.`);
9227
+ return false;
9228
+ }
9229
+ } ;
9219
9230
  function getSlotsProxy(instance) {
9220
9231
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9221
9232
  get(target, key) {
@@ -9249,9 +9260,10 @@ Component that was made reactive: `,
9249
9260
  instance.exposed = exposed || {};
9250
9261
  };
9251
9262
  {
9263
+ let attrsProxy;
9252
9264
  return Object.freeze({
9253
9265
  get attrs() {
9254
- return getAttrsProxy(instance);
9266
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9255
9267
  },
9256
9268
  get slots() {
9257
9269
  return getSlotsProxy(instance);
@@ -9596,7 +9608,7 @@ Component that was made reactive: `,
9596
9608
  return true;
9597
9609
  }
9598
9610
 
9599
- const version = "3.4.20";
9611
+ const version = "3.4.22";
9600
9612
  const warn = warn$1 ;
9601
9613
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9602
9614
  const devtools = devtools$1 ;
@@ -10022,8 +10034,8 @@ Component that was made reactive: `,
10022
10034
  setVarsOnVNode(instance.subTree, vars);
10023
10035
  updateTeleports(vars);
10024
10036
  };
10025
- watchPostEffect(setVars);
10026
10037
  onMounted(() => {
10038
+ watchPostEffect(setVars);
10027
10039
  const ob = new MutationObserver(setVars);
10028
10040
  ob.observe(instance.subTree.el.parentNode, { childList: true });
10029
10041
  onUnmounted(() => ob.disconnect());
@@ -10198,15 +10210,15 @@ Component that was made reactive: `,
10198
10210
  const tag = el.tagName;
10199
10211
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10200
10212
  !tag.includes("-")) {
10201
- el._value = value;
10202
10213
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10203
10214
  const newValue = value == null ? "" : value;
10204
- if (oldValue !== newValue) {
10215
+ if (oldValue !== newValue || !("_value" in el)) {
10205
10216
  el.value = newValue;
10206
10217
  }
10207
10218
  if (value == null) {
10208
10219
  el.removeAttribute(key);
10209
10220
  }
10221
+ el._value = value;
10210
10222
  return;
10211
10223
  }
10212
10224
  let needRemove = false;
@@ -10246,11 +10258,14 @@ Component that was made reactive: `,
10246
10258
  const invokers = el[veiKey] || (el[veiKey] = {});
10247
10259
  const existingInvoker = invokers[rawName];
10248
10260
  if (nextValue && existingInvoker) {
10249
- existingInvoker.value = nextValue;
10261
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10250
10262
  } else {
10251
10263
  const [name, options] = parseName(rawName);
10252
10264
  if (nextValue) {
10253
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10265
+ const invoker = invokers[rawName] = createInvoker(
10266
+ sanitizeEventValue(nextValue, rawName) ,
10267
+ instance
10268
+ );
10254
10269
  addEventListener(el, name, invoker, options);
10255
10270
  } else if (existingInvoker) {
10256
10271
  removeEventListener(el, name, existingInvoker, options);
@@ -10293,6 +10308,16 @@ Component that was made reactive: `,
10293
10308
  invoker.attached = getNow();
10294
10309
  return invoker;
10295
10310
  }
10311
+ function sanitizeEventValue(value, propName) {
10312
+ if (isFunction(value) || isArray(value)) {
10313
+ return value;
10314
+ }
10315
+ warn(
10316
+ `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
10317
+ Expected function or array of functions, received type ${typeof value}.`
10318
+ );
10319
+ return NOOP;
10320
+ }
10296
10321
  function patchStopImmediatePropagation(e, value) {
10297
10322
  if (isArray(value)) {
10298
10323
  const originalStop = e.stopImmediatePropagation;
@@ -10300,7 +10325,9 @@ Component that was made reactive: `,
10300
10325
  originalStop.call(e);
10301
10326
  e._stopped = true;
10302
10327
  };
10303
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10328
+ return value.map(
10329
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10330
+ );
10304
10331
  } else {
10305
10332
  return value;
10306
10333
  }
@@ -10501,7 +10528,7 @@ Component that was made reactive: `,
10501
10528
  }
10502
10529
  }
10503
10530
  _setAttr(key) {
10504
- let value = this.getAttribute(key);
10531
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10505
10532
  const camelKey = camelize(key);
10506
10533
  if (this._numberProps && this._numberProps[camelKey]) {
10507
10534
  value = toNumber(value);
@@ -10655,7 +10682,28 @@ Component that was made reactive: `,
10655
10682
  const rawProps = toRaw(props);
10656
10683
  const cssTransitionProps = resolveTransitionProps(rawProps);
10657
10684
  let tag = rawProps.tag || Fragment;
10658
- prevChildren = children;
10685
+ prevChildren = [];
10686
+ if (children) {
10687
+ for (let i = 0; i < children.length; i++) {
10688
+ const child = children[i];
10689
+ if (child.el && child.el instanceof Element) {
10690
+ prevChildren.push(child);
10691
+ setTransitionHooks(
10692
+ child,
10693
+ resolveTransitionHooks(
10694
+ child,
10695
+ cssTransitionProps,
10696
+ state,
10697
+ instance
10698
+ )
10699
+ );
10700
+ positionMap.set(
10701
+ child,
10702
+ child.el.getBoundingClientRect()
10703
+ );
10704
+ }
10705
+ }
10706
+ }
10659
10707
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10660
10708
  for (let i = 0; i < children.length; i++) {
10661
10709
  const child = children[i];
@@ -10668,16 +10716,6 @@ Component that was made reactive: `,
10668
10716
  warn(`<TransitionGroup> children must be keyed.`);
10669
10717
  }
10670
10718
  }
10671
- if (prevChildren) {
10672
- for (let i = 0; i < prevChildren.length; i++) {
10673
- const child = prevChildren[i];
10674
- setTransitionHooks(
10675
- child,
10676
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
10677
- );
10678
- positionMap.set(child, child.el.getBoundingClientRect());
10679
- }
10680
- }
10681
10719
  return createVNode(tag, null, children);
10682
10720
  };
10683
10721
  }
@@ -10776,7 +10814,7 @@ Component that was made reactive: `,
10776
10814
  el[assignKey] = getModelAssigner(vnode);
10777
10815
  if (el.composing)
10778
10816
  return;
10779
- const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10817
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10780
10818
  const newValue = value == null ? "" : value;
10781
10819
  if (elValue === newValue) {
10782
10820
  return;
@@ -10879,14 +10917,14 @@ Component that was made reactive: `,
10879
10917
  // set value in mounted & updated because <select> relies on its children
10880
10918
  // <option>s.
10881
10919
  mounted(el, { value, modifiers: { number } }) {
10882
- setSelected(el, value, number);
10920
+ setSelected(el, value);
10883
10921
  },
10884
10922
  beforeUpdate(el, _binding, vnode) {
10885
10923
  el[assignKey] = getModelAssigner(vnode);
10886
10924
  },
10887
10925
  updated(el, { value, modifiers: { number } }) {
10888
10926
  if (!el._assigning) {
10889
- setSelected(el, value, number);
10927
+ setSelected(el, value);
10890
10928
  }
10891
10929
  }
10892
10930
  };
@@ -10906,9 +10944,7 @@ Component that was made reactive: `,
10906
10944
  if (isArrayValue) {
10907
10945
  const optionType = typeof optionValue;
10908
10946
  if (optionType === "string" || optionType === "number") {
10909
- option.selected = value.includes(
10910
- number ? looseToNumber(optionValue) : optionValue
10911
- );
10947
+ option.selected = value.some((v) => String(v) === String(optionValue));
10912
10948
  } else {
10913
10949
  option.selected = looseIndexOf(value, optionValue) > -1;
10914
10950
  }
@@ -12921,7 +12957,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12921
12957
  if (isImplied) {
12922
12958
  setLocEnd(el.loc, backTrack(end, 60));
12923
12959
  } else {
12924
- setLocEnd(el.loc, end + 1);
12960
+ setLocEnd(el.loc, lookAhead(end, 62) + 1);
12925
12961
  }
12926
12962
  if (tokenizer.inSFCRoot) {
12927
12963
  if (el.children.length) {
@@ -12958,6 +12994,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12958
12994
  tokenizer.inXML = false;
12959
12995
  }
12960
12996
  }
12997
+ function lookAhead(index, c) {
12998
+ let i = index;
12999
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
13000
+ i++;
13001
+ return i;
13002
+ }
12961
13003
  function backTrack(index, c) {
12962
13004
  let i = index;
12963
13005
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -15109,10 +15151,24 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15109
15151
  function resolveComponentType(node, context, ssr = false) {
15110
15152
  let { tag } = node;
15111
15153
  const isExplicitDynamic = isComponentTag(tag);
15112
- const isProp = findProp(node, "is");
15154
+ const isProp = findProp(
15155
+ node,
15156
+ "is",
15157
+ false,
15158
+ true
15159
+ /* allow empty */
15160
+ );
15113
15161
  if (isProp) {
15114
15162
  if (isExplicitDynamic || false) {
15115
- const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
15163
+ let exp;
15164
+ if (isProp.type === 6) {
15165
+ exp = isProp.value && createSimpleExpression(isProp.value.content, true);
15166
+ } else {
15167
+ exp = isProp.exp;
15168
+ if (!exp) {
15169
+ exp = createSimpleExpression(`is`, false, isProp.loc);
15170
+ }
15171
+ }
15116
15172
  if (exp) {
15117
15173
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15118
15174
  exp