release 0.8.0

This commit is contained in:
Maccesch 2023-10-24 00:44:23 -05:00
parent c547720184
commit 8c2beb814d
9 changed files with 44 additions and 46 deletions

2
.idea/leptos-use.iml generated
View file

@ -58,6 +58,8 @@
<sourceFolder url="file://$MODULE_DIR$/examples/use_timestamp/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/examples/use_sorted/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/examples/use_service_worker/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/examples/use_infinite_scroll/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/examples/use_web_notification/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/examples/use_event_listener/target" />
<excludeFolder url="file://$MODULE_DIR$/target" />
<excludeFolder url="file://$MODULE_DIR$/docs/book/book" />

View file

@ -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 🛠

View file

@ -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"]

View file

@ -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/>
@ -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 |

View file

@ -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>

View file

@ -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>
}
}

View file

@ -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;
@ -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;
@ -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::*;
@ -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::*;

View file

@ -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);
if (state.arrived_state.get_untracked().get_direction(direction) || is_narrower)
&& !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))
);
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();
}
});
}
set_loading.set(false);
sleep(Duration::ZERO).await;
measure();
if let Some(check_and_load) = check_and_load.get_value() {
check_and_load();
}
});
}
}
}
@ -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();
}
},

View file

@ -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).
@ -157,7 +157,7 @@ pub fn use_web_notification_with_options(
}
UseWebNotificationReturn {
is_supported: is_supported.into(),
is_supported,
notification: notification.into(),
show,
close,
@ -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