1+ 'use strict' ;
2+
3+ Object . defineProperty ( exports , '__esModule' , {
4+ value : true
5+ } ) ;
6+
7+ var _createClass = ( function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( 'value' in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ) ( ) ;
8+
9+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { 'default' : obj } ; }
10+
11+ function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( 'Cannot call a class as a function' ) ; } }
12+
13+ var _utilsGetBrowserInformation = require ( './utils/getBrowserInformation' ) ;
14+
15+ var _utilsGetBrowserInformation2 = _interopRequireDefault ( _utilsGetBrowserInformation ) ;
16+
17+ var _utilsCapitalizeString = require ( './utils/capitalizeString' ) ;
18+
19+ var _utilsCapitalizeString2 = _interopRequireDefault ( _utilsCapitalizeString ) ;
20+
21+ var _utilsAssign = require ( './utils/assign' ) ;
22+
23+ var _utilsAssign2 = _interopRequireDefault ( _utilsAssign ) ;
24+
25+ var _caniuseData = require ( './caniuseData' ) ;
26+
27+ var _caniuseData2 = _interopRequireDefault ( _caniuseData ) ;
28+
29+ var _Plugins = require ( './Plugins' ) ;
30+
31+ var _Plugins2 = _interopRequireDefault ( _Plugins ) ;
32+
33+ var prefixes = _caniuseData2 [ 'default' ] ;
34+ var browserInfo = ( 0 , _utilsGetBrowserInformation2 [ 'default' ] ) ( ) ;
35+
36+ var Prefixer = ( function ( ) {
37+ function Prefixer ( ) {
38+ _classCallCheck ( this , Prefixer ) ;
39+ }
40+
41+ _createClass ( Prefixer , null , [ {
42+ key : 'prefixAll' ,
43+
44+ /**
45+ * Returns a prefixed version of the style object using all vendor prefixes
46+ * @param {Object } styles - Style object that gets prefixed properties added
47+ * @returns {Object } - Style object with prefixed properties and values
48+ */
49+ value : function prefixAll ( styles ) {
50+ styles = ( 0 , _utilsAssign2 [ 'default' ] ) ( { } , styles ) ;
51+
52+ Object . keys ( styles ) . forEach ( function ( property ) {
53+ var value = styles [ property ] ;
54+ if ( value instanceof Object ) {
55+ // recurse through nested style objects
56+ styles [ property ] = Prefixer . prefixAll ( value ) ;
57+ } else {
58+ var browsers = Object . keys ( browserInfo . prefixes ) ;
59+ browsers . forEach ( function ( browser ) {
60+ var style = browserInfo . prefixes [ browser ] ;
61+ // add prefixes if needed
62+ if ( prefixes [ property ] != null ) {
63+ styles [ style . inline + ( 0 , _utilsCapitalizeString2 [ 'default' ] ) ( property ) ] = value ;
64+ }
65+ } ) ;
66+
67+ // resolve plugins for each browser
68+ _Plugins2 [ 'default' ] . forEach ( function ( plugin ) {
69+ var resolvedStyles = plugin ( {
70+ property : property ,
71+ value : value ,
72+ styles : styles ,
73+ prefix : { } ,
74+ keepUnprefixed : true ,
75+ requiresPrefix : prefixes
76+ } ) ;
77+ ( 0 , _utilsAssign2 [ 'default' ] ) ( styles , resolvedStyles ) ;
78+ } ) ;
79+ }
80+ } ) ;
81+
82+ return styles ;
83+ }
84+ } ] ) ;
85+
86+ return Prefixer ;
87+ } ) ( ) ;
88+
89+ exports [ 'default' ] = Prefixer ;
90+ module . exports = exports [ 'default' ] ;
0 commit comments