Skip to content

Commit

Permalink
Changes for new patch 0.2.1 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja authored May 27, 2024
1 parent a0edec7 commit 9143458
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## Unreleased - [0.2.1]
## _May 27th, 2024_ - [0.2.1]

### Bug fixes

Expand Down Expand Up @@ -46,5 +46,5 @@
- Elevate `leptos` to v0.6.5
- Added `event.preventDefault()`.

[0.2.1]: https://github.com/gaucho-labs/leptos-hotkeys/compare/v0.2.0...main
[0.2.1]: https://github.com/gaucho-labs/leptos-hotkeys/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/gaucho-labs/leptos-hotkeys/compare/b83afc96...v0.2.0
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@ Declaratively create and pair keybindings with callbacks for Leptos applications
</a>
<!-- markdownlint-restore -->

# leptos-hotkeys

Leptos-hotkeys creates and manages keyboard shortcuts. It provides macros and functions that simplify the definition of
keybindings, since the management of event lifecycle associated with keyboard interactions has been done for you!

## Live example

Curious to see how it works? [See the demo](https://leptos-hotkeys.vercel.app).


To get started, follow the [Quick Start](#quick-start) section.

## Features

> [!NOTE]
> This crate has three types of hotkeys: global, scoped, and focus-trapped.
Expand All @@ -40,6 +38,7 @@ To get started, follow the [Quick Start](#quick-start) section.
Use this macro to declare global and scoped hotkeys. This macro has js idioms while preserving Leptos standards. [More about the macro.](](#macro-api).)

### Global Hotkeys

This example creates two global hotkeys: `W` and `F`.

```rust
Expand Down Expand Up @@ -112,7 +111,6 @@ pub fn SomeComponent() -> impl IntoView {
> [!NOTE]
> Scopes are case-insensitive. That means `my_scope` and `mY_sCoPe` are considered the same scope.

### Focus trapped Hotkeys (the `use_hotkeys_ref!` macro)

This example embeds a hotkey to a `<p>` tag. This hotkey will fire iff the element is focused and the scope is correct.
Expand Down Expand Up @@ -188,7 +186,6 @@ You can bind multiple hotkeys to a callback. For example:
"KeyG+KeyR,MetaLeft+KeyO,ControlLeft+keyK"
```


Keys are case-agnostic and whitspace-agnostic. For a hotkey with multiple keys, use the `,` as a delimiter in a sequence of keys.

### `scopes!()`
Expand Down Expand Up @@ -217,15 +214,15 @@ pub fn App() -> impl IntoView {
```

## The `debug` feature flag

Improve developer experience by introducing the `debug` flag which adds logging to your console in CSR. It logs the current pressed key `code` values, hotkeys fires, and scopes toggling.

Just simply:

```toml
leptos_hotkeys = { path = "0.2.0", features = ["debug"] }
leptos_hotkeys = { path = "0.2.1", features = ["debug"] }
```


## Contributors
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
Expand Down
2 changes: 1 addition & 1 deletion leptos_hotkeys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "leptos_hotkeys"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
description = "A library that declaratively pairs keybindings with callbacks for Leptos applications."
license = "MIT"
Expand Down

0 comments on commit 9143458

Please sign in to comment.