@reactuses/core 5.0.16 → 5.0.18

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.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { DependencyList, MutableRefObject, EffectCallback, Dispatch, SetStateAction, RefObject, useEffect, useLayoutEffect, Ref } from 'react';
2
+ import react__default, { DependencyList, MutableRefObject, EffectCallback, Dispatch, SetStateAction, RefObject, useEffect, useLayoutEffect, Ref, Context } from 'react';
3
3
  import Cookies from 'js-cookie';
4
4
  import { DebounceSettings, ThrottleSettings, DebouncedFunc as DebouncedFunc$1 } from 'lodash-es';
5
5
  import * as lodash from 'lodash';
@@ -20,20 +20,20 @@ declare const useActiveElement: UseActiveElement;
20
20
  */
21
21
  type UseAsyncEffect = <T>(
22
22
  /**
23
- * @zh 支持promise的副作用函数
24
- * @en effect that support promise
25
- */
23
+ * @zh 支持promise的副作用函数
24
+ * @en effect that support promise
25
+ */
26
26
  effect: () => Promise<T> | T,
27
27
  /**
28
- * @zh 清理函数
29
- * @en cleanup function
30
- * @defaultValue () => {}
31
- */
28
+ * @zh 清理函数
29
+ * @en cleanup function
30
+ * @defaultValue () => {}
31
+ */
32
32
  cleanup?: typeof effect,
33
33
  /**
34
- * @zh 依赖列表
35
- * @en dependency list
36
- */
34
+ * @zh 依赖列表
35
+ * @en dependency list
36
+ */
37
37
  deps?: DependencyList) => void;
38
38
 
39
39
  declare const useAsyncEffect: UseAsyncEffect;
@@ -110,9 +110,9 @@ declare const useCookie: UseCookie;
110
110
  * - minute.
111
111
  * - second.
112
112
  * @returns 包含以下元素的元组:
113
- * - 小时。
114
- * - 分钟。
115
- * - 秒数。
113
+ * - 小时。
114
+ * - 分钟。
115
+ * - 秒数。
116
116
  */
117
117
  type UseCountDown = (
118
118
  /**
@@ -405,7 +405,7 @@ deps: DependencyList) => void;
405
405
 
406
406
  declare const useDeepCompareEffect: UseDeepCompareEffect;
407
407
 
408
- declare const useDocumentVisibility: (defaultValue?: DocumentVisibilityState) => DocumentVisibilityState;
408
+ declare function useDocumentVisibility(defaultValue?: DocumentVisibilityState): DocumentVisibilityState;
409
409
 
410
410
  /**
411
411
  * @title useDoubleClick
@@ -441,7 +441,7 @@ declare const useDoubleClick: UseDoubleClick;
441
441
 
442
442
  type Fn = (this: any, ...args: any[]) => any;
443
443
  type Stoppable = [boolean, Fn, Fn];
444
- type PointerType = "mouse" | "touch" | "pen";
444
+ type PointerType = 'mouse' | 'touch' | 'pen';
445
445
  interface Position {
446
446
  x: number;
447
447
  y: number;
@@ -554,9 +554,9 @@ type UseDropZone = (
554
554
  */
555
555
  target: BasicTarget<EventTarget>,
556
556
  /**
557
- * @zh 拖拽释放时候的回调
558
- * @en drop callback
559
- */
557
+ * @zh 拖拽释放时候的回调
558
+ * @en drop callback
559
+ */
560
560
  onDrop?: ((files: File[] | null) => void) | undefined) => boolean;
561
561
 
562
562
  declare const useDropZone: UseDropZone;
@@ -691,14 +691,14 @@ declare const useElementSize: UseElementSize;
691
691
  */
692
692
  type UseElementVisibility = (
693
693
  /**
694
- * @zh dom对象
695
- * @en dom element
696
- */
694
+ * @zh dom对象
695
+ * @en dom element
696
+ */
697
697
  target: BasicTarget<HTMLElement | SVGElement>,
698
698
  /**
699
- * @zh 传递给 `intersectionObserver` 的选项
700
- * @en options passed to `intersectionObserver`
701
- */
699
+ * @zh 传递给 `intersectionObserver` 的选项
700
+ * @en options passed to `intersectionObserver`
701
+ */
702
702
  options?: IntersectionObserverInit) => readonly [boolean, () => void];
703
703
 
704
704
  declare const useElementVisibility: UseElementVisibility;
@@ -738,7 +738,7 @@ interface UseEventEmitterListener<T, U = void> {
738
738
  (arg1: T, arg2: U): void;
739
739
  }
740
740
  interface UseEventEmitterDisposable {
741
- dispose(): void;
741
+ dispose: () => void;
742
742
  }
