@csstools/postcss-gradient-stop-increments-experimental 1.0.0 → 1.0.2
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 +18 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +15 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changes to PostCSS Gradient Stop Increments
|
|
2
2
|
|
|
3
|
-
### 1.0.
|
|
3
|
+
### 1.0.2
|
|
4
|
+
|
|
5
|
+
_July 3, 2023_
|
|
6
|
+
|
|
7
|
+
- Updated [`@csstools/css-parser-algorithms`](/packages/css-parser-algorithms) to [`2.3.0`](/packages/css-parser-algorithms/CHANGELOG.md#230) (minor)
|
|
8
|
+
- Updated [`@csstools/css-calc`](/packages/css-calc) to [`1.1.2`](/packages/css-calc/CHANGELOG.md#112) (patch)
|
|
9
|
+
|
|
10
|
+
### 1.0.1
|
|
11
|
+
|
|
12
|
+
_April 10, 2023_
|
|
13
|
+
|
|
14
|
+
- Updated `@csstools/css-tokenizer` to `2.1.1` (patch)
|
|
15
|
+
- Updated `@csstools/css-parser-algorithms` to `2.1.1` (patch)
|
|
16
|
+
- Updated `@csstools/css-calc` to `1.1.1` (patch)
|
|
17
|
+
|
|
18
|
+
### 1.0.0
|
|
19
|
+
|
|
20
|
+
_March 21, 2023_
|
|
4
21
|
|
|
5
22
|
- Initial version
|
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
|
|
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}),null!=r&&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;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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}),null!=l&&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};
|
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.2",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Antonio Laguna",
|
|
@@ -14,10 +14,16 @@
|
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
16
|
"license": "CC0-1.0",
|
|
17
|
-
"funding":
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
"funding": [
|
|
18
|
+
{
|
|
19
|
+
"type": "github",
|
|
20
|
+
"url": "https://github.com/sponsors/csstools"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"type": "opencollective",
|
|
24
|
+
"url": "https://opencollective.com/csstools"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
21
27
|
"engines": {
|
|
22
28
|
"node": "^14 || ^16 || >=18"
|
|
23
29
|
},
|
|
@@ -39,9 +45,9 @@
|
|
|
39
45
|
"dist"
|
|
40
46
|
],
|
|
41
47
|
"dependencies": {
|
|
42
|
-
"@csstools/css-calc": "1.
|
|
43
|
-
"@csstools/css-parser-algorithms": "2.0
|
|
44
|
-
"@csstools/css-tokenizer": "^2.1.
|
|
48
|
+
"@csstools/css-calc": "^1.1.2",
|
|
49
|
+
"@csstools/css-parser-algorithms": "^2.3.0",
|
|
50
|
+
"@csstools/css-tokenizer": "^2.1.1"
|
|
45
51
|
},
|
|
46
52
|
"peerDependencies": {
|
|
47
53
|
"postcss": "^8.4"
|
|
@@ -61,7 +67,7 @@
|
|
|
61
67
|
"repository": {
|
|
62
68
|
"type": "git",
|
|
63
69
|
"url": "https://github.com/csstools/postcss-plugins.git",
|
|
64
|
-
"directory": "
|
|
70
|
+
"directory": "experimental/postcss-gradient-stop-increments"
|
|
65
71
|
},
|
|
66
72
|
"bugs": "https://github.com/csstools/postcss-plugins/issues",
|
|
67
73
|
"keywords": [
|