Merge branch 'master' into intigrate-collect-assets

This commit is contained in:
Evan Almloff committed 2023-09-17 19:40:14 -05:00
1 parent ffb5de91d1
commit f976e08f71
379 files changed
+1962 -13517

No files matched your search

+3 -2
View File
@@ -6,7 +6,7 @@ edition = "2018"
description = "Web renderer for Dioxus using websys"
license = "MIT OR Apache-2.0"
repository = "https://github.com/DioxusLabs/dioxus/"
homepage = "https://dioxuslabs.com/docs/0.3/guide/en/getting_started/web.html"
homepage = "https://dioxuslabs.com/learn/0.4/getting_started/wasm"
keywords = ["dom", "ui", "gui", "react", "wasm"]
[dependencies]
@@ -20,7 +20,7 @@ dioxus-interpreter-js = { workspace = true, features = [
js-sys = "0.3.56"
wasm-bindgen = { workspace = true, features = ["enable-interning"] }
wasm-bindgen-futures = "0.4.29"
log = { workspace = true }
tracing = { workspace = true }
rustc-hash = { workspace = true }
console_error_panic_hook = { version = "0.1.7", optional = true }
futures-util = { workspace = true, features = ["std", "async-await", "async-await-macro"] }
@@ -75,3 +75,4 @@ wasm-logger = "0.2.0"
gloo-timers = "0.2.3"
gloo-dialogs = "0.1.1"
dioxus-web = { path = ".", features = ["hydrate"] }
tracing-wasm = "0.2.1"
+2 -5
View File
@@ -7,18 +7,15 @@
[crates-badge]: https://img.shields.io/crates/v/dioxus-web.svg
[crates-url]: https://crates.io/crates/dioxus-web
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[mit-url]: https://github.com/dioxuslabs/dioxus/blob/master/LICENSE
[actions-badge]: https://github.com/dioxuslabs/dioxus/actions/workflows/main.yml/badge.svg
[actions-url]: https://github.com/dioxuslabs/dioxus/actions?query=workflow%3ACI+branch%3Amaster
[discord-badge]: https://img.shields.io/discord/899851952891002890.svg?logo=discord&style=flat-square
[discord-url]: https://discord.gg/XgGxMSkvUM
[Website](https://dioxuslabs.com) |
[Guides](https://dioxuslabs.com/docs/0.3/guide/en/) |
[Guides](https://dioxuslabs.com/learn/0.4/) |
[API Docs](https://docs.rs/dioxus-web/latest/dioxus_web) |
[Chat](https://discord.gg/XgGxMSkvUM)
@@ -36,6 +33,7 @@ Run Dioxus in the browser using WebAssembly.
- Join the discord and ask questions!
## License
This project is licensed under the [MIT license].
[mit license]: https://github.com/DioxusLabs/dioxus/blob/master/LICENSE-MIT
@@ -43,4 +41,3 @@ This project is licensed under the [MIT license].
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in Dioxus by you shall be licensed as MIT without any additional
terms or conditions.
+2 -2
View File
@@ -43,13 +43,13 @@ fn Bapp(cx: Scope) -> Element {
fn main() {
console_error_panic_hook::set_once();
wasm_logger::init(wasm_logger::Config::new(log::Level::Trace));
tracing_wasm::set_as_global_default();
let mut dom = VirtualDom::new(app);
let _ = dom.rebuild();
let pre = dioxus_ssr::pre_render(&dom);
log::trace!("{}", pre);
tracing::trace!("{}", pre);
// set the inner content of main to the pre-rendered content
window()
-1
View File
@@ -249,7 +249,6 @@ impl WebsysDom {
for id in to_mount {
let node = get_node(id.0 as u32);
if let Some(element) = node.dyn_ref::<Element>() {
log::info!("mounted event fired: {}", id.0);
let data: MountedData = element.into();
let data = Rc::new(data);
let _ = self.event_channel.unbounded_send(UiEvent {
+1 -1
View File
@@ -46,7 +46,7 @@ impl WebEvaluator {
Ok(data) => _ = channel_sender.send_blocking(data),
Err(e) => {
// Can't really do much here.
log::error!("failed to serialize JsValue to serde_json::Value (eval communication) - {}", e);
tracing::error!("failed to serialize JsValue to serde_json::Value (eval communication) - {}", e);
}
}
});
+4 -4
View File
@@ -170,7 +170,7 @@ pub fn launch_with_props<T: 'static>(
/// }
/// ```
pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_props: T, cfg: Config) {
log::info!("Starting up");
tracing::info!("Starting up");
let mut dom = VirtualDom::new_with_props(root, root_props);
@@ -205,7 +205,7 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
let mut websys_dom = dom::WebsysDom::new(cfg, tx);
log::info!("rebuilding app");
tracing::info!("rebuilding app");
if should_hydrate {
#[cfg(feature = "hydrate")]
@@ -217,7 +217,7 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
websys_dom.load_templates(&templates);
if let Err(err) = websys_dom.rehydrate(&dom) {
log::error!(
tracing::error!(
"Rehydration failed {:?}. Rebuild DOM into element from scratch",
&err
);
@@ -240,7 +240,7 @@ pub async fn run_with_props<T: 'static>(root: fn(Scope<T>) -> Element, root_prop
websys_dom.mount();
loop {
log::trace!("waiting for work");
tracing::trace!("waiting for work");
// if virtualdom has nothing, wait for it to have something before requesting idle time
// if there is work then this future resolves immediately.
+4 -4
View File
@@ -114,9 +114,9 @@ impl WebsysDom {
node: &TemplateNode,
last_node_was_static_text: &mut bool,
) -> Result<(), RehydrationError> {
log::trace!("rehydrate template node: {:?}", node);
tracing::trace!("rehydrate template node: {:?}", node);
if let Ok(current_child) = current_child {
if log::log_enabled!(log::Level::Trace) {
if tracing::event_enabled!(tracing::Level::TRACE) {
web_sys::console::log_1(&current_child.clone().into());
}
}
@@ -203,9 +203,9 @@ impl WebsysDom {
dynamic: &DynamicNode,
last_node_was_static_text: &mut bool,
) -> Result<(), RehydrationError> {
log::trace!("rehydrate dynamic node: {:?}", dynamic);
tracing::trace!("rehydrate dynamic node: {:?}", dynamic);
if let Ok(current_child) = current_child {
if log::log_enabled!(log::Level::Trace) {
if tracing::event_enabled!(tracing::Level::TRACE) {
web_sys::console::log_1(&current_child.clone().into());
}
}