@kolkrabbi/design-editor 0.46.0 → 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-B0VcuOag.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-Ck1rBV8S.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-BBb9Tk4Q.js → core-9UlJPBwX.js} +6272 -6239
  18. package/dist/core.js +6 -5
  19. package/dist/design-editor.css +2 -1
  20. package/dist/design-editor.js +7 -3644
  21. package/dist/{effectCategories-Ccye-8LP.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-BdVXv0jY.js → generators-DY4_ymWh.js} +2386 -2416
  25. package/dist/generators.js +1 -1
  26. package/dist/{getTextureBatchBindGroup-CNWhZRbV.js → getTextureBatchBindGroup-ZMqkwiZS.js} +1 -1
  27. package/dist/{host-meUhieO9.js → host-0qv2SCjk.js} +1 -1
  28. package/dist/{host-9pJ7NvnR.js → host-Bo6itV50.js} +50 -50
  29. package/dist/init-DkGhdexn.js +4 -0
  30. package/dist/{morphStore-D6mkLJ-8.js → morphStore-Bm30Ekce.js} +1 -1
  31. package/dist/{motion-wsc6Qd7S.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-SYKvfhUm.js → previewScale-C6EBx--U.js} +8 -8
  35. package/dist/{rolls-KpWCAeDv.js → rolls-DugKaHUw.js} +10549 -4517
  36. package/dist/src-BlvCHYVY.js +3672 -0
  37. package/dist/{src-B5o6fGRJ.js → src-D-TQbBo2.js} +1 -2
  38. package/dist/{store-iBb0I6hk.js → store-BMGP1qou.js} +295 -275
  39. package/dist/{useLayerEdit-Ba7RA6qX.js → useLayerEdit-B5nF5I9b.js} +103 -102
  40. package/dist/webworkerAll-0WBQ2FBr.js +2 -0
  41. package/package.json +12 -9
  42. package/dist/CanvasRenderer-Bl0rlqNq.js +0 -2
  43. package/dist/TreePicker-Dv0zpJwe.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-B47bpwGh.js +0 -447
  49. package/dist/init-jApIMi04.js +0 -4
  50. package/dist/webworkerAll-DEZhpG90.js +0 -2
