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
//! Reactive viewport size (DESIGN cycle-4 nit): `Modal::open`/
//! `Toast::show` take a `viewport: Size`, which callers were
//! hand-tracking through resizes. `use_viewport(cx)` is the one source —
//! `App::set_viewport` (mount + every driver resize) publishes into it,
//! so a `dyn_view` reading it re-renders on resize and popup call sites
//! read the current size at open time.
//!
//! Same immortal-root pattern as the theme signal: one per thread,
//! deliberately leaked (disposing it would invalidate every captured
//! handle).
use Cell;
use crateSize;
use crate;
thread_local!
/// The terminal viewport as a reactive signal. `Size::ZERO` before the
/// first `App` exists on this thread.
///
/// ```ignore
/// let vp = use_viewport(cx);
/// button.on_click(move || { Toast::show(&overlays, cx, vp.get_untracked(), "hi", d); })
/// ```
/// Untracked read for non-component code (popup call sites, plumbing).
/// App-internal publisher (called from `App::set_viewport`).
pub