@csstools/postcss-gradient-stop-increments-experimental 2.0.9 → 3.0.0
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 +7 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/package.json +7 -14
- package/dist/index.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# Changes to PostCSS Gradient Stop Increments
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### 3.0.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
_January 14, 2026_
|
|
6
6
|
|
|
7
|
-
- Updated
|
|
8
|
-
-
|
|
9
|
-
- Updated [`@csstools/css-
|
|
7
|
+
- Updated: Support for Node `20.19.0` or later (major).
|
|
8
|
+
- Removed: `commonjs` API. In supported Node versions `require(esm)` will work without needing to make code changes.
|
|
9
|
+
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`4.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#400) (major)
|
|
10
|
+
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`4.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#400) (major)
|
|
11
|
+
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#300) (major)
|
|
10
12
|
|
|
11
13
|
[Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/experimental/postcss-gradient-stop-increments/CHANGELOG.md)
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stringify as e,replaceComponentValues as n,parseCommaSeparatedListOfComponentValues as t,isFunctionNode as a,isTokenNode as r,isCommentNode as
|
|
1
|
+
import{stringify as e,replaceComponentValues as n,parseCommaSeparatedListOfComponentValues as t,isFunctionNode as a,isTokenNode as r,isCommentNode as o,TokenNode as s,FunctionNode as i,WhitespaceNode as c}from"@csstools/css-parser-algorithms";import{calcFromComponentValues as u}from"@csstools/css-calc";import{tokenize as l,isTokenDelim as v,TokenType as m,NumberType as d,isTokenNumeric as f}from"@csstools/css-tokenizer";const p=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i,g=/^(?:repeating-)?(?:linear|radial|conic)-gradient$/i,h=/^(?:abs|acos|asin|atan|atan2|calc|clamp|cos|exp|hypot|log|max|min|mod|pow|rem|round|sign|sin|sqrt|tan)$/i,creator=i=>{const c=Object.assign({preserve:!1},i);return{postcssPlugin:"postcss-gradient-stop-increments",Declaration(i){if(!p.test(i.value))return;const u=l({css:i.value});if(!u.find(e=>v(e)&&"+"===e[4].value))return;const f=e(n(t(u),e=>{if(!a(e))return;const n=e.getName();if(!g.test(n))return;let t=null;for(let n=0;n<e.value.length;n++){const i=e.value[n];if(r(i)&&v(i.value)&&"+"===i.value[4].value){const a=i,r=n;for(;o(e.value[n+1]);)n++;if(n++,isZeroOrNegative(e.value[n])){const t=new s([m.Number,"0",-1,-1,{value:0,type:d.Integer}]);e.value.splice(r,n-r+1,t),n=e.value.indexOf(t);continue}const c=incrementLengthNode(t,a,e.value[n]);e.value.splice(r,n-r+1,c),t=c,n=e.value.indexOf(c);continue}isNumericLargerThanZero(i)?t=maxOfLastAndCurrentLengthNode(t,i):a(i)&&h.test(i.getName())&&(t=maxOfLastAndCurrentLengthNode(t,i))}}));f!==i.value&&(i.cloneBefore({value:f}),c?.preserve||i.remove())}}};function isNumericLargerThanZero(e){return!!(r(e)&&f(e.value)&&e.value[4].value>0)}function isZeroOrNegative(e){return!!(r(e)&&f(e.value)&&e.value[4].value<=0)}function incrementLengthNode(e,n,t){if(!e)return t;const a=new i([m.Function,"calc(",-1,-1,{value:"calc"}],[m.CloseParen,")",-1,-1,void 0],[e,new c([[m.Whitespace," ",-1,-1,void 0]]),n,new c([[m.Whitespace," ",-1,-1,void 0]]),t]),[[r]]=u([[a]]);return r}function maxOfLastAndCurrentLengthNode(e,n){if(!e)return n;const t=new i([m.Function,"max(",-1,-1,{value:"max"}],[m.CloseParen,")",-1,-1,void 0],[e,new s([m.Comma,",",-1,-1,void 0]),new c([[m.Whitespace," ",-1,-1,void 0]]),n]),[[a]]=u([[t]]);return a}creator.postcss=!0;export{creator as default,creator as"module.exports"};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csstools/postcss-gradient-stop-increments-experimental",
|
|
3
3
|
"description": "Increment CSS gradient stops",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Antonio Laguna",
|
|
@@ -25,20 +25,13 @@
|
|
|
25
25
|
}
|
|
26
26
|
],
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
28
|
+
"node": ">=20.19.0"
|
|
29
29
|
},
|
|
30
30
|
"type": "module",
|
|
31
|
-
"main": "dist/index.cjs",
|
|
32
|
-
"module": "dist/index.mjs",
|
|
33
31
|
"exports": {
|
|
34
32
|
".": {
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
"default": "./dist/index.mjs"
|
|
38
|
-
},
|
|
39
|
-
"require": {
|
|
40
|
-
"default": "./dist/index.cjs"
|
|
41
|
-
}
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.mjs"
|
|
42
35
|
}
|
|
43
36
|
},
|
|
44
37
|
"files": [
|
|
@@ -48,9 +41,9 @@
|
|
|
48
41
|
"dist"
|
|
49
42
|
],
|
|
50
43
|
"dependencies": {
|
|
51
|
-
"@csstools/css-calc": "^
|
|
52
|
-
"@csstools/css-parser-algorithms": "^
|
|
53
|
-
"@csstools/css-tokenizer": "^
|
|
44
|
+
"@csstools/css-calc": "^3.0.0",
|
|
45
|
+
"@csstools/css-parser-algorithms": "^4.0.0",
|
|
46
|
+
"@csstools/css-tokenizer": "^4.0.0"
|
|
54
47
|
},
|
|
55
48
|
"peerDependencies": {
|
|
56
49
|
"postcss": "^8.4"
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("@csstools/css-parser-algorithms"),n=require("@csstools/css-calc"),o=require("@csstools/css-tokenizer");const t=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i,i=/^(?:repeating-)?(?:linear|radial|conic)-gradient$/i,s=/^(?:abs|acos|asin|atan|atan2|calc|clamp|cos|exp|hypot|log|max|min|mod|pow|rem|round|sign|sin|sqrt|tan)$/i,creator=n=>{const a=Object.assign({preserve:!1},n);return{postcssPlugin:"postcss-gradient-stop-increments",Declaration(n){if(!t.test(n.value))return;const r=o.tokenize({css:n.value});if(!r.find((e=>o.isTokenDelim(e)&&"+"===e[4].value)))return;const c=e.stringify(e.replaceComponentValues(e.parseCommaSeparatedListOfComponentValues(r),(n=>{if(!e.isFunctionNode(n))return;const t=n.getName();if(!i.test(t))return;let a=null;for(let t=0;t<n.value.length;t++){const i=n.value[t];if(e.isTokenNode(i)&&o.isTokenDelim(i.value)&&"+"===i.value[4].value){const s=i,r=t;for(;e.isCommentNode(n.value[t+1]);)t++;if(t++,isZeroOrNegative(n.value[t])){const i=new e.TokenNode([o.TokenType.Number,"0",-1,-1,{value:0,type:o.NumberType.Integer}]);n.value.splice(r,t-r+1,i),t=n.value.indexOf(i);continue}const c=incrementLengthNode(a,s,n.value[t]);n.value.splice(r,t-r+1,c),a=c,t=n.value.indexOf(c)}else(isNumericLargerThanZero(i)||e.isFunctionNode(i)&&s.test(i.getName()))&&(a=maxOfLastAndCurrentLengthNode(a,i))}})));c!==n.value&&(n.cloneBefore({value:c}),a?.preserve||n.remove())}}};function isNumericLargerThanZero(n){return!!(e.isTokenNode(n)&&o.isTokenNumeric(n.value)&&n.value[4].value>0)}function isZeroOrNegative(n){return!!(e.isTokenNode(n)&&o.isTokenNumeric(n.value)&&n.value[4].value<=0)}function incrementLengthNode(t,i,s){if(!t)return s;const a=new e.FunctionNode([o.TokenType.Function,"calc(",-1,-1,{value:"calc"}],[o.TokenType.CloseParen,")",-1,-1,void 0],[t,new e.WhitespaceNode([[o.TokenType.Whitespace," ",-1,-1,void 0]]),i,new e.WhitespaceNode([[o.TokenType.Whitespace," ",-1,-1,void 0]]),s]),[[r]]=n.calcFromComponentValues([[a]]);return r}function maxOfLastAndCurrentLengthNode(t,i){if(!t)return i;const s=new e.FunctionNode([o.TokenType.Function,"max(",-1,-1,{value:"max"}],[o.TokenType.CloseParen,")",-1,-1,void 0],[t,new e.TokenNode([o.TokenType.Comma,",",-1,-1,void 0]),new e.WhitespaceNode([[o.TokenType.Whitespace," ",-1,-1,void 0]]),i]),[[a]]=n.calcFromComponentValues([[s]]);return a}creator.postcss=!0,module.exports=creator;
|