Compare commits

..

4 Commits
v0.5.0 ... 1754

Author SHA1 Message Date
Greg Johnston
891448d0fa fix: router animations should reset to Start state (closes #1754) 2023-09-30 16:32:35 -04:00
Greg Johnston
d869bc6675 chore: clippy 2023-09-29 20:36:15 -04:00
Greg Johnston
d8aeb82949 cargo fmt 2023-09-29 20:35:39 -04:00
Greg Johnston
32e8213ebf v0.5.0 2023-09-29 17:13:56 -04:00
9 changed files with 51 additions and 29 deletions

View File

@@ -26,22 +26,22 @@ members = [
exclude = ["benchmarks", "examples"]
[workspace.package]
version = "0.5.0-rc3"
version = "0.5.0"
[workspace.dependencies]
leptos = { path = "./leptos", version = "0.5.0-rc3" }
leptos_dom = { path = "./leptos_dom", version = "0.5.0-rc3" }
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.5.0-rc3" }
leptos_macro = { path = "./leptos_macro", version = "0.5.0-rc3" }
leptos_reactive = { path = "./leptos_reactive", version = "0.5.0-rc3" }
leptos_server = { path = "./leptos_server", version = "0.5.0-rc3" }
server_fn = { path = "./server_fn", version = "0.5.0-rc3" }
server_fn_macro = { path = "./server_fn_macro", version = "0.5.0-rc3" }
server_fn_macro_default = { path = "./server_fn/server_fn_macro_default", version = "0.5.0-rc3" }
leptos_config = { path = "./leptos_config", version = "0.5.0-rc3" }
leptos_router = { path = "./router", version = "0.5.0-rc3" }
leptos_meta = { path = "./meta", version = "0.5.0-rc3" }
leptos_integration_utils = { path = "./integrations/utils", version = "0.5.0-rc3" }
leptos = { path = "./leptos", version = "0.5.0" }
leptos_dom = { path = "./leptos_dom", version = "0.5.0" }
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.5.0" }
leptos_macro = { path = "./leptos_macro", version = "0.5.0" }
leptos_reactive = { path = "./leptos_reactive", version = "0.5.0" }
leptos_server = { path = "./leptos_server", version = "0.5.0" }
server_fn = { path = "./server_fn", version = "0.5.0" }
server_fn_macro = { path = "./server_fn_macro", version = "0.5.0" }
server_fn_macro_default = { path = "./server_fn/server_fn_macro_default", version = "0.5.0" }
leptos_config = { path = "./leptos_config", version = "0.5.0" }
leptos_router = { path = "./router", version = "0.5.0" }
leptos_meta = { path = "./meta", version = "0.5.0" }
leptos_integration_utils = { path = "./integrations/utils", version = "0.5.0" }
[profile.release]
codegen-units = 1

View File

@@ -17,6 +17,6 @@ understand Leptos.
You can find more detailed docs for each part of the API at [Docs.rs](https://docs.rs/leptos/latest/leptos/).
**Important Note**: This current version of the book reflects the upcoming `0.5.0` release, which you can install as version `0.5.0-rc3`. The CodeSandbox versions of the examples still reflect `0.4` and earlier APIs and are in the process of being updated.
**Important Note**: This current version of the book reflects the upcoming `0.5.0` release, which you can install as version `0.5.0`. The CodeSandbox versions of the examples still reflect `0.4` and earlier APIs and are in the process of being updated.
> The source code for the book is available [here](https://github.com/leptos-rs/leptos/tree/main/docs/book). PRs for typos or clarification are always welcome.

View File

@@ -23,7 +23,7 @@ cargo init leptos-tutorial
`cd` into your new `leptos-tutorial` project and add `leptos` as a dependency
```bash
cargo add leptos@0.5.0-rc3 --features=csr,nightly
cargo add leptos@0.5.0 --features=csr,nightly
```
> **Note**: This version of the book reflects the upcoming Leptos 0.5.0 release. The CodeSandbox examples have not yet been updated from 0.4 and earlier versions.
@@ -31,7 +31,7 @@ cargo add leptos@0.5.0-rc3 --features=csr,nightly
Or you can leave off `nightly` if you're using stable Rust
```bash
cargo add leptos@0.5.0-rc3 --features=csr
cargo add leptos@0.5.0 --features=csr
```
> Using `nightly` Rust, and the `nightly` feature in Leptos enables the function-call syntax for signal getters and setters that is used in most of this book.

View File

@@ -58,7 +58,7 @@ pub fn Story() -> impl IntoView {
<For
each=move || story.comments.clone().unwrap_or_default()
key=|comment| comment.id
let:comment
let:comment
>
<Comment comment/>
</For>

View File

@@ -20,7 +20,7 @@ async fn second_wait_fn(seconds: u64) -> Result<(), ServerFnError> {
#[component]
pub fn App() -> impl IntoView {
let style = r#"
let style = r"
nav {
display: flex;
width: 100%;
@@ -30,7 +30,7 @@ pub fn App() -> impl IntoView {
[aria-current] {
font-weight: bold;
}
"#;
";
view! {
<style>{style}</style>

View File

@@ -1,6 +1,6 @@
[package]
name = "leptos_meta"
version = "0.5.0-rc3"
version = "0.5.0"
edition = "2021"
authors = ["Greg Johnston"]
license = "MIT"

View File

@@ -1,6 +1,6 @@
[package]
name = "leptos_router"
version = "0.5.0-rc3"
version = "0.5.0"
edition = "2021"
authors = ["Greg Johnston"]
license = "MIT"

View File

@@ -27,6 +27,7 @@ impl Animation {
outro,
intro,
intro_back,
finally,
..
} = self;
match current {
@@ -35,8 +36,10 @@ impl Animation {
AnimationState::Start
} else if intro.is_some() {
AnimationState::Intro
} else {
} else if finally.is_some() {
AnimationState::Finally
} else {
AnimationState::Start
};
(next, true)
}
@@ -47,21 +50,37 @@ impl Animation {
AnimationState::IntroBack
} else if intro.is_some() {
AnimationState::Intro
} else {
} else if finally.is_some() {
AnimationState::Finally
} else {
AnimationState::Start
};
(next, true)
}
AnimationState::Start => {
let next = if intro.is_some() {
AnimationState::Intro
} else {
} else if finally.is_some() {
AnimationState::Finally
} else {
AnimationState::Start
};
(next, false)
}
AnimationState::Intro => (AnimationState::Finally, false),
AnimationState::IntroBack => (AnimationState::Finally, false),
AnimationState::Intro => {
if finally.is_some() {
(AnimationState::Finally, false)
} else {
(AnimationState::Start, false)
}
}
AnimationState::IntroBack => {
if finally.is_some() {
(AnimationState::Finally, false)
} else {
(AnimationState::Start, false)
}
}
AnimationState::Finally => {
if outro.is_some() {
if is_back {
@@ -77,8 +96,10 @@ impl Animation {
} else {
(AnimationState::Intro, false)
}
} else {
} else if finally.is_some() {
(AnimationState::Finally, true)
} else {
(AnimationState::Start, true)
}
}
}

View File

@@ -179,7 +179,7 @@ pub fn AnimatedRoutes(
};
let is_back = use_is_back_navigation();
let (animation_state, set_animation_state) =
create_signal(AnimationState::Finally);
create_signal(AnimationState::Start);
let next_route = router.pathname();
let is_complete = Rc::new(Cell::new(true));
@@ -190,6 +190,7 @@ pub fn AnimatedRoutes(
move |prev: Option<&(AnimationState, String)>| {
let animation_state = animation_state.get();
let next_route = next_route.get();
logging::log!("{animation_state:?} {next_route:?}");
let prev_matches = prev
.map(|(_, r)| r)
.cloned()