euv_ui/hook/use_reduced_motion/struct.rs
1use super::*;
2
3/// Reactive state for the user's motion preference.
4///
5/// The handle carries the current answer and the teardown that removes
6/// the `change` listener from the browser's `MediaQueryList`.
7///
8/// A `true` answer means the user asked the operating system to
9/// minimise animation, and the UI should replace motion with a
10/// cross-fade. The global stylesheet already honours the preference for
11/// its own transitions; this handle exists for the component-level
12/// decisions a stylesheet cannot make.
13#[derive(Clone, CustomDebug, Data)]
14pub struct UseReducedMotion {
15 /// Whether the user asked for reduced motion.
16 #[get(type(copy))]
17 pub reduced: Signal<bool>,
18 /// The media query text this handle watches.
19 #[get(type(copy))]
20 pub query: &'static str,
21 /// The teardown that removes the `change` listener.
22 #[get(pub(crate))]
23 #[debug(skip)]
24 pub(crate) teardown: Teardown,
25}