Re-Export Manganis & Update Examples (#2625)
* feat: export manganis * revision: use manganis in examples * fix: manganis dep * fix: workspace root finder * fix: manganis dep * fix: ci
This commit is contained in:
1 parent
856fadc9d6
commit
672f4dfefc
23 files changed
+154
-134
No files matched your search
Generated
+53
-69
@@ -697,9 +697,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-lc-rs"
|
name = "aws-lc-rs"
|
||||||
version = "1.8.0"
|
version = "1.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a8a47f2fb521b70c11ce7369a6c5fa4bd6af7e5d62ec06303875bafe7c6ba245"
|
checksum = "4ae74d9bd0a7530e8afd1770739ad34b36838829d6ad61818f9230f683f5ad77"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-sys",
|
"aws-lc-sys",
|
||||||
"mirai-annotations",
|
"mirai-annotations",
|
||||||
@@ -709,9 +709,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-lc-sys"
|
name = "aws-lc-sys"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2927c7af777b460b7ccd95f8b67acd7b4c04ec8896bf0c8e80ba30523cffc057"
|
checksum = "2e89b6941c2d1a7045538884d6e760ccfffdf8e1ffc2613d8efa74305e1f3752"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
"cc",
|
"cc",
|
||||||
@@ -1408,9 +1408,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cargo_toml"
|
name = "cargo_toml"
|
||||||
version = "0.20.3"
|
version = "0.20.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4895c018bb228aa6b3ba1a0285543fcb4b704734c3fb1f72afaa75aa769500c1"
|
checksum = "ad639525b1c67b6a298f378417b060fbc04618bea559482a8484381cce27d965"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"toml 0.8.15",
|
"toml 0.8.15",
|
||||||
@@ -1439,9 +1439,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.5"
|
version = "1.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052"
|
checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -2444,6 +2444,7 @@ dependencies = [
|
|||||||
"dioxus-web",
|
"dioxus-web",
|
||||||
"env_logger 0.10.2",
|
"env_logger 0.10.2",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"manganis",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
@@ -2578,22 +2579,6 @@ dependencies = [
|
|||||||
"quote",
|
"quote",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dioxus-core"
|
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "088daa3f45aaa729e9eef32dc0a9393dd709ee906b092089e5839cad1cad7c85"
|
|
||||||
dependencies = [
|
|
||||||
"futures-channel",
|
|
||||||
"futures-util",
|
|
||||||
"generational-box 0.5.1",
|
|
||||||
"longest-increasing-subsequence",
|
|
||||||
"rustc-hash",
|
|
||||||
"slab",
|
|
||||||
"tracing",
|
|
||||||
"tracing-subscriber",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dioxus-core"
|
name = "dioxus-core"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
@@ -2621,6 +2606,23 @@ dependencies = [
|
|||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dioxus-core"
|
||||||
|
version = "0.5.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3730d2459ab66951cedf10b09eb84141a6eda7f403c28057cbe010495be156b7"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-util",
|
||||||
|
"generational-box 0.5.6",
|
||||||
|
"longest-increasing-subsequence",
|
||||||
|
"rustc-hash",
|
||||||
|
"slab",
|
||||||
|
"slotmap",
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dioxus-core-macro"
|
name = "dioxus-core-macro"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
@@ -3945,15 +3947,6 @@ dependencies = [
|
|||||||
"x11",
|
"x11",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "generational-box"
|
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f132919c96b85c02a067ceae965fd50ace57111e2f55c7384b95ac191f4d966b"
|
|
||||||
dependencies = [
|
|
||||||
"parking_lot",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "generational-box"
|
name = "generational-box"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
@@ -3963,6 +3956,15 @@ dependencies = [
|
|||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generational-box"
|
||||||
|
version = "0.5.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "557cf2cbacd0504c6bf8c29f52f8071e0de1d9783346713dc6121d7fa1e5d0e0"
|
||||||
|
dependencies = [
|
||||||
|
"parking_lot",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "generic-array"
|
name = "generic-array"
|
||||||
version = "0.14.7"
|
version = "0.14.7"
|
||||||
@@ -4110,7 +4112,7 @@ dependencies = [
|
|||||||
"gix-utils",
|
"gix-utils",
|
||||||
"itoa 1.0.11",
|
"itoa 1.0.11",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"winnow 0.6.13",
|
"winnow 0.6.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4131,7 +4133,7 @@ dependencies = [
|
|||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"unicode-bom",
|
"unicode-bom",
|
||||||
"winnow 0.6.13",
|
"winnow 0.6.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4233,7 +4235,7 @@ dependencies = [
|
|||||||
"itoa 1.0.11",
|
"itoa 1.0.11",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"winnow 0.6.13",
|
"winnow 0.6.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4268,7 +4270,7 @@ dependencies = [
|
|||||||
"gix-validate",
|
"gix-validate",
|
||||||
"memmap2",
|
"memmap2",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"winnow 0.6.13",
|
"winnow 0.6.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5785,7 +5787,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
|
checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.48.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6040,23 +6042,22 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "manganis"
|
name = "manganis"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/DioxusLabs/manganis#8a6d74dc19072e7a650854bd722c452da51955d6"
|
||||||
checksum = "c211cfb4529c79b32307b606e83a1bb15d491b3b4a1ab97159b161d7af9d1b72"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dioxus-core 0.5.1",
|
"dioxus-core 0.5.6",
|
||||||
"manganis-macro",
|
"manganis-macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "manganis-cli-support"
|
name = "manganis-cli-support"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
source = "git+https://github.com/DioxusLabs/manganis/#ad09a549775957c5ce177274cfbb6dc76c976c10"
|
source = "git+https://github.com/DioxusLabs/manganis#8a6d74dc19072e7a650854bd722c452da51955d6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"image 0.25.1",
|
"image 0.25.1",
|
||||||
"imagequant",
|
"imagequant",
|
||||||
"lightningcss",
|
"lightningcss",
|
||||||
"manganis-common 0.2.4 (git+https://github.com/DioxusLabs/manganis/)",
|
"manganis-common",
|
||||||
"mozjpeg",
|
"mozjpeg",
|
||||||
"object",
|
"object",
|
||||||
"png",
|
"png",
|
||||||
@@ -6074,24 +6075,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "manganis-common"
|
name = "manganis-common"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/DioxusLabs/manganis#8a6d74dc19072e7a650854bd722c452da51955d6"
|
||||||
checksum = "542300f1e7d9313de5b7e5b92d273ba42ab547c068d773559d616aa14987de43"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"base64 0.21.7",
|
|
||||||
"home",
|
|
||||||
"infer 0.11.0",
|
|
||||||
"reqwest 0.11.27",
|
|
||||||
"serde",
|
|
||||||
"toml 0.7.8",
|
|
||||||
"tracing",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "manganis-common"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "git+https://github.com/DioxusLabs/manganis/#ad09a549775957c5ce177274cfbb6dc76c976c10"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.21.7",
|
"base64 0.21.7",
|
||||||
@@ -6107,12 +6091,12 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "manganis-macro"
|
name = "manganis-macro"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/DioxusLabs/manganis#8a6d74dc19072e7a650854bd722c452da51955d6"
|
||||||
checksum = "704a0123ac90fa630b21a04fde56c29dfd5a7665c5e8f3639567989daa2d29d1"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"manganis-common 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"manganis-common",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
"serde_json",
|
||||||
"syn 2.0.71",
|
"syn 2.0.71",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
]
|
]
|
||||||
@@ -7313,9 +7297,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portable-atomic"
|
name = "portable-atomic"
|
||||||
version = "1.6.0"
|
version = "1.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
|
checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "powerfmt"
|
name = "powerfmt"
|
||||||
@@ -9958,7 +9942,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"winnow 0.6.13",
|
"winnow 0.6.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -11270,9 +11254,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.6.13"
|
version = "0.6.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1"
|
checksum = "374ec40a2d767a3c1b4972d9475ecd557356637be906f2cb3f7fe17a6eb5e22f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|||||||
+2
-2
@@ -105,8 +105,8 @@ wasm-bindgen-futures = "0.4.42"
|
|||||||
html_parser = "0.7.0"
|
html_parser = "0.7.0"
|
||||||
thiserror = "1.0.40"
|
thiserror = "1.0.40"
|
||||||
prettyplease = { version = "0.2.16", features = ["verbatim"] }
|
prettyplease = { version = "0.2.16", features = ["verbatim"] }
|
||||||
manganis-cli-support = { git = "https://github.com/DioxusLabs/manganis/", features = ["html"] }
|
manganis-cli-support = { git = "hhttps://github.com/DioxusLabs/manganis", features = ["html"] }
|
||||||
manganis = { version = "0.2.1" }
|
manganis = { git = "https://github.com/DioxusLabs/manganis" }
|
||||||
const_format = "0.2.32"
|
const_format = "0.2.32"
|
||||||
cargo_toml = { version = "0.20.3" }
|
cargo_toml = { version = "0.20.3" }
|
||||||
tauri-utils = { version = "=1.5.*" }
|
tauri-utils = { version = "=1.5.*" }
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use std::{collections::VecDeque, fmt::Debug, rc::Rc};
|
use std::{collections::VecDeque, fmt::Debug, rc::Rc};
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/events.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch(app);
|
launch(app);
|
||||||
}
|
}
|
||||||
@@ -24,7 +26,7 @@ fn app() -> Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/events.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
div { id: "container",
|
div { id: "container",
|
||||||
// focusing is necessary to catch keyboard events
|
// focusing is necessary to catch keyboard events
|
||||||
div { id: "receiver", tabindex: 0,
|
div { id: "receiver", tabindex: 0,
|
||||||
|
|||||||
Whitespace-only changes.
@@ -12,6 +12,8 @@ use dioxus::events::*;
|
|||||||
use dioxus::html::input_data::keyboard_types::Key;
|
use dioxus::html::input_data::keyboard_types::Key;
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/calculator.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::desktop()
|
LaunchBuilder::desktop()
|
||||||
.with_cfg(desktop!({
|
.with_cfg(desktop!({
|
||||||
@@ -52,7 +54,7 @@ fn app() -> Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/calculator.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
div { id: "wrapper",
|
div { id: "wrapper",
|
||||||
div { class: "app",
|
div { class: "app",
|
||||||
div { class: "calculator", tabindex: "0", onkeydown: handle_key_down_event,
|
div { class: "calculator", tabindex: "0", onkeydown: handle_key_down_event,
|
||||||
|
|||||||
+3
-1
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/clock.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch_desktop(app);
|
launch_desktop(app);
|
||||||
}
|
}
|
||||||
@@ -36,7 +38,7 @@ fn app() -> Element {
|
|||||||
);
|
);
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/clock.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
div { id: "app",
|
div { id: "app",
|
||||||
div { id: "title", "Carpe diem 🎉" }
|
div { id: "title", "Carpe diem 🎉" }
|
||||||
div { id: "clock-display", "{time}" }
|
div { id: "clock-display", "{time}" }
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
//! This example shows how to manage focus in a Dioxus application. We implement a "roulette" that focuses on each input
|
//! This example shows how to manage focus in a Dioxus application. We implement a "roulette" that focuses on each input
|
||||||
//! in the grid every few milliseconds until the user interacts with the inputs.
|
//! in the grid every few milliseconds until the user interacts with the inputs.
|
||||||
|
|
||||||
|
use dioxus::prelude::*;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
const STYLE: &str = asset!(file("./examples/assets/roulette.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch_desktop(app);
|
launch_desktop(app);
|
||||||
@@ -37,7 +38,7 @@ fn app() -> Element {
|
|||||||
});
|
});
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/roulette.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
h1 { "Input Roulette" }
|
h1 { "Input Roulette" }
|
||||||
button { onclick: move |_| running.toggle(), "Toggle roulette" }
|
button { onclick: move |_| running.toggle(), "Toggle roulette" }
|
||||||
div { id: "roulette-grid",
|
div { id: "roulette-grid",
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/counter.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch(app);
|
launch(app);
|
||||||
}
|
}
|
||||||
@@ -14,7 +16,7 @@ fn app() -> Element {
|
|||||||
let sum = use_memo(move || counters.read().iter().copied().sum::<i32>());
|
let sum = use_memo(move || counters.read().iter().copied().sum::<i32>());
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/counter.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
|
|
||||||
div { id: "controls",
|
div { id: "controls",
|
||||||
button { onclick: move |_| counters.write().push(0), "Add counter" }
|
button { onclick: move |_| counters.write().push(0), "Add counter" }
|
||||||
|
|||||||
+3
-1
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/crm.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
LaunchBuilder::new()
|
LaunchBuilder::new()
|
||||||
.with_cfg(desktop!({
|
.with_cfg(desktop!({
|
||||||
@@ -26,7 +28,7 @@ fn main() {
|
|||||||
integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5",
|
integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5",
|
||||||
crossorigin: "anonymous"
|
crossorigin: "anonymous"
|
||||||
}
|
}
|
||||||
style { {include_str!("./assets/crm.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
h1 { "Dioxus CRM Example" }
|
h1 { "Dioxus CRM Example" }
|
||||||
Router::<Route> {}
|
Router::<Route> {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -16,8 +16,8 @@ fn main() {
|
|||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
// Breed is a signal that will be updated when the user clicks a breed in the list
|
// Breed is a signal that will be updated when the user clicks a breed in the list
|
||||||
// `deerhound` is just a default that we know will exist. We could also use a `None` instead
|
// `shiba` is just a default that we know will exist. We could also use a `None` instead
|
||||||
let mut breed = use_signal(|| "deerhound".to_string());
|
let mut breed = use_signal(|| "shiba".to_string());
|
||||||
|
|
||||||
// Fetch the list of breeds from the Dog API
|
// Fetch the list of breeds from the Dog API
|
||||||
// Since there are no dependencies, this will never restart
|
// Since there are no dependencies, this will never restart
|
||||||
@@ -55,7 +55,6 @@ fn app() -> Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/dog_app.css")} }
|
|
||||||
h1 { "Select a dog breed!" }
|
h1 { "Select a dog breed!" }
|
||||||
div { height: "500px", display: "flex",
|
div { height: "500px", display: "flex",
|
||||||
ul { width: "100px", {breed_list} }
|
ul { width: "100px", {breed_list} }
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
use dioxus::desktop::{use_asset_handler, wry::http::Response};
|
use dioxus::desktop::{use_asset_handler, wry::http::Response};
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/custom_assets.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch_desktop(app);
|
launch_desktop(app);
|
||||||
}
|
}
|
||||||
@@ -22,7 +24,7 @@ fn app() -> Element {
|
|||||||
});
|
});
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/custom_assets.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
h1 { "Dynamic Assets" }
|
h1 { "Dynamic Assets" }
|
||||||
img { src: "/logos/logo.png" }
|
img { src: "/logos/logo.png" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use std::sync::Arc;
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus::{html::HasFileData, prelude::dioxus_elements::FileEngine};
|
use dioxus::{html::HasFileData, prelude::dioxus_elements::FileEngine};
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/file_upload.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch(app);
|
launch(app);
|
||||||
}
|
}
|
||||||
@@ -41,7 +43,7 @@ fn app() -> Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/file_upload.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
|
|
||||||
h1 { "File Upload Example" }
|
h1 { "File Upload Example" }
|
||||||
p { "Drop a .txt, .rs, or .js file here to read it" }
|
p { "Drop a .txt, .rs, or .js file here to read it" }
|
||||||
|
|||||||
@@ -9,10 +9,12 @@
|
|||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/flat_router.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch(|| {
|
launch(|| {
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/flat_router.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
Router::<Route> {}
|
Router::<Route> {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+6
-4
@@ -7,16 +7,18 @@
|
|||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
fn main() {
|
const STYLE: &str = asset!(file("./examples/assets/counter.css"));
|
||||||
launch(app);
|
|
||||||
}
|
|
||||||
|
|
||||||
static COUNT: GlobalSignal<i32> = Signal::global(|| 0);
|
static COUNT: GlobalSignal<i32> = Signal::global(|| 0);
|
||||||
static DOUBLED_COUNT: GlobalMemo<i32> = Signal::global_memo(|| COUNT() * 2);
|
static DOUBLED_COUNT: GlobalMemo<i32> = Signal::global_memo(|| COUNT() * 2);
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
launch(app);
|
||||||
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/counter.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
Increment {}
|
Increment {}
|
||||||
Decrement {}
|
Decrement {}
|
||||||
Reset {}
|
Reset {}
|
||||||
|
|||||||
+3
-1
@@ -8,13 +8,15 @@
|
|||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/links.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch(app);
|
launch(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
rsx! (
|
rsx! (
|
||||||
style { {include_str!("./assets/links.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
Router::<Route> {}
|
Router::<Route> {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/radio.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch(app);
|
launch(app);
|
||||||
}
|
}
|
||||||
@@ -15,7 +17,7 @@ fn app() -> Element {
|
|||||||
let mut state = use_signal(|| PlayerState { is_playing: false });
|
let mut state = use_signal(|| PlayerState { is_playing: false });
|
||||||
|
|
||||||
rsx!(
|
rsx!(
|
||||||
style { {include_str!("./assets/radio.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
h1 {"Select an option"}
|
h1 {"Select an option"}
|
||||||
|
|
||||||
// Add some cute animations if the radio is playing!
|
// Add some cute animations if the radio is playing!
|
||||||
|
|||||||
+3
-1
@@ -8,10 +8,12 @@
|
|||||||
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/router.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch(|| {
|
launch(|| {
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/router.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
Router::<Route> {}
|
Router::<Route> {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-1
@@ -3,6 +3,8 @@
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
const STYLE: &str = asset!(file("./examples/assets/todomvc.css"));
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
launch(app);
|
launch(app);
|
||||||
}
|
}
|
||||||
@@ -63,7 +65,7 @@ fn app() -> Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
style { {include_str!("./assets/todomvc.css")} }
|
link { rel: "stylesheet", href: STYLE }
|
||||||
section { class: "todoapp",
|
section { class: "todoapp",
|
||||||
TodoHeader { todos }
|
TodoHeader { todos }
|
||||||
section { class: "main",
|
section { class: "main",
|
||||||
|
|||||||
@@ -135,21 +135,6 @@ name = "calculator_mutable"
|
|||||||
path = "../../examples/calculator_mutable.rs"
|
path = "../../examples/calculator_mutable.rs"
|
||||||
doc-scrape-examples = true
|
doc-scrape-examples = true
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "calculator"
|
|
||||||
path = "../../examples/calculator.rs"
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "clock"
|
|
||||||
path = "../../examples/clock.rs"
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "crm"
|
|
||||||
path = "../../examples/crm.rs"
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "custom_html"
|
name = "custom_html"
|
||||||
path = "../../examples/custom_html.rs"
|
path = "../../examples/custom_html.rs"
|
||||||
@@ -160,11 +145,6 @@ name = "custom_menu"
|
|||||||
path = "../../examples/custom_menu.rs"
|
path = "../../examples/custom_menu.rs"
|
||||||
doc-scrape-examples = true
|
doc-scrape-examples = true
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "dynamic_asset"
|
|
||||||
path = "../../examples/dynamic_asset.rs"
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "errors"
|
name = "errors"
|
||||||
path = "../../examples/errors.rs"
|
path = "../../examples/errors.rs"
|
||||||
|
|||||||
@@ -2,7 +2,12 @@ use crate::{assets::*, edits::EditQueue};
|
|||||||
use dioxus_html::document::NATIVE_EVAL_JS;
|
use dioxus_html::document::NATIVE_EVAL_JS;
|
||||||
use dioxus_interpreter_js::unified_bindings::SLEDGEHAMMER_JS;
|
use dioxus_interpreter_js::unified_bindings::SLEDGEHAMMER_JS;
|
||||||
use dioxus_interpreter_js::NATIVE_JS;
|
use dioxus_interpreter_js::NATIVE_JS;
|
||||||
use std::path::{Component, Path, PathBuf};
|
use serde::Deserialize;
|
||||||
|
use std::{
|
||||||
|
path::{Component, Path, PathBuf},
|
||||||
|
process::Command,
|
||||||
|
sync::OnceLock,
|
||||||
|
};
|
||||||
use wry::{
|
use wry::{
|
||||||
http::{status::StatusCode, Request, Response},
|
http::{status::StatusCode, Request, Response},
|
||||||
RequestAsyncResponder, Result,
|
RequestAsyncResponder, Result,
|
||||||
@@ -108,8 +113,18 @@ fn assets_head() -> Option<String> {
|
|||||||
|
|
||||||
fn resolve_resource(path: &Path) -> PathBuf {
|
fn resolve_resource(path: &Path) -> PathBuf {
|
||||||
let mut base_path = get_asset_root_or_default();
|
let mut base_path = get_asset_root_or_default();
|
||||||
|
|
||||||
if running_in_dev_mode() {
|
if running_in_dev_mode() {
|
||||||
base_path.push(path);
|
base_path.push(path);
|
||||||
|
|
||||||
|
// Special handler for Manganis filesystem fallback.
|
||||||
|
// We need this since Manganis provides assets from workspace root.
|
||||||
|
if !base_path.exists() {
|
||||||
|
let workspace_root = get_workspace_root_from_cargo();
|
||||||
|
let asset_path = workspace_root.join(path);
|
||||||
|
println!("ASSET PATH: {:?}", asset_path);
|
||||||
|
return asset_path;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let mut resource_path = PathBuf::new();
|
let mut resource_path = PathBuf::new();
|
||||||
for component in path.components() {
|
for component in path.components() {
|
||||||
@@ -305,3 +320,31 @@ fn get_mime_by_ext(trimmed: &Path) -> &'static str {
|
|||||||
None => "application/octet-stream",
|
None => "application/octet-stream",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A global that stores the workspace root. Used in [`get_workspace_root_from_cargo`].
|
||||||
|
static WORKSPACE_ROOT: OnceLock<PathBuf> = OnceLock::new();
|
||||||
|
|
||||||
|
/// Describes the metadata we need from `cargo metadata`.
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct CargoMetadata {
|
||||||
|
workspace_root: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the workspace root using `cargo metadata`. Should not be used in release mode.
|
||||||
|
pub(crate) fn get_workspace_root_from_cargo() -> PathBuf {
|
||||||
|
WORKSPACE_ROOT
|
||||||
|
.get_or_init(|| {
|
||||||
|
let out = Command::new("cargo")
|
||||||
|
.args(["metadata", "--format-version", "1", "--no-deps"])
|
||||||
|
.output()
|
||||||
|
.expect("`cargo metadata` failed to run");
|
||||||
|
|
||||||
|
let out =
|
||||||
|
String::from_utf8(out.stdout).expect("failed to parse output of `cargo metadata`");
|
||||||
|
let metadata = serde_json::from_str::<CargoMetadata>(&out)
|
||||||
|
.expect("failed to deserialize data from `cargo metadata`");
|
||||||
|
|
||||||
|
metadata.workspace_root
|
||||||
|
})
|
||||||
|
.to_owned()
|
||||||
|
}
|
||||||
@@ -24,7 +24,8 @@ dioxus-desktop = { workspace = true, default-features = true, optional = true }
|
|||||||
dioxus-fullstack = { workspace = true, default-features = true, optional = true }
|
dioxus-fullstack = { workspace = true, default-features = true, optional = true }
|
||||||
dioxus-static-site-generation = { workspace = true, optional = true }
|
dioxus-static-site-generation = { workspace = true, optional = true }
|
||||||
dioxus-liveview = { workspace = true, optional = true }
|
dioxus-liveview = { workspace = true, optional = true }
|
||||||
dioxus-ssr ={ workspace = true, optional = true }
|
dioxus-ssr = { workspace = true, optional = true }
|
||||||
|
manganis = { workspace = true, optional = true }
|
||||||
|
|
||||||
serde = { version = "1.0.136", optional = true }
|
serde = { version = "1.0.136", optional = true }
|
||||||
axum = { workspace = true, optional = true }
|
axum = { workspace = true, optional = true }
|
||||||
@@ -33,7 +34,7 @@ axum = { workspace = true, optional = true }
|
|||||||
dioxus-hot-reload = { workspace = true, optional = true }
|
dioxus-hot-reload = { workspace = true, optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["macro", "html", "hot-reload", "signals", "hooks", "launch", "mounted", "file_engine", "document"]
|
default = ["macro", "html", "hot-reload", "signals", "hooks", "launch", "mounted", "file_engine", "document", "asset"]
|
||||||
minimal = ["macro", "html", "signals", "hooks", "launch"]
|
minimal = ["macro", "html", "signals", "hooks", "launch"]
|
||||||
signals = ["dep:dioxus-signals"]
|
signals = ["dep:dioxus-signals"]
|
||||||
macro = ["dep:dioxus-core-macro"]
|
macro = ["dep:dioxus-core-macro"]
|
||||||
@@ -42,6 +43,7 @@ hooks = ["dep:dioxus-hooks"]
|
|||||||
hot-reload = ["dep:dioxus-hot-reload", "dioxus-web?/hot_reload", "dioxus-fullstack?/hot-reload"]
|
hot-reload = ["dep:dioxus-hot-reload", "dioxus-web?/hot_reload", "dioxus-fullstack?/hot-reload"]
|
||||||
mounted = ["dioxus-web?/mounted", "dioxus-html?/mounted"]
|
mounted = ["dioxus-web?/mounted", "dioxus-html?/mounted"]
|
||||||
file_engine = ["dioxus-web?/file_engine"]
|
file_engine = ["dioxus-web?/file_engine"]
|
||||||
|
asset = ["dep:manganis"]
|
||||||
document = ["dioxus-web?/document", "dioxus-html?/document"]
|
document = ["dioxus-web?/document", "dioxus-html?/document"]
|
||||||
|
|
||||||
launch = ["dep:dioxus-config-macro"]
|
launch = ["dep:dioxus-config-macro"]
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ pub mod prelude {
|
|||||||
#[cfg(feature = "axum")]
|
#[cfg(feature = "axum")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
|
||||||
pub use axum;
|
pub use axum;
|
||||||
|
|
||||||
|
#[cfg(feature = "asset")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "asset")))]
|
||||||
|
pub use manganis::{self, classes, mg as asset, ImageAsset, ImageType};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "web")]
|
#[cfg(feature = "web")]
|
||||||
|
|||||||
@@ -61,36 +61,17 @@ serde = { version = "1", features = ["derive"] }
|
|||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
|
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
|
||||||
# Most of the examples live in the workspace. We include some here so that docs.rs can scrape our examples for better inline docs
|
# Most of the examples live in the workspace. We include some here so that docs.rs can scrape our examples for better inline docs
|
||||||
[[example]]
|
|
||||||
name = "crm"
|
|
||||||
path = "../../examples/crm.rs"
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "flat_router"
|
|
||||||
path = "../../examples/flat_router.rs"
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "hash_fragment_state"
|
name = "hash_fragment_state"
|
||||||
path = "../../examples/hash_fragment_state.rs"
|
path = "../../examples/hash_fragment_state.rs"
|
||||||
doc-scrape-examples = true
|
doc-scrape-examples = true
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "link"
|
|
||||||
path = "../../examples/link.rs"
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "query_segment_search"
|
name = "query_segment_search"
|
||||||
path = "../../examples/query_segment_search.rs"
|
path = "../../examples/query_segment_search.rs"
|
||||||
doc-scrape-examples = true
|
doc-scrape-examples = true
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "router"
|
|
||||||
path = "../../examples/router.rs"
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "simple_router"
|
name = "simple_router"
|
||||||
path = "../../examples/simple_router.rs"
|
path = "../../examples/simple_router.rs"
|
||||||
|
|||||||
Reference in new issue
Block a user