vasuzex 2.3.13 → 2.3.15

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.
@@ -0,0 +1,30 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ /**
4
+ * useMobileDetect
5
+ *
6
+ * Detects whether the viewport is below the given breakpoint using
7
+ * window.matchMedia — no polling, no resize listeners, reacts instantly.
8
+ *
9
+ * @param {number} breakpoint - Max-width in px (default 640 = Tailwind `sm`)
10
+ * @returns {boolean} true when viewport < breakpoint
11
+ */
12
+ export function useMobileDetect(breakpoint = 640) {
13
+ const getIsMobile = () =>
14
+ typeof window !== 'undefined'
15
+ ? window.matchMedia(`(max-width: ${breakpoint - 1}px)`).matches
16
+ : false;
17
+
18
+ const [isMobile, setIsMobile] = useState(getIsMobile);
19
+
20
+ useEffect(() => {
21
+ const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
22
+ const handler = (e) => setIsMobile(e.matches);
23
+ // Set immediately in case of SSR mismatch
24
+ setIsMobile(mq.matches);
25
+ mq.addEventListener('change', handler);
26
+ return () => mq.removeEventListener('change', handler);
27
+ }, [breakpoint]);
28
+
29
+ return isMobile;
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vasuzex",
3
- "version": "2.3.13",
3
+ "version": "2.3.15",
4
4
  "description": "Laravel-inspired framework for Node.js monorepos - V2 with optimized dependencies",
5
5
  "type": "module",
6
6
  "main": "./framework/index.js",