@siberiacancode/reactuse 0.2.22 → 0.2.23
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/cjs/hooks/useBattery/useBattery.cjs +1 -1
- package/dist/cjs/hooks/useBattery/useBattery.cjs.map +1 -1
- package/dist/cjs/hooks/useBroadcastChannel/useBroadcastChannel.cjs +2 -0
- package/dist/cjs/hooks/useBroadcastChannel/useBroadcastChannel.cjs.map +1 -0
- package/dist/cjs/hooks/useClickOutside/useClickOutside.cjs +1 -1
- package/dist/cjs/hooks/useClickOutside/useClickOutside.cjs.map +1 -1
- package/dist/cjs/hooks/useDisplayMedia/useDisplayMedia.cjs +1 -1
- package/dist/cjs/hooks/useDisplayMedia/useDisplayMedia.cjs.map +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.cjs +1 -1
- package/dist/cjs/hooks/useMemory/useMemory.cjs.map +1 -1
- package/dist/cjs/hooks/useRerender/useRerender.cjs.map +1 -1
- package/dist/cjs/hooks/useTextDirection/useTextDirection.cjs +1 -1
- package/dist/cjs/hooks/useTextDirection/useTextDirection.cjs.map +1 -1
- package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.cjs +1 -1
- package/dist/cjs/hooks/useThrottleCallback/useThrottleCallback.cjs.map +1 -1
- package/dist/cjs/hooks/useTime/useTime.cjs +1 -1
- package/dist/cjs/hooks/useTime/useTime.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/hooks/useBattery/useBattery.mjs +8 -8
- package/dist/esm/hooks/useBattery/useBattery.mjs.map +1 -1
- package/dist/esm/hooks/useBroadcastChannel/useBroadcastChannel.mjs +32 -0
- package/dist/esm/hooks/useBroadcastChannel/useBroadcastChannel.mjs.map +1 -0
- package/dist/esm/hooks/useClickOutside/useClickOutside.mjs +12 -12
- package/dist/esm/hooks/useClickOutside/useClickOutside.mjs.map +1 -1
- package/dist/esm/hooks/useDisplayMedia/useDisplayMedia.mjs +23 -25
- package/dist/esm/hooks/useDisplayMedia/useDisplayMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMemory/useMemory.mjs +9 -8
- package/dist/esm/hooks/useMemory/useMemory.mjs.map +1 -1
- package/dist/esm/hooks/useRerender/useRerender.mjs.map +1 -1
- package/dist/esm/hooks/useTextDirection/useTextDirection.mjs +9 -10
- package/dist/esm/hooks/useTextDirection/useTextDirection.mjs.map +1 -1
- package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.mjs +11 -11
- package/dist/esm/hooks/useThrottleCallback/useThrottleCallback.mjs.map +1 -1
- package/dist/esm/hooks/useTime/useTime.mjs +10 -6
- package/dist/esm/hooks/useTime/useTime.mjs.map +1 -1
- package/dist/esm/index.mjs +321 -319
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useBroadcastChannel/useBroadcastChannel.d.ts +32 -0
- package/dist/types/hooks/useTime/useTime.d.ts +8 -0
- package/package.json +1 -1
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,6 +5,7 @@ export * from './useBattery/useBattery';
|
|
|
5
5
|
export * from './useBluetooth/useBluetooth';
|
|
6
6
|
export * from './useBoolean/useBoolean';
|
|
7
7
|
export * from './useBreakpoints/useBreakpoints';
|
|
8
|
+
export * from './useBroadcastChannel/useBroadcastChannel';
|
|
8
9
|
export * from './useBrowserLanguage/useBrowserLanguage';
|
|
9
10
|
export * from './useClickOutside/useClickOutside';
|
|
10
11
|
export * from './useClipboard/useClipboard';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** The use broadcast channel return type */
|
|
2
|
+
export interface UseBroadcastChannelReturn<Data = unknown> {
|
|
3
|
+
/** The underlying BroadcastChannel instance if supported, undefined otherwise */
|
|
4
|
+
channel?: BroadcastChannel;
|
|
5
|
+
/** Whether the channel has been closed */
|
|
6
|
+
closed: boolean;
|
|
7
|
+
/** The most recently received data from other contexts */
|
|
8
|
+
data?: Data;
|
|
9
|
+
/** Error object if any error occurred during channel operations */
|
|
10
|
+
error?: Event;
|
|
11
|
+
/** Whether the BroadcastChannel API is supported in the current environment */
|
|
12
|
+
supported: boolean;
|
|
13
|
+
/** Function to close the channel and clean up resources */
|
|
14
|
+
close: () => void;
|
|
15
|
+
/** Function to send data to other contexts through the channel */
|
|
16
|
+
post: (data: Data) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @name useBroadcastChannel
|
|
20
|
+
* @description Hook that provides cross-tab/window communication
|
|
21
|
+
* @category Browser
|
|
22
|
+
*
|
|
23
|
+
* @browserapi BroadcastChannel https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel
|
|
24
|
+
*
|
|
25
|
+
* @param {string} name The name of the channel
|
|
26
|
+
* @param {Function} callback A callback function that will be called when a message is received
|
|
27
|
+
* @returns {UseBroadcastChannelReturn} An object containing the channel state and controls
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const { supported, data, post, error } = useBroadcastChannel('channel');
|
|
31
|
+
*/
|
|
32
|
+
export declare const useBroadcastChannel: <Data = unknown>(name: string, callback?: (data: Data) => void) => UseBroadcastChannelReturn<Data>;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
export interface UseTimeReturn {
|
|
2
|
+
/** The current day of the month (1-31) */
|
|
2
3
|
day: number;
|
|
4
|
+
/** The current hour in 24-hour format (0-23) */
|
|
3
5
|
hours: number;
|
|
6
|
+
/** The current hour in 12-hour format with meridiem type (AM/PM) */
|
|
4
7
|
meridiemHours: {
|
|
5
8
|
value: number;
|
|
6
9
|
type: string;
|
|
7
10
|
};
|
|
11
|
+
/** The current minute (0-59) */
|
|
8
12
|
minutes: number;
|
|
13
|
+
/** The current month (1-12) */
|
|
9
14
|
month: number;
|
|
15
|
+
/** The current second (0-59) */
|
|
10
16
|
seconds: number;
|
|
17
|
+
/** The current Unix timestamp in milliseconds */
|
|
11
18
|
timestamp: number;
|
|
19
|
+
/** The current year */
|
|
12
20
|
year: number;
|
|
13
21
|
}
|
|
14
22
|
/**
|