@csstools/postcss-gradient-stop-increments-experimental 1.0.7 → 1.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,27 +1,26 @@
1
1
  # Changes to PostCSS Gradient Stop Increments
2
2
 
3
- ### 1.0.7
3
+ ### 1.0.9
4
4
 
5
- _February 19, 2024_
5
+ _May 4, 2024_
6
6
 
7
- - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#260) (minor)
8
- - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.7`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#117) (patch)
7
+ - Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#230) (minor)
8
+ - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#262) (patch)
9
+ - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#121) (patch)
9
10
 
10
- ### 1.0.6
11
+ ### 1.0.8
11
12
 
12
- _December 31, 2023_
13
+ _March 13, 2024_
13
14
 
14
- - 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)
15
- - 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)
16
- - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.6`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#116) (patch)
15
+ - Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#224) (patch)
16
+ - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#261) (patch)
17
+ - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#120) (minor)
17
18
 
18
- ### 1.0.5
19
+ ### 1.0.7
19
20
 
20
- _December 15, 2023_
21
+ _February 19, 2024_
21
22
 
22
- - Fix type definitions
23
- - 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)
24
- - 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)
25
- - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.5`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#115) (patch)
23
+ - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#260) (minor)
24
+ - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.7`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#117) (patch)
26
25
 
27
26
  [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/experimental/postcss-gradient-stop-increments/CHANGELOG.md)
