@reactuses/core 4.0.8 → 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 CHANGED
@@ -3445,7 +3445,7 @@ function useSupported(callback, sync = false) {
3445
3445
  return supported;
3446
3446
  }
3447
3447
 
3448
- var __async$4 = (__this, __arguments, generator) => {
3448
+ var __async$5 = (__this, __arguments, generator) => {
3449
3449
  return new Promise((resolve, reject) => {
3450
3450
  var fulfilled = (value) => {
3451
3451
  try {
@@ -3490,7 +3490,7 @@ function useMediaDevices(options = {}) {
3490
3490
  });
3491
3491
  }).catch(noop);
3492
3492
  }, []);
3493
- const ensurePermissions = React.useCallback(() => __async$4(this, null, function* () {
3493
+ const ensurePermissions = React.useCallback(() => __async$5(this, null, function* () {
3494
3494
  if (!isSupported) {
3495
3495
  return false;
3496
3496
  }
@@ -4296,7 +4296,7 @@ var __spreadValues$1 = (a, b) => {
4296
4296
  return a;
4297
4297
  };
4298
4298
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4299
- var __async$3 = (__this, __arguments, generator) => {
4299
+ var __async$4 = (__this, __arguments, generator) => {
4300
4300
  return new Promise((resolve, reject) => {
4301
4301
  var fulfilled = (value) => {
4302
4302
  try {
@@ -4328,7 +4328,7 @@ function useInfiniteScroll(target, onLoadMore, options = defaultOptions$1) {
4328
4328
  const element = useLatestElement(target);
4329
4329
  const di = state[3][direction];
4330
4330
  useUpdateEffect(() => {
4331
- const fn = () => __async$3(this, null, function* () {
4331
+ const fn = () => __async$4(this, null, function* () {
4332
4332
  var _a2, _b2;
4333
4333
  const previous = {
4334
4334
  height: (_a2 = element == null ? void 0 : element.scrollHeight) != null ? _a2 : 0,
@@ -4862,7 +4862,7 @@ function useWindowScroll() {
4862
4862
  return state;
4863
4863
  }
4864
4864
 
4865
- var __async$2 = (__this, __arguments, generator) => {
4865
+ var __async$3 = (__this, __arguments, generator) => {
4866
4866
  return new Promise((resolve, reject) => {
4867
4867
  var fulfilled = (value) => {
4868
4868
  try {
@@ -4891,7 +4891,7 @@ function useClipBorad() {
4891
4891
  }, []);
4892
4892
  useEventListener("copy", updateText);
4893
4893
  useEventListener("cut", updateText);
4894
- const copy = React.useCallback((txt) => __async$2(this, null, function* () {
4894
+ const copy = React.useCallback((txt) => __async$3(this, null, function* () {
4895
4895
  setText(txt);
4896
4896
  yield window.navigator.clipboard.writeText(txt);
4897
4897
  }), []);
@@ -5230,7 +5230,7 @@ const useSticky = (targetElement, { axis = "y", nav = 0 }, scrollElement) => {
5230
5230
  return [isSticky, setSticky];
5231
5231
  };
5232
5232
 
5233
- var __async$1 = (__this, __arguments, generator) => {
5233
+ var __async$2 = (__this, __arguments, generator) => {
5234
5234
  return new Promise((resolve, reject) => {
5235
5235
  var fulfilled = (value) => {
5236
5236
  try {
@@ -5253,7 +5253,7 @@ var __async$1 = (__this, __arguments, generator) => {
5253
5253
  function useAsyncEffect(effect, cleanup = noop, deps) {
5254
5254
  const mounted = useMountedState();
5255
5255
  React.useEffect(() => {
5256
- const execute = () => __async$1(this, null, function* () {
5256
+ const execute = () => __async$2(this, null, function* () {
5257
5257
  if (!mounted()) {
5258
5258
  return;
5259
5259
  }
@@ -5314,7 +5314,7 @@ function useTextSelection() {
5314
5314
  return selection;
5315
5315
  }
5316
5316
 
5317
- var __async = (__this, __arguments, generator) => {
5317
+ var __async$1 = (__this, __arguments, generator) => {
5318
5318
  return new Promise((resolve, reject) => {
5319
5319
  var fulfilled = (value) => {
5320
5320
  try {
@@ -5340,7 +5340,7 @@ function useEyeDropper() {
5340
5340
  true
5341
5341
  );
5342
5342
  const open = React.useCallback(
5343
- (..._0) => __async(this, [..._0], function* (options = {}) {
5343
+ (..._0) => __async$1(this, [..._0], function* (options = {}) {
5344
5344
  if (!isSupported) {
5345
5345
  return {
5346
5346
  sRGBHex: ""
@@ -5741,6 +5741,87 @@ function getValue(position) {
5741
5741
  return getComputedStyle(document.documentElement).getPropertyValue(position);
5742
5742
  }
5743
5743
 
5744
+ var __async = (__this, __arguments, generator) => {
5745
+ return new Promise((resolve, reject) => {
5746
+ var fulfilled = (value) => {
5747
+ try {
5748
+ step(generator.next(value));
5749
+ } catch (e) {
5750
+ reject(e);
5751
+ }
5752
+ };
5753
+ var rejected = (value) => {
5754
+ try {
5755
+ step(generator.throw(value));
5756
+ } catch (e) {
5757
+ reject(e);
5758
+ }
5759
+ };
5760
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
5761
+ step((generator = generator.apply(__this, __arguments)).next());
5762
+ });
5763
+ };
5764
+ function useWebNotification(requestPermissions = false) {
5765
+ const isSupported = useSupported(() => !!window && "Notification" in window);
5766
+ const permissionGranted = React.useRef(false);
5767
+ const notificationRef = React.useRef(null);
5768
+ const show = (title, options = defaultOptions$1) => {
5769
+ if (!isSupported && !permissionGranted.current) {
5770
+ return;
5771
+ }
5772
+ notificationRef.current = new Notification(title || "", options);
5773
+ return notificationRef.current;
5774
+ };
5775
+ const close = React.useCallback(() => {
5776
+ if (notificationRef.current) {
5777
+ notificationRef.current.close();
5778
+ }
5779
+ notificationRef.current = null;
5780
+ }, []);
5781
+ React.useEffect(() => {
5782
+ permissionGranted.current = isSupported && "permission" in Notification && Notification.permission === "granted";
5783
+ }, [isSupported]);
5784
+ const ensurePermissions = React.useCallback(() => __async(this, null, function* () {
5785
+ if (!isSupported)
5786
+ return;
5787
+ if (!permissionGranted.current && Notification.permission !== "denied") {
5788
+ const result = yield Notification.requestPermission();
5789
+ if (result === "granted")
5790
+ permissionGranted.current = true;
5791
+ }
5792
+ return permissionGranted.current;
5793
+ }), [isSupported]);
5794
+ React.useEffect(() => {
5795
+ if (requestPermissions) {
5796
+ ensurePermissions();
5797
+ }
5798
+ }, [requestPermissions, ensurePermissions]);
5799
+ useUnmount(close);
5800
+ return {
5801
+ isSupported,
5802
+ show,
5803
+ close,
5804
+ ensurePermissions,
5805
+ permissionGranted
5806
+ };
5807
+ }
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
+
5744
5825
  exports.getHMSTime = getHMSTime;
5745
5826
  exports.useActiveElement = useActiveElement;
5746
5827
  exports.useAsyncEffect = useAsyncEffect;
@@ -5784,6 +5865,7 @@ exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
5784
5865
  exports.useKeyModifier = useKeyModifier;
5785
5866
  exports.useLatest = useLatest;
5786
5867
  exports.useLocalStorage = useLocalStorage;
5868
+ exports.useLocationSelector = useLocationSelector;
5787
5869
  exports.useLongPress = useLongPress;
5788
5870
  exports.useMeasure = useMeasure;
5789
5871
  exports.useMediaDevices = useMediaDevices;
@@ -5831,6 +5913,7 @@ exports.useUpdate = useUpdate;
5831
5913
  exports.useUpdateEffect = useUpdateEffect;
5832
5914
  exports.useUpdateLayoutEffect = index$3;
5833
5915
  exports.useVirtualList = useVirtualList;
5916
+ exports.useWebNotification = useWebNotification;
5834
5917
  exports.useWindowScroll = useWindowScroll;
5835
5918
  exports.useWindowSize = useWindowSize;
5836
5919
  exports.useWindowsFocus = useWindowsFocus;
package/dist/index.d.ts CHANGED
@@ -865,4 +865,19 @@ interface UseCssVarOptions {
865
865
  }
866
866
  declare function useCssVar<T extends HTMLElement = HTMLElement>(prop: string, target: BasicTarget<T>, defaultValue?: string, options?: UseCssVarOptions): readonly [string, (v: string) => void];
867
867
 
868
- 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, 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, useWindowScroll, useWindowSize, useWindowsFocus };
868
+ declare function useWebNotification(requestPermissions?: boolean): {
869
+ readonly isSupported: boolean;
870
+ readonly show: (title: string, options?: NotificationOptions) => Notification | undefined;
871
+ readonly close: () => void;
872
+ readonly ensurePermissions: () => Promise<boolean | undefined>;
873
+ readonly permissionGranted: react.MutableRefObject<boolean>;
874
+ };
875
+
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();
@@ -3437,7 +3437,7 @@ function useSupported(callback, sync = false) {
3437
3437
  return supported;
3438
3438
  }
3439
3439
 
3440
- var __async$4 = (__this, __arguments, generator) => {
3440
+ var __async$5 = (__this, __arguments, generator) => {
3441
3441
  return new Promise((resolve, reject) => {
3442
3442
  var fulfilled = (value) => {
3443
3443
  try {
@@ -3482,7 +3482,7 @@ function useMediaDevices(options = {}) {
3482
3482
  });
3483
3483
  }).catch(noop);
3484
3484
  }, []);
3485
- const ensurePermissions = useCallback(() => __async$4(this, null, function* () {
3485
+ const ensurePermissions = useCallback(() => __async$5(this, null, function* () {
3486
3486
  if (!isSupported) {
3487
3487
  return false;
3488
3488
  }
@@ -4288,7 +4288,7 @@ var __spreadValues$1 = (a, b) => {
4288
4288
  return a;
4289
4289
  };
4290
4290
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4291
- var __async$3 = (__this, __arguments, generator) => {
4291
+ var __async$4 = (__this, __arguments, generator) => {
4292
4292
  return new Promise((resolve, reject) => {
4293
4293
  var fulfilled = (value) => {
4294
4294
  try {
@@ -4320,7 +4320,7 @@ function useInfiniteScroll(target, onLoadMore, options = defaultOptions$1) {
4320
4320
  const element = useLatestElement(target);
4321
4321
  const di = state[3][direction];
4322
4322
  useUpdateEffect(() => {
4323
- const fn = () => __async$3(this, null, function* () {
4323
+ const fn = () => __async$4(this, null, function* () {
4324
4324
  var _a2, _b2;
4325
4325
  const previous = {
4326
4326
  height: (_a2 = element == null ? void 0 : element.scrollHeight) != null ? _a2 : 0,
@@ -4854,7 +4854,7 @@ function useWindowScroll() {
4854
4854
  return state;
4855
4855
  }
4856
4856
 
4857
- var __async$2 = (__this, __arguments, generator) => {
4857
+ var __async$3 = (__this, __arguments, generator) => {
4858
4858
  return new Promise((resolve, reject) => {
4859
4859
  var fulfilled = (value) => {
4860
4860
  try {
@@ -4883,7 +4883,7 @@ function useClipBorad() {
4883
4883
  }, []);
4884
4884
  useEventListener("copy", updateText);
4885
4885
  useEventListener("cut", updateText);
4886
- const copy = useCallback((txt) => __async$2(this, null, function* () {
4886
+ const copy = useCallback((txt) => __async$3(this, null, function* () {
4887
4887
  setText(txt);
4888
4888
  yield window.navigator.clipboard.writeText(txt);
4889
4889
  }), []);
@@ -5222,7 +5222,7 @@ const useSticky = (targetElement, { axis = "y", nav = 0 }, scrollElement) => {
5222
5222
  return [isSticky, setSticky];
5223
5223
  };
5224
5224
 
5225
- var __async$1 = (__this, __arguments, generator) => {
5225
+ var __async$2 = (__this, __arguments, generator) => {
5226
5226
  return new Promise((resolve, reject) => {
5227
5227
  var fulfilled = (value) => {
5228
5228
  try {
@@ -5245,7 +5245,7 @@ var __async$1 = (__this, __arguments, generator) => {
5245
5245
  function useAsyncEffect(effect, cleanup = noop, deps) {
5246
5246
  const mounted = useMountedState();
5247
5247
  useEffect(() => {
5248
- const execute = () => __async$1(this, null, function* () {
5248
+ const execute = () => __async$2(this, null, function* () {
5249
5249
  if (!mounted()) {
5250
5250
  return;
5251
5251
  }
@@ -5306,7 +5306,7 @@ function useTextSelection() {
5306
5306
  return selection;
5307
5307
  }
5308
5308
 
5309
- var __async = (__this, __arguments, generator) => {
5309
+ var __async$1 = (__this, __arguments, generator) => {
5310
5310
  return new Promise((resolve, reject) => {
5311
5311
  var fulfilled = (value) => {
5312
5312
  try {
@@ -5332,7 +5332,7 @@ function useEyeDropper() {
5332
5332
  true
5333
5333
  );
5334
5334
  const open = useCallback(
5335
- (..._0) => __async(this, [..._0], function* (options = {}) {
5335
+ (..._0) => __async$1(this, [..._0], function* (options = {}) {
5336
5336
  if (!isSupported) {
5337
5337
  return {
5338
5338
  sRGBHex: ""
@@ -5733,4 +5733,85 @@ function getValue(position) {
5733
5733
  return getComputedStyle(document.documentElement).getPropertyValue(position);
5734
5734
  }
5735
5735
 
5736
- 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, 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, useWindowScroll, useWindowSize, useWindowsFocus };
5736
+ var __async = (__this, __arguments, generator) => {
5737
+ return new Promise((resolve, reject) => {
5738
+ var fulfilled = (value) => {
5739
+ try {
5740
+ step(generator.next(value));
5741
+ } catch (e) {
5742
+ reject(e);
5743
+ }
5744
+ };
5745
+ var rejected = (value) => {
5746
+ try {
5747
+ step(generator.throw(value));
5748
+ } catch (e) {
5749
+ reject(e);
5750
+ }
5751
+ };
5752
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
5753
+ step((generator = generator.apply(__this, __arguments)).next());
5754
+ });
5755
+ };
5756
+ function useWebNotification(requestPermissions = false) {
5757
+ const isSupported = useSupported(() => !!window && "Notification" in window);
5758
+ const permissionGranted = useRef(false);
5759
+ const notificationRef = useRef(null);
5760
+ const show = (title, options = defaultOptions$1) => {
5761
+ if (!isSupported && !permissionGranted.current) {
5762
+ return;
5763
+ }
5764
+ notificationRef.current = new Notification(title || "", options);
5765
+ return notificationRef.current;
5766
+ };
5767
+ const close = useCallback(() => {
5768
+ if (notificationRef.current) {
5769
+ notificationRef.current.close();
5770
+ }
5771
+ notificationRef.current = null;
5772
+ }, []);
5773
+ useEffect(() => {
5774
+ permissionGranted.current = isSupported && "permission" in Notification && Notification.permission === "granted";
5775
+ }, [isSupported]);
5776
+ const ensurePermissions = useCallback(() => __async(this, null, function* () {
5777
+ if (!isSupported)
5778
+ return;
5779
+ if (!permissionGranted.current && Notification.permission !== "denied") {
5780
+ const result = yield Notification.requestPermission();
5781
+ if (result === "granted")
5782
+ permissionGranted.current = true;
5783
+ }
5784
+ return permissionGranted.current;
5785
+ }), [isSupported]);
5786
+ useEffect(() => {
5787
+ if (requestPermissions) {
5788
+ ensurePermissions();
5789
+ }
5790
+ }, [requestPermissions, ensurePermissions]);
5791
+ useUnmount(close);
5792
+ return {
5793
+ isSupported,
5794
+ show,
5795
+ close,
5796
+ ensurePermissions,
5797
+ permissionGranted
5798
+ };
5799
+ }
5800
+
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactuses/core",
3
- "version": "4.0.8",
3
+ "version": "4.0.10",
4
4
  "license": "Unlicense",
5
5
  "homepage": "https://www.reactuse.com/",
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "./package.json": "./package.json",
25
25
  ".": {
26
26
  "types": "./dist/index.d.ts",
27
- "require": "./dist/index.cjs",
28
- "import": "./dist/index.mjs"
27
+ "import": "./dist/index.mjs",
28
+ "require": "./dist/index.cjs"
29
29
  }
30
30
  },
31
31
  "main": "./dist/index.cjs",
@@ -57,9 +57,6 @@
57
57
  "screenfull": "^5.0.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/js-cookie": "^3.0.3",
61
- "@types/lodash": "^4.14.184",
62
- "@types/lodash-es": "^4.17.7",
63
60
  "@jsdevtools/version-bump-prompt": "^6.1.0",
64
61
  "@rollup/plugin-commonjs": "^22.0.2",
65
62
  "@rollup/plugin-json": "^4.1.0",
@@ -67,6 +64,9 @@
67
64
  "@rollup/plugin-replace": "^4.0.0",
68
65
  "@testing-library/react": "^13.4.0",
69
66
  "@types/jest": "^27.5.2",
67
+ "@types/js-cookie": "^3.0.3",
68
+ "@types/lodash": "^4.14.184",
69
+ "@types/lodash-es": "^4.17.7",
70
70
  "babel-jest": "^29.0.2",
71
71
  "consola": "^2.15.3",
72
72
  "esbuild": "^0.17.15",