743
743
  interface UseEventEmitterEvent<T, U = void> {
744
744
  (listener: (arg1: T, arg2: U) => any): UseEventEmitterDisposable;
@@ -764,7 +764,7 @@ interface UseEventEmitterReturn<T, U = void> {
764
764
  dispose: () => void;
765
765
  }
766
766
 
767
- declare const useEventEmitter: <T, U = void>() => readonly [UseEventEmitterEvent<T, U>, (arg1: T, arg2: U) => void, () => void];
767
+ declare function useEventEmitter<T, U = void>(): readonly [UseEventEmitterEvent<T, U>, (arg1: T, arg2: U) => void, () => void];
768
768
 
769
769
  type Target = BasicTarget<HTMLElement | Element | Window | Document | EventTarget>;
770
770
  declare function useEventListener<K extends keyof WindowEventMap>(eventName: K, handler: (event: WindowEventMap[K]) => void, element?: Window, options?: boolean | AddEventListenerOptions): void;
@@ -810,7 +810,7 @@ interface UseEyeDropperOpenReturnType {
810
810
 
811
811
  declare const useEyeDropper: UseEyeDropper;
812
812
 
813
- declare const useFavicon: (href: string, baseUrl?: string, rel?: string) => void;
813
+ declare function useFavicon(href: string, baseUrl?: string, rel?: string): void;
814
814
 
815
815
  /**
816
816
  * @title useFileDialog
@@ -903,7 +903,7 @@ interface UseFpsOptions {
903
903
  every?: number;
904
904
  }
905
905
 
906
- declare const useFps: (options?: UseFpsOptions) => number;
906
+ declare function useFps(options?: UseFpsOptions): number;
907
907
 
908
908
  /**
909
909
  * @title useFullScreen
@@ -981,14 +981,16 @@ declare const useFullscreen: UseFullscreen;
981
981
 
982
982
  /**
983
983
  * @title useGeoLocation
984
- * @returns 包含以下元素的元组:
984
+ * @returns 包含以下元素的对象:
985
985
  * - 坐标。
986
986
  * - 获取坐标的时间戳。
987
987
  * - 错误。
988
- * @returns_en A tuple with the following elements:
988
+ * - 浏览器是否支持 `geolocation`。
989
+ * @returns_en A object with the following elements:
989
990
  * - coordinates.
990
991
  * - timestamp when get coordinates.
991
992
  * - errors.
993
+ * - Whether the browser supports `geolocation`.
992
994
  */
993
995
  type UseGeolocation = (
994
996
  /**
@@ -999,6 +1001,11 @@ options?: Partial<PositionOptions>) => {
999
1001
  readonly coordinates: GeolocationCoordinates;
1000
1002
  readonly locatedAt: number | null;
1001
1003
  readonly error: GeolocationPositionError | null;
1004
+ /**
1005
+ * @zh 浏览器是否支持 `geolocation`
1006
+ * @en Whether the browser supports `geolocation`
1007
+ */
1008
+ readonly isSupported: boolean;
1002
1009
  };
1003
1010
 
1004
1011
  declare const useGeolocation: UseGeolocation;
@@ -1220,7 +1227,7 @@ interface UseInfiniteScrollOptions extends UseScrollOptions {
1220
1227
  * @zh 滚动方向
1221
1228
  * @defaultValue 'bottom'
1222
1229
  */
1223
- direction?: "top" | "bottom" | "left" | "right";
1230
+ direction?: 'top' | 'bottom' | 'left' | 'right';
1224
1231
  /**
1225
1232
  * @en Whether to preserve the current scroll position when loading more items.
1226
1233
  * @zh 加载更多项目时是否保留当前滚动位置
@@ -1380,7 +1387,7 @@ modifier: KeyModifier,
1380
1387
  * @en optional params
1381
1388
  */
1382
1389
  options?: UseModifierOptions) => boolean;
1383
- type KeyModifier = "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Symbol" | "SymbolLock";
1390
+ type KeyModifier = 'Alt' | 'AltGraph' | 'CapsLock' | 'Control' | 'Fn' | 'FnLock' | 'Meta' | 'NumLock' | 'ScrollLock' | 'Shift' | 'Symbol' | 'SymbolLock';
1384
1391
  /**
1385
1392
  * @title UseModifierOptions
1386
1393
  */
@@ -1416,8 +1423,8 @@ value: T) => MutableRefObject<T>;
1416
1423
  declare const useLatest: UseLatest;
1417
1424
 
1418
1425
  interface Serializer<T> {
1419
- read(raw: string): T;
1420
- write(value: T): string;
1426
+ read: (raw: string) => T;
1427
+ write: (value: T) => string;
1421
1428
  }
1422
1429
  interface UseStorageOptions<T> {
1423
1430
  /**
@@ -1530,7 +1537,7 @@ options?: ResizeObserverOptions) => readonly [UseMeasureRect, () => void];
1530
1537
  /**
1531
1538
  * @title UseMeasureRect
1532
1539
  */
1533
- type UseMeasureRect = Omit<DOMRectReadOnly, "toJSON">;
1540
+ type UseMeasureRect = Omit<DOMRectReadOnly, 'toJSON'>;
1534
1541
 
1535
1542
  declare const useMeasure: UseMeasure;
1536
1543
 
@@ -1611,7 +1618,7 @@ effect: () => void) => void;
1611
1618
 
1612
1619
  declare const useMount: UseMount;
1613
1620
 
1614
- declare const useMountedState: () => () => boolean;
1621
+ declare function useMountedState(): () => boolean;
1615
1622
 
1616
1623
  /**
1617
1624
  * @title useMouse
@@ -1690,7 +1697,7 @@ interface UseMousePressedOptions {
1690
1697
  /**
1691
1698
  * @title UseMousePressedSourceType
1692
1699
  */
1693
- type UseMousePressedSourceType = "mouse" | "touch" | null;
1700
+ type UseMousePressedSourceType = 'mouse' | 'touch' | null;
1694
1701
 
1695
1702
  declare const useMousePressed: UseMousePressed;
1696
1703
 
@@ -1749,13 +1756,13 @@ interface IUseNetworkState {
1749
1756
  * @zh 有效带宽估计(以兆位每秒为单位),四舍五入到
1750
1757
  * 25 kbps 的最接近倍数。
1751
1758
  */
1752
- downlink: INetworkInformation["downlink"] | undefined;
1759
+ downlink: INetworkInformation['downlink'] | undefined;
1753
1760
  /**
1754
1761
  * @en Maximum downlink speed, in megabits per second (Mbps), for the
1755
1762
  * underlying connection technology
1756
1763
  * @zh 最大下行链路速度,以兆比特每秒 (Mbps) 为单位
1757
1764
  */
1758
- downlinkMax: INetworkInformation["downlinkMax"] | undefined;
1765
+ downlinkMax: INetworkInformation['downlinkMax'] | undefined;
1759
1766
  /**
1760
1767
  * @en Effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'.
1761
1768
  * This value is determined using a combination of recently observed round-trip time
@@ -1763,19 +1770,19 @@ interface IUseNetworkState {
1763
1770
  * @zh 连接的有效类型,表示“slow-2g”、“2g”、“3g”或“4g”之一。
1764
1771
  * 该值是根据最近观察到的往返时间和和下行链路值的组合确定的
1765
1772
  */
1766
- effectiveType: INetworkInformation["effectiveType"] | undefined;
1773
+ effectiveType: INetworkInformation['effectiveType'] | undefined;
1767
1774
  /**
1768
1775
  * @en Estimated effective round-trip time of the current connection, rounded
1769
1776
  * to the nearest multiple of 25 milliseconds
1770
1777
  * @zh 当前连接的估计有效往返时间,四舍五入
1771
1778
  * 精确到 25 毫秒的最接近倍数
1772
1779
  */
1773
- rtt: INetworkInformation["rtt"] | undefined;
1780
+ rtt: INetworkInformation['rtt'] | undefined;
1774
1781
  /**
1775
1782
  * @en {true} if the user has set a reduced data usage option on the user agent.
1776
1783
  * @zh 如果用户在用户代理上设置了减少数据使用选项,则为 {true}。
1777
1784
  */
1778
- saveData: INetworkInformation["saveData"] | undefined;
1785
+ saveData: INetworkInformation['saveData'] | undefined;
1779
1786
  /**
1780
1787
  * @en The type of connection a device is using to communicate with the network.
1781
1788
  * It will be one of the following values:
@@ -1798,15 +1805,15 @@ interface IUseNetworkState {
1798
1805
  * - 其他
1799
1806
  * - 未知
1800
1807
  */
1801
- type: INetworkInformation["type"] | undefined;
1808
+ type: INetworkInformation['type'] | undefined;
1802
1809
  }
1803
1810
  interface INetworkInformation extends EventTarget {
1804
1811
  readonly downlink: number;
1805
1812
  readonly downlinkMax: number;
1806
- readonly effectiveType: "slow-2g" | "2g" | "3g" | "4g";
1813
+ readonly effectiveType: 'slow-2g' | '2g' | '3g' | '4g';
1807
1814
  readonly rtt: number;
1808
1815
  readonly saveData: boolean;
1809
- readonly type: "bluetooth" | "cellular" | "ethernet" | "none" | "wifi" | "wimax" | "other" | "unknown";
1816
+ readonly type: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
1810
1817
  onChange: (event: Event) => void;
1811
1818
  }
1812
1819
 
@@ -1878,15 +1885,15 @@ interface UseOrientationState {
1878
1885
  /**
1879
1886
  * @title UseOrientationType
1880
1887
  */
1881
- type UseOrientationType = "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
1888
+ type UseOrientationType = 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
1882
1889
  /**
1883
1890
  * @title UseOrientationLockType
1884
1891
  */
1885
- type UseOrientationLockType = "any" | "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
1892
+ type UseOrientationLockType = 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
1886
1893
 
1887
1894
  declare const useOrientation: UseOrientation;
1888
1895
 
1889
- declare const usePageLeave: () => boolean;
1896
+ declare function usePageLeave(): boolean;
1890
1897
 
1891
1898
  /**
1892
1899
  * @title usePermission
@@ -1898,11 +1905,11 @@ type UsePermission = (
1898
1905
  * @zh 权限描述符
1899
1906
  * @en permission desc
1900
1907
  */
1901
- permissionDesc: UsePermissionGeneralPermissionDescriptor | UsePermissionGeneralPermissionDescriptor["name"]) => UsePermissionState;
1908
+ permissionDesc: UsePermissionGeneralPermissionDescriptor | UsePermissionGeneralPermissionDescriptor['name']) => UsePermissionState;
1902
1909
  /**
1903
1910
  * @title UsePermissionState
1904
1911
  */
