@kolkrabbi/design-editor 0.45.1 → 0.47.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 (50) hide show
  1. package/dist/{BindDot-DqLgF_zQ.js → BindDot-B85UV79g.js} +9 -8
  2. package/dist/{BufferResource-BfLgK37S.js → BufferResource-Di5teicy.js} +2 -2
  3. package/dist/{CanvasPool-YNSF8hsR.js → CanvasPool-JdLj49b-.js} +1 -1
  4. package/dist/CanvasRenderer-fXDObOOi.js +2 -0
  5. package/dist/{FederatedEventTarget-BJgROaRQ.js → FederatedEventTarget-CH0bzxx1.js} +1 -1
  6. package/dist/{FilterSystem-BUrPNXx-.js → FilterSystem-C-ZoyuTO.js} +3 -3
  7. package/dist/{Geometry-C5s5KpWq.js → Geometry-D4tiuMOr.js} +1 -1
  8. package/dist/KolboxView-n6kEPJtV.js +21615 -0
  9. package/dist/{RenderTargetSystem-oFwWv5IW.js → RenderTargetSystem-Bom_vhlS.js} +1 -1
  10. package/dist/{Timeline-Boo1VuFe.js → Timeline-EbecYeGh.js} +49 -47
  11. package/dist/TreePicker-2RUSyGl4.js +209 -0
  12. package/dist/WebGLRenderer-4hvrGmfW.js +2 -0
  13. package/dist/WebGPURenderer-BjzMV7Pg.js +2 -0
  14. package/dist/__vite-browser-external-y2xWjzgx.js +780 -0
  15. package/dist/browserAll-BFE0MRLW.js +6 -0
  16. package/dist/{canvasUtils-BoNfkAod.js → canvasUtils-DUNsu3ct.js} +1 -1
  17. package/dist/{core-gz2DUq8s.js → core-9UlJPBwX.js} +6331 -6299
  18. package/dist/core.js +6 -5
  19. package/dist/design-editor.css +2 -1
  20. package/dist/design-editor.js +7 -3622
  21. package/dist/{effectCategories-CsCbOfy3.js → effectCategories-CCpYmxS0.js} +8965 -4984
  22. package/dist/effects-DspYFJAM.js +447 -0
  23. package/dist/effects.js +1 -1
  24. package/dist/{generators-BrdP7Omn.js → generators-DY4_ymWh.js} +2394 -2423
  25. package/dist/generators.js +1 -1
  26. package/dist/{getTextureBatchBindGroup-CNWhZRbV.js → getTextureBatchBindGroup-ZMqkwiZS.js} +1 -1
  27. package/dist/{host-BLhWuQ9Y.js → host-0qv2SCjk.js} +1 -1
  28. package/dist/{host-DwC1SsjV.js → host-Bo6itV50.js} +50 -50
  29. package/dist/init-DkGhdexn.js +4 -0
  30. package/dist/{morphStore-Ba--Lk9u.js → morphStore-Bm30Ekce.js} +1 -1
  31. package/dist/{motion-DL5Y98d6.js → motion-BOWE4m3Q.js} +762 -759
  32. package/dist/motion.js +1 -1
  33. package/dist/{pipeline-CMpuPUaX.js → pipeline-hZsOKbHd.js} +12 -12
  34. package/dist/{previewScale-xKmJh3wg.js → previewScale-C6EBx--U.js} +8 -8
  35. package/dist/{rolls-CSOfYXm5.js → rolls-DugKaHUw.js} +10550 -4518
  36. package/dist/src-BlvCHYVY.js +3672 -0
  37. package/dist/{src-BSoHkncc.js → src-D-TQbBo2.js} +1 -2
  38. package/dist/{store-BtEnp5i6.js → store-BMGP1qou.js} +295 -275
  39. package/dist/{useLayerEdit-BCGfD3Cv.js → useLayerEdit-B5nF5I9b.js} +103 -102
  40. package/dist/webworkerAll-0WBQ2FBr.js +2 -0
  41. package/package.json +14 -11
  42. package/dist/CanvasRenderer-Bl0rlqNq.js +0 -2
  43. package/dist/TreePicker-YcrYNUx5.js +0 -166
  44. package/dist/WebGLRenderer-CXxpVIx3.js +0 -2
  45. package/dist/WebGPURenderer-BwLEUYBa.js +0 -2
  46. package/dist/browserAll-CAzdTUbR.js +0 -6
  47. package/dist/chunk-3b4jIN3o.js +0 -13
  48. package/dist/effects-BZ8lWlZa.js +0 -447
  49. package/dist/init-jApIMi04.js +0 -4
  50. package/dist/webworkerAll-DEZhpG90.js +0 -2
