Feat: more docs, example, mroe nodes
This commit is contained in:
1 parent
152bced9f3
commit
d13e04c9ff
14 files changed
+303
-34
No files matched your search
@@ -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" }
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
//
|
||||
|
||||
@@ -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]
|
||||
@@ -0,0 +1,7 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user