# makeover-timing
The time axis of the make-family design system.
[`makeover`](https://makenot.work/git/max/makeover) resolves colour,
[`makeover-geometry`](https://makenot.work/git/max/makeover-geometry) resolves
distance, and
[`makeover-layout`](https://makenot.work/git/max/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
| `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_css` carries a `prefers-reduced-motion: reduce` block that
sets every `Motion` and `Cadence` token to `0ms`.
- **Other renderers.** `Motion::duration_for`, `activity_blink` and `blink`
take the `MotionPreference` the platform reported. Under `Reduced` a motion
takes no time and the activity mark is lit and still. `Motion::duration` is
the full duration under either preference.
- A `Moment` is 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:
```rust
use makeover_timing::timing_css;
std::fs::write("static/timing.css", timing_css())?;
```
egui and ratatui surfaces resolve through `Duration` instead:
```rust
use makeover_timing::{Moment, Motion, MotionPreference, Persistence, notice_lifetime};
let preference = MotionPreference::Reduced; // as the platform reported it
let settle = Moment::Debounce.duration();
let gone = notice_lifetime(Persistence::Transient)
.map(|life| life + Motion::Fade.duration_for(preference));
```
`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.