Skip to content

Commit

Permalink
feat: make a bunch of plugins support arbitrary parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Dec 25, 2022
1 parent 497a8b1 commit 21dbe0b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
36 changes: 18 additions & 18 deletions crates/tailwind-parse/src/eval/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,21 +254,21 @@ merge_plugins!(ring_base, ring_width, ring_color);
lookup_plugin!(to, colors, "--tw-gradient-to");
lookup_plugin_arbitrary!(w, width, "width");
lookup_plugin!(rotate, rotate, "--tw-rotate");
lookup_plugin!(p, padding, "padding");
lookup_plugin!(pl, padding, "paddingLeft");
lookup_plugin!(pr, padding, "paddingRight");
lookup_plugin!(pt, padding, "paddingTop");
lookup_plugin!(pb, padding, "paddingBottom");

lookup_plugin!(m, margin, "margin");
lookup_plugin!(ml, margin, "marginLeft");
lookup_plugin!(mr, margin, "marginRight");
lookup_plugin!(mt, margin, "marginTop");
lookup_plugin!(mb, margin, "marginBottom");
lookup_plugin!(z, z_index, "zIndex");
lookup_plugin_arbitrary!(p, padding, "padding");
lookup_plugin_arbitrary!(pl, padding, "paddingLeft");
lookup_plugin_arbitrary!(pr, padding, "paddingRight");
lookup_plugin_arbitrary!(pt, padding, "paddingTop");
lookup_plugin_arbitrary!(pb, padding, "paddingBottom");

lookup_plugin_arbitrary!(m, margin, "margin");
lookup_plugin_arbitrary!(ml, margin, "marginLeft");
lookup_plugin_arbitrary!(mr, margin, "marginRight");
lookup_plugin_arbitrary!(mt, margin, "marginTop");
lookup_plugin_arbitrary!(mb, margin, "marginBottom");
lookup_plugin_arbitrary!(z, z_index, "zIndex");
lookup_plugin_arbitrary!(gap, gap, "gap");
lookup_plugin!(gap_x, gap, "columnGap");
lookup_plugin!(gap_y, gap, "rowGap");
lookup_plugin_arbitrary!(gap_x, gap, "columnGap");
lookup_plugin_arbitrary!(gap_y, gap, "rowGap");
lookup_plugin!(cursor, cursor, "cursor");
lookup_plugin!(scale, scale, "transform", |v| format!("scale({v})"));

Expand Down Expand Up @@ -419,10 +419,10 @@ array_plugin!(
lookup_plugin_arbitrary!(translate_x, translate, "--tw-translate-x");
lookup_plugin_arbitrary!(translate_y, translate, "--tw-translate-y");

merge_plugins!(my, mt, mb);
merge_plugins!(mx, ml, mr);
merge_plugins!(py, pt, pb);
merge_plugins!(px, pl, pr);
merge_plugins_arbitrary!(my, mt, mb);
merge_plugins_arbitrary!(mx, ml, mr);
merge_plugins_arbitrary!(py, pt, pb);
merge_plugins_arbitrary!(px, pl, pr);

pub fn rounded<'a>(
subcommand: Option<Rounded>,
Expand Down
34 changes: 17 additions & 17 deletions crates/tailwind-parse/src/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ impl<'a> Literal<'a> {
Justify => Required(plugin::justify),
Items => Required(plugin::items),
Gap(None) => RequiredArbitrary(plugin::gap),
Gap(Some(Gap::X)) => Required(plugin::gap_x),
Gap(Some(Gap::Y)) => Required(plugin::gap_y),
Gap(Some(Gap::X)) => RequiredArbitrary(plugin::gap_x),
Gap(Some(Gap::Y)) => RequiredArbitrary(plugin::gap_y),
Cursor => Required(plugin::cursor),
Scale => Required(plugin::scale),
Box => Required(plugin::box_),
Expand All @@ -147,22 +147,22 @@ impl<'a> Literal<'a> {
H => RequiredArbitrary(plugin::h),
W => RequiredArbitrary(plugin::w),
TransformOrigin => Required(plugin::transform_origin),
P => Required(plugin::p),
Px => Required(plugin::px),
Pl => Required(plugin::pl),
Pr => Required(plugin::pr),
P => RequiredArbitrary(plugin::p),
Px => RequiredArbitrary(plugin::px),
Pl => RequiredArbitrary(plugin::pl),
Pr => RequiredArbitrary(plugin::pr),
VerticalAlign => Required(plugin::align),
Py => Required(plugin::py),
Pt => Required(plugin::pt),
Pb => Required(plugin::pb),
M => Required(plugin::m),
Mx => Required(plugin::mx),
Ml => Required(plugin::ml),
Mr => Required(plugin::mr),
My => Required(plugin::my),
Mt => Required(plugin::mt),
Mb => Required(plugin::mb),
Z => Required(plugin::z),
Py => RequiredArbitrary(plugin::py),
Pt => RequiredArbitrary(plugin::pt),
Pb => RequiredArbitrary(plugin::pb),
M => RequiredArbitrary(plugin::m),
Mx => RequiredArbitrary(plugin::mx),
Ml => RequiredArbitrary(plugin::ml),
Mr => RequiredArbitrary(plugin::mr),
My => RequiredArbitrary(plugin::my),
Mt => RequiredArbitrary(plugin::mt),
Mb => RequiredArbitrary(plugin::mb),
Z => RequiredArbitrary(plugin::z),
Min(Min::H) => RequiredArbitrary(plugin::min_h),
Min(Min::W) => RequiredArbitrary(plugin::min_w),
Max(Max::H) => RequiredArbitrary(plugin::max_h),
Expand Down

0 comments on commit 21dbe0b

Please sign in to comment.