gaucho-labs / leptos-hotkeys

a declarative way of using keyboard shortcuts + callbacks in leptos applications
https://leptos-hotkeys.vercel.app
MIT License
43 stars 8 forks source link

Add `ProvideHotkeysContextOptions` #84

Open mondeja opened 5 months ago

mondeja commented 5 months ago

I would like to write something like the next code to provide a global context for keyboard shortcuts:

provide_hotkeys_context(main_ref);

and provide the context with the default false and scopes!() parameters.

Implementation proposal

I think that the best approach is to use the same that leptos-use does (eg. see use_element_size and use_element_size_with_options) as this would reduce mental overhead when using libraries in the Leptos ecosystem.

Of course, this is a breaking change that should be postponed for v0.3.0 or beyond that.