Feat: more docs, example, mroe nodes

This commit is contained in:
Jonathan Kelley committed 2021-01-15 23:25:29 -05:00
1 parent 152bced9f3
commit d13e04c9ff
14 files changed
+303 -34

No files matched your search

+5 -3
View File
@@ -8,10 +8,12 @@ edition = "2018"
[dependencies]
generational-arena = "0.2.8"
typed-arena = "2.0.1"
virtual-dom-rs = { path = "../virtual-dom-rs" }
virtual-node = { path = "../virtual-node" }
html-macro = { path = "../html-macro" }
once_cell = "1.5.2"
# web-sys = "0.3.46"
# js-sys = "0.3.46"
# typed-arena = "2.0.1"
# virtual-dom-rs = { path = "../virtual-dom-rs" }
# virtual-node = { path = "../virtual-node" }
+10 -1
View File
@@ -1,7 +1,7 @@
use std::future::Future;
use dioxus_core::{component::AnyContext, prelude::*};
use virtual_dom_rs::Closure;
// use virtual_dom_rs::Closure;
// Stop-gap while developing
// Need to update the macro
@@ -27,9 +27,18 @@ fn root(ctx: &mut AnyContext) -> VNode {
// or a manually crated vnode
{
let mut node_0 = VNode::element("div");
{
if let Some(ref mut element_node) = node_0.as_velement_mut() {
// element_node.attrs.insert("blah", "blah");
// element_node.children.extend(node_0.into_iter());
}
}
let mut node_1: IterableNodes = ("Hello world!").into();
node_1.first().insert_space_before_text();
let mut node_2 = VNode::element("button");
let node_3 = VNode::Component(VComponent {});
{
// let closure = Closure::wrap(Box::new(|_| {}) as Box<FnMut(_)>);
// let closure_rc = std::rc::Rc::new(closure);
+5
View File
@@ -25,6 +25,9 @@ pub mod prelude {
pub use nodes::iterables::IterableNodes;
pub use nodes::*;
// hack "virtualnode"
pub type VirtualNode = VNode;
// Re-export from the macro crate
pub use html_macro::html;
}
@@ -262,6 +265,8 @@ pub mod nodes {
/// HTML attributes such as id, class, style, etc
pub attrs: HashMap<String, String>,
// TODO: @JON Get this to not heap allocate, but rather borrow
// pub attrs: HashMap<&'static str, &'static str>,
// TODO @Jon, re-enable "events"
//
+9
View File
@@ -0,0 +1,9 @@
[package]
name = "dioxus-ssr"
version = "0.0.0"
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+7
View File
@@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}