vue 3.4.21 → 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.21
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.21
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"];
@@ -1780,11 +1781,17 @@ getter: `, this.getter);
1780
1781
  }
1781
1782
  return res;
1782
1783
  }
1783
- const values = [];
1784
- for (let i = 0; i < fn.length; i++) {
1785
- 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
+ );
1786
1794
  }
1787
- return values;
1788
1795
  }
1789
1796
  function handleError(err, instance, type, throwInDev = true) {
1790
1797
  const contextVNode = instance ? instance.vnode : null;
@@ -1805,12 +1812,14 @@ getter: `, this.getter);
1805
1812
  }
1806
1813
  const appErrorHandler = instance.appContext.config.errorHandler;
1807
1814
  if (appErrorHandler) {
1815
+ pauseTracking();
1808
1816
  callWithErrorHandling(
1809
1817
  appErrorHandler,
1810
1818
  null,
1811
1819
  10,
1812
1820
  [err, exposedInstance, errorInfo]
1813
1821
  );
1822
+ resetTracking();
1814
1823
  return;
1815
1824
  }
1816
1825
  }
@@ -2186,6 +2195,8 @@ getter: `, this.getter);
2186
2195
  _devtoolsComponentRemoved(component);
2187
2196
  }
2188
2197
  };
2198
+ /*! #__NO_SIDE_EFFECTS__ */
2199
+ // @__NO_SIDE_EFFECTS__
2189
2200
  function createDevtoolsComponentHook(hook) {
2190
2201
  return (component) => {
2191
2202
  emit$1(
@@ -4256,7 +4267,7 @@ If this is a native custom element, make sure to exclude it from component resol
4256
4267
  return () => {
4257
4268
  pendingCacheKey = null;
4258
4269
  if (!slots.default) {
4259
- return null;
4270
+ return current = null;
4260
4271
  }
4261
4272
  const children = slots.default();
4262
4273
  const rawVNode = children[0];
@@ -4569,6 +4580,9 @@ If this is a native custom element, make sure to exclude it from component resol
4569
4580
  const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4570
4581
  const PublicInstanceProxyHandlers = {
4571
4582
  get({ _: instance }, key) {
4583
+ if (key === "__v_skip") {
4584
+ return true;
4585
+ }
4572
4586
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4573
4587
  if (key === "__isVue") {
4574
4588
  return true;
@@ -5536,10 +5550,10 @@ If you want to remount the same app, move your app creation logic into a factory
5536
5550
  return !!(currentInstance || currentRenderingInstance || currentApp);
5537
5551
  }
5538
5552
 
5553
+ const attrsProto = {};
5539
5554
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5540
5555
  const props = {};
5541
- const attrs = {};
5542
- def(attrs, InternalObjectKey, 1);
5556
+ const attrs = Object.create(attrsProto);
5543
5557
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5544
5558
  setFullProps(instance, rawProps, props, attrs);
5545
5559
  for (const key in instance.propsOptions[0]) {
@@ -5654,7 +5668,7 @@ If you want to remount the same app, move your app creation logic into a factory
5654
5668
  }
5655
5669
  }
5656
5670
  if (hasAttrsChanged) {
5657
- trigger(instance, "set", "$attrs");
5671
+ trigger(instance.attrs, "set", "");
5658
5672
  }
5659
5673
  {
5660
5674
  validateProps(rawProps || {}, props, instance);
@@ -5990,7 +6004,7 @@ If you want to remount the same app, move your app creation logic into a factory
5990
6004
  const type = children._;
5991
6005
  if (type) {
5992
6006
  instance.slots = toRaw(children);
5993
- def(children, "_", type);
6007
+ def(instance.slots, "_", type);
5994
6008
  } else {
5995
6009
  normalizeObjectSlots(
5996
6010
  children,
@@ -6002,7 +6016,6 @@ If you want to remount the same app, move your app creation logic into a factory
6002
6016
  normalizeVNodeSlots(instance, children);
6003
6017
  }
6004
6018
  }
6005
- def(instance.slots, InternalObjectKey, 1);
6006
6019
  };
6007
6020
  const updateSlots = (instance, children, optimized) => {
6008
6021
  const { vnode, slots } = instance;
@@ -6174,6 +6187,7 @@ If you want to remount the same app, move your app creation logic into a factory
6174
6187
  }
6175
6188
  };
6176
6189
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6190
+ optimized = optimized || !!vnode.dynamicChildren;
6177
6191
  const isFragmentStart = isComment(node) && node.data === "[";
6178
6192
  const onMismatch = () => handleMismatch(
6179
6193
  node,
@@ -8608,7 +8622,6 @@ Server rendered element contains fewer child nodes than client vdom.`
8608
8622
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8609
8623
  );
8610
8624
  };
