diff --git a/Cargo.toml b/Cargo.toml index 1072d77..146057f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,6 @@ thaw_components = { version = "0.2.0-alpha", path = "./thaw_components" } thaw_macro = { version = "0.1.0-alpha", path = "./thaw_macro" } thaw_utils = { version = "0.1.0-alpha", path = "./thaw_utils" } -leptos = { git = "https://github.com/leptos-rs/leptos", rev = "3dbedfc8710add4bc9a94fe27fa000fb180f393b" } -leptos_meta = { git = "https://github.com/leptos-rs/leptos", rev = "3dbedfc8710add4bc9a94fe27fa000fb180f393b" } -leptos_router = { git = "https://github.com/leptos-rs/leptos", rev = "3dbedfc8710add4bc9a94fe27fa000fb180f393b" } +leptos = { git = "https://github.com/leptos-rs/leptos", rev = "867036559489e86c1f25cdf7133d803d88b0579b" } +leptos_meta = { git = "https://github.com/leptos-rs/leptos", rev = "867036559489e86c1f25cdf7133d803d88b0579b" } +leptos_router = { git = "https://github.com/leptos-rs/leptos", rev = "867036559489e86c1f25cdf7133d803d88b0579b" } diff --git a/thaw/src/back_top/mod.rs b/thaw/src/back_top/mod.rs index b0ca905..58db86b 100644 --- a/thaw/src/back_top/mod.rs +++ b/thaw/src/back_top/mod.rs @@ -10,11 +10,14 @@ use thaw_utils::{ pub fn BackTop( #[prop(optional, into)] class: MaybeProp, /// The width of BackTop from the right side of the page. - #[prop(default=40.into(), into)] right: MaybeSignal, + #[prop(default=40.into(), into)] + right: MaybeSignal, /// The height of BackTop from the bottom of the page. - #[prop(default=40.into(), into)] bottom: MaybeSignal, + #[prop(default=40.into(), into)] + bottom: MaybeSignal, /// BackTop's trigger scroll top. - #[prop(default=180.into(), into)] visibility_height: MaybeSignal, + #[prop(default=180.into(), into)] + visibility_height: MaybeSignal, #[prop(optional)] children: Option, ) -> impl IntoView { mount_style("back-top", include_str!("./back-top.css")); @@ -24,7 +27,7 @@ pub fn BackTop( let is_show_back_top = RwSignal::new(false); let scroll_top = RwSignal::new(0); - Effect::new(move |prev| { + Effect::new(move |prev: Option<()>| { scroll_top.track(); if prev.is_some() { is_show_back_top.set(scroll_top.get() > visibility_height.get_untracked()); diff --git a/thaw/src/color_picker/mod.rs b/thaw/src/color_picker/mod.rs index ca138cf..b8a8d05 100644 --- a/thaw/src/color_picker/mod.rs +++ b/thaw/src/color_picker/mod.rs @@ -66,7 +66,7 @@ pub fn ColorPicker( style }); - Effect::new(move |prev| { + Effect::new(move |prev: Option<()>| { let (s, v) = sv.get(); let hue_value = hue.get(); if prev.is_none() { diff --git a/thaw_components/src/focus_trap/mod.rs b/thaw_components/src/focus_trap/mod.rs index 6dacf75..5529ad8 100644 --- a/thaw_components/src/focus_trap/mod.rs +++ b/thaw_components/src/focus_trap/mod.rs @@ -30,7 +30,7 @@ pub fn FocusTrap( STACK.with_borrow_mut(|stack| stack.retain(|value| id.with_value(|id| id != value))); }; - Effect::new(move |prev| { + Effect::new(move |prev: Option| { let is_active = active.get(); if is_active && !prev.unwrap_or(false) { let on_esc = on_esc.clone(); diff --git a/thaw_components/src/teleport/mod.rs b/thaw_components/src/teleport/mod.rs index 23c2c83..26e719b 100644 --- a/thaw_components/src/teleport/mod.rs +++ b/thaw_components/src/teleport/mod.rs @@ -1,15 +1,12 @@ -use std::cell::Cell; -// use cfg_if::cfg_if; use leptos::prelude::*; +use std::cell::Cell; -/// https://github.com/solidjs/solid/blob/main/packages/solid/web/src/index.ts#L56 #[component] pub fn Teleport( #[prop(default = true.into(), into)] immediate: MaybeSignal, #[prop(into, optional)] mount: Option, children: Children, ) -> impl IntoView { - // cfg_if! { if #[cfg(all(target_arch = "wasm32", any(feature = "csr", feature = "hydrate")))] { let mount_fn: Cell ()>>> = Cell::new(Some(Box::new(move || { let mount = if let Some(el) = mount.as_ref() { el @@ -36,7 +33,7 @@ pub fn Teleport( }); }))); - let owner = Owner::current().unwrap(); + let owner = Owner::new(); Effect::new(move |_| { if immediate.get() { let Some(f) = mount_fn.take() else { @@ -48,10 +45,4 @@ pub fn Teleport( }); } }); - // } else { - // let _ = mount; - // let _ = immediate; - // let _ = element; - // let _ = children; - // }} } diff --git a/thaw_utils/src/signals/signal_watch.rs b/thaw_utils/src/signals/signal_watch.rs index 8e04be0..59e3bb9 100644 --- a/thaw_utils/src/signals/signal_watch.rs +++ b/thaw_utils/src/signals/signal_watch.rs @@ -39,7 +39,7 @@ where fn watch(&self, f: impl Fn(&Self::Value) + 'static) -> Box { let signal = *self; - let effect = Effect::new(move |prev| { + let effect = Effect::new(move |prev: Option<()>| { signal.with(|value| { if prev.is_some() { untrack(|| f(value));