@kolkrabbi/design-editor 0.48.0 → 0.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { E as e, T as t } from "./__vite-browser-external-y2xWjzgx.js";
2
- import { Nr as n } from "./rolls-Cnu6g8th.js";
3
- import { A as r, D as i, E as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, b as p, d as m, f as h, g, j as _, k as v, w as y, x as b, y as x } from "./store-YIW6P2zN.js";
4
- import { i as S, n as C } from "./Timeline-CRr43b4B.js";
5
- import { i as w, n as T, r as E, t as D } from "./src-3UkpFoNW.js";
6
- import { M as O, N as k, a as ee, an as A, at as j, bt as M, c as N, cn as P, ct as F, d as I, dn as L, et as R, f as z, fn as B, gn as V, gt as H, i as U, it as W, l as G, ln as K, lt as q, mt as J, n as Y, nt as X, o as Z, p as Q, r as $, rn as te, rt as ne, s as re, st as ie, tt as ae, u as oe, ut as se, vn as ce, yn as le } from "./core-BbKj9Svq.js";
7
- export { R as AppSettingsSections, J as BRAND, D as DesignEditor, D as default, ae as DisplaySettingsDrawer, Q as EditorProviders, se as FilesDialog, m as GeneratorLibraryProvider, E as LABS_DRAFT_KEY, h as LIBRARY_SLOT_KEYS, w as LabsView, K as MODES, T as MobileView, oe as OutputCanvas, I as OutputStage, z as OutputView, re as RAIL_EXTRA_PREFIX, ne as STYLE_OPTIONS, C as TimelineRail, b as UnauthorizedError, L as VIEW_PATHS, W as VariantContext, ie as closeFiles, H as comboLabel, Y as copyStored, B as currentView, $ as duplicateStored, u as getLibraryApi, y as inviteFromRequest, te as isMobileDevice, d as listInviteRequests, g as loadLibrary, a as mintInvite, F as openFiles, f as readLibraryRaw, n as registerPack, U as removeStored, ee as renameStored, i as requestInvite, c as setLibraryApi, O as setMediaClient, k as setMediaProxyBase, V as setMode, ce as setNavigator, N as setRailExtras, t as setSettingsStore, Z as setThumbStored, A as setWantsDesktop, M as shortcutsBySection, v as signInLibrary, r as signOutLibrary, _ as signUpLibrary, x as subscribeLibrary, S as timelineView, o as updateAccount, s as useAccount, e as useAppSettings, q as useFilesDialog, p as useGeneratorLibrary, l as useLibrarySession, G as useRailExtras, X as useSettingsSections, j as useVariant, P as wantsDesktop, le as withView };
2
+ import { Pr as n } from "./rolls-ZToBSscx.js";
3
+ import { A as r, D as i, E as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, b as p, d as m, f as h, g, j as _, k as v, w as y, x as b, y as x } from "./store-BDAxvWTE.js";
4
+ import { i as S, n as C } from "./Timeline-BH3BF2m4.js";
5
+ import { i as w, n as T, r as E, t as D } from "./src-PZgdetsA.js";
6
+ import { M as O, N as k, Sn as ee, Tn as A, _n as j, a as M, at as N, bt as P, c as F, ct as I, d as L, dn as R, et as z, f as B, gt as V, hn as H, i as U, it as W, l as G, ln as K, lt as q, mn as J, mt as Y, n as X, nt as Z, o as Q, p as $, r as te, rt as ne, s as re, st as ie, tt as ae, u as oe, ut as se, vn as ce, wn as le } from "./core-DyfKZlBI.js";
7
+ export { z as AppSettingsSections, Y as BRAND, D as DesignEditor, D as default, ae as DisplaySettingsDrawer, $ as EditorProviders, se as FilesDialog, m as GeneratorLibraryProvider, E as LABS_DRAFT_KEY, h as LIBRARY_SLOT_KEYS, w as LabsView, H as MODES, T as MobileView, oe as OutputCanvas, L as OutputStage, B as OutputView, re as RAIL_EXTRA_PREFIX, ne as STYLE_OPTIONS, C as TimelineRail, b as UnauthorizedError, j as VIEW_PATHS, W as VariantContext, ie as closeFiles, V as comboLabel, X as copyStored, ce as currentView, te as duplicateStored, u as getLibraryApi, y as inviteFromRequest, K as isMobileDevice, d as listInviteRequests, g as loadLibrary, a as mintInvite, I as openFiles, f as readLibraryRaw, n as registerPack, U as removeStored, M as renameStored, i as requestInvite, c as setLibraryApi, O as setMediaClient, k as setMediaProxyBase, ee as setMode, le as setNavigator, F as setRailExtras, t as setSettingsStore, Q as setThumbStored, R as setWantsDesktop, P as shortcutsBySection, v as signInLibrary, r as signOutLibrary, _ as signUpLibrary, x as subscribeLibrary, S as timelineView, o as updateAccount, s as useAccount, e as useAppSettings, q as useFilesDialog, p as useGeneratorLibrary, l as useLibrarySession, G as useRailExtras, Z as useSettingsSections, N as useVariant, J as wantsDesktop, A as withView };
@@ -1,7 +1,7 @@
1
1
  import { A as e, D as t, M as n, P as r, a as i, h as a, j as o, k as s, o as c } from "./__vite-browser-external-y2xWjzgx.js";
