Skip to main content

size_class_css

Function size_class_css 

Source
pub fn size_class_css() -> String
Expand description

Emit the compact-window shell override.

The one place this crate is allowed to ask how wide the window is. Density must never be selected by width — density_css has a test forbidding a breakpoint from appearing in it at all — because a capability query answers “what is pointing at this” and a breakpoint does not. Size class is the opposite: width is exactly what it means, so it gets its own emitter and its own media query rather than being folded into that file.

Only the two shells move, and only below SizeClass::Medium’s boundary: pane 24 to 16, page 32 to 24. The four gaps between controls are absent from the block, so a narrow window never reasons about tap targets.

Emitted inside CSS_LAYER for the same reason density_css is: an unlayered custom property outranks a layered one, so an app that layers its own overrides would otherwise lose to this.

let css = size_class_css();
assert!(css.contains("--gap-pane"));
assert!(!css.contains("--gap-peer"), "a control gap crept into a width query");