Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thaw/v0.5 #388

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- uses: Swatinem/rust-cache@v2
- name: Install Trunk
uses: jetli/[email protected]
with:
Expand All @@ -47,6 +48,7 @@ jobs:
toolchain: nightly
target: wasm32-unknown-unknown
override: true
- uses: Swatinem/rust-cache@v2
- name: Install Trunk
uses: jetli/[email protected]
with:
Expand All @@ -67,14 +69,11 @@ jobs:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: Install Trunk
uses: jetli/[email protected]
with:
version: "latest"
- uses: Swatinem/rust-cache@v2
- name: Install Cargo BInstall
uses: cargo-bins/cargo-binstall@main
- name: Install Cargo Leptos
run: cargo binstall cargo-leptos -y
run: cargo binstall cargo-leptos --locked --no-confirm
- name: Build
run: |
cd ./examples/ssr_axum
Expand All @@ -91,14 +90,11 @@ jobs:
toolchain: nightly
target: wasm32-unknown-unknown
override: true
- name: Install Trunk
uses: jetli/[email protected]
with:
version: "latest"
- uses: Swatinem/rust-cache@v2
- name: Install Cargo BInstall
uses: cargo-bins/cargo-binstall@main
- name: Install Cargo Leptos
run: cargo binstall cargo-leptos -y
run: cargo binstall cargo-leptos --locked --no-confirm
- name: Build
run: |
cd ./examples/ssr_axum
Expand All @@ -116,6 +112,7 @@ jobs:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- uses: Swatinem/rust-cache@v2
- name: cargo test
run: |
cd thaw_utils
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- uses: Swatinem/rust-cache@v2
- name: Install Trunk
uses: jetli/[email protected]
with:
Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## [0.5.0-alpha](https://github.com/thaw-ui/thaw/compare/v0.4.5...v0.5.0-alpha) (2025-03-30)

### Features

