@reactuses/core 6.1.0-beta.1 → 6.1.1

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/README.md CHANGED
@@ -18,7 +18,7 @@ npm i @reactuses/core
18
18
 
19
19
  ## MCP Support
20
20
 
21
- If you want to use the MCP (Meta Command Protocol) integration with reactuse, you can easily set it up with the following configuration. This allows you to run the `@reactuses/mcp` utility via `npx` for enhanced command-line support and automation.
21
+ If you want to use the MCP (Model Context Protocol) integration with reactuse, you can easily set it up with the following configuration. This allows you to run the `@reactuses/mcp` utility via `npx` for enhanced command-line support and automation.
22
22
 
23
23
  Add the following to your configuration:
24
24
 
package/dist/index.cjs CHANGED
@@ -4204,6 +4204,112 @@ const useMap = (initialValue)=>{
4204
4204
  };
4205
4205
  };
4206
4206
 
4207
+ const useSpeechRecognition = (options = {})=>{
4208
+ const { interimResults = true, continuous = true, maxAlternatives = 1, lang = 'en-US' } = options;
4209
+ const [isListening, setIsListening] = React.useState(false);
4210
+ const [isFinal, setIsFinal] = React.useState(false);
4211
+ const [result, setResult] = React.useState('');
4212
+ const [error, setError] = React.useState(undefined);
4213
+ const recognitionRef = React.useRef(undefined);
4214
+ const SpeechRecognitionClass = defaultWindow && (defaultWindow.SpeechRecognition || defaultWindow.webkitSpeechRecognition);
4215
+ const isSupported = useSupported(()=>SpeechRecognitionClass);
4216
+ const start = useEvent((startOptions)=>{
4217
+ if (!recognitionRef.current) {
4218
+ return;
4219
+ }
4220
+ // Apply options to recognition instance
4221
+ const { interimResults: newInterimResults = interimResults, continuous: newContinuous = continuous, maxAlternatives: newMaxAlternatives = maxAlternatives, lang: newLang = lang } = startOptions || {};
4222
+ recognitionRef.current.interimResults = newInterimResults;
4223
+ recognitionRef.current.continuous = newContinuous;
4224
+ recognitionRef.current.maxAlternatives = newMaxAlternatives;
4225
+ recognitionRef.current.lang = newLang;
4226
+ setIsListening(true);
4227
+ });
4228
+ const stop = useEvent(()=>{
4229
+ setIsListening(false);
4230
+ });
4231
+ const toggle = useEvent((value = !isListening, startOptions)=>{
4232
+ if (value) {
4233
+ start(startOptions);
4234
+ } else {
4235
+ stop();
4236
+ }
4237
+ });
4238
+ // Initialize recognition when supported
4239
+ React.useEffect(()=>{
4240
+ if (!isSupported || !SpeechRecognitionClass) {
4241
+ return;
4242
+ }
4243
+ const recognition = new SpeechRecognitionClass();
4244
+ recognitionRef.current = recognition;
4245
+ // Set up event listeners
4246
+ recognition.onstart = ()=>{
4247
+ setIsListening(true);
4248
+ setIsFinal(false);
4249
+ };
4250
+ recognition.onresult = (event)=>{
4251
+ const currentResult = event.results[event.resultIndex];
4252
+ const { transcript } = currentResult[0];
4253
+ setIsFinal(currentResult.isFinal);
4254
+ setResult(transcript);
4255
+ setError(undefined);
4256
+ };
4257
+ recognition.onerror = (event)=>{
4258
+ setError(event);
4259
+ };
4260
+ recognition.onend = ()=>{
4261
+ setIsListening(false);
4262
+ };
4263
+ return ()=>{
4264
+ if (recognition) {
4265
+ recognition.abort();
4266
+ }
4267
+ };
4268
+ }, [
4269
+ isSupported,
4270
+ SpeechRecognitionClass
4271
+ ]);
4272
+ // Handle listening state changes
4273
+ React.useEffect(()=>{
4274
+ if (!recognitionRef.current) {
4275
+ return;
4276
+ }
4277
+ if (isListening) {
4278
+ try {
4279
+ recognitionRef.current.start();
4280
+ } catch (err) {
4281
+ console.warn('Failed to start speech recognition:', err);
4282
+ setIsListening(false);
4283
+ }
4284
+ } else {
4285
+ try {
4286
+ recognitionRef.current.stop();
4287
+ } catch (err) {
4288
+ console.warn('Failed to stop speech recognition:', err);
4289
+ }
4290
+ }
4291
+ }, [
4292
+ isListening
4293
+ ]);
4294
+ // Cleanup on unmount
4295
+ useUnmount(()=>{
4296
+ if (recognitionRef.current) {
4297
+ recognitionRef.current.abort();
4298
+ }
4299
+ });
4300
+ return {
4301
+ isSupported,
4302
+ isListening,
4303
+ isFinal,
4304
+ recognition: recognitionRef.current,
4305
+ result,
4306
+ error,
4307
+ toggle,
4308
+ start,
4309
+ stop
4310
+ };
4311
+ };
4312
+
4207
4313
  exports.assignRef = assignRef;
4208
4314
  exports.defaultOptions = defaultOptions;
4209
4315
  exports.mergeRefs = mergeRefs;
@@ -4298,6 +4404,7 @@ exports.useScrollIntoView = useScrollIntoView;
4298
4404
  exports.useScrollLock = useScrollLock;
4299
4405
  exports.useSessionStorage = useSessionStorage;
4300
4406
  exports.useSetState = useSetState;
4407
+ exports.useSpeechRecognition = useSpeechRecognition;
4301
4408
  exports.useSticky = useSticky;
4302
4409
  exports.useSupported = useSupported;
4303
4410
  exports.useTextDirection = useTextDirection;
package/dist/index.d.cts CHANGED
@@ -3326,6 +3326,175 @@ type UseColorMode<T extends string = string> = (options: UseColorModeOptions<T>)
3326
3326
 
3327
3327
  declare const useColorMode: UseColorMode;
3328
3328
 
