@csstools/postcss-gradient-stop-increments-experimental 1.0.4 → 1.0.6

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,38 +1,28 @@
1
1
  # Changes to PostCSS Gradient Stop Increments
2
2
 
3
- ### 1.0.4
4
-
5
- _September 24, 2023_
6
-
7
- - Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#221) (patch)
8
- - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#232) (patch)
9
- - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#114) (patch)
10
-
11
- ### 1.0.3
3
+ ### 1.0.6
12
4
 
13
- _July 24, 2023_
5
+ _December 31, 2023_
14
6
 
15
- - Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#220) (minor)
16
- - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#231) (patch)
17
- - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#113) (patch)
7
+ - 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)
8
+ - 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)
9
+ - 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)
18
10
 
19
- ### 1.0.2
11
+ ### 1.0.5
20
12
 
21
- _July 3, 2023_
13
+ _December 15, 2023_
22
14
 
23
- - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#230) (minor)
24
- - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#112) (patch)
15
+ - Fix type definitions
16
+ - 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)
17
+ - 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)
18
+ - 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)
25
19
 
26
- ### 1.0.1
27
-
28
- _April 10, 2023_
29
-
30
- - Updated `@csstools/css-tokenizer` to `2.1.1` (patch)
31
- - Updated `@csstools/css-parser-algorithms` to `2.1.1` (patch)
32
- - Updated `@csstools/css-calc` to `1.1.1` (patch)
20
+ ### 1.0.4
33
21
 
34
- ### 1.0.0
22
+ _September 24, 2023_
35
23
 
36
- _March 21, 2023_
24
+ - Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#221) (patch)
25
+ - Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#232) (patch)
26
+ - Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#114) (patch)
37
27
 
38
- - Initial version
28
+ [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}),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;
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;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  import type { PluginCreator } from 'postcss';
2
+
3
+ declare const creator: PluginCreator<pluginOptions>;
4
+ export default creator;
5
+
2
6
  /** postcss-gradient-stop-increments plugin options */
3
- export type pluginOptions = {
7
+ export declare type pluginOptions = {
4
8
  /** Preserve the original notation. default: false */
5
9
  preserve?: boolean;
6
10
  };
7
- declare const creator: PluginCreator<pluginOptions>;
8
- export default creator;
11
+
12
+ export { }
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}),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};
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};
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",
4
+ "version": "1.0.6",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "Antonio Laguna",
@@ -27,15 +27,18 @@
27
27
  "engines": {
28
28
  "node": "^14 || ^16 || >=18"
29
29
  },
30
+ "type": "module",
30
31
  "main": "dist/index.cjs",
31
32
  "module": "dist/index.mjs",
32
- "types": "dist/index.d.ts",
33
33
  "exports": {
34
34
  ".": {
35
- "types": "./dist/index.d.ts",
36
- "import": "./dist/index.mjs",
37
- "require": "./dist/index.cjs",
38
- "default": "./dist/index.mjs"
35
+ "import": {
36
+ "types": "./dist/index.d.ts",
37
+ "default": "./dist/index.mjs"
38
+ },
39
+ "require": {
40
+ "default": "./dist/index.cjs"
41
+ }
39
42
  }
40
43
  },
41
44
  "files": [
@@ -45,24 +48,13 @@
45
48
  "dist"
46
49
  ],
47
50
  "dependencies": {
48
- "@csstools/css-calc": "^1.1.4",
49
- "@csstools/css-parser-algorithms": "^2.3.2",
50
- "@csstools/css-tokenizer": "^2.2.1"
51
+ "@csstools/css-calc": "^1.1.6",
52
+ "@csstools/css-parser-algorithms": "^2.5.0",
53
+ "@csstools/css-tokenizer": "^2.2.3"
51
54
  },
52
55
  "peerDependencies": {
53
56
  "postcss": "^8.4"
54
57
  },
55
- "devDependencies": {
56
- "@csstools/postcss-tape": "*"
57
- },
58
- "scripts": {
59
- "build": "rollup -c ../../rollup/default.mjs",
60
- "docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
61
- "lint": "node ../../.github/bin/format-package-json.mjs",
62
- "prepublishOnly": "npm run build && npm run test",
63
- "test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs",
64
- "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
65
- },
66
58
  "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-gradient-stop-increments#readme",
67
59
  "repository": {
68
60
  "type": "git",
@@ -72,13 +64,5 @@
72
64
  "bugs": "https://github.com/csstools/postcss-plugins/issues",
73
65
  "keywords": [
74
66
  "postcss-plugin"
75
- ],
76
- "csstools": {
77
- "exportName": "postcssGradientStopIncrementsExperimental",
78
- "humanReadableName": "PostCSS Gradient Stop Increments",
79
- "specUrl": "https://github.com/w3c/csswg-drafts/issues/8616"
80
- },
81
- "volta": {
82
- "extends": "../../package.json"
83
- }
67
+ ]
84
68
  }