@elucim/dsl 0.8.0 → 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.
Files changed (2) hide show
  1. package/dist/index.js +229 -220
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { easeOutBounce as fe, easeOutElastic as ge, easeOutBack as oe, easeInBack as me, easeInOutExpo as ye, easeOutExpo as be, easeInExpo as xe, easeInOutSine as de, easeOutSine as ve, easeInSine as we, easeInOutQuart as ke, easeOutQuart as Ie, easeInQuart as Se, easeInOutCubic as $e, easeOutCubic as Oe, easeInCubic as Ce, easeInOutQuad as Ae, easeOutQuad as ze, easeInQuad as pe, linear as Ee, spring as Fe, cubicBezier as Re, Presentation as Pe, Scene as Me, Player as Te, Slide as Ne, Parallel as We, Stagger as De, Morph as _e, Transform as Ve, Write as Le, Draw as je, FadeOut as Be, FadeIn as qe, BarChart as Ue, LaTeX as Ge, Graph as He, Matrix as Ke, Text as j, VectorField as Qe, Vector as Xe, FunctionPlot as Je, Axes as Ye, Image as Ze, Polygon as et, Rect as tt, Arrow as at, Line as rt, Circle as it, BezierCurve as nt, Group as st, Sequence as ct } from "@elucim/core";
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 X, { forwardRef as lt, useRef as ut, useImperativeHandle as ht, useSyncExternalStore as ft } from "react";
4
- import { renderToStaticMarkup as gt } from "react-dom/server";
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,
@@ -236,11 +236,11 @@ class A extends Error {
236
236
  super(a), this.name = "ExpressionError", this.position = t;
237
237
  }
238
238
  }
