@@ -47,6 +47,15 @@ import whitespace from '../generators/whitespace'
4747import width from '../generators/width'
4848import zIndex from '../generators/zIndex'
4949
50+ function withVariants ( module , variants ) {
51+ return _ . reduce ( variants , ( module , variant ) => {
52+ return {
53+ responsive : responsive ,
54+ hover : hoverable ,
55+ } [ variant ] ( module )
56+ } , module )
57+ }
58+
5059export default function ( config ) {
5160 return function ( css ) {
5261 const unwrappedConfig = config ( )
@@ -57,47 +66,47 @@ export default function(config) {
5766 nodes : _ . flatten ( [
5867 // The `lists` module needs to be first to allow overriding the margin and
5968 // padding values that it sets with other utilities.
60- responsive ( lists ( unwrappedConfig ) ) ,
61- responsive ( appearance ( unwrappedConfig ) ) ,
62- responsive ( hoverable ( backgroundColors ( unwrappedConfig ) ) ) ,
63- responsive ( backgroundPosition ( unwrappedConfig ) ) ,
64- responsive ( backgroundSize ( unwrappedConfig ) ) ,
65- responsive ( hoverable ( borderColors ( unwrappedConfig ) ) ) ,
66- responsive ( borderRadius ( unwrappedConfig ) ) ,
67- responsive ( borderStyle ( unwrappedConfig ) ) ,
68- responsive ( borderWidths ( unwrappedConfig ) ) ,
69- responsive ( cursor ( unwrappedConfig ) ) ,
70- responsive ( display ( unwrappedConfig ) ) ,
71- responsive ( flexbox ( unwrappedConfig ) ) ,
72- responsive ( float ( unwrappedConfig ) ) ,
73- responsive ( fonts ( unwrappedConfig ) ) ,
74- responsive ( hoverable ( fontWeights ( unwrappedConfig ) ) ) ,
75- responsive ( height ( unwrappedConfig ) ) ,
76- responsive ( leading ( unwrappedConfig ) ) ,
77- responsive ( margin ( unwrappedConfig ) ) ,
78- responsive ( maxHeight ( unwrappedConfig ) ) ,
79- responsive ( maxWidth ( unwrappedConfig ) ) ,
80- responsive ( minHeight ( unwrappedConfig ) ) ,
81- responsive ( minWidth ( unwrappedConfig ) ) ,
82- responsive ( negativeMargin ( unwrappedConfig ) ) ,
83- responsive ( opacity ( unwrappedConfig ) ) ,
84- responsive ( overflow ( unwrappedConfig ) ) ,
85- responsive ( padding ( unwrappedConfig ) ) ,
86- responsive ( pointerEvents ( unwrappedConfig ) ) ,
87- responsive ( position ( unwrappedConfig ) ) ,
88- responsive ( resize ( unwrappedConfig ) ) ,
89- responsive ( shadows ( unwrappedConfig ) ) ,
90- responsive ( textAlign ( unwrappedConfig ) ) ,
91- responsive ( hoverable ( textColors ( unwrappedConfig ) ) ) ,
92- responsive ( textSizes ( unwrappedConfig ) ) ,
93- responsive ( hoverable ( textStyle ( unwrappedConfig ) ) ) ,
94- responsive ( tracking ( unwrappedConfig ) ) ,
95- responsive ( userSelect ( unwrappedConfig ) ) ,
96- responsive ( verticalAlign ( unwrappedConfig ) ) ,
97- responsive ( visibility ( unwrappedConfig ) ) ,
98- responsive ( whitespace ( unwrappedConfig ) ) ,
99- responsive ( width ( unwrappedConfig ) ) ,
100- responsive ( zIndex ( unwrappedConfig ) ) ,
69+ withVariants ( lists ( unwrappedConfig ) , unwrappedConfig . options . modules . lists ) ,
70+ withVariants ( appearance ( unwrappedConfig ) , unwrappedConfig . options . modules . appearance ) ,
71+ withVariants ( backgroundColors ( unwrappedConfig ) , unwrappedConfig . options . modules . backgroundColors ) ,
72+ withVariants ( backgroundPosition ( unwrappedConfig ) , unwrappedConfig . options . modules . backgroundPosition ) ,
73+ withVariants ( backgroundSize ( unwrappedConfig ) , unwrappedConfig . options . modules . backgroundSize ) ,
74+ withVariants ( borderColors ( unwrappedConfig ) , unwrappedConfig . options . modules . borderColors ) ,
75+ withVariants ( borderRadius ( unwrappedConfig ) , unwrappedConfig . options . modules . borderRadius ) ,
76+ withVariants ( borderStyle ( unwrappedConfig ) , unwrappedConfig . options . modules . borderStyle ) ,
77+ withVariants ( borderWidths ( unwrappedConfig ) , unwrappedConfig . options . modules . borderWidths ) ,
78+ withVariants ( cursor ( unwrappedConfig ) , unwrappedConfig . options . modules . cursor ) ,
79+ withVariants ( display ( unwrappedConfig ) , unwrappedConfig . options . modules . display ) ,
80+ withVariants ( flexbox ( unwrappedConfig ) , unwrappedConfig . options . modules . flexbox ) ,
81+ withVariants ( float ( unwrappedConfig ) , unwrappedConfig . options . modules . float ) ,
82+ withVariants ( fonts ( unwrappedConfig ) , unwrappedConfig . options . modules . fonts ) ,
83+ withVariants ( fontWeights ( unwrappedConfig ) , unwrappedConfig . options . modules . fontWeights ) ,
84+ withVariants ( height ( unwrappedConfig ) , unwrappedConfig . options . modules . height ) ,
85+ withVariants ( leading ( unwrappedConfig ) , unwrappedConfig . options . modules . leading ) ,
86+ withVariants ( margin ( unwrappedConfig ) , unwrappedConfig . options . modules . margin ) ,
87+ withVariants ( maxHeight ( unwrappedConfig ) , unwrappedConfig . options . modules . maxHeight ) ,
88+ withVariants ( maxWidth ( unwrappedConfig ) , unwrappedConfig . options . modules . maxWidth ) ,
89+ withVariants ( minHeight ( unwrappedConfig ) , unwrappedConfig . options . modules . minHeight ) ,
90+ withVariants ( minWidth ( unwrappedConfig ) , unwrappedConfig . options . modules . minWidth ) ,
91+ withVariants ( negativeMargin ( unwrappedConfig ) , unwrappedConfig . options . modules . negativeMargin ) ,
92+ withVariants ( opacity ( unwrappedConfig ) , unwrappedConfig . options . modules . opacity ) ,
93+ withVariants ( overflow ( unwrappedConfig ) , unwrappedConfig . options . modules . overflow ) ,
94+ withVariants ( padding ( unwrappedConfig ) , unwrappedConfig . options . modules . padding ) ,
95+ withVariants ( pointerEvents ( unwrappedConfig ) , unwrappedConfig . options . modules . pointerEvents ) ,
96+ withVariants ( position ( unwrappedConfig ) , unwrappedConfig . options . modules . position ) ,
97+ withVariants ( resize ( unwrappedConfig ) , unwrappedConfig . options . modules . resize ) ,
98+ withVariants ( shadows ( unwrappedConfig ) , unwrappedConfig . options . modules . shadows ) ,
99+ withVariants ( textAlign ( unwrappedConfig ) , unwrappedConfig . options . modules . textAlign ) ,
100+ withVariants ( textColors ( unwrappedConfig ) , unwrappedConfig . options . modules . textColors ) ,
101+ withVariants ( textSizes ( unwrappedConfig ) , unwrappedConfig . options . modules . textSizes ) ,
102+ withVariants ( textStyle ( unwrappedConfig ) , unwrappedConfig . options . modules . textStyle ) ,
103+ withVariants ( tracking ( unwrappedConfig ) , unwrappedConfig . options . modules . tracking ) ,
104+ withVariants ( userSelect ( unwrappedConfig ) , unwrappedConfig . options . modules . userSelect ) ,
105+ withVariants ( verticalAlign ( unwrappedConfig ) , unwrappedConfig . options . modules . verticalAlign ) ,
106+ withVariants ( visibility ( unwrappedConfig ) , unwrappedConfig . options . modules . visibility ) ,
107+ withVariants ( whitespace ( unwrappedConfig ) , unwrappedConfig . options . modules . whitespace ) ,
108+ withVariants ( width ( unwrappedConfig ) , unwrappedConfig . options . modules . width ) ,
109+ withVariants ( zIndex ( unwrappedConfig ) , unwrappedConfig . options . modules . zIndex ) ,
101110 ] ) ,
102111 } )
103112
0 commit comments