diff --git a/Cargo.lock b/Cargo.lock index 6c2326d..4d04f11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,34 +26,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "api" -version = "0.1.0" -dependencies = [ - "dioxus", -] - [[package]] name = "ashpd" version = "0.8.1" @@ -71,12 +43,6 @@ dependencies = [ "zbus", ] -[[package]] -name = "askama_escape" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" - [[package]] name = "async-broadcast" version = "0.7.2" @@ -229,77 +195,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" -[[package]] -name = "axum" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" -dependencies = [ - "async-trait", - "axum-core", - "axum-macros", - "base64", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "itoa 1.0.15", - "matchit", - "memchr", - "mime", - "multer", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sha1", - "sync_wrapper", - "tokio", - "tokio-tungstenite", - "tower 0.5.2", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "axum-core" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "rustversion", - "sync_wrapper", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "axum-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.106", -] - [[package]] name = "backtrace" version = "0.3.75" @@ -467,20 +362,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" -[[package]] -name = "chrono" -version = "0.4.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-link", -] - [[package]] name = "ciborium" version = "0.2.2" @@ -519,7 +400,7 @@ dependencies = [ "cocoa-foundation 0.1.2", "core-foundation 0.9.4", "core-graphics 0.23.2", - "foreign-types 0.5.0", + "foreign-types", "libc", "objc", ] @@ -535,7 +416,7 @@ dependencies = [ "cocoa-foundation 0.2.1", "core-foundation 0.10.1", "core-graphics 0.24.0", - "foreign-types 0.5.0", + "foreign-types", "libc", "objc", ] @@ -687,7 +568,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.4", "core-graphics-types 0.1.3", - "foreign-types 0.5.0", + "foreign-types", "libc", ] @@ -700,7 +581,7 @@ dependencies = [ "bitflags 2.9.2", "core-foundation 0.10.1", "core-graphics-types 0.2.0", - "foreign-types 0.5.0", + "foreign-types", "libc", ] @@ -879,14 +760,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "desktop" -version = "0.1.0" -dependencies = [ - "dioxus", - "ui", -] - [[package]] name = "digest" version = "0.10.7" @@ -914,12 +787,10 @@ dependencies = [ "dioxus-history", "dioxus-hooks", "dioxus-html", - "dioxus-liveview", "dioxus-logger", "dioxus-mobile", "dioxus-router", "dioxus-signals", - "dioxus-ssr", "dioxus-web", "manganis", "serde", @@ -1050,7 +921,7 @@ dependencies = [ "serde", "serde_json", "tracing", - "tungstenite 0.23.0", + "tungstenite", "warnings", ] @@ -1089,41 +960,23 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe99b48a1348eec385b5c4bd3e80fd863b0d3b47257d34e2ddc58754dec5d128" dependencies = [ - "async-trait", - "axum", "base64", "bytes", "ciborium", - "dioxus-cli-config", "dioxus-desktop", "dioxus-devtools", "dioxus-history", - "dioxus-interpreter-js", - "dioxus-isrg", "dioxus-lib", "dioxus-mobile", - "dioxus-ssr", "dioxus-web", "dioxus_server_macro", "futures-channel", "futures-util", "generational-box", - "http", - "hyper", "once_cell", - "parking_lot", - "pin-project", "serde", "server_fn", - "thiserror 1.0.69", - "tokio", - "tokio-stream", - "tokio-util", - "tower 0.4.13", - "tower-http 0.5.2", - "tower-layer", "tracing", - "tracing-futures", "web-sys", ] @@ -1211,20 +1064,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "dioxus-isrg" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff7e1701a498e214dd0c4a99fdb71c256405fc019a5c91663678ac975dd26ae6" -dependencies = [ - "chrono", - "http", - "lru", - "rustc-hash", - "thiserror 1.0.69", - "tracing", -] - [[package]] name = "dioxus-lib" version = "0.6.2" @@ -1243,34 +1082,6 @@ dependencies = [ "warnings", ] -[[package]] -name = "dioxus-liveview" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b78d90b5d593eb39e96d7892d059c085af5ac4c29b4257b22646e37c1c5ef0" -dependencies = [ - "axum", - "dioxus-cli-config", - "dioxus-core", - "dioxus-devtools", - "dioxus-document", - "dioxus-history", - "dioxus-html", - "dioxus-interpreter-js", - "futures-channel", - "futures-util", - "generational-box", - "rustc-hash", - "serde", - "serde_json", - "slab", - "thiserror 1.0.69", - "tokio", - "tokio-stream", - "tokio-util", - "tracing", -] - [[package]] name = "dioxus-logger" version = "0.6.2" @@ -1355,18 +1166,6 @@ dependencies = [ "warnings", ] -[[package]] -name = "dioxus-ssr" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e1fac097e71ccec4e9e15d44b68393be2981276e42170703180bceb0b6f122" -dependencies = [ - "askama_escape", - "dioxus-core", - "dioxus-core-types", - "rustc-hash", -] - [[package]] name = "dioxus-web" version = "0.6.3" @@ -1509,15 +1308,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - [[package]] name = "endi" version = "1.1.0" @@ -1654,21 +1444,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared 0.1.1", -] - [[package]] name = "foreign-types" version = "0.5.0" @@ -1676,7 +1451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared 0.3.1", + "foreign-types-shared", ] [[package]] @@ -1690,12 +1465,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "foreign-types-shared" version = "0.3.1" @@ -2211,11 +1980,6 @@ name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] [[package]] name = "heck" @@ -2298,24 +2062,12 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "http-range-header" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" - [[package]] name = "httparse" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hyper" version = "1.7.0" @@ -2329,7 +2081,6 @@ dependencies = [ "http", "http-body", "httparse", - "httpdate", "itoa 1.0.15", "pin-project-lite", "pin-utils", @@ -2338,22 +2089,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - [[package]] name = "hyper-util" version = "0.1.16" @@ -2378,30 +2113,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "iana-time-zone" -version = "0.1.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core 0.61.2", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "icu_collections" version = "2.0.0" @@ -2553,15 +2264,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "inventory" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" -dependencies = [ - "rustversion", -] - [[package]] name = "io-uring" version = "0.7.9" @@ -2795,15 +2497,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86" -[[package]] -name = "lru" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" -dependencies = [ - "hashbrown 0.15.5", -] - [[package]] name = "mac" version = "0.1.1" @@ -2875,12 +2568,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "memchr" version = "2.7.5" @@ -2933,14 +2620,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "mobile" -version = "0.1.0" -dependencies = [ - "dioxus", - "ui", -] - [[package]] name = "muda" version = "0.11.5" @@ -2979,40 +2658,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "multer" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http", - "httparse", - "memchr", - "mime", - "spin", - "version_check", -] - -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "ndk" version = "0.9.0" @@ -3305,50 +2950,6 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" -[[package]] -name = "openssl" -version = "0.10.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" -dependencies = [ - "bitflags 2.9.2", - "cfg-if", - "foreign-types 0.3.2", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.106", -] - -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-sys" -version = "0.9.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -3884,24 +3485,20 @@ dependencies = [ "http-body", "http-body-util", "hyper", - "hyper-tls", "hyper-util", "js-sys", "log", "mime_guess", - "native-tls", "percent-encoding", "pin-project-lite", - "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-native-tls", "tokio-util", - "tower 0.5.2", - "tower-http 0.6.6", + "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", @@ -3967,15 +3564,6 @@ dependencies = [ "windows-sys 0.60.2", ] -[[package]] -name = "rustls-pki-types" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" -dependencies = [ - "zeroize", -] - [[package]] name = "rustversion" version = "1.0.22" @@ -3997,44 +3585,12 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.9.2", - "core-foundation 0.9.4", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "selectors" version = "0.22.0" @@ -4113,16 +3669,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_path_to_error" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fab13f937fa393d08645bf3a84bdfe86e296747b506ada67bb15f10f218b2a" -dependencies = [ - "itoa 1.0.15", - "serde", -] - [[package]] name = "serde_qs" version = "0.12.0" @@ -4172,16 +3718,12 @@ version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fae7a3038a32e5a34ba32c6c45eb4852f8affaf8b794ebfcd4b1099e2d62ebe" dependencies = [ - "axum", "bytes", "const_format", "dashmap", "futures", "gloo-net", "http", - "http-body-util", - "hyper", - "inventory", "js-sys", "once_cell", "reqwest", @@ -4191,8 +3733,6 @@ dependencies = [ "serde_qs", "server_fn_macro_default", "thiserror 1.0.69", - "tower 0.4.13", - "tower-layer", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -4396,12 +3936,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -4529,7 +4063,7 @@ dependencies = [ "unicode-segmentation", "url", "windows", - "windows-core 0.58.0", + "windows-core", "windows-version", "x11-dl", ] @@ -4575,6 +4109,13 @@ dependencies = [ "utf-8", ] +[[package]] +name = "tester" +version = "0.1.0" +dependencies = [ + "dioxus", +] + [[package]] name = "thin-slice" version = "0.1.1" @@ -4671,40 +4212,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-stream" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", - "tokio-util", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite 0.24.0", -] - [[package]] name = "tokio-util" version = "0.7.16" @@ -4714,7 +4221,6 @@ dependencies = [ "bytes", "futures-core", "futures-sink", - "futures-util", "pin-project-lite", "tokio", ] @@ -4764,21 +4270,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tower" version = "0.5.2" @@ -4792,32 +4283,6 @@ dependencies = [ "tokio", "tower-layer", "tower-service", - "tracing", -] - -[[package]] -name = "tower-http" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" -dependencies = [ - "bitflags 2.9.2", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "http-range-header", - "httpdate", - "mime", - "mime_guess", - "percent-encoding", - "pin-project-lite", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", ] [[package]] @@ -4833,7 +4298,7 @@ dependencies = [ "http-body", "iri-string", "pin-project-lite", - "tower 0.5.2", + "tower", "tower-layer", "tower-service", ] @@ -4856,7 +4321,6 @@ version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4882,16 +4346,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "tracing-subscriber" version = "0.3.19" @@ -4959,24 +4413,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "tungstenite" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand 0.8.5", - "sha1", - "thiserror 1.0.69", - "utf-8", -] - [[package]] name = "typenum" version = "1.18.0" @@ -4994,14 +4430,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ui" -version = "0.1.0" -dependencies = [ - "api", - "dioxus", -] - [[package]] name = "unicase" version = "2.8.1" @@ -5028,9 +4456,9 @@ checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "url" -version = "2.5.5" +version = "2.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec961601b32b6f5d14ae8dabd35ff2ff2e2c6cb4c0e6641845ff105abe96d958" +checksum = "137a3c834eaf7139b73688502f3f1141a0337c5d8e4d9b536f9b8c796e26a7c4" dependencies = [ "form_urlencoded", "idna", @@ -5066,12 +4494,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version-compare" version = "0.2.0" @@ -5230,14 +4652,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "web" -version = "0.1.0" -dependencies = [ - "dioxus", - "ui", -] - [[package]] name = "web-sys" version = "0.3.77" @@ -5318,9 +4732,9 @@ dependencies = [ "webview2-com-macros", "webview2-com-sys", "windows", - "windows-core 0.58.0", - "windows-implement 0.58.0", - "windows-interface 0.58.0", + "windows-core", + "windows-implement", + "windows-interface", ] [[package]] @@ -5342,7 +4756,7 @@ checksum = "a3a3e2eeb58f82361c93f9777014668eb3d07e7d174ee4c819575a9208011886" dependencies = [ "thiserror 1.0.69", "windows", - "windows-core 0.58.0", + "windows-core", ] [[package]] @@ -5382,7 +4796,7 @@ version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" dependencies = [ - "windows-core 0.58.0", + "windows-core", "windows-targets 0.52.6", ] @@ -5392,26 +4806,13 @@ version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" dependencies = [ - "windows-implement 0.58.0", - "windows-interface 0.58.0", - "windows-result 0.2.0", - "windows-strings 0.1.0", + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", "windows-targets 0.52.6", ] -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement 0.60.0", - "windows-interface 0.59.1", - "windows-link", - "windows-result 0.3.4", - "windows-strings 0.4.2", -] - [[package]] name = "windows-implement" version = "0.58.0" @@ -5423,17 +4824,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "windows-implement" -version = "0.60.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.106", -] - [[package]] name = "windows-interface" version = "0.58.0" @@ -5445,17 +4835,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "windows-interface" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.106", -] - [[package]] name = "windows-link" version = "0.1.3" @@ -5471,34 +4850,16 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link", -] - [[package]] name = "windows-strings" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ - "windows-result 0.2.0", + "windows-result", "windows-targets 0.52.6", ] -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -5855,7 +5216,7 @@ dependencies = [ "webkit2gtk-sys", "webview2-com", "windows", - "windows-core 0.58.0", + "windows-core", "windows-version", "x11-dl", ] @@ -6021,12 +5382,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - [[package]] name = "zerotrie" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index 30fc656..e6043c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,28 @@ -[workspace] -resolver = "2" -members = [ - "ui", - "web", - "desktop", - "mobile", - "api", -] +[package] +name = "tester" +version = "0.1.0" +authors = ["vikingowl "] +edition = "2021" -[workspace.dependencies] -dioxus = { version = "0.6.0" } +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -# workspace -ui = { path = "ui" } -api = { path = "api" } +[dependencies] +dioxus = { version = "0.6.0", features = ["router", "fullstack"] } + +[features] +default = ["web"] +web = ["dioxus/web"] +desktop = ["dioxus/desktop"] +mobile = ["dioxus/mobile"] + +[profile] + +[profile.wasm-dev] +inherits = "dev" +opt-level = 1 + +[profile.server-dev] +inherits = "dev" + +[profile.android-dev] +inherits = "dev" diff --git a/Dioxus.toml b/Dioxus.toml new file mode 100644 index 0000000..7e2b6b8 --- /dev/null +++ b/Dioxus.toml @@ -0,0 +1,21 @@ +[application] + +[web.app] + +# HTML title tag content +title = "tester" + +# include `assets` in web platform +[web.resource] + +# Additional CSS style files +style = [] + +# Additional JavaScript files +script = [] + +[web.resource.dev] + +# Javascript code file +# serve: [dev-server] only +script = [] diff --git a/README.md b/README.md index 3a4ba36..e4adc70 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,34 @@ # Development -Your new workspace contains a member crate for each of the web, desktop and mobile platforms, a `ui` crate for shared components and a `api` crate for shared backend logic: +Your new bare-bones project includes minimal organization with a single `main.rs` file and a few assets. ``` -your_project/ -├─ web/ -│ ├─ ... # Web specific UI/logic -├─ desktop/ -│ ├─ ... # Desktop specific UI/logic -├─ mobile/ -│ ├─ ... # Mobile specific UI/logic -├─ api/ -│ ├─ ... # All shared server logic -├─ ui/ -│ ├─ ... # Component shared between multiple platforms -``` - -## Platform crates - -Each platform crate contains the entry point for the platform, and any assets, components and dependencies that are specific to that platform. For example, the desktop crate in the workspace looks something like this: - -``` -desktop/ # The desktop crate contains all platform specific UI, logic and dependencies for the desktop app -├─ assets/ # Assets used by the desktop app - Any platform specific assets should go in this folder +project/ +├─ assets/ # Any assets that are used by the app should be placed here ├─ src/ -│ ├─ main.rs # The entrypoint for the desktop app. It also defines the routes for the desktop platform -│ ├─ views/ # The views each route will render in the desktop version of the app -│ │ ├─ mod.rs # Defines the module for the views route and re-exports the components for each route -│ │ ├─ blog.rs # The component that will render at the /blog/:id route -│ │ ├─ home.rs # The component that will render at the / route -├─ Cargo.toml # The desktop crate's Cargo.toml - This should include all desktop specific dependencies +│ ├─ main.rs # main.rs is the entry point to your application and currently contains all components for the app +├─ Cargo.toml # The Cargo.toml file defines the dependencies and feature flags for your project ``` -When you start developing with the workspace setup each of the platform crates will look almost identical. The UI starts out exactly the same on all platforms. However, as you continue developing your application, this setup makes it easy to let the views for each platform change independently. +### Tailwind +1. Install npm: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm +2. Install the Tailwind CSS CLI: https://tailwindcss.com/docs/installation +3. Run the following command in the root of the project to start the Tailwind CSS compiler: -## Shared UI crate - -The workspace contains a `ui` crate with components that are shared between multiple platforms. You should put any UI elements you want to use in multiple platforms in this crate. You can also put some shared client side logic in this crate, but be careful to not pull in platform specific dependencies. The `ui` crate starts out something like this: - -``` -ui/ -├─ src/ -│ ├─ lib.rs # The entrypoint for the ui crate -│ ├─ hero.rs # The Hero component that will be used in every platform -│ ├─ echo.rs # The shared echo component that communicates with the server -│ ├─ navbar.rs # The Navbar component that will be used in the layout of every platform's router -``` - -## Shared backend logic - -The workspace contains a `api` crate with shared backend logic. This crate defines all of the shared server functions for all platforms. Server functions are async functions that expose a public API on the server. They can be called like a normal async function from the client. When you run `dx serve`, all of the server functions will be collected in the server build and hosted on a public API for the client to call. The `api` crate starts out something like this: - -``` -api/ -├─ src/ -│ ├─ lib.rs # Exports a server function that echos the input string +```bash +npx tailwindcss -i ./tailwind.css -o ./assets/tailwind.css --watch ``` ### Serving Your App -Navigate to the platform crate of your choice: -```bash -cd web -``` - -and serve: +Run the following command in the root of your project to start developing with the default platform: ```bash -dx serve +dx serve --platform web +``` + +To run for a different platform, use the `--platform platform` flag. E.g. +```bash +dx serve --platform desktop ``` diff --git a/api/Cargo.toml b/api/Cargo.toml deleted file mode 100644 index c525cf6..0000000 --- a/api/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "api" -version = "0.1.0" -edition = "2021" - -[dependencies] -dioxus = { workspace = true, features = ["fullstack"] } diff --git a/api/README.md b/api/README.md deleted file mode 100644 index 110c02f..0000000 --- a/api/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# API - -This crate contains all shared fullstack server functions. This is a great place to place any server-only logic you would like to expose in multiple platforms like a method that accesses your database or a method that sends an email. - -This crate will be built twice: -1. Once for the server build with the `dioxus/server` feature enabled -2. Once for the client build with the client feature disabled - -During the server build, the server functions will be collected and hosted on a public API for the client to call. During the client build, the server functions will be compiled into the client build. - -## Dependencies - -Most server dependencies (like sqlx and tokio) will not compile on client platforms like WASM. To avoid building server dependencies on the client, you should add platform specific dependencies under the `server` feature in the [Cargo.toml](../Cargo.toml) file. More details about managing server only dependencies can be found in the [Dioxus guide](https://dioxuslabs.com/learn/0.6/guides/fullstack/managing_dependencies#adding-server-only-dependencies). diff --git a/api/src/lib.rs b/api/src/lib.rs deleted file mode 100644 index 87eef6e..0000000 --- a/api/src/lib.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! This crate contains all shared fullstack server functions. -use dioxus::prelude::*; - -/// Echo the user input on the server. -#[server(Echo)] -pub async fn echo(input: String) -> Result { - Ok(input) -} diff --git a/web/assets/favicon.ico b/assets/favicon.ico similarity index 100% rename from web/assets/favicon.ico rename to assets/favicon.ico diff --git a/ui/assets/header.svg b/assets/header.svg similarity index 100% rename from ui/assets/header.svg rename to assets/header.svg diff --git a/assets/main.css b/assets/main.css new file mode 100644 index 0000000..4314613 --- /dev/null +++ b/assets/main.css @@ -0,0 +1,107 @@ +/* App-wide styling */ +body { + background-color: #0f1116; + color: #ffffff; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + margin: 20px; +} + +#hero { + margin: 0; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +#links { + width: 400px; + text-align: left; + font-size: x-large; + color: white; + display: flex; + flex-direction: column; +} + +#links a { + color: white; + text-decoration: none; + margin-top: 20px; + margin: 10px 0px; + border: white 1px solid; + border-radius: 5px; + padding: 10px; +} + +#links a:hover { + background-color: #1f1f1f; + cursor: pointer; +} + +#header { + max-width: 1200px; +} + +/* Navbar */ +#navbar { + display: flex; + flex-direction: row; + } + +#navbar a { + color: #ffffff; + margin-right: 20px; + text-decoration: none; + transition: color 0.2s ease; +} + +#navbar a:hover { + cursor: pointer; + color: #91a4d2; +} + +/* Blog page */ +#blog { + margin-top: 50px; + } + +#blog a { + color: #ffffff; + margin-top: 50px; +} + +/* Echo */ +#echo { + width: 360px; + margin-left: auto; + margin-right: auto; + margin-top: 50px; + background-color: #1e222d; + padding: 20px; + border-radius: 10px; +} + +#echo>h4 { + margin: 0px 0px 15px 0px; +} + + +#echo>input { + border: none; + border-bottom: 1px white solid; + background-color: transparent; + color: #ffffff; + transition: border-bottom-color 0.2s ease; + outline: none; + display: block; + padding: 0px 0px 5px 0px; + width: 100%; +} + +#echo>input:focus { + border-bottom-color: #6d85c6; +} + +#echo>p { + margin: 20px 0px 0px auto; +} \ No newline at end of file diff --git a/assets/tailwind.css b/assets/tailwind.css new file mode 100644 index 0000000..e69de29 diff --git a/desktop/Cargo.toml b/desktop/Cargo.toml deleted file mode 100644 index 8d66074..0000000 --- a/desktop/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "desktop" -version = "0.1.0" -edition = "2021" - -[dependencies] -dioxus = { workspace = true, features = ["router"] } -ui = { workspace = true } - -[features] -default = [] -desktop = ["dioxus/desktop"] -server = ["dioxus/server"] diff --git a/desktop/README.md b/desktop/README.md deleted file mode 100644 index 6f691f8..0000000 --- a/desktop/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Development - -The desktop crate defines the entrypoint for the desktop app along with any assets, components and dependencies that are specific to desktop builds. The desktop crate starts out something like this: - -``` -desktop/ -├─ assets/ # Assets used by the desktop app - Any platform specific assets should go in this folder -├─ src/ -│ ├─ main.rs # The entrypoint for the desktop app.It also defines the routes for the desktop platform -│ ├─ views/ # The views each route will render in the desktop version of the app -│ │ ├─ mod.rs # Defines the module for the views route and re-exports the components for each route -│ │ ├─ blog.rs # The component that will render at the /blog/:id route -│ │ ├─ home.rs # The component that will render at the / route -├─ Cargo.toml # The desktop crate's Cargo.toml - This should include all desktop specific dependencies -``` - -## Dependencies -Since you have fullstack enabled, the desktop crate will be built two times: -1. Once for the server build with the `server` feature enabled -2. Once for the client build with the `desktop` feature enabled - -You should make all desktop specific dependencies optional and only enabled in the `desktop` feature. This will ensure that the server builds don't pull in desktop specific dependencies which cuts down on build times significantly. - -### Serving Your Desktop App - -You can start your desktop app with the following command: - -```bash -dx serve -``` diff --git a/desktop/assets/blog.css b/desktop/assets/blog.css deleted file mode 100644 index f27f060..0000000 --- a/desktop/assets/blog.css +++ /dev/null @@ -1,8 +0,0 @@ -#blog { - margin-top: 50px; -} - -#blog a { - color: #ffffff; - margin-top: 50px; -} \ No newline at end of file diff --git a/desktop/assets/main.css b/desktop/assets/main.css deleted file mode 100644 index ef6e674..0000000 --- a/desktop/assets/main.css +++ /dev/null @@ -1,6 +0,0 @@ -body { - background-color: #0f1116; - color: #ffffff; - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - margin: 20px; -} \ No newline at end of file diff --git a/desktop/src/main.rs b/desktop/src/main.rs deleted file mode 100644 index b63670b..0000000 --- a/desktop/src/main.rs +++ /dev/null @@ -1,54 +0,0 @@ -use dioxus::prelude::*; - -use ui::Navbar; -use views::{Blog, Home}; - -mod views; - -#[derive(Debug, Clone, Routable, PartialEq)] -#[rustfmt::skip] -enum Route { - #[layout(DesktopNavbar)] - #[route("/")] - Home {}, - #[route("/blog/:id")] - Blog { id: i32 }, -} - -const MAIN_CSS: Asset = asset!("/assets/main.css"); - -fn main() { - dioxus::launch(App); -} - -#[component] -fn App() -> Element { - // Build cool things ✌️ - - rsx! { - // Global app resources - document::Link { rel: "stylesheet", href: MAIN_CSS } - - Router:: {} - } -} - -/// A desktop-specific Router around the shared `Navbar` component -/// which allows us to use the desktop-specific `Route` enum. -#[component] -fn DesktopNavbar() -> Element { - rsx! { - Navbar { - Link { - to: Route::Home {}, - "Home" - } - Link { - to: Route::Blog { id: 1 }, - "Blog" - } - } - - Outlet:: {} - } -} diff --git a/desktop/src/views/blog.rs b/desktop/src/views/blog.rs deleted file mode 100644 index c114f5e..0000000 --- a/desktop/src/views/blog.rs +++ /dev/null @@ -1,30 +0,0 @@ -use crate::Route; -use dioxus::prelude::*; - -const BLOG_CSS: Asset = asset!("/assets/blog.css"); - -#[component] -pub fn Blog(id: i32) -> Element { - rsx! { - document::Link { rel: "stylesheet", href: BLOG_CSS} - - div { - id: "blog", - - // Content - h1 { "This is blog #{id}!" } - p { "In blog #{id}, we show how the Dioxus router works and how URL parameters can be passed as props to our route components." } - - // Navigation links - Link { - to: Route::Blog { id: id - 1 }, - "Previous" - } - span { " <---> " } - Link { - to: Route::Blog { id: id + 1 }, - "Next" - } - } - } -} diff --git a/desktop/src/views/home.rs b/desktop/src/views/home.rs deleted file mode 100644 index 5ea3370..0000000 --- a/desktop/src/views/home.rs +++ /dev/null @@ -1,10 +0,0 @@ -use dioxus::prelude::*; -use ui::{Echo, Hero}; - -#[component] -pub fn Home() -> Element { - rsx! { - Hero {} - Echo {} - } -} diff --git a/desktop/src/views/mod.rs b/desktop/src/views/mod.rs deleted file mode 100644 index b3fe26b..0000000 --- a/desktop/src/views/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod home; -pub use home::Home; - -mod blog; -pub use blog::Blog; diff --git a/mobile/Cargo.toml b/mobile/Cargo.toml deleted file mode 100644 index 8ddd192..0000000 --- a/mobile/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "mobile" -version = "0.1.0" -edition = "2021" - -[dependencies] -dioxus = { workspace = true, features = ["router"] } -ui = { workspace = true } - -[features] -default = [] -mobile = ["dioxus/mobile"] -server = ["dioxus/server"] diff --git a/mobile/README.md b/mobile/README.md deleted file mode 100644 index 34d37de..0000000 --- a/mobile/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Development - -The mobile crate defines the entrypoint for the mobile app along with any assets, components and dependencies that are specific to mobile builds. The mobile crate starts out something like this: - -``` -mobile/ -├─ assets/ # Assets used by the mobile app - Any platform specific assets should go in this folder -├─ src/ -│ ├─ main.rs # The entrypoint for the mobile app.It also defines the routes for the mobile platform -│ ├─ views/ # The views each route will render in the mobile version of the app -│ │ ├─ mod.rs # Defines the module for the views route and re-exports the components for each route -│ │ ├─ blog.rs # The component that will render at the /blog/:id route -│ │ ├─ home.rs # The component that will render at the / route -├─ Cargo.toml # The mobile crate's Cargo.toml - This should include all mobile specific dependencies -``` - -## Dependencies -Since you have fullstack enabled, the mobile crate will be built two times: -1. Once for the server build with the `server` feature enabled -2. Once for the client build with the `mobile` feature enabled - -You should make all mobile specific dependencies optional and only enabled in the `mobile` feature. This will ensure that the server builds don't pull in mobile specific dependencies which cuts down on build times significantly. - -### Serving Your Mobile App - -Mobile platforms are shared in a single crate. To serve mobile, you need to explicitly set your target device to `android` or `ios`: - -```bash -dx serve --platform android -``` \ No newline at end of file diff --git a/mobile/assets/blog.css b/mobile/assets/blog.css deleted file mode 100644 index f27f060..0000000 --- a/mobile/assets/blog.css +++ /dev/null @@ -1,8 +0,0 @@ -#blog { - margin-top: 50px; -} - -#blog a { - color: #ffffff; - margin-top: 50px; -} \ No newline at end of file diff --git a/mobile/assets/main.css b/mobile/assets/main.css deleted file mode 100644 index ef6e674..0000000 --- a/mobile/assets/main.css +++ /dev/null @@ -1,6 +0,0 @@ -body { - background-color: #0f1116; - color: #ffffff; - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - margin: 20px; -} \ No newline at end of file diff --git a/mobile/src/main.rs b/mobile/src/main.rs deleted file mode 100644 index 2505cb5..0000000 --- a/mobile/src/main.rs +++ /dev/null @@ -1,54 +0,0 @@ -use dioxus::prelude::*; - -use ui::Navbar; -use views::{Blog, Home}; - -mod views; - -#[derive(Debug, Clone, Routable, PartialEq)] -#[rustfmt::skip] -enum Route { - #[layout(MobileNavbar)] - #[route("/")] - Home {}, - #[route("/blog/:id")] - Blog { id: i32 }, -} - -const MAIN_CSS: Asset = asset!("/assets/main.css"); - -fn main() { - dioxus::launch(App); -} - -#[component] -fn App() -> Element { - // Build cool things ✌️ - - rsx! { - // Global app resources - document::Link { rel: "stylesheet", href: MAIN_CSS } - - Router:: {} - } -} - -/// A mobile-specific Router around the shared `Navbar` component -/// which allows us to use the mobile-specific `Route` enum. -#[component] -fn MobileNavbar() -> Element { - rsx! { - Navbar { - Link { - to: Route::Home {}, - "Home" - } - Link { - to: Route::Blog { id: 1 }, - "Blog" - } - } - - Outlet:: {} - } -} diff --git a/mobile/src/views/blog.rs b/mobile/src/views/blog.rs deleted file mode 100644 index c114f5e..0000000 --- a/mobile/src/views/blog.rs +++ /dev/null @@ -1,30 +0,0 @@ -use crate::Route; -use dioxus::prelude::*; - -const BLOG_CSS: Asset = asset!("/assets/blog.css"); - -#[component] -pub fn Blog(id: i32) -> Element { - rsx! { - document::Link { rel: "stylesheet", href: BLOG_CSS} - - div { - id: "blog", - - // Content - h1 { "This is blog #{id}!" } - p { "In blog #{id}, we show how the Dioxus router works and how URL parameters can be passed as props to our route components." } - - // Navigation links - Link { - to: Route::Blog { id: id - 1 }, - "Previous" - } - span { " <---> " } - Link { - to: Route::Blog { id: id + 1 }, - "Next" - } - } - } -} diff --git a/mobile/src/views/home.rs b/mobile/src/views/home.rs deleted file mode 100644 index 5ea3370..0000000 --- a/mobile/src/views/home.rs +++ /dev/null @@ -1,10 +0,0 @@ -use dioxus::prelude::*; -use ui::{Echo, Hero}; - -#[component] -pub fn Home() -> Element { - rsx! { - Hero {} - Echo {} - } -} diff --git a/mobile/src/views/mod.rs b/mobile/src/views/mod.rs deleted file mode 100644 index b3fe26b..0000000 --- a/mobile/src/views/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod home; -pub use home::Home; - -mod blog; -pub use blog::Blog; diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..d8bff6e --- /dev/null +++ b/src/main.rs @@ -0,0 +1,134 @@ +use dioxus::prelude::*; + +#[derive(Debug, Clone, Routable, PartialEq)] +#[rustfmt::skip] +enum Route { + #[layout(Navbar)] + #[route("/")] + Home {}, + #[route("/blog/:id")] + Blog { id: i32 }, +} + +const FAVICON: Asset = asset!("/assets/favicon.ico"); +const MAIN_CSS: Asset = asset!("/assets/main.css"); +const HEADER_SVG: Asset = asset!("/assets/header.svg"); +const TAILWIND_CSS: Asset = asset!("/assets/tailwind.css"); + +fn main() { + dioxus::launch(App); +} + +#[component] +fn App() -> Element { + rsx! { + document::Link { rel: "icon", href: FAVICON } + document::Link { rel: "stylesheet", href: MAIN_CSS } document::Link { rel: "stylesheet", href: TAILWIND_CSS } + Router:: {} + } +} + +#[component] +pub fn Hero() -> Element { + rsx! { + div { + id: "hero", + img { src: HEADER_SVG, id: "header" } + div { id: "links", + a { href: "https://dioxuslabs.com/learn/0.6/", "📚 Learn Dioxus" } + a { href: "https://dioxuslabs.com/awesome", "🚀 Awesome Dioxus" } + a { href: "https://github.com/dioxus-community/", "📡 Community Libraries" } + a { href: "https://github.com/DioxusLabs/sdk", "⚙️ Dioxus Development Kit" } + a { href: "https://marketplace.visualstudio.com/items?itemName=DioxusLabs.dioxus", "💫 VSCode Extension" } + a { href: "https://discord.gg/XgGxMSkvUM", "👋 Community Discord" } + } + } + } +} + +/// Home page +#[component] +fn Home() -> Element { + rsx! { + Hero {} + Echo {} + } +} + +/// Blog page +#[component] +pub fn Blog(id: i32) -> Element { + rsx! { + div { + id: "blog", + + // Content + h1 { "This is blog #{id}!" } + p { "In blog #{id}, we show how the Dioxus router works and how URL parameters can be passed as props to our route components." } + + // Navigation links + Link { + to: Route::Blog { id: id - 1 }, + "Previous" + } + span { " <---> " } + Link { + to: Route::Blog { id: id + 1 }, + "Next" + } + } + } +} + +/// Shared navbar component. +#[component] +fn Navbar() -> Element { + rsx! { + div { + id: "navbar", + Link { + to: Route::Home {}, + "Home" + } + Link { + to: Route::Blog { id: 1 }, + "Blog" + } + } + + Outlet:: {} + } +} + +/// Echo component that demonstrates fullstack server functions. +#[component] +fn Echo() -> Element { + let mut response = use_signal(|| String::new()); + + rsx! { + div { + id: "echo", + h4 { "ServerFn Echo" } + input { + placeholder: "Type here to echo...", + oninput: move |event| async move { + let data = echo_server(event.value()).await.unwrap(); + response.set(data); + }, + } + + if !response().is_empty() { + p { + "Server echoed: " + i { "{response}" } + } + } + } + } +} + +/// Echo the user input on the server. +#[server(EchoServer)] +async fn echo_server(input: String) -> Result { + Ok(input) +} diff --git a/tailwind.config.js b/tailwind.config.js new file mode 100644 index 0000000..2a69d58 --- /dev/null +++ b/tailwind.config.js @@ -0,0 +1,9 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + mode: "all", + content: ["./src/**/*.{rs,html,css}", "./dist/**/*.html"], + theme: { + extend: {}, + }, + plugins: [], +}; diff --git a/tailwind.css b/tailwind.css new file mode 100644 index 0000000..bd6213e --- /dev/null +++ b/tailwind.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; \ No newline at end of file diff --git a/ui/Cargo.toml b/ui/Cargo.toml deleted file mode 100644 index 37f89fc..0000000 --- a/ui/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "ui" -version = "0.1.0" -edition = "2021" - -[dependencies] -dioxus = { workspace = true } -api = { workspace = true } diff --git a/ui/README.md b/ui/README.md deleted file mode 100644 index fa36d7f..0000000 --- a/ui/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# UI - -This crate contains all shared components for the workspace. This is a great place to place any UI you would like to use in multiple platforms like a common `Button` or `Navbar` component. - -``` -ui/ -├─ src/ -│ ├─ lib.rs # The entrypoint for the ui crate -│ ├─ hero.rs # The Hero component that will be used in every platform -│ ├─ echo.rs # The shared echo component that communicates with the server -│ ├─ navbar.rs # The Navbar component that will be used in the layout of every platform's router -``` - -## Dependencies - -Since this crate is shared between multiple platforms, it should not pull in any platform specific dependencies. For example, if you want to use the `web_sys` crate in the web build of your app, you should not add it to this crate. Instead, you should add platform specific dependencies to the [web](../web/Cargo.toml), [desktop](../desktop/Cargo.toml), or [mobile](../mobile/Cargo.toml) crates. diff --git a/ui/assets/styling/echo.css b/ui/assets/styling/echo.css deleted file mode 100644 index 67d9b2b..0000000 --- a/ui/assets/styling/echo.css +++ /dev/null @@ -1,34 +0,0 @@ -#echo { - width: 360px; - margin-left: auto; - margin-right: auto; - margin-top: 50px; - background-color: #1e222d; - padding: 20px; - border-radius: 10px; -} - -#echo>h4 { - margin: 0px 0px 15px 0px; -} - - -#echo>input { - border: none; - border-bottom: 1px white solid; - background-color: transparent; - color: #ffffff; - transition: border-bottom-color 0.2s ease; - outline: none; - display: block; - padding: 0px 0px 5px 0px; - width: 100%; -} - -#echo>input:focus { - border-bottom-color: #6d85c6; -} - -#echo>p { - margin: 20px 0px 0px auto; -} \ No newline at end of file diff --git a/ui/assets/styling/hero.css b/ui/assets/styling/hero.css deleted file mode 100644 index 79db803..0000000 --- a/ui/assets/styling/hero.css +++ /dev/null @@ -1,35 +0,0 @@ -#hero { - margin: 0; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -#links { - width: 400px; - text-align: left; - font-size: x-large; - color: white; - display: flex; - flex-direction: column; -} - -#links a { - color: white; - text-decoration: none; - margin-top: 20px; - margin: 10px 0px; - border: white 1px solid; - border-radius: 5px; - padding: 10px; -} - -#links a:hover { - background-color: #1f1f1f; - cursor: pointer; -} - -#header { - max-width: 1200px; -} \ No newline at end of file diff --git a/ui/assets/styling/navbar.css b/ui/assets/styling/navbar.css deleted file mode 100644 index 7372c63..0000000 --- a/ui/assets/styling/navbar.css +++ /dev/null @@ -1,16 +0,0 @@ -#navbar { - display: flex; - flex-direction: row; -} - -#navbar a { - color: #ffffff; - margin-right: 20px; - text-decoration: none; - transition: color 0.2s ease; -} - -#navbar a:hover { - cursor: pointer; - color: #91a4d2; -} \ No newline at end of file diff --git a/ui/src/echo.rs b/ui/src/echo.rs deleted file mode 100644 index a4f1bc2..0000000 --- a/ui/src/echo.rs +++ /dev/null @@ -1,31 +0,0 @@ -use dioxus::prelude::*; - -const ECHO_CSS: Asset = asset!("/assets/styling/echo.css"); - -/// Echo component that demonstrates fullstack server functions. -#[component] -pub fn Echo() -> Element { - let mut response = use_signal(|| String::new()); - - rsx! { - document::Link { rel: "stylesheet", href: ECHO_CSS } - div { - id: "echo", - h4 { "ServerFn Echo" } - input { - placeholder: "Type here to echo...", - oninput: move |event| async move { - let data = api::echo(event.value()).await.unwrap(); - response.set(data); - }, - } - - if !response().is_empty() { - p { - "Server echoed: " - i { "{response}" } - } - } - } - } -} diff --git a/ui/src/hero.rs b/ui/src/hero.rs deleted file mode 100644 index d05991a..0000000 --- a/ui/src/hero.rs +++ /dev/null @@ -1,24 +0,0 @@ -use dioxus::prelude::*; - -const HERO_CSS: Asset = asset!("/assets/styling/hero.css"); -const HEADER_SVG: Asset = asset!("/assets/header.svg"); - -#[component] -pub fn Hero() -> Element { - rsx! { - document::Link { rel: "stylesheet", href: HERO_CSS } - - div { - id: "hero", - img { src: HEADER_SVG, id: "header" } - div { id: "links", - a { href: "https://dioxuslabs.com/learn/0.6/", "📚 Learn Dioxus" } - a { href: "https://dioxuslabs.com/awesome", "🚀 Awesome Dioxus" } - a { href: "https://github.com/dioxus-community/", "📡 Community Libraries" } - a { href: "https://github.com/DioxusLabs/sdk", "⚙️ Dioxus Development Kit" } - a { href: "https://marketplace.visualstudio.com/items?itemName=DioxusLabs.dioxus", "💫 VSCode Extension" } - a { href: "https://discord.gg/XgGxMSkvUM", "👋 Community Discord" } - } - } - } -} diff --git a/ui/src/lib.rs b/ui/src/lib.rs deleted file mode 100644 index 4dc74a5..0000000 --- a/ui/src/lib.rs +++ /dev/null @@ -1,10 +0,0 @@ -//! This crate contains all shared UI for the workspace. - -mod hero; -pub use hero::Hero; - -mod navbar; -pub use navbar::Navbar; - -mod echo; -pub use echo::Echo; diff --git a/ui/src/navbar.rs b/ui/src/navbar.rs deleted file mode 100644 index c169782..0000000 --- a/ui/src/navbar.rs +++ /dev/null @@ -1,15 +0,0 @@ -use dioxus::prelude::*; - -const NAVBAR_CSS: Asset = asset!("/assets/styling/navbar.css"); - -#[component] -pub fn Navbar(children: Element) -> Element { - rsx! { - document::Link { rel: "stylesheet", href: NAVBAR_CSS } - - div { - id: "navbar", - {children} - } - } -} diff --git a/web/Cargo.toml b/web/Cargo.toml deleted file mode 100644 index 42b273f..0000000 --- a/web/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "web" -version = "0.1.0" -edition = "2021" - -[dependencies] -dioxus = { workspace = true, features = ["router"] } -ui = { workspace = true } - -[features] -default = [] -web = ["dioxus/web"] -server = ["dioxus/server"] diff --git a/web/README.md b/web/README.md deleted file mode 100644 index f533f8d..0000000 --- a/web/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Development - -The web crate defines the entrypoint for the web app along with any assets, components and dependencies that are specific to web builds. The web crate starts out something like this: - -``` -web/ -├─ assets/ # Assets used by the web app - Any platform specific assets should go in this folder -├─ src/ -│ ├─ main.rs # The entrypoint for the web app.It also defines the routes for the web platform -│ ├─ views/ # The views each route will render in the web version of the app -│ │ ├─ mod.rs # Defines the module for the views route and re-exports the components for each route -│ │ ├─ blog.rs # The component that will render at the /blog/:id route -│ │ ├─ home.rs # The component that will render at the / route -├─ Cargo.toml # The web crate's Cargo.toml - This should include all web specific dependencies -``` - -## Dependencies -Since you have fullstack enabled, the web crate will be built two times: -1. Once for the server build with the `server` feature enabled -2. Once for the client build with the `web` feature enabled - -You should make all web specific dependencies optional and only enabled in the `web` feature. This will ensure that the server builds don't pull in web specific dependencies which cuts down on build times significantly. - -### Serving Your Web App - -You can start your web app with the following command: - -```bash -dx serve -``` diff --git a/web/assets/blog.css b/web/assets/blog.css deleted file mode 100644 index f27f060..0000000 --- a/web/assets/blog.css +++ /dev/null @@ -1,8 +0,0 @@ -#blog { - margin-top: 50px; -} - -#blog a { - color: #ffffff; - margin-top: 50px; -} \ No newline at end of file diff --git a/web/assets/main.css b/web/assets/main.css deleted file mode 100644 index ef6e674..0000000 --- a/web/assets/main.css +++ /dev/null @@ -1,6 +0,0 @@ -body { - background-color: #0f1116; - color: #ffffff; - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - margin: 20px; -} \ No newline at end of file diff --git a/web/src/main.rs b/web/src/main.rs deleted file mode 100644 index 9947932..0000000 --- a/web/src/main.rs +++ /dev/null @@ -1,56 +0,0 @@ -use dioxus::prelude::*; - -use ui::Navbar; -use views::{Blog, Home}; - -mod views; - -#[derive(Debug, Clone, Routable, PartialEq)] -#[rustfmt::skip] -enum Route { - #[layout(WebNavbar)] - #[route("/")] - Home {}, - #[route("/blog/:id")] - Blog { id: i32 }, -} - -const FAVICON: Asset = asset!("/assets/favicon.ico"); -const MAIN_CSS: Asset = asset!("/assets/main.css"); - -fn main() { - dioxus::launch(App); -} - -#[component] -fn App() -> Element { - // Build cool things ✌️ - - rsx! { - // Global app resources - document::Link { rel: "icon", href: FAVICON } - document::Link { rel: "stylesheet", href: MAIN_CSS } - - Router:: {} - } -} - -/// A web-specific Router around the shared `Navbar` component -/// which allows us to use the web-specific `Route` enum. -#[component] -fn WebNavbar() -> Element { - rsx! { - Navbar { - Link { - to: Route::Home {}, - "Home" - } - Link { - to: Route::Blog { id: 1 }, - "Blog" - } - } - - Outlet:: {} - } -} diff --git a/web/src/views/blog.rs b/web/src/views/blog.rs deleted file mode 100644 index c114f5e..0000000 --- a/web/src/views/blog.rs +++ /dev/null @@ -1,30 +0,0 @@ -use crate::Route; -use dioxus::prelude::*; - -const BLOG_CSS: Asset = asset!("/assets/blog.css"); - -#[component] -pub fn Blog(id: i32) -> Element { - rsx! { - document::Link { rel: "stylesheet", href: BLOG_CSS} - - div { - id: "blog", - - // Content - h1 { "This is blog #{id}!" } - p { "In blog #{id}, we show how the Dioxus router works and how URL parameters can be passed as props to our route components." } - - // Navigation links - Link { - to: Route::Blog { id: id - 1 }, - "Previous" - } - span { " <---> " } - Link { - to: Route::Blog { id: id + 1 }, - "Next" - } - } - } -} diff --git a/web/src/views/home.rs b/web/src/views/home.rs deleted file mode 100644 index 5ea3370..0000000 --- a/web/src/views/home.rs +++ /dev/null @@ -1,10 +0,0 @@ -use dioxus::prelude::*; -use ui::{Echo, Hero}; - -#[component] -pub fn Home() -> Element { - rsx! { - Hero {} - Echo {} - } -} diff --git a/web/src/views/mod.rs b/web/src/views/mod.rs deleted file mode 100644 index b3fe26b..0000000 --- a/web/src/views/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod home; -pub use home::Home; - -mod blog; -pub use blog::Blog;