tailwind_css_fixes/modules/flexbox/content/content_align/
mod.rs

1use super::*;
2
3#[doc=include_str!("readme.md")]
4#[derive(Clone, Debug)]
5pub struct TailwindContentAlign {
6    kind: StandardValue,
7}
8
9crate::macros::sealed::keyword_instance!(TailwindContentAlign => "align-content");
10
11impl Display for TailwindContentAlign {
12    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
13        write!(f, "content-align-{}", self.kind)
14    }
15}
16
17impl TailwindContentAlign {
18    /// https://tailwindcss.com/docs/align-content
19    pub fn parse(pattern: &[&str], arbitrary: &TailwindArbitrary) -> Result<Self> {
20        let kind = StandardValue::parser("content-align", &Self::check_valid)(pattern, arbitrary)?;
21        Ok(Self { kind })
22    }
23    /// https://developer.mozilla.org/en-US/docs/Web/CSS/align-content#syntax
24    pub fn check_valid(mode: &str) -> bool {
25        let set = BTreeSet::from_iter(vec![
26            "baseline",
27            "center",
28            "end",
29            "first-baseline",
30            "flex-end",
31            "flex-start",
32            "inherit",
33            "initial",
34            "last-baseline",
35            "normal",
36            "revert",
37            "safe-center",
38            "space-around",
39            "space-between",
40            "space-evenly",
41            "start",
42            "stretch",
43            "unsafe-center",
44            "unset",
45        ]);
46        set.contains(mode)
47    }
48}