mazey 5.9.2 → 5.10.1

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/lib/index.d.ts CHANGED
@@ -277,9 +277,9 @@ declare function calLongestCommonSubsequence(aStr: string, bStr: string): number
277
277
  * Usage:
278
278
  *
279
279
  * ```javascript
280
- * import { isHit } from "mazey";
280
+ * import { randomBoolean } from "mazey";
281
281
  *
282
- * const ret = isHit(0.5); // A 50% chance of returning true.
282
+ * const ret = randomBoolean(0.5); // A 50% chance of returning true.
283
283
  * console.log(ret);
284
284
  * ```
285
285
  *
@@ -295,7 +295,7 @@ declare function calLongestCommonSubsequence(aStr: string, bStr: string): number
295
295
  * let trueCount = 0;
296
296
  * let falseCount = 0;
297
297
  * new Array(1000000).fill(0).forEach(() => {
298
- * if (isHit(0.5)) {
298
+ * if (randomBoolean(0.5)) {
299
299
  * trueCount++;
300
300
  * } else {
301
301
  * falseCount++;
@@ -314,9 +314,18 @@ declare function calLongestCommonSubsequence(aStr: string, bStr: string): number
314
314
  * @returns {boolean} Whether the random value is less than the probability.
315
315
  * @category Calculate and Formula
316
316
  */
317
+ declare function randomBoolean(rate: number): boolean;
318
+ /**
319
+ * Deprecated alias of {@link randomBoolean}.
320
+ *
321
+ * @deprecated Use `randomBoolean` instead.
322
+ * @param rate Probability expressed as a value from 0 to 1.
323
+ * @returns Whether the random value is less than the probability.
324
+ * @category Calculate and Formula
325
+ */
317
326
  declare function isHit(rate: number): boolean;
318
327
  /**
319
- * Alias of `isHit`.
328
+ * Compatibility alias of {@link randomBoolean}.
320
329
  *
321
330
  * @hidden
322
331
  */
@@ -535,14 +544,14 @@ declare function formatLocalDateTime(date: Date, options?: {
535
544
  */
536
545
  declare function subYears(date: Date | number, amount: number): Date;
537
546
  /**
538
- * Get the current timestamp in milliseconds.
547
+ * Return the current timestamp in milliseconds.
548
+ *
549
+ * This compatibility helper delegates to native `Date.now()`.
539
550
  *
540
551
  * Usage:
541
552
  *
542
553
  * ```javascript
543
- * import { mNow } from "mazey";
544
- *
545
- * const ret = mNow();
554
+ * const ret = Date.now();
546
555
  * console.log(ret);
547
556
  * ```
548
557
  *
@@ -553,6 +562,7 @@ declare function subYears(date: Date | number, amount: number): Date;
553
562
  * ```
554
563
  *
555
564
  * @returns {number} The current timestamp in milliseconds.
565
+ * @deprecated Use `Date.now()` instead.
556
566
  * @category Util
557
567
  */
558
568
  declare function mNow(): number;
@@ -1560,16 +1570,16 @@ declare function isBool(bool: MazeyObject): boolean;
1560
1570
  */
1561
1571
  declare function isBoolean(bool: MazeyObject): boolean;
1562
1572
  /**
1563
- * Verify the validity of a value.
1573
+ * Return whether a value is exactly `undefined` or `null`.
1564
1574
  *
1565
1575
  * Usage:
1566
1576
  *
1567
1577
  * ```javascript
1568
- * import { isUdfOrNul } from "mazey";
1578
+ * import { isNullish } from "mazey";
1569
1579
  *
1570
- * const ret1 = isUdfOrNul(undefined);
1571
- * const ret2 = isUdfOrNul(null);
1572
- * const ret3 = isUdfOrNul("abc");
1580
+ * const ret1 = isNullish(undefined);
1581
+ * const ret2 = isNullish(null);
1582
+ * const ret3 = isNullish("abc");
1573
1583
  * console.log(ret1, ret2, ret3);
1574
1584
  * ```
1575
1585
  *
@@ -1579,8 +1589,20 @@ declare function isBoolean(bool: MazeyObject): boolean;
1579
1589
  * true true false
1580
1590
  * ```
1581
1591
  *
1592
+ * Other falsy values, including `false`, `0`, `NaN`, and an empty string,
1593
+ * return `false`.
1594
+ *
1582
1595
  * @param {MazeyObject} val The value to verify.
1583
- * @returns {boolean} Return TRUE if the object is undefined or null.
1596
+ * @returns {boolean} Whether the value is `undefined` or `null`.
1597
+ * @category Util
1598
+ */
1599
+ declare function isNullish(val: MazeyObject): boolean;
1600
+ /**
1601
+ * Deprecated alias of {@link isNullish}.
1602
+ *
1603
+ * @deprecated Use `isNullish` instead.
1604
+ * @param val The value to verify.
1605
+ * @returns Whether the value is `undefined` or `null`.
1584
1606
  * @category Util
1585
1607
  */
1586
1608
  declare function isUdfOrNul(val: MazeyObject): boolean;
@@ -1760,37 +1782,50 @@ declare function escapeHtmlAttribute(value: string, options?: {
1760
1782
  preserveEntities?: boolean;
1761
1783
  }): string;
1762
1784
  /**
1763
- * Sanitizes user input to prevent XSS attacks.
1785
+ * Escape ampersands, angle brackets, quotes, and forward slashes as HTML entities.
1786
+ *
1787
+ * This performs character escaping only. It does not sanitize arbitrary HTML,
1788
+ * validate URLs, or make every HTML, JavaScript, or CSS context safe.
1764
1789
  *
1765
1790
  * Usage:
1766
1791
  *
1767
1792
  * ```javascript
1768
- * import { sanitizeInput } from "mazey";
1793
+ * import { escapeHTML } from "mazey";
1769
1794
  *
1770
- * const ret = sanitizeInput("<div>hello world</div>");
1795
+ * const ret = escapeHTML("<div>hello world</div>");
1771
1796
  * console.log(ret);
1772
1797
  * ```
1773
1798
  *
1774
1799
  * Output:
1775
1800
  *
1776
1801
  * ```text
1777
- * &lt;div&gt;hello world&lt;/div&gt;
1802
+ * &lt;div&gt;hello world&lt;&#x2F;div&gt;
1778
1803
  * ```
1779
1804
  *
1780
- * @param input - The input string to sanitize
1781
- * @returns The sanitized input string
1805
+ * @param input The string to escape.
1806
+ * @returns The escaped string.
1807
+ * @category Util
1808
+ */
1809
+ declare function escapeHTML(input: string): string;
1810
+ /**
1811
+ * Deprecated alias of {@link escapeHTML}.
1812
+ *
1813
+ * @deprecated Use `escapeHTML` instead.
1782
1814
  * @category Util
1783
1815
  */
1784
- declare function sanitizeInput(input: string): string;
1816
+ declare const sanitizeInput: typeof escapeHTML;
1785
1817
  /**
1786
- * Reverses the sanitization done by the `sanitizeInput` function.
1818
+ * Decode the fixed HTML entity set emitted by {@link escapeHTML}.
1819
+ *
1820
+ * Decoding uses one pass and preserves unrecognized entities. This is not a
1821
+ * general HTML entity decoder, and the result may contain active HTML markup.
1787
1822
  *
1788
1823
  * Usage:
1789
1824
  *
1790
1825
  * ```javascript
1791
- * import { unsanitizeInput } from "mazey";
1826
+ * import { unescapeHTML } from "mazey";
1792
1827
  *
1793
- * const ret = unsanitizeInput("&lt;div&gt;hello world&lt;/div&gt;");
1828
+ * const ret = unescapeHTML("&lt;div&gt;hello world&lt;&#x2F;div&gt;");
1794
1829
  * console.log(ret);
1795
1830
  * ```
1796
1831
  *
@@ -1800,27 +1835,37 @@ declare function sanitizeInput(input: string): string;
1800
1835
  * <div>hello world</div>
1801
1836
  * ```
1802
1837
  *
1803
- * @param input - The input string to unsanitize
1804
- * @returns The unsanitized input string
1838
+ * @param input The string containing escaped characters.
1839
+ * @returns The decoded string.
1840
+ * @category Util
1841
+ */
1842
+ declare function unescapeHTML(input: string): string;
1843
+ /**
1844
+ * Deprecated alias of {@link unescapeHTML}.
1845
+ *
1846
+ * @deprecated Use `unescapeHTML` instead.
1805
1847
  * @category Util
1806
1848
  */
1807
- declare function unsanitizeInput(input: string): string;
1849
+ declare const unsanitizeInput: typeof unescapeHTML;
1808
1850
  /**
1809
- * Alias of `unsanitizeInput`.
1851
+ * Alias of `unescapeHTML`.
1810
1852
  *
1811
1853
  * @hidden
1812
1854
  */
1813
1855
  declare function unsanitize(str: string): string;
1814
1856
  /**
1815
- * Truncate a string by weighted length, counting non-ASCII characters as two
1816
- * units.
1857
+ * Truncate a string by weighted UTF-16 length.
1858
+ *
1859
+ * Code units from U+0000 through U+00FF count as one; all other code units
1860
+ * count as two. Optional truncation text is appended after the length limit.
1861
+ * This does not measure bytes or rendered width and can split surrogate pairs.
1817
1862
  *
1818
1863
  * Usage:
1819
1864
  *
1820
1865
  * ```javascript
1821
- * import { cutZHString } from "mazey";
1866
+ * import { truncateByWeightedLength } from "mazey";
1822
1867
  *
1823
- * const ret = cutZHString("hello world", 5);
1868
+ * const ret = truncateByWeightedLength("hello world", 5);
1824
1869
  * console.log(ret);
1825
1870
  * ```
1826
1871
  *
@@ -1837,12 +1882,19 @@ declare function unsanitize(str: string): string;
1837
1882
  * @returns {string} The truncated string.
1838
1883
  * @category Util
1839
1884
  */
1840
- declare function cutZHString(str: string | null | undefined, len: number, options?: {
1885
+ declare function truncateByWeightedLength(str: string | null | undefined, len: number, options?: {
1841
1886
  hasDot?: boolean;
1842
1887
  dotText?: string;
1843
1888
  }): string;
1844
1889
  /**
1845
- * Alias of `cutZHString`.
1890
+ * Deprecated alias of {@link truncateByWeightedLength}.
1891
+ *
1892
+ * @deprecated Use `truncateByWeightedLength` instead.
1893
+ * @category Util
1894
+ */
1895
+ declare const cutZHString: typeof truncateByWeightedLength;
1896
+ /**
1897
+ * Alias of `truncateByWeightedLength`.
1846
1898
  *
1847
1899
  * Usage:
1848
1900
  *
@@ -2015,17 +2067,20 @@ declare function genHashCode(str: string): number;
2015
2067
  */
2016
2068
  declare function sha256Hex(input: string | BufferSource): Promise<string>;
2017
2069
  /**
2018
- * Check if the given string is a mobile phone number.
2070
+ * Check whether a string has the 11-digit Chinese mobile-number format.
2071
+ *
2072
+ * The pattern requires a leading `1` followed by ten digits. It does not
2073
+ * verify assigned prefixes, ownership, reachability, or international formats.
2019
2074
  *
2020
2075
  * Usage:
2021
2076
  *
2022
2077
  * ```javascript
2023
- * import { isValidPhoneNumber } from "mazey";
2078
+ * import { isCNMobileNumber } from "mazey";
2024
2079
  *
2025
- * const ret1 = isValidPhoneNumber("13800138000");
2026
- * const ret2 = isValidPhoneNumber("1380013800");
2027
- * const ret3 = isValidPhoneNumber("138001380000");
2028
- * const ret4 = isValidPhoneNumber("1380013800a");
2080
+ * const ret1 = isCNMobileNumber("13800138000");
2081
+ * const ret2 = isCNMobileNumber("1380013800");
2082
+ * const ret3 = isCNMobileNumber("138001380000");
2083
+ * const ret4 = isCNMobileNumber("1380013800a");
2029
2084
  * console.log(ret1, ret2, ret3, ret4);
2030
2085
  * ```
2031
2086
  *
@@ -2035,21 +2090,28 @@ declare function sha256Hex(input: string | BufferSource): Promise<string>;
2035
2090
  * true false false false
2036
2091
  * ```
2037
2092
  *
2038
- * @param mobile
2039
- * @returns {boolean} Return true if the given string is a mobile phone number.
2093
+ * @param mobile The string to check.
2094
+ * @returns Whether the string matches the Chinese mobile-number format.
2095
+ * @category Util
2096
+ */
2097
+ declare function isCNMobileNumber(mobile: string): boolean;
2098
+ /**
2099
+ * Deprecated alias of {@link isCNMobileNumber}.
2100
+ *
2101
+ * @deprecated Use `isCNMobileNumber` instead.
2040
2102
  * @category Util
2041
2103
  */
2042
- declare function isValidPhoneNumber(mobile: string): boolean;
2104
+ declare const isValidPhoneNumber: typeof isCNMobileNumber;
2043
2105
  /**
2044
- * Deprecated alias of {@link isValidPhoneNumber}.
2106
+ * Deprecated alias of {@link isCNMobileNumber}.
2045
2107
  *
2046
2108
  * This helper validates an 11-digit Chinese mobile-shaped number. It does not
2047
2109
  * detect a browser's device form factor; use `isPhone` for that purpose.
2048
2110
  *
2049
- * @deprecated Use `isValidPhoneNumber` instead.
2111
+ * @deprecated Use `isCNMobileNumber` instead.
2050
2112
  * @category Util
2051
2113
  */
2052
- declare const isMobile: typeof isValidPhoneNumber;
2114
+ declare const isMobile: typeof isCNMobileNumber;
2053
2115
  /**
2054
2116
  * Check if the given string is a valid email.
2055
2117
  *
@@ -2465,18 +2527,23 @@ declare function isValidHttpUrl(url: string, options?: {
2465
2527
  strict: boolean;
2466
2528
  }): boolean;
2467
2529
  /**
2468
- * Get the file extension from a URL or path.
2530
+ * Extract the extension from a URL or path after removing query and fragment text.
2531
+ *
2532
+ * This string-based helper does not inspect file contents or detect MIME types.
2533
+ * It retains everything after the first dot in the final slash-delimited
2534
+ * segment, so `archive.tar.gz` returns `tar.gz`. It does not parse URL authority:
2535
+ * an origin-only input such as `https://example.com` returns `com`.
2469
2536
  *
2470
2537
  * Usage:
2471
2538
  *
2472
2539
  * ```javascript
2473
- * import { getUrlFileType } from "mazey";
2540
+ * import { getURLPathExtension } from "mazey";
2474
2541
  *
2475
- * const ret1 = getUrlFileType("https://example.com/a/b/c.png");
2476
- * const ret2 = getUrlFileType("https://example.com/a/b/c.jpg");
2477
- * const ret3 = getUrlFileType("https://example.com/a/b/c.jpeg");
2478
- * const ret4 = getUrlFileType("/a/b/c.jpeg");
2479
- * const ret5 = getUrlFileType("https://example.com/a/b/c.v/a");
2542
+ * const ret1 = getURLPathExtension("https://example.com/a/b/c.png");
2543
+ * const ret2 = getURLPathExtension("https://example.com/a/b/c.jpg");
2544
+ * const ret3 = getURLPathExtension("https://example.com/a/b/c.jpeg");
2545
+ * const ret4 = getURLPathExtension("/a/b/c.jpeg");
2546
+ * const ret5 = getURLPathExtension("https://example.com/a/b/c.v/a");
2480
2547
  * console.log(ret1, ret2, ret3, ret4, ret5);
2481
2548
  * ```
2482
2549
  *
@@ -2486,11 +2553,18 @@ declare function isValidHttpUrl(url: string, options?: {
2486
2553
  * png jpg jpeg jpeg ""
2487
2554
  * ```
2488
2555
  *
2489
- * @param url
2490
- * @returns
2556
+ * @param url The URL or path to inspect.
2557
+ * @returns The extension without the leading dot, or an empty string when absent.
2558
+ * @category URL
2559
+ */
2560
+ declare function getURLPathExtension(url: string): boolean | string;
2561
+ /**
2562
+ * Deprecated alias of {@link getURLPathExtension}.
2563
+ *
2564
+ * @deprecated Use `getURLPathExtension` instead.
2491
2565
  * @category URL
2492
2566
  */
2493
- declare function getUrlFileType(url: string): boolean | string;
2567
+ declare const getUrlFileType: typeof getURLPathExtension;
2494
2568
  /**
2495
2569
  * Retrieve a query parameter from a script URL in the browser.
2496
2570
  *
@@ -2675,10 +2749,10 @@ declare function hasClass(obj: MazeyElement, cls: string): boolean;
2675
2749
  * Advanced Usage:
2676
2750
  *
2677
2751
  * ```javascript
2678
- * import { addClass, genBrowserAttrs } from "mazey";
2752
+ * import { addClass, getBrowserClassNames } from "mazey";
2679
2753
  *
2680
2754
  * const ele = document.querySelector("html");
2681
- * addClass(ele, genBrowserAttrs());
2755
+ * addClass(ele, getBrowserClassNames());
2682
2756
  * ```
2683
2757
  *
2684
2758
  * Output:
@@ -2752,18 +2826,18 @@ declare function removeClass(obj: MazeyElement, cls: string): void;
2752
2826
  * <style>body { background-color: #444; }</style>
2753
2827
  * ```
2754
2828
  *
2755
- * Example 3: Combine `genStyleString` and `injectStyle` to add multiple styles at once.
2829
+ * Example 3: Combine `createCSSRule` and `injectStyle` to add multiple styles at once.
2756
2830
  *
2757
2831
  * ```javascript
2758
- * import { genStyleString, injectStyle } from "mazey";
2832
+ * import { createCSSRule, injectStyle } from "mazey";
2759
2833
  *
2760
- * const xStyle = genStyleString(
2834
+ * const xStyle = createCSSRule(
2761
2835
  * ".footer>.x-wish>a:first-child" +
2762
2836
  * ",div.wish-flex>a[href^='https://github.com/chengchuu']" +
2763
2837
  * ",.m-hide",
2764
2838
  * [ "display: none" ]
2765
2839
  * );
2766
- * const yStyle = genStyleString(
2840
+ * const yStyle = createCSSRule(
2767
2841
  * ".footer>.y-wish:before",
2768
2842
  * [
2769
2843
  * `content: 'Copyright (c) chengchuu'`,
@@ -2833,13 +2907,16 @@ declare function setImgSizeBySrc(): boolean;
2833
2907
  */
2834
2908
  declare function setImgWidHeiBySrc(): boolean;
2835
2909
  /**
2836
- * Generate the inline style string from the given parameters. The first parameter is the query selector, and the second parameter is the style array.
2910
+ * Create CSS rule text from a selector and an array of declarations.
2911
+ *
2912
+ * Declarations are joined with semicolons. The selector and declarations are
2913
+ * used verbatim without validation or escaping; this function does not modify the DOM.
2837
2914
  *
2838
2915
  * Usage:
2839
2916
  *
2840
2917
  * ```javascript
2841
- * const ret1 = genStyleString(".a", [ "color:red" ]);
2842
- * const ret2 = genStyleString("#b", [ "color:red", "font-size:12px" ]);
2918
+ * const ret1 = createCSSRule(".a", [ "color:red" ]);
2919
+ * const ret2 = createCSSRule("#b", [ "color:red", "font-size:12px" ]);
2843
2920
  * console.log(ret1);
2844
2921
  * console.log(ret2);
2845
2922
  * ```
@@ -2851,18 +2928,18 @@ declare function setImgWidHeiBySrc(): boolean;
2851
2928
  * #b{color:red;font-size:12px;}
2852
2929
  * ```
2853
2930
  *
2854
- * Example: Combine `genStyleString` and `injectStyle` to add multiple styles at once.
2931
+ * Example: Combine `createCSSRule` and `injectStyle` to add multiple styles at once.
2855
2932
  *
2856
2933
  * ```javascript
2857
- * import { genStyleString, injectStyle } from "mazey";
2934
+ * import { createCSSRule, injectStyle } from "mazey";
2858
2935
  *
2859
- * const xStyle = genStyleString(
2936
+ * const xStyle = createCSSRule(
2860
2937
  * ".footer>.x-wish>a:first-child" +
2861
2938
  * ",div.wish-flex>a[href^='https://github.com/chengchuu']" +
2862
2939
  * ",.m-hide",
2863
2940
  * [ "display: none" ]
2864
2941
  * );
2865
- * const yStyle = genStyleString(
2942
+ * const yStyle = createCSSRule(
2866
2943
  * ".footer>.y-wish:before",
2867
2944
  * [
2868
2945
  * `content: 'Copyright (c) chengchuu'`,
@@ -2884,10 +2961,17 @@ declare function setImgWidHeiBySrc(): boolean;
2884
2961
  *
2885
2962
  * @param {string} selector
2886
2963
  * @param {array} styleArray
2887
- * @returns {string} The inline style string.
2964
+ * @returns {string} The CSS selector and declaration block.
2888
2965
  * @category DOM
2889
2966
  */
2890
- declare function genStyleString(selector: string, styleArray: Array<string>): string;
2967
+ declare function createCSSRule(selector: string, styleArray: Array<string>): string;
2968
+ /**
2969
+ * Deprecated alias of {@link createCSSRule}.
2970
+ *
2971
+ * @deprecated Use `createCSSRule` instead.
2972
+ * @category DOM
2973
+ */
2974
+ declare const genStyleString: typeof createCSSRule;
2891
2975
  /**
2892
2976
  * Get the value of the meta tag by the given name.
2893
2977
  *
@@ -2961,12 +3045,12 @@ interface ResolveElementTargetOptions {
2961
3045
  type DomVisibilityTarget = string | Element | Iterable<Element> | ArrayLike<Element> | null | undefined;
2962
3046
  /**
2963
3047
  * Hide every resolved element while preserving its visible inline `display`
2964
- * value for a later call to {@link show}.
3048
+ * value for a later call to {@link showElements}.
2965
3049
  *
2966
3050
  * ```javascript
2967
- * import { hide } from "mazey";
3051
+ * import { hideElements } from "mazey";
2968
3052
  *
2969
- * hide(".notice");
3053
+ * hideElements(".notice");
2970
3054
  * ```
2971
3055
  *
2972
3056
  * @remarks Selectors use the global document. Direct elements and collections
@@ -2976,17 +3060,17 @@ type DomVisibilityTarget = string | Element | Iterable<Element> | ArrayLike<Elem
2976
3060
  * @returns The original target unchanged, to support chaining by the caller.
2977
3061
  * @category DOM
2978
3062
  */
2979
- declare function hide<T extends DomVisibilityTarget>(target: T): T;
3063
+ declare function hideElements<T extends DomVisibilityTarget>(target: T): T;
2980
3064
  /**
2981
3065
  * Show every resolved element by restoring a display value preserved by
2982
- * {@link hide}, or by applying the document-aware default for CSS-hidden
3066
+ * {@link hideElements}, or by applying the document-aware default for CSS-hidden
2983
3067
  * elements.
2984
3068
  *
2985
3069
  * ```javascript
2986
- * import { show } from "mazey";
3070
+ * import { showElements } from "mazey";
2987
3071
  *
2988
3072
  * const notices = document.querySelectorAll(".notice");
2989
- * show(notices);
3073
+ * showElements(notices);
2990
3074
  * ```
2991
3075
  *
2992
3076
  * @remarks Selectors use the global document. Direct elements and collections
@@ -2996,6 +3080,24 @@ declare function hide<T extends DomVisibilityTarget>(target: T): T;
2996
3080
  * @returns The original target unchanged, to support chaining by the caller.
2997
3081
  * @category DOM
2998
3082
  */
3083
+ declare function showElements<T extends DomVisibilityTarget>(target: T): T;
3084
+ /**
3085
+ * Deprecated alias of {@link hideElements}.
3086
+ *
3087
+ * @deprecated Use `hideElements` instead.
3088
+ * @param target Selector, element, iterable, array-like collection, or an empty target.
3089
+ * @returns The original target unchanged.
3090
+ * @category DOM
3091
+ */
3092
+ declare function hide<T extends DomVisibilityTarget>(target: T): T;
3093
+ /**
3094
+ * Deprecated alias of {@link showElements}.
3095
+ *
3096
+ * @deprecated Use `showElements` instead.
3097
+ * @param target Selector, element, iterable, array-like collection, or an empty target.
3098
+ * @returns The original target unchanged.
3099
+ * @category DOM
3100
+ */
2999
3101
  declare function show<T extends DomVisibilityTarget>(target: T): T;
3000
3102
  /**
3001
3103
  * Resolve an element from a direct element, a selector, an optionally
@@ -3808,7 +3910,7 @@ type VisitorType = "crawler" | "automation" | "unknown";
3808
3910
  * @remarks Device classification is heuristic and spoofable. Do not use this
3809
3911
  * helper as a security boundary or as a substitute for responsive CSS or
3810
3912
  * feature detection. It does not inspect viewport dimensions. The separate
3811
- * `isMobile` export is an alias of the `isValidPhoneNumber` string validator.
3913
+ * `isMobile` export is an alias of the `isCNMobileNumber` string validator.
3812
3914
  * @category Browser Information
3813
3915
  */
3814
3916
  declare function isPhone(userAgent?: string): boolean;
@@ -4184,14 +4286,17 @@ declare function isStandalonePWA(options?: IsStandalonePWAOptions): boolean;
4184
4286
  */
4185
4287
  declare function getBrowserInfo(): BrowserInfo;
4186
4288
  /**
4187
- * Generate browser attributes from the detected browser information.
4289
+ * Get CSS class-name tokens from the cached browser classification.
4290
+ *
4291
+ * Each available classification value receives the optional prefix and
4292
+ * separator. This function returns strings without modifying the DOM.
4188
4293
  *
4189
4294
  * Usage:
4190
4295
  *
4191
4296
  * ```javascript
4192
- * import { genBrowserAttrs } from "mazey";
4297
+ * import { getBrowserClassNames } from "mazey";
4193
4298
  *
4194
- * const attrs = genBrowserAttrs();
4299
+ * const attrs = getBrowserClassNames();
4195
4300
  * console.log(attrs);
4196
4301
  * ```
4197
4302
  *
@@ -4202,11 +4307,19 @@ declare function getBrowserInfo(): BrowserInfo;
4202
4307
  * ```
4203
4308
  *
4204
4309
  * @remarks Browser only.
4205
- * @param {string} prefix
4206
- * @returns {array} Browser attributes
4310
+ * @param prefix Optional prefix for every class name.
4311
+ * @param separator Separator between a non-empty prefix and each value. Defaults to `-`.
4312
+ * @returns Browser classification class names.
4313
+ * @category Browser Information
4314
+ */
4315
+ declare function getBrowserClassNames(prefix?: string, separator?: string): string[];
4316
+ /**
4317
+ * Deprecated alias of {@link getBrowserClassNames}.
4318
+ *
4319
+ * @deprecated Use `getBrowserClassNames` instead.
4207
4320
  * @category Browser Information
4208
4321
  */
4209
- declare function genBrowserAttrs(prefix?: string, separator?: string): string[];
4322
+ declare const genBrowserAttrs: typeof getBrowserClassNames;
4210
4323
  /**
4211
4324
  * Detect webp support.
4212
4325
  *
@@ -4615,5 +4728,5 @@ declare const mazeyCon: Console;
4615
4728
  */
4616
4729
  declare const timeCon: Console;
4617
4730
 
4618
- export { addClass, addEvent, addStyle, assignDefined, calLongestCommonSubsequence, calLongestCommonSubstring, calculateAspectRatio, calculateCAGR, camelCase2Underscore, camelCaseToKebabCase, cancelBubble, clearHTML, clearHtml, convert10To26, convertCamelToKebab, convertCamelToUnder, convertHttpToHttps, convertKebabToCamel, convertObjectToQuery, convertToHtmlBreaks, convertUnderToCamel, cutCHSString, cutZHString, debounce, deepCopy, deepCopyObject, deepFreeze, delCookie, derivePackageMetadata, detectVisitorType, doFn, escapeHtmlAttribute, extractElementText, fireEvent, floatFixed, floatToPercent, formatByteSize, formatDate, formatDistanceToNow, formatDurationFromMs, formatLocalDateTime, genBrowserAttrs, genCustomConsole, genHashCode, genRndNumString, genStyleString, genUniqueNumString, generateCalendarVersion, generateRndNum, generateUniqueNum, getAllQueryParams, getBrowserInfo, getCLS, getCookie, getCurrentVersion, getDateDifference, getDefineListeners, getDomain, getFCP, getFID, getFP, getFileSize, getFriendlyInterval, getHashQueryParam, getLCP, getLocalJSON, getLocalStorage, getPageMeta, getPerformance, getQueryParam, getScriptQueryParam, getSessionJSON, getSessionStorage, getSystemTheme, getTTFB, getUrlFileType, getUrlHost, getUrlParam, getUrlPath, hasClass, hide, inRate, injectStyle, invokeEvent, invokeFn, isAndroid, isArray, isBool, isBoolean, isBrowser, isDesktop, isFunction, isHit, isIOS, isJSONString, isJsonString, isLinux, isMacOS, isMobile, isNonEmptyArray, isNonEmptyObject, isNumber, isPhone, isPureObject, isSafePWAEnv, isStandalonePWA, isString, isSupportWebp, isSupportedEntryType, isTablet, isThisHour, isThisMonth, isThisWeek, isThisYear, isToday, isUdfOrNul, isValidCssSelector, isValidData, isValidDate, isValidEmail, isValidHttpUrl, isValidPhoneNumber, isValidUrl, isWindows, listenMediaQueryChanges, loadCSS, loadImage, loadScript, loadScriptIfUndefined, longestComSubsequence, longestComSubstring, mNow, mTrim, mazeyCon, newLine, onEvent, onURLChange, parseGitHubRepository, parseJsonSafe, parseLocalDateTime, removeClass, removeCookie, removeEvent, removeHTML, removeHtml, repeatUntilConditionMet, replaceHttp, resolveElementTarget, resolveLanguagePreference, resolveThemePreference, sanitizeInput, setClass, setCookie, setImgSizeBySrc, setImgWidHeiBySrc, setLanguagePreference, setLocalJSON, setLocalStorage, setSessionJSON, setSessionStorage, setThemePreference, sha256Hex, show, sleep, subYears, throttle, timeCon, toJavaScriptGlobalName, truncateZHString, unsanitize, unsanitizeInput, updateQueryParam, waitTime, watchServiceWorkerUpdates, windowLoaded, zAxiosIsValidRes };
4731
+ export { addClass, addEvent, addStyle, assignDefined, calLongestCommonSubsequence, calLongestCommonSubstring, calculateAspectRatio, calculateCAGR, camelCase2Underscore, camelCaseToKebabCase, cancelBubble, clearHTML, clearHtml, convert10To26, convertCamelToKebab, convertCamelToUnder, convertHttpToHttps, convertKebabToCamel, convertObjectToQuery, convertToHtmlBreaks, convertUnderToCamel, createCSSRule, cutCHSString, cutZHString, debounce, deepCopy, deepCopyObject, deepFreeze, delCookie, derivePackageMetadata, detectVisitorType, doFn, escapeHTML, escapeHtmlAttribute, extractElementText, fireEvent, floatFixed, floatToPercent, formatByteSize, formatDate, formatDistanceToNow, formatDurationFromMs, formatLocalDateTime, genBrowserAttrs, genCustomConsole, genHashCode, genRndNumString, genStyleString, genUniqueNumString, generateCalendarVersion, generateRndNum, generateUniqueNum, getAllQueryParams, getBrowserClassNames, getBrowserInfo, getCLS, getCookie, getCurrentVersion, getDateDifference, getDefineListeners, getDomain, getFCP, getFID, getFP, getFileSize, getFriendlyInterval, getHashQueryParam, getLCP, getLocalJSON, getLocalStorage, getPageMeta, getPerformance, getQueryParam, getScriptQueryParam, getSessionJSON, getSessionStorage, getSystemTheme, getTTFB, getURLPathExtension, getUrlFileType, getUrlHost, getUrlParam, getUrlPath, hasClass, hide, hideElements, inRate, injectStyle, invokeEvent, invokeFn, isAndroid, isArray, isBool, isBoolean, isBrowser, isCNMobileNumber, isDesktop, isFunction, isHit, isIOS, isJSONString, isJsonString, isLinux, isMacOS, isMobile, isNonEmptyArray, isNonEmptyObject, isNullish, isNumber, isPhone, isPureObject, isSafePWAEnv, isStandalonePWA, isString, isSupportWebp, isSupportedEntryType, isTablet, isThisHour, isThisMonth, isThisWeek, isThisYear, isToday, isUdfOrNul, isValidCssSelector, isValidData, isValidDate, isValidEmail, isValidHttpUrl, isValidPhoneNumber, isValidUrl, isWindows, listenMediaQueryChanges, loadCSS, loadImage, loadScript, loadScriptIfUndefined, longestComSubsequence, longestComSubstring, mNow, mTrim, mazeyCon, newLine, onEvent, onURLChange, parseGitHubRepository, parseJsonSafe, parseLocalDateTime, randomBoolean, removeClass, removeCookie, removeEvent, removeHTML, removeHtml, repeatUntilConditionMet, replaceHttp, resolveElementTarget, resolveLanguagePreference, resolveThemePreference, sanitizeInput, setClass, setCookie, setImgSizeBySrc, setImgWidHeiBySrc, setLanguagePreference, setLocalJSON, setLocalStorage, setSessionJSON, setSessionStorage, setThemePreference, sha256Hex, show, showElements, sleep, subYears, throttle, timeCon, toJavaScriptGlobalName, truncateByWeightedLength, truncateZHString, unescapeHTML, unsanitize, unsanitizeInput, updateQueryParam, waitTime, watchServiceWorkerUpdates, windowLoaded, zAxiosIsValidRes };
4619
4732
  export type { DerivePackageMetadataOptions, DerivedPackageMetadata, DomVisibilityTarget, FormatByteSizeOptions, GitHubRepositoryDetails, InvestmentReturnRate, IsNumberOptions, IsSafePWAEnvOptions, IsStandalonePWAOptions, LocalDateTimePrecision, PWAEnvironment, PackageManager, PackageManifest, PackageManifestAuthor, PreferenceResult, ResolveElementTargetOptions, ResolvedTheme, ServiceWorkerUpdateCallbacks, ServiceWorkerUpdateWatcher, ThemePreference, VisitorType };