diff --git a/Cargo.toml b/Cargo.toml index 85c6708..091f8f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,5 @@ thaw_components = { version = "0.1.1", path = "./thaw_components" } thaw_macro = { version = "0.1.0", path = "./thaw_macro" } thaw_utils = { version = "0.0.3", path = "./thaw_utils" } -leptos = { git = "https://github.com/leptos-rs/leptos", branch = "leptos_0.7" } -leptos_meta = { git = "https://github.com/leptos-rs/leptos", branch = "leptos_0.7" } \ No newline at end of file +leptos = { git = "https://github.com/leptos-rs/leptos", rev = "ae0dc13c" } +leptos_meta = { git = "https://github.com/leptos-rs/leptos", rev = "ae0dc13c" } \ No newline at end of file diff --git a/thaw/src/anchor/mod.rs b/thaw/src/anchor/mod.rs index b072839..edb3314 100644 --- a/thaw/src/anchor/mod.rs +++ b/thaw/src/anchor/mod.rs @@ -19,6 +19,7 @@ pub fn Anchor( let element_ids = RwSignal::new(Vec::::new()); let active_id = RwSignal::new(None::); + let offset_target = send_wrapper::SendWrapper::new(offset_target); let on_scroll = move || { element_ids.with(|ids| { let offset_target_top = if let Some(offset_target) = offset_target.as_ref() { diff --git a/thaw/src/auto_complete/mod.rs b/thaw/src/auto_complete/mod.rs index b61f663..cf6eb4e 100644 --- a/thaw/src/auto_complete/mod.rs +++ b/thaw/src/auto_complete/mod.rs @@ -3,7 +3,7 @@ mod auto_complete_option; pub use auto_complete_option::AutoCompleteOption; use crate::{ComponentRef, ConfigInjection, Input, InputPrefix, InputRef, InputSuffix}; -use leptos::{prelude::*, html}; +use leptos::{context::Provider, html, prelude::*}; use thaw_components::{ Binder, CSSTransition, Follower, FollowerPlacement, FollowerWidth, OptionComp, }; @@ -189,7 +189,7 @@ pub fn AutoComplete( >
diff --git a/thaw/src/combobox/combobox.rs b/thaw/src/combobox/combobox.rs index 9f8ad77..c918588 100644 --- a/thaw/src/combobox/combobox.rs +++ b/thaw/src/combobox/combobox.rs @@ -107,7 +107,7 @@ pub fn Combobox( >
diff --git a/thaw/src/dialog/dialog.rs b/thaw/src/dialog/dialog.rs index 750224a..349d3b3 100644 --- a/thaw/src/dialog/dialog.rs +++ b/thaw/src/dialog/dialog.rs @@ -39,7 +39,7 @@ pub fn Dialog( > diff --git a/thaw/src/drawer/overlay_drawer.rs b/thaw/src/drawer/overlay_drawer.rs index a9959a4..ee224d7 100644 --- a/thaw/src/drawer/overlay_drawer.rs +++ b/thaw/src/drawer/overlay_drawer.rs @@ -73,7 +73,7 @@ pub fn OverlayDrawer( >
diff --git a/thaw/src/icon/mod.rs b/thaw/src/icon/mod.rs index 21f9fab..d96d795 100644 --- a/thaw/src/icon/mod.rs +++ b/thaw/src/icon/mod.rs @@ -56,8 +56,8 @@ pub fn Icon( }; icon_style.set(style); - icon_x.set(icon.x.map(|x| x.into_attribute())); - icon_y.set(icon.y.map(|y| y.into_attribute())); + icon_x.set(icon.x.map(|x| x.to_string())); + icon_y.set(icon.y.map(|y| y.to_string())); let width = match (width.clone(), icon.width) { (Some(a), _) => a, @@ -71,13 +71,13 @@ pub fn Icon( }; icon_height.set(Some(height)); - icon_view_box.set(icon.view_box.map(|view_box| view_box.into_attribute())); - icon_stroke_linecap.set(icon.stroke_linecap.map(|a| a.into_attribute())); - icon_stroke_linejoin.set(icon.stroke_linejoin.map(|a| a.into_attribute())); - icon_stroke_width.set(icon.stroke_width.map(|a| a.into_attribute())); - icon_stroke.set(icon.stroke.map(|a| a.into_attribute())); - icon_fill.set(Some(icon.fill.unwrap_or("currentColor").into_attribute())); - icon_data.set(Some(icon.data.into_attribute())); + icon_view_box.set(icon.view_box.map(|view_box| view_box.to_string())); + icon_stroke_linecap.set(icon.stroke_linecap.map(|a| a.to_string())); + icon_stroke_linejoin.set(icon.stroke_linejoin.map(|a| a.to_string())); + icon_stroke_width.set(icon.stroke_width.map(|a| a.to_string())); + icon_stroke.set(icon.stroke.map(|a| a.to_string())); + icon_fill.set(Some(icon.fill.unwrap_or("currentColor").to_string())); + icon_data.set(Some(icon.data.to_string())); }); view! { @@ -100,15 +100,18 @@ pub fn Icon( } } -fn take_signal(signal: RwSignal>>) -> Option { +fn take_signal(signal: RwSignal>>) -> String { signal.with(|s| match s { - Some(MaybeSignal::Static(value)) => Some(value.clone()), - Some(MaybeSignal::Dynamic(signal)) => Some(signal.get()), - _ => None, + Some(MaybeSignal::Static(value)) => value.clone(), + Some(MaybeSignal::Dynamic(signal)) => signal.get(), + _ => String::new(), }) } -fn take(signal: RwSignal>) -> Option { +fn take(signal: RwSignal>) -> String { signal.track(); - signal.try_update_untracked(|value| value.take()).flatten() + signal + .try_update_untracked(|value| value.take()) + .flatten() + .unwrap_or_default() } diff --git a/thaw/src/input/mod.rs b/thaw/src/input/mod.rs index bd8d30b..9523b2e 100644 --- a/thaw/src/input/mod.rs +++ b/thaw/src/input/mod.rs @@ -1,4 +1,5 @@ use leptos::{ev, html, prelude::*}; +use send_wrapper::SendWrapper; use thaw_utils::{class_list, mount_style, ComponentRef, Model, OptionalProp}; #[derive(Default, Clone)] @@ -37,8 +38,8 @@ pub fn Input( #[prop(optional, into)] allow_value: Option>, #[prop(optional, into)] variant: MaybeSignal, #[prop(optional, into)] placeholder: OptionalProp>, - #[prop(optional, into)] on_focus: Option>, - #[prop(optional, into)] on_blur: Option>, + #[prop(optional, into)] on_focus: Option>>, + #[prop(optional, into)] on_blur: Option>>, #[prop(optional, into)] disabled: MaybeSignal, #[prop(optional, into)] invalid: MaybeSignal, #[prop(optional)] input_prefix: Option, @@ -50,27 +51,30 @@ pub fn Input( mount_style("input", include_str!("./input.css")); let value_trigger = ArcTrigger::new(); - let on_input = move |ev| { - let input_value = event_target_value(&ev); - if let Some(allow_value) = allow_value.as_ref() { - if !allow_value.call(input_value.clone()) { - value_trigger.trigger(); - return; + let on_input = { + let value_trigger = value_trigger.clone(); + move |ev| { + let input_value = event_target_value(&ev); + if let Some(allow_value) = allow_value.as_ref() { + if !allow_value.call(input_value.clone()) { + value_trigger.trigger(); + return; + } } + value.set(input_value); } - value.set(input_value); }; let is_focus = RwSignal::new(false); let on_internal_focus = move |ev| { is_focus.set(true); if let Some(on_focus) = on_focus.as_ref() { - on_focus.call(ev); + on_focus.call(SendWrapper::new(ev)); } }; let on_internal_blur = move |ev| { is_focus.set(false); if let Some(on_blur) = on_blur.as_ref() { - on_blur.call(ev); + on_blur.call(SendWrapper::new(ev)); } }; @@ -113,12 +117,15 @@ pub fn Input( // }); // } + let prefix_if_ = input_prefix.as_ref().map_or(false, |prefix| prefix.if_); + let suffix_if_ = input_suffix.as_ref().map_or(false, |suffix| suffix.if_); + view! {
format!("{width}px {height}px"), }; - view! { -
+ children() - {children() - .nodes - .into_iter() - .map(|node| { - view! {
{node}
} - }) - .collect::>()} + // view! { + //
-
- } + // // {children() + // // .nodes + // // .into_iter() + // // .map(|node| { + // // view! {
{node}
} + // // }) + // // .collect::>()} + + //
+ // } } #[derive(Clone)] diff --git a/thaw/src/spinner/mod.rs b/thaw/src/spinner/mod.rs index 97b4709..b01c4d7 100644 --- a/thaw/src/spinner/mod.rs +++ b/thaw/src/spinner/mod.rs @@ -42,14 +42,14 @@ pub fn Spinner( mount_style("spinner", include_str!("./spinner.css")); let id = StoredValue::new(uuid::Uuid::new_v4().to_string()); - let spinner_label = label.clone(); - let labelledby = move || spinner_label.with(|_| true).map(|_| id.get_value()); + // let spinner_label = label.clone(); + // let labelledby = move || spinner_label.with(|_| true).map(|_| id.get_value()); view! {
diff --git a/thaw/src/tab_list/tab.rs b/thaw/src/tab_list/tab.rs index 6d1f672..d28123d 100644 --- a/thaw/src/tab_list/tab.rs +++ b/thaw/src/tab_list/tab.rs @@ -65,7 +65,7 @@ pub fn Tab( "thaw-tab", ("thaw-tab--selected", move || selected.get()), class ] role="tab" - aria-selected=move || if selected.get() { "true" } else { "false" } + // aria-selected=move || if selected.get() { "true" } else { "false" } node_ref=tab_ref on:click=on_select > diff --git a/thaw/src/time_picker/mod.rs b/thaw/src/time_picker/mod.rs index 40b4a6a..6edf814 100644 --- a/thaw/src/time_picker/mod.rs +++ b/thaw/src/time_picker/mod.rs @@ -158,7 +158,7 @@ fn Panel(
@@ -317,10 +317,8 @@ fn PanelTimeItem( comp_ref: ComponentRef, ) -> impl IntoView { let item_ref = NodeRef::new(); - item_ref.on_load(move |_| { - let item_ref = PanelTimeItemRef { item_ref }; - comp_ref.load(item_ref); - }); + comp_ref.load(PanelTimeItemRef { item_ref }); + view! {
impl IntoView { mount_style("toaster", include_str!("./toaster.css")); - let toast_list = RwSignal::new(vec![]); + // let toast_list = RwSignal::new(vec![]); Effect::new(move |_| { for view in receiver.try_recv() { - toast_list.update(move |list| { - list.push(view); - }); + // toast_list.update(move |list| { + // list.push(view.0); + // }); } }); view! { diff --git a/thaw_utils/src/class_list.rs b/thaw_utils/src/class_list.rs index 6f452ae..0b318cb 100644 --- a/thaw_utils/src/class_list.rs +++ b/thaw_utils/src/class_list.rs @@ -140,10 +140,11 @@ impl ClassList { } } -impl<'a, R> leptos::tachys::html::class::IntoClass for ClassList +impl leptos::tachys::html::class::IntoClass for ClassList where R: DomRenderer, { + type AsyncOutput = Self; type State = (R::ClassList, String); type Cloneable = Self; type CloneableOwned = Self; @@ -208,6 +209,12 @@ where fn into_cloneable_owned(self) -> Self::CloneableOwned { self } + + fn dry_resolve(&mut self) {} + + async fn resolve(self) -> Self::AsyncOutput { + self + } } pub enum Class {