Line data Source code
1 : import { z } from 'zod'
2 :
3 38 : const zKeyCombo = z.object({
4 : key: z.string(),
5 : ctrl: z.boolean().optional(),
6 : alt: z.boolean().optional(),
7 : shift: z.boolean().optional(),
8 : meta: z.boolean().optional()
9 : })
10 :
11 38 : const zKeybinding = z.object({
12 : commandId: z.string(),
13 : combo: zKeyCombo,
14 : targetElementId: z.string().optional()
15 : })
16 :
17 38 : export const zKeybindingPreset = z.object({
18 : name: z.string().trim().min(1, 'Preset name cannot be empty'),
19 : newBindings: z.array(zKeybinding),
20 : unsetBindings: z.array(zKeybinding)
21 : })
22 :
23 : export type KeyCombo = z.infer<typeof zKeyCombo>
24 : export type Keybinding = z.infer<typeof zKeybinding>
25 : export type KeybindingPreset = z.infer<typeof zKeybindingPreset>
|