@react-pdf/stylesheet 4.0.0 → 4.1.1

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @react-pdf/stylesheet
2
2
 
3
+ ## 4.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2186](https://github.com/diegomura/react-pdf/pull/2186) [`72435bd`](https://github.com/diegomura/react-pdf/commit/72435bd81afdada5b811a1d82af0c873cfb62fa0) Thanks [@jeetiss](https://github.com/jeetiss)! - update yoga-layout to support flexBasis auto
8
+
9
+ ## 4.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#2160](https://github.com/diegomura/react-pdf/pull/2160) [`a743c90`](https://github.com/diegomura/react-pdf/commit/a743c905fb5d201d2382bc9175fa36b83cc47284) Thanks [@jeetiss](https://github.com/jeetiss)! - implement flex gap
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`a743c90`](https://github.com/diegomura/react-pdf/commit/a743c905fb5d201d2382bc9175fa36b83cc47284)]:
18
+ - @react-pdf/types@2.2.0
19
+
3
20
  ## 4.0.0
4
21
 
5
22
  ### Major Changes
package/lib/index.cjs.js CHANGED
@@ -19,13 +19,23 @@ var colorString__default = /*#__PURE__*/_interopDefaultLegacy(colorString);
19
19
  var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
20
20
  var matchMedia__default = /*#__PURE__*/_interopDefaultLegacy(matchMedia);
21
21
 
22
- var flexDefaults = [1, 1, 0];
22
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/flex#values
23
+ var flexDefaults = [0, 1, 'auto'];
24
+ var flexAuto = [1, 1, 'auto'];
23
25
 
24
26
  var expandFlex = function expandFlex(key, value) {
25
- var matches = ("" + value).split(' ');
26
- var flexGrow = matches[0] || flexDefaults[0];
27
- var flexShrink = matches[1] || flexDefaults[1];
28
- var flexBasis = matches[2] || flexDefaults[2];
27
+ var defaults = flexDefaults;
28
+ var matches = [];
29
+
30
+ if (value === 'auto') {
31
+ defaults = flexAuto;
32
+ } else {
33
+ matches = ("" + value).split(' ');
34
+ }
35
+
36
+ var flexGrow = matches[0] || defaults[0];
37
+ var flexShrink = matches[1] || defaults[1];
38
+ var flexBasis = matches[2] || defaults[2];
29
39
  return {
30
40
  flexGrow: flexGrow,
31
41
  flexShrink: flexShrink,
@@ -296,8 +306,17 @@ var expandTransformOrigin = function expandTransformOrigin(key, value) {
296
306
  };
297
307
  };
298
308
 
309
+ var expandGap = function expandGap(key, value) {
310
+ var match = ("" + value).split(' ');
311
+ return {
312
+ rowGap: (match === null || match === void 0 ? void 0 : match[0]) || value,
313
+ columnGap: (match === null || match === void 0 ? void 0 : match[1]) || value
314
+ };
315
+ };
316
+
299
317
  var shorthands = {
300
318
  flex: expandFlex,
319
+ gap: expandGap,
301
320
  margin: processMargin,
302
321
  marginHorizontal: processMarginHorizontal,
303
322
  marginVertical: processMarginVertical,
package/lib/index.es.js CHANGED
@@ -6,13 +6,23 @@ import colorString from 'color-string';
6
6
  import _extends from '@babel/runtime/helpers/extends';
7
7
  import matchMedia from 'media-engine';
8
8
 
9
- var flexDefaults = [1, 1, 0];
9
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/flex#values
10
+ var flexDefaults = [0, 1, 'auto'];
11
+ var flexAuto = [1, 1, 'auto'];
10
12
 
11
13
  var expandFlex = function expandFlex(key, value) {
12
- var matches = ("" + value).split(' ');
13
- var flexGrow = matches[0] || flexDefaults[0];
14
- var flexShrink = matches[1] || flexDefaults[1];
15
- var flexBasis = matches[2] || flexDefaults[2];
14
+ var defaults = flexDefaults;
15
+ var matches = [];
16
+
17
+ if (value === 'auto') {
18
+ defaults = flexAuto;
19
+ } else {
20
+ matches = ("" + value).split(' ');
21
+ }
22
+
23
+ var flexGrow = matches[0] || defaults[0];
24
+ var flexShrink = matches[1] || defaults[1];
25
+ var flexBasis = matches[2] || defaults[2];
16
26
  return {
17
27
  flexGrow: flexGrow,
18
28
  flexShrink: flexShrink,
@@ -283,8 +293,17 @@ var expandTransformOrigin = function expandTransformOrigin(key, value) {
283
293
  };
284
294
  };
285
295
 
296
+ var expandGap = function expandGap(key, value) {
297
+ var match = ("" + value).split(' ');
298
+ return {
299
+ rowGap: (match === null || match === void 0 ? void 0 : match[0]) || value,
300
+ columnGap: (match === null || match === void 0 ? void 0 : match[1]) || value
301
+ };
302
+ };
303
+
286
304
  var shorthands = {
287
305
  flex: expandFlex,
306
+ gap: expandGap,
288
307
  margin: processMargin,
289
308
  marginHorizontal: processMarginHorizontal,
290
309
  marginVertical: processMarginVertical,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pdf/stylesheet",
3
- "version": "4.0.0",
3
+ "version": "4.1.1",
4
4
  "license": "MIT",
5
5
  "description": "A styles engine for Node and the browser",
6
6
  "author": "Diego Muracciole <diegomuracciole@gmail.com>",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@babel/runtime": "^7.16.4",
22
22
  "@react-pdf/fns": "2.0.0",
23
- "@react-pdf/types": "^2.1.0",
23
+ "@react-pdf/types": "^2.2.0",
24
24
  "color-string": "^1.5.3",
25
25
  "hsl-to-hex": "^1.0.0",
26
26
  "media-engine": "^1.0.3",