crisol-core 1.3.0

Crisol core: an egui-free data model, themes, metrics, localization, commands, state, and storage.
Documentation
//! Named commands, contexts, rebindable keys, and the registry.
//!
//! A workbench application describes each action once as a [`Command`], registers it in
//! a [`CommandRegistry`], and lets menus, the palette, the title bar, context menus, and
//! keyboard shortcuts all read that registry. Nothing has to be wired three times.
//!
//! The core owns the metadata, the `when` language, the key syntax, the sequence state,
//! and the conflict rules. The UI adapts `egui::Key`/`egui::Modifiers` and feeds
//! [`CommandRegistry::handle_key`]; it keeps only the widgets (CORE-KEY-01..04).
//!
//! ```
//! use crisol_core::commands::{Command, CommandRegistry, WhenContext};
//!
//! let mut registry = CommandRegistry::new();
//! registry.register(Command::new("file.save", "Save").shortcut("Ctrl+S"));
//! registry.register(
//!     Command::new("edit.paste", "Paste")
//!         .shortcut("Ctrl+V")
//!         .when("editorFocus && !dialogOpen"),
//! );
//! let context = WhenContext::new().with("editorFocus");
//! assert_eq!(registry.bindings().len(), 2);
//! ```

pub mod chord;
pub mod command;
pub mod key;
pub mod keybindings;
pub mod registry;
pub mod when;

pub use chord::{KeyChord, KeySequence};
pub use command::{ArgKind, ArgSchema, BindingError, Command, CommandId, CommandState};
pub use key::{Key, Modifiers, ParseKeyError};
pub use keybindings::{KeybindingEntry, Keybindings, KeybindingsError};
pub use registry::{BindingConflict, CommandRegistry, KeyOutcome, PaletteEntry};
pub use when::{
    DIALOG_OPEN, DIRTY, EDITOR_FOCUS, HAS_SELECTION, PALETTE_OPEN, READ_ONLY, When, WhenContext, WhenError,
};