@vue/runtime-dom 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.
@@ -22,27 +22,6 @@ var VueRuntimeDOM = (function (exports) {
22
22
  'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
23
23
  const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
24
24
 
25
- /**
26
- * On the client we only need to offer special cases for boolean attributes that
27
- * have different names from their corresponding dom properties:
28
- * - itemscope -> N/A
29
- * - allowfullscreen -> allowFullscreen
30
- * - formnovalidate -> formNoValidate
31
- * - ismap -> isMap
32
- * - nomodule -> noModule
33
- * - novalidate -> noValidate
34
- * - readonly -> readOnly
35
- */
36
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
37
- const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
38
- /**
39
- * Boolean attributes should be included if the value is truthy or ''.
40
- * e.g. `<select multiple>` compiles to `{ multiple: '' }`
41
- */
42
- function includeBooleanAttr(value) {
43
- return !!value || value === '';
44
- }
45
-
46
25
  function normalizeStyle(value) {
47
26
  if (isArray(value)) {
48
27
  const res = {};
@@ -67,10 +46,14 @@ var VueRuntimeDOM = (function (exports) {
67
46
  }
68
47
  }
69
48
  const listDelimiterRE = /;(?![^(]*\))/g;
70
- const propertyDelimiterRE = /:(.+)/;
49
+ const propertyDelimiterRE = /:([^]+)/;
50
+ const styleCommentRE = /\/\*.*?\*\//gs;
71
51
  function parseStringStyle(cssText) {
72
52
  const ret = {};
73
- cssText.split(listDelimiterRE).forEach(item => {
53
+ cssText
54
+ .replace(styleCommentRE, '')
55
+ .split(listDelimiterRE)
56
+ .forEach(item => {
74
57
  if (item) {
75
58
  const tmp = item.split(propertyDelimiterRE);
76
59
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -146,6 +129,27 @@ var VueRuntimeDOM = (function (exports) {
146
129
  */
147
130
  const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
148
131
 
132
+ /**
133
+ * On the client we only need to offer special cases for boolean attributes that
134
+ * have different names from their corresponding dom properties:
135
+ * - itemscope -> N/A
136
+ * - allowfullscreen -> allowFullscreen
137
+ * - formnovalidate -> formNoValidate
138
+ * - ismap -> isMap
139
+ * - nomodule -> noModule
140
+ * - novalidate -> noValidate
141
+ * - readonly -> readOnly
142
+ */
143
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
144
+ const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
145
+ /**
146
+ * Boolean attributes should be included if the value is truthy or ''.
147
+ * e.g. `<select multiple>` compiles to `{ multiple: '' }`
148
+ */
149
+ function includeBooleanAttr(value) {
150
+ return !!value || value === '';
151
+ }
152
+
149
153
  function looseCompareArrays(a, b) {
150
154
  if (a.length !== b.length)
151
155
  return false;
@@ -649,8 +653,9 @@ var VueRuntimeDOM = (function (exports) {
649
653
  deps = [...depsMap.values()];
650
654
  }
651
655
  else if (key === 'length' && isArray(target)) {
656
+ const newLength = toNumber(newValue);
652
657
  depsMap.forEach((dep, key) => {
653
- if (key === 'length' || key >= newValue) {
658
+ if (key === 'length' || key >= newLength) {
654
659
  deps.push(dep);
655
660
  }
656
661
  });
@@ -2184,7 +2189,7 @@ var VueRuntimeDOM = (function (exports) {
2184
2189
  const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
2185
2190
  const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
2186
2191
  if (trim) {
2187
- args = rawArgs.map(a => a.trim());
2192
+ args = rawArgs.map(a => (isString(a) ? a.trim() : a));
2188
2193
  }
2189
2194
  if (number) {
2190
2195
  args = rawArgs.map(toNumber);
@@ -3246,7 +3251,9 @@ var VueRuntimeDOM = (function (exports) {
3246
3251
  callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
3247
3252
  };
3248
3253
  };
3249
- let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
3254
+ let oldValue = isMultiSource
3255
+ ? new Array(source.length).fill(INITIAL_WATCHER_VALUE)
3256
+ : INITIAL_WATCHER_VALUE;
3250
3257
  const job = () => {
3251
3258
  if (!effect.active) {
3252
3259
  return;
@@ -3267,7 +3274,10 @@ var VueRuntimeDOM = (function (exports) {
3267
3274
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
3268
3275
  newValue,
3269
3276
  // pass undefined as the old value when it's changed for the first time
3270
- oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
3277
+ oldValue === INITIAL_WATCHER_VALUE ||
3278
+ (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
3279
+ ? []
3280
+ : oldValue,
3271
3281
  onCleanup
3272
3282
  ]);
3273
3283
  oldValue = newValue;
@@ -3315,12 +3325,13 @@ var VueRuntimeDOM = (function (exports) {
3315
3325
  else {
3316
3326
  effect.run();
3317
3327
  }
3318
- return () => {
3328
+ const unwatch = () => {
3319
3329
  effect.stop();
3320
3330
  if (instance && instance.scope) {
3321
3331
  remove(instance.scope.effects, effect);
3322
3332
  }
3323
3333
  };
3334
+ return unwatch;
3324
3335
  }
3325
3336
  // this.$watch
3326
3337
  function instanceWatch(source, value, options) {
@@ -3502,7 +3513,11 @@ var VueRuntimeDOM = (function (exports) {
3502
3513
  // return placeholder node and queue update when leave finishes
3503
3514
  leavingHooks.afterLeave = () => {
3504
3515
  state.isLeaving = false;
3505
- instance.update();
3516
+ // #6835
3517
+ // it also needs to be updated when active is undefined
3518
+ if (instance.update.active !== false) {
3519
+ instance.update();
3520
+ }
3506
3521
  };
3507
3522
  return emptyPlaceholder(child);
3508
3523
  }
@@ -4020,7 +4035,8 @@ var VueRuntimeDOM = (function (exports) {
4020
4035
  : comp);
4021
4036
  const { include, exclude, max } = props;
4022
4037
  if ((include && (!name || !matches(include, name))) ||
4023
- (exclude && name && matches(exclude, name))) {
4038
+ (exclude && name && matches(exclude, name)) ||
4039
+ (hmrDirtyComponents.has(comp))) {
4024
4040
  current = vnode;
4025
4041
  return rawVNode;
4026
4042
  }
@@ -4232,23 +4248,25 @@ var VueRuntimeDOM = (function (exports) {
4232
4248
  const bindings = vnode.dirs || (vnode.dirs = []);
4233
4249
  for (let i = 0; i < directives.length; i++) {
4234
4250
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4235
- if (isFunction(dir)) {
4236
- dir = {
4237
- mounted: dir,
4238
- updated: dir
4239
- };
4240
- }
4241
- if (dir.deep) {
4242
- traverse(value);
4251
+ if (dir) {
4252
+ if (isFunction(dir)) {
4253
+ dir = {
4254
+ mounted: dir,
4255
+ updated: dir
4256
+ };
4257
+ }
4258
+ if (dir.deep) {
4259
+ traverse(value);
4260
+ }
4261
+ bindings.push({
4262
+ dir,
4263
+ instance,
4264
+ value,
4265
+ oldValue: void 0,
4266
+ arg,
4267
+ modifiers
4268
+ });
4243
4269
  }
4244
- bindings.push({
4245
- dir,
4246
- instance,
4247
- value,
4248
- oldValue: void 0,
4249
- arg,
4250
- modifiers
4251
- });
4252
4270
  }
4253
4271
  return vnode;
4254
4272
  }
@@ -5461,7 +5479,7 @@ var VueRuntimeDOM = (function (exports) {
5461
5479
  if (validatePropName(normalizedKey)) {
5462
5480
  const opt = raw[key];
5463
5481
  const prop = (normalized[normalizedKey] =
5464
- isArray(opt) || isFunction(opt) ? { type: opt } : opt);
5482
+ isArray(opt) || isFunction(opt) ? { type: opt } : Object.assign({}, opt));
5465
5483
  if (prop) {
5466
5484
  const booleanIndex = getTypeIndex(Boolean, prop.type);
5467
5485
  const stringIndex = getTypeIndex(String, prop.type);
@@ -8798,6 +8816,9 @@ var VueRuntimeDOM = (function (exports) {
8798
8816
  else if (key in publicPropertiesMap) {
8799
8817
  return publicPropertiesMap[key](instance);
8800
8818
  }
8819
+ },
8820
+ has(target, key) {
8821
+ return key in target || key in publicPropertiesMap;
8801
8822
  }
8802
8823
  })));
8803
8824
  }
@@ -9246,7 +9267,7 @@ var VueRuntimeDOM = (function (exports) {
9246
9267
  }
9247
9268
 
9248
9269
  // Core API ------------------------------------------------------------------
9249
- const version = "3.2.41";
9270
+ const version = "3.2.43";
9250
9271
  /**
9251
9272
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
9252
9273
  * @internal
@@ -9765,7 +9786,7 @@ var VueRuntimeDOM = (function (exports) {
9765
9786
  }
9766
9787
  }).observe(this, { attributes: true });
9767
9788
  const resolve = (def) => {
9768
- const { props, styles } = def;
9789
+ const { props = {}, styles } = def;
9769
9790
  const hasOptions = !isArray(props);
9770
9791
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
9771
9792
  // cast Number-type props set before resolve
@@ -9812,10 +9833,11 @@ var VueRuntimeDOM = (function (exports) {
9812
9833
  }
9813
9834
  _setAttr(key) {
9814
9835
  let value = this.getAttribute(key);
9815
- if (this._numberProps && this._numberProps[key]) {
9836
+ const camelKey = camelize(key);
9837
+ if (this._numberProps && this._numberProps[camelKey]) {
9816
9838
  value = toNumber(value);
9817
9839
  }
9818
- this._setProp(camelize(key), value, false);
9840
+ this._setProp(camelKey, value, false);
9819
9841
  }
9820
9842
  /**
9821
9843
  * @internal
@@ -10196,11 +10218,11 @@ var VueRuntimeDOM = (function (exports) {
10196
10218
  const styles = window.getComputedStyle(el);
10197
10219
  // JSDOM may return undefined for transition properties
10198
10220
  const getStyleProperties = (key) => (styles[key] || '').split(', ');
10199
- const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
10200
- const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
10221
+ const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
10222
+ const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
10201
10223
  const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
10202
- const animationDelays = getStyleProperties(ANIMATION + 'Delay');
10203
- const animationDurations = getStyleProperties(ANIMATION + 'Duration');
10224
+ const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
10225
+ const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
10204
10226
  const animationTimeout = getTimeout(animationDelays, animationDurations);
10205
10227
  let type = null;
10206
10228
  let timeout = 0;
@@ -10235,7 +10257,7 @@ var VueRuntimeDOM = (function (exports) {
10235
10257
  : 0;
10236
10258
  }
10237
10259
  const hasTransform = type === TRANSITION &&
10238
- /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
10260
+ /\b(transform|all)(,|$)/.test(getStyleProperties(`${TRANSITION}Property`).toString());
10239
10261
  return {
10240
10262
  type,
10241
10263
  timeout,