@os-design/media 1.0.25 → 1.0.26

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.
Files changed (41) hide show
  1. package/dist/index.d.ts.map +1 -0
  2. package/dist/{esm/index.js → index.js} +1 -2
  3. package/dist/media/index.d.ts.map +1 -0
  4. package/dist/{esm/media → media}/index.js +1 -2
  5. package/dist/useIsMaxWidth/index.d.ts +8 -0
  6. package/dist/useIsMaxWidth/index.d.ts.map +1 -0
  7. package/dist/{esm/useIsMaxWidth → useIsMaxWidth}/index.js +1 -2
  8. package/dist/useIsMinWidth/index.d.ts +8 -0
  9. package/dist/useIsMinWidth/index.d.ts.map +1 -0
  10. package/dist/{esm/useIsMinWidth → useIsMinWidth}/index.js +1 -2
  11. package/dist/useIsWidth/index.d.ts +7 -0
  12. package/dist/useIsWidth/index.d.ts.map +1 -0
  13. package/dist/{esm/useIsWidth → useIsWidth}/index.js +1 -2
  14. package/package.json +7 -8
  15. package/src/useIsMaxWidth/index.ts +1 -1
  16. package/src/useIsMinWidth/index.ts +1 -1
  17. package/dist/cjs/index.js +0 -55
  18. package/dist/cjs/index.js.map +0 -1
  19. package/dist/cjs/media/index.js +0 -36
  20. package/dist/cjs/media/index.js.map +0 -1
  21. package/dist/cjs/useIsMaxWidth/index.js +0 -22
  22. package/dist/cjs/useIsMaxWidth/index.js.map +0 -1
  23. package/dist/cjs/useIsMinWidth/index.js +0 -22
  24. package/dist/cjs/useIsMinWidth/index.js.map +0 -1
  25. package/dist/cjs/useIsWidth/index.js +0 -42
  26. package/dist/cjs/useIsWidth/index.js.map +0 -1
  27. package/dist/esm/index.js.map +0 -1
  28. package/dist/esm/media/index.js.map +0 -1
  29. package/dist/esm/useIsMaxWidth/index.js.map +0 -1
  30. package/dist/esm/useIsMinWidth/index.js.map +0 -1
  31. package/dist/esm/useIsWidth/index.js.map +0 -1
  32. package/dist/types/index.d.ts.map +0 -1
  33. package/dist/types/media/index.d.ts.map +0 -1
  34. package/dist/types/useIsMaxWidth/index.d.ts +0 -4
  35. package/dist/types/useIsMaxWidth/index.d.ts.map +0 -1
  36. package/dist/types/useIsMinWidth/index.d.ts +0 -4
  37. package/dist/types/useIsMinWidth/index.d.ts.map +0 -1
  38. package/dist/types/useIsWidth/index.d.ts +0 -3
  39. package/dist/types/useIsWidth/index.d.ts.map +0 -1
  40. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
  41. /package/dist/{types/media → media}/index.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,cAAc,SAAS,CAAC"}
@@ -2,5 +2,4 @@ export { default as m } from './media';
2
2
  export { default as useIsMaxWidth } from './useIsMaxWidth';
3
3
  export { default as useIsMinWidth } from './useIsMinWidth';
4
4
  export { default as useIsWidth } from './useIsWidth';
5
- export * from './media';
6
- //# sourceMappingURL=index.js.map
5
+ export * from './media';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/media/index.ts"],"names":[],"mappings":"AAAA,UAAU,WAAW;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb;AAED,KAAK,KAAK,CAAC,CAAC,IAAI;KACb,GAAG,IAAI,MAAM,CAAC,GAAG,MAAM;CACzB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAEtD,eAAO,MAAM,cAAc,EAAE,cAO5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAO5B,CAAC;AAkBF,QAAA,MAAM,CAAC;;;CAGN,CAAC;AAEF,eAAe,CAAC,CAAC"}
@@ -26,5 +26,4 @@ const m = {
26
26
  min,
27
27
  max
28
28
  };
