diff --git a/README.MD b/README.MD index 69de688..6450f5b 100644 --- a/README.MD +++ b/README.MD @@ -1,5 +1,5 @@ # angular2-hotkeys -Angular 5.2.0+, 6, 7 and 8 Compatible. Older versions might work but isn't officially tested. Also library is Angular IVY ready. +Angular 5.2.0+, 6 and 7 Compatible. Older versions might work but isn't officially tested. ## Installation To install this library, run: diff --git a/index.ts b/index.ts index 9a85f30..0994dfc 100644 --- a/index.ts +++ b/index.ts @@ -1 +1,29 @@ -export * from './public_api'; \ No newline at end of file +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} + ] + }; + } +} \ No newline at end of file diff --git a/package.json b/package.json index e80ae0d..f8f268f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "prepare": "tsc && ngc", "tsc": "tsc", "tsc:watch": "tsc --watch", - "ngc": "ngc -p tsconfig.json" + "ngc": "./node_modules/.bin/ngc -p tsconfig.json" }, "repository": { "type": "git", @@ -28,27 +28,25 @@ "bugs": { "url": "git@github.com:brtnshrdr/angular2-hotkeys.git/issues" }, - "module": "./angular2-hotkeys.js", - "typings":"./angular2-hotkeys.d.ts", + "main": "./index.js", "dependencies": { "mousetrap": "^1.6.0", "@types/mousetrap": "^1.6.0" }, "devDependencies": { - "@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", + "@angular/common": "4.2.5", + "@angular/compiler": "4.2.5", + "@angular/compiler-cli": "4.2.5", + "@angular/core": "4.2.5", "@types/core-js": "0.9.41", "codelyzer": "~3.0.1", - "rxjs": "^6.5.0", + "rxjs": "^5.5.0", "tslint": "^3.15.1", - "typescript": "~3.4.5", - "zone.js": "^0.9.1" + "typescript": "~2.3.3", + "zone.js": "^0.8.4" }, "peerDependencies": { - "@angular/core": "^5.2.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", + "@angular/core": "^5.2.0 || ^6.0.0 || ^7.0.0", "rxjs": "^5.5.0 || ^6.0.0" }, "engines": { diff --git a/public_api.ts b/public_api.ts deleted file mode 100644 index e3d387d..0000000 --- a/public_api.ts +++ /dev/null @@ -1,6 +0,0 @@ -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'; diff --git a/src/hotkey.model.ts b/src/hotkey.model.ts index f92e57f..8060b64 100644 --- a/src/hotkey.model.ts +++ b/src/hotkey.model.ts @@ -37,12 +37,12 @@ export class Hotkey { /** * Creates a new Hotkey for Mousetrap binding * - * @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 + * @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 */ constructor(public combo: string | string[], public callback: (event: KeyboardEvent, combo: string) => ExtendedKeyboardEvent | boolean, public allowIn?: string[], public description?: string | Function, public action?: string, diff --git a/src/hotkey.module.ts b/src/hotkey.module.ts deleted file mode 100644 index ec682bb..0000000 --- a/src/hotkey.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -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} - ] - }; - } -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 1ae2a5d..041ecde 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,8 @@ { "compilerOptions": { "noImplicitAny": true, - "module": "esnext", - "target": "es5", - "moduleResolution": "node", + "module": "commonjs", + "target": "ES5", "emitDecoratorMetadata": true, "experimentalDecorators": true, "sourceMap": true, @@ -14,18 +13,13 @@ ] }, "angularCompilerOptions": { - "enableResourceInlining": true, - "annotateForClosureCompiler": true, - "strictMetadataEmit": false, - "skipTemplateCodegen": true, - "flatModuleOutFile": "angular2-hotkeys.js", - "flatModuleId": "angular2-hotkeys" + "genDir": "compiled" }, "typeRoots": [ "node_modules/@types" ], "files": [ - "public_api.ts" + "index.ts" ], "exclude": [ "node_modules"