@usefy/usefy 0.0.28 → 0.0.30
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 +110 -36
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -17
package/README.md
CHANGED
|
@@ -107,24 +107,25 @@ All packages require React 18 or 19:
|
|
|
107
107
|
|
|
108
108
|
### 📦 Available Hooks
|
|
109
109
|
|
|
110
|
-
| Hook
|
|
111
|
-
|
|
|
112
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-toggle" target="_blank" rel="noopener noreferrer">@usefy/use-toggle</a>
|
|
113
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-counter" target="_blank" rel="noopener noreferrer">@usefy/use-counter</a>
|
|
114
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-debounce" target="_blank" rel="noopener noreferrer">@usefy/use-debounce</a>
|
|
115
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-debounce-callback" target="_blank" rel="noopener noreferrer">@usefy/use-debounce-callback</a>
|
|
116
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-throttle" target="_blank" rel="noopener noreferrer">@usefy/use-throttle</a>
|
|
117
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-throttle-callback" target="_blank" rel="noopener noreferrer">@usefy/use-throttle-callback</a>
|
|
118
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-local-storage" target="_blank" rel="noopener noreferrer">@usefy/use-local-storage</a>
|
|
119
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-session-storage" target="_blank" rel="noopener noreferrer">@usefy/use-session-storage</a>
|
|
120
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-click-any-where" target="_blank" rel="noopener noreferrer">@usefy/use-click-any-where</a>
|
|
121
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-copy-to-clipboard" target="_blank" rel="noopener noreferrer">@usefy/use-copy-to-clipboard</a>
|
|
122
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-event-listener" target="_blank" rel="noopener noreferrer">@usefy/use-event-listener</a>
|
|
123
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-on-click-outside" target="_blank" rel="noopener noreferrer">@usefy/use-on-click-outside</a>
|
|
124
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-unmount" target="_blank" rel="noopener noreferrer">@usefy/use-unmount</a>
|
|
125
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-init" target="_blank" rel="noopener noreferrer">@usefy/use-init</a>
|
|
126
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-timer" target="_blank" rel="noopener noreferrer">@usefy/use-timer</a>
|
|
127
|
-
| <a href="https://www.npmjs.com/package/@usefy/use-geolocation" target="_blank" rel="noopener noreferrer">@usefy/use-geolocation</a>
|
|
110
|
+
| Hook | Description | npm | Coverage |
|
|
111
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
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> |  |
|
|
127
|
+
| <a href="https://www.npmjs.com/package/@usefy/use-geolocation" target="_blank" rel="noopener noreferrer">@usefy/use-geolocation</a> | Device geolocation with real-time tracking and distance | <a href="https://www.npmjs.com/package/@usefy/use-geolocation" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-geolocation.svg?style=flat-square&color=007acc" alt="npm version" /></a> |  |
|
|
128
|
+
| <a href="https://www.npmjs.com/package/@usefy/use-intersection-observer" target="_blank" rel="noopener noreferrer">@usefy/use-intersection-observer</a> | Element visibility detection with Intersection Observer | <a href="https://www.npmjs.com/package/@usefy/use-intersection-observer" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-intersection-observer.svg?style=flat-square&color=007acc" alt="npm version" /></a> |  |
|
|
128
129
|
|
|
129
130
|
---
|
|
130
131
|
|
|
@@ -141,6 +142,7 @@ import {
|
|
|
141
142
|
useCopyToClipboard,
|
|
142
143
|
useEventListener,
|
|
143
144
|
useOnClickOutside,
|
|
145
|
+
useIntersectionObserver,
|
|
144
146
|
useUnmount,
|
|
145
147
|
useInit,
|
|
146
148
|
} from "@usefy/usefy";
|
|
@@ -162,6 +164,12 @@ function App() {
|
|
|
162
164
|
// Copy functionality
|
|
163
165
|
const [copiedText, copy] = useCopyToClipboard();
|
|
164
166
|
|
|
167
|
+
// Lazy loading image
|
|
168
|
+
const { ref: imageRef, inView } = useIntersectionObserver({
|
|
169
|
+
triggerOnce: true,
|
|
170
|
+
rootMargin: "50px",
|
|
171
|
+
});
|
|
172
|
+
|
|
165
173
|
return (
|
|
166
174
|
<div data-theme={theme}>
|
|
167
175
|
{/* Modal */}
|
|
@@ -195,6 +203,11 @@ function App() {
|
|
|
195
203
|
<button onClick={() => copy("Hello World!")}>
|
|
196
204
|
{copiedText ? "Copied!" : "Copy"}
|
|
197
205
|
</button>
|
|
206
|
+
|
|
207
|
+
{/* Lazy Loading */}
|
|
208
|
+
<div ref={imageRef}>
|
|
209
|
+
{inView && <img src="large-image.jpg" alt="Lazy loaded" />}
|
|
210
|
+
</div>
|
|
198
211
|
</div>
|
|
199
212
|
);
|
|
200
213
|
}
|
|
@@ -510,6 +523,66 @@ Perfect for location-based apps, maps, navigation, distance tracking, and geofen
|
|
|
510
523
|
|
|
511
524
|
</details>
|
|
512
525
|
|
|
526
|
+
### 👁️ Visibility
|
|
527
|
+
|
|
528
|
+
<details>
|
|
529
|
+
<summary><strong>useIntersectionObserver</strong> — Efficient element visibility detection with Intersection Observer API</summary>
|
|
530
|
+
|
|
531
|
+
```tsx
|
|
532
|
+
import { useIntersectionObserver } from "@usefy/use-intersection-observer";
|
|
533
|
+
|
|
534
|
+
// Basic usage - detect when element enters viewport
|
|
535
|
+
const { ref, inView, entry } = useIntersectionObserver();
|
|
536
|
+
|
|
537
|
+
// Lazy loading images
|
|
538
|
+
const { ref, inView } = useIntersectionObserver({
|
|
539
|
+
triggerOnce: true, // Stop observing after first detection
|
|
540
|
+
threshold: 0.1, // Trigger when 10% visible
|
|
541
|
+
rootMargin: "50px", // Start loading 50px before entering viewport
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
// Infinite scroll with sentinel element
|
|
545
|
+
const { ref, inView } = useIntersectionObserver({
|
|
546
|
+
threshold: 1.0,
|
|
547
|
+
rootMargin: "100px", // Preload 100px ahead
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
useEffect(() => {
|
|
551
|
+
if (inView) loadMoreItems();
|
|
552
|
+
}, [inView]);
|
|
553
|
+
|
|
554
|
+
// Scroll animations
|
|
555
|
+
const { ref, inView } = useIntersectionObserver({
|
|
556
|
+
triggerOnce: true,
|
|
557
|
+
threshold: 0.3,
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// Progress tracking with multiple thresholds
|
|
561
|
+
const thresholds = Array.from({ length: 101 }, (_, i) => i / 100);
|
|
562
|
+
const { ref, entry } = useIntersectionObserver({
|
|
563
|
+
threshold: thresholds,
|
|
564
|
+
onChange: (entry) => {
|
|
565
|
+
setProgress(Math.round(entry.intersectionRatio * 100));
|
|
566
|
+
},
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
// Custom scroll container
|
|
570
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
571
|
+
const { ref, inView } = useIntersectionObserver({
|
|
572
|
+
root: containerRef.current,
|
|
573
|
+
rootMargin: "0px",
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
// Delayed observation
|
|
577
|
+
const { ref, inView } = useIntersectionObserver({
|
|
578
|
+
delay: 500, // Wait 500ms before creating observer
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Perfect for lazy loading, infinite scroll, scroll animations, progress tracking, and any visibility-based interactions with smart re-render optimization.
|
|
583
|
+
|
|
584
|
+
</details>
|
|
585
|
+
|
|
513
586
|
### 🔄 Lifecycle
|
|
514
587
|
|
|
515
588
|
<details>
|
|
@@ -591,24 +664,25 @@ All packages are comprehensively tested using Vitest to ensure reliability and s
|
|
|
591
664
|
|
|
592
665
|
> 💡 To generate coverage report locally, run `pnpm test:coverage`. The report will be available at `coverage/index.html`.
|
|
593
666
|
|
|
594
|
-
| Package
|
|
595
|
-
|
|
|
596
|
-
| use-toggle
|
|
597
|
-
| use-counter
|
|
598
|
-
| use-throttle
|
|
599
|
-
| use-throttle-callback
|
|
600
|
-
| use-on-click-outside
|
|
601
|
-
| use-event-listener
|
|
602
|
-
| use-init
|
|
603
|
-
| use-local-storage
|
|
604
|
-
| use-session-storage
|
|
605
|
-
| use-debounce-callback
|
|
606
|
-
| use-click-any-where
|
|
607
|
-
| use-debounce
|
|
608
|
-
| use-copy-to-clipboard
|
|
609
|
-
| use-unmount
|
|
610
|
-
| use-timer
|
|
611
|
-
| use-geolocation
|
|
667
|
+
| Package | Statements | Branches | Functions | Lines |
|
|
668
|
+
| ------------------------- | ---------- | -------- | --------- | ------ |
|
|
669
|
+
| use-toggle | 100% | 100% | 100% | 100% |
|
|
670
|
+
| use-counter | 100% | 100% | 100% | 100% |
|
|
671
|
+
| use-throttle | 100% | 100% | 100% | 100% |
|
|
672
|
+
| use-throttle-callback | 100% | 100% | 100% | 100% |
|
|
673
|
+
| use-on-click-outside | 97.61% | 93.93% | 100% | 97.61% |
|
|
674
|
+
| use-event-listener | 96.29% | 91.66% | 100% | 96.29% |
|
|
675
|
+
| use-init | 96.1% | 88.63% | 100% | 96% |
|
|
676
|
+
| use-local-storage | 95.18% | 86.84% | 93.75% | 95.12% |
|
|
677
|
+
| use-session-storage | 94.66% | 82.75% | 93.33% | 94.59% |
|
|
678
|
+
| use-debounce-callback | 93.2% | 76% | 93.75% | 93.13% |
|
|
679
|
+
| use-click-any-where | 92.3% | 87.5% | 100% | 92.3% |
|
|
680
|
+
| use-debounce | 90% | 82.6% | 66.66% | 91.95% |
|
|
681
|
+
| use-copy-to-clipboard | 87.87% | 79.16% | 85.71% | 87.87% |
|
|
682
|
+
| use-unmount | 100% | 100% | 100% | 100% |
|
|
683
|
+
| use-timer | 83.8% | 72.63% | 93.93% | 84.13% |
|
|
684
|
+
| use-geolocation | 90% | 85% | 95% | 90% |
|
|
685
|
+
| use-intersection-observer | 94% | 85% | 95% | 93.93% |
|
|
612
686
|
|
|
613
687
|
---
|
|
614
688
|
|
package/dist/index.d.mts
CHANGED
|
@@ -14,3 +14,4 @@ export { TimeFormat, TimeUnit, UseTimerOptions, UseTimerReturn, useTimer } from
|
|
|
14
14
|
export { UseUnmountOptions, useUnmount } from '@usefy/use-unmount';
|
|
15
15
|
export { UseInitOptions, UseInitResult, useInit } from '@usefy/use-init';
|
|
16
16
|
export { GeoCoordinates, GeoPosition, GeolocationError, GeolocationErrorCode, PermissionState, UseGeolocationOptions, UseGeolocationReturn, calculateBearing, haversineDistance, useGeolocation } from '@usefy/use-geolocation';
|
|
17
|
+
export { IntersectionEntry, OnChangeCallback, UseIntersectionObserverOptions, UseIntersectionObserverReturn, createInitialEntry, isIntersectionObserverSupported, toIntersectionEntry, useIntersectionObserver } from '@usefy/use-intersection-observer';
|
package/dist/index.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export { TimeFormat, TimeUnit, UseTimerOptions, UseTimerReturn, useTimer } from
|
|
|
14
14
|
export { UseUnmountOptions, useUnmount } from '@usefy/use-unmount';
|
|
15
15
|
export { UseInitOptions, UseInitResult, useInit } from '@usefy/use-init';
|
|
16
16
|
export { GeoCoordinates, GeoPosition, GeolocationError, GeolocationErrorCode, PermissionState, UseGeolocationOptions, UseGeolocationReturn, calculateBearing, haversineDistance, useGeolocation } from '@usefy/use-geolocation';
|
|
17
|
+
export { IntersectionEntry, OnChangeCallback, UseIntersectionObserverOptions, UseIntersectionObserverReturn, createInitialEntry, isIntersectionObserverSupported, toIntersectionEntry, useIntersectionObserver } from '@usefy/use-intersection-observer';
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
calculateBearing: () => import_use_geolocation.calculateBearing,
|
|
24
|
+
createInitialEntry: () => import_use_intersection_observer.createInitialEntry,
|
|
24
25
|
haversineDistance: () => import_use_geolocation.haversineDistance,
|
|
26
|
+
isIntersectionObserverSupported: () => import_use_intersection_observer.isIntersectionObserverSupported,
|
|
27
|
+
toIntersectionEntry: () => import_use_intersection_observer.toIntersectionEntry,
|
|
25
28
|
useClickAnyWhere: () => import_use_click_any_where.useClickAnyWhere,
|
|
26
29
|
useCopyToClipboard: () => import_use_copy_to_clipboard.useCopyToClipboard,
|
|
27
30
|
useCounter: () => import_use_counter.useCounter,
|
|
@@ -30,6 +33,7 @@ __export(index_exports, {
|
|
|
30
33
|
useEventListener: () => import_use_event_listener.useEventListener,
|
|
31
34
|
useGeolocation: () => import_use_geolocation.useGeolocation,
|
|
32
35
|
useInit: () => import_use_init.useInit,
|
|
36
|
+
useIntersectionObserver: () => import_use_intersection_observer.useIntersectionObserver,
|
|
33
37
|
useLocalStorage: () => import_use_local_storage.useLocalStorage,
|
|
34
38
|
useOnClickOutside: () => import_use_on_click_outside.useOnClickOutside,
|
|
35
39
|
useSessionStorage: () => import_use_session_storage.useSessionStorage,
|
|
@@ -56,10 +60,14 @@ var import_use_timer = require("@usefy/use-timer");
|
|
|
56
60
|
var import_use_unmount = require("@usefy/use-unmount");
|
|
57
61
|
var import_use_init = require("@usefy/use-init");
|
|
58
62
|
var import_use_geolocation = require("@usefy/use-geolocation");
|
|
63
|
+
var import_use_intersection_observer = require("@usefy/use-intersection-observer");
|
|
59
64
|
// Annotate the CommonJS export names for ESM import in node:
|
|
60
65
|
0 && (module.exports = {
|
|
61
66
|
calculateBearing,
|
|
67
|
+
createInitialEntry,
|
|
62
68
|
haversineDistance,
|
|
69
|
+
isIntersectionObserverSupported,
|
|
70
|
+
toIntersectionEntry,
|
|
63
71
|
useClickAnyWhere,
|
|
64
72
|
useCopyToClipboard,
|
|
65
73
|
useCounter,
|
|
@@ -68,6 +76,7 @@ var import_use_geolocation = require("@usefy/use-geolocation");
|
|
|
68
76
|
useEventListener,
|
|
69
77
|
useGeolocation,
|
|
70
78
|
useInit,
|
|
79
|
+
useIntersectionObserver,
|
|
71
80
|
useLocalStorage,
|
|
72
81
|
useOnClickOutside,
|
|
73
82
|
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\n// useInit\nexport {\n useInit,\n type UseInitOptions,\n type UseInitResult,\n} from \"@usefy/use-init\";\n\n// useGeolocation\nexport {\n useGeolocation,\n haversineDistance,\n calculateBearing,\n type GeoCoordinates,\n type GeoPosition,\n type GeolocationError,\n type GeolocationErrorCode,\n type PermissionState,\n type UseGeolocationOptions,\n type UseGeolocationReturn,\n} from \"@usefy/use-geolocation\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;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;AAGP,6BAWO;","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\n// useGeolocation\nexport {\n useGeolocation,\n haversineDistance,\n calculateBearing,\n type GeoCoordinates,\n type GeoPosition,\n type GeolocationError,\n type GeolocationErrorCode,\n type PermissionState,\n type UseGeolocationOptions,\n type UseGeolocationReturn,\n} from \"@usefy/use-geolocation\";\n\n// useIntersectionObserver\nexport {\n useIntersectionObserver,\n isIntersectionObserverSupported,\n toIntersectionEntry,\n createInitialEntry,\n type UseIntersectionObserverOptions,\n type UseIntersectionObserverReturn,\n type IntersectionEntry,\n type OnChangeCallback,\n} from \"@usefy/use-intersection-observer\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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;AAGP,6BAWO;AAGP,uCASO;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -39,9 +39,18 @@ import {
|
|
|
39
39
|
haversineDistance,
|
|
40
40
|
calculateBearing
|
|
41
41
|
} from "@usefy/use-geolocation";
|
|
42
|
+
import {
|
|
43
|
+
useIntersectionObserver,
|
|
44
|
+
isIntersectionObserverSupported,
|
|
45
|
+
toIntersectionEntry,
|
|
46
|
+
createInitialEntry
|
|
47
|
+
} from "@usefy/use-intersection-observer";
|
|
42
48
|
export {
|
|
43
49
|
calculateBearing,
|
|
50
|
+
createInitialEntry,
|
|
44
51
|
haversineDistance,
|
|
52
|
+
isIntersectionObserverSupported,
|
|
53
|
+
toIntersectionEntry,
|
|
45
54
|
useClickAnyWhere,
|
|
46
55
|
useCopyToClipboard,
|
|
47
56
|
useCounter,
|
|
@@ -50,6 +59,7 @@ export {
|
|
|
50
59
|
useEventListener,
|
|
51
60
|
useGeolocation,
|
|
52
61
|
useInit,
|
|
62
|
+
useIntersectionObserver,
|
|
53
63
|
useLocalStorage,
|
|
54
64
|
useOnClickOutside,
|
|
55
65
|
useSessionStorage,
|
package/dist/index.mjs.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\n// useInit\nexport {\n useInit,\n type UseInitOptions,\n type UseInitResult,\n} from \"@usefy/use-init\";\n\n// useGeolocation\nexport {\n useGeolocation,\n haversineDistance,\n calculateBearing,\n type GeoCoordinates,\n type GeoPosition,\n type GeolocationError,\n type GeolocationErrorCode,\n type PermissionState,\n type UseGeolocationOptions,\n type UseGeolocationReturn,\n} from \"@usefy/use-geolocation\";\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;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAQK;","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\n// useGeolocation\nexport {\n useGeolocation,\n haversineDistance,\n calculateBearing,\n type GeoCoordinates,\n type GeoPosition,\n type GeolocationError,\n type GeolocationErrorCode,\n type PermissionState,\n type UseGeolocationOptions,\n type UseGeolocationReturn,\n} from \"@usefy/use-geolocation\";\n\n// useIntersectionObserver\nexport {\n useIntersectionObserver,\n isIntersectionObserverSupported,\n toIntersectionEntry,\n createInitialEntry,\n type UseIntersectionObserverOptions,\n type UseIntersectionObserverReturn,\n type IntersectionEntry,\n type OnChangeCallback,\n} from \"@usefy/use-intersection-observer\";\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;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAQK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usefy/usefy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "A collection of useful React hooks",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -17,22 +17,23 @@
|
|
|
17
17
|
],
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@usefy/use-click-any-where": "0.0.
|
|
21
|
-
"@usefy/use-copy-to-clipboard": "0.0.
|
|
22
|
-
"@usefy/use-counter": "0.0.
|
|
23
|
-
"@usefy/use-toggle": "0.0.
|
|
24
|
-
"@usefy/use-debounce": "0.0.
|
|
25
|
-
"@usefy/use-debounce-callback": "0.0.
|
|
26
|
-
"@usefy/use-throttle": "0.0.
|
|
27
|
-
"@usefy/use-throttle-callback": "0.0.
|
|
28
|
-
"@usefy/use-local-storage": "0.0.
|
|
29
|
-
"@usefy/use-session-storage": "0.0.
|
|
30
|
-
"@usefy/use-on-click-outside": "0.0.
|
|
31
|
-
"@usefy/use-event-listener": "0.0.
|
|
32
|
-
"@usefy/use-
|
|
33
|
-
"@usefy/use-
|
|
34
|
-
"@usefy/use-
|
|
35
|
-
"@usefy/use-
|
|
20
|
+
"@usefy/use-click-any-where": "0.0.30",
|
|
21
|
+
"@usefy/use-copy-to-clipboard": "0.0.30",
|
|
22
|
+
"@usefy/use-counter": "0.0.30",
|
|
23
|
+
"@usefy/use-toggle": "0.0.30",
|
|
24
|
+
"@usefy/use-debounce": "0.0.30",
|
|
25
|
+
"@usefy/use-debounce-callback": "0.0.30",
|
|
26
|
+
"@usefy/use-throttle": "0.0.30",
|
|
27
|
+
"@usefy/use-throttle-callback": "0.0.30",
|
|
28
|
+
"@usefy/use-local-storage": "0.0.30",
|
|
29
|
+
"@usefy/use-session-storage": "0.0.30",
|
|
30
|
+
"@usefy/use-on-click-outside": "0.0.30",
|
|
31
|
+
"@usefy/use-event-listener": "0.0.30",
|
|
32
|
+
"@usefy/use-timer": "0.0.30",
|
|
33
|
+
"@usefy/use-unmount": "0.0.30",
|
|
34
|
+
"@usefy/use-init": "0.0.30",
|
|
35
|
+
"@usefy/use-geolocation": "0.0.30",
|
|
36
|
+
"@usefy/use-intersection-observer": "0.0.30"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"react": "^18.0.0 || ^19.0.0"
|