@csstools/postcss-hwb-function 3.0.6 → 3.0.8
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 +15 -102
- package/README.md +3 -2
- 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,113 +1,26 @@
|
|
|
1
1
|
# Changes to PostCSS HWB Function
|
|
2
2
|
|
|
3
|
-
### 3.0.
|
|
4
|
-
|
|
5
|
-
_October 9, 2023_
|
|
6
|
-
|
|
7
|
-
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.4.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#140) (minor)
|
|
8
|
-
|
|
9
|
-
### 3.0.5
|
|
10
|
-
|
|
11
|
-
_October 2, 2023_
|
|
12
|
-
|
|
13
|
-
- 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
|
-
|
|
15
|
-
### 3.0.4
|
|
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
|
|
3
|
+
### 3.0.8
|
|
51
4
|
|
|
52
|
-
|
|
5
|
+
_December 31, 2023_
|
|
53
6
|
|
|
54
|
-
-
|
|
55
|
-
- Updated `@csstools/css-
|
|
7
|
+
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#223) (patch)
|
|
8
|
+
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.5.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#250) (minor)
|
|
9
|
+
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.5.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#151) (patch)
|
|
56
10
|
|
|
11
|
+
### 3.0.7
|
|
57
12
|
|
|
58
|
-
|
|
13
|
+
_December 15, 2023_
|
|
59
14
|
|
|
60
|
-
|
|
15
|
+
- Skip transforms when a color value contains experimental syntax
|
|
16
|
+
- 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)
|
|
17
|
+
- 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)
|
|
18
|
+
- 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)
|
|
61
19
|
|
|
62
|
-
|
|
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.
|
|
20
|
+
### 3.0.6
|
|
108
21
|
|
|
109
|
-
|
|
22
|
+
_October 9, 2023_
|
|
110
23
|
|
|
111
|
-
|
|
24
|
+
- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`1.4.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#140) (minor)
|
|
112
25
|
|
|
113
|
-
-
|
|
26
|
+
[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-hwb-function/CHANGELOG.md)
|
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# PostCSS HWB Function [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
|
|
2
2
|
|
|
3
3
|
[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/postcss-hwb-function.svg" height="20">][npm-url]
|
|
4
|
-
[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/hwb-function.svg" height="20">][css-url]
|
|
5
4
|
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url]
|
|
6
5
|
[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
|
|
7
|
-
|
|
6
|
+
<br><br>
|
|
7
|
+
[<img alt="Baseline Status" src="https://cssdb.org/images/badges-baseline/hwb-function.svg" height="20">][css-url]
|
|
8
|
+
[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/hwb-function.svg" height="20">][css-url]
|
|
8
9
|
|
|
9
10
|
[PostCSS HWB Function] lets you use `hwb` color functions in
|
|
10
11
|
CSS, following the [CSS Color] specification.
|
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,
|
|
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,a=/^hwb$/i,postcssPlugin=n=>{const l="preserve"in Object(n)&&Boolean(n?.preserve);return{postcssPlugin:"postcss-hwb-function",Declaration:(n,{postcss:p})=>{const c=n.value;if(!o.test(c))return;if(l&&hasSupportsAtRuleAncestor(n))return;if(hasFallback(n))return;const u=t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(r.tokenize({css:c})),(r=>{if(!t.isFunctionNode(r)||!a.test(r.getName()))return;const s=e.color(r);return s&&!(s.syntaxFlags.has(e.SyntaxFlag.Experimental)||s.syntaxFlags.has(e.SyntaxFlag.HasNoneKeywords)||s.syntaxFlags.has(e.SyntaxFlag.RelativeColorSyntax))?e.serializeRGB(s):void 0})),i=t.stringify(u);if(i!==c)if(n.variable&&l&&n.parent){const e=n.parent,t=p.atRule({name:"supports",params:s,source:n.source}),r=e.clone();r.removeAll(),r.append(n.clone()),t.append(r),insertAtSupportsAfterCorrectRule(t,e,s),n.replaceWith(n.clone({value:i}))}else l?n.cloneBefore({value:i}):n.replaceWith(n.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()))return;const o=e(s);return o&&!(o.syntaxFlags.has(t.Experimental)||o.syntaxFlags.has(t.HasNoneKeywords)||o.syntaxFlags.has(t.RelativeColorSyntax))?r(o):void 0})),d=a(v);if(d!==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:d}))}else f?i.cloneBefore({value:d}):i.replaceWith(i.clone({value:d}))}}};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.8",
|
|
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.1",
|
|
43
|
+
"@csstools/css-parser-algorithms": "^2.5.0",
|
|
44
|
+
"@csstools/css-tokenizer": "^2.2.3"
|
|
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
|
}
|