wip: prepare to change our fragment pattern. Add some more docs

This commit is contained in:
Jonathan Kelley committed 2021-12-18 15:17:32 -05:00
1 parent 2b928372fb
commit 2c3a046426
10 files changed
+108 -71

No files matched your search

+2 -1
View File
@@ -51,9 +51,10 @@ dioxus-html = { path = "../html" }
fern = { version = "0.6.0", features = ["colored"] }
rand = { version = "0.8.4", features = ["small_rng"] }
simple_logger = "1.13.0"
dioxus-core-macro = { path = "../core-macro", version ="^0.1.2"}
dioxus-core-macro = { path = "../core-macro", version = "^0.1.2" }
# dioxus-hooks = { path = "../hooks" }
criterion = "0.3.5"
thiserror = "1.0.30"
[features]
default = []
+10
View File
@@ -0,0 +1,10 @@
//! Handling errors and early aborts
//!
//!
//!
//!
use dioxus_core::prelude::*;
use thiserror::Error;
fn main() {}
+40
View File
@@ -20,7 +20,47 @@ pub(crate) mod innerlude {
pub(crate) use crate::scopearena::*;
pub use crate::virtual_dom::*;
/// An [`Element`] is a possibly-none [`VNode`] created by calling `render` on [`Scope`] or [`ScopeState`].
///
/// Any [`None`] [`Element`] will automatically be coerced into a placeholder [`VNode`] with the [`VNode::Placeholder`] variant.
pub type Element<'a> = Option<VNode<'a>>;
/// A [`Component`] is a function that takes a [`Scope`] and returns an [`Element`].
///
/// Components can be used in other components with two syntax options:
/// - lowercase as a function call with named arguments (rust style)
/// - uppercase as an element (react style)
///
/// ## Rust-Style
///
/// ```rust
/// fn example(cx: Scope<Props>) -> Element {
/// // ...
/// }
///
/// rsx!(
/// example()
/// )
/// ```
/// ## React-Style
/// ```rust
/// fn Example(cx: Scope<Props>) -> Element {
/// // ...
/// }
///
/// rsx!(
/// Example {}
/// )
/// ```
///
/// ## As a closure
/// This particular type alias lets you even use static closures for pure/static components:
///
/// ```rust
/// static Example: Component<Props> = |cx| {
/// // ...
/// };
/// ```
pub type Component<P> = for<'a> fn(Scope<'a, P>) -> Element<'a>;
}
+3 -3
View File
@@ -1,6 +1,6 @@
[package]
name = "dioxus-desktop"
version = "0.0.0"
version = "0.1.0"
authors = ["Jonathan Kelley"]
edition = "2018"
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
[dependencies]
dioxus-core = { path = "../core", version ="^0.1.3", features = ["serialize"] }
dioxus-core = { path = "../core", version = "^0.1.3", features = ["serialize"] }
argh = "0.1.4"
serde = "1.0.120"
serde_json = "1.0.61"
@@ -20,7 +20,7 @@ thiserror = "1.0.23"
log = "0.4.13"
html-escape = "0.2.9"
wry = "0.12.2"
futures-channel = "0.3.18"
futures-channel = "0.3"
tokio = { version = "1.12.0", features = [
"sync",
"rt-multi-thread",
+10 -14
View File
@@ -1,16 +1,10 @@
//! Dioxus Desktop Renderer
//!
//! Render the Dioxus VirtualDom using the platform's native WebView implementation.
//!
mod cfg;
mod escape;
mod events;
pub use wry;
pub use wry::application as tao;
// mod desktop_context;
use cfg::DesktopConfig;
use dioxus_core::*;
use std::{
@@ -18,15 +12,17 @@ use std::{
sync::atomic::AtomicBool,
sync::{Arc, RwLock},
};
use tao::{
accelerator::{Accelerator, SysMods},
event::{Event, StartCause, WindowEvent},
event_loop::{ControlFlow, EventLoop, EventLoopWindowTarget},
keyboard::{KeyCode, ModifiersState},
menu::{MenuBar, MenuItem},
window::{Window, WindowId},
};
pub use wry;
pub use wry::application as tao;
use wry::{
application::{
accelerator::{Accelerator, SysMods},
event::{Event, StartCause, WindowEvent},
event_loop::{ControlFlow, EventLoop, EventLoopWindowTarget},
keyboard::{KeyCode, ModifiersState},
menu::{MenuBar, MenuItem},
window::{Window, WindowId},
},
webview::RpcRequest,
webview::{WebView, WebViewBuilder},
};
+1 -2
View File
@@ -12,8 +12,7 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dioxus-core = { path = "../core", version ="^0.1.3"}
# Serialize the Edits for use in Webview/Liveview instances
dioxus-core = { path = "../core", version = "^0.1.3" }
serde = { version = "1", features = ["derive"], optional = true }
serde_repr = { version = "0.1.7", optional = true }
+4 -4
View File
@@ -11,9 +11,9 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dioxus-core = { path = "../core", version ="^0.1.3", 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 = { path = "../core", version = "^0.1.3", default-features = false }
dioxus-html = { path = "../html", version = "^0.1.0", default-features = false }
dioxus-core-macro = { path = "../core-macro", version = "^0.1.2" }
web-sys = { version = "0.3", features = [
"Attr",
@@ -33,7 +33,7 @@ serde_urlencoded = "0.7"
wasm-bindgen = "0.2"
js-sys = "0.3"
gloo = "0.5"
gloo = "0.4"
route-recognizer = "0.3.1"
url = "2.2.2"
url_serde = "0.2.0"