Gathering detailed insights and metrics for css-calc-transform
Gathering detailed insights and metrics for css-calc-transform
Gathering detailed insights and metrics for css-calc-transform
Gathering detailed insights and metrics for css-calc-transform
Tiny Javascript library to transform CSS properties with calc() function values to pixels based on window and element dimensions.
npm install css-calc-transform
Typescript
Module System
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
12 Stars
266 Commits
1 Forks
2 Watchers
8 Branches
1 Contributors
Updated on May 27, 2025
Latest Version
1.1.0
Package Id
css-calc-transform@1.1.0
Unpacked Size
329.49 kB
Size
114.66 kB
File Count
22
Published on
Feb 25, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Tiny Javascript library to transform CSS properties with CSS calc() function values to pixels based on window and element dimensions.
1yarn add --save css-calc-transform
or
1npm install --save css-calc-transform
1import { transform } from "css-calc-transform"; 2 3transform({ 4 prop: "width", 5 value: "calc(10px + (100px / 3.5))" 6}); 7 8↓ ↓ ↓ ↓ ↓ ↓ 9 1038.57142857142857
1import { transform } from "css-calc-transform"; 2 3const parentElementDimensions = { 4 width: 480, 5 height: 100 6}; 7 8transform({ 9 prop: "width", 10 value: "calc(100% - 10px)", 11 parent: parentElementDimensions 12}); 13 14↓ ↓ ↓ ↓ ↓ ↓ 15 16470
1import { transform } from "css-calc-transform"; 2 3const windowDimensions = { 4 width: 480, 5 height: 640 6}; 7 8transform({ 9 prop: "height", 10 value: "calc(50vh + 10px)", 11 win: windowDimensions 12}); 13 14↓ ↓ ↓ ↓ ↓ ↓ 15 16330
1import { transform } from "css-calc-transform"; 2 3transform({ 4 prop: "fontSize", 5 value: "calc(2rem + 1px)", 6}); 7 8↓ ↓ ↓ ↓ ↓ ↓ 9 1033
When em units are used on font-size, the size is relative to the font-size of the parent.
When used on other properties, it’s relative to the font-size of the element itself.
https://www.digitalocean.com/community/tutorials/css-rem-vs-em-units
1import { transform } from "css-calc-transform"; 2 3transform({ 4 prop: "fontSize", 5 value: "calc(2em + 1px)", 6 parent: { 7 font: { 8 size: 16 9 } 10 } 11}); 12 13↓ ↓ ↓ ↓ ↓ ↓ 14 1533
1import { transform } from "css-calc-transform"; 2 3transform({ 4 prop: "height", 5 value: "calc(10px + 2em)", 6 font: { 7 size: 16 8 } 9}); 10 11↓ ↓ ↓ ↓ ↓ ↓ 12 1342
1import { transform } from "css-calc-transform"; 2 3transform({ 4 prop: "height", 5 value: "calc(min(2px, 3px) + clamp(100px, 150px, 200px) + max(1px, 2px))", 6}); 7 8↓ ↓ ↓ ↓ ↓ ↓ 9 10154
For more examples, please have a look at the tests.
eval()
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
9 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
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