Comparing version 0.4.0 to 0.4.1
@@ -11,6 +11,11 @@ /// <reference types="react" /> | ||
interface TTSProps extends TTSHookProps { | ||
/** How the controls are aligned within the `TextToSpeech` component. */ | ||
align?: 'vertical' | 'horizontal'; | ||
/** The relative size of the controls within the `TextToSpeech` component. */ | ||
size?: SvgProps['size']; | ||
/** The relative position of the controls within the `TextToSpeech` component. */ | ||
position?: `${Positions}`; | ||
/** Whether the `TextToSpeech` component should render the audio toggling control. */ | ||
allowMuting?: boolean; | ||
/** Whether the `TextToSpeech` should render a stop control instead of pause. */ | ||
useStopOverPause?: boolean; | ||
@@ -17,0 +22,0 @@ } |
@@ -50,3 +50,2 @@ declare enum Events { | ||
protected marks: PollySpeechMark[]; | ||
protected previousVolume: number; | ||
protected locale: string; | ||
@@ -83,3 +82,3 @@ constructor(options: ControllerOptions); | ||
mute(): void; | ||
unmute(): void; | ||
unmute(volume?: number): void; | ||
resume(): void; | ||
@@ -86,0 +85,0 @@ reset(): void; |
@@ -32,4 +32,2 @@ "use strict"; | ||
_defineProperty(this, "previousVolume", 1); | ||
_defineProperty(this, "locale", ''); | ||
@@ -346,3 +344,2 @@ | ||
mute() { | ||
this.previousVolume = this.volume; | ||
this.volume = 0; | ||
@@ -363,4 +360,4 @@ /** | ||
unmute() { | ||
this.volume = this.previousVolume ?? 1; | ||
unmute(volume) { | ||
this.volume = volume ?? 1; | ||
@@ -367,0 +364,0 @@ if (!(this.synthesizer instanceof HTMLAudioElement)) { |
import type { ReactNode } from 'react'; | ||
import type { ControllerOptions, TTSBoundaryUpdate } from './controller'; | ||
interface MarkStyles { | ||
/** Text color of the currently marked word. */ | ||
markColor?: string; | ||
/** Background color of the currently marked word. */ | ||
markBackgroundColor?: string; | ||
} | ||
interface TTSHookProps extends MarkStyles { | ||
/** The spoken text is extracted from here. */ | ||
children: ReactNode; | ||
/** The `SpeechSynthesisUtterance.lang` to use. */ | ||
lang?: ControllerOptions['lang']; | ||
/** The `SpeechSynthesisUtterance.voice` to use. */ | ||
voice?: ControllerOptions['voice']; | ||
/** Whether the text should be spoken automatically, i.e. on render. */ | ||
autoPlay?: boolean; | ||
children: ReactNode; | ||
/** Whether the spoken word should be wrapped in a `<mark>` element. */ | ||
markTextAsSpoken?: boolean; | ||
onMuted?: (muted: boolean) => void; | ||
/** Callback when the volume toggle button is clicked. */ | ||
onMuted?: (wasMuted: boolean) => void; | ||
/** Callback when there is an error of any kind. */ | ||
onError?: (errorMsg: string) => void; | ||
/** Function to fetch audio and speech marks for the spoken text. */ | ||
fetchAudioData?: ControllerOptions['fetchAudioData']; | ||
voice?: ControllerOptions['voice']; | ||
} | ||
@@ -17,0 +27,0 @@ interface TTSHookState { |
{ | ||
"name": "tts-react", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "React component to convert text to speech.", | ||
@@ -22,3 +22,3 @@ "main": "dist/index.js", | ||
"lint": "eslint . src demo --ignore-pattern dist --ext .ts,.tsx", | ||
"prettier": "prettier --no-error-on-unmatched-pattern --write *.ts {src,demo}/**/*.{ts,tsx}", | ||
"prettier": "prettier --no-error-on-unmatched-pattern --write *.ts {src,demo,__tests__}/**/*.{ts,tsx}", | ||
"demo": "npm run build && start-storybook -c demo/.storybook -p 3000", | ||
@@ -59,4 +59,6 @@ "prepack": "npm run build" | ||
"@storybook/react": "^6.5.10", | ||
"@types/react": "^18.0.17", | ||
"@types/react-dom": "^18.0.6", | ||
"@testing-library/react": "^12.1.5", | ||
"@testing-library/react-hooks": "^8.0.1", | ||
"@types/react": "^17.0.49", | ||
"@types/react-dom": "^17.0.17", | ||
"@typescript-eslint/eslint-plugin": "^5.35.1", | ||
@@ -72,2 +74,3 @@ "@typescript-eslint/parser": "^5.35.1", | ||
"jest": "^29.0.2", | ||
"jest-environment-jsdom": "^29.0.2", | ||
"prettier": "^2.7.1", | ||
@@ -74,0 +77,0 @@ "typescript": "4.7.4" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49073
1336
28