@reactuses/core 3.0.1 → 3.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 +12 -10
- package/dist/index.d.ts +3 -6
- package/dist/index.mjs +11 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@ const createUpdateEffect = (hook) => (effect, deps) => {
|
|
|
44
44
|
|
|
45
45
|
var useUpdateEffect = createUpdateEffect(React.useEffect);
|
|
46
46
|
|
|
47
|
-
var index$
|
|
47
|
+
var index$3 = createUpdateEffect(React.useLayoutEffect);
|
|
48
48
|
|
|
49
49
|
var _a;
|
|
50
50
|
const isFunction$1 = (val) => typeof val === "function";
|
|
@@ -3472,10 +3472,15 @@ function useMediaDevices(options = {}) {
|
|
|
3472
3472
|
if (permissionGranted.current) {
|
|
3473
3473
|
return true;
|
|
3474
3474
|
}
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3475
|
+
let state2 = void 0;
|
|
3476
|
+
try {
|
|
3477
|
+
state2 = (yield navigator.permissions.query({
|
|
3478
|
+
name: "camera"
|
|
3479
|
+
})).state;
|
|
3480
|
+
} catch (error) {
|
|
3481
|
+
state2 = "prompt";
|
|
3482
|
+
}
|
|
3483
|
+
if (state2 !== "granted") {
|
|
3479
3484
|
stream.current = yield navigator.mediaDevices.getUserMedia(constraints);
|
|
3480
3485
|
onChange();
|
|
3481
3486
|
permissionGranted.current = true;
|
|
@@ -3499,9 +3504,6 @@ function useMediaDevices(options = {}) {
|
|
|
3499
3504
|
}, [onChange, isSupported, requestPermissions, ensurePermissions]);
|
|
3500
3505
|
return [state, ensurePermissions];
|
|
3501
3506
|
}
|
|
3502
|
-
const useMediaDevicesMock = () => [{ devices: [] }, () => {
|
|
3503
|
-
}];
|
|
3504
|
-
var index$3 = isNavigator && !!navigator.mediaDevices ? useMediaDevices : useMediaDevicesMock;
|
|
3505
3507
|
|
|
3506
3508
|
function useTextDirection(options = {}) {
|
|
3507
3509
|
const { selector = "html", initialValue = "ltr" } = options;
|
|
@@ -5656,7 +5658,7 @@ exports.useLatest = useLatest;
|
|
|
5656
5658
|
exports.useLocalStorage = useLocalStorage;
|
|
5657
5659
|
exports.useLongPress = useLongPress;
|
|
5658
5660
|
exports.useMeasure = useMeasure;
|
|
5659
|
-
exports.useMediaDevices =
|
|
5661
|
+
exports.useMediaDevices = useMediaDevices;
|
|
5660
5662
|
exports.useMediaQuery = useMediaQuery;
|
|
5661
5663
|
exports.useMount = useMount;
|
|
5662
5664
|
exports.useMountedState = useMountedState;
|
|
@@ -5698,7 +5700,7 @@ exports.useToggle = useToggle;
|
|
|
5698
5700
|
exports.useUnmount = useUnmount;
|
|
5699
5701
|
exports.useUpdate = useUpdate;
|
|
5700
5702
|
exports.useUpdateEffect = useUpdateEffect;
|
|
5701
|
-
exports.useUpdateLayoutEffect = index$
|
|
5703
|
+
exports.useUpdateLayoutEffect = index$3;
|
|
5702
5704
|
exports.useVirtualList = useVirtualList;
|
|
5703
5705
|
exports.useWindowScroll = useWindowScroll;
|
|
5704
5706
|
exports.useWindowSize = useWindowSize;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,9 +9,9 @@ declare function useLatest<T>(value: T): MutableRefObject<T>;
|
|
|
9
9
|
|
|
10
10
|
declare function useFirstMountState(): boolean;
|
|
11
11
|
|
|
12
|
-
declare const _default$
|
|
12
|
+
declare const _default$4: typeof useEffect | typeof react.useLayoutEffect;
|
|
13
13
|
|
|
14
|
-
declare const _default$
|
|
14
|
+
declare const _default$3: typeof react.useEffect | typeof useLayoutEffect;
|
|
15
15
|
|
|
16
16
|
interface Serializer<T> {
|
|
17
17
|
read(raw: string): T;
|
|
@@ -310,9 +310,6 @@ declare function useMediaDevices(options?: UseMediaDeviceOptions): readonly [{
|
|
|
310
310
|
label: string;
|
|
311
311
|
}[];
|
|
312
312
|
}, () => Promise<boolean>];
|
|
313
|
-
declare const _default$3: typeof useMediaDevices | (() => ((() => void) | {
|
|
314
|
-
devices: never[];
|
|
315
|
-
})[]);
|
|
316
313
|
|
|
317
314
|
type UseTextDirectionValue = "ltr" | "rtl" | "auto";
|
|
318
315
|
interface UseTextDirectionOptions {
|
|
@@ -869,4 +866,4 @@ declare function useSetState<T extends Record<string, any>>(initialState: T): re
|
|
|
869
866
|
type UseMeasureRect = Omit<DOMRectReadOnly, "toJSON">;
|
|
870
867
|
declare function useMeasure(target: BasicTarget, options?: ResizeObserverOptions): readonly [UseMeasureRect, () => void];
|
|
871
868
|
|
|
872
|
-
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,
|
|
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -36,7 +36,7 @@ const createUpdateEffect = (hook) => (effect, deps) => {
|
|
|
36
36
|
|
|
37
37
|
var useUpdateEffect = createUpdateEffect(useEffect);
|
|
38
38
|
|
|
39
|
-
var index$
|
|
39
|
+
var index$3 = createUpdateEffect(useLayoutEffect);
|
|
40
40
|
|
|
41
41
|
var _a;
|
|
42
42
|
const isFunction$1 = (val) => typeof val === "function";
|
|
@@ -3464,10 +3464,15 @@ function useMediaDevices(options = {}) {
|
|
|
3464
3464
|
if (permissionGranted.current) {
|
|
3465
3465
|
return true;
|
|
3466
3466
|
}
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3467
|
+
let state2 = void 0;
|
|
3468
|
+
try {
|
|
3469
|
+
state2 = (yield navigator.permissions.query({
|
|
3470
|
+
name: "camera"
|
|
3471
|
+
})).state;
|
|
3472
|
+
} catch (error) {
|
|
3473
|
+
state2 = "prompt";
|
|
3474
|
+
}
|
|
3475
|
+
if (state2 !== "granted") {
|
|
3471
3476
|
stream.current = yield navigator.mediaDevices.getUserMedia(constraints);
|
|
3472
3477
|
onChange();
|
|
3473
3478
|
permissionGranted.current = true;
|
|
@@ -3491,9 +3496,6 @@ function useMediaDevices(options = {}) {
|
|
|
3491
3496
|
}, [onChange, isSupported, requestPermissions, ensurePermissions]);
|
|
3492
3497
|
return [state, ensurePermissions];
|
|
3493
3498
|
}
|
|
3494
|
-
const useMediaDevicesMock = () => [{ devices: [] }, () => {
|
|
3495
|
-
}];
|
|
3496
|
-
var index$3 = isNavigator && !!navigator.mediaDevices ? useMediaDevices : useMediaDevicesMock;
|
|
3497
3499
|
|
|
3498
3500
|
function useTextDirection(options = {}) {
|
|
3499
3501
|
const { selector = "html", initialValue = "ltr" } = options;
|
|
@@ -5605,4 +5607,4 @@ function useMeasure(target, options = {}) {
|
|
|
5605
5607
|
return [rect, stop];
|
|
5606
5608
|
}
|
|
5607
5609
|
|
|
5608
|
-
export { 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, index$2 as useFps, useFullscreen, useGeolocation, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLongPress, useMeasure,
|
|
5610
|
+
export { 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, 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 };
|