@flourish/pocket-knife
Advanced tools
Comparing version
{ | ||
"name": "@flourish/pocket-knife", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Flourish module with handy tools", | ||
@@ -15,3 +15,3 @@ "main": "pocket-knife.js", | ||
"author": "Kiln Enterprises Ltd", | ||
"license": "UNLICENSED", | ||
"license": "https://flourish.studio/terms/fcl/", | ||
"devDependencies": { | ||
@@ -18,0 +18,0 @@ "@flourish/eslint-plugin-flourish": "^0.7.2", |
@@ -39,2 +39,4 @@ # Flourish pocket knife 🇨🇭 | ||
### remToPx(rem) | ||
Converts value specified in rems to px | ||
@@ -41,0 +43,0 @@ ### wrapStringToLines(label, label_styles, text_max_lines, max_width) |
@@ -0,1 +1,7 @@ | ||
### 0.10.0 | ||
* Add `remToPx()` | ||
### 0.9.1 | ||
* Update module license | ||
### 0.9.0 | ||
@@ -2,0 +8,0 @@ * Add `getTextDimensions` and `getTextHeight` |
import { color } from "d3-color"; | ||
import { set as d3_set } from "d3-collection"; | ||
function remToPx(rem) { | ||
var window_width, base_size; | ||
if (window.innerWidth !== window_width) { | ||
window_width = window.innerWidth; | ||
base_size = parseFloat(getComputedStyle(document.documentElement).fontSize); | ||
} | ||
return rem * base_size; | ||
} | ||
var getTextDimensions = (function() { | ||
@@ -136,2 +145,2 @@ var context = document.createElement("canvas").getContext("2d"); | ||
export { getTextDimensions, getTextWidth, getTextHeight, isImage, isPale, isUrl, hexToColor, hexToRgba, wrapStringToLines, getUniqueValuesFromBinding }; | ||
export { remToPx, getTextDimensions, getTextWidth, getTextHeight, isImage, isPale, isUrl, hexToColor, hexToRgba, wrapStringToLines, getUniqueValuesFromBinding }; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
9032
4.61%154
5.48%52
4%