@reactuses/core 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +11 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4077,6 +4077,9 @@ function useDocumentVisibility(defaultValue) {
|
|
|
4077
4077
|
},
|
|
4078
4078
|
() => document
|
|
4079
4079
|
);
|
|
4080
|
+
React.useEffect(() => {
|
|
4081
|
+
setVisible(document.visibilityState);
|
|
4082
|
+
}, []);
|
|
4080
4083
|
return visible;
|
|
4081
4084
|
}
|
|
4082
4085
|
|
|
@@ -4894,10 +4897,13 @@ function useClipBorad() {
|
|
|
4894
4897
|
return [text, copy];
|
|
4895
4898
|
}
|
|
4896
4899
|
|
|
4897
|
-
|
|
4900
|
+
const listerOptions = {
|
|
4901
|
+
passive: true
|
|
4902
|
+
};
|
|
4903
|
+
function useClickOutside(target, handler) {
|
|
4898
4904
|
const savedHandler = useLatest(handler);
|
|
4899
|
-
const element = useLatestElement(target);
|
|
4900
4905
|
const listener = (event) => {
|
|
4906
|
+
const element = getTargetElement(target);
|
|
4901
4907
|
if (!element) {
|
|
4902
4908
|
return;
|
|
4903
4909
|
}
|
|
@@ -4907,12 +4913,8 @@ function useClickOutSide(target, handler) {
|
|
|
4907
4913
|
}
|
|
4908
4914
|
savedHandler.current(event);
|
|
4909
4915
|
};
|
|
4910
|
-
useEventListener("mousedown", listener, defaultWindow,
|
|
4911
|
-
|
|
4912
|
-
});
|
|
4913
|
-
useEventListener("touchstart", listener, defaultWindow, {
|
|
4914
|
-
passive: true
|
|
4915
|
-
});
|
|
4916
|
+
useEventListener("mousedown", listener, defaultWindow, listerOptions);
|
|
4917
|
+
useEventListener("touchstart", listener, defaultWindow, listerOptions);
|
|
4916
4918
|
}
|
|
4917
4919
|
|
|
4918
4920
|
function useCycleList(list, i = 0) {
|
|
@@ -5627,7 +5629,7 @@ function useMeasure(target, options = defaultOptions) {
|
|
|
5627
5629
|
exports.getHMSTime = getHMSTime;
|
|
5628
5630
|
exports.useActiveElement = useActiveElement;
|
|
5629
5631
|
exports.useAsyncEffect = useAsyncEffect;
|
|
5630
|
-
exports.useClickOutside =
|
|
5632
|
+
exports.useClickOutside = useClickOutside;
|
|
5631
5633
|
exports.useClipboard = useClipBorad;
|
|
5632
5634
|
exports.useControlled = useControlled;
|
|
5633
5635
|
exports.useCookie = useCookie;
|
package/dist/index.d.ts
CHANGED
|
@@ -767,7 +767,7 @@ declare function useClipBorad(): readonly [
|
|
|
767
767
|
];
|
|
768
768
|
|
|
769
769
|
type EventType = MouseEvent | TouchEvent;
|
|
770
|
-
declare function
|
|
770
|
+
declare function useClickOutside(target: BasicTarget, handler: (evt: EventType) => void): void;
|
|
771
771
|
|
|
772
772
|
declare function useCycleList<T>(list: T[], i?: number): readonly [T, (i?: number) => void, (i?: number) => void];
|
|
773
773
|
|
|
@@ -852,4 +852,4 @@ declare function useSetState<T extends Record<string, any>>(initialState: T): re
|
|
|
852
852
|
type UseMeasureRect = Omit<DOMRectReadOnly, "toJSON">;
|
|
853
853
|
declare function useMeasure(target: BasicTarget, options?: ResizeObserverOptions): readonly [UseMeasureRect, () => void];
|
|
854
854
|
|
|
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,
|
|
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, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -4069,6 +4069,9 @@ function useDocumentVisibility(defaultValue) {
|
|
|
4069
4069
|
},
|
|
4070
4070
|
() => document
|
|
4071
4071
|
);
|
|
4072
|
+
useEffect(() => {
|
|
4073
|
+
setVisible(document.visibilityState);
|
|
4074
|
+
}, []);
|
|
4072
4075
|
return visible;
|
|
4073
4076
|
}
|
|
4074
4077
|
|
|
@@ -4886,10 +4889,13 @@ function useClipBorad() {
|
|
|
4886
4889
|
return [text, copy];
|
|
4887
4890
|
}
|
|
4888
4891
|
|
|
4889
|
-
|
|
4892
|
+
const listerOptions = {
|
|
4893
|
+
passive: true
|
|
4894
|
+
};
|
|
4895
|
+
function useClickOutside(target, handler) {
|
|
4890
4896
|
const savedHandler = useLatest(handler);
|
|
4891
|
-
const element = useLatestElement(target);
|
|
4892
4897
|
const listener = (event) => {
|
|
4898
|
+
const element = getTargetElement(target);
|
|
4893
4899
|
if (!element) {
|
|
4894
4900
|
return;
|
|
4895
4901
|
}
|
|
@@ -4899,12 +4905,8 @@ function useClickOutSide(target, handler) {
|
|
|
4899
4905
|
}
|
|
4900
4906
|
savedHandler.current(event);
|
|
4901
4907
|
};
|
|
4902
|
-
useEventListener("mousedown", listener, defaultWindow,
|
|
4903
|
-
|
|
4904
|
-
});
|
|
4905
|
-
useEventListener("touchstart", listener, defaultWindow, {
|
|
4906
|
-
passive: true
|
|
4907
|
-
});
|
|
4908
|
+
useEventListener("mousedown", listener, defaultWindow, listerOptions);
|
|
4909
|
+
useEventListener("touchstart", listener, defaultWindow, listerOptions);
|
|
4908
4910
|
}
|
|
4909
4911
|
|
|
4910
4912
|
function useCycleList(list, i = 0) {
|
|
@@ -5616,4 +5618,4 @@ function useMeasure(target, options = defaultOptions) {
|
|
|
5616
5618
|
return [rect, stop];
|
|
5617
5619
|
}
|
|
5618
5620
|
|
|
5619
|
-
export { getHMSTime, useActiveElement, useAsyncEffect,
|
|
5621
|
+
export { getHMSTime, useActiveElement, useAsyncEffect, 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, index$2 as useFps, useFullscreen, useGeolocation, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, index$1 as useOnceEffect, index 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, useUpdateEffect, index$3 as useUpdateLayoutEffect, useVirtualList, useWindowScroll, useWindowSize, useWindowsFocus };
|