| 12 | templateUrl: './app.component.html', |
| 13 | }) |
| 14 | export class AppComponent { |
| 15 | protected readonly lastHotkey = signal<Hotkey | null>(null) |
| 16 | protected readonly saveCount = signal(0) |
| 17 | protected readonly incrementCount = signal(0) |
| 18 | protected readonly enabled = signal(true) |
| 19 | protected readonly activeTab = signal(1) |
| 20 | protected readonly navigationCount = signal(0) |
| 21 | protected readonly functionKeyCount = signal(0) |
| 22 | protected readonly multiModifierCount = signal(0) |
| 23 | protected readonly editingKeyCount = signal(0) |
| 24 | |
| 25 | protected readonly modalOpen = signal(false) |
| 26 | protected readonly editorContent = signal('') |
| 27 | protected readonly sidebarShortcutCount = signal(0) |
| 28 | protected readonly modalShortcutCount = signal(0) |
| 29 | protected readonly editorShortcutCount = signal(0) |
| 30 | |
| 31 | private readonly sidebarRef = |
| 32 | viewChild<ElementRef<HTMLDivElement>>('sidebarRef') |
| 33 | private readonly modalRef = viewChild<ElementRef<HTMLDivElement>>('modalRef') |
| 34 | private readonly editorRef = |
| 35 | viewChild<ElementRef<HTMLTextAreaElement>>('editorRef') |
| 36 | |
| 37 | constructor() { |
| 38 | injectHotkey('Mod+S', (_event, { hotkey }) => { |
| 39 | this.lastHotkey.set(hotkey) |
| 40 | this.saveCount.update((c) => c + 1) |
| 41 | }) |
| 42 | |
| 43 | injectHotkey( |
| 44 | 'Mod+K', |
| 45 | (_event, { hotkey }) => { |
| 46 | this.lastHotkey.set(hotkey) |
| 47 | this.incrementCount.update((c) => c + 1) |
| 48 | }, |
| 49 | { requireReset: true }, |
| 50 | ) |
| 51 | |
| 52 | injectHotkey( |
| 53 | 'Mod+E', |
| 54 | (_event, { hotkey }) => { |
| 55 | this.lastHotkey.set(hotkey) |
| 56 | alert('This hotkey can be toggled!') |
| 57 | }, |
| 58 | () => ({ enabled: this.enabled() }), |
| 59 | ) |
| 60 | |
| 61 | injectHotkey('Mod+1', () => { |
| 62 | this.lastHotkey.set('Mod+1') |
| 63 | this.activeTab.set(1) |
| 64 | }) |
| 65 | injectHotkey('Mod+2', () => { |
| 66 | this.lastHotkey.set('Mod+2') |
| 67 | this.activeTab.set(2) |
| 68 | }) |
| 69 | injectHotkey('Mod+3', () => { |
| 70 | this.lastHotkey.set('Mod+3') |
| 71 | this.activeTab.set(3) |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…