Skip to content

Commit

Permalink
Merge pull request #23 from the-via/common-menus
Browse files Browse the repository at this point in the history
Common menus
  • Loading branch information
ValdisThomann authored Feb 19, 2023
2 parents 55bf23d + 4f45ab7 commit 1c9f9f1
Show file tree
Hide file tree
Showing 12 changed files with 580 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@the-via/reader",
"version": "1.5.10",
"version": "1.6.0",
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/the-via/reader.git"
Expand Down
13 changes: 13 additions & 0 deletions src/common-menus/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {qmk_audio} from './qmk_audio';
import {qmk_backlight} from './qmk_backlight';
import {qmk_backlight_rgblight} from './qmk_backlight_rgblight';
import {qmk_rgblight} from './qmk_rgblight';
import {qmk_rgb_matrix} from './qmk_rgb_matrix';

export const commonMenus = {
qmk_audio,
qmk_backlight_rgblight,
qmk_backlight,
qmk_rgb_matrix,
qmk_rgblight,
};
24 changes: 24 additions & 0 deletions src/common-menus/qmk_audio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {VIAMenu} from '../menu-types';

export const qmk_audio: VIAMenu[] = [
{
label: 'Audio',
content: [
{
label: 'General',
content: [
{
label: 'Audio Enable',
type: 'toggle',
content: ['id_qmk_audio_enable', 4, 1],
},
{
label: 'Audio Clicky Enable',
type: 'toggle',
content: ['id_qmk_audio_clicky_enable', 4, 2],
},
],
},
],
},
];
29 changes: 29 additions & 0 deletions src/common-menus/qmk_backlight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {VIAMenu} from '../menu-types';

export const qmk_backlight: VIAMenu[] = [
{
label: 'Lighting',
content: [
{
label: 'Backlight',
content: [
{
label: 'Backlight Brightness',
type: 'range',
options: [0, 255],
content: ['id_qmk_backlight_brightness', 1, 1],
},
{
label: 'Backlight Effect',
type: 'dropdown',
content: ['id_qmk_backlight_effect', 1, 2],
options: [
['Off', 0],
['Breathing', 1],
],
},
],
},
],
},
];
104 changes: 104 additions & 0 deletions src/common-menus/qmk_backlight_rgblight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import {VIAMenu} from '../menu-types';

export const qmk_backlight_rgblight: VIAMenu[] = [
{
label: 'Lighting',
content: [
{
label: 'Backlight',
content: [
{
label: 'Backlight Brightness',
type: 'range',
options: [0, 255],
content: ['id_qmk_backlight_brightness', 1, 1],
},
{
label: 'Backlight Effect',
type: 'dropdown',
content: ['id_qmk_backlight_effect', 1, 2],
options: [
['Off', 0],
['Breathing', 1],
],
},
],
},
{
label: 'Underglow',
content: [
{
label: 'Brightness',
type: 'range',
options: [0, 255],
content: ['id_qmk_rgblight_brightness', 2, 1],
},
{
label: 'Effect',
type: 'dropdown',
content: ['id_qmk_rgblight_effect', 2, 2],
options: [
'All Off',
'Solid Color',
'Breathing 1',
'Breathing 2',
'Breathing 3',
'Breathing 4',
'Rainbow Mood 1',
'Rainbow Mood 2',
'Rainbow Mood 3',
'Rainbow Swirl 1',
'Rainbow Swirl 2',
'Rainbow Swirl 3',
'Rainbow Swirl 4',
'Rainbow Swirl 5',
'Rainbow Swirl 6',
'Snake 1',
'Snake 2',
'Snake 3',
'Snake 4',
'Snake 5',
'Snake 6',
'Knight 1',
'Knight 2',
'Knight 3',
'Christmas',
'Gradient 1',
'Gradient 2',
'Gradient 3',
'Gradient 4',
'Gradient 5',
'Gradient 6',
'Gradient 7',
'Gradient 8',
'Gradient 9',
'Gradient 10',
'RGB Test',
'Alternating',
'Twinkle 1',
'Twinkle 2',
'Twinkle 3',
'Twinkle 4',
'Twinkle 5',
'Twinkle 6',
],
},
{
showIf: '{id_qmk_rgblight_effect} != 0',
label: 'Effect Speed',
type: 'range',
options: [0, 255],
content: ['id_qmk_rgblight_effect_speed', 2, 3],
},
{
showIf:
'{id_qmk_rgblight_effect} != 0 && {id_qmk_rgblight_effect} != 35',
label: 'Color',
type: 'color',
content: ['id_qmk_rgblight_color', 2, 4],
},
],
},
],
},
];
86 changes: 86 additions & 0 deletions src/common-menus/qmk_rgb_matrix.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import {VIAMenu} from '../menu-types';

