@beff/aula 0.1.0 → 0.2.0
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 +1 -1
- package/dist/animations.d.ts +2 -1
- package/dist/animations.js +4 -19
- package/dist/engine.d.ts +43 -9
- package/dist/engine.js +75 -35
- package/dist/generated/aula.core5.wasm +0 -0
- package/dist/generated/aula.js +4260 -2573
- package/dist/generated/interfaces/aula-engine-engine.d.ts +52 -5
- package/dist/generated/interfaces/aula-engine-types.d.ts +1 -0
- package/dist/geometry.js +17 -283
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -2
- package/dist/lexicon.d.ts +10 -0
- package/dist/lexicon.js +23 -0
- package/dist/licenses/skia-pathops-NOTICE.txt +35 -0
- package/dist/pointcloud.d.ts +2 -2
- package/dist/pointcloud.js +7 -23
- package/dist/run.d.ts +10 -5
- package/dist/run.js +18 -1
- package/dist/text.d.ts +18 -8
- package/dist/text.js +17 -11
- package/package.json +1 -1
package/dist/run.js
CHANGED
|
@@ -2,9 +2,10 @@ import { checkRows, checkTitle, drawRows, drawTitle, readRows } from "./engine.j
|
|
|
2
2
|
import { card as defaultCard } from "./card.js";
|
|
3
3
|
import { theme as defaultTheme } from "./theme.js";
|
|
4
4
|
import { AulaError } from "./errors.js";
|
|
5
|
-
import { isComponentError } from "./load.js";
|
|
5
|
+
import { engine, isComponentError } from "./load.js";
|
|
6
6
|
import { hasPending, takePending } from "./host.js";
|
|
7
7
|
import { runUserCode } from "./user-code.js";
|
|
8
|
+
import { badReadings, lexiconEntries } from "./lexicon.js";
|
|
8
9
|
export { importUserModule } from "./user-code.js";
|
|
9
10
|
export { renderScene } from "./engine.js";
|
|
10
11
|
/** Frames per second of the Lottie files: the engine's rate (`engine.fps()`, which
|
|
@@ -192,6 +193,7 @@ function slotOf(project, chapter, index, host) {
|
|
|
192
193
|
source,
|
|
193
194
|
file: host.name(source) ?? source,
|
|
194
195
|
frames: (e) => host.frames(e),
|
|
196
|
+
lexicon: lexiconEntries(project.lexicon),
|
|
195
197
|
};
|
|
196
198
|
}
|
|
197
199
|
/** Reads chapter `index` (from 1) of `project`: its text and its text problems, with no move
|
|
@@ -222,6 +224,21 @@ export function checkChapter(project, index, options = {}) {
|
|
|
222
224
|
const slot = slotOf(project, chapter, index, host);
|
|
223
225
|
return attempt(slot.source, host, () => checkRows(chapter, theme, card, slot, (p) => host.exists(p)));
|
|
224
226
|
}
|
|
227
|
+
/** The problems of the project lexicon (`defineProject({ lexicon })`), at the `defineProject`
|
|
228
|
+
* call: a key that is not one word, a reading that is not `{ say: string }` or
|
|
229
|
+
* `{ phonemes: string }`, an empty `say` reading, and a phoneme that is not in Kokoro's token
|
|
230
|
+
* table. `aula check` gives them once for the project. A chapter leaves out an entry with a
|
|
231
|
+
* problem. */
|
|
232
|
+
export function checkLexicon(project, options = {}) {
|
|
233
|
+
const host = options.host ?? NODE;
|
|
234
|
+
const frame = definedAt(project, host);
|
|
235
|
+
const location = { file: host.name(frame.file) ?? frame.file, line: frame.line, col: frame.col };
|
|
236
|
+
const shapes = badReadings(project.lexicon).map((word) => error(`lexicon: the reading of ${JSON.stringify(word)} is not { say: string } or { phonemes: string }`, {
|
|
237
|
+
location,
|
|
238
|
+
hint: 'give the reading as { say: "words" } or { phonemes: "fˈQnimz" }, as for pronounce',
|
|
239
|
+
}));
|
|
240
|
+
return [...shapes, ...engine.checkLexicon(location, lexiconEntries(project.lexicon))];
|
|
241
|
+
}
|
|
225
242
|
/** Draws chapter `index` (0 is the title card) of `project` on its narration: its Lottie, its
|
|
226
243
|
* length in frames, the waits of the narration and the warnings at the moves that the
|
|
227
244
|
* narration waits for. */
|
package/dist/text.d.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
+
import { type Lexicon } from "./lexicon.ts";
|
|
1
2
|
import type { Diagnostic, Location, ChapterText } from "./generated/interfaces/aula-engine-types.js";
|
|
2
3
|
import type { Narration, ParagraphFrames, ScriptCue, SpokenCue } from "./generated/interfaces/aula-engine-engine.js";
|
|
3
4
|
export type { Diagnostic, Location, ChapterText };
|
|
4
5
|
export type { Frame, Move, ParagraphText, Related, Say, Severity } from "./generated/interfaces/aula-engine-types.js";
|
|
5
6
|
export type { CueKind, Narration, NarrationCue, NarrationWait, NarrationWord, ParagraphFrames, ScriptCue, SpokenCue, SpokenWord, } from "./generated/interfaces/aula-engine-engine.js";
|
|
6
7
|
export type { Theme } from "./theme.ts";
|
|
8
|
+
export type { Lexicon } from "./lexicon.ts";
|
|
7
9
|
/** `# <title>` and each chapter's Markdown, with the chapter line of each heading and paragraph:
|
|
8
10
|
* for people to read. */
|
|
9
11
|
export declare function scriptMarkdown(title: string, texts: readonly ChapterText[]): string;
|
|
10
12
|
/** The narration script, one list of cues for each chapter: the title card (the title), then
|
|
11
|
-
* each chapter (its heading and paragraphs).
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* each chapter (its heading and paragraphs). `project` is the project (`defineProject`), or its
|
|
14
|
+
* title and its lexicon: the spoken text of the title and of each heading has the readings of
|
|
15
|
+
* the project lexicon, as each `say` of `texts` has. */
|
|
16
|
+
export declare function narrationScript(project: {
|
|
17
|
+
readonly title: string;
|
|
18
|
+
readonly lexicon?: Lexicon;
|
|
19
|
+
}, texts: readonly ChapterText[]): ScriptCue[][];
|
|
20
|
+
/** The narration of a chapter from its script `cues` and the speech of each cue (`spoken[i]`
|
|
21
|
+
* speaks `cues[i]`), at `sampleRate`. The caller puts the
|
|
15
22
|
* samples of each speech at the `speechStartFrame` of its cue. */
|
|
16
23
|
export declare function chapterNarration(cues: readonly ScriptCue[], spoken: readonly SpokenCue[], sampleRate: number): Narration;
|
|
17
24
|
/** The engine's rules on the text of a chapter. */
|
|
@@ -27,9 +34,12 @@ export declare function moveFrames(narration: Narration, text: ChapterText): Par
|
|
|
27
34
|
export declare function estimateNarration(cues: readonly ScriptCue[]): Narration;
|
|
28
35
|
/** The index of the paragraph that holds chapter line `line`. */
|
|
29
36
|
export declare function paragraphAt(text: ChapterText, line: number): number | undefined;
|
|
30
|
-
/** The phonemes of English text as Kokoro's British voices read it:
|
|
31
|
-
* (
|
|
32
|
-
*
|
|
33
|
-
|
|
37
|
+
/** The phonemes of English text as Kokoro's British voices read it: the project lexicon
|
|
38
|
+
* `lexicon` (`defineProject({ lexicon })`), aula's pronunciation lexicon, then misaki 0.9.4's
|
|
39
|
+
* British G2P (crates/aula-g2p), with eSpeak NG for the words that its dictionaries do not
|
|
40
|
+
* have. The same on every run, in Node and in the browser. Test a reading of the project
|
|
41
|
+
* lexicon with it before the narration. An entry with a problem (`checkLexicon`) is left out.
|
|
42
|
+
* Throws where misaki raises an error. */
|
|
43
|
+
export declare function phonemize(text: string, lexicon?: Lexicon): string;
|
|
34
44
|
/** The one plain-text form of a diagnostic. */
|
|
35
45
|
export declare function renderDiagnostic(d: Diagnostic): string;
|
package/dist/text.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
// The engine's pure text rules (crates/aula-project): script, narration script, check,
|
|
2
2
|
// timeline, narration estimate, and the one diagnostic text format.
|
|
3
3
|
import { engine } from "./load.js";
|
|
4
|
+
import { lexiconEntries } from "./lexicon.js";
|
|
4
5
|
/** `# <title>` and each chapter's Markdown, with the chapter line of each heading and paragraph:
|
|
5
6
|
* for people to read. */
|
|
6
7
|
export function scriptMarkdown(title, texts) {
|
|
7
8
|
return engine.scriptMarkdown(title, [...texts]);
|
|
8
9
|
}
|
|
9
10
|
/** The narration script, one list of cues for each chapter: the title card (the title), then
|
|
10
|
-
* each chapter (its heading and paragraphs).
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
* each chapter (its heading and paragraphs). `project` is the project (`defineProject`), or its
|
|
12
|
+
* title and its lexicon: the spoken text of the title and of each heading has the readings of
|
|
13
|
+
* the project lexicon, as each `say` of `texts` has. */
|
|
14
|
+
export function narrationScript(project, texts) {
|
|
15
|
+
return engine.narrationScript(project.title, lexiconEntries(project.lexicon ?? {}), [...texts]);
|
|
16
|
+
}
|
|
17
|
+
/** The narration of a chapter from its script `cues` and the speech of each cue (`spoken[i]`
|
|
18
|
+
* speaks `cues[i]`), at `sampleRate`. The caller puts the
|
|
16
19
|
* samples of each speech at the `speechStartFrame` of its cue. */
|
|
17
20
|
export function chapterNarration(cues, spoken, sampleRate) {
|
|
18
21
|
return engine.chapterNarration([...cues], [...spoken], sampleRate);
|
|
@@ -40,11 +43,14 @@ export function estimateNarration(cues) {
|
|
|
40
43
|
export function paragraphAt(text, line) {
|
|
41
44
|
return engine.paragraphAt(text, line);
|
|
42
45
|
}
|
|
43
|
-
/** The phonemes of English text as Kokoro's British voices read it:
|
|
44
|
-
* (
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
/** The phonemes of English text as Kokoro's British voices read it: the project lexicon
|
|
47
|
+
* `lexicon` (`defineProject({ lexicon })`), aula's pronunciation lexicon, then misaki 0.9.4's
|
|
48
|
+
* British G2P (crates/aula-g2p), with eSpeak NG for the words that its dictionaries do not
|
|
49
|
+
* have. The same on every run, in Node and in the browser. Test a reading of the project
|
|
50
|
+
* lexicon with it before the narration. An entry with a problem (`checkLexicon`) is left out.
|
|
51
|
+
* Throws where misaki raises an error. */
|
|
52
|
+
export function phonemize(text, lexicon = {}) {
|
|
53
|
+
return engine.phonemize(text, lexiconEntries(lexicon));
|
|
48
54
|
}
|
|
49
55
|
/** The one plain-text form of a diagnostic. */
|
|
50
56
|
export function renderDiagnostic(d) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beff/aula",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The aula engine for narrated explainer videos: the Manim CE API, defineChapter, its rows, readChapter and renderChapter over a Rust WebAssembly component. Chapters and kits import it; the aula command is @beff/aula-cli.",
|
|
6
6
|
"license": "MIT AND GPL-3.0-or-later",
|