29
- export default m;
30
- //# sourceMappingURL=index.js.map
29
+ export default m;
@@ -0,0 +1,8 @@
1
+ import { type MaxBreakpoints } from '../media';
2
+ /**
3
+ * Checks whether the width of the screen is less than or equal to
4
+ * the specified media breakpoint (for example, sm).
5
+ */
6
+ declare const useIsMaxWidth: (breakpoint: keyof MaxBreakpoints) => boolean;
7
+ export default useIsMaxWidth;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIsMaxWidth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/D;;;GAGG;AACH,QAAA,MAAM,aAAa,eAAgB,MAAM,cAAc,KAAG,OAMzD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -10,5 +10,4 @@ const useIsMaxWidth = breakpoint => {
10
10
  const detector = useCallback(width => width <= maxBreakpoints[breakpoint], [breakpoint]);
11
11
  return useIsWidth(detector);
12
12
  };
13
- export default useIsMaxWidth;
14
- //# sourceMappingURL=index.js.map
13
+ export default useIsMaxWidth;
@@ -0,0 +1,8 @@
1
+ import { type MinBreakpoints } from '../media';
2
+ /**
3
+ * Checks whether the width of the screen is greater than or equal to
4
+ * the specified media breakpoint (for example, md).
5
+ */
6
+ declare const useIsMinWidth: (breakpoint: keyof MinBreakpoints) => boolean;
7
+ export default useIsMinWidth;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIsMinWidth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,UAAU,CAAC;AAG/D;;;GAGG;AACH,QAAA,MAAM,aAAa,eAAgB,MAAM,cAAc,KAAG,OAMzD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -10,5 +10,4 @@ const useIsMinWidth = breakpoint => {
10
10
  const detector = useCallback(width => width >= minBreakpoints[breakpoint], [breakpoint]);
11
11
  return useIsWidth(detector);
12
12
  };
13
- export default useIsMinWidth;
14
- //# sourceMappingURL=index.js.map
13
+ export default useIsMinWidth;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Checks whether the width of the screen matches the condition
3
+ * defined by the specified function.
4
+ */
5
+ declare const useIsWidth: (detector: (width: number) => boolean) => boolean;
6
+ export default useIsWidth;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/useIsWidth/index.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,QAAA,MAAM,UAAU,aAAc,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,KAAG,OAqB1D,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -20,5 +20,4 @@ const useIsWidth = detector => {
20
20
  }, [updateFlag]);
21
21
  return flag;
22
22
  };
23
- export default useIsWidth;
24
- //# sourceMappingURL=index.js.map
23
+ export default useIsWidth;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@os-design/media",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "license": "UNLICENSED",
5
5
  "repository": "git@gitlab.com:os-team/libs/os-design.git",
6
- "main": "dist/cjs/index.js",
7
- "module": "dist/esm/index.js",
8
- "types": "dist/types/index.d.ts",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist",
11
11
  "src",
@@ -20,9 +20,8 @@
20
20
  "sideEffects": false,
21
21
  "scripts": {
22
22
  "clean": "rimraf dist",
23
- "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx --out-dir dist/esm --source-maps",
24
- "build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx --out-dir dist/cjs --source-maps",
25
- "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
23
+ "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx --out-dir dist",
24
+ "build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly --declaration --declarationDir dist",
26
25
  "build": "yarn clean && npm-run-all 'build:*'",
27
26
  "ncu": "ncu -u"
28
27
  },
@@ -32,5 +31,5 @@
32
31
  "peerDependencies": {
33
32
  "react": ">=18"
34
33
  },
35
- "gitHead": "1f17189e344a56fd6347dd6b896d6e7ef6e7b35d"
34
+ "gitHead": "86a83e87297a07afe132782ca2c95023b7139276"
36
35
  }
@@ -1,5 +1,5 @@
1
1
  import { useCallback } from 'react';
2
- import { maxBreakpoints, MaxBreakpoints } from '../media';
2
+ import { maxBreakpoints, type MaxBreakpoints } from '../media';
3
3
  import useIsWidth from '../useIsWidth';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { useCallback } from 'react';
2
- import { MinBreakpoints, minBreakpoints } from '../media';
2
+ import { type MinBreakpoints, minBreakpoints } from '../media';
3
3
  import useIsWidth from '../useIsWidth';
4
4
 
