@himanshu-sorathiya/react-kit 1.0.24 → 1.0.26

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/dist/index.d.ts CHANGED
@@ -3,33 +3,264 @@
3
3
  import React$1 from 'react';
4
4
  import { CSSProperties, Key, RefObject } from 'react';
5
5
 
6
+ /**
7
+ * The native event that triggered a `useClickOutside` handler. Determined
8
+ * by whichever `eventType` was configured — `MouseEvent` for
9
+ * `click`/`mousedown`/`mouseup`, `TouchEvent` for `touchstart`/`touchend`,
10
+ * `PointerEvent` for `pointerdown`/`pointerup`.
11
+ */
6
12
  export type ClickOutsideEvent = MouseEvent | TouchEvent | PointerEvent | Event;
7
- export type ClickOutsideTarget = HTMLElement | null;
13
+ /**
14
+ * A single element to check clicks against, or `null` if it isn't mounted
15
+ * yet.
16
+ */
17
+ export type ClickOutsideTarget = Element | null;
18
+ /**
19
+ * A way of referring to a single {@link ClickOutsideTarget}: a React ref
20
+ * that will (eventually) point at the element, the element itself, or
21
+ * `null`.
22
+ *
23
+ * A ref whose `current` is `null` — for example, because the element hasn't
24
+ * mounted yet — is treated as "outside" for that entry rather than blocking
25
+ * detection. See `useClickOutside`'s docs for details.
26
+ */
8
27
  export type ClickOutsideTargetRef = React$1.RefObject<ClickOutsideTarget> | ClickOutsideTarget;
28
+ /**
29
+ * Native events `useClickOutside` can listen for. Defaults to `mousedown`
30
+ * and `touchstart`, which fire before `click`/`mouseup` — this avoids
31
+ * misfiring when a user starts a drag or text selection inside the target
32
+ * and releases outside it.
33
+ */
34
+ export type ClickOutsideEventName = "mousedown" | "mouseup" | "click" | "touchstart" | "touchend" | "pointerdown" | "pointerup";
35
+ /**
36
+ * Options accepted by `useClickOutside`.
37
+ */
9
38
  export interface UseClickOutsideOptions {
39
+ /**
40
+ * Whether the listener is active. Setting this to `false` fully detaches
41
+ * the underlying listener rather than just skipping the check on each
42
+ * click, so there's no runtime cost while disabled.
43
+ *
44
+ * @default true
45
+ */
10
46
  enabled?: boolean;
11
- eventType?: string | string[];
12
- }
13
- export type UseClickOutsideReturn = void;
47
+ /**
48
+ * The event(s) that count as a "click." See {@link ClickOutsideEventName}
49
+ * for why `mousedown`/`touchstart` are the default.
50
+ *
51
+ * @default ["mousedown", "touchstart"]
52
+ */
53
+ eventType?: ClickOutsideEventName | ClickOutsideEventName[];
54
+ /**
55
+ * Whether the listener is registered in the capture phase.
56
+ *
57
+ * Defaults to `true` so this keeps working even if some element between
58
+ * the click and `document` calls `event.stopPropagation()` — a common
59
+ * cause of "click outside stopped working" bugs in bubble-phase
60
+ * listeners.
61
+ *
62
+ * @default true
63
+ */
64
+ capture?: boolean;
65
+ }
66
+ /**
67
+ * A function that detaches the listener registered by `useClickOutside`
68
+ * immediately, without waiting for the component to unmount.
69
+ *
70
+ * Safe to call more than once. Note that this does not permanently disable
71
+ * the hook: if `target`, `eventType`, `enabled`, or `capture` change
72
+ * afterwards, a new listener may be attached again on the next render.
73
+ */
74
+ export type UseClickOutsideReturn = () => void;
75
+ /**
76
+ * Calls `handler` when a click (or the configured event type) happens
77
+ * outside of `target`.
78
+ *
79
+ * `target` may be a single element/ref, or an array of them — the handler
80
+ * only fires when the click is outside *every* target in the array. An
81
+ * unmounted target (a ref whose `current` is `null`) is treated as
82
+ * "outside" for its own entry rather than blocking detection for the
83
+ * others, so it's safe to pass refs that haven't attached yet.
84
+ *
85
+ * @param target The element(s) to detect clicks outside of. Accepts a ref, a direct
86
+ * element, `null`, or an array mixing any of those.
87
+ * @param handler Called with the native event when a click outside is detected. Doesn't
88
+ * need to be memoized.
89
+ * @param options See {@link UseClickOutsideOptions}.
90
+ * @returns A function that detaches the listener on demand.
91
+ *
92
+ * @example
93
+ * ```tsx
94
+ * const modalRef = useRef<HTMLDivElement>(null);
95
+ * useClickOutside(modalRef, () => setOpen(false));
96
+ * ```
97
+ *
98
+ * @example
99
+ * Checking outside multiple elements at once — for example, a dropdown that
100
+ * shouldn't close when its own trigger button is clicked:
101
+ * ```tsx
102
+ * const triggerRef = useRef<HTMLButtonElement>(null);
103
+ * const panelRef = useRef<HTMLDivElement>(null);
104
+ * useClickOutside([triggerRef, panelRef], () => setOpen(false));
105
+ * ```
106
+ */
14
107
  export declare function useClickOutside(target: ClickOutsideTargetRef | ClickOutsideTargetRef[], handler: (event: ClickOutsideEvent) => void, options?: UseClickOutsideOptions): UseClickOutsideReturn;
