Skip to main content

Crate makeover_touch

Crate makeover_touch 

Source
Expand description

The adaptation layer of the make-family design system.

makeover answers what colour. makeover-geometry answers how much space, and owns the two axes an adaptation is stated against: Density (pointer or touch) and SizeClass (compact, medium, expanded). makeover-layout answers what the thing is. This crate answers one question and no other:

Does this affordance exist here?

Like makeover-layout it emits nothing. It is a description, rendered to CSS by makeover-webview and to whatever the other renderers can express.

§Why this is a crate and not a density preset

What an adaptive stylesheet changes falls into buckets, and each has an owner:

bucketretired by
densitya makeover-geometry preset
typethe type scale
columnsmakeover_layout::Column
reflowmakeover_layout::Arrangement
show/hidethis crate
repositionthis crate
appearancethis crate

The bottom three are what no spacing scale can retire. display: none on a keyboard hint says the affordance does not exist on touch. No amount of gap retuning expresses that, and a scale that tried would be putting a product claim on a measurement axis.

Affordance::Gesture and Affordance::Haptic adapt behaviour, which no stylesheet contains. Without them the density question gets answered in script by sniffing ('ontouchstart' in window), where no stylesheet can see it.

§The two axes are borrowed, never redefined

Boundaries are not this crate’s job. makeover-geometry quotes Material 3’s window size classes at 600 and 840 and carries Density; this crate names affordances against those two and adds no third axis, no fourth class and no breakpoint of its own. If a rule here wants a boundary that does not exist, that is a conversation with makeover-geometry, not a constant.

§What density is allowed to gate

Density is a claim about the contact patch and nothing else. So it gates affordances that depend on an interaction a fingertip cannot perform: hovering, and the keyboard chrome that documents shortcuts a touch surface has no way to send. It does not gate anything that is really about how much screen there is. A phone is small and touch; a tablet is big and touch.

density_gates_only_what_the_contact_patch_touches asserts that separation. Putting a screen-budget claim on the input device is the failure this crate exists to prevent, and re-introducing it has to come to the test and say so.

§Both densities gain something

Touch is not pointer minus what a fingertip cannot do. Affordance::Hover’s own doc says a fingertip has no hover state and that something else has to carry the same actions, so something here has to be that something. Affordance::Anchored and Affordance::Overflow compensate on the size axis; Affordance::Gesture and Affordance::Haptic compensate on the density axis, and both are gained by touch rather than lost to it.

Affordance::gained_by makes each member declare which density it belongs to, and a_density_member_is_available_on_exactly_the_density_it_declares checks the declaration against the rule. So a new member still cannot quietly invert: it has to say which way it goes, in code, and the test is where a wrong answer surfaces.

§Collapsing is allowed, inverting is not

Borrowed verbatim from makeover-geometry, where two gap relationships both resolve to zero cells on a terminal and stay two members regardless. Two affordances here may have identical availability (Affordance::Hover and Affordance::Hint do) and are still two members, because the call site names what is being gated, not the rule. What must never happen is one of them becoming available where the other is not for a reason that is really the same reason.

§Deliberately absent

A navigation shell fork. Two navigation shells behind one breakpoint are two shells rather than one shell adapting, and choosing to build two is a product decision. This crate will not describe it. Named here the way makeover-layout names validation absent, so nobody has to discover it.

Which columns a narrow window keeps. A column is ranked rather than gated, so the cutoff for a size class lives with the ranking, in makeover-layout’s column module.

Which class applies. The app decides, from a measured width via SizeClass::at_width and from whatever it already knows about the input. This crate takes both as arguments and never sniffs.

What a renderer does when an affordance is unavailable. Hiding it, substituting it, or showing it unconditionally anyway is renderer policy. makeover-layout already deleted Fill::fallback for being exactly that.

Enums§

Affordance
An affordance whose existence depends on the surface it is offered on.
Axis
The axis an Affordance reads: the input class or the screen budget.
Density
Which input the layout is being sized for.
SizeClass
How much screen there is, independent of what is pointing at it.