Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(release): bump all dependencies to latest #91

Merged
merged 5 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Web apps are getting closer and closer to be desktop-class applications. With th
## Compatibility with Angular Versions

| @ngneat/hotkeys | Angular |
| --------------- | ------- |
|-----------------|---------|
| 3.x.x | >=17.2 |
| 2.x.x | >=16 |
| 1.3.x | >=14 |
| 1.2.x | <=13 |
Expand All @@ -47,6 +48,7 @@ Web apps are getting closer and closer to be desktop-class applications. With th

## Usage

### Module
Add `HotkeysModule` in your `AppModule`:

```ts
Expand All @@ -58,6 +60,17 @@ import { HotkeysModule } from '@ngneat/hotkeys';
export class AppModule {}
```

### Standalone
Add `HotkeysService` in the standalone components :

```ts
@Component({
standalone: true,
imports: [HotkeysDirective],
})
export class AppComponent {}
```

Now you have two ways to start adding shortcuts to your application:

## Hotkeys Directive
Expand Down Expand Up @@ -137,7 +150,7 @@ interface Options {
}
```

#### `onShortcut`
### `onShortcut`

Listen to any registered hotkey. For example:

Expand All @@ -148,7 +161,7 @@ const unsubscribe = this.hotkeys.onShortcut((event, key, target) => console.log(
unsubscribe();
```

#### `registerHelpModal`
### `registerHelpModal`

Display a help dialog listing all visible hotkeys:

Expand All @@ -175,14 +188,15 @@ export class AppComponent implements AfterViewInit {
```

It accepts a second input that allows defining the hotkey that should open the dialog. The default shortcut is `Shift + ?`. Here's how `HotkeysHelpComponent` looks like:

```
<p align="center">
<img width="50%" height="50%" src="./help_screenshot.png">
</p>
```

You can also provide a custom component. To help you with that, the service exposes the `getShortcuts` method.

#### `removeShortcuts`
### `removeShortcuts`

Remove previously registered shortcuts.

Expand All @@ -193,7 +207,7 @@ this.hotkeys.removeShortcuts('meta.a');
this.hotkeys.removeShortcuts(['meta.1', 'meta.2']);
```

#### `setSequenceDebounce`
### `setSequenceDebounce`

Set the number of milliseconds to debounce a sequence of keys

Expand Down
9 changes: 6 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "hotkeys:build"
"buildTarget": "hotkeys:build"
},
"configurations": {
"production": {
"browserTarget": "hotkeys:build:production"
"buildTarget": "hotkeys:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "hotkeys:build"
"buildTarget": "hotkeys:build"
}
},
"test": {
Expand Down Expand Up @@ -130,5 +130,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
Loading
Loading