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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//! Element selector and programmatic control API
//!
//! This module provides high-performance element selection and manipulation:
//!
//! - `ElementRegistry` - O(1) lookup of elements by string ID
//! - `ScrollRef` - Programmatic scroll control for scroll containers
//! - `ElementHandle` - Query result with bounds, events, signals, state access
//! - `ScrollOptions` - Configuration for scroll-into-view behavior
//! - `query()` - Global function to query elements from event handlers
//!
//! # Example
//!
//! ```rust,ignore
//! use blinc_layout::prelude::*;
//!
//! // Assign IDs to elements
//! div()
//! .id("my-container")
//! .child(
//! scroll()
//! .bind(&scroll_ref)
//! .child(items.iter().map(|i| div().id(format!("item-{}", i.id))))
//! )
//!
//! // Later: scroll to element
//! scroll_ref.scroll_to("item-42");
//!
//! // From event handlers, use the global query function:
//! div().on_click(|_| {
//! if let Some(handle) = query("my-target") {
//! handle.scroll_into_view();
//! }
//! })
//! ```
use Arc;
use BlincContextState;
pub use ;
pub use ElementRegistry;
/// Shared element registry for thread-safe access
pub type SharedElementRegistry = ;
/// Query an element by ID from event handlers
///
/// This is the primary way to access elements programmatically from within
/// event handler closures. It uses the global `BlincContextState` to access
/// the element registry.
///
/// Returns `Some(ElementHandle)` if the element exists, `None` otherwise.
///
/// # Example
///
/// ```rust,ignore
/// use blinc_layout::selector::query;
///
/// div().on_click(|_| {
/// if let Some(handle) = query("my-element") {
/// handle.scroll_into_view();
/// handle.focus();
/// }
/// })
/// ```
/// Query a motion animation by its stable key
///
/// Returns a `MotionHandle` that can be used to check the animation state.
/// Use this to determine if a parent motion animation has settled before
/// rendering child content with hover effects.
///
/// # Example
///
/// ```rust,ignore
/// use blinc_layout::selector::query_motion;
///
/// // Inside a Stateful on_state callback:
/// let motion = query_motion("dialog-content");
/// if motion.is_settled() {
/// // Safe to render with hover effects
/// container.merge(interactive_button());
/// } else {
/// // Render static version during animation
/// container.merge(static_button());
/// }
/// ```
pub use ;
/// Options for scroll-into-view behavior
/// Scroll animation behavior
/// Vertical scroll alignment
/// Horizontal scroll alignment