@lantun/core 0.1.2 → 0.1.3
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 +5 -5
- package/dist/highlight/highlight.js +4 -0
- package/dist/highlight/highlight.types.d.ts +1 -0
- package/dist/index.js +0 -1
- package/dist/lib/emitter.d.ts +0 -1
- package/dist/lib/emitter.js +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Lantun adds a small dock to your page. Readers press play and hear the article w
|
|
|
6
6
|
|
|
7
7
|
**[Try the live demo →](https://lantun.rzknkbr.xyz)** Open any sample article and press play.
|
|
8
8
|
|
|
9
|
-
<img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.
|
|
9
|
+
<img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/playing-dark.png" alt="Lantun reading an article aloud, highlighting the current sentence and word">
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
@@ -82,16 +82,16 @@ Turn on debug logs with `localStorage.setItem("lantun:debug", "1")`.
|
|
|
82
82
|
|
|
83
83
|
<table>
|
|
84
84
|
<tr>
|
|
85
|
-
<td width="50%"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.
|
|
86
|
-
<td width="50%"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.
|
|
85
|
+
<td width="50%"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/dock-dark.png" alt="The idle dock on the right edge, its play button showing a one-minute listening time"></td>
|
|
86
|
+
<td width="50%"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/voice-dark.png" alt="The voice picker with lifelike and built-in voices"></td>
|
|
87
87
|
</tr>
|
|
88
88
|
<tr>
|
|
89
89
|
<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>
|
|
90
90
|
<td><b>Lifelike voices.</b> Natural English voices made on the reader's device, downloaded once and only when chosen.</td>
|
|
91
91
|
</tr>
|
|
92
92
|
<tr>
|
|
93
|
-
<td><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.
|
|
94
|
-
<td align="center"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.
|
|
93
|
+
<td><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/docs/screenshots/accessibility-dark.png" alt="The reading aids panel with the Dyslexia profile on"></td>
|
|
94
|
+
<td align="center"><img src="https://raw.githubusercontent.com/rizkianakbar/lantun/v0.1.3/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>
|
|
95
95
|
</tr>
|
|
96
96
|
<tr>
|
|
97
97
|
<td><b>Reading aids.</b> Text size, spacing, readable and dyslexia fonts, colour modes, reading guide and mask, and more.</td>
|
|
@@ -68,7 +68,9 @@ function createOverlayPainter(doc, win, o) {
|
|
|
68
68
|
// One insertion per paint instead of one per line box.
|
|
69
69
|
shadow.append(boxes);
|
|
70
70
|
}
|
|
71
|
+
const reflow = typeof ResizeObserver === "function" ? new ResizeObserver(paint) : null;
|
|
71
72
|
win.addEventListener("resize", paint);
|
|
73
|
+
reflow?.observe(o.root);
|
|
72
74
|
return {
|
|
73
75
|
sentence(range) {
|
|
74
76
|
ranges.s = range;
|
|
@@ -80,6 +82,7 @@ function createOverlayPainter(doc, win, o) {
|
|
|
80
82
|
},
|
|
81
83
|
destroy() {
|
|
82
84
|
win.removeEventListener("resize", paint);
|
|
85
|
+
reflow?.disconnect();
|
|
83
86
|
host.remove();
|
|
84
87
|
},
|
|
85
88
|
};
|
|
@@ -92,6 +95,7 @@ export function createReadingView(o) {
|
|
|
92
95
|
const painter = createPainter(o.doc, o.win, {
|
|
93
96
|
color: resolveColor(o.color, o.doc) ?? DEFAULT_RGB,
|
|
94
97
|
background: backgroundOf(o.root),
|
|
98
|
+
root: o.root,
|
|
95
99
|
zIndex: o.zIndex,
|
|
96
100
|
nonce: o.nonce,
|
|
97
101
|
});
|
package/dist/index.js
CHANGED
package/dist/lib/emitter.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ type Handler = (payload: unknown) => void;
|
|
|
2
2
|
export interface Emitter<E extends string> {
|
|
3
3
|
on(event: E, handler: Handler): () => void;
|
|
4
4
|
emit(event: E, payload?: unknown): void;
|
|
5
|
-
clear(): void;
|
|
6
5
|
}
|
|
7
6
|
export declare function createEmitter<E extends string>(): Emitter<E>;
|
|
8
7
|
export {};
|
package/dist/lib/emitter.js
CHANGED
package/package.json
CHANGED