Skip to main content

Crate makeover_immediate

Crate makeover_immediate 

Source
Expand description

The immediate-mode renderer for makeover_layout.

Named for the mode, not the library, the way makeover-tui is named for the target and not for ratatui. Immediate mode is the constraint that actually separates this renderer from the other two, and egui is the backend it is written against.

It is the harshest renderer the description has to survive: no box-shadow, no inset, no cascade, no retained tree to mutate, and Visuals.widgets.*.bg_stroke is a single stroke with no per-side control. A two-tone lit edge is not something egui can be configured into producing, so it gets painted by hand here, once, instead of in every consuming app.

§What this crate draws

The parts of the description that carry no vocabulary member: depth (frame, paint_bevel), the resolved colours (Palette), a table’s per-frame facts and cell tones (table), the token and the waiting marks (piece), and the egui visuals and metrics a host starts from (host).

The vocabulary members (fields, columns, meters, controls, facts, figures and charts) are drawn by quasi-immediate, which owns those types through quasi-router and calls into this crate for everything above. The style types it draws them with stay here: FieldStyle, Editing, piece::PieceStyle and table::TableStyle.

§What this crate does and does not own

It owns the expression: two mitred polylines for a bevel and a Frame for a filled region. It owns no colours and no substitutions: makeover derives surface-well and every consumer reads the real token. Palette is supplied by the caller already resolved.

It picks no sizes either. Every radius, margin, stroke width and floor arrives in a style type (FrameStyle, FieldStyle, piece::PieceStyle, table::TableStyle, host::Metrics), and where one has a default it is the suite’s number rather than this crate’s: the focus ring and the target floor in host::Metrics default to what makeover-webview emits.

makeover itself is linked only by the theme feature, for Palette::from_theme: it embeds every shipped theme file, and an app that resolves its own colours should not carry them.

§The cascade is the real difference

A stylesheet can say “a pressed button inverts its bevel” once and let the cascade carry it. An immediate-mode renderer has nowhere to put that, so every call site decides. makeover_layout::Depth::pressed is what keeps the decision from being re-derived per widget.

§Overlays

Palette::cast is what overlaying means in immediate mode. frame hands the cast shadow to the egui::Frame for any depth whose fill is Fill::Overlay, keyed off the fill rather than the variant.

§Tones

Palette carries the three status intents together rather than one per widget, for the reason Palette::fill is an Option: Tone is five members wide, and a resolver missing one has to invent a colour, which is a substitution this crate does not make.

§Focus and chrome

Focus is not describable, and egui owns all of it here. Reach, focus and the focus ring are this renderer’s three answers and egui already has all three: its own id stack decides what is reachable, its own state decides what holds the keyboard, and it paints exactly one ring. Drawing a second ring on top of egui’s would break the one-ring rule. The terms are defined once in makeover_layout’s crate header, “Reach, focus and the focus ring”.

App-level chrome is not drawn here. quasi-router names the affordances that outlive one screen, and quasi-immediate answers them: this crate depends on makeover-layout and not on quasi-router, one layer below the renderers that consume a Screen.

Modules§

host
The design system, handed to egui as a Style.
piece
The described things that are not fields, tables or frames, and carry no vocabulary member: a token and a wait.
table
A table’s style, its per-frame facts, and the tone each part of a cell takes.

Structs§

FieldStyle
The geometry a field group is drawn with.
FrameStyle
The geometry a framed region is drawn with.
MissingToken
A token Palette::from_theme needed and the theme did not resolve.
Palette
The resolved colours this renderer needs, as flat values.

Enums§

Editing
What the field currently holds, borrowed from wherever the app keeps it.

Functions§

frame
Draw a region at a given Depth: its fill and its edge, together.
paint_bevel
Paint a two-tone edge just inside rect.