euv_ui/hook/use_resize_observer/struct.rs
1use super::*;
2
3/// Reactive state for an element's size.
4///
5/// The handle carries the element the hook watches — a [`NodeRef`] the
6/// caller attaches to its own markup — and the signals that report its
7/// content-box width and height.
8///
9/// The size is a `Signal<f64>`: a render closure that reads it
10/// re-renders when the element is resized, and nothing else in the tree
11/// is disturbed.
12#[derive(Clone, CustomDebug, Data)]
13pub struct UseResizeObserver {
14 /// The element the hook watches.
15 ///
16 /// Attach it to the caller's markup with the `ref:` attribute.
17 pub target: NodeRef<Element>,
18 /// The element's content-box width in CSS pixels.
19 #[get(type(copy))]
20 pub width: Signal<f64>,
21 /// The element's content-box height in CSS pixels.
22 #[get(type(copy))]
23 pub height: Signal<f64>,
24 /// The teardown that disconnects the observer.
25 #[get(pub(crate))]
26 #[debug(skip)]
27 pub(crate) teardown: Teardown,
28}