Merge branch 'master' into jk/windows-desktop
This commit is contained in:
commit
be2d6876ab
12 files changed
+48
-70
No files matched your search
+7
-7
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dioxus"
|
name = "dioxus"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
authors = ["Jonathan Kelley"]
|
authors = ["Jonathan Kelley"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
|
description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
|
||||||
@@ -11,13 +11,13 @@ documentation = "https://dioxuslabs.com"
|
|||||||
keywords = ["dom", "ui", "gui", "react", "wasm"]
|
keywords = ["dom", "ui", "gui", "react", "wasm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dioxus-core = { path = "./packages/core", version = "^0.1.4" }
|
dioxus-core = { path = "./packages/core", version = "^0.1.6" }
|
||||||
dioxus-html = { path = "./packages/html", version = "^0.1.1", optional = true }
|
dioxus-html = { path = "./packages/html", version = "^0.1.3", optional = true }
|
||||||
dioxus-core-macro = { path = "./packages/core-macro", version = "^0.1.3", optional = true }
|
dioxus-core-macro = { path = "./packages/core-macro", version = "^0.1.5", optional = true }
|
||||||
dioxus-hooks = { path = "./packages/hooks", version = "^0.1.4", optional = true }
|
dioxus-hooks = { path = "./packages/hooks", version = "^0.1.5", optional = true }
|
||||||
|
|
||||||
dioxus-web = { path = "./packages/web", version = "^0.0.2", optional = true }
|
dioxus-web = { path = "./packages/web", version = "^0.0.3", optional = true }
|
||||||
dioxus-desktop = { path = "./packages/desktop", version = "^0.1.1", optional = true }
|
dioxus-desktop = { path = "./packages/desktop", version = "^0.1.3", optional = true }
|
||||||
dioxus-ssr = { path = "./packages/ssr", version = "0.1.1", optional = true }
|
dioxus-ssr = { path = "./packages/ssr", version = "0.1.1", optional = true }
|
||||||
|
|
||||||
# dioxus-router = { path = "./packages/router", optional = true }
|
# dioxus-router = { path = "./packages/router", optional = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dioxus-core-macro"
|
name = "dioxus-core-macro"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
authors = ["Jonathan Kelley"]
|
authors = ["Jonathan Kelley"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Core macro for Dioxus Virtual DOM"
|
description = "Core macro for Dioxus Virtual DOM"
|
||||||
|
|||||||
@@ -204,9 +204,9 @@ impl ToTokens for Element {
|
|||||||
tokens.append_all(quote! {
|
tokens.append_all(quote! {
|
||||||
__cx.element(
|
__cx.element(
|
||||||
dioxus_elements::#name,
|
dioxus_elements::#name,
|
||||||
[ #(#listeners),* ],
|
__cx.bump().alloc([ #(#listeners),* ]),
|
||||||
[ #(#attr),* ],
|
__cx.bump().alloc([ #(#attr),* ]),
|
||||||
[ #(#children),* ],
|
__cx.bump().alloc([ #(#children),* ]),
|
||||||
#key,
|
#key,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dioxus-core"
|
name = "dioxus-core"
|
||||||
version = "0.1.5"
|
version = "0.1.6"
|
||||||
authors = ["Jonathan Kelley"]
|
authors = ["Jonathan Kelley"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
|
description = "Core functionality for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
|
||||||
|
|||||||
+23
-45
@@ -75,7 +75,7 @@ pub enum VNode<'src> {
|
|||||||
/// Example {}
|
/// Example {}
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
Fragment(VFragment<'src>),
|
Fragment(&'src VFragment<'src>),
|
||||||
|
|
||||||
/// Component nodes represent a mounted component with props, children, and a key.
|
/// Component nodes represent a mounted component with props, children, and a key.
|
||||||
///
|
///
|
||||||
@@ -156,15 +156,12 @@ impl<'src> VNode<'src> {
|
|||||||
|
|
||||||
// Create an "owned" version of the vnode.
|
// Create an "owned" version of the vnode.
|
||||||
pub fn decouple(&self) -> VNode<'src> {
|
pub fn decouple(&self) -> VNode<'src> {
|
||||||
match self {
|
match *self {
|
||||||
VNode::Text(t) => VNode::Text(*t),
|
VNode::Text(t) => VNode::Text(t),
|
||||||
VNode::Element(e) => VNode::Element(*e),
|
VNode::Element(e) => VNode::Element(e),
|
||||||
VNode::Component(c) => VNode::Component(*c),
|
VNode::Component(c) => VNode::Component(c),
|
||||||
VNode::Placeholder(a) => VNode::Placeholder(*a),
|
VNode::Placeholder(a) => VNode::Placeholder(a),
|
||||||
VNode::Fragment(f) => VNode::Fragment(VFragment {
|
VNode::Fragment(f) => VNode::Fragment(f),
|
||||||
children: f.children,
|
|
||||||
key: f.key,
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,19 +444,14 @@ impl<'a> NodeFactory<'a> {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn element<L, A, V>(
|
pub fn element(
|
||||||
&self,
|
&self,
|
||||||
el: impl DioxusElement,
|
el: impl DioxusElement,
|
||||||
listeners: L,
|
listeners: &'a [Listener<'a>],
|
||||||
attributes: A,
|
attributes: &'a [Attribute<'a>],
|
||||||
children: V,
|
children: &'a [VNode<'a>],
|
||||||
key: Option<Arguments>,
|
key: Option<Arguments>,
|
||||||
) -> VNode<'a>
|
) -> VNode<'a> {
|
||||||
where
|
|
||||||
L: 'a + AsRef<[Listener<'a>]>,
|
|
||||||
A: 'a + AsRef<[Attribute<'a>]>,
|
|
||||||
V: 'a + AsRef<[VNode<'a>]>,
|
|
||||||
{
|
|
||||||
self.raw_element(
|
self.raw_element(
|
||||||
el.tag_name(),
|
el.tag_name(),
|
||||||
el.namespace(),
|
el.namespace(),
|
||||||
@@ -470,29 +462,15 @@ impl<'a> NodeFactory<'a> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn raw_element<L, A, V>(
|
pub fn raw_element(
|
||||||
&self,
|
&self,
|
||||||
tag_name: &'static str,
|
tag_name: &'static str,
|
||||||
namespace: Option<&'static str>,
|
namespace: Option<&'static str>,
|
||||||
listeners: L,
|
listeners: &'a [Listener<'a>],
|
||||||
attributes: A,
|
attributes: &'a [Attribute<'a>],
|
||||||
children: V,
|
children: &'a [VNode<'a>],
|
||||||
key: Option<Arguments>,
|
key: Option<Arguments>,
|
||||||
) -> VNode<'a>
|
) -> VNode<'a> {
|
||||||
where
|
|
||||||
L: 'a + AsRef<[Listener<'a>]>,
|
|
||||||
A: 'a + AsRef<[Attribute<'a>]>,
|
|
||||||
V: 'a + AsRef<[VNode<'a>]>,
|
|
||||||
{
|
|
||||||
let listeners: &'a L = self.bump.alloc(listeners);
|
|
||||||
let listeners = listeners.as_ref();
|
|
||||||
|
|
||||||
let attributes: &'a A = self.bump.alloc(attributes);
|
|
||||||
let attributes = attributes.as_ref();
|
|
||||||
|
|
||||||
let children: &'a V = self.bump.alloc(children);
|
|
||||||
let children = children.as_ref();
|
|
||||||
|
|
||||||
let key = key.map(|f| self.raw_text(f).0);
|
let key = key.map(|f| self.raw_text(f).0);
|
||||||
|
|
||||||
VNode::Element(self.bump.alloc(VElement {
|
VNode::Element(self.bump.alloc(VElement {
|
||||||
@@ -574,10 +552,10 @@ impl<'a> NodeFactory<'a> {
|
|||||||
if nodes.is_empty() {
|
if nodes.is_empty() {
|
||||||
VNode::Placeholder(self.bump.alloc(VPlaceholder { id: empty_cell() }))
|
VNode::Placeholder(self.bump.alloc(VPlaceholder { id: empty_cell() }))
|
||||||
} else {
|
} else {
|
||||||
VNode::Fragment(VFragment {
|
VNode::Fragment(self.bump.alloc(VFragment {
|
||||||
children: nodes.into_bump_slice(),
|
children: nodes.into_bump_slice(),
|
||||||
key: None,
|
key: None,
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,10 +591,10 @@ impl<'a> NodeFactory<'a> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
VNode::Fragment(VFragment {
|
VNode::Fragment(self.bump.alloc(VFragment {
|
||||||
children,
|
children,
|
||||||
key: None,
|
key: None,
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,10 +617,10 @@ impl<'a> NodeFactory<'a> {
|
|||||||
} else {
|
} else {
|
||||||
let children = nodes.into_bump_slice();
|
let children = nodes.into_bump_slice();
|
||||||
|
|
||||||
Some(VNode::Fragment(VFragment {
|
Some(VNode::Fragment(self.bump.alloc(VFragment {
|
||||||
children,
|
children,
|
||||||
key: None,
|
key: None,
|
||||||
}))
|
})))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dioxus-desktop"
|
name = "dioxus-desktop"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
authors = ["Jonathan Kelley"]
|
authors = ["Jonathan Kelley"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Dioxus VirtualDOM renderer for a remote webview instance"
|
description = "Dioxus VirtualDOM renderer for a remote webview instance"
|
||||||
@@ -12,7 +12,7 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
|
|||||||
# 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", version = "^0.1.3", features = ["serialize"] }
|
dioxus-core = { path = "../core", version = "^0.1.6", features = ["serialize"] }
|
||||||
argh = "0.1.4"
|
argh = "0.1.4"
|
||||||
serde = "1.0.120"
|
serde = "1.0.120"
|
||||||
serde_json = "1.0.61"
|
serde_json = "1.0.61"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dioxus-hooks"
|
name = "dioxus-hooks"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
authors = ["Jonathan Kelley"]
|
authors = ["Jonathan Kelley"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Dioxus VirtualDOM renderer for a remote webview instance"
|
description = "Dioxus VirtualDOM renderer for a remote webview instance"
|
||||||
@@ -12,4 +12,4 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
|
|||||||
# 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 = "../../packages/core", version = "0.1.5" }
|
dioxus-core = { path = "../../packages/core", version = "^0.1.6" }
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dioxus-html"
|
name = "dioxus-html"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
authors = ["Jonathan Kelley"]
|
authors = ["Jonathan Kelley"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "HTML Element pack for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
|
description = "HTML Element pack for Dioxus - a concurrent renderer-agnostic Virtual DOM for interactive user experiences"
|
||||||
@@ -11,7 +11,7 @@ documentation = "https://docs.rs/dioxus"
|
|||||||
keywords = ["dom", "ui", "gui", "react", "wasm"]
|
keywords = ["dom", "ui", "gui", "react", "wasm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dioxus-core = { path = "../core", version = "^0.1.4" }
|
dioxus-core = { path = "../core", version = "^0.1.6" }
|
||||||
serde = { version = "1", features = ["derive"], optional = true }
|
serde = { version = "1", features = ["derive"], optional = true }
|
||||||
serde_repr = { version = "0.1", optional = true }
|
serde_repr = { version = "0.1", optional = true }
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
|
|||||||
# 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", version = "^0.1.3", default-features = false }
|
dioxus-core = { path = "../core", version = "^0.1.6", default-features = false }
|
||||||
dioxus-html = { path = "../html", version = "^0.1.0", default-features = false }
|
dioxus-html = { path = "../html", version = "^0.1.0", default-features = false }
|
||||||
dioxus-core-macro = { path = "../core-macro", version = "^0.1.2" }
|
dioxus-core-macro = { path = "../core-macro", version = "^0.1.2" }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dioxus-ssr"
|
name = "dioxus-ssr"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
authors = ["Jonathan Kelley"]
|
authors = ["Jonathan Kelley"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Dioxus render-to-string"
|
description = "Dioxus render-to-string"
|
||||||
@@ -13,7 +13,7 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
|
|||||||
# 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", version = "^0.1.3", features = ["serialize"] }
|
dioxus-core = { path = "../core", version = "^0.1.6", features = ["serialize"] }
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dioxus-web"
|
name = "dioxus-web"
|
||||||
version = "0.0.2"
|
version = "0.0.3"
|
||||||
authors = ["Jonathan Kelley"]
|
authors = ["Jonathan Kelley"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Dioxus VirtualDOM renderer for the web browser using websys"
|
description = "Dioxus VirtualDOM renderer for the web browser using websys"
|
||||||
@@ -11,7 +11,7 @@ documentation = "https://dioxuslabs.com"
|
|||||||
keywords = ["dom", "ui", "gui", "react", "wasm"]
|
keywords = ["dom", "ui", "gui", "react", "wasm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dioxus-core = { path = "../core", version = "^0.1.4" }
|
dioxus-core = { path = "../core", version = "^0.1.6" }
|
||||||
dioxus-html = { path = "../html", version = "^0.1.1" }
|
dioxus-html = { path = "../html", version = "^0.1.1" }
|
||||||
js-sys = "0.3"
|
js-sys = "0.3"
|
||||||
wasm-bindgen = { version = "0.2.78", features = ["enable-interning"] }
|
wasm-bindgen = { version = "0.2.78", features = ["enable-interning"] }
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use std::{any::Any, fmt::Debug, rc::Rc, sync::Arc};
|
|||||||
use wasm_bindgen::{closure::Closure, JsCast};
|
use wasm_bindgen::{closure::Closure, JsCast};
|
||||||
use web_sys::{
|
use web_sys::{
|
||||||
CssStyleDeclaration, Document, Element, Event, HtmlElement, HtmlInputElement,
|
CssStyleDeclaration, Document, Element, Event, HtmlElement, HtmlInputElement,
|
||||||
HtmlOptionElement, HtmlTextAreaElement, Node, NodeList,
|
HtmlOptionElement, HtmlTextAreaElement, Node,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{nodeslab::NodeSlab, WebConfig};
|
use crate::{nodeslab::NodeSlab, WebConfig};
|
||||||
@@ -49,7 +49,7 @@ impl WebsysDom {
|
|||||||
pub fn new(root: Element, cfg: WebConfig, sender_callback: Rc<dyn Fn(SchedulerMsg)>) -> Self {
|
pub fn new(root: Element, cfg: WebConfig, sender_callback: Rc<dyn Fn(SchedulerMsg)>) -> Self {
|
||||||
let document = load_document();
|
let document = load_document();
|
||||||
|
|
||||||
let mut nodes = NodeSlab::new(2000);
|
let nodes = NodeSlab::new(2000);
|
||||||
let listeners = FxHashMap::default();
|
let listeners = FxHashMap::default();
|
||||||
|
|
||||||
// re-hydrate the page - only supports one virtualdom per page
|
// re-hydrate the page - only supports one virtualdom per page
|
||||||
|
|||||||
Reference in new issue
Block a user