@kolkrabbi/design-editor 0.47.0 → 0.49.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.
@@ -1,5 +1,5 @@
1
1
  import { _ as e, d as t, g as n, m as r, o as i, v as a } from "./__vite-browser-external-y2xWjzgx.js";
2
- import { D as o, Fr as s, J as c, L as l, _ as u, b as ee, f as d, g as te, h as f, m as p, p as m, v as h, x as g, xn as ne, y as re } from "./rolls-DugKaHUw.js";
2
+ import { D as o, J as s, L as c, Nr as l, _ as u, b as ee, f as d, g as te, h as f, m as p, p as m, v as h, x as g, xn as ne, y as re } from "./rolls-ZToBSscx.js";
3
3
  import { Button as _, ButtonGroup as ie, CloseButton as v, ColorPickerPopover as ae, Dropdown as y, FullscreenOverlay as b, FunctionPlot as x, Input as S, LabeledControl as C, MenuDropdownItem as w, ModalShell as T, Section as E, Slider as D, Stepper as O, Tooltip as k } from "@kolkrabbi/kol-component";
4
4
  import { createContext as oe, useCallback as A, useContext as se, useEffect as j, useMemo as ce, useRef as le, useState as M, useSyncExternalStore as N } from "react";
5
5
  import { Fragment as ue, jsx as P, jsxs as F } from "react/jsx-runtime";
@@ -58,7 +58,7 @@ function pe({ expr: e }) {
58
58
  });
59
59
  }
