@csstools/postcss-gradient-stop-increments-experimental 2.0.8 → 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 CHANGED
@@ -1,9 +1,13 @@
1
1
  # Changes to PostCSS Gradient Stop Increments
2
2
 
3
- ### 2.0.8
3
+ ### 3.0.0
4
4
 
5
- _April 19, 2025_
5
+ _January 14, 2026_
6
6
 
7
- - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`2.1.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#213) (patch)
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)
8
12
 
9
13
  [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/experimental/postcss-gradient-stop-increments/CHANGELOG.md)
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { PluginCreator } from 'postcss';
2
2
 
3
3
  declare const creator: PluginCreator<pluginOptions>;
4
4
  export default creator;
5
+ export { creator as 'module.exports' }
5
6
 
6
7
  /** postcss-gradient-stop-increments plugin options */
7
8
  export declare type pluginOptions = {
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 s,TokenNode as o,FunctionNode as i,WhitespaceNode as c}from"@csstools/css-parser-algorithms";import{calcFromComponentValues as l}from"@csstools/css-calc";import{tokenize as u,isTokenDelim as v,TokenType as m,NumberType as f,isTokenNumeric as d}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 l=u({css:i.value});if(!l.find((e=>v(e)&&"+"===e[4].value)))return;const d=e(n(t(l),(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(;s(e.value[n+1]);)n++;if(n++,isZeroOrNegative(e.value[n])){const t=new o([m.Number,"0",-1,-1,{value:0,type:f.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)}else(isNumericLargerThanZero(i)||a(i)&&h.test(i.getName()))&&(t=maxOfLastAndCurrentLengthNode(t,i))}})));d!==i.value&&(i.cloneBefore({value:d}),c?.preserve||i.remove())}}};function isNumericLargerThanZero(e){return!!(r(e)&&d(e.value)&&e.value[4].value>0)}function isZeroOrNegative(e){return!!(r(e)&&d(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]]=l([[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 o([m.Comma,",",-1,-1,void 0]),new c([[m.Whitespace," ",-1,-1,void 0]]),n]),[[a]]=l([[t]]);return a}creator.postcss=!0;export{creator as default};
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": "2.0.8",
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": ">=18"
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
- "import": {
36
- "types": "./dist/index.d.ts",
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": "^2.1.3",
52
- "@csstools/css-parser-algorithms": "^3.0.4",
53
- "@csstools/css-tokenizer": "^3.0.3"
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;