3329
+ interface SpeechRecognitionErrorEvent extends Event {
3330
+ readonly error: string;
3331
+ readonly message: string;
3332
+ }
3333
+ interface SpeechRecognitionEvent extends Event {
3334
+ readonly resultIndex: number;
3335
+ readonly results: SpeechRecognitionResultList;
3336
+ }
3337
+ interface SpeechRecognitionResult {
3338
+ readonly isFinal: boolean;
3339
+ readonly length: number;
3340
+ item: (index: number) => SpeechRecognitionAlternative;
3341
+ [index: number]: SpeechRecognitionAlternative;
3342
+ }
3343
+ interface SpeechRecognitionAlternative {
3344
+ readonly transcript: string;
3345
+ readonly confidence: number;
3346
+ }
3347
+ interface SpeechRecognitionResultList {
3348
+ readonly length: number;
3349
+ item: (index: number) => SpeechRecognitionResult;
3350
+ [index: number]: SpeechRecognitionResult;
3351
+ }
3352
+ interface SpeechRecognition extends EventTarget {
3353
+ continuous: boolean;
3354
+ grammars: any;
3355
+ interimResults: boolean;
3356
+ lang: string;
3357
+ maxAlternatives: number;
3358
+ serviceURI: string;
3359
+ onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
3360
+ onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
3361
+ onend: ((this: SpeechRecognition, ev: Event) => any) | null;
3362
+ onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null;
3363
+ onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
3364
+ onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
3365
+ onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null;
3366
+ onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3367
+ onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null;
3368
+ onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3369
+ onstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3370
+ abort: () => void;
3371
+ start: () => void;
3372
+ stop: () => void;
3373
+ }
3374
+ declare global {
3375
+ interface Window {
3376
+ SpeechRecognition?: new () => SpeechRecognition;
3377
+ webkitSpeechRecognition?: new () => SpeechRecognition;
3378
+ }
3379
+ }
3380
+
3381
+ /**
3382
+ * @title UseSpeechRecognitionOptions
3383
+ */
3384
+ interface UseSpeechRecognitionOptions {
3385
+ /**
3386
+ * Controls whether continuous results are returned for each recognition, or only a single result.
3387
+ *
3388
+ * @zh 控制是否为每次识别返回连续结果,或仅返回单个结果
3389
+ * @en Controls whether continuous results are returned for each recognition, or only a single result
3390
+ * @default true
3391
+ */
3392
+ continuous?: boolean;
3393
+ /**
3394
+ * Controls whether interim results should be returned (true) or not (false.) Interim results are results that are not yet final
3395
+ *
3396
+ * @zh 控制是否应返回临时结果(true)或不返回(false)。临时结果是尚未最终确定的结果
3397
+ * @en Controls whether interim results should be returned (true) or not (false.) Interim results are results that are not yet final
3398
+ * @default true
3399
+ */
3400
+ interimResults?: boolean;
3401
+ /**
3402
+ * Language for SpeechRecognition
3403
+ *
3404
+ * @zh 语音识别的语言
3405
+ * @en Language for SpeechRecognition
3406
+ * @default 'en-US'
3407
+ */
3408
+ lang?: string;
3409
+ /**
3410
+ * A number representing the maximum returned alternatives for each result.
3411
+ *
3412
+ * @zh 表示每个结果返回的最大备选项数量的数字
3413
+ * @en A number representing the maximum returned alternatives for each result
3414
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/maxAlternatives
3415
+ * @default 1
3416
+ */
3417
+ maxAlternatives?: number;
3418
+ }
3419
+ /**
3420
+ * @title useSpeechRecognition
3421
+ * @returns 包含以下元素的对象:
3422
+ * - 是否支持语音识别。
3423
+ * - 是否正在监听。
3424
+ * - 识别结果是否为最终结果。
3425
+ * - SpeechRecognition 实例。
3426
+ * - 识别结果文本。
3427
+ * - 错误信息。
3428
+ * - 切换监听状态的函数。
3429
+ * - 开始监听的函数。
3430
+ * - 停止监听的函数。
3431
+ * @returns_en A object with the following elements:
3432
+ * - Whether speech recognition is supported.
3433
+ * - Whether currently listening.
3434
+ * - Whether the recognition result is final.
3435
+ * - SpeechRecognition instance.
3436
+ * - Recognition result text.
3437
+ * - Error information.
3438
+ * - Function to toggle listening state.
3439
+ * - Function to start listening.
3440
+ * - Function to stop listening.
3441
+ */
3442
+ type UseSpeechRecognition = (
3443
+ /**
3444
+ * @zh 可选的语音识别配置参数
3445
+ * @en Optional speech recognition configuration options
3446
+ */
3447
+ options?: UseSpeechRecognitionOptions) => {
3448
+ /**
3449
+ * @zh 浏览器是否支持语音识别
3450
+ * @en Whether the browser supports speech recognition
3451
+ */
3452
+ readonly isSupported: boolean;
3453
+ /**
3454
+ * @zh 是否正在监听
3455
+ * @en Whether currently listening
3456
+ */
3457
+ readonly isListening: boolean;
3458
+ /**
3459
+ * @zh 识别结果是否为最终结果
3460
+ * @en Whether the recognition result is final
3461
+ */
3462
+ readonly isFinal: boolean;
3463
+ /**
3464
+ * @zh SpeechRecognition 实例
3465
+ * @en SpeechRecognition instance
3466
+ */
3467
+ readonly recognition: SpeechRecognition | undefined;
3468
+ /**
3469
+ * @zh 识别结果文本
3470
+ * @en Recognition result text
3471
+ */
3472
+ readonly result: string;
3473
+ /**
3474
+ * @zh 错误信息
3475
+ * @en Error information
3476
+ */
3477
+ readonly error: SpeechRecognitionErrorEvent | undefined;
3478
+ /**
3479
+ * @zh 切换监听状态
3480
+ * @en Toggle listening state
3481
+ */
3482
+ readonly toggle: (value?: boolean, startOptions?: Partial<UseSpeechRecognitionOptions>) => void;
3483
+ /**
3484
+ * @zh 开始监听
3485
+ * @en Start listening
3486
+ */
3487
+ readonly start: (startOptions?: Partial<UseSpeechRecognitionOptions>) => void;
3488
+ /**
3489
+ * @zh 停止监听
3490
+ * @en Stop listening
3491
+ */
3492
+ readonly stop: () => void;
3493
+ };
3494
+ type UseSpeechRecognitionReturn = ReturnType<UseSpeechRecognition>;
3495
+
3496
+ declare const useSpeechRecognition: UseSpeechRecognition;
3497
+
3329
3498
  /**
3330
3499
  * @title useDocumentVisiblity
3331
3500
  * @returns_en document visibility
@@ -3733,5 +3902,5 @@ type Use = <T>(
3733
3902
  */
3734
3903
  usable: Usable<T>) => T;
3735
3904
 
