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.
Files changed (150) hide show
  1. package/README.md +217 -11
  2. package/changelog.md +60 -0
  3. package/dist/anchor.esm.js +9 -0
  4. package/dist/anchor.esm.js.map +7 -0
  5. package/dist/anchor.global.js +695 -0
  6. package/dist/anchor.global.js.map +7 -0
  7. package/dist/anchor.global.min.js +6 -0
  8. package/dist/anchor.global.min.js.map +7 -0
  9. package/dist/autosize.css +1 -0
  10. package/dist/autosize.css.map +7 -0
  11. package/dist/autosize.esm.js +10 -0
  12. package/dist/autosize.esm.js.map +7 -0
  13. package/dist/autosize.global.js +657 -0
  14. package/dist/autosize.global.js.map +7 -0
  15. package/dist/autosize.global.min.js +6 -0
  16. package/dist/autosize.global.min.js.map +7 -0
  17. package/dist/autosize.layered.css +1 -0
  18. package/dist/autosize.layered.css.map +7 -0
  19. package/dist/chunks/chunk-22AIMRD5.js +119 -0
  20. package/dist/chunks/chunk-22AIMRD5.js.map +7 -0
  21. package/dist/chunks/chunk-5N2IRGDM.js +766 -0
  22. package/dist/chunks/chunk-5N2IRGDM.js.map +7 -0
  23. package/dist/chunks/chunk-72FVCNNZ.js +863 -0
  24. package/dist/chunks/chunk-72FVCNNZ.js.map +7 -0
  25. package/dist/chunks/chunk-AXZYYW7H.js +865 -0
  26. package/dist/chunks/chunk-AXZYYW7H.js.map +7 -0
  27. package/dist/chunks/chunk-CM3SBIVQ.js +1116 -0
  28. package/dist/chunks/chunk-CM3SBIVQ.js.map +7 -0
  29. package/dist/chunks/chunk-H4GRLGQ3.js +578 -0
  30. package/dist/chunks/chunk-H4GRLGQ3.js.map +7 -0
  31. package/dist/chunks/chunk-ITRU2RFV.js +1195 -0
  32. package/dist/chunks/chunk-ITRU2RFV.js.map +7 -0
  33. package/dist/chunks/chunk-NLUQZEL4.js +1029 -0
  34. package/dist/chunks/chunk-NLUQZEL4.js.map +7 -0
  35. package/dist/chunks/chunk-QV46A7FV.js +197 -0
  36. package/dist/chunks/chunk-QV46A7FV.js.map +7 -0
  37. package/dist/chunks/chunk-SXLUXN6W.js +612 -0
  38. package/dist/chunks/chunk-SXLUXN6W.js.map +7 -0
  39. package/dist/chunks/chunk-T2H4EJCW.js +621 -0
  40. package/dist/chunks/chunk-T2H4EJCW.js.map +7 -0
  41. package/dist/chunks/chunk-TILLYEF2.js +6044 -0
  42. package/dist/chunks/chunk-TILLYEF2.js.map +7 -0
  43. package/dist/chunks/chunk-VJO22BAT.js +72 -0
  44. package/dist/chunks/chunk-VJO22BAT.js.map +7 -0
  45. package/dist/chunks/chunk-ZGUU6DMM.js +77 -0
  46. package/dist/chunks/chunk-ZGUU6DMM.js.map +7 -0
  47. package/dist/focus-trap.esm.js +6 -536
  48. package/dist/focus-trap.esm.js.map +3 -3
  49. package/dist/focus-trap.global.js +260 -87
  50. package/dist/focus-trap.global.js.map +3 -3
  51. package/dist/focus-trap.global.min.js +4 -4
  52. package/dist/focus-trap.global.min.js.map +4 -4
  53. package/dist/index.esm.js +79 -10069
  54. package/dist/index.esm.js.map +4 -4
  55. package/dist/index.global.js +4192 -355
  56. package/dist/index.global.js.map +4 -4
  57. package/dist/index.global.min.js +6 -3
  58. package/dist/index.global.min.js.map +4 -4
  59. package/dist/mask.esm.js +16 -6094
  60. package/dist/mask.esm.js.map +4 -4
  61. package/dist/mask.global.js +44 -55
  62. package/dist/mask.global.js.map +3 -3
  63. package/dist/mask.global.min.js +3 -3
  64. package/dist/mask.global.min.js.map +4 -4
  65. package/dist/masonry.esm.js +15 -1067
  66. package/dist/masonry.esm.js.map +4 -4
  67. package/dist/masonry.global.js +229 -148
  68. package/dist/masonry.global.js.map +3 -3
  69. package/dist/masonry.global.min.js +4 -4
  70. package/dist/masonry.global.min.js.map +4 -4
  71. package/dist/scroll.css +1 -1
  72. package/dist/scroll.css.map +2 -2
  73. package/dist/scroll.esm.js +14 -1175
  74. package/dist/scroll.esm.js.map +3 -3
  75. package/dist/scroll.global.js +171 -88
  76. package/dist/scroll.global.js.map +3 -3
  77. package/dist/scroll.global.min.js +3 -3
  78. package/dist/scroll.global.min.js.map +4 -4
  79. package/dist/scroll.layered.css +1 -1
  80. package/dist/scroll.layered.css.map +2 -2
  81. package/dist/shortcut.esm.js +6 -741
  82. package/dist/shortcut.esm.js.map +4 -4
  83. package/dist/shortcut.global.js +225 -58
  84. package/dist/shortcut.global.js.map +3 -3
  85. package/dist/shortcut.global.min.js +8 -2
  86. package/dist/shortcut.global.min.js.map +4 -4
  87. package/dist/size-report.json +319 -0
  88. package/dist/sortable.css +1 -0
  89. package/dist/sortable.css.map +7 -0
  90. package/dist/sortable.esm.js +22 -0
  91. package/dist/sortable.esm.js.map +7 -0
  92. package/dist/sortable.global.js +1477 -0
  93. package/dist/sortable.global.js.map +7 -0
  94. package/dist/sortable.global.min.js +6 -0
  95. package/dist/sortable.global.min.js.map +7 -0
  96. package/dist/sortable.layered.css +1 -0
  97. package/dist/sortable.layered.css.map +7 -0
  98. package/dist/sri-manifest.json +64 -0
  99. package/dist/toast.css +1 -1
  100. package/dist/toast.css.map +2 -2
  101. package/dist/toast.esm.js +19 -1129
  102. package/dist/toast.esm.js.map +3 -3
  103. package/dist/toast.global.js +386 -104
  104. package/dist/toast.global.js.map +3 -3
  105. package/dist/toast.global.min.js +4 -4
  106. package/dist/toast.global.min.js.map +4 -4
  107. package/dist/toast.layered.css +1 -1
  108. package/dist/toast.layered.css.map +2 -2
  109. package/dist/types/anchor/Anchor.d.ts +41 -0
  110. package/dist/types/anchor/index.d.ts +3 -0
  111. package/dist/types/anchor/types.d.ts +115 -0
  112. package/dist/types/autosize/Autosize.d.ts +71 -0
  113. package/dist/types/autosize/index.d.ts +3 -0
  114. package/dist/types/autosize/types.d.ts +66 -0
  115. package/dist/types/common/AuditableComponent.d.ts +1 -1
  116. package/dist/types/common/dom.d.ts +5 -0
  117. package/dist/types/common/registry.d.ts +40 -0
  118. package/dist/types/focus-trap/FocusTrap.d.ts +8 -3
  119. package/dist/types/index.d.ts +13 -1
  120. package/dist/types/mask/paste.d.ts +2 -5
  121. package/dist/types/masonry/Masonry.d.ts +2 -0
  122. package/dist/types/scroll/ScrollBlock.d.ts +2 -0
  123. package/dist/types/scroll/types.d.ts +6 -0
  124. package/dist/types/shortcut/ShortcutManager.d.ts +16 -3
  125. package/dist/types/shortcut/types.d.ts +5 -0
  126. package/dist/types/sortable/Sortable.d.ts +75 -0
  127. package/dist/types/sortable/i18n/en.d.ts +2 -0
  128. package/dist/types/sortable/i18n/fr.d.ts +2 -0
  129. package/dist/types/sortable/i18n/index.d.ts +9 -0
  130. package/dist/types/sortable/i18n/types.d.ts +15 -0
  131. package/dist/types/sortable/index.d.ts +4 -0
  132. package/dist/types/sortable/types.d.ts +112 -0
  133. package/dist/types/toast/Toast.d.ts +6 -1
  134. package/dist/types/toast/ToastInstance.d.ts +7 -0
  135. package/dist/types/toast/ToastManager.d.ts +4 -2
  136. package/dist/types/toast/types.d.ts +27 -1
  137. package/dist/types/undo/UndoManager.d.ts +112 -0
  138. package/dist/types/undo/i18n/en.d.ts +2 -0
  139. package/dist/types/undo/i18n/fr.d.ts +2 -0
  140. package/dist/types/undo/i18n/index.d.ts +9 -0
  141. package/dist/types/undo/i18n/types.d.ts +6 -0
  142. package/dist/types/undo/index.d.ts +5 -0
  143. package/dist/types/undo/types.d.ts +106 -0
  144. package/dist/undo.esm.js +23 -0
  145. package/dist/undo.esm.js.map +7 -0
  146. package/dist/undo.global.js +1029 -0
  147. package/dist/undo.global.js.map +7 -0
  148. package/dist/undo.global.min.js +6 -0
  149. package/dist/undo.global.min.js.map +7 -0
  150. package/package.json +54 -5