package/dist/index.cjs CHANGED
@@ -1 +1 @@
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,a=/^(repeating-)?(linear|radial|conic)-gradient$/i,i=/^(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 r=Object.assign({preserve:!1},n);return{postcssPlugin:"postcss-gradient-stop-increments",Declaration(n){if(!t.test(n.value))return;const s=o.tokenize({css:n.value});if(!s.find((e=>e[0]===o.TokenType.Delim&&"+"===e[4].value)))return;const u=e.stringify(e.replaceComponentValues(e.parseCommaSeparatedListOfComponentValues(s),(n=>{if(!e.isFunctionNode(n))return;const t=n.getName();if(!a.test(t))return;let r=null;for(let t=0;t<n.value.length;t++){const a=n.value[t];if(e.isTokenNode(a)&&a.value[0]===o.TokenType.Delim&&"+"===a.value[4].value){const i=a,s=t;for(;e.isCommentNode(n.value[t+1]);)t++;if(t++,isZeroOrNegative(n.value[t])){const a=new e.TokenNode([o.TokenType.Number,"0",-1,-1,{value:0,type:o.NumberType.Integer}]);n.value.splice(s,t-s+1,a),t=n.value.indexOf(a);continue}const u=incrementLengthNode(r,i,n.value[t]);n.value.splice(s,t-s+1,u),r=u,t=n.value.indexOf(u)}else(isNumericLargerThanZero(a)||e.isFunctionNode(a)&&i.test(a.getName()))&&(r=maxOfLastAndCurrentLengthNode(r,a))}})));u!==n.value&&(n.cloneBefore({value:u}),r?.preserve||n.remove())}}};function isNumericLargerThanZero(n){return!(!e.isTokenNode(n)||n.value[0]!==o.TokenType.Percentage&&n.value[0]!==o.TokenType.Dimension&&n.value[0]!==o.TokenType.Number||!(n.value[4].value>0))}function isZeroOrNegative(n){return!(!e.isTokenNode(n)||n.value[0]!==o.TokenType.Percentage&&n.value[0]!==o.TokenType.Dimension&&n.value[0]!==o.TokenType.Number||!(n.value[4].value<=0))}function incrementLengthNode(t,a,i){if(!t)return i;const r=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]]),a,new e.WhitespaceNode([[o.TokenType.Whitespace," ",-1,-1,void 0]]),i]),[[s]]=n.calcFromComponentValues([[r]]);return s}function maxOfLastAndCurrentLengthNode(t,a){if(!t)return a;const i=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]]),a]),[[r]]=n.calcFromComponentValues([[i]]);return r}creator.postcss=!0,module.exports=creator;
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;
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 i,TokenNode as s,FunctionNode as o,WhitespaceNode as l}from"@csstools/css-parser-algorithms";import{calcFromComponentValues as u}from"@csstools/css-calc";import{tokenize as c,TokenType as v,NumberType as m}from"@csstools/css-tokenizer";const f=/(repeating-)?(linear|radial|conic)-gradient\(/i,g=/^(repeating-)?(linear|radial|conic)-gradient$/i,d=/^(abs|acos|asin|atan|atan2|calc|clamp|cos|exp|hypot|log|max|min|mod|pow|rem|round|sign|sin|sqrt|tan)$/i,creator=o=>{const l=Object.assign({preserve:!1},o);return{postcssPlugin:"postcss-gradient-stop-increments",Declaration(o){if(!f.test(o.value))return;const u=c({css:o.value});if(!u.find((e=>e[0]===v.Delim&&"+"===e[4].value)))return;const p=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 o=e.value[n];if(r(o)&&o.value[0]===v.Delim&&"+"===o.value[4].value){const a=o,r=n;for(;i(e.value[n+1]);)n++;if(n++,isZeroOrNegative(e.value[n])){const t=new s([v.Number,"0",-1,-1,{value:0,type:m.Integer}]);e.value.splice(r,n-r+1,t),n=e.value.indexOf(t);continue}const l=incrementLengthNode(t,a,e.value[n]);e.value.splice(r,n-r+1,l),t=l,n=e.value.indexOf(l)}else(isNumericLargerThanZero(o)||a(o)&&d.test(o.getName()))&&(t=maxOfLastAndCurrentLengthNode(t,o))}})));p!==o.value&&(o.cloneBefore({value:p}),l?.preserve||o.remove())}}};function isNumericLargerThanZero(e){return!(!r(e)||e.value[0]!==v.Percentage&&e.value[0]!==v.Dimension&&e.value[0]!==v.Number||!(e.value[4].value>0))}function isZeroOrNegative(e){return!(!r(e)||e.value[0]!==v.Percentage&&e.value[0]!==v.Dimension&&e.value[0]!==v.Number||!(e.value[4].value<=0))}function incrementLengthNode(e,n,t){if(!e)return t;const a=new o([v.Function,"calc(",-1,-1,{value:"calc"}],[v.CloseParen,")",-1,-1,void 0],[e,new l([[v.Whitespace," ",-1,-1,void 0]]),n,new l([[v.Whitespace," ",-1,-1,void 0]]),t]),[[r]]=u([[a]]);return r}function maxOfLastAndCurrentLengthNode(e,n){if(!e)return n;const t=new o([v.Function,"max(",-1,-1,{value:"max"}],[v.CloseParen,")",-1,-1,void 0],[e,new s([v.Comma,",",-1,-1,void 0]),new l([[v.Whitespace," ",-1,-1,void 0]]),n]),[[a]]=u([[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 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};
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": "1.0.7",
4
+ "version": "1.0.9",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "Antonio Laguna",
@@ -48,9 +48,9 @@
48
48
  "dist"
49
49
  ],
50
50
  "dependencies": {
51
- "@csstools/css-calc": "^1.1.7",
52
- "@csstools/css-parser-algorithms": "^2.6.0",
53
- "@csstools/css-tokenizer": "^2.2.3"
51
+ "@csstools/css-calc": "^1.2.1",
52
+ "@csstools/css-parser-algorithms": "^2.6.2",
53
+ "@csstools/css-tokenizer": "^2.3.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "postcss": "^8.4"
@@ -58,7 +58,7 @@
58
58
  "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-gradient-stop-increments#readme",
59
59
  "repository": {
60
60
  "type": "git",
61
- "url": "https://github.com/csstools/postcss-plugins.git",
61
+ "url": "git+https://github.com/csstools/postcss-plugins.git",
62
62
  "directory": "experimental/postcss-gradient-stop-increments"
63
63
  },
64
64
  "bugs": "https://github.com/csstools/postcss-plugins/issues",