wulf.js 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -11
- package/changelog.md +60 -0
- package/dist/anchor.esm.js +9 -0
- package/dist/anchor.esm.js.map +7 -0
- package/dist/anchor.global.js +695 -0
- package/dist/anchor.global.js.map +7 -0
- package/dist/anchor.global.min.js +6 -0
- package/dist/anchor.global.min.js.map +7 -0
- package/dist/autosize.css +1 -0
- package/dist/autosize.css.map +7 -0
- package/dist/autosize.esm.js +10 -0
- package/dist/autosize.esm.js.map +7 -0
- package/dist/autosize.global.js +657 -0
- package/dist/autosize.global.js.map +7 -0
- package/dist/autosize.global.min.js +6 -0
- package/dist/autosize.global.min.js.map +7 -0
- package/dist/autosize.layered.css +1 -0
- package/dist/autosize.layered.css.map +7 -0
- package/dist/chunks/chunk-22AIMRD5.js +119 -0
- package/dist/chunks/chunk-22AIMRD5.js.map +7 -0
- package/dist/chunks/chunk-5N2IRGDM.js +766 -0
- package/dist/chunks/chunk-5N2IRGDM.js.map +7 -0
- package/dist/chunks/chunk-72FVCNNZ.js +863 -0
- package/dist/chunks/chunk-72FVCNNZ.js.map +7 -0
- package/dist/chunks/chunk-AXZYYW7H.js +865 -0
- package/dist/chunks/chunk-AXZYYW7H.js.map +7 -0
- package/dist/chunks/chunk-CM3SBIVQ.js +1116 -0
- package/dist/chunks/chunk-CM3SBIVQ.js.map +7 -0
- package/dist/chunks/chunk-H4GRLGQ3.js +578 -0
- package/dist/chunks/chunk-H4GRLGQ3.js.map +7 -0
- package/dist/chunks/chunk-ITRU2RFV.js +1195 -0
- package/dist/chunks/chunk-ITRU2RFV.js.map +7 -0
- package/dist/chunks/chunk-NLUQZEL4.js +1029 -0
- package/dist/chunks/chunk-NLUQZEL4.js.map +7 -0
- package/dist/chunks/chunk-QV46A7FV.js +197 -0
- package/dist/chunks/chunk-QV46A7FV.js.map +7 -0
- package/dist/chunks/chunk-SXLUXN6W.js +612 -0
- package/dist/chunks/chunk-SXLUXN6W.js.map +7 -0
- package/dist/chunks/chunk-T2H4EJCW.js +621 -0
- package/dist/chunks/chunk-T2H4EJCW.js.map +7 -0
- package/dist/chunks/chunk-TILLYEF2.js +6044 -0
- package/dist/chunks/chunk-TILLYEF2.js.map +7 -0
- package/dist/chunks/chunk-VJO22BAT.js +72 -0
- package/dist/chunks/chunk-VJO22BAT.js.map +7 -0
- package/dist/chunks/chunk-ZGUU6DMM.js +77 -0
- package/dist/chunks/chunk-ZGUU6DMM.js.map +7 -0
- package/dist/focus-trap.esm.js +6 -536
- package/dist/focus-trap.esm.js.map +3 -3
- package/dist/focus-trap.global.js +260 -87
- package/dist/focus-trap.global.js.map +3 -3
- package/dist/focus-trap.global.min.js +4 -4
- package/dist/focus-trap.global.min.js.map +4 -4
- package/dist/index.esm.js +79 -10069
- package/dist/index.esm.js.map +4 -4
- package/dist/index.global.js +4192 -355
- package/dist/index.global.js.map +4 -4
- package/dist/index.global.min.js +6 -3
- package/dist/index.global.min.js.map +4 -4
- package/dist/mask.esm.js +16 -6094
- package/dist/mask.esm.js.map +4 -4
- package/dist/mask.global.js +44 -55
- package/dist/mask.global.js.map +3 -3
- package/dist/mask.global.min.js +3 -3
- package/dist/mask.global.min.js.map +4 -4
- package/dist/masonry.esm.js +15 -1067
- package/dist/masonry.esm.js.map +4 -4
- package/dist/masonry.global.js +229 -148
- package/dist/masonry.global.js.map +3 -3
- package/dist/masonry.global.min.js +4 -4
- package/dist/masonry.global.min.js.map +4 -4
- package/dist/scroll.css +1 -1
- package/dist/scroll.css.map +2 -2
- package/dist/scroll.esm.js +14 -1175
- package/dist/scroll.esm.js.map +3 -3
- package/dist/scroll.global.js +171 -88
- package/dist/scroll.global.js.map +3 -3
- package/dist/scroll.global.min.js +3 -3
- package/dist/scroll.global.min.js.map +4 -4
- package/dist/scroll.layered.css +1 -1
- package/dist/scroll.layered.css.map +2 -2
- package/dist/shortcut.esm.js +6 -741
- package/dist/shortcut.esm.js.map +4 -4
- package/dist/shortcut.global.js +225 -58
- package/dist/shortcut.global.js.map +3 -3
- package/dist/shortcut.global.min.js +8 -2
- package/dist/shortcut.global.min.js.map +4 -4
- package/dist/size-report.json +319 -0
- package/dist/sortable.css +1 -0
- package/dist/sortable.css.map +7 -0
- package/dist/sortable.esm.js +22 -0
- package/dist/sortable.esm.js.map +7 -0
- package/dist/sortable.global.js +1477 -0
- package/dist/sortable.global.js.map +7 -0
- package/dist/sortable.global.min.js +6 -0
- package/dist/sortable.global.min.js.map +7 -0
- package/dist/sortable.layered.css +1 -0
- package/dist/sortable.layered.css.map +7 -0
- package/dist/sri-manifest.json +64 -0
- package/dist/toast.css +1 -1
- package/dist/toast.css.map +2 -2
- package/dist/toast.esm.js +19 -1129
- package/dist/toast.esm.js.map +3 -3
- package/dist/toast.global.js +386 -104
- package/dist/toast.global.js.map +3 -3
- package/dist/toast.global.min.js +4 -4
- package/dist/toast.global.min.js.map +4 -4
- package/dist/toast.layered.css +1 -1
- package/dist/toast.layered.css.map +2 -2
- package/dist/types/anchor/Anchor.d.ts +41 -0
- package/dist/types/anchor/index.d.ts +3 -0
- package/dist/types/anchor/types.d.ts +115 -0
- package/dist/types/autosize/Autosize.d.ts +71 -0
- package/dist/types/autosize/index.d.ts +3 -0
- package/dist/types/autosize/types.d.ts +66 -0
- package/dist/types/common/AuditableComponent.d.ts +1 -1
- package/dist/types/common/dom.d.ts +5 -0
- package/dist/types/common/registry.d.ts +40 -0
- package/dist/types/focus-trap/FocusTrap.d.ts +8 -3
- package/dist/types/index.d.ts +13 -1
- package/dist/types/mask/paste.d.ts +2 -5
- package/dist/types/masonry/Masonry.d.ts +2 -0
- package/dist/types/scroll/ScrollBlock.d.ts +2 -0
- package/dist/types/scroll/types.d.ts +6 -0
- package/dist/types/shortcut/ShortcutManager.d.ts +16 -3
- package/dist/types/shortcut/types.d.ts +5 -0
- package/dist/types/sortable/Sortable.d.ts +75 -0
- package/dist/types/sortable/i18n/en.d.ts +2 -0
- package/dist/types/sortable/i18n/fr.d.ts +2 -0
- package/dist/types/sortable/i18n/index.d.ts +9 -0
- package/dist/types/sortable/i18n/types.d.ts +15 -0
- package/dist/types/sortable/index.d.ts +4 -0
- package/dist/types/sortable/types.d.ts +112 -0
- package/dist/types/toast/Toast.d.ts +6 -1
- package/dist/types/toast/ToastInstance.d.ts +7 -0
- package/dist/types/toast/ToastManager.d.ts +4 -2
- package/dist/types/toast/types.d.ts +27 -1
- package/dist/types/undo/UndoManager.d.ts +112 -0
- package/dist/types/undo/i18n/en.d.ts +2 -0
- package/dist/types/undo/i18n/fr.d.ts +2 -0
- package/dist/types/undo/i18n/index.d.ts +9 -0
- package/dist/types/undo/i18n/types.d.ts +6 -0
- package/dist/types/undo/index.d.ts +5 -0
- package/dist/types/undo/types.d.ts +106 -0
- package/dist/undo.esm.js +23 -0
- package/dist/undo.esm.js.map +7 -0
- package/dist/undo.global.js +1029 -0
- package/dist/undo.global.js.map +7 -0
- package/dist/undo.global.min.js +6 -0
- package/dist/undo.global.min.js.map +7 -0
- package/package.json +54 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/shortcut/index.ts", "../src/common/dom.ts", "../src/
|
|
4
|
-
"sourcesContent": ["import { getSafeWulfNamespace } from '../common/dom';\nimport { 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)\nconst wulfNamespace = getSafeWulfNamespace();\nif (wulfNamespace) {\n wulfNamespace.Shortcut = Object.assign(ShortcutManager, {\n ShortcutManager,\n ShortcutFormatter\n });\n}\n\n\n", "/**\n * Utilitaires DOM & animations l\u00E9gers partag\u00E9s entre les modules Wulf (z\u00E9ro d\u00E9pendance).\n */\n\n/**\n * Retourne de mani\u00E8re s\u00FBre le namespace global window.Wulf en bloquant tout DOM Clobbering.\n */\nexport function getSafeWulfNamespace(): Record<string, unknown> | null {\n if (typeof window === 'undefined') return null;\n const win = window as unknown as Record<string, unknown>;\n const existing = win.Wulf;\n if (\n !existing ||\n typeof existing !== 'object' ||\n (typeof Node !== 'undefined' && existing instanceof Node) ||\n (typeof HTMLCollection !== 'undefined' && existing instanceof HTMLCollection)\n ) {\n const fresh: Record<string, unknown> = {};\n win.Wulf = fresh;\n return fresh;\n }\n return existing as Record<string, unknown>;\n}\n\n/**\n * \u00C9chappe une cha\u00EEne pour son utilisation s\u00FBre dans un s\u00E9lecteur CSS.\n */\nexport function safeCssEscape(value: string): string {\n if (typeof CSS !== 'undefined' && typeof CSS.escape === 'function') {\n return CSS.escape(value);\n }\n return String(value).replace(/[\"\\\\\\u0000-\\u001F\\u007F]/g, '\\\\$&');\n}\n\n/**\n * Retourne l'\u00E9l\u00E9ment ayant r\u00E9ellement le focus, en descendant \u00E0 travers les Shadow Roots ouverts.\n */\nexport function getDeepActiveElement(root?: Document | ShadowRoot | null): HTMLElement | null {\n if (typeof document === 'undefined') return null;\n let active: Element | null = (root ?? document).activeElement;\n while (active && active.shadowRoot && active.shadowRoot.activeElement) {\n active = active.shadowRoot.activeElement;\n }\n return active && typeof (active as HTMLElement).focus === 'function' ? (active as HTMLElement) : null;\n}\n\n/**\n * D\u00E9place un n\u0153ud DOM via moveBefore() si disponible et compatible (m\u00EAme racine connect\u00E9e)\n * afin de pr\u00E9server focus, \u00E9tat d'iframe et animations CSS, avec repli insertBefore().\n */\nexport function safeMove(parent: Element, node: Node, referenceNode: Node | null = null): void {\n const moveBefore = (parent as Element & { moveBefore?: (n: Node, ref: Node | null) => void }).moveBefore;\n if (\n typeof moveBefore === 'function' &&\n node.isConnected &&\n parent.isConnected &&\n typeof parent.getRootNode === 'function' &&\n typeof node.getRootNode === 'function' &&\n parent.getRootNode() === node.getRootNode()\n ) {\n try {\n moveBefore.call(parent, node, referenceNode);\n return;\n } catch {\n // Repli transparent vers insertBefore si l'op\u00E9ration atomique \u00E9choue\n }\n }\n parent.insertBefore(node, referenceNode);\n}\n\n/**\n * D\u00E9tecte une composition IME en cours, en cantonnant le repli Safari WebKit 165004 (keyCode 229)\n * \u00E0 la touche Enter pour ne pas bloquer les claviers virtuels mobiles Android.\n */\nexport function isImeComposing(event: KeyboardEvent): boolean {\n return Boolean(\n event.isComposing ||\n event.key === 'Process' ||\n (event.key === 'Enter' && event.keyCode === 229)\n );\n}\n\n/**\n * Convertit une dur\u00E9e CSS (nombre en ms ou cha\u00EEne \".3s\" / \"300ms\" / \"0.3s, 150ms\") en millisecondes born\u00E9es.\n */\nexport function parseCssDurationMs(\n duration: number | string | undefined,\n fallbackMs: number = 300,\n maxMs: number = 60000\n): number {\n const safeFallback = Number.isFinite(fallbackMs) && fallbackMs >= 0 ? Math.min(fallbackMs, maxMs) : 300;\n if (typeof duration === 'number') {\n return Number.isFinite(duration) && duration >= 0 ? Math.min(duration, maxMs) : safeFallback;\n }\n if (typeof duration === 'string') {\n const parts = duration.split(',');\n let maxParsed = -1;\n for (const part of parts) {\n const match = /^\\+?(\\d+(?:\\.\\d+)?|\\.\\d+)(ms|s)?$/i.exec(part.trim());\n if (match) {\n const raw = parseFloat(match[1]);\n if (Number.isFinite(raw) && raw >= 0) {\n const ms = match[2]?.toLowerCase() === 's' ? raw * 1000 : raw;\n if (ms > maxParsed) {\n maxParsed = ms;\n }\n }\n }\n }\n if (maxParsed >= 0) {\n return Math.min(maxParsed, maxMs);\n }\n }\n return safeFallback;\n}\n\n/**\n * Indique si l'utilisateur pr\u00E9f\u00E8re les animations r\u00E9duites.\n */\nexport function prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\n/**\n * Attend la fin des animations/transitions CSS finies en cours sur un \u00E9l\u00E9ment via getAnimations(),\n * avec r\u00E9solution imm\u00E9diate sous prefers-reduced-motion et filet de s\u00E9curit\u00E9 timeout/signal.\n */\nexport function waitForAnimations(\n element: Element,\n fallbackMs: number,\n signal?: AbortSignal\n): Promise<void> {\n const safeFallback = Number.isFinite(fallbackMs) ? Math.min(fallbackMs, 60000) : 300;\n if (signal?.aborted || safeFallback <= 0 || prefersReducedMotion()) {\n return Promise.resolve();\n }\n\n const animations = typeof element.getAnimations === 'function'\n ? element.getAnimations().filter((a) => {\n if (a.playState !== 'running') return false;\n const timing = a.effect?.getComputedTiming?.();\n return timing ? Number.isFinite(timing.endTime as number) : true;\n })\n : [];\n if (animations.length === 0) {\n return Promise.resolve();\n }\n\n return new Promise<void>((resolve) => {\n let settled = false;\n let timerId: ReturnType<typeof setTimeout> | null = null;\n\n const finish = () => {\n if (settled) return;\n settled = true;\n if (timerId !== null) {\n clearTimeout(timerId);\n timerId = null;\n }\n signal?.removeEventListener('abort', finish);\n resolve();\n };\n\n signal?.addEventListener('abort', finish, { once: true });\n timerId = setTimeout(finish, safeFallback);\n Promise.allSettled(animations.map((a) => a.finished)).then(finish);\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 if (key === ' ') {\n return ' ';\n }\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 'plus':\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 if (combo === ' ') {\n return [{ ctrl: false, alt: false, shift: false, meta: false, key: ' ' }];\n }\n const trimmed = combo.slice(0, 512).trim();\n if (!trimmed) {\n return [];\n }\n\n // Normaliser les espaces autour des op\u00E9rateurs '+' d'accords (\"Mod + Shift + P\" -> \"Mod+Shift+P\")\n // tout en pr\u00E9servant les s\u00E9quences s\u00E9par\u00E9es par espaces (\"g i\", \"g +\")\n const normalizedChordSpacing = trimmed.replace(\n /\\b(ctrl|control|alt|option|opt|shift|maj|cmd|command|meta|win|super|mod|\\$mod)\\s*\\+\\s*/gi,\n '$1+'\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 const stepsRaw = normalizedChordSpacing.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 de '+' isol\u00E9 et de '++' pour la touche '+')\n const tokens: string[] = [];\n if (rawStep === '+') {\n tokens.push('+');\n } else {\n let currentToken = '';\n for (let i = 0; i < rawStep.length; i++) {\n const char = rawStep[i];\n if (char === '+') {\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\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 * Attention : dans WAI-ARIA 1.2, l'espace d\u00E9limite des raccourcis alternatifs et non une s\u00E9quence temporelle.\n * Pour une s\u00E9quence multi-\u00E9tapes (ex: \"g i\"), retourne une cha\u00EEne vide afin de ne pas induire le lecteur d'\u00E9cran en erreur.\n */\n public static toAriaKeyShortcuts(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n if (steps.length !== 1) {\n return '';\n }\n const step = steps[0];\n const ariaKey = ShortcutFormatter.formatAriaKey(step.key);\n if (!ariaKey) {\n return '';\n }\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(ariaKey);\n return parts.join('+');\n }\n\n /**\n * Formate un nom de touche strictement conforme aux valeurs standard W3C UI Events / aria-keyshortcuts.\n */\n private static formatAriaKey(key: string): string {\n if (!key) return '';\n switch (key.toLowerCase()) {\n case 'escape':\n return 'Escape';\n case 'enter':\n return 'Enter';\n case ' ':\n return 'Space';\n case 'tab':\n return 'Tab';\n case 'backspace':\n return 'Backspace';\n case 'delete':\n return 'Delete';\n case 'insert':\n return 'Insert';\n case 'home':\n return 'Home';\n case 'end':\n return 'End';\n case 'pageup':\n return 'PageUp';\n case 'pagedown':\n return 'PageDown';\n case 'arrowup':\n return 'ArrowUp';\n case 'arrowdown':\n return 'ArrowDown';\n case 'arrowleft':\n return 'ArrowLeft';\n case 'arrowright':\n return 'ArrowRight';\n case 'printscreen':\n return 'PrintScreen';\n case 'scrolllock':\n return 'ScrollLock';\n case 'numlock':\n return 'NumLock';\n case 'capslock':\n return 'CapsLock';\n case 'contextmenu':\n return 'ContextMenu';\n case '+':\n return 'Plus';\n default:\n return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);\n }\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';\nimport { isImeComposing } from '../common/dom';\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 abortController: AbortController | null = null;\n private idCounter = 0;\n\n constructor(options?: ShortcutManagerOptions) {\n const rawTimeout = options?.sequenceTimeout;\n const sequenceTimeout =\n typeof rawTimeout === 'number' && Number.isFinite(rawTimeout) && rawTimeout > 0\n ? Math.min(rawTimeout, 10000)\n : 800;\n\n this.options = {\n defaultScope: options?.defaultScope || 'global',\n sequenceTimeout,\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' || role === 'combobox' || role === 'spinbutton') {\n return true;\n }\n\n // 4. \u00C9l\u00E9ment enfant situ\u00E9 \u00E0 l'int\u00E9rieur d'un conteneur contenteditable ou ARIA textbox/searchbox/combobox/spinbutton\n if (typeof el.closest === 'function') {\n const editableAncestor = el.closest(\n '[contenteditable=\"true\"], [contenteditable=\"plaintext-only\"], [contenteditable=\"\"], [role=\"textbox\"], [role=\"searchbox\"], [role=\"combobox\"], [role=\"spinbutton\"]'\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 if (typeof combo !== 'string' || !combo.trim()) {\n return;\n }\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 if (ariaValue) {\n element.setAttribute('aria-keyshortcuts', ariaValue);\n } else if (typeof element.removeAttribute === 'function') {\n element.removeAttribute('aria-keyshortcuts');\n }\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.abortController = new AbortController();\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, {\n capture: false,\n signal: this.abortController.signal\n });\n }\n }\n\n private removeListener(): void {\n if (this.abortController) {\n this.abortController.abort();\n this.abortController = null;\n } else 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 }\n this.boundListener = null;\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (!this.isListening || isImeComposing(event)) {\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 = event.timeStamp > 0\n ? event.timeStamp\n : (typeof performance !== 'undefined' ? performance.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 (y compris AltGr / Option)\n if (isPasswordInput) {\n if (shortcut.isSequence) {\n continue;\n }\n const firstStep = shortcut.normalizedSteps[0];\n if (firstStep && firstStep.key.length === 1) {\n const isUntouchedChar = !firstStep.ctrl && !firstStep.alt && !firstStep.meta;\n const isAltGrOrOptionChar =\n (firstStep.ctrl && firstStep.alt && !firstStep.meta) ||\n (firstStep.alt && !firstStep.ctrl && !firstStep.meta);\n if (isUntouchedChar || isAltGrOrOptionChar) {\n continue;\n }\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 const rawKey = typeof rawEvent?.key === 'string' ? rawEvent.key : '';\n\n // Correspondance de la touche\n const keyMatches =\n step.key === eventStep.key ||\n (rawKey !== '' && step.key === rawKey.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 (en accord comme en s\u00E9quence).\n if (step.shift === eventStep.shift) {\n return true;\n }\n\n if (!step.shift && eventStep.shift) {\n const isNonAlphaSymbol = step.key.length === 1 && !/^[a-z]$/i.test(step.key);\n if ((rawKey !== '' && rawKey === step.key) || (isNonAlphaSymbol && eventStep.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;;;ACOO,WAAS,uBAAuD;AACrE,QAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,UAAM,MAAM;AACZ,UAAM,WAAW,IAAI;AACrB,QACE,CAAC,YACD,OAAO,aAAa,YACnB,OAAO,SAAS,eAAe,oBAAoB,QACnD,OAAO,mBAAmB,eAAe,oBAA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/common/dom.ts", "../src/common/AuditableComponent.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\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 if (key === ' ') {\n return ' ';\n }\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 'plus':\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 if (combo === ' ') {\n return [{ ctrl: false, alt: false, shift: false, meta: false, key: ' ' }];\n }\n const trimmed = combo.slice(0, 512).trim();\n if (!trimmed) {\n return [];\n }\n\n // Normaliser les espaces autour des op\u00E9rateurs '+' d'accords (\"Mod + Shift + P\" -> \"Mod+Shift+P\")\n // tout en pr\u00E9servant les s\u00E9quences s\u00E9par\u00E9es par espaces (\"g i\", \"g +\")\n const normalizedChordSpacing = trimmed.replace(\n /\\b(ctrl|control|alt|option|opt|shift|maj|cmd|command|meta|win|super|mod|\\$mod)\\s*\\+\\s*/gi,\n '$1+'\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 const stepsRaw = normalizedChordSpacing.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 de '+' isol\u00E9 et de '++' pour la touche '+')\n const tokens: string[] = [];\n if (rawStep === '+') {\n tokens.push('+');\n } else {\n let currentToken = '';\n for (let i = 0; i < rawStep.length; i++) {\n const char = rawStep[i];\n if (char === '+') {\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\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 * Attention : dans WAI-ARIA 1.2, l'espace d\u00E9limite des raccourcis alternatifs et non une s\u00E9quence temporelle.\n * Pour une s\u00E9quence multi-\u00E9tapes (ex: \"g i\"), retourne une cha\u00EEne vide afin de ne pas induire le lecteur d'\u00E9cran en erreur.\n */\n public static toAriaKeyShortcuts(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n if (steps.length !== 1) {\n return '';\n }\n const step = steps[0];\n const ariaKey = ShortcutFormatter.formatAriaKey(step.key);\n if (!ariaKey) {\n return '';\n }\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(ariaKey);\n return parts.join('+');\n }\n\n /**\n * Formate un nom de touche strictement conforme aux valeurs standard W3C UI Events / aria-keyshortcuts.\n */\n private static formatAriaKey(key: string): string {\n if (!key) return '';\n switch (key.toLowerCase()) {\n case 'escape':\n return 'Escape';\n case 'enter':\n return 'Enter';\n case ' ':\n return 'Space';\n case 'tab':\n return 'Tab';\n case 'backspace':\n return 'Backspace';\n case 'delete':\n return 'Delete';\n case 'insert':\n return 'Insert';\n case 'home':\n return 'Home';\n case 'end':\n return 'End';\n case 'pageup':\n return 'PageUp';\n case 'pagedown':\n return 'PageDown';\n case 'arrowup':\n return 'ArrowUp';\n case 'arrowdown':\n return 'ArrowDown';\n case 'arrowleft':\n return 'ArrowLeft';\n case 'arrowright':\n return 'ArrowRight';\n case 'printscreen':\n return 'PrintScreen';\n case 'scrolllock':\n return 'ScrollLock';\n case 'numlock':\n return 'NumLock';\n case 'capslock':\n return 'CapsLock';\n case 'contextmenu':\n return 'ContextMenu';\n case '+':\n return 'Plus';\n default:\n return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);\n }\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' : 'Delete';\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", "/**\n * Utilitaires DOM & animations l\u00E9gers partag\u00E9s entre les modules Wulf (z\u00E9ro d\u00E9pendance).\n */\n\n/**\n * Retourne de mani\u00E8re s\u00FBre le namespace global window.Wulf en bloquant tout DOM Clobbering.\n */\nexport function getSafeWulfNamespace(): Record<string, unknown> | null {\n if (typeof window === 'undefined') return null;\n const win = window as unknown as Record<string, unknown>;\n const existing = win.Wulf;\n if (\n !existing ||\n typeof existing !== 'object' ||\n (typeof Node !== 'undefined' && existing instanceof Node) ||\n (typeof HTMLCollection !== 'undefined' && existing instanceof HTMLCollection)\n ) {\n const fresh: Record<string, unknown> = {};\n win.Wulf = fresh;\n return fresh;\n }\n return existing as Record<string, unknown>;\n}\n\n/**\n * \u00C9chappe une cha\u00EEne pour son utilisation s\u00FBre dans un s\u00E9lecteur CSS.\n */\nexport function safeCssEscape(value: string): string {\n if (typeof CSS !== 'undefined' && typeof CSS.escape === 'function') {\n return CSS.escape(value);\n }\n return String(value).replace(/[\"\\\\\\u0000-\\u001F\\u007F]/g, '\\\\$&');\n}\n\n/**\n * Supprime lin\u00E9airement (O(N)) les caract\u00E8res invisibles / marqueurs bidi / BOM\n * (protection anti-Trojan Source) sans alt\u00E9rer les espaces ni les retours \u00E0 la ligne.\n */\nexport function stripBidiAndInvisibles(raw: string, maxLength: number = 4096): string {\n const safeLimit = Math.max(0, maxLength);\n return String(raw ?? '')\n .slice(0, safeLimit)\n .replace(/[\\u061C\\u200B-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]/g, '');\n}\n\n/**\n * Retourne l'\u00E9l\u00E9ment ayant r\u00E9ellement le focus, en descendant \u00E0 travers les Shadow Roots ouverts.\n */\nexport function getDeepActiveElement(root?: Document | ShadowRoot | null): HTMLElement | null {\n if (typeof document === 'undefined') return null;\n let active: Element | null = (root ?? document).activeElement;\n while (active && active.shadowRoot && active.shadowRoot.activeElement) {\n active = active.shadowRoot.activeElement;\n }\n return active && typeof (active as HTMLElement).focus === 'function' ? (active as HTMLElement) : null;\n}\n\n/**\n * D\u00E9place un n\u0153ud DOM via moveBefore() si disponible et compatible (m\u00EAme racine connect\u00E9e)\n * afin de pr\u00E9server focus, \u00E9tat d'iframe et animations CSS, avec repli insertBefore().\n */\nexport function safeMove(parent: Element, node: Node, referenceNode: Node | null = null): void {\n const moveBefore = (parent as Element & { moveBefore?: (n: Node, ref: Node | null) => void }).moveBefore;\n if (\n typeof moveBefore === 'function' &&\n node.isConnected &&\n parent.isConnected &&\n typeof parent.getRootNode === 'function' &&\n typeof node.getRootNode === 'function' &&\n parent.getRootNode() === node.getRootNode()\n ) {\n try {\n moveBefore.call(parent, node, referenceNode);\n return;\n } catch {\n // Repli transparent vers insertBefore si l'op\u00E9ration atomique \u00E9choue\n }\n }\n parent.insertBefore(node, referenceNode);\n}\n\n/**\n * D\u00E9tecte une composition IME en cours, en cantonnant le repli Safari WebKit 165004 (keyCode 229)\n * \u00E0 la touche Enter pour ne pas bloquer les claviers virtuels mobiles Android.\n */\nexport function isImeComposing(event: KeyboardEvent): boolean {\n return Boolean(\n event.isComposing ||\n event.key === 'Process' ||\n (event.key === 'Enter' && event.keyCode === 229)\n );\n}\n\n/**\n * Convertit une dur\u00E9e CSS (nombre en ms ou cha\u00EEne \".3s\" / \"300ms\" / \"0.3s, 150ms\") en millisecondes born\u00E9es.\n */\nexport function parseCssDurationMs(\n duration: number | string | undefined,\n fallbackMs: number = 300,\n maxMs: number = 60000\n): number {\n const safeFallback = Number.isFinite(fallbackMs) && fallbackMs >= 0 ? Math.min(fallbackMs, maxMs) : 300;\n if (typeof duration === 'number') {\n return Number.isFinite(duration) && duration >= 0 ? Math.min(duration, maxMs) : safeFallback;\n }\n if (typeof duration === 'string') {\n const parts = duration.split(',');\n let maxParsed = -1;\n for (const part of parts) {\n const match = /^\\+?(\\d+(?:\\.\\d+)?|\\.\\d+)(ms|s)?$/i.exec(part.trim());\n if (match) {\n const raw = parseFloat(match[1]);\n if (Number.isFinite(raw) && raw >= 0) {\n const ms = match[2]?.toLowerCase() === 's' ? raw * 1000 : raw;\n if (ms > maxParsed) {\n maxParsed = ms;\n }\n }\n }\n }\n if (maxParsed >= 0) {\n return Math.min(maxParsed, maxMs);\n }\n }\n return safeFallback;\n}\n\n/**\n * Indique si l'utilisateur pr\u00E9f\u00E8re les animations r\u00E9duites.\n */\nexport function prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\n/**\n * Attend la fin des animations/transitions CSS finies en cours sur un \u00E9l\u00E9ment via getAnimations(),\n * avec r\u00E9solution imm\u00E9diate sous prefers-reduced-motion et filet de s\u00E9curit\u00E9 timeout/signal.\n */\nexport function waitForAnimations(\n element: Element,\n fallbackMs: number,\n signal?: AbortSignal\n): Promise<void> {\n const safeFallback = Number.isFinite(fallbackMs) ? Math.min(fallbackMs, 60000) : 300;\n if (signal?.aborted || safeFallback <= 0 || prefersReducedMotion()) {\n return Promise.resolve();\n }\n\n const animations = typeof element.getAnimations === 'function'\n ? element.getAnimations().filter((a) => {\n if (a.playState !== 'running') return false;\n const timing = a.effect?.getComputedTiming?.();\n return timing ? Number.isFinite(timing.endTime as number) : true;\n })\n : [];\n if (animations.length === 0) {\n return Promise.resolve();\n }\n\n return new Promise<void>((resolve) => {\n let settled = false;\n let timerId: ReturnType<typeof setTimeout> | null = null;\n\n const finish = () => {\n if (settled) return;\n settled = true;\n if (timerId !== null) {\n clearTimeout(timerId);\n timerId = null;\n }\n signal?.removeEventListener('abort', finish);\n resolve();\n };\n\n signal?.addEventListener('abort', finish, { once: true });\n timerId = setTimeout(finish, safeFallback);\n Promise.allSettled(animations.map((a) => a.finished)).then(finish);\n });\n}\n", "export interface AuditableOptions {\n /**\n * Ex\u00E9cute un audit d'accessibilit\u00E9 WAI-ARIA \u00E0 l'initialisation (console.warn si contraintes manquantes).\n * @default true\n */\n audit?: boolean;\n}\n\nexport interface IAuditable {\n /**\n * V\u00E9rifie la conformit\u00E9 d'accessibilit\u00E9 WAI-ARIA du composant et retourne la liste des contraintes manquantes.\n */\n audit(): string[];\n}\n\n/**\n * Classe abstraite de base imposant et factorisant le m\u00E9canisme d'audit d'accessibilit\u00E9 WAI-ARIA\n * sur l'ensemble des composants de la suite Wulf.\n */\nexport abstract class AuditableComponent implements IAuditable {\n /**\n * Analyse l'\u00E9tat DOM / options du composant et retourne la liste des contraintes d'accessibilit\u00E9 manquantes.\n */\n public abstract audit(): string[];\n\n /**\n * Identifiant du composant affich\u00E9 dans l'en-t\u00EAte du warning console (ex: \"Wulf.FocusTrap\", \"Wulf.Scroll\").\n */\n protected abstract getAuditPrefix(): string;\n\n /**\n * S\u00E9lecteur ou description de l'\u00E9l\u00E9ment DOM audit\u00E9 (ex: \"#my-modal\", \"<input>\").\n */\n protected abstract getAuditTargetLabel(): string;\n\n /**\n * Indication affich\u00E9e en pied de warning pour expliquer comment d\u00E9sactiver l'audit.\n */\n protected getAuditDisableHint(): string {\n return 'Passez { audit: false } dans les options pour d\u00E9sactiver cet avertissement';\n }\n\n /**\n * Ex\u00E9cute l'audit d'accessibilit\u00E9 et \u00E9met un avertissement standardis\u00E9 dans la console\n * si l'audit est activ\u00E9 et que des contraintes manquent.\n */\n protected runAuditWarning(enabled: boolean = true): string[] {\n if (!enabled) return [];\n\n const warnings = this.audit();\n if (warnings.length > 0 && typeof console !== 'undefined' && typeof console.warn === 'function') {\n console.warn(\n `[${this.getAuditPrefix()}] Audit d'accessibilit\u00E9 \u2014 ${warnings.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :\\n` +\n warnings.map((w) => ` - ${w}`).join('\\n') +\n `\\n(${this.getAuditDisableHint()})`\n );\n }\n return warnings;\n }\n\n /**\n * V\u00E9rifie si un attribut de r\u00E9f\u00E9rence d'IDs ARIA (ex: aria-labelledby, aria-describedby, aria-errormessage)\n * pointe vers des \u00E9l\u00E9ments r\u00E9ellement pr\u00E9sents dans le document (et optionnellement non vides).\n */\n protected checkAriaIdReferences(\n element: HTMLElement,\n attrName: 'aria-labelledby' | 'aria-describedby' | 'aria-errormessage' | 'aria-controls',\n warnings: string[],\n requireNonEmptyText: boolean = false\n ): boolean {\n const rawValue = element.getAttribute(attrName)?.trim();\n if (!rawValue) return false;\n\n const doc = element.ownerDocument || document;\n const root = typeof element.getRootNode === 'function' ? element.getRootNode() : doc;\n const ids = rawValue.split(/\\s+/).filter(Boolean);\n const targets = ids.map((id) =>\n typeof ShadowRoot !== 'undefined' && root instanceof ShadowRoot ? root.getElementById(id) : doc.getElementById(id)\n );\n const allFound = ids.length > 0 && targets.every((el) => Boolean(el));\n\n if (!allFound) {\n warnings.push(\n `Attribut ${attrName}=\"${rawValue}\" invalide : l'\u00E9l\u00E9ment cible est introuvable dans le DOM.`\n );\n return false;\n }\n\n if (requireNonEmptyText) {\n const hasNonEmptyText = targets.some((el) => {\n if (!el) return false;\n const text = el.textContent?.trim() || el.getAttribute('aria-label')?.trim() || '';\n return text.length > 0;\n });\n if (!hasNonEmptyText) {\n warnings.push(\n `Attribut ${attrName}=\"${rawValue}\" invalide : l'\u00E9l\u00E9ment cible ne contient aucun texte accessible.`\n );\n return false;\n }\n }\n\n return true;\n }\n}\n\n", "import {\n ShortcutDefinition,\n ShortcutManagerOptions,\n ShortcutInfo,\n RegisteredShortcut,\n NormalizedStep\n} from './types';\nimport { ShortcutFormatter } from './ShortcutFormatter';\nimport { isImeComposing } from '../common/dom';\nimport { AuditableComponent } from '../common/AuditableComponent';\n\nconst SENSITIVE_AUTOCOMPLETE_TOKENS = new Set([\n 'current-password',\n 'new-password',\n 'one-time-code',\n 'cc-number',\n 'cc-csc'\n]);\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 extends AuditableComponent {\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 isDestroyed = false;\n private emittedAuditWarnings: Set<string> = new Set();\n private boundListener: ((event: KeyboardEvent) => void) | null = null;\n private abortController: AbortController | null = null;\n private idCounter = 0;\n\n constructor(options?: ShortcutManagerOptions) {\n super();\n const rawTimeout = options?.sequenceTimeout;\n const sequenceTimeout =\n typeof rawTimeout === 'number' && Number.isFinite(rawTimeout) && rawTimeout > 0\n ? Math.min(rawTimeout, 10000)\n : 800;\n\n this.options = {\n defaultScope: options?.defaultScope || 'global',\n sequenceTimeout,\n target: options?.target || (typeof window !== 'undefined' ? window : ({} as Window)),\n onError: options?.onError,\n audit: options?.audit ?? true\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 const contentEditable = el.getAttribute?.('contenteditable')?.toLowerCase();\n if (\n el.isContentEditable ||\n contentEditable === 'true' ||\n contentEditable === 'plaintext-only' ||\n 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' || role === 'combobox' || role === 'spinbutton') {\n return true;\n }\n\n // 4. \u00C9l\u00E9ment enfant situ\u00E9 \u00E0 l'int\u00E9rieur d'un conteneur contenteditable ou ARIA textbox/searchbox/combobox/spinbutton\n if (typeof el.closest === 'function') {\n const editableAncestor = el.closest(\n '[contenteditable=\"true\"], [contenteditable=\"plaintext-only\"], [contenteditable=\"\"], [role=\"textbox\"], [role=\"searchbox\"], [role=\"combobox\"], [role=\"spinbutton\"]'\n );\n if (editableAncestor) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * V\u00E9rifie si la cible appartient \u00E0 un widget composite \u00E0 typeahead clavier (listbox, menu, tree, grid).\n */\n public static isTypeaheadWidget(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n const el = target as HTMLElement;\n const role = el.getAttribute?.('role');\n if (role === 'listbox' || role === 'menu' || role === 'menubar' || role === 'tree' || role === 'grid') {\n return true;\n }\n if (typeof el.closest === 'function') {\n return Boolean(el.closest('[role=\"listbox\"], [role=\"menu\"], [role=\"menubar\"], [role=\"tree\"], [role=\"grid\"]'));\n }\n return false;\n }\n\n /**\n * V\u00E9rifie si la cible est un champ sensible (password, data-mask-sensitive, autocomplete sensible).\n */\n private static isSensitiveField(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n const el = target as HTMLInputElement;\n if (el.tagName.toUpperCase() === 'INPUT' && (el.type || '').toLowerCase() === 'password') {\n return true;\n }\n const sensitiveAttr = el.getAttribute?.('data-mask-sensitive');\n if (sensitiveAttr !== null && sensitiveAttr !== undefined && sensitiveAttr !== 'false') {\n return true;\n }\n const ac = el.getAttribute?.('autocomplete');\n if (ac) {\n const tokens = ac.trim().toLowerCase().split(/\\s+/);\n if (tokens.some((tok) => SENSITIVE_AUTOCOMPLETE_TOKENS.has(tok))) {\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 if (this.isDestroyed) {\n return () => { };\n }\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 normalizedSteps = ShortcutFormatter.parseCombo(def.combo);\n if (normalizedSteps.length === 0 || normalizedSteps.some((step) => !step.key)) {\n continue;\n }\n const id = `wulf_shortcut_${++this.idCounter}`;\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 if (registeredIds.length > 0 && this.options.audit) {\n const warnings = this.audit();\n const newWarnings = warnings.filter((w) => !this.emittedAuditWarnings.has(w));\n if (newWarnings.length > 0) {\n newWarnings.forEach((w) => this.emittedAuditWarnings.add(w));\n if (typeof console !== 'undefined' && typeof console.warn === 'function') {\n console.warn(\n `[${this.getAuditPrefix()}] Audit d'accessibilit\u00E9 \u2014 ${newWarnings.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :\\n` +\n newWarnings.map((w) => ` - ${w}`).join('\\n') +\n `\\n(${this.getAuditDisableHint()})`\n );\n }\n }\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 if (typeof combo !== 'string' || !combo.trim()) {\n return;\n }\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 if (this.isDestroyed) return;\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({\n ...shortcut,\n normalizedSteps: shortcut.normalizedSteps.map((step) => ({ ...step }))\n });\n }\n }\n return list;\n }\n\n /**\n * Audite le registre des raccourcis vis-\u00E0-vis de WCAG 2.1.4 et de l'Axiome Primordial.\n */\n public override audit(): string[] {\n const warnings: string[] = [];\n const criticalEditKeys = new Set(['c', 'v', 'x', 'a', 'z']);\n\n for (const shortcut of this.shortcuts.values()) {\n const isSingleCharWithoutMod =\n shortcut.normalizedSteps.length > 0 &&\n shortcut.normalizedSteps.every(\n (step) => !step.ctrl && !step.alt && !step.meta && step.key.length === 1\n );\n if (isSingleCharWithoutMod) {\n warnings.push(\n `Raccourci mono-caract\u00E8re sans modificateur \"${shortcut.combo}\" : pr\u00E9voyez une option pour le d\u00E9sactiver ou le reconfigurer (WCAG 2.1.4).`\n );\n }\n\n if (shortcut.allowInEditable && !shortcut.isSequence && shortcut.normalizedSteps.length === 1) {\n const s = shortcut.normalizedSteps[0];\n const isPrimaryModOnly = !s.alt && !s.shift && ((s.ctrl && !s.meta) || (s.meta && !s.ctrl));\n if (isPrimaryModOnly && criticalEditKeys.has(s.key)) {\n warnings.push(\n `Raccourci \"${shortcut.combo}\" avec allowInEditable: true risque d'\u00E9craser une commande d'\u00E9dition native (Ctrl/Cmd+${s.key.toUpperCase()}).`\n );\n }\n }\n }\n\n return warnings;\n }\n\n protected override getAuditPrefix(): string {\n return 'Wulf.Shortcut';\n }\n\n protected override getAuditTargetLabel(): string {\n return `${this.shortcuts.size} raccourci(s)`;\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 if (ariaValue) {\n element.setAttribute('aria-keyshortcuts', ariaValue);\n } else if (typeof element.removeAttribute === 'function') {\n element.removeAttribute('aria-keyshortcuts');\n }\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 if (this.isDestroyed) return;\n this.isDestroyed = true;\n this.pause();\n this.removeListener();\n this.shortcuts.clear();\n this.emittedAuditWarnings.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.abortController = new AbortController();\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, {\n capture: false,\n signal: this.abortController.signal\n });\n }\n }\n\n private removeListener(): void {\n if (this.abortController) {\n this.abortController.abort();\n this.abortController = null;\n } else 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 }\n this.boundListener = null;\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (this.isDestroyed || !this.isListening || isImeComposing(event)) {\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 pathTargets = composed.length > 0 ? composed : (event.target ? [event.target] : []);\n let isEditable = ShortcutManager.isEditable(event.target);\n let isSensitiveInput = ShortcutManager.isSensitiveField(event.target);\n let isTypeahead = ShortcutManager.isTypeaheadWidget(event.target);\n for (const node of pathTargets) {\n if (!isEditable && ShortcutManager.isEditable(node)) isEditable = true;\n if (!isSensitiveInput && ShortcutManager.isSensitiveField(node)) isSensitiveInput = true;\n if (!isTypeahead && ShortcutManager.isTypeaheadWidget(node)) isTypeahead = true;\n }\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 = typeof performance !== 'undefined' ? performance.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, isSensitiveInput, isTypeahead);\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, event);\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, event)) {\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 && !isTypeahead) {\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 isSensitiveInput: boolean = false,\n isTypeahead: 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 // Protection du typeahead clavier sur widgets composites (listbox, menu, tree, grid)\n if (isTypeahead) {\n const firstStep = shortcut.normalizedSteps[0];\n if (firstStep && !firstStep.ctrl && !firstStep.alt && !firstStep.meta && firstStep.key.length === 1) {\n continue;\n }\n }\n // Sanctuaire Champs Sensibles : m\u00EAme avec allowInEditable: true, interdire s\u00E9quences, touches imprimables et Backspace/Delete/Dead sans modificateur\n if (isSensitiveInput) {\n if (shortcut.isSequence) {\n continue;\n }\n const firstStep = shortcut.normalizedSteps[0];\n if (firstStep) {\n if (firstStep.key.length === 1) {\n const isUntouchedChar = !firstStep.ctrl && !firstStep.alt && !firstStep.meta;\n const isAltGrOrOptionChar =\n (firstStep.ctrl && firstStep.alt && !firstStep.meta) ||\n (firstStep.alt && !firstStep.ctrl && !firstStep.meta);\n if (isUntouchedChar || isAltGrOrOptionChar) {\n continue;\n }\n } else if (\n !firstStep.ctrl &&\n !firstStep.alt &&\n !firstStep.meta &&\n (firstStep.key === 'backspace' || firstStep.key === 'delete' || firstStep.key === 'dead')\n ) {\n continue;\n }\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 const rawKey = typeof rawEvent?.key === 'string' ? rawEvent.key : '';\n\n // Correspondance de la touche\n const keyMatches =\n step.key === eventStep.key ||\n (rawKey !== '' && step.key === rawKey.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 (en accord comme en s\u00E9quence).\n if (step.shift === eventStep.shift) {\n return true;\n }\n\n if (!step.shift && eventStep.shift) {\n const isNonAlphaSymbol = step.key.length === 1 && !/^[a-z]$/i.test(step.key);\n if ((rawKey !== '' && rawKey === step.key) || (isNonAlphaSymbol && eventStep.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 rawEvent?: KeyboardEvent\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 const stepEvent = i === proposed.length - 1 ? rawEvent : undefined;\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i], stepEvent)) {\n allMatch = false;\n break;\n }\n }\n\n if (allMatch) {\n return candidate;\n }\n }\n return null;\n }\n\n private isPrefixOfAnySequence(\n candidates: RegisteredShortcut[],\n proposed: NormalizedStep[],\n rawEvent?: KeyboardEvent\n ): 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 const stepEvent = i === proposed.length - 1 ? rawEvent : undefined;\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i], stepEvent)) {\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 try {\n this.options.onError(err instanceof Error ? err : new Error(String(err)), shortcut.combo);\n } catch (onErrException) {\n console.error('[Wulf.Shortcut] Erreur dans le callback onError:', onErrException);\n }\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,UAAU,KAAK,GAAG,SAAS,MAAM,KAAK,GAAG,SAAS,QAAQ;AAAA,IAC3G;AAAA;AAAA;AA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G,CAAC,GAAG,SAAS,KAAK;AAAA,UAC1F,SAAS,gBAAgB;AACvB,oBAAQ,MAAM,oDAAoD,cAAc;AAAA,UAClF;AAAA,QACF,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;",
|
|
6
6
|
"names": ["popped"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
"use strict";var __WulfIIFE=(()=>{var S=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var L=(s,e)=>{for(var t in e)S(s,t,{get:e[t],enumerable:!0})},q=(s,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of k(e))!T.call(s,r)&&r!==t&&S(s,r,{get:()=>e[r],enumerable:!(o=v(e,r))||o.enumerable});return s};var A=s=>q(S({},"__esModule",{value:!0}),s);var N={};L(N,{ShortcutFormatter:()=>f,ShortcutManager:()=>h,default:()=>h});function w(){if(typeof window>"u")return null;let s=window,e=s.Wulf;if(!e||typeof e!="object"||typeof Node<"u"&&e instanceof Node||typeof HTMLCollection<"u"&&e instanceof HTMLCollection){let t={};return s.Wulf=t,t}return e}function C(s){return!!(s.isComposing||s.key==="Process"||s.key==="Enter"&&s.keyCode===229)}var f=class s{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 o=(navigator.userAgent||"").toLowerCase();return o.includes("macintosh")||o.includes("mac os x")||o.includes("ipad")||o.includes("iphone")}static normalizeKeyName(e){if(e===" ")return" ";let t=e.trim().toLowerCase();switch(t){case"esc":return"escape";case"return":return"enter";case"space":case"spacebar":return" ";case"plus":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=s.isApple()){if(typeof e!="string")return[];if(e===" ")return[{ctrl:!1,alt:!1,shift:!1,meta:!1,key:" "}];let o=e.slice(0,512).trim();if(!o)return[];let n=o.replace(/\b(ctrl|control|alt|option|opt|shift|maj|cmd|command|meta|win|super|mod|\$mod)\s*\+\s*/gi,"$1+").split(/\s+/).slice(0,10),i=[];for(let l of n){let c=[];if(l==="+")c.push("+");else{let u="";for(let a=0;a<l.length;a++){let y=l[a];y==="+"?u===""&&c.length>0?c.push("+"):u!==""&&(c.push(u),u=""):u+=y}u!==""&&c.push(u)}let p=!1,d=!1,g=!1,m=!1,b="";for(let u of c){let a=u.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:b=s.normalizeKeyName(u)}i.push({ctrl:p,alt:d,shift:g,meta:m,key:b})}return i}static format(e,t=s.isApple()){let o=s.parseCombo(e,t);return o.length===0?e:o.map(n=>{let i=[];if(t){n.ctrl&&i.push("\u2303"),n.alt&&i.push("\u2325"),n.shift&&i.push("\u21E7"),n.meta&&i.push("\u2318");let l=s.formatKeyDisplay(n.key,!0);return i.push(l),i.join("")}else{n.ctrl&&i.push("Ctrl"),n.alt&&i.push("Alt"),n.shift&&i.push("Shift"),n.meta&&i.push("Win");let l=s.formatKeyDisplay(n.key,!1);return i.push(l),i.join("+")}}).join(" ")}static toAriaKeyShortcuts(e,t=s.isApple()){let o=s.parseCombo(e,t);if(o.length!==1)return"";let r=o[0],n=s.formatAriaKey(r.key);if(!n)return"";let i=[];return r.ctrl&&i.push("Control"),r.alt&&i.push("Alt"),r.shift&&i.push("Shift"),r.meta&&i.push("Meta"),i.push(n),i.join("+")}static formatAriaKey(e){if(!e)return"";switch(e.toLowerCase()){case"escape":return"Escape";case"enter":return"Enter";case" ":return"Space";case"tab":return"Tab";case"backspace":return"Backspace";case"delete":return"Delete";case"insert":return"Insert";case"home":return"Home";case"end":return"End";case"pageup":return"PageUp";case"pagedown":return"PageDown";case"arrowup":return"ArrowUp";case"arrowdown":return"ArrowDown";case"arrowleft":return"ArrowLeft";case"arrowright":return"ArrowRight";case"printscreen":return"PrintScreen";case"scrolllock":return"ScrollLock";case"numlock":return"NumLock";case"capslock":return"CapsLock";case"contextmenu":return"ContextMenu";case"+":return"Plus";default:return e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}}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 s{options;shortcuts=new Map;scopeStack=[];sequenceBuffer=[];sequenceTimer=null;isListening=!0;boundListener=null;abortController=null;idCounter=0;constructor(e){let t=e?.sequenceTimeout,o=typeof t=="number"&&Number.isFinite(t)&&t>0?Math.min(t,1e4):800;this.options={defaultScope:e?.defaultScope||"global",sequenceTimeout:o,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,o=t.tagName.toUpperCase();if(o==="INPUT"){let n=t.type?.toLowerCase()||"text";return!["button","checkbox","radio","submit","reset","range","color","file","image"].includes(n)}if(o==="TEXTAREA"||o==="SELECT"||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")==="plaintext-only"||t.getAttribute("contenteditable")==="")return!0;let r=t.getAttribute("role");return!!(r==="textbox"||r==="searchbox"||r==="combobox"||r==="spinbutton"||typeof t.closest=="function"&&t.closest('[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"], [role="combobox"], [role="spinbutton"]'))}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],o=[];for(let r of t){if(!r.combo||typeof r.handler!="function")continue;let n=`wulf_shortcut_${++this.idCounter}`,i=f.parseCombo(r.combo),l=i.length>1,c=f.format(r.combo),p={...r,id:n,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:c,normalizedSteps:i,isSequence:l};this.shortcuts.set(n,p),o.push(n)}return()=>{for(let r of o)this.shortcuts.delete(r)}}unbind(e,t){if(typeof e!="string"||!e.trim())return;let o=f.format(e);for(let[r,n]of this.shortcuts.entries())(n.formattedCombo===o||n.combo.trim().toLowerCase()===e.trim().toLowerCase())&&(!t||n.scope===t)&&this.shortcuts.delete(r)}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 o=this.scopeStack.pop();return this.clearSequenceBuffer(),o}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 o of this.shortcuts.values())(!e||o.scope===e||o.scope==="*")&&t.push({...o});return t}attachAria(e,t){if(e&&typeof e.setAttribute=="function"){let o=f.toAriaKeyShortcuts(t);o?e.setAttribute("aria-keyshortcuts",o):typeof e.removeAttribute=="function"&&e.removeAttribute("aria-keyshortcuts")}}static format(e,t){return f.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.abortController=new AbortController,this.boundListener=t=>this.handleKeyDown(t);let e=this.options.target;typeof e.addEventListener=="function"&&e.addEventListener("keydown",this.boundListener,{capture:!1,signal:this.abortController.signal})}removeListener(){if(this.abortController)this.abortController.abort(),this.abortController=null;else 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||C(e))return;let t=(e.key||"").toLowerCase();if(["control","alt","shift","meta"].includes(t))return;let o=this.getScope(),r=typeof e.composedPath=="function"?e.composedPath():[],n=r.length>0?r[0]:e.target,i=s.isEditable(n)||s.isEditable(e.target),l=s.isPasswordField(n)||s.isPasswordField(e.target),c={ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey,key:f.normalizeKeyName(e.key||"")},p=e.timeStamp>0?e.timeStamp:typeof performance<"u"?performance.now():Date.now();if(this.sequenceBuffer.length>0){let u=this.sequenceBuffer[this.sequenceBuffer.length-1];p-u.timestamp>this.options.sequenceTimeout&&this.clearSequenceBuffer()}let d=this.getActiveShortcuts(o,i,l),g=[...this.sequenceBuffer.map(u=>u.step),c],m=this.findMatchingSequence(d,g);if(m){this.clearSequenceBuffer(),this.executeShortcut(m,e,o,!0);return}if(this.isPrefixOfAnySequence(d,g)){this.sequenceBuffer.push({step:c,timestamp:p}),this.resetSequenceTimer(),e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&!i&&e.preventDefault();return}this.clearSequenceBuffer();let b=this.findMatchingChord(d,c,e);b&&this.executeShortcut(b,e,o,!1)}getActiveShortcuts(e,t,o=!1){let r=[];for(let n of this.shortcuts.values())if(!(n.scope!==e&&n.scope!=="*")&&!(t&&!n.allowInEditable)){if(o){if(n.isSequence)continue;let i=n.normalizedSteps[0];if(i&&i.key.length===1){let l=!i.ctrl&&!i.alt&&!i.meta,c=i.ctrl&&i.alt&&!i.meta||i.alt&&!i.ctrl&&!i.meta;if(l||c)continue}}r.push(n)}return r.sort((n,i)=>(i.priority??0)-(n.priority??0))}stepMatches(e,t,o){if(e.ctrl!==t.ctrl||e.alt!==t.alt||e.meta!==t.meta)return!1;let r=typeof o?.key=="string"?o.key:"";if(!(e.key===t.key||r!==""&&e.key===r.toLowerCase()))return!1;if(e.shift===t.shift)return!0;if(!e.shift&&t.shift){let i=e.key.length===1&&!/^[a-z]$/i.test(e.key);if(r!==""&&r===e.key||i&&t.key===e.key)return!0}return!1}findMatchingChord(e,t,o){for(let r of e){if(r.isSequence||r.normalizedSteps.length!==1)continue;let n=r.normalizedSteps[0];if(this.stepMatches(n,t,o))return r}return null}findMatchingSequence(e,t){for(let o of e){if(!o.isSequence||o.normalizedSteps.length!==t.length)continue;let r=!0;for(let n=0;n<t.length;n++)if(!this.stepMatches(o.normalizedSteps[n],t[n])){r=!1;break}if(r)return o}return null}isPrefixOfAnySequence(e,t){for(let o of e){if(!o.isSequence||o.normalizedSteps.length<=t.length)continue;let r=!0;for(let n=0;n<t.length;n++)if(!this.stepMatches(o.normalizedSteps[n],t[n])){r=!1;break}if(r)return!0}return!1}executeShortcut(e,t,o,r){e.preventDefault&&t.preventDefault(),e.stopPropagation&&t.stopPropagation();let n={combo:e.combo,formattedCombo:e.formattedCombo,scope:o,target:t.target,isSequence:r};try{e.handler(t,n)}catch(i){this.options.onError?this.options.onError(i instanceof Error?i:new Error(String(i)),e.combo):console.error(`[Wulf.Shortcut] Erreur lors de l'ex\xE9cution du raccourci "${e.combo}":`,i)}}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)}};var E=w();E&&(E.Shortcut=Object.assign(h,{ShortcutManager:h,ShortcutFormatter:f}));return A(N);})();
|
|
2
|
-
|
|
1
|
+
"use strict";var __WulfIIFE=(()=>{var S=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var k=(a,e)=>{for(var t in e)S(a,t,{get:e[t],enumerable:!0})},T=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of C(e))!A.call(a,i)&&i!==t&&S(a,i,{get:()=>e[i],enumerable:!(r=v(e,i))||r.enumerable});return a};var L=a=>T(S({},"__esModule",{value:!0}),a);var q={};k(q,{ShortcutFormatter:()=>p,ShortcutManager:()=>b,default:()=>b});var p=class a{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 r=(navigator.userAgent||"").toLowerCase();return r.includes("macintosh")||r.includes("mac os x")||r.includes("ipad")||r.includes("iphone")}static normalizeKeyName(e){if(e===" ")return" ";let t=e.trim().toLowerCase();switch(t){case"esc":return"escape";case"return":return"enter";case"space":case"spacebar":return" ";case"plus":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=a.isApple()){if(typeof e!="string")return[];if(e===" ")return[{ctrl:!1,alt:!1,shift:!1,meta:!1,key:" "}];let r=e.slice(0,512).trim();if(!r)return[];let o=r.replace(/\b(ctrl|control|alt|option|opt|shift|maj|cmd|command|meta|win|super|mod|\$mod)\s*\+\s*/gi,"$1+").split(/\s+/).slice(0,10),n=[];for(let s of o){let u=[];if(s==="+")u.push("+");else{let f="";for(let c=0;c<s.length;c++){let w=s[c];w==="+"?f===""&&u.length>0?u.push("+"):f!==""&&(u.push(f),f=""):f+=w}f!==""&&u.push(f)}let l=!1,m=!1,d=!1,h=!1,g="";for(let f of u){let c=f.trim().toLowerCase();c==="ctrl"||c==="control"?l=!0:c==="alt"||c==="option"||c==="opt"?m=!0:c==="shift"||c==="maj"?d=!0:c==="cmd"||c==="command"||c==="meta"||c==="win"||c==="super"?h=!0:c==="mod"||c==="$mod"?t?h=!0:l=!0:g=a.normalizeKeyName(f)}n.push({ctrl:l,alt:m,shift:d,meta:h,key:g})}return n}static format(e,t=a.isApple()){let r=a.parseCombo(e,t);return r.length===0?e:r.map(o=>{let n=[];if(t){o.ctrl&&n.push("\u2303"),o.alt&&n.push("\u2325"),o.shift&&n.push("\u21E7"),o.meta&&n.push("\u2318");let s=a.formatKeyDisplay(o.key,!0);return n.push(s),n.join("")}else{o.ctrl&&n.push("Ctrl"),o.alt&&n.push("Alt"),o.shift&&n.push("Shift"),o.meta&&n.push("Win");let s=a.formatKeyDisplay(o.key,!1);return n.push(s),n.join("+")}}).join(" ")}static toAriaKeyShortcuts(e,t=a.isApple()){let r=a.parseCombo(e,t);if(r.length!==1)return"";let i=r[0],o=a.formatAriaKey(i.key);if(!o)return"";let n=[];return i.ctrl&&n.push("Control"),i.alt&&n.push("Alt"),i.shift&&n.push("Shift"),i.meta&&n.push("Meta"),n.push(o),n.join("+")}static formatAriaKey(e){if(!e)return"";switch(e.toLowerCase()){case"escape":return"Escape";case"enter":return"Enter";case" ":return"Space";case"tab":return"Tab";case"backspace":return"Backspace";case"delete":return"Delete";case"insert":return"Insert";case"home":return"Home";case"end":return"End";case"pageup":return"PageUp";case"pagedown":return"PageDown";case"arrowup":return"ArrowUp";case"arrowdown":return"ArrowDown";case"arrowleft":return"ArrowLeft";case"arrowright":return"ArrowRight";case"printscreen":return"PrintScreen";case"scrolllock":return"ScrollLock";case"numlock":return"NumLock";case"capslock":return"CapsLock";case"contextmenu":return"ContextMenu";case"+":return"Plus";default:return e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)}}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":"Delete";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)}}};function E(a){return!!(a.isComposing||a.key==="Process"||a.key==="Enter"&&a.keyCode===229)}var y=class{getAuditDisableHint(){return"Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement"}runAuditWarning(e=!0){if(!e)return[];let t=this.audit();return t.length>0&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${t.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
|
|
2
|
+
`+t.map(r=>` - ${r}`).join(`
|
|
3
|
+
`)+`
|
|
4
|
+
(${this.getAuditDisableHint()})`),t}checkAriaIdReferences(e,t,r,i=!1){let o=e.getAttribute(t)?.trim();if(!o)return!1;let n=e.ownerDocument||document,s=typeof e.getRootNode=="function"?e.getRootNode():n,u=o.split(/\s+/).filter(Boolean),l=u.map(d=>typeof ShadowRoot<"u"&&s instanceof ShadowRoot?s.getElementById(d):n.getElementById(d));return u.length>0&&l.every(d=>!!d)?i&&!l.some(h=>h?(h.textContent?.trim()||h.getAttribute("aria-label")?.trim()||"").length>0:!1)?(r.push(`Attribut ${t}="${o}" invalide : l'\xE9l\xE9ment cible ne contient aucun texte accessible.`),!1):!0:(r.push(`Attribut ${t}="${o}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),!1)}};var x=new Set(["current-password","new-password","one-time-code","cc-number","cc-csc"]),b=class a extends y{options;shortcuts=new Map;scopeStack=[];sequenceBuffer=[];sequenceTimer=null;isListening=!0;isDestroyed=!1;emittedAuditWarnings=new Set;boundListener=null;abortController=null;idCounter=0;constructor(e){super();let t=e?.sequenceTimeout,r=typeof t=="number"&&Number.isFinite(t)&&t>0?Math.min(t,1e4):800;this.options={defaultScope:e?.defaultScope||"global",sequenceTimeout:r,target:e?.target||(typeof window<"u"?window:{}),onError:e?.onError,audit:e?.audit??!0},this.scopeStack=[this.options.defaultScope],this.initListener()}static isEditable(e){if(!e||typeof e.tagName!="string")return!1;let t=e,r=t.tagName.toUpperCase();if(r==="INPUT"){let n=t.type?.toLowerCase()||"text";return!["button","checkbox","radio","submit","reset","range","color","file","image"].includes(n)}if(r==="TEXTAREA"||r==="SELECT")return!0;let i=t.getAttribute?.("contenteditable")?.toLowerCase();if(t.isContentEditable||i==="true"||i==="plaintext-only"||i==="")return!0;let o=t.getAttribute?.("role");return!!(o==="textbox"||o==="searchbox"||o==="combobox"||o==="spinbutton"||typeof t.closest=="function"&&t.closest('[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"], [role="combobox"], [role="spinbutton"]'))}static isTypeaheadWidget(e){if(!e||typeof e.tagName!="string")return!1;let t=e,r=t.getAttribute?.("role");return r==="listbox"||r==="menu"||r==="menubar"||r==="tree"||r==="grid"?!0:typeof t.closest=="function"?!!t.closest('[role="listbox"], [role="menu"], [role="menubar"], [role="tree"], [role="grid"]'):!1}static isSensitiveField(e){if(!e||typeof e.tagName!="string")return!1;let t=e;if(t.tagName.toUpperCase()==="INPUT"&&(t.type||"").toLowerCase()==="password")return!0;let r=t.getAttribute?.("data-mask-sensitive");if(r!=null&&r!=="false")return!0;let i=t.getAttribute?.("autocomplete");return!!(i&&i.trim().toLowerCase().split(/\s+/).some(n=>x.has(n)))}bind(e){if(this.isDestroyed)return()=>{};let t=Array.isArray(e)?e:[e],r=[];for(let i of t){if(!i.combo||typeof i.handler!="function")continue;let o=p.parseCombo(i.combo);if(o.length===0||o.some(m=>!m.key))continue;let n=`wulf_shortcut_${++this.idCounter}`,s=o.length>1,u=p.format(i.combo),l={...i,id:n,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:s};this.shortcuts.set(n,l),r.push(n)}if(r.length>0&&this.options.audit){let o=this.audit().filter(n=>!this.emittedAuditWarnings.has(n));o.length>0&&(o.forEach(n=>this.emittedAuditWarnings.add(n)),typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${o.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
|
|
5
|
+
`+o.map(n=>` - ${n}`).join(`
|
|
6
|
+
`)+`
|
|
7
|
+
(${this.getAuditDisableHint()})`))}return()=>{for(let i of r)this.shortcuts.delete(i)}}unbind(e,t){if(typeof e!="string"||!e.trim())return;let r=p.format(e);for(let[i,o]of this.shortcuts.entries())(o.formattedCombo===r||o.combo.trim().toLowerCase()===e.trim().toLowerCase())&&(!t||o.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 r=this.scopeStack.pop();return this.clearSequenceBuffer(),r}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.isDestroyed||(this.isListening=!0)}isActive(){return this.isListening}getRegistry(e){let t=[];for(let r of this.shortcuts.values())(!e||r.scope===e||r.scope==="*")&&t.push({...r,normalizedSteps:r.normalizedSteps.map(i=>({...i}))});return t}audit(){let e=[],t=new Set(["c","v","x","a","z"]);for(let r of this.shortcuts.values())if(r.normalizedSteps.length>0&&r.normalizedSteps.every(o=>!o.ctrl&&!o.alt&&!o.meta&&o.key.length===1)&&e.push(`Raccourci mono-caract\xE8re sans modificateur "${r.combo}" : pr\xE9voyez une option pour le d\xE9sactiver ou le reconfigurer (WCAG 2.1.4).`),r.allowInEditable&&!r.isSequence&&r.normalizedSteps.length===1){let o=r.normalizedSteps[0];!o.alt&&!o.shift&&(o.ctrl&&!o.meta||o.meta&&!o.ctrl)&&t.has(o.key)&&e.push(`Raccourci "${r.combo}" avec allowInEditable: true risque d'\xE9craser une commande d'\xE9dition native (Ctrl/Cmd+${o.key.toUpperCase()}).`)}return e}getAuditPrefix(){return"Wulf.Shortcut"}getAuditTargetLabel(){return`${this.shortcuts.size} raccourci(s)`}attachAria(e,t){if(e&&typeof e.setAttribute=="function"){let r=p.toAriaKeyShortcuts(t);r?e.setAttribute("aria-keyshortcuts",r):typeof e.removeAttribute=="function"&&e.removeAttribute("aria-keyshortcuts")}}static format(e,t){return p.format(e,t)}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.pause(),this.removeListener(),this.shortcuts.clear(),this.emittedAuditWarnings.clear(),this.scopeStack=[],this.clearSequenceBuffer())}initListener(){if(typeof window>"u"||!this.options.target)return;this.abortController=new AbortController,this.boundListener=t=>this.handleKeyDown(t);let e=this.options.target;typeof e.addEventListener=="function"&&e.addEventListener("keydown",this.boundListener,{capture:!1,signal:this.abortController.signal})}removeListener(){if(this.abortController)this.abortController.abort(),this.abortController=null;else 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.isDestroyed||!this.isListening||E(e))return;let t=(e.key||"").toLowerCase();if(["control","alt","shift","meta"].includes(t))return;let r=this.getScope(),i=typeof e.composedPath=="function"?e.composedPath():[],o=i.length>0?i:e.target?[e.target]:[],n=a.isEditable(e.target),s=a.isSensitiveField(e.target),u=a.isTypeaheadWidget(e.target);for(let c of o)!n&&a.isEditable(c)&&(n=!0),!s&&a.isSensitiveField(c)&&(s=!0),!u&&a.isTypeaheadWidget(c)&&(u=!0);let l={ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey,key:p.normalizeKeyName(e.key||"")},m=typeof performance<"u"?performance.now():Date.now();if(this.sequenceBuffer.length>0){let c=this.sequenceBuffer[this.sequenceBuffer.length-1];m-c.timestamp>this.options.sequenceTimeout&&this.clearSequenceBuffer()}let d=this.getActiveShortcuts(r,n,s,u),h=[...this.sequenceBuffer.map(c=>c.step),l],g=this.findMatchingSequence(d,h,e);if(g){this.clearSequenceBuffer(),this.executeShortcut(g,e,r,!0);return}if(this.isPrefixOfAnySequence(d,h,e)){this.sequenceBuffer.push({step:l,timestamp:m}),this.resetSequenceTimer(),e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&!n&&!u&&e.preventDefault();return}this.clearSequenceBuffer();let f=this.findMatchingChord(d,l,e);f&&this.executeShortcut(f,e,r,!1)}getActiveShortcuts(e,t,r=!1,i=!1){let o=[];for(let n of this.shortcuts.values())if(!(n.scope!==e&&n.scope!=="*")&&!(t&&!n.allowInEditable)){if(i){let s=n.normalizedSteps[0];if(s&&!s.ctrl&&!s.alt&&!s.meta&&s.key.length===1)continue}if(r){if(n.isSequence)continue;let s=n.normalizedSteps[0];if(s){if(s.key.length===1){let u=!s.ctrl&&!s.alt&&!s.meta,l=s.ctrl&&s.alt&&!s.meta||s.alt&&!s.ctrl&&!s.meta;if(u||l)continue}else if(!s.ctrl&&!s.alt&&!s.meta&&(s.key==="backspace"||s.key==="delete"||s.key==="dead"))continue}}o.push(n)}return o.sort((n,s)=>(s.priority??0)-(n.priority??0))}stepMatches(e,t,r){if(e.ctrl!==t.ctrl||e.alt!==t.alt||e.meta!==t.meta)return!1;let i=typeof r?.key=="string"?r.key:"";if(!(e.key===t.key||i!==""&&e.key===i.toLowerCase()))return!1;if(e.shift===t.shift)return!0;if(!e.shift&&t.shift){let n=e.key.length===1&&!/^[a-z]$/i.test(e.key);if(i!==""&&i===e.key||n&&t.key===e.key)return!0}return!1}findMatchingChord(e,t,r){for(let i of e){if(i.isSequence||i.normalizedSteps.length!==1)continue;let o=i.normalizedSteps[0];if(this.stepMatches(o,t,r))return i}return null}findMatchingSequence(e,t,r){for(let i of e){if(!i.isSequence||i.normalizedSteps.length!==t.length)continue;let o=!0;for(let n=0;n<t.length;n++){let s=n===t.length-1?r:void 0;if(!this.stepMatches(i.normalizedSteps[n],t[n],s)){o=!1;break}}if(o)return i}return null}isPrefixOfAnySequence(e,t,r){for(let i of e){if(!i.isSequence||i.normalizedSteps.length<=t.length)continue;let o=!0;for(let n=0;n<t.length;n++){let s=n===t.length-1?r:void 0;if(!this.stepMatches(i.normalizedSteps[n],t[n],s)){o=!1;break}}if(o)return!0}return!1}executeShortcut(e,t,r,i){e.preventDefault&&t.preventDefault(),e.stopPropagation&&t.stopPropagation();let o={combo:e.combo,formattedCombo:e.formattedCombo,scope:r,target:t.target,isSequence:i};try{e.handler(t,o)}catch(n){if(this.options.onError)try{this.options.onError(n instanceof Error?n:new Error(String(n)),e.combo)}catch(s){console.error("[Wulf.Shortcut] Erreur dans le callback onError:",s)}else console.error(`[Wulf.Shortcut] Erreur lors de l'ex\xE9cution du raccourci "${e.combo}":`,n)}}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 L(q);})();
|
|
8
|
+
if (typeof window !== "undefined") { var __w = window.Wulf; if (!__w || typeof __w !== "object" || (typeof Node !== "undefined" && __w instanceof Node) || (typeof HTMLCollection !== "undefined" && __w instanceof HTMLCollection)) { __w = {}; window.Wulf = __w; } var __set = function(obj, key, val) { try { Object.defineProperty(obj, key, { value: val, writable: true, configurable: true, enumerable: true }); } catch (_) { try { obj[key] = val; } catch (__) {} } }; if (typeof __WulfIIFE !== "undefined" && __WulfIIFE) { var __e = __WulfIIFE; var __skip = ["__proto__","constructor","prototype"]; for (var k in __e) { if (Object.hasOwn(__e, k) && __skip.indexOf(k) === -1 && __w[k] === undefined) { __set(__w, k, __e[k]); } } if (__e.ShortcutManager) __set(__w, "Shortcut", Object.assign(__e.ShortcutManager, { ShortcutManager: __e.ShortcutManager, ShortcutFormatter: __e.ShortcutFormatter, default: __e.ShortcutManager })); }}
|
|
3
9
|
//# sourceMappingURL=shortcut.global.min.js.map
|