postcss-convert-values 7.0.0 → 7.0.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-convert-values",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Convert values with PostCSS (e.g. ms -> s)",
5
5
  "main": "src/index.js",
6
6
  "types": "types/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "repository": "cssnano/cssnano",
26
26
  "dependencies": {
27
- "browserslist": "^4.23.0",
27
+ "browserslist": "^4.23.1",
28
28
  "postcss-value-parser": "^4.2.0"
29
29
  },
30
30
  "bugs": {
package/src/index.js CHANGED
@@ -39,8 +39,18 @@ const keepWhenZero = new Set([
39
39
  ]);
40
40
 
41
41
  // Can't remove the % on these properties when they're 0 on IE 11
42
- const keepZeroPercent = new Set(['max-height', 'height', 'min-width']);
43
-
42
+ const keepZeroPercentOnIE11 = new Set(['max-height', 'height', 'min-width']);
43
+
44
+ const keepZeroPercentAlways = new Set([
45
+ 'calc',
46
+ 'color-mix',
47
+ 'min',
48
+ 'max',
49
+ 'clamp',
50
+ 'hsl',
51
+ 'hsla',
52
+ 'hwb',
53
+ ]);
44
54
  /**
45
55
  * Numbers without digits after the dot are technically invalid,
46
56
  * but in that case css-value-parser returns the dot as part of the unit,
@@ -118,7 +128,7 @@ function shouldKeepZeroUnit(decl, browsers) {
118
128
 
119
129
  return (
120
130
  (decl.value.includes('%') &&
121
- keepZeroPercent.has(lowerCasedProp) &&
131
+ keepZeroPercentOnIE11.has(lowerCasedProp) &&
122
132
  browsers.includes('ie 11')) ||
123
133
  (lowerCasedProp === 'stroke-dasharray' &&
124
134
  parent &&
@@ -172,14 +182,7 @@ function transform(opts, browsers, decl) {
172
182
  clampOpacity(node);
173
183
  }
174
184
  } else if (node.type === 'function') {
175
- if (
176
- lowerCasedValue === 'calc' ||
177
- lowerCasedValue === 'min' ||
178
- lowerCasedValue === 'max' ||
179
- lowerCasedValue === 'clamp' ||
180
- lowerCasedValue === 'hsl' ||
181
- lowerCasedValue === 'hsla'
182
- ) {
185
+ if (keepZeroPercentAlways.has(lowerCasedValue)) {
183
186
  valueParser.walk(node.nodes, (n) => {
184
187
  if (n.type === 'word') {
185
188
  parseWord(n, opts, true);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAuMA;;;;;GAKG;AAEH;;;;GAIG;AACH,sCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CAwBnC;;;;eA9BY;IAAC,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CAAC,GAAG,cAAc,GAAG,mBAAmB,GAAG,mBAAmB;;sBAHzF;;;;GAA2B,CAAC,CAAC;2BAC7B;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE;2BAC5C,KAAK,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AA0MA;;;;;GAKG;AAEH;;;;GAIG;AACH,sCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CAwBnC;;;;eA9BY;IAAC,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CAAC,GAAG,cAAc,GAAG,mBAAmB,GAAG,mBAAmB;;sBAHzF;;;;GAA2B,CAAC,CAAC;2BAC7B;IAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE;2BAC5C,KAAK,oBAAoB,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC"}