@elucim/dsl 0.3.0 → 0.4.1
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 +32 -0
- package/dist/index.d.ts +84 -2
- package/dist/index.js +452 -328
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { easeOutBounce as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { easeOutBounce as ae, easeOutElastic as ie, easeOutBack as re, easeInBack as ne, easeInOutExpo as se, easeOutExpo as ce, easeInExpo as le, easeInOutSine as ue, easeOutSine as he, easeInSine as fe, easeInOutQuart as ge, easeOutQuart as ye, easeInQuart as oe, easeInOutCubic as me, easeOutCubic as be, easeInCubic as xe, easeInOutQuad as ve, easeOutQuad as de, easeInQuad as we, linear as ke, spring as Ie, cubicBezier as Se, Presentation as $e, Scene as Oe, Player as Ae, Slide as Ce, Parallel as ze, Stagger as pe, Morph as Ee, Transform as Fe, Write as Pe, Draw as Re, FadeOut as Te, FadeIn as Me, BarChart as Ne, LaTeX as We, Graph as _e, Matrix as De, VectorField as Le, Vector as je, FunctionPlot as qe, Axes as Be, Image as Ve, Text as Ue, Polygon as He, Rect as Ge, Arrow as Qe, Line as Ke, Circle as Xe, BezierCurve as Je, Group as Ye, Sequence as Ze } from "@elucim/core";
|
|
2
|
+
import { jsx as s, jsxs as E } from "react/jsx-runtime";
|
|
3
|
+
import V, { forwardRef as et, useRef as tt, useImperativeHandle as at } from "react";
|
|
4
|
+
import { renderToStaticMarkup as it } from "react-dom/server";
|
|
5
|
+
const D = {
|
|
5
6
|
sin: Math.sin,
|
|
6
7
|
cos: Math.cos,
|
|
7
8
|
tan: Math.tan,
|
|
@@ -21,12 +22,12 @@ const W = {
|
|
|
21
22
|
max: (...e) => Math.max(...e),
|
|
22
23
|
sign: Math.sign,
|
|
23
24
|
pow: Math.pow
|
|
24
|
-
},
|
|
25
|
+
}, U = {
|
|
25
26
|
PI: Math.PI,
|
|
26
27
|
E: Math.E,
|
|
27
28
|
TAU: Math.PI * 2
|
|
28
29
|
};
|
|
29
|
-
function
|
|
30
|
+
function q(e) {
|
|
30
31
|
const a = [];
|
|
31
32
|
let t = 0;
|
|
32
33
|
for (; t < e.length; ) {
|
|
@@ -84,12 +85,12 @@ function _(e) {
|
|
|
84
85
|
a.push({ type: "COMMA", value: ",", pos: r });
|
|
85
86
|
break;
|
|
86
87
|
default:
|
|
87
|
-
throw new
|
|
88
|
+
throw new k(`Unexpected character '${i}'`, r);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
return a.push({ type: "EOF", value: "", pos: t }), a;
|
|
91
92
|
}
|
|
92
|
-
class
|
|
93
|
+
class B {
|
|
93
94
|
constructor(a) {
|
|
94
95
|
this.pos = 0, this.tokens = a;
|
|
95
96
|
}
|
|
@@ -103,7 +104,7 @@ class D {
|
|
|
103
104
|
expect(a) {
|
|
104
105
|
const t = this.peek();
|
|
105
106
|
if (t.type !== a)
|
|
106
|
-
throw new
|
|
107
|
+
throw new k(
|
|
107
108
|
`Expected ${a} but got ${t.type} ('${t.value}')`,
|
|
108
109
|
t.pos
|
|
109
110
|
);
|
|
@@ -114,7 +115,7 @@ class D {
|
|
|
114
115
|
const a = this.parseExpression();
|
|
115
116
|
if (this.peek().type !== "EOF") {
|
|
116
117
|
const t = this.peek();
|
|
117
|
-
throw new
|
|
118
|
+
throw new k(
|
|
118
119
|
`Unexpected token '${t.value}' after expression`,
|
|
119
120
|
t.pos
|
|
120
121
|
);
|
|
@@ -167,14 +168,14 @@ class D {
|
|
|
167
168
|
if (this.peek().type !== "RPAREN")
|
|
168
169
|
for (i.push(this.parseExpression()); this.peek().type === "COMMA"; )
|
|
169
170
|
this.advance(), i.push(this.parseExpression());
|
|
170
|
-
if (this.expect("RPAREN"), !Object.prototype.hasOwnProperty.call(
|
|
171
|
-
throw new
|
|
172
|
-
`Unknown function '${t}'. Available: ${Object.keys(
|
|
171
|
+
if (this.expect("RPAREN"), !Object.prototype.hasOwnProperty.call(D, t))
|
|
172
|
+
throw new k(
|
|
173
|
+
`Unknown function '${t}'. Available: ${Object.keys(D).join(", ")}`,
|
|
173
174
|
a.pos
|
|
174
175
|
);
|
|
175
176
|
return { kind: "call", name: t, args: i };
|
|
176
177
|
}
|
|
177
|
-
return Object.prototype.hasOwnProperty.call(
|
|
178
|
+
return Object.prototype.hasOwnProperty.call(U, t) ? { kind: "number", value: U[t] } : { kind: "variable", name: t };
|
|
178
179
|
}
|
|
179
180
|
if (a.type === "LPAREN") {
|
|
180
181
|
this.advance();
|
|
@@ -189,24 +190,24 @@ class D {
|
|
|
189
190
|
this.advance(), t.push(this.parseExpression());
|
|
190
191
|
return this.expect("RBRACKET"), { kind: "array", elements: t };
|
|
191
192
|
}
|
|
192
|
-
throw new
|
|
193
|
+
throw new k(
|
|
193
194
|
`Unexpected token '${a.value}'`,
|
|
194
195
|
a.pos
|
|
195
196
|
);
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
+
function C(e, a) {
|
|
199
200
|
switch (e.kind) {
|
|
200
201
|
case "number":
|
|
201
202
|
return e.value;
|
|
202
203
|
case "variable":
|
|
203
204
|
if (Object.prototype.hasOwnProperty.call(a, e.name)) return a[e.name];
|
|
204
|
-
throw new
|
|
205
|
+
throw new k(`Unknown variable '${e.name}'`, 0);
|
|
205
206
|
case "unary":
|
|
206
|
-
const t =
|
|
207
|
+
const t = C(e.operand, a);
|
|
207
208
|
return e.op === "-" ? -t : t;
|
|
208
209
|
case "binary": {
|
|
209
|
-
const i =
|
|
210
|
+
const i = C(e.left, a), r = C(e.right, a);
|
|
210
211
|
switch (e.op) {
|
|
211
212
|
case "+":
|
|
212
213
|
return i + r;
|
|
@@ -222,95 +223,95 @@ function d(e, a) {
|
|
|
222
223
|
break;
|
|
223
224
|
}
|
|
224
225
|
case "call": {
|
|
225
|
-
const i =
|
|
226
|
+
const i = D[e.name], r = e.args.map((n) => C(n, a));
|
|
226
227
|
return i(...r);
|
|
227
228
|
}
|
|
228
229
|
case "array":
|
|
229
|
-
return e.elements.map((i) =>
|
|
230
|
+
return e.elements.map((i) => C(i, a));
|
|
230
231
|
}
|
|
231
|
-
throw new
|
|
232
|
+
throw new k("Invalid AST node", 0);
|
|
232
233
|
}
|
|
233
|
-
class
|
|
234
|
+
class k extends Error {
|
|
234
235
|
constructor(a, t) {
|
|
235
236
|
super(a), this.name = "ExpressionError", this.position = t;
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
|
-
function
|
|
239
|
-
const a =
|
|
240
|
-
return (i) =>
|
|
239
|
+
function rt(e) {
|
|
240
|
+
const a = q(e), t = new B(a).parse();
|
|
241
|
+
return (i) => C(t, i);
|
|
241
242
|
}
|
|
242
|
-
function
|
|
243
|
-
const a =
|
|
243
|
+
function nt(e) {
|
|
244
|
+
const a = q(e), t = new B(a).parse();
|
|
244
245
|
if (t.kind !== "array" || t.elements.length !== 2)
|
|
245
|
-
throw new
|
|
246
|
+
throw new k(
|
|
246
247
|
'Vector expression must be an array of 2 elements, e.g. "[-y, x]"',
|
|
247
248
|
0
|
|
248
249
|
);
|
|
249
|
-
return (i) =>
|
|
250
|
+
return (i) => C(t, i);
|
|
250
251
|
}
|
|
251
|
-
function
|
|
252
|
+
function K(e) {
|
|
252
253
|
try {
|
|
253
|
-
const a =
|
|
254
|
-
return new
|
|
254
|
+
const a = q(e);
|
|
255
|
+
return new B(a).parse(), null;
|
|
255
256
|
} catch (a) {
|
|
256
|
-
return a instanceof
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
const
|
|
260
|
-
linear:
|
|
261
|
-
easeInQuad:
|
|
262
|
-
easeOutQuad:
|
|
263
|
-
easeInOutQuad:
|
|
264
|
-
easeInCubic:
|
|
265
|
-
easeOutCubic:
|
|
266
|
-
easeInOutCubic:
|
|
267
|
-
easeInQuart:
|
|
268
|
-
easeOutQuart:
|
|
269
|
-
easeInOutQuart:
|
|
270
|
-
easeInSine:
|
|
271
|
-
easeOutSine:
|
|
272
|
-
easeInOutSine:
|
|
273
|
-
easeInExpo:
|
|
274
|
-
easeOutExpo:
|
|
275
|
-
easeInOutExpo:
|
|
276
|
-
easeInBack:
|
|
277
|
-
easeOutBack:
|
|
278
|
-
easeOutElastic:
|
|
279
|
-
easeOutBounce:
|
|
257
|
+
return a instanceof k ? `${a.message} (at position ${a.position})` : String(a);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const L = {
|
|
261
|
+
linear: ke,
|
|
262
|
+
easeInQuad: we,
|
|
263
|
+
easeOutQuad: de,
|
|
264
|
+
easeInOutQuad: ve,
|
|
265
|
+
easeInCubic: xe,
|
|
266
|
+
easeOutCubic: be,
|
|
267
|
+
easeInOutCubic: me,
|
|
268
|
+
easeInQuart: oe,
|
|
269
|
+
easeOutQuart: ye,
|
|
270
|
+
easeInOutQuart: ge,
|
|
271
|
+
easeInSine: fe,
|
|
272
|
+
easeOutSine: he,
|
|
273
|
+
easeInOutSine: ue,
|
|
274
|
+
easeInExpo: le,
|
|
275
|
+
easeOutExpo: ce,
|
|
276
|
+
easeInOutExpo: se,
|
|
277
|
+
easeInBack: ne,
|
|
278
|
+
easeOutBack: re,
|
|
279
|
+
easeOutElastic: ie,
|
|
280
|
+
easeOutBounce: ae
|
|
280
281
|
};
|
|
281
|
-
function
|
|
282
|
+
function h(e) {
|
|
282
283
|
if (e !== void 0) {
|
|
283
284
|
if (typeof e == "string") {
|
|
284
|
-
const a =
|
|
285
|
+
const a = L[e];
|
|
285
286
|
if (!a) {
|
|
286
|
-
const t = Object.keys(
|
|
287
|
+
const t = Object.keys(L), i = t.find((n) => n.toLowerCase() === e.toLowerCase()), r = i ? ` Did you mean '${i}'?` : "";
|
|
287
288
|
throw new Error(`Unknown easing '${e}'.${r} Available: ${t.join(", ")}`);
|
|
288
289
|
}
|
|
289
290
|
return a;
|
|
290
291
|
}
|
|
291
292
|
if (e.type === "spring")
|
|
292
|
-
return
|
|
293
|
+
return Ie({
|
|
293
294
|
stiffness: e.stiffness,
|
|
294
295
|
damping: e.damping,
|
|
295
296
|
mass: e.mass
|
|
296
297
|
});
|
|
297
298
|
if (e.type === "cubicBezier")
|
|
298
|
-
return
|
|
299
|
+
return Se(e.x1, e.y1, e.x2, e.y2);
|
|
299
300
|
throw new Error(`Unknown easing type: ${e.type}`);
|
|
300
301
|
}
|
|
301
302
|
}
|
|
302
|
-
const
|
|
303
|
-
function
|
|
303
|
+
const W = Object.keys(L);
|
|
304
|
+
function X(e) {
|
|
304
305
|
const a = [];
|
|
305
306
|
if (!e || typeof e != "object")
|
|
306
307
|
return a.push({ path: "", message: "Document must be an object", severity: "error" }), { valid: !1, errors: a };
|
|
307
308
|
const t = e;
|
|
308
|
-
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((i) => i.severity === "error").length === 0, errors: a }) : (
|
|
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((i) => i.severity === "error").length === 0, errors: a }) : (st(t.root, "root", a), {
|
|
309
310
|
valid: a.filter((i) => i.severity === "error").length === 0,
|
|
310
311
|
errors: a
|
|
311
312
|
});
|
|
312
313
|
}
|
|
313
|
-
const
|
|
314
|
+
const H = ["scene", "player", "presentation"], T = ["card", "slide", "square"], _ = [
|
|
314
315
|
"sequence",
|
|
315
316
|
"group",
|
|
316
317
|
"bezierCurve",
|
|
@@ -339,219 +340,219 @@ const B = ["scene", "player", "presentation"], N = [
|
|
|
339
340
|
"parallel",
|
|
340
341
|
"player",
|
|
341
342
|
"scene"
|
|
342
|
-
],
|
|
343
|
-
function
|
|
343
|
+
], G = ["none", "fade", "slide-left", "slide-up", "zoom"];
|
|
344
|
+
function st(e, a, t) {
|
|
344
345
|
const i = e.type;
|
|
345
|
-
if (!
|
|
346
|
-
t.push({ path: `${a}.type`, message: `Root type must be one of: ${
|
|
346
|
+
if (!H.includes(i)) {
|
|
347
|
+
t.push({ path: `${a}.type`, message: `Root type must be one of: ${H.join(", ")}. Got "${i}"`, severity: "error" });
|
|
347
348
|
return;
|
|
348
349
|
}
|
|
349
|
-
i === "scene" || i === "player" ?
|
|
350
|
+
i === "scene" || i === "player" ? J(e, a, i, t) : i === "presentation" && ct(e, a, t);
|
|
350
351
|
}
|
|
351
|
-
function
|
|
352
|
-
|
|
352
|
+
function J(e, a, t, i) {
|
|
353
|
+
Rt(e, "durationInFrames", a, i), y(e, "width", a, i), y(e, "height", a, i), y(e, "fps", a, i), S(e, "background", a, i), e.preset !== void 0 && (typeof e.preset != "string" || !T.includes(e.preset)) && i.push({ path: `${a}.preset`, message: `preset must be one of: ${T.join(", ")}. Got "${e.preset}"`, severity: "error" }), t === "player" && (R(e, "controls", a, i), R(e, "loop", a, i), R(e, "autoPlay", a, i)), $(e, a, i);
|
|
353
354
|
}
|
|
354
|
-
function
|
|
355
|
-
if (
|
|
355
|
+
function ct(e, a, t) {
|
|
356
|
+
if (y(e, "width", a, t), y(e, "height", a, t), S(e, "background", a, t), y(e, "transitionDuration", a, t), R(e, "showHud", a, t), R(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 && (G.includes(e.transition) || t.push({
|
|
356
357
|
path: `${a}.transition`,
|
|
357
|
-
message: `Invalid transition "${e.transition}". Must be one of: ${
|
|
358
|
+
message: `Invalid transition "${e.transition}". Must be one of: ${G.join(", ")}`,
|
|
358
359
|
severity: "error"
|
|
359
360
|
})), !Array.isArray(e.slides)) {
|
|
360
361
|
t.push({ path: `${a}.slides`, message: 'Presentation must have a "slides" array', severity: "error" });
|
|
361
362
|
return;
|
|
362
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((i, r) => {
|
|
364
|
-
|
|
365
|
+
lt(i, `${a}.slides[${r}]`, t);
|
|
365
366
|
});
|
|
366
367
|
}
|
|
367
|
-
function
|
|
368
|
+
function lt(e, a, t) {
|
|
368
369
|
if (!e || typeof e != "object") {
|
|
369
370
|
t.push({ path: a, message: "Slide must be an object", severity: "error" });
|
|
370
371
|
return;
|
|
371
372
|
}
|
|
372
|
-
|
|
373
|
-
|
|
373
|
+
S(e, "title", a, t), S(e, "notes", a, t), S(e, "background", a, t), e.children !== void 0 && (Array.isArray(e.children) ? e.children.forEach((i, r) => {
|
|
374
|
+
Y(i, `${a}.children[${r}]`, t);
|
|
374
375
|
}) : t.push({ path: `${a}.children`, message: "Slide children must be an array", severity: "error" }));
|
|
375
376
|
}
|
|
376
|
-
function
|
|
377
|
+
function $(e, a, t) {
|
|
377
378
|
if (!Array.isArray(e.children)) {
|
|
378
379
|
t.push({ path: `${a}.children`, message: 'Expected "children" array', severity: "error" });
|
|
379
380
|
return;
|
|
380
381
|
}
|
|
381
382
|
e.children.forEach((i, r) => {
|
|
382
|
-
|
|
383
|
+
Y(i, `${a}.children[${r}]`, t);
|
|
383
384
|
});
|
|
384
385
|
}
|
|
385
|
-
function
|
|
386
|
+
function Y(e, a, t) {
|
|
386
387
|
if (!e || typeof e != "object") {
|
|
387
388
|
t.push({ path: a, message: "Element must be an object", severity: "error" });
|
|
388
389
|
return;
|
|
389
390
|
}
|
|
390
391
|
const i = e.type;
|
|
391
|
-
if (!i || !
|
|
392
|
-
const r = i ?
|
|
392
|
+
if (!i || !_.includes(i)) {
|
|
393
|
+
const r = i ? Z(i, _) : "";
|
|
393
394
|
t.push({
|
|
394
395
|
path: `${a}.type`,
|
|
395
|
-
message: `Unknown element type "${i}".${r} Valid types: ${
|
|
396
|
+
message: `Unknown element type "${i}".${r} Valid types: ${_.join(", ")}`,
|
|
396
397
|
severity: "error"
|
|
397
398
|
});
|
|
398
399
|
return;
|
|
399
400
|
}
|
|
400
401
|
switch (i) {
|
|
401
402
|
case "bezierCurve":
|
|
402
|
-
|
|
403
|
+
ut(e, a, t);
|
|
403
404
|
break;
|
|
404
405
|
case "circle":
|
|
405
|
-
|
|
406
|
+
ht(e, a, t);
|
|
406
407
|
break;
|
|
407
408
|
case "line":
|
|
408
|
-
|
|
409
|
+
ft(e, a, t);
|
|
409
410
|
break;
|
|
410
411
|
case "arrow":
|
|
411
|
-
|
|
412
|
+
gt(e, a, t);
|
|
412
413
|
break;
|
|
413
414
|
case "rect":
|
|
414
|
-
|
|
415
|
+
yt(e, a, t);
|
|
415
416
|
break;
|
|
416
417
|
case "polygon":
|
|
417
|
-
|
|
418
|
+
ot(e, a, t);
|
|
418
419
|
break;
|
|
419
420
|
case "text":
|
|
420
|
-
|
|
421
|
+
mt(e, a, t);
|
|
421
422
|
break;
|
|
422
423
|
case "image":
|
|
423
|
-
|
|
424
|
+
Et(e, a, t);
|
|
424
425
|
break;
|
|
425
426
|
case "axes":
|
|
426
|
-
|
|
427
|
+
bt(e, a, t);
|
|
427
428
|
break;
|
|
428
429
|
case "functionPlot":
|
|
429
|
-
|
|
430
|
+
xt(e, a, t);
|
|
430
431
|
break;
|
|
431
432
|
case "vector":
|
|
432
|
-
|
|
433
|
+
vt(e, a, t);
|
|
433
434
|
break;
|
|
434
435
|
case "vectorField":
|
|
435
|
-
|
|
436
|
+
dt(e, a, t);
|
|
436
437
|
break;
|
|
437
438
|
case "matrix":
|
|
438
|
-
|
|
439
|
+
wt(e, a, t);
|
|
439
440
|
break;
|
|
440
441
|
case "graph":
|
|
441
|
-
|
|
442
|
+
kt(e, a, t);
|
|
442
443
|
break;
|
|
443
444
|
case "latex":
|
|
444
|
-
|
|
445
|
+
It(e, a, t);
|
|
445
446
|
break;
|
|
446
447
|
case "barChart":
|
|
447
|
-
|
|
448
|
+
Pt(e, a, t);
|
|
448
449
|
break;
|
|
449
450
|
case "sequence":
|
|
450
|
-
|
|
451
|
+
St(e, a, t);
|
|
451
452
|
break;
|
|
452
453
|
case "group":
|
|
453
|
-
|
|
454
|
+
Ft(e, a, t);
|
|
454
455
|
break;
|
|
455
456
|
case "parallel":
|
|
456
|
-
|
|
457
|
+
$(e, a, t);
|
|
457
458
|
break;
|
|
458
459
|
case "fadeIn":
|
|
459
460
|
case "fadeOut":
|
|
460
461
|
case "draw":
|
|
461
462
|
case "write":
|
|
462
|
-
|
|
463
|
+
$t(e, a, t);
|
|
463
464
|
break;
|
|
464
465
|
case "transform":
|
|
465
|
-
|
|
466
|
+
Ot(e, a, t);
|
|
466
467
|
break;
|
|
467
468
|
case "morph":
|
|
468
|
-
|
|
469
|
+
At(e, a, t);
|
|
469
470
|
break;
|
|
470
471
|
case "stagger":
|
|
471
|
-
|
|
472
|
+
Ct(e, a, t);
|
|
472
473
|
break;
|
|
473
474
|
case "scene":
|
|
474
475
|
case "player":
|
|
475
|
-
|
|
476
|
+
J(e, a, i, t);
|
|
476
477
|
break;
|
|
477
478
|
}
|
|
478
479
|
}
|
|
479
|
-
function
|
|
480
|
-
|
|
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);
|
|
481
482
|
}
|
|
482
|
-
function
|
|
483
|
-
|
|
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);
|
|
484
485
|
}
|
|
485
|
-
function
|
|
486
|
-
|
|
486
|
+
function ft(e, a, t) {
|
|
487
|
+
l(e, "x1", a, t), l(e, "y1", a, t), l(e, "x2", a, t), l(e, "y2", a, t), x(e, a, t);
|
|
487
488
|
}
|
|
488
|
-
function
|
|
489
|
-
|
|
489
|
+
function gt(e, a, t) {
|
|
490
|
+
l(e, "x1", a, t), l(e, "y1", a, t), l(e, "x2", a, t), l(e, "y2", a, t), x(e, a, t);
|
|
490
491
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
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);
|
|
493
494
|
}
|
|
494
|
-
function
|
|
495
|
+
function ot(e, a, t) {
|
|
495
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((i, r) => {
|
|
496
497
|
(!Array.isArray(i) || i.length !== 2 || typeof i[0] != "number" || typeof i[1] != "number") && t.push({ path: `${a}.points[${r}]`, message: "Each point must be [number, number]", severity: "error" });
|
|
497
|
-
}) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }),
|
|
498
|
+
}) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }), x(e, a, t);
|
|
498
499
|
}
|
|
499
|
-
function
|
|
500
|
-
|
|
500
|
+
function mt(e, a, t) {
|
|
501
|
+
l(e, "x", a, t), l(e, "y", a, t), typeof e.content != "string" && t.push({ path: `${a}.content`, message: 'Text requires a "content" string', severity: "error" }), x(e, a, t);
|
|
501
502
|
}
|
|
502
|
-
function
|
|
503
|
-
|
|
503
|
+
function bt(e, a, t) {
|
|
504
|
+
d(e, "domain", a, t), d(e, "range", a, t), d(e, "origin", a, t), M(e, a, t);
|
|
504
505
|
}
|
|
505
|
-
function
|
|
506
|
+
function xt(e, a, t) {
|
|
506
507
|
if (typeof e.fn != "string")
|
|
507
508
|
t.push({ path: `${a}.fn`, message: 'FunctionPlot requires a "fn" expression string', severity: "error" });
|
|
508
509
|
else {
|
|
509
|
-
const i =
|
|
510
|
+
const i = K(e.fn);
|
|
510
511
|
i && t.push({ path: `${a}.fn`, message: `Invalid expression: ${i}`, severity: "error" });
|
|
511
512
|
}
|
|
512
|
-
|
|
513
|
+
d(e, "domain", a, t), M(e, a, t);
|
|
513
514
|
}
|
|
514
|
-
function
|
|
515
|
-
(!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 vt(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" }), d(e, "from", a, t), M(e, a, t);
|
|
516
517
|
}
|
|
517
|
-
function
|
|
518
|
+
function dt(e, a, t) {
|
|
518
519
|
if (typeof e.fn != "string")
|
|
519
520
|
t.push({ path: `${a}.fn`, message: 'VectorField requires a "fn" expression string', severity: "error" });
|
|
520
521
|
else {
|
|
521
|
-
const i =
|
|
522
|
+
const i = K(e.fn);
|
|
522
523
|
i && t.push({ path: `${a}.fn`, message: `Invalid vector expression: ${i}`, severity: "error" });
|
|
523
524
|
}
|
|
524
|
-
|
|
525
|
+
d(e, "domain", a, t), d(e, "range", a, t), M(e, a, t);
|
|
525
526
|
}
|
|
526
|
-
function
|
|
527
|
+
function wt(e, a, t) {
|
|
527
528
|
Array.isArray(e.values) ? e.values.forEach((i, r) => {
|
|
528
529
|
Array.isArray(i) || t.push({ path: `${a}.values[${r}]`, message: "Each matrix row must be an array", severity: "error" });
|
|
529
|
-
}) : t.push({ path: `${a}.values`, message: 'Matrix requires a "values" 2D array', severity: "error" }),
|
|
530
|
+
}) : t.push({ path: `${a}.values`, message: 'Matrix requires a "values" 2D array', severity: "error" }), x(e, a, t);
|
|
530
531
|
}
|
|
531
|
-
function
|
|
532
|
+
function kt(e, a, t) {
|
|
532
533
|
if (!Array.isArray(e.nodes))
|
|
533
534
|
t.push({ path: `${a}.nodes`, message: 'Graph requires a "nodes" array', severity: "error" });
|
|
534
535
|
else {
|
|
535
536
|
const i = /* @__PURE__ */ new Set();
|
|
536
537
|
e.nodes.forEach((r, n) => {
|
|
537
|
-
typeof r.id != "string" ? t.push({ path: `${a}.nodes[${n}].id`, message: 'Graph node requires a string "id"', severity: "error" }) : (i.has(r.id) && t.push({ path: `${a}.nodes[${n}].id`, message: `Duplicate node id "${r.id}"`, severity: "error" }), i.add(r.id)),
|
|
538
|
+
typeof r.id != "string" ? t.push({ path: `${a}.nodes[${n}].id`, message: 'Graph node requires a string "id"', severity: "error" }) : (i.has(r.id) && t.push({ path: `${a}.nodes[${n}].id`, message: `Duplicate node id "${r.id}"`, severity: "error" }), i.add(r.id)), l(r, "x", `${a}.nodes[${n}]`, t), l(r, "y", `${a}.nodes[${n}]`, t);
|
|
538
539
|
}), Array.isArray(e.edges) && e.edges.forEach((r, n) => {
|
|
539
540
|
(typeof r.from != "string" || !i.has(r.from)) && t.push({ path: `${a}.edges[${n}].from`, message: `Edge "from" references unknown node "${r.from}"`, severity: "error" }), (typeof r.to != "string" || !i.has(r.to)) && t.push({ path: `${a}.edges[${n}].to`, message: `Edge "to" references unknown node "${r.to}"`, severity: "error" });
|
|
540
541
|
});
|
|
541
542
|
}
|
|
542
|
-
|
|
543
|
+
x(e, a, t);
|
|
543
544
|
}
|
|
544
|
-
function
|
|
545
|
-
typeof e.expression != "string" && t.push({ path: `${a}.expression`, message: 'LaTeX requires an "expression" string', severity: "error" }),
|
|
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);
|
|
546
547
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
548
|
+
function St(e, a, t) {
|
|
549
|
+
l(e, "from", a, t), Tt(e, "durationInFrames", a, t), $(e, a, t);
|
|
549
550
|
}
|
|
550
|
-
function
|
|
551
|
-
|
|
551
|
+
function $t(e, a, t) {
|
|
552
|
+
y(e, "duration", a, t), P(e, a, t), $(e, a, t);
|
|
552
553
|
}
|
|
553
|
-
function
|
|
554
|
-
if (
|
|
554
|
+
function Ot(e, a, t) {
|
|
555
|
+
if (y(e, "duration", a, t), P(e, a, t), e.translate !== void 0) {
|
|
555
556
|
const i = e.translate;
|
|
556
557
|
(!i || typeof i != "object") && t.push({ path: `${a}.translate`, message: "translate must be { from: [x,y], to: [x,y] }", severity: "error" });
|
|
557
558
|
}
|
|
@@ -567,51 +568,51 @@ function vt(e, a, t) {
|
|
|
567
568
|
const i = e.opacity;
|
|
568
569
|
(!i || typeof i != "object" || typeof i.from != "number" || typeof i.to != "number") && t.push({ path: `${a}.opacity`, message: "opacity must be { from: number, to: number }", severity: "error" });
|
|
569
570
|
}
|
|
570
|
-
|
|
571
|
+
$(e, a, t);
|
|
571
572
|
}
|
|
572
|
-
function
|
|
573
|
-
|
|
573
|
+
function At(e, a, t) {
|
|
574
|
+
y(e, "duration", a, t), P(e, a, t), S(e, "fromColor", a, t), S(e, "toColor", a, t), $(e, a, t);
|
|
574
575
|
}
|
|
575
|
-
function
|
|
576
|
-
|
|
576
|
+
function Ct(e, a, t) {
|
|
577
|
+
y(e, "staggerDelay", a, t), P(e, a, t), $(e, a, t);
|
|
577
578
|
}
|
|
578
|
-
function
|
|
579
|
-
|
|
579
|
+
function x(e, a, t) {
|
|
580
|
+
y(e, "fadeIn", a, t), y(e, "fadeOut", a, t), y(e, "draw", a, t), P(e, a, t), zt(e, a, t);
|
|
580
581
|
}
|
|
581
|
-
function
|
|
582
|
-
|
|
582
|
+
function M(e, a, t) {
|
|
583
|
+
y(e, "fadeIn", a, t), y(e, "fadeOut", a, t), y(e, "draw", a, t), P(e, a, t), pt(e, a, t);
|
|
583
584
|
}
|
|
584
|
-
const
|
|
585
|
-
function
|
|
586
|
-
if (
|
|
585
|
+
const Q = ["none", "circle", "ellipse"];
|
|
586
|
+
function zt(e, a, t) {
|
|
587
|
+
if (F(e, "rotation", a, t), d(e, "rotationOrigin", a, t), d(e, "translate", a, t), F(e, "zIndex", a, t), e.scale !== void 0) {
|
|
587
588
|
const i = e.scale;
|
|
588
589
|
typeof i == "number" || Array.isArray(i) && i.length === 2 && typeof i[0] == "number" && typeof i[1] == "number" || t.push({ path: `${a}.scale`, message: '"scale" must be a number or [number, number]', severity: "error" });
|
|
589
590
|
}
|
|
590
591
|
}
|
|
591
|
-
function
|
|
592
|
-
|
|
592
|
+
function pt(e, a, t) {
|
|
593
|
+
F(e, "rotation", a, t), d(e, "rotationOrigin", a, t), d(e, "translate", a, t), F(e, "zIndex", a, t);
|
|
593
594
|
}
|
|
594
|
-
function
|
|
595
|
-
typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }),
|
|
595
|
+
function Et(e, a, t) {
|
|
596
|
+
typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }), l(e, "x", a, t), l(e, "y", a, t), z(e, "width", a, t), z(e, "height", a, t), S(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 && (Q.includes(e.clipShape) || t.push({
|
|
596
597
|
path: `${a}.clipShape`,
|
|
597
|
-
message: `Invalid clipShape "${e.clipShape}". Must be one of: ${
|
|
598
|
+
message: `Invalid clipShape "${e.clipShape}". Must be one of: ${Q.join(", ")}`,
|
|
598
599
|
severity: "error"
|
|
599
|
-
})),
|
|
600
|
+
})), x(e, a, t);
|
|
600
601
|
}
|
|
601
|
-
function
|
|
602
|
-
|
|
602
|
+
function Ft(e, a, t) {
|
|
603
|
+
$(e, a, t), x(e, a, t);
|
|
603
604
|
}
|
|
604
|
-
function
|
|
605
|
-
|
|
605
|
+
function Pt(e, a, t) {
|
|
606
|
+
l(e, "x", a, t), l(e, "y", a, t), z(e, "width", a, t), z(e, "height", a, t), Array.isArray(e.bars) || t.push({ path: `${a}.bars`, message: 'BarChart requires a "bars" array', severity: "error" }), x(e, a, t);
|
|
606
607
|
}
|
|
607
|
-
function
|
|
608
|
+
function P(e, a, t) {
|
|
608
609
|
if (e.easing !== void 0) {
|
|
609
610
|
if (typeof e.easing == "string") {
|
|
610
|
-
if (!
|
|
611
|
-
const i =
|
|
611
|
+
if (!W.includes(e.easing)) {
|
|
612
|
+
const i = Z(e.easing, W);
|
|
612
613
|
t.push({
|
|
613
614
|
path: `${a}.easing`,
|
|
614
|
-
message: `Unknown easing "${e.easing}".${i} Available: ${
|
|
615
|
+
message: `Unknown easing "${e.easing}".${i} Available: ${W.join(", ")}`,
|
|
615
616
|
severity: "error"
|
|
616
617
|
});
|
|
617
618
|
}
|
|
@@ -631,142 +632,152 @@ function S(e, a, t) {
|
|
|
631
632
|
t.push({ path: `${a}.easing`, message: 'Easing must be a string name or { type: "spring"|"cubicBezier", ... }', severity: "error" });
|
|
632
633
|
}
|
|
633
634
|
}
|
|
634
|
-
function
|
|
635
|
+
function l(e, a, t, i) {
|
|
635
636
|
typeof e[a] != "number" && i.push({ path: `${t}.${a}`, message: `Required numeric field "${a}" is missing or not a number`, severity: "error" });
|
|
636
637
|
}
|
|
637
|
-
function
|
|
638
|
+
function z(e, a, t, i) {
|
|
638
639
|
(typeof e[a] != "number" || e[a] <= 0) && i.push({ path: `${t}.${a}`, message: `"${a}" must be a positive number`, severity: "error" });
|
|
639
640
|
}
|
|
640
|
-
function
|
|
641
|
+
function Rt(e, a, t, i) {
|
|
641
642
|
const r = e[a];
|
|
642
643
|
(typeof r != "number" || r <= 0 || !Number.isInteger(r)) && i.push({ path: `${t}.${a}`, message: `"${a}" must be a positive integer`, severity: "error" });
|
|
643
644
|
}
|
|
644
|
-
function
|
|
645
|
+
function y(e, a, t, i) {
|
|
645
646
|
e[a] !== void 0 && (typeof e[a] != "number" || e[a] <= 0) && i.push({ path: `${t}.${a}`, message: `"${a}" must be a positive number`, severity: "error" });
|
|
646
647
|
}
|
|
647
|
-
function
|
|
648
|
+
function Tt(e, a, t, i) {
|
|
648
649
|
const r = e[a];
|
|
649
650
|
r !== void 0 && (typeof r != "number" || r <= 0 || !Number.isInteger(r)) && i.push({ path: `${t}.${a}`, message: `"${a}" must be a positive integer`, severity: "error" });
|
|
650
651
|
}
|
|
651
|
-
function
|
|
652
|
+
function S(e, a, t, i) {
|
|
652
653
|
e[a] !== void 0 && typeof e[a] != "string" && i.push({ path: `${t}.${a}`, message: `"${a}" must be a string`, severity: "error" });
|
|
653
654
|
}
|
|
654
|
-
function
|
|
655
|
+
function F(e, a, t, i) {
|
|
655
656
|
e[a] !== void 0 && typeof e[a] != "number" && i.push({ path: `${t}.${a}`, message: `"${a}" must be a number`, severity: "error" });
|
|
656
657
|
}
|
|
657
|
-
function
|
|
658
|
+
function R(e, a, t, i) {
|
|
658
659
|
e[a] !== void 0 && typeof e[a] != "boolean" && i.push({ path: `${t}.${a}`, message: `"${a}" must be a boolean`, severity: "error" });
|
|
659
660
|
}
|
|
660
|
-
function
|
|
661
|
+
function d(e, a, t, i) {
|
|
661
662
|
const r = e[a];
|
|
662
663
|
r !== void 0 && (!Array.isArray(r) || r.length !== 2 || typeof r[0] != "number" || typeof r[1] != "number") && i.push({ path: `${t}.${a}`, message: `"${a}" must be [number, number]`, severity: "error" });
|
|
663
664
|
}
|
|
664
|
-
function
|
|
665
|
+
function Z(e, a) {
|
|
665
666
|
const t = e.toLowerCase(), i = a.find((n) => n.toLowerCase() === t);
|
|
666
667
|
if (i) return ` Did you mean '${i}'?`;
|
|
667
668
|
const r = a.find((n) => n.toLowerCase().startsWith(t.slice(0, 4)));
|
|
668
669
|
return r ? ` Did you mean '${r}'?` : "";
|
|
669
670
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
/* @__PURE__ */ s("strong", { children: "Elucim DSL Validation Errors:" }),
|
|
680
|
-
/* @__PURE__ */ s("ul", { children: i.errors.filter((r) => r.severity === "error").map((r, n) => /* @__PURE__ */ L("li", { children: [
|
|
681
|
-
r.path,
|
|
682
|
-
": ",
|
|
683
|
-
r.message
|
|
684
|
-
] }, n)) })
|
|
685
|
-
]
|
|
686
|
-
}
|
|
687
|
-
);
|
|
671
|
+
const Mt = {
|
|
672
|
+
card: [640, 360],
|
|
673
|
+
slide: [1280, 720],
|
|
674
|
+
square: [600, 600]
|
|
675
|
+
};
|
|
676
|
+
function N(e, a, t) {
|
|
677
|
+
if (!e) return { width: a, height: t };
|
|
678
|
+
const [i, r] = Mt[e];
|
|
679
|
+
return { width: a ?? i, height: t ?? r };
|
|
688
680
|
}
|
|
689
|
-
function
|
|
681
|
+
function ee(e, a) {
|
|
690
682
|
switch (e.type) {
|
|
691
683
|
case "scene":
|
|
692
|
-
return
|
|
684
|
+
return j(e, a);
|
|
693
685
|
case "player":
|
|
694
|
-
|
|
686
|
+
if ((a == null ? void 0 : a.frame) !== void 0) {
|
|
687
|
+
const { width: t, height: i } = N(e.preset, e.width, e.height);
|
|
688
|
+
return j(
|
|
689
|
+
{
|
|
690
|
+
width: t,
|
|
691
|
+
height: i,
|
|
692
|
+
fps: e.fps,
|
|
693
|
+
durationInFrames: e.durationInFrames,
|
|
694
|
+
background: e.background,
|
|
695
|
+
children: e.children
|
|
696
|
+
},
|
|
697
|
+
a
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
return te(e, a);
|
|
695
701
|
case "presentation":
|
|
696
|
-
return
|
|
702
|
+
return Nt(e);
|
|
697
703
|
}
|
|
698
704
|
}
|
|
699
|
-
function
|
|
705
|
+
function j(e, a) {
|
|
706
|
+
const t = (a == null ? void 0 : a.frame) !== void 0, { width: i, height: r } = N(e.preset, e.width, e.height);
|
|
700
707
|
return /* @__PURE__ */ s(
|
|
701
|
-
|
|
708
|
+
Oe,
|
|
702
709
|
{
|
|
703
|
-
width:
|
|
704
|
-
height:
|
|
710
|
+
width: i,
|
|
711
|
+
height: r,
|
|
705
712
|
fps: e.fps,
|
|
706
713
|
durationInFrames: e.durationInFrames,
|
|
707
714
|
background: e.background,
|
|
708
|
-
|
|
715
|
+
...t ? { frame: a.frame, autoPlay: !1 } : {},
|
|
716
|
+
children: e.children.map((n, u) => b(n, u))
|
|
709
717
|
}
|
|
710
718
|
);
|
|
711
719
|
}
|
|
712
|
-
function
|
|
720
|
+
function te(e, a) {
|
|
721
|
+
const { width: t, height: i } = N(e.preset, e.width, e.height);
|
|
713
722
|
return /* @__PURE__ */ s(
|
|
714
|
-
|
|
723
|
+
Ae,
|
|
715
724
|
{
|
|
716
|
-
|
|
717
|
-
|
|
725
|
+
ref: a == null ? void 0 : a.playerRef,
|
|
726
|
+
width: t,
|
|
727
|
+
height: i,
|
|
718
728
|
fps: e.fps,
|
|
719
729
|
durationInFrames: e.durationInFrames,
|
|
720
730
|
background: e.background,
|
|
721
731
|
controls: e.controls,
|
|
722
732
|
loop: e.loop,
|
|
723
733
|
autoPlay: e.autoPlay,
|
|
724
|
-
children: e.children.map((
|
|
734
|
+
children: e.children.map((r, n) => b(r, n))
|
|
725
735
|
}
|
|
726
736
|
);
|
|
727
737
|
}
|
|
728
|
-
function
|
|
738
|
+
function Nt(e) {
|
|
739
|
+
const { width: a, height: t } = N(e.preset, e.width, e.height);
|
|
729
740
|
return /* @__PURE__ */ s(
|
|
730
|
-
|
|
741
|
+
$e,
|
|
731
742
|
{
|
|
732
|
-
width:
|
|
733
|
-
height:
|
|
743
|
+
width: a,
|
|
744
|
+
height: t,
|
|
734
745
|
background: e.background,
|
|
735
746
|
transition: e.transition,
|
|
736
747
|
transitionDuration: e.transitionDuration,
|
|
737
748
|
showHUD: e.showHud,
|
|
738
749
|
showNotes: e.showNotes,
|
|
739
|
-
children: e.slides.map((
|
|
750
|
+
children: e.slides.map((i, r) => Wt(i, r))
|
|
740
751
|
}
|
|
741
752
|
);
|
|
742
753
|
}
|
|
743
|
-
function
|
|
754
|
+
function Wt(e, a) {
|
|
744
755
|
var t;
|
|
745
|
-
return /* @__PURE__ */ s(
|
|
756
|
+
return /* @__PURE__ */ s(Ce, { title: e.title, notes: e.notes, background: e.background, children: (t = e.children) == null ? void 0 : t.map((i, r) => b(i, r)) }, a);
|
|
746
757
|
}
|
|
747
|
-
function
|
|
758
|
+
function b(e, a) {
|
|
748
759
|
switch (e.type) {
|
|
749
760
|
case "sequence":
|
|
750
|
-
return /* @__PURE__ */ s(
|
|
761
|
+
return /* @__PURE__ */ s(Ze, { from: e.from, durationInFrames: e.durationInFrames, name: e.name, children: e.children.map((t, i) => b(t, i)) }, a);
|
|
751
762
|
case "group":
|
|
752
763
|
return /* @__PURE__ */ s(
|
|
753
|
-
|
|
764
|
+
Ye,
|
|
754
765
|
{
|
|
755
766
|
fadeIn: e.fadeIn,
|
|
756
767
|
fadeOut: e.fadeOut,
|
|
757
|
-
easing:
|
|
768
|
+
easing: h(e.easing),
|
|
758
769
|
rotation: e.rotation,
|
|
759
770
|
rotationOrigin: e.rotationOrigin,
|
|
760
771
|
scale: e.scale,
|
|
761
772
|
translate: e.translate,
|
|
762
773
|
zIndex: e.zIndex,
|
|
763
|
-
children: e.children.map((t, i) =>
|
|
774
|
+
children: e.children.map((t, i) => b(t, i))
|
|
764
775
|
},
|
|
765
776
|
a
|
|
766
777
|
);
|
|
767
778
|
case "bezierCurve":
|
|
768
779
|
return /* @__PURE__ */ s(
|
|
769
|
-
|
|
780
|
+
Je,
|
|
770
781
|
{
|
|
771
782
|
x1: e.x1,
|
|
772
783
|
y1: e.y1,
|
|
@@ -784,7 +795,7 @@ function g(e, a) {
|
|
|
784
795
|
fadeIn: e.fadeIn,
|
|
785
796
|
fadeOut: e.fadeOut,
|
|
786
797
|
draw: e.draw,
|
|
787
|
-
easing:
|
|
798
|
+
easing: h(e.easing),
|
|
788
799
|
rotation: e.rotation,
|
|
789
800
|
rotationOrigin: e.rotationOrigin,
|
|
790
801
|
scale: e.scale,
|
|
@@ -795,7 +806,7 @@ function g(e, a) {
|
|
|
795
806
|
);
|
|
796
807
|
case "circle":
|
|
797
808
|
return /* @__PURE__ */ s(
|
|
798
|
-
|
|
809
|
+
Xe,
|
|
799
810
|
{
|
|
800
811
|
cx: e.cx,
|
|
801
812
|
cy: e.cy,
|
|
@@ -807,7 +818,7 @@ function g(e, a) {
|
|
|
807
818
|
fadeIn: e.fadeIn,
|
|
808
819
|
fadeOut: e.fadeOut,
|
|
809
820
|
draw: e.draw,
|
|
810
|
-
easing:
|
|
821
|
+
easing: h(e.easing),
|
|
811
822
|
rotation: e.rotation,
|
|
812
823
|
rotationOrigin: e.rotationOrigin,
|
|
813
824
|
scale: e.scale,
|
|
@@ -818,7 +829,7 @@ function g(e, a) {
|
|
|
818
829
|
);
|
|
819
830
|
case "line":
|
|
820
831
|
return /* @__PURE__ */ s(
|
|
821
|
-
|
|
832
|
+
Ke,
|
|
822
833
|
{
|
|
823
834
|
x1: e.x1,
|
|
824
835
|
y1: e.y1,
|
|
@@ -831,7 +842,7 @@ function g(e, a) {
|
|
|
831
842
|
fadeIn: e.fadeIn,
|
|
832
843
|
fadeOut: e.fadeOut,
|
|
833
844
|
draw: e.draw,
|
|
834
|
-
easing:
|
|
845
|
+
easing: h(e.easing),
|
|
835
846
|
rotation: e.rotation,
|
|
836
847
|
rotationOrigin: e.rotationOrigin,
|
|
837
848
|
scale: e.scale,
|
|
@@ -842,7 +853,7 @@ function g(e, a) {
|
|
|
842
853
|
);
|
|
843
854
|
case "arrow":
|
|
844
855
|
return /* @__PURE__ */ s(
|
|
845
|
-
|
|
856
|
+
Qe,
|
|
846
857
|
{
|
|
847
858
|
x1: e.x1,
|
|
848
859
|
y1: e.y1,
|
|
@@ -856,7 +867,7 @@ function g(e, a) {
|
|
|
856
867
|
fadeIn: e.fadeIn,
|
|
857
868
|
fadeOut: e.fadeOut,
|
|
858
869
|
draw: e.draw,
|
|
859
|
-
easing:
|
|
870
|
+
easing: h(e.easing),
|
|
860
871
|
rotation: e.rotation,
|
|
861
872
|
rotationOrigin: e.rotationOrigin,
|
|
862
873
|
scale: e.scale,
|
|
@@ -867,7 +878,7 @@ function g(e, a) {
|
|
|
867
878
|
);
|
|
868
879
|
case "rect":
|
|
869
880
|
return /* @__PURE__ */ s(
|
|
870
|
-
|
|
881
|
+
Ge,
|
|
871
882
|
{
|
|
872
883
|
x: e.x,
|
|
873
884
|
y: e.y,
|
|
@@ -883,7 +894,7 @@ function g(e, a) {
|
|
|
883
894
|
fadeIn: e.fadeIn,
|
|
884
895
|
fadeOut: e.fadeOut,
|
|
885
896
|
draw: e.draw,
|
|
886
|
-
easing:
|
|
897
|
+
easing: h(e.easing),
|
|
887
898
|
rotation: e.rotation,
|
|
888
899
|
rotationOrigin: e.rotationOrigin,
|
|
889
900
|
scale: e.scale,
|
|
@@ -894,7 +905,7 @@ function g(e, a) {
|
|
|
894
905
|
);
|
|
895
906
|
case "polygon":
|
|
896
907
|
return /* @__PURE__ */ s(
|
|
897
|
-
|
|
908
|
+
He,
|
|
898
909
|
{
|
|
899
910
|
points: e.points,
|
|
900
911
|
fill: e.fill,
|
|
@@ -905,7 +916,7 @@ function g(e, a) {
|
|
|
905
916
|
fadeIn: e.fadeIn,
|
|
906
917
|
fadeOut: e.fadeOut,
|
|
907
918
|
draw: e.draw,
|
|
908
|
-
easing:
|
|
919
|
+
easing: h(e.easing),
|
|
909
920
|
rotation: e.rotation,
|
|
910
921
|
rotationOrigin: e.rotationOrigin,
|
|
911
922
|
scale: e.scale,
|
|
@@ -916,7 +927,7 @@ function g(e, a) {
|
|
|
916
927
|
);
|
|
917
928
|
case "text":
|
|
918
929
|
return /* @__PURE__ */ s(
|
|
919
|
-
|
|
930
|
+
Ue,
|
|
920
931
|
{
|
|
921
932
|
x: e.x,
|
|
922
933
|
y: e.y,
|
|
@@ -929,7 +940,7 @@ function g(e, a) {
|
|
|
929
940
|
opacity: e.opacity,
|
|
930
941
|
fadeIn: e.fadeIn,
|
|
931
942
|
fadeOut: e.fadeOut,
|
|
932
|
-
easing:
|
|
943
|
+
easing: h(e.easing),
|
|
933
944
|
rotation: e.rotation,
|
|
934
945
|
rotationOrigin: e.rotationOrigin,
|
|
935
946
|
scale: e.scale,
|
|
@@ -941,7 +952,7 @@ function g(e, a) {
|
|
|
941
952
|
);
|
|
942
953
|
case "image":
|
|
943
954
|
return /* @__PURE__ */ s(
|
|
944
|
-
|
|
955
|
+
Ve,
|
|
945
956
|
{
|
|
946
957
|
src: e.src,
|
|
947
958
|
x: e.x,
|
|
@@ -954,7 +965,7 @@ function g(e, a) {
|
|
|
954
965
|
opacity: e.opacity,
|
|
955
966
|
fadeIn: e.fadeIn,
|
|
956
967
|
fadeOut: e.fadeOut,
|
|
957
|
-
easing:
|
|
968
|
+
easing: h(e.easing),
|
|
958
969
|
rotation: e.rotation,
|
|
959
970
|
rotationOrigin: e.rotationOrigin,
|
|
960
971
|
scale: e.scale,
|
|
@@ -965,7 +976,7 @@ function g(e, a) {
|
|
|
965
976
|
);
|
|
966
977
|
case "axes":
|
|
967
978
|
return /* @__PURE__ */ s(
|
|
968
|
-
|
|
979
|
+
Be,
|
|
969
980
|
{
|
|
970
981
|
domain: e.domain,
|
|
971
982
|
range: e.range,
|
|
@@ -982,7 +993,7 @@ function g(e, a) {
|
|
|
982
993
|
fadeIn: e.fadeIn,
|
|
983
994
|
fadeOut: e.fadeOut,
|
|
984
995
|
draw: e.draw,
|
|
985
|
-
easing:
|
|
996
|
+
easing: h(e.easing),
|
|
986
997
|
rotation: e.rotation,
|
|
987
998
|
rotationOrigin: e.rotationOrigin,
|
|
988
999
|
translate: e.translate,
|
|
@@ -991,9 +1002,9 @@ function g(e, a) {
|
|
|
991
1002
|
a
|
|
992
1003
|
);
|
|
993
1004
|
case "functionPlot": {
|
|
994
|
-
const t =
|
|
1005
|
+
const t = rt(e.fn);
|
|
995
1006
|
return /* @__PURE__ */ s(
|
|
996
|
-
|
|
1007
|
+
qe,
|
|
997
1008
|
{
|
|
998
1009
|
fn: (i) => t({ x: i }),
|
|
999
1010
|
domain: e.domain,
|
|
@@ -1004,7 +1015,7 @@ function g(e, a) {
|
|
|
1004
1015
|
strokeWidth: e.strokeWidth,
|
|
1005
1016
|
samples: e.samples,
|
|
1006
1017
|
draw: e.draw,
|
|
1007
|
-
easing:
|
|
1018
|
+
easing: h(e.easing),
|
|
1008
1019
|
opacity: e.opacity,
|
|
1009
1020
|
rotation: e.rotation,
|
|
1010
1021
|
rotationOrigin: e.rotationOrigin,
|
|
@@ -1016,7 +1027,7 @@ function g(e, a) {
|
|
|
1016
1027
|
}
|
|
1017
1028
|
case "vector":
|
|
1018
1029
|
return /* @__PURE__ */ s(
|
|
1019
|
-
|
|
1030
|
+
je,
|
|
1020
1031
|
{
|
|
1021
1032
|
from: e.from,
|
|
1022
1033
|
to: e.to,
|
|
@@ -1032,7 +1043,7 @@ function g(e, a) {
|
|
|
1032
1043
|
fadeIn: e.fadeIn,
|
|
1033
1044
|
fadeOut: e.fadeOut,
|
|
1034
1045
|
draw: e.draw,
|
|
1035
|
-
easing:
|
|
1046
|
+
easing: h(e.easing),
|
|
1036
1047
|
rotation: e.rotation,
|
|
1037
1048
|
rotationOrigin: e.rotationOrigin,
|
|
1038
1049
|
translate: e.translate,
|
|
@@ -1041,9 +1052,9 @@ function g(e, a) {
|
|
|
1041
1052
|
a
|
|
1042
1053
|
);
|
|
1043
1054
|
case "vectorField": {
|
|
1044
|
-
const t =
|
|
1055
|
+
const t = nt(e.fn);
|
|
1045
1056
|
return /* @__PURE__ */ s(
|
|
1046
|
-
|
|
1057
|
+
Le,
|
|
1047
1058
|
{
|
|
1048
1059
|
fn: (i, r) => t({ x: i, y: r }),
|
|
1049
1060
|
domain: e.domain,
|
|
@@ -1059,7 +1070,7 @@ function g(e, a) {
|
|
|
1059
1070
|
maxLength: e.maxLength,
|
|
1060
1071
|
fadeIn: e.fadeIn,
|
|
1061
1072
|
fadeOut: e.fadeOut,
|
|
1062
|
-
easing:
|
|
1073
|
+
easing: h(e.easing),
|
|
1063
1074
|
rotation: e.rotation,
|
|
1064
1075
|
rotationOrigin: e.rotationOrigin,
|
|
1065
1076
|
translate: e.translate,
|
|
@@ -1070,7 +1081,7 @@ function g(e, a) {
|
|
|
1070
1081
|
}
|
|
1071
1082
|
case "matrix":
|
|
1072
1083
|
return /* @__PURE__ */ s(
|
|
1073
|
-
|
|
1084
|
+
De,
|
|
1074
1085
|
{
|
|
1075
1086
|
values: e.values,
|
|
1076
1087
|
x: e.x,
|
|
@@ -1081,7 +1092,7 @@ function g(e, a) {
|
|
|
1081
1092
|
fontSize: e.fontSize,
|
|
1082
1093
|
fadeIn: e.fadeIn,
|
|
1083
1094
|
fadeOut: e.fadeOut,
|
|
1084
|
-
easing:
|
|
1095
|
+
easing: h(e.easing),
|
|
1085
1096
|
rotation: e.rotation,
|
|
1086
1097
|
rotationOrigin: e.rotationOrigin,
|
|
1087
1098
|
scale: e.scale,
|
|
@@ -1092,7 +1103,7 @@ function g(e, a) {
|
|
|
1092
1103
|
);
|
|
1093
1104
|
case "graph":
|
|
1094
1105
|
return /* @__PURE__ */ s(
|
|
1095
|
-
|
|
1106
|
+
_e,
|
|
1096
1107
|
{
|
|
1097
1108
|
nodes: e.nodes,
|
|
1098
1109
|
edges: e.edges,
|
|
@@ -1104,7 +1115,7 @@ function g(e, a) {
|
|
|
1104
1115
|
labelFontSize: e.labelFontSize,
|
|
1105
1116
|
fadeIn: e.fadeIn,
|
|
1106
1117
|
fadeOut: e.fadeOut,
|
|
1107
|
-
easing:
|
|
1118
|
+
easing: h(e.easing),
|
|
1108
1119
|
rotation: e.rotation,
|
|
1109
1120
|
rotationOrigin: e.rotationOrigin,
|
|
1110
1121
|
scale: e.scale,
|
|
@@ -1115,7 +1126,7 @@ function g(e, a) {
|
|
|
1115
1126
|
);
|
|
1116
1127
|
case "latex":
|
|
1117
1128
|
return /* @__PURE__ */ s(
|
|
1118
|
-
|
|
1129
|
+
We,
|
|
1119
1130
|
{
|
|
1120
1131
|
expression: e.expression,
|
|
1121
1132
|
x: e.x,
|
|
@@ -1125,7 +1136,7 @@ function g(e, a) {
|
|
|
1125
1136
|
align: e.align,
|
|
1126
1137
|
fadeIn: e.fadeIn,
|
|
1127
1138
|
fadeOut: e.fadeOut,
|
|
1128
|
-
easing:
|
|
1139
|
+
easing: h(e.easing),
|
|
1129
1140
|
rotation: e.rotation,
|
|
1130
1141
|
rotationOrigin: e.rotationOrigin,
|
|
1131
1142
|
scale: e.scale,
|
|
@@ -1136,7 +1147,7 @@ function g(e, a) {
|
|
|
1136
1147
|
);
|
|
1137
1148
|
case "barChart":
|
|
1138
1149
|
return /* @__PURE__ */ s(
|
|
1139
|
-
|
|
1150
|
+
Ne,
|
|
1140
1151
|
{
|
|
1141
1152
|
bars: e.bars,
|
|
1142
1153
|
x: e.x,
|
|
@@ -1152,7 +1163,7 @@ function g(e, a) {
|
|
|
1152
1163
|
valueFormat: e.valueFormat,
|
|
1153
1164
|
fadeIn: e.fadeIn,
|
|
1154
1165
|
fadeOut: e.fadeOut,
|
|
1155
|
-
easing:
|
|
1166
|
+
easing: h(e.easing),
|
|
1156
1167
|
rotation: e.rotation,
|
|
1157
1168
|
rotationOrigin: e.rotationOrigin,
|
|
1158
1169
|
scale: e.scale,
|
|
@@ -1162,56 +1173,162 @@ function g(e, a) {
|
|
|
1162
1173
|
a
|
|
1163
1174
|
);
|
|
1164
1175
|
case "fadeIn":
|
|
1165
|
-
return /* @__PURE__ */ s(
|
|
1176
|
+
return /* @__PURE__ */ s(Me, { duration: e.duration, easing: h(e.easing), children: e.children.map((t, i) => b(t, i)) }, a);
|
|
1166
1177
|
case "fadeOut":
|
|
1167
|
-
return /* @__PURE__ */ s(
|
|
1178
|
+
return /* @__PURE__ */ s(Te, { duration: e.duration, totalFrames: e.totalFrames, easing: h(e.easing), children: e.children.map((t, i) => b(t, i)) }, a);
|
|
1168
1179
|
case "draw":
|
|
1169
|
-
return /* @__PURE__ */ s(
|
|
1180
|
+
return /* @__PURE__ */ s(Re, { duration: e.duration, pathLength: e.pathLength, easing: h(e.easing), children: b(e.children[0], 0) }, a);
|
|
1170
1181
|
case "write":
|
|
1171
|
-
return /* @__PURE__ */ s(
|
|
1182
|
+
return /* @__PURE__ */ s(Pe, { duration: e.duration, easing: h(e.easing), children: e.children.map((t, i) => b(t, i)) }, a);
|
|
1172
1183
|
case "transform":
|
|
1173
1184
|
return /* @__PURE__ */ s(
|
|
1174
|
-
|
|
1185
|
+
Fe,
|
|
1175
1186
|
{
|
|
1176
1187
|
duration: e.duration,
|
|
1177
|
-
easing:
|
|
1188
|
+
easing: h(e.easing),
|
|
1178
1189
|
translate: e.translate,
|
|
1179
1190
|
scale: e.scale,
|
|
1180
1191
|
rotate: e.rotate,
|
|
1181
1192
|
opacity: e.opacity,
|
|
1182
|
-
children: e.children.map((t, i) =>
|
|
1193
|
+
children: e.children.map((t, i) => b(t, i))
|
|
1183
1194
|
},
|
|
1184
1195
|
a
|
|
1185
1196
|
);
|
|
1186
1197
|
case "morph":
|
|
1187
1198
|
return /* @__PURE__ */ s(
|
|
1188
|
-
|
|
1199
|
+
Ee,
|
|
1189
1200
|
{
|
|
1190
1201
|
duration: e.duration,
|
|
1191
|
-
easing:
|
|
1202
|
+
easing: h(e.easing),
|
|
1192
1203
|
fromColor: e.fromColor,
|
|
1193
1204
|
toColor: e.toColor,
|
|
1194
1205
|
fromOpacity: e.fromOpacity,
|
|
1195
1206
|
toOpacity: e.toOpacity,
|
|
1196
1207
|
fromScale: e.fromScale,
|
|
1197
1208
|
toScale: e.toScale,
|
|
1198
|
-
children: e.children.map((t, i) =>
|
|
1209
|
+
children: e.children.map((t, i) => b(t, i))
|
|
1199
1210
|
},
|
|
1200
1211
|
a
|
|
1201
1212
|
);
|
|
1202
1213
|
case "stagger":
|
|
1203
|
-
return /* @__PURE__ */ s(
|
|
1214
|
+
return /* @__PURE__ */ s(pe, { staggerDelay: e.staggerDelay, easing: h(e.easing), children: e.children.map((t, i) => b(t, i)) }, a);
|
|
1204
1215
|
case "parallel":
|
|
1205
|
-
return /* @__PURE__ */ s(
|
|
1216
|
+
return /* @__PURE__ */ s(ze, { children: e.children.map((t, i) => b(t, i)) }, a);
|
|
1206
1217
|
case "scene":
|
|
1207
|
-
return /* @__PURE__ */ s(
|
|
1218
|
+
return /* @__PURE__ */ s(V.Fragment, { children: j(e) }, a);
|
|
1208
1219
|
case "player":
|
|
1209
|
-
return /* @__PURE__ */ s(
|
|
1220
|
+
return /* @__PURE__ */ s(V.Fragment, { children: te(e) }, a);
|
|
1210
1221
|
default:
|
|
1211
1222
|
return null;
|
|
1212
1223
|
}
|
|
1213
1224
|
}
|
|
1214
|
-
|
|
1225
|
+
function _t(e) {
|
|
1226
|
+
if (!e) return {};
|
|
1227
|
+
const a = {};
|
|
1228
|
+
for (const [t, i] of Object.entries(e))
|
|
1229
|
+
i !== void 0 && (a[`--elucim-${t}`] = i);
|
|
1230
|
+
return a;
|
|
1231
|
+
}
|
|
1232
|
+
const Gt = et(function({ dsl: a, className: t, style: i, theme: r, poster: n, onError: u }, o) {
|
|
1233
|
+
const v = tt(null);
|
|
1234
|
+
at(o, () => ({
|
|
1235
|
+
getSvgElement: () => {
|
|
1236
|
+
var c;
|
|
1237
|
+
return ((c = v.current) == null ? void 0 : c.getSvgElement()) ?? null;
|
|
1238
|
+
},
|
|
1239
|
+
seekToFrame: (c) => {
|
|
1240
|
+
var f;
|
|
1241
|
+
return (f = v.current) == null ? void 0 : f.seekToFrame(c);
|
|
1242
|
+
},
|
|
1243
|
+
getTotalFrames: () => {
|
|
1244
|
+
var c;
|
|
1245
|
+
return ((c = v.current) == null ? void 0 : c.getTotalFrames()) ?? 0;
|
|
1246
|
+
},
|
|
1247
|
+
play: () => {
|
|
1248
|
+
var c;
|
|
1249
|
+
return (c = v.current) == null ? void 0 : c.play();
|
|
1250
|
+
},
|
|
1251
|
+
pause: () => {
|
|
1252
|
+
var c;
|
|
1253
|
+
return (c = v.current) == null ? void 0 : c.pause();
|
|
1254
|
+
},
|
|
1255
|
+
isPlaying: () => {
|
|
1256
|
+
var c;
|
|
1257
|
+
return ((c = v.current) == null ? void 0 : c.isPlaying()) ?? !1;
|
|
1258
|
+
}
|
|
1259
|
+
}));
|
|
1260
|
+
const O = X(a);
|
|
1261
|
+
if (!O.valid) {
|
|
1262
|
+
const c = O.errors.filter((g) => g.severity === "error").map((g) => ({ path: g.path, message: g.message }));
|
|
1263
|
+
u == null || u(c);
|
|
1264
|
+
const f = /* @__PURE__ */ new Map();
|
|
1265
|
+
for (const g of c) {
|
|
1266
|
+
const w = g.path.split("."), I = w.length > 1 ? w.slice(0, -1).join(".") : g.path, A = f.get(I) ?? [];
|
|
1267
|
+
A.push(g), f.set(I, A);
|
|
1268
|
+
}
|
|
1269
|
+
return /* @__PURE__ */ E(
|
|
1270
|
+
"div",
|
|
1271
|
+
{
|
|
1272
|
+
className: t,
|
|
1273
|
+
style: { color: "#ff6b6b", fontFamily: "monospace", padding: 16, fontSize: 13, ...i },
|
|
1274
|
+
"data-testid": "dsl-error",
|
|
1275
|
+
children: [
|
|
1276
|
+
/* @__PURE__ */ E("strong", { children: [
|
|
1277
|
+
"Elucim DSL Validation Errors (",
|
|
1278
|
+
c.length,
|
|
1279
|
+
"):"
|
|
1280
|
+
] }),
|
|
1281
|
+
[...f.entries()].map(([g, w]) => /* @__PURE__ */ E("details", { open: !0, style: { marginTop: 8 }, children: [
|
|
1282
|
+
/* @__PURE__ */ E("summary", { style: { cursor: "pointer", fontWeight: "bold" }, children: [
|
|
1283
|
+
g,
|
|
1284
|
+
" (",
|
|
1285
|
+
w.length,
|
|
1286
|
+
")"
|
|
1287
|
+
] }),
|
|
1288
|
+
/* @__PURE__ */ s("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children: w.map((I, A) => /* @__PURE__ */ E("li", { children: [
|
|
1289
|
+
/* @__PURE__ */ s("code", { style: { color: "#ffa07a" }, children: I.path }),
|
|
1290
|
+
": ",
|
|
1291
|
+
I.message
|
|
1292
|
+
] }, A)) })
|
|
1293
|
+
] }, g)),
|
|
1294
|
+
/* @__PURE__ */ E("details", { style: { marginTop: 12 }, children: [
|
|
1295
|
+
/* @__PURE__ */ s("summary", { style: { cursor: "pointer", opacity: 0.7 }, children: "Raw JSON" }),
|
|
1296
|
+
/* @__PURE__ */ s("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
|
+
] })
|
|
1298
|
+
]
|
|
1299
|
+
}
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1302
|
+
const p = _t(r), m = n !== void 0 ? Dt(n, a) : void 0;
|
|
1303
|
+
return /* @__PURE__ */ s("div", { className: t, style: { ...p, ...i }, "data-testid": "dsl-root", children: ee(a.root, {
|
|
1304
|
+
frame: m == null ? void 0 : m.frame,
|
|
1305
|
+
playerRef: v
|
|
1306
|
+
}) });
|
|
1307
|
+
});
|
|
1308
|
+
function Dt(e, a) {
|
|
1309
|
+
if (e === "first") return { frame: 0 };
|
|
1310
|
+
if (e === "last") {
|
|
1311
|
+
const i = a.root.durationInFrames ?? 1;
|
|
1312
|
+
return { frame: Math.max(0, i - 1) };
|
|
1313
|
+
}
|
|
1314
|
+
return { frame: e };
|
|
1315
|
+
}
|
|
1316
|
+
function Qt(e, a, t) {
|
|
1317
|
+
const i = X(e);
|
|
1318
|
+
if (!i.valid) {
|
|
1319
|
+
const u = i.errors.filter((o) => o.severity === "error");
|
|
1320
|
+
throw new Error(
|
|
1321
|
+
`DSL validation failed:
|
|
1322
|
+
${u.map((o) => ` ${o.path}: ${o.message}`).join(`
|
|
1323
|
+
`)}`
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
const r = { ...e.root };
|
|
1327
|
+
t != null && t.width && (r.width = t.width), t != null && t.height && (r.height = t.height);
|
|
1328
|
+
const n = ee(r, { frame: a });
|
|
1329
|
+
return it(n);
|
|
1330
|
+
}
|
|
1331
|
+
class Lt {
|
|
1215
1332
|
constructor(a, t = 30, i = 900, r = 640) {
|
|
1216
1333
|
this.elements = [], this.cursor = 0, this.theme = a, this._fps = t, this._width = i, this._height = r;
|
|
1217
1334
|
}
|
|
@@ -1314,7 +1431,7 @@ class Pt {
|
|
|
1314
1431
|
}
|
|
1315
1432
|
/** Add an arrow */
|
|
1316
1433
|
arrow(a, t, i, r, n) {
|
|
1317
|
-
const u = (n == null ? void 0 : n.fadeIn) ?? 12,
|
|
1434
|
+
const u = (n == null ? void 0 : n.fadeIn) ?? 12, o = {
|
|
1318
1435
|
type: "arrow",
|
|
1319
1436
|
x1: a,
|
|
1320
1437
|
y1: t,
|
|
@@ -1326,7 +1443,7 @@ class Pt {
|
|
|
1326
1443
|
strokeDasharray: n != null && n.dashed ? "6 3" : void 0,
|
|
1327
1444
|
fadeIn: u
|
|
1328
1445
|
};
|
|
1329
|
-
return this.addAtCursor(
|
|
1446
|
+
return this.addAtCursor(o, (n == null ? void 0 : n.advance) ?? 3);
|
|
1330
1447
|
}
|
|
1331
1448
|
/** Add a line */
|
|
1332
1449
|
line(a, t, i, r, n) {
|
|
@@ -1430,33 +1547,33 @@ class Pt {
|
|
|
1430
1547
|
* Returns the box positions for follow-up arrows, etc.
|
|
1431
1548
|
*/
|
|
1432
1549
|
boxRow(a, t) {
|
|
1433
|
-
const i = (t == null ? void 0 : t.boxWidth) ?? 80, r = (t == null ? void 0 : t.boxHeight) ?? 40, n = (t == null ? void 0 : t.gap) ?? 12, u = (t == null ? void 0 : t.y) ?? 250,
|
|
1550
|
+
const i = (t == null ? void 0 : t.boxWidth) ?? 80, r = (t == null ? void 0 : t.boxHeight) ?? 40, n = (t == null ? void 0 : t.gap) ?? 12, u = (t == null ? void 0 : t.y) ?? 250, o = a.length * i + (a.length - 1) * n, v = (this._width - o) / 2;
|
|
1434
1551
|
t == null || t.fadeIn;
|
|
1435
|
-
const
|
|
1436
|
-
const
|
|
1437
|
-
return { x:
|
|
1438
|
-
}),
|
|
1439
|
-
var
|
|
1440
|
-
const
|
|
1552
|
+
const O = a.map((m, c) => {
|
|
1553
|
+
const f = v + c * (i + n);
|
|
1554
|
+
return { x: f, y: u, w: i, h: r, cx: f + i / 2, cy: u + r / 2 };
|
|
1555
|
+
}), p = a.map((m, c) => {
|
|
1556
|
+
var I, A;
|
|
1557
|
+
const f = O[c], g = ((I = t == null ? void 0 : t.colors) == null ? void 0 : I[c]) ?? this.theme.boxFill, w = ((A = t == null ? void 0 : t.strokeColors) == null ? void 0 : A[c]) ?? this.theme.boxStroke;
|
|
1441
1558
|
return {
|
|
1442
1559
|
type: "group",
|
|
1443
1560
|
children: [
|
|
1444
1561
|
{
|
|
1445
1562
|
type: "rect",
|
|
1446
|
-
x:
|
|
1447
|
-
y:
|
|
1563
|
+
x: f.x,
|
|
1564
|
+
y: f.y,
|
|
1448
1565
|
width: i,
|
|
1449
1566
|
height: r,
|
|
1450
|
-
fill:
|
|
1451
|
-
stroke:
|
|
1567
|
+
fill: g,
|
|
1568
|
+
stroke: w,
|
|
1452
1569
|
strokeWidth: 1.5,
|
|
1453
1570
|
rx: 6
|
|
1454
1571
|
},
|
|
1455
1572
|
{
|
|
1456
1573
|
type: "text",
|
|
1457
|
-
x:
|
|
1458
|
-
y:
|
|
1459
|
-
content:
|
|
1574
|
+
x: f.cx,
|
|
1575
|
+
y: f.cy + 5,
|
|
1576
|
+
content: m,
|
|
1460
1577
|
fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
|
|
1461
1578
|
fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
|
|
1462
1579
|
textAnchor: "middle",
|
|
@@ -1468,40 +1585,40 @@ class Pt {
|
|
|
1468
1585
|
return this.addAtCursor({
|
|
1469
1586
|
type: "stagger",
|
|
1470
1587
|
staggerDelay: 3,
|
|
1471
|
-
children:
|
|
1472
|
-
}, 8 + a.length * 2),
|
|
1588
|
+
children: p
|
|
1589
|
+
}, 8 + a.length * 2), O;
|
|
1473
1590
|
}
|
|
1474
1591
|
/**
|
|
1475
1592
|
* Render a vertical stack of labeled boxes.
|
|
1476
1593
|
*/
|
|
1477
1594
|
boxColumn(a, t) {
|
|
1478
|
-
const i = (t == null ? void 0 : t.boxWidth) ?? 160, r = (t == null ? void 0 : t.boxHeight) ?? 36, n = (t == null ? void 0 : t.gap) ?? 8, u = (t == null ? void 0 : t.y) ?? 150,
|
|
1595
|
+
const i = (t == null ? void 0 : t.boxWidth) ?? 160, r = (t == null ? void 0 : t.boxHeight) ?? 36, n = (t == null ? void 0 : t.gap) ?? 8, u = (t == null ? void 0 : t.y) ?? 150, o = (t == null ? void 0 : t.x) ?? this.cx;
|
|
1479
1596
|
t == null || t.fadeIn;
|
|
1480
|
-
const
|
|
1481
|
-
const
|
|
1482
|
-
return { x:
|
|
1483
|
-
}),
|
|
1484
|
-
var
|
|
1485
|
-
const
|
|
1597
|
+
const v = a.map((p, m) => {
|
|
1598
|
+
const c = u + m * (r + n);
|
|
1599
|
+
return { x: o - i / 2, y: c, w: i, h: r, cx: o, cy: c + r / 2 };
|
|
1600
|
+
}), O = a.map((p, m) => {
|
|
1601
|
+
var g, w;
|
|
1602
|
+
const c = v[m], f = ((g = t == null ? void 0 : t.colors) == null ? void 0 : g[m]) ?? this.theme.boxFill;
|
|
1486
1603
|
return {
|
|
1487
1604
|
type: "group",
|
|
1488
1605
|
children: [
|
|
1489
1606
|
{
|
|
1490
1607
|
type: "rect",
|
|
1491
|
-
x:
|
|
1492
|
-
y:
|
|
1608
|
+
x: c.x,
|
|
1609
|
+
y: c.y,
|
|
1493
1610
|
width: i,
|
|
1494
1611
|
height: r,
|
|
1495
|
-
fill:
|
|
1496
|
-
stroke: (
|
|
1612
|
+
fill: f,
|
|
1613
|
+
stroke: (w = t == null ? void 0 : t.colors) != null && w[m] ? t.colors[m] : this.theme.boxStroke,
|
|
1497
1614
|
strokeWidth: 1.5,
|
|
1498
1615
|
rx: 6
|
|
1499
1616
|
},
|
|
1500
1617
|
{
|
|
1501
1618
|
type: "text",
|
|
1502
|
-
x:
|
|
1503
|
-
y:
|
|
1504
|
-
content:
|
|
1619
|
+
x: c.cx,
|
|
1620
|
+
y: c.cy + 5,
|
|
1621
|
+
content: p,
|
|
1505
1622
|
fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
|
|
1506
1623
|
fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
|
|
1507
1624
|
textAnchor: "middle"
|
|
@@ -1512,8 +1629,8 @@ class Pt {
|
|
|
1512
1629
|
return this.addAtCursor({
|
|
1513
1630
|
type: "stagger",
|
|
1514
1631
|
staggerDelay: 3,
|
|
1515
|
-
children:
|
|
1516
|
-
}, 8 + a.length * 2),
|
|
1632
|
+
children: O
|
|
1633
|
+
}, 8 + a.length * 2), v;
|
|
1517
1634
|
}
|
|
1518
1635
|
/**
|
|
1519
1636
|
* Draw arrows connecting sequential positions (e.g., output of boxRow/boxColumn).
|
|
@@ -1596,7 +1713,7 @@ class Pt {
|
|
|
1596
1713
|
return { elements: this.elements, durationInFrames: a };
|
|
1597
1714
|
}
|
|
1598
1715
|
}
|
|
1599
|
-
const
|
|
1716
|
+
const jt = {
|
|
1600
1717
|
background: "#0a0a1e",
|
|
1601
1718
|
title: "#e0e7ff",
|
|
1602
1719
|
subtitle: "#94a3b8",
|
|
@@ -1611,7 +1728,7 @@ const Rt = {
|
|
|
1611
1728
|
warning: "#fbbf24",
|
|
1612
1729
|
error: "#f87171",
|
|
1613
1730
|
palette: ["#4fc3f7", "#a78bfa", "#f472b6", "#34d399", "#fbbf24", "#fb923c", "#6366f1", "#22d3ee"]
|
|
1614
|
-
},
|
|
1731
|
+
}, Kt = {
|
|
1615
1732
|
background: "#f8fafc",
|
|
1616
1733
|
title: "#1e293b",
|
|
1617
1734
|
subtitle: "#64748b",
|
|
@@ -1627,9 +1744,9 @@ const Rt = {
|
|
|
1627
1744
|
error: "#dc2626",
|
|
1628
1745
|
palette: ["#2563eb", "#7c3aed", "#db2777", "#16a34a", "#d97706", "#ea580c", "#4f46e5", "#0891b2"]
|
|
1629
1746
|
};
|
|
1630
|
-
class
|
|
1747
|
+
class qt {
|
|
1631
1748
|
constructor(a, t, i) {
|
|
1632
|
-
this._slides = [], this._title = a, this._theme = t ??
|
|
1749
|
+
this._slides = [], this._title = a, this._theme = t ?? jt, this._opts = {
|
|
1633
1750
|
width: 900,
|
|
1634
1751
|
height: 640,
|
|
1635
1752
|
fps: 30,
|
|
@@ -1647,7 +1764,7 @@ class Nt {
|
|
|
1647
1764
|
/** Build the final ElucimDocument */
|
|
1648
1765
|
build() {
|
|
1649
1766
|
const a = this._slides.map((i) => {
|
|
1650
|
-
const r = new
|
|
1767
|
+
const r = new Lt(
|
|
1651
1768
|
this._theme,
|
|
1652
1769
|
this._opts.fps,
|
|
1653
1770
|
this._opts.width,
|
|
@@ -1693,19 +1810,26 @@ class Nt {
|
|
|
1693
1810
|
return JSON.stringify(this.build(), null, a ? 2 : void 0);
|
|
1694
1811
|
}
|
|
1695
1812
|
}
|
|
1696
|
-
function
|
|
1697
|
-
return new
|
|
1813
|
+
function Xt(e, a, t) {
|
|
1814
|
+
return new qt(e, a, t);
|
|
1698
1815
|
}
|
|
1699
1816
|
export {
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1817
|
+
Gt as DslRenderer,
|
|
1818
|
+
qt as PresentationBuilder,
|
|
1819
|
+
Lt as SlideBuilder,
|
|
1820
|
+
rt as compileExpression,
|
|
1821
|
+
nt as compileVectorExpression,
|
|
1822
|
+
jt as darkTheme,
|
|
1823
|
+
Kt as lightTheme,
|
|
1824
|
+
Xt as presentation,
|
|
1825
|
+
b as renderElement,
|
|
1826
|
+
te as renderPlayer,
|
|
1827
|
+
Nt as renderPresentation,
|
|
1828
|
+
ee as renderRoot,
|
|
1829
|
+
j as renderScene,
|
|
1830
|
+
Wt as renderSlide,
|
|
1831
|
+
Qt as renderToSvgString,
|
|
1832
|
+
h as resolveEasing,
|
|
1833
|
+
X as validate,
|
|
1834
|
+
K as validateExpression
|
|
1711
1835
|
};
|