ngx-keys 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ngx-keys.mjs +60 -3
- package/fesm2022/ngx-keys.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2022/ngx-keys.mjs
CHANGED
|
@@ -489,6 +489,32 @@ class KeyboardShortcuts {
|
|
|
489
489
|
if (newShortcut.macSteps && existing.macSteps && this.stepsMatch(newShortcut.macSteps, existing.macSteps)) {
|
|
490
490
|
return existing.id;
|
|
491
491
|
}
|
|
492
|
+
// Check if new single-step shortcut conflicts with first step of existing multi-step shortcut
|
|
493
|
+
if (newShortcut.keys && existing.steps) {
|
|
494
|
+
const firstStep = existing.steps[FIRST_INDEX];
|
|
495
|
+
if (firstStep && this.keysMatch(newShortcut.keys, firstStep)) {
|
|
496
|
+
return existing.id;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
if (newShortcut.macKeys && existing.macSteps) {
|
|
500
|
+
const firstStep = existing.macSteps[FIRST_INDEX];
|
|
501
|
+
if (firstStep && this.keysMatch(newShortcut.macKeys, firstStep)) {
|
|
502
|
+
return existing.id;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
// Check if new multi-step shortcut's first step conflicts with existing single-step shortcut
|
|
506
|
+
if (newShortcut.steps && existing.keys) {
|
|
507
|
+
const firstStep = newShortcut.steps[FIRST_INDEX];
|
|
508
|
+
if (firstStep && this.keysMatch(firstStep, existing.keys)) {
|
|
509
|
+
return existing.id;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (newShortcut.macSteps && existing.macKeys) {
|
|
513
|
+
const firstStep = newShortcut.macSteps[FIRST_INDEX];
|
|
514
|
+
if (firstStep && this.keysMatch(firstStep, existing.macKeys)) {
|
|
515
|
+
return existing.id;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
492
518
|
}
|
|
493
519
|
return null;
|
|
494
520
|
}
|
|
@@ -500,7 +526,7 @@ class KeyboardShortcuts {
|
|
|
500
526
|
const shortcut = this.shortcuts.get(shortcutId);
|
|
501
527
|
if (!shortcut)
|
|
502
528
|
return [];
|
|
503
|
-
const
|
|
529
|
+
const conflictsSet = new Set();
|
|
504
530
|
for (const existing of this.shortcuts.values()) {
|
|
505
531
|
// Skip self and inactive shortcuts
|
|
506
532
|
if (existing.id === shortcutId || !this.activeShortcuts.has(existing.id)) {
|
|
@@ -511,10 +537,41 @@ class KeyboardShortcuts {
|
|
|
511
537
|
(shortcut.macKeys && existing.macKeys && this.keysMatch(shortcut.macKeys, existing.macKeys)) ||
|
|
512
538
|
(shortcut.steps && existing.steps && this.stepsMatch(shortcut.steps, existing.steps)) ||
|
|
513
539
|
(shortcut.macSteps && existing.macSteps && this.stepsMatch(shortcut.macSteps, existing.macSteps))) {
|
|
514
|
-
|
|
540
|
+
conflictsSet.add(existing.id);
|
|
541
|
+
continue; // Skip further checks for this shortcut to avoid duplicate adds
|
|
542
|
+
}
|
|
543
|
+
// Check if shortcut's single-step conflicts with first step of existing multi-step shortcut
|
|
544
|
+
if (shortcut.keys && existing.steps) {
|
|
545
|
+
const firstStep = existing.steps[FIRST_INDEX];
|
|
546
|
+
if (firstStep && this.keysMatch(shortcut.keys, firstStep)) {
|
|
547
|
+
conflictsSet.add(existing.id);
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (shortcut.macKeys && existing.macSteps) {
|
|
552
|
+
const firstStep = existing.macSteps[FIRST_INDEX];
|
|
553
|
+
if (firstStep && this.keysMatch(shortcut.macKeys, firstStep)) {
|
|
554
|
+
conflictsSet.add(existing.id);
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
// Check if shortcut's multi-step first step conflicts with existing single-step shortcut
|
|
559
|
+
if (shortcut.steps && existing.keys) {
|
|
560
|
+
const firstStep = shortcut.steps[FIRST_INDEX];
|
|
561
|
+
if (firstStep && this.keysMatch(firstStep, existing.keys)) {
|
|
562
|
+
conflictsSet.add(existing.id);
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
if (shortcut.macSteps && existing.macKeys) {
|
|
567
|
+
const firstStep = shortcut.macSteps[FIRST_INDEX];
|
|
568
|
+
if (firstStep && this.keysMatch(firstStep, existing.macKeys)) {
|
|
569
|
+
conflictsSet.add(existing.id);
|
|
570
|
+
continue;
|
|
571
|
+
}
|
|
515
572
|
}
|
|
516
573
|
}
|
|
517
|
-
return
|
|
574
|
+
return Array.from(conflictsSet);
|
|
518
575
|
}
|
|
519
576
|
/**
|
|
520
577
|
* Register a single keyboard shortcut
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-keys.mjs","sources":["../../../projects/ngx-keys/src/lib/errors/keyboard-shortcuts.errors.ts","../../../projects/ngx-keys/src/lib/config/keyboard-shortcuts.config.ts","../../../projects/ngx-keys/src/lib/core/utils/key-matcher.ts","../../../projects/ngx-keys/src/lib/core/keyboard-shortcuts.service.ts","../../../projects/ngx-keys/src/lib/directives/keyboard-shortcut.directive.ts","../../../projects/ngx-keys/src/public-api.ts","../../../projects/ngx-keys/src/ngx-keys.ts"],"sourcesContent":["/**\n * Centralized error messages for keyboard shortcuts service\n * This ensures consistency across the application and makes testing easier\n */\nexport const KeyboardShortcutsErrors = {\n // Registration errors\n SHORTCUT_ALREADY_REGISTERED: (id: string) => `Shortcut \"${id}\" already registered`,\n GROUP_ALREADY_REGISTERED: (id: string) => `Group \"${id}\" already registered`,\n KEY_CONFLICT: (conflictId: string) => `Key conflict with \"${conflictId}\"`,\n ACTIVE_KEY_CONFLICT: (conflictId: string) => `Key conflict with active shortcut \"${conflictId}\"`,\n ACTIVATION_KEY_CONFLICT: (shortcutId: string, conflictIds: string[]) => `Cannot activate \"${shortcutId}\": would conflict with active shortcuts: ${conflictIds.join(', ')}`,\n GROUP_ACTIVATION_KEY_CONFLICT: (groupId: string, conflictIds: string[]) => `Cannot activate group \"${groupId}\": would conflict with active shortcuts: ${conflictIds.join(', ')}`,\n SHORTCUT_IDS_ALREADY_REGISTERED: (ids: string[]) => `Shortcut IDs already registered: ${ids.join(', ')}`,\n DUPLICATE_SHORTCUTS_IN_GROUP: (ids: string[]) => `Duplicate shortcuts in group: ${ids.join(', ')}`,\n KEY_CONFLICTS_IN_GROUP: (conflicts: string[]) => `Key conflicts: ${conflicts.join(', ')}`,\n \n // Operation errors\n SHORTCUT_NOT_REGISTERED: (id: string) => `Shortcut \"${id}\" not registered`,\n GROUP_NOT_REGISTERED: (id: string) => `Group \"${id}\" not registered`,\n \n // Activation/Deactivation errors\n CANNOT_ACTIVATE_SHORTCUT: (id: string) => `Cannot activate shortcut \"${id}\": not registered`,\n CANNOT_DEACTIVATE_SHORTCUT: (id: string) => `Cannot deactivate shortcut \"${id}\": not registered`,\n CANNOT_ACTIVATE_GROUP: (id: string) => `Cannot activate group \"${id}\": not registered`,\n CANNOT_DEACTIVATE_GROUP: (id: string) => `Cannot deactivate group \"${id}\": not registered`,\n \n // Unregistration errors\n CANNOT_UNREGISTER_SHORTCUT: (id: string) => `Cannot unregister shortcut \"${id}\": not registered`,\n CANNOT_UNREGISTER_GROUP: (id: string) => `Cannot unregister group \"${id}\": not registered`,\n} as const;\n\n/**\n * Error types for type safety\n */\nexport type KeyboardShortcutsErrorType = keyof typeof KeyboardShortcutsErrors;\n\n/**\n * Custom error class for keyboard shortcuts\n */\nexport class KeyboardShortcutError extends Error {\n constructor(\n public readonly errorType: KeyboardShortcutsErrorType,\n message: string,\n public readonly context?: Record<string, any>\n ) {\n super(message);\n this.name = 'KeyboardShortcutError';\n }\n}\n\n/**\n * Error factory for creating consistent errors\n */\nexport class KeyboardShortcutsErrorFactory {\n static shortcutAlreadyRegistered(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'SHORTCUT_ALREADY_REGISTERED',\n KeyboardShortcutsErrors.SHORTCUT_ALREADY_REGISTERED(id),\n { shortcutId: id }\n );\n }\n\n static groupAlreadyRegistered(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'GROUP_ALREADY_REGISTERED',\n KeyboardShortcutsErrors.GROUP_ALREADY_REGISTERED(id),\n { groupId: id }\n );\n }\n\n static keyConflict(conflictId: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'KEY_CONFLICT',\n KeyboardShortcutsErrors.KEY_CONFLICT(conflictId),\n { conflictId }\n );\n }\n\n static activeKeyConflict(conflictId: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'ACTIVE_KEY_CONFLICT',\n KeyboardShortcutsErrors.ACTIVE_KEY_CONFLICT(conflictId),\n { conflictId }\n );\n }\n\n static activationKeyConflict(shortcutId: string, conflictIds: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'ACTIVATION_KEY_CONFLICT',\n KeyboardShortcutsErrors.ACTIVATION_KEY_CONFLICT(shortcutId, conflictIds),\n { shortcutId, conflictIds }\n );\n }\n\n static groupActivationKeyConflict(groupId: string, conflictIds: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'GROUP_ACTIVATION_KEY_CONFLICT',\n KeyboardShortcutsErrors.GROUP_ACTIVATION_KEY_CONFLICT(groupId, conflictIds),\n { groupId, conflictIds }\n );\n }\n\n static shortcutIdsAlreadyRegistered(ids: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'SHORTCUT_IDS_ALREADY_REGISTERED',\n KeyboardShortcutsErrors.SHORTCUT_IDS_ALREADY_REGISTERED(ids),\n { duplicateIds: ids }\n );\n }\n\n static duplicateShortcutsInGroup(ids: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'DUPLICATE_SHORTCUTS_IN_GROUP',\n KeyboardShortcutsErrors.DUPLICATE_SHORTCUTS_IN_GROUP(ids),\n { duplicateIds: ids }\n );\n }\n\n static keyConflictsInGroup(conflicts: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'KEY_CONFLICTS_IN_GROUP',\n KeyboardShortcutsErrors.KEY_CONFLICTS_IN_GROUP(conflicts),\n { conflicts }\n );\n }\n\n static shortcutNotRegistered(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'SHORTCUT_NOT_REGISTERED',\n KeyboardShortcutsErrors.SHORTCUT_NOT_REGISTERED(id),\n { shortcutId: id }\n );\n }\n\n static groupNotRegistered(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'GROUP_NOT_REGISTERED',\n KeyboardShortcutsErrors.GROUP_NOT_REGISTERED(id),\n { groupId: id }\n );\n }\n\n static cannotActivateShortcut(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_ACTIVATE_SHORTCUT',\n KeyboardShortcutsErrors.CANNOT_ACTIVATE_SHORTCUT(id),\n { shortcutId: id }\n );\n }\n\n static cannotDeactivateShortcut(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_DEACTIVATE_SHORTCUT',\n KeyboardShortcutsErrors.CANNOT_DEACTIVATE_SHORTCUT(id),\n { shortcutId: id }\n );\n }\n\n static cannotActivateGroup(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_ACTIVATE_GROUP',\n KeyboardShortcutsErrors.CANNOT_ACTIVATE_GROUP(id),\n { groupId: id }\n );\n }\n\n static cannotDeactivateGroup(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_DEACTIVATE_GROUP',\n KeyboardShortcutsErrors.CANNOT_DEACTIVATE_GROUP(id),\n { groupId: id }\n );\n }\n\n static cannotUnregisterShortcut(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_UNREGISTER_SHORTCUT',\n KeyboardShortcutsErrors.CANNOT_UNREGISTER_SHORTCUT(id),\n { shortcutId: id }\n );\n }\n\n static cannotUnregisterGroup(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_UNREGISTER_GROUP',\n KeyboardShortcutsErrors.CANNOT_UNREGISTER_GROUP(id),\n { groupId: id }\n );\n }\n}\n","import { InjectionToken, Provider } from '@angular/core';\n\n/**\n * Configuration options for the KeyboardShortcuts service.\n */\nexport interface KeyboardShortcutsConfig {\n // Reserved for future configuration options\n}\n\n/**\n * Injection token for providing KeyboardShortcuts configuration.\n * \n * @example\n * ```typescript\n * providers: [\n * provideKeyboardShortcutsConfig({ sequenceTimeoutMs: Infinity })\n * ]\n * ```\n */\nexport const KEYBOARD_SHORTCUTS_CONFIG = new InjectionToken<KeyboardShortcutsConfig>(\n 'KEYBOARD_SHORTCUTS_CONFIG',\n {\n providedIn: 'root',\n factory: () => ({})\n }\n);\n\n/**\n * Provides KeyboardShortcuts configuration using Angular's modern provider pattern.\n * \n * @param config - Configuration options for KeyboardShortcuts service\n * @returns Provider array for use in Angular dependency injection\n * \n * @example\n * ```typescript\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideKeyboardShortcutsConfig({ sequenceTimeoutMs: Infinity })\n * ]\n * });\n * ```\n */\nexport function provideKeyboardShortcutsConfig(config: KeyboardShortcutsConfig): Provider[] {\n return [{ provide: KEYBOARD_SHORTCUTS_CONFIG, useValue: config }];\n}\n\n/**\n * Initial version number for state change detection.\n * Used internally to track state updates efficiently.\n * @internal\n */\nexport const INITIAL_STATE_VERSION = 0;\n\n/**\n * Increment value for state version updates.\n * @internal\n */\nexport const STATE_VERSION_INCREMENT = 1;\n\n/**\n * Index of the first element in an array.\n * Used for readability when checking array structure.\n * @internal\n */\nexport const FIRST_INDEX = 0;\n\n/**\n * Index representing the first step in a multi-step sequence.\n * @internal\n */\nexport const FIRST_STEP_INDEX = 0;\n\n/**\n * Index representing the second step in a multi-step sequence (after first step completes).\n * @internal\n */\nexport const SECOND_STEP_INDEX = 1;\n\n/**\n * Threshold for determining if a shortcut is a single-step sequence.\n * @internal\n */\nexport const SINGLE_STEP_LENGTH = 1;\n\n/**\n * Minimum count indicating that at least one item exists.\n * @internal\n */\nexport const MIN_COUNT_ONE = 1;\n\n/**\n * Minimum length for a valid key string.\n * @internal\n */\nexport const MIN_KEY_LENGTH = 0;\n","/**\n * Utility class for keyboard shortcut key matching and normalization.\n * Provides methods for comparing key combinations and normalizing key input.\n */\nexport class KeyMatcher {\n private static readonly MODIFIER_KEYS = new Set(['ctrl', 'control', 'alt', 'shift', 'meta']);\n\n /**\n * Normalize a key string to lowercase for consistent comparison.\n * \n * @param key - The key string to normalize\n * @returns The normalized (lowercase) key string\n * \n * @example\n * ```typescript\n * KeyMatcher.normalizeKey('Ctrl'); // returns 'ctrl'\n * KeyMatcher.normalizeKey('A'); // returns 'a'\n * ```\n */\n static normalizeKey(key: string): string {\n return key.toLowerCase();\n }\n\n /**\n * Check if a key is a modifier key (ctrl, alt, shift, meta).\n * \n * @param key - The key to check\n * @returns true if the key is a modifier key\n * \n * @example\n * ```typescript\n * KeyMatcher.isModifierKey('ctrl'); // returns true\n * KeyMatcher.isModifierKey('a'); // returns false\n * ```\n */\n static isModifierKey(key: string): boolean {\n return this.MODIFIER_KEYS.has(key.toLowerCase());\n }\n\n /**\n * Compare two key combinations for equality.\n * Supports both Set<string> and string[] as input.\n * Keys are normalized (lowercased) before comparison.\n * \n * @param a - First key combination (Set or array)\n * @param b - Second key combination (array)\n * @returns true if both combinations contain the same keys\n * \n * @example\n * ```typescript\n * KeyMatcher.keysMatch(['ctrl', 's'], ['ctrl', 's']); // returns true\n * KeyMatcher.keysMatch(['ctrl', 's'], ['Ctrl', 'S']); // returns true (normalized)\n * KeyMatcher.keysMatch(['ctrl', 's'], ['alt', 's']); // returns false\n * ```\n */\n static keysMatch(a: Set<string> | string[], b: string[]): boolean {\n const setA = a instanceof Set ? a : this.normalizeKeysToSet(a);\n const setB = this.normalizeKeysToSet(b);\n\n if (setA.size !== setB.size) {\n return false;\n }\n\n for (const key of setA) {\n if (!setB.has(key)) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Compare two multi-step sequences for equality.\n * Each sequence is an array of steps, where each step is an array of keys.\n * \n * @param a - First multi-step sequence\n * @param b - Second multi-step sequence\n * @returns true if both sequences are identical\n * \n * @example\n * ```typescript\n * const seq1 = [['ctrl', 'k'], ['s']];\n * const seq2 = [['ctrl', 'k'], ['s']];\n * KeyMatcher.stepsMatch(seq1, seq2); // returns true\n * \n * const seq3 = [['ctrl', 'k'], ['t']];\n * KeyMatcher.stepsMatch(seq1, seq3); // returns false (different final step)\n * ```\n */\n static stepsMatch(a: string[][], b: string[][]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0; i < a.length; i++) {\n if (!this.keysMatch(a[i], b[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Normalize an array of keys to a Set of lowercase keys.\n * \n * @param keys - Array of keys to normalize\n * @returns Set of normalized (lowercase) keys\n * \n * @internal\n */\n private static normalizeKeysToSet(keys: string[]): Set<string> {\n return new Set(keys.map(k => k.toLowerCase()));\n }\n\n /**\n * Get the set of modifier key names.\n * Useful for filtering or checking if a key is a modifier.\n * \n * @returns ReadonlySet of modifier key names\n * \n * @example\n * ```typescript\n * const modifiers = KeyMatcher.getModifierKeys();\n * console.log(modifiers.has('ctrl')); // true\n * console.log(modifiers.has('a')); // false\n * ```\n */\n static getModifierKeys(): ReadonlySet<string> {\n return this.MODIFIER_KEYS;\n }\n}\n","import {\n afterNextRender,\n computed,\n DestroyRef,\n DOCUMENT,\n inject,\n Injectable,\n OnDestroy,\n signal,\n} from '@angular/core';\nimport { KeyboardShortcut, KeyboardShortcutActiveUntil, KeyboardShortcutFilter, KeyboardShortcutGroup, KeyboardShortcutGroupOptions, KeyboardShortcutUI, KeyStep } from '../models/keyboard-shortcut.interface'\nimport { KeyboardShortcutsErrorFactory } from '../errors/keyboard-shortcuts.errors';\nimport { Observable, take } from 'rxjs';\nimport {\n INITIAL_STATE_VERSION,\n STATE_VERSION_INCREMENT,\n FIRST_INDEX,\n FIRST_STEP_INDEX,\n SECOND_STEP_INDEX,\n SINGLE_STEP_LENGTH,\n MIN_COUNT_ONE,\n MIN_KEY_LENGTH,\n KEYBOARD_SHORTCUTS_CONFIG\n} from '../config/keyboard-shortcuts.config';\nimport { KeyMatcher } from './utils/key-matcher';\n\n/**\n * Type guard to detect KeyboardShortcutGroupOptions at runtime.\n * Centralising this logic keeps registerGroup simpler and less fragile.\n */\nfunction isGroupOptions(param: unknown): param is KeyboardShortcutGroupOptions {\n if (!param || typeof param !== 'object') return false;\n // Narrow to object for property checks\n const obj = param as Record<string, unknown>;\n return ('filter' in obj) || ('activeUntil' in obj);\n}\n\n/**\n * Detect real DestroyRef instances or duck-typed objects exposing onDestroy(fn).\n * Returns true for either an actual DestroyRef or an object with an onDestroy method.\n */\nfunction isDestroyRefLike(obj: unknown): obj is DestroyRef & { onDestroy: (fn: () => void) => void } {\n if (!obj || typeof obj !== 'object') return false;\n try {\n // Prefer instanceof when available (real DestroyRef)\n if (obj instanceof DestroyRef) return true;\n } catch {\n // instanceof may throw if DestroyRef is not constructable in certain runtimes/tests\n }\n\n const o = obj as Record<string, unknown>;\n return typeof o['onDestroy'] === 'function';\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class KeyboardShortcuts implements OnDestroy {\n private readonly document = inject(DOCUMENT);\n private readonly window = this.document.defaultView!;\n private readonly config = inject(KEYBOARD_SHORTCUTS_CONFIG);\n\n private readonly shortcuts = new Map<string, KeyboardShortcut>();\n private readonly groups = new Map<string, KeyboardShortcutGroup>();\n private readonly activeShortcuts = new Set<string>();\n private readonly activeGroups = new Set<string>();\n private readonly currentlyDownKeys = new Set<string>();\n // O(1) lookup from shortcutId to its groupId to avoid scanning all groups per event\n private readonly shortcutToGroup = new Map<string, string>();\n\n /**\n * Named global filters that apply to all shortcuts.\n * All global filters must return `true` for a shortcut to be processed.\n */\n private readonly globalFilters = new Map<string, KeyboardShortcutFilter>();\n\n // Single consolidated state signal - reduces memory overhead\n private readonly state = signal({\n shortcuts: new Map<string, KeyboardShortcut>(),\n groups: new Map<string, KeyboardShortcutGroup>(),\n activeShortcuts: new Set<string>(),\n activeGroups: new Set<string>(),\n version: INITIAL_STATE_VERSION // for change detection optimization\n });\n\n // Primary computed signal - consumers derive what they need from this\n readonly shortcuts$ = computed(() => {\n const state = this.state();\n const activeShortcuts = Array.from(state.activeShortcuts)\n .map(id => state.shortcuts.get(id))\n .filter((s): s is KeyboardShortcut => s !== undefined);\n\n const inactiveShortcuts = Array.from(state.shortcuts.values())\n .filter(s => !state.activeShortcuts.has(s.id));\n\n return {\n active: activeShortcuts,\n inactive: inactiveShortcuts,\n all: Array.from(state.shortcuts.values()),\n groups: {\n active: Array.from(state.activeGroups),\n inactive: Array.from(state.groups.keys())\n .filter(id => !state.activeGroups.has(id))\n }\n };\n });\n\n // Optional: Pre-formatted UI signal for components that need it\n readonly shortcutsUI$ = computed(() => {\n const shortcuts = this.shortcuts$();\n return {\n active: shortcuts.active.map(s => this.formatShortcutForUI(s)),\n inactive: shortcuts.inactive.map(s => this.formatShortcutForUI(s)),\n all: shortcuts.all.map(s => this.formatShortcutForUI(s))\n };\n });\n\n private readonly keydownListener = this.handleKeydown.bind(this);\n private readonly keyupListener = this.handleKeyup.bind(this);\n private readonly blurListener = this.handleWindowBlur.bind(this);\n private readonly visibilityListener = this.handleVisibilityChange.bind(this);\n private isListening = false;\n\n /** Runtime state for multi-step sequences */\n private pendingSequence: {\n shortcutId: string;\n stepIndex: number;\n timerId: any | null;\n } | null = null;\n\n constructor() {\n afterNextRender(() => {\n this.startListening();\n });\n }\n\n ngOnDestroy(): void {\n this.stopListening();\n }\n\n /**\n * Batch updates and increment version for change detection\n */\n private updateState(): void {\n this.state.update(current => ({\n shortcuts: new Map(this.shortcuts),\n groups: new Map(this.groups),\n activeShortcuts: new Set(this.activeShortcuts),\n activeGroups: new Set(this.activeGroups),\n version: current.version + STATE_VERSION_INCREMENT\n }));\n }\n\n /**\n * Utility method for UI formatting\n */\n formatShortcutForUI(shortcut: KeyboardShortcut): KeyboardShortcutUI {\n return {\n id: shortcut.id,\n keys: this.formatStepsForDisplay(shortcut.keys ?? shortcut.steps ?? [], false),\n macKeys: this.formatStepsForDisplay(shortcut.macKeys ?? shortcut.macSteps ?? [], true),\n description: shortcut.description\n };\n }\n\n /**\n * Utility method for batch operations - reduces signal updates\n */\n batchUpdate(operations: () => void): void {\n operations();\n this.updateState();\n }\n\n /**\n * Format keys for display with proper Unicode symbols\n */\n private formatKeysForDisplay(keys: string[], isMac = false): string {\n const keyMap: Record<string, string> = isMac ? {\n 'ctrl': '⌃',\n 'alt': '⌥',\n 'shift': '⇧',\n 'meta': '⌘',\n 'cmd': '⌘',\n 'command': '⌘'\n } : {\n 'ctrl': 'Ctrl',\n 'alt': 'Alt',\n 'shift': 'Shift',\n 'meta': 'Win'\n };\n\n return keys\n .map(key => keyMap[key.toLowerCase()] || key.toUpperCase())\n .join('+');\n }\n\n private formatStepsForDisplay(steps: string[] | string[][], isMac = false): string {\n if (!steps) return '';\n\n // If the first element is an array, assume steps is string[][]\n const normalized = this.normalizeToSteps(steps as KeyStep[] | string[]);\n if (normalized.length === MIN_KEY_LENGTH) return '';\n if (normalized.length === SINGLE_STEP_LENGTH) return this.formatKeysForDisplay(normalized[FIRST_INDEX], isMac);\n return normalized.map(step => this.formatKeysForDisplay(step, isMac)).join(', ');\n }\n\n private normalizeToSteps(input: KeyStep[] | string[]): KeyStep[] {\n if (!input) return [];\n // If first element is an array, assume already KeyStep[]\n if (Array.isArray(input[FIRST_INDEX])) {\n return input as KeyStep[];\n }\n // Single step array\n return [input as string[]];\n }\n\n /**\n * Check if a key combination is already registered by an active shortcut\n * @returns The ID of the conflicting active shortcut, or null if no active conflict\n */\n private findActiveConflict(newShortcut: KeyboardShortcut): string | null {\n for (const existing of this.shortcuts.values()) {\n // Only check conflicts with active shortcuts\n if (!this.activeShortcuts.has(existing.id)) {\n continue;\n }\n\n // Compare single-step shapes if provided\n if (newShortcut.keys && existing.keys && this.keysMatch(newShortcut.keys, existing.keys)) {\n return existing.id;\n }\n if (newShortcut.macKeys && existing.macKeys && this.keysMatch(newShortcut.macKeys, existing.macKeys)) {\n return existing.id;\n }\n\n // Compare multi-step shapes\n if (newShortcut.steps && existing.steps && this.stepsMatch(newShortcut.steps, existing.steps)) {\n return existing.id;\n }\n if (newShortcut.macSteps && existing.macSteps && this.stepsMatch(newShortcut.macSteps, existing.macSteps)) {\n return existing.id;\n }\n }\n return null;\n }\n\n /**\n * Check if activating a shortcut would create key conflicts with other active shortcuts\n * @returns Array of conflicting shortcut IDs that would be created by activation\n */\n private findActivationConflicts(shortcutId: string): string[] {\n const shortcut = this.shortcuts.get(shortcutId);\n if (!shortcut) return [];\n\n const conflicts: string[] = [];\n for (const existing of this.shortcuts.values()) {\n // Skip self and inactive shortcuts\n if (existing.id === shortcutId || !this.activeShortcuts.has(existing.id)) {\n continue;\n }\n\n // Check for key conflicts\n if ((shortcut.keys && existing.keys && this.keysMatch(shortcut.keys, existing.keys)) ||\n (shortcut.macKeys && existing.macKeys && this.keysMatch(shortcut.macKeys, existing.macKeys)) ||\n (shortcut.steps && existing.steps && this.stepsMatch(shortcut.steps, existing.steps)) ||\n (shortcut.macSteps && existing.macSteps && this.stepsMatch(shortcut.macSteps, existing.macSteps))) {\n conflicts.push(existing.id);\n }\n }\n return conflicts;\n }\n\n /**\n * Register a single keyboard shortcut\n * @throws KeyboardShortcutError if shortcut ID is already registered or if the shortcut would conflict with currently active shortcuts\n */\n register(shortcut: KeyboardShortcut): void {\n if (this.shortcuts.has(shortcut.id)) {\n throw KeyboardShortcutsErrorFactory.shortcutAlreadyRegistered(shortcut.id);\n }\n\n // Check for conflicts only with currently active shortcuts\n const conflictId = this.findActiveConflict(shortcut);\n if (conflictId) {\n throw KeyboardShortcutsErrorFactory.activeKeyConflict(conflictId);\n }\n\n this.shortcuts.set(shortcut.id, shortcut);\n this.activeShortcuts.add(shortcut.id);\n this.updateState();\n\n this.setupActiveUntil(\n shortcut.activeUntil,\n this.unregister.bind(this, shortcut.id),\n );\n }\n\n /**\n * Register multiple keyboard shortcuts as a group\n * @param groupId - Unique identifier for the group\n * @param shortcuts - Array of shortcuts to register as a group\n * @param options - Optional configuration including filter and activeUntil\n * @throws KeyboardShortcutError if group ID is already registered or if any shortcut ID or key combination conflicts\n */\n registerGroup(groupId: string, shortcuts: KeyboardShortcut[], options?: KeyboardShortcutGroupOptions): void;\n /**\n * @deprecated Use registerGroup(groupId, shortcuts, { activeUntil }) instead\n */\n registerGroup(groupId: string, shortcuts: KeyboardShortcut[], activeUntil?: KeyboardShortcutActiveUntil): void;\n registerGroup(groupId: string, shortcuts: KeyboardShortcut[], optionsOrActiveUntil?: KeyboardShortcutGroupOptions | KeyboardShortcutActiveUntil): void {\n // Parse parameters - support both old (activeUntil) and new (options) formats\n let options: KeyboardShortcutGroupOptions;\n if (isGroupOptions(optionsOrActiveUntil)) {\n // New format with options object\n options = optionsOrActiveUntil;\n } else {\n // Old format with just activeUntil parameter\n options = { activeUntil: optionsOrActiveUntil as KeyboardShortcutActiveUntil };\n }\n\n // Check if group ID already exists\n if (this.groups.has(groupId)) {\n throw KeyboardShortcutsErrorFactory.groupAlreadyRegistered(groupId);\n }\n \n // Check for duplicate shortcut IDs and key combination conflicts with active shortcuts\n const duplicateIds: string[] = [];\n const keyConflicts: string[] = [];\n shortcuts.forEach(shortcut => {\n if (this.shortcuts.has(shortcut.id)) {\n duplicateIds.push(shortcut.id);\n }\n const conflictId = this.findActiveConflict(shortcut);\n if (conflictId) {\n keyConflicts.push(`\"${shortcut.id}\" conflicts with active shortcut \"${conflictId}\"`);\n }\n });\n\n if (duplicateIds.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.shortcutIdsAlreadyRegistered(duplicateIds);\n }\n\n if (keyConflicts.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.keyConflictsInGroup(keyConflicts);\n }\n\n // Validate that all shortcuts have unique IDs within the group\n const groupIds = new Set<string>();\n const duplicatesInGroup: string[] = [];\n shortcuts.forEach(shortcut => {\n if (groupIds.has(shortcut.id)) {\n duplicatesInGroup.push(shortcut.id);\n } else {\n groupIds.add(shortcut.id);\n }\n });\n\n if (duplicatesInGroup.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.duplicateShortcutsInGroup(duplicatesInGroup);\n }\n\n // Use batch update to reduce signal updates\n this.batchUpdate(() => {\n const group: KeyboardShortcutGroup = {\n id: groupId,\n shortcuts,\n active: true,\n filter: options.filter\n };\n\n this.groups.set(groupId, group);\n this.activeGroups.add(groupId);\n\n // Register individual shortcuts\n shortcuts.forEach(shortcut => {\n this.shortcuts.set(shortcut.id, shortcut);\n this.activeShortcuts.add(shortcut.id);\n this.shortcutToGroup.set(shortcut.id, groupId);\n });\n });\n\n this.setupActiveUntil(\n options.activeUntil,\n this.unregisterGroup.bind(this, groupId),\n );\n }\n\n /**\n * Unregister a single keyboard shortcut\n * @throws KeyboardShortcutError if shortcut ID doesn't exist\n */\n unregister(shortcutId: string): void {\n if (!this.shortcuts.has(shortcutId)) {\n throw KeyboardShortcutsErrorFactory.cannotUnregisterShortcut(shortcutId);\n }\n\n this.shortcuts.delete(shortcutId);\n this.activeShortcuts.delete(shortcutId);\n this.shortcutToGroup.delete(shortcutId);\n this.updateState();\n }\n\n /**\n * Unregister a group of keyboard shortcuts\n * @throws KeyboardShortcutError if group ID doesn't exist\n */\n unregisterGroup(groupId: string): void {\n const group = this.groups.get(groupId);\n if (!group) {\n throw KeyboardShortcutsErrorFactory.cannotUnregisterGroup(groupId);\n }\n\n this.batchUpdate(() => {\n group.shortcuts.forEach(shortcut => {\n this.shortcuts.delete(shortcut.id);\n this.activeShortcuts.delete(shortcut.id);\n this.shortcutToGroup.delete(shortcut.id);\n });\n this.groups.delete(groupId);\n this.activeGroups.delete(groupId);\n });\n }\n\n\n\n /**\n * Activate a single keyboard shortcut\n * @throws KeyboardShortcutError if shortcut ID doesn't exist or if activation would create key conflicts\n */\n activate(shortcutId: string): void {\n if (!this.shortcuts.has(shortcutId)) {\n throw KeyboardShortcutsErrorFactory.cannotActivateShortcut(shortcutId);\n }\n\n // Check for conflicts that would be created by activation\n const conflicts = this.findActivationConflicts(shortcutId);\n if (conflicts.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.activationKeyConflict(shortcutId, conflicts);\n }\n\n this.activeShortcuts.add(shortcutId);\n this.updateState();\n }\n\n /**\n * Deactivate a single keyboard shortcut\n * @throws KeyboardShortcutError if shortcut ID doesn't exist\n */\n deactivate(shortcutId: string): void {\n if (!this.shortcuts.has(shortcutId)) {\n throw KeyboardShortcutsErrorFactory.cannotDeactivateShortcut(shortcutId);\n }\n\n this.activeShortcuts.delete(shortcutId);\n this.updateState();\n }\n\n /**\n * Activate a group of keyboard shortcuts\n * @throws KeyboardShortcutError if group ID doesn't exist or if activation would create key conflicts\n */\n activateGroup(groupId: string): void {\n const group = this.groups.get(groupId);\n if (!group) {\n throw KeyboardShortcutsErrorFactory.cannotActivateGroup(groupId);\n }\n\n // Check for conflicts that would be created by activating all shortcuts in the group\n const allConflicts: string[] = [];\n group.shortcuts.forEach(shortcut => {\n const conflicts = this.findActivationConflicts(shortcut.id);\n allConflicts.push(...conflicts);\n });\n\n if (allConflicts.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.groupActivationKeyConflict(groupId, allConflicts);\n }\n\n this.batchUpdate(() => {\n group.active = true;\n this.activeGroups.add(groupId);\n group.shortcuts.forEach(shortcut => {\n this.activeShortcuts.add(shortcut.id);\n });\n });\n }\n\n /**\n * Deactivate a group of keyboard shortcuts\n * @throws KeyboardShortcutError if group ID doesn't exist\n */\n deactivateGroup(groupId: string): void {\n const group = this.groups.get(groupId);\n if (!group) {\n throw KeyboardShortcutsErrorFactory.cannotDeactivateGroup(groupId);\n }\n\n this.batchUpdate(() => {\n group.active = false;\n this.activeGroups.delete(groupId);\n group.shortcuts.forEach(shortcut => {\n this.activeShortcuts.delete(shortcut.id);\n });\n });\n }\n\n /**\n * Check if a shortcut is active\n */\n isActive(shortcutId: string): boolean {\n return this.activeShortcuts.has(shortcutId);\n }\n\n /**\n * Check if a shortcut is registered\n */\n isRegistered(shortcutId: string): boolean {\n return this.shortcuts.has(shortcutId);\n }\n\n /**\n * Check if a group is active\n */\n isGroupActive(groupId: string): boolean {\n return this.activeGroups.has(groupId);\n }\n\n /**\n * Check if a group is registered\n */\n isGroupRegistered(groupId: string): boolean {\n return this.groups.has(groupId);\n }\n\n /**\n * Get all registered shortcuts\n */\n getShortcuts(): ReadonlyMap<string, KeyboardShortcut> {\n return this.shortcuts;\n }\n\n /**\n * Get all registered groups\n */\n getGroups(): ReadonlyMap<string, KeyboardShortcutGroup> {\n return this.groups;\n }\n\n /**\n * Add a named global filter that applies to all shortcuts.\n * All global filters must return `true` for a shortcut to execute.\n * \n * @param name - Unique name for this filter\n * @param filter - Function that returns `true` to allow shortcuts, `false` to block them\n * \n * @example\n * ```typescript\n * // Block shortcuts in form elements\n * keyboardService.addFilter('forms', (event) => {\n * const target = event.target as HTMLElement;\n * const tagName = target?.tagName?.toLowerCase();\n * return !['input', 'textarea', 'select'].includes(tagName) && !target?.isContentEditable;\n * });\n * \n * // Block shortcuts when modal is open\n * keyboardService.addFilter('modal', (event) => {\n * return !document.querySelector('.modal.active');\n * });\n * ```\n */\n addFilter(name: string, filter: KeyboardShortcutFilter): void {\n this.globalFilters.set(name, filter);\n }\n\n /**\n * Remove a named global filter.\n * \n * @param name - Name of the filter to remove\n * @returns `true` if filter was removed, `false` if it didn't exist\n */\n removeFilter(name: string): boolean {\n return this.globalFilters.delete(name);\n }\n\n /**\n * Get a named global filter.\n * \n * @param name - Name of the filter to retrieve\n * @returns The filter function, or undefined if not found\n */\n getFilter(name: string): KeyboardShortcutFilter | undefined {\n return this.globalFilters.get(name);\n }\n\n /**\n * Get all global filter names.\n * \n * @returns Array of filter names\n */\n getFilterNames(): string[] {\n return Array.from(this.globalFilters.keys());\n }\n\n /**\n * Remove all global filters.\n */\n clearFilters(): void {\n this.globalFilters.clear();\n }\n\n /**\n * Check if a named filter exists.\n * \n * @param name - Name of the filter to check\n * @returns `true` if filter exists, `false` otherwise\n */\n hasFilter(name: string): boolean {\n return this.globalFilters.has(name);\n }\n\n /**\n * Remove the filter from a specific group\n * @param groupId - The group ID\n * @throws KeyboardShortcutError if group doesn't exist\n */\n removeGroupFilter(groupId: string): void {\n const group = this.groups.get(groupId);\n if (!group) {\n throw KeyboardShortcutsErrorFactory.cannotDeactivateGroup(groupId);\n }\n\n if (!group.filter) {\n // No filter to remove, silently succeed\n return;\n }\n\n this.groups.set(groupId, {\n ...group,\n filter: undefined\n });\n\n this.updateState();\n }\n\n /**\n * Remove the filter from a specific shortcut\n * @param shortcutId - The shortcut ID\n * @throws KeyboardShortcutError if shortcut doesn't exist\n */\n removeShortcutFilter(shortcutId: string): void {\n const shortcut = this.shortcuts.get(shortcutId);\n if (!shortcut) {\n throw KeyboardShortcutsErrorFactory.cannotDeactivateShortcut(shortcutId);\n }\n\n if (!shortcut.filter) {\n // No filter to remove, silently succeed\n return;\n }\n\n this.shortcuts.set(shortcutId, {\n ...shortcut,\n filter: undefined\n });\n\n this.updateState();\n }\n\n /**\n * Remove all filters from all groups\n */\n clearAllGroupFilters(): void {\n this.batchUpdate(() => {\n this.groups.forEach((group, id) => {\n if (group.filter) {\n this.removeGroupFilter(id);\n }\n });\n });\n }\n\n /**\n * Remove all filters from all shortcuts\n */\n clearAllShortcutFilters(): void {\n this.batchUpdate(() => {\n this.shortcuts.forEach((shortcut, id) => {\n if (shortcut.filter) {\n this.removeShortcutFilter(id);\n }\n });\n });\n }\n\n /**\n * Check if a group has a filter\n * @param groupId - The group ID\n * @returns True if the group has a filter\n */\n hasGroupFilter(groupId: string): boolean {\n const group = this.groups.get(groupId);\n return !!group?.filter;\n }\n\n /**\n * Check if a shortcut has a filter\n * @param shortcutId - The shortcut ID\n * @returns True if the shortcut has a filter\n */\n hasShortcutFilter(shortcutId: string): boolean {\n const shortcut = this.shortcuts.get(shortcutId);\n return !!shortcut?.filter;\n }\n\n /**\n * Register multiple shortcuts in a single batch update\n * @param shortcuts - Array of shortcuts to register\n */\n registerMany(shortcuts: KeyboardShortcut[]): void {\n this.batchUpdate(() => {\n shortcuts.forEach(shortcut => this.register(shortcut));\n });\n }\n\n /**\n * Unregister multiple shortcuts in a single batch update\n * @param ids - Array of shortcut IDs to unregister\n */\n unregisterMany(ids: string[]): void {\n this.batchUpdate(() => {\n ids.forEach(id => this.unregister(id));\n });\n }\n\n /**\n * Unregister multiple groups in a single batch update\n * @param ids - Array of group IDs to unregister\n */\n unregisterGroups(ids: string[]): void {\n this.batchUpdate(() => {\n ids.forEach(id => this.unregisterGroup(id));\n });\n }\n\n /**\n * Clear all shortcuts and groups (nuclear reset)\n */\n clearAll(): void {\n this.batchUpdate(() => {\n this.shortcuts.clear();\n this.groups.clear();\n this.activeShortcuts.clear();\n this.activeGroups.clear();\n this.shortcutToGroup.clear();\n this.globalFilters.clear();\n this.clearCurrentlyDownKeys();\n this.clearPendingSequence();\n });\n }\n\n /**\n * Get all shortcuts belonging to a specific group\n * @param groupId - The group ID\n * @returns Array of shortcuts in the group\n */\n getGroupShortcuts(groupId: string): KeyboardShortcut[] {\n const group = this.groups.get(groupId);\n if (!group) return [];\n \n return [...group.shortcuts];\n }\n\n /**\n * Normalize a key to lowercase for consistent comparison\n */\n private normalizeKey(key: string): string {\n return key.toLowerCase();\n }\n\n /**\n * Find the group that contains a specific shortcut.\n * \n * @param shortcutId - The ID of the shortcut to find\n * @returns The group containing the shortcut, or undefined if not found in any group\n */\n private findGroupForShortcut(shortcutId: string): KeyboardShortcutGroup | undefined {\n const groupId = this.shortcutToGroup.get(shortcutId);\n return groupId ? this.groups.get(groupId) : undefined;\n }\n\n /**\n * Check if a keyboard event should be processed based on global, group, and per-shortcut filters.\n * Filter hierarchy: Global filters → Group filter → Individual shortcut filter\n * \n * @param event - The keyboard event to evaluate\n * @param shortcut - The shortcut being evaluated (for per-shortcut filter)\n * @returns `true` if event should be processed, `false` if it should be ignored\n */\n private shouldProcessEvent(event: KeyboardEvent, shortcut: KeyboardShortcut): boolean {\n // First, check all global filters - ALL must return true\n // Note: handleKeydown pre-checks these once per event for early exit,\n // but we keep this for direct calls and completeness.\n for (const globalFilter of this.globalFilters.values()) {\n if (!globalFilter(event)) {\n return false;\n }\n }\n\n // Then check group filter if shortcut belongs to a group\n const group = this.findGroupForShortcut(shortcut.id);\n if (group?.filter && !group.filter(event)) {\n return false;\n }\n\n // Finally check per-shortcut filter if it exists\n if (shortcut.filter && !shortcut.filter(event)) {\n return false;\n }\n\n return true;\n }\n\n private startListening(): void {\n if (this.isListening) {\n return;\n }\n\n // Listen to both keydown and keyup so we can maintain a Set of currently\n // pressed physical keys. We avoid passive:true because we may call\n // preventDefault() when matching shortcuts.\n this.document.addEventListener('keydown', this.keydownListener, { passive: false });\n this.document.addEventListener('keyup', this.keyupListener, { passive: false });\n // Listen for blur/visibility changes so we can clear the currently-down keys\n // and avoid stale state when the browser or tab loses focus.\n this.window.addEventListener('blur', this.blurListener);\n this.document.addEventListener('visibilitychange', this.visibilityListener);\n this.isListening = true;\n }\n\n private stopListening(): void {\n if (!this.isListening) {\n return;\n }\n\n this.document.removeEventListener('keydown', this.keydownListener);\n this.document.removeEventListener('keyup', this.keyupListener);\n this.window.removeEventListener('blur', this.blurListener);\n this.document.removeEventListener('visibilitychange', this.visibilityListener);\n this.isListening = false;\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n // Update the currently down keys with this event's key\n this.updateCurrentlyDownKeysOnKeydown(event);\n\n // Fast path: if any global filter blocks this event, bail out before\n // scanning all active shortcuts. This drastically reduces per-event work\n // when filters are commonly blocking (e.g., while typing in inputs).\n if (this.globalFilters.size > MIN_KEY_LENGTH) {\n for (const f of this.globalFilters.values()) {\n if (!f(event)) {\n // Also clear any pending multi-step sequence – entering a globally\n // filtered context should not allow sequences to continue.\n this.clearPendingSequence();\n return;\n }\n }\n }\n\n const isMac = this.isMacPlatform();\n\n // Evaluate active group-level filters once per event and cache blocked groups\n const blockedGroups = this.precomputeBlockedGroups(event);\n\n // If there is a pending multi-step sequence, try to advance it first\n if (this.pendingSequence) {\n const pending = this.pendingSequence;\n const shortcut = this.shortcuts.get(pending.shortcutId);\n if (shortcut) {\n // If the pending shortcut belongs to a blocked group, cancel sequence\n const g = this.findGroupForShortcut(shortcut.id);\n if (g && blockedGroups.has(g.id)) {\n this.clearPendingSequence();\n return;\n }\n const steps = isMac\n ? (shortcut.macSteps ?? shortcut.macKeys ?? shortcut.steps ?? shortcut.keys ?? [])\n : (shortcut.steps ?? shortcut.keys ?? shortcut.macSteps ?? shortcut.macKeys ?? []);\n const normalizedSteps = this.normalizeToSteps(steps as KeyStep[] | string[]);\n const expected = normalizedSteps[pending.stepIndex];\n\n // Use per-event pressed keys for advancing sequence steps. Relying on\n // the accumulated `currentlyDownKeys` can accidentally include keys\n // from previous steps (if tests or callers don't emit keyup), which\n // would prevent matching a simple single-key step like ['s'] after\n // a prior ['k'] step. Use getPressedKeys(event) which reflects the\n // actual modifier/main-key state for this event as a Set<string>.\n const stepPressed = this.getPressedKeys(event);\n\n if (expected && this.keysMatch(stepPressed, expected)) {\n // Advance sequence\n clearTimeout(pending.timerId);\n pending.stepIndex += STATE_VERSION_INCREMENT;\n\n if (pending.stepIndex >= normalizedSteps.length) {\n // Completed - check filters before executing\n if (!this.shouldProcessEvent(event, shortcut)) {\n this.pendingSequence = null;\n return; // Skip execution due to filters\n }\n\n event.preventDefault();\n event.stopPropagation();\n try {\n shortcut.action();\n } catch (error) {\n console.error(`Error executing keyboard shortcut \"${shortcut.id}\":`, error);\n }\n this.pendingSequence = null;\n return;\n }\n\n // Reset timer for next step (only if shortcut has timeout configured)\n if (shortcut.sequenceTimeout !== undefined) {\n pending.timerId = setTimeout(() => { this.pendingSequence = null; }, shortcut.sequenceTimeout);\n }\n return;\n } else {\n // Cancel pending if doesn't match\n this.clearPendingSequence();\n }\n } else {\n // pending exists but shortcut not found\n this.clearPendingSequence();\n }\n }\n\n // No pending sequence - check active shortcuts for a match or sequence start\n for (const shortcutId of this.activeShortcuts) {\n const shortcut = this.shortcuts.get(shortcutId);\n if (!shortcut) continue;\n\n // Skip expensive matching entirely when the shortcut's group is blocked\n const g = this.findGroupForShortcut(shortcut.id);\n if (g && blockedGroups.has(g.id)) {\n continue;\n }\n\n const steps = isMac\n ? (shortcut.macSteps ?? shortcut.macKeys ?? shortcut.steps ?? shortcut.keys ?? [])\n : (shortcut.steps ?? shortcut.keys ?? shortcut.macSteps ?? shortcut.macKeys ?? []);\n const normalizedSteps = this.normalizeToSteps(steps as KeyStep[] | string[]);\n\n const firstStep = normalizedSteps[FIRST_INDEX];\n\n // Decide which pressed-keys representation to use for this shortcut's\n // expected step: if it requires multiple non-modifier keys, treat it as\n // a chord and use accumulated keys; otherwise use per-event keys to avoid\n // interference from previously pressed non-modifier keys.\n const nonModifierCount = firstStep.filter(k => !KeyMatcher.isModifierKey(k)).length;\n // Normalize pressed keys to a Set<string> for consistent typing\n const pressedForStep: Set<string> = nonModifierCount > MIN_COUNT_ONE\n ? this.buildPressedKeysForMatch(event)\n : this.getPressedKeys(event);\n\n if (this.keysMatch(pressedForStep, firstStep)) {\n // Check if this event should be processed based on filters\n if (!this.shouldProcessEvent(event, shortcut)) {\n continue; // Skip this shortcut due to filters\n }\n\n if (normalizedSteps.length === SINGLE_STEP_LENGTH) {\n // single-step\n event.preventDefault();\n event.stopPropagation();\n try {\n shortcut.action();\n } catch (error) {\n console.error(`Error executing keyboard shortcut \"${shortcut.id}\":`, error);\n }\n break;\n } else {\n // start pending sequence\n if (this.pendingSequence) {\n this.clearPendingSequence();\n }\n const timerId = shortcut.sequenceTimeout !== undefined\n ? setTimeout(() => { this.pendingSequence = null; }, shortcut.sequenceTimeout)\n : null;\n this.pendingSequence = {\n shortcutId: shortcut.id,\n stepIndex: SECOND_STEP_INDEX,\n timerId\n };\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n }\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n // Remove the key from currently DownKeys on keyup\n const key = event.key ? event.key.toLowerCase() : '';\n if (key && !KeyMatcher.isModifierKey(key)) {\n this.currentlyDownKeys.delete(key);\n }\n }\n\n /**\n * Clear the currently-down keys. Exposed for testing and for use by\n * blur/visibilitychange handlers to avoid stale state when the page loses focus.\n */\n clearCurrentlyDownKeys(): void {\n this.currentlyDownKeys.clear();\n }\n\n protected handleWindowBlur(): void {\n this.clearCurrentlyDownKeys();\n // Clear any pressed keys and any pending multi-step sequence to avoid\n // stale state when the window loses focus.\n this.clearPendingSequence();\n }\n\n protected handleVisibilityChange(): void {\n if (this.document.visibilityState === 'hidden') {\n // When the document becomes hidden, clear both pressed keys and any\n // pending multi-step sequence. This prevents sequences from remaining\n // active when the user switches tabs or minimizes the window.\n this.clearCurrentlyDownKeys();\n this.clearPendingSequence();\n } else if (this.document.visibilityState === 'visible') {\n // When returning to visibility, clear keys to avoid stale state\n // from keys that may have been released while document was hidden\n this.clearCurrentlyDownKeys();\n }\n }\n\n /**\n * Update the currentlyDownKeys set when keydown events happen.\n * Normalizes common keys (function keys, space, etc.) to the same values\n * used by getPressedKeys/keysMatch.\n */\n protected updateCurrentlyDownKeysOnKeydown(event: KeyboardEvent): void {\n const key = event.key ? event.key.toLowerCase() : '';\n\n // Ignore modifier-only keydown entries\n if (KeyMatcher.isModifierKey(key)) {\n return;\n }\n\n // Normalize some special cases similar to the demo component's recording logic\n if (event.code && event.code.startsWith('F') && /^F\\d+$/.test(event.code)) {\n this.currentlyDownKeys.add(event.code.toLowerCase());\n return;\n }\n\n if (key === ' ') {\n this.currentlyDownKeys.add('space');\n return;\n }\n\n if (key === 'escape') {\n this.currentlyDownKeys.add('escape');\n return;\n }\n\n if (key === 'enter') {\n this.currentlyDownKeys.add('enter');\n return;\n }\n\n if (key && key.length > MIN_KEY_LENGTH) {\n this.currentlyDownKeys.add(key);\n }\n }\n\n /**\n * Build the pressed keys set used for matching against registered shortcuts.\n * If multiple non-modifier keys are currently down, include them (chord support).\n * Otherwise fall back to single main-key detection from the event for compatibility.\n *\n * Returns a Set<string> (lowercased) to allow O(1) lookups and O(n) comparisons\n * without sorting or allocating sorted arrays on every event.\n */\n protected buildPressedKeysForMatch(event: KeyboardEvent): Set<string> {\n const modifiers = new Set<string>();\n if (event.ctrlKey) modifiers.add('ctrl');\n if (event.altKey) modifiers.add('alt');\n if (event.shiftKey) modifiers.add('shift');\n if (event.metaKey) modifiers.add('meta');\n\n // Collect non-modifier keys from currentlyDownKeys (excluding modifiers)\n const nonModifierKeys = Array.from(this.currentlyDownKeys).filter(k => !KeyMatcher.isModifierKey(k));\n\n const result = new Set<string>();\n // Add modifiers first\n modifiers.forEach(m => result.add(m));\n\n if (nonModifierKeys.length > MIN_KEY_LENGTH) {\n nonModifierKeys.forEach(k => result.add(k.toLowerCase()));\n return result;\n }\n\n // Fallback: single main key from the event (existing behavior)\n const key = event.key.toLowerCase();\n if (!KeyMatcher.isModifierKey(key)) {\n result.add(key);\n }\n return result;\n }\n\n /**\n * Return the pressed keys for this event as a Set<string>.\n * This is the canonical internal API used for matching.\n */\n protected getPressedKeys(event: KeyboardEvent): Set<string> {\n const result = new Set<string>();\n\n if (event.ctrlKey) result.add('ctrl');\n if (event.altKey) result.add('alt');\n if (event.shiftKey) result.add('shift');\n if (event.metaKey) result.add('meta');\n\n // Add the main key (normalize to lowercase) if it's not a modifier\n const key = (event.key ?? '').toLowerCase();\n if (key && !KeyMatcher.isModifierKey(key)) {\n result.add(key);\n }\n\n return result;\n }\n\n /**\n * Compare pressed keys against a target key combination.\n * Accepts either a Set<string> (preferred) or an array for backwards compatibility.\n * Uses Set-based comparison: sizes must match and every element in target must exist in pressed.\n */\n /**\n * @deprecated Use KeyMatcher.keysMatch() instead\n */\n protected keysMatch(pressedKeys: Set<string> | string[], targetKeys: string[]): boolean {\n return KeyMatcher.keysMatch(pressedKeys, targetKeys);\n }\n\n /**\n * Compare two multi-step sequences for equality\n * @deprecated Use KeyMatcher.stepsMatch() instead\n */\n protected stepsMatch(a: string[][], b: string[][]): boolean {\n return KeyMatcher.stepsMatch(a, b);\n }\n\n /** Safely clear any pending multi-step sequence */\n private clearPendingSequence(): void {\n if (!this.pendingSequence) return;\n try {\n // Only clear timeout if one was set\n if (this.pendingSequence.timerId !== null) {\n clearTimeout(this.pendingSequence.timerId);\n }\n } catch { /* ignore */ }\n this.pendingSequence = null;\n }\n\n protected isMacPlatform(): boolean {\n return /Mac|iPod|iPhone|iPad/.test(this.window.navigator.platform ?? '');\n }\n\n protected setupActiveUntil(activeUntil: KeyboardShortcutActiveUntil | undefined, unregister: () => void) {\n if (!activeUntil) {\n return\n }\n\n if (activeUntil === 'destruct') {\n inject(DestroyRef).onDestroy(unregister);\n return\n }\n\n // Support both real DestroyRef instances and duck-typed objects (e.g.,\n // Jasmine spies) that expose an onDestroy(fn) method for backwards\n // compatibility with earlier APIs and tests.\n if (isDestroyRefLike(activeUntil)) {\n activeUntil.onDestroy(unregister);\n return;\n }\n\n if (activeUntil instanceof Observable) {\n activeUntil.pipe(take(1)).subscribe(unregister);\n return\n }\n }\n\n /**\n * Evaluate group filters once per event and return the set of blocked group IDs.\n */\n protected precomputeBlockedGroups(event: KeyboardEvent): Set<string> {\n const blocked = new Set<string>();\n if (this.activeGroups.size === MIN_KEY_LENGTH) return blocked;\n for (const groupId of this.activeGroups) {\n const group = this.groups.get(groupId);\n if (group && group.filter && !group.filter(event)) {\n blocked.add(groupId);\n }\n }\n return blocked;\n }\n}","import {\n Directive,\n ElementRef,\n HostBinding,\n inject,\n Input,\n OnDestroy,\n OnInit,\n output,\n} from '@angular/core';\nimport { KeyboardShortcuts } from '../core/keyboard-shortcuts.service';\nimport { Action, KeyStep } from '../models/keyboard-shortcut.interface';\n\n/**\n * Directive for registering keyboard shortcuts directly on elements in templates.\n * \n * This directive automatically:\n * - Registers the shortcut when the directive initializes\n * - Triggers the host element's click event (default) or executes a custom action\n * - Unregisters the shortcut when the component is destroyed\n * \n * @example\n * Basic usage with click trigger:\n * ```html\n * <button ngxKeys\n * keys=\"ctrl,s\"\n * description=\"Save document\"\n * (click)=\"save()\">\n * Save\n * </button>\n * ```\n * \n * @example\n * With custom action:\n * ```html\n * <button ngxKeys\n * keys=\"ctrl,s\"\n * description=\"Save document\"\n * [action]=\"customSaveAction\">\n * Save\n * </button>\n * ```\n * \n * @example\n * Multi-step shortcuts:\n * ```html\n * <button ngxKeys\n * [steps]=\"[['ctrl', 'k'], ['ctrl', 's']]\"\n * description=\"Format document\"\n * (click)=\"format()\">\n * Format\n * </button>\n * ```\n * \n * @example\n * Mac-specific keys:\n * ```html\n * <button ngxKeys\n * keys=\"ctrl,s\"\n * macKeys=\"cmd,s\"\n * description=\"Save document\"\n * (click)=\"save()\">\n * Save\n * </button>\n * ```\n * \n * @example\n * On non-interactive elements:\n * ```html\n * <div ngxKeys\n * keys=\"?\"\n * description=\"Show help\"\n * [action]=\"showHelp\">\n * Help content\n * </div>\n * ```\n */\n@Directive({\n selector: '[ngxKeys]',\n standalone: true,\n})\nexport class KeyboardShortcutDirective implements OnInit, OnDestroy {\n private readonly keyboardShortcuts = inject(KeyboardShortcuts);\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n \n /**\n * Comma-separated string of keys for the shortcut (e.g., \"ctrl,s\" or \"alt,shift,k\")\n * Use either `keys` for single-step shortcuts or `steps` for multi-step shortcuts.\n */\n @Input() keys?: string;\n\n /**\n * Comma-separated string of keys for Mac users (e.g., \"cmd,s\")\n * If not provided, `keys` will be used for all platforms.\n */\n @Input() macKeys?: string;\n\n /**\n * Multi-step shortcut as an array of key arrays.\n * Each inner array represents one step in the sequence.\n * Example: [['ctrl', 'k'], ['ctrl', 's']] for Ctrl+K followed by Ctrl+S\n */\n @Input() steps?: KeyStep[];\n\n /**\n * Multi-step shortcut for Mac users.\n * Example: [['cmd', 'k'], ['cmd', 's']]\n */\n @Input() macSteps?: KeyStep[];\n\n /**\n * Description of what the shortcut does (displayed in help/documentation)\n */\n @Input({ required: true }) description!: string;\n\n /**\n * Optional custom action to execute when the shortcut is triggered.\n * If not provided, the directive will trigger a click event on the host element.\n */\n @Input() action?: Action;\n\n /**\n * Optional custom ID for the shortcut. If not provided, a unique ID will be generated.\n * Useful for programmatically referencing the shortcut or for debugging.\n */\n @Input() shortcutId?: string;\n\n /**\n * Event emitted when the keyboard shortcut is triggered.\n * This fires in addition to the action or click trigger.\n */\n readonly triggered = output<void>();\n\n /**\n * Adds a data attribute to the host element for styling or testing purposes\n */\n @HostBinding('attr.data-keyboard-shortcut')\n get dataAttribute(): string {\n return this.generatedId;\n }\n\n private generatedId = '';\n private isRegistered = false;\n\n ngOnInit(): void {\n // Generate unique ID if not provided\n this.generatedId = this.shortcutId || this.generateUniqueId();\n\n // Validate inputs\n this.validateInputs();\n\n // Parse keys from comma-separated strings\n const parsedKeys = this.keys ? this.parseKeys(this.keys) : undefined;\n const parsedMacKeys = this.macKeys ? this.parseKeys(this.macKeys) : undefined;\n\n // Define the action: custom action or default click behavior\n const shortcutAction: Action = () => {\n if (this.action) {\n this.action();\n } else {\n // Trigger click on the host element\n this.elementRef.nativeElement.click();\n }\n // Emit the triggered event\n this.triggered.emit();\n };\n\n // Register the shortcut\n try {\n this.keyboardShortcuts.register({\n id: this.generatedId,\n keys: parsedKeys,\n macKeys: parsedMacKeys,\n steps: this.steps,\n macSteps: this.macSteps,\n action: shortcutAction,\n description: this.description,\n });\n this.isRegistered = true;\n } catch (error) {\n console.error(`[ngxKeys] Failed to register shortcut:`, error);\n throw error;\n }\n }\n\n ngOnDestroy(): void {\n // Automatically unregister the shortcut when the directive is destroyed\n if (this.isRegistered) {\n try {\n this.keyboardShortcuts.unregister(this.generatedId);\n } catch (error) {\n // Silently handle unregister errors (shortcut might have been manually removed)\n console.warn(`[ngxKeys] Failed to unregister shortcut ${this.generatedId}:`, error);\n }\n }\n }\n\n /**\n * Parse comma-separated key string into an array\n * Example: \"ctrl,s\" -> [\"ctrl\", \"s\"]\n */\n private parseKeys(keysString: string): string[] {\n return keysString\n .split(',')\n .map(key => key.trim())\n .filter(key => key.length > 0);\n }\n\n /**\n * Generate a unique ID for the shortcut based on the element and keys\n */\n private generateUniqueId(): string {\n const timestamp = Date.now();\n const random = Math.random().toString(36).substring(2, 9);\n const keysStr = this.keys || this.steps?.flat().join('-') || 'unknown';\n return `ngx-shortcut-${keysStr}-${timestamp}-${random}`;\n }\n\n /**\n * Validate that required inputs are provided correctly\n */\n private validateInputs(): void {\n const hasSingleStep = this.keys || this.macKeys;\n const hasMultiStep = this.steps || this.macSteps;\n\n if (!hasSingleStep && !hasMultiStep) {\n throw new Error(\n `[ngxKeys] Must provide either 'keys'/'macKeys' for single-step shortcuts or 'steps'/'macSteps' for multi-step shortcuts.`\n );\n }\n\n if (hasSingleStep && hasMultiStep) {\n throw new Error(\n `[ngxKeys] Cannot use both single-step ('keys'/'macKeys') and multi-step ('steps'/'macSteps') inputs simultaneously. Choose one approach.`\n );\n }\n\n if (!this.description) {\n throw new Error(\n `[ngxKeys] 'description' input is required.`\n );\n }\n }\n}\n","/*\n * Public API Surface of ngx-keys\n */\n\nexport * from './lib/core/keyboard-shortcuts.service';\nexport * from './lib/models/keyboard-shortcut.interface';\nexport * from './lib/errors/keyboard-shortcuts.errors';\nexport { \n KEYBOARD_SHORTCUTS_CONFIG,\n provideKeyboardShortcutsConfig\n} from './lib/config/keyboard-shortcuts.config';\nexport type { KeyboardShortcutsConfig } from './lib/config/keyboard-shortcuts.config';\nexport { KeyboardShortcutDirective } from './lib/directives/keyboard-shortcut.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;AAGG;AACI,MAAM,uBAAuB,GAAG;;IAErC,2BAA2B,EAAE,CAAC,EAAU,KAAK,CAAA,UAAA,EAAa,EAAE,CAAA,oBAAA,CAAsB;IAClF,wBAAwB,EAAE,CAAC,EAAU,KAAK,CAAA,OAAA,EAAU,EAAE,CAAA,oBAAA,CAAsB;IAC5E,YAAY,EAA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W;uBAAC,6BAA6B;;;ACxI5C;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-keys.mjs","sources":["../../../projects/ngx-keys/src/lib/errors/keyboard-shortcuts.errors.ts","../../../projects/ngx-keys/src/lib/config/keyboard-shortcuts.config.ts","../../../projects/ngx-keys/src/lib/core/utils/key-matcher.ts","../../../projects/ngx-keys/src/lib/core/keyboard-shortcuts.service.ts","../../../projects/ngx-keys/src/lib/directives/keyboard-shortcut.directive.ts","../../../projects/ngx-keys/src/public-api.ts","../../../projects/ngx-keys/src/ngx-keys.ts"],"sourcesContent":["/**\n * Centralized error messages for keyboard shortcuts service\n * This ensures consistency across the application and makes testing easier\n */\nexport const KeyboardShortcutsErrors = {\n // Registration errors\n SHORTCUT_ALREADY_REGISTERED: (id: string) => `Shortcut \"${id}\" already registered`,\n GROUP_ALREADY_REGISTERED: (id: string) => `Group \"${id}\" already registered`,\n KEY_CONFLICT: (conflictId: string) => `Key conflict with \"${conflictId}\"`,\n ACTIVE_KEY_CONFLICT: (conflictId: string) => `Key conflict with active shortcut \"${conflictId}\"`,\n ACTIVATION_KEY_CONFLICT: (shortcutId: string, conflictIds: string[]) => `Cannot activate \"${shortcutId}\": would conflict with active shortcuts: ${conflictIds.join(', ')}`,\n GROUP_ACTIVATION_KEY_CONFLICT: (groupId: string, conflictIds: string[]) => `Cannot activate group \"${groupId}\": would conflict with active shortcuts: ${conflictIds.join(', ')}`,\n SHORTCUT_IDS_ALREADY_REGISTERED: (ids: string[]) => `Shortcut IDs already registered: ${ids.join(', ')}`,\n DUPLICATE_SHORTCUTS_IN_GROUP: (ids: string[]) => `Duplicate shortcuts in group: ${ids.join(', ')}`,\n KEY_CONFLICTS_IN_GROUP: (conflicts: string[]) => `Key conflicts: ${conflicts.join(', ')}`,\n \n // Operation errors\n SHORTCUT_NOT_REGISTERED: (id: string) => `Shortcut \"${id}\" not registered`,\n GROUP_NOT_REGISTERED: (id: string) => `Group \"${id}\" not registered`,\n \n // Activation/Deactivation errors\n CANNOT_ACTIVATE_SHORTCUT: (id: string) => `Cannot activate shortcut \"${id}\": not registered`,\n CANNOT_DEACTIVATE_SHORTCUT: (id: string) => `Cannot deactivate shortcut \"${id}\": not registered`,\n CANNOT_ACTIVATE_GROUP: (id: string) => `Cannot activate group \"${id}\": not registered`,\n CANNOT_DEACTIVATE_GROUP: (id: string) => `Cannot deactivate group \"${id}\": not registered`,\n \n // Unregistration errors\n CANNOT_UNREGISTER_SHORTCUT: (id: string) => `Cannot unregister shortcut \"${id}\": not registered`,\n CANNOT_UNREGISTER_GROUP: (id: string) => `Cannot unregister group \"${id}\": not registered`,\n} as const;\n\n/**\n * Error types for type safety\n */\nexport type KeyboardShortcutsErrorType = keyof typeof KeyboardShortcutsErrors;\n\n/**\n * Custom error class for keyboard shortcuts\n */\nexport class KeyboardShortcutError extends Error {\n constructor(\n public readonly errorType: KeyboardShortcutsErrorType,\n message: string,\n public readonly context?: Record<string, any>\n ) {\n super(message);\n this.name = 'KeyboardShortcutError';\n }\n}\n\n/**\n * Error factory for creating consistent errors\n */\nexport class KeyboardShortcutsErrorFactory {\n static shortcutAlreadyRegistered(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'SHORTCUT_ALREADY_REGISTERED',\n KeyboardShortcutsErrors.SHORTCUT_ALREADY_REGISTERED(id),\n { shortcutId: id }\n );\n }\n\n static groupAlreadyRegistered(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'GROUP_ALREADY_REGISTERED',\n KeyboardShortcutsErrors.GROUP_ALREADY_REGISTERED(id),\n { groupId: id }\n );\n }\n\n static keyConflict(conflictId: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'KEY_CONFLICT',\n KeyboardShortcutsErrors.KEY_CONFLICT(conflictId),\n { conflictId }\n );\n }\n\n static activeKeyConflict(conflictId: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'ACTIVE_KEY_CONFLICT',\n KeyboardShortcutsErrors.ACTIVE_KEY_CONFLICT(conflictId),\n { conflictId }\n );\n }\n\n static activationKeyConflict(shortcutId: string, conflictIds: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'ACTIVATION_KEY_CONFLICT',\n KeyboardShortcutsErrors.ACTIVATION_KEY_CONFLICT(shortcutId, conflictIds),\n { shortcutId, conflictIds }\n );\n }\n\n static groupActivationKeyConflict(groupId: string, conflictIds: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'GROUP_ACTIVATION_KEY_CONFLICT',\n KeyboardShortcutsErrors.GROUP_ACTIVATION_KEY_CONFLICT(groupId, conflictIds),\n { groupId, conflictIds }\n );\n }\n\n static shortcutIdsAlreadyRegistered(ids: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'SHORTCUT_IDS_ALREADY_REGISTERED',\n KeyboardShortcutsErrors.SHORTCUT_IDS_ALREADY_REGISTERED(ids),\n { duplicateIds: ids }\n );\n }\n\n static duplicateShortcutsInGroup(ids: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'DUPLICATE_SHORTCUTS_IN_GROUP',\n KeyboardShortcutsErrors.DUPLICATE_SHORTCUTS_IN_GROUP(ids),\n { duplicateIds: ids }\n );\n }\n\n static keyConflictsInGroup(conflicts: string[]): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'KEY_CONFLICTS_IN_GROUP',\n KeyboardShortcutsErrors.KEY_CONFLICTS_IN_GROUP(conflicts),\n { conflicts }\n );\n }\n\n static shortcutNotRegistered(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'SHORTCUT_NOT_REGISTERED',\n KeyboardShortcutsErrors.SHORTCUT_NOT_REGISTERED(id),\n { shortcutId: id }\n );\n }\n\n static groupNotRegistered(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'GROUP_NOT_REGISTERED',\n KeyboardShortcutsErrors.GROUP_NOT_REGISTERED(id),\n { groupId: id }\n );\n }\n\n static cannotActivateShortcut(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_ACTIVATE_SHORTCUT',\n KeyboardShortcutsErrors.CANNOT_ACTIVATE_SHORTCUT(id),\n { shortcutId: id }\n );\n }\n\n static cannotDeactivateShortcut(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_DEACTIVATE_SHORTCUT',\n KeyboardShortcutsErrors.CANNOT_DEACTIVATE_SHORTCUT(id),\n { shortcutId: id }\n );\n }\n\n static cannotActivateGroup(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_ACTIVATE_GROUP',\n KeyboardShortcutsErrors.CANNOT_ACTIVATE_GROUP(id),\n { groupId: id }\n );\n }\n\n static cannotDeactivateGroup(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_DEACTIVATE_GROUP',\n KeyboardShortcutsErrors.CANNOT_DEACTIVATE_GROUP(id),\n { groupId: id }\n );\n }\n\n static cannotUnregisterShortcut(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_UNREGISTER_SHORTCUT',\n KeyboardShortcutsErrors.CANNOT_UNREGISTER_SHORTCUT(id),\n { shortcutId: id }\n );\n }\n\n static cannotUnregisterGroup(id: string): KeyboardShortcutError {\n return new KeyboardShortcutError(\n 'CANNOT_UNREGISTER_GROUP',\n KeyboardShortcutsErrors.CANNOT_UNREGISTER_GROUP(id),\n { groupId: id }\n );\n }\n}\n","import { InjectionToken, Provider } from '@angular/core';\n\n/**\n * Configuration options for the KeyboardShortcuts service.\n */\nexport interface KeyboardShortcutsConfig {\n // Reserved for future configuration options\n}\n\n/**\n * Injection token for providing KeyboardShortcuts configuration.\n * \n * @example\n * ```typescript\n * providers: [\n * provideKeyboardShortcutsConfig({ sequenceTimeoutMs: Infinity })\n * ]\n * ```\n */\nexport const KEYBOARD_SHORTCUTS_CONFIG = new InjectionToken<KeyboardShortcutsConfig>(\n 'KEYBOARD_SHORTCUTS_CONFIG',\n {\n providedIn: 'root',\n factory: () => ({})\n }\n);\n\n/**\n * Provides KeyboardShortcuts configuration using Angular's modern provider pattern.\n * \n * @param config - Configuration options for KeyboardShortcuts service\n * @returns Provider array for use in Angular dependency injection\n * \n * @example\n * ```typescript\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideKeyboardShortcutsConfig({ sequenceTimeoutMs: Infinity })\n * ]\n * });\n * ```\n */\nexport function provideKeyboardShortcutsConfig(config: KeyboardShortcutsConfig): Provider[] {\n return [{ provide: KEYBOARD_SHORTCUTS_CONFIG, useValue: config }];\n}\n\n/**\n * Initial version number for state change detection.\n * Used internally to track state updates efficiently.\n * @internal\n */\nexport const INITIAL_STATE_VERSION = 0;\n\n/**\n * Increment value for state version updates.\n * @internal\n */\nexport const STATE_VERSION_INCREMENT = 1;\n\n/**\n * Index of the first element in an array.\n * Used for readability when checking array structure.\n * @internal\n */\nexport const FIRST_INDEX = 0;\n\n/**\n * Index representing the first step in a multi-step sequence.\n * @internal\n */\nexport const FIRST_STEP_INDEX = 0;\n\n/**\n * Index representing the second step in a multi-step sequence (after first step completes).\n * @internal\n */\nexport const SECOND_STEP_INDEX = 1;\n\n/**\n * Threshold for determining if a shortcut is a single-step sequence.\n * @internal\n */\nexport const SINGLE_STEP_LENGTH = 1;\n\n/**\n * Minimum count indicating that at least one item exists.\n * @internal\n */\nexport const MIN_COUNT_ONE = 1;\n\n/**\n * Minimum length for a valid key string.\n * @internal\n */\nexport const MIN_KEY_LENGTH = 0;\n","/**\n * Utility class for keyboard shortcut key matching and normalization.\n * Provides methods for comparing key combinations and normalizing key input.\n */\nexport class KeyMatcher {\n private static readonly MODIFIER_KEYS = new Set(['ctrl', 'control', 'alt', 'shift', 'meta']);\n\n /**\n * Normalize a key string to lowercase for consistent comparison.\n * \n * @param key - The key string to normalize\n * @returns The normalized (lowercase) key string\n * \n * @example\n * ```typescript\n * KeyMatcher.normalizeKey('Ctrl'); // returns 'ctrl'\n * KeyMatcher.normalizeKey('A'); // returns 'a'\n * ```\n */\n static normalizeKey(key: string): string {\n return key.toLowerCase();\n }\n\n /**\n * Check if a key is a modifier key (ctrl, alt, shift, meta).\n * \n * @param key - The key to check\n * @returns true if the key is a modifier key\n * \n * @example\n * ```typescript\n * KeyMatcher.isModifierKey('ctrl'); // returns true\n * KeyMatcher.isModifierKey('a'); // returns false\n * ```\n */\n static isModifierKey(key: string): boolean {\n return this.MODIFIER_KEYS.has(key.toLowerCase());\n }\n\n /**\n * Compare two key combinations for equality.\n * Supports both Set<string> and string[] as input.\n * Keys are normalized (lowercased) before comparison.\n * \n * @param a - First key combination (Set or array)\n * @param b - Second key combination (array)\n * @returns true if both combinations contain the same keys\n * \n * @example\n * ```typescript\n * KeyMatcher.keysMatch(['ctrl', 's'], ['ctrl', 's']); // returns true\n * KeyMatcher.keysMatch(['ctrl', 's'], ['Ctrl', 'S']); // returns true (normalized)\n * KeyMatcher.keysMatch(['ctrl', 's'], ['alt', 's']); // returns false\n * ```\n */\n static keysMatch(a: Set<string> | string[], b: string[]): boolean {\n const setA = a instanceof Set ? a : this.normalizeKeysToSet(a);\n const setB = this.normalizeKeysToSet(b);\n\n if (setA.size !== setB.size) {\n return false;\n }\n\n for (const key of setA) {\n if (!setB.has(key)) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Compare two multi-step sequences for equality.\n * Each sequence is an array of steps, where each step is an array of keys.\n * \n * @param a - First multi-step sequence\n * @param b - Second multi-step sequence\n * @returns true if both sequences are identical\n * \n * @example\n * ```typescript\n * const seq1 = [['ctrl', 'k'], ['s']];\n * const seq2 = [['ctrl', 'k'], ['s']];\n * KeyMatcher.stepsMatch(seq1, seq2); // returns true\n * \n * const seq3 = [['ctrl', 'k'], ['t']];\n * KeyMatcher.stepsMatch(seq1, seq3); // returns false (different final step)\n * ```\n */\n static stepsMatch(a: string[][], b: string[][]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0; i < a.length; i++) {\n if (!this.keysMatch(a[i], b[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Normalize an array of keys to a Set of lowercase keys.\n * \n * @param keys - Array of keys to normalize\n * @returns Set of normalized (lowercase) keys\n * \n * @internal\n */\n private static normalizeKeysToSet(keys: string[]): Set<string> {\n return new Set(keys.map(k => k.toLowerCase()));\n }\n\n /**\n * Get the set of modifier key names.\n * Useful for filtering or checking if a key is a modifier.\n * \n * @returns ReadonlySet of modifier key names\n * \n * @example\n * ```typescript\n * const modifiers = KeyMatcher.getModifierKeys();\n * console.log(modifiers.has('ctrl')); // true\n * console.log(modifiers.has('a')); // false\n * ```\n */\n static getModifierKeys(): ReadonlySet<string> {\n return this.MODIFIER_KEYS;\n }\n}\n","import {\n afterNextRender,\n computed,\n DestroyRef,\n DOCUMENT,\n inject,\n Injectable,\n OnDestroy,\n signal,\n} from '@angular/core';\nimport { KeyboardShortcut, KeyboardShortcutActiveUntil, KeyboardShortcutFilter, KeyboardShortcutGroup, KeyboardShortcutGroupOptions, KeyboardShortcutUI, KeyStep } from '../models/keyboard-shortcut.interface'\nimport { KeyboardShortcutsErrorFactory } from '../errors/keyboard-shortcuts.errors';\nimport { Observable, take } from 'rxjs';\nimport {\n INITIAL_STATE_VERSION,\n STATE_VERSION_INCREMENT,\n FIRST_INDEX,\n FIRST_STEP_INDEX,\n SECOND_STEP_INDEX,\n SINGLE_STEP_LENGTH,\n MIN_COUNT_ONE,\n MIN_KEY_LENGTH,\n KEYBOARD_SHORTCUTS_CONFIG\n} from '../config/keyboard-shortcuts.config';\nimport { KeyMatcher } from './utils/key-matcher';\n\n/**\n * Type guard to detect KeyboardShortcutGroupOptions at runtime.\n * Centralising this logic keeps registerGroup simpler and less fragile.\n */\nfunction isGroupOptions(param: unknown): param is KeyboardShortcutGroupOptions {\n if (!param || typeof param !== 'object') return false;\n // Narrow to object for property checks\n const obj = param as Record<string, unknown>;\n return ('filter' in obj) || ('activeUntil' in obj);\n}\n\n/**\n * Detect real DestroyRef instances or duck-typed objects exposing onDestroy(fn).\n * Returns true for either an actual DestroyRef or an object with an onDestroy method.\n */\nfunction isDestroyRefLike(obj: unknown): obj is DestroyRef & { onDestroy: (fn: () => void) => void } {\n if (!obj || typeof obj !== 'object') return false;\n try {\n // Prefer instanceof when available (real DestroyRef)\n if (obj instanceof DestroyRef) return true;\n } catch {\n // instanceof may throw if DestroyRef is not constructable in certain runtimes/tests\n }\n\n const o = obj as Record<string, unknown>;\n return typeof o['onDestroy'] === 'function';\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class KeyboardShortcuts implements OnDestroy {\n private readonly document = inject(DOCUMENT);\n private readonly window = this.document.defaultView!;\n private readonly config = inject(KEYBOARD_SHORTCUTS_CONFIG);\n\n private readonly shortcuts = new Map<string, KeyboardShortcut>();\n private readonly groups = new Map<string, KeyboardShortcutGroup>();\n private readonly activeShortcuts = new Set<string>();\n private readonly activeGroups = new Set<string>();\n private readonly currentlyDownKeys = new Set<string>();\n // O(1) lookup from shortcutId to its groupId to avoid scanning all groups per event\n private readonly shortcutToGroup = new Map<string, string>();\n\n /**\n * Named global filters that apply to all shortcuts.\n * All global filters must return `true` for a shortcut to be processed.\n */\n private readonly globalFilters = new Map<string, KeyboardShortcutFilter>();\n\n // Single consolidated state signal - reduces memory overhead\n private readonly state = signal({\n shortcuts: new Map<string, KeyboardShortcut>(),\n groups: new Map<string, KeyboardShortcutGroup>(),\n activeShortcuts: new Set<string>(),\n activeGroups: new Set<string>(),\n version: INITIAL_STATE_VERSION // for change detection optimization\n });\n\n // Primary computed signal - consumers derive what they need from this\n readonly shortcuts$ = computed(() => {\n const state = this.state();\n const activeShortcuts = Array.from(state.activeShortcuts)\n .map(id => state.shortcuts.get(id))\n .filter((s): s is KeyboardShortcut => s !== undefined);\n\n const inactiveShortcuts = Array.from(state.shortcuts.values())\n .filter(s => !state.activeShortcuts.has(s.id));\n\n return {\n active: activeShortcuts,\n inactive: inactiveShortcuts,\n all: Array.from(state.shortcuts.values()),\n groups: {\n active: Array.from(state.activeGroups),\n inactive: Array.from(state.groups.keys())\n .filter(id => !state.activeGroups.has(id))\n }\n };\n });\n\n // Optional: Pre-formatted UI signal for components that need it\n readonly shortcutsUI$ = computed(() => {\n const shortcuts = this.shortcuts$();\n return {\n active: shortcuts.active.map(s => this.formatShortcutForUI(s)),\n inactive: shortcuts.inactive.map(s => this.formatShortcutForUI(s)),\n all: shortcuts.all.map(s => this.formatShortcutForUI(s))\n };\n });\n\n private readonly keydownListener = this.handleKeydown.bind(this);\n private readonly keyupListener = this.handleKeyup.bind(this);\n private readonly blurListener = this.handleWindowBlur.bind(this);\n private readonly visibilityListener = this.handleVisibilityChange.bind(this);\n private isListening = false;\n\n /** Runtime state for multi-step sequences */\n private pendingSequence: {\n shortcutId: string;\n stepIndex: number;\n timerId: any | null;\n } | null = null;\n\n constructor() {\n afterNextRender(() => {\n this.startListening();\n });\n }\n\n ngOnDestroy(): void {\n this.stopListening();\n }\n\n /**\n * Batch updates and increment version for change detection\n */\n private updateState(): void {\n this.state.update(current => ({\n shortcuts: new Map(this.shortcuts),\n groups: new Map(this.groups),\n activeShortcuts: new Set(this.activeShortcuts),\n activeGroups: new Set(this.activeGroups),\n version: current.version + STATE_VERSION_INCREMENT\n }));\n }\n\n /**\n * Utility method for UI formatting\n */\n formatShortcutForUI(shortcut: KeyboardShortcut): KeyboardShortcutUI {\n return {\n id: shortcut.id,\n keys: this.formatStepsForDisplay(shortcut.keys ?? shortcut.steps ?? [], false),\n macKeys: this.formatStepsForDisplay(shortcut.macKeys ?? shortcut.macSteps ?? [], true),\n description: shortcut.description\n };\n }\n\n /**\n * Utility method for batch operations - reduces signal updates\n */\n batchUpdate(operations: () => void): void {\n operations();\n this.updateState();\n }\n\n /**\n * Format keys for display with proper Unicode symbols\n */\n private formatKeysForDisplay(keys: string[], isMac = false): string {\n const keyMap: Record<string, string> = isMac ? {\n 'ctrl': '⌃',\n 'alt': '⌥',\n 'shift': '⇧',\n 'meta': '⌘',\n 'cmd': '⌘',\n 'command': '⌘'\n } : {\n 'ctrl': 'Ctrl',\n 'alt': 'Alt',\n 'shift': 'Shift',\n 'meta': 'Win'\n };\n\n return keys\n .map(key => keyMap[key.toLowerCase()] || key.toUpperCase())\n .join('+');\n }\n\n private formatStepsForDisplay(steps: string[] | string[][], isMac = false): string {\n if (!steps) return '';\n\n // If the first element is an array, assume steps is string[][]\n const normalized = this.normalizeToSteps(steps as KeyStep[] | string[]);\n if (normalized.length === MIN_KEY_LENGTH) return '';\n if (normalized.length === SINGLE_STEP_LENGTH) return this.formatKeysForDisplay(normalized[FIRST_INDEX], isMac);\n return normalized.map(step => this.formatKeysForDisplay(step, isMac)).join(', ');\n }\n\n private normalizeToSteps(input: KeyStep[] | string[]): KeyStep[] {\n if (!input) return [];\n // If first element is an array, assume already KeyStep[]\n if (Array.isArray(input[FIRST_INDEX])) {\n return input as KeyStep[];\n }\n // Single step array\n return [input as string[]];\n }\n\n /**\n * Check if a key combination is already registered by an active shortcut\n * @returns The ID of the conflicting active shortcut, or null if no active conflict\n */\n private findActiveConflict(newShortcut: KeyboardShortcut): string | null {\n for (const existing of this.shortcuts.values()) {\n // Only check conflicts with active shortcuts\n if (!this.activeShortcuts.has(existing.id)) {\n continue;\n }\n\n // Compare single-step shapes if provided\n if (newShortcut.keys && existing.keys && this.keysMatch(newShortcut.keys, existing.keys)) {\n return existing.id;\n }\n if (newShortcut.macKeys && existing.macKeys && this.keysMatch(newShortcut.macKeys, existing.macKeys)) {\n return existing.id;\n }\n\n // Compare multi-step shapes\n if (newShortcut.steps && existing.steps && this.stepsMatch(newShortcut.steps, existing.steps)) {\n return existing.id;\n }\n if (newShortcut.macSteps && existing.macSteps && this.stepsMatch(newShortcut.macSteps, existing.macSteps)) {\n return existing.id;\n }\n\n // Check if new single-step shortcut conflicts with first step of existing multi-step shortcut\n if (newShortcut.keys && existing.steps) {\n const firstStep = existing.steps[FIRST_INDEX];\n if (firstStep && this.keysMatch(newShortcut.keys, firstStep)) {\n return existing.id;\n }\n }\n if (newShortcut.macKeys && existing.macSteps) {\n const firstStep = existing.macSteps[FIRST_INDEX];\n if (firstStep && this.keysMatch(newShortcut.macKeys, firstStep)) {\n return existing.id;\n }\n }\n\n // Check if new multi-step shortcut's first step conflicts with existing single-step shortcut\n if (newShortcut.steps && existing.keys) {\n const firstStep = newShortcut.steps[FIRST_INDEX];\n if (firstStep && this.keysMatch(firstStep, existing.keys)) {\n return existing.id;\n }\n }\n if (newShortcut.macSteps && existing.macKeys) {\n const firstStep = newShortcut.macSteps[FIRST_INDEX];\n if (firstStep && this.keysMatch(firstStep, existing.macKeys)) {\n return existing.id;\n }\n }\n }\n return null;\n }\n\n /**\n * Check if activating a shortcut would create key conflicts with other active shortcuts\n * @returns Array of conflicting shortcut IDs that would be created by activation\n */\n private findActivationConflicts(shortcutId: string): string[] {\n const shortcut = this.shortcuts.get(shortcutId);\n if (!shortcut) return [];\n\n const conflictsSet = new Set<string>();\n for (const existing of this.shortcuts.values()) {\n // Skip self and inactive shortcuts\n if (existing.id === shortcutId || !this.activeShortcuts.has(existing.id)) {\n continue;\n }\n\n // Check for key conflicts\n if ((shortcut.keys && existing.keys && this.keysMatch(shortcut.keys, existing.keys)) ||\n (shortcut.macKeys && existing.macKeys && this.keysMatch(shortcut.macKeys, existing.macKeys)) ||\n (shortcut.steps && existing.steps && this.stepsMatch(shortcut.steps, existing.steps)) ||\n (shortcut.macSteps && existing.macSteps && this.stepsMatch(shortcut.macSteps, existing.macSteps))) {\n conflictsSet.add(existing.id);\n continue; // Skip further checks for this shortcut to avoid duplicate adds\n }\n\n // Check if shortcut's single-step conflicts with first step of existing multi-step shortcut\n if (shortcut.keys && existing.steps) {\n const firstStep = existing.steps[FIRST_INDEX];\n if (firstStep && this.keysMatch(shortcut.keys, firstStep)) {\n conflictsSet.add(existing.id);\n continue;\n }\n }\n if (shortcut.macKeys && existing.macSteps) {\n const firstStep = existing.macSteps[FIRST_INDEX];\n if (firstStep && this.keysMatch(shortcut.macKeys, firstStep)) {\n conflictsSet.add(existing.id);\n continue;\n }\n }\n\n // Check if shortcut's multi-step first step conflicts with existing single-step shortcut\n if (shortcut.steps && existing.keys) {\n const firstStep = shortcut.steps[FIRST_INDEX];\n if (firstStep && this.keysMatch(firstStep, existing.keys)) {\n conflictsSet.add(existing.id);\n continue;\n }\n }\n if (shortcut.macSteps && existing.macKeys) {\n const firstStep = shortcut.macSteps[FIRST_INDEX];\n if (firstStep && this.keysMatch(firstStep, existing.macKeys)) {\n conflictsSet.add(existing.id);\n continue;\n }\n }\n }\n return Array.from(conflictsSet);\n }\n\n /**\n * Register a single keyboard shortcut\n * @throws KeyboardShortcutError if shortcut ID is already registered or if the shortcut would conflict with currently active shortcuts\n */\n register(shortcut: KeyboardShortcut): void {\n if (this.shortcuts.has(shortcut.id)) {\n throw KeyboardShortcutsErrorFactory.shortcutAlreadyRegistered(shortcut.id);\n }\n\n // Check for conflicts only with currently active shortcuts\n const conflictId = this.findActiveConflict(shortcut);\n if (conflictId) {\n throw KeyboardShortcutsErrorFactory.activeKeyConflict(conflictId);\n }\n\n this.shortcuts.set(shortcut.id, shortcut);\n this.activeShortcuts.add(shortcut.id);\n this.updateState();\n\n this.setupActiveUntil(\n shortcut.activeUntil,\n this.unregister.bind(this, shortcut.id),\n );\n }\n\n /**\n * Register multiple keyboard shortcuts as a group\n * @param groupId - Unique identifier for the group\n * @param shortcuts - Array of shortcuts to register as a group\n * @param options - Optional configuration including filter and activeUntil\n * @throws KeyboardShortcutError if group ID is already registered or if any shortcut ID or key combination conflicts\n */\n registerGroup(groupId: string, shortcuts: KeyboardShortcut[], options?: KeyboardShortcutGroupOptions): void;\n /**\n * @deprecated Use registerGroup(groupId, shortcuts, { activeUntil }) instead\n */\n registerGroup(groupId: string, shortcuts: KeyboardShortcut[], activeUntil?: KeyboardShortcutActiveUntil): void;\n registerGroup(groupId: string, shortcuts: KeyboardShortcut[], optionsOrActiveUntil?: KeyboardShortcutGroupOptions | KeyboardShortcutActiveUntil): void {\n // Parse parameters - support both old (activeUntil) and new (options) formats\n let options: KeyboardShortcutGroupOptions;\n if (isGroupOptions(optionsOrActiveUntil)) {\n // New format with options object\n options = optionsOrActiveUntil;\n } else {\n // Old format with just activeUntil parameter\n options = { activeUntil: optionsOrActiveUntil as KeyboardShortcutActiveUntil };\n }\n\n // Check if group ID already exists\n if (this.groups.has(groupId)) {\n throw KeyboardShortcutsErrorFactory.groupAlreadyRegistered(groupId);\n }\n \n // Check for duplicate shortcut IDs and key combination conflicts with active shortcuts\n const duplicateIds: string[] = [];\n const keyConflicts: string[] = [];\n shortcuts.forEach(shortcut => {\n if (this.shortcuts.has(shortcut.id)) {\n duplicateIds.push(shortcut.id);\n }\n const conflictId = this.findActiveConflict(shortcut);\n if (conflictId) {\n keyConflicts.push(`\"${shortcut.id}\" conflicts with active shortcut \"${conflictId}\"`);\n }\n });\n\n if (duplicateIds.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.shortcutIdsAlreadyRegistered(duplicateIds);\n }\n\n if (keyConflicts.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.keyConflictsInGroup(keyConflicts);\n }\n\n // Validate that all shortcuts have unique IDs within the group\n const groupIds = new Set<string>();\n const duplicatesInGroup: string[] = [];\n shortcuts.forEach(shortcut => {\n if (groupIds.has(shortcut.id)) {\n duplicatesInGroup.push(shortcut.id);\n } else {\n groupIds.add(shortcut.id);\n }\n });\n\n if (duplicatesInGroup.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.duplicateShortcutsInGroup(duplicatesInGroup);\n }\n\n // Use batch update to reduce signal updates\n this.batchUpdate(() => {\n const group: KeyboardShortcutGroup = {\n id: groupId,\n shortcuts,\n active: true,\n filter: options.filter\n };\n\n this.groups.set(groupId, group);\n this.activeGroups.add(groupId);\n\n // Register individual shortcuts\n shortcuts.forEach(shortcut => {\n this.shortcuts.set(shortcut.id, shortcut);\n this.activeShortcuts.add(shortcut.id);\n this.shortcutToGroup.set(shortcut.id, groupId);\n });\n });\n\n this.setupActiveUntil(\n options.activeUntil,\n this.unregisterGroup.bind(this, groupId),\n );\n }\n\n /**\n * Unregister a single keyboard shortcut\n * @throws KeyboardShortcutError if shortcut ID doesn't exist\n */\n unregister(shortcutId: string): void {\n if (!this.shortcuts.has(shortcutId)) {\n throw KeyboardShortcutsErrorFactory.cannotUnregisterShortcut(shortcutId);\n }\n\n this.shortcuts.delete(shortcutId);\n this.activeShortcuts.delete(shortcutId);\n this.shortcutToGroup.delete(shortcutId);\n this.updateState();\n }\n\n /**\n * Unregister a group of keyboard shortcuts\n * @throws KeyboardShortcutError if group ID doesn't exist\n */\n unregisterGroup(groupId: string): void {\n const group = this.groups.get(groupId);\n if (!group) {\n throw KeyboardShortcutsErrorFactory.cannotUnregisterGroup(groupId);\n }\n\n this.batchUpdate(() => {\n group.shortcuts.forEach(shortcut => {\n this.shortcuts.delete(shortcut.id);\n this.activeShortcuts.delete(shortcut.id);\n this.shortcutToGroup.delete(shortcut.id);\n });\n this.groups.delete(groupId);\n this.activeGroups.delete(groupId);\n });\n }\n\n\n\n /**\n * Activate a single keyboard shortcut\n * @throws KeyboardShortcutError if shortcut ID doesn't exist or if activation would create key conflicts\n */\n activate(shortcutId: string): void {\n if (!this.shortcuts.has(shortcutId)) {\n throw KeyboardShortcutsErrorFactory.cannotActivateShortcut(shortcutId);\n }\n\n // Check for conflicts that would be created by activation\n const conflicts = this.findActivationConflicts(shortcutId);\n if (conflicts.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.activationKeyConflict(shortcutId, conflicts);\n }\n\n this.activeShortcuts.add(shortcutId);\n this.updateState();\n }\n\n /**\n * Deactivate a single keyboard shortcut\n * @throws KeyboardShortcutError if shortcut ID doesn't exist\n */\n deactivate(shortcutId: string): void {\n if (!this.shortcuts.has(shortcutId)) {\n throw KeyboardShortcutsErrorFactory.cannotDeactivateShortcut(shortcutId);\n }\n\n this.activeShortcuts.delete(shortcutId);\n this.updateState();\n }\n\n /**\n * Activate a group of keyboard shortcuts\n * @throws KeyboardShortcutError if group ID doesn't exist or if activation would create key conflicts\n */\n activateGroup(groupId: string): void {\n const group = this.groups.get(groupId);\n if (!group) {\n throw KeyboardShortcutsErrorFactory.cannotActivateGroup(groupId);\n }\n\n // Check for conflicts that would be created by activating all shortcuts in the group\n const allConflicts: string[] = [];\n group.shortcuts.forEach(shortcut => {\n const conflicts = this.findActivationConflicts(shortcut.id);\n allConflicts.push(...conflicts);\n });\n\n if (allConflicts.length > MIN_KEY_LENGTH) {\n throw KeyboardShortcutsErrorFactory.groupActivationKeyConflict(groupId, allConflicts);\n }\n\n this.batchUpdate(() => {\n group.active = true;\n this.activeGroups.add(groupId);\n group.shortcuts.forEach(shortcut => {\n this.activeShortcuts.add(shortcut.id);\n });\n });\n }\n\n /**\n * Deactivate a group of keyboard shortcuts\n * @throws KeyboardShortcutError if group ID doesn't exist\n */\n deactivateGroup(groupId: string): void {\n const group = this.groups.get(groupId);\n if (!group) {\n throw KeyboardShortcutsErrorFactory.cannotDeactivateGroup(groupId);\n }\n\n this.batchUpdate(() => {\n group.active = false;\n this.activeGroups.delete(groupId);\n group.shortcuts.forEach(shortcut => {\n this.activeShortcuts.delete(shortcut.id);\n });\n });\n }\n\n /**\n * Check if a shortcut is active\n */\n isActive(shortcutId: string): boolean {\n return this.activeShortcuts.has(shortcutId);\n }\n\n /**\n * Check if a shortcut is registered\n */\n isRegistered(shortcutId: string): boolean {\n return this.shortcuts.has(shortcutId);\n }\n\n /**\n * Check if a group is active\n */\n isGroupActive(groupId: string): boolean {\n return this.activeGroups.has(groupId);\n }\n\n /**\n * Check if a group is registered\n */\n isGroupRegistered(groupId: string): boolean {\n return this.groups.has(groupId);\n }\n\n /**\n * Get all registered shortcuts\n */\n getShortcuts(): ReadonlyMap<string, KeyboardShortcut> {\n return this.shortcuts;\n }\n\n /**\n * Get all registered groups\n */\n getGroups(): ReadonlyMap<string, KeyboardShortcutGroup> {\n return this.groups;\n }\n\n /**\n * Add a named global filter that applies to all shortcuts.\n * All global filters must return `true` for a shortcut to execute.\n * \n * @param name - Unique name for this filter\n * @param filter - Function that returns `true` to allow shortcuts, `false` to block them\n * \n * @example\n * ```typescript\n * // Block shortcuts in form elements\n * keyboardService.addFilter('forms', (event) => {\n * const target = event.target as HTMLElement;\n * const tagName = target?.tagName?.toLowerCase();\n * return !['input', 'textarea', 'select'].includes(tagName) && !target?.isContentEditable;\n * });\n * \n * // Block shortcuts when modal is open\n * keyboardService.addFilter('modal', (event) => {\n * return !document.querySelector('.modal.active');\n * });\n * ```\n */\n addFilter(name: string, filter: KeyboardShortcutFilter): void {\n this.globalFilters.set(name, filter);\n }\n\n /**\n * Remove a named global filter.\n * \n * @param name - Name of the filter to remove\n * @returns `true` if filter was removed, `false` if it didn't exist\n */\n removeFilter(name: string): boolean {\n return this.globalFilters.delete(name);\n }\n\n /**\n * Get a named global filter.\n * \n * @param name - Name of the filter to retrieve\n * @returns The filter function, or undefined if not found\n */\n getFilter(name: string): KeyboardShortcutFilter | undefined {\n return this.globalFilters.get(name);\n }\n\n /**\n * Get all global filter names.\n * \n * @returns Array of filter names\n */\n getFilterNames(): string[] {\n return Array.from(this.globalFilters.keys());\n }\n\n /**\n * Remove all global filters.\n */\n clearFilters(): void {\n this.globalFilters.clear();\n }\n\n /**\n * Check if a named filter exists.\n * \n * @param name - Name of the filter to check\n * @returns `true` if filter exists, `false` otherwise\n */\n hasFilter(name: string): boolean {\n return this.globalFilters.has(name);\n }\n\n /**\n * Remove the filter from a specific group\n * @param groupId - The group ID\n * @throws KeyboardShortcutError if group doesn't exist\n */\n removeGroupFilter(groupId: string): void {\n const group = this.groups.get(groupId);\n if (!group) {\n throw KeyboardShortcutsErrorFactory.cannotDeactivateGroup(groupId);\n }\n\n if (!group.filter) {\n // No filter to remove, silently succeed\n return;\n }\n\n this.groups.set(groupId, {\n ...group,\n filter: undefined\n });\n\n this.updateState();\n }\n\n /**\n * Remove the filter from a specific shortcut\n * @param shortcutId - The shortcut ID\n * @throws KeyboardShortcutError if shortcut doesn't exist\n */\n removeShortcutFilter(shortcutId: string): void {\n const shortcut = this.shortcuts.get(shortcutId);\n if (!shortcut) {\n throw KeyboardShortcutsErrorFactory.cannotDeactivateShortcut(shortcutId);\n }\n\n if (!shortcut.filter) {\n // No filter to remove, silently succeed\n return;\n }\n\n this.shortcuts.set(shortcutId, {\n ...shortcut,\n filter: undefined\n });\n\n this.updateState();\n }\n\n /**\n * Remove all filters from all groups\n */\n clearAllGroupFilters(): void {\n this.batchUpdate(() => {\n this.groups.forEach((group, id) => {\n if (group.filter) {\n this.removeGroupFilter(id);\n }\n });\n });\n }\n\n /**\n * Remove all filters from all shortcuts\n */\n clearAllShortcutFilters(): void {\n this.batchUpdate(() => {\n this.shortcuts.forEach((shortcut, id) => {\n if (shortcut.filter) {\n this.removeShortcutFilter(id);\n }\n });\n });\n }\n\n /**\n * Check if a group has a filter\n * @param groupId - The group ID\n * @returns True if the group has a filter\n */\n hasGroupFilter(groupId: string): boolean {\n const group = this.groups.get(groupId);\n return !!group?.filter;\n }\n\n /**\n * Check if a shortcut has a filter\n * @param shortcutId - The shortcut ID\n * @returns True if the shortcut has a filter\n */\n hasShortcutFilter(shortcutId: string): boolean {\n const shortcut = this.shortcuts.get(shortcutId);\n return !!shortcut?.filter;\n }\n\n /**\n * Register multiple shortcuts in a single batch update\n * @param shortcuts - Array of shortcuts to register\n */\n registerMany(shortcuts: KeyboardShortcut[]): void {\n this.batchUpdate(() => {\n shortcuts.forEach(shortcut => this.register(shortcut));\n });\n }\n\n /**\n * Unregister multiple shortcuts in a single batch update\n * @param ids - Array of shortcut IDs to unregister\n */\n unregisterMany(ids: string[]): void {\n this.batchUpdate(() => {\n ids.forEach(id => this.unregister(id));\n });\n }\n\n /**\n * Unregister multiple groups in a single batch update\n * @param ids - Array of group IDs to unregister\n */\n unregisterGroups(ids: string[]): void {\n this.batchUpdate(() => {\n ids.forEach(id => this.unregisterGroup(id));\n });\n }\n\n /**\n * Clear all shortcuts and groups (nuclear reset)\n */\n clearAll(): void {\n this.batchUpdate(() => {\n this.shortcuts.clear();\n this.groups.clear();\n this.activeShortcuts.clear();\n this.activeGroups.clear();\n this.shortcutToGroup.clear();\n this.globalFilters.clear();\n this.clearCurrentlyDownKeys();\n this.clearPendingSequence();\n });\n }\n\n /**\n * Get all shortcuts belonging to a specific group\n * @param groupId - The group ID\n * @returns Array of shortcuts in the group\n */\n getGroupShortcuts(groupId: string): KeyboardShortcut[] {\n const group = this.groups.get(groupId);\n if (!group) return [];\n \n return [...group.shortcuts];\n }\n\n /**\n * Normalize a key to lowercase for consistent comparison\n */\n private normalizeKey(key: string): string {\n return key.toLowerCase();\n }\n\n /**\n * Find the group that contains a specific shortcut.\n * \n * @param shortcutId - The ID of the shortcut to find\n * @returns The group containing the shortcut, or undefined if not found in any group\n */\n private findGroupForShortcut(shortcutId: string): KeyboardShortcutGroup | undefined {\n const groupId = this.shortcutToGroup.get(shortcutId);\n return groupId ? this.groups.get(groupId) : undefined;\n }\n\n /**\n * Check if a keyboard event should be processed based on global, group, and per-shortcut filters.\n * Filter hierarchy: Global filters → Group filter → Individual shortcut filter\n * \n * @param event - The keyboard event to evaluate\n * @param shortcut - The shortcut being evaluated (for per-shortcut filter)\n * @returns `true` if event should be processed, `false` if it should be ignored\n */\n private shouldProcessEvent(event: KeyboardEvent, shortcut: KeyboardShortcut): boolean {\n // First, check all global filters - ALL must return true\n // Note: handleKeydown pre-checks these once per event for early exit,\n // but we keep this for direct calls and completeness.\n for (const globalFilter of this.globalFilters.values()) {\n if (!globalFilter(event)) {\n return false;\n }\n }\n\n // Then check group filter if shortcut belongs to a group\n const group = this.findGroupForShortcut(shortcut.id);\n if (group?.filter && !group.filter(event)) {\n return false;\n }\n\n // Finally check per-shortcut filter if it exists\n if (shortcut.filter && !shortcut.filter(event)) {\n return false;\n }\n\n return true;\n }\n\n private startListening(): void {\n if (this.isListening) {\n return;\n }\n\n // Listen to both keydown and keyup so we can maintain a Set of currently\n // pressed physical keys. We avoid passive:true because we may call\n // preventDefault() when matching shortcuts.\n this.document.addEventListener('keydown', this.keydownListener, { passive: false });\n this.document.addEventListener('keyup', this.keyupListener, { passive: false });\n // Listen for blur/visibility changes so we can clear the currently-down keys\n // and avoid stale state when the browser or tab loses focus.\n this.window.addEventListener('blur', this.blurListener);\n this.document.addEventListener('visibilitychange', this.visibilityListener);\n this.isListening = true;\n }\n\n private stopListening(): void {\n if (!this.isListening) {\n return;\n }\n\n this.document.removeEventListener('keydown', this.keydownListener);\n this.document.removeEventListener('keyup', this.keyupListener);\n this.window.removeEventListener('blur', this.blurListener);\n this.document.removeEventListener('visibilitychange', this.visibilityListener);\n this.isListening = false;\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n // Update the currently down keys with this event's key\n this.updateCurrentlyDownKeysOnKeydown(event);\n\n // Fast path: if any global filter blocks this event, bail out before\n // scanning all active shortcuts. This drastically reduces per-event work\n // when filters are commonly blocking (e.g., while typing in inputs).\n if (this.globalFilters.size > MIN_KEY_LENGTH) {\n for (const f of this.globalFilters.values()) {\n if (!f(event)) {\n // Also clear any pending multi-step sequence – entering a globally\n // filtered context should not allow sequences to continue.\n this.clearPendingSequence();\n return;\n }\n }\n }\n\n const isMac = this.isMacPlatform();\n\n // Evaluate active group-level filters once per event and cache blocked groups\n const blockedGroups = this.precomputeBlockedGroups(event);\n\n // If there is a pending multi-step sequence, try to advance it first\n if (this.pendingSequence) {\n const pending = this.pendingSequence;\n const shortcut = this.shortcuts.get(pending.shortcutId);\n if (shortcut) {\n // If the pending shortcut belongs to a blocked group, cancel sequence\n const g = this.findGroupForShortcut(shortcut.id);\n if (g && blockedGroups.has(g.id)) {\n this.clearPendingSequence();\n return;\n }\n const steps = isMac\n ? (shortcut.macSteps ?? shortcut.macKeys ?? shortcut.steps ?? shortcut.keys ?? [])\n : (shortcut.steps ?? shortcut.keys ?? shortcut.macSteps ?? shortcut.macKeys ?? []);\n const normalizedSteps = this.normalizeToSteps(steps as KeyStep[] | string[]);\n const expected = normalizedSteps[pending.stepIndex];\n\n // Use per-event pressed keys for advancing sequence steps. Relying on\n // the accumulated `currentlyDownKeys` can accidentally include keys\n // from previous steps (if tests or callers don't emit keyup), which\n // would prevent matching a simple single-key step like ['s'] after\n // a prior ['k'] step. Use getPressedKeys(event) which reflects the\n // actual modifier/main-key state for this event as a Set<string>.\n const stepPressed = this.getPressedKeys(event);\n\n if (expected && this.keysMatch(stepPressed, expected)) {\n // Advance sequence\n clearTimeout(pending.timerId);\n pending.stepIndex += STATE_VERSION_INCREMENT;\n\n if (pending.stepIndex >= normalizedSteps.length) {\n // Completed - check filters before executing\n if (!this.shouldProcessEvent(event, shortcut)) {\n this.pendingSequence = null;\n return; // Skip execution due to filters\n }\n\n event.preventDefault();\n event.stopPropagation();\n try {\n shortcut.action();\n } catch (error) {\n console.error(`Error executing keyboard shortcut \"${shortcut.id}\":`, error);\n }\n this.pendingSequence = null;\n return;\n }\n\n // Reset timer for next step (only if shortcut has timeout configured)\n if (shortcut.sequenceTimeout !== undefined) {\n pending.timerId = setTimeout(() => { this.pendingSequence = null; }, shortcut.sequenceTimeout);\n }\n return;\n } else {\n // Cancel pending if doesn't match\n this.clearPendingSequence();\n }\n } else {\n // pending exists but shortcut not found\n this.clearPendingSequence();\n }\n }\n\n // No pending sequence - check active shortcuts for a match or sequence start\n for (const shortcutId of this.activeShortcuts) {\n const shortcut = this.shortcuts.get(shortcutId);\n if (!shortcut) continue;\n\n // Skip expensive matching entirely when the shortcut's group is blocked\n const g = this.findGroupForShortcut(shortcut.id);\n if (g && blockedGroups.has(g.id)) {\n continue;\n }\n\n const steps = isMac\n ? (shortcut.macSteps ?? shortcut.macKeys ?? shortcut.steps ?? shortcut.keys ?? [])\n : (shortcut.steps ?? shortcut.keys ?? shortcut.macSteps ?? shortcut.macKeys ?? []);\n const normalizedSteps = this.normalizeToSteps(steps as KeyStep[] | string[]);\n\n const firstStep = normalizedSteps[FIRST_INDEX];\n\n // Decide which pressed-keys representation to use for this shortcut's\n // expected step: if it requires multiple non-modifier keys, treat it as\n // a chord and use accumulated keys; otherwise use per-event keys to avoid\n // interference from previously pressed non-modifier keys.\n const nonModifierCount = firstStep.filter(k => !KeyMatcher.isModifierKey(k)).length;\n // Normalize pressed keys to a Set<string> for consistent typing\n const pressedForStep: Set<string> = nonModifierCount > MIN_COUNT_ONE\n ? this.buildPressedKeysForMatch(event)\n : this.getPressedKeys(event);\n\n if (this.keysMatch(pressedForStep, firstStep)) {\n // Check if this event should be processed based on filters\n if (!this.shouldProcessEvent(event, shortcut)) {\n continue; // Skip this shortcut due to filters\n }\n\n if (normalizedSteps.length === SINGLE_STEP_LENGTH) {\n // single-step\n event.preventDefault();\n event.stopPropagation();\n try {\n shortcut.action();\n } catch (error) {\n console.error(`Error executing keyboard shortcut \"${shortcut.id}\":`, error);\n }\n break;\n } else {\n // start pending sequence\n if (this.pendingSequence) {\n this.clearPendingSequence();\n }\n const timerId = shortcut.sequenceTimeout !== undefined\n ? setTimeout(() => { this.pendingSequence = null; }, shortcut.sequenceTimeout)\n : null;\n this.pendingSequence = {\n shortcutId: shortcut.id,\n stepIndex: SECOND_STEP_INDEX,\n timerId\n };\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n }\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n // Remove the key from currently DownKeys on keyup\n const key = event.key ? event.key.toLowerCase() : '';\n if (key && !KeyMatcher.isModifierKey(key)) {\n this.currentlyDownKeys.delete(key);\n }\n }\n\n /**\n * Clear the currently-down keys. Exposed for testing and for use by\n * blur/visibilitychange handlers to avoid stale state when the page loses focus.\n */\n clearCurrentlyDownKeys(): void {\n this.currentlyDownKeys.clear();\n }\n\n protected handleWindowBlur(): void {\n this.clearCurrentlyDownKeys();\n // Clear any pressed keys and any pending multi-step sequence to avoid\n // stale state when the window loses focus.\n this.clearPendingSequence();\n }\n\n protected handleVisibilityChange(): void {\n if (this.document.visibilityState === 'hidden') {\n // When the document becomes hidden, clear both pressed keys and any\n // pending multi-step sequence. This prevents sequences from remaining\n // active when the user switches tabs or minimizes the window.\n this.clearCurrentlyDownKeys();\n this.clearPendingSequence();\n } else if (this.document.visibilityState === 'visible') {\n // When returning to visibility, clear keys to avoid stale state\n // from keys that may have been released while document was hidden\n this.clearCurrentlyDownKeys();\n }\n }\n\n /**\n * Update the currentlyDownKeys set when keydown events happen.\n * Normalizes common keys (function keys, space, etc.) to the same values\n * used by getPressedKeys/keysMatch.\n */\n protected updateCurrentlyDownKeysOnKeydown(event: KeyboardEvent): void {\n const key = event.key ? event.key.toLowerCase() : '';\n\n // Ignore modifier-only keydown entries\n if (KeyMatcher.isModifierKey(key)) {\n return;\n }\n\n // Normalize some special cases similar to the demo component's recording logic\n if (event.code && event.code.startsWith('F') && /^F\\d+$/.test(event.code)) {\n this.currentlyDownKeys.add(event.code.toLowerCase());\n return;\n }\n\n if (key === ' ') {\n this.currentlyDownKeys.add('space');\n return;\n }\n\n if (key === 'escape') {\n this.currentlyDownKeys.add('escape');\n return;\n }\n\n if (key === 'enter') {\n this.currentlyDownKeys.add('enter');\n return;\n }\n\n if (key && key.length > MIN_KEY_LENGTH) {\n this.currentlyDownKeys.add(key);\n }\n }\n\n /**\n * Build the pressed keys set used for matching against registered shortcuts.\n * If multiple non-modifier keys are currently down, include them (chord support).\n * Otherwise fall back to single main-key detection from the event for compatibility.\n *\n * Returns a Set<string> (lowercased) to allow O(1) lookups and O(n) comparisons\n * without sorting or allocating sorted arrays on every event.\n */\n protected buildPressedKeysForMatch(event: KeyboardEvent): Set<string> {\n const modifiers = new Set<string>();\n if (event.ctrlKey) modifiers.add('ctrl');\n if (event.altKey) modifiers.add('alt');\n if (event.shiftKey) modifiers.add('shift');\n if (event.metaKey) modifiers.add('meta');\n\n // Collect non-modifier keys from currentlyDownKeys (excluding modifiers)\n const nonModifierKeys = Array.from(this.currentlyDownKeys).filter(k => !KeyMatcher.isModifierKey(k));\n\n const result = new Set<string>();\n // Add modifiers first\n modifiers.forEach(m => result.add(m));\n\n if (nonModifierKeys.length > MIN_KEY_LENGTH) {\n nonModifierKeys.forEach(k => result.add(k.toLowerCase()));\n return result;\n }\n\n // Fallback: single main key from the event (existing behavior)\n const key = event.key.toLowerCase();\n if (!KeyMatcher.isModifierKey(key)) {\n result.add(key);\n }\n return result;\n }\n\n /**\n * Return the pressed keys for this event as a Set<string>.\n * This is the canonical internal API used for matching.\n */\n protected getPressedKeys(event: KeyboardEvent): Set<string> {\n const result = new Set<string>();\n\n if (event.ctrlKey) result.add('ctrl');\n if (event.altKey) result.add('alt');\n if (event.shiftKey) result.add('shift');\n if (event.metaKey) result.add('meta');\n\n // Add the main key (normalize to lowercase) if it's not a modifier\n const key = (event.key ?? '').toLowerCase();\n if (key && !KeyMatcher.isModifierKey(key)) {\n result.add(key);\n }\n\n return result;\n }\n\n /**\n * Compare pressed keys against a target key combination.\n * Accepts either a Set<string> (preferred) or an array for backwards compatibility.\n * Uses Set-based comparison: sizes must match and every element in target must exist in pressed.\n */\n /**\n * @deprecated Use KeyMatcher.keysMatch() instead\n */\n protected keysMatch(pressedKeys: Set<string> | string[], targetKeys: string[]): boolean {\n return KeyMatcher.keysMatch(pressedKeys, targetKeys);\n }\n\n /**\n * Compare two multi-step sequences for equality\n * @deprecated Use KeyMatcher.stepsMatch() instead\n */\n protected stepsMatch(a: string[][], b: string[][]): boolean {\n return KeyMatcher.stepsMatch(a, b);\n }\n\n /** Safely clear any pending multi-step sequence */\n private clearPendingSequence(): void {\n if (!this.pendingSequence) return;\n try {\n // Only clear timeout if one was set\n if (this.pendingSequence.timerId !== null) {\n clearTimeout(this.pendingSequence.timerId);\n }\n } catch { /* ignore */ }\n this.pendingSequence = null;\n }\n\n protected isMacPlatform(): boolean {\n return /Mac|iPod|iPhone|iPad/.test(this.window.navigator.platform ?? '');\n }\n\n protected setupActiveUntil(activeUntil: KeyboardShortcutActiveUntil | undefined, unregister: () => void) {\n if (!activeUntil) {\n return\n }\n\n if (activeUntil === 'destruct') {\n inject(DestroyRef).onDestroy(unregister);\n return\n }\n\n // Support both real DestroyRef instances and duck-typed objects (e.g.,\n // Jasmine spies) that expose an onDestroy(fn) method for backwards\n // compatibility with earlier APIs and tests.\n if (isDestroyRefLike(activeUntil)) {\n activeUntil.onDestroy(unregister);\n return;\n }\n\n if (activeUntil instanceof Observable) {\n activeUntil.pipe(take(1)).subscribe(unregister);\n return\n }\n }\n\n /**\n * Evaluate group filters once per event and return the set of blocked group IDs.\n */\n protected precomputeBlockedGroups(event: KeyboardEvent): Set<string> {\n const blocked = new Set<string>();\n if (this.activeGroups.size === MIN_KEY_LENGTH) return blocked;\n for (const groupId of this.activeGroups) {\n const group = this.groups.get(groupId);\n if (group && group.filter && !group.filter(event)) {\n blocked.add(groupId);\n }\n }\n return blocked;\n }\n}","import {\n Directive,\n ElementRef,\n HostBinding,\n inject,\n Input,\n OnDestroy,\n OnInit,\n output,\n} from '@angular/core';\nimport { KeyboardShortcuts } from '../core/keyboard-shortcuts.service';\nimport { Action, KeyStep } from '../models/keyboard-shortcut.interface';\n\n/**\n * Directive for registering keyboard shortcuts directly on elements in templates.\n * \n * This directive automatically:\n * - Registers the shortcut when the directive initializes\n * - Triggers the host element's click event (default) or executes a custom action\n * - Unregisters the shortcut when the component is destroyed\n * \n * @example\n * Basic usage with click trigger:\n * ```html\n * <button ngxKeys\n * keys=\"ctrl,s\"\n * description=\"Save document\"\n * (click)=\"save()\">\n * Save\n * </button>\n * ```\n * \n * @example\n * With custom action:\n * ```html\n * <button ngxKeys\n * keys=\"ctrl,s\"\n * description=\"Save document\"\n * [action]=\"customSaveAction\">\n * Save\n * </button>\n * ```\n * \n * @example\n * Multi-step shortcuts:\n * ```html\n * <button ngxKeys\n * [steps]=\"[['ctrl', 'k'], ['ctrl', 's']]\"\n * description=\"Format document\"\n * (click)=\"format()\">\n * Format\n * </button>\n * ```\n * \n * @example\n * Mac-specific keys:\n * ```html\n * <button ngxKeys\n * keys=\"ctrl,s\"\n * macKeys=\"cmd,s\"\n * description=\"Save document\"\n * (click)=\"save()\">\n * Save\n * </button>\n * ```\n * \n * @example\n * On non-interactive elements:\n * ```html\n * <div ngxKeys\n * keys=\"?\"\n * description=\"Show help\"\n * [action]=\"showHelp\">\n * Help content\n * </div>\n * ```\n */\n@Directive({\n selector: '[ngxKeys]',\n standalone: true,\n})\nexport class KeyboardShortcutDirective implements OnInit, OnDestroy {\n private readonly keyboardShortcuts = inject(KeyboardShortcuts);\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n \n /**\n * Comma-separated string of keys for the shortcut (e.g., \"ctrl,s\" or \"alt,shift,k\")\n * Use either `keys` for single-step shortcuts or `steps` for multi-step shortcuts.\n */\n @Input() keys?: string;\n\n /**\n * Comma-separated string of keys for Mac users (e.g., \"cmd,s\")\n * If not provided, `keys` will be used for all platforms.\n */\n @Input() macKeys?: string;\n\n /**\n * Multi-step shortcut as an array of key arrays.\n * Each inner array represents one step in the sequence.\n * Example: [['ctrl', 'k'], ['ctrl', 's']] for Ctrl+K followed by Ctrl+S\n */\n @Input() steps?: KeyStep[];\n\n /**\n * Multi-step shortcut for Mac users.\n * Example: [['cmd', 'k'], ['cmd', 's']]\n */\n @Input() macSteps?: KeyStep[];\n\n /**\n * Description of what the shortcut does (displayed in help/documentation)\n */\n @Input({ required: true }) description!: string;\n\n /**\n * Optional custom action to execute when the shortcut is triggered.\n * If not provided, the directive will trigger a click event on the host element.\n */\n @Input() action?: Action;\n\n /**\n * Optional custom ID for the shortcut. If not provided, a unique ID will be generated.\n * Useful for programmatically referencing the shortcut or for debugging.\n */\n @Input() shortcutId?: string;\n\n /**\n * Event emitted when the keyboard shortcut is triggered.\n * This fires in addition to the action or click trigger.\n */\n readonly triggered = output<void>();\n\n /**\n * Adds a data attribute to the host element for styling or testing purposes\n */\n @HostBinding('attr.data-keyboard-shortcut')\n get dataAttribute(): string {\n return this.generatedId;\n }\n\n private generatedId = '';\n private isRegistered = false;\n\n ngOnInit(): void {\n // Generate unique ID if not provided\n this.generatedId = this.shortcutId || this.generateUniqueId();\n\n // Validate inputs\n this.validateInputs();\n\n // Parse keys from comma-separated strings\n const parsedKeys = this.keys ? this.parseKeys(this.keys) : undefined;\n const parsedMacKeys = this.macKeys ? this.parseKeys(this.macKeys) : undefined;\n\n // Define the action: custom action or default click behavior\n const shortcutAction: Action = () => {\n if (this.action) {\n this.action();\n } else {\n // Trigger click on the host element\n this.elementRef.nativeElement.click();\n }\n // Emit the triggered event\n this.triggered.emit();\n };\n\n // Register the shortcut\n try {\n this.keyboardShortcuts.register({\n id: this.generatedId,\n keys: parsedKeys,\n macKeys: parsedMacKeys,\n steps: this.steps,\n macSteps: this.macSteps,\n action: shortcutAction,\n description: this.description,\n });\n this.isRegistered = true;\n } catch (error) {\n console.error(`[ngxKeys] Failed to register shortcut:`, error);\n throw error;\n }\n }\n\n ngOnDestroy(): void {\n // Automatically unregister the shortcut when the directive is destroyed\n if (this.isRegistered) {\n try {\n this.keyboardShortcuts.unregister(this.generatedId);\n } catch (error) {\n // Silently handle unregister errors (shortcut might have been manually removed)\n console.warn(`[ngxKeys] Failed to unregister shortcut ${this.generatedId}:`, error);\n }\n }\n }\n\n /**\n * Parse comma-separated key string into an array\n * Example: \"ctrl,s\" -> [\"ctrl\", \"s\"]\n */\n private parseKeys(keysString: string): string[] {\n return keysString\n .split(',')\n .map(key => key.trim())\n .filter(key => key.length > 0);\n }\n\n /**\n * Generate a unique ID for the shortcut based on the element and keys\n */\n private generateUniqueId(): string {\n const timestamp = Date.now();\n const random = Math.random().toString(36).substring(2, 9);\n const keysStr = this.keys || this.steps?.flat().join('-') || 'unknown';\n return `ngx-shortcut-${keysStr}-${timestamp}-${random}`;\n }\n\n /**\n * Validate that required inputs are provided correctly\n */\n private validateInputs(): void {\n const hasSingleStep = this.keys || this.macKeys;\n const hasMultiStep = this.steps || this.macSteps;\n\n if (!hasSingleStep && !hasMultiStep) {\n throw new Error(\n `[ngxKeys] Must provide either 'keys'/'macKeys' for single-step shortcuts or 'steps'/'macSteps' for multi-step shortcuts.`\n );\n }\n\n if (hasSingleStep && hasMultiStep) {\n throw new Error(\n `[ngxKeys] Cannot use both single-step ('keys'/'macKeys') and multi-step ('steps'/'macSteps') inputs simultaneously. Choose one approach.`\n );\n }\n\n if (!this.description) {\n throw new Error(\n `[ngxKeys] 'description' input is required.`\n );\n }\n }\n}\n","/*\n * Public API Surface of ngx-keys\n */\n\nexport * from './lib/core/keyboard-shortcuts.service';\nexport * from './lib/models/keyboard-shortcut.interface';\nexport * from './lib/errors/keyboard-shortcuts.errors';\nexport { \n KEYBOARD_SHORTCUTS_CONFIG,\n provideKeyboardShortcutsConfig\n} from './lib/config/keyboard-shortcuts.config';\nexport type { KeyboardShortcutsConfig } from './lib/config/keyboard-shortcuts.config';\nexport { KeyboardShortcutDirective } from './lib/directives/keyboard-shortcut.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;AAGG;AACI,MAAM,uBAAuB,GAAG;;IAErC,2BAA2B,EAAE,CAAC,EAAU,KAAK,CAAA,UAAA,EAAa,EAAE,CAAA,oBAAA,CAAsB;IAClF,wBAAwB,EAAE,CAAC,EAAU,KAAK,CAAA,OAAA,EAAU,EAAE,CAAA,oBAAA,CAAsB;IAC5E,YAAY,EAAE,CAAC,UAAkB,KAAK,CAAA,mBAAA,EAAsB,UAAU,CAAA,CAAA,CAAG;IACzE,mBAAmB,EAAE,CAAC,UAAkB,KAAK,CAAA,mCAAA,EAAsC,UAAU,CAAA,CAAA,CAAG;AAChG,IAAA,uBAAuB,EAAE,CAAC,UAAkB,EAAE,WAAqB,KAAK,CAAA,iBAAA,EAAoB,UAAU,4CAA4C,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE;AAC1K,IAAA,6BAA6B,EAAE,CAAC,OAAe,EAAE,WAAqB,KAAK,CAAA,uBAAA,EAA0B,OAAO,4CAA4C,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE;AA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