@react-pdf/stylesheet 3.0.0 → 4.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.
@@ -0,0 +1,788 @@
1
+ import { compose, castArray } from '@react-pdf/fns';
2
+ import parse$1 from 'postcss-value-parser/lib/parse';
3
+ import parseUnit from 'postcss-value-parser/lib/unit';
4
+ import hlsToHex from 'hsl-to-hex';
5
+ import colorString from 'color-string';
6
+ import _extends from '@babel/runtime/helpers/extends';
7
+ import matchMedia from 'media-engine';
8
+
9
+ var flexDefaults = [1, 1, 0];
10
+
11
+ 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];
16
+ return {
17
+ flexGrow: flexGrow,
18
+ flexShrink: flexShrink,
19
+ flexBasis: flexBasis
20
+ };
21
+ };
22
+
23
+ /* eslint-disable no-plusplus */
24
+ var BOX_MODEL_UNITS = 'px,in,mm,cm,pt,%,vw,vh';
25
+
26
+ var logError = function logError(style, value) {
27
+ console.error("\n @react-pdf/stylesheet parsing error:\n\n " + style + ": " + value + ",\n " + ' '.repeat(style.length + 2) + "^\n Unsupported " + style + " value format\n ");
28
+ };
29
+
30
+ var expandBoxModel = function expandBoxModel(_temp) {
31
+ var _ref = _temp === void 0 ? {} : _temp,
32
+ expandsTo = _ref.expandsTo,
33
+ _ref$maxValues = _ref.maxValues,
34
+ maxValues = _ref$maxValues === void 0 ? 1 : _ref$maxValues,
35
+ _ref$autoSupported = _ref.autoSupported,
36
+ autoSupported = _ref$autoSupported === void 0 ? false : _ref$autoSupported;
37
+
38
+ return function (model, value) {
39
+ var _ref2;
40
+
41
+ var nodes = parse$1("" + value);
42
+ var parts = [];
43
+
44
+ for (var i = 0; i < nodes.length; i++) {
45
+ var node = nodes[i]; // value contains `calc`, `url` or other css function
46
+ // `,`, `/` or strings that unsupported by margin and padding
47
+
48
+ if (node.type === 'function' || node.type === 'string' || node.type === 'div') {
49
+ logError(model, value);
50
+ return {};
51
+ }
52
+
53
+ if (node.type === 'word') {
54
+ if (node.value === 'auto' && autoSupported) {
55
+ parts.push(node.value);
56
+ } else {
57
+ var result = parseUnit(node.value); // when unit isn't specified this condition is true
58
+
59
+ if (result && BOX_MODEL_UNITS.includes(result.unit)) {
60
+ parts.push(node.value);
61
+ } else {
62
+ logError(model, value);
63
+ return {};
64
+ }
65
+ }
66
+ }
67
+ } // checks that we have enough parsed values
68
+
69
+
70
+ if (parts.length > maxValues) {
71
+ logError(model, value);
72
+ return {};
73
+ }
74
+
75
+ var first = parts[0];
76
+
77
+ if (expandsTo) {
78
+ var second = parts[1] || parts[0];
79
+ var third = parts[2] || parts[0];
80
+ var fourth = parts[3] || parts[1] || parts[0];
81
+ return expandsTo({
82
+ first: first,
83
+ second: second,
84
+ third: third,
85
+ fourth: fourth
86
+ });
87
+ }
88
+
89
+ return _ref2 = {}, _ref2[model] = first, _ref2;
90
+ };
91
+ };
92
+
93
+ var processMargin = expandBoxModel({
94
+ expandsTo: function expandsTo(_ref) {
95
+ var first = _ref.first,
96
+ second = _ref.second,
97
+ third = _ref.third,
98
+ fourth = _ref.fourth;
99
+ return {
100
+ marginTop: first,
101
+ marginRight: second,
102
+ marginBottom: third,
103
+ marginLeft: fourth
104
+ };
105
+ },
106
+ maxValues: 4,
107
+ autoSupported: true
108
+ });
109
+ var processMarginVertical = expandBoxModel({
110
+ expandsTo: function expandsTo(_ref2) {
111
+ var first = _ref2.first,
112
+ second = _ref2.second;
113
+ return {
114
+ marginTop: first,
115
+ marginBottom: second
116
+ };
117
+ },
118
+ maxValues: 2,
119
+ autoSupported: true
120
+ });
121
+ var processMarginHorizontal = expandBoxModel({
122
+ expandsTo: function expandsTo(_ref3) {
123
+ var first = _ref3.first,
124
+ second = _ref3.second;
125
+ return {
126
+ marginRight: first,
127
+ marginLeft: second
128
+ };
129
+ },
130
+ maxValues: 2,
131
+ autoSupported: true
132
+ });
133
+ var processMarginSingle = expandBoxModel({
134
+ autoSupported: true
135
+ });
136
+
137
+ var BORDER_SHORTHAND_REGEX = /(-?\d+(\.\d+)?(px|in|mm|cm|pt|vw|vh|px)?)\s(\S+)\s(.+)/;
138
+
139
+ var matchBorderShorthand = function matchBorderShorthand(value) {
140
+ return value.match(BORDER_SHORTHAND_REGEX) || [];
141
+ };
142
+
143
+ var expandBorders = function expandBorders(key, value) {
144
+ var match = matchBorderShorthand("" + value);
145
+
146
+ if (match) {
147
+ var color = match[5] || value;
148
+ var style = match[4] || value;
149
+ var width = match[1] || value;
150
+
151
+ if (key.match(/(Top|Right|Bottom|Left)$/)) {
152
+ var _ref;
153
+
154
+ return _ref = {}, _ref[key + "Color"] = color, _ref[key + "Style"] = style, _ref[key + "Width"] = width, _ref;
155
+ }
156
+
157
+ if (key.match(/Color$/)) {
158
+ return {
159
+ borderTopColor: color,
160
+ borderRightColor: color,
161
+ borderBottomColor: color,
162
+ borderLeftColor: color
163
+ };
164
+ }
165
+
166
+ if (key.match(/Style$/)) {
167
+ return {
168
+ borderTopStyle: style,
169
+ borderRightStyle: style,
170
+ borderBottomStyle: style,
171
+ borderLeftStyle: style
172
+ };
173
+ }
174
+
175
+ if (key.match(/Width$/)) {
176
+ return {
177
+ borderTopWidth: width,
178
+ borderRightWidth: width,
179
+ borderBottomWidth: width,
180
+ borderLeftWidth: width
181
+ };
182
+ }
183
+
184
+ if (key.match(/Radius$/)) {
185
+ return {
186
+ borderTopLeftRadius: value,
187
+ borderTopRightRadius: value,
188
+ borderBottomRightRadius: value,
189
+ borderBottomLeftRadius: value
190
+ };
191
+ }
192
+
193
+ return {
194
+ borderTopColor: color,
195
+ borderTopStyle: style,
196
+ borderTopWidth: width,
197
+ borderRightColor: color,
198
+ borderRightStyle: style,
199
+ borderRightWidth: width,
200
+ borderBottomColor: color,
201
+ borderBottomStyle: style,
202
+ borderBottomWidth: width,
203
+ borderLeftColor: color,
204
+ borderLeftStyle: style,
205
+ borderLeftWidth: width
206
+ };
207
+ }
208
+
209
+ return value;
210
+ };
211
+
212
+ var processPadding = expandBoxModel({
213
+ expandsTo: function expandsTo(_ref) {
214
+ var first = _ref.first,
215
+ second = _ref.second,
216
+ third = _ref.third,
217
+ fourth = _ref.fourth;
218
+ return {
219
+ paddingTop: first,
220
+ paddingRight: second,
221
+ paddingBottom: third,
222
+ paddingLeft: fourth
223
+ };
224
+ },
225
+ maxValues: 4
226
+ });
227
+ var processPaddingVertical = expandBoxModel({
228
+ expandsTo: function expandsTo(_ref2) {
229
+ var first = _ref2.first,
230
+ second = _ref2.second;
231
+ return {
232
+ paddingTop: first,
233
+ paddingBottom: second
234
+ };
235
+ },
236
+ maxValues: 2
237
+ });
238
+ var processPaddingHorizontal = expandBoxModel({
239
+ expandsTo: function expandsTo(_ref3) {
240
+ var first = _ref3.first,
241
+ second = _ref3.second;
242
+ return {
243
+ paddingRight: first,
244
+ paddingLeft: second
245
+ };
246
+ },
247
+ maxValues: 2
248
+ });
249
+ var processPaddingSingle = expandBoxModel();
250
+
251
+ var expandObjectPosition = function expandObjectPosition(key, value) {
252
+ var match = ("" + value).split(' ');
253
+ return {
254
+ objectPositionX: (match === null || match === void 0 ? void 0 : match[0]) || value,
255
+ objectPositionY: (match === null || match === void 0 ? void 0 : match[1]) || value
256
+ };
257
+ };
258
+
259
+ var Y_AXIS_SHORTHANDS = {
260
+ top: true,
261
+ bottom: true
262
+ };
263
+
264
+ var sortTransformOriginPair = function sortTransformOriginPair(a, b) {
265
+ if (Y_AXIS_SHORTHANDS[a]) return 1;
266
+ if (Y_AXIS_SHORTHANDS[b]) return -1;
267
+ return 0;
268
+ };
269
+
270
+ var getTransformOriginPair = function getTransformOriginPair(values) {
271
+ if (!values || values.length === 0) return ['center', 'center'];
272
+ var pair = values.length === 1 ? [values[0], 'center'] : values;
273
+ return pair.sort(sortTransformOriginPair);
274
+ }; // Transforms shorthand transformOrigin values
275
+
276
+
277
+ var expandTransformOrigin = function expandTransformOrigin(key, value) {
278
+ var match = ("" + value).split(' ');
279
+ var pair = getTransformOriginPair(match);
280
+ return {
281
+ transformOriginX: pair[0],
282
+ transformOriginY: pair[1]
283
+ };
284
+ };
285
+
286
+ var shorthands = {
287
+ flex: expandFlex,
288
+ margin: processMargin,
289
+ marginHorizontal: processMarginHorizontal,
290
+ marginVertical: processMarginVertical,
291
+ marginTop: processMarginSingle,
292
+ marginRight: processMarginSingle,
293
+ marginBottom: processMarginSingle,
294
+ marginLeft: processMarginSingle,
295
+ padding: processPadding,
296
+ paddingHorizontal: processPaddingHorizontal,
297
+ paddingVertical: processPaddingVertical,
298
+ paddingTop: processPaddingSingle,
299
+ paddingRight: processPaddingSingle,
300
+ paddingBottom: processPaddingSingle,
301
+ paddingLeft: processPaddingSingle,
302
+ border: expandBorders,
303
+ borderTop: expandBorders,
304
+ borderRight: expandBorders,
305
+ borderBottom: expandBorders,
306
+ borderLeft: expandBorders,
307
+ borderColor: expandBorders,
308
+ borderRadius: expandBorders,
309
+ borderStyle: expandBorders,
310
+ borderWidth: expandBorders,
311
+ objectPosition: expandObjectPosition,
312
+ transformOrigin: expandTransformOrigin
313
+ };
314
+ /**
315
+ * Transforms style key-value
316
+ *
317
+ * @param {String} key style key
318
+ * @param {String} value style value
319
+ * @returns {String | Number} transformed style values
320
+ */
321
+
322
+ var expandStyle = function expandStyle(key, value) {
323
+ var _ref;
324
+
325
+ return shorthands[key] ? shorthands[key](key, value) : (_ref = {}, _ref[key] = value, _ref);
326
+ };
327
+ /**
328
+ * Expand the shorthand properties.
329
+ *
330
+ * @param { Object } style object
331
+ * @returns { Object } expanded style object
332
+ */
333
+
334
+
335
+ var expand = function expand(style) {
336
+ if (!style) return style;
337
+ var propsArray = Object.keys(style);
338
+ var resolvedStyle = {};
339
+
340
+ for (var i = 0; i < propsArray.length; i += 1) {
341
+ var key = propsArray[i];
342
+ var value = style[key];
343
+ var extended = expandStyle(key, value);
344
+ var keys = Object.keys(extended);
345
+
346
+ for (var j = 0; j < keys.length; j += 1) {
347
+ var propName = keys[j];
348
+ var propValue = extended[propName];
349
+ resolvedStyle[propName] = propValue;
350
+ }
351
+ }
352
+
353
+ return resolvedStyle;
354
+ };
355
+
356
+ /**
357
+ * Remove nil values from array
358
+ *
359
+ * @param {Array} array
360
+ * @returns {Array} array without nils
361
+ */
362
+
363
+ var compact = function compact(array) {
364
+ return array.filter(Boolean);
365
+ };
366
+ /**
367
+ * Merges style objects array
368
+ *
369
+ * @param {Array} style objects array
370
+ * @returns {Object} merged style object
371
+ */
372
+
373
+
374
+ var mergeStyles = function mergeStyles(styles) {
375
+ return styles.reduce(function (acc, style) {
376
+ var s = Array.isArray(style) ? flatten(style) : style;
377
+ Object.keys(s).forEach(function (key) {
378
+ if (s[key] !== null && s[key] !== undefined) {
379
+ acc[key] = s[key];
380
+ }
381
+ });
382
+ return acc;
383
+ }, {});
384
+ };
385
+ /**
386
+ * Flattens an array of style objects, into one aggregated style object.
387
+ *
388
+ * @param {Array} style objects array
389
+ * @returns {Object} flatted style object
390
+ */
391
+
392
+
393
+ var flatten = compose(mergeStyles, compact, castArray);
394
+
395
+ /**
396
+ * Parses scalar value in value and unit pairs
397
+ *
398
+ * @param {String} scalar value
399
+ * @returns {Object} parsed value
400
+ */
401
+ var parseValue = function parseValue(value) {
402
+ var match = /^(-?\d*\.?\d+)(in|mm|cm|pt|vh|vw|px)?$/g.exec(value);
403
+ return match ? {
404
+ value: parseFloat(match[1], 10),
405
+ unit: match[2] || 'pt'
406
+ } : {
407
+ value: value,
408
+ unit: undefined
409
+ };
410
+ };
411
+ /**
412
+ * Transform given scalar value
413
+ *
414
+ * @param {Object} container
415
+ * @param {String} styles value
416
+ * @returns {Object} transformed value
417
+ */
418
+
419
+
420
+ var transformUnit = function transformUnit(container, value) {
421
+ var scalar = parseValue(value);
422
+ var dpi = container.dpi || 72;
423
+ var mmFactor = 1 / 25.4 * dpi;
424
+ var cmFactor = 1 / 2.54 * dpi;
425
+
426
+ switch (scalar.unit) {
427
+ case 'in':
428
+ return scalar.value * dpi;
429
+
430
+ case 'mm':
431
+ return scalar.value * mmFactor;
432
+
433
+ case 'cm':
434
+ return scalar.value * cmFactor;
435
+
436
+ case 'vh':
437
+ return scalar.value * (container.height / 100);
438
+
439
+ case 'vw':
440
+ return scalar.value * (container.width / 100);
441
+
442
+ default:
443
+ return scalar.value;
444
+ }
445
+ };
446
+
447
+ var isRgb = function isRgb(value) {
448
+ return /rgba?/g.test(value);
449
+ };
450
+
451
+ var isHsl = function isHsl(value) {
452
+ return /hsla?/g.test(value);
453
+ };
454
+ /**
455
+ * Transform rgb color to hexa
456
+ *
457
+ * @param {String} styles value
458
+ * @returns {Object} transformed value
459
+ */
460
+
461
+
462
+ var parseRgb = function parseRgb(value) {
463
+ var rgb = colorString.get.rgb(value);
464
+ return colorString.to.hex(rgb);
465
+ };
466
+ /**
467
+ * Transform Hsl color to hexa
468
+ *
469
+ * @param {String} styles value
470
+ * @returns {Object} transformed value
471
+ */
472
+
473
+
474
+ var parseHsl = function parseHsl(value) {
475
+ var hsl = colorString.get.hsl(value).map(Math.round);
476
+ var hex = hlsToHex.apply(void 0, hsl);
477
+ return hex.toUpperCase();
478
+ };
479
+ /**
480
+ * Transform given color to hexa
481
+ *
482
+ * @param {String} styles value
483
+ * @returns {Object} transformed value
484
+ */
485
+
486
+
487
+ var transformColor = function transformColor(value) {
488
+ if (isRgb(value)) return parseRgb(value);
489
+ if (isHsl(value)) return parseHsl(value);
490
+ return value;
491
+ };
492
+
493
+ var parse = function parse(transformString) {
494
+ var transforms = transformString.trim().split(/\) |\)/); // Handle "initial", "inherit", "unset".
495
+
496
+ if (transforms.length === 1) {
497
+ return [[transforms[0], true]];
498
+ }
499
+
500
+ var parsed = [];
501
+
502
+ for (var i = 0; i < transforms.length; i += 1) {
503
+ var transform = transforms[i];
504
+
505
+ if (transform) {
506
+ var _transform$split = transform.split('('),
507
+ name = _transform$split[0],
508
+ rawValue = _transform$split[1];
509
+
510
+ var splitChar = rawValue.indexOf(',') >= 0 ? ',' : ' ';
511
+ var value = rawValue.split(splitChar).map(function (val) {
512
+ return val.trim();
513
+ });
514
+ parsed.push({
515
+ operation: name,
516
+ value: value
517
+ });
518
+ }
519
+ }
520
+
521
+ return parsed;
522
+ };
523
+
524
+ var parseAngle = function parseAngle(value) {
525
+ var unitsRegexp = /(-?\d*\.?\d*)(\w*)?/i;
526
+
527
+ var _unitsRegexp$exec = unitsRegexp.exec(value),
528
+ angle = _unitsRegexp$exec[1],
529
+ unit = _unitsRegexp$exec[2];
530
+
531
+ var number = Number.parseFloat(angle);
532
+ return unit === 'rad' ? number * 180 / Math.PI : number;
533
+ };
534
+
535
+ var normalizeTransformOperation = function normalizeTransformOperation(_ref) {
536
+ var operation = _ref.operation,
537
+ value = _ref.value;
538
+
539
+ switch (operation) {
540
+ case 'scale':
541
+ {
542
+ var _value$map = value.map(function (num) {
543
+ return Number.parseFloat(num);
544
+ }),
545
+ scaleX = _value$map[0],
546
+ _value$map$ = _value$map[1],
547
+ scaleY = _value$map$ === void 0 ? scaleX : _value$map$;
548
+
549
+ return {
550
+ operation: 'scale',
551
+ value: [scaleX, scaleY]
552
+ };
553
+ }
554
+
555
+ case 'scaleX':
556
+ {
557
+ return {
558
+ operation: 'scale',
559
+ value: [Number.parseFloat(value), 1]
560
+ };
561
+ }
562
+
563
+ case 'scaleY':
564
+ {
565
+ return {
566
+ operation: 'scale',
567
+ value: [1, Number.parseFloat(value)]
568
+ };
569
+ }
570
+
571
+ case 'rotate':
572
+ {
573
+ return {
574
+ operation: 'rotate',
575
+ value: [parseAngle(value)]
576
+ };
577
+ }
578
+
579
+ case 'translate':
580
+ {
581
+ return {
582
+ operation: 'translate',
583
+ value: value.map(function (num) {
584
+ return Number.parseFloat(num);
585
+ })
586
+ };
587
+ }
588
+
589
+ case 'translateX':
590
+ {
591
+ return {
592
+ operation: 'translate',
593
+ value: [Number.parseFloat(value), 0]
594
+ };
595
+ }
596
+
597
+ case 'translateY':
598
+ {
599
+ return {
600
+ operation: 'translate',
601
+ value: [0, Number.parseFloat(value)]
602
+ };
603
+ }
604
+
605
+ case 'skew':
606
+ {
607
+ return {
608
+ operation: 'skew',
609
+ value: value.map(parseAngle)
610
+ };
611
+ }
612
+
613
+ case 'skewX':
614
+ {
615
+ return {
616
+ operation: 'skew',
617
+ value: [parseAngle(value), 0]
618
+ };
619
+ }
620
+
621
+ case 'skewY':
622
+ {
623
+ return {
624
+ operation: 'skew',
625
+ value: [0, parseAngle(value)]
626
+ };
627
+ }
628
+
629
+ default:
630
+ {
631
+ return {
632
+ operation: operation,
633
+ value: value.map(function (num) {
634
+ return Number.parseFloat(num);
635
+ })
636
+ };
637
+ }
638
+ }
639
+ };
640
+
641
+ var normalize = function normalize(operations) {
642
+ return operations.map(function (operation) {
643
+ return normalizeTransformOperation(operation);
644
+ });
645
+ };
646
+
647
+ var processTransform = function processTransform(value) {
648
+ if (typeof value !== 'string') return value;
649
+ return normalize(parse(value));
650
+ };
651
+
652
+ var FONT_WEIGHTS = {
653
+ thin: 100,
654
+ hairline: 100,
655
+ ultralight: 200,
656
+ extralight: 200,
657
+ light: 300,
658
+ normal: 400,
659
+ medium: 500,
660
+ semibold: 600,
661
+ demibold: 600,
662
+ bold: 700,
663
+ ultrabold: 800,
664
+ extrabold: 800,
665
+ heavy: 900,
666
+ black: 900
667
+ };
668
+
669
+ var processFontWeight = function processFontWeight(value) {
670
+ if (!value) return FONT_WEIGHTS.normal;
671
+ if (typeof value === 'number') return value;
672
+ var lv = value.toLowerCase();
673
+ if (FONT_WEIGHTS[lv]) return FONT_WEIGHTS[lv];
674
+ return value;
675
+ };
676
+
677
+ var matchNumber = function matchNumber(value) {
678
+ return typeof value === 'string' && /^-?\d*\.?\d*$/.test(value);
679
+ };
680
+
681
+ var castFloat = function castFloat(value) {
682
+ if (typeof value !== 'string') return value;
683
+ if (matchNumber(value)) return parseFloat(value, 10);
684
+ return value;
685
+ };
686
+
687
+ var offsetKeyword = function offsetKeyword(value) {
688
+ switch (value) {
689
+ case 'top':
690
+ case 'left':
691
+ return '0%';
692
+
693
+ case 'right':
694
+ case 'bottom':
695
+ return '100%';
696
+
697
+ case 'center':
698
+ return '50%';
699
+
700
+ default:
701
+ return null;
702
+ }
703
+ };
704
+
705
+ var transformObjectPosition = function transformObjectPosition(value) {
706
+ return offsetKeyword(value) || castFloat(value);
707
+ };
708
+
709
+ var transformTransformOrigin = function transformTransformOrigin(value) {
710
+ return offsetKeyword(value) || castFloat(value);
711
+ };
712
+
713
+ var handlers = {
714
+ transform: processTransform,
715
+ fontWeight: processFontWeight,
716
+ objectPositionX: transformObjectPosition,
717
+ objectPositionY: transformObjectPosition,
718
+ transformOriginX: transformTransformOrigin,
719
+ transformOriginY: transformTransformOrigin
720
+ };
721
+
722
+ var transformStyle = function transformStyle(key, value, container) {
723
+ var result = handlers[key] ? handlers[key](value) : value;
724
+ return transformColor(transformUnit(container, castFloat(result)));
725
+ };
726
+ /**
727
+ * Transform styles values
728
+ *
729
+ * @param {Object} styles object
730
+ * @returns {Object} transformed styles
731
+ */
732
+
733
+
734
+ var transform = function transform(container) {
735
+ return function (style) {
736
+ if (!style) return style;
737
+ var propsArray = Object.keys(style);
738
+ var resolvedStyle = {};
739
+
740
+ for (var i = 0; i < propsArray.length; i += 1) {
741
+ var key = propsArray[i];
742
+ var value = style[key];
743
+ var transformed = transformStyle(key, value, container);
744
+ resolvedStyle[key] = transformed;
745
+ }
746
+
747
+ return resolvedStyle;
748
+ };
749
+ };
750
+
751
+ /**
752
+ * Resolves media queries in styles object
753
+ *
754
+ * @param {Object} container
755
+ * @param {Object} styles object
756
+ */
757
+
758
+ var resolveMediaQueries = function resolveMediaQueries(container, styles) {
759
+ return Object.keys(styles).reduce(function (acc, key) {
760
+ var _extends2;
761
+
762
+ if (/@media/.test(key)) {
763
+ var _matchMedia;
764
+
765
+ return _extends({}, acc, matchMedia((_matchMedia = {}, _matchMedia[key] = styles[key], _matchMedia), container));
766
+ }
767
+
768
+ return _extends({}, acc, (_extends2 = {}, _extends2[key] = styles[key], _extends2));
769
+ }, {});
770
+ };
771
+
772
+ /**
773
+ * Resolves styles
774
+ *
775
+ * @param {Object} container
776
+ * @param {Object} style object
777
+ * @returns {Object} resolved style object
778
+ */
779
+
780
+ var resolveStyles = function resolveStyles(container, style) {
781
+ var computeMediaQueries = function computeMediaQueries(value) {
782
+ return resolveMediaQueries(container, value);
783
+ };
784
+
785
+ return compose(transform(container), expand, computeMediaQueries, flatten)(style);
786
+ }; // Utils exported for SVG processing
787
+
788
+ export { resolveStyles as default, flatten, processTransform, transformColor };