2
- import { ar as l, cr as u, dr as d, fr as f, hr as p, ir as m, lr as h, nr as g, or as _, pr as v, rr as y, ur as b } from "./rolls-Cnu6g8th.js";
3
- import { a as x, i as S, o as C, s as w } from "./useLayerEdit-W_Tf3adq.js";
4
- import { o as T, u as E } from "./TreePicker-DXsAlHK6.js";
2
+ import { ar as l, dr as u, fr as d, gr as f, ir as p, lr as m, mr as h, or as g, pr as _, rr as v, sr as y, ur as b } from "./rolls-ZToBSscx.js";
3
+ import { a as x, i as S, o as C, s as w } from "./useLayerEdit-D6vwfIoB.js";
4
+ import { o as T, u as E } from "./TreePicker-RImJ6I_0.js";
5
5
  import { useSyncExternalStore as D } from "react";
6
6
  //#region src/loops/lib/fill.js
7
7
  var O = [
@@ -4702,7 +4702,7 @@ var yt = 1e3, bt = /* @__PURE__ */ new Map(), xt = /* @__PURE__ */ new Set(), St
4702
4702
  function Tt(e, t, n) {
4703
4703
  if (!n) return null;
4704
4704
  let r = wt(e, t), i = bt.get(r);
4705
- if (!i) return !xt.has(r) && !St.has(r) && (xt.add(r), p(e, t, !1).then((e) => {
4705
+ if (!i) return !xt.has(r) && !St.has(r) && (xt.add(r), f(e, t, !1).then((e) => {
4706
4706
  bt.set(r, e);
4707
4707
  }).catch(() => {
4708
4708
  St.add(r);
@@ -28889,7 +28889,7 @@ var lm = [
28889
28889
  noRandom: !0,
28890
28890
  label: "Mode",
28891
28891
  type: "select",
28892
- options: f,
28892
+ options: _,
28893
28893
  default: "print-press"
28894
28894
  },
28895
28895
  {
@@ -28953,9 +28953,9 @@ var lm = [
28953
28953
  e.fillStyle = a.bg, e.fillRect(0, 0, r, i);
28954
28954
  let o = vm(typeof a.svgSrc == "string" && a.svgSrc || mm, a.frequency) ?? vm(mm, a.frequency);
28955
28955
  if (!o || o.error || !o.elements.length) return;
28956
- let s = Math.round(a.motion), c = t * n * s, l = s * 2, u = a.seed + (l > 0 ? Math.floor(n * l) % l * 101 : 0), d = Math.max(0, a.amount), f = Math.max(1, a.frequency <= 50 ? a.frequency / 6 : 50 / 6 + (a.frequency - 50) / 8), p = a.smoothness > 0 ? Math.max(1, Math.round(a.smoothness / 30)) : 0, [m, h, g, _] = o.vb, y = Math.min(r * a.size / g, i * a.size / _);
28957
- e.save(), e.translate((r - g * y) / 2 - m * y, (i - _ * y) / 2 - h * y), e.scale(y, y), o.elements.forEach((t, n) => {
28958
- let r = t.pts.map((e, t) => v(a.mode, t + n * 1e3, e.t, d, f, u, c)), i = r;
28956
+ let s = Math.round(a.motion), c = t * n * s, l = s * 2, u = a.seed + (l > 0 ? Math.floor(n * l) % l * 101 : 0), d = Math.max(0, a.amount), f = Math.max(1, a.frequency <= 50 ? a.frequency / 6 : 50 / 6 + (a.frequency - 50) / 8), p = a.smoothness > 0 ? Math.max(1, Math.round(a.smoothness / 30)) : 0, [m, g, _, v] = o.vb, y = Math.min(r * a.size / _, i * a.size / v);
28957
+ e.save(), e.translate((r - _ * y) / 2 - m * y, (i - v * y) / 2 - g * y), e.scale(y, y), o.elements.forEach((t, n) => {
28958
+ let r = t.pts.map((e, t) => h(a.mode, t + n * 1e3, e.t, d, f, u, c)), i = r;
28959
28959
  p > 0 && (i = r.map((e, n) => {
28960
28960
  let i = 0, a = 0, o = 0;
28961
28961
  for (let e = -p; e <= p; e++) {
@@ -36165,11 +36165,11 @@ var jv = Object.fromEntries(eh.params.map((e) => [e.key, e.default]));
36165
36165
  //#endregion
36166
36166
  //#region src/generate/lineSwell/index.js
36167
36167
  function Mv(e, t, n = {}, r) {
36168
- let i = y(e).call, a = {
36168
+ let i = p(e).call, a = {
36169
36169
  ...t,
36170
36170
  ...r == null ? {} : { waveT: r }
36171
36171
  };
36172
- return i.fn === "vals" ? d(a, i.name, n) : b[i.fn](a, n);
36172
+ return i.fn === "vals" ? d(a, i.name, n) : u[i.fn](a, n);
36173
36173
  }
36174
36174
  var Nv = (e, t) => [
36175
36175
  e[0] * t[0] + e[2] * t[1],
@@ -36268,7 +36268,7 @@ var zv = {
36268
36268
  section: "Line Swell"
36269
36269
  })),
36270
36270
  draw(e, t, n, r) {
36271
- y(t.lsForm) && Lv(e, Mv(t.lsForm, t.lsValues ?? {}, Rv(n, r, _(t.lsForm, t.lsValues ?? {}))), n);
36271
+ p(t.lsForm) && Lv(e, Mv(t.lsForm, t.lsValues ?? {}, Rv(n, r, y(t.lsForm, t.lsValues ?? {}))), n);
36272
36272
  }
36273
36273
  }, Bv = /* @__PURE__ */ r({
36274
36274
  body: () => Zv,
@@ -36438,7 +36438,7 @@ var ey = new Set([
36438
36438
  })) } : {},
36439
36439
  ...e.unit ? { format: (t) => `${t}${e.unit === "°" ? "°" : ` ${e.unit}`}` } : {}
36440
36440
  }), iy = (e) => e.sections.flatMap((e) => e.controls.map((t) => ry(t, e.title))), ay = (e, t) => Object.fromEntries(e.sections.flatMap((e) => e.controls.map((e) => [e.name, t[ty(e.name)]]))), oy = (e) => e.split(/[,:]/)[0], sy = (e) => e ? { rings: Av([...e].pop()).map((e) => e.map(([e, t]) => [e * 5 / 7, t])) } : {}, cy = (e) => {
36441
- let t = u.forms[e];
36441
+ let t = m.forms[e];
36442
36442
  if (!t.motion) return t;
36443
36443
  let n = [...t.sections];
36444
36444
  return n.splice(t.motion.at, 0, {
@@ -36456,7 +36456,7 @@ function dy(e) {
36456
36456
  };
36457
36457
  return {
36458
36458
  id: ly(e),
36459
- label: e === "master" ? "Swell" : m({ form: e }),
36459
+ label: e === "master" ? "Swell" : l({ form: e }),
36460
36460
  group: "lineswell",
36461
36461
  kind: "2d",
36462
36462
  duration: 4,
@@ -36467,7 +36467,7 @@ function dy(e) {
36467
36467
  kind: "form"
36468
36468
  },
36469
36469
  draw(n, r, a, o, s) {
36470
- let c = ay(t, s), l = c.motion && c.motion !== "off", u = e === "master" && c.source === "wave" || l, { ink: d, ground: f } = g(e, c), p = JSON.stringify([
36470
+ let c = ay(t, s), l = c.motion && c.motion !== "off", u = e === "master" && c.source === "wave" || l, { ink: d, ground: f } = v(e, c), p = JSON.stringify([
36471
36471
  a,
36472
36472
  o,
36473
36473
  u ? r : 0,
@@ -36521,10 +36521,10 @@ function hy(e, t, n) {
36521
36521
  } : t;
36522
36522
  return Bv[r](i, n);
36523
36523
  }
36524
- return r === "keys" ? h(t, n, sy(t.letter ? String(t.letter).trim() : "")) : b[r](t, n);
36524
+ return r === "keys" ? b(t, n, sy(t.letter ? String(t.letter).trim() : "")) : u[r](t, n);
36525
36525
  }
36526
36526
  function gy(e) {
36527
- let t = u.loops[e], n = iy(t), { w: r, h: i } = t.frame, a = {
36527
+ let t = m.loops[e], n = iy(t), { w: r, h: i } = t.frame, a = {
36528
36528
  key: "",
36529
36529
  v: null
36530
36530
  };
@@ -36551,12 +36551,12 @@ function gy(e) {
36551
36551
  }
36552
36552
  };
36553
36553
  }
36554
- var _y = Object.keys(u.forms), vy = Object.keys(u.loops), yy = [..._y.map(dy), ...vy.map(gy)], by = {
36554
+ var _y = Object.keys(m.forms), vy = Object.keys(m.loops), yy = [..._y.map(dy), ...vy.map(gy)], by = {
36555
36555
  blinds: "Presets",
36556
36556
  master: "Master"
36557
36557
  }, xy = (e) => ({
36558
36558
  id: `lineswell-board-${e}`,
36559
- label: e === "master" ? "Swell" : m({ form: e }),
36559
+ label: e === "master" ? "Swell" : l({ form: e }),
36560
36560
  loop: ly(e),
36561
36561
  sub: by[e] ?? "Line Effects",
36562
36562
  params: {}
@@ -36569,7 +36569,7 @@ var _y = Object.keys(u.forms), vy = Object.keys(u.loops), yy = [..._y.map(dy), .
36569
36569
  "Wave shapes"
36570
36570
  ], Cy = [
36571
36571
  ..._y.map(xy),
36572
- ..._y.flatMap((e) => l(e).map((t) => ({
36572
+ ..._y.flatMap((e) => g(e).map((t) => ({
36573
36573
  id: `lineswell-${t.id}`,
36574
36574
  label: t.label,
36575
36575
  loop: ly(e),
@@ -36578,9 +36578,9 @@ var _y = Object.keys(u.forms), vy = Object.keys(u.loops), yy = [..._y.map(dy), .
36578
36578
  }))),
36579
36579
  ...vy.map((e) => ({
36580
36580
  id: `lineswell-board-${e}`,
36581
- label: oy(u.loops[e].title),
36581
+ label: oy(m.loops[e].title),
36582
36582
  loop: uy(e),
36583
- sub: u.loops[e].page,
36583
+ sub: m.loops[e].page,
36584
36584
  params: {}
36585
36585
  }))
36586
36586
  ].sort((e, t) => Sy.indexOf(e.sub) - Sy.indexOf(t.sub)), wy = [
@@ -0,0 +1,447 @@
1
+ import { $t as e, F as t, J as n, Jn as r, Kn as i, L as a, Pr as o, Qn as s, Xn as c, Xt as l, Zn as u, a as d, d as f, n as p, o as m, qn as h, t as g, tr as _, u as v, xn as y } from "./rolls-ZToBSscx.js";
2
+ import { n as b, r as x, t as S } from "./useLayerEdit-D6vwfIoB.js";
3
+ import { a as ee, at as C, ct as w, f as T, i as E, it as D, l as O, lt as k, nt as A, o as j, ot as M, p as N, r as P, rt as F, s as I, st as L, tt as R, u as te } from "./effectCategories-B5jhXEyy.js";
4
+ import { n as z, t as B } from "./TreePicker-RImJ6I_0.js";
5
+ import { t as V } from "./BindDot-BAAc-KSs.js";
6
+ import { Tooltip as H, XYPad as U } from "@kolkrabbi/kol-component";
7
+ import { useEffect as W, useRef as G, 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: t } = n(), r = e && e !== "canvas" ? y(t, 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: r ? /* @__PURE__ */ J(re, { layer: r }, r.id) : /* @__PURE__ */ J(x, {
24
+ always: !0,
25
+ children: "Select a layer to edit its effect."
26
+ })
27
+ })
28
+ });
29
+ }
30
+ function re({ layer: i }) {
31
+ let o = a(), { palette: c, addFilter: u, removeFilter: d, toggleFilter: f, moveFilter: p, replaceFilter: m } = n(), g = S(i.id, { history: "coalesce" }), _ = l(i), v = _.some((e) => e.def?.kind === "engine"), { effectable: y, engineHost: x, engineLoop: C } = E(i), [w, D] = K(_.length ? 0 : null), k = w == null ? null : _[w] ?? null, [A, j] = K("effect"), M = G(_.map((e) => e.key));
32
+ if (W(() => {
33
+ let e = M.current, t = _.map((e) => e.key);
34
+ M.current = t;
35
+ let n = t.find((t) => !e.includes(t));
36
+ if (n != null) {
37
+ D(t.indexOf(n));
38
+ return;
39
+ }
40
+ w != null && w >= t.length && D(t.length ? t.length - 1 : null);
41
+ }, [_.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 N = (e) => {
46
+ let t = x && (e == null ? !v : _[e]?.def?.kind === "engine" || !v && e === _.length - 1), n = T.filter((e) => e.kind !== "engine" || t), r = /* @__PURE__ */ new Set();
47
+ return ee(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
+ }, P = _.map(({ def: e, ...t }) => t), F = k ? {
55
+ ...i,
56
+ ...k.params,
57
+ id: i.id
58
+ } : null, I = (e) => {
59
+ if (w == null) return;
60
+ let t = P.map((t, n) => n === w ? {
61
+ ...t,
62
+ params: {
63
+ ...t.params,
64
+ ...e
65
+ }
66
+ } : t);
67
+ g.patch({ filters: t });
68
+ }, L = (e, t) => {
69
+ if (e === "cameraDrag") {
70
+ g.setProp(e, t);
71
+ return;
72
+ }
73
+ I({ [e]: t });
74
+ }, R = (e) => L("sweeps", e), B = (e) => /* @__PURE__ */ J(V, {
75
+ layer: F,
76
+ param: e,
77
+ setProp: L
78
+ }), H = k?.def ? O(k.def.id) : null, U = H ? k.def.params.find((e) => e.key === H) : null, X = k?.def ? k.def.params.filter((t) => e(t) !== "anim" && t !== U) : [];
79
+ return /* @__PURE__ */ Y("div", {
80
+ className: "flex flex-col gap-4",
81
+ children: [_.map((e, n) => /* @__PURE__ */ Y("div", {
82
+ className: "flex flex-col gap-3",
83
+ children: [/* @__PURE__ */ J(ie, {
84
+ stage: e,
85
+ selected: n === w,
86
+ options: N(n),
87
+ onSelect: () => D(n),
88
+ onPick: (t) => {
89
+ t && t !== e.id && m(i.id, n, t), D(n);
90
+ },
91
+ onToggle: () => f(i.id, n),
92
+ onRemove: () => d(i.id, n),
93
+ onUp: () => p(i.id, n, n - 1),
94
+ onDown: () => p(i.id, n, n + 1),
95
+ canUp: n > 0 && e.def?.kind !== "engine",
96
+ canDown: n < _.length - 1 && e.def?.kind !== "engine" && _[n + 1]?.def?.kind !== "engine"
97
+ }), n === w && k?.def && /* @__PURE__ */ Y("div", {
98
+ className: "flex flex-col gap-3",
99
+ children: [
100
+ U && /* @__PURE__ */ J(z, {
101
+ label: "Preset",
102
+ options: U.options,
103
+ value: k.params[U.key] ?? U.default,
104
+ onChange: (e) => I(te(k.def, e)),
105
+ inline: !0
106
+ }),
107
+ i.imgW != null && /* @__PURE__ */ J("span", {
108
+ className: "kol-helper-12 text-meta",
109
+ children: "Filters don't apply to cropped photos."
110
+ }),
111
+ k.def.orbit && /* @__PURE__ */ J(s, {
112
+ label: "Camera drag",
113
+ align: "fill",
114
+ labelWidth: t,
115
+ children: /* @__PURE__ */ J(h, {
116
+ layout: "joined",
117
+ size: o,
118
+ className: "w-full",
119
+ options: [{
120
+ value: "off",
121
+ label: "Off"
122
+ }, {
123
+ value: "on",
124
+ label: "On"
125
+ }],
126
+ value: i.cameraDrag ? "on" : "off",
127
+ onChange: (e) => L("cameraDrag", e === "on")
128
+ })
129
+ }),
130
+ /* @__PURE__ */ J(h, {
131
+ layout: "joined",
132
+ size: o,
133
+ className: "w-full",
134
+ value: A,
135
+ onChange: j,
136
+ options: ne
137
+ }),
138
+ A === "effect" && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(b, {
139
+ schema: X,
140
+ layer: F,
141
+ setProp: L,
142
+ palette: c,
143
+ renderAnimate: B
144
+ }), /* @__PURE__ */ J(Z, {
145
+ def: k.def,
146
+ view: F,
147
+ tab: "effect",
148
+ onPatch: I
149
+ })] }),
150
+ A === "anim" && /* @__PURE__ */ Y(q, { children: [
151
+ /* @__PURE__ */ J(b, {
152
+ schema: k.def.params,
153
+ layer: F,
154
+ setProp: L,
155
+ palette: c,
156
+ renderAnimate: B,
157
+ tab: "anim"
158
+ }),
159
+ /* @__PURE__ */ J(Z, {
160
+ def: k.def,
161
+ view: F,
162
+ tab: "anim",
163
+ onPatch: I
164
+ }),
165
+ k.def.sweeps && /* @__PURE__ */ J(Q, {
166
+ sweeps: Array.isArray(k.params.sweeps) ? k.params.sweeps : [],
167
+ onChange: R
168
+ })
169
+ ] })
170
+ ]
171
+ })]
172
+ }, e.key)), _.length < 8 ? /* @__PURE__ */ J(r, {
173
+ variant: "subtle",
174
+ size: o,
175
+ className: "w-full",
176
+ options: [{
177
+ value: "",
178
+ label: "Add effect…"
179
+ }, ...N(null)],
180
+ value: "",
181
+ onChange: (e) => {
182
+ e && u(i.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: t, view: n, tab: r, onPatch: o, inline: s = !1, levels: c = null }) {
191
+ let l = a(), u = f(n), h = r === "anim", _ = t.params.filter((t) => e(t) === "anim" === h), y = h ? _.filter((e) => !e.noRandom) : p(_, n), b = v(m(_, n), y), x = (e, t) => {
192
+ e.length && o(d(n, 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 && 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(g, {
202
+ seed: u,
203
+ inline: s
204
+ }),
205
+ y.length > 0 && /* @__PURE__ */ Y("div", {
206
+ className: "flex gap-2",
207
+ children: [c ?? /* @__PURE__ */ J(i, {
208
+ tone: "primary",
209
+ size: l,
210
+ className: "flex-1 min-w-0",
211
+ onClick: (e) => e.altKey ? S(y) : x(y),
212
+ children: h ? "Randomize motion" : "Randomize all"
213
+ }), /* @__PURE__ */ J(H, {
214
+ label: "Reset to defaults",
215
+ shortcut: "R",
216
+ children: /* @__PURE__ */ J(i, {
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__ */ J("div", {
227
+ className: `grid ${s ? "grid-cols-3" : "grid-cols-2"} gap-2`,
228
+ children: b.map((e) => /* @__PURE__ */ J(i, {
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: n, onSelect: o, onPick: s, onToggle: c, onRemove: l, onUp: u, onDown: d, canUp: f, canDown: p }) {
239
+ let m = a(), h = e.enabled !== !1, g = (e, t, n, r, a = "") => {
240
+ let o = /* @__PURE__ */ J(H, {
241
+ label: e,
242
+ children: /* @__PURE__ */ J(i, {
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 ${a}`
253
+ })
254
+ });
255
+ return n ? /* @__PURE__ */ J("span", {
256
+ "aria-hidden": "true",
257
+ className: "invisible pointer-events-none shrink-0",
258
+ children: o
259
+ }) : o;
260
+ };
261
+ return /* @__PURE__ */ Y("div", {
262
+ onClick: o,
263
+ className: `flex items-center gap-1 rounded ${t ? "bg-oq-08" : ""}`,
264
+ children: [
265
+ g(h ? "Disable effect" : "Enable effect", c, !1, h ? "eye-on" : "eye-off"),
266
+ /* @__PURE__ */ J("div", {
267
+ className: `flex-1 min-w-0 ${h ? "" : "opacity-60"}`,
268
+ children: /* @__PURE__ */ J(r, {
269
+ variant: "subtle",
270
+ size: m,
271
+ className: "w-full",
272
+ options: n,
273
+ value: e.id,
274
+ onChange: s
275
+ })
276
+ }),
277
+ g("Move up", u, !f, "chevron-down", "rotate-180"),
278
+ g("Move down", d, !p, "chevron-down"),
279
+ g("Delete effect", l, !1, "x")
280
+ ]
281
+ });
282
+ }
283
+ var ae = (e) => [
284
+ {
285
+ key: "shape",
286
+ label: "Shape",
287
+ type: "select",
288
+ options: F,
289
+ default: "linear"
290
+ },
291
+ {
292
+ key: "target",
293
+ label: "Target",
294
+ type: "select",
295
+ options: D,
296
+ default: "brightness"
297
+ },
298
+ {
299
+ key: "travel",
300
+ label: "Travel",
301
+ type: "select",
302
+ options: C,
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
+ ...R.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: n, inline: r = !1 }) {
343
+ let o = a(), s = (e) => F.find((t) => t.value === e)?.label ?? e, l = (t) => n([...e, t ? M(t.shape, t) : M()]), d = (t) => n(e.filter((e, n) => n !== t)), f = (t, r) => n(e.map((e, n) => n === t ? {
344
+ ...e,
345
+ ...r
346
+ } : e));
347
+ return /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y(u, {
348
+ label: "Motion",
349
+ divided: !0,
350
+ children: [/* @__PURE__ */ J(B, {
351
+ options: [{
352
+ value: "",
353
+ label: "Add motion…"
354
+ }, ...A.map((e) => ({
355
+ value: e.name,
356
+ label: e.name
357
+ }))],
358
+ value: "",
359
+ onChange: (e) => {
360
+ let t = A.find((t) => t.name === e);
361
+ t && l(t);
362
+ }
363
+ }), /* @__PURE__ */ J(i, {
364
+ tone: "primary",
365
+ size: o,
366
+ className: "w-full",
367
+ iconLeft: "plus",
368
+ iconSize: 12,
369
+ onClick: () => l(),
370
+ children: "Add custom sweep"
371
+ })]
372
+ }), e.map((e, n) => {
373
+ let a = e.enabled !== !1;
374
+ return /* @__PURE__ */ Y(u, {
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 ${a ? "text-fg-80" : "text-meta"}`,
381
+ children: s(e.shape ?? "linear")
382
+ }),
383
+ /* @__PURE__ */ J(_, {
384
+ size: o,
385
+ checked: a,
386
+ onChange: (e) => f(n, { enabled: e })
387
+ }),
388
+ /* @__PURE__ */ J(H, {
389
+ label: "Delete sweep",
390
+ children: /* @__PURE__ */ J(i, {
391
+ tone: "ghost",
392
+ quiet: !0,
393
+ size: o,
394
+ iconOnly: "x",
395
+ "aria-label": "Delete sweep",
396
+ className: "shrink-0",
397
+ onClick: () => d(n)
398
+ })
399
+ })
400
+ ]
401
+ }), a && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(b, {
402
+ schema: ae(e),
403
+ layer: e,
404
+ setProp: (e, t) => f(n, { [e]: t }),
405
+ inline: r
406
+ }), (e.shape ?? "linear") !== "noise" && /* @__PURE__ */ J(c, {
407
+ horizontal: !0,
408
+ label: "ORIGIN",
409
+ labelWidth: t,
410
+ children: /* @__PURE__ */ J("div", {
411
+ className: "w-full min-w-0",
412
+ children: /* @__PURE__ */ J(U, {
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(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: T,
433
+ filterById: N,
434
+ makeSweep: M,
435
+ runChain: w,
436
+ invalidateSource: L,
437
+ stillOf: k,
438
+ effectCategories: P,
439
+ liveFilterGroups: j,
440
+ liveFilterLabel: I,
441
+ EffectsPanel: X,
442
+ loadPixiPipeline: () => import("./pipeline-hZsOKbHd.js"),
443
+ loadGlHost: () => import("./host-0qv2SCjk.js")
444
+ };
445
+ o("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-D7J0e5xl.js";
1
+ import { t as e } from "./effects-BAwNQ8Kj.js";
2
2
  export { e as effects };