Trim off 150 deps for examples
This commit is contained in:
20 files changed
+297
-641
No files matched your search
Generated
+154
-538
File diff suppressed because it is too large.
Load diff
+9
-3
@@ -45,13 +45,13 @@ members = [
|
|||||||
"examples/tailwind",
|
"examples/tailwind",
|
||||||
"examples/PWA-example",
|
"examples/PWA-example",
|
||||||
"examples/query_segments_demo",
|
"examples/query_segments_demo",
|
||||||
"examples/openid_connect_demo",
|
# "examples/openid_connect_demo",
|
||||||
# Playwright tests
|
# Playwright tests
|
||||||
"playwright-tests/liveview",
|
"playwright-tests/liveview",
|
||||||
"playwright-tests/web",
|
"playwright-tests/web",
|
||||||
"playwright-tests/fullstack",
|
"playwright-tests/fullstack",
|
||||||
]
|
]
|
||||||
exclude = ["examples/mobile_demo"]
|
exclude = ["examples/mobile_demo", "packages/fermi", "examples/openid_connect_demo",]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
@@ -124,6 +124,9 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
|
|||||||
rust-version = "1.60.0"
|
rust-version = "1.60.0"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
manganis = { workspace = true, optional = true}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
dioxus = { workspace = true, features = ["desktop"] }
|
dioxus = { workspace = true, features = ["desktop"] }
|
||||||
dioxus-desktop = { workspace = true, features = ["transparent"] }
|
dioxus-desktop = { workspace = true, features = ["transparent"] }
|
||||||
@@ -144,7 +147,10 @@ reqwest = { version = "0.11.9", features = ["json"] }
|
|||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
simple_logger = "4.0.0"
|
simple_logger = "4.0.0"
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
manganis = { workspace = true }
|
|
||||||
tracing-subscriber = "0.3.17"
|
tracing-subscriber = "0.3.17"
|
||||||
http-range = "0.1.5"
|
http-range = "0.1.5"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = []
|
||||||
|
collect-assets = ["manganis"]
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ fn main() {
|
|||||||
.with_inner_size(LogicalSize::new(300.0, 525.0)),
|
.with_inner_size(LogicalSize::new(300.0, 525.0)),
|
||||||
);
|
);
|
||||||
|
|
||||||
LaunchBuilder::new(app).cfg(config).launch();
|
LaunchBuilder::desktop().cfg(config).launch(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
|
|||||||
+13
-9
@@ -5,13 +5,16 @@ use dioxus::prelude::*;
|
|||||||
use dioxus_desktop::Config;
|
use dioxus_desktop::Config;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app).cfg(
|
LaunchBuilder::new()
|
||||||
Config::new().with_custom_head("<style>body { background-color: red; }</style>".into()),
|
.cfg(
|
||||||
);
|
Config::new().with_custom_head("<style>body { background-color: red; }</style>".into()),
|
||||||
|
)
|
||||||
|
.launch(app);
|
||||||
|
|
||||||
LaunchBuilder::new(app).cfg(
|
LaunchBuilder::new()
|
||||||
Config::new().with_custom_index(
|
.cfg(
|
||||||
r#"
|
Config::new().with_custom_index(
|
||||||
|
r#"
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@@ -24,9 +27,10 @@ fn main() {
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
"#
|
"#
|
||||||
.into(),
|
.into(),
|
||||||
),
|
),
|
||||||
);
|
)
|
||||||
|
.launch(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ use dioxus::prelude::*;
|
|||||||
use dioxus_desktop::{Config, WindowBuilder};
|
use dioxus_desktop::{Config, WindowBuilder};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app)
|
LaunchBuilder::new()
|
||||||
.cfg(Config::new().with_window(WindowBuilder::new().with_resizable(true)))
|
.cfg(Config::new().with_window(WindowBuilder::new().with_resizable(true)))
|
||||||
.launch_desktop()
|
.launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
const _STYLE: &str = manganis::mg!(file("./examples/assets/fileexplorer.css"));
|
const _STYLE: &str = manganis::mg!(file("./examples/assets/fileexplorer.css"));
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ use dioxus::prelude::*;
|
|||||||
use dioxus_desktop::Config;
|
use dioxus_desktop::Config;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app)
|
LaunchBuilder::desktop()
|
||||||
.cfg(Config::new().with_file_drop_handler(|_w, e| {
|
.cfg(Config::new().with_file_drop_handler(|_w, e| {
|
||||||
println!("{e:?}");
|
println!("{e:?}");
|
||||||
true
|
true
|
||||||
}))
|
}))
|
||||||
.launch_desktop()
|
.launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
|
|||||||
+13
-13
@@ -5,19 +5,19 @@ use dioxus_router::prelude::*;
|
|||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
LaunchBuilder::new(|| {
|
LaunchBuilder::desktop()
|
||||||
rsx! {
|
.cfg(
|
||||||
Router::<Route> {}
|
Config::new().with_window(
|
||||||
}
|
WindowBuilder::new()
|
||||||
})
|
.with_inner_size(LogicalSize::new(600, 1000))
|
||||||
.cfg(
|
.with_resizable(false),
|
||||||
Config::new().with_window(
|
),
|
||||||
WindowBuilder::new()
|
)
|
||||||
.with_inner_size(LogicalSize::new(600, 1000))
|
.launch(|| {
|
||||||
.with_resizable(false),
|
rsx! {
|
||||||
),
|
Router::<Route> {}
|
||||||
)
|
}
|
||||||
.launch_desktop()
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Routable, Clone)]
|
#[derive(Routable, Clone)]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use dioxus::prelude::*;
|
|||||||
use dioxus_desktop::Config;
|
use dioxus_desktop::Config;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app)
|
LaunchBuilder::desktop()
|
||||||
.cfg(Config::new().with_prerendered({
|
.cfg(Config::new().with_prerendered({
|
||||||
// We build the dom a first time, then pre-render it to HTML
|
// We build the dom a first time, then pre-render it to HTML
|
||||||
let pre_rendered_dom = VirtualDom::prebuilt(app);
|
let pre_rendered_dom = VirtualDom::prebuilt(app);
|
||||||
@@ -21,7 +21,7 @@ fn main() {
|
|||||||
// We then launch the app with the pre-rendered HTML
|
// We then launch the app with the pre-rendered HTML
|
||||||
dioxus_ssr::pre_render(&pre_rendered_dom)
|
dioxus_ssr::pre_render(&pre_rendered_dom)
|
||||||
}))
|
}))
|
||||||
.launch_desktop();
|
.launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ pub fn main() -> Result<()> {
|
|||||||
|
|
||||||
// Right now we're going through dioxus-desktop but we'd like to go through dioxus-mobile
|
// 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
|
// That will seed the index.html with some fixes that prevent the page from scrolling/zooming etc
|
||||||
LaunchBuilder::new(app).cfg(
|
LaunchBuilder::new().cfg(
|
||||||
// Note that we have to disable the viewport goofiness of the browser.
|
// Note that we have to disable the viewport goofiness of the browser.
|
||||||
// Dioxus_mobile should do this for us
|
// Dioxus_mobile should do this for us
|
||||||
Config::default().with_custom_index(include_str!("index.html").to_string()),
|
Config::default().with_custom_index(include_str!("index.html").to_string()),
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ use dioxus::prelude::*;
|
|||||||
use dioxus_desktop::{tao::dpi::PhysicalPosition, LogicalSize, WindowBuilder};
|
use dioxus_desktop::{tao::dpi::PhysicalPosition, LogicalSize, WindowBuilder};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app).cfg(make_config());
|
LaunchBuilder::new().cfg(make_config());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ fn main() {
|
|||||||
.with_inner_size(LogicalSize::new(320.0, 530.0)),
|
.with_inner_size(LogicalSize::new(320.0, 530.0)),
|
||||||
);
|
);
|
||||||
|
|
||||||
LaunchBuilder::new(app).cfg(cfg);
|
LaunchBuilder::new().cfg(cfg).launch(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
const STYLE: &str = include_str!("./assets/calculator.css");
|
const STYLE: &str = include_str!("./assets/calculator.css");
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use std::rc::Rc;
|
|||||||
use dioxus::{html::geometry::euclid::Rect, prelude::*};
|
use dioxus::{html::geometry::euclid::Rect, prelude::*};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app).cfg(
|
LaunchBuilder::new().cfg(
|
||||||
dioxus_desktop::Config::default().with_custom_head(
|
dioxus_desktop::Config::default().with_custom_head(
|
||||||
r#"
|
r#"
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use dioxus::prelude::*;
|
|||||||
use dioxus_desktop::{Config, LogicalSize, WindowBuilder};
|
use dioxus_desktop::{Config, LogicalSize, WindowBuilder};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app)
|
LaunchBuilder::desktop()
|
||||||
.cfg(
|
.cfg(
|
||||||
Config::new().with_window(
|
Config::new().with_window(
|
||||||
WindowBuilder::new()
|
WindowBuilder::new()
|
||||||
@@ -25,7 +25,7 @@ fn main() {
|
|||||||
.with_inner_size(LogicalSize::new(600.0, 800.0)),
|
.with_inner_size(LogicalSize::new(600.0, 800.0)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.launch_desktop()
|
.launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use dioxus::prelude::*;
|
|||||||
use dioxus_desktop::{window, Config, WindowBuilder};
|
use dioxus_desktop::{window, Config, WindowBuilder};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app)
|
LaunchBuilder::desktop()
|
||||||
.cfg(
|
.cfg(
|
||||||
Config::new().with_window(
|
Config::new().with_window(
|
||||||
WindowBuilder::new()
|
WindowBuilder::new()
|
||||||
@@ -10,7 +10,7 @@ fn main() {
|
|||||||
.with_decorations(false),
|
.with_decorations(false),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.launch_desktop()
|
.launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ use dioxus_desktop::use_wry_event_handler;
|
|||||||
use dioxus_desktop::{Config, WindowCloseBehaviour};
|
use dioxus_desktop::{Config, WindowCloseBehaviour};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new(app)
|
LaunchBuilder::new()
|
||||||
.cfg(Config::new().with_close_behaviour(WindowCloseBehaviour::CloseWindow))
|
.cfg(Config::new().with_close_behaviour(WindowCloseBehaviour::CloseWindow))
|
||||||
.launch_desktop()
|
.launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ pub fn launch_virtual_dom(virtual_dom: VirtualDom, desktop_config: Config) {
|
|||||||
/// Launches the WebView and runs the event loop, with configuration and root props.
|
/// Launches the WebView and runs the event loop, with configuration and root props.
|
||||||
pub fn launch(
|
pub fn launch(
|
||||||
root: fn() -> Element,
|
root: fn() -> Element,
|
||||||
contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send>>,
|
contexts: Vec<Box<dyn Fn() -> Box<dyn Any>>>,
|
||||||
platform_config: Config,
|
platform_config: Config,
|
||||||
) {
|
) {
|
||||||
let mut virtual_dom = VirtualDom::new(root);
|
let mut virtual_dom = VirtualDom::new(root);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ dioxus-rsx = { workspace = true, optional = true }
|
|||||||
dioxus-signals = { workspace = true, optional = true }
|
dioxus-signals = { workspace = true, optional = true }
|
||||||
dioxus-router = { workspace = true, optional = true }
|
dioxus-router = { workspace = true, optional = true }
|
||||||
dioxus-web = { workspace = true, optional = true }
|
dioxus-web = { workspace = true, optional = true }
|
||||||
|
dioxus-mobile = { workspace = true, optional = true }
|
||||||
dioxus-desktop = { workspace = true, optional = true }
|
dioxus-desktop = { workspace = true, optional = true }
|
||||||
dioxus-fullstack = { workspace = true, optional = true }
|
dioxus-fullstack = { workspace = true, optional = true }
|
||||||
dioxus-liveview = { workspace = true, optional = true }
|
dioxus-liveview = { workspace = true, optional = true }
|
||||||
@@ -44,6 +45,7 @@ router = ["dioxus-router"]
|
|||||||
# Platforms
|
# Platforms
|
||||||
fullstack = ["dioxus-fullstack", "dioxus-config-macro/fullstack", "serde"]
|
fullstack = ["dioxus-fullstack", "dioxus-config-macro/fullstack", "serde"]
|
||||||
desktop = ["dioxus-desktop", "dioxus-fullstack?/desktop", "dioxus-config-macro/desktop"]
|
desktop = ["dioxus-desktop", "dioxus-fullstack?/desktop", "dioxus-config-macro/desktop"]
|
||||||
|
mobile = ["dioxus-mobile", "dioxus-fullstack?/desktop", "dioxus-config-macro/desktop"] # todo: use the mobile versions of these
|
||||||
web = ["dioxus-web", "dioxus-fullstack?/web", "dioxus-config-macro/web"]
|
web = ["dioxus-web", "dioxus-fullstack?/web", "dioxus-config-macro/web"]
|
||||||
ssr = ["dioxus-fullstack?/ssr", "dioxus-config-macro/ssr"]
|
ssr = ["dioxus-fullstack?/ssr", "dioxus-config-macro/ssr"]
|
||||||
liveview = ["dioxus-desktop", "dioxus-config-macro/liveview"]
|
liveview = ["dioxus-desktop", "dioxus-config-macro/liveview"]
|
||||||
|
|||||||
@@ -1,35 +1,96 @@
|
|||||||
//! Launch helper macros for fullstack apps
|
//! Launch helper macros for fullstack apps
|
||||||
|
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
use dioxus_core::AnyProps;
|
||||||
use dioxus_core::VProps;
|
use dioxus_core::VProps;
|
||||||
use dioxus_core::{ AnyProps};
|
|
||||||
|
|
||||||
/// A builder for a fullstack app.
|
/// A builder for a fullstack app.
|
||||||
pub struct LaunchBuilder {
|
pub struct LaunchBuilder<Cfg = ()> {
|
||||||
cross_platform_config: fn() -> Element,
|
launch_fn: LaunchFn<Cfg>,
|
||||||
#[cfg(feature = "fullstack")]
|
contexts: ContextList,
|
||||||
contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>,
|
platform_config: Option<Cfg>,
|
||||||
#[cfg(not(feature = "fullstack"))]
|
|
||||||
contexts: Vec<Box<dyn Fn() -> Box<dyn Any>>>,
|
|
||||||
platform_config: Option<current_platform::Config>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fullstack platform builder
|
pub type LaunchFn<Cfg> = fn(fn() -> Element, ContextList, Cfg);
|
||||||
|
|
||||||
|
#[cfg(feature = "fullstack")]
|
||||||
|
type ContextList = Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>;
|
||||||
|
#[cfg(not(feature = "fullstack"))]
|
||||||
|
type ContextList = Vec<Box<dyn Fn() -> Box<dyn Any>>>;
|
||||||
|
|
||||||
impl LaunchBuilder {
|
impl LaunchBuilder {
|
||||||
/// Create a new builder for your application. This will create a launch configuration for the current platform based on the features enabled on the `dioxus` crate.
|
/// Create a new builder for your application. This will create a launch configuration for the current platform based on the features enabled on the `dioxus` crate.
|
||||||
pub fn new(component: fn() -> Element) -> Self {
|
pub fn new() -> LaunchBuilder<current_platform::Config> {
|
||||||
Self {
|
LaunchBuilder {
|
||||||
cross_platform_config: component,
|
launch_fn: current_platform::launch,
|
||||||
contexts: Vec::new(),
|
contexts: Vec::new(),
|
||||||
platform_config: None,
|
platform_config: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Launch your web application.
|
||||||
|
#[cfg(feature = "web")]
|
||||||
|
pub fn web() -> LaunchBuilder<dioxus_web::Config> {
|
||||||
|
LaunchBuilder {
|
||||||
|
launch_fn: dioxus_web::launch::launch,
|
||||||
|
contexts: Vec::new(),
|
||||||
|
platform_config: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Launch your desktop application.
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
|
pub fn desktop() -> LaunchBuilder<dioxus_desktop::Config> {
|
||||||
|
LaunchBuilder {
|
||||||
|
launch_fn: dioxus_desktop::launch::launch,
|
||||||
|
contexts: Vec::new(),
|
||||||
|
platform_config: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Launch your fullstack application.
|
||||||
|
#[cfg(feature = "fullstack")]
|
||||||
|
pub fn fullstack() -> LaunchBuilder<dioxus_fullstack::Config> {
|
||||||
|
LaunchBuilder {
|
||||||
|
launch_fn: dioxus_fullstack::launch::launch,
|
||||||
|
contexts: Vec::new(),
|
||||||
|
platform_config: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Launch your fullstack application.
|
||||||
|
#[cfg(feature = "mobile")]
|
||||||
|
pub fn mobile() -> LaunchBuilder<dioxus_mobile::Config> {
|
||||||
|
LaunchBuilder {
|
||||||
|
launch_fn: dioxus_mobile::launch::launch,
|
||||||
|
contexts: Vec::new(),
|
||||||
|
platform_config: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Provide a custom launch function for your application.
|
||||||
|
///
|
||||||
|
/// Useful for third party renderers to tap into the launch builder API without having to reimplement it.
|
||||||
|
pub fn custom<Cfg>(launch_fn: LaunchFn<Cfg>) -> LaunchBuilder<Cfg> {
|
||||||
|
LaunchBuilder {
|
||||||
|
launch_fn,
|
||||||
|
contexts: Vec::new(),
|
||||||
|
platform_config: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fullstack platform builder
|
||||||
|
impl<Cfg: Default> LaunchBuilder<Cfg> {
|
||||||
#[cfg(feature = "fullstack")]
|
#[cfg(feature = "fullstack")]
|
||||||
/// Inject state into the root component's context that is created on the thread that the app is launched on.
|
/// Inject state into the root component's context that is created on the thread that the app is launched on.
|
||||||
pub fn context_provider(mut self, state: impl Fn() -> Box<dyn Any> + Send + Sync + 'static) -> Self {
|
pub fn context_provider(
|
||||||
|
mut self,
|
||||||
|
state: impl Fn() -> Box<dyn Any> + Send + Sync + 'static,
|
||||||
|
) -> Self {
|
||||||
self.contexts
|
self.contexts
|
||||||
.push(Box::new(state) as Box<dyn Fn() -> Box<dyn Any> + Send + Sync>);
|
.push(Box::new(state) as Box<dyn Fn() -> Box<dyn Any> + Send + Sync>);
|
||||||
self
|
self
|
||||||
@@ -60,51 +121,17 @@ impl LaunchBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Provide a platform-specific config to the builder.
|
/// Provide a platform-specific config to the builder.
|
||||||
pub fn cfg(mut self, config: impl Into<Option<current_platform::Config>>) -> Self {
|
pub fn cfg(mut self, config: impl Into<Option<Cfg>>) -> Self {
|
||||||
if let Some(config) = config.into() {
|
if let Some(config) = config.into() {
|
||||||
self.platform_config = Some(config);
|
self.platform_config = Some(config);
|
||||||
}
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "web")]
|
|
||||||
/// Launch your web application.
|
|
||||||
pub fn launch_web(self) {
|
|
||||||
dioxus_web::launch::launch(
|
|
||||||
self.cross_platform_config,
|
|
||||||
Default::default(),
|
|
||||||
Default::default(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Launch your desktop application.
|
|
||||||
#[cfg(feature = "desktop")]
|
|
||||||
pub fn launch_desktop(self) {
|
|
||||||
dioxus_desktop::launch::launch(
|
|
||||||
self.cross_platform_config,
|
|
||||||
Default::default(),
|
|
||||||
Default::default(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Launch your fullstack application.
|
|
||||||
#[cfg(feature = "fullstack")]
|
|
||||||
pub fn launch_fullstack(self) {
|
|
||||||
dioxus_fullstack::launch::launch(
|
|
||||||
self.cross_platform_config,
|
|
||||||
Default::default(),
|
|
||||||
Default::default(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(clippy::unit_arg)]
|
#[allow(clippy::unit_arg)]
|
||||||
/// Launch the app.
|
/// Launch the app.
|
||||||
pub fn launch(self) {
|
pub fn launch(self, app: fn() -> Element) {
|
||||||
current_platform::launch(
|
(self.launch_fn)(app, self.contexts, self.platform_config.unwrap_or_default());
|
||||||
self.cross_platform_config,
|
|
||||||
Default::default(),
|
|
||||||
self.platform_config.unwrap_or_default(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,31 +147,31 @@ mod current_platform {
|
|||||||
#[cfg(not(any(feature = "desktop", feature = "web", feature = "fullstack")))]
|
#[cfg(not(any(feature = "desktop", feature = "web", feature = "fullstack")))]
|
||||||
pub fn launch(
|
pub fn launch(
|
||||||
root: fn() -> dioxus_core::Element,
|
root: fn() -> dioxus_core::Element,
|
||||||
contexts: Vec<Box<dyn Fn() -> Box<dyn std::any::Any> + Send + Sync>>,
|
contexts: super::ContextList,
|
||||||
platform_config: Config,
|
platform_config: Config,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Launch your application without any additional configuration. See [`LaunchBuilder`] for more options.
|
/// Launch your application without any additional configuration. See [`LaunchBuilder`] for more options.
|
||||||
pub fn launch(component: fn() -> Element) {
|
pub fn launch(app: fn() -> Element) {
|
||||||
LaunchBuilder::new(component).launch()
|
LaunchBuilder::new().launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "web", not(feature = "fullstack")))]
|
#[cfg(all(feature = "web", not(feature = "fullstack")))]
|
||||||
/// Launch your web application without any additional configuration. See [`LaunchBuilder`] for more options.
|
/// Launch your web application without any additional configuration. See [`LaunchBuilder`] for more options.
|
||||||
pub fn launch_web(component: fn() -> Element) {
|
pub fn launch_web(app: fn() -> Element) {
|
||||||
LaunchBuilder::new(component).launch_web()
|
LaunchBuilder::web().launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "desktop", not(feature = "fullstack")))]
|
#[cfg(all(feature = "desktop", not(feature = "fullstack")))]
|
||||||
/// Launch your desktop application without any additional configuration. See [`LaunchBuilder`] for more options.
|
/// Launch your desktop application without any additional configuration. See [`LaunchBuilder`] for more options.
|
||||||
pub fn launch_desktop(component: fn() -> Element) {
|
pub fn launch_desktop(app: fn() -> Element) {
|
||||||
LaunchBuilder::new(component).launch_desktop()
|
LaunchBuilder::desktop().launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "fullstack")]
|
#[cfg(feature = "fullstack")]
|
||||||
/// Launch your fullstack application without any additional configuration. See [`LaunchBuilder`] for more options.
|
/// Launch your fullstack application without any additional configuration. See [`LaunchBuilder`] for more options.
|
||||||
pub fn launch_fullstack(component: fn() -> Element) {
|
pub fn launch_fullstack(app: fn() -> Element) {
|
||||||
LaunchBuilder::new(component).launch_fullstack()
|
LaunchBuilder::fullstack().launch(app)
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ pub static COMMON_JS: &str = include_str!("./common.js");
|
|||||||
|
|
||||||
#[cfg(feature = "sledgehammer")]
|
#[cfg(feature = "sledgehammer")]
|
||||||
mod sledgehammer_bindings;
|
mod sledgehammer_bindings;
|
||||||
|
|
||||||
#[cfg(feature = "sledgehammer")]
|
#[cfg(feature = "sledgehammer")]
|
||||||
pub use sledgehammer_bindings::*;
|
pub use sledgehammer_bindings::*;
|
||||||
|
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ pub mod binary_protocol {
|
|||||||
}
|
}
|
||||||
node.setAttribute('data-dioxus-id', `\${id}`);
|
node.setAttribute('data-dioxus-id', `\${id}`);
|
||||||
const event_name = $event$;
|
const event_name = $event$;
|
||||||
|
|
||||||
// if this is a mounted listener, we send the event immediately
|
// if this is a mounted listener, we send the event immediately
|
||||||
if (event_name === "mounted") {
|
if (event_name === "mounted") {
|
||||||
window.ipc.postMessage(
|
window.ipc.postMessage(
|
||||||
|
|||||||
Reference in new issue
Block a user