tailwind_css_fixes/modules/borders/divide/divide_style/
mod.rs

1use super::*;
2use crate::StandardValue;
3
4#[doc=include_str!("readme.md")]
5#[derive(Clone, Debug)]
6pub struct TailwindDivideStyle {
7    kind: StandardValue,
8}
9
10impl<T> From<T> for TailwindDivideStyle
11where
12    T: Into<String>,
13{
14    fn from(input: T) -> Self {
15        Self { kind: StandardValue::from(input.into()) }
16    }
17}
18
19impl Display for TailwindDivideStyle {
20    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
21        write!(f, "divide-{}", self.kind)
22    }
23}
24
25impl TailwindInstance for TailwindDivideStyle {
26    fn inlineable(&self) -> bool {
27        false
28    }
29    fn selectors(&self, _: &TailwindBuilder) -> String {
30        // format!(".divide-{} > * + *", self.kind)
31        format!(".divide-{}>:not([hidden])~:not([hidden])", self.kind)
32    }
33    fn attributes(&self, _: &TailwindBuilder) -> CssAttributes {
34        css_attributes! {
35            "divide-style" => self.kind
36        }
37    }
38}
39
40impl TailwindDivideStyle {
41    /// https://tailwindcss.com/docs/divide-style
42    pub fn parse(pattern: &[&str], arbitrary: &TailwindArbitrary) -> Result<Self> {
43        let kind = StandardValue::parser("divide-style", &Self::check_valid)(pattern, arbitrary)?;
44        Ok(Self { kind })
45    }
46    /// https://developer.mozilla.org/en-US/docs/Web/CSS/border-style#syntax
47    pub fn check_valid(mode: &str) -> bool {
48        TailwindBorderStyle::check_valid(mode)
49    }
50}