@mado/hooks 0.4.1 → 0.5.0

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 (47) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.cjs +1 -62
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +1 -9
  5. package/dist/index.js.map +1 -1
  6. package/dist/use-debounce.cjs +1 -20
  7. package/dist/use-debounce.cjs.map +1 -1
  8. package/dist/use-debounce.js +1 -18
  9. package/dist/use-debounce.js.map +1 -1
  10. package/dist/use-event.cjs +1 -16
  11. package/dist/use-event.cjs.map +1 -1
  12. package/dist/use-event.js +1 -14
  13. package/dist/use-event.js.map +1 -1
  14. package/dist/use-is-mounted.cjs +1 -15
  15. package/dist/use-is-mounted.cjs.map +1 -1
  16. package/dist/use-is-mounted.js +1 -13
  17. package/dist/use-is-mounted.js.map +1 -1
  18. package/dist/use-isomorphic-layout-effect.cjs +1 -9
  19. package/dist/use-isomorphic-layout-effect.cjs.map +1 -1
  20. package/dist/use-isomorphic-layout-effect.js +1 -7
  21. package/dist/use-isomorphic-layout-effect.js.map +1 -1
  22. package/dist/use-media-query.cjs +1 -35
  23. package/dist/use-media-query.cjs.map +1 -1
  24. package/dist/use-media-query.js +1 -33
  25. package/dist/use-media-query.js.map +1 -1
  26. package/dist/use-online.cjs +1 -30
  27. package/dist/use-online.cjs.map +1 -1
  28. package/dist/use-online.d.cts +1 -1
  29. package/dist/use-online.d.ts +1 -1
  30. package/dist/use-online.js +1 -28
  31. package/dist/use-online.js.map +1 -1
  32. package/dist/use-rerender.cjs +1 -15
  33. package/dist/use-rerender.cjs.map +1 -1
  34. package/dist/use-rerender.js +1 -13
  35. package/dist/use-rerender.js.map +1 -1
  36. package/dist/use-visibility-state.cjs +1 -26
  37. package/dist/use-visibility-state.cjs.map +1 -1
  38. package/dist/use-visibility-state.d.cts +1 -1
  39. package/dist/use-visibility-state.d.ts +1 -1
  40. package/dist/use-visibility-state.js +1 -24
  41. package/dist/use-visibility-state.js.map +1 -1
  42. package/package.json +29 -15
  43. package/src/use-event.ts +1 -0
  44. package/src/use-is-mounted.ts +11 -7
  45. package/src/use-media-query.ts +2 -5
  46. package/src/use-online.ts +3 -8
  47. package/src/use-visibility-state.ts +5 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mado/hooks
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f656709: build: mado-hooks 빌드 시스템을 rollup으로 전환
8
+ - tsup에서 rollup + babel로 빌드 시스템 변경
9
+ - React Compiler(babel-plugin-react-compiler) 지원 추가
10
+ - @babel/runtime을 dependencies로 추가하여 번들 최적화
11
+ - use-sync-external-store 의존성 제거하고 React 18/19의 네이티브 useSyncExternalStore 사용
12
+ - ESLint 설정 업데이트 (generateConfig → defineConfig)
13
+ - React 18+ peer dependency로 변경하여 React 19 지원
14
+ - useOnline, useVisibilityState에 기본값 매개변수 추가
15
+ - useIsMounted를 useSyncExternalStore로 재구현하여 SSR 지원 개선
16
+
3
17
  ## 0.4.1
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1,63 +1,2 @@
1
- 'use strict';
2
-
3
- var useDebounce_cjs = require('./use-debounce.cjs');
4
- var useEvent_cjs = require('./use-event.cjs');
5
- var useIsMounted_cjs = require('./use-is-mounted.cjs');
6
- var useIsomorphicLayoutEffect_cjs = require('./use-isomorphic-layout-effect.cjs');
7
- var useMediaQuery_cjs = require('./use-media-query.cjs');
8
- var useOnline_cjs = require('./use-online.cjs');
9
- var useRerender_cjs = require('./use-rerender.cjs');
10
- var useVisibilityState_cjs = require('./use-visibility-state.cjs');
11
-
12
-
13
-
14
- Object.keys(useDebounce_cjs).forEach(function (k) {
15
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
16
- enumerable: true,
17
- get: function () { return useDebounce_cjs[k]; }
18
- });
19
- });
20
- Object.keys(useEvent_cjs).forEach(function (k) {
21
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
22
- enumerable: true,
23
- get: function () { return useEvent_cjs[k]; }
24
- });
25
- });
26
- Object.keys(useIsMounted_cjs).forEach(function (k) {
27
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
28
- enumerable: true,
29
- get: function () { return useIsMounted_cjs[k]; }
30
- });
31
- });
32
- Object.keys(useIsomorphicLayoutEffect_cjs).forEach(function (k) {
33
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
34
- enumerable: true,
35
- get: function () { return useIsomorphicLayoutEffect_cjs[k]; }
36
- });
37
- });
38
- Object.keys(useMediaQuery_cjs).forEach(function (k) {
39
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
40
- enumerable: true,
41
- get: function () { return useMediaQuery_cjs[k]; }
42
- });
43
- });
44
- Object.keys(useOnline_cjs).forEach(function (k) {
45
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
46
- enumerable: true,
47
- get: function () { return useOnline_cjs[k]; }
48
- });
49
- });
50
- Object.keys(useRerender_cjs).forEach(function (k) {
51
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
52
- enumerable: true,
53
- get: function () { return useRerender_cjs[k]; }
54
- });
55
- });
56
- Object.keys(useVisibilityState_cjs).forEach(function (k) {
57
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
58
- enumerable: true,
59
- get: function () { return useVisibilityState_cjs[k]; }
60
- });
61
- });
1
+ "use strict";var useDebounce=require("./use-debounce.cjs");var useEvent=require("./use-event.cjs");var useIsMounted=require("./use-is-mounted.cjs");var useIsomorphicLayoutEffect=require("./use-isomorphic-layout-effect.cjs");var useMediaQuery=require("./use-media-query.cjs");var useOnline=require("./use-online.cjs");var useRerender=require("./use-rerender.cjs");var useVisibilityState=require("./use-visibility-state.cjs");require("react-compiler-runtime");require("@mado/utils");require("react");exports.useDebounce=useDebounce.useDebounce;exports.useEvent=useEvent.useEvent;exports.useIsMounted=useIsMounted.useIsMounted;exports.useIsomorphicLayoutEffect=useIsomorphicLayoutEffect.useIsomorphicLayoutEffect;exports.useMediaQuery=useMediaQuery.useMediaQuery;exports.useOnline=useOnline.useOnline;exports.useRerender=useRerender.useRerender;exports.useVisibilityState=useVisibilityState.useVisibilityState;
62
2
  //# sourceMappingURL=index.cjs.map
63
- //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs","sourcesContent":[]}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -1,10 +1,2 @@
1
- export * from './use-debounce.js';
2
- export * from './use-event.js';
3
- export * from './use-is-mounted.js';
4
- export * from './use-isomorphic-layout-effect.js';
5
- export * from './use-media-query.js';
6
- export * from './use-online.js';
7
- export * from './use-rerender.js';
8
- export * from './use-visibility-state.js';
1
+ export{useDebounce}from"./use-debounce.js";export{useEvent}from"./use-event.js";export{useIsMounted}from"./use-is-mounted.js";export{useIsomorphicLayoutEffect}from"./use-isomorphic-layout-effect.js";export{useMediaQuery}from"./use-media-query.js";export{useOnline}from"./use-online.js";export{useRerender}from"./use-rerender.js";export{useVisibilityState}from"./use-visibility-state.js";import"react-compiler-runtime";import"@mado/utils";import"react";
9
2
  //# sourceMappingURL=index.js.map
10
- //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,21 +1,2 @@
1
- 'use strict';
2
-
3
- var utils = require('@mado/utils');
4
- var react = require('react');
5
- var useEvent_cjs = require('./use-event.cjs');
6
-
7
- // src/use-debounce.ts
8
- function useDebounce(fn, wait) {
9
- const callback = useEvent_cjs.useEvent(fn);
10
- const debounced = react.useMemo(() => utils.debounce(callback, wait), [callback, wait]);
11
- react.useEffect(() => {
12
- return () => {
13
- debounced.cancel();
14
- };
15
- }, [debounced]);
16
- return debounced;
17
- }
18
-
19
- exports.useDebounce = useDebounce;
1
+ "use strict";var reactCompilerRuntime=require("react-compiler-runtime");var utils=require("@mado/utils");var react=require("react");var useEvent=require("./use-event.cjs");require("./use-isomorphic-layout-effect.cjs");function useDebounce(fn,wait){const $=reactCompilerRuntime.c(6);const callback=useEvent.useEvent(fn);let t0;if($[0]!==callback||$[1]!==wait){t0=utils.debounce(callback,wait);$[0]=callback;$[1]=wait;$[2]=t0}else{t0=$[2]}const debounced=t0;let t1;let t2;if($[3]!==debounced){t1=()=>()=>{debounced.cancel()};t2=[debounced];$[3]=debounced;$[4]=t1;$[5]=t2}else{t1=$[4];t2=$[5]}react.useEffect(t1,t2);return debounced}exports.useDebounce=useDebounce;
20
2
  //# sourceMappingURL=use-debounce.cjs.map
