Feat: revert FC changes (like the old style).

This commit reverts to the old style of props + FC. The old style is desirable
because people comfortable with react can automatically be comfortable with
dioxus. It's also nice in that the same props can be used to drive two different
components - something the trait version couldn't do. Now, our trait bound forces
implementations to have the #[derive(Props)] flag. This will need to implement the
Properties trait as well as PartialEq (using ptr::equal for closure fields).
This commit is contained in:
Jonathan Kelley committed 2021-03-09 00:58:20 -05:00
1 parent 55a5541dba
commit 7158bc3575
15 files changed
+1339 -137

No files matched your search

+10
View File
@@ -5,6 +5,7 @@ use syn::parse_macro_input;
mod fc;
mod htm;
mod ifmt;
mod props;
mod rsxt;
mod util;
@@ -59,3 +60,12 @@ pub fn format_args_f(input: TokenStream) -> TokenStream {
.unwrap_or_else(|err| err.to_compile_error())
.into()
}
#[proc_macro_derive(Props, attributes(builder))]
pub fn derive_typed_builder(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input as syn::DeriveInput);
match props::impl_my_derive(&input) {
Ok(output) => output.into(),
Err(error) => error.to_compile_error().into(),
}
}
File diff suppressed because it is too large. Load diff
+12 -7
View File
@@ -198,14 +198,19 @@ impl Parse for Component {
// parse the guts
let content: ParseBuffer;
syn::braced!(content in s);
let mut fields: Vec<Field> = Vec::new();
'parsing: loop {
// [1] Break if empty
if content.is_empty() {
break 'parsing;
}
}
let mut body: Vec<Field> = Vec::new();
let mut attrs = Vec::new();
let mut children: Vec<Node> = Vec::new();
parse_element_content(content, &mut attrs, &mut children);
// 'parsing: loop {
// // [1] Break if empty
// if content.is_empty() {
// break 'parsing;
// }
// }
// let body = content.parse()?;