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.
@@ -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,11 +1,13 @@
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
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;
@@ -4611,7 +4625,7 @@ If this is a native custom element, make sure to exclude it from component resol
4611
4625
  let cssModule, globalProperties;
4612
4626
  if (publicGetter) {
4613
4627
  if (key === "$attrs") {
4614
- track(instance, "get", key);
4628
+ track(instance.attrs, "get", "");
4615
4629
  markAttrsAccessed();
4616
4630
  } else if (key === "$slots") {
4617
4631
  track(instance, "get", key);
@@ -5536,10 +5550,13 @@ 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 internalObjectProto = /* @__PURE__ */ Object.create(null);
5554
+ const createInternalObject = () => Object.create(internalObjectProto);
5555
+ const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
5556
+
5539
5557
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5540
5558
  const props = {};
5541
- const attrs = {};
5542
- def(attrs, InternalObjectKey, 1);
5559
+ const attrs = createInternalObject();
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 @@ If you want to remount the same app, move your app creation logic into a factory
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,19 +6007,18 @@ If you want to remount the same app, move your app creation logic into a factory
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,
5997
- instance.slots = {});
6014
+ instance.slots = createInternalObject());
5998
6015
  }
5999
6016
  } else {
6000
- instance.slots = {};
6017
+ instance.slots = createInternalObject();
6001
6018
  if (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 @@ If you want to remount the same app, move your app creation logic into a factory
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 @@ Server rendered element contains fewer child nodes than client vdom.`
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) || isInternalObject(props) ? 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 @@ Component that was made reactive: `,
8846
8862
  } else {
8847
8863
  type = 32;
8848
8864
  const slotFlag = children._;
8849
- if (!slotFlag && !(InternalObjectKey in children)) {
8865
+ if (!slotFlag && !isInternalObject(children)) {
8850
8866
  children._ctx = currentRenderingInstance;
8851
8867
  } else if (slotFlag === 3 && currentRenderingInstance) {
8852
8868
  if (currentRenderingInstance.slots._ === 1) {
@@ -9067,7 +9083,7 @@ Component that was made reactive: `,
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 @@ Component that was made reactive: `,
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 @@ Component that was made reactive: `,
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 @@ Component that was made reactive: `,
9599
9611
  return true;
9600
9612
  }
9601
9613
 
9602
- const version = "3.4.21";
9614
+ const version = "3.4.23";
9603
9615
  const warn = warn$1 ;
9604
9616
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9605
9617
  const devtools = devtools$1 ;
@@ -10025,8 +10037,8 @@ Component that was made reactive: `,
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());
@@ -10249,11 +10261,14 @@ Component that was made reactive: `,
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 @@ Component that was made reactive: `,
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 @@ Component that was made reactive: `,
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 @@ Component that was made reactive: `,
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);
@@ -10658,7 +10685,28 @@ Component that was made reactive: `,
10658
10685
  const rawProps = toRaw(props);
10659
10686
  const cssTransitionProps = resolveTransitionProps(rawProps);
10660
10687
  let tag = rawProps.tag || Fragment;
10661
- prevChildren = children;
10688
+ prevChildren = [];
10689
+ if (children) {
10690
+ for (let i = 0; i < children.length; i++) {
10691
+ const child = children[i];
10692
+ if (child.el && child.el instanceof Element) {
10693
+ prevChildren.push(child);
10694
+ setTransitionHooks(
10695
+ child,
10696
+ resolveTransitionHooks(
10697
+ child,
10698
+ cssTransitionProps,
10699
+ state,
10700
+ instance
10701
+ )
10702
+ );
10703
+ positionMap.set(
10704
+ child,
10705
+ child.el.getBoundingClientRect()
10706
+ );
10707
+ }
10708
+ }
10709
+ }
10662
10710
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10663
10711
  for (let i = 0; i < children.length; i++) {
10664
10712
  const child = children[i];
@@ -10671,16 +10719,6 @@ Component that was made reactive: `,
10671
10719
  warn(`<TransitionGroup> children must be keyed.`);
10672
10720
  }
10673
10721
  }
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
10722
  return createVNode(tag, null, children);
10685
10723
  };
10686
10724
  }
@@ -10779,7 +10817,7 @@ Component that was made reactive: `,
10779
10817
  el[assignKey] = getModelAssigner(vnode);
10780
10818
  if (el.composing)
10781
10819
  return;
10782
- const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10820
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10783
10821
  const newValue = value == null ? "" : value;
10784
10822
  if (elValue === newValue) {
10785
10823
  return;
@@ -10882,14 +10920,14 @@ Component that was made reactive: `,
10882
10920
  // set value in mounted & updated because <select> relies on its children
10883
10921
  // <option>s.
10884
10922
  mounted(el, { value, modifiers: { number } }) {
10885
- setSelected(el, value, number);
10923
+ setSelected(el, value);
10886
10924
  },
10887
10925
  beforeUpdate(el, _binding, vnode) {
10888
10926
  el[assignKey] = getModelAssigner(vnode);
10889
10927
  },
10890
10928
  updated(el, { value, modifiers: { number } }) {
10891
10929
  if (!el._assigning) {
10892
- setSelected(el, value, number);
10930
+ setSelected(el, value);
10893
10931
  }
10894
10932
  }
10895
10933
  };
@@ -10909,9 +10947,7 @@ Component that was made reactive: `,
10909
10947
  if (isArrayValue) {
10910
10948
  const optionType = typeof optionValue;
10911
10949
  if (optionType === "string" || optionType === "number") {
10912
- option.selected = value.includes(
10913
- number ? looseToNumber(optionValue) : optionValue
10914
- );
10950
+ option.selected = value.some((v) => String(v) === String(optionValue));
10915
10951
  } else {
10916
10952
  option.selected = looseIndexOf(value, optionValue) > -1;
10917
10953
  }
@@ -12924,7 +12960,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12924
12960
  if (isImplied) {
12925
12961
  setLocEnd(el.loc, backTrack(end, 60));
12926
12962
  } else {
12927
- setLocEnd(el.loc, end + 1);
12963
+ setLocEnd(el.loc, lookAhead(end, 62) + 1);
12928
12964
  }
12929
12965
  if (tokenizer.inSFCRoot) {
12930
12966
  if (el.children.length) {
@@ -12961,6 +12997,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12961
12997
  tokenizer.inXML = false;
12962
12998
  }
12963
12999
  }
13000
+ function lookAhead(index, c) {
13001
+ let i = index;
13002
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
13003
+ i++;
13004
+ return i;
13005
+ }
12964
13006
  function backTrack(index, c) {
12965
13007
  let i = index;
12966
13008
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -15112,10 +15154,24 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15112
15154
  function resolveComponentType(node, context, ssr = false) {
15113
15155
  let { tag } = node;
15114
15156
  const isExplicitDynamic = isComponentTag(tag);
15115
- const isProp = findProp(node, "is");
15157
+ const isProp = findProp(
15158
+ node,
15159
+ "is",
15160
+ false,
15161
+ true
15162
+ /* allow empty */
15163
+ );
15116
15164
  if (isProp) {
15117
15165
  if (isExplicitDynamic || false) {
15118
- const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
15166
+ let exp;
15167
+ if (isProp.type === 6) {
15168
+ exp = isProp.value && createSimpleExpression(isProp.value.content, true);
15169
+ } else {
15170
+ exp = isProp.exp;
15171
+ if (!exp) {
15172
+ exp = createSimpleExpression(`is`, false, isProp.loc);
15173
+ }
15174
+ }
15119
15175
  if (exp) {
15120
15176
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15121
15177
  exp