21
- //# sourceMappingURL=use-debounce.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-debounce.ts"],"names":["useEvent","useMemo","debounce","useEffect"],"mappings":";;;;;;;AAMO,SAAS,WAAA,CACd,IACA,IAAA,EACkC;AAClC,EAAA,MAAM,QAAA,GAAWA,sBAAS,EAAE,CAAA;AAE5B,EAAA,MAAM,SAAA,GAAYC,aAAA,CAAQ,MAAMC,cAAA,CAAS,QAAA,EAAU,IAAI,CAAA,EAAG,CAAC,QAAA,EAAU,IAAI,CAAC,CAAA;AAE1E,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,CAAU,MAAA,EAAO;AAAA,IACnB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,SAAS,CAAC,CAAA;AAEd,EAAA,OAAO,SAAA;AACT","file":"use-debounce.cjs","sourcesContent":["import type { Cancelable } from '@mado/utils';\nimport { debounce } from '@mado/utils';\nimport { useEffect, useMemo } from 'react';\n\nimport { useEvent } from './use-event';\n\nexport function useDebounce<T extends any[], U>(\n fn: (...args: T) => U,\n wait?: number,\n): ((...args: T) => U) & Cancelable {\n const callback = useEvent(fn);\n\n const debounced = useMemo(() => debounce(callback, wait), [callback, wait]);\n\n useEffect(() => {\n return () => {\n debounced.cancel();\n };\n }, [debounced]);\n\n return debounced;\n}\n"]}
1
+ {"version":3,"file":"use-debounce.cjs","sources":["../src/use-debounce.ts"],"sourcesContent":["import type { Cancelable } from '@mado/utils';\nimport { debounce } from '@mado/utils';\nimport { useEffect, useMemo } from 'react';\n\nimport { useEvent } from './use-event';\n\nexport function useDebounce<T extends any[], U>(\n fn: (...args: T) => U,\n wait?: number,\n): ((...args: T) => U) & Cancelable {\n const callback = useEvent(fn);\n\n const debounced = useMemo(() => debounce(callback, wait), [callback, wait]);\n\n useEffect(() => {\n return () => {\n debounced.cancel();\n };\n }, [debounced]);\n\n return debounced;\n}\n"],"names":["useDebounce","fn","wait","$","_c","callback","useEvent","t0","debounce","debounced","t1","t2","cancel","useEffect"],"mappings":"0NAMO,SAAAA,YAAAC,GAAAC,MAAA,MAAAC,EAAAC,qBAAAA,EAAA,GAIL,MAAAC,SAAiBC,SAAAA,SAASL,IAAI,IAAAM,GAAA,GAAAJ,EAAA,KAAAE,UAAAF,OAAAD,KAAA,CAEEK,GAAAC,MAAAA,SAASH,SAAUH,MAAKC,KAAAE,SAAAF,KAAAD,KAAAC,KAAAI,EAAA,KAAA,CAAAA,GAAAJ,EAAA,EAAA,CAAxD,MAAAM,UAAgCF,GAA4C,IAAAG,GAAA,IAAAC,GAAA,GAAAR,OAAAM,UAAA,CAElEC,GAAAA,IACD,KACLD,UAASG,UAEVD,GAAA,CAACF,WAAUN,KAAAM,UAAAN,KAAAO,GAAAP,KAAAQ,EAAA,KAAA,CAAAD,GAAAP,EAAA,GAAAQ,GAAAR,EAAA,EAAA,CAJdU,MAAAA,UAAUH,GAIPC,IAAY,OAERF,SAAS"}
@@ -1,19 +1,2 @@
1
- import { debounce } from '@mado/utils';
2
- import { useMemo, useEffect } from 'react';
3
- import { useEvent } from './use-event.js';
4
-
5
- // src/use-debounce.ts
6
- function useDebounce(fn, wait) {
7
- const callback = useEvent(fn);
8
- const debounced = useMemo(() => debounce(callback, wait), [callback, wait]);
9
- useEffect(() => {
10
- return () => {
11
- debounced.cancel();
12
- };
13
- }, [debounced]);
14
- return debounced;
15
- }
16
-
17
- export { useDebounce };
1
+ import{c}from"react-compiler-runtime";import{debounce}from"@mado/utils";import{useEffect}from"react";import{useEvent}from"./use-event.js";import"./use-isomorphic-layout-effect.js";function useDebounce(fn,wait){const $=c(6);const callback=useEvent(fn);let t0;if($[0]!==callback||$[1]!==wait){t0=debounce(callback,wait);$[0]=callback;$[1]=wait;$[2]=t0}else{t0=$[2]}const debounced=t0;let t1;let t2;if($[3]!==debounced){t1=()=>()=>{debounced.cancel()};t2=[debounced];$[3]=debounced;$[4]=t1;$[5]=t2}else{t1=$[4];t2=$[5]}useEffect(t1,t2);return debounced}export{useDebounce};
18
2
  //# sourceMappingURL=use-debounce.js.map
19
- //# sourceMappingURL=use-debounce.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-debounce.ts"],"names":[],"mappings":";;;;;AAMO,SAAS,WAAA,CACd,IACA,IAAA,EACkC;AAClC,EAAA,MAAM,QAAA,GAAW,SAAS,EAAE,CAAA;AAE5B,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,MAAM,QAAA,CAAS,QAAA,EAAU,IAAI,CAAA,EAAG,CAAC,QAAA,EAAU,IAAI,CAAC,CAAA;AAE1E,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,CAAU,MAAA,EAAO;AAAA,IACnB,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,SAAS,CAAC,CAAA;AAEd,EAAA,OAAO,SAAA;AACT","file":"use-debounce.js","sourcesContent":["import type { Cancelable } from '@mado/utils';\nimport { debounce } from '@mado/utils';\nimport { useEffect, useMemo } from 'react';\n\nimport { useEvent } from './use-event';\n\nexport function useDebounce<T extends any[], U>(\n fn: (...args: T) => U,\n wait?: number,\n): ((...args: T) => U) & Cancelable {\n const callback = useEvent(fn);\n\n const debounced = useMemo(() => debounce(callback, wait), [callback, wait]);\n\n useEffect(() => {\n return () => {\n debounced.cancel();\n };\n }, [debounced]);\n\n return debounced;\n}\n"]}
1
+ {"version":3,"file":"use-debounce.js","sources":["../src/use-debounce.ts"],"sourcesContent":["import type { Cancelable } from '@mado/utils';\nimport { debounce } from '@mado/utils';\nimport { useEffect, useMemo } from 'react';\n\nimport { useEvent } from './use-event';\n\nexport function useDebounce<T extends any[], U>(\n fn: (...args: T) => U,\n wait?: number,\n): ((...args: T) => U) & Cancelable {\n const callback = useEvent(fn);\n\n const debounced = useMemo(() => debounce(callback, wait), [callback, wait]);\n\n useEffect(() => {\n return () => {\n debounced.cancel();\n };\n }, [debounced]);\n\n return debounced;\n}\n"],"names":["useDebounce","fn","wait","$","_c","callback","useEvent","t0","debounce","debounced","t1","t2","cancel","useEffect"],"mappings":"oLAMO,SAAAA,YAAAC,GAAAC,MAAA,MAAAC,EAAAC,EAAA,GAIL,MAAAC,SAAiBC,SAASL,IAAI,IAAAM,GAAA,GAAAJ,EAAA,KAAAE,UAAAF,OAAAD,KAAA,CAEEK,GAAAC,SAASH,SAAUH,MAAKC,KAAAE,SAAAF,KAAAD,KAAAC,KAAAI,EAAA,KAAA,CAAAA,GAAAJ,EAAA,EAAA,CAAxD,MAAAM,UAAgCF,GAA4C,IAAAG,GAAA,IAAAC,GAAA,GAAAR,OAAAM,UAAA,CAElEC,GAAAA,IACD,KACLD,UAASG,UAEVD,GAAA,CAACF,WAAUN,KAAAM,UAAAN,KAAAO,GAAAP,KAAAQ,EAAA,KAAA,CAAAD,GAAAP,EAAA,GAAAQ,GAAAR,EAAA,EAAA,CAJdU,UAAUH,GAIPC,IAAY,OAERF,SAAS"}
@@ -1,17 +1,2 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- var useIsomorphicLayoutEffect_cjs = require('./use-isomorphic-layout-effect.cjs');
5
-
6
- // src/use-event.ts
7
- function useEvent(fn) {
8
- const ref = react.useRef(fn);
9
- useIsomorphicLayoutEffect_cjs.useIsomorphicLayoutEffect(() => {
10
- ref.current = fn;
11
- });
12
- return react.useRef((...args) => (0, ref.current)(...args)).current;
13
- }
14
-
15
- exports.useEvent = useEvent;
1
+ "use strict";var react=require("react");var useIsomorphicLayoutEffect=require("./use-isomorphic-layout-effect.cjs");function useEvent(fn){const ref=react.useRef(fn);useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(()=>{ref.current=fn});return react.useRef((...args)=>(0,ref.current)(...args)).current}exports.useEvent=useEvent;
16
2
  //# sourceMappingURL=use-event.cjs.map