108
+ /**
109
+ * Any valid DOM event target — the broadest type a listener can be attached
110
+ * to. Used as the generic constraint for {@link UseEventListenerOptions} and
111
+ * {@link TargetRef}.
112
+ */
15
113
  export type TargetType = EventTarget;
114
+ /**
115
+ * A way of referring to a listener target: a React ref that will
116
+ * (eventually) point at the target, the target itself, or `null`.
117
+ *
118
+ * Passing `null` — or a ref whose `current` is `null` — means no listener is
119
+ * attached.
120
+ */
16
121
  export type TargetRef<T extends TargetType> = React$1.RefObject<T | null> | T | null;
122
+ /**
123
+ * Options accepted by `useEventListener`, extending the native
124
+ * `AddEventListenerOptions` (`capture`, `passive`, `once`) with a `target`
125
+ * to attach to.
126
+ */
17
127
  export interface UseEventListenerOptions<T extends TargetType> extends AddEventListenerOptions {
128
+ /**
129
+ * The element, ref, `window`, or `document` to attach the listener to.
130
+ *
131
+ * - Omitted → defaults to `window` (or does nothing during SSR, where
132
+ * `window` doesn't exist).
133
+ * - `null`, or a ref whose `current` is `null` → no listener is attached.
134
+ */
18
135
  target?: TargetRef<T>;
19
- }
20
- export type UseEventListenerReturn = void;
136
+ /**
137
+ * An `AbortSignal` to detach the listener(s) from outside the hook.
138
+ *
139
+ * This is combined with the hook's own internal cleanup — aborting this
140
+ * signal detaches the listener(s) immediately, the same as calling the
141
+ * function the hook returns.
142
+ */
143
+ signal?: AbortSignal;
144
+ }
145
+ /**
146
+ * A function that detaches the listener(s) registered by `useEventListener`
147
+ * immediately, without waiting for the component to unmount.
148
+ *
149
+ * Safe to call more than once — it's a no-op after the first call. Note
150
+ * that this does not permanently disable the hook: if its dependencies
151
+ * (event name(s), target, `capture`, `passive`, `once`, or `signal`) change
152
+ * afterwards, a new listener may be attached again on the next render.
153
+ */
154
+ export type UseEventListenerReturn = () => void;
155
+ /**
156
+ * Listens for one or more events on `window` — the default target when none
157
+ * is specified.
158
+ *
159
+ * @param eventName A single event name, or an array of event names, to listen for.
160
+ * @param handler Called with the native event whenever it fires. Doesn't need to be
161
+ * memoized — the latest `handler` is always used, and changing it does not
162
+ * re-attach the listener.
163
+ * @param options Optional. `target` may be omitted (defaults to `window`), or set
164
+ * explicitly to `window` or `null` (to disable).
165
+ * @returns A function that detaches the listener(s) on demand.
166
+ *
167
+ * @example
168
+ * ```tsx
169
+ * useEventListener("resize", () => {
170
+ * console.log(window.innerWidth);
171
+ * });
172
+ * ```
173
+ */
21
174
  export declare function useEventListener<K extends keyof WindowEventMap>(eventName: K | K[], handler: (event: WindowEventMap[K]) => void, options?: UseEventListenerOptions<Window> & {
22
175
  target?: Window | null | undefined;
23
176
  }): UseEventListenerReturn;
