@react-pdf/stylesheet 2.0.12 → 3.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # @react-pdf/stylesheet
2
+
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#1829](https://github.com/diegomura/react-pdf/pull/1829) [`5458a00`](https://github.com/diegomura/react-pdf/commit/5458a00979d883341c6df094243cae859344d2b9) Thanks [@diegomura](https://github.com/diegomura)! - refactor: remove ramda from stylesheet package
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1838](https://github.com/diegomura/react-pdf/pull/1838) [`9bdb5c9`](https://github.com/diegomura/react-pdf/commit/9bdb5c934a822340754cd4c892d399f91f6218de) Thanks [@diegomura](https://github.com/diegomura)! - feat: create fns package
12
+
13
+ - Updated dependencies [[`9bdb5c9`](https://github.com/diegomura/react-pdf/commit/9bdb5c934a822340754cd4c892d399f91f6218de), [`fe0f214`](https://github.com/diegomura/react-pdf/commit/fe0f214dbbf2f632b852ebfe65f886ecc4dd6953)]:
14
+ - @react-pdf/fns@1.0.0
15
+ - @react-pdf/types@2.0.9
16
+
17
+ ## 2.1.0
18
+
19
+ ### Minor Changes
20
+
21
+ - [#1535](https://github.com/diegomura/react-pdf/pull/1535) [`1f0eb6e`](https://github.com/diegomura/react-pdf/commit/1f0eb6e0d4e75480de6745a204924d5075859db7) Thanks [@jeetiss](https://github.com/jeetiss)! - fixed `margin: auto` parsing
22
+
23
+ * [#1654](https://github.com/diegomura/react-pdf/pull/1654) [`ccf3bf2`](https://github.com/diegomura/react-pdf/commit/ccf3bf22867a9bd49668cdd3543ec32492a40e4b) Thanks [@jeetiss](https://github.com/jeetiss)! - added `@babel/runtime` to dependencies
24
+
25
+ ### Patch Changes
26
+
27
+ - [#1581](https://github.com/diegomura/react-pdf/pull/1581) [`04449ab`](https://github.com/diegomura/react-pdf/commit/04449ab352db0cca2155024dd3e8c690e42193ca) Thanks [@jeetiss](https://github.com/jeetiss)! - added changelog with changesets
28
+
29
+ - Updated dependencies [[`04449ab`](https://github.com/diegomura/react-pdf/commit/04449ab352db0cca2155024dd3e8c690e42193ca)]:
30
+ - @react-pdf/types@2.0.8
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  exports.__esModule = true;
6
4
  exports.default = void 0;
7
-
8
- var R = _interopRequireWildcard(require("ramda"));
9
-
10
5
  var BORDER_SHORTHAND_REGEX = /(-?\d+(\.\d+)?(px|in|mm|cm|pt|vw|vh|px)?)\s(\S+)\s(.+)/;
11
- var matchBorderShorthand = R.match(BORDER_SHORTHAND_REGEX);
6
+
7
+ var matchBorderShorthand = function matchBorderShorthand(value) {
8
+ return value.match(BORDER_SHORTHAND_REGEX) || [];
9
+ };
12
10
 
13
11
  var expandBorders = function expandBorders(key, value) {
14
12
  var match = matchBorderShorthand("" + value);
@@ -1,46 +1,81 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports.default = void 0;
7
7
 
8
- var R = _interopRequireWildcard(require("ramda"));
8
+ var _parse = _interopRequireDefault(require("postcss-value-parser/lib/parse"));
9
9
 
10
- var BOX_MODEL_REGEX = /-?\d+(\.\d+)?(px|in|mm|cm|pt|%|vw|vh|px)?/g;
11
- var matchBoxModelValue = R.match(BOX_MODEL_REGEX);
10
+ var _unit = _interopRequireDefault(require("postcss-value-parser/lib/unit"));
12
11
 
13
- var expandBoxModel = function expandBoxModel(model) {
14
- return function (key, value) {
15
- var _ref;
12
+ /* eslint-disable no-plusplus */
13
+ var BOX_MODEL_UNITS = 'px,in,mm,cm,pt,%,vw,vh';
16
14
 
17
- if (value === 'auto') return _ref = {}, _ref[model + "Top"] = 'auto', _ref[model + "Right"] = 'auto', _ref[model + "Bottom"] = 'auto', _ref[model + "Left"] = 'auto', _ref;
18
- var match = matchBoxModelValue("" + value);
15
+ var logError = function logError(style, value) {
16
+ console.error("\n @react-pdf/stylesheet parsing error:\n\n " + style + ": " + value + ",\n " + ' '.repeat(style.length + 2) + "^\n Unsupported " + style + " value format\n ");
17
+ };
18
+
19
+ var expandBoxModel = function expandBoxModel(_temp) {
20
+ var _ref = _temp === void 0 ? {} : _temp,
21
+ expandsTo = _ref.expandsTo,
22
+ _ref$maxValues = _ref.maxValues,
23
+ maxValues = _ref$maxValues === void 0 ? 1 : _ref$maxValues,
24
+ _ref$autoSupported = _ref.autoSupported,
25
+ autoSupported = _ref$autoSupported === void 0 ? false : _ref$autoSupported;
19
26
 
20
- if (match) {
21
- var _ref4;
27
+ return function (model, value) {
28
+ var _ref2;
22
29
 
23
- var top = match[0];
24
- var right = match[1] || match[0];
25
- var bottom = match[2] || match[0];
26
- var left = match[3] || match[1] || match[0];
30
+ var nodes = (0, _parse.default)("" + value);
31
+ var parts = [];
27
32
 
28
- if (key.match(/Horizontal$/)) {
29
- var _ref2;
33
+ for (var i = 0; i < nodes.length; i++) {
34
+ var node = nodes[i]; // value contains `calc`, `url` or other css function
35
+ // `,`, `/` or strings that unsupported by margin and padding
30
36
 
31
- return _ref2 = {}, _ref2[model + "Right"] = right, _ref2[model + "Left"] = left, _ref2;
37
+ if (node.type === 'function' || node.type === 'string' || node.type === 'div') {
38
+ logError(model, value);
39
+ return {};
32
40
  }
33
41
 
34
- if (key.match(/Vertical$/)) {
35
- var _ref3;
42
+ if (node.type === 'word') {
43
+ if (node.value === 'auto' && autoSupported) {
44
+ parts.push(node.value);
45
+ } else {
46
+ var result = (0, _unit.default)(node.value); // when unit isn't specified this condition is true
36
47
 
37
- return _ref3 = {}, _ref3[model + "Top"] = top, _ref3[model + "Bottom"] = bottom, _ref3;
48
+ if (result && BOX_MODEL_UNITS.includes(result.unit)) {
49
+ parts.push(node.value);
50
+ } else {
51
+ logError(model, value);
52
+ return {};
53
+ }
54
+ }
38
55
  }
56
+ } // checks that we have enough parsed values
57
+
58
+
59
+ if (parts.length > maxValues) {
60
+ logError(model, value);
61
+ return {};
62
+ }
63
+
64
+ var first = parts[0];
39
65
 
40
- return _ref4 = {}, _ref4[model + "Top"] = top, _ref4[model + "Right"] = right, _ref4[model + "Bottom"] = bottom, _ref4[model + "Left"] = left, _ref4;
66
+ if (expandsTo) {
67
+ var second = parts[1] || parts[0];
68
+ var third = parts[2] || parts[0];
69
+ var fourth = parts[3] || parts[1] || parts[0];
70
+ return expandsTo({
71
+ first: first,
72
+ second: second,
73
+ third: third,
74
+ fourth: fourth
75
+ });
41
76
  }
42
77
 
43
- return value;
78
+ return _ref2 = {}, _ref2[model] = first, _ref2;
44
79
  };
45
80
  };
46
81
 
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports.default = void 0;
7
7
 
8
8
  var _flex = _interopRequireDefault(require("./flex"));
9
9
 
10
- var _margins = _interopRequireDefault(require("./margins"));
10
+ var _margins = require("./margins");
11
11
 
12
12
  var _borders = _interopRequireDefault(require("./borders"));
13
13
 
14
- var _paddings = _interopRequireDefault(require("./paddings"));
14
+ var _paddings = require("./paddings");
15
15
 
16
16
  var _objectPosition = _interopRequireDefault(require("./objectPosition"));
17
17
 
@@ -19,12 +19,20 @@ var _transformOrigin = _interopRequireDefault(require("./transformOrigin"));
19
19
 
20
20
  var shorthands = {
21
21
  flex: _flex.default,
22
- margin: _margins.default,
23
- marginHorizontal: _margins.default,
24
- marginVertical: _margins.default,
25
- padding: _paddings.default,
26
- paddingHorizontal: _paddings.default,
27
- paddingVertical: _paddings.default,
22
+ margin: _margins.processMargin,
23
+ marginHorizontal: _margins.processMarginHorizontal,
24
+ marginVertical: _margins.processMarginVertical,
25
+ marginTop: _margins.processMarginSingle,
26
+ marginRight: _margins.processMarginSingle,
27
+ marginBottom: _margins.processMarginSingle,
28
+ marginLeft: _margins.processMarginSingle,
29
+ padding: _paddings.processPadding,
30
+ paddingHorizontal: _paddings.processPaddingHorizontal,
31
+ paddingVertical: _paddings.processPaddingVertical,
32
+ paddingTop: _paddings.processPaddingSingle,
33
+ paddingRight: _paddings.processPaddingSingle,
34
+ paddingBottom: _paddings.processPaddingSingle,
35
+ paddingLeft: _paddings.processPaddingSingle,
28
36
  border: _borders.default,
29
37
  borderTop: _borders.default,
30
38
  borderRight: _borders.default,
@@ -1,12 +1,56 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  exports.__esModule = true;
6
- exports.default = void 0;
6
+ exports.processMarginVertical = exports.processMarginSingle = exports.processMarginHorizontal = exports.processMargin = void 0;
7
7
 
8
8
  var _boxModel = _interopRequireDefault(require("./boxModel"));
9
9
 
10
- var expandMargin = (0, _boxModel.default)('margin');
11
- var _default = expandMargin;
12
- exports.default = _default;
10
+ var processMargin = (0, _boxModel.default)({
11
+ expandsTo: function expandsTo(_ref) {
12
+ var first = _ref.first,
13
+ second = _ref.second,
14
+ third = _ref.third,
15
+ fourth = _ref.fourth;
16
+ return {
17
+ marginTop: first,
18
+ marginRight: second,
19
+ marginBottom: third,
20
+ marginLeft: fourth
21
+ };
22
+ },
23
+ maxValues: 4,
24
+ autoSupported: true
25
+ });
26
+ exports.processMargin = processMargin;
27
+ var processMarginVertical = (0, _boxModel.default)({
28
+ expandsTo: function expandsTo(_ref2) {
29
+ var first = _ref2.first,
30
+ second = _ref2.second;
31
+ return {
32
+ marginTop: first,
33
+ marginBottom: second
34
+ };
35
+ },
36
+ maxValues: 2,
37
+ autoSupported: true
38
+ });
39
+ exports.processMarginVertical = processMarginVertical;
40
+ var processMarginHorizontal = (0, _boxModel.default)({
41
+ expandsTo: function expandsTo(_ref3) {
42
+ var first = _ref3.first,
43
+ second = _ref3.second;
44
+ return {
45
+ marginRight: first,
46
+ marginLeft: second
47
+ };
48
+ },
49
+ maxValues: 2,
50
+ autoSupported: true
51
+ });
52
+ exports.processMarginHorizontal = processMarginHorizontal;
53
+ var processMarginSingle = (0, _boxModel.default)({
54
+ autoSupported: true
55
+ });
56
+ exports.processMarginSingle = processMarginSingle;
@@ -1,12 +1,51 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  exports.__esModule = true;
6
- exports.default = void 0;
6
+ exports.processPaddingVertical = exports.processPaddingSingle = exports.processPaddingHorizontal = exports.processPadding = void 0;
7
7
 
8
8
  var _boxModel = _interopRequireDefault(require("./boxModel"));
9
9
 
10
- var expandPadding = (0, _boxModel.default)('padding');
11
- var _default = expandPadding;
12
- exports.default = _default;
10
+ var processPadding = (0, _boxModel.default)({
11
+ expandsTo: function expandsTo(_ref) {
12
+ var first = _ref.first,
13
+ second = _ref.second,
14
+ third = _ref.third,
15
+ fourth = _ref.fourth;
16
+ return {
17
+ paddingTop: first,
18
+ paddingRight: second,
19
+ paddingBottom: third,
20
+ paddingLeft: fourth
21
+ };
22
+ },
23
+ maxValues: 4
24
+ });
25
+ exports.processPadding = processPadding;
26
+ var processPaddingVertical = (0, _boxModel.default)({
27
+ expandsTo: function expandsTo(_ref2) {
28
+ var first = _ref2.first,
29
+ second = _ref2.second;
30
+ return {
31
+ paddingTop: first,
32
+ paddingBottom: second
33
+ };
34
+ },
35
+ maxValues: 2
36
+ });
37
+ exports.processPaddingVertical = processPaddingVertical;
38
+ var processPaddingHorizontal = (0, _boxModel.default)({
39
+ expandsTo: function expandsTo(_ref3) {
40
+ var first = _ref3.first,
41
+ second = _ref3.second;
42
+ return {
43
+ paddingRight: first,
44
+ paddingLeft: second
45
+ };
46
+ },
47
+ maxValues: 2
48
+ });
49
+ exports.processPaddingHorizontal = processPaddingHorizontal;
50
+ var processPaddingSingle = (0, _boxModel.default)();
51
+ exports.processPaddingSingle = processPaddingSingle;
@@ -1,32 +1,19 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  exports.__esModule = true;
6
4
  exports.default = void 0;
7
5
 
8
- var R = _interopRequireWildcard(require("ramda"));
6
+ var _fns = require("@react-pdf/fns");
9
7
 
10
- var isNotArray = R.complement(R.is(Array));
11
- var castArray = R.when(isNotArray, function (v) {
12
- return [v];
13
- });
14
8
  /**
15
9
  * Remove nil values from array
16
10
  *
17
11
  * @param {Array} array
18
12
  * @returns {Array} array without nils
19
13
  */
20
-
21
- var compact = R.filter(Boolean);
22
- /**
23
- * Checks if value is array
24
- *
25
- * @param {any} value
26
- * @returns {Boolean} is value an array
27
- */
28
-
29
- var isArray = R.is(Array);
14
+ var compact = function compact(array) {
15
+ return array.filter(Boolean);
16
+ };
30
17
  /**
31
18
  * Merges style objects array
32
19
  *
@@ -34,9 +21,10 @@ var isArray = R.is(Array);
34
21
  * @returns {Object} merged style object
35
22
  */
36
23
 
24
+
37
25
  var mergeStyles = function mergeStyles(styles) {
38
26
  return styles.reduce(function (acc, style) {
39
- var s = isArray(style) ? flatten(style) : style;
27
+ var s = Array.isArray(style) ? flatten(style) : style;
40
28
  Object.keys(s).forEach(function (key) {
41
29
  if (s[key] !== null && s[key] !== undefined) {
42
30
  acc[key] = s[key];
@@ -53,6 +41,6 @@ var mergeStyles = function mergeStyles(styles) {
53
41
  */
54
42
 
55
43
 
56
- var flatten = R.compose(mergeStyles, compact, castArray);
44
+ var flatten = (0, _fns.compose)(mergeStyles, compact, _fns.castArray);
57
45
  var _default = flatten;
58
46
  exports.default = _default;
package/lib/index.js CHANGED
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
4
 
7
5
  exports.__esModule = true;
8
- exports.default = exports.processTransform = exports.transformColor = void 0;
6
+ exports.transformColor = exports.processTransform = exports.default = void 0;
9
7
 
10
- var R = _interopRequireWildcard(require("ramda"));
8
+ var _fns = require("@react-pdf/fns");
11
9
 
12
10
  var _expand = _interopRequireDefault(require("./expand"));
13
11
 
@@ -33,10 +31,13 @@ exports.processTransform = _transform2.default;
33
31
  * @returns {Object} resolved style object
34
32
  */
35
33
  var resolveStyles = function resolveStyles(container, style) {
36
- return R.compose((0, _transform.default)(container), _expand.default, (0, _mediaQueries.default)(container), _flatten.default)(style);
37
- }; // Utils exported for SVG processing
34
+ var computeMediaQueries = function computeMediaQueries(value) {
35
+ return (0, _mediaQueries.default)(container, value);
36
+ };
38
37
 
38
+ return (0, _fns.compose)((0, _transform.default)(container), _expand.default, computeMediaQueries, _flatten.default)(style);
39
+ }; // Utils exported for SVG processing
39
40
 
40
- var _default = R.curryN(2, resolveStyles);
41
41
 
42
+ var _default = resolveStyles;
42
43
  exports.default = _default;
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
4
 
7
5
  exports.__esModule = true;
8
6
  exports.default = void 0;
9
7
 
10
8
  var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
9
 
12
- var R = _interopRequireWildcard(require("ramda"));
13
-
14
10
  var _mediaEngine = _interopRequireDefault(require("media-engine"));
15
11
 
16
12
  /**
@@ -33,6 +29,5 @@ var resolveMediaQueries = function resolveMediaQueries(container, styles) {
33
29
  }, {});
34
30
  };
35
31
 
36
- var _default = R.curryN(2, resolveMediaQueries);
37
-
32
+ var _default = resolveMediaQueries;
38
33
  exports.default = _default;
@@ -1,22 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
4
 
7
5
  exports.__esModule = true;
8
6
  exports.default = void 0;
9
7
 
10
- var R = _interopRequireWildcard(require("ramda"));
11
-
12
8
  var _hslToHex = _interopRequireDefault(require("hsl-to-hex"));
13
9
 
14
10
  var _colorString = _interopRequireDefault(require("color-string"));
15
11
 
16
- var isRgb = R.test(/rgb/g);
17
- var isRgba = R.test(/rgba/g);
18
- var isHsl = R.test(/hsl/g);
19
- var isHsla = R.test(/hsla/g);
12
+ var isRgb = function isRgb(value) {
13
+ return /rgba?/g.test(value);
14
+ };
15
+
16
+ var isHsl = function isHsl(value) {
17
+ return /hsla?/g.test(value);
18
+ };
20
19
  /**
21
20
  * Transform rgb color to hexa
22
21
  *
@@ -24,7 +23,12 @@ var isHsla = R.test(/hsla/g);
24
23
  * @returns {Object} transformed value
25
24
  */
26
25
 
27
- var parseRgb = R.compose(_colorString.default.to.hex, _colorString.default.get.rgb);
26
+
27
+ var parseRgb = function parseRgb(value) {
28
+ var rgb = _colorString.default.get.rgb(value);
29
+
30
+ return _colorString.default.to.hex(rgb);
31
+ };
28
32
  /**
29
33
  * Transform Hsl color to hexa
30
34
  *
@@ -32,7 +36,14 @@ var parseRgb = R.compose(_colorString.default.to.hex, _colorString.default.get.r
32
36
  * @returns {Object} transformed value
33
37
  */
34
38
 
35
- var parseHsl = R.compose(R.toUpper, R.apply(_hslToHex.default), R.map(Math.round), _colorString.default.get.hsl);
39
+
40
+ var parseHsl = function parseHsl(value) {
41
+ var hsl = _colorString.default.get.hsl(value).map(Math.round);
42
+
43
+ var hex = _hslToHex.default.apply(void 0, hsl);
44
+
45
+ return hex.toUpperCase();
46
+ };
36
47
  /**
37
48
  * Transform given color to hexa
38
49
  *
@@ -40,8 +51,11 @@ var parseHsl = R.compose(R.toUpper, R.apply(_hslToHex.default), R.map(Math.round
40
51
  * @returns {Object} transformed value
41
52
  */
42
53
 
54
+
43
55
  var transformColor = function transformColor(value) {
44
- return R.cond([[isRgba, parseRgb], [isRgb, parseRgb], [isHsla, parseHsl], [isHsl, parseHsl], [R.T, R.always(value)]])(value);
56
+ if (isRgb(value)) return parseRgb(value);
57
+ if (isHsl(value)) return parseHsl(value);
58
+ return value;
45
59
  };
46
60
 
47
61
  var _default = transformColor;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports.default = void 0;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports.default = void 0;
@@ -130,6 +130,7 @@ var normalize = function normalize(operations) {
130
130
  };
131
131
 
132
132
  var processTransform = function processTransform(value) {
133
+ if (typeof value !== 'string') return value;
133
134
  return normalize(parse(value));
134
135
  };
135
136
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  exports.__esModule = true;
6
6
  exports.default = void 0;
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  exports.__esModule = true;
6
4
  exports.default = void 0;
7
5
 
8
- var R = _interopRequireWildcard(require("ramda"));
9
-
10
- /* eslint-disable import/prefer-default-export */
11
- var matchNumber = R.when(R.is(String), R.test(/^-?\d*\.?\d*$/));
6
+ var matchNumber = function matchNumber(value) {
7
+ return typeof value === 'string' && /^-?\d*\.?\d*$/.test(value);
8
+ };
12
9
 
13
10
  var castFloat = function castFloat(value) {
14
11
  if (typeof value !== 'string') return value;
package/package.json CHANGED
@@ -1,22 +1,29 @@
1
1
  {
2
2
  "name": "@react-pdf/stylesheet",
3
- "version": "2.0.12",
3
+ "version": "3.0.0",
4
4
  "license": "MIT",
5
+ "description": "A styles engine for Node and the browser",
5
6
  "author": "Diego Muracciole <diegomuracciole@gmail.com>",
6
7
  "homepage": "https://github.com/diegomura/react-pdf#readme",
7
- "repository": "git@github.com:diegomura/react-pdf.git",
8
8
  "main": "lib/index.js",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/diegomura/react-pdf.git",
12
+ "directory": "packages/stylesheet"
13
+ },
9
14
  "scripts": {
10
15
  "test": "jest",
11
16
  "build": "rimraf ./lib && babel src --out-dir lib",
12
17
  "watch": "rimraf ./lib && babel src --out-dir lib --watch"
13
18
  },
14
19
  "dependencies": {
15
- "@react-pdf/types": "^2.0.6",
20
+ "@babel/runtime": "^7.16.4",
21
+ "@react-pdf/fns": "1.0.0",
22
+ "@react-pdf/types": "^2.0.9",
16
23
  "color-string": "^1.5.3",
17
24
  "hsl-to-hex": "^1.0.0",
18
25
  "media-engine": "^1.0.3",
19
- "ramda": "^0.26.1"
26
+ "postcss-value-parser": "^4.1.0"
20
27
  },
21
28
  "files": [
22
29
  "lib"