diff --git a/Cargo.toml b/Cargo.toml
index 71b341a82..e512f9b10 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -125,7 +125,7 @@ rust-version = "1.60.0"
publish = false
[dev-dependencies]
-dioxus = { workspace = true }
+dioxus = { workspace = true, features = ["desktop"] }
dioxus-desktop = { workspace = true, features = ["transparent"] }
dioxus-ssr = { workspace = true }
dioxus-router = { workspace = true }
diff --git a/examples/all_css.rs b/examples/all_css.rs
index b4a854751..9d55f1105 100644
--- a/examples/all_css.rs
+++ b/examples/all_css.rs
@@ -1,7 +1,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/all_events.rs b/examples/all_events.rs
index bfca23aa8..b46d2c25e 100644
--- a/examples/all_events.rs
+++ b/examples/all_events.rs
@@ -1,7 +1,7 @@
use dioxus::{events::*, html::MouseEvent, prelude::*};
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
#[derive(Debug)]
diff --git a/examples/calculator.rs b/examples/calculator.rs
index c91c242af..8aa35ab11 100644
--- a/examples/calculator.rs
+++ b/examples/calculator.rs
@@ -15,7 +15,7 @@ fn main() {
.with_inner_size(LogicalSize::new(300.0, 500.0)),
);
- dioxus_desktop::launch_cfg(app, config);
+ LaunchBuilder::new(app).cfg(config);
}
fn app() -> Element {
@@ -61,9 +61,7 @@ fn app() -> Element {
style { {include_str!("./assets/calculator.css")} }
div { id: "wrapper",
div { class: "app",
- div { class: "calculator",
- tabindex: "0",
- onkeydown: handle_key_down_event,
+ div { class: "calculator", tabindex: "0", onkeydown: handle_key_down_event,
div { class: "calculator-display", "{val}" }
div { class: "calculator-keypad",
div { class: "input-keys",
@@ -72,7 +70,7 @@ fn app() -> Element {
class: "calculator-key key-clear",
onclick: move |_| {
val.set(String::new());
- if !val.cloned().is_empty(){
+ if !val.cloned().is_empty() {
val.set("0".into());
}
},
@@ -93,16 +91,22 @@ fn app() -> Element {
button {
class: "calculator-key key-percent",
onclick: move |_| {
- val.set(
- format!("{}", calc_val(val.cloned().as_str()) / 100.0)
- );
+ val.set(format!("{}", calc_val(val.cloned().as_str()) / 100.0));
},
"%"
}
}
div { class: "digit-keys",
- button { class: "calculator-key key-0", onclick: move |_| input_digit(0), "0" }
- button { class: "calculator-key key-dot", onclick: move |_| val.write().push('.'), "●" }
+ button {
+ class: "calculator-key key-0",
+ onclick: move |_| input_digit(0),
+ "0"
+ }
+ button {
+ class: "calculator-key key-dot",
+ onclick: move |_| val.write().push('.'),
+ "●"
+ }
for k in 1..10 {
button {
class: "calculator-key {k}",
@@ -114,10 +118,26 @@ fn app() -> Element {
}
}
div { class: "operator-keys",
- button { class: "calculator-key key-divide", onclick: move |_| input_operator("/"), "÷" }
- button { class: "calculator-key key-multiply", onclick: move |_| input_operator("*"), "×" }
- button { class: "calculator-key key-subtract", onclick: move |_| input_operator("-"), "−" }
- button { class: "calculator-key key-add", onclick: move |_| input_operator("+"), "+" }
+ button {
+ class: "calculator-key key-divide",
+ onclick: move |_| input_operator("/"),
+ "÷"
+ }
+ button {
+ class: "calculator-key key-multiply",
+ onclick: move |_| input_operator("*"),
+ "×"
+ }
+ button {
+ class: "calculator-key key-subtract",
+ onclick: move |_| input_operator("-"),
+ "−"
+ }
+ button {
+ class: "calculator-key key-add",
+ onclick: move |_| input_operator("+"),
+ "+"
+ }
button {
class: "calculator-key key-equals",
onclick: move |_| val.set(format!("{}", calc_val(val.cloned().as_str()))),
diff --git a/examples/clock.rs b/examples/clock.rs
index cab1db310..bec4d102f 100644
--- a/examples/clock.rs
+++ b/examples/clock.rs
@@ -2,7 +2,7 @@ use dioxus::prelude::*;
use dioxus_signals::use_signal;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/compose.rs b/examples/compose.rs
index be59c5aca..c9581d2b4 100644
--- a/examples/compose.rs
+++ b/examples/compose.rs
@@ -6,7 +6,7 @@ use dioxus::prelude::*;
use futures_util::StreamExt;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/control_focus.rs b/examples/control_focus.rs
index ce7e62d1b..59f5f5b3a 100644
--- a/examples/control_focus.rs
+++ b/examples/control_focus.rs
@@ -3,7 +3,7 @@ use std::rc::Rc;
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/counter.rs b/examples/counter.rs
index 8308ef07a..cee67f077 100644
--- a/examples/counter.rs
+++ b/examples/counter.rs
@@ -4,7 +4,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/crm.rs b/examples/crm.rs
index e57c8620a..7f3bba531 100644
--- a/examples/crm.rs
+++ b/examples/crm.rs
@@ -3,7 +3,7 @@ use dioxus::prelude::*;
use dioxus_router::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
/// A type alias that reprsents a shared context between components
diff --git a/examples/custom_assets.rs b/examples/custom_assets.rs
index bf33e948a..3fefdf571 100644
--- a/examples/custom_assets.rs
+++ b/examples/custom_assets.rs
@@ -1,7 +1,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/custom_html.rs b/examples/custom_html.rs
index 47c13181c..dc9320a6d 100644
--- a/examples/custom_html.rs
+++ b/examples/custom_html.rs
@@ -5,13 +5,11 @@ use dioxus::prelude::*;
use dioxus_desktop::Config;
fn main() {
- dioxus_desktop::launch_cfg(
- app,
+ LaunchBuilder::new(app).cfg(
Config::new().with_custom_head("".into()),
);
- dioxus_desktop::launch_cfg(
- app,
+ LaunchBuilder::new(app).cfg(
Config::new().with_custom_index(
r#"
@@ -33,8 +31,6 @@ fn main() {
fn app() -> Element {
rsx! {
- div {
- h1 {"hello world!"}
- }
+ div { h1 { "hello world!" } }
}
}
diff --git a/examples/disabled.rs b/examples/disabled.rs
index 7c2913265..c7288f352 100644
--- a/examples/disabled.rs
+++ b/examples/disabled.rs
@@ -1,7 +1,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/dog_app.rs b/examples/dog_app.rs
index cb45e4211..b98cb0f3b 100644
--- a/examples/dog_app.rs
+++ b/examples/dog_app.rs
@@ -2,7 +2,7 @@ use dioxus::prelude::*;
use std::collections::HashMap;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/dynamic_asset.rs b/examples/dynamic_asset.rs
index 85d1b5519..fed2ee20f 100644
--- a/examples/dynamic_asset.rs
+++ b/examples/dynamic_asset.rs
@@ -2,7 +2,7 @@ use dioxus::prelude::*;
use dioxus_desktop::{use_asset_handler, wry::http::Response};
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/error_handle.rs b/examples/error_handle.rs
index df2dd06a1..951e50c04 100644
--- a/examples/error_handle.rs
+++ b/examples/error_handle.rs
@@ -1,7 +1,7 @@
use dioxus::{dioxus_core::CapturedError, prelude::*};
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/eval.rs b/examples/eval.rs
index 5d4677fb9..736c8d652 100644
--- a/examples/eval.rs
+++ b/examples/eval.rs
@@ -1,7 +1,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/file_explorer.rs b/examples/file_explorer.rs
index e153fb8a0..2bba31e11 100644
--- a/examples/file_explorer.rs
+++ b/examples/file_explorer.rs
@@ -12,9 +12,9 @@ use dioxus::prelude::*;
use dioxus_desktop::{Config, WindowBuilder};
fn main() {
- Config::new()
- .with_window(WindowBuilder::new().with_resizable(true))
- .launch(app)
+ LaunchBuilder::new(app)
+ .cfg(Config::new().with_window(WindowBuilder::new().with_resizable(true)))
+ .launch()
}
const _STYLE: &str = manganis::mg!(file("./examples/assets/fileexplorer.css"));
diff --git a/examples/file_upload.rs b/examples/file_upload.rs
index 0cc2d2774..1ee5d968b 100644
--- a/examples/file_upload.rs
+++ b/examples/file_upload.rs
@@ -4,7 +4,7 @@ use dioxus::prelude::*;
use tokio::time::sleep;
fn main() {
- dioxus_desktop::launch(App);
+ launch(App);
}
fn App() -> Element {
diff --git a/examples/filedragdrop.rs b/examples/filedragdrop.rs
index 51dacdb58..a311d896b 100644
--- a/examples/filedragdrop.rs
+++ b/examples/filedragdrop.rs
@@ -2,18 +2,16 @@ use dioxus::prelude::*;
use dioxus_desktop::Config;
fn main() {
- Config::new()
- .with_file_drop_handler(|_w, e| {
+ LaunchBuilder::new(app)
+ .cfg(Config::new().with_file_drop_handler(|_w, e| {
println!("{e:?}");
true
- })
- .launch(app)
+ }))
+ .launch()
}
fn app() -> Element {
rsx!(
- div {
- h1 { "drag a file here and check your console" }
- }
+ div { h1 { "drag a file here and check your console" } }
)
}
diff --git a/examples/flat_router.rs b/examples/flat_router.rs
index 56f04d072..8d6790502 100644
--- a/examples/flat_router.rs
+++ b/examples/flat_router.rs
@@ -5,17 +5,17 @@ use dioxus_router::prelude::*;
fn main() {
env_logger::init();
- Config::new()
- .with_window(
+ LaunchBuilder::new(|| {
+ render! { Router:: {} }
+ })
+ .cfg(
+ Config::new().with_window(
WindowBuilder::new()
.with_inner_size(LogicalSize::new(600, 1000))
.with_resizable(false),
- )
- .launch(|| {
- render! {
- Router:: {}
- }
- });
+ ),
+ )
+ .launch()
}
#[derive(Routable, Clone)]
@@ -36,18 +36,24 @@ enum Route {
fn Footer() -> Element {
render! {
div {
- Outlet:: { }
+ Outlet:: {}
- p {
- "----"
- }
+ p { "----" }
nav {
ul {
- li { Link { to: Route::Home {}, "Home" } }
- li { Link { to: Route::Games {}, "Games" } }
- li { Link { to: Route::Play {}, "Play" } }
- li { Link { to: Route::Settings {}, "Settings" } }
+ li {
+ Link { to: Route::Home {}, "Home" }
+ }
+ li {
+ Link { to: Route::Games {}, "Games" }
+ }
+ li {
+ Link { to: Route::Play {}, "Play" }
+ }
+ li {
+ Link { to: Route::Settings {}, "Settings" }
+ }
}
}
}
diff --git a/examples/form.rs b/examples/form.rs
index 820279776..f85ea763c 100644
--- a/examples/form.rs
+++ b/examples/form.rs
@@ -6,7 +6,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/generic_component.rs b/examples/generic_component.rs
index 632a69a9a..a9055c613 100644
--- a/examples/generic_component.rs
+++ b/examples/generic_component.rs
@@ -3,7 +3,7 @@ use std::fmt::Display;
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/hello_world.rs b/examples/hello_world.rs
index b51244fe9..d1f399d4a 100644
--- a/examples/hello_world.rs
+++ b/examples/hello_world.rs
@@ -1,7 +1,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/hydration.rs b/examples/hydration.rs
index 61342c44e..4b84e6972 100644
--- a/examples/hydration.rs
+++ b/examples/hydration.rs
@@ -13,15 +13,15 @@ use dioxus::prelude::*;
use dioxus_desktop::Config;
fn main() {
- Config::new()
- .with_prerendered({
+ LaunchBuilder::new(app)
+ .cfg(Config::new().with_prerendered({
// We build the dom a first time, then pre-render it to HTML
let pre_rendered_dom = VirtualDom::prebuilt(app);
// We then launch the app with the pre-rendered HTML
dioxus_ssr::pre_render(&pre_rendered_dom)
- })
- .launch(app);
+ }))
+ .launch();
}
fn app() -> Element {
diff --git a/examples/inputs.rs b/examples/inputs.rs
index 4268797ce..e6c04bae1 100644
--- a/examples/inputs.rs
+++ b/examples/inputs.rs
@@ -5,7 +5,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
const FIELDS: &[(&str, &str)] = &[
diff --git a/examples/link.rs b/examples/link.rs
index fd859188b..14bfd0c79 100644
--- a/examples/link.rs
+++ b/examples/link.rs
@@ -2,7 +2,7 @@ use dioxus::prelude::*;
use dioxus_router::prelude::*;
fn main() {
- dioxus_desktop::launch(App);
+ launch(App);
}
#[component]
diff --git a/examples/login_form.rs b/examples/login_form.rs
index 5c778ee81..fc30112ab 100644
--- a/examples/login_form.rs
+++ b/examples/login_form.rs
@@ -4,7 +4,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/mobile_demo/src/lib.rs b/examples/mobile_demo/src/lib.rs
index 0262aa615..f29d94db1 100644
--- a/examples/mobile_demo/src/lib.rs
+++ b/examples/mobile_demo/src/lib.rs
@@ -49,8 +49,7 @@ pub fn main() -> Result<()> {
// Right now we're going through dioxus-desktop but we'd like to go through dioxus-mobile
// That will seed the index.html with some fixes that prevent the page from scrolling/zooming etc
- dioxus_desktop::launch_cfg(
- app,
+ LaunchBuilder::new(app).cfg(
// Note that we have to disable the viewport goofiness of the browser.
// Dioxus_mobile should do this for us
Config::default().with_custom_index(include_str!("index.html").to_string()),
@@ -66,10 +65,15 @@ fn app() -> Element {
render! {
div {
- h1 { "Hello, Mobile"}
- div { margin_left: "auto", margin_right: "auto", width: "200px", padding: "10px", border: "1px solid black",
+ h1 { "Hello, Mobile" }
+ div {
+ margin_left: "auto",
+ margin_right: "auto",
+ width: "200px",
+ padding: "10px",
+ border: "1px solid black",
button {
- onclick: move|_| {
+ onclick: move |_| {
println!("Clicked!");
items.push(items.len());
cx.needs_update_any(ScopeId::ROOT);
diff --git a/examples/multiwindow.rs b/examples/multiwindow.rs
index 5ba22ba7a..5667a9ff4 100644
--- a/examples/multiwindow.rs
+++ b/examples/multiwindow.rs
@@ -1,7 +1,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/nested_listeners.rs b/examples/nested_listeners.rs
index a78f3cc8b..aaee9757e 100644
--- a/examples/nested_listeners.rs
+++ b/examples/nested_listeners.rs
@@ -7,7 +7,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/optional_props.rs b/examples/optional_props.rs
index f912e9c07..39c02f4d9 100644
--- a/examples/optional_props.rs
+++ b/examples/optional_props.rs
@@ -7,7 +7,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/overlay.rs b/examples/overlay.rs
index eebbcd411..9aa1ac2f8 100644
--- a/examples/overlay.rs
+++ b/examples/overlay.rs
@@ -2,7 +2,7 @@ use dioxus::prelude::*;
use dioxus_desktop::{tao::dpi::PhysicalPosition, LogicalSize, WindowBuilder};
fn main() {
- dioxus_desktop::launch_cfg(app, make_config());
+ LaunchBuilder::new(app).cfg(make_config());
}
fn app() -> Element {
diff --git a/examples/pattern_model.rs b/examples/pattern_model.rs
index ae6a93b19..686e682f5 100644
--- a/examples/pattern_model.rs
+++ b/examples/pattern_model.rs
@@ -32,7 +32,7 @@ fn main() {
.with_inner_size(LogicalSize::new(320.0, 530.0)),
);
- dioxus_desktop::launch_cfg(app, cfg);
+ LaunchBuilder::new(app).cfg(cfg);
}
const STYLE: &str = include_str!("./assets/calculator.css");
diff --git a/examples/pattern_reducer.rs b/examples/pattern_reducer.rs
index 4179bb849..cc685a8e1 100644
--- a/examples/pattern_reducer.rs
+++ b/examples/pattern_reducer.rs
@@ -8,7 +8,7 @@
use dioxus::prelude::*;
fn main() {
- dioxus_desktop::launch(app);
+ launch(app);
}
fn app() -> Element {
diff --git a/examples/read_size.rs b/examples/read_size.rs
index 3f13d1c11..9d1b878cc 100644
--- a/examples/read_size.rs
+++ b/examples/read_size.rs
@@ -4,8 +4,7 @@ use std::rc::Rc;
use dioxus::{html::geometry::euclid::Rect, prelude::*};
fn main() {
- dioxus_desktop::launch_cfg(
- app,
+ LaunchBuilder::new(app).cfg(
dioxus_desktop::Config::default().with_custom_head(
r#"