Expand description
The application API of egui-pop (layer L3, see ADR 0001), with its own semver: what plugins are written against.
Plugin: a feature with an id, requirements, a priority, andconnect/disconnect; everything it registers is its own (ADR 0004);Ctx: what a plugin registers through: commands (declared once: keys, menus, palette and agent surface derived), key bindings, menu items, panels, zones, blocks, settings, services, lifecycle handlers, alter hooks, stories;zones: named places and blocks added, replaced, extended or wrapped (ADR 0005);hooks: alter hooks over menus, the palette and settings, run at build time; lifecycle events;host: the application’s kernel behind the interface: commands run, an event journal, the store, a waker (host::LocalHostby default);steps: the moments of a feature’s life plugins may watch, veto, replace or extend (ADR 0011);contexts: the context stack (places and modes, ADR 0012): its owner behind the host, the projection, the breadcrumb and mode chips, thenav.*andcontext.*commands, a plugin;clipboard: the clipboard (ADR 0015): its owner behind the host, components’ sources and targets, types, transforms and sanitisers declared by plugins, theclipboard.copyandclipboard.pastesteps, the Edit commands and the agents’clipboard.*, a plugin;links: links (ADR 0017): one service opens them through one policy and thelink.openstep, with a replaceable opener; egui’s ownOpenUrlrouted through it; the link widget, the confirmation, the agents’links.openandlinks.check, thelinkscollector and the lint, a plugin;selection: the application-wide selection (opt-in): the items selected and the one hovered, shared by every panel, their history (selection.back,selection.forward), context keys, the agents’ commands and theselectioncollector, a plugin;services: typed service tokens;stories: gallery stories as a contribution;busy: a button bound to a command, showing its busy state (a delayed spinner while the host has not answered);palette: the command palette, a plugin;palettes: toolboxes and palettes floating over the interface, never modal, docking in the workbench’s areas;devtools: the debug bridge’s collectors in the application, a panel behind a setting, a plugin;dialogs: confirmations, forms, choices and notices, a plugin;toasts: notices in a corner, with actions, a plugin;notices: notice sites (a page’s notes), routing policies, command errors;jobs: the host’s background jobs followed from its journal (each with an estimated overall fraction), their commands and thejobscollector, a plugin;jobs_centre: the jobs as a panel and a popover, each with its log console;frame: the window’s own title bar and edges, a plugin;strips: the activity bar and status bar indicators fed by the host’s events, a plugin;arrangements: named layouts saved, switched and reset through the host’s store, a plugin;workbench: panels in areas over egui_stack, with placement rules, changed by named steps;window: the window’s place kept and repaired, full screen with a way out, a plugin;zoom: the interface zoom in steps, its commands and keys;sliders: theslider.changestep, and the hook that runs it from egui-pop’s sliders;admin: the administration app, settings as full pages generated from declarations (scope tabs, sections, value scopes);settings_window: the settings window (search, sections, form) and the shortcuts editor, a plugin;settings_pages: custom pages a plugin draws in the settings window, placed in its tree, searched, with their reset;system_keys: how the shortcuts bound in the system scope (also outside the window) are registered, as the shortcuts editor shows it;theme_editor: a theme’s tokens edited live, by role, with colour pickers, contrast readouts, undo, export and import, a plugin;about: Help > About application, the application’s name, version, licences, authors and links, and its version info to copy, a plugin;tips: a tip of the day and contextual hints, dismissed for good through the settings, a plugin;strings: the interface’s own text, by key with English fallbacks, translated by the installedegui_pop_core::stringsprovider;mounts: the mount contract (ADR 0013): the hosts and their offers, the components and their needs,AppHandle::where_can,AppHandle::mountand themountscollector;DefaultPluginsandMinimalPlugins: plugin groups forAppBuilder::plugins;AppBuilderandApp: sorting, connecting, the shell (menu bar, zones, panels, the command palette), key dispatch; over eframe or headless.
use egui_pop_api::{App, Ctx, Plugin, PluginError, zones};
use egui_pop_api::zones::Block;
use egui_pop_model::commands::CommandSpec;
use egui_pop_model::ids::{BlockId, CommandId, PluginId};
struct Hello;
impl Plugin for Hello {
fn id(&self) -> PluginId {
PluginId::from_static("hello")
}
fn connect(&mut self, ctx: &mut Ctx<'_>) -> Result<(), PluginError> {
ctx.command(
CommandSpec::new(CommandId::from_static("hello.greet"), "Greet", "Hello").key("Ctrl+G"),
|_| Ok(serde_json::json!("hello")),
)?;
ctx.block(zones::MAIN, Block::add(BlockId::from_static("hello.text"), 0, |ui, _| {
ui.label("Hello");
}));
Ok(())
}
}
let ctx = egui::Context::default();
let mut app = App::builder().plugin(Hello).build(&ctx).unwrap();
assert!(app.handle().diagnostics().is_empty());
let out = app.run(&CommandId::from_static("hello.greet"), serde_json::Value::Null,
egui_pop_model::commands::Origin::User);
assert_eq!(out.now(), Some(Ok(serde_json::json!("hello"))));Re-exports§
pub use app::App;pub use app::AppBuilder;pub use app::AppHandle;pub use app::CMD_THEME_TOGGLE;pub use app::Call;pub use app::DormantKey;pub use app::FOCUS_MODE;pub use app::MakeError;pub use app::Request;pub use app::SETTING_ACCENT_COLOR;pub use app::SETTING_FOCUS;pub use app::SETTING_THEME_PREFERENCE;pub use app::THEME;pub use app::ThemeService;pub use ctx::Ctx;pub use ctx::CtxError;pub use ctx::ValueWriter;pub use group::Group;pub use plugin::BuildError;pub use plugin::Plugin;pub use plugin::PluginError;pub use plugin::PluginInfo;pub use eframe;pub use egui_pop_core as core;pub use egui_pop_model as model;
Modules§
- about
- About the application, as a plugin (
AboutPlugin): Help > About application opens a dialog with the application’s name, icon, version, one-line description, licences, authors and links, and a “Copy version info” button for bug reports. The host describes the application with anAppInfo. - admin
- The administration app (
docs/design/admin-forms.md), titled “Settings”: every setting, and later every tool and task that is not the work surface, as full pages generated from declarations. Nothing here draws a component’s own widgets: a component declares aManifestand the shell renders it with egui-pop’s bricks. - app
- The application: an
AppBuildertakes plugins and a theme, sorts and connects the plugins, and gives anAppthat draws the shell (menu bar, zones, panels, the command palette) and dispatches keys. It runs in eframe (featureeframe) or headless, driven by tests. - arrangements
- Arrangements, as a plugin (
ArrangementsPlugin, inDefaultPlugins): named layouts of the workbench, saved, switched and reset. They are kept in the host’s store (settings/workbench.arrangements, one versioned layout document per name, andsettings/workbench.arrangement, the current name), so they are saved with the settings, or wherever a host keeps its store. - bus
- The bus: requests, events and the listeners of each, joined (ADR 0029).
- busy
- Controls bound to a command show its busy state: a run waiting for
the host’s result (
Reply::Later, ADR 0010) greys the control and, aftermotion.spinner.delay, a spinner takes its icon’s place for at leastmotion.spinner.min. The control keeps its width and its name (AccessKit’sbusyflag is set while the run waits); a failed run says why on hover. Menu items do the same (menus), and the status bar’s indicators show a delayed spinner while busy (strips). - clipboard
- The clipboard (ADR 0015): typed items kept by the application’s owner, readable fallbacks on the system clipboard, a paste negotiated between what a copy offers and what the target accepts, and hooks at each boundary.
- contexts
- The context stack (ADR 0012): places (drill-downs, shown as a breadcrumb) and modes (global states, shown as chips), owned by the application’s kernel and projected by the interface.
- ctx
Ctx: what a plugin registers through, at connect time. One fluent facade:command,keybinding,menu_item,panel,zone,block,setting,service,on,hook,story. Everything is owned by the plugin.- devtools
- Devtools, as a plugin (
DevtoolsPlugin, opt-in): the debug bridge’s collectors shown in the application itself, in a panel of the workbench (egui_pop.devtools, bottom), behind a setting (developer.devtools, off by default) so end users never meet it; an application shown to developers turns it on by default (DevtoolsPlugin::on_by_default).Shift+F12(View > Devtools) opens it when the setting is on. NotF12: browsers open their own developer tools with it before a web build sees it, as they take Ctrl+Shift+C, I, J, K (Cmd+Option on a Mac) and Shift+F5, F7, F9. - dialogs
- Dialogs, as a plugin (
DialogsPlugin, inDefaultPlugins): a question before an action (Confirm), a form of typed fields (Form, from value descriptors), a choice among options, each answering a value of its own, with a filter field (Choose), a notice to acknowledge (Info), and a dialog with a body of its own (Custom, opened withDialogs::open_custom). They queue, one shown at a time, modal, drawn from the theme’s tokens. - dirs
- Where an application keeps its settings: the user’s configuration folder, as each platform names it.
- files
- Choosing files, as a plugin (
FilesPlugin, inDefaultPlugins): egui-pop’s in-app picker, or, as a fallback an application allows, the system’s chooser off the interface thread. - frame
- The window’s own frame, as a plugin (
FramePlugin, opt-in): the application draws its title bar (in thezones::TITLEzone, above the menu bar) and its resize edges, instead of the system, as VS Code does. A setting (window.frame) switches between the application’s frame and the system’s; the system’s comes back at once. - group
- One undo step for many writes:
AppHandle::group(andCall::groupin a command) opens a history group through the host (Host::begin_group), runs a closure, and ends the group when the closure succeeds or cancels it (every write put back) when it fails or panics. - history
- Undo (ADR 0014): histories owned by the kernel, routed by focus, projected by the interface.
- history_
view - The history’s projection (ADR 0014): the
Historypanel and thehistory.*commands agents drive it with, brought byHistoryPlugin. - hooks
- Hooks: synchronous
alterhooks over declarations (menus, the palette, settings), run when the application is built or a plugin comes or goes, never per frame; and lifecycle events. - host
- The host: the application’s kernel, which egui-pop wraps (ADR 0010).
- jobs
- Jobs, as a plugin (
JobsPlugin, opt-in): the host’s background work, followed on the bus (ADR 0029). The host publishes its job events onpop.job.event, each typed by aJobEventKind(seeegui_pop_model::jobsfor their data), with theJobPublisherthe application hands it (Host::set_job_publisher); no journal entry is read by its name. The bus delivers each once, in journal order, to the listeners ofpop.job.event(each pass, and before a read that must see them all), and theJobsmodel behind theJOBSservice is one of them (MODEL,pop.jobs.model): no job state changes but on a bus event or request. Nothing polls: without events, nothing is read. - jobs_
centre - The jobs centre: every job the host runs, as a panel (
Jobs, closed until asked for) and as a popover from the status bar’s jobs item, the same list in both. - layout_
controls - The workbench’s layout, as VS Code arranges it.
- links
- Links (ADR 0017): one service opens them, through one policy and one step, with a replaceable opener.
- main_
wake - The main window’s frames owed, for whoever runs the event loop.
- menus
- Menus drawn from their declarations, with egui’s own menus
([
egui::containers::menu::MenuButton],SubMenuButton’s [egui::containers::menu::SubMenu], [egui::Popup]): egui’s keyboard navigation and accessibility come with them. - mounts
- The mount contract in the application (ADR 0013): the hosts this
crate builds and what each offers, the components of this crate and
of
egui-pop-coreand what each needs, the components and hosts an application declares (Ctx::mountable,Ctx::host_offer), and the questions agents and code ask: - notices
- Notices shown where they happened (
docs/notices.md). - paint_
guard - The main window’s paint guard: a window never stays empty without a word.
- palette
- The command palette, as a plugin (
PalettePlugin, inDefaultPlugins): every palette command that applies where the palette opened, ranked by a fuzzy match ofCategory: Titleas shown, in the interface’s language (and the command’s id), the commands run lately first. A command declaring arguments (an example object,{"percent": 100}) asks for each in turn, the example’s value as the default; Enter runs it in the context the palette opened in. - palettes
- Palettes: toolboxes, colour palettes, navigators floating over the
interface (not the command palette,
crate::palette). - plugin
- Plugins (ADR 0004): an id, requirements, a priority,
enabled,connectanddisconnect. Everything a plugin registers throughCtxis its own, removed when it is disconnected. - pointer
- Pointer gestures in an application, owned by egui-pop: the pointer
profile setting (
input.pointer_profile: Document, darktable, Photoshop, Lightroom Classic, Blender / node editors, Trackpad; Document unless the application picks another withAppBuilder::pointer_profile; a retired id such asadobenames its successor,lightroom), the options each profile gives its default for (input.slider_wheel,input.image_double_click,input.dock_drag: what a plain drag of a floating palette does, its default the application’s withAppBuilder::dock_drag), the wheel device (input.wheel_device) and speed (input.wheel_speed), and the gesture commands (gesture.image.zoom…) the profile binds to pointer chords in the keymap’s default layer (docs/pointer-gestures.md). - reads
- The read kernel: what a page reads from the host (a status’s value, a list’s rows), kept in one place and read away from the UI thread.
- runner
- The native runner: eframe on an event loop egui-pop owns.
- scroll_
bars - The
appearance.scroll_barssetting:autoleaves the bars to the theme,alwaysandhoverdecide over it. The system’s “always show” raisesautotoalways(AppBuilder::system_always_shows_scroll_bars), and nothing a system says lowers it. Written into the theme’s spec (ThemeSpec::scroll_bars), so that it reaches egui’s style with the theme, in every scroll area, and stays when the theme changes. - selection
- The application-wide selection: what the user selected and what the pointer is over, shared by every panel.
- services
- Services plugins share, by typed token.
- settings
- The settings form: every declared setting, by section, applied live,
each with its reset. A grid of label, editor and reset; every editor
is labelled by its setting’s label for screen readers. Sections,
labels, descriptions and a choice’s values are shown in the
interface’s language (
egui_pop_core::strings). - settings_
pages - Custom pages in the settings window (ADR 0013): a page a plugin draws itself, next to the pages generated from declared settings.
- settings_
window - The settings window, as a plugin (
SettingsPlugin, inDefaultPlugins): a search field over a tree of sections on one side and the form on the other, generated from the declared settings and applied as they change, each with its reset; and a shortcuts editor (every command with its keys, changed by pressing the new ones, the conflicts said, each change taken back by its reset). Pointer gestures are there too (docs/pointer-gestures.md): the profile in force and how many of its gestures the user changed, a filter showing them alone, each gesture’s triggers removed one by one or added by doing the gesture on a pad. - sliders
- Sliders’ steps (ADR 0011). egui-pop’s sliders
(
egui_pop_core::slider) are egui widgets: they see their changes through a hook (Slider::on_change), andhookmakes that hook run each finished change as theslider.changestep of the application: - steps
- Steps: the moments of a feature’s life an application can reach (ADR 0011). egui-pop does the plumbing (closing a window, detaching a panel, switching an arrangement, rebinding a key); at each step a plugin may:
- stories
- Gallery stories: a plugin contributes a component shown in its states, with an optional playground of its options. A gallery application lists and draws them; tests reuse them as fixtures.
- strings
- The text egui-pop’s application interface shows itself (the palette’s
prompt, the settings window’s buttons, the shortcuts editor, dialogs’
buttons, toasts, devtools, the workbench’s tab menu…), by key with
English fallbacks, read through
egui_pop_core::stringsso that the installed provider translates it. The OK, Cancel, Close, Reset and Retry buttons use core’s keys (egui_pop_core::strings::ALL). - strips
- Slim strips, as a plugin (
StripsPlugin, opt-in): the activity bar, a column of icons along the start edge, one per panel that lives in the start side bar (an icon shows its panel, a click on the shown one folds the side bar to the strip, as the workbench’sworkbench.toggle.primarySideBardoes onCtrl+B), and the status bar with indicators: small items whose state is fed by the host’s events (a job’s progress, a connection, a count), each with an optional command run on a click. - system_
keys - Shortcuts in the system scope: keys bound with
BindOptions::system()(KeyScope::System,systemin keymap files) also run their command while the application is not focused, when a plugin registers them with the desktop (the platform plugin ofegui-pop-platform). Inside the window they fire as global bindings do. - text
- The user’s text settings, owned by egui-pop, on the settings
window’s Fonts page (under Appearance): the text size
(
appearance.text_size, a percentage amongTEXT_SIZES, so the font atlas holds few sizes), applied through the theme’s size scale (ThemeSpec::text_size; only text grows: the interface zoom,zoom, scales everything), and a family for interface text and one for numbers and code (appearance.font_ui,appearance.font_mono; empty keeps the theme’s), put first in the theme’s lists (ThemeSpec::font_ui). - theme_
editor - The theme editor, as a plugin (
ThemeEditorPlugin): a theme’s tokens edited live, grouped by role, each colour with its picker and the contrast of the pairs it takes part in, started from any built-in theme, exported and imported as a token file, every change undoable. - tips
- Tips, as a plugin (
TipsPlugin): a tip of the day and contextual hints, which plugins register (Tips::add), each dismissible and remembered in the settings (tips.dismissed, the ids of the tips not to show again;tips.showturns them all off). - toasts
- Toasts, as a plugin (
ToastsPlugin, inDefaultPlugins): short notices in a corner that never take the focus, each with a level, an optional action (a command, run through the host) and a close button. Information and success go after a few seconds, warnings after longer, errors stay until closed; a thin bar empties as the time runs, and stops while the pointer is over the toast. Screen readers hear them through the live region (errors at once). - toolbars
- Toolbars drawn from their declarations (
docs/toolbars.md): a toolbar is a menu id (demo.toolbar) whose items are contributed as any menu’s (Ctx::menu_item,CommandSpec::menu, an alter hook), and drawn as a row or a column of buttons instead of a list. - wait
- Waiting on the application: until a journal event matches, or until
the application is settled. The
bridge.waitcapability and the test kit’s frame-stepping wait (egui_pop_test::wait::wait_until) share it. - window
- The window’s place, as a plugin (
WindowPlugin, inDefaultPlugins): its size, position, maximized and full-screen states are kept in the store (settings/window.*, saved with the settings, no undo step) and given back at the next start byAppBuilder::run_native, after a repair: a window whose title bar would be on no screen comes back onto the first one, one larger than its screen (or than what the GPU can draw) is shrunk. - window_
invariants - The window invariants: the registry checked against what is on screen (ADR 0029, slice 2).
- windows
- Application windows: several OS windows in one process, each almost an application of its own (ADR 0025).
- workbench
- The workbench: panels in areas (the centre, the start and end side
bars, the bottom panel), as tabs and splits drawn by
egui_stack. The versioned layout document (egui_pop_model::layout::Layout) is the saved form; the areas are the named docks of oneegui_stack::DockSpace, which is how they are drawn and rearranged by hand, and which is read back into the layout as needed. - zones
- Zones and blocks (ADR 0005). A zone is a named place; blocks are drawn in it, lightest first. Four operations: add, replace, extend (before or after a block) and wrap (around a block, receiving it as a closure). They are resolved when the application is built or a plugin comes or goes, never per frame; what cannot apply is reported with what happens instead.
- zoom
- The interface zoom, owned by egui-pop: a setting
(
appearance.interface_zoom, one value for every window, in fixed steps so each step’s glyphs are rasterised once) and commands to move it, bound by default toCtrl+Alt+=,Ctrl+Alt+-andCtrl+Alt+0and rebindable like any command. egui’s own zoom keys (Ctrl and+,-,0) are turned off: they would fire with an application’s content zoom.
Structs§
- Default
Plugins - What most applications want: the command palette, dialogs, the file
chooser, toasts, links (opened through one policy), the Settings app
(
Ctrl+,) with the settings window behind its Advanced page, the window’s place, named arrangements of the workbench (and the next components of the paved road as they come). - Minimal
Plugins - The framework alone: the shell, its menus, undo and redo, quit, the focus mode setting. No palette, dialogs or toasts.
Traits§
- Plugin
Group - Plugins added together (
AppBuilder::plugins).