@elucim/dsl 0.8.1 → 0.8.2
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.js +199 -201
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { easeOutBounce as
|
|
1
|
+
import { easeOutBounce as ge, easeOutElastic as oe, easeOutBack as me, easeInBack as ye, easeInOutExpo as be, easeOutExpo as xe, easeInExpo as de, easeInOutSine as ve, easeOutSine as we, easeInSine as ke, easeInOutQuart as Ie, easeOutQuart as Se, easeInQuart as $e, easeInOutCubic as Oe, easeOutCubic as Ce, easeInCubic as Ae, easeInOutQuad as ze, easeOutQuad as pe, easeInQuad as Ee, linear as Fe, spring as Re, cubicBezier as Pe, Presentation as Me, Scene as Te, Player as Ne, Slide as We, Parallel as De, Stagger as _e, Morph as Ve, Transform as Le, Write as je, Draw as Be, FadeOut as qe, FadeIn as Ue, BarChart as Ge, LaTeX as He, Graph as Ke, Matrix as Qe, Text as j, VectorField as Xe, Vector as Je, FunctionPlot as Ye, Axes as Ze, Image as et, Polygon as tt, Rect as at, Arrow as rt, Line as it, Circle as nt, BezierCurve as st, Group as ct, Sequence as lt } from "@elucim/core";
|
|
2
2
|
import { jsx as l, jsxs as R } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { renderToStaticMarkup as
|
|
3
|
+
import X, { forwardRef as ut, useRef as ht, useImperativeHandle as ft, useSyncExternalStore as gt } from "react";
|
|
4
|
+
import { renderToStaticMarkup as ot } from "react-dom/server";
|
|
5
5
|
const U = {
|
|
6
6
|
sin: Math.sin,
|
|
7
7
|
cos: Math.cos,
|
|
@@ -22,7 +22,7 @@ const U = {
|
|
|
22
22
|
max: (...e) => Math.max(...e),
|
|
23
23
|
sign: Math.sign,
|
|
24
24
|
pow: Math.pow
|
|
25
|
-
},
|
|
25
|
+
}, J = {
|
|
26
26
|
PI: Math.PI,
|
|
27
27
|
E: Math.E,
|
|
28
28
|
TAU: Math.PI * 2
|
|
@@ -175,7 +175,7 @@ class Q {
|
|
|
175
175
|
);
|
|
176
176
|
return { kind: "call", name: t, args: r };
|
|
177
177
|
}
|
|
178
|
-
return Object.prototype.hasOwnProperty.call(
|
|
178
|
+
return Object.prototype.hasOwnProperty.call(J, t) ? { kind: "number", value: J[t] } : { kind: "variable", name: t };
|
|
179
179
|
}
|
|
180
180
|
if (a.type === "LPAREN") {
|
|
181
181
|
this.advance();
|
|
@@ -236,11 +236,11 @@ class A extends Error {
|
|
|
236
236
|
super(a), this.name = "ExpressionError", this.position = t;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function mt(e) {
|
|
240
240
|
const a = K(e), t = new Q(a).parse();
|
|
241
241
|
return (r) => E(t, r);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function yt(e) {
|
|
244
244
|
const a = K(e), t = new Q(a).parse();
|
|
245
245
|
if (t.kind !== "array" || t.elements.length !== 2)
|
|
246
246
|
throw new A(
|
|
@@ -258,26 +258,26 @@ function ae(e) {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
const G = {
|
|
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:
|
|
261
|
+
linear: Fe,
|
|
262
|
+
easeInQuad: Ee,
|
|
263
|
+
easeOutQuad: pe,
|
|
264
|
+
easeInOutQuad: ze,
|
|
265
|
+
easeInCubic: Ae,
|
|
266
|
+
easeOutCubic: Ce,
|
|
267
|
+
easeInOutCubic: Oe,
|
|
268
|
+
easeInQuart: $e,
|
|
269
|
+
easeOutQuart: Se,
|
|
270
|
+
easeInOutQuart: Ie,
|
|
271
|
+
easeInSine: ke,
|
|
272
|
+
easeOutSine: we,
|
|
273
|
+
easeInOutSine: ve,
|
|
274
|
+
easeInExpo: de,
|
|
275
|
+
easeOutExpo: xe,
|
|
276
|
+
easeInOutExpo: be,
|
|
277
|
+
easeInBack: ye,
|
|
278
|
+
easeOutBack: me,
|
|
279
|
+
easeOutElastic: oe,
|
|
280
|
+
easeOutBounce: ge
|
|
281
281
|
};
|
|
282
282
|
function g(e) {
|
|
283
283
|
if (e !== void 0) {
|
|
@@ -290,13 +290,13 @@ function g(e) {
|
|
|
290
290
|
return a;
|
|
291
291
|
}
|
|
292
292
|
if (e.type === "spring")
|
|
293
|
-
return
|
|
293
|
+
return Re({
|
|
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 Pe(e.x1, e.y1, e.x2, e.y2);
|
|
300
300
|
throw new Error(`Unknown easing type: ${e.type}`);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
@@ -306,12 +306,12 @@ function re(e) {
|
|
|
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((r) => r.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((r) => r.severity === "error").length === 0, errors: a }) : (bt(t.root, "root", a), {
|
|
310
310
|
valid: a.filter((r) => r.severity === "error").length === 0,
|
|
311
311
|
errors: a
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const Y = ["scene", "player", "presentation"], _ = ["card", "slide", "square"], q = [
|
|
315
315
|
"sequence",
|
|
316
316
|
"group",
|
|
317
317
|
"bezierCurve",
|
|
@@ -340,32 +340,32 @@ const Z = ["scene", "player", "presentation"], _ = ["card", "slide", "square"],
|
|
|
340
340
|
"parallel",
|
|
341
341
|
"player",
|
|
342
342
|
"scene"
|
|
343
|
-
],
|
|
344
|
-
function
|
|
343
|
+
], Z = ["none", "fade", "slide-left", "slide-up", "zoom"];
|
|
344
|
+
function bt(e, a, t) {
|
|
345
345
|
const r = e.type;
|
|
346
|
-
if (!
|
|
347
|
-
t.push({ path: `${a}.type`, message: `Root type must be one of: ${
|
|
346
|
+
if (!Y.includes(r)) {
|
|
347
|
+
t.push({ path: `${a}.type`, message: `Root type must be one of: ${Y.join(", ")}. Got "${r}"`, severity: "error" });
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
350
|
-
r === "scene" || r === "player" ? ie(e, a, r, t) : r === "presentation" &&
|
|
350
|
+
r === "scene" || r === "player" ? ie(e, a, r, t) : r === "presentation" && xt(e, a, t);
|
|
351
351
|
}
|
|
352
352
|
function ie(e, a, t, r) {
|
|
353
|
-
|
|
353
|
+
Bt(e, "durationInFrames", a, r), b(e, "width", a, r), b(e, "height", a, r), b(e, "fps", a, r), z(e, "background", a, r), e.preset !== void 0 && (typeof e.preset != "string" || !_.includes(e.preset)) && r.push({ path: `${a}.preset`, message: `preset must be one of: ${_.join(", ")}. Got "${e.preset}"`, severity: "error" }), t === "player" && (W(e, "controls", a, r), W(e, "loop", a, r), W(e, "autoPlay", a, r)), p(e, a, r);
|
|
354
354
|
}
|
|
355
|
-
function
|
|
356
|
-
if (b(e, "width", a, t), b(e, "height", a, t), z(e, "background", a, t), b(e, "transitionDuration", a, t), W(e, "showHud", a, t), W(e, "showNotes", a, t), e.preset !== void 0 && (typeof e.preset != "string" || !_.includes(e.preset)) && t.push({ path: `${a}.preset`, message: `preset must be one of: ${_.join(", ")}. Got "${e.preset}"`, severity: "error" }), e.transition !== void 0 && (
|
|
355
|
+
function xt(e, a, t) {
|
|
356
|
+
if (b(e, "width", a, t), b(e, "height", a, t), z(e, "background", a, t), b(e, "transitionDuration", a, t), W(e, "showHud", a, t), W(e, "showNotes", a, t), e.preset !== void 0 && (typeof e.preset != "string" || !_.includes(e.preset)) && t.push({ path: `${a}.preset`, message: `preset must be one of: ${_.join(", ")}. Got "${e.preset}"`, severity: "error" }), e.transition !== void 0 && (Z.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: ${Z.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
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
|
-
|
|
365
|
+
dt(r, `${a}.slides[${i}]`, t);
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function dt(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;
|
|
@@ -400,58 +400,58 @@ function ne(e, a, t) {
|
|
|
400
400
|
}
|
|
401
401
|
switch (r) {
|
|
402
402
|
case "bezierCurve":
|
|
403
|
-
|
|
403
|
+
vt(e, a, t);
|
|
404
404
|
break;
|
|
405
405
|
case "circle":
|
|
406
|
-
|
|
406
|
+
wt(e, a, t);
|
|
407
407
|
break;
|
|
408
408
|
case "line":
|
|
409
|
-
|
|
409
|
+
kt(e, a, t);
|
|
410
410
|
break;
|
|
411
411
|
case "arrow":
|
|
412
|
-
|
|
412
|
+
It(e, a, t);
|
|
413
413
|
break;
|
|
414
414
|
case "rect":
|
|
415
|
-
|
|
415
|
+
St(e, a, t);
|
|
416
416
|
break;
|
|
417
417
|
case "polygon":
|
|
418
|
-
|
|
418
|
+
$t(e, a, t);
|
|
419
419
|
break;
|
|
420
420
|
case "text":
|
|
421
|
-
|
|
421
|
+
Ot(e, a, t);
|
|
422
422
|
break;
|
|
423
423
|
case "image":
|
|
424
|
-
|
|
424
|
+
Vt(e, a, t);
|
|
425
425
|
break;
|
|
426
426
|
case "axes":
|
|
427
|
-
|
|
427
|
+
Ct(e, a, t);
|
|
428
428
|
break;
|
|
429
429
|
case "functionPlot":
|
|
430
|
-
|
|
430
|
+
At(e, a, t);
|
|
431
431
|
break;
|
|
432
432
|
case "vector":
|
|
433
|
-
|
|
433
|
+
zt(e, a, t);
|
|
434
434
|
break;
|
|
435
435
|
case "vectorField":
|
|
436
|
-
|
|
436
|
+
pt(e, a, t);
|
|
437
437
|
break;
|
|
438
438
|
case "matrix":
|
|
439
|
-
|
|
439
|
+
Et(e, a, t);
|
|
440
440
|
break;
|
|
441
441
|
case "graph":
|
|
442
|
-
|
|
442
|
+
Ft(e, a, t);
|
|
443
443
|
break;
|
|
444
444
|
case "latex":
|
|
445
|
-
|
|
445
|
+
Rt(e, a, t);
|
|
446
446
|
break;
|
|
447
447
|
case "barChart":
|
|
448
|
-
|
|
448
|
+
jt(e, a, t);
|
|
449
449
|
break;
|
|
450
450
|
case "sequence":
|
|
451
|
-
|
|
451
|
+
Pt(e, a, t);
|
|
452
452
|
break;
|
|
453
453
|
case "group":
|
|
454
|
-
|
|
454
|
+
Lt(e, a, t);
|
|
455
455
|
break;
|
|
456
456
|
case "parallel":
|
|
457
457
|
p(e, a, t);
|
|
@@ -460,16 +460,16 @@ function ne(e, a, t) {
|
|
|
460
460
|
case "fadeOut":
|
|
461
461
|
case "draw":
|
|
462
462
|
case "write":
|
|
463
|
-
|
|
463
|
+
Mt(e, a, t);
|
|
464
464
|
break;
|
|
465
465
|
case "transform":
|
|
466
|
-
|
|
466
|
+
Tt(e, a, t);
|
|
467
467
|
break;
|
|
468
468
|
case "morph":
|
|
469
|
-
|
|
469
|
+
Nt(e, a, t);
|
|
470
470
|
break;
|
|
471
471
|
case "stagger":
|
|
472
|
-
|
|
472
|
+
Wt(e, a, t);
|
|
473
473
|
break;
|
|
474
474
|
case "scene":
|
|
475
475
|
case "player":
|
|
@@ -477,33 +477,33 @@ function ne(e, a, t) {
|
|
|
477
477
|
break;
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
function dt(e, a, t) {
|
|
481
|
-
h(e, "x1", a, t), h(e, "y1", a, t), h(e, "cx1", a, t), h(e, "cy1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), e.cx2 !== void 0 && P(e, "cx2", a, t), e.cy2 !== void 0 && P(e, "cy2", a, t), w(e, a, t);
|
|
482
|
-
}
|
|
483
480
|
function vt(e, a, t) {
|
|
484
|
-
h(e, "
|
|
481
|
+
h(e, "x1", a, t), h(e, "y1", a, t), h(e, "cx1", a, t), h(e, "cy1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), e.cx2 !== void 0 && P(e, "cx2", a, t), e.cy2 !== void 0 && P(e, "cy2", a, t), w(e, a, t);
|
|
485
482
|
}
|
|
486
483
|
function wt(e, a, t) {
|
|
487
|
-
h(e, "
|
|
484
|
+
h(e, "cx", a, t), h(e, "cy", a, t), F(e, "r", a, t), w(e, a, t);
|
|
488
485
|
}
|
|
489
486
|
function kt(e, a, t) {
|
|
490
487
|
h(e, "x1", a, t), h(e, "y1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), w(e, a, t);
|
|
491
488
|
}
|
|
492
489
|
function It(e, a, t) {
|
|
493
|
-
h(e, "
|
|
490
|
+
h(e, "x1", a, t), h(e, "y1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), w(e, a, t);
|
|
494
491
|
}
|
|
495
492
|
function St(e, a, t) {
|
|
493
|
+
h(e, "x", a, t), h(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), w(e, a, t);
|
|
494
|
+
}
|
|
495
|
+
function $t(e, a, t) {
|
|
496
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
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
498
|
}) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }), w(e, a, t);
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function Ot(e, a, t) {
|
|
501
501
|
h(e, "x", a, t), h(e, "y", a, t), typeof e.content != "string" && t.push({ path: `${a}.content`, message: 'Text requires a "content" string', severity: "error" }), w(e, a, t);
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function Ct(e, a, t) {
|
|
504
504
|
S(e, "domain", a, t), S(e, "range", a, t), S(e, "origin", a, t), V(e, a, t);
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function At(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 {
|
|
@@ -512,10 +512,10 @@ function Ct(e, a, t) {
|
|
|
512
512
|
}
|
|
513
513
|
S(e, "domain", a, t), V(e, a, t);
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function zt(e, a, t) {
|
|
516
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" }), S(e, "from", a, t), V(e, a, t);
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function pt(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 {
|
|
@@ -524,12 +524,12 @@ function zt(e, a, t) {
|
|
|
524
524
|
}
|
|
525
525
|
S(e, "domain", a, t), S(e, "range", a, t), V(e, a, t);
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function Et(e, a, t) {
|
|
528
528
|
Array.isArray(e.values) ? e.values.forEach((r, i) => {
|
|
529
529
|
Array.isArray(r) || t.push({ path: `${a}.values[${i}]`, message: "Each matrix row must be an array", severity: "error" });
|
|
530
530
|
}) : t.push({ path: `${a}.values`, message: 'Matrix requires a "values" 2D array', severity: "error" }), w(e, a, t);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function Ft(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 {
|
|
@@ -542,16 +542,16 @@ function Et(e, a, t) {
|
|
|
542
542
|
}
|
|
543
543
|
w(e, a, t);
|
|
544
544
|
}
|
|
545
|
-
function Ft(e, a, t) {
|
|
546
|
-
typeof e.expression != "string" && t.push({ path: `${a}.expression`, message: 'LaTeX requires an "expression" string', severity: "error" }), h(e, "x", a, t), h(e, "y", a, t), w(e, a, t);
|
|
547
|
-
}
|
|
548
545
|
function Rt(e, a, t) {
|
|
549
|
-
h(e, "
|
|
546
|
+
typeof e.expression != "string" && t.push({ path: `${a}.expression`, message: 'LaTeX requires an "expression" string', severity: "error" }), h(e, "x", a, t), h(e, "y", a, t), w(e, a, t);
|
|
550
547
|
}
|
|
551
548
|
function Pt(e, a, t) {
|
|
552
|
-
|
|
549
|
+
h(e, "from", a, t), qt(e, "durationInFrames", a, t), p(e, a, t);
|
|
553
550
|
}
|
|
554
551
|
function Mt(e, a, t) {
|
|
552
|
+
b(e, "duration", a, t), M(e, a, t), p(e, a, t);
|
|
553
|
+
}
|
|
554
|
+
function Tt(e, a, t) {
|
|
555
555
|
if (b(e, "duration", a, t), M(e, a, t), e.translate !== void 0) {
|
|
556
556
|
const r = e.translate;
|
|
557
557
|
(!r || typeof r != "object") && t.push({ path: `${a}.translate`, message: "translate must be { from: [x,y], to: [x,y] }", severity: "error" });
|
|
@@ -570,39 +570,39 @@ function Mt(e, a, t) {
|
|
|
570
570
|
}
|
|
571
571
|
p(e, a, t);
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Nt(e, a, t) {
|
|
574
574
|
b(e, "duration", a, t), M(e, a, t), z(e, "fromColor", a, t), z(e, "toColor", a, t), p(e, a, t);
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function Wt(e, a, t) {
|
|
577
577
|
b(e, "staggerDelay", a, t), M(e, a, t), p(e, a, t);
|
|
578
578
|
}
|
|
579
579
|
function w(e, a, t) {
|
|
580
|
-
b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), M(e, a, t),
|
|
580
|
+
b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), M(e, a, t), Dt(e, a, t);
|
|
581
581
|
}
|
|
582
582
|
function V(e, a, t) {
|
|
583
|
-
b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), M(e, a, t),
|
|
583
|
+
b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), M(e, a, t), _t(e, a, t);
|
|
584
584
|
}
|
|
585
|
-
const
|
|
586
|
-
function
|
|
585
|
+
const ee = ["none", "circle", "ellipse"];
|
|
586
|
+
function Dt(e, a, t) {
|
|
587
587
|
if (P(e, "rotation", a, t), S(e, "rotationOrigin", a, t), S(e, "translate", a, t), P(e, "zIndex", a, t), e.scale !== void 0) {
|
|
588
588
|
const r = e.scale;
|
|
589
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
|
|
592
|
+
function _t(e, a, t) {
|
|
593
593
|
P(e, "rotation", a, t), S(e, "rotationOrigin", a, t), S(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" }), h(e, "x", a, t), h(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), z(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 && (
|
|
595
|
+
function Vt(e, a, t) {
|
|
596
|
+
typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }), h(e, "x", a, t), h(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), z(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 && (ee.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: ${ee.join(", ")}`,
|
|
599
599
|
severity: "error"
|
|
600
600
|
})), w(e, a, t);
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Lt(e, a, t) {
|
|
603
603
|
p(e, a, t), w(e, a, t);
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function jt(e, a, t) {
|
|
606
606
|
h(e, "x", a, t), h(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), Array.isArray(e.bars) || t.push({ path: `${a}.bars`, message: 'BarChart requires a "bars" array', severity: "error" }), w(e, a, t);
|
|
607
607
|
}
|
|
608
608
|
function M(e, a, t) {
|
|
@@ -638,14 +638,14 @@ function h(e, a, t, r) {
|
|
|
638
638
|
function F(e, a, t, r) {
|
|
639
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
|
|
641
|
+
function Bt(e, a, t, r) {
|
|
642
642
|
const i = e[a];
|
|
643
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
645
|
function b(e, a, t, r) {
|
|
646
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
|
|
648
|
+
function qt(e, a, t, r) {
|
|
649
649
|
const i = e[a];
|
|
650
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
|
}
|
|
@@ -668,7 +668,7 @@ function se(e, a) {
|
|
|
668
668
|
const i = a.find((n) => n.toLowerCase().startsWith(t.slice(0, 4)));
|
|
669
669
|
return i ? ` Did you mean '${i}'?` : "";
|
|
670
670
|
}
|
|
671
|
-
const
|
|
671
|
+
const ce = {
|
|
672
672
|
foreground: { cssVar: "--elucim-foreground", fallback: "#c8d6e5" },
|
|
673
673
|
background: { cssVar: "--elucim-background", fallback: "#0a0a1e" },
|
|
674
674
|
title: { cssVar: "--elucim-title", fallback: "#e0e7ff" },
|
|
@@ -683,24 +683,24 @@ const X = {
|
|
|
683
683
|
success: { cssVar: "--elucim-success", fallback: "#34d399" },
|
|
684
684
|
warning: { cssVar: "--elucim-warning", fallback: "#fbbf24" },
|
|
685
685
|
error: { cssVar: "--elucim-error", fallback: "#f87171" }
|
|
686
|
-
},
|
|
686
|
+
}, ga = Object.keys(ce);
|
|
687
687
|
function u(e) {
|
|
688
688
|
if (e === void 0) return;
|
|
689
689
|
if (!e.startsWith("$")) return e;
|
|
690
|
-
const a = e.slice(1), t =
|
|
690
|
+
const a = e.slice(1), t = ce[a];
|
|
691
691
|
return t ? `var(${t.cssVar}, ${t.fallback})` : `var(--elucim-${a})`;
|
|
692
692
|
}
|
|
693
|
-
const
|
|
693
|
+
const Ut = {
|
|
694
694
|
card: [640, 360],
|
|
695
695
|
slide: [1280, 720],
|
|
696
696
|
square: [600, 600]
|
|
697
697
|
};
|
|
698
698
|
function L(e, a, t) {
|
|
699
699
|
if (!e) return { width: a, height: t };
|
|
700
|
-
const [r, i] =
|
|
700
|
+
const [r, i] = Ut[e];
|
|
701
701
|
return { width: a ?? r, height: t ?? i };
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function le(e, a) {
|
|
704
704
|
switch (e.type) {
|
|
705
705
|
case "scene":
|
|
706
706
|
return H(e, a);
|
|
@@ -719,15 +719,15 @@ function ce(e, a) {
|
|
|
719
719
|
a
|
|
720
720
|
);
|
|
721
721
|
}
|
|
722
|
-
return
|
|
722
|
+
return ue(e, a);
|
|
723
723
|
case "presentation":
|
|
724
|
-
return
|
|
724
|
+
return Gt(e);
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
727
|
function H(e, a) {
|
|
728
728
|
const t = (a == null ? void 0 : a.frame) !== void 0, { width: r, height: i } = L(e.preset, e.width, e.height);
|
|
729
729
|
return /* @__PURE__ */ l(
|
|
730
|
-
|
|
730
|
+
Te,
|
|
731
731
|
{
|
|
732
732
|
width: r,
|
|
733
733
|
height: i,
|
|
@@ -740,10 +740,10 @@ function H(e, a) {
|
|
|
740
740
|
}
|
|
741
741
|
);
|
|
742
742
|
}
|
|
743
|
-
function
|
|
743
|
+
function ue(e, a) {
|
|
744
744
|
const { width: t, height: r } = L(e.preset, e.width, e.height);
|
|
745
745
|
return /* @__PURE__ */ l(
|
|
746
|
-
|
|
746
|
+
Ne,
|
|
747
747
|
{
|
|
748
748
|
ref: a == null ? void 0 : a.playerRef,
|
|
749
749
|
width: t,
|
|
@@ -759,10 +759,10 @@ function le(e, a) {
|
|
|
759
759
|
}
|
|
760
760
|
);
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Gt(e) {
|
|
763
763
|
const { width: a, height: t } = L(e.preset, e.width, e.height);
|
|
764
764
|
return /* @__PURE__ */ l(
|
|
765
|
-
|
|
765
|
+
Me,
|
|
766
766
|
{
|
|
767
767
|
width: a,
|
|
768
768
|
height: t,
|
|
@@ -771,22 +771,22 @@ function Ut(e) {
|
|
|
771
771
|
transitionDuration: e.transitionDuration,
|
|
772
772
|
showHUD: e.showHud,
|
|
773
773
|
showNotes: e.showNotes,
|
|
774
|
-
children: e.slides.map((r, i) =>
|
|
774
|
+
children: e.slides.map((r, i) => Ht(r, i))
|
|
775
775
|
}
|
|
776
776
|
);
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function Ht(e, a) {
|
|
779
779
|
var t;
|
|
780
|
-
return /* @__PURE__ */ l(
|
|
780
|
+
return /* @__PURE__ */ l(We, { title: e.title, notes: e.notes, background: u(e.background), children: (t = e.children) == null ? void 0 : t.map((r, i) => v(r, i)) }, a);
|
|
781
781
|
}
|
|
782
782
|
function v(e, a) {
|
|
783
783
|
var t, r, i, n;
|
|
784
784
|
switch (e.type) {
|
|
785
785
|
case "sequence":
|
|
786
|
-
return /* @__PURE__ */ l(
|
|
786
|
+
return /* @__PURE__ */ l(lt, { from: e.from, durationInFrames: e.durationInFrames, name: e.name, children: e.children.map((s, c) => v(s, c)) }, a);
|
|
787
787
|
case "group":
|
|
788
788
|
return /* @__PURE__ */ l(
|
|
789
|
-
|
|
789
|
+
ct,
|
|
790
790
|
{
|
|
791
791
|
fadeIn: e.fadeIn,
|
|
792
792
|
fadeOut: e.fadeOut,
|
|
@@ -802,7 +802,7 @@ function v(e, a) {
|
|
|
802
802
|
);
|
|
803
803
|
case "bezierCurve":
|
|
804
804
|
return /* @__PURE__ */ l(
|
|
805
|
-
|
|
805
|
+
st,
|
|
806
806
|
{
|
|
807
807
|
x1: e.x1,
|
|
808
808
|
y1: e.y1,
|
|
@@ -831,7 +831,7 @@ function v(e, a) {
|
|
|
831
831
|
);
|
|
832
832
|
case "circle":
|
|
833
833
|
return /* @__PURE__ */ l(
|
|
834
|
-
|
|
834
|
+
nt,
|
|
835
835
|
{
|
|
836
836
|
cx: e.cx,
|
|
837
837
|
cy: e.cy,
|
|
@@ -854,7 +854,7 @@ function v(e, a) {
|
|
|
854
854
|
);
|
|
855
855
|
case "line":
|
|
856
856
|
return /* @__PURE__ */ l(
|
|
857
|
-
|
|
857
|
+
it,
|
|
858
858
|
{
|
|
859
859
|
x1: e.x1,
|
|
860
860
|
y1: e.y1,
|
|
@@ -878,7 +878,7 @@ function v(e, a) {
|
|
|
878
878
|
);
|
|
879
879
|
case "arrow":
|
|
880
880
|
return /* @__PURE__ */ l(
|
|
881
|
-
|
|
881
|
+
rt,
|
|
882
882
|
{
|
|
883
883
|
x1: e.x1,
|
|
884
884
|
y1: e.y1,
|
|
@@ -903,7 +903,7 @@ function v(e, a) {
|
|
|
903
903
|
);
|
|
904
904
|
case "rect":
|
|
905
905
|
return /* @__PURE__ */ l(
|
|
906
|
-
|
|
906
|
+
at,
|
|
907
907
|
{
|
|
908
908
|
x: e.x,
|
|
909
909
|
y: e.y,
|
|
@@ -930,7 +930,7 @@ function v(e, a) {
|
|
|
930
930
|
);
|
|
931
931
|
case "polygon":
|
|
932
932
|
return /* @__PURE__ */ l(
|
|
933
|
-
|
|
933
|
+
tt,
|
|
934
934
|
{
|
|
935
935
|
points: e.points,
|
|
936
936
|
fill: u(e.fill),
|
|
@@ -977,7 +977,7 @@ function v(e, a) {
|
|
|
977
977
|
);
|
|
978
978
|
case "image":
|
|
979
979
|
return /* @__PURE__ */ l(
|
|
980
|
-
|
|
980
|
+
et,
|
|
981
981
|
{
|
|
982
982
|
src: e.src,
|
|
983
983
|
x: e.x,
|
|
@@ -1001,7 +1001,7 @@ function v(e, a) {
|
|
|
1001
1001
|
);
|
|
1002
1002
|
case "axes":
|
|
1003
1003
|
return /* @__PURE__ */ l(
|
|
1004
|
-
|
|
1004
|
+
Ze,
|
|
1005
1005
|
{
|
|
1006
1006
|
domain: e.domain,
|
|
1007
1007
|
range: e.range,
|
|
@@ -1029,7 +1029,7 @@ function v(e, a) {
|
|
|
1029
1029
|
case "functionPlot": {
|
|
1030
1030
|
let s;
|
|
1031
1031
|
try {
|
|
1032
|
-
s =
|
|
1032
|
+
s = mt(e.fn);
|
|
1033
1033
|
} catch {
|
|
1034
1034
|
return /* @__PURE__ */ l(
|
|
1035
1035
|
j,
|
|
@@ -1045,7 +1045,7 @@ function v(e, a) {
|
|
|
1045
1045
|
);
|
|
1046
1046
|
}
|
|
1047
1047
|
return /* @__PURE__ */ l(
|
|
1048
|
-
|
|
1048
|
+
Ye,
|
|
1049
1049
|
{
|
|
1050
1050
|
fn: (c) => s({ x: c }),
|
|
1051
1051
|
domain: e.domain,
|
|
@@ -1068,7 +1068,7 @@ function v(e, a) {
|
|
|
1068
1068
|
}
|
|
1069
1069
|
case "vector":
|
|
1070
1070
|
return /* @__PURE__ */ l(
|
|
1071
|
-
|
|
1071
|
+
Je,
|
|
1072
1072
|
{
|
|
1073
1073
|
from: e.from,
|
|
1074
1074
|
to: e.to,
|
|
@@ -1095,7 +1095,7 @@ function v(e, a) {
|
|
|
1095
1095
|
case "vectorField": {
|
|
1096
1096
|
let s;
|
|
1097
1097
|
try {
|
|
1098
|
-
s =
|
|
1098
|
+
s = yt(e.fn);
|
|
1099
1099
|
} catch {
|
|
1100
1100
|
return /* @__PURE__ */ l(
|
|
1101
1101
|
j,
|
|
@@ -1111,7 +1111,7 @@ function v(e, a) {
|
|
|
1111
1111
|
);
|
|
1112
1112
|
}
|
|
1113
1113
|
return /* @__PURE__ */ l(
|
|
1114
|
-
|
|
1114
|
+
Xe,
|
|
1115
1115
|
{
|
|
1116
1116
|
fn: (c, x) => s({ x: c, y: x }),
|
|
1117
1117
|
domain: e.domain,
|
|
@@ -1138,7 +1138,7 @@ function v(e, a) {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
case "matrix":
|
|
1140
1140
|
return /* @__PURE__ */ l(
|
|
1141
|
-
|
|
1141
|
+
Qe,
|
|
1142
1142
|
{
|
|
1143
1143
|
values: e.values,
|
|
1144
1144
|
x: e.x,
|
|
@@ -1160,7 +1160,7 @@ function v(e, a) {
|
|
|
1160
1160
|
);
|
|
1161
1161
|
case "graph":
|
|
1162
1162
|
return /* @__PURE__ */ l(
|
|
1163
|
-
|
|
1163
|
+
Ke,
|
|
1164
1164
|
{
|
|
1165
1165
|
nodes: e.nodes,
|
|
1166
1166
|
edges: e.edges,
|
|
@@ -1183,7 +1183,7 @@ function v(e, a) {
|
|
|
1183
1183
|
);
|
|
1184
1184
|
case "latex":
|
|
1185
1185
|
return /* @__PURE__ */ l(
|
|
1186
|
-
|
|
1186
|
+
He,
|
|
1187
1187
|
{
|
|
1188
1188
|
expression: e.expression,
|
|
1189
1189
|
x: e.x,
|
|
@@ -1204,7 +1204,7 @@ function v(e, a) {
|
|
|
1204
1204
|
);
|
|
1205
1205
|
case "barChart":
|
|
1206
1206
|
return /* @__PURE__ */ l(
|
|
1207
|
-
|
|
1207
|
+
Ge,
|
|
1208
1208
|
{
|
|
1209
1209
|
bars: e.bars,
|
|
1210
1210
|
x: e.x,
|
|
@@ -1230,16 +1230,16 @@ function v(e, a) {
|
|
|
1230
1230
|
a
|
|
1231
1231
|
);
|
|
1232
1232
|
case "fadeIn":
|
|
1233
|
-
return /* @__PURE__ */ l(
|
|
1233
|
+
return /* @__PURE__ */ l(Ue, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
|
|
1234
1234
|
case "fadeOut":
|
|
1235
|
-
return /* @__PURE__ */ l(
|
|
1235
|
+
return /* @__PURE__ */ l(qe, { duration: e.duration, totalFrames: e.totalFrames, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
|
|
1236
1236
|
case "draw":
|
|
1237
|
-
return /* @__PURE__ */ l(
|
|
1237
|
+
return /* @__PURE__ */ l(Be, { duration: e.duration, pathLength: e.pathLength, easing: g(e.easing), children: v(e.children[0], 0) }, a);
|
|
1238
1238
|
case "write":
|
|
1239
|
-
return /* @__PURE__ */ l(
|
|
1239
|
+
return /* @__PURE__ */ l(je, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
|
|
1240
1240
|
case "transform":
|
|
1241
1241
|
return /* @__PURE__ */ l(
|
|
1242
|
-
|
|
1242
|
+
Le,
|
|
1243
1243
|
{
|
|
1244
1244
|
duration: e.duration,
|
|
1245
1245
|
easing: g(e.easing),
|
|
@@ -1253,7 +1253,7 @@ function v(e, a) {
|
|
|
1253
1253
|
);
|
|
1254
1254
|
case "morph":
|
|
1255
1255
|
return /* @__PURE__ */ l(
|
|
1256
|
-
|
|
1256
|
+
Ve,
|
|
1257
1257
|
{
|
|
1258
1258
|
duration: e.duration,
|
|
1259
1259
|
easing: g(e.easing),
|
|
@@ -1268,18 +1268,18 @@ function v(e, a) {
|
|
|
1268
1268
|
a
|
|
1269
1269
|
);
|
|
1270
1270
|
case "stagger":
|
|
1271
|
-
return /* @__PURE__ */ l(
|
|
1271
|
+
return /* @__PURE__ */ l(_e, { staggerDelay: e.staggerDelay, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
|
|
1272
1272
|
case "parallel":
|
|
1273
|
-
return /* @__PURE__ */ l(
|
|
1273
|
+
return /* @__PURE__ */ l(De, { children: e.children.map((s, c) => v(s, c)) }, a);
|
|
1274
1274
|
case "scene":
|
|
1275
|
-
return /* @__PURE__ */ l(
|
|
1275
|
+
return /* @__PURE__ */ l(X.Fragment, { children: H(e) }, a);
|
|
1276
1276
|
case "player":
|
|
1277
|
-
return /* @__PURE__ */ l(
|
|
1277
|
+
return /* @__PURE__ */ l(X.Fragment, { children: ue(e) }, a);
|
|
1278
1278
|
default:
|
|
1279
1279
|
return null;
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
|
-
const
|
|
1282
|
+
const he = {
|
|
1283
1283
|
background: "#0a0a1e",
|
|
1284
1284
|
title: "#e0e7ff",
|
|
1285
1285
|
subtitle: "#94a3b8",
|
|
@@ -1294,7 +1294,7 @@ const ue = {
|
|
|
1294
1294
|
warning: "#fbbf24",
|
|
1295
1295
|
error: "#f87171",
|
|
1296
1296
|
palette: ["#4fc3f7", "#a78bfa", "#f472b6", "#34d399", "#fbbf24", "#fb923c", "#6366f1", "#22d3ee"]
|
|
1297
|
-
},
|
|
1297
|
+
}, Kt = {
|
|
1298
1298
|
background: "#f8fafc",
|
|
1299
1299
|
title: "#1e293b",
|
|
1300
1300
|
subtitle: "#64748b",
|
|
@@ -1310,14 +1310,14 @@ const ue = {
|
|
|
1310
1310
|
error: "#dc2626",
|
|
1311
1311
|
palette: ["#2563eb", "#7c3aed", "#db2777", "#16a34a", "#d97706", "#ea580c", "#4f46e5", "#0891b2"]
|
|
1312
1312
|
};
|
|
1313
|
-
function
|
|
1313
|
+
function Qt(e) {
|
|
1314
1314
|
if (!e) return {};
|
|
1315
1315
|
const a = {};
|
|
1316
1316
|
for (const [t, r] of Object.entries(e))
|
|
1317
1317
|
r !== void 0 && (a[`--elucim-${t}`] = r);
|
|
1318
1318
|
return a;
|
|
1319
1319
|
}
|
|
1320
|
-
function
|
|
1320
|
+
function fe(e) {
|
|
1321
1321
|
return {
|
|
1322
1322
|
"--elucim-foreground": e.text,
|
|
1323
1323
|
"--elucim-background": e.background,
|
|
@@ -1334,25 +1334,25 @@ function he(e) {
|
|
|
1334
1334
|
"--elucim-error": e.error
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
|
-
const
|
|
1338
|
-
function
|
|
1337
|
+
const Xt = fe(he), Jt = fe(Kt);
|
|
1338
|
+
function Yt(e) {
|
|
1339
1339
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {
|
|
1340
1340
|
};
|
|
1341
1341
|
const a = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1342
1342
|
return a.addEventListener("change", e), () => a.removeEventListener("change", e);
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1344
|
+
function Zt() {
|
|
1345
1345
|
return typeof window > "u" || typeof window.matchMedia != "function" ? !0 : window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
1346
1346
|
}
|
|
1347
|
-
function
|
|
1347
|
+
function ea() {
|
|
1348
1348
|
return !0;
|
|
1349
1349
|
}
|
|
1350
|
-
function
|
|
1351
|
-
return
|
|
1350
|
+
function ta() {
|
|
1351
|
+
return gt(Yt, Zt, ea);
|
|
1352
1352
|
}
|
|
1353
|
-
const
|
|
1354
|
-
const m =
|
|
1355
|
-
|
|
1353
|
+
const oa = ut(function({ dsl: a, className: t, style: r, theme: i, colorScheme: n, poster: s, onError: c }, x) {
|
|
1354
|
+
const m = ht(null), k = ta();
|
|
1355
|
+
ft(x, () => ({
|
|
1356
1356
|
getSvgElement: () => {
|
|
1357
1357
|
var f;
|
|
1358
1358
|
return ((f = m.current) == null ? void 0 : f.getSvgElement()) ?? null;
|
|
@@ -1420,17 +1420,17 @@ const ga = lt(function({ dsl: a, className: t, style: r, theme: i, colorScheme:
|
|
|
1420
1420
|
}
|
|
1421
1421
|
);
|
|
1422
1422
|
}
|
|
1423
|
-
const o =
|
|
1423
|
+
const o = Qt(i);
|
|
1424
1424
|
let d = {};
|
|
1425
|
-
n && (d = (n === "auto" ? k : n === "dark") ?
|
|
1426
|
-
const $ = s !== void 0 ?
|
|
1427
|
-
return /* @__PURE__ */ l("div", { className: t, style: { ...d, ...o, ...r }, "data-testid": "dsl-root", children:
|
|
1425
|
+
n && (d = (n === "auto" ? k : n === "dark") ? Xt : Jt);
|
|
1426
|
+
const $ = s !== void 0 ? aa(s, a) : void 0, O = n ? n === "auto" ? k ? "dark" : "light" : n : void 0;
|
|
1427
|
+
return /* @__PURE__ */ l("div", { className: t, style: { ...d, ...o, ...r }, "data-testid": "dsl-root", children: le(a.root, {
|
|
1428
1428
|
frame: $ == null ? void 0 : $.frame,
|
|
1429
1429
|
playerRef: m,
|
|
1430
1430
|
colorScheme: O
|
|
1431
1431
|
}) });
|
|
1432
1432
|
});
|
|
1433
|
-
function
|
|
1433
|
+
function aa(e, a) {
|
|
1434
1434
|
if (e === "first") return { frame: 0 };
|
|
1435
1435
|
if (e === "last") {
|
|
1436
1436
|
const r = a.root.durationInFrames ?? 1;
|
|
@@ -1438,7 +1438,7 @@ function ta(e, a) {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
return { frame: e };
|
|
1440
1440
|
}
|
|
1441
|
-
function
|
|
1441
|
+
function ra(e, a, t) {
|
|
1442
1442
|
const r = re(e);
|
|
1443
1443
|
if (!r.valid) {
|
|
1444
1444
|
const s = r.errors.filter((c) => c.severity === "error");
|
|
@@ -1450,11 +1450,18 @@ ${s.map((c) => ` ${c.path}: ${c.message}`).join(`
|
|
|
1450
1450
|
}
|
|
1451
1451
|
const i = { ...e.root };
|
|
1452
1452
|
t != null && t.width && (i.width = t.width), t != null && t.height && (i.height = t.height);
|
|
1453
|
-
const n =
|
|
1454
|
-
return
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1453
|
+
const n = le(i, { frame: a });
|
|
1454
|
+
return ot(n);
|
|
1455
|
+
}
|
|
1456
|
+
function te(e) {
|
|
1457
|
+
let a;
|
|
1458
|
+
do
|
|
1459
|
+
a = e, e = e.replace(/var\(--[a-z][\w-]*,\s*([^)]+)\)/gi, "$1");
|
|
1460
|
+
while (e !== a);
|
|
1461
|
+
return e = e.replace(/var\(--[a-z][\w-]*\)/gi, "none"), e = e.replace(/light-dark\([^,]+,\s*([^)]+)\)/gi, "$1"), e;
|
|
1462
|
+
}
|
|
1463
|
+
async function ma(e, a, t) {
|
|
1464
|
+
const r = (t == null ? void 0 : t.scale) ?? 2, n = ra(e, a, {
|
|
1458
1465
|
width: t == null ? void 0 : t.width,
|
|
1459
1466
|
height: t == null ? void 0 : t.height
|
|
1460
1467
|
}).match(/<svg[\s\S]*<\/svg>/);
|
|
@@ -1464,28 +1471,19 @@ async function oa(e, a, t) {
|
|
|
1464
1471
|
const c = s.match(/viewBox="0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)"/), x = (t == null ? void 0 : t.width) ?? (c ? parseFloat(c[1]) : 800), m = (t == null ? void 0 : t.height) ?? (c ? parseFloat(c[2]) : 600), k = Math.round(x * r), y = Math.round(m * r);
|
|
1465
1472
|
s = s.replace(/width="100%"/, `width="${k}"`).replace(/height="100%"/, `height="${y}"`), s.includes("xmlns=") || (s = s.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg"')), s = s.replace(/style="[^"]*position:\s*absolute[^"]*"/, "");
|
|
1466
1473
|
let o = e.root.background ?? "#ffffff";
|
|
1467
|
-
|
|
1468
|
-
const f = X[o.slice(1)];
|
|
1469
|
-
o = (f == null ? void 0 : f.fallback) ?? "#ffffff";
|
|
1470
|
-
}
|
|
1474
|
+
o.startsWith("$") && (o = u(o) ?? "#ffffff"), o = te(o);
|
|
1471
1475
|
const d = `<rect width="${x}" height="${m}" fill="${o}"/>`;
|
|
1472
|
-
s = s.replace(/>/, `>${d}`), s = s
|
|
1473
|
-
/var\(--elucim-[\w-]+,\s*(#[0-9a-fA-F]{3,8})\)/g,
|
|
1474
|
-
"$1"
|
|
1475
|
-
), s = s.replace(
|
|
1476
|
-
/var\(--elucim-[\w-]+\)/g,
|
|
1477
|
-
"none"
|
|
1478
|
-
);
|
|
1476
|
+
s = s.replace(/>/, `>${d}`), s = te(s);
|
|
1479
1477
|
const O = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(s)))}`;
|
|
1480
|
-
return typeof OffscreenCanvas < "u" ?
|
|
1478
|
+
return typeof OffscreenCanvas < "u" ? ia(O, k, y) : na(O, k, y);
|
|
1481
1479
|
}
|
|
1482
|
-
async function
|
|
1480
|
+
async function ia(e, a, t) {
|
|
1483
1481
|
const i = await (await fetch(e)).blob(), n = await createImageBitmap(i, { resizeWidth: a, resizeHeight: t }), s = new OffscreenCanvas(a, t);
|
|
1484
1482
|
s.getContext("2d").drawImage(n, 0, 0, a, t), n.close();
|
|
1485
1483
|
const m = await (await s.convertToBlob({ type: "image/png" })).arrayBuffer();
|
|
1486
1484
|
return new Uint8Array(m);
|
|
1487
1485
|
}
|
|
1488
|
-
function
|
|
1486
|
+
function na(e, a, t) {
|
|
1489
1487
|
return new Promise((r, i) => {
|
|
1490
1488
|
const n = new Image();
|
|
1491
1489
|
n.onload = () => {
|
|
@@ -1500,7 +1498,7 @@ function ia(e, a, t) {
|
|
|
1500
1498
|
}, n.onerror = () => i(new Error("Failed to load SVG data URI for PNG render")), n.src = e;
|
|
1501
1499
|
});
|
|
1502
1500
|
}
|
|
1503
|
-
class
|
|
1501
|
+
class sa {
|
|
1504
1502
|
constructor(a, t = 30, r = 900, i = 640) {
|
|
1505
1503
|
this.elements = [], this.cursor = 0, this.theme = a, this._fps = t, this._width = r, this._height = i;
|
|
1506
1504
|
}
|
|
@@ -1885,9 +1883,9 @@ class na {
|
|
|
1885
1883
|
return { elements: this.elements, durationInFrames: a };
|
|
1886
1884
|
}
|
|
1887
1885
|
}
|
|
1888
|
-
class
|
|
1886
|
+
class ca {
|
|
1889
1887
|
constructor(a, t, r) {
|
|
1890
|
-
this._slides = [], this._title = a, this._theme = t ??
|
|
1888
|
+
this._slides = [], this._title = a, this._theme = t ?? he, this._opts = {
|
|
1891
1889
|
width: 900,
|
|
1892
1890
|
height: 640,
|
|
1893
1891
|
fps: 30,
|
|
@@ -1905,7 +1903,7 @@ class sa {
|
|
|
1905
1903
|
/** Build the final ElucimDocument */
|
|
1906
1904
|
build() {
|
|
1907
1905
|
const a = this._slides.map((r) => {
|
|
1908
|
-
const i = new
|
|
1906
|
+
const i = new sa(
|
|
1909
1907
|
this._theme,
|
|
1910
1908
|
this._opts.fps,
|
|
1911
1909
|
this._opts.width,
|
|
@@ -1951,28 +1949,28 @@ class sa {
|
|
|
1951
1949
|
return JSON.stringify(this.build(), null, a ? 2 : void 0);
|
|
1952
1950
|
}
|
|
1953
1951
|
}
|
|
1954
|
-
function
|
|
1955
|
-
return new
|
|
1952
|
+
function ya(e, a, t) {
|
|
1953
|
+
return new ca(e, a, t);
|
|
1956
1954
|
}
|
|
1957
1955
|
export {
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1956
|
+
oa as DslRenderer,
|
|
1957
|
+
ca as PresentationBuilder,
|
|
1958
|
+
ce as SEMANTIC_TOKENS,
|
|
1959
|
+
sa as SlideBuilder,
|
|
1960
|
+
ga as TOKEN_NAMES,
|
|
1961
|
+
mt as compileExpression,
|
|
1962
|
+
yt as compileVectorExpression,
|
|
1963
|
+
he as darkTheme,
|
|
1964
|
+
Kt as lightTheme,
|
|
1965
|
+
ya as presentation,
|
|
1968
1966
|
v as renderElement,
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1967
|
+
ue as renderPlayer,
|
|
1968
|
+
Gt as renderPresentation,
|
|
1969
|
+
le as renderRoot,
|
|
1972
1970
|
H as renderScene,
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1971
|
+
Ht as renderSlide,
|
|
1972
|
+
ma as renderToPng,
|
|
1973
|
+
ra as renderToSvgString,
|
|
1976
1974
|
u as resolveColor,
|
|
1977
1975
|
g as resolveEasing,
|
|
1978
1976
|
re as validate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elucim/dsl",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "JSON/YAML DSL for declarative Elucim animations — define visualizations without writing React code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@elucim/core": "0.8.
|
|
48
|
+
"@elucim/core": "0.8.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@testing-library/jest-dom": "^6.9.1",
|