Merge branch 'master' into jk/fix-segfault-boot

This commit is contained in:
Jonathan Kelley committed 2024-01-11 14:56:09 -08:00
commit 11b51f6173
6 files changed
+25 -22

No files matched your search

+1 -2
View File
@@ -7,8 +7,6 @@ fn main() {
dioxus_desktop::launch(app); dioxus_desktop::launch(app);
} }
const _STYLE: &str = manganis::mg!(file("./examples/assets/todomvc.css"));
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(PartialEq, Eq, Clone, Copy)]
pub enum FilterState { pub enum FilterState {
All, All,
@@ -49,6 +47,7 @@ pub fn app(cx: Scope<()>) -> Element {
cx.render(rsx! { cx.render(rsx! {
section { class: "todoapp", section { class: "todoapp",
style { {include_str!("./assets/todomvc.css")} }
TodoHeader { todos: todos } TodoHeader { todos: todos }
section { class: "main", section { class: "main",
if !todos.is_empty() { if !todos.is_empty() {
@@ -12,18 +12,6 @@ rsx! {
let blah = 120; let blah = 120;
true true
}, },
onclick: move |_| {
let blah = 120;
true
},
onclick: move |_| {
let blah = 120;
true
},
onclick: move |_| {
let blah = 120;
true
},
div { div {
div { "hi" } div { "hi" }
h2 { class: "asd" } h2 { class: "asd" }
+1 -1
View File
@@ -6,7 +6,7 @@ rsx! {
show_user_menu.set(!show_user_menu.get()); show_user_menu.set(!show_user_menu.get());
evt.cancel_bubble(); evt.cancel_bubble();
}, },
onclick: move |evt| show_user_menu.set(!show_user_menu.get()), onmousedown: move |evt| show_user_menu.set(!show_user_menu.get()),
span { class: "inline-block mr-4", icons::icon_14 {} } span { class: "inline-block mr-4", icons::icon_14 {} }
span { "Settings" } span { "Settings" }
} }
-7
View File
@@ -401,13 +401,6 @@ impl VirtualDom {
} }
} }
}); });
// Break if this is the exact target element.
// This means we won't call two listeners with the same name on the same element. This should be
// documented, or be rejected from the rsx! macro outright
if target_path == this_path {
break;
}
} }
} }
+2
View File
@@ -52,6 +52,8 @@ serde_json = "1"
[features] [features]
default = ["serialize", "mounted", "eval"] default = ["serialize", "mounted", "eval"]
serialize = [ serialize = [
"serde",
"serde_json",
"serde_repr", "serde_repr",
"euclid/serde", "euclid/serde",
"keyboard-types/serde", "keyboard-types/serde",
+21
View File
@@ -99,6 +99,27 @@ impl Parse for Element {
let span = content.span(); let span = content.span();
if name_str.starts_with("on") { if name_str.starts_with("on") {
// check for any duplicate event listeners
if attributes.iter().any(|f| {
if let AttributeType::Named(ElementAttrNamed {
attr:
ElementAttr {
name: ElementAttrName::BuiltIn(n),
value: ElementAttrValue::EventTokens(_),
},
..
}) = f
{
n == &name_str
} else {
false
}
}) {
return Err(syn::Error::new(
name.span(),
format!("Duplicate event listener `{}`", name),
));
}
attributes.push(attribute::AttributeType::Named(ElementAttrNamed { attributes.push(attribute::AttributeType::Named(ElementAttrNamed {
el_name: el_name.clone(), el_name: el_name.clone(),
attr: ElementAttr { attr: ElementAttr {