Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tts-react

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tts-react - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

dist/umd/tts-react.min.js

0

dist/component.d.ts

@@ -0,0 +0,0 @@ /// <reference types="react" />

3

dist/component.js

@@ -1,2 +0,3 @@

import { useMemo, useCallback } from 'react';
// No umd build for react/jsx-runtime @see https://github.com/facebook/react/issues/20923
import React, { useMemo, useCallback } from 'react';
import { useTts } from './hook';

@@ -3,0 +4,0 @@ import { iconSizes, Sizes } from './icons';

@@ -0,0 +0,0 @@ import type { MouseEventHandler } from 'react';

@@ -1,2 +0,2 @@

import { useMemo, useEffect } from 'react';
import React, { useMemo, useEffect } from 'react';
import { Sizes, icons, iconSizes } from './icons';

@@ -3,0 +3,0 @@ import { jsx as _jsx } from "react/jsx-runtime";

@@ -0,0 +0,0 @@ declare enum Events {

@@ -90,4 +90,2 @@ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }

constructor(options) {
var _options$lang, _options$dispatchBoun;
super();

@@ -179,3 +177,3 @@

_classPrivateFieldSet(this, _lang, (_options$lang = options === null || options === void 0 ? void 0 : options.lang) !== null && _options$lang !== void 0 ? _options$lang : _classPrivateFieldGet(this, _lang));
_classPrivateFieldSet(this, _lang, (options === null || options === void 0 ? void 0 : options.lang) ?? _classPrivateFieldGet(this, _lang));

@@ -186,3 +184,3 @@ _classPrivateFieldSet(this, _synthesizer, window.speechSynthesis);

_classPrivateFieldSet(this, _dispatchBoundaries, (_options$dispatchBoun = options === null || options === void 0 ? void 0 : options.dispatchBoundaries) !== null && _options$dispatchBoun !== void 0 ? _options$dispatchBoun : _classPrivateFieldGet(this, _dispatchBoundaries));
_classPrivateFieldSet(this, _dispatchBoundaries, (options === null || options === void 0 ? void 0 : options.dispatchBoundaries) ?? _classPrivateFieldGet(this, _dispatchBoundaries));

@@ -413,3 +411,3 @@ if (options !== null && options !== void 0 && options.fetchAudioData) {

unmute(volume) {
this.volume = volume !== null && volume !== void 0 ? volume : 1;
this.volume = volume ?? 1;
/**

@@ -435,6 +433,4 @@ * Same as muting, for SpeechSynthesis have to replay to activate the volume change instantly.

if (_classPrivateFieldGet(this, _lang)) {
var _voices$;
voices = voices.filter(voice => voice.lang === _classPrivateFieldGet(this, _lang));
_classPrivateFieldGet(this, _target).voice = (_voices$ = voices[0]) !== null && _voices$ !== void 0 ? _voices$ : null;
_classPrivateFieldGet(this, _target).voice = voices[0] ?? null;

@@ -462,7 +458,5 @@ if (voice && voice.lang === _classPrivateFieldGet(this, _lang)) {

if ((_data = data) !== null && _data !== void 0 && _data.audio) {
var _data$marks;
_classPrivateFieldGet(this, _synthesizer).src = data.audio;
_classPrivateFieldSet(this, _marks, (_data$marks = data.marks) !== null && _data$marks !== void 0 ? _data$marks : _classPrivateFieldGet(this, _marks));
_classPrivateFieldSet(this, _marks, data.marks ?? _classPrivateFieldGet(this, _marks));
}

@@ -613,8 +607,8 @@ }

_classPrivateFieldGet(this, _target).addEventListener('boundary', evt => {
var _evt$charLength;
const {
charIndex: startChar
} = evt;
const charLength = (_evt$charLength = evt.charLength) !== null && _evt$charLength !== void 0 ? _evt$charLength : _classPrivateMethodGet(this, _getBoundaryWordCharLength, _getBoundaryWordCharLength2).call(this, startChar);
const charLength = evt.charLength ?? _classPrivateMethodGet(this, _getBoundaryWordCharLength, _getBoundaryWordCharLength2).call(this, startChar);
const endChar = startChar + charLength;

@@ -621,0 +615,0 @@

@@ -0,0 +0,0 @@ /// <reference types="react" />

@@ -1,2 +0,2 @@

import { useMemo } from 'react';
import React, { useMemo } from 'react';
import { jsx as _jsx } from "react/jsx-runtime";

@@ -3,0 +3,0 @@ import { Fragment as _Fragment } from "react/jsx-runtime";

@@ -0,0 +0,0 @@ import type { ReactNode } from 'react';

@@ -1,2 +0,2 @@

import { useRef, useMemo, useReducer, useCallback, useEffect, Children, cloneElement, isValidElement } from 'react';
import React, { useRef, useMemo, useReducer, useCallback, useEffect, Children, cloneElement, isValidElement } from 'react';
import { Controller, Events } from './controller';

@@ -155,3 +155,3 @@ import { isStringOrNumber, stripPunctuation } from './utils';

const useTts = _ref2 => {
var _window$speechSynthes, _window$speechSynthes2;
var _window$speechSynthes;

@@ -180,3 +180,3 @@ let {

const [state, dispatch] = useReducer(reducer, {
voices: (_window$speechSynthes = (_window$speechSynthes2 = window.speechSynthesis) === null || _window$speechSynthes2 === void 0 ? void 0 : _window$speechSynthes2.getVoices()) !== null && _window$speechSynthes !== void 0 ? _window$speechSynthes : [],
voices: ((_window$speechSynthes = window.speechSynthesis) === null || _window$speechSynthes === void 0 ? void 0 : _window$speechSynthes.getVoices()) ?? [],
boundary: defaultBoundary,

@@ -439,3 +439,3 @@ isPlaying: false,

useEffect(() => {
var _window$speechSynthes3;
var _window$speechSynthes2;

@@ -449,3 +449,3 @@ const onVoicesChanged = () => {

if (typeof ((_window$speechSynthes3 = window.speechSynthesis) === null || _window$speechSynthes3 === void 0 ? void 0 : _window$speechSynthes3.addEventListener) === 'function') {
if (typeof ((_window$speechSynthes2 = window.speechSynthesis) === null || _window$speechSynthes2 === void 0 ? void 0 : _window$speechSynthes2.addEventListener) === 'function') {
window.speechSynthesis.addEventListener('voiceschanged', onVoicesChanged);

@@ -455,5 +455,5 @@ }

return () => {
var _window$speechSynthes4;
var _window$speechSynthes3;
if (typeof ((_window$speechSynthes4 = window.speechSynthesis) === null || _window$speechSynthes4 === void 0 ? void 0 : _window$speechSynthes4.removeEventListener) === 'function') {
if (typeof ((_window$speechSynthes3 = window.speechSynthesis) === null || _window$speechSynthes3 === void 0 ? void 0 : _window$speechSynthes3.removeEventListener) === 'function') {
window.speechSynthesis.removeEventListener('voiceschanged', onVoicesChanged);

@@ -460,0 +460,0 @@ }

@@ -0,0 +0,0 @@ declare enum Sizes {

@@ -0,0 +0,0 @@ export { TextToSpeech, Positions, Sizes } from './component';

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import type { ReactNode } from 'react';

{
"name": "tts-react",
"version": "1.1.0",
"version": "1.2.0",
"description": "React hook and component for converting text to speech using the Web Speech API or Amazon Polly.",

@@ -26,7 +26,9 @@ "main": "dist/index.js",

"build:js": "babel src --out-dir dist --extensions '.ts,.tsx'",
"build:storybook": "npm run build && build-storybook -o demo/build -c demo/.storybook",
"build": "npm run build:types && npm run build:js",
"build:base": "npm run build:types && npm run build:js",
"build:umd": "microbundle -i src/index.ts -o dist/umd/tts-react.min.js -f umd --no-pkg-main --name='TTSReact' --globals react='React' --jsx='' --jsxFragment='' --tsconfig='./tsconfig.umd.json'",
"build:storybook": "npm run build:base && build-storybook -o demo/build -c demo/.storybook",
"build": "npm run build:base && npm run build:umd",
"lint": "eslint . src demo --ignore-pattern dist --ext .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",
"demo": "npm run build:base && start-storybook -c demo/.storybook -p 3000",
"prepack": "npm run build"

@@ -85,2 +87,3 @@ },

"jest-environment-jsdom": "^29.0.2",
"microbundle": "^0.15.1",
"prettier": "^2.7.1",

@@ -87,0 +90,0 @@ "typescript": "4.7.4"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc