diff --git a/examples/crm.rs b/examples/crm.rs index b0f1aabe2..818c190bb 100644 --- a/examples/crm.rs +++ b/examples/crm.rs @@ -35,14 +35,16 @@ fn App(cx: Scope) -> Element { rel: "stylesheet", href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css", integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5", - crossorigin: "anonymous", + crossorigin: "anonymous" } - style { " + style { + " .red {{ background-color: rgb(202, 60, 60) !important; }} - " } + " + } h1 { "Dioxus CRM Example" } @@ -57,22 +59,14 @@ fn ClientList(cx: Scope) -> Element { cx.render(rsx! { h2 { "List of Clients" } - Link { - to: Route::ClientAdd {}, - class: "pure-button pure-button-primary", - "Add Client" - } - Link { - to: Route::Settings {}, - class: "pure-button", - "Settings" - } + Link { to: Route::ClientAdd {}, class: "pure-button pure-button-primary", "Add Client" } + Link { to: Route::Settings {}, class: "pure-button", "Settings" } clients.read().iter().map(|client| rsx! { div { class: "client", style: "margin-bottom: 50px", - + p { "Name: {client.first_name} {client.last_name}" } p { "Description: {client.description}" } } @@ -94,23 +88,18 @@ fn ClientAdd(cx: Scope) -> Element { class: "pure-form pure-form-aligned", onsubmit: move |_| { let mut clients = clients.write(); - - clients.push(Client { - first_name: first_name.to_string(), - last_name: last_name.to_string(), - description: description.to_string(), - }); - + clients + .push(Client { + first_name: first_name.to_string(), + last_name: last_name.to_string(), + description: description.to_string(), + }); dioxus_router::router().push(Route::ClientList {}); }, fieldset { - div { - class: "pure-control-group", - label { - "for": "first_name", - "First Name" - } + div { class: "pure-control-group", + label { "for": "first_name", "First Name" } input { id: "first_name", "type": "text", @@ -121,12 +110,8 @@ fn ClientAdd(cx: Scope) -> Element { } } - div { - class: "pure-control-group", - label { - "for": "last_name", - "Last Name" - } + div { class: "pure-control-group", + label { "for": "last_name", "Last Name" } input { id: "last_name", "type": "text", @@ -137,12 +122,8 @@ fn ClientAdd(cx: Scope) -> Element { } } - div { - class: "pure-control-group", - label { - "for": "description", - "Description" - } + div { class: "pure-control-group", + label { "for": "description", "Description" } textarea { id: "description", placeholder: "Description…", @@ -151,22 +132,11 @@ fn ClientAdd(cx: Scope) -> Element { } } - div { - class: "pure-controls", - button { - "type": "submit", - class: "pure-button pure-button-primary", - "Save" - } - Link { - to: Route::ClientList {}, - class: "pure-button pure-button-primary red", - "Cancel" - } + div { class: "pure-controls", + button { "type": "submit", class: "pure-button pure-button-primary", "Save" } + Link { to: Route::ClientList {}, class: "pure-button pure-button-primary red", "Cancel" } } } - - } }) } @@ -187,10 +157,6 @@ fn Settings(cx: Scope) -> Element { "Remove all Clients" } - Link { - to: Route::ClientList {}, - class: "pure-button", - "Go back" - } + Link { to: Route::ClientList {}, class: "pure-button", "Go back" } }) } diff --git a/packages/core/src/scopes.rs b/packages/core/src/scopes.rs index 1a26d3847..ef4a5771f 100644 --- a/packages/core/src/scopes.rs +++ b/packages/core/src/scopes.rs @@ -2,7 +2,6 @@ use crate::{ any_props::AnyProps, any_props::VProps, bump_frame::BumpFrame, - innerlude::ErrorBoundary, innerlude::{DynamicNode, EventHandler, VComponent, VNodeId, VText}, lazynodes::LazyNodes, nodes::{IntoAttributeValue, IntoDynNode, RenderReturn}, diff --git a/packages/desktop/src/webview.rs b/packages/desktop/src/webview.rs index de5ff121c..f4bc4c4ed 100644 --- a/packages/desktop/src/webview.rs +++ b/packages/desktop/src/webview.rs @@ -5,7 +5,6 @@ use tao::event_loop::{EventLoopProxy, EventLoopWindowTarget}; pub use wry; pub use wry::application as tao; use wry::application::window::Window; -use wry::http::Response; use wry::webview::{WebContext, WebView, WebViewBuilder}; pub(crate) fn build( diff --git a/packages/web/src/dom.rs b/packages/web/src/dom.rs index 575fa1260..118b3eddb 100644 --- a/packages/web/src/dom.rs +++ b/packages/web/src/dom.rs @@ -6,10 +6,11 @@ //! - tests to ensure dyn_into works for various event types. //! - Partial delegation? +use dioxus_interpreter_js::get_node; use dioxus_core::{ BorrowedAttributeValue, ElementId, Mutation, Template, TemplateAttribute, TemplateNode, }; -use dioxus_html::{event_bubbles, PlatformEventData}; +use dioxus_html::{event_bubbles, PlatformEventData, MountedData}; use dioxus_interpreter_js::{minimal_bindings, save_template, Channel}; use futures_channel::mpsc; use rustc_hash::FxHashMap; @@ -267,12 +268,12 @@ impl WebsysDom { let node = get_node(id.0 as u32); if let Some(element) = node.dyn_ref::() { let data: MountedData = element.into(); - let data = Rc::new(data); + let data = Box::new(data); let _ = self.event_channel.unbounded_send(UiEvent { name: "mounted".to_string(), bubbles: false, element: id, - data, + data: PlatformEventData::new(data), }); } }