@csstools/postcss-gradient-stop-increments-experimental 1.0.9 → 1.0.11
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 +15 -14
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
# Changes to PostCSS Gradient Stop Increments
|
|
2
2
|
|
|
3
|
-
### 1.0.
|
|
3
|
+
### 1.0.11
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
_June 29, 2024_
|
|
6
6
|
|
|
7
|
-
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.
|
|
8
|
-
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.
|
|
9
|
-
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.
|
|
7
|
+
- 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)
|
|
8
|
+
- 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)
|
|
9
|
+
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#123) (patch)
|
|
10
10
|
|
|
11
|
-
### 1.0.
|
|
11
|
+
### 1.0.10
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
_May 4, 2024_
|
|
14
14
|
|
|
15
|
-
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.
|
|
16
|
-
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.
|
|
17
|
-
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.
|
|
15
|
+
- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#231) (patch)
|
|
16
|
+
- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.6.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#263) (patch)
|
|
17
|
+
- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.2.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#122) (patch)
|
|
18
18
|
|
|
19
|
-
### 1.0.
|
|
19
|
+
### 1.0.9
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
_May 4, 2024_
|
|
22
22
|
|
|
23
|
-
- Updated [`@csstools/css-
|
|
24
|
-
- Updated [`@csstools/css-
|
|
23
|
+
- 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)
|
|
24
|
+
- 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)
|
|
25
|
+
- 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)
|
|
25
26
|
|
|
26
27
|
[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,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;
|
|
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 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 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.
|
|
4
|
+
"version": "1.0.11",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Antonio Laguna",
|
|
@@ -48,13 +48,14 @@
|
|
|
48
48
|
"dist"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@csstools/css-calc": "^1.2.
|
|
52
|
-
"@csstools/css-parser-algorithms": "^2.
|
|
53
|
-
"@csstools/css-tokenizer": "^2.3.
|
|
51
|
+
"@csstools/css-calc": "^1.2.3",
|
|
52
|
+
"@csstools/css-parser-algorithms": "^2.7.0",
|
|
53
|
+
"@csstools/css-tokenizer": "^2.3.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"postcss": "^8.4"
|
|
57
57
|
},
|
|
58
|
+
"scripts": {},
|
|
58
59
|
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-gradient-stop-increments#readme",
|
|
59
60
|
"repository": {
|
|
60
61
|
"type": "git",
|