fix formatting

This commit is contained in:
Evan Almloff committed 2024-01-03 15:18:37 -06:00
1 parent afb258b658
commit bc557906fe
3 files changed
+9 -12

No files matched your search

@@ -15,7 +15,7 @@ use serde::{de::DeserializeOwned, Serialize};
/// let state1 = use_state(cx, || server_cached(|| { /// let state1 = use_state(cx, || server_cached(|| {
/// 1234 /// 1234
/// })); /// }));
/// ///
/// todo!() /// todo!()
/// } /// }
/// ``` /// ```
+4 -1
View File
@@ -148,7 +148,10 @@ impl_event! {
/// ondoubleclick /// ondoubleclick
#[inline] #[inline]
pub fn ondoubleclick<'a, E: crate::EventReturn<T>, T>(_cx: &'a ::dioxus_core::ScopeState, mut _f: impl FnMut(::dioxus_core::Event<MouseData>) -> E + 'a) -> ::dioxus_core::Attribute<'a> { pub fn ondoubleclick<'a, E: crate::EventReturn<T>, T>(
_cx: &'a ::dioxus_core::ScopeState,
mut _f: impl FnMut(::dioxus_core::Event<MouseData>) -> E + 'a,
) -> ::dioxus_core::Attribute<'a> {
::dioxus_core::Attribute::new( ::dioxus_core::Attribute::new(
"ondblclick", "ondblclick",
_cx.listener(move |e: ::dioxus_core::Event<MouseData>| { _cx.listener(move |e: ::dioxus_core::Event<MouseData>| {
+4 -10
View File
@@ -2,8 +2,8 @@
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")] #![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")] #![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
use dioxus_html::{map_html_element_to_rsx, map_html_attribute_to_rsx};
use convert_case::{Case, Casing}; use convert_case::{Case, Casing};
use dioxus_html::{map_html_attribute_to_rsx, map_html_element_to_rsx};
use dioxus_rsx::{ use dioxus_rsx::{
BodyNode, CallBody, Component, Element, ElementAttr, ElementAttrNamed, ElementName, IfmtInput, BodyNode, CallBody, Component, Element, ElementAttr, ElementAttrNamed, ElementName, IfmtInput,
}; };
@@ -33,10 +33,7 @@ pub fn rsx_node_from_html(node: &Node) -> Option<BodyNode> {
ElementName::Custom(LitStr::new(&el.name, Span::call_site())) ElementName::Custom(LitStr::new(&el.name, Span::call_site()))
} else { } else {
// otherwise, it might be an element that isn't supported yet // otherwise, it might be an element that isn't supported yet
ElementName::Ident(Ident::new( ElementName::Ident(Ident::new(&el.name.to_case(Case::Snake), Span::call_site()))
&el.name.to_case(Case::Snake),
Span::call_site(),
))
} }
}; };
@@ -51,10 +48,7 @@ pub fn rsx_node_from_html(node: &Node) -> Option<BodyNode> {
} else { } else {
Ident::new(name, Span::call_site()) Ident::new(name, Span::call_site())
}; };
ElementAttr::AttrText { ElementAttr::AttrText { value, name: ident }
value,
name: ident,
}
} else { } else {
// If we don't recognize the attribute, we assume it's a custom attribute // If we don't recognize the attribute, we assume it's a custom attribute
ElementAttr::CustomAttrText { ElementAttr::CustomAttrText {
@@ -65,7 +59,7 @@ pub fn rsx_node_from_html(node: &Node) -> Option<BodyNode> {
ElementAttrNamed { ElementAttrNamed {
el_name: el_name.clone(), el_name: el_name.clone(),
attr attr,
} }
}) })
.collect(); .collect();