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,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);
@@ -292,7 +294,11 @@ var Vue = (function (exports) {
292
294
  };
293
295
  const stringifySymbol = (v, i = "") => {
294
296
  var _a;
295
- return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
297
+ return (
298
+ // Symbol.description in es2019+ so we need to cast here to pass
299
+ // the lib: es2016 check
300
+ isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
301
+ );
296
302
  };
297
303
 
298
304
  function warn$2(msg, ...args) {
@@ -728,6 +734,8 @@ var Vue = (function (exports) {
728
734
  return instrumentations;
729
735
  }
730
736
  function hasOwnProperty(key) {
737
+ if (!isSymbol(key))
738
+ key = String(key);
731
739
  const obj = toRaw(this);
732
740
  track(obj, "has", key);
733
741
  return obj.hasOwnProperty(key);
@@ -1080,23 +1088,16 @@ var Vue = (function (exports) {
1080
1088
  clear: createReadonlyMethod("clear"),
1081
1089
  forEach: createForEach(true, true)
1082
1090
  };
1083
- const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
1091
+ const iteratorMethods = [
1092
+ "keys",
1093
+ "values",
1094
+ "entries",
1095
+ Symbol.iterator
1096
+ ];
1084
1097
  iteratorMethods.forEach((method) => {
1085
- mutableInstrumentations2[method] = createIterableMethod(
1086
- method,
1087
- false,
1088
- false
1089
- );
1090
- readonlyInstrumentations2[method] = createIterableMethod(
1091
- method,
1092
- true,
1093
- false
1094
- );
1095
- shallowInstrumentations2[method] = createIterableMethod(
1096
- method,
1097
- false,
1098
- true
1099
- );
1098
+ mutableInstrumentations2[method] = createIterableMethod(method, false, false);
1099
+ readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
1100
+ shallowInstrumentations2[method] = createIterableMethod(method, false, true);
1100
1101
  shallowReadonlyInstrumentations2[method] = createIterableMethod(
1101
1102
  method,
1102
1103
  true,
@@ -1253,7 +1254,7 @@ var Vue = (function (exports) {
1253
1254
  return !!(value && value["__v_isShallow"]);
1254
1255
  }
1255
1256
  function isProxy(value) {
1256
- return isReactive(value) || isReadonly(value);
1257
+ return value ? !!value["__v_raw"] : false;
1257
1258
  }
1258
1259
  function toRaw(observed) {
1259
1260
  const raw = observed && observed["__v_raw"];
@@ -1715,11 +1716,17 @@ getter: `, this.getter);
1715
1716
  }
1716
1717
  return res;
1717
1718
  }
1718
- const values = [];
1719
- for (let i = 0; i < fn.length; i++) {
1720
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1719
+ if (isArray(fn)) {
1720
+ const values = [];
1721
+ for (let i = 0; i < fn.length; i++) {
1722
+ values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1723
+ }
1724
+ return values;
1725
+ } else {
1726
+ warn$1(
1727
+ `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
1728
+ );
1721
1729
  }
1722
- return values;
1723
1730
  }
1724
1731
  function handleError(err, instance, type, throwInDev = true) {
1725
1732
  const contextVNode = instance ? instance.vnode : null;
@@ -1740,12 +1747,14 @@ getter: `, this.getter);
1740
1747
  }
1741
1748
  const appErrorHandler = instance.appContext.config.errorHandler;
1742
1749
  if (appErrorHandler) {
1750
+ pauseTracking();
1743
1751
  callWithErrorHandling(
1744
1752
  appErrorHandler,
1745
1753
  null,
1746
1754
  10,
1747
1755
  [err, exposedInstance, errorInfo]
1748
1756
  );
1757
+ resetTracking();
1749
1758
  return;
1750
1759
  }
1751
1760
  }
@@ -2121,6 +2130,8 @@ getter: `, this.getter);
2121
2130
  _devtoolsComponentRemoved(component);
2122
2131
  }
2123
2132
  };
2133
+ /*! #__NO_SIDE_EFFECTS__ */
2134
+ // @__NO_SIDE_EFFECTS__
2124
2135
  function createDevtoolsComponentHook(hook) {
2125
2136
  return (component) => {
2126
2137
  emit$1(
@@ -4191,7 +4202,7 @@ If this is a native custom element, make sure to exclude it from component resol
4191
4202
  return () => {
4192
4203
  pendingCacheKey = null;
4193
4204
  if (!slots.default) {
4194
- return null;
4205
+ return current = null;
4195
4206
  }
4196
4207
  const children = slots.default();
4197
4208
  const rawVNode = children[0];
@@ -4504,6 +4515,9 @@ If this is a native custom element, make sure to exclude it from component resol
4504
4515
  const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4505
4516
  const PublicInstanceProxyHandlers = {
4506
4517
  get({ _: instance }, key) {
4518
+ if (key === "__v_skip") {
4519
+ return true;
4520
+ }
4507
4521
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
4508
4522
  if (key === "__isVue") {
4509
4523
  return true;
@@ -5471,10 +5485,10 @@ If you want to remount the same app, move your app creation logic into a factory
5471
5485
  return !!(currentInstance || currentRenderingInstance || currentApp);
5472
5486
  }
5473
5487
 
5488
+ const attrsProto = {};
5474
5489
  function initProps(instance, rawProps, isStateful, isSSR = false) {
5475
5490
  const props = {};
5476
- const attrs = {};
5477
- def(attrs, InternalObjectKey, 1);
5491
+ const attrs = Object.create(attrsProto);
5478
5492
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5479
5493
  setFullProps(instance, rawProps, props, attrs);
5480
5494
  for (const key in instance.propsOptions[0]) {
@@ -5589,7 +5603,7 @@ If you want to remount the same app, move your app creation logic into a factory
5589
5603
  }
5590
5604
  }
5591
5605
  if (hasAttrsChanged) {
5592
- trigger(instance, "set", "$attrs");
5606
+ trigger(instance.attrs, "set", "");
5593
5607
  }
5594
5608
  {
5595
5609
  validateProps(rawProps || {}, props, instance);
@@ -5925,7 +5939,7 @@ If you want to remount the same app, move your app creation logic into a factory
5925
5939
  const type = children._;
5926
5940
  if (type) {
5927
5941
  instance.slots = toRaw(children);
5928
- def(children, "_", type);
5942
+ def(instance.slots, "_", type);
5929
5943
  } else {
5930
5944
  normalizeObjectSlots(
5931
5945
  children,
@@ -5937,7 +5951,6 @@ If you want to remount the same app, move your app creation logic into a factory
5937
5951
  normalizeVNodeSlots(instance, children);
5938
5952
  }
5939
5953
  }
5940
- def(instance.slots, InternalObjectKey, 1);
5941
5954
  };
5942
5955
  const updateSlots = (instance, children, optimized) => {
5943
5956
  const { vnode, slots } = instance;
@@ -6109,6 +6122,7 @@ If you want to remount the same app, move your app creation logic into a factory
6109
6122
  }
6110
6123
  };
6111
6124
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
6125
+ optimized = optimized || !!vnode.dynamicChildren;
6112
6126
  const isFragmentStart = isComment(node) && node.data === "[";
6113
6127
  const onMismatch = () => handleMismatch(
6114
6128
  node,
@@ -8543,7 +8557,6 @@ Server rendered element contains fewer child nodes than client vdom.`
8543
8557
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
8544
8558
  );
8545
8559
  };
8546
- const InternalObjectKey = `__vInternal`;
8547
8560
  const normalizeKey = ({ key }) => key != null ? key : null;
8548
8561
  const normalizeRef = ({
8549
8562
  ref,
@@ -8676,7 +8689,7 @@ Component that was made reactive: `,
8676
8689
  function guardReactiveProps(props) {
8677
8690
  if (!props)
8678
8691
  return null;
8679
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
8692
+ return isProxy(props) || Object.getPrototypeOf(props) === attrsProto ? extend({}, props) : props;
8680
8693
  }
8681
8694
  function cloneVNode(vnode, extraProps, mergeRef = false) {
8682
8695
  const { props, ref, patchFlag, children } = vnode;
@@ -8781,7 +8794,7 @@ Component that was made reactive: `,
8781
8794
  } else {
8782
8795
  type = 32;
8783
8796
  const slotFlag = children._;
8784
- if (!slotFlag && !(InternalObjectKey in children)) {
8797
+ if (!slotFlag) {
8785
8798
  children._ctx = currentRenderingInstance;
8786
8799
  } else if (slotFlag === 3 && currentRenderingInstance) {
8787
8800
  if (currentRenderingInstance.slots._ === 1) {
@@ -9002,7 +9015,7 @@ Component that was made reactive: `,
9002
9015
  }
9003
9016
  }
9004
9017
  instance.accessCache = /* @__PURE__ */ Object.create(null);
9005
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
9018
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
9006
9019
  {
9007
9020
  exposePropsOnRenderContext(instance);
9008
9021
  }
@@ -9134,26 +9147,21 @@ Component that was made reactive: `,
9134
9147
  }
9135
9148
  }
9136
9149
  }
9137
- function getAttrsProxy(instance) {
9138
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
9139
- instance.attrs,
9140
- {
9141
- get(target, key) {
9142
- markAttrsAccessed();
9143
- track(instance, "get", "$attrs");
9144
- return target[key];
9145
- },
9146
- set() {
9147
- warn$1(`setupContext.attrs is readonly.`);
9148
- return false;
9149
- },
9150
- deleteProperty() {
9151
- warn$1(`setupContext.attrs is readonly.`);
9152
- return false;
9153
- }
9154
- }
9155
- ));
9156
- }
9150
+ const attrsProxyHandlers = {
9151
+ get(target, key) {
9152
+ markAttrsAccessed();
9153
+ track(target, "get", "");
9154
+ return target[key];
9155
+ },
9156
+ set() {
9157
+ warn$1(`setupContext.attrs is readonly.`);
9158
+ return false;
9159
+ },
9160
+ deleteProperty() {
9161
+ warn$1(`setupContext.attrs is readonly.`);
9162
+ return false;
9163
+ }
9164
+ } ;
9157
9165
  function getSlotsProxy(instance) {
9158
9166
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
9159
9167
  get(target, key) {
@@ -9187,9 +9195,10 @@ Component that was made reactive: `,
9187
9195
  instance.exposed = exposed || {};
9188
9196
  };
9189
9197
  {
9198
+ let attrsProxy;
9190
9199
  return Object.freeze({
9191
9200
  get attrs() {
9192
- return getAttrsProxy(instance);
9201
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
9193
9202
  },
9194
9203
  get slots() {
9195
9204
  return getSlotsProxy(instance);
@@ -9534,7 +9543,7 @@ Component that was made reactive: `,
9534
9543
  return true;
9535
9544
  }
9536
9545
 
9537
- const version = "3.4.21";
9546
+ const version = "3.4.22";
9538
9547
  const warn = warn$1 ;
9539
9548
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9540
9549
  const devtools = devtools$1 ;
@@ -9960,8 +9969,8 @@ Component that was made reactive: `,
9960
9969
  setVarsOnVNode(instance.subTree, vars);
9961
9970
  updateTeleports(vars);
9962
9971
  };
9963
- watchPostEffect(setVars);
9964
9972
  onMounted(() => {
9973
+ watchPostEffect(setVars);
9965
9974
  const ob = new MutationObserver(setVars);
9966
9975
  ob.observe(instance.subTree.el.parentNode, { childList: true });
9967
9976
  onUnmounted(() => ob.disconnect());
@@ -10184,11 +10193,14 @@ Component that was made reactive: `,
10184
10193
  const invokers = el[veiKey] || (el[veiKey] = {});
10185
10194
  const existingInvoker = invokers[rawName];
10186
10195
  if (nextValue && existingInvoker) {
10187
- existingInvoker.value = nextValue;
10196
+ existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
10188
10197
  } else {
10189
10198
  const [name, options] = parseName(rawName);
10190
10199
  if (nextValue) {
10191
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
10200
+ const invoker = invokers[rawName] = createInvoker(
10201
+ sanitizeEventValue(nextValue, rawName) ,
10202
+ instance
10203
+ );
10192
10204
  addEventListener(el, name, invoker, options);
10193
10205
  } else if (existingInvoker) {
10194
10206
  removeEventListener(el, name, existingInvoker, options);
@@ -10231,6 +10243,16 @@ Component that was made reactive: `,
10231
10243
  invoker.attached = getNow();
10232
10244
  return invoker;
10233
10245
  }
10246
+ function sanitizeEventValue(value, propName) {
10247
+ if (isFunction(value) || isArray(value)) {
10248
+ return value;
10249
+ }
10250
+ warn(
10251
+ `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
10252
+ Expected function or array of functions, received type ${typeof value}.`
10253
+ );
10254
+ return NOOP;
10255
+ }
10234
10256
  function patchStopImmediatePropagation(e, value) {
10235
10257
  if (isArray(value)) {
10236
10258
  const originalStop = e.stopImmediatePropagation;
@@ -10238,7 +10260,9 @@ Component that was made reactive: `,
10238
10260
  originalStop.call(e);
10239
10261
  e._stopped = true;
10240
10262
  };
10241
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
10263
+ return value.map(
10264
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
10265
+ );
10242
10266
  } else {
10243
10267
  return value;
10244
10268
  }
@@ -10439,7 +10463,7 @@ Component that was made reactive: `,
10439
10463
  }
10440
10464
  }
10441
10465
  _setAttr(key) {
10442
- let value = this.getAttribute(key);
10466
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
10443
10467
  const camelKey = camelize(key);
10444
10468
  if (this._numberProps && this._numberProps[camelKey]) {
10445
10469
  value = toNumber(value);
@@ -10593,7 +10617,28 @@ Component that was made reactive: `,
10593
10617
  const rawProps = toRaw(props);
10594
10618
  const cssTransitionProps = resolveTransitionProps(rawProps);
10595
10619
  let tag = rawProps.tag || Fragment;
10596
- prevChildren = children;
10620
+ prevChildren = [];
10621
+ if (children) {
10622
+ for (let i = 0; i < children.length; i++) {
10623
+ const child = children[i];
10624
+ if (child.el && child.el instanceof Element) {
10625
+ prevChildren.push(child);
10626
+ setTransitionHooks(
10627
+ child,
10628
+ resolveTransitionHooks(
10629
+ child,
10630
+ cssTransitionProps,
10631
+ state,
10632
+ instance
10633
+ )
10634
+ );
10635
+ positionMap.set(
10636
+ child,
10637
+ child.el.getBoundingClientRect()
10638
+ );
10639
+ }
10640
+ }
10641
+ }
10597
10642
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
10598
10643
  for (let i = 0; i < children.length; i++) {
10599
10644
  const child = children[i];
@@ -10606,16 +10651,6 @@ Component that was made reactive: `,
10606
10651
  warn(`<TransitionGroup> children must be keyed.`);
10607
10652
  }
10608
10653
  }
10609
- if (prevChildren) {
10610
- for (let i = 0; i < prevChildren.length; i++) {
10611
- const child = prevChildren[i];
10612
- setTransitionHooks(
10613
- child,
10614
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
10615
- );
10616
- positionMap.set(child, child.el.getBoundingClientRect());
10617
- }
10618
- }
10619
10654
  return createVNode(tag, null, children);
10620
10655
  };
10621
10656
  }
@@ -10714,7 +10749,7 @@ Component that was made reactive: `,
10714
10749
  el[assignKey] = getModelAssigner(vnode);
10715
10750
  if (el.composing)
10716
10751
  return;
10717
- const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
10752
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
10718
10753
  const newValue = value == null ? "" : value;
10719
10754
  if (elValue === newValue) {
10720
10755
  return;
@@ -10817,14 +10852,14 @@ Component that was made reactive: `,
10817
10852
  // set value in mounted & updated because <select> relies on its children
10818
10853
  // <option>s.
10819
10854
  mounted(el, { value, modifiers: { number } }) {
10820
- setSelected(el, value, number);
10855
+ setSelected(el, value);
10821
10856
  },
10822
10857
  beforeUpdate(el, _binding, vnode) {
10823
10858
  el[assignKey] = getModelAssigner(vnode);
10824
10859
  },
10825
10860
  updated(el, { value, modifiers: { number } }) {
10826
10861
  if (!el._assigning) {
10827
- setSelected(el, value, number);
10862
+ setSelected(el, value);
10828
10863
  }
10829
10864
  }
10830
10865
  };
@@ -10844,9 +10879,7 @@ Component that was made reactive: `,
10844
10879
  if (isArrayValue) {
10845
10880
  const optionType = typeof optionValue;
10846
10881
  if (optionType === "string" || optionType === "number") {
10847
- option.selected = value.includes(
10848
- number ? looseToNumber(optionValue) : optionValue
10849
- );
10882
+ option.selected = value.some((v) => String(v) === String(optionValue));
10850
10883
  } else {
10851
10884
  option.selected = looseIndexOf(value, optionValue) > -1;
10852
10885
  }