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
use *;
/// Obtains the [`UseClickOutside`] registered against the current hook
/// context slot.
///
/// Behaves like `HookContext::use_hook` - the same handle is returned on
/// every render at the same hook index, so the document listener is
/// attached once and the trigger survives re-renders.
///
/// Attach `get_target()` to the caller's markup with the `ref:`
/// attribute, then read `get_triggered()` inside a render closure to
/// react to a press outside.
///
/// # Returns
///
/// - `UseClickOutside` - The handle, with `get_target()` returning the
/// [`NodeRef`] and `get_triggered()` the reactive `Signal<bool>`.
/// Reports whether a pointer press landed outside the watched element.
///
/// A press on the watched element itself is *not* outside it, and a
/// press that arrives before the element has been mounted cannot be
/// classified at all — the element ref is still empty then, and an
/// unclassified press must not raise the trigger.
///
/// # Arguments
///
/// - `&NodeRef<Element>` - The element being watched.
/// - `&Event` - The press event.
///
/// # Returns
///
/// - `bool` - `true` when the press landed outside the element.
pub