@csstools/postcss-oklab-function 3.0.7 → 3.0.9

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 CHANGED
@@ -1,165 +1,28 @@
1
1
  # Changes to PostCSS OKLab Function
2
2
 
3
- ### 3.0.7
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
- - 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)
9
-
10
- ### 3.0.6
11
-
12
- _October 2, 2023_
13
-
14
- - 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)
15
-
16
- ### 3.0.5
17
-
18
- _September 24, 2023_
19
-
20
- - Small performance improvements
21
- - 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)
22
- - 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)
23
- - 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)
24
-
25
- ### 3.0.4
26
-
27
- _September 18, 2023_
28
-
29
- - 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)
30
-
31
- ### 3.0.3
32
-
33
- _September 2, 2023_
34
-
35
- - 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)
36
-
37
- ### 3.0.2
38
-
39
- _August 28, 2023_
40
-
41
- - 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)
42
-
43
- ### 3.0.1
44
-
45
- _July 24, 2023_
46
-
47
- - 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)
48
- - 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)
49
-
50
- ### 3.0.0
51
-
52
- _July 3, 2023_
53
-
54
- - Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/))
55
- - 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)
56
- - 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)
57
- - 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)
58
-
59
- ### 2.2.3
60
-
61
- _June 1, 2023_
62
-
63
- - Updated `@csstools/postcss-progressive-custom-properties` to `2.3.0` (minor)
64
-
65
-
66
- ### 2.2.2
67
-
68
- _May 19, 2023_
69
-
70
- - Ignore relative color syntax
71
- - Updated `@csstools/postcss-progressive-custom-properties` to `2.2.0` (minor)
72
- - Updated `@csstools/css-color-parser` to `1.2.0` (minor)
3
+ ### 3.0.9
73
4
 
5
+ _December 31, 2023_
74
6
 
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)
75
10
 
76
- ### 2.2.1
11
+ ### 3.0.8
77
12
 
78
- _April 10, 2023_
13
+ _December 15, 2023_
79
14
 
80
- - Updated `@csstools/css-tokenizer` to `2.1.1` (patch)
81
- - Updated `@csstools/css-parser-algorithms` to `2.1.1` (patch)
82
- - Updated `@csstools/css-color-parser` to `1.1.2` (patch)
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/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)
19
+ - 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)
83
20
 
84
- ### 2.2.0
85
-
86
- _March 25, 2023_
87
-
88
- - Add `@csstools/css-color-parser` dependency for all color value transformations.
89
- - Add support for `calc` expressions in color components.
90
- - Skip `color(display-p3 0 0 0)` fallbacks when the color is already in the `srgb` gamut.
91
-
92
- ### 2.1.0
93
-
94
- _February 6, 2023_
95
-
96
- - Add: `@csstools/color-helpers` dependency for all color value transformations.
97
-
98
- ### 2.0.1
99
-
100
- _January 28, 2023_
101
-
102
- - Improve `types` declaration in `package.json`
103
-
104
- ### 2.0.0
105
-
106
- _January 24, 2023_
107
-
108
- - Updated: Support for Node v14+ (major).
109
-
110
- ### 1.1.1
111
-
112
- _July 8, 2022_
113
-
114
- - Fix case insensitive matching.
115
-
116
- ### 1.1.0
117
-
118
- _April 4, 2022_
119
-
120
- - Allow percentage and number units in more color components.
121
-
122
- ```css
123
- .percentages {
124
- color-1: oklab(40% 0.309% 0.975%);
125
- color-2: oklch(40% 31.718385875% 34.568626);
126
-
127
- /* becomes */
128
-
129
- color-1: rgb(73, 71, 69);
130
- color-1: color(display-p3 0.28515 0.27983 0.27246);
131
- color-2: rgb(126, 37, 15);
132
- color-2: color(display-p3 0.45368 0.16978 0.09411);
133
- }
134
-
135
- .numbers {
136
- color-1: oklab(0.40 0.001236 0.0039);
137
- color-2: oklch(0.40 0.1268735435 34.568626);
138
-
139
- /* becomes */
140
-
141
- color-1: rgb(73, 71, 69);
142
- color-1: color(display-p3 0.28515 0.27983 0.27246);
143
- color-2: rgb(126, 37, 15);
144
- color-2: color(display-p3 0.45368 0.16978 0.09411);
145
- }
146
- ```
147
-
148
- ### 1.0.2
149
-
150
- _March 8, 2022_
151
-
152
- - Fix gamut mapping giving overly unsaturated colors.
153
- - Implement powerless color components in gamut mapping.
154
-
155
- ### 1.0.1
156
-
157
- _February 12, 2022_
158
-
159
- - Updated `@csstools/postcss-progressive-custom-properties` to `1.1.0`.
21
+ ### 3.0.7
160
22
 
