Skip to content

Commit

Permalink
release 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maccesch committed Oct 24, 2023
1 parent c547720 commit 8c2beb8
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .idea/leptos-use.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] -
## [0.8.0] - 2023-10-24

### New Functions 🚀

- `use_web_notification` - @centershocks44
- `use_web_notification` (thanks to @centershocks44)
- `use_infinite_scroll`
- `use_service_worker` - @lpotthast
- `use_service_worker` (thanks to @lpotthast)

### Breaking Changes 🛠

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "leptos-use"
version = "0.7.2"
version = "0.8.0"
edition = "2021"
authors = ["Marc-Stefan Cassola"]
categories = ["gui", "web-programming"]
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a href="https://crates.io/crates/leptos-use"><img src="https://img.shields.io/crates/v/leptos-use.svg?label=&color=%232C1275" alt="Crates.io"/></a>
<a href="https://leptos-use.rs/server_side_rendering.html"><img src="https://img.shields.io/badge/-SSR-%236a214b" alt="SSR"></a>
<a href="https://leptos-use.rs"><img src="https://img.shields.io/badge/-docs%20%26%20demos-%239A233F" alt="Docs & Demos"></a>
<a href="https://leptos-use.rs"><img src="https://img.shields.io/badge/-59%20functions-%23EF3939" alt="59 Functions" /></a>
<a href="https://leptos-use.rs"><img src="https://img.shields.io/badge/-62%20functions-%23EF3939" alt="62 Functions" /></a>
</p>

<br/>
Expand Down Expand Up @@ -87,8 +87,8 @@ This will create the function file in the src directory, scaffold an example dir

## Leptos compatibility

| Crate version | Compatible Leptos version |
|---------------|---------------------------|
| <= 0.3 | 0.3 |
| 0.4, 0.5, 0.6 | 0.4 |
| 0.7 | 0.5 |
| Crate version | Compatible Leptos version |
|----------------|---------------------------|
| <= 0.3 | 0.3 |
| 0.4, 0.5, 0.6 | 0.4 |
| 0.7, 0.8 | 0.5 |
2 changes: 1 addition & 1 deletion docs/book/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<a href="https://crates.io/crates/leptos-use"><img src="https://img.shields.io/crates/v/leptos-use.svg?label=&color=%232C1275" alt="Crates.io"/></a>
<a href="https://leptos-use.rs/server_side_rendering.html"><img src="https://img.shields.io/badge/-SSR-%236a214b" alt="SSR"></a>
<a href="./get_started.html"><img src="https://img.shields.io/badge/-docs%20%26%20demos-%239A233F" alt="Docs & Demos"></a>
<a href="./functions.html"><img src="https://img.shields.io/badge/-59%20functions-%23EF3939" alt="59 Functions" /></a>
<a href="./functions.html"><img src="https://img.shields.io/badge/-62%20functions-%23EF3939" alt="62 Functions" /></a>
</p>
</div>
13 changes: 5 additions & 8 deletions examples/use_web_notification/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,20 @@ fn Demo() -> impl IntoView {

view! {
<div>
<p>
Supported: <BooleanDisplay value=is_supported />
</p>
<p>Supported: <BooleanDisplay value=is_supported/></p>
</div>

<Show
when=is_supported
fallback=|| view! {
<div>The Notification Web API is not supported in your browser.</div>
fallback=|| {
view! { <div>The Notification Web API is not supported in your browser.</div> }
}
>

<button on:click={
let show = show.clone();
move |_| show()
}>
Show Notification
</button>
}>Show Notification</button>
</Show>
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mod is_none;
mod is_ok;
mod is_some;
mod on_click_outside;
mod use_web_notification;
mod signal_debounced;
mod signal_throttled;
mod use_active_element;
Expand Down Expand Up @@ -62,6 +61,7 @@ mod use_supported;
mod use_throttle_fn;
mod use_timestamp;
mod use_to_string;
mod use_web_notification;
mod use_websocket;
mod use_window;
mod use_window_focus;
Expand All @@ -77,7 +77,6 @@ pub use is_none::*;
pub use is_ok::*;
pub use is_some::*;
pub use on_click_outside::*;
pub use use_web_notification::*;
pub use signal_debounced::*;
pub use signal_throttled::*;
pub use use_active_element::*;
Expand Down Expand Up @@ -114,6 +113,7 @@ pub use use_supported::*;
pub use use_throttle_fn::*;
pub use use_timestamp::*;
pub use use_to_string::*;
pub use use_web_notification::*;
pub use use_websocket::*;
pub use use_window::*;
pub use use_window_focus::*;
Expand Down
41 changes: 20 additions & 21 deletions src/use_infinite_scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,26 +150,25 @@ where
scroll_width <= client_width
};

if state.arrived_state.get_untracked().get_direction(direction) || is_narrower {
if !is_loading.get_untracked() {
set_loading.set(true);

let state = state.clone();
let measure = measure.clone();
spawn_local(async move {
join!(
on_load_more.with_value(|f| f(state)),
sleep(Duration::from_millis(interval as u64))
);

set_loading.set(false);
sleep(Duration::ZERO).await;
measure();
if let Some(check_and_load) = check_and_load.get_value() {
check_and_load();
}
});
}
if (state.arrived_state.get_untracked().get_direction(direction) || is_narrower)
&& !is_loading.get_untracked()
{
set_loading.set(true);

let measure = measure.clone();
spawn_local(async move {
join!(
on_load_more.with_value(|f| f(state)),
sleep(Duration::from_millis(interval as u64))
);

set_loading.set(false);
sleep(Duration::ZERO).await;
measure();
if let Some(check_and_load) = check_and_load.get_value() {
check_and_load();
}
});
}
}
}
Expand All @@ -178,7 +177,7 @@ where
let _ = watch(
move || is_element_visible.get(),
move |visible, prev_visible, _| {
if *visible && !prev_visible.map(|v| *v).unwrap_or_default() {
if *visible && !prev_visible.copied().unwrap_or_default() {
measure();
}
},
Expand Down
12 changes: 6 additions & 6 deletions src/use_web_notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub fn use_web_notification_with_options(
set_permission.set(request_web_notification_permission().await);
});

on_cleanup(close.clone());
on_cleanup(close);

// Use close() to remove a notification that is no longer relevant to to
// the user (e.g.the user already read the notification on the webpage).
Expand All @@ -157,7 +157,7 @@ pub fn use_web_notification_with_options(
}

UseWebNotificationReturn {
is_supported: is_supported.into(),
is_supported,
notification: notification.into(),
show,
close,
Expand Down Expand Up @@ -274,19 +274,19 @@ impl From<&UseWebNotificationOptions> for web_sys::NotificationOptions {
// .renotify(options.renotify);

if let Some(body) = &options.body {
web_sys_options.body(&body);
web_sys_options.body(body);
}

if let Some(icon) = &options.icon {
web_sys_options.icon(&icon);
web_sys_options.icon(icon);
}

if let Some(language) = &options.language {
web_sys_options.lang(&language);
web_sys_options.lang(language);
}

if let Some(tag) = &options.tag {
web_sys_options.tag(&tag);
web_sys_options.tag(tag);
}

web_sys_options
Expand Down

0 comments on commit 8c2beb8

Please sign in to comment.