diff --git a/thaw_components/src/binder/mod.rs b/thaw_components/src/binder/mod.rs index d63e805..583488b 100644 --- a/thaw_components/src/binder/mod.rs +++ b/thaw_components/src/binder/mod.rs @@ -4,7 +4,9 @@ pub use get_placement_style::FollowerPlacement; use crate::Teleport; use get_placement_style::{get_follower_placement_offset, FollowerPlacementOffset}; -use leptos::{html::ElementDescriptor, leptos_dom::helpers::WindowListenerHandle, *}; +use leptos::{ + ev, html, html::ElementDescriptor, leptos_dom::helpers::WindowListenerHandle, prelude::*, +}; use thaw_utils::{ add_event_listener, get_scroll_parent, mount_style, with_hydration_off, EventListenerHandle, }; @@ -69,9 +71,9 @@ pub fn Binder( children: follower_children, } = follower; - let scroll_listener = store_value(None::>); - let scrollable_element_handle_vec = store_value::>(vec![]); - let resize_handle = store_value(None::); + let scroll_listener = StoredValue::new(None::>); + let scrollable_element_handle_vec = StoredValue::new::>(vec![]); + let resize_handle = StoredValue::new(None::); let ensure_scroll_listener = move || { let Some(el) = target_ref.get_untracked().map(|target| target.into_any()) else { @@ -167,9 +169,9 @@ fn FollowerContainer( #[prop(into)] remove_resize_listener: Callback<()>, children: Children, ) -> impl IntoView { - let content_ref = create_node_ref::(); - let content_style = create_rw_signal(String::new()); - let placement_str = create_rw_signal(placement.as_str()); + let content_ref = NodeRef::::new(); + let content_style = RwSignal::new(String::new()); + let placement_str = RwSignal::new(placement.as_str()); let sync_position: Callback<()> = Callback::new(move |_| { let Some(content_ref) = content_ref.get_untracked() else { return; diff --git a/thaw_components/src/css_transition/mod.rs b/thaw_components/src/css_transition/mod.rs index 1e199d7..5e1a0be 100644 --- a/thaw_components/src/css_transition/mod.rs +++ b/thaw_components/src/css_transition/mod.rs @@ -1,13 +1,13 @@ -use leptos::{html::ElementDescriptor, *}; +use leptos::{ev, html::ElementType, prelude::*}; use std::{ops::Deref, time::Duration}; -use thaw_utils::{add_event_listener, use_next_frame, EventListenerHandle}; +use thaw_utils::{add_event_listener, EventListenerHandle, NextFrame}; /// # CSS Transition /// /// Reference to https://vuejs.org/guide/built-ins/transition.html #[component] -pub fn CSSTransition( - node_ref: NodeRef, +pub fn CSSTransition( + node_ref: NodeRef, #[prop(into)] show: MaybeSignal, #[prop(into)] name: MaybeSignal, #[prop(optional)] appear: bool, @@ -20,17 +20,18 @@ pub fn CSSTransition( children: CF, ) -> impl IntoView where - T: ElementDescriptor + Clone + 'static, + E: ElementType, + E::Output: 'static, CF: FnOnce(ReadSignal>) -> IV + 'static, IV: IntoView, { - let display = create_rw_signal((!show.get_untracked()).then_some("display: none;")); + let display = RwSignal::new((!show.get_untracked()).then_some("display: none;")); node_ref.on_load(move |node_el| { let any_el = node_el.clone().into_any(); let el = any_el.deref().clone(); let class_list = el.class_list(); - let next_frame = use_next_frame(); + let next_frame = NextFrame::use_(); let end_handle = StoredValue::new(None::); let end_count = StoredValue::new(None::); let finish = StoredValue::new(None::>); @@ -166,7 +167,7 @@ where }) }; - create_render_effect(move |prev: Option| { + RenderEffect::new(move |prev: Option| { let show = show.get(); let prev = if let Some(prev) = prev { prev diff --git a/thaw_components/src/focus_trap/mod.rs b/thaw_components/src/focus_trap/mod.rs index 4dfab3a..31c1f8e 100644 --- a/thaw_components/src/focus_trap/mod.rs +++ b/thaw_components/src/focus_trap/mod.rs @@ -1,4 +1,4 @@ -use leptos::*; +use leptos::{ev, prelude::*}; #[cfg(any(feature = "csr", feature = "hydrate"))] thread_local! { diff --git a/thaw_components/src/if_comp.rs b/thaw_components/src/if_comp.rs index 708da33..e253323 100644 --- a/thaw_components/src/if_comp.rs +++ b/thaw_components/src/if_comp.rs @@ -1,5 +1,5 @@ use super::Fallback; -use leptos::*; +use leptos::prelude::*; #[slot] pub struct Then { diff --git a/thaw_components/src/lib.rs b/thaw_components/src/lib.rs index 4901296..cf1c3cf 100644 --- a/thaw_components/src/lib.rs +++ b/thaw_components/src/lib.rs @@ -14,7 +14,7 @@ pub use option_comp::OptionComp; pub use teleport::Teleport; pub use wave::{Wave, WaveRef}; -use leptos::*; +use leptos::prelude::{slot, ChildrenFn}; #[slot] pub struct Fallback { diff --git a/thaw_components/src/teleport/mod.rs b/thaw_components/src/teleport/mod.rs index 5c2b653..f24f096 100644 --- a/thaw_components/src/teleport/mod.rs +++ b/thaw_components/src/teleport/mod.rs @@ -1,5 +1,6 @@ use cfg_if::cfg_if; -use leptos::{html::AnyElement, *}; +use leptos::{html::{AnyElement, HtmlElement}, prelude::*}; +use tachys::view::any_view::AnyView; /// https://github.com/solidjs/solid/blob/main/packages/solid/web/src/index.ts#L56 #[component] diff --git a/thaw_components/src/wave/mod.rs b/thaw_components/src/wave/mod.rs index b5ee7dc..d2c9640 100644 --- a/thaw_components/src/wave/mod.rs +++ b/thaw_components/src/wave/mod.rs @@ -1,4 +1,4 @@ -use leptos::{leptos_dom::helpers::TimeoutHandle, *}; +use leptos::{html, leptos_dom::helpers::TimeoutHandle, prelude::*}; use std::time::Duration; use thaw_utils::{mount_style, ComponentRef}; @@ -16,8 +16,8 @@ impl WaveRef { #[component] pub fn Wave(#[prop(optional)] comp_ref: ComponentRef) -> impl IntoView { mount_style("wave", include_str!("./wave.css")); - let wave_ref = create_node_ref::(); - let animation_timeout_handle = create_rw_signal(None::); + let wave_ref = NodeRef::::new(); + let animation_timeout_handle = RwSignal::new(None::); let play = Callback::new(move |_: ()| { if let Some(handle) = animation_timeout_handle.get() { handle.clear(); @@ -51,7 +51,7 @@ pub fn Wave(#[prop(optional)] comp_ref: ComponentRef) -> impl IntoView move || animation_timeout_handle.with(|handle| handle.is_some()), ) - ref=wave_ref + node_ref=wave_ref > } }