@reactuses/core 3.0.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -446,7 +446,7 @@ declare function useIntersectionObserver(target: BasicTarget, callback: Intersec
446
446
 
447
447
  declare function usePageLeave(): boolean;
448
448
 
449
- declare function useDocumentVisibility(): DocumentVisibilityState;
449
+ declare function useDocumentVisibility(defaultValue?: DocumentVisibilityState): DocumentVisibilityState;
450
450
 
451
451
  declare function useResizeObserver(target: BasicTarget, callback: ResizeObserverCallback, options?: ResizeObserverOptions): () => void;
452
452
 
@@ -747,7 +747,7 @@ declare function useElementBounding(target: BasicTarget, options?: UseElementBou
747
747
 
748
748
  declare function useElementVisibility(target: BasicTarget<HTMLElement | SVGElement>, options?: IntersectionObserverInit): readonly [boolean, () => void];
749
749
 
750
- declare function useWindowsFocus(): boolean;
750
+ declare function useWindowsFocus(defauleValue?: boolean): boolean;
751
751
 
752
752
  interface WindowSize {
753
753
  width: number;
@@ -755,11 +755,11 @@ interface WindowSize {
755
755
  }
756
756
  declare function useWindowSize(): WindowSize;
757
757
 
758
- interface State {
758
+ interface UseWindowScrollState {
759
759
  x: number;
760
760
  y: number;
761
761
  }
762
- declare function useWindowScroll(): State;
762
+ declare function useWindowScroll(): UseWindowScrollState;
763
763
 
764
764
  declare function useClipBorad(): readonly [
765
765
  string,
@@ -805,26 +805,19 @@ interface ScrollIntoViewParams {
805
805
  cancelable?: boolean;
806
806
  /** prevents content jumping in scrolling lists with multiple targets */
807
807
  isList?: boolean;
808
- targetElement: BasicTarget<HTMLElement>;
809
- scrollElement?: BasicTarget<HTMLElement>;
810
808
  }
811
- declare function useScrollIntoView({ duration, axis, onScrollFinish, easing, offset, cancelable, isList, targetElement, scrollElement, }: ScrollIntoViewParams): {
809
+ declare function useScrollIntoView(targetElement: BasicTarget<HTMLElement>, { duration, axis, onScrollFinish, easing, offset, cancelable, isList, }?: ScrollIntoViewParams, scrollElement?: BasicTarget<HTMLElement>): {
812
810
  scrollIntoView: ({ alignment }?: ScrollIntoViewAnimation) => void;
813
811
  cancel: () => void;
814
812
  };
815
813
 
816
814
  interface UseStickyParams {
817
- targetElement: BasicTarget<HTMLElement>;
818
- scrollElement?: BasicTarget<HTMLElement>;
819
815
  /** axis of scroll */
820
816
  axis?: "x" | "y";
821
817
  /** cover height or width */
822
818
  nav: number;
823
819
  }
824
- declare const useSticky: ({ targetElement, scrollElement, axis, nav, }: UseStickyParams) => [
825
- boolean,
826
- react__default.Dispatch<react__default.SetStateAction<boolean>>
827
- ];
820
+ declare const useSticky: (targetElement: BasicTarget<HTMLElement>, { axis, nav }: UseStickyParams, scrollElement?: BasicTarget<HTMLElement>) => [boolean, react__default.Dispatch<react__default.SetStateAction<boolean>>];
828
821
 
829
822
  declare function useAsyncEffect<T extends void>(effect: () => Promise<T> | T, cleanup?: typeof effect, deps?: DependencyList): void;
830
823
 
@@ -844,15 +837,8 @@ interface EyeDropperOpenReturnType {
844
837
  declare function useEyeDropper(): readonly [boolean, (options?: EyeDropperOpenOptions) => Promise<EyeDropperOpenReturnType>];
845
838
  type UseEyeDropperReturn = ReturnType<typeof useEyeDropper>;
846
839
 
847
- type CookieState = string | undefined;
848
- interface CookieOptions extends Cookies.CookieAttributes {
849
- defaultValue?: string | (() => string);
850
- /**
851
- * set to storage when nodata in effect, fallback to defaultValue
852
- */
853
- csrData?: CookieState | (() => CookieState);
854
- }
855
- declare function useCookie(key: string, options?: CookieOptions): readonly [CookieState, (newValue: CookieState | ((prevState: CookieState) => CookieState)) => void, () => void];
840
+ type UseCookieState = string | undefined;
841
+ declare function useCookie(key: string, options?: Cookies.CookieAttributes, defaultValue?: string): readonly [UseCookieState, (newValue: UseCookieState | ((prevState: UseCookieState) => UseCookieState)) => void, () => void];
856
842
 
857
843
  declare function useDoubleClick({ target, latency, onSingleClick, onDoubleClick, }: {
858
844
  target: BasicTarget;
@@ -866,4 +852,4 @@ declare function useSetState<T extends Record<string, any>>(initialState: T): re
866
852
  type UseMeasureRect = Omit<DOMRectReadOnly, "toJSON">;
867
853
  declare function useMeasure(target: BasicTarget, options?: ResizeObserverOptions): readonly [UseMeasureRect, () => void];
868
854
 
869
- export { ColorScheme, Contrast, CookieOptions, CookieState, CursorState, EyeDropperOpenReturnType, GeneralPermissionDescriptor, IDisposable, IEvent, IEventOnce, IListener, INetworkInformation, IState, IUseNetworkState, KeyModifier, MousePressedOptions, MouseSourceType, OrientationState, RafLoopReturns, ScrollIntoViewAnimation, ScrollIntoViewParams, State, Status, Target, UseDarkOptions, UseDraggableOptions, UseElementBoundingOptions, UseEventEmitterReturn, UseEyeDropperReturn, UseFileDialogOptions, UseFpsOptions, UseFullScreenOptions, UseInfiniteScrollOptions, UseLongPressOptions, UseMeasureRect, UseMediaDeviceOptions, UseModifierOptions, UseScriptTagOptions, UseScrollOptions, UseStickyParams, UseTextDirectionOptions, UseTextDirectionValue, UseTimeoutFnOptions, UseVirtualListItem, UseVirtualListOptions, UseVirtualListReturn, WindowSize, getHMSTime, useActiveElement, useAsyncEffect, useClickOutSide as useClickOutside, useClipBorad as useClipboard, useControlled, useCookie, useCountDown, useCounter, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, _default$2 as useFps, useFullscreen, useGeolocation, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, _default$1 as useOnceEffect, _default as useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, _default$4 as useUpdateEffect, _default$3 as useUpdateLayoutEffect, useVirtualList, useWindowScroll, useWindowSize, useWindowsFocus };
855
+ export { ColorScheme, Contrast, CursorState, EyeDropperOpenReturnType, GeneralPermissionDescriptor, IDisposable, IEvent, IEventOnce, IListener, INetworkInformation, IState, IUseNetworkState, KeyModifier, MousePressedOptions, MouseSourceType, OrientationState, RafLoopReturns, ScrollIntoViewAnimation, ScrollIntoViewParams, Status, Target, UseCookieState, UseDarkOptions, UseDraggableOptions, UseElementBoundingOptions, UseEventEmitterReturn, UseEyeDropperReturn, UseFileDialogOptions, UseFpsOptions, UseFullScreenOptions, UseInfiniteScrollOptions, UseLongPressOptions, UseMeasureRect, UseMediaDeviceOptions, UseModifierOptions, UseScriptTagOptions, UseScrollOptions, UseStickyParams, UseTextDirectionOptions, UseTextDirectionValue, UseTimeoutFnOptions, UseVirtualListItem, UseVirtualListOptions, UseVirtualListReturn, UseWindowScrollState, WindowSize, getHMSTime, useActiveElement, useAsyncEffect, useClickOutSide as useClickOutside, useClipBorad as useClipboard, useControlled, useCookie, useCountDown, useCounter, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, _default$2 as useFps, useFullscreen, useGeolocation, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, _default$1 as useOnceEffect, _default as useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, _default$4 as useUpdateEffect, _default$3 as useUpdateLayoutEffect, useVirtualList, useWindowScroll, useWindowSize, useWindowsFocus };