@@ -544,7 +544,7 @@ fn extract_inner_type_from_segment(segment: &PathSegment) -> Option<&Type> {
544544mod struct_info {
545545 use convert_case:: { Case , Casing } ;
546546 use proc_macro2:: TokenStream ;
547- use quote:: quote;
547+ use quote:: { quote, ToTokens } ;
548548 use syn:: parse:: Error ;
549549 use syn:: punctuated:: Punctuated ;
550550 use syn:: spanned:: Spanned ;
@@ -884,7 +884,7 @@ Finally, call `.build()` to create the instance of `{name}`.
884884 _phantom: ( #( #phantom_generics ) , * ) ,
885885 }
886886
887- impl #impl_generics dioxus_core:: prelude :: Properties for #name #ty_generics
887+ impl #impl_generics dioxus_core:: Properties for #name #ty_generics
888888 #b_generics_where
889889 {
890890 type Builder = #builder_name #generics_with_empty;
@@ -1024,22 +1024,19 @@ Finally, call `.build()` to create the instance of `{name}`.
10241024
10251025 Ok ( quote ! {
10261026 #[ allow( dead_code, non_camel_case_types, missing_docs) ]
1027- impl #impl_generics dioxus_core:: prelude :: HasAttributes for #builder_name < #( #ty_generics ) , * > #where_clause {
1027+ impl #impl_generics dioxus_core:: HasAttributes for #builder_name < #( #ty_generics ) , * > #where_clause {
10281028 fn push_attribute<L >(
10291029 mut self ,
10301030 ____name: & ' static str ,
10311031 ____ns: Option <& ' static str >,
1032- ____attr: impl dioxus_core:: prelude :: IntoAttributeValue <L >,
1032+ ____attr: impl dioxus_core:: IntoAttributeValue <L >,
10331033 ____volatile: bool
10341034 ) -> Self {
10351035 let ( #( #descructuring, ) * ) = self . fields;
10361036 self . #field_name. push(
10371037 dioxus_core:: Attribute :: new(
10381038 ____name,
1039- {
1040- use dioxus_core:: prelude:: IntoAttributeValue ;
1041- ____attr. into_value( )
1042- } ,
1039+ dioxus_core:: IntoAttributeValue :: <L >:: into_value( ____attr) ,
10431040 ____ns,
10441041 ____volatile,
10451042 )
@@ -1150,16 +1147,16 @@ Finally, call `.build()` to create the instance of `{name}`.
11501147 let marker_ident = syn:: Ident :: new ( "__Marker" , proc_macro2:: Span :: call_site ( ) ) ;
11511148 marker = Some ( marker_ident. clone ( ) ) ;
11521149 (
1153- quote ! ( impl dioxus_core:: prelude :: SuperInto <#arg_type, #marker_ident>) ,
1150+ quote ! ( impl dioxus_core:: SuperInto <#arg_type, #marker_ident>) ,
11541151 // If this looks like a signal type, we automatically convert it with SuperInto and use the props struct as the owner
1155- quote ! ( with_owner( self . owner. clone( ) , move || dioxus_core:: prelude :: SuperInto :: super_into( #field_name) ) ) ,
1152+ quote ! ( dioxus_core :: with_owner( self . owner. clone( ) , move || dioxus_core:: SuperInto :: super_into( #field_name) ) ) ,
11561153 )
11571154 } else if field. builder_attr . auto_into || field. builder_attr . strip_option {
11581155 let marker_ident = syn:: Ident :: new ( "__Marker" , proc_macro2:: Span :: call_site ( ) ) ;
11591156 marker = Some ( marker_ident. clone ( ) ) ;
11601157 (
1161- quote ! ( impl dioxus_core:: prelude :: SuperInto <#arg_type, #marker_ident>) ,
1162- quote ! ( dioxus_core:: prelude :: SuperInto :: super_into( #field_name) ) ,
1158+ quote ! ( impl dioxus_core:: SuperInto <#arg_type, #marker_ident>) ,
1159+ quote ! ( dioxus_core:: SuperInto :: super_into( #field_name) ) ,
11631160 )
11641161 } else if field. builder_attr . from_displayable {
11651162 (
@@ -1419,24 +1416,27 @@ Finally, call `.build()` to create the instance of `{name}`.
14191416 // If this is a signal type, we use super_into and the props struct as the owner
14201417 let is_child_owned_type = child_owned_type ( field. ty ) ;
14211418
1422- let mut into = quote ! { } ;
14231419
1424- if !is_default {
1420+ let body = if !is_default {
14251421 if is_child_owned_type {
1426- into = quote ! { . super_into( ) }
1422+ quote ! { dioxus_core :: SuperInto :: super_into( # default ) }
14271423 } else if field. builder_attr . auto_into {
1428- into = quote ! { . into( ) }
1424+ quote ! { ( # default ) . into( ) }
14291425 } else if field. builder_attr . auto_to_string {
1430- into = quote ! { . to_string( ) }
1426+ quote ! { ( #default ) . to_string( ) }
1427+ } else {
1428+ default. to_token_stream ( )
14311429 }
1432- }
1430+ } else {
1431+ default. to_token_stream ( )
1432+ } ;
14331433
14341434 if field. builder_attr . skip {
1435- quote ! ( let #name = #default #into ; )
1435+ quote ! ( let #name = #body ; )
14361436 } else if is_child_owned_type {
1437- quote ! ( let #name = #helper_trait_name:: into_value( #name, || with_owner( self . owner. clone( ) , move || ( # default ) #into ) ) ; )
1437+ quote ! ( let #name = #helper_trait_name:: into_value( #name, || dioxus_core :: with_owner( self . owner. clone( ) , move || #body ) ) ; )
14381438 } else {
1439- quote ! ( let #name = #helper_trait_name:: into_value( #name, || #default #into ) ; )
1439+ quote ! ( let #name = #helper_trait_name:: into_value( #name, || #body ) ; )
14401440 }
14411441 } else {
14421442 quote ! ( let #name = #name. 0 ; )
@@ -1484,15 +1484,15 @@ Finally, call `.build()` to create the instance of `{name}`.
14841484 /// Create a component from the props.
14851485 pub fn into_vcomponent<M : ' static >(
14861486 self ,
1487- render_fn: impl dioxus_core:: prelude :: ComponentFunction <#original_name #ty_generics, M >,
1487+ render_fn: impl dioxus_core:: ComponentFunction <#original_name #ty_generics, M >,
14881488 ) -> dioxus_core:: VComponent {
1489- use dioxus_core:: prelude :: ComponentFunction ;
1489+ use dioxus_core:: ComponentFunction ;
14901490 let component_name = :: std:: any:: type_name_of_val( & render_fn) ;
14911491 dioxus_core:: VComponent :: new( move |wrapper: Self | render_fn. rebuild( wrapper. inner) , self , component_name)
14921492 }
14931493 }
14941494
1495- impl #original_impl_generics dioxus_core:: prelude :: Properties for #name #ty_generics #where_clause {
1495+ impl #original_impl_generics dioxus_core:: Properties for #name #ty_generics #where_clause {
14961496 type Builder = ( ) ;
14971497 fn builder( ) -> Self :: Builder {
14981498 unreachable!( )
@@ -1742,7 +1742,7 @@ fn child_owned_type(ty: &Type) -> bool {
17421742fn looks_like_signal_type ( ty : & Type ) -> bool {
17431743 match extract_base_type_without_generics ( ty) {
17441744 Some ( path_without_generics) => {
1745- path_without_generics == parse_quote ! ( dioxus_core:: prelude :: ReadOnlySignal )
1745+ path_without_generics == parse_quote ! ( dioxus_core:: ReadOnlySignal )
17461746 || path_without_generics == parse_quote ! ( prelude:: ReadOnlySignal )
17471747 || path_without_generics == parse_quote ! ( ReadOnlySignal )
17481748 }
@@ -1754,10 +1754,10 @@ fn looks_like_callback_type(ty: &Type) -> bool {
17541754 let type_without_option = remove_option_wrapper ( ty. clone ( ) ) ;
17551755 match extract_base_type_without_generics ( & type_without_option) {
17561756 Some ( path_without_generics) => {
1757- path_without_generics == parse_quote ! ( dioxus_core:: prelude :: EventHandler )
1757+ path_without_generics == parse_quote ! ( dioxus_core:: EventHandler )
17581758 || path_without_generics == parse_quote ! ( prelude:: EventHandler )
17591759 || path_without_generics == parse_quote ! ( EventHandler )
1760- || path_without_generics == parse_quote ! ( dioxus_core:: prelude :: Callback )
1760+ || path_without_generics == parse_quote ! ( dioxus_core:: Callback )
17611761 || path_without_generics == parse_quote ! ( prelude:: Callback )
17621762 || path_without_generics == parse_quote ! ( Callback )
17631763 }
0 commit comments