euv_ui/component/layout/struct.rs
1use super::*;
2
3/// Dual-mode responsive application shell (Desktop / PC `>= 960px`: full-width topbar + permanent left sidebar + zero bottom nav; Mobile `< 960px`: compact topbar + overlay drawer + mobile-only bottom nav).
4#[derive(Clone, CustomDebug, Data, New, Props)]
5pub struct EuvAppShell {
6 /// Application brand title shown in sidebar or mobile top bar.
7 pub(crate) brand: String,
8 /// Mounted sidebar navigation content node.
9 #[get(type(copy))]
10 pub(crate) sidebar: NodeId,
11 /// Mounted main page content node.
12 #[get(type(copy))]
13 pub(crate) main_content: NodeId,
14 /// Active theme tokens.
15 #[get(type(copy))]
16 pub(crate) tokens: ThemeTokens,
17 /// Optional active route signal used to auto-close the mobile drawer on navigation.
18 #[new(skip)]
19 #[get(skip)]
20 pub(crate) route_signal: Option<Signal<String>>,
21 /// Optional action controls rendered on the right side of the persistent top header bar.
22 #[new(skip)]
23 #[get(skip)]
24 #[prop(custom)]
25 pub(crate) top_bar_actions: Option<NodeId>,
26 /// Optional compact inline actions rendered beside the mobile header Menu button.
27 #[new(skip)]
28 #[get(skip)]
29 #[prop(custom)]
30 pub(crate) mobile_header_actions: Option<NodeId>,
31 /// Optional footer widget rendered at the bottom of the navigation sidebar / mobile drawer.
32 #[new(skip)]
33 #[get(skip)]
34 #[prop(custom)]
35 pub(crate) sidebar_footer: Option<NodeId>,
36 /// Optional live breadcrumb / page context label rendered in the desktop top header bar.
37 #[new(skip)]
38 #[get(skip)]
39 #[prop(custom)]
40 pub(crate) breadcrumb: Option<Signal<String>>,
41 /// Optional mobile bottom navigation bar displayed exclusively on Mobile (`< 960px`) and hidden with zero padding reservation on Desktop (`>= 960px`).
42 #[new(skip)]
43 #[get(skip)]
44 #[prop(custom)]
45 pub(crate) bottom_nav: Option<NodeId>,
46 /// Ordered route paths cycled directly by horizontal left/right swipes across the viewport.
47 #[new(skip)]
48 #[prop(custom)]
49 pub(crate) swipe_routes: Vec<String>,
50 /// Optional reactive toggle enabling or disabling horizontal swipe route navigation live.
51 #[new(skip)]
52 #[get(skip)]
53 #[prop(custom)]
54 pub(crate) swipe_routes_enabled: Option<Signal<bool>>,
55 /// Whether the top navigation bar renders a live real-time FPS telemetry pill.
56 #[new(skip)]
57 #[get(type(copy))]
58 #[prop(custom)]
59 pub(crate) show_fps: bool,
60 /// Optional reactive toggle controlling visibility of the live FPS telemetry pill.
61 #[new(skip)]
62 #[get(skip)]
63 #[prop(custom)]
64 pub(crate) show_fps_signal: Option<Signal<bool>>,
65 /// Optional reactive theme controller enabling zero-teardown in-place shell restyling.
66 #[new(skip)]
67 #[get(skip)]
68 #[prop(custom)]
69 pub(crate) theme: Option<UiThemeState>,
70 /// Optional reactive per-page padding signal synchronized with an embedded `EuvRouterOutlet`.
71 #[new(skip)]
72 #[get(skip)]
73 #[prop(custom)]
74 pub(crate) page_padding: Option<Signal<Edges>>,
75 /// Whether vertical scrolling auto-hides the top bar (and mobile bottom navigation bar) cleanly during scrolling.
76 #[new(skip)]
77 #[get(type(copy))]
78 #[prop(custom)]
79 pub(crate) auto_hide_chrome_on_scroll: bool,
80 /// Optional reactive toggle enabling or disabling scroll-driven chrome auto-hide live.
81 #[new(skip)]
82 #[get(skip)]
83 #[prop(custom)]
84 pub(crate) auto_hide_chrome_signal: Option<Signal<bool>>,
85 /// Optional external URL dispatched via `open_url` when clicking the brand header (default opens the mobile drawer on Mobile).
86 #[new(skip)]
87 #[get(skip)]
88 #[prop(custom)]
89 pub(crate) brand_url: Option<String>,
90 /// Optional custom click handler overriding the top-left brand click action (default opens the mobile drawer on Mobile).
91 #[new(skip)]
92 #[debug(skip)]
93 #[get(skip)]
94 #[prop(custom)]
95 pub(crate) on_brand_click: Option<ShellBrandClickHandler>,
96 /// Optional explicit raster brand logo image rendered inside the topbar and drawer brand emblem badge.
97 #[new(skip)]
98 #[get(skip)]
99 #[prop(custom)]
100 pub(crate) brand_logo: Option<ImageBuffer>,
101 /// Optional external reactive signal synchronizing the Mobile overlay drawer open state (`false` enforced on Desktop and Fullscreen).
102 #[new(skip)]
103 #[get(skip)]
104 #[prop(custom)]
105 pub(crate) drawer_open: Option<Signal<bool>>,
106 /// Optional reactive output signal synchronized with the active `EuvShellLayoutMode` (`Desktop` >= 960px, `Mobile` < 960px).
107 #[new(skip)]
108 #[get(skip)]
109 #[prop(custom)]
110 pub(crate) layout_mode: Option<Signal<EuvShellLayoutMode>>,
111}
112
113/// Hysteresis tracker driving Twitter/X-style top and bottom chrome auto-hide during vertical scrolling.
114#[derive(Clone, Copy, Data, Debug, Default)]
115pub(crate) struct ChromeScrollAutoHideState {
116 /// Most recently observed active scroll container node handle.
117 #[get(type(copy))]
118 pub(crate) active_scroll_node: NodeId,
119 /// Whether `last_scroll_y` has been seeded for `active_scroll_node`.
120 #[get(type(copy))]
121 pub(crate) has_sample: bool,
122 /// Last observed vertical scroll offset in logical pixels.
123 #[get(type(copy))]
124 pub(crate) last_scroll_y: f32,
125 /// Signed accumulated vertical scroll delta in the current uninterrupted direction.
126 #[get(type(copy))]
127 pub(crate) accum_delta_y: f32,
128 /// Remaining downward scroll ticks suppressed after a viewport resize reveals chrome so leftover inertia does not immediately re-hide it.
129 #[get(type(copy))]
130 pub(crate) suppress_hide_ticks: u8,
131}
132
133/// Shared scroll observer state driving Twitter/X-style chrome auto-hide across direct and outlet scroll views.
134#[derive(Clone, Getter, New)]
135pub(crate) struct ChromeScrollObserver {
136 /// Whether auto-hide is statically enabled for the owning shell.
137 #[get(type(copy))]
138 pub(crate) enabled: bool,
139 /// Optional reactive auto-hide toggle overriding `enabled` live.
140 #[get(type(copy))]
141 pub(crate) auto_hide_signal: Option<Signal<bool>>,
142 /// Shared scene handle for reading scroll offsets.
143 pub(crate) scene: SceneHandle,
144 /// Shared hysteresis tracker state.
145 pub(crate) state: Rc<Cell<ChromeScrollAutoHideState>>,
146 /// Context-level immersive fullscreen signal.
147 #[get(type(copy))]
148 pub(crate) ctx_fs: Signal<bool>,
149 /// Compact drawer open state signal.
150 #[get(type(copy))]
151 pub(crate) menu_open: Signal<bool>,
152 /// Chrome hidden state signal updated on threshold crossings.
153 #[get(type(copy))]
154 pub(crate) chrome_hidden: Signal<bool>,
155}
156
157/// Hairline horizontal or vertical structural divider.
158#[derive(Clone, Copy, Data, Debug, New, Props)]
159pub struct EuvDivider {
160 /// True for vertical divider; false for horizontal.
161 #[get(type(copy))]
162 #[prop(custom)]
163 pub(crate) vertical: bool,
164 /// Active theme tokens.
165 #[get(type(copy))]
166 pub(crate) tokens: ThemeTokens,
167}
168
169/// Zero-boilerplate standardized page wrapper combining `EuvHeader` and uniform vertical section spacing.
170#[derive(Clone, Data, Debug, New, Props)]
171pub struct EuvPage {
172 /// Page title text.
173 pub(crate) title: String,
174 /// Page subtitle description.
175 pub(crate) subtitle: String,
176 /// Active theme tokens.
177 #[get(type(copy))]
178 pub(crate) tokens: ThemeTokens,
179 /// Optional style overrides merged onto the root page column (`None` renders full fluid width).
180 #[new(skip)]
181 #[get(type(copy))]
182 #[prop(custom)]
183 pub(crate) style: Option<Style>,
184 /// Ordered section children rendered beneath the page header.
185 #[new(skip)]
186 pub(crate) sections: Vec<NodeId>,
187}
188
189/// Standardized wrapping horizontal action bar aligning buttons and controls on one center baseline.
190#[derive(Clone, Data, Debug, Default, New, Props)]
191pub struct EuvActionRow {
192 /// Pre-mounted child controls inside the action row.
193 #[new(skip)]
194 pub(crate) children: Vec<NodeId>,
195}
196
197/// Responsive 1/2/3-column KPI stat grid synchronized with the active viewport breakpoint.
198#[derive(Clone, Data, Debug, Default, New, Props)]
199pub struct EuvStatGrid {
200 /// Pre-mounted stat card children.
201 #[new(skip)]
202 pub(crate) cards: Vec<NodeId>,
203}