60
60
  function R({ layer: r, param: i, setProp: s }) {
61
- let c = l(), u = r[i.key], [ee, d] = M(null), [te, f] = M(!1), [p, m] = M(!1);
61
+ let l = c(), u = r[i.key], [ee, d] = M(null), [te, f] = M(!1), [p, m] = M(!1);
62
62
  if (!o(u) || u.bind !== "mod") return null;
63
63
  let h = u.source, g = u.transform ?? {}, ne = h.startsWith("lfo-"), re = h === "midi", v = n(h), ae = h === "expr", y = g.expr ?? "wave(t)", b = (e) => s(i.key, {
64
64
  ...u,
@@ -97,7 +97,7 @@ function R({ layer: r, param: i, setProp: s }) {
97
97
  className: "flex-1 min-w-0",
98
98
  children: /* @__PURE__ */ P(S, {
99
99
  variant: "filled",
100
- size: c,
100
+ size: l,
101
101
  type: "number",
102
102
  width: "100%",
103
103
  value: O[0],
@@ -112,7 +112,7 @@ function R({ layer: r, param: i, setProp: s }) {
112
112
  className: "flex-1 min-w-0",
113
113
  children: /* @__PURE__ */ P(S, {
114
114
  variant: "filled",
115
- size: c,
115
+ size: l,
116
116
  type: "number",
117
117
  width: "100%",
118
118
  value: O[1],
@@ -128,7 +128,7 @@ function R({ layer: r, param: i, setProp: s }) {
128
128
  label: "Invert",
129
129
  children: /* @__PURE__ */ P(ie, {
130
130
  layout: "joined",
131
- size: c,
131
+ size: l,
132
132
  className: "w-full",
133
133
  options: [{
134
134
  value: "off",
@@ -188,7 +188,7 @@ function R({ layer: r, param: i, setProp: s }) {
188
188
  label: "Expression",
189
189
  children: /* @__PURE__ */ P(S, {
190
190
  variant: "ghost",
191
- size: c,
191
+ size: l,
192
192
  value: ee ?? y,
193
193
  onChange: (e) => d(e.target.value),
194
194
  onBlur: (e) => x(e.target.value),
@@ -215,7 +215,7 @@ function R({ layer: r, param: i, setProp: s }) {
215
215
  label: g?.cc == null ? "MIDI · no CC yet" : `MIDI · CC ${g.cc}`,
216
216
  children: /* @__PURE__ */ P(_, {
217
217
  tone: "outline",
218
- size: c,
218
+ size: l,
219
219
  onClick: T,
220
220
  children: te ? "Move a knob…" : "Learn"
221
221
  })
@@ -224,7 +224,7 @@ function R({ layer: r, param: i, setProp: s }) {
224
224
  label: t(h)?.label ?? "Gamepad",
225
225
  children: /* @__PURE__ */ P(_, {
226
226
  tone: "outline",
227
- size: c,
227
+ size: l,
228
228
  onClick: E,
229
229
  children: p ? "Move a control…" : "Learn"
230
230
  })
@@ -1177,7 +1177,7 @@ function ht() {
1177
1177
  savePreset: () => null
1178
1178
  };
1179
1179
  }
1180
- var gt = Y, _t = (e) => s("generators")?.loopById(e) ?? null, vt = {
1180
+ var gt = Y, _t = (e) => l("generators")?.loopById(e) ?? null, vt = {
1181
1181
  bg: "Background",
1182
1182
  fg: "Ink",
1183
1183
  accent: "Accent",
@@ -1191,14 +1191,14 @@ var gt = Y, _t = (e) => s("generators")?.loopById(e) ?? null, vt = {
1191
1191
  5: "bg"
1192
1192
  }, bt = (e) => e.slice(0, 7).toLowerCase();
1193
1193
  function xt() {
1194
- let e = l(), { layers: t, selectedId: n, updateLayer: r, setColorAt: i } = c(), { library: a, addItem: o } = ht(), [s, ie] = M("analogous"), [v, b] = M(m), [x, S] = M(() => ee(.62, .14, Math.random() * 360)), [C, w] = M(() => re(d(v), {
1194
+ let e = c(), { layers: t, selectedId: n, updateLayer: r, setColorAt: i } = s(), { library: a, addItem: o } = ht(), [l, ie] = M("analogous"), [v, b] = M(m), [x, S] = M(() => ee(.62, .14, Math.random() * 360)), [C, w] = M(() => re(d(v), {
1195
1195
  base: x,
1196
- relation: s,
1196
+ relation: l,
1197
1197
  count: 5
1198
1198
  }).map((e) => ({
1199
1199
  hex: e,
1200
1200
  locked: !1
1201
- }))), [T, E] = M(null), D = ce(() => te(a), [a]), k = ({ b: e = x, rel: t = s, n = C.length, s: r = v } = {}) => {
1201
+ }))), [T, E] = M(null), D = ce(() => te(a), [a]), k = ({ b: e = x, rel: t = l, n = C.length, s: r = v } = {}) => {
1202
1202
  let i = re(d(r), {
1203
1203
  base: e,
1204
1204
  relation: t,
@@ -1240,9 +1240,9 @@ function xt() {
1240
1240
  name: t.name,
1241
1241
  roles: t.colors.length <= 8 ? t.roles : null
1242
1242
  });
1243
- }, I = C.map((e) => e.hex), L = T?.roles ?? u(I), pe = p.find((e) => e.id === s)?.label ?? "Palette", R = {
1243
+ }, I = C.map((e) => e.hex), L = T?.roles ?? u(I), pe = p.find((e) => e.id === l)?.label ?? "Palette", R = {
1244
1244
  name: T?.name ?? pe,
1245
- relation: s,
1245
+ relation: l,
1246
1246
  colors: I,
1247
1247
  roles: L
1248
1248
  }, me = (e) => f.filter((t) => L[t]?.toLowerCase() === e).map((e) => vt[e]).join(", "), z = n && n !== "canvas" ? ne(t, n) : null, B = z?.type === "loop" ? _t(z.loopId)?.params : null, he = () => {
@@ -1295,7 +1295,7 @@ function xt() {
1295
1295
  value: e.id,
1296
1296
  label: e.label
1297
1297
  })),
1298
- value: s,
1298
+ value: l,
1299
1299
  onChange: se
1300
1300
  }), /* @__PURE__ */ P(_, {
1301
1301
  tone: "grey",
@@ -1,19 +1,19 @@
1
1
  import { c as e, m as t } from "./__vite-browser-external-y2xWjzgx.js";
2
- import { $n as n, $t as r, D as i, F as a, I as o, J as s, Jn as c, Kn as l, L as u, Qn as d, Qt as f, T as p, Wn as m, Xn as h, Yn as g, Zn as _, Zt as v, en as y, er as b, ir as x, j as S, qn as C, tr as w } from "./rolls-DugKaHUw.js";
3
- import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as k } from "react";
4
- import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
2
+ import { $n as n, $t as r, D as i, F as a, Gn as o, I as s, J as c, Jn as l, L as u, Qn as d, Qt as f, T as p, Xn as m, Yn as h, Zn as g, Zt as _, en as v, er as y, j as b, nr as x, qn as S, tr as C } from "./rolls-ZToBSscx.js";
3
+ import { useCallback as w, useEffect as T, useMemo as E, useRef as D, useState as O } from "react";
4
+ import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
5
5
  //#region src/editor/lib/viewport.js
6
- var N = Math.PI * 2, P = {
6
+ var M = Math.PI * 2, N = {
7
7
  vpZoom: 1,
8
8
  vpSpin: 0,
9
9
  vpPulse: 0,
10
10
  vpWobble: 0,
11
11
  vpRate: 1
12
- }, F = {
12
+ }, P = {
13
13
  vpTime: "linear",
14
14
  vpSpeed: 1,
15
15
  vpPhase: 0
16
- }, I = [
16
+ }, F = [
17
17
  {
18
18
  key: "vpTime",
19
19
  label: "Time",
@@ -72,12 +72,12 @@ var N = Math.PI * 2, P = {
72
72
  tab: "anim",
73
73
  section: "Form"
74
74
  }
75
- ], L = (e) => e - Math.floor(e);
76
- function R(e, t) {
75
+ ], I = (e) => e - Math.floor(e);
76
+ function L(e, t) {
77
77
  if (!t) return e;
78
78
  let n = t.vpTime || "linear", r = Math.max(1, Math.round(t.vpSpeed || 1)), i = t.vpPhase || 0;
79
79
  if (n === "linear" && r === 1 && !i) return e;
80
- let a = L(e * r);
80
+ let a = I(e * r);
81
81
  switch (n) {
82
82
  case "ease":
83
83
  a = .5 - .5 * Math.cos(a * Math.PI);
@@ -90,17 +90,17 @@ function R(e, t) {
90
90
  break;
91
91
  case "bounce": {
92
92
  let e = Math.abs(Math.sin(a * Math.PI * 2));
93
- a = a < .5 ? e : 1 - e * .5, a = L(a);
93
+ a = a < .5 ? e : 1 - e * .5, a = I(a);
94
94
  break;
95
95
  }
96
96
  case "drift":
97
- a = L(a + .08 * Math.sin(a * N) + .04 * Math.sin(a * N * 3));
97
+ a = I(a + .08 * Math.sin(a * M) + .04 * Math.sin(a * M * 3));
98
98
  break;
99
99
  default: break;
100
100
  }
101
- return L(a + i);
101
+ return I(a + i);
102
102
  }
103
- var z = [
103
+ var R = [
104
104
  {
105
105
  key: "vpSpin",
106
106
  label: "Spin",
@@ -161,44 +161,44 @@ var z = [
161
161
  section: "Form"
162
162
  }
163
163
  ];
164
- function B(e, t, n, r, i) {
164
+ function z(e, t, n, r, i) {
165
165
  let a = Math.round(i.vpSpin || 0), o = i.vpZoom ?? 1, s = i.vpPulse || 0, c = i.vpWobble || 0;
166
166
  if (!a && s === 0 && c === 0 && o === 1) return !1;
167
- let l = t * N * Math.round(i.vpRate || 1), u = t * N * a + c * Math.PI / 180 * Math.sin(l), d = a ? Math.PI / 4 : Math.abs(c * Math.PI / 180), f = Math.cos(d) + Math.sin(d), p = Math.max(o * (1 + s * .5 * Math.sin(l)), f * 1.02);
167
+ let l = t * M * Math.round(i.vpRate || 1), u = t * M * a + c * Math.PI / 180 * Math.sin(l), d = a ? Math.PI / 4 : Math.abs(c * Math.PI / 180), f = Math.cos(d) + Math.sin(d), p = Math.max(o * (1 + s * .5 * Math.sin(l)), f * 1.02);
168
168
  return e.translate(n / 2, r / 2), e.rotate(u), e.scale(p, p), e.translate(-n / 2, -r / 2), !0;
169
169
  }
170
- function V(e, t, n, r, i, a) {
170
+ function B(e, t, n, r, i, a) {
171
171
  if (!t) return;
172
- let o = R(n, a);
173
- e.save(), B(e, o, r, i, a), t.draw(e, o, r, i, a), e.restore();
172
+ let o = L(n, a);
173
+ e.save(), z(e, o, r, i, a), t.draw(e, o, r, i, a), e.restore();
174
174
  }
175
175
  //#endregion
176
176
  //#region src/editor/components/Hint.jsx
177
- function H({ children: e, className: t = "kol-mono-12 text-meta", always: n = !1 }) {
178
- return /* @__PURE__ */ j("p", {
177
+ function V({ children: e, className: t = "kol-mono-12 text-meta", always: n = !1 }) {
178
+ return /* @__PURE__ */ A("p", {
179
179
  className: `${n ? "" : "kol-placeholder "}${t}`,
180
180
  children: e
181
181
  });
182
182
  }
183
183
  //#endregion
184
184
  //#region src/editor/params/AutoControls.jsx
185
- function U({ schema: e, layer: t, setProp: n, palette: a, renderAnimate: o, tab: s, emptyHint: c, inline: l = !0 }) {
186
- let u = y(e, t);
187
- if (s && (u = u.filter((e) => r(e) === s)), u.length === 0) return c ? /* @__PURE__ */ j(H, { children: c }) : null;
188
- let d = [];
189
- for (let e of u) {
190
- let t = f(e), n = d[d.length - 1];
191
- n && n.section === t ? n.params.push(e) : d.push({
185
+ function H({ schema: e, layer: t, setProp: n, palette: a, renderAnimate: s, tab: c, emptyHint: l, inline: u = !0 }) {
186
+ let d = v(e, t);
187
+ if (c && (d = d.filter((e) => r(e) === c)), d.length === 0) return l ? /* @__PURE__ */ A(V, { children: l }) : null;
188
+ let p = [];
189
+ for (let e of d) {
190
+ let t = f(e), n = p[p.length - 1];
191
+ n && n.section === t ? n.params.push(e) : p.push({
192
192
  section: t,
193
193
  params: [e]
194
194
  });
195
195
  }
196
- for (let e = 0; e < d.length; e++) {
197
- let t = d[e];
196
+ for (let e = 0; e < p.length; e++) {
197
+ let t = p[e];
198
198
  if (t.section) continue;
199
199
  let n = 0;
200
200
  for (; n < t.params.length && t.params[n].type === "select";) n++;
201
- n === 0 || n === t.params.length || (d.splice(e, 1, {
201
+ n === 0 || n === t.params.length || (p.splice(e, 1, {
202
202
  section: void 0,
203
203
  params: t.params.slice(0, n)
204
204
  }, {
@@ -206,220 +206,220 @@ function U({ schema: e, layer: t, setProp: n, palette: a, renderAnimate: o, tab:
206
206
  params: t.params.slice(n)
207
207
  }), e++);
208
208
  }
209
- return /* @__PURE__ */ j(A, { children: d.map((e) => {
210
- let r = Math.max(0, ...e.params.filter((e) => e.type === "range").map(W)), s = e.section && e.params.some((e) => e.collapsed), c = /* @__PURE__ */ j(h, {
211
- label: !s && e.section && e.section !== e.params[0].label ? e.section : void 0,
212
- divided: !s,
209
+ return /* @__PURE__ */ A(k, { children: p.map((e) => {
210
+ let r = Math.max(0, ...e.params.filter((e) => e.type === "range").map(U)), c = e.section && e.params.some((e) => e.collapsed), l = /* @__PURE__ */ A(g, {
211
+ label: !c && e.section && e.section !== e.params[0].label ? e.section : void 0,
212
+ divided: !c,
213
213
  children: e.params.map((e) => {
214
- let s = i(t[e.key]);
215
- return /* @__PURE__ */ j(J, {
214
+ let o = i(t[e.key]);
215
+ return /* @__PURE__ */ A(q, {
216
216
  param: e,
217
217
  layer: t,
218
218
  setProp: n,
219
219
  palette: a,
220
- bound: s,
221
- animate: o && v(e) ? o(e, s) : null,
222
- inline: l,
220
+ bound: o,
221
+ animate: s && _(e) ? s(e, o) : null,
222
+ inline: u,
223
223
  chars: r || void 0
224
224
  }, e.key);
225
225
  })
226
226
  }, e.params[0].key);
227
- return s ? /* @__PURE__ */ j(m, {
227
+ return c ? /* @__PURE__ */ A(o, {
228
228
  title: e.section,
229
- children: c
230
- }, e.params[0].key) : c;
229
+ children: l
230
+ }, e.params[0].key) : l;
231
231
  }) });
232
232
  }
233
- function W(e) {
233
+ function U(e) {
234
234
  let t = e.step && e.step < 1 ? String(e.step).split(".")[1]?.length ?? 2 : 0;
235
235
  return Math.max(2, String(Math.round(e.max ?? 0)).length, String(Math.round(e.min ?? 0)).length) + (t ? t + 1 : 0);
236
236
  }
237
- function G({ param: n, layer: r, setProp: a, chars: o }) {
238
- let s = u(), l = r[n.key], f = i(l), p = f && l.bind === "mod" && l.source === "expr", m = e(f), h = f ? S(l, m, r) : l, g = typeof h == "number" ? h : n.default ?? 0, _ = n.step && n.step < 1 ? String(n.step).split(".")[1]?.length ?? 2 : 0, v = p ? l.transform?.expr ?? "wave(t)" : n.format ? String(n.format(g)) : _ ? g.toFixed(_) : String(Math.round(g)), y = o ?? W(n), [b, C] = k(v), [w, T] = k(!1);
239
- return E(() => {
240
- w || C(v);
241
- }, [v, w]), /* @__PURE__ */ M("div", {
242
- className: `flex items-center gap-3${x() === "float" ? " w-full" : ""}`,
243
- children: [!f && /* @__PURE__ */ j(d, {
244
- min: n.min,
245
- max: n.max,
246
- step: n.step ?? 1,
237
+ function W({ param: r, layer: a, setProp: o, chars: s }) {
238
+ let c = u(), l = a[r.key], d = i(l), f = d && l.bind === "mod" && l.source === "expr", p = e(d), m = d ? b(l, p, a) : l, g = typeof m == "number" ? m : r.default ?? 0, _ = r.step && r.step < 1 ? String(r.step).split(".")[1]?.length ?? 2 : 0, v = f ? l.transform?.expr ?? "wave(t)" : r.format ? String(r.format(g)) : _ ? g.toFixed(_) : String(Math.round(g)), y = s ?? U(r), [x, S] = O(v), [C, w] = O(!1);
239
+ return T(() => {
240
+ C || S(v);
241
+ }, [v, C]), /* @__PURE__ */ j("div", {
242
+ className: "flex items-center gap-3",
243
+ children: [!d && /* @__PURE__ */ A(n, {
244
+ min: r.min,
245
+ max: r.max,
246
+ step: r.step ?? 1,
247
247
  value: g,
248
- onChange: (e) => a(n.key, Number(e)),
248
+ onChange: (e) => o(r.key, Number(e)),
249
249
  readout: "none",
250
250
  className: "flex-1"
251
- }), /* @__PURE__ */ j(c, {
251
+ }), /* @__PURE__ */ A(h, {
252
252
  type: "text",
253
253
  variant: "filled",
254
- size: s,
254
+ size: c,
255
255
  width: `calc(${y}ch + 24px)`,
256
- value: b,
256
+ value: x,
257
257
  title: "Number sets a constant · an expression like sin(t) binds it",
258
258
  onFocus: (e) => {
259
- T(!0), e.target.select();
259
+ w(!0), e.target.select();
260
260
  },
261
- onChange: (e) => C(e.target.value),
261
+ onChange: (e) => S(e.target.value),
262
262
  onBlur: () => {
263
- T(!1);
264
- let e = b.trim();
263
+ w(!1);
264
+ let e = x.trim();
265
265
  if (e === "") {
266
- C(v);
266
+ S(v);
267
267
  return;
268
268
  }
269
- let r = Number(e);
270
- if (Number.isFinite(r)) {
271
- a(n.key, r);
269
+ let n = Number(e);
270
+ if (Number.isFinite(n)) {
271
+ o(r.key, n);
272
272
  return;
273
273
  }
274
274
  if (!t(e).ok) {
275
- C(v);
275
+ S(v);
276
276
  return;
277
277
  }
278
- let i = f && l.transform?.range || (n.min != null && n.max != null ? [n.min, n.max] : [0, 1]);
279
- a(n.key, {
278
+ let i = d && l.transform?.range || (r.min != null && r.max != null ? [r.min, r.max] : [0, 1]);
279
+ o(r.key, {
280
280
  bind: "mod",
281
281
  source: "expr",
282
282
  transform: {
283
- ...f ? l.transform : {},
283
+ ...d ? l.transform : {},
284
284
  expr: e,
285
285
  range: i
286
286
  }
287
287
  });
288
288
  },
289
289
  onKeyDown: (e) => {
290
- e.key === "Enter" && e.currentTarget.blur(), e.key === "Escape" && (C(v), T(!1), e.currentTarget.blur());
290
+ e.key === "Enter" && e.currentTarget.blur(), e.key === "Escape" && (S(v), w(!1), e.currentTarget.blur());
291
291
  },
292
292
  inputClassName: "text-center"
293
293
  })]
294
294
  });
295
295
  }
296
- var K = a, q = {
296
+ var G = a, K = {
297
297
  xs: "h-[var(--kol-ctl-xs)]",
298
298
  sm: "h-[var(--kol-ctl-sm)]",
299
299
  md: "h-[var(--kol-ctl-md)]",
300
300
  lg: "h-[var(--kol-ctl-lg)]"
301
301
  };
302
- function J({ param: e, layer: t, setProp: r, palette: i, bound: a, animate: s, inline: c, chars: d }) {
303
- let f = u(), m = x() === "float", h = t[e.key], v = h === void 0 ? e.default : h;
304
- if (e.type === "color") return /* @__PURE__ */ M("div", {
302
+ function q({ param: e, layer: t, setProp: n, palette: r, bound: i, animate: a, inline: o, chars: c }) {
303
+ let f = u(), h = t[e.key], g = h === void 0 ? e.default : h;
304
+ if (e.type === "color") return /* @__PURE__ */ j("div", {
305
305
  className: "flex items-end gap-2",
306
- children: [/* @__PURE__ */ j("div", {
306
+ children: [/* @__PURE__ */ A("div", {
307
307
  className: "flex-1 min-w-0",
308
- children: /* @__PURE__ */ j(p, {
308
+ children: /* @__PURE__ */ A(p, {
309
309
  label: e.label,
310
- value: v,
311
- onChange: (t) => r(e.key, t),
312
- palette: i,
313
- inline: c
310
+ value: g,
311
+ onChange: (t) => n(e.key, t),
312
+ palette: r,
313
+ inline: o
314
314
  })
315
- }), s]
315
+ }), a]
316
316
  });
317
- let y = c, S = null;
318
- if (e.type === "range") f !== "sm" && (y = !1), S = /* @__PURE__ */ j(G, {
317
+ let _ = o, v = null;
318
+ if (e.type === "range") f !== "sm" && (_ = !1), v = /* @__PURE__ */ A(W, {
319
319
  param: e,
320
320
  layer: t,
321
- setProp: r,
322
- chars: d
321
+ setProp: n,
322
+ chars: c
323
323
  });
324
- else if (e.type === "select") S = /* @__PURE__ */ j(C, {
324
+ else if (e.type === "select") v = /* @__PURE__ */ A(l, {
325
325
  variant: "subtle",
326
326
  size: f,
327
327
  className: "w-full",
328
328
  options: e.options ?? [],
329
- value: v,
330
- onChange: (t) => r(e.key, e.numeric ? Number(t) : t)
329
+ value: g,
330
+ onChange: (t) => n(e.key, e.numeric ? Number(t) : t)
331
331
  });
332
- else if (e.type === "segmented") S = c ? /* @__PURE__ */ j(l, {
332
+ else if (e.type === "segmented") v = o ? /* @__PURE__ */ A(S, {
333
333
  layout: "joined",
334
334
  tone: "sunken",
335
335
  size: f,
336
- className: `w-full ${o(f) ?? ""}`,
336
+ className: `w-full ${s(f) ?? ""}`,
337
337
  options: e.options ?? [],
338
- value: v,
339
- onChange: (t) => r(e.key, t)
340
- }) : /* @__PURE__ */ j(w, {
338
+ value: g,
339
+ onChange: (t) => n(e.key, t)
340
+ }) : /* @__PURE__ */ A(x, {
341
341
  size: f,
342
342
  options: e.options ?? [],
343
- viewMode: v,
344
- onViewChange: (t) => r(e.key, t)
343
+ viewMode: g,
344
+ onViewChange: (t) => n(e.key, t)
345
345
  });
346
346
  else if (e.type === "toggle") {
347
- let [t, n] = e.labels ?? ["Off", "On"];
348
- e.labels ? c ? S = /* @__PURE__ */ j(l, {
347
+ let [t, r] = e.labels ?? ["Off", "On"];
348
+ e.labels ? o ? v = /* @__PURE__ */ A(S, {
349
349
  layout: "joined",
350
350
  tone: "sunken",
351
351
  size: f,
352
- className: `w-full ${o(f) ?? ""}`,
352
+ className: `w-full ${s(f) ?? ""}`,
353
353
  options: [{
354
354
  value: "off",
355
355
  label: t
356
356
  }, {
357
357
  value: "on",
358
- label: n
358
+ label: r
359
359
  }],
360
- value: v ? "on" : "off",
361
- onChange: (t) => r(e.key, t === "on")
362
- }) : (y = !1, S = /* @__PURE__ */ j(w, {
360
+ value: g ? "on" : "off",
361
+ onChange: (t) => n(e.key, t === "on")
362
+ }) : (_ = !1, v = /* @__PURE__ */ A(x, {
363
363
  size: f,
364
364
  options: [{
365
365
  value: "off",
366
366
  label: t
367
367
  }, {
368
368
  value: "on",
369
- label: n
369
+ label: r
370
370
  }],
371
- viewMode: v ? "on" : "off",
372
- onViewChange: (t) => r(e.key, t === "on")
373
- })) : (c || (y = !1), S = /* @__PURE__ */ j(b, {
371
+ viewMode: g ? "on" : "off",
372
+ onViewChange: (t) => n(e.key, t === "on")
373
+ })) : (o || (_ = !1), v = /* @__PURE__ */ A(C, {
374
374
  size: f,
375
- checked: !!v,
376
- onChange: (t) => r(e.key, t)
375
+ checked: !!g,
376
+ onChange: (t) => n(e.key, t)
377
377
  }));
378
- } else if (e.type === "text") y = !1, S = /* @__PURE__ */ j(n, {
378
+ } else if (e.type === "text") _ = !1, v = /* @__PURE__ */ A(y, {
379
379
  variant: "filled",
380
380
  size: f,
381
381
  rows: e.rows ?? 2,
382
382
  axis: "y",
383
- value: v ?? "",
384
- onChange: (t) => r(e.key, t.target.value),
383
+ value: g ?? "",
384
+ onChange: (t) => n(e.key, t.target.value),
385
385
  placeholder: e.placeholder
386
386
  });
387
387
  else return null;
388
- let T = e.type === "range" && e.format && typeof v == "number" && !a ? e.format(v) : void 0, E = s ? /* @__PURE__ */ M("div", {
388
+ let b = e.type === "range" && e.format && typeof g == "number" && !i ? e.format(g) : void 0, w = a ? /* @__PURE__ */ j("div", {
389
389
  className: "flex items-center gap-2",
390
- children: [/* @__PURE__ */ j("div", {
390
+ children: [/* @__PURE__ */ A("div", {
391
391
  className: "flex-1 min-w-0",
392
- children: S
393
- }), s]
394
- }) : S, D = e.type === "toggle" && !e.labels ? "end" : "fill", O = e.type === "toggle" && !e.labels && !c, k = (e) => m ? e : String(e).toUpperCase();
395
- return y && D === "end" && !T ? /* @__PURE__ */ j(g, {
392
+ children: v
393
+ }), a]
394
+ }) : v, T = e.type === "toggle" && !e.labels ? "end" : "fill", E = e.type === "toggle" && !e.labels && !o, D = (e) => String(e).toUpperCase();
395
+ return _ && T === "end" && !b ? /* @__PURE__ */ A(m, {
396
396
  horizontal: !0,
397
- label: k(e.label),
398
- labelWidth: K,
399
- children: /* @__PURE__ */ j("div", {
400
- className: `flex w-full items-center justify-end ${q[f] ?? ""}`,
401
- children: E
397
+ label: D(e.label),
398
+ labelWidth: G,
399
+ children: /* @__PURE__ */ A("div", {
400
+ className: `flex w-full items-center justify-end ${K[f] ?? ""}`,
401
+ children: w
402
402
  })
403
- }) : y ? /* @__PURE__ */ j(_, {
403
+ }) : _ ? /* @__PURE__ */ A(d, {
404
404
  label: e.label,
405
- hint: T,
406
- align: D,
407
- labelWidth: K,
408
- children: E
409
- }) : /* @__PURE__ */ j(g, {
410
- horizontal: O,
411
- label: c ? k(e.label) : e.label,
412
- hint: T,
413
- labelWidth: O ? "auto" : K,
414
- children: E
405
+ hint: b,
406
+ align: T,
407
+ labelWidth: G,
408
+ children: w
409
+ }) : /* @__PURE__ */ A(m, {
410
+ horizontal: E,
411
+ label: o ? D(e.label) : e.label,
412
+ hint: b,
413
+ labelWidth: E ? "auto" : G,
414
+ children: w
415
415
  });
416
416
  }
417
417
  //#endregion
418
418
  //#region src/editor/compose/useLayerEdit.js
419
- function Y(e, { history: t = "discrete", coalesceMs: n = 250 } = {}) {
420
- let { updateLayer: r, beginTransaction: i, commitTransaction: a } = s(), o = O(null), c = T(() => {
419
+ function J(e, { history: t = "discrete", coalesceMs: n = 250 } = {}) {
420
+ let { updateLayer: r, beginTransaction: i, commitTransaction: a } = c(), o = D(null), s = w(() => {
421
421
  o.current !== null && (clearTimeout(o.current), o.current = null, a());
422
- }, [a]), l = T((s) => {
422
+ }, [a]), l = w((s) => {
423
423
  if (e) {
424
424
  if (t === "discrete") {
425
425
  r(e, s);
@@ -440,16 +440,16 @@ function Y(e, { history: t = "discrete", coalesceMs: n = 250 } = {}) {
440
440
  r,
441
441
  i,
442
442
  a
443
- ]), u = T((e, t) => l({ [e]: t }), [l]);
444
- return E(() => () => c(), [c, e]), D(() => ({
443
+ ]), u = w((e, t) => l({ [e]: t }), [l]);
444
+ return T(() => () => s(), [s, e]), E(() => ({
445
445
  patch: l,
446
446
  setProp: u,
447
- flush: c
447
+ flush: s
448
448
  }), [
449
449
  l,
450
450
  u,
451
- c
451
+ s
452
452
  ]);
453
453
  }
454
454
  //#endregion
455
- export { I as a, V as c, F as i, R as l, U as n, P as o, H as r, z as s, Y as t };
455
+ export { F as a, B as c, P as i, L as l, H as n, N as o, V as r, R as s, J as t };