@kolkrabbi/design-editor 0.23.0 → 0.26.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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/BindDot-CMUtpJPX.js +84 -0
  3. package/dist/BufferGeometryUtils-Cc8LNd5v.js +150 -0
  4. package/dist/ColorModesWindow-CWhL6nfm.js +1493 -0
  5. package/dist/GLTFLoader-BFir8PCc.js +1361 -0
  6. package/dist/OBJLoader-BgqC_-Jn.js +287 -0
  7. package/dist/{OrbitControls-Cql8Rn2i.js → OrbitControls-DVpLgmKv.js} +2755 -2202
  8. package/dist/STLLoader-C6DGLf6r.js +83 -0
  9. package/dist/TreePicker-nMf17QGH.js +68 -0
  10. package/dist/core-CfGqY4VB.js +17504 -0
  11. package/dist/core.js +4 -3
  12. package/dist/design-editor.css +1 -1
  13. package/dist/design-editor.js +2114 -916
  14. package/dist/effects-DZEmfY7a.js +444 -0
  15. package/dist/effects.js +1 -1
  16. package/dist/generators-D1tFSZgG.js +2961 -0
  17. package/dist/generators.js +1 -1
  18. package/dist/{host-B4SRaN9h.js → host-CRsCCafL.js} +429 -370
  19. package/dist/{host-be1CWhN1.js → host-ZLJKCZ54.js} +137 -136
  20. package/dist/motion-BJ8xqUKI.js +3096 -0
  21. package/dist/motion.js +1 -1
  22. package/dist/previewScale-BMkeLc6w.js +26 -0
  23. package/dist/{rolls-Bg1XHuvJ.js → rolls-BGtqxVYq.js} +2621 -1522
  24. package/dist/{src-B5fQgAVE.js → src-BpTckTDZ.js} +1 -1
  25. package/dist/{labels-B5qkocWy.js → timelinePinned-BwYq1Msi.js} +321 -164
  26. package/dist/{useLayerEdit-ieOjHx6x.js → useLayerEdit-BFcZhiNX.js} +20992 -12580
  27. package/package.json +11 -9
  28. package/dist/RuleRow-BXkjpTyN.js +0 -650
  29. package/dist/TreePicker-DLmMl0aU.js +0 -68
  30. package/dist/core-CTI1YRJD.js +0 -12335
  31. package/dist/effectCategories-BcaQSD_V.js +0 -4216
  32. package/dist/effects-pCd8YTdQ.js +0 -469
  33. package/dist/generators-B8_StNAy.js +0 -2517
  34. package/dist/motion-DFnAar_2.js +0 -2263
