pub struct Breakpoints { /* private fields */ }Expand description
Fail the build if a hand-written breakpoint has drifted from SizeClass.
Every pixel width named by a media or container query must be a
SizeClass boundary or one of the tuning widths. A
container query is checked the same way: @container screen (width < 600px)
states a width, and a container whose inline size tracks the shell is a
breakpoint in disguise, so it must move with SizeClass or be declared a
tuning width like any other.
makeover_webview::build::drift::Breakpoints::in_frontend("frontend")
.tuning(&[1400])
.run();Without this, moving SizeClass::Medium::min_px regenerates the emitted
stylesheets and leaves every hand-written query behind, and the result is a
stylesheet that disagrees with itself at the old boundary rather than an
error.
The generated stylesheets are scanned too, and pass by construction: they ask makeover-geometry for the number rather than stating it. Scanning them means a consumer never has to name which files are hand-written.
Implementations§
Source§impl Breakpoints
impl Breakpoints
Sourcepub fn in_frontend(frontend: impl AsRef<Path>) -> Self
pub fn in_frontend(frontend: impl AsRef<Path>) -> Self
Every .css under frontend/css and every .js under frontend/js,
recursively.
Sourcepub fn files<P: AsRef<Path>>(paths: &[P]) -> Self
pub fn files<P: AsRef<Path>>(paths: &[P]) -> Self
A named list of files rather than a tree.
For a frontend whose generated and hand-written files share a directory,
with nothing to point a directory scan at: the MNW server keeps both
under static/ beside a bundler’s output. The list is hand-maintained,
and a stylesheet nobody adds to it is unchecked rather than failing, so
prefer in_frontend where the layout allows it.
A .js path is read as script and anything else as stylesheet.
Sourcepub fn tuning(self, widths: &[u16]) -> Self
pub fn tuning(self, widths: &[u16]) -> Self
Widths inside a shell where something reflows without the shell changing: a dashboard dropping from three columns to two, a pane’s width cap ending.
The one thing an app gets a say in. A shell boundary is a SizeClass
edge and belongs to makeover-geometry; nothing switches shells at a
tuning width, so it does not move when a size class does. Each entry
owes a note beside it saying what it tunes: this list is where a genuine
boundary goes to hide from the check.
Sourcepub fn run(&self)
pub fn run(&self)
Run the check. Emits cargo::rerun-if-changed for every file it read,
and for the scanned directories.
§Panics
If a listed file cannot be read (a listed path that no longer exists is a check covering less than it says), or if any width is neither a size-class boundary nor a tuning width. A build script has nowhere useful to return an error to.