177
+ /**
178
+ * Listens for one or more events on `document`. `target` is required to
179
+ * distinguish this overload from the `window` one.
180
+ *
181
+ * @param eventName A single event name, or an array of event names, to listen for.
182
+ * @param handler Called with the native event whenever it fires. Doesn't need to be
183
+ * memoized — the latest `handler` is always used, and changing it does not
184
+ * re-attach the listener.
185
+ * @param options `target` must be `document`, a ref pointing at `document`, or `null`
186
+ * (to disable).
187
+ * @returns A function that detaches the listener(s) on demand.
188
+ *
189
+ * @example
190
+ * ```tsx
191
+ * useEventListener("visibilitychange", () => {
192
+ * console.log(document.visibilityState);
193
+ * }, { target: document });
194
+ * ```
195
+ */
24
196
  export declare function useEventListener<K extends keyof DocumentEventMap>(eventName: K | K[], handler: (event: DocumentEventMap[K]) => void, options: UseEventListenerOptions<Document> & {
25
197
  target: Document | React$1.RefObject<Document | null> | null;
26
198
  }): UseEventListenerReturn;
199
+ /**
200
+ * Listens for one or more events on an `HTMLElement`, via a ref or the
201
+ * element itself.
202
+ *
203
+ * @param eventName A single event name, or an array of event names, to listen for.
204
+ * @param handler Called with the native event whenever it fires. Doesn't need to be
205
+ * memoized — the latest `handler` is always used, and changing it does not
206
+ * re-attach the listener.
207
+ * @param options `target` must be the element, a ref to it, or `null` (to disable —
208
+ * for example while the ref hasn't attached to a DOM node yet).
209
+ * @returns A function that detaches the listener(s) on demand.
210
+ *
211
+ * @example
212
+ * ```tsx
213
+ * const buttonRef = useRef<HTMLButtonElement>(null);
214
+ * useEventListener("click", () => {
215
+ * console.log("clicked");
216
+ * }, { target: buttonRef });
217
+ * ```
218
+ */
27
219
  export declare function useEventListener<K extends keyof HTMLElementEventMap, T extends HTMLElement = HTMLElement>(eventName: K | K[], handler: (event: HTMLElementEventMap[K]) => void, options: UseEventListenerOptions<T> & {
28
220
  target: T | React$1.RefObject<T | null> | null;
29
221
  }): UseEventListenerReturn;
222
+ /**
223
+ * Listens for one or more events on an `SVGElement`, via a ref or the
224
+ * element itself.
225
+ *
226
+ * @param eventName A single event name, or an array of event names, to listen for.
227
+ * @param handler Called with the native event whenever it fires. Doesn't need to be
228
+ * memoized — the latest `handler` is always used, and changing it does not
229
+ * re-attach the listener.
230
+ * @param options `target` must be the element, a ref to it, or `null` (to disable).
231
+ * @returns A function that detaches the listener(s) on demand.
232
+ *
233
+ * @example
234
+ * ```tsx
235
+ * const circleRef = useRef<SVGCircleElement>(null);
236
+ * useEventListener("click", () => {
237
+ * console.log("circle clicked");
238
+ * }, { target: circleRef });
239
+ * ```
240
+ */
30
241
  export declare function useEventListener<K extends keyof SVGElementEventMap, T extends SVGElement = SVGElement>(eventName: K | K[], handler: (event: SVGElementEventMap[K]) => void, options: UseEventListenerOptions<T> & {
31
242
  target: T | React$1.RefObject<T | null> | null;
32
243
  }): UseEventListenerReturn;
