File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1+ export type Keycode =
2+ | "Backquote"
3+ | "Digit1"
4+ | "Digit2"
5+ | "Digit3"
6+ | "Digit4"
7+ | "Digit5"
8+ | "Digit6"
9+ | "Digit7"
10+ | "Digit8"
11+ | "Digit9"
12+ | "Digit0"
13+ | "Minus"
14+ | "Equal"
15+ | "KeyQ"
16+ | "KeyW"
17+ | "KeyE"
18+ | "KeyR"
19+ | "KeyT"
20+ | "KeyY"
21+ | "KeyU"
22+ | "KeyI"
23+ | "KeyO"
24+ | "KeyP"
25+ | "BracketLeft"
26+ | "BracketRight"
27+ | "Backslash"
28+ | "KeyA"
29+ | "KeyS"
30+ | "KeyD"
31+ | "KeyF"
32+ | "KeyG"
33+ | "KeyH"
34+ | "KeyJ"
35+ | "KeyK"
36+ | "KeyL"
37+ | "Semicolon"
38+ | "Quote"
39+ | "KeyZ"
40+ | "KeyX"
41+ | "KeyC"
42+ | "KeyV"
43+ | "KeyB"
44+ | "KeyN"
45+ | "KeyM"
46+ | "Comma"
47+ | "Period"
48+ | "Slash"
49+ | "Space"
50+ | "ShiftLeft"
51+ | "IntlBackslash"
52+ | "ShiftRight"
53+ | "ArrowUp"
54+ | "ArrowLeft"
55+ | "ArrowDown"
56+ | "ArrowRight"
57+ | "NumpadMultiply"
58+ | "NumpadSubtract"
59+ | "NumpadAdd"
60+ | "NumpadDecimal"
61+ | "NumpadEqual"
62+ | "NumpadDivide"
63+ | "Numpad0"
64+ | "Numpad1"
65+ | "Numpad2"
66+ | "Numpad3"
67+ | "Numpad4"
68+ | "Numpad5"
69+ | "Numpad6"
70+ | "Numpad7"
71+ | "Numpad8"
72+ | "Numpad9"
73+ | "NumpadEnter"
74+ | "Enter"
75+ | "Backspace" ;
76+
77+ export const qwertyKeycodeKeymap : Keycode [ ] [ ] = [
78+ [
79+ "Backquote" ,
80+ "Digit1" ,
81+ "Digit2" ,
82+ "Digit3" ,
83+ "Digit4" ,
84+ "Digit5" ,
85+ "Digit6" ,
86+ "Digit7" ,
87+ "Digit8" ,
88+ "Digit9" ,
89+ "Digit0" ,
90+ "Minus" ,
91+ "Equal" ,
92+ ] ,
93+ [
94+ "KeyQ" ,
95+ "KeyW" ,
96+ "KeyE" ,
97+ "KeyR" ,
98+ "KeyT" ,
99+ "KeyY" ,
100+ "KeyU" ,
101+ "KeyI" ,
102+ "KeyO" ,
103+ "KeyP" ,
104+ "BracketLeft" ,
105+ "BracketRight" ,
106+ "Backslash" ,
107+ ] ,
108+ [
109+ "KeyA" ,
110+ "KeyS" ,
111+ "KeyD" ,
112+ "KeyF" ,
113+ "KeyG" ,
114+ "KeyH" ,
115+ "KeyJ" ,
116+ "KeyK" ,
117+ "KeyL" ,
118+ "Semicolon" ,
119+ "Quote" ,
120+ ] ,
121+ [
122+ "KeyZ" ,
123+ "KeyX" ,
124+ "KeyC" ,
125+ "KeyV" ,
126+ "KeyB" ,
127+ "KeyN" ,
128+ "KeyM" ,
129+ "Comma" ,
130+ "Period" ,
131+ "Slash" ,
132+ ] ,
133+ [ "Space" ] ,
134+ ] ;
135+
136+ export const leftSideKeys : Set < Keycode > = new Set ( [
137+ "Backquote" ,
138+ "Digit1" ,
139+ "Digit2" ,
140+ "Digit3" ,
141+ "Digit4" ,
142+ "Digit5" ,
143+ "Digit6" ,
144+
145+ "KeyQ" ,
146+ "KeyW" ,
147+ "KeyE" ,
148+ "KeyR" ,
149+ "KeyT" ,
150+ "KeyY" ,
151+
152+ "KeyA" ,
153+ "KeyS" ,
154+ "KeyD" ,
155+ "KeyF" ,
156+ "KeyG" ,
157+
158+ "ShiftLeft" ,
159+ "IntlBackslash" ,
160+ "KeyZ" ,
161+ "KeyX" ,
162+ "KeyC" ,
163+ "KeyV" ,
164+ "KeyB" ,
165+
166+ "Space" ,
167+ ] ) ;
168+
169+ export const rightSideKeys : Set < Keycode > = new Set ( [
170+ "Digit6" ,
171+ "Digit7" ,
172+ "Digit8" ,
173+ "Digit9" ,
174+ "Digit0" ,
175+ "Minus" ,
176+ "Equal" ,
177+ "Backspace" ,
178+
179+ "KeyY" ,
180+ "KeyU" ,
181+ "KeyI" ,
182+ "KeyO" ,
183+ "KeyP" ,
184+ "BracketLeft" ,
185+ "BracketRight" ,
186+ "Backslash" ,
187+
188+ "KeyH" ,
189+ "KeyJ" ,
190+ "KeyK" ,
191+ "KeyL" ,
192+ "Semicolon" ,
193+ "Quote" ,
194+ "Enter" ,
195+
196+ "KeyB" ,
197+ "KeyN" ,
198+ "KeyM" ,
199+ "Comma" ,
200+ "Period" ,
201+ "Slash" ,
202+ "ShiftRight" ,
203+
204+ "ArrowUp" ,
205+ "ArrowLeft" ,
206+ "ArrowDown" ,
207+ "ArrowRight" ,
208+
209+ "NumpadMultiply" ,
210+ "NumpadSubtract" ,
211+ "NumpadAdd" ,
212+ "NumpadDecimal" ,
213+ "NumpadEqual" ,
214+ "NumpadDivide" ,
215+ "Numpad0" ,
216+ "Numpad1" ,
217+ "Numpad2" ,
218+ "Numpad3" ,
219+ "Numpad4" ,
220+ "Numpad5" ,
221+ "Numpad6" ,
222+ "Numpad7" ,
223+ "Numpad8" ,
224+ "Numpad9" ,
225+ "NumpadEnter" ,
226+
227+ "Space" ,
228+ ] ) ;
Original file line number Diff line number Diff line change 11import { ThemeName } from "@monkeytype/schemas/configs" ;
2- import { hexToHSL } from "../utils/colors" ;
32import { z } from "zod" ;
43
54const hexColorSchema = z
@@ -2335,11 +2334,3 @@ export const ThemesList: ThemeWithName[] = Object.keys(themes)
23352334 name : it as ThemeName ,
23362335 } ) as Theme & { name : ThemeName } ,
23372336 ) ;
2338-
2339- export const ThemesListSorted : ThemeWithName [ ] = [
2340- ...ThemesList . sort ( ( a , b ) => {
2341- const b1 = hexToHSL ( a . bg ) ;
2342- const b2 = hexToHSL ( b . bg ) ;
2343- return b2 . lgt - b1 . lgt ;
2344- } ) ,
2345- ] ;
File renamed without changes.
Original file line number Diff line number Diff line change @@ -14,10 +14,16 @@ import { isAuthenticated } from "../../firebase";
1414import { getActivePage } from "../../signals/core" ;
1515import { ThemeName } from "@monkeytype/schemas/configs" ;
1616import { captureException } from "../../sentry" ;
17- import { ColorName , ThemesListSorted } from "../../constants/themes" ;
17+ import { ColorName , ThemesList , ThemeWithName } from "../../constants/themes" ;
1818import { qs , qsa , qsr } from "../../utils/dom" ;
1919import { getTheme , updateThemeColor } from "../../signals/theme" ;
2020
21+ export const sortedThemes : ThemeWithName [ ] = [ ...ThemesList ] . sort ( ( a , b ) => {
22+ const b1 = Colors . hexToHSL ( a . bg ) ;
23+ const b2 = Colors . hexToHSL ( b . bg ) ;
24+ return b2 . lgt - b1 . lgt ;
25+ } ) ;
26+
2127function updateActiveButton ( ) : void {
2228 let activeThemeName : string = Config . theme ;
2329 if (
@@ -85,7 +91,7 @@ export async function fillPresetButtons(): Promise<void> {
8591 activeThemeName = ThemeController . randomTheme ;
8692 }
8793
88- const themes = ThemesListSorted ;
94+ const themes = sortedThemes ;
8995
9096 //first show favourites
9197 if ( Config . favThemes . length > 0 ) {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
2626 getActiveFunboxesWithFunction ,
2727 getActiveFunboxNames ,
2828} from "../../test/funbox/list" ;
29+ import { Keycode } from "../../constants/keys" ;
2930
3031export async function handleTab ( e : KeyboardEvent , now : number ) : Promise < void > {
3132 if ( Config . quickRestart === "tab" ) {
@@ -122,7 +123,7 @@ export async function handleOppositeShift(event: KeyboardEvent): Promise<void> {
122123 ) ;
123124 } else {
124125 setCorrectShiftUsed (
125- ShiftTracker . isUsingOppositeShift ( event . code as KeyConverter . Keycode ) ,
126+ ShiftTracker . isUsingOppositeShift ( event . code as Keycode ) ,
126127 ) ;
127128 }
128129}
Original file line number Diff line number Diff line change 11import Ape from "../ape" ;
22import Page from "./page" ;
33import * as Skeleton from "../utils/skeleton" ;
4- import TypoList from "../utils /typo-list" ;
4+ import TypoList from "../constants /typo-list" ;
55import {
66 PasswordSchema ,
77 UserEmailSchema ,
You can’t perform that action at this time.
0 commit comments