@beff/aula 0.4.2 → 0.5.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/engine.d.ts +31 -1
- package/dist/engine.js +81 -3
- package/dist/generated/aula.core5.wasm +0 -0
- package/dist/generated/aula.js +2495 -867
- package/dist/generated/interfaces/aula-engine-engine.d.ts +18 -0
- package/dist/generated/interfaces/aula-engine-types.d.ts +18 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/licenses/fonts-OFL-NotoSans.txt +94 -0
- package/dist/media.d.ts +33 -0
- package/dist/media.js +390 -0
- package/dist/run.d.ts +9 -3
- package/dist/run.js +23 -0
- package/dist/text.d.ts +2 -2
- package/package.json +1 -1
package/dist/run.js
CHANGED
|
@@ -6,8 +6,10 @@ import { engine, isComponentError } from "./load.js";
|
|
|
6
6
|
import { hasPending, takePending } from "./host.js";
|
|
7
7
|
import { runUserCode } from "./user-code.js";
|
|
8
8
|
import { badReadings, lexiconEntries } from "./lexicon.js";
|
|
9
|
+
import { probeMedia, projectPath } from "./media.js";
|
|
9
10
|
export { importUserModule } from "./user-code.js";
|
|
10
11
|
export { renderScene } from "./engine.js";
|
|
12
|
+
export { MAX_CLIP_BYTES, MEDIA_FORMATS, probeMedia } from "./media.js";
|
|
11
13
|
/** Frames per second of the Lottie files: the engine's rate (`engine.fps()`, which
|
|
12
14
|
* `constants.test.ts` checks), as a value here: an import does not load the engine. */
|
|
13
15
|
export const FPS = 15;
|
|
@@ -184,6 +186,26 @@ function chapterOf(project, index) {
|
|
|
184
186
|
return (project.chapters[index - 1] ??
|
|
185
187
|
error(`the project has chapters 1 to ${String(project.chapters.length)}; there is no chapter ${String(index)}`));
|
|
186
188
|
}
|
|
189
|
+
/** The folder of the project, as the host names it (`.` for the working directory): where the
|
|
190
|
+
* path of an `embed` starts. */
|
|
191
|
+
function projectFolder(project, host) {
|
|
192
|
+
const file = definedAt(project, host).file;
|
|
193
|
+
const name = host.name(file) ?? file;
|
|
194
|
+
const slash = name.lastIndexOf("/");
|
|
195
|
+
return slash === -1 ? "." : name.slice(0, slash);
|
|
196
|
+
}
|
|
197
|
+
/** The file `given` of an `embed` (a path from the project folder): what it is, or why it
|
|
198
|
+
* cannot play. */
|
|
199
|
+
function clipOf(host, folder, given) {
|
|
200
|
+
const found = projectPath(given);
|
|
201
|
+
if ("problem" in found)
|
|
202
|
+
return `embed: ${JSON.stringify(given)} ${found.problem}`;
|
|
203
|
+
const source = host.media?.(folder === "." ? found.path : `${folder}/${found.path}`);
|
|
204
|
+
if (source === undefined)
|
|
205
|
+
return `embed: no file ${JSON.stringify(given)} in the project folder`;
|
|
206
|
+
const probed = probeMedia(source);
|
|
207
|
+
return typeof probed === "string" ? `embed: ${JSON.stringify(given)} ${probed}` : probed;
|
|
208
|
+
}
|
|
187
209
|
/** The slot of chapter `index` (from 1) of `project`. */
|
|
188
210
|
function slotOf(project, chapter, index, host) {
|
|
189
211
|
const source = definedAt(chapter, host).file;
|
|
@@ -194,6 +216,7 @@ function slotOf(project, chapter, index, host) {
|
|
|
194
216
|
file: host.name(source) ?? source,
|
|
195
217
|
frames: (e) => host.frames(e),
|
|
196
218
|
lexicon: lexiconEntries(project.lexicon),
|
|
219
|
+
clip: (given) => clipOf(host, projectFolder(project, host), given),
|
|
197
220
|
};
|
|
198
221
|
}
|
|
199
222
|
/** Reads chapter `index` (from 1) of `project`: its text and its text problems, with no move
|
package/dist/text.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { type Lexicon } from "./lexicon.ts";
|
|
|
2
2
|
import type { Diagnostic, Location, ChapterText } from "./generated/interfaces/aula-engine-types.js";
|
|
3
3
|
import type { Narration, ParagraphFrames, SayPart, ScriptCue, SpokenCue, UnclearWord } from "./generated/interfaces/aula-engine-engine.js";
|
|
4
4
|
export type { Diagnostic, Location, ChapterText };
|
|
5
|
-
export type { Frame, Move, ParagraphText, Related, Say, Severity } from "./generated/interfaces/aula-engine-types.js";
|
|
6
|
-
export type { CueKind, Narration, NarrationCue, NarrationWait, NarrationWord, ParagraphFrames, SayPart, ScriptCue, SpokenCue, UnclearKind, UnclearWord, } from "./generated/interfaces/aula-engine-engine.js";
|
|
5
|
+
export type { Embed, EmbedKind, Frame, Move, ParagraphText, Related, Say, Severity, } from "./generated/interfaces/aula-engine-types.js";
|
|
6
|
+
export type { CueKind, Narration, NarrationCue, NarrationWait, NarrationWord, ParagraphFrames, PlayedEmbed, SayPart, ScriptCue, SpokenCue, UnclearKind, UnclearWord, } from "./generated/interfaces/aula-engine-engine.js";
|
|
7
7
|
export type { Theme } from "./theme.ts";
|
|
8
8
|
export type { Lexicon } from "./lexicon.ts";
|
|
9
9
|
/** `# <title>` and each chapter's Markdown, with the chapter line of each heading and paragraph:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beff/aula",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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",
|