The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
signal_throttled
andsignal_debounced
now have..._local
variants (thanks to @bicarlsen)
use_storage
now accepts a Signal as it'skey
parameter (thanks to LeftClick)use_websocket
now supports sending heartbeats (thanks to LeftClick)
- Fixed
use_storage
to actually remove the key whenremove
is called (thanks to @flaviopezzini)
- @spencewenski
- LeftClick
- Updated to Leptos 0.7
- Refactored
ElementMaybeSignal
andElementsMaybeSignal
to have a simpler implementation. For the vast majority of cases this should continue to work as before. - Almost everything returned from functions is now
Send + Sync
.
- Updated Leptos to use stable 0.7 version
- Updated wasm-bindgen to 0.2.96
- Updated web-sys 0.3.73
Special thanks to our sponsor:
- @spencewenski
- fixed error messages for get_header
- added Send + Sync to storage return closure
Special thanks to our sponsor:
- @spencewenski
- Updated to Leptos 0.7.0-rc2
- Fixed WASM on the serverside (thanks to @GuillaumeDelorme)
- Fixed
use_storage
. - Made all returned closures
Send + Sync
.
Special thanks to our sponsor:
- @spencewenski
- Fixed potential SSR panic in use_locale(s) (thanks to @veigaribo)
- Make
use_locale
prioritize user preferred locales over app preferred ones
- Updated to Leptos 0.7.0-rc1
- Updated to web-sys 0.3.72 and unpinned version (thanks to @sabify)
- Added dependabot (thanks to @sabify)
- Reverted use_user_media to have video enabled by default
- Fixed exponential increase on websocket reconnects
- Fixed MediaTrackConstraints dependency (thanks to @mollymorphous)
- Fixed warnings and tests (thanks to @SleeplessOne1917 and @jheuel)
- Unpinned the wasm-bindgen version (thanks to @jheuel)
- Latest changes up to version 0.13.7 ported
- Updated to Leptos 0.7.0-rc0
- Updated to Leptos 0.7.0-gamma3 by using
Signal
instead ofMaybeSignal
- Adapted to the latest changes in Leptos (thanks to @BakerNet and @nikessel)
- Fixed all the examples
use_active_element
porteduse_drop_zone
now returnsSignal<Vec<SendSignal<web_sys::File>>>
instead ofSignal<Vec<web_sys::File>, LocalStorage>
to make it easier to use with<For>
- Latest changes from version 0.13.4 and 0.13.5 ported
- Refactored
ElementMaybeSignal
andElementsMaybeSignal
to have a simpler implementation. For the vast majority of cases this should continue to work as before.
- Latest Leptos 0.7 beta changed the trigger trait method (thanks to @BakerNet)
- Latest changes from version 0.13.3 ported
Ported everything to Leptos 0.7 Some example don't run yet.
- Added video and audio options to
use_user_media
(thanks to @sauloco). - Fixed cookies in SSR (thanks to @jim-taylor-business).
- Updated leptos-spin version to 0.2 (thanks to @tqq1994516).
use_textarea_autosize
use_websocket
now returns a signal for the websocket instance so the user can actually use it. Before it always returnedNone
.
- Fixed
use_color_mode
with cookies enabled
- Fixed web-sys
unstable_apis
flag foruse_web_lock
use_web_lock
use_window_size
UseWebsocket::protocols
now supports a signal. It is read right beforeopen
is called. (thanks to @zakstucke)
use_toggle
use_prefers_reduced_motion
(thanks to @hcandelaria)
use_websocket
now supports different types for sending and receiving messagesSyncSignalOptions
now can take now either transformations or assignment functions but not both.- updated to
codee
version 0.2.0
use_websocket
fixed error with cleanup and reconnect (thanks to @BakerNet).
- There is now a feature for almost every function to get better compile and rust-analyzer times.
use_web_notification
now supports thevibrate
option (thanks to @hcandelaria).UseDocument
now supports a whole bunch of methods more fromdocument
(thanks to @luckynumberke7in).
Make sure you also update
cargo-leptos
to the latest version if you use that.
- Updated to web_sys 0.3.70 which unfortunately is breaking some things.
use_clipboard
doesn't need the unstable flags anymore.use_locale
now usesunic_langid::LanguageIdentifier
and proper locale matching (thanks to @mondeja).- Removed
UseMouseEventExtractorDefault
and reworkedUseMouseCoordType
(thanks to @carloskiki) use_preferred_dark
anduse_color_mode
now try to read theSec-CH-Prefers-Color-Scheme
header in SSR. This brings the necessity to enable an additional feature for them (axum
/actix
/spin
).
- Fixed the codec chapter in the book to refer to crate
codee
.
use_web_notification
now supports the optionsrenotify
,silent
andimage
(thanks to @hcandelaria).sync_signal
no supports the optionsassign_ltr
andassign_rtl
.
- Made
use_timeout_fn
SSR-safe
use_locale
has now a supported locale list.
use_locale
(thanks to @BrandonDyer64)use_locales
(thanks to @BrandonDyer64)header
– Standard implementations for reading a header on the server.
use_user_media
-
Codecs:
- All codecs now live in their own crate
codee
- There are now binary codecs in addition to string codecs.
FromToBytesCodec
WebpackSerdeCodec
BincodeSerdeCodec
ProstCodec
(see also the section "Breaking Changes 🛠" below)
- Every binary codec can be used as a string codec with the
Base64
wrapper which encodes the binary data as a base64 string.- This required feature
base64
- It can be wrapped for example like this:
Base64<WebpackSerdeCodec>
.
- This required feature
- There is now an
OptionCodec
wrapper that allows to wrap any string codec that encodesT
to encodeOption<T>
.- Use it like this:
OptionCodec<FromToStringCodec<f64>>
.
- Use it like this:
- All codecs now live in their own crate
-
ElementMaybeSignal
is now implemented forwebsys::HtmlElement
(thanks to @blorbb). -
UseStorageOptions
now hasdelay_during_hydration
which has to be used when you conditionally show parts of the DOM controlled by a value from storage. This leads to hydration errors which can be fixed by setting this new option totrue
. -
cookie::SameSite
is now re-exported -
Changing the signal returned by
use_cookie
now tries and changes the headers during SSR. -
New book chapter about codecs
-
The macro
use_derive_signal!
is now exported (thanks to @mscofield0).
UseStorageOptions
andUseEventSourceOptions
no longer accept acodec
value because this is already provided as a generic parameter to the respective function calls.- Codecs have been refactored. There are now two traits that codecs implement:
Encoder
andDecoder
. The traitStringCodec
is gone. The methods are now associated methods and their params now always take references.JsonCodec
has been renamed toJsonSerdeCodec
.- The feature to enable this codec is now called
json_serde
instead of justserde
. ProstCodec
now encodes as binary data. If you want to keep using it with string data you can wrap it like this:Base64<ProstCodec>
.- All of these structs, traits and features now live in their own crate called
codee
- A bunch of new codecs are available. Have a look at the docs for crate
codee
.
use_websocket
:UseWebsocketOptions
has been renamed toUseWebSocketOptions
(uppercase S) to be consistent with the return type.UseWebSocketOptions::reconnect_limit
andUseEventSourceOptions::reconnect_limit
is nowReconnectLimit
instead ofu64
. UseReconnectLimit::Infinite
for infinite retries orReconnectLimit::Limited(...)
for limited retries.use_websocket
now uses codecs to send typed messages over the network.- When calling you have give type parameters for the message type and the
codec:
use_websocket::<String, WebpackSerdeCodec>
- You can use binary or string codecs.
- The
UseWebSocketReturn::send
closure now takes a&T
which is encoded using the codec. - The
UseWebSocketReturn::message
signal now returns anOption<T>
which is decoded using the codec. UseWebSocketReturn::send_bytes
andUseWebSocketReturn::message_bytes
are gone.UseWebSocketOptions::on_message
andUseWebSocketOptions::on_message_bytes
have been renamed toon_message_raw
andon_message_raw_bytes
.- The new
UseWebSocketOptions::on_message
takes a&T
. UseWebSocketOptions::on_error
now takes aUseWebSocketError
instead of aweb_sys::Event
.
- When calling you have give type parameters for the message type and the
codec:
use_storage
now always saves the default value to storage if the key doesn't exist yet.- Renamed
BreakpointsSematic
toBreakpointsSemantic
andbreakpoints_sematic
tobreakpoints_semantic
(note then
) (thanks to @mondeja).
- Fixed auto-reconnect in
use_websocket
- Fixed typo in compiler error messages in
use_cookie
(thanks to @SleeplessOne1917). - Fixed potential signal out of scope issue with
use_raf_fn
- Better links in docs that work both in the book and in rustdoc (thanks to @mondeja).
- Better CI/CD (thanks to @EstebanBorai).
- Added compile-time warning when you use
ssr
feature withwasm32
. You can enablewasm_ssr
to remove the warning.
- Fixed
use_color_mode
without cookies and make cookies sync properly with local storage - Fixed
use_infinite_scroll
edge case bug with disposed signals
use_cookie
now supports Spin out of the box (thanks to @javierEd).
sync_signal
use_color_mode
now supports cookies.
- Corrected docs of
use_cookie
'smax-age
unit to milliseconds (thanks to @sify21). - Fixed setting multiple cookies in the browser (thanks to @sbking).
- Fixed SSR detection from an url query parameter for
use_color_mode
(thanks to @mondeja).
use_event_source
- Wrapped callbacks in a non-reactive zone to remove potential warnings.
- Updated SSR chapter in the book to make it more clear and beginner-friendly (thanks to @flupke).
use_or
use_and
use_not
- Removed signal warnings from
use_websocket
'ssend...
methods.
use_color_mode
now supports detection from an url query parameter. (thanks to @mondeja)
use_permission
use_clipboard
use_timeout_fn
- Fixed docs.rs build
use_broadcast_channel
use_cookie
(thanks to @rakshith-ravi)use_mouse_in_element
use_device_orientation
(thanks to @mondeja)use_device_pixel_ratio
(thanks to @mondeja)use_element_bounding
- The
leptos
version is now 0.6 - The trait
Codec
has been renamed toStringCodec
and has been moved toutil::StringCodec
.- The struct
StringCodec
has been renamed toFromToStringCodec
and has been moved toutil::FromToStringCodec
. - The structs
JsonCodec
andProstCodec
have been moved toutil
as well.
- The struct
- The function
use_storage
now requires type parameters for the stored type and the codec like all the other...storage...
functions.
- Fixed
use_geolocation
SSR compile issue - Fixed
use_intl_number_format
maximum fraction digits option
- The
UseMouseReturn
signalsx
,y
, andsource_type
are now of typeSignal<f64>
instead ofReadSignal<f64>
. - You can now convert
leptos::html::HtmlElement<T>
intoElement(s)MaybeSignal
. This should make functions a lot easier to use in directives. - There's now a chapter in the book especially for
Element(s)MaybeSignal
. - Throttled or debounced callbacks (in watch__ or __fn) no longer are called after the containing scope was cleaned up.
- The document returned from
use_document
now supports the methodsquery_selector
andquery_selector_all
.
use_display_media
(thanks to @seanaye)
- (@feral-dot-io) The use
use_<type>_storage
functions have been rewritten to useCodec
s instead of always requiringserde
.- This also removes the feature
storage
- By default the
StringCodec
is used which relies on types implementingFromString + ToString
- If you want to use
JsonCodec
you have to enable the featureserde
- If you want to use
ProstCodec
(new!) you have to enable the featureprost
.
- This also removes the feature
- (@feral-dot-io) The Rust flag
--cfg=web_sys_unstable_apis
is not needed anymore since relevantweb_sys
APIs are now stable. This affects in particularuse_element_size
use_resize_observer
use_raf_fn
anduse_timestamp
no longer spam warnings because ofget
ting signals outside of reactive contexts.use_infinite_scroll
no longer calls the callback twice for the same eventuse_scroll
now usestry_get_untracked
in the debounced callback to avoid panics if the context has been destroyed while the callback was waiting to be called.use_idle
works properly now (no more idles too early).use_web_notification
doesn't panic on the server anymore.
- Fixed SSR for
- use_timestamp
- use_raf_fn
- use_idle
- Using strings for
ElementMaybeSignal
andElementsMaybeSignal
is now SSR safe.- This fixes specifically
use_color_mode
to work on the server.
- This fixes specifically
use_web_notification
(thanks to @centershocks44)use_infinite_scroll
use_service_worker
(thanks to @lpotthast)
use_scroll
returnsimpl Fn(T) + Clone
instead ofBox<dyn Fn(T)>
.
UseScrollReturn
is now documented
- Some functions still used
window()
which could lead to panics in SSR. This is now fixed. Specifically foruse_draggable
.
use_sorted
use_timestamp
use_idle
use_document
use_window
use_geolocation
signal_debounced
signal_throttled
- Leptos version is now 0.5
- No
cx: Scope
params are supported/needed anymore because of the changes in Leptos. Please check the release notes of Leptos 0.5 for how to upgrade. watch
is now deprecated in favor ofleptos::watch
and will be removed in a future release.watch_with_options
will continue to exist.use_event_listener_with_options
now takes aUseEventListenerOptions
instead of aweb_sys::AddEventListenerOptions
.use_mutation_observer_with_options
now takes aUseMutationObserverOptions
instead of aweb_sys::MutationObserverInit
.use_websocket
:- takes now a
&str
instead of aString
as itsurl
parameter. - same for the returned
send
method. - The
ready_state
return type is now renamed toConnectionReadyState
instead ofUseWebSocketReadyState
. - The returned signals
ready_state
,message
,message_bytes
have now the typeSignal<...>
instead ofReadSignal<...>
to make them more consistent with other functions. - The options
reconnect_limit
andreconnect_interval
now take au64
instead ofOption<u64>
to improve DX. - The option
manual
has been renamed toimmediate
to make it more consistent with other functions. To port please note thatimmediate
is the inverse ofmanual
(immediate
=!manual
). - Added documentation how pass it ergonomically as context.
- takes now a
use_color_mode
:- The optional
on_changed
handler parameters have changed slightly. Please refer to the docs for more details.
- The optional
- Throttled or debounced functions cannot be
FnOnce
anymore. - All traits
ClonableFn...
have been removed.
use_websocket
can use relative urls now- Callbacks in options don't require to be cloneable anymore
- Callback in
use_raf_fn
doesn't require to be cloneable anymore - All (!) functions can now be safely called on the server. Specifically this includes the following that before
panicked on the server:
use_scroll
use_event_listener
use_element_hover
on_click_outside
use_drop_zone
use_element_size
use_element_visibility
use_resize_observer
use_intersection_observer
use_mutation_observer
use_element_visibility
didn't work in some cases on Chrome properly. This has been fixed.
use_websocket
panicked after unmount
use_event_listener_with_options
removes the handlers now correctly.
use_storage
now uses.get_untracked()
to avoid warnings.
use_draggable
use_to_string
is_err
is_ok
is_none
is_some
use_raf_fn
- The following functions now accept a
MaybeRwSignal
as their initial/default value which means you can use a synchronizedRwSignal
in those places.use_color_mode
use_cycle_list
use_favicon
use_storage
use_local_storage
use_session_storage
- Instead of returning
ReadSignal
, the following functions now returnSignal
.use_color_mode
use_favicon
use_storage
use_local_storage
use_session_storage
use_drop_zone
now uses.get_untracked()
in event handlers
use_drop_zone
use_websocket
(thanks @sectore)use_intl_number_format
- Crate is ready for Server-Side Rendering. Enable feature
ssr
like you do forleptos
.
use_window_focus
use_window_scroll
use_document_visibility
- Required
leptos
version is now 0.4 - Following the changes in
leptos
there is no longer astable
crate feature required in order to use this library with a stable toolchain. If you want to use it with a nightly toolchain you have to enable thenightly
feature only onleptos
directly. No change is required forleptos-use
itself.
use_color_mode
use_cycle_list
use_active_element
- You can now use this crate with the
stable
toolchain (thanks @lpotthast) - Set leptos dependency to
default-features = false
in order to enable SSR.
use_css_var
use_element_hover
use_interval_fn
use_interval
use_event_listener
no longer returns aBox<dyn Fn()>
but aimpl Fn() + Clone
- You can now specify a
&str
orSignal<String>
with CSS selectors wherever a node ref is accepted - Callbacks of the following functions no longer require
Clone
use_resize_observer
use_intersection_observer
- These functions now also accept multiple target elements in addition to a single one:
use_resize_observer
use_intersection_observer
whenever
use_mutation_observer
use_abs
on_click_outside
use_intersection_observer
use_element_visibility
watch
doesn't acceptimmediate
as a direct argument anymore. This is only provided by the option variant.watch
has now variantwatch_with_options
which allows for debouncing and throttling.
use_storage
use_local_storage
use_session_storage
watch_debounced
watch_throttled
watch_pausable
use_ceil
use_round
use_media_query
use_preferred_dark
use_preferred_contrast
use_favicon
use_breakpoints
- Function count badge in readme
- Fixed documentation and doc tests running for functions behind
#[cfg(web_sys_unstable_apis)]
use_element_size
- Fixed documentation so all feature are documented
use_floor
use_max
use_min
- New feature:
math
that has to be activated in order to use the math functions.
use_supported
use_resize_observer
watch
use_mouse
- Use the crate
default-struct-builder
to provide ergonimic function options.
use_scroll
use_debounce_fn
- Better and more beautiful demo integration into the guide.