Skip to content

Commit

Permalink
Update lights to lighting
Browse files Browse the repository at this point in the history
  • Loading branch information
olivia committed Nov 3, 2019
1 parent aa12518 commit 8b68720
Show file tree
Hide file tree
Showing 48 changed files with 6,513 additions and 95 deletions.
8 changes: 4 additions & 4 deletions lib/keyboard.definition.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const KeyboardDefinitionSchema = {
defaultProperties: [],
definitions: {
LightingSupport: {
enum: [0, 1, 2, 3],
type: 'number'
enum: ['none', 'qmk_backlight', 'wt_rgb_backlight', 'wt_mono_backlight'],
type: 'string'
},
'Partial<{c:string;t:string;x:number;y:number;w:number;a:number;}>': {
defaultProperties: [],
Expand Down Expand Up @@ -82,7 +82,7 @@ export const KeyboardDefinitionSchema = {
defaultProperties: [],
type: 'object'
},
lights: {
lighting: {
$ref: '#/definitions/LightingSupport'
},
name: {
Expand All @@ -95,7 +95,7 @@ export const KeyboardDefinitionSchema = {
type: 'string'
}
},
required: ['layouts', 'lights', 'name', 'productId', 'vendorId', 'matrix'],
required: ['layouts', 'lighting', 'name', 'productId', 'vendorId', 'matrix'],
type: 'object'
};
export type ValidateFunction<T> = ((data: unknown) => data is T) &
Expand Down
4 changes: 2 additions & 2 deletions lib/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ function getVendorProductId({productId, vendorId}: KeyboardDefinition): number {
export function keyboardDefinitionToVIADefinition(
definition: KeyboardDefinition
): VIADefinition {
const {name, lights, matrix} = definition;
const {name, lighting, matrix} = definition;
const layouts = Object.entries(definition.layouts).reduce(
(p, [k, v]) => ({...p, [k]: generateParsedKLE(v)}),
{}
);
return {
name,
lights,
lighting,
layouts,
matrix,
vendorProductId: getVendorProductId(definition)
Expand Down
4 changes: 2 additions & 2 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ export type KeyboardDefinition = {
name: string;
vendorId: string;
productId: string;
lights: LightingSupport;
lighting: LightingSupport;
matrix: MatrixInfo;
layouts: {[name: string]: KLELayoutDefinition};
};

export type VIADefinition = {
name: string;
vendorProductId: number;
lights: LightingSupport;
lighting: LightingSupport;
matrix: MatrixInfo;
layouts: {
[layoutName: string]: {
Expand Down
Loading

0 comments on commit 8b68720

Please sign in to comment.