@react-pdf/stylesheet 4.2.2 → 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -10,15 +10,6 @@ var colorString = require('color-string');
10
10
  var _extends = require('@babel/runtime/helpers/extends');
11
11
  var matchMedia = require('media-engine');
12
12
 
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- var parse__default = /*#__PURE__*/_interopDefaultLegacy(parse$1);
16
- var parseUnit__default = /*#__PURE__*/_interopDefaultLegacy(parseUnit);
17
- var hlsToHex__default = /*#__PURE__*/_interopDefaultLegacy(hlsToHex);
18
- var colorString__default = /*#__PURE__*/_interopDefaultLegacy(colorString);
19
- var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
20
- var matchMedia__default = /*#__PURE__*/_interopDefaultLegacy(matchMedia);
21
-
22
13
  // https://developer.mozilla.org/en-US/docs/Web/CSS/flex#values
23
14
 
24
15
  // TODO: change flex defaults to [0, 1, 'auto'] as in spec in next major release
@@ -49,6 +40,8 @@ var expandFlex = function expandFlex(key, value) {
49
40
  };
50
41
 
51
42
  /* eslint-disable no-plusplus */
43
+ // This file is ran directly with Node - needs to have .js extension
44
+ // eslint-disable-next-line import/extensions
52
45
  var BOX_MODEL_UNITS = 'px,in,mm,cm,pt,%,vw,vh';
53
46
  var logError = function logError(style, value) {
54
47
  console.error("\n @react-pdf/stylesheet parsing error:\n\n " + style + ": " + value + ",\n " + ' '.repeat(style.length + 2) + "^\n Unsupported " + style + " value format\n ");
@@ -69,7 +62,7 @@ var expandBoxModel = function expandBoxModel(_temp) {
69
62
  autoSupported = _ref$autoSupported === void 0 ? false : _ref$autoSupported;
70
63
  return function (model, value) {
71
64
  var _ref2;
72
- var nodes = parse__default["default"]("" + value);
65
+ var nodes = parse$1("" + value);
73
66
  var parts = [];
74
67
  for (var i = 0; i < nodes.length; i++) {
75
68
  var node = nodes[i];
@@ -84,7 +77,7 @@ var expandBoxModel = function expandBoxModel(_temp) {
84
77
  if (node.value === 'auto' && autoSupported) {
85
78
  parts.push(node.value);
86
79
  } else {
87
- var result = parseUnit__default["default"](node.value);
80
+ var result = parseUnit(node.value);
88
81
 
89
82
  // when unit isn't specified this condition is true
90
83
  if (result && BOX_MODEL_UNITS.includes(result.unit)) {
@@ -468,8 +461,8 @@ var isHsl = function isHsl(value) {
468
461
  * @returns {Object} transformed value
469
462
  */
470
463
  var parseRgb = function parseRgb(value) {
471
- var rgb = colorString__default["default"].get.rgb(value);
472
- return colorString__default["default"].to.hex(rgb);
464
+ var rgb = colorString.get.rgb(value);
465
+ return colorString.to.hex(rgb);
473
466
  };
474
467
 
475
468
  /**
@@ -479,8 +472,8 @@ var parseRgb = function parseRgb(value) {
479
472
  * @returns {Object} transformed value
480
473
  */
481
474
  var parseHsl = function parseHsl(value) {
482
- var hsl = colorString__default["default"].get.hsl(value).map(Math.round);
483
- var hex = hlsToHex__default["default"].apply(void 0, hsl);
475
+ var hsl = colorString.get.hsl(value).map(Math.round);
476
+ var hex = hlsToHex.apply(void 0, hsl);
484
477
  return hex.toUpperCase();
485
478
  };
486
479
 
@@ -740,9 +733,9 @@ var resolveMediaQueries = function resolveMediaQueries(container, styles) {
740
733
  var _extends2;
741
734
  if (/@media/.test(key)) {
742
735
  var _matchMedia;
743
- return _extends__default["default"]({}, acc, matchMedia__default["default"]((_matchMedia = {}, _matchMedia[key] = styles[key], _matchMedia), container));
736
+ return _extends({}, acc, matchMedia((_matchMedia = {}, _matchMedia[key] = styles[key], _matchMedia), container));
744
737
  }
745
- return _extends__default["default"]({}, acc, (_extends2 = {}, _extends2[key] = styles[key], _extends2));
738
+ return _extends({}, acc, (_extends2 = {}, _extends2[key] = styles[key], _extends2));
746
739
  }, {});
747
740
  };
748
741
 
@@ -760,7 +753,7 @@ var resolveStyles = function resolveStyles(container, style) {
760
753
  return fns.compose(transform(container), expand, computeMediaQueries, flatten)(style);
761
754
  };
762
755
 
763
- exports["default"] = resolveStyles;
756
+ exports.default = resolveStyles;
764
757
  exports.flatten = flatten;
765
758
  exports.processTransform = processTransform;
766
759
  exports.transformColor = transformColor;
package/lib/index.js CHANGED
@@ -36,6 +36,8 @@ var expandFlex = function expandFlex(key, value) {
36
36
  };
37
37
 
38
38
  /* eslint-disable no-plusplus */
39
+ // This file is ran directly with Node - needs to have .js extension
40
+ // eslint-disable-next-line import/extensions
39
41
  var BOX_MODEL_UNITS = 'px,in,mm,cm,pt,%,vw,vh';
40
42
  var logError = function logError(style, value) {
41
43
  console.error("\n @react-pdf/stylesheet parsing error:\n\n " + style + ": " + value + ",\n " + ' '.repeat(style.length + 2) + "^\n Unsupported " + style + " value format\n ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pdf/stylesheet",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "license": "MIT",
5
5
  "description": "A styles engine for Node and the browser",
6
6
  "author": "Diego Muracciole <diegomuracciole@gmail.com>",
@@ -21,14 +21,14 @@
21
21
  "directory": "packages/stylesheet"
22
22
  },
23
23
  "scripts": {
24
- "test": "NODE_OPTIONS=\"--experimental-vm-modules\" jest",
24
+ "test": "vitest",
25
25
  "build": "rimraf ./lib && rollup -c",
26
26
  "watch": "rimraf ./lib && rollup -c -w"
27
27
  },
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.20.13",
30
- "@react-pdf/fns": "2.1.0",
31
- "@react-pdf/types": "^2.4.0",
30
+ "@react-pdf/fns": "2.2.0",
31
+ "@react-pdf/types": "^2.4.1",
32
32
  "color-string": "^1.9.1",
33
33
  "hsl-to-hex": "^1.0.0",
34
34
  "media-engine": "^1.0.3",