tailwind_css_fixes/modules/interactivity/cursor/
mod.rs

1use crate::StandardValue;
2
3use super::*;
4
5#[doc=include_str!("readme.md")]
6#[derive(Debug, Clone)]
7pub struct TailwindCursor {
8    kind: StandardValue,
9}
10
11crate::macros::sealed::keyword_instance!(TailwindCursor => "cursor");
12
13impl Display for TailwindCursor {
14    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
15        write!(f, "cursor-{}", self.kind)
16    }
17}
18
19impl TailwindCursor {
20    /// <https://tailwindcss.com/docs/cursor>
21    pub fn parse(pattern: &[&str], arbitrary: &TailwindArbitrary) -> Result<Self> {
22        let kind = StandardValue::parser("cursor", &Self::check_valid)(pattern, arbitrary)?;
23        Ok(Self { kind })
24    }
25    /// https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#syntax
26    pub fn check_valid(mode: &str) -> bool {
27        let set = BTreeSet::from_iter(vec![
28            "alias",
29            "all-scroll",
30            "auto",
31            "cell",
32            "col-resize",
33            "context-menu",
34            "copy",
35            "crosshair",
36            "default",
37            "e-resize",
38            "ew-resize",
39            "grab",
40            "grabbing",
41            "help",
42            "inherit",
43            "initial",
44            "move",
45            "ne-resize",
46            "nesw-resize",
47            "no-drop",
48            "none",
49            "not-allowed",
50            "n-resize",
51            "ns-resize",
52            "nw-resize",
53            "nwse-resize",
54            "pointer",
55            "progress",
56            "revert",
57            "row-resize",
58            "se-resize",
59            "s-resize",
60            "sw-resize",
61            "text",
62            "unset",
63            "vertical-text",
64            "wait",
65            "w-resize",
66            "zoom-in",
67            "zoom-out",
68        ]);
69        set.contains(mode)
70    }
71}