@kolkrabbi/design-editor 0.29.0 → 0.31.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.
@@ -1,3200 +0,0 @@
1
- import { $t as e, C as t, Cn as n, D as r, En as i, F as a, I as o, J as s, L as c, On as l, Qt as u, S as d, a as f, bn as p, c as m, d as h, f as g, it as _, kn as v, l as ee, m as te, n as y, nt as ne, o as re, p as b, s as x, t as ie, tn as S, u as ae, vn as oe, x as se } from "./rolls-CGma4Bua.js";
2
- import { c as ce, n as C, t as le } from "./useLayerEdit-CnPxtfWc.js";
3
- import { C as ue, D as w, E as T, O as de, S as fe, T as E, _ as D, at as pe, b as me, ct as he, d as ge, dt as O, f as k, ft as _e, h as ve, ht as A, it as ye, l as j, lt as be, m as M, mt as N, n as P, nt as xe, ot as Se, pt as Ce, r as F, rt as we, st as Te, t as I, tt as Ee, v as De, w as Oe, x as L, y as R } from "./effectCategories-DJrQJ7vg.js";
4
- import { n as z, t as ke } from "./TreePicker-BQYPaQv3.js";
5
- import { A as Ae, D as je, c as Me, n as Ne } from "./ColorModesWindow-D65R5YR5.js";
6
- import { h as Pe, r as Fe, s as Ie, t as Le, u as Re } from "./morphStore-DaOLa9oj.js";
7
- import { BezierPathEditor as ze, Button as B, CurveEditor as Be, Divider as Ve, Dropdown as V, FullscreenOverlay as He, KeyframeEditor as Ue, LabeledControl as H, LabeledControlSection as U, SegmentedToggle as We, SettingsRow as Ge, ShellSearchOverlay as Ke, Slider as qe, StepList as Je, ToggleSwitch as Ye, Tooltip as W, ViewToggle as Xe, XYPad as Ze } from "@kolkrabbi/kol-component";
8
- import { useCallback as Qe, useEffect as $e, useId as et, useMemo as tt, useState as nt } from "react";
9
- import { Fragment as G, jsx as K, jsxs as q } from "react/jsx-runtime";
10
- //#region src/loops/taxonomy.js
11
- var rt = [
12
- {
13
- label: "Scanline",
14
- groups: ["scanline"]
15
- },
16
- {
17
- label: "Pattern",
18
- groups: [
19
- "pattern",
20
- "patternloop",
21
- "field"
22
- ],
23
- labels: { pattern: "Rules" }
24
- },
25
- {
26
- label: "Loops",
27
- groups: ["shape"]
28
- },
29
- {
30
- label: "Math",
31
- groups: ["math"]
32
- },
33
- {
34
- label: "Penrose",
35
- groups: ["penrose"]
36
- },
37
- {
38
- label: "Flow",
39
- groups: ["flow"]
40
- },
41
- {
42
- label: "Letter Gap",
43
- groups: ["lettergap"]
44
- },
45
- {
46
- label: "Drift",
47
- groups: ["drift"]
48
- },
49
- {
50
- label: "Gradients",
51
- groups: ["gradients"]
52
- },
53
- {
54
- label: "Soft Forms",
55
- groups: ["softforms"]
56
- },
57
- {
58
- label: "3D Scene",
59
- groups: [
60
- "scene",
61
- "ribbon",
62
- "forms",
63
- "environment",
64
- "abstract",
65
- "softforms3d"
66
- ],
67
- labels: {
68
- scene: "Primitive",
69
- softforms3d: "Soft forms"
70
- }
71
- }
72
- ], it = [{
73
- label: "Para Type",
74
- groups: ["paratype"]
75
- }], at = rt, ot = {
76
- optic: "Pattern · Effects",
77
- paratype: "Para Type · Misc",
78
- distress: "Distressor · Vector",
79
- modulator: "Modulator · Vector"
80
- }, st = Object.fromEntries(Ee.params.map((e) => [e.key, e.default]));
81
- function ct(e) {
82
- let t = { ...st };
83
- for (let n of Object.keys(st)) {
84
- let r = e[n];
85
- r != null && typeof r != "object" && (t[n] = r);
86
- }
87
- return t;
88
- }
89
- function lt(e, t) {
90
- let n = t.stemWidth ?? 18, r = 0;
91
- return (t.serif ?? 0) > 0 && (r = Math.max(2, n * .7) * t.serif + (t.jut ?? 0) * n * 1.5 + 1), e === "i" && (r = Math.max(r, n * .1 + 1)), r;
92
- }
93
- var J = (e) => Number(e.toFixed(2));
94
- function ut(e, t, n) {
95
- if (!e || e.loopId !== "paratype-glyph") return null;
96
- let r = Math.max(1, e.w ?? 480), i = Math.max(1, e.h ?? 480), a = ct(e), o = xe(a, r, i);
97
- if (!o.length) return null;
98
- let s = [];
99
- t.bg && s.push({
100
- id: n("shape"),
101
- type: "shape",
102
- kind: "rect",
103
- color: t.bg,
104
- x: 0,
105
- y: 0,
106
- w: r,
107
- h: i,
108
- visible: !0,
109
- opacity: 1,
110
- blend: "normal"
111
- });
112
- for (let e of o) {
113
- let r = lt(e.name, a) + 1.5, i = 1.5, o = e.gw + r * 2, c = e.gh + i * 2, l = e.g.paths.map((e) => `<path d="${e.d.replace(/\s+/g, " ").trim()}"${e.fillRule ? ` fill-rule="${e.fillRule}"` : ""} fill="currentColor"/>`).join(""), u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${J(o)} ${J(c)}" preserveAspectRatio="none"><g transform="translate(${J(r)} ${J(e.y1 + i)}) scale(1 -1)">${l}</g></svg>`;
114
- s.push({
115
- id: n("shape"),
116
- type: "shape",
117
- kind: "flatten",
118
- svg: u,
119
- fit: "fill",
120
- color: t.fg,
121
- x: J(e.tx - r * e.s),
122
- y: J(e.ty - (e.y1 + i) * e.s),
123
- w: Math.max(1, J(o * e.s)),
124
- h: Math.max(1, J(c * e.s)),
125
- visible: !0,
126
- opacity: 1,
127
- blend: "normal"
128
- });
129
- }
130
- return {
131
- id: n("group"),
132
- type: "group",
133
- x: e.x ?? 0,
134
- y: e.y ?? 0,
135
- w: r,
136
- h: i,
137
- visible: e.visible ?? !0,
138
- opacity: e.opacity ?? 1,
139
- blend: e.blend ?? "normal",
140
- children: s
141
- };
142
- }
143
- //#endregion
144
- //#region src/editor/labs/presetStep.js
145
- function Y(e, t) {
146
- return {
147
- loopGroup: t,
148
- presetId: e.id,
149
- presetLabel: e.label,
150
- loopId: e.loop,
151
- _framePreset: "custom",
152
- _formPreset: "custom",
153
- _lookPreset: "custom",
154
- ...E(e)
155
- };
156
- }
157
- function dt(e, t, n = "preset") {
158
- if (!e?.loopGroup) return null;
159
- let r = e.loopGroup, i = T(r);
160
- if (!i.length) return null;
161
- let a = i.find((t) => t.id === e.presetId) ?? i[0], o = (e, t) => (e % t + t) % t;
162
- if (n === "category") {
163
- let e = [...new Set(i.map((e) => e.sub).filter(Boolean))];
164
- if (e.length < 2) return null;
165
- let n = e[o(e.indexOf(a.sub) + t, e.length)];
166
- return Y(i.find((e) => e.sub === n), r);
167
- }
168
- let s = a.sub ? i.filter((e) => e.sub === a.sub) : i;
169
- return s.length < 2 ? null : Y(s[o(s.indexOf(a) + t, s.length)], r);
170
- }
171
- var ft = {
172
- h: ["preset", -1],
173
- ArrowLeft: ["preset", -1],
174
- l: ["preset", 1],
175
- ArrowRight: ["preset", 1],
176
- k: ["category", -1],
177
- ArrowUp: ["category", -1],
178
- j: ["category", 1],
179
- ArrowDown: ["category", 1]
180
- };
181
- function pt(e, t, n) {
182
- let r = e?.loopGroup;
183
- if (!r) return !1;
184
- let i = T(r).filter((e) => !R(e)), a = i.find((t) => t.id === e.presetId) ?? i[0];
185
- return t === "type" ? n.some((e) => e !== r && T(e).some((e) => !R(e))) : t === "category" ? new Set(i.map((e) => e.sub).filter((e) => e && e !== a?.sub)).size > 0 : i.some((e) => e.id !== a?.id && (!a?.sub || e.sub === a.sub));
186
- }
187
- function mt(e, t, n, r) {
188
- let i = e?.loopGroup;
189
- if (!i) return null;
190
- let a = (e) => e[Math.floor(n() * e.length)], o = (e) => T(e).filter((e) => !R(e));
191
- if (t === "type") {
192
- let e = r.filter((e) => e !== i && o(e).length);
193
- if (!e.length) return null;
194
- let t = a(e);
195
- return Y(a(o(t)), t);
196
- }
197
- let s = o(i), c = s.find((t) => t.id === e.presetId) ?? s[0];
198
- if (t === "category") {
199
- let e = [...new Set(s.map((e) => e.sub).filter((e) => e && e !== c?.sub))];
200
- if (!e.length) return null;
201
- let t = a(e);
202
- return Y(a(s.filter((e) => e.sub === t)), i);
203
- }
204
- let l = s.filter((e) => e.id !== c?.id && (!c?.sub || e.sub === c.sub));
205
- return l.length ? Y(a(l), i) : null;
206
- }
207
- function ht(e, t, n) {
208
- let r = {};
209
- for (let i of t) {
210
- if (i.type !== "range" || i.noRandom || i.min == null || i.max == null) continue;
211
- let t = e[i.key];
212
- if (typeof t == "object" && t) continue;
213
- let a = Number(t ?? i.default ?? i.min), o = i.max - i.min, s = a + (n() - .5) * .3 * o;
214
- s = Math.min(i.max, Math.max(i.min, s)), i.step && (s = Math.round((s - i.min) / i.step) * i.step + i.min), r[i.key] = +s.toFixed(6);
215
- }
216
- return r;
217
- }
218
- var gt = null, _t = () => gt ??= [...F(k).filter((e) => !e.rack).map((e) => ({
219
- id: e.id,
220
- filters: e.filters
221
- })), ...I.map((e) => ({
222
- id: e.id,
223
- filters: ge(e, k)
224
- }))].filter((e) => e.filters.length);
225
- function vt(e, t, n) {
226
- let r = (e) => e[Math.floor(n() * e.length)], i = P(e);
227
- if (t === "type") {
228
- let e = _t().filter((e) => e.id !== i);
229
- return e.length ? r(r(e).filters).id : null;
230
- }
231
- let a = _t().find((e) => e.id === i)?.filters.filter((t) => t.id !== e) ?? [];
232
- return a.length ? r(a).id : null;
233
- }
234
- function yt(e, t, n) {
235
- let r = j(e?.id), i = (e?.params.find((e) => e.key === r)?.options ?? []).map((e) => typeof e == "object" ? e.value : e).filter((e) => e !== t[r]);
236
- return i.length ? i[Math.floor(n() * i.length)] : null;
237
- }
238
- function bt(e, t) {
239
- return e ? t === "type" ? _t().length > 1 : t === "category" ? (_t().find((t) => t.id === P(e.id))?.filters.length ?? 0) > 1 : t === "preset" ? !!j(e.id) : !0 : !1;
240
- }
241
- //#endregion
242
- //#region src/editor/compose/inspectors/LoopPicker.jsx
243
- function xt({ layer: e, tree: t = at, inline: n = !0, about: r = null }) {
244
- let { updateLayer: i } = s(), a = c(), o = e.loopGroup ?? "shape", l = t.find((e) => e.groups.includes(o)) ?? null, u = T(o), d = u.find((t) => t.id === e.presetId), f = [...new Set(u.map((e) => e.sub).filter(Boolean))], p = d?.sub ?? f[0], m = f.length ? u.filter((e) => e.sub === p) : u, h = (t, n = o) => {
245
- t && i(e.id, {
246
- loopGroup: n,
247
- presetId: t.id,
248
- presetLabel: t.label,
249
- loopId: t.loop,
250
- _framePreset: "custom",
251
- _formPreset: "custom",
252
- _lookPreset: "custom",
253
- ...E(t)
254
- });
255
- };
256
- return /* @__PURE__ */ q(G, { children: [
257
- t.length > 1 || !l ? /* @__PURE__ */ K(z, {
258
- label: "Type",
259
- inline: n,
260
- children: /* @__PURE__ */ q("div", {
261
- className: "flex flex-col gap-1 w-full",
262
- children: [l ? /* @__PURE__ */ K(ke, {
263
- options: t.map((e) => ({
264
- value: e.label,
265
- label: e.label
266
- })),
267
- value: l.label,
268
- onChange: (e) => {
269
- let n = t.find((t) => t.label === e);
270
- n && h(T(n.groups[0])[0], n.groups[0]);
271
- }
272
- }) : /* @__PURE__ */ K("span", {
273
- className: "kol-helper-12 text-meta px-1",
274
- children: ot[o] ?? D(o).label
275
- }), l && l.groups.length > 1 && /* @__PURE__ */ K(ke, {
276
- options: l.groups.map((e) => ({
277
- value: e,
278
- label: l.labels?.[e] ?? D(e).label
279
- })),
280
- value: o,
281
- onChange: (e) => h(T(e)[0], e)
282
- })]
283
- })
284
- }) : null,
285
- f.length > 1 && /* @__PURE__ */ K(z, {
286
- inline: n,
287
- label: "Category",
288
- options: f.map((e) => ({
289
- value: e,
290
- label: e
291
- })),
292
- value: p,
293
- onChange: (e) => h(u.find((t) => t.sub === e))
294
- }),
295
- /* @__PURE__ */ K(z, {
296
- inline: n,
297
- label: "Preset",
298
- children: /* @__PURE__ */ q("div", {
299
- className: "flex w-full gap-1",
300
- children: [
301
- m.length > 1 && /* @__PURE__ */ K(B, {
302
- size: a,
303
- iconOnly: "chevron-left",
304
- "aria-label": "Previous preset (H)",
305
- onClick: () => {
306
- let t = dt(e, -1);
307
- t && i(e.id, t);
308
- }
309
- }),
310
- /* @__PURE__ */ K(ke, {
311
- className: "flex-1 min-w-0",
312
- options: m.map((e) => ({
313
- value: e.id,
314
- label: e.label
315
- })),
316
- value: e.presetId,
317
- onChange: (e) => h(u.find((t) => t.id === e))
318
- }),
319
- m.length > 1 && /* @__PURE__ */ K(B, {
320
- size: a,
321
- iconOnly: "chevron-right",
322
- "aria-label": "Next preset (L)",
323
- onClick: () => {
324
- let t = dt(e, 1);
325
- t && i(e.id, t);
326
- }
327
- }),
328
- r
329
- ]
330
- })
331
- })
332
- ] });
333
- }
334
- //#endregion
335
- //#region src/editor/params/RollScopesDialog.jsx
336
- function St({ open: e, onClose: t, schema: n, layer: r, size: i = "md" }) {
337
- if (p(), !e) return null;
338
- let a = re(n ?? [], r);
339
- return /* @__PURE__ */ K(He, {
340
- open: !0,
341
- scrim: !0,
342
- onClose: t,
343
- children: /* @__PURE__ */ q("div", {
344
- className: "kol-roll-scopes flex flex-col gap-4 p-5 rounded bg-surface-primary border border-oq-08",
345
- style: { width: "min(420px, calc(100vw - 32px))" },
346
- children: [
347
- /* @__PURE__ */ K("p", {
348
- className: "kol-eyebrow text-fg-96",
349
- children: "Randomize all rolls"
350
- }),
351
- /* @__PURE__ */ q(U, {
352
- divided: !0,
353
- children: [a.map((e) => /* @__PURE__ */ K(Ge, {
354
- label: e.label,
355
- children: /* @__PURE__ */ K(Ye, {
356
- checked: m(e.id),
357
- onChange: (t) => ee(e.id, t),
358
- "aria-label": e.label
359
- })
360
- }, e.id)), /* @__PURE__ */ K(Ge, {
361
- label: "Effects",
362
- children: /* @__PURE__ */ K(Ye, {
363
- checked: x(),
364
- onChange: (e) => oe("rollEffects", !!e),
365
- "aria-label": "Effects"
366
- })
367
- })]
368
- }),
369
- /* @__PURE__ */ K("p", {
370
- className: "kol-mono-12 text-meta",
371
- children: "A scope switched off still rolls from its own button."
372
- }),
373
- /* @__PURE__ */ K(B, {
374
- tone: "primary",
375
- size: i,
376
- className: "w-full",
377
- onClick: t,
378
- children: "Done"
379
- })
380
- ]
381
- })
382
- });
383
- }
384
- //#endregion
385
- //#region src/editor/params/motionPresets.js
386
- var Ct = (e) => l("generators")?.loopById(e) ?? null, wt = {
387
- frame: [
388
- {
389
- id: "static",
390
- label: "Static",
391
- params: { flow: 0 }
392
- },
393
- {
394
- id: "drift",
395
- label: "Drift",
396
- params: {
397
- flow: 1,
398
- spin: 0
399
- }
400
- },
401
- {
402
- id: "spin",
403
- label: "Spin",
404
- params: {
405
- flow: 1,
406
- spin: 1
407
- }
408
- },
409
- {
410
- id: "rush",
411
- label: "Rush",
412
- params: {
413
- flow: 2,
414
- spin: 0
415
- }
416
- }
417
- ],
418
- form: [
419
- {
420
- id: "static",
421
- label: "Static",
422
- params: {
423
- sweep: 0,
424
- pulse: 0
425
- }
426
- },
427
- {
428
- id: "sweep",
429
- label: "Sweep",
430
- params: {
431
- sweep: .6,
432
- pulse: 0
433
- }
434
- },
435
- {
436
- id: "breathe",
437
- label: "Breathe",
438
- params: {
439
- sweep: 0,
440
- pulse: .5
441
- }
442
- },
443
- {
444
- id: "ripple",
445
- label: "Ripple",
446
- params: {
447
- sweep: .5,
448
- pulse: .4
449
- }
450
- }
451
- ]
452
- }, Tt = [
453
- {
454
- id: "static",
455
- label: "Static",
456
- params: { camFlow: 0 }
457
- },
458
- {
459
- id: "pan-right",
460
- label: "Pan Right",
461
- params: {
462
- camFlow: 1,
463
- panDir: "right"
464
- }
465
- },
466
- {
467
- id: "pan-left",
468
- label: "Pan Left",
469
- params: {
470
- camFlow: 1,
471
- panDir: "left"
472
- }
473
- },
474
- {
475
- id: "pan-up",
476
- label: "Pan Up",
477
- params: {
478
- camFlow: 1,
479
- panDir: "up"
480
- }
481
- },
482
- {
483
- id: "pan-down",
484
- label: "Pan Down",
485
- params: {
486
- camFlow: 1,
487
- panDir: "down"
488
- }
489
- },
490
- {
491
- id: "drift",
492
- label: "Drift",
493
- params: {
494
- camFlow: 1,
495
- panDir: "diag"
496
- }
497
- },
498
- {
499
- id: "glide",
500
- label: "Glide",
501
- params: {
502
- camFlow: 2,
503
- panDir: "anti"
504
- }
505
- }
506
- ], Et = [
507
- {
508
- id: "static",
509
- label: "Static",
510
- params: {
511
- spin: 0,
512
- animAxis: "none",
513
- animCycles: 1,
514
- animWaves: 2,
515
- pulse: 0,
516
- fade: 0,
517
- swing: 0,
518
- colorMix: 0
519
- }
520
- },
521
- {
522
- id: "spin",
523
- label: "Spin",
524
- params: {
525
- spin: 1,
526
- animAxis: "none",
527
- animCycles: 1,
528
- animWaves: 2,
529
- pulse: 0,
530
- fade: 0,
531
- swing: 0,
532
- colorMix: 0
533
- }
534
- },
535
- {
536
- id: "breathe",
537
- label: "Breathe",
538
- params: {
539
- spin: 0,
540
- animAxis: "radial",
541
- animCycles: 1,
542
- animWaves: 2,
543
- pulse: .6,
544
- fade: 0,
545
- swing: 0,
546
- colorMix: 0
547
- }
548
- },
549
- {
550
- id: "pulse-wave",
551
- label: "Pulse Wave",
552
- params: {
553
- spin: 0,
554
- animAxis: "diag",
555
- animCycles: 1,
556
- animWaves: 3,
557
- pulse: .7,
558
- fade: 0,
559
- swing: 0,
560
- colorMix: 0
561
- }
562
- },
563
- {
564
- id: "fade-wave",
565
- label: "Fade Wave",
566
- params: {
567
- spin: 0,
568
- animAxis: "col",
569
- animCycles: 1,
570
- animWaves: 2,
571
- pulse: 0,
572
- fade: .8,
573
- swing: 0,
574
- colorMix: 0
575
- }
576
- },
577
- {
578
- id: "sway",
579
- label: "Sway",
580
- params: {
581
- spin: 0,
582
- animAxis: "diag",
583
- animCycles: 1,
584
- animWaves: 2,
585
- pulse: 0,
586
- fade: 0,
587
- swing: 60,
588
- colorMix: 0
589
- }
590
- },
591
- {
592
- id: "colour-sweep",
593
- label: "Color Sweep",
594
- params: {
595
- spin: 0,
596
- animAxis: "diag",
597
- animCycles: 1,
598
- animWaves: 2,
599
- pulse: 0,
600
- fade: 0,
601
- swing: 0,
602
- colorMix: 1
603
- }
604
- },
605
- {
606
- id: "ripple",
607
- label: "Ripple",
608
- params: {
609
- spin: 0,
610
- animAxis: "radial",
611
- animCycles: 1,
612
- animWaves: 4,
613
- pulse: .5,
614
- fade: .5,
615
- swing: 0,
616
- colorMix: 0
617
- }
618
- }
619
- ], Dt = [
620
- {
621
- id: "static",
622
- label: "Static",
623
- params: {
624
- camFlow: 0,
625
- panDir: "right"
626
- }
627
- },
628
- {
629
- id: "drift",
630
- label: "Drift",
631
- params: {
632
- camFlow: 1,
633
- panDir: "right"
634
- }
635
- },
636
- {
637
- id: "reverse",
638
- label: "Reverse",
639
- params: {
640
- camFlow: 1,
641
- panDir: "left"
642
- }
643
- },
644
- {
645
- id: "glide",
646
- label: "Glide",
647
- params: {
648
- camFlow: 2,
649
- panDir: "right"
650
- }
651
- },
652
- {
653
- id: "rush",
654
- label: "Rush",
655
- params: {
656
- camFlow: 3,
657
- panDir: "right"
658
- }
659
- },
660
- {
661
- id: "bias",
662
- label: "Bias",
663
- params: {
664
- camFlow: 1,
665
- panDir: "right",
666
- stripeAngle: 30
667
- }
668
- },
669
- {
670
- id: "diagonal",
671
- label: "Diagonal",
672
- params: {
673
- camFlow: 1,
674
- panDir: "right",
675
- stripeAngle: 45
676
- }
677
- },
678
- {
679
- id: "counter",
680
- label: "Counter",
681
- params: {
682
- camFlow: 1,
683
- panDir: "right",
684
- stripeAngle: 135
685
- }
686
- }
687
- ], Ot = [
688
- {
689
- id: "static",
690
- label: "Static",
691
- params: {
692
- camFlow: 0,
693
- waveFlow: 0,
694
- panDir: "right"
695
- }
696
- },
697
- {
698
- id: "drift",
699
- label: "Drift",
700
- params: {
701
- camFlow: 1,
702
- waveFlow: 0,
703
- panDir: "right"
704
- }
705
- },
706
- {
707
- id: "travel",
708
- label: "Travel",
709
- params: {
710
- camFlow: 0,
711
- waveFlow: 1,
712
- panDir: "right"
713
- }
714
- },
715
- {
716
- id: "both",
717
- label: "Both",
718
- params: {
719
- camFlow: 1,
720
- waveFlow: 1,
721
- panDir: "right"
722
- }
723
- },
724
- {
725
- id: "reverse",
726
- label: "Reverse",
727
- params: {
728
- camFlow: 1,
729
- waveFlow: 0,
730
- panDir: "left"
731
- }
732
- },
733
- {
734
- id: "glide",
735
- label: "Glide",
736
- params: {
737
- camFlow: 1,
738
- waveFlow: 2,
739
- panDir: "right"
740
- }
741
- },
742
- {
743
- id: "diagonal",
744
- label: "Diagonal",
745
- params: {
746
- camFlow: 1,
747
- waveFlow: 1,
748
- panDir: "right",
749
- stripeAngle: 45
750
- }
751
- }
752
- ], kt = [
753
- {
754
- id: "static",
755
- label: "Static",
756
- params: {
757
- fieldSway: 0,
758
- fieldStagger: 0,
759
- fieldCycles: 1
760
- }
761
- },
762
- {
763
- id: "sway",
764
- label: "Sway",
765
- params: {
766
- fieldSway: .5,
767
- fieldStagger: .3,
768
- fieldCycles: 1
769
- }
770
- },
771
- {
772
- id: "alternate",
773
- label: "Alternate",
774
- params: {
775
- fieldSway: .6,
776
- fieldStagger: 1,
777
- fieldCycles: 1
778
- }
779
- },
780
- {
781
- id: "ripple",
782
- label: "Ripple",
783
- params: {
784
- fieldSway: .45,
785
- fieldStagger: .5,
786
- fieldCycles: 1
787
- }
788
- }
789
- ], At = [
790
- {
791
- id: "static",
792
- label: "Static",
793
- params: {
794
- animAxis: "none",
795
- animCycles: 1,
796
- animWaves: 2,
797
- pulse: 0,
798
- fade: 0
799
- }
800
- },
801
- {
802
- id: "pulse",
803
- label: "Pulse",
804
- params: {
805
- animAxis: "diag",
806
- animCycles: 1,
807
- animWaves: 3,
808
- pulse: .6,
809
- fade: 0
810
- }
811
- },
812
- {
813
- id: "fade",
814
- label: "Fade",
815
- params: {
816
- animAxis: "col",
817
- animCycles: 1,
818
- animWaves: 2,
819
- pulse: 0,
820
- fade: .7
821
- }
822
- },
823
- {
824
- id: "ripple",
825
- label: "Ripple",
826
- params: {
827
- animAxis: "radial",
828
- animCycles: 1,
829
- animWaves: 4,
830
- pulse: .4,
831
- fade: .4
832
- }
833
- }
834
- ], jt = {
835
- frame: [
836
- {
837
- id: "static",
838
- label: "Static",
839
- params: { flow: 0 }
840
- },
841
- {
842
- id: "drift",
843
- label: "Drift",
844
- params: {
845
- flow: 1,
846
- panDir: "right"
847
- }
848
- },
849
- {
850
- id: "reverse",
851
- label: "Reverse",
852
- params: {
853
- flow: 1,
854
- panDir: "left"
855
- }
856
- },
857
- {
858
- id: "rise",
859
- label: "Rise",
860
- params: {
861
- flow: 1,
862
- panDir: "up"
863
- }
864
- },
865
- {
866
- id: "fall",
867
- label: "Fall",
868
- params: {
869
- flow: 1,
870
- panDir: "down"
871
- }
872
- },
873
- {
874
- id: "diagonal",
875
- label: "Diagonal",
876
- params: {
877
- flow: 1,
878
- panDir: "diag"
879
- }
880
- },
881
- {
882
- id: "glide",
883
- label: "Glide",
884
- params: {
885
- flow: 2,
886
- panDir: "anti"
887
- }
888
- },
889
- {
890
- id: "rush",
891
- label: "Rush",
892
- params: {
893
- flow: 3,
894
- panDir: "right"
895
- }
896
- }
897
- ],
898
- form: [
899
- {
900
- id: "static",
901
- label: "Static",
902
- params: {
903
- speed: 0,
904
- stagger: 0,
905
- pulse: 0,
906
- fade: 0,
907
- swing: 0
908
- }
909
- },
910
- {
911
- id: "scroll",
912
- label: "Scroll",
913
- params: {
914
- speed: .45,
915
- stagger: 0,
916
- pulse: 0,
917
- fade: 0,
918
- swing: 0
919
- }
920
- },
921
- {
922
- id: "morph",
923
- label: "Morph",
924
- params: {
925
- speed: .3,
926
- stagger: .5,
927
- pulse: 0,
928
- fade: 0,
929
- swing: 0
930
- }
931
- },
932
- {
933
- id: "sway",
934
- label: "Sway",
935
- params: {
936
- speed: .3,
937
- stagger: 0,
938
- pulse: 0,
939
- fade: 0,
940
- swing: 30
941
- }
942
- },
943
- {
944
- id: "breathe",
945
- label: "Breathe",
946
- params: {
947
- speed: .3,
948
- stagger: 0,
949
- pulse: .6,
950
- fade: 0,
951
- swing: 0
952
- }
953
- },
954
- {
955
- id: "shimmer",
956
- label: "Shimmer",
957
- params: {
958
- speed: .4,
959
- stagger: 0,
960
- pulse: 0,
961
- fade: .7,
962
- swing: 0
963
- }
964
- },
965
- {
966
- id: "rich",
967
- label: "Rich",
968
- params: {
969
- speed: .4,
970
- stagger: .35,
971
- pulse: .4,
972
- fade: .3,
973
- swing: 18
974
- }
975
- }
976
- ]
977
- }, Mt = {
978
- frame: [
979
- {
980
- id: "static",
981
- label: "Static",
982
- params: { spin: 0 }
983
- },
984
- {
985
- id: "orbit",
986
- label: "Orbit",
987
- params: { spin: 1 }
988
- },
989
- {
990
- id: "spin",
991
- label: "Spin",
992
- params: { spin: 2 }
993
- }
994
- ],
995
- form: [
996
- {
997
- id: "static",
998
- label: "Static",
999
- params: {
1000
- morph: 0,
1001
- ripple: 0,
1002
- fade: 0
1003
- }
1004
- },
1005
- {
1006
- id: "breathe",
1007
- label: "Breathe",
1008
- params: {
1009
- morph: .25,
1010
- ripple: 0,
1011
- fade: 0
1012
- }
1013
- },
1014
- {
1015
- id: "pulse",
1016
- label: "Pulse",
1017
- params: {
1018
- morph: .5,
1019
- ripple: 0,
1020
- fade: 0
1021
- }
1022
- },
1023
- {
1024
- id: "ripple",
1025
- label: "Ripple",
1026
- params: {
1027
- morph: 0,
1028
- ripple: .6,
1029
- fade: 0
1030
- }
1031
- },
1032
- {
1033
- id: "shimmer",
1034
- label: "Shimmer",
1035
- params: {
1036
- morph: 0,
1037
- ripple: 0,
1038
- fade: .6
1039
- }
1040
- },
1041
- {
1042
- id: "rich",
1043
- label: "Rich",
1044
- params: {
1045
- morph: .3,
1046
- ripple: .4,
1047
- fade: .3
1048
- }
1049
- }
1050
- ]
1051
- }, Nt = {
1052
- frame: [
1053
- {
1054
- id: "static",
1055
- label: "Static",
1056
- params: {
1057
- flowSpeed: 0,
1058
- swirl: 0,
1059
- drift: 0
1060
- }
1061
- },
1062
- {
1063
- id: "drift",
1064
- label: "Drift",
1065
- params: {
1066
- flowSpeed: 1,
1067
- swirl: 0,
1068
- drift: 0
1069
- }
1070
- },
1071
- {
1072
- id: "wind",
1073
- label: "Wind",
1074
- params: {
1075
- flowSpeed: 1,
1076
- swirl: 0,
1077
- drift: .6,
1078
- driftDir: "right"
1079
- }
1080
- },
1081
- {
1082
- id: "vortex",
1083
- label: "Vortex",
1084
- params: {
1085
- flowSpeed: 1,
1086
- swirl: .5,
1087
- drift: 0
1088
- }
1089
- },
1090
- {
1091
- id: "rush",
1092
- label: "Rush",
1093
- params: {
1094
- flowSpeed: 2.4,
1095
- swirl: 0,
1096
- drift: 0
1097
- }
1098
- }
1099
- ],
1100
- form: [
1101
- {
1102
- id: "lines",
1103
- label: "Lines",
1104
- params: {
1105
- dots: !1,
1106
- pulse: 0,
1107
- jitter: 0
1108
- }
1109
- },
1110
- {
1111
- id: "dots",
1112
- label: "Dots",
1113
- params: {
1114
- dots: !0,
1115
- pulse: 0,
1116
- jitter: 0
1117
- }
1118
- },
1119
- {
1120
- id: "pulse",
1121
- label: "Pulse",
1122
- params: {
1123
- dots: !1,
1124
- pulse: .6,
1125
- jitter: 0
1126
- }
1127
- },
1128
- {
1129
- id: "shimmer",
1130
- label: "Shimmer",
1131
- params: {
1132
- dots: !0,
1133
- pulse: .3,
1134
- jitter: .5
1135
- }
1136
- }
1137
- ]
1138
- }, Pt = {
1139
- frame: [
1140
- {
1141
- id: "static",
1142
- label: "Static",
1143
- params: {
1144
- hueSpeed: 0,
1145
- cspin: 0,
1146
- czoom: 0
1147
- }
1148
- },
1149
- {
1150
- id: "cycle",
1151
- label: "Cycle",
1152
- params: {
1153
- hueSpeed: 1,
1154
- cspin: 0,
1155
- czoom: 0
1156
- }
1157
- },
1158
- {
1159
- id: "turn",
1160
- label: "Turn",
1161
- params: {
1162
- hueSpeed: .4,
1163
- cspin: .6,
1164
- czoom: 0
1165
- }
1166
- },
1167
- {
1168
- id: "breathe",
1169
- label: "Breathe",
1170
- params: {
1171
- hueSpeed: .4,
1172
- cspin: 0,
1173
- czoom: .6
1174
- }
1175
- },
1176
- {
1177
- id: "rush",
1178
- label: "Rush",
1179
- params: {
1180
- hueSpeed: 2,
1181
- cspin: 1,
1182
- czoom: 0
1183
- }
1184
- }
1185
- ],
1186
- form: [
1187
- {
1188
- id: "static",
1189
- label: "Static",
1190
- params: {
1191
- ringSpeed: 0,
1192
- shade: 0
1193
- }
1194
- },
1195
- {
1196
- id: "rings",
1197
- label: "Rings",
1198
- params: {
1199
- ringSpeed: 1,
1200
- shade: 0
1201
- }
1202
- },
1203
- {
1204
- id: "pulse",
1205
- label: "Pulse",
1206
- params: {
1207
- ringSpeed: 1,
1208
- shade: .4
1209
- }
1210
- },
1211
- {
1212
- id: "fast",
1213
- label: "Fast",
1214
- params: {
1215
- ringSpeed: 2.4,
1216
- shade: 0
1217
- }
1218
- }
1219
- ]
1220
- }, Ft = {
1221
- frame: [
1222
- {
1223
- id: "static",
1224
- label: "Static",
1225
- params: {
1226
- vpSpin: 0,
1227
- vpZoom: 1
1228
- }
1229
- },
1230
- {
1231
- id: "spin",
1232
- label: "Spin",
1233
- params: {
1234
- vpSpin: 1,
1235
- vpZoom: 1
1236
- }
1237
- },
1238
- {
1239
- id: "spin2",
1240
- label: "Spin ×2",
1241
- params: {
1242
- vpSpin: 2,
1243
- vpZoom: 1
1244
- }
1245
- },
1246
- {
1247
- id: "push",
1248
- label: "Push in",
1249
- params: {
1250
- vpSpin: 0,
1251
- vpZoom: 1.3
1252
- }
1253
- }
1254
- ],
1255
- form: [
1256
- {
1257
- id: "static",
1258
- label: "Static",
1259
- params: {
1260
- vpPulse: 0,
1261
- vpWobble: 0
1262
- }
1263
- },
1264
- {
1265
- id: "pulse",
1266
- label: "Pulse",
1267
- params: {
1268
- vpPulse: .3,
1269
- vpWobble: 0
1270
- }
1271
- },
1272
- {
1273
- id: "wobble",
1274
- label: "Wobble",
1275
- params: {
1276
- vpPulse: 0,
1277
- vpWobble: 8
1278
- }
1279
- },
1280
- {
1281
- id: "breathe",
1282
- label: "Breathe",
1283
- params: {
1284
- vpPulse: .22,
1285
- vpWobble: 5
1286
- }
1287
- }
1288
- ]
1289
- };
1290
- function It(e, t = {}) {
1291
- switch (e) {
1292
- case "scanline": return wt;
1293
- case "pattern-rules": {
1294
- let e = t.render ?? "tiles", n = e === "field" && t.field === "organic";
1295
- return {
1296
- frame: e === "tiles" ? Tt : n ? Ot : Dt,
1297
- form: e === "tiles" ? Et : e === "weave" ? At : kt
1298
- };
1299
- }
1300
- case "math-waveform": return jt;
1301
- case "math-surface": return Mt;
1302
- case "math-field": return (t.kind ?? "scalar") === "complex" ? Pt : Nt;
1303
- default: return Ct(e)?.params?.some((e) => e.key === "vpSpin") ? Ft : null;
1304
- }
1305
- }
1306
- function Lt(e) {
1307
- let t = /* @__PURE__ */ new Set();
1308
- for (let n of e ?? []) for (let e of Object.keys(n.params ?? {})) t.add(e);
1309
- return t;
1310
- }
1311
- //#endregion
1312
- //#region src/editor/params/lookPresets.js
1313
- var Rt = {
1314
- Spectrum: {
1315
- palette: "spectrum",
1316
- spectral: !0,
1317
- hue: 0,
1318
- irid: 1.1
1319
- },
1320
- Iris: {
1321
- palette: "iris",
1322
- spectral: !1,
1323
- hue: .1,
1324
- irid: 1.05
1325
- },
1326
- Aqua: {
1327
- palette: "aqua",
1328
- spectral: !1,
1329
- hue: .5,
1330
- irid: 1
1331
- },
1332
- Magma: {
1333
- palette: "magma",
1334
- spectral: !1,
1335
- hue: .05,
1336
- irid: .95
1337
- },
1338
- Candy: {
1339
- palette: "candy",
1340
- spectral: !1,
1341
- hue: .8,
1342
- irid: 1.15
1343
- },
1344
- Noir: {
1345
- palette: "spectrum",
1346
- spectral: !0,
1347
- hue: 0,
1348
- irid: .6,
1349
- rim: 1
1350
- }
1351
- };
1352
- function zt(e) {
1353
- return e === "softforms" || e === "softforms3d" ? Rt : null;
1354
- }
1355
- //#endregion
1356
- //#region src/loops/gl/primitiveEasing.js
1357
- function Bt(e) {
1358
- let t = 7.5625, n = 2.75;
1359
- return e < 1 / n ? t * e * e : e < 2 / n ? (e -= 1.5 / n, t * e * e + .75) : e < 2.5 / n ? (e -= 2.25 / n, t * e * e + .9375) : (e -= 2.625 / n, t * e * e + .984375);
1360
- }
1361
- var Vt = {
1362
- linear: (e) => e,
1363
- in: (e) => e * e,
1364
- out: (e) => 1 - (1 - e) * (1 - e),
1365
- inout: (e) => e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2,
1366
- sine: (e) => -(Math.cos(Math.PI * e) - 1) / 2,
1367
- cubicIn: (e) => e * e * e,
1368
- cubicOut: (e) => 1 - (1 - e) ** 3,
1369
- cubicInOut: (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2,
1370
- expoOut: (e) => e >= 1 ? 1 : 1 - 2 ** (-10 * e),
1371
- expoInOut: (e) => e <= 0 ? 0 : e >= 1 ? 1 : e < .5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2,
1372
- backOut: (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2,
1373
- backInOut: (e) => {
1374
- let t = 1.70158 * 1.525;
1375
- return e < .5 ? (2 * e) ** 2 * (3.5949095 * 2 * e - t) / 2 : ((2 * e - 2) ** 2 * (3.5949095 * (e * 2 - 2) + t) + 2) / 2;
1376
- },
1377
- elasticOut: (e) => {
1378
- if (e <= 0) return 0;
1379
- if (e >= 1) return 1;
1380
- let t = 2 * Math.PI / 3;
1381
- return 2 ** (-10 * e) * Math.sin((e * 10 - .75) * t) + 1;
1382
- },
1383
- bounceOut: Bt
1384
- }, Ht = {
1385
- linear: "Linear",
1386
- in: "Ease in",
1387
- out: "Ease out",
1388
- inout: "Ease in-out",
1389
- sine: "Sine",
1390
- cubicIn: "Cubic in",
1391
- cubicOut: "Cubic out",
1392
- cubicInOut: "Cubic in-out",
1393
- expoOut: "Expo out",
1394
- expoInOut: "Expo in-out",
1395
- backOut: "Back out",
1396
- backInOut: "Back in-out",
1397
- elasticOut: "Elastic out",
1398
- bounceOut: "Bounce out"
1399
- }, Ut = Object.keys(Vt).map((e) => ({
1400
- value: e,
1401
- label: Ht[e] || e
1402
- })), Wt = (e, t, n) => [
1403
- i(e[0], t[0], n),
1404
- i(e[1], t[1], n),
1405
- i(e[2], t[2], n)
1406
- ], Gt = (e) => ({
1407
- rot: e.rot || [
1408
- 0,
1409
- 0,
1410
- 0
1411
- ],
1412
- pos: e.pos || [
1413
- 0,
1414
- 0,
1415
- 0
1416
- ],
1417
- scale: e.scale ?? 1
1418
- });
1419
- function Kt(e, t) {
1420
- if (!e || !e.length) return {};
1421
- if (e.length === 1) return Gt(e[0]);
1422
- let n = 0;
1423
- for (; n < e.length - 1 && t > e[n + 1].t;) n++;
1424
- let r = e[n], a = e[n + 1] || r, o = a.t - r.t || 1, s = Math.max(0, Math.min(1, (t - r.t) / o));
1425
- return s = (Vt[a.ease] || Vt.inout)(s), {
1426
- rot: Wt(r.rot || [
1427
- 0,
1428
- 0,
1429
- 0
1430
- ], a.rot || [
1431
- 0,
1432
- 0,
1433
- 0
1434
- ], s),
1435
- pos: Wt(r.pos || [
1436
- 0,
1437
- 0,
1438
- 0
1439
- ], a.pos || [
1440
- 0,
1441
- 0,
1442
- 0
1443
- ], s),
1444
- scale: i(r.scale ?? 1, a.scale ?? 1, s)
1445
- };
1446
- }
1447
- var qt = [{
1448
- t: 0,
1449
- rot: [
1450
- 0,
1451
- 0,
1452
- 0
1453
- ],
1454
- pos: [
1455
- 0,
1456
- 0,
1457
- 0
1458
- ],
1459
- scale: 1,
1460
- ease: "inout"
1461
- }, {
1462
- t: 1,
1463
- rot: [
1464
- 0,
1465
- Math.PI * 2,
1466
- 0
1467
- ],
1468
- pos: [
1469
- 0,
1470
- 0,
1471
- 0
1472
- ],
1473
- scale: 1,
1474
- ease: "inout"
1475
- }];
1476
- //#endregion
1477
- //#region src/loops/gl/phase.js
1478
- function Jt(e, t) {
1479
- let n = Number(e), r = Number(t);
1480
- return !n || n <= 0 || !r || r <= 0 ? 1 : Math.max(1, Math.round(r / n));
1481
- }
1482
- function Yt(e, t) {
1483
- return e * t % 1;
1484
- }
1485
- //#endregion
1486
- //#region src/editor/compose/inspectors/KeyframeEditor.jsx
1487
- function Xt({ layer: e, patch: t, defaultDuration: n = 8 }) {
1488
- let r = () => Jt(e.duration ?? n, S.getLoopSeconds());
1489
- return /* @__PURE__ */ K(Ue, {
1490
- keyframes: e.keyframes,
1491
- onChange: (e) => t({ keyframes: e }),
1492
- t: () => S.getT() * r() % 1,
1493
- onPause: () => S.pause(),
1494
- onSeek: (e) => S.seek(e / r()),
1495
- easeOptions: Ut,
1496
- defaultKeyframes: qt
1497
- });
1498
- }
1499
- //#endregion
1500
- //#region src/editor/compose/inspectors/CameraPoseSlots.jsx
1501
- function Zt({ layer: e, patch: t, camParams: n, isEngine: r, showHeader: i = !1 }) {
1502
- let a = c(), o = Array.isArray(e._camSlots) ? e._camSlots : [], s = [
1503
- o[0] ?? null,
1504
- o[1] ?? null,
1505
- o[2] ?? null
1506
- ], l = (r) => {
1507
- let i = {};
1508
- for (let t of n) i[t.key] = e[t.key] ?? t.default;
1509
- let a = [...s];
1510
- a[r] = i, t({ _camSlots: a });
1511
- }, u = (e) => {
1512
- s[e] && t({ ...s[e] });
1513
- };
1514
- return /* @__PURE__ */ q(G, { children: [i && /* @__PURE__ */ K("span", {
1515
- className: "kol-eyebrow text-fg-80",
1516
- children: "Camera"
1517
- }), /* @__PURE__ */ q("div", {
1518
- className: "flex items-center gap-1",
1519
- children: [n.length > 0 && s.map((e, t) => /* @__PURE__ */ K(W, {
1520
- label: e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1521
- children: /* @__PURE__ */ K(B, {
1522
- "aria-label": e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1523
- tone: e ? "inverted" : "ghost",
1524
- size: a,
1525
- onClick: (n) => n.shiftKey || !e ? l(t) : u(t),
1526
- children: t + 1
1527
- })
1528
- }, t)), /* @__PURE__ */ K(B, {
1529
- tone: "primary",
1530
- size: a,
1531
- className: "ml-auto",
1532
- onClick: () => {
1533
- let i = {};
1534
- for (let e of n) i[e.key] = e.default;
1535
- t(i), r && import("./host-DXizGh-A.js").then((t) => t.hostAction?.(e.id, "resetCamera")).catch(() => {});
1536
- },
1537
- children: "Reset"
1538
- })]
1539
- })] });
1540
- }
1541
- //#endregion
1542
- //#region src/editor/compose/inspectors/RulesEditor.jsx
1543
- function Qt({ layer: e, patch: t, seed: n }) {
1544
- let r = c(), i = e.rules ?? [], a = (e, n) => t({
1545
- rules: e,
1546
- ...n
1547
- }), o = () => a([...i, N()]), s = (e, t) => a(i.map((n, r) => r === e ? t : n)), l = (e) => a(i.filter((t, n) => n !== e)), u = (e) => {
1548
- let t = n.take(), r = g(t >>> 0);
1549
- a(i.map((t, n) => n === e ? {
1550
- ...A(r),
1551
- id: t.id
1552
- } : t), { _rollSeed: t });
1553
- };
1554
- return /* @__PURE__ */ K(H, {
1555
- label: `Rules · ${i.length}`,
1556
- children: /* @__PURE__ */ q("div", {
1557
- className: "flex flex-col gap-2",
1558
- children: [i.map((e, t) => /* @__PURE__ */ K(je, {
1559
- rule: e,
1560
- onChange: (e) => s(t, e),
1561
- onRemove: () => l(t),
1562
- onReroll: () => u(t)
1563
- }, e.id ?? t)), /* @__PURE__ */ q("div", {
1564
- className: "grid grid-cols-2 gap-2",
1565
- children: [/* @__PURE__ */ K(B, {
1566
- tone: "primary",
1567
- size: r,
1568
- iconLeft: "plus",
1569
- onClick: o,
1570
- children: "Add rule"
1571
- }), /* @__PURE__ */ K(B, {
1572
- tone: "primary",
1573
- size: r,
1574
- onClick: () => {
1575
- let e = n.take(), t = g(e >>> 0), r = 1 + Math.floor(t() * 3);
1576
- a(Array.from({ length: r }, () => A(t)), { _rollSeed: e });
1577
- },
1578
- children: "Randomize"
1579
- })]
1580
- })]
1581
- })
1582
- });
1583
- }
1584
- //#endregion
1585
- //#region src/editor/compose/inspectors/ProfileEditor.jsx
1586
- var $t = (e) => e.map((e) => ({
1587
- x: e.x,
1588
- y: (1 - e.y) / 2,
1589
- hl: {
1590
- x: e.hlx ?? 0,
1591
- y: -(e.hly ?? 0) / 2
1592
- },
1593
- hr: {
1594
- x: e.hrx ?? 0,
1595
- y: -(e.hry ?? 0) / 2
1596
- }
1597
- })), en = (e) => e.map((e) => ({
1598
- x: e.x,
1599
- y: n(1 - 2 * e.y, -1, 1),
1600
- hlx: e.hl?.x ?? 0,
1601
- hly: -2 * (e.hl?.y ?? 0),
1602
- hrx: e.hr?.x ?? 0,
1603
- hry: -2 * (e.hr?.y ?? 0)
1604
- }));
1605
- function tn({ value: e, onChange: t }) {
1606
- let r = Array.isArray(e) && e.length > 1 ? e : Ce, i = c();
1607
- return /* @__PURE__ */ K(ze, {
1608
- value: $t(r),
1609
- onChange: (e) => {
1610
- let i = en(e);
1611
- if (i.length < 3 || i[0].x > .001 || i[i.length - 1].x < .999) return;
1612
- i[0].x = 0, i[i.length - 1].x = 1;
1613
- let a = Math.abs(i[0].y - r[0].y) > 1e-6 ? i[0].y : i[i.length - 1].y;
1614
- i[0].y = a, i[i.length - 1].y = a;
1615
- for (let e = 1; e < i.length - 1; e++) i[e].x = n(i[e].x, i[e - 1].x + .02, .98);
1616
- t(i);
1617
- },
1618
- aspect: 2,
1619
- size: i,
1620
- minPoints: 3,
1621
- ariaLabel: "Profile curve"
1622
- });
1623
- }
1624
- function nn({ layer: e, patch: t }) {
1625
- return e.render !== "field" || e.field !== "organic" || e.waveProfile !== "custom" ? null : /* @__PURE__ */ K(H, {
1626
- label: "Profile curve",
1627
- children: /* @__PURE__ */ K(tn, {
1628
- value: Array.isArray(e.waveCurve) && e.waveCurve.length > 1 ? e.waveCurve : Ce,
1629
- onChange: (e) => t({ waveCurve: e })
1630
- })
1631
- });
1632
- }
1633
- //#endregion
1634
- //#region src/editor/compose/inspectors/CurveEditor.jsx
1635
- function rn({ layer: e, patch: t }) {
1636
- let n = e.clip === "custom", r = n ? null : Se(e.clip), i = n ? null : {
1637
- label: (we.find((t) => t.id === e.clip) || we[0]).label,
1638
- copies: r.copies,
1639
- spiral: r.spiral,
1640
- layerCopies: e.copies,
1641
- layerSpiral: e.spiral
1642
- };
1643
- return /* @__PURE__ */ K(Be, {
1644
- value: n ? e.custom ?? pe("polar") : r.def,
1645
- stock: i,
1646
- onChange: (e, { extras: n }) => t({
1647
- clip: "custom",
1648
- ...n,
1649
- custom: e
1650
- }),
1651
- validate: Te,
1652
- kinds: ye,
1653
- defaultFor: pe
1654
- });
1655
- }
1656
- //#endregion
1657
- //#region src/editor/compose/inspectors/ParatypeTools.jsx
1658
- function an({ layer: e, patch: t, tab: n, renderAnimate: r }) {
1659
- return e?.loopId === "paratype-glyph" ? n === "generate" ? /* @__PURE__ */ K(on, { layer: e }) : n === "style" ? /* @__PURE__ */ K(sn, {
1660
- layer: e,
1661
- patch: t,
1662
- renderAnimate: r
1663
- }) : null : null;
1664
- }
1665
- function on({ layer: e }) {
1666
- let t = c(), { flattenParatype: n } = s();
1667
- return n ? /* @__PURE__ */ K(W, {
1668
- label: "Flatten the glyph(s) to vector shape layers (one-way)",
1669
- children: /* @__PURE__ */ K(B, {
1670
- "aria-label": "Flatten the glyph(s) to vector shape layers (one-way)",
1671
- tone: "primary",
1672
- size: t,
1673
- className: "w-full",
1674
- onClick: () => n(e.id),
1675
- children: "Flatten to vector"
1676
- })
1677
- }) : null;
1678
- }
1679
- function sn({ layer: e, patch: t, renderAnimate: n }) {
1680
- let i = c(), a = _(L(e.loopId)?.params ?? [], e).filter((e) => e.type === "range");
1681
- if (a.length < 2) return null;
1682
- let o = (e, t) => a.some((t) => t.key === e) && e !== t ? e : a.find((e) => e.key !== t)?.key, s = o(e._xyX ?? "stemWidth", null), l = o(e._xyY ?? "oWidth", s), u = a.find((e) => e.key === s), d = a.find((e) => e.key === l);
1683
- if (!u || !d) return null;
1684
- let f = (t, n) => typeof e[t] == "number" ? e[t] : n.default, p = (t) => r(e[t]), m = (e, t) => {
1685
- let n = t.step ?? 1;
1686
- return n < 1 ? Number((Math.round(e / n) * n).toFixed(4)) : Math.round(e);
1687
- }, h = a.map((e) => ({
1688
- value: e.key,
1689
- label: e.label
1690
- }));
1691
- return /* @__PURE__ */ q(G, { children: [
1692
- /* @__PURE__ */ K("span", {
1693
- className: "kol-eyebrow text-fg-80",
1694
- children: "Explore"
1695
- }),
1696
- /* @__PURE__ */ q("div", {
1697
- className: "grid grid-cols-2 gap-2",
1698
- children: [/* @__PURE__ */ K(H, {
1699
- label: "X axis",
1700
- children: /* @__PURE__ */ q("div", {
1701
- className: "flex items-center gap-2",
1702
- children: [/* @__PURE__ */ K(V, {
1703
- variant: "subtle",
1704
- size: i,
1705
- className: "w-full min-w-0",
1706
- options: h,
1707
- value: s,
1708
- onChange: (e) => t({ _xyX: e })
1709
- }), n?.(u)]
1710
- })
1711
- }), /* @__PURE__ */ K(H, {
1712
- label: "Y axis",
1713
- children: /* @__PURE__ */ q("div", {
1714
- className: "flex items-center gap-2",
1715
- children: [/* @__PURE__ */ K(V, {
1716
- variant: "subtle",
1717
- size: i,
1718
- className: "w-full min-w-0",
1719
- options: h,
1720
- value: l,
1721
- onChange: (e) => t({ _xyY: e })
1722
- }), n?.(d)]
1723
- })
1724
- })]
1725
- }),
1726
- /* @__PURE__ */ K(Ze, {
1727
- xValue: f(s, u),
1728
- yValue: f(l, d),
1729
- xMin: u.min ?? 0,
1730
- xMax: u.max ?? 1,
1731
- yMin: d.min ?? 0,
1732
- yMax: d.max ?? 1,
1733
- xLabel: u.label,
1734
- yLabel: d.label,
1735
- onChange: (e, n) => t({
1736
- ...!p(s) && { [s]: m(e, u) },
1737
- ...!p(l) && { [l]: m(n, d) }
1738
- })
1739
- })
1740
- ] });
1741
- }
1742
- //#endregion
1743
- //#region src/editor/compose/inspectors/SoftformsLayers.jsx
1744
- var cn = 5, ln = [
1745
- {
1746
- value: "teardrop",
1747
- label: "Teardrop"
1748
- },
1749
- {
1750
- value: "pill",
1751
- label: "Pill"
1752
- },
1753
- {
1754
- value: "dome",
1755
- label: "Dome"
1756
- },
1757
- {
1758
- value: "orb",
1759
- label: "Orb"
1760
- },
1761
- {
1762
- value: "super",
1763
- label: "Lozenge"
1764
- }
1765
- ], un = [
1766
- {
1767
- value: "sphere",
1768
- label: "Sphere"
1769
- },
1770
- {
1771
- value: "capsule",
1772
- label: "Capsule"
1773
- },
1774
- {
1775
- value: "teardrop",
1776
- label: "Teardrop"
1777
- },
1778
- {
1779
- value: "lozenge",
1780
- label: "Lozenge"
1781
- }
1782
- ], dn = [
1783
- {
1784
- k: "x",
1785
- label: "Position X",
1786
- min: -1,
1787
- max: 1,
1788
- step: .01,
1789
- def: 0
1790
- },
1791
- {
1792
- k: "y",
1793
- label: "Position Y",
1794
- min: -1,
1795
- max: 1,
1796
- step: .01,
1797
- def: 0
1798
- },
1799
- {
1800
- k: "sx",
1801
- label: "Scale X",
1802
- min: .12,
1803
- max: 1.6,
1804
- step: .01,
1805
- def: .6
1806
- },
1807
- {
1808
- k: "sy",
1809
- label: "Scale Y",
1810
- min: .12,
1811
- max: 1.6,
1812
- step: .01,
1813
- def: .6,
1814
- fallback: "sx"
1815
- },
1816
- {
1817
- k: "rot",
1818
- label: "Rotation",
1819
- min: 0,
1820
- max: 360,
1821
- step: 1,
1822
- def: 0
1823
- },
1824
- {
1825
- k: "hue",
1826
- label: "Hue",
1827
- min: 0,
1828
- max: 1,
1829
- step: .01,
1830
- def: 0
1831
- }
1832
- ], fn = [
1833
- {
1834
- k: "x",
1835
- label: "Position X",
1836
- min: -1.2,
1837
- max: 1.2,
1838
- step: .01,
1839
- def: 0
1840
- },
1841
- {
1842
- k: "y",
1843
- label: "Position Y",
1844
- min: -1.2,
1845
- max: 1.2,
1846
- step: .01,
1847
- def: 0
1848
- },
1849
- {
1850
- k: "z",
1851
- label: "Position Z",
1852
- min: -1.2,
1853
- max: 1.2,
1854
- step: .01,
1855
- def: 0
1856
- },
1857
- {
1858
- k: "sx",
1859
- label: "Scale X",
1860
- min: .12,
1861
- max: 1.6,
1862
- step: .01,
1863
- def: .7
1864
- },
1865
- {
1866
- k: "sy",
1867
- label: "Scale Y",
1868
- min: .12,
1869
- max: 1.6,
1870
- step: .01,
1871
- def: .7,
1872
- fallback: "sx"
1873
- },
1874
- {
1875
- k: "sz",
1876
- label: "Scale Z",
1877
- min: .12,
1878
- max: 1.6,
1879
- step: .01,
1880
- def: .7,
1881
- fallback: "sx"
1882
- },
1883
- {
1884
- k: "rot",
1885
- label: "Rotation",
1886
- min: 0,
1887
- max: 360,
1888
- step: 1,
1889
- def: 0
1890
- },
1891
- {
1892
- k: "hue",
1893
- label: "Hue",
1894
- min: 0,
1895
- max: 1,
1896
- step: .01,
1897
- def: 0
1898
- }
1899
- ], pn = Math.PI * 2, X = (e) => Math.round(e * 100) / 100, Z = (e, t, n) => t + e() * (n - t), mn = (e, t) => {
1900
- let n = t * Math.sqrt(e()), r = e() * pn;
1901
- return [n * Math.cos(r), n * Math.sin(r)];
1902
- }, hn = (e, t) => {
1903
- let n = t * Math.cbrt(e()), r = e() * pn, i = Math.acos(2 * e() - 1);
1904
- return [
1905
- n * Math.sin(i) * Math.cos(r),
1906
- n * Math.sin(i) * Math.sin(r),
1907
- n * Math.cos(i) * .8
1908
- ];
1909
- }, gn = (e) => {
1910
- let t = e.length || 1, n = e.reduce((e, n) => ({
1911
- x: e.x + n.x / t,
1912
- y: e.y + n.y / t
1913
- }), {
1914
- x: 0,
1915
- y: 0
1916
- });
1917
- return e.map((e) => ({
1918
- ...e,
1919
- x: X(e.x - n.x),
1920
- y: X(e.y - n.y)
1921
- }));
1922
- }, _n = (e) => {
1923
- let t = e.length || 1, n = e.reduce((e, n) => ({
1924
- x: e.x + n.x / t,
1925
- y: e.y + n.y / t,
1926
- z: e.z + n.z / t
1927
- }), {
1928
- x: 0,
1929
- y: 0,
1930
- z: 0
1931
- });
1932
- return e.map((e) => ({
1933
- ...e,
1934
- x: X(e.x - n.x),
1935
- y: X(e.y - n.y),
1936
- z: X(e.z - n.z)
1937
- }));
1938
- }, vn = (e, t) => e.find((e) => e.value === t)?.label ?? t;
1939
- function yn({ layer: e }) {
1940
- let t = c(), { updateLayer: r } = s(), i = le(e.id, { history: "coalesce" }), a = e.loopId === "softforms3d", o = a && !!e.metaball, l = a ? un : ln, u = a ? fn : dn, d = o ? 2 : 1, f = Array.isArray(e.forms) ? e.forms : [], [p, m] = nt(-1), h = p >= 0 && p < f.length ? f[p] : null, _ = (t) => {
1941
- m(t), window.dispatchEvent(new CustomEvent("kol:softform-select", { detail: {
1942
- id: e.id,
1943
- index: t,
1944
- from: "panel"
1945
- } }));
1946
- };
1947
- $e(() => {
1948
- let t = (t) => {
1949
- t.detail?.id === e.id && t.detail.from === "canvas" && m(t.detail.index);
1950
- };
1951
- return window.addEventListener("kol:softform-select", t), () => window.removeEventListener("kol:softform-select", t);
1952
- }, [e.id]);
1953
- let v = (t) => r(e.id, { forms: t }), ee = (e, t) => i.patch({ forms: f.map((n, r) => r === p ? {
1954
- ...n,
1955
- [e]: t
1956
- } : n) }), te = () => {
1957
- if (f.length >= cn) return;
1958
- let e = a ? {
1959
- t: "sphere",
1960
- x: 0,
1961
- y: 0,
1962
- z: 0,
1963
- sx: .7,
1964
- sy: .7,
1965
- sz: .7,
1966
- rot: 0,
1967
- hue: X(Math.random())
1968
- } : {
1969
- t: "dome",
1970
- x: 0,
1971
- y: 0,
1972
- sx: .6,
1973
- sy: .6,
1974
- rot: 0,
1975
- hue: X(Math.random())
1976
- };
1977
- v([...f, e]), _(f.length);
1978
- }, y = (e) => {
1979
- if (f.length >= cn) return;
1980
- let t = {
1981
- ...f[e],
1982
- x: n((f[e].x ?? 0) + .12, -1.2, 1.2),
1983
- y: n((f[e].y ?? 0) - .1, -1.2, 1.2)
1984
- };
1985
- v([
1986
- ...f.slice(0, e + 1),
1987
- t,
1988
- ...f.slice(e + 1)
1989
- ]), _(e + 1);
1990
- }, ne = (e) => {
1991
- f.length <= d || (v(f.filter((t, n) => n !== e)), _(-1));
1992
- }, re = (e, t) => {
1993
- if (t < 0 || t >= f.length) return;
1994
- let n = [...f];
1995
- [n[e], n[t]] = [n[t], n[e]], v(n), _(t);
1996
- };
1997
- return /* @__PURE__ */ q("div", {
1998
- className: "flex flex-col gap-2",
1999
- children: [
2000
- /* @__PURE__ */ K("span", {
2001
- className: "kol-eyebrow text-fg-80",
2002
- children: "Forms"
2003
- }),
2004
- /* @__PURE__ */ K(Je, {
2005
- size: t,
2006
- reorder: "grab",
2007
- activeIndex: p >= 0 ? f.length - 1 - p : null,
2008
- items: f.map((e, t) => {
2009
- let n = f.length - 1 - t;
2010
- return {
2011
- id: n,
2012
- label: vn(l, f[n].t),
2013
- actions: [{
2014
- icon: "copy",
2015
- label: "Duplicate form",
2016
- hidden: f.length >= cn,
2017
- onClick: () => y(n)
2018
- }, {
2019
- icon: "trash",
2020
- label: "Delete form",
2021
- hidden: f.length <= d,
2022
- onClick: () => ne(n)
2023
- }]
2024
- };
2025
- }),
2026
- onSelect: (e) => _(f.length - 1 - e),
2027
- onMove: (e, t) => re(f.length - 1 - e, f.length - 1 - t)
2028
- }),
2029
- f.length < cn && /* @__PURE__ */ K(B, {
2030
- tone: "primary",
2031
- size: t,
2032
- className: "w-full",
2033
- iconLeft: "plus",
2034
- iconSize: 12,
2035
- onClick: te,
2036
- children: "Add form"
2037
- }),
2038
- !a && /* @__PURE__ */ K(W, {
2039
- label: "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
2040
- children: /* @__PURE__ */ K(B, {
2041
- "aria-label": "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
2042
- tone: "primary",
2043
- size: t,
2044
- className: "w-full",
2045
- onClick: () => window.dispatchEvent(new CustomEvent("kol:softform-edit", { detail: {
2046
- id: e.id,
2047
- index: Math.max(0, p)
2048
- } })),
2049
- children: "Edit forms on canvas"
2050
- })
2051
- }),
2052
- h && /* @__PURE__ */ q("div", {
2053
- className: "flex flex-col gap-2 pt-1",
2054
- children: [
2055
- /* @__PURE__ */ K("span", {
2056
- className: "kol-eyebrow text-fg-80",
2057
- children: "Selected form"
2058
- }),
2059
- /* @__PURE__ */ K(H, {
2060
- label: "Type",
2061
- children: /* @__PURE__ */ K(V, {
2062
- variant: "subtle",
2063
- size: t,
2064
- className: "w-full",
2065
- options: l,
2066
- value: h.t,
2067
- onChange: (e) => v(f.map((t, n) => n === p ? {
2068
- ...t,
2069
- t: e
2070
- } : t))
2071
- })
2072
- }),
2073
- u.map((e) => {
2074
- let t = h[e.k] ?? (e.fallback ? h[e.fallback] : void 0), n = typeof t == "number" ? t : e.def;
2075
- return /* @__PURE__ */ K(H, {
2076
- label: e.label,
2077
- children: /* @__PURE__ */ K(qe, {
2078
- min: e.min,
2079
- max: e.max,
2080
- step: e.step,
2081
- value: n,
2082
- onChange: (t) => ee(e.k, t)
2083
- })
2084
- }, e.k);
2085
- })
2086
- ]
2087
- }),
2088
- /* @__PURE__ */ K("span", {
2089
- className: "kol-helper-10 text-meta pt-1",
2090
- children: "Randomize forms"
2091
- }),
2092
- /* @__PURE__ */ q("div", {
2093
- className: "grid grid-cols-2 gap-2",
2094
- children: [
2095
- /* @__PURE__ */ K(B, {
2096
- tone: "primary",
2097
- size: t,
2098
- onClick: () => {
2099
- let e = g(b());
2100
- v(f.map((t) => ({
2101
- ...t,
2102
- hue: X(e())
2103
- })));
2104
- },
2105
- children: "Color"
2106
- }),
2107
- /* @__PURE__ */ K(B, {
2108
- tone: "primary",
2109
- size: t,
2110
- onClick: () => {
2111
- let e = g(b());
2112
- v(f.map((t) => a ? {
2113
- ...t,
2114
- x: X(Z(e, -.7, .7)),
2115
- y: X(Z(e, -.7, .7)),
2116
- z: X(Z(e, -.5, .5)),
2117
- rot: Math.round(Z(e, 0, 360))
2118
- } : {
2119
- ...t,
2120
- x: X(Z(e, -.55, .55)),
2121
- y: X(Z(e, -.75, .75)),
2122
- rot: Math.round(Z(e, 0, 360))
2123
- }));
2124
- },
2125
- children: "Transform"
2126
- }),
2127
- /* @__PURE__ */ K(B, {
2128
- tone: "primary",
2129
- size: t,
2130
- onClick: () => {
2131
- let e = g(b());
2132
- v(f.map((t) => {
2133
- let n = X(Z(e, .35, .95)), r = X(Z(e, .35, .95));
2134
- return a ? {
2135
- ...t,
2136
- sx: n,
2137
- sy: r,
2138
- sz: X(Z(e, .35, .95))
2139
- } : {
2140
- ...t,
2141
- sx: n,
2142
- sy: r
2143
- };
2144
- }));
2145
- },
2146
- children: "Scale"
2147
- }),
2148
- /* @__PURE__ */ K(B, {
2149
- tone: "primary",
2150
- size: t,
2151
- onClick: () => {
2152
- let t = g(b());
2153
- r(e.id, {
2154
- motion: X(Z(t, 0, 1.1)),
2155
- sweep: Math.round(Z(t, 0, 360))
2156
- });
2157
- },
2158
- children: "Animation"
2159
- })
2160
- ]
2161
- }),
2162
- /* @__PURE__ */ K(B, {
2163
- tone: "primary",
2164
- size: t,
2165
- className: "w-full",
2166
- onClick: () => {
2167
- let e = g(b());
2168
- if (a) {
2169
- if (o) {
2170
- let t = 2 + Math.floor(e() * 4), n = Z(e, .45, .9);
2171
- v(_n(Array.from({ length: t }, (r, i) => {
2172
- let [a, o, s] = hn(e, n), c = X(Z(e, .5, .92));
2173
- return {
2174
- t: "sphere",
2175
- x: X(a),
2176
- y: X(o),
2177
- z: X(s),
2178
- sx: c,
2179
- sy: c,
2180
- sz: c,
2181
- rot: 0,
2182
- hue: X(i / t)
2183
- };
2184
- })));
2185
- } else {
2186
- let t = Z(e, .6, 1.15);
2187
- v(_n(f.map((n) => {
2188
- let [r, i, a] = hn(e, t);
2189
- return {
2190
- ...n,
2191
- x: X(r),
2192
- y: X(i),
2193
- z: X(a),
2194
- rot: Math.round(Z(e, 0, 360))
2195
- };
2196
- })));
2197
- }
2198
- return;
2199
- }
2200
- let t = 2 + Math.floor(e() * 4), n = Z(e, .45, .85);
2201
- v(gn(Array.from({ length: t }, (r, i) => {
2202
- let [a, o] = mn(e, n);
2203
- return {
2204
- t: ln[Math.floor(e() * ln.length)].value,
2205
- x: X(a),
2206
- y: X(o),
2207
- sx: X(Z(e, .4, .85)),
2208
- sy: X(Z(e, .4, .85)),
2209
- rot: Math.round(Z(e, 0, 360)),
2210
- hue: X(i / t)
2211
- };
2212
- })));
2213
- },
2214
- children: "Rearrange"
2215
- })
2216
- ]
2217
- });
2218
- }
2219
- //#endregion
2220
- //#region src/editor/compose/inspectors/PenroseLayers.jsx
2221
- var bn = [
2222
- {
2223
- role: "fg",
2224
- label: "Foreground"
2225
- },
2226
- {
2227
- role: "accent",
2228
- label: "Accent"
2229
- },
2230
- {
2231
- role: "dim",
2232
- label: "Dim"
2233
- },
2234
- {
2235
- role: "warm",
2236
- label: "Warm"
2237
- }
2238
- ], xn = {
2239
- fg: 1,
2240
- accent: 1,
2241
- dim: 5,
2242
- warm: 1
2243
- };
2244
- function Sn({ layer: e, setProp: t, patch: n }) {
2245
- let r = c();
2246
- _e();
2247
- let i = O(e.loopId), a = bn.filter((e) => i?.has(e.role));
2248
- if (!a.length) return null;
2249
- let o = e._layerPrev ?? {};
2250
- return /* @__PURE__ */ K(U, {
2251
- label: "Layers",
2252
- divided: !0,
2253
- children: /* @__PURE__ */ K(Je, {
2254
- size: r,
2255
- items: a.map(({ role: n, label: r }) => {
2256
- let i = `${n}Opacity`, a = Number(e[i] ?? xn[n]);
2257
- return {
2258
- id: n,
2259
- label: r,
2260
- swatch: e[n] ?? null,
2261
- shown: a > 0,
2262
- control: /* @__PURE__ */ K(qe, {
2263
- min: 0,
2264
- max: 5,
2265
- step: .1,
2266
- value: a,
2267
- onChange: (e) => t(i, e),
2268
- formatValue: (e) => e.toFixed(1),
2269
- displayWidth: 3,
2270
- readoutPreset: "rail",
2271
- className: "w-full min-w-0",
2272
- "aria-label": `${r} opacity`
2273
- })
2274
- };
2275
- }),
2276
- onToggleShown: (t) => {
2277
- let { role: r } = a[t], i = `${r}Opacity`, s = Number(e[i] ?? xn[r]);
2278
- n(s > 0 ? {
2279
- [i]: 0,
2280
- _layerPrev: {
2281
- ...o,
2282
- [r]: s
2283
- }
2284
- } : { [i]: o[r] || xn[r] });
2285
- }
2286
- })
2287
- });
2288
- }
2289
- //#endregion
2290
- //#region src/loops/about.js
2291
- var Cn = {
2292
- "morph-circle": "Shape interpolation — a circle eased into polygons, point by point",
2293
- "square-circle": "Superellipse morph between a square and a circle",
2294
- "star-morph": "Star polygon whose inner radius and point count are tweened",
2295
- blob: "Noise-displaced closed curve — a circle pushed by periodic noise",
2296
- lissajous: "Lissajous figures — two perpendicular sine oscillations at an integer ratio",
2297
- spiral: "Archimedean and logarithmic spirals",
2298
- "rose-curve": "Rose curves (rhodonea) — r = cos(kθ)",
2299
- "ring-pulse": "Concentric rings pulsing on a phase offset",
2300
- "concentric-arcs": "Concentric arc segments rotating at harmonic rates",
2301
- "bars-wave": "A row of bars sampling a travelling sine wave",
2302
- "wave-grid": "A grid displaced by a 2D sine field",
2303
- "checker-pulse": "Checkerboard whose cells scale on a phase wave",
2304
- "grid-rotor": "A grid of marks each rotating with a phase offset",
2305
- "arc-sweep": "Arcs sweeping on staggered timing",
2306
- "radial-bars": "Bars arranged radially, lengths driven by a wave",
2307
- "orbit-dots": "Dots on circular orbits at harmonic speeds",
2308
- "sliced-solid": "Sliced solid — a solid of revolution cut into translucent discs that drift along its axis",
2309
- "pattern-rules": "Rule-based repeat patterns — stripes, tiles and lattices from a small rule set",
2310
- stripes: "Periodic stripe field — a sine of position, thresholded",
2311
- "checker-field": "Checkerboard field from two crossed square waves",
2312
- halftone: "Halftone — dot size follows a field value, as in print screening",
2313
- "gradient-field": "Multi-stop colour gradient field",
2314
- plasma: "Plasma — summed sines of position and time (the demoscene effect)",
2315
- "rings-field": "Concentric ring field — sine of the distance from a centre",
2316
- interference: "Wave interference — summed circular waves from several sources",
2317
- swirl: "Swirl — a field rotated by an angle that falls off with distance",
2318
- moire: "Moiré — two fine line patterns overlaid at an offset",
2319
- contour: "Contour lines (isolines) of a noise field",
2320
- scanline: "Scanline art — rows of marks displaced and sized by a field",
2321
- "optic-halftone": "Op-art halftone matrix — dot screens with optical interference",
2322
- "optic-moire": "Op-art moiré — line grids interfering",
2323
- "optic-reaction": "Reaction-diffusion pattern (Gray-Scott) in op-art tones",
2324
- meshgradient: "Mesh gradient — colour points blended over a deformable mesh",
2325
- "abstract-rd": "Reaction-diffusion — Gray-Scott chemistry (spots, stripes, coral)",
2326
- "abstract-mstp": "Multi-scale Turing patterns (Jonathan McCabe)",
2327
- "math-expression": "Oscilloscope — a typed expression traced like an XY scope",
2328
- "math-waveform": "Waveform plots — stacked periodic functions",
2329
- "math-curves": "Parametric curves in 3D — epicycles, knots, harmonographs",
2330
- "math-spinner": "Spinners — rotating epicycle stacks",
2331
- "math-threads": "String art — chords between points on a circle by a multiplication rule",
2332
- "math-surface": "Parametric surface z = f(x, y), drawn as a 3D wireframe",
2333
- "math-field": "Vector field plot — direction marks over a function of position",
2334
- "math-orbits": "Orbital paths — bodies on Keplerian and harmonic orbits",
2335
- "math-pendulum": "Pendulum wave — N pendulums whose swing counts differ by one; in-phase groups form at every rational fraction of the cycle",
2336
- "paratype-glyph": "Parametric type — glyphs built from adjustable strokes",
2337
- "modulator-rings": "Modulated rings — circles displaced by stacked oscillators",
2338
- "vector-distress": "Vector distress — SVG paths roughened by noise and erosion",
2339
- "flow-obstacles": "Flow field around obstacles — particles following a curl-noise field",
2340
- "flow-charges": "Electric field lines between point charges",
2341
- "flow-glyphs": "Glyph vortex — characters carried by a rotating flow",
2342
- "flow-ascii": "ASCII field — characters chosen by a noise field’s value",
2343
- "flow-voronoi": "Voronoi diagram whose cells pulse",
2344
- "flow-growth": "Differential growth — one closed line that grows, splits and repels (Anders Hoff’s differential line)",
2345
- "flow-letter-gap": "Letter-gap flow — lines that route around set type",
2346
- "drift-air": "Clouds and sky — fractal noise with domain warping",
2347
- "drift-water": "Water — Gerstner-style waves and caustics",
2348
- "drift-cloth": "Cloth — folded sine sheets with lighting",
2349
- iridescent: "Thin-film iridescence — colour from viewing angle over gradient forms",
2350
- softforms: "Soft forms — 2D signed-distance shapes, smooth-unioned and lit",
2351
- softforms3d: "3D soft forms — ray-marched signed-distance shapes with metaball blending",
2352
- scene3d: "3D scene — primitive meshes, lighting and a camera",
2353
- forms3d: "3D forms — instanced shapes arranged in space",
2354
- environment: "Environment — a 3D landscape scene (terrain, tunnel)",
2355
- ribbon: "Ribbon — a swept 3D surface along a curve",
2356
- "life-game": "Conway’s Game of Life and eight other B/S cellular automata (from kol-monitor)",
2357
- glass: "Glass — refraction through a distorted lens surface",
2358
- dither: "Ordered and error-diffusion dithering (Bayer, Floyd–Steinberg)",
2359
- "fx-chromatic": "Chromatic aberration — RGB channels offset",
2360
- "fx-edge": "Edge detection — Sobel gradient magnitude",
2361
- "fx-posterize": "Posterize — colour levels quantised",
2362
- "fx-pixelsort": "Pixel sorting — runs of pixels sorted by brightness",
2363
- "fx-mirror": "Mirror — the frame reflected about an axis",
2364
- "fx-kaleido": "Kaleidoscope — a wedge mirrored around a centre",
2365
- "fx-threshold": "Threshold — two tones split at a brightness level",
2366
- "fx-blocks": "Block glitch — rectangles displaced and repeated",
2367
- "fx-media": "Media motion — the image moved, scaled and rotated over time",
2368
- "fx-ascii": "ASCII art — brightness mapped to characters",
2369
- "fx-halftone-dither": "Halftone dither — print screens and ordered dither",
2370
- "fx-bitmap": "1-bit bitmap — threshold with a dither pattern",
2371
- "fx-growth": "Differential growth line drawn over the image’s brightness",
2372
- "fx-slice-wave": "Slice wave — horizontal slices offset by a sine",
2373
- "fx-riso": "Risograph — two spot-colour layers with misregistration and grain",
2374
- "fx-hsl": "HSL colour adjustment",
2375
- "fx-hsv": "HSV colour adjustment",
2376
- "fx-brightness": "Brightness adjustment",
2377
- "fx-contrast": "Contrast adjustment",
2378
- "fx-rgb": "Per-channel RGB levels",
2379
- "fx-invert": "Colour inversion",
2380
- "fx-sepia": "Sepia toning",
2381
- "fx-grayscale": "Greyscale (luma)",
2382
- "fx-enhance": "Enhance — local contrast and saturation",
2383
- "fx-blur": "Gaussian blur",
2384
- "fx-pixelate": "Pixelate — mosaic blocks",
2385
- "fx-solarize": "Solarisation — tones above a level inverted",
2386
- "fx-emboss": "Emboss — a directional relief kernel",
2387
- "fx-noise": "Film grain noise",
2388
- "gl-trails": "Feedback trails — the previous frame fed back and faded",
2389
- "gl-scan": "Rutt-Etra — scanlines displaced by brightness (the 1970s video synthesiser)",
2390
- "gl-slitscan": "Slit-scan — time smeared across the frame, a row at a time",
2391
- "gl-disco": "Disco — a mirror-ball facet shader",
2392
- "gl-distort": "Distortion — noise-driven UV displacement",
2393
- "gl-lens": "Lens — barrel and pincushion distortion",
2394
- "filter-adjustment": "Gamma, saturation, contrast and brightness adjustment",
2395
- "filter-hsl-adjustment": "HSL adjustment",
2396
- "filter-color-gradient": "Gradient map overlay",
2397
- "filter-color-map": "Colour lookup (LUT) mapping",
2398
- "filter-color-overlay": "Flat colour overlay",
2399
- "filter-color-replace": "Replace one colour with another",
2400
- "filter-multi-color-replace": "Replace several colours",
2401
- "filter-radial-blur": "Radial (spin) blur",
2402
- "filter-zoom-blur": "Zoom blur",
2403
- "filter-motion-blur": "Directional motion blur",
2404
- "filter-kawase-blur": "Kawase blur — a fast multi-pass blur",
2405
- "filter-tilt-shift": "Tilt-shift — a band of focus",
2406
- "filter-backdrop-blur": "Backdrop blur",
2407
- "filter-displacement": "Displacement map — pixels pushed by a second image",
2408
- "filter-twist": "Twist — a swirl distortion",
2409
- "filter-bulge-pinch": "Bulge / pinch lens distortion",
2410
- "filter-shockwave": "Shockwave — an expanding ring of refraction",
2411
- "filter-ascii": "ASCII characters by brightness",
2412
- "filter-cross-hatch": "Cross-hatching by brightness",
2413
- "filter-dot": "Dot screen (halftone)",
2414
- "filter-crt": "CRT — scanlines, curvature and vignette",
2415
- "filter-old-film": "Old film — scratches, grain and sepia",
2416
- "filter-glitch": "Glitch — slices offset with colour shift",
2417
- "filter-rgb-split": "RGB split",
2418
- "filter-simplex-noise": "Simplex noise overlay",
2419
- "filter-bloom": "Bloom — bright areas glow",
2420
- "filter-advanced-bloom": "Bloom with threshold and brightness control",
2421
- "filter-glow": "Glow around edges",
2422
- "filter-godray": "God rays — volumetric light shafts",
2423
- "filter-simple-lightmap": "Light map — a texture multiplies the light",
2424
- "filter-bevel": "Bevel — edges lit as relief",
2425
- "filter-drop-shadow": "Drop shadow",
2426
- "filter-outline": "Outline around shapes",
2427
- "filter-reflection": "Water reflection with waves",
2428
- "filter-convolution": "Custom 3×3 convolution kernel"
2429
- }, wn = new Set([
2430
- "drift",
2431
- "iridescent",
2432
- "softforms",
2433
- "mesh"
2434
- ]), Tn = new Set([
2435
- "scene",
2436
- "forms",
2437
- "environment",
2438
- "ribbon"
2439
- ]);
2440
- function En(e, t = !1) {
2441
- return t ? e.pixi || /^filter-/.test(e.id) ? "WebGL shader (PixiJS)" : e.kind === "engine" || /^gl-/.test(e.id) ? "WebGL shader" : "canvas 2D" : e.group === "field" && e.id !== "halftone" || e.id === "optic-moire" ? "WebGL shader" : Tn.has(e.engine) ? "three.js" : e.engine === "softforms3d" ? "WebGL shader (ray-marched)" : wn.has(e.engine) ? "WebGL shader" : "canvas 2D";
2442
- }
2443
- function Dn(e, t = !1) {
2444
- if (!e) return null;
2445
- let n = e.about ?? {};
2446
- return {
2447
- kind: n.kind ?? (t ? "effect" : "generative"),
2448
- basis: n.basis ?? Cn[e.id] ?? null,
2449
- engine: n.engine ?? En(e, t),
2450
- dimension: n.dimension ?? (e.is3D ? "3D" : "2D")
2451
- };
2452
- }
2453
- //#endregion
2454
- //#region src/editor/compose/inspectors/AboutLine.jsx
2455
- function On({ def: e, isFilter: t = !1 }) {
2456
- let n = et(), r = c(), i = Dn(e, t);
2457
- return i ? /* @__PURE__ */ q(G, { children: [/* @__PURE__ */ K(B, {
2458
- size: r,
2459
- iconOnly: "info",
2460
- "aria-label": "About this preset",
2461
- popoverTarget: n
2462
- }), /* @__PURE__ */ q("div", {
2463
- id: n,
2464
- popover: "auto",
2465
- className: "m-auto w-[min(320px,calc(100vw-32px))] rounded-[var(--kol-radius-sm)] border-0 bg-surface-primary p-4 text-body shadow-[var(--kol-shadow-rail-up)]",
2466
- children: [/* @__PURE__ */ q("p", {
2467
- className: "kol-eyebrow text-meta",
2468
- children: [
2469
- i.kind,
2470
- " · ",
2471
- i.engine,
2472
- " · ",
2473
- i.dimension
2474
- ]
2475
- }), i.basis && /* @__PURE__ */ K("p", {
2476
- className: "kol-sans-body-03 mt-2",
2477
- children: i.basis
2478
- })]
2479
- })] }) : null;
2480
- }
2481
- //#endregion
2482
- //#region src/loops/theme.js
2483
- function kn(n, r, i, a) {
2484
- return se(n, r, t(e(i, a)));
2485
- }
2486
- //#endregion
2487
- //#region src/editor/compose/inspectors/LoopFields.jsx
2488
- var An = rt.flatMap((e) => e.groups), jn = (e, t) => {
2489
- let n = e.map((e) => ({
2490
- value: e.id,
2491
- label: e.label
2492
- }));
2493
- return t == null || t === "custom" ? [{
2494
- value: "custom",
2495
- label: "Custom"
2496
- }, ...n] : n;
2497
- };
2498
- function Q({ inline: e, label: t, align: n = "fill", children: r }) {
2499
- return e ? /* @__PURE__ */ K(Ge, {
2500
- label: t,
2501
- align: n,
2502
- labelWidth: a,
2503
- children: r
2504
- }) : /* @__PURE__ */ K(H, {
2505
- label: t,
2506
- children: r
2507
- });
2508
- }
2509
- var Mn = [{
2510
- value: "off",
2511
- label: "Off"
2512
- }, {
2513
- value: "on",
2514
- label: "On"
2515
- }];
2516
- function $({ inline: e, cs: t, on: n, onChange: r }) {
2517
- return e ? /* @__PURE__ */ K(We, {
2518
- tone: "sunken",
2519
- size: t,
2520
- className: `w-full ${o(t) ?? ""}`,
2521
- options: Mn,
2522
- value: n ? "on" : "off",
2523
- onChange: (e) => r(e === "on")
2524
- }) : /* @__PURE__ */ K(Xe, {
2525
- size: t,
2526
- options: Mn,
2527
- viewMode: n ? "on" : "off",
2528
- onViewChange: (e) => r(e === "on")
2529
- });
2530
- }
2531
- function Nn({ layer: e, setProp: t, patch: n, updateLayer: r, palette: i, renderAnimate: a, tab: o, tabStrip: s, tree: l, picker: m = !0, inline: _ = !1, showSeed: v = !_, onReset: ee }) {
2532
- let x = c(), S = L(e.loopId), ce = p(), le = (S?.params ?? []).some((e) => e.key === "orbit"), ue = (e) => {
2533
- I("orbit", e), e && !ce.grab && oe("grab", !0);
2534
- }, w = S?.params ?? [], fe = e.themeId ?? "kol", E = !!e.themeInvert, D = (t) => r(e.id, {
2535
- themeId: t,
2536
- ...kn(e, S?.params, t, E)
2537
- }), pe = (t) => r(e.id, {
2538
- themeInvert: t,
2539
- ...kn(e, S?.params, fe, t)
2540
- }), ge = e._paletteRelation ?? "analogous", O = (S?.params ?? []).filter((e) => e.type === "color"), k = new Set(e._rollKeep ?? []), _e = (t = ge, n = {}) => {
2541
- let i = d(g(b()), t), a = se(e, S?.params, i, { rotate: !0 });
2542
- r(e.id, {
2543
- ...n,
2544
- ...Object.fromEntries(O.filter((e) => !k.has(e.key)).map((e) => [e.key, a[e.key]]))
2545
- });
2546
- }, ve = (e) => t("_rollKeep", k.has(e) ? [...k].filter((t) => t !== e) : [...k, e]), A = zt(e.loopId), ye = A ? Object.keys(A).map((e) => ({
2547
- id: e,
2548
- label: e
2549
- })) : null, j = A ? new Set(Object.values(A).flatMap((e) => Object.keys(e))) : null, M = h(e), N = ae(re(w, e), y(w, e)), P = It(e.loopId, e), [xe, Se] = nt(!1), Ce = (t, n, i) => {
2550
- let a = f(e, t, M.take(), {
2551
- stripNoRandom: !!n?.motion,
2552
- ...i
2553
- });
2554
- P && n?.motion && (n.id !== "Form" && (a._framePreset = "custom"), n.id !== "Frame" && (a._formPreset = "custom")), j && Object.keys(a).some((e) => j.has(e)) && (a._lookPreset = "custom"), r(e.id, a);
2555
- }, F = (t) => {
2556
- let n = T(e.loopGroup).find((t) => t.id === e.presetId)?.params ?? {}, i = {};
2557
- for (let e of t) {
2558
- let t = n[e.key] === void 0 ? e.default : n[e.key];
2559
- t !== void 0 && (i[e.key] = t);
2560
- }
2561
- r(e.id, i);
2562
- }, we = P ? Lt(P.frame) : null, Te = P ? Lt(P.form) : null, I = (e, t) => {
2563
- let r = {};
2564
- we?.has(e) && (r._framePreset = "custom"), Te?.has(e) && (r._formPreset = "custom"), j?.has(e) && (r._lookPreset = "custom"), n({
2565
- [e]: t,
2566
- ...r
2567
- });
2568
- }, Ee = (e, t) => (r) => {
2569
- let i = t.find((e) => e.id === r);
2570
- n({
2571
- [e]: r,
2572
- ...i?.params ?? {}
2573
- });
2574
- }, De = (e) => n({
2575
- _lookPreset: e,
2576
- ...A?.[e] ?? {}
2577
- }), Oe = S?.camera ? S.camera.map((e) => ({
2578
- ...e,
2579
- section: "Camera"
2580
- })) : null, R = [...S?.camera ?? [], ...w.filter((e) => ne(e) === "Camera")], z = S?.kind === "engine", ke = R.length > 0 || z && S?.orbit, je = S?.engine === "scene" && (e.animMode === "keyframes" || e.animMode === "keyframe"), Me = S?.orbit ? {
2581
- yaw: 1,
2582
- dist: 1
2583
- } : de(S), Pe = Me ? /* @__PURE__ */ K("p", {
2584
- className: `kol-mono-10 text-meta${_ ? "" : " col-span-2"}`,
2585
- children: S?.orbit ? "Press C, then drag to orbit the camera and scroll to zoom." : Me.yaw ? "Press C, then drag to rotate and scroll to zoom." : "Press C, then scroll to zoom."
2586
- }) : null;
2587
- return /* @__PURE__ */ q(G, { children: [
2588
- s,
2589
- m && (_ ? o === "generate" && /* @__PURE__ */ K(U, {
2590
- divided: !0,
2591
- children: /* @__PURE__ */ K(xt, {
2592
- layer: e,
2593
- tree: l,
2594
- inline: !0,
2595
- about: /* @__PURE__ */ K(On, { def: S })
2596
- })
2597
- }) : /* @__PURE__ */ K(xt, {
2598
- layer: e,
2599
- tree: l,
2600
- about: /* @__PURE__ */ K(On, { def: S })
2601
- })),
2602
- (o === "generate" || o === "labs-effect") && /* @__PURE__ */ q(G, { children: [
2603
- (e.loopId === "softforms" || e.loopId === "softforms3d") && /* @__PURE__ */ K(yn, { layer: e }),
2604
- A && !_ && /* @__PURE__ */ K(Q, {
2605
- inline: _,
2606
- label: "Look",
2607
- children: /* @__PURE__ */ K(V, {
2608
- variant: "subtle",
2609
- size: x,
2610
- className: "w-full",
2611
- options: jn(ye, e._lookPreset),
2612
- value: e._lookPreset ?? "custom",
2613
- onChange: De
2614
- })
2615
- }),
2616
- _ && /* @__PURE__ */ q(U, {
2617
- divided: !0,
2618
- children: [
2619
- A && /* @__PURE__ */ K(Q, {
2620
- inline: !0,
2621
- label: "Look",
2622
- children: /* @__PURE__ */ K(V, {
2623
- variant: "subtle",
2624
- size: x,
2625
- className: "w-full",
2626
- options: jn(ye, e._lookPreset),
2627
- value: e._lookPreset ?? "custom",
2628
- onChange: De
2629
- })
2630
- }),
2631
- /* @__PURE__ */ K(Q, {
2632
- inline: !0,
2633
- label: "Theme",
2634
- children: /* @__PURE__ */ K(V, {
2635
- variant: "subtle",
2636
- size: x,
2637
- className: "w-full",
2638
- options: u,
2639
- value: fe,
2640
- onChange: D
2641
- })
2642
- }),
2643
- /* @__PURE__ */ K(Q, {
2644
- inline: !0,
2645
- label: "Invert",
2646
- children: /* @__PURE__ */ K($, {
2647
- inline: !0,
2648
- cs: x,
2649
- on: E,
2650
- onChange: pe
2651
- })
2652
- }),
2653
- O.length > 0 && /* @__PURE__ */ K(Q, {
2654
- inline: !0,
2655
- label: "Palette",
2656
- children: /* @__PURE__ */ q("div", {
2657
- className: "flex w-full gap-2",
2658
- children: [
2659
- /* @__PURE__ */ K(V, {
2660
- variant: "subtle",
2661
- size: x,
2662
- className: "flex-1 min-w-0",
2663
- options: te.map((e) => ({
2664
- value: e.id,
2665
- label: e.label
2666
- })),
2667
- value: ge,
2668
- onChange: (e) => _e(e, { _paletteRelation: e })
2669
- }),
2670
- /* @__PURE__ */ K(B, {
2671
- tone: "primary",
2672
- size: x,
2673
- onClick: () => _e(),
2674
- children: "Roll"
2675
- }),
2676
- /* @__PURE__ */ K(W, {
2677
- label: "Edit in Color Modes",
2678
- children: /* @__PURE__ */ K(B, {
2679
- tone: "primary",
2680
- size: x,
2681
- iconOnly: "clr-tri",
2682
- "aria-label": "Edit in Color Modes",
2683
- onClick: Ne
2684
- })
2685
- })
2686
- ]
2687
- })
2688
- }),
2689
- O.length > 1 && /* @__PURE__ */ K(Q, {
2690
- inline: !0,
2691
- label: "Rolls",
2692
- children: /* @__PURE__ */ K("div", {
2693
- className: "flex w-full flex-wrap gap-1",
2694
- children: O.map((e) => /* @__PURE__ */ K(B, {
2695
- size: x,
2696
- tone: k.has(e.key) ? "ghost" : "primary",
2697
- pressed: !k.has(e.key),
2698
- "aria-label": `Roll ${e.label}`,
2699
- onClick: () => ve(e.key),
2700
- children: e.label
2701
- }, e.key))
2702
- })
2703
- }),
2704
- me(S) && /* @__PURE__ */ K(Q, {
2705
- inline: !0,
2706
- label: "Background",
2707
- children: /* @__PURE__ */ K($, {
2708
- inline: !0,
2709
- cs: x,
2710
- on: e.bgOn !== !1,
2711
- onChange: (e) => t("bgOn", e)
2712
- })
2713
- }),
2714
- Pe
2715
- ]
2716
- }),
2717
- !_ && /* @__PURE__ */ q("div", {
2718
- className: "grid grid-cols-2 gap-2",
2719
- children: [
2720
- /* @__PURE__ */ K(Q, {
2721
- inline: !1,
2722
- label: "Theme",
2723
- children: /* @__PURE__ */ K(V, {
2724
- variant: "subtle",
2725
- size: x,
2726
- className: "w-full",
2727
- options: u,
2728
- value: fe,
2729
- onChange: D
2730
- })
2731
- }),
2732
- /* @__PURE__ */ K(Q, {
2733
- inline: !1,
2734
- label: "Invert",
2735
- children: /* @__PURE__ */ K($, {
2736
- inline: !1,
2737
- cs: x,
2738
- on: E,
2739
- onChange: pe
2740
- })
2741
- }),
2742
- me(S) && /* @__PURE__ */ K(Q, {
2743
- inline: !1,
2744
- label: "Background",
2745
- children: /* @__PURE__ */ K($, {
2746
- inline: !1,
2747
- cs: x,
2748
- on: e.bgOn !== !1,
2749
- onChange: (e) => t("bgOn", e)
2750
- })
2751
- }),
2752
- Pe
2753
- ]
2754
- }),
2755
- /* @__PURE__ */ K(C, {
2756
- schema: w,
2757
- layer: e,
2758
- setProp: I,
2759
- palette: i,
2760
- renderAnimate: a,
2761
- tab: "generate",
2762
- inline: _
2763
- }),
2764
- _ && /* @__PURE__ */ K(Ve, {}),
2765
- /* @__PURE__ */ q("div", {
2766
- className: "flex gap-2",
2767
- children: [
2768
- [
2769
- ["type", "Type"],
2770
- ["category", "Category"],
2771
- ["preset", "Preset"]
2772
- ].filter(([t]) => pt(e, t, An)).map(([t, n]) => /* @__PURE__ */ K(B, {
2773
- tone: "primary",
2774
- size: x,
2775
- className: "flex-1 min-w-0",
2776
- "aria-label": `Randomize ${n.toLowerCase()}`,
2777
- onClick: () => {
2778
- let n = M.take(), i = mt(e, t, g(n >>> 0), An);
2779
- i && r(e.id, {
2780
- ...i,
2781
- _rollSeed: n
2782
- });
2783
- },
2784
- children: n
2785
- }, t)),
2786
- /* @__PURE__ */ K(B, {
2787
- tone: "primary",
2788
- size: x,
2789
- className: "flex-1 min-w-0",
2790
- "aria-label": "Randomize settings",
2791
- onClick: (t) => {
2792
- if (t.altKey) return F(y(w, e));
2793
- let n = M.take();
2794
- r(e.id, {
2795
- ...ht(e, y(w, e), g(n >>> 0)),
2796
- _rollSeed: n
2797
- });
2798
- },
2799
- children: "Settings"
2800
- }),
2801
- /* @__PURE__ */ K(B, {
2802
- tone: "primary",
2803
- size: x,
2804
- iconOnly: "nav-settings",
2805
- "aria-label": "What Settings rolls",
2806
- onClick: () => Se(!0),
2807
- className: "shrink-0"
2808
- }),
2809
- /* @__PURE__ */ K(W, {
2810
- label: "Reset to defaults",
2811
- shortcut: "R",
2812
- children: /* @__PURE__ */ K(B, {
2813
- tone: "primary",
2814
- size: x,
2815
- iconOnly: "refresh",
2816
- "aria-label": "Reset to defaults",
2817
- onClick: ee ?? (() => F(y(w, e))),
2818
- className: "shrink-0"
2819
- })
2820
- })
2821
- ]
2822
- }),
2823
- /* @__PURE__ */ K(St, {
2824
- open: xe,
2825
- onClose: () => Se(!1),
2826
- schema: w,
2827
- layer: e,
2828
- size: x
2829
- }),
2830
- N.length > 0 && /* @__PURE__ */ q("div", {
2831
- className: `grid ${_ ? "grid-cols-3" : "grid-cols-2"} gap-2`,
2832
- children: [N.map((e) => /* @__PURE__ */ K(B, {
2833
- tone: "primary",
2834
- size: x,
2835
- onClick: (t) => t.altKey ? F(e.params) : Ce(e.params, e),
2836
- children: e.label
2837
- }, e.id)), e.loopId === "math-expression" && /* @__PURE__ */ K(B, {
2838
- tone: "primary",
2839
- size: x,
2840
- onClick: (t) => {
2841
- if (t.altKey) return F(N.find((e) => e.id === "Expression")?.params ?? []);
2842
- let n = M.take();
2843
- r(e.id, {
2844
- expr: be(g(n >>> 0)),
2845
- _rollSeed: n
2846
- });
2847
- },
2848
- children: "Wild"
2849
- })]
2850
- }),
2851
- v && y(w, e).length >= 5 && /* @__PURE__ */ K(ie, {
2852
- seed: M,
2853
- inline: _
2854
- }),
2855
- e.loopId === "pattern-rules" && (e.render ?? "tiles") === "tiles" && /* @__PURE__ */ K(Qt, {
2856
- layer: e,
2857
- patch: n,
2858
- seed: M
2859
- })
2860
- ] }),
2861
- (o === "style" || o === "labs-effect") && /* @__PURE__ */ q(G, { children: [
2862
- /* @__PURE__ */ K(C, {
2863
- schema: w,
2864
- layer: e,
2865
- setProp: I,
2866
- palette: i,
2867
- renderAnimate: a,
2868
- tab: "style",
2869
- inline: _
2870
- }),
2871
- S?.group === "penrose" && e.loopId?.startsWith("penrose-") && /* @__PURE__ */ K(Sn, {
2872
- layer: e,
2873
- setProp: I,
2874
- patch: n
2875
- }),
2876
- e.loopId === "pattern-rules" && /* @__PURE__ */ K(nn, {
2877
- layer: e,
2878
- patch: n
2879
- }),
2880
- e.loopId === "math-curves" && /* @__PURE__ */ K(rn, {
2881
- layer: e,
2882
- patch: n
2883
- }),
2884
- e.loopId === "math-expression" && /* @__PURE__ */ q("div", {
2885
- className: "grid grid-cols-2 gap-2",
2886
- children: [/* @__PURE__ */ K(B, {
2887
- tone: "primary",
2888
- size: x,
2889
- onClick: () => r(e.id, he(e)),
2890
- children: "Fit"
2891
- }), /* @__PURE__ */ K(B, {
2892
- tone: "primary",
2893
- size: x,
2894
- onClick: () => F(N.find((e) => e.id === "View")?.params ?? []),
2895
- children: "Reset"
2896
- })]
2897
- })
2898
- ] }),
2899
- o === "anim" && /* @__PURE__ */ q(G, { children: [
2900
- P && /* @__PURE__ */ q(U, {
2901
- label: "Motion",
2902
- divided: !0,
2903
- children: [/* @__PURE__ */ K(Q, {
2904
- inline: _,
2905
- label: "Frame",
2906
- children: /* @__PURE__ */ K(V, {
2907
- variant: "subtle",
2908
- size: x,
2909
- className: "w-full",
2910
- options: jn(P.frame, e._framePreset),
2911
- value: e._framePreset ?? "custom",
2912
- onChange: Ee("_framePreset", P.frame)
2913
- })
2914
- }), /* @__PURE__ */ K(Q, {
2915
- inline: _,
2916
- label: "Form",
2917
- children: /* @__PURE__ */ K(V, {
2918
- variant: "subtle",
2919
- size: x,
2920
- className: "w-full",
2921
- options: jn(P.form, e._formPreset),
2922
- value: e._formPreset ?? "custom",
2923
- onChange: Ee("_formPreset", P.form)
2924
- })
2925
- })]
2926
- }),
2927
- /* @__PURE__ */ K(Ae, {
2928
- layer: e,
2929
- schema: w,
2930
- setProp: I
2931
- }),
2932
- le && !S?.is3D && /* @__PURE__ */ K(U, {
2933
- label: "Interaction",
2934
- divided: !0,
2935
- children: /* @__PURE__ */ K(Q, {
2936
- inline: _,
2937
- label: "Drag (C)",
2938
- children: /* @__PURE__ */ K($, {
2939
- inline: _,
2940
- cs: x,
2941
- on: !!ce.grab && e.orbit !== !1,
2942
- onChange: ue
2943
- })
2944
- })
2945
- }),
2946
- S?.is3D && /* @__PURE__ */ q(U, {
2947
- label: "3D",
2948
- divided: !0,
2949
- children: [/* @__PURE__ */ K(Q, {
2950
- inline: _,
2951
- label: "Orbit (C)",
2952
- children: /* @__PURE__ */ K($, {
2953
- inline: _,
2954
- cs: x,
2955
- on: !!ce.grab && e.orbit !== !1,
2956
- onChange: ue
2957
- })
2958
- }), S.zoom3dKey && /* @__PURE__ */ K(C, {
2959
- schema: w.filter((e) => e.key === S.zoom3dKey).map(({ section: e, ...t }) => t),
2960
- layer: e,
2961
- setProp: I,
2962
- palette: i,
2963
- renderAnimate: a,
2964
- tab: "anim",
2965
- inline: _
2966
- })]
2967
- }),
2968
- /* @__PURE__ */ K(C, {
2969
- schema: S?.is3D && S.zoom3dKey ? w.filter((e) => e.key !== S.zoom3dKey) : w,
2970
- layer: e,
2971
- setProp: I,
2972
- palette: i,
2973
- renderAnimate: a,
2974
- tab: "anim",
2975
- inline: _
2976
- }),
2977
- je && /* @__PURE__ */ K(Xt, {
2978
- layer: e,
2979
- patch: n,
2980
- defaultDuration: S?.duration ?? 8
2981
- }),
2982
- Oe && /* @__PURE__ */ K(C, {
2983
- schema: Oe,
2984
- layer: e,
2985
- setProp: t,
2986
- palette: i,
2987
- renderAnimate: a,
2988
- inline: _
2989
- }),
2990
- ke && /* @__PURE__ */ K(Zt, {
2991
- layer: e,
2992
- patch: n,
2993
- camParams: R,
2994
- isEngine: z,
2995
- showHeader: !Oe
2996
- })
2997
- ] }),
2998
- /* @__PURE__ */ K(an, {
2999
- layer: e,
3000
- patch: n,
3001
- renderAnimate: a,
3002
- tab: o === "labs-effect" ? "style" : o
3003
- })
3004
- ] });
3005
- }
3006
- //#endregion
3007
- //#region src/editor/labs/useLabsLayer.js
3008
- function Pn() {
3009
- let { layers: e, addLayer: t, removeLayer: n, updateLayer: r, select: i, beginTransaction: a, commitTransaction: o } = s(), c = Qe((s, c) => {
3010
- let [l, ...u] = e;
3011
- a();
3012
- for (let e of u) n(e.id);
3013
- let d;
3014
- return l && l.type === s ? (r(l.id, c), i(l.id), d = l.id) : (l && n(l.id), d = t(s, c)), o(), d;
3015
- }, [
3016
- e,
3017
- t,
3018
- n,
3019
- r,
3020
- i,
3021
- a,
3022
- o
3023
- ]);
3024
- return {
3025
- layer: e[0] ?? null,
3026
- setOnly: c
3027
- };
3028
- }
3029
- //#endregion
3030
- //#region src/editor/morph/StepPicker.jsx
3031
- function Fn(e) {
3032
- let t = De(e.id), n = L(e.loop)?.params ?? [];
3033
- return {
3034
- loopId: e.loop,
3035
- loopGroup: t,
3036
- presetId: e.id,
3037
- presetLabel: e.label,
3038
- params: Fe(E(e), n),
3039
- source: {
3040
- kind: "preset",
3041
- id: e.id,
3042
- label: e.label
3043
- }
3044
- };
3045
- }
3046
- function In(e, t) {
3047
- let n = t ? Pe(e, t) : (e.layers ?? []).find((e) => e?.type === "loop");
3048
- if (!n) return null;
3049
- let r = L(n.loopId)?.params ?? [];
3050
- return {
3051
- loopId: n.loopId,
3052
- loopGroup: n.loopGroup,
3053
- presetId: n.presetId,
3054
- presetLabel: n.presetLabel,
3055
- params: Fe(n, r),
3056
- source: {
3057
- kind: "file",
3058
- id: e.id,
3059
- label: e.name || "Untitled"
3060
- }
3061
- };
3062
- }
3063
- function Ln(e) {
3064
- let t = L(e.loopId)?.params ?? [];
3065
- return {
3066
- loopId: e.loopId,
3067
- loopGroup: e.loopGroup,
3068
- presetId: e.presetId,
3069
- presetLabel: e.presetLabel,
3070
- params: Fe(e, t),
3071
- source: {
3072
- kind: "stage",
3073
- label: e.presetLabel || "Stage"
3074
- }
3075
- };
3076
- }
3077
- function Rn() {
3078
- let e = Re(), { layer: t, setOnly: n } = Pn(), r = !!e.picker, i = e.mode === "blend" ? e.loopId : null, [a, o] = nt(""), s = t?.type === "loop" && (e.steps.length < 2 || e.editing != null), { rows: c, make: l } = tt(() => {
3079
- let e = [], n = /* @__PURE__ */ new Map();
3080
- if (!r) return {
3081
- rows: e,
3082
- make: n
3083
- };
3084
- s && (!i || t.loopId === i) && (e.push({
3085
- id: "stage",
3086
- label: t.presetLabel || "Current stage",
3087
- group: "Current stage",
3088
- hint: D(t.loopGroup)?.label
3089
- }), n.set("stage", () => Ln(t)));
3090
- for (let t of (Me().preset ?? []).filter((e) => !e.shipped)) {
3091
- if (t.mode === "morph" || !(i ? Pe(t, i) : (t.layers ?? []).some((e) => e?.type === "loop"))) continue;
3092
- let r = `file:${t.id}`;
3093
- e.push({
3094
- id: r,
3095
- label: t.name || "Untitled",
3096
- group: "My files"
3097
- }), n.set(r, () => In(t, i));
3098
- }
3099
- for (let t of ve) {
3100
- if (R(t) || i && t.loop !== i) continue;
3101
- let r = `preset:${t.id}`;
3102
- e.push({
3103
- id: r,
3104
- label: t.label,
3105
- group: D(De(t.id))?.label ?? t.loop,
3106
- hint: t.sub
3107
- }), n.set(r, () => Fn(t));
3108
- }
3109
- return {
3110
- rows: e,
3111
- make: n
3112
- };
3113
- }, [
3114
- r,
3115
- i,
3116
- s,
3117
- t
3118
- ]), [u, d] = nt(null), f = tt(() => {
3119
- if (u) return [{
3120
- id: "back",
3121
- label: "All categories",
3122
- icon: "arrow-left",
3123
- group: u,
3124
- keepOpen: !0
3125
- }, ...c.filter((e) => e.id.startsWith("preset:") && e.group === u)];
3126
- let e = /* @__PURE__ */ new Map();
3127
- for (let t of c) t.id.startsWith("preset:") && e.set(t.group, (e.get(t.group) ?? 0) + 1);
3128
- let t = [...e].map(([e, t]) => ({
3129
- id: `cat:${e}`,
3130
- label: e,
3131
- icon: "arrow-right",
3132
- group: "Categories",
3133
- hint: `${t}`,
3134
- cat: e,
3135
- keepOpen: !0
3136
- }));
3137
- return [...c.filter((e) => !e.id.startsWith("preset:")), ...t];
3138
- }, [c, u]);
3139
- if (!r) return null;
3140
- let p = a.trim().toLowerCase();
3141
- return /* @__PURE__ */ K(Ke, {
3142
- open: !0,
3143
- onClose: () => {
3144
- Ie({ picker: null }), o(""), d(null);
3145
- },
3146
- suggestions: f,
3147
- results: p ? c.filter((e) => [
3148
- e.label,
3149
- e.group,
3150
- e.hint
3151
- ].some((e) => e && e.toLowerCase().includes(p))) : [],
3152
- query: a,
3153
- onQueryChange: o,
3154
- onSelect: (t) => {
3155
- if (t.keepOpen) {
3156
- d(t.cat ?? null);
3157
- return;
3158
- }
3159
- let r = l.get(t.id)?.();
3160
- r && (e.steps.length === 0 && n("loop", {
3161
- loopGroup: r.loopGroup,
3162
- presetId: r.presetId,
3163
- presetLabel: r.presetLabel,
3164
- loopId: r.loopId,
3165
- ...r.params
3166
- }), Le(r));
3167
- },
3168
- placeholder: "Search presets and files",
3169
- selectLabel: "Add step"
3170
- });
3171
- }
3172
- //#endregion
3173
- //#region src/packs/generators.js
3174
- var zn = {
3175
- layerTypes: ["loop", "misc"],
3176
- GROUPS: M,
3177
- loopById: L,
3178
- loopDrawParams: fe,
3179
- resolveCameraKeys: de,
3180
- loopBgToggleable: me,
3181
- presetById: ue,
3182
- presetParams: E,
3183
- presetsInGroup: T,
3184
- presetsInSub: w,
3185
- presetLayerPatch: Oe,
3186
- isToolPreset: R,
3187
- groupById: D,
3188
- drawLoopFrame: ce,
3189
- GENERATIVE_TREE: rt,
3190
- MISC_TREE: it,
3191
- THEME_OPTIONS: u,
3192
- buildParatypeFlattenGroup: ut,
3193
- LoopPicker: xt,
3194
- LoopFields: Nn,
3195
- stepFromPreset: Fn,
3196
- loadGlHost: () => import("./host-DXizGh-A.js")
3197
- };
3198
- v("generators", zn);
3199
- //#endregion
3200
- export { yt as _, Pn as a, it as b, Jt as c, Kt as d, St as f, vt as g, ht as h, Fn as i, Yt as l, bt as m, Rn as n, Nn as o, ft as p, Ln as r, On as s, zn as t, qt as u, dt as v, rt as y };