@elucim/dsl 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +76 -65
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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";
|
|
2
2
|
import { jsx as l, jsxs as R } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import J, { forwardRef as lt, useRef as ut, useImperativeHandle as ht, useSyncExternalStore as ft } from "react";
|
|
4
4
|
import { renderToStaticMarkup as gt } from "react-dom/server";
|
|
5
5
|
const U = {
|
|
6
6
|
sin: Math.sin,
|
|
@@ -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
|
+
}, Y = {
|
|
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(Y, t) ? { kind: "number", value: Y[t] } : { kind: "variable", name: t };
|
|
179
179
|
}
|
|
180
180
|
if (a.type === "LPAREN") {
|
|
181
181
|
this.advance();
|
|
@@ -249,7 +249,7 @@ function mt(e) {
|
|
|
249
249
|
);
|
|
250
250
|
return (r) => E(t, r);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function ae(e) {
|
|
253
253
|
try {
|
|
254
254
|
const a = K(e);
|
|
255
255
|
return new Q(a).parse(), null;
|
|
@@ -301,7 +301,7 @@ function g(e) {
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
const B = Object.keys(G);
|
|
304
|
-
function
|
|
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 };
|
|
@@ -311,7 +311,7 @@ function ae(e) {
|
|
|
311
311
|
errors: a
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const Z = ["scene", "player", "presentation"], _ = ["card", "slide", "square"], q = [
|
|
315
315
|
"sequence",
|
|
316
316
|
"group",
|
|
317
317
|
"bezierCurve",
|
|
@@ -340,22 +340,22 @@ const Y = ["scene", "player", "presentation"], _ = ["card", "slide", "square"],
|
|
|
340
340
|
"parallel",
|
|
341
341
|
"player",
|
|
342
342
|
"scene"
|
|
343
|
-
],
|
|
343
|
+
], ee = ["none", "fade", "slide-left", "slide-up", "zoom"];
|
|
344
344
|
function yt(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 (!Z.includes(r)) {
|
|
347
|
+
t.push({ path: `${a}.type`, message: `Root type must be one of: ${Z.join(", ")}. Got "${r}"`, severity: "error" });
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
350
|
-
r === "scene" || r === "player" ?
|
|
350
|
+
r === "scene" || r === "player" ? ie(e, a, r, t) : r === "presentation" && bt(e, a, t);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function ie(e, a, t, r) {
|
|
353
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);
|
|
354
354
|
}
|
|
355
355
|
function bt(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 && (
|
|
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 && (ee.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: ${ee.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" });
|
|
@@ -371,7 +371,7 @@ function xt(e, a, t) {
|
|
|
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
|
-
|
|
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
|
-
|
|
383
|
+
ne(r, `${a}.children[${i}]`, t);
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
-
function
|
|
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 ?
|
|
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(", ")}`,
|
|
@@ -473,7 +473,7 @@ function ie(e, a, t) {
|
|
|
473
473
|
break;
|
|
474
474
|
case "scene":
|
|
475
475
|
case "player":
|
|
476
|
-
|
|
476
|
+
ie(e, a, r, t);
|
|
477
477
|
break;
|
|
478
478
|
}
|
|
479
479
|
}
|
|
@@ -507,7 +507,7 @@ function Ct(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 =
|
|
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);
|
|
@@ -519,7 +519,7 @@ function zt(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 =
|
|
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);
|
|
@@ -582,7 +582,7 @@ function w(e, a, t) {
|
|
|
582
582
|
function V(e, a, t) {
|
|
583
583
|
b(e, "fadeIn", a, t), b(e, "fadeOut", a, t), b(e, "draw", a, t), M(e, a, t), Dt(e, a, t);
|
|
584
584
|
}
|
|
585
|
-
const
|
|
585
|
+
const te = ["none", "circle", "ellipse"];
|
|
586
586
|
function Wt(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;
|
|
@@ -593,9 +593,9 @@ function Dt(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
595
|
function _t(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 && (
|
|
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 && (te.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: ${te.join(", ")}`,
|
|
599
599
|
severity: "error"
|
|
600
600
|
})), w(e, a, t);
|
|
601
601
|
}
|
|
@@ -609,7 +609,7 @@ 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 =
|
|
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(", ")}`,
|
|
@@ -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
|
|
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
|
|
671
|
+
const X = {
|
|
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,11 +683,11 @@ 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(
|
|
686
|
+
}, fa = Object.keys(X);
|
|
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 = X[a];
|
|
691
691
|
return t ? `var(${t.cssVar}, ${t.fallback})` : `var(--elucim-${a})`;
|
|
692
692
|
}
|
|
693
693
|
const qt = {
|
|
@@ -1272,9 +1272,9 @@ function v(e, a) {
|
|
|
1272
1272
|
case "parallel":
|
|
1273
1273
|
return /* @__PURE__ */ l(We, { children: e.children.map((s, c) => v(s, c)) }, a);
|
|
1274
1274
|
case "scene":
|
|
1275
|
-
return /* @__PURE__ */ l(
|
|
1275
|
+
return /* @__PURE__ */ l(J.Fragment, { children: H(e) }, a);
|
|
1276
1276
|
case "player":
|
|
1277
|
-
return /* @__PURE__ */ l(
|
|
1277
|
+
return /* @__PURE__ */ l(J.Fragment, { children: le(e) }, a);
|
|
1278
1278
|
default:
|
|
1279
1279
|
return null;
|
|
1280
1280
|
}
|
|
@@ -1351,34 +1351,34 @@ function ea() {
|
|
|
1351
1351
|
return ft(Jt, Yt, Zt);
|
|
1352
1352
|
}
|
|
1353
1353
|
const ga = lt(function({ dsl: a, className: t, style: r, theme: i, colorScheme: n, poster: s, onError: c }, x) {
|
|
1354
|
-
const
|
|
1354
|
+
const m = ut(null), k = ea();
|
|
1355
1355
|
ht(x, () => ({
|
|
1356
1356
|
getSvgElement: () => {
|
|
1357
1357
|
var f;
|
|
1358
|
-
return ((f =
|
|
1358
|
+
return ((f = m.current) == null ? void 0 : f.getSvgElement()) ?? null;
|
|
1359
1359
|
},
|
|
1360
1360
|
seekToFrame: (f) => {
|
|
1361
1361
|
var C;
|
|
1362
|
-
return (C =
|
|
1362
|
+
return (C = m.current) == null ? void 0 : C.seekToFrame(f);
|
|
1363
1363
|
},
|
|
1364
1364
|
getTotalFrames: () => {
|
|
1365
1365
|
var f;
|
|
1366
|
-
return ((f =
|
|
1366
|
+
return ((f = m.current) == null ? void 0 : f.getTotalFrames()) ?? 0;
|
|
1367
1367
|
},
|
|
1368
1368
|
play: () => {
|
|
1369
1369
|
var f;
|
|
1370
|
-
return (f =
|
|
1370
|
+
return (f = m.current) == null ? void 0 : f.play();
|
|
1371
1371
|
},
|
|
1372
1372
|
pause: () => {
|
|
1373
1373
|
var f;
|
|
1374
|
-
return (f =
|
|
1374
|
+
return (f = m.current) == null ? void 0 : f.pause();
|
|
1375
1375
|
},
|
|
1376
1376
|
isPlaying: () => {
|
|
1377
1377
|
var f;
|
|
1378
|
-
return ((f =
|
|
1378
|
+
return ((f = m.current) == null ? void 0 : f.isPlaying()) ?? !1;
|
|
1379
1379
|
}
|
|
1380
1380
|
}));
|
|
1381
|
-
const y =
|
|
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,13 +1420,13 @@ const ga = lt(function({ dsl: a, className: t, style: r, theme: i, colorScheme:
|
|
|
1420
1420
|
}
|
|
1421
1421
|
);
|
|
1422
1422
|
}
|
|
1423
|
-
const
|
|
1423
|
+
const o = Kt(i);
|
|
1424
1424
|
let d = {};
|
|
1425
1425
|
n && (d = (n === "auto" ? k : n === "dark") ? Qt : Xt);
|
|
1426
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, ...
|
|
1427
|
+
return /* @__PURE__ */ l("div", { className: t, style: { ...d, ...o, ...r }, "data-testid": "dsl-root", children: ce(a.root, {
|
|
1428
1428
|
frame: $ == null ? void 0 : $.frame,
|
|
1429
|
-
playerRef:
|
|
1429
|
+
playerRef: m,
|
|
1430
1430
|
colorScheme: O
|
|
1431
1431
|
}) });
|
|
1432
1432
|
});
|
|
@@ -1439,7 +1439,7 @@ function ta(e, a) {
|
|
|
1439
1439
|
return { frame: e };
|
|
1440
1440
|
}
|
|
1441
1441
|
function aa(e, a, t) {
|
|
1442
|
-
const r =
|
|
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(
|
|
@@ -1461,18 +1461,29 @@ async function oa(e, a, t) {
|
|
|
1461
1461
|
if (!n)
|
|
1462
1462
|
throw new Error("renderToSvgString did not produce an SVG element");
|
|
1463
1463
|
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),
|
|
1464
|
+
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
1465
|
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
|
-
|
|
1467
|
-
|
|
1466
|
+
let o = e.root.background ?? "#ffffff";
|
|
1467
|
+
if (o.startsWith("$")) {
|
|
1468
|
+
const f = X[o.slice(1)];
|
|
1469
|
+
o = (f == null ? void 0 : f.fallback) ?? "#ffffff";
|
|
1470
|
+
}
|
|
1471
|
+
const d = `<rect width="${x}" height="${m}" fill="${o}"/>`;
|
|
1472
|
+
s = s.replace(/>/, `>${d}`), s = s.replace(
|
|
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
|
+
);
|
|
1468
1479
|
const O = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(s)))}`;
|
|
1469
1480
|
return typeof OffscreenCanvas < "u" ? ra(O, k, y) : ia(O, k, y);
|
|
1470
1481
|
}
|
|
1471
1482
|
async function ra(e, a, t) {
|
|
1472
1483
|
const i = await (await fetch(e)).blob(), n = await createImageBitmap(i, { resizeWidth: a, resizeHeight: t }), s = new OffscreenCanvas(a, t);
|
|
1473
1484
|
s.getContext("2d").drawImage(n, 0, 0, a, t), n.close();
|
|
1474
|
-
const
|
|
1475
|
-
return new Uint8Array(
|
|
1485
|
+
const m = await (await s.convertToBlob({ type: "image/png" })).arrayBuffer();
|
|
1486
|
+
return new Uint8Array(m);
|
|
1476
1487
|
}
|
|
1477
1488
|
function ia(e, a, t) {
|
|
1478
1489
|
return new Promise((r, i) => {
|
|
@@ -1482,7 +1493,7 @@ function ia(e, a, t) {
|
|
|
1482
1493
|
s.width = a, s.height = t, s.getContext("2d").drawImage(n, 0, 0, a, t), s.toBlob(
|
|
1483
1494
|
(x) => {
|
|
1484
1495
|
if (!x) return i(new Error("Failed to render PNG from SVG"));
|
|
1485
|
-
x.arrayBuffer().then((
|
|
1496
|
+
x.arrayBuffer().then((m) => r(new Uint8Array(m)));
|
|
1486
1497
|
},
|
|
1487
1498
|
"image/png"
|
|
1488
1499
|
);
|
|
@@ -1710,12 +1721,12 @@ class na {
|
|
|
1710
1721
|
boxRow(a, t) {
|
|
1711
1722
|
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
1723
|
t == null || t.fadeIn;
|
|
1713
|
-
const
|
|
1714
|
-
const d = x +
|
|
1724
|
+
const m = a.map((y, o) => {
|
|
1725
|
+
const d = x + o * (r + n);
|
|
1715
1726
|
return { x: d, y: s, w: r, h: i, cx: d + r / 2, cy: s + i / 2 };
|
|
1716
|
-
}), k = a.map((y,
|
|
1727
|
+
}), k = a.map((y, o) => {
|
|
1717
1728
|
var f, C;
|
|
1718
|
-
const d = o
|
|
1729
|
+
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
1730
|
return {
|
|
1720
1731
|
type: "group",
|
|
1721
1732
|
children: [
|
|
@@ -1747,7 +1758,7 @@ class na {
|
|
|
1747
1758
|
type: "stagger",
|
|
1748
1759
|
staggerDelay: 3,
|
|
1749
1760
|
children: k
|
|
1750
|
-
}, 8 + a.length * 2),
|
|
1761
|
+
}, 8 + a.length * 2), m;
|
|
1751
1762
|
}
|
|
1752
1763
|
/**
|
|
1753
1764
|
* Render a vertical stack of labeled boxes.
|
|
@@ -1756,18 +1767,18 @@ class na {
|
|
|
1756
1767
|
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
1768
|
t == null || t.fadeIn;
|
|
1758
1769
|
const x = a.map((k, y) => {
|
|
1759
|
-
const
|
|
1760
|
-
return { x: c - r / 2, y:
|
|
1761
|
-
}),
|
|
1770
|
+
const o = s + y * (i + n);
|
|
1771
|
+
return { x: c - r / 2, y: o, w: r, h: i, cx: c, cy: o + i / 2 };
|
|
1772
|
+
}), m = a.map((k, y) => {
|
|
1762
1773
|
var $, O;
|
|
1763
|
-
const
|
|
1774
|
+
const o = x[y], d = (($ = t == null ? void 0 : t.colors) == null ? void 0 : $[y]) ?? this.theme.boxFill;
|
|
1764
1775
|
return {
|
|
1765
1776
|
type: "group",
|
|
1766
1777
|
children: [
|
|
1767
1778
|
{
|
|
1768
1779
|
type: "rect",
|
|
1769
|
-
x:
|
|
1770
|
-
y:
|
|
1780
|
+
x: o.x,
|
|
1781
|
+
y: o.y,
|
|
1771
1782
|
width: r,
|
|
1772
1783
|
height: i,
|
|
1773
1784
|
fill: d,
|
|
@@ -1777,8 +1788,8 @@ class na {
|
|
|
1777
1788
|
},
|
|
1778
1789
|
{
|
|
1779
1790
|
type: "text",
|
|
1780
|
-
x:
|
|
1781
|
-
y:
|
|
1791
|
+
x: o.cx,
|
|
1792
|
+
y: o.cy + 5,
|
|
1782
1793
|
content: k,
|
|
1783
1794
|
fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
|
|
1784
1795
|
fill: (t == null ? void 0 : t.textColor) ?? this.theme.text,
|
|
@@ -1790,7 +1801,7 @@ class na {
|
|
|
1790
1801
|
return this.addAtCursor({
|
|
1791
1802
|
type: "stagger",
|
|
1792
1803
|
staggerDelay: 3,
|
|
1793
|
-
children:
|
|
1804
|
+
children: m
|
|
1794
1805
|
}, 8 + a.length * 2), x;
|
|
1795
1806
|
}
|
|
1796
1807
|
/**
|
|
@@ -1946,7 +1957,7 @@ function ma(e, a, t) {
|
|
|
1946
1957
|
export {
|
|
1947
1958
|
ga as DslRenderer,
|
|
1948
1959
|
sa as PresentationBuilder,
|
|
1949
|
-
|
|
1960
|
+
X as SEMANTIC_TOKENS,
|
|
1950
1961
|
na as SlideBuilder,
|
|
1951
1962
|
fa as TOKEN_NAMES,
|
|
1952
1963
|
ot as compileExpression,
|
|
@@ -1964,6 +1975,6 @@ export {
|
|
|
1964
1975
|
aa as renderToSvgString,
|
|
1965
1976
|
u as resolveColor,
|
|
1966
1977
|
g as resolveEasing,
|
|
1967
|
-
|
|
1968
|
-
|
|
1978
|
+
re as validate,
|
|
1979
|
+
ae as validateExpression
|
|
1969
1980
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elucim/dsl",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
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.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@testing-library/jest-dom": "^6.9.1",
|