@oneplatformdev/hooks 0.0.1-beta.6 → 0.1.0-11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2 -2
- package/index.js +74 -0
- package/package.json +35 -16
- package/index.d.ts +0 -35
- package/index.mjs +0 -72
- package/useBoolean/index.d.ts +0 -1
- package/useBoolean/index.mjs +0 -4
- package/useBoolean/package.json +0 -7
- package/useBoolean/useBoolean.d.ts +0 -29
- package/useBoolean/useBoolean.mjs +0 -16
- package/useClickAnyWhere/index.d.ts +0 -1
- package/useClickAnyWhere/index.mjs +0 -4
- package/useClickAnyWhere/package.json +0 -7
- package/useClickAnyWhere/useClickAnyWhere.d.ts +0 -16
- package/useClickAnyWhere/useClickAnyWhere.mjs +0 -9
- package/useCopyToClipboard/index.d.ts +0 -1
- package/useCopyToClipboard/index.mjs +0 -4
- package/useCopyToClipboard/package.json +0 -7
- package/useCopyToClipboard/useCopyToClipboard.d.ts +0 -33
- package/useCopyToClipboard/useCopyToClipboard.mjs +0 -16
- package/useCountdown/index.d.ts +0 -1
- package/useCountdown/index.mjs +0 -4
- package/useCountdown/package.json +0 -7
- package/useCountdown/useCountdown.d.ts +0 -46
- package/useCountdown/useCountdown.mjs +0 -33
- package/useCounter/index.d.ts +0 -1
- package/useCounter/index.mjs +0 -4
- package/useCounter/package.json +0 -7
- package/useCounter/useCounter.d.ts +0 -28
- package/useCounter/useCounter.mjs +0 -20
- package/useDarkMode/index.d.ts +0 -1
- package/useDarkMode/index.mjs +0 -4
- package/useDarkMode/package.json +0 -7
- package/useDarkMode/useDarkMode.d.ts +0 -45
- package/useDarkMode/useDarkMode.mjs +0 -38
- package/useDebounceCallback/index.d.ts +0 -2
- package/useDebounceCallback/index.mjs +0 -5
- package/useDebounceCallback/package.json +0 -7
- package/useDebounceCallback/useDebounceCallback.d.ts +0 -61
- package/useDebounceCallback/useDebounceCallback.mjs +0 -101
- package/useDebounceValue/index.d.ts +0 -1
- package/useDebounceValue/index.mjs +0 -4
- package/useDebounceValue/package.json +0 -7
- package/useDebounceValue/useDebounceValue.d.ts +0 -40
- package/useDebounceValue/useDebounceValue.mjs +0 -13
- package/useDocumentTitle/index.d.ts +0 -1
- package/useDocumentTitle/index.mjs +0 -4
- package/useDocumentTitle/package.json +0 -7
- package/useDocumentTitle/useDocumentTitle.d.ts +0 -18
- package/useDocumentTitle/useDocumentTitle.mjs +0 -16
- package/useEventCallback/index.d.ts +0 -1
- package/useEventCallback/index.mjs +0 -4
- package/useEventCallback/package.json +0 -7
- package/useEventCallback/useEventCallback.d.ts +0 -17
- package/useEventCallback/useEventCallback.mjs +0 -16
- package/useEventListener/index.d.ts +0 -1
- package/useEventListener/index.mjs +0 -4
- package/useEventListener/package.json +0 -7
- package/useEventListener/useEventListener.d.ts +0 -7
- package/useEventListener/useEventListener.mjs +0 -20
- package/useHover/index.d.ts +0 -1
- package/useHover/index.mjs +0 -4
- package/useHover/package.json +0 -7
- package/useHover/useHover.d.ts +0 -17
- package/useHover/useHover.mjs +0 -13
- package/useIntersectionObserver/index.d.ts +0 -1
- package/useIntersectionObserver/index.mjs +0 -4
- package/useIntersectionObserver/package.json +0 -7
- package/useIntersectionObserver/useIntersectionObserver.d.ts +0 -71
- package/useIntersectionObserver/useIntersectionObserver.mjs +0 -55
- package/useInterval/index.d.ts +0 -1
- package/useInterval/index.mjs +0 -4
- package/useInterval/package.json +0 -7
- package/useInterval/useInterval.d.ts +0 -15
- package/useInterval/useInterval.mjs +0 -20
- package/useIsClient/index.d.ts +0 -1
- package/useIsClient/index.mjs +0 -4
- package/useIsClient/package.json +0 -7
- package/useIsClient/useIsClient.d.ts +0 -12
- package/useIsClient/useIsClient.mjs +0 -10
- package/useIsMobile/index.d.ts +0 -2
- package/useIsMobile/index.mjs +0 -4
- package/useIsMobile/package.json +0 -7
- package/useIsMobile/types.d.ts +0 -3
- package/useIsMobile/types.mjs +0 -1
- package/useIsMobile/useIsMobile.d.ts +0 -3
- package/useIsMobile/useIsMobile.mjs +0 -16
- package/useIsMounted/index.d.ts +0 -1
- package/useIsMounted/index.mjs +0 -4
- package/useIsMounted/package.json +0 -7
- package/useIsMounted/useIsMounted.d.ts +0 -1
- package/useIsMounted/useIsMounted.mjs +0 -10
- package/useIsomorphicLayoutEffect/index.d.ts +0 -1
- package/useIsomorphicLayoutEffect/index.mjs +0 -4
- package/useIsomorphicLayoutEffect/package.json +0 -7
- package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +0 -16
- package/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +0 -5
- package/useLocalStorage/index.d.ts +0 -1
- package/useLocalStorage/index.mjs +0 -4
- package/useLocalStorage/package.json +0 -7
- package/useLocalStorage/useLocalStorage.d.ts +0 -39
- package/useLocalStorage/useLocalStorage.mjs +0 -65
- package/useLockBody/index.d.ts +0 -1
- package/useLockBody/index.mjs +0 -4
- package/useLockBody/package.json +0 -7
- package/useLockBody/useLockBody.d.ts +0 -1
- package/useLockBody/useLockBody.mjs +0 -12
- package/useMap/index.d.ts +0 -1
- package/useMap/index.mjs +0 -4
- package/useMap/package.json +0 -7
- package/useMap/useMap.d.ts +0 -47
- package/useMap/useMap.mjs +0 -27
- package/useMediaQuery/index.d.ts +0 -1
- package/useMediaQuery/index.mjs +0 -4
- package/useMediaQuery/package.json +0 -7
- package/useMediaQuery/useMediaQuery.d.ts +0 -28
- package/useMediaQuery/useMediaQuery.mjs +0 -21
- package/useOnClickOutside/index.d.ts +0 -1
- package/useOnClickOutside/index.mjs +0 -4
- package/useOnClickOutside/package.json +0 -7
- package/useOnClickOutside/useOnClickOutside.d.ts +0 -24
- package/useOnClickOutside/useOnClickOutside.mjs +0 -17
- package/useReadLocalStorage/index.d.ts +0 -1
- package/useReadLocalStorage/index.mjs +0 -4
- package/useReadLocalStorage/package.json +0 -7
- package/useReadLocalStorage/useReadLocalStorage.d.ts +0 -13
- package/useReadLocalStorage/useReadLocalStorage.mjs +0 -48
- package/useResizeObserver/index.d.ts +0 -1
- package/useResizeObserver/index.mjs +0 -4
- package/useResizeObserver/package.json +0 -7
- package/useResizeObserver/useResizeObserver.d.ts +0 -44
- package/useResizeObserver/useResizeObserver.mjs +0 -31
- package/useScreen/index.d.ts +0 -1
- package/useScreen/index.mjs +0 -4
- package/useScreen/package.json +0 -7
- package/useScreen/useScreen.d.ts +0 -19
- package/useScreen/useScreen.mjs +0 -48
- package/useScript/index.d.ts +0 -1
- package/useScript/index.mjs +0 -4
- package/useScript/package.json +0 -7
- package/useScript/useScript.d.ts +0 -23
- package/useScript/useScript.mjs +0 -45
- package/useScrollLock/index.d.ts +0 -1
- package/useScrollLock/index.mjs +0 -4
- package/useScrollLock/package.json +0 -7
- package/useScrollLock/useScrollLock.d.ts +0 -53
- package/useScrollLock/useScrollLock.mjs +0 -26
- package/useSessionStorage/index.d.ts +0 -1
- package/useSessionStorage/index.mjs +0 -4
- package/useSessionStorage/package.json +0 -7
- package/useSessionStorage/useSessionStorage.d.ts +0 -39
- package/useSessionStorage/useSessionStorage.mjs +0 -65
- package/useStep/index.d.ts +0 -1
- package/useStep/index.mjs +0 -4
- package/useStep/package.json +0 -7
- package/useStep/useStep.d.ts +0 -31
- package/useStep/useStep.mjs +0 -34
- package/useTernaryDarkMode/index.d.ts +0 -1
- package/useTernaryDarkMode/index.mjs +0 -4
- package/useTernaryDarkMode/package.json +0 -7
- package/useTernaryDarkMode/useTernaryDarkMode.d.ts +0 -46
- package/useTernaryDarkMode/useTernaryDarkMode.mjs +0 -27
- package/useTimeout/index.d.ts +0 -1
- package/useTimeout/index.mjs +0 -4
- package/useTimeout/package.json +0 -7
- package/useTimeout/useTimeout.d.ts +0 -16
- package/useTimeout/useTimeout.mjs +0 -20
- package/useToggle/index.d.ts +0 -1
- package/useToggle/index.mjs +0 -4
- package/useToggle/package.json +0 -7
- package/useToggle/useToggle.d.ts +0 -18
- package/useToggle/useToggle.mjs +0 -10
- package/useUnmount/index.d.ts +0 -1
- package/useUnmount/index.mjs +0 -4
- package/useUnmount/package.json +0 -7
- package/useUnmount/useUnmount.d.ts +0 -13
- package/useUnmount/useUnmount.mjs +0 -13
- package/useWindowSize/index.d.ts +0 -1
- package/useWindowSize/index.mjs +0 -4
- package/useWindowSize/package.json +0 -7
- package/useWindowSize/useWindowSize.d.ts +0 -29
- package/useWindowSize/useWindowSize.mjs +0 -31
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Oleh Maksimenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# hooks
|
|
1
|
+
# @oneplatformdev/hooks
|
|
2
2
|
|
|
3
3
|
This library was generated with [Nx](https://nx.dev).
|
|
4
4
|
|
|
5
5
|
## Running unit tests
|
|
6
6
|
|
|
7
|
-
Run `nx test hooks` to execute the unit tests via [Vitest](https://vitest.dev/).
|
|
7
|
+
Run `nx test @oneplatformdev/hooks` to execute the unit tests via [Vitest](https://vitest.dev/).
|
package/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useBoolean as r } from "./useBoolean/useBoolean.js";
|
|
2
|
+
import { useClickAnyWhere as u } from "./useClickAnyWhere/useClickAnyWhere.js";
|
|
3
|
+
import { useCopyToClipboard as p } from "./useCopyToClipboard/useCopyToClipboard.js";
|
|
4
|
+
import { useCountdown as f } from "./useCountdown/useCountdown.js";
|
|
5
|
+
import { useCounter as n } from "./useCounter/useCounter.js";
|
|
6
|
+
import { useDarkMode as i } from "./useDarkMode/useDarkMode.js";
|
|
7
|
+
import { useDebounceCallback as c } from "./useDebounceCallback/useDebounceCallback.js";
|
|
8
|
+
import { useDebounceValue as S } from "./useDebounceValue/useDebounceValue.js";
|
|
9
|
+
import { useDocumentTitle as b } from "./useDocumentTitle/useDocumentTitle.js";
|
|
10
|
+
import { useEventCallback as y } from "./useEventCallback/useEventCallback.js";
|
|
11
|
+
import { useEventListener as v } from "./useEventListener/useEventListener.js";
|
|
12
|
+
import { useHover as L } from "./useHover/useHover.js";
|
|
13
|
+
import { useIntersectionObserver as D } from "./useIntersectionObserver/useIntersectionObserver.js";
|
|
14
|
+
import { useInterval as O } from "./useInterval/useInterval.js";
|
|
15
|
+
import { useIsClient as h } from "./useIsClient/useIsClient.js";
|
|
16
|
+
import { useIsMobile as z } from "./useIsMobile/useIsMobile.js";
|
|
17
|
+
import { useIsMounted as Q } from "./useIsMounted/useIsMounted.js";
|
|
18
|
+
import { useIsomorphicLayoutEffect as W } from "./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";
|
|
19
|
+
import { useLocalStorage as H } from "./useLocalStorage/useLocalStorage.js";
|
|
20
|
+
import { useLockBody as V } from "./useLockBody/useLockBody.js";
|
|
21
|
+
import { useMap as q } from "./useMap/useMap.js";
|
|
22
|
+
import { useMediaQuery as G } from "./useMediaQuery/useMediaQuery.js";
|
|
23
|
+
import { useOnClickOutside as K } from "./useOnClickOutside/useOnClickOutside.js";
|
|
24
|
+
import { useReadLocalStorage as P } from "./useReadLocalStorage/useReadLocalStorage.js";
|
|
25
|
+
import { useResizeObserver as Y } from "./useResizeObserver/useResizeObserver.js";
|
|
26
|
+
import { useScreen as _ } from "./useScreen/useScreen.js";
|
|
27
|
+
import { useScript as ee } from "./useScript/useScript.js";
|
|
28
|
+
import { useScrollLock as re } from "./useScrollLock/useScrollLock.js";
|
|
29
|
+
import { useSessionStorage as ue } from "./useSessionStorage/useSessionStorage.js";
|
|
30
|
+
import { useStep as pe } from "./useStep/useStep.js";
|
|
31
|
+
import { useTernaryDarkMode as fe } from "./useTernaryDarkMode/useTernaryDarkMode.js";
|
|
32
|
+
import { useTimeout as ne } from "./useTimeout/useTimeout.js";
|
|
33
|
+
import { useToggle as ie } from "./useToggle/useToggle.js";
|
|
34
|
+
import { useUnmount as ce } from "./useUnmount/useUnmount.js";
|
|
35
|
+
import { useWindowSize as Se } from "./useWindowSize/useWindowSize.js";
|
|
36
|
+
import { useQueryString as be } from "./useQueryString/useQueryString.js";
|
|
37
|
+
export {
|
|
38
|
+
r as useBoolean,
|
|
39
|
+
u as useClickAnyWhere,
|
|
40
|
+
p as useCopyToClipboard,
|
|
41
|
+
f as useCountdown,
|
|
42
|
+
n as useCounter,
|
|
43
|
+
i as useDarkMode,
|
|
44
|
+
c as useDebounceCallback,
|
|
45
|
+
S as useDebounceValue,
|
|
46
|
+
b as useDocumentTitle,
|
|
47
|
+
y as useEventCallback,
|
|
48
|
+
v as useEventListener,
|
|
49
|
+
L as useHover,
|
|
50
|
+
D as useIntersectionObserver,
|
|
51
|
+
O as useInterval,
|
|
52
|
+
h as useIsClient,
|
|
53
|
+
z as useIsMobile,
|
|
54
|
+
Q as useIsMounted,
|
|
55
|
+
W as useIsomorphicLayoutEffect,
|
|
56
|
+
H as useLocalStorage,
|
|
57
|
+
V as useLockBody,
|
|
58
|
+
q as useMap,
|
|
59
|
+
G as useMediaQuery,
|
|
60
|
+
K as useOnClickOutside,
|
|
61
|
+
be as useQueryString,
|
|
62
|
+
P as useReadLocalStorage,
|
|
63
|
+
Y as useResizeObserver,
|
|
64
|
+
_ as useScreen,
|
|
65
|
+
ee as useScript,
|
|
66
|
+
re as useScrollLock,
|
|
67
|
+
ue as useSessionStorage,
|
|
68
|
+
pe as useStep,
|
|
69
|
+
fe as useTernaryDarkMode,
|
|
70
|
+
ne as useTimeout,
|
|
71
|
+
ie as useToggle,
|
|
72
|
+
ce as useUnmount,
|
|
73
|
+
Se as useWindowSize
|
|
74
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneplatformdev/hooks",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-11",
|
|
4
4
|
"description": "React hook library",
|
|
5
5
|
"author": "One Platform Development Team",
|
|
6
6
|
"keywords": [
|
|
@@ -18,21 +18,43 @@
|
|
|
18
18
|
"url": "https://github.com/oneplatformdev/core/issues"
|
|
19
19
|
},
|
|
20
20
|
"homepage": "private package",
|
|
21
|
+
"private": false,
|
|
22
|
+
"license": "MIT",
|
|
21
23
|
"type": "module",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"module": "./index.mjs",
|
|
25
|
-
"default": "./index.mjs",
|
|
24
|
+
"main": "./index.js",
|
|
25
|
+
"module": "./index.js",
|
|
26
26
|
"types": "./index.d.ts",
|
|
27
|
-
"
|
|
27
|
+
"exports": {
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
".": {
|
|
30
|
+
"@oneplatformdev/source": "./src/index.ts",
|
|
31
|
+
"types": "./index.d.ts",
|
|
32
|
+
"import": "./index.js",
|
|
33
|
+
"default": "./index.js"
|
|
34
|
+
},
|
|
35
|
+
"./*": {
|
|
36
|
+
"types": "./*.d.ts",
|
|
37
|
+
"import": "./*.js",
|
|
38
|
+
"default": "./*.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
28
41
|
"publishConfig": {
|
|
29
|
-
"directory": "
|
|
30
|
-
|
|
42
|
+
"directory": "dist"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"README.md",
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"package.json",
|
|
49
|
+
"!**/*.tsbuildinfo"
|
|
50
|
+
],
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"lodash.debounce": "^4.0.8"
|
|
31
53
|
},
|
|
32
|
-
"
|
|
33
|
-
"react": "
|
|
34
|
-
"react-dom": "
|
|
35
|
-
"@types/react": "
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": ">=18",
|
|
56
|
+
"react-dom": ">=18",
|
|
57
|
+
"@types/react": ">=18",
|
|
36
58
|
"@types/lodash.debounce": "^4.0.9"
|
|
37
59
|
},
|
|
38
60
|
"peerDependenciesMeta": {
|
|
@@ -45,8 +67,5 @@
|
|
|
45
67
|
"@types/lodash.debounce": {
|
|
46
68
|
"optional": true
|
|
47
69
|
}
|
|
48
|
-
},
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"lodash.debounce": "^4.0.8"
|
|
51
70
|
}
|
|
52
|
-
}
|
|
71
|
+
}
|
package/index.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export * from './useBoolean';
|
|
2
|
-
export * from './useClickAnyWhere';
|
|
3
|
-
export * from './useCopyToClipboard';
|
|
4
|
-
export * from './useCountdown';
|
|
5
|
-
export * from './useCounter';
|
|
6
|
-
export * from './useDarkMode';
|
|
7
|
-
export * from './useDebounceCallback';
|
|
8
|
-
export * from './useDebounceValue';
|
|
9
|
-
export * from './useDocumentTitle';
|
|
10
|
-
export * from './useEventCallback';
|
|
11
|
-
export * from './useEventListener';
|
|
12
|
-
export * from './useHover';
|
|
13
|
-
export * from './useIntersectionObserver';
|
|
14
|
-
export * from './useInterval';
|
|
15
|
-
export * from './useIsClient';
|
|
16
|
-
export * from './useIsMobile';
|
|
17
|
-
export * from './useIsMounted';
|
|
18
|
-
export * from './useIsomorphicLayoutEffect';
|
|
19
|
-
export * from './useLocalStorage';
|
|
20
|
-
export * from './useLockBody';
|
|
21
|
-
export * from './useMap';
|
|
22
|
-
export * from './useMediaQuery';
|
|
23
|
-
export * from './useOnClickOutside';
|
|
24
|
-
export * from './useReadLocalStorage';
|
|
25
|
-
export * from './useResizeObserver';
|
|
26
|
-
export * from './useScreen';
|
|
27
|
-
export * from './useScript';
|
|
28
|
-
export * from './useScrollLock';
|
|
29
|
-
export * from './useSessionStorage';
|
|
30
|
-
export * from './useStep';
|
|
31
|
-
export * from './useTernaryDarkMode';
|
|
32
|
-
export * from './useTimeout';
|
|
33
|
-
export * from './useToggle';
|
|
34
|
-
export * from './useUnmount';
|
|
35
|
-
export * from './useWindowSize';
|
package/index.mjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { useBoolean as r } from "./useBoolean/useBoolean.mjs";
|
|
2
|
-
import { useClickAnyWhere as s } from "./useClickAnyWhere/useClickAnyWhere.mjs";
|
|
3
|
-
import { useCopyToClipboard as p } from "./useCopyToClipboard/useCopyToClipboard.mjs";
|
|
4
|
-
import { useCountdown as f } from "./useCountdown/useCountdown.mjs";
|
|
5
|
-
import { useCounter as n } from "./useCounter/useCounter.mjs";
|
|
6
|
-
import { useDarkMode as l } from "./useDarkMode/useDarkMode.mjs";
|
|
7
|
-
import { useDebounceCallback as i } from "./useDebounceCallback/useDebounceCallback.mjs";
|
|
8
|
-
import { useDebounceValue as C } from "./useDebounceValue/useDebounceValue.mjs";
|
|
9
|
-
import { useDocumentTitle as b } from "./useDocumentTitle/useDocumentTitle.mjs";
|
|
10
|
-
import { useEventCallback as v } from "./useEventCallback/useEventCallback.mjs";
|
|
11
|
-
import { useEventListener as I } from "./useEventListener/useEventListener.mjs";
|
|
12
|
-
import { useHover as M } from "./useHover/useHover.mjs";
|
|
13
|
-
import { useIntersectionObserver as D } from "./useIntersectionObserver/useIntersectionObserver.mjs";
|
|
14
|
-
import { useInterval as O } from "./useInterval/useInterval.mjs";
|
|
15
|
-
import { useIsClient as h } from "./useIsClient/useIsClient.mjs";
|
|
16
|
-
import { useIsMobile as z } from "./useIsMobile/useIsMobile.mjs";
|
|
17
|
-
import { useIsMounted as R } from "./useIsMounted/useIsMounted.mjs";
|
|
18
|
-
import { useIsomorphicLayoutEffect as A } from "./useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
|
|
19
|
-
import { useLocalStorage as Q } from "./useLocalStorage/useLocalStorage.mjs";
|
|
20
|
-
import { useLockBody as V } from "./useLockBody/useLockBody.mjs";
|
|
21
|
-
import { useMap as q } from "./useMap/useMap.mjs";
|
|
22
|
-
import { useMediaQuery as G } from "./useMediaQuery/useMediaQuery.mjs";
|
|
23
|
-
import { useOnClickOutside as K } from "./useOnClickOutside/useOnClickOutside.mjs";
|
|
24
|
-
import { useReadLocalStorage as P } from "./useReadLocalStorage/useReadLocalStorage.mjs";
|
|
25
|
-
import { useResizeObserver as Y } from "./useResizeObserver/useResizeObserver.mjs";
|
|
26
|
-
import { useScreen as _ } from "./useScreen/useScreen.mjs";
|
|
27
|
-
import { useScript as ee } from "./useScript/useScript.mjs";
|
|
28
|
-
import { useScrollLock as re } from "./useScrollLock/useScrollLock.mjs";
|
|
29
|
-
import { useSessionStorage as se } from "./useSessionStorage/useSessionStorage.mjs";
|
|
30
|
-
import { useStep as pe } from "./useStep/useStep.mjs";
|
|
31
|
-
import { useTernaryDarkMode as fe } from "./useTernaryDarkMode/useTernaryDarkMode.mjs";
|
|
32
|
-
import { useTimeout as ne } from "./useTimeout/useTimeout.mjs";
|
|
33
|
-
import { useToggle as le } from "./useToggle/useToggle.mjs";
|
|
34
|
-
import { useUnmount as ie } from "./useUnmount/useUnmount.mjs";
|
|
35
|
-
import { useWindowSize as Ce } from "./useWindowSize/useWindowSize.mjs";
|
|
36
|
-
export {
|
|
37
|
-
r as useBoolean,
|
|
38
|
-
s as useClickAnyWhere,
|
|
39
|
-
p as useCopyToClipboard,
|
|
40
|
-
f as useCountdown,
|
|
41
|
-
n as useCounter,
|
|
42
|
-
l as useDarkMode,
|
|
43
|
-
i as useDebounceCallback,
|
|
44
|
-
C as useDebounceValue,
|
|
45
|
-
b as useDocumentTitle,
|
|
46
|
-
v as useEventCallback,
|
|
47
|
-
I as useEventListener,
|
|
48
|
-
M as useHover,
|
|
49
|
-
D as useIntersectionObserver,
|
|
50
|
-
O as useInterval,
|
|
51
|
-
h as useIsClient,
|
|
52
|
-
z as useIsMobile,
|
|
53
|
-
R as useIsMounted,
|
|
54
|
-
A as useIsomorphicLayoutEffect,
|
|
55
|
-
Q as useLocalStorage,
|
|
56
|
-
V as useLockBody,
|
|
57
|
-
q as useMap,
|
|
58
|
-
G as useMediaQuery,
|
|
59
|
-
K as useOnClickOutside,
|
|
60
|
-
P as useReadLocalStorage,
|
|
61
|
-
Y as useResizeObserver,
|
|
62
|
-
_ as useScreen,
|
|
63
|
-
ee as useScript,
|
|
64
|
-
re as useScrollLock,
|
|
65
|
-
se as useSessionStorage,
|
|
66
|
-
pe as useStep,
|
|
67
|
-
fe as useTernaryDarkMode,
|
|
68
|
-
ne as useTimeout,
|
|
69
|
-
le as useToggle,
|
|
70
|
-
ie as useUnmount,
|
|
71
|
-
Ce as useWindowSize
|
|
72
|
-
};
|
package/useBoolean/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useBoolean';
|
package/useBoolean/index.mjs
DELETED
package/useBoolean/package.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
|
|
3
|
-
/** The useBoolean return type. */
|
|
4
|
-
type UseBooleanReturn = {
|
|
5
|
-
/** The current boolean state value. */
|
|
6
|
-
value: boolean;
|
|
7
|
-
/** Function to set the boolean state directly. */
|
|
8
|
-
setValue: Dispatch<SetStateAction<boolean>>;
|
|
9
|
-
/** Function to set the boolean state to `true`. */
|
|
10
|
-
setTrue: () => void;
|
|
11
|
-
/** Function to set the boolean state to `false`. */
|
|
12
|
-
setFalse: () => void;
|
|
13
|
-
/** Function to toggle the boolean state. */
|
|
14
|
-
toggle: () => void;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Custom hook that handles boolean state with useful utility functions.
|
|
18
|
-
* @param {boolean} [defaultValue] - The initial value for the boolean state (default is `false`).
|
|
19
|
-
* @returns {UseBooleanReturn} An object containing the boolean state value and utility functions to manipulate the state.
|
|
20
|
-
* @throws Will throw an error if `defaultValue` is an invalid boolean value.
|
|
21
|
-
* @public
|
|
22
|
-
* @see [Documentation](https://usehooks-ts.com/react-hook/use-boolean)
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* const { value, setTrue, setFalse, toggle } = useBoolean(true);
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare function useBoolean(defaultValue?: boolean): UseBooleanReturn;
|
|
29
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useState as n, useCallback as t } from "react";
|
|
2
|
-
function c(o = !1) {
|
|
3
|
-
if (typeof o != "boolean")
|
|
4
|
-
throw new Error("defaultValue must be `true` or `false`");
|
|
5
|
-
const [s, e] = n(o), r = t(() => {
|
|
6
|
-
e(!0);
|
|
7
|
-
}, []), a = t(() => {
|
|
8
|
-
e(!1);
|
|
9
|
-
}, []), l = t(() => {
|
|
10
|
-
e((u) => !u);
|
|
11
|
-
}, []);
|
|
12
|
-
return { value: s, setValue: e, setTrue: r, setFalse: a, toggle: l };
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
c as useBoolean
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useClickAnyWhere';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom hook that handles click events anywhere on the document.
|
|
3
|
-
* @param {Function} handler - The function to be called when a click event is detected anywhere on the document.
|
|
4
|
-
* @public
|
|
5
|
-
* @see [Documentation](https://usehooks-ts.com/react-hook/use-click-any-where)
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* const handleClick = (event) => {
|
|
9
|
-
* console.log('Document clicked!', event);
|
|
10
|
-
* };
|
|
11
|
-
*
|
|
12
|
-
* // Attach click event handler to document
|
|
13
|
-
* useClickAnywhere(handleClick);
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare function useClickAnyWhere(handler: (event: MouseEvent) => void): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useCopyToClipboard';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The copied text as `string` or `null` if nothing has been copied yet.
|
|
3
|
-
*/
|
|
4
|
-
type CopiedValue = string | null;
|
|
5
|
-
/**
|
|
6
|
-
* Function to copy text to the clipboard.
|
|
7
|
-
* @param text - The text to copy to the clipboard.
|
|
8
|
-
* @returns {Promise<boolean>} A promise that resolves to `true` if the text was copied successfully, or `false` otherwise.
|
|
9
|
-
*/
|
|
10
|
-
type CopyFn = (text: string) => Promise<boolean>;
|
|
11
|
-
/**
|
|
12
|
-
* Custom hook that copies text to the clipboard using the [`Clipboard API`](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API).
|
|
13
|
-
* @returns {[CopiedValue, CopyFn]} An tuple containing the copied text and a function to copy text to the clipboard.
|
|
14
|
-
* @public
|
|
15
|
-
* @see [Documentation](https://usehooks-ts.com/react-hook/use-copy-to-clipboard)
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* const [copiedText, copyToClipboard] = useCopyToClipboard();
|
|
19
|
-
* const textToCopy = 'Hello, world!';
|
|
20
|
-
*
|
|
21
|
-
* // Attempt to copy text to the clipboard
|
|
22
|
-
* copyToClipboard(textToCopy)
|
|
23
|
-
* .then(success => {
|
|
24
|
-
* if (success) {
|
|
25
|
-
* console.log(`Text "${textToCopy}" copied to clipboard successfully.`);
|
|
26
|
-
* } else {
|
|
27
|
-
* console.error('Failed to copy text to clipboard.');
|
|
28
|
-
* }
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function useCopyToClipboard(): [CopiedValue, CopyFn];
|
|
33
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useState as n, useCallback as l } from "react";
|
|
2
|
-
function c() {
|
|
3
|
-
const [e, r] = n(null), t = l(async (o) => {
|
|
4
|
-
if (!(navigator != null && navigator.clipboard))
|
|
5
|
-
return console.warn("Clipboard not supported"), !1;
|
|
6
|
-
try {
|
|
7
|
-
return await navigator.clipboard.writeText(o), r(o), !0;
|
|
8
|
-
} catch (a) {
|
|
9
|
-
return console.warn("Copy failed", a), r(null), !1;
|
|
10
|
-
}
|
|
11
|
-
}, []);
|
|
12
|
-
return [e, t];
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
c as useCopyToClipboard
|
|
16
|
-
};
|
package/useCountdown/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useCountdown';
|
package/useCountdown/index.mjs
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/** The countdown's options. */
|
|
2
|
-
type CountdownOptions = {
|
|
3
|
-
/** The countdown's starting number, initial value of the returned number. */
|
|
4
|
-
countStart: number;
|
|
5
|
-
/**
|
|
6
|
-
* The countdown's interval, in milliseconds.
|
|
7
|
-
* @default 1000
|
|
8
|
-
*/
|
|
9
|
-
intervalMs?: number;
|
|
10
|
-
/**
|
|
11
|
-
* True if the countdown is increment.
|
|
12
|
-
* @default false
|
|
13
|
-
*/
|
|
14
|
-
isIncrement?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* The countdown's stopping number. Pass `-Infinity` to decrease forever.
|
|
17
|
-
* @default 0
|
|
18
|
-
*/
|
|
19
|
-
countStop?: number;
|
|
20
|
-
};
|
|
21
|
-
/** The countdown's controllers. */
|
|
22
|
-
type CountdownControllers = {
|
|
23
|
-
/** Start the countdown. */
|
|
24
|
-
startCountdown: () => void;
|
|
25
|
-
/** Stop the countdown. */
|
|
26
|
-
stopCountdown: () => void;
|
|
27
|
-
/** Reset the countdown. */
|
|
28
|
-
resetCountdown: () => void;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Custom hook that manages countdown.
|
|
32
|
-
* @param {CountdownOptions} countdownOptions - The countdown's options.
|
|
33
|
-
* @returns {[number, CountdownControllers]} An array containing the countdown's count and its controllers.
|
|
34
|
-
* @public
|
|
35
|
-
* @see [Documentation](https://usehooks-ts.com/react-hook/use-countdown)
|
|
36
|
-
* @example
|
|
37
|
-
* ```tsx
|
|
38
|
-
* const [counter, { start, stop, reset }] = useCountdown({
|
|
39
|
-
* countStart: 10,
|
|
40
|
-
* intervalMs: 1000,
|
|
41
|
-
* isIncrement: false,
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare function useCountdown({ countStart, countStop, intervalMs, isIncrement, }: CountdownOptions): [number, CountdownControllers];
|
|
46
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useCallback as l } from "react";
|
|
2
|
-
import { useBoolean as d } from "../useBoolean/useBoolean.mjs";
|
|
3
|
-
import { useCounter as w } from "../useCounter/useCounter.mjs";
|
|
4
|
-
import { useInterval as p } from "../useInterval/useInterval.mjs";
|
|
5
|
-
function x({
|
|
6
|
-
countStart: a,
|
|
7
|
-
countStop: n = 0,
|
|
8
|
-
intervalMs: c = 1e3,
|
|
9
|
-
isIncrement: t = !1
|
|
10
|
-
}) {
|
|
11
|
-
const {
|
|
12
|
-
count: o,
|
|
13
|
-
increment: r,
|
|
14
|
-
decrement: s,
|
|
15
|
-
reset: u
|
|
16
|
-
} = w(a), {
|
|
17
|
-
value: f,
|
|
18
|
-
setTrue: i,
|
|
19
|
-
setFalse: e
|
|
20
|
-
} = d(!1), m = l(() => {
|
|
21
|
-
e(), u();
|
|
22
|
-
}, [e, u]), C = l(() => {
|
|
23
|
-
if (o === n) {
|
|
24
|
-
e();
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
t ? r() : s();
|
|
28
|
-
}, [o, n, s, r, t, e]);
|
|
29
|
-
return p(C, f ? c : null), [o, { startCountdown: i, stopCountdown: e, resetCountdown: m }];
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
x as useCountdown
|
|
33
|
-
};
|
package/useCounter/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useCounter';
|
package/useCounter/index.mjs
DELETED
package/useCounter/package.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
|
|
3
|
-
/** The hook return type. */
|
|
4
|
-
type UseCounterReturn = {
|
|
5
|
-
/** The current count value. */
|
|
6
|
-
count: number;
|
|
7
|
-
/** Function to increment the counter by 1. */
|
|
8
|
-
increment: () => void;
|
|
9
|
-
/** Function to decrement the counter by 1. */
|
|
10
|
-
decrement: () => void;
|
|
11
|
-
/** Function to reset the counter to its initial value. */
|
|
12
|
-
reset: () => void;
|
|
13
|
-
/** Function to set a specific value to the counter. */
|
|
14
|
-
setCount: Dispatch<SetStateAction<number>>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Custom hook that manages a counter with increment, decrement, reset, and setCount functionalities.
|
|
18
|
-
* @param {number} [initialValue] - The initial value for the counter.
|
|
19
|
-
* @returns {UseCounterReturn} An object containing the current count and functions to interact with the counter.
|
|
20
|
-
* @public
|
|
21
|
-
* @see [Documentation](https://usehooks-ts.com/react-hook/use-counter)
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* const { count, increment, decrement, reset, setCount } = useCounter(5);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function useCounter(initialValue?: number): UseCounterReturn;
|
|
28
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useState as m, useCallback as o } from "react";
|
|
2
|
-
function f(e) {
|
|
3
|
-
const [c, t] = m(e ?? 0), r = o(() => {
|
|
4
|
-
t((n) => n + 1);
|
|
5
|
-
}, []), s = o(() => {
|
|
6
|
-
t((n) => n - 1);
|
|
7
|
-
}, []), u = o(() => {
|
|
8
|
-
t(e ?? 0);
|
|
9
|
-
}, [e]);
|
|
10
|
-
return {
|
|
11
|
-
count: c,
|
|
12
|
-
increment: r,
|
|
13
|
-
decrement: s,
|
|
14
|
-
reset: u,
|
|
15
|
-
setCount: t
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
f as useCounter
|
|
20
|
-
};
|
package/useDarkMode/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useDarkMode';
|
package/useDarkMode/index.mjs
DELETED