@elucim/dsl 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -931,6 +931,14 @@ export declare interface StaggerNode {
931
931
  children: ElementNode[];
932
932
  }
933
933
 
934
+ /**
935
+ * Strip all CSS functions that are invalid in standalone SVGs loaded via Image:
936
+ * - var(--x, fallback) → fallback (iterative for nested vars)
937
+ * - var(--x) with no fallback → 'none'
938
+ * - light-dark(light, dark) → dark value (elucim defaults to dark theme)
939
+ */
940
+ export declare function stripCssFunctions(s: string): string;
941
+
934
942
  export declare interface TextNode {
935
943
  type: 'text';
936
944
  id?: string;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
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
- import { jsx as l, jsxs as R } from "react/jsx-runtime";
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";
1
+ import { easeOutBounce as oe, easeOutElastic as ge, 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 Pe, cubicBezier as Re, Presentation as Te, Scene as Me, 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
+ import { jsx as l, jsxs as P } from "react/jsx-runtime";
3
+ import X, { forwardRef as ut, useRef as ft, useImperativeHandle as ht, useSyncExternalStore as ot } from "react";
4
+ import { renderToStaticMarkup as gt } from "react-dom/server";
5
5
  const U = {
6
6
  sin: Math.sin,
7
7
  cos: Math.cos,
@@ -276,10 +276,10 @@ const G = {
276
276
  easeInOutExpo: be,
277
277
  easeInBack: ye,
278
278
  easeOutBack: me,
279
- easeOutElastic: oe,
280
- easeOutBounce: ge
279
+ easeOutElastic: ge,
280
+ easeOutBounce: oe
281
281
  };
282
- function g(e) {
282
+ function o(e) {
283
283
  if (e !== void 0) {
284
284
  if (typeof e == "string") {
285
285
  const a = G[e];
@@ -290,13 +290,13 @@ function g(e) {
290
290
  return a;
291
291
  }
292
292
  if (e.type === "spring")
293
- return Re({
293
+ return Pe({
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 Pe(e.x1, e.y1, e.x2, e.y2);
299
+ return Re(e.x1, e.y1, e.x2, e.y2);
300
300
  throw new Error(`Unknown easing type: ${e.type}`);
301
301
  }
302
302
  }
@@ -442,13 +442,13 @@ function ne(e, a, t) {
442
442
  Ft(e, a, t);
443
443
  break;
444
444
  case "latex":
445
- Rt(e, a, t);
445
+ Pt(e, a, t);
446
446
  break;
447
447
  case "barChart":
448
448
  jt(e, a, t);
449
449
  break;
450
450
  case "sequence":
451
- Pt(e, a, t);
451
+ Rt(e, a, t);
452
452
  break;
453
453
  case "group":
454
454
  Lt(e, a, t);
@@ -460,10 +460,10 @@ function ne(e, a, t) {
460
460
  case "fadeOut":
461
461
  case "draw":
462
462
  case "write":
463
- Mt(e, a, t);
463
+ Tt(e, a, t);
464
464
  break;
465
465
  case "transform":
466
- Tt(e, a, t);
466
+ Mt(e, a, t);
467
467
  break;
468
468
  case "morph":
469
469
  Nt(e, a, t);
@@ -478,19 +478,19 @@ function ne(e, a, t) {
478
478
  }
479
479
  }
480
480
  function vt(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);
481
+ f(e, "x1", a, t), f(e, "y1", a, t), f(e, "cx1", a, t), f(e, "cy1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), e.cx2 !== void 0 && R(e, "cx2", a, t), e.cy2 !== void 0 && R(e, "cy2", a, t), w(e, a, t);
482
482
  }
483
483
  function wt(e, a, t) {
484
- h(e, "cx", a, t), h(e, "cy", a, t), F(e, "r", a, t), w(e, a, t);
484
+ f(e, "cx", a, t), f(e, "cy", a, t), F(e, "r", a, t), w(e, a, t);
485
485
  }
486
486
  function kt(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);
487
+ f(e, "x1", a, t), f(e, "y1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), w(e, a, t);
488
488
  }
489
489
  function It(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);
490
+ f(e, "x1", a, t), f(e, "y1", a, t), f(e, "x2", a, t), f(e, "y2", a, t), w(e, a, t);
491
491
  }
492
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);
493
+ f(e, "x", a, t), f(e, "y", a, t), F(e, "width", a, t), F(e, "height", a, t), w(e, a, t);
494
494
  }
495
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) => {
@@ -498,7 +498,7 @@ function $t(e, a, t) {
498
498
  }) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }), w(e, a, t);
499
499
  }
500
500
  function Ot(e, a, t) {
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);
501
+ f(e, "x", a, t), f(e, "y", a, t), typeof e.content != "string" && t.push({ path: `${a}.content`, message: 'Text requires a "content" string', severity: "error" }), w(e, a, t);
502
502
  }
503
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);
@@ -535,24 +535,24 @@ function Ft(e, a, t) {
535
535
  else {
536
536
  const r = /* @__PURE__ */ new Set();
537
537
  e.nodes.forEach((i, n) => {
538
- typeof i.id != "string" ? t.push({ path: `${a}.nodes[${n}].id`, message: 'Graph node requires a string "id"', severity: "error" }) : (r.has(i.id) && t.push({ path: `${a}.nodes[${n}].id`, message: `Duplicate node id "${i.id}"`, severity: "error" }), r.add(i.id)), h(i, "x", `${a}.nodes[${n}]`, t), h(i, "y", `${a}.nodes[${n}]`, t);
538
+ typeof i.id != "string" ? t.push({ path: `${a}.nodes[${n}].id`, message: 'Graph node requires a string "id"', severity: "error" }) : (r.has(i.id) && t.push({ path: `${a}.nodes[${n}].id`, message: `Duplicate node id "${i.id}"`, severity: "error" }), r.add(i.id)), f(i, "x", `${a}.nodes[${n}]`, t), f(i, "y", `${a}.nodes[${n}]`, t);
539
539
  }), Array.isArray(e.edges) && e.edges.forEach((i, n) => {
540
540
  (typeof i.from != "string" || !r.has(i.from)) && t.push({ path: `${a}.edges[${n}].from`, message: `Edge "from" references unknown node "${i.from}"`, severity: "error" }), (typeof i.to != "string" || !r.has(i.to)) && t.push({ path: `${a}.edges[${n}].to`, message: `Edge "to" references unknown node "${i.to}"`, severity: "error" });
541
541
  });
542
542
  }
543
543
  w(e, a, t);
544
544
  }
545
- function Rt(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 Pt(e, a, t) {
549
- h(e, "from", a, t), qt(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" }), f(e, "x", a, t), f(e, "y", a, t), w(e, a, t);
550
547
  }
551
- function Mt(e, a, t) {
552
- b(e, "duration", a, t), M(e, a, t), p(e, a, t);
548
+ function Rt(e, a, t) {
549
+ f(e, "from", a, t), qt(e, "durationInFrames", a, t), p(e, a, t);
553
550
  }
554
551
  function Tt(e, a, t) {
555
- if (b(e, "duration", a, t), M(e, a, t), e.translate !== void 0) {
552
+ b(e, "duration", a, t), T(e, a, t), p(e, a, t);
553
+ }
554
+ function Mt(e, a, t) {
555
+ if (b(e, "duration", a, t), T(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" });
558
558
  }
@@ -571,29 +571,29 @@ function Tt(e, a, t) {
571
571
  p(e, a, t);
572
572
  }
573
573
  function Nt(e, a, t) {
574
- b(e, "duration", a, t), M(e, a, t), z(e, "fromColor", a, t), z(e, "toColor", a, t), p(e, a, t);
574
+ b(e, "duration", a, t), T(e, a, t), z(e, "fromColor", a, t), z(e, "toColor", a, t), p(e, a, t);
575
575
  }
576
576
  function Wt(e, a, t) {
577
- b(e, "staggerDelay", a, t), M(e, a, t), p(e, a, t);
577
+ b(e, "staggerDelay", a, t), T(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), Dt(e, a, t);
580
+ b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), T(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), _t(e, a, t);
583
+ b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), T(e, a, t), _t(e, a, t);
584
584
  }
585
585
  const ee = ["none", "circle", "ellipse"];
586
586
  function Dt(e, a, t) {
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) {
587
+ if (R(e, "rotation", a, t), S(e, "rotationOrigin", a, t), S(e, "translate", a, t), R(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
592
  function _t(e, a, t) {
593
- P(e, "rotation", a, t), S(e, "rotationOrigin", a, t), S(e, "translate", a, t), P(e, "zIndex", a, t);
593
+ R(e, "rotation", a, t), S(e, "rotationOrigin", a, t), S(e, "translate", a, t), R(e, "zIndex", a, t);
594
594
  }
595
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({
596
+ typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }), f(e, "x", a, t), f(e, "y", a, t), 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"
@@ -603,9 +603,9 @@ function Lt(e, a, t) {
603
603
  p(e, a, t), w(e, a, t);
604
604
  }
605
605
  function jt(e, a, t) {
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);
606
+ f(e, "x", a, t), f(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
- function M(e, a, t) {
608
+ function T(e, a, t) {
609
609
  if (e.easing !== void 0) {
610
610
  if (typeof e.easing == "string") {
611
611
  if (!B.includes(e.easing)) {
@@ -632,7 +632,7 @@ function M(e, a, t) {
632
632
  t.push({ path: `${a}.easing`, message: 'Easing must be a string name or { type: "spring"|"cubicBezier", ... }', severity: "error" });
633
633
  }
634
634
  }
635
- function h(e, a, t, r) {
635
+ function f(e, a, t, r) {
636
636
  typeof e[a] != "number" && r.push({ path: `${t}.${a}`, message: `Required numeric field "${a}" is missing or not a number`, severity: "error" });
637
637
  }
638
638
  function F(e, a, t, r) {
@@ -652,7 +652,7 @@ function qt(e, a, t, r) {
652
652
  function z(e, a, t, r) {
653
653
  e[a] !== void 0 && typeof e[a] != "string" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a string`, severity: "error" });
654
654
  }
655
- function P(e, a, t, r) {
655
+ function R(e, a, t, r) {
656
656
  e[a] !== void 0 && typeof e[a] != "number" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a number`, severity: "error" });
657
657
  }
658
658
  function W(e, a, t, r) {
@@ -683,7 +683,7 @@ const ce = {
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
- }, ga = Object.keys(ce);
686
+ }, oa = Object.keys(ce);
687
687
  function u(e) {
688
688
  if (e === void 0) return;
689
689
  if (!e.startsWith("$")) return e;
@@ -727,7 +727,7 @@ function le(e, a) {
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
- Te,
730
+ Me,
731
731
  {
732
732
  width: r,
733
733
  height: i,
@@ -762,7 +762,7 @@ function ue(e, a) {
762
762
  function Gt(e) {
763
763
  const { width: a, height: t } = L(e.preset, e.width, e.height);
764
764
  return /* @__PURE__ */ l(
765
- Me,
765
+ Te,
766
766
  {
767
767
  width: a,
768
768
  height: t,
@@ -790,7 +790,7 @@ function v(e, a) {
790
790
  {
791
791
  fadeIn: e.fadeIn,
792
792
  fadeOut: e.fadeOut,
793
- easing: g(e.easing),
793
+ easing: o(e.easing),
794
794
  rotation: e.rotation,
795
795
  rotationOrigin: e.rotationOrigin,
796
796
  scale: e.scale,
@@ -820,7 +820,7 @@ function v(e, a) {
820
820
  fadeIn: e.fadeIn,
821
821
  fadeOut: e.fadeOut,
822
822
  draw: e.draw,
823
- easing: g(e.easing),
823
+ easing: o(e.easing),
824
824
  rotation: e.rotation,
825
825
  rotationOrigin: e.rotationOrigin,
826
826
  scale: e.scale,
@@ -843,7 +843,7 @@ function v(e, a) {
843
843
  fadeIn: e.fadeIn,
844
844
  fadeOut: e.fadeOut,
845
845
  draw: e.draw,
846
- easing: g(e.easing),
846
+ easing: o(e.easing),
847
847
  rotation: e.rotation,
848
848
  rotationOrigin: e.rotationOrigin,
849
849
  scale: e.scale,
@@ -867,7 +867,7 @@ function v(e, a) {
867
867
  fadeIn: e.fadeIn,
868
868
  fadeOut: e.fadeOut,
869
869
  draw: e.draw,
870
- easing: g(e.easing),
870
+ easing: o(e.easing),
871
871
  rotation: e.rotation,
872
872
  rotationOrigin: e.rotationOrigin,
873
873
  scale: e.scale,
@@ -892,7 +892,7 @@ function v(e, a) {
892
892
  fadeIn: e.fadeIn,
893
893
  fadeOut: e.fadeOut,
894
894
  draw: e.draw,
895
- easing: g(e.easing),
895
+ easing: o(e.easing),
896
896
  rotation: e.rotation,
897
897
  rotationOrigin: e.rotationOrigin,
898
898
  scale: e.scale,
@@ -919,7 +919,7 @@ function v(e, a) {
919
919
  fadeIn: e.fadeIn,
920
920
  fadeOut: e.fadeOut,
921
921
  draw: e.draw,
922
- easing: g(e.easing),
922
+ easing: o(e.easing),
923
923
  rotation: e.rotation,
924
924
  rotationOrigin: e.rotationOrigin,
925
925
  scale: e.scale,
@@ -941,7 +941,7 @@ function v(e, a) {
941
941
  fadeIn: e.fadeIn,
942
942
  fadeOut: e.fadeOut,
943
943
  draw: e.draw,
944
- easing: g(e.easing),
944
+ easing: o(e.easing),
945
945
  rotation: e.rotation,
946
946
  rotationOrigin: e.rotationOrigin,
947
947
  scale: e.scale,
@@ -965,7 +965,7 @@ function v(e, a) {
965
965
  opacity: e.opacity,
966
966
  fadeIn: e.fadeIn,
967
967
  fadeOut: e.fadeOut,
968
- easing: g(e.easing),
968
+ easing: o(e.easing),
969
969
  rotation: e.rotation,
970
970
  rotationOrigin: e.rotationOrigin,
971
971
  scale: e.scale,
@@ -990,7 +990,7 @@ function v(e, a) {
990
990
  opacity: e.opacity,
991
991
  fadeIn: e.fadeIn,
992
992
  fadeOut: e.fadeOut,
993
- easing: g(e.easing),
993
+ easing: o(e.easing),
994
994
  rotation: e.rotation,
995
995
  rotationOrigin: e.rotationOrigin,
996
996
  scale: e.scale,
@@ -1018,7 +1018,7 @@ function v(e, a) {
1018
1018
  fadeIn: e.fadeIn,
1019
1019
  fadeOut: e.fadeOut,
1020
1020
  draw: e.draw,
1021
- easing: g(e.easing),
1021
+ easing: o(e.easing),
1022
1022
  rotation: e.rotation,
1023
1023
  rotationOrigin: e.rotationOrigin,
1024
1024
  translate: e.translate,
@@ -1056,7 +1056,7 @@ function v(e, a) {
1056
1056
  strokeWidth: e.strokeWidth,
1057
1057
  samples: e.samples,
1058
1058
  draw: e.draw,
1059
- easing: g(e.easing),
1059
+ easing: o(e.easing),
1060
1060
  opacity: e.opacity,
1061
1061
  rotation: e.rotation,
1062
1062
  rotationOrigin: e.rotationOrigin,
@@ -1084,7 +1084,7 @@ function v(e, a) {
1084
1084
  fadeIn: e.fadeIn,
1085
1085
  fadeOut: e.fadeOut,
1086
1086
  draw: e.draw,
1087
- easing: g(e.easing),
1087
+ easing: o(e.easing),
1088
1088
  rotation: e.rotation,
1089
1089
  rotationOrigin: e.rotationOrigin,
1090
1090
  translate: e.translate,
@@ -1127,7 +1127,7 @@ function v(e, a) {
1127
1127
  maxLength: e.maxLength,
1128
1128
  fadeIn: e.fadeIn,
1129
1129
  fadeOut: e.fadeOut,
1130
- easing: g(e.easing),
1130
+ easing: o(e.easing),
1131
1131
  rotation: e.rotation,
1132
1132
  rotationOrigin: e.rotationOrigin,
1133
1133
  translate: e.translate,
@@ -1149,7 +1149,7 @@ function v(e, a) {
1149
1149
  fontSize: e.fontSize,
1150
1150
  fadeIn: e.fadeIn,
1151
1151
  fadeOut: e.fadeOut,
1152
- easing: g(e.easing),
1152
+ easing: o(e.easing),
1153
1153
  rotation: e.rotation,
1154
1154
  rotationOrigin: e.rotationOrigin,
1155
1155
  scale: e.scale,
@@ -1172,7 +1172,7 @@ function v(e, a) {
1172
1172
  labelFontSize: e.labelFontSize,
1173
1173
  fadeIn: e.fadeIn,
1174
1174
  fadeOut: e.fadeOut,
1175
- easing: g(e.easing),
1175
+ easing: o(e.easing),
1176
1176
  rotation: e.rotation,
1177
1177
  rotationOrigin: e.rotationOrigin,
1178
1178
  scale: e.scale,
@@ -1193,7 +1193,7 @@ function v(e, a) {
1193
1193
  align: e.align,
1194
1194
  fadeIn: e.fadeIn,
1195
1195
  fadeOut: e.fadeOut,
1196
- easing: g(e.easing),
1196
+ easing: o(e.easing),
1197
1197
  rotation: e.rotation,
1198
1198
  rotationOrigin: e.rotationOrigin,
1199
1199
  scale: e.scale,
@@ -1220,7 +1220,7 @@ function v(e, a) {
1220
1220
  valueFormat: e.valueFormat,
1221
1221
  fadeIn: e.fadeIn,
1222
1222
  fadeOut: e.fadeOut,
1223
- easing: g(e.easing),
1223
+ easing: o(e.easing),
1224
1224
  rotation: e.rotation,
1225
1225
  rotationOrigin: e.rotationOrigin,
1226
1226
  scale: e.scale,
@@ -1230,19 +1230,19 @@ function v(e, a) {
1230
1230
  a
1231
1231
  );
1232
1232
  case "fadeIn":
1233
- return /* @__PURE__ */ l(Ue, { 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: o(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
1234
1234
  case "fadeOut":
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);
1235
+ return /* @__PURE__ */ l(qe, { duration: e.duration, totalFrames: e.totalFrames, easing: o(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
1236
1236
  case "draw":
1237
- return /* @__PURE__ */ l(Be, { 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: o(e.easing), children: v(e.children[0], 0) }, a);
1238
1238
  case "write":
1239
- return /* @__PURE__ */ l(je, { 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: o(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
- easing: g(e.easing),
1245
+ easing: o(e.easing),
1246
1246
  translate: e.translate,
1247
1247
  scale: e.scale,
1248
1248
  rotate: e.rotate,
@@ -1256,7 +1256,7 @@ function v(e, a) {
1256
1256
  Ve,
1257
1257
  {
1258
1258
  duration: e.duration,
1259
- easing: g(e.easing),
1259
+ easing: o(e.easing),
1260
1260
  fromColor: u(e.fromColor),
1261
1261
  toColor: u(e.toColor),
1262
1262
  fromOpacity: e.fromOpacity,
@@ -1268,7 +1268,7 @@ function v(e, a) {
1268
1268
  a
1269
1269
  );
1270
1270
  case "stagger":
1271
- return /* @__PURE__ */ l(_e, { 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: o(e.easing), children: e.children.map((s, c) => v(s, c)) }, a);
1272
1272
  case "parallel":
1273
1273
  return /* @__PURE__ */ l(De, { children: e.children.map((s, c) => v(s, c)) }, a);
1274
1274
  case "scene":
@@ -1279,7 +1279,7 @@ function v(e, a) {
1279
1279
  return null;
1280
1280
  }
1281
1281
  }
1282
- const he = {
1282
+ const fe = {
1283
1283
  background: "#0a0a1e",
1284
1284
  title: "#e0e7ff",
1285
1285
  subtitle: "#94a3b8",
@@ -1317,7 +1317,7 @@ function Qt(e) {
1317
1317
  r !== void 0 && (a[`--elucim-${t}`] = r);
1318
1318
  return a;
1319
1319
  }
1320
- function fe(e) {
1320
+ function he(e) {
1321
1321
  return {
1322
1322
  "--elucim-foreground": e.text,
1323
1323
  "--elucim-background": e.background,
@@ -1334,7 +1334,7 @@ function fe(e) {
1334
1334
  "--elucim-error": e.error
1335
1335
  };
1336
1336
  }
1337
- const Xt = fe(he), Jt = fe(Kt);
1337
+ const Xt = he(fe), Jt = he(Kt);
1338
1338
  function Yt(e) {
1339
1339
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {
1340
1340
  };
@@ -1348,71 +1348,71 @@ function ea() {
1348
1348
  return !0;
1349
1349
  }
1350
1350
  function ta() {
1351
- return gt(Yt, Zt, ea);
1351
+ return ot(Yt, Zt, ea);
1352
1352
  }
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, () => ({
1353
+ const ga = ut(function({ dsl: a, className: t, style: r, theme: i, colorScheme: n, poster: s, onError: c }, x) {
1354
+ const m = ft(null), k = ta();
1355
+ ht(x, () => ({
1356
1356
  getSvgElement: () => {
1357
- var f;
1358
- return ((f = m.current) == null ? void 0 : f.getSvgElement()) ?? null;
1357
+ var h;
1358
+ return ((h = m.current) == null ? void 0 : h.getSvgElement()) ?? null;
1359
1359
  },
1360
- seekToFrame: (f) => {
1360
+ seekToFrame: (h) => {
1361
1361
  var C;
1362
- return (C = m.current) == null ? void 0 : C.seekToFrame(f);
1362
+ return (C = m.current) == null ? void 0 : C.seekToFrame(h);
1363
1363
  },
1364
1364
  getTotalFrames: () => {
1365
- var f;
1366
- return ((f = m.current) == null ? void 0 : f.getTotalFrames()) ?? 0;
1365
+ var h;
1366
+ return ((h = m.current) == null ? void 0 : h.getTotalFrames()) ?? 0;
1367
1367
  },
1368
1368
  play: () => {
1369
- var f;
1370
- return (f = m.current) == null ? void 0 : f.play();
1369
+ var h;
1370
+ return (h = m.current) == null ? void 0 : h.play();
1371
1371
  },
1372
1372
  pause: () => {
1373
- var f;
1374
- return (f = m.current) == null ? void 0 : f.pause();
1373
+ var h;
1374
+ return (h = m.current) == null ? void 0 : h.pause();
1375
1375
  },
1376
1376
  isPlaying: () => {
1377
- var f;
1378
- return ((f = m.current) == null ? void 0 : f.isPlaying()) ?? !1;
1377
+ var h;
1378
+ return ((h = m.current) == null ? void 0 : h.isPlaying()) ?? !1;
1379
1379
  }
1380
1380
  }));
1381
1381
  const y = re(a);
1382
1382
  if (!y.valid) {
1383
- const f = y.errors.filter((I) => I.severity === "error").map((I) => ({ path: I.path, message: I.message }));
1384
- c == null || c(f);
1383
+ const h = y.errors.filter((I) => I.severity === "error").map((I) => ({ path: I.path, message: I.message }));
1384
+ c == null || c(h);
1385
1385
  const C = /* @__PURE__ */ new Map();
1386
- for (const I of f) {
1387
- const T = I.path.split("."), N = T.length > 1 ? T.slice(0, -1).join(".") : I.path, D = C.get(N) ?? [];
1386
+ for (const I of h) {
1387
+ const M = I.path.split("."), N = M.length > 1 ? M.slice(0, -1).join(".") : I.path, D = C.get(N) ?? [];
1388
1388
  D.push(I), C.set(N, D);
1389
1389
  }
1390
- return /* @__PURE__ */ R(
1390
+ return /* @__PURE__ */ P(
1391
1391
  "div",
1392
1392
  {
1393
1393
  className: t,
1394
1394
  style: { color: "#ff6b6b", fontFamily: "monospace", padding: 16, fontSize: 13, ...r },
1395
1395
  "data-testid": "dsl-error",
1396
1396
  children: [
1397
- /* @__PURE__ */ R("strong", { children: [
1397
+ /* @__PURE__ */ P("strong", { children: [
1398
1398
  "Elucim DSL Validation Errors (",
1399
- f.length,
1399
+ h.length,
1400
1400
  "):"
1401
1401
  ] }),
1402
- [...C.entries()].map(([I, T]) => /* @__PURE__ */ R("details", { open: !0, style: { marginTop: 8 }, children: [
1403
- /* @__PURE__ */ R("summary", { style: { cursor: "pointer", fontWeight: "bold" }, children: [
1402
+ [...C.entries()].map(([I, M]) => /* @__PURE__ */ P("details", { open: !0, style: { marginTop: 8 }, children: [
1403
+ /* @__PURE__ */ P("summary", { style: { cursor: "pointer", fontWeight: "bold" }, children: [
1404
1404
  I,
1405
1405
  " (",
1406
- T.length,
1406
+ M.length,
1407
1407
  ")"
1408
1408
  ] }),
1409
- /* @__PURE__ */ l("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children: T.map((N, D) => /* @__PURE__ */ R("li", { children: [
1409
+ /* @__PURE__ */ l("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children: M.map((N, D) => /* @__PURE__ */ P("li", { children: [
1410
1410
  /* @__PURE__ */ l("code", { style: { color: "#ffa07a" }, children: N.path }),
1411
1411
  ": ",
1412
1412
  N.message
1413
1413
  ] }, D)) })
1414
1414
  ] }, I)),
1415
- /* @__PURE__ */ R("details", { style: { marginTop: 12 }, children: [
1415
+ /* @__PURE__ */ P("details", { style: { marginTop: 12 }, children: [
1416
1416
  /* @__PURE__ */ l("summary", { style: { cursor: "pointer", opacity: 0.7 }, children: "Raw JSON" }),
1417
1417
  /* @__PURE__ */ l("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) })
1418
1418
  ] })
@@ -1420,11 +1420,11 @@ const oa = ut(function({ dsl: a, className: t, style: r, theme: i, colorScheme:
1420
1420
  }
1421
1421
  );
1422
1422
  }
1423
- const o = Qt(i);
1423
+ const g = Qt(i);
1424
1424
  let d = {};
1425
1425
  n && (d = (n === "auto" ? k : n === "dark") ? Xt : Jt);
1426
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, {
1427
+ return /* @__PURE__ */ l("div", { className: t, style: { ...d, ...g, ...r }, "data-testid": "dsl-root", children: le(a.root, {
1428
1428
  frame: $ == null ? void 0 : $.frame,
1429
1429
  playerRef: m,
1430
1430
  colorScheme: O
@@ -1451,7 +1451,7 @@ ${s.map((c) => ` ${c.path}: ${c.message}`).join(`
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
1453
  const n = le(i, { frame: a });
1454
- return ot(n);
1454
+ return gt(n);
1455
1455
  }
1456
1456
  function te(e) {
1457
1457
  let a;
@@ -1470,12 +1470,16 @@ async function ma(e, a, t) {
1470
1470
  let s = n[0];
1471
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);
1472
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[^"]*"/, "");
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}"/>`;
1473
+ let g = e.root.background ?? "#ffffff";
1474
+ g.startsWith("$") && (g = u(g) ?? "#ffffff"), g = te(g);
1475
+ const d = `<rect width="${x}" height="${m}" fill="${g}"/>`;
1476
1476
  s = s.replace(/>/, `>${d}`), s = te(s);
1477
1477
  const O = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(s)))}`;
1478
- return typeof OffscreenCanvas < "u" ? ia(O, k, y) : na(O, k, y);
1478
+ if (typeof Image < "u" && typeof document < "u")
1479
+ return na(O, k, y);
1480
+ if (typeof OffscreenCanvas < "u")
1481
+ return ia(O, k, y);
1482
+ throw new Error("renderToPng requires Image+document (browser) or OffscreenCanvas (worker)");
1479
1483
  }
1480
1484
  async function ia(e, a, t) {
1481
1485
  const i = await (await fetch(e)).blob(), n = await createImageBitmap(i, { resizeWidth: a, resizeHeight: t }), s = new OffscreenCanvas(a, t);
@@ -1719,12 +1723,12 @@ class sa {
1719
1723
  boxRow(a, t) {
1720
1724
  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;
1721
1725
  t == null || t.fadeIn;
1722
- const m = a.map((y, o) => {
1723
- const d = x + o * (r + n);
1726
+ const m = a.map((y, g) => {
1727
+ const d = x + g * (r + n);
1724
1728
  return { x: d, y: s, w: r, h: i, cx: d + r / 2, cy: s + i / 2 };
1725
- }), k = a.map((y, o) => {
1726
- var f, C;
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;
1729
+ }), k = a.map((y, g) => {
1730
+ var h, C;
1731
+ const d = m[g], $ = ((h = t == null ? void 0 : t.colors) == null ? void 0 : h[g]) ?? this.theme.boxFill, O = ((C = t == null ? void 0 : t.strokeColors) == null ? void 0 : C[g]) ?? this.theme.boxStroke;
1728
1732
  return {
1729
1733
  type: "group",
1730
1734
  children: [
@@ -1765,18 +1769,18 @@ class sa {
1765
1769
  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;
1766
1770
  t == null || t.fadeIn;
1767
1771
  const x = 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 };
1772
+ const g = s + y * (i + n);
1773
+ return { x: c - r / 2, y: g, w: r, h: i, cx: c, cy: g + i / 2 };
1770
1774
  }), m = a.map((k, y) => {
1771
1775
  var $, O;
1772
- const o = x[y], d = (($ = t == null ? void 0 : t.colors) == null ? void 0 : $[y]) ?? this.theme.boxFill;
1776
+ const g = x[y], d = (($ = t == null ? void 0 : t.colors) == null ? void 0 : $[y]) ?? this.theme.boxFill;
1773
1777
  return {
1774
1778
  type: "group",
1775
1779
  children: [
1776
1780
  {
1777
1781
  type: "rect",
1778
- x: o.x,
1779
- y: o.y,
1782
+ x: g.x,
1783
+ y: g.y,
1780
1784
  width: r,
1781
1785
  height: i,
1782
1786
  fill: d,
@@ -1786,8 +1790,8 @@ class sa {
1786
1790
  },
1787
1791
  {
1788
1792
  type: "text",
1789
- x: o.cx,
1790
- y: o.cy + 5,
1793
+ x: g.cx,
1794
+ y: g.cy + 5,
1791
1795
  content: k,
1792
1796
  fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
1793
1797
  fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
@@ -1885,7 +1889,7 @@ class sa {
1885
1889
  }
1886
1890
  class ca {
1887
1891
  constructor(a, t, r) {
1888
- this._slides = [], this._title = a, this._theme = t ?? he, this._opts = {
1892
+ this._slides = [], this._title = a, this._theme = t ?? fe, this._opts = {
1889
1893
  width: 900,
1890
1894
  height: 640,
1891
1895
  fps: 30,
@@ -1953,14 +1957,14 @@ function ya(e, a, t) {
1953
1957
  return new ca(e, a, t);
1954
1958
  }
1955
1959
  export {
1956
- oa as DslRenderer,
1960
+ ga as DslRenderer,
1957
1961
  ca as PresentationBuilder,
1958
1962
  ce as SEMANTIC_TOKENS,
1959
1963
  sa as SlideBuilder,
1960
- ga as TOKEN_NAMES,
1964
+ oa as TOKEN_NAMES,
1961
1965
  mt as compileExpression,
1962
1966
  yt as compileVectorExpression,
1963
- he as darkTheme,
1967
+ fe as darkTheme,
1964
1968
  Kt as lightTheme,
1965
1969
  ya as presentation,
1966
1970
  v as renderElement,
@@ -1972,7 +1976,8 @@ export {
1972
1976
  ma as renderToPng,
1973
1977
  ra as renderToSvgString,
1974
1978
  u as resolveColor,
1975
- g as resolveEasing,
1979
+ o as resolveEasing,
1980
+ te as stripCssFunctions,
1976
1981
  re as validate,
1977
1982
  ae as validateExpression
1978
1983
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elucim/dsl",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
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.2"
48
+ "@elucim/core": "0.8.3"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@testing-library/jest-dom": "^6.9.1",