1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! Root routing entry utilities.
//!
//! This module re-exports [`Router`] which provides `push()` and `pop()` methods for manipulating the navigation stack,
//! and provides the [`router_root`] component which drives per‑frame execution of
//! the current (top) destination.
//!
//! Core flow:
//! * On the first frame, the supplied `root_dest` is pushed if the stack is empty.
//! * On every frame, the top destination's `exec_component()` is invoked.
//!
//! The actual stack and destination logic live in `tessera_ui_shard::router`.
//!
//! # Typical Minimal Usage
//!
//! ```
//! use tessera_ui::{tessera, shard, router::{router_root, Router}};
//!
//! #[shard]
//! #[tessera]
//! fn home_screen() { /* ... */ }
//!
//! // In your app's root layout:
//! router_root(HomeScreenDestination {});
//!
//! ##[shard]
//! ##[tessera]
//! # fn settings_screen() { /* ... */ }
//!
//! // Somewhere inside an event (e.g. button click) to navigate:
//! Router::with_mut(|router| {
//! router.push(SettingsScreenDestination {});
//! });
//!
//! // To go back:
//! Router::with_mut(|router| {
//! router.pop();
//! });
//! ```
//!
//! # Behavior
//!
//! * `router_root` is idempotent regarding the initial destination: it only pushes
//! `root_dest` when the stack is empty.
//! * Subsequent frames never push automatically; they only execute the current top.
//! * If the stack is externally cleared (not typical), `router_root` will push again.
//!
//! # Panics
//!
//! Panics if after internal logic the stack is still empty (indicates an unexpected
//! mutation from user code while in the execution closure).
//!
//! # See Also
//!
//! * [`tessera_ui_shard::router::RouterDestination`]
//! * `#[shard]` macro which generates `*Destination` structs.
use tessera;
pub use ;
/// Root component that drives the shard router stack each frame.
///
/// See module‑level docs for detailed usage patterns.
///
/// # Parameters
/// * `root_dest` - The destination pushed only once when the stack is empty.
///
/// # Notes
///
/// Keep `router_root` exactly once at the point in your tree that should display
/// the active routed component. Wrapping it multiple times would still execute
/// only one top destination but wastes layout work.