Skip to content

Commit

Permalink
Added KLE typing for ghosted, stepped, homing. Export ValidateFunctio…
Browse files Browse the repository at this point in the history
…n from index
  • Loading branch information
ValdisThomann committed Jan 29, 2023
1 parent d91b2ca commit c2e5ad4
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export {isVIADefinitionV3} from './validated-types/via-definition-v3.validator';
export {isVIADefinitionV2} from './validated-types/via-definition-v2.validator';
export {isKeyboardDefinitionV3} from './validated-types/keyboard-definition-v3.validator';
export {
isKeyboardDefinitionV3,
ValidateFunction,
} from './validated-types/keyboard-definition-v3.validator';
export {isKeyboardDefinitionV2} from './validated-types/keyboard-definition-v2.validator';
export * from './transform';
export * from './kle-parser';
Expand Down
22 changes: 21 additions & 1 deletion src/types.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ export type OptionalDimensions = Partial<{
w2: number;
}>;

export type Ghosted = {
g: boolean;
};

export type Stepped = {
l: boolean;
};

export type Homing = {
n: boolean;
};

export type Decal = {
d: boolean;
};
Expand All @@ -43,7 +55,15 @@ export type Dimensions = {
h: number;
};
export type KLEElem =
| Partial<KLEDimensions & Formatting & Decal & OptionalDimensions>
| Partial<
KLEDimensions &
OptionalDimensions &
Formatting &
Ghosted &
Stepped &
Homing &
Decal
>
| string;
export type ColorCount = {[key: string]: number};
export type ParsedKLE = {
Expand Down
9 changes: 5 additions & 4 deletions test/data/v2_invalid_label_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"lighting": "wt_rgb_backlight",
"matrix": {"rows": 5, "cols": 14},
"layouts": {
"labels": [
["Bottom Row", "HHKB", "Full"]
],
"labels": [["Bottom Row", "HHKB", "Full"]],
"keymap": [
[
{
Expand All @@ -24,6 +22,9 @@
"y": 15,
"y2": 1,
"h": 10,
"g": true,
"l": true,
"n": true,
"a": 1
},
"0,0",
Expand Down Expand Up @@ -189,4 +190,4 @@
]
]
}
}
}
9 changes: 5 additions & 4 deletions test/data/v2_valid_definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"lighting": "wt_rgb_backlight",
"matrix": {"rows": 5, "cols": 14},
"layouts": {
"labels": [
["Bottom Row", "HHKB", "Full"]
],
"labels": [["Bottom Row", "HHKB", "Full"]],
"keymap": [
[
{
Expand All @@ -24,6 +22,9 @@
"y": 15,
"y2": 1,
"h": 10,
"g": true,
"l": true,
"n": true,
"a": 0
},
"0,0",
Expand Down Expand Up @@ -189,4 +190,4 @@
]
]
}
}
}
5 changes: 4 additions & 1 deletion test/data/v3_invalid_label_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
"y": 15,
"y2": 1,
"h": 10,
"g": true,
"l": true,
"n": true,
"a": 1
},
"0,0",
Expand Down Expand Up @@ -266,4 +269,4 @@
]
]
}
}
}
5 changes: 4 additions & 1 deletion test/data/v3_valid_definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
"y": 15,
"y2": 1,
"h": 10,
"g": true,
"l": true,
"n": true,
"a": 0
},
"0,0",
Expand Down Expand Up @@ -266,4 +269,4 @@
]
]
}
}
}

0 comments on commit c2e5ad4

Please sign in to comment.