Expand description
State-driven text-color / opacity / box-shadow / background swaps.
The CSS parser routes :hover / :focus / :active / :disabled
declarations for text-color, opacity, and box-shadow (plus
bg for :disabled) into a StateVisuals component (one
StatePatch per state); this module’s apply_state_visuals
system swaps the live TextStyle / Opacity /
Visuals::shadows / Visuals::fill values as the interaction
markers come and go, holding them in
StyleOverrides and
letting go onto the element’s own styles when every state ends. Swaps
snap (no tween), matching CSS state rules without a transition -
exactly like the border swap in crate::hover::apply_state_borders.
:disabled reacts to the
Disabled marker at runtime
(Wave 3: bind-disabled can add / remove it live). Statically
disabled markup without a binding takes its :disabled styles as its
own computed style (lumen_scene::computed); the patch here drives
every dynamic case.
eject_interaction_on_disable strips Hovered / Pressed /
focus the moment an entity becomes disabled (moving keyboard focus
to the next focusable) so no interaction state lingers on a
greyed-out widget.
Structs§
- State
Patch - One state’s property patch. Only authored fields swap; the rest keep the idle value.
- State
Patched - Marks an element whose state patch
apply_state_visualsholds, and names its layer inStyleOverrides. - State
Style Plugin - Plugin: registers
eject_interaction_on_disablethenapply_state_visuals. - State
Visuals - Author-set per-state style patches. Pressed wins over focused wins over hovered on a per-field basis (mirrors the cascade order skins author these rules in); disabled stamps over everything.
Functions§
- apply_
state_ visuals - Swap text color / opacity / shadows / background per interaction state, and let them go when every state ends.
- eject_
interaction_ on_ disable - The moment an entity gains
Disabled(spec section 0: runtime enable/disable viabind-disabled), strip every live interaction state from it: