From a5a5821aa56863b52156f9534478b34f3bbfba3d Mon Sep 17 00:00:00 2001 From: Tim Lee Date: Fri, 8 Apr 2022 15:32:07 +0100 Subject: [PATCH 1/7] Include optional public-url flag in build instruction within getting started docs --- docs/reference/src/platforms/web.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/src/platforms/web.md b/docs/reference/src/platforms/web.md index 2ff5f621e..ab5d6505b 100644 --- a/docs/reference/src/platforms/web.md +++ b/docs/reference/src/platforms/web.md @@ -77,7 +77,7 @@ trunk serve To build our app and publish it to Github: - Make sure Github Pages is set up for your repo -- Build your app with `trunk build --release` +- Build your app with `trunk build --release` (include `--public-url ` to update asset prefixes if using a project site) - Move your generated HTML/CSS/JS/Wasm from `dist` into the folder configured for Github Pages - Add and commit with git - Push to Github From 24bca456124349571512f68508084cc0c70a4bca Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Sat, 9 Apr 2022 19:41:29 -0400 Subject: [PATCH 2/7] fix: inline props should look for attributes --- packages/core-macro/src/inlineprops.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/core-macro/src/inlineprops.rs b/packages/core-macro/src/inlineprops.rs index a0f12706a..782d13a48 100644 --- a/packages/core-macro/src/inlineprops.rs +++ b/packages/core-macro/src/inlineprops.rs @@ -7,6 +7,7 @@ use syn::{ }; pub struct InlinePropsBody { + pub attrs: Vec, pub vis: syn::Visibility, pub fn_token: Token![fn], pub ident: Ident, @@ -22,6 +23,7 @@ pub struct InlinePropsBody { /// The custom rusty variant of parsing rsx! impl Parse for InlinePropsBody { fn parse(input: ParseStream) -> Result { + let attrs: Vec = input.call(Attribute::parse_outer)?; let vis: Visibility = input.parse()?; let fn_token = input.parse()?; @@ -57,6 +59,7 @@ impl Parse for InlinePropsBody { output, block, cx_token, + attrs, }) } } @@ -72,6 +75,7 @@ impl ToTokens for InlinePropsBody { output, block, cx_token, + attrs, .. } = self; @@ -136,6 +140,7 @@ impl ToTokens for InlinePropsBody { #(#fields),* } + #(#attrs)* #vis fn #ident #fn_generics (#cx_token: Scope<#scope_lifetime #struct_name #generics>) #output { let #struct_name { #(#field_names),* } = &cx.props; #block From 5f17b6a849da5711a64cd8c9670263405ee2853e Mon Sep 17 00:00:00 2001 From: Erlend Sogge Heggen Date: Mon, 11 Apr 2022 09:53:08 +0200 Subject: [PATCH 3/7] Update mobile.md --- docs/reference/src/platforms/mobile.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/reference/src/platforms/mobile.md b/docs/reference/src/platforms/mobile.md index 5a41ffe60..193487885 100644 --- a/docs/reference/src/platforms/mobile.md +++ b/docs/reference/src/platforms/mobile.md @@ -1,15 +1,15 @@ # Getting started: mobile -Dioxus is unique in that it actually supports mobile. However, support is very young and you might need to dip down into some of the primitives until better supported is ready. +Dioxus is unique in that it actually supports mobile. However, support is very young and you might need to dip down into some of the primitives until better support is ready. -Currently, only iOS is supported through us, however you *can* add android support by following the same instructions below, but using the `android` guide in `cargo-mobile`. +Currently, only iOS is supported through us, however you *can* add android support by following the same instructions below by using the `android` guide in `cargo-mobile`. Also, Dioxus Desktop and Dioxus Mobile share the same codebase, and dioxus-mobile currently just re-exports dioxus-desktop. ## Getting Set up -Getting set up with mobile can but quite challenging. The tooling here isn't great (yet) and might take some hacking around to get things working. macOS M1 is broadly unexplored and might not work for you. +Getting set up with mobile can be quite challenging. The tooling here isn't great (yet) and might take some hacking around to get things working. macOS M1 is broadly unexplored and might not work for you. We're going to be using `cargo-mobile` to build for mobile. First, install it: From 69752313eb49ba4a9152cd9dcd8bbf5db507a200 Mon Sep 17 00:00:00 2001 From: Dave Rolsky Date: Mon, 11 Apr 2022 10:33:06 -0500 Subject: [PATCH 4/7] Fix typo in docs for NodeFactory.bump --- packages/core/src/nodes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/nodes.rs b/packages/core/src/nodes.rs index 4ed541711..0d3359a8c 100644 --- a/packages/core/src/nodes.rs +++ b/packages/core/src/nodes.rs @@ -508,7 +508,7 @@ impl<'a> NodeFactory<'a> { } } - /// Get the custom alloactor for this component + /// Get the custom allocator for this component #[inline] pub fn bump(&self) -> &'a bumpalo::Bump { self.bump From 9c0963abe74fb1d283b781a29859e61d09922ec5 Mon Sep 17 00:00:00 2001 From: YuKun Liu Date: Sun, 17 Apr 2022 11:56:30 +0800 Subject: [PATCH 5/7] Update ZH_CN.md --- notes/README/ZH_CN.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notes/README/ZH_CN.md b/notes/README/ZH_CN.md index 79f2b51aa..0a4832443 100644 --- a/notes/README/ZH_CN.md +++ b/notes/README/ZH_CN.md @@ -65,12 +65,12 @@ Dioxus 是一个可移植、高性能的框架,用于在 Rust 中构建跨平 ```rust fn app(cx: Scope) -> Element { - let (count, set_count) = use_state(&cx, || 0); + let count = use_state(&cx, || 0); cx.render(rsx!( h1 { "High-Five counter: {count}" } - button { onclick: move |_| set_count(count + 1), "Up high!" } - button { onclick: move |_| set_count(count - 1), "Down low!" } + button { onclick: move |_| count.set(count + 1), "Up high!" } + button { onclick: move |_| count.set(count - 1), "Down low!" } )) } ``` From 9d285d842d1411c93919f27ba68760c0886c5cad Mon Sep 17 00:00:00 2001 From: YuKun Liu Date: Sun, 17 Apr 2022 11:59:29 +0800 Subject: [PATCH 6/7] Update ZH_CN.md --- notes/README/ZH_CN.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/notes/README/ZH_CN.md b/notes/README/ZH_CN.md index 0a4832443..4da075c7d 100644 --- a/notes/README/ZH_CN.md +++ b/notes/README/ZH_CN.md @@ -65,13 +65,13 @@ Dioxus 是一个可移植、高性能的框架,用于在 Rust 中构建跨平 ```rust fn app(cx: Scope) -> Element { - let count = use_state(&cx, || 0); + let mut count = use_state(&cx, || 0); - cx.render(rsx!( + cx.render(rsx! { h1 { "High-Five counter: {count}" } - button { onclick: move |_| count.set(count + 1), "Up high!" } - button { onclick: move |_| count.set(count - 1), "Down low!" } - )) + button { onclick: move |_| count += 1, "Up high!" } + button { onclick: move |_| count -= 1, "Down low!" } + }) } ``` From c9537a4c41f08c809eb000426cc9a9ed1a83e755 Mon Sep 17 00:00:00 2001 From: YuKun Liu Date: Sun, 17 Apr 2022 12:27:41 +0800 Subject: [PATCH 7/7] Update localstate.md --- docs/guide/src/state/localstate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/src/state/localstate.md b/docs/guide/src/state/localstate.md index 72dcdb619..788399cb5 100644 --- a/docs/guide/src/state/localstate.md +++ b/docs/guide/src/state/localstate.md @@ -19,8 +19,8 @@ cx.render(rsx!{ ul { todos.read().iter().enumerate().map(|(id, todo)| rsx!{ li { + onhover: move |_| *todos.write()[id].is_hovered = true, h1 { "{todo.contents}" } - onhover: move |_| *todos.write()[id].is_hovered = true; } }) }