postcss-normalize-positions 4.0.0 → 4.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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/dist/index.js +16 -17
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -16,7 +16,7 @@ npm install postcss-normalize-positions --save
16
16
 
17
17
  ```css
18
18
  div {
19
- background-position: bottom right
19
+ background-position: bottom left;
20
20
  }
21
21
  ```
22
22
 
@@ -24,7 +24,7 @@ div {
24
24
 
25
25
  ```css
26
26
  div {
27
- background-position: 100% 100%
27
+ background-position:0 100%;
28
28
  }
29
29
  ```
30
30
 
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ function transform(decl) {
44
44
  end: null
45
45
  });
46
46
  arg.forEach((part, index) => {
47
- const isPosition = ~directions.indexOf(part.value) || (0, _postcssValueParser.unit)(part.value);
47
+ const isPosition = ~directions.indexOf(part.value.toLowerCase()) || (0, _postcssValueParser.unit)(part.value);
48
48
  const len = relevant.length - 1;
49
49
  if (relevant[len].start === null && isPosition) {
50
50
  relevant[len].start = index;
@@ -70,35 +70,34 @@ function transform(decl) {
70
70
  if (position.length > 3) {
71
71
  return;
72
72
  }
73
- if (position.length === 1 || position[2].value === 'center') {
74
- if (position[2]) {
73
+ const firstValue = position[0].value.toLowerCase();
74
+ const secondValue = position[2] && position[2].value ? position[2].value.toLowerCase() : null;
75
+ if (position.length === 1 || secondValue === 'center') {
76
+ if (secondValue) {
75
77
  position[2].value = position[1].value = '';
76
78
  }
77
- const { value } = position[0];
78
79
  const map = Object.assign({}, horizontal, {
79
80
  center
80
81
  });
81
- if ((0, _has2.default)(map, value)) {
82
- position[0].value = map[value];
82
+ if ((0, _has2.default)(map, firstValue)) {
83
+ position[0].value = map[firstValue];
83
84
  }
84
85
  return;
85
86
  }
86
- if (position[0].value === 'center' && ~directions.indexOf(position[2].value)) {
87
+ if (firstValue === 'center' && ~directions.indexOf(secondValue)) {
87
88
  position[0].value = position[1].value = '';
88
- const { value } = position[2];
89
- if ((0, _has2.default)(horizontal, value)) {
90
- position[2].value = horizontal[value];
89
+ if ((0, _has2.default)(horizontal, secondValue)) {
90
+ position[2].value = horizontal[secondValue];
91
91
  }
92
92
  return;
93
93
  }
94
- if ((0, _has2.default)(horizontal, position[0].value) && (0, _has2.default)(vertical, position[2].value)) {
95
- position[0].value = horizontal[position[0].value];
96
- position[2].value = vertical[position[2].value];
94
+ if ((0, _has2.default)(horizontal, firstValue) && (0, _has2.default)(vertical, secondValue)) {
95
+ position[0].value = horizontal[firstValue];
96
+ position[2].value = vertical[secondValue];
97
97
  return;
98
- } else if ((0, _has2.default)(vertical, position[0].value) && (0, _has2.default)(horizontal, position[2].value)) {
99
- let first = position[0].value;
100
- position[0].value = horizontal[position[2].value];
101
- position[2].value = vertical[first];
98
+ } else if ((0, _has2.default)(vertical, firstValue) && (0, _has2.default)(horizontal, secondValue)) {
99
+ position[0].value = horizontal[secondValue];
100
+ position[2].value = vertical[firstValue];
102
101
  return;
103
102
  }
104
103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-normalize-positions",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Normalize keyword values for position into length values.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "cssnano-util-get-arguments": "^4.0.0",
32
32
  "has": "^1.0.0",
33
- "postcss": "^6.0.0",
33
+ "postcss": "^7.0.0",
34
34
  "postcss-value-parser": "^3.0.0"
35
35
  },
36
36
  "bugs": {