makeover-timing
The time axis of the make-family design system.
makeover resolves colour,
makeover-geometry resolves
distance, and
makeover-layout names what a
thing is without resolving anything. This crate answers the remaining question
of the same shape: how long.
A duration is named by what it is waiting for
| Moment | What it waits for | Resolves to |
|---|---|---|
revert |
a control returning to its resting label after confirming | 1500ms |
clear |
a status line emptying itself | 2000ms |
dismiss |
a transient notice's lifetime | 3000ms |
debounce |
typing settling before the work starts | 150ms |
One duration per moment, on every renderer
A moment resolves to exactly one duration everywhere, whatever the renderer and whatever the theme.
There is no per-renderer table, unlike geometry's Density: a browser, egui
and a terminal resolve a moment to the same duration.
What is deliberately not a moment
A race is not a moment. Waiting 300ms before navigating because the write "should" have landed, or 150ms before closing a dropdown so a mousedown can beat the blur, has no token here.
Severity is not a moment, and it is not a fifth number. A message the user
must not miss does not go away on its own. makeover-layout already has the
word for that (such a message is not Notice::transient), and a banner has no
lifetime.
A poll interval is not a moment. A retry backoff, a health check or an update check is set by the service it talks to, and has no token here.
Motion and cadence are separate axes
Moment says how long a state lasts. Motion says how long a change takes,
and Cadence says how often a repeating mark repeats. In CSS a Moment is a
setTimeout delay and a Motion is a transition-duration, so 300ms of fade
and 3000ms of toast are separate tokens.
Reduced motion:
- Web.
timing_csscarries aprefers-reduced-motion: reduceblock that sets everyMotionandCadencetoken to0ms. - Other renderers.
Motion::duration_for,activity_blinkandblinktake theMotionPreferencethe platform reported. UnderReduceda motion takes no time and the activity mark is lit and still.Motion::durationis the full duration under either preference. - A
Momentis the same under either preference.
Using it
Web surfaces bake the stylesheet in at build time. Nothing here changes at runtime, so there is no load-time JS step:
use timing_css;
write?;
egui and ratatui surfaces resolve through Duration instead:
use ;
let preference = Reduced; // as the platform reported it
let settle = Debounce.duration;
let gone = notice_lifetime
.map;
notice_lifetime takes a Persistence, the description's answer to "does
this go away on its own", rather than makeover-layout's Notice; this crate
does not depend on makeover-layout.
Licence
MIT.