1905
- type UsePermissionState = PermissionState | "";
1912
+ type UsePermissionState = PermissionState | '';
1906
1913
  /**
1907
1914
  * @title UsePermissionGeneralPermissionDescriptor
1908
1915
  */
@@ -1912,7 +1919,7 @@ type UsePermissionGeneralPermissionDescriptor = PermissionDescriptor | {
1912
1919
  /**
1913
1920
  * @title UsePermissionDescriptorNamePolyfill
1914
1921
  */
1915
- type UsePermissionDescriptorNamePolyfill = "accelerometer" | "accessibility-events" | "ambient-light-sensor" | "background-sync" | "camera" | "clipboard-read" | "clipboard-write" | "gyroscope" | "magnetometer" | "microphone" | "notifications" | "payment-handler" | "persistent-storage" | "push" | "speaker";
1922
+ type UsePermissionDescriptorNamePolyfill = 'accelerometer' | 'accessibility-events' | 'ambient-light-sensor' | 'background-sync' | 'camera' | 'clipboard-read' | 'clipboard-write' | 'gyroscope' | 'magnetometer' | 'microphone' | 'notifications' | 'payment-handler' | 'persistent-storage' | 'push' | 'speaker';
1916
1923
 
1917
1924
  declare const usePermission: UsePermission;
1918
1925
 
@@ -1931,7 +1938,7 @@ defaultState?: ColorScheme) => ColorScheme;
1931
1938
  /**
1932
1939
  * @title ColorScheme
1933
1940
  */
