@usefy/usefy 0.0.30 → 0.0.32
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 +68 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -18
package/README.md
CHANGED
|
@@ -126,6 +126,7 @@ All packages require React 18 or 19:
|
|
|
126
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
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
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> |  |
|
|
129
|
+
| <a href="https://www.npmjs.com/package/@usefy/use-signal" target="_blank" rel="noopener noreferrer">@usefy/use-signal</a> | Event-driven communication between components | <a href="https://www.npmjs.com/package/@usefy/use-signal" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/npm/v/@usefy/use-signal.svg?style=flat-square&color=007acc" alt="npm version" /></a> |  |
|
|
129
130
|
|
|
130
131
|
---
|
|
131
132
|
|
|
@@ -143,6 +144,7 @@ import {
|
|
|
143
144
|
useEventListener,
|
|
144
145
|
useOnClickOutside,
|
|
145
146
|
useIntersectionObserver,
|
|
147
|
+
useSignal,
|
|
146
148
|
useUnmount,
|
|
147
149
|
useInit,
|
|
148
150
|
} from "@usefy/usefy";
|
|
@@ -382,6 +384,71 @@ Data persists during tab lifetime, isolated per tab.
|
|
|
382
384
|
|
|
383
385
|
</details>
|
|
384
386
|
|
|
387
|
+
### 📡 Communication
|
|
388
|
+
|
|
389
|
+
<details>
|
|
390
|
+
<summary><strong>useSignal</strong> — Event-driven communication between components</summary>
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
import { useSignal } from "@usefy/use-signal";
|
|
394
|
+
|
|
395
|
+
// Emitter component
|
|
396
|
+
function RefreshButton() {
|
|
397
|
+
const { emit, info } = useSignal("dashboard-refresh");
|
|
398
|
+
|
|
399
|
+
return (
|
|
400
|
+
<button onClick={() => emit()}>
|
|
401
|
+
Refresh All ({info.subscriberCount} widgets)
|
|
402
|
+
</button>
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// Subscriber component
|
|
407
|
+
function DataWidget() {
|
|
408
|
+
const { signal } = useSignal("dashboard-refresh");
|
|
409
|
+
|
|
410
|
+
useEffect(() => {
|
|
411
|
+
fetchData(); // Refetch when signal changes
|
|
412
|
+
}, [signal]);
|
|
413
|
+
|
|
414
|
+
return <div>Widget Content</div>;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// With typed data payload
|
|
418
|
+
interface NotificationData {
|
|
419
|
+
type: "success" | "error";
|
|
420
|
+
message: string;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function NotificationEmitter() {
|
|
424
|
+
const { emit } = useSignal<NotificationData>("notification");
|
|
425
|
+
|
|
426
|
+
return (
|
|
427
|
+
<button onClick={() => emit({ type: "success", message: "Done!" })}>
|
|
428
|
+
Notify
|
|
429
|
+
</button>
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function NotificationReceiver() {
|
|
434
|
+
const { signal, info } = useSignal<NotificationData>("notification");
|
|
435
|
+
|
|
436
|
+
useEffect(() => {
|
|
437
|
+
if (signal > 0 && info.data) {
|
|
438
|
+
toast[info.data.type](info.data.message);
|
|
439
|
+
}
|
|
440
|
+
}, [signal]);
|
|
441
|
+
|
|
442
|
+
return null;
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Perfect for:** Dashboard refresh, form reset, cache invalidation, multi-step flows, and event broadcasting.
|
|
447
|
+
|
|
448
|
+
> ⚠️ **Note:** `useSignal` is NOT a global state management solution. It's designed for lightweight event-driven communication. For complex state management, use Context, Zustand, Jotai, or Recoil.
|
|
449
|
+
|
|
450
|
+
</details>
|
|
451
|
+
|
|
385
452
|
### 🖱️ Events
|
|
386
453
|
|
|
387
454
|
<details>
|
|
@@ -683,6 +750,7 @@ All packages are comprehensively tested using Vitest to ensure reliability and s
|
|
|
683
750
|
| use-timer | 83.8% | 72.63% | 93.93% | 84.13% |
|
|
684
751
|
| use-geolocation | 90% | 85% | 95% | 90% |
|
|
685
752
|
| use-intersection-observer | 94% | 85% | 95% | 93.93% |
|
|
753
|
+
| use-signal | 98.61% | 90.9% | 96.42% | 98.59% |
|
|
686
754
|
|
|
687
755
|
---
|
|
688
756
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ClickAnyWhereHandler, UseClickAnyWhereOptions, useClickAnyWhere } from '@usefy/use-click-any-where';
|
|
2
2
|
export { CopyFn, UseCopyToClipboardOptions, UseCopyToClipboardReturn, useCopyToClipboard } from '@usefy/use-copy-to-clipboard';
|
|
3
3
|
export { useCounter } from '@usefy/use-counter';
|
|
4
|
+
export { SignalInfo, SignalOptions, UseSignalReturn, useSignal } from '@usefy/use-signal';
|
|
4
5
|
export { UseToggleReturn, useToggle } from '@usefy/use-toggle';
|
|
5
6
|
export { UseDebounceOptions, useDebounce } from '@usefy/use-debounce';
|
|
6
7
|
export { DebouncedFunction, UseDebounceCallbackOptions, useDebounceCallback } from '@usefy/use-debounce-callback';
|
|
@@ -15,3 +16,4 @@ export { UseUnmountOptions, useUnmount } from '@usefy/use-unmount';
|
|
|
15
16
|
export { UseInitOptions, UseInitResult, useInit } from '@usefy/use-init';
|
|
16
17
|
export { GeoCoordinates, GeoPosition, GeolocationError, GeolocationErrorCode, PermissionState, UseGeolocationOptions, UseGeolocationReturn, calculateBearing, haversineDistance, useGeolocation } from '@usefy/use-geolocation';
|
|
17
18
|
export { IntersectionEntry, OnChangeCallback, UseIntersectionObserverOptions, UseIntersectionObserverReturn, createInitialEntry, isIntersectionObserverSupported, toIntersectionEntry, useIntersectionObserver } from '@usefy/use-intersection-observer';
|
|
19
|
+
export { AvailableMetric, BrowserSupport, CircularBuffer, FallbackStrategy, FormattedMemory, LeakAnalysis, LeakSensitivity, MemoryInfo, MemorySnapshot, Severity, SnapshotDiff, SupportLevel, Trend, UnsupportedInfo, UseMemoryMonitorOptions, UseMemoryMonitorReturn, analyzeLeakProbability, calculateTrend, detectSupport, formatBytes, linearRegression, useMemoryMonitor } from '@usefy/use-memory-monitor';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { ClickAnyWhereHandler, UseClickAnyWhereOptions, useClickAnyWhere } from '@usefy/use-click-any-where';
|
|
2
2
|
export { CopyFn, UseCopyToClipboardOptions, UseCopyToClipboardReturn, useCopyToClipboard } from '@usefy/use-copy-to-clipboard';
|
|
3
3
|
export { useCounter } from '@usefy/use-counter';
|
|
4
|
+
export { SignalInfo, SignalOptions, UseSignalReturn, useSignal } from '@usefy/use-signal';
|
|
4
5
|
export { UseToggleReturn, useToggle } from '@usefy/use-toggle';
|
|
5
6
|
export { UseDebounceOptions, useDebounce } from '@usefy/use-debounce';
|
|
6
7
|
export { DebouncedFunction, UseDebounceCallbackOptions, useDebounceCallback } from '@usefy/use-debounce-callback';
|
|
@@ -15,3 +16,4 @@ export { UseUnmountOptions, useUnmount } from '@usefy/use-unmount';
|
|
|
15
16
|
export { UseInitOptions, UseInitResult, useInit } from '@usefy/use-init';
|
|
16
17
|
export { GeoCoordinates, GeoPosition, GeolocationError, GeolocationErrorCode, PermissionState, UseGeolocationOptions, UseGeolocationReturn, calculateBearing, haversineDistance, useGeolocation } from '@usefy/use-geolocation';
|
|
17
18
|
export { IntersectionEntry, OnChangeCallback, UseIntersectionObserverOptions, UseIntersectionObserverReturn, createInitialEntry, isIntersectionObserverSupported, toIntersectionEntry, useIntersectionObserver } from '@usefy/use-intersection-observer';
|
|
19
|
+
export { AvailableMetric, BrowserSupport, CircularBuffer, FallbackStrategy, FormattedMemory, LeakAnalysis, LeakSensitivity, MemoryInfo, MemorySnapshot, Severity, SnapshotDiff, SupportLevel, Trend, UnsupportedInfo, UseMemoryMonitorOptions, UseMemoryMonitorReturn, analyzeLeakProbability, calculateTrend, detectSupport, formatBytes, linearRegression, useMemoryMonitor } from '@usefy/use-memory-monitor';
|
package/dist/index.js
CHANGED
|
@@ -20,10 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
CircularBuffer: () => import_use_memory_monitor.CircularBuffer,
|
|
24
|
+
analyzeLeakProbability: () => import_use_memory_monitor.analyzeLeakProbability,
|
|
23
25
|
calculateBearing: () => import_use_geolocation.calculateBearing,
|
|
26
|
+
calculateTrend: () => import_use_memory_monitor.calculateTrend,
|
|
24
27
|
createInitialEntry: () => import_use_intersection_observer.createInitialEntry,
|
|
28
|
+
detectSupport: () => import_use_memory_monitor.detectSupport,
|
|
29
|
+
formatBytes: () => import_use_memory_monitor.formatBytes,
|
|
25
30
|
haversineDistance: () => import_use_geolocation.haversineDistance,
|
|
26
31
|
isIntersectionObserverSupported: () => import_use_intersection_observer.isIntersectionObserverSupported,
|
|
32
|
+
linearRegression: () => import_use_memory_monitor.linearRegression,
|
|
27
33
|
toIntersectionEntry: () => import_use_intersection_observer.toIntersectionEntry,
|
|
28
34
|
useClickAnyWhere: () => import_use_click_any_where.useClickAnyWhere,
|
|
29
35
|
useCopyToClipboard: () => import_use_copy_to_clipboard.useCopyToClipboard,
|
|
@@ -35,8 +41,10 @@ __export(index_exports, {
|
|
|
35
41
|
useInit: () => import_use_init.useInit,
|
|
36
42
|
useIntersectionObserver: () => import_use_intersection_observer.useIntersectionObserver,
|
|
37
43
|
useLocalStorage: () => import_use_local_storage.useLocalStorage,
|
|
44
|
+
useMemoryMonitor: () => import_use_memory_monitor.useMemoryMonitor,
|
|
38
45
|
useOnClickOutside: () => import_use_on_click_outside.useOnClickOutside,
|
|
39
46
|
useSessionStorage: () => import_use_session_storage.useSessionStorage,
|
|
47
|
+
useSignal: () => import_use_signal.useSignal,
|
|
40
48
|
useThrottle: () => import_use_throttle.useThrottle,
|
|
41
49
|
useThrottleCallback: () => import_use_throttle_callback.useThrottleCallback,
|
|
42
50
|
useTimer: () => import_use_timer.useTimer,
|
|
@@ -47,6 +55,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
47
55
|
var import_use_click_any_where = require("@usefy/use-click-any-where");
|
|
48
56
|
var import_use_copy_to_clipboard = require("@usefy/use-copy-to-clipboard");
|
|
49
57
|
var import_use_counter = require("@usefy/use-counter");
|
|
58
|
+
var import_use_signal = require("@usefy/use-signal");
|
|
50
59
|
var import_use_toggle = require("@usefy/use-toggle");
|
|
51
60
|
var import_use_debounce = require("@usefy/use-debounce");
|
|
52
61
|
var import_use_debounce_callback = require("@usefy/use-debounce-callback");
|
|
@@ -61,12 +70,19 @@ var import_use_unmount = require("@usefy/use-unmount");
|
|
|
61
70
|
var import_use_init = require("@usefy/use-init");
|
|
62
71
|
var import_use_geolocation = require("@usefy/use-geolocation");
|
|
63
72
|
var import_use_intersection_observer = require("@usefy/use-intersection-observer");
|
|
73
|
+
var import_use_memory_monitor = require("@usefy/use-memory-monitor");
|
|
64
74
|
// Annotate the CommonJS export names for ESM import in node:
|
|
65
75
|
0 && (module.exports = {
|
|
76
|
+
CircularBuffer,
|
|
77
|
+
analyzeLeakProbability,
|
|
66
78
|
calculateBearing,
|
|
79
|
+
calculateTrend,
|
|
67
80
|
createInitialEntry,
|
|
81
|
+
detectSupport,
|
|
82
|
+
formatBytes,
|
|
68
83
|
haversineDistance,
|
|
69
84
|
isIntersectionObserverSupported,
|
|
85
|
+
linearRegression,
|
|
70
86
|
toIntersectionEntry,
|
|
71
87
|
useClickAnyWhere,
|
|
72
88
|
useCopyToClipboard,
|
|
@@ -78,8 +94,10 @@ var import_use_intersection_observer = require("@usefy/use-intersection-observer
|
|
|
78
94
|
useInit,
|
|
79
95
|
useIntersectionObserver,
|
|
80
96
|
useLocalStorage,
|
|
97
|
+
useMemoryMonitor,
|
|
81
98
|
useOnClickOutside,
|
|
82
99
|
useSessionStorage,
|
|
100
|
+
useSignal,
|
|
83
101
|
useThrottle,
|
|
84
102
|
useThrottleCallback,
|
|
85
103
|
useTimer,
|
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\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":[]}
|
|
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// useSignal\nexport {\n useSignal,\n type UseSignalReturn,\n type SignalOptions,\n type SignalInfo,\n} from \"@usefy/use-signal\";\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\n// useMemoryMonitor\nexport {\n useMemoryMonitor,\n formatBytes,\n detectSupport,\n CircularBuffer,\n linearRegression,\n calculateTrend,\n analyzeLeakProbability,\n type UseMemoryMonitorOptions,\n type UseMemoryMonitorReturn,\n type MemoryInfo,\n type MemorySnapshot,\n type SnapshotDiff,\n type LeakAnalysis,\n type UnsupportedInfo,\n type SupportLevel,\n type AvailableMetric,\n type Severity,\n type Trend,\n type FallbackStrategy,\n type LeakSensitivity,\n type FormattedMemory,\n type BrowserSupport,\n} from \"@usefy/use-memory-monitor\";\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAIO;AAGP,mCAKO;AAGP,yBAA2B;AAG3B,wBAKO;AAGP,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;AAGP,gCAuBO;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
useCopyToClipboard
|
|
7
7
|
} from "@usefy/use-copy-to-clipboard";
|
|
8
8
|
import { useCounter } from "@usefy/use-counter";
|
|
9
|
+
import {
|
|
10
|
+
useSignal
|
|
11
|
+
} from "@usefy/use-signal";
|
|
9
12
|
import { useToggle } from "@usefy/use-toggle";
|
|
10
13
|
import { useDebounce } from "@usefy/use-debounce";
|
|
11
14
|
import {
|
|
@@ -45,11 +48,26 @@ import {
|
|
|
45
48
|
toIntersectionEntry,
|
|
46
49
|
createInitialEntry
|
|
47
50
|
} from "@usefy/use-intersection-observer";
|
|
51
|
+
import {
|
|
52
|
+
useMemoryMonitor,
|
|
53
|
+
formatBytes,
|
|
54
|
+
detectSupport,
|
|
55
|
+
CircularBuffer,
|
|
56
|
+
linearRegression,
|
|
57
|
+
calculateTrend,
|
|
58
|
+
analyzeLeakProbability
|
|
59
|
+
} from "@usefy/use-memory-monitor";
|
|
48
60
|
export {
|
|
61
|
+
CircularBuffer,
|
|
62
|
+
analyzeLeakProbability,
|
|
49
63
|
calculateBearing,
|
|
64
|
+
calculateTrend,
|
|
50
65
|
createInitialEntry,
|
|
66
|
+
detectSupport,
|
|
67
|
+
formatBytes,
|
|
51
68
|
haversineDistance,
|
|
52
69
|
isIntersectionObserverSupported,
|
|
70
|
+
linearRegression,
|
|
53
71
|
toIntersectionEntry,
|
|
54
72
|
useClickAnyWhere,
|
|
55
73
|
useCopyToClipboard,
|
|
@@ -61,8 +79,10 @@ export {
|
|
|
61
79
|
useInit,
|
|
62
80
|
useIntersectionObserver,
|
|
63
81
|
useLocalStorage,
|
|
82
|
+
useMemoryMonitor,
|
|
64
83
|
useOnClickOutside,
|
|
65
84
|
useSessionStorage,
|
|
85
|
+
useSignal,
|
|
66
86
|
useThrottle,
|
|
67
87
|
useThrottleCallback,
|
|
68
88
|
useTimer,
|
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\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":[]}
|
|
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// useSignal\nexport {\n useSignal,\n type UseSignalReturn,\n type SignalOptions,\n type SignalInfo,\n} from \"@usefy/use-signal\";\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\n// useMemoryMonitor\nexport {\n useMemoryMonitor,\n formatBytes,\n detectSupport,\n CircularBuffer,\n linearRegression,\n calculateTrend,\n analyzeLeakProbability,\n type UseMemoryMonitorOptions,\n type UseMemoryMonitorReturn,\n type MemoryInfo,\n type MemorySnapshot,\n type SnapshotDiff,\n type LeakAnalysis,\n type UnsupportedInfo,\n type SupportLevel,\n type AvailableMetric,\n type Severity,\n type Trend,\n type FallbackStrategy,\n type LeakSensitivity,\n type FormattedMemory,\n type BrowserSupport,\n} from \"@usefy/use-memory-monitor\";\n"],"mappings":";AAGA;AAAA,EACE;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAIK;AAGP,SAAS,kBAAkB;AAG3B;AAAA,EACE;AAAA,OAIK;AAGP,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;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAgBK;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usefy/usefy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "A collection of useful React hooks",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -17,23 +17,25 @@
|
|
|
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-
|
|
24
|
-
"@usefy/use-
|
|
25
|
-
"@usefy/use-debounce
|
|
26
|
-
"@usefy/use-
|
|
27
|
-
"@usefy/use-throttle
|
|
28
|
-
"@usefy/use-
|
|
29
|
-
"@usefy/use-
|
|
30
|
-
"@usefy/use-
|
|
31
|
-
"@usefy/use-
|
|
32
|
-
"@usefy/use-
|
|
33
|
-
"@usefy/use-
|
|
34
|
-
"@usefy/use-
|
|
35
|
-
"@usefy/use-
|
|
36
|
-
"@usefy/use-
|
|
20
|
+
"@usefy/use-click-any-where": "0.0.32",
|
|
21
|
+
"@usefy/use-copy-to-clipboard": "0.0.32",
|
|
22
|
+
"@usefy/use-counter": "0.0.32",
|
|
23
|
+
"@usefy/use-signal": "0.0.32",
|
|
24
|
+
"@usefy/use-toggle": "0.0.32",
|
|
25
|
+
"@usefy/use-debounce": "0.0.32",
|
|
26
|
+
"@usefy/use-debounce-callback": "0.0.32",
|
|
27
|
+
"@usefy/use-throttle": "0.0.32",
|
|
28
|
+
"@usefy/use-throttle-callback": "0.0.32",
|
|
29
|
+
"@usefy/use-local-storage": "0.0.32",
|
|
30
|
+
"@usefy/use-session-storage": "0.0.32",
|
|
31
|
+
"@usefy/use-on-click-outside": "0.0.32",
|
|
32
|
+
"@usefy/use-event-listener": "0.0.32",
|
|
33
|
+
"@usefy/use-timer": "0.0.32",
|
|
34
|
+
"@usefy/use-unmount": "0.0.32",
|
|
35
|
+
"@usefy/use-init": "0.0.32",
|
|
36
|
+
"@usefy/use-geolocation": "0.0.32",
|
|
37
|
+
"@usefy/use-intersection-observer": "0.0.32",
|
|
38
|
+
"@usefy/use-memory-monitor": "0.0.32"
|
|
37
39
|
},
|
|
38
40
|
"peerDependencies": {
|
|
39
41
|
"react": "^18.0.0 || ^19.0.0"
|