postcss-calc 7.0.2 → 7.0.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 7.0.3
2
+
3
+ - Fixed: substracted css-variable from zero ([#111](https://github.com/postcss/postcss-calc/issues/111))
4
+
1
5
  # 7.0.2
2
6
 
3
7
  - Fixed: incorrect reduction of subtraction from zero ([#88](https://github.com/postcss/postcss-calc/issues/88))
package/dist/index.js CHANGED
File without changes
File without changes
@@ -68,7 +68,7 @@ function reduceAddSubExpression(node, precision) {
68
68
  } // 0 - something => -something
69
69
 
70
70
 
71
- if (isValueType(node.left.type) && node.left.value === 0 && node.operator === "-" && node.right.type !== "Function") {
71
+ if (isValueType(node.left.type) && node.left.value === 0 && node.operator === "-" && !isCSSFunction(node.right)) {
72
72
  return flipValue(node.right);
73
73
  } // value + value
74
74
  // value - value
@@ -324,4 +324,17 @@ function reduce(node, precision) {
324
324
 
325
325
  var _default = reduce;
326
326
  exports.default = _default;
327
+
328
+ function isCSSFunction(node) {
329
+ if (node.type === "Function") {
330
+ return true;
331
+ }
332
+
333
+ if (node.type === "MathExpression") {
334
+ return isCSSFunction(node.left) || isCSSFunction(node.right);
335
+ }
336
+
337
+ return false;
338
+ }
339
+
327
340
  module.exports = exports.default;
File without changes
File without changes
package/dist/parser.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-calc",
3
- "version": "7.0.2",
3
+ "version": "7.0.3",
4
4
  "description": "PostCSS plugin to reduce calc()",
5
5
  "keywords": [
6
6
  "css",