@reactuses/core 5.0.17 → 5.0.19-beta.1

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 CHANGED
@@ -56,19 +56,6 @@ Refer to [documentations](https://reactuse.com/) for more details.
56
56
 
57
57
  <hr/>
58
58
 
59
- ## Sponsor Me
60
-
61
- If my work has helped you, consider buying me a cup of coffee. Thank you very much🥰!.
62
-
63
- [Buy me a coffee](https://www.buymeacoffee.com/lianwenwu)
64
-
65
- ### For Chinese User
66
-
67
- <p float="left">
68
- <img src="https://d21002cb.images-f3o.pages.dev/images/wechat.jpg" alt="Wechat Pay" width="200" />
69
- <img src="https://d21002cb.images-f3o.pages.dev/images/ali.jpg" alt="Ali Pay" width="200" />
70
- </p>
71
-
72
59
  ## Feedback
73
60
 
74
61
  You can submit an [issue](https://github.com/childrentime/reactuse/issues) or provide feedback on [Discord](https://discord.gg/HMsq6cFkKp).
@@ -94,3 +81,16 @@ This project is heavily inspired by the following awesome projects.
94
81
  - [vueuse](https://github.com/vueuse/vueuse)
95
82
 
96
83
  <hr/>
84
+
85
+ ## Sponsor Me
86
+
87
+ If my work has helped you, consider buying me a cup of coffee. Thank you very much🥰!.
88
+
89
+ [Buy me a coffee](https://www.buymeacoffee.com/lianwenwu)
90
+
91
+ ### For Chinese User
92
+
93
+ <p float="left">
94
+ <img src="https://d21002cb.images-f3o.pages.dev/images/wechat.jpg" alt="Wechat Pay" width="200" />
95
+ <img src="https://d21002cb.images-f3o.pages.dev/images/ali.jpg" alt="Ali Pay" width="200" />
96
+ </p>
package/dist/index.cjs CHANGED
@@ -207,7 +207,7 @@ const useClickOutside = (target, handler, enabled = true)=>{
207
207
  useEventListener('touchstart', listener, defaultWindow, listerOptions);
208
208
  };
209
209
 
210
- function getInitialState$4(key, defaultValue) {
210
+ function getInitialState$5(key, defaultValue) {
211
211
  // Prevent a React hydration mismatch when a default value is provided.
212
212
  if (defaultValue !== undefined) {
213
213
  return defaultValue;
@@ -221,7 +221,7 @@ function getInitialState$4(key, defaultValue) {
221
221
  return '';
222
222
  }
223
223
  const useCookie = (key, options = defaultOptions$1, defaultValue)=>{
224
- const [cookieValue, setCookieValue] = React.useState(getInitialState$4(key, defaultValue));
224
+ const [cookieValue, setCookieValue] = React.useState(getInitialState$5(key, defaultValue));
225
225
  React.useEffect(()=>{
226
226
  const getStoredValue = ()=>{
227
227
  const raw = Cookies__default.default.get(key);
@@ -442,7 +442,7 @@ const defaultOptions = {
442
442
  observe: false
443
443
  };
444
444
 
445
- function getInitialState$3(defaultValue) {
445
+ function getInitialState$4(defaultValue) {
446
446
  // Prevent a React hydration mismatch when a default value is provided.
447
447
  if (defaultValue !== undefined) {
448
448
  return defaultValue;
@@ -457,7 +457,7 @@ function getInitialState$3(defaultValue) {
457
457
  }
458
458
  const useCssVar = (prop, target, defaultValue, options = defaultOptions)=>{
459
459
  const { observe } = options;
460
- const [variable, setVariable] = React.useState(getInitialState$3(defaultValue));
460
+ const [variable, setVariable] = React.useState(getInitialState$4(defaultValue));
461
461
  const observerRef = React.useRef();
462
462
  const set = React.useCallback((v)=>{
463
463
  const element = getTargetElement(target);
@@ -579,7 +579,7 @@ const StorageSerializers = {
579
579
  write: (v)=>v.toISOString()
580
580
  }
581
581
  };
582
- function getInitialState$2(key, defaultValue, storage, serializer, onError) {
582
+ function getInitialState$3(key, defaultValue, storage, serializer, onError) {
583
583
  // Prevent a React hydration mismatch when a default value is provided.
584
584
  if (defaultValue !== undefined) {
585
585
  return defaultValue;
@@ -612,7 +612,7 @@ function useStorage(key, defaultValue, getStorage = ()=>isBrowser ? sessionStora
612
612
  const type = guessSerializerType(defaultValue);
613
613
  var _options_serializer;
614
614
  const serializer = (_options_serializer = options.serializer) != null ? _options_serializer : StorageSerializers[type];
615
- const [state, setState] = React.useState(getInitialState$2(key, defaultValue, storage, serializer, onError));
615
+ const [state, setState] = React.useState(getInitialState$3(key, defaultValue, storage, serializer, onError));
616
616
  useDeepCompareEffect(()=>{
617
617
  var _ref;
618
618
  const data = (_ref = effectStorageValue ? isFunction(effectStorageValue) ? effectStorageValue() : effectStorageValue : defaultValue) != null ? _ref : null;
@@ -755,7 +755,7 @@ const useDebounce = (value, wait, options)=>{
755
755
  return debounced;
756
756
  };
757
757
 
758
- function getInitialState$1(defaultValue) {
758
+ function getInitialState$2(defaultValue) {
759
759
  // Prevent a React hydration mismatch when a default value is provided.
760
760
  if (defaultValue !== undefined) {
761
761
  return defaultValue;
@@ -769,7 +769,7 @@ function getInitialState$1(defaultValue) {
769
769
  return 'visible';
770
770
  }
771
771
  function useDocumentVisibility(defaultValue) {
772
- const [visible, setVisible] = React.useState(getInitialState$1(defaultValue));
772
+ const [visible, setVisible] = React.useState(getInitialState$2(defaultValue));
773
773
  useEventListener('visibilitychange', ()=>{
774
774
  setVisible(document.visibilityState);
775
775
  }, ()=>document);
@@ -1501,6 +1501,7 @@ const initCoord = {
1501
1501
  };
1502
1502
  const useGeolocation = (options = defaultOptions$1)=>{
1503
1503
  const { enableHighAccuracy = true, maximumAge = 30000, timeout = 27000 } = options;
1504
+ const isSupported = useSupported(()=>navigator && 'geolocation' in navigator);
1504
1505
  const [coordinates, setCoordinates] = React.useState(initCoord);
1505
1506
  const [locatedAt, setLocatedAt] = React.useState(null);
1506
1507
  const [error, setError] = React.useState(null);
@@ -1515,6 +1516,9 @@ const useGeolocation = (options = defaultOptions$1)=>{
1515
1516
  setError(err);
1516
1517
  }, []);
1517
1518
  React.useEffect(()=>{
1519
+ if (!isSupported) {
1520
+ return;
1521
+ }
1518
1522
  navigator.geolocation.getCurrentPosition(updatePosition, updateError);
1519
1523
  const watchId = navigator.geolocation.watchPosition(updatePosition, updateError, {
1520
1524
  enableHighAccuracy,
@@ -1528,6 +1532,7 @@ const useGeolocation = (options = defaultOptions$1)=>{
1528
1532
  };
1529
1533
  }, [
1530
1534
  enableHighAccuracy,
1535
+ isSupported,
1531
1536
  maximumAge,
1532
1537
  timeout,
1533
1538
  updateError,
@@ -1536,7 +1541,8 @@ const useGeolocation = (options = defaultOptions$1)=>{
1536
1541
  return {
1537
1542
  coordinates,
1538
1543
  locatedAt,
1539
- error
1544
+ error,
1545
+ isSupported
1540
1546
  };
1541
1547
  };
1542
1548
 
@@ -2029,7 +2035,7 @@ const useMediaDevices = (options = {})=>{
2029
2035
  ];
2030
2036
  };
2031
2037
 
2032
- function getInitialState(query, defaultState) {
2038
+ function getInitialState$1(query, defaultState) {
2033
2039
  // Prevent a React hydration mismatch when a default value is provided by not defaulting to window.matchMedia(query).matches.
2034
2040
  if (defaultState !== undefined) {
2035
2041
  return defaultState;
@@ -2044,7 +2050,7 @@ function getInitialState(query, defaultState) {
2044
2050
  return false;
2045
2051
  }
2046
2052
  const useMediaQuery = (query, defaultState)=>{
2047
- const [state, setState] = React.useState(getInitialState(query, defaultState));
2053
+ const [state, setState] = React.useState(getInitialState$1(query, defaultState));
2048
2054
  React.useEffect(()=>{
2049
2055
  let mounted = true;
2050
2056
  const mql = window.matchMedia(query);
@@ -3519,6 +3525,216 @@ const useEventSource = (url, events = [], options = defaultOptions$1)=>{
3519
3525
  }
3520
3526
  });
3521
3527
 
3528
+ function getInitialState(defaultState) {
3529
+ // Prevent a React hydration mismatch when a default value is provided by not defaulting to window.matchMedia(query).matches.
3530
+ if (defaultState !== undefined) {
3531
+ return defaultState;
3532
+ }
3533
+ if (isBrowser) {
3534
+ const navigator1 = window.navigator;
3535
+ return navigator1.languages;
3536
+ }
3537
+ // A default value has not been provided, and you are rendering on the server, warn of a possible hydration mismatch when defaulting to false.
3538
+ if (process.env.NODE_ENV !== 'production') {
3539
+ console.warn('`usePreferredLanguage` When server side rendering, defaultState should be defined to prevent a hydration mismatches.');
3540
+ }
3541
+ return [
3542
+ 'en'
3543
+ ];
3544
+ }
3545
+ const usePreferredLanguages = (defaultLanguages)=>{
3546
+ const [state, setState] = React.useState(getInitialState(defaultLanguages));
3547
+ useEventListener('languagechange', ()=>{
3548
+ setState(navigator.languages);
3549
+ });
3550
+ return state;
3551
+ };
3552
+
3553
+ const useBroadcastChannel = (options)=>{
3554
+ const { name } = options;
3555
+ const isSupported = useSupported(()=>window && 'BroadcastChannel' in window);
3556
+ const [isClosed, setIsClosed] = React.useState(false);
3557
+ const [data, setData] = React.useState();
3558
+ const [error, setError] = React.useState(null);
3559
+ const [timeStamp, setTimeStamp] = React.useState(0);
3560
+ const channelRef = React.useRef();
3561
+ const post = React.useCallback((data)=>{
3562
+ if (channelRef.current) {
3563
+ channelRef.current.postMessage(data);
3564
+ }
3565
+ }, []);
3566
+ const close = React.useCallback(()=>{
3567
+ if (channelRef.current) {
3568
+ channelRef.current.close();
3569
+ }
3570
+ setIsClosed(true);
3571
+ }, []);
3572
+ React.useEffect(()=>{
3573
+ if (isSupported) {
3574
+ channelRef.current = new BroadcastChannel(name);
3575
+ setError(null);
3576
+ const handleMessage = (e)=>{
3577
+ setData(e.data);
3578
+ // avoid data is same between two messages
3579
+ setTimeStamp(Date.now());
3580
+ };
3581
+ const handleError = (e)=>{
3582
+ setError(e);
3583
+ };
3584
+ const handleClose = ()=>{
3585
+ setIsClosed(true);
3586
+ };
3587
+ channelRef.current.addEventListener('message', handleMessage, {
3588
+ passive: true
3589
+ });
3590
+ channelRef.current.addEventListener('messageerror', handleError, {
3591
+ passive: true
3592
+ });
3593
+ channelRef.current.addEventListener('close', handleClose);
3594
+ return ()=>{
3595
+ if (channelRef.current) {
3596
+ channelRef.current.removeEventListener('message', handleMessage);
3597
+ channelRef.current.removeEventListener('messageerror', handleError);
3598
+ channelRef.current.removeEventListener('close', handleClose);
3599
+ close();
3600
+ }
3601
+ };
3602
+ }
3603
+ return close;
3604
+ }, [
3605
+ isSupported,
3606
+ name,
3607
+ close
3608
+ ]);
3609
+ return {
3610
+ isSupported,
3611
+ channel: channelRef.current,
3612
+ data,
3613
+ post,
3614
+ close,
3615
+ error,
3616
+ isClosed,
3617
+ timeStamp
3618
+ };
3619
+ };
3620
+
3621
+ const useDevicePixelRatio = ()=>{
3622
+ const [pixelRatio, setPixelRatio] = React.useState(1);
3623
+ const observe = React.useCallback(()=>{
3624
+ if (!window) return;
3625
+ setPixelRatio(window.devicePixelRatio);
3626
+ const media = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);
3627
+ const handleChange = ()=>{
3628
+ observe();
3629
+ };
3630
+ media.addEventListener('change', handleChange, {
3631
+ once: true
3632
+ });
3633
+ return ()=>{
3634
+ media.removeEventListener('change', handleChange);
3635
+ };
3636
+ }, []);
3637
+ React.useEffect(()=>{
3638
+ const cleanup = observe();
3639
+ return cleanup;
3640
+ }, [
3641
+ observe
3642
+ ]);
3643
+ return {
3644
+ pixelRatio
3645
+ };
3646
+ };
3647
+
3648
+ const useElementByPoint = (options)=>{
3649
+ const { x, y, document: doc = typeof document !== 'undefined' ? document : null, multiple = false, interval = 'requestAnimationFrame', immediate = true } = options;
3650
+ const isSupported = useSupported(()=>{
3651
+ if (multiple) return doc && 'elementsFromPoint' in doc;
3652
+ return doc && 'elementFromPoint' in doc;
3653
+ });
3654
+ const [element, setElement] = React.useState(null);
3655
+ const [isActive, setIsActive] = React.useState(immediate);
3656
+ const rafIdRef = React.useRef(null);
3657
+ const intervalIdRef = React.useRef(null);
3658
+ const getXY = React.useCallback(()=>{
3659
+ // 需要判断 NaN
3660
+ const currentX = typeof x === 'function' ? x() : x;
3661
+ const currentY = typeof y === 'function' ? y() : y;
3662
+ return {
3663
+ x: Number.isNaN(currentX) ? 0 : currentX,
3664
+ y: Number.isNaN(currentY) ? 0 : currentY
3665
+ };
3666
+ }, [
3667
+ x,
3668
+ y
3669
+ ]);
3670
+ const cb = React.useCallback(()=>{
3671
+ const { x: currentX, y: currentY } = getXY();
3672
+ var _doc_elementsFromPoint, _doc_elementFromPoint;
3673
+ setElement(multiple ? (_doc_elementsFromPoint = doc == null ? void 0 : doc.elementsFromPoint(currentX, currentY)) != null ? _doc_elementsFromPoint : [] : (_doc_elementFromPoint = doc == null ? void 0 : doc.elementFromPoint(currentX, currentY)) != null ? _doc_elementFromPoint : null);
3674
+ }, [
3675
+ doc,
3676
+ multiple,
3677
+ getXY
3678
+ ]);
3679
+ const cleanup = React.useCallback(()=>{
3680
+ if (rafIdRef.current !== null) {
3681
+ cancelAnimationFrame(rafIdRef.current);
3682
+ rafIdRef.current = null;
3683
+ }
3684
+ if (intervalIdRef.current !== null) {
3685
+ clearInterval(intervalIdRef.current);
3686
+ intervalIdRef.current = null;
3687
+ }
3688
+ }, []);
3689
+ const pause = React.useCallback(()=>{
3690
+ setIsActive(false);
3691
+ cleanup();
3692
+ }, [
3693
+ cleanup
3694
+ ]);
3695
+ const resume = React.useCallback(()=>{
3696
+ setIsActive(true);
3697
+ }, []);
3698
+ React.useEffect(()=>{
3699
+ if (!isActive) {
3700
+ return;
3701
+ }
3702
+ if (interval === 'requestAnimationFrame') {
3703
+ const runRaf = ()=>{
3704
+ cb();
3705
+ rafIdRef.current = requestAnimationFrame(runRaf);
3706
+ };
3707
+ runRaf();
3708
+ } else {
3709
+ cb();
3710
+ intervalIdRef.current = setInterval(cb, interval);
3711
+ }
3712
+ return cleanup;
3713
+ }, [
3714
+ isActive,
3715
+ interval,
3716
+ cb,
3717
+ cleanup
3718
+ ]);
3719
+ React.useEffect(()=>{
3720
+ if (immediate) {
3721
+ resume();
3722
+ }
3723
+ return pause;
3724
+ }, [
3725
+ immediate,
3726
+ resume,
3727
+ pause
3728
+ ]);
3729
+ return {
3730
+ isSupported,
3731
+ element,
3732
+ pause,
3733
+ resume,
3734
+ isActive
3735
+ };
3736
+ };
3737
+
3522
3738
  exports.assignRef = indexClient.assignRef;
3523
3739
  exports.mergeRefs = indexClient.mergeRefs;
3524
3740
  exports.useMergedRefs = indexClient.useMergedRefs;
@@ -3526,6 +3742,7 @@ exports.defaultOptions = defaultOptions;
3526
3742
  exports.use = use;
3527
3743
  exports.useActiveElement = useActiveElement;
3528
3744
  exports.useAsyncEffect = useAsyncEffect;
3745
+ exports.useBroadcastChannel = useBroadcastChannel;
3529
3746
  exports.useClickOutside = useClickOutside;
3530
3747
  exports.useClipboard = useClipboard;
3531
3748
  exports.useControlled = useControlled;
@@ -3539,12 +3756,14 @@ exports.useDarkMode = useDarkMode;
3539
3756
  exports.useDebounce = useDebounce;
3540
3757
  exports.useDebounceFn = useDebounceFn;
3541
3758
  exports.useDeepCompareEffect = useDeepCompareEffect;
3759
+ exports.useDevicePixelRatio = useDevicePixelRatio;
3542
3760
  exports.useDisclosure = useDisclosure;
3543
3761
  exports.useDocumentVisibility = useDocumentVisibility;
3544
3762
  exports.useDoubleClick = useDoubleClick;
3545
3763
  exports.useDraggable = useDraggable;
3546
3764
  exports.useDropZone = useDropZone;
3547
3765
  exports.useElementBounding = useElementBounding;
3766
+ exports.useElementByPoint = useElementByPoint;
3548
3767
  exports.useElementSize = useElementSize;
3549
3768
  exports.useElementVisibility = useElementVisibility;
3550
3769
  exports.useEvent = useEvent;
@@ -3591,6 +3810,7 @@ exports.usePlatform = usePlatform;
3591
3810
  exports.usePreferredColorScheme = usePreferredColorScheme;
3592
3811
  exports.usePreferredContrast = usePreferredContrast;
3593
3812
  exports.usePreferredDark = usePreferredDark;
3813
+ exports.usePreferredLanguages = usePreferredLanguages;
3594
3814
  exports.usePrevious = usePrevious;
3595
3815
  exports.useRafFn = useRafFn;
3596
3816
  exports.useRafState = useRafState;
package/dist/index.d.cts CHANGED
@@ -446,6 +446,26 @@ interface Position {
446
446
  x: number;
447
447
  y: number;
448
448
  }
449
+ /**
450
+ * @title Pausable
451
+ */
452
+ interface Pausable$1 {
453
+ /**
454
+ * @en A ref indicate whether a pausable instance is active
455
+ * @zh 一个 ref,表示一个 pausable 实例是否处于激活状态
456
+ */
457
+ isActive: boolean;
458
+ /**
459
+ * @en Temporary pause the effect from executing
460
+ * @zh 暂时暂停效果的执行
461
+ */
462
+ pause: Fn;
463
+ /**
464
+ * @en Resume the effects
465
+ * @zh 恢复效果
466
+ */
467
+ resume: Fn;
468
+ }
449
469
 
450
470
  /**
451
471
  * @title useDraggable
@@ -981,14 +1001,16 @@ declare const useFullscreen: UseFullscreen;
981
1001
 
982
1002
  /**
983
1003
  * @title useGeoLocation
984
- * @returns 包含以下元素的元组:
1004
+ * @returns 包含以下元素的对象:
985
1005
  * - 坐标。
986
1006
  * - 获取坐标的时间戳。
987
1007
  * - 错误。
988
- * @returns_en A tuple with the following elements:
1008
+ * - 浏览器是否支持 `geolocation`。
1009
+ * @returns_en A object with the following elements:
989
1010
  * - coordinates.
990
1011
  * - timestamp when get coordinates.
991
1012
  * - errors.
1013
+ * - Whether the browser supports `geolocation`.
992
1014
  */
993
1015
  type UseGeolocation = (
994
1016
  /**
@@ -999,6 +1021,11 @@ options?: Partial<PositionOptions>) => {
999
1021
  readonly coordinates: GeolocationCoordinates;
1000
1022
  readonly locatedAt: number | null;
1001
1023
  readonly error: GeolocationPositionError | null;
1024
+ /**
1025
+ * @zh 浏览器是否支持 `geolocation`
1026
+ * @en Whether the browser supports `geolocation`
1027
+ */
1028
+ readonly isSupported: boolean;
1002
1029
  };
1003
1030
 
1004
1031
  declare const useGeolocation: UseGeolocation;
@@ -2831,6 +2858,165 @@ declare function useMergedRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) =
2831
2858
  */
2832
2859
  declare const use: any;
2833
2860
 
2861
+ /**
2862
+ * @title UsePreferredLanguages
2863
+ * @returns 语言偏好
2864
+ * @returns_en preferred languages
2865
+ */
2866
+ type UsePreferredLanguages = (
2867
+ /**
2868
+ * @zh 默认值
2869
+ * @en defaule value
2870
+ */ defaultLanguages?: string[]) => string[];
2871
+
2872
+ declare const usePreferredLanguages: UsePreferredLanguages;
2873
+
2874
+ /**
2875
+ * @title UseBroadcastChannelOptions
2876
+ */
2877
+ interface UseBroadcastChannelOptions {
2878
+ /**
2879
+ * @zh 频道名称
2880
+ * @en channel name
2881
+ */
2882
+ name: string;
2883
+ }
2884
+ /**
2885
+ * @title UseBroadcastChannel
2886
+ */
2887
+ type UseBroadcastChannel = <D, P>(
2888
+ /**
2889
+ * @zh 选项
2890
+ * @en options
2891
+ */
2892
+ options: UseBroadcastChannelOptions) => UseBroadcastChannelReturn<D, P>;
2893
+ /**
2894
+ * @title UseBroadcastChannelReturn
2895
+ */
2896
+ interface UseBroadcastChannelReturn<D, P> {
2897
+ /**
2898
+ * @zh 是否支持
2899
+ * @en is supported
2900
+ */
2901
+ readonly isSupported: boolean;
2902
+ /**
2903
+ * @zh 频道
2904
+ * @en channel
2905
+ */
2906
+ readonly channel: BroadcastChannel | undefined;
2907
+ /**
2908
+ * @zh 数据
2909
+ * @en data
2910
+ */
2911
+ readonly data: D | undefined;
2912
+ /**
2913
+ * @zh 发送数据
2914
+ * @en post data
2915
+ */
2916
+ readonly post: (data: P) => void;
2917
+ /**
2918
+ * @zh 关闭
2919
+ * @en close
2920
+ */
2921
+ readonly close: () => void;
2922
+ /**
2923
+ * @zh 错误
2924
+ * @en error
2925
+ */
2926
+ readonly error: Event | null;
2927
+ /**
2928
+ * @zh 是否关闭
2929
+ * @en is closed
2930
+ */
2931
+ readonly isClosed: boolean;
2932
+ /**
2933
+ * @zh 时间戳
2934
+ * @en timestamp
2935
+ */
2936
+ readonly timeStamp: number;
2937
+ }
2938
+
2939
+ declare const useBroadcastChannel: UseBroadcastChannel;
2940
+
2941
+ /**
2942
+ * @title UseDevicePixelRatio
2943
+ */
2944
+ type UseDevicePixelRatio = () => UseDevicePixelRatioReturn;
2945
+ /**
2946
+ * @title UseDevicePixelRatioReturn
2947
+ */
2948
+ interface UseDevicePixelRatioReturn {
2949
+ /**
2950
+ * @zh 像素比率
2951
+ * @en Pixel ratio
2952
+ */
2953
+ pixelRatio: number;
2954
+ }
2955
+
2956
+ declare const useDevicePixelRatio: UseDevicePixelRatio;
2957
+
2958
+ /**
2959
+ * @title UseElementByPoint
2960
+ */
2961
+ type UseElementByPoint = <M extends boolean = false>(
2962
+ /**
2963
+ * @en options
2964
+ * @zh 配置项
2965
+ */
2966
+ options: UseElementByPointOptions<M>) => UseElementByPointReturn<M>;
2967
+ /**
2968
+ * @title UseElementByPointOptions
2969
+ */
2970
+ interface UseElementByPointOptions<M extends boolean = false> {
2971
+ /**
2972
+ * @en The x coordinate of the point
2973
+ * @zh 点的 x 坐标
2974
+ */
2975
+ x: number | (() => number);
2976
+ /**
2977
+ * @en The y coordinate of the point
2978
+ * @zh 点的 y 坐标
2979
+ */
2980
+ y: number | (() => number);
2981
+ /**
2982
+ * @en The document to query
2983
+ * @zh 要查询的文档
2984
+ */
2985
+ document?: Document | null;
2986
+ /**
2987
+ * @en Whether to query multiple elements
2988
+ * @zh 是否查询多个元素
2989
+ */
2990
+ multiple?: M;
2991
+ /**
2992
+ * @en The interval to query the element
2993
+ * @zh 查询元素的间隔
2994
+ */
2995
+ interval?: number | 'requestAnimationFrame';
2996
+ /**
2997
+ * @en Whether to query the element immediately
2998
+ * @zh 是否立即查询元素
2999
+ */
3000
+ immediate?: boolean;
3001
+ }
3002
+ /**
3003
+ * @title UseElementByPointReturn
3004
+ */
3005
+ interface UseElementByPointReturn<M extends boolean> extends Pausable$1 {
3006
+ /**
3007
+ * @en Whether the feature is supported
3008
+ * @zh 功能是否支持
3009
+ */
3010
+ isSupported: boolean;
3011
+ /**
3012
+ * @en The queried element
3013
+ * @zh 查询到的元素
3014
+ */
3015
+ element: M extends true ? Element[] : Element | null;
3016
+ }
3017
+
3018
+ declare const useElementByPoint: UseElementByPoint;
3019
+
2834
3020
  /**
2835
3021
  * @title useDocumentVisiblity
2836
3022
  * @returns_en document visibility
@@ -3214,4 +3400,4 @@ type Use = <T>(
3214
3400
  */
3215
3401
  usable: Usable<T>) => T;
3216
3402
 
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 };
3403
+ 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 UseBroadcastChannel, type UseBroadcastChannelOptions, type UseBroadcastChannelReturn, 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 UseDevicePixelRatio, type UseDevicePixelRatioReturn, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementByPoint, type UseElementByPointOptions, type UseElementByPointReturn, 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 UsePreferredLanguages, 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, useBroadcastChannel, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, 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, usePreferredLanguages, 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 };