1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Prefers-reduced-motion detection
//!
//! Provides functions to detect and monitor the user's system preference
//! for reduced motion.
//!
//! In WASI unified environment, this module currently provides a default
//! implementation. The tairitsu WIT interface does not currently expose
//! the `matchMedia` API needed for `prefers-reduced-motion` detection.
//!
//! When the WIT interface adds this capability, this module can be updated
//! to use it.
use RefCell;
use Rc;
use Platform;
/// Detect system prefers-reduced-motion setting
///
/// Currently returns false (no preference detected) as the WIT interface
/// does not expose the matchMedia API.
///
/// When available, this should use: `window.matchMedia("(prefers-reduced-motion: reduce)").matches()`
/// Watch for prefers-reduced-motion changes
///
/// Currently a no-op as the WIT interface does not expose the MediaQueryList API.
///
/// When available, this should use: `window.matchMedia("(prefers-reduced-motion: reduce)").addEventListener("change", callback)`
///
/// # Arguments
///
/// * `callback` - Function to call when preference changes
/// Check if reduced motion should be applied
///
/// This is a convenience function that checks both the system preference
/// and any application-level override.
///
/// # Arguments
///
/// * `platform` - Platform reference
/// * `enabled_override` - Optional application-level override (Some(true) = always enabled)