wulf.js 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/changelog.md +45 -0
- package/dist/focus-trap.esm.js +62 -9
- package/dist/focus-trap.esm.js.map +2 -2
- package/dist/focus-trap.global.js +64 -11
- package/dist/focus-trap.global.js.map +2 -2
- package/dist/focus-trap.global.min.js +3 -3
- package/dist/focus-trap.global.min.js.map +3 -3
- package/dist/index.esm.js +364 -107
- package/dist/index.esm.js.map +2 -2
- package/dist/index.global.js +366 -109
- package/dist/index.global.js.map +2 -2
- package/dist/index.global.min.js +3 -3
- package/dist/index.global.min.js.map +3 -3
- package/dist/mask.esm.js +66 -22
- package/dist/mask.esm.js.map +2 -2
- package/dist/mask.global.js +68 -24
- package/dist/mask.global.js.map +2 -2
- package/dist/mask.global.min.js +3 -3
- package/dist/mask.global.min.js.map +3 -3
- package/dist/masonry.esm.js +96 -40
- package/dist/masonry.esm.js.map +2 -2
- package/dist/masonry.global.js +98 -42
- package/dist/masonry.global.js.map +2 -2
- package/dist/masonry.global.min.js +3 -3
- package/dist/masonry.global.min.js.map +3 -3
- package/dist/scroll.esm.js +66 -28
- package/dist/scroll.esm.js.map +2 -2
- package/dist/scroll.global.js +68 -30
- package/dist/scroll.global.js.map +2 -2
- package/dist/scroll.global.min.js +4 -4
- package/dist/scroll.global.min.js.map +3 -3
- package/dist/shortcut.esm.js +53 -6
- package/dist/shortcut.esm.js.map +3 -3
- package/dist/shortcut.global.js +55 -8
- package/dist/shortcut.global.js.map +2 -2
- package/dist/shortcut.global.min.js +2 -2
- package/dist/shortcut.global.min.js.map +3 -3
- package/dist/toast.css +1 -1
- package/dist/toast.css.map +2 -2
- package/dist/toast.esm.js +109 -44
- package/dist/toast.esm.js.map +2 -2
- package/dist/toast.global.js +111 -46
- package/dist/toast.global.js.map +2 -2
- package/dist/toast.global.min.js +4 -4
- package/dist/toast.global.min.js.map +3 -3
- package/dist/types/focus-trap/FocusTrap.d.ts +2 -0
- package/dist/types/mask/AmountEngine.d.ts +1 -0
- package/dist/types/mask/BaseInputMask.d.ts +4 -0
- package/dist/types/mask/InputAmountMask.d.ts +1 -0
- package/dist/types/mask/InputMask.d.ts +1 -0
- package/dist/types/shortcut/ShortcutManager.d.ts +4 -0
- package/dist/types/toast/ToastInstance.d.ts +1 -1
- package/dist/types/toast/types.d.ts +5 -0
- package/package.json +5 -3
package/dist/mask.esm.js
CHANGED
|
@@ -247,7 +247,8 @@ var BaseInputMask = class extends AuditableComponent {
|
|
|
247
247
|
"data-disabled",
|
|
248
248
|
"data-mask-align",
|
|
249
249
|
"data-align",
|
|
250
|
-
"placeholder"
|
|
250
|
+
"placeholder",
|
|
251
|
+
"type"
|
|
251
252
|
]
|
|
252
253
|
};
|
|
253
254
|
this.mutationObserver.observe(this.wrapper, config);
|
|
@@ -295,7 +296,12 @@ var BaseInputMask = class extends AuditableComponent {
|
|
|
295
296
|
} else if (attrName === "data-mask-select-on-focus") {
|
|
296
297
|
this.options.selectAllOnFocus = this.getAttr("data-mask-select-on-focus") === "true";
|
|
297
298
|
} else if (attrName === "data-mask-copy-raw") {
|
|
298
|
-
this.options.copyRaw = this.getAttr("data-mask-copy-raw") === "true";
|
|
299
|
+
this.options.copyRaw = this.input.type === "password" ? false : this.getAttr("data-mask-copy-raw") === "true";
|
|
300
|
+
} else if (attrName === "type") {
|
|
301
|
+
if (this.input.type === "password") {
|
|
302
|
+
this.options.copyRaw = false;
|
|
303
|
+
this.onPasswordModeDetected();
|
|
304
|
+
}
|
|
299
305
|
} else if (attrName === "data-mask-align" || attrName === "data-align") {
|
|
300
306
|
const align = this.getAttr("data-mask-align") || this.getAttr("data-align");
|
|
301
307
|
if (align !== (this.options.align ?? null)) {
|
|
@@ -550,6 +556,11 @@ var BaseInputMask = class extends AuditableComponent {
|
|
|
550
556
|
getSpecificAuditWarnings() {
|
|
551
557
|
return [];
|
|
552
558
|
}
|
|
559
|
+
/**
|
|
560
|
+
* Crochet appelé lorsque l'input bascule dynamiquement en type="password" (ex: toggle afficher/masquer).
|
|
561
|
+
*/
|
|
562
|
+
onPasswordModeDetected() {
|
|
563
|
+
}
|
|
553
564
|
/**
|
|
554
565
|
* Supprime les éléments fantômes, restaure les propriétés et nettoie les attributs.
|
|
555
566
|
*/
|
|
@@ -634,11 +645,11 @@ var MaskEngine = class _MaskEngine {
|
|
|
634
645
|
compile(newPattern) {
|
|
635
646
|
if (newPattern !== void 0) {
|
|
636
647
|
if (Array.isArray(newPattern)) {
|
|
637
|
-
this.patterns =
|
|
648
|
+
this.patterns = newPattern.slice(0, 32).map((p) => String(p ?? "").slice(0, 512));
|
|
638
649
|
this.pattern = this.patterns[0] || "";
|
|
639
650
|
} else {
|
|
640
651
|
this.patterns = [];
|
|
641
|
-
this.pattern = newPattern;
|
|
652
|
+
this.pattern = String(newPattern ?? "").slice(0, 512);
|
|
642
653
|
}
|
|
643
654
|
}
|
|
644
655
|
if (this.patterns.length > 0) {
|
|
@@ -789,7 +800,8 @@ var MaskEngine = class _MaskEngine {
|
|
|
789
800
|
return engine.extractRaw(input);
|
|
790
801
|
}
|
|
791
802
|
}
|
|
792
|
-
const
|
|
803
|
+
const maxInputLen = Math.max(4096, this.slots.length * 4);
|
|
804
|
+
const str = String(input ?? "").slice(0, maxInputLen);
|
|
793
805
|
if (!str) return "";
|
|
794
806
|
let raw = "";
|
|
795
807
|
let inputIdx = 0;
|
|
@@ -858,7 +870,8 @@ var MaskEngine = class _MaskEngine {
|
|
|
858
870
|
return engine.format(rawValue);
|
|
859
871
|
}
|
|
860
872
|
}
|
|
861
|
-
const
|
|
873
|
+
const maxInputLen = Math.max(4096, this.slots.length * 4);
|
|
874
|
+
const rawStr = String(rawValue ?? "").slice(0, maxInputLen);
|
|
862
875
|
if (!this.slots.length) return rawStr;
|
|
863
876
|
const cleanRaw = this.extractRaw(rawStr);
|
|
864
877
|
if (cleanRaw.length === 0) {
|
|
@@ -1361,6 +1374,9 @@ var InputMask = class extends BaseInputMask {
|
|
|
1361
1374
|
extractRawSnippet(snippet) {
|
|
1362
1375
|
return this.engine.extractRaw(snippet);
|
|
1363
1376
|
}
|
|
1377
|
+
onPasswordModeDetected() {
|
|
1378
|
+
this.history.clear();
|
|
1379
|
+
}
|
|
1364
1380
|
/**
|
|
1365
1381
|
* Formate statiquement une valeur selon un masque donné sans nécessiter d'élément DOM.
|
|
1366
1382
|
*
|
|
@@ -1729,7 +1745,7 @@ var InputMask = class extends BaseInputMask {
|
|
|
1729
1745
|
}
|
|
1730
1746
|
e.preventDefault();
|
|
1731
1747
|
this.history.updateCurrentCursor(this.input.selectionStart ?? 0);
|
|
1732
|
-
const rawPasted = e.clipboardData?.getData("text") || "";
|
|
1748
|
+
const rawPasted = (e.clipboardData?.getData("text") || "").slice(0, 4096);
|
|
1733
1749
|
const pastedText = rawPasted.trim();
|
|
1734
1750
|
if (!pastedText) return;
|
|
1735
1751
|
const minPos = this.engine.getPrefixLength();
|
|
@@ -1881,7 +1897,10 @@ var InputMask = class extends BaseInputMask {
|
|
|
1881
1897
|
this.input.setSelectionRange(safeCursor, safeCursor);
|
|
1882
1898
|
isCompleted = this.isComplete();
|
|
1883
1899
|
this.wrapper.classList.toggle("is-complete", isCompleted);
|
|
1884
|
-
if (
|
|
1900
|
+
if (this.input.type === "password") {
|
|
1901
|
+
this.options.copyRaw = false;
|
|
1902
|
+
this.history.clear();
|
|
1903
|
+
} else if (!this.isUndoingRedoing) {
|
|
1885
1904
|
this.history.push(this.getRawValue(), safeCursor);
|
|
1886
1905
|
}
|
|
1887
1906
|
} finally {
|
|
@@ -1932,7 +1951,10 @@ var InputMask = class extends BaseInputMask {
|
|
|
1932
1951
|
}
|
|
1933
1952
|
this.isNotifying = true;
|
|
1934
1953
|
try {
|
|
1935
|
-
|
|
1954
|
+
let iterations = 0;
|
|
1955
|
+
const MAX_NOTIFICATION_ITERATIONS = 10;
|
|
1956
|
+
while ((this.input.value !== this.lastValue || this.hasPendingNotification || forceNotify) && iterations < MAX_NOTIFICATION_ITERATIONS) {
|
|
1957
|
+
iterations++;
|
|
1936
1958
|
this.hasPendingNotification = false;
|
|
1937
1959
|
forceNotify = false;
|
|
1938
1960
|
const valToNotify = this.input.value;
|
|
@@ -1980,13 +2002,15 @@ var AmountEngine = class _AmountEngine {
|
|
|
1980
2002
|
currency = options.unit;
|
|
1981
2003
|
}
|
|
1982
2004
|
const defaultPosition = currency === "$" || currency === "\xA3" || currency === "\xA5" ? "prefix" : "suffix";
|
|
2005
|
+
const rawDecimals = options.decimals !== void 0 ? Number(options.decimals) : 2;
|
|
2006
|
+
const safeDecimals = Number.isFinite(rawDecimals) ? Math.min(20, Math.max(0, Math.floor(rawDecimals))) : 2;
|
|
1983
2007
|
this.options = {
|
|
1984
|
-
currency,
|
|
1985
|
-
unit: options.unit ?? currency,
|
|
2008
|
+
currency: String(currency).slice(0, 32),
|
|
2009
|
+
unit: String(options.unit ?? currency).slice(0, 32),
|
|
1986
2010
|
currencyPosition: options.currencyPosition ?? defaultPosition,
|
|
1987
|
-
decimals:
|
|
1988
|
-
decimalSeparator: options.decimalSeparator ?? ",",
|
|
1989
|
-
thousandSeparator: options.thousandSeparator ?? "\xA0",
|
|
2011
|
+
decimals: safeDecimals,
|
|
2012
|
+
decimalSeparator: String(options.decimalSeparator ?? ",").slice(0, 4) || ",",
|
|
2013
|
+
thousandSeparator: String(options.thousandSeparator ?? "\xA0").slice(0, 4),
|
|
1990
2014
|
// Espace insécable
|
|
1991
2015
|
allowNegative: options.allowNegative ?? false,
|
|
1992
2016
|
min: options.min ?? -Infinity,
|
|
@@ -1997,7 +2021,7 @@ var AmountEngine = class _AmountEngine {
|
|
|
1997
2021
|
* Analyse et nettoie une saisie utilisateur pour extraire ses composantes numériques.
|
|
1998
2022
|
*/
|
|
1999
2023
|
parse(input) {
|
|
2000
|
-
let str = input.trim();
|
|
2024
|
+
let str = String(input ?? "").slice(0, 512).trim();
|
|
2001
2025
|
let isNegative = false;
|
|
2002
2026
|
if (this.options.allowNegative && str.includes("-")) {
|
|
2003
2027
|
isNegative = true;
|
|
@@ -2038,7 +2062,9 @@ var AmountEngine = class _AmountEngine {
|
|
|
2038
2062
|
* @param rawCursor Position actuelle du curseur dans l'input natif
|
|
2039
2063
|
*/
|
|
2040
2064
|
format(input, rawCursor = input.length, padDecimals = false) {
|
|
2041
|
-
|
|
2065
|
+
const safeInput = String(input ?? "").slice(0, 512);
|
|
2066
|
+
const safeRawCursor = Math.max(0, Math.min(rawCursor, safeInput.length));
|
|
2067
|
+
if (!safeInput || safeInput.trim() === "" || safeInput === this.options.currency.trim()) {
|
|
2042
2068
|
return {
|
|
2043
2069
|
formatted: "",
|
|
2044
2070
|
rawNumber: null,
|
|
@@ -2047,10 +2073,10 @@ var AmountEngine = class _AmountEngine {
|
|
|
2047
2073
|
isValid: true
|
|
2048
2074
|
};
|
|
2049
2075
|
}
|
|
2050
|
-
const prefixBeforeCursor =
|
|
2076
|
+
const prefixBeforeCursor = safeInput.substring(0, safeRawCursor);
|
|
2051
2077
|
const digitsBeforeCursor = prefixBeforeCursor.replace(/\D/g, "").length;
|
|
2052
2078
|
const hadDecimalBeforeCursor = this.options.decimals > 0 && /[,.]/.test(prefixBeforeCursor);
|
|
2053
|
-
const { isNegative, integerPart, decimalPart, hasDecimal } = this.parse(
|
|
2079
|
+
const { isNegative, integerPart, decimalPart, hasDecimal } = this.parse(safeInput);
|
|
2054
2080
|
let effectiveDecimal = decimalPart;
|
|
2055
2081
|
let effectiveHasDecimal = hasDecimal;
|
|
2056
2082
|
if (padDecimals && this.options.decimals > 0 && (integerPart || decimalPart !== null)) {
|
|
@@ -2090,7 +2116,7 @@ var AmountEngine = class _AmountEngine {
|
|
|
2090
2116
|
isValid: true
|
|
2091
2117
|
};
|
|
2092
2118
|
}
|
|
2093
|
-
const formattedInteger = (integerPart || "0")
|
|
2119
|
+
const formattedInteger = this.formatThousands(integerPart || "0");
|
|
2094
2120
|
let numberCore = formattedInteger;
|
|
2095
2121
|
if (effectiveHasDecimal && this.options.decimals > 0) {
|
|
2096
2122
|
numberCore += this.options.decimalSeparator + (effectiveDecimal ?? "");
|
|
@@ -2163,6 +2189,18 @@ var AmountEngine = class _AmountEngine {
|
|
|
2163
2189
|
const str = typeof value === "number" ? value.toString() : value;
|
|
2164
2190
|
return engine.format(str).formatted;
|
|
2165
2191
|
}
|
|
2192
|
+
formatThousands(digits) {
|
|
2193
|
+
const sep = this.options.thousandSeparator;
|
|
2194
|
+
if (!sep || digits.length <= 3) return digits;
|
|
2195
|
+
const parts = [];
|
|
2196
|
+
let i = digits.length;
|
|
2197
|
+
while (i > 0) {
|
|
2198
|
+
const start = Math.max(0, i - 3);
|
|
2199
|
+
parts.push(digits.slice(start, i));
|
|
2200
|
+
i = start;
|
|
2201
|
+
}
|
|
2202
|
+
return parts.reverse().join(sep);
|
|
2203
|
+
}
|
|
2166
2204
|
escapeRegExp(string) {
|
|
2167
2205
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2168
2206
|
}
|
|
@@ -2213,6 +2251,9 @@ var InputAmountMask = class extends BaseInputMask {
|
|
|
2213
2251
|
if (!p.integerPart && !p.decimalPart) return "";
|
|
2214
2252
|
return (p.isNegative ? "-" : "") + (p.integerPart || "0") + (p.decimalPart ? "." + p.decimalPart : "");
|
|
2215
2253
|
}
|
|
2254
|
+
onPasswordModeDetected() {
|
|
2255
|
+
this.history.clear();
|
|
2256
|
+
}
|
|
2216
2257
|
/**
|
|
2217
2258
|
* Formate statiquement une valeur sans nécessiter d'élément DOM.
|
|
2218
2259
|
*/
|
|
@@ -2290,7 +2331,10 @@ var InputAmountMask = class extends BaseInputMask {
|
|
|
2290
2331
|
const result = this.engine.format(val, cursor);
|
|
2291
2332
|
this.setNativeValue(result.formatted);
|
|
2292
2333
|
this.input.setSelectionRange(result.cursor, result.cursor);
|
|
2293
|
-
if (
|
|
2334
|
+
if (this.input.type === "password") {
|
|
2335
|
+
this.options.copyRaw = false;
|
|
2336
|
+
this.history.clear();
|
|
2337
|
+
} else if (!this.isUndoingRedoing) {
|
|
2294
2338
|
this.history.push(result.rawValue, result.cursor);
|
|
2295
2339
|
}
|
|
2296
2340
|
this.updateGhost(result);
|
|
@@ -2584,7 +2628,7 @@ var _EmailEngine = class _EmailEngine {
|
|
|
2584
2628
|
* Retourne l'ensemble des domaines correspondant à la saisie courante.
|
|
2585
2629
|
*/
|
|
2586
2630
|
getMatchingDomains(input) {
|
|
2587
|
-
const val = input ?? "";
|
|
2631
|
+
const val = String(input ?? "").slice(0, 512);
|
|
2588
2632
|
if (!val.includes("@")) {
|
|
2589
2633
|
return this.defaultDomain ? [this.defaultDomain] : [];
|
|
2590
2634
|
}
|
|
@@ -2606,7 +2650,7 @@ var _EmailEngine = class _EmailEngine {
|
|
|
2606
2650
|
* @param matchIndex Index de la suggestion à sélectionner si plusieurs domaines/TLD correspondent (permet le cyclage)
|
|
2607
2651
|
*/
|
|
2608
2652
|
getSuggestion(input, matchIndex = 0) {
|
|
2609
|
-
const val = input ?? "";
|
|
2653
|
+
const val = String(input ?? "").slice(0, 512);
|
|
2610
2654
|
if (!val.includes("@")) {
|
|
2611
2655
|
if (this.defaultDomain) {
|
|
2612
2656
|
return {
|