diff options
author | Pauline <git@ethanlibs.co> | 2023-10-14 22:27:27 -0400 |
---|---|---|
committer | Pauline <git@ethanlibs.co> | 2023-10-14 22:27:27 -0400 |
commit | 2582162cea2b3a59cd21c78f8b73cb03d0acad40 (patch) | |
tree | 432057475f3b51850a85e2cba9969bcb79f3a8e6 /packages/ui/src/keys.ts | |
parent | 06f51ccdc496a6581d098edc424f3973e550221d (diff) | |
download | Nexus-2582162cea2b3a59cd21c78f8b73cb03d0acad40.tar.gz Nexus-2582162cea2b3a59cd21c78f8b73cb03d0acad40.tar.bz2 Nexus-2582162cea2b3a59cd21c78f8b73cb03d0acad40.zip |
refactor(trunk): refactor the entire project idk
Diffstat (limited to 'packages/ui/src/keys.ts')
-rw-r--r-- | packages/ui/src/keys.ts | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/packages/ui/src/keys.ts b/packages/ui/src/keys.ts new file mode 100644 index 0000000..55940f9 --- /dev/null +++ b/packages/ui/src/keys.ts @@ -0,0 +1,56 @@ +export enum ModifierKeys { + Alt = 'Alt', + Shift = 'Shift', + AltGraph = 'AltGraph', + CapsLock = 'CapsLock', + Control = 'Control', + Fn = 'Fn', + FnLock = 'FnLock', + Meta = 'Meta', + NumLock = 'NumLock', + ScrollLock = 'ScrollLock', + Symbol = 'Symbol', + SymbolLock = 'SymbolLock' +} + +export type OSforKeys = 'macOS' | 'Windows' | 'Other'; + +export const modifierSymbols: Record< + ModifierKeys, + { macOS?: string; Windows?: string; Other: string } +> = { + Alt: { macOS: '⌥', Other: 'Alt' }, + AltGraph: { macOS: '⌥', Other: 'Alt' }, + CapsLock: { Other: '⇪' }, + Control: { macOS: '⌃', Other: 'Ctrl' }, + Fn: { macOS: 'fn', Other: 'Fn' }, + FnLock: { macOS: 'fn', Other: 'Fn' }, + Meta: { macOS: '⌘', Windows: '⊞ Win', Other: 'Meta' }, + NumLock: { macOS: '⇭', Other: 'Num' }, + ScrollLock: { macOS: '⤓', Other: 'ScrLk' }, + Shift: { Other: 'Shift', macOS: '⇧' }, + Symbol: { macOS: '⎄', Other: 'Sym' }, + SymbolLock: { macOS: '⎄', Other: 'Sym' } +}; + +export const keySymbols: Record<string, { macOS?: string; Windows?: string; Other: string }> = { + ' ': { Other: '␣' }, + 'Tab': { macOS: '⇥', Other: '⭾' }, + 'Enter': { macOS: '↩', Other: '↵' }, + 'Escape': { macOS: '⎋', Other: 'Esc' }, + 'Backspace': { macOS: '⌫', Other: '⟵' }, + 'ArrowUp': { Other: '↑' }, + 'ArrowDown': { Other: '↓' }, + 'ArrowLeft': { Other: '←' }, + 'ArrowRight': { Other: '→' }, + 'Insert': { Other: 'Ins' }, + 'Delete': { macOS: '⌦', Other: 'Del' }, + 'Home': { macOS: '↖', Other: 'Home' }, + 'End': { macOS: '↘', Other: 'End' }, + 'PageUp': { macOS: '⇞', Other: 'PgUp' }, + 'PageDown': { macOS: '⇟', Other: 'PgDn' }, + 'Shift': { macOS: '⇧', Other: 'Shift' }, + 'PrintScreen': { Other: 'PrtSc' }, + 'ScrollLock': { macOS: '⤓', Other: 'ScrLk' }, + 'Pause': { macOS: '⎉', Other: 'Pause' } +}; |