Skip to main content

egui_cha/
lib.rs

1//! egui-cha: TEA (The Elm Architecture) framework for egui
2//!
3//! # Architecture
4//!
5//! ```text
6//! ┌────────────────────────────────────────┐
7//! │  Design System (egui-cha-ds)           │
8//! │  Button, Input, Card, Modal...         │
9//! ├────────────────────────────────────────┤
10//! │  Component Layer                       │
11//! │  Props / Emit / Hierarchical           │
12//! ├────────────────────────────────────────┤
13//! │  TEA Core                              │
14//! │  Model, Msg, update(), view(), Cmd     │
15//! └────────────────────────────────────────┘
16//!              ↓
17//!           egui
18//! ```
19
20mod app;
21pub mod bindings;
22mod cmd;
23mod component;
24pub mod drag_drop;
25pub mod error;
26pub mod helpers;
27pub mod router;
28mod scroll_area;
29pub mod shortcuts;
30pub mod sub;
31pub mod testing;
32mod view_ctx;
33
34#[cfg(feature = "eframe")]
35mod runtime;
36
37pub use app::App;
38pub use cmd::Cmd;
39pub use component::Component;
40pub use error::{ErrorSource, FrameworkError, Severity};
41pub use router::{Router, RouterMsg};
42pub use scroll_area::{ScrollArea, ScrollDirection};
43pub use sub::Sub;
44pub use view_ctx::ViewCtx;
45
46#[cfg(feature = "eframe")]
47pub use runtime::{run, RepaintMode, RunConfig};
48
49/// Prelude for convenient imports
50pub mod prelude {
51    pub use crate::bindings::{ActionBindings, DynamicShortcut, InputBinding, ShortcutGroup};
52    pub use crate::drag_drop::{DragSourceResponse, DropZoneResponse};
53    pub use crate::error::{ErrorSource, FrameworkError, Severity};
54    pub use crate::helpers::{Debouncer, Throttler, TrailingThrottler};
55    pub use crate::router::{BackButton, NavLink, Router, RouterMsg};
56    pub use crate::shortcuts;
57    pub use crate::sub::Sub;
58    pub use crate::{App, Cmd, Component, ScrollArea, ViewCtx};
59    pub use egui;
60    pub use egui::{Key, KeyboardShortcut, Modifiers};
61
62    #[cfg(feature = "eframe")]
63    pub use crate::{RepaintMode, RunConfig};
64}
65
66/// Testing utilities prelude
67pub mod test_prelude {
68    pub use crate::testing::{CmdRecord, ModelAssert, TestRunner};
69    pub use crate::{App, Cmd};
70}