Skip to main content

euv_ui/hook/context/
struct.rs

1use super::*;
2
3/// Reactive UI state bundle shared across all `euv-ui` components.
4#[derive(Clone, Data, Debug)]
5pub struct UiThemeState {
6    /// Reactive design scheme signal (supports live switching across all 17 schemes).
7    #[get(type(copy))]
8    pub(crate) scheme: Signal<DesignScheme>,
9    /// Reactive light/dark mode signal.
10    #[get(type(copy))]
11    pub(crate) mode: Signal<ThemeMode>,
12    /// Derived memoized `ThemeTokens` recomputed only when scheme or mode changes.
13    #[get(type(copy))]
14    pub(crate) tokens: Memo<ThemeTokens>,
15}
16
17/// Precomputed `(old, new)` semantic color lookup tables for one directed theme hop used by in-place remaps.
18#[derive(Clone, Copy, Debug)]
19pub(crate) struct ThemeRemapPairs {
20    /// Background fill and gradient stop pairs in semantic priority order.
21    pub(crate) surface: [(Color, Color); THEME_SURFACE_PAIR_COUNT],
22    /// Border and focus ring stroke pairs in semantic priority order.
23    pub(crate) border: [(Color, Color); THEME_BORDER_PAIR_COUNT],
24    /// Text color pairs in semantic priority order.
25    pub(crate) text: [(Color, Color); THEME_TEXT_PAIR_COUNT],
26    /// Source theme geometry tokens.
27    pub(crate) from_geometry: ThemeGeometry,
28    /// Target theme geometry tokens.
29    pub(crate) to_geometry: ThemeGeometry,
30}
31
32/// Lifetime guard deduplicating the root-attached external fullscreen exit observer per `Context` signal.
33#[derive(Clone, Debug)]
34pub(crate) struct FullscreenWatcherGuard {
35    /// Watched `Context::immersive_fullscreen` signal identifier.
36    pub(crate) signal_id: SignalId,
37    /// Flag cleared by `on_cleanup` when the watched `SceneTree` root scope is disposed.
38    pub(crate) alive: Rc<Cell<bool>>,
39}