17
- //# sourceMappingURL=use-event.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-event.ts"],"names":["useRef","useIsomorphicLayoutEffect"],"mappings":";;;;;;AAIO,SAAS,SAAiC,EAAA,EAA0C;AACzF,EAAA,MAAM,GAAA,GAAMA,aAAO,EAAE,CAAA;AAErB,EAAAC,uDAAA,CAA0B,MAAM;AAC9B,IAAA,GAAA,CAAI,OAAA,GAAU,EAAA;AAAA,EAChB,CAAC,CAAA;AAED,EAAA,OAAOD,YAAA,CAAO,IAAI,IAAA,KAAA,IAAgB,IAAI,OAAA,EAAS,GAAG,IAAI,CAAC,CAAA,CAAE,OAAA;AAC3D","file":"use-event.cjs","sourcesContent":["import { useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect';\n\nexport function useEvent<T extends unknown[], U>(fn: (...args: T) => U): (...args: T) => U {\n const ref = useRef(fn);\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n });\n\n return useRef((...args: T) => (0, ref.current)(...args)).current;\n}\n"]}
1
+ {"version":3,"file":"use-event.cjs","sources":["../src/use-event.ts"],"sourcesContent":["import { useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect';\n\nexport function useEvent<T extends unknown[], U>(fn: (...args: T) => U): (...args: T) => U {\n const ref = useRef(fn);\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n });\n\n // eslint-disable-next-line react-hooks/refs\n return useRef((...args: T) => (0, ref.current)(...args)).current;\n}\n"],"names":["useEvent","fn","ref","useRef","useIsomorphicLayoutEffect","current","args"],"mappings":"oHAIO,SAASA,SAAiCC,IAC/C,MAAMC,IAAMC,MAAAA,OAAOF,IAEnBG,0BAAAA,0BAA0B,KACxBF,IAAIG,QAAUJ,KAIhB,OAAOE,MAAAA,OAAO,IAAIG,QAAY,EAAIJ,IAAIG,YAAYC,OAAOD,OAC3D"}
package/dist/use-event.js CHANGED
@@ -1,15 +1,2 @@
1
- import { useRef } from 'react';
2
- import { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect.js';
3
-
4
- // src/use-event.ts
5
- function useEvent(fn) {
6
- const ref = useRef(fn);
7
- useIsomorphicLayoutEffect(() => {
8
- ref.current = fn;
9
- });
10
- return useRef((...args) => (0, ref.current)(...args)).current;
11
- }
12
-
13
- export { useEvent };
1
+ import{useRef}from"react";import{useIsomorphicLayoutEffect}from"./use-isomorphic-layout-effect.js";function useEvent(fn){const ref=useRef(fn);useIsomorphicLayoutEffect(()=>{ref.current=fn});return useRef((...args)=>(0,ref.current)(...args)).current}export{useEvent};
14
2
  //# sourceMappingURL=use-event.js.map
15
- //# sourceMappingURL=use-event.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-event.ts"],"names":[],"mappings":";;;;AAIO,SAAS,SAAiC,EAAA,EAA0C;AACzF,EAAA,MAAM,GAAA,GAAM,OAAO,EAAE,CAAA;AAErB,EAAA,yBAAA,CAA0B,MAAM;AAC9B,IAAA,GAAA,CAAI,OAAA,GAAU,EAAA;AAAA,EAChB,CAAC,CAAA;AAED,EAAA,OAAO,MAAA,CAAO,IAAI,IAAA,KAAA,IAAgB,IAAI,OAAA,EAAS,GAAG,IAAI,CAAC,CAAA,CAAE,OAAA;AAC3D","file":"use-event.js","sourcesContent":["import { useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect';\n\nexport function useEvent<T extends unknown[], U>(fn: (...args: T) => U): (...args: T) => U {\n const ref = useRef(fn);\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n });\n\n return useRef((...args: T) => (0, ref.current)(...args)).current;\n}\n"]}
1
+ {"version":3,"file":"use-event.js","sources":["../src/use-event.ts"],"sourcesContent":["import { useRef } from 'react';\n\nimport { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect';\n\nexport function useEvent<T extends unknown[], U>(fn: (...args: T) => U): (...args: T) => U {\n const ref = useRef(fn);\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n });\n\n // eslint-disable-next-line react-hooks/refs\n return useRef((...args: T) => (0, ref.current)(...args)).current;\n}\n"],"names":["useEvent","fn","ref","useRef","useIsomorphicLayoutEffect","current","args"],"mappings":"mGAIO,SAASA,SAAiCC,IAC/C,MAAMC,IAAMC,OAAOF,IAEnBG,0BAA0B,KACxBF,IAAIG,QAAUJ,KAIhB,OAAOE,OAAO,IAAIG,QAAY,EAAIJ,IAAIG,YAAYC,OAAOD,OAC3D"}
@@ -1,16 +1,2 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
-
5
- // src/use-is-mounted.ts
6
- function useIsMounted() {
7
- const [isMounted, setIsMounted] = react.useState(false);
8
- react.useEffect(() => {
9
- setIsMounted(true);
10
- }, []);
11
- return isMounted;
12
- }
13
-
14
- exports.useIsMounted = useIsMounted;
1
+ "use strict";var react=require("react");const subscribe=()=>()=>{};function getSnapshot(){return true}function getServerSnapshot(){return false}function useIsMounted(){return react.useSyncExternalStore(subscribe,getSnapshot,getServerSnapshot)}exports.useIsMounted=useIsMounted;
15
2
  //# sourceMappingURL=use-is-mounted.cjs.map
16
- //# sourceMappingURL=use-is-mounted.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-is-mounted.ts"],"names":["useState","useEffect"],"mappings":";;;;;AAEO,SAAS,YAAA,GAAwB;AACtC,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAIA,eAAS,KAAK,CAAA;AAEhD,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,YAAA,CAAa,IAAI,CAAA;AAAA,EACnB,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,SAAA;AACT","file":"use-is-mounted.cjs","sourcesContent":["import { useEffect, useState } from 'react';\n\nexport function useIsMounted(): boolean {\n const [isMounted, setIsMounted] = useState(false);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n return isMounted;\n}\n"]}
1
+ {"version":3,"file":"use-is-mounted.cjs","sources":["../src/use-is-mounted.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nconst subscribe = () => () => {};\n\nfunction getSnapshot(): boolean {\n return true;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nexport function useIsMounted(): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"],"names":["subscribe","getSnapshot","getServerSnapshot","useIsMounted","useSyncExternalStore"],"mappings":"wCAEA,MAAMA,UAAYA,IAAM,OAExB,SAASC,cACP,OAAO,IACT,CAEA,SAASC,oBACP,OAAO,KACT,CAEO,SAAAC,eAAA,OACEC,2BAAqBJ,UAAWC,YAAaC,kBAAkB"}
@@ -1,14 +1,2 @@
1
- import { useState, useEffect } from 'react';
2
-
3
- // src/use-is-mounted.ts
4
- function useIsMounted() {
5
- const [isMounted, setIsMounted] = useState(false);
6
- useEffect(() => {
7
- setIsMounted(true);
8
- }, []);
9
- return isMounted;
10
- }
11
-
12
- export { useIsMounted };
1
+ import{useSyncExternalStore}from"react";const subscribe=()=>()=>{};function getSnapshot(){return true}function getServerSnapshot(){return false}function useIsMounted(){return useSyncExternalStore(subscribe,getSnapshot,getServerSnapshot)}export{useIsMounted};
13
2
  //# sourceMappingURL=use-is-mounted.js.map
14
- //# sourceMappingURL=use-is-mounted.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-is-mounted.ts"],"names":[],"mappings":";;;AAEO,SAAS,YAAA,GAAwB;AACtC,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,YAAA,CAAa,IAAI,CAAA;AAAA,EACnB,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,SAAA;AACT","file":"use-is-mounted.js","sourcesContent":["import { useEffect, useState } from 'react';\n\nexport function useIsMounted(): boolean {\n const [isMounted, setIsMounted] = useState(false);\n\n useEffect(() => {\n setIsMounted(true);\n }, []);\n\n return isMounted;\n}\n"]}
1
+ {"version":3,"file":"use-is-mounted.js","sources":["../src/use-is-mounted.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nconst subscribe = () => () => {};\n\nfunction getSnapshot(): boolean {\n return true;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nexport function useIsMounted(): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"],"names":["subscribe","getSnapshot","getServerSnapshot","useIsMounted","useSyncExternalStore"],"mappings":"wCAEA,MAAMA,UAAYA,IAAM,OAExB,SAASC,cACP,OAAO,IACT,CAEA,SAASC,oBACP,OAAO,KACT,CAEO,SAAAC,eAAA,OACEC,qBAAqBJ,UAAWC,YAAaC,kBAAkB"}
@@ -1,10 +1,2 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
-
5
- // src/use-isomorphic-layout-effect.ts
6
- var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
7
-
8
- exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
1
+ "use strict";var react=require("react");const useIsomorphicLayoutEffect=typeof window==="undefined"?react.useEffect:react.useLayoutEffect;exports.useIsomorphicLayoutEffect=useIsomorphicLayoutEffect;
9
2
  //# sourceMappingURL=use-isomorphic-layout-effect.cjs.map
10
- //# sourceMappingURL=use-isomorphic-layout-effect.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-isomorphic-layout-effect.ts"],"names":["useEffect","useLayoutEffect"],"mappings":";;;;;AAEO,IAAM,yBAAA,GAA4B,OAAO,MAAA,KAAW,WAAA,GAAcA,eAAA,GAAYC","file":"use-isomorphic-layout-effect.cjs","sourcesContent":["import { useEffect, useLayoutEffect } from 'react';\n\nexport const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n"]}
1
+ {"version":3,"file":"use-isomorphic-layout-effect.cjs","sources":["../src/use-isomorphic-layout-effect.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from 'react';\n\nexport const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n"],"names":["useIsomorphicLayoutEffect","window","useEffect","useLayoutEffect"],"mappings":"wCAEO,MAAMA,iCAAmCC,SAAW,YAAcC,gBAAYC,MAAAA"}
@@ -1,8 +1,2 @@
1
- import { useEffect, useLayoutEffect } from 'react';
2
-
3
- // src/use-isomorphic-layout-effect.ts
4
- var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
5
-
6
- export { useIsomorphicLayoutEffect };
1
+ import{useEffect,useLayoutEffect}from"react";const useIsomorphicLayoutEffect=typeof window==="undefined"?useEffect:useLayoutEffect;export{useIsomorphicLayoutEffect};
7
2
  //# sourceMappingURL=use-isomorphic-layout-effect.js.map
8
- //# sourceMappingURL=use-isomorphic-layout-effect.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-isomorphic-layout-effect.ts"],"names":[],"mappings":";;;AAEO,IAAM,yBAAA,GAA4B,OAAO,MAAA,KAAW,WAAA,GAAc,SAAA,GAAY","file":"use-isomorphic-layout-effect.js","sourcesContent":["import { useEffect, useLayoutEffect } from 'react';\n\nexport const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n"]}
1
+ {"version":3,"file":"use-isomorphic-layout-effect.js","sources":["../src/use-isomorphic-layout-effect.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from 'react';\n\nexport const useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n"],"names":["useIsomorphicLayoutEffect","window","useEffect","useLayoutEffect"],"mappings":"6CAEO,MAAMA,iCAAmCC,SAAW,YAAcC,UAAYC"}
@@ -1,36 +1,2 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
- var shim = require('use-sync-external-store/shim');
5
-
6
- // src/use-media-query.ts
7
- function useMediaQuery(query, defaultMatches = false) {
8
- const [subscribe, getSnapshot, getServerSnapshot] = react.useMemo(() => {
9
- const matchMedia = typeof window !== "undefined" && window.matchMedia;
10
- const getDefaultSnapshot = () => {
11
- return defaultMatches;
12
- };
13
- if (!matchMedia) {
14
- return [() => () => {
15
- }, getDefaultSnapshot, getDefaultSnapshot];
16
- }
17
- const mediaQueryList = matchMedia(query);
18
- return [
19
- (onStoreChange) => {
20
- mediaQueryList.addListener(onStoreChange);
21
- return () => {
22
- mediaQueryList.removeListener(onStoreChange);
23
- };
24
- },
25
- () => {
26
- return mediaQueryList.matches;
27
- },
28
- getDefaultSnapshot
29
- ];
30
- }, [defaultMatches, query]);
31
- return shim.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
32
- }
33
-
34
- exports.useMediaQuery = useMediaQuery;
1
+ "use strict";var reactCompilerRuntime=require("react-compiler-runtime");var react=require("react");function useMediaQuery(query,t0){const $=reactCompilerRuntime.c(13);const defaultMatches=t0===undefined?false:t0;let t1;bb0:{const matchMedia=typeof window!=="undefined"&&window.matchMedia;let t2;if($[0]!==defaultMatches){t2=()=>defaultMatches;$[0]=defaultMatches;$[1]=t2}else{t2=$[1]}const getDefaultSnapshot=t2;if(!matchMedia){let t3;if($[2]!==getDefaultSnapshot){t3=[_temp2,getDefaultSnapshot,getDefaultSnapshot];$[2]=getDefaultSnapshot;$[3]=t3}else{t3=$[3]}t1=t3;break bb0}let t3;if($[4]!==query){t3=matchMedia(query);$[4]=query;$[5]=t3}else{t3=$[5]}const mediaQueryList=t3;let t4;let t5;if($[6]!==mediaQueryList){t4=onStoreChange=>{mediaQueryList.addListener(onStoreChange);return()=>{mediaQueryList.removeListener(onStoreChange)}};t5=()=>mediaQueryList.matches;$[6]=mediaQueryList;$[7]=t4;$[8]=t5}else{t4=$[7];t5=$[8]}let t6;if($[9]!==getDefaultSnapshot||$[10]!==t4||$[11]!==t5){t6=[t4,t5,getDefaultSnapshot];$[9]=getDefaultSnapshot;$[10]=t4;$[11]=t5;$[12]=t6}else{t6=$[12]}t1=t6}const[subscribe,getSnapshot,getServerSnapshot]=t1;return react.useSyncExternalStore(subscribe,getSnapshot,getServerSnapshot)}function _temp2(){return _temp}function _temp(){}exports.useMediaQuery=useMediaQuery;
35
2
  //# sourceMappingURL=use-media-query.cjs.map
36
- //# sourceMappingURL=use-media-query.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-media-query.ts"],"names":["useMemo","useSyncExternalStore"],"mappings":";;;;;;AAGO,SAAS,aAAA,CAAc,KAAA,EAAe,cAAA,GAAiB,KAAA,EAAgB;AAC5E,EAAA,MAAM,CAAC,SAAA,EAAW,WAAA,EAAa,iBAAiB,CAAA,GAAIA,cAAQ,MAAM;AAChE,IAAA,MAAM,UAAA,GAAa,OAAO,MAAA,KAAW,WAAA,IAAe,MAAA,CAAO,UAAA;AAE3D,IAAA,MAAM,qBAAqB,MAAM;AAC/B,MAAA,OAAO,cAAA;AAAA,IACT,CAAA;AAEA,IAAA,IAAI,CAAC,UAAA,EAAY;AACf,MAAA,OAAO,CAAC,MAAM,MAAM;AAAA,MAAC,CAAA,EAAG,oBAAoB,kBAAkB,CAAA;AAAA,IAChE;AAEA,IAAA,MAAM,cAAA,GAAiB,WAAW,KAAK,CAAA;AAEvC,IAAA,OAAO;AAAA,MACL,CAAC,aAAA,KAAgC;AAC/B,QAAA,cAAA,CAAe,YAAY,aAAa,CAAA;AAExC,QAAA,OAAO,MAAM;AACX,UAAA,cAAA,CAAe,eAAe,aAAa,CAAA;AAAA,QAC7C,CAAA;AAAA,MACF,CAAA;AAAA,MACA,MAAM;AACJ,QAAA,OAAO,cAAA,CAAe,OAAA;AAAA,MACxB,CAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF,CAAA,EAAG,CAAC,cAAA,EAAgB,KAAK,CAAC,CAAA;AAE1B,EAAA,OAAOC,yBAAA,CAAqB,SAAA,EAAW,WAAA,EAAa,iBAAiB,CAAA;AACvE","file":"use-media-query.cjs","sourcesContent":["import { useMemo } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\n\nexport function useMediaQuery(query: string, defaultMatches = false): boolean {\n const [subscribe, getSnapshot, getServerSnapshot] = useMemo(() => {\n const matchMedia = typeof window !== 'undefined' && window.matchMedia;\n\n const getDefaultSnapshot = () => {\n return defaultMatches;\n };\n\n if (!matchMedia) {\n return [() => () => {}, getDefaultSnapshot, getDefaultSnapshot];\n }\n\n const mediaQueryList = matchMedia(query);\n\n return [\n (onStoreChange: VoidFunction) => {\n mediaQueryList.addListener(onStoreChange);\n\n return () => {\n mediaQueryList.removeListener(onStoreChange);\n };\n },\n () => {\n return mediaQueryList.matches;\n },\n getDefaultSnapshot,\n ];\n }, [defaultMatches, query]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"]}
1
+ {"version":3,"file":"use-media-query.cjs","sources":["../src/use-media-query.ts"],"sourcesContent":["import { useMemo, useSyncExternalStore } from 'react';\n\nexport function useMediaQuery(query: string, defaultMatches = false): boolean {\n const [subscribe, getSnapshot, getServerSnapshot] = useMemo(() => {\n const matchMedia = typeof window !== 'undefined' && window.matchMedia;\n\n const getDefaultSnapshot = () => {\n return defaultMatches;\n };\n\n if (!matchMedia) {\n return [() => () => {}, getDefaultSnapshot, getDefaultSnapshot];\n }\n\n const mediaQueryList = matchMedia(query);\n\n return [\n (onStoreChange: VoidFunction) => {\n mediaQueryList.addListener(onStoreChange);\n\n return () => {\n mediaQueryList.removeListener(onStoreChange);\n };\n },\n () => mediaQueryList.matches,\n getDefaultSnapshot,\n ];\n }, [defaultMatches, query]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"],"names":["useMediaQuery","query","t0","$","_c","defaultMatches","undefined","t1","bb0","matchMedia","window","t2","getDefaultSnapshot","t3","_temp2","mediaQueryList","t4","t5","onStoreChange","addListener","removeListener","matches","t6","subscribe","getSnapshot","getServerSnapshot","useSyncExternalStore","_temp"],"mappings":"mGAEO,SAAAA,cAAAC,MAAAC,IAAA,MAAAC,EAAAC,qBAAAA,EAAA,IAAsC,MAAAC,eAAAH,KAAAI,UAAA,MAAAJ,GAAsB,IAAAK,GAAAC,IAAA,CAE/D,MAAAC,kBAA0BC,SAAW,aAAeA,OAAMD,WAAY,IAAAE,GAAA,GAAAR,OAAAE,eAAA,CAE3CM,GAAAA,IAClBN,eACRF,KAAAE,eAAAF,KAAAQ,EAAA,KAAA,CAAAA,GAAAR,EAAA,EAAA,CAFD,MAAAS,mBAA2BD,GAI3B,IAAKF,WAAU,CAAA,IAAAI,GAAA,GAAAV,OAAAS,mBAAA,CACNC,IAACC,OAAgBF,mBAAoBA,oBAAmBT,KAAAS,mBAAAT,KAAAU,EAAA,KAAA,CAAAA,GAAAV,EAAA,EAAA,CAA/DI,GAAOM,GAAP,MAAAL,GAAgE,CACjE,IAAAK,GAAA,GAAAV,OAAAF,MAAA,CAEsBY,GAAAJ,WAAWR,OAAME,KAAAF,MAAAE,KAAAU,EAAA,KAAA,CAAAA,GAAAV,EAAA,EAAA,CAAxC,MAAAY,eAAuBF,GAAkB,IAAAG,GAAA,IAAAC,GAAA,GAAAd,OAAAY,eAAA,CAGvCC,GAAAE,gBACEH,eAAcI,YAAaD,eAAc,MAElC,KACLH,eAAcK,eAAgBF,iBAGlCD,GAAAA,IAAMF,eAAcM,QAAQlB,KAAAY,eAAAZ,KAAAa,GAAAb,KAAAc,EAAA,KAAA,CAAAD,GAAAb,EAAA,GAAAc,GAAAd,EAAA,EAAA,CAAA,IAAAmB,GAAA,GAAAnB,EAAA,KAAAS,oBAAAT,QAAAa,IAAAb,EAAA,MAAAc,GAAA,CARvBK,IACLN,GAOAC,GACAL,oBACDT,KAAAS,mBAAAT,MAAAa,GAAAb,MAAAc,GAAAd,MAAAmB,EAAA,KAAA,CAAAA,GAAAnB,EAAA,GAAA,CAVDI,GAAOe,EAUL,CAvBJ,MAAAC,UAAAC,YAAAC,mBAAoDlB,GAwBxB,OAErBmB,2BAAqBH,UAAWC,YAAaC,kBAAkB,CA3BjE,SAAAX,SAAA,OASaa,KAAQ,CATrB,SAAAA,QAAA"}
@@ -1,34 +1,2 @@
1
- import { useMemo } from 'react';
2
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
3
-
4
- // src/use-media-query.ts
5
- function useMediaQuery(query, defaultMatches = false) {
6
- const [subscribe, getSnapshot, getServerSnapshot] = useMemo(() => {
7
- const matchMedia = typeof window !== "undefined" && window.matchMedia;
8
- const getDefaultSnapshot = () => {
9
- return defaultMatches;
10
- };
11
- if (!matchMedia) {
12
- return [() => () => {
13
- }, getDefaultSnapshot, getDefaultSnapshot];
14
- }
15
- const mediaQueryList = matchMedia(query);
16
- return [
17
- (onStoreChange) => {
18
- mediaQueryList.addListener(onStoreChange);
19
- return () => {
20
- mediaQueryList.removeListener(onStoreChange);
21
- };
22
- },
23
- () => {
24
- return mediaQueryList.matches;
25
- },
26
- getDefaultSnapshot
27
- ];
28
- }, [defaultMatches, query]);
29
- return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
30
- }
31
-
32
- export { useMediaQuery };
1
+ import{c}from"react-compiler-runtime";import{useSyncExternalStore}from"react";function useMediaQuery(query,t0){const $=c(13);const defaultMatches=t0===undefined?false:t0;let t1;bb0:{const matchMedia=typeof window!=="undefined"&&window.matchMedia;let t2;if($[0]!==defaultMatches){t2=()=>defaultMatches;$[0]=defaultMatches;$[1]=t2}else{t2=$[1]}const getDefaultSnapshot=t2;if(!matchMedia){let t3;if($[2]!==getDefaultSnapshot){t3=[_temp2,getDefaultSnapshot,getDefaultSnapshot];$[2]=getDefaultSnapshot;$[3]=t3}else{t3=$[3]}t1=t3;break bb0}let t3;if($[4]!==query){t3=matchMedia(query);$[4]=query;$[5]=t3}else{t3=$[5]}const mediaQueryList=t3;let t4;let t5;if($[6]!==mediaQueryList){t4=onStoreChange=>{mediaQueryList.addListener(onStoreChange);return()=>{mediaQueryList.removeListener(onStoreChange)}};t5=()=>mediaQueryList.matches;$[6]=mediaQueryList;$[7]=t4;$[8]=t5}else{t4=$[7];t5=$[8]}let t6;if($[9]!==getDefaultSnapshot||$[10]!==t4||$[11]!==t5){t6=[t4,t5,getDefaultSnapshot];$[9]=getDefaultSnapshot;$[10]=t4;$[11]=t5;$[12]=t6}else{t6=$[12]}t1=t6}const[subscribe,getSnapshot,getServerSnapshot]=t1;return useSyncExternalStore(subscribe,getSnapshot,getServerSnapshot)}function _temp2(){return _temp}function _temp(){}export{useMediaQuery};
33
2
  //# sourceMappingURL=use-media-query.js.map
34
- //# sourceMappingURL=use-media-query.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-media-query.ts"],"names":[],"mappings":";;;;AAGO,SAAS,aAAA,CAAc,KAAA,EAAe,cAAA,GAAiB,KAAA,EAAgB;AAC5E,EAAA,MAAM,CAAC,SAAA,EAAW,WAAA,EAAa,iBAAiB,CAAA,GAAI,QAAQ,MAAM;AAChE,IAAA,MAAM,UAAA,GAAa,OAAO,MAAA,KAAW,WAAA,IAAe,MAAA,CAAO,UAAA;AAE3D,IAAA,MAAM,qBAAqB,MAAM;AAC/B,MAAA,OAAO,cAAA;AAAA,IACT,CAAA;AAEA,IAAA,IAAI,CAAC,UAAA,EAAY;AACf,MAAA,OAAO,CAAC,MAAM,MAAM;AAAA,MAAC,CAAA,EAAG,oBAAoB,kBAAkB,CAAA;AAAA,IAChE;AAEA,IAAA,MAAM,cAAA,GAAiB,WAAW,KAAK,CAAA;AAEvC,IAAA,OAAO;AAAA,MACL,CAAC,aAAA,KAAgC;AAC/B,QAAA,cAAA,CAAe,YAAY,aAAa,CAAA;AAExC,QAAA,OAAO,MAAM;AACX,UAAA,cAAA,CAAe,eAAe,aAAa,CAAA;AAAA,QAC7C,CAAA;AAAA,MACF,CAAA;AAAA,MACA,MAAM;AACJ,QAAA,OAAO,cAAA,CAAe,OAAA;AAAA,MACxB,CAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF,CAAA,EAAG,CAAC,cAAA,EAAgB,KAAK,CAAC,CAAA;AAE1B,EAAA,OAAO,oBAAA,CAAqB,SAAA,EAAW,WAAA,EAAa,iBAAiB,CAAA;AACvE","file":"use-media-query.js","sourcesContent":["import { useMemo } from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\n\nexport function useMediaQuery(query: string, defaultMatches = false): boolean {\n const [subscribe, getSnapshot, getServerSnapshot] = useMemo(() => {\n const matchMedia = typeof window !== 'undefined' && window.matchMedia;\n\n const getDefaultSnapshot = () => {\n return defaultMatches;\n };\n\n if (!matchMedia) {\n return [() => () => {}, getDefaultSnapshot, getDefaultSnapshot];\n }\n\n const mediaQueryList = matchMedia(query);\n\n return [\n (onStoreChange: VoidFunction) => {\n mediaQueryList.addListener(onStoreChange);\n\n return () => {\n mediaQueryList.removeListener(onStoreChange);\n };\n },\n () => {\n return mediaQueryList.matches;\n },\n getDefaultSnapshot,\n ];\n }, [defaultMatches, query]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"]}
1
+ {"version":3,"file":"use-media-query.js","sources":["../src/use-media-query.ts"],"sourcesContent":["import { useMemo, useSyncExternalStore } from 'react';\n\nexport function useMediaQuery(query: string, defaultMatches = false): boolean {\n const [subscribe, getSnapshot, getServerSnapshot] = useMemo(() => {\n const matchMedia = typeof window !== 'undefined' && window.matchMedia;\n\n const getDefaultSnapshot = () => {\n return defaultMatches;\n };\n\n if (!matchMedia) {\n return [() => () => {}, getDefaultSnapshot, getDefaultSnapshot];\n }\n\n const mediaQueryList = matchMedia(query);\n\n return [\n (onStoreChange: VoidFunction) => {\n mediaQueryList.addListener(onStoreChange);\n\n return () => {\n mediaQueryList.removeListener(onStoreChange);\n };\n },\n () => mediaQueryList.matches,\n getDefaultSnapshot,\n ];\n }, [defaultMatches, query]);\n\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"],"names":["useMediaQuery","query","t0","$","_c","defaultMatches","undefined","t1","bb0","matchMedia","window","t2","getDefaultSnapshot","t3","_temp2","mediaQueryList","t4","t5","onStoreChange","addListener","removeListener","matches","t6","subscribe","getSnapshot","getServerSnapshot","useSyncExternalStore","_temp"],"mappings":"8EAEO,SAAAA,cAAAC,MAAAC,IAAA,MAAAC,EAAAC,EAAA,IAAsC,MAAAC,eAAAH,KAAAI,UAAA,MAAAJ,GAAsB,IAAAK,GAAAC,IAAA,CAE/D,MAAAC,kBAA0BC,SAAW,aAAeA,OAAMD,WAAY,IAAAE,GAAA,GAAAR,OAAAE,eAAA,CAE3CM,GAAAA,IAClBN,eACRF,KAAAE,eAAAF,KAAAQ,EAAA,KAAA,CAAAA,GAAAR,EAAA,EAAA,CAFD,MAAAS,mBAA2BD,GAI3B,IAAKF,WAAU,CAAA,IAAAI,GAAA,GAAAV,OAAAS,mBAAA,CACNC,IAACC,OAAgBF,mBAAoBA,oBAAmBT,KAAAS,mBAAAT,KAAAU,EAAA,KAAA,CAAAA,GAAAV,EAAA,EAAA,CAA/DI,GAAOM,GAAP,MAAAL,GAAgE,CACjE,IAAAK,GAAA,GAAAV,OAAAF,MAAA,CAEsBY,GAAAJ,WAAWR,OAAME,KAAAF,MAAAE,KAAAU,EAAA,KAAA,CAAAA,GAAAV,EAAA,EAAA,CAAxC,MAAAY,eAAuBF,GAAkB,IAAAG,GAAA,IAAAC,GAAA,GAAAd,OAAAY,eAAA,CAGvCC,GAAAE,gBACEH,eAAcI,YAAaD,eAAc,MAElC,KACLH,eAAcK,eAAgBF,iBAGlCD,GAAAA,IAAMF,eAAcM,QAAQlB,KAAAY,eAAAZ,KAAAa,GAAAb,KAAAc,EAAA,KAAA,CAAAD,GAAAb,EAAA,GAAAc,GAAAd,EAAA,EAAA,CAAA,IAAAmB,GAAA,GAAAnB,EAAA,KAAAS,oBAAAT,QAAAa,IAAAb,EAAA,MAAAc,GAAA,CARvBK,IACLN,GAOAC,GACAL,oBACDT,KAAAS,mBAAAT,MAAAa,GAAAb,MAAAc,GAAAd,MAAAmB,EAAA,KAAA,CAAAA,GAAAnB,EAAA,GAAA,CAVDI,GAAOe,EAUL,CAvBJ,MAAAC,UAAAC,YAAAC,mBAAoDlB,GAwBxB,OAErBmB,qBAAqBH,UAAWC,YAAaC,kBAAkB,CA3BjE,SAAAX,SAAA,OASaa,KAAQ,CATrB,SAAAA,QAAA"}
@@ -1,31 +1,2 @@
1
- 'use strict';
2
-
3
- var shim = require('use-sync-external-store/shim');
4
-
5
- // src/use-online.ts
6
- function subscribe(onStoreChange) {
7
- window.addEventListener("online", onStoreChange, {
8
- passive: true
9
- });
10
- window.addEventListener("offline", onStoreChange, {
11
- passive: true
12
- });
13
- return () => {
14
- window.removeEventListener("online", onStoreChange);
15
- window.removeEventListener("offline", onStoreChange);
16
- };
17
- }
18
- function getSnapshot() {
19
- return navigator.onLine;
20
- }
21
- function getServerSnapshot() {
22
- return true;
23
- }
24
- function useOnline() {
25
- return shim.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
26
- }
27
- /* istanbul ignore next -- @preserve */
28
-
29
- exports.useOnline = useOnline;
1
+ "use strict";var reactCompilerRuntime=require("react-compiler-runtime");var react=require("react");function subscribe(onStoreChange){window.addEventListener("online",onStoreChange,{passive:true});window.addEventListener("offline",onStoreChange,{passive:true});return()=>{window.removeEventListener("online",onStoreChange);window.removeEventListener("offline",onStoreChange)}}function getSnapshot(){return navigator.onLine}function useOnline(t0){const $=reactCompilerRuntime.c(2);const defaultOnline=t0===undefined?true:t0;let t1;if($[0]!==defaultOnline){t1=()=>defaultOnline;$[0]=defaultOnline;$[1]=t1}else{t1=$[1]}return react.useSyncExternalStore(subscribe,getSnapshot,t1)}exports.useOnline=useOnline;
30
2
  //# sourceMappingURL=use-online.cjs.map
31
- //# sourceMappingURL=use-online.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-online.ts"],"names":["useSyncExternalStore"],"mappings":";;;;;AAEA,SAAS,UAAU,aAAA,EAA2C;AAC5D,EAAA,MAAA,CAAO,gBAAA,CAAiB,UAAU,aAAA,EAAe;AAAA,IAC/C,OAAA,EAAS;AAAA,GACV,CAAA;AACD,EAAA,MAAA,CAAO,gBAAA,CAAiB,WAAW,aAAA,EAAe;AAAA,IAChD,OAAA,EAAS;AAAA,GACV,CAAA;AAED,EAAA,OAAO,MAAM;AACX,IAAA,MAAA,CAAO,mBAAA,CAAoB,UAAU,aAAa,CAAA;AAClD,IAAA,MAAA,CAAO,mBAAA,CAAoB,WAAW,aAAa,CAAA;AAAA,EACrD,CAAA;AACF;AAEA,SAAS,WAAA,GAAuB;AAC9B,EAAA,OAAO,SAAA,CAAU,MAAA;AACnB;AAGA,SAAS,iBAAA,GAA6B;AACpC,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,SAAA,GAAqB;AACnC,EAAA,OAAOA,yBAAA,CAAqB,SAAA,EAAW,WAAA,EAAa,iBAAiB,CAAA;AACvE","file":"use-online.cjs","sourcesContent":["import { useSyncExternalStore } from 'use-sync-external-store/shim';\n\nfunction subscribe(onStoreChange: VoidFunction): VoidFunction {\n window.addEventListener('online', onStoreChange, {\n passive: true,\n });\n window.addEventListener('offline', onStoreChange, {\n passive: true,\n });\n\n return () => {\n window.removeEventListener('online', onStoreChange);\n window.removeEventListener('offline', onStoreChange);\n };\n}\n\nfunction getSnapshot(): boolean {\n return navigator.onLine;\n}\n\n/* istanbul ignore next -- @preserve */\nfunction getServerSnapshot(): boolean {\n return true;\n}\n\nexport function useOnline(): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"]}
1
+ {"version":3,"file":"use-online.cjs","sources":["../src/use-online.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nfunction subscribe(onStoreChange: VoidFunction): VoidFunction {\n window.addEventListener('online', onStoreChange, {\n passive: true,\n });\n window.addEventListener('offline', onStoreChange, {\n passive: true,\n });\n\n return () => {\n window.removeEventListener('online', onStoreChange);\n window.removeEventListener('offline', onStoreChange);\n };\n}\n\nfunction getSnapshot(): boolean {\n return navigator.onLine;\n}\n\nexport function useOnline(defaultOnline = true): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, () => defaultOnline);\n}\n"],"names":["subscribe","onStoreChange","window","addEventListener","passive","removeEventListener","getSnapshot","navigator","onLine","useOnline","t0","$","_c","defaultOnline","undefined","t1","useSyncExternalStore"],"mappings":"mGAEA,SAASA,UAAUC,eACjBC,OAAOC,iBAAiB,SAAUF,cAAe,CAC/CG,QAAS,OAEXF,OAAOC,iBAAiB,UAAWF,cAAe,CAChDG,QAAS,OAGX,MAAO,KACLF,OAAOG,oBAAoB,SAAUJ,eACrCC,OAAOG,oBAAoB,UAAWJ,eAE1C,CAEA,SAASK,cACP,OAAOC,UAAUC,MACnB,CAEO,SAAAC,UAAAC,IAAA,MAAAC,EAAAC,qBAAAA,EAAA,GAAmB,MAAAC,cAAAH,KAAAI,UAAA,KAAAJ,GAAoB,IAAAK,GAAA,GAAAJ,OAAAE,cAAA,CACQE,GAAAA,IAAMF,cAAaF,KAAAE,cAAAF,KAAAI,EAAA,KAAA,CAAAA,GAAAJ,EAAA,EAAA,CAAA,OAAhEK,2BAAqBhB,UAAWM,YAAaS,GAAoB"}
@@ -1,3 +1,3 @@
1
- declare function useOnline(): boolean;
1
+ declare function useOnline(defaultOnline?: boolean): boolean;
2
2
 
3
3
  export { useOnline };
@@ -1,3 +1,3 @@
1
- declare function useOnline(): boolean;
1
+ declare function useOnline(defaultOnline?: boolean): boolean;
2
2
 
3
3
  export { useOnline };
@@ -1,29 +1,2 @@
1
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
2
-
3
- // src/use-online.ts
4
- function subscribe(onStoreChange) {
5
- window.addEventListener("online", onStoreChange, {
6
- passive: true
7
- });
8
- window.addEventListener("offline", onStoreChange, {
9
- passive: true
10
- });
11
- return () => {
12
- window.removeEventListener("online", onStoreChange);
13
- window.removeEventListener("offline", onStoreChange);
14
- };
15
- }
16
- function getSnapshot() {
17
- return navigator.onLine;
18
- }
19
- function getServerSnapshot() {
20
- return true;
21
- }
22
- function useOnline() {
23
- return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
24
- }
25
- /* istanbul ignore next -- @preserve */
26
-
27
- export { useOnline };
1
+ import{c}from"react-compiler-runtime";import{useSyncExternalStore}from"react";function subscribe(onStoreChange){window.addEventListener("online",onStoreChange,{passive:true});window.addEventListener("offline",onStoreChange,{passive:true});return()=>{window.removeEventListener("online",onStoreChange);window.removeEventListener("offline",onStoreChange)}}function getSnapshot(){return navigator.onLine}function useOnline(t0){const $=c(2);const defaultOnline=t0===undefined?true:t0;let t1;if($[0]!==defaultOnline){t1=()=>defaultOnline;$[0]=defaultOnline;$[1]=t1}else{t1=$[1]}return useSyncExternalStore(subscribe,getSnapshot,t1)}export{useOnline};
28
2
  //# sourceMappingURL=use-online.js.map
29
- //# sourceMappingURL=use-online.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-online.ts"],"names":[],"mappings":";;;AAEA,SAAS,UAAU,aAAA,EAA2C;AAC5D,EAAA,MAAA,CAAO,gBAAA,CAAiB,UAAU,aAAA,EAAe;AAAA,IAC/C,OAAA,EAAS;AAAA,GACV,CAAA;AACD,EAAA,MAAA,CAAO,gBAAA,CAAiB,WAAW,aAAA,EAAe;AAAA,IAChD,OAAA,EAAS;AAAA,GACV,CAAA;AAED,EAAA,OAAO,MAAM;AACX,IAAA,MAAA,CAAO,mBAAA,CAAoB,UAAU,aAAa,CAAA;AAClD,IAAA,MAAA,CAAO,mBAAA,CAAoB,WAAW,aAAa,CAAA;AAAA,EACrD,CAAA;AACF;AAEA,SAAS,WAAA,GAAuB;AAC9B,EAAA,OAAO,SAAA,CAAU,MAAA;AACnB;AAGA,SAAS,iBAAA,GAA6B;AACpC,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,SAAA,GAAqB;AACnC,EAAA,OAAO,oBAAA,CAAqB,SAAA,EAAW,WAAA,EAAa,iBAAiB,CAAA;AACvE","file":"use-online.js","sourcesContent":["import { useSyncExternalStore } from 'use-sync-external-store/shim';\n\nfunction subscribe(onStoreChange: VoidFunction): VoidFunction {\n window.addEventListener('online', onStoreChange, {\n passive: true,\n });\n window.addEventListener('offline', onStoreChange, {\n passive: true,\n });\n\n return () => {\n window.removeEventListener('online', onStoreChange);\n window.removeEventListener('offline', onStoreChange);\n };\n}\n\nfunction getSnapshot(): boolean {\n return navigator.onLine;\n}\n\n/* istanbul ignore next -- @preserve */\nfunction getServerSnapshot(): boolean {\n return true;\n}\n\nexport function useOnline(): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"]}
1
+ {"version":3,"file":"use-online.js","sources":["../src/use-online.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nfunction subscribe(onStoreChange: VoidFunction): VoidFunction {\n window.addEventListener('online', onStoreChange, {\n passive: true,\n });\n window.addEventListener('offline', onStoreChange, {\n passive: true,\n });\n\n return () => {\n window.removeEventListener('online', onStoreChange);\n window.removeEventListener('offline', onStoreChange);\n };\n}\n\nfunction getSnapshot(): boolean {\n return navigator.onLine;\n}\n\nexport function useOnline(defaultOnline = true): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, () => defaultOnline);\n}\n"],"names":["subscribe","onStoreChange","window","addEventListener","passive","removeEventListener","getSnapshot","navigator","onLine","useOnline","t0","$","_c","defaultOnline","undefined","t1","useSyncExternalStore"],"mappings":"8EAEA,SAASA,UAAUC,eACjBC,OAAOC,iBAAiB,SAAUF,cAAe,CAC/CG,QAAS,OAEXF,OAAOC,iBAAiB,UAAWF,cAAe,CAChDG,QAAS,OAGX,MAAO,KACLF,OAAOG,oBAAoB,SAAUJ,eACrCC,OAAOG,oBAAoB,UAAWJ,eAE1C,CAEA,SAASK,cACP,OAAOC,UAAUC,MACnB,CAEO,SAAAC,UAAAC,IAAA,MAAAC,EAAAC,EAAA,GAAmB,MAAAC,cAAAH,KAAAI,UAAA,KAAAJ,GAAoB,IAAAK,GAAA,GAAAJ,OAAAE,cAAA,CACQE,GAAAA,IAAMF,cAAaF,KAAAE,cAAAF,KAAAI,EAAA,KAAA,CAAAA,GAAAJ,EAAA,EAAA,CAAA,OAAhEK,qBAAqBhB,UAAWM,YAAaS,GAAoB"}
@@ -1,16 +1,2 @@
1
- 'use strict';
2
-
3
- var react = require('react');
4
-
5
- // src/use-rerender.ts
6
- var initialState = {};
7
- function reducer() {
8
- return {};
9
- }
10
- function useRerender() {
11
- return react.useReducer(reducer, initialState)[1];
12
- }
13
-
14
- exports.useRerender = useRerender;
1
+ "use strict";var react=require("react");const initialState={};function reducer(){return{}}function useRerender(){return react.useReducer(reducer,initialState)[1]}exports.useRerender=useRerender;
15
2
  //# sourceMappingURL=use-rerender.cjs.map
16
- //# sourceMappingURL=use-rerender.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-rerender.ts"],"names":["useReducer"],"mappings":";;;;;AAGA,IAAM,eAAe,EAAC;AAEtB,SAAS,OAAA,GAAU;AACjB,EAAA,OAAO,EAAC;AACV;AAEO,SAAS,WAAA,GAAqC;AACnD,EAAA,OAAOA,gBAAA,CAAW,OAAA,EAAS,YAAY,CAAA,CAAE,CAAC,CAAA;AAC5C","file":"use-rerender.cjs","sourcesContent":["import type { DispatchWithoutAction } from 'react';\nimport { useReducer } from 'react';\n\nconst initialState = {};\n\nfunction reducer() {\n return {};\n}\n\nexport function useRerender(): DispatchWithoutAction {\n return useReducer(reducer, initialState)[1];\n}\n"]}
1
+ {"version":3,"file":"use-rerender.cjs","sources":["../src/use-rerender.ts"],"sourcesContent":["import type { DispatchWithoutAction } from 'react';\nimport { useReducer } from 'react';\n\nconst initialState = {};\n\nfunction reducer() {\n return {};\n}\n\nexport function useRerender(): DispatchWithoutAction {\n return useReducer(reducer, initialState)[1];\n}\n"],"names":["initialState","reducer","useRerender","useReducer"],"mappings":"wCAGA,MAAMA,aAAe,CAAA,EAErB,SAASC,UACP,MAAO,CAAA,CACT,CAEO,SAAAC,cAAA,OACEC,iBAAWF,QAASD,cAAa,EAAG"}
@@ -1,14 +1,2 @@
1
- import { useReducer } from 'react';
2
-
3
- // src/use-rerender.ts
4
- var initialState = {};
5
- function reducer() {
6
- return {};
7
- }
8
- function useRerender() {
9
- return useReducer(reducer, initialState)[1];
10
- }
11
-
12
- export { useRerender };
1
+ import{useReducer}from"react";const initialState={};function reducer(){return{}}function useRerender(){return useReducer(reducer,initialState)[1]}export{useRerender};
13
2
  //# sourceMappingURL=use-rerender.js.map
14
- //# sourceMappingURL=use-rerender.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-rerender.ts"],"names":[],"mappings":";;;AAGA,IAAM,eAAe,EAAC;AAEtB,SAAS,OAAA,GAAU;AACjB,EAAA,OAAO,EAAC;AACV;AAEO,SAAS,WAAA,GAAqC;AACnD,EAAA,OAAO,UAAA,CAAW,OAAA,EAAS,YAAY,CAAA,CAAE,CAAC,CAAA;AAC5C","file":"use-rerender.js","sourcesContent":["import type { DispatchWithoutAction } from 'react';\nimport { useReducer } from 'react';\n\nconst initialState = {};\n\nfunction reducer() {\n return {};\n}\n\nexport function useRerender(): DispatchWithoutAction {\n return useReducer(reducer, initialState)[1];\n}\n"]}
1
+ {"version":3,"file":"use-rerender.js","sources":["../src/use-rerender.ts"],"sourcesContent":["import type { DispatchWithoutAction } from 'react';\nimport { useReducer } from 'react';\n\nconst initialState = {};\n\nfunction reducer() {\n return {};\n}\n\nexport function useRerender(): DispatchWithoutAction {\n return useReducer(reducer, initialState)[1];\n}\n"],"names":["initialState","reducer","useRerender","useReducer"],"mappings":"8BAGA,MAAMA,aAAe,CAAA,EAErB,SAASC,UACP,MAAO,CAAA,CACT,CAEO,SAAAC,cAAA,OACEC,WAAWF,QAASD,cAAa,EAAG"}
@@ -1,27 +1,2 @@
1
- 'use strict';
2
-
3
- var shim = require('use-sync-external-store/shim');
4
-
5
- // src/use-visibility-state.ts
6
- function subscribe(onStoreChange) {
7
- document.addEventListener("visibilitychange", onStoreChange, {
8
- passive: true
9
- });
10
- return () => {
11
- document.removeEventListener("visibilitychange", onStoreChange);
12
- };
13
- }
14
- function getSnapshot() {
15
- return document.visibilityState;
16
- }
17
- function getServerSnapshot() {
18
- return "visible";
19
- }
20
- function useVisibilityState() {
21
- return shim.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
22
- }
23
- /* istanbul ignore next -- @preserve */
24
-
25
- exports.useVisibilityState = useVisibilityState;
1
+ "use strict";var reactCompilerRuntime=require("react-compiler-runtime");var react=require("react");function subscribe(onStoreChange){document.addEventListener("visibilitychange",onStoreChange,{passive:true});return()=>{document.removeEventListener("visibilitychange",onStoreChange)}}function getSnapshot(){return document.visibilityState}function useVisibilityState(t0){const $=reactCompilerRuntime.c(2);const defaultVisibilityState=t0===undefined?"visible":t0;let t1;if($[0]!==defaultVisibilityState){t1=()=>defaultVisibilityState;$[0]=defaultVisibilityState;$[1]=t1}else{t1=$[1]}return react.useSyncExternalStore(subscribe,getSnapshot,t1)}exports.useVisibilityState=useVisibilityState;
26
2
  //# sourceMappingURL=use-visibility-state.cjs.map
27
- //# sourceMappingURL=use-visibility-state.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-visibility-state.ts"],"names":["useSyncExternalStore"],"mappings":";;;;;AAEA,SAAS,UAAU,aAAA,EAA2C;AAC5D,EAAA,QAAA,CAAS,gBAAA,CAAiB,oBAAoB,aAAA,EAAe;AAAA,IAC3D,OAAA,EAAS;AAAA,GACV,CAAA;AAED,EAAA,OAAO,MAAM;AACX,IAAA,QAAA,CAAS,mBAAA,CAAoB,oBAAoB,aAAa,CAAA;AAAA,EAChE,CAAA;AACF;AAEA,SAAS,WAAA,GAAuC;AAC9C,EAAA,OAAO,QAAA,CAAS,eAAA;AAClB;AAGA,SAAS,iBAAA,GAA6C;AACpD,EAAA,OAAO,SAAA;AACT;AAEO,SAAS,kBAAA,GAA8C;AAC5D,EAAA,OAAOA,yBAAA,CAAqB,SAAA,EAAW,WAAA,EAAa,iBAAiB,CAAA;AACvE","file":"use-visibility-state.cjs","sourcesContent":["import { useSyncExternalStore } from 'use-sync-external-store/shim';\n\nfunction subscribe(onStoreChange: VoidFunction): VoidFunction {\n document.addEventListener('visibilitychange', onStoreChange, {\n passive: true,\n });\n\n return () => {\n document.removeEventListener('visibilitychange', onStoreChange);\n };\n}\n\nfunction getSnapshot(): DocumentVisibilityState {\n return document.visibilityState;\n}\n\n/* istanbul ignore next -- @preserve */\nfunction getServerSnapshot(): DocumentVisibilityState {\n return 'visible';\n}\n\nexport function useVisibilityState(): DocumentVisibilityState {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"]}
1
+ {"version":3,"file":"use-visibility-state.cjs","sources":["../src/use-visibility-state.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nfunction subscribe(onStoreChange: VoidFunction): VoidFunction {\n document.addEventListener('visibilitychange', onStoreChange, {\n passive: true,\n });\n\n return () => {\n document.removeEventListener('visibilitychange', onStoreChange);\n };\n}\n\nfunction getSnapshot(): DocumentVisibilityState {\n return document.visibilityState;\n}\n\nexport function useVisibilityState(\n defaultVisibilityState: DocumentVisibilityState = 'visible',\n): DocumentVisibilityState {\n return useSyncExternalStore(subscribe, getSnapshot, () => defaultVisibilityState);\n}\n"],"names":["subscribe","onStoreChange","document","addEventListener","passive","removeEventListener","getSnapshot","visibilityState","useVisibilityState","t0","$","_c","defaultVisibilityState","undefined","t1","useSyncExternalStore"],"mappings":"mGAEA,SAASA,UAAUC,eACjBC,SAASC,iBAAiB,mBAAoBF,cAAe,CAC3DG,QAAS,OAGX,MAAO,KACLF,SAASG,oBAAoB,mBAAoBJ,eAErD,CAEA,SAASK,cACP,OAAOJ,SAASK,eAClB,CAEO,SAAAC,mBAAAC,IAAA,MAAAC,EAAAC,qBAAAA,EAAA,GACL,MAAAC,uBAAAH,KAAAI,UAAA,UAAAJ,GAA2D,IAAAK,GAAA,GAAAJ,OAAAE,uBAAA,CAEPE,GAAAA,IAAMF,uBAAsBF,KAAAE,uBAAAF,KAAAI,EAAA,KAAA,CAAAA,GAAAJ,EAAA,EAAA,CAAA,OAAzEK,2BAAqBf,UAAWM,YAAaQ,GAA6B"}
@@ -1,3 +1,3 @@
1
- declare function useVisibilityState(): DocumentVisibilityState;
1
+ declare function useVisibilityState(defaultVisibilityState?: DocumentVisibilityState): DocumentVisibilityState;
2
2
 
3
3
  export { useVisibilityState };
@@ -1,3 +1,3 @@
1
- declare function useVisibilityState(): DocumentVisibilityState;
1
+ declare function useVisibilityState(defaultVisibilityState?: DocumentVisibilityState): DocumentVisibilityState;
2
2
 
3
3
  export { useVisibilityState };
@@ -1,25 +1,2 @@
1
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
2
-
3
- // src/use-visibility-state.ts
4
- function subscribe(onStoreChange) {
5
- document.addEventListener("visibilitychange", onStoreChange, {
6
- passive: true
7
- });
8
- return () => {
9
- document.removeEventListener("visibilitychange", onStoreChange);
10
- };
11
- }
12
- function getSnapshot() {
13
- return document.visibilityState;
14
- }
15
- function getServerSnapshot() {
16
- return "visible";
17
- }
18
- function useVisibilityState() {
19
- return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
20
- }
21
- /* istanbul ignore next -- @preserve */
22
-
23
- export { useVisibilityState };
1
+ import{c}from"react-compiler-runtime";import{useSyncExternalStore}from"react";function subscribe(onStoreChange){document.addEventListener("visibilitychange",onStoreChange,{passive:true});return()=>{document.removeEventListener("visibilitychange",onStoreChange)}}function getSnapshot(){return document.visibilityState}function useVisibilityState(t0){const $=c(2);const defaultVisibilityState=t0===undefined?"visible":t0;let t1;if($[0]!==defaultVisibilityState){t1=()=>defaultVisibilityState;$[0]=defaultVisibilityState;$[1]=t1}else{t1=$[1]}return useSyncExternalStore(subscribe,getSnapshot,t1)}export{useVisibilityState};
24
2
  //# sourceMappingURL=use-visibility-state.js.map
25
- //# sourceMappingURL=use-visibility-state.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-visibility-state.ts"],"names":[],"mappings":";;;AAEA,SAAS,UAAU,aAAA,EAA2C;AAC5D,EAAA,QAAA,CAAS,gBAAA,CAAiB,oBAAoB,aAAA,EAAe;AAAA,IAC3D,OAAA,EAAS;AAAA,GACV,CAAA;AAED,EAAA,OAAO,MAAM;AACX,IAAA,QAAA,CAAS,mBAAA,CAAoB,oBAAoB,aAAa,CAAA;AAAA,EAChE,CAAA;AACF;AAEA,SAAS,WAAA,GAAuC;AAC9C,EAAA,OAAO,QAAA,CAAS,eAAA;AAClB;AAGA,SAAS,iBAAA,GAA6C;AACpD,EAAA,OAAO,SAAA;AACT;AAEO,SAAS,kBAAA,GAA8C;AAC5D,EAAA,OAAO,oBAAA,CAAqB,SAAA,EAAW,WAAA,EAAa,iBAAiB,CAAA;AACvE","file":"use-visibility-state.js","sourcesContent":["import { useSyncExternalStore } from 'use-sync-external-store/shim';\n\nfunction subscribe(onStoreChange: VoidFunction): VoidFunction {\n document.addEventListener('visibilitychange', onStoreChange, {\n passive: true,\n });\n\n return () => {\n document.removeEventListener('visibilitychange', onStoreChange);\n };\n}\n\nfunction getSnapshot(): DocumentVisibilityState {\n return document.visibilityState;\n}\n\n/* istanbul ignore next -- @preserve */\nfunction getServerSnapshot(): DocumentVisibilityState {\n return 'visible';\n}\n\nexport function useVisibilityState(): DocumentVisibilityState {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"]}
1
+ {"version":3,"file":"use-visibility-state.js","sources":["../src/use-visibility-state.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nfunction subscribe(onStoreChange: VoidFunction): VoidFunction {\n document.addEventListener('visibilitychange', onStoreChange, {\n passive: true,\n });\n\n return () => {\n document.removeEventListener('visibilitychange', onStoreChange);\n };\n}\n\nfunction getSnapshot(): DocumentVisibilityState {\n return document.visibilityState;\n}\n\nexport function useVisibilityState(\n defaultVisibilityState: DocumentVisibilityState = 'visible',\n): DocumentVisibilityState {\n return useSyncExternalStore(subscribe, getSnapshot, () => defaultVisibilityState);\n}\n"],"names":["subscribe","onStoreChange","document","addEventListener","passive","removeEventListener","getSnapshot","visibilityState","useVisibilityState","t0","$","_c","defaultVisibilityState","undefined","t1","useSyncExternalStore"],"mappings":"8EAEA,SAASA,UAAUC,eACjBC,SAASC,iBAAiB,mBAAoBF,cAAe,CAC3DG,QAAS,OAGX,MAAO,KACLF,SAASG,oBAAoB,mBAAoBJ,eAErD,CAEA,SAASK,cACP,OAAOJ,SAASK,eAClB,CAEO,SAAAC,mBAAAC,IAAA,MAAAC,EAAAC,EAAA,GACL,MAAAC,uBAAAH,KAAAI,UAAA,UAAAJ,GAA2D,IAAAK,GAAA,GAAAJ,OAAAE,uBAAA,CAEPE,GAAAA,IAAMF,uBAAsBF,KAAAE,uBAAAF,KAAAI,EAAA,KAAA,CAAAA,GAAAJ,EAAA,EAAA,CAAA,OAAzEK,qBAAqBf,UAAWM,YAAaQ,GAA6B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mado/hooks",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -18,6 +18,31 @@
18
18
  },
19
19
  "./package.json": "./package.json"
20
20
  },
