wulf.js 1.9.2 → 1.9.3

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.
Files changed (55) hide show
  1. package/README.md +6 -0
  2. package/changelog.md +45 -0
  3. package/dist/focus-trap.esm.js +62 -9
  4. package/dist/focus-trap.esm.js.map +2 -2
  5. package/dist/focus-trap.global.js +64 -11
  6. package/dist/focus-trap.global.js.map +2 -2
  7. package/dist/focus-trap.global.min.js +3 -3
  8. package/dist/focus-trap.global.min.js.map +3 -3
  9. package/dist/index.esm.js +364 -107
  10. package/dist/index.esm.js.map +2 -2
  11. package/dist/index.global.js +366 -109
  12. package/dist/index.global.js.map +2 -2
  13. package/dist/index.global.min.js +3 -3
  14. package/dist/index.global.min.js.map +3 -3
  15. package/dist/mask.esm.js +66 -22
  16. package/dist/mask.esm.js.map +2 -2
  17. package/dist/mask.global.js +68 -24
  18. package/dist/mask.global.js.map +2 -2
  19. package/dist/mask.global.min.js +3 -3
  20. package/dist/mask.global.min.js.map +3 -3
  21. package/dist/masonry.esm.js +96 -40
  22. package/dist/masonry.esm.js.map +2 -2
  23. package/dist/masonry.global.js +98 -42
  24. package/dist/masonry.global.js.map +2 -2
  25. package/dist/masonry.global.min.js +3 -3
  26. package/dist/masonry.global.min.js.map +3 -3
  27. package/dist/scroll.esm.js +66 -28
  28. package/dist/scroll.esm.js.map +2 -2
  29. package/dist/scroll.global.js +68 -30
  30. package/dist/scroll.global.js.map +2 -2
  31. package/dist/scroll.global.min.js +4 -4
  32. package/dist/scroll.global.min.js.map +3 -3
  33. package/dist/shortcut.esm.js +53 -6
  34. package/dist/shortcut.esm.js.map +3 -3
  35. package/dist/shortcut.global.js +55 -8
  36. package/dist/shortcut.global.js.map +2 -2
  37. package/dist/shortcut.global.min.js +2 -2
  38. package/dist/shortcut.global.min.js.map +3 -3
  39. package/dist/toast.css +1 -1
  40. package/dist/toast.css.map +2 -2
  41. package/dist/toast.esm.js +109 -44
  42. package/dist/toast.esm.js.map +2 -2
  43. package/dist/toast.global.js +111 -46
  44. package/dist/toast.global.js.map +2 -2
  45. package/dist/toast.global.min.js +4 -4
  46. package/dist/toast.global.min.js.map +3 -3
  47. package/dist/types/focus-trap/FocusTrap.d.ts +2 -0
  48. package/dist/types/mask/AmountEngine.d.ts +1 -0
  49. package/dist/types/mask/BaseInputMask.d.ts +4 -0
  50. package/dist/types/mask/InputAmountMask.d.ts +1 -0
  51. package/dist/types/mask/InputMask.d.ts +1 -0
  52. package/dist/types/shortcut/ShortcutManager.d.ts +4 -0
  53. package/dist/types/toast/ToastInstance.d.ts +1 -1
  54. package/dist/types/toast/types.d.ts +5 -0
  55. package/package.json +5 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/shortcut/ShortcutFormatter.ts", "../src/shortcut/ShortcutManager.ts"],
