diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6ff2b1e9c..7d9415bca 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -40,4 +40,4 @@ jobs: - uses: actions-rs/cargo@v1 with: command: test - args: --features "desktop, ssr, router" + args: --all --tests diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 228e83f11..1ebe08005 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: check + args: --all --examples --tests test: if: github.event.pull_request.draft == false diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 961adee97..9b5204d1c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -71,6 +71,6 @@ jobs: rustc -Vv cargo -V set RUST_BACKTRACE=1 - cargo build --features "desktop, ssr, router" - cargo test --features "desktop, ssr, router" + cargo build --all --tests --examples + cargo test --all --tests shell: cmd diff --git a/Cargo.toml b/Cargo.toml index 3c3f78b7e..31a89c5bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,61 +1,10 @@ -[package] -name = "dioxus" -version = "0.2.4" -authors = ["Jonathan Kelley"] -edition = "2021" -description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences" -license = "MIT OR Apache-2.0" -repository = "https://github.com/DioxusLabs/dioxus/" -homepage = "https://dioxuslabs.com" -documentation = "https://dioxuslabs.com" -keywords = ["dom", "ui", "gui", "react", "wasm"] -rust-version = "1.60.0" - -[dependencies] -dioxus-core = { path = "./packages/core", version = "^0.2.1" } -dioxus-html = { path = "./packages/html", version = "^0.2.1", optional = true } -dioxus-core-macro = { path = "./packages/core-macro", version = "^0.2.1", optional = true } -dioxus-hooks = { path = "./packages/hooks", version = "^0.2.1", optional = true } -fermi = { path = "./packages/fermi", version = "^0.2.1", optional = true } - -dioxus-web = { path = "./packages/web", version = "^0.2.1", optional = true } -dioxus-desktop = { path = "./packages/desktop", version = "^0.2.3", optional = true } -dioxus-ssr = { path = "./packages/ssr", version = "^0.2.1", optional = true } - -dioxus-router = { path = "./packages/router", version = "^0.2.3", optional = true } -dioxus-interpreter-js = { path = "./packages/interpreter", version = "^0.2.1", optional = true } -dioxus-tui = { path = "./packages/tui", version = "^0.2.2", optional = true } - -dioxus-rsx = { path = "./packages/rsx", optional = true } -dioxus-rsx-interpreter = { path = "./packages/rsx_interpreter", optional = true } -dioxus-liveview = { path = "./packages/liveview", version = "^0.1.0", optional = true } - -dioxus-native-core = { path = "./packages/native-core", version = "^0.2.0", optional = true } -dioxus-native-core-macro = { path = "./packages/native-core-macro", version = "^0.2.0", optional = true } - -# dioxus-mobile = { path = "./packages/mobile", version = "^0.2.0", optional = true } -# dioxus-rsx = { path = "./packages/rsx", optional = true } -# macro = ["dioxus-core-macro", "dioxus-rsx"] - -[features] -default = ["macro", "hooks", "html"] - -macro = ["dioxus-core-macro", "dioxus-rsx"] -hooks = ["dioxus-hooks"] -html = ["dioxus-html"] -ssr = ["dioxus-ssr"] -web = ["dioxus-web", "dioxus-router?/web"] -desktop = ["dioxus-desktop"] -router = ["dioxus-router"] -tui = ["dioxus-tui"] -liveview = ["dioxus-liveview"] -hot-reload = ["dioxus-core-macro/hot-reload", "dioxus-rsx-interpreter", "dioxus-desktop?/hot-reload", "dioxus-web?/hot-reload", "dioxus-router?/hot-reload"] -native-core = ["dioxus-native-core", "dioxus-native-core-macro"] [workspace] members = [ + "packages/dioxus", "packages/core", "packages/core-macro", + "packages/router", "packages/html", "packages/hooks", "packages/web", @@ -71,11 +20,32 @@ members = [ "packages/rsx_interpreter", "packages/native-core", "packages/native-core-macro", - "packages/rsx-prelude", "docs/guide", ] + +# This is a "virtual package" +# It is not meant to be published, but is used so "cargo run --example XYZ" works properly +[package] +name = "dioxus-examples" +version = "0.0.0" +authors = ["Jonathan Kelley"] +edition = "2021" +description = "Top level crate for the Dioxus repository" +license = "MIT OR Apache-2.0" +repository = "https://github.com/DioxusLabs/dioxus/" +homepage = "https://dioxuslabs.com" +documentation = "https://dioxuslabs.com" +keywords = ["dom", "ui", "gui", "react", "wasm"] +rust-version = "1.60.0" + + [dev-dependencies] +dioxus = { path = "./packages/dioxus" } +dioxus-desktop = { path = "./packages/desktop" } +dioxus-ssr = { path = "./packages/ssr" } +dioxus-router = { path = "./packages/router" } +fermi = { path = "./packages/fermi" } futures-util = "0.3.21" log = "0.4.14" num-format = "0.4.0" @@ -87,21 +57,6 @@ serde_json = "1.0.79" rand = { version = "0.8.4", features = ["small_rng"] } tokio = { version = "1.16.1", features = ["full"] } reqwest = { version = "0.11.9", features = ["json"] } -dioxus = { path = ".", features = ["desktop", "ssr", "router", "fermi", "tui", "hot-reload"] } fern = { version = "0.6.0", features = ["colored"] } -criterion = "0.3.5" thiserror = "1.0.30" env_logger = "0.9.0" - - -[[bench]] -name = "create" -harness = false - -[[bench]] -name = "jsframework" -harness = false - -[[bench]] -name = "tui_update" -harness = false diff --git a/docs/guide/Cargo.toml b/docs/guide/Cargo.toml index 50edb6d7e..0f544e071 100644 --- a/docs/guide/Cargo.toml +++ b/docs/guide/Cargo.toml @@ -6,7 +6,16 @@ description = "Dioxus guide, including testable examples" license = "MIT/Apache-2.0" [dev-dependencies] -dioxus = { path = "../..", features = ["desktop", "web", "ssr", "router", "fermi", "tui"] } +dioxus = { path = "../../packages/dioxus" } +dioxus-desktop = { path = "../../packages/desktop" } +dioxus-web = { path = "../../packages/web" } +dioxus-ssr = { path = "../../packages/ssr" } +dioxus-router = { path = "../../packages/router" } +dioxus-tui = { path = "../../packages/tui" } +fermi = { path = "../../packages/fermi" } + + +# dioxus = { path = "../../packages/dioxus", features = ["desktop", "web", "ssr", "router", "fermi", "tui"] } serde = { version = "1.0.138", features=["derive"] } reqwest = { version = "0.11.11", features = ["json"] } -tokio = { version = "1.19.2" , features=[]} \ No newline at end of file +tokio = { version = "1.19.2" , features=[]} diff --git a/docs/guide/examples/boolean_attribute.rs b/docs/guide/examples/boolean_attribute.rs index f624de331..14a824b69 100644 --- a/docs/guide/examples/boolean_attribute.rs +++ b/docs/guide/examples/boolean_attribute.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/component_borrowed_props.rs b/docs/guide/examples/component_borrowed_props.rs index ed6beb1af..ee78a1824 100644 --- a/docs/guide/examples/component_borrowed_props.rs +++ b/docs/guide/examples/component_borrowed_props.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: App diff --git a/docs/guide/examples/component_children.rs b/docs/guide/examples/component_children.rs index 37ba59ba8..d13a6480d 100644 --- a/docs/guide/examples/component_children.rs +++ b/docs/guide/examples/component_children.rs @@ -3,7 +3,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/component_children_inspect.rs b/docs/guide/examples/component_children_inspect.rs index 1a239890f..d05a95a8b 100644 --- a/docs/guide/examples/component_children_inspect.rs +++ b/docs/guide/examples/component_children_inspect.rs @@ -3,7 +3,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/component_element_props.rs b/docs/guide/examples/component_element_props.rs index 86ff67bc7..b8fe98879 100644 --- a/docs/guide/examples/component_element_props.rs +++ b/docs/guide/examples/component_element_props.rs @@ -3,7 +3,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/component_owned_props.rs b/docs/guide/examples/component_owned_props.rs index 04fb6e2eb..3913f02c8 100644 --- a/docs/guide/examples/component_owned_props.rs +++ b/docs/guide/examples/component_owned_props.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: App diff --git a/docs/guide/examples/component_props_options.rs b/docs/guide/examples/component_props_options.rs index 28482e421..a32e65a33 100644 --- a/docs/guide/examples/component_props_options.rs +++ b/docs/guide/examples/component_props_options.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/components.rs b/docs/guide/examples/components.rs index 476eadc8d..85020c79c 100644 --- a/docs/guide/examples/components.rs +++ b/docs/guide/examples/components.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: App diff --git a/docs/guide/examples/conditional_rendering.rs b/docs/guide/examples/conditional_rendering.rs index 5dbadd29b..5a89ef4ed 100644 --- a/docs/guide/examples/conditional_rendering.rs +++ b/docs/guide/examples/conditional_rendering.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } pub fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/dangerous_inner_html.rs b/docs/guide/examples/dangerous_inner_html.rs index dafece034..f5f976e59 100644 --- a/docs/guide/examples/dangerous_inner_html.rs +++ b/docs/guide/examples/dangerous_inner_html.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/event_click.rs b/docs/guide/examples/event_click.rs index 457873d49..d6ccc0682 100644 --- a/docs/guide/examples/event_click.rs +++ b/docs/guide/examples/event_click.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/event_handler_prop.rs b/docs/guide/examples/event_handler_prop.rs index 4a9bbbb00..a333f86fe 100644 --- a/docs/guide/examples/event_handler_prop.rs +++ b/docs/guide/examples/event_handler_prop.rs @@ -4,7 +4,7 @@ use dioxus::events::MouseEvent; use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/event_nested.rs b/docs/guide/examples/event_nested.rs index 63096448e..512211707 100644 --- a/docs/guide/examples/event_nested.rs +++ b/docs/guide/examples/event_nested.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/event_prevent_default.rs b/docs/guide/examples/event_prevent_default.rs index f983400ae..120f74157 100644 --- a/docs/guide/examples/event_prevent_default.rs +++ b/docs/guide/examples/event_prevent_default.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/hello_world_desktop.rs b/docs/guide/examples/hello_world_desktop.rs index 373c1f9d6..91f0db03f 100644 --- a/docs/guide/examples/hello_world_desktop.rs +++ b/docs/guide/examples/hello_world_desktop.rs @@ -3,7 +3,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: component diff --git a/docs/guide/examples/hello_world_tui.rs b/docs/guide/examples/hello_world_tui.rs index f16751d71..ef9b7ec47 100644 --- a/docs/guide/examples/hello_world_tui.rs +++ b/docs/guide/examples/hello_world_tui.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::tui::launch(App); + dioxus_tui::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/hello_world_tui_no_ctrl_c.rs b/docs/guide/examples/hello_world_tui_no_ctrl_c.rs index addf43671..652d17752 100644 --- a/docs/guide/examples/hello_world_tui_no_ctrl_c.rs +++ b/docs/guide/examples/hello_world_tui_no_ctrl_c.rs @@ -3,16 +3,16 @@ use dioxus::events::{KeyCode, KeyboardEvent}; use dioxus::prelude::*; -use dioxus::tui::TuiContext; +use dioxus_tui::TuiContext; fn main() { - dioxus::tui::launch_cfg( + dioxus_tui::launch_cfg( App, - dioxus::tui::Config::new() + dioxus_tui::Config::new() .without_ctrl_c_quit() // Some older terminals only support 16 colors or ANSI colors // If your terminal is one of these, change this to BaseColors or ANSI - .with_rendering_mode(dioxus::tui::RenderingMode::Rgb), + .with_rendering_mode(dioxus_tui::RenderingMode::Rgb), ); } diff --git a/docs/guide/examples/hello_world_web.rs b/docs/guide/examples/hello_world_web.rs index a0547b8e5..5f813bbe1 100644 --- a/docs/guide/examples/hello_world_web.rs +++ b/docs/guide/examples/hello_world_web.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::web::launch(App); + dioxus_web::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/hooks_bad.rs b/docs/guide/examples/hooks_bad.rs index bb4a43c26..1503f11bd 100644 --- a/docs/guide/examples/hooks_bad.rs +++ b/docs/guide/examples/hooks_bad.rs @@ -4,7 +4,7 @@ use dioxus::prelude::*; use std::collections::HashMap; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/hooks_counter.rs b/docs/guide/examples/hooks_counter.rs index 3a858c3e8..f717ba650 100644 --- a/docs/guide/examples/hooks_counter.rs +++ b/docs/guide/examples/hooks_counter.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: component diff --git a/docs/guide/examples/hooks_counter_two_state.rs b/docs/guide/examples/hooks_counter_two_state.rs index 5ad534b33..75fcb9117 100644 --- a/docs/guide/examples/hooks_counter_two_state.rs +++ b/docs/guide/examples/hooks_counter_two_state.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: component diff --git a/docs/guide/examples/hooks_use_ref.rs b/docs/guide/examples/hooks_use_ref.rs index c03993561..8c06247ac 100644 --- a/docs/guide/examples/hooks_use_ref.rs +++ b/docs/guide/examples/hooks_use_ref.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: component diff --git a/docs/guide/examples/input_controlled.rs b/docs/guide/examples/input_controlled.rs index 955fe7ef5..b58fe58a7 100644 --- a/docs/guide/examples/input_controlled.rs +++ b/docs/guide/examples/input_controlled.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: component diff --git a/docs/guide/examples/input_uncontrolled.rs b/docs/guide/examples/input_uncontrolled.rs index 66b77769a..5adc4aaad 100644 --- a/docs/guide/examples/input_uncontrolled.rs +++ b/docs/guide/examples/input_uncontrolled.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: component diff --git a/docs/guide/examples/meme_editor.rs b/docs/guide/examples/meme_editor.rs index b8b6858d3..67bef123b 100644 --- a/docs/guide/examples/meme_editor.rs +++ b/docs/guide/examples/meme_editor.rs @@ -5,7 +5,7 @@ use dioxus::events::FormEvent; use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(MemeEditor); + dioxus_desktop::launch(MemeEditor); } // ANCHOR: meme_editor diff --git a/docs/guide/examples/meme_editor_dark_mode.rs b/docs/guide/examples/meme_editor_dark_mode.rs index ed7de16b8..6c58a540b 100644 --- a/docs/guide/examples/meme_editor_dark_mode.rs +++ b/docs/guide/examples/meme_editor_dark_mode.rs @@ -5,7 +5,7 @@ use dioxus::events::FormEvent; use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } // ANCHOR: DarkMode_struct diff --git a/docs/guide/examples/rendering_lists.rs b/docs/guide/examples/rendering_lists.rs index 49fd2b7e2..9e873979d 100644 --- a/docs/guide/examples/rendering_lists.rs +++ b/docs/guide/examples/rendering_lists.rs @@ -3,7 +3,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } #[derive(PartialEq, Clone)] diff --git a/docs/guide/examples/rsx_overview.rs b/docs/guide/examples/rsx_overview.rs index 124cf6ebc..8dc102e8a 100644 --- a/docs/guide/examples/rsx_overview.rs +++ b/docs/guide/examples/rsx_overview.rs @@ -3,7 +3,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } pub fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/spawn.rs b/docs/guide/examples/spawn.rs index 17dd259f7..9ba8e18ff 100644 --- a/docs/guide/examples/spawn.rs +++ b/docs/guide/examples/spawn.rs @@ -3,7 +3,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/examples/use_future.rs b/docs/guide/examples/use_future.rs index da52f8c63..445c8675a 100644 --- a/docs/guide/examples/use_future.rs +++ b/docs/guide/examples/use_future.rs @@ -3,7 +3,7 @@ use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } #[derive(serde::Deserialize, Debug)] diff --git a/docs/guide/src/en/__unused/advanced-guides/rsx.md b/docs/guide/src/en/__unused/advanced-guides/rsx.md index 062246490..7c6761493 100644 --- a/docs/guide/src/en/__unused/advanced-guides/rsx.md +++ b/docs/guide/src/en/__unused/advanced-guides/rsx.md @@ -33,7 +33,7 @@ let name = "jane"; let pending = false; let count = 10; -dioxus::ssr::render_lazy(html! { +dioxus_ssr::render_lazy(html! {
"Hello, {name}!"
"Status: {pending}!"
@@ -51,7 +51,7 @@ When helpful, the Dioxus VSCode extension provides a way of converting a selecti It's also a bit easier on the eyes than HTML. ```rust -dioxus::ssr::render_lazy(rsx! { +dioxus_ssr::render_lazy(rsx! { div { p {"Hello, {name}!"} p {"Status: {pending}!"} diff --git a/docs/guide/src/en/__unused/composing.md b/docs/guide/src/en/__unused/composing.md index 5746d6477..b344fe1a3 100644 --- a/docs/guide/src/en/__unused/composing.md +++ b/docs/guide/src/en/__unused/composing.md @@ -159,7 +159,7 @@ force_render(ScopeId(0)); In our guides, we frequently use the phrase "re-render" to describe updates to our app. You'll often hear this paired with "preventing unnecessary re-renders." But what exactly does this mean? -When we call `dioxus::desktop::launch`, Dioxus will create a new `Scope` object and call the component we gave it. Our `rsx!` calls will create new nodes which we return back to the VirtualDom. Dioxus will then look through these nodes for child components, call their functions, and so on until every component has been "rendered." We consider these nodes "rendered" because they were created because of our explicit actions. +When we call `dioxus_desktop::launch`, Dioxus will create a new `Scope` object and call the component we gave it. Our `rsx!` calls will create new nodes which we return back to the VirtualDom. Dioxus will then look through these nodes for child components, call their functions, and so on until every component has been "rendered." We consider these nodes "rendered" because they were created because of our explicit actions. The tree of UI that dioxus creates will roughly look like the tree of components presented earlier: diff --git a/docs/guide/src/en/__unused/event_javascript.rs b/docs/guide/src/en/__unused/event_javascript.rs index 2b0a60340..a0618129d 100644 --- a/docs/guide/src/en/__unused/event_javascript.rs +++ b/docs/guide/src/en/__unused/event_javascript.rs @@ -12,7 +12,7 @@ Instead of passing a closure, you can also pass a string to event handlers – t use dioxus::prelude::*; fn main() { - dioxus::desktop::launch(App); + dioxus_desktop::launch(App); } fn App(cx: Scope) -> Element { diff --git a/docs/guide/src/en/__unused/index.md b/docs/guide/src/en/__unused/index.md index 1732afdae..641611f52 100644 --- a/docs/guide/src/en/__unused/index.md +++ b/docs/guide/src/en/__unused/index.md @@ -16,7 +16,7 @@ For the simplest of apps, all of your state can enter the app from the root prop ```rust let all_content = get_all_content().await; -let output = dioxus::ssr::render_lazy(rsx!{ +let output = dioxus_ssr::render_lazy(rsx!{ div { RenderContent { content: all_content } } diff --git a/docs/guide/src/en/getting_started/mobile.md b/docs/guide/src/en/getting_started/mobile.md index 0dffdac30..25a276db5 100644 --- a/docs/guide/src/en/getting_started/mobile.md +++ b/docs/guide/src/en/getting_started/mobile.md @@ -24,7 +24,7 @@ cargo install --git https://github.com/BrainiumLLC/cargo-mobile And then initialize your app for the right platform. Use the `winit` template for now. Right now, there's no "Dioxus" template in cargo-mobile. ```shell -cargo mobile init +cargo mobile init ``` We're going to completely clear out the `dependencies` it generates for us, swapping out `winit` with `dioxus-mobile`. @@ -61,7 +61,7 @@ Edit your `lib.rs`: use dioxus::prelude::*; fn main() { - dioxus::mobile::launch(app); + dioxus_mobile::launch(app); } fn app(cx: Scope) -> Element { diff --git a/docs/guide/src/en/getting_started/ssr.md b/docs/guide/src/en/getting_started/ssr.md index 0b6ca0701..0e17c2c70 100644 --- a/docs/guide/src/en/getting_started/ssr.md +++ b/docs/guide/src/en/getting_started/ssr.md @@ -21,10 +21,10 @@ If you just want to render `rsx!` or a VirtualDom to HTML, check out the API doc // We can render VirtualDoms let mut vdom = VirtualDom::new(app); let _ = vdom.rebuild(); -println!("{}", dioxus::ssr::render_vdom(&vdom)); +println!("{}", dioxus_ssr::render_vdom(&vdom)); // Or we can render rsx! calls directly -println!( "{}", dioxus::ssr::render_lazy(rsx! { h1 { "Hello, world!" } } ); +println!( "{}", dioxus_ssr::render_lazy(rsx! { h1 { "Hello, world!" } } ); ``` However, for this guide, we're going to show how to use Dioxus SSR with `Axum`. @@ -84,7 +84,7 @@ And then add our endpoint. We can either render `rsx!` directly: ```rust async fn app_endpoint() -> Html, props: P) -> VirtualDom {
- const IS_LOGGING_ENABLED: bool = false;
- test_logging::set_up_logging(IS_LOGGING_ENABLED);
VirtualDom::new_with_props(app, props)
}
diff --git a/tests/diffing.rs b/packages/dioxus/tests/diffing.rs
similarity index 98%
rename from tests/diffing.rs
rename to packages/dioxus/tests/diffing.rs
index 3cc010673..21a9d4f38 100644
--- a/tests/diffing.rs
+++ b/packages/dioxus/tests/diffing.rs
@@ -8,11 +8,7 @@
use dioxus::prelude::*;
-mod test_logging;
-
fn new_dom() -> VirtualDom {
- const IS_LOGGING_ENABLED: bool = false;
- test_logging::set_up_logging(IS_LOGGING_ENABLED);
VirtualDom::new(|cx| rsx!(cx, "hi"))
}
@@ -224,7 +220,7 @@ fn two_fragments_with_differrent_elements_are_differet() {
);
let (_create, changes) = dom.diff_lazynodes(left, right);
- log::trace!("{:#?}", &changes);
+ println!("{:#?}", &changes);
assert_eq!(
changes.edits,
[
@@ -360,7 +356,7 @@ fn keyed_diffing_out_of_order() {
});
let (_, changes) = dom.diff_lazynodes(left, right);
- log::trace!("{:?}", &changes);
+ println!("{:?}", &changes);
assert_eq!(
changes.edits,
[PushRoot { root: 7 }, InsertBefore { root: 5, n: 1 }]
@@ -546,7 +542,7 @@ fn keyed_diffing_additions_and_moves_on_ends() {
});
let (_, change) = dom.diff_lazynodes(left, right);
- log::trace!("{:?}", change);
+ println!("{:?}", change);
assert_eq!(
change.edits,
[
@@ -579,7 +575,7 @@ fn keyed_diffing_additions_and_moves_in_middle() {
// LIS: 4, 5, 6
let (_, change) = dom.diff_lazynodes(left, right);
- log::trace!("{:#?}", change);
+ println!("{:#?}", change);
assert_eq!(
change.edits,
[
@@ -616,7 +612,7 @@ fn controlled_keyed_diffing_out_of_order() {
// LIS: 5, 6
let (_, changes) = dom.diff_lazynodes(left, right);
- log::trace!("{:#?}", &changes);
+ println!("{:#?}", &changes);
assert_eq!(
changes.edits,
[
@@ -653,7 +649,7 @@ fn controlled_keyed_diffing_out_of_order_max_test() {
});
let (_, changes) = dom.diff_lazynodes(left, right);
- log::trace!("{:#?}", &changes);
+ println!("{:#?}", &changes);
assert_eq!(
changes.edits,
[
diff --git a/tests/earlyabort.rs b/packages/dioxus/tests/earlyabort.rs
similarity index 95%
rename from tests/earlyabort.rs
rename to packages/dioxus/tests/earlyabort.rs
index e0a698bb8..3de5e2f9c 100644
--- a/tests/earlyabort.rs
+++ b/packages/dioxus/tests/earlyabort.rs
@@ -7,13 +7,11 @@
use dioxus::prelude::*;
-mod test_logging;
use dioxus_core::{DomEdit::*, ScopeId};
const IS_LOGGING_ENABLED: bool = false;
fn new_dom , props: P) -> VirtualDom {
- test_logging::set_up_logging(IS_LOGGING_ENABLED);
VirtualDom::new_with_props(app, props)
}
diff --git a/tests/lifecycle.rs b/packages/dioxus/tests/lifecycle.rs
similarity index 97%
rename from tests/lifecycle.rs
rename to packages/dioxus/tests/lifecycle.rs
index 6961f3f02..6f85954ea 100644
--- a/tests/lifecycle.rs
+++ b/packages/dioxus/tests/lifecycle.rs
@@ -6,9 +6,6 @@ use dioxus::prelude::*;
use dioxus_core::DomEdit::*;
use std::sync::{Arc, Mutex};
-mod test_logging;
-
-const IS_LOGGING_ENABLED: bool = true;
type Shared , props: P) -> VirtualDom {
- test_logging::set_up_logging(IS_LOGGING_ENABLED);
VirtualDom::new_with_props(app, props)
}
diff --git a/tests/passthru.rs b/packages/dioxus/tests/passthru.rs
similarity index 95%
rename from tests/passthru.rs
rename to packages/dioxus/tests/passthru.rs
index ffe4648e2..730a6b93e 100644
--- a/tests/passthru.rs
+++ b/packages/dioxus/tests/passthru.rs
@@ -9,11 +9,7 @@
use dioxus::prelude::*;
-mod test_logging;
-
fn new_dom() -> VirtualDom {
- const IS_LOGGING_ENABLED: bool = false;
- test_logging::set_up_logging(IS_LOGGING_ENABLED);
VirtualDom::new(|cx| rsx!(cx, "hi"))
}
diff --git a/tests/scheduler.rs b/packages/dioxus/tests/scheduler.rs
similarity index 100%
rename from tests/scheduler.rs
rename to packages/dioxus/tests/scheduler.rs
diff --git a/tests/sharedstate.rs b/packages/dioxus/tests/sharedstate.rs
similarity index 99%
rename from tests/sharedstate.rs
rename to packages/dioxus/tests/sharedstate.rs
index e07baaaed..f3b6fabf3 100644
--- a/tests/sharedstate.rs
+++ b/packages/dioxus/tests/sharedstate.rs
@@ -5,8 +5,6 @@ use dioxus_core::{DomEdit, Mutations, SchedulerMsg, ScopeId};
use std::rc::Rc;
use DomEdit::*;
-mod test_logging;
-
#[test]
fn shared_state_test() {
struct MySharedState(&'static str);
diff --git a/tests/task.rs b/packages/dioxus/tests/task.rs
similarity index 100%
rename from tests/task.rs
rename to packages/dioxus/tests/task.rs
diff --git a/tests/vdom_rebuild.rs b/packages/dioxus/tests/vdom_rebuild.rs
similarity index 100%
rename from tests/vdom_rebuild.rs
rename to packages/dioxus/tests/vdom_rebuild.rs
diff --git a/packages/fermi/README.md b/packages/fermi/README.md
index ae89ea73c..f751adb2e 100644
--- a/packages/fermi/README.md
+++ b/packages/fermi/README.md
@@ -36,14 +36,14 @@ Fermi is a global state management solution for Dioxus that's as easy as `use_st
Inspired by atom-based state management solutions, all state in Fermi starts as an `atom`:
-```rust
+```rust, ignore
static NAME: Atom<&str> = |_| "Dioxus";
```
From anywhere in our app, we can read our the value of our atom:
-```rust
-fn NameCard(cx: Scope) -> Element {
+```rust, ignore
+fn NameCard(cx: Scope) -> Element {
let name = use_read(&cx, NAME);
cx.render(rsx!{ h1 { "Hello, {name}"} })
}
@@ -51,8 +51,8 @@ fn NameCard(cx: Scope) -> Element {
We can also set the value of our atom, also from anywhere in our app:
-```rust
-fn NameCard(cx: Scope) -> Element {
+```rust, ignore
+fn NameCard(cx: Scope) -> Element {
let set_name = use_set(&cx, NAME);
cx.render(rsx!{
button {
@@ -68,7 +68,7 @@ It's that simple!
## Installation
Fermi is currently under construction, so you have to use the `master` branch to get started.
-```rust
+```toml
[dependencies]
fermi = { git = "https://github.com/dioxuslabs/fermi" }
```
@@ -89,4 +89,4 @@ Broadly our feature set to required to be released includes:
- [ ] Support for Atom Families
- [ ] Support for memoized Selectors
- [ ] Support for memoized SelectorFamilies
-- [ ] Support for UseFermiCallback for access to fermi from async
+- [ ] Support for UseFermiCallback for access to fermi from async
diff --git a/packages/fermi/src/hooks/state.rs b/packages/fermi/src/hooks/state.rs
index b698bb3c3..41e4e8ab0 100644
--- a/packages/fermi/src/hooks/state.rs
+++ b/packages/fermi/src/hooks/state.rs
@@ -124,7 +124,7 @@ impl A header element
)
/// rsx!(h1 { "A header element" })
/// LazyNodes::new(|f| f.el(h1).children([f.text("A header element")]).finish())
@@ -201,7 +201,7 @@ builder_constructors! {
/// - The `` heading is usually a large bolded font.
///
/// # Usage
- /// ```
+ /// ```rust, ignore
/// html!(
A header element
)
/// rsx!(h2 { "A header element" })
/// LazyNodes::new(|f| f.el(h2).children([f.text("A header element")]).finish())
@@ -274,7 +274,7 @@ builder_constructors! {
/// Note: By default, browsers always place a line break before and after the