@elucim/dsl 0.11.0 → 0.12.0
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 +91 -48
- package/dist/index.js +393 -399
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { easeOutBounce as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { easeOutBounce as xe, easeOutElastic as de, easeOutBack as we, easeInBack as ve, easeInOutExpo as ke, easeOutExpo as Ie, easeInExpo as Se, easeInOutSine as $e, easeOutSine as Ce, easeInSine as Oe, easeInOutQuart as Ae, easeOutQuart as pe, easeInQuart as ze, easeInOutCubic as Ee, easeOutCubic as Re, easeInCubic as Te, easeInOutQuad as Fe, easeOutQuad as Pe, easeInQuad as Me, linear as _e, spring as De, cubicBezier as Ne, Presentation as We, resolveColor as u, Scene as Le, Player as Ve, Slide as Be, Parallel as je, Stagger as qe, Morph as Ue, Transform as He, Write as Ge, Draw as Ke, FadeOut as Qe, FadeIn as Xe, BarChart as Je, LaTeX as Ye, Graph as Ze, Matrix as et, Text as U, VectorField as tt, Vector as at, FunctionPlot as rt, Axes as it, Image as nt, Polygon as st, Rect as ct, Arrow as lt, Line as ut, Circle as ht, BezierCurve as ft, Group as gt, Sequence as ot, themeToVars as mt, DARK_THEME_VARS as yt, LIGHT_THEME_VARS as bt } from "@elucim/core";
|
|
2
|
+
import { DARK_THEME as $a, DARK_THEME_VARS as Ca, LIGHT_THEME as Oa, LIGHT_THEME_VARS as Aa, SEMANTIC_TOKENS as pa, TOKEN_NAMES as za, resolveColor as Ea, themeToVars as Ra } from "@elucim/core";
|
|
3
|
+
import { jsx as l, jsxs as E } from "react/jsx-runtime";
|
|
4
|
+
import K, { forwardRef as xt, useRef as dt, useImperativeHandle as wt, useSyncExternalStore as vt } from "react";
|
|
5
|
+
import { renderToStaticMarkup as kt } from "react-dom/server";
|
|
6
|
+
const Q = {
|
|
6
7
|
sin: Math.sin,
|
|
7
8
|
cos: Math.cos,
|
|
8
9
|
tan: Math.tan,
|
|
@@ -22,12 +23,12 @@ const K = {
|
|
|
22
23
|
max: (...e) => Math.max(...e),
|
|
23
24
|
sign: Math.sign,
|
|
24
25
|
pow: Math.pow
|
|
25
|
-
},
|
|
26
|
+
}, ae = {
|
|
26
27
|
PI: Math.PI,
|
|
27
28
|
E: Math.E,
|
|
28
29
|
TAU: Math.PI * 2
|
|
29
30
|
};
|
|
30
|
-
function
|
|
31
|
+
function Y(e) {
|
|
31
32
|
const a = [];
|
|
32
33
|
let t = 0;
|
|
33
34
|
for (; t < e.length; ) {
|
|
@@ -85,12 +86,12 @@ function J(e) {
|
|
|
85
86
|
a.push({ type: "COMMA", value: ",", pos: i });
|
|
86
87
|
break;
|
|
87
88
|
default:
|
|
88
|
-
throw new
|
|
89
|
+
throw new A(`Unexpected character '${r}'`, i);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
return a.push({ type: "EOF", value: "", pos: t }), a;
|
|
92
93
|
}
|
|
93
|
-
class
|
|
94
|
+
class Z {
|
|
94
95
|
constructor(a) {
|
|
95
96
|
this.pos = 0, this.tokens = a;
|
|
96
97
|
}
|
|
@@ -104,7 +105,7 @@ class Y {
|
|
|
104
105
|
expect(a) {
|
|
105
106
|
const t = this.peek();
|
|
106
107
|
if (t.type !== a)
|
|
107
|
-
throw new
|
|
108
|
+
throw new A(
|
|
108
109
|
`Expected ${a} but got ${t.type} ('${t.value}')`,
|
|
109
110
|
t.pos
|
|
110
111
|
);
|
|
@@ -115,7 +116,7 @@ class Y {
|
|
|
115
116
|
const a = this.parseExpression();
|
|
116
117
|
if (this.peek().type !== "EOF") {
|
|
117
118
|
const t = this.peek();
|
|
118
|
-
throw new
|
|
119
|
+
throw new A(
|
|
119
120
|
`Unexpected token '${t.value}' after expression`,
|
|
120
121
|
t.pos
|
|
121
122
|
);
|
|
@@ -168,14 +169,14 @@ class Y {
|
|
|
168
169
|
if (this.peek().type !== "RPAREN")
|
|
169
170
|
for (r.push(this.parseExpression()); this.peek().type === "COMMA"; )
|
|
170
171
|
this.advance(), r.push(this.parseExpression());
|
|
171
|
-
if (this.expect("RPAREN"), !Object.prototype.hasOwnProperty.call(
|
|
172
|
-
throw new
|
|
173
|
-
`Unknown function '${t}'. Available: ${Object.keys(
|
|
172
|
+
if (this.expect("RPAREN"), !Object.prototype.hasOwnProperty.call(Q, t))
|
|
173
|
+
throw new A(
|
|
174
|
+
`Unknown function '${t}'. Available: ${Object.keys(Q).join(", ")}`,
|
|
174
175
|
a.pos
|
|
175
176
|
);
|
|
176
177
|
return { kind: "call", name: t, args: r };
|
|
177
178
|
}
|
|
178
|
-
return Object.prototype.hasOwnProperty.call(
|
|
179
|
+
return Object.prototype.hasOwnProperty.call(ae, t) ? { kind: "number", value: ae[t] } : { kind: "variable", name: t };
|
|
179
180
|
}
|
|
180
181
|
if (a.type === "LPAREN") {
|
|
181
182
|
this.advance();
|
|
@@ -190,24 +191,24 @@ class Y {
|
|
|
190
191
|
this.advance(), t.push(this.parseExpression());
|
|
191
192
|
return this.expect("RBRACKET"), { kind: "array", elements: t };
|
|
192
193
|
}
|
|
193
|
-
throw new
|
|
194
|
+
throw new A(
|
|
194
195
|
`Unexpected token '${a.value}'`,
|
|
195
196
|
a.pos
|
|
196
197
|
);
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
+
function R(e, a) {
|
|
200
201
|
switch (e.kind) {
|
|
201
202
|
case "number":
|
|
202
203
|
return e.value;
|
|
203
204
|
case "variable":
|
|
204
205
|
if (Object.prototype.hasOwnProperty.call(a, e.name)) return a[e.name];
|
|
205
|
-
throw new
|
|
206
|
+
throw new A(`Unknown variable '${e.name}'`, 0);
|
|
206
207
|
case "unary":
|
|
207
|
-
const t =
|
|
208
|
+
const t = R(e.operand, a);
|
|
208
209
|
return e.op === "-" ? -t : t;
|
|
209
210
|
case "binary": {
|
|
210
|
-
const r =
|
|
211
|
+
const r = R(e.left, a), i = R(e.right, a);
|
|
211
212
|
switch (e.op) {
|
|
212
213
|
case "+":
|
|
213
214
|
return r + i;
|
|
@@ -223,95 +224,95 @@ function p(e, a) {
|
|
|
223
224
|
break;
|
|
224
225
|
}
|
|
225
226
|
case "call": {
|
|
226
|
-
const r =
|
|
227
|
+
const r = Q[e.name], i = e.args.map((n) => R(n, a));
|
|
227
228
|
return r(...i);
|
|
228
229
|
}
|
|
229
230
|
case "array":
|
|
230
|
-
return e.elements.map((r) =>
|
|
231
|
+
return e.elements.map((r) => R(r, a));
|
|
231
232
|
}
|
|
232
|
-
throw new
|
|
233
|
+
throw new A("Invalid AST node", 0);
|
|
233
234
|
}
|
|
234
|
-
class
|
|
235
|
+
class A extends Error {
|
|
235
236
|
constructor(a, t) {
|
|
236
237
|
super(a), this.name = "ExpressionError", this.position = t;
|
|
237
238
|
}
|
|
238
239
|
}
|
|
239
|
-
function
|
|
240
|
-
const a =
|
|
241
|
-
return (r) =>
|
|
240
|
+
function It(e) {
|
|
241
|
+
const a = Y(e), t = new Z(a).parse();
|
|
242
|
+
return (r) => R(t, r);
|
|
242
243
|
}
|
|
243
|
-
function
|
|
244
|
-
const a =
|
|
244
|
+
function St(e) {
|
|
245
|
+
const a = Y(e), t = new Z(a).parse();
|
|
245
246
|
if (t.kind !== "array" || t.elements.length !== 2)
|
|
246
|
-
throw new
|
|
247
|
+
throw new A(
|
|
247
248
|
'Vector expression must be an array of 2 elements, e.g. "[-y, x]"',
|
|
248
249
|
0
|
|
249
250
|
);
|
|
250
|
-
return (r) =>
|
|
251
|
+
return (r) => R(t, r);
|
|
251
252
|
}
|
|
252
|
-
function
|
|
253
|
+
function ce(e) {
|
|
253
254
|
try {
|
|
254
|
-
const a =
|
|
255
|
-
return new
|
|
255
|
+
const a = Y(e);
|
|
256
|
+
return new Z(a).parse(), null;
|
|
256
257
|
} catch (a) {
|
|
257
|
-
return a instanceof
|
|
258
|
+
return a instanceof A ? `${a.message} (at position ${a.position})` : String(a);
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
|
-
const
|
|
261
|
-
linear:
|
|
262
|
-
easeInQuad:
|
|
263
|
-
easeOutQuad:
|
|
261
|
+
const X = {
|
|
262
|
+
linear: _e,
|
|
263
|
+
easeInQuad: Me,
|
|
264
|
+
easeOutQuad: Pe,
|
|
264
265
|
easeInOutQuad: Fe,
|
|
265
|
-
easeInCubic:
|
|
266
|
-
easeOutCubic:
|
|
267
|
-
easeInOutCubic:
|
|
266
|
+
easeInCubic: Te,
|
|
267
|
+
easeOutCubic: Re,
|
|
268
|
+
easeInOutCubic: Ee,
|
|
268
269
|
easeInQuart: ze,
|
|
269
|
-
easeOutQuart:
|
|
270
|
-
easeInOutQuart:
|
|
270
|
+
easeOutQuart: pe,
|
|
271
|
+
easeInOutQuart: Ae,
|
|
271
272
|
easeInSine: Oe,
|
|
272
|
-
easeOutSine:
|
|
273
|
-
easeInOutSine:
|
|
274
|
-
easeInExpo:
|
|
275
|
-
easeOutExpo:
|
|
276
|
-
easeInOutExpo:
|
|
277
|
-
easeInBack:
|
|
278
|
-
easeOutBack:
|
|
279
|
-
easeOutElastic:
|
|
280
|
-
easeOutBounce:
|
|
273
|
+
easeOutSine: Ce,
|
|
274
|
+
easeInOutSine: $e,
|
|
275
|
+
easeInExpo: Se,
|
|
276
|
+
easeOutExpo: Ie,
|
|
277
|
+
easeInOutExpo: ke,
|
|
278
|
+
easeInBack: ve,
|
|
279
|
+
easeOutBack: we,
|
|
280
|
+
easeOutElastic: de,
|
|
281
|
+
easeOutBounce: xe
|
|
281
282
|
};
|
|
282
283
|
function f(e) {
|
|
283
284
|
if (e !== void 0) {
|
|
284
285
|
if (typeof e == "string") {
|
|
285
|
-
const a =
|
|
286
|
+
const a = X[e];
|
|
286
287
|
if (!a) {
|
|
287
|
-
const t = Object.keys(
|
|
288
|
+
const t = Object.keys(X), r = t.find((n) => n.toLowerCase() === e.toLowerCase()), i = r ? ` Did you mean '${r}'?` : "";
|
|
288
289
|
throw new Error(`Unknown easing '${e}'.${i} Available: ${t.join(", ")}`);
|
|
289
290
|
}
|
|
290
291
|
return a;
|
|
291
292
|
}
|
|
292
293
|
if (e.type === "spring")
|
|
293
|
-
return
|
|
294
|
+
return De({
|
|
294
295
|
stiffness: e.stiffness,
|
|
295
296
|
damping: e.damping,
|
|
296
297
|
mass: e.mass
|
|
297
298
|
});
|
|
298
299
|
if (e.type === "cubicBezier")
|
|
299
|
-
return
|
|
300
|
+
return Ne(e.x1, e.y1, e.x2, e.y2);
|
|
300
301
|
throw new Error(`Unknown easing type: ${e.type}`);
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
|
-
const
|
|
304
|
-
function
|
|
304
|
+
const H = Object.keys(X);
|
|
305
|
+
function le(e) {
|
|
305
306
|
const a = [];
|
|
306
307
|
if (!e || typeof e != "object")
|
|
307
308
|
return a.push({ path: "", message: "Document must be an object", severity: "error" }), { valid: !1, errors: a };
|
|
308
309
|
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 }) : (
|
|
310
|
+
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 }) : ($t(t.root, "root", a), {
|
|
310
311
|
valid: a.filter((r) => r.severity === "error").length === 0,
|
|
311
312
|
errors: a
|
|
312
313
|
});
|
|
313
314
|
}
|
|
314
|
-
const
|
|
315
|
+
const re = ["scene", "player", "presentation"], V = ["card", "slide", "square"], G = [
|
|
315
316
|
"sequence",
|
|
316
317
|
"group",
|
|
317
318
|
"bezierCurve",
|
|
@@ -340,38 +341,38 @@ const te = ["scene", "player", "presentation"], L = ["card", "slide", "square"],
|
|
|
340
341
|
"parallel",
|
|
341
342
|
"player",
|
|
342
343
|
"scene"
|
|
343
|
-
],
|
|
344
|
-
function
|
|
344
|
+
], ie = ["none", "fade", "slide-left", "slide-up", "zoom"];
|
|
345
|
+
function $t(e, a, t) {
|
|
345
346
|
const r = e.type;
|
|
346
|
-
if (!
|
|
347
|
-
t.push({ path: `${a}.type`, message: `Root type must be one of: ${
|
|
347
|
+
if (!re.includes(r)) {
|
|
348
|
+
t.push({ path: `${a}.type`, message: `Root type must be one of: ${re.join(", ")}. Got "${r}"`, severity: "error" });
|
|
348
349
|
return;
|
|
349
350
|
}
|
|
350
|
-
r === "scene" || r === "player" ?
|
|
351
|
+
r === "scene" || r === "player" ? ue(e, a, r, t) : r === "presentation" && Ct(e, a, t);
|
|
351
352
|
}
|
|
352
|
-
function
|
|
353
|
-
|
|
353
|
+
function ue(e, a, t, r) {
|
|
354
|
+
Jt(e, "durationInFrames", a, r), m(e, "width", a, r), m(e, "height", a, r), m(e, "fps", a, r), p(e, "background", a, r), e.preset !== void 0 && (typeof e.preset != "string" || !V.includes(e.preset)) && r.push({ path: `${a}.preset`, message: `preset must be one of: ${V.join(", ")}. Got "${e.preset}"`, severity: "error" }), t === "player" && (W(e, "controls", a, r), W(e, "loop", a, r), W(e, "autoPlay", a, r)), z(e, a, r);
|
|
354
355
|
}
|
|
355
|
-
function
|
|
356
|
-
if (
|
|
356
|
+
function Ct(e, a, t) {
|
|
357
|
+
if (m(e, "width", a, t), m(e, "height", a, t), p(e, "background", a, t), m(e, "transitionDuration", a, t), W(e, "showHud", a, t), W(e, "showNotes", a, t), e.preset !== void 0 && (typeof e.preset != "string" || !V.includes(e.preset)) && t.push({ path: `${a}.preset`, message: `preset must be one of: ${V.join(", ")}. Got "${e.preset}"`, severity: "error" }), e.transition !== void 0 && (ie.includes(e.transition) || t.push({
|
|
357
358
|
path: `${a}.transition`,
|
|
358
|
-
message: `Invalid transition "${e.transition}". Must be one of: ${
|
|
359
|
+
message: `Invalid transition "${e.transition}". Must be one of: ${ie.join(", ")}`,
|
|
359
360
|
severity: "error"
|
|
360
361
|
})), !Array.isArray(e.slides)) {
|
|
361
362
|
t.push({ path: `${a}.slides`, message: 'Presentation must have a "slides" array', severity: "error" });
|
|
362
363
|
return;
|
|
363
364
|
}
|
|
364
365
|
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
|
-
|
|
366
|
+
Ot(r, `${a}.slides[${i}]`, t);
|
|
366
367
|
});
|
|
367
368
|
}
|
|
368
|
-
function
|
|
369
|
+
function Ot(e, a, t) {
|
|
369
370
|
if (!e || typeof e != "object") {
|
|
370
371
|
t.push({ path: a, message: "Slide must be an object", severity: "error" });
|
|
371
372
|
return;
|
|
372
373
|
}
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
p(e, "title", a, t), p(e, "notes", a, t), p(e, "background", a, t), e.children !== void 0 && (Array.isArray(e.children) ? e.children.forEach((r, i) => {
|
|
375
|
+
he(r, `${a}.children[${i}]`, t);
|
|
375
376
|
}) : t.push({ path: `${a}.children`, message: "Slide children must be an array", severity: "error" }));
|
|
376
377
|
}
|
|
377
378
|
function z(e, a, t) {
|
|
@@ -380,78 +381,78 @@ function z(e, a, t) {
|
|
|
380
381
|
return;
|
|
381
382
|
}
|
|
382
383
|
e.children.forEach((r, i) => {
|
|
383
|
-
|
|
384
|
+
he(r, `${a}.children[${i}]`, t);
|
|
384
385
|
});
|
|
385
386
|
}
|
|
386
|
-
function
|
|
387
|
+
function he(e, a, t) {
|
|
387
388
|
if (!e || typeof e != "object") {
|
|
388
389
|
t.push({ path: a, message: "Element must be an object", severity: "error" });
|
|
389
390
|
return;
|
|
390
391
|
}
|
|
391
392
|
const r = e.type;
|
|
392
|
-
if (!r || !
|
|
393
|
-
const i = r ?
|
|
393
|
+
if (!r || !G.includes(r)) {
|
|
394
|
+
const i = r ? fe(r, G) : "";
|
|
394
395
|
t.push({
|
|
395
396
|
path: `${a}.type`,
|
|
396
|
-
message: `Unknown element type "${r}".${i} Valid types: ${
|
|
397
|
+
message: `Unknown element type "${r}".${i} Valid types: ${G.join(", ")}`,
|
|
397
398
|
severity: "error"
|
|
398
399
|
});
|
|
399
400
|
return;
|
|
400
401
|
}
|
|
401
402
|
switch (r) {
|
|
402
403
|
case "bezierCurve":
|
|
403
|
-
|
|
404
|
+
At(e, a, t);
|
|
404
405
|
break;
|
|
405
406
|
case "circle":
|
|
406
|
-
|
|
407
|
+
pt(e, a, t);
|
|
407
408
|
break;
|
|
408
409
|
case "line":
|
|
409
|
-
|
|
410
|
+
zt(e, a, t);
|
|
410
411
|
break;
|
|
411
412
|
case "arrow":
|
|
412
|
-
|
|
413
|
+
Et(e, a, t);
|
|
413
414
|
break;
|
|
414
415
|
case "rect":
|
|
415
|
-
|
|
416
|
+
Rt(e, a, t);
|
|
416
417
|
break;
|
|
417
418
|
case "polygon":
|
|
418
|
-
|
|
419
|
+
Tt(e, a, t);
|
|
419
420
|
break;
|
|
420
421
|
case "text":
|
|
421
|
-
|
|
422
|
+
Ft(e, a, t);
|
|
422
423
|
break;
|
|
423
424
|
case "image":
|
|
424
|
-
|
|
425
|
+
Kt(e, a, t);
|
|
425
426
|
break;
|
|
426
427
|
case "axes":
|
|
427
|
-
|
|
428
|
+
Pt(e, a, t);
|
|
428
429
|
break;
|
|
429
430
|
case "functionPlot":
|
|
430
|
-
|
|
431
|
+
Mt(e, a, t);
|
|
431
432
|
break;
|
|
432
433
|
case "vector":
|
|
433
|
-
|
|
434
|
+
_t(e, a, t);
|
|
434
435
|
break;
|
|
435
436
|
case "vectorField":
|
|
436
|
-
|
|
437
|
+
Dt(e, a, t);
|
|
437
438
|
break;
|
|
438
439
|
case "matrix":
|
|
439
|
-
|
|
440
|
+
Nt(e, a, t);
|
|
440
441
|
break;
|
|
441
442
|
case "graph":
|
|
442
|
-
|
|
443
|
+
Wt(e, a, t);
|
|
443
444
|
break;
|
|
444
445
|
case "latex":
|
|
445
|
-
|
|
446
|
+
Lt(e, a, t);
|
|
446
447
|
break;
|
|
447
448
|
case "barChart":
|
|
448
|
-
|
|
449
|
+
Xt(e, a, t);
|
|
449
450
|
break;
|
|
450
451
|
case "sequence":
|
|
451
|
-
|
|
452
|
+
Vt(e, a, t);
|
|
452
453
|
break;
|
|
453
454
|
case "group":
|
|
454
|
-
|
|
455
|
+
Qt(e, a, t);
|
|
455
456
|
break;
|
|
456
457
|
case "parallel":
|
|
457
458
|
z(e, a, t);
|
|
@@ -460,76 +461,76 @@ function le(e, a, t) {
|
|
|
460
461
|
case "fadeOut":
|
|
461
462
|
case "draw":
|
|
462
463
|
case "write":
|
|
463
|
-
|
|
464
|
+
Bt(e, a, t);
|
|
464
465
|
break;
|
|
465
466
|
case "transform":
|
|
466
|
-
|
|
467
|
+
jt(e, a, t);
|
|
467
468
|
break;
|
|
468
469
|
case "morph":
|
|
469
|
-
|
|
470
|
+
qt(e, a, t);
|
|
470
471
|
break;
|
|
471
472
|
case "stagger":
|
|
472
|
-
|
|
473
|
+
Ut(e, a, t);
|
|
473
474
|
break;
|
|
474
475
|
case "scene":
|
|
475
476
|
case "player":
|
|
476
|
-
|
|
477
|
+
ue(e, a, r, t);
|
|
477
478
|
break;
|
|
478
479
|
}
|
|
479
480
|
}
|
|
480
|
-
function
|
|
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 &&
|
|
481
|
+
function At(e, a, t) {
|
|
482
|
+
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), v(e, a, t);
|
|
482
483
|
}
|
|
483
|
-
function
|
|
484
|
-
h(e, "cx", a, t), h(e, "cy", a, t),
|
|
484
|
+
function pt(e, a, t) {
|
|
485
|
+
h(e, "cx", a, t), h(e, "cy", a, t), T(e, "r", a, t), v(e, a, t);
|
|
485
486
|
}
|
|
486
|
-
function
|
|
487
|
+
function zt(e, a, t) {
|
|
487
488
|
h(e, "x1", a, t), h(e, "y1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), v(e, a, t);
|
|
488
489
|
}
|
|
489
|
-
function
|
|
490
|
+
function Et(e, a, t) {
|
|
490
491
|
h(e, "x1", a, t), h(e, "y1", a, t), h(e, "x2", a, t), h(e, "y2", a, t), v(e, a, t);
|
|
491
492
|
}
|
|
492
|
-
function
|
|
493
|
-
h(e, "x", a, t), h(e, "y", a, t),
|
|
493
|
+
function Rt(e, a, t) {
|
|
494
|
+
h(e, "x", a, t), h(e, "y", a, t), T(e, "width", a, t), T(e, "height", a, t), v(e, a, t);
|
|
494
495
|
}
|
|
495
|
-
function
|
|
496
|
+
function Tt(e, a, t) {
|
|
496
497
|
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
498
|
(!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
499
|
}) : t.push({ path: `${a}.points`, message: 'Polygon requires a "points" array', severity: "error" }), v(e, a, t);
|
|
499
500
|
}
|
|
500
|
-
function
|
|
501
|
+
function Ft(e, a, t) {
|
|
501
502
|
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" }), v(e, a, t);
|
|
502
503
|
}
|
|
503
|
-
function Et(e, a, t) {
|
|
504
|
-
I(e, "domain", a, t), I(e, "range", a, t), I(e, "origin", a, t), j(e, a, t);
|
|
505
|
-
}
|
|
506
504
|
function Pt(e, a, t) {
|
|
505
|
+
I(e, "domain", a, t), I(e, "range", a, t), I(e, "origin", a, t), B(e, a, t);
|
|
506
|
+
}
|
|
507
|
+
function Mt(e, a, t) {
|
|
507
508
|
if (typeof e.fn != "string")
|
|
508
509
|
t.push({ path: `${a}.fn`, message: 'FunctionPlot requires a "fn" expression string', severity: "error" });
|
|
509
510
|
else {
|
|
510
|
-
const r =
|
|
511
|
+
const r = ce(e.fn);
|
|
511
512
|
r && t.push({ path: `${a}.fn`, message: `Invalid expression: ${r}`, severity: "error" });
|
|
512
513
|
}
|
|
513
|
-
I(e, "domain", a, t),
|
|
514
|
+
I(e, "domain", a, t), B(e, a, t);
|
|
514
515
|
}
|
|
515
|
-
function
|
|
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" }), I(e, "from", a, t),
|
|
516
|
+
function _t(e, a, t) {
|
|
517
|
+
(!Array.isArray(e.to) || e.to.length !== 2) && t.push({ path: `${a}.to`, message: 'Vector requires a "to" array of [number, number]', severity: "error" }), I(e, "from", a, t), B(e, a, t);
|
|
517
518
|
}
|
|
518
|
-
function
|
|
519
|
+
function Dt(e, a, t) {
|
|
519
520
|
if (typeof e.fn != "string")
|
|
520
521
|
t.push({ path: `${a}.fn`, message: 'VectorField requires a "fn" expression string', severity: "error" });
|
|
521
522
|
else {
|
|
522
|
-
const r =
|
|
523
|
+
const r = ce(e.fn);
|
|
523
524
|
r && t.push({ path: `${a}.fn`, message: `Invalid vector expression: ${r}`, severity: "error" });
|
|
524
525
|
}
|
|
525
|
-
I(e, "domain", a, t), I(e, "range", a, t),
|
|
526
|
+
I(e, "domain", a, t), I(e, "range", a, t), B(e, a, t);
|
|
526
527
|
}
|
|
527
|
-
function
|
|
528
|
+
function Nt(e, a, t) {
|
|
528
529
|
Array.isArray(e.values) ? e.values.forEach((r, i) => {
|
|
529
530
|
Array.isArray(r) || t.push({ path: `${a}.values[${i}]`, message: "Each matrix row must be an array", severity: "error" });
|
|
530
531
|
}) : t.push({ path: `${a}.values`, message: 'Matrix requires a "values" 2D array', severity: "error" }), v(e, a, t);
|
|
531
532
|
}
|
|
532
|
-
function
|
|
533
|
+
function Wt(e, a, t) {
|
|
533
534
|
if (!Array.isArray(e.nodes))
|
|
534
535
|
t.push({ path: `${a}.nodes`, message: 'Graph requires a "nodes" array', severity: "error" });
|
|
535
536
|
else {
|
|
@@ -542,17 +543,17 @@ function Mt(e, a, t) {
|
|
|
542
543
|
}
|
|
543
544
|
v(e, a, t);
|
|
544
545
|
}
|
|
545
|
-
function
|
|
546
|
+
function Lt(e, a, t) {
|
|
546
547
|
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), v(e, a, t);
|
|
547
548
|
}
|
|
548
|
-
function
|
|
549
|
-
h(e, "from", a, t),
|
|
549
|
+
function Vt(e, a, t) {
|
|
550
|
+
h(e, "from", a, t), Yt(e, "durationInFrames", a, t), z(e, a, t);
|
|
550
551
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
552
|
+
function Bt(e, a, t) {
|
|
553
|
+
m(e, "duration", a, t), M(e, a, t), z(e, a, t);
|
|
553
554
|
}
|
|
554
|
-
function
|
|
555
|
-
if (
|
|
555
|
+
function jt(e, a, t) {
|
|
556
|
+
if (m(e, "duration", a, t), M(e, a, t), e.translate !== void 0) {
|
|
556
557
|
const r = e.translate;
|
|
557
558
|
(!r || typeof r != "object") && t.push({ path: `${a}.translate`, message: "translate must be { from: [x,y], to: [x,y] }", severity: "error" });
|
|
558
559
|
}
|
|
@@ -570,49 +571,49 @@ function _t(e, a, t) {
|
|
|
570
571
|
}
|
|
571
572
|
z(e, a, t);
|
|
572
573
|
}
|
|
573
|
-
function
|
|
574
|
-
|
|
574
|
+
function qt(e, a, t) {
|
|
575
|
+
m(e, "duration", a, t), M(e, a, t), p(e, "fromColor", a, t), p(e, "toColor", a, t), z(e, a, t);
|
|
575
576
|
}
|
|
576
|
-
function
|
|
577
|
-
|
|
577
|
+
function Ut(e, a, t) {
|
|
578
|
+
m(e, "staggerDelay", a, t), M(e, a, t), z(e, a, t);
|
|
578
579
|
}
|
|
579
580
|
function v(e, a, t) {
|
|
580
|
-
|
|
581
|
+
m(e, "fadeIn", a, t), m(e, "fadeOut", a, t), m(e, "draw", a, t), M(e, a, t), Ht(e, a, t);
|
|
581
582
|
}
|
|
582
|
-
function
|
|
583
|
-
|
|
583
|
+
function B(e, a, t) {
|
|
584
|
+
m(e, "fadeIn", a, t), m(e, "fadeOut", a, t), m(e, "draw", a, t), M(e, a, t), Gt(e, a, t);
|
|
584
585
|
}
|
|
585
|
-
const
|
|
586
|
-
function
|
|
587
|
-
if (
|
|
586
|
+
const ne = ["none", "circle", "ellipse"];
|
|
587
|
+
function Ht(e, a, t) {
|
|
588
|
+
if (P(e, "rotation", a, t), I(e, "rotationOrigin", a, t), I(e, "translate", a, t), P(e, "zIndex", a, t), e.scale !== void 0) {
|
|
588
589
|
const r = e.scale;
|
|
589
590
|
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
591
|
}
|
|
591
592
|
}
|
|
592
|
-
function
|
|
593
|
-
|
|
593
|
+
function Gt(e, a, t) {
|
|
594
|
+
P(e, "rotation", a, t), I(e, "rotationOrigin", a, t), I(e, "translate", a, t), P(e, "zIndex", a, t);
|
|
594
595
|
}
|
|
595
|
-
function
|
|
596
|
-
typeof e.src != "string" && t.push({ path: `${a}.src`, message: 'Image requires a "src" string', severity: "error" }), h(e, "x", a, t), h(e, "y", a, t),
|
|
596
|
+
function Kt(e, a, t) {
|
|
597
|
+
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), T(e, "width", a, t), T(e, "height", a, t), p(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 && (ne.includes(e.clipShape) || t.push({
|
|
597
598
|
path: `${a}.clipShape`,
|
|
598
|
-
message: `Invalid clipShape "${e.clipShape}". Must be one of: ${
|
|
599
|
+
message: `Invalid clipShape "${e.clipShape}". Must be one of: ${ne.join(", ")}`,
|
|
599
600
|
severity: "error"
|
|
600
601
|
})), v(e, a, t);
|
|
601
602
|
}
|
|
602
|
-
function
|
|
603
|
+
function Qt(e, a, t) {
|
|
603
604
|
z(e, a, t), v(e, a, t);
|
|
604
605
|
}
|
|
605
|
-
function
|
|
606
|
-
h(e, "x", a, t), h(e, "y", a, t),
|
|
606
|
+
function Xt(e, a, t) {
|
|
607
|
+
h(e, "x", a, t), h(e, "y", a, t), T(e, "width", a, t), T(e, "height", a, t), Array.isArray(e.bars) || t.push({ path: `${a}.bars`, message: 'BarChart requires a "bars" array', severity: "error" }), v(e, a, t);
|
|
607
608
|
}
|
|
608
|
-
function
|
|
609
|
+
function M(e, a, t) {
|
|
609
610
|
if (e.easing !== void 0) {
|
|
610
611
|
if (typeof e.easing == "string") {
|
|
611
|
-
if (!
|
|
612
|
-
const r =
|
|
612
|
+
if (!H.includes(e.easing)) {
|
|
613
|
+
const r = fe(e.easing, H);
|
|
613
614
|
t.push({
|
|
614
615
|
path: `${a}.easing`,
|
|
615
|
-
message: `Unknown easing "${e.easing}".${r} Available: ${
|
|
616
|
+
message: `Unknown easing "${e.easing}".${r} Available: ${H.join(", ")}`,
|
|
616
617
|
severity: "error"
|
|
617
618
|
});
|
|
618
619
|
}
|
|
@@ -635,79 +636,57 @@ function T(e, a, t) {
|
|
|
635
636
|
function h(e, a, t, r) {
|
|
636
637
|
typeof e[a] != "number" && r.push({ path: `${t}.${a}`, message: `Required numeric field "${a}" is missing or not a number`, severity: "error" });
|
|
637
638
|
}
|
|
638
|
-
function
|
|
639
|
+
function T(e, a, t, r) {
|
|
639
640
|
(typeof e[a] != "number" || e[a] <= 0) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive number`, severity: "error" });
|
|
640
641
|
}
|
|
641
|
-
function
|
|
642
|
+
function Jt(e, a, t, r) {
|
|
642
643
|
const i = e[a];
|
|
643
644
|
(typeof i != "number" || i <= 0 || !Number.isInteger(i)) && r.push({ path: `${t}.${a}`, message: `"${a}" must be a positive integer`, severity: "error" });
|
|
644
645
|
}
|
|
645
|
-
function
|
|
646
|
+
function m(e, a, t, r) {
|
|
646
647
|
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
648
|
}
|
|
648
|
-
function
|
|
649
|
+
function Yt(e, a, t, r) {
|
|
649
650
|
const i = e[a];
|
|
650
651
|
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
652
|
}
|
|
652
|
-
function
|
|
653
|
+
function p(e, a, t, r) {
|
|
653
654
|
e[a] !== void 0 && typeof e[a] != "string" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a string`, severity: "error" });
|
|
654
655
|
}
|
|
655
|
-
function
|
|
656
|
+
function P(e, a, t, r) {
|
|
656
657
|
e[a] !== void 0 && typeof e[a] != "number" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a number`, severity: "error" });
|
|
657
658
|
}
|
|
658
|
-
function
|
|
659
|
+
function W(e, a, t, r) {
|
|
659
660
|
e[a] !== void 0 && typeof e[a] != "boolean" && r.push({ path: `${t}.${a}`, message: `"${a}" must be a boolean`, severity: "error" });
|
|
660
661
|
}
|
|
661
662
|
function I(e, a, t, r) {
|
|
662
663
|
const i = e[a];
|
|
663
664
|
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
665
|
}
|
|
665
|
-
function
|
|
666
|
+
function fe(e, a) {
|
|
666
667
|
const t = e.toLowerCase(), r = a.find((n) => n.toLowerCase() === t);
|
|
667
668
|
if (r) return ` Did you mean '${r}'?`;
|
|
668
669
|
const i = a.find((n) => n.toLowerCase().startsWith(t.slice(0, 4)));
|
|
669
670
|
return i ? ` Did you mean '${i}'?` : "";
|
|
670
671
|
}
|
|
671
|
-
const
|
|
672
|
-
foreground: { cssVar: "--elucim-foreground", fallback: "#c8d6e5" },
|
|
673
|
-
background: { cssVar: "--elucim-background", fallback: "#0a0a1e" },
|
|
674
|
-
title: { cssVar: "--elucim-title", fallback: "#e0e7ff" },
|
|
675
|
-
subtitle: { cssVar: "--elucim-subtitle", fallback: "#94a3b8" },
|
|
676
|
-
accent: { cssVar: "--elucim-accent", fallback: "#4fc3f7" },
|
|
677
|
-
muted: { cssVar: "--elucim-muted", fallback: "#64748b" },
|
|
678
|
-
surface: { cssVar: "--elucim-surface", fallback: "#1e293b" },
|
|
679
|
-
border: { cssVar: "--elucim-border", fallback: "#334155" },
|
|
680
|
-
primary: { cssVar: "--elucim-primary", fallback: "#4fc3f7" },
|
|
681
|
-
secondary: { cssVar: "--elucim-secondary", fallback: "#a78bfa" },
|
|
682
|
-
tertiary: { cssVar: "--elucim-tertiary", fallback: "#f472b6" },
|
|
683
|
-
success: { cssVar: "--elucim-success", fallback: "#34d399" },
|
|
684
|
-
warning: { cssVar: "--elucim-warning", fallback: "#fbbf24" },
|
|
685
|
-
error: { cssVar: "--elucim-error", fallback: "#f87171" }
|
|
686
|
-
}, ba = Object.keys(he);
|
|
687
|
-
function u(e) {
|
|
688
|
-
if (e === void 0) return;
|
|
689
|
-
if (!e.startsWith("$")) return e;
|
|
690
|
-
const a = e.slice(1), t = he[a];
|
|
691
|
-
return t ? `var(${t.cssVar}, ${t.fallback})` : `var(--elucim-${a})`;
|
|
692
|
-
}
|
|
693
|
-
const Qt = {
|
|
672
|
+
const Zt = {
|
|
694
673
|
card: [640, 360],
|
|
695
674
|
slide: [1280, 720],
|
|
696
675
|
square: [600, 600]
|
|
697
676
|
};
|
|
698
|
-
function
|
|
677
|
+
function j(e, a, t) {
|
|
699
678
|
if (!e) return { width: a, height: t };
|
|
700
|
-
const [r, i] =
|
|
679
|
+
const [r, i] = Zt[e];
|
|
701
680
|
return { width: a ?? r, height: t ?? i };
|
|
702
681
|
}
|
|
703
|
-
function
|
|
682
|
+
function ge(e, a) {
|
|
704
683
|
switch (e.type) {
|
|
705
684
|
case "scene":
|
|
706
|
-
return
|
|
685
|
+
return J(e, a);
|
|
707
686
|
case "player":
|
|
708
687
|
if ((a == null ? void 0 : a.frame) !== void 0) {
|
|
709
|
-
const { width: t, height: r } =
|
|
710
|
-
return
|
|
688
|
+
const { width: t, height: r } = j(e.preset, e.width, e.height);
|
|
689
|
+
return J(
|
|
711
690
|
{
|
|
712
691
|
width: t,
|
|
713
692
|
height: r,
|
|
@@ -719,15 +698,15 @@ function fe(e, a) {
|
|
|
719
698
|
a
|
|
720
699
|
);
|
|
721
700
|
}
|
|
722
|
-
return
|
|
701
|
+
return oe(e, a);
|
|
723
702
|
case "presentation":
|
|
724
|
-
return
|
|
703
|
+
return ea(e, a);
|
|
725
704
|
}
|
|
726
705
|
}
|
|
727
|
-
function
|
|
728
|
-
const t = (a == null ? void 0 : a.frame) !== void 0, { width: r, height: i } =
|
|
706
|
+
function J(e, a) {
|
|
707
|
+
const t = (a == null ? void 0 : a.frame) !== void 0, { width: r, height: i } = j(e.preset, e.width, e.height);
|
|
729
708
|
return /* @__PURE__ */ l(
|
|
730
|
-
|
|
709
|
+
Le,
|
|
731
710
|
{
|
|
732
711
|
width: r,
|
|
733
712
|
height: i,
|
|
@@ -735,13 +714,14 @@ function X(e, a) {
|
|
|
735
714
|
durationInFrames: e.durationInFrames,
|
|
736
715
|
background: u(e.background),
|
|
737
716
|
colorScheme: a == null ? void 0 : a.colorScheme,
|
|
717
|
+
fitToContainer: a == null ? void 0 : a.fitToContainer,
|
|
738
718
|
...t ? { frame: a.frame, autoPlay: !1 } : {},
|
|
739
719
|
children: e.children.map((n, s) => w(n, s))
|
|
740
720
|
}
|
|
741
721
|
);
|
|
742
722
|
}
|
|
743
|
-
function
|
|
744
|
-
const { width: t, height: r } =
|
|
723
|
+
function oe(e, a) {
|
|
724
|
+
const { width: t, height: r } = j(e.preset, e.width, e.height);
|
|
745
725
|
return /* @__PURE__ */ l(
|
|
746
726
|
Ve,
|
|
747
727
|
{
|
|
@@ -755,15 +735,16 @@ function ge(e, a) {
|
|
|
755
735
|
loop: (a == null ? void 0 : a.loop) ?? e.loop,
|
|
756
736
|
autoPlay: (a == null ? void 0 : a.autoPlay) ?? e.autoPlay,
|
|
757
737
|
onPlayStateChange: a == null ? void 0 : a.onPlayStateChange,
|
|
738
|
+
fitToContainer: a == null ? void 0 : a.fitToContainer,
|
|
758
739
|
colorScheme: a == null ? void 0 : a.colorScheme,
|
|
759
740
|
children: e.children.map((i, n) => w(i, n))
|
|
760
741
|
}
|
|
761
742
|
);
|
|
762
743
|
}
|
|
763
|
-
function
|
|
764
|
-
const { width: t, height: r } =
|
|
744
|
+
function ea(e, a) {
|
|
745
|
+
const { width: t, height: r } = j(e.preset, e.width, e.height);
|
|
765
746
|
return /* @__PURE__ */ l(
|
|
766
|
-
|
|
747
|
+
We,
|
|
767
748
|
{
|
|
768
749
|
width: t,
|
|
769
750
|
height: r,
|
|
@@ -773,22 +754,22 @@ function Xt(e, a) {
|
|
|
773
754
|
showHUD: e.showHud,
|
|
774
755
|
showNotes: e.showNotes,
|
|
775
756
|
colorScheme: a == null ? void 0 : a.colorScheme,
|
|
776
|
-
children: e.slides.map((i, n) =>
|
|
757
|
+
children: e.slides.map((i, n) => ta(i, n))
|
|
777
758
|
}
|
|
778
759
|
);
|
|
779
760
|
}
|
|
780
|
-
function
|
|
761
|
+
function ta(e, a) {
|
|
781
762
|
var t;
|
|
782
|
-
return /* @__PURE__ */ l(
|
|
763
|
+
return /* @__PURE__ */ l(Be, { title: e.title, notes: e.notes, background: u(e.background), children: (t = e.children) == null ? void 0 : t.map((r, i) => w(r, i)) }, a);
|
|
783
764
|
}
|
|
784
765
|
function w(e, a) {
|
|
785
766
|
var t, r, i, n;
|
|
786
767
|
switch (e.type) {
|
|
787
768
|
case "sequence":
|
|
788
|
-
return /* @__PURE__ */ l(
|
|
769
|
+
return /* @__PURE__ */ l(ot, { from: e.from, durationInFrames: e.durationInFrames, name: e.name, children: e.children.map((s, c) => w(s, c)) }, a);
|
|
789
770
|
case "group":
|
|
790
771
|
return /* @__PURE__ */ l(
|
|
791
|
-
|
|
772
|
+
gt,
|
|
792
773
|
{
|
|
793
774
|
fadeIn: e.fadeIn,
|
|
794
775
|
fadeOut: e.fadeOut,
|
|
@@ -804,7 +785,7 @@ function w(e, a) {
|
|
|
804
785
|
);
|
|
805
786
|
case "bezierCurve":
|
|
806
787
|
return /* @__PURE__ */ l(
|
|
807
|
-
|
|
788
|
+
ft,
|
|
808
789
|
{
|
|
809
790
|
x1: e.x1,
|
|
810
791
|
y1: e.y1,
|
|
@@ -833,7 +814,7 @@ function w(e, a) {
|
|
|
833
814
|
);
|
|
834
815
|
case "circle":
|
|
835
816
|
return /* @__PURE__ */ l(
|
|
836
|
-
|
|
817
|
+
ht,
|
|
837
818
|
{
|
|
838
819
|
cx: e.cx,
|
|
839
820
|
cy: e.cy,
|
|
@@ -856,7 +837,7 @@ function w(e, a) {
|
|
|
856
837
|
);
|
|
857
838
|
case "line":
|
|
858
839
|
return /* @__PURE__ */ l(
|
|
859
|
-
|
|
840
|
+
ut,
|
|
860
841
|
{
|
|
861
842
|
x1: e.x1,
|
|
862
843
|
y1: e.y1,
|
|
@@ -880,7 +861,7 @@ function w(e, a) {
|
|
|
880
861
|
);
|
|
881
862
|
case "arrow":
|
|
882
863
|
return /* @__PURE__ */ l(
|
|
883
|
-
|
|
864
|
+
lt,
|
|
884
865
|
{
|
|
885
866
|
x1: e.x1,
|
|
886
867
|
y1: e.y1,
|
|
@@ -905,7 +886,7 @@ function w(e, a) {
|
|
|
905
886
|
);
|
|
906
887
|
case "rect":
|
|
907
888
|
return /* @__PURE__ */ l(
|
|
908
|
-
|
|
889
|
+
ct,
|
|
909
890
|
{
|
|
910
891
|
x: e.x,
|
|
911
892
|
y: e.y,
|
|
@@ -932,7 +913,7 @@ function w(e, a) {
|
|
|
932
913
|
);
|
|
933
914
|
case "polygon":
|
|
934
915
|
return /* @__PURE__ */ l(
|
|
935
|
-
|
|
916
|
+
st,
|
|
936
917
|
{
|
|
937
918
|
points: e.points,
|
|
938
919
|
fill: u(e.fill),
|
|
@@ -979,7 +960,7 @@ function w(e, a) {
|
|
|
979
960
|
);
|
|
980
961
|
case "image":
|
|
981
962
|
return /* @__PURE__ */ l(
|
|
982
|
-
|
|
963
|
+
nt,
|
|
983
964
|
{
|
|
984
965
|
src: e.src,
|
|
985
966
|
x: e.x,
|
|
@@ -1003,7 +984,7 @@ function w(e, a) {
|
|
|
1003
984
|
);
|
|
1004
985
|
case "axes":
|
|
1005
986
|
return /* @__PURE__ */ l(
|
|
1006
|
-
|
|
987
|
+
it,
|
|
1007
988
|
{
|
|
1008
989
|
domain: e.domain,
|
|
1009
990
|
range: e.range,
|
|
@@ -1031,7 +1012,7 @@ function w(e, a) {
|
|
|
1031
1012
|
case "functionPlot": {
|
|
1032
1013
|
let s;
|
|
1033
1014
|
try {
|
|
1034
|
-
s =
|
|
1015
|
+
s = It(e.fn);
|
|
1035
1016
|
} catch {
|
|
1036
1017
|
return /* @__PURE__ */ l(
|
|
1037
1018
|
U,
|
|
@@ -1047,7 +1028,7 @@ function w(e, a) {
|
|
|
1047
1028
|
);
|
|
1048
1029
|
}
|
|
1049
1030
|
return /* @__PURE__ */ l(
|
|
1050
|
-
|
|
1031
|
+
rt,
|
|
1051
1032
|
{
|
|
1052
1033
|
fn: (c) => s({ x: c }),
|
|
1053
1034
|
domain: e.domain,
|
|
@@ -1070,7 +1051,7 @@ function w(e, a) {
|
|
|
1070
1051
|
}
|
|
1071
1052
|
case "vector":
|
|
1072
1053
|
return /* @__PURE__ */ l(
|
|
1073
|
-
|
|
1054
|
+
at,
|
|
1074
1055
|
{
|
|
1075
1056
|
from: e.from,
|
|
1076
1057
|
to: e.to,
|
|
@@ -1097,7 +1078,7 @@ function w(e, a) {
|
|
|
1097
1078
|
case "vectorField": {
|
|
1098
1079
|
let s;
|
|
1099
1080
|
try {
|
|
1100
|
-
s =
|
|
1081
|
+
s = St(e.fn);
|
|
1101
1082
|
} catch {
|
|
1102
1083
|
return /* @__PURE__ */ l(
|
|
1103
1084
|
U,
|
|
@@ -1113,9 +1094,9 @@ function w(e, a) {
|
|
|
1113
1094
|
);
|
|
1114
1095
|
}
|
|
1115
1096
|
return /* @__PURE__ */ l(
|
|
1116
|
-
|
|
1097
|
+
tt,
|
|
1117
1098
|
{
|
|
1118
|
-
fn: (c,
|
|
1099
|
+
fn: (c, y) => s({ x: c, y }),
|
|
1119
1100
|
domain: e.domain,
|
|
1120
1101
|
range: e.range,
|
|
1121
1102
|
step: e.step,
|
|
@@ -1140,7 +1121,7 @@ function w(e, a) {
|
|
|
1140
1121
|
}
|
|
1141
1122
|
case "matrix":
|
|
1142
1123
|
return /* @__PURE__ */ l(
|
|
1143
|
-
|
|
1124
|
+
et,
|
|
1144
1125
|
{
|
|
1145
1126
|
values: e.values,
|
|
1146
1127
|
x: e.x,
|
|
@@ -1162,7 +1143,7 @@ function w(e, a) {
|
|
|
1162
1143
|
);
|
|
1163
1144
|
case "graph":
|
|
1164
1145
|
return /* @__PURE__ */ l(
|
|
1165
|
-
|
|
1146
|
+
Ze,
|
|
1166
1147
|
{
|
|
1167
1148
|
nodes: e.nodes,
|
|
1168
1149
|
edges: e.edges,
|
|
@@ -1185,7 +1166,7 @@ function w(e, a) {
|
|
|
1185
1166
|
);
|
|
1186
1167
|
case "latex":
|
|
1187
1168
|
return /* @__PURE__ */ l(
|
|
1188
|
-
|
|
1169
|
+
Ye,
|
|
1189
1170
|
{
|
|
1190
1171
|
expression: e.expression,
|
|
1191
1172
|
x: e.x,
|
|
@@ -1206,7 +1187,7 @@ function w(e, a) {
|
|
|
1206
1187
|
);
|
|
1207
1188
|
case "barChart":
|
|
1208
1189
|
return /* @__PURE__ */ l(
|
|
1209
|
-
|
|
1190
|
+
Je,
|
|
1210
1191
|
{
|
|
1211
1192
|
bars: e.bars,
|
|
1212
1193
|
x: e.x,
|
|
@@ -1232,16 +1213,16 @@ function w(e, a) {
|
|
|
1232
1213
|
a
|
|
1233
1214
|
);
|
|
1234
1215
|
case "fadeIn":
|
|
1235
|
-
return /* @__PURE__ */ l(
|
|
1216
|
+
return /* @__PURE__ */ l(Xe, { duration: e.duration, easing: f(e.easing), children: e.children.map((s, c) => w(s, c)) }, a);
|
|
1236
1217
|
case "fadeOut":
|
|
1237
|
-
return /* @__PURE__ */ l(
|
|
1218
|
+
return /* @__PURE__ */ l(Qe, { duration: e.duration, totalFrames: e.totalFrames, easing: f(e.easing), children: e.children.map((s, c) => w(s, c)) }, a);
|
|
1238
1219
|
case "draw":
|
|
1239
|
-
return /* @__PURE__ */ l(
|
|
1220
|
+
return /* @__PURE__ */ l(Ke, { duration: e.duration, pathLength: e.pathLength, easing: f(e.easing), children: w(e.children[0], 0) }, a);
|
|
1240
1221
|
case "write":
|
|
1241
1222
|
return /* @__PURE__ */ l(Ge, { duration: e.duration, easing: f(e.easing), children: e.children.map((s, c) => w(s, c)) }, a);
|
|
1242
1223
|
case "transform":
|
|
1243
1224
|
return /* @__PURE__ */ l(
|
|
1244
|
-
|
|
1225
|
+
He,
|
|
1245
1226
|
{
|
|
1246
1227
|
duration: e.duration,
|
|
1247
1228
|
easing: f(e.easing),
|
|
@@ -1255,7 +1236,7 @@ function w(e, a) {
|
|
|
1255
1236
|
);
|
|
1256
1237
|
case "morph":
|
|
1257
1238
|
return /* @__PURE__ */ l(
|
|
1258
|
-
|
|
1239
|
+
Ue,
|
|
1259
1240
|
{
|
|
1260
1241
|
duration: e.duration,
|
|
1261
1242
|
easing: f(e.easing),
|
|
@@ -1270,73 +1251,17 @@ function w(e, a) {
|
|
|
1270
1251
|
a
|
|
1271
1252
|
);
|
|
1272
1253
|
case "stagger":
|
|
1273
|
-
return /* @__PURE__ */ l(
|
|
1254
|
+
return /* @__PURE__ */ l(qe, { staggerDelay: e.staggerDelay, easing: f(e.easing), children: e.children.map((s, c) => w(s, c)) }, a);
|
|
1274
1255
|
case "parallel":
|
|
1275
1256
|
return /* @__PURE__ */ l(je, { children: e.children.map((s, c) => w(s, c)) }, a);
|
|
1276
1257
|
case "scene":
|
|
1277
|
-
return /* @__PURE__ */ l(
|
|
1258
|
+
return /* @__PURE__ */ l(K.Fragment, { children: J(e) }, a);
|
|
1278
1259
|
case "player":
|
|
1279
|
-
return /* @__PURE__ */ l(
|
|
1260
|
+
return /* @__PURE__ */ l(K.Fragment, { children: oe(e) }, a);
|
|
1280
1261
|
default:
|
|
1281
1262
|
return null;
|
|
1282
1263
|
}
|
|
1283
1264
|
}
|
|
1284
|
-
const oe = {
|
|
1285
|
-
background: "#0a0a1e",
|
|
1286
|
-
title: "#e0e7ff",
|
|
1287
|
-
subtitle: "#94a3b8",
|
|
1288
|
-
primary: "#4fc3f7",
|
|
1289
|
-
secondary: "#a78bfa",
|
|
1290
|
-
tertiary: "#f472b6",
|
|
1291
|
-
muted: "#64748b",
|
|
1292
|
-
text: "#c8d6e5",
|
|
1293
|
-
boxFill: "rgba(79,195,247,0.12)",
|
|
1294
|
-
boxStroke: "#4fc3f7",
|
|
1295
|
-
success: "#34d399",
|
|
1296
|
-
warning: "#fbbf24",
|
|
1297
|
-
error: "#f87171",
|
|
1298
|
-
palette: ["#4fc3f7", "#a78bfa", "#f472b6", "#34d399", "#fbbf24", "#fb923c", "#6366f1", "#22d3ee"]
|
|
1299
|
-
}, Yt = {
|
|
1300
|
-
background: "#f8fafc",
|
|
1301
|
-
title: "#1e293b",
|
|
1302
|
-
subtitle: "#64748b",
|
|
1303
|
-
primary: "#2563eb",
|
|
1304
|
-
secondary: "#7c3aed",
|
|
1305
|
-
tertiary: "#db2777",
|
|
1306
|
-
muted: "#94a3b8",
|
|
1307
|
-
text: "#334155",
|
|
1308
|
-
boxFill: "rgba(37,99,235,0.08)",
|
|
1309
|
-
boxStroke: "#2563eb",
|
|
1310
|
-
success: "#16a34a",
|
|
1311
|
-
warning: "#d97706",
|
|
1312
|
-
error: "#dc2626",
|
|
1313
|
-
palette: ["#2563eb", "#7c3aed", "#db2777", "#16a34a", "#d97706", "#ea580c", "#4f46e5", "#0891b2"]
|
|
1314
|
-
};
|
|
1315
|
-
function Zt(e) {
|
|
1316
|
-
if (!e) return {};
|
|
1317
|
-
const a = {};
|
|
1318
|
-
for (const [t, r] of Object.entries(e))
|
|
1319
|
-
r !== void 0 && (a[`--elucim-${t}`] = r);
|
|
1320
|
-
return a;
|
|
1321
|
-
}
|
|
1322
|
-
function me(e) {
|
|
1323
|
-
return {
|
|
1324
|
-
"--elucim-foreground": e.text,
|
|
1325
|
-
"--elucim-background": e.background,
|
|
1326
|
-
"--elucim-title": e.title,
|
|
1327
|
-
"--elucim-subtitle": e.subtitle,
|
|
1328
|
-
"--elucim-accent": e.primary,
|
|
1329
|
-
"--elucim-muted": e.muted,
|
|
1330
|
-
"--elucim-surface": e.background,
|
|
1331
|
-
"--elucim-primary": e.primary,
|
|
1332
|
-
"--elucim-secondary": e.secondary,
|
|
1333
|
-
"--elucim-tertiary": e.tertiary,
|
|
1334
|
-
"--elucim-success": e.success,
|
|
1335
|
-
"--elucim-warning": e.warning,
|
|
1336
|
-
"--elucim-error": e.error
|
|
1337
|
-
};
|
|
1338
|
-
}
|
|
1339
|
-
const ea = me(oe), ta = me(Yt);
|
|
1340
1265
|
function aa(e) {
|
|
1341
1266
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {
|
|
1342
1267
|
};
|
|
@@ -1350,71 +1275,97 @@ function ia() {
|
|
|
1350
1275
|
return !0;
|
|
1351
1276
|
}
|
|
1352
1277
|
function na() {
|
|
1353
|
-
return
|
|
1278
|
+
return vt(aa, ra, ia);
|
|
1279
|
+
}
|
|
1280
|
+
class sa extends K.Component {
|
|
1281
|
+
constructor() {
|
|
1282
|
+
super(...arguments), this.state = { error: null };
|
|
1283
|
+
}
|
|
1284
|
+
static getDerivedStateFromError(a) {
|
|
1285
|
+
return { error: a };
|
|
1286
|
+
}
|
|
1287
|
+
componentDidCatch(a) {
|
|
1288
|
+
var t, r;
|
|
1289
|
+
(r = (t = this.props).onRenderError) == null || r.call(t, a);
|
|
1290
|
+
}
|
|
1291
|
+
render() {
|
|
1292
|
+
return this.state.error ? this.props.fallback !== void 0 ? this.props.fallback : /* @__PURE__ */ E(
|
|
1293
|
+
"div",
|
|
1294
|
+
{
|
|
1295
|
+
style: { color: "#ff6b6b", fontFamily: "monospace", padding: 16, fontSize: 13 },
|
|
1296
|
+
"data-testid": "dsl-render-error",
|
|
1297
|
+
children: [
|
|
1298
|
+
/* @__PURE__ */ l("strong", { children: "Render Error:" }),
|
|
1299
|
+
" ",
|
|
1300
|
+
this.state.error.message
|
|
1301
|
+
]
|
|
1302
|
+
}
|
|
1303
|
+
) : this.props.children;
|
|
1304
|
+
}
|
|
1354
1305
|
}
|
|
1355
|
-
const
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1306
|
+
const da = xt(function({ dsl: a, className: t, style: r, theme: i, colorScheme: n, poster: s, controls: c, autoPlay: y, loop: d, fitToContainer: S, onPlayStateChange: b, onRenderError: g, fallback: x, onError: C }, O) {
|
|
1307
|
+
const $ = dt(null), _ = na();
|
|
1308
|
+
wt(O, () => ({
|
|
1358
1309
|
getSvgElement: () => {
|
|
1359
1310
|
var o;
|
|
1360
|
-
return ((o =
|
|
1311
|
+
return ((o = $.current) == null ? void 0 : o.getSvgElement()) ?? null;
|
|
1361
1312
|
},
|
|
1362
1313
|
seekToFrame: (o) => {
|
|
1363
|
-
var
|
|
1364
|
-
return (
|
|
1314
|
+
var F;
|
|
1315
|
+
return (F = $.current) == null ? void 0 : F.seekToFrame(o);
|
|
1365
1316
|
},
|
|
1366
1317
|
getTotalFrames: () => {
|
|
1367
1318
|
var o;
|
|
1368
|
-
return ((o =
|
|
1319
|
+
return ((o = $.current) == null ? void 0 : o.getTotalFrames()) ?? 0;
|
|
1369
1320
|
},
|
|
1370
1321
|
play: () => {
|
|
1371
1322
|
var o;
|
|
1372
|
-
return (o =
|
|
1323
|
+
return (o = $.current) == null ? void 0 : o.play();
|
|
1373
1324
|
},
|
|
1374
1325
|
pause: () => {
|
|
1375
1326
|
var o;
|
|
1376
|
-
return (o =
|
|
1327
|
+
return (o = $.current) == null ? void 0 : o.pause();
|
|
1377
1328
|
},
|
|
1378
1329
|
isPlaying: () => {
|
|
1379
1330
|
var o;
|
|
1380
|
-
return ((o =
|
|
1331
|
+
return ((o = $.current) == null ? void 0 : o.isPlaying()) ?? !1;
|
|
1381
1332
|
}
|
|
1382
1333
|
}));
|
|
1383
|
-
const
|
|
1384
|
-
if (
|
|
1385
|
-
const o =
|
|
1386
|
-
|
|
1387
|
-
const
|
|
1334
|
+
const ee = le(a);
|
|
1335
|
+
if (!ee.valid) {
|
|
1336
|
+
const o = ee.errors.filter((k) => k.severity === "error").map((k) => ({ path: k.path, message: k.message }));
|
|
1337
|
+
C == null || C(o);
|
|
1338
|
+
const F = /* @__PURE__ */ new Map();
|
|
1388
1339
|
for (const k of o) {
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1340
|
+
const D = k.path.split("."), N = D.length > 1 ? D.slice(0, -1).join(".") : k.path, L = F.get(N) ?? [];
|
|
1341
|
+
L.push(k), F.set(N, L);
|
|
1391
1342
|
}
|
|
1392
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ E(
|
|
1393
1344
|
"div",
|
|
1394
1345
|
{
|
|
1395
1346
|
className: t,
|
|
1396
1347
|
style: { color: "#ff6b6b", fontFamily: "monospace", padding: 16, fontSize: 13, ...r },
|
|
1397
1348
|
"data-testid": "dsl-error",
|
|
1398
1349
|
children: [
|
|
1399
|
-
/* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ E("strong", { children: [
|
|
1400
1351
|
"Elucim DSL Validation Errors (",
|
|
1401
1352
|
o.length,
|
|
1402
1353
|
"):"
|
|
1403
1354
|
] }),
|
|
1404
|
-
[...
|
|
1405
|
-
/* @__PURE__ */
|
|
1355
|
+
[...F.entries()].map(([k, D]) => /* @__PURE__ */ E("details", { open: !0, style: { marginTop: 8 }, children: [
|
|
1356
|
+
/* @__PURE__ */ E("summary", { style: { cursor: "pointer", fontWeight: "bold" }, children: [
|
|
1406
1357
|
k,
|
|
1407
1358
|
" (",
|
|
1408
|
-
|
|
1359
|
+
D.length,
|
|
1409
1360
|
")"
|
|
1410
1361
|
] }),
|
|
1411
|
-
/* @__PURE__ */ l("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children:
|
|
1412
|
-
/* @__PURE__ */ l("code", { style: { color: "#ffa07a" }, children:
|
|
1362
|
+
/* @__PURE__ */ l("ul", { style: { margin: "4px 0", paddingLeft: 20 }, children: D.map((N, L) => /* @__PURE__ */ E("li", { children: [
|
|
1363
|
+
/* @__PURE__ */ l("code", { style: { color: "#ffa07a" }, children: N.path }),
|
|
1413
1364
|
": ",
|
|
1414
|
-
|
|
1415
|
-
] },
|
|
1365
|
+
N.message
|
|
1366
|
+
] }, L)) })
|
|
1416
1367
|
] }, k)),
|
|
1417
|
-
/* @__PURE__ */
|
|
1368
|
+
/* @__PURE__ */ E("details", { style: { marginTop: 12 }, children: [
|
|
1418
1369
|
/* @__PURE__ */ l("summary", { style: { cursor: "pointer", opacity: 0.7 }, children: "Raw JSON" }),
|
|
1419
1370
|
/* @__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) })
|
|
1420
1371
|
] })
|
|
@@ -1422,21 +1373,22 @@ const xa = ot(function({ dsl: a, className: t, style: r, theme: i, colorScheme:
|
|
|
1422
1373
|
}
|
|
1423
1374
|
);
|
|
1424
1375
|
}
|
|
1425
|
-
const
|
|
1426
|
-
let
|
|
1427
|
-
n && (
|
|
1428
|
-
const q = s !== void 0 ?
|
|
1429
|
-
return /* @__PURE__ */ l("div", { className: t, style: { ...M, ..._, ...r }, "data-testid": "dsl-root", children: fe(a.root, {
|
|
1376
|
+
const me = mt(i);
|
|
1377
|
+
let te = {};
|
|
1378
|
+
n && (te = (n === "auto" ? _ : n === "dark") ? yt : bt);
|
|
1379
|
+
const q = s !== void 0 ? ca(s, a) : void 0, ye = n ? n === "auto" ? _ ? "dark" : "light" : n : void 0, be = ge(a.root, {
|
|
1430
1380
|
frame: q == null ? void 0 : q.frame,
|
|
1431
|
-
playerRef:
|
|
1381
|
+
playerRef: $,
|
|
1432
1382
|
colorScheme: ye,
|
|
1433
1383
|
controls: c,
|
|
1434
|
-
autoPlay:
|
|
1384
|
+
autoPlay: y,
|
|
1435
1385
|
loop: d,
|
|
1436
|
-
|
|
1437
|
-
|
|
1386
|
+
fitToContainer: S,
|
|
1387
|
+
onPlayStateChange: b
|
|
1388
|
+
});
|
|
1389
|
+
return /* @__PURE__ */ l("div", { className: t, style: { ...te, ...me, ...r }, "data-testid": "dsl-root", children: /* @__PURE__ */ l(sa, { onRenderError: g, fallback: x, children: be }) });
|
|
1438
1390
|
});
|
|
1439
|
-
function
|
|
1391
|
+
function ca(e, a) {
|
|
1440
1392
|
if (e === "first") return { frame: 0 };
|
|
1441
1393
|
if (e === "last") {
|
|
1442
1394
|
const r = a.root.durationInFrames ?? 1;
|
|
@@ -1444,8 +1396,8 @@ function sa(e, a) {
|
|
|
1444
1396
|
}
|
|
1445
1397
|
return { frame: e };
|
|
1446
1398
|
}
|
|
1447
|
-
function
|
|
1448
|
-
const r =
|
|
1399
|
+
function la(e, a, t) {
|
|
1400
|
+
const r = le(e);
|
|
1449
1401
|
if (!r.valid) {
|
|
1450
1402
|
const s = r.errors.filter((c) => c.severity === "error");
|
|
1451
1403
|
throw new Error(
|
|
@@ -1456,59 +1408,59 @@ ${s.map((c) => ` ${c.path}: ${c.message}`).join(`
|
|
|
1456
1408
|
}
|
|
1457
1409
|
const i = { ...e.root };
|
|
1458
1410
|
t != null && t.width && (i.width = t.width), t != null && t.height && (i.height = t.height);
|
|
1459
|
-
const n =
|
|
1460
|
-
return
|
|
1411
|
+
const n = ge(i, { frame: a });
|
|
1412
|
+
return kt(n);
|
|
1461
1413
|
}
|
|
1462
|
-
function
|
|
1414
|
+
function se(e) {
|
|
1463
1415
|
let a;
|
|
1464
1416
|
do
|
|
1465
1417
|
a = e, e = e.replace(/var\(--[a-z][\w-]*,\s*([^)]+)\)/gi, "$1");
|
|
1466
1418
|
while (e !== a);
|
|
1467
1419
|
return e = e.replace(/var\(--[a-z][\w-]*\)/gi, "none"), e = e.replace(/light-dark\([^,]+,\s*([^)]+)\)/gi, "$1"), e;
|
|
1468
1420
|
}
|
|
1469
|
-
async function
|
|
1470
|
-
const r = (t == null ? void 0 : t.scale) ?? 2, n =
|
|
1421
|
+
async function wa(e, a, t) {
|
|
1422
|
+
const r = (t == null ? void 0 : t.scale) ?? 2, n = la(e, a, {
|
|
1471
1423
|
width: t == null ? void 0 : t.width,
|
|
1472
1424
|
height: t == null ? void 0 : t.height
|
|
1473
1425
|
}).match(/<svg[\s\S]*<\/svg>/);
|
|
1474
1426
|
if (!n)
|
|
1475
1427
|
throw new Error("renderToSvgString did not produce an SVG element");
|
|
1476
1428
|
let s = n[0];
|
|
1477
|
-
const c = s.match(/viewBox="0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)"/),
|
|
1478
|
-
s = s.replace(/width="100%"/, `width="${S}"`).replace(/height="100%"/, `height="${
|
|
1429
|
+
const c = s.match(/viewBox="0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)"/), y = (t == null ? void 0 : t.width) ?? (c ? parseFloat(c[1]) : 800), d = (t == null ? void 0 : t.height) ?? (c ? parseFloat(c[2]) : 600), S = Math.round(y * r), b = Math.round(d * r);
|
|
1430
|
+
s = s.replace(/width="100%"/, `width="${S}"`).replace(/height="100%"/, `height="${b}"`), s.includes("xmlns=") || (s = s.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg"')), s = s.replace(/style="[^"]*position:\s*absolute[^"]*"/, "");
|
|
1479
1431
|
let g = e.root.background ?? "#ffffff";
|
|
1480
|
-
g.startsWith("$") && (g = u(g) ?? "#ffffff"), g =
|
|
1481
|
-
const
|
|
1482
|
-
s = s.replace(/>/, `>${
|
|
1483
|
-
const
|
|
1432
|
+
g.startsWith("$") && (g = u(g) ?? "#ffffff"), g = se(g);
|
|
1433
|
+
const x = `<rect width="${y}" height="${d}" fill="${g}"/>`;
|
|
1434
|
+
s = s.replace(/>/, `>${x}`), s = se(s);
|
|
1435
|
+
const O = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(s)))}`;
|
|
1484
1436
|
if (typeof Image < "u" && typeof document < "u")
|
|
1485
|
-
return
|
|
1437
|
+
return ha(O, S, b);
|
|
1486
1438
|
if (typeof OffscreenCanvas < "u")
|
|
1487
|
-
return
|
|
1439
|
+
return ua(O, S, b);
|
|
1488
1440
|
throw new Error("renderToPng requires Image+document (browser) or OffscreenCanvas (worker)");
|
|
1489
1441
|
}
|
|
1490
|
-
async function
|
|
1442
|
+
async function ua(e, a, t) {
|
|
1491
1443
|
const i = await (await fetch(e)).blob(), n = await createImageBitmap(i, { resizeWidth: a, resizeHeight: t }), s = new OffscreenCanvas(a, t);
|
|
1492
1444
|
s.getContext("2d").drawImage(n, 0, 0, a, t), n.close();
|
|
1493
1445
|
const d = await (await s.convertToBlob({ type: "image/png" })).arrayBuffer();
|
|
1494
1446
|
return new Uint8Array(d);
|
|
1495
1447
|
}
|
|
1496
|
-
function
|
|
1448
|
+
function ha(e, a, t) {
|
|
1497
1449
|
return new Promise((r, i) => {
|
|
1498
1450
|
const n = new Image();
|
|
1499
1451
|
n.onload = () => {
|
|
1500
1452
|
const s = document.createElement("canvas");
|
|
1501
1453
|
s.width = a, s.height = t, s.getContext("2d").drawImage(n, 0, 0, a, t), s.toBlob(
|
|
1502
|
-
(
|
|
1503
|
-
if (!
|
|
1504
|
-
|
|
1454
|
+
(y) => {
|
|
1455
|
+
if (!y) return i(new Error("Failed to render PNG from SVG"));
|
|
1456
|
+
y.arrayBuffer().then((d) => r(new Uint8Array(d)));
|
|
1505
1457
|
},
|
|
1506
1458
|
"image/png"
|
|
1507
1459
|
);
|
|
1508
1460
|
}, n.onerror = () => i(new Error("Failed to load SVG data URI for PNG render")), n.src = e;
|
|
1509
1461
|
});
|
|
1510
1462
|
}
|
|
1511
|
-
class
|
|
1463
|
+
class fa {
|
|
1512
1464
|
constructor(a, t = 30, r = 900, i = 640) {
|
|
1513
1465
|
this.elements = [], this.cursor = 0, this.theme = a, this._fps = t, this._width = r, this._height = i;
|
|
1514
1466
|
}
|
|
@@ -1602,7 +1554,7 @@ class ha {
|
|
|
1602
1554
|
y: t.y,
|
|
1603
1555
|
content: a,
|
|
1604
1556
|
fontSize: t.fontSize ?? 14,
|
|
1605
|
-
fill: t.color ?? this.theme.
|
|
1557
|
+
fill: t.color ?? this.theme.foreground,
|
|
1606
1558
|
textAnchor: t.anchor ?? "middle",
|
|
1607
1559
|
fontWeight: t.fontWeight,
|
|
1608
1560
|
fontFamily: t.fontFamily
|
|
@@ -1682,7 +1634,7 @@ class ha {
|
|
|
1682
1634
|
width: t.width,
|
|
1683
1635
|
height: t.height,
|
|
1684
1636
|
barColor: t.barColor ?? this.theme.primary,
|
|
1685
|
-
labelColor: t.labelColor ?? this.theme.
|
|
1637
|
+
labelColor: t.labelColor ?? this.theme.foreground,
|
|
1686
1638
|
labelFontSize: t.labelFontSize,
|
|
1687
1639
|
maxValue: t.maxValue,
|
|
1688
1640
|
valueFormat: t.valueFormat,
|
|
@@ -1700,7 +1652,7 @@ class ha {
|
|
|
1700
1652
|
x: (t == null ? void 0 : t.x) ?? this.cx,
|
|
1701
1653
|
y: (t == null ? void 0 : t.y) ?? 300,
|
|
1702
1654
|
cellSize: (t == null ? void 0 : t.cellSize) ?? 50,
|
|
1703
|
-
color: (t == null ? void 0 : t.color) ?? this.theme.
|
|
1655
|
+
color: (t == null ? void 0 : t.color) ?? this.theme.foreground,
|
|
1704
1656
|
bracketColor: (t == null ? void 0 : t.bracketColor) ?? this.theme.primary,
|
|
1705
1657
|
fontSize: t == null ? void 0 : t.fontSize,
|
|
1706
1658
|
fadeIn: r
|
|
@@ -1727,35 +1679,35 @@ class ha {
|
|
|
1727
1679
|
* Returns the box positions for follow-up arrows, etc.
|
|
1728
1680
|
*/
|
|
1729
1681
|
boxRow(a, t) {
|
|
1730
|
-
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,
|
|
1682
|
+
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, y = (this._width - c) / 2;
|
|
1731
1683
|
t == null || t.fadeIn;
|
|
1732
|
-
const d = a.map((
|
|
1733
|
-
const
|
|
1734
|
-
return { x
|
|
1735
|
-
}), S = a.map((
|
|
1736
|
-
var _
|
|
1737
|
-
const
|
|
1684
|
+
const d = a.map((b, g) => {
|
|
1685
|
+
const x = y + g * (r + n);
|
|
1686
|
+
return { x, y: s, w: r, h: i, cx: x + r / 2, cy: s + i / 2 };
|
|
1687
|
+
}), S = a.map((b, g) => {
|
|
1688
|
+
var $, _;
|
|
1689
|
+
const x = d[g], C = (($ = t == null ? void 0 : t.colors) == null ? void 0 : $[g]) ?? this.theme.boxFill, O = ((_ = t == null ? void 0 : t.strokeColors) == null ? void 0 : _[g]) ?? this.theme.boxStroke;
|
|
1738
1690
|
return {
|
|
1739
1691
|
type: "group",
|
|
1740
1692
|
children: [
|
|
1741
1693
|
{
|
|
1742
1694
|
type: "rect",
|
|
1743
|
-
x:
|
|
1744
|
-
y:
|
|
1695
|
+
x: x.x,
|
|
1696
|
+
y: x.y,
|
|
1745
1697
|
width: r,
|
|
1746
1698
|
height: i,
|
|
1747
1699
|
fill: C,
|
|
1748
|
-
stroke:
|
|
1700
|
+
stroke: O,
|
|
1749
1701
|
strokeWidth: 1.5,
|
|
1750
1702
|
rx: 6
|
|
1751
1703
|
},
|
|
1752
1704
|
{
|
|
1753
1705
|
type: "text",
|
|
1754
|
-
x:
|
|
1755
|
-
y:
|
|
1756
|
-
content:
|
|
1706
|
+
x: x.cx,
|
|
1707
|
+
y: x.cy + 5,
|
|
1708
|
+
content: b,
|
|
1757
1709
|
fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
|
|
1758
|
-
fill: (t == null ? void 0 : t.textColor) ?? this.theme.
|
|
1710
|
+
fill: (t == null ? void 0 : t.textColor) ?? this.theme.foreground,
|
|
1759
1711
|
textAnchor: "middle",
|
|
1760
1712
|
fontFamily: t == null ? void 0 : t.fontFamily
|
|
1761
1713
|
}
|
|
@@ -1774,12 +1726,12 @@ class ha {
|
|
|
1774
1726
|
boxColumn(a, t) {
|
|
1775
1727
|
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;
|
|
1776
1728
|
t == null || t.fadeIn;
|
|
1777
|
-
const
|
|
1778
|
-
const g = s +
|
|
1729
|
+
const y = a.map((S, b) => {
|
|
1730
|
+
const g = s + b * (i + n);
|
|
1779
1731
|
return { x: c - r / 2, y: g, w: r, h: i, cx: c, cy: g + i / 2 };
|
|
1780
|
-
}), d = a.map((S,
|
|
1781
|
-
var C,
|
|
1782
|
-
const g =
|
|
1732
|
+
}), d = a.map((S, b) => {
|
|
1733
|
+
var C, O;
|
|
1734
|
+
const g = y[b], x = ((C = t == null ? void 0 : t.colors) == null ? void 0 : C[b]) ?? this.theme.boxFill;
|
|
1783
1735
|
return {
|
|
1784
1736
|
type: "group",
|
|
1785
1737
|
children: [
|
|
@@ -1789,8 +1741,8 @@ class ha {
|
|
|
1789
1741
|
y: g.y,
|
|
1790
1742
|
width: r,
|
|
1791
1743
|
height: i,
|
|
1792
|
-
fill:
|
|
1793
|
-
stroke: (
|
|
1744
|
+
fill: x,
|
|
1745
|
+
stroke: (O = t == null ? void 0 : t.colors) != null && O[b] ? t.colors[b] : this.theme.boxStroke,
|
|
1794
1746
|
strokeWidth: 1.5,
|
|
1795
1747
|
rx: 6
|
|
1796
1748
|
},
|
|
@@ -1800,7 +1752,7 @@ class ha {
|
|
|
1800
1752
|
y: g.cy + 5,
|
|
1801
1753
|
content: S,
|
|
1802
1754
|
fontSize: (t == null ? void 0 : t.fontSize) ?? 13,
|
|
1803
|
-
fill: (t == null ? void 0 : t.textColor) ?? this.theme.
|
|
1755
|
+
fill: (t == null ? void 0 : t.textColor) ?? this.theme.foreground,
|
|
1804
1756
|
textAnchor: "middle"
|
|
1805
1757
|
}
|
|
1806
1758
|
]
|
|
@@ -1810,7 +1762,7 @@ class ha {
|
|
|
1810
1762
|
type: "stagger",
|
|
1811
1763
|
staggerDelay: 3,
|
|
1812
1764
|
children: d
|
|
1813
|
-
}, 8 + a.length * 2),
|
|
1765
|
+
}, 8 + a.length * 2), y;
|
|
1814
1766
|
}
|
|
1815
1767
|
/**
|
|
1816
1768
|
* Draw arrows connecting sequential positions (e.g., output of boxRow/boxColumn).
|
|
@@ -1893,9 +1845,46 @@ class ha {
|
|
|
1893
1845
|
return { elements: this.elements, durationInFrames: a };
|
|
1894
1846
|
}
|
|
1895
1847
|
}
|
|
1896
|
-
|
|
1848
|
+
const ga = {
|
|
1849
|
+
foreground: "#c8d6e5",
|
|
1850
|
+
background: "#0a0a1e",
|
|
1851
|
+
title: "#e0e7ff",
|
|
1852
|
+
subtitle: "#94a3b8",
|
|
1853
|
+
primary: "#4fc3f7",
|
|
1854
|
+
secondary: "#a78bfa",
|
|
1855
|
+
tertiary: "#f472b6",
|
|
1856
|
+
muted: "#64748b",
|
|
1857
|
+
surface: "#1e293b",
|
|
1858
|
+
border: "#334155",
|
|
1859
|
+
accent: "#4fc3f7",
|
|
1860
|
+
success: "#34d399",
|
|
1861
|
+
warning: "#fbbf24",
|
|
1862
|
+
error: "#f87171",
|
|
1863
|
+
boxFill: "rgba(79,195,247,0.12)",
|
|
1864
|
+
boxStroke: "#4fc3f7",
|
|
1865
|
+
palette: ["#4fc3f7", "#a78bfa", "#f472b6", "#34d399", "#fbbf24", "#fb923c", "#6366f1", "#22d3ee"]
|
|
1866
|
+
}, va = {
|
|
1867
|
+
foreground: "#334155",
|
|
1868
|
+
background: "#f8fafc",
|
|
1869
|
+
title: "#1e293b",
|
|
1870
|
+
subtitle: "#64748b",
|
|
1871
|
+
primary: "#2563eb",
|
|
1872
|
+
secondary: "#7c3aed",
|
|
1873
|
+
tertiary: "#db2777",
|
|
1874
|
+
muted: "#94a3b8",
|
|
1875
|
+
surface: "#ffffff",
|
|
1876
|
+
border: "#e2e8f0",
|
|
1877
|
+
accent: "#2563eb",
|
|
1878
|
+
success: "#16a34a",
|
|
1879
|
+
warning: "#d97706",
|
|
1880
|
+
error: "#dc2626",
|
|
1881
|
+
boxFill: "rgba(37,99,235,0.08)",
|
|
1882
|
+
boxStroke: "#2563eb",
|
|
1883
|
+
palette: ["#2563eb", "#7c3aed", "#db2777", "#16a34a", "#d97706", "#ea580c", "#4f46e5", "#0891b2"]
|
|
1884
|
+
};
|
|
1885
|
+
class oa {
|
|
1897
1886
|
constructor(a, t, r) {
|
|
1898
|
-
this._slides = [], this._title = a, this._theme = t ??
|
|
1887
|
+
this._slides = [], this._title = a, this._theme = t ?? ga, this._opts = {
|
|
1899
1888
|
width: 900,
|
|
1900
1889
|
height: 640,
|
|
1901
1890
|
fps: 30,
|
|
@@ -1913,7 +1902,7 @@ class fa {
|
|
|
1913
1902
|
/** Build the final ElucimDocument */
|
|
1914
1903
|
build() {
|
|
1915
1904
|
const a = this._slides.map((r) => {
|
|
1916
|
-
const i = new
|
|
1905
|
+
const i = new fa(
|
|
1917
1906
|
this._theme,
|
|
1918
1907
|
this._opts.fps,
|
|
1919
1908
|
this._opts.width,
|
|
@@ -1959,31 +1948,36 @@ class fa {
|
|
|
1959
1948
|
return JSON.stringify(this.build(), null, a ? 2 : void 0);
|
|
1960
1949
|
}
|
|
1961
1950
|
}
|
|
1962
|
-
function
|
|
1963
|
-
return new
|
|
1951
|
+
function ka(e, a, t) {
|
|
1952
|
+
return new oa(e, a, t);
|
|
1964
1953
|
}
|
|
1965
1954
|
export {
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1955
|
+
$a as DARK_THEME,
|
|
1956
|
+
Ca as DARK_THEME_VARS,
|
|
1957
|
+
da as DslRenderer,
|
|
1958
|
+
Oa as LIGHT_THEME,
|
|
1959
|
+
Aa as LIGHT_THEME_VARS,
|
|
1960
|
+
oa as PresentationBuilder,
|
|
1961
|
+
pa as SEMANTIC_TOKENS,
|
|
1962
|
+
fa as SlideBuilder,
|
|
1963
|
+
za as TOKEN_NAMES,
|
|
1964
|
+
It as compileExpression,
|
|
1965
|
+
St as compileVectorExpression,
|
|
1966
|
+
ga as darkTheme,
|
|
1967
|
+
va as lightTheme,
|
|
1968
|
+
ka as presentation,
|
|
1976
1969
|
w as renderElement,
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1970
|
+
oe as renderPlayer,
|
|
1971
|
+
ea as renderPresentation,
|
|
1972
|
+
ge as renderRoot,
|
|
1973
|
+
J as renderScene,
|
|
1974
|
+
ta as renderSlide,
|
|
1975
|
+
wa as renderToPng,
|
|
1976
|
+
la as renderToSvgString,
|
|
1977
|
+
Ea as resolveColor,
|
|
1985
1978
|
f as resolveEasing,
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1979
|
+
se as stripCssFunctions,
|
|
1980
|
+
Ra as themeToVars,
|
|
1981
|
+
le as validate,
|
|
1982
|
+
ce as validateExpression
|
|
1989
1983
|
};
|