@@ -1,2517 +0,0 @@
1
- import { Ft as e, It as t, Rt as n, S as r, V as i, a, c as o, dn as s, i as c, j as l, l as u, mn as d, n as f, o as p, pn as m, s as h, t as ee, u as g, x as _, z as te } from "./rolls-Bg1XHuvJ.js";
2
- import { $ as ne, B as re, F as v, I as y, L as b, N as x, P as S, Q as C, R as ie, V as ae, a as w, c as oe, d as T, et as E, f as D, g as se, h as O, l as ce, m as k, n as A, p as j, s as M, t as le, tt as N, u as ue, z as de } from "./useLayerEdit-ieOjHx6x.js";
3
- import { a as P, c as fe, i as pe, o as me, s as F, t as he } from "./RuleRow-BXkjpTyN.js";
4
- import { n as I, t as ge } from "./TreePicker-DLmMl0aU.js";
5
- import { Button as L, CurveEditor as _e, Dropdown as R, KeyframeEditor as ve, LabeledControl as z, LabeledControlSection as ye, SegmentedToggle as be, SettingsRow as xe, Slider as Se, Tooltip as B, ViewToggle as Ce, XYPad as we } from "@kolkrabbi/kol-component";
6
- import { useEffect as Te, useRef as Ee, useState as De } from "react";
7
- import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
8
- //#region src/loops/paratype/flatten.js
9
- var Oe = Object.fromEntries(x.params.map((e) => [e.key, e.default]));
10
- function ke(e) {
11
- let t = { ...Oe };
12
- for (let n of Object.keys(Oe)) {
13
- let r = e[n];
14
- r != null && typeof r != "object" && (t[n] = r);
15
- }
16
- return t;
17
- }
18
- function Ae(e, t) {
19
- let n = t.stemWidth ?? 18, r = 0;
20
- 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;
21
- }
22
- var W = (e) => Number(e.toFixed(2));
23
- function je(e, t, n) {
24
- if (!e || e.loopId !== "paratype-glyph") return null;
25
- let r = Math.max(1, e.w ?? 480), i = Math.max(1, e.h ?? 480), a = ke(e), o = S(a, r, i);
26
- if (!o.length) return null;
27
- let s = [];
28
- t.bg && s.push({
29
- id: n("shape"),
30
- type: "shape",
31
- kind: "rect",
32
- color: t.bg,
33
- x: 0,
34
- y: 0,
35
- w: r,
36
- h: i,
37
- visible: !0,
38
- opacity: 1,
39
- blend: "normal"
40
- });
41
- for (let e of o) {
42
- let r = Ae(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 ${W(o)} ${W(c)}" preserveAspectRatio="none"><g transform="translate(${W(r)} ${W(e.y1 + i)}) scale(1 -1)">${l}</g></svg>`;
43
- s.push({
44
- id: n("shape"),
45
- type: "shape",
46
- kind: "flatten",
47
- svg: u,
48
- fit: "fill",
49
- color: t.fg,
50
- x: W(e.tx - r * e.s),
51
- y: W(e.ty - (e.y1 + i) * e.s),
52
- w: Math.max(1, W(o * e.s)),
53
- h: Math.max(1, W(c * e.s)),
54
- visible: !0,
55
- opacity: 1,
56
- blend: "normal"
57
- });
58
- }
59
- return {
60
- id: n("group"),
61
- type: "group",
62
- x: e.x ?? 0,
63
- y: e.y ?? 0,
64
- w: r,
65
- h: i,
66
- visible: e.visible ?? !0,
67
- opacity: e.opacity ?? 1,
68
- blend: e.blend ?? "normal",
69
- children: s
70
- };
71
- }
72
- //#endregion
73
- //#region src/editor/compose/inspectors/LoopPicker.jsx
74
- function Me({ layer: e, tree: t = fe, inline: n = !1 }) {
75
- let { updateLayer: r } = l(), i = e.loopGroup ?? "shape", a = t.find((e) => e.groups.includes(i)) ?? null, o = k(i), s = o.find((t) => t.id === e.presetId), c = [...new Set(o.map((e) => e.sub).filter(Boolean))], u = s?.sub ?? c[0], d = c.length ? o.filter((e) => e.sub === u) : o, f = (t, n = i) => {
76
- t && r(e.id, {
77
- loopGroup: n,
78
- presetId: t.id,
79
- presetLabel: t.label,
80
- loopId: t.loop,
81
- _framePreset: "custom",
82
- _formPreset: "custom",
83
- _lookPreset: "custom",
84
- ...j(t)
85
- });
86
- };
87
- return /* @__PURE__ */ U(V, { children: [
88
- t.length > 1 || !a ? /* @__PURE__ */ H(I, {
89
- label: "Type",
90
- inline: n,
91
- children: /* @__PURE__ */ U("div", {
92
- className: "flex flex-col gap-1 w-full",
93
- children: [a ? /* @__PURE__ */ H(ge, {
94
- options: t.map((e) => ({
95
- value: e.label,
96
- label: e.label
97
- })),
98
- value: a.label,
99
- onChange: (e) => {
100
- let n = t.find((t) => t.label === e);
101
- n && f(k(n.groups[0])[0], n.groups[0]);
102
- }
103
- }) : /* @__PURE__ */ H("span", {
104
- className: "kol-helper-12 text-meta px-1",
105
- children: me[i] ?? w(i).label
106
- }), a && a.groups.length > 1 && /* @__PURE__ */ H(ge, {
107
- options: a.groups.map((e) => ({
108
- value: e,
109
- label: a.labels?.[e] ?? w(e).label
110
- })),
111
- value: i,
112
- onChange: (e) => f(k(e)[0], e)
113
- })]
114
- })
115
- }) : null,
116
- c.length > 1 && /* @__PURE__ */ H(I, {
117
- inline: n,
118
- label: "Category",
119
- options: c.map((e) => ({
120
- value: e,
121
- label: e
122
- })),
123
- value: u,
124
- onChange: (e) => f(o.find((t) => t.sub === e))
125
- }),
126
- /* @__PURE__ */ H(I, {
127
- inline: n,
128
- label: "Preset",
129
- options: d.map((e) => ({
130
- value: e.id,
131
- label: e.label
132
- })),
133
- value: e.presetId,
134
- onChange: (e) => f(o.find((t) => t.id === e))
135
- })
136
- ] });
137
- }
138
- //#endregion
139
- //#region src/editor/params/motionPresets.js
140
- var Ne = (e) => m("generators")?.loopById(e) ?? null, Pe = {
141
- frame: [
142
- {
143
- id: "static",
144
- label: "Static",
145
- params: { flow: 0 }
146
- },
147
- {
148
- id: "drift",
149
- label: "Drift",
150
- params: {
151
- flow: 1,
152
- spin: 0
153
- }
154
- },
155
- {
156
- id: "spin",
157
- label: "Spin",
158
- params: {
159
- flow: 1,
160
- spin: 1
161
- }
162
- },
163
- {
164
- id: "rush",
165
- label: "Rush",
166
- params: {
167
- flow: 2,
168
- spin: 0
169
- }
170
- }
171
- ],
172
- form: [
173
- {
174
- id: "static",
175
- label: "Static",
176
- params: {
177
- sweep: 0,
178
- pulse: 0
179
- }
180
- },
181
- {
182
- id: "sweep",
183
- label: "Sweep",
184
- params: {
185
- sweep: .6,
186
- pulse: 0
187
- }
188
- },
189
- {
190
- id: "breathe",
191
- label: "Breathe",
192
- params: {
193
- sweep: 0,
194
- pulse: .5
195
- }
196
- },
197
- {
198
- id: "ripple",
199
- label: "Ripple",
200
- params: {
201
- sweep: .5,
202
- pulse: .4
203
- }
204
- }
205
- ]
206
- }, Fe = [
207
- {
208
- id: "static",
209
- label: "Static",
210
- params: { camFlow: 0 }
211
- },
212
- {
213
- id: "pan-right",
214
- label: "Pan Right",
215
- params: {
216
- camFlow: 1,
217
- panDir: "right"
218
- }
219
- },
220
- {
221
- id: "pan-left",
222
- label: "Pan Left",
223
- params: {
224
- camFlow: 1,
225
- panDir: "left"
226
- }
227
- },
228
- {
229
- id: "pan-up",
230
- label: "Pan Up",
231
- params: {
232
- camFlow: 1,
233
- panDir: "up"
234
- }
235
- },
236
- {
237
- id: "pan-down",
238
- label: "Pan Down",
239
- params: {
240
- camFlow: 1,
241
- panDir: "down"
242
- }
243
- },
244
- {
245
- id: "drift",
246
- label: "Drift",
247
- params: {
248
- camFlow: 1,
249
- panDir: "diag"
250
- }
251
- },
252
- {
253
- id: "glide",
254
- label: "Glide",
255
- params: {
256
- camFlow: 2,
257
- panDir: "anti"
258
- }
259
- }
260
- ], Ie = [
261
- {
262
- id: "static",
263
- label: "Static",
264
- params: {
265
- spin: 0,
266
- animAxis: "none",
267
- animCycles: 1,
268
- animWaves: 2,
269
- pulse: 0,
270
- fade: 0,
271
- swing: 0,
272
- colorMix: 0
273
- }
274
- },
275
- {
276
- id: "spin",
277
- label: "Spin",
278
- params: {
279
- spin: 1,
280
- animAxis: "none",
281
- animCycles: 1,
282
- animWaves: 2,
283
- pulse: 0,
284
- fade: 0,
285
- swing: 0,
286
- colorMix: 0
287
- }
288
- },
289
- {
290
- id: "breathe",
291
- label: "Breathe",
292
- params: {
293
- spin: 0,
294
- animAxis: "radial",
295
- animCycles: 1,
296
- animWaves: 2,
297
- pulse: .6,
298
- fade: 0,
299
- swing: 0,
300
- colorMix: 0
301
- }
302
- },
303
- {
304
- id: "pulse-wave",
305
- label: "Pulse Wave",
306
- params: {
307
- spin: 0,
308
- animAxis: "diag",
309
- animCycles: 1,
310
- animWaves: 3,
311
- pulse: .7,
312
- fade: 0,
313
- swing: 0,
314
- colorMix: 0
315
- }
316
- },
317
- {
318
- id: "fade-wave",
319
- label: "Fade Wave",
320
- params: {
321
- spin: 0,
322
- animAxis: "col",
323
- animCycles: 1,
324
- animWaves: 2,
325
- pulse: 0,
326
- fade: .8,
327
- swing: 0,
328
- colorMix: 0
329
- }
330
- },
331
- {
332
- id: "sway",
333
- label: "Sway",
334
- params: {
335
- spin: 0,
336
- animAxis: "diag",
337
- animCycles: 1,
338
- animWaves: 2,
339
- pulse: 0,
340
- fade: 0,
341
- swing: 60,
342
- colorMix: 0
343
- }
344
- },
345
- {
346
- id: "colour-sweep",
347
- label: "Color Sweep",
348
- params: {
349
- spin: 0,
350
- animAxis: "diag",
351
- animCycles: 1,
352
- animWaves: 2,
353
- pulse: 0,
354
- fade: 0,
355
- swing: 0,
356
- colorMix: 1
357
- }
358
- },
359
- {
360
- id: "ripple",
361
- label: "Ripple",
362
- params: {
363
- spin: 0,
364
- animAxis: "radial",
365
- animCycles: 1,
366
- animWaves: 4,
367
- pulse: .5,
368
- fade: .5,
369
- swing: 0,
370
- colorMix: 0
371
- }
372
- }
373
- ], Le = [
374
- {
375
- id: "static",
376
- label: "Static",
377
- params: {
378
- camFlow: 0,
379
- panDir: "right"
380
- }
381
- },
382
- {
383
- id: "drift",
384
- label: "Drift",
385
- params: {
386
- camFlow: 1,
387
- panDir: "right"
388
- }
389
- },
390
- {
391
- id: "reverse",
392
- label: "Reverse",
393
- params: {
394
- camFlow: 1,
395
- panDir: "left"
396
- }
397
- },
398
- {
399
- id: "glide",
400
- label: "Glide",
401
- params: {
402
- camFlow: 2,
403
- panDir: "right"
404
- }
405
- },
406
- {
407
- id: "rush",
408
- label: "Rush",
409
- params: {
410
- camFlow: 3,
411
- panDir: "right"
412
- }
413
- },
414
- {
415
- id: "bias",
416
- label: "Bias",
417
- params: {
418
- camFlow: 1,
419
- panDir: "right",
420
- stripeAngle: 30
421
- }
422
- },
423
- {
424
- id: "diagonal",
425
- label: "Diagonal",
426
- params: {
427
- camFlow: 1,
428
- panDir: "right",
429
- stripeAngle: 45
430
- }
431
- },
432
- {
433
- id: "counter",
434
- label: "Counter",
435
- params: {
436
- camFlow: 1,
437
- panDir: "right",
438
- stripeAngle: 135
439
- }
440
- }
441
- ], Re = [
442
- {
443
- id: "static",
444
- label: "Static",
445
- params: {
446
- camFlow: 0,
447
- waveFlow: 0,
448
- panDir: "right"
449
- }
450
- },
451
- {
452
- id: "drift",
453
- label: "Drift",
454
- params: {
455
- camFlow: 1,
456
- waveFlow: 0,
457
- panDir: "right"
458
- }
459
- },
460
- {
461
- id: "travel",
462
- label: "Travel",
463
- params: {
464
- camFlow: 0,
465
- waveFlow: 1,
466
- panDir: "right"
467
- }
468
- },
469
- {
470
- id: "both",
471
- label: "Both",
472
- params: {
473
- camFlow: 1,
474
- waveFlow: 1,
475
- panDir: "right"
476
- }
477
- },
478
- {
479
- id: "reverse",
480
- label: "Reverse",
481
- params: {
482
- camFlow: 1,
483
- waveFlow: 0,
484
- panDir: "left"
485
- }
486
- },
487
- {
488
- id: "glide",
489
- label: "Glide",
490
- params: {
491
- camFlow: 1,
492
- waveFlow: 2,
493
- panDir: "right"
494
- }
495
- },
496
- {
497
- id: "diagonal",
498
- label: "Diagonal",
499
- params: {
500
- camFlow: 1,
501
- waveFlow: 1,
502
- panDir: "right",
503
- stripeAngle: 45
504
- }
505
- }
506
- ], ze = [
507
- {
508
- id: "static",
509
- label: "Static",
510
- params: {
511
- fieldSway: 0,
512
- fieldStagger: 0,
513
- fieldCycles: 1
514
- }
515
- },
516
- {
517
- id: "sway",
518
- label: "Sway",
519
- params: {
520
- fieldSway: .5,
521
- fieldStagger: .3,
522
- fieldCycles: 1
523
- }
524
- },
525
- {
526
- id: "alternate",
527
- label: "Alternate",
528
- params: {
529
- fieldSway: .6,
530
- fieldStagger: 1,
531
- fieldCycles: 1
532
- }
533
- },
534
- {
535
- id: "ripple",
536
- label: "Ripple",
537
- params: {
538
- fieldSway: .45,
539
- fieldStagger: .5,
540
- fieldCycles: 1
541
- }
542
- }
543
- ], Be = [
544
- {
545
- id: "static",
546
- label: "Static",
547
- params: {
548
- animAxis: "none",
549
- animCycles: 1,
550
- animWaves: 2,
551
- pulse: 0,
552
- fade: 0
553
- }
554
- },
555
- {
556
- id: "pulse",
557
- label: "Pulse",
558
- params: {
559
- animAxis: "diag",
560
- animCycles: 1,
561
- animWaves: 3,
562
- pulse: .6,
563
- fade: 0
564
- }
565
- },
566
- {
567
- id: "fade",
568
- label: "Fade",
569
- params: {
570
- animAxis: "col",
571
- animCycles: 1,
572
- animWaves: 2,
573
- pulse: 0,
574
- fade: .7
575
- }
576
- },
577
- {
578
- id: "ripple",
579
- label: "Ripple",
580
- params: {
581
- animAxis: "radial",
582
- animCycles: 1,
583
- animWaves: 4,
584
- pulse: .4,
585
- fade: .4
586
- }
587
- }
588
- ], Ve = {
589
- frame: [
590
- {
591
- id: "static",
592
- label: "Static",
593
- params: { flow: 0 }
594
- },
595
- {
596
- id: "drift",
597
- label: "Drift",
598
- params: {
599
- flow: 1,
600
- panDir: "right"
601
- }
602
- },
603
- {
604
- id: "reverse",
605
- label: "Reverse",
606
- params: {
607
- flow: 1,
608
- panDir: "left"
609
- }
610
- },
611
- {
612
- id: "rise",
613
- label: "Rise",
614
- params: {
615
- flow: 1,
616
- panDir: "up"
617
- }
618
- },
619
- {
620
- id: "fall",
621
- label: "Fall",
622
- params: {
623
- flow: 1,
624
- panDir: "down"
625
- }
626
- },
627
- {
628
- id: "diagonal",
629
- label: "Diagonal",
630
- params: {
631
- flow: 1,
632
- panDir: "diag"
633
- }
634
- },
635
- {
636
- id: "glide",
637
- label: "Glide",
638
- params: {
639
- flow: 2,
640
- panDir: "anti"
641
- }
642
- },
643
- {
644
- id: "rush",
645
- label: "Rush",
646
- params: {
647
- flow: 3,
648
- panDir: "right"
649
- }
650
- }
651
- ],
652
- form: [
653
- {
654
- id: "static",
655
- label: "Static",
656
- params: {
657
- speed: 0,
658
- stagger: 0,
659
- pulse: 0,
660
- fade: 0,
661
- swing: 0
662
- }
663
- },
664
- {
665
- id: "scroll",
666
- label: "Scroll",
667
- params: {
668
- speed: .45,
669
- stagger: 0,
670
- pulse: 0,
671
- fade: 0,
672
- swing: 0
673
- }
674
- },
675
- {
676
- id: "morph",
677
- label: "Morph",
678
- params: {
679
- speed: .3,
680
- stagger: .5,
681
- pulse: 0,
682
- fade: 0,
683
- swing: 0
684
- }
685
- },
686
- {
687
- id: "sway",
688
- label: "Sway",
689
- params: {
690
- speed: .3,
691
- stagger: 0,
692
- pulse: 0,
693
- fade: 0,
694
- swing: 30
695
- }
696
- },
697
- {
698
- id: "breathe",
699
- label: "Breathe",
700
- params: {
701
- speed: .3,
702
- stagger: 0,
703
- pulse: .6,
704
- fade: 0,
705
- swing: 0
706
- }
707
- },
708
- {
709
- id: "shimmer",
710
- label: "Shimmer",
711
- params: {
712
- speed: .4,
713
- stagger: 0,
714
- pulse: 0,
715
- fade: .7,
716
- swing: 0
717
- }
718
- },
719
- {
720
- id: "rich",
721
- label: "Rich",
722
- params: {
723
- speed: .4,
724
- stagger: .35,
725
- pulse: .4,
726
- fade: .3,
727
- swing: 18
728
- }
729
- }
730
- ]
731
- }, He = {
732
- frame: [
733
- {
734
- id: "static",
735
- label: "Static",
736
- params: { spin: 0 }
737
- },
738
- {
739
- id: "orbit",
740
- label: "Orbit",
741
- params: { spin: 1 }
742
- },
743
- {
744
- id: "spin",
745
- label: "Spin",
746
- params: { spin: 2 }
747
- }
748
- ],
749
- form: [
750
- {
751
- id: "static",
752
- label: "Static",
753
- params: {
754
- morph: 0,
755
- ripple: 0,
756
- fade: 0
757
- }
758
- },
759
- {
760
- id: "breathe",
761
- label: "Breathe",
762
- params: {
763
- morph: .25,
764
- ripple: 0,
765
- fade: 0
766
- }
767
- },
768
- {
769
- id: "pulse",
770
- label: "Pulse",
771
- params: {
772
- morph: .5,
773
- ripple: 0,
774
- fade: 0
775
- }
776
- },
777
- {
778
- id: "ripple",
779
- label: "Ripple",
780
- params: {
781
- morph: 0,
782
- ripple: .6,
783
- fade: 0
784
- }
785
- },
786
- {
787
- id: "shimmer",
788
- label: "Shimmer",
789
- params: {
790
- morph: 0,
791
- ripple: 0,
792
- fade: .6
793
- }
794
- },
795
- {
796
- id: "rich",
797
- label: "Rich",
798
- params: {
799
- morph: .3,
800
- ripple: .4,
801
- fade: .3
802
- }
803
- }
804
- ]
805
- }, Ue = {
806
- frame: [
807
- {
808
- id: "static",
809
- label: "Static",
810
- params: {
811
- flowSpeed: 0,
812
- swirl: 0,
813
- drift: 0
814
- }
815
- },
816
- {
817
- id: "drift",
818
- label: "Drift",
819
- params: {
820
- flowSpeed: 1,
821
- swirl: 0,
822
- drift: 0
823
- }
824
- },
825
- {
826
- id: "wind",
827
- label: "Wind",
828
- params: {
829
- flowSpeed: 1,
830
- swirl: 0,
831
- drift: .6,
832
- driftDir: "right"
833
- }
834
- },
835
- {
836
- id: "vortex",
837
- label: "Vortex",
838
- params: {
839
- flowSpeed: 1,
840
- swirl: .5,
841
- drift: 0
842
- }
843
- },
844
- {
845
- id: "rush",
846
- label: "Rush",
847
- params: {
848
- flowSpeed: 2.4,
849
- swirl: 0,
850
- drift: 0
851
- }
852
- }
853
- ],
854
- form: [
855
- {
856
- id: "lines",
857
- label: "Lines",
858
- params: {
859
- dots: !1,
860
- pulse: 0,
861
- jitter: 0
862
- }
863
- },
864
- {
865
- id: "dots",
866
- label: "Dots",
867
- params: {
868
- dots: !0,
869
- pulse: 0,
870
- jitter: 0
871
- }
872
- },
873
- {
874
- id: "pulse",
875
- label: "Pulse",
876
- params: {
877
- dots: !1,
878
- pulse: .6,
879
- jitter: 0
880
- }
881
- },
882
- {
883
- id: "shimmer",
884
- label: "Shimmer",
885
- params: {
886
- dots: !0,
887
- pulse: .3,
888
- jitter: .5
889
- }
890
- }
891
- ]
892
- }, We = {
893
- frame: [
894
- {
895
- id: "static",
896
- label: "Static",
897
- params: {
898
- hueSpeed: 0,
899
- cspin: 0,
900
- czoom: 0
901
- }
902
- },
903
- {
904
- id: "cycle",
905
- label: "Cycle",
906
- params: {
907
- hueSpeed: 1,
908
- cspin: 0,
909
- czoom: 0
910
- }
911
- },
912
- {
913
- id: "turn",
914
- label: "Turn",
915
- params: {
916
- hueSpeed: .4,
917
- cspin: .6,
918
- czoom: 0
919
- }
920
- },
921
- {
922
- id: "breathe",
923
- label: "Breathe",
924
- params: {
925
- hueSpeed: .4,
926
- cspin: 0,
927
- czoom: .6
928
- }
929
- },
930
- {
931
- id: "rush",
932
- label: "Rush",
933
- params: {
934
- hueSpeed: 2,
935
- cspin: 1,
936
- czoom: 0
937
- }
938
- }
939
- ],
940
- form: [
941
- {
942
- id: "static",
943
- label: "Static",
944
- params: {
945
- ringSpeed: 0,
946
- shade: 0
947
- }
948
- },
949
- {
950
- id: "rings",
951
- label: "Rings",
952
- params: {
953
- ringSpeed: 1,
954
- shade: 0
955
- }
956
- },
957
- {
958
- id: "pulse",
959
- label: "Pulse",
960
- params: {
961
- ringSpeed: 1,
962
- shade: .4
963
- }
964
- },
965
- {
966
- id: "fast",
967
- label: "Fast",
968
- params: {
969
- ringSpeed: 2.4,
970
- shade: 0
971
- }
972
- }
973
- ]
974
- }, Ge = {
975
- frame: [
976
- {
977
- id: "static",
978
- label: "Static",
979
- params: {
980
- vpSpin: 0,
981
- vpZoom: 1
982
- }
983
- },
984
- {
985
- id: "spin",
986
- label: "Spin",
987
- params: {
988
- vpSpin: 1,
989
- vpZoom: 1
990
- }
991
- },
992
- {
993
- id: "spin2",
994
- label: "Spin ×2",
995
- params: {
996
- vpSpin: 2,
997
- vpZoom: 1
998
- }
999
- },
1000
- {
1001
- id: "push",
1002
- label: "Push in",
1003
- params: {
1004
- vpSpin: 0,
1005
- vpZoom: 1.3
1006
- }
1007
- }
1008
- ],
1009
- form: [
1010
- {
1011
- id: "static",
1012
- label: "Static",
1013
- params: {
1014
- vpPulse: 0,
1015
- vpWobble: 0
1016
- }
1017
- },
1018
- {
1019
- id: "pulse",
1020
- label: "Pulse",
1021
- params: {
1022
- vpPulse: .3,
1023
- vpWobble: 0
1024
- }
1025
- },
1026
- {
1027
- id: "wobble",
1028
- label: "Wobble",
1029
- params: {
1030
- vpPulse: 0,
1031
- vpWobble: 8
1032
- }
1033
- },
1034
- {
1035
- id: "breathe",
1036
- label: "Breathe",
1037
- params: {
1038
- vpPulse: .22,
1039
- vpWobble: 5
1040
- }
1041
- }
1042
- ]
1043
- };
1044
- function Ke(e, t = {}) {
1045
- switch (e) {
1046
- case "scanline": return Pe;
1047
- case "pattern-rules": {
1048
- let e = t.render ?? "tiles", n = e === "field" && t.field === "organic";
1049
- return {
1050
- frame: e === "tiles" ? Fe : n ? Re : Le,
1051
- form: e === "tiles" ? Ie : e === "weave" ? Be : ze
1052
- };
1053
- }
1054
- case "math-waveform": return Ve;
1055
- case "math-surface": return He;
1056
- case "math-field": return (t.kind ?? "scalar") === "complex" ? We : Ue;
1057
- default: return Ne(e)?.params?.some((e) => e.key === "vpSpin") ? Ge : null;
1058
- }
1059
- }
1060
- function qe(e) {
1061
- let t = /* @__PURE__ */ new Set();
1062
- for (let n of e ?? []) for (let e of Object.keys(n.params ?? {})) t.add(e);
1063
- return t;
1064
- }
1065
- //#endregion
1066
- //#region src/editor/params/lookPresets.js
1067
- var Je = {
1068
- Spectrum: {
1069
- palette: "spectrum",
1070
- spectral: !0,
1071
- hue: 0,
1072
- irid: 1.1
1073
- },
1074
- Iris: {
1075
- palette: "iris",
1076
- spectral: !1,
1077
- hue: .1,
1078
- irid: 1.05
1079
- },
1080
- Aqua: {
1081
- palette: "aqua",
1082
- spectral: !1,
1083
- hue: .5,
1084
- irid: 1
1085
- },
1086
- Magma: {
1087
- palette: "magma",
1088
- spectral: !1,
1089
- hue: .05,
1090
- irid: .95
1091
- },
1092
- Candy: {
1093
- palette: "candy",
1094
- spectral: !1,
1095
- hue: .8,
1096
- irid: 1.15
1097
- },
1098
- Noir: {
1099
- palette: "spectrum",
1100
- spectral: !0,
1101
- hue: 0,
1102
- irid: .6,
1103
- rim: 1
1104
- }
1105
- };
1106
- function Ye(e) {
1107
- return e === "softforms" || e === "softforms3d" ? Je : null;
1108
- }
1109
- //#endregion
1110
- //#region src/loops/gl/primitiveEasing.js
1111
- function Xe(e) {
1112
- let t = 7.5625, n = 2.75;
1113
- 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);
1114
- }
1115
- var Ze = {
1116
- linear: (e) => e,
1117
- in: (e) => e * e,
1118
- out: (e) => 1 - (1 - e) * (1 - e),
1119
- inout: (e) => e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2,
1120
- sine: (e) => -(Math.cos(Math.PI * e) - 1) / 2,
1121
- cubicIn: (e) => e * e * e,
1122
- cubicOut: (e) => 1 - (1 - e) ** 3,
1123
- cubicInOut: (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2,
1124
- expoOut: (e) => e >= 1 ? 1 : 1 - 2 ** (-10 * e),
1125
- expoInOut: (e) => e <= 0 ? 0 : e >= 1 ? 1 : e < .5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2,
1126
- backOut: (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2,
1127
- backInOut: (e) => {
1128
- let t = 1.70158 * 1.525;
1129
- return e < .5 ? (2 * e) ** 2 * (3.5949095 * 2 * e - t) / 2 : ((2 * e - 2) ** 2 * (3.5949095 * (e * 2 - 2) + t) + 2) / 2;
1130
- },
1131
- elasticOut: (e) => {
1132
- if (e <= 0) return 0;
1133
- if (e >= 1) return 1;
1134
- let t = 2 * Math.PI / 3;
1135
- return 2 ** (-10 * e) * Math.sin((e * 10 - .75) * t) + 1;
1136
- },
1137
- bounceOut: Xe
1138
- }, Qe = {
1139
- linear: "Linear",
1140
- in: "Ease in",
1141
- out: "Ease out",
1142
- inout: "Ease in-out",
1143
- sine: "Sine",
1144
- cubicIn: "Cubic in",
1145
- cubicOut: "Cubic out",
1146
- cubicInOut: "Cubic in-out",
1147
- expoOut: "Expo out",
1148
- expoInOut: "Expo in-out",
1149
- backOut: "Back out",
1150
- backInOut: "Back in-out",
1151
- elasticOut: "Elastic out",
1152
- bounceOut: "Bounce out"
1153
- }, $e = Object.keys(Ze).map((e) => ({
1154
- value: e,
1155
- label: Qe[e] || e
1156
- })), et = (e, t, n) => [
1157
- s(e[0], t[0], n),
1158
- s(e[1], t[1], n),
1159
- s(e[2], t[2], n)
1160
- ], tt = (e) => ({
1161
- rot: e.rot || [
1162
- 0,
1163
- 0,
1164
- 0
1165
- ],
1166
- pos: e.pos || [
1167
- 0,
1168
- 0,
1169
- 0
1170
- ],
1171
- scale: e.scale ?? 1
1172
- });
1173
- function nt(e, t) {
1174
- if (!e || !e.length) return {};
1175
- if (e.length === 1) return tt(e[0]);
1176
- let n = 0;
1177
- for (; n < e.length - 1 && t > e[n + 1].t;) n++;
1178
- let r = e[n], i = e[n + 1] || r, a = i.t - r.t || 1, o = Math.max(0, Math.min(1, (t - r.t) / a));
1179
- return o = (Ze[i.ease] || Ze.inout)(o), {
1180
- rot: et(r.rot || [
1181
- 0,
1182
- 0,
1183
- 0
1184
- ], i.rot || [
1185
- 0,
1186
- 0,
1187
- 0
1188
- ], o),
1189
- pos: et(r.pos || [
1190
- 0,
1191
- 0,
1192
- 0
1193
- ], i.pos || [
1194
- 0,
1195
- 0,
1196
- 0
1197
- ], o),
1198
- scale: s(r.scale ?? 1, i.scale ?? 1, o)
1199
- };
1200
- }
1201
- var rt = [{
1202
- t: 0,
1203
- rot: [
1204
- 0,
1205
- 0,
1206
- 0
1207
- ],
1208
- pos: [
1209
- 0,
1210
- 0,
1211
- 0
1212
- ],
1213
- scale: 1,
1214
- ease: "inout"
1215
- }, {
1216
- t: 1,
1217
- rot: [
1218
- 0,
1219
- Math.PI * 2,
1220
- 0
1221
- ],
1222
- pos: [
1223
- 0,
1224
- 0,
1225
- 0
1226
- ],
1227
- scale: 1,
1228
- ease: "inout"
1229
- }];
1230
- //#endregion
1231
- //#region src/loops/gl/phase.js
1232
- function it(e, t) {
1233
- let n = Number(e), r = Number(t);
1234
- return !n || n <= 0 || !r || r <= 0 ? 1 : Math.max(1, Math.round(r / n));
1235
- }
1236
- function at(e, t) {
1237
- return e * t % 1;
1238
- }
1239
- //#endregion
1240
- //#region src/editor/compose/inspectors/KeyframeEditor.jsx
1241
- function ot({ layer: e, patch: t, defaultDuration: r = 8 }) {
1242
- let i = () => it(e.duration ?? r, n.getLoopSeconds());
1243
- return /* @__PURE__ */ H(ve, {
1244
- keyframes: e.keyframes,
1245
- onChange: (e) => t({ keyframes: e }),
1246
- t: () => n.getT() * i() % 1,
1247
- onPause: () => n.pause(),
1248
- onSeek: (e) => n.seek(e / i()),
1249
- easeOptions: $e,
1250
- defaultKeyframes: rt
1251
- });
1252
- }
1253
- //#endregion
1254
- //#region src/editor/compose/inspectors/CameraPoseSlots.jsx
1255
- function st({ layer: e, patch: t, camParams: n, isEngine: r, showHeader: i = !1 }) {
1256
- let a = Array.isArray(e._camSlots) ? e._camSlots : [], o = [
1257
- a[0] ?? null,
1258
- a[1] ?? null,
1259
- a[2] ?? null
1260
- ], s = (r) => {
1261
- let i = {};
1262
- for (let t of n) i[t.key] = e[t.key] ?? t.default;
1263
- let a = [...o];
1264
- a[r] = i, t({ _camSlots: a });
1265
- }, c = (e) => {
1266
- o[e] && t({ ...o[e] });
1267
- };
1268
- return /* @__PURE__ */ U(V, { children: [i && /* @__PURE__ */ H("span", {
1269
- className: "kol-helper-10 text-meta",
1270
- children: "Camera"
1271
- }), /* @__PURE__ */ U("div", {
1272
- className: "flex items-center gap-1",
1273
- children: [n.length > 0 && o.map((e, t) => /* @__PURE__ */ H(B, {
1274
- label: e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1275
- children: /* @__PURE__ */ H(L, {
1276
- "aria-label": e ? "Recall pose (shift-click = overwrite)" : "Save pose",
1277
- tone: e ? "inverted" : "ghost",
1278
- size: "sm",
1279
- onClick: (n) => n.shiftKey || !e ? s(t) : c(t),
1280
- children: t + 1
1281
- })
1282
- }, t)), /* @__PURE__ */ H(L, {
1283
- tone: "primary",
1284
- size: "sm",
1285
- className: "ml-auto",
1286
- onClick: () => {
1287
- let i = {};
1288
- for (let e of n) i[e.key] = e.default;
1289
- t(i), r && import("./host-B4SRaN9h.js").then((t) => t.hostAction?.(e.id, "resetCamera")).catch(() => {});
1290
- },
1291
- children: "Reset"
1292
- })]
1293
- })] });
1294
- }
1295
- //#endregion
1296
- //#region src/editor/compose/inspectors/RulesEditor.jsx
1297
- function ct({ layer: e, patch: t, seed: n }) {
1298
- let r = e.rules ?? [], i = (e, n) => t({
1299
- rules: e,
1300
- ...n
1301
- }), a = () => i([...r, ne()]), o = (e, t) => i(r.map((n, r) => r === e ? t : n)), s = (e) => i(r.filter((t, n) => n !== e)), c = (e) => {
1302
- let t = n.take(), a = u(t >>> 0);
1303
- i(r.map((t, n) => n === e ? {
1304
- ...E(a),
1305
- id: t.id
1306
- } : t), { _rollSeed: t });
1307
- };
1308
- return /* @__PURE__ */ H(z, {
1309
- label: `Rules · ${r.length}`,
1310
- children: /* @__PURE__ */ U("div", {
1311
- className: "flex flex-col gap-2",
1312
- children: [r.map((e, t) => /* @__PURE__ */ H(he, {
1313
- rule: e,
1314
- onChange: (e) => o(t, e),
1315
- onRemove: () => s(t),
1316
- onReroll: () => c(t)
1317
- }, e.id ?? t)), /* @__PURE__ */ U("div", {
1318
- className: "grid grid-cols-2 gap-2",
1319
- children: [/* @__PURE__ */ H(L, {
1320
- tone: "primary",
1321
- size: "sm",
1322
- iconLeft: "plus",
1323
- onClick: a,
1324
- children: "Add rule"
1325
- }), /* @__PURE__ */ H(L, {
1326
- tone: "primary",
1327
- size: "sm",
1328
- onClick: () => {
1329
- let e = n.take(), t = u(e >>> 0), r = 1 + Math.floor(t() * 3);
1330
- i(Array.from({ length: r }, () => E(t)), { _rollSeed: e });
1331
- },
1332
- children: "Randomize"
1333
- })]
1334
- })]
1335
- })
1336
- });
1337
- }
1338
- //#endregion
1339
- //#region src/editor/compose/inspectors/ProfileEditor.jsx
1340
- var G = 240, K = 120, lt = 12, q = (e, t, n) => Math.max(t, Math.min(n, e)), J = (e) => e * G, Y = (e) => K / 2 - e * (K / 2 - lt);
1341
- function ut({ value: e, onChange: t }) {
1342
- let n = Array.isArray(e) && e.length > 1 ? e : C, r = Ee(null), i = Ee(null), a = (e) => {
1343
- let t = r.current, n = t.createSVGPoint();
1344
- n.x = e.clientX, n.y = e.clientY;
1345
- let i = n.matrixTransform(t.getScreenCTM().inverse());
1346
- return {
1347
- nx: i.x / G,
1348
- ny: (K / 2 - i.y) / (K / 2 - lt)
1349
- };
1350
- }, o = (e) => {
1351
- let r = i.current;
1352
- if (!r) return;
1353
- let { nx: o, ny: s } = a(e), c = q(s, -1, 1), l = n.map((e) => ({ ...e })), u = l[r.i];
1354
- if (r.type === "anchor") {
1355
- let e = r.i === 0, t = r.i === l.length - 1;
1356
- !e && !t && (u.x = q(o, l[r.i - 1].x + .02, l[r.i + 1].x - .02)), u.y = c, e && (l[l.length - 1].y = c), t && (l[0].y = c);
1357
- } else r.type === "hr" ? (u.hrx = o - u.x, u.hry = c - u.y) : (u.hlx = o - u.x, u.hly = c - u.y);
1358
- t(l);
1359
- }, s = (e, t) => (n) => {
1360
- n.stopPropagation(), i.current = {
1361
- type: e,
1362
- i: t
1363
- };
1364
- try {
1365
- n.target.setPointerCapture(n.pointerId);
1366
- } catch {}
1367
- }, c = (e) => {
1368
- i.current = null;
1369
- try {
1370
- e.target.releasePointerCapture(e.pointerId);
1371
- } catch {}
1372
- }, l = (e) => {
1373
- let { nx: r, ny: i } = a(e), o = q(r, .04, .96), s = n.findIndex((e) => e.x > o), c = s < 0 ? n.length - 1 : s, l = n.map((e) => ({ ...e }));
1374
- l.splice(c, 0, {
1375
- x: o,
1376
- y: q(i, -1, 1),
1377
- hlx: -.08,
1378
- hly: 0,
1379
- hrx: .08,
1380
- hry: 0
1381
- }), t(l);
1382
- }, u = (e) => (r) => {
1383
- r.stopPropagation(), !(e === 0 || e === n.length - 1 || n.length <= 3) && t(n.filter((t, n) => n !== e));
1384
- }, d = n.map((e, t) => {
1385
- if (t === 0) return `M ${J(e.x)} ${Y(e.y)}`;
1386
- let r = n[t - 1];
1387
- return `C ${J(r.x + r.hrx)} ${Y(r.y + r.hry)}, ${J(e.x + e.hlx)} ${Y(e.y + e.hly)}, ${J(e.x)} ${Y(e.y)}`;
1388
- }).join(" ");
1389
- return /* @__PURE__ */ U("svg", {
1390
- ref: r,
1391
- width: "100%",
1392
- height: K,
1393
- viewBox: `0 0 ${G} ${K}`,
1394
- className: "rounded touch-none select-none",
1395
- style: { background: "var(--kol-surface-primary)" },
1396
- onPointerMove: o,
1397
- onPointerUp: c,
1398
- onPointerLeave: c,
1399
- onDoubleClick: l,
1400
- children: [
1401
- /* @__PURE__ */ H("line", {
1402
- x1: "0",
1403
- y1: K / 2,
1404
- x2: G,
1405
- y2: K / 2,
1406
- stroke: "var(--kol-fg-16)",
1407
- strokeWidth: "1"
1408
- }),
1409
- /* @__PURE__ */ H("path", {
1410
- d,
1411
- fill: "none",
1412
- stroke: "var(--kol-fg-80)",
1413
- strokeWidth: "1.5",
1414
- vectorEffect: "non-scaling-stroke"
1415
- }),
1416
- n.map((e, t) => /* @__PURE__ */ U("g", { children: [
1417
- /* @__PURE__ */ H("line", {
1418
- x1: J(e.x),
1419
- y1: Y(e.y),
1420
- x2: J(e.x + e.hlx),
1421
- y2: Y(e.y + e.hly),
1422
- stroke: "var(--kol-fg-32)",
1423
- vectorEffect: "non-scaling-stroke"
1424
- }),
1425
- /* @__PURE__ */ H("line", {
1426
- x1: J(e.x),
1427
- y1: Y(e.y),
1428
- x2: J(e.x + e.hrx),
1429
- y2: Y(e.y + e.hry),
1430
- stroke: "var(--kol-fg-32)",
1431
- vectorEffect: "non-scaling-stroke"
1432
- }),
1433
- /* @__PURE__ */ H("circle", {
1434
- cx: J(e.x + e.hlx),
1435
- cy: Y(e.y + e.hly),
1436
- r: "3.5",
1437
- fill: "var(--kol-fg-48)",
1438
- className: "cursor-grab",
1439
- onPointerDown: s("hl", t)
1440
- }),
1441
- /* @__PURE__ */ H("circle", {
1442
- cx: J(e.x + e.hrx),
1443
- cy: Y(e.y + e.hry),
1444
- r: "3.5",
1445
- fill: "var(--kol-fg-48)",
1446
- className: "cursor-grab",
1447
- onPointerDown: s("hr", t)
1448
- }),
1449
- /* @__PURE__ */ H("circle", {
1450
- cx: J(e.x),
1451
- cy: Y(e.y),
1452
- r: "5",
1453
- fill: "var(--kol-surface-on-primary)",
1454
- className: "cursor-grab",
1455
- onPointerDown: s("anchor", t),
1456
- onDoubleClick: u(t)
1457
- })
1458
- ] }, t))
1459
- ]
1460
- });
1461
- }
1462
- function dt({ layer: e, patch: t }) {
1463
- return e.render !== "field" || e.field !== "organic" || e.waveProfile !== "custom" ? null : /* @__PURE__ */ H(z, {
1464
- label: "Profile curve",
1465
- children: /* @__PURE__ */ H(ut, {
1466
- value: Array.isArray(e.waveCurve) && e.waveCurve.length > 1 ? e.waveCurve : C,
1467
- onChange: (e) => t({ waveCurve: e })
1468
- })
1469
- });
1470
- }
1471
- //#endregion
1472
- //#region src/editor/compose/inspectors/CurveEditor.jsx
1473
- function ft({ layer: e, patch: t }) {
1474
- let n = e.clip === "custom", r = n ? null : ie(e.clip), i = n ? null : {
1475
- label: (v.find((t) => t.id === e.clip) || v[0]).label,
1476
- copies: r.copies,
1477
- spiral: r.spiral,
1478
- layerCopies: e.copies,
1479
- layerSpiral: e.spiral
1480
- };
1481
- return /* @__PURE__ */ H(_e, {
1482
- value: n ? e.custom ?? b("polar") : r.def,
1483
- stock: i,
1484
- onChange: (e, { extras: n }) => t({
1485
- clip: "custom",
1486
- ...n,
1487
- custom: e
1488
- }),
1489
- validate: de,
1490
- kinds: y,
1491
- defaultFor: b
1492
- });
1493
- }
1494
- //#endregion
1495
- //#region src/editor/compose/inspectors/ParatypeTools.jsx
1496
- function pt({ layer: e, patch: t, tab: n }) {
1497
- return e?.loopId === "paratype-glyph" ? n === "generate" ? /* @__PURE__ */ H(mt, { layer: e }) : n === "style" ? /* @__PURE__ */ H(ht, {
1498
- layer: e,
1499
- patch: t
1500
- }) : null : null;
1501
- }
1502
- function mt({ layer: e }) {
1503
- let { flattenParatype: t } = l();
1504
- return t ? /* @__PURE__ */ H(B, {
1505
- label: "Flatten the glyph(s) to vector shape layers (one-way)",
1506
- children: /* @__PURE__ */ H(L, {
1507
- "aria-label": "Flatten the glyph(s) to vector shape layers (one-way)",
1508
- tone: "primary",
1509
- size: "sm",
1510
- className: "w-full",
1511
- onClick: () => t(e.id),
1512
- children: "Flatten to vector"
1513
- })
1514
- }) : null;
1515
- }
1516
- function ht({ layer: e, patch: t }) {
1517
- let n = i(ce(e.loopId)?.params ?? [], e).filter((e) => e.type === "range");
1518
- if (n.length < 2) return null;
1519
- let r = (e, t) => n.some((t) => t.key === e) && e !== t ? e : n.find((e) => e.key !== t)?.key, a = r(e._xyX ?? "stemWidth", null), o = r(e._xyY ?? "oWidth", a), s = n.find((e) => e.key === a), c = n.find((e) => e.key === o);
1520
- if (!s || !c) return null;
1521
- let l = (t, n) => typeof e[t] == "number" ? e[t] : n.default, u = (e, t) => {
1522
- let n = t.step ?? 1;
1523
- return n < 1 ? Number((Math.round(e / n) * n).toFixed(4)) : Math.round(e);
1524
- }, d = n.map((e) => ({
1525
- value: e.key,
1526
- label: e.label
1527
- }));
1528
- return /* @__PURE__ */ U(V, { children: [
1529
- /* @__PURE__ */ H("span", {
1530
- className: "kol-helper-10 text-meta",
1531
- children: "Explore"
1532
- }),
1533
- /* @__PURE__ */ U("div", {
1534
- className: "grid grid-cols-2 gap-2",
1535
- children: [/* @__PURE__ */ H(z, {
1536
- label: "X axis",
1537
- children: /* @__PURE__ */ H(R, {
1538
- variant: "subtle",
1539
- size: "sm",
1540
- className: "w-full",
1541
- options: d,
1542
- value: a,
1543
- onChange: (e) => t({ _xyX: e })
1544
- })
1545
- }), /* @__PURE__ */ H(z, {
1546
- label: "Y axis",
1547
- children: /* @__PURE__ */ H(R, {
1548
- variant: "subtle",
1549
- size: "sm",
1550
- className: "w-full",
1551
- options: d,
1552
- value: o,
1553
- onChange: (e) => t({ _xyY: e })
1554
- })
1555
- })]
1556
- }),
1557
- /* @__PURE__ */ H(we, {
1558
- xValue: l(a, s),
1559
- yValue: l(o, c),
1560
- xMin: s.min ?? 0,
1561
- xMax: s.max ?? 1,
1562
- yMin: c.min ?? 0,
1563
- yMax: c.max ?? 1,
1564
- xLabel: s.label,
1565
- yLabel: c.label,
1566
- onChange: (e, n) => t({
1567
- [a]: u(e, s),
1568
- [o]: u(n, c)
1569
- })
1570
- })
1571
- ] });
1572
- }
1573
- //#endregion
1574
- //#region src/editor/compose/inspectors/SoftformsLayers.jsx
1575
- var X = 5, gt = [
1576
- {
1577
- value: "teardrop",
1578
- label: "Teardrop"
1579
- },
1580
- {
1581
- value: "pill",
1582
- label: "Pill"
1583
- },
1584
- {
1585
- value: "dome",
1586
- label: "Dome"
1587
- },
1588
- {
1589
- value: "orb",
1590
- label: "Orb"
1591
- },
1592
- {
1593
- value: "super",
1594
- label: "Lozenge"
1595
- }
1596
- ], _t = [
1597
- {
1598
- value: "sphere",
1599
- label: "Sphere"
1600
- },
1601
- {
1602
- value: "capsule",
1603
- label: "Capsule"
1604
- },
1605
- {
1606
- value: "teardrop",
1607
- label: "Teardrop"
1608
- },
1609
- {
1610
- value: "lozenge",
1611
- label: "Lozenge"
1612
- }
1613
- ], vt = [
1614
- {
1615
- k: "x",
1616
- label: "Position X",
1617
- min: -1,
1618
- max: 1,
1619
- step: .01,
1620
- def: 0
1621
- },
1622
- {
1623
- k: "y",
1624
- label: "Position Y",
1625
- min: -1,
1626
- max: 1,
1627
- step: .01,
1628
- def: 0
1629
- },
1630
- {
1631
- k: "sx",
1632
- label: "Scale X",
1633
- min: .12,
1634
- max: 1.6,
1635
- step: .01,
1636
- def: .6
1637
- },
1638
- {
1639
- k: "sy",
1640
- label: "Scale Y",
1641
- min: .12,
1642
- max: 1.6,
1643
- step: .01,
1644
- def: .6,
1645
- fallback: "sx"
1646
- },
1647
- {
1648
- k: "rot",
1649
- label: "Rotation",
1650
- min: 0,
1651
- max: 360,
1652
- step: 1,
1653
- def: 0
1654
- },
1655
- {
1656
- k: "hue",
1657
- label: "Hue",
1658
- min: 0,
1659
- max: 1,
1660
- step: .01,
1661
- def: 0
1662
- }
1663
- ], yt = [
1664
- {
1665
- k: "x",
1666
- label: "Position X",
1667
- min: -1.2,
1668
- max: 1.2,
1669
- step: .01,
1670
- def: 0
1671
- },
1672
- {
1673
- k: "y",
1674
- label: "Position Y",
1675
- min: -1.2,
1676
- max: 1.2,
1677
- step: .01,
1678
- def: 0
1679
- },
1680
- {
1681
- k: "z",
1682
- label: "Position Z",
1683
- min: -1.2,
1684
- max: 1.2,
1685
- step: .01,
1686
- def: 0
1687
- },
1688
- {
1689
- k: "sx",
1690
- label: "Scale X",
1691
- min: .12,
1692
- max: 1.6,
1693
- step: .01,
1694
- def: .7
1695
- },
1696
- {
1697
- k: "sy",
1698
- label: "Scale Y",
1699
- min: .12,
1700
- max: 1.6,
1701
- step: .01,
1702
- def: .7,
1703
- fallback: "sx"
1704
- },
1705
- {
1706
- k: "sz",
1707
- label: "Scale Z",
1708
- min: .12,
1709
- max: 1.6,
1710
- step: .01,
1711
- def: .7,
1712
- fallback: "sx"
1713
- },
1714
- {
1715
- k: "rot",
1716
- label: "Rotation",
1717
- min: 0,
1718
- max: 360,
1719
- step: 1,
1720
- def: 0
1721
- },
1722
- {
1723
- k: "hue",
1724
- label: "Hue",
1725
- min: 0,
1726
- max: 1,
1727
- step: .01,
1728
- def: 0
1729
- }
1730
- ], bt = Math.PI * 2, xt = (e, t, n) => Math.min(n, Math.max(t, e)), Z = (e) => Math.round(e * 100) / 100, Q = (e, t, n) => t + e() * (n - t), St = (e, t) => {
1731
- let n = t * Math.sqrt(e()), r = e() * bt;
1732
- return [n * Math.cos(r), n * Math.sin(r)];
1733
- }, Ct = (e, t) => {
1734
- let n = t * Math.cbrt(e()), r = e() * bt, i = Math.acos(2 * e() - 1);
1735
- return [
1736
- n * Math.sin(i) * Math.cos(r),
1737
- n * Math.sin(i) * Math.sin(r),
1738
- n * Math.cos(i) * .8
1739
- ];
1740
- }, wt = (e) => {
1741
- let t = e.length || 1, n = e.reduce((e, n) => ({
1742
- x: e.x + n.x / t,
1743
- y: e.y + n.y / t
1744
- }), {
1745
- x: 0,
1746
- y: 0
1747
- });
1748
- return e.map((e) => ({
1749
- ...e,
1750
- x: Z(e.x - n.x),
1751
- y: Z(e.y - n.y)
1752
- }));
1753
- }, Tt = (e) => {
1754
- let t = e.length || 1, n = e.reduce((e, n) => ({
1755
- x: e.x + n.x / t,
1756
- y: e.y + n.y / t,
1757
- z: e.z + n.z / t
1758
- }), {
1759
- x: 0,
1760
- y: 0,
1761
- z: 0
1762
- });
1763
- return e.map((e) => ({
1764
- ...e,
1765
- x: Z(e.x - n.x),
1766
- y: Z(e.y - n.y),
1767
- z: Z(e.z - n.z)
1768
- }));
1769
- }, Et = (e, t) => e.find((e) => e.value === t)?.label ?? t;
1770
- function Dt({ layer: e }) {
1771
- let { updateLayer: t } = l(), n = le(e.id, { history: "coalesce" }), r = e.loopId === "softforms3d", i = r && !!e.metaball, a = r ? _t : gt, o = r ? yt : vt, s = i ? 2 : 1, c = Array.isArray(e.forms) ? e.forms : [], [d, f] = De(-1), p = d >= 0 && d < c.length ? c[d] : null, m = (t) => {
1772
- f(t), window.dispatchEvent(new CustomEvent("kol:softform-select", { detail: {
1773
- id: e.id,
1774
- index: t,
1775
- from: "panel"
1776
- } }));
1777
- };
1778
- Te(() => {
1779
- let t = (t) => {
1780
- t.detail?.id === e.id && t.detail.from === "canvas" && f(t.detail.index);
1781
- };
1782
- return window.addEventListener("kol:softform-select", t), () => window.removeEventListener("kol:softform-select", t);
1783
- }, [e.id]);
1784
- let h = (n) => t(e.id, { forms: n }), ee = (e, t) => n.patch({ forms: c.map((n, r) => r === d ? {
1785
- ...n,
1786
- [e]: t
1787
- } : n) }), _ = () => {
1788
- if (c.length >= X) return;
1789
- let e = r ? {
1790
- t: "sphere",
1791
- x: 0,
1792
- y: 0,
1793
- z: 0,
1794
- sx: .7,
1795
- sy: .7,
1796
- sz: .7,
1797
- rot: 0,
1798
- hue: Z(Math.random())
1799
- } : {
1800
- t: "dome",
1801
- x: 0,
1802
- y: 0,
1803
- sx: .6,
1804
- sy: .6,
1805
- rot: 0,
1806
- hue: Z(Math.random())
1807
- };
1808
- h([...c, e]), m(c.length);
1809
- }, te = (e) => {
1810
- if (c.length >= X) return;
1811
- let t = {
1812
- ...c[e],
1813
- x: xt((c[e].x ?? 0) + .12, -1.2, 1.2),
1814
- y: xt((c[e].y ?? 0) - .1, -1.2, 1.2)
1815
- };
1816
- h([
1817
- ...c.slice(0, e + 1),
1818
- t,
1819
- ...c.slice(e + 1)
1820
- ]), m(e + 1);
1821
- }, ne = (e) => {
1822
- c.length <= s || (h(c.filter((t, n) => n !== e)), m(-1));
1823
- }, re = (e, t) => {
1824
- if (t < 0 || t >= c.length) return;
1825
- let n = [...c];
1826
- [n[e], n[t]] = [n[t], n[e]], h(n), m(t);
1827
- };
1828
- return /* @__PURE__ */ U("div", {
1829
- className: "flex flex-col gap-2",
1830
- children: [
1831
- /* @__PURE__ */ H("span", {
1832
- className: "kol-helper-10 text-meta",
1833
- children: "Forms"
1834
- }),
1835
- /* @__PURE__ */ H("div", {
1836
- className: "flex flex-col gap-1",
1837
- children: c.map((e, t) => {
1838
- let n = c.length - 1 - t, r = c[n];
1839
- return /* @__PURE__ */ U("div", {
1840
- onClick: () => m(n),
1841
- className: `flex items-center gap-2 pl-2 pr-1 py-1 rounded cursor-pointer kol-helper-12 ${n === d ? "bg-[color-mix(in_srgb,var(--kol-accent-primary)_26%,transparent)] text-emphasis" : "text-body hover:bg-oq-04 hover:text-emphasis"}`,
1842
- children: [
1843
- /* @__PURE__ */ H("span", {
1844
- className: "kol-helper-10 text-meta shrink-0",
1845
- children: n + 1
1846
- }),
1847
- /* @__PURE__ */ H("span", {
1848
- className: "truncate flex-1 min-w-0",
1849
- children: Et(a, r.t)
1850
- }),
1851
- /* @__PURE__ */ H(B, {
1852
- label: "Move form up",
1853
- children: /* @__PURE__ */ H(L, {
1854
- tone: "ghost",
1855
- size: "sm",
1856
- quiet: !0,
1857
- iconOnly: "chevron-down",
1858
- iconSize: 12,
1859
- "aria-label": "Move form up",
1860
- disabled: n >= c.length - 1,
1861
- onClick: (e) => {
1862
- e.stopPropagation(), re(n, n + 1);
1863
- },
1864
- style: { transform: "rotate(180deg)" }
1865
- })
1866
- }),
1867
- /* @__PURE__ */ H(B, {
1868
- label: "Move form down",
1869
- children: /* @__PURE__ */ H(L, {
1870
- tone: "ghost",
1871
- size: "sm",
1872
- quiet: !0,
1873
- iconOnly: "chevron-down",
1874
- iconSize: 12,
1875
- "aria-label": "Move form down",
1876
- disabled: n <= 0,
1877
- onClick: (e) => {
1878
- e.stopPropagation(), re(n, n - 1);
1879
- }
1880
- })
1881
- }),
1882
- /* @__PURE__ */ H(B, {
1883
- label: "Duplicate form",
1884
- children: /* @__PURE__ */ H(L, {
1885
- tone: "ghost",
1886
- size: "sm",
1887
- quiet: !0,
1888
- iconOnly: "copy",
1889
- iconSize: 12,
1890
- "aria-label": "Duplicate form",
1891
- disabled: c.length >= X,
1892
- onClick: (e) => {
1893
- e.stopPropagation(), te(n);
1894
- }
1895
- })
1896
- }),
1897
- /* @__PURE__ */ H(B, {
1898
- label: "Delete form",
1899
- children: /* @__PURE__ */ H(L, {
1900
- tone: "ghost",
1901
- size: "sm",
1902
- quiet: !0,
1903
- iconOnly: "trash",
1904
- iconSize: 12,
1905
- "aria-label": "Delete form",
1906
- disabled: c.length <= s,
1907
- onClick: (e) => {
1908
- e.stopPropagation(), ne(n);
1909
- }
1910
- })
1911
- })
1912
- ]
1913
- }, n);
1914
- })
1915
- }),
1916
- /* @__PURE__ */ H(L, {
1917
- tone: "primary",
1918
- size: "sm",
1919
- className: "w-full",
1920
- iconLeft: "plus",
1921
- iconSize: 12,
1922
- disabled: c.length >= X,
1923
- onClick: _,
1924
- children: "Add form"
1925
- }),
1926
- !r && /* @__PURE__ */ H(B, {
1927
- label: "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
1928
- children: /* @__PURE__ */ H(L, {
1929
- "aria-label": "Edit forms on the canvas (click to select, drag to move, corners to scale, knob to rotate)",
1930
- tone: "primary",
1931
- size: "sm",
1932
- className: "w-full",
1933
- onClick: () => window.dispatchEvent(new CustomEvent("kol:softform-edit", { detail: {
1934
- id: e.id,
1935
- index: Math.max(0, d)
1936
- } })),
1937
- children: "Edit forms on canvas"
1938
- })
1939
- }),
1940
- p && /* @__PURE__ */ U("div", {
1941
- className: "flex flex-col gap-2 pt-1",
1942
- children: [
1943
- /* @__PURE__ */ H("span", {
1944
- className: "kol-helper-10 text-meta",
1945
- children: "Selected form"
1946
- }),
1947
- /* @__PURE__ */ H(z, {
1948
- label: "Type",
1949
- children: /* @__PURE__ */ H(R, {
1950
- variant: "subtle",
1951
- size: "sm",
1952
- className: "w-full",
1953
- options: a,
1954
- value: p.t,
1955
- onChange: (e) => h(c.map((t, n) => n === d ? {
1956
- ...t,
1957
- t: e
1958
- } : t))
1959
- })
1960
- }),
1961
- o.map((e) => {
1962
- let t = p[e.k] ?? (e.fallback ? p[e.fallback] : void 0), n = typeof t == "number" ? t : e.def;
1963
- return /* @__PURE__ */ H(z, {
1964
- label: e.label,
1965
- children: /* @__PURE__ */ H(Se, {
1966
- min: e.min,
1967
- max: e.max,
1968
- step: e.step,
1969
- value: n,
1970
- onChange: (t) => ee(e.k, t)
1971
- })
1972
- }, e.k);
1973
- })
1974
- ]
1975
- }),
1976
- /* @__PURE__ */ H("span", {
1977
- className: "kol-helper-10 text-meta pt-1",
1978
- children: "Randomise forms"
1979
- }),
1980
- /* @__PURE__ */ U("div", {
1981
- className: "grid grid-cols-2 gap-2",
1982
- children: [
1983
- /* @__PURE__ */ H(L, {
1984
- tone: "primary",
1985
- size: "sm",
1986
- onClick: () => {
1987
- let e = u(g());
1988
- h(c.map((t) => ({
1989
- ...t,
1990
- hue: Z(e())
1991
- })));
1992
- },
1993
- children: "Color"
1994
- }),
1995
- /* @__PURE__ */ H(L, {
1996
- tone: "primary",
1997
- size: "sm",
1998
- onClick: () => {
1999
- let e = u(g());
2000
- h(c.map((t) => r ? {
2001
- ...t,
2002
- x: Z(Q(e, -.7, .7)),
2003
- y: Z(Q(e, -.7, .7)),
2004
- z: Z(Q(e, -.5, .5)),
2005
- rot: Math.round(Q(e, 0, 360))
2006
- } : {
2007
- ...t,
2008
- x: Z(Q(e, -.55, .55)),
2009
- y: Z(Q(e, -.75, .75)),
2010
- rot: Math.round(Q(e, 0, 360))
2011
- }));
2012
- },
2013
- children: "Transform"
2014
- }),
2015
- /* @__PURE__ */ H(L, {
2016
- tone: "primary",
2017
- size: "sm",
2018
- onClick: () => {
2019
- let e = u(g());
2020
- h(c.map((t) => {
2021
- let n = Z(Q(e, .35, .95)), i = Z(Q(e, .35, .95));
2022
- return r ? {
2023
- ...t,
2024
- sx: n,
2025
- sy: i,
2026
- sz: Z(Q(e, .35, .95))
2027
- } : {
2028
- ...t,
2029
- sx: n,
2030
- sy: i
2031
- };
2032
- }));
2033
- },
2034
- children: "Scale"
2035
- }),
2036
- /* @__PURE__ */ H(L, {
2037
- tone: "primary",
2038
- size: "sm",
2039
- onClick: () => {
2040
- let n = u(g());
2041
- t(e.id, {
2042
- motion: Z(Q(n, 0, 1.1)),
2043
- sweep: Math.round(Q(n, 0, 360))
2044
- });
2045
- },
2046
- children: "Animation"
2047
- })
2048
- ]
2049
- }),
2050
- /* @__PURE__ */ H(L, {
2051
- tone: "primary",
2052
- size: "sm",
2053
- className: "w-full",
2054
- onClick: () => {
2055
- let e = u(g());
2056
- if (r) {
2057
- if (i) {
2058
- let t = 2 + Math.floor(e() * 4), n = Q(e, .45, .9);
2059
- h(Tt(Array.from({ length: t }, (r, i) => {
2060
- let [a, o, s] = Ct(e, n), c = Z(Q(e, .5, .92));
2061
- return {
2062
- t: "sphere",
2063
- x: Z(a),
2064
- y: Z(o),
2065
- z: Z(s),
2066
- sx: c,
2067
- sy: c,
2068
- sz: c,
2069
- rot: 0,
2070
- hue: Z(i / t)
2071
- };
2072
- })));
2073
- } else {
2074
- let t = Q(e, .6, 1.15);
2075
- h(Tt(c.map((n) => {
2076
- let [r, i, a] = Ct(e, t);
2077
- return {
2078
- ...n,
2079
- x: Z(r),
2080
- y: Z(i),
2081
- z: Z(a),
2082
- rot: Math.round(Q(e, 0, 360))
2083
- };
2084
- })));
2085
- }
2086
- return;
2087
- }
2088
- let t = 2 + Math.floor(e() * 4), n = Q(e, .45, .85);
2089
- h(wt(Array.from({ length: t }, (r, i) => {
2090
- let [a, o] = St(e, n);
2091
- return {
2092
- t: gt[Math.floor(e() * gt.length)].value,
2093
- x: Z(a),
2094
- y: Z(o),
2095
- sx: Z(Q(e, .4, .85)),
2096
- sy: Z(Q(e, .4, .85)),
2097
- rot: Math.round(Q(e, 0, 360)),
2098
- hue: Z(i / t)
2099
- };
2100
- })));
2101
- },
2102
- children: "Rearrange"
2103
- })
2104
- ]
2105
- });
2106
- }
2107
- //#endregion
2108
- //#region src/loops/theme.js
2109
- function Ot(e, n, r, i) {
2110
- let a = t(r, i), o = {
2111
- bg: a.bg,
2112
- fg: a.fg,
2113
- accent: a.accent,
2114
- dim: a.dim ?? a.accent,
2115
- warm: a.warm ?? a.accent
2116
- }, s = { ...e };
2117
- for (let e of n || []) e.type === "color" && e.role && o[e.role] && (s[e.key] = o[e.role]);
2118
- return s;
2119
- }
2120
- //#endregion
2121
- //#region src/editor/compose/inspectors/LoopFields.jsx
2122
- var kt = (e, t) => {
2123
- let n = e.map((e) => ({
2124
- value: e.id,
2125
- label: e.label
2126
- }));
2127
- return t == null || t === "custom" ? [{
2128
- value: "custom",
2129
- label: "Custom"
2130
- }, ...n] : n;
2131
- };
2132
- function $({ inline: e, label: t, align: n = "fill", children: r }) {
2133
- return e ? /* @__PURE__ */ H(xe, {
2134
- label: t,
2135
- align: n,
2136
- labelWidth: 112,
2137
- children: r
2138
- }) : /* @__PURE__ */ H(z, {
2139
- label: t,
2140
- children: r
2141
- });
2142
- }
2143
- var At = [{
2144
- value: "off",
2145
- label: "Off"
2146
- }, {
2147
- value: "on",
2148
- label: "On"
2149
- }];
2150
- function jt({ inline: e, cs: t, on: n, onChange: r }) {
2151
- return e ? /* @__PURE__ */ H(be, {
2152
- size: t,
2153
- className: `w-full ${_(t) ?? ""}`,
2154
- options: At,
2155
- value: n ? "on" : "off",
2156
- onChange: (e) => r(e === "on")
2157
- }) : /* @__PURE__ */ H(Ce, {
2158
- size: t,
2159
- options: At,
2160
- viewMode: n ? "on" : "off",
2161
- onViewChange: (e) => r(e === "on")
2162
- });
2163
- }
2164
- function Mt({ layer: t, setProp: n, patch: i, updateLayer: s, palette: l, renderAnimate: d, tab: m, tabStrip: g, tree: _, picker: ne = !0, inline: v = !1 }) {
2165
- let y = r(), b = ce(t.loopId), x = b?.params ?? [], S = t.themeId ?? "kol", C = !!t.themeInvert, ie = (e) => s(t.id, {
2166
- themeId: e,
2167
- ...Ot(t, b?.params, e, C)
2168
- }), w = (e) => s(t.id, {
2169
- themeInvert: e,
2170
- ...Ot(t, b?.params, S, e)
2171
- }), T = Ye(t.loopId), E = T ? Object.keys(T).map((e) => ({
2172
- id: e,
2173
- label: e
2174
- })) : null, D = T ? new Set(Object.values(T).flatMap((e) => Object.keys(e))) : null, O = o(t), j = p(x, t), M = Ke(t.loopId, t), le = (e, n, r) => {
2175
- let i = a(t, e, O.take(), {
2176
- stripNoRandom: !!n?.motion,
2177
- ...r
2178
- });
2179
- M && n?.motion && (n.id !== "Form" && (i._framePreset = "custom"), n.id !== "Frame" && (i._formPreset = "custom")), D && Object.keys(i).some((e) => D.has(e)) && (i._lookPreset = "custom"), s(t.id, i);
2180
- }, N = (e) => {
2181
- let n = k(t.loopGroup).find((e) => e.id === t.presetId)?.params ?? {}, r = {};
2182
- for (let t of e) {
2183
- let e = n[t.key] === void 0 ? t.default : n[t.key];
2184
- e !== void 0 && (r[t.key] = e);
2185
- }
2186
- s(t.id, r);
2187
- }, ue = M ? qe(M.frame) : null, de = M ? qe(M.form) : null, P = (e, t) => {
2188
- let n = {};
2189
- ue?.has(e) && (n._framePreset = "custom"), de?.has(e) && (n._formPreset = "custom"), D?.has(e) && (n._lookPreset = "custom"), i({
2190
- [e]: t,
2191
- ...n
2192
- });
2193
- }, fe = (e, t) => (n) => {
2194
- let r = t.find((e) => e.id === n);
2195
- i({
2196
- [e]: n,
2197
- ...r?.params ?? {}
2198
- });
2199
- }, me = (e) => i({
2200
- _lookPreset: e,
2201
- ...T?.[e] ?? {}
2202
- }), F = b?.camera ? b.camera.map((e) => ({
2203
- ...e,
2204
- section: "Camera"
2205
- })) : null, he = [...b?.camera ?? [], ...x.filter((e) => te(e) === "Camera")], I = b?.kind === "engine", ge = he.length > 0 || I && b?.orbit, _e = b?.engine === "scene" && (t.animMode === "keyframes" || t.animMode === "keyframe"), ve = b?.orbit ? {
2206
- yaw: 1,
2207
- dist: 1
2208
- } : se(b), z = ve ? /* @__PURE__ */ U("p", {
2209
- className: `kol-mono-10 text-meta${v ? "" : " col-span-2"}`,
2210
- children: [
2211
- "Press C (Orbit tool) to move the camera — ",
2212
- b?.orbit ? "drag to orbit, scroll to zoom" : ve.yaw ? "drag to rotate, scroll to zoom" : "scroll to zoom",
2213
- "."
2214
- ]
2215
- }) : null;
2216
- return /* @__PURE__ */ U(V, { children: [
2217
- ne && (v ? m === "generate" && /* @__PURE__ */ H(ye, {
2218
- divided: !0,
2219
- children: /* @__PURE__ */ H(Me, {
2220
- layer: t,
2221
- tree: _,
2222
- inline: !0
2223
- })
2224
- }) : /* @__PURE__ */ H(Me, {
2225
- layer: t,
2226
- tree: _
2227
- })),
2228
- g,
2229
- (m === "generate" || m === "labs-effect") && /* @__PURE__ */ U(V, { children: [
2230
- (t.loopId === "softforms" || t.loopId === "softforms3d") && /* @__PURE__ */ H(Dt, { layer: t }),
2231
- T && !v && /* @__PURE__ */ H($, {
2232
- inline: v,
2233
- label: "Look",
2234
- children: /* @__PURE__ */ H(R, {
2235
- variant: "subtle",
2236
- size: y,
2237
- className: "w-full",
2238
- options: kt(E, t._lookPreset),
2239
- value: t._lookPreset ?? "custom",
2240
- onChange: me
2241
- })
2242
- }),
2243
- v && /* @__PURE__ */ U(ye, {
2244
- divided: !0,
2245
- children: [
2246
- T && /* @__PURE__ */ H($, {
2247
- inline: !0,
2248
- label: "Look",
2249
- children: /* @__PURE__ */ H(R, {
2250
- variant: "subtle",
2251
- size: y,
2252
- className: "w-full",
2253
- options: kt(E, t._lookPreset),
2254
- value: t._lookPreset ?? "custom",
2255
- onChange: me
2256
- })
2257
- }),
2258
- /* @__PURE__ */ H($, {
2259
- inline: !0,
2260
- label: "Theme",
2261
- children: /* @__PURE__ */ H(R, {
2262
- variant: "subtle",
2263
- size: y,
2264
- className: "w-full",
2265
- options: e,
2266
- value: S,
2267
- onChange: ie
2268
- })
2269
- }),
2270
- /* @__PURE__ */ H($, {
2271
- inline: !0,
2272
- label: "Invert",
2273
- children: /* @__PURE__ */ H(jt, {
2274
- inline: !0,
2275
- cs: y,
2276
- on: C,
2277
- onChange: w
2278
- })
2279
- }),
2280
- oe(b) && /* @__PURE__ */ H($, {
2281
- inline: !0,
2282
- label: "Background",
2283
- children: /* @__PURE__ */ H(jt, {
2284
- inline: !0,
2285
- cs: y,
2286
- on: t.bgOn !== !1,
2287
- onChange: (e) => n("bgOn", e)
2288
- })
2289
- }),
2290
- z
2291
- ]
2292
- }),
2293
- !v && /* @__PURE__ */ U("div", {
2294
- className: "grid grid-cols-2 gap-2",
2295
- children: [
2296
- /* @__PURE__ */ H($, {
2297
- inline: !1,
2298
- label: "Theme",
2299
- children: /* @__PURE__ */ H(R, {
2300
- variant: "subtle",
2301
- size: y,
2302
- className: "w-full",
2303
- options: e,
2304
- value: S,
2305
- onChange: ie
2306
- })
2307
- }),
2308
- /* @__PURE__ */ H($, {
2309
- inline: !1,
2310
- label: "Invert",
2311
- children: /* @__PURE__ */ H(jt, {
2312
- inline: !1,
2313
- cs: y,
2314
- on: C,
2315
- onChange: w
2316
- })
2317
- }),
2318
- oe(b) && /* @__PURE__ */ H($, {
2319
- inline: !1,
2320
- label: "Background",
2321
- children: /* @__PURE__ */ H(jt, {
2322
- inline: !1,
2323
- cs: y,
2324
- on: t.bgOn !== !1,
2325
- onChange: (e) => n("bgOn", e)
2326
- })
2327
- }),
2328
- z
2329
- ]
2330
- }),
2331
- /* @__PURE__ */ H(A, {
2332
- schema: x,
2333
- layer: t,
2334
- setProp: P,
2335
- palette: l,
2336
- renderAnimate: d,
2337
- tab: "generate",
2338
- inline: v
2339
- }),
2340
- h(t).length > 0 && /* @__PURE__ */ H(L, {
2341
- tone: "primary",
2342
- size: y,
2343
- className: "w-full",
2344
- onClick: () => {
2345
- let e = c(t, O.take());
2346
- e && s(t.id, e);
2347
- },
2348
- children: "Randomize preset"
2349
- }),
2350
- /* @__PURE__ */ H(L, {
2351
- tone: "primary",
2352
- size: y,
2353
- className: "w-full",
2354
- onClick: (e) => e.altKey ? N(f(x, t)) : le(f(x, t), void 0, { withFilters: !0 }),
2355
- children: "Randomize all"
2356
- }),
2357
- j.length > 0 && /* @__PURE__ */ U("div", {
2358
- className: "grid grid-cols-2 gap-2",
2359
- children: [j.map((e) => /* @__PURE__ */ H(L, {
2360
- tone: "primary",
2361
- size: y,
2362
- onClick: (t) => t.altKey ? N(e.params) : le(e.params, e),
2363
- children: e.label
2364
- }, e.id)), t.loopId === "math-expression" && /* @__PURE__ */ H(L, {
2365
- tone: "primary",
2366
- size: y,
2367
- onClick: (e) => {
2368
- if (e.altKey) return N(j.find((e) => e.id === "Expression")?.params ?? []);
2369
- let n = O.take();
2370
- s(t.id, {
2371
- expr: ae(u(n >>> 0)),
2372
- _rollSeed: n
2373
- });
2374
- },
2375
- children: "Wild"
2376
- })]
2377
- }),
2378
- !v && /* @__PURE__ */ H(ee, { seed: O }),
2379
- t.loopId === "pattern-rules" && (t.render ?? "tiles") === "tiles" && /* @__PURE__ */ H(ct, {
2380
- layer: t,
2381
- patch: i,
2382
- seed: O
2383
- })
2384
- ] }),
2385
- (m === "style" || m === "labs-effect") && /* @__PURE__ */ U(V, { children: [
2386
- /* @__PURE__ */ H(A, {
2387
- schema: x,
2388
- layer: t,
2389
- setProp: P,
2390
- palette: l,
2391
- renderAnimate: d,
2392
- tab: "style",
2393
- inline: v
2394
- }),
2395
- t.loopId === "pattern-rules" && /* @__PURE__ */ H(dt, {
2396
- layer: t,
2397
- patch: i
2398
- }),
2399
- t.loopId === "math-curves" && /* @__PURE__ */ H(ft, {
2400
- layer: t,
2401
- patch: i
2402
- }),
2403
- t.loopId === "math-expression" && /* @__PURE__ */ U("div", {
2404
- className: "grid grid-cols-2 gap-2",
2405
- children: [/* @__PURE__ */ H(L, {
2406
- tone: "primary",
2407
- size: y,
2408
- onClick: () => s(t.id, re(t)),
2409
- children: "Fit"
2410
- }), /* @__PURE__ */ H(L, {
2411
- tone: "primary",
2412
- size: y,
2413
- onClick: () => N(j.find((e) => e.id === "View")?.params ?? []),
2414
- children: "Reset"
2415
- })]
2416
- })
2417
- ] }),
2418
- m === "anim" && /* @__PURE__ */ U(V, { children: [
2419
- M && /* @__PURE__ */ U(V, { children: [
2420
- /* @__PURE__ */ H("span", {
2421
- className: "kol-helper-10 text-meta",
2422
- children: "Motion"
2423
- }),
2424
- /* @__PURE__ */ H($, {
2425
- inline: v,
2426
- label: "Frame",
2427
- children: /* @__PURE__ */ H(R, {
2428
- variant: "subtle",
2429
- size: y,
2430
- className: "w-full",
2431
- options: kt(M.frame, t._framePreset),
2432
- value: t._framePreset ?? "custom",
2433
- onChange: fe("_framePreset", M.frame)
2434
- })
2435
- }),
2436
- /* @__PURE__ */ H($, {
2437
- inline: v,
2438
- label: "Form",
2439
- children: /* @__PURE__ */ H(R, {
2440
- variant: "subtle",
2441
- size: y,
2442
- className: "w-full",
2443
- options: kt(M.form, t._formPreset),
2444
- value: t._formPreset ?? "custom",
2445
- onChange: fe("_formPreset", M.form)
2446
- })
2447
- })
2448
- ] }),
2449
- /* @__PURE__ */ H(pe, {
2450
- layer: t,
2451
- schema: x,
2452
- setProp: P
2453
- }),
2454
- /* @__PURE__ */ H(A, {
2455
- schema: x,
2456
- layer: t,
2457
- setProp: P,
2458
- palette: l,
2459
- renderAnimate: d,
2460
- tab: "anim",
2461
- inline: v
2462
- }),
2463
- _e && /* @__PURE__ */ H(ot, {
2464
- layer: t,
2465
- patch: i,
2466
- defaultDuration: b?.duration ?? 8
2467
- }),
2468
- F && /* @__PURE__ */ H(A, {
2469
- schema: F,
2470
- layer: t,
2471
- setProp: n,
2472
- palette: l,
2473
- renderAnimate: d,
2474
- inline: v
2475
- }),
2476
- ge && /* @__PURE__ */ H(st, {
2477
- layer: t,
2478
- patch: i,
2479
- camParams: he,
2480
- isEngine: I,
2481
- showHeader: !F
2482
- })
2483
- ] }),
2484
- /* @__PURE__ */ H(pt, {
2485
- layer: t,
2486
- patch: i,
2487
- tab: m === "labs-effect" ? "style" : m
2488
- })
2489
- ] });
2490
- }
2491
- //#endregion
2492
- //#region src/packs/generators.js
2493
- var Nt = {
2494
- layerTypes: ["loop", "misc"],
2495
- loopById: ce,
2496
- loopDrawParams: ue,
2497
- resolveCameraKeys: se,
2498
- loopBgToggleable: oe,
2499
- presetById: T,
2500
- presetParams: j,
2501
- presetsInGroup: k,
2502
- presetsInSub: O,
2503
- presetLayerPatch: D,
2504
- isToolPreset: M,
2505
- groupById: w,
2506
- drawLoopFrame: N,
2507
- GENERATIVE_TREE: P,
2508
- MISC_TREE: F,
2509
- THEME_OPTIONS: e,
2510
- buildParatypeFlattenGroup: je,
2511
- LoopPicker: Me,
2512
- LoopFields: Mt,
2513
- loadGlHost: () => import("./host-B4SRaN9h.js")
2514
- };
2515
- d("generators", Nt);
2516
- //#endregion
2517
- export { rt as a, at as i, Mt as n, nt as o, it as r, Nt as t };