4
- "sourcesContent": ["import { NormalizedStep } from './types';\n\n/**\n * Utilitaires de d\u00E9tection d'OS, de parsing de cha\u00EEnes et de formatage de raccourcis.\n */\nexport class ShortcutFormatter {\n /**\n * D\u00E9tecte si l'environnement d'ex\u00E9cution actuel est un environnement Apple (macOS / iOS / iPadOS).\n */\n public static isApple(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n // 1. D\u00E9tection moderne via User-Agent Client Hints (si disponible)\n const uaData = (navigator as unknown as { userAgentData?: { platform?: string } }).userAgentData;\n if (uaData && typeof uaData.platform === 'string') {\n const p = uaData.platform.toLowerCase();\n if (p.includes('mac') || p.includes('ios')) {\n return true;\n }\n }\n\n // 2. D\u00E9tection via navigator.platform\n const platform = (navigator.platform || '').toLowerCase();\n if (platform.includes('mac') || platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) {\n return true;\n }\n\n // 3. D\u00E9tection de secours via User-Agent\n const ua = (navigator.userAgent || '').toLowerCase();\n return ua.includes('macintosh') || ua.includes('mac os x') || ua.includes('ipad') || ua.includes('iphone');\n }\n\n /**\n * Normalise un nom de touche unitaire pour les comparaisons.\n */\n public static normalizeKeyName(key: string): string {\n const k = key.trim().toLowerCase();\n switch (k) {\n case 'esc':\n return 'escape';\n case 'return':\n return 'enter';\n case 'space':\n case 'spacebar':\n return ' ';\n case 'del':\n return 'delete';\n case 'ins':\n return 'insert';\n case 'up':\n return 'arrowup';\n case 'down':\n return 'arrowdown';\n case 'left':\n return 'arrowleft';\n case 'right':\n return 'arrowright';\n default:\n return k;\n }\n }\n\n /**\n * Parse une cha\u00EEne de combinaison (ex: \"Mod+K\", \"g i\", \"Shift+?\", \"Alt++\")\n * et retourne la liste des \u00E9tapes normalis\u00E9es n\u00E9cessaires au d\u00E9clenchement.\n */\n public static parseCombo(combo: string, isApple: boolean = ShortcutFormatter.isApple()): NormalizedStep[] {\n const trimmed = combo.trim();\n if (!trimmed) {\n return [];\n }\n\n // D\u00E9coupage en \u00E9tapes pour les s\u00E9quences (ex: \"g i\" -> [\"g\", \"i\"])\n // Attention : on s\u00E9pare par espaces, sauf si l'espace est la touche elle-m\u00EAme (\"space\")\n const stepsRaw = trimmed.split(/\\s+/);\n const steps: NormalizedStep[] = [];\n\n for (const rawStep of stepsRaw) {\n // D\u00E9coupage de chaque accord sur le symbole '+' (gestion du cas '++' pour la touche '+')\n const tokens: string[] = [];\n let currentToken = '';\n\n for (let i = 0; i < rawStep.length; i++) {\n const char = rawStep[i];\n if (char === '+') {\n // Si le token actuel est vide et qu'on a d\u00E9j\u00E0 des tokens, c'est que c'est un '+' litt\u00E9ral (ex: \"Ctrl++\")\n if (currentToken === '' && tokens.length > 0) {\n tokens.push('+');\n } else if (currentToken !== '') {\n tokens.push(currentToken);\n currentToken = '';\n }\n } else {\n currentToken += char;\n }\n }\n if (currentToken !== '') {\n tokens.push(currentToken);\n }\n\n let ctrl = false;\n let alt = false;\n let shift = false;\n let meta = false;\n let mainKey = '';\n\n for (const token of tokens) {\n const lower = token.trim().toLowerCase();\n if (lower === 'ctrl' || lower === 'control') {\n ctrl = true;\n } else if (lower === 'alt' || lower === 'option' || lower === 'opt') {\n alt = true;\n } else if (lower === 'shift' || lower === 'maj') {\n shift = true;\n } else if (lower === 'cmd' || lower === 'command' || lower === 'meta' || lower === 'win' || lower === 'super') {\n meta = true;\n } else if (lower === 'mod' || lower === '$mod') {\n if (isApple) {\n meta = true;\n } else {\n ctrl = true;\n }\n } else {\n // Touche principale\n mainKey = ShortcutFormatter.normalizeKeyName(token);\n }\n }\n\n steps.push({\n ctrl,\n alt,\n shift,\n meta,\n key: mainKey\n });\n }\n\n return steps;\n }\n\n /**\n * Formate une combinaison brute en libell\u00E9 soign\u00E9 et lisible pour l'OS cible.\n * Ex: \"Mod+Shift+P\" -> macOS: \"\u21E7\u2318P\", Windows: \"Ctrl+Shift+P\"\n * Ex: \"g i\" -> \"g puis i\" ou \"g i\"\n */\n public static format(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n if (steps.length === 0) {\n return combo;\n }\n\n const formattedSteps = steps.map(step => {\n const parts: string[] = [];\n\n if (isApple) {\n if (step.ctrl) parts.push('\u2303');\n if (step.alt) parts.push('\u2325');\n if (step.shift) parts.push('\u21E7');\n if (step.meta) parts.push('\u2318');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, true);\n parts.push(keyDisplay);\n return parts.join('');\n } else {\n if (step.ctrl) parts.push('Ctrl');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Win');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, false);\n parts.push(keyDisplay);\n return parts.join('+');\n }\n });\n\n return formattedSteps.join(' ');\n }\n\n /**\n * Convertit un combo technique vers le format officiel WAI-ARIA `aria-keyshortcuts`.\n * Standard W3C : les modificateurs sont 'Control', 'Alt', 'Shift', 'Meta' et le s\u00E9parateur est '+'.\n */\n public static toAriaKeyShortcuts(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n return steps.map(step => {\n const parts: string[] = [];\n if (step.ctrl) parts.push('Control');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Meta');\n parts.push(ShortcutFormatter.formatKeyDisplay(step.key, false));\n return parts.join('+');\n }).join(' ');\n }\n\n private static formatKeyDisplay(key: string, isApple: boolean): string {\n if (!key) return '';\n switch (key.toLowerCase()) {\n case 'escape':\n return isApple ? '\u238B' : 'Esc';\n case 'enter':\n return isApple ? '\u21A9' : 'Enter';\n case ' ':\n return isApple ? '\u2423' : 'Space';\n case 'tab':\n return isApple ? '\u21E5' : 'Tab';\n case 'backspace':\n return isApple ? '\u232B' : 'Backspace';\n case 'delete':\n return isApple ? '\u2326' : 'Suppr';\n case 'arrowup':\n return '\u2191';\n case 'arrowdown':\n return '\u2193';\n case 'arrowleft':\n return '\u2190';\n case 'arrowright':\n return '\u2192';\n default:\n return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);\n }\n }\n}\n\n", "import {\n ShortcutDefinition,\n ShortcutManagerOptions,\n ShortcutInfo,\n RegisteredShortcut,\n NormalizedStep\n} from './types';\nimport { ShortcutFormatter } from './ShortcutFormatter';\n\n/**\n * Moteur autonome et modulaire de gestion des raccourcis clavier applicatifs (Wulf.Shortcut).\n * Z\u00E9ro d\u00E9pendance. Conforme \u00E0 l'Axiome Primordial de pr\u00E9servation de la saisie utilisateur.\n */\nexport class ShortcutManager {\n private readonly options: Required<Omit<ShortcutManagerOptions, 'onError'>> & {\n onError?: (error: Error, combo: string) => void;\n };\n private readonly shortcuts: Map<string, RegisteredShortcut> = new Map();\n private scopeStack: string[] = [];\n private sequenceBuffer: { step: NormalizedStep; timestamp: number }[] = [];\n private sequenceTimer: ReturnType<typeof setTimeout> | null = null;\n private isListening = true;\n private boundListener: ((event: KeyboardEvent) => void) | null = null;\n private idCounter = 0;\n\n constructor(options?: ShortcutManagerOptions) {\n this.options = {\n defaultScope: options?.defaultScope || 'global',\n sequenceTimeout: options?.sequenceTimeout ?? 800,\n target: options?.target || (typeof window !== 'undefined' ? window : ({} as Window)),\n onError: options?.onError\n };\n\n this.scopeStack = [this.options.defaultScope];\n this.initListener();\n }\n\n /**\n * V\u00E9rifie si un \u00E9l\u00E9ment DOM est une zone d'\u00E9dition o\u00F9 la saisie de l'utilisateur\n * ne doit JAMAIS \u00EAtre interrompue ou d\u00E9tourn\u00E9e (Axiome Primordial).\n */\n public static isEditable(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n\n const el = target as HTMLElement;\n const tagName = el.tagName.toUpperCase();\n\n // 1. \u00C9l\u00E9ments natifs de formulaire textuel\n if (tagName === 'INPUT') {\n const type = (el as HTMLInputElement).type?.toLowerCase() || 'text';\n // Seuls les types non-textuels ne sont pas consid\u00E9r\u00E9s comme de la saisie libre\n const nonTextTypes = ['button', 'checkbox', 'radio', 'submit', 'reset', 'range', 'color', 'file', 'image'];\n return !nonTextTypes.includes(type);\n }\n if (tagName === 'TEXTAREA' || tagName === 'SELECT') {\n return true;\n }\n\n // 2. \u00C9l\u00E9ments modifiables en ligne (contenteditable)\n if (el.isContentEditable || el.getAttribute('contenteditable') === 'true' || el.getAttribute('contenteditable') === 'plaintext-only') {\n return true;\n }\n\n // 3. R\u00F4les ARIA de saisie\n const role = el.getAttribute('role');\n if (role === 'textbox' || role === 'searchbox') {\n return true;\n }\n\n return false;\n }\n\n /**\n * Enregistre un ou plusieurs raccourcis clavier.\n * Retourne une fonction de nettoyage pour d\u00E9senregistrer imm\u00E9diatement.\n */\n public bind(definition: ShortcutDefinition | ShortcutDefinition[]): () => void {\n const list = Array.isArray(definition) ? definition : [definition];\n const registeredIds: string[] = [];\n\n for (const def of list) {\n if (!def.combo || typeof def.handler !== 'function') {\n continue;\n }\n\n const id = `wulf_shortcut_${++this.idCounter}`;\n const normalizedSteps = ShortcutFormatter.parseCombo(def.combo);\n const isSequence = normalizedSteps.length > 1;\n const formattedCombo = ShortcutFormatter.format(def.combo);\n\n const registered: RegisteredShortcut = {\n ...def,\n id,\n scope: def.scope || 'global',\n category: def.category || 'G\u00E9n\u00E9ral',\n allowInEditable: def.allowInEditable ?? false,\n preventDefault: def.preventDefault ?? true,\n stopPropagation: def.stopPropagation ?? true,\n priority: def.priority ?? 0,\n formattedCombo,\n normalizedSteps,\n isSequence\n };\n\n this.shortcuts.set(id, registered);\n registeredIds.push(id);\n }\n\n // Fonction de d\u00E9sabonnement direct\n return () => {\n for (const id of registeredIds) {\n this.shortcuts.delete(id);\n }\n };\n }\n\n /**\n * Retire tous les raccourcis correspondant \u00E0 une combinaison et \u00E9ventuellement un scope.\n */\n public unbind(combo: string, scope?: string): void {\n const formatted = ShortcutFormatter.format(combo);\n for (const [id, s] of this.shortcuts.entries()) {\n if (s.formattedCombo === formatted || s.combo.trim().toLowerCase() === combo.trim().toLowerCase()) {\n if (!scope || s.scope === scope) {\n this.shortcuts.delete(id);\n }\n }\n }\n }\n\n /**\n * Empile un nouveau scope actif (mode LIFO).\n * Seuls les raccourcis de ce scope (et les omnipr\u00E9sents '*') seront actifs.\n */\n public pushScope(scope: string): void {\n if (scope && typeof scope === 'string') {\n this.scopeStack.push(scope);\n this.clearSequenceBuffer();\n }\n }\n\n /**\n * D\u00E9pile le scope actuel et r\u00E9tablit le pr\u00E9c\u00E9dent.\n * Si un param\u00E8tre `scope` est pass\u00E9, ne retire que si le scope actuel correspond.\n */\n public popScope(scope?: string): string | undefined {\n if (this.scopeStack.length <= 1) {\n return this.scopeStack[0];\n }\n\n if (scope) {\n if (this.getScope() === scope) {\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n return undefined;\n }\n\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n\n /**\n * R\u00E9initialise brutalement la pile pour activer le scope sp\u00E9cifi\u00E9.\n */\n public setScope(scope: string): void {\n this.scopeStack = [scope || this.options.defaultScope];\n this.clearSequenceBuffer();\n }\n\n /**\n * Retourne le scope actuellement actif au sommet de la pile.\n */\n public getScope(): string {\n return this.scopeStack[this.scopeStack.length - 1] || this.options.defaultScope;\n }\n\n /**\n * Retourne une copie de la pile compl\u00E8te des scopes.\n */\n public getScopeStack(): string[] {\n return [...this.scopeStack];\n }\n\n /**\n * Met en pause l'\u00E9coute de tous les raccourcis.\n */\n public pause(): void {\n this.isListening = false;\n this.clearSequenceBuffer();\n }\n\n /**\n * R\u00E9active l'\u00E9coute des raccourcis.\n */\n public resume(): void {\n this.isListening = true;\n }\n\n /**\n * Indique si le gestionnaire est actif et \u00E0 l'\u00E9coute.\n */\n public isActive(): boolean {\n return this.isListening;\n }\n\n /**\n * Retourne le catalogue des raccourcis enregistr\u00E9s (optionnellement filtr\u00E9 par scope).\n */\n public getRegistry(scope?: string): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n if (!scope || shortcut.scope === scope || shortcut.scope === '*') {\n list.push({ ...shortcut });\n }\n }\n return list;\n }\n\n /**\n * Associe l'attribut standard WAI-ARIA `aria-keyshortcuts` sur un \u00E9l\u00E9ment DOM.\n */\n public attachAria(element: HTMLElement, combo: string): void {\n if (element && typeof element.setAttribute === 'function') {\n const ariaValue = ShortcutFormatter.toAriaKeyShortcuts(combo);\n element.setAttribute('aria-keyshortcuts', ariaValue);\n }\n }\n\n /**\n * Formate une combinaison brute selon l'OS courant (\"\u2318K\" ou \"Ctrl+K\").\n */\n public static format(combo: string, isApple?: boolean): string {\n return ShortcutFormatter.format(combo, isApple);\n }\n\n /**\n * D\u00E9truit le gestionnaire : supprime les \u00E9couteurs du DOM et vide toute la m\u00E9moire.\n */\n public destroy(): void {\n this.pause();\n this.removeListener();\n this.shortcuts.clear();\n this.scopeStack = [];\n this.clearSequenceBuffer();\n }\n\n // --- Impl\u00E9mentation Interne ---\n\n private initListener(): void {\n if (typeof window === 'undefined' || !this.options.target) {\n return;\n }\n\n this.boundListener = (event: KeyboardEvent) => this.handleKeyDown(event);\n const target = this.options.target as EventTarget;\n if (typeof target.addEventListener === 'function') {\n target.addEventListener('keydown', this.boundListener as EventListener, false);\n }\n }\n\n private removeListener(): void {\n if (this.boundListener && this.options.target) {\n const target = this.options.target as EventTarget;\n if (typeof target.removeEventListener === 'function') {\n target.removeEventListener('keydown', this.boundListener as EventListener, false);\n }\n this.boundListener = null;\n }\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (!this.isListening) {\n return;\n }\n\n // Touches modificatrices isol\u00E9es : on ne fait rien\n const k = (event.key || '').toLowerCase();\n if (['control', 'alt', 'shift', 'meta'].includes(k)) {\n return;\n }\n\n const currentScope = this.getScope();\n const isEditable = ShortcutManager.isEditable(event.target);\n\n // Extraction du pas de touche actuel\n const currentStep: NormalizedStep = {\n ctrl: event.ctrlKey,\n alt: event.altKey,\n shift: event.shiftKey,\n meta: event.metaKey,\n key: ShortcutFormatter.normalizeKeyName(event.key || '')\n };\n\n const now = Date.now();\n\n // 1. Purge du buffer de s\u00E9quence si le d\u00E9lai est d\u00E9pass\u00E9\n if (this.sequenceBuffer.length > 0) {\n const last = this.sequenceBuffer[this.sequenceBuffer.length - 1];\n if (now - last.timestamp > this.options.sequenceTimeout) {\n this.clearSequenceBuffer();\n }\n }\n\n // Candidats potentiels actifs pour le scope courant\n const activeCandidates = this.getActiveShortcuts(currentScope, isEditable);\n\n // 2. \u00C9valuation des s\u00E9quences temporelles (Key Sequences)\n const proposedSequence = [...this.sequenceBuffer.map(b => b.step), currentStep];\n const matchingSequence = this.findMatchingSequence(activeCandidates, proposedSequence);\n\n if (matchingSequence) {\n this.clearSequenceBuffer();\n this.executeShortcut(matchingSequence, event, currentScope, true);\n return;\n }\n\n // V\u00E9rifier si le pas actuel peut \u00EAtre le pr\u00E9fixe d'une s\u00E9quence enregistr\u00E9e\n if (this.isPrefixOfAnySequence(activeCandidates, proposedSequence)) {\n this.sequenceBuffer.push({ step: currentStep, timestamp: now });\n this.resetSequenceTimer();\n // On bloque l'\u00E9v\u00E9nement pour ne pas d\u00E9clencher un accord unitaire pendant une s\u00E9quence\n if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && !isEditable) {\n event.preventDefault();\n }\n return;\n }\n\n // Si la s\u00E9quence ne m\u00E8ne \u00E0 rien, on vide le buffer\n this.clearSequenceBuffer();\n\n // 3. \u00C9valuation des accords simultan\u00E9s unitaires (Single Chords)\n const matchingChord = this.findMatchingChord(activeCandidates, currentStep, event);\n if (matchingChord) {\n this.executeShortcut(matchingChord, event, currentScope, false);\n }\n }\n\n private getActiveShortcuts(currentScope: string, isEditable: boolean): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n // Filtrage de scope\n if (shortcut.scope !== currentScope && shortcut.scope !== '*') {\n continue;\n }\n // R\u00C8GLE ABSOLUE (Axiome Primordial) : Filtrage des \u00E9l\u00E9ments \u00E9ditables\n if (isEditable && !shortcut.allowInEditable) {\n continue;\n }\n list.push(shortcut);\n }\n\n // Tri par priorit\u00E9 d\u00E9croissante\n return list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }\n\n private stepMatches(step: NormalizedStep, eventStep: NormalizedStep, rawEvent?: KeyboardEvent): boolean {\n if (step.ctrl !== eventStep.ctrl) return false;\n if (step.alt !== eventStep.alt) return false;\n if (step.meta !== eventStep.meta) return false;\n\n // Correspondance de la touche\n const keyMatches =\n step.key === eventStep.key ||\n (rawEvent && step.key === rawEvent.key.toLowerCase());\n\n if (!keyMatches) return false;\n\n // Correspondance Shift :\n // Si la touche sp\u00E9cifie shift: true, l'\u00E9v\u00E9nement doit avoir shiftKey true.\n // Si la touche sp\u00E9cifie shift: false, mais que le caract\u00E8re est un symbole (ex: \"?\")\n // tap\u00E9 avec shift, on tol\u00E8re si la touche correspond exactement.\n if (step.shift === eventStep.shift) {\n return true;\n }\n\n if (!step.shift && eventStep.shift) {\n // Autoris\u00E9 si c'est un caract\u00E8re sp\u00E9cial direct (comme \"?\" ou \"!\")\n if (rawEvent && rawEvent.key === step.key) {\n return true;\n }\n }\n\n return false;\n }\n\n private findMatchingChord(\n candidates: RegisteredShortcut[],\n currentStep: NormalizedStep,\n rawEvent: KeyboardEvent\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (candidate.isSequence || candidate.normalizedSteps.length !== 1) {\n continue;\n }\n\n const step = candidate.normalizedSteps[0];\n if (this.stepMatches(step, currentStep, rawEvent)) {\n return candidate;\n }\n }\n return null;\n }\n\n private findMatchingSequence(\n candidates: RegisteredShortcut[],\n proposed: NormalizedStep[]\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length !== proposed.length) {\n continue;\n }\n\n let allMatch = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n allMatch = false;\n break;\n }\n }\n\n if (allMatch) {\n return candidate;\n }\n }\n return null;\n }\n\n private isPrefixOfAnySequence(candidates: RegisteredShortcut[], proposed: NormalizedStep[]): boolean {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length <= proposed.length) {\n continue;\n }\n\n let prefixMatches = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n prefixMatches = false;\n break;\n }\n }\n\n if (prefixMatches) {\n return true;\n }\n }\n return false;\n }\n\n private executeShortcut(\n shortcut: RegisteredShortcut,\n event: KeyboardEvent,\n scope: string,\n isSequence: boolean\n ): void {\n if (shortcut.preventDefault) {\n event.preventDefault();\n }\n if (shortcut.stopPropagation) {\n event.stopPropagation();\n }\n\n const info: ShortcutInfo = {\n combo: shortcut.combo,\n formattedCombo: shortcut.formattedCombo,\n scope,\n target: event.target,\n isSequence\n };\n\n try {\n shortcut.handler(event, info);\n } catch (err) {\n if (this.options.onError) {\n this.options.onError(err instanceof Error ? err : new Error(String(err)), shortcut.combo);\n } else {\n console.error(`[Wulf.Shortcut] Erreur lors de l'ex\u00E9cution du raccourci \"${shortcut.combo}\":`, err);\n }\n }\n }\n\n private resetSequenceTimer(): void {\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n }\n this.sequenceTimer = setTimeout(() => {\n this.clearSequenceBuffer();\n }, this.options.sequenceTimeout);\n }\n\n private clearSequenceBuffer(): void {\n this.sequenceBuffer = [];\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n this.sequenceTimer = null;\n }\n }\n}\n\n"],
5
- "mappings": ";AAKO,IAAM,oBAAN,MAAM,mBAAkB;AAAA;AAAA;AAAA;AAAA,EAI7B,OAAc,UAAmB;AAC/B,QAAI,OAAO,cAAc,aAAa;AACpC,aAAO;AAAA,IACT;AAGA,UAAM,SAAU,UAAmE;AACnF,QAAI,UAAU,OAAO,OAAO,aAAa,UAAU;AACjD,YAAM,IAAI,OAAO,SAAS,YAAY;AACtC,UAAI,EAAE,SAAS,KAAK,KAAK,EAAE,SAAS,KAAK,GAAG;AAC1C,eAAO;AAAA,MACT;AAAA,IACF;AAGA,UAAM,YAAY,UAAU,YAAY,IAAI,YAAY;AACxD,QAAI,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,QAAQ,KAAK,SAAS,SAAS,MAAM,KAAK,SAAS,SAAS,MAAM,GAAG;AACrH,aAAO;AAAA,IACT;AAGA,UAAM,MAAM,UAAU,aAAa,IAAI,YAAY;AACnD,WAAO,GAAG,SAAS,WAAW,KAAK,GAAG,SAAS,UAAU,KAAK,GAAG,SAAS,MAAM,KAAK,GAAG,SAAS,QAAQ;AAAA,EAC3G;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,iBAAiB,KAAqB;AAClD,UAAM,IAAI,IAAI,KAAK,EAAE,YAAY;AACjC,YAAQ,GAAG;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AAAA,MACL,KAAK;AACH,eAAO;AAAA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AK,eAAe;AACtB,mBAAa,KAAK,aAAa;AAAA,IACjC;AACA,SAAK,gBAAgB,WAAW,MAAM;AACpC,WAAK,oBAAoB;AAAA,IAC3B,GAAG,KAAK,QAAQ,eAAe;AAAA,EACjC;AAAA,EAEQ,sBAA4B;AAClC,SAAK,iBAAiB,CAAC;AACvB,QAAI,KAAK,eAAe;AACtB,mBAAa,KAAK,aAAa;AAC/B,WAAK,gBAAgB;AAAA,IACvB;AAAA,EACF;AACF;",
3
+ "sources": ["../src/shortcut/ShortcutFormatter.ts", "../src/shortcut/ShortcutManager.ts", "../src/shortcut/index.ts"],
4
+ "sourcesContent": ["import { NormalizedStep } from './types';\n\n/**\n * Utilitaires de d\u00E9tection d'OS, de parsing de cha\u00EEnes et de formatage de raccourcis.\n */\nexport class ShortcutFormatter {\n /**\n * D\u00E9tecte si l'environnement d'ex\u00E9cution actuel est un environnement Apple (macOS / iOS / iPadOS).\n */\n public static isApple(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n // 1. D\u00E9tection moderne via User-Agent Client Hints (si disponible)\n const uaData = (navigator as unknown as { userAgentData?: { platform?: string } }).userAgentData;\n if (uaData && typeof uaData.platform === 'string') {\n const p = uaData.platform.toLowerCase();\n if (p.includes('mac') || p.includes('ios')) {\n return true;\n }\n }\n\n // 2. D\u00E9tection via navigator.platform\n const platform = (navigator.platform || '').toLowerCase();\n if (platform.includes('mac') || platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) {\n return true;\n }\n\n // 3. D\u00E9tection de secours via User-Agent\n const ua = (navigator.userAgent || '').toLowerCase();\n return ua.includes('macintosh') || ua.includes('mac os x') || ua.includes('ipad') || ua.includes('iphone');\n }\n\n /**\n * Normalise un nom de touche unitaire pour les comparaisons.\n */\n public static normalizeKeyName(key: string): string {\n const k = key.trim().toLowerCase();\n switch (k) {\n case 'esc':\n return 'escape';\n case 'return':\n return 'enter';\n case 'space':\n case 'spacebar':\n return ' ';\n case 'del':\n return 'delete';\n case 'ins':\n return 'insert';\n case 'up':\n return 'arrowup';\n case 'down':\n return 'arrowdown';\n case 'left':\n return 'arrowleft';\n case 'right':\n return 'arrowright';\n default:\n return k;\n }\n }\n\n /**\n * Parse une cha\u00EEne de combinaison (ex: \"Mod+K\", \"g i\", \"Shift+?\", \"Alt++\")\n * et retourne la liste des \u00E9tapes normalis\u00E9es n\u00E9cessaires au d\u00E9clenchement.\n */\n public static parseCombo(combo: string, isApple: boolean = ShortcutFormatter.isApple()): NormalizedStep[] {\n if (typeof combo !== 'string') {\n return [];\n }\n const trimmed = combo.slice(0, 512).trim();\n if (!trimmed) {\n return [];\n }\n\n // D\u00E9coupage en \u00E9tapes pour les s\u00E9quences (ex: \"g i\" -> [\"g\", \"i\"]), plafonn\u00E9 \u00E0 10 \u00E9tapes max (anti-DoS)\n // Attention : on s\u00E9pare par espaces, sauf si l'espace est la touche elle-m\u00EAme (\"space\")\n const stepsRaw = trimmed.split(/\\s+/).slice(0, 10);\n const steps: NormalizedStep[] = [];\n\n for (const rawStep of stepsRaw) {\n // D\u00E9coupage de chaque accord sur le symbole '+' (gestion du cas '++' pour la touche '+')\n const tokens: string[] = [];\n let currentToken = '';\n\n for (let i = 0; i < rawStep.length; i++) {\n const char = rawStep[i];\n if (char === '+') {\n // Si le token actuel est vide et qu'on a d\u00E9j\u00E0 des tokens, c'est que c'est un '+' litt\u00E9ral (ex: \"Ctrl++\")\n if (currentToken === '' && tokens.length > 0) {\n tokens.push('+');\n } else if (currentToken !== '') {\n tokens.push(currentToken);\n currentToken = '';\n }\n } else {\n currentToken += char;\n }\n }\n if (currentToken !== '') {\n tokens.push(currentToken);\n }\n\n let ctrl = false;\n let alt = false;\n let shift = false;\n let meta = false;\n let mainKey = '';\n\n for (const token of tokens) {\n const lower = token.trim().toLowerCase();\n if (lower === 'ctrl' || lower === 'control') {\n ctrl = true;\n } else if (lower === 'alt' || lower === 'option' || lower === 'opt') {\n alt = true;\n } else if (lower === 'shift' || lower === 'maj') {\n shift = true;\n } else if (lower === 'cmd' || lower === 'command' || lower === 'meta' || lower === 'win' || lower === 'super') {\n meta = true;\n } else if (lower === 'mod' || lower === '$mod') {\n if (isApple) {\n meta = true;\n } else {\n ctrl = true;\n }\n } else {\n // Touche principale\n mainKey = ShortcutFormatter.normalizeKeyName(token);\n }\n }\n\n steps.push({\n ctrl,\n alt,\n shift,\n meta,\n key: mainKey\n });\n }\n\n return steps;\n }\n\n /**\n * Formate une combinaison brute en libell\u00E9 soign\u00E9 et lisible pour l'OS cible.\n * Ex: \"Mod+Shift+P\" -> macOS: \"\u21E7\u2318P\", Windows: \"Ctrl+Shift+P\"\n * Ex: \"g i\" -> \"g puis i\" ou \"g i\"\n */\n public static format(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n if (steps.length === 0) {\n return combo;\n }\n\n const formattedSteps = steps.map(step => {\n const parts: string[] = [];\n\n if (isApple) {\n if (step.ctrl) parts.push('\u2303');\n if (step.alt) parts.push('\u2325');\n if (step.shift) parts.push('\u21E7');\n if (step.meta) parts.push('\u2318');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, true);\n parts.push(keyDisplay);\n return parts.join('');\n } else {\n if (step.ctrl) parts.push('Ctrl');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Win');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, false);\n parts.push(keyDisplay);\n return parts.join('+');\n }\n });\n\n return formattedSteps.join(' ');\n }\n\n /**\n * Convertit un combo technique vers le format officiel WAI-ARIA `aria-keyshortcuts`.\n * Standard W3C : les modificateurs sont 'Control', 'Alt', 'Shift', 'Meta' et le s\u00E9parateur est '+'.\n */\n public static toAriaKeyShortcuts(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n return steps.map(step => {\n const parts: string[] = [];\n if (step.ctrl) parts.push('Control');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Meta');\n parts.push(ShortcutFormatter.formatKeyDisplay(step.key, false));\n return parts.join('+');\n }).join(' ');\n }\n\n private static formatKeyDisplay(key: string, isApple: boolean): string {\n if (!key) return '';\n switch (key.toLowerCase()) {\n case 'escape':\n return isApple ? '\u238B' : 'Esc';\n case 'enter':\n return isApple ? '\u21A9' : 'Enter';\n case ' ':\n return isApple ? '\u2423' : 'Space';\n case 'tab':\n return isApple ? '\u21E5' : 'Tab';\n case 'backspace':\n return isApple ? '\u232B' : 'Backspace';\n case 'delete':\n return isApple ? '\u2326' : 'Suppr';\n case 'arrowup':\n return '\u2191';\n case 'arrowdown':\n return '\u2193';\n case 'arrowleft':\n return '\u2190';\n case 'arrowright':\n return '\u2192';\n default:\n return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);\n }\n }\n}\n\n", "import {\n ShortcutDefinition,\n ShortcutManagerOptions,\n ShortcutInfo,\n RegisteredShortcut,\n NormalizedStep\n} from './types';\nimport { ShortcutFormatter } from './ShortcutFormatter';\n\n/**\n * Moteur autonome et modulaire de gestion des raccourcis clavier applicatifs (Wulf.Shortcut).\n * Z\u00E9ro d\u00E9pendance. Conforme \u00E0 l'Axiome Primordial de pr\u00E9servation de la saisie utilisateur.\n */\nexport class ShortcutManager {\n private readonly options: Required<Omit<ShortcutManagerOptions, 'onError'>> & {\n onError?: (error: Error, combo: string) => void;\n };\n private readonly shortcuts: Map<string, RegisteredShortcut> = new Map();\n private scopeStack: string[] = [];\n private sequenceBuffer: { step: NormalizedStep; timestamp: number }[] = [];\n private sequenceTimer: ReturnType<typeof setTimeout> | null = null;\n private isListening = true;\n private boundListener: ((event: KeyboardEvent) => void) | null = null;\n private idCounter = 0;\n\n constructor(options?: ShortcutManagerOptions) {\n this.options = {\n defaultScope: options?.defaultScope || 'global',\n sequenceTimeout: options?.sequenceTimeout ?? 800,\n target: options?.target || (typeof window !== 'undefined' ? window : ({} as Window)),\n onError: options?.onError\n };\n\n this.scopeStack = [this.options.defaultScope];\n this.initListener();\n }\n\n /**\n * V\u00E9rifie si un \u00E9l\u00E9ment DOM est une zone d'\u00E9dition o\u00F9 la saisie de l'utilisateur\n * ne doit JAMAIS \u00EAtre interrompue ou d\u00E9tourn\u00E9e (Axiome Primordial).\n */\n public static isEditable(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n\n const el = target as HTMLElement;\n const tagName = el.tagName.toUpperCase();\n\n // 1. \u00C9l\u00E9ments natifs de formulaire textuel\n if (tagName === 'INPUT') {\n const type = (el as HTMLInputElement).type?.toLowerCase() || 'text';\n // Seuls les types non-textuels ne sont pas consid\u00E9r\u00E9s comme de la saisie libre\n const nonTextTypes = ['button', 'checkbox', 'radio', 'submit', 'reset', 'range', 'color', 'file', 'image'];\n return !nonTextTypes.includes(type);\n }\n if (tagName === 'TEXTAREA' || tagName === 'SELECT') {\n return true;\n }\n\n // 2. \u00C9l\u00E9ments modifiables en ligne (contenteditable)\n if (\n el.isContentEditable ||\n el.getAttribute('contenteditable') === 'true' ||\n el.getAttribute('contenteditable') === 'plaintext-only' ||\n el.getAttribute('contenteditable') === ''\n ) {\n return true;\n }\n\n // 3. R\u00F4les ARIA de saisie\n const role = el.getAttribute('role');\n if (role === 'textbox' || role === 'searchbox') {\n return true;\n }\n\n // 4. \u00C9l\u00E9ment enfant situ\u00E9 \u00E0 l'int\u00E9rieur d'un conteneur contenteditable ou ARIA textbox/searchbox\n if (typeof el.closest === 'function') {\n const editableAncestor = el.closest(\n '[contenteditable=\"true\"], [contenteditable=\"plaintext-only\"], [contenteditable=\"\"], [role=\"textbox\"], [role=\"searchbox\"]'\n );\n if (editableAncestor) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * V\u00E9rifie si la cible est un champ de mot de passe (sanctuaire anti-keylogging).\n */\n private static isPasswordField(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n const el = target as HTMLInputElement;\n return el.tagName.toUpperCase() === 'INPUT' && (el.type || '').toLowerCase() === 'password';\n }\n\n /**\n * Enregistre un ou plusieurs raccourcis clavier.\n * Retourne une fonction de nettoyage pour d\u00E9senregistrer imm\u00E9diatement.\n */\n public bind(definition: ShortcutDefinition | ShortcutDefinition[]): () => void {\n const list = Array.isArray(definition) ? definition : [definition];\n const registeredIds: string[] = [];\n\n for (const def of list) {\n if (!def.combo || typeof def.handler !== 'function') {\n continue;\n }\n\n const id = `wulf_shortcut_${++this.idCounter}`;\n const normalizedSteps = ShortcutFormatter.parseCombo(def.combo);\n const isSequence = normalizedSteps.length > 1;\n const formattedCombo = ShortcutFormatter.format(def.combo);\n\n const registered: RegisteredShortcut = {\n ...def,\n id,\n scope: def.scope || 'global',\n category: def.category || 'G\u00E9n\u00E9ral',\n allowInEditable: def.allowInEditable ?? false,\n preventDefault: def.preventDefault ?? true,\n stopPropagation: def.stopPropagation ?? true,\n priority: def.priority ?? 0,\n formattedCombo,\n normalizedSteps,\n isSequence\n };\n\n this.shortcuts.set(id, registered);\n registeredIds.push(id);\n }\n\n // Fonction de d\u00E9sabonnement direct\n return () => {\n for (const id of registeredIds) {\n this.shortcuts.delete(id);\n }\n };\n }\n\n /**\n * Retire tous les raccourcis correspondant \u00E0 une combinaison et \u00E9ventuellement un scope.\n */\n public unbind(combo: string, scope?: string): void {\n const formatted = ShortcutFormatter.format(combo);\n for (const [id, s] of this.shortcuts.entries()) {\n if (s.formattedCombo === formatted || s.combo.trim().toLowerCase() === combo.trim().toLowerCase()) {\n if (!scope || s.scope === scope) {\n this.shortcuts.delete(id);\n }\n }\n }\n }\n\n /**\n * Empile un nouveau scope actif (mode LIFO).\n * Seuls les raccourcis de ce scope (et les omnipr\u00E9sents '*') seront actifs.\n */\n public pushScope(scope: string): void {\n if (scope && typeof scope === 'string') {\n if (this.scopeStack.length >= 64) {\n return;\n }\n this.scopeStack.push(scope);\n this.clearSequenceBuffer();\n }\n }\n\n /**\n * D\u00E9pile le scope actuel et r\u00E9tablit le pr\u00E9c\u00E9dent.\n * Si un param\u00E8tre `scope` est pass\u00E9, ne retire que si le scope actuel correspond.\n */\n public popScope(scope?: string): string | undefined {\n if (this.scopeStack.length <= 1) {\n return this.scopeStack[0];\n }\n\n if (scope) {\n if (this.getScope() === scope) {\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n return undefined;\n }\n\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n\n /**\n * R\u00E9initialise brutalement la pile pour activer le scope sp\u00E9cifi\u00E9.\n */\n public setScope(scope: string): void {\n this.scopeStack = [scope || this.options.defaultScope];\n this.clearSequenceBuffer();\n }\n\n /**\n * Retourne le scope actuellement actif au sommet de la pile.\n */\n public getScope(): string {\n return this.scopeStack[this.scopeStack.length - 1] || this.options.defaultScope;\n }\n\n /**\n * Retourne une copie de la pile compl\u00E8te des scopes.\n */\n public getScopeStack(): string[] {\n return [...this.scopeStack];\n }\n\n /**\n * Met en pause l'\u00E9coute de tous les raccourcis.\n */\n public pause(): void {\n this.isListening = false;\n this.clearSequenceBuffer();\n }\n\n /**\n * R\u00E9active l'\u00E9coute des raccourcis.\n */\n public resume(): void {\n this.isListening = true;\n }\n\n /**\n * Indique si le gestionnaire est actif et \u00E0 l'\u00E9coute.\n */\n public isActive(): boolean {\n return this.isListening;\n }\n\n /**\n * Retourne le catalogue des raccourcis enregistr\u00E9s (optionnellement filtr\u00E9 par scope).\n */\n public getRegistry(scope?: string): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n if (!scope || shortcut.scope === scope || shortcut.scope === '*') {\n list.push({ ...shortcut });\n }\n }\n return list;\n }\n\n /**\n * Associe l'attribut standard WAI-ARIA `aria-keyshortcuts` sur un \u00E9l\u00E9ment DOM.\n */\n public attachAria(element: HTMLElement, combo: string): void {\n if (element && typeof element.setAttribute === 'function') {\n const ariaValue = ShortcutFormatter.toAriaKeyShortcuts(combo);\n element.setAttribute('aria-keyshortcuts', ariaValue);\n }\n }\n\n /**\n * Formate une combinaison brute selon l'OS courant (\"\u2318K\" ou \"Ctrl+K\").\n */\n public static format(combo: string, isApple?: boolean): string {\n return ShortcutFormatter.format(combo, isApple);\n }\n\n /**\n * D\u00E9truit le gestionnaire : supprime les \u00E9couteurs du DOM et vide toute la m\u00E9moire.\n */\n public destroy(): void {\n this.pause();\n this.removeListener();\n this.shortcuts.clear();\n this.scopeStack = [];\n this.clearSequenceBuffer();\n }\n\n // --- Impl\u00E9mentation Interne ---\n\n private initListener(): void {\n if (typeof window === 'undefined' || !this.options.target) {\n return;\n }\n\n this.boundListener = (event: KeyboardEvent) => this.handleKeyDown(event);\n const target = this.options.target as EventTarget;\n if (typeof target.addEventListener === 'function') {\n target.addEventListener('keydown', this.boundListener as EventListener, false);\n }\n }\n\n private removeListener(): void {\n if (this.boundListener && this.options.target) {\n const target = this.options.target as EventTarget;\n if (typeof target.removeEventListener === 'function') {\n target.removeEventListener('keydown', this.boundListener as EventListener, false);\n }\n this.boundListener = null;\n }\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (!this.isListening) {\n return;\n }\n\n // Touches modificatrices isol\u00E9es : on ne fait rien\n const k = (event.key || '').toLowerCase();\n if (['control', 'alt', 'shift', 'meta'].includes(k)) {\n return;\n }\n\n const currentScope = this.getScope();\n const composed = typeof event.composedPath === 'function' ? event.composedPath() : [];\n const actualTarget = (composed.length > 0 ? composed[0] : event.target) as EventTarget | null;\n const isEditable = ShortcutManager.isEditable(actualTarget) || ShortcutManager.isEditable(event.target);\n const isPasswordInput = ShortcutManager.isPasswordField(actualTarget) || ShortcutManager.isPasswordField(event.target);\n\n // Extraction du pas de touche actuel\n const currentStep: NormalizedStep = {\n ctrl: event.ctrlKey,\n alt: event.altKey,\n shift: event.shiftKey,\n meta: event.metaKey,\n key: ShortcutFormatter.normalizeKeyName(event.key || '')\n };\n\n const now = Date.now();\n\n // 1. Purge du buffer de s\u00E9quence si le d\u00E9lai est d\u00E9pass\u00E9\n if (this.sequenceBuffer.length > 0) {\n const last = this.sequenceBuffer[this.sequenceBuffer.length - 1];\n if (now - last.timestamp > this.options.sequenceTimeout) {\n this.clearSequenceBuffer();\n }\n }\n\n // Candidats potentiels actifs pour le scope courant\n const activeCandidates = this.getActiveShortcuts(currentScope, isEditable, isPasswordInput);\n\n // 2. \u00C9valuation des s\u00E9quences temporelles (Key Sequences)\n const proposedSequence = [...this.sequenceBuffer.map(b => b.step), currentStep];\n const matchingSequence = this.findMatchingSequence(activeCandidates, proposedSequence);\n\n if (matchingSequence) {\n this.clearSequenceBuffer();\n this.executeShortcut(matchingSequence, event, currentScope, true);\n return;\n }\n\n // V\u00E9rifier si le pas actuel peut \u00EAtre le pr\u00E9fixe d'une s\u00E9quence enregistr\u00E9e\n if (this.isPrefixOfAnySequence(activeCandidates, proposedSequence)) {\n this.sequenceBuffer.push({ step: currentStep, timestamp: now });\n this.resetSequenceTimer();\n // On bloque l'\u00E9v\u00E9nement pour ne pas d\u00E9clencher un accord unitaire pendant une s\u00E9quence\n if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && !isEditable) {\n event.preventDefault();\n }\n return;\n }\n\n // Si la s\u00E9quence ne m\u00E8ne \u00E0 rien, on vide le buffer\n this.clearSequenceBuffer();\n\n // 3. \u00C9valuation des accords simultan\u00E9s unitaires (Single Chords)\n const matchingChord = this.findMatchingChord(activeCandidates, currentStep, event);\n if (matchingChord) {\n this.executeShortcut(matchingChord, event, currentScope, false);\n }\n }\n\n private getActiveShortcuts(\n currentScope: string,\n isEditable: boolean,\n isPasswordInput: boolean = false\n ): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n // Filtrage de scope\n if (shortcut.scope !== currentScope && shortcut.scope !== '*') {\n continue;\n }\n // R\u00C8GLE ABSOLUE (Axiome Primordial) : Filtrage des \u00E9l\u00E9ments \u00E9ditables\n if (isEditable && !shortcut.allowInEditable) {\n continue;\n }\n // Sanctuaire Password : m\u00EAme avec allowInEditable: true, interdire les s\u00E9quences et touches imprimables sans modificateur\n if (isPasswordInput) {\n if (shortcut.isSequence) {\n continue;\n }\n const firstStep = shortcut.normalizedSteps[0];\n if (firstStep && firstStep.key.length === 1 && !firstStep.ctrl && !firstStep.alt && !firstStep.meta) {\n continue;\n }\n }\n list.push(shortcut);\n }\n\n // Tri par priorit\u00E9 d\u00E9croissante\n return list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }\n\n private stepMatches(step: NormalizedStep, eventStep: NormalizedStep, rawEvent?: KeyboardEvent): boolean {\n if (step.ctrl !== eventStep.ctrl) return false;\n if (step.alt !== eventStep.alt) return false;\n if (step.meta !== eventStep.meta) return false;\n\n // Correspondance de la touche\n const keyMatches =\n step.key === eventStep.key ||\n (rawEvent && step.key === rawEvent.key.toLowerCase());\n\n if (!keyMatches) return false;\n\n // Correspondance Shift :\n // Si la touche sp\u00E9cifie shift: true, l'\u00E9v\u00E9nement doit avoir shiftKey true.\n // Si la touche sp\u00E9cifie shift: false, mais que le caract\u00E8re est un symbole (ex: \"?\")\n // tap\u00E9 avec shift, on tol\u00E8re si la touche correspond exactement.\n if (step.shift === eventStep.shift) {\n return true;\n }\n\n if (!step.shift && eventStep.shift) {\n // Autoris\u00E9 si c'est un caract\u00E8re sp\u00E9cial direct (comme \"?\" ou \"!\")\n if (rawEvent && rawEvent.key === step.key) {\n return true;\n }\n }\n\n return false;\n }\n\n private findMatchingChord(\n candidates: RegisteredShortcut[],\n currentStep: NormalizedStep,\n rawEvent: KeyboardEvent\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (candidate.isSequence || candidate.normalizedSteps.length !== 1) {\n continue;\n }\n\n const step = candidate.normalizedSteps[0];\n if (this.stepMatches(step, currentStep, rawEvent)) {\n return candidate;\n }\n }\n return null;\n }\n\n private findMatchingSequence(\n candidates: RegisteredShortcut[],\n proposed: NormalizedStep[]\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length !== proposed.length) {\n continue;\n }\n\n let allMatch = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n allMatch = false;\n break;\n }\n }\n\n if (allMatch) {\n return candidate;\n }\n }\n return null;\n }\n\n private isPrefixOfAnySequence(candidates: RegisteredShortcut[], proposed: NormalizedStep[]): boolean {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length <= proposed.length) {\n continue;\n }\n\n let prefixMatches = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n prefixMatches = false;\n break;\n }\n }\n\n if (prefixMatches) {\n return true;\n }\n }\n return false;\n }\n\n private executeShortcut(\n shortcut: RegisteredShortcut,\n event: KeyboardEvent,\n scope: string,\n isSequence: boolean\n ): void {\n if (shortcut.preventDefault) {\n event.preventDefault();\n }\n if (shortcut.stopPropagation) {\n event.stopPropagation();\n }\n\n const info: ShortcutInfo = {\n combo: shortcut.combo,\n formattedCombo: shortcut.formattedCombo,\n scope,\n target: event.target,\n isSequence\n };\n\n try {\n shortcut.handler(event, info);\n } catch (err) {\n if (this.options.onError) {\n this.options.onError(err instanceof Error ? err : new Error(String(err)), shortcut.combo);\n } else {\n console.error(`[Wulf.Shortcut] Erreur lors de l'ex\u00E9cution du raccourci \"${shortcut.combo}\":`, err);\n }\n }\n }\n\n private resetSequenceTimer(): void {\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n }\n this.sequenceTimer = setTimeout(() => {\n this.clearSequenceBuffer();\n }, this.options.sequenceTimeout);\n }\n\n private clearSequenceBuffer(): void {\n this.sequenceBuffer = [];\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n this.sequenceTimer = null;\n }\n }\n}\n\n", "import { ShortcutManager } from './ShortcutManager';\nimport { ShortcutFormatter } from './ShortcutFormatter';\n\nexport { ShortcutManager } from './ShortcutManager';\nexport { ShortcutFormatter } from './ShortcutFormatter';\nexport * from './types';\nexport { ShortcutManager as default } from './ShortcutManager';\n\n// Attachement namespace global dans les environnements de navigation (IIFE / Vanilla)\nif (typeof window !== 'undefined') {\n const win = window as unknown as Record<string, unknown>;\n const wulfNamespace = ((win.Wulf as Record<string, unknown>) || {}) as Record<string, unknown>;\n win.Wulf = wulfNamespace;\n\n wulfNamespace.Shortcut = Object.assign(ShortcutManager, {\n ShortcutManager,\n ShortcutFormatter\n });\n}\n\n\n"],
5
+ "mappings": ";AAKO,IAAM,oBAAN,MAAM,mBAAkB;AAAA;AAAA;AAAA;AAAA,EAI7B,OAAc,UAAmB;AAC/B,QAAI,OAAO,cAAc,aAAa;AACpC,aAAO;AAAA,IACT;AAGA,UAAM,SAAU,UAAmE;AACnF,QAAI,UAAU,OAAO,OAAO,aAAa,UAAU;AACjD,YAAM,IAAI,OAAO,SAAS,YAAY;AACtC,UAAI,EAAE,SAAS,KAAK,KAAK,EAAE,SAAS,KAAK,GAAG;AAC1C,eAAO;AAAA,MACT;AAAA,IACF;AAGA,UAAM,YAAY,UAAU,YAAY,IAAI,YAAY;AACxD,QAAI,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,QAAQ,KAAK,SAAS,SAAS,MAAM,KAAK,SAAS,SAAS,MAAM,GAAG;AACrH,aAAO;AAAA,IACT;AAGA,UAAM,MAAM,UAAU,aAAa,IAAI,YAAY;AACnD,WAAO,GAAG,SAAS,WAAW,KAAK,GAAG,SAAS,UAAU,KAAK,GAAG,SAAS,MAAM,KAAK,GAAG,SAAS,QAAQ;AAAA,EAC3G;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,iBAAiB,KAAqB;AAClD,UAAM,IAAI,IAAI,KAAK,EAAE,YAAY;AACjC,YAAQ,GAAG;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;A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AA,EAEQ,sBAA4B;AAClC,SAAK,iBAAiB,CAAC;AACvB,QAAI,KAAK,eAAe;AACtB,mBAAa,KAAK,aAAa;AAC/B,WAAK,gBAAgB;AAAA,IACvB;AAAA,EACF;AACF;;;AC1hBA,IAAI,OAAO,WAAW,aAAa;AACjC,QAAM,MAAM;AACZ,QAAM,gBAAkB,IAAI,QAAoC,CAAC;AACjE,MAAI,OAAO;AAEX,gBAAc,WAAW,OAAO,OAAO,iBAAiB;AAAA,IACtD;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
6
  "names": ["popped"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var Wulf = (() => {
2
+ var __WulfIIFE = (() => {
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -83,11 +83,14 @@ var Wulf = (() => {
83
83
  * et retourne la liste des étapes normalisées nécessaires au déclenchement.
84
84
  */
85
85
  static parseCombo(combo, isApple = _ShortcutFormatter.isApple()) {
86
- const trimmed = combo.trim();
86
+ if (typeof combo !== "string") {
87
+ return [];
88
+ }
89
+ const trimmed = combo.slice(0, 512).trim();
87
90
  if (!trimmed) {
88
91
  return [];
89
92
  }
90
- const stepsRaw = trimmed.split(/\s+/);
93
+ const stepsRaw = trimmed.split(/\s+/).slice(0, 10);
91
94
  const steps = [];
92
95
  for (const rawStep of stepsRaw) {
93
96
  const tokens = [];
@@ -257,15 +260,33 @@ var Wulf = (() => {
257
260
  if (tagName === "TEXTAREA" || tagName === "SELECT") {
258
261
  return true;
259
262
  }
260
- if (el.isContentEditable || el.getAttribute("contenteditable") === "true" || el.getAttribute("contenteditable") === "plaintext-only") {
263
+ if (el.isContentEditable || el.getAttribute("contenteditable") === "true" || el.getAttribute("contenteditable") === "plaintext-only" || el.getAttribute("contenteditable") === "") {
261
264
  return true;
262
265
  }
263
266
  const role = el.getAttribute("role");
264
267
  if (role === "textbox" || role === "searchbox") {
265
268
  return true;
266
269
  }
270
+ if (typeof el.closest === "function") {
271
+ const editableAncestor = el.closest(
272
+ '[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"]'
273
+ );
274
+ if (editableAncestor) {
275
+ return true;
276
+ }
277
+ }
267
278
  return false;
268
279
  }
280
+ /**
281
+ * Vérifie si la cible est un champ de mot de passe (sanctuaire anti-keylogging).
282
+ */
283
+ static isPasswordField(target) {
284
+ if (!target || typeof target.tagName !== "string") {
285
+ return false;
286
+ }
287
+ const el = target;
288
+ return el.tagName.toUpperCase() === "INPUT" && (el.type || "").toLowerCase() === "password";
289
+ }
269
290
  /**
270
291
  * Enregistre un ou plusieurs raccourcis clavier.
271
292
  * Retourne une fonction de nettoyage pour désenregistrer immédiatement.
@@ -322,6 +343,9 @@ var Wulf = (() => {
322
343
  */
323
344
  pushScope(scope) {
324
345
  if (scope && typeof scope === "string") {
346
+ if (this.scopeStack.length >= 64) {
347
+ return;
348
+ }
325
349
  this.scopeStack.push(scope);
326
350
  this.clearSequenceBuffer();
327
351
  }
@@ -450,7 +474,10 @@ var Wulf = (() => {
450
474
  return;
451
475
  }
452
476
  const currentScope = this.getScope();
453
- const isEditable = _ShortcutManager.isEditable(event.target);
477
+ const composed = typeof event.composedPath === "function" ? event.composedPath() : [];
478
+ const actualTarget = composed.length > 0 ? composed[0] : event.target;
479
+ const isEditable = _ShortcutManager.isEditable(actualTarget) || _ShortcutManager.isEditable(event.target);
480
+ const isPasswordInput = _ShortcutManager.isPasswordField(actualTarget) || _ShortcutManager.isPasswordField(event.target);
454
481
  const currentStep = {
455
482
  ctrl: event.ctrlKey,
456
483
  alt: event.altKey,
@@ -465,7 +492,7 @@ var Wulf = (() => {
465
492
  this.clearSequenceBuffer();
466
493
  }
467
494
  }
468
- const activeCandidates = this.getActiveShortcuts(currentScope, isEditable);
495
+ const activeCandidates = this.getActiveShortcuts(currentScope, isEditable, isPasswordInput);
469
496
  const proposedSequence = [...this.sequenceBuffer.map((b) => b.step), currentStep];
470
497
  const matchingSequence = this.findMatchingSequence(activeCandidates, proposedSequence);
471
498
  if (matchingSequence) {
@@ -487,7 +514,7 @@ var Wulf = (() => {
487
514
  this.executeShortcut(matchingChord, event, currentScope, false);
488
515
  }
489
516
  }
490
- getActiveShortcuts(currentScope, isEditable) {
517
+ getActiveShortcuts(currentScope, isEditable, isPasswordInput = false) {
491
518
  const list = [];
492
519
  for (const shortcut of this.shortcuts.values()) {
493
520
  if (shortcut.scope !== currentScope && shortcut.scope !== "*") {
@@ -496,6 +523,15 @@ var Wulf = (() => {
496
523
  if (isEditable && !shortcut.allowInEditable) {
497
524
  continue;
498
525
  }
526
+ if (isPasswordInput) {
527
+ if (shortcut.isSequence) {
528
+ continue;
529
+ }
530
+ const firstStep = shortcut.normalizedSteps[0];
531
+ if (firstStep && firstStep.key.length === 1 && !firstStep.ctrl && !firstStep.alt && !firstStep.meta) {
532
+ continue;
533
+ }
534
+ }
499
535
  list.push(shortcut);
500
536
  }
501
537
  return list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
@@ -604,7 +640,18 @@ var Wulf = (() => {
604
640
  }
605
641
  }
606
642
  };
643
+
644
+ // src/shortcut/index.ts
645
+ if (typeof window !== "undefined") {
646
+ const win = window;
647
+ const wulfNamespace = win.Wulf || {};
648
+ win.Wulf = wulfNamespace;
649
+ wulfNamespace.Shortcut = Object.assign(ShortcutManager, {
650
+ ShortcutManager,
651
+ ShortcutFormatter
652
+ });
653
+ }
607
654
  return __toCommonJS(index_exports);
608
655
  })();
609
- if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast", "FocusTrap", "Shortcut"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
656
+ if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof __WulfIIFE !== "undefined" && __WulfIIFE) { for (var k in __WulfIIFE) { if (Object.prototype.hasOwnProperty.call(__WulfIIFE, k) && k !== "__proto__" && k !== "constructor" && k !== "prototype" && window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: __WulfIIFE[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = __WulfIIFE[k]; } catch (__) {} } } } } }
610
657
  //# sourceMappingURL=shortcut.global.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/shortcut/index.ts", "../src/shortcut/ShortcutFormatter.ts", "../src/shortcut/ShortcutManager.ts"],
4
- "sourcesContent": ["export { ShortcutManager } from './ShortcutManager';\nexport { ShortcutFormatter } from './ShortcutFormatter';\nexport * from './types';\nexport { ShortcutManager as default } from './ShortcutManager';\n\n", "import { NormalizedStep } from './types';\n\n/**\n * Utilitaires de d\u00E9tection d'OS, de parsing de cha\u00EEnes et de formatage de raccourcis.\n */\nexport class ShortcutFormatter {\n /**\n * D\u00E9tecte si l'environnement d'ex\u00E9cution actuel est un environnement Apple (macOS / iOS / iPadOS).\n */\n public static isApple(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n // 1. D\u00E9tection moderne via User-Agent Client Hints (si disponible)\n const uaData = (navigator as unknown as { userAgentData?: { platform?: string } }).userAgentData;\n if (uaData && typeof uaData.platform === 'string') {\n const p = uaData.platform.toLowerCase();\n if (p.includes('mac') || p.includes('ios')) {\n return true;\n }\n }\n\n // 2. D\u00E9tection via navigator.platform\n const platform = (navigator.platform || '').toLowerCase();\n if (platform.includes('mac') || platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) {\n return true;\n }\n\n // 3. D\u00E9tection de secours via User-Agent\n const ua = (navigator.userAgent || '').toLowerCase();\n return ua.includes('macintosh') || ua.includes('mac os x') || ua.includes('ipad') || ua.includes('iphone');\n }\n\n /**\n * Normalise un nom de touche unitaire pour les comparaisons.\n */\n public static normalizeKeyName(key: string): string {\n const k = key.trim().toLowerCase();\n switch (k) {\n case 'esc':\n return 'escape';\n case 'return':\n return 'enter';\n case 'space':\n case 'spacebar':\n return ' ';\n case 'del':\n return 'delete';\n case 'ins':\n return 'insert';\n case 'up':\n return 'arrowup';\n case 'down':\n return 'arrowdown';\n case 'left':\n return 'arrowleft';\n case 'right':\n return 'arrowright';\n default:\n return k;\n }\n }\n\n /**\n * Parse une cha\u00EEne de combinaison (ex: \"Mod+K\", \"g i\", \"Shift+?\", \"Alt++\")\n * et retourne la liste des \u00E9tapes normalis\u00E9es n\u00E9cessaires au d\u00E9clenchement.\n */\n public static parseCombo(combo: string, isApple: boolean = ShortcutFormatter.isApple()): NormalizedStep[] {\n const trimmed = combo.trim();\n if (!trimmed) {\n return [];\n }\n\n // D\u00E9coupage en \u00E9tapes pour les s\u00E9quences (ex: \"g i\" -> [\"g\", \"i\"])\n // Attention : on s\u00E9pare par espaces, sauf si l'espace est la touche elle-m\u00EAme (\"space\")\n const stepsRaw = trimmed.split(/\\s+/);\n const steps: NormalizedStep[] = [];\n\n for (const rawStep of stepsRaw) {\n // D\u00E9coupage de chaque accord sur le symbole '+' (gestion du cas '++' pour la touche '+')\n const tokens: string[] = [];\n let currentToken = '';\n\n for (let i = 0; i < rawStep.length; i++) {\n const char = rawStep[i];\n if (char === '+') {\n // Si le token actuel est vide et qu'on a d\u00E9j\u00E0 des tokens, c'est que c'est un '+' litt\u00E9ral (ex: \"Ctrl++\")\n if (currentToken === '' && tokens.length > 0) {\n tokens.push('+');\n } else if (currentToken !== '') {\n tokens.push(currentToken);\n currentToken = '';\n }\n } else {\n currentToken += char;\n }\n }\n if (currentToken !== '') {\n tokens.push(currentToken);\n }\n\n let ctrl = false;\n let alt = false;\n let shift = false;\n let meta = false;\n let mainKey = '';\n\n for (const token of tokens) {\n const lower = token.trim().toLowerCase();\n if (lower === 'ctrl' || lower === 'control') {\n ctrl = true;\n } else if (lower === 'alt' || lower === 'option' || lower === 'opt') {\n alt = true;\n } else if (lower === 'shift' || lower === 'maj') {\n shift = true;\n } else if (lower === 'cmd' || lower === 'command' || lower === 'meta' || lower === 'win' || lower === 'super') {\n meta = true;\n } else if (lower === 'mod' || lower === '$mod') {\n if (isApple) {\n meta = true;\n } else {\n ctrl = true;\n }\n } else {\n // Touche principale\n mainKey = ShortcutFormatter.normalizeKeyName(token);\n }\n }\n\n steps.push({\n ctrl,\n alt,\n shift,\n meta,\n key: mainKey\n });\n }\n\n return steps;\n }\n\n /**\n * Formate une combinaison brute en libell\u00E9 soign\u00E9 et lisible pour l'OS cible.\n * Ex: \"Mod+Shift+P\" -> macOS: \"\u21E7\u2318P\", Windows: \"Ctrl+Shift+P\"\n * Ex: \"g i\" -> \"g puis i\" ou \"g i\"\n */\n public static format(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n if (steps.length === 0) {\n return combo;\n }\n\n const formattedSteps = steps.map(step => {\n const parts: string[] = [];\n\n if (isApple) {\n if (step.ctrl) parts.push('\u2303');\n if (step.alt) parts.push('\u2325');\n if (step.shift) parts.push('\u21E7');\n if (step.meta) parts.push('\u2318');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, true);\n parts.push(keyDisplay);\n return parts.join('');\n } else {\n if (step.ctrl) parts.push('Ctrl');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Win');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, false);\n parts.push(keyDisplay);\n return parts.join('+');\n }\n });\n\n return formattedSteps.join(' ');\n }\n\n /**\n * Convertit un combo technique vers le format officiel WAI-ARIA `aria-keyshortcuts`.\n * Standard W3C : les modificateurs sont 'Control', 'Alt', 'Shift', 'Meta' et le s\u00E9parateur est '+'.\n */\n public static toAriaKeyShortcuts(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n return steps.map(step => {\n const parts: string[] = [];\n if (step.ctrl) parts.push('Control');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Meta');\n parts.push(ShortcutFormatter.formatKeyDisplay(step.key, false));\n return parts.join('+');\n }).join(' ');\n }\n\n private static formatKeyDisplay(key: string, isApple: boolean): string {\n if (!key) return '';\n switch (key.toLowerCase()) {\n case 'escape':\n return isApple ? '\u238B' : 'Esc';\n case 'enter':\n return isApple ? '\u21A9' : 'Enter';\n case ' ':\n return isApple ? '\u2423' : 'Space';\n case 'tab':\n return isApple ? '\u21E5' : 'Tab';\n case 'backspace':\n return isApple ? '\u232B' : 'Backspace';\n case 'delete':\n return isApple ? '\u2326' : 'Suppr';\n case 'arrowup':\n return '\u2191';\n case 'arrowdown':\n return '\u2193';\n case 'arrowleft':\n return '\u2190';\n case 'arrowright':\n return '\u2192';\n default:\n return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);\n }\n }\n}\n\n", "import {\n ShortcutDefinition,\n ShortcutManagerOptions,\n ShortcutInfo,\n RegisteredShortcut,\n NormalizedStep\n} from './types';\nimport { ShortcutFormatter } from './ShortcutFormatter';\n\n/**\n * Moteur autonome et modulaire de gestion des raccourcis clavier applicatifs (Wulf.Shortcut).\n * Z\u00E9ro d\u00E9pendance. Conforme \u00E0 l'Axiome Primordial de pr\u00E9servation de la saisie utilisateur.\n */\nexport class ShortcutManager {\n private readonly options: Required<Omit<ShortcutManagerOptions, 'onError'>> & {\n onError?: (error: Error, combo: string) => void;\n };\n private readonly shortcuts: Map<string, RegisteredShortcut> = new Map();\n private scopeStack: string[] = [];\n private sequenceBuffer: { step: NormalizedStep; timestamp: number }[] = [];\n private sequenceTimer: ReturnType<typeof setTimeout> | null = null;\n private isListening = true;\n private boundListener: ((event: KeyboardEvent) => void) | null = null;\n private idCounter = 0;\n\n constructor(options?: ShortcutManagerOptions) {\n this.options = {\n defaultScope: options?.defaultScope || 'global',\n sequenceTimeout: options?.sequenceTimeout ?? 800,\n target: options?.target || (typeof window !== 'undefined' ? window : ({} as Window)),\n onError: options?.onError\n };\n\n this.scopeStack = [this.options.defaultScope];\n this.initListener();\n }\n\n /**\n * V\u00E9rifie si un \u00E9l\u00E9ment DOM est une zone d'\u00E9dition o\u00F9 la saisie de l'utilisateur\n * ne doit JAMAIS \u00EAtre interrompue ou d\u00E9tourn\u00E9e (Axiome Primordial).\n */\n public static isEditable(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n\n const el = target as HTMLElement;\n const tagName = el.tagName.toUpperCase();\n\n // 1. \u00C9l\u00E9ments natifs de formulaire textuel\n if (tagName === 'INPUT') {\n const type = (el as HTMLInputElement).type?.toLowerCase() || 'text';\n // Seuls les types non-textuels ne sont pas consid\u00E9r\u00E9s comme de la saisie libre\n const nonTextTypes = ['button', 'checkbox', 'radio', 'submit', 'reset', 'range', 'color', 'file', 'image'];\n return !nonTextTypes.includes(type);\n }\n if (tagName === 'TEXTAREA' || tagName === 'SELECT') {\n return true;\n }\n\n // 2. \u00C9l\u00E9ments modifiables en ligne (contenteditable)\n if (el.isContentEditable || el.getAttribute('contenteditable') === 'true' || el.getAttribute('contenteditable') === 'plaintext-only') {\n return true;\n }\n\n // 3. R\u00F4les ARIA de saisie\n const role = el.getAttribute('role');\n if (role === 'textbox' || role === 'searchbox') {\n return true;\n }\n\n return false;\n }\n\n /**\n * Enregistre un ou plusieurs raccourcis clavier.\n * Retourne une fonction de nettoyage pour d\u00E9senregistrer imm\u00E9diatement.\n */\n public bind(definition: ShortcutDefinition | ShortcutDefinition[]): () => void {\n const list = Array.isArray(definition) ? definition : [definition];\n const registeredIds: string[] = [];\n\n for (const def of list) {\n if (!def.combo || typeof def.handler !== 'function') {\n continue;\n }\n\n const id = `wulf_shortcut_${++this.idCounter}`;\n const normalizedSteps = ShortcutFormatter.parseCombo(def.combo);\n const isSequence = normalizedSteps.length > 1;\n const formattedCombo = ShortcutFormatter.format(def.combo);\n\n const registered: RegisteredShortcut = {\n ...def,\n id,\n scope: def.scope || 'global',\n category: def.category || 'G\u00E9n\u00E9ral',\n allowInEditable: def.allowInEditable ?? false,\n preventDefault: def.preventDefault ?? true,\n stopPropagation: def.stopPropagation ?? true,\n priority: def.priority ?? 0,\n formattedCombo,\n normalizedSteps,\n isSequence\n };\n\n this.shortcuts.set(id, registered);\n registeredIds.push(id);\n }\n\n // Fonction de d\u00E9sabonnement direct\n return () => {\n for (const id of registeredIds) {\n this.shortcuts.delete(id);\n }\n };\n }\n\n /**\n * Retire tous les raccourcis correspondant \u00E0 une combinaison et \u00E9ventuellement un scope.\n */\n public unbind(combo: string, scope?: string): void {\n const formatted = ShortcutFormatter.format(combo);\n for (const [id, s] of this.shortcuts.entries()) {\n if (s.formattedCombo === formatted || s.combo.trim().toLowerCase() === combo.trim().toLowerCase()) {\n if (!scope || s.scope === scope) {\n this.shortcuts.delete(id);\n }\n }\n }\n }\n\n /**\n * Empile un nouveau scope actif (mode LIFO).\n * Seuls les raccourcis de ce scope (et les omnipr\u00E9sents '*') seront actifs.\n */\n public pushScope(scope: string): void {\n if (scope && typeof scope === 'string') {\n this.scopeStack.push(scope);\n this.clearSequenceBuffer();\n }\n }\n\n /**\n * D\u00E9pile le scope actuel et r\u00E9tablit le pr\u00E9c\u00E9dent.\n * Si un param\u00E8tre `scope` est pass\u00E9, ne retire que si le scope actuel correspond.\n */\n public popScope(scope?: string): string | undefined {\n if (this.scopeStack.length <= 1) {\n return this.scopeStack[0];\n }\n\n if (scope) {\n if (this.getScope() === scope) {\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n return undefined;\n }\n\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n\n /**\n * R\u00E9initialise brutalement la pile pour activer le scope sp\u00E9cifi\u00E9.\n */\n public setScope(scope: string): void {\n this.scopeStack = [scope || this.options.defaultScope];\n this.clearSequenceBuffer();\n }\n\n /**\n * Retourne le scope actuellement actif au sommet de la pile.\n */\n public getScope(): string {\n return this.scopeStack[this.scopeStack.length - 1] || this.options.defaultScope;\n }\n\n /**\n * Retourne une copie de la pile compl\u00E8te des scopes.\n */\n public getScopeStack(): string[] {\n return [...this.scopeStack];\n }\n\n /**\n * Met en pause l'\u00E9coute de tous les raccourcis.\n */\n public pause(): void {\n this.isListening = false;\n this.clearSequenceBuffer();\n }\n\n /**\n * R\u00E9active l'\u00E9coute des raccourcis.\n */\n public resume(): void {\n this.isListening = true;\n }\n\n /**\n * Indique si le gestionnaire est actif et \u00E0 l'\u00E9coute.\n */\n public isActive(): boolean {\n return this.isListening;\n }\n\n /**\n * Retourne le catalogue des raccourcis enregistr\u00E9s (optionnellement filtr\u00E9 par scope).\n */\n public getRegistry(scope?: string): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n if (!scope || shortcut.scope === scope || shortcut.scope === '*') {\n list.push({ ...shortcut });\n }\n }\n return list;\n }\n\n /**\n * Associe l'attribut standard WAI-ARIA `aria-keyshortcuts` sur un \u00E9l\u00E9ment DOM.\n */\n public attachAria(element: HTMLElement, combo: string): void {\n if (element && typeof element.setAttribute === 'function') {\n const ariaValue = ShortcutFormatter.toAriaKeyShortcuts(combo);\n element.setAttribute('aria-keyshortcuts', ariaValue);\n }\n }\n\n /**\n * Formate une combinaison brute selon l'OS courant (\"\u2318K\" ou \"Ctrl+K\").\n */\n public static format(combo: string, isApple?: boolean): string {\n return ShortcutFormatter.format(combo, isApple);\n }\n\n /**\n * D\u00E9truit le gestionnaire : supprime les \u00E9couteurs du DOM et vide toute la m\u00E9moire.\n */\n public destroy(): void {\n this.pause();\n this.removeListener();\n this.shortcuts.clear();\n this.scopeStack = [];\n this.clearSequenceBuffer();\n }\n\n // --- Impl\u00E9mentation Interne ---\n\n private initListener(): void {\n if (typeof window === 'undefined' || !this.options.target) {\n return;\n }\n\n this.boundListener = (event: KeyboardEvent) => this.handleKeyDown(event);\n const target = this.options.target as EventTarget;\n if (typeof target.addEventListener === 'function') {\n target.addEventListener('keydown', this.boundListener as EventListener, false);\n }\n }\n\n private removeListener(): void {\n if (this.boundListener && this.options.target) {\n const target = this.options.target as EventTarget;\n if (typeof target.removeEventListener === 'function') {\n target.removeEventListener('keydown', this.boundListener as EventListener, false);\n }\n this.boundListener = null;\n }\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (!this.isListening) {\n return;\n }\n\n // Touches modificatrices isol\u00E9es : on ne fait rien\n const k = (event.key || '').toLowerCase();\n if (['control', 'alt', 'shift', 'meta'].includes(k)) {\n return;\n }\n\n const currentScope = this.getScope();\n const isEditable = ShortcutManager.isEditable(event.target);\n\n // Extraction du pas de touche actuel\n const currentStep: NormalizedStep = {\n ctrl: event.ctrlKey,\n alt: event.altKey,\n shift: event.shiftKey,\n meta: event.metaKey,\n key: ShortcutFormatter.normalizeKeyName(event.key || '')\n };\n\n const now = Date.now();\n\n // 1. Purge du buffer de s\u00E9quence si le d\u00E9lai est d\u00E9pass\u00E9\n if (this.sequenceBuffer.length > 0) {\n const last = this.sequenceBuffer[this.sequenceBuffer.length - 1];\n if (now - last.timestamp > this.options.sequenceTimeout) {\n this.clearSequenceBuffer();\n }\n }\n\n // Candidats potentiels actifs pour le scope courant\n const activeCandidates = this.getActiveShortcuts(currentScope, isEditable);\n\n // 2. \u00C9valuation des s\u00E9quences temporelles (Key Sequences)\n const proposedSequence = [...this.sequenceBuffer.map(b => b.step), currentStep];\n const matchingSequence = this.findMatchingSequence(activeCandidates, proposedSequence);\n\n if (matchingSequence) {\n this.clearSequenceBuffer();\n this.executeShortcut(matchingSequence, event, currentScope, true);\n return;\n }\n\n // V\u00E9rifier si le pas actuel peut \u00EAtre le pr\u00E9fixe d'une s\u00E9quence enregistr\u00E9e\n if (this.isPrefixOfAnySequence(activeCandidates, proposedSequence)) {\n this.sequenceBuffer.push({ step: currentStep, timestamp: now });\n this.resetSequenceTimer();\n // On bloque l'\u00E9v\u00E9nement pour ne pas d\u00E9clencher un accord unitaire pendant une s\u00E9quence\n if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && !isEditable) {\n event.preventDefault();\n }\n return;\n }\n\n // Si la s\u00E9quence ne m\u00E8ne \u00E0 rien, on vide le buffer\n this.clearSequenceBuffer();\n\n // 3. \u00C9valuation des accords simultan\u00E9s unitaires (Single Chords)\n const matchingChord = this.findMatchingChord(activeCandidates, currentStep, event);\n if (matchingChord) {\n this.executeShortcut(matchingChord, event, currentScope, false);\n }\n }\n\n private getActiveShortcuts(currentScope: string, isEditable: boolean): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n // Filtrage de scope\n if (shortcut.scope !== currentScope && shortcut.scope !== '*') {\n continue;\n }\n // R\u00C8GLE ABSOLUE (Axiome Primordial) : Filtrage des \u00E9l\u00E9ments \u00E9ditables\n if (isEditable && !shortcut.allowInEditable) {\n continue;\n }\n list.push(shortcut);\n }\n\n // Tri par priorit\u00E9 d\u00E9croissante\n return list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }\n\n private stepMatches(step: NormalizedStep, eventStep: NormalizedStep, rawEvent?: KeyboardEvent): boolean {\n if (step.ctrl !== eventStep.ctrl) return false;\n if (step.alt !== eventStep.alt) return false;\n if (step.meta !== eventStep.meta) return false;\n\n // Correspondance de la touche\n const keyMatches =\n step.key === eventStep.key ||\n (rawEvent && step.key === rawEvent.key.toLowerCase());\n\n if (!keyMatches) return false;\n\n // Correspondance Shift :\n // Si la touche sp\u00E9cifie shift: true, l'\u00E9v\u00E9nement doit avoir shiftKey true.\n // Si la touche sp\u00E9cifie shift: false, mais que le caract\u00E8re est un symbole (ex: \"?\")\n // tap\u00E9 avec shift, on tol\u00E8re si la touche correspond exactement.\n if (step.shift === eventStep.shift) {\n return true;\n }\n\n if (!step.shift && eventStep.shift) {\n // Autoris\u00E9 si c'est un caract\u00E8re sp\u00E9cial direct (comme \"?\" ou \"!\")\n if (rawEvent && rawEvent.key === step.key) {\n return true;\n }\n }\n\n return false;\n }\n\n private findMatchingChord(\n candidates: RegisteredShortcut[],\n currentStep: NormalizedStep,\n rawEvent: KeyboardEvent\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (candidate.isSequence || candidate.normalizedSteps.length !== 1) {\n continue;\n }\n\n const step = candidate.normalizedSteps[0];\n if (this.stepMatches(step, currentStep, rawEvent)) {\n return candidate;\n }\n }\n return null;\n }\n\n private findMatchingSequence(\n candidates: RegisteredShortcut[],\n proposed: NormalizedStep[]\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length !== proposed.length) {\n continue;\n }\n\n let allMatch = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n allMatch = false;\n break;\n }\n }\n\n if (allMatch) {\n return candidate;\n }\n }\n return null;\n }\n\n private isPrefixOfAnySequence(candidates: RegisteredShortcut[], proposed: NormalizedStep[]): boolean {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length <= proposed.length) {\n continue;\n }\n\n let prefixMatches = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n prefixMatches = false;\n break;\n }\n }\n\n if (prefixMatches) {\n return true;\n }\n }\n return false;\n }\n\n private executeShortcut(\n shortcut: RegisteredShortcut,\n event: KeyboardEvent,\n scope: string,\n isSequence: boolean\n ): void {\n if (shortcut.preventDefault) {\n event.preventDefault();\n }\n if (shortcut.stopPropagation) {\n event.stopPropagation();\n }\n\n const info: ShortcutInfo = {\n combo: shortcut.combo,\n formattedCombo: shortcut.formattedCombo,\n scope,\n target: event.target,\n isSequence\n };\n\n try {\n shortcut.handler(event, info);\n } catch (err) {\n if (this.options.onError) {\n this.options.onError(err instanceof Error ? err : new Error(String(err)), shortcut.combo);\n } else {\n console.error(`[Wulf.Shortcut] Erreur lors de l'ex\u00E9cution du raccourci \"${shortcut.combo}\":`, err);\n }\n }\n }\n\n private resetSequenceTimer(): void {\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n }\n this.sequenceTimer = setTimeout(() => {\n this.clearSequenceBuffer();\n }, this.options.sequenceTimeout);\n }\n\n private clearSequenceBuffer(): void {\n this.sequenceBuffer = [];\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n this.sequenceTimer = null;\n }\n }\n}\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,MAAM,oBAAN,MAAM,mBAAkB;AAAA;AAAA;AAAA;AAAA,IAI7B,OAAc,UAAmB;AAC/B,UAAI,OAAO,cAAc,aAAa;AACpC,eAAO;AAAA,MACT;AAGA,YAAM,SAAU,UAAmE;AACnF,UAAI,UAAU,OAAO,OAAO,aAAa,UAAU;AACjD,cAAM,IAAI,OAAO,SAAS,YAAY;AACtC,YAAI,EAAE,SAAS,KAAK,KAAK,EAAE,SAAS,KAAK,GAAG;AAC1C,iBAAO;AAAA,QACT;AAAA,MACF;AAGA,YAAM,YAAY,UAAU,YAAY,IAAI,YAAY;AACxD,UAAI,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,QAAQ,KAAK,SAAS,SAAS,MAAM,KAAK,SAAS,SAAS,MAAM,GAAG;AACrH,eAAO;AAAA,MACT;AAGA,YAAM,MAAM,UAAU,aAAa,IAAI,YAAY;AACnD,aAAO,GAAG,SAAS,WAAW,KAAK,GAAG,SAAS,UA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AAA,QACd;AAAA,MACF;AAEA,UAAI;AACF,iBAAS,QAAQ,OAAO,IAAI;AAAA,MAC9B,SAAS,KAAK;AACZ,YAAI,KAAK,QAAQ,SAAS;AACxB,eAAK,QAAQ,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,GAAG,SAAS,KAAK;AAAA,QAC1F,OAAO;AACL,kBAAQ,MAAM,+DAA4D,SAAS,KAAK,MAAM,GAAG;AAAA,QACnG;AAAA,MACF;AAAA,IACF;AAAA,IAEQ,qBAA2B;AACjC,UAAI,KAAK,eAAe;AACtB,qBAAa,KAAK,aAAa;AAAA,MACjC;AACA,WAAK,gBAAgB,WAAW,MAAM;AACpC,aAAK,oBAAoB;AAAA,MAC3B,GAAG,KAAK,QAAQ,eAAe;AAAA,IACjC;AAAA,IAEQ,sBAA4B;AAClC,WAAK,iBAAiB,CAAC;AACvB,UAAI,KAAK,eAAe;AACtB,qBAAa,KAAK,aAAa;AAC/B,aAAK,gBAAgB;AAAA,MACvB;AAAA,IACF;AAAA,EACF;",
4
+ "sourcesContent": ["import { ShortcutManager } from './ShortcutManager';\nimport { ShortcutFormatter } from './ShortcutFormatter';\n\nexport { ShortcutManager } from './ShortcutManager';\nexport { ShortcutFormatter } from './ShortcutFormatter';\nexport * from './types';\nexport { ShortcutManager as default } from './ShortcutManager';\n\n// Attachement namespace global dans les environnements de navigation (IIFE / Vanilla)\nif (typeof window !== 'undefined') {\n const win = window as unknown as Record<string, unknown>;\n const wulfNamespace = ((win.Wulf as Record<string, unknown>) || {}) as Record<string, unknown>;\n win.Wulf = wulfNamespace;\n\n wulfNamespace.Shortcut = Object.assign(ShortcutManager, {\n ShortcutManager,\n ShortcutFormatter\n });\n}\n\n\n", "import { NormalizedStep } from './types';\n\n/**\n * Utilitaires de d\u00E9tection d'OS, de parsing de cha\u00EEnes et de formatage de raccourcis.\n */\nexport class ShortcutFormatter {\n /**\n * D\u00E9tecte si l'environnement d'ex\u00E9cution actuel est un environnement Apple (macOS / iOS / iPadOS).\n */\n public static isApple(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n // 1. D\u00E9tection moderne via User-Agent Client Hints (si disponible)\n const uaData = (navigator as unknown as { userAgentData?: { platform?: string } }).userAgentData;\n if (uaData && typeof uaData.platform === 'string') {\n const p = uaData.platform.toLowerCase();\n if (p.includes('mac') || p.includes('ios')) {\n return true;\n }\n }\n\n // 2. D\u00E9tection via navigator.platform\n const platform = (navigator.platform || '').toLowerCase();\n if (platform.includes('mac') || platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) {\n return true;\n }\n\n // 3. D\u00E9tection de secours via User-Agent\n const ua = (navigator.userAgent || '').toLowerCase();\n return ua.includes('macintosh') || ua.includes('mac os x') || ua.includes('ipad') || ua.includes('iphone');\n }\n\n /**\n * Normalise un nom de touche unitaire pour les comparaisons.\n */\n public static normalizeKeyName(key: string): string {\n const k = key.trim().toLowerCase();\n switch (k) {\n case 'esc':\n return 'escape';\n case 'return':\n return 'enter';\n case 'space':\n case 'spacebar':\n return ' ';\n case 'del':\n return 'delete';\n case 'ins':\n return 'insert';\n case 'up':\n return 'arrowup';\n case 'down':\n return 'arrowdown';\n case 'left':\n return 'arrowleft';\n case 'right':\n return 'arrowright';\n default:\n return k;\n }\n }\n\n /**\n * Parse une cha\u00EEne de combinaison (ex: \"Mod+K\", \"g i\", \"Shift+?\", \"Alt++\")\n * et retourne la liste des \u00E9tapes normalis\u00E9es n\u00E9cessaires au d\u00E9clenchement.\n */\n public static parseCombo(combo: string, isApple: boolean = ShortcutFormatter.isApple()): NormalizedStep[] {\n if (typeof combo !== 'string') {\n return [];\n }\n const trimmed = combo.slice(0, 512).trim();\n if (!trimmed) {\n return [];\n }\n\n // D\u00E9coupage en \u00E9tapes pour les s\u00E9quences (ex: \"g i\" -> [\"g\", \"i\"]), plafonn\u00E9 \u00E0 10 \u00E9tapes max (anti-DoS)\n // Attention : on s\u00E9pare par espaces, sauf si l'espace est la touche elle-m\u00EAme (\"space\")\n const stepsRaw = trimmed.split(/\\s+/).slice(0, 10);\n const steps: NormalizedStep[] = [];\n\n for (const rawStep of stepsRaw) {\n // D\u00E9coupage de chaque accord sur le symbole '+' (gestion du cas '++' pour la touche '+')\n const tokens: string[] = [];\n let currentToken = '';\n\n for (let i = 0; i < rawStep.length; i++) {\n const char = rawStep[i];\n if (char === '+') {\n // Si le token actuel est vide et qu'on a d\u00E9j\u00E0 des tokens, c'est que c'est un '+' litt\u00E9ral (ex: \"Ctrl++\")\n if (currentToken === '' && tokens.length > 0) {\n tokens.push('+');\n } else if (currentToken !== '') {\n tokens.push(currentToken);\n currentToken = '';\n }\n } else {\n currentToken += char;\n }\n }\n if (currentToken !== '') {\n tokens.push(currentToken);\n }\n\n let ctrl = false;\n let alt = false;\n let shift = false;\n let meta = false;\n let mainKey = '';\n\n for (const token of tokens) {\n const lower = token.trim().toLowerCase();\n if (lower === 'ctrl' || lower === 'control') {\n ctrl = true;\n } else if (lower === 'alt' || lower === 'option' || lower === 'opt') {\n alt = true;\n } else if (lower === 'shift' || lower === 'maj') {\n shift = true;\n } else if (lower === 'cmd' || lower === 'command' || lower === 'meta' || lower === 'win' || lower === 'super') {\n meta = true;\n } else if (lower === 'mod' || lower === '$mod') {\n if (isApple) {\n meta = true;\n } else {\n ctrl = true;\n }\n } else {\n // Touche principale\n mainKey = ShortcutFormatter.normalizeKeyName(token);\n }\n }\n\n steps.push({\n ctrl,\n alt,\n shift,\n meta,\n key: mainKey\n });\n }\n\n return steps;\n }\n\n /**\n * Formate une combinaison brute en libell\u00E9 soign\u00E9 et lisible pour l'OS cible.\n * Ex: \"Mod+Shift+P\" -> macOS: \"\u21E7\u2318P\", Windows: \"Ctrl+Shift+P\"\n * Ex: \"g i\" -> \"g puis i\" ou \"g i\"\n */\n public static format(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n if (steps.length === 0) {\n return combo;\n }\n\n const formattedSteps = steps.map(step => {\n const parts: string[] = [];\n\n if (isApple) {\n if (step.ctrl) parts.push('\u2303');\n if (step.alt) parts.push('\u2325');\n if (step.shift) parts.push('\u21E7');\n if (step.meta) parts.push('\u2318');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, true);\n parts.push(keyDisplay);\n return parts.join('');\n } else {\n if (step.ctrl) parts.push('Ctrl');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Win');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, false);\n parts.push(keyDisplay);\n return parts.join('+');\n }\n });\n\n return formattedSteps.join(' ');\n }\n\n /**\n * Convertit un combo technique vers le format officiel WAI-ARIA `aria-keyshortcuts`.\n * Standard W3C : les modificateurs sont 'Control', 'Alt', 'Shift', 'Meta' et le s\u00E9parateur est '+'.\n */\n public static toAriaKeyShortcuts(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n return steps.map(step => {\n const parts: string[] = [];\n if (step.ctrl) parts.push('Control');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Meta');\n parts.push(ShortcutFormatter.formatKeyDisplay(step.key, false));\n return parts.join('+');\n }).join(' ');\n }\n\n private static formatKeyDisplay(key: string, isApple: boolean): string {\n if (!key) return '';\n switch (key.toLowerCase()) {\n case 'escape':\n return isApple ? '\u238B' : 'Esc';\n case 'enter':\n return isApple ? '\u21A9' : 'Enter';\n case ' ':\n return isApple ? '\u2423' : 'Space';\n case 'tab':\n return isApple ? '\u21E5' : 'Tab';\n case 'backspace':\n return isApple ? '\u232B' : 'Backspace';\n case 'delete':\n return isApple ? '\u2326' : 'Suppr';\n case 'arrowup':\n return '\u2191';\n case 'arrowdown':\n return '\u2193';\n case 'arrowleft':\n return '\u2190';\n case 'arrowright':\n return '\u2192';\n default:\n return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);\n }\n }\n}\n\n", "import {\n ShortcutDefinition,\n ShortcutManagerOptions,\n ShortcutInfo,\n RegisteredShortcut,\n NormalizedStep\n} from './types';\nimport { ShortcutFormatter } from './ShortcutFormatter';\n\n/**\n * Moteur autonome et modulaire de gestion des raccourcis clavier applicatifs (Wulf.Shortcut).\n * Z\u00E9ro d\u00E9pendance. Conforme \u00E0 l'Axiome Primordial de pr\u00E9servation de la saisie utilisateur.\n */\nexport class ShortcutManager {\n private readonly options: Required<Omit<ShortcutManagerOptions, 'onError'>> & {\n onError?: (error: Error, combo: string) => void;\n };\n private readonly shortcuts: Map<string, RegisteredShortcut> = new Map();\n private scopeStack: string[] = [];\n private sequenceBuffer: { step: NormalizedStep; timestamp: number }[] = [];\n private sequenceTimer: ReturnType<typeof setTimeout> | null = null;\n private isListening = true;\n private boundListener: ((event: KeyboardEvent) => void) | null = null;\n private idCounter = 0;\n\n constructor(options?: ShortcutManagerOptions) {\n this.options = {\n defaultScope: options?.defaultScope || 'global',\n sequenceTimeout: options?.sequenceTimeout ?? 800,\n target: options?.target || (typeof window !== 'undefined' ? window : ({} as Window)),\n onError: options?.onError\n };\n\n this.scopeStack = [this.options.defaultScope];\n this.initListener();\n }\n\n /**\n * V\u00E9rifie si un \u00E9l\u00E9ment DOM est une zone d'\u00E9dition o\u00F9 la saisie de l'utilisateur\n * ne doit JAMAIS \u00EAtre interrompue ou d\u00E9tourn\u00E9e (Axiome Primordial).\n */\n public static isEditable(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n\n const el = target as HTMLElement;\n const tagName = el.tagName.toUpperCase();\n\n // 1. \u00C9l\u00E9ments natifs de formulaire textuel\n if (tagName === 'INPUT') {\n const type = (el as HTMLInputElement).type?.toLowerCase() || 'text';\n // Seuls les types non-textuels ne sont pas consid\u00E9r\u00E9s comme de la saisie libre\n const nonTextTypes = ['button', 'checkbox', 'radio', 'submit', 'reset', 'range', 'color', 'file', 'image'];\n return !nonTextTypes.includes(type);\n }\n if (tagName === 'TEXTAREA' || tagName === 'SELECT') {\n return true;\n }\n\n // 2. \u00C9l\u00E9ments modifiables en ligne (contenteditable)\n if (\n el.isContentEditable ||\n el.getAttribute('contenteditable') === 'true' ||\n el.getAttribute('contenteditable') === 'plaintext-only' ||\n el.getAttribute('contenteditable') === ''\n ) {\n return true;\n }\n\n // 3. R\u00F4les ARIA de saisie\n const role = el.getAttribute('role');\n if (role === 'textbox' || role === 'searchbox') {\n return true;\n }\n\n // 4. \u00C9l\u00E9ment enfant situ\u00E9 \u00E0 l'int\u00E9rieur d'un conteneur contenteditable ou ARIA textbox/searchbox\n if (typeof el.closest === 'function') {\n const editableAncestor = el.closest(\n '[contenteditable=\"true\"], [contenteditable=\"plaintext-only\"], [contenteditable=\"\"], [role=\"textbox\"], [role=\"searchbox\"]'\n );\n if (editableAncestor) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * V\u00E9rifie si la cible est un champ de mot de passe (sanctuaire anti-keylogging).\n */\n private static isPasswordField(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n const el = target as HTMLInputElement;\n return el.tagName.toUpperCase() === 'INPUT' && (el.type || '').toLowerCase() === 'password';\n }\n\n /**\n * Enregistre un ou plusieurs raccourcis clavier.\n * Retourne une fonction de nettoyage pour d\u00E9senregistrer imm\u00E9diatement.\n */\n public bind(definition: ShortcutDefinition | ShortcutDefinition[]): () => void {\n const list = Array.isArray(definition) ? definition : [definition];\n const registeredIds: string[] = [];\n\n for (const def of list) {\n if (!def.combo || typeof def.handler !== 'function') {\n continue;\n }\n\n const id = `wulf_shortcut_${++this.idCounter}`;\n const normalizedSteps = ShortcutFormatter.parseCombo(def.combo);\n const isSequence = normalizedSteps.length > 1;\n const formattedCombo = ShortcutFormatter.format(def.combo);\n\n const registered: RegisteredShortcut = {\n ...def,\n id,\n scope: def.scope || 'global',\n category: def.category || 'G\u00E9n\u00E9ral',\n allowInEditable: def.allowInEditable ?? false,\n preventDefault: def.preventDefault ?? true,\n stopPropagation: def.stopPropagation ?? true,\n priority: def.priority ?? 0,\n formattedCombo,\n normalizedSteps,\n isSequence\n };\n\n this.shortcuts.set(id, registered);\n registeredIds.push(id);\n }\n\n // Fonction de d\u00E9sabonnement direct\n return () => {\n for (const id of registeredIds) {\n this.shortcuts.delete(id);\n }\n };\n }\n\n /**\n * Retire tous les raccourcis correspondant \u00E0 une combinaison et \u00E9ventuellement un scope.\n */\n public unbind(combo: string, scope?: string): void {\n const formatted = ShortcutFormatter.format(combo);\n for (const [id, s] of this.shortcuts.entries()) {\n if (s.formattedCombo === formatted || s.combo.trim().toLowerCase() === combo.trim().toLowerCase()) {\n if (!scope || s.scope === scope) {\n this.shortcuts.delete(id);\n }\n }\n }\n }\n\n /**\n * Empile un nouveau scope actif (mode LIFO).\n * Seuls les raccourcis de ce scope (et les omnipr\u00E9sents '*') seront actifs.\n */\n public pushScope(scope: string): void {\n if (scope && typeof scope === 'string') {\n if (this.scopeStack.length >= 64) {\n return;\n }\n this.scopeStack.push(scope);\n this.clearSequenceBuffer();\n }\n }\n\n /**\n * D\u00E9pile le scope actuel et r\u00E9tablit le pr\u00E9c\u00E9dent.\n * Si un param\u00E8tre `scope` est pass\u00E9, ne retire que si le scope actuel correspond.\n */\n public popScope(scope?: string): string | undefined {\n if (this.scopeStack.length <= 1) {\n return this.scopeStack[0];\n }\n\n if (scope) {\n if (this.getScope() === scope) {\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n return undefined;\n }\n\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n\n /**\n * R\u00E9initialise brutalement la pile pour activer le scope sp\u00E9cifi\u00E9.\n */\n public setScope(scope: string): void {\n this.scopeStack = [scope || this.options.defaultScope];\n this.clearSequenceBuffer();\n }\n\n /**\n * Retourne le scope actuellement actif au sommet de la pile.\n */\n public getScope(): string {\n return this.scopeStack[this.scopeStack.length - 1] || this.options.defaultScope;\n }\n\n /**\n * Retourne une copie de la pile compl\u00E8te des scopes.\n */\n public getScopeStack(): string[] {\n return [...this.scopeStack];\n }\n\n /**\n * Met en pause l'\u00E9coute de tous les raccourcis.\n */\n public pause(): void {\n this.isListening = false;\n this.clearSequenceBuffer();\n }\n\n /**\n * R\u00E9active l'\u00E9coute des raccourcis.\n */\n public resume(): void {\n this.isListening = true;\n }\n\n /**\n * Indique si le gestionnaire est actif et \u00E0 l'\u00E9coute.\n */\n public isActive(): boolean {\n return this.isListening;\n }\n\n /**\n * Retourne le catalogue des raccourcis enregistr\u00E9s (optionnellement filtr\u00E9 par scope).\n */\n public getRegistry(scope?: string): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n if (!scope || shortcut.scope === scope || shortcut.scope === '*') {\n list.push({ ...shortcut });\n }\n }\n return list;\n }\n\n /**\n * Associe l'attribut standard WAI-ARIA `aria-keyshortcuts` sur un \u00E9l\u00E9ment DOM.\n */\n public attachAria(element: HTMLElement, combo: string): void {\n if (element && typeof element.setAttribute === 'function') {\n const ariaValue = ShortcutFormatter.toAriaKeyShortcuts(combo);\n element.setAttribute('aria-keyshortcuts', ariaValue);\n }\n }\n\n /**\n * Formate une combinaison brute selon l'OS courant (\"\u2318K\" ou \"Ctrl+K\").\n */\n public static format(combo: string, isApple?: boolean): string {\n return ShortcutFormatter.format(combo, isApple);\n }\n\n /**\n * D\u00E9truit le gestionnaire : supprime les \u00E9couteurs du DOM et vide toute la m\u00E9moire.\n */\n public destroy(): void {\n this.pause();\n this.removeListener();\n this.shortcuts.clear();\n this.scopeStack = [];\n this.clearSequenceBuffer();\n }\n\n // --- Impl\u00E9mentation Interne ---\n\n private initListener(): void {\n if (typeof window === 'undefined' || !this.options.target) {\n return;\n }\n\n this.boundListener = (event: KeyboardEvent) => this.handleKeyDown(event);\n const target = this.options.target as EventTarget;\n if (typeof target.addEventListener === 'function') {\n target.addEventListener('keydown', this.boundListener as EventListener, false);\n }\n }\n\n private removeListener(): void {\n if (this.boundListener && this.options.target) {\n const target = this.options.target as EventTarget;\n if (typeof target.removeEventListener === 'function') {\n target.removeEventListener('keydown', this.boundListener as EventListener, false);\n }\n this.boundListener = null;\n }\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (!this.isListening) {\n return;\n }\n\n // Touches modificatrices isol\u00E9es : on ne fait rien\n const k = (event.key || '').toLowerCase();\n if (['control', 'alt', 'shift', 'meta'].includes(k)) {\n return;\n }\n\n const currentScope = this.getScope();\n const composed = typeof event.composedPath === 'function' ? event.composedPath() : [];\n const actualTarget = (composed.length > 0 ? composed[0] : event.target) as EventTarget | null;\n const isEditable = ShortcutManager.isEditable(actualTarget) || ShortcutManager.isEditable(event.target);\n const isPasswordInput = ShortcutManager.isPasswordField(actualTarget) || ShortcutManager.isPasswordField(event.target);\n\n // Extraction du pas de touche actuel\n const currentStep: NormalizedStep = {\n ctrl: event.ctrlKey,\n alt: event.altKey,\n shift: event.shiftKey,\n meta: event.metaKey,\n key: ShortcutFormatter.normalizeKeyName(event.key || '')\n };\n\n const now = Date.now();\n\n // 1. Purge du buffer de s\u00E9quence si le d\u00E9lai est d\u00E9pass\u00E9\n if (this.sequenceBuffer.length > 0) {\n const last = this.sequenceBuffer[this.sequenceBuffer.length - 1];\n if (now - last.timestamp > this.options.sequenceTimeout) {\n this.clearSequenceBuffer();\n }\n }\n\n // Candidats potentiels actifs pour le scope courant\n const activeCandidates = this.getActiveShortcuts(currentScope, isEditable, isPasswordInput);\n\n // 2. \u00C9valuation des s\u00E9quences temporelles (Key Sequences)\n const proposedSequence = [...this.sequenceBuffer.map(b => b.step), currentStep];\n const matchingSequence = this.findMatchingSequence(activeCandidates, proposedSequence);\n\n if (matchingSequence) {\n this.clearSequenceBuffer();\n this.executeShortcut(matchingSequence, event, currentScope, true);\n return;\n }\n\n // V\u00E9rifier si le pas actuel peut \u00EAtre le pr\u00E9fixe d'une s\u00E9quence enregistr\u00E9e\n if (this.isPrefixOfAnySequence(activeCandidates, proposedSequence)) {\n this.sequenceBuffer.push({ step: currentStep, timestamp: now });\n this.resetSequenceTimer();\n // On bloque l'\u00E9v\u00E9nement pour ne pas d\u00E9clencher un accord unitaire pendant une s\u00E9quence\n if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && !isEditable) {\n event.preventDefault();\n }\n return;\n }\n\n // Si la s\u00E9quence ne m\u00E8ne \u00E0 rien, on vide le buffer\n this.clearSequenceBuffer();\n\n // 3. \u00C9valuation des accords simultan\u00E9s unitaires (Single Chords)\n const matchingChord = this.findMatchingChord(activeCandidates, currentStep, event);\n if (matchingChord) {\n this.executeShortcut(matchingChord, event, currentScope, false);\n }\n }\n\n private getActiveShortcuts(\n currentScope: string,\n isEditable: boolean,\n isPasswordInput: boolean = false\n ): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n // Filtrage de scope\n if (shortcut.scope !== currentScope && shortcut.scope !== '*') {\n continue;\n }\n // R\u00C8GLE ABSOLUE (Axiome Primordial) : Filtrage des \u00E9l\u00E9ments \u00E9ditables\n if (isEditable && !shortcut.allowInEditable) {\n continue;\n }\n // Sanctuaire Password : m\u00EAme avec allowInEditable: true, interdire les s\u00E9quences et touches imprimables sans modificateur\n if (isPasswordInput) {\n if (shortcut.isSequence) {\n continue;\n }\n const firstStep = shortcut.normalizedSteps[0];\n if (firstStep && firstStep.key.length === 1 && !firstStep.ctrl && !firstStep.alt && !firstStep.meta) {\n continue;\n }\n }\n list.push(shortcut);\n }\n\n // Tri par priorit\u00E9 d\u00E9croissante\n return list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }\n\n private stepMatches(step: NormalizedStep, eventStep: NormalizedStep, rawEvent?: KeyboardEvent): boolean {\n if (step.ctrl !== eventStep.ctrl) return false;\n if (step.alt !== eventStep.alt) return false;\n if (step.meta !== eventStep.meta) return false;\n\n // Correspondance de la touche\n const keyMatches =\n step.key === eventStep.key ||\n (rawEvent && step.key === rawEvent.key.toLowerCase());\n\n if (!keyMatches) return false;\n\n // Correspondance Shift :\n // Si la touche sp\u00E9cifie shift: true, l'\u00E9v\u00E9nement doit avoir shiftKey true.\n // Si la touche sp\u00E9cifie shift: false, mais que le caract\u00E8re est un symbole (ex: \"?\")\n // tap\u00E9 avec shift, on tol\u00E8re si la touche correspond exactement.\n if (step.shift === eventStep.shift) {\n return true;\n }\n\n if (!step.shift && eventStep.shift) {\n // Autoris\u00E9 si c'est un caract\u00E8re sp\u00E9cial direct (comme \"?\" ou \"!\")\n if (rawEvent && rawEvent.key === step.key) {\n return true;\n }\n }\n\n return false;\n }\n\n private findMatchingChord(\n candidates: RegisteredShortcut[],\n currentStep: NormalizedStep,\n rawEvent: KeyboardEvent\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (candidate.isSequence || candidate.normalizedSteps.length !== 1) {\n continue;\n }\n\n const step = candidate.normalizedSteps[0];\n if (this.stepMatches(step, currentStep, rawEvent)) {\n return candidate;\n }\n }\n return null;\n }\n\n private findMatchingSequence(\n candidates: RegisteredShortcut[],\n proposed: NormalizedStep[]\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length !== proposed.length) {\n continue;\n }\n\n let allMatch = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n allMatch = false;\n break;\n }\n }\n\n if (allMatch) {\n return candidate;\n }\n }\n return null;\n }\n\n private isPrefixOfAnySequence(candidates: RegisteredShortcut[], proposed: NormalizedStep[]): boolean {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length <= proposed.length) {\n continue;\n }\n\n let prefixMatches = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n prefixMatches = false;\n break;\n }\n }\n\n if (prefixMatches) {\n return true;\n }\n }\n return false;\n }\n\n private executeShortcut(\n shortcut: RegisteredShortcut,\n event: KeyboardEvent,\n scope: string,\n isSequence: boolean\n ): void {\n if (shortcut.preventDefault) {\n event.preventDefault();\n }\n if (shortcut.stopPropagation) {\n event.stopPropagation();\n }\n\n const info: ShortcutInfo = {\n combo: shortcut.combo,\n formattedCombo: shortcut.formattedCombo,\n scope,\n target: event.target,\n isSequence\n };\n\n try {\n shortcut.handler(event, info);\n } catch (err) {\n if (this.options.onError) {\n this.options.onError(err instanceof Error ? err : new Error(String(err)), shortcut.combo);\n } else {\n console.error(`[Wulf.Shortcut] Erreur lors de l'ex\u00E9cution du raccourci \"${shortcut.combo}\":`, err);\n }\n }\n }\n\n private resetSequenceTimer(): void {\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n }\n this.sequenceTimer = setTimeout(() => {\n this.clearSequenceBuffer();\n }, this.options.sequenceTimeout);\n }\n\n private clearSequenceBuffer(): void {\n this.sequenceBuffer = [];\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n this.sequenceTimer = null;\n }\n }\n}\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,MAAM,oBAAN,MAAM,mBAAkB;AAAA;AAAA;AAAA;AAAA,IAI7B,OAAc,UAAmB;AAC/B,UAAI,OAAO,cAAc,aAAa;AACpC,eAAO;AAAA,MACT;AAGA,YAAM,SAAU,UAAmE;AACnF,UAAI,UAAU,OAAO,OAAO,aAAa,UAAU;AACjD,cAAM,IAAI,OAAO,SAAS,YAAY;AACtC,YAAI,EAAE,SAAS,KAAK,KAAK,EAAE,SAAS,KAAK,GAAG;AAC1C,iBAAO;AAAA,QACT;AAAA,MACF;AAGA,YAAM,YAAY,UAAU,YAAY,IAAI,YAAY;AACxD,UAAI,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,QAAQ,KAAK,SAAS,SAAS,MAAM,KAAK,SAAS,SAAS,MAAM,GA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AACZ,YAAI,KAAK,QAAQ,SAAS;AACxB,eAAK,QAAQ,QAAQ,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,GAAG,CAAC,GAAG,SAAS,KAAK;AAAA,QAC1F,OAAO;AACL,kBAAQ,MAAM,+DAA4D,SAAS,KAAK,MAAM,GAAG;AAAA,QACnG;AAAA,MACF;AAAA,IACF;AAAA,IAEQ,qBAA2B;AACjC,UAAI,KAAK,eAAe;AACtB,qBAAa,KAAK,aAAa;AAAA,MACjC;AACA,WAAK,gBAAgB,WAAW,MAAM;AACpC,aAAK,oBAAoB;AAAA,MAC3B,GAAG,KAAK,QAAQ,eAAe;AAAA,IACjC;AAAA,IAEQ,sBAA4B;AAClC,WAAK,iBAAiB,CAAC;AACvB,UAAI,KAAK,eAAe;AACtB,qBAAa,KAAK,aAAa;AAC/B,aAAK,gBAAgB;AAAA,MACvB;AAAA,IACF;AAAA,EACF;;;AF1hBA,MAAI,OAAO,WAAW,aAAa;AACjC,UAAM,MAAM;AACZ,UAAM,gBAAkB,IAAI,QAAoC,CAAC;AACjE,QAAI,OAAO;AAEX,kBAAc,WAAW,OAAO,OAAO,iBAAiB;AAAA,MACtD;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;",
6
6
  "names": ["popped"]
7
7
  }
@@ -1,3 +1,3 @@
1
- "use strict";var Wulf=(()=>{var S=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var q=(n,e)=>{for(var t in e)S(n,t,{get:e[t],enumerable:!0})},k=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of v(e))!w.call(n,r)&&r!==t&&S(n,r,{get:()=>e[r],enumerable:!(i=y(e,r))||i.enumerable});return n};var E=n=>k(S({},"__esModule",{value:!0}),n);var L={};q(L,{ShortcutFormatter:()=>l,ShortcutManager:()=>m,default:()=>m});var l=class n{static isApple(){if(typeof navigator>"u")return!1;let e=navigator.userAgentData;if(e&&typeof e.platform=="string"){let r=e.platform.toLowerCase();if(r.includes("mac")||r.includes("ios"))return!0}let t=(navigator.platform||"").toLowerCase();if(t.includes("mac")||t.includes("iphone")||t.includes("ipad")||t.includes("ipod"))return!0;let i=(navigator.userAgent||"").toLowerCase();return i.includes("macintosh")||i.includes("mac os x")||i.includes("ipad")||i.includes("iphone")}static normalizeKeyName(e){let t=e.trim().toLowerCase();switch(t){case"esc":return"escape";case"return":return"enter";case"space":case"spacebar":return" ";case"del":return"delete";case"ins":return"insert";case"up":return"arrowup";case"down":return"arrowdown";case"left":return"arrowleft";case"right":return"arrowright";default:return t}}static parseCombo(e,t=n.isApple()){let i=e.trim();if(!i)return[];let r=i.split(/\s+/),s=[];for(let o of r){let c=[],u="";for(let h=0;h<o.length;h++){let a=o[h];a==="+"?u===""&&c.length>0?c.push("+"):u!==""&&(c.push(u),u=""):u+=a}u!==""&&c.push(u);let f=!1,d=!1,p=!1,g=!1,b="";for(let h of c){let a=h.trim().toLowerCase();a==="ctrl"||a==="control"?f=!0:a==="alt"||a==="option"||a==="opt"?d=!0:a==="shift"||a==="maj"?p=!0:a==="cmd"||a==="command"||a==="meta"||a==="win"||a==="super"?g=!0:a==="mod"||a==="$mod"?t?g=!0:f=!0:b=n.normalizeKeyName(h)}s.push({ctrl:f,alt:d,shift:p,meta:g,key:b})}return s}static format(e,t=n.isApple()){let i=n.parseCombo(e,t);return i.length===0?e:i.map(s=>{let o=[];if(t){s.ctrl&&o.push("\u2303"),s.alt&&o.push("\u2325"),s.shift&&o.push("\u21E7"),s.meta&&o.push("\u2318");let c=n.formatKeyDisplay(s.key,!0);return o.push(c),o.join("")}else{s.ctrl&&o.push("Ctrl"),s.alt&&o.push("Alt"),s.shift&&o.push("Shift"),s.meta&&o.push("Win");let c=n.formatKeyDisplay(s.key,!1);return o.push(c),o.join("+")}}).join(" ")}static toAriaKeyShortcuts(e,t=n.isApple()){return n.parseCombo(e,t).map(r=>{let s=[];return r.ctrl&&s.push("Control"),r.alt&&s.push("Alt"),r.shift&&s.push("Shift"),r.meta&&s.push("Meta"),s.push(n.formatKeyDisplay(r.key,!1)),s.join("+")}).join(" ")}static formatKeyDisplay(e,t){if(!e)return"";switch(e.toLowerCase()){case"escape":return t?"\u238B":"Esc";case"enter":return t?"\u21A9":"Enter";case" ":return t?"\u2423":"Space";case"tab":return t?"\u21E5":"Tab";case"backspace":return t?"\u232B":"Backspace";case"delete":return t?"\u2326":"Suppr";case"arrowup":return"\u2191";case"arrowdown":return"\u2193";case"arrowleft":return"\u2190";case"arrowright":return"\u2192";default:return e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}}};var m=class n{constructor(e){this.shortcuts=new Map;this.scopeStack=[];this.sequenceBuffer=[];this.sequenceTimer=null;this.isListening=!0;this.boundListener=null;this.idCounter=0;this.options={defaultScope:e?.defaultScope||"global",sequenceTimeout:e?.sequenceTimeout??800,target:e?.target||(typeof window<"u"?window:{}),onError:e?.onError},this.scopeStack=[this.options.defaultScope],this.initListener()}static isEditable(e){if(!e||typeof e.tagName!="string")return!1;let t=e,i=t.tagName.toUpperCase();if(i==="INPUT"){let s=t.type?.toLowerCase()||"text";return!["button","checkbox","radio","submit","reset","range","color","file","image"].includes(s)}if(i==="TEXTAREA"||i==="SELECT"||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")==="plaintext-only")return!0;let r=t.getAttribute("role");return r==="textbox"||r==="searchbox"}bind(e){let t=Array.isArray(e)?e:[e],i=[];for(let r of t){if(!r.combo||typeof r.handler!="function")continue;let s=`wulf_shortcut_${++this.idCounter}`,o=l.parseCombo(r.combo),c=o.length>1,u=l.format(r.combo),f={...r,id:s,scope:r.scope||"global",category:r.category||"G\xE9n\xE9ral",allowInEditable:r.allowInEditable??!1,preventDefault:r.preventDefault??!0,stopPropagation:r.stopPropagation??!0,priority:r.priority??0,formattedCombo:u,normalizedSteps:o,isSequence:c};this.shortcuts.set(s,f),i.push(s)}return()=>{for(let r of i)this.shortcuts.delete(r)}}unbind(e,t){let i=l.format(e);for(let[r,s]of this.shortcuts.entries())(s.formattedCombo===i||s.combo.trim().toLowerCase()===e.trim().toLowerCase())&&(!t||s.scope===t)&&this.shortcuts.delete(r)}pushScope(e){e&&typeof e=="string"&&(this.scopeStack.push(e),this.clearSequenceBuffer())}popScope(e){if(this.scopeStack.length<=1)return this.scopeStack[0];if(e){if(this.getScope()===e){let i=this.scopeStack.pop();return this.clearSequenceBuffer(),i}return}let t=this.scopeStack.pop();return this.clearSequenceBuffer(),t}setScope(e){this.scopeStack=[e||this.options.defaultScope],this.clearSequenceBuffer()}getScope(){return this.scopeStack[this.scopeStack.length-1]||this.options.defaultScope}getScopeStack(){return[...this.scopeStack]}pause(){this.isListening=!1,this.clearSequenceBuffer()}resume(){this.isListening=!0}isActive(){return this.isListening}getRegistry(e){let t=[];for(let i of this.shortcuts.values())(!e||i.scope===e||i.scope==="*")&&t.push({...i});return t}attachAria(e,t){if(e&&typeof e.setAttribute=="function"){let i=l.toAriaKeyShortcuts(t);e.setAttribute("aria-keyshortcuts",i)}}static format(e,t){return l.format(e,t)}destroy(){this.pause(),this.removeListener(),this.shortcuts.clear(),this.scopeStack=[],this.clearSequenceBuffer()}initListener(){if(typeof window>"u"||!this.options.target)return;this.boundListener=t=>this.handleKeyDown(t);let e=this.options.target;typeof e.addEventListener=="function"&&e.addEventListener("keydown",this.boundListener,!1)}removeListener(){if(this.boundListener&&this.options.target){let e=this.options.target;typeof e.removeEventListener=="function"&&e.removeEventListener("keydown",this.boundListener,!1),this.boundListener=null}}handleKeyDown(e){if(!this.isListening)return;let t=(e.key||"").toLowerCase();if(["control","alt","shift","meta"].includes(t))return;let i=this.getScope(),r=n.isEditable(e.target),s={ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey,key:l.normalizeKeyName(e.key||"")},o=Date.now();if(this.sequenceBuffer.length>0){let p=this.sequenceBuffer[this.sequenceBuffer.length-1];o-p.timestamp>this.options.sequenceTimeout&&this.clearSequenceBuffer()}let c=this.getActiveShortcuts(i,r),u=[...this.sequenceBuffer.map(p=>p.step),s],f=this.findMatchingSequence(c,u);if(f){this.clearSequenceBuffer(),this.executeShortcut(f,e,i,!0);return}if(this.isPrefixOfAnySequence(c,u)){this.sequenceBuffer.push({step:s,timestamp:o}),this.resetSequenceTimer(),e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&!r&&e.preventDefault();return}this.clearSequenceBuffer();let d=this.findMatchingChord(c,s,e);d&&this.executeShortcut(d,e,i,!1)}getActiveShortcuts(e,t){let i=[];for(let r of this.shortcuts.values())r.scope!==e&&r.scope!=="*"||t&&!r.allowInEditable||i.push(r);return i.sort((r,s)=>(s.priority??0)-(r.priority??0))}stepMatches(e,t,i){return e.ctrl!==t.ctrl||e.alt!==t.alt||e.meta!==t.meta||!(e.key===t.key||i&&e.key===i.key.toLowerCase())?!1:!!(e.shift===t.shift||!e.shift&&t.shift&&i&&i.key===e.key)}findMatchingChord(e,t,i){for(let r of e){if(r.isSequence||r.normalizedSteps.length!==1)continue;let s=r.normalizedSteps[0];if(this.stepMatches(s,t,i))return r}return null}findMatchingSequence(e,t){for(let i of e){if(!i.isSequence||i.normalizedSteps.length!==t.length)continue;let r=!0;for(let s=0;s<t.length;s++)if(!this.stepMatches(i.normalizedSteps[s],t[s])){r=!1;break}if(r)return i}return null}isPrefixOfAnySequence(e,t){for(let i of e){if(!i.isSequence||i.normalizedSteps.length<=t.length)continue;let r=!0;for(let s=0;s<t.length;s++)if(!this.stepMatches(i.normalizedSteps[s],t[s])){r=!1;break}if(r)return!0}return!1}executeShortcut(e,t,i,r){e.preventDefault&&t.preventDefault(),e.stopPropagation&&t.stopPropagation();let s={combo:e.combo,formattedCombo:e.formattedCombo,scope:i,target:t.target,isSequence:r};try{e.handler(t,s)}catch(o){this.options.onError?this.options.onError(o instanceof Error?o:new Error(String(o)),e.combo):console.error(`[Wulf.Shortcut] Erreur lors de l'ex\xE9cution du raccourci "${e.combo}":`,o)}}resetSequenceTimer(){this.sequenceTimer&&clearTimeout(this.sequenceTimer),this.sequenceTimer=setTimeout(()=>{this.clearSequenceBuffer()},this.options.sequenceTimeout)}clearSequenceBuffer(){this.sequenceBuffer=[],this.sequenceTimer&&(clearTimeout(this.sequenceTimer),this.sequenceTimer=null)}};return E(L);})();
2
- if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast", "FocusTrap", "Shortcut"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
1
+ "use strict";var __WulfIIFE=(()=>{var b=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var t in e)b(n,t,{get:e[t],enumerable:!0})},E=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of w(e))!k.call(n,i)&&i!==t&&b(n,i,{get:()=>e[i],enumerable:!(s=y(e,i))||s.enumerable});return n};var q=n=>E(b({},"__esModule",{value:!0}),n);var T={};v(T,{ShortcutFormatter:()=>l,ShortcutManager:()=>h,default:()=>h});var l=class n{static isApple(){if(typeof navigator>"u")return!1;let e=navigator.userAgentData;if(e&&typeof e.platform=="string"){let i=e.platform.toLowerCase();if(i.includes("mac")||i.includes("ios"))return!0}let t=(navigator.platform||"").toLowerCase();if(t.includes("mac")||t.includes("iphone")||t.includes("ipad")||t.includes("ipod"))return!0;let s=(navigator.userAgent||"").toLowerCase();return s.includes("macintosh")||s.includes("mac os x")||s.includes("ipad")||s.includes("iphone")}static normalizeKeyName(e){let t=e.trim().toLowerCase();switch(t){case"esc":return"escape";case"return":return"enter";case"space":case"spacebar":return" ";case"del":return"delete";case"ins":return"insert";case"up":return"arrowup";case"down":return"arrowdown";case"left":return"arrowleft";case"right":return"arrowright";default:return t}}static parseCombo(e,t=n.isApple()){if(typeof e!="string")return[];let s=e.slice(0,512).trim();if(!s)return[];let i=s.split(/\s+/).slice(0,10),r=[];for(let o of i){let c=[],u="";for(let f=0;f<o.length;f++){let a=o[f];a==="+"?u===""&&c.length>0?c.push("+"):u!==""&&(c.push(u),u=""):u+=a}u!==""&&c.push(u);let p=!1,d=!1,g=!1,m=!1,S="";for(let f of c){let a=f.trim().toLowerCase();a==="ctrl"||a==="control"?p=!0:a==="alt"||a==="option"||a==="opt"?d=!0:a==="shift"||a==="maj"?g=!0:a==="cmd"||a==="command"||a==="meta"||a==="win"||a==="super"?m=!0:a==="mod"||a==="$mod"?t?m=!0:p=!0:S=n.normalizeKeyName(f)}r.push({ctrl:p,alt:d,shift:g,meta:m,key:S})}return r}static format(e,t=n.isApple()){let s=n.parseCombo(e,t);return s.length===0?e:s.map(r=>{let o=[];if(t){r.ctrl&&o.push("\u2303"),r.alt&&o.push("\u2325"),r.shift&&o.push("\u21E7"),r.meta&&o.push("\u2318");let c=n.formatKeyDisplay(r.key,!0);return o.push(c),o.join("")}else{r.ctrl&&o.push("Ctrl"),r.alt&&o.push("Alt"),r.shift&&o.push("Shift"),r.meta&&o.push("Win");let c=n.formatKeyDisplay(r.key,!1);return o.push(c),o.join("+")}}).join(" ")}static toAriaKeyShortcuts(e,t=n.isApple()){return n.parseCombo(e,t).map(i=>{let r=[];return i.ctrl&&r.push("Control"),i.alt&&r.push("Alt"),i.shift&&r.push("Shift"),i.meta&&r.push("Meta"),r.push(n.formatKeyDisplay(i.key,!1)),r.join("+")}).join(" ")}static formatKeyDisplay(e,t){if(!e)return"";switch(e.toLowerCase()){case"escape":return t?"\u238B":"Esc";case"enter":return t?"\u21A9":"Enter";case" ":return t?"\u2423":"Space";case"tab":return t?"\u21E5":"Tab";case"backspace":return t?"\u232B":"Backspace";case"delete":return t?"\u2326":"Suppr";case"arrowup":return"\u2191";case"arrowdown":return"\u2193";case"arrowleft":return"\u2190";case"arrowright":return"\u2192";default:return e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}}};var h=class n{constructor(e){this.shortcuts=new Map;this.scopeStack=[];this.sequenceBuffer=[];this.sequenceTimer=null;this.isListening=!0;this.boundListener=null;this.idCounter=0;this.options={defaultScope:e?.defaultScope||"global",sequenceTimeout:e?.sequenceTimeout??800,target:e?.target||(typeof window<"u"?window:{}),onError:e?.onError},this.scopeStack=[this.options.defaultScope],this.initListener()}static isEditable(e){if(!e||typeof e.tagName!="string")return!1;let t=e,s=t.tagName.toUpperCase();if(s==="INPUT"){let r=t.type?.toLowerCase()||"text";return!["button","checkbox","radio","submit","reset","range","color","file","image"].includes(r)}if(s==="TEXTAREA"||s==="SELECT"||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")==="plaintext-only"||t.getAttribute("contenteditable")==="")return!0;let i=t.getAttribute("role");return!!(i==="textbox"||i==="searchbox"||typeof t.closest=="function"&&t.closest('[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"]'))}static isPasswordField(e){if(!e||typeof e.tagName!="string")return!1;let t=e;return t.tagName.toUpperCase()==="INPUT"&&(t.type||"").toLowerCase()==="password"}bind(e){let t=Array.isArray(e)?e:[e],s=[];for(let i of t){if(!i.combo||typeof i.handler!="function")continue;let r=`wulf_shortcut_${++this.idCounter}`,o=l.parseCombo(i.combo),c=o.length>1,u=l.format(i.combo),p={...i,id:r,scope:i.scope||"global",category:i.category||"G\xE9n\xE9ral",allowInEditable:i.allowInEditable??!1,preventDefault:i.preventDefault??!0,stopPropagation:i.stopPropagation??!0,priority:i.priority??0,formattedCombo:u,normalizedSteps:o,isSequence:c};this.shortcuts.set(r,p),s.push(r)}return()=>{for(let i of s)this.shortcuts.delete(i)}}unbind(e,t){let s=l.format(e);for(let[i,r]of this.shortcuts.entries())(r.formattedCombo===s||r.combo.trim().toLowerCase()===e.trim().toLowerCase())&&(!t||r.scope===t)&&this.shortcuts.delete(i)}pushScope(e){if(e&&typeof e=="string"){if(this.scopeStack.length>=64)return;this.scopeStack.push(e),this.clearSequenceBuffer()}}popScope(e){if(this.scopeStack.length<=1)return this.scopeStack[0];if(e){if(this.getScope()===e){let s=this.scopeStack.pop();return this.clearSequenceBuffer(),s}return}let t=this.scopeStack.pop();return this.clearSequenceBuffer(),t}setScope(e){this.scopeStack=[e||this.options.defaultScope],this.clearSequenceBuffer()}getScope(){return this.scopeStack[this.scopeStack.length-1]||this.options.defaultScope}getScopeStack(){return[...this.scopeStack]}pause(){this.isListening=!1,this.clearSequenceBuffer()}resume(){this.isListening=!0}isActive(){return this.isListening}getRegistry(e){let t=[];for(let s of this.shortcuts.values())(!e||s.scope===e||s.scope==="*")&&t.push({...s});return t}attachAria(e,t){if(e&&typeof e.setAttribute=="function"){let s=l.toAriaKeyShortcuts(t);e.setAttribute("aria-keyshortcuts",s)}}static format(e,t){return l.format(e,t)}destroy(){this.pause(),this.removeListener(),this.shortcuts.clear(),this.scopeStack=[],this.clearSequenceBuffer()}initListener(){if(typeof window>"u"||!this.options.target)return;this.boundListener=t=>this.handleKeyDown(t);let e=this.options.target;typeof e.addEventListener=="function"&&e.addEventListener("keydown",this.boundListener,!1)}removeListener(){if(this.boundListener&&this.options.target){let e=this.options.target;typeof e.removeEventListener=="function"&&e.removeEventListener("keydown",this.boundListener,!1),this.boundListener=null}}handleKeyDown(e){if(!this.isListening)return;let t=(e.key||"").toLowerCase();if(["control","alt","shift","meta"].includes(t))return;let s=this.getScope(),i=typeof e.composedPath=="function"?e.composedPath():[],r=i.length>0?i[0]:e.target,o=n.isEditable(r)||n.isEditable(e.target),c=n.isPasswordField(r)||n.isPasswordField(e.target),u={ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey,key:l.normalizeKeyName(e.key||"")},p=Date.now();if(this.sequenceBuffer.length>0){let f=this.sequenceBuffer[this.sequenceBuffer.length-1];p-f.timestamp>this.options.sequenceTimeout&&this.clearSequenceBuffer()}let d=this.getActiveShortcuts(s,o,c),g=[...this.sequenceBuffer.map(f=>f.step),u],m=this.findMatchingSequence(d,g);if(m){this.clearSequenceBuffer(),this.executeShortcut(m,e,s,!0);return}if(this.isPrefixOfAnySequence(d,g)){this.sequenceBuffer.push({step:u,timestamp:p}),this.resetSequenceTimer(),e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&!o&&e.preventDefault();return}this.clearSequenceBuffer();let S=this.findMatchingChord(d,u,e);S&&this.executeShortcut(S,e,s,!1)}getActiveShortcuts(e,t,s=!1){let i=[];for(let r of this.shortcuts.values())if(!(r.scope!==e&&r.scope!=="*")&&!(t&&!r.allowInEditable)){if(s){if(r.isSequence)continue;let o=r.normalizedSteps[0];if(o&&o.key.length===1&&!o.ctrl&&!o.alt&&!o.meta)continue}i.push(r)}return i.sort((r,o)=>(o.priority??0)-(r.priority??0))}stepMatches(e,t,s){return e.ctrl!==t.ctrl||e.alt!==t.alt||e.meta!==t.meta||!(e.key===t.key||s&&e.key===s.key.toLowerCase())?!1:!!(e.shift===t.shift||!e.shift&&t.shift&&s&&s.key===e.key)}findMatchingChord(e,t,s){for(let i of e){if(i.isSequence||i.normalizedSteps.length!==1)continue;let r=i.normalizedSteps[0];if(this.stepMatches(r,t,s))return i}return null}findMatchingSequence(e,t){for(let s of e){if(!s.isSequence||s.normalizedSteps.length!==t.length)continue;let i=!0;for(let r=0;r<t.length;r++)if(!this.stepMatches(s.normalizedSteps[r],t[r])){i=!1;break}if(i)return s}return null}isPrefixOfAnySequence(e,t){for(let s of e){if(!s.isSequence||s.normalizedSteps.length<=t.length)continue;let i=!0;for(let r=0;r<t.length;r++)if(!this.stepMatches(s.normalizedSteps[r],t[r])){i=!1;break}if(i)return!0}return!1}executeShortcut(e,t,s,i){e.preventDefault&&t.preventDefault(),e.stopPropagation&&t.stopPropagation();let r={combo:e.combo,formattedCombo:e.formattedCombo,scope:s,target:t.target,isSequence:i};try{e.handler(t,r)}catch(o){this.options.onError?this.options.onError(o instanceof Error?o:new Error(String(o)),e.combo):console.error(`[Wulf.Shortcut] Erreur lors de l'ex\xE9cution du raccourci "${e.combo}":`,o)}}resetSequenceTimer(){this.sequenceTimer&&clearTimeout(this.sequenceTimer),this.sequenceTimer=setTimeout(()=>{this.clearSequenceBuffer()},this.options.sequenceTimeout)}clearSequenceBuffer(){this.sequenceBuffer=[],this.sequenceTimer&&(clearTimeout(this.sequenceTimer),this.sequenceTimer=null)}};if(typeof window<"u"){let n=window,e=n.Wulf||{};n.Wulf=e,e.Shortcut=Object.assign(h,{ShortcutManager:h,ShortcutFormatter:l})}return q(T);})();
2
+ if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof __WulfIIFE !== "undefined" && __WulfIIFE) { for (var k in __WulfIIFE) { if (Object.prototype.hasOwnProperty.call(__WulfIIFE, k) && k !== "__proto__" && k !== "constructor" && k !== "prototype" && window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: __WulfIIFE[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = __WulfIIFE[k]; } catch (__) {} } } } } }
3
3
  //# sourceMappingURL=shortcut.global.min.js.map