tailwind_css_fixes/modules/borders/divide/
mod.rs

1pub(crate) mod divide_color;
2pub(crate) mod divide_reverse;
3pub(crate) mod divide_style;
4pub(crate) mod divide_width;
5
6use super::*;
7
8#[derive(Copy, Clone, Debug, Default)]
9pub struct TailwindDivide {}
10
11impl TailwindDivide {
12    /// Parse the instructions starting with `divide`.
13    pub fn adapt(pattern: &[&str], arbitrary: &TailwindArbitrary) -> Result<Box<dyn TailwindInstance>> {
14
15        let out = match pattern {
16            // --- Divide Width ---
17             // https://tailwindcss.com/docs/divide-width
18            ["x", "reverse"] => TailwindDivideReverse::from(true).boxed(), // true = X-axis
19            ["y", "reverse"] => TailwindDivideReverse::from(false).boxed(), // false = Y-axis
20
21            // Catches all other width-related classes:
22            // e.g., divide-x, divide-y, divide-x-2, divide-y-[3px]
23            ["x", rest @ ..] => TailwindDivideWidth::parse(rest, arbitrary, true)?.boxed(),
24            ["y", rest @ ..] => TailwindDivideWidth::parse(rest, arbitrary, false)?.boxed(),
25
26            // --- Divide Style (Alias to TailwindBorderStyle) ---
27            // https://tailwindcss.com/docs/border-style#setting-the-divider-style
28            [s @ ("solid" | "dashed" | "dotted" | "double" | "hidden" | "none")] => TailwindDivideStyle::from(*s).boxed(),
29
30
31            // --- Divide Color  ---
32            // https://tailwindcss.com/docs/border-color#divider-between-children
33            // If not a width, reverse, or style, it's a color
34            _ => TailwindDivideColor::parse(pattern, arbitrary)?.boxed(),
35        };
36        Ok(out)
37    }
38}