1934
- type ColorScheme = "dark" | "light" | "no-preference";
1941
+ type ColorScheme = 'dark' | 'light' | 'no-preference';
1935
1942
 
1936
1943
  declare const usePreferredColorScheme: UsePreferredColorScheme;
1937
1944
 
@@ -1948,13 +1955,13 @@ defaultState?: Contrast) => Contrast;
1948
1955
  /**
1949
1956
  * @title Contrast
1950
1957
  */
1951
- type Contrast = "more" | "less" | "custom" | "no-preference";
1958
+ type Contrast = 'more' | 'less' | 'custom' | 'no-preference';
1952
1959
 
1953
1960
  declare const usePreferredContrast: UsePreferredContrast;
1954
1961
 
1955
- declare const usePreferredDark: (defaultState?: boolean) => boolean;
1962
+ declare function usePreferredDark(defaultState?: boolean): boolean;
1956
1963
 
1957
- declare const usePrevious: <T>(state: T) => T | undefined;
1964
+ declare function usePrevious<T>(state: T): T | undefined;
1958
1965
 
1959
1966
  /**
1960
1967
  * @title useRafFn
@@ -1981,9 +1988,9 @@ initiallyActive?: boolean) => readonly [() => void, () => void, () => boolean];
1981
1988
 
1982
1989
  declare const useRafFn: UseRafFn;
1983
1990
 
1984
- declare const useRafState: <S>(initialState: S | (() => S)) => readonly [S, Dispatch<SetStateAction<S>>];
1991
+ declare function useRafState<S>(initialState: S | (() => S)): readonly [S, Dispatch<SetStateAction<S>>];
1985
1992
 
1986
- declare const useReducedMotion: (defaultState?: boolean) => boolean;
1993
+ declare function useReducedMotion(defaultState?: boolean): boolean;
1987
1994
 
1988
1995
  /**
1989
1996
  * @title useResizeObserver
@@ -2000,14 +2007,14 @@ target: BasicTarget<Element>,
2000
2007
  */
2001
2008
  callback: ResizeObserverCallback,
2002
2009
  /**
2003
- * @zh `resizeObserver` 参数
2004
- * @en options passed to `resizeObserver`
2005
- */
2010
+ * @zh `resizeObserver` 参数
2011
+ * @en options passed to `resizeObserver`
2012
+ */
2006
2013
  options?: ResizeObserverOptions) => () => void;
2007
2014
 
2008
2015
  declare const useResizeObserver: UseResizeObserver;
2009
2016
 
2010
- declare const useScreenSafeArea: () => readonly [string, string, string, string, lodash.DebouncedFunc<() => void>];
2017
+ declare function useScreenSafeArea(): readonly [string, string, string, string, lodash.DebouncedFunc<() => void>];
2011
2018
 
2012
2019
  /**
2013
2020
  * @title useScriptTag
@@ -2075,12 +2082,12 @@ interface UseScriptTagOptions {
2075
2082
  * @zh 跨域属性
2076
2083
  * @en cross origin
2077
2084
  */
