updated to leptos 0.5.0-beta2

This commit is contained in:
Maccesch 2023-08-31 04:41:42 +01:00
parent ecfe9b6a71
commit 660e115b0d
5 changed files with 27 additions and 33 deletions

View file

@ -13,7 +13,7 @@ repository = "https://github.com/Synphonyte/leptos-use"
homepage = "https://leptos-use.rs"
[dependencies]
leptos = "0.5.0-beta"
leptos = "0.5.0-beta2"
wasm-bindgen = "0.2"
js-sys = "0.3"
default-struct-builder = "0.5"

View file

@ -41,10 +41,12 @@ where
}
}
impl<T, E> SignalGet<Option<T>> for ElementMaybeSignal<T, E>
impl<T, E> SignalGet for ElementMaybeSignal<T, E>
where
T: Into<E> + Clone + 'static,
{
type Value = Option<T>;
fn get(&self) -> Option<T> {
match self {
Self::Static(t) => t.clone(),
@ -62,10 +64,12 @@ where
}
}
impl<T, E> SignalWith<Option<T>> for ElementMaybeSignal<T, E>
impl<T, E> SignalWith for ElementMaybeSignal<T, E>
where
T: Into<E> + Clone + 'static,
{
type Value = Option<T>;
fn with<O>(&self, f: impl FnOnce(&Option<T>) -> O) -> O {
match self {
Self::Static(t) => f(t),
@ -83,10 +87,12 @@ where
}
}
impl<T, E> SignalWithUntracked<Option<T>> for ElementMaybeSignal<T, E>
impl<T, E> SignalWithUntracked for ElementMaybeSignal<T, E>
where
T: Into<E> + Clone + 'static,
{
type Value = Option<T>;
fn with_untracked<O>(&self, f: impl FnOnce(&Option<T>) -> O) -> O {
match self {
Self::Static(t) => f(t),
@ -104,10 +110,12 @@ where
}
}
impl<T, E> SignalGetUntracked<Option<T>> for ElementMaybeSignal<T, E>
impl<T, E> SignalGetUntracked for ElementMaybeSignal<T, E>
where
T: Into<E> + Clone + 'static,
{
type Value = Option<T>;
fn get_untracked(&self) -> Option<T> {
match self {
Self::Static(t) => t.clone(),

View file

@ -42,10 +42,12 @@ where
}
}
impl<T, E> SignalGet<Vec<Option<T>>> for ElementsMaybeSignal<T, E>
impl<T, E> SignalGet for ElementsMaybeSignal<T, E>
where
T: Into<E> + Clone + 'static,
{
type Value = Vec<Option<T>>;
fn get(&self) -> Vec<Option<T>> {
match self {
Self::Static(v) => v.clone(),
@ -63,10 +65,12 @@ where
}
}
impl<T, E> SignalWith<Vec<Option<T>>> for ElementsMaybeSignal<T, E>
impl<T, E> SignalWith for ElementsMaybeSignal<T, E>
where
T: Into<E> + Clone + 'static,
{
type Value = Vec<Option<T>>;
fn with<O>(&self, f: impl FnOnce(&Vec<Option<T>>) -> O) -> O {
match self {
Self::Static(v) => f(v),
@ -84,10 +88,12 @@ where
}
}
impl<T, E> SignalWithUntracked<Vec<Option<T>>> for ElementsMaybeSignal<T, E>
impl<T, E> SignalWithUntracked for ElementsMaybeSignal<T, E>
where
T: Into<E> + Clone + 'static,
{
type Value = Vec<Option<T>>;
fn with_untracked<O>(&self, f: impl FnOnce(&Vec<Option<T>>) -> O) -> O {
match self {
Self::Static(t) => f(t),
@ -105,10 +111,12 @@ where
}
}
impl<T, E> SignalGetUntracked<Vec<Option<T>>> for ElementsMaybeSignal<T, E>
impl<T, E> SignalGetUntracked for ElementsMaybeSignal<T, E>
where
T: Into<E> + Clone + 'static,
{
type Value = Vec<Option<T>>;
fn get_untracked(&self) -> Vec<Option<T>> {
match self {
Self::Static(t) => t.clone(),

View file

@ -1,4 +1,4 @@
#[derive(Copy, Clone, Default)]
#[derive(Copy, Clone, Default, Debug)]
pub struct Position {
pub x: f64,
pub y: f64,

View file

@ -3,7 +3,7 @@ use crate::use_event_listener::use_event_listener_with_options;
use crate::{use_debounce_fn_with_arg, use_throttle_fn_with_arg_and_options, ThrottleOptions};
use cfg_if::cfg_if;
use default_struct_builder::DefaultBuilder;
use leptos::ev::EventDescriptor;
use leptos::ev::{scrollend, EventDescriptor};
use leptos::*;
use std::borrow::Cow;
use std::rc::Rc;
@ -523,25 +523,3 @@ pub struct ScrollOffset {
pub right: f64,
pub bottom: f64,
}
// TODO : remove when leptos merges PR https://github.com/leptos-rs/leptos/pull/1105
#[allow(non_camel_case_types)]
#[derive(Copy, Clone)]
struct scrollend;
impl EventDescriptor for scrollend {
type EventType = web_sys::Event;
#[inline(always)]
fn name(&self) -> Cow<'static, str> {
"scrollend".into()
}
#[inline(always)]
fn event_delegation_key(&self) -> Cow<'static, str> {
"$$$scrollend".into()
}
const BUBBLES: bool = false;
}