@effindomv2/fui-rs 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMMERCIAL.md +7 -0
- package/Cargo.toml +34 -0
- package/LICENSE.md +9 -0
- package/README.md +88 -0
- package/package.json +54 -0
- package/scripts/build.sh +227 -0
- package/scripts/check-runtime-dependency.sh +41 -0
- package/scripts/framework-host-services.ts +40 -0
- package/scripts/generate-host-events.ts +17 -0
- package/scripts/generate-host-services.ts +28 -0
- package/scripts/hostgen/common.ts +73 -0
- package/scripts/hostgen/registry.ts +159 -0
- package/scripts/hostgen/rust-host-events.ts +171 -0
- package/scripts/hostgen/rust-host-services.ts +257 -0
- package/src/animation.rs +625 -0
- package/src/app.rs +324 -0
- package/src/assets.rs +572 -0
- package/src/bindings/mod.rs +1 -0
- package/src/bindings/ui.rs +705 -0
- package/src/bitmap.rs +317 -0
- package/src/bridge_callbacks.rs +242 -0
- package/src/context_menu_manager.rs +332 -0
- package/src/controls/anti_selection_area.rs +54 -0
- package/src/controls/button.rs +542 -0
- package/src/controls/checkbox.rs +372 -0
- package/src/controls/combobox.rs +1574 -0
- package/src/controls/context_menu.rs +1367 -0
- package/src/controls/control_template_set.rs +46 -0
- package/src/controls/control_tokens.rs +596 -0
- package/src/controls/dialog.rs +590 -0
- package/src/controls/dropdown.rs +1010 -0
- package/src/controls/form.rs +229 -0
- package/src/controls/internal/button_presenter.rs +142 -0
- package/src/controls/internal/checkbox_indicator_presenter.rs +210 -0
- package/src/controls/internal/dropdown_chevron_presenter.rs +134 -0
- package/src/controls/internal/dropdown_field_presenter.rs +269 -0
- package/src/controls/internal/dropdown_option_row_presenter.rs +184 -0
- package/src/controls/internal/mod.rs +13 -0
- package/src/controls/internal/pressable_indicator_presenter.rs +26 -0
- package/src/controls/internal/pressable_labeled_control.rs +492 -0
- package/src/controls/internal/radio_indicator_presenter.rs +208 -0
- package/src/controls/internal/selectable_popup_list.rs +597 -0
- package/src/controls/internal/slider_presenter.rs +282 -0
- package/src/controls/internal/switch_indicator_presenter.rs +235 -0
- package/src/controls/internal/text_input_core.rs +1074 -0
- package/src/controls/internal/text_input_presenter.rs +108 -0
- package/src/controls/mod.rs +235 -0
- package/src/controls/nav_link.rs +395 -0
- package/src/controls/popup.rs +191 -0
- package/src/controls/progress_bar.rs +287 -0
- package/src/controls/radio_button.rs +348 -0
- package/src/controls/radio_group.rs +283 -0
- package/src/controls/selection_area.rs +82 -0
- package/src/controls/shared.rs +68 -0
- package/src/controls/slider.rs +701 -0
- package/src/controls/switch.rs +293 -0
- package/src/controls/templating.rs +49 -0
- package/src/controls/tests.rs +3905 -0
- package/src/controls/text_area.rs +207 -0
- package/src/controls/text_input.rs +192 -0
- package/src/debug.rs +146 -0
- package/src/drag_drop.rs +424 -0
- package/src/drag_gesture.rs +258 -0
- package/src/drawing.rs +385 -0
- package/src/event.rs +1603 -0
- package/src/external_drop.rs +467 -0
- package/src/fetch.rs +500 -0
- package/src/ffi.rs +3542 -0
- package/src/file.rs +1677 -0
- package/src/focus_adorner.rs +307 -0
- package/src/focus_visibility.rs +121 -0
- package/src/frame_scheduler.rs +159 -0
- package/src/frame_signal.rs +64 -0
- package/src/generated/ffi.rs +798 -0
- package/src/generated/framework_host_services.rs +74 -0
- package/src/generated/mod.rs +2 -0
- package/src/host_services.rs +162 -0
- package/src/image_sampling.rs +78 -0
- package/src/keyboard_scroll.rs +137 -0
- package/src/keyboard_scroll_tracker.rs +385 -0
- package/src/lib.rs +547 -0
- package/src/logger.rs +56 -0
- package/src/mobile_text_selection_toolbar.rs +1034 -0
- package/src/navigation.rs +48 -0
- package/src/node/core.rs +2210 -0
- package/src/node/custom_drawable.rs +149 -0
- package/src/node/flex_box.rs +874 -0
- package/src/node/grid.rs +304 -0
- package/src/node/helpers.rs +442 -0
- package/src/node/image.rs +506 -0
- package/src/node/mod.rs +315 -0
- package/src/node/scroll_bar.rs +845 -0
- package/src/node/scroll_box.rs +514 -0
- package/src/node/scroll_state.rs +121 -0
- package/src/node/scroll_view.rs +557 -0
- package/src/node/svg_node.rs +474 -0
- package/src/node/text_node.rs +633 -0
- package/src/node/virtual_list.rs +678 -0
- package/src/panic_hook.rs +36 -0
- package/src/persisted.rs +274 -0
- package/src/platform.rs +556 -0
- package/src/popup_presenter.rs +344 -0
- package/src/selection_handle_adorner.rs +838 -0
- package/src/signal.rs +134 -0
- package/src/text.rs +1065 -0
- package/src/theme.rs +571 -0
- package/src/timers.rs +106 -0
- package/src/tool_tip.rs +167 -0
- package/src/tool_tip_manager.rs +691 -0
- package/src/transitions.rs +41 -0
- package/src/typography.rs +520 -0
- package/src/viewport.rs +108 -0
- package/src/worker.rs +308 -0
- package/src/worker_job.rs +82 -0
- package/src/worker_runtime.rs +172 -0
package/src/lib.rs
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
pub mod animation;
|
|
2
|
+
pub mod app;
|
|
3
|
+
pub mod assets;
|
|
4
|
+
#[doc(hidden)]
|
|
5
|
+
pub mod bindings;
|
|
6
|
+
pub mod bitmap;
|
|
7
|
+
#[doc(hidden)]
|
|
8
|
+
pub mod bridge_callbacks;
|
|
9
|
+
pub(crate) mod context_menu_manager;
|
|
10
|
+
pub mod controls;
|
|
11
|
+
pub mod debug;
|
|
12
|
+
pub mod drag_drop;
|
|
13
|
+
pub(crate) mod drag_gesture;
|
|
14
|
+
pub mod drawing;
|
|
15
|
+
pub mod event;
|
|
16
|
+
pub mod external_drop;
|
|
17
|
+
pub mod fetch;
|
|
18
|
+
#[doc(hidden)]
|
|
19
|
+
pub mod ffi;
|
|
20
|
+
pub mod file;
|
|
21
|
+
pub(crate) mod focus_adorner;
|
|
22
|
+
mod focus_visibility;
|
|
23
|
+
pub mod frame_scheduler;
|
|
24
|
+
pub mod frame_signal;
|
|
25
|
+
#[doc(hidden)]
|
|
26
|
+
pub mod generated;
|
|
27
|
+
pub mod host_services;
|
|
28
|
+
pub mod image_sampling;
|
|
29
|
+
pub(crate) mod keyboard_scroll;
|
|
30
|
+
pub(crate) mod keyboard_scroll_tracker;
|
|
31
|
+
pub mod logger;
|
|
32
|
+
pub(crate) mod mobile_text_selection_toolbar;
|
|
33
|
+
pub mod navigation;
|
|
34
|
+
pub mod node;
|
|
35
|
+
pub(crate) mod panic_hook;
|
|
36
|
+
pub mod persisted;
|
|
37
|
+
pub mod platform;
|
|
38
|
+
#[doc(hidden)]
|
|
39
|
+
pub mod popup_presenter;
|
|
40
|
+
pub(crate) mod selection_handle_adorner;
|
|
41
|
+
#[doc(hidden)]
|
|
42
|
+
pub mod signal;
|
|
43
|
+
pub mod text;
|
|
44
|
+
pub mod theme;
|
|
45
|
+
pub mod timers;
|
|
46
|
+
pub mod tool_tip;
|
|
47
|
+
pub(crate) mod tool_tip_manager;
|
|
48
|
+
pub mod transitions;
|
|
49
|
+
pub mod typography;
|
|
50
|
+
pub mod viewport;
|
|
51
|
+
pub mod worker;
|
|
52
|
+
#[cfg(feature = "worker-runtime")]
|
|
53
|
+
pub mod worker_job;
|
|
54
|
+
#[cfg(feature = "worker-runtime")]
|
|
55
|
+
pub mod worker_runtime;
|
|
56
|
+
|
|
57
|
+
#[macro_export]
|
|
58
|
+
macro_rules! children {
|
|
59
|
+
($($child:expr),* $(,)?) => {
|
|
60
|
+
vec![$($crate::Child::from_node(&$child)),*]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
pub trait Configure: Sized {
|
|
65
|
+
fn configure(self, configure: impl FnOnce(&Self)) -> Self {
|
|
66
|
+
configure(&self);
|
|
67
|
+
self
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
impl<T> Configure for T {}
|
|
72
|
+
|
|
73
|
+
#[macro_export]
|
|
74
|
+
macro_rules! fui_app {
|
|
75
|
+
($page_ty:ty, $build_page:expr) => {
|
|
76
|
+
$crate::fui_managed_app!($page_ty, $build_page, |page: &$page_ty| page.clone());
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#[macro_export]
|
|
81
|
+
macro_rules! fui_managed_app {
|
|
82
|
+
($page_ty:ty, $build_page:expr, $get_root:expr) => {
|
|
83
|
+
thread_local! {
|
|
84
|
+
static __FUI_RS_APP: ::std::cell::RefCell<Option<$crate::ManagedApplication<$page_ty>>> =
|
|
85
|
+
const { ::std::cell::RefCell::new(None) };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
fn __fui_rs_with_app<T>(
|
|
89
|
+
callback: impl FnOnce(&$crate::ManagedApplication<$page_ty>) -> T,
|
|
90
|
+
) -> T {
|
|
91
|
+
__FUI_RS_APP.with(|slot| {
|
|
92
|
+
if slot.borrow().is_none() {
|
|
93
|
+
slot.borrow_mut()
|
|
94
|
+
.replace($crate::ManagedApplication::new($build_page, $get_root));
|
|
95
|
+
}
|
|
96
|
+
let app = slot.borrow();
|
|
97
|
+
callback(app.as_ref().expect("FUI-RS managed app must be initialized"))
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
#[no_mangle]
|
|
102
|
+
pub extern "C" fn __runApp() {
|
|
103
|
+
__fui_rs_with_app(|app| app.run());
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#[no_mangle]
|
|
107
|
+
pub extern "C" fn __disposeApp() {
|
|
108
|
+
__fui_rs_with_app(|app| app.dispose());
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
($page_ty:ty, $build_page:expr, $get_root:expr, mount: $mount_page:expr) => {
|
|
112
|
+
thread_local! {
|
|
113
|
+
static __FUI_RS_APP: ::std::cell::RefCell<Option<$crate::ManagedApplication<$page_ty>>> =
|
|
114
|
+
const { ::std::cell::RefCell::new(None) };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
fn __fui_rs_with_app<T>(
|
|
118
|
+
callback: impl FnOnce(&$crate::ManagedApplication<$page_ty>) -> T,
|
|
119
|
+
) -> T {
|
|
120
|
+
__FUI_RS_APP.with(|slot| {
|
|
121
|
+
if slot.borrow().is_none() {
|
|
122
|
+
slot.borrow_mut().replace(
|
|
123
|
+
$crate::ManagedApplication::new($build_page, $get_root)
|
|
124
|
+
.mount_page($mount_page),
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
let app = slot.borrow();
|
|
128
|
+
callback(app.as_ref().expect("FUI-RS managed app must be initialized"))
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#[no_mangle]
|
|
133
|
+
pub extern "C" fn __runApp() {
|
|
134
|
+
__fui_rs_with_app(|app| app.run());
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
#[no_mangle]
|
|
138
|
+
pub extern "C" fn __disposeApp() {
|
|
139
|
+
__fui_rs_with_app(|app| app.dispose());
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
($page_ty:ty, $build_page:expr, $get_root:expr, dispose: $dispose_page:expr) => {
|
|
143
|
+
thread_local! {
|
|
144
|
+
static __FUI_RS_APP: ::std::cell::RefCell<Option<$crate::ManagedApplication<$page_ty>>> =
|
|
145
|
+
const { ::std::cell::RefCell::new(None) };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
fn __fui_rs_with_app<T>(
|
|
149
|
+
callback: impl FnOnce(&$crate::ManagedApplication<$page_ty>) -> T,
|
|
150
|
+
) -> T {
|
|
151
|
+
__FUI_RS_APP.with(|slot| {
|
|
152
|
+
if slot.borrow().is_none() {
|
|
153
|
+
slot.borrow_mut().replace(
|
|
154
|
+
$crate::ManagedApplication::new($build_page, $get_root)
|
|
155
|
+
.dispose_page($dispose_page),
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
let app = slot.borrow();
|
|
159
|
+
callback(app.as_ref().expect("FUI-RS managed app must be initialized"))
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#[no_mangle]
|
|
164
|
+
pub extern "C" fn __runApp() {
|
|
165
|
+
__fui_rs_with_app(|app| app.run());
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#[no_mangle]
|
|
169
|
+
pub extern "C" fn __disposeApp() {
|
|
170
|
+
__fui_rs_with_app(|app| app.dispose());
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
($page_ty:ty, $build_page:expr, $get_root:expr, mount: $mount_page:expr, dispose: $dispose_page:expr) => {
|
|
174
|
+
thread_local! {
|
|
175
|
+
static __FUI_RS_APP: ::std::cell::RefCell<Option<$crate::ManagedApplication<$page_ty>>> =
|
|
176
|
+
const { ::std::cell::RefCell::new(None) };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
fn __fui_rs_with_app<T>(
|
|
180
|
+
callback: impl FnOnce(&$crate::ManagedApplication<$page_ty>) -> T,
|
|
181
|
+
) -> T {
|
|
182
|
+
__FUI_RS_APP.with(|slot| {
|
|
183
|
+
if slot.borrow().is_none() {
|
|
184
|
+
slot.borrow_mut().replace(
|
|
185
|
+
$crate::ManagedApplication::new($build_page, $get_root)
|
|
186
|
+
.mount_page($mount_page)
|
|
187
|
+
.dispose_page($dispose_page),
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
let app = slot.borrow();
|
|
191
|
+
callback(app.as_ref().expect("FUI-RS managed app must be initialized"))
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
#[no_mangle]
|
|
196
|
+
pub extern "C" fn __runApp() {
|
|
197
|
+
__fui_rs_with_app(|app| app.run());
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#[no_mangle]
|
|
201
|
+
pub extern "C" fn __disposeApp() {
|
|
202
|
+
__fui_rs_with_app(|app| app.dispose());
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
#[doc(hidden)]
|
|
208
|
+
#[macro_export]
|
|
209
|
+
macro_rules! __fui_rs_ui_children {
|
|
210
|
+
($parent:ident;) => {};
|
|
211
|
+
($parent:ident; , $($rest:tt)*) => {
|
|
212
|
+
$crate::__fui_rs_ui_children!($parent; $($rest)*);
|
|
213
|
+
};
|
|
214
|
+
($parent:ident; $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* { $($children:tt)* } , $($rest:tt)*) => {{
|
|
215
|
+
let __fui_child = $crate::ui! {
|
|
216
|
+
$ctor($($args)*) $( . $method($($method_args)*) )* { $($children)* }
|
|
217
|
+
};
|
|
218
|
+
$parent.child(&__fui_child);
|
|
219
|
+
$crate::__fui_rs_ui_children!($parent; $($rest)*);
|
|
220
|
+
}};
|
|
221
|
+
($parent:ident; $type_name:ident :: $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* { $($children:tt)* } , $($rest:tt)*) => {{
|
|
222
|
+
let __fui_child = $crate::ui! {
|
|
223
|
+
$type_name::$ctor($($args)*) $( . $method($($method_args)*) )* { $($children)* }
|
|
224
|
+
};
|
|
225
|
+
$parent.child(&__fui_child);
|
|
226
|
+
$crate::__fui_rs_ui_children!($parent; $($rest)*);
|
|
227
|
+
}};
|
|
228
|
+
($parent:ident; $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* { $($children:tt)* } $(,)?) => {{
|
|
229
|
+
let __fui_child = $crate::ui! {
|
|
230
|
+
$ctor($($args)*) $( . $method($($method_args)*) )* { $($children)* }
|
|
231
|
+
};
|
|
232
|
+
$parent.child(&__fui_child);
|
|
233
|
+
}};
|
|
234
|
+
($parent:ident; $type_name:ident :: $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* { $($children:tt)* } $(,)?) => {{
|
|
235
|
+
let __fui_child = $crate::ui! {
|
|
236
|
+
$type_name::$ctor($($args)*) $( . $method($($method_args)*) )* { $($children)* }
|
|
237
|
+
};
|
|
238
|
+
$parent.child(&__fui_child);
|
|
239
|
+
}};
|
|
240
|
+
($parent:ident; $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* , $($rest:tt)*) => {{
|
|
241
|
+
let __fui_child = $crate::ui! {
|
|
242
|
+
$ctor($($args)*) $( . $method($($method_args)*) )*
|
|
243
|
+
};
|
|
244
|
+
$parent.child(&__fui_child);
|
|
245
|
+
$crate::__fui_rs_ui_children!($parent; $($rest)*);
|
|
246
|
+
}};
|
|
247
|
+
($parent:ident; $type_name:ident :: $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* , $($rest:tt)*) => {{
|
|
248
|
+
let __fui_child = $crate::ui! {
|
|
249
|
+
$type_name::$ctor($($args)*) $( . $method($($method_args)*) )*
|
|
250
|
+
};
|
|
251
|
+
$parent.child(&__fui_child);
|
|
252
|
+
$crate::__fui_rs_ui_children!($parent; $($rest)*);
|
|
253
|
+
}};
|
|
254
|
+
($parent:ident; $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* $(,)?) => {{
|
|
255
|
+
let __fui_child = $crate::ui! {
|
|
256
|
+
$ctor($($args)*) $( . $method($($method_args)*) )*
|
|
257
|
+
};
|
|
258
|
+
$parent.child(&__fui_child);
|
|
259
|
+
}};
|
|
260
|
+
($parent:ident; $type_name:ident :: $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* $(,)?) => {{
|
|
261
|
+
let __fui_child = $crate::ui! {
|
|
262
|
+
$type_name::$ctor($($args)*) $( . $method($($method_args)*) )*
|
|
263
|
+
};
|
|
264
|
+
$parent.child(&__fui_child);
|
|
265
|
+
}};
|
|
266
|
+
($parent:ident; $child:expr, $($rest:tt)*) => {{
|
|
267
|
+
$parent.child(&$child);
|
|
268
|
+
$crate::__fui_rs_ui_children!($parent; $($rest)*);
|
|
269
|
+
}};
|
|
270
|
+
($parent:ident; $child:expr $(,)?) => {{
|
|
271
|
+
$parent.child(&$child);
|
|
272
|
+
}};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
#[macro_export]
|
|
276
|
+
macro_rules! ui {
|
|
277
|
+
($base:ident { $($children:tt)* }) => {{
|
|
278
|
+
let __fui_node = $base;
|
|
279
|
+
$crate::__fui_rs_ui_children!(__fui_node; $($children)*);
|
|
280
|
+
__fui_node
|
|
281
|
+
}};
|
|
282
|
+
($type_name:ident :: $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* { $($children:tt)* }) => {{
|
|
283
|
+
let __fui_node = $type_name::$ctor($($args)*);
|
|
284
|
+
$(
|
|
285
|
+
__fui_node.$method($($method_args)*);
|
|
286
|
+
)*
|
|
287
|
+
$crate::__fui_rs_ui_children!(__fui_node; $($children)*);
|
|
288
|
+
__fui_node
|
|
289
|
+
}};
|
|
290
|
+
($ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )* { $($children:tt)* }) => {{
|
|
291
|
+
let __fui_node = $ctor($($args)*);
|
|
292
|
+
$(
|
|
293
|
+
__fui_node.$method($($method_args)*);
|
|
294
|
+
)*
|
|
295
|
+
$crate::__fui_rs_ui_children!(__fui_node; $($children)*);
|
|
296
|
+
__fui_node
|
|
297
|
+
}};
|
|
298
|
+
($ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )*) => {{
|
|
299
|
+
let __fui_node = $ctor($($args)*);
|
|
300
|
+
$(
|
|
301
|
+
__fui_node.$method($($method_args)*);
|
|
302
|
+
)*
|
|
303
|
+
__fui_node
|
|
304
|
+
}};
|
|
305
|
+
($type_name:ident :: $ctor:ident ( $($args:tt)* ) $( . $method:ident ( $($method_args:tt)* ) )*) => {{
|
|
306
|
+
let __fui_node = $type_name::$ctor($($args)*);
|
|
307
|
+
$(
|
|
308
|
+
__fui_node.$method($($method_args)*);
|
|
309
|
+
)*
|
|
310
|
+
__fui_node
|
|
311
|
+
}};
|
|
312
|
+
($expr:expr) => {
|
|
313
|
+
$expr
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
pub mod prelude {
|
|
318
|
+
pub use crate::animation::{
|
|
319
|
+
animate_color, animate_color_with, animate_float, animate_float_with,
|
|
320
|
+
get_animation_manager, reset_animations, tick_animations, Animation, AnimationManager,
|
|
321
|
+
AnimationTiming, Easing, Easings,
|
|
322
|
+
};
|
|
323
|
+
pub use crate::app::{Application, ApplicationRegistration, ManagedApplication};
|
|
324
|
+
pub use crate::bitmap::{Bitmap, BitmapTextReadyEventArgs};
|
|
325
|
+
pub use crate::bridge_callbacks::current_route;
|
|
326
|
+
pub use crate::controls::{
|
|
327
|
+
anti_selection_area, button, checkbox, clear_control_templates, combo_box, context_menu,
|
|
328
|
+
create_default_button_presenter, create_default_checkbox_indicator_presenter,
|
|
329
|
+
create_default_dropdown_chevron_presenter, create_default_dropdown_field_presenter,
|
|
330
|
+
create_default_dropdown_option_row_presenter, create_default_radio_indicator_presenter,
|
|
331
|
+
create_default_slider_presenter, create_default_switch_indicator_presenter,
|
|
332
|
+
create_default_text_input_presenter, dialog, dropdown, form, get_control_templates,
|
|
333
|
+
nav_link, popup, progress_bar, radio_button, radio_group, selection_area, slider, switch,
|
|
334
|
+
text_area, text_input, use_control_templates, AntiSelectionArea, Button, ButtonColors,
|
|
335
|
+
ButtonPresenter, ButtonTemplate, ButtonVisualState, CheckState, Checkbox,
|
|
336
|
+
CheckboxChangedEventArgs, CheckboxIndicatorPresenter, CheckboxIndicatorTemplate,
|
|
337
|
+
CheckboxIndicatorVisualState, ClickEventArgs, ComboBox, ComboBoxChangedEventArgs,
|
|
338
|
+
ComboBoxCommitMode, ComboBoxFilterMode, ComboBoxItem, ContextMenu, ContextMenuAction,
|
|
339
|
+
ContextMenuVisibilityChangedEventArgs, ControlTemplateSet, DefaultButtonTemplate,
|
|
340
|
+
DefaultCheckboxIndicatorTemplate, DefaultDropdownChevronTemplate,
|
|
341
|
+
DefaultDropdownFieldTemplate, DefaultDropdownOptionRowTemplate,
|
|
342
|
+
DefaultRadioIndicatorTemplate, DefaultSliderTemplate, DefaultSwitchIndicatorTemplate,
|
|
343
|
+
DefaultTextInputTemplate, Dialog, DialogShownEventArgs, Dropdown, DropdownChangedEventArgs,
|
|
344
|
+
DropdownChevronMetrics, DropdownChevronPresenter, DropdownChevronTemplate,
|
|
345
|
+
DropdownChevronVisualState, DropdownColors, DropdownFieldMetrics, DropdownFieldPresenter,
|
|
346
|
+
DropdownFieldTemplate, DropdownFieldVisualState, DropdownItem, DropdownOptionRowMetrics,
|
|
347
|
+
DropdownOptionRowPresenter, DropdownOptionRowTemplate, DropdownOptionRowVisualState,
|
|
348
|
+
DropdownSizing, Form, LabeledControlColors, LabeledControlSizing, MenuItem, NavLink,
|
|
349
|
+
NavigateEventArgs, Popup, PressableIndicatorMetrics, PressableIndicatorPresenter,
|
|
350
|
+
PressableIndicatorVisualState, ProgressBar, RadioButton, RadioButtonChangedEventArgs,
|
|
351
|
+
RadioGroup, RadioGroupChangedEventArgs, RadioIndicatorPresenter, RadioIndicatorTemplate,
|
|
352
|
+
RadioIndicatorVisualState, SelectionArea, Slider, SliderChangedEventArgs, SliderColors,
|
|
353
|
+
SliderPresenter, SliderPresenterMetrics, SliderSizing, SliderTemplate, SliderVisualState,
|
|
354
|
+
Switch, SwitchChangedEventArgs, SwitchIndicatorPresenter, SwitchIndicatorTemplate,
|
|
355
|
+
SwitchIndicatorVisualState, TextArea, TextInput, TextInputColors, TextInputPresenter,
|
|
356
|
+
TextInputTemplate, TextInputVisualState, DEFAULT_BUTTON_TEMPLATE,
|
|
357
|
+
DEFAULT_CHECKBOX_INDICATOR_TEMPLATE, DEFAULT_DROPDOWN_CHEVRON_TEMPLATE,
|
|
358
|
+
DEFAULT_DROPDOWN_FIELD_TEMPLATE, DEFAULT_DROPDOWN_OPTION_ROW_TEMPLATE,
|
|
359
|
+
DEFAULT_RADIO_INDICATOR_TEMPLATE, DEFAULT_SLIDER_TEMPLATE,
|
|
360
|
+
DEFAULT_SWITCH_INDICATOR_TEMPLATE, DEFAULT_TEXT_INPUT_TEMPLATE,
|
|
361
|
+
};
|
|
362
|
+
pub use crate::drag_drop::{
|
|
363
|
+
DragCompletedEventArgs, DragDataObject, DragDropEffects, DragEventArgs, DragSession,
|
|
364
|
+
DropProposal,
|
|
365
|
+
};
|
|
366
|
+
pub use crate::drawing::{DrawContext, Paint, Path};
|
|
367
|
+
pub use crate::event::{
|
|
368
|
+
FocusChangedEventArgs, GestureEventArgs, GestureEventKind, GestureEventPhase,
|
|
369
|
+
GestureIntent, KeyEventArgs, LongPressEventArgs, PointerEventArgs, PointerType,
|
|
370
|
+
SelectionChangedEventArgs, TextChangedEventArgs, WheelEventArgs,
|
|
371
|
+
};
|
|
372
|
+
pub use crate::external_drop::{
|
|
373
|
+
ExternalDropEventArgs, ExternalDropItemInfo, ExternalDropItemKind,
|
|
374
|
+
};
|
|
375
|
+
pub use crate::fetch::{Fetch, FetchErrorEventArgs, FetchRequest, FetchResponse};
|
|
376
|
+
pub use crate::ffi::{
|
|
377
|
+
AlignItems, AlignSelf, BorderStyle, CursorStyle, FlexDirection, FlexWrap, GridUnit,
|
|
378
|
+
JustifyContent, KeyEventType, KeyModifier, ObjectFit, Orientation, PointerEventType,
|
|
379
|
+
PositionType, SemanticCheckedState, SemanticRole, TextAlign, TextOverflow,
|
|
380
|
+
TextVerticalAlign, Unit, Visibility,
|
|
381
|
+
};
|
|
382
|
+
pub use crate::file::{
|
|
383
|
+
BrowserFile, BrowserFileWriter, File, FileCapabilities, FileErrorEventArgs,
|
|
384
|
+
FileOpenEventArgs, FileOpenRequest, FileReadChunk, FileRequestGuard, FileSaveMode,
|
|
385
|
+
FileSaveRequest, FileSaveResult, FileWorkerProcessProgress, FileWorkerProcessRequest,
|
|
386
|
+
FileWorkerProcessResult, FileWriteProgress,
|
|
387
|
+
};
|
|
388
|
+
pub use crate::focus_visibility::show_keyboard_focus_for_key_event;
|
|
389
|
+
pub use crate::image_sampling::{ImageSampling, ImageSamplingMode};
|
|
390
|
+
pub use crate::logger;
|
|
391
|
+
pub use crate::navigation;
|
|
392
|
+
pub use crate::node::{
|
|
393
|
+
auto, column, custom_drawable, fill, flex_box, grid, image, pct, portal, px, row,
|
|
394
|
+
scroll_box, scroll_view, svg, text, viewport_height, viewport_width, virtual_list, Border,
|
|
395
|
+
Child, ContextMenuEventArgs, CustomDrawable, FlexBox, FlexBoxSurface, GradientStop, Grid,
|
|
396
|
+
GridTrack, HasFlexBoxRoot, Image, ImageNode, Length, Node, ScrollBar, ScrollBarVisibility,
|
|
397
|
+
ScrollBox, ScrollState, ScrollView, Svg, SvgNode, Text, TextCore, TextNode, VirtualList,
|
|
398
|
+
};
|
|
399
|
+
pub use crate::persisted;
|
|
400
|
+
pub use crate::platform;
|
|
401
|
+
pub use crate::popup_presenter::PopupPlacement;
|
|
402
|
+
pub use crate::signal::Subscription;
|
|
403
|
+
pub use crate::text::{
|
|
404
|
+
span, DynamicTextLayout, DynamicTextOverflow, RichText, RichTextSpan, TextLayout,
|
|
405
|
+
TextLayoutReadyEventArgs, TextMetrics,
|
|
406
|
+
};
|
|
407
|
+
pub use crate::theme::{
|
|
408
|
+
bind_theme, current_theme, default_dark_theme, default_light_theme, generate_theme,
|
|
409
|
+
is_dark_mode, is_using_system_theme, set_accent_color, subscribe, use_custom_theme,
|
|
410
|
+
use_system_theme, Colors, ContextMenuItemTheme, ContextMenuTheme, Fonts, Spacing, Theme,
|
|
411
|
+
ToolTipTheme,
|
|
412
|
+
};
|
|
413
|
+
pub use crate::timers::{cancel_timeout, set_timeout, TimerHandle};
|
|
414
|
+
pub use crate::tool_tip::ToolTip;
|
|
415
|
+
pub use crate::transitions::NodeTransitions;
|
|
416
|
+
pub use crate::typography::{
|
|
417
|
+
FontFace, FontFaceLoadedEventArgs, FontFamily, FontStack, FontStackLoadedEventArgs,
|
|
418
|
+
FontStyle, FontWeight, FontsLoadedEventArgs,
|
|
419
|
+
};
|
|
420
|
+
pub use crate::viewport::{
|
|
421
|
+
viewport_height_signal, viewport_width_signal, ViewportSignalHandle,
|
|
422
|
+
};
|
|
423
|
+
pub use crate::worker::{
|
|
424
|
+
Worker, WorkerCompletedEventArgs, WorkerErrorEventArgs, WorkerProgressEventArgs,
|
|
425
|
+
};
|
|
426
|
+
#[cfg(feature = "worker-runtime")]
|
|
427
|
+
pub use crate::worker_job::{WorkerJob, WorkerJobState};
|
|
428
|
+
#[cfg(feature = "worker-runtime")]
|
|
429
|
+
pub use crate::worker_runtime::{file_read_chunk, file_worker_write_chunk, WorkerRuntime};
|
|
430
|
+
pub use crate::{children, fui_app, fui_managed_app, ui, Configure};
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
pub use animation::{
|
|
434
|
+
animate_color, animate_color_with, animate_float, animate_float_with, get_animation_manager,
|
|
435
|
+
reset_animations, tick_animations, Animation, AnimationManager, AnimationTiming, Easing,
|
|
436
|
+
Easings,
|
|
437
|
+
};
|
|
438
|
+
pub use app::{Application, ApplicationRegistration, ManagedApplication};
|
|
439
|
+
pub use assets::*;
|
|
440
|
+
pub use bitmap::{Bitmap, BitmapTextReadyEventArgs};
|
|
441
|
+
pub use bridge_callbacks::current_route;
|
|
442
|
+
pub use controls::{
|
|
443
|
+
anti_selection_area, button, checkbox, clear_control_templates, combo_box, context_menu,
|
|
444
|
+
create_default_button_presenter, create_default_checkbox_indicator_presenter,
|
|
445
|
+
create_default_dropdown_chevron_presenter, create_default_dropdown_field_presenter,
|
|
446
|
+
create_default_dropdown_option_row_presenter, create_default_radio_indicator_presenter,
|
|
447
|
+
create_default_slider_presenter, create_default_switch_indicator_presenter,
|
|
448
|
+
create_default_text_input_presenter, dialog, dropdown, form, get_control_templates, nav_link,
|
|
449
|
+
popup, progress_bar, radio_button, radio_group, selection_area, slider, switch, text_area,
|
|
450
|
+
text_input, use_control_templates, AntiSelectionArea, Button, ButtonColors, ButtonPresenter,
|
|
451
|
+
ButtonTemplate, ButtonVisualState, CheckState, Checkbox, CheckboxChangedEventArgs,
|
|
452
|
+
CheckboxIndicatorPresenter, CheckboxIndicatorTemplate, CheckboxIndicatorVisualState,
|
|
453
|
+
ClickEventArgs, ComboBox, ComboBoxChangedEventArgs, ComboBoxCommitMode, ComboBoxFilterMode,
|
|
454
|
+
ComboBoxItem, ContextMenu, ContextMenuAction, ContextMenuVisibilityChangedEventArgs,
|
|
455
|
+
ControlTemplateSet, DefaultButtonTemplate, DefaultCheckboxIndicatorTemplate,
|
|
456
|
+
DefaultDropdownChevronTemplate, DefaultDropdownFieldTemplate, DefaultDropdownOptionRowTemplate,
|
|
457
|
+
DefaultRadioIndicatorTemplate, DefaultSliderTemplate, DefaultSwitchIndicatorTemplate,
|
|
458
|
+
DefaultTextInputTemplate, Dialog, DialogShownEventArgs, Dropdown, DropdownChangedEventArgs,
|
|
459
|
+
DropdownChevronMetrics, DropdownChevronPresenter, DropdownChevronTemplate,
|
|
460
|
+
DropdownChevronVisualState, DropdownColors, DropdownFieldMetrics, DropdownFieldPresenter,
|
|
461
|
+
DropdownFieldTemplate, DropdownFieldVisualState, DropdownItem, DropdownOptionRowMetrics,
|
|
462
|
+
DropdownOptionRowPresenter, DropdownOptionRowTemplate, DropdownOptionRowVisualState,
|
|
463
|
+
DropdownSizing, Form, LabeledControlColors, LabeledControlSizing, MenuItem, NavLink,
|
|
464
|
+
NavigateEventArgs, Popup, PressableIndicatorMetrics, PressableIndicatorPresenter,
|
|
465
|
+
PressableIndicatorVisualState, ProgressBar, RadioButton, RadioButtonChangedEventArgs,
|
|
466
|
+
RadioGroup, RadioGroupChangedEventArgs, RadioIndicatorPresenter, RadioIndicatorTemplate,
|
|
467
|
+
RadioIndicatorVisualState, SelectionArea, Slider, SliderChangedEventArgs, SliderColors,
|
|
468
|
+
SliderPresenter, SliderPresenterMetrics, SliderSizing, SliderTemplate, SliderVisualState,
|
|
469
|
+
Switch, SwitchChangedEventArgs, SwitchIndicatorPresenter, SwitchIndicatorTemplate,
|
|
470
|
+
SwitchIndicatorVisualState, TextArea, TextInput, TextInputColors, TextInputPresenter,
|
|
471
|
+
TextInputTemplate, TextInputVisualState, DEFAULT_BUTTON_TEMPLATE,
|
|
472
|
+
DEFAULT_CHECKBOX_INDICATOR_TEMPLATE, DEFAULT_DROPDOWN_CHEVRON_TEMPLATE,
|
|
473
|
+
DEFAULT_DROPDOWN_FIELD_TEMPLATE, DEFAULT_DROPDOWN_OPTION_ROW_TEMPLATE,
|
|
474
|
+
DEFAULT_RADIO_INDICATOR_TEMPLATE, DEFAULT_SLIDER_TEMPLATE, DEFAULT_SWITCH_INDICATOR_TEMPLATE,
|
|
475
|
+
DEFAULT_TEXT_INPUT_TEMPLATE,
|
|
476
|
+
};
|
|
477
|
+
pub use debug::*;
|
|
478
|
+
pub use drag_drop::{
|
|
479
|
+
DragCompletedEventArgs, DragDataObject, DragDropEffects, DragEventArgs, DragSession,
|
|
480
|
+
DropProposal,
|
|
481
|
+
};
|
|
482
|
+
pub use drawing::{DrawContext, Paint, Path};
|
|
483
|
+
pub use event::{
|
|
484
|
+
FocusChangedEventArgs, GestureEventArgs, GestureEventKind, GestureEventPhase, GestureIntent,
|
|
485
|
+
KeyEventArgs, LongPressEventArgs, PointerEventArgs, PointerType, SelectionChangedEventArgs,
|
|
486
|
+
TextChangedEventArgs, WheelEventArgs,
|
|
487
|
+
};
|
|
488
|
+
pub use external_drop::{ExternalDropEventArgs, ExternalDropItemInfo, ExternalDropItemKind};
|
|
489
|
+
pub use fetch::{Fetch, FetchErrorEventArgs, FetchRequest, FetchResponse};
|
|
490
|
+
pub use ffi::{
|
|
491
|
+
AlignItems, AlignSelf, BorderStyle, CursorStyle, FlexDirection, FlexWrap, GridUnit,
|
|
492
|
+
JustifyContent, KeyEventType, KeyModifier, ObjectFit, Orientation, PointerEventType,
|
|
493
|
+
PositionType, SemanticCheckedState, SemanticRole, TextAlign, TextOverflow, TextVerticalAlign,
|
|
494
|
+
Unit, Visibility,
|
|
495
|
+
};
|
|
496
|
+
pub use file::{
|
|
497
|
+
BrowserFile, BrowserFileWriter, File, FileCapabilities, FileErrorEventArgs, FileOpenEventArgs,
|
|
498
|
+
FileOpenRequest, FileReadChunk, FileRequestGuard, FileSaveMode, FileSaveRequest,
|
|
499
|
+
FileSaveResult, FileWorkerProcessProgress, FileWorkerProcessRequest, FileWorkerProcessResult,
|
|
500
|
+
FileWriteProgress,
|
|
501
|
+
};
|
|
502
|
+
pub use focus_visibility::show_keyboard_focus_for_key_event;
|
|
503
|
+
pub use frame_scheduler::{mark_needs_commit, on_loaded, LoadedEventArgs};
|
|
504
|
+
pub use frame_signal::{frame_time_signal, FrameTimeSignalHandle};
|
|
505
|
+
pub use image_sampling::{ImageSampling, ImageSamplingMode};
|
|
506
|
+
pub use logger::*;
|
|
507
|
+
pub use navigation::*;
|
|
508
|
+
pub use node::{
|
|
509
|
+
auto, column, custom_drawable, fill, flex_box, grid, image, pct, portal, px, row, scroll_box,
|
|
510
|
+
scroll_view, svg, text, viewport_height, viewport_width, virtual_list, Border, Child,
|
|
511
|
+
ContextMenuEventArgs, CustomDrawable, FlexBox, FlexBoxSurface, GradientStop, Grid, GridTrack,
|
|
512
|
+
HasFlexBoxRoot, Image, ImageNode, Length, Node, ScrollBar, ScrollBarVisibility, ScrollBox,
|
|
513
|
+
ScrollState, ScrollView, Svg, SvgNode, Text, TextCore, TextNode, VirtualList,
|
|
514
|
+
};
|
|
515
|
+
pub use persisted::*;
|
|
516
|
+
pub use platform::*;
|
|
517
|
+
#[doc(hidden)]
|
|
518
|
+
pub use popup_presenter::{PopupPlacement, PopupPresenter};
|
|
519
|
+
pub use signal::Subscription;
|
|
520
|
+
pub use text::{
|
|
521
|
+
span, DynamicTextLayout, DynamicTextOverflow, RichText, RichTextSpan, TextLayout,
|
|
522
|
+
TextLayoutReadyEventArgs, TextMetrics,
|
|
523
|
+
};
|
|
524
|
+
pub use theme::{
|
|
525
|
+
bind_theme, current_theme, default_dark_theme, default_light_theme, generate_theme,
|
|
526
|
+
is_dark_mode, is_using_system_theme, set_accent_color, subscribe, use_custom_theme,
|
|
527
|
+
use_system_theme, Colors, ContextMenuItemTheme, ContextMenuTheme, Fonts, Spacing, Theme,
|
|
528
|
+
ToolTipTheme,
|
|
529
|
+
};
|
|
530
|
+
pub use timers::{cancel_timeout, set_timeout, TimerHandle};
|
|
531
|
+
pub use tool_tip::ToolTip;
|
|
532
|
+
pub use transitions::NodeTransitions;
|
|
533
|
+
pub use typography::{
|
|
534
|
+
FontFace, FontFaceLoadedEventArgs, FontFamily, FontStack, FontStackLoadedEventArgs, FontStyle,
|
|
535
|
+
FontWeight, FontsLoadedEventArgs,
|
|
536
|
+
};
|
|
537
|
+
pub use viewport::{viewport_height_signal, viewport_width_signal, ViewportSignalHandle};
|
|
538
|
+
pub use worker::{Worker, WorkerCompletedEventArgs, WorkerErrorEventArgs, WorkerProgressEventArgs};
|
|
539
|
+
#[cfg(feature = "worker-runtime")]
|
|
540
|
+
pub use worker_job::{WorkerJob, WorkerJobState};
|
|
541
|
+
#[cfg(feature = "worker-runtime")]
|
|
542
|
+
pub use worker_runtime::{
|
|
543
|
+
file_read_chunk, file_worker_write_chunk, handle_fetch_complete as __fui_on_fetch_complete,
|
|
544
|
+
handle_fetch_error as __fui_on_fetch_error, reset_worker_runtime,
|
|
545
|
+
worker_text_buffer_ptr as __fui_worker_text_buffer,
|
|
546
|
+
worker_text_buffer_size as __fui_worker_text_buffer_size, WorkerRuntime,
|
|
547
|
+
};
|
package/src/logger.rs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
use crate::ffi;
|
|
2
|
+
|
|
3
|
+
fn write_log(category: &str, message: &str) {
|
|
4
|
+
let category_bytes = category.as_bytes();
|
|
5
|
+
let message_bytes = message.as_bytes();
|
|
6
|
+
unsafe {
|
|
7
|
+
ffi::fui_log(
|
|
8
|
+
if category_bytes.is_empty() {
|
|
9
|
+
0
|
|
10
|
+
} else {
|
|
11
|
+
category_bytes.as_ptr() as usize
|
|
12
|
+
},
|
|
13
|
+
category_bytes.len() as u32,
|
|
14
|
+
if message_bytes.is_empty() {
|
|
15
|
+
0
|
|
16
|
+
} else {
|
|
17
|
+
message_bytes.as_ptr() as usize
|
|
18
|
+
},
|
|
19
|
+
message_bytes.len() as u32,
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
pub fn logs_enabled() -> bool {
|
|
25
|
+
unsafe { ffi::fui_logs_enabled() }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pub fn log(category: &str, message: &str) {
|
|
29
|
+
if !logs_enabled() {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
write_log(category, message);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pub fn warn(category: &str, message: &str) {
|
|
36
|
+
write_log(&format!("Warning/{category}"), message);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pub fn error(category: &str, message: &str) {
|
|
40
|
+
write_log(&format!("Error/{category}"), message);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#[cfg(test)]
|
|
44
|
+
mod tests {
|
|
45
|
+
use crate::ffi::{self, Call};
|
|
46
|
+
|
|
47
|
+
#[test]
|
|
48
|
+
fn log_respects_logs_enabled() {
|
|
49
|
+
ffi::test::reset();
|
|
50
|
+
ffi::test::set_logs_enabled(false);
|
|
51
|
+
super::log("test", "message");
|
|
52
|
+
let calls = ffi::test::take_calls();
|
|
53
|
+
assert!(calls.iter().any(|call| matches!(call, Call::LogsEnabled)));
|
|
54
|
+
assert!(!calls.iter().any(|call| matches!(call, Call::Log { .. })));
|
|
55
|
+
}
|
|
56
|
+
}
|