@csstools/postcss-relative-color-syntax 2.0.6 → 2.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 -61
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +1 -1
- package/package.json +14 -31
- package/dist/has-fallback-decl.d.ts +0 -2
- package/dist/has-supports-at-rule-ancestor.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,72 +1,26 @@
|
|
|
1
1
|
# Changes to PostCSS Relative Color Syntax
|
|
2
2
|
|
|
3
|
-
### 2.0.
|
|
4
|
-
|
|
5
|
-
_October 2, 2023_
|
|
6
|
-
|
|
7
|
-
- 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)
|
|
8
|
-
|
|
9
|
-
### 2.0.5
|
|
10
|
-
|
|
11
|
-
_September 24, 2023_
|
|
12
|
-
|
|
13
|
-
- Small performance improvements
|
|
14
|
-
- 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)
|
|
15
|
-
- 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)
|
|
16
|
-
- 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)
|
|
17
|
-
|
|
18
|
-
### 2.0.4
|
|
19
|
-
|
|
20
|
-
_September 18, 2023_
|
|
21
|
-
|
|
22
|
-
- Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#301) (patch)
|
|
23
|
-
|
|
24
|
-
### 2.0.3
|
|
25
|
-
|
|
26
|
-
_September 2, 2023_
|
|
27
|
-
|
|
28
|
-
- 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)
|
|
3
|
+
### 2.0.8
|
|
29
4
|
|
|
30
|
-
|
|
5
|
+
_December 15, 2023_
|
|
31
6
|
|
|
32
|
-
|
|
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/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.3`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#303) (patch)
|
|
11
|
+
- 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)
|
|
33
12
|
|
|
34
|
-
|
|
13
|
+
### 2.0.7
|
|
35
14
|
|
|
36
|
-
|
|
15
|
+
_October 9, 2023_
|
|
37
16
|
|
|
38
|
-
|
|
17
|
+
- 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)
|
|
18
|
+
- Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.2`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#302) (patch)
|
|
39
19
|
|
|
40
|
-
|
|
41
|
-
- 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)
|
|
42
|
-
|
|
43
|
-
### 2.0.0
|
|
44
|
-
|
|
45
|
-
_July 3, 2023_
|
|
46
|
-
|
|
47
|
-
- Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/))
|
|
48
|
-
- 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)
|
|
49
|
-
- Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#300) (major)
|
|
50
|
-
- 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)
|
|
51
|
-
|
|
52
|
-
### 1.0.2
|
|
53
|
-
|
|
54
|
-
_June 14, 2023_
|
|
55
|
-
|
|
56
|
-
- Fix value calculation for `hue` components in relative color syntax.
|
|
57
|
-
|
|
58
|
-
### 1.0.1
|
|
59
|
-
|
|
60
|
-
_June 1, 2023_
|
|
61
|
-
|
|
62
|
-
- Updated `@csstools/postcss-progressive-custom-properties` to `2.3.0` (minor)
|
|
63
|
-
|
|
64
|
-
### 1.0.0
|
|
65
|
-
|
|
66
|
-
_May 19, 2023_
|
|
20
|
+
### 2.0.6
|
|
67
21
|
|
|
68
|
-
|
|
69
|
-
- Updated `@csstools/postcss-progressive-custom-properties` to `2.2.0` (minor)
|
|
70
|
-
- Updated `@csstools/css-color-parser` to `1.2.0` (minor)
|
|
22
|
+
_October 2, 2023_
|
|
71
23
|
|
|
24
|
+
- 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)
|
|
72
25
|
|
|
26
|
+
[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-relative-color-syntax/CHANGELOG.md)
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("@csstools/css-tokenizer"),r=require("@csstools/css-color-parser"),t=require("@csstools/css-parser-algorithms");function hasFallback(e){const s=e.parent;if(!s)return!1;const r=e.prop.toLowerCase(),t=s.index(e);for(let e=0;e<t;e++){const t=s.nodes[e];if("decl"===t.type&&t.prop.toLowerCase()===r)return!0}return!1}const o=/(rgb|hsl|hwb|lab|lch|oklch|oklab|color)\(\s*?from/i;function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&o.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}const a=/(rgb|hsl|hwb|lab|lch|oklch|oklab|color)\(/i,
|
|
1
|
+
"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("@csstools/css-tokenizer"),r=require("@csstools/css-color-parser"),t=require("@csstools/css-parser-algorithms");function hasFallback(e){const s=e.parent;if(!s)return!1;const r=e.prop.toLowerCase(),t=s.index(e);for(let e=0;e<t;e++){const t=s.nodes[e];if("decl"===t.type&&t.prop.toLowerCase()===r)return!0}return!1}const o=/(rgb|hsl|hwb|lab|lch|oklch|oklab|color)\(\s*?from/i;function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()&&o.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}const a=/(rgb|hsl|hwb|lab|lch|oklch|oklab|color)\(/i,n=/^(rgb|hsl|hwb|lab|lch|oklch|oklab|color)$/i,l=/from/i,basePlugin=e=>({postcssPlugin:"postcss-relative-color-syntax",Declaration:o=>{const i=o.value;if(!a.test(i))return;if(!l.test(i))return;if(hasFallback(o))return;if(hasSupportsAtRuleAncestor(o))return;const u=s.tokenize({css:i}),c=t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(u),(e=>{if(t.isFunctionNode(e)&&n.test(e.getName())){const s=r.color(e);if(!s)return;if(s.syntaxFlags.has(r.SyntaxFlag.Experimental))return;if(s.syntaxFlags.has(r.SyntaxFlag.HasNoneKeywords))return;if(!s.syntaxFlags.has(r.SyntaxFlag.RelativeColorSyntax))return;return r.serializeRGB(s)}})),p=t.stringify(c);if(p===i)return;let f=p;e?.subFeatures.displayP3&&(f=t.stringify(t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(u),(e=>{if(t.isFunctionNode(e)&&n.test(e.getName())){const s=r.color(e);if(!s)return;if(s.syntaxFlags.has(r.SyntaxFlag.HasNoneKeywords))return;if(!s.syntaxFlags.has(r.SyntaxFlag.RelativeColorSyntax))return;return r.colorDataFitsRGB_Gamut(s)?r.serializeRGB(s):r.serializeP3(s)}})))),o.cloneBefore({value:p}),e?.subFeatures.displayP3&&f!==p&&o.cloneBefore({value:f}),e?.preserve||o.remove()}});basePlugin.postcss=!0;const postcssPlugin=s=>{const r=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},s);return r.subFeatures=Object.assign({displayP3:!0},r.subFeatures),r.enableProgressiveCustomProperties&&(r.preserve||r.subFeatures.displayP3)?{postcssPlugin:"postcss-relative-color-syntax",plugins:[e(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0,module.exports=postcssPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PluginCreator } from 'postcss';
|
|
2
|
+
|
|
2
3
|
/** postcss-relative-color-syntax 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
|
/** Enable "@csstools/postcss-progressive-custom-properties". default: true */
|
|
@@ -11,5 +12,8 @@ export type pluginOptions = {
|
|
|
11
12
|
displayP3?: boolean;
|
|
12
13
|
};
|
|
13
14
|
};
|
|
15
|
+
|
|
14
16
|
declare const postcssPlugin: PluginCreator<pluginOptions>;
|
|
15
17
|
export default postcssPlugin;
|
|
18
|
+
|
|
19
|
+
export { }
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import s from"@csstools/postcss-progressive-custom-properties";import{tokenize as e}from"@csstools/css-tokenizer";import{color as r,SyntaxFlag as t,serializeRGB as o,colorDataFitsRGB_Gamut as a,serializeP3 as l}from"@csstools/css-color-parser";import{replaceComponentValues as n,parseCommaSeparatedListOfComponentValues as
|
|
1
|
+
import s from"@csstools/postcss-progressive-custom-properties";import{tokenize as e}from"@csstools/css-tokenizer";import{color as r,SyntaxFlag as t,serializeRGB as o,colorDataFitsRGB_Gamut as a,serializeP3 as l}from"@csstools/css-color-parser";import{replaceComponentValues as n,parseCommaSeparatedListOfComponentValues as i,isFunctionNode as c,stringify as u}from"@csstools/css-parser-algorithms";function hasFallback(s){const e=s.parent;if(!e)return!1;const r=s.prop.toLowerCase(),t=e.index(s);for(let s=0;s<t;s++){const t=e.nodes[s];if("decl"===t.type&&t.prop.toLowerCase()===r)return!0}return!1}const p=/(rgb|hsl|hwb|lab|lch|oklch|oklab|color)\(\s*?from/i;function hasSupportsAtRuleAncestor(s){let e=s.parent;for(;e;)if("atrule"===e.type){if("supports"===e.name.toLowerCase()&&p.test(e.params))return!0;e=e.parent}else e=e.parent;return!1}const f=/(rgb|hsl|hwb|lab|lch|oklch|oklab|color)\(/i,b=/^(rgb|hsl|hwb|lab|lch|oklch|oklab|color)$/i,h=/from/i,basePlugin=s=>({postcssPlugin:"postcss-relative-color-syntax",Declaration:p=>{const m=p.value;if(!f.test(m))return;if(!h.test(m))return;if(hasFallback(p))return;if(hasSupportsAtRuleAncestor(p))return;const g=e({css:m}),y=n(i(g),(s=>{if(c(s)&&b.test(s.getName())){const e=r(s);if(!e)return;if(e.syntaxFlags.has(t.Experimental))return;if(e.syntaxFlags.has(t.HasNoneKeywords))return;if(!e.syntaxFlags.has(t.RelativeColorSyntax))return;return o(e)}})),v=u(y);if(v===m)return;let F=v;s?.subFeatures.displayP3&&(F=u(n(i(g),(s=>{if(c(s)&&b.test(s.getName())){const e=r(s);if(!e)return;if(e.syntaxFlags.has(t.HasNoneKeywords))return;if(!e.syntaxFlags.has(t.RelativeColorSyntax))return;return a(e)?o(e):l(e)}})))),p.cloneBefore({value:v}),s?.subFeatures.displayP3&&F!==v&&p.cloneBefore({value:F}),s?.preserve||p.remove()}});basePlugin.postcss=!0;const postcssPlugin=e=>{const r=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},e);return r.subFeatures=Object.assign({displayP3:!0},r.subFeatures),r.enableProgressiveCustomProperties&&(r.preserve||r.subFeatures.displayP3)?{postcssPlugin:"postcss-relative-color-syntax",plugins:[s(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0;export{postcssPlugin as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csstools/postcss-relative-color-syntax",
|
|
3
3
|
"description": "Use the relative color syntax in CSS",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.8",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Antonio Laguna",
|
|
@@ -27,15 +27,18 @@
|
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": "^14 || ^16 || >=18"
|
|
29
29
|
},
|
|
30
|
+
"type": "module",
|
|
30
31
|
"main": "dist/index.cjs",
|
|
31
32
|
"module": "dist/index.mjs",
|
|
32
|
-
"types": "dist/index.d.ts",
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"default": "./dist/index.cjs"
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
},
|
|
41
44
|
"files": [
|
|
@@ -45,25 +48,14 @@
|
|
|
45
48
|
"dist"
|
|
46
49
|
],
|
|
47
50
|
"dependencies": {
|
|
48
|
-
"@csstools/css-color-parser": "^1.
|
|
49
|
-
"@csstools/css-parser-algorithms": "^2.
|
|
50
|
-
"@csstools/css-tokenizer": "^2.2.
|
|
51
|
-
"@csstools/postcss-progressive-custom-properties": "^3.0.
|
|
51
|
+
"@csstools/css-color-parser": "^1.5.0",
|
|
52
|
+
"@csstools/css-parser-algorithms": "^2.4.0",
|
|
53
|
+
"@csstools/css-tokenizer": "^2.2.2",
|
|
54
|
+
"@csstools/postcss-progressive-custom-properties": "^3.0.3"
|
|
52
55
|
},
|
|
53
56
|
"peerDependencies": {
|
|
54
57
|
"postcss": "^8.4"
|
|
55
58
|
},
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"@csstools/postcss-tape": "*"
|
|
58
|
-
},
|
|
59
|
-
"scripts": {
|
|
60
|
-
"build": "rollup -c ../../rollup/default.mjs",
|
|
61
|
-
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
|
|
62
|
-
"lint": "node ../../.github/bin/format-package-json.mjs",
|
|
63
|
-
"prepublishOnly": "npm run build && npm run test",
|
|
64
|
-
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
|
|
65
|
-
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
|
|
66
|
-
},
|
|
67
59
|
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-relative-color-syntax#readme",
|
|
68
60
|
"repository": {
|
|
69
61
|
"type": "git",
|
|
@@ -75,14 +67,5 @@
|
|
|
75
67
|
"color",
|
|
76
68
|
"postcss-plugin",
|
|
77
69
|
"relative color syntax"
|
|
78
|
-
]
|
|
79
|
-
"csstools": {
|
|
80
|
-
"cssdbId": "relative-color-syntax",
|
|
81
|
-
"exportName": "postcssRelativeColorSyntax",
|
|
82
|
-
"humanReadableName": "PostCSS Relative Color Syntax",
|
|
83
|
-
"specUrl": "https://www.w3.org/TR/css-color-5/#relative-colors"
|
|
84
|
-
},
|
|
85
|
-
"volta": {
|
|
86
|
-
"extends": "../../package.json"
|
|
87
|
-
}
|
|
70
|
+
]
|
|
88
71
|
}
|