Here's another significant PR. Hopefully we can avoid any such sweeping changes going forward.
This PR integrates the new Storage concept for signals. Anything that was trivially wrapped in a SendWrapper has now been converted to make use of LocalStorage.
This now compiles with my leptos branch that includes custom events, which has a PR waiting on approval leptos-rs/leptos#2762. This should now work with Leptos's main branch and the upcoming beta2 release.
I also swapped the type order for ElementMaybeSignal::Static from Option<SendWrapper<T>> to SendWrapper<Option<T>>, removing the need for cloning in a few places. I did something similar for ElementMaybeSignals as well.
There are probably several places where the bounds on types are overly strict. For example, watch_with_options does not have a local implementation. If there's a good approach for this in general, it might be nice to look into. I imagine people will often want to use many of these utilities with !Send types.
The two things that have not yet been ported are:
From<HtmlElement<El>> for ElementMaybeSignal and similar
use_active_element
Both of these rely on the old, eager Leptos element architecture to varying degrees. They'll need some assessment and will require more effort to port than the rest of the code.
I didn't notice there was more work on the upstream since my last commits. Hopefully my merge didn't step on anyone's toes!
Here's another significant PR. Hopefully we can avoid any such sweeping changes going forward.
This PR integrates the new
Storage
concept for signals. Anything that was trivially wrapped in aSendWrapper
has now been converted to make use ofLocalStorage
.This now compiles with my leptos branch that includes custom events, which has a PR waiting on approval leptos-rs/leptos#2762.This should now work with Leptos's main branch and the upcomingbeta2
release.I also swapped the type order for
ElementMaybeSignal::Static
fromOption<SendWrapper<T>>
toSendWrapper<Option<T>>
, removing the need for cloning in a few places. I did something similar forElementMaybeSignals
as well.There are probably several places where the bounds on types are overly strict. For example,
watch_with_options
does not have alocal
implementation. If there's a good approach for this in general, it might be nice to look into. I imagine people will often want to use many of these utilities with!Send
types.The two things that have not yet been ported are:
From<HtmlElement<El>> for ElementMaybeSignal
and similaruse_active_element
Both of these rely on the old, eager Leptos element architecture to varying degrees. They'll need some assessment and will require more effort to port than the rest of the code.
I didn't notice there was more work on the upstream since my last commits. Hopefully my merge didn't step on anyone's toes!