Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-pdf/stylesheet

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf/stylesheet - npm Package Compare versions

Comparing version 5.0.1 to 5.1.0

39

lib/index.js

@@ -1,2 +0,2 @@

import { compose, castArray } from '@react-pdf/fns';
import { compose, castArray, matchPercent } from '@react-pdf/fns';
import parse$1 from 'postcss-value-parser/lib/parse.js';

@@ -423,3 +423,3 @@ import parseUnit from 'postcss-value-parser/lib/unit.js';

const parseValue = value => {
const match = /^(-?\d*\.?\d+)(in|mm|cm|pt|vh|vw|px)?$/g.exec(value);
const match = /^(-?\d*\.?\d+)(in|mm|cm|pt|vh|vw|px|rem)?$/g.exec(value);
return match ? {

@@ -447,2 +447,4 @@ value: parseFloat(match[1]),

switch (scalar.unit) {
case 'rem':
return scalar.value * (container.remBase || 18);
case 'in':

@@ -647,2 +649,20 @@ return scalar.value * dpi;

/* eslint-disable no-restricted-globals */
const processLineHeight = (value, styles) => {
if (value === '') return value;
const {
fontSize = 18
} = styles;
// Percent values: use this number multiplied by the element's font size
const {
percent
} = matchPercent(value) || {};
if (percent) return percent * fontSize;
// Unitless values: use this number multiplied by the element's font size
return isNaN(value) ? value : value * fontSize;
};
const matchNumber = value => typeof value === 'string' && /^-?\d*\.?\d*$/.test(value);

@@ -677,2 +697,3 @@ const castFloat = value => {

fontWeight: processFontWeight,
lineHeight: processLineHeight,
objectPositionX: transformObjectPosition,

@@ -683,4 +704,4 @@ objectPositionY: transformObjectPosition,

};
const transformStyle = (key, value, container) => {
const result = handlers[key] ? handlers[key](value) : value;
const transformStyle = (key, value, styles, container) => {
const result = handlers[key] ? handlers[key](value, styles) : value;
return transformColor(transformUnit(container, castFloat(result)));

@@ -701,10 +722,10 @@ };

*/
const transform = container => style => {
if (!style) return style;
const propsArray = Object.keys(style);
const transform = container => styles => {
if (!styles) return styles;
const propsArray = Object.keys(styles);
const resolvedStyle = {};
for (let i = 0; i < propsArray.length; i += 1) {
const key = propsArray[i];
const value = style[key];
const transformed = transformStyle(key, value, container);
const value = styles[key];
const transformed = transformStyle(key, value, styles, container);
resolvedStyle[key] = transformed;

@@ -711,0 +732,0 @@ }

{
"name": "@react-pdf/stylesheet",
"version": "5.0.1",
"version": "5.1.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "A styles engine for Node and the browser",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc