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
//! List selection with viewport scrolling - type definitions
use Cell;
/// Wrap-around index navigation with viewport scrolling
///
/// Uses `Cell` for offset/visible to allow updates from immutable context (e.g., render).
use HashMap;
/// Selection state for list view with collapsible sections
///
/// Commonly used in views where items are grouped by status, category, etc.
/// and each group can be collapsed/expanded.
///
/// # Example
///
/// ```ignore
/// use revue::utils::SectionedSelection;
///
/// let mut sel = SectionedSelection::new();
///
/// // Navigate
/// sel.next(&[5, 3, 2]); // section_sizes = [5 items, 3 items, 2 items]
/// sel.prev(&[5, 3, 2]);
///
/// // Toggle section
/// sel.toggle_section();
///
/// // Check state
/// if !sel.is_section_collapsed(0) {
/// // Render section 0 items...
/// }
/// ```