1pub use super::box_align::{AlignContent, AlignItems, AlignSelf, JustifyContent};
2use crate::{unit::*, Style, StyleUpdater};
3
4#[derive(Clone, Debug, PartialEq, Display, From)]
5pub enum Basis {
6 #[display(fmt = "content")]
7 Content,
8 #[display(fmt = "auto")]
9 Auto,
10 #[display(fmt = "inherit")]
11 Inherit,
12 #[from]
13 Length(Length),
14 #[from(forward)]
15 Percent(Percent),
16}
17
18impl StyleUpdater for Basis {
19 fn update_style(self, style: Style) -> Style {
20 style.insert("flex-basis", self)
21 }
22}
23
24#[derive(Clone, Debug, Copy, PartialEq, Eq, Display, From)]
25pub enum Direction {
26 #[display(fmt = "row")]
27 Row,
28 #[display(fmt = "row-reverse")]
29 RowReverse,
30 #[display(fmt = "column")]
31 Column,
32 #[display(fmt = "column-reverse")]
33 ColumnReverse,
34}
35
36impl StyleUpdater for Direction {
37 fn update_style(self, style: Style) -> Style {
38 style.insert("flex-direction", self)
39 }
40}
41
42#[derive(Clone, Debug, Copy, PartialEq, Eq, Display, From)]
43pub enum Wrap {
44 #[display(fmt = "wrap")]
45 Wrap,
46 #[display(fmt = "nowrap")]
47 Nowrap,
48 #[display(fmt = "wrap-reverse")]
49 WrapReverse,
50}
51
52impl StyleUpdater for Wrap {
53 fn update_style(self, style: Style) -> Style {
54 style.insert("flex-wrap", self)
55 }
56}
57
58#[derive(Clone, Debug, Copy, PartialEq, Eq, Display, From)]
59pub struct Order(i32);
60
61impl StyleUpdater for Order {
62 fn update_style(self, style: Style) -> Style {
63 style.insert("order", self.0)
64 }
65}
66
67#[derive(Clone, Debug, Copy, PartialEq, Display, From)]
68pub struct Grow(f32);
69
70impl From<u16> for Grow {
71 fn from(source: u16) -> Self {
72 Grow(source.into())
73 }
74}
75
76impl StyleUpdater for Grow {
77 fn update_style(self, style: Style) -> Style {
78 style.insert("flex-grow", self.0)
79 }
80}
81
82#[derive(Clone, Debug, Copy, PartialEq, Display, From)]
83pub struct Shrink(f32);
84
85impl From<u16> for Shrink {
86 fn from(source: u16) -> Self {
87 Shrink(source.into())
88 }
89}
90
91impl StyleUpdater for Shrink {
92 fn update_style(self, style: Style) -> Style {
93 style.insert("flex-shrink", self.0)
94 }
95}