postcss-color-functional-notation 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.
- package/dist/index.cjs.js +17 -2
- package/dist/index.esm.js +17 -2
- package/package.json +10 -10
package/dist/index.cjs.js
CHANGED
|
@@ -169,13 +169,28 @@ var options = {
|
|
|
169
169
|
|
|
170
170
|
/** @type {(decl: CSSDeclaration) => void} Transform space and slash separated color functions in CSS Declarations. */
|
|
171
171
|
|
|
172
|
-
const onCSSDeclaration = decl
|
|
172
|
+
const onCSSDeclaration = (decl, {
|
|
173
|
+
result
|
|
174
|
+
}) => {
|
|
173
175
|
const {
|
|
174
176
|
value: originalValue
|
|
175
177
|
} = decl;
|
|
176
178
|
|
|
177
179
|
if (hasAnyColorFunction(originalValue)) {
|
|
178
|
-
|
|
180
|
+
let valueAST;
|
|
181
|
+
|
|
182
|
+
try {
|
|
183
|
+
valueAST = postcssValuesParser.parse(originalValue, {
|
|
184
|
+
ignoreUnknownWords: true
|
|
185
|
+
});
|
|
186
|
+
} catch (error) {
|
|
187
|
+
decl.warn(result, `Failed to parse value '${originalValue}' as a color function. Leaving the original value intact.`);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (typeof valueAST === 'undefined') {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
179
194
|
valueAST.walkType('func', onCSSFunction);
|
|
180
195
|
const modifiedValue = String(valueAST);
|
|
181
196
|
|
package/dist/index.esm.js
CHANGED
|
@@ -167,13 +167,28 @@ var options = {
|
|
|
167
167
|
|
|
168
168
|
/** @type {(decl: CSSDeclaration) => void} Transform space and slash separated color functions in CSS Declarations. */
|
|
169
169
|
|
|
170
|
-
const onCSSDeclaration = decl
|
|
170
|
+
const onCSSDeclaration = (decl, {
|
|
171
|
+
result
|
|
172
|
+
}) => {
|
|
171
173
|
const {
|
|
172
174
|
value: originalValue
|
|
173
175
|
} = decl;
|
|
174
176
|
|
|
175
177
|
if (hasAnyColorFunction(originalValue)) {
|
|
176
|
-
|
|
178
|
+
let valueAST;
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
valueAST = parse(originalValue, {
|
|
182
|
+
ignoreUnknownWords: true
|
|
183
|
+
});
|
|
184
|
+
} catch (error) {
|
|
185
|
+
decl.warn(result, `Failed to parse value '${originalValue}' as a color function. Leaving the original value intact.`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (typeof valueAST === 'undefined') {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
177
192
|
valueAST.walkType('func', onCSSFunction);
|
|
178
193
|
const modifiedValue = String(valueAST);
|
|
179
194
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-color-functional-notation",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Use space and slash separated color notation in CSS",
|
|
5
5
|
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
|
6
6
|
"license": "CC0-1.0",
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
"node": ">=12"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"postcss-values-parser": "6.0.
|
|
29
|
+
"postcss-values-parser": "6.0.1"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"postcss": "^8.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@babel/core": "7.
|
|
36
|
-
"@babel/preset-env": "7.
|
|
37
|
-
"eslint": "
|
|
38
|
-
"postcss": "8.3.
|
|
39
|
-
"postcss-tape": "6.0.1",
|
|
40
|
-
"pre-commit": "1.2.2",
|
|
41
|
-
"rollup": "2.
|
|
42
|
-
"rollup-plugin-babel": "4.4.0"
|
|
35
|
+
"@babel/core": "^7.16.0",
|
|
36
|
+
"@babel/preset-env": "^7.16.4",
|
|
37
|
+
"eslint": "^8.2.0",
|
|
38
|
+
"postcss": "^8.3.11",
|
|
39
|
+
"postcss-tape": "^6.0.1",
|
|
40
|
+
"pre-commit": "^1.2.2",
|
|
41
|
+
"rollup": "^2.60.0",
|
|
42
|
+
"rollup-plugin-babel": "^4.4.0"
|
|
43
43
|
},
|
|
44
44
|
"babel": {
|
|
45
45
|
"presets": [
|