Skip to main content

Module style_overrides

Module style_overrides 

Source
Expand description

The values runtime systems hold on an element over what its styles say.

An element’s styles are a function of the cascade: the user-agent and skin sheets, the app’s stylesheet, what its markup declares and what a script set with set_style. A restyle recomputes them from all of that, so a class removed takes with it every property only that class set.

Some values are not the cascade’s to decide. A hidden <if> is display: none while its signal is false; an open popup sits where the edge-flip put it; a virtualized row sits in its slot; a hovered button fades toward its tint. The system that owns such a value holds it here, in StyleOverrides, instead of writing the live component behind the cascade’s back. The live components are always the cascade’s result with every held value laid over it, so a restyle that recomputes the cascade keeps them: it records the new resting values here and leaves the held fields alone, and when a system lets go the field drops back to what the cascade says now, not what it said when the system took hold.

Holders stack by StyleOwner::RANK: a press tint over a hover tint over a toggle’s checked fill over the cascade. A holder that blends toward its own value from whatever is under it (a tint fading in) reads that through StyleOverrides::below.

Structs§

Live
The live components of one element, read when a holder takes a field nobody held yet: at that moment the live value is the cascade’s.
StyleFields
The style values a runtime system can hold on an element.
StyleOverrides
The values runtime systems hold on one element; see the module docs.
StyleValues
A value for some of the StyleFields; None leaves a field out.

Traits§

StyleOwner
A runtime system that holds style values on elements.

Functions§

hold_on
Hold values for O on one element and write what it shows now: the form for a holder that reaches the element through the world rather than through a query. Inserts the StyleOverrides the element lacks.
release_on
Stop holding anything for O on one element and write what it shows now; see hold_on.
write_on
Write values onto an element’s live components, touching only what differs.