1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use super::*;
impl Display for TailwindScale {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self.axis {
None => write!(f, "scale-{}", self.scale),
Some(true) => write!(f, "scale-x-{}", self.scale),
Some(false) => write!(f, "scale-y-{}", self.scale),
}
}
}
impl TailwindInstance for TailwindScale {
fn attributes(&self, _: &TailwindBuilder) -> BTreeSet<CssAttribute> {
let scale = self.scale as f32 / 100.0;
let scale = match self.axis {
None => format!("scale({})", scale),
Some(true) => format!("scaleX({})", scale),
Some(false) => format!("scaleY({})", scale),
};
css_attributes! {
"transform" => scale
}
}
}
impl Display for TailwindRotate {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "rotate-{}", self.deg)
}
}
impl TailwindInstance for TailwindRotate {
fn attributes(&self, _: &TailwindBuilder) -> BTreeSet<CssAttribute> {
let rotate = format!("rotate({}deg)", self.deg);
css_attributes! {
"transform" => rotate
}
}
}
impl Display for TailwindTranslate {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
todo!()
}
}
impl TailwindInstance for TailwindTranslate {}
impl Display for TailwindSkew {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self.axis {
true => write!(f, "skew-x-{}", self.deg),
false => write!(f, "skew-y-{}", self.deg),
}
}
}
impl TailwindInstance for TailwindSkew {
fn attributes(&self, _: &TailwindBuilder) -> BTreeSet<CssAttribute> {
let skew = match self.axis {
true => format!("skewX({}deg)", self.deg),
false => format!("skewY({}deg)", self.deg),
};
css_attributes! {
"transform" => skew
}
}
}
impl Display for TailwindOrigin {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
todo!()
}
}
impl TailwindInstance for TailwindOrigin {}