@siberiacancode/reactuse 0.0.115 → 0.0.117

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.
Files changed (36) hide show
  1. package/dist/cjs/hooks/useActiveElement/useActiveElement.cjs.map +1 -1
  2. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.cjs +1 -1
  3. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.cjs.map +1 -1
  4. package/dist/cjs/hooks/useDoubleClick/useDoubleClick.cjs.map +1 -1
  5. package/dist/cjs/hooks/useFul/useFul.cjs +2 -0
  6. package/dist/cjs/hooks/useFul/useFul.cjs.map +1 -0
  7. package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.cjs.map +1 -1
  8. package/dist/cjs/hooks/useSpeechSynthesis/useSpeechSynthesis.cjs +2 -0
  9. package/dist/cjs/hooks/useSpeechSynthesis/useSpeechSynthesis.cjs.map +1 -0
  10. package/dist/cjs/hooks/useWakeLock/useWakeLock.cjs +2 -0
  11. package/dist/cjs/hooks/useWakeLock/useWakeLock.cjs.map +1 -0
  12. package/dist/cjs/hooks/useWindowFocus/useWindowFocus.cjs.map +1 -1
  13. package/dist/cjs/index.cjs +1 -1
  14. package/dist/esm/hooks/useActiveElement/useActiveElement.mjs.map +1 -1
  15. package/dist/esm/hooks/useDidUpdate/useDidUpdate.mjs +14 -13
  16. package/dist/esm/hooks/useDidUpdate/useDidUpdate.mjs.map +1 -1
  17. package/dist/esm/hooks/useDoubleClick/useDoubleClick.mjs.map +1 -1
  18. package/dist/esm/hooks/useFul/useFul.mjs +8 -0
  19. package/dist/esm/hooks/useFul/useFul.mjs.map +1 -0
  20. package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.mjs.map +1 -1
  21. package/dist/esm/hooks/useSpeechSynthesis/useSpeechSynthesis.mjs +56 -0
  22. package/dist/esm/hooks/useSpeechSynthesis/useSpeechSynthesis.mjs.map +1 -0
  23. package/dist/esm/hooks/useWakeLock/useWakeLock.mjs +24 -0
  24. package/dist/esm/hooks/useWakeLock/useWakeLock.mjs.map +1 -0
  25. package/dist/esm/hooks/useWindowFocus/useWindowFocus.mjs.map +1 -1
  26. package/dist/esm/index.mjs +231 -225
  27. package/dist/esm/index.mjs.map +1 -1
  28. package/dist/types/hooks/index.d.ts +3 -0
  29. package/dist/types/hooks/useActiveElement/useActiveElement.d.ts +2 -0
  30. package/dist/types/hooks/useDidUpdate/useDidUpdate.d.ts +1 -1
  31. package/dist/types/hooks/useDoubleClick/useDoubleClick.d.ts +3 -4
  32. package/dist/types/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +2 -0
  33. package/dist/types/hooks/useSpeechSynthesis/useSpeechSynthesis.d.ts +59 -0
  34. package/dist/types/hooks/useWakeLock/useWakeLock.d.ts +32 -0
  35. package/dist/types/hooks/useWindowFocus/useWindowFocus.d.ts +2 -0
  36. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ /** The use speech synthesis status type */
