Gathering detailed insights and metrics for @csstools/postcss-trigonometric-functions
Gathering detailed insights and metrics for @csstools/postcss-trigonometric-functions
PostCSS Tools and Plugins
npm install @csstools/postcss-trigonometric-functions
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.8
Supply Chain
95.7
Quality
90.1
Maintenance
100
Vulnerability
100
License
CSS (43.37%)
JavaScript (30.22%)
TypeScript (22.76%)
HTML (3.06%)
Nunjucks (0.48%)
Shell (0.1%)
Total Downloads
415,027,052
Last Day
758,838
Last Week
3,933,199
Last Month
13,877,957
Last Year
182,311,056
927 Stars
4,162 Commits
73 Forks
12 Watching
5 Branches
131 Contributors
Minified
Minified + Gzipped
Latest Version
4.0.6
Package Id
@csstools/postcss-trigonometric-functions@4.0.6
Unpacked Size
8.84 kB
Size
3.27 kB
File Count
7
NPM Version
10.9.0
Node Version
22.12.0
Publised On
27 Dec 2024
Cumulative downloads
Total Downloads
Last day
-2.9%
758,838
Compared to previous day
Last week
-0.8%
3,933,199
Compared to previous week
Last month
-10.1%
13,877,957
Compared to previous month
Last year
7.7%
182,311,056
Compared to previous year
1
npm install @csstools/postcss-trigonometric-functions --save-dev
PostCSS Trigonometric Functions lets you use sin
, cos
, tan
, asin
, acos
, atan
and atan2
to be able to compute trigonometric relationships following the CSS Values 4 specification.
1.trigonometry { 2 line-height: sin(pi / 4); 3 line-height: cos(.125turn); 4 line-height: tan(50grad); 5 transform: rotate(asin(-1)); 6 transform: rotate(asin(sin(30deg + 1.0471967rad))); 7 transform: rotate(acos(-1)); 8 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 9 transform: rotate(atan(infinity)); 10 transform: rotate(atan(e - 2.7182818284590452354)); 11 transform: rotate(atan2(-infinity,-infinity)); 12 transform: rotate(atan2(-infinity,infinity)); 13 transform: rotate(atan2(-infinity,infinity)); 14 transform: rotate(atan2(90, 15)); 15} 16 17/* becomes */ 18 19.trigonometry { 20 line-height: 0.70711; 21 line-height: 0.70711; 22 line-height: 1; 23 transform: rotate(-90deg); 24 transform: rotate(89.99995deg); 25 transform: rotate(180deg); 26 transform: rotate(0deg); 27 transform: rotate(90deg); 28 transform: rotate(0deg); 29 transform: rotate(-135deg); 30 transform: rotate(-45deg); 31 transform: rotate(-45deg); 32 transform: rotate(80.53768deg); 33}
Add PostCSS Trigonometric Functions to your project:
1npm install postcss @csstools/postcss-trigonometric-functions --save-dev
Use it as a PostCSS plugin:
1const postcss = require('postcss'); 2const postcssTrigonometricFunctions = require('@csstools/postcss-trigonometric-functions'); 3 4postcss([ 5 postcssTrigonometricFunctions(/* pluginOptions */) 6]).process(YOUR_CSS /*, processOptions */);
Given the dynamic nature of custom properties it's impossible to know what the variable value is, which means the plugin can't compute a final value for the stylesheet.
Because of that, any usage that contains a var
is skipped.
PostCSS Trigonometric Functions lets you use different special units that are within the spec and computed at run time to be able to calculate the result of the trigonometric function.
The following units are supported:
pi
: Computes to Math.PI
which is 3.141592653589793
e
: Computes to Math.E
which is 2.718281828459045
infinity
, -infinity
: Compute to Infinity
and -Infinity
respectively. Note that the usage is case insensitive so InFiNiTy
is a valid value.Some calculations (such as sin(-infinity)
) might return NaN
as per the spec. Given that NaN
can't be replaced with a value that's useful to CSS it is left as is, as the result will be effectively ignored by the browser.
The preserve
option determines whether the original notation
is preserved. By default, it is not preserved.
1postcssTrigonometricFunctions({ preserve: true })
1.trigonometry { 2 line-height: sin(pi / 4); 3 line-height: cos(.125turn); 4 line-height: tan(50grad); 5 transform: rotate(asin(-1)); 6 transform: rotate(asin(sin(30deg + 1.0471967rad))); 7 transform: rotate(acos(-1)); 8 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 9 transform: rotate(atan(infinity)); 10 transform: rotate(atan(e - 2.7182818284590452354)); 11 transform: rotate(atan2(-infinity,-infinity)); 12 transform: rotate(atan2(-infinity,infinity)); 13 transform: rotate(atan2(-infinity,infinity)); 14 transform: rotate(atan2(90, 15)); 15} 16 17/* becomes */ 18 19.trigonometry { 20 line-height: 0.70711; 21 line-height: sin(pi / 4); 22 line-height: 0.70711; 23 line-height: cos(.125turn); 24 line-height: 1; 25 line-height: tan(50grad); 26 transform: rotate(-90deg); 27 transform: rotate(asin(-1)); 28 transform: rotate(89.99995deg); 29 transform: rotate(asin(sin(30deg + 1.0471967rad))); 30 transform: rotate(180deg); 31 transform: rotate(acos(-1)); 32 transform: rotate(0deg); 33 transform: rotate(acos(cos(0 / 2 + 1 - 1))); 34 transform: rotate(90deg); 35 transform: rotate(atan(infinity)); 36 transform: rotate(0deg); 37 transform: rotate(atan(e - 2.7182818284590452354)); 38 transform: rotate(-135deg); 39 transform: rotate(atan2(-infinity,-infinity)); 40 transform: rotate(-45deg); 41 transform: rotate(atan2(-infinity,infinity)); 42 transform: rotate(-45deg); 43 transform: rotate(atan2(-infinity,infinity)); 44 transform: rotate(80.53768deg); 45 transform: rotate(atan2(90, 15)); 46}
No vulnerabilities found.
Reason
30 commit(s) and 10 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
SAST tool detected but not run on all commits
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-01-20
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More