@m4l/graphics 7.0.6 → 7.0.7

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.
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Hook para obtener el valor del userAgent
3
+ */
4
+ export declare const useUserAgent: () => string;
1
5
  /**
2
6
  * Hook to check if the device is a mobile device
3
7
  * @author Juan Escobar - automatic
@@ -5,4 +9,7 @@
5
9
  * @updatedAt 2024-10-08 19:28:36 - automatic
6
10
  * @updatedUser Juan Escobar - automatic
7
11
  */
12
+ /**
13
+ * Hook de verificación de dispositivo móvil
14
+ */
8
15
  export declare const useIsMobile: (isMobileForced?: boolean) => boolean;
@@ -1,24 +1,18 @@
1
- import { useState as o, useEffect as s } from "react";
2
- import a from "lodash-es/throttle";
3
- const i = () => typeof navigator > "u" ? !1 : /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), f = (t) => {
4
- const [r, n] = o(t || i());
5
- return s(() => {
6
- if (t === void 0)
7
- return;
8
- const e = a(
9
- () => {
10
- n(i());
11
- },
12
- 200,
13
- {
14
- trailing: !0
15
- }
16
- );
17
- return window.addEventListener("resize", e), e(), () => {
18
- window.removeEventListener("resize", e), e.cancel();
19
- };
20
- }, [t]), r;
1
+ import { useSyncExternalStore as r } from "react";
2
+ const t = () => navigator.userAgent, s = (e) => {
3
+ const n = () => e(navigator.userAgent);
4
+ return window.addEventListener("userAgentChange", n), () => window.removeEventListener("userAgentChange", n);
5
+ }, o = () => r(
6
+ s,
7
+ // Función de suscripción
8
+ t,
9
+ // Función para obtener el estado actual
10
+ t
11
+ // (Opcional) Función para obtener el valor en SSR
12
+ ), i = (e) => typeof e > "u" ? !1 : /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e), c = (e) => {
13
+ const n = o();
14
+ return e || i(n);
21
15
  };
22
16
  export {
23
- f as u
17
+ c as u
24
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "7.0.6",
3
+ "version": "7.0.7",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team*",
6
6
  "type": "module",