euv-docs 0.48.2

Cross-platform documentation viewer and static site generator powered by euv and euv-ui.
Documentation
use super::*;

/// Shared reactive state driving the showcase-parity `euv-docs` viewer across native desktop, headless, and WebAssembly targets.
#[derive(Clone, Data)]
pub struct DocsViewerState {
    /// Immutable documentation site data shared across routes.
    pub(crate) site: Rc<DocSite>,
    /// Reactive theme controller supporting all 17 `euv-ui` schemes and Light/Dark switching.
    pub(crate) theme: UiThemeState,
    /// Persistent `PageRetention::Freeze` router preserving scroll state per documentation page.
    pub(crate) router: EuvRouter,
    /// Active canonical route path signal.
    #[get(type(copy))]
    pub(crate) active_route: Signal<String>,
    /// Live sidebar search query signal.
    #[get(type(copy))]
    pub(crate) search_query: Signal<String>,
    /// Active table-of-contents heading anchor slug signal.
    #[get(type(copy))]
    pub(crate) active_toc_slug: Signal<String>,
    /// Quick-search command palette modal visibility signal.
    #[get(type(copy))]
    pub(crate) cmd_open: Signal<bool>,
    /// Quick-search command palette query signal.
    #[get(type(copy))]
    pub(crate) cmd_query: Signal<String>,
    /// Mobile catalog drawer visibility signal toggled by the bottom navigation `Catalog` (`目录`) tab.
    #[get(type(copy))]
    pub(crate) catalog_drawer_open: Signal<bool>,
    /// Topbar locale dropdown visibility signal.
    #[get(type(copy))]
    pub(crate) locale_menu_open: Signal<bool>,
    /// Topbar 17-scheme theme color dropdown visibility signal.
    #[get(type(copy))]
    pub(crate) scheme_menu_open: Signal<bool>,
    /// Most recently selected locale navigation href (recorded across all targets for deterministic verification).
    #[get(type(copy))]
    pub(crate) last_locale_href: Signal<String>,
    /// Most recently opened external or new-tab URL (recorded across all targets for deterministic verification).
    #[get(type(copy))]
    pub(crate) last_opened_url: Signal<String>,
    /// Unlocked directory/page password secrets entered by the user during this session.
    #[get(type(copy))]
    pub(crate) unlocked_passwords: Signal<Vec<String>>,
    /// Monotonic scroll tick signal pulsed whenever the active documentation viewport scrolls.
    #[get(type(copy))]
    pub(crate) scroll_tick: Signal<u64>,
    /// Optional heading anchor slug queued to scroll into view after initial layout or deep-link navigation.
    #[get(type(copy))]
    pub(crate) pending_anchor_scroll: Signal<Option<String>>,
    /// Registry mapping canonical routes to their mounted left-sidebar catalog row `NodeId` handles.
    pub(crate) catalog_row_nodes: Rc<RefCell<HashMap<String, NodeId>>>,
    /// Mounted left-sidebar catalog container handle for scrolling active items into view.
    pub(crate) sidebar_root: Rc<Cell<NodeId>>,
    /// Mounted router outlet container handle for hooking page scroll views and post-layout sync.
    pub(crate) outlet_root: Rc<Cell<NodeId>>,
    /// Deferred flag signaling that active sidebar scroll-into-view / anchor alignment must run once layout completes.
    pub(crate) pending_post_layout_sync: Rc<Cell<bool>>,
    /// Cached recursive filesystem catalog tree computed once from `site`.
    pub(crate) catalog_tree: Rc<Vec<DocCatalogNode>>,
    /// Loaded `/api/page-artifacts` catalog records rendered on `home: true` pages.
    #[get(type(copy))]
    pub(crate) catalog_items: Signal<Vec<DocsCatalogArtifact>>,
    /// Whether the `/api/page-artifacts` catalog request is currently loading.
    #[get(type(copy))]
    pub(crate) catalog_loading: Signal<bool>,
    /// Whether the latest `/api/page-artifacts` catalog request failed (enabling localized Retry).
    #[get(type(copy))]
    pub(crate) catalog_error: Signal<bool>,
    /// Guard preventing duplicate route registration on `router`.
    pub(crate) router_ready: Rc<Cell<bool>>,
}