@beff/aula 0.0.1 → 0.1.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.
Files changed (77) hide show
  1. package/README.md +9 -1
  2. package/dist/animations.d.ts +634 -0
  3. package/dist/animations.js +1793 -0
  4. package/dist/braces.d.ts +84 -0
  5. package/dist/braces.js +253 -0
  6. package/dist/card.d.ts +17 -0
  7. package/dist/card.js +90 -0
  8. package/dist/colors-palette.d.ts +2242 -0
  9. package/dist/colors-palette.js +2241 -0
  10. package/dist/colors.d.ts +120 -0
  11. package/dist/colors.js +403 -0
  12. package/dist/curves.d.ts +10 -0
  13. package/dist/curves.js +128 -0
  14. package/dist/engine.d.ts +1595 -0
  15. package/dist/engine.js +3364 -0
  16. package/dist/errors.d.ts +19 -0
  17. package/dist/errors.js +25 -0
  18. package/dist/generated/aula.conditional-suspending-3-i32-to-void.wasm +0 -0
  19. package/dist/generated/aula.core.wasm +0 -0
  20. package/dist/generated/aula.core2.wasm +0 -0
  21. package/dist/generated/aula.core3.wasm +0 -0
  22. package/dist/generated/aula.core4.wasm +0 -0
  23. package/dist/generated/aula.core5.wasm +0 -0
  24. package/dist/generated/aula.core6.wasm +0 -0
  25. package/dist/generated/aula.core7.wasm +0 -0
  26. package/dist/generated/aula.core8.wasm +0 -0
  27. package/dist/generated/aula.d.ts +80 -0
  28. package/dist/generated/aula.js +54639 -0
  29. package/dist/generated/interfaces/aula-engine-engine.d.ts +983 -0
  30. package/dist/generated/interfaces/aula-engine-host.d.ts +10 -0
  31. package/dist/generated/interfaces/aula-engine-tts.d.ts +43 -0
  32. package/dist/generated/interfaces/aula-engine-types.d.ts +60 -0
  33. package/dist/geometry.d.ts +551 -0
  34. package/dist/geometry.js +1821 -0
  35. package/dist/graph.d.ts +117 -0
  36. package/dist/graph.js +526 -0
  37. package/dist/graphing.d.ts +597 -0
  38. package/dist/graphing.js +1504 -0
  39. package/dist/host.d.ts +19 -0
  40. package/dist/host.js +85 -0
  41. package/dist/index.d.ts +5 -0
  42. package/dist/index.js +11 -0
  43. package/dist/licenses/aula-g2p-NOTICE.txt +13 -0
  44. package/dist/licenses/espeak-ng-COPYING.txt +674 -0
  45. package/dist/licenses/fonts-OFL-JetBrainsMono.txt +93 -0
  46. package/dist/licenses/fonts-OFL-NunitoSans.txt +93 -0
  47. package/dist/load.d.ts +16 -0
  48. package/dist/load.js +69 -0
  49. package/dist/logo.d.ts +30 -0
  50. package/dist/logo.js +186 -0
  51. package/dist/manim.d.ts +22 -0
  52. package/dist/manim.js +19 -0
  53. package/dist/mobjects.d.ts +127 -0
  54. package/dist/mobjects.js +316 -0
  55. package/dist/pointcloud.d.ts +144 -0
  56. package/dist/pointcloud.js +400 -0
  57. package/dist/rates.d.ts +19 -0
  58. package/dist/rates.js +54 -0
  59. package/dist/run.d.ts +82 -0
  60. package/dist/run.js +245 -0
  61. package/dist/tables.d.ts +179 -0
  62. package/dist/tables.js +403 -0
  63. package/dist/tex.d.ts +8 -0
  64. package/dist/tex.js +257 -0
  65. package/dist/text-layouts.d.ts +64 -0
  66. package/dist/text-layouts.js +225 -0
  67. package/dist/text.d.ts +35 -0
  68. package/dist/text.js +52 -0
  69. package/dist/theme.d.ts +25 -0
  70. package/dist/theme.js +12 -0
  71. package/dist/user-code.d.ts +5 -0
  72. package/dist/user-code.js +20 -0
  73. package/dist/utils.d.ts +152 -0
  74. package/dist/utils.js +517 -0
  75. package/dist/vector-field.d.ts +132 -0
  76. package/dist/vector-field.js +361 -0
  77. package/package.json +46 -5