21
+ "sideEffects": false,
22
+ "type": "module",
23
+ "peerDependencies": {
24
+ "react": "^18.0.0 || ^19.0.0"
25
+ },
26
+ "dependencies": {
27
+ "@babel/runtime": "^7.28.4",
28
+ "react-compiler-runtime": "^1.0.0",
29
+ "@mado/utils": "^0.4.0"
30
+ },
31
+ "devDependencies": {
32
+ "@babel/core": "^7.28.5",
33
+ "@babel/plugin-transform-runtime": "^7.28.5",
34
+ "@babel/preset-env": "^7.28.5",
35
+ "@babel/preset-react": "^7.28.5",
36
+ "@babel/preset-typescript": "^7.28.5",
37
+ "@rollup/plugin-babel": "^6.1.0",
38
+ "@rollup/plugin-node-resolve": "^16.0.3",
39
+ "@rollup/plugin-terser": "^0.4.4",
40
+ "babel-plugin-react-compiler": "^1.0.0",
41
+ "react": "^19.2.0",
42
+ "react-dom": "^19.2.0",
43
+ "rollup": "^4.53.2",
44
+ "rollup-plugin-dts": "^6.2.3"
45
+ },
21
46
  "author": {
22
47
  "email": "doinki94@gmail.com",
23
48
  "name": "doinki",
@@ -40,22 +65,11 @@
40
65
  "type": "git",
41
66
  "url": "git+https://github.com/doinki/mado.git"
42
67
  },