2078
- crossOrigin?: "anonymous" | "use-credentials";
2085
+ crossOrigin?: 'anonymous' | 'use-credentials';
2079
2086
  /**
2080
2087
  * @en referrer policy
2081
2088
  * @zh 来源属性
2082
2089
  */
2083
- referrerPolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
2090
+ referrerPolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
2084
2091
  /**
2085
2092
  * @en Add `noModule` attribute to the script tag
2086
2093
  * @zh 在 `script` 标签上加上 `noModule`
@@ -2100,7 +2107,7 @@ interface UseScriptTagOptions {
2100
2107
  /**
2101
2108
  * @title UseScriptTagStatus
2102
2109
  */
2103
- type UseScriptTagStatus = "idle" | "loading" | "ready" | "error";
2110
+ type UseScriptTagStatus = 'idle' | 'loading' | 'ready' | 'error';
2104
2111
 
2105
2112
  declare const useScriptTag: UseScriptTag;
2106
2113
 
@@ -2141,7 +2148,7 @@ interface UseScrollIntoViewAnimation {
2141
2148
  * @en target element alignment relatively to parent based on current axis
2142
2149
  * @zh 基于当前轴的目标元素相对于父元素的对齐方式
2143
2150
  */
2144
- alignment?: "start" | "end" | "center";
2151
+ alignment?: 'start' | 'end' | 'center';
2145
2152
  }
2146
2153
  /**
2147
2154
  * @title UseScrollIntoViewParams
@@ -2163,7 +2170,7 @@ interface UseScrollIntoViewParams {
2163
2170
  * @zh 滚动方向
2164
2171
  * @defaultValue y
2165
2172
  */
2166
- axis?: "x" | "y";
2173
+ axis?: 'x' | 'y';
2167
2174
  /**
2168
2175
  * @en custom mathematical easing function
2169
2176
  * @zh 自定义缓和数学函数
@@ -2185,7 +2192,7 @@ interface UseScrollIntoViewParams {
2185
2192
  /**
2186
2193
  * @en prevents content jumping in scrolling lists with multiple targets
2187
2194
  * @zh 防止内容在具有多个目标的滚动列表中跳跃
2188
- */
2195
+ */
2189
2196
  isList?: boolean;
2190
2197
  }
2191
2198
 
@@ -2276,7 +2283,7 @@ interface UseStickyParams {
2276
2283
  * @zh 滚动方向
2277
2284
  * @defaultValue y
2278
2285
  */
2279
- axis?: "x" | "y";
2286
+ axis?: 'x' | 'y';
2280
2287
  /**
2281
2288
  * @en cover height or width
2282
2289
  * @zh 沉浸式高度/宽度
@@ -2285,9 +2292,9 @@ interface UseStickyParams {
2285
2292
  nav: number;
2286
2293
  }
2287
2294
 
2288
- declare const useSticky: (targetElement: BasicTarget<HTMLElement>, { axis, nav }: UseStickyParams, scrollElement?: BasicTarget<HTMLElement>) => [boolean, react__default.Dispatch<react__default.SetStateAction<boolean>>];
2295
+ declare function useSticky(targetElement: BasicTarget<HTMLElement>, { axis, nav }: UseStickyParams, scrollElement?: BasicTarget<HTMLElement>): [boolean, react__default.Dispatch<react__default.SetStateAction<boolean>>];
2289
2296
 
2290
- declare const useSupported: (callback: () => unknown, sync?: boolean) => boolean;
2297
+ declare function useSupported(callback: () => unknown, sync?: boolean): boolean;
2291
2298
 
2292
2299
  /**
2293
2300
  * @title useTextDirection
@@ -2324,7 +2331,7 @@ interface UseTextDirectionOptions {
2324
2331
  /**
2325
2332
  * @title UseTextDirectionValue
2326
2333
  */
2327
- type UseTextDirectionValue = "ltr" | "rtl" | "auto";
2334
+ type UseTextDirectionValue = 'ltr' | 'rtl' | 'auto';
2328
2335
 
2329
2336
  declare const useTextDirection: UseTextDirection;
2330
2337
 
@@ -2359,7 +2366,7 @@ options?: ThrottleSettings) => T;
2359
2366
 
2360
2367
  declare const useThrottle: UseThrottle;
2361
2368
 
2362
- declare const useThrottleFn: <T extends (...args: any) => any>(fn: T, wait?: number, options?: ThrottleSettings) => {
2369
+ declare function useThrottleFn<T extends (...args: any) => any>(fn: T, wait?: number, options?: ThrottleSettings): {
2363
2370
  run: lodash.DebouncedFunc<(...args_0: Parameters<T>) => ReturnType<T>>;
2364
2371
  cancel: () => void;
2365
2372
  flush: () => ReturnType<T> | undefined;
@@ -2453,9 +2460,9 @@ declare const useTimeoutFn: UseTimeoutFn;
2453
2460
  */
2454
2461
  type UseTitle = (
2455
2462
  /**
2456
- * @zh 标题
2457
- * @en title
2458
- */
2463
+ * @zh 标题
2464
+ * @en title
2465
+ */
2459
2466
  title: string) => void;
2460
2467
 
2461
2468
  declare const useTitle: UseTitle;
@@ -2478,9 +2485,9 @@ initialValue: boolean) => [boolean, (nextValue?: any) => void];
2478
2485
 
2479
2486
  declare const useToggle: UseToggle;
2480
2487
 
2481
- declare const useUnmount: (fn: () => void) => void;
2488
+ declare function useUnmount(fn: () => void): void;
2482
2489
 
2483
- declare const useUpdate: () => () => void;
2490
+ declare function useUpdate(): () => void;
2484
2491
 
2485
2492
  declare const useUpdateEffect: typeof useEffect | typeof react.useLayoutEffect;
2486
2493
 
@@ -2542,7 +2549,7 @@ options?: NotificationOptions) => Notification | undefined;
2542
2549
 
