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
//! # egui-material3
//!
//! A comprehensive Material Design 3 component library for [egui](https://github.com/emilk/egui),
//! providing a complete set of Material Design components with advanced theming support.
//!
//! ## Features
//!
//! - **Complete Material Design 3 Components**: Buttons, checkboxes, sliders, dialogs, data tables, and more
//! - **Advanced Theming System**: Support for light/dark modes, contrast levels, and custom Material Design themes
//! - **Build-time Theme Inclusion**: Automatically include theme JSON files at compile time for optimal performance
//! - **Runtime Theme Loading**: Load and switch themes dynamically at runtime
//! - **Material Design Icons**: Full support for Material Symbols with built-in icon font loading
//! - **Responsive Design**: Components adapt to different screen sizes and orientations
//!
//! ## Quick Start
//!
//! Add this to your `Cargo.toml`:
//! ```bash
//! $ cargo add egui-material3
//! ```
//!
//! ### Basic Usage
//!
//! ```rust,no_run
//! use eframe::egui;
//! use egui_material3::{
//! MaterialButton, MaterialCheckbox, MaterialSlider,
//! theme::{setup_google_fonts, setup_local_fonts, setup_local_theme,
//! load_fonts, load_themes, update_window_background}
//! };
//!
//! fn main() -> Result<(), eframe::Error> {
//! let options = eframe::NativeOptions {
//! viewport: egui::ViewportBuilder::default().with_inner_size([800.0, 600.0]),
//! ..Default::default()
//! };
//!
//! eframe::run_native(
//! "Material Design App",
//! options,
//! Box::new(|cc| {
//! // Setup Material Design fonts and themes
//! setup_google_fonts(Some("Roboto"));
//! setup_local_fonts(Some("resources/MaterialSymbolsOutlined.ttf"));
//! setup_local_theme(None); // Use default theme
//!
//! // Load fonts and themes
//! load_fonts(&cc.egui_ctx);
//! load_themes();
//!
//! // Apply theme background
//! update_window_background(&cc.egui_ctx);
//!
//! Ok(Box::<MyApp>::default())
//! }),
//! )
//! }
//!
//! #[derive(Default)]
//! struct MyApp {
//! checked: bool,
//! slider_value: f32,
//! }
//!
//! impl eframe::App for MyApp {
//! fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
//! egui::CentralPanel::default().show(ctx, |ui| {
//! ui.heading("Material Design Components");
//!
//! // Use Material Design components
//! ui.add(MaterialButton::new("Click me"));
//! ui.add(MaterialCheckbox::new(&mut self.checked, "Check me"));
//! ui.add(MaterialSlider::new(&mut self.slider_value, 0.0..=100.0));
//! });
//! }
//! }
//! ```
//!
//! ## Theme System
//!
//! The theme system supports Material Design 3 with comprehensive theming capabilities:
//!
//! ### Build-time Theme Inclusion
//!
//! Themes can be automatically included at build time from JSON files:
//!
//! ```rust,no_run
//! use egui_material3::theme::{setup_local_theme, load_themes};
//!
//! // Uses themes from resources/ and examples/ directories automatically
//! setup_local_theme(None);
//! load_themes();
//! ```
//!
//! ### Runtime Theme Loading
//!
//! Load custom themes dynamically:
//!
//! ```rust,no_run
//! use egui_material3::theme::{setup_local_theme, load_themes};
//!
//! // Load specific theme file
//! setup_local_theme(Some("path/to/my-theme.json"));
//! load_themes();
//! ```
//!
//! ### Theme Modes and Contrast
//!
//! Support for multiple theme modes and contrast levels:
//!
//! ```rust,no_run
//! use egui_material3::theme::{get_global_theme, update_window_background, ThemeMode, ContrastLevel};
//!
//! // Change theme mode at runtime
//! if let Ok(mut theme) = get_global_theme().lock() {
//! theme.theme_mode = ThemeMode::Dark;
//! theme.contrast_level = ContrastLevel::High;
//! }
//! // Apply changes
//! update_window_background(ctx);
//! ```
//!
//! ## Available Components
//!
//! ### Basic Components
//! - [`MaterialButton`] - Material Design buttons with multiple variants
//! - [`MaterialCheckbox`] - Checkboxes following Material Design guidelines
//! - [`MaterialSlider`] - Sliders with Material Design styling
//! - [`MaterialSwitch`] - Toggle switches
//! - [`MaterialRadio`] - Radio button groups
//! - [`MaterialSelect`] - Dropdown selection components
//!
//! ### Advanced Components
//! - [`MaterialChip`] - Filter and action chips
//! - [`MaterialCard2`] - Material Design cards
//! - [`MaterialDialog`] - Modal dialogs and alerts
//! - [`MaterialFab`] - Floating Action Buttons
//! - [`MaterialProgress`] - Progress indicators and loading states
//! - [`MaterialDataTable`] - Data tables with sorting and selection
//!
//! ### Navigation Components
//! - [`MaterialTabs`] - Tab navigation
//! - [`MaterialDrawer`] - Navigation drawers
//! - [`MaterialTopAppBar`] - App bars and toolbars
//!
//! ### Icons and Visual Elements
//! - [`MaterialIcon`] - Material Design icons with font support
//! - [`MaterialList`] - Lists following Material Design patterns
//! - [`MaterialImageList`] - Image lists with online/offline support and smart caching
//! - [`MaterialTimeline`] - Timeline component for displaying chronological events
//!
//! ## Image Lists and OnDemand Feature
//!
//! The [`MaterialImageList`] component provides comprehensive image display capabilities:
//!
//! ```rust,no_run
//! use egui_material3::image_list;
//!
//! // Local image files
//! ui.add(image_list()
//! .columns(3)
//! .item_spacing(8.0)
//! .items_from_paths(glob::glob("resources/*.png")?));
//!
//! // Online images (requires 'ondemand' feature)
//! ui.add(image_list()
//! .columns(4)
//! .item_spacing(8.0)
//! .items_from_urls(vec![
//! "https://example.com/image1.jpg".to_string(),
//! "https://example.com/image2.png".to_string(),
//! ]));
//!
//! // Embedded images from byte arrays
//! ui.add(image_list()
//! .columns(2)
//! .item_spacing(8.0)
//! .items_from_bytes(vec![
//! include_bytes!("image1.png").to_vec(),
//! include_bytes!("image2.png").to_vec(),
//! ]));
//! ```
//!
//! ### OnDemand Feature
//!
//! Enable the `ondemand` feature for online image support:
//!
//! ```toml
//! [dependencies]
//! egui-material3 = { version = "0.0.6", features = ["ondemand"] }
//! ```
//!
//! Key capabilities:
//! - **Smart caching**: Downloaded images are cached locally with correct file extensions
//! - **Format detection**: Automatically detects PNG, JPEG, GIF, and WebP formats
//! - **Efficient loading**: Images are downloaded once and reused from cache
//! - **Performance optimized**: UI repaints only when new images are available
//! - **Error handling**: Graceful fallback with visual indicators for failed loads
//!
//! ## Examples
//!
//! The crate includes comprehensive examples:
//!
//! - `widget_gallery_example` - Showcase of all Material components with theme switching
//! - `nobel_prizes_example` - Real-world data table implementation
//! - `stories` - Individual component showcase windows for detailed exploration
//! - `package` - Standalone example with bundled resources and themes
//! - `ondemand` - Image list demonstration with online/offline images and smart caching
//!
//! Run examples with:
//! ```bash
//! cargo run --example widget_gallery_example
//! cargo run --example nobel_prizes_example
//! cargo run --example stories
//!
//! # OnDemand example with online image support
//! cd examples/ondemand && cargo run
//!
//! # Package example runs independently with its own Cargo.toml
//! cd examples/package && cargo run
//! ```
//!
//! ## Material Design Resources
//!
//! - [Material Design 3](https://m3.material.io/)
//! - [Material Theme Builder](https://m3.material.io/theme-builder)
//! - [Material Design Icons](https://fonts.google.com/icons)
//!
//! This crate follows the Material Design 3 specifications and guidelines for consistent,
//! accessible, and beautiful user interfaces.
pub use ;
pub use ;