43
- "sideEffects": false,
44
- "type": "module",
45
- "peerDependencies": {
46
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
47
- },
48
- "dependencies": {
49
- "use-sync-external-store": "^1.6.0",
50
- "@mado/utils": "^0.4.0"
51
- },
52
- "devDependencies": {
53
- "@types/use-sync-external-store": "^1.5.0",
54
- "react": "^19.2.0",
55
- "react-dom": "^19.2.0"
68
+ "publishConfig": {
69
+ "access": "public"
56
70
  },
57
71
  "scripts": {
58
- "build": "tsup",
72
+ "build": "rimraf dist && rollup -c",
59
73
  "test": "vitest run",
60
74
  "test:coverage": "vitest run --coverage",
61
75
  "lint": "eslint",
package/src/use-event.ts CHANGED
@@ -9,5 +9,6 @@ export function useEvent<T extends unknown[], U>(fn: (...args: T) => U): (...arg
9
9
  ref.current = fn;
10
10
  });
11
11
 
12
+ // eslint-disable-next-line react-hooks/refs
12
13
  return useRef((...args: T) => (0, ref.current)(...args)).current;
13
14
  }
@@ -1,11 +1,15 @@
1
- import { useEffect, useState } from 'react';
1
+ import { useSyncExternalStore } from 'react';
2
2
 