export const qmk_rgb_matrix: VIAMenu[] = [
{
label: 'Lighting',
content: [
{
label: 'Backlight',
content: [
{
label: 'Brightness',
type: 'range',
options: [0, 255],
content: ['id_qmk_rgb_matrix_brightness', 3, 1],
},
{
label: 'Effect',
type: 'dropdown',
content: ['id_qmk_rgb_matrix_effect', 3, 2],
options: [
'All Off',
'Solid Color',
'Alphas Mods',
'Gradient Up/Down',
'Gradient Left/Right',
'Breathing',
'Band Sat.',
'Band Val.',
'Pinwheel Sat.',
'Pinwheel Val.',
'Spiral Sat.',
'Spiral Val.',
'Cycle All',
'Cycle Left/Right',
'Cycle Up/Down',
'Rainbow Moving Chevron',
'Cycle Out/In',
'Cycle Out/In Dual',
'Cycle Pinwheel',
'Cycle Spiral',
'Dual Beacon',
'Rainbow Beacon',
'Rainbow Pinwheels',
'Raindrops',
'Jellybean Raindrops',
'Hue Breathing',
'Hue Pendulum',
'Hue Wave',
'Pixel Rain',
'Pixel Flow',
'Pixel Fractal',
'Typing Heatmap',
'Digital Rain',
'Solid Reactive Simple',
'Solid Reactive',
'Solid Reactive Wide',
'Solid Reactive Multi Wide',
'Solid Reactive Cross',
'Solid Reactive Multi Cross',
'Solid Reactive Nexus',
'Solid Reactive Multi Nexus',
'Spash',
'Multi Splash',
'Solid Splash',
'Solid Multi Splash',
],
},
{
showIf: '{id_qmk_rgb_matrix_effect} != 0',
label: 'Effect Speed',
type: 'range',
options: [0, 255],
content: ['id_qmk_rgb_matrix_effect_speed', 3, 3],
},
{
showIf:
'{id_qmk_rgb_matrix_effect} != 0 && {id_qmk_rgb_matrix_effect} != 24 && {id_qmk_rgb_matrix_effect} != 28 && {id_qmk_rgb_matrix_effect} != 29 && {id_qmk_rgb_matrix_effect} != 32',
label: 'Color',
type: 'color',
content: ['id_qmk_rgb_matrix_color', 3, 4],
},
],
},
],
},
];
84 changes: 84 additions & 0 deletions src/common-menus/qmk_rgblight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import {VIAMenu} from '../menu-types';

export const qmk_rgblight: VIAMenu[] = [
{
label: 'Lighting',
content: [
{
label: 'Underglow',
content: [
{
label: 'Brightness',
type: 'range',
options: [0, 255],
content: ['id_qmk_rgblight_brightness', 2, 1],
},
{
label: 'Effect',
type: 'dropdown',
content: ['id_qmk_rgblight_effect', 2, 2],
options: [
'All Off',
'Solid Color',
'Breathing 1',
'Breathing 2',
'Breathing 3',
'Breathing 4',
'Rainbow Mood 1',
'Rainbow Mood 2',
'Rainbow Mood 3',
'Rainbow Swirl 1',
'Rainbow Swirl 2',
'Rainbow Swirl 3',
'Rainbow Swirl 4',
'Rainbow Swirl 5',
'Rainbow Swirl 6',
'Snake 1',
'Snake 2',
'Snake 3',
'Snake 4',
'Snake 5',
'Snake 6',
'Knight 1',
'Knight 2',
'Knight 3',
'Christmas',
'Gradient 1',
'Gradient 2',
'Gradient 3',
'Gradient 4',
'Gradient 5',
'Gradient 6',
'Gradient 7',
'Gradient 8',
'Gradient 9',
'Gradient 10',
'RGB Test',
'Alternating',
'Twinkle 1',
'Twinkle 2',
'Twinkle 3',
'Twinkle 4',
'Twinkle 5',
'Twinkle 6',
],
},
{
showIf: '{id_qmk_rgblight_effect} != 0',
label: 'Effect Speed',
type: 'range',
options: [0, 255],
content: ['id_qmk_rgblight_effect_speed', 2, 3],
},
{
showIf:
'{id_qmk_rgblight_effect} != 0 && {id_qmk_rgblight_effect} != 35',
label: 'Color',
type: 'color',
content: ['id_qmk_rgblight_color', 2, 4],
},
],
},
],
},
];
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export * from './menu-types';
export * from './themes';
export * from './types.guards';
export * from './validate';
export * from './common-menus';
8 changes: 7 additions & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import {
VIALightingTypeDefinition,
} from './types.v2';
import {LightingPreset} from './lighting-presets';
import {validateKeyBounds, validateLayouts} from './validate';
import {
validateCommonMenus,
validateKeyBounds,
validateLayouts,
} from './validate';

export {VIADefinitionV3, KeyboardDefinitionV3};

Expand Down Expand Up @@ -65,6 +69,8 @@ export const keyboardDefinitionV3ToVIADefinitionV3 = (
...viaLayout,
};
validateKeyBounds(matrix, viaLayouts);
validateCommonMenus(menus ?? []);

return {
name,
vendorProductId: getVendorProductId(definition),
Expand Down
Loading

0 comments on commit 1c9f9f1

Please sign in to comment.