Skip to content

Commit fd874e7

Browse files
authored
feat: provide fallback for no browser support, allow updating text. (#94)
1 parent b9dfb77 commit fd874e7

21 files changed

+8571
-6487
lines changed

build.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<script type="importmap">
7+
{
8+
"imports": {
9+
"react": "https://esm.sh/react",
10+
"react-dom/client": "https://esm.sh/react-dom/client",
11+
"react/jsx-runtime": "https://esm.sh/react/jsx-runtime",
12+
"tts-react": "./packages/tts-react/dist/index.js",
13+
"htm": "https://esm.sh/htm"
14+
}
15+
}
16+
</script>
17+
<title>ESM + CDN + Import Map + htm</title>
18+
</head>
19+
<body>
20+
<script type="module">
21+
import { createElement } from 'react'
22+
import { createRoot } from 'react-dom/client'
23+
import { TextToSpeech } from 'tts-react'
24+
import htm from 'htm'
25+
26+
const html = htm.bind(createElement)
27+
28+
createRoot(document.body).render(
29+
html`
30+
<${TextToSpeech} markTextAsSpoken>
31+
<p>Hello from tts-react.</p>
32+
</${TextToSpeech}>
33+
`
34+
)
35+
</script>
36+
</body>
37+
</html>

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const config = tseslint.config(
5858
}
5959
},
6060
{
61-
files: ['**/src/component.tsx', '**/src/story.tsx'],
61+
files: ['**/src/component.tsx', '**/src/story.tsx', '**/src/update.story.tsx'],
6262
rules: {
6363
/**
6464
* Allow onClick handlers for the player controls to return Promise<void>.

jest.config.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
},
2323
"modulePathIgnorePatterns": ["dist"],
2424
"resolver": "ts-jest-resolver",
25-
"setupFilesAfterEnv": ["<rootDir>/jest.setup.ts"],
26-
"testEnvironment": "jest-environment-jsdom",
25+
"setupFilesAfterEnv": ["@testing-library/jest-dom"],
26+
"testEnvironment": "jsdom",
2727
"testMatch": [
2828
"**/__tests__/**/*.ts",
2929
"**/__tests__/**/*.tsx",
30+
"!**/__tests__/**/setup.ts",
3031
"!**/__tests__/**/*.mock.ts"
3132
]
3233
}

jest.setup.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)