@reactuses/core 4.0.10 → 4.0.13
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.cjs +2954 -5429
- package/dist/index.d.cts +886 -0
- package/dist/index.d.mts +886 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.mjs +2952 -5426
- package/package.json +22 -15
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,886 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default, { MutableRefObject, useEffect, useLayoutEffect, Dispatch, SetStateAction, DependencyList, EffectCallback, RefObject, CSSProperties } from 'react';
|
|
3
|
+
import * as lodash from 'lodash';
|
|
4
|
+
import Cookies from 'js-cookie';
|
|
5
|
+
|
|
6
|
+
declare function usePrevious<T>(state: T): T | undefined;
|
|
7
|
+
|
|
8
|
+
declare function useLatest<T>(value: T): MutableRefObject<T>;
|
|
9
|
+
|
|
10
|
+
declare function useFirstMountState(): boolean;
|
|
11
|
+
|
|
12
|
+
declare const _default$4: typeof useEffect | typeof react.useLayoutEffect;
|
|
13
|
+
|
|
14
|
+
declare const _default$3: typeof react.useEffect | typeof useLayoutEffect;
|
|
15
|
+
|
|
16
|
+
interface Serializer<T> {
|
|
17
|
+
read(raw: string): T;
|
|
18
|
+
write(value: T): string;
|
|
19
|
+
}
|
|
20
|
+
interface UseStorageOptions<T> {
|
|
21
|
+
/**
|
|
22
|
+
* Custom data serialization
|
|
23
|
+
*/
|
|
24
|
+
serializer?: Serializer<T>;
|
|
25
|
+
/**
|
|
26
|
+
* On error callback
|
|
27
|
+
*
|
|
28
|
+
* Default log error to `console.error`
|
|
29
|
+
*/
|
|
30
|
+
onError?: (error: unknown) => void;
|
|
31
|
+
/**
|
|
32
|
+
* set to storage when nodata in effect, fallback to defaults
|
|
33
|
+
*/
|
|
34
|
+
csrData?: T | (() => T);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare function useLocalStorage(key: string, defaults: string, options?: UseStorageOptions<string>): readonly [string | null, Dispatch<SetStateAction<string | null>>];
|
|
38
|
+
declare function useLocalStorage(key: string, defaults: number, options?: UseStorageOptions<number>): readonly [number | null, Dispatch<SetStateAction<number | null>>];
|
|
39
|
+
declare function useLocalStorage(key: string, defaults: boolean, options?: UseStorageOptions<boolean>): readonly [boolean | null, Dispatch<SetStateAction<boolean | null>>];
|
|
40
|
+
declare function useLocalStorage<T>(key: string, defaults: T, options?: UseStorageOptions<T>): readonly [T | null, Dispatch<SetStateAction<T | null>>];
|
|
41
|
+
declare function useLocalStorage<T = unknown>(key: string, defaults: null, options?: UseStorageOptions<T>): readonly [T | null, Dispatch<SetStateAction<T | null>>];
|
|
42
|
+
|
|
43
|
+
declare function useSessionStorage(key: string, defaults: string, options?: UseStorageOptions<string>): readonly [string | null, Dispatch<SetStateAction<string | null>>];
|
|
44
|
+
declare function useSessionStorage(key: string, defaults: number, options?: UseStorageOptions<number>): readonly [number | null, Dispatch<SetStateAction<number | null>>];
|
|
45
|
+
declare function useSessionStorage(key: string, defaults: boolean, options?: UseStorageOptions<boolean>): readonly [boolean | null, Dispatch<SetStateAction<boolean | null>>];
|
|
46
|
+
declare function useSessionStorage<T>(key: string, defaults: T, options?: UseStorageOptions<T>): readonly [T | null, Dispatch<SetStateAction<T | null>>];
|
|
47
|
+
declare function useSessionStorage<T = unknown>(key: string, defaults: null, options?: UseStorageOptions<T>): readonly [T | null, Dispatch<SetStateAction<T | null>>];
|
|
48
|
+
|
|
49
|
+
type Fn = (this: any, ...args: any[]) => any;
|
|
50
|
+
type Stoppable = [boolean, Fn, Fn];
|
|
51
|
+
type PointerType = "mouse" | "touch" | "pen";
|
|
52
|
+
interface Position {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* keep function reference immutable
|
|
59
|
+
*/
|
|
60
|
+
declare function useEvent<T extends Fn>(fn: T): T;
|
|
61
|
+
|
|
62
|
+
declare function useToggle(initialValue: boolean): [boolean, (nextValue?: any) => void];
|
|
63
|
+
|
|
64
|
+
declare function useInterval(callback: () => void, delay?: number | null, options?: {
|
|
65
|
+
immediate?: boolean;
|
|
66
|
+
}): void;
|
|
67
|
+
|
|
68
|
+
interface UseDarkOptions {
|
|
69
|
+
/**
|
|
70
|
+
* CSS Selector for the target element applying to
|
|
71
|
+
*
|
|
72
|
+
* @default 'html'
|
|
73
|
+
*/
|
|
74
|
+
selector?: string;
|
|
75
|
+
/**
|
|
76
|
+
* HTML attribute applying the target element
|
|
77
|
+
*
|
|
78
|
+
* @default 'class'
|
|
79
|
+
*/
|
|
80
|
+
attribute?: string;
|
|
81
|
+
/**
|
|
82
|
+
* isomorphic default value
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
defaultValue?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Key to persist the data into localStorage/sessionStorage.
|
|
88
|
+
*
|
|
89
|
+
* @default 'reactuses-color-scheme'
|
|
90
|
+
*/
|
|
91
|
+
storageKey?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Storage object, can be localStorage or sessionStorage
|
|
94
|
+
*
|
|
95
|
+
* @default localStorage
|
|
96
|
+
*/
|
|
97
|
+
storage?: () => Storage;
|
|
98
|
+
/**
|
|
99
|
+
* name dark apply to element
|
|
100
|
+
*/
|
|
101
|
+
classNameDark: string;
|
|
102
|
+
/**
|
|
103
|
+
* name light apply to element
|
|
104
|
+
*/
|
|
105
|
+
classNameLight: string;
|
|
106
|
+
}
|
|
107
|
+
declare function useDarkMode(options: UseDarkOptions): readonly [boolean | null, () => void, react.Dispatch<react.SetStateAction<boolean | null>>];
|
|
108
|
+
|
|
109
|
+
declare function useMediaQuery(query: string, defaultState?: boolean): boolean;
|
|
110
|
+
|
|
111
|
+
declare function usePreferredDark(defaultState?: boolean): boolean;
|
|
112
|
+
|
|
113
|
+
declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
114
|
+
|
|
115
|
+
declare function useMount(fn: () => void): void;
|
|
116
|
+
|
|
117
|
+
declare function useUnmount(fn: () => void): void;
|
|
118
|
+
|
|
119
|
+
interface ThrottleSettings {
|
|
120
|
+
leading?: boolean | undefined;
|
|
121
|
+
trailing?: boolean | undefined;
|
|
122
|
+
}
|
|
123
|
+
interface DebounceSettings {
|
|
124
|
+
leading?: boolean;
|
|
125
|
+
trailing?: boolean;
|
|
126
|
+
maxWait?: number;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare function useThrottle<T>(value: T, wait?: number, options?: ThrottleSettings): T;
|
|
130
|
+
|
|
131
|
+
declare function useThrottleFn<T extends (...args: any) => any>(fn: T, wait?: number, options?: ThrottleSettings): {
|
|
132
|
+
run: lodash.DebouncedFunc<(...args_0: Parameters<T>) => ReturnType<T>>;
|
|
133
|
+
cancel: () => void;
|
|
134
|
+
flush: () => ReturnType<T> | undefined;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
declare function useDebounce<T>(value: T, wait?: number, options?: DebounceSettings): T;
|
|
138
|
+
|
|
139
|
+
declare function useDebounceFn<T extends (...args: any) => any>(fn: T, wait?: number, options?: DebounceSettings): {
|
|
140
|
+
run: lodash.DebouncedFunc<(...args_0: Parameters<T>) => ReturnType<T>>;
|
|
141
|
+
cancel: () => void;
|
|
142
|
+
flush: () => ReturnType<T> | undefined;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
declare function useRafState<S>(initialState: S | (() => S)): readonly [S, Dispatch<SetStateAction<S>>];
|
|
146
|
+
|
|
147
|
+
declare function useUpdate(): () => void;
|
|
148
|
+
|
|
149
|
+
interface UseTimeoutFnOptions {
|
|
150
|
+
/**
|
|
151
|
+
* Start the timer immediate after calling this function
|
|
152
|
+
*
|
|
153
|
+
* @default false
|
|
154
|
+
*/
|
|
155
|
+
immediate?: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Wrapper for `setTimeout` with controls.
|
|
159
|
+
*
|
|
160
|
+
* @param cb
|
|
161
|
+
* @param interval
|
|
162
|
+
* @param options
|
|
163
|
+
*/
|
|
164
|
+
declare function useTimeoutFn(cb: (...args: unknown[]) => any, interval: number, options?: UseTimeoutFnOptions): Stoppable;
|
|
165
|
+
|
|
166
|
+
declare function useTimeout(ms?: number, options?: UseTimeoutFnOptions): Stoppable;
|
|
167
|
+
|
|
168
|
+
declare function useMountedState(): () => boolean;
|
|
169
|
+
|
|
170
|
+
type TargetValue<T> = T | undefined | null;
|
|
171
|
+
type TargetType = HTMLElement | Element | Window | Document | EventTarget;
|
|
172
|
+
type BasicTarget<T extends TargetType = Element> = (() => TargetValue<T>) | TargetValue<T> | MutableRefObject<TargetValue<T>>;
|
|
173
|
+
|
|
174
|
+
type Target = BasicTarget<HTMLElement | Element | Window | Document | EventTarget>;
|
|
175
|
+
declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, element?: Window, options?: boolean | AddEventListenerOptions): void;
|
|
176
|
+
declare function useEventListener<K extends keyof DocumentEventMap>(eventName: K, handler: (event: DocumentEventMap[K]) => void, element: Document, options?: boolean | AddEventListenerOptions): void;
|
|
177
|
+
declare function useEventListener<K extends keyof HTMLElementEventMap, T extends HTMLElement = HTMLDivElement>(eventName: K, handler: (event: HTMLElementEventMap[K]) => void, element: T, options?: boolean | AddEventListenerOptions): void;
|
|
178
|
+
declare function useEventListener<K extends keyof ElementEventMap>(eventName: K, handler: (event: ElementEventMap[K]) => void, element: Element, options?: boolean | AddEventListenerOptions): void;
|
|
179
|
+
declare function useEventListener<K = Event>(eventName: string, handler: (event: K) => void, element: EventTarget | null | undefined, options?: boolean | AddEventListenerOptions): void;
|
|
180
|
+
declare function useEventListener(eventName: string, handler: (...p: any) => void, element?: Target, options?: boolean | AddEventListenerOptions): void;
|
|
181
|
+
|
|
182
|
+
declare function useCounter(initialValue?: number | (() => number), max?: number | null, min?: number | null): readonly [number, (newState: number | ((prev: number) => number) | (() => number)) => void, (delta?: number) => void, (delta?: number) => void, () => void];
|
|
183
|
+
|
|
184
|
+
type RafLoopReturns = readonly [() => void, () => void, () => boolean];
|
|
185
|
+
declare function useRafFn(callback: FrameRequestCallback, initiallyActive?: boolean): RafLoopReturns;
|
|
186
|
+
|
|
187
|
+
interface IListener<T, U = void> {
|
|
188
|
+
(arg1: T, arg2: U): void;
|
|
189
|
+
}
|
|
190
|
+
interface IDisposable {
|
|
191
|
+
dispose(): void;
|
|
192
|
+
}
|
|
193
|
+
interface IEvent<T, U = void> {
|
|
194
|
+
(listener: (arg1: T, arg2: U) => any): IDisposable;
|
|
195
|
+
}
|
|
196
|
+
interface IEventOnce<T, U = void> {
|
|
197
|
+
(listener: (arg1: T, arg2: U) => any): void;
|
|
198
|
+
}
|
|
199
|
+
interface UseEventEmitterReturn<T, U = void> {
|
|
200
|
+
/**
|
|
201
|
+
* Subscribe to an event. When calling emit, the listeners will execute.
|
|
202
|
+
* @param listener watch listener.
|
|
203
|
+
* @returns a stop function to remove the current callback.
|
|
204
|
+
*/
|
|
205
|
+
event: IEvent<T, U>;
|
|
206
|
+
/**
|
|
207
|
+
* fire an event, the corresponding event listeners will execute.
|
|
208
|
+
* @param event data sent.
|
|
209
|
+
*/
|
|
210
|
+
fire: (arg1: T, arg2: U) => void;
|
|
211
|
+
/**
|
|
212
|
+
* Remove all corresponding listener.
|
|
213
|
+
*/
|
|
214
|
+
dispose: () => void;
|
|
215
|
+
}
|
|
216
|
+
declare function useEventEmitter<T, U = void>(): readonly [IEvent<T, U>, (arg1: T, arg2: U) => void, () => void];
|
|
217
|
+
|
|
218
|
+
declare function useFavicon(href: string, baseUrl?: string, rel?: string): void;
|
|
219
|
+
|
|
220
|
+
declare function useMutationObserver(callback: MutationCallback, target: BasicTarget, options?: MutationObserverInit): () => void;
|
|
221
|
+
|
|
222
|
+
type DepsEqualFnType<TDeps extends DependencyList> = (prevDeps: TDeps, nextDeps: TDeps) => boolean;
|
|
223
|
+
declare function useCustomCompareEffect<TDeps extends DependencyList>(effect: EffectCallback, deps: TDeps, depsEqual: DepsEqualFnType<TDeps>): void;
|
|
224
|
+
|
|
225
|
+
declare function useDeepCompareEffect(effect: EffectCallback, deps: DependencyList): void;
|
|
226
|
+
|
|
227
|
+
declare function useTitle(title: string): void;
|
|
228
|
+
|
|
229
|
+
interface UseScriptTagOptions {
|
|
230
|
+
/**
|
|
231
|
+
* Load the script immediately
|
|
232
|
+
*
|
|
233
|
+
* @default true
|
|
234
|
+
*/
|
|
235
|
+
immediate?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Add `async` attribute to the script tag
|
|
238
|
+
*
|
|
239
|
+
* @default true
|
|
240
|
+
*/
|
|
241
|
+
async?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Script type
|
|
244
|
+
*
|
|
245
|
+
* @default 'text/javascript'
|
|
246
|
+
*/
|
|
247
|
+
type?: string;
|
|
248
|
+
/**
|
|
249
|
+
* Manual controls the timing of loading and unloading
|
|
250
|
+
*
|
|
251
|
+
* @default false
|
|
252
|
+
*/
|
|
253
|
+
manual?: boolean;
|
|
254
|
+
crossOrigin?: "anonymous" | "use-credentials";
|
|
255
|
+
referrerPolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
256
|
+
noModule?: boolean;
|
|
257
|
+
defer?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Add custom attribute to the script tag
|
|
260
|
+
*
|
|
261
|
+
*/
|
|
262
|
+
attrs?: Record<string, string>;
|
|
263
|
+
}
|
|
264
|
+
type Status = "idle" | "loading" | "ready" | "error";
|
|
265
|
+
declare function useScriptTag(src: string, onLoaded?: (el: HTMLScriptElement) => void, options?: UseScriptTagOptions): readonly [HTMLScriptElement | null, Status, (waitForScriptLoad?: boolean) => Promise<HTMLScriptElement | boolean>, () => void];
|
|
266
|
+
|
|
267
|
+
type IState = PermissionState | "";
|
|
268
|
+
type DescriptorNamePolyfill = "accelerometer" | "accessibility-events" | "ambient-light-sensor" | "background-sync" | "camera" | "clipboard-read" | "clipboard-write" | "gyroscope" | "magnetometer" | "microphone" | "notifications" | "payment-handler" | "persistent-storage" | "push" | "speaker";
|
|
269
|
+
type GeneralPermissionDescriptor = PermissionDescriptor | {
|
|
270
|
+
name: DescriptorNamePolyfill;
|
|
271
|
+
};
|
|
272
|
+
declare function usePermission(permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor["name"]): IState;
|
|
273
|
+
|
|
274
|
+
interface UseLongPressOptions {
|
|
275
|
+
isPreventDefault?: boolean;
|
|
276
|
+
delay?: number;
|
|
277
|
+
}
|
|
278
|
+
declare function useLongPress(callback: (e: TouchEvent | MouseEvent) => void, { isPreventDefault, delay }?: UseLongPressOptions): {
|
|
279
|
+
readonly onMouseDown: (e: any) => void;
|
|
280
|
+
readonly onTouchStart: (e: any) => void;
|
|
281
|
+
readonly onMouseUp: () => void;
|
|
282
|
+
readonly onMouseLeave: () => void;
|
|
283
|
+
readonly onTouchEnd: () => void;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
declare function useObjectUrl(object: Blob | MediaSource | undefined): string | undefined;
|
|
287
|
+
|
|
288
|
+
declare function useIdle(ms?: number, initialState?: boolean, events?: (keyof WindowEventMap)[]): boolean;
|
|
289
|
+
|
|
290
|
+
interface UseMediaDeviceOptions {
|
|
291
|
+
/**
|
|
292
|
+
* Request for permissions immediately if it's not granted,
|
|
293
|
+
* otherwise label and deviceIds could be empty
|
|
294
|
+
*
|
|
295
|
+
* @default false
|
|
296
|
+
*/
|
|
297
|
+
requestPermissions?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Request for types of media permissions
|
|
300
|
+
*
|
|
301
|
+
* @default { audio: true, video: true }
|
|
302
|
+
*/
|
|
303
|
+
constraints?: MediaStreamConstraints;
|
|
304
|
+
}
|
|
305
|
+
declare function useMediaDevices(options?: UseMediaDeviceOptions): readonly [{
|
|
306
|
+
devices: {
|
|
307
|
+
deviceId: string;
|
|
308
|
+
groupId: string;
|
|
309
|
+
kind: MediaDeviceKind;
|
|
310
|
+
label: string;
|
|
311
|
+
}[];
|
|
312
|
+
}, () => Promise<boolean>];
|
|
313
|
+
|
|
314
|
+
type UseTextDirectionValue = "ltr" | "rtl" | "auto";
|
|
315
|
+
interface UseTextDirectionOptions {
|
|
316
|
+
/**
|
|
317
|
+
* CSS Selector for the target element applying to
|
|
318
|
+
*
|
|
319
|
+
* @default 'html'
|
|
320
|
+
*/
|
|
321
|
+
selector?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Initial value
|
|
324
|
+
*
|
|
325
|
+
* @default 'ltr'
|
|
326
|
+
*/
|
|
327
|
+
initialValue?: UseTextDirectionValue;
|
|
328
|
+
}
|
|
329
|
+
declare function useTextDirection(options?: UseTextDirectionOptions): readonly [UseTextDirectionValue, (value: UseTextDirectionValue) => void];
|
|
330
|
+
|
|
331
|
+
interface CursorState {
|
|
332
|
+
screenX: number;
|
|
333
|
+
screenY: number;
|
|
334
|
+
clientX: number;
|
|
335
|
+
clientY: number;
|
|
336
|
+
pageX: number;
|
|
337
|
+
pageY: number;
|
|
338
|
+
elementX: number;
|
|
339
|
+
elementY: number;
|
|
340
|
+
elementH: number;
|
|
341
|
+
elementW: number;
|
|
342
|
+
elementPosX: number;
|
|
343
|
+
elementPosY: number;
|
|
344
|
+
}
|
|
345
|
+
declare function useMouse(target?: BasicTarget): CursorState;
|
|
346
|
+
|
|
347
|
+
interface UseFpsOptions {
|
|
348
|
+
/**
|
|
349
|
+
* Calculate the FPS on every x frames.
|
|
350
|
+
* @default 10
|
|
351
|
+
*/
|
|
352
|
+
every?: number;
|
|
353
|
+
}
|
|
354
|
+
declare const _default$2: (options?: UseFpsOptions | undefined) => number;
|
|
355
|
+
|
|
356
|
+
declare function useGeolocation(options?: Partial<PositionOptions>): {
|
|
357
|
+
readonly coordinates: GeolocationCoordinates;
|
|
358
|
+
readonly locatedAt: number | null;
|
|
359
|
+
readonly error: GeolocationPositionError | null;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
interface UseFullScreenOptions {
|
|
363
|
+
onExit?: () => void;
|
|
364
|
+
onEnter?: () => void;
|
|
365
|
+
}
|
|
366
|
+
declare function useFullscreen(target: BasicTarget, options?: UseFullScreenOptions): readonly [boolean, {
|
|
367
|
+
readonly enterFullscreen: () => void;
|
|
368
|
+
readonly exitFullscreen: () => void;
|
|
369
|
+
readonly toggleFullscreen: () => void;
|
|
370
|
+
readonly isEnabled: boolean;
|
|
371
|
+
}];
|
|
372
|
+
|
|
373
|
+
interface INetworkInformation extends EventTarget {
|
|
374
|
+
readonly downlink: number;
|
|
375
|
+
readonly downlinkMax: number;
|
|
376
|
+
readonly effectiveType: "slow-2g" | "2g" | "3g" | "4g";
|
|
377
|
+
readonly rtt: number;
|
|
378
|
+
readonly saveData: boolean;
|
|
379
|
+
readonly type: "bluetooth" | "cellular" | "ethernet" | "none" | "wifi" | "wimax" | "other" | "unknown";
|
|
380
|
+
onChange: (event: Event) => void;
|
|
381
|
+
}
|
|
382
|
+
interface IUseNetworkState {
|
|
383
|
+
/**
|
|
384
|
+
* @desc Whether browser connected to the network or not.
|
|
385
|
+
*/
|
|
386
|
+
online: boolean | undefined;
|
|
387
|
+
/**
|
|
388
|
+
* @desc Previous value of `online` property. Helps to identify if browser
|
|
389
|
+
* just connected or lost connection.
|
|
390
|
+
*/
|
|
391
|
+
previous: boolean | undefined;
|
|
392
|
+
/**
|
|
393
|
+
* @desc The {Date} object pointing to the moment when state change occurred.
|
|
394
|
+
*/
|
|
395
|
+
since: Date | undefined;
|
|
396
|
+
/**
|
|
397
|
+
* @desc Effective bandwidth estimate in megabits per second, rounded to the
|
|
398
|
+
* nearest multiple of 25 kilobits per seconds.
|
|
399
|
+
*/
|
|
400
|
+
downlink: INetworkInformation["downlink"] | undefined;
|
|
401
|
+
/**
|
|
402
|
+
* @desc Maximum downlink speed, in megabits per second (Mbps), for the
|
|
403
|
+
* underlying connection technology
|
|
404
|
+
*/
|
|
405
|
+
downlinkMax: INetworkInformation["downlinkMax"] | undefined;
|
|
406
|
+
/**
|
|
407
|
+
* @desc Effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'.
|
|
408
|
+
* This value is determined using a combination of recently observed round-trip time
|
|
409
|
+
* and downlink values.
|
|
410
|
+
*/
|
|
411
|
+
effectiveType: INetworkInformation["effectiveType"] | undefined;
|
|
412
|
+
/**
|
|
413
|
+
* @desc Estimated effective round-trip time of the current connection, rounded
|
|
414
|
+
* to the nearest multiple of 25 milliseconds
|
|
415
|
+
*/
|
|
416
|
+
rtt: INetworkInformation["rtt"] | undefined;
|
|
417
|
+
/**
|
|
418
|
+
* @desc {true} if the user has set a reduced data usage option on the user agent.
|
|
419
|
+
*/
|
|
420
|
+
saveData: INetworkInformation["saveData"] | undefined;
|
|
421
|
+
/**
|
|
422
|
+
* @desc The type of connection a device is using to communicate with the network.
|
|
423
|
+
* It will be one of the following values:
|
|
424
|
+
* - bluetooth
|
|
425
|
+
* - cellular
|
|
426
|
+
* - ethernet
|
|
427
|
+
* - none
|
|
428
|
+
* - wifi
|
|
429
|
+
* - wimax
|
|
430
|
+
* - other
|
|
431
|
+
* - unknown
|
|
432
|
+
*/
|
|
433
|
+
type: INetworkInformation["type"] | undefined;
|
|
434
|
+
}
|
|
435
|
+
declare function useNetwork(): IUseNetworkState;
|
|
436
|
+
|
|
437
|
+
declare function useOnline(): boolean | undefined;
|
|
438
|
+
|
|
439
|
+
interface OrientationState {
|
|
440
|
+
angle: number;
|
|
441
|
+
type: string;
|
|
442
|
+
}
|
|
443
|
+
declare function useOrientation(initialState?: OrientationState): readonly [OrientationState, (type: OrientationLockType) => Promise<void> | undefined, () => void];
|
|
444
|
+
|
|
445
|
+
declare function useIntersectionObserver(target: BasicTarget, callback: IntersectionObserverCallback, options?: IntersectionObserverInit): () => void;
|
|
446
|
+
|
|
447
|
+
declare function usePageLeave(): boolean;
|
|
448
|
+
|
|
449
|
+
declare function useDocumentVisibility(defaultValue?: DocumentVisibilityState): DocumentVisibilityState;
|
|
450
|
+
|
|
451
|
+
declare function useResizeObserver(target: BasicTarget, callback: ResizeObserverCallback, options?: ResizeObserverOptions): () => void;
|
|
452
|
+
|
|
453
|
+
declare function useDropZone(target: BasicTarget<EventTarget>, onDrop?: (files: File[] | null) => void): boolean;
|
|
454
|
+
|
|
455
|
+
interface UseFileDialogOptions {
|
|
456
|
+
/**
|
|
457
|
+
* @default true
|
|
458
|
+
*/
|
|
459
|
+
multiple?: boolean;
|
|
460
|
+
/**
|
|
461
|
+
* @default '*'
|
|
462
|
+
*/
|
|
463
|
+
accept?: string;
|
|
464
|
+
/**
|
|
465
|
+
* Select the input source for the capture file.
|
|
466
|
+
* @see [HTMLInputElement Capture](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture)
|
|
467
|
+
*/
|
|
468
|
+
capture?: string;
|
|
469
|
+
}
|
|
470
|
+
declare function useFileDialog(options?: UseFileDialogOptions): readonly [
|
|
471
|
+
FileList | null,
|
|
472
|
+
(localOptions?: Partial<UseFileDialogOptions>) => void,
|
|
473
|
+
() => void
|
|
474
|
+
];
|
|
475
|
+
|
|
476
|
+
interface UseScrollOptions {
|
|
477
|
+
/**
|
|
478
|
+
* Throttle time for scroll event, it’s disabled by default.
|
|
479
|
+
*
|
|
480
|
+
* @default 0
|
|
481
|
+
*/
|
|
482
|
+
throttle?: number;
|
|
483
|
+
/**
|
|
484
|
+
* The check time when scrolling ends.
|
|
485
|
+
* This configuration will be setting to (throttle + idle) when the `throttle` is configured.
|
|
486
|
+
*
|
|
487
|
+
* @default 200
|
|
488
|
+
*/
|
|
489
|
+
idle?: number;
|
|
490
|
+
/**
|
|
491
|
+
* Offset arrived states by x pixels
|
|
492
|
+
*
|
|
493
|
+
*/
|
|
494
|
+
offset?: {
|
|
495
|
+
left?: number;
|
|
496
|
+
right?: number;
|
|
497
|
+
top?: number;
|
|
498
|
+
bottom?: number;
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Trigger it when scrolling.
|
|
502
|
+
*
|
|
503
|
+
*/
|
|
504
|
+
onScroll?: (e: Event) => void;
|
|
505
|
+
/**
|
|
506
|
+
* Trigger it when scrolling ends.
|
|
507
|
+
*
|
|
508
|
+
*/
|
|
509
|
+
onStop?: (e: Event) => void;
|
|
510
|
+
/**
|
|
511
|
+
* Listener options for scroll event.
|
|
512
|
+
*
|
|
513
|
+
* @default {capture: false, passive: true}
|
|
514
|
+
*/
|
|
515
|
+
eventListenerOptions?: boolean | AddEventListenerOptions;
|
|
516
|
+
}
|
|
517
|
+
declare function useScroll(target: BasicTarget<HTMLElement | SVGElement | Window | Document>, options?: UseScrollOptions): readonly [
|
|
518
|
+
number,
|
|
519
|
+
number,
|
|
520
|
+
boolean,
|
|
521
|
+
{
|
|
522
|
+
left: boolean;
|
|
523
|
+
right: boolean;
|
|
524
|
+
top: boolean;
|
|
525
|
+
bottom: boolean;
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
left: boolean;
|
|
529
|
+
right: boolean;
|
|
530
|
+
top: boolean;
|
|
531
|
+
bottom: boolean;
|
|
532
|
+
}
|
|
533
|
+
];
|
|
534
|
+
|
|
535
|
+
interface UseInfiniteScrollOptions extends UseScrollOptions {
|
|
536
|
+
/**
|
|
537
|
+
* The minimum distance between the bottom of the element and the bottom of the viewport
|
|
538
|
+
*
|
|
539
|
+
* @default 0
|
|
540
|
+
*/
|
|
541
|
+
distance?: number;
|
|
542
|
+
/**
|
|
543
|
+
* The direction in which to listen the scroll.
|
|
544
|
+
*
|
|
545
|
+
* @default 'bottom'
|
|
546
|
+
*/
|
|
547
|
+
direction?: "top" | "bottom" | "left" | "right";
|
|
548
|
+
/**
|
|
549
|
+
* Whether to preserve the current scroll position when loading more items.
|
|
550
|
+
*
|
|
551
|
+
* @default false
|
|
552
|
+
*/
|
|
553
|
+
preserveScrollPosition?: boolean;
|
|
554
|
+
}
|
|
555
|
+
declare function useInfiniteScroll(target: BasicTarget<HTMLElement | SVGElement>, onLoadMore: (state: ReturnType<typeof useScroll>) => void | Promise<void>, options?: UseInfiniteScrollOptions): void;
|
|
556
|
+
|
|
557
|
+
type KeyModifier = "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Symbol" | "SymbolLock";
|
|
558
|
+
interface UseModifierOptions {
|
|
559
|
+
/**
|
|
560
|
+
* Event names that will prompt update to modifier states
|
|
561
|
+
*
|
|
562
|
+
* @default ['mousedown', 'mouseup', 'keydown', 'keyup']
|
|
563
|
+
*/
|
|
564
|
+
events?: (keyof WindowEventMap)[];
|
|
565
|
+
/**
|
|
566
|
+
* Initial value of the returned ref
|
|
567
|
+
*
|
|
568
|
+
* @default false
|
|
569
|
+
*/
|
|
570
|
+
initial?: boolean;
|
|
571
|
+
}
|
|
572
|
+
declare function useKeyModifier(modifier: KeyModifier, options?: UseModifierOptions): boolean;
|
|
573
|
+
|
|
574
|
+
type IHookStateInitialSetter<S> = () => S;
|
|
575
|
+
type IHookStateInitAction<S> = S | IHookStateInitialSetter<S>;
|
|
576
|
+
|
|
577
|
+
interface MousePressedOptions {
|
|
578
|
+
/**
|
|
579
|
+
* Listen to `touchstart` `touchend` events
|
|
580
|
+
*
|
|
581
|
+
* @default true
|
|
582
|
+
*/
|
|
583
|
+
touch?: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Listen to `dragstart` `drop` and `dragend` events
|
|
586
|
+
*
|
|
587
|
+
* @default true
|
|
588
|
+
*/
|
|
589
|
+
drag?: boolean;
|
|
590
|
+
/**
|
|
591
|
+
* Initial values
|
|
592
|
+
*
|
|
593
|
+
* @default false
|
|
594
|
+
*/
|
|
595
|
+
initialValue?: IHookStateInitAction<boolean>;
|
|
596
|
+
}
|
|
597
|
+
type MouseSourceType = "mouse" | "touch" | null;
|
|
598
|
+
declare function useMousePressed(target?: BasicTarget, options?: MousePressedOptions): readonly [boolean, MouseSourceType];
|
|
599
|
+
|
|
600
|
+
declare function useScrollLock(target: BasicTarget<HTMLElement>, initialState?: boolean): readonly [boolean, (flag: boolean) => void];
|
|
601
|
+
|
|
602
|
+
declare function useElementSize(target: BasicTarget, options?: ResizeObserverOptions): readonly [number, number];
|
|
603
|
+
|
|
604
|
+
interface UseVirtualListOptions {
|
|
605
|
+
/**
|
|
606
|
+
* container default height
|
|
607
|
+
*
|
|
608
|
+
* @default 300
|
|
609
|
+
*/
|
|
610
|
+
containerHeight?: number;
|
|
611
|
+
/**
|
|
612
|
+
* item height, accept a pixel value or a function that returns the height
|
|
613
|
+
*/
|
|
614
|
+
itemHeight: number | ((index: number) => number);
|
|
615
|
+
/**
|
|
616
|
+
* the extra buffer items outside of the view area
|
|
617
|
+
*
|
|
618
|
+
* @default 5
|
|
619
|
+
*/
|
|
620
|
+
overscan?: number;
|
|
621
|
+
}
|
|
622
|
+
interface UseVirtualListItem<T> {
|
|
623
|
+
data: T;
|
|
624
|
+
index: number;
|
|
625
|
+
}
|
|
626
|
+
interface UseVirtualListReturn<T> {
|
|
627
|
+
list: UseVirtualListItem<T>[];
|
|
628
|
+
scrollTo: (index: number) => void;
|
|
629
|
+
containerProps: {
|
|
630
|
+
ref: RefObject<any>;
|
|
631
|
+
onScroll: () => void;
|
|
632
|
+
style: Partial<CSSProperties>;
|
|
633
|
+
};
|
|
634
|
+
wrapperProps: {
|
|
635
|
+
style: {
|
|
636
|
+
width: string;
|
|
637
|
+
height: string;
|
|
638
|
+
marginTop: string;
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
declare function useVirtualList<T = any>(list: T[] | undefined, options: UseVirtualListOptions): UseVirtualListReturn<T>;
|
|
643
|
+
|
|
644
|
+
type ColorScheme = "dark" | "light" | "no-preference";
|
|
645
|
+
declare function usePreferredColorScheme(defaultState?: ColorScheme): ColorScheme;
|
|
646
|
+
|
|
647
|
+
type Contrast = "more" | "less" | "custom" | "no-preference";
|
|
648
|
+
declare function usePreferredContrast(defaultState?: Contrast): Contrast;
|
|
649
|
+
|
|
650
|
+
declare function useActiveElement<T extends Element>(): T | null;
|
|
651
|
+
|
|
652
|
+
interface UseDraggableOptions {
|
|
653
|
+
/**
|
|
654
|
+
* Only start the dragging when click on the element directly
|
|
655
|
+
*
|
|
656
|
+
* @default false
|
|
657
|
+
*/
|
|
658
|
+
exact?: boolean;
|
|
659
|
+
/**
|
|
660
|
+
* Prevent events defaults
|
|
661
|
+
*
|
|
662
|
+
* @default false
|
|
663
|
+
*/
|
|
664
|
+
preventDefault?: boolean;
|
|
665
|
+
/**
|
|
666
|
+
* Prevent events propagation
|
|
667
|
+
*
|
|
668
|
+
* @default false
|
|
669
|
+
*/
|
|
670
|
+
stopPropagation?: boolean;
|
|
671
|
+
/**
|
|
672
|
+
* Element to attach `pointermove` and `pointerup` events to.
|
|
673
|
+
*
|
|
674
|
+
* @default window
|
|
675
|
+
*/
|
|
676
|
+
draggingElement?: BasicTarget<HTMLElement | SVGElement | Window | Document>;
|
|
677
|
+
/**
|
|
678
|
+
* Handle that triggers the drag event
|
|
679
|
+
*
|
|
680
|
+
* @default target
|
|
681
|
+
*/
|
|
682
|
+
handle?: BasicTarget<HTMLElement | SVGElement>;
|
|
683
|
+
/**
|
|
684
|
+
* Pointer types that listen to.
|
|
685
|
+
*
|
|
686
|
+
* @default ['mouse', 'touch', 'pen']
|
|
687
|
+
*/
|
|
688
|
+
pointerTypes?: PointerType[];
|
|
689
|
+
/**
|
|
690
|
+
* Initial position of the element.
|
|
691
|
+
*
|
|
692
|
+
* @default { x: 0, y: 0 }
|
|
693
|
+
*/
|
|
694
|
+
initialValue?: Position;
|
|
695
|
+
/**
|
|
696
|
+
* Callback when the dragging starts. Return `false` to prevent dragging.
|
|
697
|
+
*/
|
|
698
|
+
onStart?: (position: Position, event: PointerEvent) => void | false;
|
|
699
|
+
/**
|
|
700
|
+
* Callback during dragging.
|
|
701
|
+
*/
|
|
702
|
+
onMove?: (position: Position, event: PointerEvent) => void;
|
|
703
|
+
/**
|
|
704
|
+
* Callback when dragging end.
|
|
705
|
+
*/
|
|
706
|
+
onEnd?: (position: Position, event: PointerEvent) => void;
|
|
707
|
+
}
|
|
708
|
+
declare function useDraggable(target: BasicTarget<HTMLElement | SVGElement>, options?: UseDraggableOptions): readonly [number, number, boolean];
|
|
709
|
+
|
|
710
|
+
interface UseElementBoundingOptions {
|
|
711
|
+
/**
|
|
712
|
+
* Reset values to 0 on component unmounted
|
|
713
|
+
*
|
|
714
|
+
* @default true
|
|
715
|
+
*/
|
|
716
|
+
reset?: boolean;
|
|
717
|
+
/**
|
|
718
|
+
* Listen to window resize event
|
|
719
|
+
*
|
|
720
|
+
* @default true
|
|
721
|
+
*/
|
|
722
|
+
windowResize?: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* Listen to window scroll event
|
|
725
|
+
*
|
|
726
|
+
* @default true
|
|
727
|
+
*/
|
|
728
|
+
windowScroll?: boolean;
|
|
729
|
+
/**
|
|
730
|
+
* Immediately call update on component mounted
|
|
731
|
+
*
|
|
732
|
+
* @default true
|
|
733
|
+
*/
|
|
734
|
+
immediate?: boolean;
|
|
735
|
+
}
|
|
736
|
+
declare function useElementBounding(target: BasicTarget, options?: UseElementBoundingOptions): {
|
|
737
|
+
readonly height: number;
|
|
738
|
+
readonly bottom: number;
|
|
739
|
+
readonly left: number;
|
|
740
|
+
readonly right: number;
|
|
741
|
+
readonly top: number;
|
|
742
|
+
readonly width: number;
|
|
743
|
+
readonly x: number;
|
|
744
|
+
readonly y: number;
|
|
745
|
+
readonly update: () => void;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
declare function useElementVisibility(target: BasicTarget<HTMLElement | SVGElement>, options?: IntersectionObserverInit): readonly [boolean, () => void];
|
|
749
|
+
|
|
750
|
+
declare function useWindowsFocus(defauleValue?: boolean): boolean;
|
|
751
|
+
|
|
752
|
+
interface WindowSize {
|
|
753
|
+
width: number;
|
|
754
|
+
height: number;
|
|
755
|
+
}
|
|
756
|
+
declare function useWindowSize(): {
|
|
757
|
+
readonly width: number;
|
|
758
|
+
readonly height: number;
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
interface UseWindowScrollState {
|
|
762
|
+
x: number;
|
|
763
|
+
y: number;
|
|
764
|
+
}
|
|
765
|
+
declare function useWindowScroll(): UseWindowScrollState;
|
|
766
|
+
|
|
767
|
+
declare function useClipBorad(): readonly [
|
|
768
|
+
string,
|
|
769
|
+
(txt: string) => Promise<void>
|
|
770
|
+
];
|
|
771
|
+
|
|
772
|
+
type EventType = MouseEvent | TouchEvent;
|
|
773
|
+
declare function useClickOutside(target: BasicTarget, handler: (evt: EventType) => void): void;
|
|
774
|
+
|
|
775
|
+
declare function useCycleList<T>(list: T[], i?: number): readonly [T, (i?: number) => void, (i?: number) => void];
|
|
776
|
+
|
|
777
|
+
declare function useFocus(target: BasicTarget<HTMLElement | SVGElement>, initialValue?: boolean): readonly [boolean, (value: boolean) => void];
|
|
778
|
+
|
|
779
|
+
interface IProps<T> {
|
|
780
|
+
controlled?: T;
|
|
781
|
+
defaultValue?: T;
|
|
782
|
+
state?: T;
|
|
783
|
+
}
|
|
784
|
+
declare function useControlled<T = string>(props?: IProps<T>): readonly [T, (newValue: T) => void];
|
|
785
|
+
|
|
786
|
+
declare const _default$1: typeof useEffect | typeof react.useLayoutEffect;
|
|
787
|
+
|
|
788
|
+
declare const _default: typeof react.useEffect | typeof useLayoutEffect;
|
|
789
|
+
|
|
790
|
+
declare function useReducedMotion(defaultState?: boolean): boolean;
|
|
791
|
+
|
|
792
|
+
interface ScrollIntoViewAnimation {
|
|
793
|
+
/** target element alignment relatively to parent based on current axis */
|
|
794
|
+
alignment?: "start" | "end" | "center";
|
|
795
|
+
}
|
|
796
|
+
interface ScrollIntoViewParams {
|
|
797
|
+
/** callback fired after scroll */
|
|
798
|
+
onScrollFinish?: () => void;
|
|
799
|
+
/** duration of scroll in milliseconds */
|
|
800
|
+
duration?: number;
|
|
801
|
+
/** axis of scroll */
|
|
802
|
+
axis?: "x" | "y";
|
|
803
|
+
/** custom mathematical easing function */
|
|
804
|
+
easing?: (t: number) => number;
|
|
805
|
+
/** additional distance between nearest edge and element */
|
|
806
|
+
offset?: number;
|
|
807
|
+
/** indicator if animation may be interrupted by user scrolling */
|
|
808
|
+
cancelable?: boolean;
|
|
809
|
+
/** prevents content jumping in scrolling lists with multiple targets */
|
|
810
|
+
isList?: boolean;
|
|
811
|
+
}
|
|
812
|
+
declare function useScrollIntoView(targetElement: BasicTarget<HTMLElement>, { duration, axis, onScrollFinish, easing, offset, cancelable, isList, }?: ScrollIntoViewParams, scrollElement?: BasicTarget<HTMLElement>): {
|
|
813
|
+
scrollIntoView: ({ alignment, }?: ScrollIntoViewAnimation) => void;
|
|
814
|
+
cancel: () => void;
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
interface UseStickyParams {
|
|
818
|
+
/** axis of scroll */
|
|
819
|
+
axis?: "x" | "y";
|
|
820
|
+
/** cover height or width */
|
|
821
|
+
nav: number;
|
|
822
|
+
}
|
|
823
|
+
declare const useSticky: (targetElement: BasicTarget<HTMLElement>, { axis, nav }: UseStickyParams, scrollElement?: BasicTarget<HTMLElement>) => [boolean, react__default.Dispatch<react__default.SetStateAction<boolean>>];
|
|
824
|
+
|
|
825
|
+
declare function useAsyncEffect<T extends void>(effect: () => Promise<T> | T, cleanup?: typeof effect, deps?: DependencyList): void;
|
|
826
|
+
|
|
827
|
+
declare const getHMSTime: (timeDiff: number) => [string, string, string];
|
|
828
|
+
declare const useCountDown: (time: number, format?: (num: number) => [string, string, string], callback?: () => void) => readonly [string, string, string];
|
|
829
|
+
|
|
830
|
+
declare function useSupported(callback: () => unknown, sync?: boolean): boolean;
|
|
831
|
+
|
|
832
|
+
declare function useTextSelection(): Selection | null;
|
|
833
|
+
|
|
834
|
+
interface EyeDropperOpenOptions {
|
|
835
|
+
signal?: AbortSignal;
|
|
836
|
+
}
|
|
837
|
+
interface EyeDropperOpenReturnType {
|
|
838
|
+
sRGBHex: string;
|
|
839
|
+
}
|
|
840
|
+
declare function useEyeDropper(): readonly [boolean, (options?: EyeDropperOpenOptions) => Promise<EyeDropperOpenReturnType>];
|
|
841
|
+
type UseEyeDropperReturn = ReturnType<typeof useEyeDropper>;
|
|
842
|
+
|
|
843
|
+
type UseCookieState = string | undefined;
|
|
844
|
+
declare function useCookie(key: string, options?: Cookies.CookieAttributes, defaultValue?: string): readonly [UseCookieState, (newValue: UseCookieState | ((prevState: UseCookieState) => UseCookieState)) => void, () => void];
|
|
845
|
+
|
|
846
|
+
declare function useDoubleClick({ target, latency, onSingleClick, onDoubleClick, }: {
|
|
847
|
+
target: BasicTarget;
|
|
848
|
+
latency?: number;
|
|
849
|
+
onSingleClick?: (e?: MouseEvent | TouchEvent) => void;
|
|
850
|
+
onDoubleClick?: (e?: MouseEvent | TouchEvent) => void;
|
|
851
|
+
}): void;
|
|
852
|
+
|
|
853
|
+
declare function useSetState<T extends Record<string, any>>(initialState: T): readonly [T, (statePartial: Partial<T> | ((currentState: T) => Partial<T>)) => void];
|
|
854
|
+
|
|
855
|
+
type UseMeasureRect = Omit<DOMRectReadOnly, "toJSON">;
|
|
856
|
+
declare function useMeasure(target: BasicTarget, options?: ResizeObserverOptions): readonly [UseMeasureRect, () => void];
|
|
857
|
+
|
|
858
|
+
declare function useHover<T extends HTMLElement = HTMLDivElement>(target: BasicTarget<T>): boolean;
|
|
859
|
+
|
|
860
|
+
declare function useScreenSafeArea(): readonly [string, string, string, string, lodash.DebouncedFunc<() => void>];
|
|
861
|
+
|
|
862
|
+
interface UseCssVarOptions {
|
|
863
|
+
/**
|
|
864
|
+
* Use MutationObserver to monitor variable changes
|
|
865
|
+
* @default false
|
|
866
|
+
*/
|
|
867
|
+
observe?: boolean;
|
|
868
|
+
}
|
|
869
|
+
declare function useCssVar<T extends HTMLElement = HTMLElement>(prop: string, target: BasicTarget<T>, defaultValue?: string, options?: UseCssVarOptions): readonly [string, (v: string) => void];
|
|
870
|
+
|
|
871
|
+
declare function useWebNotification(requestPermissions?: boolean): {
|
|
872
|
+
readonly isSupported: boolean;
|
|
873
|
+
readonly show: (title: string, options?: NotificationOptions) => Notification | undefined;
|
|
874
|
+
readonly close: () => void;
|
|
875
|
+
readonly ensurePermissions: () => Promise<boolean | undefined>;
|
|
876
|
+
readonly permissionGranted: react.MutableRefObject<boolean>;
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
declare function useLocationSelector<R>(selector: (location: Location) => R,
|
|
880
|
+
/**
|
|
881
|
+
* @description server fallback
|
|
882
|
+
* @default undefined
|
|
883
|
+
*/
|
|
884
|
+
fallback?: R): R | undefined;
|
|
885
|
+
|
|
886
|
+
export { type ColorScheme, type Contrast, type CursorState, type EyeDropperOpenReturnType, type GeneralPermissionDescriptor, type IDisposable, type IEvent, type IEventOnce, type IListener, type INetworkInformation, type IState, type IUseNetworkState, type KeyModifier, type MousePressedOptions, type MouseSourceType, type OrientationState, type RafLoopReturns, type ScrollIntoViewAnimation, type ScrollIntoViewParams, type Status, type Target, type UseCookieState, type UseCssVarOptions, type UseDarkOptions, type UseDraggableOptions, type UseElementBoundingOptions, type UseEventEmitterReturn, type UseEyeDropperReturn, type UseFileDialogOptions, type UseFpsOptions, type UseFullScreenOptions, type UseInfiniteScrollOptions, type UseLongPressOptions, type UseMeasureRect, type UseMediaDeviceOptions, type UseModifierOptions, type UseScriptTagOptions, type UseScrollOptions, type UseStickyParams, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTimeoutFnOptions, type UseVirtualListItem, type UseVirtualListOptions, type UseVirtualListReturn, type UseWindowScrollState, type WindowSize, getHMSTime, useActiveElement, useAsyncEffect, useClickOutside, useClipBorad as useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, _default$2 as useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, _default$1 as useOnceEffect, _default as useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, _default$4 as useUpdateEffect, _default$3 as useUpdateLayoutEffect, useVirtualList, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|