1use blitz_dom::FontContext;
2use dioxus_core::LaunchConfig;
3use winit::window::WindowAttributes;
4
5pub struct Config {
7 pub(crate) window_attributes: WindowAttributes,
8 pub(crate) font_ctx: Option<FontContext>,
9}
10
11impl LaunchConfig for Config {}
12
13impl Default for Config {
14 fn default() -> Self {
15 let window_attributes = WindowAttributes::default()
16 .with_title(dioxus_cli_config::app_title().unwrap_or_else(|| "Dioxus App".to_string()));
17
18 #[cfg(target_arch = "wasm32")]
25 let window_attributes = {
26 use winit::platform::web::WindowAttributesWeb;
27 window_attributes.with_platform_attributes(Box::new(
28 WindowAttributesWeb::default().with_append(true),
29 ))
30 };
31
32 Self {
33 window_attributes,
34 font_ctx: None,
35 }
36 }
37}
38
39impl Config {
40 pub fn new() -> Self {
41 Self::default()
42 }
43
44 pub fn with_window_attributes(mut self, attrs: WindowAttributes) -> Self {
46 self.window_attributes = attrs;
47 self
48 }
49
50 pub fn with_font_ctx(mut self, font_ctx: FontContext) -> Self {
56 self.font_ctx = Some(font_ctx);
57 self
58 }
59}