3
- export function useIsMounted(): boolean {
4
- const [isMounted, setIsMounted] = useState(false);
3
+ const subscribe = () => () => {};
5
4
 
6
- useEffect(() => {
7
- setIsMounted(true);
8
- }, []);
5
+ function getSnapshot(): boolean {
6
+ return true;
7
+ }
9
8
 
10
- return isMounted;
9
+ function getServerSnapshot(): boolean {
10
+ return false;
11
+ }
12
+
13
+ export function useIsMounted(): boolean {
14
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
11
15
  }
@@ -1,5 +1,4 @@
1
- import { useMemo } from 'react';
2
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
1
+ import { useMemo, useSyncExternalStore } from 'react';
3
2
 
4
3
  export function useMediaQuery(query: string, defaultMatches = false): boolean {
5
4
  const [subscribe, getSnapshot, getServerSnapshot] = useMemo(() => {
@@ -23,9 +22,7 @@ export function useMediaQuery(query: string, defaultMatches = false): boolean {
23
22
  mediaQueryList.removeListener(onStoreChange);
24
23
  };
25
24
  },
26
- () => {
27
- return mediaQueryList.matches;
28
- },
25
+ () => mediaQueryList.matches,
29
26
  getDefaultSnapshot,
30
27
  ];
31
28
  }, [defaultMatches, query]);
