@vue/compat 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.
@@ -1,8 +1,10 @@
1
1
  /**
2
- * @vue/compat v3.4.20
2
+ * @vue/compat 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);
@@ -289,7 +291,11 @@ const replacer = (_key, val) => {
289
291
  };
290
292
  const stringifySymbol = (v, i = "") => {
291
293
  var _a;
292
- return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
294
+ return (
295
+ // Symbol.description in es2019+ so we need to cast here to pass
296
+ // the lib: es2016 check
297
+ isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
298
+ );
293
299
  };
294
300
 
295
301
  function warn$2(msg, ...args) {
@@ -725,6 +731,8 @@ function createArrayInstrumentations() {
725
731
  return instrumentations;
726
732
  }
727
733
  function hasOwnProperty(key) {
734
+ if (!isSymbol(key))
735
+ key = String(key);
728
736
  const obj = toRaw(this);
729
737
  track(obj, "has", key);
730
738
  return obj.hasOwnProperty(key);
@@ -1077,23 +1085,16 @@ function createInstrumentations() {
1077
1085
  clear: createReadonlyMethod("clear"),
1078
1086
  forEach: createForEach(true, true)
1079
1087
  };
1080
- const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
1088
+ const iteratorMethods = [
1089
+ "keys",
1090
+ "values",
1091
+ "entries",
1092
+ Symbol.iterator
1093
+ ];
1081
1094
  iteratorMethods.forEach((method) => {
1082
- mutableInstrumentations2[method] = createIterableMethod(
1083
- method,
1084
- false,
1085
- false
1086
- );
1087
- readonlyInstrumentations2[method] = createIterableMethod(
1088
- method,
1089
- true,
1090
- false
1091
- );
1092
- shallowInstrumentations2[method] = createIterableMethod(
1093
- method,
1094
- false,
1095
- true
1096
- );
1095
+ mutableInstrumentations2[method] = createIterableMethod(method, false, false);
1096
+ readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
1097
+ shallowInstrumentations2[method] = createIterableMethod(method, false, true);
1097
1098
  shallowReadonlyInstrumentations2[method] = createIterableMethod(
1098
1099
  method,
1099
1100
  true,
@@ -1250,7 +1251,7 @@ function isShallow(value) {
1250
1251
  return !!(value && value["__v_isShallow"]);
1251
1252
  }
1252
1253
  function isProxy(value) {
1253
- return isReactive(value) || isReadonly(value);
1254
+ return value ? !!value["__v_raw"] : false;
1254
1255
  }
1255
1256
  function toRaw(observed) {
1256
1257
  const raw = observed && observed["__v_raw"];
@@ -1533,7 +1534,10 @@ function warn$1(msg, ...args) {
1533
1534
  instance,
1534
1535
  11,
1535
1536
  [
1536
- msg + args.join(""),
1537
+ msg + args.map((a) => {
1538
+ var _a, _b;
1539
+ return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
1540
+ }).join(""),
1537
1541
  instance && instance.proxy,
1538
1542
  trace.map(
1539
1543
  ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
@@ -1711,11 +1715,17 @@ function callWithAsyncErrorHandling(fn, instance, type, args) {
1711
1715
  }
1712
1716
  return res;
1713
1717
  }
1714
- const values = [];
1715
- for (let i = 0; i < fn.length; i++) {
1716
- values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1718
+ if (isArray(fn)) {
1719
+ const values = [];
1720
+ for (let i = 0; i < fn.length; i++) {
1721
+ values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
1722
+ }
1723
+ return values;
1724
+ } else if (!!(process.env.NODE_ENV !== "production")) {
1725
+ warn$1(
1726
+ `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
1727
+ );
1717
1728
  }
1718
- return values;
1719
1729
  }
1720
1730
  function handleError(err, instance, type, throwInDev = true) {
1721
1731
  const contextVNode = instance ? instance.vnode : null;
@@ -1736,12 +1746,14 @@ function handleError(err, instance, type, throwInDev = true) {
1736
1746
  }
1737
1747
  const appErrorHandler = instance.appContext.config.errorHandler;
1738
1748
  if (appErrorHandler) {
1749
+ pauseTracking();
1739
1750
  callWithErrorHandling(
1740
1751
  appErrorHandler,
1741
1752
  null,
1742
1753
  10,
1743
1754
  [err, exposedInstance, errorInfo]
1744
1755
  );
1756
+ resetTracking();
1745
1757
  return;
1746
1758
  }
1747
1759
  }
@@ -2119,6 +2131,8 @@ const devtoolsComponentRemoved = (component) => {
2119
2131
  _devtoolsComponentRemoved(component);
2120
2132
  }
2121
2133
  };
2134
+ /*! #__NO_SIDE_EFFECTS__ */
2135
+ // @__NO_SIDE_EFFECTS__
2122
2136
  function createDevtoolsComponentHook(hook) {
2123
2137
  return (component) => {
2124
2138
  emit$2(
@@ -3228,7 +3242,7 @@ const SuspenseImpl = {
3228
3242
  rendererInternals
3229
3243
  );
3230
3244
  } else {
3231
- if (parentSuspense && parentSuspense.deps > 0) {
3245
+ if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
3232
3246
  n2.suspense = n1.suspense;
3233
3247
  n2.suspense.vnode = n2;
3234
3248
  n2.el = n1.el;
@@ -4802,7 +4816,7 @@ const KeepAliveImpl = {
4802
4816
  return () => {
4803
4817
  pendingCacheKey = null;
4804
4818
  if (!slots.default) {
4805
- return null;
4819
+ return current = null;
4806
4820
  }
4807
4821
  const children = slots.default();
4808
4822
  const rawVNode = children[0];
@@ -5533,47 +5547,74 @@ function installCompatInstanceProperties(map) {
5533
5547
  $once: (i) => once.bind(null, i),
5534
5548
  $off: (i) => off.bind(null, i),
5535
5549
  $children: getCompatChildren,
5536
- $listeners: getCompatListeners
5550
+ $listeners: getCompatListeners,
5551
+ // inject additional properties into $options for compat
5552
+ // e.g. vuex needs this.$options.parent
5553
+ $options: (i) => {
5554
+ if (!isCompatEnabled("PRIVATE_APIS", i)) {
5555
+ return resolveMergedOptions(i);
5556
+ }
5557
+ if (i.resolvedOptions) {
5558
+ return i.resolvedOptions;
5559
+ }
5560
+ const res = i.resolvedOptions = extend({}, resolveMergedOptions(i));
5561
+ Object.defineProperties(res, {
5562
+ parent: {
5563
+ get() {
5564
+ warnDeprecation("PRIVATE_APIS", i, "$options.parent");
5565
+ return i.proxy.$parent;
5566
+ }
5567
+ },
5568
+ propsData: {
5569
+ get() {
5570
+ warnDeprecation(
5571
+ "PRIVATE_APIS",
5572
+ i,
5573
+ "$options.propsData"
5574
+ );
5575
+ return i.vnode.props;
5576
+ }
5577
+ }
5578
+ });
5579
+ return res;
5580
+ }
5537
5581
  });
5538
- if (isCompatEnabled("PRIVATE_APIS", null)) {
5539
- extend(map, {
5540
- // needed by many libs / render fns
5541
- $vnode: (i) => i.vnode,
5542
- // inject additional properties into $options for compat
5543
- // e.g. vuex needs this.$options.parent
5544
- $options: (i) => {
5545
- const res = extend({}, resolveMergedOptions(i));
5546
- res.parent = i.proxy.$parent;
5547
- res.propsData = i.vnode.props;
5548
- return res;
5549
- },
5550
- // some private properties that are likely accessed...
5551
- _self: (i) => i.proxy,
5552
- _uid: (i) => i.uid,
5553
- _data: (i) => i.data,
5554
- _isMounted: (i) => i.isMounted,
5555
- _isDestroyed: (i) => i.isUnmounted,
5556
- // v2 render helpers
5557
- $createElement: () => compatH,
5558
- _c: () => compatH,
5559
- _o: () => legacyMarkOnce,
5560
- _n: () => looseToNumber,
5561
- _s: () => toDisplayString,
5562
- _l: () => renderList,
5563
- _t: (i) => legacyRenderSlot.bind(null, i),
5564
- _q: () => looseEqual,
5565
- _i: () => looseIndexOf,
5566
- _m: (i) => legacyRenderStatic.bind(null, i),
5567
- _f: () => resolveFilter$1,
5568
- _k: (i) => legacyCheckKeyCodes.bind(null, i),
5569
- _b: () => legacyBindObjectProps,
5570
- _v: () => createTextVNode,
5571
- _e: () => createCommentVNode,
5572
- _u: () => legacyresolveScopedSlots,
5573
- _g: () => legacyBindObjectListeners,
5574
- _d: () => legacyBindDynamicKeys,
5575
- _p: () => legacyPrependModifier
5576
- });
5582
+ const privateAPIs = {
5583
+ // needed by many libs / render fns
5584
+ $vnode: (i) => i.vnode,
5585
+ // some private properties that are likely accessed...
5586
+ _self: (i) => i.proxy,
5587
+ _uid: (i) => i.uid,
5588
+ _data: (i) => i.data,
5589
+ _isMounted: (i) => i.isMounted,
5590
+ _isDestroyed: (i) => i.isUnmounted,
5591
+ // v2 render helpers
5592
+ $createElement: () => compatH,
5593
+ _c: () => compatH,
5594
+ _o: () => legacyMarkOnce,
5595
+ _n: () => looseToNumber,
5596
+ _s: () => toDisplayString,
5597
+ _l: () => renderList,
5598
+ _t: (i) => legacyRenderSlot.bind(null, i),
5599
+ _q: () => looseEqual,
5600
+ _i: () => looseIndexOf,
5601
+ _m: (i) => legacyRenderStatic.bind(null, i),
5602
+ _f: () => resolveFilter$1,
5603
+ _k: (i) => legacyCheckKeyCodes.bind(null, i),
5604
+ _b: () => legacyBindObjectProps,
5605
+ _v: () => createTextVNode,
5606
+ _e: () => createCommentVNode,
5607
+ _u: () => legacyresolveScopedSlots,
5608
+ _g: () => legacyBindObjectListeners,
5609
+ _d: () => legacyBindDynamicKeys,
5610
+ _p: () => legacyPrependModifier
5611
+ };
5612
+ for (const key in privateAPIs) {
5613
+ map[key] = (i) => {
5614
+ if (isCompatEnabled("PRIVATE_APIS", i)) {
5615
+ return privateAPIs[key](i);
5616
+ }
5617
+ };
5577
5618
  }
5578
5619
  }
5579
5620
 
@@ -5614,6 +5655,9 @@ const isReservedPrefix = (key) => key === "_" || key === "$";
5614
5655
  const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
5615
5656
  const PublicInstanceProxyHandlers = {
5616
5657
  get({ _: instance }, key) {
5658
+ if (key === "__v_skip") {
5659
+ return true;
5660
+ }
5617
5661
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
5618
5662
  if (!!(process.env.NODE_ENV !== "production") && key === "__isVue") {
5619
5663
  return true;
@@ -6470,7 +6514,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6470
6514
  return vm;
6471
6515
  }
6472
6516
  }
6473
- Vue.version = `2.6.14-compat:${"3.4.20"}`;
6517
+ Vue.version = `2.6.14-compat:${"3.4.22"}`;
6474
6518
  Vue.config = singletonApp.config;
6475
6519
  Vue.use = (p, ...options) => {
6476
6520
  if (p && isFunction(p.install)) {
@@ -6665,15 +6709,14 @@ function applySingletonPrototype(app, Ctor) {
6665
6709
  app.config.globalProperties = Object.create(Ctor.prototype);
6666
6710
  }
6667
6711
  let hasPrototypeAugmentations = false;
6668
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6669
- for (const key in descriptors) {
6712
+ for (const key of Object.getOwnPropertyNames(Ctor.prototype)) {
6670
6713
  if (key !== "constructor") {
6671
6714
  hasPrototypeAugmentations = true;
6672
6715
  if (enabled) {
6673
6716
  Object.defineProperty(
6674
6717
  app.config.globalProperties,
6675
6718
  key,
6676
- descriptors[key]
6719
+ Object.getOwnPropertyDescriptor(Ctor.prototype, key)
6677
6720
  );
6678
6721
  }
6679
6722
  }
@@ -7111,10 +7154,10 @@ function shouldSkipAttr(key, instance) {
7111
7154
  return false;
7112
7155
  }
7113
7156
 
7157
+ const attrsProto = {};
7114
7158
  function initProps(instance, rawProps, isStateful, isSSR = false) {
7115
7159
  const props = {};
7116
- const attrs = {};
7117
- def(attrs, InternalObjectKey, 1);
7160
+ const attrs = Object.create(attrsProto);
7118
7161
  instance.propsDefaults = /* @__PURE__ */ Object.create(null);
7119
7162
  setFullProps(instance, rawProps, props, attrs);
7120
7163
  for (const key in instance.propsOptions[0]) {
@@ -7236,7 +7279,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
7236
7279
  }
7237
7280
  }
7238
7281
  if (hasAttrsChanged) {
7239
- trigger(instance, "set", "$attrs");
7282
+ trigger(instance.attrs, "set", "");
7240
7283
  }
7241
7284
  if (!!(process.env.NODE_ENV !== "production")) {
7242
7285
  validateProps(rawProps || {}, props, instance);
@@ -7594,7 +7637,7 @@ const initSlots = (instance, children) => {
7594
7637
  const type = children._;
7595
7638
  if (type) {
7596
7639
  instance.slots = toRaw(children);
7597
- def(children, "_", type);
7640
+ def(instance.slots, "_", type);
7598
7641
  } else {
7599
7642
  normalizeObjectSlots(
7600
7643
  children,
@@ -7608,7 +7651,6 @@ const initSlots = (instance, children) => {
7608
7651
  normalizeVNodeSlots(instance, children);
7609
7652
  }
7610
7653
  }
7611
- def(instance.slots, InternalObjectKey, 1);
7612
7654
  };
7613
7655
  const updateSlots = (instance, children, optimized) => {
7614
7656
  const { vnode, slots } = instance;
@@ -7780,6 +7822,7 @@ function createHydrationFunctions(rendererInternals) {
7780
7822
  }
7781
7823
  };
7782
7824
  const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
7825
+ optimized = optimized || !!vnode.dynamicChildren;
7783
7826
  const isFragmentStart = isComment(node) && node.data === "[";
7784
7827
  const onMismatch = () => handleMismatch(
7785
7828
  node,
@@ -8025,9 +8068,9 @@ Server rendered element contains more child nodes than client vdom.`
8025
8068
  }
8026
8069
  }
8027
8070
  if (props) {
8028
- if (!!(process.env.NODE_ENV !== "production") || forcePatch || !optimized || patchFlag & (16 | 32)) {
8071
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {
8029
8072
  for (const key in props) {
8030
- if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
8073
+ if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
8031
8074
  hasMismatch = true;
8032
8075
  }
8033
8076
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -10347,7 +10390,6 @@ const createVNodeWithArgsTransform = (...args) => {
10347
10390
  ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
10348
10391
  );
10349
10392
  };
10350
- const InternalObjectKey = `__vInternal`;
10351
10393
  const normalizeKey = ({ key }) => key != null ? key : null;
10352
10394
  const normalizeRef = ({
10353
10395
  ref,
@@ -10487,7 +10529,7 @@ Component that was made reactive: `,
10487
10529
  function guardReactiveProps(props) {
10488
10530
  if (!props)
10489
10531
  return null;
10490
- return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
10532
+ return isProxy(props) || Object.getPrototypeOf(props) === attrsProto ? extend({}, props) : props;
10491
10533
  }
10492
10534
  function cloneVNode(vnode, extraProps, mergeRef = false) {
10493
10535
  const { props, ref, patchFlag, children } = vnode;
@@ -10595,7 +10637,7 @@ function normalizeChildren(vnode, children) {
10595
10637
  } else {
10596
10638
  type = 32;
10597
10639
  const slotFlag = children._;
10598
- if (!slotFlag && !(InternalObjectKey in children)) {
10640
+ if (!slotFlag) {
10599
10641
  children._ctx = currentRenderingInstance;
10600
10642
  } else if (slotFlag === 3 && currentRenderingInstance) {
10601
10643
  if (currentRenderingInstance.slots._ === 1) {
@@ -10833,7 +10875,7 @@ function setupStatefulComponent(instance, isSSR) {
10833
10875
  }
10834
10876
  }
10835
10877
  instance.accessCache = /* @__PURE__ */ Object.create(null);
10836
- instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
10878
+ instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
10837
10879
  if (!!(process.env.NODE_ENV !== "production")) {
10838
10880
  exposePropsOnRenderContext(instance);
10839
10881
  }
@@ -10979,31 +11021,26 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10979
11021
  }
10980
11022
  }
10981
11023
  }
10982
- function getAttrsProxy(instance) {
10983
- return instance.attrsProxy || (instance.attrsProxy = new Proxy(
10984
- instance.attrs,
10985
- !!(process.env.NODE_ENV !== "production") ? {
10986
- get(target, key) {
10987
- markAttrsAccessed();
10988
- track(instance, "get", "$attrs");
10989
- return target[key];
10990
- },
10991
- set() {
10992
- warn$1(`setupContext.attrs is readonly.`);
10993
- return false;
10994
- },
10995
- deleteProperty() {
10996
- warn$1(`setupContext.attrs is readonly.`);
10997
- return false;
10998
- }
10999
- } : {
11000
- get(target, key) {
11001
- track(instance, "get", "$attrs");
11002
- return target[key];
11003
- }
11004
- }
11005
- ));
11006
- }
11024
+ const attrsProxyHandlers = !!(process.env.NODE_ENV !== "production") ? {
11025
+ get(target, key) {
11026
+ markAttrsAccessed();
11027
+ track(target, "get", "");
11028
+ return target[key];
11029
+ },
11030
+ set() {
11031
+ warn$1(`setupContext.attrs is readonly.`);
11032
+ return false;
11033
+ },
11034
+ deleteProperty() {
11035
+ warn$1(`setupContext.attrs is readonly.`);
11036
+ return false;
11037
+ }
11038
+ } : {
11039
+ get(target, key) {
11040
+ track(target, "get", "");
11041
+ return target[key];
11042
+ }
11043
+ };
11007
11044
  function getSlotsProxy(instance) {
11008
11045
  return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
11009
11046
  get(target, key) {
@@ -11037,9 +11074,10 @@ function createSetupContext(instance) {
11037
11074
  instance.exposed = exposed || {};
11038
11075
  };
11039
11076
  if (!!(process.env.NODE_ENV !== "production")) {
11077
+ let attrsProxy;
11040
11078
  return Object.freeze({
11041
11079
  get attrs() {
11042
- return getAttrsProxy(instance);
11080
+ return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
11043
11081
  },
11044
11082
  get slots() {
11045
11083
  return getSlotsProxy(instance);
@@ -11051,9 +11089,7 @@ function createSetupContext(instance) {
11051
11089
  });
11052
11090
  } else {
11053
11091
  return {
11054
- get attrs() {
11055
- return getAttrsProxy(instance);
11056
- },
11092
+ attrs: new Proxy(instance.attrs, attrsProxyHandlers),
11057
11093
  slots: instance.slots,
11058
11094
  emit: instance.emit,
11059
11095
  expose
@@ -11393,7 +11429,7 @@ function isMemoSame(cached, memo) {
11393
11429
  return true;
11394
11430
  }
11395
11431
 
11396
- const version = "3.4.20";
11432
+ const version = "3.4.22";
11397
11433
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11398
11434
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11399
11435
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -11878,8 +11914,8 @@ function useCssVars(getter) {
11878
11914
  setVarsOnVNode(instance.subTree, vars);
11879
11915
  updateTeleports(vars);
11880
11916
  };
11881
- watchPostEffect(setVars);
11882
11917
  onMounted(() => {
11918
+ watchPostEffect(setVars);
11883
11919
  const ob = new MutationObserver(setVars);
11884
11920
  ob.observe(instance.subTree.el.parentNode, { childList: true });
11885
11921
  onUnmounted(() => ob.disconnect());
@@ -12081,15 +12117,15 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
12081
12117
  const tag = el.tagName;
12082
12118
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
12083
12119
  !tag.includes("-")) {
12084
- el._value = value;
12085
12120
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
12086
12121
  const newValue = value == null ? "" : value;
12087
- if (oldValue !== newValue) {
12122
+ if (oldValue !== newValue || !("_value" in el)) {
12088
12123
  el.value = newValue;
12089
12124
  }
12090
12125
  if (value == null) {
12091
12126
  el.removeAttribute(key);
12092
12127
  }
12128
+ el._value = value;
12093
12129
  return;
12094
12130
  }
12095
12131
  let needRemove = false;
@@ -12145,11 +12181,14 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
12145
12181
  const invokers = el[veiKey] || (el[veiKey] = {});
12146
12182
  const existingInvoker = invokers[rawName];
12147
12183
  if (nextValue && existingInvoker) {
12148
- existingInvoker.value = nextValue;
12184
+ existingInvoker.value = !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue;
12149
12185
  } else {
12150
12186
  const [name, options] = parseName(rawName);
12151
12187
  if (nextValue) {
12152
- const invoker = invokers[rawName] = createInvoker(nextValue, instance);
12188
+ const invoker = invokers[rawName] = createInvoker(
12189
+ !!(process.env.NODE_ENV !== "production") ? sanitizeEventValue(nextValue, rawName) : nextValue,
12190
+ instance
12191
+ );
12153
12192
  addEventListener(el, name, invoker, options);
12154
12193
  } else if (existingInvoker) {
12155
12194
  removeEventListener(el, name, existingInvoker, options);
@@ -12192,6 +12231,16 @@ function createInvoker(initialValue, instance) {
12192
12231
  invoker.attached = getNow();
12193
12232
  return invoker;
12194
12233
  }
12234
+ function sanitizeEventValue(value, propName) {
12235
+ if (isFunction(value) || isArray(value)) {
12236
+ return value;
12237
+ }
12238
+ warn(
12239
+ `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
12240
+ Expected function or array of functions, received type ${typeof value}.`
12241
+ );
12242
+ return NOOP;
12243
+ }
12195
12244
  function patchStopImmediatePropagation(e, value) {
12196
12245
  if (isArray(value)) {
12197
12246
  const originalStop = e.stopImmediatePropagation;
@@ -12199,7 +12248,9 @@ function patchStopImmediatePropagation(e, value) {
12199
12248
  originalStop.call(e);
12200
12249
  e._stopped = true;
12201
12250
  };
12202
- return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
12251
+ return value.map(
12252
+ (fn) => (e2) => !e2._stopped && fn && fn(e2)
12253
+ );
12203
12254
  } else {
12204
12255
  return value;
12205
12256
  }
@@ -12400,7 +12451,7 @@ class VueElement extends BaseClass {
12400
12451
  }
12401
12452
  }
12402
12453
  _setAttr(key) {
12403
- let value = this.getAttribute(key);
12454
+ let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
12404
12455
  const camelKey = camelize(key);
12405
12456
  if (this._numberProps && this._numberProps[camelKey]) {
12406
12457
  value = toNumber(value);
@@ -12572,7 +12623,28 @@ const TransitionGroupImpl = {
12572
12623
  )) {
12573
12624
  tag = "span";
12574
12625
  }
12575
- prevChildren = children;
12626
+ prevChildren = [];
12627
+ if (children) {
12628
+ for (let i = 0; i < children.length; i++) {
12629
+ const child = children[i];
12630
+ if (child.el && child.el instanceof Element) {
12631
+ prevChildren.push(child);
12632
+ setTransitionHooks(
12633
+ child,
12634
+ resolveTransitionHooks(
12635
+ child,
12636
+ cssTransitionProps,
12637
+ state,
12638
+ instance
12639
+ )
12640
+ );
12641
+ positionMap.set(
12642
+ child,
12643
+ child.el.getBoundingClientRect()
12644
+ );
12645
+ }
12646
+ }
12647
+ }
12576
12648
  children = slots.default ? getTransitionRawChildren(slots.default()) : [];
12577
12649
  for (let i = 0; i < children.length; i++) {
12578
12650
  const child = children[i];
@@ -12585,16 +12657,6 @@ const TransitionGroupImpl = {
12585
12657
  warn(`<TransitionGroup> children must be keyed.`);
12586
12658
  }
12587
12659
  }
12588
- if (prevChildren) {
12589
- for (let i = 0; i < prevChildren.length; i++) {
12590
- const child = prevChildren[i];
12591
- setTransitionHooks(
12592
- child,
12593
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
12594
- );
12595
- positionMap.set(child, child.el.getBoundingClientRect());
12596
- }
12597
- }
12598
12660
  return createVNode(tag, null, children);
12599
12661
  };
12600
12662
  }
@@ -12696,7 +12758,7 @@ const vModelText = {
12696
12758
  el[assignKey] = getModelAssigner(vnode);
12697
12759
  if (el.composing)
12698
12760
  return;
12699
- const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12761
+ const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
12700
12762
  const newValue = value == null ? "" : value;
12701
12763
  if (elValue === newValue) {
12702
12764
  return;
@@ -12799,14 +12861,14 @@ const vModelSelect = {
12799
12861
  // set value in mounted & updated because <select> relies on its children
12800
12862
  // <option>s.
12801
12863
  mounted(el, { value, modifiers: { number } }) {
12802
- setSelected(el, value, number);
12864
+ setSelected(el, value);
12803
12865
  },
12804
12866
  beforeUpdate(el, _binding, vnode) {
12805
12867
  el[assignKey] = getModelAssigner(vnode);
12806
12868
  },
12807
12869
  updated(el, { value, modifiers: { number } }) {
12808
12870
  if (!el._assigning) {
12809
- setSelected(el, value, number);
12871
+ setSelected(el, value);
12810
12872
  }
12811
12873
  }
12812
12874
  };
@@ -12826,9 +12888,7 @@ function setSelected(el, value, number) {
12826
12888
  if (isArrayValue) {
12827
12889
  const optionType = typeof optionValue;
12828
12890
  if (optionType === "string" || optionType === "number") {
12829
- option.selected = value.includes(
12830
- number ? looseToNumber(optionValue) : optionValue
12831
- );
12891
+ option.selected = value.some((v) => String(v) === String(optionValue));
12832
12892
  } else {
12833
12893
  option.selected = looseIndexOf(value, optionValue) > -1;
12834
12894
  }