#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum AlignmentSafety {
Default,
Unsafe,
Safe,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum ContentAlignmentKeyword {
Normal,
Start,
End,
FlexStart,
FlexEnd,
Left,
Right,
Center,
Stretch,
SpaceBetween,
SpaceAround,
SpaceEvenly,
Baseline,
LastBaseline,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) struct ContentAlignment {
pub keyword: ContentAlignmentKeyword,
pub safety: AlignmentSafety,
}
impl ContentAlignment {
pub const NORMAL: Self = Self::new(ContentAlignmentKeyword::Normal);
pub const fn new(keyword: ContentAlignmentKeyword) -> Self {
Self {
keyword,
safety: AlignmentSafety::Default,
}
}
pub const fn safe(keyword: ContentAlignmentKeyword) -> Self {
Self {
keyword,
safety: AlignmentSafety::Safe,
}
}
pub const fn unsafe_position(keyword: ContentAlignmentKeyword) -> Self {
Self {
keyword,
safety: AlignmentSafety::Unsafe,
}
}
}
pub(crate) type JustifyContent = ContentAlignment;
pub(crate) type AlignContent = ContentAlignment;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum SelfAlignmentKeyword {
Auto,
Normal,
Start,
End,
SelfStart,
SelfEnd,
FlexStart,
FlexEnd,
Left,
Right,
Center,
Stretch,
Baseline,
LastBaseline,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) struct SelfAlignment {
pub keyword: SelfAlignmentKeyword,
pub safety: AlignmentSafety,
}
impl SelfAlignment {
pub const AUTO: Self = Self::new(SelfAlignmentKeyword::Auto);
pub const NORMAL: Self = Self::new(SelfAlignmentKeyword::Normal);
pub const fn new(keyword: SelfAlignmentKeyword) -> Self {
Self {
keyword,
safety: AlignmentSafety::Default,
}
}
pub const fn safe(keyword: SelfAlignmentKeyword) -> Self {
Self {
keyword,
safety: AlignmentSafety::Safe,
}
}
pub const fn unsafe_position(keyword: SelfAlignmentKeyword) -> Self {
Self {
keyword,
safety: AlignmentSafety::Unsafe,
}
}
}
pub(crate) type JustifyItems = SelfAlignment;
pub(crate) type JustifySelf = SelfAlignment;
pub(crate) type AlignItems = SelfAlignment;
pub(crate) type AlignSelf = SelfAlignment;