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
package/dist/index.esm.js CHANGED
@@ -51,6 +51,7 @@ var BaseInputMask = class {
51
51
  this.onCutHandler = () => {
52
52
  };
53
53
  this.mutationObserver = null;
54
+ this.focusSelectTimerId = null;
54
55
  this.onBaseCopy = (e) => {
55
56
  if (!this.options.copyRaw || this.options.disabled || this.input.type === "password") return;
56
57
  const start = this.input.selectionStart ?? 0;
@@ -69,7 +70,11 @@ var BaseInputMask = class {
69
70
  this.onBaseFocus = () => {
70
71
  this.isFocused = true;
71
72
  if (this.options.selectAllOnFocus && this.input.value.length > 0) {
72
- setTimeout(() => {
73
+ if (this.focusSelectTimerId !== null) {
74
+ clearTimeout(this.focusSelectTimerId);
75
+ }
76
+ this.focusSelectTimerId = window.setTimeout(() => {
77
+ this.focusSelectTimerId = null;
73
78
  if (!this.isDestroyed && document.activeElement === this.input) {
74
79
  this.input.select();
75
80
  }
@@ -88,7 +93,7 @@ var BaseInputMask = class {
88
93
  }
89
94
  };
90
95
  const { wrapper: providedWrapper, input, options } = resolveMaskConstructorArgs(targetOrWrapper, inputOrOptions, maybeOptions);
91
- if (!input || !(input instanceof HTMLElement) || input.tagName !== "INPUT") {
96
+ if (!input || typeof input !== "object" || input.nodeType !== 1 || input.tagName !== "INPUT") {
92
97
  throw new Error(`[${new.target.name || "InputMask"}] input (HTMLInputElement) est requis.`);
93
98
  }
94
99
  this.input = input;
@@ -213,6 +218,8 @@ var BaseInputMask = class {
213
218
  "data-mask-pad-decimals",
214
219
  "data-mask-auto-lowercase",
215
220
  "data-mask-cycle-suggestions",
221
+ "data-mask-default-tld",
222
+ "data-mask-tlds",
216
223
  "data-disabled",
217
224
  "data-mask-align",
218
225
  "data-align",
@@ -483,6 +490,10 @@ var BaseInputMask = class {
483
490
  destroy() {
484
491
  if (this.isDestroyed) return;
485
492
  this.isDestroyed = true;
493
+ if (this.focusSelectTimerId !== null) {
494
+ clearTimeout(this.focusSelectTimerId);
495
+ this.focusSelectTimerId = null;
496
+ }
486
497
  if (this.mutationObserver) {
487
498
  this.mutationObserver.disconnect();
488
499
  this.mutationObserver = null;
@@ -1244,6 +1255,9 @@ var InputMask = class extends BaseInputMask {
1244
1255
  this.onChangeNativeHandler = () => {
1245
1256
  };
1246
1257
  this.wasInputModeInferred = false;
1258
+ this.cutTimerId = null;
1259
+ this.pasteTimerId = null;
1260
+ this.resetTimerId = null;
1247
1261
  this.history = new MaskHistory();
1248
1262
  this.engine = new MaskEngine(this.options.mask || "", {
1249
1263
  placeholderChar: this.options.placeholderChar,
@@ -1251,12 +1265,7 @@ var InputMask = class extends BaseInputMask {
1251
1265
  strict: this.options.strict,
1252
1266
  autoLowercase: this.options.autoLowercase
1253
1267
  });
1254
- if (this.options.inferInputMode && !this.input.hasAttribute("inputmode")) {
1255
- if (this.engine.isNumericOnly()) {
1256
- this.input.inputMode = "numeric";
1257
- this.wasInputModeInferred = true;
1258
- }
1259
- }
1268
+ this.syncInferredInputMode();
1260
1269
  this.keyboard = new MaskKeyboard({
1261
1270
  getInput: () => this.input,
1262
1271
  getEngine: () => this.engine,
@@ -1320,7 +1329,9 @@ var InputMask = class extends BaseInputMask {
1320
1329
  this.onScroll = this.onScroll.bind(this);
1321
1330
  this.onBeforeInput = this.onBeforeInput.bind(this);
1322
1331
  this.onCutHandler = () => {
1323
- setTimeout(() => {
1332
+ if (this.cutTimerId !== null) clearTimeout(this.cutTimerId);
1333
+ this.cutTimerId = window.setTimeout(() => {
1334
+ this.cutTimerId = null;
1324
1335
  if (this.isDestroyed) return;
1325
1336
  if (this.options.disabled) {
1326
1337
  this.checkValueChange();
@@ -1352,7 +1363,9 @@ var InputMask = class extends BaseInputMask {
1352
1363
  this.input.addEventListener("change", this.onChangeNativeHandler);
1353
1364
  if (this.input.form) {
1354
1365
  this.onFormResetHandler = () => {
1355
- setTimeout(() => {
1366
+ if (this.resetTimerId !== null) clearTimeout(this.resetTimerId);
1367
+ this.resetTimerId = window.setTimeout(() => {
1368
+ this.resetTimerId = null;
1356
1369
  if (this.isDestroyed) return;
1357
1370
  if (this.options.disabled) {
1358
1371
  this.checkValueChange();
@@ -1364,11 +1377,40 @@ var InputMask = class extends BaseInputMask {
1364
1377
  this.input.form.addEventListener("reset", this.onFormResetHandler);
1365
1378
  }
1366
1379
  }
1380
+ /**
1381
+ * Synchronise dynamiquement l'attribut inputmode="numeric" selon le motif actif
1382
+ * sans jamais écraser un inputmode défini explicitement par l'hôte.
1383
+ */
1384
+ syncInferredInputMode() {
1385
+ if (!this.options.inferInputMode) return;
1386
+ const isNum = !this.options.disabled && this.engine.isNumericOnly();
1387
+ if (isNum) {
1388
+ if (!this.input.hasAttribute("inputmode")) {
1389
+ this.input.inputMode = "numeric";
1390
+ this.wasInputModeInferred = true;
1391
+ }
1392
+ } else if (this.wasInputModeInferred && this.input.getAttribute("inputmode") === "numeric") {
1393
+ this.input.removeAttribute("inputmode");
1394
+ this.wasInputModeInferred = false;
1395
+ }
1396
+ }
1367
1397
  /**
1368
1398
  * Supprime tous les écouteurs et nettoie les attributs associés.
1369
1399
  */
1370
1400
  destroy() {
1371
1401
  if (this.isDestroyed) return;
1402
+ if (this.cutTimerId !== null) {
1403
+ clearTimeout(this.cutTimerId);
1404
+ this.cutTimerId = null;
1405
+ }
1406
+ if (this.pasteTimerId !== null) {
1407
+ clearTimeout(this.pasteTimerId);
1408
+ this.pasteTimerId = null;
1409
+ }
1410
+ if (this.resetTimerId !== null) {
1411
+ clearTimeout(this.resetTimerId);
1412
+ this.resetTimerId = null;
1413
+ }
1372
1414
  this.input.removeEventListener("beforeinput", this.onBeforeInput);
1373
1415
  this.input.removeEventListener("input", this.handleInput);
1374
1416
  this.input.removeEventListener("keydown", this.onKeyDown);
@@ -1430,6 +1472,7 @@ var InputMask = class extends BaseInputMask {
1430
1472
  this.history.clear();
1431
1473
  }
1432
1474
  this.setDisabled(true);
1475
+ this.syncInferredInputMode();
1433
1476
  return;
1434
1477
  }
1435
1478
  this.options.mask = newPattern;
@@ -1440,6 +1483,7 @@ var InputMask = class extends BaseInputMask {
1440
1483
  this.history.clear();
1441
1484
  }
1442
1485
  this.setDisabled(false);
1486
+ this.syncInferredInputMode();
1443
1487
  }
1444
1488
  handleAttributeMutation(attrName) {
1445
1489
  super.handleAttributeMutation(attrName);
@@ -1597,7 +1641,9 @@ var InputMask = class extends BaseInputMask {
1597
1641
  }
1598
1642
  onPaste(e) {
1599
1643
  if (this.options.disabled) {
1600
- setTimeout(() => {
1644
+ if (this.pasteTimerId !== null) clearTimeout(this.pasteTimerId);
1645
+ this.pasteTimerId = window.setTimeout(() => {
1646
+ this.pasteTimerId = null;
1601
1647
  if (!this.isDestroyed) this.checkValueChange();
1602
1648
  }, 0);
1603
1649
  return;
@@ -2406,9 +2452,12 @@ var InputAmountMask = class extends BaseInputMask {
2406
2452
  var _EmailEngine = class _EmailEngine {
2407
2453
  constructor(options = {}) {
2408
2454
  this.defaultDomain = null;
2455
+ this.defaultTld = "__";
2409
2456
  this.domains = options.domains && options.domains.length > 0 ? options.domains : _EmailEngine.DEFAULT_DOMAINS;
2457
+ this.tlds = options.tlds && options.tlds.length > 0 ? options.tlds.map((t) => t.trim().replace(/^\./, "")).filter(Boolean) : [..._EmailEngine.DEFAULT_TLDS];
2410
2458
  this.suggestOnAt = options.suggestOnAt ?? true;
2411
2459
  this.setDefaultDomain(options.defaultDomain ?? null);
2460
+ this.setDefaultTld(options.defaultTld !== void 0 ? options.defaultTld : "__");
2412
2461
  }
2413
2462
  /**
2414
2463
  * Définit ou modifie le domaine suggéré par défaut.
@@ -2422,6 +2471,35 @@ var _EmailEngine = class _EmailEngine {
2422
2471
  this.defaultDomain = null;
2423
2472
  }
2424
2473
  }
2474
+ /**
2475
+ * Définit ou modifie l'extension (TLD) ou gabarit suggéré par défaut sur un domaine inconnu.
2476
+ */
2477
+ setDefaultTld(tld) {
2478
+ if (tld === true) {
2479
+ this.defaultTld = this.tlds.length > 0 ? this.tlds[0] : null;
2480
+ } else if (typeof tld === "string" && tld.trim().length > 0) {
2481
+ this.defaultTld = tld.trim().replace(/^\./, "");
2482
+ } else {
2483
+ this.defaultTld = null;
2484
+ }
2485
+ }
2486
+ /**
2487
+ * Définit ou modifie la liste des extensions (TLD) proposées par ordre de priorité.
2488
+ */
2489
+ setTlds(tlds) {
2490
+ this.tlds = tlds && tlds.length > 0 ? tlds.map((t) => t.trim().replace(/^\./, "")).filter(Boolean) : [..._EmailEngine.DEFAULT_TLDS];
2491
+ }
2492
+ /**
2493
+ * Retourne l'ensemble des extensions (TLD) correspondant au fragment saisi après le dernier point,
2494
+ * dans l'ordre exact fourni par l'utilisateur.
2495
+ */
2496
+ getMatchingTlds(tldInput) {
2497
+ const query = (tldInput ?? "").toLowerCase();
2498
+ if (query.length === 0) {
2499
+ return [...this.tlds];
2500
+ }
2501
+ return this.tlds.filter((t) => t.toLowerCase().startsWith(query) && t.toLowerCase() !== query);
2502
+ }
2425
2503
  /**
2426
2504
  * Retourne l'ensemble des domaines correspondant à la saisie courante.
2427
2505
  */
@@ -2442,10 +2520,10 @@ var _EmailEngine = class _EmailEngine {
2442
2520
  return this.domains.filter((d) => d.toLowerCase().startsWith(query) && d.toLowerCase() !== query);
2443
2521
  }
2444
2522
  /**
2445
- * Analyse la saisie courante et calcule la suggestion de domaine adaptée.
2523
+ * Analyse la saisie courante et calcule la suggestion de domaine ou d'extension (TLD) adaptée.
2446
2524
  *
2447
2525
  * @param input Saisie utilisateur
2448
- * @param matchIndex Index de la suggestion à sélectionner si plusieurs domaines correspondent (permet le cyclage)
2526
+ * @param matchIndex Index de la suggestion à sélectionner si plusieurs domaines/TLD correspondent (permet le cyclage)
2449
2527
  */
2450
2528
  getSuggestion(input, matchIndex = 0) {
2451
2529
  const val = input ?? "";
@@ -2454,30 +2532,104 @@ var _EmailEngine = class _EmailEngine {
2454
2532
  return {
2455
2533
  full: val ? `${val}@${this.defaultDomain}` : `@${this.defaultDomain}`,
2456
2534
  remaining: `@${this.defaultDomain}`,
2457
- matchedDomain: this.defaultDomain
2535
+ matchedDomain: this.defaultDomain,
2536
+ isHintOnly: false
2458
2537
  };
2459
2538
  }
2460
- return { full: val, remaining: "", matchedDomain: null };
2539
+ return { full: val, remaining: "", matchedDomain: null, isHintOnly: false };
2461
2540
  }
2462
2541
  const atIndex = val.indexOf("@");
2463
2542
  const localPart = val.substring(0, atIndex);
2464
2543
  const domainPart = val.substring(atIndex + 1);
2465
2544
  if (val.indexOf("@", atIndex + 1) !== -1) {
2466
- return { full: val, remaining: "", matchedDomain: null };
2545
+ return { full: val, remaining: "", matchedDomain: null, isHintOnly: false };
2467
2546
  }
2468
2547
  const matches = this.getMatchingDomains(input);
2469
- if (matches.length === 0) {
2470
- return { full: input, remaining: "", matchedDomain: null };
2548
+ if (matches.length > 0) {
2549
+ const safeIndex = (matchIndex % matches.length + matches.length) % matches.length;
2550
+ const matched = matches[safeIndex];
2551
+ const query = domainPart.toLowerCase();
2552
+ const remaining = matched.substring(query.length);
2553
+ return {
2554
+ full: `${localPart}@${matched}`,
2555
+ remaining,
2556
+ matchedDomain: matched,
2557
+ isHintOnly: false
2558
+ };
2471
2559
  }
2472
- const safeIndex = (matchIndex % matches.length + matches.length) % matches.length;
2473
- const matched = matches[safeIndex];
2474
- const query = domainPart.toLowerCase();
2475
- const remaining = matched.substring(query.length);
2476
- return {
2477
- full: `${localPart}@${matched}`,
2478
- remaining,
2479
- matchedDomain: matched
2480
- };
2560
+ if (domainPart.length === 0 || domainPart.startsWith(".")) {
2561
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2562
+ }
2563
+ const lowerDomain = domainPart.toLowerCase();
2564
+ if (this.domains.some((d) => d.toLowerCase() === lowerDomain)) {
2565
+ return { full: input, remaining: "", matchedDomain: domainPart, isHintOnly: false };
2566
+ }
2567
+ const lastDotIndex = domainPart.lastIndexOf(".");
2568
+ if (lastDotIndex === -1) {
2569
+ if (!this.defaultTld) {
2570
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2571
+ }
2572
+ const isHint = this.defaultTld.includes("_");
2573
+ const remaining = `.${this.defaultTld}`;
2574
+ const fullDomain = `${domainPart}.${this.defaultTld}`;
2575
+ return {
2576
+ full: isHint ? input : `${localPart}@${fullDomain}`,
2577
+ remaining,
2578
+ matchedDomain: isHint ? null : fullDomain,
2579
+ isHintOnly: isHint
2580
+ };
2581
+ }
2582
+ const hostPart = domainPart.substring(0, lastDotIndex);
2583
+ const tldPart = domainPart.substring(lastDotIndex + 1);
2584
+ if (!hostPart || hostPart.endsWith(".")) {
2585
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2586
+ }
2587
+ if (tldPart.length === 0) {
2588
+ if (this.defaultTld && !this.defaultTld.includes("_")) {
2589
+ const fullDomain = `${hostPart}.${this.defaultTld}`;
2590
+ return {
2591
+ full: `${localPart}@${fullDomain}`,
2592
+ remaining: this.defaultTld,
2593
+ matchedDomain: fullDomain,
2594
+ isHintOnly: false
2595
+ };
2596
+ }
2597
+ if (this.defaultTld && this.defaultTld.includes("_")) {
2598
+ return {
2599
+ full: input,
2600
+ remaining: this.defaultTld,
2601
+ matchedDomain: null,
2602
+ isHintOnly: true
2603
+ };
2604
+ }
2605
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2606
+ }
2607
+ const lowerTld = tldPart.toLowerCase();
2608
+ const matchingTlds = this.getMatchingTlds(tldPart);
2609
+ if (matchingTlds.length > 0) {
2610
+ const safeTldIndex = (matchIndex % matchingTlds.length + matchingTlds.length) % matchingTlds.length;
2611
+ const matchedTld = matchingTlds[safeTldIndex];
2612
+ const remaining = matchedTld.substring(lowerTld.length);
2613
+ const fullDomain = `${hostPart}.${matchedTld}`;
2614
+ return {
2615
+ full: `${localPart}@${fullDomain}`,
2616
+ remaining,
2617
+ matchedDomain: fullDomain,
2618
+ isHintOnly: false
2619
+ };
2620
+ }
2621
+ if (this.defaultTld && this.defaultTld.includes("_") && tldPart.length < this.defaultTld.length) {
2622
+ const remaining = this.defaultTld.substring(tldPart.length);
2623
+ if (remaining.includes("_")) {
2624
+ return {
2625
+ full: input,
2626
+ remaining,
2627
+ matchedDomain: null,
2628
+ isHintOnly: true
2629
+ };
2630
+ }
2631
+ }
2632
+ return { full: input, remaining: "", matchedDomain: null, isHintOnly: false };
2481
2633
  }
2482
2634
  };
2483
2635
  _EmailEngine.DEFAULT_DOMAINS = [
@@ -2492,6 +2644,27 @@ _EmailEngine.DEFAULT_DOMAINS = [
2492
2644
  "laposte.net",
2493
2645
  "proton.me"
2494
2646
  ];
2647
+ _EmailEngine.DEFAULT_TLDS = [
2648
+ "com",
2649
+ "fr",
2650
+ "net",
2651
+ "org",
2652
+ "eu",
2653
+ "io",
2654
+ "co",
2655
+ "info",
2656
+ "biz",
2657
+ "me",
2658
+ "tv",
2659
+ "fi",
2660
+ "be",
2661
+ "ch",
2662
+ "ca",
2663
+ "uk",
2664
+ "de",
2665
+ "es",
2666
+ "it"
2667
+ ];
2495
2668
  var EmailEngine = _EmailEngine;
2496
2669
 
2497
2670
  // src/mask/InputEmailMask.ts
@@ -2505,6 +2678,10 @@ var InputEmailMask = class extends BaseInputMask {
2505
2678
  const dataAutoLower = wrap?.getAttribute("data-mask-auto-lowercase") === "true" || inp?.getAttribute("data-mask-auto-lowercase") === "true";
2506
2679
  const dataAriaAuto = wrap?.getAttribute("data-mask-aria-autocomplete") ?? inp?.getAttribute("data-mask-aria-autocomplete");
2507
2680
  const setAriaAutocomplete = opts.setAriaAutocomplete ?? (dataAriaAuto !== null ? dataAriaAuto !== "false" : true);
2681
+ const dataTlds = wrap?.getAttribute("data-mask-tlds") ?? inp?.getAttribute("data-mask-tlds");
2682
+ const parsedTlds = opts.tlds ?? (dataTlds ? dataTlds.split(",").map((s) => s.trim()).filter(Boolean) : void 0);
2683
+ const dataDefaultTld = wrap?.getAttribute("data-mask-default-tld") ?? inp?.getAttribute("data-mask-default-tld");
2684
+ const resolvedDefaultTld = opts.defaultTld !== void 0 ? opts.defaultTld : dataDefaultTld !== null ? dataDefaultTld === "false" || dataDefaultTld === "none" ? null : dataDefaultTld === "true" ? true : dataDefaultTld : void 0;
2508
2685
  const resolvedOptions = {
2509
2686
  completeOnTab: true,
2510
2687
  completeOnArrowRight: true,
@@ -2512,7 +2689,9 @@ var InputEmailMask = class extends BaseInputMask {
2512
2689
  cycleSuggestions: opts.cycleSuggestions ?? dataCycle ?? false,
2513
2690
  autoLowercase: opts.autoLowercase ?? dataAutoLower ?? false,
2514
2691
  setAriaAutocomplete,
2515
- ...opts
2692
+ ...opts,
2693
+ ...parsedTlds !== void 0 ? { tlds: parsedTlds } : {},
2694
+ ...resolvedDefaultTld !== void 0 ? { defaultTld: resolvedDefaultTld } : {}
2516
2695
  };
2517
2696
  super(wrap, inp, resolvedOptions);
2518
2697
  this.currentSuggestion = { full: "", remaining: "", matchedDomain: null };
@@ -2625,7 +2804,7 @@ var InputEmailMask = class extends BaseInputMask {
2625
2804
  }
2626
2805
  handleKeyDown(e) {
2627
2806
  if (this.options.disabled) return;
2628
- const hasSuggestion = Boolean(this.currentSuggestion.remaining);
2807
+ const hasSuggestion = Boolean(this.currentSuggestion.remaining) && !this.currentSuggestion.isHintOnly;
2629
2808
  const cursor = this.input.selectionStart ?? 0;
2630
2809
  const isAtEnd = cursor === this.input.value.length;
2631
2810
  const isNotEmpty = this.input.value.length > 0;
@@ -2663,7 +2842,7 @@ var InputEmailMask = class extends BaseInputMask {
2663
2842
  * Valide et applique la suggestion courante dans le champ natif.
2664
2843
  */
2665
2844
  acceptSuggestion() {
2666
- if (!this.currentSuggestion.remaining || this.options.disabled || this.input.value.length === 0) return false;
2845
+ if (!this.currentSuggestion.remaining || this.currentSuggestion.isHintOnly || this.options.disabled || this.input.value.length === 0) return false;
2667
2846
  const completed = this.currentSuggestion.full;
2668
2847
  this.setNativeValue(completed);
2669
2848
  this.input.setSelectionRange(completed.length, completed.length);
@@ -2684,6 +2863,21 @@ var InputEmailMask = class extends BaseInputMask {
2684
2863
  this.engine.setDefaultDomain(domain);
2685
2864
  this.updateSuggestion();
2686
2865
  }
2866
+ /**
2867
+ * Modifie dynamiquement l'extension (TLD) ou gabarit suggéré par défaut sur un domaine inconnu.
2868
+ */
2869
+ setDefaultTld(tld) {
2870
+ this.engine.setDefaultTld(tld);
2871
+ this.updateSuggestion();
2872
+ }
2873
+ /**
2874
+ * Modifie dynamiquement la liste des extensions (TLD) connues.
2875
+ */
2876
+ setTlds(tlds) {
2877
+ this.engine.setTlds(tlds);
2878
+ this.currentSuggestionIndex = 0;
2879
+ this.updateSuggestion();
2880
+ }
2687
2881
  handleFocus() {
2688
2882
  this.wrapper.classList.add("is-focused");
2689
2883
  this.syncGhostStyles();
@@ -2704,6 +2898,12 @@ var InputEmailMask = class extends BaseInputMask {
2704
2898
  this.options.cycleSuggestions = this.getAttr("data-mask-cycle-suggestions") === "true";
2705
2899
  } else if (attrName === "data-mask-auto-lowercase") {
2706
2900
  this.options.autoLowercase = this.getAttr("data-mask-auto-lowercase") === "true";
2901
+ } else if (attrName === "data-mask-default-tld") {
2902
+ const val = this.getAttr("data-mask-default-tld");
2903
+ this.setDefaultTld(val === null || val === "false" || val === "none" ? null : val === "true" ? true : val);
2904
+ } else if (attrName === "data-mask-tlds") {
2905
+ const val = this.getAttr("data-mask-tlds");
2906
+ this.setTlds(val ? val.split(",").map((s) => s.trim()).filter(Boolean) : null);
2707
2907
  } else if (attrName === "placeholder") {
2708
2908
  this.updateSuggestion();
2709
2909
  }
@@ -2711,7 +2911,7 @@ var InputEmailMask = class extends BaseInputMask {
2711
2911
  getDetail() {
2712
2912
  return {
2713
2913
  value: this.input.value,
2714
- suggestedValue: this.currentSuggestion.full,
2914
+ suggestedValue: this.currentSuggestion.isHintOnly ? "" : this.currentSuggestion.full,
2715
2915
  domain: this.currentSuggestion.matchedDomain
2716
2916
  };
2717
2917
  }
@@ -2769,16 +2969,206 @@ var mask_default = InputMask;
2769
2969
  // src/scroll/index.ts
2770
2970
  var scroll_exports = {};
2771
2971
  __export(scroll_exports, {
2972
+ LocalizedComponent: () => LocalizedComponent,
2772
2973
  Scroll: () => Scroll,
2773
2974
  ScrollBlock: () => ScrollBlock,
2774
- default: () => scroll_default
2975
+ createI18nManager: () => createI18nManager,
2976
+ default: () => scroll_default,
2977
+ scrollEn: () => scrollEn,
2978
+ scrollFr: () => scrollFr,
2979
+ scrollI18n: () => scrollI18n
2980
+ });
2981
+
2982
+ // src/common/LocalizedComponent.ts
2983
+ var LocalizedComponent = class {
2984
+ /**
2985
+ * Définit la langue globale du composant (ex: 'fr', 'en', 'es').
2986
+ */
2987
+ static setLocale(locale) {
2988
+ if (this._i18n) {
2989
+ this._i18n.setLocale(locale);
2990
+ }
2991
+ }
2992
+ /**
2993
+ * Retourne la langue globale active du composant.
2994
+ */
2995
+ static getLocale() {
2996
+ return this._i18n ? this._i18n.getLocale() : "";
2997
+ }
2998
+ /**
2999
+ * Enregistre un dictionnaire de traduction pour une langue donnée.
3000
+ */
3001
+ static registerLocale(locale, translations) {
3002
+ if (this._i18n) {
3003
+ this._i18n.registerLocale(locale, translations);
3004
+ }
3005
+ }
3006
+ /**
3007
+ * Surcharge les libellés globalement pour ce composant.
3008
+ */
3009
+ static setI18n(overrides) {
3010
+ if (this._i18n) {
3011
+ this._i18n.setI18n(overrides);
3012
+ }
3013
+ }
3014
+ /**
3015
+ * Retourne l'ensemble des libellés actifs résolus du composant.
3016
+ */
3017
+ static getI18n() {
3018
+ return this._i18n ? this._i18n.getAll() : {};
3019
+ }
3020
+ /**
3021
+ * Réinitialise les réglages de langue et surcharges globales.
3022
+ */
3023
+ static resetI18n() {
3024
+ if (this._i18n) {
3025
+ this._i18n.reset();
3026
+ }
3027
+ }
3028
+ /**
3029
+ * Résout une clé au niveau statique de la classe.
3030
+ */
3031
+ static t(key, instanceOverride) {
3032
+ return this._i18n ? this._i18n.t(key, instanceOverride) : String(key);
3033
+ }
3034
+ constructor(i18nOverrides) {
3035
+ this.i18nOverrides = i18nOverrides;
3036
+ }
3037
+ /**
3038
+ * Traduit une clé en tenant compte automatiquement des surcharges de l'instance courante.
3039
+ */
3040
+ t(key) {
3041
+ const ctor = this.constructor;
3042
+ return ctor._i18n ? ctor._i18n.t(key, this.i18nOverrides) : String(key);
3043
+ }
3044
+ };
3045
+
3046
+ // src/common/i18n.ts
3047
+ function normalizeLocaleCode(locale) {
3048
+ return locale.trim().toLowerCase().replace(/_/g, "-");
3049
+ }
3050
+ function getPrimaryLanguage(normalizedLocale) {
3051
+ const dashIndex = normalizedLocale.indexOf("-");
3052
+ return dashIndex > 0 ? normalizedLocale.slice(0, dashIndex) : null;
3053
+ }
3054
+ function assignDefined(target, source) {
3055
+ if (!source) return target;
3056
+ for (const key of Object.keys(source)) {
3057
+ if (source[key] !== void 0) {
3058
+ target[key] = source[key];
3059
+ }
3060
+ }
3061
+ return target;
3062
+ }
3063
+ function createI18nManager(defaultLocale, locales) {
3064
+ const fallbackLocale = normalizeLocaleCode(defaultLocale);
3065
+ const initialLocales = {};
3066
+ for (const [loc, dict] of Object.entries(locales)) {
3067
+ initialLocales[normalizeLocaleCode(loc)] = { ...dict };
3068
+ }
3069
+ let currentLocale = fallbackLocale;
3070
+ let activeLocales = { ...initialLocales };
3071
+ let globalOverrides = {};
3072
+ function resolveActiveDictionaries() {
3073
+ const dicts = [];
3074
+ const exact = activeLocales[currentLocale];
3075
+ if (exact) dicts.push(exact);
3076
+ const primary = getPrimaryLanguage(currentLocale);
3077
+ if (primary && activeLocales[primary]) {
3078
+ dicts.push(activeLocales[primary]);
3079
+ }
3080
+ return dicts;
3081
+ }
3082
+ return {
3083
+ setLocale(locale) {
3084
+ if (locale && locale.trim()) {
3085
+ currentLocale = normalizeLocaleCode(locale);
3086
+ }
3087
+ },
3088
+ getLocale() {
3089
+ return currentLocale;
3090
+ },
3091
+ registerLocale(locale, translations) {
3092
+ if (!locale || !locale.trim() || !translations) return;
3093
+ const norm = normalizeLocaleCode(locale);
3094
+ activeLocales[norm] = assignDefined({ ...activeLocales[norm] || {} }, translations);
3095
+ },
3096
+ setI18n(overrides) {
3097
+ if (!overrides) return;
3098
+ globalOverrides = assignDefined({ ...globalOverrides }, overrides);
3099
+ },
3100
+ t(key, instanceOverride) {
3101
+ if (instanceOverride && instanceOverride[key] !== void 0) {
3102
+ return String(instanceOverride[key]);
3103
+ }
3104
+ if (globalOverrides[key] !== void 0) {
3105
+ return String(globalOverrides[key]);
3106
+ }
3107
+ for (const dict of resolveActiveDictionaries()) {
3108
+ if (dict[key] !== void 0) {
3109
+ return String(dict[key]);
3110
+ }
3111
+ }
3112
+ const fallbackDict = activeLocales[fallbackLocale] || initialLocales[fallbackLocale];
3113
+ if (fallbackDict && fallbackDict[key] !== void 0) {
3114
+ return String(fallbackDict[key]);
3115
+ }
3116
+ return String(key);
3117
+ },
3118
+ getAll(instanceOverride) {
3119
+ const result = {};
3120
+ const fallback = activeLocales[fallbackLocale] || initialLocales[fallbackLocale];
3121
+ assignDefined(result, fallback);
3122
+ const activeDicts = resolveActiveDictionaries().reverse();
3123
+ for (const dict of activeDicts) {
3124
+ assignDefined(result, dict);
3125
+ }
3126
+ assignDefined(result, globalOverrides);
3127
+ assignDefined(result, instanceOverride);
3128
+ return result;
3129
+ },
3130
+ reset() {
3131
+ currentLocale = fallbackLocale;
3132
+ globalOverrides = {};
3133
+ activeLocales = {};
3134
+ for (const [loc, dict] of Object.entries(initialLocales)) {
3135
+ activeLocales[loc] = { ...dict };
3136
+ }
3137
+ }
3138
+ };
3139
+ }
3140
+
3141
+ // src/scroll/i18n/fr.ts
3142
+ var scrollFr = {
3143
+ viewport: "Zone de contenu d\xE9filable",
3144
+ verticalThumb: "D\xE9filement vertical",
3145
+ horizontalThumb: "D\xE9filement horizontal"
3146
+ };
3147
+
3148
+ // src/scroll/i18n/en.ts
3149
+ var scrollEn = {
3150
+ viewport: "Scrollable content area",
3151
+ verticalThumb: "Vertical scroll",
3152
+ horizontalThumb: "Horizontal scroll"
3153
+ };
3154
+
3155
+ // src/scroll/i18n/index.ts
3156
+ var scrollI18n = createI18nManager("fr", {
3157
+ fr: scrollFr,
3158
+ en: scrollEn
2775
3159
  });
2776
3160
 
2777
3161
  // src/scroll/ScrollBlock.ts
2778
3162
  var idCounter = 0;
2779
- var ScrollBlock = class {
3163
+ var ScrollBlock = class extends LocalizedComponent {
2780
3164
  constructor(element, options) {
3165
+ super(options?.i18n);
2781
3166
  this.createdViewport = false;
3167
+ this.wasIdGenerated = false;
3168
+ this.wasRoleInferred = false;
3169
+ this.wasAriaLabelInferred = false;
3170
+ this.hasExplicitAriaLabel = false;
3171
+ this.lastInferredAriaLabel = "";
2782
3172
  this.isDragging = false;
2783
3173
  this.dragStartPos = 0;
2784
3174
  this.dragStartScroll = 0;
@@ -2791,12 +3181,14 @@ var ScrollBlock = class {
2791
3181
  throw new Error(`[ScrollBlock] \xC9l\xE9ment introuvable : "${element}".`);
2792
3182
  }
2793
3183
  this.root = resolvedElement;
3184
+ this.hasExplicitAriaLabel = Boolean(options?.ariaLabel);
2794
3185
  this.options = {
2795
3186
  axis: options?.axis || "y",
2796
3187
  autoHide: options?.autoHide ?? true,
2797
3188
  autoHideDelay: options?.autoHideDelay ?? 1e3,
2798
3189
  alwaysVisible: options?.alwaysVisible ?? false,
2799
- ariaLabel: options?.ariaLabel || "Zone de contenu d\xE9filable",
3190
+ ariaLabel: options?.ariaLabel || this.t("viewport"),
3191
+ i18n: options?.i18n || {},
2800
3192
  minThumbSize: options?.minThumbSize ?? 24,
2801
3193
  edgeThreshold: options?.edgeThreshold ?? 10,
2802
3194
  onScroll: options?.onScroll || (() => {
@@ -2851,9 +3243,38 @@ var ScrollBlock = class {
2851
3243
  if (!this.viewport.id) {
2852
3244
  idCounter += 1;
2853
3245
  this.viewport.id = `wulf-scrollblock-vp-${idCounter}`;
3246
+ this.wasIdGenerated = true;
3247
+ }
3248
+ if (!this.viewport.hasAttribute("role")) {
3249
+ this.viewport.setAttribute("role", "region");
3250
+ this.wasRoleInferred = true;
3251
+ }
3252
+ if (!this.viewport.hasAttribute("aria-label")) {
3253
+ const label = this.hasExplicitAriaLabel ? this.options.ariaLabel : this.t("viewport");
3254
+ this.viewport.setAttribute("aria-label", label);
3255
+ this.lastInferredAriaLabel = label;
3256
+ this.wasAriaLabelInferred = true;
3257
+ }
3258
+ }
3259
+ /**
3260
+ * Synchronise dynamiquement les libellés ARIA si la langue globale change après montage.
3261
+ */
3262
+ syncAccessibilityLabels() {
3263
+ if (this.wasAriaLabelInferred && !this.hasExplicitAriaLabel) {
3264
+ const currentAttr = this.viewport.getAttribute("aria-label");
3265
+ if (currentAttr === this.lastInferredAriaLabel) {
3266
+ const nextLabel = this.t("viewport");
3267
+ this.viewport.setAttribute("aria-label", nextLabel);
3268
+ this.lastInferredAriaLabel = nextLabel;
3269
+ this.options.ariaLabel = nextLabel;
3270
+ }
3271
+ }
3272
+ if (this.thumbY) {
3273
+ this.thumbY.setAttribute("aria-label", this.t("verticalThumb"));
3274
+ }
3275
+ if (this.thumbX) {
3276
+ this.thumbX.setAttribute("aria-label", this.t("horizontalThumb"));
2854
3277
  }
2855
- this.viewport.setAttribute("role", "region");
2856
- this.viewport.setAttribute("aria-label", this.options.ariaLabel);
2857
3278
  }
2858
3279
  /**
2859
3280
  * Crée les rails et curseurs selon l'axe sélectionné.
@@ -2871,7 +3292,7 @@ var ScrollBlock = class {
2871
3292
  this.thumbY.setAttribute("aria-valuenow", "0");
2872
3293
  this.thumbY.setAttribute("aria-valuemin", "0");
2873
3294
  this.thumbY.setAttribute("aria-valuemax", "100");
2874
- this.thumbY.setAttribute("aria-label", "D\xE9filement vertical");
3295
+ this.thumbY.setAttribute("aria-label", this.t("verticalThumb"));
2875
3296
  this.trackY.appendChild(this.thumbY);
2876
3297
  this.root.appendChild(this.trackY);
2877
3298
  this.attachTrackListeners(this.trackY, this.thumbY, "y");
@@ -2888,7 +3309,7 @@ var ScrollBlock = class {
2888
3309
  this.thumbX.setAttribute("aria-valuenow", "0");
2889
3310
  this.thumbX.setAttribute("aria-valuemin", "0");
2890
3311
  this.thumbX.setAttribute("aria-valuemax", "100");
2891
- this.thumbX.setAttribute("aria-label", "D\xE9filement horizontal");
3312
+ this.thumbX.setAttribute("aria-label", this.t("horizontalThumb"));
2892
3313
  this.trackX.appendChild(this.thumbX);
2893
3314
  this.root.appendChild(this.trackX);
2894
3315
  this.attachTrackListeners(this.trackX, this.thumbX, "x");
@@ -3110,6 +3531,7 @@ var ScrollBlock = class {
3110
3531
  * Recalcule les dimensions et la visibilité des barres.
3111
3532
  */
3112
3533
  update() {
3534
+ this.syncAccessibilityLabels();
3113
3535
  const { scrollHeight, clientHeight, scrollWidth, clientWidth } = this.viewport;
3114
3536
  const canScrollY = scrollHeight > clientHeight;
3115
3537
  const canScrollX = scrollWidth > clientWidth;
@@ -3171,6 +3593,18 @@ var ScrollBlock = class {
3171
3593
  targetLeft = maxLeft;
3172
3594
  break;
3173
3595
  default: {
3596
+ if (/^-?\d+(\.\d+)?%$/.test(target.trim())) {
3597
+ const pct = Math.max(0, Math.min(100, parseFloat(target.trim()))) / 100;
3598
+ if (this.options.axis === "x") {
3599
+ targetLeft = maxLeft * pct;
3600
+ } else if (this.options.axis === "both") {
3601
+ targetTop = maxTop * pct;
3602
+ targetLeft = maxLeft * pct;
3603
+ } else {
3604
+ targetTop = maxTop * pct;
3605
+ }
3606
+ break;
3607
+ }
3174
3608
  let el = null;
3175
3609
  try {
3176
3610
  el = this.viewport.querySelector(target);
@@ -3230,13 +3664,27 @@ var ScrollBlock = class {
3230
3664
  this.root.insertBefore(this.viewport.firstChild, this.viewport);
3231
3665
  }
3232
3666
  this.viewport.remove();
3667
+ } else {
3668
+ this.viewport.removeAttribute("tabindex");
3669
+ if (this.wasIdGenerated) {
3670
+ this.viewport.removeAttribute("id");
3671
+ }
3672
+ if (this.wasRoleInferred && this.viewport.getAttribute("role") === "region") {
3673
+ this.viewport.removeAttribute("role");
3674
+ }
3675
+ if (this.wasAriaLabelInferred && this.viewport.getAttribute("aria-label") === this.lastInferredAriaLabel) {
3676
+ this.viewport.removeAttribute("aria-label");
3677
+ }
3233
3678
  }
3234
3679
  }
3235
3680
  };
3681
+ ScrollBlock._i18n = scrollI18n;
3682
+ ScrollBlock.i18n = scrollI18n;
3236
3683
 
3237
3684
  // src/scroll/index.ts
3238
3685
  var Scroll = {
3239
- ScrollBlock
3686
+ ScrollBlock,
3687
+ i18n: scrollI18n
3240
3688
  };
3241
3689
  var scroll_default = ScrollBlock;
3242
3690
  if (typeof window !== "undefined") {
@@ -3250,8 +3698,13 @@ if (typeof window !== "undefined") {
3250
3698
  var masonry_exports = {};
3251
3699
  __export(masonry_exports, {
3252
3700
  LayoutEngine: () => LayoutEngine,
3701
+ LocalizedComponent: () => LocalizedComponent,
3253
3702
  Masonry: () => Masonry,
3254
- default: () => masonry_default
3703
+ createI18nManager: () => createI18nManager,
3704
+ default: () => masonry_default,
3705
+ masonryEn: () => masonryEn,
3706
+ masonryFr: () => masonryFr,
3707
+ masonryI18n: () => masonryI18n
3255
3708
  });
3256
3709
 
3257
3710
  // src/masonry/LayoutEngine.ts
@@ -3441,9 +3894,26 @@ var LayoutEngine = class {
3441
3894
  }
3442
3895
  };
3443
3896
 
3897
+ // src/masonry/i18n/fr.ts
3898
+ var masonryFr = {
3899
+ gallery: "Galerie en grille asym\xE9trique"
3900
+ };
3901
+
3902
+ // src/masonry/i18n/en.ts
3903
+ var masonryEn = {
3904
+ gallery: "Masonry grid gallery"
3905
+ };
3906
+
3907
+ // src/masonry/i18n/index.ts
3908
+ var masonryI18n = createI18nManager("fr", {
3909
+ fr: masonryFr,
3910
+ en: masonryEn
3911
+ });
3912
+
3444
3913
  // src/masonry/Masonry.ts
3445
- var Masonry = class {
3914
+ var Masonry = class extends LocalizedComponent {
3446
3915
  constructor(target, options = {}) {
3916
+ super(options.i18n);
3447
3917
  this.isNativeCSSGrid = false;
3448
3918
  this._items = [];
3449
3919
  this.resizeObserver = null;
@@ -3452,6 +3922,8 @@ var Masonry = class {
3452
3922
  this.isDestroyed = false;
3453
3923
  this.wasRoleInferred = false;
3454
3924
  this.wasAriaLabelInferred = false;
3925
+ this.hasExplicitAriaLabel = false;
3926
+ this.lastInferredAriaLabel = "";
3455
3927
  this.removeTimers = /* @__PURE__ */ new Set();
3456
3928
  this.pendingImageListeners = [];
3457
3929
  if (typeof target === "string") {
@@ -3469,11 +3941,12 @@ var Masonry = class {
3469
3941
  height: this.root.style.height,
3470
3942
  width: this.root.style.width
3471
3943
  };
3944
+ this.hasExplicitAriaLabel = Boolean(options.ariaLabel);
3472
3945
  this.options = {
3473
3946
  itemSelector: options.itemSelector || "> *",
3474
3947
  columnWidth: options.columnWidth ?? 0,
3475
3948
  gutter: options.gutter ?? 0,
3476
- percentPosition: options.percentPosition !== false,
3949
+ percentPosition: Boolean(options.percentPosition),
3477
3950
  fitWidth: Boolean(options.fitWidth),
3478
3951
  horizontalOrder: Boolean(options.horizontalOrder),
3479
3952
  transitionDuration: options.transitionDuration !== void 0 ? options.transitionDuration : 300,
@@ -3482,7 +3955,8 @@ var Masonry = class {
3482
3955
  autoImages: options.autoImages !== false,
3483
3956
  useNativeCSSGrid: options.useNativeCSSGrid !== false,
3484
3957
  ariaRole: options.ariaRole || "region",
3485
- ariaLabel: options.ariaLabel || "Galerie en grille asym\xE9trique",
3958
+ ariaLabel: options.ariaLabel || this.t("gallery"),
3959
+ i18n: options.i18n || {},
3486
3960
  onLayout: options.onLayout || (() => {
3487
3961
  }),
3488
3962
  onItemPlaced: options.onItemPlaced || (() => {
@@ -3513,11 +3987,27 @@ var Masonry = class {
3513
3987
  this.root.setAttribute("role", this.options.ariaRole);
3514
3988
  this.wasRoleInferred = true;
3515
3989
  }
3516
- if (this.options.ariaLabel && !this.root.hasAttribute("aria-label")) {
3517
- this.root.setAttribute("aria-label", this.options.ariaLabel);
3990
+ const label = this.hasExplicitAriaLabel ? this.options.ariaLabel : this.t("gallery");
3991
+ if (label && !this.root.hasAttribute("aria-label")) {
3992
+ this.root.setAttribute("aria-label", label);
3993
+ this.lastInferredAriaLabel = label;
3518
3994
  this.wasAriaLabelInferred = true;
3519
3995
  }
3520
3996
  }
3997
+ /**
3998
+ * Synchronise dynamiquement le libellé ARIA si la langue globale change après montage.
3999
+ */
4000
+ syncAccessibilityLabels() {
4001
+ if (this.wasAriaLabelInferred && !this.hasExplicitAriaLabel) {
4002
+ const currentAttr = this.root.getAttribute("aria-label");
4003
+ if (currentAttr === this.lastInferredAriaLabel) {
4004
+ const nextLabel = this.t("gallery");
4005
+ this.root.setAttribute("aria-label", nextLabel);
4006
+ this.lastInferredAriaLabel = nextLabel;
4007
+ this.options.ariaLabel = nextLabel;
4008
+ }
4009
+ }
4010
+ }
3521
4011
  /**
3522
4012
  * Configure les variables CSS de transition sur le conteneur.
3523
4013
  */
@@ -3624,6 +4114,7 @@ var Masonry = class {
3624
4114
  */
3625
4115
  layout() {
3626
4116
  if (this.isDestroyed) return;
4117
+ this.syncAccessibilityLabels();
3627
4118
  if (this.isNativeCSSGrid) {
3628
4119
  this.options.onLayout([]);
3629
4120
  return;
@@ -3638,10 +4129,16 @@ var Masonry = class {
3638
4129
  this.root.classList.remove("wulf-masonry--fit-width");
3639
4130
  }
3640
4131
  const stagger = this.options.stagger;
4132
+ const usePercent = this.options.percentPosition && result.containerWidth > 0;
3641
4133
  for (let i = 0; i < result.positions.length; i++) {
3642
4134
  const pos = result.positions[i];
3643
4135
  const item = pos.element;
3644
- item.style.setProperty("--wulf-masonry-w", `${pos.width}px`);
4136
+ if (usePercent) {
4137
+ const wPct = Number((pos.width / result.containerWidth * 100).toFixed(4));
4138
+ item.style.setProperty("--wulf-masonry-w", `${wPct}%`);
4139
+ } else {
4140
+ item.style.setProperty("--wulf-masonry-w", `${pos.width}px`);
4141
+ }
3645
4142
  item.style.setProperty("--wulf-masonry-x", `${pos.x}px`);
3646
4143
  item.style.setProperty("--wulf-masonry-y", `${pos.y}px`);
3647
4144
  if (stagger > 0) {
@@ -3761,7 +4258,7 @@ var Masonry = class {
3761
4258
  if (this.wasRoleInferred && this.root.getAttribute("role") === this.options.ariaRole) {
3762
4259
  this.root.removeAttribute("role");
3763
4260
  }
3764
- if (this.wasAriaLabelInferred && this.root.getAttribute("aria-label") === this.options.ariaLabel) {
4261
+ if (this.wasAriaLabelInferred && this.root.getAttribute("aria-label") === this.lastInferredAriaLabel) {
3765
4262
  this.root.removeAttribute("aria-label");
3766
4263
  }
3767
4264
  this.root.style.removeProperty("--wulf-masonry-duration");
@@ -3785,6 +4282,8 @@ var Masonry = class {
3785
4282
  this._items = [];
3786
4283
  }
3787
4284
  };
4285
+ Masonry._i18n = masonryI18n;
4286
+ Masonry.i18n = masonryI18n;
3788
4287
 
3789
4288
  // src/masonry/index.ts
3790
4289
  var masonry_default = Masonry;
@@ -3794,17 +4293,39 @@ if (typeof window !== "undefined") {
3794
4293
  win.Wulf = wulfNamespace;
3795
4294
  wulfNamespace.Masonry = Object.assign(Masonry, {
3796
4295
  Masonry,
3797
- LayoutEngine
4296
+ LayoutEngine,
4297
+ i18n: masonryI18n
3798
4298
  });
3799
4299
  }
3800
4300
 
3801
4301
  // src/toast/index.ts
3802
4302
  var toast_exports = {};
3803
4303
  __export(toast_exports, {
4304
+ LocalizedComponent: () => LocalizedComponent,
3804
4305
  Toast: () => Toast,
3805
4306
  ToastInstance: () => ToastInstance,
3806
4307
  ToastManager: () => ToastManager,
3807
- default: () => toast_default
4308
+ createI18nManager: () => createI18nManager,
4309
+ default: () => toast_default,
4310
+ toastEn: () => toastEn,
4311
+ toastFr: () => toastFr,
4312
+ toastI18n: () => toastI18n
4313
+ });
4314
+
4315
+ // src/toast/i18n/fr.ts
4316
+ var toastFr = {
4317
+ closeButton: "Fermer la notification"
4318
+ };
4319
+
4320
+ // src/toast/i18n/en.ts
4321
+ var toastEn = {
4322
+ closeButton: "Close notification"
4323
+ };
4324
+
4325
+ // src/toast/i18n/index.ts
4326
+ var toastI18n = createI18nManager("fr", {
4327
+ fr: toastFr,
4328
+ en: toastEn
3808
4329
  });
3809
4330
 
3810
4331
  // src/toast/ToastInstance.ts
@@ -3878,12 +4399,12 @@ var ToastInstance = class {
3878
4399
  content.appendChild(messageEl);
3879
4400
  }
3880
4401
  el.appendChild(content);
3881
- const closable = this.options.closable !== void 0 ? this.options.closable : this.remainingTime === 0 || this.options.closable === true || true;
4402
+ const closable = this.options.closable ?? true;
3882
4403
  if (closable) {
3883
4404
  const closeBtn = document.createElement("button");
3884
4405
  closeBtn.type = "button";
3885
4406
  closeBtn.className = "wulf-toast-close";
3886
- closeBtn.setAttribute("aria-label", "Fermer la notification");
4407
+ closeBtn.setAttribute("aria-label", toastI18n.t("closeButton", this.options.i18n));
3887
4408
  closeBtn.setAttribute("tabindex", "0");
3888
4409
  const closeIcon = document.createElement("span");
3889
4410
  closeIcon.className = "wulf-toast-close-icon";
@@ -3919,6 +4440,9 @@ var ToastInstance = class {
3919
4440
  if (this.options.onClick) {
3920
4441
  this.options.onClick(this, e);
3921
4442
  }
4443
+ if (this.options.closeOnClick) {
4444
+ this.close("toast-click");
4445
+ }
3922
4446
  });
3923
4447
  this.element.addEventListener("mouseenter", () => this.pauseTimer());
3924
4448
  this.element.addEventListener("mouseleave", () => this.resumeTimer());
@@ -4008,9 +4532,14 @@ var ToastInstance = class {
4008
4532
  window.setTimeout(handleAnimationEnd, 90);
4009
4533
  } else {
4010
4534
  let transitioned = false;
4535
+ let fallbackTimerId = null;
4011
4536
  const onEnd = () => {
4012
4537
  if (!transitioned) {
4013
4538
  transitioned = true;
4539
+ if (fallbackTimerId !== null) {
4540
+ window.clearTimeout(fallbackTimerId);
4541
+ fallbackTimerId = null;
4542
+ }
4014
4543
  this.element.removeEventListener("animationend", onEnd);
4015
4544
  this.element.removeEventListener("transitionend", onEnd);
4016
4545
  handleAnimationEnd();
@@ -4018,7 +4547,7 @@ var ToastInstance = class {
4018
4547
  };
4019
4548
  this.element.addEventListener("animationend", onEnd, { once: true });
4020
4549
  this.element.addEventListener("transitionend", onEnd, { once: true });
4021
- window.setTimeout(onEnd, 300);
4550
+ fallbackTimerId = window.setTimeout(onEnd, 300);
4022
4551
  }
4023
4552
  });
4024
4553
  }
@@ -4182,7 +4711,7 @@ _ToastManager.instance = null;
4182
4711
  var ToastManager = _ToastManager;
4183
4712
 
4184
4713
  // src/toast/Toast.ts
4185
- var Toast = class {
4714
+ var Toast = class extends LocalizedComponent {
4186
4715
  /**
4187
4716
  * Affiche une nouvelle notification Toast avec les options spécifiées.
4188
4717
  */
@@ -4201,6 +4730,8 @@ var Toast = class {
4201
4730
  return ToastManager.getInstance().clearAll(position);
4202
4731
  }
4203
4732
  };
4733
+ Toast._i18n = toastI18n;
4734
+ Toast.i18n = toastI18n;
4204
4735
 
4205
4736
  // src/toast/index.ts
4206
4737
  var toast_default = Toast;
@@ -4208,7 +4739,10 @@ if (typeof window !== "undefined") {
4208
4739
  const win = window;
4209
4740
  const wulfNamespace = win.Wulf || {};
4210
4741
  win.Wulf = wulfNamespace;
4211
- wulfNamespace.Toast = Toast;
4742
+ wulfNamespace.Toast = Object.assign(Toast, {
4743
+ Toast,
4744
+ i18n: toastI18n
4745
+ });
4212
4746
  }
4213
4747
  export {
4214
4748
  AmountEngine,
@@ -4217,6 +4751,7 @@ export {
4217
4751
  InputAmountMask,
4218
4752
  InputEmailMask,
4219
4753
  InputMask,
4754
+ LocalizedComponent,
4220
4755
  mask_exports as Mask,
4221
4756
  MaskEngine,
4222
4757
  MaskHistory,
@@ -4224,6 +4759,7 @@ export {
4224
4759
  masonry_exports as Masonry,
4225
4760
  scroll_exports as Scroll,
4226
4761
  toast_exports as Toast,
4762
+ createI18nManager,
4227
4763
  mask_default as default,
4228
4764
  resolveMaskConstructorArgs
4229
4765
  };