@reactuses/core 1.1.4 → 1.1.5
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 +28 -5
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -171,12 +171,35 @@ declare function useCounter(initialValue?: number | (() => number), max?: number
|
|
|
171
171
|
type RafLoopReturns = readonly [() => void, () => void, () => boolean];
|
|
172
172
|
declare function useRafFn(callback: FrameRequestCallback, initiallyActive?: boolean): RafLoopReturns;
|
|
173
173
|
|
|
174
|
+
interface IListener<T, U = void> {
|
|
175
|
+
(arg1: T, arg2: U): void;
|
|
176
|
+
}
|
|
174
177
|
interface IDisposable {
|
|
175
178
|
dispose(): void;
|
|
176
179
|
}
|
|
177
180
|
interface IEvent<T, U = void> {
|
|
178
181
|
(listener: (arg1: T, arg2: U) => any): IDisposable;
|
|
179
182
|
}
|
|
183
|
+
interface IEventOnce<T, U = void> {
|
|
184
|
+
(listener: (arg1: T, arg2: U) => any): void;
|
|
185
|
+
}
|
|
186
|
+
interface UseEventEmitterReturn<T, U = void> {
|
|
187
|
+
/**
|
|
188
|
+
* Subscribe to an event. When calling emit, the listeners will execute.
|
|
189
|
+
* @param listener watch listener.
|
|
190
|
+
* @returns a stop function to remove the current callback.
|
|
191
|
+
*/
|
|
192
|
+
event: IEvent<T, U>;
|
|
193
|
+
/**
|
|
194
|
+
* fire an event, the corresponding event listeners will execute.
|
|
195
|
+
* @param event data sent.
|
|
196
|
+
*/
|
|
197
|
+
fire: (arg1: T, arg2: U) => void;
|
|
198
|
+
/**
|
|
199
|
+
* Remove all corresponding listener.
|
|
200
|
+
*/
|
|
201
|
+
dispose: () => void;
|
|
202
|
+
}
|
|
180
203
|
declare function useEventEmitter<T, U = void>(): readonly [IEvent<T, U>, (arg1: T, arg2: U) => void, () => void];
|
|
181
204
|
|
|
182
205
|
declare function useFavicon(href: string, baseUrl?: string, rel?: string): void;
|
|
@@ -235,11 +258,11 @@ type GeneralPermissionDescriptor = PermissionDescriptor | {
|
|
|
235
258
|
};
|
|
236
259
|
declare function usePermission(permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor["name"]): IState;
|
|
237
260
|
|
|
238
|
-
interface
|
|
261
|
+
interface UseLongPressOptions {
|
|
239
262
|
isPreventDefault?: boolean;
|
|
240
263
|
delay?: number;
|
|
241
264
|
}
|
|
242
|
-
declare function useLongPress(callback: (e: TouchEvent | MouseEvent) => void, { isPreventDefault, delay }?:
|
|
265
|
+
declare function useLongPress(callback: (e: TouchEvent | MouseEvent) => void, { isPreventDefault, delay }?: UseLongPressOptions): {
|
|
243
266
|
readonly onMouseDown: (e: any) => void;
|
|
244
267
|
readonly onTouchStart: (e: any) => void;
|
|
245
268
|
readonly onMouseUp: () => void;
|
|
@@ -301,11 +324,11 @@ declare function useGeolocation(options?: Partial<PositionOptions>): {
|
|
|
301
324
|
readonly error: GeolocationPositionError | null;
|
|
302
325
|
};
|
|
303
326
|
|
|
304
|
-
interface
|
|
327
|
+
interface UseFullScreenOptions {
|
|
305
328
|
onExit?: () => void;
|
|
306
329
|
onEnter?: () => void;
|
|
307
330
|
}
|
|
308
|
-
declare function useFullscreen(target: BasicTarget, options?:
|
|
331
|
+
declare function useFullscreen(target: BasicTarget, options?: UseFullScreenOptions): readonly [boolean, {
|
|
309
332
|
readonly enterFullscreen: () => void;
|
|
310
333
|
readonly exitFullscreen: () => void;
|
|
311
334
|
readonly toggleFullscreen: () => void;
|
|
@@ -726,4 +749,4 @@ declare const _default$1: typeof useEffect | typeof react.useLayoutEffect;
|
|
|
726
749
|
|
|
727
750
|
declare const _default: typeof react.useEffect | typeof useLayoutEffect;
|
|
728
751
|
|
|
729
|
-
export { useActiveElement, useClickOutSide as useClickOutside, useClipBorad as useClipboard, useControlled, useCounter, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDocumentVisibility, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useFavicon, useFileDialog, useFirstMountState, useFocus, _default$2 as useFps, useFullscreen, useGeolocation, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLongPress, _default$3 as 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, useResizeObserver, useScriptTag, useScroll, useScrollLock, useSessionStorage, useTextDirection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, _default$5 as useUpdateEffect, _default$4 as useUpdateLayoutEffect, useVirtualList, useWindowScroll, useWindowSize, useWindowsFocus };
|
|
752
|
+
export { ColorScheme, Contrast, CursorState, GeneralPermissionDescriptor, IDisposable, IEvent, IEventOnce, IListener, INetworkInformation, IState, IUseNetworkState, KeyModifier, MousePressedOptions, MouseSourceType, OrientationState, RafLoopReturns, State, Status, Target, UseDarkOptions, UseDraggableOptions, UseElementBoundingOptions, UseEventEmitterReturn, UseFileDialogOptions, UseFpsOptions, UseFullScreenOptions, UseInfiniteScrollOptions, UseLongPressOptions, UseModifierOptions, UseScriptTagOptions, UseScrollOptions, UseTextDirectionOptions, UseTextDirectionValue, UseTimeoutFnOptions, UseVirtualListItem, UseVirtualListOptions, UseVirtualListReturn, WindowSize, useActiveElement, useClickOutSide as useClickOutside, useClipBorad as useClipboard, useControlled, useCounter, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDocumentVisibility, useDraggable, useDropZone, useElementBounding, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useFavicon, useFileDialog, useFirstMountState, useFocus, _default$2 as useFps, useFullscreen, useGeolocation, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLongPress, _default$3 as 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, useResizeObserver, useScriptTag, useScroll, useScrollLock, useSessionStorage, useTextDirection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, _default$5 as useUpdateEffect, _default$4 as useUpdateLayoutEffect, useVirtualList, useWindowScroll, useWindowSize, useWindowsFocus };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactuses/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -76,6 +76,9 @@
|
|
|
76
76
|
"ts-node": "^10.9.1",
|
|
77
77
|
"typescript": "^4.8.2"
|
|
78
78
|
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
81
|
+
},
|
|
79
82
|
"keywords": [
|
|
80
83
|
"react",
|
|
81
84
|
"react-use",
|