Skip to main content

Crate frust_glyph

Crate frust_glyph 

Source
Expand description

frust-glyph: the Glyph design system, packaged as a design-system plugin.

Glyph is a terminal-native, dark-first, monospace-led design language — “inspired by Material 3 Expressive, Liquid Glass, and Yaru research · original tokens”. This crate is the whole system: the tokens module (color schemes, type/shape/elevation/motion/glass scales, the brightness-invariant GlyphInk extension, the assembled [baseline] theme), the bundled monospace faces, the two Glyph motion patterns, and the widget catalog.

The catalog holds two kinds of component. Most are terminal-native ones with no Material or Cupertino equivalent (badges/tags/alerts, loaders + toast, nav chrome, content cards, the terminal block + tooltip, and the command-palette overlay). The rest are ordinary controls whose authored Glyph design diverges from what re-theming a baseline widget would produce — the baseline set is token-themed, not re-designed, per design language. [toggle] is the first of those: Glyph authors its own switch (a hairline-bordered pill with a constant-diameter springing knob and an accent wash), and the baseline deliberately ships no Switch at all for it to re-theme.

§Installing it

install is the one-line entry point, and it must run before the first frame: a shell reads the default-theme slot and drains the font registry once, at construction. The supported place is app!’s setup block, which runs before any shell construction:

use frust::{AnyView, Component, any, text};

#[derive(Default)]
struct MyApp;

impl Component for MyApp {
    type State = ();
    fn init(&self) -> Self::State {}
    fn build(&self, _state: &mut Self::State) -> AnyView<Self::State> {
        any(text("glyph"))
    }
}

frust::app!(MyApp, setup = { frust_glyph::install(); });

§Namespace

Every catalog module is re-exported wholesale from this root, so app code names one flat namespace — frust_glyph::GlyphBadge, frust_glyph::show_glyph_dialog, frust_glyph::baseline() — alongside the frust::* baseline widgets a Glyph screen composes with.

§Charter

  • Token-driven, never design-language-branching. A Glyph widget resolves Theme::from_paint_ctx/from_layout_ctx and reads the Glyph token tables (tokens’ color schemes, type scale, status palette, GlyphInk, …) with an unthemed-fallback constant per resolved value — exactly like every baseline widget. It never matches on DesignLanguage; a Glyph theme is just a Theme whose token tables happen to be the Glyph ones.
  • Facade-only. Widgets are View/Widget pairs authored against frust::authoring (plus kurbo/peniko for geometry and color); this crate names no other framework crate, and nothing reactive.

§Fonts

The Space Mono and IBM Plex Mono faces the Glyph type scale names are compiled in and registered by install behind the crate’s bundled-fonts feature (default on); an app that sets default-features = false on this dependency compiles in no font bytes, install() registers none, and text falls back to the platform’s system faces through fontique (Roboto on Android). Both families are OFL-1.1 and ship with their license text and provenance record (plugins/glyph/fonts/README.md). font_data exposes the raw bytes for a host that wants them directly. Each family’s italic face ships too, even though the catalog itself never requests FontStyle::Italic — see tokens::fonts’s module doc for the measurement behind keeping them (dropping them would silently fall back to plain upright text for an app’s own italic request, not a synthesized oblique).

Re-exports§

pub use tokens::GlyphInk;
pub use tokens::baseline;
pub use tokens::baseline;
pub use tokens::font_data;
pub use accordion::*;
pub use alert::*;
pub use appbar::*;
pub use avatar::*;
pub use badge::*;
pub use breadcrumb::*;
pub use card::*;
pub use command_palette::*;
pub use dialog::*;
pub use dots::*;
pub use empty_state::*;
pub use list::*;
pub use menu::*;
pub use navbar::*;
pub use progress::*;
pub use radio::*;
pub use reveal::*;
pub use segmented::*;
pub use sheet::*;
pub use side_sheet::*;
pub use skeleton::*;
pub use stat_card::*;
pub use tabs::*;
pub use tag::*;
pub use term_block::*;
pub use toast::*;
pub use toggle::*;
pub use tooltip::*;

Modules§

