Skip to main content

snora_core/
lib.rs

1//! # snora-core
2//!
3//! The contract and vocabulary layer of the Snora GUI framework.
4//!
5//! This crate has **no dependency on iced**. It defines:
6//!
7//! * The shape of an application layout ([`AppLayout`]) — the skeleton an
8//!   engine implementation is expected to render.
9//! * Vocabulary enums that spell out the canonical *choices* an application
10//!   can make: [`LayoutDirection`], [`ToastIntent`], [`ToastLifetime`],
11//!   [`ToastPosition`], [`SheetEdge`], [`SheetSize`], [`Icon`].
12//! * Data contracts for secondary surfaces: [`Toast`], [`Dialog`],
13//!   [`Sheet`], [`Menu`], [`MenuItem`], [`SideBar`], [`SideBarItem`].
14//!
15//! The `snora` sibling crate binds these contracts to iced and provides the
16//! actual render engine. Other engines (e.g. a test double, a WGPU frontend,
17//! a WASM/HTML backend) could be built against this vocabulary without
18//! depending on iced.
19//!
20//! # Non-goals
21//!
22//! * **No trait-driven rendering.** Earlier drafts of snora exposed a
23//!   `PageContract` trait that declared `view`, `dialog`, `toasts`, etc.
24//!   In practice the render engine did not consume the non-`view` methods,
25//!   forcing users to plumb them manually. v0.4 drops the trait and keeps
26//!   all overlay state as plain fields on [`AppLayout`].
27//!
28//! * **No user-extensible close hooks.** Closing an overlay is a single
29//!   concern with a single channel: [`AppLayout::on_close_menus`] and
30//!   [`AppLayout::on_close_modals`]. Individual `Dialog` / `Sheet`
31//!   values do *not* carry their own close messages.
32
33#![warn(missing_docs)]
34#![cfg_attr(docsrs, feature(doc_cfg))]
35
36/// Breadcrumb trail — [`Crumb`], [`BreadcrumbAction`].
37pub mod crumb;
38/// Reading direction and logical edges (`Start`, `End`).
39pub mod direction;
40/// Frame-level keyboard zone navigation — [`focus::FocusZone`],
41/// [`focus::next_zone`].
42pub mod focus;
43/// Icon enum and its source variants (text, Lucide, SVG).
44pub mod icon;
45/// The application skeleton ([`AppLayout`]).
46pub mod layout;
47/// Header / context menu vocabulary.
48pub mod menu;
49/// Modal overlay surfaces — [`Dialog`], [`Sheet`].
50pub mod overlay;
51/// Vertical navigation rail.
52pub mod sidebar;
53/// Horizontal tab bar — [`TabBar`], [`Tab`], [`TabAction`].
54pub mod tab;
55/// Toast notifications and lifetime / position vocabulary.
56pub mod toast;
57
58pub use crumb::{BreadcrumbAction, Crumb};
59pub use direction::{Edge, LayoutDirection};
60pub use focus::{Cycle, FocusZone, ZonePresence};
61pub use icon::Icon;
62pub use layout::AppLayout;
63pub use menu::{Menu, MenuAction, MenuItem};
64pub use overlay::{Dialog, Sheet, SheetEdge, SheetSize};
65pub use sidebar::{SideBar, SideBarItem};
66pub use tab::{Tab, TabAction, TabBar};
67pub use toast::{Toast, ToastIntent, ToastLifetime, ToastPosition};