* Adds `Tree` component, closes [#392](https://github.com/thaw-ui/thaw/pull/392).
* `Menu` is changed to a generic component, closes [#390](https://github.com/thaw-ui/thaw/pull/390).

### Breaking Changes

* Update leptos to v0.8.0-beta.
* Theme is changed to use getset.
* RatingColor adds Marigold prop.
* InputType adds Number prop.
* The icon prop of `Icon` is changed to icondata_core::Icon type.
* The value prop of `MenuItem` is changed to generic type.

## [0.4.5](https://github.com/thaw-ui/thaw/compare/v0.4.4...v0.4.5) (2025-03-30)

### Features
Expand Down Expand Up @@ -69,4 +85,4 @@

### 0.1.0-beta2 - 0.4.0-rc (2023-11-14 - 2024-12-09)

See [0.1 - 0.4 changelog](./changelog/CHANGELOG-0.1-0.4.md)
See [0.1 - 0.4 changelog](./changelogs/CHANGELOG-0.1-0.4.md)
18 changes: 11 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ exclude = ["examples"]
rust-version = "1.79"

[workspace.dependencies]
thaw = { version = "0.4.5", path = "./thaw" }
thaw_components = { version = "0.3.1", path = "./thaw_components" }
thaw = { version = "0.5.0-alpha", path = "./thaw" }
thaw_components = { version = "0.4.0-alpha", path = "./thaw_components" }
thaw_macro = { version = "0.1.0", path = "./thaw_macro" }
thaw_utils = { version = "0.1.1", path = "./thaw_utils" }
thaw_utils = { version = "0.2.0-alpha", path = "./thaw_utils" }

leptos = { version = "0.7.7" }
leptos_meta = { version = "0.7.7" }
leptos_router = { version = "0.7.7" }
reactive_stores = { version = "0.1.7" }
# leptos
leptos = { version = "0.8.0-beta" }
leptos_meta = { version = "0.8.0-beta" }
leptos_router = { version = "0.8.0-beta" }
reactive_stores = { version = "0.2.0-beta" }

# web
wasm-bindgen = { version = "0.2.100" }
2 changes: 1 addition & 1 deletion demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ uuid = { version = "1.10.0", features = ["v4", "js"] }
console_error_panic_hook = "0.1.7"
console_log = "1"
log = "0.4"
js-sys = "0.3.70"
js-sys = "0.3.74"
gloo-net = { version = "0.6.0" }

[features]
Expand Down
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
href="/favicon.ico"
type="image/x-icon"
/>
<meta name="thaw-ui-style"/>
<link data-trunk rel="copy-file" href="./src/assets/svg/grid_dot.svg" />
<link data-trunk rel="copy-file" href="./src/assets/favicon.ico" />
<link
Expand Down
2 changes: 2 additions & 0 deletions demo/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ fn TheRouter() -> impl IntoView {
<Route path=path!("/server-sider-rendering") view=ServerSiderRenderingMdPage />
<Route path=path!("/development/components") view=DevelopmentComponentsMdPage />
<Route path=path!("/customize-theme") view=CustomizeThemeMdPage />
<Route path=path!("/style-element-position") view=StyleElementPositionMdPage />
<Route path=path!("/FAQs") view=FAQsMdPage />
</ParentRoute>
<ParentRoute path=path!("/components") view=ComponentsPage>
Expand Down Expand Up @@ -120,6 +121,7 @@ fn TheRouter() -> impl IntoView {
<Route path=path!("/time-picker") view=TimePickerMdPage />
<Route path=path!("/toast") view=ToastMdPage />
<Route path=path!("/tooltip") view=TooltipMdPage />
<Route path=path!("/tree") view=TreeMdPage />
<Route path=path!("/upload") view=UploadMdPage />
</ParentRoute>
</Routes>
Expand Down
9 changes: 7 additions & 2 deletions demo/src/components/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn Demo(
let css_vars = Memo::new(move |_| {
let mut css_vars = String::new();
theme.with(|theme| {
if theme.color.color_scheme == "dark" {
if theme.color.color_scheme() == "dark" {
css_vars.push_str("--demo-border-color: #383f52;");
css_vars.push_str("--demo-background-color: #242832;");
} else {
Expand All @@ -32,7 +32,12 @@ pub fn Demo(
});

let code_class = Memo::new(move |_| {
theme.with(|theme| format!("demo-demo__code color-scheme--{}", theme.color.color_scheme))
theme.with(|theme| {
format!(
"demo-demo__code color-scheme--{}",
theme.color.color_scheme()
)
})
});
let is_show_code = RwSignal::new(children.is_none());

Expand Down
27 changes: 17 additions & 10 deletions demo/src/components/site_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ use leptos_router::hooks::use_navigate;
// use leptos_use::{storage::use_local_storage, utils::FromToStringCodec};
use thaw::*;

#[derive(Clone)]
enum HeaderAction {
ChangeTheme,
Github,
Discord,
Navigate(&'static str),
}

#[component]
pub fn SiteHeader() -> impl IntoView {
let navigate = use_navigate();
Expand Down Expand Up @@ -172,19 +180,18 @@ pub fn SiteHeader() -> impl IntoView {
</AutoComplete>
<Menu
position=MenuPosition::BottomEnd
on_select=move |value: String| match value.as_str() {
"Dark" => change_theme(MouseEvent::new("click").unwrap()),
"Light" => change_theme(MouseEvent::new("click").unwrap()),
"github" => {
on_select=move |value: HeaderAction| match value {
HeaderAction::ChangeTheme => change_theme(MouseEvent::new("click").unwrap()),
HeaderAction::Github => {
_ = window().open_with_url("http://github.com/thaw-ui/thaw");
}
"discord" => {
HeaderAction::Discord => {
_ = window()
.open_with_url(
"https://discord.gg/VwtS7b8c",
);
}
_ => navigate_signal.get()(&value, Default::default()),
HeaderAction::Navigate(value) => navigate_signal.get()(&value, Default::default()),
}
>
<MenuTrigger slot>
Expand All @@ -195,11 +202,11 @@ pub fn SiteHeader() -> impl IntoView {
attr:style="font-size: 22px; padding: 0px 6px;"
/>
</MenuTrigger>
<MenuItem value=theme_name>{theme_name}</MenuItem>
<MenuItem icon=icondata::AiGithubOutlined value="github">
<MenuItem value=HeaderAction::ChangeTheme>{theme_name}</MenuItem>
<MenuItem value=HeaderAction::Github icon=icondata::AiGithubOutlined>
"Github"
</MenuItem>
<MenuItem icon=icondata::BiDiscordAlt value="discord">
<MenuItem value=HeaderAction::Discord icon=icondata::BiDiscordAlt>
"Discord"
</MenuItem>
{
Expand All @@ -216,7 +223,7 @@ pub fn SiteHeader() -> impl IntoView {
.into_iter()
.map(|item| {
let NavItemOption { label, value, .. } = item;
view! { <MenuItem value=value>{label}</MenuItem> }
view! { <MenuItem value=HeaderAction::Navigate(value)>{label}</MenuItem> }
})
.collect_view()}
}
Expand Down
10 changes: 10 additions & 0 deletions demo/src/pages/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ pub(crate) fn gen_nav_data() -> Vec<NavGroupOption> {
value: "/guide/customize-theme",
label: "Customize Theme",
},
NavItemOption {
group: Some("Theme"),
value: "/guide/style-element-position",
label: "Style Element Position",
},
NavItemOption {
group: None,
value: "/guide/FAQs",
Expand Down Expand Up @@ -469,6 +474,11 @@ pub(crate) fn gen_nav_data() -> Vec<NavGroupOption> {
value: "/components/tooltip",
label: "Tooltip",
},
NavItemOption {
group: None,
value: "/components/tree",
label: "Tree",
},
NavItemOption {
group: None,
value: "/components/upload",
Expand Down
5 changes: 4 additions & 1 deletion demo_markdown/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ quote = "1.0.36"
comrak = "0.26.0"
proc-macro2 = "1.0.86"
syn = "2.0.74"
syntect = "5.2.0"
syntect = "5.2.0"

# fix: https://github.com/jhpratt/deranged/issues/17
deranged = "=0.4.0"
9 changes: 9 additions & 0 deletions demo_markdown/docs/_guide/server_sider_rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ For [start-actix](https://github.com/leptos-rs/start-actix), it is in the [src/m

## Features

<MessageBar layout=MessageBarLayout::Multiline intent=MessageBarIntent::Warning>
<MessageBarBody>
<h3 style="margin: 0">"Prerequisite"</h3>
<p>
"The following configuration is only suitable for enabling one of SSR and Hydrate at the same time. If you want to enable both SSR and Hydrate, please refer to the configuration of cargo-leptos section below."
</p>
</MessageBarBody>
</MessageBar>

To enable the ssr mode, the following configurations are required:

```toml
Expand Down
6 changes: 3 additions & 3 deletions demo_markdown/docs/_guide/theme/customize_theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
let theme = RwSignal::new(Theme::light());
let on_customize_theme = move |_| {
theme.update(|theme| {
theme.color.color_brand_background = "#f5222d".to_string();
theme.color.color_brand_background_hover = "#ff4d4f".to_string();
theme.color.color_brand_background_pressed = "#cf1322".to_string();
theme.color.set_color_brand_background("#f5222d".to_string());
theme.color.set_color_brand_background_hover("#ff4d4f".to_string());
theme.color.set_color_brand_background_pressed("#cf1322".to_string());
});
};

Expand Down
14 changes: 14 additions & 0 deletions demo_markdown/docs/_guide/theme/style_element_position.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Style Element Position

Sometimes you want to control where the style element should be inserted.

You can create a <meta name="thaw-ui-style" /> element inside head element, then thaw-ui's style will be inserted right before it.

```html
<head>
<xxx />
<!-- thaw-ui's style will be inserted here -->
<meta name="thaw-ui-style" />
<xxx />
</head>
```
2 changes: 2 additions & 0 deletions demo_markdown/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub fn include_md(_token_stream: proc_macro::TokenStream) -> proc_macro::TokenSt
"InstallationMdPage" => "../docs/_guide/installation.md",
"ServerSiderRenderingMdPage" => "../docs/_guide/server_sider_rendering.md",
"CustomizeThemeMdPage" => "../docs/_guide/theme/customize_theme.md",
"StyleElementPositionMdPage" => "../docs/_guide/theme/style_element_position.md",
"FAQsMdPage" => "../docs/_guide/FAQs.md",
"AccordionMdPage" => "../../thaw/src/accordion/docs/mod.md",
"AnchorMdPage" => "../../thaw/src/anchor/docs/mod.md",
Expand Down Expand Up @@ -84,6 +85,7 @@ pub fn include_md(_token_stream: proc_macro::TokenStream) -> proc_macro::TokenSt
"TimePickerMdPage" => "../../thaw/src/time_picker/docs/mod.md",
"ToastMdPage" => "../../thaw/src/toast/docs/mod.md",
"TooltipMdPage" => "../../thaw/src/tooltip/docs/mod.md",
"TreeMdPage" => "../../thaw/src/tree/docs/mod.md",
"UploadMdPage" => "../../thaw/src/upload/docs/mod.md"
};

Expand Down
2 changes: 1 addition & 1 deletion examples/island/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ leptos_router = { version = "0.7.7" }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
tower = { version = "0.4", optional = true }
tower-http = { version = "0.5", features = ["fs"], optional = true }
wasm-bindgen = "0.2.95"
wasm-bindgen = "0.2.100"
thiserror = "1"
tracing = { version = "0.1", optional = true }
http = "1"
Expand Down
26 changes: 16 additions & 10 deletions examples/ssr_axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ edition = "2021"
crate-type = ["cdylib", "rlib"]

[dependencies]
axum = { version = "0.7.5", optional = true }
console_error_panic_hook = "0.1"
leptos = { version = "0.7.7" }
leptos_axum = { version = "0.7.7", optional = true }
leptos_meta = { version = "0.7.7" }
leptos_router = { version = "0.7.7" }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
http = "1"
tower = { version = "0.5.0", optional = true }
tower-http = { version = "0.5", features = ["fs"], optional = true }
wasm-bindgen = "0.2.95"
axum = { version = "0.8.1", optional = true }

tokio = { version = "1", features = ["rt-multi-thread"], optional = true }

console_log = "1"
console_error_panic_hook = "0.1"

leptos = { version = "0.8.0-beta" }
leptos_axum = { version = "0.8.0-beta", optional = true }
leptos_meta = { version = "0.8.0-beta" }
leptos_router = { version = "0.8.0-beta" }

wasm-bindgen = "0.2.100"

thiserror = "1"
tracing = { version = "0.1", optional = true }
http = "1"
console_log = "1"
log = "0.4"

demo = { path = "../../demo", default-features = false }
thaw = { path = "../../thaw" }

Expand Down
Loading
Loading