()
| 12 | import './index.css' |
| 13 | |
| 14 | function App() { |
| 15 | const [lastHotkey, setLastHotkey] = createSignal<Hotkey | null>(null) |
| 16 | const [saveCount, setSaveCount] = createSignal(0) |
| 17 | const [incrementCount, setIncrementCount] = createSignal(0) |
| 18 | const [enabled, setEnabled] = createSignal(true) |
| 19 | const [activeTab, setActiveTab] = createSignal(1) |
| 20 | const [navigationCount, setNavigationCount] = createSignal(0) |
| 21 | const [functionKeyCount, setFunctionKeyCount] = createSignal(0) |
| 22 | const [multiModifierCount, setMultiModifierCount] = createSignal(0) |
| 23 | const [editingKeyCount, setEditingKeyCount] = createSignal(0) |
| 24 | |
| 25 | const [modalOpen, setModalOpen] = createSignal(false) |
| 26 | const [editorContent, setEditorContent] = createSignal('') |
| 27 | const [sidebarShortcutCount, setSidebarShortcutCount] = createSignal(0) |
| 28 | const [modalShortcutCount, setModalShortcutCount] = createSignal(0) |
| 29 | const [editorShortcutCount, setEditorShortcutCount] = createSignal(0) |
| 30 | |
| 31 | const [sidebarRef, setSidebarRef] = createSignal<HTMLDivElement | null>(null) |
| 32 | const [modalRef, setModalRef] = createSignal<HTMLDivElement | null>(null) |
| 33 | const [editorRef, setEditorRef] = createSignal<HTMLTextAreaElement | null>( |
| 34 | null, |
| 35 | ) |
| 36 | |
| 37 | createHotkey('Mod+S', (_event, { hotkey, parsedHotkey }) => { |
| 38 | setLastHotkey(hotkey) |
| 39 | setSaveCount((c) => c + 1) |
| 40 | console.log('Hotkey triggered:', hotkey) |
| 41 | console.log('Parsed hotkey:', parsedHotkey) |
| 42 | }) |
| 43 | |
| 44 | createHotkey( |
| 45 | 'Mod+K', |
| 46 | (_event, { hotkey }) => { |
| 47 | setLastHotkey(hotkey) |
| 48 | setIncrementCount((c) => c + 1) |
| 49 | }, |
| 50 | { requireReset: true }, |
| 51 | ) |
| 52 | |
| 53 | createHotkey( |
| 54 | 'Mod+E', |
| 55 | (_event, { hotkey }) => { |
| 56 | setLastHotkey(hotkey) |
| 57 | alert('This hotkey can be toggled!') |
| 58 | }, |
| 59 | () => ({ enabled: enabled() }), |
| 60 | ) |
| 61 | |
| 62 | createHotkey('Mod+1', () => { |
| 63 | setLastHotkey('Mod+1') |
| 64 | setActiveTab(1) |
| 65 | }) |
| 66 | createHotkey('Mod+2', () => { |
| 67 | setLastHotkey('Mod+2') |
| 68 | setActiveTab(2) |
| 69 | }) |
| 70 | createHotkey('Mod+3', () => { |
| 71 | setLastHotkey('Mod+3') |
nothing calls this directly
no test coverage detected