@@ -1,447 +0,0 @@
1
- import { F as e, J as t, L as n, Rt as r, a as i, d as a, dn as o, ft as s, hn as c, ht as l, ln as u, mn as d, n as f, o as p, pn as m, t as h, tr as g, u as _, un as v, vn as y } from "./rolls-KpWCAeDv.js";
2
- import { n as b, r as x, t as S } from "./useLayerEdit-Ba7RA6qX.js";
3
- import { $ as C, J as w, K as T, Q as E, X as D, Y as O, Z as k, a as A, et as j, f as M, i as N, l as P, o as F, p as I, q as L, r as R, s as z, u as B } from "./effectCategories-Ccye-8LP.js";
4
- import { n as V, t as H } from "./TreePicker-Dv0zpJwe.js";
5
- import { t as U } from "./BindDot-B0VcuOag.js";
6
- import { Tooltip as W, XYPad as G } from "@kolkrabbi/kol-component";
7
- import { useEffect as ee, useRef as te, useState as K } from "react";
8
- import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
9
- //#region src/editor/compose/inspectors/EffectsPanel.jsx
10
- var ne = [{
11
- value: "effect",
12
- label: "Effect"
13
- }, {
14
- value: "anim",
15
- label: "Animation"
16
- }];
17
- function X() {
18
- let { selectedId: e, layers: n } = t(), i = e && e !== "canvas" ? r(n, e) : null;
19
- return /* @__PURE__ */ J("div", {
20
- className: "kol-compose-rail kol-compose-rail--inspector",
21
- children: /* @__PURE__ */ J("div", {
22
- className: "kol-compose-inspector-body",
23
- children: i ? /* @__PURE__ */ J(re, { layer: i }, i.id) : /* @__PURE__ */ J(x, {
24
- always: !0,
25
- children: "Select a layer to edit its effect."
26
- })
27
- })
28
- });
29
- }
30
- function re({ layer: r }) {
31
- let i = n(), { palette: a, addFilter: u, removeFilter: d, toggleFilter: f, moveFilter: p, replaceFilter: m } = t(), h = S(r.id, { history: "coalesce" }), g = s(r), _ = g.some((e) => e.def?.kind === "engine"), { effectable: y, engineHost: x, engineLoop: C } = N(r), [w, T] = K(g.length ? 0 : null), E = w == null ? null : g[w] ?? null, [D, O] = K("effect"), k = te(g.map((e) => e.key));
32
- if (ee(() => {
33
- let e = k.current, t = g.map((e) => e.key);
34
- k.current = t;
35
- let n = t.find((t) => !e.includes(t));
36
- if (n != null) {
37
- T(t.indexOf(n));
38
- return;
39
- }
40
- w != null && w >= t.length && T(t.length ? t.length - 1 : null);
41
- }, [g.length]), !y) return /* @__PURE__ */ J("p", {
42
- className: "kol-mono-12 text-meta",
43
- children: C ? "Engine loops can't host effects yet." : "This layer can't host an effect."
44
- });
45
- let j = (e) => {
46
- let t = x && (e == null ? !_ : g[e]?.def?.kind === "engine" || !_ && e === g.length - 1), n = M.filter((e) => e.kind !== "engine" || t), r = /* @__PURE__ */ new Set();
47
- return A(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 = g.map(({ def: e, ...t }) => t), I = E ? {
55
- ...r,
56
- ...E.params,
57
- id: r.id
58
- } : null, L = (e) => {
59
- if (w == null) return;
60
- let t = F.map((t, n) => n === w ? {
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), H = (e) => /* @__PURE__ */ J(U, {
75
- layer: I,
76
- param: e,
77
- setProp: R
78
- }), W = E?.def ? P(E.def.id) : null, G = W ? E.def.params.find((e) => e.key === W) : null, X = E?.def ? E.def.params.filter((e) => l(e) !== "anim" && e !== G) : [];
79
- return /* @__PURE__ */ Y("div", {
80
- className: "flex flex-col gap-4",
81
- children: [g.map((t, n) => /* @__PURE__ */ Y("div", {
82
- className: "flex flex-col gap-3",
83
- children: [/* @__PURE__ */ J(ie, {
84
- stage: t,
85
- selected: n === w,
86
- options: j(n),
87
- onSelect: () => T(n),
88
- onPick: (e) => {
89
- e && e !== t.id && m(r.id, n, e), T(n);
90
- },
91
- onToggle: () => f(r.id, n),
92
- onRemove: () => d(r.id, n),
93
- onUp: () => p(r.id, n, n - 1),
94
- onDown: () => p(r.id, n, n + 1),
95
- canUp: n > 0 && t.def?.kind !== "engine",
96
- canDown: n < g.length - 1 && t.def?.kind !== "engine" && g[n + 1]?.def?.kind !== "engine"
97
- }), n === w && E?.def && /* @__PURE__ */ Y("div", {
98
- className: "flex flex-col gap-3",
99
- children: [
100
- G && /* @__PURE__ */ J(V, {
101
- label: "Preset",
102
- options: G.options,
103
- value: E.params[G.key] ?? G.default,
104
- onChange: (e) => L(B(E.def, e)),
105
- inline: !0
106
- }),
107
- r.imgW != null && /* @__PURE__ */ J("span", {
108
- className: "kol-helper-12 text-meta",
109
- children: "Filters don't apply to cropped photos."
110
- }),
111
- E.def.orbit && /* @__PURE__ */ J(c, {
112
- label: "Camera drag",
113
- align: "fill",
114
- labelWidth: e,
115
- children: /* @__PURE__ */ J(v, {
116
- layout: "joined",
117
- size: i,
118
- className: "w-full",
119
- options: [{
120
- value: "off",
121
- label: "Off"
122
- }, {
123
- value: "on",
124
- label: "On"
125
- }],
126
- value: r.cameraDrag ? "on" : "off",
127
- onChange: (e) => R("cameraDrag", e === "on")
128
- })
129
- }),
130
- /* @__PURE__ */ J(v, {
131
- layout: "joined",
132
- size: i,
133
- className: "w-full",
134
- value: D,
135
- onChange: O,
136
- options: ne
137
- }),
138
- D === "effect" && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(b, {
139
- schema: X,
140
- layer: I,
141
- setProp: R,
142
- palette: a,
143
- renderAnimate: H
144
- }), /* @__PURE__ */ J(Z, {
145
- def: E.def,
146
- view: I,
147
- tab: "effect",
148
- onPatch: L
149
- })] }),
150
- D === "anim" && /* @__PURE__ */ Y(q, { children: [
151
- /* @__PURE__ */ J(b, {
152
- schema: E.def.params,
153
- layer: I,
154
- setProp: R,
155
- palette: a,
156
- renderAnimate: H,
157
- tab: "anim"
158
- }),
159
- /* @__PURE__ */ J(Z, {
160
- def: E.def,
161
- view: I,
162
- tab: "anim",
163
- onPatch: L
164
- }),
165
- E.def.sweeps && /* @__PURE__ */ J(Q, {
166
- sweeps: Array.isArray(E.params.sweeps) ? E.params.sweeps : [],
167
- onChange: z
168
- })
169
- ] })
170
- ]
171
- })]
172
- }, t.key)), g.length < 8 ? /* @__PURE__ */ J(o, {
173
- variant: "subtle",
174
- size: i,
175
- className: "w-full",
176
- options: [{
177
- value: "",
178
- label: "Add effect…"
179
- }, ...j(null)],
180
- value: "",
181
- onChange: (e) => {
182
- e && u(r.id, e);
183
- }
184
- }) : /* @__PURE__ */ J("span", {
185
- className: "kol-helper-12 text-meta",
186
- children: "Chain is full (8 effects)"
187
- })]
188
- });
189
- }
190
- function Z({ def: e, view: t, tab: r, onPatch: o, inline: s = !1, levels: c = null }) {
191
- let d = n(), m = a(t), g = r === "anim", v = e.params.filter((e) => l(e) === "anim" === g), y = g ? v.filter((e) => !e.noRandom) : f(v, t), b = _(p(v, t), y), x = (e, n) => {
192
- e.length && o(i(t, e, m.take(), { stripNoRandom: !!n?.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 && o(t);
197
- };
198
- return !y.length && !b.length ? null : /* @__PURE__ */ Y("div", {
199
- className: "flex flex-col gap-2",
200
- children: [
201
- y.length >= 5 && /* @__PURE__ */ J(h, {
202
- seed: m,
203
- inline: s
204
- }),
205
- y.length > 0 && /* @__PURE__ */ Y("div", {
206
- className: "flex gap-2",
207
- children: [c ?? /* @__PURE__ */ J(u, {
208
- tone: "primary",
209
- size: d,
210
- className: "flex-1 min-w-0",
211
- onClick: (e) => e.altKey ? S(y) : x(y),
212
- children: g ? "Randomize motion" : "Randomize all"
213
- }), /* @__PURE__ */ J(W, {
214
- label: "Reset to defaults",
215
- shortcut: "R",
216
- children: /* @__PURE__ */ J(u, {
217
- tone: "primary",
218
- size: d,
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__ */ J("div", {
227
- className: `grid ${s ? "grid-cols-3" : "grid-cols-2"} gap-2`,
228
- children: b.map((e) => /* @__PURE__ */ J(u, {
229
- tone: "primary",
230
- size: d,
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: d, canUp: f, canDown: p }) {
239
- let m = n(), h = e.enabled !== !1, g = (e, t, n, r, i = "") => {
240
- let a = /* @__PURE__ */ J(W, {
241
- label: e,
242
- children: /* @__PURE__ */ J(u, {
243
- tone: "ghost",
244
- quiet: !0,
245
- size: m,
246
- iconOnly: r,
247
- "aria-label": e,
248
- tabIndex: n ? -1 : void 0,
249
- onClick: (e) => {
250
- e.stopPropagation(), n || t();
251
- },
252
- className: `shrink-0 ${i}`
253
- })
254
- });
255
- return n ? /* @__PURE__ */ J("span", {
256
- "aria-hidden": "true",
257
- className: "invisible pointer-events-none shrink-0",
258
- children: a
259
- }) : a;
260
- };
261
- return /* @__PURE__ */ Y("div", {
262
- onClick: i,
263
- className: `flex items-center gap-1 rounded ${t ? "bg-oq-08" : ""}`,
264
- children: [
265
- g(h ? "Disable effect" : "Enable effect", s, !1, h ? "eye-on" : "eye-off"),
266
- /* @__PURE__ */ J("div", {
267
- className: `flex-1 min-w-0 ${h ? "" : "opacity-60"}`,
268
- children: /* @__PURE__ */ J(o, {
269
- variant: "subtle",
270
- size: m,
271
- className: "w-full",
272
- options: r,
273
- value: e.id,
274
- onChange: a
275
- })
276
- }),
277
- g("Move up", l, !f, "chevron-down", "rotate-180"),
278
- g("Move down", d, !p, "chevron-down"),
279
- g("Delete effect", c, !1, "x")
280
- ]
281
- });
282
- }
283
- var ae = (e) => [
284
- {
285
- key: "shape",
286
- label: "Shape",
287
- type: "select",
288
- options: w,
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: D,
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
- ...T.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: t, onChange: r, inline: i = !1 }) {
343
- let a = n(), o = (e) => w.find((t) => t.value === e)?.label ?? e, s = (e) => r([...t, e ? k(e.shape, e) : k()]), c = (e) => r(t.filter((t, n) => n !== e)), l = (e, n) => r(t.map((t, r) => r === e ? {
344
- ...t,
345
- ...n
346
- } : t));
347
- return /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(d, {
348
- label: "Motion",
349
- divided: !0,
350
- children: [/* @__PURE__ */ J(H, {
351
- options: [{
352
- value: "",
353
- label: "Add motion…"
354
- }, ...L.map((e) => ({
355
- value: e.name,
356
- label: e.name
357
- }))],
358
- value: "",
359
- onChange: (e) => {
360
- let t = L.find((t) => t.name === e);
361
- t && s(t);
362
- }
363
- }), /* @__PURE__ */ J(u, {
364
- tone: "primary",
365
- size: a,
366
- className: "w-full",
367
- iconLeft: "plus",
368
- iconSize: 12,
369
- onClick: () => s(),
370
- children: "Add custom sweep"
371
- })]
372
- }), t.map((t, n) => {
373
- let r = t.enabled !== !1;
374
- return /* @__PURE__ */ Y(d, {
375
- divided: !0,
376
- children: [/* @__PURE__ */ Y("div", {
377
- className: "flex items-center gap-2",
378
- children: [
379
- /* @__PURE__ */ J("span", {
380
- className: `kol-eyebrow flex-1 truncate ${r ? "text-fg-80" : "text-meta"}`,
381
- children: o(t.shape ?? "linear")
382
- }),
383
- /* @__PURE__ */ J(y, {
384
- size: a,
385
- checked: r,
386
- onChange: (e) => l(n, { enabled: e })
387
- }),
388
- /* @__PURE__ */ J(W, {
389
- label: "Delete sweep",
390
- children: /* @__PURE__ */ J(u, {
391
- tone: "ghost",
392
- quiet: !0,
393
- size: a,
394
- iconOnly: "x",
395
- "aria-label": "Delete sweep",
396
- className: "shrink-0",
397
- onClick: () => c(n)
398
- })
399
- })
400
- ]
401
- }), r && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(b, {
402
- schema: ae(t),
403
- layer: t,
404
- setProp: (e, t) => l(n, { [e]: t }),
405
- inline: i
406
- }), (t.shape ?? "linear") !== "noise" && /* @__PURE__ */ J(m, {
407
- horizontal: !0,
408
- label: "ORIGIN",
409
- labelWidth: e,
410
- children: /* @__PURE__ */ J("div", {
411
- className: "w-full min-w-0",
412
- children: /* @__PURE__ */ J(G, {
413
- xValue: t.cx ?? .5,
414
- yValue: t.cy ?? .5,
415
- xMin: 0,
416
- xMax: 1,
417
- yMin: 1,
418
- yMax: 0,
419
- onChange: (e, t) => l(n, {
420
- cx: Math.round(e * 100) / 100,
421
- cy: Math.round(t * 100) / 100
422
- })
423
- })
424
- })
425
- })] })]
426
- }, n);
427
- })] });
428
- }
429
- //#endregion
430
- //#region src/packs/effects.js
431
- var $ = {
432
- FILTERS: M,
433
- filterById: I,
434
- makeSweep: k,
435
- runChain: C,
436
- invalidateSource: E,
437
- stillOf: j,
438
- effectCategories: R,
439
- liveFilterGroups: F,
440
- liveFilterLabel: z,
441
- EffectsPanel: X,
442
- loadPixiPipeline: () => import("./pipeline-CMpuPUaX.js"),
443
- loadGlHost: () => import("./host-meUhieO9.js")
444
- };
445
- g("effects", $);
446
- //#endregion
447
- export { Z as n, Q as r, $ as t };
@@ -1,4 +0,0 @@
1
- import { ot as e } from "./Geometry-C5s5KpWq.js";
2
- import { i as t, r as n, t as r } from "./FilterSystem-BUrPNXx-.js";
3
- e.add(r, t), e.add(n);
4
- //#endregion
@@ -1,2 +0,0 @@
1
- import "./FilterSystem-BUrPNXx-.js";
2
- import "./init-jApIMi04.js";