package/src/use-online.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
1
+ import { useSyncExternalStore } from 'react';
2
2
 
3
3
  function subscribe(onStoreChange: VoidFunction): VoidFunction {
4
4
  window.addEventListener('online', onStoreChange, {
@@ -18,11 +18,6 @@ function getSnapshot(): boolean {
18
18
  return navigator.onLine;
19
19
  }
20
20
 
21
- /* istanbul ignore next -- @preserve */
22
- function getServerSnapshot(): boolean {
23
- return true;
24
- }
25
-
26
- export function useOnline(): boolean {
27
- return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
21
+ export function useOnline(defaultOnline = true): boolean {
22
+ return useSyncExternalStore(subscribe, getSnapshot, () => defaultOnline);
28
23
  }
@@ -1,4 +1,4 @@
1
- import { useSyncExternalStore } from 'use-sync-external-store/shim';
1
+ import { useSyncExternalStore } from 'react';
2
2
 
3
3
  function subscribe(onStoreChange: VoidFunction): VoidFunction {
4
4
  document.addEventListener('visibilitychange', onStoreChange, {
@@ -14,11 +14,8 @@ function getSnapshot(): DocumentVisibilityState {
14
14
  return document.visibilityState;
15
15
  }
16
16
 
17
- /* istanbul ignore next -- @preserve */
18
- function getServerSnapshot(): DocumentVisibilityState {
19
- return 'visible';
20
- }
21
-
22
- export function useVisibilityState(): DocumentVisibilityState {
23
- return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
17
+ export function useVisibilityState(
18
+ defaultVisibilityState: DocumentVisibilityState = 'visible',
19
+ ): DocumentVisibilityState {
20
+ return useSyncExternalStore(subscribe, getSnapshot, () => defaultVisibilityState);
24
21
  }