Skip to main content

egui_pop_views/
lib.rs

1//! Data views for egui-pop: a live tree, a list, a data table and charts.
2//!
3//! <div class="warning">Experimental: may change in any release
4//! (docs/stability.md).</div>
5//!
6//! - [`tree`]: a tree over a source the application implements, with
7//!   lazy, asynchronous branches and edits at any time;
8//! - [`list`]: a list of rows the application draws;
9//! - [`table`]: a data table (on `egui_table`), sorted and resized
10//!   through the host's value store, cells drawn by the application;
11//! - [`text_log`]: a text log on the data table: time, entity, level and
12//!   body columns, filters by level and text, the tail followed, the rows
13//!   at a time cursor highlighted and a click moving the cursor;
14//! - [`item`]: the dense row they draw with, also a widget of its own
15//!   ([`item::ListItem`]: an icon, a label, weak trailing text, action
16//!   buttons shown on hover, indent guides, an arrow, a drag handle);
17//! - [`property`]: property rows, a name and a value, their names
18//!   aligned;
19//! - [`plot`]: charts (on `egui_plot`): time series, scatters and bars
20//!   in the kit's colours and the categorical palette, with an
21//!   accessible summary, a time cursor and the `plots` collector;
22//! - [`select`]: the selection by key they share; the tree and the list
23//!   also bind to the application-wide selection
24//!   (`egui_pop_api::selection`) with `shared`;
25//! - [`library`]: a photo library's widgets: a thumbnail grid and a
26//!   filmstrip, ratings, colour labels and flags, a comparison, tag
27//!   chips and input, a search field with filter chips, their steps and
28//!   commands;
29//! - [`mounts`]: what they need (the mount contract, ADR 0013);
30//! - [`steps`]: their moments as steps, and [`ViewsPlugin`] that
31//!   declares them;
32//! - [`strings`]: the text they show, translatable;
33//! - [`timeline`]: a timeline over seconds, frames (timecode) or bars and
34//!   beats: an adaptive ruler, a playhead to scrub, a range that loops,
35//!   markers and cue points, snapping, the J/K/L transport keys, each
36//!   change of its document a step of the history, and the commands and
37//!   collector agents drive it with;
38//! - [`video`]: the video widget, a local file played in place with full,
39//!   compact or no controls (GStreamer with the `video` feature, a
40//!   placeholder with Open outside without it), and the commands and
41//!   collector agents drive it with;
42//! - `viewer` (feature `markdown`): the in-app viewer of ADR 0017, a
43//!   panel showing `docs:` pages, markdown and images with back and
44//!   forward, an address bar, find in page and zoom, the links service's
45//!   way inside.
46//!
47//! All three are virtualised (only the rows in view are built), take
48//! the keyboard focus as a whole (arrows, Page Up/Down, Home/End,
49//! type-ahead), and report what happened as signals in their output and
50//! as steps a plugin may veto, replace or extend (ADR 0011). The
51//! application owns its data: the views show it and say what the user
52//! asked for.
53//!
54//! ## Without the application
55//!
56//! The `api` feature (on by default) brings the application layer: each
57//! view's `.app(&AppHandle)`, `.shared(..)`, and the plugins. Turned off
58//! (`default-features = false`), a view is a plain egui widget over
59//! egui-pop's core and model, for any egui or eframe application; what
60//! the user did comes back in its output.
61//!
62//! ```
63//! use egui_pop_views::list::{ListRows, ListState, ListView};
64//!
65//! struct Files(Vec<String>);
66//!
67//! impl ListRows<usize> for Files {
68//!     fn len(&self) -> usize {
69//!         self.0.len()
70//!     }
71//!     fn key(&self, row: usize) -> usize {
72//!         row
73//!     }
74//!     fn label(&self, row: usize) -> String {
75//!         self.0[row].clone()
76//!     }
77//! }
78//!
79//! let ctx = egui::Context::default();
80//! let mut state = ListState::<usize>::new();
81//! let mut files = Files(vec!["a.txt".into(), "b.txt".into()]);
82//! let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {
83//!     let out = ListView::new("files").label("Files").show(ui, &mut state, &mut files);
84//!     for _signal in out.signals { /* the user selected or opened a row */ }
85//! });
86//! out.textures_delta.clear();
87//! ```
88//!
89//! Layer: a component on the application API (L4, ADR 0001); without
90//! `api`, a component on core and model only.
91
92mod app_link;
93pub mod item;
94pub mod library;
95pub mod list;
96pub mod mounts;
97mod nav;
98pub mod plot;
99pub mod property;
100mod rows;
101pub mod select;
102mod shared;
103pub mod steps;
104pub mod strings;
105pub mod table;
106pub mod text_log;
107pub mod timeline;
108pub mod tree;
109pub mod video;
110#[cfg(feature = "markdown")]
111pub mod viewer;
112
113pub use nav::TYPE_AHEAD_DELAY;
114pub use select::{Mode, Selection};
115#[cfg(feature = "api")]
116pub use steps::ViewsPlugin;