5
5
  /**
package/dist/cjs/index.js DELETED
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- var _exportNames = {
8
- m: true,
9
- useIsMaxWidth: true,
10
- useIsMinWidth: true,
11
- useIsWidth: true
12
- };
13
- Object.defineProperty(exports, "m", {
14
- enumerable: true,
15
- get: function get() {
16
- return _media["default"];
17
- }
18
- });
19
- Object.defineProperty(exports, "useIsMaxWidth", {
20
- enumerable: true,
21
- get: function get() {
22
- return _useIsMaxWidth["default"];
23
- }
24
- });
25
- Object.defineProperty(exports, "useIsMinWidth", {
26
- enumerable: true,
27
- get: function get() {
28
- return _useIsMinWidth["default"];
29
- }
30
- });
31
- Object.defineProperty(exports, "useIsWidth", {
32
- enumerable: true,
33
- get: function get() {
34
- return _useIsWidth["default"];
35
- }
36
- });
37
- var _media = _interopRequireWildcard(require("./media"));
38
- Object.keys(_media).forEach(function (key) {
39
- if (key === "default" || key === "__esModule") return;
40
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
41
- if (key in exports && exports[key] === _media[key]) return;
42
- Object.defineProperty(exports, key, {
43
- enumerable: true,
44
- get: function get() {
45
- return _media[key];
46
- }
47
- });
48
- });
49
- var _useIsMaxWidth = _interopRequireDefault(require("./useIsMaxWidth"));
50
- var _useIsMinWidth = _interopRequireDefault(require("./useIsMinWidth"));
51
- var _useIsWidth = _interopRequireDefault(require("./useIsWidth"));
52
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
53
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
54
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
55
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_media","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_useIsMaxWidth","_interopRequireDefault","_useIsMinWidth","_useIsWidth","obj","__esModule","_getRequireWildcardCache","e","WeakMap","r","t","_typeof","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["export { default as m } from './media';\nexport { default as useIsMaxWidth } from './useIsMaxWidth';\nexport { default as useIsMinWidth } from './useIsMinWidth';\nexport { default as useIsWidth } from './useIsWidth';\n\nexport * from './media';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAKAC,MAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAN,MAAA,CAAAM,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAd,MAAA,CAAAM,GAAA;IAAA;EAAA;AAAA;AAJA,IAAAS,cAAA,GAAAC,sBAAA,CAAAd,OAAA;AACA,IAAAe,cAAA,GAAAD,sBAAA,CAAAd,OAAA;AACA,IAAAgB,WAAA,GAAAF,sBAAA,CAAAd,OAAA;AAAqD,SAA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
4
- value: true
5
- });
6
- exports.minBreakpoints = exports.maxBreakpoints = exports["default"] = void 0;
7
- var minBreakpoints = exports.minBreakpoints = {
8
- xs: 480,
9
- sm: 576,
10
- md: 786,
11
- lg: 992,
12
- xl: 1200,
13
- xxl: 1600
14
- };
15
- var maxBreakpoints = exports.maxBreakpoints = {
16
- xxs: minBreakpoints.xs - 1,
17
- xs: minBreakpoints.sm - 1,
18
- sm: minBreakpoints.md - 1,
19
- md: minBreakpoints.lg - 1,
20
- lg: minBreakpoints.xl - 1,
21
- xl: minBreakpoints.xxl - 1
22
- };
23
- var min = Object.keys(minBreakpoints).reduce(function (res, key) {
24
- res[key] = "@media (min-width: ".concat(minBreakpoints[key], "px)");
25
- return res;
26
- }, {});
27
- var max = Object.keys(maxBreakpoints).reduce(function (res, key) {
28
- res[key] = "@media (max-width: ".concat(maxBreakpoints[key], "px)");
29
- return res;
30
- }, {});
31
- var m = {
32
- min: min,
33
- max: max
34
- };
35
- var _default = exports["default"] = m;
36
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["minBreakpoints","exports","xs","sm","md","lg","xl","xxl","maxBreakpoints","xxs","min","Object","keys","reduce","res","key","concat","max","m","_default"],"sources":["../../../src/media/index.ts"],"sourcesContent":["interface Breakpoints {\n xxs: number;\n xs: number;\n sm: number;\n md: number;\n lg: number;\n xl: number;\n xxl: number;\n}\n\ntype Index<T> = {\n [key in keyof T]: string;\n};\n\nexport type MinBreakpoints = Omit<Breakpoints, 'xxs'>;\nexport type MaxBreakpoints = Omit<Breakpoints, 'xxl'>;\n\nexport const minBreakpoints: MinBreakpoints = {\n xs: 480,\n sm: 576,\n md: 786,\n lg: 992,\n xl: 1200,\n xxl: 1600,\n};\n\nexport const maxBreakpoints: MaxBreakpoints = {\n xxs: minBreakpoints.xs - 1,\n xs: minBreakpoints.sm - 1,\n sm: minBreakpoints.md - 1,\n md: minBreakpoints.lg - 1,\n lg: minBreakpoints.xl - 1,\n xl: minBreakpoints.xxl - 1,\n};\n\nconst min = Object.keys(minBreakpoints).reduce<Index<MinBreakpoints>>(\n (res, key) => {\n res[key] = `@media (min-width: ${minBreakpoints[key]}px)`;\n return res;\n },\n {} as Index<MinBreakpoints>\n);\n\nconst max = Object.keys(maxBreakpoints).reduce<Index<MaxBreakpoints>>(\n (res, key) => {\n res[key] = `@media (max-width: ${maxBreakpoints[key]}px)`;\n return res;\n },\n {} as Index<MaxBreakpoints>\n);\n\nconst m = {\n min,\n max,\n};\n\nexport default m;\n"],"mappings":";;;;;;AAiBO,IAAMA,cAA8B,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC5CE,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,IAAI;EACRC,GAAG,EAAE;AACP,CAAC;AAEM,IAAMC,cAA8B,GAAAP,OAAA,CAAAO,cAAA,GAAG;EAC5CC,GAAG,EAAET,cAAc,CAACE,EAAE,GAAG,CAAC;EAC1BA,EAAE,EAAEF,cAAc,CAACG,EAAE,GAAG,CAAC;EACzBA,EAAE,EAAEH,cAAc,CAACI,EAAE,GAAG,CAAC;EACzBA,EAAE,EAAEJ,cAAc,CAACK,EAAE,GAAG,CAAC;EACzBA,EAAE,EAAEL,cAAc,CAACM,EAAE,GAAG,CAAC;EACzBA,EAAE,EAAEN,cAAc,CAACO,GAAG,GAAG;AAC3B,CAAC;AAED,IAAMG,GAAG,GAAGC,MAAM,CAACC,IAAI,CAACZ,cAAc,CAAC,CAACa,MAAM,CAC5C,UAACC,GAAG,EAAEC,GAAG,EAAK;EACZD,GAAG,CAACC,GAAG,CAAC,yBAAAC,MAAA,CAAyBhB,cAAc,CAACe,GAAG,CAAC,QAAK;EACzD,OAAOD,GAAG;AACZ,CAAC,EACD,CAAC,CACH,CAAC;AAED,IAAMG,GAAG,GAAGN,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAACK,MAAM,CAC5C,UAACC,GAAG,EAAEC,GAAG,EAAK;EACZD,GAAG,CAACC,GAAG,CAAC,yBAAAC,MAAA,CAAyBR,cAAc,CAACO,GAAG,CAAC,QAAK;EACzD,OAAOD,GAAG;AACZ,CAAC,EACD,CAAC,CACH,CAAC;AAED,IAAMI,CAAC,GAAG;EACRR,GAAG,EAAHA,GAAG;EACHO,GAAG,EAAHA;AACF,CAAC;AAAC,IAAAE,QAAA,GAAAlB,OAAA,cAEaiB,CAAC","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _react = require("react");
8
- var _media = require("../media");
9
- var _useIsWidth = _interopRequireDefault(require("../useIsWidth"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
- /**
12
- * Checks whether the width of the screen is less than or equal to
13
- * the specified media breakpoint (for example, sm).
14
- */
15
- var useIsMaxWidth = function useIsMaxWidth(breakpoint) {
16
- var detector = (0, _react.useCallback)(function (width) {
17
- return width <= _media.maxBreakpoints[breakpoint];
18
- }, [breakpoint]);
19
- return (0, _useIsWidth["default"])(detector);
20
- };
21
- var _default = exports["default"] = useIsMaxWidth;
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_react","require","_media","_useIsWidth","_interopRequireDefault","obj","__esModule","useIsMaxWidth","breakpoint","detector","useCallback","width","maxBreakpoints","useIsWidth","_default","exports"],"sources":["../../../src/useIsMaxWidth/index.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { maxBreakpoints, MaxBreakpoints } from '../media';\nimport useIsWidth from '../useIsWidth';\n\n/**\n * Checks whether the width of the screen is less than or equal to\n * the specified media breakpoint (for example, sm).\n */\nconst useIsMaxWidth = (breakpoint: keyof MaxBreakpoints): boolean => {\n const detector = useCallback(\n (width) => width <= maxBreakpoints[breakpoint],\n [breakpoint]\n );\n return useIsWidth(detector);\n};\n\nexport default useIsMaxWidth;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAuC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEvC;AACA;AACA;AACA;AACA,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,UAAgC,EAAc;EACnE,IAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAC1B,UAACC,KAAK;IAAA,OAAKA,KAAK,IAAIC,qBAAc,CAACJ,UAAU,CAAC;EAAA,GAC9C,CAACA,UAAU,CACb,CAAC;EACD,OAAO,IAAAK,sBAAU,EAACJ,QAAQ,CAAC;AAC7B,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,cAEaR,aAAa","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _react = require("react");
8
- var _media = require("../media");
9
- var _useIsWidth = _interopRequireDefault(require("../useIsWidth"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
- /**
12
- * Checks whether the width of the screen is greater than or equal to
13
- * the specified media breakpoint (for example, md).
14
- */
15
- var useIsMinWidth = function useIsMinWidth(breakpoint) {
16
- var detector = (0, _react.useCallback)(function (width) {
17
- return width >= _media.minBreakpoints[breakpoint];
18
- }, [breakpoint]);
19
- return (0, _useIsWidth["default"])(detector);
20
- };
21
- var _default = exports["default"] = useIsMinWidth;
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_react","require","_media","_useIsWidth","_interopRequireDefault","obj","__esModule","useIsMinWidth","breakpoint","detector","useCallback","width","minBreakpoints","useIsWidth","_default","exports"],"sources":["../../../src/useIsMinWidth/index.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { MinBreakpoints, minBreakpoints } from '../media';\nimport useIsWidth from '../useIsWidth';\n\n/**\n * Checks whether the width of the screen is greater than or equal to\n * the specified media breakpoint (for example, md).\n */\nconst useIsMinWidth = (breakpoint: keyof MinBreakpoints): boolean => {\n const detector = useCallback(\n (width) => width >= minBreakpoints[breakpoint],\n [breakpoint]\n );\n return useIsWidth(detector);\n};\n\nexport default useIsMinWidth;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAuC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAEvC;AACA;AACA;AACA;AACA,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,UAAgC,EAAc;EACnE,IAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAC1B,UAACC,KAAK;IAAA,OAAKA,KAAK,IAAIC,qBAAc,CAACJ,UAAU,CAAC;EAAA,GAC9C,CAACA,UAAU,CACb,CAAC;EACD,OAAO,IAAAK,sBAAU,EAACJ,QAAQ,CAAC;AAC7B,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,cAEaR,aAAa","ignoreList":[]}
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _react = require("react");
8
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
- /**
15
- * Checks whether the width of the screen matches the condition
16
- * defined by the specified function.
17
- */
18
- var useIsWidth = function useIsWidth(detector) {
19
- var detectorRef = (0, _react.useRef)(detector);
20
- var _useState = (0, _react.useState)(function () {
21
- return detector(typeof window !== 'undefined' ? window.innerWidth : 0);
22
- }),
23
- _useState2 = _slicedToArray(_useState, 2),
24
- flag = _useState2[0],
25
- setFlag = _useState2[1];
26
- var updateFlag = (0, _react.useCallback)(function () {
27
- setFlag(detectorRef.current(window.innerWidth));
28
- }, []);
29
- (0, _react.useEffect)(function () {
30
- detectorRef.current = detector;
31
- updateFlag();
32
- }, [detector, updateFlag]);
33
- (0, _react.useEffect)(function () {
34
- window.addEventListener('resize', updateFlag);
35
- return function () {
36
- return window.removeEventListener('resize', updateFlag);
37
- };
38
- }, [updateFlag]);
39
- return flag;
40
- };
41
- var _default = exports["default"] = useIsWidth;
42
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_react","require","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","len","length","arr2","r","l","t","Symbol","iterator","e","u","a","f","next","done","push","value","isArray","useIsWidth","detector","detectorRef","useRef","_useState","useState","window","innerWidth","_useState2","flag","setFlag","updateFlag","useCallback","current","useEffect","addEventListener","removeEventListener","_default","exports"],"sources":["../../../src/useIsWidth/index.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\n/**\n * Checks whether the width of the screen matches the condition\n * defined by the specified function.\n */\nconst useIsWidth = (detector: (width: number) => boolean): boolean => {\n const detectorRef = useRef<(width: number) => boolean>(detector);\n const [flag, setFlag] = useState(() =>\n detector(typeof window !== 'undefined' ? window.innerWidth : 0)\n );\n\n const updateFlag = useCallback(() => {\n setFlag(detectorRef.current(window.innerWidth));\n }, []);\n\n useEffect(() => {\n detectorRef.current = detector;\n updateFlag();\n }, [detector, updateFlag]);\n\n useEffect(() => {\n window.addEventListener('resize', updateFlag);\n return () => window.removeEventListener('resize', updateFlag);\n }, [updateFlag]);\n\n return flag;\n};\n\nexport default useIsWidth;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAiE,SAAAC,eAAAC,GAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,GAAA,KAAAG,qBAAA,CAAAH,GAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,GAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAG,CAAA,EAAAC,MAAA,SAAAD,CAAA,qBAAAA,CAAA,sBAAAE,iBAAA,CAAAF,CAAA,EAAAC,MAAA,OAAAE,CAAA,GAAAC,MAAA,CAAAC,SAAA,CAAAC,QAAA,CAAAC,IAAA,CAAAP,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+0,0 @@
1
- {"version":3,"file":"index.js","names":["default","m","useIsMaxWidth","useIsMinWidth","useIsWidth"],"sources":["../../src/index.ts"],"sourcesContent":["export { default as m } from './media';\nexport { default as useIsMaxWidth } from './useIsMaxWidth';\nexport { default as useIsMinWidth } from './useIsMinWidth';\nexport { default as useIsWidth } from './useIsWidth';\n\nexport * from './media';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,CAAC,QAAQ,SAAS;AACtC,SAASD,OAAO,IAAIE,aAAa,QAAQ,iBAAiB;AAC1D,SAASF,OAAO,IAAIG,aAAa,QAAQ,iBAAiB;AAC1D,SAASH,OAAO,IAAII,UAAU,QAAQ,cAAc;AAEpD,cAAc,SAAS","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["minBreakpoints","xs","sm","md","lg","xl","xxl","maxBreakpoints","xxs","min","Object","keys","reduce","res","key","max","m"],"sources":["../../../src/media/index.ts"],"sourcesContent":["interface Breakpoints {\n xxs: number;\n xs: number;\n sm: number;\n md: number;\n lg: number;\n xl: number;\n xxl: number;\n}\n\ntype Index<T> = {\n [key in keyof T]: string;\n};\n\nexport type MinBreakpoints = Omit<Breakpoints, 'xxs'>;\nexport type MaxBreakpoints = Omit<Breakpoints, 'xxl'>;\n\nexport const minBreakpoints: MinBreakpoints = {\n xs: 480,\n sm: 576,\n md: 786,\n lg: 992,\n xl: 1200,\n xxl: 1600,\n};\n\nexport const maxBreakpoints: MaxBreakpoints = {\n xxs: minBreakpoints.xs - 1,\n xs: minBreakpoints.sm - 1,\n sm: minBreakpoints.md - 1,\n md: minBreakpoints.lg - 1,\n lg: minBreakpoints.xl - 1,\n xl: minBreakpoints.xxl - 1,\n};\n\nconst min = Object.keys(minBreakpoints).reduce<Index<MinBreakpoints>>(\n (res, key) => {\n res[key] = `@media (min-width: ${minBreakpoints[key]}px)`;\n return res;\n },\n {} as Index<MinBreakpoints>\n);\n\nconst max = Object.keys(maxBreakpoints).reduce<Index<MaxBreakpoints>>(\n (res, key) => {\n res[key] = `@media (max-width: ${maxBreakpoints[key]}px)`;\n return res;\n },\n {} as Index<MaxBreakpoints>\n);\n\nconst m = {\n min,\n max,\n};\n\nexport default m;\n"],"mappings":"AAiBA,OAAO,MAAMA,cAA8B,GAAG;EAC5CC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,IAAI;EACRC,GAAG,EAAE;AACP,CAAC;AAED,OAAO,MAAMC,cAA8B,GAAG;EAC5CC,GAAG,EAAER,cAAc,CAACC,EAAE,GAAG,CAAC;EAC1BA,EAAE,EAAED,cAAc,CAACE,EAAE,GAAG,CAAC;EACzBA,EAAE,EAAEF,cAAc,CAACG,EAAE,GAAG,CAAC;EACzBA,EAAE,EAAEH,cAAc,CAACI,EAAE,GAAG,CAAC;EACzBA,EAAE,EAAEJ,cAAc,CAACK,EAAE,GAAG,CAAC;EACzBA,EAAE,EAAEL,cAAc,CAACM,GAAG,GAAG;AAC3B,CAAC;AAED,MAAMG,GAAG,GAAGC,MAAM,CAACC,IAAI,CAACX,cAAc,CAAC,CAACY,MAAM,CAC5C,CAACC,GAAG,EAAEC,GAAG,KAAK;EACZD,GAAG,CAACC,GAAG,CAAC,GAAI,sBAAqBd,cAAc,CAACc,GAAG,CAAE,KAAI;EACzD,OAAOD,GAAG;AACZ,CAAC,EACD,CAAC,CACH,CAAC;AAED,MAAME,GAAG,GAAGL,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAACK,MAAM,CAC5C,CAACC,GAAG,EAAEC,GAAG,KAAK;EACZD,GAAG,CAACC,GAAG,CAAC,GAAI,sBAAqBP,cAAc,CAACO,GAAG,CAAE,KAAI;EACzD,OAAOD,GAAG;AACZ,CAAC,EACD,CAAC,CACH,CAAC;AAED,MAAMG,CAAC,GAAG;EACRP,GAAG;EACHM;AACF,CAAC;AAED,eAAeC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["useCallback","maxBreakpoints","useIsWidth","useIsMaxWidth","breakpoint","detector","width"],"sources":["../../../src/useIsMaxWidth/index.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { maxBreakpoints, MaxBreakpoints } from '../media';\nimport useIsWidth from '../useIsWidth';\n\n/**\n * Checks whether the width of the screen is less than or equal to\n * the specified media breakpoint (for example, sm).\n */\nconst useIsMaxWidth = (breakpoint: keyof MaxBreakpoints): boolean => {\n const detector = useCallback(\n (width) => width <= maxBreakpoints[breakpoint],\n [breakpoint]\n );\n return useIsWidth(detector);\n};\n\nexport default useIsMaxWidth;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,cAAc,QAAwB,UAAU;AACzD,OAAOC,UAAU,MAAM,eAAe;;AAEtC;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,UAAgC,IAAc;EACnE,MAAMC,QAAQ,GAAGL,WAAW,CACzBM,KAAK,IAAKA,KAAK,IAAIL,cAAc,CAACG,UAAU,CAAC,EAC9C,CAACA,UAAU,CACb,CAAC;EACD,OAAOF,UAAU,CAACG,QAAQ,CAAC;AAC7B,CAAC;AAED,eAAeF,aAAa","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["useCallback","minBreakpoints","useIsWidth","useIsMinWidth","breakpoint","detector","width"],"sources":["../../../src/useIsMinWidth/index.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { MinBreakpoints, minBreakpoints } from '../media';\nimport useIsWidth from '../useIsWidth';\n\n/**\n * Checks whether the width of the screen is greater than or equal to\n * the specified media breakpoint (for example, md).\n */\nconst useIsMinWidth = (breakpoint: keyof MinBreakpoints): boolean => {\n const detector = useCallback(\n (width) => width >= minBreakpoints[breakpoint],\n [breakpoint]\n );\n return useIsWidth(detector);\n};\n\nexport default useIsMinWidth;\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAAyBC,cAAc,QAAQ,UAAU;AACzD,OAAOC,UAAU,MAAM,eAAe;;AAEtC;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,UAAgC,IAAc;EACnE,MAAMC,QAAQ,GAAGL,WAAW,CACzBM,KAAK,IAAKA,KAAK,IAAIL,cAAc,CAACG,UAAU,CAAC,EAC9C,CAACA,UAAU,CACb,CAAC;EACD,OAAOF,UAAU,CAACG,QAAQ,CAAC;AAC7B,CAAC;AAED,eAAeF,aAAa","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["useCallback","useEffect","useRef","useState","useIsWidth","detector","detectorRef","flag","setFlag","window","innerWidth","updateFlag","current","addEventListener","removeEventListener"],"sources":["../../../src/useIsWidth/index.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\n/**\n * Checks whether the width of the screen matches the condition\n * defined by the specified function.\n */\nconst useIsWidth = (detector: (width: number) => boolean): boolean => {\n const detectorRef = useRef<(width: number) => boolean>(detector);\n const [flag, setFlag] = useState(() =>\n detector(typeof window !== 'undefined' ? window.innerWidth : 0)\n );\n\n const updateFlag = useCallback(() => {\n setFlag(detectorRef.current(window.innerWidth));\n }, []);\n\n useEffect(() => {\n detectorRef.current = detector;\n updateFlag();\n }, [detector, updateFlag]);\n\n useEffect(() => {\n window.addEventListener('resize', updateFlag);\n return () => window.removeEventListener('resize', updateFlag);\n }, [updateFlag]);\n\n return flag;\n};\n\nexport default useIsWidth;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;;AAEhE;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAIC,QAAoC,IAAc;EACpE,MAAMC,WAAW,GAAGJ,MAAM,CAA6BG,QAAQ,CAAC;EAChE,MAAM,CAACE,IAAI,EAAEC,OAAO,CAAC,GAAGL,QAAQ,CAAC,MAC/BE,QAAQ,CAAC,OAAOI,MAAM,KAAK,WAAW,GAAGA,MAAM,CAACC,UAAU,GAAG,CAAC,CAChE,CAAC;EAED,MAAMC,UAAU,GAAGX,WAAW,CAAC,MAAM;IACnCQ,OAAO,CAACF,WAAW,CAACM,OAAO,CAACH,MAAM,CAACC,UAAU,CAAC,CAAC;EACjD,CAAC,EAAE,EAAE,CAAC;EAENT,SAAS,CAAC,MAAM;IACdK,WAAW,CAACM,OAAO,GAAGP,QAAQ;IAC9BM,UAAU,CAAC,CAAC;EACd,CAAC,EAAE,CAACN,QAAQ,EAAEM,UAAU,CAAC,CAAC;EAE1BV,SAAS,CAAC,MAAM;IACdQ,MAAM,CAACI,gBAAgB,CAAC,QAAQ,EAAEF,UAAU,CAAC;IAC7C,OAAO,MAAMF,MAAM,CAACK,mBAAmB,CAAC,QAAQ,EAAEH,UAAU,CAAC;EAC/D,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;EAEhB,OAAOJ,IAAI;AACb,CAAC;AAED,eAAeH,UAAU","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,cAAc,SAAS,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/media/index.ts"],"names":[],"mappings":"AAAA,UAAU,WAAW;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb;AAED,KAAK,KAAK,CAAC,CAAC,IAAI;KACb,GAAG,IAAI,MAAM,CAAC,GAAG,MAAM;CACzB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAEtD,eAAO,MAAM,cAAc,EAAE,cAO5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAO5B,CAAC;AAkBF,QAAA,MAAM,CAAC;;;CAGN,CAAC;AAEF,eAAe,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- import { MaxBreakpoints } from '../media';
2
- declare const useIsMaxWidth: (breakpoint: keyof MaxBreakpoints) => boolean;
3
- export default useIsMaxWidth;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/useIsMaxWidth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAE,MAAM,UAAU,CAAC;AAO1D,QAAA,MAAM,aAAa,eAAgB,MAAM,cAAc,KAAG,OAMzD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,4 +0,0 @@
1
- import { MinBreakpoints } from '../media';
2
- declare const useIsMinWidth: (breakpoint: keyof MinBreakpoints) => boolean;
3
- export default useIsMinWidth;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/useIsMinWidth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAkB,MAAM,UAAU,CAAC;AAO1D,QAAA,MAAM,aAAa,eAAgB,MAAM,cAAc,KAAG,OAMzD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const useIsWidth: (detector: (width: number) => boolean) => boolean;
2
- export default useIsWidth;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/useIsWidth/index.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,UAAU,aAAc,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,KAAG,OAqB1D,CAAC;AAEF,eAAe,UAAU,CAAC"}
File without changes
File without changes