@reactuses/core 5.0.16 → 5.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/{index-client-DSNqfa2q.cjs → index-client-DJgtg2U_.cjs} +4 -3
- package/dist/{index-client-KksAIxbB.js → index-client-Qon46B4S.js} +4 -3
- package/dist/index.cjs +372 -339
- package/dist/index.d.cts +132 -96
- package/dist/index.d.mts +132 -96
- package/dist/index.d.ts +132 -96
- package/dist/index.mjs +372 -341
- package/package.json +4 -4
package/dist/index.d.ts
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
|
|
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 =
|
|
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
|
-
|
|
558
|
-
|
|
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
|
-
|
|
695
|
-
|
|
696
|
-
|
|
694
|
+
* @zh dom对象
|
|
695
|
+
* @en dom element
|
|
696
|
+
*/
|
|
697
697
|
target: BasicTarget<HTMLElement | SVGElement>,
|
|
698
698
|
/**
|
|
699
|
-
|
|
700
|
-
|
|
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()
|
|
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
|
|
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
|
|
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
|
|
906
|
+
declare function useFps(options?: UseFpsOptions): number;
|
|
907
907
|
|
|
908
908
|
/**
|
|
909
909
|
* @title useFullScreen
|
|
@@ -1220,7 +1220,7 @@ interface UseInfiniteScrollOptions extends UseScrollOptions {
|
|
|
1220
1220
|
* @zh 滚动方向
|
|
1221
1221
|
* @defaultValue 'bottom'
|
|
1222
1222
|
*/
|
|
1223
|
-
direction?:
|
|
1223
|
+
direction?: 'top' | 'bottom' | 'left' | 'right';
|
|
1224
1224
|
/**
|
|
1225
1225
|
* @en Whether to preserve the current scroll position when loading more items.
|
|
1226
1226
|
* @zh 加载更多项目时是否保留当前滚动位置
|
|
@@ -1380,7 +1380,7 @@ modifier: KeyModifier,
|
|
|
1380
1380
|
* @en optional params
|
|
1381
1381
|
*/
|
|
1382
1382
|
options?: UseModifierOptions) => boolean;
|
|
1383
|
-
type KeyModifier =
|
|
1383
|
+
type KeyModifier = 'Alt' | 'AltGraph' | 'CapsLock' | 'Control' | 'Fn' | 'FnLock' | 'Meta' | 'NumLock' | 'ScrollLock' | 'Shift' | 'Symbol' | 'SymbolLock';
|
|
1384
1384
|
/**
|
|
1385
1385
|
* @title UseModifierOptions
|
|
1386
1386
|
*/
|
|
@@ -1416,8 +1416,8 @@ value: T) => MutableRefObject<T>;
|
|
|
1416
1416
|
declare const useLatest: UseLatest;
|
|
1417
1417
|
|
|
1418
1418
|
interface Serializer<T> {
|
|
1419
|
-
read(raw: string)
|
|
1420
|
-
write(value: T)
|
|
1419
|
+
read: (raw: string) => T;
|
|
1420
|
+
write: (value: T) => string;
|
|
1421
1421
|
}
|
|
1422
1422
|
interface UseStorageOptions<T> {
|
|
1423
1423
|
/**
|
|
@@ -1530,7 +1530,7 @@ options?: ResizeObserverOptions) => readonly [UseMeasureRect, () => void];
|
|
|
1530
1530
|
/**
|
|
1531
1531
|
* @title UseMeasureRect
|
|
1532
1532
|
*/
|
|
1533
|
-
type UseMeasureRect = Omit<DOMRectReadOnly,
|
|
1533
|
+
type UseMeasureRect = Omit<DOMRectReadOnly, 'toJSON'>;
|
|
1534
1534
|
|
|
1535
1535
|
declare const useMeasure: UseMeasure;
|
|
1536
1536
|
|
|
@@ -1611,7 +1611,7 @@ effect: () => void) => void;
|
|
|
1611
1611
|
|
|
1612
1612
|
declare const useMount: UseMount;
|
|
1613
1613
|
|
|
1614
|
-
declare
|
|
1614
|
+
declare function useMountedState(): () => boolean;
|
|
1615
1615
|
|
|
1616
1616
|
/**
|
|
1617
1617
|
* @title useMouse
|
|
@@ -1690,7 +1690,7 @@ interface UseMousePressedOptions {
|
|
|
1690
1690
|
/**
|
|
1691
1691
|
* @title UseMousePressedSourceType
|
|
1692
1692
|
*/
|
|
1693
|
-
type UseMousePressedSourceType =
|
|
1693
|
+
type UseMousePressedSourceType = 'mouse' | 'touch' | null;
|
|
1694
1694
|
|
|
1695
1695
|
declare const useMousePressed: UseMousePressed;
|
|
1696
1696
|
|
|
@@ -1749,13 +1749,13 @@ interface IUseNetworkState {
|
|
|
1749
1749
|
* @zh 有效带宽估计(以兆位每秒为单位),四舍五入到
|
|
1750
1750
|
* 25 kbps 的最接近倍数。
|
|
1751
1751
|
*/
|
|
1752
|
-
downlink: INetworkInformation[
|
|
1752
|
+
downlink: INetworkInformation['downlink'] | undefined;
|
|
1753
1753
|
/**
|
|
1754
1754
|
* @en Maximum downlink speed, in megabits per second (Mbps), for the
|
|
1755
1755
|
* underlying connection technology
|
|
1756
1756
|
* @zh 最大下行链路速度,以兆比特每秒 (Mbps) 为单位
|
|
1757
1757
|
*/
|
|
1758
|
-
downlinkMax: INetworkInformation[
|
|
1758
|
+
downlinkMax: INetworkInformation['downlinkMax'] | undefined;
|
|
1759
1759
|
/**
|
|
1760
1760
|
* @en Effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'.
|
|
1761
1761
|
* This value is determined using a combination of recently observed round-trip time
|
|
@@ -1763,19 +1763,19 @@ interface IUseNetworkState {
|
|
|
1763
1763
|
* @zh 连接的有效类型,表示“slow-2g”、“2g”、“3g”或“4g”之一。
|
|
1764
1764
|
* 该值是根据最近观察到的往返时间和和下行链路值的组合确定的
|
|
1765
1765
|
*/
|
|
1766
|
-
effectiveType: INetworkInformation[
|
|
1766
|
+
effectiveType: INetworkInformation['effectiveType'] | undefined;
|
|
1767
1767
|
/**
|
|
1768
1768
|
* @en Estimated effective round-trip time of the current connection, rounded
|
|
1769
1769
|
* to the nearest multiple of 25 milliseconds
|
|
1770
1770
|
* @zh 当前连接的估计有效往返时间,四舍五入
|
|
1771
1771
|
* 精确到 25 毫秒的最接近倍数
|
|
1772
1772
|
*/
|
|
1773
|
-
rtt: INetworkInformation[
|
|
1773
|
+
rtt: INetworkInformation['rtt'] | undefined;
|
|
1774
1774
|
/**
|
|
1775
1775
|
* @en {true} if the user has set a reduced data usage option on the user agent.
|
|
1776
1776
|
* @zh 如果用户在用户代理上设置了减少数据使用选项,则为 {true}。
|
|
1777
1777
|
*/
|
|
1778
|
-
saveData: INetworkInformation[
|
|
1778
|
+
saveData: INetworkInformation['saveData'] | undefined;
|
|
1779
1779
|
/**
|
|
1780
1780
|
* @en The type of connection a device is using to communicate with the network.
|
|
1781
1781
|
* It will be one of the following values:
|
|
@@ -1798,15 +1798,15 @@ interface IUseNetworkState {
|
|
|
1798
1798
|
* - 其他
|
|
1799
1799
|
* - 未知
|
|
1800
1800
|
*/
|
|
1801
|
-
type: INetworkInformation[
|
|
1801
|
+
type: INetworkInformation['type'] | undefined;
|
|
1802
1802
|
}
|
|
1803
1803
|
interface INetworkInformation extends EventTarget {
|
|
1804
1804
|
readonly downlink: number;
|
|
1805
1805
|
readonly downlinkMax: number;
|
|
1806
|
-
readonly effectiveType:
|
|
1806
|
+
readonly effectiveType: 'slow-2g' | '2g' | '3g' | '4g';
|
|
1807
1807
|
readonly rtt: number;
|
|
1808
1808
|
readonly saveData: boolean;
|
|
1809
|
-
readonly type:
|
|
1809
|
+
readonly type: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
|
|
1810
1810
|
onChange: (event: Event) => void;
|
|
1811
1811
|
}
|
|
1812
1812
|
|
|
@@ -1878,15 +1878,15 @@ interface UseOrientationState {
|
|
|
1878
1878
|
/**
|
|
1879
1879
|
* @title UseOrientationType
|
|
1880
1880
|
*/
|
|
1881
|
-
type UseOrientationType =
|
|
1881
|
+
type UseOrientationType = 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
|
|
1882
1882
|
/**
|
|
1883
1883
|
* @title UseOrientationLockType
|
|
1884
1884
|
*/
|
|
1885
|
-
type UseOrientationLockType =
|
|
1885
|
+
type UseOrientationLockType = 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
|
|
1886
1886
|
|
|
1887
1887
|
declare const useOrientation: UseOrientation;
|
|
1888
1888
|
|
|
1889
|
-
declare
|
|
1889
|
+
declare function usePageLeave(): boolean;
|
|
1890
1890
|
|
|
1891
1891
|
/**
|
|
1892
1892
|
* @title usePermission
|
|
@@ -1898,11 +1898,11 @@ type UsePermission = (
|
|
|
1898
1898
|
* @zh 权限描述符
|
|
1899
1899
|
* @en permission desc
|
|
1900
1900
|
*/
|
|
1901
|
-
permissionDesc: UsePermissionGeneralPermissionDescriptor | UsePermissionGeneralPermissionDescriptor[
|
|
1901
|
+
permissionDesc: UsePermissionGeneralPermissionDescriptor | UsePermissionGeneralPermissionDescriptor['name']) => UsePermissionState;
|
|
1902
1902
|
/**
|
|
1903
1903
|
* @title UsePermissionState
|
|
1904
1904
|
*/
|
|
1905
|
-
type UsePermissionState = PermissionState |
|
|
1905
|
+
type UsePermissionState = PermissionState | '';
|
|
1906
1906
|
/**
|
|
1907
1907
|
* @title UsePermissionGeneralPermissionDescriptor
|
|
1908
1908
|
*/
|
|
@@ -1912,7 +1912,7 @@ type UsePermissionGeneralPermissionDescriptor = PermissionDescriptor | {
|
|
|
1912
1912
|
/**
|
|
1913
1913
|
* @title UsePermissionDescriptorNamePolyfill
|
|
1914
1914
|
*/
|
|
1915
|
-
type UsePermissionDescriptorNamePolyfill =
|
|
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';
|
|
1916
1916
|
|
|
1917
1917
|
declare const usePermission: UsePermission;
|
|
1918
1918
|
|
|
@@ -1931,7 +1931,7 @@ defaultState?: ColorScheme) => ColorScheme;
|
|
|
1931
1931
|
/**
|
|
1932
1932
|
* @title ColorScheme
|
|
1933
1933
|
*/
|
|
1934
|
-
type ColorScheme =
|
|
1934
|
+
type ColorScheme = 'dark' | 'light' | 'no-preference';
|
|
1935
1935
|
|
|
1936
1936
|
declare const usePreferredColorScheme: UsePreferredColorScheme;
|
|
1937
1937
|
|
|
@@ -1948,13 +1948,13 @@ defaultState?: Contrast) => Contrast;
|
|
|
1948
1948
|
/**
|
|
1949
1949
|
* @title Contrast
|
|
1950
1950
|
*/
|
|
1951
|
-
type Contrast =
|
|
1951
|
+
type Contrast = 'more' | 'less' | 'custom' | 'no-preference';
|
|
1952
1952
|
|
|
1953
1953
|
declare const usePreferredContrast: UsePreferredContrast;
|
|
1954
1954
|
|
|
1955
|
-
declare
|
|
1955
|
+
declare function usePreferredDark(defaultState?: boolean): boolean;
|
|
1956
1956
|
|
|
1957
|
-
declare
|
|
1957
|
+
declare function usePrevious<T>(state: T): T | undefined;
|
|
1958
1958
|
|
|
1959
1959
|
/**
|
|
1960
1960
|
* @title useRafFn
|
|
@@ -1981,9 +1981,9 @@ initiallyActive?: boolean) => readonly [() => void, () => void, () => boolean];
|
|
|
1981
1981
|
|
|
1982
1982
|
declare const useRafFn: UseRafFn;
|
|
1983
1983
|
|
|
1984
|
-
declare
|
|
1984
|
+
declare function useRafState<S>(initialState: S | (() => S)): readonly [S, Dispatch<SetStateAction<S>>];
|
|
1985
1985
|
|
|
1986
|
-
declare
|
|
1986
|
+
declare function useReducedMotion(defaultState?: boolean): boolean;
|
|
1987
1987
|
|
|
1988
1988
|
/**
|
|
1989
1989
|
* @title useResizeObserver
|
|
@@ -2000,14 +2000,14 @@ target: BasicTarget<Element>,
|
|
|
2000
2000
|
*/
|
|
2001
2001
|
callback: ResizeObserverCallback,
|
|
2002
2002
|
/**
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2003
|
+
* @zh `resizeObserver` 参数
|
|
2004
|
+
* @en options passed to `resizeObserver`
|
|
2005
|
+
*/
|
|
2006
2006
|
options?: ResizeObserverOptions) => () => void;
|
|
2007
2007
|
|
|
2008
2008
|
declare const useResizeObserver: UseResizeObserver;
|
|
2009
2009
|
|
|
2010
|
-
declare
|
|
2010
|
+
declare function useScreenSafeArea(): readonly [string, string, string, string, lodash.DebouncedFunc<() => void>];
|
|
2011
2011
|
|
|
2012
2012
|
/**
|
|
2013
2013
|
* @title useScriptTag
|
|
@@ -2075,12 +2075,12 @@ interface UseScriptTagOptions {
|
|
|
2075
2075
|
* @zh 跨域属性
|
|
2076
2076
|
* @en cross origin
|
|
2077
2077
|
*/
|
|
2078
|
-
crossOrigin?:
|
|
2078
|
+
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
2079
2079
|
/**
|
|
2080
2080
|
* @en referrer policy
|
|
2081
2081
|
* @zh 来源属性
|
|
2082
2082
|
*/
|
|
2083
|
-
referrerPolicy?:
|
|
2083
|
+
referrerPolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
|
2084
2084
|
/**
|
|
2085
2085
|
* @en Add `noModule` attribute to the script tag
|
|
2086
2086
|
* @zh 在 `script` 标签上加上 `noModule`
|
|
@@ -2100,7 +2100,7 @@ interface UseScriptTagOptions {
|
|
|
2100
2100
|
/**
|
|
2101
2101
|
* @title UseScriptTagStatus
|
|
2102
2102
|
*/
|
|
2103
|
-
type UseScriptTagStatus =
|
|
2103
|
+
type UseScriptTagStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
2104
2104
|
|
|
2105
2105
|
declare const useScriptTag: UseScriptTag;
|
|
2106
2106
|
|
|
@@ -2141,7 +2141,7 @@ interface UseScrollIntoViewAnimation {
|
|
|
2141
2141
|
* @en target element alignment relatively to parent based on current axis
|
|
2142
2142
|
* @zh 基于当前轴的目标元素相对于父元素的对齐方式
|
|
2143
2143
|
*/
|
|
2144
|
-
alignment?:
|
|
2144
|
+
alignment?: 'start' | 'end' | 'center';
|
|
2145
2145
|
}
|
|
2146
2146
|
/**
|
|
2147
2147
|
* @title UseScrollIntoViewParams
|
|
@@ -2163,7 +2163,7 @@ interface UseScrollIntoViewParams {
|
|
|
2163
2163
|
* @zh 滚动方向
|
|
2164
2164
|
* @defaultValue y
|
|
2165
2165
|
*/
|
|
2166
|
-
axis?:
|
|
2166
|
+
axis?: 'x' | 'y';
|
|
2167
2167
|
/**
|
|
2168
2168
|
* @en custom mathematical easing function
|
|
2169
2169
|
* @zh 自定义缓和数学函数
|
|
@@ -2185,7 +2185,7 @@ interface UseScrollIntoViewParams {
|
|
|
2185
2185
|
/**
|
|
2186
2186
|
* @en prevents content jumping in scrolling lists with multiple targets
|
|
2187
2187
|
* @zh 防止内容在具有多个目标的滚动列表中跳跃
|
|
2188
|
-
|
|
2188
|
+
*/
|
|
2189
2189
|
isList?: boolean;
|
|
2190
2190
|
}
|
|
2191
2191
|
|
|
@@ -2276,7 +2276,7 @@ interface UseStickyParams {
|
|
|
2276
2276
|
* @zh 滚动方向
|
|
2277
2277
|
* @defaultValue y
|
|
2278
2278
|
*/
|
|
2279
|
-
axis?:
|
|
2279
|
+
axis?: 'x' | 'y';
|
|
2280
2280
|
/**
|
|
2281
2281
|
* @en cover height or width
|
|
2282
2282
|
* @zh 沉浸式高度/宽度
|
|
@@ -2285,9 +2285,9 @@ interface UseStickyParams {
|
|
|
2285
2285
|
nav: number;
|
|
2286
2286
|
}
|
|
2287
2287
|
|
|
2288
|
-
declare
|
|
2288
|
+
declare function useSticky(targetElement: BasicTarget<HTMLElement>, { axis, nav }: UseStickyParams, scrollElement?: BasicTarget<HTMLElement>): [boolean, react__default.Dispatch<react__default.SetStateAction<boolean>>];
|
|
2289
2289
|
|
|
2290
|
-
declare
|
|
2290
|
+
declare function useSupported(callback: () => unknown, sync?: boolean): boolean;
|
|
2291
2291
|
|
|
2292
2292
|
/**
|
|
2293
2293
|
* @title useTextDirection
|
|
@@ -2324,7 +2324,7 @@ interface UseTextDirectionOptions {
|
|
|
2324
2324
|
/**
|
|
2325
2325
|
* @title UseTextDirectionValue
|
|
2326
2326
|
*/
|
|
2327
|
-
type UseTextDirectionValue =
|
|
2327
|
+
type UseTextDirectionValue = 'ltr' | 'rtl' | 'auto';
|
|
2328
2328
|
|
|
2329
2329
|
declare const useTextDirection: UseTextDirection;
|
|
2330
2330
|
|
|
@@ -2359,7 +2359,7 @@ options?: ThrottleSettings) => T;
|
|
|
2359
2359
|
|
|
2360
2360
|
declare const useThrottle: UseThrottle;
|
|
2361
2361
|
|
|
2362
|
-
declare
|
|
2362
|
+
declare function useThrottleFn<T extends (...args: any) => any>(fn: T, wait?: number, options?: ThrottleSettings): {
|
|
2363
2363
|
run: lodash.DebouncedFunc<(...args_0: Parameters<T>) => ReturnType<T>>;
|
|
2364
2364
|
cancel: () => void;
|
|
2365
2365
|
flush: () => ReturnType<T> | undefined;
|
|
@@ -2453,9 +2453,9 @@ declare const useTimeoutFn: UseTimeoutFn;
|
|
|
2453
2453
|
*/
|
|
2454
2454
|
type UseTitle = (
|
|
2455
2455
|
/**
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2456
|
+
* @zh 标题
|
|
2457
|
+
* @en title
|
|
2458
|
+
*/
|
|
2459
2459
|
title: string) => void;
|
|
2460
2460
|
|
|
2461
2461
|
declare const useTitle: UseTitle;
|
|
@@ -2478,9 +2478,9 @@ initialValue: boolean) => [boolean, (nextValue?: any) => void];
|
|
|
2478
2478
|
|
|
2479
2479
|
declare const useToggle: UseToggle;
|
|
2480
2480
|
|
|
2481
|
-
declare
|
|
2481
|
+
declare function useUnmount(fn: () => void): void;
|
|
2482
2482
|
|
|
2483
|
-
declare
|
|
2483
|
+
declare function useUpdate(): () => void;
|
|
2484
2484
|
|
|
2485
2485
|
declare const useUpdateEffect: typeof useEffect | typeof react.useLayoutEffect;
|
|
2486
2486
|
|
|
@@ -2542,7 +2542,7 @@ options?: NotificationOptions) => Notification | undefined;
|
|
|
2542
2542
|
|
|
2543
2543
|
declare const useWebNotification: UseWebNotification;
|
|
2544
2544
|
|
|
2545
|
-
declare
|
|
2545
|
+
declare function useWindowsFocus(defauleValue?: boolean): boolean;
|
|
2546
2546
|
|
|
2547
2547
|
/**
|
|
2548
2548
|
* @title useWindowScroll
|
|
@@ -2565,7 +2565,7 @@ interface UseWindowScrollState {
|
|
|
2565
2565
|
y: number;
|
|
2566
2566
|
}
|
|
2567
2567
|
|
|
2568
|
-
declare
|
|
2568
|
+
declare function useWindowScroll(): UseWindowScrollState;
|
|
2569
2569
|
|
|
2570
2570
|
/**
|
|
2571
2571
|
* @title useWindowSize
|
|
@@ -2573,8 +2573,8 @@ declare const useWindowScroll: () => UseWindowScrollState;
|
|
|
2573
2573
|
* - width: The current window width.
|
|
2574
2574
|
* - height: The current window height.
|
|
2575
2575
|
* @returns 包含以下元素的对象:
|
|
2576
|
-
|
|
2577
|
-
|
|
2576
|
+
* - width:当前视窗宽度。
|
|
2577
|
+
* - height: 当前视窗高度。
|
|
2578
2578
|
*/
|
|
2579
2579
|
type UseWindowSize = () => {
|
|
2580
2580
|
readonly width: number;
|
|
@@ -2592,7 +2592,7 @@ type UseClipboard = () => readonly [string, (txt: string) => Promise<void>];
|
|
|
2592
2592
|
|
|
2593
2593
|
declare const useClipboard: UseClipboard;
|
|
2594
2594
|
|
|
2595
|
-
type Platform =
|
|
2595
|
+
type Platform = 'ios' | 'android' | 'unknown';
|
|
2596
2596
|
/**
|
|
2597
2597
|
* @title UsePlatformProps
|
|
2598
2598
|
*/
|
|
@@ -2619,25 +2619,25 @@ interface UsePlatformReturn {
|
|
|
2619
2619
|
*/
|
|
2620
2620
|
platform: Platform;
|
|
2621
2621
|
/**
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2622
|
+
* @zh 是否在小程序中
|
|
2623
|
+
* @en Whether in mini program
|
|
2624
|
+
*/
|
|
2625
2625
|
isInMiniProgram: () => boolean;
|
|
2626
2626
|
/**
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2627
|
+
* @zh 是否在微信中
|
|
2628
|
+
* @en whether in wechat
|
|
2629
|
+
*/
|
|
2630
2630
|
isInWechat: () => boolean;
|
|
2631
2631
|
/**
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2632
|
+
* @zh 是否是 iPhoneX
|
|
2633
|
+
* @en whether is iPhoneX
|
|
2634
|
+
*/
|
|
2635
2635
|
isiPhoneX: () => boolean;
|
|
2636
2636
|
}
|
|
2637
2637
|
|
|
2638
2638
|
declare const usePlatform: UsePlatform;
|
|
2639
2639
|
|
|
2640
|
-
declare
|
|
2640
|
+
declare function useMobileLandscape(): boolean;
|
|
2641
2641
|
|
|
2642
2642
|
/**
|
|
2643
2643
|
* @title useControlledState
|
|
@@ -2695,7 +2695,7 @@ interface UseDisclosureProps {
|
|
|
2695
2695
|
* @en Callback when disclosure is changed
|
|
2696
2696
|
* @zh 状态改变时的回调
|
|
2697
2697
|
*/
|
|
2698
|
-
onChange
|
|
2698
|
+
onChange?: (isOpen: boolean | undefined) => void;
|
|
2699
2699
|
}
|
|
2700
2700
|
/**
|
|
2701
2701
|
* @title useDisclosure
|
|
@@ -2708,7 +2708,7 @@ type UseDisclosure = (props?: UseDisclosureProps) => {
|
|
|
2708
2708
|
isControlled: boolean;
|
|
2709
2709
|
};
|
|
2710
2710
|
|
|
2711
|
-
declare
|
|
2711
|
+
declare function useDisclosure(props?: UseDisclosureProps): {
|
|
2712
2712
|
isOpen: boolean;
|
|
2713
2713
|
onOpen: () => void;
|
|
2714
2714
|
onClose: () => void;
|
|
@@ -2716,7 +2716,7 @@ declare const useDisclosure: (props?: UseDisclosureProps) => {
|
|
|
2716
2716
|
isControlled: boolean;
|
|
2717
2717
|
};
|
|
2718
2718
|
|
|
2719
|
-
type EventSourceStatus =
|
|
2719
|
+
type EventSourceStatus = 'CONNECTING' | 'CONNECTED' | 'DISCONNECTED';
|
|
2720
2720
|
/**
|
|
2721
2721
|
* @title UseEventSourceOptions
|
|
2722
2722
|
*/
|
|
@@ -2824,7 +2824,12 @@ type PossibleRef<T> = Ref<T> | undefined;
|
|
|
2824
2824
|
|
|
2825
2825
|
declare function assignRef<T>(ref: PossibleRef<T>, value: T): void;
|
|
2826
2826
|
declare function mergeRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
|
|
2827
|
-
declare
|
|
2827
|
+
declare function useMergedRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
|
|
2828
|
+
|
|
2829
|
+
/**
|
|
2830
|
+
* @description copy from swr
|
|
2831
|
+
*/
|
|
2832
|
+
declare const use: any;
|
|
2828
2833
|
|
|
2829
2834
|
/**
|
|
2830
2835
|
* @title useDocumentVisiblity
|
|
@@ -3178,4 +3183,35 @@ defauleValue?: boolean) => boolean;
|
|
|
3178
3183
|
*/
|
|
3179
3184
|
type UseMobileLandscape = () => boolean;
|
|
3180
3185
|
|
|
3181
|
-
|
|
3186
|
+
interface ThenableImpl<T> {
|
|
3187
|
+
then: (onFulfill: (value: T) => unknown, onReject: (error: unknown) => unknown) => void | PromiseLike<unknown>;
|
|
3188
|
+
}
|
|
3189
|
+
interface UntrackedThenable<T> extends ThenableImpl<T> {
|
|
3190
|
+
status?: void;
|
|
3191
|
+
}
|
|
3192
|
+
interface PendingThenable<T> extends ThenableImpl<T> {
|
|
3193
|
+
status: 'pending';
|
|
3194
|
+
}
|
|
3195
|
+
interface FulfilledThenable<T> extends ThenableImpl<T> {
|
|
3196
|
+
status: 'fulfilled';
|
|
3197
|
+
value: T;
|
|
3198
|
+
}
|
|
3199
|
+
interface RejectedThenable<T> extends ThenableImpl<T> {
|
|
3200
|
+
status: 'rejected';
|
|
3201
|
+
reason: unknown;
|
|
3202
|
+
}
|
|
3203
|
+
type Thenable<T> = UntrackedThenable<T> | PendingThenable<T> | FulfilledThenable<T> | RejectedThenable<T>;
|
|
3204
|
+
type Usable<T> = Thenable<T> | Context<T>;
|
|
3205
|
+
/**
|
|
3206
|
+
* @title Use
|
|
3207
|
+
* @returns 解析状态值
|
|
3208
|
+
* @returns_en resolved state value
|
|
3209
|
+
*/
|
|
3210
|
+
type Use = <T>(
|
|
3211
|
+
/**
|
|
3212
|
+
* @zh promise 或者 context
|
|
3213
|
+
* @en promise or context
|
|
3214
|
+
*/
|
|
3215
|
+
usable: Usable<T>) => T;
|
|
3216
|
+
|
|
3217
|
+
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 };
|