Clearing up some of the flood of warnings for unused imports etc. that have come up as I've shifted around implementations
This commit is contained in:
parent
fc5ef03c30
commit
3f7e7193ea
|
@ -9,6 +9,6 @@ crate-type = ["cdylib", "rlib"]
|
|||
[dependencies]
|
||||
console_log = "0.2"
|
||||
hackernews-app = { path = "../hackernews-app", default-features = false, features = ["hydrate"] }
|
||||
leptos = { path = "../../../leptos", features = ["hydrate"] }
|
||||
leptos = { path = "../../../leptos", default-features = false, features = ["hydrate"] }
|
||||
log = "0.4"
|
||||
wee_alloc = "0.4"
|
|
@ -1,12 +1,11 @@
|
|||
use actix_files::{Files, NamedFile};
|
||||
use actix_web::*;
|
||||
use futures::{stream::FuturesUnordered, StreamExt};
|
||||
use futures::StreamExt;
|
||||
use hackernews_app::*;
|
||||
use leptos::*;
|
||||
use leptos_meta::*;
|
||||
use leptos_router::*;
|
||||
use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod};
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
struct ActixIntegration {
|
||||
|
@ -27,7 +26,7 @@ impl History for ActixIntegration {
|
|||
.0
|
||||
}
|
||||
|
||||
fn navigate(&self, loc: &LocationChange) {}
|
||||
fn navigate(&self, _loc: &LocationChange) {}
|
||||
}
|
||||
|
||||
#[get("/static/style.css")]
|
||||
|
|
|
@ -8,7 +8,7 @@ static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
|||
|
||||
#[wasm_bindgen]
|
||||
pub fn main() {
|
||||
console_log::init_with_level(log::Level::Debug);
|
||||
_ = console_log::init_with_level(log::Level::Debug);
|
||||
log::debug!("initialized logging");
|
||||
|
||||
leptos::hydrate(body().unwrap(), |cx| {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use actix_files::{Directory, Files, NamedFile};
|
||||
use actix_web::*;
|
||||
use leptos::*;
|
||||
|
|
|
@ -173,7 +173,7 @@ pub fn TodoMVC(cx: Scope, todos: Todos) -> Element {
|
|||
.map(TodoSerialized::from)
|
||||
.collect::<Vec<_>>();
|
||||
let json = json::to_string(&objs);
|
||||
if let Err(e) = storage.set_item(STORAGE_KEY, &json) {
|
||||
if storage.set_item(STORAGE_KEY, &json).is_err() {
|
||||
log::error!("error while trying to set item in localStorage");
|
||||
}
|
||||
}
|
||||
|
@ -189,12 +189,12 @@ pub fn TodoMVC(cx: Scope, todos: Todos) -> Element {
|
|||
<section class="main" class:hidden={move || todos.with(|t| t.is_empty())}>
|
||||
<input id="toggle-all" class="toggle-all" type="checkbox"
|
||||
prop:checked={move || todos.with(|t| t.remaining() > 0)}
|
||||
on:input={move |_| set_todos.update(|t| t.toggle_all())}
|
||||
on:input=move |_| set_todos.update(|t| t.toggle_all())
|
||||
/>
|
||||
<label for="toggle-all">"Mark all as complete"</label>
|
||||
<ul class="todo-list">
|
||||
<For each={filtered_todos} key={|todo| todo.id}>
|
||||
{move |cx, todo: &Todo| view! { cx, <Todo todo={todo.clone()} /> }}
|
||||
<For each=filtered_todos key=|todo| todo.id>
|
||||
{move |cx, todo: &Todo| view! { cx, <Todo todo=todo.clone() /> }}
|
||||
</For>
|
||||
</ul>
|
||||
</section>
|
||||
|
@ -216,7 +216,7 @@ pub fn TodoMVC(cx: Scope, todos: Todos) -> Element {
|
|||
<button
|
||||
class="clear-completed hidden"
|
||||
class:hidden={move || todos.with(|t| t.completed() == 0)}
|
||||
on:click={move |_| set_todos.update(|t| t.clear_completed())}
|
||||
on:click=move |_| set_todos.update(|t| t.clear_completed())
|
||||
>
|
||||
"Clear completed"
|
||||
</button>
|
||||
|
@ -264,10 +264,10 @@ pub fn Todo(cx: Scope, todo: Todo) -> Element {
|
|||
(todo.set_completed)(checked);
|
||||
}}
|
||||
/>
|
||||
<label on:dblclick={move |_| set_editing(true)}>
|
||||
<label on:dblclick=move |_| set_editing(true)>
|
||||
{move || todo.title.get()}
|
||||
</label>
|
||||
<button class="destroy" on:click={move |_| set_todos.update(|t| t.remove(todo.id))}/>
|
||||
<button class="destroy" on:click=move |_| set_todos.update(|t| t.remove(todo.id))/>
|
||||
</div>
|
||||
{move || editing().then(|| view! { cx,
|
||||
<input
|
||||
|
|
|
@ -9,14 +9,14 @@ description = "Leptos is a full-stack, isomorphic Rust web framework leveraging
|
|||
readme = "../README.md"
|
||||
|
||||
[dependencies]
|
||||
leptos_core = { path = "../leptos_core", version = "0.0.8" }
|
||||
leptos_dom = { path = "../leptos_dom", version = "0.0.8" }
|
||||
leptos_macro = { path = "../leptos_macro", version = "0.0.7" }
|
||||
leptos_core = { path = "../leptos_core", default-features = false, version = "0.0.8" }
|
||||
leptos_dom = { path = "../leptos_dom", default-features = false, version = "0.0.8" }
|
||||
leptos_macro = { path = "../leptos_macro", default-features = false, version = "0.0.7" }
|
||||
leptos_reactive = { path = "../leptos_reactive", default-features = false, version = "0.0.8" }
|
||||
|
||||
[features]
|
||||
default = ["resource"]
|
||||
csr = ["leptos_core/csr", "leptos_macro/csr", "leptos_reactive/csr"]
|
||||
hydrate = ["leptos_core/hydrate", "leptos_macro/hydrate", "leptos_reactive/hydrate"]
|
||||
ssr = ["leptos_core/ssr", "leptos_macro/ssr", "leptos_reactive/ssr"]
|
||||
csr = ["leptos_core/csr", "leptos_dom/csr", "leptos_macro/csr", "leptos_reactive/csr"]
|
||||
hydrate = ["leptos_core/hydrate", "leptos_dom/hydrate", "leptos_macro/hydrate", "leptos_reactive/hydrate"]
|
||||
ssr = ["leptos_core/ssr", "leptos_dom/ssr", "leptos_macro/ssr", "leptos_reactive/ssr"]
|
||||
resource = ["leptos_reactive/resource"]
|
|
@ -1,6 +1,6 @@
|
|||
use leptos_dom::Element;
|
||||
use leptos_macro::*;
|
||||
use leptos_reactive::{create_effect, Memo, ReadSignal, Scope};
|
||||
use leptos_reactive::{Memo, Scope};
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
use leptos_reactive::{
|
||||
create_effect, create_memo, create_signal, queue_microtask, Memo, ReadSignal, Scope,
|
||||
ScopeDisposer,
|
||||
};
|
||||
use leptos_reactive::{create_memo, queue_microtask, Memo, Scope, ScopeDisposer};
|
||||
use std::{collections::HashMap, fmt::Debug, hash::Hash, ops::IndexMut};
|
||||
|
||||
/// Function that maps a `Vec` to another `Vec` via a map function. The mapped `Vec` is lazy
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate as leptos;
|
||||
use leptos_dom::{Child, IntoAttribute, IntoChild};
|
||||
use leptos_dom::{Child, IntoChild};
|
||||
use leptos_macro::Props;
|
||||
use leptos_reactive::{debug_warn, provide_context, Scope, SuspenseContext};
|
||||
use leptos_reactive::{provide_context, Scope, SuspenseContext};
|
||||
|
||||
#[derive(Props)]
|
||||
pub struct SuspenseProps<F, E, G>
|
||||
|
@ -102,7 +102,7 @@ where
|
|||
});
|
||||
|
||||
// return the fallback for now, wrapped in fragment identifer
|
||||
Child::Node(view! { cx, <div data-fragment-id={key}>{fallback.into_child(cx)}</div> })
|
||||
Child::Node(view! { cx, <div data-fragment-id=key>{fallback.into_child(cx)}</div> })
|
||||
}
|
||||
};
|
||||
move || initial.clone()
|
||||
|
|
|
@ -238,6 +238,11 @@ pub fn add_event_listener(
|
|||
event_delegation::add_event_listener(event_name);
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn ssr_event_listener(_cb: impl FnMut(web_sys::Event) + 'static) {
|
||||
// this function exists only for type inference in templates for SSR
|
||||
}
|
||||
|
||||
pub fn window_event_listener(event_name: &str, cb: impl Fn(web_sys::Event) + 'static) {
|
||||
if !is_server!() {
|
||||
let handler = Box::new(cb) as Box<dyn FnMut(web_sys::Event)>;
|
||||
|
|
|
@ -66,7 +66,7 @@ pub fn reconcile_arrays(parent: &web_sys::Element, a: &mut [web_sys::Node], b: &
|
|||
// Remove.
|
||||
for node in &a[a_start..a_end] {
|
||||
if map.is_none() || !map.as_ref().unwrap().contains_key(&NodeWrapper(node)) {
|
||||
parent.remove_child(node);
|
||||
_ = parent.remove_child(node);
|
||||
}
|
||||
}
|
||||
a_start = a_end;
|
||||
|
@ -122,7 +122,7 @@ pub fn reconcile_arrays(parent: &web_sys::Element, a: &mut [web_sys::Node], b: &
|
|||
b_start += 1;
|
||||
}
|
||||
} else {
|
||||
parent.replace_child(&a[a_start], &b[b_start]);
|
||||
_ = parent.replace_child(&a[a_start], &b[b_start]);
|
||||
a_start += 1;
|
||||
b_start += 1;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ pub fn reconcile_arrays(parent: &web_sys::Element, a: &mut [web_sys::Node], b: &
|
|||
a_start += 1;
|
||||
}
|
||||
} else {
|
||||
parent.remove_child(&a[a_start]);
|
||||
_ = parent.remove_child(&a[a_start]);
|
||||
a_start += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ pub fn insert(
|
|||
}
|
||||
|
||||
pub fn insert_expression(
|
||||
cx: Scope,
|
||||
_cx: Scope,
|
||||
parent: web_sys::Element,
|
||||
new_value: &Child,
|
||||
mut current: Child,
|
||||
|
@ -433,7 +433,7 @@ fn clean_children(
|
|||
}
|
||||
}
|
||||
|
||||
fn child_nodes(parent: &web_sys::Element) -> Vec<web_sys::Node> {
|
||||
/* fn child_nodes(parent: &web_sys::Element) -> Vec<web_sys::Node> {
|
||||
let children = parent.children();
|
||||
let mut nodes = Vec::new();
|
||||
for idx in 0..children.length() {
|
||||
|
@ -443,3 +443,4 @@ fn child_nodes(parent: &web_sys::Element) -> Vec<web_sys::Node> {
|
|||
}
|
||||
nodes
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -125,7 +125,7 @@ impl ToTokens for InlinePropsBody {
|
|||
quote! { #[derive(Props, PartialEq, Eq)] }
|
||||
}; */
|
||||
|
||||
let (scope_lifetime, fn_generics, struct_generics) = if let Some(lt) = first_lifetime {
|
||||
let (_scope_lifetime, fn_generics, struct_generics) = if let Some(lt) = first_lifetime {
|
||||
let struct_generics: Punctuated<_, token::Comma> = generics
|
||||
.params
|
||||
.iter()
|
||||
|
|
|
@ -108,7 +108,7 @@ fn root_element_to_tokens(
|
|||
},
|
||||
// for hydration, use get_next_element(), which will either draw from an SSRed node or clone the template
|
||||
Mode::Hydrate => {
|
||||
let name = node.name_as_string().unwrap();
|
||||
//let name = node.name_as_string().unwrap();
|
||||
quote! {
|
||||
let root = #template_uid.with(|template| #cx.get_next_element(template));
|
||||
// //log::debug!("root = {}", root.node_name());
|
||||
|
@ -152,7 +152,7 @@ fn root_element_to_tokens(
|
|||
#[derive(Clone, Debug)]
|
||||
enum PrevSibChange {
|
||||
Sib(Ident),
|
||||
Parent,
|
||||
//Parent,
|
||||
Skip,
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ fn element_to_tokens(
|
|||
|
||||
prev_sib = match curr_id {
|
||||
PrevSibChange::Sib(id) => Some(id),
|
||||
PrevSibChange::Parent => None,
|
||||
//PrevSibChange::Parent => None,
|
||||
PrevSibChange::Skip => prev_sib,
|
||||
};
|
||||
}
|
||||
|
@ -457,15 +457,22 @@ fn attr_to_tokens(
|
|||
}
|
||||
// Event Handlers
|
||||
else if name.starts_with("on:") {
|
||||
if mode != Mode::Ssr {
|
||||
let event_name = name.replacen("on:", "", 1);
|
||||
let handler = node
|
||||
.value
|
||||
.as_ref()
|
||||
.expect("event listener attributes need a value");
|
||||
|
||||
if mode != Mode::Ssr {
|
||||
let event_name = name.replacen("on:", "", 1);
|
||||
expressions.push(quote_spanned! {
|
||||
span => add_event_listener(#el_id.unchecked_ref(), #event_name, #handler);
|
||||
});
|
||||
} else {
|
||||
// this is here to avoid warnings about unused signals
|
||||
// that are used in event listeners. I'm open to better solutions.
|
||||
expressions.push(quote_spanned! {
|
||||
span => let _ = ssr_event_listener(#handler);
|
||||
});
|
||||
}
|
||||
}
|
||||
// Properties
|
||||
|
@ -556,7 +563,7 @@ fn child_to_tokens(
|
|||
node: &Node,
|
||||
parent: &Ident,
|
||||
prev_sib: Option<Ident>,
|
||||
mut next_sib: Option<Ident>,
|
||||
next_sib: Option<Ident>,
|
||||
next_el_id: &mut usize,
|
||||
next_co_id: &mut usize,
|
||||
template: &mut String,
|
||||
|
@ -609,7 +616,7 @@ fn child_to_tokens(
|
|||
},
|
||||
_ => None,
|
||||
});
|
||||
let mut current: Option<Ident> = None;
|
||||
let current: Option<Ident> = None;
|
||||
|
||||
// code to navigate to this text node
|
||||
let span = node
|
||||
|
@ -687,7 +694,7 @@ fn child_to_tokens(
|
|||
let el = child_ident(*next_el_id, node);
|
||||
*next_co_id += 1;
|
||||
let co = comment_ident(*next_co_id, node);
|
||||
next_sib = Some(el.clone());
|
||||
//next_sib = Some(el.clone());
|
||||
|
||||
template.push_str("<!#><!/>");
|
||||
navigations.push(quote! {
|
||||
|
@ -706,7 +713,7 @@ fn child_to_tokens(
|
|||
);
|
||||
});
|
||||
|
||||
current = Some(el);
|
||||
//current = Some(el);
|
||||
}
|
||||
// in SSR, it needs to insert the value, wrapped in comments
|
||||
Mode::Ssr => expressions.push(quote::quote_spanned! {
|
||||
|
@ -729,7 +736,7 @@ fn component_to_tokens(
|
|||
node: &Node,
|
||||
parent: Option<&Ident>,
|
||||
prev_sib: Option<Ident>,
|
||||
mut next_sib: Option<Ident>,
|
||||
next_sib: Option<Ident>,
|
||||
template: &mut String,
|
||||
expressions: &mut Vec<TokenStream>,
|
||||
navigations: &mut Vec<TokenStream>,
|
||||
|
@ -764,12 +771,12 @@ fn component_to_tokens(
|
|||
|
||||
});
|
||||
} else if mode == Mode::Hydrate {
|
||||
let name = child_ident(*next_el_id, node);
|
||||
//let name = child_ident(*next_el_id, node);
|
||||
*next_el_id += 1;
|
||||
let el = child_ident(*next_el_id, node);
|
||||
*next_co_id += 1;
|
||||
let co = comment_ident(*next_co_id, node);
|
||||
next_sib = Some(el.clone());
|
||||
//next_sib = Some(el.clone());
|
||||
|
||||
let starts_at = if let Some(prev_sib) = prev_sib {
|
||||
quote::quote! {{
|
||||
|
@ -958,10 +965,10 @@ fn debug_name(node: &Node) -> String {
|
|||
})
|
||||
}
|
||||
|
||||
fn span(node: &Node) -> Span {
|
||||
/* fn span(node: &Node) -> Span {
|
||||
node.name_span()
|
||||
.unwrap_or_else(|| node.value.as_ref().unwrap().span())
|
||||
}
|
||||
} */
|
||||
|
||||
fn child_ident(el_id: usize, node: &Node) -> Ident {
|
||||
let id = format!("_el{el_id}");
|
||||
|
|
|
@ -42,13 +42,19 @@ use std::fmt::Debug;
|
|||
/// # assert_eq!(b(), 2);
|
||||
/// # }).dispose();
|
||||
/// ```
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
pub fn create_effect<T>(cx: Scope, f: impl FnMut(Option<T>) -> T + 'static)
|
||||
where
|
||||
T: Debug + 'static,
|
||||
{
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
create_isomorphic_effect(cx, f);
|
||||
}
|
||||
#[cfg(feature = "ssr")]
|
||||
pub fn create_effect<T>(_cx: Scope, _f: impl FnMut(Option<T>) -> T + 'static)
|
||||
where
|
||||
T: Debug + 'static,
|
||||
{
|
||||
}
|
||||
|
||||
/// Creates an effect; unlike effects created by [create_effect], isomorphic effects will run on
|
||||
/// the server as well as the client.
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#[cfg(any(feature = "hydrate"))]
|
||||
use std::collections::{HashMap, HashSet};
|
||||
#[cfg(any(feature = "ssr"))]
|
||||
use std::{collections::HashMap, future::Future, pin::Pin};
|
||||
use std::collections::HashMap;
|
||||
#[cfg(feature = "hydrate")]
|
||||
use std::collections::HashSet;
|
||||
#[cfg(feature = "ssr")]
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[cfg(any(feature = "hydrate"))]
|
||||
use crate::{ResourceId, Scope};
|
||||
use crate::ResourceId;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct SharedContext {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{create_isomorphic_effect, create_signal, ReadSignal, Scope};
|
||||
use crate::{ReadSignal, Scope};
|
||||
use std::fmt::Debug;
|
||||
|
||||
/// Creates an efficient derived reactive value based on other reactive values.
|
||||
|
|
|
@ -163,7 +163,6 @@ where
|
|||
r.trigger.update(|n| *n += 1);
|
||||
|
||||
let resolve = {
|
||||
let runtime = cx.runtime;
|
||||
let resolved = r.resolved.clone();
|
||||
let set_value = r.set_value;
|
||||
let set_loading = r.set_loading;
|
||||
|
@ -184,7 +183,7 @@ where
|
|||
)
|
||||
.unwrap();
|
||||
let id = serde_json::to_string(&id).unwrap();
|
||||
js_sys::Reflect::set(
|
||||
_ = js_sys::Reflect::set(
|
||||
&resource_resolvers,
|
||||
&wasm_bindgen::JsValue::from_str(&id),
|
||||
resolve.as_ref().unchecked_ref(),
|
||||
|
|
|
@ -158,7 +158,6 @@ impl Runtime {
|
|||
|
||||
#[cfg(feature = "hydrate")]
|
||||
pub fn start_hydration(&self, element: &web_sys::Element) {
|
||||
use std::collections::HashMap;
|
||||
use wasm_bindgen::{JsCast, UnwrapThrowExt};
|
||||
|
||||
// gather hydratable elements
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
use crate::{
|
||||
hydration::SharedContext, AnyEffect, AnyResource, EffectId, ResourceId, ResourceState, Runtime,
|
||||
SignalId,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
cell::RefCell,
|
||||
collections::HashMap,
|
||||
fmt::Debug,
|
||||
rc::Rc,
|
||||
};
|
||||
#[cfg(feature = "ssr")]
|
||||
use std::{future::Future, pin::Pin};
|
||||
use crate::SuspenseContext;
|
||||
use crate::{hydration::SharedContext, EffectId, ResourceId, Runtime, SignalId};
|
||||
use std::fmt::Debug;
|
||||
#[cfg(feature = "ssr")]
|
||||
use std::{collections::HashMap, future::Future, pin::Pin};
|
||||
|
||||
#[must_use = "Scope will leak memory if the disposer function is never called"]
|
||||
/// Creates a child reactive scope and runs the function within it. This is useful for applications
|
||||
|
@ -331,20 +323,20 @@ impl Scope {
|
|||
#[cfg(feature = "ssr")]
|
||||
pub fn register_suspense(
|
||||
&self,
|
||||
context: crate::SuspenseContext,
|
||||
context: SuspenseContext,
|
||||
key: &str,
|
||||
resolver: impl FnOnce() -> String + 'static,
|
||||
) {
|
||||
use crate::{create_isomorphic_effect, SuspenseContext};
|
||||
use futures::{future::join_all, FutureExt, StreamExt};
|
||||
use crate::create_isomorphic_effect;
|
||||
use futures::StreamExt;
|
||||
|
||||
if let Some(ref mut shared_context) = *self.runtime.shared_context.borrow_mut() {
|
||||
let (mut tx, mut rx) = futures::channel::mpsc::channel::<()>(1);
|
||||
|
||||
create_isomorphic_effect(*self, move |fut| {
|
||||
create_isomorphic_effect(*self, move |_| {
|
||||
let pending = context.pending_resources.get();
|
||||
if pending == 0 {
|
||||
tx.try_send(());
|
||||
_ = tx.try_send(());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use crate::{Runtime, Scope, ScopeId, ScopeProperty};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::{Runtime, Scope, ScopeProperty};
|
||||
use std::{fmt::Debug, marker::PhantomData};
|
||||
|
||||
/// Creates a signal, the basic reactive primitive.
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
#[cfg(feature = "ssr")]
|
||||
use std::{cell::RefCell, future::Future, pin::Pin, rc::Rc};
|
||||
|
||||
use crate::{create_signal, spawn::queue_microtask, ReadSignal, Scope, WriteSignal};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{cell::RefCell, fmt::Debug, rc::Rc};
|
||||
use std::fmt::Debug;
|
||||
|
||||
use leptos::*;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{use_head, MetaContext};
|
||||
use crate::use_head;
|
||||
use leptos::*;
|
||||
use std::{cell::RefCell, collections::HashMap, rc::Rc};
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
use crate::{use_head, MetaContext, TextProp};
|
||||
use crate::{use_head, TextProp};
|
||||
use leptos::*;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct TitleContext {
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
el: Rc<RefCell<Option<web_sys::HtmlTitleElement>>>,
|
||||
formatter: Rc<RefCell<Option<Formatter>>>,
|
||||
text: Rc<RefCell<Option<TextProp>>>,
|
||||
|
|
|
@ -30,7 +30,6 @@ where
|
|||
children,
|
||||
} = props;
|
||||
|
||||
#[cfg(any(feature = "csr", feature = "hydrate"))]
|
||||
let on_submit = move |ev: web_sys::Event| {
|
||||
if ev.default_prevented() {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use leptos::leptos_dom::IntoChild;
|
||||
use leptos::*;
|
||||
use typed_builder::TypedBuilder;
|
||||
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
use wasm_bindgen::JsCast;
|
||||
|
||||
use crate::{use_location, use_resolved_path, State};
|
||||
|
|
|
@ -12,12 +12,13 @@ use wasm_bindgen::JsCast;
|
|||
use leptos_reactive::use_transition;
|
||||
|
||||
use crate::{
|
||||
create_location,
|
||||
matching::{get_route_matches, resolve_path, Branch, RouteMatch},
|
||||
unescape, History, Location, LocationChange, RouteContext, RouterIntegrationContext, State,
|
||||
Url,
|
||||
create_location, matching::resolve_path, History, Location, LocationChange, RouteContext,
|
||||
RouterIntegrationContext, State,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
use crate::{unescape, Url};
|
||||
|
||||
#[derive(TypedBuilder)]
|
||||
pub struct RouterProps {
|
||||
#[builder(default, setter(strip_option))]
|
||||
|
|
Loading…
Reference in New Issue