2543
2550
  declare const useWebNotification: UseWebNotification;
2544
2551
 
2545
- declare const useWindowsFocus: (defauleValue?: boolean) => boolean;
2552
+ declare function useWindowsFocus(defauleValue?: boolean): boolean;
2546
2553
 
2547
2554
  /**
2548
2555
  * @title useWindowScroll
@@ -2565,7 +2572,7 @@ interface UseWindowScrollState {
2565
2572
  y: number;
2566
2573
  }
2567
2574
 
2568
- declare const useWindowScroll: () => UseWindowScrollState;
2575
+ declare function useWindowScroll(): UseWindowScrollState;
2569
2576
 
2570
2577
  /**
2571
2578
  * @title useWindowSize
@@ -2573,8 +2580,8 @@ declare const useWindowScroll: () => UseWindowScrollState;
2573
2580
  * - width: The current window width.
2574
2581
  * - height: The current window height.
2575
2582
  * @returns 包含以下元素的对象:
2576
- * - width:当前视窗宽度。
2577
- * - height: 当前视窗高度。
2583
+ * - width:当前视窗宽度。
2584
+ * - height: 当前视窗高度。
2578
2585
  */
2579
2586
  type UseWindowSize = () => {
2580
2587
  readonly width: number;
@@ -2592,7 +2599,7 @@ type UseClipboard = () => readonly [string, (txt: string) => Promise<void>];
2592
2599
 
2593
2600
  declare const useClipboard: UseClipboard;
2594
2601
 
2595
- type Platform = "ios" | "android" | "unknown";
2602
+ type Platform = 'ios' | 'android' | 'unknown';
2596
2603
  /**
2597
2604
  * @title UsePlatformProps
2598
2605
  */
@@ -2619,25 +2626,25 @@ interface UsePlatformReturn {
2619
2626
  */
2620
2627
  platform: Platform;
2621
2628
  /**
2622
- * @zh 是否在小程序中
2623
- * @en Whether in mini program
2624
- */
2629
+ * @zh 是否在小程序中
2630
+ * @en Whether in mini program
2631
+ */
2625
2632
  isInMiniProgram: () => boolean;
2626
2633
  /**
2627
- * @zh 是否在微信中
2628
- * @en whether in wechat
2629
- */
2634
+ * @zh 是否在微信中
2635
+ * @en whether in wechat
2636
+ */
2630
2637
  isInWechat: () => boolean;
2631
2638
  /**
2632
- * @zh 是否是 iPhoneX
2633
- * @en whether is iPhoneX
2634
- */
2639
+ * @zh 是否是 iPhoneX
2640
+ * @en whether is iPhoneX
2641
+ */
2635
2642
  isiPhoneX: () => boolean;
2636
2643
  }
2637
2644
 
2638
2645
  declare const usePlatform: UsePlatform;
2639
2646
 
2640
- declare const useMobileLandscape: () => boolean;
2647
+ declare function useMobileLandscape(): boolean;
2641
2648
 
2642
2649
  /**
2643
2650
  * @title useControlledState
@@ -2695,7 +2702,7 @@ interface UseDisclosureProps {
2695
2702
  * @en Callback when disclosure is changed
2696
2703
  * @zh 状态改变时的回调
2697
2704
  */
2698
- onChange?(isOpen: boolean | undefined): void;
2705
+ onChange?: (isOpen: boolean | undefined) => void;
2699
2706
  }
2700
2707
  /**
2701
2708
  * @title useDisclosure
@@ -2708,7 +2715,7 @@ type UseDisclosure = (props?: UseDisclosureProps) => {
2708
2715
  isControlled: boolean;
2709
2716
  };
2710
2717
 
2711
- declare const useDisclosure: (props?: UseDisclosureProps) => {
2718
+ declare function useDisclosure(props?: UseDisclosureProps): {
2712
2719
  isOpen: boolean;
2713
2720
  onOpen: () => void;
2714
2721
  onClose: () => void;
@@ -2716,7 +2723,7 @@ declare const useDisclosure: (props?: UseDisclosureProps) => {
2716
2723
  isControlled: boolean;
2717
2724
  };
2718
2725
 
2719
- type EventSourceStatus = "CONNECTING" | "CONNECTED" | "DISCONNECTED";
2726
+ type EventSourceStatus = 'CONNECTING' | 'CONNECTED' | 'DISCONNECTED';
2720
2727
  /**
2721
2728
  * @title UseEventSourceOptions
2722
2729
  */