package/dist/host.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { Point } from "./generated/interfaces/aula-engine-types.js";
2
+ /** Keeps `f` for the engine; the engine drops it with its owner. */
3
+ export declare function register(f: (...args: never[]) => unknown): number;
4
+ /** True when a callback threw since the last `takePending`. */
5
+ export declare function hasPending(): boolean;
6
+ /** The first error a callback threw since the last call, taken. */
7
+ export declare function takePending(): unknown;
8
+ export declare function callUpdater(id: number, dt: number): boolean;
9
+ export declare function callAlpha(id: number, alpha: number): boolean;
10
+ export declare function callRedraw(id: number): boolean;
11
+ export declare function callPoint(id: number, p: Point): Point | undefined;
12
+ /** A rate function's value. When it returns no finite number, the error is kept as if it threw. */
13
+ export declare function callRate(id: number, t: number): number | undefined;
14
+ /** The points of a path function. When it returns no list of points, the error is kept as if
15
+ * it threw. */
16
+ export declare function callPath(id: number, starts: Point[], ends: Point[], t: number): Point[] | undefined;
17
+ export declare function dropCallback(id: number): void;
18
+ /** A Rust panic: an engine bug. The instance traps right after this. */
19
+ export declare function reportPanic(message: string): void;
package/dist/host.js ADDED
@@ -0,0 +1,85 @@
1
+ // The host side of the engine component (WIT interface `aula:engine/host`): JS callbacks
2
+ // by id. A callback that throws never unwinds through the component: the error is kept here,
3
+ // the host call returns a failure, the export returns an error, and `diagnosticOf` (run.ts)
4
+ // reports the original error, with its own stack, instead of the export's error.
5
+ import { aulaError } from "./errors.js";
6
+ import { runUserCode } from "./user-code.js";
7
+ const table = new Map();
8
+ let next = 1;
9
+ let pending = [];
10
+ /** Keeps `f` for the engine; the engine drops it with its owner. */
11
+ export function register(f) {
12
+ const id = next++;
13
+ table.set(id, f);
14
+ return id;
15
+ }
16
+ /** True when a callback threw since the last `takePending`. */
17
+ export function hasPending() {
18
+ return pending.length > 0;
19
+ }
20
+ /** The first error a callback threw since the last call, taken. */
21
+ export function takePending() {
22
+ const first = pending[0];
23
+ pending = [];
24
+ return first;
25
+ }
26
+ /** Runs callback `id`: its value, or null when it threw (the error is kept). */
27
+ function run(id, args) {
28
+ const f = table.get(id);
29
+ if (f === undefined)
30
+ return { value: undefined };
31
+ const r = runUserCode(() => Reflect.apply(f, undefined, args));
32
+ if (r._tag === "Left") {
33
+ pending.push(r.left);
34
+ return null;
35
+ }
36
+ return { value: r.right };
37
+ }
38
+ export function callUpdater(id, dt) {
39
+ return run(id, [dt]) !== null;
40
+ }
41
+ export function callAlpha(id, alpha) {
42
+ return run(id, [alpha]) !== null;
43
+ }
44
+ export function callRedraw(id) {
45
+ return run(id, []) !== null;
46
+ }
47
+ export function callPoint(id, p) {
48
+ const r = run(id, [p]);
49
+ if (r === null)
50
+ return undefined;
51
+ const v = r.value;
52
+ return Array.isArray(v) && typeof v[0] === "number" && typeof v[1] === "number" ? [v[0], v[1]] : undefined;
53
+ }
54
+ /** A rate function's value. When it returns no finite number, the error is kept as if it threw. */
55
+ export function callRate(id, t) {
56
+ const r = run(id, [t]);
57
+ if (r === null)
58
+ return undefined;
59
+ if (typeof r.value === "number" && Number.isFinite(r.value))
60
+ return r.value;
61
+ pending.push(aulaError(`rateFunc: returned ${String(r.value)} for t = ${String(t)}`, "a rate function returns a finite number, like m.smooth or (t) => t * t"));
62
+ return undefined;
63
+ }
64
+ /** The points of a path function. When it returns no list of points, the error is kept as if
65
+ * it threw. */
66
+ export function callPath(id, starts, ends, t) {
67
+ const r = run(id, [starts, ends, t]);
68
+ if (r === null)
69
+ return undefined;
70
+ const v = r.value;
71
+ const ok = Array.isArray(v) &&
72
+ v.length === starts.length &&
73
+ v.every((p) => Array.isArray(p) && typeof p[0] === "number" && typeof p[1] === "number");
74
+ if (ok)
75
+ return v.map((p) => [p[0], p[1]]);
76
+ pending.push(aulaError(`pathFunc: returned ${String(v)} for t = ${String(t)}`, "a path function returns one point [x, y] for each start point"));
77
+ return undefined;
78
+ }
79
+ export function dropCallback(id) {
80
+ table.delete(id);
81
+ }
82
+ /** A Rust panic: an engine bug. The instance traps right after this. */
83
+ export function reportPanic(message) {
84
+ console.error(`error: ${message}\n = hint: an engine bug, not a chapter error: report it with the chapter line`);
85
+ }
@@ -0,0 +1,5 @@
1
+ export * as m from "./manim.ts";
2
+ export { defineChapter, defineProject, isProjectDefinition, paragraph, say, show, tagText } from "./engine.ts";
3
+ export { checkChapter, readChapter, renderChapter, renderScene } from "./run.ts";
4
+ export type { Card, ChapterDefinition, ChapterFields, ChapterRun, CheckedChapter, CheckedParagraph, Check, Finding, Heading, Notes, OpenMove, Leaf, SceneRun, Untimed, ProjectDefinition, ProjectFields, Instant, Row, Screen, Shown, } from "./engine.ts";
5
+ export type { ChapterResult, Host, ReadOptions, RenderOptions, StackFrame } from "./run.ts";
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // `@beff/aula`: a chapter module imports `m` (the Manim-style API, ./manim.ts), `defineChapter`
2
+ // and the rows; a project module imports `defineProject`:
3
+ //
4
+ // import { m, defineChapter, paragraph, say, show } from "@beff/aula";
5
+ // import { defineProject } from "@beff/aula";
6
+ //
7
+ // readChapter, checkChapter and renderChapter run a chapter, as the CLI and the web app do.
8
+ // renderScene runs a Manim construct, with no narration.
9
+ export * as m from "./manim.js";
10
+ export { defineChapter, defineProject, isProjectDefinition, paragraph, say, show, tagText } from "./engine.js";
11
+ export { checkChapter, readChapter, renderChapter, renderScene } from "./run.js";
@@ -0,0 +1,13 @@
1
+ aula-g2p ports misaki's British G2P to Rust and carries data from these projects:
2
+
3
+ - misaki 0.9.4 (https://github.com/hexgrad/misaki), Apache-2.0: the rules (ported) and the
4
+ dictionaries data/gb_gold.json and data/gb_silver.json (copied as they are).
5
+ - spaCy 3.8 and en_core_web_sm 3.8.0 (https://github.com/explosion/spaCy), MIT: the tokenizer
6
+ rules (data/spacy_en.json), the tagger weights (data/tagger.bin, the same fp32 numbers) and the
7
+ symbol table (data/symbols.txt), exported by tools/.
8
+ - num2words 0.5.14 (https://github.com/savoirfaireinternational/num2words), LGPL-2.1: misaki
9
+ reads numbers with it. src/numbers.rs gives the same words; it is written from the observed
10
+ output, not translated from its code.
11
+ - eSpeak NG 1.52.0 (https://github.com/espeak-ng/espeak-ng), GPL-3.0-or-later, with its data:
12
+ espeak/espeak.wasm is built from it by espeak/build.sh. See espeak/COPYING. The source is the
13
+ pinned tag in build.sh.