3736
- export { assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBoolean, useBroadcastChannel, useClickOutside as useClickAway, useClickOutside, useClipboard, useColorMode, useControlled, useCookie, useClipboard as useCopyToClipboard, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMap, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, 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, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
3737
- export type { ColorScheme, Contrast, DepsEqualFnType, EventSourceStatus, EventType, INetworkInformation, IUseNetworkState, KeyModifier, Pausable, Platform, PossibleRef, Use, UseActiveElement, UseAsyncEffect, UseBoolean, UseBroadcastChannel, UseBroadcastChannelOptions, UseBroadcastChannelReturn, UseClickOutside, UseClipboard, UseColorMode, UseColorModeOptions, UseControlled, UseCookie, UseCookieState, UseCountDown, UseCounter, UseCssVar, UseCssVarOptions, UseCustomCompareEffect, UseCycleList, UseDarkMode, UseDarkOptions, UseDebounce, UseDebounceFn, UseDeepCompareEffect, UseDevicePixelRatio, UseDevicePixelRatioReturn, UseDisclosure, UseDisclosureProps, UseDocumentVisibility, UseDoubleClick, UseDoubleClickProps, UseDraggable, UseDraggableOptions, UseDropZone, UseElementBounding, UseElementBoundingOptions, UseElementBoundingReturn, UseElementByPoint, UseElementByPointOptions, UseElementByPointReturn, UseElementSize, UseElementVisibility, UseEvent, UseEventEmitter, UseEventEmitterDisposable, UseEventEmitterEvent, UseEventEmitterEventOnce, UseEventEmitterListener, UseEventEmitterReturn, UseEventListener, UseEventSource, UseEventSourceAutoReconnectOptions, UseEventSourceOptions, UseEventSourceReturn, UseEyeDropper, UseEyeDropperOpenOptions, UseEyeDropperOpenReturnType, UseFavicon, UseFetchEventSource, UseFetchEventSourceAutoReconnectOptions, UseFetchEventSourceMessage, UseFetchEventSourceOptions, UseFetchEventSourceReturn, UseFetchEventSourceStatus, UseFileDialog, UseFileDialogOptions, UseFirstMountState, UseFocus, UseFps, UseFpsOptions, UseFullScreenOptions, UseFullscreen, UseGeolocation, UseHover, UseIdle, UseInfiniteScroll, UseInfiniteScrollArrivedState, UseInfiniteScrollDirection, UseInfiniteScrollLoadMore, UseInfiniteScrollOptions, UseIntersectionObserver, UseInterval, UseIntervalOptions, UseKeyModifier, UseLatest, UseLocalStorage, UseLocalStorageOptions, UseLocalStorageSerializer, UseLocationSelector, UseLongPress, UseLongPressOptions, UseMap, UseMeasure, UseMeasureRect, UseMediaDeviceOptions, UseMediaDevices, UseMediaQuery, UseMergedRef, UseMobileLandscape, UseModifierOptions, UseMount, UseMountedState, UseMouse, UseMouseCursorState, UseMousePressed, UseMousePressedOptions, UseMousePressedSourceType, UseMutationObserver, UseNetwork, UseObjectUrl, UseOnline, UseOrientation, UseOrientationLockType, UseOrientationState, UseOrientationType, UsePageLeave, UsePermission, UsePermissionDescriptorNamePolyfill, UsePermissionGeneralPermissionDescriptor, UsePermissionState, UsePlatform, UsePlatformProps, UsePlatformReturn, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePrevious, UseRafFn, UseRafState, UseReducedMotion, UseResizeObserver, UseScreenSafeArea, UseScriptTag, UseScriptTagOptions, UseScriptTagStatus, UseScroll, UseScrollArrivedState, UseScrollDirection, UseScrollIntoView, UseScrollIntoViewAnimation, UseScrollIntoViewParams, UseScrollLock, UseScrollOffset, UseScrollOptions, UseSessionStorage, UseSessionStorageOptions, UseSessionStorageSerializer, UseSetState, UseSticky, UseStickyParams, UseSupported, UseTextDirection, UseTextDirectionOptions, UseTextDirectionValue, UseTextSelection, UseThrottle, UseThrottleFn, UseTimeout, UseTimeoutFn, UseTimeoutFnOptions, UseTimeoutOptions, UseTitle, UseToggle, UseUnmount, UseUpdate, UseWebNotification, UseWebNotificationReturn, UseWebNotificationShow, UseWindowScroll, UseWindowScrollState, UseWindowSize, UseWindowsFocus };
3905
+ export { assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBoolean, useBroadcastChannel, useClickOutside as useClickAway, useClickOutside, useClipboard, useColorMode, useControlled, useCookie, useClipboard as useCopyToClipboard, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMap, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSpeechRecognition, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
3906
+ export type { ColorScheme, Contrast, DepsEqualFnType, EventSourceStatus, EventType, INetworkInformation, IUseNetworkState, KeyModifier, Pausable, Platform, PossibleRef, Use, UseActiveElement, UseAsyncEffect, UseBoolean, UseBroadcastChannel, UseBroadcastChannelOptions, UseBroadcastChannelReturn, UseClickOutside, UseClipboard, UseColorMode, UseColorModeOptions, UseControlled, UseCookie, UseCookieState, UseCountDown, UseCounter, UseCssVar, UseCssVarOptions, UseCustomCompareEffect, UseCycleList, UseDarkMode, UseDarkOptions, UseDebounce, UseDebounceFn, UseDeepCompareEffect, UseDevicePixelRatio, UseDevicePixelRatioReturn, UseDisclosure, UseDisclosureProps, UseDocumentVisibility, UseDoubleClick, UseDoubleClickProps, UseDraggable, UseDraggableOptions, UseDropZone, UseElementBounding, UseElementBoundingOptions, UseElementBoundingReturn, UseElementByPoint, UseElementByPointOptions, UseElementByPointReturn, UseElementSize, UseElementVisibility, UseEvent, UseEventEmitter, UseEventEmitterDisposable, UseEventEmitterEvent, UseEventEmitterEventOnce, UseEventEmitterListener, UseEventEmitterReturn, UseEventListener, UseEventSource, UseEventSourceAutoReconnectOptions, UseEventSourceOptions, UseEventSourceReturn, UseEyeDropper, UseEyeDropperOpenOptions, UseEyeDropperOpenReturnType, UseFavicon, UseFetchEventSource, UseFetchEventSourceAutoReconnectOptions, UseFetchEventSourceMessage, UseFetchEventSourceOptions, UseFetchEventSourceReturn, UseFetchEventSourceStatus, UseFileDialog, UseFileDialogOptions, UseFirstMountState, UseFocus, UseFps, UseFpsOptions, UseFullScreenOptions, UseFullscreen, UseGeolocation, UseHover, UseIdle, UseInfiniteScroll, UseInfiniteScrollArrivedState, UseInfiniteScrollDirection, UseInfiniteScrollLoadMore, UseInfiniteScrollOptions, UseIntersectionObserver, UseInterval, UseIntervalOptions, UseKeyModifier, UseLatest, UseLocalStorage, UseLocalStorageOptions, UseLocalStorageSerializer, UseLocationSelector, UseLongPress, UseLongPressOptions, UseMap, UseMeasure, UseMeasureRect, UseMediaDeviceOptions, UseMediaDevices, UseMediaQuery, UseMergedRef, UseMobileLandscape, UseModifierOptions, UseMount, UseMountedState, UseMouse, UseMouseCursorState, UseMousePressed, UseMousePressedOptions, UseMousePressedSourceType, UseMutationObserver, UseNetwork, UseObjectUrl, UseOnline, UseOrientation, UseOrientationLockType, UseOrientationState, UseOrientationType, UsePageLeave, UsePermission, UsePermissionDescriptorNamePolyfill, UsePermissionGeneralPermissionDescriptor, UsePermissionState, UsePlatform, UsePlatformProps, UsePlatformReturn, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePrevious, UseRafFn, UseRafState, UseReducedMotion, UseResizeObserver, UseScreenSafeArea, UseScriptTag, UseScriptTagOptions, UseScriptTagStatus, UseScroll, UseScrollArrivedState, UseScrollDirection, UseScrollIntoView, UseScrollIntoViewAnimation, UseScrollIntoViewParams, UseScrollLock, UseScrollOffset, UseScrollOptions, UseSessionStorage, UseSessionStorageOptions, UseSessionStorageSerializer, UseSetState, UseSpeechRecognition, UseSpeechRecognitionOptions, UseSpeechRecognitionReturn, UseSticky, UseStickyParams, UseSupported, UseTextDirection, UseTextDirectionOptions, UseTextDirectionValue, UseTextSelection, UseThrottle, UseThrottleFn, UseTimeout, UseTimeoutFn, UseTimeoutFnOptions, UseTimeoutOptions, UseTitle, UseToggle, UseUnmount, UseUpdate, UseWebNotification, UseWebNotificationReturn, UseWebNotificationShow, UseWindowScroll, UseWindowScrollState, UseWindowSize, UseWindowsFocus };
package/dist/index.d.mts CHANGED
@@ -3326,6 +3326,175 @@ type UseColorMode<T extends string = string> = (options: UseColorModeOptions<T>)
3326
3326
 
3327
3327
  declare const useColorMode: UseColorMode;
3328
3328
 
3329
+ interface SpeechRecognitionErrorEvent extends Event {
3330
+ readonly error: string;
3331
+ readonly message: string;
3332
+ }
3333
+ interface SpeechRecognitionEvent extends Event {
3334
+ readonly resultIndex: number;
3335
+ readonly results: SpeechRecognitionResultList;
3336
+ }
3337
+ interface SpeechRecognitionResult {
3338
+ readonly isFinal: boolean;
3339
+ readonly length: number;
3340
+ item: (index: number) => SpeechRecognitionAlternative;
3341
+ [index: number]: SpeechRecognitionAlternative;
3342
+ }
3343
+ interface SpeechRecognitionAlternative {
3344
+ readonly transcript: string;
3345
+ readonly confidence: number;
3346
+ }
3347
+ interface SpeechRecognitionResultList {
3348
+ readonly length: number;
3349
+ item: (index: number) => SpeechRecognitionResult;
3350
+ [index: number]: SpeechRecognitionResult;
3351
+ }
3352
+ interface SpeechRecognition extends EventTarget {
3353
+ continuous: boolean;
3354
+ grammars: any;
3355
+ interimResults: boolean;
3356
+ lang: string;
3357
+ maxAlternatives: number;
3358
+ serviceURI: string;
3359
+ onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
3360
+ onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
3361
+ onend: ((this: SpeechRecognition, ev: Event) => any) | null;
3362
+ onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null;
3363
+ onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
3364
+ onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
3365
+ onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null;
3366
+ onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3367
+ onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null;
3368
+ onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3369
+ onstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3370
+ abort: () => void;
3371
+ start: () => void;
3372
+ stop: () => void;
3373
+ }
3374
+ declare global {
3375
+ interface Window {
3376
+ SpeechRecognition?: new () => SpeechRecognition;
3377
+ webkitSpeechRecognition?: new () => SpeechRecognition;
3378
+ }
3379
+ }
3380
+
3381
+ /**
3382
+ * @title UseSpeechRecognitionOptions
3383
+ */
3384
+ interface UseSpeechRecognitionOptions {
3385
+ /**
3386
+ * Controls whether continuous results are returned for each recognition, or only a single result.
3387
+ *
3388
+ * @zh 控制是否为每次识别返回连续结果,或仅返回单个结果
3389
+ * @en Controls whether continuous results are returned for each recognition, or only a single result
3390
+ * @default true
3391
+ */
3392
+ continuous?: boolean;
3393
+ /**
3394
+ * Controls whether interim results should be returned (true) or not (false.) Interim results are results that are not yet final
3395
+ *
3396
+ * @zh 控制是否应返回临时结果(true)或不返回(false)。临时结果是尚未最终确定的结果
3397
+ * @en Controls whether interim results should be returned (true) or not (false.) Interim results are results that are not yet final
3398
+ * @default true
3399
+ */
3400
+ interimResults?: boolean;
3401
+ /**
3402
+ * Language for SpeechRecognition
3403
+ *
3404
+ * @zh 语音识别的语言
3405
+ * @en Language for SpeechRecognition
3406
+ * @default 'en-US'
3407
+ */
3408
+ lang?: string;
3409
+ /**
3410
+ * A number representing the maximum returned alternatives for each result.
3411
+ *
3412
+ * @zh 表示每个结果返回的最大备选项数量的数字
3413
+ * @en A number representing the maximum returned alternatives for each result
3414
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/maxAlternatives
3415
+ * @default 1
3416
+ */
3417
+ maxAlternatives?: number;
3418
+ }
3419
+ /**
3420
+ * @title useSpeechRecognition
3421
+ * @returns 包含以下元素的对象:
3422
+ * - 是否支持语音识别。
3423
+ * - 是否正在监听。
3424
+ * - 识别结果是否为最终结果。
3425
+ * - SpeechRecognition 实例。
3426
+ * - 识别结果文本。
3427
+ * - 错误信息。
3428
+ * - 切换监听状态的函数。
3429
+ * - 开始监听的函数。
3430
+ * - 停止监听的函数。
3431
+ * @returns_en A object with the following elements:
3432
+ * - Whether speech recognition is supported.
3433
+ * - Whether currently listening.
3434
+ * - Whether the recognition result is final.
3435
+ * - SpeechRecognition instance.
3436
+ * - Recognition result text.
3437
+ * - Error information.
3438
+ * - Function to toggle listening state.
3439
+ * - Function to start listening.
3440
+ * - Function to stop listening.
3441
+ */
3442
+ type UseSpeechRecognition = (
3443
+ /**
3444
+ * @zh 可选的语音识别配置参数
3445
+ * @en Optional speech recognition configuration options
3446
+ */
3447
+ options?: UseSpeechRecognitionOptions) => {
3448
+ /**
3449
+ * @zh 浏览器是否支持语音识别
3450
+ * @en Whether the browser supports speech recognition
3451
+ */
3452
+ readonly isSupported: boolean;
3453
+ /**
3454
+ * @zh 是否正在监听
3455
+ * @en Whether currently listening
3456
+ */
3457
+ readonly isListening: boolean;
3458
+ /**
3459
+ * @zh 识别结果是否为最终结果
3460
+ * @en Whether the recognition result is final
3461
+ */
3462
+ readonly isFinal: boolean;
3463
+ /**
3464
+ * @zh SpeechRecognition 实例
3465
+ * @en SpeechRecognition instance
3466
+ */
3467
+ readonly recognition: SpeechRecognition | undefined;
3468
+ /**
3469
+ * @zh 识别结果文本
3470
+ * @en Recognition result text
3471
+ */
3472
+ readonly result: string;
3473
+ /**
3474
+ * @zh 错误信息
3475
+ * @en Error information
3476
+ */
3477
+ readonly error: SpeechRecognitionErrorEvent | undefined;
3478
+ /**
3479
+ * @zh 切换监听状态
3480
+ * @en Toggle listening state
3481
+ */
3482
+ readonly toggle: (value?: boolean, startOptions?: Partial<UseSpeechRecognitionOptions>) => void;
3483
+ /**
3484
+ * @zh 开始监听
3485
+ * @en Start listening
3486
+ */
3487
+ readonly start: (startOptions?: Partial<UseSpeechRecognitionOptions>) => void;
3488
+ /**
3489
+ * @zh 停止监听
3490
+ * @en Stop listening
3491
+ */
3492
+ readonly stop: () => void;
3493
+ };
3494
+ type UseSpeechRecognitionReturn = ReturnType<UseSpeechRecognition>;
3495
+
3496
+ declare const useSpeechRecognition: UseSpeechRecognition;
3497
+
3329
3498
  /**
3330
3499
  * @title useDocumentVisiblity
3331
3500
  * @returns_en document visibility
@@ -3733,5 +3902,5 @@ type Use = <T>(
3733
3902
  */
3734
3903
  usable: Usable<T>) => T;
3735
3904
 
3736
- export { assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBoolean, useBroadcastChannel, useClickOutside as useClickAway, useClickOutside, useClipboard, useColorMode, useControlled, useCookie, useClipboard as useCopyToClipboard, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMap, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, 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, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
3737
- export type { ColorScheme, Contrast, DepsEqualFnType, EventSourceStatus, EventType, INetworkInformation, IUseNetworkState, KeyModifier, Pausable, Platform, PossibleRef, Use, UseActiveElement, UseAsyncEffect, UseBoolean, UseBroadcastChannel, UseBroadcastChannelOptions, UseBroadcastChannelReturn, UseClickOutside, UseClipboard, UseColorMode, UseColorModeOptions, UseControlled, UseCookie, UseCookieState, UseCountDown, UseCounter, UseCssVar, UseCssVarOptions, UseCustomCompareEffect, UseCycleList, UseDarkMode, UseDarkOptions, UseDebounce, UseDebounceFn, UseDeepCompareEffect, UseDevicePixelRatio, UseDevicePixelRatioReturn, UseDisclosure, UseDisclosureProps, UseDocumentVisibility, UseDoubleClick, UseDoubleClickProps, UseDraggable, UseDraggableOptions, UseDropZone, UseElementBounding, UseElementBoundingOptions, UseElementBoundingReturn, UseElementByPoint, UseElementByPointOptions, UseElementByPointReturn, UseElementSize, UseElementVisibility, UseEvent, UseEventEmitter, UseEventEmitterDisposable, UseEventEmitterEvent, UseEventEmitterEventOnce, UseEventEmitterListener, UseEventEmitterReturn, UseEventListener, UseEventSource, UseEventSourceAutoReconnectOptions, UseEventSourceOptions, UseEventSourceReturn, UseEyeDropper, UseEyeDropperOpenOptions, UseEyeDropperOpenReturnType, UseFavicon, UseFetchEventSource, UseFetchEventSourceAutoReconnectOptions, UseFetchEventSourceMessage, UseFetchEventSourceOptions, UseFetchEventSourceReturn, UseFetchEventSourceStatus, UseFileDialog, UseFileDialogOptions, UseFirstMountState, UseFocus, UseFps, UseFpsOptions, UseFullScreenOptions, UseFullscreen, UseGeolocation, UseHover, UseIdle, UseInfiniteScroll, UseInfiniteScrollArrivedState, UseInfiniteScrollDirection, UseInfiniteScrollLoadMore, UseInfiniteScrollOptions, UseIntersectionObserver, UseInterval, UseIntervalOptions, UseKeyModifier, UseLatest, UseLocalStorage, UseLocalStorageOptions, UseLocalStorageSerializer, UseLocationSelector, UseLongPress, UseLongPressOptions, UseMap, UseMeasure, UseMeasureRect, UseMediaDeviceOptions, UseMediaDevices, UseMediaQuery, UseMergedRef, UseMobileLandscape, UseModifierOptions, UseMount, UseMountedState, UseMouse, UseMouseCursorState, UseMousePressed, UseMousePressedOptions, UseMousePressedSourceType, UseMutationObserver, UseNetwork, UseObjectUrl, UseOnline, UseOrientation, UseOrientationLockType, UseOrientationState, UseOrientationType, UsePageLeave, UsePermission, UsePermissionDescriptorNamePolyfill, UsePermissionGeneralPermissionDescriptor, UsePermissionState, UsePlatform, UsePlatformProps, UsePlatformReturn, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePrevious, UseRafFn, UseRafState, UseReducedMotion, UseResizeObserver, UseScreenSafeArea, UseScriptTag, UseScriptTagOptions, UseScriptTagStatus, UseScroll, UseScrollArrivedState, UseScrollDirection, UseScrollIntoView, UseScrollIntoViewAnimation, UseScrollIntoViewParams, UseScrollLock, UseScrollOffset, UseScrollOptions, UseSessionStorage, UseSessionStorageOptions, UseSessionStorageSerializer, UseSetState, UseSticky, UseStickyParams, UseSupported, UseTextDirection, UseTextDirectionOptions, UseTextDirectionValue, UseTextSelection, UseThrottle, UseThrottleFn, UseTimeout, UseTimeoutFn, UseTimeoutFnOptions, UseTimeoutOptions, UseTitle, UseToggle, UseUnmount, UseUpdate, UseWebNotification, UseWebNotificationReturn, UseWebNotificationShow, UseWindowScroll, UseWindowScrollState, UseWindowSize, UseWindowsFocus };
3905
+ export { assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBoolean, useBroadcastChannel, useClickOutside as useClickAway, useClickOutside, useClipboard, useColorMode, useControlled, useCookie, useClipboard as useCopyToClipboard, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMap, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSpeechRecognition, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
3906
+ export type { ColorScheme, Contrast, DepsEqualFnType, EventSourceStatus, EventType, INetworkInformation, IUseNetworkState, KeyModifier, Pausable, Platform, PossibleRef, Use, UseActiveElement, UseAsyncEffect, UseBoolean, UseBroadcastChannel, UseBroadcastChannelOptions, UseBroadcastChannelReturn, UseClickOutside, UseClipboard, UseColorMode, UseColorModeOptions, UseControlled, UseCookie, UseCookieState, UseCountDown, UseCounter, UseCssVar, UseCssVarOptions, UseCustomCompareEffect, UseCycleList, UseDarkMode, UseDarkOptions, UseDebounce, UseDebounceFn, UseDeepCompareEffect, UseDevicePixelRatio, UseDevicePixelRatioReturn, UseDisclosure, UseDisclosureProps, UseDocumentVisibility, UseDoubleClick, UseDoubleClickProps, UseDraggable, UseDraggableOptions, UseDropZone, UseElementBounding, UseElementBoundingOptions, UseElementBoundingReturn, UseElementByPoint, UseElementByPointOptions, UseElementByPointReturn, UseElementSize, UseElementVisibility, UseEvent, UseEventEmitter, UseEventEmitterDisposable, UseEventEmitterEvent, UseEventEmitterEventOnce, UseEventEmitterListener, UseEventEmitterReturn, UseEventListener, UseEventSource, UseEventSourceAutoReconnectOptions, UseEventSourceOptions, UseEventSourceReturn, UseEyeDropper, UseEyeDropperOpenOptions, UseEyeDropperOpenReturnType, UseFavicon, UseFetchEventSource, UseFetchEventSourceAutoReconnectOptions, UseFetchEventSourceMessage, UseFetchEventSourceOptions, UseFetchEventSourceReturn, UseFetchEventSourceStatus, UseFileDialog, UseFileDialogOptions, UseFirstMountState, UseFocus, UseFps, UseFpsOptions, UseFullScreenOptions, UseFullscreen, UseGeolocation, UseHover, UseIdle, UseInfiniteScroll, UseInfiniteScrollArrivedState, UseInfiniteScrollDirection, UseInfiniteScrollLoadMore, UseInfiniteScrollOptions, UseIntersectionObserver, UseInterval, UseIntervalOptions, UseKeyModifier, UseLatest, UseLocalStorage, UseLocalStorageOptions, UseLocalStorageSerializer, UseLocationSelector, UseLongPress, UseLongPressOptions, UseMap, UseMeasure, UseMeasureRect, UseMediaDeviceOptions, UseMediaDevices, UseMediaQuery, UseMergedRef, UseMobileLandscape, UseModifierOptions, UseMount, UseMountedState, UseMouse, UseMouseCursorState, UseMousePressed, UseMousePressedOptions, UseMousePressedSourceType, UseMutationObserver, UseNetwork, UseObjectUrl, UseOnline, UseOrientation, UseOrientationLockType, UseOrientationState, UseOrientationType, UsePageLeave, UsePermission, UsePermissionDescriptorNamePolyfill, UsePermissionGeneralPermissionDescriptor, UsePermissionState, UsePlatform, UsePlatformProps, UsePlatformReturn, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePrevious, UseRafFn, UseRafState, UseReducedMotion, UseResizeObserver, UseScreenSafeArea, UseScriptTag, UseScriptTagOptions, UseScriptTagStatus, UseScroll, UseScrollArrivedState, UseScrollDirection, UseScrollIntoView, UseScrollIntoViewAnimation, UseScrollIntoViewParams, UseScrollLock, UseScrollOffset, UseScrollOptions, UseSessionStorage, UseSessionStorageOptions, UseSessionStorageSerializer, UseSetState, UseSpeechRecognition, UseSpeechRecognitionOptions, UseSpeechRecognitionReturn, UseSticky, UseStickyParams, UseSupported, UseTextDirection, UseTextDirectionOptions, UseTextDirectionValue, UseTextSelection, UseThrottle, UseThrottleFn, UseTimeout, UseTimeoutFn, UseTimeoutFnOptions, UseTimeoutOptions, UseTitle, UseToggle, UseUnmount, UseUpdate, UseWebNotification, UseWebNotificationReturn, UseWebNotificationShow, UseWindowScroll, UseWindowScrollState, UseWindowSize, UseWindowsFocus };
package/dist/index.d.ts CHANGED
@@ -3326,6 +3326,175 @@ type UseColorMode<T extends string = string> = (options: UseColorModeOptions<T>)
3326
3326
 
3327
3327
  declare const useColorMode: UseColorMode;
3328
3328
 
3329
+ interface SpeechRecognitionErrorEvent extends Event {
3330
+ readonly error: string;
3331
+ readonly message: string;
3332
+ }
3333
+ interface SpeechRecognitionEvent extends Event {
3334
+ readonly resultIndex: number;
3335
+ readonly results: SpeechRecognitionResultList;
3336
+ }
3337
+ interface SpeechRecognitionResult {
3338
+ readonly isFinal: boolean;
3339
+ readonly length: number;
3340
+ item: (index: number) => SpeechRecognitionAlternative;
3341
+ [index: number]: SpeechRecognitionAlternative;
3342
+ }
3343
+ interface SpeechRecognitionAlternative {
3344
+ readonly transcript: string;
3345
+ readonly confidence: number;
3346
+ }
3347
+ interface SpeechRecognitionResultList {
3348
+ readonly length: number;
3349
+ item: (index: number) => SpeechRecognitionResult;
3350
+ [index: number]: SpeechRecognitionResult;
3351
+ }
3352
+ interface SpeechRecognition extends EventTarget {
3353
+ continuous: boolean;
3354
+ grammars: any;
3355
+ interimResults: boolean;
3356
+ lang: string;
3357
+ maxAlternatives: number;
3358
+ serviceURI: string;
3359
+ onaudioend: ((this: SpeechRecognition, ev: Event) => any) | null;
3360
+ onaudiostart: ((this: SpeechRecognition, ev: Event) => any) | null;
3361
+ onend: ((this: SpeechRecognition, ev: Event) => any) | null;
3362
+ onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null;
3363
+ onnomatch: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
3364
+ onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
3365
+ onsoundend: ((this: SpeechRecognition, ev: Event) => any) | null;
3366
+ onsoundstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3367
+ onspeechend: ((this: SpeechRecognition, ev: Event) => any) | null;
3368
+ onspeechstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3369
+ onstart: ((this: SpeechRecognition, ev: Event) => any) | null;
3370
+ abort: () => void;
3371
+ start: () => void;
3372
+ stop: () => void;
3373
+ }
3374
+ declare global {
3375
+ interface Window {
3376
+ SpeechRecognition?: new () => SpeechRecognition;
3377
+ webkitSpeechRecognition?: new () => SpeechRecognition;
3378
+ }
3379
+ }
3380
+
3381
+ /**
3382
+ * @title UseSpeechRecognitionOptions
3383
+ */
3384
+ interface UseSpeechRecognitionOptions {
3385
+ /**
3386
+ * Controls whether continuous results are returned for each recognition, or only a single result.
3387
+ *
3388
+ * @zh 控制是否为每次识别返回连续结果,或仅返回单个结果
3389
+ * @en Controls whether continuous results are returned for each recognition, or only a single result
3390
+ * @default true
3391
+ */
3392
+ continuous?: boolean;
3393
+ /**
3394
+ * Controls whether interim results should be returned (true) or not (false.) Interim results are results that are not yet final
3395
+ *
3396
+ * @zh 控制是否应返回临时结果(true)或不返回(false)。临时结果是尚未最终确定的结果
3397
+ * @en Controls whether interim results should be returned (true) or not (false.) Interim results are results that are not yet final
3398
+ * @default true
3399
+ */
3400
+ interimResults?: boolean;
3401
+ /**
3402
+ * Language for SpeechRecognition
3403
+ *
3404
+ * @zh 语音识别的语言
3405
+ * @en Language for SpeechRecognition
3406
+ * @default 'en-US'
3407
+ */
3408
+ lang?: string;
3409
+ /**
3410
+ * A number representing the maximum returned alternatives for each result.
3411
+ *
3412
+ * @zh 表示每个结果返回的最大备选项数量的数字
3413
+ * @en A number representing the maximum returned alternatives for each result
3414
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition/maxAlternatives
3415
+ * @default 1
3416
+ */
3417
+ maxAlternatives?: number;
3418
+ }
3419
+ /**
3420
+ * @title useSpeechRecognition
3421
+ * @returns 包含以下元素的对象:
3422
+ * - 是否支持语音识别。
3423
+ * - 是否正在监听。
3424
+ * - 识别结果是否为最终结果。
3425
+ * - SpeechRecognition 实例。
3426
+ * - 识别结果文本。
3427
+ * - 错误信息。
3428
+ * - 切换监听状态的函数。
3429
+ * - 开始监听的函数。
3430
+ * - 停止监听的函数。
3431
+ * @returns_en A object with the following elements:
3432
+ * - Whether speech recognition is supported.
3433
+ * - Whether currently listening.
3434
+ * - Whether the recognition result is final.
3435
+ * - SpeechRecognition instance.
3436
+ * - Recognition result text.
3437
+ * - Error information.
3438
+ * - Function to toggle listening state.
3439
+ * - Function to start listening.
3440
+ * - Function to stop listening.
3441
+ */
3442
+ type UseSpeechRecognition = (
3443
+ /**
3444
+ * @zh 可选的语音识别配置参数
3445
+ * @en Optional speech recognition configuration options
3446
+ */
3447
+ options?: UseSpeechRecognitionOptions) => {
3448
+ /**
3449
+ * @zh 浏览器是否支持语音识别
3450
+ * @en Whether the browser supports speech recognition
3451
+ */
3452
+ readonly isSupported: boolean;
3453
+ /**
3454
+ * @zh 是否正在监听
3455
+ * @en Whether currently listening
3456
+ */
3457
+ readonly isListening: boolean;
3458
+ /**
3459
+ * @zh 识别结果是否为最终结果
3460
+ * @en Whether the recognition result is final
3461
+ */
3462
+ readonly isFinal: boolean;
3463
+ /**
3464
+ * @zh SpeechRecognition 实例
3465
+ * @en SpeechRecognition instance
3466
+ */
3467
+ readonly recognition: SpeechRecognition | undefined;
3468
+ /**
3469
+ * @zh 识别结果文本
3470
+ * @en Recognition result text
3471
+ */
3472
+ readonly result: string;
3473
+ /**
3474
+ * @zh 错误信息
3475
+ * @en Error information
3476
+ */
3477
+ readonly error: SpeechRecognitionErrorEvent | undefined;
3478
+ /**
3479
+ * @zh 切换监听状态
3480
+ * @en Toggle listening state
3481
+ */
3482
+ readonly toggle: (value?: boolean, startOptions?: Partial<UseSpeechRecognitionOptions>) => void;
3483
+ /**
3484
+ * @zh 开始监听
3485
+ * @en Start listening
3486
+ */
3487
+ readonly start: (startOptions?: Partial<UseSpeechRecognitionOptions>) => void;
3488
+ /**
3489
+ * @zh 停止监听
3490
+ * @en Stop listening
3491
+ */
3492
+ readonly stop: () => void;
3493
+ };
3494
+ type UseSpeechRecognitionReturn = ReturnType<UseSpeechRecognition>;
3495
+
3496
+ declare const useSpeechRecognition: UseSpeechRecognition;
3497
+
3329
3498
  /**
3330
3499
  * @title useDocumentVisiblity
3331
3500
  * @returns_en document visibility
@@ -3733,5 +3902,5 @@ type Use = <T>(
3733
3902
  */
3734
3903
  usable: Usable<T>) => T;
3735
3904
 
3736
- export { assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBoolean, useBroadcastChannel, useClickOutside as useClickAway, useClickOutside, useClipboard, useColorMode, useControlled, useCookie, useClipboard as useCopyToClipboard, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMap, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, 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, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
3737
- export type { ColorScheme, Contrast, DepsEqualFnType, EventSourceStatus, EventType, INetworkInformation, IUseNetworkState, KeyModifier, Pausable, Platform, PossibleRef, Use, UseActiveElement, UseAsyncEffect, UseBoolean, UseBroadcastChannel, UseBroadcastChannelOptions, UseBroadcastChannelReturn, UseClickOutside, UseClipboard, UseColorMode, UseColorModeOptions, UseControlled, UseCookie, UseCookieState, UseCountDown, UseCounter, UseCssVar, UseCssVarOptions, UseCustomCompareEffect, UseCycleList, UseDarkMode, UseDarkOptions, UseDebounce, UseDebounceFn, UseDeepCompareEffect, UseDevicePixelRatio, UseDevicePixelRatioReturn, UseDisclosure, UseDisclosureProps, UseDocumentVisibility, UseDoubleClick, UseDoubleClickProps, UseDraggable, UseDraggableOptions, UseDropZone, UseElementBounding, UseElementBoundingOptions, UseElementBoundingReturn, UseElementByPoint, UseElementByPointOptions, UseElementByPointReturn, UseElementSize, UseElementVisibility, UseEvent, UseEventEmitter, UseEventEmitterDisposable, UseEventEmitterEvent, UseEventEmitterEventOnce, UseEventEmitterListener, UseEventEmitterReturn, UseEventListener, UseEventSource, UseEventSourceAutoReconnectOptions, UseEventSourceOptions, UseEventSourceReturn, UseEyeDropper, UseEyeDropperOpenOptions, UseEyeDropperOpenReturnType, UseFavicon, UseFetchEventSource, UseFetchEventSourceAutoReconnectOptions, UseFetchEventSourceMessage, UseFetchEventSourceOptions, UseFetchEventSourceReturn, UseFetchEventSourceStatus, UseFileDialog, UseFileDialogOptions, UseFirstMountState, UseFocus, UseFps, UseFpsOptions, UseFullScreenOptions, UseFullscreen, UseGeolocation, UseHover, UseIdle, UseInfiniteScroll, UseInfiniteScrollArrivedState, UseInfiniteScrollDirection, UseInfiniteScrollLoadMore, UseInfiniteScrollOptions, UseIntersectionObserver, UseInterval, UseIntervalOptions, UseKeyModifier, UseLatest, UseLocalStorage, UseLocalStorageOptions, UseLocalStorageSerializer, UseLocationSelector, UseLongPress, UseLongPressOptions, UseMap, UseMeasure, UseMeasureRect, UseMediaDeviceOptions, UseMediaDevices, UseMediaQuery, UseMergedRef, UseMobileLandscape, UseModifierOptions, UseMount, UseMountedState, UseMouse, UseMouseCursorState, UseMousePressed, UseMousePressedOptions, UseMousePressedSourceType, UseMutationObserver, UseNetwork, UseObjectUrl, UseOnline, UseOrientation, UseOrientationLockType, UseOrientationState, UseOrientationType, UsePageLeave, UsePermission, UsePermissionDescriptorNamePolyfill, UsePermissionGeneralPermissionDescriptor, UsePermissionState, UsePlatform, UsePlatformProps, UsePlatformReturn, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePrevious, UseRafFn, UseRafState, UseReducedMotion, UseResizeObserver, UseScreenSafeArea, UseScriptTag, UseScriptTagOptions, UseScriptTagStatus, UseScroll, UseScrollArrivedState, UseScrollDirection, UseScrollIntoView, UseScrollIntoViewAnimation, UseScrollIntoViewParams, UseScrollLock, UseScrollOffset, UseScrollOptions, UseSessionStorage, UseSessionStorageOptions, UseSessionStorageSerializer, UseSetState, UseSticky, UseStickyParams, UseSupported, UseTextDirection, UseTextDirectionOptions, UseTextDirectionValue, UseTextSelection, UseThrottle, UseThrottleFn, UseTimeout, UseTimeoutFn, UseTimeoutFnOptions, UseTimeoutOptions, UseTitle, UseToggle, UseUnmount, UseUpdate, UseWebNotification, UseWebNotificationReturn, UseWebNotificationShow, UseWindowScroll, UseWindowScrollState, UseWindowSize, UseWindowsFocus };
3905
+ export { assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBoolean, useBroadcastChannel, useClickOutside as useClickAway, useClickOutside, useClipboard, useColorMode, useControlled, useCookie, useClipboard as useCopyToClipboard, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMap, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSpeechRecognition, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
3906
+ export type { ColorScheme, Contrast, DepsEqualFnType, EventSourceStatus, EventType, INetworkInformation, IUseNetworkState, KeyModifier, Pausable, Platform, PossibleRef, Use, UseActiveElement, UseAsyncEffect, UseBoolean, UseBroadcastChannel, UseBroadcastChannelOptions, UseBroadcastChannelReturn, UseClickOutside, UseClipboard, UseColorMode, UseColorModeOptions, UseControlled, UseCookie, UseCookieState, UseCountDown, UseCounter, UseCssVar, UseCssVarOptions, UseCustomCompareEffect, UseCycleList, UseDarkMode, UseDarkOptions, UseDebounce, UseDebounceFn, UseDeepCompareEffect, UseDevicePixelRatio, UseDevicePixelRatioReturn, UseDisclosure, UseDisclosureProps, UseDocumentVisibility, UseDoubleClick, UseDoubleClickProps, UseDraggable, UseDraggableOptions, UseDropZone, UseElementBounding, UseElementBoundingOptions, UseElementBoundingReturn, UseElementByPoint, UseElementByPointOptions, UseElementByPointReturn, UseElementSize, UseElementVisibility, UseEvent, UseEventEmitter, UseEventEmitterDisposable, UseEventEmitterEvent, UseEventEmitterEventOnce, UseEventEmitterListener, UseEventEmitterReturn, UseEventListener, UseEventSource, UseEventSourceAutoReconnectOptions, UseEventSourceOptions, UseEventSourceReturn, UseEyeDropper, UseEyeDropperOpenOptions, UseEyeDropperOpenReturnType, UseFavicon, UseFetchEventSource, UseFetchEventSourceAutoReconnectOptions, UseFetchEventSourceMessage, UseFetchEventSourceOptions, UseFetchEventSourceReturn, UseFetchEventSourceStatus, UseFileDialog, UseFileDialogOptions, UseFirstMountState, UseFocus, UseFps, UseFpsOptions, UseFullScreenOptions, UseFullscreen, UseGeolocation, UseHover, UseIdle, UseInfiniteScroll, UseInfiniteScrollArrivedState, UseInfiniteScrollDirection, UseInfiniteScrollLoadMore, UseInfiniteScrollOptions, UseIntersectionObserver, UseInterval, UseIntervalOptions, UseKeyModifier, UseLatest, UseLocalStorage, UseLocalStorageOptions, UseLocalStorageSerializer, UseLocationSelector, UseLongPress, UseLongPressOptions, UseMap, UseMeasure, UseMeasureRect, UseMediaDeviceOptions, UseMediaDevices, UseMediaQuery, UseMergedRef, UseMobileLandscape, UseModifierOptions, UseMount, UseMountedState, UseMouse, UseMouseCursorState, UseMousePressed, UseMousePressedOptions, UseMousePressedSourceType, UseMutationObserver, UseNetwork, UseObjectUrl, UseOnline, UseOrientation, UseOrientationLockType, UseOrientationState, UseOrientationType, UsePageLeave, UsePermission, UsePermissionDescriptorNamePolyfill, UsePermissionGeneralPermissionDescriptor, UsePermissionState, UsePlatform, UsePlatformProps, UsePlatformReturn, UsePreferredColorScheme, UsePreferredContrast, UsePreferredDark, UsePreferredLanguages, UsePrevious, UseRafFn, UseRafState, UseReducedMotion, UseResizeObserver, UseScreenSafeArea, UseScriptTag, UseScriptTagOptions, UseScriptTagStatus, UseScroll, UseScrollArrivedState, UseScrollDirection, UseScrollIntoView, UseScrollIntoViewAnimation, UseScrollIntoViewParams, UseScrollLock, UseScrollOffset, UseScrollOptions, UseSessionStorage, UseSessionStorageOptions, UseSessionStorageSerializer, UseSetState, UseSpeechRecognition, UseSpeechRecognitionOptions, UseSpeechRecognitionReturn, UseSticky, UseStickyParams, UseSupported, UseTextDirection, UseTextDirectionOptions, UseTextDirectionValue, UseTextSelection, UseThrottle, UseThrottleFn, UseTimeout, UseTimeoutFn, UseTimeoutFnOptions, UseTimeoutOptions, UseTitle, UseToggle, UseUnmount, UseUpdate, UseWebNotification, UseWebNotificationReturn, UseWebNotificationShow, UseWindowScroll, UseWindowScrollState, UseWindowSize, UseWindowsFocus };
package/dist/index.mjs CHANGED
@@ -4196,4 +4196,110 @@ const useMap = (initialValue)=>{
4196
4196
  };
4197
4197
  };
4198
4198
 
4199
- export { assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBoolean, useBroadcastChannel, useClickOutside as useClickAway, useClickOutside, useClipboard, useColorMode, useControlled, useCookie, useClipboard as useCopyToClipboard, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMap, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, 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, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
4199
+ const useSpeechRecognition = (options = {})=>{
4200
+ const { interimResults = true, continuous = true, maxAlternatives = 1, lang = 'en-US' } = options;
4201
+ const [isListening, setIsListening] = useState(false);
4202
+ const [isFinal, setIsFinal] = useState(false);
4203
+ const [result, setResult] = useState('');
4204
+ const [error, setError] = useState(undefined);
4205
+ const recognitionRef = useRef(undefined);
4206
+ const SpeechRecognitionClass = defaultWindow && (defaultWindow.SpeechRecognition || defaultWindow.webkitSpeechRecognition);
4207
+ const isSupported = useSupported(()=>SpeechRecognitionClass);
4208
+ const start = useEvent((startOptions)=>{
4209
+ if (!recognitionRef.current) {
4210
+ return;
4211
+ }
4212
+ // Apply options to recognition instance
4213
+ const { interimResults: newInterimResults = interimResults, continuous: newContinuous = continuous, maxAlternatives: newMaxAlternatives = maxAlternatives, lang: newLang = lang } = startOptions || {};
4214
+ recognitionRef.current.interimResults = newInterimResults;
4215
+ recognitionRef.current.continuous = newContinuous;
4216
+ recognitionRef.current.maxAlternatives = newMaxAlternatives;
4217
+ recognitionRef.current.lang = newLang;
4218
+ setIsListening(true);
4219
+ });
4220
+ const stop = useEvent(()=>{
4221
+ setIsListening(false);
4222
+ });
4223
+ const toggle = useEvent((value = !isListening, startOptions)=>{
4224
+ if (value) {
4225
+ start(startOptions);
4226
+ } else {
4227
+ stop();
4228
+ }
4229
+ });
4230
+ // Initialize recognition when supported
4231
+ useEffect(()=>{
4232
+ if (!isSupported || !SpeechRecognitionClass) {
4233
+ return;
4234
+ }
4235
+ const recognition = new SpeechRecognitionClass();
4236
+ recognitionRef.current = recognition;
4237
+ // Set up event listeners
4238
+ recognition.onstart = ()=>{
4239
+ setIsListening(true);
4240
+ setIsFinal(false);
4241
+ };
4242
+ recognition.onresult = (event)=>{
4243
+ const currentResult = event.results[event.resultIndex];
4244
+ const { transcript } = currentResult[0];
4245
+ setIsFinal(currentResult.isFinal);
4246
+ setResult(transcript);
4247
+ setError(undefined);
4248
+ };
4249
+ recognition.onerror = (event)=>{
4250
+ setError(event);
4251
+ };
4252
+ recognition.onend = ()=>{
4253
+ setIsListening(false);
4254
+ };
4255
+ return ()=>{
4256
+ if (recognition) {
4257
+ recognition.abort();
4258
+ }
4259
+ };
4260
+ }, [
4261
+ isSupported,
4262
+ SpeechRecognitionClass
4263
+ ]);
4264
+ // Handle listening state changes
4265
+ useEffect(()=>{
4266
+ if (!recognitionRef.current) {
4267
+ return;
4268
+ }
4269
+ if (isListening) {
4270
+ try {
4271
+ recognitionRef.current.start();
4272
+ } catch (err) {
4273
+ console.warn('Failed to start speech recognition:', err);
4274
+ setIsListening(false);
4275
+ }
4276
+ } else {
4277
+ try {
4278
+ recognitionRef.current.stop();
4279
+ } catch (err) {
4280
+ console.warn('Failed to stop speech recognition:', err);
4281
+ }
4282
+ }
4283
+ }, [
4284
+ isListening
4285
+ ]);
4286
+ // Cleanup on unmount
4287
+ useUnmount(()=>{
4288
+ if (recognitionRef.current) {
4289
+ recognitionRef.current.abort();
4290
+ }
4291
+ });
4292
+ return {
4293
+ isSupported,
4294
+ isListening,
4295
+ isFinal,
4296
+ recognition: recognitionRef.current,
4297
+ result,
4298
+ error,
4299
+ toggle,
4300
+ start,
4301
+ stop
4302
+ };
4303
+ };
4304
+
4305
+ export { assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBoolean, useBroadcastChannel, useClickOutside as useClickAway, useClickOutside, useClipboard, useColorMode, useControlled, useCookie, useClipboard as useCopyToClipboard, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMap, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSpeechRecognition, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactuses/core",
3
- "version": "6.1.0-beta.1",
3
+ "version": "6.1.1",
4
4
  "license": "Unlicense",
5
5
  "homepage": "https://www.reactuse.com/",
6
6
  "repository": {