@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.
- package/README.md +9 -1
- package/dist/animations.d.ts +634 -0
- package/dist/animations.js +1793 -0
- package/dist/braces.d.ts +84 -0
- package/dist/braces.js +253 -0
- package/dist/card.d.ts +17 -0
- package/dist/card.js +90 -0
- package/dist/colors-palette.d.ts +2242 -0
- package/dist/colors-palette.js +2241 -0
- package/dist/colors.d.ts +120 -0
- package/dist/colors.js +403 -0
- package/dist/curves.d.ts +10 -0
- package/dist/curves.js +128 -0
- package/dist/engine.d.ts +1595 -0
- package/dist/engine.js +3364 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.js +25 -0
- package/dist/generated/aula.conditional-suspending-3-i32-to-void.wasm +0 -0
- package/dist/generated/aula.core.wasm +0 -0
- package/dist/generated/aula.core2.wasm +0 -0
- package/dist/generated/aula.core3.wasm +0 -0
- package/dist/generated/aula.core4.wasm +0 -0
- package/dist/generated/aula.core5.wasm +0 -0
- package/dist/generated/aula.core6.wasm +0 -0
- package/dist/generated/aula.core7.wasm +0 -0
- package/dist/generated/aula.core8.wasm +0 -0
- package/dist/generated/aula.d.ts +80 -0
- package/dist/generated/aula.js +54639 -0
- package/dist/generated/interfaces/aula-engine-engine.d.ts +983 -0
- package/dist/generated/interfaces/aula-engine-host.d.ts +10 -0
- package/dist/generated/interfaces/aula-engine-tts.d.ts +43 -0
- package/dist/generated/interfaces/aula-engine-types.d.ts +60 -0
- package/dist/geometry.d.ts +551 -0
- package/dist/geometry.js +1821 -0
- package/dist/graph.d.ts +117 -0
- package/dist/graph.js +526 -0
- package/dist/graphing.d.ts +597 -0
- package/dist/graphing.js +1504 -0
- package/dist/host.d.ts +19 -0
- package/dist/host.js +85 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11 -0
- package/dist/licenses/aula-g2p-NOTICE.txt +13 -0
- package/dist/licenses/espeak-ng-COPYING.txt +674 -0
- package/dist/licenses/fonts-OFL-JetBrainsMono.txt +93 -0
- package/dist/licenses/fonts-OFL-NunitoSans.txt +93 -0
- package/dist/load.d.ts +16 -0
- package/dist/load.js +69 -0
- package/dist/logo.d.ts +30 -0
- package/dist/logo.js +186 -0
- package/dist/manim.d.ts +22 -0
- package/dist/manim.js +19 -0
- package/dist/mobjects.d.ts +127 -0
- package/dist/mobjects.js +316 -0
- package/dist/pointcloud.d.ts +144 -0
- package/dist/pointcloud.js +400 -0
- package/dist/rates.d.ts +19 -0
- package/dist/rates.js +54 -0
- package/dist/run.d.ts +82 -0
- package/dist/run.js +245 -0
- package/dist/tables.d.ts +179 -0
- package/dist/tables.js +403 -0
- package/dist/tex.d.ts +8 -0
- package/dist/tex.js +257 -0
- package/dist/text-layouts.d.ts +64 -0
- package/dist/text-layouts.js +225 -0
- package/dist/text.d.ts +35 -0
- package/dist/text.js +52 -0
- package/dist/theme.d.ts +25 -0
- package/dist/theme.js +12 -0
- package/dist/user-code.d.ts +5 -0
- package/dist/user-code.js +20 -0
- package/dist/utils.d.ts +152 -0
- package/dist/utils.js +517 -0
- package/dist/vector-field.d.ts +132 -0
- package/dist/vector-field.js +361 -0
- package/package.json +46 -5
package/dist/run.js
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { checkRows, checkTitle, drawRows, drawTitle, readRows } from "./engine.js";
|
|
2
|
+
import { card as defaultCard } from "./card.js";
|
|
3
|
+
import { theme as defaultTheme } from "./theme.js";
|
|
4
|
+
import { AulaError } from "./errors.js";
|
|
5
|
+
import { isComponentError } from "./load.js";
|
|
6
|
+
import { hasPending, takePending } from "./host.js";
|
|
7
|
+
import { runUserCode } from "./user-code.js";
|
|
8
|
+
export { importUserModule } from "./user-code.js";
|
|
9
|
+
export { renderScene } from "./engine.js";
|
|
10
|
+
/** Frames per second of the Lottie files: the engine's rate (`engine.fps()`, which
|
|
11
|
+
* `constants.test.ts` checks), as a value here: an import does not load the engine. */
|
|
12
|
+
export const FPS = 15;
|
|
13
|
+
/** `tts`: the narrator engine (tokens to audio), after `loadEngine()`. */
|
|
14
|
+
export { loadEngine, tts } from "./load.js";
|
|
15
|
+
/** The name of chapter 0, the title card. */
|
|
16
|
+
export const TITLE = "title";
|
|
17
|
+
/** The slug of a title or heading: lower-case words joined by `-`. */
|
|
18
|
+
export function slugOf(text) {
|
|
19
|
+
return text
|
|
20
|
+
.normalize("NFKD")
|
|
21
|
+
.replace(/[̀-ͯ]/g, "")
|
|
22
|
+
.toLowerCase()
|
|
23
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
24
|
+
.replace(/^-|-$/g, "");
|
|
25
|
+
}
|
|
26
|
+
/** The chapter names of a project in narration order: the title card, then `NN-<heading slug>`. */
|
|
27
|
+
export function chapterNames(project) {
|
|
28
|
+
return [TITLE, ...project.chapters.map((c, i) => `${String(i + 1).padStart(2, "0")}-${slugOf(c.heading)}`)];
|
|
29
|
+
}
|
|
30
|
+
/** The hint of a wrong name: `tsc` names the name and its line. */
|
|
31
|
+
const TSC = "run tsc: it finds wrong names before aula runs";
|
|
32
|
+
/** A frame's file: a `file:` URL as its path. */
|
|
33
|
+
function framePath(at) {
|
|
34
|
+
return at.startsWith("file:") ? decodeURIComponent(new URL(at).pathname) : at;
|
|
35
|
+
}
|
|
36
|
+
/** The frames of an error from the V8 text of its stack (Node), with `file:` URLs as paths. */
|
|
37
|
+
export function v8Frames(made) {
|
|
38
|
+
const out = [];
|
|
39
|
+
for (const raw of (made.stack ?? "").split("\n")) {
|
|
40
|
+
const line = raw.trim();
|
|
41
|
+
if (!line.startsWith("at "))
|
|
42
|
+
continue;
|
|
43
|
+
const body = line.slice(3);
|
|
44
|
+
const paren = /^(.*) \((.*)\)$/.exec(body);
|
|
45
|
+
const fn = paren?.[1] ?? "";
|
|
46
|
+
const at = paren?.[2] ?? body;
|
|
47
|
+
const m = /^(.*):(\d+):(\d+)$/.exec(at);
|
|
48
|
+
if (m?.[1] === undefined || m[2] === undefined || m[3] === undefined)
|
|
49
|
+
continue;
|
|
50
|
+
out.push({
|
|
51
|
+
function: fn.replace(/^(async |new )/, ""),
|
|
52
|
+
file: framePath(m[1]),
|
|
53
|
+
line: Number(m[2]),
|
|
54
|
+
col: Number(m[3]),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/** The host of Node: V8 frames, each file named by its path, and each path taken as a file. */
|
|
60
|
+
const NODE = { frames: v8Frames, name: (file) => file, exists: () => true };
|
|
61
|
+
/** The place of a define call (`defineChapter`, `defineProject`): the frame of its caller, as
|
|
62
|
+
* `host` reads it. */
|
|
63
|
+
export function definedAt(definition, host = NODE) {
|
|
64
|
+
return host.frames(definition.call)[1] ?? { function: "", file: "", line: 0, col: 0 };
|
|
65
|
+
}
|
|
66
|
+
/** The location of a syntax error in an imported module: V8 starts the stack with `file:line`. */
|
|
67
|
+
function syntaxLocation(stack) {
|
|
68
|
+
const first = stack.split("\n")[0] ?? "";
|
|
69
|
+
const m = /^(file:\S+?):(\d+)$/.exec(first);
|
|
70
|
+
if (m?.[1] === undefined || m[2] === undefined)
|
|
71
|
+
return undefined;
|
|
72
|
+
return { file: framePath(m[1]), line: Number(m[2]) };
|
|
73
|
+
}
|
|
74
|
+
function propertyOf(e, key) {
|
|
75
|
+
return typeof e === "object" && e !== null ? Reflect.get(e, key) : undefined;
|
|
76
|
+
}
|
|
77
|
+
function stringOf(e, key) {
|
|
78
|
+
const v = propertyOf(e, key);
|
|
79
|
+
return typeof v === "string" ? v : undefined;
|
|
80
|
+
}
|
|
81
|
+
/** An error diagnostic. */
|
|
82
|
+
export function error(message, more = {}) {
|
|
83
|
+
return { severity: "error", message, ...more, stack: [], related: [] };
|
|
84
|
+
}
|
|
85
|
+
function isDiagnostic(v) {
|
|
86
|
+
return typeof v === "object" && v !== null && "message" in v && "severity" in v;
|
|
87
|
+
}
|
|
88
|
+
/** The engine's own diagnostic of a thrown value: a AulaError's, or the error of a WIT `result`
|
|
89
|
+
* (jco throws it as a ComponentError). */
|
|
90
|
+
function engineDiagnostic(thrown) {
|
|
91
|
+
if (thrown instanceof AulaError)
|
|
92
|
+
return thrown.diagnostic;
|
|
93
|
+
if (isComponentError(thrown) && isDiagnostic(thrown.payload))
|
|
94
|
+
return thrown.payload;
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
/** The diagnostic of a thrown value: the first frame in the chapter file `chapterFile` (as the stack names
|
|
98
|
+
* it) is the location, the workspace frames before it are the stack. When a callback threw inside
|
|
99
|
+
* the engine call, that error is the one reported, with its own stack. */
|
|
100
|
+
export function diagnosticOf(value, chapterFile, host) {
|
|
101
|
+
const thrown = hasPending() ? takePending() : value;
|
|
102
|
+
if (!(thrown instanceof Error)) {
|
|
103
|
+
return error(`threw ${typeof thrown === "string" ? thrown : String(thrown)}, not an Error`, {
|
|
104
|
+
hint: "throw an Error: throw new Error(message)",
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
const stack = thrown.stack ?? "";
|
|
108
|
+
const named = (file) => host.name(file) ?? file;
|
|
109
|
+
const all = host.frames(thrown).filter((f) => host.name(f.file) !== undefined);
|
|
110
|
+
const primary = all.findIndex((f) => f.file === chapterFile);
|
|
111
|
+
const own = engineDiagnostic(thrown);
|
|
112
|
+
const at = primary >= 0 ? all[primary] : own !== undefined ? undefined : all[0];
|
|
113
|
+
const kit = (primary >= 0 ? all.slice(0, primary) : all.slice(1)).map((f) => ({
|
|
114
|
+
function: f.function,
|
|
115
|
+
location: { file: named(f.file), line: f.line, col: f.col },
|
|
116
|
+
}));
|
|
117
|
+
let location = at === undefined ? undefined : { file: named(at.file), line: at.line, col: at.col };
|
|
118
|
+
let message = thrown.message;
|
|
119
|
+
let hint = stringOf(thrown, "hint");
|
|
120
|
+
const related = [];
|
|
121
|
+
if (own !== undefined) {
|
|
122
|
+
message = own.message;
|
|
123
|
+
hint = own.hint;
|
|
124
|
+
if (own.location !== undefined) {
|
|
125
|
+
if (location !== undefined && (own.location.line !== location.line || own.location.file !== location.file)) {
|
|
126
|
+
related.push({ label: "called at", location });
|
|
127
|
+
}
|
|
128
|
+
location = own.location;
|
|
129
|
+
}
|
|
130
|
+
related.push(...own.related);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
if (thrown.name === "SyntaxError") {
|
|
134
|
+
const where = syntaxLocation(stack);
|
|
135
|
+
if (where !== undefined)
|
|
136
|
+
location = { file: named(where.file), line: where.line, col: 0 };
|
|
137
|
+
if (/does not provide an export named/.test(message)) {
|
|
138
|
+
hint = TSC;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
message = `syntax error: ${message}`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (thrown.name === "ReferenceError") {
|
|
145
|
+
hint = TSC;
|
|
146
|
+
}
|
|
147
|
+
else if (thrown.name === "TypeError") {
|
|
148
|
+
if (/ is not a function/.test(message)) {
|
|
149
|
+
hint = TSC;
|
|
150
|
+
}
|
|
151
|
+
else if (message.startsWith("Cannot read properties of")) {
|
|
152
|
+
hint =
|
|
153
|
+
"the value before the dot is undefined or null: check that it was made, or returned by the function that made it";
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else if (thrown.name === "RangeError") {
|
|
157
|
+
if (message.includes("call stack"))
|
|
158
|
+
hint = "too much recursion or a loop that never ends";
|
|
159
|
+
}
|
|
160
|
+
else if (message.startsWith("unreachable")) {
|
|
161
|
+
hint = "an engine bug, not a chapter error: report it with the chapter line";
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
severity: "error",
|
|
166
|
+
message,
|
|
167
|
+
...(location === undefined ? {} : { location }),
|
|
168
|
+
stack: kit,
|
|
169
|
+
...(hint === undefined ? {} : { hint }),
|
|
170
|
+
related,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const isError = (d) => d.severity === "error";
|
|
174
|
+
/** Runs a chapter; a throw is a diagnostic at the line of the chapter file `file`. */
|
|
175
|
+
function attempt(file, host, f) {
|
|
176
|
+
const run = runUserCode(f);
|
|
177
|
+
if (run._tag === "Left")
|
|
178
|
+
return { ok: false, diagnostics: [diagnosticOf(run.left, file, host)] };
|
|
179
|
+
return { ok: !run.right.diagnostics.some(isError), diagnostics: run.right.diagnostics, value: run.right };
|
|
180
|
+
}
|
|
181
|
+
/** Chapter `index` (from 1) of `project`. */
|
|
182
|
+
function chapterOf(project, index) {
|
|
183
|
+
return (project.chapters[index - 1] ??
|
|
184
|
+
error(`the project has chapters 1 to ${String(project.chapters.length)}; there is no chapter ${String(index)}`));
|
|
185
|
+
}
|
|
186
|
+
/** The slot of chapter `index` (from 1) of `project`. */
|
|
187
|
+
function slotOf(project, chapter, index, host) {
|
|
188
|
+
const source = definedAt(chapter, host).file;
|
|
189
|
+
return {
|
|
190
|
+
number: index,
|
|
191
|
+
count: project.chapters.length,
|
|
192
|
+
source,
|
|
193
|
+
file: host.name(source) ?? source,
|
|
194
|
+
frames: (e) => host.frames(e),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/** Reads chapter `index` (from 1) of `project`: its text and its text problems, with no move
|
|
198
|
+
* run. The paragraph checks run only when the chapter is checked (`checkChapter`). */
|
|
199
|
+
export function readChapter(project, index, options = {}) {
|
|
200
|
+
const host = options.host ?? NODE;
|
|
201
|
+
const chapter = chapterOf(project, index);
|
|
202
|
+
if (!("call" in chapter))
|
|
203
|
+
return { ok: false, diagnostics: [chapter] };
|
|
204
|
+
const slot = slotOf(project, chapter, index, host);
|
|
205
|
+
const run = attempt(slot.source, host, () => readRows(chapter, slot));
|
|
206
|
+
return { ok: run.ok, diagnostics: run.diagnostics, value: run.value?.text };
|
|
207
|
+
}
|
|
208
|
+
/** Checks chapter `index` (0 is the title card) of `project`, as `aula check` does: it runs
|
|
209
|
+
* the moves in list order with no clock and no narration, and gives the text problems, the
|
|
210
|
+
* engine's checks of the picture after each animation, the kit findings and the paragraph
|
|
211
|
+
* checks. With sync by construction, no check depends on the length of a `say`. */
|
|
212
|
+
export function checkChapter(project, index, options = {}) {
|
|
213
|
+
const host = options.host ?? NODE;
|
|
214
|
+
const card = project.card ?? defaultCard;
|
|
215
|
+
const theme = project.theme ?? defaultTheme;
|
|
216
|
+
if (index === 0) {
|
|
217
|
+
return attempt("", host, () => checkTitle(project.title, theme, card, project.chapters.length));
|
|
218
|
+
}
|
|
219
|
+
const chapter = chapterOf(project, index);
|
|
220
|
+
if (!("call" in chapter))
|
|
221
|
+
return { ok: false, diagnostics: [chapter] };
|
|
222
|
+
const slot = slotOf(project, chapter, index, host);
|
|
223
|
+
return attempt(slot.source, host, () => checkRows(chapter, theme, card, slot, (p) => host.exists(p)));
|
|
224
|
+
}
|
|
225
|
+
/** Draws chapter `index` (0 is the title card) of `project` on its narration: its Lottie, its
|
|
226
|
+
* length in frames, the waits of the narration and the warnings at the moves that the
|
|
227
|
+
* narration waits for. */
|
|
228
|
+
export function renderChapter(project, index, options) {
|
|
229
|
+
const host = options.host ?? NODE;
|
|
230
|
+
const drawing = {
|
|
231
|
+
narration: options.narration,
|
|
232
|
+
name: chapterNames(project)[index] ?? "",
|
|
233
|
+
lint: options.lint ?? false,
|
|
234
|
+
count: project.chapters.length + 1,
|
|
235
|
+
};
|
|
236
|
+
const card = project.card ?? defaultCard;
|
|
237
|
+
const theme = project.theme ?? defaultTheme;
|
|
238
|
+
if (index === 0)
|
|
239
|
+
return attempt("", host, () => drawTitle(project.title, theme, card, drawing));
|
|
240
|
+
const chapter = chapterOf(project, index);
|
|
241
|
+
if (!("call" in chapter))
|
|
242
|
+
return { ok: false, diagnostics: [chapter] };
|
|
243
|
+
const slot = slotOf(project, chapter, index, host);
|
|
244
|
+
return attempt(slot.source, host, () => drawRows(chapter, theme, card, slot, drawing));
|
|
245
|
+
}
|
package/dist/tables.d.ts
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { type Animation, type Color, type DecimalNumberOptions, type Point, type StyleOptions, type TexOptions, type TextOptions, Mobject } from "./engine.ts";
|
|
2
|
+
import type { Mobject as RawMobject } from "./generated/interfaces/aula-engine-engine.js";
|
|
3
|
+
/** An entry of a table or a matrix: a string, a number or a mobject. */
|
|
4
|
+
export type Entry = string | number | Mobject;
|
|
5
|
+
/** The options that `elementToMobjectConfig` gives each entry. */
|
|
6
|
+
export type ElementConfig = TextOptions & TexOptions & DecimalNumberOptions;
|
|
7
|
+
/** Manim's `element_to_mobject`: makes the mobject of an entry, with `elementToMobjectConfig`. */
|
|
8
|
+
export type ElementToMobject = {
|
|
9
|
+
bivariance(item: Entry, config: ElementConfig): Mobject;
|
|
10
|
+
}["bivariance"];
|
|
11
|
+
/** The options of the grid of a Table (Manim's `arrange_in_grid` keyword arguments). */
|
|
12
|
+
export interface GridConfig {
|
|
13
|
+
/** The edge or corner of each cell that its entry goes to (default the center). */
|
|
14
|
+
cellAlignment?: Point;
|
|
15
|
+
/** One letter for each row: `"u"` (up), `"c"` (center) or `"d"` (down). */
|
|
16
|
+
rowAlignments?: string;
|
|
17
|
+
/** One letter for each column: `"l"` (left), `"c"` (center) or `"r"` (right). */
|
|
18
|
+
colAlignments?: string;
|
|
19
|
+
/** The height of each row; undefined gives the tallest entry. */
|
|
20
|
+
rowHeights?: readonly (number | undefined)[];
|
|
21
|
+
/** The width of each column; undefined gives the widest entry. */
|
|
22
|
+
colWidths?: readonly (number | undefined)[];
|
|
23
|
+
}
|
|
24
|
+
/** The options of Table (Manim's keyword arguments). */
|
|
25
|
+
export interface TableOptions {
|
|
26
|
+
rowLabels?: readonly Mobject[];
|
|
27
|
+
colLabels?: readonly Mobject[];
|
|
28
|
+
topLeftEntry?: Mobject;
|
|
29
|
+
vBuff?: number;
|
|
30
|
+
hBuff?: number;
|
|
31
|
+
includeOuterLines?: boolean;
|
|
32
|
+
includeInnerLines?: boolean;
|
|
33
|
+
addBackgroundRectanglesToEntries?: boolean;
|
|
34
|
+
entriesBackgroundColor?: Color;
|
|
35
|
+
includeBackgroundRectangle?: boolean;
|
|
36
|
+
backgroundRectangleColor?: Color;
|
|
37
|
+
elementToMobject?: ElementToMobject;
|
|
38
|
+
elementToMobjectConfig?: ElementConfig;
|
|
39
|
+
arrangeInGridConfig?: GridConfig;
|
|
40
|
+
lineConfig?: StyleOptions;
|
|
41
|
+
}
|
|
42
|
+
/** What Table keeps besides its node. */
|
|
43
|
+
interface TableParts {
|
|
44
|
+
mobTable: Mobject[][];
|
|
45
|
+
elements: Mobject;
|
|
46
|
+
elementsWithoutLabels: Mobject;
|
|
47
|
+
rowLabels: readonly Mobject[] | undefined;
|
|
48
|
+
colLabels: readonly Mobject[] | undefined;
|
|
49
|
+
topLeftEntry: Mobject | undefined;
|
|
50
|
+
colDim: number;
|
|
51
|
+
horizontalLines: Mobject;
|
|
52
|
+
verticalLines: Mobject;
|
|
53
|
+
backgrounds: Map<Mobject, Mobject>;
|
|
54
|
+
}
|
|
55
|
+
/** A table: Manim's `Table`. Rows and columns count from 1, labels included. */
|
|
56
|
+
export declare class TableMobject extends Mobject {
|
|
57
|
+
#private;
|
|
58
|
+
hBuff: number;
|
|
59
|
+
vBuff: number;
|
|
60
|
+
constructor(handle: RawMobject, parts: TableParts, hBuff: number, vBuff: number);
|
|
61
|
+
/** The entries, labels included (Manim `elements`). */
|
|
62
|
+
get elements(): Mobject;
|
|
63
|
+
/** The grid of entries, labels included (Manim `mob_table`). */
|
|
64
|
+
get mobTable(): Mobject[][];
|
|
65
|
+
getHorizontalLines(): Mobject;
|
|
66
|
+
getVerticalLines(): Mobject;
|
|
67
|
+
/** One VGroup for each column. */
|
|
68
|
+
getColumns(): Mobject;
|
|
69
|
+
/** One VGroup for each row. */
|
|
70
|
+
getRows(): Mobject;
|
|
71
|
+
setColumnColors(...colors: Color[]): this;
|
|
72
|
+
setRowColors(...colors: Color[]): this;
|
|
73
|
+
/** All the entries with the labels, or the entry at `pos` (`[row, column]`, from 1). */
|
|
74
|
+
getEntries(pos?: readonly [number, number]): Mobject;
|
|
75
|
+
/** The entries without the labels, or the one at `pos` (`[row, column]`, from 1). */
|
|
76
|
+
getEntriesWithoutLabels(pos?: readonly [number, number]): Mobject;
|
|
77
|
+
getRowLabels(): Mobject;
|
|
78
|
+
getColLabels(): Mobject;
|
|
79
|
+
/** The top-left entry, the column labels and the row labels. */
|
|
80
|
+
getLabels(): Mobject;
|
|
81
|
+
/** A BackgroundRectangle behind each entry. */
|
|
82
|
+
addBackgroundToEntries(color?: Color): this;
|
|
83
|
+
/** The rectangle of the cell at `pos` (`[row, column]`, from 1), with half the buffs around the
|
|
84
|
+
* entries, as a Polygon with the style options. */
|
|
85
|
+
getCell(pos?: readonly [number, number], opts?: StyleOptions): Mobject;
|
|
86
|
+
/** A BackgroundRectangle on the cell at `pos`, in `color` (Manim's `PURE_YELLOW`). */
|
|
87
|
+
getHighlightedCell(pos?: readonly [number, number], color?: Color, opts?: {
|
|
88
|
+
fillOpacity?: number;
|
|
89
|
+
buff?: number;
|
|
90
|
+
}): Mobject;
|
|
91
|
+
/** Puts `getHighlightedCell(pos, color)` behind the table. */
|
|
92
|
+
addHighlightedCell(pos?: readonly [number, number], color?: Color, opts?: {
|
|
93
|
+
fillOpacity?: number;
|
|
94
|
+
buff?: number;
|
|
95
|
+
}): this;
|
|
96
|
+
/** Draws the lines, then the entries, the labels and the highlighted cells, one after the
|
|
97
|
+
* other by `lagRatio` (Manim `Table.create`). */
|
|
98
|
+
create(opts?: {
|
|
99
|
+
lagRatio?: number;
|
|
100
|
+
lineAnimation?: (m: Mobject) => Animation;
|
|
101
|
+
labelAnimation?: (m: Mobject) => Animation;
|
|
102
|
+
elementAnimation?: (m: Mobject) => Animation;
|
|
103
|
+
entryAnimation?: (m: Mobject) => Animation;
|
|
104
|
+
}): Animation;
|
|
105
|
+
/** Scales the table and its buffs. With `scaleStroke`, the stroke widths scale too. */
|
|
106
|
+
scale(scaleFactor: number, opts?: {
|
|
107
|
+
aboutPoint?: Point;
|
|
108
|
+
aboutEdge?: Point;
|
|
109
|
+
scaleStroke?: boolean;
|
|
110
|
+
}): this;
|
|
111
|
+
copy(): TableMobject;
|
|
112
|
+
}
|
|
113
|
+
/** Manim's `Table(table, opts)`: each entry becomes `elementToMobject(entry, elementToMobjectConfig)`
|
|
114
|
+
* (a `Paragraph` by default), in a grid with lines between the rows and the columns. */
|
|
115
|
+
export declare function Table(table: readonly (readonly Entry[])[], opts?: TableOptions): TableMobject;
|
|
116
|
+
/** A Table of `MathTex` entries (Manim `MathTable`). */
|
|
117
|
+
export declare function MathTable(table: readonly (readonly Entry[])[], opts?: TableOptions): TableMobject;
|
|
118
|
+
/** A Table of mobjects as they are (Manim `MobjectTable`). */
|
|
119
|
+
export declare function MobjectTable(table: readonly (readonly Mobject[])[], opts?: TableOptions): TableMobject;
|
|
120
|
+
/** A Table of `Integer` entries (Manim `IntegerTable`). */
|
|
121
|
+
export declare function IntegerTable(table: readonly (readonly Entry[])[], opts?: TableOptions): TableMobject;
|
|
122
|
+
/** A Table of `DecimalNumber` entries with one decimal place (Manim `DecimalTable`). */
|
|
123
|
+
export declare function DecimalTable(table: readonly (readonly Entry[])[], opts?: TableOptions): TableMobject;
|
|
124
|
+
/** The options of Matrix (Manim's keyword arguments). */
|
|
125
|
+
export interface MatrixOptions {
|
|
126
|
+
vBuff?: number;
|
|
127
|
+
hBuff?: number;
|
|
128
|
+
bracketHBuff?: number;
|
|
129
|
+
bracketVBuff?: number;
|
|
130
|
+
addBackgroundRectanglesToEntries?: boolean;
|
|
131
|
+
includeBackgroundRectangle?: boolean;
|
|
132
|
+
elementToMobject?: ElementToMobject;
|
|
133
|
+
elementToMobjectConfig?: ElementConfig;
|
|
134
|
+
elementAlignmentCorner?: Point;
|
|
135
|
+
leftBracket?: string;
|
|
136
|
+
rightBracket?: string;
|
|
137
|
+
stretchBrackets?: boolean;
|
|
138
|
+
bracketConfig?: {
|
|
139
|
+
fontSize?: number;
|
|
140
|
+
color?: Color;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** A matrix: Manim's `Matrix`. Its submobjects are the entries (one VGroup) and the brackets. */
|
|
144
|
+
export declare class MatrixMobject extends Mobject {
|
|
145
|
+
#private;
|
|
146
|
+
constructor(handle: RawMobject, mobMatrix: Mobject[][], elements: Mobject, brackets: Mobject);
|
|
147
|
+
getColumns(): Mobject;
|
|
148
|
+
getRows(): Mobject;
|
|
149
|
+
setColumnColors(...colors: Color[]): this;
|
|
150
|
+
setRowColors(...colors: Color[]): this;
|
|
151
|
+
/** A BackgroundRectangle behind each entry. */
|
|
152
|
+
addBackgroundToEntries(): this;
|
|
153
|
+
/** The entries as rows of mobjects (Manim `mob_matrix`). */
|
|
154
|
+
getMobMatrix(): Mobject[][];
|
|
155
|
+
getEntries(): Mobject;
|
|
156
|
+
/** The left and the right bracket. */
|
|
157
|
+
getBrackets(): Mobject;
|
|
158
|
+
copy(): MatrixMobject;
|
|
159
|
+
}
|
|
160
|
+
/** Manim's `Matrix(matrix, opts)`: each entry is `elementToMobject(entry, elementToMobjectConfig)`
|
|
161
|
+
* (a `MathTex` by default), between brackets that `\\left` and `\\right` draw. */
|
|
162
|
+
export declare function Matrix(matrix: readonly (readonly Entry[])[], opts?: MatrixOptions): MatrixMobject;
|
|
163
|
+
/** A Matrix of `DecimalNumber` entries with one decimal place (Manim `DecimalMatrix`). */
|
|
164
|
+
export declare function DecimalMatrix(matrix: readonly (readonly Entry[])[], opts?: MatrixOptions): MatrixMobject;
|
|
165
|
+
/** A Matrix of `Integer` entries (Manim `IntegerMatrix`). */
|
|
166
|
+
export declare function IntegerMatrix(matrix: readonly (readonly Entry[])[], opts?: MatrixOptions): MatrixMobject;
|
|
167
|
+
/** A Matrix of mobjects as they are (Manim `MobjectMatrix`). */
|
|
168
|
+
export declare function MobjectMatrix(matrix: readonly (readonly Mobject[])[], opts?: MatrixOptions): MatrixMobject;
|
|
169
|
+
/** The LaTeX of a matrix (a list is one column) in brackets (Manim `matrix_to_tex_string`). */
|
|
170
|
+
export declare function matrixToTexString(matrix: readonly (readonly Entry[])[] | readonly Entry[]): string;
|
|
171
|
+
/** `MathTex(matrixToTexString(matrix))` (Manim `matrix_to_mobject`). */
|
|
172
|
+
export declare function matrixToMobject(matrix: readonly (readonly Entry[])[] | readonly Entry[]): Mobject;
|
|
173
|
+
/** `det(…)` around a Matrix, and `= determinant` with a determinant (Manim `get_det_text`). */
|
|
174
|
+
export declare function getDetText(matrix: Mobject, opts?: {
|
|
175
|
+
determinant?: number | string;
|
|
176
|
+
backgroundRect?: boolean;
|
|
177
|
+
initialScaleFactor?: number;
|
|
178
|
+
}): Mobject;
|
|
179
|
+
export {};
|