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.
package/dist/vue.cjs.js CHANGED
@@ -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,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,8 +1,10 @@
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
+ /*! #__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"];
@@ -1598,7 +1599,10 @@ function warn$1(msg, ...args) {
1598
1599
  instance,
1599
1600
  11,
1600
1601
  [
1601
- msg + args.join(""),
1602
+ msg + args.map((a) => {
1603
+ var _a, _b;
1604
+ return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1605
+ }).join(""),
1602
1606
  instance && instance.proxy,
1603
1607
  trace.map(
1604
1608
  ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -1774,11 +1778,17 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
1774
1778
  }
1775
1779
  return res;
1776
1780
  }
1777
- const values = [];
1778
- for (let i = 0; i < fn.length; i++) {
1779
- 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
+ );
1780
1791
  }
1781
- return values;
1782
1792
  }
1783
1793
  function handleError(err, instance, type, throwInDev = true) {
1784
1794
  const contextVNode = instance ? instance.vnode : null;
@@ -1799,12 +1809,14 @@ function handleError(err, instance, type, throwInDev = true) {
1799
1809
  }
1800
1810
  const appErrorHandler = instance.appContext.config.errorHandler;
1801
1811
  if (appErrorHandler) {
1812
+ pauseTracking();
1802
1813
  callWithErrorHandling(
1803
1814
  appErrorHandler,
1804
1815
  null,
1805
1816
  10,
1806
1817
  [err, exposedInstance, errorInfo]
1807
1818
  );
1819
+ resetTracking();
1808
1820
  return;
1809
1821
  }
1810
1822
  }
@@ -2180,6 +2192,8 @@ const devtoolsComponentRemoved = (component) => {
2180
2192
  _devtoolsComponentRemoved(component);
2181
2193
  }
2182
2194
  };
2195
+ /*! #__NO_SIDE_EFFECTS__ */
2196
+ // @__NO_SIDE_EFFECTS__
2183
2197
  function createDevtoolsComponentHook(hook) {
2184
2198
  return (component) => {
2185
2199
  emit$1(
@@ -2765,7 +2779,7 @@ const SuspenseImpl = {
2765
2779
  rendererInternals
2766
2780
  );
2767
2781
  } else {
2768
- if (parentSuspense && parentSuspense.deps > 0) {
2782
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
2769
2783
  n2.suspense = n1.suspense;
2770
2784
  n2.suspense.vnode = n2;
2771
2785
  n2.el = n1.el;
@@ -4256,7 +4270,7 @@ const KeepAliveImpl = {
4256
4270
  return () => {
4257
4271
  pendingCacheKey = null;
4258
4272
  if (!slots.default) {
4259
- return null;
4273
+ return current = null;
4260
4274
  }
4261
4275
  const children = slots.default();
4262
4276
  const rawVNode = children[0];
@@ -4569,6 +4583,9 @@ const isReservedPrefix = (key) => key === "_" || key === "$";
4569
4583
  const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4570
4584
  const PublicInstanceProxyHandlers = {
4571
4585
  get({ _: instance }, key) {
4586
+ if (key === "__v_skip") {
4587
+ return true;
4588
+ }
4572
4589
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4573
4590
  if (key === "__isVue") {
4574
4591
  return true;
@@ -5536,10 +5553,10 @@ function hasInjectionContext() {
5536
5553
  return !!(currentInstance || currentRenderingInstance || currentApp);
5537
5554
  }
5538
5555
 
5556
+ const attrsProto = {};
5539
5557
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5540
5558
  const props = {};
5541
- const attrs = {};
5542
- def(attrs, InternalObjectKey, 1);
5559
+ const attrs = Object.create(attrsProto);
5543
5560
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5544
5561
  setFullProps(instance, rawProps, props, attrs);
5545
5562
  for (const key in instance.propsOptions[0]) {
@@ -5654,7 +5671,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5654
5671
  }
5655
5672
  }
5656
5673
  if (hasAttrsChanged) {
5657
- trigger(instance, "set", "$attrs");
5674
+ trigger(instance.attrs, "set", "");
5658
5675
  }
5659
5676
  {
5660
5677
  validateProps(rawProps || {}, props, instance);
@@ -5990,7 +6007,7 @@ const initSlots = (instance, children) => {
5990
6007
  const type = children._;
5991
6008
  if (type) {
5992
6009
  instance.slots = toRaw(children);
5993
- def(children, "_", type);
6010
+ def(instance.slots, "_", type);
5994
6011
  } else {
5995
6012
  normalizeObjectSlots(
5996
6013
  children,
@@ -6002,7 +6019,6 @@ const initSlots = (instance, children) => {
6002
6019
  normalizeVNodeSlots(instance, children);
6003
6020
  }
6004
6021
  }
6005
- def(instance.slots, InternalObjectKey, 1);
6006
6022
  };
6007
6023
  const updateSlots = (instance, children, optimized) => {
6008
6024
  const { vnode, slots } = instance;
@@ -6174,6 +6190,7 @@ function createHydrationFunctions(rendererInternals) {
6174
6190
  }
6175
6191
  };
6176
6192
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6193
+ optimized = optimized || !!vnode.dynamicChildren;
6177
6194
  const isFragmentStart = isComment(node) && node.data === "[";
6178
6195
  const onMismatch = () => handleMismatch(
6179
6196
  node,
@@ -8608,7 +8625,6 @@ const createVNodeWithArgsTransform = (...args) => {
8608
8625
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8609
8626
  );
8610
8627
  };
8611
- const InternalObjectKey = `__vInternal`;
8612
8628
  const normalizeKey = ({ key }) => key != null ? key : null;
8613
8629
  const normalizeRef = ({
8614
8630
  ref,
@@ -8741,7 +8757,7 @@ Component that was made reactive: `,
8741
8757
  function guardReactiveProps(props) {
8742
8758
  if (!props)
8743
8759
  return null;
8744
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8760
+ return isProxy(props) || Object.getPrototypeOf(props) === attrsProto ? extend({}, props) : props;
8745
8761
  }
8746
8762
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8747
8763
  const { props, ref, patchFlag, children } = vnode;
@@ -8846,7 +8862,7 @@ function normalizeChildren(vnode, children) {
8846
8862
  } else {
8847
8863
  type = 32;
8848
8864
  const slotFlag = children._;
8849
- if (!slotFlag && !(InternalObjectKey in children)) {
8865
+ if (!slotFlag) {
8850
8866
  children._ctx = currentRenderingInstance;
8851
8867
  } else if (slotFlag === 3 && currentRenderingInstance) {
8852
8868
  if (currentRenderingInstance.slots._ === 1) {
@@ -9067,7 +9083,7 @@ function setupStatefulComponent(instance, isSSR) {
9067
9083
  }
9068
9084
  }
9069
9085
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9070
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9086
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9071
9087
  {
9072
9088
  exposePropsOnRenderContext(instance);
9073
9089
  }
@@ -9199,26 +9215,21 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9199
9215
  }
9200
9216
  }
9201
9217
  }
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
- }
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
+ } ;
9222
9233
  function getSlotsProxy(instance) {
9223
9234
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9224
9235
  get(target, key) {
@@ -9252,9 +9263,10 @@ function createSetupContext(instance) {
9252
9263
  instance.exposed = exposed || {};
9253
9264
  };
9254
9265
  {
9266
+ let attrsProxy;
9255
9267
  return Object.freeze({
9256
9268
  get attrs() {
9257
- return getAttrsProxy(instance);
9269
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9258
9270
  },
9259
9271
  get slots() {
9260
9272
  return getSlotsProxy(instance);
@@ -9599,7 +9611,7 @@ function isMemoSame(cached, memo) {
9599
9611
  return true;
9600
9612
  }
9601
9613
 
9602
- const version = "3.4.20";
9614
+ const version = "3.4.22";
9603
9615
  const warn = warn$1 ;
9604
9616
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9605
9617
  const devtools = devtools$1 ;
@@ -10025,8 +10037,8 @@ function useCssVars(getter) {
10025
10037
  setVarsOnVNode(instance.subTree, vars);
10026
10038
  updateTeleports(vars);
10027
10039
  };
10028
- watchPostEffect(setVars);
10029
10040
  onMounted(() => {
10041
+ watchPostEffect(setVars);
10030
10042
  const ob = new MutationObserver(setVars);
10031
10043
  ob.observe(instance.subTree.el.parentNode, { childList: true });
10032
10044
  onUnmounted(() => ob.disconnect());
@@ -10201,15 +10213,15 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
10201
10213
  const tag = el.tagName;
10202
10214
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
10203
10215
  !tag.includes("-")) {
10204
- el._value = value;
10205
10216
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
10206
10217
  const newValue = value == null ? "" : value;
10207
- if (oldValue !== newValue) {
10218
+ if (oldValue !== newValue || !("_value" in el)) {
10208
10219
  el.value = newValue;
10209
10220
  }
10210
10221
  if (value == null) {
10211
10222
  el.removeAttribute(key);
10212
10223
  }
10224
+ el._value = value;
10213
10225
  return;
10214
10226
  }
10215
10227
  let needRemove = false;
@@ -10249,11 +10261,14 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10249
10261
  const invokers = el[veiKey] || (el[veiKey] = {});
10250
10262
  const existingInvoker = invokers[rawName];
10251
10263
  if (nextValue && existingInvoker) {
10252
- existingInvoker.value = nextValue;
10264
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10253
10265
  } else {
10254
10266
  const [name, options] = parseName(rawName);
10255
10267
  if (nextValue) {
10256
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10268
+ const invoker = invokers[rawName] = createInvoker(
10269
+ sanitizeEventValue(nextValue, rawName) ,
10270
+ instance
10271
+ );
10257
10272
  addEventListener(el, name, invoker, options);
10258
10273
  } else if (existingInvoker) {
10259
10274
  removeEventListener(el, name, existingInvoker, options);
@@ -10296,6 +10311,16 @@ function createInvoker(initialValue, instance) {
10296
10311
  invoker.attached = getNow();
10297
10312
  return invoker;
10298
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
+ }
10299
10324
  function patchStopImmediatePropagation(e, value) {
10300
10325
  if (isArray(value)) {
10301
10326
  const originalStop = e.stopImmediatePropagation;
@@ -10303,7 +10328,9 @@ function patchStopImmediatePropagation(e, value) {
10303
10328
  originalStop.call(e);
10304
10329
  e._stopped = true;
10305
10330
  };
10306
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10331
+ return value.map(
10332
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10333
+ );
10307
10334
  } else {
10308
10335
  return value;
10309
10336
  }
@@ -10504,7 +10531,7 @@ class VueElement extends BaseClass {
10504
10531
  }
10505
10532
  }
10506
10533
  _setAttr(key) {
10507
- let value = this.getAttribute(key);
10534
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10508
10535
  const camelKey = camelize(key);
10509
10536
  if (this._numberProps && this._numberProps[camelKey]) {
10510
10537
  value = toNumber(value);
@@ -10670,7 +10697,28 @@ const TransitionGroupImpl = {
10670
10697
  const rawProps = toRaw(props);
10671
10698
  const cssTransitionProps = resolveTransitionProps(rawProps);
10672
10699
  let tag = rawProps.tag || Fragment;
10673
- 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
+ }
10674
10722
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10675
10723
  for (let i = 0; i < children.length; i++) {
10676
10724
  const child = children[i];
@@ -10683,16 +10731,6 @@ const TransitionGroupImpl = {
10683
10731
  warn(`<TransitionGroup> children must be keyed.`);
10684
10732
  }
10685
10733
  }
10686
- if (prevChildren) {
10687
- for (let i = 0; i < prevChildren.length; i++) {
10688
- const child = prevChildren[i];
10689
- setTransitionHooks(
10690
- child,
10691
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
10692
- );
10693
- positionMap.set(child, child.el.getBoundingClientRect());
10694
- }
10695
- }
10696
10734
  return createVNode(tag, null, children);
10697
10735
  };
10698
10736
  }
@@ -10791,7 +10829,7 @@ const vModelText = {
10791
10829
  el[assignKey] = getModelAssigner(vnode);
10792
10830
  if (el.composing)
10793
10831
  return;
10794
- 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;
10795
10833
  const newValue = value == null ? "" : value;
10796
10834
  if (elValue === newValue) {
10797
10835
  return;
@@ -10894,14 +10932,14 @@ const vModelSelect = {
10894
10932
  // set value in mounted & updated because <select> relies on its children
10895
10933
  // <option>s.
10896
10934
  mounted(el, { value, modifiers: { number } }) {
10897
- setSelected(el, value, number);
10935
+ setSelected(el, value);
10898
10936
  },
10899
10937
  beforeUpdate(el, _binding, vnode) {
10900
10938
  el[assignKey] = getModelAssigner(vnode);
10901
10939
  },
10902
10940
  updated(el, { value, modifiers: { number } }) {
10903
10941
  if (!el._assigning) {
10904
- setSelected(el, value, number);
10942
+ setSelected(el, value);
10905
10943
  }
10906
10944
  }
10907
10945
  };
@@ -10921,9 +10959,7 @@ function setSelected(el, value, number) {
10921
10959
  if (isArrayValue) {
10922
10960
  const optionType = typeof optionValue;
10923
10961
  if (optionType === "string" || optionType === "number") {
10924
- option.selected = value.includes(
10925
- number ? looseToNumber(optionValue) : optionValue
10926
- );
10962
+ option.selected = value.some((v) => String(v) === String(optionValue));
10927
10963
  } else {
10928
10964
  option.selected = looseIndexOf(value, optionValue) > -1;
10929
10965
  }
@@ -13098,7 +13134,7 @@ function onCloseTag(el, end, isImplied = false) {
13098
13134
  if (isImplied) {
13099
13135
  setLocEnd(el.loc, backTrack(end, 60));
13100
13136
  } else {
13101
- setLocEnd(el.loc, end + 1);
13137
+ setLocEnd(el.loc, lookAhead(end, 62) + 1);
13102
13138
  }
13103
13139
  if (tokenizer.inSFCRoot) {
13104
13140
  if (el.children.length) {
@@ -13135,6 +13171,12 @@ function onCloseTag(el, end, isImplied = false) {
13135
13171
  tokenizer.inXML = false;
13136
13172
  }
13137
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
+ }
13138
13180
  function backTrack(index, c) {
13139
13181
  let i = index;
13140
13182
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -15286,10 +15328,24 @@ const transformElement = (node, context) => {
15286
15328
  function resolveComponentType(node, context, ssr = false) {
15287
15329
  let { tag } = node;
15288
15330
  const isExplicitDynamic = isComponentTag(tag);
15289
- const isProp = findProp(node, "is");
15331
+ const isProp = findProp(
15332
+ node,
15333
+ "is",
15334
+ false,
15335
+ true
15336
+ /* allow empty */
15337
+ );
15290
15338
  if (isProp) {
15291
15339
  if (isExplicitDynamic || false) {
15292
- 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
+ }
15293
15349
  if (exp) {
15294
15350
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15295
15351
  exp