wulf.js 1.9.1 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +154 -21
  2. package/changelog.md +21 -0
  3. package/dist/focus-trap.global.js +1 -1
  4. package/dist/focus-trap.global.min.js +1 -1
  5. package/dist/index.esm.js +589 -0
  6. package/dist/index.esm.js.map +4 -4
  7. package/dist/index.global.js +590 -1
  8. package/dist/index.global.js.map +4 -4
  9. package/dist/index.global.min.js +3 -3
  10. package/dist/index.global.min.js.map +4 -4
  11. package/dist/mask.global.js +1 -1
  12. package/dist/mask.global.min.js +1 -1
  13. package/dist/masonry.global.js +1 -1
  14. package/dist/masonry.global.min.js +1 -1
  15. package/dist/scroll.global.js +1 -1
  16. package/dist/scroll.global.min.js +1 -1
  17. package/dist/shortcut.esm.js +584 -0
  18. package/dist/shortcut.esm.js.map +7 -0
  19. package/dist/shortcut.global.js +610 -0
  20. package/dist/shortcut.global.js.map +7 -0
  21. package/dist/shortcut.global.min.js +3 -0
  22. package/dist/shortcut.global.min.js.map +7 -0
  23. package/dist/toast.global.js +1 -1
  24. package/dist/toast.global.min.js +1 -1
  25. package/dist/types/index.d.ts +2 -0
  26. package/dist/types/shortcut/ShortcutFormatter.d.ts +31 -0
  27. package/dist/types/shortcut/ShortcutManager.d.ts +91 -0
  28. package/dist/types/shortcut/index.d.ts +4 -0
  29. package/dist/types/shortcut/types.d.ts +101 -0
  30. package/package.json +17 -10
  31. package/dist/focus-trap.cjs.js +0 -430
  32. package/dist/focus-trap.cjs.js.map +0 -7
  33. package/dist/index.cjs.js +0 -5365
  34. package/dist/index.cjs.js.map +0 -7
  35. package/dist/mask.cjs.js +0 -3086
  36. package/dist/mask.cjs.js.map +0 -7
  37. package/dist/masonry.cjs.js +0 -858
  38. package/dist/masonry.cjs.js.map +0 -7
  39. package/dist/scroll.cjs.js +0 -823
  40. package/dist/scroll.cjs.js.map +0 -7
  41. package/dist/toast.cjs.js +0 -715
  42. package/dist/toast.cjs.js.map +0 -7