244
+ /**
245
+ * Listens for one or more events on any other `EventTarget` — a custom
246
+ * event emitter, `ShadowRoot`, `MessagePort`, and so on. Since there's no
247
+ * matching `*EventMap` for arbitrary targets, events are typed as the
248
+ * generic `Event`.
249
+ *
250
+ * @param eventName A single event name, or an array of event names, to listen for.
251
+ * @param handler Called with the native event whenever it fires. Doesn't need to be
252
+ * memoized — the latest `handler` is always used, and changing it does not
253
+ * re-attach the listener.
254
+ * @param options `target` must be the target, a ref to it, or `null` (to disable).
255
+ * @returns A function that detaches the listener(s) on demand.
256
+ *
257
+ * @example
258
+ * ```tsx
259
+ * useEventListener("message", (event) => {
260
+ * console.log(event);
261
+ * }, { target: myMessagePort });
262
+ * ```
263
+ */
33
264
  export declare function useEventListener<K extends string, T extends TargetType = TargetType>(eventName: K | K[], handler: (event: Event) => void, options: UseEventListenerOptions<T> & {
34
265
  target: T | React$1.RefObject<T | null> | null;
35
266
  }): UseEventListenerReturn;
@@ -38,27 +269,154 @@ declare const validKeyEventTypes: readonly [
38
269
  "keyup",
39
270
  "keypress"
40
271
  ];
272
+ /**
273
+ * The keyboard event types `useKey` can listen for. See
274
+ * {@link validKeyEventTypes}.
275
+ */
41
276
  export type KeyEventType = (typeof validKeyEventTypes)[number];
