euv-ui 0.48.9

Cross-platform UI component library and 17-scheme design system for the euv framework with pixel-consistent rendering across Web, Android, iOS, iPadOS, macOS, Windows, and Linux.
Documentation
use super::*;

/// Single hierarchical heading entry displayed inside `EuvDocToc`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct EuvDocTocItem {
    /// Heading depth from 1 to 6 controlling outline indentation.
    #[get(type(copy))]
    pub(crate) level: u8,
    /// Canonical heading anchor slug.
    pub(crate) slug: String,
    /// Visible heading label.
    pub(crate) title: String,
}

/// Interactive hierarchical table-of-contents outline with active heading highlight and click callback.
#[derive(Clone, CustomDebug, Data, New, Props)]
pub struct EuvDocToc {
    /// Ordered table-of-contents heading entries.
    pub(crate) items: Vec<EuvDocTocItem>,
    /// Reactive currently active heading slug signal.
    #[get(type(copy))]
    pub(crate) active_slug: Signal<String>,
    /// Active UI theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
    /// Optional heading title above the outline (`"On This Page"` when empty).
    #[new(skip)]
    #[prop(custom)]
    pub(crate) title: String,
    /// Optional callback invoked with the selected heading slug when clicked.
    #[new(skip)]
    #[debug(skip)]
    #[get(skip)]
    #[prop(custom)]
    pub(crate) on_select: Option<MarkdownStrCallback>,
}

/// Destination descriptor for a previous or next article card inside `EuvDocPager`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct EuvDocPagerLink {
    /// Target canonical route path.
    pub(crate) route: String,
    /// Destination article title.
    pub(crate) title: String,
    /// Optional destination section name.
    pub(crate) section: String,
}

/// Responsive Previous / Next documentation article navigation card pair.
#[derive(Clone, CustomDebug, Data, New, Props)]
pub struct EuvDocPager {
    /// Optional previous article destination.
    #[get(skip)]
    pub(crate) prev: Option<EuvDocPagerLink>,
    /// Optional next article destination.
    #[get(skip)]
    pub(crate) next: Option<EuvDocPagerLink>,
    /// Reactive active route signal updated on card activation.
    #[get(type(copy))]
    pub(crate) active_route: Signal<String>,
    /// Active UI theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
    /// Optional localized label above the previous article card (`"Previous"` when empty).
    #[new(skip)]
    #[prop(custom)]
    pub(crate) prev_label: String,
    /// Optional localized label above the next article card (`"Next"` when empty).
    #[new(skip)]
    #[prop(custom)]
    pub(crate) next_label: String,
    /// Optional callback invoked with the navigated route string.
    #[new(skip)]
    #[debug(skip)]
    #[get(skip)]
    #[prop(custom)]
    pub(crate) on_navigate: Option<MarkdownStrCallback>,
}

/// Collapsible section group containing categorized navigation items for `EuvDocSectionNav`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct EuvDocSectionGroup {
    /// Visible section header title.
    pub(crate) title: String,
    /// Ordered navigation items belonging to this section.
    pub(crate) items: Vec<EuvNavItem>,
    /// Whether the section starts expanded (`true` by default).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) collapsed: bool,
}

/// Grouped collapsible documentation sidebar navigation with active route indicator and section item counts.
#[derive(Clone, CustomDebug, Data, New, Props)]
pub struct EuvDocSectionNav {
    /// Ordered collapsible documentation section groups.
    pub(crate) groups: Vec<EuvDocSectionGroup>,
    /// Reactive active route signal highlighted across all groups.
    #[get(type(copy))]
    pub(crate) active_route: Signal<String>,
    /// Active UI theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
    /// Optional callback invoked with the selected route path.
    #[new(skip)]
    #[debug(skip)]
    #[get(skip)]
    #[prop(custom)]
    pub(crate) on_select: Option<MarkdownStrCallback>,
}

/// Compact article metadata strip showing section badge, reading time, word count, and optional source or update tags.
#[derive(Clone, Data, Debug, New, Props)]
pub struct EuvDocMetaBar {
    /// Primary documentation section label.
    pub(crate) section: String,
    /// Estimated reading duration in minutes (clamped to at least 1).
    #[get(type(copy))]
    pub(crate) reading_minutes: usize,
    /// Total prose word count in the article.
    #[get(type(copy))]
    pub(crate) word_count: usize,
    /// Active UI theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
    /// Optional last-updated date or timestamp string.
    #[new(skip)]
    #[prop(custom)]
    pub(crate) updated: String,
    /// Optional route or source file metadata label.
    #[new(skip)]
    #[prop(custom)]
    pub(crate) source_path: String,
}

/// Reactive header node handle bundle for a collapsible `EuvDocSectionNav` section group.
pub(crate) struct DocSectionHeaderEntry {
    /// Section title text node.
    pub(crate) hdr_id: NodeId,
    /// Section item count badge node.
    pub(crate) badge_id: NodeId,
    /// Section item count badge label text node.
    pub(crate) badge_txt_id: NodeId,
    /// Collapsible chevron canvas node.
    pub(crate) chev_id: NodeId,
    /// Section items container column node.
    pub(crate) list_id: NodeId,
    /// Reactive expanded state signal.
    pub(crate) open_sig: Signal<bool>,
    /// Route paths owned by this section group.
    pub(crate) routes: Vec<String>,
}