@@ -0,0 +1,447 @@
1
+ import { $t as e, F as t, Gn as n, Ir as r, J as i, Kn as a, L as o, Xn as s, Xt as c, Yn as l, Zn as u, a as d, d as f, er as p, n as m, o as h, qn as g, t as _, u as v, xn as y } from "./rolls-DugKaHUw.js";
2
+ import { n as b, r as x, t as S } from "./useLayerEdit-B5nF5I9b.js";
3
+ import { a as C, at as w, ct as T, f as E, i as D, it as O, l as k, lt as A, nt as j, o as M, ot as N, p as P, r as F, rt as I, s as L, st as R, tt as z, u as B } from "./effectCategories-CCpYmxS0.js";
4
+ import { n as ee, t as V } from "./TreePicker-2RUSyGl4.js";
5
+ import { t as H } from "./BindDot-B85UV79g.js";
6
+ import { Tooltip as U, XYPad as W } from "@kolkrabbi/kol-component";
7
+ import { useEffect as te, useRef as ne, useState as G } from "react";
8
+ import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
9
+ //#region src/editor/compose/inspectors/EffectsPanel.jsx
10
+ var Y = [{
11
+ value: "effect",
12
+ label: "Effect"
13
+ }, {
14
+ value: "anim",
15
+ label: "Animation"
16
+ }];
17
+ function X() {
18
+ let { selectedId: e, layers: t } = i(), n = e && e !== "canvas" ? y(t, e) : null;
19
+ return /* @__PURE__ */ q("div", {
20
+ className: "kol-compose-rail kol-compose-rail--inspector",
21
+ children: /* @__PURE__ */ q("div", {
22
+ className: "kol-compose-inspector-body",
23
+ children: n ? /* @__PURE__ */ q(re, { layer: n }, n.id) : /* @__PURE__ */ q(x, {
24
+ always: !0,
25
+ children: "Select a layer to edit its effect."
26
+ })
27
+ })
28
+ });
29
+ }
30
+ function re({ layer: n }) {
31
+ let r = o(), { palette: s, addFilter: l, removeFilter: d, toggleFilter: f, moveFilter: p, replaceFilter: m } = i(), h = S(n.id, { history: "coalesce" }), _ = c(n), v = _.some((e) => e.def?.kind === "engine"), { effectable: y, engineHost: x, engineLoop: w } = D(n), [T, O] = G(_.length ? 0 : null), A = T == null ? null : _[T] ?? null, [j, M] = G("effect"), N = ne(_.map((e) => e.key));
32
+ if (te(() => {
33
+ let e = N.current, t = _.map((e) => e.key);
34
+ N.current = t;
35
+ let n = t.find((t) => !e.includes(t));
36
+ if (n != null) {
37
+ O(t.indexOf(n));
38
+ return;
39
+ }
40
+ T != null && T >= t.length && O(t.length ? t.length - 1 : null);
41
+ }, [_.length]), !y) return /* @__PURE__ */ q("p", {
42
+ className: "kol-mono-12 text-meta",
43
+ children: w ? "Engine loops can't host effects yet." : "This layer can't host an effect."
44
+ });
45
+ let P = (e) => {
46
+ let t = x && (e == null ? !v : _[e]?.def?.kind === "engine" || !v && e === _.length - 1), n = E.filter((e) => e.kind !== "engine" || t), r = /* @__PURE__ */ new Set();
47
+ return C(n).flatMap((e) => {
48
+ let t = e.filters.filter((e) => !r.has(e.id) && r.add(e.id));
49
+ return t.length ? [{ heading: e.label }, ...t.map((e) => ({
50
+ value: e.id,
51
+ label: e.label
52
+ }))] : [];
53
+ });
54
+ }, F = _.map(({ def: e, ...t }) => t), I = A ? {
55
+ ...n,
56
+ ...A.params,
57
+ id: n.id
58
+ } : null, L = (e) => {
59
+ if (T == null) return;
60
+ let t = F.map((t, n) => n === T ? {
61
+ ...t,
62
+ params: {
63
+ ...t.params,
64
+ ...e
65
+ }
66
+ } : t);
67
+ h.patch({ filters: t });
68
+ }, R = (e, t) => {
69
+ if (e === "cameraDrag") {
70
+ h.setProp(e, t);
71
+ return;
72
+ }
73
+ L({ [e]: t });
74
+ }, z = (e) => R("sweeps", e), V = (e) => /* @__PURE__ */ q(H, {
75
+ layer: I,
76
+ param: e,
77
+ setProp: R
78
+ }), U = A?.def ? k(A.def.id) : null, W = U ? A.def.params.find((e) => e.key === U) : null, X = A?.def ? A.def.params.filter((t) => e(t) !== "anim" && t !== W) : [];
79
+ return /* @__PURE__ */ J("div", {
80
+ className: "flex flex-col gap-4",
81
+ children: [_.map((e, i) => /* @__PURE__ */ J("div", {
82
+ className: "flex flex-col gap-3",
83
+ children: [/* @__PURE__ */ q(ie, {
84
+ stage: e,
85
+ selected: i === T,
86
+ options: P(i),
87
+ onSelect: () => O(i),
88
+ onPick: (t) => {
89
+ t && t !== e.id && m(n.id, i, t), O(i);
90
+ },
91
+ onToggle: () => f(n.id, i),
92
+ onRemove: () => d(n.id, i),
93
+ onUp: () => p(n.id, i, i - 1),
94
+ onDown: () => p(n.id, i, i + 1),
95
+ canUp: i > 0 && e.def?.kind !== "engine",
96
+ canDown: i < _.length - 1 && e.def?.kind !== "engine" && _[i + 1]?.def?.kind !== "engine"
97
+ }), i === T && A?.def && /* @__PURE__ */ J("div", {
98
+ className: "flex flex-col gap-3",
99
+ children: [
100
+ W && /* @__PURE__ */ q(ee, {
101
+ label: "Preset",
102
+ options: W.options,
103
+ value: A.params[W.key] ?? W.default,
104
+ onChange: (e) => L(B(A.def, e)),
105
+ inline: !0
106
+ }),
107
+ n.imgW != null && /* @__PURE__ */ q("span", {
108
+ className: "kol-helper-12 text-meta",
109
+ children: "Filters don't apply to cropped photos."
110
+ }),
111
+ A.def.orbit && /* @__PURE__ */ q(u, {
112
+ label: "Camera drag",
113
+ align: "fill",
114
+ labelWidth: t,
115
+ children: /* @__PURE__ */ q(a, {
116
+ layout: "joined",
117
+ size: r,
118
+ className: "w-full",
119
+ options: [{
120
+ value: "off",
121
+ label: "Off"
122
+ }, {
123
+ value: "on",
124
+ label: "On"
125
+ }],
126
+ value: n.cameraDrag ? "on" : "off",
127
+ onChange: (e) => R("cameraDrag", e === "on")
128
+ })
129
+ }),
130
+ /* @__PURE__ */ q(a, {
131
+ layout: "joined",
132
+ size: r,
133
+ className: "w-full",
134
+ value: j,
135
+ onChange: M,
136
+ options: Y
137
+ }),
138
+ j === "effect" && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(b, {
139
+ schema: X,
140
+ layer: I,
141
+ setProp: R,
142
+ palette: s,
143
+ renderAnimate: V
144
+ }), /* @__PURE__ */ q(Z, {
145
+ def: A.def,
146
+ view: I,
147
+ tab: "effect",
148
+ onPatch: L
149
+ })] }),
150
+ j === "anim" && /* @__PURE__ */ J(K, { children: [
151
+ /* @__PURE__ */ q(b, {
152
+ schema: A.def.params,
153
+ layer: I,
154
+ setProp: R,
155
+ palette: s,
156
+ renderAnimate: V,
157
+ tab: "anim"
158
+ }),
159
+ /* @__PURE__ */ q(Z, {
160
+ def: A.def,
161
+ view: I,
162
+ tab: "anim",
163
+ onPatch: L
164
+ }),
165
+ A.def.sweeps && /* @__PURE__ */ q(Q, {
166
+ sweeps: Array.isArray(A.params.sweeps) ? A.params.sweeps : [],
167
+ onChange: z
168
+ })
169
+ ] })
170
+ ]
171
+ })]
172
+ }, e.key)), _.length < 8 ? /* @__PURE__ */ q(g, {
173
+ variant: "subtle",
174
+ size: r,
175
+ className: "w-full",
176
+ options: [{
177
+ value: "",
178
+ label: "Add effect…"
179
+ }, ...P(null)],
180
+ value: "",
181
+ onChange: (e) => {
182
+ e && l(n.id, e);
183
+ }
184
+ }) : /* @__PURE__ */ q("span", {
185
+ className: "kol-helper-12 text-meta",
186
+ children: "Chain is full (8 effects)"
187
+ })]
188
+ });
189
+ }
190
+ function Z({ def: t, view: r, tab: i, onPatch: a, inline: s = !1, levels: c = null }) {
191
+ let l = o(), u = f(r), p = i === "anim", g = t.params.filter((t) => e(t) === "anim" === p), y = p ? g.filter((e) => !e.noRandom) : m(g, r), b = v(h(g, r), y), x = (e, t) => {
192
+ e.length && a(d(r, e, u.take(), { stripNoRandom: !!t?.motion }));
193
+ }, S = (e) => {
194
+ let t = {};
195
+ for (let n of e) n.default !== void 0 && (t[n.key] = n.default);
196
+ Object.keys(t).length && a(t);
197
+ };
198
+ return !y.length && !b.length ? null : /* @__PURE__ */ J("div", {
199
+ className: "flex flex-col gap-2",
200
+ children: [
201
+ y.length >= 5 && /* @__PURE__ */ q(_, {
202
+ seed: u,
203
+ inline: s
204
+ }),
205
+ y.length > 0 && /* @__PURE__ */ J("div", {
206
+ className: "flex gap-2",
207
+ children: [c ?? /* @__PURE__ */ q(n, {
208
+ tone: "primary",
209
+ size: l,
210
+ className: "flex-1 min-w-0",
211
+ onClick: (e) => e.altKey ? S(y) : x(y),
212
+ children: p ? "Randomize motion" : "Randomize all"
213
+ }), /* @__PURE__ */ q(U, {
214
+ label: "Reset to defaults",
215
+ shortcut: "R",
216
+ children: /* @__PURE__ */ q(n, {
217
+ tone: "primary",
218
+ size: l,
219
+ iconOnly: "refresh",
220
+ "aria-label": "Reset to defaults",
221
+ onClick: () => S(y),
222
+ className: "shrink-0"
223
+ })
224
+ })]
225
+ }),
226
+ b.length > 0 && /* @__PURE__ */ q("div", {
227
+ className: `grid ${s ? "grid-cols-3" : "grid-cols-2"} gap-2`,
228
+ children: b.map((e) => /* @__PURE__ */ q(n, {
229
+ tone: "primary",
230
+ size: l,
231
+ onClick: (t) => t.altKey ? S(e.params) : x(e.params, e),
232
+ children: e.label
233
+ }, e.id))
234
+ })
235
+ ]
236
+ });
237
+ }
238
+ function ie({ stage: e, selected: t, options: r, onSelect: i, onPick: a, onToggle: s, onRemove: c, onUp: l, onDown: u, canUp: d, canDown: f }) {
239
+ let p = o(), m = e.enabled !== !1, h = (e, t, r, i, a = "") => {
240
+ let o = /* @__PURE__ */ q(U, {
241
+ label: e,
242
+ children: /* @__PURE__ */ q(n, {
243
+ tone: "ghost",
244
+ quiet: !0,
245
+ size: p,
246
+ iconOnly: i,
247
+ "aria-label": e,
248
+ tabIndex: r ? -1 : void 0,
249
+ onClick: (e) => {
250
+ e.stopPropagation(), r || t();
251
+ },
252
+ className: `shrink-0 ${a}`
253
+ })
254
+ });
255
+ return r ? /* @__PURE__ */ q("span", {
256
+ "aria-hidden": "true",
257
+ className: "invisible pointer-events-none shrink-0",
258
+ children: o
259
+ }) : o;
260
+ };
261
+ return /* @__PURE__ */ J("div", {
262
+ onClick: i,
263
+ className: `flex items-center gap-1 rounded ${t ? "bg-oq-08" : ""}`,
264
+ children: [
265
+ h(m ? "Disable effect" : "Enable effect", s, !1, m ? "eye-on" : "eye-off"),
266
+ /* @__PURE__ */ q("div", {
267
+ className: `flex-1 min-w-0 ${m ? "" : "opacity-60"}`,
268
+ children: /* @__PURE__ */ q(g, {
269
+ variant: "subtle",
270
+ size: p,
271
+ className: "w-full",
272
+ options: r,
273
+ value: e.id,
274
+ onChange: a
275
+ })
276
+ }),
277
+ h("Move up", l, !d, "chevron-down", "rotate-180"),
278
+ h("Move down", u, !f, "chevron-down"),
279
+ h("Delete effect", c, !1, "x")
280
+ ]
281
+ });
282
+ }
283
+ var ae = (e) => [
284
+ {
285
+ key: "shape",
286
+ label: "Shape",
287
+ type: "select",
288
+ options: I,
289
+ default: "linear"
290
+ },
291
+ {
292
+ key: "target",
293
+ label: "Target",
294
+ type: "select",
295
+ options: O,
296
+ default: "brightness"
297
+ },
298
+ {
299
+ key: "travel",
300
+ label: "Travel",
301
+ type: "select",
302
+ options: w,
303
+ default: "forward"
304
+ },
305
+ ...e.target === "reveal" ? [] : [{
306
+ key: "amount",
307
+ label: "Amount",
308
+ type: "range",
309
+ min: -1,
310
+ max: 1,
311
+ step: .01,
312
+ default: .6
313
+ }],
314
+ {
315
+ key: "speed",
316
+ label: "Speed",
317
+ type: "range",
318
+ min: -8,
319
+ max: 8,
320
+ step: 1,
321
+ default: 1
322
+ },
323
+ {
324
+ key: "width",
325
+ label: "Width",
326
+ type: "range",
327
+ min: .05,
328
+ max: 1,
329
+ step: .01,
330
+ default: .35
331
+ },
332
+ ...z.has(e.shape ?? "linear") ? [{
333
+ key: "angle",
334
+ label: "Angle",
335
+ type: "range",
336
+ min: 0,
337
+ max: 360,
338
+ step: 1,
339
+ default: 0
340
+ }] : []
341
+ ];
342
+ function Q({ sweeps: e, onChange: r, inline: i = !1 }) {
343
+ let a = o(), c = (e) => I.find((t) => t.value === e)?.label ?? e, u = (t) => r([...e, t ? N(t.shape, t) : N()]), d = (t) => r(e.filter((e, n) => n !== t)), f = (t, n) => r(e.map((e, r) => r === t ? {
344
+ ...e,
345
+ ...n
346
+ } : e));
347
+ return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J(s, {
348
+ label: "Motion",
349
+ divided: !0,
350
+ children: [/* @__PURE__ */ q(V, {
351
+ options: [{
352
+ value: "",
353
+ label: "Add motion…"
354
+ }, ...j.map((e) => ({
355
+ value: e.name,
356
+ label: e.name
357
+ }))],
358
+ value: "",
359
+ onChange: (e) => {
360
+ let t = j.find((t) => t.name === e);
361
+ t && u(t);
362
+ }
363
+ }), /* @__PURE__ */ q(n, {
364
+ tone: "primary",
365
+ size: a,
366
+ className: "w-full",
367
+ iconLeft: "plus",
368
+ iconSize: 12,
369
+ onClick: () => u(),
370
+ children: "Add custom sweep"
371
+ })]
372
+ }), e.map((e, r) => {
373
+ let o = e.enabled !== !1;
374
+ return /* @__PURE__ */ J(s, {
375
+ divided: !0,
376
+ children: [/* @__PURE__ */ J("div", {
377
+ className: "flex items-center gap-2",
378
+ children: [
379
+ /* @__PURE__ */ q("span", {
380
+ className: `kol-eyebrow flex-1 truncate ${o ? "text-fg-80" : "text-meta"}`,
381
+ children: c(e.shape ?? "linear")
382
+ }),
383
+ /* @__PURE__ */ q(p, {
384
+ size: a,
385
+ checked: o,
386
+ onChange: (e) => f(r, { enabled: e })
387
+ }),
388
+ /* @__PURE__ */ q(U, {
389
+ label: "Delete sweep",
390
+ children: /* @__PURE__ */ q(n, {
391
+ tone: "ghost",
392
+ quiet: !0,
393
+ size: a,
394
+ iconOnly: "x",
395
+ "aria-label": "Delete sweep",
396
+ className: "shrink-0",
397
+ onClick: () => d(r)
398
+ })
399
+ })
400
+ ]
401
+ }), o && /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(b, {
402
+ schema: ae(e),
403
+ layer: e,
404
+ setProp: (e, t) => f(r, { [e]: t }),
405
+ inline: i
406
+ }), (e.shape ?? "linear") !== "noise" && /* @__PURE__ */ q(l, {
407
+ horizontal: !0,
408
+ label: "ORIGIN",
409
+ labelWidth: t,
410
+ children: /* @__PURE__ */ q("div", {
411
+ className: "w-full min-w-0",
412
+ children: /* @__PURE__ */ q(W, {
413
+ xValue: e.cx ?? .5,
414
+ yValue: e.cy ?? .5,
415
+ xMin: 0,
416
+ xMax: 1,
417
+ yMin: 1,
418
+ yMax: 0,
419
+ onChange: (e, t) => f(r, {
420
+ cx: Math.round(e * 100) / 100,
421
+ cy: Math.round(t * 100) / 100
422
+ })
423
+ })
424
+ })
425
+ })] })]
426
+ }, r);
427
+ })] });
428
+ }
429
+ //#endregion
430
+ //#region src/packs/effects.js
431
+ var $ = {
432
+ FILTERS: E,
433
+ filterById: P,
434
+ makeSweep: N,
435
+ runChain: T,
436
+ invalidateSource: R,
437
+ stillOf: A,
438
+ effectCategories: F,
439
+ liveFilterGroups: M,
440
+ liveFilterLabel: L,
441
+ EffectsPanel: X,
442
+ loadPixiPipeline: () => import("./pipeline-hZsOKbHd.js"),
443
+ loadGlHost: () => import("./host-0qv2SCjk.js")
444
+ };
445
+ r("effects", $);
446
+ //#endregion
447
+ export { Z as n, Q as r, $ as t };
package/dist/effects.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./effects-BZ8lWlZa.js";
1
+ import { t as e } from "./effects-DspYFJAM.js";
2
2
  export { e as effects };