Skip to main content

euv_docs/viewer/
struct.rs

1use super::*;
2
3/// Shared reactive state driving the showcase-parity `euv-docs` viewer across native desktop, headless, and WebAssembly targets.
4#[derive(Clone, Data)]
5pub struct DocsViewerState {
6    /// Immutable documentation site data shared across routes.
7    pub(crate) site: Rc<DocSite>,
8    /// Reactive theme controller supporting all 17 `euv-ui` schemes and Light/Dark switching.
9    pub(crate) theme: UiThemeState,
10    /// Persistent `PageRetention::Freeze` router preserving scroll state per documentation page.
11    pub(crate) router: EuvRouter,
12    /// Active canonical route path signal.
13    #[get(type(copy))]
14    pub(crate) active_route: Signal<String>,
15    /// Live sidebar search query signal.
16    #[get(type(copy))]
17    pub(crate) search_query: Signal<String>,
18    /// Active table-of-contents heading anchor slug signal.
19    #[get(type(copy))]
20    pub(crate) active_toc_slug: Signal<String>,
21    /// Quick-search command palette modal visibility signal.
22    #[get(type(copy))]
23    pub(crate) cmd_open: Signal<bool>,
24    /// Quick-search command palette query signal.
25    #[get(type(copy))]
26    pub(crate) cmd_query: Signal<String>,
27    /// Mobile catalog drawer visibility signal toggled by the bottom navigation `Catalog` (`目录`) tab.
28    #[get(type(copy))]
29    pub(crate) catalog_drawer_open: Signal<bool>,
30    /// Topbar locale dropdown visibility signal.
31    #[get(type(copy))]
32    pub(crate) locale_menu_open: Signal<bool>,
33    /// Topbar 17-scheme theme color dropdown visibility signal.
34    #[get(type(copy))]
35    pub(crate) scheme_menu_open: Signal<bool>,
36    /// Most recently selected locale navigation href (recorded across all targets for deterministic verification).
37    #[get(type(copy))]
38    pub(crate) last_locale_href: Signal<String>,
39    /// Most recently opened external or new-tab URL (recorded across all targets for deterministic verification).
40    #[get(type(copy))]
41    pub(crate) last_opened_url: Signal<String>,
42    /// Unlocked directory/page password secrets entered by the user during this session.
43    #[get(type(copy))]
44    pub(crate) unlocked_passwords: Signal<Vec<String>>,
45    /// Monotonic scroll tick signal pulsed whenever the active documentation viewport scrolls.
46    #[get(type(copy))]
47    pub(crate) scroll_tick: Signal<u64>,
48    /// Cached recursive filesystem catalog tree computed once from `site`.
49    pub(crate) catalog_tree: Rc<Vec<DocCatalogNode>>,
50    /// Loaded `/api/page-artifacts` catalog records rendered on `home: true` pages.
51    #[get(type(copy))]
52    pub(crate) catalog_items: Signal<Vec<DocsCatalogArtifact>>,
53    /// Whether the `/api/page-artifacts` catalog request is currently loading.
54    #[get(type(copy))]
55    pub(crate) catalog_loading: Signal<bool>,
56    /// Whether the latest `/api/page-artifacts` catalog request failed (enabling localized Retry).
57    #[get(type(copy))]
58    pub(crate) catalog_error: Signal<bool>,
59    /// Guard preventing duplicate route registration on `router`.
60    pub(crate) router_ready: Rc<Cell<bool>>,
61}