42
- export interface BaseKeyOptions {
277
+ /**
278
+ * Options shared by both variants of {@link UseKeyOptions}.
279
+ */
280
+ export interface UseKeyBaseOptions {
281
+ /**
282
+ * Whether the listener is active. Setting this to `false` fully detaches
283
+ * the underlying listener rather than just skipping the check on each
284
+ * keystroke, so there's no runtime cost while disabled.
285
+ *
286
+ * @default true
287
+ */
43
288
  enabled?: boolean;
44
- target?: React$1.RefObject<HTMLElement | null> | Window;
289
+ /**
290
+ * The element, ref, `window`, or `document` to attach the listener to.
291
+ *
292
+ * @default window
293
+ */
294
+ target?: React$1.RefObject<HTMLElement | null> | HTMLElement | Window | Document | null;
295
+ /**
296
+ * Whether to call `event.preventDefault()` when `key` matches. Applied
297
+ * before `handler` is called, so it still takes effect even if `handler`
298
+ * throws.
299
+ *
300
+ * @default true
301
+ */
45
302
  preventDefault?: boolean;
303
+ /**
304
+ * Whether to call `event.stopPropagation()` when `key` matches. Applied
305
+ * before `handler` is called, so it still takes effect even if `handler`
306
+ * throws.
307
+ *
308
+ * @default true
309
+ */
46
310
  stopPropagation?: boolean;
311
+ /**
312
+ * Whether the listener is registered in the capture phase.
313
+ *
314
+ * Unlike `useClickOutside`, this defaults to `false`. Flip it to `true`
315
+ * if a descendant element calling `event.stopPropagation()` is
316
+ * preventing this shortcut from firing.
317
+ *
318
+ * @default false
319
+ */
320
+ capture?: boolean;
321
+ /**
322
+ * Whether to ignore the keystroke while focus is inside an `<input>`,
323
+ * `<textarea>`, `<select>`, or any `contenteditable` element — so a
324
+ * shortcut like a bare `"s"` doesn't fire while someone is just typing.
325
+ *
326
+ * @default true
327
+ */
47
328
  ignoreWhenFocusedInInputs?: boolean;
329
+ /**
330
+ * Whether the Ctrl key must be held for a match.
331
+ * @default false
332
+ */
48
333
  ctrlKey?: boolean;
334
+ /**
335
+ * Whether the Shift key must be held for a match.
336
+ * @default false
337
+ */
49
338
  shiftKey?: boolean;
339
+ /**
340
+ * Whether the Alt key (Option, on Mac) must be held for a match.
341
+ * @default false
342
+ */
50
343
  altKey?: boolean;
344
+ /**
345
+ * Whether the Meta key (Cmd on Mac, the Windows key elsewhere) must be
346
+ * held for a match.
347
+ * @default false
348
+ */
51
349
  metaKey?: boolean;
52
350
  }
53
- export type KeyOptions = BaseKeyOptions & ({
54
- eventType?: "keydown" | "keypress";
351
+ /**
352
+ * Options accepted by `useKey`.
353
+ *
354
+ * `preventRepeat` is only valid together with `eventType: "keydown"` or
355
+ * `"keypress"` — TypeScript rejects it on `"keyup"`, since a keyup event is
356
+ * never marked as auto-repeating.
357
+ */
358
+ export type UseKeyOptions = UseKeyBaseOptions & ({
359
+ /**
360
+ * Which keyboard event to listen for.
361
+ * @default "keydown"
362
+ */
363
+ eventType?: Extract<KeyEventType, "keydown" | "keypress">;
364
+ /**
365
+ * If `true`, ignores auto-repeated events fired while the key is
366
+ * held down (based on the native `KeyboardEvent.repeat` flag), so
367
+ * `handler` only fires once per physical press rather than
368
+ * repeatedly while it's held.
369
+ *
370
+ * @default false
371
+ */
55
372
  preventRepeat?: boolean;
56
373
  } | {
57
- eventType: "keyup";
374
+ eventType: Extract<KeyEventType, "keyup">;
58
375
  preventRepeat?: never;
59
376
  });
60
- export type UseKeyReturn = void;
61
- export declare function useKey(key: string, handler: (e: KeyboardEvent) => void, { enabled, preventDefault, stopPropagation, eventType, preventRepeat, ignoreWhenFocusedInInputs, ctrlKey, shiftKey, altKey, metaKey, target, }?: KeyOptions): UseKeyReturn;
377
+ /**
378
+ * A function that detaches the listener registered by `useKey` immediately,
379
+ * without waiting for the component to unmount.
380
+ *
381
+ * Safe to call more than once. Note that this does not permanently disable
382
+ * the hook: if `eventType`, `enabled`, `target`, or `capture` change
383
+ * afterwards, a new listener may be attached again on the next render.
384
+ * Changing `key` — or any of the modifier-matching options — does *not*
385
+ * cause a re-attach; those are picked up fresh on the next keystroke
386
+ * without the underlying listener ever being torn down.
387
+ */
388
+ export type UseKeyReturn = () => void;
389
+ /**
390
+ * Calls `handler` when `key` is pressed (or released, depending on
391
+ * `eventType`), optionally matching an exact combination of modifier keys.
392
+ *
393
+ * Ignores keystrokes that occur during IME composition (for example, while
394
+ * typing pinyin or romaji before a CJK character is confirmed), so
395
+ * shortcuts don't misfire or interfere with the IME's own confirmation key
396
+ * — often Enter. By default, also ignores keystrokes while focus is inside
397
+ * a text input, textarea, select, or contenteditable element — see
398
+ * `ignoreWhenFocusedInInputs` in {@link UseKeyOptions}.
399
+ *
400
+ * @param key The key to match, compared case-insensitively against
401
+ * `KeyboardEvent.key` (e.g. `"Escape"`, `"a"`, `"Enter"`).
402
+ * @param handler Called with the native event when a match is found. Doesn't need to be
403
+ * memoized.
404
+ * @param options See {@link UseKeyOptions}.
405
+ * @returns A function that detaches the listener on demand.
406
+ *
407
+ * @example
408
+ * ```tsx
409
+ * useKey("Escape", () => setOpen(false));
410
+ * ```
411
+ *
412
+ * @example
413
+ * Matching a modifier combination — all four modifier flags are matched
414
+ * exactly, so this only fires for Ctrl+K alone, not Ctrl+Shift+K:
415
+ * ```tsx
416
+ * useKey("k", () => openCommandPalette(), { ctrlKey: true });
417
+ * ```
418
+ */
419
+ export declare function useKey(key: string, handler: (event: KeyboardEvent) => void, options?: UseKeyOptions): UseKeyReturn;
62
420
  export interface DebounceOptions {
63
421
  maxWait?: number;
64
422
  leading?: boolean;
@@ -458,6 +816,44 @@ export interface UseSortReturn<T> {
458
816
  getSortIndex: (id: string) => number | undefined;
459
817
  }
460
818
  export declare function useSort<T>(data?: T[], initialSorts?: SortState): UseSortReturn<T>;
819
+ export interface StorageSerializer<T> {
820
+ serialize: (value: T) => string;
821
+ deserialize: (raw: string) => T;
822
+ }
823
+ export interface BaseStorageOptions<T> {
824
+ serializer?: StorageSerializer<T>;
825
+ initializeWithValue?: boolean;
826
+ sameInstanceSync?: boolean;
827
+ }
828
+ export interface StorageCustomEventDetail {
829
+ value: string | null;
830
+ instanceId: symbol;
831
+ }
832
+ export interface UseLocalStorageOptions<T> extends BaseStorageOptions<T> {
833
+ crossInstanceSync?: boolean;
834
+ }
835
+ export interface UseLocalStorageReturn<T> {
836
+ value: T | undefined;
837
+ setValue: (valueOrUpdater: T | ((prev: T | undefined) => T)) => void;
838
+ removeValue: () => void;
839
+ isHydrated: boolean;
840
+ error: Error | null;
841
+ }
842
+ export declare function useLocalStorage<T = unknown>(key: string, initialValue?: T, options?: UseLocalStorageOptions<T>): UseLocalStorageReturn<T>;
843
+ export type UseSessionStorageOptions<T> = BaseStorageOptions<T>;
844
+ export interface UseSessionStorageReturn<T> {
845
+ value: T | undefined;
846
+ setValue: (valueOrUpdater: T | ((prev: T | undefined) => T)) => void;
847
+ removeValue: () => void;
848
+ isHydrated: boolean;
849
+ error: Error | null;
850
+ }
851
+ export declare function useSessionStorage<T = unknown>(key: string, initialValue?: T, options?: UseSessionStorageOptions<T>): UseSessionStorageReturn<T>;
852
+ export declare const defaultSerializer: StorageSerializer<unknown>;
853
+ export declare function mapSerializer<K, V>(): StorageSerializer<Map<K, V>>;
854
+ export declare function setSerializer<V>(): StorageSerializer<Set<V>>;
855
+ export declare const dateSerializer: StorageSerializer<Date>;
856
+ export declare const bigIntSerializer: StorageSerializer<bigint>;
461
857
  export interface FuzzyHighlighterProps {
462
858
  text: string;
463
859
  query: string;
package/dist/index.js CHANGED
@@ -2,5 +2,6 @@ import { t as e } from "./useEventListener.js";
2
2
  import { n as t, t as n } from "./events2.js";
3
3
  import { a as r, c as i, d as a, f as o, i as s, l as c, n as l, o as u, r as d, s as f, t as p, u as m } from "./performance2.js";
4
4
  import { a as h, c as g, i as _, n as v, o as y, r as b, s as x, t as S } from "./state2.js";
5
- import { a as C, c as w, i as T, n as E, o as D, r as O, s as k, t as A } from "./ui2.js";
6
- export { w as FuzzyHighlighter, T as ModalLayout, t as useClickOutside, o as useDebounce, a as useDebouncedCallback, m as useDebouncedState, c as useDebouncedValue, e as useEventListener, O as useExpansion, g as useFilter, x as useFuzzySearch, y as useGrouping, n as useKey, C as useModal, D as useModalActions, k as useModalState, h as useMultipleSelection, _ as useOrder, b as usePagination, E as usePin, i as useRateLimit, f as useRateLimitedCallback, v as useSingleSelection, S as useSort, u as useThrottle, r as useThrottledCallback, s as useThrottledState, d as useThrottledValue, l as useVirtualGrid, p as useVirtualList, A as useVisibility };
5
+ import { a as C, i as w, n as T, o as E, r as D, s as O, t as k } from "./storage2.js";
6
+ import { a as A, c as j, i as M, n as N, o as P, r as F, s as I, t as L } from "./ui2.js";
7
+ export { j as FuzzyHighlighter, M as ModalLayout, D as bigIntSerializer, w as dateSerializer, C as defaultSerializer, E as mapSerializer, O as setSerializer, t as useClickOutside, o as useDebounce, a as useDebouncedCallback, m as useDebouncedState, c as useDebouncedValue, e as useEventListener, F as useExpansion, g as useFilter, x as useFuzzySearch, y as useGrouping, n as useKey, T as useLocalStorage, A as useModal, P as useModalActions, I as useModalState, h as useMultipleSelection, _ as useOrder, b as usePagination, N as usePin, i as useRateLimit, f as useRateLimitedCallback, k as useSessionStorage, v as useSingleSelection, S as useSort, u as useThrottle, r as useThrottledCallback, s as useThrottledState, d as useThrottledValue, l as useVirtualGrid, p as useVirtualList, L as useVisibility };
@@ -0,0 +1,42 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ export interface StorageSerializer<T> {
4
+ serialize: (value: T) => string;
5
+ deserialize: (raw: string) => T;
6
+ }
7
+ export interface BaseStorageOptions<T> {
8
+ serializer?: StorageSerializer<T>;
9
+ initializeWithValue?: boolean;
10
+ sameInstanceSync?: boolean;
11
+ }
12
+ export interface StorageCustomEventDetail {
13
+ value: string | null;
14
+ instanceId: symbol;
15
+ }
16
+ export interface UseLocalStorageOptions<T> extends BaseStorageOptions<T> {
17
+ crossInstanceSync?: boolean;
18
+ }
19
+ export interface UseLocalStorageReturn<T> {
20
+ value: T | undefined;
21
+ setValue: (valueOrUpdater: T | ((prev: T | undefined) => T)) => void;
22
+ removeValue: () => void;
23
+ isHydrated: boolean;
24
+ error: Error | null;
25
+ }
26
+ export declare function useLocalStorage<T = unknown>(key: string, initialValue?: T, options?: UseLocalStorageOptions<T>): UseLocalStorageReturn<T>;
27
+ export type UseSessionStorageOptions<T> = BaseStorageOptions<T>;
28
+ export interface UseSessionStorageReturn<T> {
29
+ value: T | undefined;
30
+ setValue: (valueOrUpdater: T | ((prev: T | undefined) => T)) => void;
31
+ removeValue: () => void;
32
+ isHydrated: boolean;
33
+ error: Error | null;
34
+ }
35
+ export declare function useSessionStorage<T = unknown>(key: string, initialValue?: T, options?: UseSessionStorageOptions<T>): UseSessionStorageReturn<T>;
36
+ export declare const defaultSerializer: StorageSerializer<unknown>;
37
+ export declare function mapSerializer<K, V>(): StorageSerializer<Map<K, V>>;
38
+ export declare function setSerializer<V>(): StorageSerializer<Set<V>>;
39
+ export declare const dateSerializer: StorageSerializer<Date>;
40
+ export declare const bigIntSerializer: StorageSerializer<bigint>;
41
+
42
+ export {};
@@ -0,0 +1,2 @@
1
+ import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./storage2.js";
2
+ export { i as bigIntSerializer, t as dateSerializer, e as defaultSerializer, r as mapSerializer, a as setSerializer, n as useLocalStorage, o as useSessionStorage };