wulf.js 1.8.4 → 1.9.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 (75) hide show
  1. package/README.md +18 -14
  2. package/changelog.md +55 -0
  3. package/dist/index.cjs.js +590 -54
  4. package/dist/index.cjs.js.map +3 -3
  5. package/dist/index.esm.js +590 -54
  6. package/dist/index.esm.js.map +3 -3
  7. package/dist/index.global.js +590 -54
  8. package/dist/index.global.js.map +3 -3
  9. package/dist/index.global.min.js +1 -1
  10. package/dist/index.global.min.js.map +4 -4
  11. package/dist/mask.cjs.js +231 -31
  12. package/dist/mask.cjs.js.map +2 -2
  13. package/dist/mask.css +1 -1
  14. package/dist/mask.css.map +2 -2
  15. package/dist/mask.esm.js +231 -31
  16. package/dist/mask.esm.js.map +2 -2
  17. package/dist/mask.global.js +231 -31
  18. package/dist/mask.global.js.map +2 -2
  19. package/dist/mask.global.min.js +1 -1
  20. package/dist/mask.global.min.js.map +3 -3
  21. package/dist/masonry.cjs.js +220 -9
  22. package/dist/masonry.cjs.js.map +3 -3
  23. package/dist/masonry.esm.js +220 -9
  24. package/dist/masonry.esm.js.map +3 -3
  25. package/dist/masonry.global.js +220 -9
  26. package/dist/masonry.global.js.map +3 -3
  27. package/dist/masonry.global.min.js +1 -1
  28. package/dist/masonry.global.min.js.map +4 -4
  29. package/dist/scroll.cjs.js +256 -8
  30. package/dist/scroll.cjs.js.map +3 -3
  31. package/dist/scroll.esm.js +256 -8
  32. package/dist/scroll.esm.js.map +3 -3
  33. package/dist/scroll.global.js +256 -8
  34. package/dist/scroll.global.js.map +3 -3
  35. package/dist/scroll.global.min.js +1 -1
  36. package/dist/scroll.global.min.js.map +4 -4
  37. package/dist/toast.cjs.js +199 -6
  38. package/dist/toast.cjs.js.map +3 -3
  39. package/dist/toast.css +1 -1
  40. package/dist/toast.css.map +2 -2
  41. package/dist/toast.esm.js +199 -6
  42. package/dist/toast.esm.js.map +3 -3
  43. package/dist/toast.global.js +199 -6
  44. package/dist/toast.global.js.map +3 -3
  45. package/dist/toast.global.min.js +1 -1
  46. package/dist/toast.global.min.js.map +4 -4
  47. package/dist/types/common/LocalizedComponent.d.ts +53 -0
  48. package/dist/types/common/i18n.d.ts +39 -0
  49. package/dist/types/index.d.ts +2 -0
  50. package/dist/types/mask/BaseInputMask.d.ts +1 -0
  51. package/dist/types/mask/EmailEngine.d.ts +24 -2
  52. package/dist/types/mask/InputEmailMask.d.ts +8 -0
  53. package/dist/types/mask/InputMask.d.ts +8 -0
  54. package/dist/types/masonry/Masonry.d.ts +11 -1
  55. package/dist/types/masonry/i18n/en.d.ts +2 -0
  56. package/dist/types/masonry/i18n/fr.d.ts +2 -0
  57. package/dist/types/masonry/i18n/index.d.ts +9 -0
  58. package/dist/types/masonry/i18n/types.d.ts +7 -0
  59. package/dist/types/masonry/index.d.ts +1 -0
  60. package/dist/types/masonry/types.d.ts +8 -3
  61. package/dist/types/scroll/ScrollBlock.d.ts +14 -1
  62. package/dist/types/scroll/i18n/en.d.ts +2 -0
  63. package/dist/types/scroll/i18n/fr.d.ts +2 -0
  64. package/dist/types/scroll/i18n/index.d.ts +9 -0
  65. package/dist/types/scroll/i18n/types.d.ts +11 -0
  66. package/dist/types/scroll/index.d.ts +2 -0
  67. package/dist/types/scroll/types.d.ts +6 -1
  68. package/dist/types/toast/Toast.d.ts +5 -1
  69. package/dist/types/toast/i18n/en.d.ts +2 -0
  70. package/dist/types/toast/i18n/fr.d.ts +2 -0
  71. package/dist/types/toast/i18n/index.d.ts +9 -0
  72. package/dist/types/toast/i18n/types.d.ts +7 -0
  73. package/dist/types/toast/index.d.ts +1 -0
  74. package/dist/types/toast/types.d.ts +9 -1
  75. package/package.json +1 -1