@@ -2824,7 +2831,12 @@ type PossibleRef<T> = Ref<T> | undefined;
2824
2831
 
2825
2832
  declare function assignRef<T>(ref: PossibleRef<T>, value: T): void;
2826
2833
  declare function mergeRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
2827
- declare const useMergedRefs: <T>(...refs: PossibleRef<T>[]) => (node: T | null) => void;
2834
+ declare function useMergedRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
2835
+
2836
+ /**
2837
+ * @description copy from swr
2838
+ */
2839
+ declare const use: any;
2828
2840
 
2829
2841
  /**
2830
2842
  * @title useDocumentVisiblity
@@ -3178,4 +3190,35 @@ defauleValue?: boolean) => boolean;
3178
3190
  */
3179
3191
  type UseMobileLandscape = () => boolean;
3180
3192
 
3181
- export { type ColorScheme, type Contrast, type DepsEqualFnType, type EventSourceStatus, type EventType, type INetworkInformation, type IUseNetworkState, type KeyModifier, type Pausable, type Platform, type PossibleRef, type UseActiveElement, type UseAsyncEffect, type UseClickOutside, type UseClipboard, type UseControlled, type UseCookie, type UseCookieState, type UseCountDown, type UseCounter, type UseCssVar, type UseCssVarOptions, type UseCustomCompareEffect, type UseCycleList, type UseDarkMode, type UseDarkOptions, type UseDebounce, type UseDebounceFn, type UseDeepCompareEffect, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementSize, type UseElementVisibility, type UseEvent, type UseEventEmitter, type UseEventEmitterDisposable, type UseEventEmitterEvent, type UseEventEmitterEventOnce, type UseEventEmitterListener, type UseEventEmitterReturn, type UseEventListener, type UseEventSource, type UseEventSourceAutoReconnectOptions, type UseEventSourceOptions, type UseEventSourceReturn, type UseEyeDropper, type UseEyeDropperOpenOptions, type UseEyeDropperOpenReturnType, type UseFavicon, type UseFileDialog, type UseFileDialogOptions, type UseFirstMountState, type UseFocus, type UseFps, type UseFpsOptions, type UseFullScreenOptions, type UseFullscreen, type UseGeolocation, type UseHover, type UseIdle, type UseInfiniteScroll, type UseInfiniteScrollArrivedState, type UseInfiniteScrollDirection, type UseInfiniteScrollLoadMore, type UseInfiniteScrollOptions, type UseIntersectionObserver, type UseInterval, type UseIntervalOptions, type UseKeyModifier, type UseLatest, type UseLocalStorage, type UseLocalStorageOptions, type UseLocalStorageSerializer, type UseLocationSelector, type UseLongPress, type UseLongPressOptions, type UseMeasure, type UseMeasureRect, type UseMediaDeviceOptions, type UseMediaDevices, type UseMediaQuery, type UseMergedRef, type UseMobileLandscape, type UseModifierOptions, type UseMount, type UseMountedState, type UseMouse, type UseMouseCursorState, type UseMousePressed, type UseMousePressedOptions, type UseMousePressedSourceType, type UseMutationObserver, type UseNetwork, type UseObjectUrl, type UseOnline, type UseOrientation, type UseOrientationLockType, type UseOrientationState, type UseOrientationType, type UsePageLeave, type UsePermission, type UsePermissionDescriptorNamePolyfill, type UsePermissionGeneralPermissionDescriptor, type UsePermissionState, type UsePlatform, type UsePlatformProps, type UsePlatformReturn, type UsePreferredColorScheme, type UsePreferredContrast, type UsePreferredDark, type UsePrevious, type UseRafFn, type UseRafState, type UseReducedMotion, type UseResizeObserver, type UseScreenSafeArea, type UseScriptTag, type UseScriptTagOptions, type UseScriptTagStatus, type UseScroll, type UseScrollArrivedState, type UseScrollDirection, type UseScrollIntoView, type UseScrollIntoViewAnimation, type UseScrollIntoViewParams, type UseScrollLock, type UseScrollOffset, type UseScrollOptions, type UseSessionStorage, type UseSessionStorageOptions, type UseSessionStorageSerializer, type UseSetState, type UseSticky, type UseStickyParams, type UseSupported, type UseTextDirection, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTextSelection, type UseThrottle, type UseThrottleFn, type UseTimeout, type UseTimeoutFn, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseTitle, type UseToggle, type UseUnmount, type UseUpdate, type UseWebNotification, type UseWebNotificationReturn, type UseWebNotificationShow, type UseWindowScroll, type UseWindowScrollState, type UseWindowSize, type UseWindowsFocus, assignRef, defaultOptions, mergeRefs, useActiveElement, useAsyncEffect, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, 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, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
3193
+ interface ThenableImpl<T> {
3194
+ then: (onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown) => void | PromiseLike<unknown>;
3195
+ }
3196
+ interface UntrackedThenable<T> extends ThenableImpl<T> {
3197
+ status?: void;
3198
+ }
3199
+ interface PendingThenable<T> extends ThenableImpl<T> {
3200
+ status: 'pending';
3201
+ }
3202
+ interface FulfilledThenable<T> extends ThenableImpl<T> {
3203
+ status: 'fulfilled';
3204
+ value: T;
3205
+ }
3206
+ interface RejectedThenable<T> extends ThenableImpl<T> {
3207
+ status: 'rejected';
3208
+ reason: unknown;
3209
+ }
3210
+ type Thenable<T> = UntrackedThenable<T> | PendingThenable<T> | FulfilledThenable<T> | RejectedThenable<T>;
3211
+ type Usable<T> = Thenable<T> | Context<T>;
3212
+ /**
3213
+ * @title Use
3214
+ * @returns 解析状态值
3215
+ * @returns_en resolved state value
3216
+ */
3217
+ type Use = <T>(
3218
+ /**
3219
+ * @zh promise 或者 context
3220
+ * @en promise or context
3221
+ */
3222
+ usable: Usable<T>) => T;
3223
+
3224
+ export { type ColorScheme, type Contrast, type DepsEqualFnType, type EventSourceStatus, type EventType, type INetworkInformation, type IUseNetworkState, type KeyModifier, type Pausable, type Platform, type PossibleRef, type Use, type UseActiveElement, type UseAsyncEffect, type UseClickOutside, type UseClipboard, type UseControlled, type UseCookie, type UseCookieState, type UseCountDown, type UseCounter, type UseCssVar, type UseCssVarOptions, type UseCustomCompareEffect, type UseCycleList, type UseDarkMode, type UseDarkOptions, type UseDebounce, type UseDebounceFn, type UseDeepCompareEffect, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementSize, type UseElementVisibility, type UseEvent, type UseEventEmitter, type UseEventEmitterDisposable, type UseEventEmitterEvent, type UseEventEmitterEventOnce, type UseEventEmitterListener, type UseEventEmitterReturn, type UseEventListener, type UseEventSource, type UseEventSourceAutoReconnectOptions, type UseEventSourceOptions, type UseEventSourceReturn, type UseEyeDropper, type UseEyeDropperOpenOptions, type UseEyeDropperOpenReturnType, type UseFavicon, type UseFileDialog, type UseFileDialogOptions, type UseFirstMountState, type UseFocus, type UseFps, type UseFpsOptions, type UseFullScreenOptions, type UseFullscreen, type UseGeolocation, type UseHover, type UseIdle, type UseInfiniteScroll, type UseInfiniteScrollArrivedState, type UseInfiniteScrollDirection, type UseInfiniteScrollLoadMore, type UseInfiniteScrollOptions, type UseIntersectionObserver, type UseInterval, type UseIntervalOptions, type UseKeyModifier, type UseLatest, type UseLocalStorage, type UseLocalStorageOptions, type UseLocalStorageSerializer, type UseLocationSelector, type UseLongPress, type UseLongPressOptions, type UseMeasure, type UseMeasureRect, type UseMediaDeviceOptions, type UseMediaDevices, type UseMediaQuery, type UseMergedRef, type UseMobileLandscape, type UseModifierOptions, type UseMount, type UseMountedState, type UseMouse, type UseMouseCursorState, type UseMousePressed, type UseMousePressedOptions, type UseMousePressedSourceType, type UseMutationObserver, type UseNetwork, type UseObjectUrl, type UseOnline, type UseOrientation, type UseOrientationLockType, type UseOrientationState, type UseOrientationType, type UsePageLeave, type UsePermission, type UsePermissionDescriptorNamePolyfill, type UsePermissionGeneralPermissionDescriptor, type UsePermissionState, type UsePlatform, type UsePlatformProps, type UsePlatformReturn, type UsePreferredColorScheme, type UsePreferredContrast, type UsePreferredDark, type UsePrevious, type UseRafFn, type UseRafState, type UseReducedMotion, type UseResizeObserver, type UseScreenSafeArea, type UseScriptTag, type UseScriptTagOptions, type UseScriptTagStatus, type UseScroll, type UseScrollArrivedState, type UseScrollDirection, type UseScrollIntoView, type UseScrollIntoViewAnimation, type UseScrollIntoViewParams, type UseScrollLock, type UseScrollOffset, type UseScrollOptions, type UseSessionStorage, type UseSessionStorageOptions, type UseSessionStorageSerializer, type UseSetState, type UseSticky, type UseStickyParams, type UseSupported, type UseTextDirection, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTextSelection, type UseThrottle, type UseThrottleFn, type UseTimeout, type UseTimeoutFn, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseTitle, type UseToggle, type UseUnmount, type UseUpdate, type UseWebNotification, type UseWebNotificationReturn, type UseWebNotificationShow, type UseWindowScroll, type UseWindowScrollState, type UseWindowSize, type UseWindowsFocus, assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, 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, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };