diff --git a/config-serializer/config-items/KeyAction.ts b/config-serializer/config-items/KeyAction.ts index 35a49ada..99fb2e04 100644 --- a/config-serializer/config-items/KeyAction.ts +++ b/config-serializer/config-items/KeyAction.ts @@ -25,7 +25,7 @@ let keyActionType = { abstract class KeyAction extends Serializable { assertKeyActionType(jsObject: any) { let keyActionClassname = this.constructor.name; - let keyActionTypeString = keyActionType[keyActionClassname] + let keyActionTypeString = keyActionType[keyActionClassname]; if (jsObject.keyActionType !== keyActionTypeString) { throw `Invalid ${keyActionClassname}.keyActionType: ${jsObject.keyActionType}`; } diff --git a/examples/uhk.key-design.fn-layer.svg b/examples/uhk.key-design.fn-layer.svg new file mode 100644 index 00000000..1d9aa9f3 --- /dev/null +++ b/examples/uhk.key-design.fn-layer.svg @@ -0,0 +1,1791 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Shift + + + Fn + + + Alt + + + Super + + + Ctrl + + + Mod + + + + + + + + + + + + + + + + + + + + + + + + Mouse + + + Shift + + + Ctrl + + + Super + + + Alt + + + Fn + + + Mod + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/uhk.key-design.fn-layer.with_alignments.svg b/examples/uhk.key-design.fn-layer.with_alignments.svg new file mode 100644 index 00000000..06121b67 --- /dev/null +++ b/examples/uhk.key-design.fn-layer.with_alignments.svg @@ -0,0 +1,2078 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Shift + + + Fn + + + Alt + + + Super + + + Ctrl + + + Mod + + + + + + + + + + + + + + + + + + + + + + + + Mouse + + + Shift + + + Ctrl + + + Super + + + Alt + + + Fn + + + Mod + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Media + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/uhk.key-design.mouse-layer.svg b/examples/uhk.key-design.mouse-layer.svg new file mode 100644 index 00000000..d4ec77cd --- /dev/null +++ b/examples/uhk.key-design.mouse-layer.svg @@ -0,0 +1,1588 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Shift + + + Fn + + + Alt + + + Super + + + Ctrl + + + Mod + + + + + + + + + + + + + + + + + + + + + + + + Mouse + + + Shift + + + Ctrl + + + Super + + + Alt + + + Fn + + + Mod + + + + + + + + + Move + + + + + + + + + Move + + + + + + + + + Move + + + + + + + + + Move + + + + + + + + + Scroll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Scroll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Scroll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Scroll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Click + + + + Right + + + + + Click + + + + Middle + + + + + Click + + + + Left + + + + + Click + + + + Button 4 + + + + + Click + + + + Btn 5 + + + + + Click + + + + Btn 6 + + diff --git a/examples/uhk.key-design.mouse-layer.with_alignments.svg b/examples/uhk.key-design.mouse-layer.with_alignments.svg new file mode 100644 index 00000000..847917ed --- /dev/null +++ b/examples/uhk.key-design.mouse-layer.with_alignments.svg @@ -0,0 +1,2220 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Shift + + + Fn + + + Alt + + + Super + + + Ctrl + + + Mod + + + + + + + + + + + + + + + + + + + + + + + + Mouse + + + Shift + + + Ctrl + + + Super + + + Alt + + + Fn + + + Mod + + + + + + + + + Move + + + + + + + + + Move + + + + + + + + + Move + + + + + + + + + Move + + + + + + + + + Scroll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Scroll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Scroll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Scroll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Click + + + + Right + + + + + + + + + + + + Click + + + + Middle + + + + + + + + + + + + Click + + + + Left + + + + + + + + + + + + Click + + + + Button 4 + + + + + + + + + + + + Click + + + + Btn 5 + + + + + + + + + + + + Click + + + + Btn 6 + + diff --git a/examples/uhk.key-design.svg b/examples/uhk.key-design.svg index df8cd635..4da37f4d 100755 --- a/examples/uhk.key-design.svg +++ b/examples/uhk.key-design.svg @@ -23,7 +23,7 @@ image/svg+xml - + @@ -69,669 +69,65 @@ style="fill:#333333;stroke:none" rx="3.5433071" ry="3.5433071" - x="93.996696" - y="92.947655" + x="277.43369" + y="227.59335" height="63.779526" width="63.779526" - id="a2" /> - - - - - - - - - - + id="c4" /> - - - - - - - - - + id="c5" /> - - - - - - - - - - + id="c2" /> - - - - - - + id="c3" /> - - - + id="d9" /> - - - - - - - - + id="d11" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + width="111.61417" + id="c13" /> + + + + + + + + + + + + + + + + + + + + + + - - - Y U I O - P - - H J K L Enter N Shift Ctrl - - - - - Tab Q - W - - E - R - - Mouse A S D F Shift Z X C - V - - B @@ -1631,7 +1106,7 @@ id="SvgjsTspan1220">Mod <, - >. - ?/ - - - - - - - - C - A - - - - 3 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:19px;font-family:Helvetica;-inkscape-font-specification:'Helvetica Bold';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">3 $ &7 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:19px;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">& 8 - (9 0 - _- - += 4 % 5 - - - - Mod - - ^ 6 Fn - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - :; - "' - {[ - }] - |\ - ~` - - - - C - - - - - - - - C - - - - - - C - - - - - - - - - - C - - - - - - - - Mouse - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - C - - - - - - - - - - - - - C - - - - - - - - - - - - - - - C - - - - - - - - - - - - - - - C - - - - - - - - - - - - - - - C - - - - - - - - - - - - - - - C - - - - - - - - - - - - - - - C - - - - - - - - - - - - - - - C - - - - - - - - - - - - - - - C - - - - - - - - - - - - - - - C - - - - - - @@ -5427,147 +1443,588 @@ y="119.1199" id="tspan4554-3-1-4" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:19px;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">) + # + @ + 2 + 1 + ! + ~ + ` + 7 + 9 + ( + - + _ + = + + + \ + | + ] + } + [ + { + P - - - - - - + id="g5496" + transform="translate(-15.186732,-0.30478927)"> C + + + + R + + C + A S # + x="225.02646" + y="188.45581" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:19px;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">W C + id="tspan4573-69-7-3-69-08-71-7-2-6" + x="213.78044" + y="218.26228" + style="font-size:12.12682629px;fill:#82b2dc;fill-opacity:1;">C + d="m 201.20784,216.3102 0,-2.07047 -1.16463,0 c -0.64056,0 -1.16465,-0.008 -1.16465,-0.0177 0,-0.01 1.05347,-1.07113 2.34105,-2.35866 l 2.34104,-2.34096 2.34105,2.34096 c 1.28758,1.28753 2.34104,2.34892 2.34104,2.35866 0,0.01 -0.52408,0.0177 -1.16463,0.0177 l -1.16464,0 0,2.07047 0,2.07048 -2.35282,0 -2.35281,0 0,-2.07048 z m 4.02331,-0.65878 0,-2.04695 0.71171,0 0.7117,0 -1.54694,-1.54693 -1.54692,-1.54693 -1.54121,1.54105 -1.54122,1.54106 0.71183,0.0118 0.71183,0.0118 0.006,2.04106 0.006,2.04106 1.6586,0 1.65861,0 0,-2.04695 z" + style="fill:#82b2dc;fill-opacity:1;stroke:none" /> - + id="path5460-44-93-16-94-8-21" /> + + ; + : + ' + " + C + + + + + + / + ? + . + > + , + < + V + transform="translate(20.905476,-381.50633)" + id="g5219-8"> + C + + + + + + id="g5437-0"> Mouse + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:14.13553333px;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">LCtrl - @ - 2 - - C - - - - + transform="translate(-152.34431,-429.1804)" + id="g5428-7-7"> + id="g5437-0-4"> Mouse + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:14.13553333px;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">LShift - 1 - ! + style="fill:#333333;stroke:none" + id="g5437-0-3" + transform="translate(-11.901139,-429.26521)"> + C - - - + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:14.13553333px;font-family:Helvetica;-inkscape-font-specification:Helvetica;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1" + y="714.99799" + x="327.66473" + sodipodi:role="line" + id="tspan5212-5-0-3-7">LAlt + + + + + LSuper + diff --git a/examples/uhk.key-design.with_alignments.svg b/examples/uhk.key-design.with_alignments.svg new file mode 100644 index 00000000..fe754996 --- /dev/null +++ b/examples/uhk.key-design.with_alignments.svg @@ -0,0 +1,3144 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Y + + + U + + + I + + + O + + + H + + + J + + + K + + + L + + + Enter + + + N + + + M + + + Shift + + + Space + + + Fn + + + Alt + + + Super + + + Ctrl + + + Mod + + + + + + + + + + + + + + + + + + + + + + + + Tab + + + Q + + + E + + + T + + + Mouse + + + A + + + S + + + D + + + F + + + G + + + Shift + + + Z + + + X + + + C + + + B + + + Ctrl + + + Super + + + Alt + + + Fn + + + Mod + + + Space + + + + 3 + $ + & + 8 + 0 + 4 + + + + Mouse + + + % + 5 + ^ + 6 + + + + Fn + + + C + + + + + C + + + + + + C + + + + + + * + ) + # + @ + 2 + 1 + ! + ~ + ` + 7 + + + + + + + 9 + ( + - + _ + = + + + \ + | + ] + } + [ + { + P + + C + + + + + + + + + R + + C + + A + S + + W + C + + + + + + + + + + ; + : + + + + + + + ' + " + C + + + + + + / + ? + + + + + . + > + , + < + + + + + V + + C + + + + + + + + LCtrl + + + + + + LShift + + + + + LAlt + + + + + LSuper + + + diff --git a/package.json b/package.json index 02ca95b9..148ea295 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ }, "scripts": { "postinstall": "typings install", - "lint": "tslint **/*.ts", + "lint": "tslint 'src/**/*.ts' 'config-serializer/**/*.ts'", "typings": "typings", "webpack": "webpack", "webpack-dev-server": "webpack-dev-server" diff --git a/src/components/keyboard-button-group.component.ts b/src/components/keyboard-button-group.component.ts index d8c2f0c3..4032d61b 100644 --- a/src/components/keyboard-button-group.component.ts +++ b/src/components/keyboard-button-group.component.ts @@ -31,4 +31,4 @@ export class KeyboardButtonGroupComponent implements OnInit { ngOnInit() { } -} \ No newline at end of file +} diff --git a/src/components/keyboard-button.component.ts b/src/components/keyboard-button.component.ts index 65a2e9d1..6609fb4e 100644 --- a/src/components/keyboard-button.component.ts +++ b/src/components/keyboard-button.component.ts @@ -13,7 +13,7 @@ import { Component, OnInit, Input } from 'angular2/core'; :host { display: flex; } - `], + `] }) export class KeyboardButtonComponent implements OnInit { @Input() id: string; @@ -27,4 +27,4 @@ export class KeyboardButtonComponent implements OnInit { ngOnInit() { } -} \ No newline at end of file +} diff --git a/src/components/keyboard-button.model.ts b/src/components/keyboard-button.model.ts index d9c1e690..651e2108 100644 --- a/src/components/keyboard-button.model.ts +++ b/src/components/keyboard-button.model.ts @@ -7,4 +7,4 @@ export interface KeyboardButton { height: string; width: string; fill: string; -} \ No newline at end of file +} diff --git a/src/components/keyboard.component.ts b/src/components/keyboard.component.ts index 0b863760..89db4f21 100644 --- a/src/components/keyboard.component.ts +++ b/src/components/keyboard.component.ts @@ -7,7 +7,11 @@ import {Module, ModuleComponent} from './module'; selector: 'keyboard', template: ` - + + `, styles: [` @@ -31,8 +35,8 @@ export class KeyboardComponent implements OnInit { } private loadKeyboardModules(): void { - var svg: any = this.dps.getBaseLayer(); + let svg: any = this.dps.getBaseLayer(); this.modules = svg.g[0].g.map(obj => new Module(obj, svg.g[0].$.fill)); } -} \ No newline at end of file +} diff --git a/src/components/module.component.ts b/src/components/module.component.ts index 44fcbbbd..a70c7384 100644 --- a/src/components/module.component.ts +++ b/src/components/module.component.ts @@ -30,27 +30,25 @@ export class ModuleComponent implements OnInit { ngOnInit() { this.getButtonGroups().forEach(buttonGroup => { - this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, "row").then((bttnComponentRef: ComponentRef) => { - var group: KeyboardButtonGroupComponent = bttnComponentRef.instance; - group.keyboardButtons = buttonGroup; - // console.log(keyboardButtonComponent); - }); + this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, 'row') + .then((bttnComponentRef: ComponentRef) => { + let group: KeyboardButtonGroupComponent = bttnComponentRef.instance; + group.keyboardButtons = buttonGroup; + }); }); } - private getButtonGroups(): KeyboardButton[][] { - var buttonGroups: KeyboardButton[][] = []; - var buttonGroup: KeyboardButton[] = []; - this.keyboardButtons.forEach((keyboardButton, index) => { + let buttonGroups: KeyboardButton[][] = []; + let buttonGroup: KeyboardButton[] = []; + this.keyboardButtons.forEach(keyboardButton => { if (buttonGroup.length > 0 && buttonGroup[buttonGroup.length - 1].y !== keyboardButton.y) { buttonGroups.push(buttonGroup); buttonGroup = []; } buttonGroup.push(keyboardButton); }); - //console.log(buttonGroups, buttonGroup, this.keyboardButtons); return buttonGroups; } -} \ No newline at end of file +} diff --git a/src/components/module.model.ts b/src/components/module.model.ts index 161ad9a1..e7d52df0 100644 --- a/src/components/module.model.ts +++ b/src/components/module.model.ts @@ -5,8 +5,8 @@ export class Module { private keyboardButtons: KeyboardButton[]; constructor(obj: { rect: any[], path: any[] }, fill?: string) { - this.keyboardButtons = obj.rect.map(obj => obj.$); + this.keyboardButtons = obj.rect.map(rect => rect.$); this.keyboardButtons.forEach(keyboardButton => keyboardButton.fill = fill ? fill : 'black'); this.case = obj.path[0].$; } -} \ No newline at end of file +} diff --git a/src/components/module.ts b/src/components/module.ts index 54e5251d..141d0a3e 100644 --- a/src/components/module.ts +++ b/src/components/module.ts @@ -1,3 +1,3 @@ import {Module} from './module.model'; import {ModuleComponent} from './module.component'; -export {Module, ModuleComponent}; \ No newline at end of file +export {Module, ModuleComponent}; diff --git a/src/services/data-provider.service.ts b/src/services/data-provider.service.ts index bccc350c..604de161 100644 --- a/src/services/data-provider.service.ts +++ b/src/services/data-provider.service.ts @@ -5,9 +5,8 @@ export class DataProviderService { constructor() { } - getBaseLayer(): any { return require('xml!../../images/base-layer.svg').svg; } -} \ No newline at end of file +}