239
- function ot(e) {
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 mt(e) {
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(
@@ -249,7 +249,7 @@ function mt(e) {
249
249
  );
250
250
  return (r) => E(t, r);
251
251
  }
252
- function te(e) {
252
+ function ae(e) {
253
253
  try {
254
254
  const a = K(e);
255
255
  return new Q(a).parse(), null;
@@ -258,26 +258,26 @@ function te(e) {
258
258
  }
259
259
  }
260
260
  const G = {
261
- linear: Ee,
262
- easeInQuad: pe,
263
- easeOutQuad: ze,
264
- easeInOutQuad: Ae,
265
- easeInCubic: Ce,
266
- easeOutCubic: Oe,
267
- easeInOutCubic: $e,
268
- easeInQuart: Se,
269
- easeOutQuart: Ie,
270
- easeInOutQuart: ke,
271
- easeInSine: we,
272
- easeOutSine: ve,
273
- easeInOutSine: de,
274
- easeInExpo: xe,
275
- easeOutExpo: be,
276
- easeInOutExpo: ye,
277
- easeInBack: me,
278
- easeOutBack: oe,
279
- easeOutElastic: ge,
280
- easeOutBounce: fe
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,23 +290,23 @@ function g(e) {
290
290
  return a;
291
291
  }
292
292
  if (e.type === "spring")
293
- return Fe({
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 Re(e.x1, e.y1, e.x2, e.y2);
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
  }
303
303
  const B = Object.keys(G);
304
- function ae(e) {
304
+ function re(e) {
305
305
  const a = [];
306
306
  if (!e || typeof e != "object")
307
307
  return a.push({ path: "", message: "Document must be an object", severity: "error" }), { valid: !1, errors: a };
308
308
  const t = e;
309
- return t.version !== "1.0" && a.push({ path: "version", message: `Expected version "1.0", got "${t.version}"`, severity: "error" }), !t.root || typeof t.root != "object" ? (a.push({ path: "root", message: 'Missing or invalid "root" node', severity: "error" }), { valid: a.filter((r) => r.severity === "error").length === 0, errors: a }) : (yt(t.root, "root", 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
  });
@@ -341,18 +341,18 @@ const Y = ["scene", "player", "presentation"], _ = ["card", "slide", "square"],
341
341
  "player",
342
342
  "scene"
343
343
  ], Z = ["none", "fade", "slide-left", "slide-up", "zoom"];
344
- function yt(e, a, t) {
344
+ function bt(e, a, t) {
345
345
  const r = e.type;
346
346
  if (!Y.includes(r)) {
347
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" ? re(e, a, r, t) : r === "presentation" && bt(e, a, t);
350
+ r === "scene" || r === "player" ? ie(e, a, r, t) : r === "presentation" && xt(e, a, t);
351
351
  }
352
- function re(e, a, t, r) {
353
- jt(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);
352
+ function ie(e, a, t, r) {
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 bt(e, a, t) {
355
+ function xt(e, a, t) {
356
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
358
  message: `Invalid transition "${e.transition}". Must be one of: ${Z.join(", ")}`,
@@ -362,16 +362,16 @@ function bt(e, a, t) {
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
- xt(r, `${a}.slides[${i}]`, t);
365
+ dt(r, `${a}.slides[${i}]`, t);
366
366
  });
367
367
  }
368
- function xt(e, a, t) {
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;
372
372
  }
373
373
  z(e, "title", a, t), z(e, "notes", a, t), z(e, "background", a, t), e.children !== void 0 && (Array.isArray(e.children) ? e.children.forEach((r, i) => {
374
- ie(r, `${a}.children[${i}]`, t);
374
+ ne(r, `${a}.children[${i}]`, t);
375
375
  }) : t.push({ path: `${a}.children`, message: "Slide children must be an array", severity: "error" }));
376
376
  }
377
377
  function p(e, a, t) {
@@ -380,17 +380,17 @@ function p(e, a, t) {
380
380
  return;
381
381
  }
382
382
  e.children.forEach((r, i) => {
383
- ie(r, `${a}.children[${i}]`, t);
383
+ ne(r, `${a}.children[${i}]`, t);
384
384
  });
385
385
  }
386
- function ie(e, a, t) {
386
+ function ne(e, a, t) {
387
387
  if (!e || typeof e != "object") {
388
388
  t.push({ path: a, message: "Element must be an object", severity: "error" });
389
389
  return;
390
390
  }
391
391
  const r = e.type;
392
392
  if (!r || !q.includes(r)) {
393
- const i = r ? ne(r, q) : "";
393
+ const i = r ? se(r, q) : "";
394
394
  t.push({
395
395
  path: `${a}.type`,
396
396
  message: `Unknown element type "${r}".${i} Valid types: ${q.join(", ")}`,
@@ -400,58 +400,58 @@ function ie(e, a, t) {
400
400
  }
401
401
  switch (r) {
402
402
  case "bezierCurve":
403
- dt(e, a, t);
403
+ vt(e, a, t);
404
404
  break;
405
405
  case "circle":
406
- vt(e, a, t);
406
+ wt(e, a, t);
407
407
  break;
408
408
  case "line":
409
- wt(e, a, t);
409
+ kt(e, a, t);
410
410
  break;
411
411
  case "arrow":
412
- kt(e, a, t);
412
+ It(e, a, t);
413
413
  break;
414
414
  case "rect":
415
- It(e, a, t);
415
+ St(e, a, t);
416
416
  break;
417
417
  case "polygon":
418
- St(e, a, t);
418
+ $t(e, a, t);
419
419
  break;
420
420
  case "text":
421
- $t(e, a, t);
421
+ Ot(e, a, t);
422
422
  break;
423
423
  case "image":
424
- _t(e, a, t);
424
+ Vt(e, a, t);
425
425
  break;
426
426
  case "axes":
427
- Ot(e, a, t);
427
+ Ct(e, a, t);
428
428
  break;
429
429
  case "functionPlot":
430
- Ct(e, a, t);
430
+ At(e, a, t);
431
431
  break;
432
432
  case "vector":
433
- At(e, a, t);
433
+ zt(e, a, t);
434
434
  break;
435
435
  case "vectorField":
436
- zt(e, a, t);
436
+ pt(e, a, t);
437
437
  break;
438
438
  case "matrix":
439
- pt(e, a, t);
439
+ Et(e, a, t);
440
440
  break;
441
441
  case "graph":
442
- Et(e, a, t);
442
+ Ft(e, a, t);
443
443
  break;
444
444
  case "latex":
445
- Ft(e, a, t);
445
+ Rt(e, a, t);
446
446
  break;
447
447
  case "barChart":
448
- Lt(e, a, t);
448
+ jt(e, a, t);
449
449
  break;
450
450
  case "sequence":
451
- Rt(e, a, t);
451
+ Pt(e, a, t);
452
452
  break;
453
453
  case "group":
454
- Vt(e, a, t);
454
+ Lt(e, a, t);
455
455
  break;
456
456
  case "parallel":
457
457
  p(e, a, t);
@@ -460,76 +460,76 @@ function ie(e, a, t) {
460
460
  case "fadeOut":
461
461
  case "draw":
462
462
  case "write":
463
- Pt(e, a, t);
463
+ Mt(e, a, t);
464
464
  break;
465
465
  case "transform":
466
- Mt(e, a, t);
466
+ Tt(e, a, t);
467
467
  break;
468
468
  case "morph":
469
- Tt(e, a, t);
469
+ Nt(e, a, t);
470
470
  break;
471
471
  case "stagger":
472
- Nt(e, a, t);
472
+ Wt(e, a, t);
473
473
  break;
474
474
  case "scene":
475
475
  case "player":
476
- re(e, a, r, t);
476
+ ie(e, a, r, 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, "cx", a, t), h(e, "cy", a, t), F(e, "r", a, t), w(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);
485
482
  }
486
483
  function wt(e, a, t) {
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);
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, "x", a, t), h(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), w(e, a, t);
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 $t(e, a, t) {
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 Ot(e, a, t) {
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 Ct(e, a, t) {
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 {
510
- const r = te(e.fn);
510
+ const r = ae(e.fn);
511
511
  r && t.push({ path: `${a}.fn`, message: `Invalid expression: ${r}`, severity: "error" });
512
512
  }
513
513
  S(e, "domain", a, t), V(e, a, t);
514
514
  }
515
- function At(e, a, t) {
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 zt(e, a, t) {
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 {
522
- const r = te(e.fn);
522
+ const r = ae(e.fn);
523
523
  r && t.push({ path: `${a}.fn`, message: `Invalid vector expression: ${r}`, severity: "error" });
524
524
  }
525
525
  S(e, "domain", a, t), S(e, "range", a, t), V(e, a, t);
526
526
  }
527
- function pt(e, a, t) {
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 Et(e, a, t) {
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, "from", a, t), Bt(e, "durationInFrames", a, t), p(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);
550
547
  }
551
548
  function Pt(e, a, t) {
552
- b(e, "duration", a, t), M(e, a, t), p(e, a, t);
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,46 +570,46 @@ function Mt(e, a, t) {
570
570
  }
571
571
  p(e, a, t);
572
572
  }
573
- function Tt(e, a, t) {
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 Nt(e, a, t) {
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), Wt(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), Dt(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
585
  const ee = ["none", "circle", "ellipse"];
586
- function Wt(e, a, t) {
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 Dt(e, a, t) {
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 _t(e, a, t) {
595
+ function Vt(e, a, t) {
596
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
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 Vt(e, a, t) {
602
+ function Lt(e, a, t) {
603
603
  p(e, a, t), w(e, a, t);
604
604
  }
605
- function Lt(e, a, t) {
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) {
609
609
  if (e.easing !== void 0) {
610
610
  if (typeof e.easing == "string") {
611
611
  if (!B.includes(e.easing)) {
612
- const r = ne(e.easing, B);
612
+ const r = se(e.easing, B);
613
613
  t.push({
614
614
  path: `${a}.easing`,
615
615
  message: `Unknown easing "${e.easing}".${r} Available: ${B.join(", ")}`,
@@ -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 jt(e, a, t, r) {
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 Bt(e, a, t, r) {
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
  }
@@ -662,13 +662,13 @@ function S(e, a, t, r) {
662
662
  const i = e[a];
663
663
  i !== void 0 && (!Array.isArray(i) || i.length !== 2 || typeof i[0] != "number" || typeof i[1] != "number") && r.push({ path: `${t}.${a}`, message: `"${a}" must be [number, number]`, severity: "error" });
664
664
  }
665
- function ne(e, a) {
665
+ function se(e, a) {
666
666
  const t = e.toLowerCase(), r = a.find((n) => n.toLowerCase() === t);
667
667
  if (r) return ` Did you mean '${r}'?`;
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 se = {
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 se = {
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
- }, fa = Object.keys(se);
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 = se[a];
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 qt = {
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] = qt[e];
700
+ const [r, i] = Ut[e];
701
701
  return { width: a ?? r, height: t ?? i };
702
702
  }
703
- function ce(e, a) {
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 le(e, a);
722
+ return ue(e, a);
723
723
  case "presentation":
724
- return Ut(e);
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
- Me,
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 le(e, a) {
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
- Te,
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 Ut(e) {
762
+ function Gt(e) {
763
763
  const { width: a, height: t } = L(e.preset, e.width, e.height);
764
764
  return /* @__PURE__ */ l(
765
- Pe,
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) => Gt(r, i))
774
+ children: e.slides.map((r, i) => Ht(r, i))
775
775
  }
776
776
  );
777
777
  }
778
- function Gt(e, a) {
778
+ function Ht(e, a) {
779
779
  var t;
780
- return /* @__PURE__ */ l(Ne, { 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);
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(ct, { from: e.from, durationInFrames: e.durationInFrames, name: e.name, children: e.children.map((s, c) => v(s, c)) }, a);
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
- st,
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
- nt,
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
- it,
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
- rt,
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
- at,
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
- tt,
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
- et,
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
- Ze,
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
- Ye,
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 = ot(e.fn);
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
- Je,
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
- Xe,
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 = mt(e.fn);
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
- Qe,
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
- Ke,
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
- He,
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
- Ge,
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
- Ue,
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(qe, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
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(Be, { duration: e.duration, totalFrames: e.totalFrames, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
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(je, { duration: e.duration, pathLength: e.pathLength, easing: g(e.easing), children: v(e.children[0], 0) }, a);
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(Le, { duration: e.duration, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
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
- Ve,
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
- _e,
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(De, { staggerDelay: e.staggerDelay, easing: g(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
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(We, { children: e.children.map((s, c) => v(s, c)) }, a);
1273
+ return /* @__PURE__ */ l(De, { children: e.children.map((s, c) => v(s, c)) }, a);
1274
1274
  case "scene":
1275
1275
  return /* @__PURE__ */ l(X.Fragment, { children: H(e) }, a);
1276
1276
  case "player":
1277
- return /* @__PURE__ */ l(X.Fragment, { children: le(e) }, a);
1277
+ return /* @__PURE__ */ l(X.Fragment, { children: ue(e) }, a);
1278
1278
  default:
1279
1279
  return null;
1280
1280
  }
1281
1281
  }
1282
- const ue = {
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
- }, Ht = {
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 Kt(e) {
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 he(e) {
1320
+ function fe(e) {
1321
1321
  return {
1322
1322
  "--elucim-foreground": e.text,
1323
1323
  "--elucim-background": e.background,
@@ -1334,51 +1334,51 @@ function he(e) {
1334
1334
  "--elucim-error": e.error
1335
1335
  };
1336
1336
  }
1337
- const Qt = he(ue), Xt = he(Ht);
1338
- function Jt(e) {
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 Yt() {
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 Zt() {
1347
+ function ea() {
1348
1348
  return !0;
1349
1349
  }
1350
- function ea() {
1351
- return ft(Jt, Yt, Zt);
1350
+ function ta() {
1351
+ return gt(Yt, Zt, ea);
1352
1352
  }
1353
- const ga = lt(function({ dsl: a, className: t, style: r, theme: i, colorScheme: n, poster: s, onError: c }, x) {
1354
- const o = ut(null), k = ea();
1355
- ht(x, () => ({
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
- return ((f = o.current) == null ? void 0 : f.getSvgElement()) ?? null;
1358
+ return ((f = m.current) == null ? void 0 : f.getSvgElement()) ?? null;
1359
1359
  },
1360
1360
  seekToFrame: (f) => {
1361
1361
  var C;
1362
- return (C = o.current) == null ? void 0 : C.seekToFrame(f);
1362
+ return (C = m.current) == null ? void 0 : C.seekToFrame(f);
1363
1363
  },
1364
1364
  getTotalFrames: () => {
1365
1365
  var f;
1366
- return ((f = o.current) == null ? void 0 : f.getTotalFrames()) ?? 0;
1366
+ return ((f = m.current) == null ? void 0 : f.getTotalFrames()) ?? 0;
1367
1367
  },
1368
1368
  play: () => {
1369
1369
  var f;
1370
- return (f = o.current) == null ? void 0 : f.play();
1370
+ return (f = m.current) == null ? void 0 : f.play();
1371
1371
  },
1372
1372
  pause: () => {
1373
1373
  var f;
1374
- return (f = o.current) == null ? void 0 : f.pause();
1374
+ return (f = m.current) == null ? void 0 : f.pause();
1375
1375
  },
1376
1376
  isPlaying: () => {
1377
1377
  var f;
1378
- return ((f = o.current) == null ? void 0 : f.isPlaying()) ?? !1;
1378
+ return ((f = m.current) == null ? void 0 : f.isPlaying()) ?? !1;
1379
1379
  }
1380
1380
  }));
1381
- const y = ae(a);
1381
+ const y = re(a);
1382
1382
  if (!y.valid) {
1383
1383
  const f = y.errors.filter((I) => I.severity === "error").map((I) => ({ path: I.path, message: I.message }));
1384
1384
  c == null || c(f);
@@ -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 m = Kt(i);
1423
+ const o = Qt(i);
1424
1424
  let d = {};
1425
- n && (d = (n === "auto" ? k : n === "dark") ? Qt : Xt);
1426
- const $ = s !== void 0 ? ta(s, a) : void 0, O = n ? n === "auto" ? k ? "dark" : "light" : n : void 0;
1427
- return /* @__PURE__ */ l("div", { className: t, style: { ...d, ...m, ...r }, "data-testid": "dsl-root", children: ce(a.root, {
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
- playerRef: o,
1429
+ playerRef: m,
1430
1430
  colorScheme: O
1431
1431
  }) });
1432
1432
  });
1433
- function ta(e, a) {
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,8 +1438,8 @@ function ta(e, a) {
1438
1438
  }
1439
1439
  return { frame: e };
1440
1440
  }
1441
- function aa(e, a, t) {
1442
- const r = ae(e);
1441
+ function ra(e, a, t) {
1442
+ const r = re(e);
1443
1443
  if (!r.valid) {
1444
1444
  const s = r.errors.filter((c) => c.severity === "error");
1445
1445
  throw new Error(
@@ -1450,31 +1450,40 @@ ${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 = ce(i, { frame: a });
1454
- return gt(n);
1453
+ const n = le(i, { frame: a });
1454
+ return ot(n);
1455
1455
  }
1456
- async function oa(e, a, t) {
1457
- const r = (t == null ? void 0 : t.scale) ?? 2, n = aa(e, a, {
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>/);
1461
1468
  if (!n)
1462
1469
  throw new Error("renderToSvgString did not produce an SVG element");
1463
1470
  let s = n[0];
1464
- const c = s.match(/viewBox="0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)"/), x = (t == null ? void 0 : t.width) ?? (c ? parseFloat(c[1]) : 800), o = (t == null ? void 0 : t.height) ?? (c ? parseFloat(c[2]) : 600), k = Math.round(x * r), y = Math.round(o * r);
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
- const m = e.root.background ?? "#ffffff", d = `<rect width="${x}" height="${o}" fill="${m}"/>`;
1467
- s = s.replace(/>/, `>${d}`);
1473
+ let o = e.root.background ?? "#ffffff";
1474
+ o.startsWith("$") && (o = u(o) ?? "#ffffff"), o = te(o);
1475
+ const d = `<rect width="${x}" height="${m}" fill="${o}"/>`;
1476
+ s = s.replace(/>/, `>${d}`), s = te(s);
1468
1477
  const O = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(s)))}`;
1469
- return typeof OffscreenCanvas < "u" ? ra(O, k, y) : ia(O, k, y);
1478
+ return typeof OffscreenCanvas < "u" ? ia(O, k, y) : na(O, k, y);
1470
1479
  }
1471
- async function ra(e, a, t) {
1480
+ async function ia(e, a, t) {
1472
1481
  const i = await (await fetch(e)).blob(), n = await createImageBitmap(i, { resizeWidth: a, resizeHeight: t }), s = new OffscreenCanvas(a, t);
1473
1482
  s.getContext("2d").drawImage(n, 0, 0, a, t), n.close();
1474
- const o = await (await s.convertToBlob({ type: "image/png" })).arrayBuffer();
1475
- return new Uint8Array(o);
1483
+ const m = await (await s.convertToBlob({ type: "image/png" })).arrayBuffer();
1484
+ return new Uint8Array(m);
1476
1485
  }
1477
- function ia(e, a, t) {
1486
+ function na(e, a, t) {
1478
1487
  return new Promise((r, i) => {
1479
1488
  const n = new Image();
1480
1489
  n.onload = () => {
@@ -1482,14 +1491,14 @@ function ia(e, a, t) {
1482
1491
  s.width = a, s.height = t, s.getContext("2d").drawImage(n, 0, 0, a, t), s.toBlob(
1483
1492
  (x) => {
1484
1493
  if (!x) return i(new Error("Failed to render PNG from SVG"));
1485
- x.arrayBuffer().then((o) => r(new Uint8Array(o)));
1494
+ x.arrayBuffer().then((m) => r(new Uint8Array(m)));
1486
1495
  },
1487
1496
  "image/png"
1488
1497
  );
1489
1498
  }, n.onerror = () => i(new Error("Failed to load SVG data URI for PNG render")), n.src = e;
1490
1499
  });
1491
1500
  }
1492
- class na {
1501
+ class sa {
1493
1502
  constructor(a, t = 30, r = 900, i = 640) {
1494
1503
  this.elements = [], this.cursor = 0, this.theme = a, this._fps = t, this._width = r, this._height = i;
1495
1504
  }
@@ -1710,12 +1719,12 @@ class na {
1710
1719
  boxRow(a, t) {
1711
1720
  const r = (t == null ? void 0 : t.boxWidth) ?? 80, i = (t == null ? void 0 : t.boxHeight) ?? 40, n = (t == null ? void 0 : t.gap) ?? 12, s = (t == null ? void 0 : t.y) ?? 250, c = a.length * r + (a.length - 1) * n, x = (this._width - c) / 2;
1712
1721
  t == null || t.fadeIn;
1713
- const o = a.map((y, m) => {
1714
- const d = x + m * (r + n);
1722
+ const m = a.map((y, o) => {
1723
+ const d = x + o * (r + n);
1715
1724
  return { x: d, y: s, w: r, h: i, cx: d + r / 2, cy: s + i / 2 };
1716
- }), k = a.map((y, m) => {
1725
+ }), k = a.map((y, o) => {
1717
1726
  var f, C;
1718
- const d = o[m], $ = ((f = t == null ? void 0 : t.colors) == null ? void 0 : f[m]) ?? this.theme.boxFill, O = ((C = t == null ? void 0 : t.strokeColors) == null ? void 0 : C[m]) ?? this.theme.boxStroke;
1727
+ const d = m[o], $ = ((f = t == null ? void 0 : t.colors) == null ? void 0 : f[o]) ?? this.theme.boxFill, O = ((C = t == null ? void 0 : t.strokeColors) == null ? void 0 : C[o]) ?? this.theme.boxStroke;
1719
1728
  return {
1720
1729
  type: "group",
1721
1730
  children: [
@@ -1747,7 +1756,7 @@ class na {
1747
1756
  type: "stagger",
1748
1757
  staggerDelay: 3,
1749
1758
  children: k
1750
- }, 8 + a.length * 2), o;
1759
+ }, 8 + a.length * 2), m;
1751
1760
  }
1752
1761
  /**
1753
1762
  * Render a vertical stack of labeled boxes.
@@ -1756,18 +1765,18 @@ class na {
1756
1765
  const r = (t == null ? void 0 : t.boxWidth) ?? 160, i = (t == null ? void 0 : t.boxHeight) ?? 36, n = (t == null ? void 0 : t.gap) ?? 8, s = (t == null ? void 0 : t.y) ?? 150, c = (t == null ? void 0 : t.x) ?? this.cx;
1757
1766
  t == null || t.fadeIn;
1758
1767
  const x = a.map((k, y) => {
1759
- const m = s + y * (i + n);
1760
- return { x: c - r / 2, y: m, w: r, h: i, cx: c, cy: m + i / 2 };
1761
- }), o = a.map((k, y) => {
1768
+ const o = s + y * (i + n);
1769
+ return { x: c - r / 2, y: o, w: r, h: i, cx: c, cy: o + i / 2 };
1770
+ }), m = a.map((k, y) => {
1762
1771
  var $, O;
1763
- const m = x[y], d = (($ = t == null ? void 0 : t.colors) == null ? void 0 : $[y]) ?? this.theme.boxFill;
1772
+ const o = x[y], d = (($ = t == null ? void 0 : t.colors) == null ? void 0 : $[y]) ?? this.theme.boxFill;
1764
1773
  return {
1765
1774
  type: "group",
1766
1775
  children: [
1767
1776
  {
1768
1777
  type: "rect",
1769
- x: m.x,
1770
- y: m.y,
1778
+ x: o.x,
1779
+ y: o.y,
1771
1780
  width: r,
1772
1781
  height: i,
1773
1782
  fill: d,
@@ -1777,8 +1786,8 @@ class na {
1777
1786
  },
1778
1787
  {
1779
1788
  type: "text",
1780
- x: m.cx,
1781
- y: m.cy + 5,
1789
+ x: o.cx,
1790
+ y: o.cy + 5,
1782
1791
  content: k,
1783
1792
  fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
1784
1793
  fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
@@ -1790,7 +1799,7 @@ class na {
1790
1799
  return this.addAtCursor({
1791
1800
  type: "stagger",
1792
1801
  staggerDelay: 3,
1793
- children: o
1802
+ children: m
1794
1803
  }, 8 + a.length * 2), x;
1795
1804
  }
1796
1805
  /**
@@ -1874,9 +1883,9 @@ class na {
1874
1883
  return { elements: this.elements, durationInFrames: a };
1875
1884
  }
1876
1885
  }
1877
- class sa {
1886
+ class ca {
1878
1887
  constructor(a, t, r) {
1879
- this._slides = [], this._title = a, this._theme = t ?? ue, this._opts = {
1888
+ this._slides = [], this._title = a, this._theme = t ?? he, this._opts = {
1880
1889
  width: 900,
1881
1890
  height: 640,
1882
1891
  fps: 30,
@@ -1894,7 +1903,7 @@ class sa {
1894
1903
  /** Build the final ElucimDocument */
1895
1904
  build() {
1896
1905
  const a = this._slides.map((r) => {
1897
- const i = new na(
1906
+ const i = new sa(
1898
1907
  this._theme,
1899
1908
  this._opts.fps,
1900
1909
  this._opts.width,
@@ -1940,30 +1949,30 @@ class sa {
1940
1949
  return JSON.stringify(this.build(), null, a ? 2 : void 0);
1941
1950
  }
1942
1951
  }
1943
- function ma(e, a, t) {
1944
- return new sa(e, a, t);
1952
+ function ya(e, a, t) {
1953
+ return new ca(e, a, t);
1945
1954
  }
1946
1955
  export {
1947
- ga as DslRenderer,
1948
- sa as PresentationBuilder,
1949
- se as SEMANTIC_TOKENS,
1950
- na as SlideBuilder,
1951
- fa as TOKEN_NAMES,
1952
- ot as compileExpression,
1953
- mt as compileVectorExpression,
1954
- ue as darkTheme,
1955
- Ht as lightTheme,
1956
- ma as presentation,
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,
1957
1966
  v as renderElement,
1958
- le as renderPlayer,
1959
- Ut as renderPresentation,
1960
- ce as renderRoot,
1967
+ ue as renderPlayer,
1968
+ Gt as renderPresentation,
1969
+ le as renderRoot,
1961
1970
  H as renderScene,
1962
- Gt as renderSlide,
1963
- oa as renderToPng,
1964
- aa as renderToSvgString,
1971
+ Ht as renderSlide,
1972
+ ma as renderToPng,
1973
+ ra as renderToSvgString,
1965
1974
  u as resolveColor,
1966
1975
  g as resolveEasing,
1967
- ae as validate,
1968
- te as validateExpression
1976
+ re as validate,
1977
+ ae as validateExpression
1969
1978
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elucim/dsl",
3
- "version": "0.8.0",
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.0"
48
+ "@elucim/core": "0.8.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@testing-library/jest-dom": "^6.9.1",