egui_pop/lib.rs
1//! egui-pop: themable, accessible, agent-drivable components for egui.
2//!
3//! The facade over the egui-pop crates: an application framework (`App`,
4//! plugins, commands with their keys, menus and palette, zones and a
5//! docking workbench, dialogs, toasts, settings, an undo history, a debug
6//! bridge an agent can drive) and parts usable on their own (design tokens
7//! and themes, visual kits, widgets, the image viewport, data views,
8//! editors). What is stable and what is experimental is in the README
9//! and `docs/stability.md`; experimental crates, modules and items say
10//! so in a warning block in their documentation;
11//! what works without `App` is in the guide's "Using parts without App".
12//!
13//! The smallest start: themes are DTCG token files (see [`tokens`]) in
14//! three tiers (palette, roles, components), composed from a base theme
15//! (dark, light, high contrast), a density, an accent and overrides, and
16//! turned into egui's own style so egui's widgets and other crates'
17//! widgets match. Custom widgets read the typed [`theme::Tokens`] from the
18//! context.
19//!
20//! ```
21//! use egui_pop::theme::{self, Density, ThemeSpec};
22//!
23//! let ctx = egui::Context::default();
24//! // At start-up, or whenever the user picks another theme:
25//! let tokens = theme::install(
26//! &ctx,
27//! &ThemeSpec::new("pop-dark").density(Density::Compact).accent("blue"),
28//! );
29//! assert!(tokens.resolved().problems().is_empty());
30//!
31//! // Then draw as usual: egui's widgets use the theme, custom painting
32//! // reads the typed tokens.
33//! fn draw(ui: &mut egui::Ui) {
34//! let tokens = theme::Tokens::of(ui.ctx());
35//! ui.colored_label(tokens.status.success, "Saved");
36//! let _ = ui.button("A themed button");
37//! }
38//! ```
39//!
40//! `egui` is re-exported: use `egui_pop::egui` to be sure to get the
41//! version egui-pop was built for (one egui-pop minor per egui minor).
42
43/// egui-pop's version: this crate's, the one an application depends on.
44pub const VERSION: &str = env!("CARGO_PKG_VERSION");
45
46pub use egui;
47/// eframe (feature `eframe`): the version applications run with.
48#[cfg(feature = "eframe")]
49pub use egui_pop_api::eframe;
50/// The token parser and resolver (no egui dependency).
51pub use egui_pop_tokens as tokens;
52
53/// The slot layout engine (no egui dependency): plain boxes packed into a
54/// grid in standard slot sizes, with forms, groups, growth and hysteresis.
55pub use egui_pop_fit as fit;
56
57/// The logic without egui: ids, commands, keymap, menus, panels, layouts,
58/// the value store, documents.
59pub use egui_pop_model as model;
60
61/// The egui layer: focus, keys, overlays, placement, accessibility,
62/// strings, icons, persistence, fault boundaries, binding.
63pub use egui_pop_core as core;
64
65/// The application API: plugins, the app builder, zones and blocks,
66/// hooks, services, stories.
67pub use egui_pop_api as api;
68
69/// The image viewport, thumbnails and the histogram (feature
70/// `viewport`).
71///
72/// <div class="warning">Experimental: may change in any release
73/// (docs/stability.md).</div>
74#[cfg(feature = "viewport")]
75pub use egui_pop_viewport as viewport;
76
77/// The image tools' steps: each change of the histogram's drag, a
78/// curve, a colour wheel, the zoom control or the navigator runs as a
79/// step of the application (feature `imaging`).
80///
81/// <div class="warning">Experimental: may change in any release
82/// (docs/stability.md).</div>
83#[cfg(feature = "imaging")]
84pub use egui_pop_imaging as imaging;
85
86/// Data views: a live tree, a list and a data table (feature `views`).
87///
88/// <div class="warning">Experimental: may change in any release
89/// (docs/stability.md).</div>
90#[cfg(feature = "views")]
91pub use egui_pop_views as views;
92
93/// Text and code editors (feature `editors`).
94///
95/// <div class="warning">Experimental: may change in any release
96/// (docs/stability.md).</div>
97#[cfg(feature = "editors")]
98pub use egui_pop_editors as editors;
99
100/// Translations: catalogues, the language setting, locale formatting,
101/// the key extractor (feature `i18n`).
102#[cfg(feature = "i18n")]
103pub use egui_pop_i18n as i18n;
104
105/// Platform services as opt-in plugins: a single instance and deep
106/// links, notifications, a tray icon, global shortcuts, logs and crash
107/// reports, the focus mode and the text scaling read in-process, the
108/// system clipboard (feature `platform`, or `platform-<service>` for
109/// one).
110///
111/// <div class="warning">Experimental: may change in any release
112/// (docs/stability.md).</div>
113#[cfg(any(
114 feature = "platform-clipboard",
115 feature = "platform-instance",
116 feature = "platform-notify",
117 feature = "platform-tray",
118 feature = "platform-keys",
119 feature = "platform-logs",
120 feature = "platform-crash",
121 feature = "platform-focus",
122 feature = "platform-text-scale",
123 feature = "platform-wheel-lines",
124 feature = "platform-open"
125))]
126pub use egui_pop_platform as platform;
127
128/// Themes: tokens into egui's style (from `egui-pop-core`).
129pub use egui_pop_core::theme;
130
131/// Layer ranks: what lies over what in a window's foreground (from
132/// `egui-pop-core`, ADR 0026).
133///
134/// <div class="warning">Experimental: may change in any release
135/// (docs/stability.md).</div>
136pub use egui_pop_core::layers;
137
138pub mod mounts;
139
140/// What most applications use.
141pub mod prelude {
142 pub use egui_pop_api::hooks::{Hook, On};
143 pub use egui_pop_api::services::ServiceToken;
144 pub use egui_pop_api::steps::{Before, Outcome, StepSpec};
145 pub use egui_pop_api::stories::Story;
146 pub use egui_pop_api::zones::{self, Block, Place};
147 pub use egui_pop_api::{
148 App, AppBuilder, AppHandle, Call, Ctx, DefaultPlugins, MinimalPlugins, Plugin, PluginError,
149 };
150 pub use egui_pop_core::binding::{Binding, SharedStore};
151 pub use egui_pop_core::theme::{Density, ThemeSpec, Tokens};
152 pub use egui_pop_core::ui::{Space, TextRole, Tone, UiPop};
153 pub use egui_pop_model::commands::{CommandSpec, Origin};
154 pub use egui_pop_model::ids::{
155 BlockId, CommandId, HookId, MenuId, PanelId, PluginId, ServiceId, SettingId, StepId,
156 StoryId, ZoneId,
157 };
158 pub use egui_pop_model::values::Descriptor;
159}