8611
- const InternalObjectKey = `__vInternal`;
8612
8625
  const normalizeKey = ({ key }) => key != null ? key : null;
8613
8626
  const normalizeRef = ({
8614
8627
  ref,
@@ -8741,7 +8754,7 @@ Component that was made reactive: `,
8741
8754
  function guardReactiveProps(props) {
8742
8755
  if (!props)
8743
8756
  return null;
8744
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8757
+ return isProxy(props) || Object.getPrototypeOf(props) === attrsProto ? extend({}, props) : props;
8745
8758
  }
8746
8759
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8747
8760
  const { props, ref, patchFlag, children } = vnode;
@@ -8846,7 +8859,7 @@ Component that was made reactive: `,
8846
8859
  } else {
8847
8860
  type = 32;
8848
8861
  const slotFlag = children._;
8849
- if (!slotFlag && !(InternalObjectKey in children)) {
8862
+ if (!slotFlag) {
8850
8863
  children._ctx = currentRenderingInstance;
8851
8864
  } else if (slotFlag === 3 && currentRenderingInstance) {
8852
8865
  if (currentRenderingInstance.slots._ === 1) {
@@ -9067,7 +9080,7 @@ Component that was made reactive: `,
9067
9080
  }
9068
9081
  }
9069
9082
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9070
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9083
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9071
9084
  {
9072
9085
  exposePropsOnRenderContext(instance);
9073
9086
  }
@@ -9199,26 +9212,21 @@ Component that was made reactive: `,
9199
9212
  }
9200
9213
  }
9201
9214
  }
9202
- function getAttrsProxy(instance) {
9203
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
9204
- instance.attrs,
9205
- {
9206
- get(target, key) {
9207
- markAttrsAccessed();
9208
- track(instance, "get", "$attrs");
9209
- return target[key];
9210
- },
9211
- set() {
9212
- warn$1(`setupContext.attrs is readonly.`);
9213
- return false;
9214
- },
9215
- deleteProperty() {
9216
- warn$1(`setupContext.attrs is readonly.`);
9217
- return false;
9218
- }
9219
- }
9220
- ));
9221
- }
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
+ } ;
9222
9230
  function getSlotsProxy(instance) {
9223
9231
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9224
9232
  get(target, key) {
@@ -9252,9 +9260,10 @@ Component that was made reactive: `,
9252
9260
  instance.exposed = exposed || {};
9253
9261
  };
9254
9262
  {
9263
+ let attrsProxy;
9255
9264
  return Object.freeze({
9256
9265
  get attrs() {
9257
- return getAttrsProxy(instance);
9266
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9258
9267
  },
9259
9268
  get slots() {
9260
9269
  return getSlotsProxy(instance);
@@ -9599,7 +9608,7 @@ Component that was made reactive: `,
9599
9608
  return true;
9600
9609
  }
9601
9610
 
9602
- const version = "3.4.21";
9611
+ const version = "3.4.22";
9603
9612
  const warn = warn$1 ;
9604
9613
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9605
9614
  const devtools = devtools$1 ;
@@ -10025,8 +10034,8 @@ Component that was made reactive: `,
10025
10034
  setVarsOnVNode(instance.subTree, vars);
10026
10035
  updateTeleports(vars);
10027
10036
  };
10028
- watchPostEffect(setVars);
10029
10037
  onMounted(() => {
10038
+ watchPostEffect(setVars);
10030
10039
  const ob = new MutationObserver(setVars);
10031
10040
  ob.observe(instance.subTree.el.parentNode, { childList: true });
10032
10041
  onUnmounted(() => ob.disconnect());
@@ -10249,11 +10258,14 @@ Component that was made reactive: `,
10249
10258
  const invokers = el[veiKey] || (el[veiKey] = {});
10250
10259
  const existingInvoker = invokers[rawName];
10251
10260
  if (nextValue && existingInvoker) {
10252
- existingInvoker.value = nextValue;
10261
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10253
10262
  } else {
10254
10263
  const [name, options] = parseName(rawName);
10255
10264
  if (nextValue) {
10256
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10265
+ const invoker = invokers[rawName] = createInvoker(
10266
+ sanitizeEventValue(nextValue, rawName) ,
10267
+ instance
10268
+ );
10257
10269
  addEventListener(el, name, invoker, options);
10258
10270
  } else if (existingInvoker) {
10259
10271
  removeEventListener(el, name, existingInvoker, options);
@@ -10296,6 +10308,16 @@ Component that was made reactive: `,
10296
10308
  invoker.attached = getNow();
10297
10309
  return invoker;
10298
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
+ }
10299
10321
  function patchStopImmediatePropagation(e, value) {
10300
10322
  if (isArray(value)) {
10301
10323
  const originalStop = e.stopImmediatePropagation;
@@ -10303,7 +10325,9 @@ Component that was made reactive: `,
10303
10325
  originalStop.call(e);
10304
10326
  e._stopped = true;
10305
10327
  };
10306
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10328
+ return value.map(
10329
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10330
+ );
10307
10331
  } else {
10308
10332
  return value;
10309
10333
  }
@@ -10504,7 +10528,7 @@ Component that was made reactive: `,
10504
10528
  }
10505
10529
  }
10506
10530
  _setAttr(key) {
10507
- let value = this.getAttribute(key);
10531
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10508
10532
  const camelKey = camelize(key);
10509
10533
  if (this._numberProps && this._numberProps[camelKey]) {
10510
10534
  value = toNumber(value);
@@ -10658,7 +10682,28 @@ Component that was made reactive: `,
10658
10682
  const rawProps = toRaw(props);
10659
10683
  const cssTransitionProps = resolveTransitionProps(rawProps);
10660
10684
  let tag = rawProps.tag || Fragment;
10661
- 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
+ }
10662
10707
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10663
10708
  for (let i = 0; i < children.length; i++) {
10664
10709
  const child = children[i];
@@ -10671,16 +10716,6 @@ Component that was made reactive: `,
10671
10716
  warn(`<TransitionGroup> children must be keyed.`);
10672
10717
  }
10673
10718
  }
10674
- if (prevChildren) {
10675
- for (let i = 0; i < prevChildren.length; i++) {
10676
- const child = prevChildren[i];
10677
- setTransitionHooks(
10678
- child,
10679
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
10680
- );
10681
- positionMap.set(child, child.el.getBoundingClientRect());
10682
- }
10683
- }
10684
10719
  return createVNode(tag, null, children);
10685
10720
  };
10686
10721
  }
@@ -10779,7 +10814,7 @@ Component that was made reactive: `,
10779
10814
  el[assignKey] = getModelAssigner(vnode);
10780
10815
  if (el.composing)
10781
10816
  return;
10782
- 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;
10783
10818
  const newValue = value == null ? "" : value;
10784
10819
  if (elValue === newValue) {
10785
10820
  return;
@@ -10882,14 +10917,14 @@ Component that was made reactive: `,
10882
10917
  // set value in mounted & updated because <select> relies on its children
10883
10918
  // <option>s.
10884
10919
  mounted(el, { value, modifiers: { number } }) {
10885
- setSelected(el, value, number);
10920
+ setSelected(el, value);
10886
10921
  },
10887
10922
  beforeUpdate(el, _binding, vnode) {
10888
10923
  el[assignKey] = getModelAssigner(vnode);
10889
10924
  },
10890
10925
  updated(el, { value, modifiers: { number } }) {
10891
10926
  if (!el._assigning) {
10892
- setSelected(el, value, number);
10927
+ setSelected(el, value);
10893
10928
  }
10894
10929
  }
10895
10930
  };
@@ -10909,9 +10944,7 @@ Component that was made reactive: `,
10909
10944
  if (isArrayValue) {
10910
10945
  const optionType = typeof optionValue;
10911
10946
  if (optionType === "string" || optionType === "number") {
10912
- option.selected = value.includes(
10913
- number ? looseToNumber(optionValue) : optionValue
10914
- );
10947
+ option.selected = value.some((v) => String(v) === String(optionValue));
10915
10948
  } else {
10916
10949
  option.selected = looseIndexOf(value, optionValue) > -1;
10917
10950
  }
@@ -12924,7 +12957,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12924
12957
  if (isImplied) {
12925
12958
  setLocEnd(el.loc, backTrack(end, 60));
12926
12959
  } else {
12927
- setLocEnd(el.loc, end + 1);
12960
+ setLocEnd(el.loc, lookAhead(end, 62) + 1);
12928
12961
  }
12929
12962
  if (tokenizer.inSFCRoot) {
12930
12963
  if (el.children.length) {
@@ -12961,6 +12994,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12961
12994
  tokenizer.inXML = false;
12962
12995
  }
12963
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
+ }
12964
13003
  function backTrack(index, c) {
12965
13004
  let i = index;
12966
13005
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -15112,10 +15151,24 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15112
15151
  function resolveComponentType(node, context, ssr = false) {
15113
15152
  let { tag } = node;
15114
15153
  const isExplicitDynamic = isComponentTag(tag);
15115
- const isProp = findProp(node, "is");
15154
+ const isProp = findProp(
15155
+ node,
15156
+ "is",
15157
+ false,
15158
+ true
15159
+ /* allow empty */
15160
+ );
15116
15161
  if (isProp) {
15117
15162
  if (isExplicitDynamic || false) {
15118
- 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
+ }
15119
15172
  if (exp) {
15120
15173
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15121
15174
  exp