tilo_app/framework/views/mod.rs
1//! Views: the mechanism behind an app's designed views and its search.
2//!
3//! A view is a query over the app's resources plus a layout. The app's
4//! designed views (a library, a page per album) are crafted and fixed; this
5//! module is what they stand on, never something people configure:
6//!
7//! - **Resource types** ([`KindDecl`]): each type's fields, the role a field
8//! plays where an item is shown ([`FieldRole`]), which fields typed text
9//! finds and which narrow by a chip ([`FilterKind`]), and how its items are
10//! presented in a list of results ([`Form`]). Every place an item appears
11//! renders through the app's presentation of its type, so a search result
12//! is the same song as in the library.
13//! - **A view stack per window** ([`ViewStack`]): back and forward always
14//! work, and returning to a view restores where the person was in it
15//! ([`ViewPlace`]).
16//! - **Search is a view.** Typing into the window bar's search field turns
17//! the window's view into a query view of the app's resources
18//! ([`QuerySpec`]): results grouped by type, chips under the field from the
19//! filterable fields ([`facet_offers`], [`facet_bar`]), typed tokens
20//! (`artist:ada`) mapped onto the same chips, and the app's actions that
21//! match in a trailing "In this app" group as their real controls
22//! ([`action_hits`], [`actions_group`]). Escape or Back returns to the view
23//! before, exactly.
24//! - **The query** ([`QueryEngine`]): local items answered from an index in
25//! the frame of the keystroke; remote sources ([`RemoteSource`]) streamed
26//! into their own sections below, with cancellation, a cache by query,
27//! reuse of an earlier answer while a refined query is on the way, and rows
28//! that never move under the person's pointer or keyboard. An app whose
29//! search already has entries hands those over ([`Item::from_entry`]): one
30//! search model feeds the platform search and the app's query view, and a
31//! match inside an entry's prose is a hit at its passage.
32//! - **Keeping** ([`KeptViews`]): any query view can be kept, and then sits
33//! beside the designed views as the person's own.
34
35mod actions;
36mod chips;
37mod engine;
38mod kept;
39mod kind;
40mod query;
41mod stack;
42
43pub use actions::{
44 ActionHit, ControlDecl, ControlKind, action_control, action_hits, actions_group,
45};
46pub use chips::{FacetMenu, FacetOffer, FacetValue, OpenFacet, facet_bar, facet_offers};
47pub use engine::{
48 Cancel, FRESH, GROUP_LIMIT, LocalSource, QueryEngine, QueryResults, QueryTimings, RemoteError,
49 RemoteSection, RemoteSource, ResultGroup, THROTTLE, excerpt,
50};
51pub use kept::{KeptView, KeptViews};
52pub use kind::{FieldDecl, FieldRole, FilterKind, Form, Item, KindDecl, filters};
53pub use query::{Chip, QuerySpec};
54pub use stack::{ViewEntry, ViewPlace, ViewStack};
55
56#[cfg(test)]
57mod tests;