accordion
accordion/AccordionView: a disclosure panel — a pressable header row (title + a chevron that rotates 90° as it opens) over a height-animated body child view (the Glyph design system’s .accordion). Controlled: the caller owns the open: bool and receives on_toggle on a header press; the widget never mutates its own open state (the same never-self- mutating contract crate::material::navbar uses).
alert
alert/AlertView: an icon + title + body inline banner with four semantic variants (the Glyph design system’s .alert* rules, retrieved 2026-07-21) — “Layout refresh is every 3 seconds” (info), “Session synced” (success), “Certificate expires in 6 days” (warning), “Connection lost” (error) in the design system’s demo section.
appbar
Glyph top AppBar — core: the compact terminal-native top bar per the Glyph design system’s sections 01/03/05, retrieved 2026-07-22.
avatar
avatar/AvatarView: an initials box — a small rounded square with a faint accent wash, an accent hairline border, and centered accent-colored initials (the Glyph design system’s .avatar rule). Purely a leaf display widget (no interaction), so — like [super::badge] — it shapes and paints its own glyph run rather than nesting a frust::TextView, and its View impl is generic over any State.
badge
badge/BadgeView: a small, lowercase, pill-shaped status indicator — “connected”/“degraded”/“offline”/“read-only”/“v0.44.1” in the Glyph design system’s .badge* rules (retrieved 2026-07-21) — with six semantic variants and an optional leading dot.
breadcrumb
breadcrumb/BreadcrumbView: an inline path of tappable crumbs joined by / separators, the last crumb being the current (non-link) location (the Glyph design system’s .breadcrumb/.breadcrumb a/ .breadcrumb .sep/.breadcrumb .current rules, retrieved 2026-07-21).
card
glyph_card/GlyphCardView: the Glyph content card — a surface container with a bright hairline border and the radius-lg corner, holding up to three optional child-view slots stacked vertically: title, desc, and footer (the Glyph design system’s .card with .card-title/.card-desc/.card-footer).
command_palette
Glyph command palette: the signature amber-ring overlay — a prompt-prefixed search field over a filtered result list, the Glyph recipe over the existing navigator transparent-push modal plumbing.
dialog
Glyph modal dialog: a scrim + centered surface panel confirmation dialog — the Glyph recipe over the existing navigator transparent-push modal plumbing.
dots
Glyph three-dot loader: three dots opacity-pulsing on a 1.2s cycle, each offset 0.15s behind the last — the classic “typing indicator” loop.
empty_state
empty_state/EmptyStateView: the “nothing here yet” placeholder — a dashed-border panel with a large, faint centered glyph slot (a font char by default, the Space Mono display face — or a vector icon, see below), a title, a description, and an optional action child-view slot (the Glyph design system’s .empty-state).
list
glyph_list/GlyphListView + GlyphListItem: a bordered, rounded list container whose rows are data (not child views) — each a leading glyph box (a 32px raised square holding an accent glyph char) + a title/sub text column + an optional right-aligned meta + an optional chevron (the Glyph design system’s .list/.list-item).
menu
Glyph anchored dropdown menu: a small chooser that scales in from an anchor’s own corner rather than the screen center, the Glyph recipe over the existing navigator transparent-push modal plumbing. The Glyph design system’s “overflow menu” section (retrieved 2026-07-23) is the primary source; the AppBar’s overflow kebab is its first consumer, but the API is anchor-agnostic — any widget that can report its own painted window-coordinate rect can open one.
motion
The two Glyph motion patterns: GlyphSlide (directional 16dp slide + fade, a TransitionPattern a PatternSwitcher stages a child pair under) and GlyphStagger (per-item log-reveal, a plain per-item helper).
navbar
glyph_nav_bar/GlyphNavBarView: the Glyph bottom navigation bar — a raised, bordered bar of 2-5 destinations, each a glyph/icon above a tiny 9.5px micro label, the active one tinted accent (the Glyph design system’s .bottom-nav-demo/.bottom-nav-item/ .bottom-nav-item.active/.bottom-nav-glyph rules, retrieved 2026-07-21).
progress
Glyph shimmer progress bar: a determinate fill in the Glyph accent (bright amber) over the Glyph “progress track” role, with a continuously sweeping shimmer highlight over the filled region.
radio
radio/RadioView: a labelled, ring-and-dot radio button — the Glyph selection control frust::authoring’s baseline Radio cannot fill for a themed catalog: baseline’s RadioView renders its label at TextStyle::default() (no family/size/color the active Theme can ever reach), so an app whose row wants a design-authored typeface and ink has nothing to build on. This widget closes that gap: a single self-contained View/Widget pair painting its own ring, dot and label glyph run, resolving color from Theme exactly like every other Glyph widget.
reveal
glyph_reveal/GlyphRevealView: the tree-expansion vocabulary — a controlled container that animates its own height between nothing and its children’s natural extent, cascades those children in as it opens, and optionally rules a dashed guide line down its leading edge. glyph_chevron is its companion leaf: the small rotating disclosure marker a row pairs with a reveal (public on its own, so any row can reuse it).
segmented
segmented_control/SegmentedControlView: a pill container of mutually-exclusive segments — the active one gets a raised surface fill and accent text (the Glyph design system’s .segmented/.segmented button/.segmented button.active rules, retrieved 2026-07-21).
sheet
Glyph modal bottom sheet: a full-area scrim + a bottom-anchored panel wrapping a single app-provided content view — the Glyph recipe over the same navigator transparent-push modal plumbing crate::dialog uses.
side_sheet
Glyph modal side sheet: a full-area scrim plus a trailing-edge-pinned, full-height panel holding a sticky header, a body, and an optional sticky footer — the x-axis sibling of crate::sheet’s bottom sheet, over the same navigator transparent-push modal plumbing.
skeleton
Glyph skeleton placeholder: a fixed-size box painted with a repeating 3-stop gradient sweep — the “content is loading” shimmer placeholder pattern.
stat_card
stat_card/StatCardView: a compact metric readout — an uppercase dim label, a large display-family value, and an optional semantic delta (a signed change badge) — inside the same surface/bright-border/ radius-lg chrome as super::card (the Glyph design system’s .stat-card). A leaf display widget with no interaction and three text runs, so — like [super::badge] — it shapes and paints its own glyph runs rather than nesting frust::TextView children, and its View impl is generic over any State.
tabs
tabs/TabsView: a horizontal tab strip with one moving 2px underline indicator that animates its position/width to the active tab (the Glyph design system’s .tabs/.tab/.tab.active rules, retrieved 2026-07-21).
tag
tag/TagView: a neutral, removable chip (the Glyph design system’s .tag/.tag button rules, retrieved 2026-07-21) — a raised-surface pill carrying a label and an optional trailing “×” remove affordance.
term_block
term_block/TermBlockView: a rounded terminal-style output block — the Glyph design system’s .term-block/.term-head/ .term-body rules (retrieved 2026-07-21): a three-dot header strip over a monospace body of TermLines, each typed Prompt/Output/Comment with its own ink color.
toast
Glyph toast + host/queue: a status-dot + message bubble (Toast), and ToastHost — the retained overlay widget that plays a queue of toast requests one at a time with authored enter/hold/exit motion and a 2.4s auto-dismiss.
toggle
toggle/ToggleView: the Glyph switch — a 38×22 pill track whose 16px knob springs 16px across on a state change (the Glyph design system’s .toggle rules and the motion reference’s own “toggle spring” section, retrieved 2026-07-21).
tokens
The Glyph design language: a terminal-native, dark-first, monospace-led token set — “inspired by Material 3 Expressive, Liquid Glass, and Yaru research · original tokens”.
tooltip
tooltip/TooltipView: a transparent long-press-to-peek label bubble wrapper — the Glyph design system’s light-page .tooltip-bubble rule (retrieved 2026-07-21): a small dark bubble, centered 8px above the wrapped child, shown while the child is held past the shared long-press threshold and dismissed on release. Like crate::term_block, every painted color here is a GlyphInk field or a literal fallback constant — never a brightness-swapped ColorScheme role (“a tooltip is a floating overlay, not page content”). The design system’s own light-page CSS override for .tooltip-bubble (border/shadow spelled out as literal rgba(255,255,255,.1)/rgba(34,29,18,.25), distinct from the dark page’s var(--border-bright)/black-shadow rule) is exactly what this module’s [TOOLTIP_BORDER]/[TOOLTIP_SHADOW_BASE] pin — the same “light source’s literal dark-ink swatches” precedent GlyphInk’s own module docs cite.

Functions§

install
Make the Glyph design system this app’s starting point.