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_timestamp/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/examples/use_sorted/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_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$/examples/use_event_listener/target" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/target" />
<excludeFolder url="file://$MODULE_DIR$/docs/book/book" /> <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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] - ## [0.8.0] - 2023-10-24
### New Functions 🚀 ### New Functions 🚀
- `use_web_notification` - @centershocks44 - `use_web_notification` (thanks to @centershocks44)
- `use_infinite_scroll` - `use_infinite_scroll`
- `use_service_worker` - @lpotthast - `use_service_worker` (thanks to @lpotthast)
### Breaking Changes 🛠 ### Breaking Changes 🛠

View file

@ -1,6 +1,6 @@
[package] [package]
name = "leptos-use" name = "leptos-use"
version = "0.7.2" version = "0.8.0"
edition = "2021" edition = "2021"
authors = ["Marc-Stefan Cassola"] authors = ["Marc-Stefan Cassola"]
categories = ["gui", "web-programming"] 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://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/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/-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> </p>
<br/> <br/>
@ -87,8 +87,8 @@ This will create the function file in the src directory, scaffold an example dir
## Leptos compatibility ## Leptos compatibility
| Crate version | Compatible Leptos version | | Crate version | Compatible Leptos version |
|---------------|---------------------------| |----------------|---------------------------|
| <= 0.3 | 0.3 | | <= 0.3 | 0.3 |
| 0.4, 0.5, 0.6 | 0.4 | | 0.4, 0.5, 0.6 | 0.4 |
| 0.7 | 0.5 | | 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://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/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="./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> </p>
</div> </div>

View file

@ -24,23 +24,20 @@ fn Demo() -> impl IntoView {
view! { view! {
<div> <div>
<p> <p>Supported: <BooleanDisplay value=is_supported/></p>
Supported: <BooleanDisplay value=is_supported />
</p>
</div> </div>
<Show <Show
when=is_supported when=is_supported
fallback=|| view! { fallback=|| {
<div>The Notification Web API is not supported in your browser.</div> view! { <div>The Notification Web API is not supported in your browser.</div> }
} }
> >
<button on:click={ <button on:click={
let show = show.clone(); let show = show.clone();
move |_| show() move |_| show()
}> }>Show Notification</button>
Show Notification
</button>
</Show> </Show>
} }
} }

View file

@ -25,7 +25,6 @@ mod is_none;
mod is_ok; mod is_ok;
mod is_some; mod is_some;
mod on_click_outside; mod on_click_outside;
mod use_web_notification;
mod signal_debounced; mod signal_debounced;
mod signal_throttled; mod signal_throttled;
mod use_active_element; mod use_active_element;
@ -62,6 +61,7 @@ mod use_supported;
mod use_throttle_fn; mod use_throttle_fn;
mod use_timestamp; mod use_timestamp;
mod use_to_string; mod use_to_string;
mod use_web_notification;
mod use_websocket; mod use_websocket;
mod use_window; mod use_window;
mod use_window_focus; mod use_window_focus;
@ -77,7 +77,6 @@ pub use is_none::*;
pub use is_ok::*; pub use is_ok::*;
pub use is_some::*; pub use is_some::*;
pub use on_click_outside::*; pub use on_click_outside::*;
pub use use_web_notification::*;
pub use signal_debounced::*; pub use signal_debounced::*;
pub use signal_throttled::*; pub use signal_throttled::*;
pub use use_active_element::*; pub use use_active_element::*;
@ -114,6 +113,7 @@ pub use use_supported::*;
pub use use_throttle_fn::*; pub use use_throttle_fn::*;
pub use use_timestamp::*; pub use use_timestamp::*;
pub use use_to_string::*; pub use use_to_string::*;
pub use use_web_notification::*;
pub use use_websocket::*; pub use use_websocket::*;
pub use use_window::*; pub use use_window::*;
pub use use_window_focus::*; pub use use_window_focus::*;

View file

@ -150,26 +150,25 @@ where
scroll_width <= client_width scroll_width <= client_width
}; };
if state.arrived_state.get_untracked().get_direction(direction) || is_narrower { if (state.arrived_state.get_untracked().get_direction(direction) || is_narrower)
if !is_loading.get_untracked() { && !is_loading.get_untracked()
set_loading.set(true); {
set_loading.set(true);
let state = state.clone(); let measure = measure.clone();
let measure = measure.clone(); spawn_local(async move {
spawn_local(async move { join!(
join!( on_load_more.with_value(|f| f(state)),
on_load_more.with_value(|f| f(state)), sleep(Duration::from_millis(interval as u64))
sleep(Duration::from_millis(interval as u64)) );
);
set_loading.set(false); set_loading.set(false);
sleep(Duration::ZERO).await; sleep(Duration::ZERO).await;
measure(); measure();
if let Some(check_and_load) = check_and_load.get_value() { if let Some(check_and_load) = check_and_load.get_value() {
check_and_load(); check_and_load();
} }
}); });
}
} }
} }
} }
@ -178,7 +177,7 @@ where
let _ = watch( let _ = watch(
move || is_element_visible.get(), move || is_element_visible.get(),
move |visible, prev_visible, _| { move |visible, prev_visible, _| {
if *visible && !prev_visible.map(|v| *v).unwrap_or_default() { if *visible && !prev_visible.copied().unwrap_or_default() {
measure(); measure();
} }
}, },

View file

@ -140,7 +140,7 @@ pub fn use_web_notification_with_options(
set_permission.set(request_web_notification_permission().await); 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 // 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). // 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 { UseWebNotificationReturn {
is_supported: is_supported.into(), is_supported,
notification: notification.into(), notification: notification.into(),
show, show,
close, close,
@ -274,19 +274,19 @@ impl From<&UseWebNotificationOptions> for web_sys::NotificationOptions {
// .renotify(options.renotify); // .renotify(options.renotify);
if let Some(body) = &options.body { if let Some(body) = &options.body {
web_sys_options.body(&body); web_sys_options.body(body);
} }
if let Some(icon) = &options.icon { if let Some(icon) = &options.icon {
web_sys_options.icon(&icon); web_sys_options.icon(icon);
} }
if let Some(language) = &options.language { if let Some(language) = &options.language {
web_sys_options.lang(&language); web_sys_options.lang(language);
} }
if let Some(tag) = &options.tag { if let Some(tag) = &options.tag {
web_sys_options.tag(&tag); web_sys_options.tag(tag);
} }
web_sys_options web_sys_options