@@ -27,6 +27,7 @@ var Wulf = (() => {
27
27
  InputAmountMask: () => InputAmountMask,
28
28
  InputEmailMask: () => InputEmailMask,
29
29
  InputMask: () => InputMask,
30
+ LocalizedComponent: () => LocalizedComponent,
30
31
  Mask: () => mask_exports,
31
32
  MaskEngine: () => MaskEngine,
32
33
  MaskHistory: () => MaskHistory,
@@ -34,6 +35,7 @@ var Wulf = (() => {
34
35
  Masonry: () => masonry_exports,
35
36
  Scroll: () => scroll_exports,
36
37
  Toast: () => toast_exports,
38
+ createI18nManager: () => createI18nManager,
37
39
  default: () => mask_default,
38
40
  resolveMaskConstructorArgs: () => resolveMaskConstructorArgs
39
41
  });
@@ -85,6 +87,7 @@ var Wulf = (() => {
85
87
  this.onCutHandler = () => {
86
88
  };
87
89
  this.mutationObserver = null;
90
+ this.focusSelectTimerId = null;
88
91
  this.onBaseCopy = (e) => {
89
92
  if (!this.options.copyRaw || this.options.disabled || this.input.type === "password") return;
90
93
  const start = this.input.selectionStart ?? 0;
@@ -103,7 +106,11 @@ var Wulf = (() => {
103
106
  this.onBaseFocus = () => {
104
107
  this.isFocused = true;
105
108
  if (this.options.selectAllOnFocus && this.input.value.length > 0) {
106
- setTimeout(() => {
109
+ if (this.focusSelectTimerId !== null) {
110
+ clearTimeout(this.focusSelectTimerId);
111
+ }
112
+ this.focusSelectTimerId = window.setTimeout(() => {
113
+ this.focusSelectTimerId = null;
107
114
  if (!this.isDestroyed && document.activeElement === this.input) {
108
115
  this.input.select();
109
116
  }
@@ -122,7 +129,7 @@ var Wulf = (() => {
122
129
  }
123
130
  };
124
131
  const { wrapper: providedWrapper, input, options } = resolveMaskConstructorArgs(targetOrWrapper, inputOrOptions, maybeOptions);
125
- if (!input || !(input instanceof HTMLElement) || input.tagName !== "INPUT") {
132
+ if (!input || typeof input !== "object" || input.nodeType !== 1 || input.tagName !== "INPUT") {
126
133
  throw new Error(`[${new.target.name || "InputMask"}] input (HTMLInputElement) est requis.`);
127
134
  }
128
135
  this.input = input;
@@ -247,6 +254,8 @@ var Wulf = (() => {
247
254
  "data-mask-pad-decimals",
248
255
  "data-mask-auto-lowercase",
249
256
  "data-mask-cycle-suggestions",
257
+ "data-mask-default-tld",
258
+ "data-mask-tlds",
250
259
  "data-disabled",
251
260
  "data-mask-align",
252
261
  "data-align",
@@ -517,6 +526,10 @@ var Wulf = (() => {
517
526
  destroy() {
518
527
  if (this.isDestroyed) return;
519
528
  this.isDestroyed = true;
529
+ if (this.focusSelectTimerId !== null) {
530
+ clearTimeout(this.focusSelectTimerId);
531
+ this.focusSelectTimerId = null;
532
+ }
520
533
  if (this.mutationObserver) {
521
534
  this.mutationObserver.disconnect();
522
535
  this.mutationObserver = null;
@@ -1278,6 +1291,9 @@ var Wulf = (() => {
1278
1291
  this.onChangeNativeHandler = () => {
1279
1292
  };
1280
1293
  this.wasInputModeInferred = false;
1294
+ this.cutTimerId = null;
1295
+ this.pasteTimerId = null;
1296
+ this.resetTimerId = null;
1281
1297
  this.history = new MaskHistory();
1282
1298
  this.engine = new MaskEngine(this.options.mask || "", {
1283
1299
  placeholderChar: this.options.placeholderChar,
@@ -1285,12 +1301,7 @@ var Wulf = (() => {
1285
1301
  strict: this.options.strict,
1286
1302
  autoLowercase: this.options.autoLowercase
1287
1303
  });
1288
- if (this.options.inferInputMode && !this.input.hasAttribute("inputmode")) {
1289
- if (this.engine.isNumericOnly()) {
1290
- this.input.inputMode = "numeric";
1291
- this.wasInputModeInferred = true;
1292
- }
1293
- }
1304
+ this.syncInferredInputMode();
1294
1305
  this.keyboard = new MaskKeyboard({
1295
1306
  getInput: () => this.input,
1296
1307
  getEngine: () => this.engine,
@@ -1354,7 +1365,9 @@ var Wulf = (() => {
1354
1365
  this.onScroll = this.onScroll.bind(this);
1355
1366
  this.onBeforeInput = this.onBeforeInput.bind(this);
1356
1367
  this.onCutHandler = () => {
1357
- setTimeout(() => {
1368
+ if (this.cutTimerId !== null) clearTimeout(this.cutTimerId);
1369
+ this.cutTimerId = window.setTimeout(() => {
1370
+ this.cutTimerId = null;
1358
1371
  if (this.isDestroyed) return;
1359
1372
  if (this.options.disabled) {
1360
1373
  this.checkValueChange();
@@ -1386,7 +1399,9 @@ var Wulf = (() => {
1386
1399
  this.input.addEventListener("change", this.onChangeNativeHandler);
1387
1400
  if (this.input.form) {
1388
1401
  this.onFormResetHandler = () => {
1389
- setTimeout(() => {
1402
+ if (this.resetTimerId !== null) clearTimeout(this.resetTimerId);
1403
+ this.resetTimerId = window.setTimeout(() => {
1404
+ this.resetTimerId = null;
1390
1405
  if (this.isDestroyed) return;
1391
1406
  if (this.options.disabled) {
1392
1407
  this.checkValueChange();
@@ -1398,11 +1413,40 @@ var Wulf = (() => {
1398
1413
  this.input.form.addEventListener("reset", this.onFormResetHandler);
1399
1414
  }
1400
1415
  }
1416
+ /**
1417
+ * Synchronise dynamiquement l'attribut inputmode="numeric" selon le motif actif
1418
+ * sans jamais écraser un inputmode défini explicitement par l'hôte.
1419
+ */
1420
+ syncInferredInputMode() {
1421
+ if (!this.options.inferInputMode) return;
1422
+ const isNum = !this.options.disabled && this.engine.isNumericOnly();
1423
+ if (isNum) {
1424
+ if (!this.input.hasAttribute("inputmode")) {
1425
+ this.input.inputMode = "numeric";
1426
+ this.wasInputModeInferred = true;
1427
+ }
1428
+ } else if (this.wasInputModeInferred && this.input.getAttribute("inputmode") === "numeric") {
1429
+ this.input.removeAttribute("inputmode");
1430
+ this.wasInputModeInferred = false;
1431
+ }
1432
+ }
1401
1433
  /**
1402
1434
  * Supprime tous les écouteurs et nettoie les attributs associés.
1403
1435
  */
1404
1436
  destroy() {
1405
1437
  if (this.isDestroyed) return;
1438
+ if (this.cutTimerId !== null) {
1439
+ clearTimeout(this.cutTimerId);
1440
+ this.cutTimerId = null;
1441
+ }
1442
+ if (this.pasteTimerId !== null) {
1443
+ clearTimeout(this.pasteTimerId);
1444
+ this.pasteTimerId = null;
1445
+ }
1446
+ if (this.resetTimerId !== null) {
1447
+ clearTimeout(this.resetTimerId);
1448
+ this.resetTimerId = null;
1449
+ }
1406
1450
  this.input.removeEventListener("beforeinput", this.onBeforeInput);
1407
1451
  this.input.removeEventListener("input", this.handleInput);
1408
1452
  this.input.removeEventListener("keydown", this.onKeyDown);
@@ -1464,6 +1508,7 @@ var Wulf = (() => {
1464
1508
  this.history.clear();
1465
1509
  }
1466
1510
  this.setDisabled(true);
1511
+ this.syncInferredInputMode();
1467
1512
  return;
1468
1513
  }
1469
1514
  this.options.mask = newPattern;
@@ -1474,6 +1519,7 @@ var Wulf = (() => {
1474
1519
  this.history.clear();
1475
1520
  }
1476
1521
  this.setDisabled(false);
1522
+ this.syncInferredInputMode();
1477
1523
  }
1478
1524
  handleAttributeMutation(attrName) {
1479
1525
  super.handleAttributeMutation(attrName);
@@ -1631,7 +1677,9 @@ var Wulf = (() => {
1631
1677
  }
1632
1678
  onPaste(e) {
1633
1679
  if (this.options.disabled) {
1634
- setTimeout(() => {
1680
+ if (this.pasteTimerId !== null) clearTimeout(this.pasteTimerId);
1681
+ this.pasteTimerId = window.setTimeout(() => {
1682
+ this.pasteTimerId = null;
1635
1683
  if (!this.isDestroyed) this.checkValueChange();
1636
1684
  }, 0);
1637
1685
  return;
@@ -2440,9 +2488,12 @@ var Wulf = (() => {
2440
2488
  var _EmailEngine = class _EmailEngine {
2441
2489
  constructor(options = {}) {
2442
2490
  this.defaultDomain = null;
2491
+ this.defaultTld = "__";
2443
2492
  this.domains = options.domains && options.domains.length > 0 ? options.domains : _EmailEngine.DEFAULT_DOMAINS;
2493
+ this.tlds = options.tlds && options.tlds.length > 0 ? options.tlds.map((t) => t.trim().replace(/^\./, "")).filter(Boolean) : [..._EmailEngine.DEFAULT_TLDS];
2444
2494
  this.suggestOnAt = options.suggestOnAt ?? true;
2445
2495
  this.setDefaultDomain(options.defaultDomain ?? null);
2496
+ this.setDefaultTld(options.defaultTld !== void 0 ? options.defaultTld : "__");
2446
2497
  }
2447
2498
  /**
2448
2499
  * Définit ou modifie le domaine suggéré par défaut.
@@ -2456,6 +2507,35 @@ var Wulf = (() => {
2456
2507
  this.defaultDomain = null;
2457
2508
  }
2458
2509
  }
2510
+ /**
2511
+ * Définit ou modifie l'extension (TLD) ou gabarit suggéré par défaut sur un domaine inconnu.
2512
+ */
2513
+ setDefaultTld(tld) {
2514
+ if (tld === true) {
2515
+ this.defaultTld = this.tlds.length > 0 ? this.tlds[0] : null;
2516
+ } else if (typeof tld === "string" && tld.trim().length > 0) {
2517
+ this.defaultTld = tld.trim().replace(/^\./, "");
2518
+ } else {
2519
+ this.defaultTld = null;
2520
+ }
2521
+ }
2522
+ /**
2523
+ * Définit ou modifie la liste des extensions (TLD) proposées par ordre de priorité.
2524
+ */
2525
+ setTlds(tlds) {
2526
+ this.tlds = tlds && tlds.length > 0 ? tlds.map((t) => t.trim().replace(/^\./, "")).filter(Boolean) : [..._EmailEngine.DEFAULT_TLDS];
2527
+ }
2528
+ /**
2529
+ * Retourne l'ensemble des extensions (TLD) correspondant au fragment saisi après le dernier point,
2530
+ * dans l'ordre exact fourni par l'utilisateur.
2531
+ */
2532
+ getMatchingTlds(tldInput) {
2533
+ const query = (tldInput ?? "").toLowerCase();
2534
+ if (query.length === 0) {
2535
+ return [...this.tlds];
2536
+ }
2537
+ return this.tlds.filter((t) => t.toLowerCase().startsWith(query) && t.toLowerCase() !== query);
2538
+ }
2459
2539
  /**
2460
2540
  * Retourne l'ensemble des domaines correspondant à la saisie courante.
2461
2541
  */
@@ -2476,10 +2556,10 @@ var Wulf = (() => {
2476
2556
  return this.domains.filter((d) => d.toLowerCase().startsWith(query) && d.toLowerCase() !== query);
2477
2557
  }
2478
2558
  /**
2479
- * Analyse la saisie courante et calcule la suggestion de domaine adaptée.
2559
+ * Analyse la saisie courante et calcule la suggestion de domaine ou d'extension (TLD) adaptée.
2480
2560
  *
2481
2561
  * @param input Saisie utilisateur
2482
- * @param matchIndex Index de la suggestion à sélectionner si plusieurs domaines correspondent (permet le cyclage)
2562
+ * @param matchIndex Index de la suggestion à sélectionner si plusieurs domaines/TLD correspondent (permet le cyclage)
2483
2563
  */
2484
2564
  getSuggestion(input, matchIndex = 0) {
2485
2565
  const val = input ?? "";
@@ -2488,30 +2568,104 @@ var Wulf = (() => {
2488
2568
  return {
2489
2569
  full: val ? `${val}@${this.defaultDomain}` : `@${this.defaultDomain}`,
2490
2570
  remaining: `@${this.defaultDomain}`,
2491
- matchedDomain: this.defaultDomain
2571
+ matchedDomain: this.defaultDomain,
2572
+ isHintOnly: false
2492
2573
  };
2493
2574
  }
2494
- return { full: val, remaining: "", matchedDomain: null };
2575
+ return { full: val, remaining: "", matchedDomain: null, isHintOnly: false };
2495
2576
  }
2496
2577
  const atIndex = val.indexOf("@");
2497
2578
  const localPart = val.substring(0, atIndex);
2498
2579
  const domainPart = val.substring(atIndex + 1);
2499
2580
  if (val.indexOf("@", atIndex + 1) !== -1) {
2500
- return { full: val, remaining: "", matchedDomain: null };
2581
+ return { full: val, remaining: "", matchedDomain: null, isHintOnly: false };
2501
2582
  }
2502
2583
  const matches = this.getMatchingDomains(input);
2503
- if (matches.length === 0) {
2504
- return { full: input, remaining: "", matchedDomain: null };
2584
+ if (matches.length > 0) {
2585
+ const safeIndex = (matchIndex % matches.length + matches.length) % matches.length;
2586
+ const matched = matches[safeIndex];
2587
+ const query = domainPart.toLowerCase();
2588
+ const remaining = matched.substring(query.length);
2589
+ return {
2590
+ full: `${localPart}@${matched}`,
2591
+ remaining,
2592
+ matchedDomain: matched,
2593
+ isHintOnly: false
2594
+ };
2505
2595
  }
2506
- const safeIndex = (matchIndex % matches.length + matches.length) % matches.length;
2507
- const matched = matches[safeIndex];
2508
- const query = domainPart.toLowerCase();
2509
- const remaining = matched.substring(query.length);
2510
- return {
2511
- full: `${localPart}@${matched}`,
2512
- remaining,
2513
- matchedDomain: matched
2514
- };
2596
+ if (domainPart.length === 0 || domainPart.startsWith(".")) {
2597
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2598
+ }
2599
+ const lowerDomain = domainPart.toLowerCase();
2600
+ if (this.domains.some((d) => d.toLowerCase() === lowerDomain)) {
2601
+ return { full: input, remaining: "", matchedDomain: domainPart, isHintOnly: false };
2602
+ }
2603
+ const lastDotIndex = domainPart.lastIndexOf(".");
2604
+ if (lastDotIndex === -1) {
2605
+ if (!this.defaultTld) {
2606
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2607
+ }
2608
+ const isHint = this.defaultTld.includes("_");
2609
+ const remaining = `.${this.defaultTld}`;
2610
+ const fullDomain = `${domainPart}.${this.defaultTld}`;
2611
+ return {
2612
+ full: isHint ? input : `${localPart}@${fullDomain}`,
2613
+ remaining,
2614
+ matchedDomain: isHint ? null : fullDomain,
2615
+ isHintOnly: isHint
2616
+ };
2617
+ }
2618
+ const hostPart = domainPart.substring(0, lastDotIndex);
2619
+ const tldPart = domainPart.substring(lastDotIndex + 1);
2620
+ if (!hostPart || hostPart.endsWith(".")) {
2621
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2622
+ }
2623
+ if (tldPart.length === 0) {
2624
+ if (this.defaultTld && !this.defaultTld.includes("_")) {
2625
+ const fullDomain = `${hostPart}.${this.defaultTld}`;
2626
+ return {
2627
+ full: `${localPart}@${fullDomain}`,
2628
+ remaining: this.defaultTld,
2629
+ matchedDomain: fullDomain,
2630
+ isHintOnly: false
2631
+ };
2632
+ }
2633
+ if (this.defaultTld && this.defaultTld.includes("_")) {
2634
+ return {
2635
+ full: input,
2636
+ remaining: this.defaultTld,
2637
+ matchedDomain: null,
2638
+ isHintOnly: true
2639
+ };
2640
+ }
2641
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2642
+ }
2643
+ const lowerTld = tldPart.toLowerCase();
2644
+ const matchingTlds = this.getMatchingTlds(tldPart);
2645
+ if (matchingTlds.length > 0) {
2646
+ const safeTldIndex = (matchIndex % matchingTlds.length + matchingTlds.length) % matchingTlds.length;
2647
+ const matchedTld = matchingTlds[safeTldIndex];
2648
+ const remaining = matchedTld.substring(lowerTld.length);
2649
+ const fullDomain = `${hostPart}.${matchedTld}`;
2650
+ return {
2651
+ full: `${localPart}@${fullDomain}`,
2652
+ remaining,
2653
+ matchedDomain: fullDomain,
2654
+ isHintOnly: false
2655
+ };
2656
+ }
2657
+ if (this.defaultTld && this.defaultTld.includes("_") && tldPart.length < this.defaultTld.length) {
2658
+ const remaining = this.defaultTld.substring(tldPart.length);
2659
+ if (remaining.includes("_")) {
2660
+ return {
2661
+ full: input,
2662
+ remaining,
2663
+ matchedDomain: null,
2664
+ isHintOnly: true
2665
+ };
2666
+ }
2667
+ }
2668
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2515
2669
  }
2516
2670
  };
2517
2671
  _EmailEngine.DEFAULT_DOMAINS = [
@@ -2526,6 +2680,27 @@ var Wulf = (() => {
2526
2680
  "laposte.net",
2527
2681
  "proton.me"
2528
2682
  ];
2683
+ _EmailEngine.DEFAULT_TLDS = [
2684
+ "com",
2685
+ "fr",
2686
+ "net",
2687
+ "org",
2688
+ "eu",
2689
+ "io",
2690
+ "co",
2691
+ "info",
2692
+ "biz",
2693
+ "me",
2694
+ "tv",
2695
+ "fi",
2696
+ "be",
2697
+ "ch",
2698
+ "ca",
2699
+ "uk",
2700
+ "de",
2701
+ "es",
2702
+ "it"
2703
+ ];
2529
2704
  var EmailEngine = _EmailEngine;
2530
2705
 
2531
2706
  // src/mask/InputEmailMask.ts
@@ -2539,6 +2714,10 @@ var Wulf = (() => {
2539
2714
  const dataAutoLower = wrap?.getAttribute("data-mask-auto-lowercase") === "true" || inp?.getAttribute("data-mask-auto-lowercase") === "true";
2540
2715
  const dataAriaAuto = wrap?.getAttribute("data-mask-aria-autocomplete") ?? inp?.getAttribute("data-mask-aria-autocomplete");
2541
2716
  const setAriaAutocomplete = opts.setAriaAutocomplete ?? (dataAriaAuto !== null ? dataAriaAuto !== "false" : true);
2717
+ const dataTlds = wrap?.getAttribute("data-mask-tlds") ?? inp?.getAttribute("data-mask-tlds");
2718
+ const parsedTlds = opts.tlds ?? (dataTlds ? dataTlds.split(",").map((s) => s.trim()).filter(Boolean) : void 0);
2719
+ const dataDefaultTld = wrap?.getAttribute("data-mask-default-tld") ?? inp?.getAttribute("data-mask-default-tld");
2720
+ const resolvedDefaultTld = opts.defaultTld !== void 0 ? opts.defaultTld : dataDefaultTld !== null ? dataDefaultTld === "false" || dataDefaultTld === "none" ? null : dataDefaultTld === "true" ? true : dataDefaultTld : void 0;
2542
2721
  const resolvedOptions = {
2543
2722
  completeOnTab: true,
2544
2723
  completeOnArrowRight: true,
@@ -2546,7 +2725,9 @@ var Wulf = (() => {
2546
2725
  cycleSuggestions: opts.cycleSuggestions ?? dataCycle ?? false,
2547
2726
  autoLowercase: opts.autoLowercase ?? dataAutoLower ?? false,
2548
2727
  setAriaAutocomplete,
2549
- ...opts
2728
+ ...opts,
2729
+ ...parsedTlds !== void 0 ? { tlds: parsedTlds } : {},
2730
+ ...resolvedDefaultTld !== void 0 ? { defaultTld: resolvedDefaultTld } : {}
2550
2731
  };
2551
2732
  super(wrap, inp, resolvedOptions);
2552
2733
  this.currentSuggestion = { full: "", remaining: "", matchedDomain: null };
@@ -2659,7 +2840,7 @@ var Wulf = (() => {
2659
2840
  }
2660
2841
  handleKeyDown(e) {
2661
2842
  if (this.options.disabled) return;
2662
- const hasSuggestion = Boolean(this.currentSuggestion.remaining);
2843
+ const hasSuggestion = Boolean(this.currentSuggestion.remaining) && !this.currentSuggestion.isHintOnly;
2663
2844
  const cursor = this.input.selectionStart ?? 0;
2664
2845
  const isAtEnd = cursor === this.input.value.length;
2665
2846
  const isNotEmpty = this.input.value.length > 0;
@@ -2697,7 +2878,7 @@ var Wulf = (() => {
2697
2878
  * Valide et applique la suggestion courante dans le champ natif.
2698
2879
  */
2699
2880
  acceptSuggestion() {
2700
- if (!this.currentSuggestion.remaining || this.options.disabled || this.input.value.length === 0) return false;
2881
+ if (!this.currentSuggestion.remaining || this.currentSuggestion.isHintOnly || this.options.disabled || this.input.value.length === 0) return false;
2701
2882
  const completed = this.currentSuggestion.full;
2702
2883
  this.setNativeValue(completed);
2703
2884
  this.input.setSelectionRange(completed.length, completed.length);
@@ -2718,6 +2899,21 @@ var Wulf = (() => {
2718
2899
  this.engine.setDefaultDomain(domain);
2719
2900
  this.updateSuggestion();
2720
2901
  }
2902
+ /**
2903
+ * Modifie dynamiquement l'extension (TLD) ou gabarit suggéré par défaut sur un domaine inconnu.
2904
+ */
2905
+ setDefaultTld(tld) {
2906
+ this.engine.setDefaultTld(tld);
2907
+ this.updateSuggestion();
2908
+ }
2909
+ /**
2910
+ * Modifie dynamiquement la liste des extensions (TLD) connues.
2911
+ */
2912
+ setTlds(tlds) {
2913
+ this.engine.setTlds(tlds);
2914
+ this.currentSuggestionIndex = 0;
2915
+ this.updateSuggestion();
2916
+ }
2721
2917
  handleFocus() {
2722
2918
  this.wrapper.classList.add("is-focused");
2723
2919
  this.syncGhostStyles();
@@ -2738,6 +2934,12 @@ var Wulf = (() => {
2738
2934
  this.options.cycleSuggestions = this.getAttr("data-mask-cycle-suggestions") === "true";
2739
2935
  } else if (attrName === "data-mask-auto-lowercase") {
2740
2936
  this.options.autoLowercase = this.getAttr("data-mask-auto-lowercase") === "true";
2937
+ } else if (attrName === "data-mask-default-tld") {
2938
+ const val = this.getAttr("data-mask-default-tld");
2939
+ this.setDefaultTld(val === null || val === "false" || val === "none" ? null : val === "true" ? true : val);
2940
+ } else if (attrName === "data-mask-tlds") {
2941
+ const val = this.getAttr("data-mask-tlds");
2942
+ this.setTlds(val ? val.split(",").map((s) => s.trim()).filter(Boolean) : null);
2741
2943
  } else if (attrName === "placeholder") {
2742
2944
  this.updateSuggestion();
2743
2945
  }
@@ -2745,7 +2947,7 @@ var Wulf = (() => {
2745
2947
  getDetail() {
2746
2948
  return {
2747
2949
  value: this.input.value,
2748
- suggestedValue: this.currentSuggestion.full,
2950
+ suggestedValue: this.currentSuggestion.isHintOnly ? "" : this.currentSuggestion.full,
2749
2951
  domain: this.currentSuggestion.matchedDomain
2750
2952
  };
2751
2953
  }
@@ -2803,16 +3005,206 @@ var Wulf = (() => {
2803
3005
  // src/scroll/index.ts
2804
3006
  var scroll_exports = {};
2805
3007
  __export(scroll_exports, {
3008
+ LocalizedComponent: () => LocalizedComponent,
2806
3009
  Scroll: () => Scroll,
2807
3010
  ScrollBlock: () => ScrollBlock,
2808
- default: () => scroll_default
3011
+ createI18nManager: () => createI18nManager,
3012
+ default: () => scroll_default,
3013
+ scrollEn: () => scrollEn,
3014
+ scrollFr: () => scrollFr,
3015
+ scrollI18n: () => scrollI18n
3016
+ });
3017
+
3018
+ // src/common/LocalizedComponent.ts
3019
+ var LocalizedComponent = class {
3020
+ /**
3021
+ * Définit la langue globale du composant (ex: 'fr', 'en', 'es').
3022
+ */
3023
+ static setLocale(locale) {
3024
+ if (this._i18n) {
3025
+ this._i18n.setLocale(locale);
3026
+ }
3027
+ }
3028
+ /**
3029
+ * Retourne la langue globale active du composant.
3030
+ */
3031
+ static getLocale() {
3032
+ return this._i18n ? this._i18n.getLocale() : "";
3033
+ }
3034
+ /**
3035
+ * Enregistre un dictionnaire de traduction pour une langue donnée.
3036
+ */
3037
+ static registerLocale(locale, translations) {
3038
+ if (this._i18n) {
3039
+ this._i18n.registerLocale(locale, translations);
3040
+ }
3041
+ }
3042
+ /**
3043
+ * Surcharge les libellés globalement pour ce composant.
3044
+ */
3045
+ static setI18n(overrides) {
3046
+ if (this._i18n) {
3047
+ this._i18n.setI18n(overrides);
3048
+ }
3049
+ }
3050
+ /**
3051
+ * Retourne l'ensemble des libellés actifs résolus du composant.
3052
+ */
3053
+ static getI18n() {
3054
+ return this._i18n ? this._i18n.getAll() : {};
3055
+ }
3056
+ /**
3057
+ * Réinitialise les réglages de langue et surcharges globales.
3058
+ */
3059
+ static resetI18n() {
3060
+ if (this._i18n) {
3061
+ this._i18n.reset();
3062
+ }
3063
+ }
3064
+ /**
3065
+ * Résout une clé au niveau statique de la classe.
3066
+ */
3067
+ static t(key, instanceOverride) {
3068
+ return this._i18n ? this._i18n.t(key, instanceOverride) : String(key);
3069
+ }
3070
+ constructor(i18nOverrides) {
3071
+ this.i18nOverrides = i18nOverrides;
3072
+ }
3073
+ /**
3074
+ * Traduit une clé en tenant compte automatiquement des surcharges de l'instance courante.
3075
+ */
3076
+ t(key) {
3077
+ const ctor = this.constructor;
3078
+ return ctor._i18n ? ctor._i18n.t(key, this.i18nOverrides) : String(key);
3079
+ }
3080
+ };
3081
+
3082
+ // src/common/i18n.ts
3083
+ function normalizeLocaleCode(locale) {
3084
+ return locale.trim().toLowerCase().replace(/_/g, "-");
3085
+ }
3086
+ function getPrimaryLanguage(normalizedLocale) {
3087
+ const dashIndex = normalizedLocale.indexOf("-");
3088
+ return dashIndex > 0 ? normalizedLocale.slice(0, dashIndex) : null;
3089
+ }
3090
+ function assignDefined(target, source) {
3091
+ if (!source) return target;
3092
+ for (const key of Object.keys(source)) {
3093
+ if (source[key] !== void 0) {
3094
+ target[key] = source[key];
3095
+ }
3096
+ }
3097
+ return target;
3098
+ }
3099
+ function createI18nManager(defaultLocale, locales) {
3100
+ const fallbackLocale = normalizeLocaleCode(defaultLocale);
3101
+ const initialLocales = {};
3102
+ for (const [loc, dict] of Object.entries(locales)) {
3103
+ initialLocales[normalizeLocaleCode(loc)] = { ...dict };
3104
+ }
3105
+ let currentLocale = fallbackLocale;
3106
+ let activeLocales = { ...initialLocales };
3107
+ let globalOverrides = {};
3108
+ function resolveActiveDictionaries() {
3109
+ const dicts = [];
3110
+ const exact = activeLocales[currentLocale];
3111
+ if (exact) dicts.push(exact);
3112
+ const primary = getPrimaryLanguage(currentLocale);
3113
+ if (primary && activeLocales[primary]) {
3114
+ dicts.push(activeLocales[primary]);
3115
+ }
3116
+ return dicts;
3117
+ }
3118
+ return {
3119
+ setLocale(locale) {
3120
+ if (locale && locale.trim()) {
3121
+ currentLocale = normalizeLocaleCode(locale);
3122
+ }
3123
+ },
3124
+ getLocale() {
3125
+ return currentLocale;
3126
+ },
3127
+ registerLocale(locale, translations) {
3128
+ if (!locale || !locale.trim() || !translations) return;
3129
+ const norm = normalizeLocaleCode(locale);
3130
+ activeLocales[norm] = assignDefined({ ...activeLocales[norm] || {} }, translations);
3131
+ },
3132
+ setI18n(overrides) {
3133
+ if (!overrides) return;
3134
+ globalOverrides = assignDefined({ ...globalOverrides }, overrides);
3135
+ },
3136
+ t(key, instanceOverride) {
3137
+ if (instanceOverride && instanceOverride[key] !== void 0) {
3138
+ return String(instanceOverride[key]);
3139
+ }
3140
+ if (globalOverrides[key] !== void 0) {
3141
+ return String(globalOverrides[key]);
3142
+ }
3143
+ for (const dict of resolveActiveDictionaries()) {
3144
+ if (dict[key] !== void 0) {
3145
+ return String(dict[key]);
3146
+ }
3147
+ }
3148
+ const fallbackDict = activeLocales[fallbackLocale] || initialLocales[fallbackLocale];
3149
+ if (fallbackDict && fallbackDict[key] !== void 0) {
3150
+ return String(fallbackDict[key]);
3151
+ }
3152
+ return String(key);
3153
+ },
3154
+ getAll(instanceOverride) {
3155
+ const result = {};
3156
+ const fallback = activeLocales[fallbackLocale] || initialLocales[fallbackLocale];
3157
+ assignDefined(result, fallback);
3158
+ const activeDicts = resolveActiveDictionaries().reverse();
3159
+ for (const dict of activeDicts) {
3160
+ assignDefined(result, dict);
3161
+ }
3162
+ assignDefined(result, globalOverrides);
3163
+ assignDefined(result, instanceOverride);
3164
+ return result;
3165
+ },
3166
+ reset() {
3167
+ currentLocale = fallbackLocale;
3168
+ globalOverrides = {};
3169
+ activeLocales = {};
3170
+ for (const [loc, dict] of Object.entries(initialLocales)) {
3171
+ activeLocales[loc] = { ...dict };
3172
+ }
3173
+ }
3174
+ };
3175
+ }
3176
+
3177
+ // src/scroll/i18n/fr.ts
3178
+ var scrollFr = {
3179
+ viewport: "Zone de contenu d\xE9filable",
3180
+ verticalThumb: "D\xE9filement vertical",
3181
+ horizontalThumb: "D\xE9filement horizontal"
3182
+ };
3183
+
3184
+ // src/scroll/i18n/en.ts
3185
+ var scrollEn = {
3186
+ viewport: "Scrollable content area",
3187
+ verticalThumb: "Vertical scroll",
3188
+ horizontalThumb: "Horizontal scroll"
3189
+ };
3190
+
3191
+ // src/scroll/i18n/index.ts
3192
+ var scrollI18n = createI18nManager("fr", {
3193
+ fr: scrollFr,
3194
+ en: scrollEn
2809
3195
  });
2810
3196
 
2811
3197
  // src/scroll/ScrollBlock.ts
2812
3198
  var idCounter = 0;
2813
- var ScrollBlock = class {
3199
+ var ScrollBlock = class extends LocalizedComponent {
2814
3200
  constructor(element, options) {
3201
+ super(options?.i18n);
2815
3202
  this.createdViewport = false;
3203
+ this.wasIdGenerated = false;
3204
+ this.wasRoleInferred = false;
3205
+ this.wasAriaLabelInferred = false;
3206
+ this.hasExplicitAriaLabel = false;
3207
+ this.lastInferredAriaLabel = "";
2816
3208
  this.isDragging = false;
2817
3209
  this.dragStartPos = 0;
2818
3210
  this.dragStartScroll = 0;
@@ -2825,12 +3217,14 @@ var Wulf = (() => {
2825
3217
  throw new Error(`[ScrollBlock] \xC9l\xE9ment introuvable : "${element}".`);
2826
3218
  }
2827
3219
  this.root = resolvedElement;
3220
+ this.hasExplicitAriaLabel = Boolean(options?.ariaLabel);
2828
3221
  this.options = {
2829
3222
  axis: options?.axis || "y",
2830
3223
  autoHide: options?.autoHide ?? true,
2831
3224
  autoHideDelay: options?.autoHideDelay ?? 1e3,
2832
3225
  alwaysVisible: options?.alwaysVisible ?? false,
2833
- ariaLabel: options?.ariaLabel || "Zone de contenu d\xE9filable",
3226
+ ariaLabel: options?.ariaLabel || this.t("viewport"),
3227
+ i18n: options?.i18n || {},
2834
3228
  minThumbSize: options?.minThumbSize ?? 24,
2835
3229
  edgeThreshold: options?.edgeThreshold ?? 10,
2836
3230
  onScroll: options?.onScroll || (() => {
@@ -2885,9 +3279,38 @@ var Wulf = (() => {
2885
3279
  if (!this.viewport.id) {
2886
3280
  idCounter += 1;
2887
3281
  this.viewport.id = `wulf-scrollblock-vp-${idCounter}`;
3282
+ this.wasIdGenerated = true;
3283
+ }
3284
+ if (!this.viewport.hasAttribute("role")) {
3285
+ this.viewport.setAttribute("role", "region");
3286
+ this.wasRoleInferred = true;
3287
+ }
3288
+ if (!this.viewport.hasAttribute("aria-label")) {
3289
+ const label = this.hasExplicitAriaLabel ? this.options.ariaLabel : this.t("viewport");
3290
+ this.viewport.setAttribute("aria-label", label);
3291
+ this.lastInferredAriaLabel = label;
3292
+ this.wasAriaLabelInferred = true;
3293
+ }
3294
+ }
3295
+ /**
3296
+ * Synchronise dynamiquement les libellés ARIA si la langue globale change après montage.
3297
+ */
3298
+ syncAccessibilityLabels() {
3299
+ if (this.wasAriaLabelInferred && !this.hasExplicitAriaLabel) {
3300
+ const currentAttr = this.viewport.getAttribute("aria-label");
3301
+ if (currentAttr === this.lastInferredAriaLabel) {
3302
+ const nextLabel = this.t("viewport");
3303
+ this.viewport.setAttribute("aria-label", nextLabel);
3304
+ this.lastInferredAriaLabel = nextLabel;
3305
+ this.options.ariaLabel = nextLabel;
3306
+ }
3307
+ }
3308
+ if (this.thumbY) {
3309
+ this.thumbY.setAttribute("aria-label", this.t("verticalThumb"));
3310
+ }
3311
+ if (this.thumbX) {
3312
+ this.thumbX.setAttribute("aria-label", this.t("horizontalThumb"));
2888
3313
  }
2889
- this.viewport.setAttribute("role", "region");
2890
- this.viewport.setAttribute("aria-label", this.options.ariaLabel);
2891
3314
  }
2892
3315
  /**
2893
3316
  * Crée les rails et curseurs selon l'axe sélectionné.
@@ -2905,7 +3328,7 @@ var Wulf = (() => {
2905
3328
  this.thumbY.setAttribute("aria-valuenow", "0");
2906
3329
  this.thumbY.setAttribute("aria-valuemin", "0");
2907
3330
  this.thumbY.setAttribute("aria-valuemax", "100");
2908
- this.thumbY.setAttribute("aria-label", "D\xE9filement vertical");
3331
+ this.thumbY.setAttribute("aria-label", this.t("verticalThumb"));
2909
3332
  this.trackY.appendChild(this.thumbY);
2910
3333
  this.root.appendChild(this.trackY);
2911
3334
  this.attachTrackListeners(this.trackY, this.thumbY, "y");
@@ -2922,7 +3345,7 @@ var Wulf = (() => {
2922
3345
  this.thumbX.setAttribute("aria-valuenow", "0");
2923
3346
  this.thumbX.setAttribute("aria-valuemin", "0");
2924
3347
  this.thumbX.setAttribute("aria-valuemax", "100");
2925
- this.thumbX.setAttribute("aria-label", "D\xE9filement horizontal");
3348
+ this.thumbX.setAttribute("aria-label", this.t("horizontalThumb"));
2926
3349
  this.trackX.appendChild(this.thumbX);
2927
3350
  this.root.appendChild(this.trackX);
2928
3351
  this.attachTrackListeners(this.trackX, this.thumbX, "x");
@@ -3144,6 +3567,7 @@ var Wulf = (() => {
3144
3567
  * Recalcule les dimensions et la visibilité des barres.
3145
3568
  */
3146
3569
  update() {
3570
+ this.syncAccessibilityLabels();
3147
3571
  const { scrollHeight, clientHeight, scrollWidth, clientWidth } = this.viewport;
3148
3572
  const canScrollY = scrollHeight > clientHeight;
3149
3573
  const canScrollX = scrollWidth > clientWidth;
@@ -3205,6 +3629,18 @@ var Wulf = (() => {
3205
3629
  targetLeft = maxLeft;
3206
3630
  break;
3207
3631
  default: {
3632
+ if (/^-?\d+(\.\d+)?%$/.test(target.trim())) {
3633
+ const pct = Math.max(0, Math.min(100, parseFloat(target.trim()))) / 100;
3634
+ if (this.options.axis === "x") {
3635
+ targetLeft = maxLeft * pct;
3636
+ } else if (this.options.axis === "both") {
3637
+ targetTop = maxTop * pct;
3638
+ targetLeft = maxLeft * pct;
3639
+ } else {
3640
+ targetTop = maxTop * pct;
3641
+ }
3642
+ break;
3643
+ }
3208
3644
  let el = null;
3209
3645
  try {
3210
3646
  el = this.viewport.querySelector(target);
@@ -3264,13 +3700,27 @@ var Wulf = (() => {
3264
3700
  this.root.insertBefore(this.viewport.firstChild, this.viewport);
3265
3701
  }
3266
3702
  this.viewport.remove();
3703
+ } else {
3704
+ this.viewport.removeAttribute("tabindex");
3705
+ if (this.wasIdGenerated) {
3706
+ this.viewport.removeAttribute("id");
3707
+ }
3708
+ if (this.wasRoleInferred && this.viewport.getAttribute("role") === "region") {
3709
+ this.viewport.removeAttribute("role");
3710
+ }
3711
+ if (this.wasAriaLabelInferred && this.viewport.getAttribute("aria-label") === this.lastInferredAriaLabel) {
3712
+ this.viewport.removeAttribute("aria-label");
3713
+ }
3267
3714
  }
3268
3715
  }
3269
3716
  };
3717
+ ScrollBlock._i18n = scrollI18n;
3718
+ ScrollBlock.i18n = scrollI18n;
3270
3719
 
3271
3720
  // src/scroll/index.ts
3272
3721
  var Scroll = {
3273
- ScrollBlock
3722
+ ScrollBlock,
3723
+ i18n: scrollI18n
3274
3724
  };
3275
3725
  var scroll_default = ScrollBlock;
3276
3726
  if (typeof window !== "undefined") {
@@ -3284,8 +3734,13 @@ var Wulf = (() => {
3284
3734
  var masonry_exports = {};
3285
3735
  __export(masonry_exports, {
3286
3736
  LayoutEngine: () => LayoutEngine,
3737
+ LocalizedComponent: () => LocalizedComponent,
3287
3738
  Masonry: () => Masonry,
3288
- default: () => masonry_default
3739
+ createI18nManager: () => createI18nManager,
3740
+ default: () => masonry_default,
3741
+ masonryEn: () => masonryEn,
3742
+ masonryFr: () => masonryFr,
3743
+ masonryI18n: () => masonryI18n
3289
3744
  });
3290
3745
 
3291
3746
  // src/masonry/LayoutEngine.ts
@@ -3475,9 +3930,26 @@ var Wulf = (() => {
3475
3930
  }
3476
3931
  };
3477
3932
 
3933
+ // src/masonry/i18n/fr.ts
3934
+ var masonryFr = {
3935
+ gallery: "Galerie en grille asym\xE9trique"
3936
+ };
3937
+
3938
+ // src/masonry/i18n/en.ts
3939
+ var masonryEn = {
3940
+ gallery: "Masonry grid gallery"
3941
+ };
3942
+
3943
+ // src/masonry/i18n/index.ts
3944
+ var masonryI18n = createI18nManager("fr", {
3945
+ fr: masonryFr,
3946
+ en: masonryEn
3947
+ });
3948
+
3478
3949
  // src/masonry/Masonry.ts
3479
- var Masonry = class {
3950
+ var Masonry = class extends LocalizedComponent {
3480
3951
  constructor(target, options = {}) {
3952
+ super(options.i18n);
3481
3953
  this.isNativeCSSGrid = false;
3482
3954
  this._items = [];
3483
3955
  this.resizeObserver = null;
@@ -3486,6 +3958,8 @@ var Wulf = (() => {
3486
3958
  this.isDestroyed = false;
3487
3959
  this.wasRoleInferred = false;
3488
3960
  this.wasAriaLabelInferred = false;
3961
+ this.hasExplicitAriaLabel = false;
3962
+ this.lastInferredAriaLabel = "";
3489
3963
  this.removeTimers = /* @__PURE__ */ new Set();
3490
3964
  this.pendingImageListeners = [];
3491
3965
  if (typeof target === "string") {
@@ -3503,11 +3977,12 @@ var Wulf = (() => {
3503
3977
  height: this.root.style.height,
3504
3978
  width: this.root.style.width
3505
3979
  };
3980
+ this.hasExplicitAriaLabel = Boolean(options.ariaLabel);
3506
3981
  this.options = {
3507
3982
  itemSelector: options.itemSelector || "> *",
3508
3983
  columnWidth: options.columnWidth ?? 0,
3509
3984
  gutter: options.gutter ?? 0,
3510
- percentPosition: options.percentPosition !== false,
3985
+ percentPosition: Boolean(options.percentPosition),
3511
3986
  fitWidth: Boolean(options.fitWidth),
3512
3987
  horizontalOrder: Boolean(options.horizontalOrder),
3513
3988
  transitionDuration: options.transitionDuration !== void 0 ? options.transitionDuration : 300,
@@ -3516,7 +3991,8 @@ var Wulf = (() => {
3516
3991
  autoImages: options.autoImages !== false,
3517
3992
  useNativeCSSGrid: options.useNativeCSSGrid !== false,
3518
3993
  ariaRole: options.ariaRole || "region",
3519
- ariaLabel: options.ariaLabel || "Galerie en grille asym\xE9trique",
3994
+ ariaLabel: options.ariaLabel || this.t("gallery"),
3995
+ i18n: options.i18n || {},
3520
3996
  onLayout: options.onLayout || (() => {
3521
3997
  }),
3522
3998
  onItemPlaced: options.onItemPlaced || (() => {
@@ -3547,11 +4023,27 @@ var Wulf = (() => {
3547
4023
  this.root.setAttribute("role", this.options.ariaRole);
3548
4024
  this.wasRoleInferred = true;
3549
4025
  }
3550
- if (this.options.ariaLabel && !this.root.hasAttribute("aria-label")) {
3551
- this.root.setAttribute("aria-label", this.options.ariaLabel);
4026
+ const label = this.hasExplicitAriaLabel ? this.options.ariaLabel : this.t("gallery");
4027
+ if (label && !this.root.hasAttribute("aria-label")) {
4028
+ this.root.setAttribute("aria-label", label);
4029
+ this.lastInferredAriaLabel = label;
3552
4030
  this.wasAriaLabelInferred = true;
3553
4031
  }
3554
4032
  }
4033
+ /**
4034
+ * Synchronise dynamiquement le libellé ARIA si la langue globale change après montage.
4035
+ */
4036
+ syncAccessibilityLabels() {
4037
+ if (this.wasAriaLabelInferred && !this.hasExplicitAriaLabel) {
4038
+ const currentAttr = this.root.getAttribute("aria-label");
4039
+ if (currentAttr === this.lastInferredAriaLabel) {
4040
+ const nextLabel = this.t("gallery");
4041
+ this.root.setAttribute("aria-label", nextLabel);
4042
+ this.lastInferredAriaLabel = nextLabel;
4043
+ this.options.ariaLabel = nextLabel;
4044
+ }
4045
+ }
4046
+ }
3555
4047
  /**
3556
4048
  * Configure les variables CSS de transition sur le conteneur.
3557
4049
  */
@@ -3658,6 +4150,7 @@ var Wulf = (() => {
3658
4150
  */
3659
4151
  layout() {
3660
4152
  if (this.isDestroyed) return;
4153
+ this.syncAccessibilityLabels();
3661
4154
  if (this.isNativeCSSGrid) {
3662
4155
  this.options.onLayout([]);
3663
4156
  return;
@@ -3672,10 +4165,16 @@ var Wulf = (() => {
3672
4165
  this.root.classList.remove("wulf-masonry--fit-width");
3673
4166
  }
3674
4167
  const stagger = this.options.stagger;
4168
+ const usePercent = this.options.percentPosition && result.containerWidth > 0;
3675
4169
  for (let i = 0; i < result.positions.length; i++) {
3676
4170
  const pos = result.positions[i];
3677
4171
  const item = pos.element;
3678
- item.style.setProperty("--wulf-masonry-w", `${pos.width}px`);
4172
+ if (usePercent) {
4173
+ const wPct = Number((pos.width / result.containerWidth * 100).toFixed(4));
4174
+ item.style.setProperty("--wulf-masonry-w", `${wPct}%`);
4175
+ } else {
4176
+ item.style.setProperty("--wulf-masonry-w", `${pos.width}px`);
4177
+ }
3679
4178
  item.style.setProperty("--wulf-masonry-x", `${pos.x}px`);
3680
4179
  item.style.setProperty("--wulf-masonry-y", `${pos.y}px`);
3681
4180
  if (stagger > 0) {
@@ -3795,7 +4294,7 @@ var Wulf = (() => {
3795
4294
  if (this.wasRoleInferred && this.root.getAttribute("role") === this.options.ariaRole) {
3796
4295
  this.root.removeAttribute("role");
3797
4296
  }
3798
- if (this.wasAriaLabelInferred && this.root.getAttribute("aria-label") === this.options.ariaLabel) {
4297
+ if (this.wasAriaLabelInferred && this.root.getAttribute("aria-label") === this.lastInferredAriaLabel) {
3799
4298
  this.root.removeAttribute("aria-label");
3800
4299
  }
3801
4300
  this.root.style.removeProperty("--wulf-masonry-duration");
@@ -3819,6 +4318,8 @@ var Wulf = (() => {
3819
4318
  this._items = [];
3820
4319
  }
3821
4320
  };
4321
+ Masonry._i18n = masonryI18n;
4322
+ Masonry.i18n = masonryI18n;
3822
4323
 
3823
4324
  // src/masonry/index.ts
3824
4325
  var masonry_default = Masonry;
@@ -3828,17 +4329,39 @@ var Wulf = (() => {
3828
4329
  win.Wulf = wulfNamespace;
3829
4330
  wulfNamespace.Masonry = Object.assign(Masonry, {
3830
4331
  Masonry,
3831
- LayoutEngine
4332
+ LayoutEngine,
4333
+ i18n: masonryI18n
3832
4334
  });
3833
4335
  }
3834
4336
 
3835
4337
  // src/toast/index.ts
3836
4338
  var toast_exports = {};
3837
4339
  __export(toast_exports, {
4340
+ LocalizedComponent: () => LocalizedComponent,
3838
4341
  Toast: () => Toast,
3839
4342
  ToastInstance: () => ToastInstance,
3840
4343
  ToastManager: () => ToastManager,
3841
- default: () => toast_default
4344
+ createI18nManager: () => createI18nManager,
4345
+ default: () => toast_default,
4346
+ toastEn: () => toastEn,
4347
+ toastFr: () => toastFr,
4348
+ toastI18n: () => toastI18n
4349
+ });
4350
+
4351
+ // src/toast/i18n/fr.ts
4352
+ var toastFr = {
4353
+ closeButton: "Fermer la notification"
4354
+ };
4355
+
4356
+ // src/toast/i18n/en.ts
4357
+ var toastEn = {
4358
+ closeButton: "Close notification"
4359
+ };
4360
+
4361
+ // src/toast/i18n/index.ts
4362
+ var toastI18n = createI18nManager("fr", {
4363
+ fr: toastFr,
4364
+ en: toastEn
3842
4365
  });
3843
4366
 
3844
4367
  // src/toast/ToastInstance.ts
@@ -3912,12 +4435,12 @@ var Wulf = (() => {
3912
4435
  content.appendChild(messageEl);
3913
4436
  }
3914
4437
  el.appendChild(content);
3915
- const closable = this.options.closable !== void 0 ? this.options.closable : this.remainingTime === 0 || this.options.closable === true || true;
4438
+ const closable = this.options.closable ?? true;
3916
4439
  if (closable) {
3917
4440
  const closeBtn = document.createElement("button");
3918
4441
  closeBtn.type = "button";
3919
4442
  closeBtn.className = "wulf-toast-close";
3920
- closeBtn.setAttribute("aria-label", "Fermer la notification");
4443
+ closeBtn.setAttribute("aria-label", toastI18n.t("closeButton", this.options.i18n));
3921
4444
  closeBtn.setAttribute("tabindex", "0");
3922
4445
  const closeIcon = document.createElement("span");
3923
4446
  closeIcon.className = "wulf-toast-close-icon";
@@ -3953,6 +4476,9 @@ var Wulf = (() => {
3953
4476
  if (this.options.onClick) {
3954
4477
  this.options.onClick(this, e);
3955
4478
  }
4479
+ if (this.options.closeOnClick) {
4480
+ this.close("toast-click");
4481
+ }
3956
4482
  });
3957
4483
  this.element.addEventListener("mouseenter", () => this.pauseTimer());
3958
4484
  this.element.addEventListener("mouseleave", () => this.resumeTimer());
@@ -4042,9 +4568,14 @@ var Wulf = (() => {
4042
4568
  window.setTimeout(handleAnimationEnd, 90);
4043
4569
  } else {
4044
4570
  let transitioned = false;
4571
+ let fallbackTimerId = null;
4045
4572
  const onEnd = () => {
4046
4573
  if (!transitioned) {
4047
4574
  transitioned = true;
4575
+ if (fallbackTimerId !== null) {
4576
+ window.clearTimeout(fallbackTimerId);
4577
+ fallbackTimerId = null;
4578
+ }
4048
4579
  this.element.removeEventListener("animationend", onEnd);
4049
4580
  this.element.removeEventListener("transitionend", onEnd);
4050
4581
  handleAnimationEnd();
@@ -4052,7 +4583,7 @@ var Wulf = (() => {
4052
4583
  };
4053
4584
  this.element.addEventListener("animationend", onEnd, { once: true });
4054
4585
  this.element.addEventListener("transitionend", onEnd, { once: true });
4055
- window.setTimeout(onEnd, 300);
4586
+ fallbackTimerId = window.setTimeout(onEnd, 300);
4056
4587
  }
4057
4588
  });
4058
4589
  }
@@ -4216,7 +4747,7 @@ var Wulf = (() => {
4216
4747
  var ToastManager = _ToastManager;
4217
4748
 
4218
4749
  // src/toast/Toast.ts
4219
- var Toast = class {
4750
+ var Toast = class extends LocalizedComponent {
4220
4751
  /**
4221
4752
  * Affiche une nouvelle notification Toast avec les options spécifiées.
4222
4753
  */
@@ -4235,6 +4766,8 @@ var Wulf = (() => {
4235
4766
  return ToastManager.getInstance().clearAll(position);
4236
4767
  }
4237
4768
  };
4769
+ Toast._i18n = toastI18n;
4770
+ Toast.i18n = toastI18n;
4238
4771
 
4239
4772
  // src/toast/index.ts
4240
4773
  var toast_default = Toast;
@@ -4242,7 +4775,10 @@ var Wulf = (() => {
4242
4775
  const win = window;
4243
4776
  const wulfNamespace = win.Wulf || {};
4244
4777
  win.Wulf = wulfNamespace;
4245
- wulfNamespace.Toast = Toast;
4778
+ wulfNamespace.Toast = Object.assign(Toast, {
4779
+ Toast,
4780
+ i18n: toastI18n
4781
+ });
4246
4782
  }
4247
4783
  return __toCommonJS(index_exports);
4248
4784
  })();