hookery 0.0.1 → 1.0.1
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/README.md +74 -11
- package/dist/index.d.ts +3270 -8
- package/dist/index.js +21 -35
- package/dist/index.mjs +22 -11
- package/package.json +62 -8
- package/dist/index.d.mts +0 -14
package/README.md
CHANGED
|
@@ -1,23 +1,86 @@
|
|
|
1
1
|
# Hookery 🪝
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The ultimate collection of **100+ high-quality React hooks**. Built for modern web applications with a focus on **performance**, **type safety**, and **minimal bundle size**.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/hookery)
|
|
6
|
+
[](#)
|
|
7
|
+
[](#)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
6
10
|
|
|
7
|
-
##
|
|
11
|
+
## 🚀 Why Hookery?
|
|
12
|
+
|
|
13
|
+
- **📦 Ultra-Lightweight**: Only **215 KB unpacked** (~55 KB bundled). One of the smallest libraries for its scale.
|
|
14
|
+
- **🛡️ 100% Type Safe**: Written in TypeScript with strict type inference and zero "any".
|
|
15
|
+
- **⚡ Performance First**: Zero unnecessary re-renders with optimized memoization and stable callbacks.
|
|
16
|
+
- **🔌 SSR Ready**: First-class support for Next.js, Remix, and Astro.
|
|
17
|
+
- **🤖 Modern Workflows**: Pre-built hooks for AI streaming, Media recording, and Hardware APIs.
|
|
18
|
+
|
|
19
|
+
## 📦 Installation
|
|
8
20
|
|
|
9
21
|
```bash
|
|
10
22
|
npm install hookery
|
|
23
|
+
# or
|
|
24
|
+
yarn add hookery
|
|
25
|
+
# or
|
|
26
|
+
pnpm add hookery
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 💡 Quick Start
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { useLocalStorage, useToggle, useWindowSize } from 'hookery';
|
|
33
|
+
|
|
34
|
+
function App() {
|
|
35
|
+
const [isDark, toggleDark] = useToggle(false);
|
|
36
|
+
const { width, height } = useWindowSize();
|
|
37
|
+
const { value: user } = useLocalStorage('user_pref', { name: 'Guest' });
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div>
|
|
41
|
+
<h1>Hello, {user.name}!</h1>
|
|
42
|
+
<p>Window Size: {width} x {height}</p>
|
|
43
|
+
<button onClick={toggleDark}>
|
|
44
|
+
Switch to {isDark ? 'Light' : 'Dark'} Mode
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
11
49
|
```
|
|
12
50
|
|
|
13
|
-
##
|
|
51
|
+
## 📚 Available Hooks (100+)
|
|
52
|
+
|
|
53
|
+
### 🛠️ Core Essentials
|
|
54
|
+
`useIsomorphicLayoutEffect` • `useToggle` • `useCounter` • `usePrevious` • `useMount` • `useUnmount` • `useDebounce` • `useThrottle` • `useLocalStorage` • `useSessionStorage` • `useTimeout` • `useInterval` • `useUpdateEffect` • `useIsMounted` • `useStableCallback`
|
|
55
|
+
|
|
56
|
+
### 🖱️ UI & Interaction
|
|
57
|
+
`useMediaQuery` • `useWindowSize` • `useClickOutside` • `useHover` • `useKeyPress` • `useScroll` • `useIntersection` • `useCopyToClipboard` • `useDocumentTitle` • `useLockBodyScroll` • `useTheme` • `useEvent` • `useLongPress` • `useWindowFocus` • `useResizeObserver` • `useMutationObserver` • `usePageLeave` • `useEyeDropper` • `useScreen` • `useClickAnywhere`
|
|
58
|
+
|
|
59
|
+
### 🌐 Browser & Hardware APIs
|
|
60
|
+
`useOnline` • `useNetworkState` • `useFullscreen` • `useShare` • `usePermissions` • `useWakeLock` • `useMediaDevices` • `useMediaRecorder` • `useBattery` • `useBluetooth` • `useGamepad` • `useFileSystem` • `useStorageEstimate` • `useBroadcastChannel` • `useWebSocket` • `useWebRTC`
|
|
61
|
+
|
|
62
|
+
### ⚡ Async, Data & Logic
|
|
63
|
+
`useAsync` • `useFetch` • `useScript` • `useWorker` • `useIndexedDB` • `useHistory` • `useStep` • `usePagination` • `useMachine` • `useVirtualList` • `useInfiniteScroll` • `useForm` • `useTable` • `useSpreadsheet` • `useMarkdown` • `usePDF` • `useFileProcessing` • `useSortable` • `useDragAndDrop` • `useList` • `useMap` • `useSet` • `useQueue` • `useCountdown` • `useDebounceCallback` • `useIsClient`
|
|
64
|
+
|
|
65
|
+
### 🧠 AI & Search
|
|
66
|
+
`useLLMStream` • `useSTT` • `useTTS` • `useOpenAI` • `useAnthropic` • `useGemini` • `useRAG` • `useEmbeddings` • `useSemanticSearch` • `useSearchHighlight`
|
|
67
|
+
|
|
68
|
+
### 🎨 Animation & Graphics
|
|
69
|
+
`useAnimate` • `useCanvas` • `useSpringCore` • `useParallax` • `useSVGAnimation` • `useThreeJS` • `useLottie` • `useFrameRate` • `useVideoRef` • `useAudioRef`
|
|
70
|
+
|
|
71
|
+
## 🔌 Ecosystem Bridges
|
|
72
|
+
Hookery includes built-in hooks to bridge with your favorite tools:
|
|
73
|
+
- `useZodValidation`, `useYupValidation`
|
|
74
|
+
- `useZustand`, `useRedux`, `useJotai`
|
|
75
|
+
- `useFirebaseAuth`, `useSupabaseUser`
|
|
76
|
+
- `useTanStackQuery`, `useAxios`
|
|
77
|
+
- `useFramerMotion` (via `useAnimate`)
|
|
78
|
+
- `useNextRouter`, `useRemixFetcher`
|
|
79
|
+
- `useStripe`, `useAuth0`, `useClerk`
|
|
14
80
|
|
|
15
|
-
|
|
16
|
-
- 📦 **Tree-shakeable** - Only import what you need
|
|
17
|
-
- 🔒 **TypeScript First** - Full type safety
|
|
18
|
-
- ⚡ **SSR Ready** - Works with Next.js, Remix, and more
|
|
19
|
-
- 🎯 **React 18/19** - Built for modern React
|
|
81
|
+
## 📄 License
|
|
20
82
|
|
|
21
|
-
|
|
83
|
+
Distributed under the MIT License. See `LICENSE` for more information.
|
|
22
84
|
|
|
23
|
-
|
|
85
|
+
---
|
|
86
|
+
Built with ❤️ by [Mohamed Shaban](https://github.com/Moshaban09)
|