vue 3.4.21 → 3.4.23

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.23
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.23
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.23
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;
@@ -4614,7 +4628,7 @@ const PublicInstanceProxyHandlers = {
4614
4628
  let cssModule, globalProperties;
4615
4629
  if (publicGetter) {
4616
4630
  if (key === "$attrs") {
4617
- track(instance, "get", key);
4631
+ track(instance.attrs, "get", "");
4618
4632
  markAttrsAccessed();
4619
4633
  } else if (key === "$slots") {
4620
4634
  track(instance, "get", key);
@@ -5539,10 +5553,13 @@ function hasInjectionContext() {
5539
5553
  return !!(currentInstance || currentRenderingInstance || currentApp);
5540
5554
  }
5541
5555
 
5556
+ const internalObjectProto = /* @__PURE__ */ Object.create(null);
5557
+ const createInternalObject = () => Object.create(internalObjectProto);
5558
+ const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
5559
+
5542
5560
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5543
5561
  const props = {};
5544
- const attrs = {};
5545
- def(attrs, InternalObjectKey, 1);
5562
+ const attrs = createInternalObject();
5546
5563
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5547
5564
  setFullProps(instance, rawProps, props, attrs);
5548
5565
  for (const key in instance.propsOptions[0]) {
@@ -5657,7 +5674,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5657
5674
  }
5658
5675
  }
5659
5676
  if (hasAttrsChanged) {
5660
- trigger(instance, "set", "$attrs");
5677
+ trigger(instance.attrs, "set", "");
5661
5678
  }
5662
5679
  {
5663
5680
  validateProps(rawProps || {}, props, instance);
@@ -5993,19 +6010,18 @@ const initSlots = (instance, children) => {
5993
6010
  const type = children._;
5994
6011
  if (type) {
5995
6012
  instance.slots = toRaw(children);
5996
- def(children, "_", type);
6013
+ def(instance.slots, "_", type);
5997
6014
  } else {
5998
6015
  normalizeObjectSlots(
5999
6016
  children,
6000
- instance.slots = {});
6017
+ instance.slots = createInternalObject());
6001
6018
  }
6002
6019
  } else {
6003
- instance.slots = {};
6020
+ instance.slots = createInternalObject();
6004
6021
  if (children) {
6005
6022
  normalizeVNodeSlots(instance, children);
6006
6023
  }
6007
6024
  }
6008
- def(instance.slots, InternalObjectKey, 1);
6009
6025
  };
6010
6026
  const updateSlots = (instance, children, optimized) => {
6011
6027
  const { vnode, slots } = instance;
@@ -6177,6 +6193,7 @@ function createHydrationFunctions(rendererInternals) {
6177
6193
  }
6178
6194
  };
6179
6195
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6196
+ optimized = optimized || !!vnode.dynamicChildren;
6180
6197
  const isFragmentStart = isComment(node) && node.data === "[";
6181
6198
  const onMismatch = () => handleMismatch(
6182
6199
  node,
@@ -8611,7 +8628,6 @@ const createVNodeWithArgsTransform = (...args) => {
8611
8628
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8612
8629
  );
8613
8630
  };
8614
- const InternalObjectKey = `__vInternal`;
8615
8631
  const normalizeKey = ({ key }) => key != null ? key : null;
8616
8632
  const normalizeRef = ({
8617
8633
  ref,
@@ -8744,7 +8760,7 @@ Component that was made reactive: `,
8744
8760
  function guardReactiveProps(props) {
8745
8761
  if (!props)
8746
8762
  return null;
8747
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8763
+ return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
8748
8764
  }
8749
8765
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8750
8766
  const { props, ref, patchFlag, children } = vnode;
@@ -8849,7 +8865,7 @@ function normalizeChildren(vnode, children) {
8849
8865
  } else {
8850
8866
  type = 32;
8851
8867
  const slotFlag = children._;
8852
- if (!slotFlag && !(InternalObjectKey in children)) {
8868
+ if (!slotFlag && !isInternalObject(children)) {
8853
8869
  children._ctx = currentRenderingInstance;
8854
8870
  } else if (slotFlag === 3 && currentRenderingInstance) {
8855
8871
  if (currentRenderingInstance.slots._ === 1) {
@@ -9070,7 +9086,7 @@ function setupStatefulComponent(instance, isSSR) {
9070
9086
  }
9071
9087
  }
9072
9088
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9073
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9089
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9074
9090
  {
9075
9091
  exposePropsOnRenderContext(instance);
9076
9092
  }
@@ -9202,26 +9218,21 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9202
9218
  }
9203
9219
  }
9204
9220
  }
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
- }
9221
+ const attrsProxyHandlers = {
9222
+ get(target, key) {
9223
+ markAttrsAccessed();
9224
+ track(target, "get", "");
9225
+ return target[key];
9226
+ },
9227
+ set() {
9228
+ warn$1(`setupContext.attrs is readonly.`);
9229
+ return false;
9230
+ },
9231
+ deleteProperty() {
9232
+ warn$1(`setupContext.attrs is readonly.`);
9233
+ return false;
9234
+ }
9235
+ } ;
9225
9236
  function getSlotsProxy(instance) {
9226
9237
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9227
9238
  get(target, key) {
@@ -9255,9 +9266,10 @@ function createSetupContext(instance) {
9255
9266
  instance.exposed = exposed || {};
9256
9267
  };
9257
9268
  {
9269
+ let attrsProxy;
9258
9270
  return Object.freeze({
9259
9271
  get attrs() {
9260
- return getAttrsProxy(instance);
9272
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9261
9273
  },
9262
9274
  get slots() {
9263
9275
  return getSlotsProxy(instance);
@@ -9602,7 +9614,7 @@ function isMemoSame(cached, memo) {
9602
9614
  return true;
9603
9615
  }
9604
9616
 
9605
- const version = "3.4.21";
9617
+ const version = "3.4.23";
9606
9618
  const warn = warn$1 ;
9607
9619
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9608
9620
  const devtools = devtools$1 ;
@@ -10028,8 +10040,8 @@ function useCssVars(getter) {
10028
10040
  setVarsOnVNode(instance.subTree, vars);
10029
10041
  updateTeleports(vars);
10030
10042
  };
10031
- watchPostEffect(setVars);
10032
10043
  onMounted(() => {
10044
+ watchPostEffect(setVars);
10033
10045
  const ob = new MutationObserver(setVars);
10034
10046
  ob.observe(instance.subTree.el.parentNode, { childList: true });
10035
10047
  onUnmounted(() => ob.disconnect());
@@ -10252,11 +10264,14 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
10252
10264
  const invokers = el[veiKey] || (el[veiKey] = {});
10253
10265
  const existingInvoker = invokers[rawName];
10254
10266
  if (nextValue && existingInvoker) {
10255
- existingInvoker.value = nextValue;
10267
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10256
10268
  } else {
10257
10269
  const [name, options] = parseName(rawName);
10258
10270
  if (nextValue) {
10259
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10271
+ const invoker = invokers[rawName] = createInvoker(
10272
+ sanitizeEventValue(nextValue, rawName) ,
10273
+ instance
10274
+ );
10260
10275
  addEventListener(el, name, invoker, options);
10261
10276
  } else if (existingInvoker) {
10262
10277
  removeEventListener(el, name, existingInvoker, options);
@@ -10299,6 +10314,16 @@ function createInvoker(initialValue, instance) {
10299
10314
  invoker.attached = getNow();
10300
10315
  return invoker;
10301
10316
  }
10317
+ function sanitizeEventValue(value, propName) {
10318
+ if (isFunction(value) || isArray(value)) {
10319
+ return value;
10320
+ }
10321
+ warn(
10322
+ `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
10323
+ Expected function or array of functions, received type ${typeof value}.`
10324
+ );
10325
+ return NOOP;
10326
+ }
10302
10327
  function patchStopImmediatePropagation(e, value) {
10303
10328
  if (isArray(value)) {
10304
10329
  const originalStop = e.stopImmediatePropagation;
@@ -10306,7 +10331,9 @@ function patchStopImmediatePropagation(e, value) {
10306
10331
  originalStop.call(e);
10307
10332
  e._stopped = true;
10308
10333
  };
10309
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10334
+ return value.map(
10335
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10336
+ );
10310
10337
  } else {
10311
10338
  return value;
10312
10339
  }
@@ -10507,7 +10534,7 @@ class VueElement extends BaseClass {
10507
10534
  }
10508
10535
  }
10509
10536
  _setAttr(key) {
10510
- let value = this.getAttribute(key);
10537
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10511
10538
  const camelKey = camelize(key);
10512
10539
  if (this._numberProps && this._numberProps[camelKey]) {
10513
10540
  value = toNumber(value);
@@ -10673,7 +10700,28 @@ const TransitionGroupImpl = {
10673
10700
  const rawProps = toRaw(props);
10674
10701
  const cssTransitionProps = resolveTransitionProps(rawProps);
10675
10702
  let tag = rawProps.tag || Fragment;
10676
- prevChildren = children;
10703
+ prevChildren = [];
10704
+ if (children) {
10705
+ for (let i = 0; i < children.length; i++) {
10706
+ const child = children[i];
10707
+ if (child.el && child.el instanceof Element) {
10708
+ prevChildren.push(child);
10709
+ setTransitionHooks(
10710
+ child,
10711
+ resolveTransitionHooks(
10712
+ child,
10713
+ cssTransitionProps,
10714
+ state,
10715
+ instance
10716
+ )
10717
+ );
10718
+ positionMap.set(
10719
+ child,
10720
+ child.el.getBoundingClientRect()
10721
+ );
10722
+ }
10723
+ }
10724
+ }
10677
10725
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10678
10726
  for (let i = 0; i < children.length; i++) {
10679
10727
  const child = children[i];
@@ -10686,16 +10734,6 @@ const TransitionGroupImpl = {
10686
10734
  warn(`<TransitionGroup> children must be keyed.`);
10687
10735
  }
10688
10736
  }
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
10737
  return createVNode(tag, null, children);
10700
10738
  };
10701
10739
  }
@@ -10794,7 +10832,7 @@ const vModelText = {
10794
10832
  el[assignKey] = getModelAssigner(vnode);
10795
10833
  if (el.composing)
10796
10834
  return;
10797
- const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10835
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10798
10836
  const newValue = value == null ? "" : value;
10799
10837
  if (elValue === newValue) {
10800
10838
  return;
@@ -10897,14 +10935,14 @@ const vModelSelect = {
10897
10935
  // set value in mounted & updated because <select> relies on its children
10898
10936
  // <option>s.
10899
10937
  mounted(el, { value, modifiers: { number } }) {
10900
- setSelected(el, value, number);
10938
+ setSelected(el, value);
10901
10939
  },
10902
10940
  beforeUpdate(el, _binding, vnode) {
10903
10941
  el[assignKey] = getModelAssigner(vnode);
10904
10942
  },
10905
10943
  updated(el, { value, modifiers: { number } }) {
10906
10944
  if (!el._assigning) {
10907
- setSelected(el, value, number);
10945
+ setSelected(el, value);
10908
10946
  }
10909
10947
  }
10910
10948
  };
@@ -10924,9 +10962,7 @@ function setSelected(el, value, number) {
10924
10962
  if (isArrayValue) {
10925
10963
  const optionType = typeof optionValue;
10926
10964
  if (optionType === "string" || optionType === "number") {
10927
- option.selected = value.includes(
10928
- number ? looseToNumber(optionValue) : optionValue
10929
- );
10965
+ option.selected = value.some((v) => String(v) === String(optionValue));
10930
10966
  } else {
10931
10967
  option.selected = looseIndexOf(value, optionValue) > -1;
10932
10968
  }
@@ -13101,7 +13137,7 @@ function onCloseTag(el, end, isImplied = false) {
13101
13137
  if (isImplied) {
13102
13138
  setLocEnd(el.loc, backTrack(end, 60));
13103
13139
  } else {
13104
- setLocEnd(el.loc, end + 1);
13140
+ setLocEnd(el.loc, lookAhead(end, 62) + 1);
13105
13141
  }
13106
13142
  if (tokenizer.inSFCRoot) {
13107
13143
  if (el.children.length) {
@@ -13138,6 +13174,12 @@ function onCloseTag(el, end, isImplied = false) {
13138
13174
  tokenizer.inXML = false;
13139
13175
  }
13140
13176
  }
13177
+ function lookAhead(index, c) {
13178
+ let i = index;
13179
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
13180
+ i++;
13181
+ return i;
13182
+ }
13141
13183
  function backTrack(index, c) {
13142
13184
  let i = index;
13143
13185
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -15289,10 +15331,24 @@ const transformElement = (node, context) => {
15289
15331
  function resolveComponentType(node, context, ssr = false) {
15290
15332
  let { tag } = node;
15291
15333
  const isExplicitDynamic = isComponentTag(tag);
15292
- const isProp = findProp(node, "is");
15334
+ const isProp = findProp(
15335
+ node,
15336
+ "is",
15337
+ false,
15338
+ true
15339
+ /* allow empty */
15340
+ );
15293
15341
  if (isProp) {
15294
15342
  if (isExplicitDynamic || false) {
15295
- const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
15343
+ let exp;
15344
+ if (isProp.type === 6) {
15345
+ exp = isProp.value && createSimpleExpression(isProp.value.content, true);
15346
+ } else {
15347
+ exp = isProp.exp;
15348
+ if (!exp) {
15349
+ exp = createSimpleExpression(`is`, false, isProp.loc);
15350
+ }
15351
+ }
15296
15352
  if (exp) {
15297
15353
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15298
15354
  exp