@@ -102,6 +102,19 @@ macro_rules! merge_plugins {
102
102
} ;
103
103
}
104
104
105
+ macro_rules! merge_plugins_arbitrary {
106
+ ( $def: ident, $closure_a: expr, $closure_b: expr) => {
107
+ pub fn $def( rest: & SubjectValue , theme: & TailwindTheme ) -> Option <ObjectLit > {
108
+ match ( $closure_a( rest, theme) , $closure_b( rest, theme) ) {
109
+ ( None , None ) => None ,
110
+ ( None , Some ( a) ) => Some ( a) ,
111
+ ( Some ( b) , None ) => Some ( b) ,
112
+ ( Some ( a) , Some ( b) ) => Some ( merge_literals( a, b) ) ,
113
+ }
114
+ }
115
+ } ;
116
+ }
117
+
105
118
macro_rules! merge_plugins_opt {
106
119
( $def: ident, $closure_a: expr, $closure_b: expr) => {
107
120
pub fn $def( rest: Option <& Value >, theme: & TailwindTheme ) -> Option <ObjectLit > {
@@ -150,14 +163,14 @@ lookup_plugin_opt!(invert, invert, "filter", |s| format!("invert({s})"));
150
163
lookup_plugin ! ( basis, flex_basis, "flexBasis" ) ;
151
164
lookup_plugin_opt ! ( grow, flex_grow, "flexGrow" ) ;
152
165
lookup_plugin_opt ! ( shrink, flex_shrink, "flexShrink" ) ;
153
- lookup_plugin ! ( top, height, "top" ) ;
166
+ lookup_plugin_arbitrary ! ( top, height, "top" ) ;
154
167
lookup_plugin ! ( opacity, opacity, "opacity" ) ;
155
168
lookup_plugin ! ( animation, animation, "animation" ) ;
156
169
lookup_plugin ! ( order, order, "order" ) ;
157
- lookup_plugin ! ( bottom, height, "bottom" ) ;
170
+ lookup_plugin_arbitrary ! ( bottom, height, "bottom" ) ;
158
171
lookup_plugin ! ( fill, colors, "fill" ) ;
159
- lookup_plugin ! ( left, width, "left" ) ;
160
- lookup_plugin ! ( right, width, "right" ) ;
172
+ lookup_plugin_arbitrary ! ( left, width, "left" ) ;
173
+ lookup_plugin_arbitrary ! ( right, width, "right" ) ;
161
174
lookup_plugin_arbitrary ! ( tracking, letter_spacing, "letterSpacing" ) ;
162
175
lookup_plugin_arbitrary ! ( h, height, "height" ) ;
163
176
lookup_plugin ! ( to, colors, "--tw-gradient-to" ) ;
@@ -501,9 +514,9 @@ merge_plugins_arbitrary_opt!(border_y, border_t, border_b);
501
514
merge_plugins_arbitrary_opt ! ( border_cw, border_color, border_width) ;
502
515
merge_plugins_arbitrary_opt ! ( border_inner, border_cw, border_style) ;
503
516
504
- merge_plugins ! ( inset_x, left, right) ;
505
- merge_plugins ! ( inset_y, top, bottom) ;
506
- merge_plugins ! ( inset, inset_x, inset_y) ;
517
+ merge_plugins_arbitrary ! ( inset_x, left, right) ;
518
+ merge_plugins_arbitrary ! ( inset_y, top, bottom) ;
519
+ merge_plugins_arbitrary ! ( inset, inset_x, inset_y) ;
507
520
508
521
pub fn from ( Value ( rest) : & Value , theme : & TailwindTheme ) -> Option < ObjectLit > {
509
522
theme. colors . get ( rest) . map ( |c| {
0 commit comments