161
- ### 1.0.0
23
+ _October 9, 2023_
162
24
 
163
- _February 11, 2022_
25
+ - 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)
26
+ - 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)
164
27
 
165
- - Initial version
28
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-oklab-function/CHANGELOG.md)
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # PostCSS OKLab 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-oklab-function.svg" height="20">][npm-url]
4
- [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/oklab-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]
6
+ <br><br>
7
+ [<img alt="Baseline Status" src="https://cssdb.org/images/badges-baseline/oklab-function.svg" height="20">][css-url]
8
+ [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/oklab-function.svg" height="20">][css-url]
7
9
 
8
10
  [PostCSS OKLab Function] lets you use `oklab` and `oklch` color functions in
9
11
  CSS, following the [CSS Color] specification.
@@ -95,7 +97,9 @@ postcssOKLabFunction({ preserve: true })
95
97
  The `enableProgressiveCustomProperties` option determines whether the original notation
96
98
  is wrapped with `@supports` when used in Custom Properties. By default, it is enabled.
97
99
 
98
- ⚠️ We only recommend disabling this when you set `preserve` to `false` or if you bring your own fix for Custom Properties. See what the plugin does in its [README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties#readme).
100
+ > [!NOTE]
101
+ > We only recommend disabling this when you set `preserve` to `false` or if you bring your own fix for Custom Properties.
102
+ > See what the plugin does in its [README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties#readme).
99
103
 
100
104
  ```js
101
105
  postcssOKLabFunction({ enableProgressiveCustomProperties: false })
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}function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()){if(-1!==s.params.toLowerCase().indexOf("oklab("))return!0;if(-1!==s.params.toLowerCase().indexOf("oklch("))return!0}s=s.parent}else s=s.parent;return!1}const o=/(oklab|oklch)\(/i,a=/^(oklab|oklch)$/i,basePlugin=e=>({postcssPlugin:"postcss-oklab-function",Declaration:n=>{const l=n.value;if(!o.test(l))return;if(hasFallback(n))return;if(hasSupportsAtRuleAncestor(n))return;const i=s.tokenize({css:l}),u=t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(i),(e=>{if(t.isFunctionNode(e)&&a.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.serializeRGB(s)}})),c=t.stringify(u);if(c===l)return;let p=c;null!=e&&e.subFeatures.displayP3&&(p=t.stringify(t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(i),(e=>{if(t.isFunctionNode(e)&&a.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)}})))),n.cloneBefore({value:c}),null!=e&&e.subFeatures.displayP3&&p!==c&&n.cloneBefore({value:p}),null!=e&&e.preserve||n.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-oklab-function",plugins:[e(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0,module.exports=postcssPlugin;
1
+ "use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("@csstools/css-tokenizer"),t=require("@csstools/css-color-parser"),r=require("@csstools/css-parser-algorithms");function hasFallback(e){const s=e.parent;if(!s)return!1;const t=e.prop.toLowerCase(),r=s.index(e);for(let e=0;e<r;e++){const r=s.nodes[e];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()){if(-1!==s.params.toLowerCase().indexOf("oklab("))return!0;if(-1!==s.params.toLowerCase().indexOf("oklch("))return!0}s=s.parent}else s=s.parent;return!1}const a=/(oklab|oklch)\(/i,o=/^(oklab|oklch)$/i,basePlugin=e=>({postcssPlugin:"postcss-oklab-function",Declaration:n=>{const l=n.value;if(!a.test(l))return;if(hasFallback(n))return;if(hasSupportsAtRuleAncestor(n))return;const i=s.tokenize({css:l}),u=r.replaceComponentValues(r.parseCommaSeparatedListOfComponentValues(i),(e=>{if(!r.isFunctionNode(e)||!o.test(e.getName()))return;const s=t.color(e);return s&&!(s.syntaxFlags.has(t.SyntaxFlag.Experimental)||s.syntaxFlags.has(t.SyntaxFlag.HasNoneKeywords)||s.syntaxFlags.has(t.SyntaxFlag.RelativeColorSyntax))?t.serializeRGB(s):void 0})),p=r.stringify(u);if(p===l)return;let c=p;e?.subFeatures.displayP3&&(c=r.stringify(r.replaceComponentValues(r.parseCommaSeparatedListOfComponentValues(i),(e=>{if(!r.isFunctionNode(e)||!o.test(e.getName()))return;const s=t.color(e);return s&&!(s.syntaxFlags.has(t.SyntaxFlag.Experimental)||s.syntaxFlags.has(t.SyntaxFlag.HasNoneKeywords)||s.syntaxFlags.has(t.SyntaxFlag.RelativeColorSyntax))?t.colorDataFitsRGB_Gamut(s)?t.serializeRGB(s):t.serializeP3(s):void 0})))),n.cloneBefore({value:p}),e?.subFeatures.displayP3&&c!==p&&n.cloneBefore({value:c}),e?.preserve||n.remove()}});basePlugin.postcss=!0;const postcssPlugin=s=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},s);return t.subFeatures=Object.assign({displayP3:!0},t.subFeatures),t.enableProgressiveCustomProperties&&(t.preserve||t.subFeatures.displayP3)?{postcssPlugin:"postcss-oklab-function",plugins:[e(),basePlugin(t)]}:basePlugin(t)};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-oklab-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
  /** 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 n}from"@csstools/css-color-parser";import{replaceComponentValues as l,parseCommaSeparatedListOfComponentValues as u,isFunctionNode as i,stringify as p}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}function hasSupportsAtRuleAncestor(s){let e=s.parent;for(;e;)if("atrule"===e.type){if("supports"===e.name.toLowerCase()){if(-1!==e.params.toLowerCase().indexOf("oklab("))return!0;if(-1!==e.params.toLowerCase().indexOf("oklch("))return!0}e=e.parent}else e=e.parent;return!1}const c=/(oklab|oklch)\(/i,f=/^(oklab|oklch)$/i,basePlugin=s=>({postcssPlugin:"postcss-oklab-function",Declaration:m=>{const b=m.value;if(!c.test(b))return;if(hasFallback(m))return;if(hasSupportsAtRuleAncestor(m))return;const g=e({css:b}),y=l(u(g),(s=>{if(i(s)&&f.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 o(e)}})),d=p(y);if(d===b)return;let h=d;null!=s&&s.subFeatures.displayP3&&(h=p(l(u(g),(s=>{if(i(s)&&f.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):n(e)}})))),m.cloneBefore({value:d}),null!=s&&s.subFeatures.displayP3&&h!==d&&m.cloneBefore({value:h}),null!=s&&s.preserve||m.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-oklab-function",plugins:[s(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0;export{postcssPlugin as default};
1
+ import s from"@csstools/postcss-progressive-custom-properties";import{tokenize as e}from"@csstools/css-tokenizer";import{color as t,SyntaxFlag as r,serializeRGB as o,colorDataFitsRGB_Gamut as a,serializeP3 as n}from"@csstools/css-color-parser";import{replaceComponentValues as l,parseCommaSeparatedListOfComponentValues as i,isFunctionNode as p,stringify as u}from"@csstools/css-parser-algorithms";function hasFallback(s){const e=s.parent;if(!e)return!1;const t=s.prop.toLowerCase(),r=e.index(s);for(let s=0;s<r;s++){const r=e.nodes[s];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}function hasSupportsAtRuleAncestor(s){let e=s.parent;for(;e;)if("atrule"===e.type){if("supports"===e.name.toLowerCase()){if(-1!==e.params.toLowerCase().indexOf("oklab("))return!0;if(-1!==e.params.toLowerCase().indexOf("oklch("))return!0}e=e.parent}else e=e.parent;return!1}const c=/(oklab|oklch)\(/i,f=/^(oklab|oklch)$/i,basePlugin=s=>({postcssPlugin:"postcss-oklab-function",Declaration:m=>{const b=m.value;if(!c.test(b))return;if(hasFallback(m))return;if(hasSupportsAtRuleAncestor(m))return;const g=e({css:b}),y=l(i(g),(s=>{if(!p(s)||!f.test(s.getName()))return;const e=t(s);return e&&!(e.syntaxFlags.has(r.Experimental)||e.syntaxFlags.has(r.HasNoneKeywords)||e.syntaxFlags.has(r.RelativeColorSyntax))?o(e):void 0})),d=u(y);if(d===b)return;let h=d;s?.subFeatures.displayP3&&(h=u(l(i(g),(s=>{if(!p(s)||!f.test(s.getName()))return;const e=t(s);return e&&!(e.syntaxFlags.has(r.Experimental)||e.syntaxFlags.has(r.HasNoneKeywords)||e.syntaxFlags.has(r.RelativeColorSyntax))?a(e)?o(e):n(e):void 0})))),m.cloneBefore({value:d}),s?.subFeatures.displayP3&&h!==d&&m.cloneBefore({value:h}),s?.preserve||m.remove()}});basePlugin.postcss=!0;const postcssPlugin=e=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},e);return t.subFeatures=Object.assign({displayP3:!0},t.subFeatures),t.enableProgressiveCustomProperties&&(t.preserve||t.subFeatures.displayP3)?{postcssPlugin:"postcss-oklab-function",plugins:[s(),basePlugin(t)]}:basePlugin(t)};postcssPlugin.postcss=!0;export{postcssPlugin as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@csstools/postcss-oklab-function",
3
3
  "description": "Use oklab() and oklch() color functions in CSS",
4
- "version": "3.0.7",
4
+ "version": "3.0.9",
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
- "types": "./dist/index.d.ts",
26
- "import": "./dist/index.mjs",
27
- "require": "./dist/index.cjs",
28
- "default": "./dist/index.mjs"
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": [
@@ -35,25 +38,14 @@
35
38
  "dist"
36
39
  ],
37
40
  "dependencies": {
38
- "@csstools/css-color-parser": "^1.4.0",
39
- "@csstools/css-parser-algorithms": "^2.3.2",
40
- "@csstools/css-tokenizer": "^2.2.1",
41
- "@csstools/postcss-progressive-custom-properties": "^3.0.2"
41
+ "@csstools/css-color-parser": "^1.5.1",
42
+ "@csstools/css-parser-algorithms": "^2.5.0",
43
+ "@csstools/css-tokenizer": "^2.2.3",
44
+ "@csstools/postcss-progressive-custom-properties": "^3.0.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-oklab-function#readme",
58
50
  "repository": {
59
51
  "type": "git",
@@ -71,12 +63,5 @@
71
63
  "postcss",
72
64
  "postcss-plugin",
73
65
  "syntax"
74
- ],
75
- "csstools": {
76
- "exportName": "postcssOKLabFunction",
77
- "humanReadableName": "PostCSS OKLab Function"
78
- },
79
- "volta": {
80
- "extends": "../../package.json"
81
- }
66
+ ]
82
67
  }
@@ -1,2 +0,0 @@
1
- import type { Declaration } from 'postcss';
2
- export declare function hasFallback(node: Declaration): boolean;
@@ -1,2 +0,0 @@
1
- import type { Node } from 'postcss';
2
- export declare function hasSupportsAtRuleAncestor(node: Node): boolean;