@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
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
use super::internal::button_presenter::ButtonTemplate;
|
|
2
|
+
use super::internal::checkbox_indicator_presenter::CheckboxIndicatorTemplate;
|
|
3
|
+
use super::internal::dropdown_chevron_presenter::DropdownChevronTemplate;
|
|
4
|
+
use super::internal::dropdown_field_presenter::DropdownFieldTemplate;
|
|
5
|
+
use super::internal::dropdown_option_row_presenter::DropdownOptionRowTemplate;
|
|
6
|
+
use super::internal::radio_indicator_presenter::RadioIndicatorTemplate;
|
|
7
|
+
use super::internal::slider_presenter::SliderTemplate;
|
|
8
|
+
use super::internal::switch_indicator_presenter::SwitchIndicatorTemplate;
|
|
9
|
+
use super::internal::text_input_presenter::TextInputTemplate;
|
|
10
|
+
use std::cell::RefCell;
|
|
11
|
+
use std::rc::Rc;
|
|
12
|
+
|
|
13
|
+
#[derive(Clone, Default)]
|
|
14
|
+
pub struct ControlTemplateSet {
|
|
15
|
+
pub button: Option<Rc<dyn ButtonTemplate>>,
|
|
16
|
+
pub checkbox_indicator: Option<Rc<dyn CheckboxIndicatorTemplate>>,
|
|
17
|
+
pub dropdown_chevron: Option<Rc<dyn DropdownChevronTemplate>>,
|
|
18
|
+
pub dropdown_field: Option<Rc<dyn DropdownFieldTemplate>>,
|
|
19
|
+
pub dropdown_option_row: Option<Rc<dyn DropdownOptionRowTemplate>>,
|
|
20
|
+
pub radio_indicator: Option<Rc<dyn RadioIndicatorTemplate>>,
|
|
21
|
+
pub slider: Option<Rc<dyn SliderTemplate>>,
|
|
22
|
+
pub switch_indicator: Option<Rc<dyn SwitchIndicatorTemplate>>,
|
|
23
|
+
pub text_input: Option<Rc<dyn TextInputTemplate>>,
|
|
24
|
+
pub text_area: Option<Rc<dyn TextInputTemplate>>,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
thread_local! {
|
|
28
|
+
static ACTIVE_CONTROL_TEMPLATES: RefCell<Option<ControlTemplateSet>> = const { RefCell::new(None) };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
pub fn get_control_templates() -> Option<ControlTemplateSet> {
|
|
32
|
+
ACTIVE_CONTROL_TEMPLATES.with(|slot| slot.borrow().clone())
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pub fn use_control_templates(templates: Option<ControlTemplateSet>) -> Option<ControlTemplateSet> {
|
|
36
|
+
ACTIVE_CONTROL_TEMPLATES.with(|slot| {
|
|
37
|
+
*slot.borrow_mut() = templates;
|
|
38
|
+
slot.borrow().clone()
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pub fn clear_control_templates() {
|
|
43
|
+
ACTIVE_CONTROL_TEMPLATES.with(|slot| {
|
|
44
|
+
*slot.borrow_mut() = None;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
use crate::logger;
|
|
2
|
+
|
|
3
|
+
fn sanitize_positive(owner: &str, property: &str, value: f32) -> f32 {
|
|
4
|
+
if value <= 0.0 {
|
|
5
|
+
logger::warn(
|
|
6
|
+
"Layout",
|
|
7
|
+
&format!("{owner}.{property}() received {value}; ignoring."),
|
|
8
|
+
);
|
|
9
|
+
return 0.0;
|
|
10
|
+
}
|
|
11
|
+
value
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
|
15
|
+
pub struct LabeledControlSizing {
|
|
16
|
+
indicator_size: f32,
|
|
17
|
+
label_font_size: f32,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
impl LabeledControlSizing {
|
|
21
|
+
pub fn new() -> Self {
|
|
22
|
+
Self::default()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pub fn indicator_size(mut self, value: f32) -> Self {
|
|
26
|
+
self.indicator_size = sanitize_positive("LabeledControlSizing", "indicator_size", value);
|
|
27
|
+
self
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
pub fn label_font_size(mut self, value: f32) -> Self {
|
|
31
|
+
self.label_font_size = sanitize_positive("LabeledControlSizing", "label_font_size", value);
|
|
32
|
+
self
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pub fn has_indicator_size(&self) -> bool {
|
|
36
|
+
self.indicator_size > 0.0
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pub fn has_label_font_size(&self) -> bool {
|
|
40
|
+
self.label_font_size > 0.0
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pub fn indicator_size_px(&self) -> f32 {
|
|
44
|
+
self.indicator_size
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pub fn label_font_size_px(&self) -> f32 {
|
|
48
|
+
self.label_font_size
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
|
53
|
+
pub struct SliderSizing {
|
|
54
|
+
thumb_size: f32,
|
|
55
|
+
track_thickness: f32,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
impl SliderSizing {
|
|
59
|
+
pub fn new() -> Self {
|
|
60
|
+
Self::default()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
pub fn thumb_size(mut self, value: f32) -> Self {
|
|
64
|
+
self.thumb_size = sanitize_positive("SliderSizing", "thumb_size", value);
|
|
65
|
+
self
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pub fn track_thickness(mut self, value: f32) -> Self {
|
|
69
|
+
self.track_thickness = sanitize_positive("SliderSizing", "track_thickness", value);
|
|
70
|
+
self
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub fn has_thumb_size(&self) -> bool {
|
|
74
|
+
self.thumb_size > 0.0
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
pub fn has_track_thickness(&self) -> bool {
|
|
78
|
+
self.track_thickness > 0.0
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
pub fn thumb_size_px(&self) -> f32 {
|
|
82
|
+
self.thumb_size
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
pub fn track_thickness_px(&self) -> f32 {
|
|
86
|
+
self.track_thickness
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
|
91
|
+
pub struct DropdownSizing {
|
|
92
|
+
field_font_size: f32,
|
|
93
|
+
option_font_size: f32,
|
|
94
|
+
field_height: f32,
|
|
95
|
+
option_height: f32,
|
|
96
|
+
chevron_box_size: f32,
|
|
97
|
+
chevron_icon_size: f32,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
impl DropdownSizing {
|
|
101
|
+
pub fn new() -> Self {
|
|
102
|
+
Self::default()
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
pub fn field_font_size(mut self, value: f32) -> Self {
|
|
106
|
+
self.field_font_size = sanitize_positive("DropdownSizing", "field_font_size", value);
|
|
107
|
+
self
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
pub fn option_font_size(mut self, value: f32) -> Self {
|
|
111
|
+
self.option_font_size = sanitize_positive("DropdownSizing", "option_font_size", value);
|
|
112
|
+
self
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
pub fn field_height(mut self, value: f32) -> Self {
|
|
116
|
+
self.field_height = sanitize_positive("DropdownSizing", "field_height", value);
|
|
117
|
+
self
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
pub fn option_height(mut self, value: f32) -> Self {
|
|
121
|
+
self.option_height = sanitize_positive("DropdownSizing", "option_height", value);
|
|
122
|
+
self
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
pub fn chevron_box_size(mut self, value: f32) -> Self {
|
|
126
|
+
self.chevron_box_size = sanitize_positive("DropdownSizing", "chevron_box_size", value);
|
|
127
|
+
self
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
pub fn chevron_icon_size(mut self, value: f32) -> Self {
|
|
131
|
+
self.chevron_icon_size = sanitize_positive("DropdownSizing", "chevron_icon_size", value);
|
|
132
|
+
self
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
pub fn has_field_font_size(&self) -> bool {
|
|
136
|
+
self.field_font_size > 0.0
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
pub fn has_option_font_size(&self) -> bool {
|
|
140
|
+
self.option_font_size > 0.0
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
pub fn has_field_height(&self) -> bool {
|
|
144
|
+
self.field_height > 0.0
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
pub fn has_option_height(&self) -> bool {
|
|
148
|
+
self.option_height > 0.0
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
pub fn has_chevron_box_size(&self) -> bool {
|
|
152
|
+
self.chevron_box_size > 0.0
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
pub fn has_chevron_icon_size(&self) -> bool {
|
|
156
|
+
self.chevron_icon_size > 0.0
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
pub fn field_font_size_px(&self) -> f32 {
|
|
160
|
+
self.field_font_size
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
pub fn option_font_size_px(&self) -> f32 {
|
|
164
|
+
self.option_font_size
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
pub fn field_height_px(&self) -> f32 {
|
|
168
|
+
self.field_height
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
pub fn option_height_px(&self) -> f32 {
|
|
172
|
+
self.option_height
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
pub fn chevron_box_size_px(&self) -> f32 {
|
|
176
|
+
self.chevron_box_size
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
pub fn chevron_icon_size_px(&self) -> f32 {
|
|
180
|
+
self.chevron_icon_size
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
|
185
|
+
pub struct ButtonColors {
|
|
186
|
+
pub(crate) background: Option<u32>,
|
|
187
|
+
pub(crate) background_hover: Option<u32>,
|
|
188
|
+
pub(crate) background_pressed: Option<u32>,
|
|
189
|
+
pub(crate) text_primary: Option<u32>,
|
|
190
|
+
pub(crate) text_muted: Option<u32>,
|
|
191
|
+
pub(crate) border: Option<u32>,
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
impl ButtonColors {
|
|
195
|
+
pub fn new() -> Self {
|
|
196
|
+
Self::default()
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
pub fn background(mut self, color: u32) -> Self {
|
|
200
|
+
self.background = Some(color);
|
|
201
|
+
self
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
pub fn background_hover(mut self, color: u32) -> Self {
|
|
205
|
+
self.background_hover = Some(color);
|
|
206
|
+
self
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
pub fn background_pressed(mut self, color: u32) -> Self {
|
|
210
|
+
self.background_pressed = Some(color);
|
|
211
|
+
self
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
pub fn text_primary(mut self, color: u32) -> Self {
|
|
215
|
+
self.text_primary = Some(color);
|
|
216
|
+
self
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
pub fn text_muted(mut self, color: u32) -> Self {
|
|
220
|
+
self.text_muted = Some(color);
|
|
221
|
+
self
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
pub fn border(mut self, color: u32) -> Self {
|
|
225
|
+
self.border = Some(color);
|
|
226
|
+
self
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
pub fn has_background(&self) -> bool {
|
|
230
|
+
self.background.is_some()
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
pub fn background_color(&self) -> u32 {
|
|
234
|
+
self.background.unwrap_or(0)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
pub fn has_background_hover(&self) -> bool {
|
|
238
|
+
self.background_hover.is_some()
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
pub fn background_hover_color(&self) -> u32 {
|
|
242
|
+
self.background_hover.unwrap_or(0)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
pub fn has_background_pressed(&self) -> bool {
|
|
246
|
+
self.background_pressed.is_some()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
pub fn background_pressed_color(&self) -> u32 {
|
|
250
|
+
self.background_pressed.unwrap_or(0)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
pub fn has_text_primary(&self) -> bool {
|
|
254
|
+
self.text_primary.is_some()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
pub fn text_primary_color(&self) -> u32 {
|
|
258
|
+
self.text_primary.unwrap_or(0)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
pub fn has_text_muted(&self) -> bool {
|
|
262
|
+
self.text_muted.is_some()
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
pub fn text_muted_color(&self) -> u32 {
|
|
266
|
+
self.text_muted.unwrap_or(0)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
pub fn has_border(&self) -> bool {
|
|
270
|
+
self.border.is_some()
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
pub fn border_color(&self) -> u32 {
|
|
274
|
+
self.border.unwrap_or(0)
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
|
279
|
+
pub struct LabeledControlColors {
|
|
280
|
+
pub(crate) background: Option<u32>,
|
|
281
|
+
pub(crate) border: Option<u32>,
|
|
282
|
+
pub(crate) accent: Option<u32>,
|
|
283
|
+
pub(crate) text_primary: Option<u32>,
|
|
284
|
+
pub(crate) text_muted: Option<u32>,
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
impl LabeledControlColors {
|
|
288
|
+
pub fn new() -> Self {
|
|
289
|
+
Self::default()
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
pub fn background(mut self, color: u32) -> Self {
|
|
293
|
+
self.background = Some(color);
|
|
294
|
+
self
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
pub fn border(mut self, color: u32) -> Self {
|
|
298
|
+
self.border = Some(color);
|
|
299
|
+
self
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
pub fn accent(mut self, color: u32) -> Self {
|
|
303
|
+
self.accent = Some(color);
|
|
304
|
+
self
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
pub fn text_primary(mut self, color: u32) -> Self {
|
|
308
|
+
self.text_primary = Some(color);
|
|
309
|
+
self
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
pub fn text_muted(mut self, color: u32) -> Self {
|
|
313
|
+
self.text_muted = Some(color);
|
|
314
|
+
self
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
pub fn has_background(&self) -> bool {
|
|
318
|
+
self.background.is_some()
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
pub fn background_color(&self) -> u32 {
|
|
322
|
+
self.background.unwrap_or(0)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
pub fn has_border(&self) -> bool {
|
|
326
|
+
self.border.is_some()
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
pub fn border_color(&self) -> u32 {
|
|
330
|
+
self.border.unwrap_or(0)
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
pub fn has_accent(&self) -> bool {
|
|
334
|
+
self.accent.is_some()
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
pub fn accent_color(&self) -> u32 {
|
|
338
|
+
self.accent.unwrap_or(0)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
pub fn has_text_primary(&self) -> bool {
|
|
342
|
+
self.text_primary.is_some()
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
pub fn text_primary_color(&self) -> u32 {
|
|
346
|
+
self.text_primary.unwrap_or(0)
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
pub fn has_text_muted(&self) -> bool {
|
|
350
|
+
self.text_muted.is_some()
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
pub fn text_muted_color(&self) -> u32 {
|
|
354
|
+
self.text_muted.unwrap_or(0)
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
|
359
|
+
pub struct SliderColors {
|
|
360
|
+
pub(crate) track: Option<u32>,
|
|
361
|
+
pub(crate) fill: Option<u32>,
|
|
362
|
+
pub(crate) thumb: Option<u32>,
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
impl SliderColors {
|
|
366
|
+
pub fn new() -> Self {
|
|
367
|
+
Self::default()
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
pub fn track(mut self, color: u32) -> Self {
|
|
371
|
+
self.track = Some(color);
|
|
372
|
+
self
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
pub fn fill(mut self, color: u32) -> Self {
|
|
376
|
+
self.fill = Some(color);
|
|
377
|
+
self
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
pub fn thumb(mut self, color: u32) -> Self {
|
|
381
|
+
self.thumb = Some(color);
|
|
382
|
+
self
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
pub fn has_track(&self) -> bool {
|
|
386
|
+
self.track.is_some()
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
pub fn track_color(&self) -> u32 {
|
|
390
|
+
self.track.unwrap_or(0)
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
pub fn has_fill(&self) -> bool {
|
|
394
|
+
self.fill.is_some()
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
pub fn fill_color(&self) -> u32 {
|
|
398
|
+
self.fill.unwrap_or(0)
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
pub fn has_thumb(&self) -> bool {
|
|
402
|
+
self.thumb.is_some()
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
pub fn thumb_color(&self) -> u32 {
|
|
406
|
+
self.thumb.unwrap_or(0)
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
|
411
|
+
pub struct DropdownColors {
|
|
412
|
+
pub(crate) background: Option<u32>,
|
|
413
|
+
pub(crate) text_primary: Option<u32>,
|
|
414
|
+
pub(crate) placeholder: Option<u32>,
|
|
415
|
+
pub(crate) border: Option<u32>,
|
|
416
|
+
pub(crate) accent: Option<u32>,
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
impl DropdownColors {
|
|
420
|
+
pub fn new() -> Self {
|
|
421
|
+
Self::default()
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
pub fn background(mut self, color: u32) -> Self {
|
|
425
|
+
self.background = Some(color);
|
|
426
|
+
self
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
pub fn text_primary(mut self, color: u32) -> Self {
|
|
430
|
+
self.text_primary = Some(color);
|
|
431
|
+
self
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
pub fn placeholder(mut self, color: u32) -> Self {
|
|
435
|
+
self.placeholder = Some(color);
|
|
436
|
+
self
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
pub fn border(mut self, color: u32) -> Self {
|
|
440
|
+
self.border = Some(color);
|
|
441
|
+
self
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
pub fn accent(mut self, color: u32) -> Self {
|
|
445
|
+
self.accent = Some(color);
|
|
446
|
+
self
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
pub fn has_background(&self) -> bool {
|
|
450
|
+
self.background.is_some()
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
pub fn background_color(&self) -> u32 {
|
|
454
|
+
self.background.unwrap_or(0)
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
pub fn has_text_primary(&self) -> bool {
|
|
458
|
+
self.text_primary.is_some()
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
pub fn text_primary_color(&self) -> u32 {
|
|
462
|
+
self.text_primary.unwrap_or(0)
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
pub fn has_placeholder(&self) -> bool {
|
|
466
|
+
self.placeholder.is_some()
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
pub fn placeholder_color(&self) -> u32 {
|
|
470
|
+
self.placeholder.unwrap_or(0)
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
pub fn has_border(&self) -> bool {
|
|
474
|
+
self.border.is_some()
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
pub fn border_color(&self) -> u32 {
|
|
478
|
+
self.border.unwrap_or(0)
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
pub fn has_accent(&self) -> bool {
|
|
482
|
+
self.accent.is_some()
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
pub fn accent_color(&self) -> u32 {
|
|
486
|
+
self.accent.unwrap_or(0)
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
|
491
|
+
pub struct TextInputColors {
|
|
492
|
+
pub(crate) background: Option<u32>,
|
|
493
|
+
pub(crate) text_primary: Option<u32>,
|
|
494
|
+
pub(crate) text_muted: Option<u32>,
|
|
495
|
+
pub(crate) placeholder: Option<u32>,
|
|
496
|
+
pub(crate) caret: Option<u32>,
|
|
497
|
+
pub(crate) border: Option<u32>,
|
|
498
|
+
pub(crate) accent: Option<u32>,
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
impl TextInputColors {
|
|
502
|
+
pub fn new() -> Self {
|
|
503
|
+
Self::default()
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
pub fn background(mut self, color: u32) -> Self {
|
|
507
|
+
self.background = Some(color);
|
|
508
|
+
self
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
pub fn text_primary(mut self, color: u32) -> Self {
|
|
512
|
+
self.text_primary = Some(color);
|
|
513
|
+
self
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
pub fn text_muted(mut self, color: u32) -> Self {
|
|
517
|
+
self.text_muted = Some(color);
|
|
518
|
+
self
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
pub fn placeholder(mut self, color: u32) -> Self {
|
|
522
|
+
self.placeholder = Some(color);
|
|
523
|
+
self
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
pub fn caret(mut self, color: u32) -> Self {
|
|
527
|
+
self.caret = Some(color);
|
|
528
|
+
self
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
pub fn border(mut self, color: u32) -> Self {
|
|
532
|
+
self.border = Some(color);
|
|
533
|
+
self
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
pub fn accent(mut self, color: u32) -> Self {
|
|
537
|
+
self.accent = Some(color);
|
|
538
|
+
self
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
pub fn has_background(&self) -> bool {
|
|
542
|
+
self.background.is_some()
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
pub fn background_color(&self) -> u32 {
|
|
546
|
+
self.background.unwrap_or(0)
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
pub fn has_text_primary(&self) -> bool {
|
|
550
|
+
self.text_primary.is_some()
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
pub fn text_primary_color(&self) -> u32 {
|
|
554
|
+
self.text_primary.unwrap_or(0)
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
pub fn has_text_muted(&self) -> bool {
|
|
558
|
+
self.text_muted.is_some()
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
pub fn text_muted_color(&self) -> u32 {
|
|
562
|
+
self.text_muted.unwrap_or(0)
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
pub fn has_placeholder(&self) -> bool {
|
|
566
|
+
self.placeholder.is_some()
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
pub fn placeholder_color(&self) -> u32 {
|
|
570
|
+
self.placeholder.unwrap_or(0)
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
pub fn has_caret(&self) -> bool {
|
|
574
|
+
self.caret.is_some()
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
pub fn caret_color(&self) -> u32 {
|
|
578
|
+
self.caret.unwrap_or(0)
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
pub fn has_border(&self) -> bool {
|
|
582
|
+
self.border.is_some()
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
pub fn border_color(&self) -> u32 {
|
|
586
|
+
self.border.unwrap_or(0)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
pub fn has_accent(&self) -> bool {
|
|
590
|
+
self.accent.is_some()
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
pub fn accent_color(&self) -> u32 {
|
|
594
|
+
self.accent.unwrap_or(0)
|
|
595
|
+
}
|
|
596
|
+
}
|