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//!   [`SheetHeight`], [`Icon`].
12//! * Data contracts for secondary surfaces: [`Toast`], [`Dialog`],
13//!   [`BottomSheet`], [`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` / `BottomSheet`
31//!   values do *not* carry their own close messages.
32
33pub mod direction;
34pub mod icon;
35pub mod layout;
36pub mod menu;
37pub mod overlay;
38pub mod sidebar;
39pub mod toast;
40
41pub use direction::{Edge, LayoutDirection};
42pub use icon::Icon;
43pub use layout::AppLayout;
44pub use menu::{Menu, MenuAction, MenuItem};
45pub use overlay::{BottomSheet, Dialog, SheetHeight};
46pub use sidebar::{SideBar, SideBarItem};
47pub use toast::{Toast, ToastIntent, ToastLifetime};