@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.
@@ -19,27 +19,6 @@ const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,p
19
19
  'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
20
20
  const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
21
21
 
22
- /**
23
- * On the client we only need to offer special cases for boolean attributes that
24
- * have different names from their corresponding dom properties:
25
- * - itemscope -> N/A
26
- * - allowfullscreen -> allowFullscreen
27
- * - formnovalidate -> formNoValidate
28
- * - ismap -> isMap
29
- * - nomodule -> noModule
30
- * - novalidate -> noValidate
31
- * - readonly -> readOnly
32
- */
33
- const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
34
- const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
35
- /**
36
- * Boolean attributes should be included if the value is truthy or ''.
37
- * e.g. `<select multiple>` compiles to `{ multiple: '' }`
38
- */
39
- function includeBooleanAttr(value) {
40
- return !!value || value === '';
41
- }
42
-
43
22
  function normalizeStyle(value) {
44
23
  if (isArray(value)) {
45
24
  const res = {};
@@ -64,10 +43,14 @@ function normalizeStyle(value) {
64
43
  }
65
44
  }
66
45
  const listDelimiterRE = /;(?![^(]*\))/g;
67
- const propertyDelimiterRE = /:(.+)/;
46
+ const propertyDelimiterRE = /:([^]+)/;
47
+ const styleCommentRE = /\/\*.*?\*\//gs;
68
48
  function parseStringStyle(cssText) {
69
49
  const ret = {};
70
- cssText.split(listDelimiterRE).forEach(item => {
50
+ cssText
51
+ .replace(styleCommentRE, '')
52
+ .split(listDelimiterRE)
53
+ .forEach(item => {
71
54
  if (item) {
72
55
  const tmp = item.split(propertyDelimiterRE);
73
56
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -143,6 +126,27 @@ const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
143
126
  */
144
127
  const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
145
128
 
129
+ /**
130
+ * On the client we only need to offer special cases for boolean attributes that
131
+ * have different names from their corresponding dom properties:
132
+ * - itemscope -> N/A
133
+ * - allowfullscreen -> allowFullscreen
134
+ * - formnovalidate -> formNoValidate
135
+ * - ismap -> isMap
136
+ * - nomodule -> noModule
137
+ * - novalidate -> noValidate
138
+ * - readonly -> readOnly
139
+ */
140
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
141
+ const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
142
+ /**
143
+ * Boolean attributes should be included if the value is truthy or ''.
144
+ * e.g. `<select multiple>` compiles to `{ multiple: '' }`
145
+ */
146
+ function includeBooleanAttr(value) {
147
+ return !!value || value === '';
148
+ }
149
+
146
150
  function looseCompareArrays(a, b) {
147
151
  if (a.length !== b.length)
148
152
  return false;
@@ -646,8 +650,9 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
646
650
  deps = [...depsMap.values()];
647
651
  }
648
652
  else if (key === 'length' && isArray(target)) {
653
+ const newLength = toNumber(newValue);
649
654
  depsMap.forEach((dep, key) => {
650
- if (key === 'length' || key >= newValue) {
655
+ if (key === 'length' || key >= newLength) {
651
656
  deps.push(dep);
652
657
  }
653
658
  });
@@ -2701,7 +2706,7 @@ function emit$2(instance, event, ...rawArgs) {
2701
2706
  const modifiersKey = `${modelArg === 'modelValue' ? 'model' : modelArg}Modifiers`;
2702
2707
  const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
2703
2708
  if (trim) {
2704
- args = rawArgs.map(a => a.trim());
2709
+ args = rawArgs.map(a => (isString(a) ? a.trim() : a));
2705
2710
  }
2706
2711
  if (number) {
2707
2712
  args = rawArgs.map(toNumber);
@@ -3804,7 +3809,9 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3804
3809
  callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
3805
3810
  };
3806
3811
  };
3807
- let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
3812
+ let oldValue = isMultiSource
3813
+ ? new Array(source.length).fill(INITIAL_WATCHER_VALUE)
3814
+ : INITIAL_WATCHER_VALUE;
3808
3815
  const job = () => {
3809
3816
  if (!effect.active) {
3810
3817
  return;
@@ -3826,7 +3833,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3826
3833
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
3827
3834
  newValue,
3828
3835
  // pass undefined as the old value when it's changed for the first time
3829
- oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
3836
+ oldValue === INITIAL_WATCHER_VALUE ||
3837
+ (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
3838
+ ? []
3839
+ : oldValue,
3830
3840
  onCleanup
3831
3841
  ]);
3832
3842
  oldValue = newValue;
@@ -3874,12 +3884,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3874
3884
  else {
3875
3885
  effect.run();
3876
3886
  }
3877
- return () => {
3887
+ const unwatch = () => {
3878
3888
  effect.stop();
3879
3889
  if (instance && instance.scope) {
3880
3890
  remove(instance.scope.effects, effect);
3881
3891
  }
3882
3892
  };
3893
+ return unwatch;
3883
3894
  }
3884
3895
  // this.$watch
3885
3896
  function instanceWatch(source, value, options) {
@@ -4061,7 +4072,11 @@ const BaseTransitionImpl = {
4061
4072
  // return placeholder node and queue update when leave finishes
4062
4073
  leavingHooks.afterLeave = () => {
4063
4074
  state.isLeaving = false;
4064
- instance.update();
4075
+ // #6835
4076
+ // it also needs to be updated when active is undefined
4077
+ if (instance.update.active !== false) {
4078
+ instance.update();
4079
+ }
4065
4080
  };
4066
4081
  return emptyPlaceholder(child);
4067
4082
  }
@@ -4582,7 +4597,8 @@ const KeepAliveImpl = {
4582
4597
  : comp);
4583
4598
  const { include, exclude, max } = props;
4584
4599
  if ((include && (!name || !matches(include, name))) ||
4585
- (exclude && name && matches(exclude, name))) {
4600
+ (exclude && name && matches(exclude, name)) ||
4601
+ (hmrDirtyComponents.has(comp))) {
4586
4602
  current = vnode;
4587
4603
  return rawVNode;
4588
4604
  }
@@ -4862,23 +4878,25 @@ function withDirectives(vnode, directives) {
4862
4878
  const bindings = vnode.dirs || (vnode.dirs = []);
4863
4879
  for (let i = 0; i < directives.length; i++) {
4864
4880
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4865
- if (isFunction(dir)) {
4866
- dir = {
4867
- mounted: dir,
4868
- updated: dir
4869
- };
4870
- }
4871
- if (dir.deep) {
4872
- traverse(value);
4881
+ if (dir) {
4882
+ if (isFunction(dir)) {
4883
+ dir = {
4884
+ mounted: dir,
4885
+ updated: dir
4886
+ };
4887
+ }
4888
+ if (dir.deep) {
4889
+ traverse(value);
4890
+ }
4891
+ bindings.push({
4892
+ dir,
4893
+ instance,
4894
+ value,
4895
+ oldValue: void 0,
4896
+ arg,
4897
+ modifiers
4898
+ });
4873
4899
  }
4874
- bindings.push({
4875
- dir,
4876
- instance,
4877
- value,
4878
- oldValue: void 0,
4879
- arg,
4880
- modifiers
4881
- });
4882
4900
  }
4883
4901
  return vnode;
4884
4902
  }
@@ -6705,7 +6723,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
6705
6723
  if (validatePropName(normalizedKey)) {
6706
6724
  const opt = raw[key];
6707
6725
  const prop = (normalized[normalizedKey] =
6708
- isArray(opt) || isFunction(opt) ? { type: opt } : opt);
6726
+ isArray(opt) || isFunction(opt) ? { type: opt } : Object.assign({}, opt));
6709
6727
  if (prop) {
6710
6728
  const booleanIndex = getTypeIndex(Boolean, prop.type);
6711
6729
  const stringIndex = getTypeIndex(String, prop.type);
@@ -7075,7 +7093,7 @@ function createCompatVue(createApp, createSingletonApp) {
7075
7093
  return vm;
7076
7094
  }
7077
7095
  }
7078
- Vue.version = `2.6.14-compat:${"3.2.41"}`;
7096
+ Vue.version = `2.6.14-compat:${"3.2.43"}`;
7079
7097
  Vue.config = singletonApp.config;
7080
7098
  Vue.use = (p, ...options) => {
7081
7099
  if (p && isFunction(p.install)) {
@@ -10631,6 +10649,9 @@ function getExposeProxy(instance) {
10631
10649
  else if (key in publicPropertiesMap) {
10632
10650
  return publicPropertiesMap[key](instance);
10633
10651
  }
10652
+ },
10653
+ has(target, key) {
10654
+ return key in target || key in publicPropertiesMap;
10634
10655
  }
10635
10656
  })));
10636
10657
  }
@@ -10861,7 +10882,7 @@ const useSSRContext = () => {
10861
10882
  const ctx = inject(ssrContextKey);
10862
10883
  if (!ctx) {
10863
10884
  warn$1(`Server rendering context not provided. Make sure to only call ` +
10864
- `useSSRContext() conditionally in the server build.`);
10885
+ `useSSRContext() conditionally in the server build.`);
10865
10886
  }
10866
10887
  return ctx;
10867
10888
  }
@@ -11084,7 +11105,7 @@ function isMemoSame(cached, memo) {
11084
11105
  }
11085
11106
 
11086
11107
  // Core API ------------------------------------------------------------------
11087
- const version = "3.2.41";
11108
+ const version = "3.2.43";
11088
11109
  /**
11089
11110
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
11090
11111
  * @internal
@@ -11648,7 +11669,7 @@ class VueElement extends BaseClass {
11648
11669
  }
11649
11670
  }).observe(this, { attributes: true });
11650
11671
  const resolve = (def) => {
11651
- const { props, styles } = def;
11672
+ const { props = {}, styles } = def;
11652
11673
  const hasOptions = !isArray(props);
11653
11674
  const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11654
11675
  // cast Number-type props set before resolve
@@ -11695,10 +11716,11 @@ class VueElement extends BaseClass {
11695
11716
  }
11696
11717
  _setAttr(key) {
11697
11718
  let value = this.getAttribute(key);
11698
- if (this._numberProps && this._numberProps[key]) {
11719
+ const camelKey = camelize(key);
11720
+ if (this._numberProps && this._numberProps[camelKey]) {
11699
11721
  value = toNumber(value);
11700
11722
  }
11701
- this._setProp(camelize(key), value, false);
11723
+ this._setProp(camelKey, value, false);
11702
11724
  }
11703
11725
  /**
11704
11726
  * @internal
@@ -12126,11 +12148,11 @@ function getTransitionInfo(el, expectedType) {
12126
12148
  const styles = window.getComputedStyle(el);
12127
12149
  // JSDOM may return undefined for transition properties
12128
12150
  const getStyleProperties = (key) => (styles[key] || '').split(', ');
12129
- const transitionDelays = getStyleProperties(TRANSITION + 'Delay');
12130
- const transitionDurations = getStyleProperties(TRANSITION + 'Duration');
12151
+ const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
12152
+ const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
12131
12153
  const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
12132
- const animationDelays = getStyleProperties(ANIMATION + 'Delay');
12133
- const animationDurations = getStyleProperties(ANIMATION + 'Duration');
12154
+ const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
12155
+ const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
12134
12156
  const animationTimeout = getTimeout(animationDelays, animationDurations);
12135
12157
  let type = null;
12136
12158
  let timeout = 0;
@@ -12165,7 +12187,7 @@ function getTransitionInfo(el, expectedType) {
12165
12187
  : 0;
12166
12188
  }
12167
12189
  const hasTransform = type === TRANSITION &&
12168
- /\b(transform|all)(,|$)/.test(styles[TRANSITION + 'Property']);
12190
+ /\b(transform|all)(,|$)/.test(getStyleProperties(`${TRANSITION}Property`).toString());
12169
12191
  return {
12170
12192
  type,
12171
12193
  timeout,