@@ -1,539 +1,9 @@
1
- // src/common/dom.ts
2
- function getSafeWulfNamespace() {
3
- if (typeof window === "undefined") return null;
4
- const win = window;
5
- const existing = win.Wulf;
6
- if (!existing || typeof existing !== "object" || typeof Node !== "undefined" && existing instanceof Node || typeof HTMLCollection !== "undefined" && existing instanceof HTMLCollection) {
7
- const fresh = {};
8
- win.Wulf = fresh;
9
- return fresh;
10
- }
11
- return existing;
12
- }
13
- function safeCssEscape(value) {
14
- if (typeof CSS !== "undefined" && typeof CSS.escape === "function") {
15
- return CSS.escape(value);
16
- }
17
- return String(value).replace(/["\\\u0000-\u001F\u007F]/g, "\\$&");
18
- }
19
- function getDeepActiveElement(root) {
20
- if (typeof document === "undefined") return null;
21
- let active = (root ?? document).activeElement;
22
- while (active && active.shadowRoot && active.shadowRoot.activeElement) {
23
- active = active.shadowRoot.activeElement;
24
- }
25
- return active && typeof active.focus === "function" ? active : null;
26
- }
27
- function isImeComposing(event) {
28
- return Boolean(
29
- event.isComposing || event.key === "Process" || event.key === "Enter" && event.keyCode === 229
30
- );
31
- }
32
-
33
- // src/common/AuditableComponent.ts
34
- var AuditableComponent = class {
35
- /**
36
- * Indication affichée en pied de warning pour expliquer comment désactiver l'audit.
37
- */
38
- getAuditDisableHint() {
39
- return "Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement";
40
- }
41
- /**
42
- * Exécute l'audit d'accessibilité et émet un avertissement standardisé dans la console
43
- * si l'audit est activé et que des contraintes manquent.
44
- */
45
- runAuditWarning(enabled = true) {
46
- if (!enabled) return [];
47
- const warnings = this.audit();
48
- if (warnings.length > 0 && typeof console !== "undefined" && typeof console.warn === "function") {
49
- console.warn(
50
- `[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${warnings.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
51
- ` + warnings.map((w) => ` - ${w}`).join("\n") + `
52
- (${this.getAuditDisableHint()})`
53
- );
54
- }
55
- return warnings;
56
- }
57
- /**
58
- * Vérifie si un attribut de référence d'IDs ARIA (ex: aria-labelledby, aria-describedby, aria-errormessage)
59
- * pointe vers des éléments réellement présents dans le document (et optionnellement non vides).
60
- */
61
- checkAriaIdReferences(element, attrName, warnings, requireNonEmptyText = false) {
62
- const rawValue = element.getAttribute(attrName)?.trim();
63
- if (!rawValue) return false;
64
- const doc = element.ownerDocument || document;
65
- const root = typeof element.getRootNode === "function" ? element.getRootNode() : doc;
66
- const ids = rawValue.split(/\s+/).filter(Boolean);
67
- const targets = ids.map(
68
- (id) => typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot ? root.getElementById(id) : doc.getElementById(id)
69
- );
70
- const allFound = ids.length > 0 && targets.every((el) => Boolean(el));
71
- if (!allFound) {
72
- warnings.push(
73
- `Attribut ${attrName}="${rawValue}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`
74
- );
75
- return false;
76
- }
77
- if (requireNonEmptyText) {
78
- const hasNonEmptyText = targets.some((el) => {
79
- if (!el) return false;
80
- const text = el.textContent?.trim() || el.getAttribute("aria-label")?.trim() || "";
81
- return text.length > 0;
82
- });
83
- if (!hasNonEmptyText) {
84
- warnings.push(
85
- `Attribut ${attrName}="${rawValue}" invalide : l'\xE9l\xE9ment cible ne contient aucun texte accessible.`
86
- );
87
- return false;
88
- }
89
- }
90
- return true;
91
- }
92
- };
93
-
94
- // src/focus-trap/FocusTrap.ts
95
- var FOCUSABLE_SELECTOR = [
96
- "a[href]",
97
- "area[href]",
98
- 'input:not([disabled]):not([type="hidden"])',
99
- "select:not([disabled])",
100
- "textarea:not([disabled])",
101
- "button:not([disabled])",
102
- "audio[controls]",
103
- "video[controls]",
104
- "details > summary:first-of-type",
105
- "iframe",
106
- "object",
107
- "embed",
108
- '[contenteditable]:not([contenteditable="false"])',
109
- '[tabindex]:not([tabindex="-1"])'
110
- ].join(",");
111
- function safeQuerySelector(root, selector) {
112
- if (!selector || typeof selector !== "string") return null;
113
- try {
114
- return root.querySelector(selector);
115
- } catch {
116
- return null;
117
- }
118
- }
119
- var trapStack = [];
120
- var FocusTrap = class extends AuditableComponent {
121
- element;
122
- options;
123
- active = false;
124
- paused = false;
125
- previousActiveElement = null;
126
- inertSiblings = [];
127
- addedContainerTabIndex = false;
128
- lastOutsidePointerDownTime = 0;
129
- abortController;
130
- // Handlers liés
131
- handleKeyDownBound;
132
- handleClickOutsideBound;
133
- handleFocusInBound;
134
- constructor(target, options = {}) {
135
- super();
136
- const el = typeof target === "string" ? safeQuerySelector(document, target) : target;
137
- if (!el || !(el instanceof HTMLElement)) {
138
- throw new Error(`[Wulf.FocusTrap] Conteneur introuvable ou invalide : "${target}"`);
139
- }
140
- this.element = el;
141
- const allowOutsideClick = options.allowOutsideClick ?? false;
142
- this.options = {
143
- initialFocus: options.initialFocus !== void 0 ? options.initialFocus : "[data-autofocus], [autofocus]",
144
- returnFocus: options.returnFocus ?? true,
145
- fallbackReturnFocus: options.fallbackReturnFocus ?? "",
146
- escapeDeactivates: options.escapeDeactivates ?? true,
147
- allowOutsideClick,
148
- setInert: options.setInert ?? !allowOutsideClick,
149
- onActivate: options.onActivate ?? (() => {
150
- }),
151
- onDeactivate: options.onDeactivate ?? (() => {
152
- }),
153
- audit: options.audit ?? true
154
- };
155
- this.handleKeyDownBound = this.handleKeyDown.bind(this);
156
- this.handleClickOutsideBound = this.handleClickOutside.bind(this);
157
- this.handleFocusInBound = this.handleFocusIn.bind(this);
158
- this.runAuditWarning(this.options.audit);
159
- }
160
- isNativeDialogElement() {
161
- return this.element.tagName.toLowerCase() === "dialog";
162
- }
163
- isNativeModalDialog() {
164
- if (!this.isNativeDialogElement()) return false;
165
- try {
166
- return this.element.matches(":modal");
167
- } catch {
168
- return false;
169
- }
170
- }
171
- isElementFocusableBase(el) {
172
- if (!el || !el.isConnected) return false;
173
- if (el.tabIndex < 0) return false;
174
- if (el.disabled) return false;
175
- try {
176
- if (el.matches(":disabled")) return false;
177
- } catch {
178
- if (el.closest("fieldset[disabled]")) return false;
179
- }
180
- if (el.hasAttribute("inert") || el.closest("[inert]")) return false;
181
- if (el.hidden || el.closest("[hidden]")) return false;
182
- const elWithCheck = el;
183
- if (typeof elWithCheck.checkVisibility === "function") {
184
- if (!elWithCheck.checkVisibility({
185
- checkOpacity: false,
186
- checkVisibilityCSS: true,
187
- visibilityProperty: true
188
- })) {
189
- return false;
190
- }
191
- } else {
192
- if (el.style.display === "none" || el.style.visibility === "hidden") return false;
193
- const style = window.getComputedStyle(el);
194
- if (style.display === "none" || style.visibility === "hidden") return false;
195
- if (el.offsetWidth === 0 && el.offsetHeight === 0 && style.position !== "fixed") {
196
- return false;
197
- }
198
- }
199
- return true;
200
- }
201
- /**
202
- * Vérifie si un élément est réellement focusable, visible et actif dans le DOM.
203
- */
204
- isFocusable(el) {
205
- if (!this.isElementFocusableBase(el)) return false;
206
- if (el instanceof HTMLInputElement && el.type === "radio" && el.name) {
207
- const group = Array.from(
208
- this.element.querySelectorAll(`input[type="radio"][name="${safeCssEscape(el.name)}"]`)
209
- ).filter((r) => r.form === el.form && this.isElementFocusableBase(r));
210
- if (group.length === 0) return false;
211
- const checked = group.find((r) => r.checked);
212
- if (checked) {
213
- return el === checked;
214
- }
215
- return el === group[0];
216
- }
217
- return true;
218
- }
219
- /**
220
- * Retourne tous les éléments focusables réels ordonnés dans le conteneur.
221
- */
222
- getFocusableElements() {
223
- const rawElements = Array.from(this.element.querySelectorAll(FOCUSABLE_SELECTOR));
224
- return rawElements.filter((el) => this.isFocusable(el));
225
- }
226
- /**
227
- * Active le trap.
228
- */
229
- activate() {
230
- if (this.active) return this;
231
- const currentTop = trapStack[trapStack.length - 1];
232
- if (currentTop) {
233
- currentTop.pause();
234
- }
235
- this.active = true;
236
- this.paused = false;
237
- trapStack.push(this);
238
- const deepActive = getDeepActiveElement(document);
239
- this.previousActiveElement = deepActive instanceof HTMLElement ? deepActive : document.activeElement;
240
- if (this.options.setInert && !this.isNativeModalDialog()) {
241
- this.applyInert();
242
- }
243
- this.abortController?.abort();
244
- this.abortController = new AbortController();
245
- const { signal } = this.abortController;
246
- document.addEventListener("keydown", this.handleKeyDownBound, { capture: true, signal });
247
- document.addEventListener("focusin", this.handleFocusInBound, { capture: true, signal });
248
- document.addEventListener("pointerdown", this.handleClickOutsideBound, { capture: true, signal });
249
- if (!this.options.allowOutsideClick) {
250
- document.addEventListener("mousedown", this.handleClickOutsideBound, { capture: true, signal });
251
- document.addEventListener("touchstart", this.handleClickOutsideBound, { capture: true, signal });
252
- document.addEventListener("click", this.handleClickOutsideBound, { capture: true, signal });
253
- }
254
- this.applyInitialFocus();
255
- this.runAuditWarning(this.options.audit);
256
- this.options.onActivate();
257
- return this;
258
- }
259
- /**
260
- * Désactive le trap et libère les écouteurs.
261
- */
262
- deactivate() {
263
- if (!this.active) return this;
264
- this.active = false;
265
- this.paused = false;
266
- const index = trapStack.indexOf(this);
267
- if (index !== -1) {
268
- trapStack.splice(index, 1);
269
- }
270
- this.abortController?.abort();
271
- this.abortController = void 0;
272
- this.removeInert();
273
- if (this.addedContainerTabIndex) {
274
- this.element.removeAttribute("tabindex");
275
- this.addedContainerTabIndex = false;
276
- }
277
- const nextTop = trapStack[trapStack.length - 1];
278
- if (nextTop) {
279
- nextTop.unpause();
280
- }
281
- if (this.options.returnFocus) {
282
- this.restoreFocus();
283
- }
284
- this.previousActiveElement = null;
285
- this.options.onDeactivate();
286
- return this;
287
- }
288
- /**
289
- * Met en pause le trap (utilisé quand un trap fils s'ouvre au-dessus).
290
- * Retire temporairement `inert` pour ne pas bloquer une modale sœur ou enfant.
291
- */
292
- pause() {
293
- this.paused = true;
294
- this.removeInert();
295
- }
296
- /**
297
- * Sort de pause et réapplique l'isolation `inert` si active et si ce trap est bien au sommet de la pile.
298
- */
299
- unpause() {
300
- if (!this.active) return;
301
- if (trapStack[trapStack.length - 1] !== this) return;
302
- this.paused = false;
303
- if (this.options.setInert && !this.isNativeModalDialog()) {
304
- this.applyInert();
305
- }
306
- }
307
- /**
308
- * Indique si le trap est actuellement actif et non en pause.
309
- */
310
- isActive() {
311
- return this.active && !this.paused;
312
- }
313
- /**
314
- * Vérifie la conformité d'accessibilité WAI-ARIA du conteneur FocusTrap
315
- * et retourne la liste des contraintes manquantes.
316
- */
317
- audit() {
318
- const warnings = [];
319
- const role = this.element.getAttribute("role");
320
- const isNativeDialog = this.isNativeDialogElement();
321
- const validRoles = ["dialog", "alertdialog", "menu", "listbox", "tree", "grid"];
322
- if (isNativeDialog) {
323
- if (role === "dialog") {
324
- warnings.push(
325
- 'Attribut redondant : role="dialog" est d\xE9j\xE0 implicite sur une balise native <dialog>.'
326
- );
327
- }
328
- if (this.element.hasAttribute("aria-modal")) {
329
- warnings.push(
330
- 'Attribut redondant : <dialog> ouvert via showModal() g\xE8re nativement la modalit\xE9 sans n\xE9cessiter aria-modal="true".'
331
- );
332
- }
333
- if (this.element.hasAttribute("open") && !this.isNativeModalDialog()) {
334
- warnings.push(
335
- "Dialogue non modal d\xE9tect\xE9 : pr\xE9f\xE9rez dialog.showModal() plut\xF4t que l'attribut open pour obtenir la Top Layer et l'inertie natives."
336
- );
337
- }
338
- } else {
339
- if (!role || !validRoles.includes(role)) {
340
- warnings.push(
341
- 'R\xF4le s\xE9mantique manquant ou inadapt\xE9 : d\xE9finissez role="dialog" (ou "alertdialog", "menu", "listbox") sur le conteneur.'
342
- );
343
- }
344
- if ((role === "dialog" || role === "alertdialog") && this.element.getAttribute("aria-modal") !== "true") {
345
- warnings.push(
346
- 'Isolation modale manquante : d\xE9finissez aria-modal="true" sur le conteneur de dialogue (WCAG 4.1.2).'
347
- );
348
- }
349
- }
350
- const ariaLabel = this.element.getAttribute("aria-label")?.trim();
351
- const hasValidLabelledby = this.checkAriaIdReferences(this.element, "aria-labelledby", warnings);
352
- if (!ariaLabel && !hasValidLabelledby) {
353
- warnings.push(
354
- 'Nom accessible manquant : d\xE9finissez aria-labelledby="id-titre" ou aria-label="..." sur le conteneur (WCAG 4.1.2).'
355
- );
356
- }
357
- return warnings;
358
- }
359
- getAuditPrefix() {
360
- return "Wulf.FocusTrap";
361
- }
362
- getAuditTargetLabel() {
363
- return this.element.id ? `#${this.element.id}` : `<${this.element.tagName.toLowerCase()}>`;
364
- }
365
- /**
366
- * Détruit l'instance proprement.
367
- */
368
- destroy() {
369
- this.deactivate();
370
- }
371
- // --- Implémentation interne ---
372
- isEventInside(e, target) {
373
- if (target && this.element.contains(target)) {
374
- return true;
375
- }
376
- if (typeof e.composedPath === "function") {
377
- const path = e.composedPath();
378
- if (path.includes(this.element)) {
379
- return true;
380
- }
381
- }
382
- return false;
383
- }
384
- isInsideToastContainer(target) {
385
- if (!target || !(target instanceof Element)) return false;
386
- return Boolean(target.closest(".wulf-toast-container"));
387
- }
388
- ensureContainerTabIndex() {
389
- if (this.element.getAttribute("tabindex") === null) {
390
- this.element.setAttribute("tabindex", "-1");
391
- this.addedContainerTabIndex = true;
392
- }
393
- }
394
- handleKeyDown(e) {
395
- if (!this.isActive()) return;
396
- if (this.element.isConnected === false) {
397
- this.deactivate();
398
- return;
399
- }
400
- if (e.key === "Escape" && this.options.escapeDeactivates) {
401
- if (isImeComposing(e)) return;
402
- if (!this.isNativeModalDialog()) {
403
- e.preventDefault();
404
- e.stopPropagation();
405
- }
406
- this.deactivate();
407
- return;
408
- }
409
- if (e.key !== "Tab") return;
410
- const focusables = this.getFocusableElements();
411
- if (focusables.length === 0) {
412
- e.preventDefault();
413
- this.ensureContainerTabIndex();
414
- this.element.focus();
415
- return;
416
- }
417
- const first = focusables[0];
418
- const last = focusables[focusables.length - 1];
419
- const deepCurrent = getDeepActiveElement(document);
420
- const current = deepCurrent instanceof HTMLElement ? deepCurrent : document.activeElement;
421
- const isInside = current ? this.element.contains(current) || this.isEventInside(e, current) : false;
422
- if (!e.shiftKey && (current === last || !isInside)) {
423
- e.preventDefault();
424
- first.focus();
425
- } else if (e.shiftKey && (current === first || current === this.element || !isInside)) {
426
- e.preventDefault();
427
- last.focus();
428
- }
429
- }
430
- handleFocusIn(e) {
431
- if (!this.isActive()) return;
432
- if (this.element.isConnected === false) {
433
- this.deactivate();
434
- return;
435
- }
436
- const target = e.target;
437
- if (!target) return;
438
- if (this.isInsideToastContainer(target)) {
439
- return;
440
- }
441
- if (this.options.allowOutsideClick && performance.now() - this.lastOutsidePointerDownTime < 150) {
442
- return;
443
- }
444
- if (!this.isEventInside(e, target)) {
445
- const focusables = this.getFocusableElements();
446
- if (focusables.length > 0) {
447
- focusables[0].focus();
448
- } else {
449
- this.ensureContainerTabIndex();
450
- this.element.focus();
451
- }
452
- }
453
- }
454
- handleClickOutside(e) {
455
- if (!this.isActive()) return;
456
- if (this.element.isConnected === false) {
457
- this.deactivate();
458
- return;
459
- }
460
- const target = e.target;
461
- if (target && !this.isEventInside(e, target)) {
462
- if (this.isInsideToastContainer(target)) {
463
- return;
464
- }
465
- if (this.options.allowOutsideClick) {
466
- this.lastOutsidePointerDownTime = performance.now();
467
- return;
468
- }
469
- e.preventDefault();
470
- e.stopPropagation();
471
- }
472
- }
473
- /**
474
- * Applique `inert` sur les éléments frères à chaque niveau hiérarchique jusqu'à <body>,
475
- * en préservant les conteneurs de notifications Toast en Top Layer.
476
- */
477
- applyInert() {
478
- this.removeInert();
479
- let current = this.element;
480
- const ignoredTags = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "TEMPLATE", "LINK", "META", "NOSCRIPT"]);
481
- while (current && current !== document.body && current.parentElement) {
482
- const parent = current.parentElement;
483
- for (const sibling of Array.from(parent.children)) {
484
- if (sibling instanceof HTMLElement && sibling !== current && !ignoredTags.has(sibling.tagName) && !sibling.hasAttribute("inert") && !sibling.matches(".wulf-toast-container, .wulf-toast-announcer")) {
485
- sibling.setAttribute("inert", "");
486
- this.inertSiblings.push(sibling);
487
- }
488
- }
489
- current = parent;
490
- }
491
- }
492
- removeInert() {
493
- this.inertSiblings.forEach((el) => el.removeAttribute("inert"));
494
- this.inertSiblings = [];
495
- }
496
- applyInitialFocus() {
497
- if (this.options.initialFocus === false) return;
498
- let targetEl = null;
499
- if (typeof this.options.initialFocus === "string") {
500
- targetEl = safeQuerySelector(this.element, this.options.initialFocus);
501
- } else if (this.options.initialFocus instanceof HTMLElement) {
502
- targetEl = this.options.initialFocus;
503
- }
504
- if (targetEl && this.isFocusable(targetEl)) {
505
- targetEl.focus();
506
- return;
507
- }
508
- const focusables = this.getFocusableElements();
509
- if (focusables.length > 0) {
510
- focusables[0].focus();
511
- } else {
512
- this.ensureContainerTabIndex();
513
- this.element.focus();
514
- }
515
- }
516
- restoreFocus() {
517
- if (this.previousActiveElement && this.previousActiveElement.isConnected && this.isElementFocusableBase(this.previousActiveElement)) {
518
- this.previousActiveElement.focus();
519
- return;
520
- }
521
- if (this.options.fallbackReturnFocus) {
522
- const fallback = typeof this.options.fallbackReturnFocus === "string" ? safeQuerySelector(document, this.options.fallbackReturnFocus) : this.options.fallbackReturnFocus;
523
- if (fallback && fallback.isConnected && this.isElementFocusableBase(fallback)) {
524
- fallback.focus();
525
- }
526
- }
527
- }
528
- };
529
-
530
- // src/focus-trap/index.ts
531
- var wulfNamespace = getSafeWulfNamespace();
532
- if (wulfNamespace) {
533
- wulfNamespace.FocusTrap = Object.assign(FocusTrap, {
534
- FocusTrap
535
- });
536
- }
1
+ import {
2
+ FocusTrap
3
+ } from "./chunks/chunk-SXLUXN6W.js";
4
+ import "./chunks/chunk-ZGUU6DMM.js";
5
+ import "./chunks/chunk-22AIMRD5.js";
6
+ import "./chunks/chunk-VJO22BAT.js";
537
7
  export {
538
8
  FocusTrap,
539
9
  FocusTrap as default
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/common/dom.ts", "../src/common/AuditableComponent.ts", "../src/focus-trap/FocusTrap.ts", "../src/focus-trap/index.ts"],
4
- "sourcesContent": ["/**\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", "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',\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 { FocusTrapOptions, FocusTrapTarget } from './types';\nimport { AuditableComponent } from '../common/AuditableComponent';\nimport { isImeComposing, getDeepActiveElement, safeCssEscape } from '../common/dom';\n\n/**\n * S\u00E9lecteur standard WAI-ARIA pour les \u00E9l\u00E9ments potentiellement interactifs.\n */\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'area[href]',\n 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'audio[controls]',\n 'video[controls]',\n 'details > summary:first-of-type',\n 'iframe',\n 'object',\n 'embed',\n '[contenteditable]:not([contenteditable=\"false\"])',\n '[tabindex]:not([tabindex=\"-1\"])'\n].join(',');\n\nfunction safeQuerySelector<T extends Element = HTMLElement>(\n root: ParentNode,\n selector: string\n): T | null {\n if (!selector || typeof selector !== 'string') return null;\n try {\n return root.querySelector<T>(selector);\n } catch {\n return null;\n }\n}\n\n/**\n * Pile globale (LIFO) pour orchestrer les FocusTrap imbriqu\u00E9s.\n */\nconst trapStack: FocusTrap[] = [];\n\nexport class FocusTrap extends AuditableComponent {\n private element: HTMLElement;\n private options: Required<FocusTrapOptions>;\n private active = false;\n private paused = false;\n private previousActiveElement: HTMLElement | null = null;\n private inertSiblings: HTMLElement[] = [];\n private addedContainerTabIndex = false;\n private lastOutsidePointerDownTime = 0;\n private abortController?: AbortController;\n\n // Handlers li\u00E9s\n private handleKeyDownBound: (e: KeyboardEvent) => void;\n private handleClickOutsideBound: (e: MouseEvent | TouchEvent | PointerEvent) => void;\n private handleFocusInBound: (e: FocusEvent) => void;\n\n constructor(target: FocusTrapTarget, options: FocusTrapOptions = {}) {\n super();\n const el = typeof target === 'string' ? safeQuerySelector<HTMLElement>(document, target) : target;\n if (!el || !(el instanceof HTMLElement)) {\n throw new Error(`[Wulf.FocusTrap] Conteneur introuvable ou invalide : \"${target}\"`);\n }\n this.element = el;\n\n const allowOutsideClick = options.allowOutsideClick ?? false;\n this.options = {\n initialFocus: options.initialFocus !== undefined ? options.initialFocus : '[data-autofocus], [autofocus]',\n returnFocus: options.returnFocus ?? true,\n fallbackReturnFocus: options.fallbackReturnFocus ?? '',\n escapeDeactivates: options.escapeDeactivates ?? true,\n allowOutsideClick,\n setInert: options.setInert ?? !allowOutsideClick,\n onActivate: options.onActivate ?? (() => { }),\n onDeactivate: options.onDeactivate ?? (() => { }),\n audit: options.audit ?? true\n };\n\n this.handleKeyDownBound = this.handleKeyDown.bind(this);\n this.handleClickOutsideBound = this.handleClickOutside.bind(this);\n this.handleFocusInBound = this.handleFocusIn.bind(this);\n\n this.runAuditWarning(this.options.audit);\n }\n\n private isNativeDialogElement(): boolean {\n return this.element.tagName.toLowerCase() === 'dialog';\n }\n\n private isNativeModalDialog(): boolean {\n if (!this.isNativeDialogElement()) return false;\n try {\n return this.element.matches(':modal');\n } catch {\n return false;\n }\n }\n\n private isElementFocusableBase(el: HTMLElement): boolean {\n if (!el || !el.isConnected) return false;\n if (el.tabIndex < 0) return false;\n\n // \u00C9l\u00E9ments d\u00E9sactiv\u00E9s (inclut la r\u00E8gle native fieldset[disabled] > first legend)\n if ((el as HTMLElement & { disabled?: boolean }).disabled) return false;\n try {\n if (el.matches(':disabled')) return false;\n } catch {\n if (el.closest('fieldset[disabled]')) return false;\n }\n\n // Attribut inert ou hidden\n if (el.hasAttribute('inert') || el.closest('[inert]')) return false;\n if (el.hidden || el.closest('[hidden]')) return false;\n\n // Visibilit\u00E9 native moderne via checkVisibility() avec repli complet\n const elWithCheck = el as HTMLElement & {\n checkVisibility?: (options?: {\n checkOpacity?: boolean;\n checkVisibilityCSS?: boolean;\n visibilityProperty?: boolean;\n }) => boolean;\n };\n if (typeof elWithCheck.checkVisibility === 'function') {\n if (\n !elWithCheck.checkVisibility({\n checkOpacity: false,\n checkVisibilityCSS: true,\n visibilityProperty: true\n })\n ) {\n return false;\n }\n } else {\n if (el.style.display === 'none' || el.style.visibility === 'hidden') return false;\n const style = window.getComputedStyle(el);\n if (style.display === 'none' || style.visibility === 'hidden') return false;\n if (el.offsetWidth === 0 && el.offsetHeight === 0 && style.position !== 'fixed') {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * V\u00E9rifie si un \u00E9l\u00E9ment est r\u00E9ellement focusable, visible et actif dans le DOM.\n */\n public isFocusable(el: HTMLElement): boolean {\n if (!this.isElementFocusableBase(el)) return false;\n\n // Gestion rigoureuse des groupes radio (filtrage pr\u00E9alable des radios \u00E9ligibles du m\u00EAme formulaire)\n if (el instanceof HTMLInputElement && el.type === 'radio' && el.name) {\n const group = Array.from(\n this.element.querySelectorAll<HTMLInputElement>(`input[type=\"radio\"][name=\"${safeCssEscape(el.name)}\"]`)\n ).filter((r) => r.form === el.form && this.isElementFocusableBase(r));\n if (group.length === 0) return false;\n const checked = group.find((r) => r.checked);\n if (checked) {\n return el === checked;\n }\n return el === group[0];\n }\n\n return true;\n }\n\n /**\n * Retourne tous les \u00E9l\u00E9ments focusables r\u00E9els ordonn\u00E9s dans le conteneur.\n */\n public getFocusableElements(): HTMLElement[] {\n const rawElements = Array.from(this.element.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\n return rawElements.filter(el => this.isFocusable(el));\n }\n\n /**\n * Active le trap.\n */\n public activate(): this {\n if (this.active) return this;\n\n // Met en pause le trap pr\u00E9c\u00E9dent au sommet de la pile (lib\u00E8re son inertie pour \u00E9viter tout conflit)\n const currentTop = trapStack[trapStack.length - 1];\n if (currentTop) {\n currentTop.pause();\n }\n\n this.active = true;\n this.paused = false;\n trapStack.push(this);\n\n // M\u00E9morise l'\u00E9l\u00E9ment d\u00E9clencheur (y compris dans un Shadow DOM ouvert) pour le retour du focus\n const deepActive = getDeepActiveElement(document);\n this.previousActiveElement =\n deepActive instanceof HTMLElement ? deepActive : (document.activeElement as HTMLElement | null);\n\n // Applique 'inert' multi-niveaux si demand\u00E9 et hors <dialog> modal natif\n if (this.options.setInert && !this.isNativeModalDialog()) {\n this.applyInert();\n }\n\n // Attache les \u00E9couteurs d'\u00E9v\u00E9nements via AbortController\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n\n document.addEventListener('keydown', this.handleKeyDownBound, { capture: true, signal });\n document.addEventListener('focusin', this.handleFocusInBound, { capture: true, signal });\n document.addEventListener('pointerdown', this.handleClickOutsideBound, { capture: true, signal });\n if (!this.options.allowOutsideClick) {\n document.addEventListener('mousedown', this.handleClickOutsideBound, { capture: true, signal });\n document.addEventListener('touchstart', this.handleClickOutsideBound, { capture: true, signal });\n document.addEventListener('click', this.handleClickOutsideBound, { capture: true, signal });\n }\n\n // Positionne le focus initial\n this.applyInitialFocus();\n\n this.runAuditWarning(this.options.audit);\n\n this.options.onActivate();\n return this;\n }\n\n /**\n * D\u00E9sactive le trap et lib\u00E8re les \u00E9couteurs.\n */\n public deactivate(): this {\n if (!this.active) return this;\n\n this.active = false;\n this.paused = false;\n\n // Retire du gestionnaire de pile\n const index = trapStack.indexOf(this);\n if (index !== -1) {\n trapStack.splice(index, 1);\n }\n\n // D\u00E9tache tous les \u00E9couteurs globaux via AbortController\n this.abortController?.abort();\n this.abortController = undefined;\n\n // Restaure les \u00E9l\u00E9ments mis en 'inert' avant de r\u00E9veiller le trap parent ou restaurer le focus\n this.removeInert();\n\n if (this.addedContainerTabIndex) {\n this.element.removeAttribute('tabindex');\n this.addedContainerTabIndex = false;\n }\n\n // R\u00E9veille le trap pr\u00E9c\u00E9dent s'il existe\n const nextTop = trapStack[trapStack.length - 1];\n if (nextTop) {\n nextTop.unpause();\n }\n\n // Restaure le focus sur l'\u00E9l\u00E9ment d'origine\n if (this.options.returnFocus) {\n this.restoreFocus();\n }\n this.previousActiveElement = null;\n\n this.options.onDeactivate();\n return this;\n }\n\n /**\n * Met en pause le trap (utilis\u00E9 quand un trap fils s'ouvre au-dessus).\n * Retire temporairement `inert` pour ne pas bloquer une modale s\u0153ur ou enfant.\n */\n public pause(): void {\n this.paused = true;\n this.removeInert();\n }\n\n /**\n * Sort de pause et r\u00E9applique l'isolation `inert` si active et si ce trap est bien au sommet de la pile.\n */\n public unpause(): void {\n if (!this.active) return;\n if (trapStack[trapStack.length - 1] !== this) return;\n this.paused = false;\n if (this.options.setInert && !this.isNativeModalDialog()) {\n this.applyInert();\n }\n }\n\n /**\n * Indique si le trap est actuellement actif et non en pause.\n */\n public isActive(): boolean {\n return this.active && !this.paused;\n }\n\n /**\n * V\u00E9rifie la conformit\u00E9 d'accessibilit\u00E9 WAI-ARIA du conteneur FocusTrap\n * et retourne la liste des contraintes manquantes.\n */\n public override audit(): string[] {\n const warnings: string[] = [];\n const role = this.element.getAttribute('role');\n const isNativeDialog = this.isNativeDialogElement();\n const validRoles = ['dialog', 'alertdialog', 'menu', 'listbox', 'tree', 'grid'];\n\n if (isNativeDialog) {\n if (role === 'dialog') {\n warnings.push(\n 'Attribut redondant : role=\"dialog\" est d\u00E9j\u00E0 implicite sur une balise native <dialog>.'\n );\n }\n if (this.element.hasAttribute('aria-modal')) {\n warnings.push(\n 'Attribut redondant : <dialog> ouvert via showModal() g\u00E8re nativement la modalit\u00E9 sans n\u00E9cessiter aria-modal=\"true\".'\n );\n }\n if (this.element.hasAttribute('open') && !this.isNativeModalDialog()) {\n warnings.push(\n 'Dialogue non modal d\u00E9tect\u00E9 : pr\u00E9f\u00E9rez dialog.showModal() plut\u00F4t que l\\'attribut open pour obtenir la Top Layer et l\\'inertie natives.'\n );\n }\n } else {\n if (!role || !validRoles.includes(role)) {\n warnings.push(\n 'R\u00F4le s\u00E9mantique manquant ou inadapt\u00E9 : d\u00E9finissez role=\"dialog\" (ou \"alertdialog\", \"menu\", \"listbox\") sur le conteneur.'\n );\n }\n\n if ((role === 'dialog' || role === 'alertdialog') && this.element.getAttribute('aria-modal') !== 'true') {\n warnings.push(\n 'Isolation modale manquante : d\u00E9finissez aria-modal=\"true\" sur le conteneur de dialogue (WCAG 4.1.2).'\n );\n }\n }\n\n const ariaLabel = this.element.getAttribute('aria-label')?.trim();\n const hasValidLabelledby = this.checkAriaIdReferences(this.element, 'aria-labelledby', warnings);\n\n if (!ariaLabel && !hasValidLabelledby) {\n warnings.push(\n 'Nom accessible manquant : d\u00E9finissez aria-labelledby=\"id-titre\" ou aria-label=\"...\" sur le conteneur (WCAG 4.1.2).'\n );\n }\n\n return warnings;\n }\n\n protected override getAuditPrefix(): string {\n return 'Wulf.FocusTrap';\n }\n\n protected override getAuditTargetLabel(): string {\n return this.element.id ? `#${this.element.id}` : `<${this.element.tagName.toLowerCase()}>`;\n }\n\n /**\n * D\u00E9truit l'instance proprement.\n */\n public destroy(): void {\n this.deactivate();\n }\n\n // --- Impl\u00E9mentation interne ---\n\n private isEventInside(e: Event, target: Node | null): boolean {\n if (target && this.element.contains(target)) {\n return true;\n }\n if (typeof e.composedPath === 'function') {\n const path = e.composedPath();\n if (path.includes(this.element)) {\n return true;\n }\n }\n return false;\n }\n\n private isInsideToastContainer(target: Node | null): boolean {\n if (!target || !(target instanceof Element)) return false;\n return Boolean(target.closest('.wulf-toast-container'));\n }\n\n private ensureContainerTabIndex(): void {\n if (this.element.getAttribute('tabindex') === null) {\n this.element.setAttribute('tabindex', '-1');\n this.addedContainerTabIndex = true;\n }\n }\n\n private handleKeyDown(e: KeyboardEvent): void {\n if (!this.isActive()) return;\n if (this.element.isConnected === false) {\n this.deactivate();\n return;\n }\n\n if (e.key === 'Escape' && this.options.escapeDeactivates) {\n if (isImeComposing(e)) return;\n if (!this.isNativeModalDialog()) {\n e.preventDefault();\n e.stopPropagation();\n }\n this.deactivate();\n return;\n }\n\n if (e.key !== 'Tab') return;\n\n const focusables = this.getFocusableElements();\n\n if (focusables.length === 0) {\n // Aucun \u00E9l\u00E9ment focusable : on maintient le focus sur le conteneur lui-m\u00EAme s'il le peut\n e.preventDefault();\n this.ensureContainerTabIndex();\n this.element.focus();\n return;\n }\n\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n const deepCurrent = getDeepActiveElement(document);\n const current = (deepCurrent instanceof HTMLElement ? deepCurrent : document.activeElement) as HTMLElement | null;\n const isInside = current ? (this.element.contains(current) || this.isEventInside(e, current)) : false;\n\n // Si Tab (en avant) et qu'on est sur le dernier \u00E9l\u00E9ment ou hors du conteneur -> boucle sur le premier\n if (!e.shiftKey && (current === last || !isInside)) {\n e.preventDefault();\n first.focus();\n }\n // Si Shift+Tab (en arri\u00E8re) et qu'on est sur le premier \u00E9l\u00E9ment, le conteneur lui-m\u00EAme ou hors du conteneur -> boucle sur le dernier\n else if (e.shiftKey && (current === first || current === this.element || !isInside)) {\n e.preventDefault();\n last.focus();\n }\n }\n\n private handleFocusIn(e: FocusEvent): void {\n if (!this.isActive()) return;\n if (this.element.isConnected === false) {\n this.deactivate();\n return;\n }\n const target = e.target as HTMLElement | null;\n if (!target) return;\n\n // Autoriser l'interaction clavier/focus avec les notifications Toast actives en Top Layer\n if (this.isInsideToastContainer(target)) {\n return;\n }\n\n // Si allowOutsideClick est actif et qu'un clic ext\u00E9rieur volontaire vient d'avoir lieu, laisser le focus externe\n if (this.options.allowOutsideClick && performance.now() - this.lastOutsidePointerDownTime < 150) {\n return;\n }\n\n // Si le focus part hors du conteneur (ex: lecteur d'\u00E9cran sautant les bornes), on le ram\u00E8ne\n if (!this.isEventInside(e, target)) {\n const focusables = this.getFocusableElements();\n if (focusables.length > 0) {\n focusables[0].focus();\n } else {\n this.ensureContainerTabIndex();\n this.element.focus();\n }\n }\n }\n\n private handleClickOutside(e: MouseEvent | TouchEvent | PointerEvent): void {\n if (!this.isActive()) return;\n if (this.element.isConnected === false) {\n this.deactivate();\n return;\n }\n const target = e.target as HTMLElement | null;\n if (target && !this.isEventInside(e, target)) {\n if (this.isInsideToastContainer(target)) {\n return;\n }\n if (this.options.allowOutsideClick) {\n this.lastOutsidePointerDownTime = performance.now();\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n }\n }\n\n /**\n * Applique `inert` sur les \u00E9l\u00E9ments fr\u00E8res \u00E0 chaque niveau hi\u00E9rarchique jusqu'\u00E0 <body>,\n * en pr\u00E9servant les conteneurs de notifications Toast en Top Layer.\n */\n private applyInert(): void {\n this.removeInert();\n let current: HTMLElement | null = this.element;\n const ignoredTags = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'LINK', 'META', 'NOSCRIPT']);\n\n while (current && current !== document.body && current.parentElement) {\n const parent: HTMLElement = current.parentElement;\n for (const sibling of Array.from(parent.children)) {\n if (\n sibling instanceof HTMLElement &&\n sibling !== current &&\n !ignoredTags.has(sibling.tagName) &&\n !sibling.hasAttribute('inert') &&\n !sibling.matches('.wulf-toast-container, .wulf-toast-announcer')\n ) {\n sibling.setAttribute('inert', '');\n this.inertSiblings.push(sibling);\n }\n }\n current = parent;\n }\n }\n\n private removeInert(): void {\n this.inertSiblings.forEach(el => el.removeAttribute('inert'));\n this.inertSiblings = [];\n }\n\n private applyInitialFocus(): void {\n if (this.options.initialFocus === false) return;\n\n let targetEl: HTMLElement | null = null;\n\n if (typeof this.options.initialFocus === 'string') {\n targetEl = safeQuerySelector<HTMLElement>(this.element, this.options.initialFocus);\n } else if (this.options.initialFocus instanceof HTMLElement) {\n targetEl = this.options.initialFocus;\n }\n\n if (targetEl && this.isFocusable(targetEl)) {\n targetEl.focus();\n return;\n }\n\n const focusables = this.getFocusableElements();\n if (focusables.length > 0) {\n focusables[0].focus();\n } else {\n this.ensureContainerTabIndex();\n this.element.focus();\n }\n }\n\n private restoreFocus(): void {\n if (\n this.previousActiveElement &&\n this.previousActiveElement.isConnected &&\n this.isElementFocusableBase(this.previousActiveElement)\n ) {\n this.previousActiveElement.focus();\n return;\n }\n\n if (this.options.fallbackReturnFocus) {\n const fallback = typeof this.options.fallbackReturnFocus === 'string'\n ? safeQuerySelector<HTMLElement>(document, this.options.fallbackReturnFocus)\n : this.options.fallbackReturnFocus;\n if (fallback && fallback.isConnected && this.isElementFocusableBase(fallback)) {\n fallback.focus();\n }\n }\n }\n}\n", "import { getSafeWulfNamespace } from '../common/dom';\nimport { FocusTrap } from './FocusTrap';\n\nexport * from './types';\nexport * from './FocusTrap';\nexport { FocusTrap as default } from './FocusTrap';\n\n// Attachement namespace global dans les environnements de navigation (IIFE / Vanilla)\nconst wulfNamespace = getSafeWulfNamespace();\nif (wulfNamespace) {\n // Namespace sp\u00E9cifique et exclusif \u00E0 la librairie FocusTrap : Wulf.FocusTrap\n wulfNamespace.FocusTrap = Object.assign(FocusTrap, {\n FocusTrap\n });\n}\n\n\n"],
5
- "mappings": ";AAOO,SAAS,uBAAuD;AACrE,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAM,MAAM;AACZ,QAAM,WAAW,IAAI;AACrB,MACE,CAAC,YACD,OAAO,aAAa,YACnB,OAAO,SAAS,eAAe,oBAAoB,QACnD,OAAO,mBAAmB,eAAe,oBAAoB,gBAC9D;AACA,UAAM,QAAiC,CAAC;AACxC,QAAI,OAAO;AACX,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAKO,SAAS,cAAc,OAAuB;AACnD,MAAI,OAAO,QAAQ,eAAe,OAAO,IAAI,WAAW,YAAY;AAClE,WAAO,IAAI,OAAO,KAAK;AAAA,EACzB;AACA,SAAO,OAAO,KAAK,EAAE,QAAQ,6BAA6B,MAAM;AAClE;AAKO,SAAS,qBAAqB,MAAyD;AAC5F,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,MAAI,UAA0B,QAAQ,UAAU;AAChD,SAAO,UAAU,OAAO,cAAc,OAAO,WAAW,eAAe;AACrE,aAAS,OAAO,WAAW;AAAA,EAC7B;AACA,SAAO,UAAU,OAAQ,OAAuB,UAAU,aAAc,SAAyB;AACnG;AA8BO,SAAS,eAAe,OAA+B;AAC5D,SAAO;AAAA,IACL,MAAM,eACN,MAAM,QAAQ,aACb,MAAM,QAAQ,WAAW,MAAM,YAAY;AAAA,EAC9C;AACF;;;AC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