@elucim/dsl 0.4.1 → 0.6.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/dist/index.d.ts +21 -0
- package/dist/index.js +639 -583
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { easeOutBounce as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import { renderToStaticMarkup as
|
|
5
|
-
const
|
|
1
|
+
import { easeOutBounce as ne, easeOutElastic as se, easeOutBack as ce, easeInBack as le, easeInOutExpo as ue, easeOutExpo as he, easeInExpo as fe, easeInOutSine as ge, easeOutSine as oe, easeInSine as ye, easeInOutQuart as me, easeOutQuart as be, easeInQuart as xe, easeInOutCubic as ve, easeOutCubic as de, easeInCubic as ke, easeInOutQuad as we, easeOutQuad as Ie, easeInQuad as Se, linear as $e, spring as Oe, cubicBezier as Ae, Presentation as Ce, Scene as ze, Player as pe, Slide as Ee, Parallel as Fe, Stagger as Pe, Morph as Re, Transform as Ne, Write as Te, Draw as Me, FadeOut as We, FadeIn as _e, BarChart as De, LaTeX as Ve, Graph as Le, Matrix as je, Text as _, VectorField as qe, Vector as Be, FunctionPlot as Ue, Axes as He, Image as Ge, Polygon as Ke, Rect as Qe, Arrow as Xe, Line as Je, Circle as Ye, BezierCurve as Ze, Group as et, Sequence as tt } from "@elucim/core";
|
|
2
|
+
import { jsx as c, jsxs as F } from "react/jsx-runtime";
|
|
3
|
+
import H, { forwardRef as at, useRef as rt, useImperativeHandle as it } from "react";
|
|
4
|
+
import { renderToStaticMarkup as nt } from "react-dom/server";
|
|
5
|
+
const L = {
|
|
6
6
|
sin: Math.sin,
|
|
7
7
|
cos: Math.cos,
|
|
8
8
|
tan: Math.tan,
|
|
@@ -22,75 +22,75 @@ const D = {
|
|
|
22
22
|
max: (...e) => Math.max(...e),
|
|
23
23
|
sign: Math.sign,
|
|
24
24
|
pow: Math.pow
|
|
25
|
-
},
|
|
25
|
+
}, G = {
|
|
26
26
|
PI: Math.PI,
|
|
27
27
|
E: Math.E,
|
|
28
28
|
TAU: Math.PI * 2
|
|
29
29
|
};
|
|
30
|
-
function
|
|
30
|
+
function B(e) {
|
|
31
31
|
const a = [];
|
|
32
32
|
let t = 0;
|
|
33
33
|
for (; t < e.length; ) {
|
|
34
|
-
const
|
|
35
|
-
if (/\s/.test(
|
|
34
|
+
const r = e[t];
|
|
35
|
+
if (/\s/.test(r)) {
|
|
36
36
|
t++;
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
|
-
if (/[0-9]/.test(
|
|
39
|
+
if (/[0-9]/.test(r) || r === "." && t + 1 < e.length && /[0-9]/.test(e[t + 1])) {
|
|
40
40
|
let n = "";
|
|
41
|
-
const
|
|
41
|
+
const s = t;
|
|
42
42
|
for (; t < e.length && /[0-9.]/.test(e[t]); )
|
|
43
43
|
n += e[t++];
|
|
44
|
-
a.push({ type: "NUMBER", value: n, pos:
|
|
44
|
+
a.push({ type: "NUMBER", value: n, pos: s });
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
|
-
if (/[a-zA-Z_]/.test(
|
|
47
|
+
if (/[a-zA-Z_]/.test(r)) {
|
|
48
48
|
let n = "";
|
|
49
|
-
const
|
|
49
|
+
const s = t;
|
|
50
50
|
for (; t < e.length && /[a-zA-Z0-9_]/.test(e[t]); )
|
|
51
51
|
n += e[t++];
|
|
52
|
-
a.push({ type: "IDENT", value: n, pos:
|
|
52
|
+
a.push({ type: "IDENT", value: n, pos: s });
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
switch (t++,
|
|
55
|
+
const i = t;
|
|
56
|
+
switch (t++, r) {
|
|
57
57
|
case "+":
|
|
58
|
-
a.push({ type: "PLUS", value: "+", pos:
|
|
58
|
+
a.push({ type: "PLUS", value: "+", pos: i });
|
|
59
59
|
break;
|
|
60
60
|
case "-":
|
|
61
|
-
a.push({ type: "MINUS", value: "-", pos:
|
|
61
|
+
a.push({ type: "MINUS", value: "-", pos: i });
|
|
62
62
|
break;
|
|
63
63
|
case "*":
|
|
64
|
-
a.push({ type: "STAR", value: "*", pos:
|
|
64
|
+
a.push({ type: "STAR", value: "*", pos: i });
|
|
65
65
|
break;
|
|
66
66
|
case "/":
|
|
67
|
-
a.push({ type: "SLASH", value: "/", pos:
|
|
67
|
+
a.push({ type: "SLASH", value: "/", pos: i });
|
|
68
68
|
break;
|
|
69
69
|
case "^":
|
|
70
|
-
a.push({ type: "CARET", value: "^", pos:
|
|
70
|
+
a.push({ type: "CARET", value: "^", pos: i });
|
|
71
71
|
break;
|
|
72
72
|
case "(":
|
|
73
|
-
a.push({ type: "LPAREN", value: "(", pos:
|
|
73
|
+
a.push({ type: "LPAREN", value: "(", pos: i });
|
|
74
74
|
break;
|
|
75
75
|
case ")":
|
|
76
|
-
a.push({ type: "RPAREN", value: ")", pos:
|
|
76
|
+
a.push({ type: "RPAREN", value: ")", pos: i });
|
|
77
77
|
break;
|
|
78
78
|
case "[":
|
|
79
|
-
a.push({ type: "LBRACKET", value: "[", pos:
|
|
79
|
+
a.push({ type: "LBRACKET", value: "[", pos: i });
|
|
80
80
|
break;
|
|
81
81
|
case "]":
|
|
82
|
-
a.push({ type: "RBRACKET", value: "]", pos:
|
|
82
|
+
a.push({ type: "RBRACKET", value: "]", pos: i });
|
|
83
83
|
break;
|
|
84
84
|
case ",":
|
|
85
|
-
a.push({ type: "COMMA", value: ",", pos:
|
|
85
|
+
a.push({ type: "COMMA", value: ",", pos: i });
|
|
86
86
|
break;
|
|
87
87
|
default:
|
|
88
|
-
throw new
|
|
88
|
+
throw new I(`Unexpected character '${r}'`, i);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
return a.push({ type: "EOF", value: "", pos: t }), a;
|
|
92
92
|
}
|
|
93
|
-
class
|
|
93
|
+
class U {
|
|
94
94
|
constructor(a) {
|
|
95
95
|
this.pos = 0, this.tokens = a;
|
|
96
96
|
}
|
|
@@ -104,7 +104,7 @@ class B {
|
|
|
104
104
|
expect(a) {
|
|
105
105
|
const t = this.peek();
|
|
106
106
|
if (t.type !== a)
|
|
107
|
-
throw new
|
|
107
|
+
throw new I(
|
|
108
108
|
`Expected ${a} but got ${t.type} ('${t.value}')`,
|
|
109
109
|
t.pos
|
|
110
110
|
);
|
|
@@ -115,7 +115,7 @@ class B {
|
|
|
115
115
|
const a = this.parseExpression();
|
|
116
116
|
if (this.peek().type !== "EOF") {
|
|
117
117
|
const t = this.peek();
|
|
118
|
-
throw new
|
|
118
|
+
throw new I(
|
|
119
119
|
`Unexpected token '${t.value}' after expression`,
|
|
120
120
|
t.pos
|
|
121
121
|
);
|
|
@@ -126,8 +126,8 @@ class B {
|
|
|
126
126
|
parseExpression() {
|
|
127
127
|
let a = this.parseTerm();
|
|
128
128
|
for (; this.peek().type === "PLUS" || this.peek().type === "MINUS"; ) {
|
|
129
|
-
const t = this.advance().value,
|
|
130
|
-
a = { kind: "binary", op: t, left: a, right:
|
|
129
|
+
const t = this.advance().value, r = this.parseTerm();
|
|
130
|
+
a = { kind: "binary", op: t, left: a, right: r };
|
|
131
131
|
}
|
|
132
132
|
return a;
|
|
133
133
|
}
|
|
@@ -135,8 +135,8 @@ class B {
|
|
|
135
135
|
parseTerm() {
|
|
136
136
|
let a = this.parsePower();
|
|
137
137
|
for (; this.peek().type === "STAR" || this.peek().type === "SLASH"; ) {
|
|
138
|
-
const t = this.advance().value,
|
|
139
|
-
a = { kind: "binary", op: t, left: a, right:
|
|
138
|
+
const t = this.advance().value, r = this.parsePower();
|
|
139
|
+
a = { kind: "binary", op: t, left: a, right: r };
|
|
140
140
|
}
|
|
141
141
|
return a;
|
|
142
142
|
}
|
|
@@ -164,18 +164,18 @@ class B {
|
|
|
164
164
|
const t = a.value;
|
|
165
165
|
if (this.peek().type === "LPAREN") {
|
|
166
166
|
this.advance();
|
|
167
|
-
const
|
|
167
|
+
const r = [];
|
|
168
168
|
if (this.peek().type !== "RPAREN")
|
|
169
|
-
for (
|
|
170
|
-
this.advance(),
|
|
171
|
-
if (this.expect("RPAREN"), !Object.prototype.hasOwnProperty.call(
|
|
172
|
-
throw new
|
|
173
|
-
`Unknown function '${t}'. Available: ${Object.keys(
|
|
169
|
+
for (r.push(this.parseExpression()); this.peek().type === "COMMA"; )
|
|
170
|
+
this.advance(), r.push(this.parseExpression());
|
|
171
|
+
if (this.expect("RPAREN"), !Object.prototype.hasOwnProperty.call(L, t))
|
|
172
|
+
throw new I(
|
|
173
|
+
`Unknown function '${t}'. Available: ${Object.keys(L).join(", ")}`,
|
|
174
174
|
a.pos
|
|
175
175
|
);
|
|
176
|
-
return { kind: "call", name: t, args:
|
|
176
|
+
return { kind: "call", name: t, args: r };
|
|
177
177
|
}
|
|
178
|
-
return Object.prototype.hasOwnProperty.call(
|
|
178
|
+
return Object.prototype.hasOwnProperty.call(G, t) ? { kind: "number", value: G[t] } : { kind: "variable", name: t };
|
|
179
179
|
}
|
|
180
180
|
if (a.type === "LPAREN") {
|
|
181
181
|
this.advance();
|
|
@@ -190,128 +190,128 @@ class B {
|
|
|
190
190
|
this.advance(), t.push(this.parseExpression());
|
|
191
191
|
return this.expect("RBRACKET"), { kind: "array", elements: t };
|
|
192
192
|
}
|
|
193
|
-
throw new
|
|
193
|
+
throw new I(
|
|
194
194
|
`Unexpected token '${a.value}'`,
|
|
195
195
|
a.pos
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function z(e, a) {
|
|
200
200
|
switch (e.kind) {
|
|
201
201
|
case "number":
|
|
202
202
|
return e.value;
|
|
203
203
|
case "variable":
|
|
204
204
|
if (Object.prototype.hasOwnProperty.call(a, e.name)) return a[e.name];
|
|
205
|
-
throw new
|
|
205
|
+
throw new I(`Unknown variable '${e.name}'`, 0);
|
|
206
206
|
case "unary":
|
|
207
|
-
const t =
|
|
207
|
+
const t = z(e.operand, a);
|
|
208
208
|
return e.op === "-" ? -t : t;
|
|
209
209
|
case "binary": {
|
|
210
|
-
const
|
|
210
|
+
const r = z(e.left, a), i = z(e.right, a);
|
|
211
211
|
switch (e.op) {
|
|
212
212
|
case "+":
|
|
213
|
-
return
|
|
213
|
+
return r + i;
|
|
214
214
|
case "-":
|
|
215
|
-
return
|
|
215
|
+
return r - i;
|
|
216
216
|
case "*":
|
|
217
|
-
return
|
|
217
|
+
return r * i;
|
|
218
218
|
case "/":
|
|
219
|
-
return
|
|
219
|
+
return i === 0 ? 1 / 0 : r / i;
|
|
220
220
|
case "^":
|
|
221
|
-
return Math.pow(
|
|
221
|
+
return Math.pow(r, i);
|
|
222
222
|
}
|
|
223
223
|
break;
|
|
224
224
|
}
|
|
225
225
|
case "call": {
|
|
226
|
-
const
|
|
227
|
-
return
|
|
226
|
+
const r = L[e.name], i = e.args.map((n) => z(n, a));
|
|
227
|
+
return r(...i);
|
|
228
228
|
}
|
|
229
229
|
case "array":
|
|
230
|
-
return e.elements.map((
|
|
230
|
+
return e.elements.map((r) => z(r, a));
|
|
231
231
|
}
|
|
232
|
-
throw new
|
|
232
|
+
throw new I("Invalid AST node", 0);
|
|
233
233
|
}
|
|
234
|
-
class
|
|
234
|
+
class I extends Error {
|
|
235
235
|
constructor(a, t) {
|
|
236
236
|
super(a), this.name = "ExpressionError", this.position = t;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
const a =
|
|
241
|
-
return (
|
|
239
|
+
function st(e) {
|
|
240
|
+
const a = B(e), t = new U(a).parse();
|
|
241
|
+
return (r) => z(t, r);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
244
|
-
const a =
|
|
243
|
+
function ct(e) {
|
|
244
|
+
const a = B(e), t = new U(a).parse();
|
|
245
245
|
if (t.kind !== "array" || t.elements.length !== 2)
|
|
246
|
-
throw new
|
|
246
|
+
throw new I(
|
|
247
247
|
'Vector expression must be an array of 2 elements, e.g. "[-y, x]"',
|
|
248
248
|
0
|
|
249
249
|
);
|
|
250
|
-
return (
|
|
250
|
+
return (r) => z(t, r);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function J(e) {
|
|
253
253
|
try {
|
|
254
|
-
const a =
|
|
255
|
-
return new
|
|
254
|
+
const a = B(e);
|
|
255
|
+
return new U(a).parse(), null;
|
|
256
256
|
} catch (a) {
|
|
257
|
-
return a instanceof
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
const
|
|
261
|
-
linear:
|
|
262
|
-
easeInQuad:
|
|
263
|
-
easeOutQuad:
|
|
264
|
-
easeInOutQuad:
|
|
265
|
-
easeInCubic:
|
|
266
|
-
easeOutCubic:
|
|
267
|
-
easeInOutCubic:
|
|
268
|
-
easeInQuart:
|
|
269
|
-
easeOutQuart:
|
|
270
|
-
easeInOutQuart:
|
|
271
|
-
easeInSine:
|
|
272
|
-
easeOutSine:
|
|
273
|
-
easeInOutSine:
|
|
274
|
-
easeInExpo:
|
|
275
|
-
easeOutExpo:
|
|
276
|
-
easeInOutExpo:
|
|
277
|
-
easeInBack:
|
|
278
|
-
easeOutBack:
|
|
279
|
-
easeOutElastic:
|
|
280
|
-
easeOutBounce:
|
|
257
|
+
return a instanceof I ? `${a.message} (at position ${a.position})` : String(a);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const j = {
|
|
261
|
+
linear: $e,
|
|
262
|
+
easeInQuad: Se,
|
|
263
|
+
easeOutQuad: Ie,
|
|
264
|
+
easeInOutQuad: we,
|
|
265
|
+
easeInCubic: ke,
|
|
266
|
+
easeOutCubic: de,
|
|
267
|
+
easeInOutCubic: ve,
|
|
268
|
+
easeInQuart: xe,
|
|
269
|
+
easeOutQuart: be,
|
|
270
|
+
easeInOutQuart: me,
|
|
271
|
+
easeInSine: ye,
|
|
272
|
+
easeOutSine: oe,
|
|
273
|
+
easeInOutSine: ge,
|
|
274
|
+
easeInExpo: fe,
|
|
275
|
+
easeOutExpo: he,
|
|
276
|
+
easeInOutExpo: ue,
|
|
277
|
+
easeInBack: le,
|
|
278
|
+
easeOutBack: ce,
|
|
279
|
+
easeOutElastic: se,
|
|
280
|
+
easeOutBounce: ne
|
|
281
281
|
};
|
|
282
|
-
function
|
|
282
|
+
function g(e) {
|
|
283
283
|
if (e !== void 0) {
|
|
284
284
|
if (typeof e == "string") {
|
|
285
|
-
const a =
|
|
285
|
+
const a = j[e];
|
|
286
286
|
if (!a) {
|
|
287
|
-
const t = Object.keys(
|
|
288
|
-
throw new Error(`Unknown easing '${e}'.${
|
|
287
|
+
const t = Object.keys(j), r = t.find((n) => n.toLowerCase() === e.toLowerCase()), i = r ? ` Did you mean '${r}'?` : "";
|
|
288
|
+
throw new Error(`Unknown easing '${e}'.${i} Available: ${t.join(", ")}`);
|
|
289
289
|
}
|
|
290
290
|
return a;
|
|
291
291
|
}
|
|
292
292
|
if (e.type === "spring")
|
|
293
|
-
return
|
|
293
|
+
return Oe({
|
|
294
294
|
stiffness: e.stiffness,
|
|
295
295
|
damping: e.damping,
|
|
296
296
|
mass: e.mass
|
|
297
297
|
});
|
|
298
298
|
if (e.type === "cubicBezier")
|
|
299
|
-
return
|
|
299
|
+
return Ae(e.x1, e.y1, e.x2, e.y2);
|
|
300
300
|
throw new Error(`Unknown easing type: ${e.type}`);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
const
|
|
304
|
-
function
|
|
303
|
+
const D = Object.keys(j);
|
|
304
|
+
function Y(e) {
|
|
305
305
|
const a = [];
|
|
306
306
|
if (!e || typeof e != "object")
|
|
307
307
|
return a.push({ path: "", message: "Document must be an object", severity: "error" }), { valid: !1, errors: a };
|
|
308
308
|
const t = e;
|
|
309
|
-
return t.version !== "1.0" && a.push({ path: "version", message: `Expected version "1.0", got "${t.version}"`, severity: "error" }), !t.root || typeof t.root != "object" ? (a.push({ path: "root", message: 'Missing or invalid "root" node', severity: "error" }), { valid: a.filter((
|
|
310
|
-
valid: a.filter((
|
|
309
|
+
return t.version !== "1.0" && a.push({ path: "version", message: `Expected version "1.0", got "${t.version}"`, severity: "error" }), !t.root || typeof t.root != "object" ? (a.push({ path: "root", message: 'Missing or invalid "root" node', severity: "error" }), { valid: a.filter((r) => r.severity === "error").length === 0, errors: a }) : (lt(t.root, "root", a), {
|
|
310
|
+
valid: a.filter((r) => r.severity === "error").length === 0,
|
|
311
311
|
errors: a
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const K = ["scene", "player", "presentation"], T = ["card", "slide", "square"], V = [
|
|
315
315
|
"sequence",
|
|
316
316
|
"group",
|
|
317
317
|
"bezierCurve",
|
|
@@ -340,290 +340,290 @@ const H = ["scene", "player", "presentation"], T = ["card", "slide", "square"],
|
|
|
340
340
|
"parallel",
|
|
341
341
|
"player",
|
|
342
342
|
"scene"
|
|
343
|
-
],
|
|
344
|
-
function
|
|
345
|
-
const
|
|
346
|
-
if (!
|
|
347
|
-
t.push({ path: `${a}.type`, message: `Root type must be one of: ${
|
|
343
|
+
], Q = ["none", "fade", "slide-left", "slide-up", "zoom"];
|
|
344
|
+
function lt(e, a, t) {
|
|
345
|
+
const r = e.type;
|
|
346
|
+
if (!K.includes(r)) {
|
|
347
|
+
t.push({ path: `${a}.type`, message: `Root type must be one of: ${K.join(", ")}. Got "${r}"`, severity: "error" });
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
350
|
-
|
|
350
|
+
r === "scene" || r === "player" ? Z(e, a, r, t) : r === "presentation" && ut(e, a, t);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
353
|
-
|
|
352
|
+
function Z(e, a, t, r) {
|
|
353
|
+
Tt(e, "durationInFrames", a, r), m(e, "width", a, r), m(e, "height", a, r), m(e, "fps", a, r), $(e, "background", a, r), e.preset !== void 0 && (typeof e.preset != "string" || !T.includes(e.preset)) && r.push({ path: `${a}.preset`, message: `preset must be one of: ${T.join(", ")}. Got "${e.preset}"`, severity: "error" }), t === "player" && (N(e, "controls", a, r), N(e, "loop", a, r), N(e, "autoPlay", a, r)), O(e, a, r);
|
|
354
354
|
}
|
|
355
|
-
function
|
|
356
|
-
if (
|
|
355
|
+
function ut(e, a, t) {
|
|
356
|
+
if (m(e, "width", a, t), m(e, "height", a, t), $(e, "background", a, t), m(e, "transitionDuration", a, t), N(e, "showHud", a, t), N(e, "showNotes", a, t), e.preset !== void 0 && (typeof e.preset != "string" || !T.includes(e.preset)) && t.push({ path: `${a}.preset`, message: `preset must be one of: ${T.join(", ")}. Got "${e.preset}"`, severity: "error" }), e.transition !== void 0 && (Q.includes(e.transition) || t.push({
|
|
357
357
|
path: `${a}.transition`,
|
|
358
|
-
message: `Invalid transition "${e.transition}". Must be one of: ${
|
|
358
|
+
message: `Invalid transition "${e.transition}". Must be one of: ${Q.join(", ")}`,
|
|
359
359
|
severity: "error"
|
|
360
360
|
})), !Array.isArray(e.slides)) {
|
|
361
361
|
t.push({ path: `${a}.slides`, message: 'Presentation must have a "slides" array', severity: "error" });
|
|
362
362
|
return;
|
|
363
363
|
}
|
|
364
|
-
e.slides.length === 0 && t.push({ path: `${a}.slides`, message: "Presentation must have at least one slide", severity: "warning" }), e.slides.forEach((
|
|
365
|
-
|
|
364
|
+
e.slides.length === 0 && t.push({ path: `${a}.slides`, message: "Presentation must have at least one slide", severity: "warning" }), e.slides.forEach((r, i) => {
|
|
365
|
+
ht(r, `${a}.slides[${i}]`, t);
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function ht(e, a, t) {
|
|
369
369
|
if (!e || typeof e != "object") {
|
|
370
370
|
t.push({ path: a, message: "Slide must be an object", severity: "error" });
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
|
-
|
|
374
|
-
|
|
373
|
+
$(e, "title", a, t), $(e, "notes", a, t), $(e, "background", a, t), e.children !== void 0 && (Array.isArray(e.children) ? e.children.forEach((r, i) => {
|
|
374
|
+
ee(r, `${a}.children[${i}]`, t);
|
|
375
375
|
}) : t.push({ path: `${a}.children`, message: "Slide children must be an array", severity: "error" }));
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function O(e, a, t) {
|
|
378
378
|
if (!Array.isArray(e.children)) {
|
|
379
379
|
t.push({ path: `${a}.children`, message: 'Expected "children" array', severity: "error" });
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
|
-
e.children.forEach((
|
|
383
|
-
|
|
382
|
+
e.children.forEach((r, i) => {
|
|
383
|
+
ee(r, `${a}.children[${i}]`, t);
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function ee(e, a, t) {
|
|
387
387
|
if (!e || typeof e != "object") {
|
|
388
388
|
t.push({ path: a, message: "Element must be an object", severity: "error" });
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
|
-
const
|
|
392
|
-
if (!
|
|
393
|
-
const
|
|
391
|
+
const r = e.type;
|
|
392
|
+
if (!r || !V.includes(r)) {
|
|
393
|
+
const i = r ? te(r, V) : "";
|
|
394
394
|
t.push({
|
|
395
395
|
path: `${a}.type`,
|
|
396
|
-
message: `Unknown element type "${
|
|
396
|
+
message: `Unknown element type "${r}".${i} Valid types: ${V.join(", ")}`,
|
|
397
397
|
severity: "error"
|
|
398
398
|
});
|
|
399
399
|
return;
|
|
400
400
|
}
|
|
401
|
-
switch (
|
|
401
|
+
switch (r) {
|
|
402
402
|
case "bezierCurve":
|
|
403
|
-
|
|
403
|
+
ft(e, a, t);
|
|
404
404
|
break;
|
|
405
405
|
case "circle":
|
|
406
|
-
|
|
406
|
+
gt(e, a, t);
|
|
407
407
|
break;
|
|
408
408
|
case "line":
|
|
409
|
-
|
|
409
|
+
ot(e, a, t);
|
|
410
410
|
break;
|
|
411
411
|
case "arrow":
|
|
412
|
-
|
|
412
|
+
yt(e, a, t);
|
|
413
413
|
break;
|
|
414
414
|
case "rect":
|
|
415
|
-
|
|
415
|
+
mt(e, a, t);
|
|
416
416
|
break;
|
|
417
417
|
case "polygon":
|
|
418
|
-
|
|
418
|
+
bt(e, a, t);
|
|
419
419
|
break;
|
|
420
420
|
case "text":
|
|
421
|
-
|
|
421
|
+
xt(e, a, t);
|
|
422
422
|
break;
|
|
423
423
|
case "image":
|
|
424
|
-
|
|
424
|
+
Pt(e, a, t);
|
|
425
425
|
break;
|
|
426
426
|
case "axes":
|
|
427
|
-
|
|
427
|
+
vt(e, a, t);
|
|
428
428
|
break;
|
|
429
429
|
case "functionPlot":
|
|
430
|
-
|
|
430
|
+
dt(e, a, t);
|
|
431
431
|
break;
|
|
432
432
|
case "vector":
|
|
433
|
-
|
|
433
|
+
kt(e, a, t);
|
|
434
434
|
break;
|
|
435
435
|
case "vectorField":
|
|
436
|
-
|
|
436
|
+
wt(e, a, t);
|
|
437
437
|
break;
|
|
438
438
|
case "matrix":
|
|
439
|
-
|
|
439
|
+
It(e, a, t);
|
|
440
440
|
break;
|
|
441
441
|
case "graph":
|
|
442
|
-
|
|
442
|
+
St(e, a, t);
|
|
443
443
|
break;
|
|
444
444
|
case "latex":
|
|
445
|
-
|
|
445
|
+
$t(e, a, t);
|
|
446
446
|
break;
|
|
447
447
|
case "barChart":
|
|
448
|
-
|
|
448
|
+
Nt(e, a, t);
|
|
449
449
|
break;
|
|
450
450
|
case "sequence":
|
|
451
|
-
|
|
451
|
+
Ot(e, a, t);
|
|
452
452
|
break;
|
|
453
453
|
case "group":
|
|
454
|
-
|
|
454
|
+
Rt(e, a, t);
|
|
455
455
|
break;
|
|
456
456
|
case "parallel":
|
|
457
|
-
|
|
457
|
+
O(e, a, t);
|
|
458
458
|
break;
|
|
459
459
|
case "fadeIn":
|
|
460
460
|
case "fadeOut":
|
|
461
461
|
case "draw":
|
|
462
462
|
case "write":
|
|
463
|
-
|
|
463
|
+
At(e, a, t);
|
|
464
464
|
break;
|
|
465
465
|
case "transform":
|
|
466
|
-
|
|
466
|
+
Ct(e, a, t);
|
|
467
467
|
break;
|
|
468
468
|
case "morph":
|
|
469
|
-
|
|
469
|
+
zt(e, a, t);
|
|
470
470
|
break;
|
|
471
471
|
case "stagger":
|
|
472
|
-
|
|
472
|
+
pt(e, a, t);
|
|
473
473
|
break;
|
|
474
474
|
case "scene":
|
|
475
475
|
case "player":
|
|
476
|
-
|
|
476
|
+
Z(e, a, r, t);
|
|
477
477
|
break;
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
function ut(e, a, t) {
|
|
481
|
-
l(e, "x1", a, t), l(e, "y1", a, t), l(e, "cx1", a, t), l(e, "cy1", a, t), l(e, "x2", a, t), l(e, "y2", a, t), e.cx2 !== void 0 && F(e, "cx2", a, t), e.cy2 !== void 0 && F(e, "cy2", a, t), x(e, a, t);
|
|
482
|
-
}
|
|
483
|
-
function ht(e, a, t) {
|
|
484
|
-
l(e, "cx", a, t), l(e, "cy", a, t), z(e, "r", a, t), x(e, a, t);
|
|
485
|
-
}
|
|
486
480
|
function ft(e, a, t) {
|
|
487
|
-
|
|
481
|
+
f(e, "x1", a, t), f(e, "y1", a, t), f(e, "cx1", a, t), f(e, "cy1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), e.cx2 !== void 0 && P(e, "cx2", a, t), e.cy2 !== void 0 && P(e, "cy2", a, t), d(e, a, t);
|
|
488
482
|
}
|
|
489
483
|
function gt(e, a, t) {
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
function yt(e, a, t) {
|
|
493
|
-
l(e, "x", a, t), l(e, "y", a, t), z(e, "width", a, t), z(e, "height", a, t), x(e, a, t);
|
|
484
|
+
f(e, "cx", a, t), f(e, "cy", a, t), p(e, "r", a, t), d(e, a, t);
|
|
494
485
|
}
|
|
495
486
|
function ot(e, a, t) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
487
|
+
f(e, "x1", a, t), f(e, "y1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), d(e, a, t);
|
|
488
|
+
}
|
|
489
|
+
function yt(e, a, t) {
|
|
490
|
+
f(e, "x1", a, t), f(e, "y1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), d(e, a, t);
|
|
499
491
|
}
|
|
500
492
|
function mt(e, a, t) {
|
|
501
|
-
|
|
493
|
+
f(e, "x", a, t), f(e, "y", a, t), p(e, "width", a, t), p(e, "height", a, t), d(e, a, t);
|
|
502
494
|
}
|
|
503
495
|
function bt(e, a, t) {
|
|
504
|
-
|
|
496
|
+
Array.isArray(e.points) ? e.points.length < 3 ? t.push({ path: `${a}.points`, message: "Polygon requires at least 3 points", severity: "error" }) : e.points.forEach((r, i) => {
|
|
497
|
+
(!Array.isArray(r) || r.length !== 2 || typeof r[0] != "number" || typeof r[1] != "number") && t.push({ path: `${a}.points[${i}]`, message: "Each point must be [number, number]", severity: "error" });
|
|
498
|
+
}) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }), d(e, a, t);
|
|
505
499
|
}
|
|
506
500
|
function xt(e, a, t) {
|
|
501
|
+
f(e, "x", a, t), f(e, "y", a, t), typeof e.content != "string" && t.push({ path: `${a}.content`, message: 'Text requires a "content" string', severity: "error" }), d(e, a, t);
|
|
502
|
+
}
|
|
503
|
+
function vt(e, a, t) {
|
|
504
|
+
k(e, "domain", a, t), k(e, "range", a, t), k(e, "origin", a, t), M(e, a, t);
|
|
505
|
+
}
|
|
506
|
+
function dt(e, a, t) {
|
|
507
507
|
if (typeof e.fn != "string")
|
|
508
508
|
t.push({ path: `${a}.fn`, message: 'FunctionPlot requires a "fn" expression string', severity: "error" });
|
|
509
509
|
else {
|
|
510
|
-
const
|
|
511
|
-
|
|
510
|
+
const r = J(e.fn);
|
|
511
|
+
r && t.push({ path: `${a}.fn`, message: `Invalid expression: ${r}`, severity: "error" });
|
|
512
512
|
}
|
|
513
|
-
|
|
513
|
+
k(e, "domain", a, t), M(e, a, t);
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
(!Array.isArray(e.to) || e.to.length !== 2) && t.push({ path: `${a}.to`, message: 'Vector requires a "to" array of [number, number]', severity: "error" }),
|
|
515
|
+
function kt(e, a, t) {
|
|
516
|
+
(!Array.isArray(e.to) || e.to.length !== 2) && t.push({ path: `${a}.to`, message: 'Vector requires a "to" array of [number, number]', severity: "error" }), k(e, "from", a, t), M(e, a, t);
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function wt(e, a, t) {
|
|
519
519
|
if (typeof e.fn != "string")
|
|
520
520
|
t.push({ path: `${a}.fn`, message: 'VectorField requires a "fn" expression string', severity: "error" });
|
|
521
521
|
else {
|
|
522
|
-
const
|
|
523
|
-
|
|
522
|
+
const r = J(e.fn);
|
|
523
|
+
r && t.push({ path: `${a}.fn`, message: `Invalid vector expression: ${r}`, severity: "error" });
|
|
524
524
|
}
|
|
525
|
-
|
|
525
|
+
k(e, "domain", a, t), k(e, "range", a, t), M(e, a, t);
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
Array.isArray(e.values) ? e.values.forEach((
|
|
529
|
-
Array.isArray(
|
|
530
|
-
}) : t.push({ path: `${a}.values`, message: 'Matrix requires a "values" 2D array', severity: "error" }),
|
|
527
|
+
function It(e, a, t) {
|
|
528
|
+
Array.isArray(e.values) ? e.values.forEach((r, i) => {
|
|
529
|
+
Array.isArray(r) || t.push({ path: `${a}.values[${i}]`, message: "Each matrix row must be an array", severity: "error" });
|
|
530
|
+
}) : t.push({ path: `${a}.values`, message: 'Matrix requires a "values" 2D array', severity: "error" }), d(e, a, t);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function St(e, a, t) {
|
|
533
533
|
if (!Array.isArray(e.nodes))
|
|
534
534
|
t.push({ path: `${a}.nodes`, message: 'Graph requires a "nodes" array', severity: "error" });
|
|
535
535
|
else {
|
|
536
|
-
const
|
|
537
|
-
e.nodes.forEach((
|
|
538
|
-
typeof
|
|
539
|
-
}), Array.isArray(e.edges) && e.edges.forEach((
|
|
540
|
-
(typeof
|
|
536
|
+
const r = /* @__PURE__ */ new Set();
|
|
537
|
+
e.nodes.forEach((i, n) => {
|
|
538
|
+
typeof i.id != "string" ? t.push({ path: `${a}.nodes[${n}].id`, message: 'Graph node requires a string "id"', severity: "error" }) : (r.has(i.id) && t.push({ path: `${a}.nodes[${n}].id`, message: `Duplicate node id "${i.id}"`, severity: "error" }), r.add(i.id)), f(i, "x", `${a}.nodes[${n}]`, t), f(i, "y", `${a}.nodes[${n}]`, t);
|
|
539
|
+
}), Array.isArray(e.edges) && e.edges.forEach((i, n) => {
|
|
540
|
+
(typeof i.from != "string" || !r.has(i.from)) && t.push({ path: `${a}.edges[${n}].from`, message: `Edge "from" references unknown node "${i.from}"`, severity: "error" }), (typeof i.to != "string" || !r.has(i.to)) && t.push({ path: `${a}.edges[${n}].to`, message: `Edge "to" references unknown node "${i.to}"`, severity: "error" });
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
function It(e, a, t) {
|
|
546
|
-
typeof e.expression != "string" && t.push({ path: `${a}.expression`, message: 'LaTeX requires an "expression" string', severity: "error" }), l(e, "x", a, t), l(e, "y", a, t), x(e, a, t);
|
|
547
|
-
}
|
|
548
|
-
function St(e, a, t) {
|
|
549
|
-
l(e, "from", a, t), Tt(e, "durationInFrames", a, t), $(e, a, t);
|
|
543
|
+
d(e, a, t);
|
|
550
544
|
}
|
|
551
545
|
function $t(e, a, t) {
|
|
552
|
-
|
|
546
|
+
typeof e.expression != "string" && t.push({ path: `${a}.expression`, message: 'LaTeX requires an "expression" string', severity: "error" }), f(e, "x", a, t), f(e, "y", a, t), d(e, a, t);
|
|
553
547
|
}
|
|
554
548
|
function Ot(e, a, t) {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
549
|
+
f(e, "from", a, t), Mt(e, "durationInFrames", a, t), O(e, a, t);
|
|
550
|
+
}
|
|
551
|
+
function At(e, a, t) {
|
|
552
|
+
m(e, "duration", a, t), R(e, a, t), O(e, a, t);
|
|
553
|
+
}
|
|
554
|
+
function Ct(e, a, t) {
|
|
555
|
+
if (m(e, "duration", a, t), R(e, a, t), e.translate !== void 0) {
|
|
556
|
+
const r = e.translate;
|
|
557
|
+
(!r || typeof r != "object") && t.push({ path: `${a}.translate`, message: "translate must be { from: [x,y], to: [x,y] }", severity: "error" });
|
|
558
558
|
}
|
|
559
559
|
if (e.scale !== void 0) {
|
|
560
|
-
const
|
|
561
|
-
(!
|
|
560
|
+
const r = e.scale;
|
|
561
|
+
(!r || typeof r != "object" || typeof r.from != "number" || typeof r.to != "number") && t.push({ path: `${a}.scale`, message: "scale must be { from: number, to: number }", severity: "error" });
|
|
562
562
|
}
|
|
563
563
|
if (e.rotate !== void 0) {
|
|
564
|
-
const
|
|
565
|
-
(!
|
|
564
|
+
const r = e.rotate;
|
|
565
|
+
(!r || typeof r != "object" || typeof r.from != "number" || typeof r.to != "number") && t.push({ path: `${a}.rotate`, message: "rotate must be { from: number, to: number }", severity: "error" });
|
|
566
566
|
}
|
|
567
567
|
if (e.opacity !== void 0) {
|
|
568
|
-
const
|
|
569
|
-
(!
|
|
568
|
+
const r = e.opacity;
|
|
569
|
+
(!r || typeof r != "object" || typeof r.from != "number" || typeof r.to != "number") && t.push({ path: `${a}.opacity`, message: "opacity must be { from: number, to: number }", severity: "error" });
|
|
570
570
|
}
|
|
571
|
-
|
|
571
|
+
O(e, a, t);
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
|
|
573
|
+
function zt(e, a, t) {
|
|
574
|
+
m(e, "duration", a, t), R(e, a, t), $(e, "fromColor", a, t), $(e, "toColor", a, t), O(e, a, t);
|
|
575
575
|
}
|
|
576
|
-
function
|
|
577
|
-
|
|
576
|
+
function pt(e, a, t) {
|
|
577
|
+
m(e, "staggerDelay", a, t), R(e, a, t), O(e, a, t);
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
|
|
579
|
+
function d(e, a, t) {
|
|
580
|
+
m(e, "fadeIn", a, t), m(e, "fadeOut", a, t), m(e, "draw", a, t), R(e, a, t), Et(e, a, t);
|
|
581
581
|
}
|
|
582
582
|
function M(e, a, t) {
|
|
583
|
-
|
|
583
|
+
m(e, "fadeIn", a, t), m(e, "fadeOut", a, t), m(e, "draw", a, t), R(e, a, t), Ft(e, a, t);
|
|
584
584
|
}
|
|
585
|
-
const
|
|
586
|
-
function
|
|
587
|
-
if (
|
|
588
|
-
const
|
|
589
|
-
typeof
|
|
585
|
+
const X = ["none", "circle", "ellipse"];
|
|
586
|
+
function Et(e, a, t) {
|
|
587
|
+
if (P(e, "rotation", a, t), k(e, "rotationOrigin", a, t), k(e, "translate", a, t), P(e, "zIndex", a, t), e.scale !== void 0) {
|
|
588
|
+
const r = e.scale;
|
|
589
|
+
typeof r == "number" || Array.isArray(r) && r.length === 2 && typeof r[0] == "number" && typeof r[1] == "number" || t.push({ path: `${a}.scale`, message: '"scale" must be a number or [number, number]', severity: "error" });
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
|
|
592
|
+
function Ft(e, a, t) {
|
|
593
|
+
P(e, "rotation", a, t), k(e, "rotationOrigin", a, t), k(e, "translate", a, t), P(e, "zIndex", a, t);
|
|
594
594
|
}
|
|
595
|
-
function
|
|
596
|
-
typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }),
|
|
595
|
+
function Pt(e, a, t) {
|
|
596
|
+
typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }), f(e, "x", a, t), f(e, "y", a, t), p(e, "width", a, t), p(e, "height", a, t), $(e, "preserveAspectRatio", a, t), e.borderRadius !== void 0 && (typeof e.borderRadius != "number" || e.borderRadius < 0) && t.push({ path: `${a}.borderRadius`, message: '"borderRadius" must be a number >= 0', severity: "error" }), e.clipShape !== void 0 && (X.includes(e.clipShape) || t.push({
|
|
597
597
|
path: `${a}.clipShape`,
|
|
598
|
-
message: `Invalid clipShape "${e.clipShape}". Must be one of: ${
|
|
598
|
+
message: `Invalid clipShape "${e.clipShape}". Must be one of: ${X.join(", ")}`,
|
|
599
599
|
severity: "error"
|
|
600
|
-
})),
|
|
600
|
+
})), d(e, a, t);
|
|
601
601
|
}
|
|
602
|
-
function
|
|
603
|
-
|
|
602
|
+
function Rt(e, a, t) {
|
|
603
|
+
O(e, a, t), d(e, a, t);
|
|
604
604
|
}
|
|
605
|
-
function
|
|
606
|
-
|
|
605
|
+
function Nt(e, a, t) {
|
|
606
|
+
f(e, "x", a, t), f(e, "y", a, t), p(e, "width", a, t), p(e, "height", a, t), Array.isArray(e.bars) || t.push({ path: `${a}.bars`, message: 'BarChart requires a "bars" array', severity: "error" }), d(e, a, t);
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function R(e, a, t) {
|
|
609
609
|
if (e.easing !== void 0) {
|
|
610
610
|
if (typeof e.easing == "string") {
|
|
611
|
-
if (!
|
|
612
|
-
const
|
|
611
|
+
if (!D.includes(e.easing)) {
|
|
612
|
+
const r = te(e.easing, D);
|
|
613
613
|
t.push({
|
|
614
614
|
path: `${a}.easing`,
|
|
615
|
-
message: `Unknown easing "${e.easing}".${
|
|
615
|
+
message: `Unknown easing "${e.easing}".${r} Available: ${D.join(", ")}`,
|
|
616
616
|
severity: "error"
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
619
|
return;
|
|
620
620
|
}
|
|
621
621
|
if (typeof e.easing == "object" && e.easing !== null) {
|
|
622
|
-
const
|
|
623
|
-
if (
|
|
624
|
-
if (
|
|
625
|
-
for (const
|
|
626
|
-
typeof i
|
|
622
|
+
const r = e.easing;
|
|
623
|
+
if (r.type === "spring") return;
|
|
624
|
+
if (r.type === "cubicBezier") {
|
|
625
|
+
for (const i of ["x1", "y1", "x2", "y2"])
|
|
626
|
+
typeof r[i] != "number" && t.push({ path: `${a}.easing.${i}`, message: `cubicBezier requires numeric "${i}"`, severity: "error" });
|
|
627
627
|
return;
|
|
628
628
|
}
|
|
629
629
|
t.push({ path: `${a}.easing.type`, message: 'Easing object type must be "spring" or "cubicBezier"', severity: "error" });
|
|
@@ -632,63 +632,83 @@ function P(e, a, t) {
|
|
|
632
632
|
t.push({ path: `${a}.easing`, message: 'Easing must be a string name or { type: "spring"|"cubicBezier", ... }', severity: "error" });
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
typeof e[a] != "number" &&
|
|
635
|
+
function f(e, a, t, r) {
|
|
636
|
+
typeof e[a] != "number" && r.push({ path: `${t}.${a}`, message: `Required numeric field "${a}" is missing or not a number`, severity: "error" });
|
|
637
637
|
}
|
|
638
|
-
function
|
|
639
|
-
(typeof e[a] != "number" || e[a] <= 0) &&
|
|
638
|
+
function p(e, a, t, r) {
|
|
639
|
+
(typeof e[a] != "number" || e[a] <= 0) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive number`, severity: "error" });
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
const
|
|
643
|
-
(typeof
|
|
641
|
+
function Tt(e, a, t, r) {
|
|
642
|
+
const i = e[a];
|
|
643
|
+
(typeof i != "number" || i <= 0 || !Number.isInteger(i)) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive integer`, severity: "error" });
|
|
644
644
|
}
|
|
645
|
-
function
|
|
646
|
-
e[a] !== void 0 && (typeof e[a] != "number" || e[a] <= 0) &&
|
|
645
|
+
function m(e, a, t, r) {
|
|
646
|
+
e[a] !== void 0 && (typeof e[a] != "number" || e[a] <= 0) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive number`, severity: "error" });
|
|
647
647
|
}
|
|
648
|
-
function
|
|
649
|
-
const
|
|
650
|
-
|
|
648
|
+
function Mt(e, a, t, r) {
|
|
649
|
+
const i = e[a];
|
|
650
|
+
i !== void 0 && (typeof i != "number" || i <= 0 || !Number.isInteger(i)) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive integer`, severity: "error" });
|
|
651
651
|
}
|
|
652
|
-
function
|
|
653
|
-
e[a] !== void 0 && typeof e[a] != "string" &&
|
|
652
|
+
function $(e, a, t, r) {
|
|
653
|
+
e[a] !== void 0 && typeof e[a] != "string" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a string`, severity: "error" });
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
e[a] !== void 0 && typeof e[a] != "number" &&
|
|
655
|
+
function P(e, a, t, r) {
|
|
656
|
+
e[a] !== void 0 && typeof e[a] != "number" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a number`, severity: "error" });
|
|
657
657
|
}
|
|
658
|
-
function
|
|
659
|
-
e[a] !== void 0 && typeof e[a] != "boolean" &&
|
|
658
|
+
function N(e, a, t, r) {
|
|
659
|
+
e[a] !== void 0 && typeof e[a] != "boolean" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a boolean`, severity: "error" });
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
const
|
|
663
|
-
|
|
661
|
+
function k(e, a, t, r) {
|
|
662
|
+
const i = e[a];
|
|
663
|
+
i !== void 0 && (!Array.isArray(i) || i.length !== 2 || typeof i[0] != "number" || typeof i[1] != "number") && r.push({ path: `${t}.${a}`, message: `"${a}" must be [number, number]`, severity: "error" });
|
|
664
664
|
}
|
|
665
|
-
function
|
|
666
|
-
const t = e.toLowerCase(),
|
|
667
|
-
if (
|
|
668
|
-
const
|
|
669
|
-
return
|
|
665
|
+
function te(e, a) {
|
|
666
|
+
const t = e.toLowerCase(), r = a.find((n) => n.toLowerCase() === t);
|
|
667
|
+
if (r) return ` Did you mean '${r}'?`;
|
|
668
|
+
const i = a.find((n) => n.toLowerCase().startsWith(t.slice(0, 4)));
|
|
669
|
+
return i ? ` Did you mean '${i}'?` : "";
|
|
670
|
+
}
|
|
671
|
+
const ae = {
|
|
672
|
+
foreground: { cssVar: "--elucim-foreground", fallback: "#e0e0e0" },
|
|
673
|
+
background: { cssVar: "--elucim-background", fallback: "#0f172a" },
|
|
674
|
+
accent: { cssVar: "--elucim-accent", fallback: "#4fc3f7" },
|
|
675
|
+
muted: { cssVar: "--elucim-muted", fallback: "#64748b" },
|
|
676
|
+
surface: { cssVar: "--elucim-surface", fallback: "#1e293b" },
|
|
677
|
+
border: { cssVar: "--elucim-border", fallback: "#334155" },
|
|
678
|
+
primary: { cssVar: "--elucim-primary", fallback: "#4fc3f7" },
|
|
679
|
+
secondary: { cssVar: "--elucim-secondary", fallback: "#a78bfa" },
|
|
680
|
+
tertiary: { cssVar: "--elucim-tertiary", fallback: "#f472b6" },
|
|
681
|
+
success: { cssVar: "--elucim-success", fallback: "#34d399" },
|
|
682
|
+
warning: { cssVar: "--elucim-warning", fallback: "#fbbf24" },
|
|
683
|
+
error: { cssVar: "--elucim-error", fallback: "#f87171" }
|
|
684
|
+
}, Qt = Object.keys(ae);
|
|
685
|
+
function h(e) {
|
|
686
|
+
if (e === void 0) return;
|
|
687
|
+
if (!e.startsWith("$")) return e;
|
|
688
|
+
const a = e.slice(1), t = ae[a];
|
|
689
|
+
return t ? `var(${t.cssVar}, ${t.fallback})` : `var(--elucim-${a})`;
|
|
670
690
|
}
|
|
671
|
-
const
|
|
691
|
+
const Wt = {
|
|
672
692
|
card: [640, 360],
|
|
673
693
|
slide: [1280, 720],
|
|
674
694
|
square: [600, 600]
|
|
675
695
|
};
|
|
676
|
-
function
|
|
696
|
+
function W(e, a, t) {
|
|
677
697
|
if (!e) return { width: a, height: t };
|
|
678
|
-
const [
|
|
679
|
-
return { width: a ??
|
|
698
|
+
const [r, i] = Wt[e];
|
|
699
|
+
return { width: a ?? r, height: t ?? i };
|
|
680
700
|
}
|
|
681
|
-
function
|
|
701
|
+
function re(e, a) {
|
|
682
702
|
switch (e.type) {
|
|
683
703
|
case "scene":
|
|
684
|
-
return
|
|
704
|
+
return q(e, a);
|
|
685
705
|
case "player":
|
|
686
706
|
if ((a == null ? void 0 : a.frame) !== void 0) {
|
|
687
|
-
const { width: t, height:
|
|
688
|
-
return
|
|
707
|
+
const { width: t, height: r } = W(e.preset, e.width, e.height);
|
|
708
|
+
return q(
|
|
689
709
|
{
|
|
690
710
|
width: t,
|
|
691
|
-
height:
|
|
711
|
+
height: r,
|
|
692
712
|
fps: e.fps,
|
|
693
713
|
durationInFrames: e.durationInFrames,
|
|
694
714
|
background: e.background,
|
|
@@ -697,87 +717,88 @@ function ee(e, a) {
|
|
|
697
717
|
a
|
|
698
718
|
);
|
|
699
719
|
}
|
|
700
|
-
return
|
|
720
|
+
return ie(e, a);
|
|
701
721
|
case "presentation":
|
|
702
|
-
return
|
|
722
|
+
return _t(e);
|
|
703
723
|
}
|
|
704
724
|
}
|
|
705
|
-
function
|
|
706
|
-
const t = (a == null ? void 0 : a.frame) !== void 0, { width:
|
|
707
|
-
return /* @__PURE__ */
|
|
708
|
-
|
|
725
|
+
function q(e, a) {
|
|
726
|
+
const t = (a == null ? void 0 : a.frame) !== void 0, { width: r, height: i } = W(e.preset, e.width, e.height);
|
|
727
|
+
return /* @__PURE__ */ c(
|
|
728
|
+
ze,
|
|
709
729
|
{
|
|
710
|
-
width:
|
|
711
|
-
height:
|
|
730
|
+
width: r,
|
|
731
|
+
height: i,
|
|
712
732
|
fps: e.fps,
|
|
713
733
|
durationInFrames: e.durationInFrames,
|
|
714
|
-
background: e.background,
|
|
734
|
+
background: h(e.background),
|
|
715
735
|
...t ? { frame: a.frame, autoPlay: !1 } : {},
|
|
716
|
-
children: e.children.map((n,
|
|
736
|
+
children: e.children.map((n, s) => v(n, s))
|
|
717
737
|
}
|
|
718
738
|
);
|
|
719
739
|
}
|
|
720
|
-
function
|
|
721
|
-
const { width: t, height:
|
|
722
|
-
return /* @__PURE__ */
|
|
723
|
-
|
|
740
|
+
function ie(e, a) {
|
|
741
|
+
const { width: t, height: r } = W(e.preset, e.width, e.height);
|
|
742
|
+
return /* @__PURE__ */ c(
|
|
743
|
+
pe,
|
|
724
744
|
{
|
|
725
745
|
ref: a == null ? void 0 : a.playerRef,
|
|
726
746
|
width: t,
|
|
727
|
-
height:
|
|
747
|
+
height: r,
|
|
728
748
|
fps: e.fps,
|
|
729
749
|
durationInFrames: e.durationInFrames,
|
|
730
|
-
background: e.background,
|
|
750
|
+
background: h(e.background),
|
|
731
751
|
controls: e.controls,
|
|
732
752
|
loop: e.loop,
|
|
733
753
|
autoPlay: e.autoPlay,
|
|
734
|
-
children: e.children.map((
|
|
754
|
+
children: e.children.map((i, n) => v(i, n))
|
|
735
755
|
}
|
|
736
756
|
);
|
|
737
757
|
}
|
|
738
|
-
function
|
|
739
|
-
const { width: a, height: t } =
|
|
740
|
-
return /* @__PURE__ */
|
|
741
|
-
|
|
758
|
+
function _t(e) {
|
|
759
|
+
const { width: a, height: t } = W(e.preset, e.width, e.height);
|
|
760
|
+
return /* @__PURE__ */ c(
|
|
761
|
+
Ce,
|
|
742
762
|
{
|
|
743
763
|
width: a,
|
|
744
764
|
height: t,
|
|
745
|
-
background: e.background,
|
|
765
|
+
background: h(e.background),
|
|
746
766
|
transition: e.transition,
|
|
747
767
|
transitionDuration: e.transitionDuration,
|
|
748
768
|
showHUD: e.showHud,
|
|
749
769
|
showNotes: e.showNotes,
|
|
750
|
-
children: e.slides.map((
|
|
770
|
+
children: e.slides.map((r, i) => Dt(r, i))
|
|
751
771
|
}
|
|
752
772
|
);
|
|
753
773
|
}
|
|
754
|
-
function
|
|
774
|
+
function Dt(e, a) {
|
|
755
775
|
var t;
|
|
756
|
-
return /* @__PURE__ */
|
|
776
|
+
return /* @__PURE__ */ c(Ee, { title: e.title, notes: e.notes, background: h(e.background), children: (t = e.children) == null ? void 0 : t.map((r, i) => v(r, i)) }, a);
|
|
757
777
|
}
|
|
758
|
-
function
|
|
778
|
+
function v(e, a) {
|
|
779
|
+
var t, r, i, n;
|
|
759
780
|
switch (e.type) {
|
|
760
781
|
case "sequence":
|
|
761
|
-
return /* @__PURE__ */
|
|
782
|
+
return /* @__PURE__ */ c(tt, { from: e.from, durationInFrames: e.durationInFrames, name: e.name, children: e.children.map((s, l) => v(s, l)) }, a);
|
|
762
783
|
case "group":
|
|
763
|
-
return /* @__PURE__ */
|
|
764
|
-
|
|
784
|
+
return /* @__PURE__ */ c(
|
|
785
|
+
et,
|
|
765
786
|
{
|
|
766
787
|
fadeIn: e.fadeIn,
|
|
767
788
|
fadeOut: e.fadeOut,
|
|
768
|
-
easing:
|
|
789
|
+
easing: g(e.easing),
|
|
769
790
|
rotation: e.rotation,
|
|
770
791
|
rotationOrigin: e.rotationOrigin,
|
|
771
792
|
scale: e.scale,
|
|
772
793
|
translate: e.translate,
|
|
773
794
|
zIndex: e.zIndex,
|
|
774
|
-
children: e.children.map((
|
|
795
|
+
children: e.children.map((s, l) => v(s, l))
|
|
775
796
|
},
|
|
776
797
|
a
|
|
777
798
|
);
|
|
778
799
|
case "bezierCurve":
|
|
779
|
-
return /* @__PURE__ */
|
|
780
|
-
|
|
800
|
+
return /* @__PURE__ */ c(
|
|
801
|
+
Ze,
|
|
781
802
|
{
|
|
782
803
|
x1: e.x1,
|
|
783
804
|
y1: e.y1,
|
|
@@ -787,15 +808,15 @@ function b(e, a) {
|
|
|
787
808
|
cy2: e.cy2,
|
|
788
809
|
x2: e.x2,
|
|
789
810
|
y2: e.y2,
|
|
790
|
-
stroke: e.stroke,
|
|
811
|
+
stroke: h(e.stroke),
|
|
791
812
|
strokeWidth: e.strokeWidth,
|
|
792
|
-
fill: e.fill,
|
|
813
|
+
fill: h(e.fill),
|
|
793
814
|
strokeDasharray: e.strokeDasharray,
|
|
794
815
|
opacity: e.opacity,
|
|
795
816
|
fadeIn: e.fadeIn,
|
|
796
817
|
fadeOut: e.fadeOut,
|
|
797
818
|
draw: e.draw,
|
|
798
|
-
easing:
|
|
819
|
+
easing: g(e.easing),
|
|
799
820
|
rotation: e.rotation,
|
|
800
821
|
rotationOrigin: e.rotationOrigin,
|
|
801
822
|
scale: e.scale,
|
|
@@ -805,20 +826,20 @@ function b(e, a) {
|
|
|
805
826
|
a
|
|
806
827
|
);
|
|
807
828
|
case "circle":
|
|
808
|
-
return /* @__PURE__ */
|
|
809
|
-
|
|
829
|
+
return /* @__PURE__ */ c(
|
|
830
|
+
Ye,
|
|
810
831
|
{
|
|
811
832
|
cx: e.cx,
|
|
812
833
|
cy: e.cy,
|
|
813
834
|
r: e.r,
|
|
814
|
-
fill: e.fill,
|
|
815
|
-
stroke: e.stroke,
|
|
835
|
+
fill: h(e.fill),
|
|
836
|
+
stroke: h(e.stroke),
|
|
816
837
|
strokeWidth: e.strokeWidth,
|
|
817
838
|
opacity: e.opacity,
|
|
818
839
|
fadeIn: e.fadeIn,
|
|
819
840
|
fadeOut: e.fadeOut,
|
|
820
841
|
draw: e.draw,
|
|
821
|
-
easing:
|
|
842
|
+
easing: g(e.easing),
|
|
822
843
|
rotation: e.rotation,
|
|
823
844
|
rotationOrigin: e.rotationOrigin,
|
|
824
845
|
scale: e.scale,
|
|
@@ -828,21 +849,21 @@ function b(e, a) {
|
|
|
828
849
|
a
|
|
829
850
|
);
|
|
830
851
|
case "line":
|
|
831
|
-
return /* @__PURE__ */
|
|
832
|
-
|
|
852
|
+
return /* @__PURE__ */ c(
|
|
853
|
+
Je,
|
|
833
854
|
{
|
|
834
855
|
x1: e.x1,
|
|
835
856
|
y1: e.y1,
|
|
836
857
|
x2: e.x2,
|
|
837
858
|
y2: e.y2,
|
|
838
|
-
stroke: e.stroke,
|
|
859
|
+
stroke: h(e.stroke),
|
|
839
860
|
strokeWidth: e.strokeWidth,
|
|
840
861
|
strokeDasharray: e.strokeDasharray,
|
|
841
862
|
opacity: e.opacity,
|
|
842
863
|
fadeIn: e.fadeIn,
|
|
843
864
|
fadeOut: e.fadeOut,
|
|
844
865
|
draw: e.draw,
|
|
845
|
-
easing:
|
|
866
|
+
easing: g(e.easing),
|
|
846
867
|
rotation: e.rotation,
|
|
847
868
|
rotationOrigin: e.rotationOrigin,
|
|
848
869
|
scale: e.scale,
|
|
@@ -852,14 +873,14 @@ function b(e, a) {
|
|
|
852
873
|
a
|
|
853
874
|
);
|
|
854
875
|
case "arrow":
|
|
855
|
-
return /* @__PURE__ */
|
|
856
|
-
|
|
876
|
+
return /* @__PURE__ */ c(
|
|
877
|
+
Xe,
|
|
857
878
|
{
|
|
858
879
|
x1: e.x1,
|
|
859
880
|
y1: e.y1,
|
|
860
881
|
x2: e.x2,
|
|
861
882
|
y2: e.y2,
|
|
862
|
-
stroke: e.stroke,
|
|
883
|
+
stroke: h(e.stroke),
|
|
863
884
|
strokeWidth: e.strokeWidth,
|
|
864
885
|
headSize: e.headSize,
|
|
865
886
|
strokeDasharray: e.strokeDasharray,
|
|
@@ -867,7 +888,7 @@ function b(e, a) {
|
|
|
867
888
|
fadeIn: e.fadeIn,
|
|
868
889
|
fadeOut: e.fadeOut,
|
|
869
890
|
draw: e.draw,
|
|
870
|
-
easing:
|
|
891
|
+
easing: g(e.easing),
|
|
871
892
|
rotation: e.rotation,
|
|
872
893
|
rotationOrigin: e.rotationOrigin,
|
|
873
894
|
scale: e.scale,
|
|
@@ -877,15 +898,15 @@ function b(e, a) {
|
|
|
877
898
|
a
|
|
878
899
|
);
|
|
879
900
|
case "rect":
|
|
880
|
-
return /* @__PURE__ */
|
|
881
|
-
|
|
901
|
+
return /* @__PURE__ */ c(
|
|
902
|
+
Qe,
|
|
882
903
|
{
|
|
883
904
|
x: e.x,
|
|
884
905
|
y: e.y,
|
|
885
906
|
width: e.width,
|
|
886
907
|
height: e.height,
|
|
887
|
-
fill: e.fill,
|
|
888
|
-
stroke: e.stroke,
|
|
908
|
+
fill: h(e.fill),
|
|
909
|
+
stroke: h(e.stroke),
|
|
889
910
|
strokeWidth: e.strokeWidth,
|
|
890
911
|
rx: e.rx,
|
|
891
912
|
ry: e.ry,
|
|
@@ -894,7 +915,7 @@ function b(e, a) {
|
|
|
894
915
|
fadeIn: e.fadeIn,
|
|
895
916
|
fadeOut: e.fadeOut,
|
|
896
917
|
draw: e.draw,
|
|
897
|
-
easing:
|
|
918
|
+
easing: g(e.easing),
|
|
898
919
|
rotation: e.rotation,
|
|
899
920
|
rotationOrigin: e.rotationOrigin,
|
|
900
921
|
scale: e.scale,
|
|
@@ -904,19 +925,19 @@ function b(e, a) {
|
|
|
904
925
|
a
|
|
905
926
|
);
|
|
906
927
|
case "polygon":
|
|
907
|
-
return /* @__PURE__ */
|
|
908
|
-
|
|
928
|
+
return /* @__PURE__ */ c(
|
|
929
|
+
Ke,
|
|
909
930
|
{
|
|
910
931
|
points: e.points,
|
|
911
|
-
fill: e.fill,
|
|
912
|
-
stroke: e.stroke,
|
|
932
|
+
fill: h(e.fill),
|
|
933
|
+
stroke: h(e.stroke),
|
|
913
934
|
strokeWidth: e.strokeWidth,
|
|
914
935
|
closed: e.closed,
|
|
915
936
|
opacity: e.opacity,
|
|
916
937
|
fadeIn: e.fadeIn,
|
|
917
938
|
fadeOut: e.fadeOut,
|
|
918
939
|
draw: e.draw,
|
|
919
|
-
easing:
|
|
940
|
+
easing: g(e.easing),
|
|
920
941
|
rotation: e.rotation,
|
|
921
942
|
rotationOrigin: e.rotationOrigin,
|
|
922
943
|
scale: e.scale,
|
|
@@ -926,12 +947,12 @@ function b(e, a) {
|
|
|
926
947
|
a
|
|
927
948
|
);
|
|
928
949
|
case "text":
|
|
929
|
-
return /* @__PURE__ */
|
|
930
|
-
|
|
950
|
+
return /* @__PURE__ */ c(
|
|
951
|
+
_,
|
|
931
952
|
{
|
|
932
953
|
x: e.x,
|
|
933
954
|
y: e.y,
|
|
934
|
-
fill: e.fill,
|
|
955
|
+
fill: h(e.fill),
|
|
935
956
|
fontSize: e.fontSize,
|
|
936
957
|
fontFamily: e.fontFamily,
|
|
937
958
|
fontWeight: e.fontWeight,
|
|
@@ -940,7 +961,7 @@ function b(e, a) {
|
|
|
940
961
|
opacity: e.opacity,
|
|
941
962
|
fadeIn: e.fadeIn,
|
|
942
963
|
fadeOut: e.fadeOut,
|
|
943
|
-
easing:
|
|
964
|
+
easing: g(e.easing),
|
|
944
965
|
rotation: e.rotation,
|
|
945
966
|
rotationOrigin: e.rotationOrigin,
|
|
946
967
|
scale: e.scale,
|
|
@@ -951,8 +972,8 @@ function b(e, a) {
|
|
|
951
972
|
a
|
|
952
973
|
);
|
|
953
974
|
case "image":
|
|
954
|
-
return /* @__PURE__ */
|
|
955
|
-
|
|
975
|
+
return /* @__PURE__ */ c(
|
|
976
|
+
Ge,
|
|
956
977
|
{
|
|
957
978
|
src: e.src,
|
|
958
979
|
x: e.x,
|
|
@@ -965,7 +986,7 @@ function b(e, a) {
|
|
|
965
986
|
opacity: e.opacity,
|
|
966
987
|
fadeIn: e.fadeIn,
|
|
967
988
|
fadeOut: e.fadeOut,
|
|
968
|
-
easing:
|
|
989
|
+
easing: g(e.easing),
|
|
969
990
|
rotation: e.rotation,
|
|
970
991
|
rotationOrigin: e.rotationOrigin,
|
|
971
992
|
scale: e.scale,
|
|
@@ -975,8 +996,8 @@ function b(e, a) {
|
|
|
975
996
|
a
|
|
976
997
|
);
|
|
977
998
|
case "axes":
|
|
978
|
-
return /* @__PURE__ */
|
|
979
|
-
|
|
999
|
+
return /* @__PURE__ */ c(
|
|
1000
|
+
He,
|
|
980
1001
|
{
|
|
981
1002
|
domain: e.domain,
|
|
982
1003
|
range: e.range,
|
|
@@ -986,14 +1007,14 @@ function b(e, a) {
|
|
|
986
1007
|
showTicks: e.showTicks,
|
|
987
1008
|
showLabels: e.showLabels,
|
|
988
1009
|
tickStep: e.tickStep,
|
|
989
|
-
axisColor: e.axisColor,
|
|
990
|
-
gridColor: e.gridColor,
|
|
991
|
-
labelColor: e.labelColor,
|
|
1010
|
+
axisColor: h(e.axisColor),
|
|
1011
|
+
gridColor: h(e.gridColor),
|
|
1012
|
+
labelColor: h(e.labelColor),
|
|
992
1013
|
labelFontSize: e.labelFontSize,
|
|
993
1014
|
fadeIn: e.fadeIn,
|
|
994
1015
|
fadeOut: e.fadeOut,
|
|
995
1016
|
draw: e.draw,
|
|
996
|
-
easing:
|
|
1017
|
+
easing: g(e.easing),
|
|
997
1018
|
rotation: e.rotation,
|
|
998
1019
|
rotationOrigin: e.rotationOrigin,
|
|
999
1020
|
translate: e.translate,
|
|
@@ -1002,20 +1023,36 @@ function b(e, a) {
|
|
|
1002
1023
|
a
|
|
1003
1024
|
);
|
|
1004
1025
|
case "functionPlot": {
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1026
|
+
let s;
|
|
1027
|
+
try {
|
|
1028
|
+
s = st(e.fn);
|
|
1029
|
+
} catch {
|
|
1030
|
+
return /* @__PURE__ */ c(
|
|
1031
|
+
_,
|
|
1032
|
+
{
|
|
1033
|
+
x: ((t = e.origin) == null ? void 0 : t[0]) ?? 400,
|
|
1034
|
+
y: (((r = e.origin) == null ? void 0 : r[1]) ?? 300) - 20,
|
|
1035
|
+
fontSize: 14,
|
|
1036
|
+
fill: "red",
|
|
1037
|
+
opacity: 0.8,
|
|
1038
|
+
children: `⚠ f(x) = ${e.fn}`
|
|
1039
|
+
},
|
|
1040
|
+
a
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
return /* @__PURE__ */ c(
|
|
1044
|
+
Ue,
|
|
1008
1045
|
{
|
|
1009
|
-
fn: (
|
|
1046
|
+
fn: (l) => s({ x: l }),
|
|
1010
1047
|
domain: e.domain,
|
|
1011
1048
|
yClamp: e.yClamp,
|
|
1012
1049
|
origin: e.origin,
|
|
1013
1050
|
scale: e.scale,
|
|
1014
|
-
color: e.color,
|
|
1051
|
+
color: h(e.color),
|
|
1015
1052
|
strokeWidth: e.strokeWidth,
|
|
1016
1053
|
samples: e.samples,
|
|
1017
1054
|
draw: e.draw,
|
|
1018
|
-
easing:
|
|
1055
|
+
easing: g(e.easing),
|
|
1019
1056
|
opacity: e.opacity,
|
|
1020
1057
|
rotation: e.rotation,
|
|
1021
1058
|
rotationOrigin: e.rotationOrigin,
|
|
@@ -1026,24 +1063,24 @@ function b(e, a) {
|
|
|
1026
1063
|
);
|
|
1027
1064
|
}
|
|
1028
1065
|
case "vector":
|
|
1029
|
-
return /* @__PURE__ */
|
|
1030
|
-
|
|
1066
|
+
return /* @__PURE__ */ c(
|
|
1067
|
+
Be,
|
|
1031
1068
|
{
|
|
1032
1069
|
from: e.from,
|
|
1033
1070
|
to: e.to,
|
|
1034
1071
|
origin: e.origin,
|
|
1035
1072
|
scale: e.scale,
|
|
1036
|
-
color: e.color,
|
|
1073
|
+
color: h(e.color),
|
|
1037
1074
|
strokeWidth: e.strokeWidth,
|
|
1038
1075
|
headSize: e.headSize,
|
|
1039
1076
|
label: e.label,
|
|
1040
1077
|
labelOffset: e.labelOffset,
|
|
1041
|
-
labelColor: e.labelColor,
|
|
1078
|
+
labelColor: h(e.labelColor),
|
|
1042
1079
|
labelFontSize: e.labelFontSize,
|
|
1043
1080
|
fadeIn: e.fadeIn,
|
|
1044
1081
|
fadeOut: e.fadeOut,
|
|
1045
1082
|
draw: e.draw,
|
|
1046
|
-
easing:
|
|
1083
|
+
easing: g(e.easing),
|
|
1047
1084
|
rotation: e.rotation,
|
|
1048
1085
|
rotationOrigin: e.rotationOrigin,
|
|
1049
1086
|
translate: e.translate,
|
|
@@ -1052,25 +1089,41 @@ function b(e, a) {
|
|
|
1052
1089
|
a
|
|
1053
1090
|
);
|
|
1054
1091
|
case "vectorField": {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1092
|
+
let s;
|
|
1093
|
+
try {
|
|
1094
|
+
s = ct(e.fn);
|
|
1095
|
+
} catch {
|
|
1096
|
+
return /* @__PURE__ */ c(
|
|
1097
|
+
_,
|
|
1098
|
+
{
|
|
1099
|
+
x: ((i = e.origin) == null ? void 0 : i[0]) ?? 400,
|
|
1100
|
+
y: (((n = e.origin) == null ? void 0 : n[1]) ?? 300) - 20,
|
|
1101
|
+
fontSize: 14,
|
|
1102
|
+
fill: "red",
|
|
1103
|
+
opacity: 0.8,
|
|
1104
|
+
children: `⚠ field = ${e.fn}`
|
|
1105
|
+
},
|
|
1106
|
+
a
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
return /* @__PURE__ */ c(
|
|
1110
|
+
qe,
|
|
1058
1111
|
{
|
|
1059
|
-
fn: (
|
|
1112
|
+
fn: (l, b) => s({ x: l, y: b }),
|
|
1060
1113
|
domain: e.domain,
|
|
1061
1114
|
range: e.range,
|
|
1062
1115
|
step: e.step,
|
|
1063
1116
|
origin: e.origin,
|
|
1064
1117
|
scale: e.scale,
|
|
1065
1118
|
arrowScale: e.arrowScale,
|
|
1066
|
-
color: e.color,
|
|
1119
|
+
color: h(e.color),
|
|
1067
1120
|
strokeWidth: e.strokeWidth,
|
|
1068
1121
|
headSize: e.headSize,
|
|
1069
1122
|
normalize: e.normalize,
|
|
1070
1123
|
maxLength: e.maxLength,
|
|
1071
1124
|
fadeIn: e.fadeIn,
|
|
1072
1125
|
fadeOut: e.fadeOut,
|
|
1073
|
-
easing:
|
|
1126
|
+
easing: g(e.easing),
|
|
1074
1127
|
rotation: e.rotation,
|
|
1075
1128
|
rotationOrigin: e.rotationOrigin,
|
|
1076
1129
|
translate: e.translate,
|
|
@@ -1080,19 +1133,19 @@ function b(e, a) {
|
|
|
1080
1133
|
);
|
|
1081
1134
|
}
|
|
1082
1135
|
case "matrix":
|
|
1083
|
-
return /* @__PURE__ */
|
|
1084
|
-
|
|
1136
|
+
return /* @__PURE__ */ c(
|
|
1137
|
+
je,
|
|
1085
1138
|
{
|
|
1086
1139
|
values: e.values,
|
|
1087
1140
|
x: e.x,
|
|
1088
1141
|
y: e.y,
|
|
1089
1142
|
cellSize: e.cellSize,
|
|
1090
|
-
color: e.color,
|
|
1091
|
-
bracketColor: e.bracketColor,
|
|
1143
|
+
color: h(e.color),
|
|
1144
|
+
bracketColor: h(e.bracketColor),
|
|
1092
1145
|
fontSize: e.fontSize,
|
|
1093
1146
|
fadeIn: e.fadeIn,
|
|
1094
1147
|
fadeOut: e.fadeOut,
|
|
1095
|
-
easing:
|
|
1148
|
+
easing: g(e.easing),
|
|
1096
1149
|
rotation: e.rotation,
|
|
1097
1150
|
rotationOrigin: e.rotationOrigin,
|
|
1098
1151
|
scale: e.scale,
|
|
@@ -1102,20 +1155,20 @@ function b(e, a) {
|
|
|
1102
1155
|
a
|
|
1103
1156
|
);
|
|
1104
1157
|
case "graph":
|
|
1105
|
-
return /* @__PURE__ */
|
|
1106
|
-
|
|
1158
|
+
return /* @__PURE__ */ c(
|
|
1159
|
+
Le,
|
|
1107
1160
|
{
|
|
1108
1161
|
nodes: e.nodes,
|
|
1109
1162
|
edges: e.edges,
|
|
1110
|
-
nodeColor: e.nodeColor,
|
|
1163
|
+
nodeColor: h(e.nodeColor),
|
|
1111
1164
|
nodeRadius: e.nodeRadius,
|
|
1112
|
-
edgeColor: e.edgeColor,
|
|
1165
|
+
edgeColor: h(e.edgeColor),
|
|
1113
1166
|
edgeWidth: e.edgeWidth,
|
|
1114
|
-
labelColor: e.labelColor,
|
|
1167
|
+
labelColor: h(e.labelColor),
|
|
1115
1168
|
labelFontSize: e.labelFontSize,
|
|
1116
1169
|
fadeIn: e.fadeIn,
|
|
1117
1170
|
fadeOut: e.fadeOut,
|
|
1118
|
-
easing:
|
|
1171
|
+
easing: g(e.easing),
|
|
1119
1172
|
rotation: e.rotation,
|
|
1120
1173
|
rotationOrigin: e.rotationOrigin,
|
|
1121
1174
|
scale: e.scale,
|
|
@@ -1125,18 +1178,18 @@ function b(e, a) {
|
|
|
1125
1178
|
a
|
|
1126
1179
|
);
|
|
1127
1180
|
case "latex":
|
|
1128
|
-
return /* @__PURE__ */
|
|
1129
|
-
|
|
1181
|
+
return /* @__PURE__ */ c(
|
|
1182
|
+
Ve,
|
|
1130
1183
|
{
|
|
1131
1184
|
expression: e.expression,
|
|
1132
1185
|
x: e.x,
|
|
1133
1186
|
y: e.y,
|
|
1134
|
-
color: e.color,
|
|
1187
|
+
color: h(e.color),
|
|
1135
1188
|
fontSize: e.fontSize,
|
|
1136
1189
|
align: e.align,
|
|
1137
1190
|
fadeIn: e.fadeIn,
|
|
1138
1191
|
fadeOut: e.fadeOut,
|
|
1139
|
-
easing:
|
|
1192
|
+
easing: g(e.easing),
|
|
1140
1193
|
rotation: e.rotation,
|
|
1141
1194
|
rotationOrigin: e.rotationOrigin,
|
|
1142
1195
|
scale: e.scale,
|
|
@@ -1146,16 +1199,16 @@ function b(e, a) {
|
|
|
1146
1199
|
a
|
|
1147
1200
|
);
|
|
1148
1201
|
case "barChart":
|
|
1149
|
-
return /* @__PURE__ */
|
|
1150
|
-
|
|
1202
|
+
return /* @__PURE__ */ c(
|
|
1203
|
+
De,
|
|
1151
1204
|
{
|
|
1152
1205
|
bars: e.bars,
|
|
1153
1206
|
x: e.x,
|
|
1154
1207
|
y: e.y,
|
|
1155
1208
|
width: e.width,
|
|
1156
1209
|
height: e.height,
|
|
1157
|
-
barColor: e.barColor,
|
|
1158
|
-
labelColor: e.labelColor,
|
|
1210
|
+
barColor: h(e.barColor),
|
|
1211
|
+
labelColor: h(e.labelColor),
|
|
1159
1212
|
labelFontSize: e.labelFontSize,
|
|
1160
1213
|
showValues: e.showValues,
|
|
1161
1214
|
maxValue: e.maxValue,
|
|
@@ -1163,7 +1216,7 @@ function b(e, a) {
|
|
|
1163
1216
|
valueFormat: e.valueFormat,
|
|
1164
1217
|
fadeIn: e.fadeIn,
|
|
1165
1218
|
fadeOut: e.fadeOut,
|
|
1166
|
-
easing:
|
|
1219
|
+
easing: g(e.easing),
|
|
1167
1220
|
rotation: e.rotation,
|
|
1168
1221
|
rotationOrigin: e.rotationOrigin,
|
|
1169
1222
|
scale: e.scale,
|
|
@@ -1173,164 +1226,164 @@ function b(e, a) {
|
|
|
1173
1226
|
a
|
|
1174
1227
|
);
|
|
1175
1228
|
case "fadeIn":
|
|
1176
|
-
return /* @__PURE__ */
|
|
1229
|
+
return /* @__PURE__ */ c(_e, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, l) => v(s, l)) }, a);
|
|
1177
1230
|
case "fadeOut":
|
|
1178
|
-
return /* @__PURE__ */
|
|
1231
|
+
return /* @__PURE__ */ c(We, { duration: e.duration, totalFrames: e.totalFrames, easing: g(e.easing), children: e.children.map((s, l) => v(s, l)) }, a);
|
|
1179
1232
|
case "draw":
|
|
1180
|
-
return /* @__PURE__ */
|
|
1233
|
+
return /* @__PURE__ */ c(Me, { duration: e.duration, pathLength: e.pathLength, easing: g(e.easing), children: v(e.children[0], 0) }, a);
|
|
1181
1234
|
case "write":
|
|
1182
|
-
return /* @__PURE__ */
|
|
1235
|
+
return /* @__PURE__ */ c(Te, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, l) => v(s, l)) }, a);
|
|
1183
1236
|
case "transform":
|
|
1184
|
-
return /* @__PURE__ */
|
|
1185
|
-
|
|
1237
|
+
return /* @__PURE__ */ c(
|
|
1238
|
+
Ne,
|
|
1186
1239
|
{
|
|
1187
1240
|
duration: e.duration,
|
|
1188
|
-
easing:
|
|
1241
|
+
easing: g(e.easing),
|
|
1189
1242
|
translate: e.translate,
|
|
1190
1243
|
scale: e.scale,
|
|
1191
1244
|
rotate: e.rotate,
|
|
1192
1245
|
opacity: e.opacity,
|
|
1193
|
-
children: e.children.map((
|
|
1246
|
+
children: e.children.map((s, l) => v(s, l))
|
|
1194
1247
|
},
|
|
1195
1248
|
a
|
|
1196
1249
|
);
|
|
1197
1250
|
case "morph":
|
|
1198
|
-
return /* @__PURE__ */
|
|
1199
|
-
|
|
1251
|
+
return /* @__PURE__ */ c(
|
|
1252
|
+
Re,
|
|
1200
1253
|
{
|
|
1201
1254
|
duration: e.duration,
|
|
1202
|
-
easing:
|
|
1203
|
-
fromColor: e.fromColor,
|
|
1204
|
-
toColor: e.toColor,
|
|
1255
|
+
easing: g(e.easing),
|
|
1256
|
+
fromColor: h(e.fromColor),
|
|
1257
|
+
toColor: h(e.toColor),
|
|
1205
1258
|
fromOpacity: e.fromOpacity,
|
|
1206
1259
|
toOpacity: e.toOpacity,
|
|
1207
1260
|
fromScale: e.fromScale,
|
|
1208
1261
|
toScale: e.toScale,
|
|
1209
|
-
children: e.children.map((
|
|
1262
|
+
children: e.children.map((s, l) => v(s, l))
|
|
1210
1263
|
},
|
|
1211
1264
|
a
|
|
1212
1265
|
);
|
|
1213
1266
|
case "stagger":
|
|
1214
|
-
return /* @__PURE__ */
|
|
1267
|
+
return /* @__PURE__ */ c(Pe, { staggerDelay: e.staggerDelay, easing: g(e.easing), children: e.children.map((s, l) => v(s, l)) }, a);
|
|
1215
1268
|
case "parallel":
|
|
1216
|
-
return /* @__PURE__ */
|
|
1269
|
+
return /* @__PURE__ */ c(Fe, { children: e.children.map((s, l) => v(s, l)) }, a);
|
|
1217
1270
|
case "scene":
|
|
1218
|
-
return /* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ c(H.Fragment, { children: q(e) }, a);
|
|
1219
1272
|
case "player":
|
|
1220
|
-
return /* @__PURE__ */
|
|
1273
|
+
return /* @__PURE__ */ c(H.Fragment, { children: ie(e) }, a);
|
|
1221
1274
|
default:
|
|
1222
1275
|
return null;
|
|
1223
1276
|
}
|
|
1224
1277
|
}
|
|
1225
|
-
function
|
|
1278
|
+
function Vt(e) {
|
|
1226
1279
|
if (!e) return {};
|
|
1227
1280
|
const a = {};
|
|
1228
|
-
for (const [t,
|
|
1229
|
-
|
|
1281
|
+
for (const [t, r] of Object.entries(e))
|
|
1282
|
+
r !== void 0 && (a[`--elucim-${t}`] = r);
|
|
1230
1283
|
return a;
|
|
1231
1284
|
}
|
|
1232
|
-
const
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1285
|
+
const Xt = at(function({ dsl: a, className: t, style: r, theme: i, poster: n, onError: s }, l) {
|
|
1286
|
+
const b = rt(null);
|
|
1287
|
+
it(l, () => ({
|
|
1235
1288
|
getSvgElement: () => {
|
|
1236
|
-
var
|
|
1237
|
-
return ((
|
|
1289
|
+
var u;
|
|
1290
|
+
return ((u = b.current) == null ? void 0 : u.getSvgElement()) ?? null;
|
|
1238
1291
|
},
|
|
1239
|
-
seekToFrame: (
|
|
1240
|
-
var
|
|
1241
|
-
return (
|
|
1292
|
+
seekToFrame: (u) => {
|
|
1293
|
+
var o;
|
|
1294
|
+
return (o = b.current) == null ? void 0 : o.seekToFrame(u);
|
|
1242
1295
|
},
|
|
1243
1296
|
getTotalFrames: () => {
|
|
1244
|
-
var
|
|
1245
|
-
return ((
|
|
1297
|
+
var u;
|
|
1298
|
+
return ((u = b.current) == null ? void 0 : u.getTotalFrames()) ?? 0;
|
|
1246
1299
|
},
|
|
1247
1300
|
play: () => {
|
|
1248
|
-
var
|
|
1249
|
-
return (
|
|
1301
|
+
var u;
|
|
1302
|
+
return (u = b.current) == null ? void 0 : u.play();
|
|
1250
1303
|
},
|
|
1251
1304
|
pause: () => {
|
|
1252
|
-
var
|
|
1253
|
-
return (
|
|
1305
|
+
var u;
|
|
1306
|
+
return (u = b.current) == null ? void 0 : u.pause();
|
|
1254
1307
|
},
|
|
1255
1308
|
isPlaying: () => {
|
|
1256
|
-
var
|
|
1257
|
-
return ((
|
|
1309
|
+
var u;
|
|
1310
|
+
return ((u = b.current) == null ? void 0 : u.isPlaying()) ?? !1;
|
|
1258
1311
|
}
|
|
1259
1312
|
}));
|
|
1260
|
-
const
|
|
1261
|
-
if (!
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
const
|
|
1265
|
-
for (const
|
|
1266
|
-
const w =
|
|
1267
|
-
|
|
1313
|
+
const A = Y(a);
|
|
1314
|
+
if (!A.valid) {
|
|
1315
|
+
const u = A.errors.filter((y) => y.severity === "error").map((y) => ({ path: y.path, message: y.message }));
|
|
1316
|
+
s == null || s(u);
|
|
1317
|
+
const o = /* @__PURE__ */ new Map();
|
|
1318
|
+
for (const y of u) {
|
|
1319
|
+
const w = y.path.split("."), S = w.length > 1 ? w.slice(0, -1).join(".") : y.path, C = o.get(S) ?? [];
|
|
1320
|
+
C.push(y), o.set(S, C);
|
|
1268
1321
|
}
|
|
1269
|
-
return /* @__PURE__ */
|
|
1322
|
+
return /* @__PURE__ */ F(
|
|
1270
1323
|
"div",
|
|
1271
1324
|
{
|
|
1272
1325
|
className: t,
|
|
1273
|
-
style: { color: "#ff6b6b", fontFamily: "monospace", padding: 16, fontSize: 13, ...
|
|
1326
|
+
style: { color: "#ff6b6b", fontFamily: "monospace", padding: 16, fontSize: 13, ...r },
|
|
1274
1327
|
"data-testid": "dsl-error",
|
|
1275
1328
|
children: [
|
|
1276
|
-
/* @__PURE__ */
|
|
1329
|
+
/* @__PURE__ */ F("strong", { children: [
|
|
1277
1330
|
"Elucim DSL Validation Errors (",
|
|
1278
|
-
|
|
1331
|
+
u.length,
|
|
1279
1332
|
"):"
|
|
1280
1333
|
] }),
|
|
1281
|
-
[...
|
|
1282
|
-
/* @__PURE__ */
|
|
1283
|
-
|
|
1334
|
+
[...o.entries()].map(([y, w]) => /* @__PURE__ */ F("details", { open: !0, style: { marginTop: 8 }, children: [
|
|
1335
|
+
/* @__PURE__ */ F("summary", { style: { cursor: "pointer", fontWeight: "bold" }, children: [
|
|
1336
|
+
y,
|
|
1284
1337
|
" (",
|
|
1285
1338
|
w.length,
|
|
1286
1339
|
")"
|
|
1287
1340
|
] }),
|
|
1288
|
-
/* @__PURE__ */
|
|
1289
|
-
/* @__PURE__ */
|
|
1341
|
+
/* @__PURE__ */ c("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children: w.map((S, C) => /* @__PURE__ */ F("li", { children: [
|
|
1342
|
+
/* @__PURE__ */ c("code", { style: { color: "#ffa07a" }, children: S.path }),
|
|
1290
1343
|
": ",
|
|
1291
|
-
|
|
1292
|
-
] },
|
|
1293
|
-
] },
|
|
1294
|
-
/* @__PURE__ */
|
|
1295
|
-
/* @__PURE__ */
|
|
1296
|
-
/* @__PURE__ */
|
|
1344
|
+
S.message
|
|
1345
|
+
] }, C)) })
|
|
1346
|
+
] }, y)),
|
|
1347
|
+
/* @__PURE__ */ F("details", { style: { marginTop: 12 }, children: [
|
|
1348
|
+
/* @__PURE__ */ c("summary", { style: { cursor: "pointer", opacity: 0.7 }, children: "Raw JSON" }),
|
|
1349
|
+
/* @__PURE__ */ c("pre", { style: { fontSize: 11, maxHeight: 300, overflow: "auto", marginTop: 4, padding: 8, background: "rgba(0,0,0,0.3)", borderRadius: 4 }, children: JSON.stringify(a, null, 2) })
|
|
1297
1350
|
] })
|
|
1298
1351
|
]
|
|
1299
1352
|
}
|
|
1300
1353
|
);
|
|
1301
1354
|
}
|
|
1302
|
-
const
|
|
1303
|
-
return /* @__PURE__ */
|
|
1304
|
-
frame:
|
|
1305
|
-
playerRef:
|
|
1355
|
+
const E = Vt(i), x = n !== void 0 ? Lt(n, a) : void 0;
|
|
1356
|
+
return /* @__PURE__ */ c("div", { className: t, style: { ...E, ...r }, "data-testid": "dsl-root", children: re(a.root, {
|
|
1357
|
+
frame: x == null ? void 0 : x.frame,
|
|
1358
|
+
playerRef: b
|
|
1306
1359
|
}) });
|
|
1307
1360
|
});
|
|
1308
|
-
function
|
|
1361
|
+
function Lt(e, a) {
|
|
1309
1362
|
if (e === "first") return { frame: 0 };
|
|
1310
1363
|
if (e === "last") {
|
|
1311
|
-
const
|
|
1312
|
-
return { frame: Math.max(0,
|
|
1364
|
+
const r = a.root.durationInFrames ?? 1;
|
|
1365
|
+
return { frame: Math.max(0, r - 1) };
|
|
1313
1366
|
}
|
|
1314
1367
|
return { frame: e };
|
|
1315
1368
|
}
|
|
1316
|
-
function
|
|
1317
|
-
const
|
|
1318
|
-
if (!
|
|
1319
|
-
const
|
|
1369
|
+
function Jt(e, a, t) {
|
|
1370
|
+
const r = Y(e);
|
|
1371
|
+
if (!r.valid) {
|
|
1372
|
+
const s = r.errors.filter((l) => l.severity === "error");
|
|
1320
1373
|
throw new Error(
|
|
1321
1374
|
`DSL validation failed:
|
|
1322
|
-
${
|
|
1375
|
+
${s.map((l) => ` ${l.path}: ${l.message}`).join(`
|
|
1323
1376
|
`)}`
|
|
1324
1377
|
);
|
|
1325
1378
|
}
|
|
1326
|
-
const
|
|
1327
|
-
t != null && t.width && (
|
|
1328
|
-
const n =
|
|
1329
|
-
return
|
|
1379
|
+
const i = { ...e.root };
|
|
1380
|
+
t != null && t.width && (i.width = t.width), t != null && t.height && (i.height = t.height);
|
|
1381
|
+
const n = re(i, { frame: a });
|
|
1382
|
+
return nt(n);
|
|
1330
1383
|
}
|
|
1331
|
-
class
|
|
1332
|
-
constructor(a, t = 30,
|
|
1333
|
-
this.elements = [], this.cursor = 0, this.theme = a, this._fps = t, this._width =
|
|
1384
|
+
class jt {
|
|
1385
|
+
constructor(a, t = 30, r = 900, i = 640) {
|
|
1386
|
+
this.elements = [], this.cursor = 0, this.theme = a, this._fps = t, this._width = r, this._height = i;
|
|
1334
1387
|
}
|
|
1335
1388
|
get width() {
|
|
1336
1389
|
return this._width;
|
|
@@ -1395,10 +1448,10 @@ class Lt {
|
|
|
1395
1448
|
}
|
|
1396
1449
|
/** Add a LaTeX expression */
|
|
1397
1450
|
latex(a, t) {
|
|
1398
|
-
const
|
|
1451
|
+
const r = (t == null ? void 0 : t.fadeIn) ?? 15;
|
|
1399
1452
|
return this.addAtCursor({
|
|
1400
1453
|
type: "fadeIn",
|
|
1401
|
-
duration:
|
|
1454
|
+
duration: r,
|
|
1402
1455
|
children: [{
|
|
1403
1456
|
type: "latex",
|
|
1404
1457
|
expression: a,
|
|
@@ -1412,10 +1465,10 @@ class Lt {
|
|
|
1412
1465
|
}
|
|
1413
1466
|
/** Add text at a position */
|
|
1414
1467
|
text(a, t) {
|
|
1415
|
-
const
|
|
1468
|
+
const r = t.fadeIn ?? 15, i = t.advance ?? 5;
|
|
1416
1469
|
return this.addAtCursor({
|
|
1417
1470
|
type: "fadeIn",
|
|
1418
|
-
duration:
|
|
1471
|
+
duration: r,
|
|
1419
1472
|
children: [{
|
|
1420
1473
|
type: "text",
|
|
1421
1474
|
x: t.x,
|
|
@@ -1427,73 +1480,73 @@ class Lt {
|
|
|
1427
1480
|
fontWeight: t.fontWeight,
|
|
1428
1481
|
fontFamily: t.fontFamily
|
|
1429
1482
|
}]
|
|
1430
|
-
},
|
|
1483
|
+
}, i);
|
|
1431
1484
|
}
|
|
1432
1485
|
/** Add an arrow */
|
|
1433
|
-
arrow(a, t,
|
|
1434
|
-
const
|
|
1486
|
+
arrow(a, t, r, i, n) {
|
|
1487
|
+
const s = (n == null ? void 0 : n.fadeIn) ?? 12, l = {
|
|
1435
1488
|
type: "arrow",
|
|
1436
1489
|
x1: a,
|
|
1437
1490
|
y1: t,
|
|
1438
|
-
x2:
|
|
1439
|
-
y2:
|
|
1491
|
+
x2: r,
|
|
1492
|
+
y2: i,
|
|
1440
1493
|
stroke: (n == null ? void 0 : n.color) ?? this.theme.primary,
|
|
1441
1494
|
strokeWidth: (n == null ? void 0 : n.strokeWidth) ?? 2,
|
|
1442
1495
|
headSize: (n == null ? void 0 : n.headSize) ?? 8,
|
|
1443
1496
|
strokeDasharray: n != null && n.dashed ? "6 3" : void 0,
|
|
1444
|
-
fadeIn:
|
|
1497
|
+
fadeIn: s
|
|
1445
1498
|
};
|
|
1446
|
-
return this.addAtCursor(
|
|
1499
|
+
return this.addAtCursor(l, (n == null ? void 0 : n.advance) ?? 3);
|
|
1447
1500
|
}
|
|
1448
1501
|
/** Add a line */
|
|
1449
|
-
line(a, t,
|
|
1450
|
-
const
|
|
1502
|
+
line(a, t, r, i, n) {
|
|
1503
|
+
const s = (n == null ? void 0 : n.fadeIn) ?? 12;
|
|
1451
1504
|
return this.addAtCursor({
|
|
1452
1505
|
type: "line",
|
|
1453
1506
|
x1: a,
|
|
1454
1507
|
y1: t,
|
|
1455
|
-
x2:
|
|
1456
|
-
y2:
|
|
1508
|
+
x2: r,
|
|
1509
|
+
y2: i,
|
|
1457
1510
|
stroke: (n == null ? void 0 : n.color) ?? this.theme.muted,
|
|
1458
1511
|
strokeWidth: (n == null ? void 0 : n.strokeWidth) ?? 1,
|
|
1459
1512
|
strokeDasharray: n != null && n.dashed ? "6 3" : void 0,
|
|
1460
|
-
fadeIn:
|
|
1513
|
+
fadeIn: s
|
|
1461
1514
|
}, (n == null ? void 0 : n.advance) ?? 3);
|
|
1462
1515
|
}
|
|
1463
1516
|
/** Add a rectangle */
|
|
1464
|
-
rect(a, t,
|
|
1465
|
-
const
|
|
1517
|
+
rect(a, t, r, i, n) {
|
|
1518
|
+
const s = (n == null ? void 0 : n.fadeIn) ?? 12;
|
|
1466
1519
|
return this.addAtCursor({
|
|
1467
1520
|
type: "rect",
|
|
1468
1521
|
x: a,
|
|
1469
1522
|
y: t,
|
|
1470
|
-
width:
|
|
1471
|
-
height:
|
|
1523
|
+
width: r,
|
|
1524
|
+
height: i,
|
|
1472
1525
|
fill: (n == null ? void 0 : n.fill) ?? "none",
|
|
1473
1526
|
stroke: (n == null ? void 0 : n.stroke) ?? this.theme.boxStroke,
|
|
1474
1527
|
strokeWidth: (n == null ? void 0 : n.strokeWidth) ?? 1.5,
|
|
1475
1528
|
rx: (n == null ? void 0 : n.rx) ?? 6,
|
|
1476
1529
|
strokeDasharray: n != null && n.dashed ? "6 3" : void 0,
|
|
1477
|
-
fadeIn:
|
|
1530
|
+
fadeIn: s
|
|
1478
1531
|
}, (n == null ? void 0 : n.advance) ?? 5);
|
|
1479
1532
|
}
|
|
1480
1533
|
/** Add a circle */
|
|
1481
|
-
circle(a, t,
|
|
1482
|
-
const n = (
|
|
1534
|
+
circle(a, t, r, i) {
|
|
1535
|
+
const n = (i == null ? void 0 : i.fadeIn) ?? 12;
|
|
1483
1536
|
return this.addAtCursor({
|
|
1484
1537
|
type: "circle",
|
|
1485
1538
|
cx: a,
|
|
1486
1539
|
cy: t,
|
|
1487
|
-
r
|
|
1488
|
-
fill: (
|
|
1489
|
-
stroke: (
|
|
1490
|
-
strokeWidth: (
|
|
1540
|
+
r,
|
|
1541
|
+
fill: (i == null ? void 0 : i.fill) ?? "none",
|
|
1542
|
+
stroke: (i == null ? void 0 : i.stroke) ?? this.theme.primary,
|
|
1543
|
+
strokeWidth: (i == null ? void 0 : i.strokeWidth) ?? 2,
|
|
1491
1544
|
fadeIn: n
|
|
1492
|
-
}, (
|
|
1545
|
+
}, (i == null ? void 0 : i.advance) ?? 5);
|
|
1493
1546
|
}
|
|
1494
1547
|
/** Add a bar chart */
|
|
1495
1548
|
barChart(a, t) {
|
|
1496
|
-
const
|
|
1549
|
+
const r = t.fadeIn ?? 20;
|
|
1497
1550
|
return this.addAtCursor({
|
|
1498
1551
|
type: "barChart",
|
|
1499
1552
|
bars: a,
|
|
@@ -1508,12 +1561,12 @@ class Lt {
|
|
|
1508
1561
|
valueFormat: t.valueFormat,
|
|
1509
1562
|
gap: t.gap,
|
|
1510
1563
|
showValues: t.showValues,
|
|
1511
|
-
fadeIn:
|
|
1564
|
+
fadeIn: r
|
|
1512
1565
|
}, 10);
|
|
1513
1566
|
}
|
|
1514
1567
|
/** Add a matrix visualization */
|
|
1515
1568
|
matrix(a, t) {
|
|
1516
|
-
const
|
|
1569
|
+
const r = (t == null ? void 0 : t.fadeIn) ?? 20;
|
|
1517
1570
|
return this.addAtCursor({
|
|
1518
1571
|
type: "matrix",
|
|
1519
1572
|
values: a,
|
|
@@ -1523,22 +1576,22 @@ class Lt {
|
|
|
1523
1576
|
color: (t == null ? void 0 : t.color) ?? this.theme.text,
|
|
1524
1577
|
bracketColor: (t == null ? void 0 : t.bracketColor) ?? this.theme.primary,
|
|
1525
1578
|
fontSize: t == null ? void 0 : t.fontSize,
|
|
1526
|
-
fadeIn:
|
|
1579
|
+
fadeIn: r
|
|
1527
1580
|
}, 10);
|
|
1528
1581
|
}
|
|
1529
1582
|
/** Add a graph (nodes + edges) */
|
|
1530
|
-
graph(a, t,
|
|
1531
|
-
const
|
|
1583
|
+
graph(a, t, r) {
|
|
1584
|
+
const i = (r == null ? void 0 : r.fadeIn) ?? 20;
|
|
1532
1585
|
return this.addAtCursor({
|
|
1533
1586
|
type: "graph",
|
|
1534
1587
|
nodes: a,
|
|
1535
1588
|
edges: t,
|
|
1536
|
-
nodeColor: (
|
|
1537
|
-
edgeColor: (
|
|
1538
|
-
labelColor: (
|
|
1539
|
-
nodeRadius:
|
|
1540
|
-
edgeWidth:
|
|
1541
|
-
fadeIn:
|
|
1589
|
+
nodeColor: (r == null ? void 0 : r.nodeColor) ?? this.theme.secondary,
|
|
1590
|
+
edgeColor: (r == null ? void 0 : r.edgeColor) ?? this.theme.muted,
|
|
1591
|
+
labelColor: (r == null ? void 0 : r.labelColor) ?? "#fff",
|
|
1592
|
+
nodeRadius: r == null ? void 0 : r.nodeRadius,
|
|
1593
|
+
edgeWidth: r == null ? void 0 : r.edgeWidth,
|
|
1594
|
+
fadeIn: i
|
|
1542
1595
|
}, 10);
|
|
1543
1596
|
}
|
|
1544
1597
|
// ─── Layout helpers ──────────────────────────────────────────────────
|
|
@@ -1547,33 +1600,33 @@ class Lt {
|
|
|
1547
1600
|
* Returns the box positions for follow-up arrows, etc.
|
|
1548
1601
|
*/
|
|
1549
1602
|
boxRow(a, t) {
|
|
1550
|
-
const
|
|
1603
|
+
const r = (t == null ? void 0 : t.boxWidth) ?? 80, i = (t == null ? void 0 : t.boxHeight) ?? 40, n = (t == null ? void 0 : t.gap) ?? 12, s = (t == null ? void 0 : t.y) ?? 250, l = a.length * r + (a.length - 1) * n, b = (this._width - l) / 2;
|
|
1551
1604
|
t == null || t.fadeIn;
|
|
1552
|
-
const
|
|
1553
|
-
const
|
|
1554
|
-
return { x:
|
|
1555
|
-
}),
|
|
1556
|
-
var
|
|
1557
|
-
const
|
|
1605
|
+
const A = a.map((x, u) => {
|
|
1606
|
+
const o = b + u * (r + n);
|
|
1607
|
+
return { x: o, y: s, w: r, h: i, cx: o + r / 2, cy: s + i / 2 };
|
|
1608
|
+
}), E = a.map((x, u) => {
|
|
1609
|
+
var S, C;
|
|
1610
|
+
const o = A[u], y = ((S = t == null ? void 0 : t.colors) == null ? void 0 : S[u]) ?? this.theme.boxFill, w = ((C = t == null ? void 0 : t.strokeColors) == null ? void 0 : C[u]) ?? this.theme.boxStroke;
|
|
1558
1611
|
return {
|
|
1559
1612
|
type: "group",
|
|
1560
1613
|
children: [
|
|
1561
1614
|
{
|
|
1562
1615
|
type: "rect",
|
|
1563
|
-
x:
|
|
1564
|
-
y:
|
|
1565
|
-
width:
|
|
1566
|
-
height:
|
|
1567
|
-
fill:
|
|
1616
|
+
x: o.x,
|
|
1617
|
+
y: o.y,
|
|
1618
|
+
width: r,
|
|
1619
|
+
height: i,
|
|
1620
|
+
fill: y,
|
|
1568
1621
|
stroke: w,
|
|
1569
1622
|
strokeWidth: 1.5,
|
|
1570
1623
|
rx: 6
|
|
1571
1624
|
},
|
|
1572
1625
|
{
|
|
1573
1626
|
type: "text",
|
|
1574
|
-
x:
|
|
1575
|
-
y:
|
|
1576
|
-
content:
|
|
1627
|
+
x: o.cx,
|
|
1628
|
+
y: o.cy + 5,
|
|
1629
|
+
content: x,
|
|
1577
1630
|
fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
|
|
1578
1631
|
fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
|
|
1579
1632
|
textAnchor: "middle",
|
|
@@ -1585,40 +1638,40 @@ class Lt {
|
|
|
1585
1638
|
return this.addAtCursor({
|
|
1586
1639
|
type: "stagger",
|
|
1587
1640
|
staggerDelay: 3,
|
|
1588
|
-
children:
|
|
1589
|
-
}, 8 + a.length * 2),
|
|
1641
|
+
children: E
|
|
1642
|
+
}, 8 + a.length * 2), A;
|
|
1590
1643
|
}
|
|
1591
1644
|
/**
|
|
1592
1645
|
* Render a vertical stack of labeled boxes.
|
|
1593
1646
|
*/
|
|
1594
1647
|
boxColumn(a, t) {
|
|
1595
|
-
const
|
|
1648
|
+
const r = (t == null ? void 0 : t.boxWidth) ?? 160, i = (t == null ? void 0 : t.boxHeight) ?? 36, n = (t == null ? void 0 : t.gap) ?? 8, s = (t == null ? void 0 : t.y) ?? 150, l = (t == null ? void 0 : t.x) ?? this.cx;
|
|
1596
1649
|
t == null || t.fadeIn;
|
|
1597
|
-
const
|
|
1598
|
-
const
|
|
1599
|
-
return { x:
|
|
1600
|
-
}),
|
|
1601
|
-
var
|
|
1602
|
-
const
|
|
1650
|
+
const b = a.map((E, x) => {
|
|
1651
|
+
const u = s + x * (i + n);
|
|
1652
|
+
return { x: l - r / 2, y: u, w: r, h: i, cx: l, cy: u + i / 2 };
|
|
1653
|
+
}), A = a.map((E, x) => {
|
|
1654
|
+
var y, w;
|
|
1655
|
+
const u = b[x], o = ((y = t == null ? void 0 : t.colors) == null ? void 0 : y[x]) ?? this.theme.boxFill;
|
|
1603
1656
|
return {
|
|
1604
1657
|
type: "group",
|
|
1605
1658
|
children: [
|
|
1606
1659
|
{
|
|
1607
1660
|
type: "rect",
|
|
1608
|
-
x:
|
|
1609
|
-
y:
|
|
1610
|
-
width:
|
|
1611
|
-
height:
|
|
1612
|
-
fill:
|
|
1613
|
-
stroke: (w = t == null ? void 0 : t.colors) != null && w[
|
|
1661
|
+
x: u.x,
|
|
1662
|
+
y: u.y,
|
|
1663
|
+
width: r,
|
|
1664
|
+
height: i,
|
|
1665
|
+
fill: o,
|
|
1666
|
+
stroke: (w = t == null ? void 0 : t.colors) != null && w[x] ? t.colors[x] : this.theme.boxStroke,
|
|
1614
1667
|
strokeWidth: 1.5,
|
|
1615
1668
|
rx: 6
|
|
1616
1669
|
},
|
|
1617
1670
|
{
|
|
1618
1671
|
type: "text",
|
|
1619
|
-
x:
|
|
1620
|
-
y:
|
|
1621
|
-
content:
|
|
1672
|
+
x: u.cx,
|
|
1673
|
+
y: u.cy + 5,
|
|
1674
|
+
content: E,
|
|
1622
1675
|
fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
|
|
1623
1676
|
fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
|
|
1624
1677
|
textAnchor: "middle"
|
|
@@ -1629,22 +1682,22 @@ class Lt {
|
|
|
1629
1682
|
return this.addAtCursor({
|
|
1630
1683
|
type: "stagger",
|
|
1631
1684
|
staggerDelay: 3,
|
|
1632
|
-
children:
|
|
1633
|
-
}, 8 + a.length * 2),
|
|
1685
|
+
children: A
|
|
1686
|
+
}, 8 + a.length * 2), b;
|
|
1634
1687
|
}
|
|
1635
1688
|
/**
|
|
1636
1689
|
* Draw arrows connecting sequential positions (e.g., output of boxRow/boxColumn).
|
|
1637
1690
|
*/
|
|
1638
1691
|
connectDown(a, t) {
|
|
1639
|
-
const
|
|
1640
|
-
for (let
|
|
1641
|
-
const n = a[
|
|
1642
|
-
|
|
1692
|
+
const r = [];
|
|
1693
|
+
for (let i = 0; i < a.length - 1; i++) {
|
|
1694
|
+
const n = a[i], s = a[i + 1];
|
|
1695
|
+
r.push({
|
|
1643
1696
|
type: "arrow",
|
|
1644
1697
|
x1: n.cx,
|
|
1645
1698
|
y1: n.y + n.h + 2,
|
|
1646
|
-
x2:
|
|
1647
|
-
y2:
|
|
1699
|
+
x2: s.cx,
|
|
1700
|
+
y2: s.y - 2,
|
|
1648
1701
|
stroke: (t == null ? void 0 : t.color) ?? this.theme.muted,
|
|
1649
1702
|
strokeWidth: 1.5,
|
|
1650
1703
|
headSize: (t == null ? void 0 : t.headSize) ?? 6
|
|
@@ -1653,30 +1706,30 @@ class Lt {
|
|
|
1653
1706
|
return this.addAtCursor({
|
|
1654
1707
|
type: "stagger",
|
|
1655
1708
|
staggerDelay: 2,
|
|
1656
|
-
children:
|
|
1709
|
+
children: r
|
|
1657
1710
|
}, 5 + a.length * 2);
|
|
1658
1711
|
}
|
|
1659
1712
|
/**
|
|
1660
1713
|
* Draw arrows between two rows of boxes (fan-out pattern).
|
|
1661
1714
|
*/
|
|
1662
|
-
connectRows(a, t,
|
|
1663
|
-
const
|
|
1715
|
+
connectRows(a, t, r) {
|
|
1716
|
+
const i = [];
|
|
1664
1717
|
if (a.length === t.length)
|
|
1665
1718
|
for (let n = 0; n < a.length; n++)
|
|
1666
|
-
|
|
1719
|
+
i.push({
|
|
1667
1720
|
type: "arrow",
|
|
1668
1721
|
x1: a[n].cx,
|
|
1669
1722
|
y1: a[n].y + a[n].h + 2,
|
|
1670
1723
|
x2: t[n].cx,
|
|
1671
1724
|
y2: t[n].y - 2,
|
|
1672
|
-
stroke: (
|
|
1725
|
+
stroke: (r == null ? void 0 : r.color) ?? this.theme.muted,
|
|
1673
1726
|
strokeWidth: 1.5,
|
|
1674
|
-
headSize: (
|
|
1727
|
+
headSize: (r == null ? void 0 : r.headSize) ?? 6
|
|
1675
1728
|
});
|
|
1676
1729
|
return this.addAtCursor({
|
|
1677
1730
|
type: "fadeIn",
|
|
1678
1731
|
duration: 15,
|
|
1679
|
-
children:
|
|
1732
|
+
children: i
|
|
1680
1733
|
}, 15);
|
|
1681
1734
|
}
|
|
1682
1735
|
// ─── Raw element access ──────────────────────────────────────────────
|
|
@@ -1713,7 +1766,7 @@ class Lt {
|
|
|
1713
1766
|
return { elements: this.elements, durationInFrames: a };
|
|
1714
1767
|
}
|
|
1715
1768
|
}
|
|
1716
|
-
const
|
|
1769
|
+
const qt = {
|
|
1717
1770
|
background: "#0a0a1e",
|
|
1718
1771
|
title: "#e0e7ff",
|
|
1719
1772
|
subtitle: "#94a3b8",
|
|
@@ -1728,7 +1781,7 @@ const jt = {
|
|
|
1728
1781
|
warning: "#fbbf24",
|
|
1729
1782
|
error: "#f87171",
|
|
1730
1783
|
palette: ["#4fc3f7", "#a78bfa", "#f472b6", "#34d399", "#fbbf24", "#fb923c", "#6366f1", "#22d3ee"]
|
|
1731
|
-
},
|
|
1784
|
+
}, Yt = {
|
|
1732
1785
|
background: "#f8fafc",
|
|
1733
1786
|
title: "#1e293b",
|
|
1734
1787
|
subtitle: "#64748b",
|
|
@@ -1744,9 +1797,9 @@ const jt = {
|
|
|
1744
1797
|
error: "#dc2626",
|
|
1745
1798
|
palette: ["#2563eb", "#7c3aed", "#db2777", "#16a34a", "#d97706", "#ea580c", "#4f46e5", "#0891b2"]
|
|
1746
1799
|
};
|
|
1747
|
-
class
|
|
1748
|
-
constructor(a, t,
|
|
1749
|
-
this._slides = [], this._title = a, this._theme = t ??
|
|
1800
|
+
class Bt {
|
|
1801
|
+
constructor(a, t, r) {
|
|
1802
|
+
this._slides = [], this._title = a, this._theme = t ?? qt, this._opts = {
|
|
1750
1803
|
width: 900,
|
|
1751
1804
|
height: 640,
|
|
1752
1805
|
fps: 30,
|
|
@@ -1754,35 +1807,35 @@ class qt {
|
|
|
1754
1807
|
transitionDuration: 10,
|
|
1755
1808
|
showHud: !0,
|
|
1756
1809
|
showNotes: !0,
|
|
1757
|
-
...
|
|
1810
|
+
...r
|
|
1758
1811
|
};
|
|
1759
1812
|
}
|
|
1760
1813
|
/** Add a slide */
|
|
1761
|
-
slide(a, t,
|
|
1762
|
-
return this._slides.push({ title: a, build: t, notes:
|
|
1814
|
+
slide(a, t, r) {
|
|
1815
|
+
return this._slides.push({ title: a, build: t, notes: r == null ? void 0 : r.notes, background: r == null ? void 0 : r.background }), this;
|
|
1763
1816
|
}
|
|
1764
1817
|
/** Build the final ElucimDocument */
|
|
1765
1818
|
build() {
|
|
1766
|
-
const a = this._slides.map((
|
|
1767
|
-
const
|
|
1819
|
+
const a = this._slides.map((r) => {
|
|
1820
|
+
const i = new jt(
|
|
1768
1821
|
this._theme,
|
|
1769
1822
|
this._opts.fps,
|
|
1770
1823
|
this._opts.width,
|
|
1771
1824
|
this._opts.height
|
|
1772
1825
|
);
|
|
1773
|
-
|
|
1774
|
-
const { elements: n, durationInFrames:
|
|
1826
|
+
r.build(i);
|
|
1827
|
+
const { elements: n, durationInFrames: s } = i._build();
|
|
1775
1828
|
return {
|
|
1776
1829
|
type: "slide",
|
|
1777
|
-
title:
|
|
1778
|
-
notes:
|
|
1779
|
-
background:
|
|
1830
|
+
title: r.title,
|
|
1831
|
+
notes: r.notes,
|
|
1832
|
+
background: r.background,
|
|
1780
1833
|
children: [{
|
|
1781
1834
|
type: "player",
|
|
1782
1835
|
width: this._opts.width,
|
|
1783
1836
|
height: this._opts.height,
|
|
1784
1837
|
fps: this._opts.fps,
|
|
1785
|
-
durationInFrames:
|
|
1838
|
+
durationInFrames: s,
|
|
1786
1839
|
controls: !1,
|
|
1787
1840
|
loop: !1,
|
|
1788
1841
|
autoPlay: !0,
|
|
@@ -1810,26 +1863,29 @@ class qt {
|
|
|
1810
1863
|
return JSON.stringify(this.build(), null, a ? 2 : void 0);
|
|
1811
1864
|
}
|
|
1812
1865
|
}
|
|
1813
|
-
function
|
|
1814
|
-
return new
|
|
1866
|
+
function Zt(e, a, t) {
|
|
1867
|
+
return new Bt(e, a, t);
|
|
1815
1868
|
}
|
|
1816
1869
|
export {
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1870
|
+
Xt as DslRenderer,
|
|
1871
|
+
Bt as PresentationBuilder,
|
|
1872
|
+
ae as SEMANTIC_TOKENS,
|
|
1873
|
+
jt as SlideBuilder,
|
|
1874
|
+
Qt as TOKEN_NAMES,
|
|
1875
|
+
st as compileExpression,
|
|
1876
|
+
ct as compileVectorExpression,
|
|
1877
|
+
qt as darkTheme,
|
|
1878
|
+
Yt as lightTheme,
|
|
1879
|
+
Zt as presentation,
|
|
1880
|
+
v as renderElement,
|
|
1881
|
+
ie as renderPlayer,
|
|
1882
|
+
_t as renderPresentation,
|
|
1883
|
+
re as renderRoot,
|
|
1884
|
+
q as renderScene,
|
|
1885
|
+
Dt as renderSlide,
|
|
1886
|
+
Jt as renderToSvgString,
|
|
1887
|
+
h as resolveColor,
|
|
1888
|
+
g as resolveEasing,
|
|
1889
|
+
Y as validate,
|
|
1890
|
+
J as validateExpression
|
|
1835
1891
|
};
|