mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-22 22:09:22 -05:00
Feat/thaw components (#146)
* feat: extract utils as the library * fix: thaw_components dependencies
This commit is contained in:
parent
9bf0f7da1a
commit
2be216043e
37 changed files with 89 additions and 77 deletions
|
@ -1,8 +1,9 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = ["thaw", "thaw_utils", "demo", "demo_markdown"]
|
members = ["thaw", "thaw_components", "thaw_utils", "demo", "demo_markdown"]
|
||||||
exclude = ["examples"]
|
exclude = ["examples"]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
thaw = { version = "0.2.3", path = "./thaw" }
|
thaw = { version = "0.2.3", path = "./thaw" }
|
||||||
|
thaw_components = { version = "0.0.1", path = "./thaw_components" }
|
||||||
thaw_utils = { version = "0.0.1", path = "./thaw_utils" }
|
thaw_utils = { version = "0.0.1", path = "./thaw_utils" }
|
||||||
|
|
|
@ -14,6 +14,7 @@ license = "MIT"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
leptos = { version = "0.6.9" }
|
leptos = { version = "0.6.9" }
|
||||||
|
thaw_components = { workspace = true }
|
||||||
thaw_utils = { workspace = true }
|
thaw_utils = { workspace = true }
|
||||||
web-sys = { version = "0.3.69", features = [
|
web-sys = { version = "0.3.69", features = [
|
||||||
"DomRect",
|
"DomRect",
|
||||||
|
@ -30,6 +31,6 @@ chrono = "0.4.35"
|
||||||
palette = "0.7.5"
|
palette = "0.7.5"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
csr = ["leptos/csr", "thaw_utils/csr"]
|
csr = ["leptos/csr", "thaw_components/csr", "thaw_utils/csr"]
|
||||||
ssr = ["leptos/ssr", "thaw_utils/ssr"]
|
ssr = ["leptos/ssr", "thaw_components/ssr", "thaw_utils/ssr"]
|
||||||
hydrate = ["leptos/hydrate", "thaw_utils/hydrate"]
|
hydrate = ["leptos/hydrate", "thaw_components/hydrate", "thaw_utils/hydrate"]
|
||||||
|
|
|
@ -2,8 +2,9 @@ mod theme;
|
||||||
|
|
||||||
pub use theme::AlertTheme;
|
pub use theme::AlertTheme;
|
||||||
|
|
||||||
use crate::{components::OptionComp, theme::use_theme, Icon, Theme};
|
use crate::{theme::use_theme, Icon, Theme};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::OptionComp;
|
||||||
use thaw_utils::{class_list, mount_style, OptionalProp};
|
use thaw_utils::{class_list, mount_style, OptionalProp};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
|
@ -2,11 +2,9 @@ mod theme;
|
||||||
|
|
||||||
pub use theme::AutoCompleteTheme;
|
pub use theme::AutoCompleteTheme;
|
||||||
|
|
||||||
use crate::{
|
use crate::{use_theme, ComponentRef, Input, InputPrefix, InputRef, InputSuffix, Theme};
|
||||||
components::{Binder, CSSTransition, Follower, FollowerPlacement, FollowerWidth},
|
|
||||||
use_theme, ComponentRef, Input, InputPrefix, InputRef, InputSuffix, Theme,
|
|
||||||
};
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::{Binder, CSSTransition, Follower, FollowerPlacement, FollowerWidth};
|
||||||
use thaw_utils::{class_list, mount_style, Model, OptionalProp, StoredMaybeSignal};
|
use thaw_utils::{class_list, mount_style, Model, OptionalProp, StoredMaybeSignal};
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone, PartialEq)]
|
||||||
|
|
|
@ -2,8 +2,9 @@ mod theme;
|
||||||
|
|
||||||
pub use theme::AvatarTheme;
|
pub use theme::AvatarTheme;
|
||||||
|
|
||||||
use crate::{components::OptionComp, use_theme, Theme};
|
use crate::{use_theme, Theme};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::OptionComp;
|
||||||
use thaw_utils::{class_list, mount_style, OptionalProp};
|
use thaw_utils::{class_list, mount_style, OptionalProp};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -4,12 +4,9 @@ mod theme;
|
||||||
pub use button_group::ButtonGroup;
|
pub use button_group::ButtonGroup;
|
||||||
pub use theme::ButtonTheme;
|
pub use theme::ButtonTheme;
|
||||||
|
|
||||||
use crate::{
|
use crate::{icon::Icon, theme::*};
|
||||||
components::{OptionComp, Wave, WaveRef},
|
|
||||||
icon::Icon,
|
|
||||||
theme::*,
|
|
||||||
};
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::{OptionComp, Wave, WaveRef};
|
||||||
use thaw_utils::{class_list, mount_style, ComponentRef, OptionalMaybeSignal, OptionalProp};
|
use thaw_utils::{class_list, mount_style, ComponentRef, OptionalMaybeSignal, OptionalProp};
|
||||||
|
|
||||||
#[derive(Default, PartialEq, Clone, Copy)]
|
#[derive(Default, PartialEq, Clone, Copy)]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::{components::*, use_theme, Theme};
|
use crate::{use_theme, Theme};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::*;
|
||||||
use thaw_utils::{class_list, mount_style, OptionalProp};
|
use thaw_utils::{class_list, mount_style, OptionalProp};
|
||||||
|
|
||||||
#[slot]
|
#[slot]
|
||||||
|
|
|
@ -4,8 +4,9 @@ mod checkbox_item;
|
||||||
pub use checkbox_group::CheckboxGroup;
|
pub use checkbox_group::CheckboxGroup;
|
||||||
pub use checkbox_item::CheckboxItem;
|
pub use checkbox_item::CheckboxItem;
|
||||||
|
|
||||||
use crate::{components::*, icon::*, theme::use_theme, Theme};
|
use crate::{icon::*, theme::use_theme, Theme};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::*;
|
||||||
use thaw_utils::{class_list, mount_style, Model, OptionalProp};
|
use thaw_utils::{class_list, mount_style, Model, OptionalProp};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use super::use_collapse;
|
use super::use_collapse;
|
||||||
use crate::{components::CSSTransition, Icon};
|
use crate::Icon;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::CSSTransition;
|
||||||
use thaw_utils::{class_list, OptionalProp, StoredMaybeSignal};
|
use thaw_utils::{class_list, OptionalProp, StoredMaybeSignal};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -4,13 +4,11 @@ mod theme;
|
||||||
pub use color::*;
|
pub use color::*;
|
||||||
pub use theme::ColorPickerTheme;
|
pub use theme::ColorPickerTheme;
|
||||||
|
|
||||||
use crate::{
|
use crate::{use_theme, Theme};
|
||||||
components::{Binder, CSSTransition, Follower, FollowerPlacement},
|
|
||||||
use_theme, Theme,
|
|
||||||
};
|
|
||||||
use leptos::leptos_dom::helpers::WindowListenerHandle;
|
use leptos::leptos_dom::helpers::WindowListenerHandle;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use palette::{Hsv, IntoColor, Srgb};
|
use palette::{Hsv, IntoColor, Srgb};
|
||||||
|
use thaw_components::{Binder, CSSTransition, Follower, FollowerPlacement};
|
||||||
use thaw_utils::{class_list, mount_style, Model, OptionalProp};
|
use thaw_utils::{class_list, mount_style, Model, OptionalProp};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
mod binder;
|
|
||||||
mod css_transition;
|
|
||||||
mod if_comp;
|
|
||||||
mod option_comp;
|
|
||||||
mod teleport;
|
|
||||||
mod wave;
|
|
||||||
|
|
||||||
pub(crate) use binder::*;
|
|
||||||
pub(crate) use css_transition::CSSTransition;
|
|
||||||
pub(crate) use if_comp::*;
|
|
||||||
use leptos::*;
|
|
||||||
pub(crate) use option_comp::*;
|
|
||||||
pub(crate) use teleport::*;
|
|
||||||
pub(crate) use wave::*;
|
|
||||||
|
|
||||||
#[slot]
|
|
||||||
pub struct Fallback {
|
|
||||||
children: ChildrenFn,
|
|
||||||
}
|
|
|
@ -3,13 +3,11 @@ mod theme;
|
||||||
|
|
||||||
pub use theme::DatePickerTheme;
|
pub use theme::DatePickerTheme;
|
||||||
|
|
||||||
use crate::{
|
use crate::{Icon, Input, InputSuffix, SignalWatch};
|
||||||
components::{Binder, Follower, FollowerPlacement},
|
|
||||||
Icon, Input, InputSuffix, SignalWatch,
|
|
||||||
};
|
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use panel::{Panel, PanelRef};
|
use panel::{Panel, PanelRef};
|
||||||
|
use thaw_components::{Binder, Follower, FollowerPlacement};
|
||||||
use thaw_utils::{mount_style, now_date, ComponentRef, Model, OptionalProp};
|
use thaw_utils::{mount_style, now_date, ComponentRef, Model, OptionalProp};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -2,11 +2,12 @@ mod date_panel;
|
||||||
mod month_panel;
|
mod month_panel;
|
||||||
mod year_panel;
|
mod year_panel;
|
||||||
|
|
||||||
use crate::{components::CSSTransition, use_theme, Theme};
|
use crate::{use_theme, Theme};
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use date_panel::DatePanel;
|
use date_panel::DatePanel;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use month_panel::MonthPanel;
|
use month_panel::MonthPanel;
|
||||||
|
use thaw_components::CSSTransition;
|
||||||
use thaw_utils::{now_date, ComponentRef};
|
use thaw_utils::{now_date, ComponentRef};
|
||||||
use year_panel::YearPanel;
|
use year_panel::YearPanel;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use crate::{
|
use crate::Card;
|
||||||
components::{CSSTransition, Teleport},
|
|
||||||
Card,
|
|
||||||
};
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::{CSSTransition, Teleport};
|
||||||
use thaw_utils::{class_list, mount_style, use_lock_html_scroll, Model, OptionalProp};
|
use thaw_utils::{class_list, mount_style, use_lock_html_scroll, Model, OptionalProp};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -10,7 +10,6 @@ mod checkbox;
|
||||||
mod code;
|
mod code;
|
||||||
mod collapse;
|
mod collapse;
|
||||||
mod color_picker;
|
mod color_picker;
|
||||||
mod components;
|
|
||||||
mod date_picker;
|
mod date_picker;
|
||||||
mod divider;
|
mod divider;
|
||||||
mod drawer;
|
mod drawer;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use super::{LoadingBar, LoadingBarRef};
|
use super::{LoadingBar, LoadingBarRef};
|
||||||
use crate::components::Teleport;
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::Teleport;
|
||||||
use thaw_utils::ComponentRef;
|
use thaw_utils::ComponentRef;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use super::{message_environment::MessageEnvironment, MessageVariant};
|
use super::{message_environment::MessageEnvironment, MessageVariant};
|
||||||
use crate::components::Teleport;
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use thaw_components::Teleport;
|
||||||
use thaw_utils::{class_list, mount_style};
|
use thaw_utils::{class_list, mount_style};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,9 @@ mod theme;
|
||||||
pub use message_provider::*;
|
pub use message_provider::*;
|
||||||
pub use theme::MessageTheme;
|
pub use theme::MessageTheme;
|
||||||
|
|
||||||
use crate::{
|
use crate::{theme::use_theme, Icon, Theme};
|
||||||
components::{If, Then},
|
|
||||||
theme::use_theme,
|
|
||||||
Icon, Theme,
|
|
||||||
};
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::{If, Then};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
|
|
|
@ -2,8 +2,9 @@ mod theme;
|
||||||
|
|
||||||
pub use theme::NavBarTheme;
|
pub use theme::NavBarTheme;
|
||||||
|
|
||||||
use crate::{components::*, icon::*, use_theme, Theme};
|
use crate::{icon::*, use_theme, Theme};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::*;
|
||||||
use thaw_utils::{class_list, mount_style, OptionalProp};
|
use thaw_utils::{class_list, mount_style, OptionalProp};
|
||||||
|
|
||||||
#[slot]
|
#[slot]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use super::use_tabbar;
|
use super::use_tabbar;
|
||||||
use crate::components::*;
|
|
||||||
use crate::{icon::Icon, theme::use_theme, Theme};
|
use crate::{icon::Icon, theme::use_theme, Theme};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::*;
|
||||||
use thaw_utils::{mount_style, StoredMaybeSignal};
|
use thaw_utils::{mount_style, StoredMaybeSignal};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use crate::{
|
use crate::{Card, CardFooter, CardHeader, CardHeaderExtra, Icon};
|
||||||
components::{CSSTransition, OptionComp, Teleport},
|
|
||||||
Card, CardFooter, CardHeader, CardHeaderExtra, Icon,
|
|
||||||
};
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::{CSSTransition, OptionComp, Teleport};
|
||||||
use thaw_utils::{mount_style, use_click_position, Model};
|
use thaw_utils::{mount_style, use_click_position, Model};
|
||||||
|
|
||||||
#[slot]
|
#[slot]
|
||||||
|
|
|
@ -2,12 +2,10 @@ mod theme;
|
||||||
|
|
||||||
pub use theme::PopoverTheme;
|
pub use theme::PopoverTheme;
|
||||||
|
|
||||||
use crate::{
|
use crate::{use_theme, Theme};
|
||||||
components::{Binder, CSSTransition, Follower, FollowerPlacement},
|
|
||||||
use_theme, Theme,
|
|
||||||
};
|
|
||||||
use leptos::{leptos_dom::helpers::TimeoutHandle, *};
|
use leptos::{leptos_dom::helpers::TimeoutHandle, *};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use thaw_components::{Binder, CSSTransition, Follower, FollowerPlacement};
|
||||||
use thaw_utils::{add_event_listener, class_list, mount_style, OptionalProp};
|
use thaw_utils::{add_event_listener, class_list, mount_style, OptionalProp};
|
||||||
|
|
||||||
#[slot]
|
#[slot]
|
||||||
|
|
|
@ -2,13 +2,10 @@ mod theme;
|
||||||
|
|
||||||
pub use theme::SelectTheme;
|
pub use theme::SelectTheme;
|
||||||
|
|
||||||
use crate::{
|
use crate::{theme::use_theme, Theme};
|
||||||
components::{Binder, CSSTransition, Follower, FollowerPlacement, FollowerWidth},
|
|
||||||
theme::use_theme,
|
|
||||||
Theme,
|
|
||||||
};
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
use thaw_components::{Binder, CSSTransition, Follower, FollowerPlacement, FollowerWidth};
|
||||||
use thaw_utils::{class_list, mount_style, Model, OptionalProp};
|
use thaw_utils::{class_list, mount_style, Model, OptionalProp};
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Hash)]
|
#[derive(Clone, PartialEq, Eq, Hash)]
|
||||||
|
|
|
@ -4,8 +4,9 @@ mod theme;
|
||||||
pub use slider_label::SliderLabel;
|
pub use slider_label::SliderLabel;
|
||||||
pub use theme::SliderTheme;
|
pub use theme::SliderTheme;
|
||||||
|
|
||||||
use crate::{components::OptionComp, theme::use_theme, Theme};
|
use crate::{theme::use_theme, Theme};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::OptionComp;
|
||||||
use thaw_utils::{class_list, mount_style, Model, OptionalProp};
|
use thaw_utils::{class_list, mount_style, Model, OptionalProp};
|
||||||
use web_sys::DomRect;
|
use web_sys::DomRect;
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ mod theme;
|
||||||
pub use theme::TimePickerTheme;
|
pub use theme::TimePickerTheme;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
components::{Binder, CSSTransition, Follower, FollowerPlacement},
|
|
||||||
use_theme, Button, ButtonSize, ButtonVariant, Icon, Input, InputSuffix, SignalWatch, Theme,
|
use_theme, Button, ButtonSize, ButtonVariant, Icon, Input, InputSuffix, SignalWatch, Theme,
|
||||||
};
|
};
|
||||||
use chrono::{Local, NaiveTime, Timelike};
|
use chrono::{Local, NaiveTime, Timelike};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use thaw_components::{Binder, CSSTransition, Follower, FollowerPlacement};
|
||||||
use thaw_utils::{mount_style, ComponentRef, Model, OptionalProp};
|
use thaw_utils::{mount_style, ComponentRef, Model, OptionalProp};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
23
thaw_components/Cargo.toml
Normal file
23
thaw_components/Cargo.toml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
[package]
|
||||||
|
name = "thaw_components"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2021"
|
||||||
|
keywords = ["leptos", "thaw", "components"]
|
||||||
|
readme = "../README.md"
|
||||||
|
authors = ["luoxiaozero"]
|
||||||
|
description = "Shared Thaw internal components"
|
||||||
|
repository = "https://github.com/thaw-ui/thaw"
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
leptos = { version = "0.6.9" }
|
||||||
|
thaw_utils = { workspace = true }
|
||||||
|
web-sys = { version = "0.3.69", features = ["DomRect"] }
|
||||||
|
cfg-if = "1.0.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
csr = ["leptos/csr"]
|
||||||
|
ssr = ["leptos/ssr"]
|
||||||
|
hydrate = ["leptos/hydrate"]
|
|
@ -2,7 +2,7 @@ mod get_placement_style;
|
||||||
|
|
||||||
pub use get_placement_style::FollowerPlacement;
|
pub use get_placement_style::FollowerPlacement;
|
||||||
|
|
||||||
use crate::components::Teleport;
|
use crate::Teleport;
|
||||||
use get_placement_style::{get_follower_placement_offset, FollowerPlacementOffset};
|
use get_placement_style::{get_follower_placement_offset, FollowerPlacementOffset};
|
||||||
use leptos::{
|
use leptos::{
|
||||||
html::{AnyElement, ElementDescriptor, ToHtmlElement},
|
html::{AnyElement, ElementDescriptor, ToHtmlElement},
|
20
thaw_components/src/lib.rs
Normal file
20
thaw_components/src/lib.rs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
mod binder;
|
||||||
|
mod css_transition;
|
||||||
|
mod if_comp;
|
||||||
|
mod option_comp;
|
||||||
|
mod teleport;
|
||||||
|
mod wave;
|
||||||
|
|
||||||
|
pub use binder::{Binder, Follower, FollowerPlacement, FollowerWidth};
|
||||||
|
pub use css_transition::CSSTransition;
|
||||||
|
pub use if_comp::{ElseIf, If, Then};
|
||||||
|
pub use option_comp::OptionComp;
|
||||||
|
pub use teleport::Teleport;
|
||||||
|
pub use wave::{Wave, WaveRef};
|
||||||
|
|
||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
#[slot]
|
||||||
|
pub struct Fallback {
|
||||||
|
children: ChildrenFn,
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ mod optional_prop;
|
||||||
mod signals;
|
mod signals;
|
||||||
mod time;
|
mod time;
|
||||||
|
|
||||||
pub use event_listener::*;
|
pub use event_listener::{add_event_listener, EventListenerHandle};
|
||||||
pub use hooks::{use_click_position, use_lock_html_scroll};
|
pub use hooks::{use_click_position, use_lock_html_scroll};
|
||||||
pub use mount_style::mount_style;
|
pub use mount_style::mount_style;
|
||||||
pub use optional_prop::OptionalProp;
|
pub use optional_prop::OptionalProp;
|
||||||
|
|
Loading…
Add table
Reference in a new issue