Feat: update and prep for dioxusweb

This commit is contained in:
Jonathan Kelley 2021-02-28 17:22:23 -05:00
parent 3b30fa61b8
commit ab655eac97
4 changed files with 11 additions and 5 deletions

View file

@ -355,3 +355,8 @@ fn component(ctx: Context, props: &Props) -> DomTree {
``` ```
The DomTree object purely represents a viewable "key". It also forces components to use the "view" function as there is no other way to generate the DomTree object. Because the DomTree is a required type of FC, we can guarantee the same usage and flow patterns for all components. The DomTree object purely represents a viewable "key". It also forces components to use the "view" function as there is no other way to generate the DomTree object. Because the DomTree is a required type of FC, we can guarantee the same usage and flow patterns for all components.
## Events
Events are finally in! To do events properly, we are abstracting over the event source with synthetic events. This forces 3rd party renderers to create the appropriate cross-platform event

View file

@ -3,11 +3,12 @@ name = "dioxus-web"
version = "0.0.0" version = "0.0.0"
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"] authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
edition = "2018" edition = "2018"
description = "Dioxus VirtualDOM renderer for the web browser using websys"
license = "MIT/Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
dioxus-core = { path = "../core" } dioxus-core = { path = "../core", version = "0.1.0" }
js-sys = "0.3" js-sys = "0.3"
wasm-bindgen = "0.2.69" wasm-bindgen = "0.2.69"
# wasm-bindgen = "0.2.70" # wasm-bindgen = "0.2.70"
@ -20,6 +21,7 @@ fxhash = "0.2.1"
pretty_env_logger = "0.4.0" pretty_env_logger = "0.4.0"
console_error_panic_hook = "0.1.6" console_error_panic_hook = "0.1.6"
generational-arena = "0.2.8" generational-arena = "0.2.8"
wasm-bindgen-test = "0.3.21"
# html-validation = { path = "../html-validation", version = "0.1.1" } # html-validation = { path = "../html-validation", version = "0.1.1" }
[dependencies.web-sys] [dependencies.web-sys]

View file

@ -39,14 +39,14 @@ static Example: FC<()> = |ctx, props| {
// Control buttons // Control buttons
<div> <div>
<button <button
class="inline-block py-4 px-8 mr-6 leading-none text-white bg-indigo-600 hover:bg-indigo-700 font-semibold rounded shadow" class="inline-block py-4 px-8 mr-6 leading-none text-white bg-indigo-600 hover:bg-indigo-900 font-semibold rounded shadow"
// onclick={move |_| log::debug!("set jack")}> // onclick={move |_| log::debug!("set jack")}>
onclick={move |_| set_name("jack")}> onclick={move |_| set_name("jack")}>
"Jack!" "Jack!"
</button> </button>
<button <button
class="inline-block py-4 px-8 mr-6 leading-none text-white bg-indigo-600 hover:bg-indigo-700 font-semibold rounded shadow" class="inline-block py-4 px-8 mr-6 leading-none text-white bg-indigo-600 hover:bg-indigo-900 font-semibold rounded shadow"
// onclick={move |_| log::debug!("set jill")}> // onclick={move |_| log::debug!("set jill")}>
onclick={move |_| set_name("jill")} onclick={move |_| set_name("jill")}
onclick={move |_| set_name("jill")}> onclick={move |_| set_name("jill")}>

View file

@ -161,7 +161,6 @@ mod tests {
use dioxus_core as dioxus; use dioxus_core as dioxus;
use dioxus_core::prelude::html; use dioxus_core::prelude::html;
#[test]
fn simple_patch() { fn simple_patch() {
env::set_var("RUST_LOG", "trace"); env::set_var("RUST_LOG", "trace");
pretty_env_logger::init(); pretty_env_logger::init();