postcss-minify-gradients 8.0.5 → 9.0.0
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 +7 -10
- package/src/index.js +8 -8
- package/src/isColorStop.js +13 -11
- package/types/index.d.ts +9 -2
- package/types/index.d.ts.map +1 -1
- package/types/isColorStop.d.ts +1 -1
- package/types/isColorStop.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-minify-gradients",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Minify gradient parameters with PostCSS.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
8
8
|
"default": "./src/index.js"
|
|
9
|
-
}
|
|
10
|
-
"./src": "./src/index.js",
|
|
11
|
-
"./src/*": "./src/*.js",
|
|
12
|
-
"./src/*.js": "./src/*.js",
|
|
13
|
-
"./package.json": "./package.json"
|
|
9
|
+
}
|
|
14
10
|
},
|
|
15
11
|
"files": [
|
|
16
12
|
"LICENSE-MIT",
|
|
@@ -34,15 +30,15 @@
|
|
|
34
30
|
"url": "git+https://github.com/cssnano/cssnano.git"
|
|
35
31
|
},
|
|
36
32
|
"dependencies": {
|
|
37
|
-
"@colordx/core": "^5.
|
|
38
|
-
"
|
|
39
|
-
"
|
|
33
|
+
"@colordx/core": "^5.6.0",
|
|
34
|
+
"cssnano-utils": "^7.0.0",
|
|
35
|
+
"postcss-value-parser": "^4.2.0"
|
|
40
36
|
},
|
|
41
37
|
"bugs": {
|
|
42
38
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
43
39
|
},
|
|
44
40
|
"engines": {
|
|
45
|
-
"node": "^22.
|
|
41
|
+
"node": "^22.22.3 || ^24.15.0 || >=26.0"
|
|
46
42
|
},
|
|
47
43
|
"devDependencies": {
|
|
48
44
|
"postcss": "^8.5.26"
|
|
@@ -50,6 +46,7 @@
|
|
|
50
46
|
"peerDependencies": {
|
|
51
47
|
"postcss": "^8.5.26"
|
|
52
48
|
},
|
|
49
|
+
"type": "module",
|
|
53
50
|
"scripts": {
|
|
54
51
|
"test": "node --test"
|
|
55
52
|
}
|
package/src/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const isColorStop = require('./isColorStop.js');
|
|
1
|
+
import valueParser from 'postcss-value-parser';
|
|
2
|
+
import cssnanoUtils from 'cssnano-utils';
|
|
3
|
+
import isColorStop from './isColorStop.js';
|
|
5
4
|
|
|
5
|
+
const { getArguments } = cssnanoUtils;
|
|
6
6
|
const directionsToAngles = new Map([
|
|
7
7
|
['top', '0deg'],
|
|
8
8
|
['right', '90deg'],
|
|
@@ -376,8 +376,8 @@ function pluginCreator() {
|
|
|
376
376
|
},
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
|
-
|
|
379
|
+
/** @type {true} */
|
|
380
380
|
pluginCreator.postcss = true;
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
381
|
+
const moduleExports = pluginCreator;
|
|
382
|
+
|
|
383
|
+
export { moduleExports as default, moduleExports as 'module.exports' };
|
package/src/isColorStop.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const namesPlugin = require('@colordx/core/plugins/names');
|
|
1
|
+
import postcssValueParser from 'postcss-value-parser';
|
|
2
|
+
import { colordx as colord, extend } from '@colordx/core';
|
|
3
|
+
import hwbPlugin from '@colordx/core/plugins/hwb';
|
|
4
|
+
import namesPlugin from '@colordx/core/plugins/names';
|
|
6
5
|
|
|
6
|
+
const { unit } = postcssValueParser;
|
|
7
7
|
extend([
|
|
8
8
|
/** @type {import('@colordx/core').Plugin} */ (
|
|
9
9
|
/** @type {unknown} */ (hwbPlugin)
|
|
@@ -48,7 +48,7 @@ function isCSSLengthUnit(input) {
|
|
|
48
48
|
*/
|
|
49
49
|
function isStop(str) {
|
|
50
50
|
if (str) {
|
|
51
|
-
let
|
|
51
|
+
let colorStop = false;
|
|
52
52
|
const node = unit(str);
|
|
53
53
|
if (node) {
|
|
54
54
|
const number = Number(node.number);
|
|
@@ -56,12 +56,12 @@ function isStop(str) {
|
|
|
56
56
|
number === 0 ||
|
|
57
57
|
(!Number.isNaN(number) && isCSSLengthUnit(node.unit))
|
|
58
58
|
) {
|
|
59
|
-
|
|
59
|
+
colorStop = true;
|
|
60
60
|
}
|
|
61
61
|
} else {
|
|
62
|
-
|
|
62
|
+
colorStop = colorStopRegex.test(str);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return colorStop;
|
|
65
65
|
}
|
|
66
66
|
return true;
|
|
67
67
|
}
|
|
@@ -70,6 +70,8 @@ function isStop(str) {
|
|
|
70
70
|
* @param {string} [stop]
|
|
71
71
|
* @return {boolean}
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
function isColorStop(color, stop) {
|
|
74
74
|
return colord(color).isValid() && isStop(stop);
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default isColorStop;
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @return {import('postcss').Plugin}
|
|
3
|
+
*/
|
|
4
|
+
declare function pluginCreator(): import('postcss').Plugin;
|
|
5
|
+
declare namespace pluginCreator {
|
|
6
|
+
var postcss: true;
|
|
7
|
+
}
|
|
8
|
+
declare const moduleExports: typeof pluginCreator;
|
|
9
|
+
export { moduleExports as default, moduleExports as 'module.exports' };
|
|
3
10
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA4WA;;GAEG;AACH,iBAAS,aAAa,IAFV,OAAO,SAAS,EAAE,MAAM,CAYnC;kBAVQ,aAAa;iBAWX,IAAI;;AAEf,QAAA,MAAM,aAAa,sBAAgB,CAAC;AAEpC,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,CAAC"}
|
package/types/isColorStop.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isColorStop.d.ts","sourceRoot":"","sources":["../src/isColorStop.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isColorStop.d.ts","sourceRoot":"","sources":["../src/isColorStop.js"],"names":[],"mappings":"AAmEA;;;;GAIG;AACH,iBAAS,WAAW,CAAC,KAAK,EAJf,MAIe,EAAE,IAAI,AAH7B,CACA,EADQ,MAGqB,GAFpB,OAAO,CAIlB;eAEc,WAAW"}
|