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 /// Optional heading anchor slug queued to scroll into view after initial layout or deep-link navigation.
49 #[get(type(copy))]
50 pub(crate) pending_anchor_scroll: Signal<Option<String>>,
51 /// Registry mapping canonical routes to their mounted left-sidebar catalog row `NodeId` handles.
52 pub(crate) catalog_row_nodes: Rc<RefCell<HashMap<String, NodeId>>>,
53 /// Mounted left-sidebar catalog container handle for scrolling active items into view.
54 pub(crate) sidebar_root: Rc<Cell<NodeId>>,
55 /// Mounted router outlet container handle for hooking page scroll views and post-layout sync.
56 pub(crate) outlet_root: Rc<Cell<NodeId>>,
57 /// Deferred flag signaling that active sidebar scroll-into-view / anchor alignment must run once layout completes.
58 pub(crate) pending_post_layout_sync: Rc<Cell<bool>>,
59 /// Cached recursive filesystem catalog tree computed once from `site`.
60 pub(crate) catalog_tree: Rc<Vec<DocCatalogNode>>,
61 /// Loaded `/api/page-artifacts` catalog records rendered on `home: true` pages.
62 #[get(type(copy))]
63 pub(crate) catalog_items: Signal<Vec<DocsCatalogArtifact>>,
64 /// Whether the `/api/page-artifacts` catalog request is currently loading.
65 #[get(type(copy))]
66 pub(crate) catalog_loading: Signal<bool>,
67 /// Whether the latest `/api/page-artifacts` catalog request failed (enabling localized Retry).
68 #[get(type(copy))]
69 pub(crate) catalog_error: Signal<bool>,
70 /// Guard preventing duplicate route registration on `router`.
71 pub(crate) router_ready: Rc<Cell<bool>>,
72}