{"_id":"@allem-sdk/hooks","_rev":"4-73eecb66d7d7887c3aa01633b5fda443","name":"@allem-sdk/hooks","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@allem-sdk/hooks","version":"0.1.0","keywords":["allem-sdk","react","hooks","useDebounce","useMediaQuery","useLocalStorage"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/hooks@0.1.0","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"d539a8fd3b41eb547400e9eb23ba6ac34636ade7","tarball":"https://registry.npmjs.org/@allem-sdk/hooks/-/hooks-0.1.0.tgz","fileCount":8,"integrity":"sha512-nSfNIoTtdy4gNwaA/isi3rfUN8J2TUjLx/RpjcnTC/3Ey8iAh+ATB+NugL6FJTEmegBIEH3+XPw3/EM/z4t7UQ==","signatures":[{"sig":"MEUCIALsIrNi4L+1ej4IXq/Ku+vrZ8K2nGpj2TPBq+BK83tTAiEAzN4gy7L6mPrFz5p+vzmpBPBtb/5o77m8TW7Sb0yA9KU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24004},"main":"./dist/index.js","_from":"file:allem-sdk-hooks-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/ace966a4da2f2dadb53d0c604225802b/allem-sdk-hooks-0.1.0.tgz","_integrity":"sha512-nSfNIoTtdy4gNwaA/isi3rfUN8J2TUjLx/RpjcnTC/3Ey8iAh+ATB+NugL6FJTEmegBIEH3+XPw3/EM/z4t7UQ==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/hooks"},"_npmVersion":"11.12.1","description":"A collection of essential React hooks for modern applications","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^3.0.0","react-dom":"^19.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@testing-library/react":"^16.0.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hooks_0.1.0_1779452653707_0.6474833365536017","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@allem-sdk/hooks","version":"0.1.1","keywords":["allem-sdk","react","hooks","useDebounce","useMediaQuery","useLocalStorage"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/hooks@0.1.1","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"0cea01cabd5fecbaf20d0176355c05aa2e331faf","tarball":"https://registry.npmjs.org/@allem-sdk/hooks/-/hooks-0.1.1.tgz","fileCount":8,"integrity":"sha512-7VhhBpicFqD3Fkjg5WG+00yPTkfjcg1IZ36fVY3Wop06PB+nlt1r117Aalqoa8Lo9IhiLTgNkpyQYVWpSYjgKw==","signatures":[{"sig":"MEYCIQCNc35eHq3C/M+RKy42TXninMlY/hFkz9kl/Mgq+g347gIhAPcHuhErKg4gh3mx5qe3h8TW4Xn0kkR5E4cOrtjOJ+Nk","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24002},"main":"./dist/index.js","_from":"file:allem-sdk-hooks-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/10a54d08d7c03629400d2c59fd19bff5/allem-sdk-hooks-0.1.1.tgz","_integrity":"sha512-7VhhBpicFqD3Fkjg5WG+00yPTkfjcg1IZ36fVY3Wop06PB+nlt1r117Aalqoa8Lo9IhiLTgNkpyQYVWpSYjgKw==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/hooks"},"_npmVersion":"11.12.1","description":"A collection of essential React hooks for modern applications","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^3.0.0","react-dom":"^19.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@testing-library/react":"^16.0.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hooks_0.1.1_1779454891018_0.4371839646597304","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@allem-sdk/hooks","version":"0.1.2","keywords":["allem-sdk","react","react-hooks","useDebounce","useLocalStorage","useMediaQuery","useClickOutside","useToggle","useCopyToClipboard","useIntersectionObserver","useWindowSize","ssr","typescript","nextjs"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/hooks@0.1.2","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"b86ab6eb475d138b14a74d232d4eebe1dae5f81e","tarball":"https://registry.npmjs.org/@allem-sdk/hooks/-/hooks-0.1.2.tgz","fileCount":8,"integrity":"sha512-AlOYTby28YKNek134LETl7QJleSwOIaN61FmFAq0TKxp75eLvSTIkYPsbQZXzrfE01BEHOLcZroktcmywJAlAA==","signatures":[{"sig":"MEYCIQDySghpDZN3Em4GCNb1zGlKc9i8l8GM25JyhvswVA/FYAIhANSUvh3XEp+Qe8GwAOAZp+DQ+x0Npq5dG60MBiM8Fkl+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24439},"main":"./dist/index.js","_from":"file:allem-sdk-hooks-0.1.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/f5f282224ec6e2c26ca06affa0fa0330/allem-sdk-hooks-0.1.2.tgz","_integrity":"sha512-AlOYTby28YKNek134LETl7QJleSwOIaN61FmFAq0TKxp75eLvSTIkYPsbQZXzrfE01BEHOLcZroktcmywJAlAA==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/hooks"},"_npmVersion":"11.12.1","description":"8 essential React hooks: useDebounce, useLocalStorage, useMediaQuery, useClickOutside, useToggle, useCopyToClipboard, useIntersectionObserver, useWindowSize. SSR-safe, TypeScript strict.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.4.0","jsdom":"^25.0.0","react":"^19.0.0","vitest":"^3.0.0","react-dom":"^19.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@testing-library/react":"^16.0.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hooks_0.1.2_1779499472296_0.7692853363445833","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@allem-sdk/hooks","version":"0.1.3","description":"8 essential React hooks: useDebounce, useLocalStorage, useMediaQuery, useClickOutside, useToggle, useCopyToClipboard, useIntersectionObserver, useWindowSize. SSR-safe, TypeScript strict.","license":"MIT","author":{"name":"Ahmed Allem"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"sideEffects":false,"devDependencies":{"@testing-library/react":"^16.0.0","@types/react":"^19.0.0","jsdom":"^25.0.0","react":"^19.0.0","react-dom":"^19.0.0","tsup":"^8.4.0","typescript":"^5.8.0","vitest":"^3.0.0"},"peerDependencies":{"react":">=18.0.0"},"repository":{"type":"git","url":"git+https://github.com/kingofmit/allem-sdk.git","directory":"packages/hooks"},"keywords":["allem-sdk","react","react-hooks","useDebounce","useLocalStorage","useMediaQuery","useClickOutside","useToggle","useCopyToClipboard","useIntersectionObserver","useWindowSize","ssr","typescript","nextjs"],"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","clean":"rm -rf dist","test":"vitest run","test:watch":"vitest"},"_id":"@allem-sdk/hooks@0.1.3","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"homepage":"https://github.com/kingofmit/allem-sdk#readme","_integrity":"sha512-rSvNJhBjZgCWBOvrjPV+wGgA6jHQCJeR/ws+Rf6VABq1WsTtjVg8NV67ZpVrahIg4zcVZzevONwoadoyAYY9Rg==","_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/b2cffd53723b3106cc3216e3afb16cc8/allem-sdk-hooks-0.1.3.tgz","_from":"file:allem-sdk-hooks-0.1.3.tgz","_nodeVersion":"26.0.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-rSvNJhBjZgCWBOvrjPV+wGgA6jHQCJeR/ws+Rf6VABq1WsTtjVg8NV67ZpVrahIg4zcVZzevONwoadoyAYY9Rg==","shasum":"5d928f72b9b623ea96829fd7481e192914b821e4","tarball":"https://registry.npmjs.org/@allem-sdk/hooks/-/hooks-0.1.3.tgz","fileCount":8,"unpackedSize":39293,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCspVJ9x1gPI2APwRBzS4N9Izc1lY7UwbtMQFQ0zQbSewIhAKUrROVeV2dWvQa057OEz+7fT1azcbBata9Xa+cy3WfN"}]},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"directories":{},"maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hooks_0.1.3_1779571359665_0.016691105563904074"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T12:24:13.585Z","modified":"2026-05-23T21:22:39.961Z","0.1.0":"2026-05-22T12:24:13.856Z","0.1.1":"2026-05-22T13:01:31.172Z","0.1.2":"2026-05-23T01:24:32.441Z","0.1.3":"2026-05-23T21:22:39.812Z"},"bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"author":{"name":"Ahmed Allem"},"license":"MIT","homepage":"https://github.com/kingofmit/allem-sdk#readme","keywords":["allem-sdk","react","react-hooks","useDebounce","useLocalStorage","useMediaQuery","useClickOutside","useToggle","useCopyToClipboard","useIntersectionObserver","useWindowSize","ssr","typescript","nextjs"],"repository":{"type":"git","url":"git+https://github.com/kingofmit/allem-sdk.git","directory":"packages/hooks"},"description":"8 essential React hooks: useDebounce, useLocalStorage, useMediaQuery, useClickOutside, useToggle, useCopyToClipboard, useIntersectionObserver, useWindowSize. SSR-safe, TypeScript strict.","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"readme":"<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/kingofmit/allem-sdk/main/.github/AllemSDK.png\" alt=\"Allem SDK\" />\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@allem-sdk/hooks\"><img src=\"https://img.shields.io/npm/v/@allem-sdk/hooks.svg\" alt=\"npm version\" /></a>\n  <a href=\"https://github.com/kingofmit/allem-sdk/blob/main/LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\" /></a>\n  <img src=\"https://img.shields.io/badge/react-19-61dafb\" alt=\"React 19\" />\n  <img src=\"https://img.shields.io/badge/typescript-strict-blue\" alt=\"TypeScript\" />\n  <img src=\"https://img.shields.io/badge/SSR-safe-brightgreen\" alt=\"SSR Safe\" />\n</p>\n\n# @allem-sdk/hooks\n\nEssential React hooks for modern applications. SSR-safe, zero dependencies, works with Next.js, Vite, and Remix.\n\n## Installation\n\n```bash\nnpm install @allem-sdk/hooks\n```\n\n## Hooks\n\n| Hook | Description |\n|------|-------------|\n| `useDebounce` | Debounce a value by a given delay |\n| `useThrottle` | Throttle a value, updating at most once per delay |\n| `useLocalStorage` | Persist state in localStorage with SSR safety |\n| `useMediaQuery` | Reactive CSS media query matching |\n| `useClickOutside` | Detect clicks outside a ref element |\n| `useToggle` | Boolean toggle state |\n| `useCopyToClipboard` | Copy text to clipboard with status |\n| `useIntersectionObserver` | Observe element visibility via IntersectionObserver |\n| `useWindowSize` | Reactive window dimensions |\n| `useFetch` | Data fetching with loading/error states and refetch |\n| `usePrevious` | Track the previous value of a variable |\n| `useKeyPress` | Detect if a specific key is pressed |\n| `useOnlineStatus` | Reactive browser online/offline status |\n\n## Usage\n\n```tsx\nimport { useDebounce, useLocalStorage, useMediaQuery } from \"@allem-sdk/hooks\";\n\nfunction Search() {\n  const [query, setQuery] = useLocalStorage(\"search\", \"\");\n  const debouncedQuery = useDebounce(query, 300);\n  const isMobile = useMediaQuery(\"(max-width: 768px)\");\n\n  return <input value={query} onChange={(e) => setQuery(e.target.value)} />;\n}\n```\n\n```tsx\nimport { useClickOutside, useToggle } from \"@allem-sdk/hooks\";\n\nfunction Dropdown() {\n  const [isOpen, toggle] = useToggle(false);\n  const ref = useClickOutside<HTMLDivElement>(() => toggle(false));\n\n  return (\n    <div ref={ref}>\n      <button onClick={() => toggle()}>Menu</button>\n      {isOpen && <ul>...</ul>}\n    </div>\n  );\n}\n```\n\n## More Examples\n\n```tsx\nimport { useFetch, useThrottle, useKeyPress, useOnlineStatus, usePrevious } from \"@allem-sdk/hooks\";\n\nfunction UserList() {\n  const { data, error, isLoading, refetch } = useFetch<User[]>(\"/api/users\");\n  const isOnline = useOnlineStatus();\n  const isEscPressed = useKeyPress(\"Escape\");\n\n  if (!isOnline) return <p>You are offline</p>;\n  if (isLoading) return <p>Loading...</p>;\n  return <ul>{data?.map((u) => <li key={u.id}>{u.name}</li>)}</ul>;\n}\n\nfunction ScrollTracker() {\n  const [scroll, setScroll] = useState(0);\n  const throttledScroll = useThrottle(scroll, 100);\n  const prevScroll = usePrevious(throttledScroll);\n  const direction = prevScroll !== undefined && throttledScroll > prevScroll ? \"down\" : \"up\";\n\n  useEffect(() => {\n    const handler = () => setScroll(window.scrollY);\n    window.addEventListener(\"scroll\", handler);\n    return () => window.removeEventListener(\"scroll\", handler);\n  }, []);\n\n  return <p>Scrolling {direction}</p>;\n}\n```\n\n## Part of [Allem SDK](https://github.com/kingofmit/allem-sdk)\n\nThis package can be used standalone or as part of the full SDK. Install `allem-sdk` to get all packages in one install.\n\n## Support\n\nIf you find Allem SDK useful, consider supporting its development:\n\n<a href=\"https://buymeacoffee.com/kingofmit\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"50\" /></a>\n\n## License\n\n[MIT](https://github.com/kingofmit/allem-sdk/blob/main/LICENSE) - [Ahmed Allem](https://kingallem.com)\n","readmeFilename":"README.md"}