@vue/compat 3.2.41 → 3.2.43

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.
@@ -95,27 +95,6 @@ var Vue = (function () {
95
95
  return res.join('\n');
96
96
  }
97
97
 
98
- /**
99
- * On the client we only need to offer special cases for boolean attributes that
100
- * have different names from their corresponding dom properties:
101
- * - itemscope -> N/A
102
- * - allowfullscreen -> allowFullscreen
103
- * - formnovalidate -> formNoValidate
104
- * - ismap -> isMap
105
- * - nomodule -> noModule
106
- * - novalidate -> noValidate
107
- * - readonly -> readOnly
108
- */
109
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
110
- const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
111
- /**
112
- * Boolean attributes should be included if the value is truthy or ''.
113
- * e.g. `<select multiple>` compiles to `{ multiple: '' }`
114
- */
115
- function includeBooleanAttr(value) {
116
- return !!value || value === '';
117
- }
118
-
119
98
  function normalizeStyle(value) {
120
99
  if (isArray(value)) {
121
100
  const res = {};
@@ -140,10 +119,14 @@ var Vue = (function () {
140
119
  }
141
120
  }
142
121
  const listDelimiterRE = /;(?![^(]*\))/g;
143
- const propertyDelimiterRE = /:(.+)/;
122
+ const propertyDelimiterRE = /:([^]+)/;
123
+ const styleCommentRE = /\/\*.*?\*\//gs;
144
124
  function parseStringStyle(cssText) {
145
125
  const ret = {};
146
- cssText.split(listDelimiterRE).forEach(item => {
126
+ cssText
127
+ .replace(styleCommentRE, '')
128
+ .split(listDelimiterRE)
129
+ .forEach(item => {
147
130
  if (item) {
148
131
  const tmp = item.split(propertyDelimiterRE);
149
132
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -225,6 +208,27 @@ var Vue = (function () {
225
208
  */
226
209
  const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
227
210
 
211
+ /**
212
+ * On the client we only need to offer special cases for boolean attributes that
213
+ * have different names from their corresponding dom properties:
214
+ * - itemscope -> N/A
215
+ * - allowfullscreen -> allowFullscreen
216
+ * - formnovalidate -> formNoValidate
217
+ * - ismap -> isMap
218
+ * - nomodule -> noModule
219
+ * - novalidate -> noValidate
220
+ * - readonly -> readOnly
221
+ */
222
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
223
+ const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
224
+ /**
225
+ * Boolean attributes should be included if the value is truthy or ''.
226
+ * e.g. `<select multiple>` compiles to `{ multiple: '' }`
227
+ */
228
+ function includeBooleanAttr(value) {
229
+ return !!value || value === '';
230
+ }
231
+
228
232
  function looseCompareArrays(a, b) {
229
233
  if (a.length !== b.length)
230
234
  return false;
@@ -728,8 +732,9 @@ var Vue = (function () {
728
732
  deps = [...depsMap.values()];
729
733
  }
730
734
  else if (key === 'length' && isArray(target)) {
735
+ const newLength = toNumber(newValue);
731
736
  depsMap.forEach((dep, key) => {
732
- if (key === 'length' || key >= newValue) {
737
+ if (key === 'length' || key >= newLength) {
733
738
  deps.push(dep);
734
739
  }
735
740
  });
@@ -2783,7 +2788,7 @@ var Vue = (function () {
2783
2788
  const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
2784
2789
  const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
2785
2790
  if (trim) {
2786
- args = rawArgs.map(a => a.trim());
2791
+ args = rawArgs.map(a => (isString(a) ? a.trim() : a));
2787
2792
  }
2788
2793
  if (number) {
2789
2794
  args = rawArgs.map(toNumber);
@@ -3886,7 +3891,9 @@ var Vue = (function () {
3886
3891
  callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
3887
3892
  };
3888
3893
  };
3889
- let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
3894
+ let oldValue = isMultiSource
3895
+ ? new Array(source.length).fill(INITIAL_WATCHER_VALUE)
3896
+ : INITIAL_WATCHER_VALUE;
3890
3897
  const job = () => {
3891
3898
  if (!effect.active) {
3892
3899
  return;
@@ -3908,7 +3915,10 @@ var Vue = (function () {
3908
3915
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
3909
3916
  newValue,
3910
3917
  // pass undefined as the old value when it's changed for the first time
3911
- oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
3918
+ oldValue === INITIAL_WATCHER_VALUE ||
3919
+ (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
3920
+ ? []
3921
+ : oldValue,
3912
3922
  onCleanup
3913
3923
  ]);
3914
3924
  oldValue = newValue;
@@ -3956,12 +3966,13 @@ var Vue = (function () {
3956
3966
  else {
3957
3967
  effect.run();
3958
3968
  }
3959
- return () => {
3969
+ const unwatch = () => {
3960
3970
  effect.stop();
3961
3971
  if (instance && instance.scope) {
3962
3972
  remove(instance.scope.effects, effect);
3963
3973
  }
3964
3974
  };
3975
+ return unwatch;
3965
3976
  }
3966
3977
  // this.$watch
3967
3978
  function instanceWatch(source, value, options) {
@@ -4143,7 +4154,11 @@ var Vue = (function () {
4143
4154
  // return placeholder node and queue update when leave finishes
4144
4155
  leavingHooks.afterLeave = () => {
4145
4156
  state.isLeaving = false;
4146
- instance.update();
4157
+ // #6835
4158
+ // it also needs to be updated when active is undefined
4159
+ if (instance.update.active !== false) {
4160
+ instance.update();
4161
+ }
4147
4162
  };
4148
4163
  return emptyPlaceholder(child);
4149
4164
  }
@@ -4664,7 +4679,8 @@ var Vue = (function () {
4664
4679
  : comp);
4665
4680
  const { include, exclude, max } = props;
4666
4681
  if ((include && (!name || !matches(include, name))) ||
4667
- (exclude && name && matches(exclude, name))) {
4682
+ (exclude && name && matches(exclude, name)) ||
4683
+ (hmrDirtyComponents.has(comp))) {
4668
4684
  current = vnode;
4669
4685
  return rawVNode;
4670
4686
  }
@@ -4944,23 +4960,25 @@ var Vue = (function () {
4944
4960
  const bindings = vnode.dirs || (vnode.dirs = []);
4945
4961
  for (let i = 0; i < directives.length; i++) {
4946
4962
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4947
- if (isFunction(dir)) {
4948
- dir = {
4949
- mounted: dir,
4950
- updated: dir
4951
- };
4952
- }
4953
- if (dir.deep) {
4954
- traverse(value);
4963
+ if (dir) {
4964
+ if (isFunction(dir)) {
4965
+ dir = {
4966
+ mounted: dir,
4967
+ updated: dir
4968
+ };
4969
+ }
4970
+ if (dir.deep) {
4971
+ traverse(value);
4972
+ }
4973
+ bindings.push({
4974
+ dir,
4975
+ instance,
4976
+ value,
4977
+ oldValue: void 0,
4978
+ arg,
4979
+ modifiers
4980
+ });
4955
4981
  }
4956
- bindings.push({
4957
- dir,
4958
- instance,
4959
- value,
4960
- oldValue: void 0,
4961
- arg,
4962
- modifiers
4963
- });
4964
4982
  }
4965
4983
  return vnode;
4966
4984
  }
@@ -6787,7 +6805,7 @@ var Vue = (function () {
6787
6805
  if (validatePropName(normalizedKey)) {
6788
6806
  const opt = raw[key];
6789
6807
  const prop = (normalized[normalizedKey] =
6790
- isArray(opt) || isFunction(opt) ? { type: opt } : opt);
6808
+ isArray(opt) || isFunction(opt) ? { type: opt } : Object.assign({}, opt));
6791
6809
  if (prop) {
6792
6810
  const booleanIndex = getTypeIndex(Boolean, prop.type);
6793
6811
  const stringIndex = getTypeIndex(String, prop.type);
@@ -7157,7 +7175,7 @@ var Vue = (function () {
7157
7175
  return vm;
7158
7176
  }
7159
7177
  }
7160
- Vue.version = `2.6.14-compat:${"3.2.41"}`;
7178
+ Vue.version = `2.6.14-compat:${"3.2.43"}`;
7161
7179
  Vue.config = singletonApp.config;
7162
7180
  Vue.use = (p, ...options) => {
7163
7181
  if (p && isFunction(p.install)) {
@@ -10713,6 +10731,9 @@ var Vue = (function () {
10713
10731
  else if (key in publicPropertiesMap) {
10714
10732
  return publicPropertiesMap[key](instance);
10715
10733
  }
10734
+ },
10735
+ has(target, key) {
10736
+ return key in target || key in publicPropertiesMap;
10716
10737
  }
10717
10738
  })));
10718
10739
  }
@@ -11161,7 +11182,7 @@ var Vue = (function () {
11161
11182
  }
11162
11183
 
11163
11184
  // Core API ------------------------------------------------------------------
11164
- const version = "3.2.41";
11185
+ const version = "3.2.43";
11165
11186
  /**
11166
11187
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
11167
11188
  * @internal
@@ -11725,7 +11746,7 @@ var Vue = (function () {
11725
11746
  }
11726
11747
  }).observe(this, { attributes: true });
11727
11748
  const resolve = (def) => {
11728
- const { props, styles } = def;
11749
+ const { props = {}, styles } = def;
11729
11750
  const hasOptions = !isArray(props);
11730
11751
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11731
11752
  // cast Number-type props set before resolve
@@ -11772,10 +11793,11 @@ var Vue = (function () {
11772
11793
  }
11773
11794
  _setAttr(key) {
11774
11795
  let value = this.getAttribute(key);
11775
- if (this._numberProps && this._numberProps[key]) {
11796
+ const camelKey = camelize(key);
11797
+ if (this._numberProps && this._numberProps[camelKey]) {
11776
11798
  value = toNumber(value);
11777
11799
  }
11778
- this._setProp(camelize(key), value, false);
11800
+ this._setProp(camelKey, value, false);
11779
11801
  }
11780
11802
  /**
11781
11803
  * @internal
@@ -12191,11 +12213,11 @@ var Vue = (function () {
12191
12213
  const styles = window.getComputedStyle(el);
12192
12214
  // JSDOM may return undefined for transition properties
12193
12215
  const getStyleProperties = (key) => (styles[key] || '').split(', ');
12194
- const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
12195
- const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
12216
+ const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
12217
+ const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
12196
12218
  const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
12197
- const animationDelays = getStyleProperties(ANIMATION + 'Delay');
12198
- const animationDurations = getStyleProperties(ANIMATION + 'Duration');
12219
+ const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
12220
+ const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
12199
12221
  const animationTimeout = getTimeout(animationDelays, animationDurations);
12200
12222
  let type = null;
12201
12223
  let timeout = 0;
@@ -12230,7 +12252,7 @@ var Vue = (function () {
12230
12252
  : 0;
12231
12253
  }
12232
12254
  const hasTransform = type === TRANSITION &&
12233
- /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
12255
+ /\b(transform|all)(,|$)/.test(getStyleProperties(`${TRANSITION}Property`).toString());
12234
12256
  return {
12235
12257
  type,
12236
12258
  timeout,
@@ -13619,7 +13641,10 @@ var Vue = (function () {
13619
13641
  // if doesn't override user provided keys
13620
13642
  const first = props.arguments[0];
13621
13643
  if (!isString(first) && first.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
13622
- first.properties.unshift(prop);
13644
+ // #6631
13645
+ if (!hasProp(prop, first)) {
13646
+ first.properties.unshift(prop);
13647
+ }
13623
13648
  }
13624
13649
  else {
13625
13650
  if (props.callee === TO_HANDLERS) {
@@ -13636,14 +13661,7 @@ var Vue = (function () {
13636
13661
  !propsWithInjection && (propsWithInjection = props);
13637
13662
  }
13638
13663
  else if (props.type === 15 /* NodeTypes.JS_OBJECT_EXPRESSION */) {
13639
- let alreadyExists = false;
13640
- // check existing key to avoid overriding user provided keys
13641
- if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
13642
- const propKeyName = prop.key.content;
13643
- alreadyExists = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
13644
- p.key.content === propKeyName);
13645
- }
13646
- if (!alreadyExists) {
13664
+ if (!hasProp(prop, props)) {
13647
13665
  props.properties.unshift(prop);
13648
13666
  }
13649
13667
  propsWithInjection = props;
@@ -13678,6 +13696,16 @@ var Vue = (function () {
13678
13696
  }
13679
13697
  }
13680
13698
  }
13699
+ // check existing key to avoid overriding user provided keys
13700
+ function hasProp(prop, props) {
13701
+ let result = false;
13702
+ if (prop.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */) {
13703
+ const propKeyName = prop.key.content;
13704
+ result = props.properties.some(p => p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
13705
+ p.key.content === propKeyName);
13706
+ }
13707
+ return result;
13708
+ }
13681
13709
  function toValidAssetId(name, type) {
13682
13710
  // see issue#4422, we need adding identifier on validAssetId if variable `name` has specific character
13683
13711
  return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
@@ -13949,13 +13977,18 @@ var Vue = (function () {
13949
13977
  const next = nodes[i + 1];
13950
13978
  // Remove if:
13951
13979
  // - the whitespace is the first or last node, or:
13952
- // - (condense mode) the whitespace is adjacent to a comment, or:
13980
+ // - (condense mode) the whitespace is between twos comments, or:
13981
+ // - (condense mode) the whitespace is between comment and element, or:
13953
13982
  // - (condense mode) the whitespace is between two elements AND contains newline
13954
13983
  if (!prev ||
13955
13984
  !next ||
13956
13985
  (shouldCondense &&
13957
- (prev.type === 3 /* NodeTypes.COMMENT */ ||
13958
- next.type === 3 /* NodeTypes.COMMENT */ ||
13986
+ ((prev.type === 3 /* NodeTypes.COMMENT */ &&
13987
+ next.type === 3 /* NodeTypes.COMMENT */) ||
13988
+ (prev.type === 3 /* NodeTypes.COMMENT */ &&
13989
+ next.type === 1 /* NodeTypes.ELEMENT */) ||
13990
+ (prev.type === 1 /* NodeTypes.ELEMENT */ &&
13991
+ next.type === 3 /* NodeTypes.COMMENT */) ||
13959
13992
  (prev.type === 1 /* NodeTypes.ELEMENT */ &&
13960
13993
  next.type === 1 /* NodeTypes.ELEMENT */ &&
13961
13994
  /[\r\n]/.test(node.content))))) {
@@ -17159,7 +17192,7 @@ var Vue = (function () {
17159
17192
  };
17160
17193
  }
17161
17194
 
17162
- const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
17195
+ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
17163
17196
  const transformOn = (dir, node, context, augmentor) => {
17164
17197
  const { loc, modifiers, arg } = dir;
17165
17198
  if (!dir.exp && !modifiers.length) {
@@ -17173,10 +17206,10 @@ var Vue = (function () {
17173
17206
  if (rawName.startsWith('vue:')) {
17174
17207
  rawName = `vnode-${rawName.slice(4)}`;
17175
17208
  }
17176
- const eventString = node.tagType === 1 /* ElementTypes.COMPONENT */ ||
17209
+ const eventString = node.tagType !== 0 /* ElementTypes.ELEMENT */ ||
17177
17210
  rawName.startsWith('vnode') ||
17178
17211
  !/[A-Z]/.test(rawName)
17179
- ? // for component and vnode lifecycle event listeners, auto convert
17212
+ ? // for non-element and vnode lifecycle event listeners, auto convert
17180
17213
  // it to camelCase. See issue #2249
17181
17214
  toHandlerKey(camelize(rawName))
17182
17215
  : // preserve case for plain element listeners that have uppercase