@mirai/ui 2.0.34 → 2.0.35
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/build/hooks/useDevice.js
CHANGED
|
@@ -42,7 +42,7 @@ var useDevice = function useDevice() {
|
|
|
42
42
|
breakpointM = _Theme$get$breakpoint2 === void 0 ? '1180px' : _Theme$get$breakpoint2;
|
|
43
43
|
var isLandscape = resolution.width >= resolution.height;
|
|
44
44
|
var isMobile = resolution.width <= (0, _helpers2.sanitizePx)(breakpointS);
|
|
45
|
-
var isTablet = !isMobile && resolution.width
|
|
45
|
+
var isTablet = !isMobile && resolution.width < (0, _helpers2.sanitizePx)(breakpointM);
|
|
46
46
|
var navigator = (0, _helpers.getNavigator)();
|
|
47
47
|
return _objectSpread(_objectSpread(_objectSpread({}, resolution), navigator), {}, {
|
|
48
48
|
isLandscape: isLandscape,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDevice.js","names":["useDevice","useState","getResolution","resolution","setResolution","useEffect","handleResize","window","addEventListener","removeEventListener","useMemo","Theme","get","breakpointS","breakpointM","isLandscape","width","height","isMobile","sanitizePx","isTablet","navigator","getNavigator","isPortrait","isDesktop"],"sources":["../../src/hooks/useDevice.js"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { getNavigator } from '../helpers';\nimport { Theme } from '../theme';\nimport { getResolution, sanitizePx } from './helpers';\n\nexport const useDevice = () => {\n const [resolution, setResolution] = useState(getResolution());\n\n useEffect(() => {\n const handleResize = () => setResolution(getResolution());\n\n window.addEventListener('resize', handleResize);\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return useMemo(() => {\n const { breakpointS = '480px', breakpointM = '1180px' } = Theme.get();\n const isLandscape = resolution.width >= resolution.height;\n const isMobile = resolution.width <= sanitizePx(breakpointS);\n const isTablet = !isMobile && resolution.width
|
|
1
|
+
{"version":3,"file":"useDevice.js","names":["useDevice","useState","getResolution","resolution","setResolution","useEffect","handleResize","window","addEventListener","removeEventListener","useMemo","Theme","get","breakpointS","breakpointM","isLandscape","width","height","isMobile","sanitizePx","isTablet","navigator","getNavigator","isPortrait","isDesktop"],"sources":["../../src/hooks/useDevice.js"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { getNavigator } from '../helpers';\nimport { Theme } from '../theme';\nimport { getResolution, sanitizePx } from './helpers';\n\nexport const useDevice = () => {\n const [resolution, setResolution] = useState(getResolution());\n\n useEffect(() => {\n const handleResize = () => setResolution(getResolution());\n\n window.addEventListener('resize', handleResize);\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return useMemo(() => {\n const { breakpointS = '480px', breakpointM = '1180px' } = Theme.get();\n\n const isLandscape = resolution.width >= resolution.height;\n const isMobile = resolution.width <= sanitizePx(breakpointS);\n const isTablet = !isMobile && resolution.width < sanitizePx(breakpointM);\n const navigator = getNavigator();\n\n return {\n ...resolution,\n ...navigator,\n isLandscape,\n isPortrait: !isLandscape,\n isMobile,\n isTablet,\n isDesktop: !isMobile && !isTablet,\n };\n }, [resolution]);\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AACA;AAAsD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE/C,IAAMA,SAAS,GAAG,SAAZA,SAAS,GAAS;EAC7B,gBAAoC,IAAAC,eAAQ,EAAC,IAAAC,uBAAa,GAAE,CAAC;IAAA;IAAtDC,UAAU;IAAEC,aAAa;EAEhC,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAMC,YAAY,GAAG,SAAfA,YAAY;MAAA,OAASF,aAAa,CAAC,IAAAF,uBAAa,GAAE,CAAC;IAAA;IAEzDK,MAAM,CAACC,gBAAgB,CAAC,QAAQ,EAAEF,YAAY,CAAC;IAE/C,OAAO;MAAA,OAAMC,MAAM,CAACE,mBAAmB,CAAC,QAAQ,EAAEH,YAAY,CAAC;IAAA;EACjE,CAAC,EAAE,EAAE,CA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