euv-core 0.48.3

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Retained page and scroll layer state preserved cleanly across `PageRetention::Freeze` route transitions.
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct RetainedScrollLayer {
    /// Canonical route path owning this retained page layer.
    pub(crate) route_key: String,
    /// Persistent outer `ScrollView` wrapper node reused across route switches.
    #[get(type(copy))]
    pub(crate) wrapper_node: NodeId,
    /// Monotonic retained layer generation preserved across reuse without teardown.
    #[get(type(copy))]
    pub(crate) layer_generation: u64,
    /// Primary wrapper scroll offset captured before freeze and verified on resume.
    #[get(type(copy))]
    pub(crate) scroll_offset: Point,
    /// Nested scrollable descendant `(node_id, scroll_offset)` pairs preserved across route switches.
    pub(crate) nested_scroll_offsets: Vec<(NodeId, Point)>,
    /// Focused descendant `NodeId` inside this page when it froze (restored on return when still live).
    #[get(skip)]
    pub(crate) focused_node: Option<NodeId>,
    /// Monotonic page animation timeline clock in seconds preserved across freeze/resume.
    #[get(type(copy))]
    pub(crate) animation_timeline_secs: f64,
    /// Suspended descendant `NodeTransition` records keeping exact `elapsed` progress intact across freeze.
    pub(crate) suspended_transitions: Vec<NodeTransition>,
    /// Cumulative number of times this retained page/scroll layer was reused on route resume.
    #[get(type(copy))]
    pub(crate) reuse_count: u64,
    /// Cumulative number of resource pre-warm passes completed for this route.
    #[get(type(copy))]
    pub(crate) prewarm_count: u64,
    /// Number of layout nodes inspected during the most recent pre-warm pass.
    #[get(type(copy))]
    pub(crate) prewarmed_layout_nodes: usize,
    /// Number of representative glyph strings warmed during the most recent pre-warm pass.
    #[get(type(copy))]
    pub(crate) prewarmed_glyph_strings: usize,
    /// Monotonic last-used tick for bounded LRU maintenance.
    #[get(type(copy))]
    pub(crate) last_used_tick: u64,
}

/// Summary report emitted by `prewarm_page_resources` during route transition pre-warming.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct PagePrewarmReport {
    /// Target route path that was pre-warmed.
    pub(crate) route_key: String,
    /// Number of layout/scene nodes inspected and verified for the target page.
    #[get(type(copy))]
    pub(crate) layout_nodes_warmed: usize,
    /// Number of text/glyph strings registered for shaping cache warmup.
    #[get(type(copy))]
    pub(crate) glyph_strings_warmed: usize,
    /// True when an existing retained page/scroll layer was reused without rebuilding.
    #[get(type(copy))]
    pub(crate) retained_layer_reused: bool,
    /// Number of scroll layers (wrapper + nested scrollables) preserved for this page.
    #[get(type(copy))]
    pub(crate) scroll_layers_preserved: usize,
}

/// Bounded registry tracking retained page/scroll layers, focus, and animation timelines across route transitions.
#[derive(Clone, Data, Debug, Default)]
pub struct RetainedLayerRegistry {
    /// Active retained page layer records keyed by canonical route path.
    #[get(pub(crate))]
    #[get_mut(pub(crate))]
    #[set(skip)]
    pub(crate) entries: HashMap<String, RetainedScrollLayer>,
    /// Monotonic layer generation counter assigned only when a brand-new wrapper layer is registered.
    #[get(type(copy))]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) next_generation: u64,
    /// Monotonic LRU tick incremented on every capture, restore, or pre-warm touch.
    #[get(type(copy))]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) touch_clock: u64,
    /// Cumulative retained layer reuse hits across all routes.
    #[get(type(copy))]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) total_reuse_hits: u64,
    /// Cumulative pre-warm executions across all routes.
    #[get(type(copy))]
    #[get_mut(skip)]
    #[set(skip)]
    pub(crate) total_prewarms: u64,
}