Skip to main content

euv_example/pages/shell/
struct.rs

1use super::*;
2
3/// Cross-component custom event emitted via `#[event]` / `emit!` and received via `on!` across showcase pages.
4#[event]
5#[derive(Data, Debug)]
6pub struct ShowcasePulseEvent {
7    /// Source page or control emitting the pulse.
8    pub(crate) source: String,
9    /// Monotonic pulse sequence counter.
10    #[get(type(copy))]
11    pub(crate) seq: u32,
12}
13
14/// App-wide reactive global state store registered via `#[store]` and observed with `watch!(global ...)`.
15#[store]
16#[derive(Data, Debug, Default, PartialEq)]
17pub struct ShowcaseGlobalBanner {
18    /// Total cross-component pulses received globally.
19    #[get(type(copy))]
20    pub(crate) pulses: u32,
21    /// Latest event source label broadcast globally.
22    pub(crate) last_source: String,
23}
24
25/// Typed `Component` + `Lifecycle` page wrapper enforcing `PageRetention::Freeze` for every showcase route.
26#[derive(Clone, Getter)]
27pub struct ShowcasePage {
28    /// Static normalized route path owned by this page component.
29    #[get(type(copy))]
30    pub(crate) route: &'static str,
31    /// Shared reactive showcase state.
32    pub(crate) state: ShowcaseState,
33    /// Active theme tokens snapshot for this render pass.
34    #[get(type(copy))]
35    pub(crate) tokens: ThemeTokens,
36}
37
38/// Single source of truth describing one showcase route: path, navigation copy, sidebar section, quick-launch badge, and page builder.
39#[derive(Clone, Copy, Getter)]
40pub struct ShowcaseRouteSpec {
41    /// Normalized route path.
42    #[get(type(copy))]
43    pub(crate) path: &'static str,
44    /// Sidebar, command palette, and quick-launch label.
45    #[get(type(copy))]
46    pub(crate) label: &'static str,
47    /// Compact breadcrumb title.
48    #[get(type(copy))]
49    pub(crate) title: &'static str,
50    /// Sidebar drawer section heading.
51    #[get(type(copy))]
52    pub(crate) section: &'static str,
53    /// Two-letter quick-launch badge.
54    #[get(type(copy))]
55    pub(crate) tag: &'static str,
56    /// One-line responsibility summary.
57    #[get(type(copy))]
58    pub(crate) summary: &'static str,
59    /// Page builder mounting this route.
60    #[get(type(copy))]
61    pub(crate) mount: fn(&ShowcaseState, ThemeTokens) -> NodeId,
62}