@csstools/postcss-hwb-function 3.0.6 → 3.0.7
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 +10 -99
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1 -1
- package/package.json +13 -28
- package/dist/has-fallback-decl.d.ts +0 -2
- package/dist/has-supports-at-rule-ancestor.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changes to PostCSS HWB Function
|
|
2
2
|
|
|
3
|
+
### 3.0.7
|
|
4
|
+
|
|
5
|
+
_December 15, 2023_
|
|
6
|
+
|
|
7
|
+
- Skip transforms when a color value contains experimental syntax
|
|
8
|
+
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#222) (patch)
|
|
9
|
+
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.4.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#240) (minor)
|
|
10
|
+
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.5.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#150) (minor)
|
|
11
|
+
|
|
3
12
|
### 3.0.6
|
|
4
13
|
|
|
5
14
|
_October 9, 2023_
|
|
@@ -12,102 +21,4 @@ _October 2, 2023_
|
|
|
12
21
|
|
|
13
22
|
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.3.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#133) (patch)
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_September 24, 2023_
|
|
18
|
-
|
|
19
|
-
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#221) (patch)
|
|
20
|
-
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#232) (patch)
|
|
21
|
-
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#132) (patch)
|
|
22
|
-
|
|
23
|
-
### 3.0.3
|
|
24
|
-
|
|
25
|
-
_September 2, 2023_
|
|
26
|
-
|
|
27
|
-
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#131) (patch)
|
|
28
|
-
|
|
29
|
-
### 3.0.2
|
|
30
|
-
|
|
31
|
-
_August 28, 2023_
|
|
32
|
-
|
|
33
|
-
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#130) (minor)
|
|
34
|
-
|
|
35
|
-
### 3.0.1
|
|
36
|
-
|
|
37
|
-
_July 24, 2023_
|
|
38
|
-
|
|
39
|
-
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#220) (minor)
|
|
40
|
-
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#231) (patch)
|
|
41
|
-
|
|
42
|
-
### 3.0.0
|
|
43
|
-
|
|
44
|
-
_July 3, 2023_
|
|
45
|
-
|
|
46
|
-
- Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/))
|
|
47
|
-
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#230) (minor)
|
|
48
|
-
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.2.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#122) (patch)
|
|
49
|
-
|
|
50
|
-
### 2.2.2
|
|
51
|
-
|
|
52
|
-
_May 19, 2023_
|
|
53
|
-
|
|
54
|
-
- Ignore relative color syntax
|
|
55
|
-
- Updated `@csstools/css-color-parser` to `1.2.0` (minor)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
### 2.2.1
|
|
59
|
-
|
|
60
|
-
_April 10, 2023_
|
|
61
|
-
|
|
62
|
-
- Updated `@csstools/css-tokenizer` to `2.1.1` (patch)
|
|
63
|
-
- Updated `@csstools/css-parser-algorithms` to `2.1.1` (patch)
|
|
64
|
-
- Updated `@csstools/css-color-parser` to `1.1.2` (patch)
|
|
65
|
-
|
|
66
|
-
### 2.2.0
|
|
67
|
-
|
|
68
|
-
_March 25, 2023_
|
|
69
|
-
|
|
70
|
-
- Add `@csstools/css-color-parser` dependency for all color value transformations.
|
|
71
|
-
- Add support for `calc` expressions in color components.
|
|
72
|
-
|
|
73
|
-
### 2.1.1
|
|
74
|
-
|
|
75
|
-
_February 8, 2023_
|
|
76
|
-
|
|
77
|
-
- Reduce the amount of duplicate fallback CSS.
|
|
78
|
-
|
|
79
|
-
### 2.1.0
|
|
80
|
-
|
|
81
|
-
_February 2, 2023_
|
|
82
|
-
|
|
83
|
-
- Add: `@csstools/color-helpers` dependency for all color value transformations.
|
|
84
|
-
|
|
85
|
-
### 2.0.1
|
|
86
|
-
|
|
87
|
-
_January 28, 2023_
|
|
88
|
-
|
|
89
|
-
- Improve `types` declaration in `package.json`
|
|
90
|
-
|
|
91
|
-
### 2.0.0
|
|
92
|
-
|
|
93
|
-
_January 24, 2023_
|
|
94
|
-
|
|
95
|
-
- Updated: Support for Node v14+ (major).
|
|
96
|
-
|
|
97
|
-
### 1.0.2
|
|
98
|
-
|
|
99
|
-
_July 8, 2022_
|
|
100
|
-
|
|
101
|
-
- Fix case insensitive matching.
|
|
102
|
-
|
|
103
|
-
### 1.0.1
|
|
104
|
-
|
|
105
|
-
_May 18, 2022_
|
|
106
|
-
|
|
107
|
-
- Fix grayscale conversions.
|
|
108
|
-
|
|
109
|
-
### 1.0.0
|
|
110
|
-
|
|
111
|
-
_January 22, 2022_
|
|
112
|
-
|
|
113
|
-
- Initial version
|
|
24
|
+
[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-hwb-function/CHANGELOG.md)
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@csstools/css-color-parser"),t=require("@csstools/css-parser-algorithms"),r=require("@csstools/css-tokenizer");const s="(color: hwb(0 0% 0%))";function hasSupportsAtRuleAncestor(e){let t=e.parent;for(;t;)if("atrule"===t.type){if("supports"===t.name.toLowerCase()&&t.params.includes(s))return!0;t=t.parent}else t=t.parent;return!1}function hasFallback(e){const t=e.parent;if(!t)return!1;const r=e.prop.toLowerCase(),s=t.index(e);for(let e=0;e<s;e++){const s=t.nodes[e];if("decl"===s.type&&s.prop.toLowerCase()===r)return!0}return!1}const o=/hwb\(/i,n=/^hwb$/i,postcssPlugin=a=>{const l="preserve"in Object(a)&&Boolean(
|
|
1
|
+
"use strict";var e=require("@csstools/css-color-parser"),t=require("@csstools/css-parser-algorithms"),r=require("@csstools/css-tokenizer");const s="(color: hwb(0 0% 0%))";function hasSupportsAtRuleAncestor(e){let t=e.parent;for(;t;)if("atrule"===t.type){if("supports"===t.name.toLowerCase()&&t.params.includes(s))return!0;t=t.parent}else t=t.parent;return!1}function hasFallback(e){const t=e.parent;if(!t)return!1;const r=e.prop.toLowerCase(),s=t.index(e);for(let e=0;e<s;e++){const s=t.nodes[e];if("decl"===s.type&&s.prop.toLowerCase()===r)return!0}return!1}const o=/hwb\(/i,n=/^hwb$/i,postcssPlugin=a=>{const l="preserve"in Object(a)&&Boolean(a?.preserve);return{postcssPlugin:"postcss-hwb-function",Declaration:(a,{postcss:p})=>{const c=a.value;if(!o.test(c))return;if(l&&hasSupportsAtRuleAncestor(a))return;if(hasFallback(a))return;const u=t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(r.tokenize({css:c})),(r=>{if(t.isFunctionNode(r)&&n.test(r.getName())){const t=e.color(r);if(!t)return;if(t.syntaxFlags.has(e.SyntaxFlag.Experimental))return;if(t.syntaxFlags.has(e.SyntaxFlag.HasNoneKeywords))return;if(t.syntaxFlags.has(e.SyntaxFlag.RelativeColorSyntax))return;return e.serializeRGB(t)}})),i=t.stringify(u);if(i!==c)if(a.variable&&l&&a.parent){const e=a.parent,t=p.atRule({name:"supports",params:s,source:a.source}),r=e.clone();r.removeAll(),r.append(a.clone()),t.append(r),insertAtSupportsAfterCorrectRule(t,e,s),a.replaceWith(a.clone({value:i}))}else l?a.cloneBefore({value:i}):a.replaceWith(a.clone({value:i}))}}};function insertAtSupportsAfterCorrectRule(e,t,r){let s=t,o=t.next();for(;s&&o&&"atrule"===o.type&&"supports"===o.name.toLowerCase()&&o.params===r;)s=o,o=o.next();s.after(e)}postcssPlugin.postcss=!0,module.exports=postcssPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { PluginCreator } from 'postcss';
|
|
2
|
+
|
|
2
3
|
/** postcss-hwb-function plugin options */
|
|
3
|
-
export type pluginOptions = {
|
|
4
|
+
export declare type pluginOptions = {
|
|
4
5
|
/** Preserve the original notation. default: false */
|
|
5
6
|
preserve?: boolean;
|
|
6
7
|
};
|
|
8
|
+
|
|
7
9
|
/** Transform hwb() functions in CSS. */
|
|
8
10
|
declare const postcssPlugin: PluginCreator<pluginOptions>;
|
|
9
11
|
export default postcssPlugin;
|
|
12
|
+
|
|
13
|
+
export { }
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{color as e,SyntaxFlag as t,serializeRGB as r}from"@csstools/css-color-parser";import{replaceComponentValues as s,parseCommaSeparatedListOfComponentValues as o,isFunctionNode as n,stringify as a}from"@csstools/css-parser-algorithms";import{tokenize as
|
|
1
|
+
import{color as e,SyntaxFlag as t,serializeRGB as r}from"@csstools/css-color-parser";import{replaceComponentValues as s,parseCommaSeparatedListOfComponentValues as o,isFunctionNode as n,stringify as a}from"@csstools/css-parser-algorithms";import{tokenize as p}from"@csstools/css-tokenizer";const l="(color: hwb(0 0% 0%))";function hasSupportsAtRuleAncestor(e){let t=e.parent;for(;t;)if("atrule"===t.type){if("supports"===t.name.toLowerCase()&&t.params.includes(l))return!0;t=t.parent}else t=t.parent;return!1}function hasFallback(e){const t=e.parent;if(!t)return!1;const r=e.prop.toLowerCase(),s=t.index(e);for(let e=0;e<s;e++){const s=t.nodes[e];if("decl"===s.type&&s.prop.toLowerCase()===r)return!0}return!1}const c=/hwb\(/i,u=/^hwb$/i,postcssPlugin=i=>{const f="preserve"in Object(i)&&Boolean(i?.preserve);return{postcssPlugin:"postcss-hwb-function",Declaration:(i,{postcss:m})=>{const h=i.value;if(!c.test(h))return;if(f&&hasSupportsAtRuleAncestor(i))return;if(hasFallback(i))return;const v=s(o(p({css:h})),(s=>{if(n(s)&&u.test(s.getName())){const o=e(s);if(!o)return;if(o.syntaxFlags.has(t.Experimental))return;if(o.syntaxFlags.has(t.HasNoneKeywords))return;if(o.syntaxFlags.has(t.RelativeColorSyntax))return;return r(o)}})),w=a(v);if(w!==h)if(i.variable&&f&&i.parent){const e=i.parent,t=m.atRule({name:"supports",params:l,source:i.source}),r=e.clone();r.removeAll(),r.append(i.clone()),t.append(r),insertAtSupportsAfterCorrectRule(t,e,l),i.replaceWith(i.clone({value:w}))}else f?i.cloneBefore({value:w}):i.replaceWith(i.clone({value:w}))}}};function insertAtSupportsAfterCorrectRule(e,t,r){let s=t,o=t.next();for(;s&&o&&"atrule"===o.type&&"supports"===o.name.toLowerCase()&&o.params===r;)s=o,o=o.next();s.after(e)}postcssPlugin.postcss=!0;export{postcssPlugin as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csstools/postcss-hwb-function",
|
|
3
3
|
"description": "Use hwb() color functions in CSS",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.7",
|
|
5
5
|
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
|
6
6
|
"license": "MIT-0",
|
|
7
7
|
"funding": [
|
|
@@ -17,15 +17,18 @@
|
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": "^14 || ^16 || >=18"
|
|
19
19
|
},
|
|
20
|
+
"type": "module",
|
|
20
21
|
"main": "dist/index.cjs",
|
|
21
22
|
"module": "dist/index.mjs",
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"default": "./dist/index.cjs"
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
},
|
|
31
34
|
"files": [
|
|
@@ -36,24 +39,13 @@
|
|
|
36
39
|
"dist"
|
|
37
40
|
],
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"@csstools/css-color-parser": "^1.
|
|
40
|
-
"@csstools/css-parser-algorithms": "^2.
|
|
41
|
-
"@csstools/css-tokenizer": "^2.2.
|
|
42
|
+
"@csstools/css-color-parser": "^1.5.0",
|
|
43
|
+
"@csstools/css-parser-algorithms": "^2.4.0",
|
|
44
|
+
"@csstools/css-tokenizer": "^2.2.2"
|
|
42
45
|
},
|
|
43
46
|
"peerDependencies": {
|
|
44
47
|
"postcss": "^8.4"
|
|
45
48
|
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@csstools/postcss-tape": "*"
|
|
48
|
-
},
|
|
49
|
-
"scripts": {
|
|
50
|
-
"build": "rollup -c ../../rollup/default.mjs",
|
|
51
|
-
"docs": "node ../../.github/bin/generate-docs/install.mjs",
|
|
52
|
-
"lint": "node ../../.github/bin/format-package-json.mjs",
|
|
53
|
-
"prepublishOnly": "npm run build && npm run test",
|
|
54
|
-
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
|
|
55
|
-
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
|
|
56
|
-
},
|
|
57
49
|
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-hwb-function#readme",
|
|
58
50
|
"repository": {
|
|
59
51
|
"type": "git",
|
|
@@ -77,12 +69,5 @@
|
|
|
77
69
|
"rgba",
|
|
78
70
|
"space",
|
|
79
71
|
"syntax"
|
|
80
|
-
]
|
|
81
|
-
"csstools": {
|
|
82
|
-
"exportName": "postcssHWBFunction",
|
|
83
|
-
"humanReadableName": "PostCSS HWB Function"
|
|
84
|
-
},
|
|
85
|
-
"volta": {
|
|
86
|
-
"extends": "../../package.json"
|
|
87
|
-
}
|
|
72
|
+
]
|
|
88
73
|
}
|