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