Skip to content

Commit

Permalink
Merge pull request #113 from kukjevov/master
Browse files Browse the repository at this point in the history
Angular 8 and IVY support
  • Loading branch information
wittlock authored Jul 17, 2019
2 parents 09bb8f4 + daebfb0 commit 7a3baca
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# angular2-hotkeys
Angular 5.2.0+, 6 and 7 Compatible. Older versions might work but isn't officially tested.
Angular 5.2.0+, 6, 7 and 8 Compatible. Older versions might work but isn't officially tested. Also library is Angular IVY ready.
## Installation

To install this library, run:
Expand Down
30 changes: 1 addition & 29 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {CommonModule} from '@angular/common';
import {HotkeysDirective} from './src/hotkeys.directive';
import {CheatSheetComponent} from './src/cheatsheet.component';
import {IHotkeyOptions, HotkeyOptions} from './src/hotkey.options';
import {HotkeysService} from './src/hotkeys.service';

export * from './src/cheatsheet.component';
export * from './src/hotkey.model';
export * from './src/hotkey.options';
export * from './src/hotkeys.directive';
export * from './src/hotkeys.service';

@NgModule({
imports : [CommonModule],
exports : [HotkeysDirective, CheatSheetComponent],
declarations : [HotkeysDirective, CheatSheetComponent]
})
export class HotkeyModule {
static forRoot(options: IHotkeyOptions = {}): ModuleWithProviders {
return {
ngModule : HotkeyModule,
providers : [
HotkeysService,
{provide : HotkeyOptions, useValue : options}
]
};
}
}
export * from './public_api';
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"prepare": "tsc && ngc",
"tsc": "tsc",
"tsc:watch": "tsc --watch",
"ngc": "./node_modules/.bin/ngc -p tsconfig.json"
"ngc": "ngc -p tsconfig.json"
},
"repository": {
"type": "git",
Expand All @@ -28,25 +28,27 @@
"bugs": {
"url": "[email protected]:brtnshrdr/angular2-hotkeys.git/issues"
},
"main": "./index.js",
"module": "./angular2-hotkeys.js",
"typings":"./angular2-hotkeys.d.ts",
"dependencies": {
"mousetrap": "^1.6.0",
"@types/mousetrap": "^1.6.0"
},
"devDependencies": {
"@angular/common": "4.2.5",
"@angular/compiler": "4.2.5",
"@angular/compiler-cli": "4.2.5",
"@angular/core": "4.2.5",
"@angular/common": "8.0.0",
"@angular/compiler": "8.0.0",
"@angular/compiler-cli": "8.0.0",
"@angular/core": "8.0.0",
"tsickle": "0.35.0",
"@types/core-js": "0.9.41",
"codelyzer": "~3.0.1",
"rxjs": "^5.5.0",
"rxjs": "^6.5.0",
"tslint": "^3.15.1",
"typescript": "~2.3.3",
"zone.js": "^0.8.4"
"typescript": "~3.4.5",
"zone.js": "^0.9.1"
},
"peerDependencies": {
"@angular/core": "^5.2.0 || ^6.0.0 || ^7.0.0",
"@angular/core": "^5.2.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
"rxjs": "^5.5.0 || ^6.0.0"
},
"engines": {
Expand Down
6 changes: 6 additions & 0 deletions public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './src/cheatsheet.component';
export * from './src/hotkey.model';
export * from './src/hotkey.options';
export * from './src/hotkeys.directive';
export * from './src/hotkeys.service';
export * from './src/hotkey.module';
12 changes: 6 additions & 6 deletions src/hotkey.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export class Hotkey {
/**
* Creates a new Hotkey for Mousetrap binding
*
* @param {string} combo mousetrap key binding
* @param {string} description description for the help menu
* @param {Function} callback method to call when key is pressed
* @param {string} action the type of event to listen for (for mousetrap)
* @param {array} allowIn an array of tag names to allow this combo in ('INPUT', 'SELECT', and/or 'TEXTAREA')
* @param {boolean} persistent if true, the binding is preserved upon route changes
* @param combo mousetrap key binding
* @param description description for the help menu
* @param callback method to call when key is pressed
* @param action the type of event to listen for (for mousetrap)
* @param allowIn an array of tag names to allow this combo in ('INPUT', 'SELECT', and/or 'TEXTAREA')
* @param persistent if true, the binding is preserved upon route changes
*/
constructor(public combo: string | string[], public callback: (event: KeyboardEvent, combo: string) => ExtendedKeyboardEvent | boolean,
public allowIn?: string[], public description?: string | Function, public action?: string,
Expand Down
23 changes: 23 additions & 0 deletions src/hotkey.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {CommonModule} from '@angular/common';
import {HotkeysDirective} from './hotkeys.directive';
import {CheatSheetComponent} from './cheatsheet.component';
import {IHotkeyOptions, HotkeyOptions} from './hotkey.options';
import {HotkeysService} from './hotkeys.service';

@NgModule({
imports : [CommonModule],
exports : [HotkeysDirective, CheatSheetComponent],
declarations : [HotkeysDirective, CheatSheetComponent]
})
export class HotkeyModule {
static forRoot(options: IHotkeyOptions = {}): ModuleWithProviders {
return {
ngModule : HotkeyModule,
providers : [
HotkeysService,
{provide : HotkeyOptions, useValue : options}
]
};
}
}
14 changes: 10 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"compilerOptions": {
"noImplicitAny": true,
"module": "commonjs",
"target": "ES5",
"module": "esnext",
"target": "es5",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
Expand All @@ -13,13 +14,18 @@
]
},
"angularCompilerOptions": {
"genDir": "compiled"
"enableResourceInlining": true,
"annotateForClosureCompiler": true,
"strictMetadataEmit": false,
"skipTemplateCodegen": true,
"flatModuleOutFile": "angular2-hotkeys.js",
"flatModuleId": "angular2-hotkeys"
},
"typeRoots": [
"node_modules/@types"
],
"files": [
"index.ts"
"public_api.ts"
],
"exclude": [
"node_modules"
Expand Down

0 comments on commit 7a3baca

Please sign in to comment.