burin 0.1.2

A Rust GUI framework built on the auralis reactive signal kernel
Documentation
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
//! ComponentRole — declarative widget identity for automatic theme resolution.

use crate::style::{Color, CornerRadii, Padding};
use crate::theme::m3::states::{DisabledColors, LayerColor};
use crate::theme::{Appearance, ControlShape, ControlSize, Intent};

/// The role a widget plays — determines which M3 color roles and tokens it gets.
#[derive(Clone, Debug)]
pub enum ComponentRole {
    Interactive(InteractiveRole),
    Display(DisplayRole),
}

#[derive(Clone, Debug)]
pub enum InteractiveRole {
    Button {
        intent: Intent,
        appearance: Appearance,
        size: ControlSize,
        shape: ControlShape,
    },
    TextInput {
        variant: InputVariant,
        size: ControlSize,
        disabled: bool,
        readonly: bool,
        is_valid: bool,
    },
    Select {
        size: ControlSize,
    },
    Checkbox {
        size: ControlSize,
    },
    Switch {
        size: ControlSize,
    },
    Radio {
        size: ControlSize,
    },
    Slider {
        size: ControlSize,
    },
    ColorPicker {
        size: ControlSize,
    },
    Chip {
        selected: bool,
    },
    Tab {
        selected: bool,
    },
    MenuItem,
    ListItem {
        selected: bool,
    },
    TreeItem {
        selected: bool,
        expanded: bool,
    },
    Progress {
        intent: Intent,
    },
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum InputVariant {
    Filled,
    Outlined,
}

#[derive(Clone, Debug)]
pub enum DisplayRole {
    Text { foreground: ColorRole },
    Badge { intent: Intent },
    Divider,
    Skeleton,
    Avatar,
    Icon,
    Tooltip,
    Popover,
    Modal,
    Dialog,
    Toast { kind: ToastKind },
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ColorRole {
    OnSurface,
    OnSurfaceVariant,
    Primary,
    Error,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ToastKind {
    Info,
    Success,
    Warning,
    Error,
}

// ── Resolved style types ──

#[derive(Clone, Debug)]
pub enum ResolvedComponentStyle {
    Button(ButtonStyle),
    TextInput(InputStyle),
    Select(SelectStyle),
    Checkbox(CheckboxStyle),
    Switch(SwitchStyle),
    Radio(RadioStyle),
    Slider(SliderStyle),
    ColorPicker(ColorPickerStyle),
    Chip(ChipStyle),
    Tab(TabStyle),
    MenuItem(MenuItemStyle),
    ListItem(ListItemStyle),
    TreeItem(TreeItemStyle),
    Progress(ProgressStyle),
    Text(TextStyle),
    Badge(BadgeStyle),
    Divider(DividerStyle),
    Skeleton(SkeletonStyle),
    Avatar(AvatarStyle),
    Icon(IconStyle),
    Tooltip(TooltipStyle),
    Popover(PopoverStyle),
    Modal(ModalStyle),
    Dialog(DialogStyle),
    Toast(ToastStyle),
}

#[derive(Clone, Debug)]
pub struct ButtonStyle {
    pub background: Color,
    pub foreground: Color,
    pub border: Option<Color>,
    pub(crate) hover: LayerColor,
    pub(crate) pressed: LayerColor,
    pub(crate) focused: LayerColor,
    pub(crate) disabled: DisabledColors,
    pub font_size: f32,
    pub font_weight: u16,
    pub letter_spacing: f32,
    pub corner_radius: CornerRadii,
    pub min_width: f32,
    pub height: f32,
    pub padding: Padding,
}

#[derive(Clone, Debug)]
pub struct InputStyle {
    pub background: Color,
    pub foreground: Color,
    pub border_color: Color,
    pub placeholder_color: Color,
    pub(crate) hover: LayerColor,
    pub(crate) pressed: LayerColor,
    pub(crate) focused: LayerColor,
    pub(crate) disabled: DisabledColors,
    pub font_size: f32,
    pub font_weight: u16,
    pub letter_spacing: f32,
    pub corner_radius: CornerRadii,
    pub height: f32,
    pub padding: Padding,
}

#[derive(Clone, Debug)]
pub struct SelectStyle {
    pub trigger_bg: Color,
    pub trigger_fg: Color,
    pub trigger_border: Color,
    pub trigger_hover_bg: Color,
    pub dropdown_bg: Color,
    pub dropdown_fg: Color,
    pub dropdown_border: Color,
    pub selected_bg: Color,
    pub selected_fg: Color,
    pub option_hover_bg: Color,
    pub option_disabled_fg: Color,
    pub corner_radius: CornerRadii,
    pub height: f32,
    pub font_size: f32,
    pub shadow: Option<crate::style::styled::Shadow>,
}

#[derive(Clone, Debug)]
pub struct CheckboxStyle {
    pub checked_bg: Color,
    pub unchecked_bg: Color,
    pub unchecked_border: Color,
    pub checked_icon: Color,
    pub hover_bg: Color,
    pub pressed_bg: Color,
    pub disabled_bg: Color,
    pub disabled_border: Color,
    pub corner_radius: CornerRadii,
    pub size: f32,
}

#[derive(Clone, Debug)]
pub struct SwitchStyle {
    pub checked_bg: Color,
    pub unchecked_bg: Color,
    pub checked_thumb: Color,
    pub unchecked_thumb: Color,
    pub disabled_bg: Color,
    pub disabled_thumb: Color,
    pub width: f32,
    pub height: f32,
    pub thumb_size: f32,
    pub hover_bg: Color,
    pub hover_fg: Color,
    pub pressed_bg: Color,
    pub pressed_fg: Color,
    pub focused_bg: Color,
    pub focused_fg: Color,
}

#[derive(Clone, Debug)]
pub struct RadioStyle {
    pub checked_bg: Color,
    pub unchecked_bg: Color,
    pub unchecked_border: Color,
    pub checked_dot: Color,
    pub hover_bg: Color,
    pub disabled_bg: Color,
    pub disabled_border: Color,
    pub size: f32,
}

#[derive(Clone, Debug)]
pub struct SliderStyle {
    pub track_color: Color,
    pub fill_color: Color,
    pub thumb_color: Color,
    pub hover_thumb: Color,
    pub pressed_thumb: Color,
    pub disabled_track: Color,
    pub disabled_thumb: Color,
    pub track_height: f32,
    pub thumb_radius: f32,
}

#[derive(Clone, Debug)]
pub struct ColorPickerStyle {
    pub panel_bg: Color,
    pub panel_border: Color,
    pub trigger_bg: Color,
    pub trigger_border: Color,
    pub plane_handle_color: Color,
    pub plane_handle_border: Color,
    pub slider_handle_color: Color,
    pub slider_track_color: Color,
    pub preview_border: Color,
    pub preset_border: Color,
    pub label_color: Color,
    pub font_size: f32,
    pub corner_radius: CornerRadii,
    pub handle_radius: f32,
    pub hue_track_height: f32,
    pub alpha_track_height: f32,
    pub plane_size: f32,
    pub preset_size: f32,
    pub shadow: Option<crate::style::styled::Shadow>,
}

#[derive(Clone, Debug)]
pub struct ChipStyle {
    pub background: Color,
    pub foreground: Color,
    pub selected_bg: Color,
    pub selected_fg: Color,
    pub border_color: Color,
    pub corner_radius: CornerRadii,
    pub height: f32,
    pub font_size: f32,
    pub padding_h: f32,
    pub hover_bg: Color,
    pub hover_fg: Color,
    pub pressed_bg: Color,
    pub pressed_fg: Color,
    pub focused_bg: Color,
    pub focused_fg: Color,
    pub(crate) disabled: DisabledColors,
}

#[derive(Clone, Debug)]
pub struct TabStyle {
    pub background: Color,
    pub foreground: Color,
    pub selected_bg: Color,
    pub selected_fg: Color,
    pub indicator_color: Color,
    pub indicator_height: f32,
    pub hover_bg: Color,
    pub hover_fg: Color,
    pub pressed_bg: Color,
    pub pressed_fg: Color,
    pub focused_bg: Color,
    pub focused_fg: Color,
    pub(crate) disabled: DisabledColors,
    pub font_size: f32,
    pub height: f32,
    pub tab_gap: f32,
    pub pill_radius: CornerRadii,
}

#[derive(Clone, Debug)]
pub struct MenuItemStyle {
    pub background: Color,
    pub foreground: Color,
    pub hover_bg: Color,
    pub hover_fg: Color,
    pub disabled_fg: Color,
    pub font_size: f32,
    pub height: f32,
    pub padding: Padding,
}

#[derive(Clone, Debug)]
pub struct ListItemStyle {
    pub background: Color,
    pub foreground: Color,
    pub selected_bg: Color,
    pub selected_fg: Color,
    pub hover_bg: Color,
    pub font_size: f32,
    pub height: f32,
    pub padding: Padding,
}

#[derive(Clone, Debug)]
pub struct TreeItemStyle {
    pub background: Color,
    pub foreground: Color,
    pub selected_bg: Color,
    pub selected_fg: Color,
    pub hover_bg: Color,
    pub indent: f32,
    pub font_size: f32,
    pub height: f32,
}

#[derive(Clone, Debug)]
pub struct ProgressStyle {
    pub track_color: Color,
    pub fill_color: Color,
    pub height: f32,
    pub corner_radius: CornerRadii,
    pub circular_size: f32,
}

#[derive(Clone, Debug)]
pub struct TextStyle {
    pub foreground: Color,
    pub font_size: f32,
    pub font_weight: u16,
    pub letter_spacing: f32,
}

#[derive(Clone, Debug)]
pub struct BadgeStyle {
    pub background: Color,
    pub foreground: Color,
    pub corner_radius: CornerRadii,
    pub font_size: f32,
    pub font_weight: u16,
    pub height: f32,
    pub padding_h: f32,
}

#[derive(Clone, Debug)]
pub struct DividerStyle {
    pub color: Color,
    pub thickness: f32,
}

#[derive(Clone, Debug)]
pub struct SkeletonStyle {
    pub background: Color,
    pub shimmer: Color,
}

#[derive(Clone, Debug)]
pub struct AvatarStyle {
    pub font_size: f32,
    pub font_weight: u16,
    pub size: f32,
    pub corner_radius: CornerRadii,
}

#[derive(Clone, Debug)]
pub struct IconStyle {
    pub color: Color,
    pub size: f32,
}

#[derive(Clone, Debug)]
pub struct TooltipStyle {
    pub background: Color,
    pub foreground: Color,
    pub font_size: f32,
    pub corner_radius: CornerRadii,
    pub padding: Padding,
}

#[derive(Clone, Debug)]
pub struct PopoverStyle {
    pub background: Color,
    pub border_color: Color,
    pub corner_radius: CornerRadii,
    pub shadow: Option<crate::style::styled::Shadow>,
}

#[derive(Clone, Debug)]
pub struct ModalStyle {
    pub backdrop_color: Color,
}

#[derive(Clone, Debug)]
pub struct DialogStyle {
    pub background: Color,
    pub foreground: Color,
    pub border_color: Color,
    pub corner_radius: CornerRadii,
    pub shadow: Option<crate::style::styled::Shadow>,
    pub title_font_size: f32,
    pub body_font_size: f32,
    pub padding: Padding,
    pub gap: f32,
    pub max_width: f32,
}

#[derive(Clone, Debug)]
pub struct ToastStyle {
    pub background: Color,
    pub foreground: Color,
    pub corner_radius: CornerRadii,
    pub font_size: f32,
}