@kolkrabbi/design-editor 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BindDot-CuCS4LS-.js +127 -0
- package/dist/{RuleRow-D0nV-GvB.js → RuleRow-DlouS36V.js} +115 -109
- package/dist/{TreePicker-DlEXH2kw.js → TreePicker-D5XZT0Zi.js} +1 -1
- package/dist/{core-EQZBciYo.js → core-B78-YLQh.js} +3630 -5555
- package/dist/core.js +3 -3
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +564 -532
- package/dist/{effects-C0ojfSm8.js → effects-B743CHEU.js} +511 -501
- package/dist/effects.js +1 -1
- package/dist/{generators-RjXuwET7.js → generators-B0uhjxUs.js} +488 -867
- package/dist/generators.js +1 -1
- package/dist/{host-BMD1sgpp.js → host-bXQMgZeW.js} +4 -4
- package/dist/{motion-ejcDWbeh.js → motion-9j3WO6a2.js} +628 -724
- package/dist/motion.js +1 -1
- package/dist/{registry-C7rLJN2U.js → registry-CSOtIU7o.js} +35 -35
- package/dist/{EditorIcon-BbFMmc1G.js → rolls-CkmuE-Ya.js} +1826 -1914
- package/dist/{src-BOZt8ciR.js → src-DFtETCsY.js} +1 -1
- package/dist/{useLayerEdit-BElo4uVW.js → useLayerEdit-BDXtPeAP.js} +69 -67
- package/package.json +8 -8
- package/dist/BindDot-xnv1FDLI.js +0 -125
package/dist/design-editor.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as w, d as T, f as E, l as D, n as O, o as k, p as A, r as j, t as M } from "./registry-
|
|
3
|
-
import { c as N, n as P, s as F } from "./generators-
|
|
4
|
-
import { n as I, r as L, t as ee } from "./useLayerEdit-
|
|
5
|
-
import { a as te, c as R, d as ne, f as z, i as re, l as B, n as ie, o as ae, r as oe, s as se, u as ce } from "./effects-
|
|
6
|
-
import { t as
|
|
7
|
-
import { a as
|
|
8
|
-
import { A as
|
|
9
|
-
import { Button as
|
|
1
|
+
import { B as e, Ft as t, It as n, L as r, S as i, Xt as a, Zt as o, a as s, b as c, c as l, i as u, it as d, j as f, l as p, n as m, o as h, ot as g, r as _, rt as v, tt as y, u as b, w as x, wt as S, x as C } from "./rolls-CkmuE-Ya.js";
|
|
2
|
+
import { c as w, d as T, f as E, l as D, n as O, o as k, p as A, r as j, t as M } from "./registry-CSOtIU7o.js";
|
|
3
|
+
import { c as N, n as P, s as F } from "./generators-B0uhjxUs.js";
|
|
4
|
+
import { n as I, r as L, t as ee } from "./useLayerEdit-BDXtPeAP.js";
|
|
5
|
+
import { a as te, c as R, d as ne, f as z, i as re, l as B, n as ie, o as ae, r as oe, s as se, u as ce } from "./effects-B743CHEU.js";
|
|
6
|
+
import { t as le } from "./BindDot-CuCS4LS-.js";
|
|
7
|
+
import { a as ue, i as de, n as fe, o as pe, r as me, s as he } from "./motion-9j3WO6a2.js";
|
|
8
|
+
import { A as ge, B as _e, C as ve, D as ye, E as be, F as xe, G as Se, H as Ce, I as we, L as Te, M as Ee, N as De, O as Oe, P as ke, R as Ae, S as je, T as Me, U as Ne, V as Pe, W as Fe, _ as Ie, a as Le, b as Re, c as ze, d as Be, f as Ve, g as He, h as Ue, i as We, j as Ge, k as Ke, l as qe, m as Je, n as Ye, o as Xe, p as Ze, r as Qe, s as $e, t as et, u as tt, v as nt, w as rt, x as it, y as at, z as ot } from "./core-B78-YLQh.js";
|
|
9
|
+
import { Button as V, Divider as st, Dropdown as ct, FullscreenOverlay as lt, LabeledControlSection as H, SegmentedToggle as U, ToggleSwitch as ut, Tooltip as W } from "@kolkrabbi/kol-component";
|
|
10
10
|
import { createContext as dt, useCallback as ft, useContext as pt, useEffect as G, useRef as K, useState as q } from "react";
|
|
11
11
|
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
12
|
+
import { Icon as Z } from "@kolkrabbi/kol-icons";
|
|
12
13
|
import { useDragResize as mt, useTheme as ht } from "@kolkrabbi/kol-framework";
|
|
13
14
|
//#region src/editor/labs/useLabsLayer.js
|
|
14
|
-
function
|
|
15
|
-
let { layers: e, addLayer: t, removeLayer:
|
|
15
|
+
function Q() {
|
|
16
|
+
let { layers: e, addLayer: t, removeLayer: n, updateLayer: r, select: i, beginTransaction: a, commitTransaction: o } = f(), s = ft((s, c) => {
|
|
16
17
|
let [l, ...u] = e;
|
|
17
|
-
|
|
18
|
-
for (let e of u)
|
|
18
|
+
a();
|
|
19
|
+
for (let e of u) n(e.id);
|
|
19
20
|
let d;
|
|
20
|
-
return l && l.type ===
|
|
21
|
+
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;
|
|
21
22
|
}, [
|
|
22
23
|
e,
|
|
23
24
|
t,
|
|
25
|
+
n,
|
|
24
26
|
r,
|
|
25
27
|
i,
|
|
26
28
|
a,
|
|
27
|
-
o
|
|
28
|
-
s
|
|
29
|
+
o
|
|
29
30
|
]);
|
|
30
31
|
return {
|
|
31
32
|
layer: e[0] ?? null,
|
|
32
|
-
setOnly:
|
|
33
|
+
setOnly: s
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
//#endregion
|
|
36
37
|
//#region src/editor/labs/catalog.js
|
|
37
|
-
var
|
|
38
|
+
var $ = {
|
|
38
39
|
"fx:halftone": "ptrn-dot",
|
|
39
40
|
"fx:scanline": "grid-horizontal",
|
|
40
41
|
"fx:crt": "desktop",
|
|
@@ -64,16 +65,16 @@ var Q = {
|
|
|
64
65
|
composition: "type",
|
|
65
66
|
modulation: "frequency",
|
|
66
67
|
mode: "mode-toggle-01"
|
|
67
|
-
},
|
|
68
|
+
}, _t = {
|
|
68
69
|
editor: "desktop",
|
|
69
70
|
labs: "globe",
|
|
70
71
|
randomiser: "refresh"
|
|
71
|
-
},
|
|
72
|
+
}, vt = [
|
|
72
73
|
"Moiré",
|
|
73
74
|
"Mesh Gradient",
|
|
74
75
|
"Reaction",
|
|
75
76
|
"Halftone"
|
|
76
|
-
],
|
|
77
|
+
], yt = [
|
|
77
78
|
{
|
|
78
79
|
label: "Spaced",
|
|
79
80
|
patch: {
|
|
@@ -105,11 +106,11 @@ var Q = {
|
|
|
105
106
|
label: "Spiral",
|
|
106
107
|
patch: { geometry: "spiral" }
|
|
107
108
|
}
|
|
108
|
-
],
|
|
109
|
+
], bt = (e = {}) => {
|
|
109
110
|
let t = e.geometry ?? "rows";
|
|
110
111
|
return t === "radial" ? "Vortex" : t === "rings" ? "Rings" : t === "spiral" ? "Spiral" : e.mark === "glyph" ? "Glyph" : e.mark === "lattice" ? "Lattice" : "Spaced";
|
|
111
112
|
};
|
|
112
|
-
function
|
|
113
|
+
function xt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource: i }) {
|
|
113
114
|
let a = (e, a) => {
|
|
114
115
|
let o = t("photo", {
|
|
115
116
|
...i(),
|
|
@@ -129,7 +130,7 @@ function bt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
|
|
|
129
130
|
t("kinetic", {
|
|
130
131
|
presetId: e.id,
|
|
131
132
|
presetLabel: e.label,
|
|
132
|
-
comp:
|
|
133
|
+
comp: he(e)
|
|
133
134
|
}), window.dispatchEvent(new CustomEvent("kol:open-params"));
|
|
134
135
|
}, l = e?.presetId ?? null, u = e?.filters?.[0]?.id ?? null, d = l ? T(e?.loopGroup).find((e) => e.id === l) ?? null : null, f = (n, r = "loop", i) => {
|
|
135
136
|
let a = T(n), o = [...new Set(a.map((e) => e.sub).filter(Boolean))], c = (e) => r === "misc" ? () => {
|
|
@@ -159,19 +160,19 @@ function bt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
|
|
|
159
160
|
...ae(z).map((t) => ({
|
|
160
161
|
id: `fx:${t.id}`,
|
|
161
162
|
label: t.label,
|
|
162
|
-
icon:
|
|
163
|
+
icon: $[`fx:${t.id}`] ?? "square",
|
|
163
164
|
pages: t.rack ? re.map((t) => ({
|
|
164
165
|
label: t.label,
|
|
165
166
|
onSelect: () => o(t.id),
|
|
166
167
|
active: e?.fxGroup === t.id
|
|
167
|
-
})) : t.id === "pattern" ?
|
|
168
|
+
})) : t.id === "pattern" ? vt.map((t) => ({
|
|
168
169
|
label: t,
|
|
169
170
|
onSelect: () => s(E("optic", t)[0], "optic"),
|
|
170
171
|
active: e?.loopGroup === "optic" && d?.sub === t
|
|
171
|
-
})) : t.id === "scanline" ?
|
|
172
|
+
})) : t.id === "scanline" ? yt.map((t) => ({
|
|
172
173
|
label: t.label,
|
|
173
174
|
onSelect: () => a("scanline", t.patch),
|
|
174
|
-
active: !e?.fxGroup && u === "scanline" &&
|
|
175
|
+
active: !e?.fxGroup && u === "scanline" && bt(e?.filters?.[0]?.params) === t.label
|
|
175
176
|
})) : t.filters.map((t) => ({
|
|
176
177
|
label: t.label ?? t.id,
|
|
177
178
|
onSelect: () => a(t.id),
|
|
@@ -185,7 +186,7 @@ function bt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
|
|
|
185
186
|
...F.map((e) => ({
|
|
186
187
|
id: `gen:${e.label}`,
|
|
187
188
|
label: e.label,
|
|
188
|
-
icon:
|
|
189
|
+
icon: $[`gen:${e.label}`] ?? "square",
|
|
189
190
|
pages: p(e)
|
|
190
191
|
})),
|
|
191
192
|
{
|
|
@@ -195,33 +196,33 @@ function bt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
|
|
|
195
196
|
{
|
|
196
197
|
id: "vec:Distressor",
|
|
197
198
|
label: "Distressor",
|
|
198
|
-
icon:
|
|
199
|
+
icon: $["vec:Distressor"] ?? "square",
|
|
199
200
|
pages: f("distress")
|
|
200
201
|
},
|
|
201
202
|
{
|
|
202
203
|
id: "vec:Modulator",
|
|
203
204
|
label: "Modulator",
|
|
204
|
-
icon:
|
|
205
|
+
icon: $["vec:Modulator"] ?? "square",
|
|
205
206
|
pages: f("modulator")
|
|
206
207
|
},
|
|
207
208
|
{
|
|
208
209
|
id: "sec:composition",
|
|
209
210
|
label: "Composition"
|
|
210
211
|
},
|
|
211
|
-
...
|
|
212
|
+
...pe.map((t) => ({
|
|
212
213
|
id: `kin:${t.label}`,
|
|
213
214
|
label: t.label,
|
|
214
|
-
icon:
|
|
215
|
+
icon: $[`kin:${t.label}`] ?? "square",
|
|
215
216
|
pages: t.subs.map((t) => ({
|
|
216
217
|
label: t,
|
|
217
|
-
onSelect: () => c(
|
|
218
|
-
active: e?.type === "kinetic" &&
|
|
218
|
+
onSelect: () => c(ue.find((e) => e.sub === t)),
|
|
219
|
+
active: e?.type === "kinetic" && ue.some((e) => e.sub === t && e.id === l)
|
|
219
220
|
}))
|
|
220
221
|
})),
|
|
221
222
|
...N.map((e) => ({
|
|
222
223
|
id: `misc:${e.label}`,
|
|
223
224
|
label: e.label,
|
|
224
|
-
icon:
|
|
225
|
+
icon: $[`misc:${e.label}`] ?? "square",
|
|
225
226
|
pages: e.groups.flatMap((e) => f(e, "misc"))
|
|
226
227
|
})),
|
|
227
228
|
{
|
|
@@ -238,8 +239,8 @@ function bt({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
|
|
|
238
239
|
}
|
|
239
240
|
//#endregion
|
|
240
241
|
//#region src/editor/labs/LabsNav.jsx
|
|
241
|
-
function
|
|
242
|
-
let { addFilter: e, patchFilter:
|
|
242
|
+
function St() {
|
|
243
|
+
let { addFilter: e, patchFilter: n } = f(), { layer: r, setOnly: i } = Q(), a = K(null);
|
|
243
244
|
G(() => {
|
|
244
245
|
r?.type === "photo" && r.src && (a.current = {
|
|
245
246
|
src: r.src,
|
|
@@ -252,11 +253,11 @@ function xt() {
|
|
|
252
253
|
r?.srcType,
|
|
253
254
|
r?.fit
|
|
254
255
|
]);
|
|
255
|
-
let o =
|
|
256
|
+
let o = xt({
|
|
256
257
|
layer: r,
|
|
257
258
|
setOnly: i,
|
|
258
259
|
addFilter: e,
|
|
259
|
-
patchFilter:
|
|
260
|
+
patchFilter: n,
|
|
260
261
|
carriedSource: () => r?.type === "photo" ? {
|
|
261
262
|
src: r.src,
|
|
262
263
|
srcType: r.srcType,
|
|
@@ -264,40 +265,40 @@ function xt() {
|
|
|
264
265
|
} : a.current ?? {}
|
|
265
266
|
});
|
|
266
267
|
return G(() => {
|
|
267
|
-
let e = /* @__PURE__ */ new Map(),
|
|
268
|
-
o.forEach((
|
|
269
|
-
if (
|
|
270
|
-
let e =
|
|
271
|
-
|
|
268
|
+
let e = /* @__PURE__ */ new Map(), n = [];
|
|
269
|
+
o.forEach((t) => {
|
|
270
|
+
if (t.id.startsWith("sec:")) {
|
|
271
|
+
let e = t.id.slice(4);
|
|
272
|
+
n.push({
|
|
272
273
|
icon: gt[e] ?? "square",
|
|
273
|
-
path: `${$e}${
|
|
274
|
-
label:
|
|
274
|
+
path: `${$e}${t.id}`,
|
|
275
|
+
label: t.label,
|
|
275
276
|
sub: []
|
|
276
277
|
});
|
|
277
278
|
return;
|
|
278
279
|
}
|
|
279
|
-
let r = `${$e}${
|
|
280
|
+
let r = `${$e}${t.id}`, i = t.pages ?? [], a = t.onSelect ?? i[0]?.onSelect;
|
|
280
281
|
a && e.set(r, a);
|
|
281
|
-
let o =
|
|
282
|
-
icon:
|
|
282
|
+
let o = n[n.length - 1], s = {
|
|
283
|
+
icon: t.icon,
|
|
283
284
|
path: r,
|
|
284
|
-
label:
|
|
285
|
+
label: t.label
|
|
285
286
|
};
|
|
286
|
-
o?.sub ? o.sub.push(s) :
|
|
287
|
+
o?.sub ? o.sub.push(s) : n.push(s);
|
|
287
288
|
});
|
|
288
|
-
let
|
|
289
|
+
let r = Qe() && !Xe();
|
|
289
290
|
return ze({
|
|
290
|
-
items:
|
|
291
|
-
dispatch: (
|
|
292
|
-
let
|
|
293
|
-
return
|
|
291
|
+
items: n,
|
|
292
|
+
dispatch: (n) => {
|
|
293
|
+
let i = e.get(n);
|
|
294
|
+
return i ? (i(), r && t.play(), !0) : !1;
|
|
294
295
|
}
|
|
295
296
|
}), () => ze(null);
|
|
296
297
|
}), null;
|
|
297
298
|
}
|
|
298
299
|
//#endregion
|
|
299
300
|
//#region src/editor/labs/LabsSourcePicker.jsx
|
|
300
|
-
function
|
|
301
|
+
function Ct(e) {
|
|
301
302
|
let { patch: t } = ee(e.id), n = K(null), [r, i] = q(!1), a = e.type === "loop" && e.loopGroup === "distress";
|
|
302
303
|
return {
|
|
303
304
|
nodes: /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("input", {
|
|
@@ -314,7 +315,7 @@ function St(e) {
|
|
|
314
315
|
return;
|
|
315
316
|
}
|
|
316
317
|
if (r.type.startsWith("video/")) {
|
|
317
|
-
|
|
318
|
+
y(e.id, r), t({
|
|
318
319
|
src: URL.createObjectURL(r),
|
|
319
320
|
srcType: "video"
|
|
320
321
|
});
|
|
@@ -326,17 +327,17 @@ function St(e) {
|
|
|
326
327
|
srcType: "image"
|
|
327
328
|
}), i.readAsDataURL(r);
|
|
328
329
|
}
|
|
329
|
-
}), /* @__PURE__ */ Y(
|
|
330
|
+
}), /* @__PURE__ */ Y(He, {
|
|
330
331
|
open: r,
|
|
331
332
|
onClose: () => i(!1),
|
|
332
333
|
onPick: (e, { contentType: n } = {}) => {
|
|
333
334
|
if (a) {
|
|
334
|
-
t({ svgSrc:
|
|
335
|
+
t({ svgSrc: nt(e) });
|
|
335
336
|
return;
|
|
336
337
|
}
|
|
337
338
|
t({
|
|
338
|
-
src:
|
|
339
|
-
srcType:
|
|
339
|
+
src: nt(e),
|
|
340
|
+
srcType: Ie(n) ? "video" : "image"
|
|
340
341
|
});
|
|
341
342
|
},
|
|
342
343
|
accept: a ? "svg" : "all"
|
|
@@ -345,29 +346,30 @@ function St(e) {
|
|
|
345
346
|
openLibrary: () => i(!0),
|
|
346
347
|
openUpload: () => n.current?.click(),
|
|
347
348
|
openCamera: () => {
|
|
348
|
-
|
|
349
|
+
at(e.id).then(() => t({
|
|
349
350
|
src: null,
|
|
350
351
|
srcType: "webcam"
|
|
351
352
|
})).catch(() => {});
|
|
352
353
|
}
|
|
353
354
|
};
|
|
354
355
|
}
|
|
355
|
-
function
|
|
356
|
-
let
|
|
357
|
-
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(
|
|
356
|
+
function wt({ layer: e }) {
|
|
357
|
+
let t = i(), n = Ct(e);
|
|
358
|
+
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(U, {
|
|
359
|
+
variant: "filled",
|
|
358
360
|
value: null,
|
|
359
361
|
onChange: (e) => ({
|
|
360
|
-
library:
|
|
361
|
-
upload:
|
|
362
|
-
camera:
|
|
362
|
+
library: n.openLibrary,
|
|
363
|
+
upload: n.openUpload,
|
|
364
|
+
camera: n.openCamera
|
|
363
365
|
})[e]?.(),
|
|
364
|
-
options:
|
|
365
|
-
size:
|
|
366
|
+
options: n.svgMode ? Et : Tt,
|
|
367
|
+
size: t,
|
|
366
368
|
ariaLabel: "Source",
|
|
367
|
-
className:
|
|
368
|
-
}),
|
|
369
|
+
className: C(t)
|
|
370
|
+
}), n.nodes] });
|
|
369
371
|
}
|
|
370
|
-
var
|
|
372
|
+
var Tt = [
|
|
371
373
|
{
|
|
372
374
|
value: "library",
|
|
373
375
|
label: "Library"
|
|
@@ -380,9 +382,9 @@ var wt = [
|
|
|
380
382
|
value: "camera",
|
|
381
383
|
label: "Camera"
|
|
382
384
|
}
|
|
383
|
-
],
|
|
384
|
-
function
|
|
385
|
-
let t =
|
|
385
|
+
], Et = Tt.slice(0, 2);
|
|
386
|
+
function Dt({ layer: e }) {
|
|
387
|
+
let t = Ct(e), n = "flex-1 flex flex-col items-center justify-center gap-3 cursor-pointer text-oq-48 hover:text-emphasis hover:bg-oq-02 transition-colors";
|
|
386
388
|
return /* @__PURE__ */ X("div", {
|
|
387
389
|
className: "w-full h-full flex items-stretch p-6 gap-px",
|
|
388
390
|
children: [
|
|
@@ -390,7 +392,7 @@ function Et({ layer: e }) {
|
|
|
390
392
|
type: "button",
|
|
391
393
|
className: n,
|
|
392
394
|
onClick: t.openLibrary,
|
|
393
|
-
children: [/* @__PURE__ */ Y(
|
|
395
|
+
children: [/* @__PURE__ */ Y(Z, {
|
|
394
396
|
name: "image",
|
|
395
397
|
size: 28
|
|
396
398
|
}), /* @__PURE__ */ Y("span", {
|
|
@@ -400,13 +402,13 @@ function Et({ layer: e }) {
|
|
|
400
402
|
}),
|
|
401
403
|
/* @__PURE__ */ Y("div", {
|
|
402
404
|
className: "w-px",
|
|
403
|
-
style: { background: "var(--kol-
|
|
405
|
+
style: { background: "var(--kol-oq-08)" }
|
|
404
406
|
}),
|
|
405
407
|
/* @__PURE__ */ X("button", {
|
|
406
408
|
type: "button",
|
|
407
409
|
className: n,
|
|
408
410
|
onClick: t.openUpload,
|
|
409
|
-
children: [/* @__PURE__ */ Y(
|
|
411
|
+
children: [/* @__PURE__ */ Y(Z, {
|
|
410
412
|
name: "upload",
|
|
411
413
|
size: 28
|
|
412
414
|
}), /* @__PURE__ */ Y("span", {
|
|
@@ -416,13 +418,13 @@ function Et({ layer: e }) {
|
|
|
416
418
|
}),
|
|
417
419
|
/* @__PURE__ */ Y("div", {
|
|
418
420
|
className: "w-px",
|
|
419
|
-
style: { background: "var(--kol-
|
|
421
|
+
style: { background: "var(--kol-oq-08)" }
|
|
420
422
|
}),
|
|
421
423
|
/* @__PURE__ */ X("button", {
|
|
422
424
|
type: "button",
|
|
423
425
|
className: n,
|
|
424
426
|
onClick: t.openCamera,
|
|
425
|
-
children: [/* @__PURE__ */ Y(
|
|
427
|
+
children: [/* @__PURE__ */ Y(Z, {
|
|
426
428
|
name: "camera",
|
|
427
429
|
size: 28
|
|
428
430
|
}), /* @__PURE__ */ Y("span", {
|
|
@@ -436,7 +438,7 @@ function Et({ layer: e }) {
|
|
|
436
438
|
}
|
|
437
439
|
//#endregion
|
|
438
440
|
//#region src/editor/labs/LabsParams.jsx
|
|
439
|
-
function
|
|
441
|
+
function Ot(e, t) {
|
|
440
442
|
G(() => {
|
|
441
443
|
let n = (n) => {
|
|
442
444
|
if (n.key !== "r" && n.key !== "R" || n.metaKey || n.ctrlKey || n.altKey) return;
|
|
@@ -446,13 +448,13 @@ function Dt(e, t) {
|
|
|
446
448
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
447
449
|
});
|
|
448
450
|
}
|
|
449
|
-
var
|
|
451
|
+
var kt = [{
|
|
450
452
|
value: "effect",
|
|
451
453
|
label: "Effect"
|
|
452
454
|
}, {
|
|
453
455
|
value: "anim",
|
|
454
456
|
label: "Motion"
|
|
455
|
-
}],
|
|
457
|
+
}], At = [
|
|
456
458
|
{
|
|
457
459
|
value: "generate",
|
|
458
460
|
label: "Generate"
|
|
@@ -465,7 +467,7 @@ var Ot = [{
|
|
|
465
467
|
value: "anim",
|
|
466
468
|
label: "Animation"
|
|
467
469
|
}
|
|
468
|
-
],
|
|
470
|
+
], jt = [
|
|
469
471
|
{
|
|
470
472
|
value: "generate",
|
|
471
473
|
label: "Gen"
|
|
@@ -479,7 +481,7 @@ var Ot = [{
|
|
|
479
481
|
label: "Anim"
|
|
480
482
|
}
|
|
481
483
|
];
|
|
482
|
-
function
|
|
484
|
+
function Mt({ options: e, active: t, onPick: n, spread: r = !1, pills: i = !1 }) {
|
|
483
485
|
return e?.length ? i ? /* @__PURE__ */ Y("div", {
|
|
484
486
|
className: "flex items-center gap-1 flex-wrap",
|
|
485
487
|
children: e.map((e) => /* @__PURE__ */ Y("button", {
|
|
@@ -498,7 +500,7 @@ function jt({ options: e, active: t, onPick: n, spread: r = !1, pills: i = !1 })
|
|
|
498
500
|
}, e.value))
|
|
499
501
|
}) : null;
|
|
500
502
|
}
|
|
501
|
-
function
|
|
503
|
+
function Nt({ chips: e, active: t, onPick: n, spread: r, pills: i, title: a, tabStrip: o, preStrip: s, fx: c = !1, children: l }) {
|
|
502
504
|
return /* @__PURE__ */ X("div", {
|
|
503
505
|
className: `flex flex-col gap-5${c ? " kol-labs-fx" : ""}`,
|
|
504
506
|
children: [
|
|
@@ -506,7 +508,7 @@ function Mt({ chips: e, active: t, onPick: n, spread: r, pills: i, title: a, tab
|
|
|
506
508
|
className: "kol-eyebrow text-fg-96",
|
|
507
509
|
children: a
|
|
508
510
|
}),
|
|
509
|
-
e && /* @__PURE__ */ Y(
|
|
511
|
+
e && /* @__PURE__ */ Y(Mt, {
|
|
510
512
|
options: e,
|
|
511
513
|
active: t,
|
|
512
514
|
onPick: n,
|
|
@@ -519,26 +521,26 @@ function Mt({ chips: e, active: t, onPick: n, spread: r, pills: i, title: a, tab
|
|
|
519
521
|
]
|
|
520
522
|
});
|
|
521
523
|
}
|
|
522
|
-
function
|
|
523
|
-
let
|
|
524
|
+
function Pt({ layer: t, showMod: n }) {
|
|
525
|
+
let a = i(), [o, c] = q("effect");
|
|
524
526
|
G(() => {
|
|
525
|
-
let e = () =>
|
|
527
|
+
let e = () => c("effect");
|
|
526
528
|
return window.addEventListener("kol:open-effects", e), () => window.removeEventListener("kol:open-effects", e);
|
|
527
529
|
}, []);
|
|
528
|
-
let { addFilter:
|
|
530
|
+
let { addFilter: l, replaceFilter: u, removeFilter: d, toggleFilter: p, updateLayer: h, palette: g } = f(), _ = ee(t.id, { history: "coalesce" }), v = r(t), y = v[0] ?? null, x = ae(z).find((e) => e.id === te(y?.id)), S = x?.id === "halftone", w = S ? (x?.filters ?? []).map((e) => ({
|
|
529
531
|
value: e.id,
|
|
530
532
|
label: e.label
|
|
531
|
-
})) : null, T = !
|
|
532
|
-
if (!
|
|
533
|
-
|
|
533
|
+
})) : null, T = !S && y ? y.def.label : null, E = (e) => {
|
|
534
|
+
if (!y) {
|
|
535
|
+
l(t.id, e);
|
|
534
536
|
return;
|
|
535
537
|
}
|
|
536
|
-
|
|
537
|
-
}, D =
|
|
538
|
-
...
|
|
539
|
-
...
|
|
540
|
-
id:
|
|
541
|
-
} :
|
|
538
|
+
e !== y.id && u(t.id, 0, e);
|
|
539
|
+
}, D = v.map(({ def: e, ...t }) => t), O = y ? {
|
|
540
|
+
...t,
|
|
541
|
+
...y.params,
|
|
542
|
+
id: t.id
|
|
543
|
+
} : t, k = (e) => (t, n) => {
|
|
542
544
|
let r = D.map((r, i) => i === e ? {
|
|
543
545
|
...r,
|
|
544
546
|
params: {
|
|
@@ -546,163 +548,166 @@ function Nt({ layer: e, showMod: r }) {
|
|
|
546
548
|
[t]: n
|
|
547
549
|
}
|
|
548
550
|
} : r);
|
|
549
|
-
|
|
550
|
-
}, A = k(0), j =
|
|
551
|
+
_.patch({ filters: r });
|
|
552
|
+
}, A = k(0), j = n ? (e) => /* @__PURE__ */ Y(le, {
|
|
551
553
|
layer: O,
|
|
552
554
|
param: e,
|
|
553
555
|
setProp: A
|
|
554
|
-
}) : void 0, M = (
|
|
555
|
-
let n = D.map((
|
|
556
|
-
...
|
|
556
|
+
}) : void 0, M = (e) => {
|
|
557
|
+
let n = D.map((t, n) => n === 0 ? {
|
|
558
|
+
...t,
|
|
557
559
|
params: {
|
|
558
|
-
...
|
|
559
|
-
...
|
|
560
|
+
...t.params,
|
|
561
|
+
...e
|
|
560
562
|
}
|
|
561
|
-
} :
|
|
562
|
-
|
|
563
|
+
} : t);
|
|
564
|
+
h(t.id, { filters: n });
|
|
563
565
|
};
|
|
564
|
-
|
|
565
|
-
|
|
566
|
+
Ot(() => {
|
|
567
|
+
y && h(t.id, { filters: D.map((e, t) => t === 0 ? {
|
|
566
568
|
...e,
|
|
567
569
|
params: {}
|
|
568
570
|
} : e) });
|
|
569
571
|
}, () => {
|
|
570
|
-
|
|
572
|
+
y && M(s(O, m(y.def.params, O), b()));
|
|
571
573
|
});
|
|
572
|
-
let N =
|
|
574
|
+
let N = t.fxGroup ? re.find((e) => e.id === t.fxGroup) : null;
|
|
573
575
|
if (N) {
|
|
574
|
-
let
|
|
575
|
-
chain:
|
|
576
|
-
layer:
|
|
576
|
+
let e = {
|
|
577
|
+
chain: v,
|
|
578
|
+
layer: t,
|
|
577
579
|
hostView: O,
|
|
578
|
-
toggleFilter:
|
|
579
|
-
removeFilter:
|
|
580
|
+
toggleFilter: p,
|
|
581
|
+
removeFilter: d,
|
|
580
582
|
setStagePropAt: k,
|
|
581
|
-
palette:
|
|
582
|
-
showMod:
|
|
583
|
-
},
|
|
583
|
+
palette: g,
|
|
584
|
+
showMod: n
|
|
585
|
+
}, r = [{
|
|
584
586
|
value: "",
|
|
585
587
|
label: "Add effect…"
|
|
586
588
|
}, ...ne(N, z).map((e) => ({
|
|
587
589
|
value: e.id,
|
|
588
590
|
label: `${e.label ?? e.id}${e.kind === "pixi" ? " · GPU" : ""}`
|
|
589
591
|
}))];
|
|
590
|
-
return /* @__PURE__ */ X(
|
|
592
|
+
return /* @__PURE__ */ X(Nt, {
|
|
591
593
|
title: "Effects",
|
|
592
594
|
fx: !0,
|
|
593
|
-
tabStrip: /* @__PURE__ */ Y(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
595
|
+
tabStrip: /* @__PURE__ */ Y(U, {
|
|
596
|
+
variant: "filled",
|
|
597
|
+
value: o,
|
|
598
|
+
onChange: c,
|
|
599
|
+
options: kt,
|
|
600
|
+
size: a,
|
|
601
|
+
className: C(a)
|
|
599
602
|
}),
|
|
600
|
-
children: [
|
|
601
|
-
/* @__PURE__ */ X(
|
|
603
|
+
children: [o === "effect" && /* @__PURE__ */ X(J, { children: [
|
|
604
|
+
/* @__PURE__ */ X(H, {
|
|
602
605
|
label: "Effect Stack",
|
|
603
606
|
divided: !0,
|
|
604
|
-
children: [
|
|
607
|
+
children: [v.length === 0 && /* @__PURE__ */ Y(L, {
|
|
605
608
|
className: "kol-mono-10 text-meta",
|
|
606
609
|
children: "No effects yet — add one below."
|
|
607
|
-
}), /* @__PURE__ */ Y(
|
|
608
|
-
...
|
|
610
|
+
}), /* @__PURE__ */ Y(Ft, {
|
|
611
|
+
...e,
|
|
609
612
|
from: 0
|
|
610
613
|
})]
|
|
611
614
|
}),
|
|
612
615
|
/* @__PURE__ */ Y(st, {}),
|
|
613
|
-
/* @__PURE__ */ Y(
|
|
616
|
+
/* @__PURE__ */ Y(H, {
|
|
614
617
|
label: N.label,
|
|
615
618
|
divided: !0,
|
|
616
619
|
children: /* @__PURE__ */ Y(ct, {
|
|
617
620
|
variant: "subtle",
|
|
618
|
-
size:
|
|
621
|
+
size: a,
|
|
619
622
|
className: "w-full",
|
|
620
|
-
options:
|
|
623
|
+
options: r,
|
|
621
624
|
value: "",
|
|
622
|
-
disabled:
|
|
623
|
-
onChange: (
|
|
624
|
-
|
|
625
|
+
disabled: v.length >= 8,
|
|
626
|
+
onChange: (e) => {
|
|
627
|
+
e && l(t.id, e);
|
|
625
628
|
}
|
|
626
629
|
})
|
|
627
630
|
})
|
|
628
|
-
] }),
|
|
629
|
-
sweeps: Array.isArray(
|
|
631
|
+
] }), o === "anim" && y?.def?.sweeps && /* @__PURE__ */ Y(oe, {
|
|
632
|
+
sweeps: Array.isArray(y.params.sweeps) ? y.params.sweeps : [],
|
|
630
633
|
onChange: (e) => A("sweeps", e),
|
|
631
634
|
inline: !0
|
|
632
635
|
})]
|
|
633
636
|
});
|
|
634
637
|
}
|
|
635
|
-
if (!
|
|
638
|
+
if (!y) return /* @__PURE__ */ Y(Nt, {
|
|
636
639
|
chips: w,
|
|
637
640
|
active: null,
|
|
638
641
|
onPick: E,
|
|
639
|
-
spread:
|
|
642
|
+
spread: S,
|
|
640
643
|
fx: !0,
|
|
641
|
-
tabStrip: /* @__PURE__ */ Y(
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
644
|
+
tabStrip: /* @__PURE__ */ Y(U, {
|
|
645
|
+
variant: "filled",
|
|
646
|
+
value: o,
|
|
647
|
+
onChange: c,
|
|
648
|
+
options: kt,
|
|
649
|
+
size: a,
|
|
650
|
+
className: C(a)
|
|
647
651
|
}),
|
|
648
652
|
children: /* @__PURE__ */ Y(I, {
|
|
649
|
-
schema:
|
|
650
|
-
layer:
|
|
651
|
-
setProp:
|
|
652
|
-
palette:
|
|
653
|
-
renderAnimate: (
|
|
654
|
-
layer:
|
|
655
|
-
param:
|
|
656
|
-
setProp:
|
|
653
|
+
schema: Ue,
|
|
654
|
+
layer: t,
|
|
655
|
+
setProp: _.setProp,
|
|
656
|
+
palette: g,
|
|
657
|
+
renderAnimate: (e) => /* @__PURE__ */ Y(le, {
|
|
658
|
+
layer: t,
|
|
659
|
+
param: e,
|
|
660
|
+
setProp: _.setProp
|
|
657
661
|
}),
|
|
658
|
-
tab:
|
|
662
|
+
tab: o === "anim" ? "anim" : "style",
|
|
659
663
|
emptyHint: "Pick an effect from the nav."
|
|
660
664
|
})
|
|
661
665
|
});
|
|
662
|
-
let P =
|
|
666
|
+
let P = y.def.params.filter((t) => e(t) !== "anim"), F = ce(y.def.id), R = F ? P.findIndex((e) => e.key === F) : -1, B = P.length;
|
|
663
667
|
if (R >= 0) {
|
|
664
668
|
let e = R;
|
|
665
669
|
for (; e + 1 < P.length && P[e + 1].type === "select";) e++;
|
|
666
670
|
B = e + 1;
|
|
667
671
|
}
|
|
668
|
-
let se = R > 0 ? P.slice(0, R) : [],
|
|
672
|
+
let se = R > 0 ? P.slice(0, R) : [], ue = R >= 0 ? P.slice(R, B).map((e) => ({
|
|
669
673
|
...e,
|
|
670
674
|
section: void 0
|
|
671
|
-
})) : P,
|
|
675
|
+
})) : P, de = {
|
|
672
676
|
layer: O,
|
|
673
677
|
setProp: A,
|
|
674
|
-
palette:
|
|
678
|
+
palette: g,
|
|
675
679
|
renderAnimate: j,
|
|
676
680
|
inline: !0
|
|
677
681
|
};
|
|
678
|
-
return /* @__PURE__ */ X(
|
|
682
|
+
return /* @__PURE__ */ X(Nt, {
|
|
679
683
|
chips: w,
|
|
680
|
-
active:
|
|
684
|
+
active: y.id,
|
|
681
685
|
onPick: E,
|
|
682
|
-
spread:
|
|
686
|
+
spread: S,
|
|
683
687
|
title: T,
|
|
684
688
|
fx: !0,
|
|
685
|
-
preStrip: /* @__PURE__ */ Y(
|
|
686
|
-
tabStrip: /* @__PURE__ */ Y(
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
689
|
+
preStrip: /* @__PURE__ */ Y(wt, { layer: t }),
|
|
690
|
+
tabStrip: /* @__PURE__ */ Y(U, {
|
|
691
|
+
variant: "filled",
|
|
692
|
+
value: o,
|
|
693
|
+
onChange: c,
|
|
694
|
+
options: kt,
|
|
695
|
+
size: a,
|
|
696
|
+
className: C(a)
|
|
692
697
|
}),
|
|
693
|
-
children: [
|
|
698
|
+
children: [o === "effect" && /* @__PURE__ */ X(J, { children: [
|
|
694
699
|
se.length > 0 && /* @__PURE__ */ Y(I, {
|
|
695
700
|
schema: se,
|
|
696
|
-
...
|
|
701
|
+
...de
|
|
697
702
|
}),
|
|
698
|
-
/* @__PURE__ */ X(
|
|
703
|
+
/* @__PURE__ */ X(H, {
|
|
699
704
|
divided: !0,
|
|
700
705
|
children: [/* @__PURE__ */ Y(I, {
|
|
701
|
-
schema:
|
|
702
|
-
...
|
|
706
|
+
schema: ue,
|
|
707
|
+
...de
|
|
703
708
|
}), /* @__PURE__ */ Y(ie, {
|
|
704
709
|
inline: !0,
|
|
705
|
-
def:
|
|
710
|
+
def: y.def,
|
|
706
711
|
view: O,
|
|
707
712
|
tab: "effect",
|
|
708
713
|
onPatch: M
|
|
@@ -711,102 +716,106 @@ function Nt({ layer: e, showMod: r }) {
|
|
|
711
716
|
/* @__PURE__ */ Y(st, {}),
|
|
712
717
|
B < P.length && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(I, {
|
|
713
718
|
schema: P.slice(B),
|
|
714
|
-
...
|
|
719
|
+
...de
|
|
715
720
|
}), /* @__PURE__ */ Y(st, {})] }),
|
|
716
|
-
/* @__PURE__ */ Y(
|
|
717
|
-
chain:
|
|
718
|
-
layer:
|
|
721
|
+
/* @__PURE__ */ Y(It, {
|
|
722
|
+
chain: v,
|
|
723
|
+
layer: t,
|
|
719
724
|
hostView: O,
|
|
720
|
-
addFilter:
|
|
721
|
-
removeFilter:
|
|
722
|
-
toggleFilter:
|
|
725
|
+
addFilter: l,
|
|
726
|
+
removeFilter: d,
|
|
727
|
+
toggleFilter: p,
|
|
723
728
|
setStagePropAt: k,
|
|
724
|
-
palette:
|
|
725
|
-
showMod:
|
|
729
|
+
palette: g,
|
|
730
|
+
showMod: n
|
|
726
731
|
})
|
|
727
|
-
] }),
|
|
732
|
+
] }), o === "anim" && /* @__PURE__ */ X(J, { children: [
|
|
728
733
|
/* @__PURE__ */ Y(I, {
|
|
729
|
-
schema:
|
|
730
|
-
...
|
|
734
|
+
schema: y.def.params,
|
|
735
|
+
...de,
|
|
731
736
|
tab: "anim"
|
|
732
737
|
}),
|
|
733
738
|
/* @__PURE__ */ Y(ie, {
|
|
734
739
|
inline: !0,
|
|
735
|
-
def:
|
|
740
|
+
def: y.def,
|
|
736
741
|
view: O,
|
|
737
742
|
tab: "anim",
|
|
738
743
|
onPatch: M
|
|
739
744
|
}),
|
|
740
|
-
|
|
741
|
-
sweeps: Array.isArray(
|
|
745
|
+
y.def.sweeps && /* @__PURE__ */ Y(oe, {
|
|
746
|
+
sweeps: Array.isArray(y.params.sweeps) ? y.params.sweeps : [],
|
|
742
747
|
onChange: (e) => A("sweeps", e),
|
|
743
748
|
inline: !0
|
|
744
749
|
})
|
|
745
750
|
] })]
|
|
746
751
|
});
|
|
747
752
|
}
|
|
748
|
-
function
|
|
749
|
-
let d =
|
|
750
|
-
return
|
|
751
|
-
let f =
|
|
752
|
-
...
|
|
753
|
-
...
|
|
753
|
+
function Ft({ chain: t, from: n = 0, layer: r, hostView: a, toggleFilter: o, removeFilter: s, setStagePropAt: c, palette: l, showMod: u }) {
|
|
754
|
+
let d = i();
|
|
755
|
+
return t.slice(n).map((t, i) => {
|
|
756
|
+
let f = i + n, p = t.enabled !== !1, m = {
|
|
757
|
+
...a,
|
|
758
|
+
...t.params,
|
|
754
759
|
id: r.id
|
|
755
760
|
}, h = c(f);
|
|
756
761
|
return /* @__PURE__ */ X("div", {
|
|
757
|
-
className: "flex flex-col gap-2 p-2 rounded bg-
|
|
762
|
+
className: "flex flex-col gap-2 p-2 rounded bg-oq-04",
|
|
758
763
|
children: [/* @__PURE__ */ X("div", {
|
|
759
764
|
className: "flex items-center gap-2",
|
|
760
765
|
children: [/* @__PURE__ */ Y(ut, {
|
|
761
766
|
size: d,
|
|
762
767
|
checked: p,
|
|
763
|
-
onChange: () =>
|
|
764
|
-
label:
|
|
765
|
-
}), /* @__PURE__ */ Y(
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
768
|
+
onChange: () => o(r.id, f),
|
|
769
|
+
label: t.def?.label ?? t.id
|
|
770
|
+
}), /* @__PURE__ */ Y(W, {
|
|
771
|
+
asChild: !0,
|
|
772
|
+
label: "Remove effect",
|
|
773
|
+
children: /* @__PURE__ */ Y("button", {
|
|
774
|
+
type: "button",
|
|
775
|
+
"aria-label": "Remove effect",
|
|
776
|
+
onClick: () => s(r.id, f),
|
|
777
|
+
className: "ml-auto inline-flex items-center justify-center w-5 h-5 shrink-0 text-oq-64 hover:text-emphasis cursor-pointer",
|
|
778
|
+
style: {
|
|
779
|
+
border: "none",
|
|
780
|
+
background: "transparent"
|
|
781
|
+
},
|
|
782
|
+
children: /* @__PURE__ */ Y(Z, {
|
|
783
|
+
name: "x",
|
|
784
|
+
size: 12
|
|
785
|
+
})
|
|
777
786
|
})
|
|
778
787
|
})]
|
|
779
|
-
}), p &&
|
|
780
|
-
schema:
|
|
788
|
+
}), p && t.def && /* @__PURE__ */ Y(I, {
|
|
789
|
+
schema: t.def.params.filter((t) => e(t) !== "anim"),
|
|
781
790
|
layer: m,
|
|
782
791
|
setProp: h,
|
|
783
792
|
palette: l,
|
|
784
793
|
inline: !0,
|
|
785
|
-
renderAnimate: u ? (e) => /* @__PURE__ */ Y(
|
|
794
|
+
renderAnimate: u ? (e) => /* @__PURE__ */ Y(le, {
|
|
786
795
|
layer: m,
|
|
787
796
|
param: e,
|
|
788
797
|
setProp: h
|
|
789
798
|
}) : void 0
|
|
790
799
|
})]
|
|
791
|
-
},
|
|
800
|
+
}, t.key ?? f);
|
|
792
801
|
});
|
|
793
802
|
}
|
|
794
|
-
function
|
|
795
|
-
let u =
|
|
803
|
+
function It({ chain: e, layer: t, hostView: n, addFilter: r, removeFilter: a, toggleFilter: o, setStagePropAt: s, palette: c, showMod: l }) {
|
|
804
|
+
let u = i(), d = [{
|
|
796
805
|
value: "",
|
|
797
806
|
label: "Add FX..."
|
|
798
807
|
}, ...B(z).map((e) => ({
|
|
799
808
|
value: e.id,
|
|
800
809
|
label: e.label ?? e.id
|
|
801
810
|
}))];
|
|
802
|
-
return /* @__PURE__ */ X(
|
|
811
|
+
return /* @__PURE__ */ X(H, {
|
|
803
812
|
label: "Post-Processing",
|
|
804
813
|
divided: !0,
|
|
805
|
-
children: [/* @__PURE__ */ Y(
|
|
814
|
+
children: [/* @__PURE__ */ Y(Ft, {
|
|
806
815
|
chain: e,
|
|
807
816
|
from: 1,
|
|
808
|
-
layer:
|
|
809
|
-
hostView:
|
|
817
|
+
layer: t,
|
|
818
|
+
hostView: n,
|
|
810
819
|
toggleFilter: o,
|
|
811
820
|
removeFilter: a,
|
|
812
821
|
setStagePropAt: s,
|
|
@@ -820,123 +829,125 @@ function Ft({ chain: e, layer: n, hostView: r, addFilter: i, removeFilter: a, to
|
|
|
820
829
|
value: "",
|
|
821
830
|
disabled: e.length >= 8,
|
|
822
831
|
onChange: (e) => {
|
|
823
|
-
e &&
|
|
832
|
+
e && r(t.id, e);
|
|
824
833
|
}
|
|
825
834
|
})]
|
|
826
835
|
});
|
|
827
836
|
}
|
|
828
|
-
function
|
|
829
|
-
let
|
|
837
|
+
function Lt({ layer: e, showMod: t, tree: n }) {
|
|
838
|
+
let r = i(), [a, o] = q("generate"), { updateLayer: c, palette: l } = f(), { setOnly: u } = Q(), d = ee(e.id, { history: "coalesce" }), p = T(e.loopGroup).find((t) => t.id === e.presetId), h = O(e.loopGroup)?.label ?? "", g = e.loopGroup === "paratype" && p?.sub === "Glyphs" ? E("paratype", "Glyphs") : null, _ = g ? g.map((e) => ({
|
|
830
839
|
value: e.id,
|
|
831
840
|
label: e.label
|
|
832
841
|
})) : null;
|
|
833
|
-
return
|
|
834
|
-
|
|
842
|
+
return Ot(() => {
|
|
843
|
+
p && u(e.type, D(p, e.loopGroup));
|
|
835
844
|
}, () => {
|
|
836
845
|
let t = k(e.loopId)?.params ?? [];
|
|
837
|
-
|
|
838
|
-
}), /* @__PURE__ */ Y(
|
|
839
|
-
title:
|
|
840
|
-
chips:
|
|
846
|
+
c(e.id, s(e, m(t, e), b(), { withFilters: !0 }));
|
|
847
|
+
}), /* @__PURE__ */ Y(Nt, {
|
|
848
|
+
title: h,
|
|
849
|
+
chips: _,
|
|
841
850
|
active: e.presetId,
|
|
842
851
|
onPick: (t) => {
|
|
843
|
-
let n =
|
|
844
|
-
n && t !== e.presetId &&
|
|
852
|
+
let n = g?.find((e) => e.id === t);
|
|
853
|
+
n && t !== e.presetId && u(e.type, D(n, e.loopGroup));
|
|
845
854
|
},
|
|
846
855
|
pills: !0,
|
|
847
|
-
preStrip: e.loopGroup === "distress" ? /* @__PURE__ */ Y(
|
|
848
|
-
tabStrip: /* @__PURE__ */ Y(
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
856
|
+
preStrip: e.loopGroup === "distress" ? /* @__PURE__ */ Y(wt, { layer: e }) : void 0,
|
|
857
|
+
tabStrip: /* @__PURE__ */ Y(U, {
|
|
858
|
+
variant: "filled",
|
|
859
|
+
value: a,
|
|
860
|
+
onChange: o,
|
|
861
|
+
options: r === "sm" ? At : jt,
|
|
862
|
+
size: r,
|
|
863
|
+
className: C(r)
|
|
854
864
|
}),
|
|
855
865
|
children: /* @__PURE__ */ Y(P, {
|
|
856
866
|
layer: e,
|
|
857
|
-
setProp:
|
|
858
|
-
patch:
|
|
859
|
-
updateLayer:
|
|
860
|
-
palette:
|
|
861
|
-
renderAnimate:
|
|
867
|
+
setProp: d.setProp,
|
|
868
|
+
patch: d.patch,
|
|
869
|
+
updateLayer: c,
|
|
870
|
+
palette: l,
|
|
871
|
+
renderAnimate: t ? (t) => /* @__PURE__ */ Y(le, {
|
|
862
872
|
layer: e,
|
|
863
873
|
param: t,
|
|
864
|
-
setProp:
|
|
874
|
+
setProp: d.setProp
|
|
865
875
|
}) : void 0,
|
|
866
|
-
tab:
|
|
876
|
+
tab: a,
|
|
867
877
|
tabStrip: null,
|
|
868
|
-
tree:
|
|
878
|
+
tree: n,
|
|
869
879
|
inline: !0
|
|
870
880
|
})
|
|
871
881
|
});
|
|
872
882
|
}
|
|
873
|
-
function
|
|
874
|
-
let
|
|
875
|
-
return
|
|
876
|
-
|
|
877
|
-
presetId:
|
|
878
|
-
presetLabel:
|
|
879
|
-
comp:
|
|
883
|
+
function Rt({ layer: e, showMod: t }) {
|
|
884
|
+
let n = i(), [r, a] = q("generate"), { updateLayer: o, palette: s } = f(), { setOnly: c } = Q(), l = ee(e.id, { history: "coalesce" }), u = ue.find((t) => t.id === e.presetId), d = pe.find((e) => e.subs.includes(u?.sub))?.label ?? "Kinetic";
|
|
885
|
+
return Ot(() => {
|
|
886
|
+
u && c("kinetic", {
|
|
887
|
+
presetId: u.id,
|
|
888
|
+
presetLabel: u.label,
|
|
889
|
+
comp: he(u)
|
|
880
890
|
});
|
|
881
891
|
}, () => {
|
|
882
|
-
let t =
|
|
892
|
+
let t = b(), n = p(t >>> 0), r = e.comp ?? { instances: [] };
|
|
883
893
|
(r.instances ?? []).forEach((e, t) => {
|
|
884
|
-
r =
|
|
885
|
-
}),
|
|
894
|
+
r = de(r, t, n);
|
|
895
|
+
}), o(e.id, {
|
|
886
896
|
comp: r,
|
|
887
897
|
_rollSeed: t
|
|
888
898
|
});
|
|
889
|
-
}), /* @__PURE__ */ Y(
|
|
890
|
-
title:
|
|
891
|
-
tabStrip: /* @__PURE__ */ Y(
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
899
|
+
}), /* @__PURE__ */ Y(Nt, {
|
|
900
|
+
title: d,
|
|
901
|
+
tabStrip: /* @__PURE__ */ Y(U, {
|
|
902
|
+
variant: "filled",
|
|
903
|
+
value: r,
|
|
904
|
+
onChange: a,
|
|
905
|
+
options: n === "sm" ? At : jt,
|
|
906
|
+
size: n,
|
|
907
|
+
className: C(n)
|
|
897
908
|
}),
|
|
898
|
-
children: /* @__PURE__ */ Y(
|
|
909
|
+
children: /* @__PURE__ */ Y(me, {
|
|
899
910
|
layer: e,
|
|
900
|
-
setProp:
|
|
901
|
-
updateLayer:
|
|
902
|
-
palette:
|
|
903
|
-
renderAnimate:
|
|
911
|
+
setProp: l.setProp,
|
|
912
|
+
updateLayer: o,
|
|
913
|
+
palette: s,
|
|
914
|
+
renderAnimate: t ? (t) => /* @__PURE__ */ Y(le, {
|
|
904
915
|
layer: e,
|
|
905
916
|
param: t,
|
|
906
|
-
setProp:
|
|
917
|
+
setProp: l.setProp
|
|
907
918
|
}) : () => null,
|
|
908
|
-
tab:
|
|
919
|
+
tab: r,
|
|
909
920
|
tabStrip: null
|
|
910
921
|
})
|
|
911
922
|
});
|
|
912
923
|
}
|
|
913
|
-
function
|
|
914
|
-
let { layer: e } =
|
|
924
|
+
function zt() {
|
|
925
|
+
let { layer: e } = Q(), t = !!g().labsModDots;
|
|
915
926
|
return G(() => {
|
|
916
927
|
let e = (e) => {
|
|
917
928
|
if (e.key !== "m" && e.key !== "M" || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
918
929
|
let t = e.target;
|
|
919
|
-
t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable ||
|
|
930
|
+
t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable || d("labsModDots", !v().labsModDots);
|
|
920
931
|
};
|
|
921
932
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
922
|
-
}, []), e ? e.type === "photo" ? /* @__PURE__ */ Y(
|
|
933
|
+
}, []), e ? e.type === "photo" ? /* @__PURE__ */ Y(Pt, {
|
|
923
934
|
layer: e,
|
|
924
935
|
showMod: t
|
|
925
|
-
}, e.id) : e.type === "loop" ? /* @__PURE__ */ Y(
|
|
936
|
+
}, e.id) : e.type === "loop" ? /* @__PURE__ */ Y(Lt, {
|
|
926
937
|
layer: e,
|
|
927
938
|
showMod: t
|
|
928
|
-
}, e.id) : e.type === "misc" ? /* @__PURE__ */ Y(
|
|
939
|
+
}, e.id) : e.type === "misc" ? /* @__PURE__ */ Y(Lt, {
|
|
929
940
|
layer: e,
|
|
930
941
|
showMod: t,
|
|
931
942
|
tree: N
|
|
932
|
-
}, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Y(
|
|
943
|
+
}, e.id) : e.type === "kinetic" ? /* @__PURE__ */ Y(Rt, {
|
|
933
944
|
layer: e,
|
|
934
945
|
showMod: t
|
|
935
946
|
}, e.id) : /* @__PURE__ */ Y(L, { children: "This layer has no labs surface." }) : /* @__PURE__ */ Y(L, { children: "Pick an effect or generator from the nav." });
|
|
936
947
|
}
|
|
937
948
|
//#endregion
|
|
938
949
|
//#region src/editor/labs/LabsShortcuts.jsx
|
|
939
|
-
var
|
|
950
|
+
var Bt = [
|
|
940
951
|
["0.5", "a plain value — stays put (normal slider)"],
|
|
941
952
|
["t", "counts up in seconds: 0, 1, 2 …"],
|
|
942
953
|
["t*0.1", "counts up slowly"],
|
|
@@ -946,14 +957,14 @@ var zt = [
|
|
|
946
957
|
["wave(t*0.5)*40", "bounce, scaled to 0 … 40"],
|
|
947
958
|
["saw(t)", "ramp 0 → 1, repeat"],
|
|
948
959
|
["tri(t)", "triangle 0 → 1 → 0"]
|
|
949
|
-
],
|
|
960
|
+
], Vt = [
|
|
950
961
|
["Oscillators · 0…1", "wave saw tri pulse(t,w) ease(t,c) bell step(t,n)"],
|
|
951
962
|
["Trig", "sin cos tan atan2"],
|
|
952
963
|
["Math", "abs floor ceil round sqrt pow"],
|
|
953
964
|
["Helpers", "clamp(x,a,b) lerp(a,b,u) mod(a,b) frac smooth"],
|
|
954
965
|
["Constants", "PI TAU PHI E"]
|
|
955
|
-
],
|
|
956
|
-
function
|
|
966
|
+
], Ht = () => [...Pe("labs").flatMap(({ items: e }) => e.map((e) => [_e(e.combo), e.label])), ["Esc", "close"]];
|
|
967
|
+
function Ut() {
|
|
957
968
|
let [e, t] = q(!1);
|
|
958
969
|
return G(() => {
|
|
959
970
|
let e = (e) => {
|
|
@@ -994,14 +1005,14 @@ function Ht() {
|
|
|
994
1005
|
" is the playhead in seconds, so it pauses / scrubs / tempo-scales with the transport. Drag the slider to clear an expression."
|
|
995
1006
|
]
|
|
996
1007
|
}),
|
|
997
|
-
/* @__PURE__ */ Y(
|
|
1008
|
+
/* @__PURE__ */ Y(H, {
|
|
998
1009
|
label: "Examples",
|
|
999
1010
|
children: /* @__PURE__ */ Y("div", {
|
|
1000
1011
|
className: "flex flex-col gap-1",
|
|
1001
|
-
children:
|
|
1012
|
+
children: Bt.map(([e, t]) => /* @__PURE__ */ X("div", {
|
|
1002
1013
|
className: "flex items-center gap-4",
|
|
1003
1014
|
children: [/* @__PURE__ */ Y("code", {
|
|
1004
|
-
className: "kol-mono-12 text-emphasis bg-
|
|
1015
|
+
className: "kol-mono-12 text-emphasis bg-oq-04 rounded px-2 py-0.5",
|
|
1005
1016
|
style: { minWidth: 132 },
|
|
1006
1017
|
children: e
|
|
1007
1018
|
}), /* @__PURE__ */ Y("span", {
|
|
@@ -1011,7 +1022,7 @@ function Ht() {
|
|
|
1011
1022
|
}, e))
|
|
1012
1023
|
})
|
|
1013
1024
|
}),
|
|
1014
|
-
/* @__PURE__ */ Y(
|
|
1025
|
+
/* @__PURE__ */ Y(H, {
|
|
1015
1026
|
label: "Loop",
|
|
1016
1027
|
children: /* @__PURE__ */ X("p", {
|
|
1017
1028
|
className: "kol-mono-12 text-body",
|
|
@@ -1026,11 +1037,11 @@ function Ht() {
|
|
|
1026
1037
|
]
|
|
1027
1038
|
})
|
|
1028
1039
|
}),
|
|
1029
|
-
/* @__PURE__ */ Y(
|
|
1040
|
+
/* @__PURE__ */ Y(H, {
|
|
1030
1041
|
label: "Functions",
|
|
1031
1042
|
children: /* @__PURE__ */ Y("div", {
|
|
1032
1043
|
className: "flex flex-col gap-2",
|
|
1033
|
-
children:
|
|
1044
|
+
children: Vt.map(([e, t]) => /* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("p", {
|
|
1034
1045
|
className: "kol-helper-10 text-subtle",
|
|
1035
1046
|
children: e
|
|
1036
1047
|
}), /* @__PURE__ */ Y("p", {
|
|
@@ -1041,7 +1052,7 @@ function Ht() {
|
|
|
1041
1052
|
}),
|
|
1042
1053
|
/* @__PURE__ */ Y("div", {
|
|
1043
1054
|
className: "pt-3 border-t border-oq-08 flex flex-wrap gap-x-5 gap-y-1",
|
|
1044
|
-
children:
|
|
1055
|
+
children: Ht().map(([e, t]) => /* @__PURE__ */ X("span", {
|
|
1045
1056
|
className: "kol-mono-12",
|
|
1046
1057
|
children: [
|
|
1047
1058
|
/* @__PURE__ */ Y("span", {
|
|
@@ -1063,15 +1074,15 @@ function Ht() {
|
|
|
1063
1074
|
}
|
|
1064
1075
|
//#endregion
|
|
1065
1076
|
//#region src/editor/labs/LabsView.jsx
|
|
1066
|
-
var
|
|
1077
|
+
var Wt = .85, Gt = .3, Kt = 2.5, qt = {
|
|
1067
1078
|
0: 1,
|
|
1068
1079
|
1: .5,
|
|
1069
1080
|
2: 1,
|
|
1070
1081
|
3: 1.5,
|
|
1071
1082
|
4: 2
|
|
1072
|
-
},
|
|
1073
|
-
function
|
|
1074
|
-
let { layer: e } =
|
|
1083
|
+
}, Jt = "px-2 py-1 rounded border border-oq-08 bg-surface-secondary kol-mono-12 text-emphasis tabular-nums";
|
|
1084
|
+
function Yt() {
|
|
1085
|
+
let { layer: e } = Q(), t = e?.type === "photo" && !e.src && e.srcType !== "webcam", [n, r] = q(1), [i, a] = q(!1), o = Te(i), s = K(null), c = (e) => Math.min(Kt, Math.max(Gt, e)), l = (e) => r((t) => c(t * (e > 0 ? 1.25 : .8))), { tool: u } = Se(), d = u === "orbit", f = K(d);
|
|
1075
1086
|
return f.current = d, G(() => {
|
|
1076
1087
|
let e = s.current;
|
|
1077
1088
|
if (!e) return;
|
|
@@ -1088,7 +1099,7 @@ function Jt() {
|
|
|
1088
1099
|
a((e) => !e);
|
|
1089
1100
|
return;
|
|
1090
1101
|
}
|
|
1091
|
-
|
|
1102
|
+
qt[e.key] !== void 0 && r(qt[e.key]);
|
|
1092
1103
|
}
|
|
1093
1104
|
};
|
|
1094
1105
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
@@ -1097,46 +1108,57 @@ function Jt() {
|
|
|
1097
1108
|
className: "relative w-full h-full flex items-center justify-center",
|
|
1098
1109
|
style: { background: "var(--kol-surface-secondary)" },
|
|
1099
1110
|
onDoubleClick: () => r(1),
|
|
1100
|
-
children: [t ? /* @__PURE__ */ Y(
|
|
1111
|
+
children: [t ? /* @__PURE__ */ Y(Dt, { layer: e }) : /* @__PURE__ */ Y("div", {
|
|
1101
1112
|
style: {
|
|
1102
|
-
width: `${n *
|
|
1103
|
-
height: `${n *
|
|
1113
|
+
width: `${n * Wt * 100}%`,
|
|
1114
|
+
height: `${n * Wt * 100}%`
|
|
1104
1115
|
},
|
|
1105
1116
|
children: /* @__PURE__ */ Y(tt, {})
|
|
1106
1117
|
}), /* @__PURE__ */ X("div", {
|
|
1107
1118
|
className: "absolute bottom-3 right-3 z-[3] flex items-center gap-2",
|
|
1108
1119
|
children: [
|
|
1109
|
-
/* @__PURE__ */ Y(
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1120
|
+
/* @__PURE__ */ Y(W, {
|
|
1121
|
+
label: "Zoom out",
|
|
1122
|
+
children: /* @__PURE__ */ Y("button", {
|
|
1123
|
+
"aria-label": "Zoom out",
|
|
1124
|
+
type: "button",
|
|
1125
|
+
className: Jt,
|
|
1126
|
+
onClick: () => l(-1),
|
|
1127
|
+
children: "−"
|
|
1128
|
+
})
|
|
1115
1129
|
}),
|
|
1116
|
-
/* @__PURE__ */
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1130
|
+
/* @__PURE__ */ Y(W, {
|
|
1131
|
+
label: "Reset zoom (0)",
|
|
1132
|
+
children: /* @__PURE__ */ X("button", {
|
|
1133
|
+
"aria-label": "Reset zoom (0)",
|
|
1134
|
+
type: "button",
|
|
1135
|
+
className: Jt,
|
|
1136
|
+
onClick: () => r(1),
|
|
1137
|
+
children: [Math.round(n * 100), "%"]
|
|
1138
|
+
})
|
|
1122
1139
|
}),
|
|
1123
|
-
/* @__PURE__ */ Y(
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1140
|
+
/* @__PURE__ */ Y(W, {
|
|
1141
|
+
label: "Zoom in",
|
|
1142
|
+
children: /* @__PURE__ */ Y("button", {
|
|
1143
|
+
"aria-label": "Zoom in",
|
|
1144
|
+
type: "button",
|
|
1145
|
+
className: Jt,
|
|
1146
|
+
onClick: () => l(1),
|
|
1147
|
+
children: "+"
|
|
1148
|
+
})
|
|
1129
1149
|
}),
|
|
1130
|
-
i && /* @__PURE__ */
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1150
|
+
i && /* @__PURE__ */ Y(W, {
|
|
1151
|
+
label: "Framerate — press F to hide",
|
|
1152
|
+
children: /* @__PURE__ */ X("span", {
|
|
1153
|
+
className: Jt,
|
|
1154
|
+
children: [o, " fps"]
|
|
1155
|
+
})
|
|
1134
1156
|
})
|
|
1135
1157
|
]
|
|
1136
1158
|
})]
|
|
1137
1159
|
});
|
|
1138
1160
|
}
|
|
1139
|
-
function
|
|
1161
|
+
function Xt() {
|
|
1140
1162
|
let e = K(null), { grabProps: t } = mt(e, {
|
|
1141
1163
|
token: "kol-rail",
|
|
1142
1164
|
side: "right"
|
|
@@ -1183,47 +1205,50 @@ function Yt() {
|
|
|
1183
1205
|
className: "kol-compose-rail kol-compose-rail--inspector",
|
|
1184
1206
|
children: [/* @__PURE__ */ Y("div", { ...t }), /* @__PURE__ */ Y("div", {
|
|
1185
1207
|
className: "kol-compose-inspector-body",
|
|
1186
|
-
children: /* @__PURE__ */ Y(
|
|
1208
|
+
children: /* @__PURE__ */ Y(zt, {})
|
|
1187
1209
|
})]
|
|
1188
1210
|
});
|
|
1189
1211
|
}
|
|
1190
|
-
var
|
|
1191
|
-
function
|
|
1192
|
-
let { paramsOpen: e, toggleParams: t } = pt(
|
|
1212
|
+
var Zt = dt(null);
|
|
1213
|
+
function Qt() {
|
|
1214
|
+
let { paramsOpen: e, toggleParams: t } = pt(Zt);
|
|
1193
1215
|
return /* @__PURE__ */ Y("div", {
|
|
1194
1216
|
className: "flex h-12 shrink-0 items-center border-b border-oq-08 bg-surface-primary px-2",
|
|
1195
|
-
children: /* @__PURE__ */ Y(
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1217
|
+
children: /* @__PURE__ */ Y(W, {
|
|
1218
|
+
label: "Parameters",
|
|
1219
|
+
children: /* @__PURE__ */ Y(V, {
|
|
1220
|
+
variant: "nav",
|
|
1221
|
+
size: "lg",
|
|
1222
|
+
iconOnly: "panel-right",
|
|
1223
|
+
"aria-label": "Parameters",
|
|
1224
|
+
pressed: e,
|
|
1225
|
+
onClick: t
|
|
1226
|
+
})
|
|
1202
1227
|
})
|
|
1203
1228
|
});
|
|
1204
1229
|
}
|
|
1205
|
-
function
|
|
1230
|
+
function $t() {
|
|
1206
1231
|
return /* @__PURE__ */ Y("div", {
|
|
1207
1232
|
className: "kol-compose-rail kol-compose-rail--inspector",
|
|
1208
1233
|
children: /* @__PURE__ */ Y("div", {
|
|
1209
1234
|
className: "kol-compose-inspector-body",
|
|
1210
|
-
children: /* @__PURE__ */ Y(
|
|
1235
|
+
children: /* @__PURE__ */ Y(zt, {})
|
|
1211
1236
|
})
|
|
1212
1237
|
});
|
|
1213
1238
|
}
|
|
1214
|
-
var
|
|
1239
|
+
var en = {
|
|
1215
1240
|
topbar: () => null,
|
|
1216
|
-
canvas:
|
|
1241
|
+
canvas: Yt,
|
|
1217
1242
|
panels: [
|
|
1218
1243
|
{
|
|
1219
1244
|
slot: "canvas.footer",
|
|
1220
1245
|
order: 0,
|
|
1221
|
-
Component:
|
|
1246
|
+
Component: fe
|
|
1222
1247
|
},
|
|
1223
1248
|
{
|
|
1224
1249
|
slot: "right.body",
|
|
1225
1250
|
order: 0,
|
|
1226
|
-
Component:
|
|
1251
|
+
Component: Xt
|
|
1227
1252
|
},
|
|
1228
1253
|
{
|
|
1229
1254
|
slot: "right.footer",
|
|
@@ -1231,97 +1256,97 @@ var $t = {
|
|
|
1231
1256
|
Component: Je
|
|
1232
1257
|
}
|
|
1233
1258
|
]
|
|
1234
|
-
},
|
|
1235
|
-
|
|
1236
|
-
topbar:
|
|
1237
|
-
panels:
|
|
1259
|
+
}, tn = {
|
|
1260
|
+
...en,
|
|
1261
|
+
topbar: Qt,
|
|
1262
|
+
panels: en.panels.map((e) => e.Component === Xt ? {
|
|
1238
1263
|
...e,
|
|
1239
|
-
Component:
|
|
1264
|
+
Component: $t
|
|
1240
1265
|
} : e)
|
|
1241
1266
|
};
|
|
1242
|
-
function
|
|
1243
|
-
let { setAspect: e, selectedId:
|
|
1244
|
-
|
|
1267
|
+
function nn() {
|
|
1268
|
+
let { setAspect: e, selectedId: n, select: r } = f(), { layer: i, setOnly: a } = Q(), o = K(!1), s = Qe() && !Xe(), [l, u] = q(!1);
|
|
1269
|
+
ot(), G(() => {
|
|
1245
1270
|
if (o.current) return;
|
|
1246
1271
|
o.current = !0;
|
|
1247
|
-
let
|
|
1248
|
-
|
|
1272
|
+
let n = v();
|
|
1273
|
+
n.defaultAspect && n.defaultAspect !== "custom" && e(n.defaultAspect), n.defaultLoopSeconds && t.setLoopSeconds(n.defaultLoopSeconds);
|
|
1249
1274
|
}, []);
|
|
1250
|
-
let
|
|
1275
|
+
let d = K(!1);
|
|
1251
1276
|
G(() => {
|
|
1252
|
-
if (
|
|
1253
|
-
|
|
1277
|
+
if (d.current) return;
|
|
1278
|
+
d.current = !0;
|
|
1254
1279
|
let e = new URLSearchParams(window.location.search).get("preset"), t = e ? j(e) : null;
|
|
1255
1280
|
t && a("loop", D(w(e), t));
|
|
1256
1281
|
}, [a]);
|
|
1257
|
-
let { tool:
|
|
1258
|
-
return
|
|
1282
|
+
let { tool: p, setTool: m } = Se(), h = K(p);
|
|
1283
|
+
return h.current = p, G(() => {
|
|
1259
1284
|
let e = (e) => {
|
|
1260
|
-
let
|
|
1261
|
-
if (!(
|
|
1285
|
+
let n = e.target;
|
|
1286
|
+
if (!(n?.tagName === "INPUT" || n?.tagName === "TEXTAREA" || n?.isContentEditable)) {
|
|
1262
1287
|
if (e.code === "Space") {
|
|
1263
|
-
e.preventDefault(),
|
|
1288
|
+
e.preventDefault(), t.toggle();
|
|
1264
1289
|
return;
|
|
1265
1290
|
}
|
|
1266
|
-
(e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey &&
|
|
1291
|
+
(e.key === "c" || e.key === "C") && !e.metaKey && !e.ctrlKey && !e.altKey && m(h.current === "orbit" ? "select" : "orbit");
|
|
1267
1292
|
}
|
|
1268
1293
|
};
|
|
1269
1294
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
1270
|
-
}, [
|
|
1295
|
+
}, [m]), G(() => {
|
|
1271
1296
|
if (!i?.presetId) return;
|
|
1272
1297
|
let e = new URLSearchParams(window.location.search);
|
|
1273
1298
|
e.get("preset") !== i.presetId && (e.set("view", "labs"), e.set("preset", i.presetId), i.loopGroup ? e.set("cat", i.loopGroup) : e.delete("cat"), window.history.replaceState(null, "", `${window.location.pathname}?${e}`));
|
|
1274
1299
|
}, [i?.presetId, i?.loopGroup]), G(() => {
|
|
1275
|
-
i &&
|
|
1300
|
+
i && n !== i.id && r(i.id);
|
|
1276
1301
|
}, [
|
|
1277
1302
|
i,
|
|
1278
|
-
|
|
1303
|
+
n,
|
|
1279
1304
|
r
|
|
1280
1305
|
]), /* @__PURE__ */ X("div", {
|
|
1281
1306
|
className: "kol-editor-labs contents",
|
|
1282
1307
|
"data-touch": s || void 0,
|
|
1283
|
-
"data-params":
|
|
1308
|
+
"data-params": l ? "open" : void 0,
|
|
1284
1309
|
children: [
|
|
1285
|
-
/* @__PURE__ */ Y(
|
|
1286
|
-
s ? /* @__PURE__ */ Y(
|
|
1310
|
+
/* @__PURE__ */ Y(St, {}),
|
|
1311
|
+
s ? /* @__PURE__ */ Y(Zt.Provider, {
|
|
1287
1312
|
value: {
|
|
1288
|
-
paramsOpen:
|
|
1289
|
-
toggleParams: () =>
|
|
1313
|
+
paramsOpen: l,
|
|
1314
|
+
toggleParams: () => u((e) => !e)
|
|
1290
1315
|
},
|
|
1291
|
-
children: /* @__PURE__ */ Y(
|
|
1316
|
+
children: /* @__PURE__ */ Y(c.Provider, {
|
|
1292
1317
|
value: "md",
|
|
1293
|
-
children: /* @__PURE__ */ Y(
|
|
1318
|
+
children: /* @__PURE__ */ Y(Re, { registry: tn })
|
|
1294
1319
|
})
|
|
1295
|
-
}) : /* @__PURE__ */ Y(
|
|
1296
|
-
/* @__PURE__ */ Y(
|
|
1320
|
+
}) : /* @__PURE__ */ Y(Re, { registry: en }),
|
|
1321
|
+
/* @__PURE__ */ Y(Ut, {})
|
|
1297
1322
|
]
|
|
1298
1323
|
});
|
|
1299
1324
|
}
|
|
1300
|
-
var
|
|
1301
|
-
function
|
|
1325
|
+
var rn = "kol.editor.labs-draft";
|
|
1326
|
+
function an() {
|
|
1302
1327
|
return /* @__PURE__ */ Y(Ze, {
|
|
1303
|
-
draftKey:
|
|
1304
|
-
children: /* @__PURE__ */ Y(
|
|
1328
|
+
draftKey: rn,
|
|
1329
|
+
children: /* @__PURE__ */ Y(nn, {})
|
|
1305
1330
|
});
|
|
1306
1331
|
}
|
|
1307
1332
|
//#endregion
|
|
1308
1333
|
//#region src/editor/mobile/CategoryScreen.jsx
|
|
1309
|
-
var
|
|
1310
|
-
function
|
|
1334
|
+
var on = "w-full [&>span]:w-full [&>span]:justify-between";
|
|
1335
|
+
function sn(e) {
|
|
1311
1336
|
G(() => {
|
|
1312
1337
|
let t = (t) => {
|
|
1313
1338
|
t.key === "Escape" && e?.();
|
|
1314
1339
|
};
|
|
1315
1340
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
1316
1341
|
}, [e]), G(() => {
|
|
1317
|
-
let e =
|
|
1318
|
-
return
|
|
1319
|
-
e &&
|
|
1342
|
+
let e = t.isPlaying();
|
|
1343
|
+
return t.pause(), () => {
|
|
1344
|
+
e && t.play();
|
|
1320
1345
|
};
|
|
1321
1346
|
}, []);
|
|
1322
1347
|
}
|
|
1323
|
-
function
|
|
1324
|
-
return
|
|
1348
|
+
function cn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
|
|
1349
|
+
return sn(r ?? n), /* @__PURE__ */ Y("div", {
|
|
1325
1350
|
className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
|
|
1326
1351
|
style: { zIndex: "var(--kol-z-modal)" },
|
|
1327
1352
|
children: /* @__PURE__ */ X("div", {
|
|
@@ -1335,11 +1360,11 @@ function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
|
|
|
1335
1360
|
/* @__PURE__ */ Y("div", {
|
|
1336
1361
|
className: "flex flex-col gap-2",
|
|
1337
1362
|
children: F.map((t) => {
|
|
1338
|
-
let n =
|
|
1339
|
-
return /* @__PURE__ */ Y(
|
|
1363
|
+
let n = $[`gen:${t.label}`] ?? "square";
|
|
1364
|
+
return /* @__PURE__ */ Y(V, {
|
|
1340
1365
|
variant: "primary",
|
|
1341
1366
|
size: "lg",
|
|
1342
|
-
className:
|
|
1367
|
+
className: on,
|
|
1343
1368
|
iconLeft: n,
|
|
1344
1369
|
iconRight: n,
|
|
1345
1370
|
onClick: () => e(t),
|
|
@@ -1349,7 +1374,7 @@ function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
|
|
|
1349
1374
|
}),
|
|
1350
1375
|
/* @__PURE__ */ X("div", {
|
|
1351
1376
|
className: "flex flex-col gap-2",
|
|
1352
|
-
children: [t && /* @__PURE__ */ Y(
|
|
1377
|
+
children: [t && /* @__PURE__ */ Y(V, {
|
|
1353
1378
|
variant: "grey",
|
|
1354
1379
|
size: "lg",
|
|
1355
1380
|
className: "w-full [&>span]:w-full [&>span]:justify-between",
|
|
@@ -1357,7 +1382,7 @@ function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
|
|
|
1357
1382
|
iconRight: "image",
|
|
1358
1383
|
onClick: t,
|
|
1359
1384
|
children: "Insert image or video"
|
|
1360
|
-
}), n && /* @__PURE__ */ Y(
|
|
1385
|
+
}), n && /* @__PURE__ */ Y(V, {
|
|
1361
1386
|
variant: "grey",
|
|
1362
1387
|
size: "lg",
|
|
1363
1388
|
className: "w-full [&>span]:w-full [&>span]:justify-between",
|
|
@@ -1373,9 +1398,9 @@ function sn({ onPick: e, onInsert: t, onBack: n, onDismiss: r }) {
|
|
|
1373
1398
|
}
|
|
1374
1399
|
//#endregion
|
|
1375
1400
|
//#region src/editor/mobile/EffectScreen.jsx
|
|
1376
|
-
function
|
|
1401
|
+
function ln({ layer: e, chain: t, onPick: n, onBack: r }) {
|
|
1377
1402
|
let [i, a] = q(null);
|
|
1378
|
-
|
|
1403
|
+
sn(r);
|
|
1379
1404
|
let { engineHost: o } = se(e), s = o && !t.some((e) => e.def?.kind === "engine"), c = R(z.filter((e) => e.kind !== "engine" || s)), l = c.find((e) => e.id === i) ?? null;
|
|
1380
1405
|
return /* @__PURE__ */ Y("div", {
|
|
1381
1406
|
className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center overflow-y-auto p-6",
|
|
@@ -1390,20 +1415,20 @@ function cn({ layer: e, chain: t, onPick: n, onBack: r }) {
|
|
|
1390
1415
|
}),
|
|
1391
1416
|
/* @__PURE__ */ Y("div", {
|
|
1392
1417
|
className: "flex flex-col gap-2",
|
|
1393
|
-
children: (l ? l.filters : c).map((e) => /* @__PURE__ */ Y(
|
|
1418
|
+
children: (l ? l.filters : c).map((e) => /* @__PURE__ */ Y(V, {
|
|
1394
1419
|
variant: "primary",
|
|
1395
1420
|
size: "lg",
|
|
1396
|
-
className:
|
|
1421
|
+
className: on,
|
|
1397
1422
|
iconLeft: l ? "filter" : "chevron-right",
|
|
1398
1423
|
iconRight: l ? "filter" : "chevron-right",
|
|
1399
1424
|
onClick: () => l ? n(e.id) : a(e.id),
|
|
1400
1425
|
children: e.label
|
|
1401
1426
|
}, e.id))
|
|
1402
1427
|
}),
|
|
1403
|
-
/* @__PURE__ */ Y(
|
|
1428
|
+
/* @__PURE__ */ Y(V, {
|
|
1404
1429
|
variant: "grey",
|
|
1405
1430
|
size: "lg",
|
|
1406
|
-
className:
|
|
1431
|
+
className: on,
|
|
1407
1432
|
iconLeft: "arrow-left",
|
|
1408
1433
|
iconRight: "arrow-left",
|
|
1409
1434
|
onClick: () => l ? a(null) : r(),
|
|
@@ -1415,7 +1440,7 @@ function cn({ layer: e, chain: t, onPick: n, onBack: r }) {
|
|
|
1415
1440
|
}
|
|
1416
1441
|
//#endregion
|
|
1417
1442
|
//#region src/editor/mobile/MobileOverlay.jsx
|
|
1418
|
-
var
|
|
1443
|
+
var un = { background: "var(--kol-surface-primary)" }, dn = [
|
|
1419
1444
|
{
|
|
1420
1445
|
value: "generate",
|
|
1421
1446
|
label: "Generate"
|
|
@@ -1432,26 +1457,27 @@ var ln = { background: "var(--kol-surface-primary)" }, un = [
|
|
|
1432
1457
|
value: "output",
|
|
1433
1458
|
label: "Output"
|
|
1434
1459
|
}
|
|
1435
|
-
],
|
|
1436
|
-
function
|
|
1460
|
+
], fn = dn.filter((e) => e.value !== "generate"), pn = "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-1 [&_.kol-seg-cell]:overflow-hidden [@media(hover:none)]:[&_.kol-seg-cell:hover]:text-[var(--kol-oq-48)]", mn = 9.6, hn = 10;
|
|
1461
|
+
function gn(e) {
|
|
1437
1462
|
let t = Math.min(window.innerWidth, 480) - 24, n = [], r = [], i = 0;
|
|
1438
1463
|
for (let a of e) {
|
|
1439
|
-
let e = a.label.length *
|
|
1464
|
+
let e = a.label.length * mn + hn, o = Math.max(i, e);
|
|
1440
1465
|
r.length && (r.length + 1) * o > t ? (n.push(r), r = [a], i = e) : (r.push(a), i = o);
|
|
1441
1466
|
}
|
|
1442
1467
|
return r.length && n.push(r), n;
|
|
1443
1468
|
}
|
|
1444
|
-
function
|
|
1445
|
-
return
|
|
1469
|
+
function _n({ cells: e }) {
|
|
1470
|
+
return gn(e).map((e, t) => /* @__PURE__ */ Y(U, {
|
|
1471
|
+
variant: "filled",
|
|
1446
1472
|
value: null,
|
|
1447
1473
|
onChange: (t) => e.find((e) => e.value === t)?.run(),
|
|
1448
1474
|
options: e,
|
|
1449
1475
|
size: "lg",
|
|
1450
1476
|
ariaLabel: "Randomize scope",
|
|
1451
|
-
className:
|
|
1477
|
+
className: pn
|
|
1452
1478
|
}, t));
|
|
1453
1479
|
}
|
|
1454
|
-
var
|
|
1480
|
+
var vn = [
|
|
1455
1481
|
2,
|
|
1456
1482
|
4,
|
|
1457
1483
|
8,
|
|
@@ -1460,17 +1486,18 @@ var _n = [
|
|
|
1460
1486
|
value: String(e),
|
|
1461
1487
|
label: `${e}s`
|
|
1462
1488
|
}));
|
|
1463
|
-
function
|
|
1464
|
-
let { loopSeconds:
|
|
1465
|
-
return /* @__PURE__ */ Y(
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1489
|
+
function yn() {
|
|
1490
|
+
let { loopSeconds: e, setLoopSeconds: t } = n();
|
|
1491
|
+
return /* @__PURE__ */ Y(U, {
|
|
1492
|
+
variant: "filled",
|
|
1493
|
+
value: String(e),
|
|
1494
|
+
onChange: (e) => t(Number(e)),
|
|
1495
|
+
options: vn,
|
|
1469
1496
|
size: "lg",
|
|
1470
1497
|
ariaLabel: "Loop length"
|
|
1471
1498
|
});
|
|
1472
1499
|
}
|
|
1473
|
-
var
|
|
1500
|
+
var bn = [
|
|
1474
1501
|
{
|
|
1475
1502
|
value: "9:16",
|
|
1476
1503
|
label: "9:16"
|
|
@@ -1487,7 +1514,7 @@ var yn = [
|
|
|
1487
1514
|
value: "1:1",
|
|
1488
1515
|
label: "1:1"
|
|
1489
1516
|
}
|
|
1490
|
-
],
|
|
1517
|
+
], xn = [
|
|
1491
1518
|
{
|
|
1492
1519
|
value: "5:4",
|
|
1493
1520
|
label: "5:4"
|
|
@@ -1505,95 +1532,96 @@ var yn = [
|
|
|
1505
1532
|
label: "Fill"
|
|
1506
1533
|
}
|
|
1507
1534
|
];
|
|
1508
|
-
function
|
|
1509
|
-
let { updateLayer:
|
|
1535
|
+
function Sn({ layer: e, onSwitchCategory: n, onInsert: i, onRestart: o, aspectValue: c, onAspect: d }) {
|
|
1536
|
+
let { updateLayer: p, addFilter: g, removeFilter: v } = f(), { onExportPng: y } = Ee(), [b, x] = q(!1), [S, C] = q(!0), [w, T] = q(!1), [E, D] = q(!1), [A, j] = q("generate"), M = l(e);
|
|
1510
1537
|
if (!e) return null;
|
|
1511
|
-
if (
|
|
1538
|
+
if (b) return /* @__PURE__ */ Y("button", {
|
|
1512
1539
|
"aria-label": "Show controls",
|
|
1513
1540
|
className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] z-20",
|
|
1514
|
-
onClick: () =>
|
|
1541
|
+
onClick: () => x(!1)
|
|
1515
1542
|
});
|
|
1516
|
-
let N = e.type === "loop", P = N ? `${O(e.loopGroup).label} · ${e.presetLabel}` : "Media", F = N ? k(e.loopId)?.params ?? [] : [], I = N ?
|
|
1517
|
-
let t =
|
|
1518
|
-
t &&
|
|
1519
|
-
}, R =
|
|
1520
|
-
let t =
|
|
1521
|
-
t &&
|
|
1543
|
+
let N = e.type === "loop", P = N ? `${O(e.loopGroup).label} · ${e.presetLabel}` : "Media", F = N ? k(e.loopId)?.params ?? [] : [], I = N ? h(F, e) : [], L = () => p(e.id, s(e, m(F, e), M.take(), { withFilters: !0 })), ee = (t) => p(e.id, s(e, t.params, M.take(), { stripNoRandom: !!t.motion })), te = () => {
|
|
1544
|
+
let t = u(e, M.take());
|
|
1545
|
+
t && p(e.id, t);
|
|
1546
|
+
}, R = r(e), { effectable: ne } = se(e), z = () => {
|
|
1547
|
+
let t = _(e, M.take());
|
|
1548
|
+
t && p(e.id, { filters: t });
|
|
1522
1549
|
};
|
|
1523
|
-
if (!
|
|
1550
|
+
if (!S) return /* @__PURE__ */ X("div", {
|
|
1524
1551
|
className: "fixed bottom-[max(0.75rem,env(safe-area-inset-bottom))] left-[var(--fxr-rail,0px)] z-10 flex gap-2 px-3",
|
|
1525
1552
|
children: [
|
|
1526
|
-
/* @__PURE__ */ Y(
|
|
1553
|
+
/* @__PURE__ */ Y(V, {
|
|
1527
1554
|
variant: "primary",
|
|
1528
1555
|
size: "lg",
|
|
1529
|
-
onClick: () =>
|
|
1556
|
+
onClick: () => C(!0),
|
|
1530
1557
|
children: /* @__PURE__ */ X("span", {
|
|
1531
1558
|
className: "flex items-center gap-2",
|
|
1532
|
-
children: [N ? e.presetLabel : "Media", /* @__PURE__ */ Y(
|
|
1559
|
+
children: [N ? e.presetLabel : "Media", /* @__PURE__ */ Y(Z, {
|
|
1533
1560
|
name: "chevron-down",
|
|
1534
1561
|
size: 16,
|
|
1535
1562
|
className: "rotate-180"
|
|
1536
1563
|
})]
|
|
1537
1564
|
})
|
|
1538
1565
|
}),
|
|
1539
|
-
(N || R.length > 0) && /* @__PURE__ */ Y(
|
|
1566
|
+
(N || R.length > 0) && /* @__PURE__ */ Y(V, {
|
|
1540
1567
|
variant: "primary",
|
|
1541
1568
|
size: "lg",
|
|
1542
1569
|
onClick: L,
|
|
1543
1570
|
children: "Randomize all"
|
|
1544
1571
|
}),
|
|
1545
|
-
/* @__PURE__ */ Y(
|
|
1572
|
+
/* @__PURE__ */ Y(V, {
|
|
1546
1573
|
variant: "primary",
|
|
1547
1574
|
size: "lg",
|
|
1548
|
-
onClick: () =>
|
|
1575
|
+
onClick: () => y(2),
|
|
1549
1576
|
children: "Download"
|
|
1550
1577
|
})
|
|
1551
1578
|
]
|
|
1552
1579
|
});
|
|
1553
|
-
let re = (N ?
|
|
1580
|
+
let re = (N ? dn : fn).filter((e) => (e.value !== "effects" || ne) && (e.value !== "transport" || a("motion"))), B = re.some((e) => e.value === A) ? A : re[0].value;
|
|
1554
1581
|
return /* @__PURE__ */ X(J, { children: [
|
|
1555
|
-
w && /* @__PURE__ */ Y(
|
|
1582
|
+
w && /* @__PURE__ */ Y(cn, {
|
|
1556
1583
|
onPick: (e) => {
|
|
1557
|
-
|
|
1584
|
+
n(e), T(!1);
|
|
1558
1585
|
},
|
|
1559
1586
|
onInsert: () => {
|
|
1560
|
-
T(!1),
|
|
1587
|
+
T(!1), i();
|
|
1561
1588
|
},
|
|
1562
1589
|
onBack: () => {
|
|
1563
|
-
T(!1),
|
|
1590
|
+
T(!1), o();
|
|
1564
1591
|
},
|
|
1565
1592
|
onDismiss: () => T(!1)
|
|
1566
1593
|
}),
|
|
1567
|
-
E && /* @__PURE__ */ Y(
|
|
1594
|
+
E && /* @__PURE__ */ Y(ln, {
|
|
1568
1595
|
layer: e,
|
|
1569
1596
|
chain: R,
|
|
1570
1597
|
onPick: (t) => {
|
|
1571
|
-
|
|
1598
|
+
g(e.id, t), D(!1);
|
|
1572
1599
|
},
|
|
1573
1600
|
onBack: () => D(!1)
|
|
1574
1601
|
}),
|
|
1575
1602
|
/* @__PURE__ */ X("div", {
|
|
1576
1603
|
className: "fixed right-0 left-[var(--fxr-rail,0px)] bottom-0 z-10 pb-[env(safe-area-inset-bottom)]",
|
|
1577
|
-
style:
|
|
1604
|
+
style: un,
|
|
1578
1605
|
children: [/* @__PURE__ */ X("div", {
|
|
1579
1606
|
className: "flex w-full items-center px-3",
|
|
1580
1607
|
children: [/* @__PURE__ */ X("button", {
|
|
1581
1608
|
className: "kol-helper-12 text-meta flex flex-1 items-center gap-2 py-2.5",
|
|
1582
|
-
onClick: () =>
|
|
1583
|
-
children: [/* @__PURE__ */ Y("span", { children: P }), /* @__PURE__ */ Y(
|
|
1609
|
+
onClick: () => C(!1),
|
|
1610
|
+
children: [/* @__PURE__ */ Y("span", { children: P }), /* @__PURE__ */ Y(Z, {
|
|
1584
1611
|
name: "chevron-down",
|
|
1585
1612
|
size: 16,
|
|
1586
1613
|
className: "text-oq-48"
|
|
1587
1614
|
})]
|
|
1588
1615
|
}), /* @__PURE__ */ Y("button", {
|
|
1589
1616
|
className: "kol-helper-12 text-meta py-2.5",
|
|
1590
|
-
onClick:
|
|
1617
|
+
onClick: o,
|
|
1591
1618
|
children: "Start over"
|
|
1592
1619
|
})]
|
|
1593
1620
|
}), /* @__PURE__ */ X("div", {
|
|
1594
1621
|
className: "px-3 pb-3",
|
|
1595
1622
|
children: [
|
|
1596
|
-
/* @__PURE__ */ Y(
|
|
1623
|
+
/* @__PURE__ */ Y(U, {
|
|
1624
|
+
variant: "filled",
|
|
1597
1625
|
value: B,
|
|
1598
1626
|
onChange: j,
|
|
1599
1627
|
options: re,
|
|
@@ -1605,35 +1633,34 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
|
|
|
1605
1633
|
children: [
|
|
1606
1634
|
/* @__PURE__ */ X("div", {
|
|
1607
1635
|
className: "grid grid-cols-2 gap-2",
|
|
1608
|
-
children: [/* @__PURE__ */ Y(
|
|
1609
|
-
iconComponent: v,
|
|
1636
|
+
children: [/* @__PURE__ */ Y(V, {
|
|
1610
1637
|
variant: "primary",
|
|
1611
1638
|
size: "lg",
|
|
1612
1639
|
iconRight: "refresh",
|
|
1613
1640
|
onClick: te,
|
|
1614
1641
|
children: "Preset"
|
|
1615
|
-
}), /* @__PURE__ */ Y(
|
|
1642
|
+
}), /* @__PURE__ */ Y(V, {
|
|
1616
1643
|
variant: "primary",
|
|
1617
1644
|
size: "lg",
|
|
1618
1645
|
onClick: () => T(!0),
|
|
1619
1646
|
children: "Generator"
|
|
1620
1647
|
})]
|
|
1621
1648
|
}),
|
|
1622
|
-
/* @__PURE__ */ Y(
|
|
1649
|
+
/* @__PURE__ */ Y(V, {
|
|
1623
1650
|
variant: "primary",
|
|
1624
1651
|
size: "lg",
|
|
1625
1652
|
className: "w-full",
|
|
1626
1653
|
onClick: L,
|
|
1627
1654
|
children: "Randomize all"
|
|
1628
1655
|
}),
|
|
1629
|
-
I.length > 0 && /* @__PURE__ */ Y(
|
|
1656
|
+
I.length > 0 && /* @__PURE__ */ Y(_n, { cells: [...I.map((e) => ({
|
|
1630
1657
|
value: e.id,
|
|
1631
1658
|
label: e.label,
|
|
1632
1659
|
run: () => ee(e)
|
|
1633
1660
|
})), {
|
|
1634
1661
|
value: "__retrigger",
|
|
1635
1662
|
label: "Re-trigger",
|
|
1636
|
-
run: () =>
|
|
1663
|
+
run: () => t.rewind()
|
|
1637
1664
|
}] })
|
|
1638
1665
|
]
|
|
1639
1666
|
}),
|
|
@@ -1641,12 +1668,12 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
|
|
|
1641
1668
|
className: "flex flex-col gap-2 pt-3",
|
|
1642
1669
|
children: [/* @__PURE__ */ X("div", {
|
|
1643
1670
|
className: "grid grid-cols-2 gap-2",
|
|
1644
|
-
children: [/* @__PURE__ */ Y(
|
|
1671
|
+
children: [/* @__PURE__ */ Y(V, {
|
|
1645
1672
|
variant: "primary",
|
|
1646
1673
|
size: "lg",
|
|
1647
1674
|
onClick: () => D(!0),
|
|
1648
1675
|
children: "Add effect"
|
|
1649
|
-
}), /* @__PURE__ */ Y(
|
|
1676
|
+
}), /* @__PURE__ */ Y(V, {
|
|
1650
1677
|
variant: "primary",
|
|
1651
1678
|
size: "lg",
|
|
1652
1679
|
disabled: !R.length,
|
|
@@ -1658,9 +1685,9 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
|
|
|
1658
1685
|
...e,
|
|
1659
1686
|
...t.params,
|
|
1660
1687
|
id: e.id
|
|
1661
|
-
}, i = t.def ?
|
|
1662
|
-
let i =
|
|
1663
|
-
|
|
1688
|
+
}, i = t.def ? h(t.def.params, r) : [], a = (t) => {
|
|
1689
|
+
let i = s(r, t.params, M.take(), { stripNoRandom: !!t.motion }), a = R.map(({ def: e, ...t }) => t);
|
|
1690
|
+
p(e.id, { filters: a.map((e, t) => t === n ? {
|
|
1664
1691
|
...e,
|
|
1665
1692
|
params: {
|
|
1666
1693
|
...e.params,
|
|
@@ -1670,15 +1697,15 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
|
|
|
1670
1697
|
};
|
|
1671
1698
|
return /* @__PURE__ */ X("div", {
|
|
1672
1699
|
className: "flex flex-col gap-2",
|
|
1673
|
-
children: [/* @__PURE__ */ Y(
|
|
1700
|
+
children: [/* @__PURE__ */ Y(V, {
|
|
1674
1701
|
variant: "grey",
|
|
1675
1702
|
size: "lg",
|
|
1676
1703
|
className: "w-full [&>span]:w-full [&>span]:justify-between",
|
|
1677
1704
|
iconLeft: "trash",
|
|
1678
1705
|
iconRight: "trash",
|
|
1679
|
-
onClick: () =>
|
|
1706
|
+
onClick: () => v(e.id, n),
|
|
1680
1707
|
children: `${n + 1}. ${t.def?.label ?? t.id}`
|
|
1681
|
-
}), i.length > 0 && /* @__PURE__ */ Y(
|
|
1708
|
+
}), i.length > 0 && /* @__PURE__ */ Y(_n, { cells: i.map((e) => ({
|
|
1682
1709
|
value: e.id,
|
|
1683
1710
|
label: e.label,
|
|
1684
1711
|
run: () => a(e)
|
|
@@ -1686,46 +1713,51 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
|
|
|
1686
1713
|
}, t.key);
|
|
1687
1714
|
})]
|
|
1688
1715
|
}),
|
|
1689
|
-
B === "transport" && /* @__PURE__ */ X("div", {
|
|
1716
|
+
B === "transport" && a("motion") && /* @__PURE__ */ X("div", {
|
|
1690
1717
|
className: "flex flex-col gap-2 pt-3",
|
|
1691
|
-
children: [
|
|
1718
|
+
children: [(() => {
|
|
1719
|
+
let e = a("motion").TransportBar;
|
|
1720
|
+
return /* @__PURE__ */ Y(e, { size: "lg" });
|
|
1721
|
+
})(), /* @__PURE__ */ Y(yn, {})]
|
|
1692
1722
|
}),
|
|
1693
1723
|
B === "output" && /* @__PURE__ */ X("div", {
|
|
1694
1724
|
className: "flex flex-col gap-2 pt-3",
|
|
1695
1725
|
children: [
|
|
1696
|
-
/* @__PURE__ */ Y(
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1726
|
+
/* @__PURE__ */ Y(U, {
|
|
1727
|
+
variant: "filled",
|
|
1728
|
+
value: c,
|
|
1729
|
+
onChange: d,
|
|
1730
|
+
options: bn,
|
|
1700
1731
|
size: "lg",
|
|
1701
1732
|
ariaLabel: "Aspect"
|
|
1702
1733
|
}),
|
|
1703
|
-
/* @__PURE__ */ Y(
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1734
|
+
/* @__PURE__ */ Y(U, {
|
|
1735
|
+
variant: "filled",
|
|
1736
|
+
value: c,
|
|
1737
|
+
onChange: d,
|
|
1738
|
+
options: xn,
|
|
1707
1739
|
size: "lg",
|
|
1708
1740
|
ariaLabel: "Aspect (landscape) and fill"
|
|
1709
1741
|
}),
|
|
1710
1742
|
/* @__PURE__ */ X("div", {
|
|
1711
1743
|
className: "grid grid-cols-3 gap-2",
|
|
1712
1744
|
children: [
|
|
1713
|
-
/* @__PURE__ */ Y(
|
|
1745
|
+
/* @__PURE__ */ Y(V, {
|
|
1714
1746
|
variant: "primary",
|
|
1715
1747
|
size: "lg",
|
|
1716
|
-
onClick: () =>
|
|
1748
|
+
onClick: () => y(2),
|
|
1717
1749
|
children: "Download"
|
|
1718
1750
|
}),
|
|
1719
|
-
/* @__PURE__ */ Y(
|
|
1751
|
+
/* @__PURE__ */ Y(V, {
|
|
1720
1752
|
variant: "primary",
|
|
1721
1753
|
size: "lg",
|
|
1722
|
-
onClick: () =>
|
|
1754
|
+
onClick: () => x(!0),
|
|
1723
1755
|
children: "Hide UI"
|
|
1724
1756
|
}),
|
|
1725
|
-
/* @__PURE__ */ Y(
|
|
1757
|
+
/* @__PURE__ */ Y(V, {
|
|
1726
1758
|
variant: "primary",
|
|
1727
1759
|
size: "lg",
|
|
1728
|
-
onClick:
|
|
1760
|
+
onClick: o,
|
|
1729
1761
|
children: "Start over"
|
|
1730
1762
|
})
|
|
1731
1763
|
]
|
|
@@ -1739,7 +1771,7 @@ function xn({ layer: e, onSwitchCategory: t, onInsert: r, onRestart: a, aspectVa
|
|
|
1739
1771
|
}
|
|
1740
1772
|
//#endregion
|
|
1741
1773
|
//#region src/editor/mobile/MobileView.jsx
|
|
1742
|
-
function
|
|
1774
|
+
function Cn({ onGenerate: e }) {
|
|
1743
1775
|
return /* @__PURE__ */ Y("div", {
|
|
1744
1776
|
className: "fixed inset-y-0 right-0 left-[var(--fxr-rail,0px)] kol-overlay-scrim flex flex-col items-center justify-center p-6",
|
|
1745
1777
|
style: { zIndex: "var(--kol-z-modal)" },
|
|
@@ -1758,74 +1790,74 @@ function Sn({ onGenerate: e }) {
|
|
|
1758
1790
|
}), /* @__PURE__ */ X("div", {
|
|
1759
1791
|
className: "flex flex-col gap-2",
|
|
1760
1792
|
children: [
|
|
1761
|
-
/* @__PURE__ */ Y(
|
|
1793
|
+
/* @__PURE__ */ Y(V, {
|
|
1762
1794
|
variant: "primary",
|
|
1763
1795
|
size: "lg",
|
|
1764
|
-
className:
|
|
1765
|
-
iconLeft:
|
|
1766
|
-
iconRight:
|
|
1796
|
+
className: on,
|
|
1797
|
+
iconLeft: _t.randomiser,
|
|
1798
|
+
iconRight: _t.randomiser,
|
|
1767
1799
|
onClick: e,
|
|
1768
1800
|
children: "Generate"
|
|
1769
1801
|
}),
|
|
1770
|
-
We() && /* @__PURE__ */ Y(
|
|
1802
|
+
We() && /* @__PURE__ */ Y(V, {
|
|
1771
1803
|
variant: "primary",
|
|
1772
1804
|
size: "lg",
|
|
1773
1805
|
className: "w-full [&>span]:w-full [&>span]:justify-between",
|
|
1774
|
-
iconLeft:
|
|
1775
|
-
iconRight:
|
|
1806
|
+
iconLeft: _t.editor,
|
|
1807
|
+
iconRight: _t.editor,
|
|
1776
1808
|
onClick: Ye,
|
|
1777
|
-
children:
|
|
1809
|
+
children: Me("editor").label
|
|
1778
1810
|
}),
|
|
1779
|
-
/* @__PURE__ */ Y(
|
|
1811
|
+
/* @__PURE__ */ Y(V, {
|
|
1780
1812
|
variant: "primary",
|
|
1781
1813
|
size: "lg",
|
|
1782
|
-
className:
|
|
1783
|
-
iconLeft:
|
|
1784
|
-
iconRight:
|
|
1785
|
-
onClick:
|
|
1786
|
-
children:
|
|
1814
|
+
className: on,
|
|
1815
|
+
iconLeft: _t.labs,
|
|
1816
|
+
iconRight: _t.labs,
|
|
1817
|
+
onClick: rt,
|
|
1818
|
+
children: Me("labs").label
|
|
1787
1819
|
})
|
|
1788
1820
|
]
|
|
1789
1821
|
})]
|
|
1790
1822
|
})
|
|
1791
1823
|
});
|
|
1792
1824
|
}
|
|
1793
|
-
function
|
|
1794
|
-
let { layers: e, addLayer:
|
|
1825
|
+
function wn() {
|
|
1826
|
+
let { layers: e, addLayer: n, removeLayer: r, updateLayer: i, canvasW: a, canvasH: o, aspect: s, setAspect: c } = f(), { setTool: l } = Se(), u = () => Qe() && !Xe() ? "entry" : "category", [d, p] = q(u), [m, h] = q(null), [g, _] = q("contain"), [v, y] = q(1), b = K({
|
|
1795
1827
|
pts: /* @__PURE__ */ new Map(),
|
|
1796
1828
|
startDist: 0,
|
|
1797
1829
|
startScale: 1
|
|
1798
|
-
}),
|
|
1799
|
-
let [e, t] = [...
|
|
1830
|
+
}), C = K(null), w = () => {
|
|
1831
|
+
let [e, t] = [...b.current.pts.values()];
|
|
1800
1832
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
1801
1833
|
}, T = (e) => {
|
|
1802
|
-
|
|
1834
|
+
b.current.pts.set(e.pointerId, {
|
|
1803
1835
|
x: e.clientX,
|
|
1804
1836
|
y: e.clientY
|
|
1805
|
-
}),
|
|
1837
|
+
}), C.current = b.current.pts.size === 1 ? {
|
|
1806
1838
|
id: e.pointerId,
|
|
1807
1839
|
x: e.clientX,
|
|
1808
1840
|
y: e.clientY,
|
|
1809
1841
|
t: performance.now()
|
|
1810
|
-
} : null,
|
|
1842
|
+
} : null, b.current.pts.size === 2 && (b.current.startDist = w(), b.current.startScale = v, t.setStagePointer(null), e.stopPropagation());
|
|
1811
1843
|
}, E = (e) => {
|
|
1812
|
-
let t =
|
|
1844
|
+
let t = b.current;
|
|
1813
1845
|
t.pts.has(e.pointerId) && (t.pts.set(e.pointerId, {
|
|
1814
1846
|
x: e.clientX,
|
|
1815
1847
|
y: e.clientY
|
|
1816
|
-
}), t.pts.size >= 2 && t.startDist > 0 && (e.stopPropagation(),
|
|
1848
|
+
}), t.pts.size >= 2 && t.startDist > 0 && (e.stopPropagation(), y(Math.min(3, Math.max(.5, t.startScale * (w() / t.startDist))))));
|
|
1817
1849
|
}, D = (e) => {
|
|
1818
|
-
let
|
|
1819
|
-
if (
|
|
1850
|
+
let n = C.current;
|
|
1851
|
+
if (n && n.id === e.pointerId && e.type === "pointerup" && d === "live" && performance.now() - n.t < 350 && Math.hypot(e.clientX - n.x, e.clientY - n.y) < 12 && O?.type === "loop") {
|
|
1820
1852
|
let e = k(O.loopId);
|
|
1821
|
-
e && e.group !== "penrose" && e.kind !== "engine" && !A(e) &&
|
|
1853
|
+
e && e.group !== "penrose" && e.kind !== "engine" && !A(e) && t.rewind();
|
|
1822
1854
|
}
|
|
1823
|
-
|
|
1855
|
+
n?.id === e.pointerId && (C.current = null), b.current.pts.delete(e.pointerId), b.current.pts.size < 2 && (b.current.startDist = 0);
|
|
1824
1856
|
};
|
|
1825
1857
|
ht(), G(() => {
|
|
1826
|
-
|
|
1858
|
+
c("4:5"), l("orbit");
|
|
1827
1859
|
}, []);
|
|
1828
|
-
let O = e.find((e) => e.id ===
|
|
1860
|
+
let O = e.find((e) => e.id === m) ?? (e.length === 1 ? e[0] : null), j = d === "live" && O?.type === "photo" && !O.src && O.srcType !== "webcam";
|
|
1829
1861
|
G(() => {
|
|
1830
1862
|
if (!j) return;
|
|
1831
1863
|
let e = (e) => {
|
|
@@ -1834,69 +1866,69 @@ function Cn() {
|
|
|
1834
1866
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
1835
1867
|
}), G(() => {
|
|
1836
1868
|
if (!j) return;
|
|
1837
|
-
let e =
|
|
1838
|
-
return
|
|
1839
|
-
e &&
|
|
1869
|
+
let e = t.isPlaying();
|
|
1870
|
+
return t.pause(), () => {
|
|
1871
|
+
e && t.play();
|
|
1840
1872
|
};
|
|
1841
1873
|
}, [j]);
|
|
1842
1874
|
let N = (e) => {
|
|
1843
|
-
let
|
|
1844
|
-
|
|
1875
|
+
let r = M(e);
|
|
1876
|
+
r && (h(n("loop", r)), t.play(), p("live"));
|
|
1845
1877
|
}, P = (e) => {
|
|
1846
1878
|
let t = M(e);
|
|
1847
|
-
t &&
|
|
1879
|
+
t && m && i(m, t);
|
|
1848
1880
|
}, F = () => {
|
|
1849
|
-
|
|
1881
|
+
h(n("photo", {
|
|
1850
1882
|
fit: "cover",
|
|
1851
1883
|
x: 0,
|
|
1852
1884
|
y: 0,
|
|
1853
|
-
w:
|
|
1854
|
-
h: Math.round(
|
|
1855
|
-
})),
|
|
1885
|
+
w: x,
|
|
1886
|
+
h: Math.round(x * o / a)
|
|
1887
|
+
})), t.play(), p("live");
|
|
1856
1888
|
}, I = (e) => {
|
|
1857
1889
|
if (e === "fill") {
|
|
1858
|
-
|
|
1890
|
+
_("cover");
|
|
1859
1891
|
return;
|
|
1860
1892
|
}
|
|
1861
|
-
|
|
1862
|
-
let t =
|
|
1863
|
-
|
|
1893
|
+
_("contain"), c(e);
|
|
1894
|
+
let t = S[e];
|
|
1895
|
+
m && t && i(m, {
|
|
1864
1896
|
x: 0,
|
|
1865
1897
|
y: 0,
|
|
1866
|
-
w:
|
|
1867
|
-
h: Math.round(
|
|
1898
|
+
w: x,
|
|
1899
|
+
h: Math.round(x * t.h / t.w)
|
|
1868
1900
|
});
|
|
1869
1901
|
}, L = () => {
|
|
1870
|
-
for (let t of [...e])
|
|
1871
|
-
|
|
1902
|
+
for (let t of [...e]) r(t.id);
|
|
1903
|
+
h(null), y(1), p(u());
|
|
1872
1904
|
};
|
|
1873
1905
|
return /* @__PURE__ */ X("div", {
|
|
1874
1906
|
className: "relative h-dvh bg-black",
|
|
1875
1907
|
children: [
|
|
1876
1908
|
/* @__PURE__ */ Y("div", {
|
|
1877
1909
|
className: "absolute inset-0 touch-none",
|
|
1878
|
-
style: { transform: `scale(${
|
|
1910
|
+
style: { transform: `scale(${v})` },
|
|
1879
1911
|
onPointerDownCapture: T,
|
|
1880
1912
|
onPointerMoveCapture: E,
|
|
1881
1913
|
onPointerUpCapture: D,
|
|
1882
1914
|
onPointerCancelCapture: D,
|
|
1883
1915
|
onPointerLeave: D,
|
|
1884
|
-
children: /* @__PURE__ */ Y(Be, { fit:
|
|
1916
|
+
children: /* @__PURE__ */ Y(Be, { fit: g })
|
|
1885
1917
|
}),
|
|
1886
|
-
|
|
1887
|
-
|
|
1918
|
+
d === "entry" && /* @__PURE__ */ Y(Cn, { onGenerate: () => p("category") }),
|
|
1919
|
+
d === "category" && /* @__PURE__ */ Y(cn, {
|
|
1888
1920
|
onPick: N,
|
|
1889
1921
|
onInsert: F,
|
|
1890
|
-
onBack:
|
|
1922
|
+
onBack: u() === "entry" ? () => p("entry") : void 0
|
|
1891
1923
|
}),
|
|
1892
|
-
|
|
1924
|
+
d === "live" && /* @__PURE__ */ Y(Sn, {
|
|
1893
1925
|
layer: O,
|
|
1894
1926
|
onSwitchCategory: P,
|
|
1895
1927
|
onInsert: () => {
|
|
1896
1928
|
L(), F();
|
|
1897
1929
|
},
|
|
1898
1930
|
onRestart: L,
|
|
1899
|
-
aspectValue:
|
|
1931
|
+
aspectValue: g === "cover" ? "fill" : s,
|
|
1900
1932
|
onAspect: I
|
|
1901
1933
|
}),
|
|
1902
1934
|
j && /* @__PURE__ */ X("div", {
|
|
@@ -1904,10 +1936,10 @@ function Cn() {
|
|
|
1904
1936
|
style: { zIndex: "var(--kol-z-modal)" },
|
|
1905
1937
|
children: [/* @__PURE__ */ Y("div", {
|
|
1906
1938
|
className: "flex-1 min-h-0",
|
|
1907
|
-
children: /* @__PURE__ */ Y(
|
|
1939
|
+
children: /* @__PURE__ */ Y(Dt, { layer: O })
|
|
1908
1940
|
}), /* @__PURE__ */ Y("div", {
|
|
1909
1941
|
className: "flex justify-center pb-[max(0.75rem,env(safe-area-inset-bottom))]",
|
|
1910
|
-
children: /* @__PURE__ */ Y(
|
|
1942
|
+
children: /* @__PURE__ */ Y(V, {
|
|
1911
1943
|
variant: "outline",
|
|
1912
1944
|
size: "lg",
|
|
1913
1945
|
onClick: L,
|
|
@@ -1918,11 +1950,11 @@ function Cn() {
|
|
|
1918
1950
|
]
|
|
1919
1951
|
});
|
|
1920
1952
|
}
|
|
1921
|
-
function
|
|
1953
|
+
function Tn() {
|
|
1922
1954
|
return /* @__PURE__ */ Y(Ze, {
|
|
1923
1955
|
persistDraft: !1,
|
|
1924
|
-
children: /* @__PURE__ */ Y(
|
|
1956
|
+
children: /* @__PURE__ */ Y(wn, {})
|
|
1925
1957
|
});
|
|
1926
1958
|
}
|
|
1927
1959
|
//#endregion
|
|
1928
|
-
export {
|
|
1960
|
+
export { Ke as AppSettingsSections, Ae as BRAND, et as DesignEditor, et as default, ge as DisplaySettingsDrawer, Ze as EditorProviders, we as FilesDialog, Ce as GeneratorLibraryProvider, rn as LABS_DRAFT_KEY, Ne as LIBRARY_SLOT_KEYS, an as LabsView, it as MODES, Tn as MobileView, tt as OutputCanvas, Be as OutputStage, Ve as OutputView, $e as RAIL_EXTRA_PREFIX, je as VIEW_PATHS, De as closeFiles, _e as comboLabel, ve as currentView, Qe as isMobileDevice, ke as openFiles, o as registerPack, be as setMode, ye as setNavigator, ze as setRailExtras, Le as setWantsDesktop, Pe as shortcutsBySection, xe as useFilesDialog, Fe as useGeneratorLibrary, qe as useRailExtras, Ge as useSettingsSections, Xe as wantsDesktop, Oe as withView };
|