euv_core/scene/lifecycle/enum.rs
1/// Retention policy controlling how a routed page behaves when the user navigates away.
2#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
3pub enum PageRetention {
4 /// Dispose the page subtree, reactive scope, and lifecycle resources on leave; recreate fresh on next visit.
5 Destroy,
6 /// Retain the scene subtree hidden (`Display::None`), freeze all reactive effects and animations while tracking cross-page dirty state, and coalesce updates atomically on resume.
7 #[default]
8 Freeze,
9 /// Hide the page visually (`Display::None`) while keeping its reactive effects running in the background.
10 Alive,
11}
12
13/// Lifecycle phase of a mounted `Component` or routed page managed by the framework.
14#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
15pub enum LifecyclePhase {
16 /// Component instance created, not yet mounted into the scene tree.
17 #[default]
18 Created,
19 /// Component rendered and attached to the retained scene graph.
20 Mounted,
21 /// Component or page is actively visible and executing reactive logic.
22 Active,
23 /// Component or page is hidden with reactive effects suspended (`PageRetention::Freeze`).
24 Frozen,
25 /// Cold frozen page evicted under budget pressure while retaining a versioned `PageSnapshot` for deterministic restore.
26 Evicted,
27 /// Component detached from the scene graph prior to final disposal.
28 Unmounted,
29 /// Component scope disposed and resources released.
30 Destroyed,
31}
32
33/// Distinct lifecycle boundary event separating OS background, surface loss, and route-level freeze semantics.
34#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
35pub enum LifecycleBoundaryEvent {
36 /// Host OS moved the application into background execution.
37 OsBackground,
38 /// Host OS returned the application to foreground execution.
39 OsForeground,
40 /// Graphics swapchain/surface was lost while keeping logical page state intact.
41 SurfaceLost {
42 /// Newly invalidated surface generation identifier.
43 surface_generation: u64,
44 },
45 /// Graphics swapchain/surface was recreated ready for full redraw.
46 SurfaceRecreated {
47 /// Newly created surface generation identifier.
48 surface_generation: u64,
49 },
50 /// Application router froze a page under `PageRetention::Freeze`.
51 RouteFreeze {
52 /// Target page identifier being frozen.
53 page_id: u64,
54 },
55 /// Application router resumed a previously frozen or evicted page.
56 RouteResume {
57 /// Target page identifier being resumed.
58 page_id: u64,
59 },
60}