@react-pdf/stylesheet
Advanced tools
Comparing version 3.0.0 to 3.1.0
# @react-pdf/stylesheet | ||
## 3.1.0 | ||
### Minor Changes | ||
- [#1869](https://github.com/diegomura/react-pdf/pull/1869) [`5d2c308`](https://github.com/diegomura/react-pdf/commit/5d2c3088cf438a8abf1038b14a21117fecf59d57) Thanks [@diegomura](https://github.com/diegomura)! - feat: variable dpi | ||
### Patch Changes | ||
- Updated dependencies [[`1411d16`](https://github.com/diegomura/react-pdf/commit/1411d162e04ca237bad93729695c363fdf4bdbeb), [`4fadb48`](https://github.com/diegomura/react-pdf/commit/4fadb48983d7269452f89f80c7e341ece859aaee), [`ce8762f`](https://github.com/diegomura/react-pdf/commit/ce8762f6de5c796e69ec5a225c7f3ff9c619a960), [`5d2c308`](https://github.com/diegomura/react-pdf/commit/5d2c3088cf438a8abf1038b14a21117fecf59d57)]: | ||
- @react-pdf/types@2.1.0 | ||
## 3.0.0 | ||
@@ -4,0 +15,0 @@ |
@@ -5,6 +5,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var DPI = 72; // 72pt per inch. | ||
var MM_FACTOR = 1 / 25.4 * DPI; | ||
var CM_FACTOR = 1 / 2.54 * DPI; | ||
/** | ||
@@ -16,3 +13,2 @@ * Parses scalar value in value and unit pairs | ||
*/ | ||
var parseValue = function parseValue(value) { | ||
@@ -39,12 +35,15 @@ var match = /^(-?\d*\.?\d+)(in|mm|cm|pt|vh|vw|px)?$/g.exec(value); | ||
var scalar = parseValue(value); | ||
var dpi = container.dpi || 72; | ||
var mmFactor = 1 / 25.4 * dpi; | ||
var cmFactor = 1 / 2.54 * dpi; | ||
switch (scalar.unit) { | ||
case 'in': | ||
return scalar.value * DPI; | ||
return scalar.value * dpi; | ||
case 'mm': | ||
return scalar.value * MM_FACTOR; | ||
return scalar.value * mmFactor; | ||
case 'cm': | ||
return scalar.value * CM_FACTOR; | ||
return scalar.value * cmFactor; | ||
@@ -51,0 +50,0 @@ case 'vh': |
{ | ||
"name": "@react-pdf/stylesheet", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"license": "MIT", | ||
@@ -22,3 +22,3 @@ "description": "A styles engine for Node and the browser", | ||
"@react-pdf/fns": "1.0.0", | ||
"@react-pdf/types": "^2.0.9", | ||
"@react-pdf/types": "^2.1.0", | ||
"color-string": "^1.5.3", | ||
@@ -25,0 +25,0 @@ "hsl-to-hex": "^1.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30106
Updated@react-pdf/types@^2.1.0