@usefy/usefy 0.0.23 → 0.0.25

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 CHANGED
@@ -111,17 +111,18 @@ All packages require React 18 or 19:
111
111
  | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
112
112
  | <a href="https://www.npmjs.com/package/@usefy/use-toggle" target="_blank" rel="noopener noreferrer">@usefy/use-toggle</a> | Boolean state management with toggle, setTrue, setFalse | <a href="https://www.npmjs.com/package/@usefy/use-toggle" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-toggle.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![100%](https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square) |
113
113
  | <a href="https://www.npmjs.com/package/@usefy/use-counter" target="_blank" rel="noopener noreferrer">@usefy/use-counter</a> | Counter state with increment, decrement, reset | <a href="https://www.npmjs.com/package/@usefy/use-counter" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-counter.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![100%](https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square) |
114
- | <a href="https://www.npmjs.com/package/@usefy/use-debounce" target="_blank" rel="noopener noreferrer">@usefy/use-debounce</a> | Value debouncing with leading/trailing edge | <a href="https://www.npmjs.com/package/@usefy/use-debounce" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-debounce.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![91%](https://img.shields.io/badge/coverage-91%25-brightgreen?style=flat-square) |
115
- | <a href="https://www.npmjs.com/package/@usefy/use-debounce-callback" target="_blank" rel="noopener noreferrer">@usefy/use-debounce-callback</a> | Debounced callbacks with cancel/flush/pending | <a href="https://www.npmjs.com/package/@usefy/use-debounce-callback" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-debounce-callback.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![94%](https://img.shields.io/badge/coverage-94%25-brightgreen?style=flat-square) |
114
+ | <a href="https://www.npmjs.com/package/@usefy/use-debounce" target="_blank" rel="noopener noreferrer">@usefy/use-debounce</a> | Value debouncing with leading/trailing edge | <a href="https://www.npmjs.com/package/@usefy/use-debounce" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-debounce.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![92%](https://img.shields.io/badge/coverage-92%25-brightgreen?style=flat-square) |
115
+ | <a href="https://www.npmjs.com/package/@usefy/use-debounce-callback" target="_blank" rel="noopener noreferrer">@usefy/use-debounce-callback</a> | Debounced callbacks with cancel/flush/pending | <a href="https://www.npmjs.com/package/@usefy/use-debounce-callback" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-debounce-callback.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![93%](https://img.shields.io/badge/coverage-93%25-brightgreen?style=flat-square) |
116
116
  | <a href="https://www.npmjs.com/package/@usefy/use-throttle" target="_blank" rel="noopener noreferrer">@usefy/use-throttle</a> | Value throttling for rate-limiting updates | <a href="https://www.npmjs.com/package/@usefy/use-throttle" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-throttle.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![100%](https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square) |
117
117
  | <a href="https://www.npmjs.com/package/@usefy/use-throttle-callback" target="_blank" rel="noopener noreferrer">@usefy/use-throttle-callback</a> | Throttled callbacks with cancel/flush/pending | <a href="https://www.npmjs.com/package/@usefy/use-throttle-callback" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-throttle-callback.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![100%](https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square) |
118
118
  | <a href="https://www.npmjs.com/package/@usefy/use-local-storage" target="_blank" rel="noopener noreferrer">@usefy/use-local-storage</a> | localStorage persistence with cross-tab sync | <a href="https://www.npmjs.com/package/@usefy/use-local-storage" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-local-storage.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![95%](https://img.shields.io/badge/coverage-95%25-brightgreen?style=flat-square) |
119
- | <a href="https://www.npmjs.com/package/@usefy/use-session-storage" target="_blank" rel="noopener noreferrer">@usefy/use-session-storage</a> | sessionStorage persistence for tab lifetime | <a href="https://www.npmjs.com/package/@usefy/use-session-storage" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-session-storage.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![94%](https://img.shields.io/badge/coverage-94%25-brightgreen?style=flat-square) |
119
+ | <a href="https://www.npmjs.com/package/@usefy/use-session-storage" target="_blank" rel="noopener noreferrer">@usefy/use-session-storage</a> | sessionStorage persistence for tab lifetime | <a href="https://www.npmjs.com/package/@usefy/use-session-storage" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-session-storage.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![95%](https://img.shields.io/badge/coverage-95%25-brightgreen?style=flat-square) |
120
120
  | <a href="https://www.npmjs.com/package/@usefy/use-click-any-where" target="_blank" rel="noopener noreferrer">@usefy/use-click-any-where</a> | Document-wide click event detection | <a href="https://www.npmjs.com/package/@usefy/use-click-any-where" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-click-any-where.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![92%](https://img.shields.io/badge/coverage-92%25-brightgreen?style=flat-square) |
121
121
  | <a href="https://www.npmjs.com/package/@usefy/use-copy-to-clipboard" target="_blank" rel="noopener noreferrer">@usefy/use-copy-to-clipboard</a> | Clipboard copy with fallback support | <a href="https://www.npmjs.com/package/@usefy/use-copy-to-clipboard" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-copy-to-clipboard.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![88%](https://img.shields.io/badge/coverage-88%25-brightgreen?style=flat-square) |
122
122
  | <a href="https://www.npmjs.com/package/@usefy/use-event-listener" target="_blank" rel="noopener noreferrer">@usefy/use-event-listener</a> | DOM event listener with auto cleanup | <a href="https://www.npmjs.com/package/@usefy/use-event-listener" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-event-listener.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![96%](https://img.shields.io/badge/coverage-96%25-brightgreen?style=flat-square) |
123
- | <a href="https://www.npmjs.com/package/@usefy/use-on-click-outside" target="_blank" rel="noopener noreferrer">@usefy/use-on-click-outside</a> | Outside click detection for modals/dropdowns | <a href="https://www.npmjs.com/package/@usefy/use-on-click-outside" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-on-click-outside.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![97%](https://img.shields.io/badge/coverage-97%25-brightgreen?style=flat-square) |
123
+ | <a href="https://www.npmjs.com/package/@usefy/use-on-click-outside" target="_blank" rel="noopener noreferrer">@usefy/use-on-click-outside</a> | Outside click detection for modals/dropdowns | <a href="https://www.npmjs.com/package/@usefy/use-on-click-outside" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-on-click-outside.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![98%](https://img.shields.io/badge/coverage-98%25-brightgreen?style=flat-square) |
124
124
  | <a href="https://www.npmjs.com/package/@usefy/use-unmount" target="_blank" rel="noopener noreferrer">@usefy/use-unmount</a> | Execute callback on component unmount | <a href="https://www.npmjs.com/package/@usefy/use-unmount" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-unmount.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![100%](https://img.shields.io/badge/coverage-100%25-brightgreen?style=flat-square) |
125
+ | <a href="https://www.npmjs.com/package/@usefy/use-init" target="_blank" rel="noopener noreferrer">@usefy/use-init</a> | One-time initialization with async, retry, timeout | <a href="https://www.npmjs.com/package/@usefy/use-init" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-init.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![96%](https://img.shields.io/badge/coverage-96%25-brightgreen?style=flat-square) |
125
126
  | <a href="https://www.npmjs.com/package/@usefy/use-timer" target="_blank" rel="noopener noreferrer">@usefy/use-timer</a> | Countdown timer with drift compensation and formats | <a href="https://www.npmjs.com/package/@usefy/use-timer" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-timer.svg?style=flat-square&color=007acc" alt="npm version" /></a> | ![84%](https://img.shields.io/badge/coverage-84%25-brightgreen?style=flat-square) |
126
127
 
127
128
  ---
@@ -140,6 +141,7 @@ import {
140
141
  useEventListener,
141
142
  useOnClickOutside,
142
143
  useUnmount,
144
+ useInit,
143
145
  } from "@usefy/usefy";
144
146
 
145
147
  function App() {
@@ -493,6 +495,46 @@ Perfect for saving data, sending analytics, and cleaning up resources on compone
493
495
 
494
496
  </details>
495
497
 
498
+ <details>
499
+ <summary><strong>useInit</strong> — One-time initialization with async support, retry, timeout, and conditional execution</summary>
500
+
501
+ ```tsx
502
+ // Basic async initialization
503
+ const { isInitialized, isInitializing, error } = useInit(async () => {
504
+ await loadConfiguration();
505
+ });
506
+
507
+ // With retry and timeout
508
+ const { error, reinitialize } = useInit(
509
+ async () => {
510
+ await connectToServer();
511
+ },
512
+ {
513
+ retry: 3,
514
+ retryDelay: 1000,
515
+ timeout: 5000,
516
+ }
517
+ );
518
+
519
+ // Conditional initialization
520
+ useInit(
521
+ () => {
522
+ initializeFeature();
523
+ },
524
+ { when: isEnabled }
525
+ );
526
+
527
+ // With cleanup function
528
+ useInit(() => {
529
+ const subscription = eventBus.subscribe();
530
+ return () => subscription.unsubscribe();
531
+ });
532
+ ```
533
+
534
+ Perfect for initializing services, loading configuration, setting up subscriptions, and any one-time setup tasks with robust error handling.
535
+
536
+ </details>
537
+
496
538
  ---
497
539
 
498
540
  ## Test Coverage
@@ -503,22 +545,23 @@ All packages are comprehensively tested using Vitest to ensure reliability and s
503
545
 
504
546
  > 💡 To generate coverage report locally, run `pnpm test:coverage`. The report will be available at `coverage/index.html`.
505
547
 
506
- | Package | Statements | Branches | Functions | Lines |
507
- | --------------------- | ---------- | -------- | --------- | ----- |
508
- | use-toggle | 100% | 100% | 100% | 100% |
509
- | use-counter | 100% | 100% | 100% | 100% |
510
- | use-throttle | 100% | 100% | 100% | 100% |
511
- | use-throttle-callback | 100% | 100% | 100% | 100% |
512
- | use-local-storage | 95% | 86% | 93% | 95% |
513
- | use-session-storage | 94% | 82% | 93% | 94% |
514
- | use-debounce-callback | 94% | 83% | 94% | 94% |
515
- | use-click-any-where | 92% | 88% | 100% | 92% |
516
- | use-debounce | 91% | 90% | 67% | 93% |
517
- | use-copy-to-clipboard | 88% | 79% | 86% | 88% |
518
- | use-event-listener | 96% | 91% | 100% | 96% |
519
- | use-on-click-outside | 97% | 93% | 100% | 97% |
520
- | use-unmount | 100% | 100% | 100% | 100% |
521
- | use-timer | 84% | 73% | 94% | 84% |
548
+ | Package | Statements | Branches | Functions | Lines |
549
+ | --------------------- | ---------- | -------- | --------- | ------ |
550
+ | use-toggle | 100% | 100% | 100% | 100% |
551
+ | use-counter | 100% | 100% | 100% | 100% |
552
+ | use-throttle | 100% | 100% | 100% | 100% |
553
+ | use-throttle-callback | 100% | 100% | 100% | 100% |
554
+ | use-on-click-outside | 97.61% | 93.93% | 100% | 97.61% |
555
+ | use-event-listener | 96.29% | 91.66% | 100% | 96.29% |
556
+ | use-init | 96.1% | 88.63% | 100% | 96% |
557
+ | use-local-storage | 95.18% | 86.84% | 93.75% | 95.12% |
558
+ | use-session-storage | 94.66% | 82.75% | 93.33% | 94.59% |
559
+ | use-debounce-callback | 93.2% | 76% | 93.75% | 93.13% |
560
+ | use-click-any-where | 92.3% | 87.5% | 100% | 92.3% |
561
+ | use-debounce | 90% | 82.6% | 66.66% | 91.95% |
562
+ | use-copy-to-clipboard | 87.87% | 79.16% | 85.71% | 87.87% |
563
+ | use-unmount | 100% | 100% | 100% | 100% |
564
+ | use-timer | 83.8% | 72.63% | 93.93% | 84.13% |
522
565
 
523
566
  ---
524
567
 
package/dist/index.d.mts CHANGED
@@ -12,3 +12,4 @@ export { ClickOutsideEvent, MouseEventType, OnClickOutsideHandler, RefTarget, To
12
12
  export { EventTargetType, UseEventListenerOptions, useEventListener } from '@usefy/use-event-listener';
13
13
  export { TimeFormat, TimeUnit, UseTimerOptions, UseTimerReturn, useTimer } from '@usefy/use-timer';
14
14
  export { UseUnmountOptions, useUnmount } from '@usefy/use-unmount';
15
+ export { UseInitOptions, UseInitResult, useInit } from '@usefy/use-init';
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export { ClickOutsideEvent, MouseEventType, OnClickOutsideHandler, RefTarget, To
12
12
  export { EventTargetType, UseEventListenerOptions, useEventListener } from '@usefy/use-event-listener';
13
13
  export { TimeFormat, TimeUnit, UseTimerOptions, UseTimerReturn, useTimer } from '@usefy/use-timer';
14
14
  export { UseUnmountOptions, useUnmount } from '@usefy/use-unmount';
15
+ export { UseInitOptions, UseInitResult, useInit } from '@usefy/use-init';
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ __export(index_exports, {
26
26
  useDebounce: () => import_use_debounce.useDebounce,
27
27
  useDebounceCallback: () => import_use_debounce_callback.useDebounceCallback,
28
28
  useEventListener: () => import_use_event_listener.useEventListener,
29
+ useInit: () => import_use_init.useInit,
29
30
  useLocalStorage: () => import_use_local_storage.useLocalStorage,
30
31
  useOnClickOutside: () => import_use_on_click_outside.useOnClickOutside,
31
32
  useSessionStorage: () => import_use_session_storage.useSessionStorage,
@@ -50,6 +51,7 @@ var import_use_on_click_outside = require("@usefy/use-on-click-outside");
50
51
  var import_use_event_listener = require("@usefy/use-event-listener");
51
52
  var import_use_timer = require("@usefy/use-timer");
52
53
  var import_use_unmount = require("@usefy/use-unmount");
54
+ var import_use_init = require("@usefy/use-init");
53
55
  // Annotate the CommonJS export names for ESM import in node:
54
56
  0 && (module.exports = {
55
57
  useClickAnyWhere,
@@ -58,6 +60,7 @@ var import_use_unmount = require("@usefy/use-unmount");
58
60
  useDebounce,
59
61
  useDebounceCallback,
60
62
  useEventListener,
63
+ useInit,
61
64
  useLocalStorage,
62
65
  useOnClickOutside,
63
66
  useSessionStorage,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Re-export all hooks from individual packages\n\n// useClickAnyWhere\nexport {\n useClickAnyWhere,\n type UseClickAnyWhereOptions,\n type ClickAnyWhereHandler,\n} from \"@usefy/use-click-any-where\";\n\n// useCopyToClipboard\nexport {\n useCopyToClipboard,\n type UseCopyToClipboardOptions,\n type UseCopyToClipboardReturn,\n type CopyFn,\n} from \"@usefy/use-copy-to-clipboard\";\n\n// useCounter\nexport { useCounter } from \"@usefy/use-counter\";\n\n// useToggle\nexport { useToggle, type UseToggleReturn } from \"@usefy/use-toggle\";\n\n// useDebounce\nexport { useDebounce, type UseDebounceOptions } from \"@usefy/use-debounce\";\n\n// useDebounceCallback\nexport {\n useDebounceCallback,\n type UseDebounceCallbackOptions,\n type DebouncedFunction,\n} from \"@usefy/use-debounce-callback\";\n\n// useThrottle\nexport { useThrottle, type UseThrottleOptions } from \"@usefy/use-throttle\";\n\n// useThrottleCallback\nexport {\n useThrottleCallback,\n type UseThrottleCallbackOptions,\n type ThrottledFunction,\n} from \"@usefy/use-throttle-callback\";\n\n// useLocalStorage\nexport {\n useLocalStorage,\n type UseLocalStorageOptions,\n type UseLocalStorageReturn,\n type InitialValue,\n} from \"@usefy/use-local-storage\";\n\n// useSessionStorage\nexport {\n useSessionStorage,\n type UseSessionStorageOptions,\n type UseSessionStorageReturn,\n type InitialValue as SessionStorageInitialValue,\n} from \"@usefy/use-session-storage\";\n\n// useOnClickOutside\nexport {\n useOnClickOutside,\n type UseOnClickOutsideOptions,\n type OnClickOutsideHandler,\n type ClickOutsideEvent,\n type RefTarget,\n type MouseEventType,\n type TouchEventType,\n} from \"@usefy/use-on-click-outside\";\n\n// useEventListener\nexport {\n useEventListener,\n type UseEventListenerOptions,\n type EventTargetType,\n} from \"@usefy/use-event-listener\";\n\n// useTimer\nexport {\n useTimer,\n type TimeUnit,\n type TimeFormat,\n type UseTimerOptions,\n type UseTimerReturn,\n} from \"@usefy/use-timer\";\n\n// useUnmount\nexport { useUnmount, type UseUnmountOptions } from \"@usefy/use-unmount\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAIO;AAGP,mCAKO;AAGP,yBAA2B;AAG3B,wBAAgD;AAGhD,0BAAqD;AAGrD,mCAIO;AAGP,0BAAqD;AAGrD,mCAIO;AAGP,+BAKO;AAGP,iCAKO;AAGP,kCAQO;AAGP,gCAIO;AAGP,uBAMO;AAGP,yBAAmD;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Re-export all hooks from individual packages\n\n// useClickAnyWhere\nexport {\n useClickAnyWhere,\n type UseClickAnyWhereOptions,\n type ClickAnyWhereHandler,\n} from \"@usefy/use-click-any-where\";\n\n// useCopyToClipboard\nexport {\n useCopyToClipboard,\n type UseCopyToClipboardOptions,\n type UseCopyToClipboardReturn,\n type CopyFn,\n} from \"@usefy/use-copy-to-clipboard\";\n\n// useCounter\nexport { useCounter } from \"@usefy/use-counter\";\n\n// useToggle\nexport { useToggle, type UseToggleReturn } from \"@usefy/use-toggle\";\n\n// useDebounce\nexport { useDebounce, type UseDebounceOptions } from \"@usefy/use-debounce\";\n\n// useDebounceCallback\nexport {\n useDebounceCallback,\n type UseDebounceCallbackOptions,\n type DebouncedFunction,\n} from \"@usefy/use-debounce-callback\";\n\n// useThrottle\nexport { useThrottle, type UseThrottleOptions } from \"@usefy/use-throttle\";\n\n// useThrottleCallback\nexport {\n useThrottleCallback,\n type UseThrottleCallbackOptions,\n type ThrottledFunction,\n} from \"@usefy/use-throttle-callback\";\n\n// useLocalStorage\nexport {\n useLocalStorage,\n type UseLocalStorageOptions,\n type UseLocalStorageReturn,\n type InitialValue,\n} from \"@usefy/use-local-storage\";\n\n// useSessionStorage\nexport {\n useSessionStorage,\n type UseSessionStorageOptions,\n type UseSessionStorageReturn,\n type InitialValue as SessionStorageInitialValue,\n} from \"@usefy/use-session-storage\";\n\n// useOnClickOutside\nexport {\n useOnClickOutside,\n type UseOnClickOutsideOptions,\n type OnClickOutsideHandler,\n type ClickOutsideEvent,\n type RefTarget,\n type MouseEventType,\n type TouchEventType,\n} from \"@usefy/use-on-click-outside\";\n\n// useEventListener\nexport {\n useEventListener,\n type UseEventListenerOptions,\n type EventTargetType,\n} from \"@usefy/use-event-listener\";\n\n// useTimer\nexport {\n useTimer,\n type TimeUnit,\n type TimeFormat,\n type UseTimerOptions,\n type UseTimerReturn,\n} from \"@usefy/use-timer\";\n\n// useUnmount\nexport { useUnmount, type UseUnmountOptions } from \"@usefy/use-unmount\";\n\n// useInit\nexport {\n useInit,\n type UseInitOptions,\n type UseInitResult,\n} from \"@usefy/use-init\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAIO;AAGP,mCAKO;AAGP,yBAA2B;AAG3B,wBAAgD;AAGhD,0BAAqD;AAGrD,mCAIO;AAGP,0BAAqD;AAGrD,mCAIO;AAGP,+BAKO;AAGP,iCAKO;AAGP,kCAQO;AAGP,gCAIO;AAGP,uBAMO;AAGP,yBAAmD;AAGnD,sBAIO;","names":[]}
package/dist/index.mjs CHANGED
@@ -31,6 +31,9 @@ import {
31
31
  useTimer
32
32
  } from "@usefy/use-timer";
33
33
  import { useUnmount } from "@usefy/use-unmount";
34
+ import {
35
+ useInit
36
+ } from "@usefy/use-init";
34
37
  export {
35
38
  useClickAnyWhere,
36
39
  useCopyToClipboard,
@@ -38,6 +41,7 @@ export {
38
41
  useDebounce,
39
42
  useDebounceCallback,
40
43
  useEventListener,
44
+ useInit,
41
45
  useLocalStorage,
42
46
  useOnClickOutside,
43
47
  useSessionStorage,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Re-export all hooks from individual packages\n\n// useClickAnyWhere\nexport {\n useClickAnyWhere,\n type UseClickAnyWhereOptions,\n type ClickAnyWhereHandler,\n} from \"@usefy/use-click-any-where\";\n\n// useCopyToClipboard\nexport {\n useCopyToClipboard,\n type UseCopyToClipboardOptions,\n type UseCopyToClipboardReturn,\n type CopyFn,\n} from \"@usefy/use-copy-to-clipboard\";\n\n// useCounter\nexport { useCounter } from \"@usefy/use-counter\";\n\n// useToggle\nexport { useToggle, type UseToggleReturn } from \"@usefy/use-toggle\";\n\n// useDebounce\nexport { useDebounce, type UseDebounceOptions } from \"@usefy/use-debounce\";\n\n// useDebounceCallback\nexport {\n useDebounceCallback,\n type UseDebounceCallbackOptions,\n type DebouncedFunction,\n} from \"@usefy/use-debounce-callback\";\n\n// useThrottle\nexport { useThrottle, type UseThrottleOptions } from \"@usefy/use-throttle\";\n\n// useThrottleCallback\nexport {\n useThrottleCallback,\n type UseThrottleCallbackOptions,\n type ThrottledFunction,\n} from \"@usefy/use-throttle-callback\";\n\n// useLocalStorage\nexport {\n useLocalStorage,\n type UseLocalStorageOptions,\n type UseLocalStorageReturn,\n type InitialValue,\n} from \"@usefy/use-local-storage\";\n\n// useSessionStorage\nexport {\n useSessionStorage,\n type UseSessionStorageOptions,\n type UseSessionStorageReturn,\n type InitialValue as SessionStorageInitialValue,\n} from \"@usefy/use-session-storage\";\n\n// useOnClickOutside\nexport {\n useOnClickOutside,\n type UseOnClickOutsideOptions,\n type OnClickOutsideHandler,\n type ClickOutsideEvent,\n type RefTarget,\n type MouseEventType,\n type TouchEventType,\n} from \"@usefy/use-on-click-outside\";\n\n// useEventListener\nexport {\n useEventListener,\n type UseEventListenerOptions,\n type EventTargetType,\n} from \"@usefy/use-event-listener\";\n\n// useTimer\nexport {\n useTimer,\n type TimeUnit,\n type TimeFormat,\n type UseTimerOptions,\n type UseTimerReturn,\n} from \"@usefy/use-timer\";\n\n// useUnmount\nexport { useUnmount, type UseUnmountOptions } from \"@usefy/use-unmount\";\n"],"mappings":";AAGA;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP,SAAS,kBAAkB;AAG3B,SAAS,iBAAuC;AAGhD,SAAS,mBAA4C;AAGrD;AAAA,EACE;AAAA,OAGK;AAGP,SAAS,mBAA4C;AAGrD;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,OAOK;AAGP;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAKK;AAGP,SAAS,kBAA0C;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Re-export all hooks from individual packages\n\n// useClickAnyWhere\nexport {\n useClickAnyWhere,\n type UseClickAnyWhereOptions,\n type ClickAnyWhereHandler,\n} from \"@usefy/use-click-any-where\";\n\n// useCopyToClipboard\nexport {\n useCopyToClipboard,\n type UseCopyToClipboardOptions,\n type UseCopyToClipboardReturn,\n type CopyFn,\n} from \"@usefy/use-copy-to-clipboard\";\n\n// useCounter\nexport { useCounter } from \"@usefy/use-counter\";\n\n// useToggle\nexport { useToggle, type UseToggleReturn } from \"@usefy/use-toggle\";\n\n// useDebounce\nexport { useDebounce, type UseDebounceOptions } from \"@usefy/use-debounce\";\n\n// useDebounceCallback\nexport {\n useDebounceCallback,\n type UseDebounceCallbackOptions,\n type DebouncedFunction,\n} from \"@usefy/use-debounce-callback\";\n\n// useThrottle\nexport { useThrottle, type UseThrottleOptions } from \"@usefy/use-throttle\";\n\n// useThrottleCallback\nexport {\n useThrottleCallback,\n type UseThrottleCallbackOptions,\n type ThrottledFunction,\n} from \"@usefy/use-throttle-callback\";\n\n// useLocalStorage\nexport {\n useLocalStorage,\n type UseLocalStorageOptions,\n type UseLocalStorageReturn,\n type InitialValue,\n} from \"@usefy/use-local-storage\";\n\n// useSessionStorage\nexport {\n useSessionStorage,\n type UseSessionStorageOptions,\n type UseSessionStorageReturn,\n type InitialValue as SessionStorageInitialValue,\n} from \"@usefy/use-session-storage\";\n\n// useOnClickOutside\nexport {\n useOnClickOutside,\n type UseOnClickOutsideOptions,\n type OnClickOutsideHandler,\n type ClickOutsideEvent,\n type RefTarget,\n type MouseEventType,\n type TouchEventType,\n} from \"@usefy/use-on-click-outside\";\n\n// useEventListener\nexport {\n useEventListener,\n type UseEventListenerOptions,\n type EventTargetType,\n} from \"@usefy/use-event-listener\";\n\n// useTimer\nexport {\n useTimer,\n type TimeUnit,\n type TimeFormat,\n type UseTimerOptions,\n type UseTimerReturn,\n} from \"@usefy/use-timer\";\n\n// useUnmount\nexport { useUnmount, type UseUnmountOptions } from \"@usefy/use-unmount\";\n\n// useInit\nexport {\n useInit,\n type UseInitOptions,\n type UseInitResult,\n} from \"@usefy/use-init\";\n"],"mappings":";AAGA;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP,SAAS,kBAAkB;AAG3B,SAAS,iBAAuC;AAGhD,SAAS,mBAA4C;AAGrD;AAAA,EACE;AAAA,OAGK;AAGP,SAAS,mBAA4C;AAGrD;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP;AAAA,EACE;AAAA,OAOK;AAGP;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAKK;AAGP,SAAS,kBAA0C;AAGnD;AAAA,EACE;AAAA,OAGK;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefy/usefy",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "A collection of useful React hooks",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -17,20 +17,21 @@
17
17
  ],
18
18
  "sideEffects": false,
19
19
  "dependencies": {
20
- "@usefy/use-click-any-where": "0.0.23",
21
- "@usefy/use-copy-to-clipboard": "0.0.23",
22
- "@usefy/use-counter": "0.0.23",
23
- "@usefy/use-toggle": "0.0.23",
24
- "@usefy/use-debounce": "0.0.23",
25
- "@usefy/use-debounce-callback": "0.0.23",
26
- "@usefy/use-throttle": "0.0.23",
27
- "@usefy/use-throttle-callback": "0.0.23",
28
- "@usefy/use-local-storage": "0.0.23",
29
- "@usefy/use-session-storage": "0.0.23",
30
- "@usefy/use-on-click-outside": "0.0.23",
31
- "@usefy/use-event-listener": "0.0.23",
32
- "@usefy/use-timer": "0.0.23",
33
- "@usefy/use-unmount": "0.0.23"
20
+ "@usefy/use-copy-to-clipboard": "0.0.25",
21
+ "@usefy/use-counter": "0.0.25",
22
+ "@usefy/use-click-any-where": "0.0.25",
23
+ "@usefy/use-toggle": "0.0.25",
24
+ "@usefy/use-debounce": "0.0.25",
25
+ "@usefy/use-debounce-callback": "0.0.25",
26
+ "@usefy/use-throttle": "0.0.25",
27
+ "@usefy/use-throttle-callback": "0.0.25",
28
+ "@usefy/use-local-storage": "0.0.25",
29
+ "@usefy/use-session-storage": "0.0.25",
30
+ "@usefy/use-on-click-outside": "0.0.25",
31
+ "@usefy/use-event-listener": "0.0.25",
32
+ "@usefy/use-timer": "0.0.25",
33
+ "@usefy/use-unmount": "0.0.25",
34
+ "@usefy/use-init": "0.0.25"
34
35
  },
35
36
  "peerDependencies": {
36
37
  "react": "^18.0.0 || ^19.0.0"