@@ -0,0 +1,584 @@
1
+ // src/shortcut/ShortcutFormatter.ts
2
+ var ShortcutFormatter = class _ShortcutFormatter {
3
+ /**
4
+ * Détecte si l'environnement d'exécution actuel est un environnement Apple (macOS / iOS / iPadOS).
5
+ */
6
+ static isApple() {
7
+ if (typeof navigator === "undefined") {
8
+ return false;
9
+ }
10
+ const uaData = navigator.userAgentData;
11
+ if (uaData && typeof uaData.platform === "string") {
12
+ const p = uaData.platform.toLowerCase();
13
+ if (p.includes("mac") || p.includes("ios")) {
14
+ return true;
15
+ }
16
+ }
17
+ const platform = (navigator.platform || "").toLowerCase();
18
+ if (platform.includes("mac") || platform.includes("iphone") || platform.includes("ipad") || platform.includes("ipod")) {
19
+ return true;
20
+ }
21
+ const ua = (navigator.userAgent || "").toLowerCase();
22
+ return ua.includes("macintosh") || ua.includes("mac os x") || ua.includes("ipad") || ua.includes("iphone");
23
+ }
24
+ /**
25
+ * Normalise un nom de touche unitaire pour les comparaisons.
26
+ */
27
+ static normalizeKeyName(key) {
28
+ const k = key.trim().toLowerCase();
29
+ switch (k) {
30
+ case "esc":
31
+ return "escape";
32
+ case "return":
33
+ return "enter";
34
+ case "space":
35
+ case "spacebar":
36
+ return " ";
37
+ case "del":
38
+ return "delete";
39
+ case "ins":
40
+ return "insert";
41
+ case "up":
42
+ return "arrowup";
43
+ case "down":
44
+ return "arrowdown";
45
+ case "left":
46
+ return "arrowleft";
47
+ case "right":
48
+ return "arrowright";
49
+ default:
50
+ return k;
51
+ }
52
+ }
53
+ /**
54
+ * Parse une chaîne de combinaison (ex: "Mod+K", "g i", "Shift+?", "Alt++")
55
+ * et retourne la liste des étapes normalisées nécessaires au déclenchement.
56
+ */
57
+ static parseCombo(combo, isApple = _ShortcutFormatter.isApple()) {
58
+ const trimmed = combo.trim();
59
+ if (!trimmed) {
60
+ return [];
61
+ }
62
+ const stepsRaw = trimmed.split(/\s+/);
63
+ const steps = [];
64
+ for (const rawStep of stepsRaw) {
65
+ const tokens = [];
66
+ let currentToken = "";
67
+ for (let i = 0; i < rawStep.length; i++) {
68
+ const char = rawStep[i];
69
+ if (char === "+") {
70
+ if (currentToken === "" && tokens.length > 0) {
71
+ tokens.push("+");
72
+ } else if (currentToken !== "") {
73
+ tokens.push(currentToken);
74
+ currentToken = "";
75
+ }
76
+ } else {
77
+ currentToken += char;
78
+ }
79
+ }
80
+ if (currentToken !== "") {
81
+ tokens.push(currentToken);
82
+ }
83
+ let ctrl = false;
84
+ let alt = false;
85
+ let shift = false;
86
+ let meta = false;
87
+ let mainKey = "";
88
+ for (const token of tokens) {
89
+ const lower = token.trim().toLowerCase();
90
+ if (lower === "ctrl" || lower === "control") {
91
+ ctrl = true;
92
+ } else if (lower === "alt" || lower === "option" || lower === "opt") {
93
+ alt = true;
94
+ } else if (lower === "shift" || lower === "maj") {
95
+ shift = true;
96
+ } else if (lower === "cmd" || lower === "command" || lower === "meta" || lower === "win" || lower === "super") {
97
+ meta = true;
98
+ } else if (lower === "mod" || lower === "$mod") {
99
+ if (isApple) {
100
+ meta = true;
101
+ } else {
102
+ ctrl = true;
103
+ }
104
+ } else {
105
+ mainKey = _ShortcutFormatter.normalizeKeyName(token);
106
+ }
107
+ }
108
+ steps.push({
109
+ ctrl,
110
+ alt,
111
+ shift,
112
+ meta,
113
+ key: mainKey
114
+ });
115
+ }
116
+ return steps;
117
+ }
118
+ /**
119
+ * Formate une combinaison brute en libellé soigné et lisible pour l'OS cible.
120
+ * Ex: "Mod+Shift+P" -> macOS: "⇧⌘P", Windows: "Ctrl+Shift+P"
121
+ * Ex: "g i" -> "g puis i" ou "g i"
122
+ */
123
+ static format(combo, isApple = _ShortcutFormatter.isApple()) {
124
+ const steps = _ShortcutFormatter.parseCombo(combo, isApple);
125
+ if (steps.length === 0) {
126
+ return combo;
127
+ }
128
+ const formattedSteps = steps.map((step) => {
129
+ const parts = [];
130
+ if (isApple) {
131
+ if (step.ctrl) parts.push("\u2303");
132
+ if (step.alt) parts.push("\u2325");
133
+ if (step.shift) parts.push("\u21E7");
134
+ if (step.meta) parts.push("\u2318");
135
+ const keyDisplay = _ShortcutFormatter.formatKeyDisplay(step.key, true);
136
+ parts.push(keyDisplay);
137
+ return parts.join("");
138
+ } else {
139
+ if (step.ctrl) parts.push("Ctrl");
140
+ if (step.alt) parts.push("Alt");
141
+ if (step.shift) parts.push("Shift");
142
+ if (step.meta) parts.push("Win");
143
+ const keyDisplay = _ShortcutFormatter.formatKeyDisplay(step.key, false);
144
+ parts.push(keyDisplay);
145
+ return parts.join("+");
146
+ }
147
+ });
148
+ return formattedSteps.join(" ");
149
+ }
150
+ /**
151
+ * Convertit un combo technique vers le format officiel WAI-ARIA `aria-keyshortcuts`.
152
+ * Standard W3C : les modificateurs sont 'Control', 'Alt', 'Shift', 'Meta' et le séparateur est '+'.
153
+ */
154
+ static toAriaKeyShortcuts(combo, isApple = _ShortcutFormatter.isApple()) {
155
+ const steps = _ShortcutFormatter.parseCombo(combo, isApple);
156
+ return steps.map((step) => {
157
+ const parts = [];
158
+ if (step.ctrl) parts.push("Control");
159
+ if (step.alt) parts.push("Alt");
160
+ if (step.shift) parts.push("Shift");
161
+ if (step.meta) parts.push("Meta");
162
+ parts.push(_ShortcutFormatter.formatKeyDisplay(step.key, false));
163
+ return parts.join("+");
164
+ }).join(" ");
165
+ }
166
+ static formatKeyDisplay(key, isApple) {
167
+ if (!key) return "";
168
+ switch (key.toLowerCase()) {
169
+ case "escape":
170
+ return isApple ? "\u238B" : "Esc";
171
+ case "enter":
172
+ return isApple ? "\u21A9" : "Enter";
173
+ case " ":
174
+ return isApple ? "\u2423" : "Space";
175
+ case "tab":
176
+ return isApple ? "\u21E5" : "Tab";
177
+ case "backspace":
178
+ return isApple ? "\u232B" : "Backspace";
179
+ case "delete":
180
+ return isApple ? "\u2326" : "Suppr";
181
+ case "arrowup":
182
+ return "\u2191";
183
+ case "arrowdown":
184
+ return "\u2193";
185
+ case "arrowleft":
186
+ return "\u2190";
187
+ case "arrowright":
188
+ return "\u2192";
189
+ default:
190
+ return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);
191
+ }
192
+ }
193
+ };
194
+
195
+ // src/shortcut/ShortcutManager.ts
196
+ var ShortcutManager = class _ShortcutManager {
197
+ constructor(options) {
198
+ this.shortcuts = /* @__PURE__ */ new Map();
199
+ this.scopeStack = [];
200
+ this.sequenceBuffer = [];
201
+ this.sequenceTimer = null;
202
+ this.isListening = true;
203
+ this.boundListener = null;
204
+ this.idCounter = 0;
205
+ this.options = {
206
+ defaultScope: options?.defaultScope || "global",
207
+ sequenceTimeout: options?.sequenceTimeout ?? 800,
208
+ target: options?.target || (typeof window !== "undefined" ? window : {}),
209
+ onError: options?.onError
210
+ };
211
+ this.scopeStack = [this.options.defaultScope];
212
+ this.initListener();
213
+ }
214
+ /**
215
+ * Vérifie si un élément DOM est une zone d'édition où la saisie de l'utilisateur
216
+ * ne doit JAMAIS être interrompue ou détournée (Axiome Primordial).
217
+ */
218
+ static isEditable(target) {
219
+ if (!target || typeof target.tagName !== "string") {
220
+ return false;
221
+ }
222
+ const el = target;
223
+ const tagName = el.tagName.toUpperCase();
224
+ if (tagName === "INPUT") {
225
+ const type = el.type?.toLowerCase() || "text";
226
+ const nonTextTypes = ["button", "checkbox", "radio", "submit", "reset", "range", "color", "file", "image"];
227
+ return !nonTextTypes.includes(type);
228
+ }
229
+ if (tagName === "TEXTAREA" || tagName === "SELECT") {
230
+ return true;
231
+ }
232
+ if (el.isContentEditable || el.getAttribute("contenteditable") === "true" || el.getAttribute("contenteditable") === "plaintext-only") {
233
+ return true;
234
+ }
235
+ const role = el.getAttribute("role");
236
+ if (role === "textbox" || role === "searchbox") {
237
+ return true;
238
+ }
239
+ return false;
240
+ }
241
+ /**
242
+ * Enregistre un ou plusieurs raccourcis clavier.
243
+ * Retourne une fonction de nettoyage pour désenregistrer immédiatement.
244
+ */
245
+ bind(definition) {
246
+ const list = Array.isArray(definition) ? definition : [definition];
247
+ const registeredIds = [];
248
+ for (const def of list) {
249
+ if (!def.combo || typeof def.handler !== "function") {
250
+ continue;
251
+ }
252
+ const id = `wulf_shortcut_${++this.idCounter}`;
253
+ const normalizedSteps = ShortcutFormatter.parseCombo(def.combo);
254
+ const isSequence = normalizedSteps.length > 1;
255
+ const formattedCombo = ShortcutFormatter.format(def.combo);
256
+ const registered = {
257
+ ...def,
258
+ id,
259
+ scope: def.scope || "global",
260
+ category: def.category || "G\xE9n\xE9ral",
261
+ allowInEditable: def.allowInEditable ?? false,
262
+ preventDefault: def.preventDefault ?? true,
263
+ stopPropagation: def.stopPropagation ?? true,
264
+ priority: def.priority ?? 0,
265
+ formattedCombo,
266
+ normalizedSteps,
267
+ isSequence
268
+ };
269
+ this.shortcuts.set(id, registered);
270
+ registeredIds.push(id);
271
+ }
272
+ return () => {
273
+ for (const id of registeredIds) {
274
+ this.shortcuts.delete(id);
275
+ }
276
+ };
277
+ }
278
+ /**
279
+ * Retire tous les raccourcis correspondant à une combinaison et éventuellement un scope.
280
+ */
281
+ unbind(combo, scope) {
282
+ const formatted = ShortcutFormatter.format(combo);
283
+ for (const [id, s] of this.shortcuts.entries()) {
284
+ if (s.formattedCombo === formatted || s.combo.trim().toLowerCase() === combo.trim().toLowerCase()) {
285
+ if (!scope || s.scope === scope) {
286
+ this.shortcuts.delete(id);
287
+ }
288
+ }
289
+ }
290
+ }
291
+ /**
292
+ * Empile un nouveau scope actif (mode LIFO).
293
+ * Seuls les raccourcis de ce scope (et les omniprésents '*') seront actifs.
294
+ */
295
+ pushScope(scope) {
296
+ if (scope && typeof scope === "string") {
297
+ this.scopeStack.push(scope);
298
+ this.clearSequenceBuffer();
299
+ }
300
+ }
301
+ /**
302
+ * Dépile le scope actuel et rétablit le précédent.
303
+ * Si un paramètre `scope` est passé, ne retire que si le scope actuel correspond.
304
+ */
305
+ popScope(scope) {
306
+ if (this.scopeStack.length <= 1) {
307
+ return this.scopeStack[0];
308
+ }
309
+ if (scope) {
310
+ if (this.getScope() === scope) {
311
+ const popped2 = this.scopeStack.pop();
312
+ this.clearSequenceBuffer();
313
+ return popped2;
314
+ }
315
+ return void 0;
316
+ }
317
+ const popped = this.scopeStack.pop();
318
+ this.clearSequenceBuffer();
319
+ return popped;
320
+ }
321
+ /**
322
+ * Réinitialise brutalement la pile pour activer le scope spécifié.
323
+ */
324
+ setScope(scope) {
325
+ this.scopeStack = [scope || this.options.defaultScope];
326
+ this.clearSequenceBuffer();
327
+ }
328
+ /**
329
+ * Retourne le scope actuellement actif au sommet de la pile.
330
+ */
331
+ getScope() {
332
+ return this.scopeStack[this.scopeStack.length - 1] || this.options.defaultScope;
333
+ }
334
+ /**
335
+ * Retourne une copie de la pile complète des scopes.
336
+ */
337
+ getScopeStack() {
338
+ return [...this.scopeStack];
339
+ }
340
+ /**
341
+ * Met en pause l'écoute de tous les raccourcis.
342
+ */
343
+ pause() {
344
+ this.isListening = false;
345
+ this.clearSequenceBuffer();
346
+ }
347
+ /**
348
+ * Réactive l'écoute des raccourcis.
349
+ */
350
+ resume() {
351
+ this.isListening = true;
352
+ }
353
+ /**
354
+ * Indique si le gestionnaire est actif et à l'écoute.
355
+ */
356
+ isActive() {
357
+ return this.isListening;
358
+ }
359
+ /**
360
+ * Retourne le catalogue des raccourcis enregistrés (optionnellement filtré par scope).
361
+ */
362
+ getRegistry(scope) {
363
+ const list = [];
364
+ for (const shortcut of this.shortcuts.values()) {
365
+ if (!scope || shortcut.scope === scope || shortcut.scope === "*") {
366
+ list.push({ ...shortcut });
367
+ }
368
+ }
369
+ return list;
370
+ }
371
+ /**
372
+ * Associe l'attribut standard WAI-ARIA `aria-keyshortcuts` sur un élément DOM.
373
+ */
374
+ attachAria(element, combo) {
375
+ if (element && typeof element.setAttribute === "function") {
376
+ const ariaValue = ShortcutFormatter.toAriaKeyShortcuts(combo);
377
+ element.setAttribute("aria-keyshortcuts", ariaValue);
378
+ }
379
+ }
380
+ /**
381
+ * Formate une combinaison brute selon l'OS courant ("⌘K" ou "Ctrl+K").
382
+ */
383
+ static format(combo, isApple) {
384
+ return ShortcutFormatter.format(combo, isApple);
385
+ }
386
+ /**
387
+ * Détruit le gestionnaire : supprime les écouteurs du DOM et vide toute la mémoire.
388
+ */
389
+ destroy() {
390
+ this.pause();
391
+ this.removeListener();
392
+ this.shortcuts.clear();
393
+ this.scopeStack = [];
394
+ this.clearSequenceBuffer();
395
+ }
396
+ // --- Implémentation Interne ---
397
+ initListener() {
398
+ if (typeof window === "undefined" || !this.options.target) {
399
+ return;
400
+ }
401
+ this.boundListener = (event) => this.handleKeyDown(event);
402
+ const target = this.options.target;
403
+ if (typeof target.addEventListener === "function") {
404
+ target.addEventListener("keydown", this.boundListener, false);
405
+ }
406
+ }
407
+ removeListener() {
408
+ if (this.boundListener && this.options.target) {
409
+ const target = this.options.target;
410
+ if (typeof target.removeEventListener === "function") {
411
+ target.removeEventListener("keydown", this.boundListener, false);
412
+ }
413
+ this.boundListener = null;
414
+ }
415
+ }
416
+ handleKeyDown(event) {
417
+ if (!this.isListening) {
418
+ return;
419
+ }
420
+ const k = (event.key || "").toLowerCase();
421
+ if (["control", "alt", "shift", "meta"].includes(k)) {
422
+ return;
423
+ }
424
+ const currentScope = this.getScope();
425
+ const isEditable = _ShortcutManager.isEditable(event.target);
426
+ const currentStep = {
427
+ ctrl: event.ctrlKey,
428
+ alt: event.altKey,
429
+ shift: event.shiftKey,
430
+ meta: event.metaKey,
431
+ key: ShortcutFormatter.normalizeKeyName(event.key || "")
432
+ };
433
+ const now = Date.now();
434
+ if (this.sequenceBuffer.length > 0) {
435
+ const last = this.sequenceBuffer[this.sequenceBuffer.length - 1];
436
+ if (now - last.timestamp > this.options.sequenceTimeout) {
437
+ this.clearSequenceBuffer();
438
+ }
439
+ }
440
+ const activeCandidates = this.getActiveShortcuts(currentScope, isEditable);
441
+ const proposedSequence = [...this.sequenceBuffer.map((b) => b.step), currentStep];
442
+ const matchingSequence = this.findMatchingSequence(activeCandidates, proposedSequence);
443
+ if (matchingSequence) {
444
+ this.clearSequenceBuffer();
445
+ this.executeShortcut(matchingSequence, event, currentScope, true);
446
+ return;
447
+ }
448
+ if (this.isPrefixOfAnySequence(activeCandidates, proposedSequence)) {
449
+ this.sequenceBuffer.push({ step: currentStep, timestamp: now });
450
+ this.resetSequenceTimer();
451
+ if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && !isEditable) {
452
+ event.preventDefault();
453
+ }
454
+ return;
455
+ }
456
+ this.clearSequenceBuffer();
457
+ const matchingChord = this.findMatchingChord(activeCandidates, currentStep, event);
458
+ if (matchingChord) {
459
+ this.executeShortcut(matchingChord, event, currentScope, false);
460
+ }
461
+ }
462
+ getActiveShortcuts(currentScope, isEditable) {
463
+ const list = [];
464
+ for (const shortcut of this.shortcuts.values()) {
465
+ if (shortcut.scope !== currentScope && shortcut.scope !== "*") {
466
+ continue;
467
+ }
468
+ if (isEditable && !shortcut.allowInEditable) {
469
+ continue;
470
+ }
471
+ list.push(shortcut);
472
+ }
473
+ return list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
474
+ }
475
+ stepMatches(step, eventStep, rawEvent) {
476
+ if (step.ctrl !== eventStep.ctrl) return false;
477
+ if (step.alt !== eventStep.alt) return false;
478
+ if (step.meta !== eventStep.meta) return false;
479
+ const keyMatches = step.key === eventStep.key || rawEvent && step.key === rawEvent.key.toLowerCase();
480
+ if (!keyMatches) return false;
481
+ if (step.shift === eventStep.shift) {
482
+ return true;
483
+ }
484
+ if (!step.shift && eventStep.shift) {
485
+ if (rawEvent && rawEvent.key === step.key) {
486
+ return true;
487
+ }
488
+ }
489
+ return false;
490
+ }
491
+ findMatchingChord(candidates, currentStep, rawEvent) {
492
+ for (const candidate of candidates) {
493
+ if (candidate.isSequence || candidate.normalizedSteps.length !== 1) {
494
+ continue;
495
+ }
496
+ const step = candidate.normalizedSteps[0];
497
+ if (this.stepMatches(step, currentStep, rawEvent)) {
498
+ return candidate;
499
+ }
500
+ }
501
+ return null;
502
+ }
503
+ findMatchingSequence(candidates, proposed) {
504
+ for (const candidate of candidates) {
505
+ if (!candidate.isSequence || candidate.normalizedSteps.length !== proposed.length) {
506
+ continue;
507
+ }
508
+ let allMatch = true;
509
+ for (let i = 0; i < proposed.length; i++) {
510
+ if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {
511
+ allMatch = false;
512
+ break;
513
+ }
514
+ }
515
+ if (allMatch) {
516
+ return candidate;
517
+ }
518
+ }
519
+ return null;
520
+ }
521
+ isPrefixOfAnySequence(candidates, proposed) {
522
+ for (const candidate of candidates) {
523
+ if (!candidate.isSequence || candidate.normalizedSteps.length <= proposed.length) {
524
+ continue;
525
+ }
526
+ let prefixMatches = true;
527
+ for (let i = 0; i < proposed.length; i++) {
528
+ if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {
529
+ prefixMatches = false;
530
+ break;
531
+ }
532
+ }
533
+ if (prefixMatches) {
534
+ return true;
535
+ }
536
+ }
537
+ return false;
538
+ }
539
+ executeShortcut(shortcut, event, scope, isSequence) {
540
+ if (shortcut.preventDefault) {
541
+ event.preventDefault();
542
+ }
543
+ if (shortcut.stopPropagation) {
544
+ event.stopPropagation();
545
+ }
546
+ const info = {
547
+ combo: shortcut.combo,
548
+ formattedCombo: shortcut.formattedCombo,
549
+ scope,
550
+ target: event.target,
551
+ isSequence
552
+ };
553
+ try {
554
+ shortcut.handler(event, info);
555
+ } catch (err) {
556
+ if (this.options.onError) {
557
+ this.options.onError(err instanceof Error ? err : new Error(String(err)), shortcut.combo);
558
+ } else {
559
+ console.error(`[Wulf.Shortcut] Erreur lors de l'ex\xE9cution du raccourci "${shortcut.combo}":`, err);
560
+ }
561
+ }
562
+ }
563
+ resetSequenceTimer() {
564
+ if (this.sequenceTimer) {
565
+ clearTimeout(this.sequenceTimer);
566
+ }
567
+ this.sequenceTimer = setTimeout(() => {
568
+ this.clearSequenceBuffer();
569
+ }, this.options.sequenceTimeout);
570
+ }
571
+ clearSequenceBuffer() {
572
+ this.sequenceBuffer = [];
573
+ if (this.sequenceTimer) {
574
+ clearTimeout(this.sequenceTimer);
575
+ this.sequenceTimer = null;
576
+ }
577
+ }
578
+ };
579
+ export {
580
+ ShortcutFormatter,
581
+ ShortcutManager,
582
+ ShortcutManager as default
583
+ };
584
+ //# sourceMappingURL=shortcut.esm.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/shortcut/ShortcutFormatter.ts", "../src/shortcut/ShortcutManager.ts"],
4
+ "sourcesContent": ["import { NormalizedStep } from './types';\n\n/**\n * Utilitaires de d\u00E9tection d'OS, de parsing de cha\u00EEnes et de formatage de raccourcis.\n */\nexport class ShortcutFormatter {\n /**\n * D\u00E9tecte si l'environnement d'ex\u00E9cution actuel est un environnement Apple (macOS / iOS / iPadOS).\n */\n public static isApple(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n // 1. D\u00E9tection moderne via User-Agent Client Hints (si disponible)\n const uaData = (navigator as unknown as { userAgentData?: { platform?: string } }).userAgentData;\n if (uaData && typeof uaData.platform === 'string') {\n const p = uaData.platform.toLowerCase();\n if (p.includes('mac') || p.includes('ios')) {\n return true;\n }\n }\n\n // 2. D\u00E9tection via navigator.platform\n const platform = (navigator.platform || '').toLowerCase();\n if (platform.includes('mac') || platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) {\n return true;\n }\n\n // 3. D\u00E9tection de secours via User-Agent\n const ua = (navigator.userAgent || '').toLowerCase();\n return ua.includes('macintosh') || ua.includes('mac os x') || ua.includes('ipad') || ua.includes('iphone');\n }\n\n /**\n * Normalise un nom de touche unitaire pour les comparaisons.\n */\n public static normalizeKeyName(key: string): string {\n const k = key.trim().toLowerCase();\n switch (k) {\n case 'esc':\n return 'escape';\n case 'return':\n return 'enter';\n case 'space':\n case 'spacebar':\n return ' ';\n case 'del':\n return 'delete';\n case 'ins':\n return 'insert';\n case 'up':\n return 'arrowup';\n case 'down':\n return 'arrowdown';\n case 'left':\n return 'arrowleft';\n case 'right':\n return 'arrowright';\n default:\n return k;\n }\n }\n\n /**\n * Parse une cha\u00EEne de combinaison (ex: \"Mod+K\", \"g i\", \"Shift+?\", \"Alt++\")\n * et retourne la liste des \u00E9tapes normalis\u00E9es n\u00E9cessaires au d\u00E9clenchement.\n */\n public static parseCombo(combo: string, isApple: boolean = ShortcutFormatter.isApple()): NormalizedStep[] {\n const trimmed = combo.trim();\n if (!trimmed) {\n return [];\n }\n\n // D\u00E9coupage en \u00E9tapes pour les s\u00E9quences (ex: \"g i\" -> [\"g\", \"i\"])\n // Attention : on s\u00E9pare par espaces, sauf si l'espace est la touche elle-m\u00EAme (\"space\")\n const stepsRaw = trimmed.split(/\\s+/);\n const steps: NormalizedStep[] = [];\n\n for (const rawStep of stepsRaw) {\n // D\u00E9coupage de chaque accord sur le symbole '+' (gestion du cas '++' pour la touche '+')\n const tokens: string[] = [];\n let currentToken = '';\n\n for (let i = 0; i < rawStep.length; i++) {\n const char = rawStep[i];\n if (char === '+') {\n // Si le token actuel est vide et qu'on a d\u00E9j\u00E0 des tokens, c'est que c'est un '+' litt\u00E9ral (ex: \"Ctrl++\")\n if (currentToken === '' && tokens.length > 0) {\n tokens.push('+');\n } else if (currentToken !== '') {\n tokens.push(currentToken);\n currentToken = '';\n }\n } else {\n currentToken += char;\n }\n }\n if (currentToken !== '') {\n tokens.push(currentToken);\n }\n\n let ctrl = false;\n let alt = false;\n let shift = false;\n let meta = false;\n let mainKey = '';\n\n for (const token of tokens) {\n const lower = token.trim().toLowerCase();\n if (lower === 'ctrl' || lower === 'control') {\n ctrl = true;\n } else if (lower === 'alt' || lower === 'option' || lower === 'opt') {\n alt = true;\n } else if (lower === 'shift' || lower === 'maj') {\n shift = true;\n } else if (lower === 'cmd' || lower === 'command' || lower === 'meta' || lower === 'win' || lower === 'super') {\n meta = true;\n } else if (lower === 'mod' || lower === '$mod') {\n if (isApple) {\n meta = true;\n } else {\n ctrl = true;\n }\n } else {\n // Touche principale\n mainKey = ShortcutFormatter.normalizeKeyName(token);\n }\n }\n\n steps.push({\n ctrl,\n alt,\n shift,\n meta,\n key: mainKey\n });\n }\n\n return steps;\n }\n\n /**\n * Formate une combinaison brute en libell\u00E9 soign\u00E9 et lisible pour l'OS cible.\n * Ex: \"Mod+Shift+P\" -> macOS: \"\u21E7\u2318P\", Windows: \"Ctrl+Shift+P\"\n * Ex: \"g i\" -> \"g puis i\" ou \"g i\"\n */\n public static format(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n if (steps.length === 0) {\n return combo;\n }\n\n const formattedSteps = steps.map(step => {\n const parts: string[] = [];\n\n if (isApple) {\n if (step.ctrl) parts.push('\u2303');\n if (step.alt) parts.push('\u2325');\n if (step.shift) parts.push('\u21E7');\n if (step.meta) parts.push('\u2318');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, true);\n parts.push(keyDisplay);\n return parts.join('');\n } else {\n if (step.ctrl) parts.push('Ctrl');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Win');\n\n const keyDisplay = ShortcutFormatter.formatKeyDisplay(step.key, false);\n parts.push(keyDisplay);\n return parts.join('+');\n }\n });\n\n return formattedSteps.join(' ');\n }\n\n /**\n * Convertit un combo technique vers le format officiel WAI-ARIA `aria-keyshortcuts`.\n * Standard W3C : les modificateurs sont 'Control', 'Alt', 'Shift', 'Meta' et le s\u00E9parateur est '+'.\n */\n public static toAriaKeyShortcuts(combo: string, isApple: boolean = ShortcutFormatter.isApple()): string {\n const steps = ShortcutFormatter.parseCombo(combo, isApple);\n return steps.map(step => {\n const parts: string[] = [];\n if (step.ctrl) parts.push('Control');\n if (step.alt) parts.push('Alt');\n if (step.shift) parts.push('Shift');\n if (step.meta) parts.push('Meta');\n parts.push(ShortcutFormatter.formatKeyDisplay(step.key, false));\n return parts.join('+');\n }).join(' ');\n }\n\n private static formatKeyDisplay(key: string, isApple: boolean): string {\n if (!key) return '';\n switch (key.toLowerCase()) {\n case 'escape':\n return isApple ? '\u238B' : 'Esc';\n case 'enter':\n return isApple ? '\u21A9' : 'Enter';\n case ' ':\n return isApple ? '\u2423' : 'Space';\n case 'tab':\n return isApple ? '\u21E5' : 'Tab';\n case 'backspace':\n return isApple ? '\u232B' : 'Backspace';\n case 'delete':\n return isApple ? '\u2326' : 'Suppr';\n case 'arrowup':\n return '\u2191';\n case 'arrowdown':\n return '\u2193';\n case 'arrowleft':\n return '\u2190';\n case 'arrowright':\n return '\u2192';\n default:\n return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);\n }\n }\n}\n\n", "import {\n ShortcutDefinition,\n ShortcutManagerOptions,\n ShortcutInfo,\n RegisteredShortcut,\n NormalizedStep\n} from './types';\nimport { ShortcutFormatter } from './ShortcutFormatter';\n\n/**\n * Moteur autonome et modulaire de gestion des raccourcis clavier applicatifs (Wulf.Shortcut).\n * Z\u00E9ro d\u00E9pendance. Conforme \u00E0 l'Axiome Primordial de pr\u00E9servation de la saisie utilisateur.\n */\nexport class ShortcutManager {\n private readonly options: Required<Omit<ShortcutManagerOptions, 'onError'>> & {\n onError?: (error: Error, combo: string) => void;\n };\n private readonly shortcuts: Map<string, RegisteredShortcut> = new Map();\n private scopeStack: string[] = [];\n private sequenceBuffer: { step: NormalizedStep; timestamp: number }[] = [];\n private sequenceTimer: ReturnType<typeof setTimeout> | null = null;\n private isListening = true;\n private boundListener: ((event: KeyboardEvent) => void) | null = null;\n private idCounter = 0;\n\n constructor(options?: ShortcutManagerOptions) {\n this.options = {\n defaultScope: options?.defaultScope || 'global',\n sequenceTimeout: options?.sequenceTimeout ?? 800,\n target: options?.target || (typeof window !== 'undefined' ? window : ({} as Window)),\n onError: options?.onError\n };\n\n this.scopeStack = [this.options.defaultScope];\n this.initListener();\n }\n\n /**\n * V\u00E9rifie si un \u00E9l\u00E9ment DOM est une zone d'\u00E9dition o\u00F9 la saisie de l'utilisateur\n * ne doit JAMAIS \u00EAtre interrompue ou d\u00E9tourn\u00E9e (Axiome Primordial).\n */\n public static isEditable(target: EventTarget | null): boolean {\n if (!target || typeof (target as HTMLElement).tagName !== 'string') {\n return false;\n }\n\n const el = target as HTMLElement;\n const tagName = el.tagName.toUpperCase();\n\n // 1. \u00C9l\u00E9ments natifs de formulaire textuel\n if (tagName === 'INPUT') {\n const type = (el as HTMLInputElement).type?.toLowerCase() || 'text';\n // Seuls les types non-textuels ne sont pas consid\u00E9r\u00E9s comme de la saisie libre\n const nonTextTypes = ['button', 'checkbox', 'radio', 'submit', 'reset', 'range', 'color', 'file', 'image'];\n return !nonTextTypes.includes(type);\n }\n if (tagName === 'TEXTAREA' || tagName === 'SELECT') {\n return true;\n }\n\n // 2. \u00C9l\u00E9ments modifiables en ligne (contenteditable)\n if (el.isContentEditable || el.getAttribute('contenteditable') === 'true' || el.getAttribute('contenteditable') === 'plaintext-only') {\n return true;\n }\n\n // 3. R\u00F4les ARIA de saisie\n const role = el.getAttribute('role');\n if (role === 'textbox' || role === 'searchbox') {\n return true;\n }\n\n return false;\n }\n\n /**\n * Enregistre un ou plusieurs raccourcis clavier.\n * Retourne une fonction de nettoyage pour d\u00E9senregistrer imm\u00E9diatement.\n */\n public bind(definition: ShortcutDefinition | ShortcutDefinition[]): () => void {\n const list = Array.isArray(definition) ? definition : [definition];\n const registeredIds: string[] = [];\n\n for (const def of list) {\n if (!def.combo || typeof def.handler !== 'function') {\n continue;\n }\n\n const id = `wulf_shortcut_${++this.idCounter}`;\n const normalizedSteps = ShortcutFormatter.parseCombo(def.combo);\n const isSequence = normalizedSteps.length > 1;\n const formattedCombo = ShortcutFormatter.format(def.combo);\n\n const registered: RegisteredShortcut = {\n ...def,\n id,\n scope: def.scope || 'global',\n category: def.category || 'G\u00E9n\u00E9ral',\n allowInEditable: def.allowInEditable ?? false,\n preventDefault: def.preventDefault ?? true,\n stopPropagation: def.stopPropagation ?? true,\n priority: def.priority ?? 0,\n formattedCombo,\n normalizedSteps,\n isSequence\n };\n\n this.shortcuts.set(id, registered);\n registeredIds.push(id);\n }\n\n // Fonction de d\u00E9sabonnement direct\n return () => {\n for (const id of registeredIds) {\n this.shortcuts.delete(id);\n }\n };\n }\n\n /**\n * Retire tous les raccourcis correspondant \u00E0 une combinaison et \u00E9ventuellement un scope.\n */\n public unbind(combo: string, scope?: string): void {\n const formatted = ShortcutFormatter.format(combo);\n for (const [id, s] of this.shortcuts.entries()) {\n if (s.formattedCombo === formatted || s.combo.trim().toLowerCase() === combo.trim().toLowerCase()) {\n if (!scope || s.scope === scope) {\n this.shortcuts.delete(id);\n }\n }\n }\n }\n\n /**\n * Empile un nouveau scope actif (mode LIFO).\n * Seuls les raccourcis de ce scope (et les omnipr\u00E9sents '*') seront actifs.\n */\n public pushScope(scope: string): void {\n if (scope && typeof scope === 'string') {\n this.scopeStack.push(scope);\n this.clearSequenceBuffer();\n }\n }\n\n /**\n * D\u00E9pile le scope actuel et r\u00E9tablit le pr\u00E9c\u00E9dent.\n * Si un param\u00E8tre `scope` est pass\u00E9, ne retire que si le scope actuel correspond.\n */\n public popScope(scope?: string): string | undefined {\n if (this.scopeStack.length <= 1) {\n return this.scopeStack[0];\n }\n\n if (scope) {\n if (this.getScope() === scope) {\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n return undefined;\n }\n\n const popped = this.scopeStack.pop();\n this.clearSequenceBuffer();\n return popped;\n }\n\n /**\n * R\u00E9initialise brutalement la pile pour activer le scope sp\u00E9cifi\u00E9.\n */\n public setScope(scope: string): void {\n this.scopeStack = [scope || this.options.defaultScope];\n this.clearSequenceBuffer();\n }\n\n /**\n * Retourne le scope actuellement actif au sommet de la pile.\n */\n public getScope(): string {\n return this.scopeStack[this.scopeStack.length - 1] || this.options.defaultScope;\n }\n\n /**\n * Retourne une copie de la pile compl\u00E8te des scopes.\n */\n public getScopeStack(): string[] {\n return [...this.scopeStack];\n }\n\n /**\n * Met en pause l'\u00E9coute de tous les raccourcis.\n */\n public pause(): void {\n this.isListening = false;\n this.clearSequenceBuffer();\n }\n\n /**\n * R\u00E9active l'\u00E9coute des raccourcis.\n */\n public resume(): void {\n this.isListening = true;\n }\n\n /**\n * Indique si le gestionnaire est actif et \u00E0 l'\u00E9coute.\n */\n public isActive(): boolean {\n return this.isListening;\n }\n\n /**\n * Retourne le catalogue des raccourcis enregistr\u00E9s (optionnellement filtr\u00E9 par scope).\n */\n public getRegistry(scope?: string): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n if (!scope || shortcut.scope === scope || shortcut.scope === '*') {\n list.push({ ...shortcut });\n }\n }\n return list;\n }\n\n /**\n * Associe l'attribut standard WAI-ARIA `aria-keyshortcuts` sur un \u00E9l\u00E9ment DOM.\n */\n public attachAria(element: HTMLElement, combo: string): void {\n if (element && typeof element.setAttribute === 'function') {\n const ariaValue = ShortcutFormatter.toAriaKeyShortcuts(combo);\n element.setAttribute('aria-keyshortcuts', ariaValue);\n }\n }\n\n /**\n * Formate une combinaison brute selon l'OS courant (\"\u2318K\" ou \"Ctrl+K\").\n */\n public static format(combo: string, isApple?: boolean): string {\n return ShortcutFormatter.format(combo, isApple);\n }\n\n /**\n * D\u00E9truit le gestionnaire : supprime les \u00E9couteurs du DOM et vide toute la m\u00E9moire.\n */\n public destroy(): void {\n this.pause();\n this.removeListener();\n this.shortcuts.clear();\n this.scopeStack = [];\n this.clearSequenceBuffer();\n }\n\n // --- Impl\u00E9mentation Interne ---\n\n private initListener(): void {\n if (typeof window === 'undefined' || !this.options.target) {\n return;\n }\n\n this.boundListener = (event: KeyboardEvent) => this.handleKeyDown(event);\n const target = this.options.target as EventTarget;\n if (typeof target.addEventListener === 'function') {\n target.addEventListener('keydown', this.boundListener as EventListener, false);\n }\n }\n\n private removeListener(): void {\n if (this.boundListener && this.options.target) {\n const target = this.options.target as EventTarget;\n if (typeof target.removeEventListener === 'function') {\n target.removeEventListener('keydown', this.boundListener as EventListener, false);\n }\n this.boundListener = null;\n }\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (!this.isListening) {\n return;\n }\n\n // Touches modificatrices isol\u00E9es : on ne fait rien\n const k = (event.key || '').toLowerCase();\n if (['control', 'alt', 'shift', 'meta'].includes(k)) {\n return;\n }\n\n const currentScope = this.getScope();\n const isEditable = ShortcutManager.isEditable(event.target);\n\n // Extraction du pas de touche actuel\n const currentStep: NormalizedStep = {\n ctrl: event.ctrlKey,\n alt: event.altKey,\n shift: event.shiftKey,\n meta: event.metaKey,\n key: ShortcutFormatter.normalizeKeyName(event.key || '')\n };\n\n const now = Date.now();\n\n // 1. Purge du buffer de s\u00E9quence si le d\u00E9lai est d\u00E9pass\u00E9\n if (this.sequenceBuffer.length > 0) {\n const last = this.sequenceBuffer[this.sequenceBuffer.length - 1];\n if (now - last.timestamp > this.options.sequenceTimeout) {\n this.clearSequenceBuffer();\n }\n }\n\n // Candidats potentiels actifs pour le scope courant\n const activeCandidates = this.getActiveShortcuts(currentScope, isEditable);\n\n // 2. \u00C9valuation des s\u00E9quences temporelles (Key Sequences)\n const proposedSequence = [...this.sequenceBuffer.map(b => b.step), currentStep];\n const matchingSequence = this.findMatchingSequence(activeCandidates, proposedSequence);\n\n if (matchingSequence) {\n this.clearSequenceBuffer();\n this.executeShortcut(matchingSequence, event, currentScope, true);\n return;\n }\n\n // V\u00E9rifier si le pas actuel peut \u00EAtre le pr\u00E9fixe d'une s\u00E9quence enregistr\u00E9e\n if (this.isPrefixOfAnySequence(activeCandidates, proposedSequence)) {\n this.sequenceBuffer.push({ step: currentStep, timestamp: now });\n this.resetSequenceTimer();\n // On bloque l'\u00E9v\u00E9nement pour ne pas d\u00E9clencher un accord unitaire pendant une s\u00E9quence\n if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && !isEditable) {\n event.preventDefault();\n }\n return;\n }\n\n // Si la s\u00E9quence ne m\u00E8ne \u00E0 rien, on vide le buffer\n this.clearSequenceBuffer();\n\n // 3. \u00C9valuation des accords simultan\u00E9s unitaires (Single Chords)\n const matchingChord = this.findMatchingChord(activeCandidates, currentStep, event);\n if (matchingChord) {\n this.executeShortcut(matchingChord, event, currentScope, false);\n }\n }\n\n private getActiveShortcuts(currentScope: string, isEditable: boolean): RegisteredShortcut[] {\n const list: RegisteredShortcut[] = [];\n for (const shortcut of this.shortcuts.values()) {\n // Filtrage de scope\n if (shortcut.scope !== currentScope && shortcut.scope !== '*') {\n continue;\n }\n // R\u00C8GLE ABSOLUE (Axiome Primordial) : Filtrage des \u00E9l\u00E9ments \u00E9ditables\n if (isEditable && !shortcut.allowInEditable) {\n continue;\n }\n list.push(shortcut);\n }\n\n // Tri par priorit\u00E9 d\u00E9croissante\n return list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }\n\n private stepMatches(step: NormalizedStep, eventStep: NormalizedStep, rawEvent?: KeyboardEvent): boolean {\n if (step.ctrl !== eventStep.ctrl) return false;\n if (step.alt !== eventStep.alt) return false;\n if (step.meta !== eventStep.meta) return false;\n\n // Correspondance de la touche\n const keyMatches =\n step.key === eventStep.key ||\n (rawEvent && step.key === rawEvent.key.toLowerCase());\n\n if (!keyMatches) return false;\n\n // Correspondance Shift :\n // Si la touche sp\u00E9cifie shift: true, l'\u00E9v\u00E9nement doit avoir shiftKey true.\n // Si la touche sp\u00E9cifie shift: false, mais que le caract\u00E8re est un symbole (ex: \"?\")\n // tap\u00E9 avec shift, on tol\u00E8re si la touche correspond exactement.\n if (step.shift === eventStep.shift) {\n return true;\n }\n\n if (!step.shift && eventStep.shift) {\n // Autoris\u00E9 si c'est un caract\u00E8re sp\u00E9cial direct (comme \"?\" ou \"!\")\n if (rawEvent && rawEvent.key === step.key) {\n return true;\n }\n }\n\n return false;\n }\n\n private findMatchingChord(\n candidates: RegisteredShortcut[],\n currentStep: NormalizedStep,\n rawEvent: KeyboardEvent\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (candidate.isSequence || candidate.normalizedSteps.length !== 1) {\n continue;\n }\n\n const step = candidate.normalizedSteps[0];\n if (this.stepMatches(step, currentStep, rawEvent)) {\n return candidate;\n }\n }\n return null;\n }\n\n private findMatchingSequence(\n candidates: RegisteredShortcut[],\n proposed: NormalizedStep[]\n ): RegisteredShortcut | null {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length !== proposed.length) {\n continue;\n }\n\n let allMatch = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n allMatch = false;\n break;\n }\n }\n\n if (allMatch) {\n return candidate;\n }\n }\n return null;\n }\n\n private isPrefixOfAnySequence(candidates: RegisteredShortcut[], proposed: NormalizedStep[]): boolean {\n for (const candidate of candidates) {\n if (!candidate.isSequence || candidate.normalizedSteps.length <= proposed.length) {\n continue;\n }\n\n let prefixMatches = true;\n for (let i = 0; i < proposed.length; i++) {\n if (!this.stepMatches(candidate.normalizedSteps[i], proposed[i])) {\n prefixMatches = false;\n break;\n }\n }\n\n if (prefixMatches) {\n return true;\n }\n }\n return false;\n }\n\n private executeShortcut(\n shortcut: RegisteredShortcut,\n event: KeyboardEvent,\n scope: string,\n isSequence: boolean\n ): void {\n if (shortcut.preventDefault) {\n event.preventDefault();\n }\n if (shortcut.stopPropagation) {\n event.stopPropagation();\n }\n\n const info: ShortcutInfo = {\n combo: shortcut.combo,\n formattedCombo: shortcut.formattedCombo,\n scope,\n target: event.target,\n isSequence\n };\n\n try {\n shortcut.handler(event, info);\n } catch (err) {\n if (this.options.onError) {\n this.options.onError(err instanceof Error ? err : new Error(String(err)), shortcut.combo);\n } else {\n console.error(`[Wulf.Shortcut] Erreur lors de l'ex\u00E9cution du raccourci \"${shortcut.combo}\":`, err);\n }\n }\n }\n\n private resetSequenceTimer(): void {\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n }\n this.sequenceTimer = setTimeout(() => {\n this.clearSequenceBuffer();\n }, this.options.sequenceTimeout);\n }\n\n private clearSequenceBuffer(): void {\n this.sequenceBuffer = [];\n if (this.sequenceTimer) {\n clearTimeout(this.sequenceTimer);\n this.sequenceTimer = null;\n }\n }\n}\n\n"],
5
+ "mappings": ";AAKO,IAAM,oBAAN,MAAM,mBAAkB;AAAA;AAAA;AAAA;AAAA,EAI7B,OAAc,UAAmB;AAC/B,QAAI,OAAO,cAAc,aAAa;AACpC,aAAO;AAAA,IACT;AAGA,UAAM,SAAU,UAAmE;AACnF,QAAI,UAAU,OAAO,OAAO,aAAa,UAAU;AACjD,YAAM,IAAI,OAAO,SAAS,YAAY;AACtC,UAAI,EAAE,SAAS,KAAK,KAAK,EAAE,SAAS,KAAK,GAAG;AAC1C,eAAO;AAAA,MACT;AAAA,IACF;AAGA,UAAM,YAAY,UAAU,YAAY,IAAI,YAAY;AACxD,QAAI,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,QAAQ,KAAK,SAAS,SAAS,MAAM,KAAK,SAAS,SAAS,MAAM,GAAG;AACrH,aAAO;AAAA,IACT;AAGA,UAAM,MAAM,UAAU,aAAa,IAAI,YAAY;AACnD,WAAO,GAAG,SAAS,WAAW,KAAK,GAAG,SAAS,UAAU,KAAK,GAAG,SAAS,MAAM,KAAK,GAAG,SAAS,QAAQ;AAAA,EAC3G;AAAA;AAAA;AAAA;AAAA,EAKA,OAAc,iBAAiB,KAAqB;AAClD,UAAM,IAAI,IAAI,KAAK,EAAE,YAAY;AACjC,YAAQ,GAAG;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AAAA,MACL,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA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