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.
package/dist/vue.cjs.js CHANGED
@@ -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,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,8 +1,10 @@
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
+ /*! #__NO_SIDE_EFFECTS__ */
7
+ // @__NO_SIDE_EFFECTS__
6
8
  function makeMap(str, expectsLowerCase) {
7
9
  const set = new Set(str.split(","));
8
10
  return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
@@ -354,7 +356,11 @@ const replacer = (_key, val) => {
354
356
  };
355
357
  const stringifySymbol = (v, i = "") => {
356
358
  var _a;
357
- return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
359
+ return (
360
+ // Symbol.description in es2019+ so we need to cast here to pass
361
+ // the lib: es2016 check
362
+ isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
363
+ );
358
364
  };
359
365
 
360
366
  function warn$2(msg, ...args) {
@@ -790,6 +796,8 @@ function createArrayInstrumentations() {
790
796
  return instrumentations;
791
797
  }
792
798
  function hasOwnProperty(key) {
799
+ if (!isSymbol(key))
800
+ key = String(key);
793
801
  const obj = toRaw(this);
794
802
  track(obj, "has", key);
795
803
  return obj.hasOwnProperty(key);
@@ -1142,23 +1150,16 @@ function createInstrumentations() {
1142
1150
  clear: createReadonlyMethod("clear"),
1143
1151
  forEach: createForEach(true, true)
1144
1152
  };
1145
- const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
1153
+ const iteratorMethods = [
1154
+ "keys",
1155
+ "values",
1156
+ "entries",
1157
+ Symbol.iterator
1158
+ ];
1146
1159
  iteratorMethods.forEach((method) => {
1147
- mutableInstrumentations2[method] = createIterableMethod(
1148
- method,
1149
- false,
1150
- false
1151
- );
1152
- readonlyInstrumentations2[method] = createIterableMethod(
1153
- method,
1154
- true,
1155
- false
1156
- );
1157
- shallowInstrumentations2[method] = createIterableMethod(
1158
- method,
1159
- false,
1160
- true
1161
- );
1160
+ mutableInstrumentations2[method] = createIterableMethod(method, false, false);
1161
+ readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
1162
+ shallowInstrumentations2[method] = createIterableMethod(method, false, true);
1162
1163
  shallowReadonlyInstrumentations2[method] = createIterableMethod(
1163
1164
  method,
1164
1165
  true,
@@ -1315,7 +1316,7 @@ function isShallow(value) {
1315
1316
  return !!(value && value["__v_isShallow"]);
1316
1317
  }
1317
1318
  function isProxy(value) {
1318
- return isReactive(value) || isReadonly(value);
1319
+ return value ? !!value["__v_raw"] : false;
1319
1320
  }
1320
1321
  function toRaw(observed) {
1321
1322
  const raw = observed && observed["__v_raw"];
@@ -1777,11 +1778,17 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
1777
1778
  }
1778
1779
  return res;
1779
1780
  }
1780
- const values = [];
1781
- for (let i = 0; i < fn.length; i++) {
1782
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1781
+ if (isArray(fn)) {
1782
+ const values = [];
1783
+ for (let i = 0; i < fn.length; i++) {
1784
+ values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1785
+ }
1786
+ return values;
1787
+ } else {
1788
+ warn$1(
1789
+ `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
1790
+ );
1783
1791
  }
1784
- return values;
1785
1792
  }
1786
1793
  function handleError(err, instance, type, throwInDev = true) {
1787
1794
  const contextVNode = instance ? instance.vnode : null;
@@ -1802,12 +1809,14 @@ function handleError(err, instance, type, throwInDev = true) {
1802
1809
  }
1803
1810
  const appErrorHandler = instance.appContext.config.errorHandler;
1804
1811
  if (appErrorHandler) {
1812
+ pauseTracking();
1805
1813
  callWithErrorHandling(
1806
1814
  appErrorHandler,
1807
1815
  null,
1808
1816
  10,
1809
1817
  [err, exposedInstance, errorInfo]
1810
1818
  );
1819
+ resetTracking();
1811
1820
  return;
1812
1821
  }
1813
1822
  }
@@ -2183,6 +2192,8 @@ const devtoolsComponentRemoved = (component) => {
2183
2192
  _devtoolsComponentRemoved(component);
2184
2193
  }
2185
2194
  };
2195
+ /*! #__NO_SIDE_EFFECTS__ */
2196
+ // @__NO_SIDE_EFFECTS__
2186
2197
  function createDevtoolsComponentHook(hook) {
2187
2198
  return (component) => {
2188
2199
  emit$1(
@@ -4259,7 +4270,7 @@ const KeepAliveImpl = {
4259
4270
  return () => {
4260
4271
  pendingCacheKey = null;
4261
4272
  if (!slots.default) {
4262
- return null;
4273
+ return current = null;
4263
4274
  }
4264
4275
  const children = slots.default();
4265
4276
  const rawVNode = children[0];
@@ -4572,6 +4583,9 @@ const isReservedPrefix = (key) => key === "_" || key === "$";
4572
4583
  const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4573
4584
  const PublicInstanceProxyHandlers = {
4574
4585
  get({ _: instance }, key) {
4586
+ if (key === "__v_skip") {
4587
+ return true;
4588
+ }
4575
4589
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4576
4590
  if (key === "__isVue") {
4577
4591
  return true;
@@ -5539,10 +5553,10 @@ function hasInjectionContext() {
5539
5553
  return !!(currentInstance || currentRenderingInstance || currentApp);
5540
5554
  }
5541
5555
 
5556
+ const attrsProto = {};
5542
5557
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5543
5558
  const props = {};
5544
- const attrs = {};
5545
- def(attrs, InternalObjectKey, 1);
5559
+ const attrs = Object.create(attrsProto);
5546
5560
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5547
5561
  setFullProps(instance, rawProps, props, attrs);
5548
5562
  for (const key in instance.propsOptions[0]) {
@@ -5657,7 +5671,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5657
5671
  }
5658
5672
  }
5659
5673
  if (hasAttrsChanged) {
5660
- trigger(instance, "set", "$attrs");
5674
+ trigger(instance.attrs, "set", "");
5661
5675
  }
5662
5676
  {
5663
5677
  validateProps(rawProps || {}, props, instance);
@@ -5993,7 +6007,7 @@ const initSlots = (instance, children) => {
5993
6007
  const type = children._;
5994
6008
  if (type) {
5995
6009
  instance.slots = toRaw(children);
5996
- def(children, "_", type);
6010
+ def(instance.slots, "_", type);
5997
6011
  } else {
5998
6012
  normalizeObjectSlots(
5999
6013
  children,
@@ -6005,7 +6019,6 @@ const initSlots = (instance, children) => {
6005
6019
  normalizeVNodeSlots(instance, children);
6006
6020
  }
6007
6021
  }
6008
- def(instance.slots, InternalObjectKey, 1);
6009
6022
  };
6010
6023
  const updateSlots = (instance, children, optimized) => {
6011
6024
  const { vnode, slots } = instance;
@@ -6177,6 +6190,7 @@ function createHydrationFunctions(rendererInternals) {
6177
6190
  }
6178
6191
  };
6179
6192
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6193
+ optimized = optimized || !!vnode.dynamicChildren;
6180
6194
  const isFragmentStart = isComment(node) && node.data === "[";
6181
6195
  const onMismatch = () => handleMismatch(
6182
6196
  node,
@@ -8611,7 +8625,6 @@ const createVNodeWithArgsTransform = (...args) => {
8611
8625
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8612
8626
  );
8613
8627
  };
8614
- const InternalObjectKey = `__vInternal`;
8615
8628
  const normalizeKey = ({ key }) => key != null ? key : null;
8616
8629
  const normalizeRef = ({
8617
8630
  ref,
@@ -8744,7 +8757,7 @@ Component that was made reactive: `,
8744
8757
  function guardReactiveProps(props) {
8745
8758
  if (!props)
8746
8759
  return null;
8747
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8760
+ return isProxy(props) || Object.getPrototypeOf(props) === attrsProto ? extend({}, props) : props;
8748
8761
  }
8749
8762
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8750
8763
  const { props, ref, patchFlag, children } = vnode;
@@ -8849,7 +8862,7 @@ function normalizeChildren(vnode, children) {
8849
8862
  } else {
8850
8863
  type = 32;
8851
8864
  const slotFlag = children._;
8852
- if (!slotFlag && !(InternalObjectKey in children)) {
8865
+ if (!slotFlag) {
8853
8866
  children._ctx = currentRenderingInstance;
8854
8867
  } else if (slotFlag === 3 && currentRenderingInstance) {
8855
8868
  if (currentRenderingInstance.slots._ === 1) {
@@ -9070,7 +9083,7 @@ function setupStatefulComponent(instance, isSSR) {
9070
9083
  }
9071
9084
  }
9072
9085
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9073
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9086
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9074
9087
  {
9075
9088
  exposePropsOnRenderContext(instance);
9076
9089
  }
@@ -9202,26 +9215,21 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9202
9215
  }
9203
9216
  }
9204
9217
  }
9205
- function getAttrsProxy(instance) {
9206
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
9207
- instance.attrs,
9208
- {
9209
- get(target, key) {
9210
- markAttrsAccessed();
9211
- track(instance, "get", "$attrs");
9212
- return target[key];
9213
- },
9214
- set() {
9215
- warn$1(`setupContext.attrs is readonly.`);
9216
- return false;
9217
- },
9218
- deleteProperty() {
9219
- warn$1(`setupContext.attrs is readonly.`);
9220
- return false;
9221
- }
9222
- }
9223
- ));
9224
- }
9218
+ const attrsProxyHandlers = {
9219
+ get(target, key) {
9220
+ markAttrsAccessed();
9221
+ track(target, "get", "");
9222
+ return target[key];
9223
+ },
9224
+ set() {
9225
+ warn$1(`setupContext.attrs is readonly.`);
9226
+ return false;
9227
+ },
9228
+ deleteProperty() {
9229
+ warn$1(`setupContext.attrs is readonly.`);
9230
+ return false;
9231
+ }
9232
+ } ;
9225
9233
  function getSlotsProxy(instance) {
9226
9234
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9227
9235
  get(target, key) {
@@ -9255,9 +9263,10 @@ function createSetupContext(instance) {
9255
9263
  instance.exposed = exposed || {};
9256
9264
  };
9257
9265
  {
9266
+ let attrsProxy;
9258
9267
  return Object.freeze({
9259
9268
  get attrs() {
9260
- return getAttrsProxy(instance);
9269
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9261
9270
  },
9262
9271
  get slots() {
9263
9272
  return getSlotsProxy(instance);
@@ -9602,7 +9611,7 @@ function isMemoSame(cached, memo) {
9602
9611
  return true;
9603
9612
  }
9604
9613
 
9605
- const version = "3.4.21";
9614
+ const version = "3.4.22";
9606
9615
  const warn = warn$1 ;
9607
9616
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9608
9617
  const devtools = devtools$1 ;
@@ -10028,8 +10037,8 @@ function useCssVars(getter) {
10028
10037
  setVarsOnVNode(instance.subTree, vars);
10029
10038
  updateTeleports(vars);
10030
10039
  };
10031
- watchPostEffect(setVars);
10032
10040
  onMounted(() => {
10041
+ watchPostEffect(setVars);
10033
10042
  const ob = new MutationObserver(setVars);
10034
10043
  ob.observe(instance.subTree.el.parentNode, { childList: true });
10035
10044
  onUnmounted(() => ob.disconnect());
@@ -10252,11 +10261,14 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10252
10261
  const invokers = el[veiKey] || (el[veiKey] = {});
10253
10262
  const existingInvoker = invokers[rawName];
10254
10263
  if (nextValue && existingInvoker) {
10255
- existingInvoker.value = nextValue;
10264
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10256
10265
  } else {
10257
10266
  const [name, options] = parseName(rawName);
10258
10267
  if (nextValue) {
10259
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10268
+ const invoker = invokers[rawName] = createInvoker(
10269
+ sanitizeEventValue(nextValue, rawName) ,
10270
+ instance
10271
+ );
10260
10272
  addEventListener(el, name, invoker, options);
10261
10273
  } else if (existingInvoker) {
10262
10274
  removeEventListener(el, name, existingInvoker, options);
@@ -10299,6 +10311,16 @@ function createInvoker(initialValue, instance) {
10299
10311
  invoker.attached = getNow();
10300
10312
  return invoker;
10301
10313
  }
10314
+ function sanitizeEventValue(value, propName) {
10315
+ if (isFunction(value) || isArray(value)) {
10316
+ return value;
10317
+ }
10318
+ warn(
10319
+ `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
10320
+ Expected function or array of functions, received type ${typeof value}.`
10321
+ );
10322
+ return NOOP;
10323
+ }
10302
10324
  function patchStopImmediatePropagation(e, value) {
10303
10325
  if (isArray(value)) {
10304
10326
  const originalStop = e.stopImmediatePropagation;
@@ -10306,7 +10328,9 @@ function patchStopImmediatePropagation(e, value) {
10306
10328
  originalStop.call(e);
10307
10329
  e._stopped = true;
10308
10330
  };
10309
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10331
+ return value.map(
10332
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10333
+ );
10310
10334
  } else {
10311
10335
  return value;
10312
10336
  }
@@ -10507,7 +10531,7 @@ class VueElement extends BaseClass {
10507
10531
  }
10508
10532
  }
10509
10533
  _setAttr(key) {
10510
- let value = this.getAttribute(key);
10534
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10511
10535
  const camelKey = camelize(key);
10512
10536
  if (this._numberProps && this._numberProps[camelKey]) {
10513
10537
  value = toNumber(value);
@@ -10673,7 +10697,28 @@ const TransitionGroupImpl = {
10673
10697
  const rawProps = toRaw(props);
10674
10698
  const cssTransitionProps = resolveTransitionProps(rawProps);
10675
10699
  let tag = rawProps.tag || Fragment;
10676
- prevChildren = children;
10700
+ prevChildren = [];
10701
+ if (children) {
10702
+ for (let i = 0; i < children.length; i++) {
10703
+ const child = children[i];
10704
+ if (child.el && child.el instanceof Element) {
10705
+ prevChildren.push(child);
10706
+ setTransitionHooks(
10707
+ child,
10708
+ resolveTransitionHooks(
10709
+ child,
10710
+ cssTransitionProps,
10711
+ state,
10712
+ instance
10713
+ )
10714
+ );
10715
+ positionMap.set(
10716
+ child,
10717
+ child.el.getBoundingClientRect()
10718
+ );
10719
+ }
10720
+ }
10721
+ }
10677
10722
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10678
10723
  for (let i = 0; i < children.length; i++) {
10679
10724
  const child = children[i];
@@ -10686,16 +10731,6 @@ const TransitionGroupImpl = {
10686
10731
  warn(`<TransitionGroup> children must be keyed.`);
10687
10732
  }
10688
10733
  }
10689
- if (prevChildren) {
10690
- for (let i = 0; i < prevChildren.length; i++) {
10691
- const child = prevChildren[i];
10692
- setTransitionHooks(
10693
- child,
10694
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
10695
- );
10696
- positionMap.set(child, child.el.getBoundingClientRect());
10697
- }
10698
- }
10699
10734
  return createVNode(tag, null, children);
10700
10735
  };
10701
10736
  }
@@ -10794,7 +10829,7 @@ const vModelText = {
10794
10829
  el[assignKey] = getModelAssigner(vnode);
10795
10830
  if (el.composing)
10796
10831
  return;
10797
- const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10832
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10798
10833
  const newValue = value == null ? "" : value;
10799
10834
  if (elValue === newValue) {
10800
10835
  return;
@@ -10897,14 +10932,14 @@ const vModelSelect = {
10897
10932
  // set value in mounted & updated because <select> relies on its children
10898
10933
  // <option>s.
10899
10934
  mounted(el, { value, modifiers: { number } }) {
10900
- setSelected(el, value, number);
10935
+ setSelected(el, value);
10901
10936
  },
10902
10937
  beforeUpdate(el, _binding, vnode) {
10903
10938
  el[assignKey] = getModelAssigner(vnode);
10904
10939
  },
10905
10940
  updated(el, { value, modifiers: { number } }) {
10906
10941
  if (!el._assigning) {
10907
- setSelected(el, value, number);
10942
+ setSelected(el, value);
10908
10943
  }
10909
10944
  }
10910
10945
  };
@@ -10924,9 +10959,7 @@ function setSelected(el, value, number) {
10924
10959
  if (isArrayValue) {
10925
10960
  const optionType = typeof optionValue;
10926
10961
  if (optionType === "string" || optionType === "number") {
10927
- option.selected = value.includes(
10928
- number ? looseToNumber(optionValue) : optionValue
10929
- );
10962
+ option.selected = value.some((v) => String(v) === String(optionValue));
10930
10963
  } else {
10931
10964
  option.selected = looseIndexOf(value, optionValue) > -1;
10932
10965
  }
@@ -13101,7 +13134,7 @@ function onCloseTag(el, end, isImplied = false) {
13101
13134
  if (isImplied) {
13102
13135
  setLocEnd(el.loc, backTrack(end, 60));
13103
13136
  } else {
13104
- setLocEnd(el.loc, end + 1);
13137
+ setLocEnd(el.loc, lookAhead(end, 62) + 1);
13105
13138
  }
13106
13139
  if (tokenizer.inSFCRoot) {
13107
13140
  if (el.children.length) {
@@ -13138,6 +13171,12 @@ function onCloseTag(el, end, isImplied = false) {
13138
13171
  tokenizer.inXML = false;
13139
13172
  }
13140
13173
  }
13174
+ function lookAhead(index, c) {
13175
+ let i = index;
13176
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
13177
+ i++;
13178
+ return i;
13179
+ }
13141
13180
  function backTrack(index, c) {
13142
13181
  let i = index;
13143
13182
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -15289,10 +15328,24 @@ const transformElement = (node, context) => {
15289
15328
  function resolveComponentType(node, context, ssr = false) {
15290
15329
  let { tag } = node;
15291
15330
  const isExplicitDynamic = isComponentTag(tag);
15292
- const isProp = findProp(node, "is");
15331
+ const isProp = findProp(
15332
+ node,
15333
+ "is",
15334
+ false,
15335
+ true
15336
+ /* allow empty */
15337
+ );
15293
15338
  if (isProp) {
15294
15339
  if (isExplicitDynamic || false) {
15295
- const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
15340
+ let exp;
15341
+ if (isProp.type === 6) {
15342
+ exp = isProp.value && createSimpleExpression(isProp.value.content, true);
15343
+ } else {
15344
+ exp = isProp.exp;
15345
+ if (!exp) {
15346
+ exp = createSimpleExpression(`is`, false, isProp.loc);
15347
+ }
15348
+ }
15296
15349
  if (exp) {
15297
15350
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15298
15351
  exp