From 8a78de2e2da5fb74335ee437018ffae1d25a6c72 Mon Sep 17 00:00:00 2001 From: luoxiao Date: Tue, 29 Aug 2023 09:11:22 +0800 Subject: [PATCH 1/5] feat: upgrade leptos to 0.5.0-beta --- Cargo.toml | 6 +-- examples/basic/Cargo.toml | 16 ------- examples/basic/Trunk.toml | 13 ----- examples/basic/index.html | 13 ----- examples/basic/src/app.rs | 61 ------------------------ examples/basic/src/assets/css/index.css | 16 ------- examples/basic/src/main.rs | 9 ---- examples/basic/src/pages/button/mod.rs | 43 ----------------- examples/basic/src/pages/checkbox/mod.rs | 14 ------ examples/basic/src/pages/components.rs | 52 -------------------- examples/basic/src/pages/home.rs | 40 ---------------- examples/basic/src/pages/image/mod.rs | 12 ----- examples/basic/src/pages/input/mod.rs | 14 ------ examples/basic/src/pages/menu/mod.rs | 16 ------- examples/basic/src/pages/mobile.rs | 10 ---- examples/basic/src/pages/mod.rs | 25 ---------- examples/basic/src/pages/modal/mod.rs | 15 ------ examples/basic/src/pages/nav_bar/mod.rs | 24 ---------- examples/basic/src/pages/slider/mod.rs | 11 ----- examples/basic/src/pages/tabbar/mod.rs | 23 --------- gh-pages/Cargo.toml | 4 +- gh-pages/src/app.rs | 42 ++++++++-------- gh-pages/src/components/site_header.rs | 8 ++-- gh-pages/src/main.rs | 2 +- gh-pages/src/pages/button/mod.rs | 4 +- gh-pages/src/pages/checkbox/mod.rs | 6 +-- gh-pages/src/pages/components.rs | 16 +++---- gh-pages/src/pages/home.rs | 16 +++---- gh-pages/src/pages/image/mod.rs | 6 +-- gh-pages/src/pages/input/mod.rs | 8 ++-- gh-pages/src/pages/menu/mod.rs | 6 +-- gh-pages/src/pages/mobile.rs | 4 +- gh-pages/src/pages/modal/mod.rs | 8 ++-- gh-pages/src/pages/nav_bar/mod.rs | 16 +++---- gh-pages/src/pages/select/mod.rs | 6 +-- gh-pages/src/pages/slider/mod.rs | 6 +-- gh-pages/src/pages/tabbar/mod.rs | 10 ++-- gh-pages/src/pages/tabs/mod.rs | 6 +-- gh-pages/src/pages/toast/mod.rs | 19 ++++---- src/button/mod.rs | 9 ++-- src/button/theme.rs | 10 ++-- src/card/mod.rs | 15 +++--- src/checkbox/mod.rs | 14 ++---- src/code/mod.rs | 6 +-- src/components/if_comp.rs | 11 ++--- src/components/mod.rs | 2 +- src/components/option_comp.rs | 11 ++--- src/icon/mod.rs | 25 +++++----- src/image/mod.rs | 9 ++-- src/input/mod.rs | 11 ++--- src/input/theme.rs | 10 ++-- src/layout/layout_header.rs | 5 +- src/layout/layout_sider.rs | 6 +-- src/layout/mod.rs | 7 ++- src/menu/menu_item.rs | 9 ++-- src/menu/mod.rs | 23 ++++----- src/mobile/nav_bar/mod.rs | 7 ++- src/mobile/tabbar/mod.rs | 22 ++++----- src/mobile/tabbar/tabbar_item.rs | 11 ++--- src/mobile/toast/mod.rs | 11 +++-- src/modal/mod.rs | 7 ++- src/progress/mod.rs | 13 ++--- src/select/mod.rs | 23 +++++---- src/slider/mod.rs | 19 ++++---- src/space/mod.rs | 8 ++-- src/table/mod.rs | 6 +-- src/tabs/mod.rs | 41 ++++++++-------- src/tabs/tab.rs | 8 ++-- src/teleport/mod.rs | 11 ++--- src/theme/common.rs | 2 +- src/theme/mod.rs | 9 ++-- src/utils/dom.rs | 2 +- src/utils/mod.rs | 2 +- src/wave/mod.rs | 14 +++--- 74 files changed, 277 insertions(+), 748 deletions(-) delete mode 100644 examples/basic/Cargo.toml delete mode 100644 examples/basic/Trunk.toml delete mode 100644 examples/basic/index.html delete mode 100644 examples/basic/src/app.rs delete mode 100644 examples/basic/src/assets/css/index.css delete mode 100644 examples/basic/src/main.rs delete mode 100644 examples/basic/src/pages/button/mod.rs delete mode 100644 examples/basic/src/pages/checkbox/mod.rs delete mode 100644 examples/basic/src/pages/components.rs delete mode 100644 examples/basic/src/pages/home.rs delete mode 100644 examples/basic/src/pages/image/mod.rs delete mode 100644 examples/basic/src/pages/input/mod.rs delete mode 100644 examples/basic/src/pages/menu/mod.rs delete mode 100644 examples/basic/src/pages/mobile.rs delete mode 100644 examples/basic/src/pages/mod.rs delete mode 100644 examples/basic/src/pages/modal/mod.rs delete mode 100644 examples/basic/src/pages/nav_bar/mod.rs delete mode 100644 examples/basic/src/pages/slider/mod.rs delete mode 100644 examples/basic/src/pages/tabbar/mod.rs diff --git a/Cargo.toml b/Cargo.toml index c7ad785..5d939a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,10 +13,10 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -leptos = { version = "0.4.8", features = ["csr"] } +leptos = { version = "0.5.0-beta", features = ["csr"] } stylers = { git = "https://github.com/abishekatp/stylers", rev = "4bfd2df" } web-sys = { version = "0.3.62", features = ["DomRect"] } -leptos_dom = { version = "0.4.0" } +leptos_dom = { version = "0.5.0-beta" } wasm-bindgen = "0.2.85" icondata = { version = "0.0.7", features = [ "AiCloseOutlined", @@ -25,4 +25,4 @@ icondata = { version = "0.0.7", features = [ ] } [workspace] -members = ["examples/basic", "gh-pages"] +members = ["gh-pages"] diff --git a/examples/basic/Cargo.toml b/examples/basic/Cargo.toml deleted file mode 100644 index 003b630..0000000 --- a/examples/basic/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "basic" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -leptos = { version = "0.4.0", features = ["csr"] } -melt-ui = { path = "../../" } -icondata = { version = "0.0.7", features = [ - "AiCloseOutlined", - "AiCheckOutlined", -] } -leptos_router = { version = "0.4.0", features = ["csr"] } -regex = "1.8.2" diff --git a/examples/basic/Trunk.toml b/examples/basic/Trunk.toml deleted file mode 100644 index 7cf59cc..0000000 --- a/examples/basic/Trunk.toml +++ /dev/null @@ -1,13 +0,0 @@ -[build] -target = "index.html" - -[watch] -watch = [ - "../../src", - "./src" -] - -[serve] -address = "127.0.0.1" -port = 6421 -open = false diff --git a/examples/basic/index.html b/examples/basic/index.html deleted file mode 100644 index 7dd8246..0000000 --- a/examples/basic/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - Document - - - - - - \ No newline at end of file diff --git a/examples/basic/src/app.rs b/examples/basic/src/app.rs deleted file mode 100644 index ce29b04..0000000 --- a/examples/basic/src/app.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::pages::*; -use leptos::*; -use leptos_router::*; - -#[component] -pub fn App(cx: Scope) -> impl IntoView { - view! { cx, - - - - } /> - - } /> - - } /> - - } > - - } /> - - } /> - - } /> - - } /> - - } /> - - } /> - - } /> - - } /> - - } /> - - - - - } /> - - } /> - - - } -} diff --git a/examples/basic/src/assets/css/index.css b/examples/basic/src/assets/css/index.css deleted file mode 100644 index edc5940..0000000 --- a/examples/basic/src/assets/css/index.css +++ /dev/null @@ -1,16 +0,0 @@ -body { - margin: 0; -} - - -.components-page-box { - display: flex; -} - -.components-page-box aside { - width: 260px; -} - -.components-page-box main { - flex: 1; -} \ No newline at end of file diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs deleted file mode 100644 index 38ab1fd..0000000 --- a/examples/basic/src/main.rs +++ /dev/null @@ -1,9 +0,0 @@ -mod app; -mod pages; - -use app::*; -use leptos::*; - -fn main() { - mount_to_body(|cx| view! { cx, }) -} diff --git a/examples/basic/src/pages/button/mod.rs b/examples/basic/src/pages/button/mod.rs deleted file mode 100644 index a181112..0000000 --- a/examples/basic/src/pages/button/mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -use leptos::*; -use melt_ui::*; - -#[component] -pub fn ButtonPage(cx: Scope) -> impl IntoView { - view! {cx, - - - - - - - - - - - - -
- - -
- } -} \ No newline at end of file diff --git a/examples/basic/src/pages/checkbox/mod.rs b/examples/basic/src/pages/checkbox/mod.rs deleted file mode 100644 index 7d63d87..0000000 --- a/examples/basic/src/pages/checkbox/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -use leptos::*; -use melt_ui::*; - -#[component] -pub fn CheckboxPage(cx: Scope) -> impl IntoView { - let checked = create_rw_signal(cx, false); - view! {cx, -
- - "Click" - -
- } -} diff --git a/examples/basic/src/pages/components.rs b/examples/basic/src/pages/components.rs deleted file mode 100644 index 4e7db06..0000000 --- a/examples/basic/src/pages/components.rs +++ /dev/null @@ -1,52 +0,0 @@ -use leptos::*; -use leptos_router::{use_location, use_navigate, Outlet}; -use melt_ui::*; -use regex::Regex; - -#[component] -pub fn ComponentsPage(cx: Scope) -> impl IntoView { - let loaction = use_location(cx); - let navigate = use_navigate(cx); - let selected = create_rw_signal(cx, String::from("")); - create_effect(cx, move |_| { - let pathname = loaction.pathname.get(); - - let re = Regex::new(r"^/components/(.+)$").unwrap(); - let Some(caps) = re.captures(&pathname) else { - return; - }; - let Some(path) = caps.get(1) else { - return; - }; - let path = path.as_str().to_string(); - selected.set(path); - }); - - create_effect(cx, move |value| { - let selected = selected.get(); - if value.is_some() { - _ = navigate(&format!("/components/{selected}"), Default::default()); - } - selected - }); - view! {cx, -
- -
- -
-
- } -} diff --git a/examples/basic/src/pages/home.rs b/examples/basic/src/pages/home.rs deleted file mode 100644 index 8d41b0c..0000000 --- a/examples/basic/src/pages/home.rs +++ /dev/null @@ -1,40 +0,0 @@ -use leptos::*; -use leptos_router::use_navigate; -use melt_ui::*; - -#[component] -pub fn Home(cx: Scope) -> impl IntoView { - let (theme, set_theme) = create_signal(cx, Theme::light()); - provide_context(cx, theme); - let (count, set_count) = create_signal(cx, 0.0); - let (button_type, set_button_type) = create_signal(cx, ButtonType::TEXT); - view! { cx, - -
- - - - - {move || count.get()} - - - - } -} diff --git a/examples/basic/src/pages/image/mod.rs b/examples/basic/src/pages/image/mod.rs deleted file mode 100644 index f98e30a..0000000 --- a/examples/basic/src/pages/image/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -use leptos::*; -use melt_ui::*; - -#[component] -pub fn ImagePage(cx: Scope) -> impl IntoView { - view! { cx, - <> - - - - } -} \ No newline at end of file diff --git a/examples/basic/src/pages/input/mod.rs b/examples/basic/src/pages/input/mod.rs deleted file mode 100644 index 1a50d84..0000000 --- a/examples/basic/src/pages/input/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -use leptos::*; -use melt_ui::*; - -#[component] -pub fn InputPage(cx: Scope) -> impl IntoView { - let value = create_rw_signal(cx, String::from("o")); - view! { cx, - <> - {move || value.get()} - - - - } -} \ No newline at end of file diff --git a/examples/basic/src/pages/menu/mod.rs b/examples/basic/src/pages/menu/mod.rs deleted file mode 100644 index 2e13f97..0000000 --- a/examples/basic/src/pages/menu/mod.rs +++ /dev/null @@ -1,16 +0,0 @@ -use leptos::*; -use melt_ui::*; - -#[component] -pub fn MenuPage(cx: Scope) -> impl IntoView { - let selected = create_rw_signal(cx, String::from("o")); - view! { cx, - <> - { move || selected.get() } - - - - - - } -} diff --git a/examples/basic/src/pages/mobile.rs b/examples/basic/src/pages/mobile.rs deleted file mode 100644 index ba52df9..0000000 --- a/examples/basic/src/pages/mobile.rs +++ /dev/null @@ -1,10 +0,0 @@ -use leptos::*; - -#[component] -pub fn MobilePage(cx: Scope, path: &'static str) -> impl IntoView { - view! { cx, -
-