wulf.js 1.9.2 → 2.0.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 +124 -78
- package/changelog.md +105 -0
- package/dist/focus-trap.esm.js +245 -126
- package/dist/focus-trap.esm.js.map +3 -3
- package/dist/focus-trap.global.js +247 -128
- 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 +2434 -905
- package/dist/index.esm.js.map +4 -4
- package/dist/index.global.js +2436 -907
- package/dist/index.global.js.map +4 -4
- package/dist/index.global.min.js +4 -4
- package/dist/index.global.min.js.map +4 -4
- package/dist/mask.css +1 -1
- package/dist/mask.css.map +2 -2
- package/dist/mask.esm.js +746 -346
- package/dist/mask.esm.js.map +3 -3
- package/dist/mask.global.js +748 -348
- package/dist/mask.global.js.map +3 -3
- package/dist/mask.global.min.js +4 -4
- package/dist/mask.global.min.js.map +4 -4
- package/dist/mask.layered.css +1 -0
- package/dist/mask.layered.css.map +7 -0
- package/dist/masonry.css +1 -1
- package/dist/masonry.css.map +2 -2
- package/dist/masonry.esm.js +341 -114
- package/dist/masonry.esm.js.map +3 -3
- package/dist/masonry.global.js +343 -116
- 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/masonry.layered.css +1 -0
- package/dist/masonry.layered.css.map +7 -0
- package/dist/scroll.css +1 -1
- package/dist/scroll.css.map +2 -2
- package/dist/scroll.esm.js +524 -153
- package/dist/scroll.esm.js.map +3 -3
- package/dist/scroll.global.js +526 -155
- package/dist/scroll.global.js.map +3 -3
- package/dist/scroll.global.min.js +4 -4
- package/dist/scroll.global.min.js.map +4 -4
- package/dist/scroll.layered.css +1 -0
- package/dist/scroll.layered.css.map +7 -0
- package/dist/shortcut.esm.js +209 -46
- package/dist/shortcut.esm.js.map +3 -3
- package/dist/shortcut.global.js +211 -48
- package/dist/shortcut.global.js.map +3 -3
- package/dist/shortcut.global.min.js +2 -2
- package/dist/shortcut.global.min.js.map +4 -4
- package/dist/toast.css +1 -1
- package/dist/toast.css.map +2 -2
- package/dist/toast.esm.js +590 -160
- package/dist/toast.esm.js.map +3 -3
- package/dist/toast.global.js +592 -162
- 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 -0
- package/dist/toast.layered.css.map +7 -0
- package/dist/types/common/dom.d.ts +38 -0
- package/dist/types/focus-trap/FocusTrap.d.ts +15 -5
- package/dist/types/focus-trap/types.d.ts +2 -2
- package/dist/types/index.d.ts +10 -0
- package/dist/types/mask/AmountEngine.d.ts +1 -0
- package/dist/types/mask/BaseInputMask.d.ts +24 -0
- package/dist/types/mask/InputAmountMask.d.ts +3 -0
- package/dist/types/mask/InputEmailMask.d.ts +16 -1
- package/dist/types/mask/InputMask.d.ts +1 -0
- package/dist/types/mask/MaskEngine.d.ts +4 -0
- package/dist/types/masonry/Masonry.d.ts +10 -3
- package/dist/types/scroll/ScrollBlock.d.ts +31 -3
- package/dist/types/scroll/types.d.ts +13 -1
- package/dist/types/shortcut/ShortcutFormatter.d.ts +6 -0
- package/dist/types/shortcut/ShortcutManager.d.ts +5 -0
- package/dist/types/toast/Toast.d.ts +4 -0
- package/dist/types/toast/ToastInstance.d.ts +22 -10
- package/dist/types/toast/ToastManager.d.ts +37 -4
- package/dist/types/toast/i18n/types.d.ts +2 -0
- package/dist/types/toast/types.d.ts +14 -2
- package/package.json +20 -5
package/dist/shortcut.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
2
|
+
var __WulfIIFE = (() => {
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -26,6 +26,24 @@ var Wulf = (() => {
|
|
|
26
26
|
default: () => ShortcutManager
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
// src/common/dom.ts
|
|
30
|
+
function getSafeWulfNamespace() {
|
|
31
|
+
if (typeof window === "undefined") return null;
|
|
32
|
+
const win = window;
|
|
33
|
+
const existing = win.Wulf;
|
|
34
|
+
if (!existing || typeof existing !== "object" || typeof Node !== "undefined" && existing instanceof Node || typeof HTMLCollection !== "undefined" && existing instanceof HTMLCollection) {
|
|
35
|
+
const fresh = {};
|
|
36
|
+
win.Wulf = fresh;
|
|
37
|
+
return fresh;
|
|
38
|
+
}
|
|
39
|
+
return existing;
|
|
40
|
+
}
|
|
41
|
+
function isImeComposing(event) {
|
|
42
|
+
return Boolean(
|
|
43
|
+
event.isComposing || event.key === "Process" || event.key === "Enter" && event.keyCode === 229
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
// src/shortcut/ShortcutFormatter.ts
|
|
30
48
|
var ShortcutFormatter = class _ShortcutFormatter {
|
|
31
49
|
/**
|
|
@@ -53,6 +71,9 @@ var Wulf = (() => {
|
|
|
53
71
|
* Normalise un nom de touche unitaire pour les comparaisons.
|
|
54
72
|
*/
|
|
55
73
|
static normalizeKeyName(key) {
|
|
74
|
+
if (key === " ") {
|
|
75
|
+
return " ";
|
|
76
|
+
}
|
|
56
77
|
const k = key.trim().toLowerCase();
|
|
57
78
|
switch (k) {
|
|
58
79
|
case "esc":
|
|
@@ -62,6 +83,8 @@ var Wulf = (() => {
|
|
|
62
83
|
case "space":
|
|
63
84
|
case "spacebar":
|
|
64
85
|
return " ";
|
|
86
|
+
case "plus":
|
|
87
|
+
return "+";
|
|
65
88
|
case "del":
|
|
66
89
|
return "delete";
|
|
67
90
|
case "ins":
|
|
@@ -83,30 +106,44 @@ var Wulf = (() => {
|
|
|
83
106
|
* et retourne la liste des étapes normalisées nécessaires au déclenchement.
|
|
84
107
|
*/
|
|
85
108
|
static parseCombo(combo, isApple = _ShortcutFormatter.isApple()) {
|
|
86
|
-
|
|
109
|
+
if (typeof combo !== "string") {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
if (combo === " ") {
|
|
113
|
+
return [{ ctrl: false, alt: false, shift: false, meta: false, key: " " }];
|
|
114
|
+
}
|
|
115
|
+
const trimmed = combo.slice(0, 512).trim();
|
|
87
116
|
if (!trimmed) {
|
|
88
117
|
return [];
|
|
89
118
|
}
|
|
90
|
-
const
|
|
119
|
+
const normalizedChordSpacing = trimmed.replace(
|
|
120
|
+
/\b(ctrl|control|alt|option|opt|shift|maj|cmd|command|meta|win|super|mod|\$mod)\s*\+\s*/gi,
|
|
121
|
+
"$1+"
|
|
122
|
+
);
|
|
123
|
+
const stepsRaw = normalizedChordSpacing.split(/\s+/).slice(0, 10);
|
|
91
124
|
const steps = [];
|
|
92
125
|
for (const rawStep of stepsRaw) {
|
|
93
126
|
const tokens = [];
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
tokens.
|
|
102
|
-
|
|
127
|
+
if (rawStep === "+") {
|
|
128
|
+
tokens.push("+");
|
|
129
|
+
} else {
|
|
130
|
+
let currentToken = "";
|
|
131
|
+
for (let i = 0; i < rawStep.length; i++) {
|
|
132
|
+
const char = rawStep[i];
|
|
133
|
+
if (char === "+") {
|
|
134
|
+
if (currentToken === "" && tokens.length > 0) {
|
|
135
|
+
tokens.push("+");
|
|
136
|
+
} else if (currentToken !== "") {
|
|
137
|
+
tokens.push(currentToken);
|
|
138
|
+
currentToken = "";
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
currentToken += char;
|
|
103
142
|
}
|
|
104
|
-
} else {
|
|
105
|
-
currentToken += char;
|
|
106
143
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
144
|
+
if (currentToken !== "") {
|
|
145
|
+
tokens.push(currentToken);
|
|
146
|
+
}
|
|
110
147
|
}
|
|
111
148
|
let ctrl = false;
|
|
112
149
|
let alt = false;
|
|
@@ -178,18 +215,78 @@ var Wulf = (() => {
|
|
|
178
215
|
/**
|
|
179
216
|
* Convertit un combo technique vers le format officiel WAI-ARIA `aria-keyshortcuts`.
|
|
180
217
|
* Standard W3C : les modificateurs sont 'Control', 'Alt', 'Shift', 'Meta' et le séparateur est '+'.
|
|
218
|
+
* Attention : dans WAI-ARIA 1.2, l'espace délimite des raccourcis alternatifs et non une séquence temporelle.
|
|
219
|
+
* Pour une séquence multi-étapes (ex: "g i"), retourne une chaîne vide afin de ne pas induire le lecteur d'écran en erreur.
|
|
181
220
|
*/
|
|
182
221
|
static toAriaKeyShortcuts(combo, isApple = _ShortcutFormatter.isApple()) {
|
|
183
222
|
const steps = _ShortcutFormatter.parseCombo(combo, isApple);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
223
|
+
if (steps.length !== 1) {
|
|
224
|
+
return "";
|
|
225
|
+
}
|
|
226
|
+
const step = steps[0];
|
|
227
|
+
const ariaKey = _ShortcutFormatter.formatAriaKey(step.key);
|
|
228
|
+
if (!ariaKey) {
|
|
229
|
+
return "";
|
|
230
|
+
}
|
|
231
|
+
const parts = [];
|
|
232
|
+
if (step.ctrl) parts.push("Control");
|
|
233
|
+
if (step.alt) parts.push("Alt");
|
|
234
|
+
if (step.shift) parts.push("Shift");
|
|
235
|
+
if (step.meta) parts.push("Meta");
|
|
236
|
+
parts.push(ariaKey);
|
|
237
|
+
return parts.join("+");
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Formate un nom de touche strictement conforme aux valeurs standard W3C UI Events / aria-keyshortcuts.
|
|
241
|
+
*/
|
|
242
|
+
static formatAriaKey(key) {
|
|
243
|
+
if (!key) return "";
|
|
244
|
+
switch (key.toLowerCase()) {
|
|
245
|
+
case "escape":
|
|
246
|
+
return "Escape";
|
|
247
|
+
case "enter":
|
|
248
|
+
return "Enter";
|
|
249
|
+
case " ":
|
|
250
|
+
return "Space";
|
|
251
|
+
case "tab":
|
|
252
|
+
return "Tab";
|
|
253
|
+
case "backspace":
|
|
254
|
+
return "Backspace";
|
|
255
|
+
case "delete":
|
|
256
|
+
return "Delete";
|
|
257
|
+
case "insert":
|
|
258
|
+
return "Insert";
|
|
259
|
+
case "home":
|
|
260
|
+
return "Home";
|
|
261
|
+
case "end":
|
|
262
|
+
return "End";
|
|
263
|
+
case "pageup":
|
|
264
|
+
return "PageUp";
|
|
265
|
+
case "pagedown":
|
|
266
|
+
return "PageDown";
|
|
267
|
+
case "arrowup":
|
|
268
|
+
return "ArrowUp";
|
|
269
|
+
case "arrowdown":
|
|
270
|
+
return "ArrowDown";
|
|
271
|
+
case "arrowleft":
|
|
272
|
+
return "ArrowLeft";
|
|
273
|
+
case "arrowright":
|
|
274
|
+
return "ArrowRight";
|
|
275
|
+
case "printscreen":
|
|
276
|
+
return "PrintScreen";
|
|
277
|
+
case "scrolllock":
|
|
278
|
+
return "ScrollLock";
|
|
279
|
+
case "numlock":
|
|
280
|
+
return "NumLock";
|
|
281
|
+
case "capslock":
|
|
282
|
+
return "CapsLock";
|
|
283
|
+
case "contextmenu":
|
|
284
|
+
return "ContextMenu";
|
|
285
|
+
case "+":
|
|
286
|
+
return "Plus";
|
|
287
|
+
default:
|
|
288
|
+
return key.length === 1 ? key.toUpperCase() : key.charAt(0).toUpperCase() + key.slice(1);
|
|
289
|
+
}
|
|
193
290
|
}
|
|
194
291
|
static formatKeyDisplay(key, isApple) {
|
|
195
292
|
if (!key) return "";
|
|
@@ -222,17 +319,21 @@ var Wulf = (() => {
|
|
|
222
319
|
|
|
223
320
|
// src/shortcut/ShortcutManager.ts
|
|
224
321
|
var ShortcutManager = class _ShortcutManager {
|
|
322
|
+
options;
|
|
323
|
+
shortcuts = /* @__PURE__ */ new Map();
|
|
324
|
+
scopeStack = [];
|
|
325
|
+
sequenceBuffer = [];
|
|
326
|
+
sequenceTimer = null;
|
|
327
|
+
isListening = true;
|
|
328
|
+
boundListener = null;
|
|
329
|
+
abortController = null;
|
|
330
|
+
idCounter = 0;
|
|
225
331
|
constructor(options) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
this.sequenceBuffer = [];
|
|
229
|
-
this.sequenceTimer = null;
|
|
230
|
-
this.isListening = true;
|
|
231
|
-
this.boundListener = null;
|
|
232
|
-
this.idCounter = 0;
|
|
332
|
+
const rawTimeout = options?.sequenceTimeout;
|
|
333
|
+
const sequenceTimeout = typeof rawTimeout === "number" && Number.isFinite(rawTimeout) && rawTimeout > 0 ? Math.min(rawTimeout, 1e4) : 800;
|
|
233
334
|
this.options = {
|
|
234
335
|
defaultScope: options?.defaultScope || "global",
|
|
235
|
-
sequenceTimeout
|
|
336
|
+
sequenceTimeout,
|
|
236
337
|
target: options?.target || (typeof window !== "undefined" ? window : {}),
|
|
237
338
|
onError: options?.onError
|
|
238
339
|
};
|
|
@@ -257,15 +358,33 @@ var Wulf = (() => {
|
|
|
257
358
|
if (tagName === "TEXTAREA" || tagName === "SELECT") {
|
|
258
359
|
return true;
|
|
259
360
|
}
|
|
260
|
-
if (el.isContentEditable || el.getAttribute("contenteditable") === "true" || el.getAttribute("contenteditable") === "plaintext-only") {
|
|
361
|
+
if (el.isContentEditable || el.getAttribute("contenteditable") === "true" || el.getAttribute("contenteditable") === "plaintext-only" || el.getAttribute("contenteditable") === "") {
|
|
261
362
|
return true;
|
|
262
363
|
}
|
|
263
364
|
const role = el.getAttribute("role");
|
|
264
|
-
if (role === "textbox" || role === "searchbox") {
|
|
365
|
+
if (role === "textbox" || role === "searchbox" || role === "combobox" || role === "spinbutton") {
|
|
265
366
|
return true;
|
|
266
367
|
}
|
|
368
|
+
if (typeof el.closest === "function") {
|
|
369
|
+
const editableAncestor = el.closest(
|
|
370
|
+
'[contenteditable="true"], [contenteditable="plaintext-only"], [contenteditable=""], [role="textbox"], [role="searchbox"], [role="combobox"], [role="spinbutton"]'
|
|
371
|
+
);
|
|
372
|
+
if (editableAncestor) {
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
267
376
|
return false;
|
|
268
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* Vérifie si la cible est un champ de mot de passe (sanctuaire anti-keylogging).
|
|
380
|
+
*/
|
|
381
|
+
static isPasswordField(target) {
|
|
382
|
+
if (!target || typeof target.tagName !== "string") {
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
const el = target;
|
|
386
|
+
return el.tagName.toUpperCase() === "INPUT" && (el.type || "").toLowerCase() === "password";
|
|
387
|
+
}
|
|
269
388
|
/**
|
|
270
389
|
* Enregistre un ou plusieurs raccourcis clavier.
|
|
271
390
|
* Retourne une fonction de nettoyage pour désenregistrer immédiatement.
|
|
@@ -307,6 +426,9 @@ var Wulf = (() => {
|
|
|
307
426
|
* Retire tous les raccourcis correspondant à une combinaison et éventuellement un scope.
|
|
308
427
|
*/
|
|
309
428
|
unbind(combo, scope) {
|
|
429
|
+
if (typeof combo !== "string" || !combo.trim()) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
310
432
|
const formatted = ShortcutFormatter.format(combo);
|
|
311
433
|
for (const [id, s] of this.shortcuts.entries()) {
|
|
312
434
|
if (s.formattedCombo === formatted || s.combo.trim().toLowerCase() === combo.trim().toLowerCase()) {
|
|
@@ -322,6 +444,9 @@ var Wulf = (() => {
|
|
|
322
444
|
*/
|
|
323
445
|
pushScope(scope) {
|
|
324
446
|
if (scope && typeof scope === "string") {
|
|
447
|
+
if (this.scopeStack.length >= 64) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
325
450
|
this.scopeStack.push(scope);
|
|
326
451
|
this.clearSequenceBuffer();
|
|
327
452
|
}
|
|
@@ -402,7 +527,11 @@ var Wulf = (() => {
|
|
|
402
527
|
attachAria(element, combo) {
|
|
403
528
|
if (element && typeof element.setAttribute === "function") {
|
|
404
529
|
const ariaValue = ShortcutFormatter.toAriaKeyShortcuts(combo);
|
|
405
|
-
|
|
530
|
+
if (ariaValue) {
|
|
531
|
+
element.setAttribute("aria-keyshortcuts", ariaValue);
|
|
532
|
+
} else if (typeof element.removeAttribute === "function") {
|
|
533
|
+
element.removeAttribute("aria-keyshortcuts");
|
|
534
|
+
}
|
|
406
535
|
}
|
|
407
536
|
}
|
|
408
537
|
/**
|
|
@@ -426,23 +555,30 @@ var Wulf = (() => {
|
|
|
426
555
|
if (typeof window === "undefined" || !this.options.target) {
|
|
427
556
|
return;
|
|
428
557
|
}
|
|
558
|
+
this.abortController = new AbortController();
|
|
429
559
|
this.boundListener = (event) => this.handleKeyDown(event);
|
|
430
560
|
const target = this.options.target;
|
|
431
561
|
if (typeof target.addEventListener === "function") {
|
|
432
|
-
target.addEventListener("keydown", this.boundListener,
|
|
562
|
+
target.addEventListener("keydown", this.boundListener, {
|
|
563
|
+
capture: false,
|
|
564
|
+
signal: this.abortController.signal
|
|
565
|
+
});
|
|
433
566
|
}
|
|
434
567
|
}
|
|
435
568
|
removeListener() {
|
|
436
|
-
if (this.
|
|
569
|
+
if (this.abortController) {
|
|
570
|
+
this.abortController.abort();
|
|
571
|
+
this.abortController = null;
|
|
572
|
+
} else if (this.boundListener && this.options.target) {
|
|
437
573
|
const target = this.options.target;
|
|
438
574
|
if (typeof target.removeEventListener === "function") {
|
|
439
575
|
target.removeEventListener("keydown", this.boundListener, false);
|
|
440
576
|
}
|
|
441
|
-
this.boundListener = null;
|
|
442
577
|
}
|
|
578
|
+
this.boundListener = null;
|
|
443
579
|
}
|
|
444
580
|
handleKeyDown(event) {
|
|
445
|
-
if (!this.isListening) {
|
|
581
|
+
if (!this.isListening || isImeComposing(event)) {
|
|
446
582
|
return;
|
|
447
583
|
}
|
|
448
584
|
const k = (event.key || "").toLowerCase();
|
|
@@ -450,7 +586,10 @@ var Wulf = (() => {
|
|
|
450
586
|
return;
|
|
451
587
|
}
|
|
452
588
|
const currentScope = this.getScope();
|
|
453
|
-
const
|
|
589
|
+
const composed = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
590
|
+
const actualTarget = composed.length > 0 ? composed[0] : event.target;
|
|
591
|
+
const isEditable = _ShortcutManager.isEditable(actualTarget) || _ShortcutManager.isEditable(event.target);
|
|
592
|
+
const isPasswordInput = _ShortcutManager.isPasswordField(actualTarget) || _ShortcutManager.isPasswordField(event.target);
|
|
454
593
|
const currentStep = {
|
|
455
594
|
ctrl: event.ctrlKey,
|
|
456
595
|
alt: event.altKey,
|
|
@@ -458,14 +597,14 @@ var Wulf = (() => {
|
|
|
458
597
|
meta: event.metaKey,
|
|
459
598
|
key: ShortcutFormatter.normalizeKeyName(event.key || "")
|
|
460
599
|
};
|
|
461
|
-
const now = Date.now();
|
|
600
|
+
const now = event.timeStamp > 0 ? event.timeStamp : typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
462
601
|
if (this.sequenceBuffer.length > 0) {
|
|
463
602
|
const last = this.sequenceBuffer[this.sequenceBuffer.length - 1];
|
|
464
603
|
if (now - last.timestamp > this.options.sequenceTimeout) {
|
|
465
604
|
this.clearSequenceBuffer();
|
|
466
605
|
}
|
|
467
606
|
}
|
|
468
|
-
const activeCandidates = this.getActiveShortcuts(currentScope, isEditable);
|
|
607
|
+
const activeCandidates = this.getActiveShortcuts(currentScope, isEditable, isPasswordInput);
|
|
469
608
|
const proposedSequence = [...this.sequenceBuffer.map((b) => b.step), currentStep];
|
|
470
609
|
const matchingSequence = this.findMatchingSequence(activeCandidates, proposedSequence);
|
|
471
610
|
if (matchingSequence) {
|
|
@@ -487,7 +626,7 @@ var Wulf = (() => {
|
|
|
487
626
|
this.executeShortcut(matchingChord, event, currentScope, false);
|
|
488
627
|
}
|
|
489
628
|
}
|
|
490
|
-
getActiveShortcuts(currentScope, isEditable) {
|
|
629
|
+
getActiveShortcuts(currentScope, isEditable, isPasswordInput = false) {
|
|
491
630
|
const list = [];
|
|
492
631
|
for (const shortcut of this.shortcuts.values()) {
|
|
493
632
|
if (shortcut.scope !== currentScope && shortcut.scope !== "*") {
|
|
@@ -496,6 +635,19 @@ var Wulf = (() => {
|
|
|
496
635
|
if (isEditable && !shortcut.allowInEditable) {
|
|
497
636
|
continue;
|
|
498
637
|
}
|
|
638
|
+
if (isPasswordInput) {
|
|
639
|
+
if (shortcut.isSequence) {
|
|
640
|
+
continue;
|
|
641
|
+
}
|
|
642
|
+
const firstStep = shortcut.normalizedSteps[0];
|
|
643
|
+
if (firstStep && firstStep.key.length === 1) {
|
|
644
|
+
const isUntouchedChar = !firstStep.ctrl && !firstStep.alt && !firstStep.meta;
|
|
645
|
+
const isAltGrOrOptionChar = firstStep.ctrl && firstStep.alt && !firstStep.meta || firstStep.alt && !firstStep.ctrl && !firstStep.meta;
|
|
646
|
+
if (isUntouchedChar || isAltGrOrOptionChar) {
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
499
651
|
list.push(shortcut);
|
|
500
652
|
}
|
|
501
653
|
return list.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
@@ -504,13 +656,15 @@ var Wulf = (() => {
|
|
|
504
656
|
if (step.ctrl !== eventStep.ctrl) return false;
|
|
505
657
|
if (step.alt !== eventStep.alt) return false;
|
|
506
658
|
if (step.meta !== eventStep.meta) return false;
|
|
507
|
-
const
|
|
659
|
+
const rawKey = typeof rawEvent?.key === "string" ? rawEvent.key : "";
|
|
660
|
+
const keyMatches = step.key === eventStep.key || rawKey !== "" && step.key === rawKey.toLowerCase();
|
|
508
661
|
if (!keyMatches) return false;
|
|
509
662
|
if (step.shift === eventStep.shift) {
|
|
510
663
|
return true;
|
|
511
664
|
}
|
|
512
665
|
if (!step.shift && eventStep.shift) {
|
|
513
|
-
|
|
666
|
+
const isNonAlphaSymbol = step.key.length === 1 && !/^[a-z]$/i.test(step.key);
|
|
667
|
+
if (rawKey !== "" && rawKey === step.key || isNonAlphaSymbol && eventStep.key === step.key) {
|
|
514
668
|
return true;
|
|
515
669
|
}
|
|
516
670
|
}
|
|
@@ -604,7 +758,16 @@ var Wulf = (() => {
|
|
|
604
758
|
}
|
|
605
759
|
}
|
|
606
760
|
};
|
|
761
|
+
|
|
762
|
+
// src/shortcut/index.ts
|
|
763
|
+
var wulfNamespace = getSafeWulfNamespace();
|
|
764
|
+
if (wulfNamespace) {
|
|
765
|
+
wulfNamespace.Shortcut = Object.assign(ShortcutManager, {
|
|
766
|
+
ShortcutManager,
|
|
767
|
+
ShortcutFormatter
|
|
768
|
+
});
|
|
769
|
+
}
|
|
607
770
|
return __toCommonJS(index_exports);
|
|
608
771
|
})();
|
|
609
|
-
if (typeof window !== "undefined") {
|
|
772
|
+
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; } if (typeof __WulfIIFE !== "undefined" && __WulfIIFE) { for (var k in __WulfIIFE) { if (Object.hasOwn(__WulfIIFE, k) && k !== "__proto__" && k !== "constructor" && k !== "prototype" && __w[k] === undefined) { try { Object.defineProperty(__w, k, { value: __WulfIIFE[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { __w[k] = __WulfIIFE[k]; } catch (__) {} } } } } }
|
|
610
773
|
//# sourceMappingURL=shortcut.global.js.map
|