@lantun/react 0.1.0 → 0.1.2

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
@@ -1,15 +1,85 @@
1
1
  # @lantun/react
2
2
 
3
- The Lantun read-aloud widget as a React component.
3
+ **A read-aloud widget for React: text-to-speech with sentence and word highlighting, plus reading aids for low vision, dyslexia and ADHD.**
4
+
5
+ Drop `<LantunWidget />` on an article page. Readers get a small dock: press play to hear the article as it highlights along, or open the reading aids for text size, spacing, a dyslexia font, colour modes and more. It runs entirely in the browser, with no backend or account.
6
+
7
+ **[Try the live demo →](https://lantun.rzknkbr.xyz)** Open any sample article and press play.
8
+
9
+ <img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.2/docs/screenshots/playing-dark.png" alt="Lantun reading an article aloud, highlighting the current sentence and word">
10
+
11
+ ## Install
4
12
 
5
13
  ```sh
6
- npm install @lantun/react
14
+ npm install @lantun/react @lantun/voice-kitten
7
15
  ```
8
16
 
17
+ Requires React 17 or later. `@lantun/voice-kitten` is optional but recommended. Browser voices often sound robotic, while these natural voices run on the reader's device and download nothing until a reader picks one.
18
+
19
+ ## Usage
20
+
9
21
  ```tsx
10
- import { LantunWidget } from "@lantun/react";
22
+ import { LantunWidget, registerVoices } from "@lantun/react";
23
+ import { kittenVoices } from "@lantun/voice-kitten";
24
+
25
+ registerVoices(kittenVoices());
11
26
 
12
- <LantunWidget contentSelector="article" color="#7c3aed" />;
27
+ export function ArticlePage() {
28
+ return (
29
+ <>
30
+ <article>…</article>
31
+ <LantunWidget contentSelector="article" color="#7c3aed" />
32
+ </>
33
+ );
34
+ }
13
35
  ```
14
36
 
15
- Options, API and screenshots: [github.com/rizkianakbar/lantun](https://github.com/rizkianakbar/lantun#readme)
37
+ `<LantunWidget />` renders nothing in your tree. It starts the widget on mount, restarts it only when its props change, and removes it on unmount. It is safe under `StrictMode`. Render one per page.
38
+
39
+ ## Props
40
+
41
+ All props are optional.
42
+
43
+ | Prop | Default | What it does |
44
+ | ------------------ | --------------------------- | ------------------------------------------------------- |
45
+ | `contentSelector` | auto-detected | Where the article body is. |
46
+ | `excludeSelectors` | `[]` | Selectors that are never read aloud. |
47
+ | `position` | `"right"` | Dock side: `"right"` or `"left"`. |
48
+ | `color` | `"#f5b841"` | Highlight and accent colour; any CSS colour. |
49
+ | `lang` | `<html lang>`, then `en` | Article language; picks the voices and the UI language. |
50
+ | `features` | `{ tts: true, a11y: true }` | Turn listening or reading aids off. |
51
+ | `zIndex` | `2147483000` | Stacking order of the dock. |
52
+ | `nonce` | none | CSP nonce for Lantun's `<style>` elements. |
53
+
54
+ To skip one element without a selector, add `data-reader-skip` to it.
55
+
56
+ Need `play()`, `pause()` or events such as `on("end", …)`? Import them from [`@lantun/core`](https://www.npmjs.com/package/@lantun/core), which this package installs for you.
57
+
58
+ ## A closer look
59
+
60
+ <table>
61
+ <tr>
62
+ <td width="50%"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.2/docs/screenshots/dock-dark.png" alt="The idle dock on the right edge, its play button showing a one-minute listening time"></td>
63
+ <td width="50%"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.2/docs/screenshots/voice-dark.png" alt="The voice picker with lifelike and built-in voices"></td>
64
+ </tr>
65
+ <tr>
66
+ <td><b>Quiet until needed.</b> A slim dock shows how long the article takes to hear. Drag it to any edge, or tuck it away.</td>
67
+ <td><b>Lifelike voices.</b> Natural English voices made on the reader's device, downloaded once and only when chosen.</td>
68
+ </tr>
69
+ <tr>
70
+ <td><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.2/docs/screenshots/accessibility-dark.png" alt="The reading aids panel with the Dyslexia profile on"></td>
71
+ <td align="center"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.2/docs/screenshots/mobile-dark.png" width="240" alt="Lantun on a phone, the dock lying flat along the bottom while the headline is read aloud"></td>
72
+ </tr>
73
+ <tr>
74
+ <td><b>Reading aids.</b> Text size, spacing, readable and dyslexia fonts, colour modes, reading guide and mask, and more.</td>
75
+ <td><b>On phones.</b> The dock lies flat along the bottom, in thumb reach.</td>
76
+ </tr>
77
+ </table>
78
+
79
+ ## Links
80
+
81
+ - [Live demo](https://lantun.rzknkbr.xyz)
82
+ - [GitHub](https://github.com/rizkianakbar/lantun) (full docs and screenshots)
83
+ - [Issues](https://github.com/rizkianakbar/lantun/issues)
84
+
85
+ MIT licensed.
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { destroy, init } from "@lantun/core";
2
3
  import { useEffect } from "react";
3
4
  export { registerVoices } from "@lantun/core";
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "@lantun/react",
3
- "version": "0.1.0",
4
- "description": "React component for Lantun: read articles aloud with highlighting and reading aids.",
3
+ "version": "0.1.2",
4
+ "description": "Read-aloud widget for React and Next.js: text-to-speech with sentence and word highlighting, plus reading aids for low vision, dyslexia and ADHD.",
5
5
  "keywords": [
6
6
  "react",
7
+ "nextjs",
7
8
  "text-to-speech",
9
+ "tts",
8
10
  "read-aloud",
9
11
  "accessibility",
12
+ "a11y",
13
+ "dyslexia",
10
14
  "lantun"
11
15
  ],
12
16
  "license": "MIT",
13
17
  "author": "rizkianakbar",
14
- "homepage": "https://github.com/rizkianakbar/lantun#readme",
18
+ "homepage": "https://lantun.rzknkbr.xyz",
15
19
  "repository": {
16
20
  "type": "git",
17
21
  "url": "git+https://github.com/rizkianakbar/lantun.git",
@@ -33,7 +37,7 @@
33
37
  "access": "public"
34
38
  },
35
39
  "dependencies": {
36
- "@lantun/core": "^0.1.0"
40
+ "@lantun/core": "^0.1.2"
37
41
  },
38
42
  "peerDependencies": {
39
43
  "react": ">=17"