@reactuses/core 4.0.9 → 4.0.10
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 +17 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.mjs +18 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5806,6 +5806,22 @@ function useWebNotification(requestPermissions = false) {
|
|
|
5806
5806
|
};
|
|
5807
5807
|
}
|
|
5808
5808
|
|
|
5809
|
+
function subscribe(callback) {
|
|
5810
|
+
window.addEventListener("popstate", callback);
|
|
5811
|
+
window.addEventListener("hashchange", callback);
|
|
5812
|
+
return () => {
|
|
5813
|
+
window.removeEventListener("popstate", callback);
|
|
5814
|
+
window.removeEventListener("hashchange", callback);
|
|
5815
|
+
};
|
|
5816
|
+
}
|
|
5817
|
+
function useLocationSelector(selector, fallback) {
|
|
5818
|
+
return React.useSyncExternalStore(
|
|
5819
|
+
subscribe,
|
|
5820
|
+
() => selector(location),
|
|
5821
|
+
() => fallback
|
|
5822
|
+
);
|
|
5823
|
+
}
|
|
5824
|
+
|
|
5809
5825
|
exports.getHMSTime = getHMSTime;
|
|
5810
5826
|
exports.useActiveElement = useActiveElement;
|
|
5811
5827
|
exports.useAsyncEffect = useAsyncEffect;
|
|
@@ -5849,6 +5865,7 @@ exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
|
5849
5865
|
exports.useKeyModifier = useKeyModifier;
|
|
5850
5866
|
exports.useLatest = useLatest;
|
|
5851
5867
|
exports.useLocalStorage = useLocalStorage;
|
|
5868
|
+
exports.useLocationSelector = useLocationSelector;
|
|
5852
5869
|
exports.useLongPress = useLongPress;
|
|
5853
5870
|
exports.useMeasure = useMeasure;
|
|
5854
5871
|
exports.useMediaDevices = useMediaDevices;
|
package/dist/index.d.ts
CHANGED
|
@@ -873,4 +873,11 @@ declare function useWebNotification(requestPermissions?: boolean): {
|
|
|
873
873
|
readonly permissionGranted: react.MutableRefObject<boolean>;
|
|
874
874
|
};
|
|
875
875
|
|
|
876
|
-
|
|
876
|
+
declare function useLocationSelector<R>(selector: (location: Location) => R,
|
|
877
|
+
/**
|
|
878
|
+
* @description server fallback
|
|
879
|
+
* @default undefined
|
|
880
|
+
*/
|
|
881
|
+
fallback?: R): R | undefined;
|
|
882
|
+
|
|
883
|
+
export { ColorScheme, Contrast, CursorState, EyeDropperOpenReturnType, GeneralPermissionDescriptor, IDisposable, IEvent, IEventOnce, IListener, INetworkInformation, IState, IUseNetworkState, KeyModifier, MousePressedOptions, MouseSourceType, OrientationState, RafLoopReturns, ScrollIntoViewAnimation, ScrollIntoViewParams, Status, Target, UseCookieState, UseCssVarOptions, 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, useCssVar, 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, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, 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, useScreenSafeArea, 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, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useLayoutEffect, useCallback, useMemo, useState, useReducer } from 'react';
|
|
1
|
+
import React, { useRef, useEffect, useLayoutEffect, useCallback, useMemo, useState, useReducer, useSyncExternalStore } from 'react';
|
|
2
2
|
|
|
3
3
|
function usePrevious(state) {
|
|
4
4
|
const ref = useRef();
|
|
@@ -5798,4 +5798,20 @@ function useWebNotification(requestPermissions = false) {
|
|
|
5798
5798
|
};
|
|
5799
5799
|
}
|
|
5800
5800
|
|
|
5801
|
-
|
|
5801
|
+
function subscribe(callback) {
|
|
5802
|
+
window.addEventListener("popstate", callback);
|
|
5803
|
+
window.addEventListener("hashchange", callback);
|
|
5804
|
+
return () => {
|
|
5805
|
+
window.removeEventListener("popstate", callback);
|
|
5806
|
+
window.removeEventListener("hashchange", callback);
|
|
5807
|
+
};
|
|
5808
|
+
}
|
|
5809
|
+
function useLocationSelector(selector, fallback) {
|
|
5810
|
+
return useSyncExternalStore(
|
|
5811
|
+
subscribe,
|
|
5812
|
+
() => selector(location),
|
|
5813
|
+
() => fallback
|
|
5814
|
+
);
|
|
5815
|
+
}
|
|
5816
|
+
|
|
5817
|
+
export { getHMSTime, useActiveElement, useAsyncEffect, useClickOutside, useClipBorad as useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, 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, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, 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, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, index$3 as useUpdateLayoutEffect, useVirtualList, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|