postcss-reduce-initial 5.0.3 → 5.1.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/README.md +1 -4
- package/package.json +9 -7
- package/{data → src/data}/fromInitial.json +18 -6
- package/{data → src/data}/toInitial.json +2 -0
- package/src/index.js +12 -6
- package/types/index.d.ts +9 -0
package/README.md
CHANGED
|
@@ -85,10 +85,7 @@ See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTOR
|
|
|
85
85
|
|
|
86
86
|
## License
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
[template:cssdata]: https://developer.mozilla.org/en-US/docs/Template:CSSData
|
|
91
|
-
[cc-by-sa 2.5]: http://creativecommons.org/licenses/by-sa/2.5/
|
|
88
|
+
This program uses a list of CSS properties derived from data maintained my the MDN team at Mozilla and licensed under the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).
|
|
92
89
|
|
|
93
90
|
MIT © [Ben Briggs](http://beneb.info)
|
|
94
91
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-reduce-initial",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "Reduce initial definitions to the actual initial value, where possible.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
6
7
|
"files": [
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"src",
|
|
9
|
+
"LICENSE-MIT",
|
|
10
|
+
"types"
|
|
10
11
|
],
|
|
11
12
|
"keywords": [
|
|
12
13
|
"css",
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
},
|
|
23
24
|
"repository": "cssnano/cssnano",
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"browserslist": "^4.
|
|
26
|
+
"browserslist": "^4.21.4",
|
|
26
27
|
"caniuse-api": "^3.0.0"
|
|
27
28
|
},
|
|
28
29
|
"bugs": {
|
|
@@ -32,6 +33,8 @@
|
|
|
32
33
|
"node": "^10 || ^12 || >=14.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
36
|
+
"@types/caniuse-api": "^3.0.2",
|
|
37
|
+
"html-to-text": "^8.2.0",
|
|
35
38
|
"postcss": "^8.2.15"
|
|
36
39
|
},
|
|
37
40
|
"peerDependencies": {
|
|
@@ -39,6 +42,5 @@
|
|
|
39
42
|
},
|
|
40
43
|
"scripts": {
|
|
41
44
|
"acquire": "node ./src/script/acquire.mjs"
|
|
42
|
-
}
|
|
43
|
-
"readme": "# [postcss][postcss]-reduce-initial\n\n> Reduce `initial` definitions to the _actual_ initial value, where possible.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-reduce-initial) do:\n\n```\nnpm install postcss-reduce-initial --save\n```\n\n## Examples\n\nSee the [data](data) for more conversions. This data is courtesy\nof Mozilla.\n\n### Convert `initial` values\n\nWhen the `initial` keyword is longer than the property value, it will\nbe converted:\n\n#### Input\n\n```css\nh1 {\n min-width: initial;\n}\n```\n\n#### Output\n\n```css\nh1 {\n min-width: 0;\n}\n```\n\n### Convert values back to `initial`\n\nWhen the `initial` value is smaller than the property value, it will\nbe converted:\n\n#### Input\n\n```css\nh1 {\n transform-box: border-box;\n}\n```\n\n#### Output\n\n```css\nh1 {\n transform-box: initial;\n}\n```\n\nThis conversion is only applied when you supply a browsers list that all support\nthe `initial` keyword; it's worth noting that Internet Explorer has no support.\n\n## API\n\n### reduceInitial([options])\n\n#### options\n\n##### ignore\n\nType: `Array<String>`\nDefault: `undefined`\n\nIt contains the Array of properties that will be ignored while reducing its value to initial.\nExample : `{ ignore : [\"min-height\"] }`\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n## License\n\n[Template:CSSData] by Mozilla Contributors is licensed under [CC-BY-SA 2.5].\n\n[template:cssdata]: https://developer.mozilla.org/en-US/docs/Template:CSSData\n[cc-by-sa 2.5]: http://creativecommons.org/licenses/by-sa/2.5/\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[postcss]: https://github.com/postcss/postcss\n"
|
|
45
|
+
}
|
|
44
46
|
}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"animation-iteration-count": "1",
|
|
13
13
|
"animation-name": "none",
|
|
14
14
|
"animation-timing-function": "ease",
|
|
15
|
-
"
|
|
15
|
+
"animation-timeline": "auto",
|
|
16
|
+
"appearance": "none",
|
|
16
17
|
"aspect-ratio": "auto",
|
|
17
18
|
"azimuth": "center",
|
|
18
19
|
"backdrop-filter": "none",
|
|
@@ -20,8 +21,8 @@
|
|
|
20
21
|
"background-blend-mode": "normal",
|
|
21
22
|
"background-image": "none",
|
|
22
23
|
"background-position": "0% 0%",
|
|
23
|
-
"background-position-x": "
|
|
24
|
-
"background-position-y": "
|
|
24
|
+
"background-position-x": "0%",
|
|
25
|
+
"background-position-y": "0%",
|
|
25
26
|
"background-repeat": "repeat",
|
|
26
27
|
"block-overflow": "clip",
|
|
27
28
|
"block-size": "auto",
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
"break-inside": "auto",
|
|
67
68
|
"caption-side": "top",
|
|
68
69
|
"caret-color": "auto",
|
|
70
|
+
"caret-shape": "auto",
|
|
69
71
|
"clear": "none",
|
|
70
72
|
"clip": "auto",
|
|
71
73
|
"clip-path": "none",
|
|
@@ -77,6 +79,10 @@
|
|
|
77
79
|
"column-span": "none",
|
|
78
80
|
"column-width": "auto",
|
|
79
81
|
"contain": "none",
|
|
82
|
+
"contain-intrinsic-block-size": "none",
|
|
83
|
+
"contain-intrinsic-height": "none",
|
|
84
|
+
"contain-intrinsic-inline-size": "none",
|
|
85
|
+
"contain-intrinsic-width": "none",
|
|
80
86
|
"content": "normal",
|
|
81
87
|
"counter-increment": "none",
|
|
82
88
|
"counter-reset": "none",
|
|
@@ -123,6 +129,7 @@
|
|
|
123
129
|
"grid-template-rows": "none",
|
|
124
130
|
"hanging-punctuation": "none",
|
|
125
131
|
"height": "auto",
|
|
132
|
+
"hyphenate-character": "auto",
|
|
126
133
|
"hyphens": "manual",
|
|
127
134
|
"image-rendering": "auto",
|
|
128
135
|
"image-resolution": "1dppx",
|
|
@@ -130,6 +137,7 @@
|
|
|
130
137
|
"initial-letter": "normal",
|
|
131
138
|
"initial-letter-align": "auto",
|
|
132
139
|
"inline-size": "auto",
|
|
140
|
+
"input-security": "auto",
|
|
133
141
|
"inset": "auto",
|
|
134
142
|
"inset-block": "auto",
|
|
135
143
|
"inset-block-end": "auto",
|
|
@@ -172,10 +180,12 @@
|
|
|
172
180
|
"mask-repeat": "repeat",
|
|
173
181
|
"mask-size": "auto",
|
|
174
182
|
"masonry-auto-flow": "pack",
|
|
183
|
+
"math-depth": "0",
|
|
184
|
+
"math-shift": "normal",
|
|
175
185
|
"math-style": "normal",
|
|
176
|
-
"max-block-size": "
|
|
186
|
+
"max-block-size": "none",
|
|
177
187
|
"max-height": "none",
|
|
178
|
-
"max-inline-size": "
|
|
188
|
+
"max-inline-size": "none",
|
|
179
189
|
"max-lines": "none",
|
|
180
190
|
"max-width": "none",
|
|
181
191
|
"min-block-size": "0",
|
|
@@ -189,7 +199,7 @@
|
|
|
189
199
|
"offset-path": "none",
|
|
190
200
|
"offset-position": "auto",
|
|
191
201
|
"offset-rotate": "auto",
|
|
192
|
-
"opacity": "1
|
|
202
|
+
"opacity": "1",
|
|
193
203
|
"order": "0",
|
|
194
204
|
"orphans": "2",
|
|
195
205
|
"outline-offset": "0",
|
|
@@ -262,6 +272,8 @@
|
|
|
262
272
|
"scroll-snap-type": "none",
|
|
263
273
|
"scroll-snap-type-x": "none",
|
|
264
274
|
"scroll-snap-type-y": "none",
|
|
275
|
+
"scroll-timeline-axis": "block",
|
|
276
|
+
"scroll-timeline-name": "none",
|
|
265
277
|
"shape-image-threshold": "0.0",
|
|
266
278
|
"shape-margin": "0",
|
|
267
279
|
"shape-outside": "none",
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
"border-right-color": "currentcolor",
|
|
16
16
|
"border-top-color": "currentcolor",
|
|
17
17
|
"box-sizing": "content-box",
|
|
18
|
+
"color": "canvastext",
|
|
18
19
|
"column-rule-color": "currentcolor",
|
|
19
20
|
"font-synthesis": "weight style",
|
|
20
21
|
"image-orientation": "from-image",
|
|
21
22
|
"mask-clip": "border-box",
|
|
22
23
|
"mask-mode": "match-source",
|
|
23
24
|
"mask-origin": "border-box",
|
|
25
|
+
"mask-repeat": "no-repeat",
|
|
24
26
|
"mask-type": "luminance",
|
|
25
27
|
"ruby-align": "space-around",
|
|
26
28
|
"ruby-merge": "separate",
|
package/src/index.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const browserslist = require('browserslist');
|
|
3
3
|
const { isSupported } = require('caniuse-api');
|
|
4
|
-
const fromInitial = require('
|
|
5
|
-
const toInitial = require('
|
|
4
|
+
const fromInitial = require('./data/fromInitial.json');
|
|
5
|
+
const toInitial = require('./data/toInitial.json');
|
|
6
6
|
|
|
7
7
|
const initial = 'initial';
|
|
8
8
|
|
|
9
9
|
// In most of the browser including chrome the initial for `writing-mode` is not `horizontal-tb`. Ref https://github.com/cssnano/cssnano/pull/905
|
|
10
10
|
const defaultIgnoreProps = ['writing-mode', 'transform-box'];
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @type {import('postcss').PluginCreator<void>}
|
|
14
|
+
* @return {import('postcss').Plugin}
|
|
15
|
+
*/
|
|
12
16
|
function pluginCreator() {
|
|
13
17
|
return {
|
|
14
18
|
postcssPlugin: 'postcss-reduce-initial',
|
|
15
|
-
|
|
19
|
+
/** @param {import('postcss').Result & {opts: browserslist.Options & {ignore?: string[]}}} result */
|
|
16
20
|
prepare(result) {
|
|
17
21
|
const resultOpts = result.opts || {};
|
|
18
22
|
const browsers = browserslist(null, {
|
|
@@ -37,7 +41,8 @@ function pluginCreator() {
|
|
|
37
41
|
if (
|
|
38
42
|
initialSupport &&
|
|
39
43
|
Object.prototype.hasOwnProperty.call(toInitial, lowerCasedProp) &&
|
|
40
|
-
decl.value.toLowerCase() ===
|
|
44
|
+
decl.value.toLowerCase() ===
|
|
45
|
+
toInitial[/** @type {keyof toInitial} */ (lowerCasedProp)]
|
|
41
46
|
) {
|
|
42
47
|
decl.value = initial;
|
|
43
48
|
return;
|
|
@@ -45,12 +50,13 @@ function pluginCreator() {
|
|
|
45
50
|
|
|
46
51
|
if (
|
|
47
52
|
decl.value.toLowerCase() !== initial ||
|
|
48
|
-
!fromInitial[lowerCasedProp]
|
|
53
|
+
!fromInitial[/** @type {keyof fromInitial} */ (lowerCasedProp)]
|
|
49
54
|
) {
|
|
50
55
|
return;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
decl.value =
|
|
58
|
+
decl.value =
|
|
59
|
+
fromInitial[/** @type {keyof fromInitial} */ (lowerCasedProp)];
|
|
54
60
|
});
|
|
55
61
|
},
|
|
56
62
|
};
|
package/types/index.d.ts
ADDED