2
+ export type UseSpeechSynthesisStatus = 'end' | 'init' | 'pause' | 'play';
3
+ /** The use speech synthesis options type */
4
+ export interface UseSpeechSynthesisOptions {
5
+ /** Language for SpeechSynthesis */
6
+ lang?: string;
7
+ /** Gets and sets the pitch at which the utterance will be spoken at. */
8
+ pitch?: number;
9
+ /** Gets and sets the speed at which the utterance will be spoken at. */
10
+ rate?: number;
11
+ /** The text to be spoken */
12
+ text?: string;
13
+ /** Gets and sets the voice that will be used to speak the utterance. */
14
+ voice?: SpeechSynthesisVoice | null;
15
+ /** Gets and sets the volume that the utterance will be spoken at. */
16
+ volume?: number;
17
+ }
18
+ /** The use speech synthesis return type */
19
+ export interface UseSpeechSynthesisReturn {
20
+ /** Any error that occurred during speech synthesis. */
21
+ error: SpeechSynthesisErrorEvent | undefined;
22
+ /** Indicates if speech is currently playing. */
23
+ playing: boolean;
24
+ /** The current status of speech synthesis. */
25
+ status: UseSpeechSynthesisStatus;
26
+ /** Indicates if the SpeechSynthesis API is supported in the current environment. */
27
+ supported: boolean;
28
+ /** The SpeechSynthesisUtterance instance. */
29
+ utterance: SpeechSynthesisUtterance | null;
30
+ /** Function to pause speech synthesis. */
31
+ pause: () => void;
32
+ /** Function to resume speech synthesis. */
33
+ resume: () => void;
34
+ /** Function to start speech synthesis. */
35
+ speak: () => void;
36
+ /** Function to stop speech synthesis. */
37
+ stop: () => void;
38
+ /** Function to toggle between play and pause. */
39
+ toggle: (value?: boolean) => void;
40
+ }
41
+ /**
42
+ * @name useSpeechSynthesis
43
+ * @description - Hook that provides speech synthesis functionality
44
+ * @category Sensors
45
+ *
46
+ * @browserapi SpeechSynthesis https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis
47
+ *
48
+ * @params {string} [options.text] - The text to be spoken
49
+ * @params {string} [options.lang] - The language to be spoken
50
+ * @params {number} [options.pitch] - The pitch to be spoken
51
+ * @params {number} [options.rate] - The rate to be spoken
52
+ * @params {SpeechSynthesisVoice} [options.voice] - The voice to be spoken
53
+ * @params {number} [options.volume] - The volume to be spoken
54
+ * @returns {UseSpeechSynthesisReturn} An object containing the speech synthesis state and control methods
55
+ *
56
+ * @example
57
+ * const { supported, playing, status, utterance, error, stop, toggle, speak, resume, pause } = useSpeechSynthesis();
58
+ */
59
+ export declare const useSpeechSynthesis: (options?: UseSpeechSynthesisOptions) => UseSpeechSynthesisReturn;
@@ -0,0 +1,32 @@
1
+ /** The use wake lock options type */
2
+ export interface UseWakeLockOptions {
3
+ /** Determines if the wake lock should be automatically reacquired when the document becomes visible. */
4
+ immediately?: boolean;
5
+ /** A string specifying the screen wake lock type. */
6
+ type?: WakeLockType;
7
+ }
8
+ /** The use wake lock return type */
9
+ export interface UseWakeLockReturn {
10
+ /** Indicates if the wake lock is currently active. */
11
+ active: boolean;
12
+ /** Indicates if the Wake Lock API is supported in the current environment. */
13
+ supported: boolean;
14
+ /** Function to release the wake lock. */
15
+ release: () => Promise<void>;
16
+ /** Function to request the wake lock. */
17
+ request: () => Promise<void>;
18
+ }
19
+ /**
20
+ * @name useWakeLock
21
+ * @description - Hook that provides a wake lock functionality
22
+ * @category Browser
23
+ *
24
+ * @browserapi navigator.wakeLock https://developer.mozilla.org/en-US/docs/Web/API/WakeLock
25
+ *
26
+ * @param {immediately} [options] Configuration options for the hook.
27
+ * @returns {UseWakeLockReturn} An object containing the wake lock state and control methods.
28
+ *
29
+ * @example
30
+ * const { supported, active, request, release } = useWakeLock();
31
+ */
32
+ export declare const useWakeLock: (options?: UseWakeLockOptions) => UseWakeLockReturn;
@@ -7,5 +7,7 @@
7
7
  *
8
8
  * @example
9
9
  * const focused = useWindowFocus();
10
+ *
11
+ * @see {@link https://siberiacancode.github.io/reactuse/functions/hooks/useWindowFocus.html}
10
12
  */
11
13
  export declare const useWindowFocus: () => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siberiacancode/reactuse",
3
- "version": "0.0.115",
3
+ "version": "0.0.117",
4
4
  "description": "The ultimate collection of react hooks",
5
5
  "author": {
6
6
  "name": "SIBERIA CAN CODE 🧊",