diff options
Diffstat (limited to 'node_modules/@csstools/postcss-gradients-interpolation-method')
7 files changed, 0 insertions, 305 deletions
diff --git a/node_modules/@csstools/postcss-gradients-interpolation-method/CHANGELOG.md b/node_modules/@csstools/postcss-gradients-interpolation-method/CHANGELOG.md deleted file mode 100644 index 91f52ea0..00000000 --- a/node_modules/@csstools/postcss-gradients-interpolation-method/CHANGELOG.md +++ /dev/null @@ -1,25 +0,0 @@ -# Changes to PostCSS Gradients Interpolation Method - -### 4.0.20 - -_July 7, 2024_ - -- Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.3.0`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#330) (minor) - -### 4.0.19 - -_July 6, 2024_ - -- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.4.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#241) (patch) -- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#271) (patch) -- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`2.0.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#204) (patch) - -### 4.0.18 - -_June 29, 2024_ - -- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#232) (patch) -- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.7.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#270) (minor) -- Updated [`@csstools/css-color-parser`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser) to [`2.0.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-color-parser/CHANGELOG.md#203) (patch) - -[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-gradients-interpolation-method/CHANGELOG.md) diff --git a/node_modules/@csstools/postcss-gradients-interpolation-method/LICENSE.md b/node_modules/@csstools/postcss-gradients-interpolation-method/LICENSE.md deleted file mode 100644 index e8ae93b9..00000000 --- a/node_modules/@csstools/postcss-gradients-interpolation-method/LICENSE.md +++ /dev/null @@ -1,18 +0,0 @@ -MIT No Attribution (MIT-0) - -Copyright © CSSTools Contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the “Software”), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@csstools/postcss-gradients-interpolation-method/README.md b/node_modules/@csstools/postcss-gradients-interpolation-method/README.md deleted file mode 100644 index a9badbb3..00000000 --- a/node_modules/@csstools/postcss-gradients-interpolation-method/README.md +++ /dev/null @@ -1,173 +0,0 @@ -# PostCSS Gradients Interpolation Method [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS] - -[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/postcss-gradients-interpolation-method.svg" height="20">][npm-url] [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]<br><br>[<img alt="Baseline Status" src="https://cssdb.org/images/badges-baseline/gradients-interpolation-method.svg" height="20">][css-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/gradients-interpolation-method.svg" height="20">][css-url] - -```bash -npm install @csstools/postcss-gradients-interpolation-method --save-dev -``` - -[PostCSS Gradients Interpolation Method] lets you use different interpolation methods in CSS gradient functions following [CSS Images Module 4]. - -```pcss -.example { - background-image: linear-gradient(in oklch, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%); -} - -:root { - --background-image: linear-gradient(in oklab, hsl(96, 42%, 24%) 0%, hsl(302, 67%, 25%) 100%); -} - -/* becomes */ - -.example { - background-image: linear-gradient(rgb(245, 137, 137) 0%, rgb(248, 146, 114), rgb(244, 158, 94), rgb(235, 171, 82), rgb(220, 185, 81), rgb(201, 199, 95), rgb(177, 211, 118), rgb(151, 221, 146), rgb(125, 229, 177), rgb(103, 235, 208), rgb(94, 237, 237) 100%); - background-image: linear-gradient(in oklch, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%); -} - -:root { - --background-image: linear-gradient(rgb(56, 87, 35) 0%, rgb(64, 83, 46), rgb(70, 79, 54), rgb(76, 74, 62), rgb(82, 69, 68), rgb(86, 64, 75), rgb(91, 58, 81), rgb(95, 51, 87), rgb(99, 44, 93), rgb(103, 34, 98), rgb(106, 21, 104) 100%); -} - -@supports (background: linear-gradient(in oklch, red 0%, red 0% 1%, red 2%)) { -:root { - --background-image: linear-gradient(in oklab, hsl(96, 42%, 24%) 0%, hsl(302, 67%, 25%) 100%); -} -} -``` - -## Shortcomings - -> [!CAUTION] -> Color stops with only a color or only an interpolation hint are not supported. - -For best results you should always provide at least the color and position for each color stop. -Double position color stops are supported. - -```pcss -.foo { - /* Only a color: can't transform */ - background-image: linear-gradient(in oklch, black 0%, green, blue 100%); - - /* Only an interpolation hint: can't transform */ - background-image: linear-gradient(in oklch, black 0%, 25%, blue 100%); -} -``` - -> [!CAUTION] -> Variable colors are not supported. -> We can not mix colors when the color is a variable. - -```pcss -.foo { - --red: red; - /* Color stop variable : can't transform */ - background-image: linear-gradient(in oklch, black 0%, var(--red), blue 100%); -} -``` - -## Usage - -Add [PostCSS Gradients Interpolation Method] to your project: - -```bash -npm install postcss @csstools/postcss-gradients-interpolation-method --save-dev -``` - -Use it as a [PostCSS] plugin: - -```js -const postcss = require('postcss'); -const postcssGradientsInterpolationMethod = require('@csstools/postcss-gradients-interpolation-method'); - -postcss([ - postcssGradientsInterpolationMethod(/* pluginOptions */) -]).process(YOUR_CSS /*, processOptions */); -``` - -[PostCSS Gradients Interpolation Method] runs in all Node environments, with special -instructions for: - -- [Node](INSTALL.md#node) -- [PostCSS CLI](INSTALL.md#postcss-cli) -- [PostCSS Load Config](INSTALL.md#postcss-load-config) -- [Webpack](INSTALL.md#webpack) -- [Next.js](INSTALL.md#nextjs) -- [Gulp](INSTALL.md#gulp) -- [Grunt](INSTALL.md#grunt) - -## Options - -### preserve - -The `preserve` option determines whether the original notation -is preserved. By default, it is preserved. - -```js -postcssGradientsInterpolationMethod({ preserve: false }) -``` - -```pcss -.example { - background-image: linear-gradient(in oklch, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%); -} - -:root { - --background-image: linear-gradient(in oklab, hsl(96, 42%, 24%) 0%, hsl(302, 67%, 25%) 100%); -} - -/* becomes */ - -.example { - background-image: linear-gradient(rgb(245, 137, 137) 0%, rgb(248, 146, 114), rgb(244, 158, 94), rgb(235, 171, 82), rgb(220, 185, 81), rgb(201, 199, 95), rgb(177, 211, 118), rgb(151, 221, 146), rgb(125, 229, 177), rgb(103, 235, 208), rgb(94, 237, 237) 100%); -} - -:root { - --background-image: linear-gradient(rgb(56, 87, 35) 0%, rgb(64, 83, 46), rgb(70, 79, 54), rgb(76, 74, 62), rgb(82, 69, 68), rgb(86, 64, 75), rgb(91, 58, 81), rgb(95, 51, 87), rgb(99, 44, 93), rgb(103, 34, 98), rgb(106, 21, 104) 100%); -} -``` - -### enableProgressiveCustomProperties - -The `enableProgressiveCustomProperties` option determines whether the original notation -is wrapped with `@supports` when used in Custom Properties. By default, it is enabled. - -> [!NOTE] -> 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). - -```js -postcssGradientsInterpolationMethod({ enableProgressiveCustomProperties: false }) -``` - -```pcss -.example { - background-image: linear-gradient(in oklch, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%); -} - -:root { - --background-image: linear-gradient(in oklab, hsl(96, 42%, 24%) 0%, hsl(302, 67%, 25%) 100%); -} - -/* becomes */ - -.example { - background-image: linear-gradient(rgb(245, 137, 137) 0%, rgb(248, 146, 114), rgb(244, 158, 94), rgb(235, 171, 82), rgb(220, 185, 81), rgb(201, 199, 95), rgb(177, 211, 118), rgb(151, 221, 146), rgb(125, 229, 177), rgb(103, 235, 208), rgb(94, 237, 237) 100%); - background-image: linear-gradient(in oklch, hsl(0deg 85% 75%) 0%, hsl(180deg 80% 65%) 100%); -} - -:root { - --background-image: linear-gradient(rgb(56, 87, 35) 0%, rgb(64, 83, 46), rgb(70, 79, 54), rgb(76, 74, 62), rgb(82, 69, 68), rgb(86, 64, 75), rgb(91, 58, 81), rgb(95, 51, 87), rgb(99, 44, 93), rgb(103, 34, 98), rgb(106, 21, 104) 100%); - --background-image: linear-gradient(in oklab, hsl(96, 42%, 24%) 0%, hsl(302, 67%, 25%) 100%); -} -``` - -_Custom properties do not fallback to the previous declaration_ - -[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test -[css-url]: https://cssdb.org/#gradients-interpolation-method -[discord]: https://discord.gg/bUadyRwkJS -[npm-url]: https://www.npmjs.com/package/@csstools/postcss-gradients-interpolation-method - -[PostCSS]: https://github.com/postcss/postcss -[PostCSS Gradients Interpolation Method]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-gradients-interpolation-method -[CSS Images Module 4]: https://drafts.csswg.org/css-images-4/#linear-gradients diff --git a/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.cjs b/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.cjs deleted file mode 100644 index 68872a75..00000000 --- a/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.cjs +++ /dev/null @@ -1 +0,0 @@ -"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),o=require("@csstools/utilities"),t=require("@csstools/css-parser-algorithms"),i=require("@csstools/css-tokenizer"),n=require("@csstools/css-color-parser");const s=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i,r=/\bin\b/i,a={test:e=>s.test(e)&&r.test(e)},l=/^(repeating-)?(linear|radial|conic)-gradient$/i;function interpolateColorsInColorStopsList(e,o,s,r=!1){const a=[],l=[];for(let r=0;r<e.length-1;r++){const a=e[r],c=e[r+1];if(l.push(a),s||n.serializeP3(a.colorData,!1).toString()!==n.serializeP3(c.colorData,!1).toString()&&a.position.toString()!==c.position.toString())for(let e=1;e<=9;e++){const r=10*e;let u=[];s&&(u=[new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]),s,new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]),new t.TokenNode([i.TokenType.Ident,"hue",-1,-1,{value:"hue"}])]);const p=new t.FunctionNode([i.TokenType.Function,"color-mix(",-1,-1,{value:"color-mix"}],[i.TokenType.CloseParen,")",-1,-1,void 0],[new t.TokenNode([i.TokenType.Ident,"in",-1,-1,{value:"in"}]),new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]),o,...u,new t.TokenNode([i.TokenType.Comma,",",-1,-1,void 0]),new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]),a.color,new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]),new t.TokenNode([i.TokenType.Percentage,100-r+"%",-1,-1,{value:100-r}]),new t.TokenNode([i.TokenType.Comma,",",-1,-1,void 0]),new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]),c.color,new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]),new t.TokenNode([i.TokenType.Percentage,`${r}%`,-1,-1,{value:r}])]),d=n.color(p);if(!d)return!1;l.push({colorData:d})}r===e.length-2&&l.push(c)}for(let e=0;e<l.length;e++)r&&!n.colorDataFitsRGB_Gamut(l[e].colorData)?l[e].color=n.serializeP3(l[e].colorData,!1):l[e].color=n.serializeRGB(l[e].colorData,!1);for(let e=0;e<l.length;e++){const o=l[e];o.position?a.push(o.color,new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]),o.position):a.push(o.color),e!==l.length-1&&a.push(new t.TokenNode([i.TokenType.Comma,",",-1,-1,void 0]),new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]]))}return a}function parseColorStops(e){const o=[];let s={};for(let r=0;r<e.length;r++){const a=e[r];if(t.isCommentNode(a)||t.isWhitespaceNode(a))continue;if(t.isTokenNode(a)&&i.isTokenComma(a.value)){if(s.color&&s.colorData&&s.positionA){o.push({color:s.color,colorData:s.colorData,position:s.positionA}),s.positionB&&o.push({color:s.color,colorData:s.colorData,position:s.positionB}),s={};continue}return!1}const l=n.color(a);if(l){if(s.color)return!1;if(l.syntaxFlags.has(n.SyntaxFlag.Experimental))return!1;s.color=a,s.colorData=l}else{if(!s.color)return!1;if(s.positionA){if(!s.positionA||s.positionB)return!1;s.positionB=a}else s.positionA=a}}return!(!s.color||!s.positionA)&&(s.color&&s.colorData&&s.positionA&&(o.push({color:s.color,colorData:s.colorData,position:s.positionA}),s.positionB&&o.push({color:s.color,colorData:s.colorData,position:s.positionB})),!(o.length<2)&&o)}const c=/^(?:srgb|srgb-linear|lab|oklab|xyz|xyz-d50|xyz-d65|hsl|hwb|lch|oklch)$/i,u=/^(?:hsl|hwb|lch|oklch)$/i,p=/^(?:shorter|longer|increasing|decreasing)$/i,d=/^in$/i,v=/^hue$/i;function modifyGradientFunctionComponentValues(e,o=!1){const n=e.getName();if(!l.test(n))return!1;let s="srgb",r=null,a=null,h=null,T=null,f=null,m=[];{let o=0,n=e.value[o];for(;n&&!(t.isTokenNode(n)&&i.isTokenIdent(n.value)&&d.test(n.value[4].value));){if(t.isTokenNode(n)&&i.isTokenComma(n.value))return!1;o++,n=e.value[o]}for(r=n,o++,n=e.value[o];t.isCommentNode(n)||t.isWhitespaceNode(n);)o++,n=e.value[o];if(t.isTokenNode(n)&&i.isTokenIdent(n.value)&&c.test(n.value[4].value)){if(a)return!1;a=n,s=n.value[4].value,o++,n=e.value[o]}for(;t.isCommentNode(n)||t.isWhitespaceNode(n);)o++,n=e.value[o];if(t.isTokenNode(n)&&i.isTokenIdent(n.value)&&p.test(n.value[4].value)&&u.test(s)){if(h||!a)return!1;h=n,o++,n=e.value[o]}for(;t.isCommentNode(n)||t.isWhitespaceNode(n);)o++,n=e.value[o];if(t.isTokenNode(n)&&i.isTokenIdent(n.value)&&v.test(n.value[4].value)){if(T||!a||!h)return!1;T=n,o++,n=e.value[o]}for(;n&&(!t.isTokenNode(n)||!i.isTokenComma(n.value));)o++,n=e.value[o];if(f=n,!f)return!1;m=e.value.slice(o+1)}if(!a)return!1;if(h&&!T)return!1;if(T&&!h)return!1;const k=parseColorStops(m);if(!k)return!1;const g=interpolateColorsInColorStopsList(k,a,h,o);if(!g)return!1;const N=trim([...e.value.slice(0,e.value.indexOf(r)),...e.value.slice(e.value.indexOf(T||a)+1,e.value.indexOf(f))]);return N.length>0&&N.some((e=>!t.isCommentNode(e)))&&N.push(new t.TokenNode([i.TokenType.Comma,",",-1,-1,void 0]),new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]])),trim([...N,...trim(g)])}function trim(e){let o=0,i=e.length-1;for(let i=0;i<e.length;i++)if(!t.isWhitespaceNode(e[i])){o=i;break}for(let o=e.length-1;o>=0;o--)if(!t.isWhitespaceNode(e[o])){i=o;break}return e.slice(o,i+1)}const basePlugin=e=>({postcssPlugin:"postcss-gradients-interpolation-method",Declaration(n){if(!a.test(n.value))return;if(o.hasFallback(n))return;if(o.hasSupportsAtRuleAncestor(n,a))return;const s=i.tokenize({css:n.value}),r=t.stringify(t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(s),(e=>{if(!t.isFunctionNode(e))return;const o=modifyGradientFunctionComponentValues(e);o&&(e.value=o)})));if(r===n.value)return;const l=t.stringify(t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(s),(e=>{if(!t.isFunctionNode(e))return;const o=modifyGradientFunctionComponentValues(e,!0);o&&(e.value=o)})));n.cloneBefore({value:r}),r!==l&&n.cloneBefore({value:l}),e?.preserve||n.remove()}});basePlugin.postcss=!0;const postcssPlugin=o=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!0},o);return t.enableProgressiveCustomProperties?{postcssPlugin:"postcss-gradients-interpolation-method",plugins:[e(),basePlugin(t)]}:basePlugin(t)};postcssPlugin.postcss=!0,module.exports=postcssPlugin; diff --git a/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.d.ts b/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.d.ts deleted file mode 100644 index 26b20e2f..00000000 --- a/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { PluginCreator } from 'postcss'; - -/** postcss-gradients-interpolation-method plugin options */ -export declare type pluginOptions = { - /** Preserve the original notation. default: true */ - preserve?: boolean; - /** Enable "@csstools/postcss-progressive-custom-properties". default: true */ - enableProgressiveCustomProperties?: boolean; -}; - -declare const postcssPlugin: PluginCreator<pluginOptions>; -export default postcssPlugin; - -export { } diff --git a/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.mjs b/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.mjs deleted file mode 100644 index 70546984..00000000 --- a/node_modules/@csstools/postcss-gradients-interpolation-method/dist/index.mjs +++ /dev/null @@ -1 +0,0 @@ -import o from"@csstools/postcss-progressive-custom-properties";import{hasFallback as e,hasSupportsAtRuleAncestor as t}from"@csstools/utilities";import{WhitespaceNode as i,TokenNode as r,FunctionNode as n,isCommentNode as s,isWhitespaceNode as l,isTokenNode as a,stringify as c,replaceComponentValues as u,parseCommaSeparatedListOfComponentValues as p,isFunctionNode as v}from"@csstools/css-parser-algorithms";import{TokenType as f,isTokenComma as h,isTokenIdent as m,tokenize as g}from"@csstools/css-tokenizer";import{serializeP3 as d,color as w,colorDataFitsRGB_Gamut as D,serializeRGB as C,SyntaxFlag as b}from"@csstools/css-color-parser";const x=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i,W=/\bin\b/i,P={test:o=>x.test(o)&&W.test(o)},A=/^(repeating-)?(linear|radial|conic)-gradient$/i;function interpolateColorsInColorStopsList(o,e,t,s=!1){const l=[],a=[];for(let s=0;s<o.length-1;s++){const l=o[s],c=o[s+1];if(a.push(l),t||d(l.colorData,!1).toString()!==d(c.colorData,!1).toString()&&l.position.toString()!==c.position.toString())for(let o=1;o<=9;o++){const s=10*o;let u=[];t&&(u=[new i([[f.Whitespace," ",-1,-1,void 0]]),t,new i([[f.Whitespace," ",-1,-1,void 0]]),new r([f.Ident,"hue",-1,-1,{value:"hue"}])]);const p=new n([f.Function,"color-mix(",-1,-1,{value:"color-mix"}],[f.CloseParen,")",-1,-1,void 0],[new r([f.Ident,"in",-1,-1,{value:"in"}]),new i([[f.Whitespace," ",-1,-1,void 0]]),e,...u,new r([f.Comma,",",-1,-1,void 0]),new i([[f.Whitespace," ",-1,-1,void 0]]),l.color,new i([[f.Whitespace," ",-1,-1,void 0]]),new r([f.Percentage,100-s+"%",-1,-1,{value:100-s}]),new r([f.Comma,",",-1,-1,void 0]),new i([[f.Whitespace," ",-1,-1,void 0]]),c.color,new i([[f.Whitespace," ",-1,-1,void 0]]),new r([f.Percentage,`${s}%`,-1,-1,{value:s}])]),v=w(p);if(!v)return!1;a.push({colorData:v})}s===o.length-2&&a.push(c)}for(let o=0;o<a.length;o++)s&&!D(a[o].colorData)?a[o].color=d(a[o].colorData,!1):a[o].color=C(a[o].colorData,!1);for(let o=0;o<a.length;o++){const e=a[o];e.position?l.push(e.color,new i([[f.Whitespace," ",-1,-1,void 0]]),e.position):l.push(e.color),o!==a.length-1&&l.push(new r([f.Comma,",",-1,-1,void 0]),new i([[f.Whitespace," ",-1,-1,void 0]]))}return l}function parseColorStops(o){const e=[];let t={};for(let i=0;i<o.length;i++){const r=o[i];if(s(r)||l(r))continue;if(a(r)&&h(r.value)){if(t.color&&t.colorData&&t.positionA){e.push({color:t.color,colorData:t.colorData,position:t.positionA}),t.positionB&&e.push({color:t.color,colorData:t.colorData,position:t.positionB}),t={};continue}return!1}const n=w(r);if(n){if(t.color)return!1;if(n.syntaxFlags.has(b.Experimental))return!1;t.color=r,t.colorData=n}else{if(!t.color)return!1;if(t.positionA){if(!t.positionA||t.positionB)return!1;t.positionB=r}else t.positionA=r}}return!(!t.color||!t.positionA)&&(t.color&&t.colorData&&t.positionA&&(e.push({color:t.color,colorData:t.colorData,position:t.positionA}),t.positionB&&e.push({color:t.color,colorData:t.colorData,position:t.positionB})),!(e.length<2)&&e)}const B=/^(?:srgb|srgb-linear|lab|oklab|xyz|xyz-d50|xyz-d65|hsl|hwb|lch|oklch)$/i,S=/^(?:hsl|hwb|lch|oklch)$/i,y=/^(?:shorter|longer|increasing|decreasing)$/i,$=/^in$/i,k=/^hue$/i;function modifyGradientFunctionComponentValues(o,e=!1){const t=o.getName();if(!A.test(t))return!1;let n="srgb",c=null,u=null,p=null,v=null,g=null,d=[];{let e=0,t=o.value[e];for(;t&&!(a(t)&&m(t.value)&&$.test(t.value[4].value));){if(a(t)&&h(t.value))return!1;e++,t=o.value[e]}for(c=t,e++,t=o.value[e];s(t)||l(t);)e++,t=o.value[e];if(a(t)&&m(t.value)&&B.test(t.value[4].value)){if(u)return!1;u=t,n=t.value[4].value,e++,t=o.value[e]}for(;s(t)||l(t);)e++,t=o.value[e];if(a(t)&&m(t.value)&&y.test(t.value[4].value)&&S.test(n)){if(p||!u)return!1;p=t,e++,t=o.value[e]}for(;s(t)||l(t);)e++,t=o.value[e];if(a(t)&&m(t.value)&&k.test(t.value[4].value)){if(v||!u||!p)return!1;v=t,e++,t=o.value[e]}for(;t&&(!a(t)||!h(t.value));)e++,t=o.value[e];if(g=t,!g)return!1;d=o.value.slice(e+1)}if(!u)return!1;if(p&&!v)return!1;if(v&&!p)return!1;const w=parseColorStops(d);if(!w)return!1;const D=interpolateColorsInColorStopsList(w,u,p,e);if(!D)return!1;const C=trim([...o.value.slice(0,o.value.indexOf(c)),...o.value.slice(o.value.indexOf(v||u)+1,o.value.indexOf(g))]);return C.length>0&&C.some((o=>!s(o)))&&C.push(new r([f.Comma,",",-1,-1,void 0]),new i([[f.Whitespace," ",-1,-1,void 0]])),trim([...C,...trim(D)])}function trim(o){let e=0,t=o.length-1;for(let t=0;t<o.length;t++)if(!l(o[t])){e=t;break}for(let e=o.length-1;e>=0;e--)if(!l(o[e])){t=e;break}return o.slice(e,t+1)}const basePlugin=o=>({postcssPlugin:"postcss-gradients-interpolation-method",Declaration(i){if(!P.test(i.value))return;if(e(i))return;if(t(i,P))return;const r=g({css:i.value}),n=c(u(p(r),(o=>{if(!v(o))return;const e=modifyGradientFunctionComponentValues(o);e&&(o.value=e)})));if(n===i.value)return;const s=c(u(p(r),(o=>{if(!v(o))return;const e=modifyGradientFunctionComponentValues(o,!0);e&&(o.value=e)})));i.cloneBefore({value:n}),n!==s&&i.cloneBefore({value:s}),o?.preserve||i.remove()}});basePlugin.postcss=!0;const postcssPlugin=e=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!0},e);return t.enableProgressiveCustomProperties?{postcssPlugin:"postcss-gradients-interpolation-method",plugins:[o(),basePlugin(t)]}:basePlugin(t)};postcssPlugin.postcss=!0;export{postcssPlugin as default}; diff --git a/node_modules/@csstools/postcss-gradients-interpolation-method/package.json b/node_modules/@csstools/postcss-gradients-interpolation-method/package.json deleted file mode 100644 index ae7a1f0c..00000000 --- a/node_modules/@csstools/postcss-gradients-interpolation-method/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@csstools/postcss-gradients-interpolation-method", - "description": "Use interpolation methods in CSS gradient functions", - "version": "4.0.20", - "author": "Jonathan Neal <jonathantneal@hotmail.com>", - "license": "MIT-0", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/csstools" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/csstools" - } - ], - "engines": { - "node": "^14 || ^16 || >=18" - }, - "type": "module", - "main": "dist/index.cjs", - "module": "dist/index.mjs", - "exports": { - ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.mjs" - }, - "require": { - "default": "./dist/index.cjs" - } - } - }, - "files": [ - "CHANGELOG.md", - "LICENSE.md", - "README.md", - "dist" - ], - "dependencies": { - "@csstools/css-color-parser": "^2.0.4", - "@csstools/css-parser-algorithms": "^2.7.1", - "@csstools/css-tokenizer": "^2.4.1", - "@csstools/postcss-progressive-custom-properties": "^3.3.0", - "@csstools/utilities": "^1.0.0" - }, - "peerDependencies": { - "postcss": "^8.4" - }, - "scripts": {}, - "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-gradients-interpolation-method#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/csstools/postcss-plugins.git", - "directory": "plugins/postcss-gradients-interpolation-method" - }, - "bugs": "https://github.com/csstools/postcss-plugins/issues", - "keywords": [ - "color", - "color space interpolation", - "conic", - "css", - "gradients", - "hue interpolation method", - "interpolation", - "linear", - "postcss", - "postcss-plugin", - "radial", - "repeating", - "syntax" - ] -} |
