From 227a3211cae7a46f8ca35a75b9205e67e522a8bb Mon Sep 17 00:00:00 2001 From: luoxiaozero <48741584+luoxiaozero@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:49:02 +0800 Subject: [PATCH] feat: Update leptos to v0.5.3 (#27) --- Cargo.toml | 4 ++-- demo/Cargo.toml | 6 +++--- demo/src/components/demo.rs | 4 +++- src/breadcrumb/mod.rs | 6 +----- src/checkbox/checkbox_group.rs | 1 - src/grid/mod.rs | 1 - src/loading_bar/loading_bar_provider.rs | 5 +---- src/menu/mod.rs | 1 - src/message/message_provider.rs | 5 +---- src/mobile/tabbar/mod.rs | 6 +----- src/tabs/mod.rs | 6 +----- src/theme/mod.rs | 1 - src/typography/text.rs | 3 +-- src/utils/mod.rs | 2 -- src/utils/provider.rs | 13 ------------- 15 files changed, 14 insertions(+), 50 deletions(-) delete mode 100644 src/utils/provider.rs diff --git a/Cargo.toml b/Cargo.toml index a14260d..0ee56c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,8 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -leptos = { version = "0.5.2" } -leptos_meta = { version = "0.5.2", optional = true } +leptos = { version = "0.5.3" } +leptos_meta = { version = "0.5.3", optional = true } web-sys = { version = "0.3.63", features = [ "DomRect", "File", diff --git a/demo/Cargo.toml b/demo/Cargo.toml index 630353f..979daab 100644 --- a/demo/Cargo.toml +++ b/demo/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -leptos = { version = "0.5.2" } -leptos_meta = { version = "0.5.2" } -leptos_router = { version = "0.5.2" } +leptos = { version = "0.5.3" } +leptos_meta = { version = "0.5.3" } +leptos_router = { version = "0.5.3" } leptos_devtools = "0.0.1" thaw = { path = "../", default-features = false } icondata = { version = "0.1.0", features = [ diff --git a/demo/src/components/demo.rs b/demo/src/components/demo.rs index 2c96d86..f28f067 100644 --- a/demo/src/components/demo.rs +++ b/demo/src/components/demo.rs @@ -43,7 +43,9 @@ pub fn Demo(demo_code: DemoCode, children: Children) -> impl IntoView { for node in frag.nodes { match node { View::Text(text) => html.push_str(&text.content), - _ => leptos::logging::warn!("Only text nodes are supported as children of ."), + _ => { + leptos::logging::warn!("Only text nodes are supported as children of .") + } } } diff --git a/src/breadcrumb/mod.rs b/src/breadcrumb/mod.rs index 6950495..b311bee 100644 --- a/src/breadcrumb/mod.rs +++ b/src/breadcrumb/mod.rs @@ -1,11 +1,7 @@ mod breadcrumb_item; mod theme; -use crate::{ - use_theme, - utils::{mount_style, Provider}, - Theme, -}; +use crate::{use_theme, utils::mount_style, Theme}; pub use breadcrumb_item::BreadcrumbItem; use leptos::*; pub use theme::BreadcrumbTheme; diff --git a/src/checkbox/checkbox_group.rs b/src/checkbox/checkbox_group.rs index 90a0ed5..fda9c53 100644 --- a/src/checkbox/checkbox_group.rs +++ b/src/checkbox/checkbox_group.rs @@ -1,4 +1,3 @@ -use crate::utils::Provider; use leptos::*; use std::collections::HashSet; diff --git a/src/grid/mod.rs b/src/grid/mod.rs index db7c331..f1278f3 100644 --- a/src/grid/mod.rs +++ b/src/grid/mod.rs @@ -1,6 +1,5 @@ mod grid_item; -use crate::utils::Provider; pub use grid_item::*; use leptos::*; diff --git a/src/loading_bar/loading_bar_provider.rs b/src/loading_bar/loading_bar_provider.rs index 2953c7d..6af19b3 100644 --- a/src/loading_bar/loading_bar_provider.rs +++ b/src/loading_bar/loading_bar_provider.rs @@ -1,8 +1,5 @@ use super::{LoadingBar, LoadingBarRef}; -use crate::{ - components::Teleport, - utils::{ComponentRef, Provider}, -}; +use crate::{components::Teleport, utils::ComponentRef}; use leptos::*; #[component] diff --git a/src/menu/mod.rs b/src/menu/mod.rs index 2208d08..3e291d2 100644 --- a/src/menu/mod.rs +++ b/src/menu/mod.rs @@ -2,7 +2,6 @@ mod menu_group; mod menu_item; mod theme; -use crate::utils::Provider; use leptos::*; pub use menu_group::MenuGroup; pub use menu_item::*; diff --git a/src/message/message_provider.rs b/src/message/message_provider.rs index 4639dc8..d0465e0 100644 --- a/src/message/message_provider.rs +++ b/src/message/message_provider.rs @@ -1,10 +1,7 @@ use std::time::Duration; use super::{message_environment::MessageEnvironment, MessageVariant}; -use crate::{ - components::Teleport, - utils::{mount_style, Provider}, -}; +use crate::{components::Teleport, utils::mount_style}; use leptos::*; use uuid::Uuid; diff --git a/src/mobile/tabbar/mod.rs b/src/mobile/tabbar/mod.rs index dadb135..c21c082 100644 --- a/src/mobile/tabbar/mod.rs +++ b/src/mobile/tabbar/mod.rs @@ -1,11 +1,7 @@ mod tabbar_item; mod theme; -use crate::{ - use_theme, - utils::{mount_style, Provider}, - Theme, -}; +use crate::{use_theme, utils::mount_style, Theme}; use leptos::*; pub use tabbar_item::*; pub use theme::TabbarTheme; diff --git a/src/tabs/mod.rs b/src/tabs/mod.rs index 2cae306..71ba144 100644 --- a/src/tabs/mod.rs +++ b/src/tabs/mod.rs @@ -1,10 +1,6 @@ mod tab; -use crate::{ - theme::use_theme, - utils::{mount_style, Provider}, - Theme, -}; +use crate::{theme::use_theme, utils::mount_style, Theme}; use leptos::*; pub use tab::*; diff --git a/src/theme/mod.rs b/src/theme/mod.rs index ae98102..19dc7ef 100644 --- a/src/theme/mod.rs +++ b/src/theme/mod.rs @@ -3,7 +3,6 @@ mod common; use self::common::CommonTheme; use crate::{ mobile::{NavBarTheme, TabbarTheme}, - utils::Provider, AlertTheme, AutoCompleteTheme, AvatarTheme, BreadcrumbTheme, ButtonTheme, ColorPickerTheme, InputTheme, MenuTheme, MessageTheme, ProgressTheme, SelectTheme, SkeletionTheme, SliderTheme, SwitchTheme, TableTheme, TagTheme, TypographyTheme, UploadTheme, diff --git a/src/typography/text.rs b/src/typography/text.rs index 1ded9e6..a878567 100644 --- a/src/typography/text.rs +++ b/src/typography/text.rs @@ -24,7 +24,6 @@ pub fn Text(#[prop(optional)] code: bool, children: Children) -> impl IntoView { } .into_any(); } else { - view! { {children()} } - .into_any() + view! { {children()} }.into_any() } } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 9ca81a9..ed5b257 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -2,7 +2,6 @@ mod component_ref; mod event_listener; mod mount_style; -mod provider; mod signal; mod stored_maybe_signal; @@ -10,7 +9,6 @@ mod stored_maybe_signal; pub(crate) use component_ref::ComponentRef; pub(crate) use event_listener::*; pub(crate) use mount_style::mount_style; -pub(crate) use provider::Provider; pub use signal::SignalWatch; pub(crate) use stored_maybe_signal::*; diff --git a/src/utils/provider.rs b/src/utils/provider.rs deleted file mode 100644 index cf8840f..0000000 --- a/src/utils/provider.rs +++ /dev/null @@ -1,13 +0,0 @@ -/// https://github.com/leptos-rs/leptos/issues/2038 -use leptos::*; - -#[component] -pub fn Provider(value: T, children: Children) -> impl IntoView -where - T: Clone + 'static, -{ - run_as_child(move || { - provide_context(value); - children() - }) -}