diff --git a/leptos_macro/src/component.rs b/leptos_macro/src/component.rs index 5aa779db04..3bd36c0c2c 100644 --- a/leptos_macro/src/component.rs +++ b/leptos_macro/src/component.rs @@ -249,7 +249,7 @@ impl ToTokens for Model { } else { quote! { ::leptos::leptos_dom::Component::new( - stringify!(#name), + ::std::stringify!(#name), move || { #tracing_guard_expr #tracing_props_expr @@ -291,13 +291,14 @@ impl ToTokens for Model { && cfg!(feature = "ssr") { quote! { - let children = Box::new(|| ::leptos::Fragment::lazy(|| vec![ + let children = ::std::boxed::Box::new(|| ::leptos::Fragment::lazy(|| ::std::vec![ ::leptos::SharedContext::with_hydration(move || { - ::leptos::leptos_dom::html::custom( - ::leptos::leptos_dom::html::Custom::new("leptos-children"), + ::leptos::IntoView::into_view( + ::leptos::leptos_dom::html::custom( + ::leptos::leptos_dom::html::Custom::new("leptos-children"), + ) + .child(::leptos::SharedContext::no_hydration(children)) ) - .child(::leptos::SharedContext::no_hydration(children)) - .into_view() }) ])); } @@ -411,13 +412,14 @@ impl ToTokens for Model { }; let children = if is_island_with_children { quote! { - .children(Box::new(move || ::leptos::Fragment::lazy(|| vec![ + .children(::std::boxed::Box::new(move || ::leptos::Fragment::lazy(|| ::std::vec![ ::leptos::SharedContext::with_hydration(move || { - ::leptos::leptos_dom::html::custom( - ::leptos::leptos_dom::html::Custom::new("leptos-children"), + ::leptos::IntoView::into_view( + ::leptos::leptos_dom::html::custom( + ::leptos::leptos_dom::html::Custom::new("leptos-children"), + ) + .prop("$$owner", ::leptos::Owner::current().map(|n| n.as_ffi())) ) - .prop("$$owner", ::leptos::Owner::current().map(|n| n.as_ffi())) - .into_view() })]))) } } else { diff --git a/leptos_macro/src/params.rs b/leptos_macro/src/params.rs index c94fc88a63..6c75a3ce99 100644 --- a/leptos_macro/src/params.rs +++ b/leptos_macro/src/params.rs @@ -19,7 +19,10 @@ pub fn params_impl(ast: &syn::DeriveInput) -> proc_macro::TokenStream { let span = field.span(); quote_spanned! { - span => #ident: <#ty>::into_param(map.get(#field_name_string).map(::std::string::String::as_str), #field_name_string)? + span=> #ident: <#ty as ::leptos_router::IntoParam>::into_param( + map.get(#field_name_string).map(::std::string::String::as_str), + #field_name_string + )? } }) .collect() diff --git a/leptos_macro/src/view/client_builder.rs b/leptos_macro/src/view/client_builder.rs index 631eb1fb7b..15e0151c4a 100644 --- a/leptos_macro/src/view/client_builder.rs +++ b/leptos_macro/src/view/client_builder.rs @@ -47,7 +47,7 @@ pub(crate) fn fragment_to_tokens( )?; Some(quote! { - #node.into_view() + ::leptos::IntoView::into_view(#[allow(unused_braces)] {#node}) }) }) .peekable(); @@ -305,11 +305,8 @@ pub(crate) fn element_to_tokens( global_class, None, ) - .unwrap_or({ - let span = Span::call_site(); - quote_spanned! { - span => ::leptos::leptos_dom::Unit - } + .unwrap_or(quote_spanned! { + Span::call_site()=> ::leptos::leptos_dom::Unit }), false, ), @@ -378,7 +375,7 @@ pub(crate) fn attribute_to_tokens( let name = node.key.to_string(); if name == "ref" || name == "_ref" || name == "ref_" || name == "node_ref" { let value = expr_to_ident(attribute_value(node)); - let node_ref = quote_spanned! { span => node_ref }; + let node_ref = quote_spanned! { span=> node_ref }; quote! { .#node_ref(#value) @@ -415,18 +412,14 @@ pub(crate) fn attribute_to_tokens( NodeName::Punctuated(parts) => &parts[0], _ => unreachable!(), }; - let on = { - let span = on.span(); - quote_spanned! { - span => .on - } + let on = quote_spanned! { + on.span()=> .on }; let event_type = if is_custom { event_type } else if let Some(ev_name) = event_name_ident { - let span = ev_name.span(); quote_spanned! { - span => #ev_name + ev_name.span()=> #ev_name } } else { event_type @@ -434,9 +427,8 @@ pub(crate) fn attribute_to_tokens( let event_type = if is_force_undelegated { let undelegated = if let Some(undelegated) = undelegated_ident { - let span = undelegated.span(); quote_spanned! { - span => #undelegated + undelegated.span()=> #undelegated } } else { quote! { undelegated } @@ -455,11 +447,8 @@ pub(crate) fn attribute_to_tokens( NodeName::Punctuated(parts) => &parts[0], _ => unreachable!(), }; - let prop = { - let span = prop.span(); - quote_spanned! { - span => .prop - } + let prop = quote_spanned! { + prop.span()=> .prop }; quote! { #prop(#name, #[allow(unused_braces)] {#value}) @@ -470,11 +459,8 @@ pub(crate) fn attribute_to_tokens( NodeName::Punctuated(parts) => &parts[0], _ => unreachable!(), }; - let class = { - let span = class.span(); - quote_spanned! { - span => .class - } + let class = quote_spanned! { + class.span()=> .class }; quote! { #class(#name, #[allow(unused_braces)] {#value}) @@ -485,11 +471,8 @@ pub(crate) fn attribute_to_tokens( NodeName::Punctuated(parts) => &parts[0], _ => unreachable!(), }; - let style = { - let span = style.span(); - quote_spanned! { - span => .style - } + let style = quote_spanned! { + style.span()=> .style }; quote! { #style(#name, #[allow(unused_braces)] {#value}) @@ -518,7 +501,7 @@ pub(crate) fn attribute_to_tokens( Some(value) => { quote! { #value } } - None => quote_spanned! { span => "" }, + None => quote_spanned! { span=> "" }, }; let attr = match &node.key { @@ -526,9 +509,8 @@ pub(crate) fn attribute_to_tokens( _ => None, }; let attr = if let Some(attr) = attr { - let span = attr.span(); quote_spanned! { - span => .attr + attr.span()=> .attr } } else { quote! { diff --git a/leptos_macro/src/view/client_template.rs b/leptos_macro/src/view/client_template.rs index f178e8b15a..bc71fd7927 100644 --- a/leptos_macro/src/view/client_template.rs +++ b/leptos_macro/src/view/client_template.rs @@ -144,23 +144,25 @@ fn element_to_tokens( let debug_name = node.name().to_string(); let this_nav = if is_root_el { quote_spanned! { - span => let #this_el_ident = #debug_name; + span=> let #this_el_ident = #debug_name; let #this_el_ident = - ::leptos::wasm_bindgen::JsCast::unchecked_into::(#parent.clone()); + ::leptos::wasm_bindgen::JsCast::unchecked_into::<::leptos::web_sys::Node>( + #parent.clone() + ); //debug!("=> got {}", #this_el_ident.node_name()); } } else if let Some(prev_sib) = &prev_sib { quote_spanned! { - span => let #this_el_ident = #debug_name; + span=> let #this_el_ident = #debug_name; //log::debug!("next_sibling ({})", #debug_name); - let #this_el_ident = #prev_sib.next_sibling().unwrap_or_else(|| panic!("error : {} => {} ", #debug_name, "nextSibling")); + let #this_el_ident = #prev_sib.next_sibling().unwrap_or_else(|| ::std::panic!("error : {} => {} ", #debug_name, "nextSibling")); //log::debug!("=> got {}", #this_el_ident.node_name()); } } else { quote_spanned! { - span => let #this_el_ident = #debug_name; + span=> let #this_el_ident = #debug_name; //log::debug!("first_child ({})", #debug_name); - let #this_el_ident = #parent.first_child().unwrap_or_else(|| panic!("error: {} => {}", #debug_name, "firstChild")); + let #this_el_ident = #parent.first_child().unwrap_or_else(|| ::std::panic!("error: {} => {}", #debug_name, "firstChild")); //log::debug!("=> got {}", #this_el_ident.node_name()); } }; @@ -297,7 +299,11 @@ fn attr_to_tokens( let (event_type, handler) = crate::view::event_from_attribute_node(node, false); expressions.push(quote! { - ::leptos::leptos_dom::add_event_helper(::leptos::wasm_bindgen::JsCast::unchecked_ref(&#el_id), #event_type, #handler); + ::leptos::leptos_dom::add_event_helper( + ::leptos::wasm_bindgen::JsCast::unchecked_ref(&#el_id), + #event_type, + #handler, + ); }) } // Properties @@ -305,7 +311,11 @@ fn attr_to_tokens( let value = attribute_value(node); expressions.push(quote_spanned! { - span => ::leptos::leptos_dom::property(::leptos::wasm_bindgen::JsCast::unchecked_ref(&#el_id), #name, #value.into_property()) + span=> ::leptos::leptos_dom::property( + ::leptos::wasm_bindgen::JsCast::unchecked_ref(&#el_id), + #name, + ::leptos::IntoProperty::into_property(#value), + ) }); } // Classes @@ -313,7 +323,11 @@ fn attr_to_tokens( let value = attribute_value(node); expressions.push(quote_spanned! { - span => ::leptos::leptos_dom::class_helper(leptos::wasm_bindgen::JsCast::unchecked_ref(&#el_id), #name.into(), #value.into_class()) + span=> ::leptos::leptos_dom::class_helper( + ::leptos::wasm_bindgen::JsCast::unchecked_ref(&#el_id), + #name.into(), + ::leptos::IntoClass::into_class(#value), + ) }); } // Attributes @@ -337,7 +351,11 @@ fn attr_to_tokens( // For client-side rendering, dynamic attributes don't need to be rendered in the template // They'll immediately be set synchronously before the cloned template is mounted expressions.push(quote_spanned! { - span => ::leptos::leptos_dom::attribute_helper(leptos::wasm_bindgen::JsCast::unchecked_ref(&#el_id), #name.into(), {#value}.into_attribute()) + span=> ::leptos::leptos_dom::attribute_helper( + ::leptos::wasm_bindgen::JsCast::unchecked_ref(&#el_id), + #name.into(), + ::leptos::IntoAttribute::into_attribute(#[allow(unused_braces)] {#value}), + ) }); } } @@ -465,15 +483,15 @@ fn block_to_tokens( let name = child_ident(*next_el_id, span); let location = if let Some(sibling) = &prev_sib { quote_spanned! { - span => //log::debug!("-> next sibling"); - let #name = #sibling.next_sibling().unwrap_or_else(|| panic!("error : {} => {} ", "{block}", "nextSibling")); - //log::debug!("\tnext sibling = {}", #name.node_name()); + span=> //log::debug!("-> next sibling"); + let #name = #sibling.next_sibling().unwrap_or_else(|| ::std::panic!("error : {} => {} ", "{block}", "nextSibling")); + //log::debug!("\tnext sibling = {}", #name.node_name()); } } else { quote_spanned! { - span => //log::debug!("\\|/ first child on {}", #parent.node_name()); - let #name = #parent.first_child().unwrap_or_else(|| panic!("error : {} => {} ", "{block}", "firstChild")); - //log::debug!("\tfirst child = {}", #name.node_name()); + span=> //log::debug!("\\|/ first child on {}", #parent.node_name()); + let #name = #parent.first_child().unwrap_or_else(|| ::std::panic!("error : {} => {} ", "{block}", "firstChild")); + //log::debug!("\tfirst child = {}", #name.node_name()); } }; (Some(name), location) @@ -504,7 +522,7 @@ fn block_to_tokens( navigations.push(location); expressions.push(quote! { - ::leptos::leptos_dom::mount_child(#mount_kind, &{#value}.into_view()); + ::leptos::leptos_dom::mount_child(#mount_kind, &::leptos::IntoView::into_view(#[allow(unused_braces)] {#value})); }); if let Some(name) = name { diff --git a/leptos_macro/src/view/component_builder.rs b/leptos_macro/src/view/component_builder.rs index 41924e8577..0d045ce2b2 100644 --- a/leptos_macro/src/view/component_builder.rs +++ b/leptos_macro/src/view/component_builder.rs @@ -105,7 +105,7 @@ pub(crate) fn component_to_tokens( let value = attr.value().map(|v| { quote! { #v } })?; - Some(quote! { (#name, #value.into_attribute()) }) + Some(quote! { (#name, ::leptos::IntoAttribute::into_attribute(#value)) }) }) .collect::>(); @@ -172,7 +172,7 @@ pub(crate) fn component_to_tokens( let slot = Ident::new(&slot, span); if values.len() > 1 { quote! { - .#slot(vec![ + .#slot(::std::vec![ #(#values)* ]) } @@ -211,7 +211,7 @@ pub(crate) fn component_to_tokens( component } else { quote! { - #component.into_view() + ::leptos::IntoView::into_view(#[allow(unused_braces)] {#component}) #(#events_and_directives)* } } diff --git a/leptos_macro/src/view/ide_helper.rs b/leptos_macro/src/view/ide_helper.rs index e3f62032ac..74c8f4afbd 100644 --- a/leptos_macro/src/view/ide_helper.rs +++ b/leptos_macro/src/view/ide_helper.rs @@ -103,13 +103,13 @@ impl IdeTagHelper { // todo: check is html, and emit_warning in case of custom tag quote! { ::leptos::leptos_dom::html } }; - quote!( #namespace::#name) + quote! { #namespace::#name } } /// Returns `syn::Path`-like `TokenStream` to the `custom` section in docs. fn create_custom_tag_fn_path(span: Span) -> TokenStream { let custom_ident = Ident::new("custom", span); - quote! {leptos::leptos_dom::html::#custom_ident::} + quote! { ::leptos::leptos_dom::html::#custom_ident::<::leptos::leptos_dom::html::Custom> } } // Extract from NodeName completion idents. diff --git a/leptos_macro/src/view/mod.rs b/leptos_macro/src/view/mod.rs index f7cbf329dc..5aca5c7528 100644 --- a/leptos_macro/src/view/mod.rs +++ b/leptos_macro/src/view/mod.rs @@ -25,7 +25,7 @@ pub(crate) fn render_view( let empty = { let span = Span::call_site(); quote_spanned! { - span => leptos::leptos_dom::Unit + span=> ::leptos::leptos_dom::Unit } }; @@ -402,9 +402,8 @@ fn fancy_class_name<'a>( if name == "class" { if let Some(Tuple(tuple)) = node.value() { if tuple.elems.len() == 2 { - let span = node.key.span(); let class = quote_spanned! { - span => .class + node.key.span()=> .class }; let class_name = &tuple.elems[0]; let class_name = if let Expr::Lit(ExprLit { @@ -472,9 +471,8 @@ fn fancy_style_name<'a>( if name == "style" { if let Some(Tuple(tuple)) = node.value() { if tuple.elems.len() == 2 { - let span = node.key.span(); let style = quote_spanned! { - span => .style + node.key.span()=> .style }; let style_name = &tuple.elems[0]; let style_name = if let Expr::Lit(ExprLit { diff --git a/leptos_macro/src/view/server_template.rs b/leptos_macro/src/view/server_template.rs index 8ada4e8179..970ecce5c3 100644 --- a/leptos_macro/src/view/server_template.rs +++ b/leptos_macro/src/view/server_template.rs @@ -42,14 +42,14 @@ pub(crate) fn root_node_to_tokens_ssr( Node::Comment(_) | Node::Doctype(_) => quote! {}, Node::Text(node) => { quote! { - leptos::leptos_dom::html::text(#node) + ::leptos::leptos_dom::html::text(#node) } } Node::RawText(r) => { let text = r.to_string_best(); let text = syn::LitStr::new(&text, r.span()); quote! { - leptos::leptos_dom::html::text(#text) + ::leptos::leptos_dom::html::text(#text) } } Node::Block(node) => { @@ -78,12 +78,12 @@ pub(crate) fn fragment_to_tokens_ssr( let nodes = nodes.iter().map(|node| { let node = root_node_to_tokens_ssr(node, global_class, None); quote! { - #node.into_view() + ::leptos::IntoView::into_view(#[allow(unused_braces)] {#node}) } }); quote! { { - leptos::Fragment::lazy(|| ::std::vec![ + ::leptos::Fragment::lazy(|| ::std::vec![ #(#nodes),* ]) #view_marker @@ -133,17 +133,16 @@ pub(crate) fn root_element_to_tokens_ssr( if holes.is_empty() { let template = template.replace("\\{", "{").replace("\\}", "}"); quote! { - leptos::leptos_dom::html::StringOrView::String(#template.into()) + ::leptos::leptos_dom::html::StringOrView::String(#template.into()) } } else { let template = template.replace("\\{", "{{").replace("\\}", "}}"); quote! { - leptos::leptos_dom::html::StringOrView::String( - format!( + ::leptos::leptos_dom::html::StringOrView::String( + ::std::format!( #template, #(#holes),* - ) - .into() + ).into() ) } } @@ -153,7 +152,7 @@ pub(crate) fn root_element_to_tokens_ssr( #[allow(unused_braces)] { let view = #view; - leptos::leptos_dom::html::StringOrView::View(std::rc::Rc::new(move || view.clone())) + ::leptos::leptos_dom::html::StringOrView::View(::std::rc::Rc::new(move || view.clone())) } } }, @@ -189,7 +188,7 @@ pub(crate) fn root_element_to_tokens_ssr( } } else { quote! { - ::leptos::leptos_dom::#typed_element_name::default() + <::leptos::leptos_dom::#typed_element_name as ::std::default::Default>::default() } }; let view_marker = if let Some(marker) = view_marker { @@ -237,7 +236,7 @@ fn element_to_tokens_ssr( } chunks.push(SsrElementChunks::View(quote! { - {#component}.into_view() + ::leptos::IntoView::into_view(#[allow(unused_braces)] {#component}) })); } else { let tag_name = node.name().to_string(); @@ -284,8 +283,12 @@ fn element_to_tokens_ssr( template.push_str(" {}"); holes.push(quote! { {#end}.into_iter().filter_map(|(name, attr)| { - Some(format!("{}=\"{}\"", name, ::leptos::leptos_dom::ssr::escape_attr(&attr.as_nameless_value_string()?))) - }).collect::>().join(" ") + Some(::std::format!( + "{}=\"{}\"", + name, + ::leptos::leptos_dom::ssr::escape_attr(&attr.as_nameless_value_string()?) + )) + }).collect::<::std::vec::Vec<_>>().join(" ") }); }; } @@ -299,7 +302,7 @@ fn element_to_tokens_ssr( }; template.push_str("{}"); holes.push(quote! { - #hydration_id.map(|id| format!(" data-hk=\"{id}\"")).unwrap_or_default() + #hydration_id.map(|id| ::std::format!(" data-hk=\"{id}\"")).unwrap_or_default() }); set_class_attribute_ssr(node, template, holes, global_class); @@ -315,7 +318,7 @@ fn element_to_tokens_ssr( let value = inner_html; holes.push(quote! { - (#value).into_attribute().as_nameless_value_string().unwrap_or_default() + ::leptos::IntoAttribute::into_attribute(#value).as_nameless_value_string().unwrap_or_default() }) } else { for child in &node.children { @@ -369,14 +372,14 @@ fn element_to_tokens_ssr( }) } chunks.push(SsrElementChunks::View(quote! { - {#block}.into_view() + ::leptos::IntoView::into_view(#[allow(unused_braces)] {#block}) })); } } // Keep invalid blocks for faster IDE diff (on user type) Node::Block(block @ NodeBlock::Invalid { .. }) => { chunks.push(SsrElementChunks::View(quote! { - {#block}.into_view() + ::leptos::IntoView::into_view(#[allow(unused_braces)] {#block}) })); } Node::Fragment(_) => abort!( @@ -411,7 +414,7 @@ fn attribute_to_tokens_ssr<'a>( let (event_type, _, _) = parse_event_name(name); exprs_for_compiler.push(quote! { - leptos::leptos_dom::helpers::ssr_event_listener(::leptos::ev::#event_type, #handler); + ::leptos::leptos_dom::helpers::ssr_event_listener(::leptos::ev::#event_type, #handler); }) } else if name.strip_prefix("prop:").is_some() || name.strip_prefix("class:").is_some() @@ -457,9 +460,13 @@ fn attribute_to_tokens_ssr<'a>( } else { template.push_str("{}"); holes.push(quote! { - &{#value}.into_attribute() + &::leptos::IntoAttribute::into_attribute(#[allow(unused_braces)] {#value}) .as_nameless_value_string() - .map(|a| format!("{}=\"{}\"", #name, leptos::leptos_dom::ssr::escape_attr(&a))) + .map(|a| ::std::format!( + "{}=\"{}\"", + #name, + ::leptos::leptos_dom::ssr::escape_attr(&a) + )) .unwrap_or_default() }) } @@ -582,8 +589,8 @@ fn set_class_attribute_ssr( if let Some(value) = value { template.push_str(" {}"); holes.push(quote! { - &(#value).into_attribute().as_nameless_value_string() - .map(|a| leptos::leptos_dom::ssr::escape_attr(&a).to_string()) + &::leptos::IntoAttribute::into_attribute(#value).as_nameless_value_string() + .map(|a| ::leptos::leptos_dom::ssr::escape_attr(&a).to_string()) .unwrap_or_default() }); } @@ -592,7 +599,7 @@ fn set_class_attribute_ssr( for (_span, name, value) in &class_attrs { template.push_str(" {}"); holes.push(quote! { - (#value).into_class().as_value_string(#name) + ::leptos::IntoClass::into_class(#value).as_value_string(#name) }); } @@ -693,8 +700,8 @@ fn set_style_attribute_ssr( if let Some(value) = value { template.push_str(" {};"); holes.push(quote! { - &(#value).into_attribute().as_nameless_value_string() - .map(|a| leptos::leptos_dom::ssr::escape_attr(&a).to_string()) + &::leptos::IntoAttribute::into_attribute(#value).as_nameless_value_string() + .map(|a| ::leptos::leptos_dom::ssr::escape_attr(&a).to_string()) .unwrap_or_default() }); } @@ -703,7 +710,7 @@ fn set_style_attribute_ssr( for (_span, name, value) in &style_attrs { template.push_str(" {}"); holes.push(quote! { - (#value).into_style().as_value_string(#name).unwrap_or_default() + ::leptos::IntoStyle::into_style(#value).as_value_string(#name).unwrap_or_default() }); } diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__custom_event.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__custom_event.snap index 5752f0981d..17d852ae4f 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__custom_event.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__custom_event.snap @@ -1,14 +1,17 @@ --- source: leptos_macro/src/view/tests.rs -assertion_line: 101 expression: pretty(result) --- fn view() { - ::leptos::component_view( - &ExternalComponent, - ::leptos::component_props_builder(&ExternalComponent).build(), + ::leptos::IntoView::into_view( + #[allow(unused_braces)] + { + ::leptos::component_view( + &ExternalComponent, + ::leptos::component_props_builder(&ExternalComponent).build(), + ) + }, ) - .into_view() .on( ::leptos::leptos_dom::ev::undelegated( ::leptos::leptos_dom::ev::Custom::new("custom.event.clear"), diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__full_span__custom_event.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__full_span__custom_event.snap index 33ae658ff5..490808427e 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__full_span__custom_event.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__full_span__custom_event.snap @@ -1,6 +1,5 @@ --- source: leptos_macro/src/view/tests.rs -assertion_line: 101 expression: result --- TokenStream [ @@ -24,86 +23,138 @@ TokenStream [ spacing: Alone, }, Ident { - sym: component_view, + sym: IntoView, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: into_view, }, Group { delimiter: Parenthesis, stream: TokenStream [ Punct { - char: '&', - spacing: Alone, - }, - Ident { - sym: ExternalComponent, - span: bytes(11..28), - }, - Punct { - char: ',', + char: '#', spacing: Alone, }, - Punct { - char: ':', - spacing: Joint, - }, - Punct { - char: ':', - spacing: Alone, - }, - Ident { - sym: leptos, - }, - Punct { - char: ':', - spacing: Joint, - }, - Punct { - char: ':', - spacing: Alone, - }, - Ident { - sym: component_props_builder, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + sym: allow, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + sym: unused_braces, + }, + ], + }, + ], }, Group { - delimiter: Parenthesis, + delimiter: Brace, stream: TokenStream [ Punct { - char: '&', + char: ':', + spacing: Joint, + }, + Punct { + char: ':', spacing: Alone, }, Ident { - sym: ExternalComponent, - span: bytes(11..28), + sym: leptos, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: component_view, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Punct { + char: '&', + spacing: Alone, + }, + Ident { + sym: ExternalComponent, + span: bytes(11..28), + }, + Punct { + char: ',', + spacing: Alone, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: leptos, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: component_props_builder, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Punct { + char: '&', + spacing: Alone, + }, + Ident { + sym: ExternalComponent, + span: bytes(11..28), + }, + ], + }, + Punct { + char: '.', + spacing: Alone, + }, + Ident { + sym: build, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [], + }, + ], }, ], }, - Punct { - char: '.', - spacing: Alone, - }, - Ident { - sym: build, - }, - Group { - delimiter: Parenthesis, - stream: TokenStream [], - }, ], }, Punct { char: '.', spacing: Alone, }, - Ident { - sym: into_view, - }, - Group { - delimiter: Parenthesis, - stream: TokenStream [], - }, - Punct { - char: '.', - spacing: Alone, - }, Ident { sym: on, }, diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__full_span__simple_counter.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__full_span__simple_counter.snap index c002b0f901..57cd4c4e11 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__full_span__simple_counter.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__full_span__simple_counter.snap @@ -1023,6 +1023,16 @@ TokenStream [ spacing: Alone, span: bytes(10..15), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(10..15), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(10..15), + }, Ident { sym: leptos, span: bytes(10..15), @@ -1159,6 +1169,30 @@ TokenStream [ spacing: Alone, span: bytes(28..67), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(28..67), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(28..67), + }, + Ident { + sym: std, + span: bytes(28..67), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(28..67), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(28..67), + }, Ident { sym: panic, span: bytes(28..67), @@ -1255,6 +1289,30 @@ TokenStream [ spacing: Alone, span: bytes(67..74), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(67..74), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(67..74), + }, + Ident { + sym: std, + span: bytes(67..74), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(67..74), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(67..74), + }, Ident { sym: panic, span: bytes(67..74), @@ -1371,6 +1429,30 @@ TokenStream [ spacing: Alone, span: bytes(96..163), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(96..163), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(96..163), + }, + Ident { + sym: std, + span: bytes(96..163), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(96..163), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(96..163), + }, Ident { sym: panic, span: bytes(96..163), @@ -1467,6 +1549,30 @@ TokenStream [ spacing: Alone, span: bytes(163..167), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(163..167), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(163..167), + }, + Ident { + sym: std, + span: bytes(163..167), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(163..167), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(163..167), + }, Ident { sym: panic, span: bytes(163..167), @@ -1583,6 +1689,30 @@ TokenStream [ spacing: Alone, span: bytes(189..195), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(189..195), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(189..195), + }, + Ident { + sym: std, + span: bytes(189..195), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(189..195), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(189..195), + }, Ident { sym: panic, span: bytes(189..195), @@ -1679,6 +1809,30 @@ TokenStream [ spacing: Alone, span: bytes(195..204), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(195..204), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(195..204), + }, + Ident { + sym: std, + span: bytes(195..204), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(195..204), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(195..204), + }, Ident { sym: panic, span: bytes(195..204), @@ -1777,6 +1931,30 @@ TokenStream [ spacing: Alone, span: bytes(205..212), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(205..212), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(205..212), + }, + Ident { + sym: std, + span: bytes(205..212), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(205..212), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(205..212), + }, Ident { sym: panic, span: bytes(205..212), @@ -1875,6 +2053,30 @@ TokenStream [ spacing: Alone, span: bytes(213..216), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(213..216), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(213..216), + }, + Ident { + sym: std, + span: bytes(213..216), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(213..216), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(213..216), + }, Ident { sym: panic, span: bytes(213..216), @@ -1991,6 +2193,30 @@ TokenStream [ spacing: Alone, span: bytes(236..303), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(236..303), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(236..303), + }, + Ident { + sym: std, + span: bytes(236..303), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(236..303), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(236..303), + }, Ident { sym: panic, span: bytes(236..303), @@ -2087,6 +2313,30 @@ TokenStream [ spacing: Alone, span: bytes(303..307), }, + Punct { + char: ':', + spacing: Joint, + span: bytes(303..307), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(303..307), + }, + Ident { + sym: std, + span: bytes(303..307), + }, + Punct { + char: ':', + spacing: Joint, + span: bytes(303..307), + }, + Punct { + char: ':', + spacing: Alone, + span: bytes(303..307), + }, Ident { sym: panic, span: bytes(303..307), @@ -2309,6 +2559,10 @@ TokenStream [ ], span: bytes(63..66), }, + Punct { + char: ',', + spacing: Alone, + }, ], }, Punct { @@ -2538,6 +2792,10 @@ TokenStream [ ], span: bytes(138..162), }, + Punct { + char: ',', + spacing: Alone, + }, ], }, Punct { @@ -2660,23 +2918,34 @@ TokenStream [ char: '&', spacing: Alone, }, - Group { - delimiter: Brace, - stream: TokenStream [ - Group { - delimiter: Brace, - stream: TokenStream [ - Ident { - sym: value, - span: bytes(206..211), - }, - ], - span: bytes(205..212), - }, - ], + Punct { + char: ':', + spacing: Joint, }, Punct { - char: '.', + char: ':', + spacing: Alone, + }, + Ident { + sym: leptos, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: IntoView, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', spacing: Alone, }, Ident { @@ -2684,7 +2953,43 @@ TokenStream [ }, Group { delimiter: Parenthesis, - stream: TokenStream [], + stream: TokenStream [ + Punct { + char: '#', + spacing: Alone, + }, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + sym: allow, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + sym: unused_braces, + }, + ], + }, + ], + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Group { + delimiter: Brace, + stream: TokenStream [ + Ident { + sym: value, + span: bytes(206..211), + }, + ], + span: bytes(205..212), + }, + ], + }, + ], }, ], }, @@ -2915,6 +3220,10 @@ TokenStream [ ], span: bytes(278..302), }, + Punct { + char: ',', + spacing: Alone, + }, ], }, Punct { diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__simple_counter.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__simple_counter.snap index 7a8d9716ca..91d4d27b77 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__simple_counter.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__client_template__simple_counter.snap @@ -28,42 +28,60 @@ fn view() { .unwrap(); let _el1 = "div"; let _el1 = ::leptos::wasm_bindgen::JsCast::unchecked_into::< - leptos::web_sys::Node, + ::leptos::web_sys::Node, >(root.clone()); let _el2 = "button"; let _el2 = _el1 .first_child() - .unwrap_or_else(|| panic!("error: {} => {}", "button", "firstChild")); + .unwrap_or_else(|| ::std::panic!("error: {} => {}", "button", "firstChild")); let _el3 = _el2 .first_child() - .unwrap_or_else(|| panic!("error : {} => {} ", "{block}", "firstChild")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "{block}", "firstChild") + }); let _el4 = "button"; let _el4 = _el2 .next_sibling() - .unwrap_or_else(|| panic!("error : {} => {} ", "button", "nextSibling")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "button", "nextSibling") + }); let _el5 = _el4 .first_child() - .unwrap_or_else(|| panic!("error : {} => {} ", "{block}", "firstChild")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "{block}", "firstChild") + }); let _el6 = "span"; let _el6 = _el4 .next_sibling() - .unwrap_or_else(|| panic!("error : {} => {} ", "span", "nextSibling")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "span", "nextSibling") + }); let _el7 = _el6 .first_child() - .unwrap_or_else(|| panic!("error : {} => {} ", "{block}", "firstChild")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "{block}", "firstChild") + }); let _el8 = _el7 .next_sibling() - .unwrap_or_else(|| panic!("error : {} => {} ", "{block}", "nextSibling")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "{block}", "nextSibling") + }); let _el9 = _el8 .next_sibling() - .unwrap_or_else(|| panic!("error : {} => {} ", "{block}", "nextSibling")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "{block}", "nextSibling") + }); let _el10 = "button"; let _el10 = _el6 .next_sibling() - .unwrap_or_else(|| panic!("error : {} => {} ", "button", "nextSibling")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "button", "nextSibling") + }); let _el11 = _el10 .first_child() - .unwrap_or_else(|| panic!("error : {} => {} ", "{block}", "firstChild")); + .unwrap_or_else(|| { + ::std::panic!("error : {} => {} ", "{block}", "firstChild") + }); ::leptos::leptos_dom::add_event_helper( ::leptos::wasm_bindgen::JsCast::unchecked_ref(&_el2), ::leptos::leptos_dom::ev::click, @@ -76,7 +94,7 @@ fn view() { ); ::leptos::leptos_dom::mount_child( ::leptos::leptos_dom::MountKind::Before(&_el8.clone()), - &{ { value } }.into_view(), + &::leptos::IntoView::into_view(#[allow(unused_braces)] { { value } }), ); ::leptos::leptos_dom::add_event_helper( ::leptos::wasm_bindgen::JsCast::unchecked_ref(&_el10), diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__csr__custom_event.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__csr__custom_event.snap index 5752f0981d..17d852ae4f 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__csr__custom_event.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__csr__custom_event.snap @@ -1,14 +1,17 @@ --- source: leptos_macro/src/view/tests.rs -assertion_line: 101 expression: pretty(result) --- fn view() { - ::leptos::component_view( - &ExternalComponent, - ::leptos::component_props_builder(&ExternalComponent).build(), + ::leptos::IntoView::into_view( + #[allow(unused_braces)] + { + ::leptos::component_view( + &ExternalComponent, + ::leptos::component_props_builder(&ExternalComponent).build(), + ) + }, ) - .into_view() .on( ::leptos::leptos_dom::ev::undelegated( ::leptos::leptos_dom::ev::Custom::new("custom.event.clear"), diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__csr__full_span__custom_event.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__csr__full_span__custom_event.snap index 33ae658ff5..490808427e 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__csr__full_span__custom_event.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__csr__full_span__custom_event.snap @@ -1,6 +1,5 @@ --- source: leptos_macro/src/view/tests.rs -assertion_line: 101 expression: result --- TokenStream [ @@ -24,86 +23,138 @@ TokenStream [ spacing: Alone, }, Ident { - sym: component_view, + sym: IntoView, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: into_view, }, Group { delimiter: Parenthesis, stream: TokenStream [ Punct { - char: '&', - spacing: Alone, - }, - Ident { - sym: ExternalComponent, - span: bytes(11..28), - }, - Punct { - char: ',', + char: '#', spacing: Alone, }, - Punct { - char: ':', - spacing: Joint, - }, - Punct { - char: ':', - spacing: Alone, - }, - Ident { - sym: leptos, - }, - Punct { - char: ':', - spacing: Joint, - }, - Punct { - char: ':', - spacing: Alone, - }, - Ident { - sym: component_props_builder, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + sym: allow, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + sym: unused_braces, + }, + ], + }, + ], }, Group { - delimiter: Parenthesis, + delimiter: Brace, stream: TokenStream [ Punct { - char: '&', + char: ':', + spacing: Joint, + }, + Punct { + char: ':', spacing: Alone, }, Ident { - sym: ExternalComponent, - span: bytes(11..28), + sym: leptos, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: component_view, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Punct { + char: '&', + spacing: Alone, + }, + Ident { + sym: ExternalComponent, + span: bytes(11..28), + }, + Punct { + char: ',', + spacing: Alone, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: leptos, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: component_props_builder, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Punct { + char: '&', + spacing: Alone, + }, + Ident { + sym: ExternalComponent, + span: bytes(11..28), + }, + ], + }, + Punct { + char: '.', + spacing: Alone, + }, + Ident { + sym: build, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [], + }, + ], }, ], }, - Punct { - char: '.', - spacing: Alone, - }, - Ident { - sym: build, - }, - Group { - delimiter: Parenthesis, - stream: TokenStream [], - }, ], }, Punct { char: '.', spacing: Alone, }, - Ident { - sym: into_view, - }, - Group { - delimiter: Parenthesis, - stream: TokenStream [], - }, - Punct { - char: '.', - spacing: Alone, - }, Ident { sym: on, }, diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__custom_event.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__custom_event.snap index 5752f0981d..17d852ae4f 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__custom_event.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__custom_event.snap @@ -1,14 +1,17 @@ --- source: leptos_macro/src/view/tests.rs -assertion_line: 101 expression: pretty(result) --- fn view() { - ::leptos::component_view( - &ExternalComponent, - ::leptos::component_props_builder(&ExternalComponent).build(), + ::leptos::IntoView::into_view( + #[allow(unused_braces)] + { + ::leptos::component_view( + &ExternalComponent, + ::leptos::component_props_builder(&ExternalComponent).build(), + ) + }, ) - .into_view() .on( ::leptos::leptos_dom::ev::undelegated( ::leptos::leptos_dom::ev::Custom::new("custom.event.clear"), diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__full_span__custom_event.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__full_span__custom_event.snap index 33ae658ff5..490808427e 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__full_span__custom_event.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__full_span__custom_event.snap @@ -1,6 +1,5 @@ --- source: leptos_macro/src/view/tests.rs -assertion_line: 101 expression: result --- TokenStream [ @@ -24,86 +23,138 @@ TokenStream [ spacing: Alone, }, Ident { - sym: component_view, + sym: IntoView, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: into_view, }, Group { delimiter: Parenthesis, stream: TokenStream [ Punct { - char: '&', - spacing: Alone, - }, - Ident { - sym: ExternalComponent, - span: bytes(11..28), - }, - Punct { - char: ',', + char: '#', spacing: Alone, }, - Punct { - char: ':', - spacing: Joint, - }, - Punct { - char: ':', - spacing: Alone, - }, - Ident { - sym: leptos, - }, - Punct { - char: ':', - spacing: Joint, - }, - Punct { - char: ':', - spacing: Alone, - }, - Ident { - sym: component_props_builder, + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + sym: allow, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + sym: unused_braces, + }, + ], + }, + ], }, Group { - delimiter: Parenthesis, + delimiter: Brace, stream: TokenStream [ Punct { - char: '&', + char: ':', + spacing: Joint, + }, + Punct { + char: ':', spacing: Alone, }, Ident { - sym: ExternalComponent, - span: bytes(11..28), + sym: leptos, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: component_view, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Punct { + char: '&', + spacing: Alone, + }, + Ident { + sym: ExternalComponent, + span: bytes(11..28), + }, + Punct { + char: ',', + spacing: Alone, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: leptos, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: component_props_builder, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Punct { + char: '&', + spacing: Alone, + }, + Ident { + sym: ExternalComponent, + span: bytes(11..28), + }, + ], + }, + Punct { + char: '.', + spacing: Alone, + }, + Ident { + sym: build, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [], + }, + ], }, ], }, - Punct { - char: '.', - spacing: Alone, - }, - Ident { - sym: build, - }, - Group { - delimiter: Parenthesis, - stream: TokenStream [], - }, ], }, Punct { char: '.', spacing: Alone, }, - Ident { - sym: into_view, - }, - Group { - delimiter: Parenthesis, - stream: TokenStream [], - }, - Punct { - char: '.', - spacing: Alone, - }, Ident { sym: on, }, diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__full_span__simple_counter.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__full_span__simple_counter.snap index d870706ddd..b5c776f5c1 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__full_span__simple_counter.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__full_span__simple_counter.snap @@ -616,6 +616,14 @@ TokenStream [ char: ';', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: leptos, }, @@ -731,6 +739,14 @@ TokenStream [ char: ';', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: leptos, }, @@ -888,6 +904,14 @@ TokenStream [ char: ';', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: leptos, }, @@ -1081,6 +1105,10 @@ TokenStream [ Group { delimiter: Parenthesis, stream: TokenStream [ + Punct { + char: '<', + spacing: Alone, + }, Punct { char: ':', spacing: Joint, @@ -1125,6 +1153,46 @@ TokenStream [ Ident { sym: Div, }, + Ident { + sym: as, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: std, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: default, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: Default, + }, + Punct { + char: '>', + spacing: Alone, + }, Punct { char: ':', spacing: Joint, @@ -1147,6 +1215,14 @@ TokenStream [ Group { delimiter: Bracket, stream: TokenStream [ + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: leptos, }, @@ -1197,6 +1273,25 @@ TokenStream [ Group { delimiter: Parenthesis, stream: TokenStream [ + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: std, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: format, }, @@ -1283,6 +1378,25 @@ TokenStream [ char: '|', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: std, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: format, }, @@ -1385,6 +1499,25 @@ TokenStream [ char: '|', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: std, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: format, }, @@ -1487,6 +1620,25 @@ TokenStream [ char: '|', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: std, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: format, }, @@ -1589,6 +1741,25 @@ TokenStream [ char: '|', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: std, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: format, }, @@ -1670,34 +1841,89 @@ TokenStream [ char: '=', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: leptos, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: IntoView, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: into_view, + }, Group { - delimiter: Brace, + delimiter: Parenthesis, stream: TokenStream [ + Punct { + char: '#', + spacing: Alone, + }, Group { - delimiter: Brace, + delimiter: Bracket, stream: TokenStream [ Ident { - sym: value, - span: bytes(206..211), + sym: allow, + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + sym: unused_braces, + }, + ], + }, + ], + }, + Group { + delimiter: Brace, + stream: TokenStream [ + Group { + delimiter: Brace, + stream: TokenStream [ + Ident { + sym: value, + span: bytes(206..211), + }, + ], + span: bytes(205..212), }, ], - span: bytes(205..212), }, ], }, Punct { - char: '.', + char: ';', spacing: Alone, }, - Ident { - sym: into_view, - }, - Group { - delimiter: Parenthesis, - stream: TokenStream [], + Punct { + char: ':', + spacing: Joint, }, Punct { - char: ';', + char: ':', spacing: Alone, }, Ident { @@ -1750,6 +1976,14 @@ TokenStream [ Group { delimiter: Parenthesis, stream: TokenStream [ + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: std, }, @@ -1824,6 +2058,14 @@ TokenStream [ char: ',', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: leptos, }, @@ -1874,6 +2116,25 @@ TokenStream [ Group { delimiter: Parenthesis, stream: TokenStream [ + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: std, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: format, }, @@ -1960,6 +2221,25 @@ TokenStream [ char: '|', spacing: Alone, }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, + Ident { + sym: std, + }, + Punct { + char: ':', + spacing: Joint, + }, + Punct { + char: ':', + spacing: Alone, + }, Ident { sym: format, }, diff --git a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__simple_counter.snap b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__simple_counter.snap index 7b8e8c6174..03816d7932 100644 --- a/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__simple_counter.snap +++ b/leptos_macro/src/view/snapshots/leptos_macro__view__tests__ssr__simple_counter.snap @@ -15,47 +15,50 @@ fn view() { let _ = ::leptos::leptos_dom::html::span; let _ = ::leptos::leptos_dom::html::button; let _ = ::leptos::leptos_dom::html::button; - leptos::leptos_dom::helpers::ssr_event_listener( + ::leptos::leptos_dom::helpers::ssr_event_listener( ::leptos::ev::click, move |_| set_value(0), ); - leptos::leptos_dom::helpers::ssr_event_listener( + ::leptos::leptos_dom::helpers::ssr_event_listener( ::leptos::ev::click, move |_| set_value.update(|value| *value -= step), ); - leptos::leptos_dom::helpers::ssr_event_listener( + ::leptos::leptos_dom::helpers::ssr_event_listener( ::leptos::ev::click, move |_| set_value.update(|value| *value += step), ); ::leptos::HtmlElement::from_chunks( - ::leptos::leptos_dom::html::Div::default(), + <::leptos::leptos_dom::html::Div as ::std::default::Default>::default(), [ - leptos::leptos_dom::html::StringOrView::String( - format!( + ::leptos::leptos_dom::html::StringOrView::String( + ::std::format!( "Clear-1Value: ", ::leptos::leptos_dom::HydrationCtx::peek().map(| id | - format!(" data-hk=\"{id}\"")).unwrap_or_default(), + ::std::format!(" data-hk=\"{id}\"")).unwrap_or_default(), ::leptos::leptos_dom::HydrationCtx::id().map(| id | - format!(" data-hk=\"{id}\"")).unwrap_or_default(), + ::std::format!(" data-hk=\"{id}\"")).unwrap_or_default(), ::leptos::leptos_dom::HydrationCtx::id().map(| id | - format!(" data-hk=\"{id}\"")).unwrap_or_default(), + ::std::format!(" data-hk=\"{id}\"")).unwrap_or_default(), ::leptos::leptos_dom::HydrationCtx::id().map(| id | - format!(" data-hk=\"{id}\"")).unwrap_or_default() + ::std::format!(" data-hk=\"{id}\"")).unwrap_or_default() ) .into(), ), #[allow(unused_braces)] { - let view = { { value } }.into_view(); - leptos::leptos_dom::html::StringOrView::View( - std::rc::Rc::new(move || view.clone()), + let view = ::leptos::IntoView::into_view( + #[allow(unused_braces)] + { { value } }, + ); + ::leptos::leptos_dom::html::StringOrView::View( + ::std::rc::Rc::new(move || view.clone()), ) }, - leptos::leptos_dom::html::StringOrView::String( - format!( + ::leptos::leptos_dom::html::StringOrView::String( + ::std::format!( "!+1", ::leptos::leptos_dom::HydrationCtx::id().map(| id | - format!(" data-hk=\"{id}\"")).unwrap_or_default() + ::std::format!(" data-hk=\"{id}\"")).unwrap_or_default() ) .into(), ),