@maz-ui/utils 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/helpers/TextareaAutogrow.js +1 -2
- package/dist/helpers/camelCase.js +1 -2
- package/dist/helpers/capitalize.js +1 -2
- package/dist/helpers/checkAvailability.js +1 -2
- package/dist/helpers/cookie.js +1 -2
- package/dist/helpers/countryCodeToUnicodeFlag.js +1 -2
- package/dist/helpers/debounce.js +1 -2
- package/dist/helpers/debounceCallback.js +1 -2
- package/dist/helpers/debounceId.js +1 -2
- package/dist/helpers/fetchLocaleIp.js +1 -2
- package/dist/helpers/formatCurrency.js +1 -2
- package/dist/helpers/formatDate.js +1 -2
- package/dist/helpers/formatJson.js +1 -2
- package/dist/helpers/formatNumber.js +1 -2
- package/dist/helpers/formatPhoneNumber.js +1 -2
- package/dist/helpers/getBrowserLocale.js +1 -2
- package/dist/helpers/getCountryFlagUrl.js +1 -2
- package/dist/helpers/getErrorMessage.js +1 -2
- package/dist/helpers/idleTimeout.js +1 -2
- package/dist/helpers/index.js +5 -5
- package/dist/helpers/isClient.js +1 -2
- package/dist/helpers/isEqual.js +1 -2
- package/dist/helpers/isIos.js +1 -2
- package/dist/helpers/isServer.js +1 -2
- package/dist/helpers/isStandaloneMode.js +1 -2
- package/dist/helpers/kebabCase.js +1 -2
- package/dist/helpers/normalizeString.js +1 -2
- package/dist/helpers/pascalCase.js +1 -2
- package/dist/helpers/preventIosInputZoom.js +1 -2
- package/dist/helpers/scriptLoader.js +1 -2
- package/dist/helpers/sleep.js +1 -2
- package/dist/helpers/snakeCase.js +1 -2
- package/dist/helpers/swipeHandler.js +1 -2
- package/dist/helpers/throttle.js +1 -2
- package/dist/helpers/throttleId.js +1 -2
- package/dist/helpers/truthyFilter.js +1 -2
- package/dist/helpers/upperFirst.js +1 -2
- package/dist/helpers/userVisibility.js +1 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -163,7 +163,7 @@ const phone = formatPhoneNumber('+33123456789', 'international')
|
|
|
163
163
|
|
|
164
164
|
## Requirements
|
|
165
165
|
|
|
166
|
-
- Node.js
|
|
166
|
+
- Node.js 22.23.4+, 24.22.1+ or 26.12.1+ (the releases with the October 2026 security fixes)
|
|
167
167
|
- TypeScript support included
|
|
168
168
|
- Tree-shakeable for optimal bundle size
|
|
169
169
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { debounce } from "./debounce.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/TextareaAutogrow.ts
|
|
3
3
|
var TextareaAutogrow = class {
|
|
4
4
|
element;
|
|
5
5
|
constructor(element) {
|
|
@@ -21,5 +21,4 @@ var TextareaAutogrow = class {
|
|
|
21
21
|
this.element.style.height = "auto", this.element.style.overflow = "hidden", this.element.style.height = `${this.element.scrollHeight}px`;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { TextareaAutogrow };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/checkAvailability.ts
|
|
2
2
|
function checkAvailability(getRef, callback, options) {
|
|
3
3
|
let opts = {
|
|
4
4
|
maxAttempts: 20,
|
|
@@ -12,5 +12,4 @@ function checkAvailability(getRef, callback, options) {
|
|
|
12
12
|
}
|
|
13
13
|
check();
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { checkAvailability };
|
package/dist/helpers/cookie.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isServer } from "./isServer.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/cookie.ts
|
|
3
3
|
var ONE_YEAR_SECONDS = 31536e3;
|
|
4
4
|
function getCookie(key, cookieHeader) {
|
|
5
5
|
let source = isServer() ? cookieHeader : document.cookie;
|
|
@@ -19,5 +19,4 @@ function deleteCookie(key, options = {}) {
|
|
|
19
19
|
maxAge: 0
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { deleteCookie, getCookie, setCookie };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { truthyFilter } from "./truthyFilter.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/countryCodeToUnicodeFlag.ts
|
|
3
3
|
function countryCodeToUnicodeFlag(locale) {
|
|
4
4
|
return Array.from(locale, (letter) => {
|
|
5
5
|
let code = letter.codePointAt(0);
|
|
6
6
|
return code ? code % 32 + 127461 : void 0;
|
|
7
7
|
}).filter(truthyFilter).map((n) => String.fromCodePoint(n)).join("");
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { countryCodeToUnicodeFlag };
|
package/dist/helpers/debounce.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/debounceCallback.ts
|
|
2
2
|
var timeout = null;
|
|
3
3
|
function debounceCallback(callback, delay) {
|
|
4
4
|
timeout && clearTimeout(timeout), timeout = setTimeout(callback, delay);
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
export { debounceCallback };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/debounceId.ts
|
|
2
2
|
function debounceId(identifier, func, delay) {
|
|
3
3
|
let debouncedFunctions = {};
|
|
4
4
|
return function(...args) {
|
|
@@ -20,5 +20,4 @@ function debounceId(identifier, func, delay) {
|
|
|
20
20
|
}), debounced.promise;
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
//#endregion
|
|
24
23
|
export { debounceId };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/fetchLocaleIp.ts
|
|
2
2
|
async function fetchLocaleIp() {
|
|
3
3
|
try {
|
|
4
4
|
let { country_code } = await (await fetch("https://ipwho.is")).json();
|
|
@@ -8,5 +8,4 @@ async function fetchLocaleIp() {
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { fetchLocaleIp };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/formatCurrency.ts
|
|
2
2
|
var DEFAULT_OPTIONS = {
|
|
3
3
|
style: "currency",
|
|
4
4
|
minimumFractionDigits: 2,
|
|
@@ -26,5 +26,4 @@ function formatCurrency(number, locale, options) {
|
|
|
26
26
|
throw Error(`[maz-ui](FilterCurrency) ${error}`, { cause: error });
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { formatCurrency };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/formatDate.ts
|
|
2
2
|
var DEFAULT_OPTIONS = {
|
|
3
3
|
month: "short",
|
|
4
4
|
day: "numeric",
|
|
@@ -15,5 +15,4 @@ function formatDate(date, locale, options) {
|
|
|
15
15
|
throw Error(`[maz-ui](FilterDate) ${error}`, { cause: error });
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { formatDate };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/formatNumber.ts
|
|
2
2
|
var DEFAULT_OPTIONS = { minimumFractionDigits: 2 };
|
|
3
3
|
function formatNumber(number, locale, options) {
|
|
4
4
|
let filterOptions = {
|
|
@@ -14,5 +14,4 @@ function formatNumber(number, locale, options) {
|
|
|
14
14
|
throw Error(`[maz-ui](FilterNumber) ${error}`, { cause: error });
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { formatNumber };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { parsePhoneNumberFromString } from "libphonenumber-js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/formatPhoneNumber.ts
|
|
3
3
|
function formatPhoneNumber(phoneNumber) {
|
|
4
4
|
if (!phoneNumber) throw TypeError("[maz-ui](formatPhoneNumber) The `phoneNumber` argument is required.");
|
|
5
5
|
let parsedPhone = parsePhoneNumberFromString(phoneNumber);
|
|
6
6
|
return parsedPhone ? parsedPhone.formatInternational() : phoneNumber;
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { formatPhoneNumber };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isServer } from "./isServer.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/getBrowserLocale.ts
|
|
3
3
|
function getBrowserLocale() {
|
|
4
4
|
try {
|
|
5
5
|
return isServer() ? void 0 : globalThis.navigator.language;
|
|
@@ -7,5 +7,4 @@ function getBrowserLocale() {
|
|
|
7
7
|
throw Error(`[MazInputPhoneNumber] (browserLocale) ${error}`, { cause: error });
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { getBrowserLocale };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/getCountryFlagUrl.ts
|
|
2
2
|
var _supportedCodes = /* @__PURE__ */ "ad.ae.af.ag.ai.al.am.ao.aq.ar.as.at.au.aw.ax.az.ba.bb.bd.be.bf.bg.bh.bi.bj.bl.bm.bn.bo.bq.br.bs.bt.bv.bw.by.bz.ca.cc.cd.cf.cg.ch.ci.ck.cl.cm.cn.co.cr.cu.cv.cw.cx.cy.cz.de.dj.dk.dm.do.dz.ec.ee.eg.eh.er.es.et.eu.fi.fj.fk.fm.fo.fr.ga.gb.gb-eng.gb-nir.gb-sct.gb-wls.gd.ge.gf.gg.gh.gi.gl.gm.gn.gp.gq.gr.gs.gt.gu.gw.gy.hk.hm.hn.hr.ht.hu.id.ie.il.im.in.io.iq.ir.is.it.je.jm.jo.jp.ke.kg.kh.ki.km.kn.kp.kr.kw.ky.kz.la.lb.lc.li.lk.lr.ls.lt.lu.lv.ly.ma.mc.md.me.mf.mg.mh.mk.ml.mm.mn.mo.mp.mq.mr.ms.mt.mu.mv.mw.mx.my.mz.na.nc.ne.nf.ng.ni.nl.no.np.nr.nu.nz.om.pa.pe.pf.pg.ph.pk.pl.pm.pn.pr.ps.pt.pw.py.qa.re.ro.rs.ru.rw.sa.sb.sc.sd.se.sg.sh.si.sj.sk.sl.sm.sn.so.sr.ss.st.sv.sx.sy.sz.tc.td.tf.tg.th.tj.tk.tl.tm.tn.to.tr.tt.tv.tw.tz.ua.ug.um.un.us.us-ak.us-al.us-ar.us-az.us-ca.us-co.us-ct.us-de.us-fl.us-ga.us-hi.us-ia.us-id.us-il.us-in.us-ks.us-ky.us-la.us-ma.us-md.us-me.us-mi.us-mn.us-mo.us-ms.us-mt.us-nc.us-nd.us-ne.us-nh.us-nj.us-nm.us-nv.us-ny.us-oh.us-ok.us-or.us-pa.us-ri.us-sc.us-sd.us-tn.us-tx.us-ut.us-va.us-vt.us-wa.us-wi.us-wv.us-wy.uy.uz.va.vc.ve.vg.vi.vn.vu.wf.ws.xk.ye.yt.za.zm.zw".split(".");
|
|
3
3
|
function getCountryFlagUrl(countryIsoCode, size) {
|
|
4
4
|
let code = countryIsoCode.toLowerCase();
|
|
5
5
|
if (_supportedCodes.includes(code)) return size ? `https://flagcdn.com/${size}/${code}.png` : `https://flagcdn.com/${code}.svg`;
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { getCountryFlagUrl };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/getErrorMessage.ts
|
|
2
2
|
function getErrorMessage(error) {
|
|
3
3
|
return error instanceof Error ? error.message : typeof error == "string" ? error : error && typeof error == "object" && "message" in error ? String(error.message) : error ? String(error) : "An unexpected error occurred";
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
export { getErrorMessage };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isClient } from "./isClient.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/idleTimeout.ts
|
|
3
3
|
var IdleTimeout = class {
|
|
4
4
|
callback;
|
|
5
5
|
defaultOptions = {
|
|
@@ -117,5 +117,4 @@ var IdleTimeout = class {
|
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
//#endregion
|
|
121
120
|
export { IdleTimeout };
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { camelCase } from "./camelCase.js";
|
|
2
2
|
import { capitalize } from "./capitalize.js";
|
|
3
3
|
import { checkAvailability } from "./checkAvailability.js";
|
|
4
|
-
import { isServer } from "./isServer.js";
|
|
5
4
|
import { deleteCookie, getCookie, setCookie } from "./cookie.js";
|
|
6
|
-
import { truthyFilter } from "./truthyFilter.js";
|
|
7
5
|
import { countryCodeToUnicodeFlag } from "./countryCodeToUnicodeFlag.js";
|
|
8
6
|
import { debounce } from "./debounce.js";
|
|
9
7
|
import { debounceCallback } from "./debounceCallback.js";
|
|
@@ -17,22 +15,24 @@ import { formatPhoneNumber } from "./formatPhoneNumber.js";
|
|
|
17
15
|
import { getBrowserLocale } from "./getBrowserLocale.js";
|
|
18
16
|
import { getCountryFlagUrl } from "./getCountryFlagUrl.js";
|
|
19
17
|
import { getErrorMessage } from "./getErrorMessage.js";
|
|
20
|
-
import { isClient } from "./isClient.js";
|
|
21
18
|
import { IdleTimeout } from "./idleTimeout.js";
|
|
19
|
+
import { isClient } from "./isClient.js";
|
|
22
20
|
import { isEqual } from "./isEqual.js";
|
|
23
21
|
import { isIos } from "./isIos.js";
|
|
22
|
+
import { isServer } from "./isServer.js";
|
|
24
23
|
import { isStandaloneMode } from "./isStandaloneMode.js";
|
|
25
24
|
import { kebabCase } from "./kebabCase.js";
|
|
26
|
-
import { pascalCase } from "./pascalCase.js";
|
|
27
|
-
import { snakeCase } from "./snakeCase.js";
|
|
28
25
|
import { normalizeString } from "./normalizeString.js";
|
|
26
|
+
import { pascalCase } from "./pascalCase.js";
|
|
29
27
|
import { addViewportMaximumScale, preventIosInputZoom } from "./preventIosInputZoom.js";
|
|
30
28
|
import { ScriptLoader } from "./scriptLoader.js";
|
|
31
29
|
import { sleep } from "./sleep.js";
|
|
30
|
+
import { snakeCase } from "./snakeCase.js";
|
|
32
31
|
import { Swipe } from "./swipeHandler.js";
|
|
33
32
|
import { TextareaAutogrow } from "./TextareaAutogrow.js";
|
|
34
33
|
import { throttle } from "./throttle.js";
|
|
35
34
|
import { throttleId } from "./throttleId.js";
|
|
35
|
+
import { truthyFilter } from "./truthyFilter.js";
|
|
36
36
|
import { upperFirst } from "./upperFirst.js";
|
|
37
37
|
import { UserVisibility } from "./userVisibility.js";
|
|
38
38
|
export { IdleTimeout, ScriptLoader, Swipe, TextareaAutogrow, UserVisibility, addViewportMaximumScale, camelCase, capitalize, checkAvailability, countryCodeToUnicodeFlag, debounce, debounceCallback, debounceId, deleteCookie, fetchLocaleIp, formatCurrency, formatDate, formatJson, formatNumber, formatPhoneNumber, getBrowserLocale, getCookie, getCountryFlagUrl, getErrorMessage, isClient, isEqual, isIos, isServer, isStandaloneMode, kebabCase, normalizeString, pascalCase, preventIosInputZoom, setCookie, sleep, snakeCase, throttle, throttleId, truthyFilter, upperFirst };
|
package/dist/helpers/isClient.js
CHANGED
package/dist/helpers/isEqual.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/isEqual.ts
|
|
2
2
|
function isPrimitive(value) {
|
|
3
3
|
return value == null || typeof value == "string" || typeof value == "number" || typeof value == "boolean" || typeof value == "symbol" || typeof value == "bigint";
|
|
4
4
|
}
|
|
@@ -17,5 +17,4 @@ function isEqualObjects(a, b) {
|
|
|
17
17
|
function isEqual(a, b) {
|
|
18
18
|
return isPrimitive(a) || isPrimitive(b) ? a === b : a instanceof Date && b instanceof Date ? a.getTime() === b.getTime() : typeof a != typeof b || Array.isArray(a) !== Array.isArray(b) ? !1 : Array.isArray(a) && Array.isArray(b) ? isEqualArrays(a, b) : typeof a == "object" && typeof b == "object" && isEqualObjects(a, b);
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { isEqual };
|
package/dist/helpers/isIos.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { isClient } from "./isClient.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/isIos.ts
|
|
3
3
|
function isIos() {
|
|
4
4
|
if (!isClient()) return !1;
|
|
5
5
|
let userAgent = navigator.userAgent;
|
|
6
6
|
return /iPhone|iPad|iPod/.test(userAgent) || /Macintosh/.test(userAgent) && navigator.maxTouchPoints > 1;
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { isIos };
|
package/dist/helpers/isServer.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isClient } from "./isClient.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/isStandaloneMode.ts
|
|
3
3
|
function isStandaloneMode() {
|
|
4
4
|
if (!isClient()) return !1;
|
|
5
5
|
let nav = navigator;
|
|
6
6
|
let isStandalone = globalThis.matchMedia("(display-mode: standalone)").matches;
|
|
7
7
|
return nav.standalone || isStandalone;
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { isStandaloneMode };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/kebabCase.ts
|
|
2
2
|
function kebabCase(str) {
|
|
3
3
|
return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase().replace(/-+/g, "-").replace(/(^-)|(-$)/g, "");
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
export { kebabCase };
|
|
@@ -2,7 +2,7 @@ import { camelCase } from "./camelCase.js";
|
|
|
2
2
|
import { kebabCase } from "./kebabCase.js";
|
|
3
3
|
import { pascalCase } from "./pascalCase.js";
|
|
4
4
|
import { snakeCase } from "./snakeCase.js";
|
|
5
|
-
|
|
5
|
+
// src/helpers/normalizeString.ts
|
|
6
6
|
var defaultOptions = {
|
|
7
7
|
removeAccents: !0,
|
|
8
8
|
caseSensitive: !1,
|
|
@@ -83,5 +83,4 @@ function normalizeString(input, options) {
|
|
|
83
83
|
if (finalOptions.trim && (result = result.trim()), finalOptions.normalizeSpaces && (result = result.replaceAll(/\s+/g, " ")), finalOptions.replaceSpaces && (result = result.replaceAll(" ", "-")), finalOptions.removeNumbers && (result = result.replaceAll(/\d/g, "")), finalOptions.removeAccents && (result = result.replaceAll(/[ÀÁÂÃÄÅÇÈÉÊËÎÏÑÔÕÖØÙÚÛÜàáâãäåçèéêëíîïñóôõöøùúûüÿ]/g, (char) => accentsMap[char] || char), result = result.replaceAll(/[\u0300-\u036F]/g, "")), finalOptions.case ? result = applyCaseTransform(result, finalOptions.case) : finalOptions.caseSensitive === !1 && (result = result.toLowerCase()), finalOptions.removeSpecialCharacters && (result = result.replaceAll(/[^\dA-Z-]/gi, "")), finalOptions.trim && (result = result.trim()), finalOptions.customNormalizationForms) for (let form of finalOptions.customNormalizationForms) result = result.normalize(form);
|
|
84
84
|
return result;
|
|
85
85
|
}
|
|
86
|
-
//#endregion
|
|
87
86
|
export { normalizeString };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { camelCase } from "./camelCase.js";
|
|
2
2
|
import { capitalize } from "./capitalize.js";
|
|
3
|
-
|
|
3
|
+
// src/helpers/pascalCase.ts
|
|
4
4
|
function pascalCase(str) {
|
|
5
5
|
if (str === str.toUpperCase()) {
|
|
6
6
|
if (str.includes("-")) return str.toLowerCase().split("-").map(capitalize).join("");
|
|
@@ -9,5 +9,4 @@ function pascalCase(str) {
|
|
|
9
9
|
}
|
|
10
10
|
return str.includes("-") ? str.toLowerCase().split("-").map(capitalize).join("") : str.includes("_") ? str.toLowerCase().split("_").map(capitalize).join("") : str.includes(" ") ? str.toLowerCase().split(" ").map(capitalize).join("") : capitalize(camelCase(str));
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { pascalCase };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isIos } from "./isIos.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/preventIosInputZoom.ts
|
|
3
3
|
var MAXIMUM_SCALE_REGEX = /maximum-scale\s*=\s*[\d.]+/i;
|
|
4
4
|
function addViewportMaximumScale(content) {
|
|
5
5
|
return MAXIMUM_SCALE_REGEX.test(content) ? content.replace(MAXIMUM_SCALE_REGEX, "maximum-scale=1") : content.trim() ? `${content}, maximum-scale=1` : "maximum-scale=1";
|
|
@@ -11,5 +11,4 @@ function preventIosInputZoom() {
|
|
|
11
11
|
let originalContent = meta.getAttribute("content") ?? "";
|
|
12
12
|
return meta.setAttribute("content", addViewportMaximumScale(originalContent)), () => meta.setAttribute("content", originalContent);
|
|
13
13
|
}
|
|
14
|
-
//#endregion
|
|
15
14
|
export { addViewportMaximumScale, preventIosInputZoom };
|
package/dist/helpers/sleep.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/snakeCase.ts
|
|
2
2
|
function snakeCase(str) {
|
|
3
3
|
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase().replace(/_+/g, "_").replace(/(^_)|(_$)/g, "");
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
export { snakeCase };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/swipeHandler.ts
|
|
2
2
|
var defaultOptions = {
|
|
3
3
|
preventDefaultOnMove: !1,
|
|
4
4
|
preventDefaultOnMouseWheel: !1,
|
|
@@ -79,5 +79,4 @@ var Swipe = class {
|
|
|
79
79
|
this.xStart = void 0, this.yStart = void 0, this.xEnd = void 0, this.yEnd = void 0, this.xDiff = void 0, this.yDiff = void 0, this.emitValuesChanged();
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
//#endregion
|
|
83
82
|
export { Swipe };
|
package/dist/helpers/throttle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/throttle.ts
|
|
2
2
|
function throttle(func, limit) {
|
|
3
3
|
let inThrottle = !1;
|
|
4
4
|
let lastFunc;
|
|
@@ -9,5 +9,4 @@ function throttle(func, limit) {
|
|
|
9
9
|
}, Math.max(limit - (Date.now() - lastRan), 0))) : (func.apply(this, args), lastRan = Date.now(), inThrottle = !0);
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { throttle };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/helpers/throttleId.ts
|
|
2
2
|
function throttleId(identifier, func, interval) {
|
|
3
3
|
let state = {};
|
|
4
4
|
return async (...args) => {
|
|
@@ -16,5 +16,4 @@ function throttleId(identifier, func, interval) {
|
|
|
16
16
|
})), state[identifier].promise);
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { throttleId };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isClient } from "./isClient.js";
|
|
2
|
-
|
|
2
|
+
// src/helpers/userVisibility.ts
|
|
3
3
|
var UserVisibility = class {
|
|
4
4
|
callback;
|
|
5
5
|
eventHandlerFunction;
|
|
@@ -43,5 +43,4 @@ var UserVisibility = class {
|
|
|
43
43
|
this.removeEventListener(), this.timeoutHandler && clearTimeout(this.timeoutHandler);
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
//#endregion
|
|
47
46
|
export { UserVisibility };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maz-ui/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.3.0",
|
|
5
5
|
"description": "Utils of maz-ui for JavaScript/TypeScript users",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dist"
|
|
60
60
|
],
|
|
61
61
|
"engines": {
|
|
62
|
-
"node": "
|
|
62
|
+
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"libphonenumber-js": ">= 1 < 2"
|
|
@@ -72,17 +72,17 @@
|
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@codecov/vite-plugin": "^2.0.1",
|
|
74
74
|
"@maz-ui/vite-config": "^0.0.0",
|
|
75
|
-
"@types/node": "^
|
|
75
|
+
"@types/node": "^26.6.6",
|
|
76
76
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
77
|
-
"@vitest/coverage-v8": "^5.0
|
|
77
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
78
78
|
"cross-env": "^10.1.0",
|
|
79
|
-
"eslint": "^10.
|
|
80
|
-
"glob": "^
|
|
79
|
+
"eslint": "^10.14.0",
|
|
80
|
+
"glob": "^14.0.3",
|
|
81
81
|
"libphonenumber-js": "^1.13.15",
|
|
82
82
|
"typescript": "^6.0.3",
|
|
83
|
-
"vite": "^8.3.
|
|
83
|
+
"vite": "^8.3.5",
|
|
84
84
|
"vite-plugin-dts": "^5.1.2",
|
|
85
|
-
"vitest": "5.0
|
|
85
|
+
"vitest": "5.1.0",
|
|
86
86
|
"vue": "^3.5.44"
|
|
87
87
|
},
|
|
88
88
|
"lint-staged": {
|