diff --git a/.gitignore b/.gitignore index fc17bb46..6fcdc572 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ crates/*/target /.vscode /benches/target *.code-workspace + +/website/dist diff --git a/Cargo.lock b/Cargo.lock index e10a6993..21b45c6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,6 +297,12 @@ version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + [[package]] name = "approx" version = "0.5.1" @@ -427,7 +433,7 @@ dependencies = [ "async-lock", "async-task", "concurrent-queue", - "fastrand", + "fastrand 1.9.0", "futures-lite", "slab", ] @@ -715,7 +721,7 @@ dependencies = [ "bevy_winit", "crossbeam-channel", "downcast-rs", - "fastrand", + "fastrand 1.9.0", "js-sys", "parking_lot 0.12.1", "serde", @@ -1440,11 +1446,17 @@ dependencies = [ "async-lock", "async-task", "atomic-waker", - "fastrand", + "fastrand 1.9.0", "futures-lite", "log", ] +[[package]] +name = "boolinator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" + [[package]] name = "bumpalo" version = "3.13.0" @@ -2016,6 +2028,12 @@ dependencies = [ "signature", ] +[[package]] +name = "either" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" + [[package]] name = "elliptic-curve" version = "0.12.3" @@ -2146,6 +2164,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "fdeflate" version = "0.3.0" @@ -2271,7 +2295,7 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", @@ -2434,6 +2458,132 @@ dependencies = [ "serde", ] +[[package]] +name = "gloo" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" +dependencies = [ + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file", + "gloo-history", + "gloo-net", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils", + "gloo-worker", +] + +[[package]] +name = "gloo-console" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" +dependencies = [ + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-history" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfd137a4b629e72b8c949ec56c71ea9bd5491cc66358a0a7787e94875feec71" +dependencies = [ + "gloo-events", + "gloo-utils", + "serde", + "serde-wasm-bindgen", + "serde_urlencoded", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3000ef231a67d5bfee6b35f2c0f6f5c8d45b3381ef5bbbea603690ec4e539762" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "http", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gloo-timers" version = "0.2.6" @@ -2446,6 +2596,36 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gloo-utils" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-worker" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" +dependencies = [ + "anymap2", + "bincode", + "gloo-console", + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "glow" version = "0.12.2" @@ -2756,6 +2936,15 @@ dependencies = [ "png", ] +[[package]] +name = "implicit-clone" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40fc102e70475c320b185cd18c1e48bba2d7210b63970a4d581ef903e4368ef7" +dependencies = [ + "indexmap", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -2841,6 +3030,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.6" @@ -2925,6 +3123,15 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "litrs" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f17c3668f3cc1132437cdadc93dab05e52d592f06948d3f64828430c36e4a70" +dependencies = [ + "proc-macro2", +] + [[package]] name = "lock_api" version = "0.4.10" @@ -3575,6 +3782,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pinned" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b" +dependencies = [ + "futures", + "rustversion", + "thiserror", +] + [[package]] name = "pkcs8" version = "0.9.0" @@ -3653,6 +3871,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -3663,6 +3891,30 @@ dependencies = [ "toml_edit", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.60" @@ -3678,6 +3930,23 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "332cd62e95873ea4f41f3dfd6bbbfc5b52aec892d7e8d534197c4720a0bbbab2" +[[package]] +name = "prokio" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488" +dependencies = [ + "futures", + "gloo", + "num_cpus", + "once_cell", + "pin-project", + "pinned", + "tokio", + "tokio-stream", + "wasm-bindgen-futures", +] + [[package]] name = "quote" version = "1.0.28" @@ -4288,6 +4557,53 @@ dependencies = [ "webrtc-util", ] +[[package]] +name = "stylist" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d46ee215e84089a9f648d5d77fb21fa5c34f187b88377e9c080ee41940dc9c33" +dependencies = [ + "fastrand 2.0.0", + "instant", + "once_cell", + "serde", + "stylist-core", + "stylist-macros", + "wasm-bindgen", + "web-sys", + "yew", +] + +[[package]] +name = "stylist-core" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "805ae52bc4eb164abd0953acdcacca2eefae3e39b21cbc6616ce9ac3c5d4c222" +dependencies = [ + "nom", + "once_cell", + "serde", + "thiserror", + "wasm-bindgen", +] + +[[package]] +name = "stylist-macros" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a37d492603237395c6d8367ae9d3bd473726c9ec0daf238b1fc58a4c6d087ec" +dependencies = [ + "itertools", + "litrs", + "log", + "nom", + "proc-macro-error", + "proc-macro2", + "quote", + "stylist-core", + "syn 1.0.109", +] + [[package]] name = "substring" version = "1.4.5" @@ -5202,6 +5518,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "website" +version = "0.1.0" +dependencies = [ + "bevy_ggrs_example", + "stylist", + "yew", +] + [[package]] name = "wgpu" version = "0.15.1" @@ -5643,6 +5968,46 @@ dependencies = [ "time", ] +[[package]] +name = "yew" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dbecfe44343b70cc2932c3eb445425969ae21754a8ab3a0966981c1cf7af1cc" +dependencies = [ + "console_error_panic_hook", + "futures", + "gloo", + "implicit-clone", + "indexmap", + "js-sys", + "prokio", + "rustversion", + "serde", + "slab", + "thiserror", + "tokio", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "yew-macro", +] + +[[package]] +name = "yew-macro" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64c253c1d401f1ea868ca9988db63958cfa15a69f739101f338d6f05eea8301" +dependencies = [ + "boolinator", + "once_cell", + "prettyplease", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "zeroize" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index a26270c6..6c2aef45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "matchbox_socket", "matchbox_server", "matchbox_signaling", + "website", "examples/*", ] resolver = "2" # Important! Bevy/WGPU needs this! diff --git a/website/Cargo.toml b/website/Cargo.toml new file mode 100644 index 00000000..02600ce5 --- /dev/null +++ b/website/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "website" +version = "0.1.0" +authors = [ + "Johan Helsing ", + "Garry O'Donnell ", +] +edition = "2021" +description = "A Website for Matchbox WebRtc networking" +license = "MIT OR Apache-2.0" +repository = "https://github.com/johanhelsing/matchbox" +homepage = "https://github.com/johanhelsing/matchbox" +readme = "../README.md" + +[dependencies] +bevy_ggrs_example = { path = "../examples/bevy_ggrs" } +stylist = { version = "0.12.1", features = ["yew"] } +yew = { version = "0.20.0", features = ["csr"] } diff --git a/website/Trunk.toml b/website/Trunk.toml new file mode 100644 index 00000000..8d8f852d --- /dev/null +++ b/website/Trunk.toml @@ -0,0 +1,2 @@ +[build] +target = "index.html" diff --git a/website/index.html b/website/index.html new file mode 100644 index 00000000..b977824a --- /dev/null +++ b/website/index.html @@ -0,0 +1,67 @@ + + + + + + Loading... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bevy + + + + + + + + + \ No newline at end of file diff --git a/website/src/main.rs b/website/src/main.rs new file mode 100644 index 00000000..e8300db7 --- /dev/null +++ b/website/src/main.rs @@ -0,0 +1,42 @@ +use stylist::{global_style, yew::styled_component}; +use yew::{html, Html}; + +#[styled_component(Root)] +fn root() -> Html { + global_style!( + r#" + html { + min-height: 100%; + position: relative; + } + + body { + height: 100%; + padding: 0; + margin: 0; + } + "# + ) + .expect("Unable to mount global style"); + + let css = css!( + r#" + position: absolute; + overflow: hidden; + width: 100%; + height: 100%; + "# + ); + + html! { +
+ +
+ + } +} + +fn main() { + yew::Renderer::::new().render(); + bevy_ggrs_example_lib::run(); +} diff --git a/website/static/banner.png b/website/static/banner.png new file mode 120000 index 00000000..4e2baa82 --- /dev/null +++ b/website/static/banner.png @@ -0,0 +1 @@ +../../images/matchbox_logo.png \ No newline at end of file diff --git a/website/static/favicon.png b/website/static/favicon.png new file mode 120000 index 00000000..77a7057d --- /dev/null +++ b/website/static/favicon.png @@ -0,0 +1 @@ +../../images/favicon.png \ No newline at end of file