Skip to main content

euv_core/style/layout_prop/
enum.rs

1/// Box display mode determining how a node lays out its children.
2#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3pub enum Display {
4    /// Flexbox container layout (default for cross-platform consistency).
5    #[default]
6    Flex,
7    /// Vertical block flow layout.
8    Block,
9    /// Multi-column CSS Grid-like layout.
10    Grid,
11    /// Node is omitted from layout and painting.
12    None,
13}
14
15/// Positioning strategy relative to parent or viewport.
16#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub enum Position {
18    /// Normal flow participation with optional offset.
19    #[default]
20    Relative,
21    /// Positioned relative to the nearest non-static ancestor.
22    Absolute,
23    /// Positioned relative to the root viewport.
24    Fixed,
25}
26
27/// Main-axis direction for flex containers.
28#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub enum FlexDirection {
30    /// Left-to-right horizontal row.
31    #[default]
32    Row,
33    /// Top-to-bottom vertical column.
34    Column,
35    /// Right-to-left horizontal row.
36    RowReverse,
37    /// Bottom-to-top vertical column.
38    ColumnReverse,
39}
40
41/// Line wrapping behavior for flex containers.
42#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub enum FlexWrap {
44    /// Keep all children on a single line.
45    #[default]
46    NoWrap,
47    /// Wrap overflowing children onto subsequent lines.
48    Wrap,
49}
50
51/// Main-axis alignment inside a flex or grid container.
52#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
53pub enum JustifyContent {
54    /// Pack items at the start of the main axis.
55    #[default]
56    Start,
57    /// Center items along the main axis.
58    Center,
59    /// Pack items at the end of the main axis.
60    End,
61    /// Distribute space evenly between items.
62    SpaceBetween,
63    /// Distribute space around each item.
64    SpaceAround,
65    /// Distribute equal space between items and edges.
66    SpaceEvenly,
67}
68
69/// Cross-axis alignment inside a flex or grid container.
70#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
71pub enum AlignItems {
72    /// Stretch items to fill cross-axis extent.
73    #[default]
74    Stretch,
75    /// Align items at cross-axis start.
76    Start,
77    /// Center items along cross axis.
78    Center,
79    /// Align items at cross-axis end.
80    End,
81}
82
83/// Per-item cross-axis alignment override.
84#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
85pub enum AlignSelf {
86    /// Inherit alignment from parent container.
87    #[default]
88    Auto,
89    /// Stretch across the cross axis.
90    Stretch,
91    /// Align at cross-axis start.
92    Start,
93    /// Center on the cross axis.
94    Center,
95    /// Align at cross-axis end.
96    End,
97}
98
99/// Overflow clipping and scrolling behavior.
100#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
101pub enum Overflow {
102    /// Content may render outside box bounds.
103    #[default]
104    Visible,
105    /// Content outside box bounds is clipped.
106    Hidden,
107    /// Content outside box bounds is clipped and scrollable.
108    Scroll,
109}
110
111/// Responsive layout breakpoint class unified across all 7 platforms.
112#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
113pub enum Breakpoint {
114    /// Compact viewport (`< 768px`, phones and narrow split-views).
115    Compact,
116    /// Medium viewport (`768px..1024px`, tablets / iPadOS portrait).
117    Medium,
118    /// Expanded viewport (`>= 1024px`, desktops and iPadOS landscape).
119    #[default]
120    Expanded,
121}