postcss-normalize-timing-functions 4.0.0-nightly.2020.9.9 → 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.
- package/CHANGELOG.md +4 -0
- package/dist/index.js +52 -78
- package/dist/lib/map.js +7 -0
- package/package.json +11 -9
package/CHANGELOG.md
ADDED
package/dist/index.js
CHANGED
|
@@ -1,98 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
7
6
|
|
|
8
|
-
var _postcss = require(
|
|
7
|
+
var _postcss = require('postcss');
|
|
9
8
|
|
|
10
|
-
var _postcssValueParser =
|
|
9
|
+
var _postcssValueParser = require('postcss-value-parser');
|
|
11
10
|
|
|
12
|
-
var
|
|
11
|
+
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const getValue = node => parseFloat(node.value);
|
|
13
|
+
var _cssnanoUtilGetMatch = require('cssnano-util-get-match');
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
if (node.type !== 'function') {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!node.value) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const lowerCasedValue = node.value.toLowerCase();
|
|
28
|
-
|
|
29
|
-
if (lowerCasedValue === 'steps') {
|
|
30
|
-
// Don't bother checking the step-end case as it has the same length
|
|
31
|
-
// as steps(1)
|
|
32
|
-
if (node.nodes[0].type === 'word' && getValue(node.nodes[0]) === 1 && node.nodes[2] && node.nodes[2].type === 'word' && (node.nodes[2].value.toLowerCase() === 'start' || node.nodes[2].value.toLowerCase() === 'jump-start')) {
|
|
33
|
-
node.type = 'word';
|
|
34
|
-
node.value = 'step-start';
|
|
35
|
-
delete node.nodes;
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
15
|
+
var _cssnanoUtilGetMatch2 = _interopRequireDefault(_cssnanoUtilGetMatch);
|
|
38
16
|
|
|
39
|
-
|
|
40
|
-
node.type = 'word';
|
|
41
|
-
node.value = 'step-end';
|
|
42
|
-
delete node.nodes;
|
|
43
|
-
return;
|
|
44
|
-
} // The end case is actually the browser default, so it isn't required.
|
|
17
|
+
var _map = require('./lib/map');
|
|
45
18
|
|
|
19
|
+
var _map2 = _interopRequireDefault(_map);
|
|
46
20
|
|
|
47
|
-
|
|
48
|
-
node.nodes = [node.nodes[0]];
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
51
22
|
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
const getMatch = (0, _cssnanoUtilGetMatch2.default)(_map2.default);
|
|
24
|
+
const getValue = node => parseFloat(node.value);
|
|
54
25
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}).map(getValue);
|
|
26
|
+
function evenValues(list, index) {
|
|
27
|
+
return index % 2 === 0;
|
|
28
|
+
}
|
|
59
29
|
|
|
60
|
-
|
|
61
|
-
|
|
30
|
+
function reduce(node) {
|
|
31
|
+
if (node.type !== 'function') {
|
|
32
|
+
return false;
|
|
62
33
|
}
|
|
63
34
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
35
|
+
const value = node.value.toLowerCase();
|
|
36
|
+
|
|
37
|
+
if (value === 'steps') {
|
|
38
|
+
// Don't bother checking the step-end case as it has the same length
|
|
39
|
+
// as steps(1)
|
|
40
|
+
if (getValue(node.nodes[0]) === 1 && node.nodes[2] && node.nodes[2].value.toLowerCase() === 'start') {
|
|
41
|
+
node.type = 'word';
|
|
42
|
+
node.value = 'step-start';
|
|
43
|
+
delete node.nodes;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// The end case is actually the browser default, so it isn't required.
|
|
47
|
+
if (node.nodes[2] && node.nodes[2].value.toLowerCase() === 'end') {
|
|
48
|
+
node.nodes = [node.nodes[0]];
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (value === 'cubic-bezier') {
|
|
54
|
+
const match = getMatch(node.nodes.filter(evenValues).map(getValue));
|
|
55
|
+
|
|
56
|
+
if (match) {
|
|
57
|
+
node.type = 'word';
|
|
58
|
+
node.value = match;
|
|
59
|
+
delete node.nodes;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
71
62
|
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function transform(value) {
|
|
76
|
-
return (0, _postcssValueParser.default)(value).walk(reduce).toString();
|
|
77
63
|
}
|
|
78
64
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (cache[value]) {
|
|
86
|
-
decl.value = cache[value];
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const result = transform(value);
|
|
91
|
-
decl.value = result;
|
|
92
|
-
cache[value] = result;
|
|
93
|
-
});
|
|
94
|
-
};
|
|
65
|
+
exports.default = (0, _postcss.plugin)('postcss-normalize-timing-functions', () => {
|
|
66
|
+
return css => {
|
|
67
|
+
css.walkDecls(/(animation|transition)(-timing-function|$)/i, decl => {
|
|
68
|
+
decl.value = (0, _postcssValueParser2.default)(decl.value).walk(reduce).toString();
|
|
69
|
+
});
|
|
70
|
+
};
|
|
95
71
|
});
|
|
96
|
-
|
|
97
|
-
exports.default = _default;
|
|
98
|
-
module.exports = exports.default;
|
|
72
|
+
module.exports = exports['default'];
|
package/dist/lib/map.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = [['ease', [0.25, 0.1, 0.25, 1]], ['linear', [0, 0, 1, 1]], ['ease-in', [0.42, 0, 1, 1]], ['ease-out', [0, 0, 0.58, 1]], ['ease-in-out', [0.42, 0, 0.58, 1]]];
|
|
7
|
+
module.exports = exports['default'];
|
package/package.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-normalize-timing-functions",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Normalize CSS animation/transition timing functions.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
|
|
9
|
-
"prepublish": ""
|
|
7
|
+
"prepublish": "cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/"
|
|
10
8
|
},
|
|
11
9
|
"files": [
|
|
12
10
|
"LICENSE-MIT",
|
|
@@ -14,9 +12,13 @@
|
|
|
14
12
|
],
|
|
15
13
|
"license": "MIT",
|
|
16
14
|
"dependencies": {
|
|
17
|
-
"cssnano-
|
|
18
|
-
"postcss": "^7.0.
|
|
19
|
-
"postcss-value-parser": "^3.
|
|
15
|
+
"cssnano-util-get-match": "^4.0.0",
|
|
16
|
+
"postcss": "^7.0.0",
|
|
17
|
+
"postcss-value-parser": "^3.0.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"babel-cli": "^6.0.0",
|
|
21
|
+
"cross-env": "^5.0.0"
|
|
20
22
|
},
|
|
21
23
|
"author": {
|
|
22
24
|
"name": "Ben Briggs",
|
|
@@ -29,6 +31,6 @@
|
|
|
29
31
|
},
|
|
30
32
|
"homepage": "https://github.com/cssnano/cssnano",
|
|
31
33
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
34
|
+
"node": ">=6.9.0"
|
|
33
35
|
}
|
|
34
|
-
}
|
|
36
|
+
}
|