@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.
@@ -0,0 +1,127 @@
1
+ import { Bt as e, Ft as t, Ut as n, Vt as r, m as i, v as a } from "./rolls-CkmuE-Ya.js";
2
+ import { PopoverPanel as o, Tooltip as s, usePopover as c } from "@kolkrabbi/kol-component";
3
+ import { useEffect as l, useState as u } from "react";
4
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
5
+ //#region src/editor/params/dotVisibility.js
6
+ var m = "kol-editor-show-dots", h = !1;
7
+ try {
8
+ h = localStorage.getItem(m) === "1";
9
+ } catch {}
10
+ var g = /* @__PURE__ */ new Set();
11
+ function _() {
12
+ h = !h;
13
+ try {
14
+ localStorage.setItem(m, h ? "1" : "0");
15
+ } catch {}
16
+ g.forEach((e) => e(h));
17
+ }
18
+ function v() {
19
+ let [e, t] = u(h);
20
+ return l(() => {
21
+ let e = (e) => t(e);
22
+ return g.add(e), () => g.delete(e);
23
+ }, []), e;
24
+ }
25
+ //#endregion
26
+ //#region src/editor/params/BindDot.jsx
27
+ function y({ layer: l, param: m, setProp: h }) {
28
+ let [g, _] = u(!1), y = c({
29
+ open: g,
30
+ onOpenChange: _,
31
+ placement: "bottom-end",
32
+ offset: 4,
33
+ role: "menu"
34
+ }), b = v(), x = l[m.key], S = i(x), C = S ? x.bind === "track" ? "track" : x.source : "none";
35
+ if (!b && !S) return null;
36
+ let w = () => a(x, t.getCtx(), l) ?? m.default ?? 0, T = () => m.min != null && m.max != null ? [m.min, m.max] : [0, 1], E = (t) => {
37
+ if (_(!1), t === "none") h(m.key, w());
38
+ else if (t === "track") {
39
+ let e = w();
40
+ h(m.key, {
41
+ bind: "track",
42
+ keys: [{
43
+ t: 0,
44
+ v: e,
45
+ easing: "linear"
46
+ }, {
47
+ t: 1,
48
+ v: e,
49
+ easing: "linear"
50
+ }]
51
+ });
52
+ } else e(t)?.ensure?.().catch(() => {}), h(m.key, {
53
+ bind: "mod",
54
+ source: t,
55
+ transform: { range: T() }
56
+ });
57
+ }, D = m.type === "color" ? [] : r().filter((e) => !e.hidden), O = D.find((e) => n(e.id)), k = [
58
+ {
59
+ value: "none",
60
+ label: "Constant"
61
+ },
62
+ {
63
+ value: "track",
64
+ label: "Keyframes"
65
+ },
66
+ ...D.filter((e) => !n(e.id)).map((e) => ({
67
+ value: e.id,
68
+ label: e.label
69
+ })),
70
+ ...O ? [{
71
+ value: O.id,
72
+ label: "Joystick"
73
+ }] : []
74
+ ];
75
+ return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(s, {
76
+ label: S ? `Modulated (${C}) — shape it in the Animation tab` : "Modulate",
77
+ children: /* @__PURE__ */ f("button", {
78
+ ref: y.refs.setReference,
79
+ ...y.getReferenceProps(),
80
+ type: "button",
81
+ "aria-label": `Modulate ${m.label ?? m.key}`,
82
+ className: "inline-flex items-center justify-center w-5 h-5 rounded shrink-0",
83
+ style: {
84
+ border: "none",
85
+ background: "transparent",
86
+ cursor: "pointer"
87
+ },
88
+ children: /* @__PURE__ */ f("span", {
89
+ "aria-hidden": "true",
90
+ className: "rounded-full",
91
+ style: {
92
+ width: 7,
93
+ height: 7,
94
+ background: S ? "var(--kol-accent-primary)" : "transparent",
95
+ border: `1.5px solid ${S ? "var(--kol-accent-primary)" : "var(--kol-fg-48)"}`
96
+ }
97
+ })
98
+ })
99
+ }), /* @__PURE__ */ f(o, {
100
+ popover: y,
101
+ panel: !1,
102
+ focus: !1,
103
+ className: "z-50 bg-surface-secondary border border-oq-08 rounded shadow-lg",
104
+ style: {
105
+ maxHeight: "50vh",
106
+ overflowY: "auto",
107
+ overscrollBehavior: "contain"
108
+ },
109
+ children: /* @__PURE__ */ f("div", {
110
+ className: "w-[220px]",
111
+ children: k.map((e) => /* @__PURE__ */ p("button", {
112
+ type: "button",
113
+ onClick: () => E(e.value),
114
+ className: "w-full kol-helper-12 px-3 h-8 inline-flex items-center gap-2 text-body hover:text-emphasis text-left",
115
+ children: [/* @__PURE__ */ f("span", {
116
+ className: "flex-1 truncate",
117
+ children: e.label
118
+ }), /* @__PURE__ */ f("span", {
119
+ className: "kol-helper-10 text-emphasis shrink-0",
120
+ children: C === e.value ? "✓" : ""
121
+ })]
122
+ }, e.value))
123
+ })
124
+ })] });
125
+ }
126
+ //#endregion
127
+ export { _ as n, y as t };
@@ -1,5 +1,5 @@
1
- import { Jt as e, Kt as t, Wt as n, Yt as r, h as i, qt as a, t as o, zt as s } from "./EditorIcon-BbFMmc1G.js";
2
- import { Button as c, Dropdown as l, Input as u, LabeledControl as d, Section as f, Slider as p, Stepper as m, ViewToggle as h } from "@kolkrabbi/kol-component";
1
+ import { Bt as e, Ft as t, Gt as n, Ht as r, Ut as i, Wt as a, m as o } from "./rolls-CkmuE-Ya.js";
2
+ import { Button as s, Dropdown as c, Input as l, LabeledControl as u, Section as d, Slider as f, Stepper as p, Tooltip as m, ViewToggle as h } from "@kolkrabbi/kol-component";
3
3
  import { useEffect as g, useRef as _, useState as v } from "react";
4
4
  import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
5
5
  //#region src/editor/params/ModulationEditor.jsx
@@ -40,52 +40,52 @@ var S = [
40
40
  function T({ expr: e }) {
41
41
  let n = _(null);
42
42
  return g(() => {
43
- let r = n.current;
44
- if (!r) return;
45
- let i = Math.min(2, window.devicePixelRatio || 1);
46
- r.width = C * i, r.height = w * i;
47
- let a = r.getContext("2d");
48
- a.setTransform(i, 0, 0, i, 0, 0);
49
- let o = 0, c = () => {
50
- o = requestAnimationFrame(c);
51
- let n = getComputedStyle(r), i = n.getPropertyValue("--kol-accent-primary").trim() || "#2dd4bf", l = n.color || "rgb(160,160,160)", u = t(e), d = s.getLoopSeconds(), f = s.getCtx().t ?? 0, p = C - 12, m = w - 12;
52
- a.clearRect(0, 0, C, w);
43
+ let i = n.current;
44
+ if (!i) return;
45
+ let a = Math.min(2, window.devicePixelRatio || 1);
46
+ i.width = C * a, i.height = w * a;
47
+ let o = i.getContext("2d");
48
+ o.setTransform(a, 0, 0, a, 0, 0);
49
+ let s = 0, c = () => {
50
+ s = requestAnimationFrame(c);
51
+ let n = getComputedStyle(i), a = n.getPropertyValue("--kol-accent-primary").trim() || "#2dd4bf", l = n.color || "rgb(160,160,160)", u = r(e), d = t.getLoopSeconds(), f = t.getCtx().t ?? 0, p = C - 12, m = w - 12;
52
+ o.clearRect(0, 0, C, w);
53
53
  let h = p, g = new Float64Array(185), _ = Infinity, v = -Infinity;
54
54
  for (let e = 0; e <= h; e++) {
55
55
  let t = u.ok ? u.fn(e / h * d) : 0;
56
56
  g[e] = t, t < _ && (_ = t), t > v && (v = t);
57
57
  }
58
58
  let y = (_ + v) / 2, b = Math.min(_, 0), x = Math.max(v, 1) - b || 1, S = (e) => 6 + m * (1 - (e - b) / x), T = (e) => 6 + e / h * p;
59
- a.strokeStyle = "rgba(231,76,60,0.35)", a.lineWidth = 1, a.setLineDash([4, 4]);
59
+ o.strokeStyle = "rgba(231,76,60,0.35)", o.lineWidth = 1, o.setLineDash([4, 4]);
60
60
  for (let e of [0, 1]) {
61
61
  let t = S(e);
62
- a.beginPath(), a.moveTo(6, t), a.lineTo(C - 6, t), a.stroke();
62
+ o.beginPath(), o.moveTo(6, t), o.lineTo(C - 6, t), o.stroke();
63
63
  }
64
- if (a.setLineDash([]), u.ok) {
65
- a.font = "8px var(--kol-font-family-mono, monospace)", a.strokeStyle = l, a.fillStyle = l;
64
+ if (o.setLineDash([]), u.ok) {
65
+ o.font = "8px var(--kol-font-family-mono, monospace)", o.strokeStyle = l, o.fillStyle = l;
66
66
  for (let e of [
67
67
  v,
68
68
  y,
69
69
  _
70
70
  ]) {
71
71
  let t = S(e);
72
- a.globalAlpha = .12, a.beginPath(), a.moveTo(6, t), a.lineTo(C - 6, t), a.stroke(), a.globalAlpha = .5, a.fillText(e.toFixed(2), 8, t - 2);
72
+ o.globalAlpha = .12, o.beginPath(), o.moveTo(6, t), o.lineTo(C - 6, t), o.stroke(), o.globalAlpha = .5, o.fillText(e.toFixed(2), 8, t - 2);
73
73
  }
74
- a.globalAlpha = 1;
74
+ o.globalAlpha = 1;
75
75
  let e = (e) => {
76
- a.beginPath();
76
+ o.beginPath();
77
77
  for (let t = 0; t <= e; t++) {
78
78
  let e = S(g[t]);
79
- t === 0 ? a.moveTo(T(0), e) : a.lineTo(T(t), e);
79
+ t === 0 ? o.moveTo(T(0), e) : o.lineTo(T(t), e);
80
80
  }
81
- a.stroke();
81
+ o.stroke();
82
82
  };
83
- a.strokeStyle = i, a.lineWidth = 1, a.globalAlpha = .25, e(h);
83
+ o.strokeStyle = a, o.lineWidth = 1, o.globalAlpha = .25, e(h);
84
84
  let t = 6 + f * p;
85
- a.globalAlpha = .4, a.beginPath(), a.moveTo(t, 6), a.lineTo(t, w - 6), a.stroke(), a.globalAlpha = 1, a.lineWidth = 1.5, e(Math.round(f * h)), a.fillStyle = i, a.beginPath(), a.arc(t, S(u.fn(f * d)), 2.5, 0, Math.PI * 2), a.fill();
85
+ o.globalAlpha = .4, o.beginPath(), o.moveTo(t, 6), o.lineTo(t, w - 6), o.stroke(), o.globalAlpha = 1, o.lineWidth = 1.5, e(Math.round(f * h)), o.fillStyle = a, o.beginPath(), o.arc(t, S(u.fn(f * d)), 2.5, 0, Math.PI * 2), o.fill();
86
86
  }
87
87
  };
88
- return c(), () => cancelAnimationFrame(o);
88
+ return c(), () => cancelAnimationFrame(s);
89
89
  }, [e]), /* @__PURE__ */ b("canvas", {
90
90
  ref: n,
91
91
  "aria-label": "Expression plot over one loop",
@@ -94,47 +94,47 @@ function T({ expr: e }) {
94
94
  height: w,
95
95
  display: "block",
96
96
  borderRadius: 3,
97
- background: "var(--kol-fg-04, rgba(128,128,128,0.06))"
97
+ background: "var(--kol-oq-04)"
98
98
  }
99
99
  });
100
100
  }
101
- function E({ layer: t, param: o, setProp: s }) {
102
- let c = t[o.key], [l, f] = v(null), [m, g] = v(!1), [_, C] = v(!1);
103
- if (!i(c) || c.bind !== "mod") return null;
104
- let w = c.source, E = c.transform ?? {}, D = w.startsWith("lfo-"), O = w === "midi", k = a(w), A = w === "expr", j = E.expr ?? "wave(t)", M = (e) => s(o.key, {
101
+ function E({ layer: t, param: r, setProp: s }) {
102
+ let c = t[r.key], [d, p] = v(null), [m, g] = v(!1), [_, C] = v(!1);
103
+ if (!o(c) || c.bind !== "mod") return null;
104
+ let w = c.source, E = c.transform ?? {}, D = w.startsWith("lfo-"), O = w === "midi", k = i(w), A = w === "expr", j = E.expr ?? "wave(t)", M = (e) => s(r.key, {
105
105
  ...c,
106
106
  transform: {
107
107
  ...E,
108
108
  ...e
109
109
  }
110
110
  }), N = (e) => {
111
- f(null);
111
+ p(null);
112
112
  let t = String(e).trim();
113
113
  t && t !== j && M({ expr: t });
114
114
  }, P = async () => {
115
115
  g(!0);
116
- let e = await r();
116
+ let e = await n();
117
117
  g(!1), e != null && M({ cc: e });
118
118
  }, F = async () => {
119
119
  C(!0);
120
- let t = await e();
121
- C(!1), t && s(o.key, {
120
+ let e = await a();
121
+ C(!1), e && s(r.key, {
122
122
  ...c,
123
- source: t
123
+ source: e
124
124
  });
125
- }, I = E.range ?? (o.min != null && o.max != null ? [o.min, o.max] : [0, 1]), L = (e, t) => {
125
+ }, I = E.range ?? (r.min != null && r.max != null ? [r.min, r.max] : [0, 1]), L = (e, t) => {
126
126
  let n = Number(e);
127
127
  return Number.isFinite(n) ? n : t;
128
128
  };
129
129
  return /* @__PURE__ */ x("div", {
130
130
  className: "flex flex-col gap-3",
131
131
  children: [
132
- /* @__PURE__ */ b(d, {
132
+ /* @__PURE__ */ b(u, {
133
133
  label: "Range",
134
134
  children: /* @__PURE__ */ x("div", {
135
135
  className: "flex items-center gap-2",
136
136
  children: [
137
- /* @__PURE__ */ b(u, {
137
+ /* @__PURE__ */ b(l, {
138
138
  variant: "filled",
139
139
  size: "sm",
140
140
  type: "number",
@@ -146,7 +146,7 @@ function E({ layer: t, param: o, setProp: s }) {
146
146
  className: "kol-helper-10 text-meta",
147
147
  children: "to"
148
148
  }),
149
- /* @__PURE__ */ b(u, {
149
+ /* @__PURE__ */ b(l, {
150
150
  variant: "filled",
151
151
  size: "sm",
152
152
  type: "number",
@@ -159,7 +159,7 @@ function E({ layer: t, param: o, setProp: s }) {
159
159
  }),
160
160
  /* @__PURE__ */ x("div", {
161
161
  className: "grid grid-cols-2 gap-2",
162
- children: [/* @__PURE__ */ b(d, {
162
+ children: [/* @__PURE__ */ b(u, {
163
163
  label: "Invert",
164
164
  children: /* @__PURE__ */ b(h, {
165
165
  options: [{
@@ -172,9 +172,9 @@ function E({ layer: t, param: o, setProp: s }) {
172
172
  viewMode: E?.invert ? "on" : "off",
173
173
  onViewChange: (e) => M({ invert: e === "on" })
174
174
  })
175
- }), /* @__PURE__ */ b(d, {
175
+ }), /* @__PURE__ */ b(u, {
176
176
  label: "Smooth",
177
- children: /* @__PURE__ */ b(p, {
177
+ children: /* @__PURE__ */ b(f, {
178
178
  min: 0,
179
179
  max: .95,
180
180
  step: .05,
@@ -183,9 +183,9 @@ function E({ layer: t, param: o, setProp: s }) {
183
183
  })
184
184
  })]
185
185
  }),
186
- /* @__PURE__ */ b(d, {
186
+ /* @__PURE__ */ b(u, {
187
187
  label: "Curve",
188
- children: /* @__PURE__ */ b(p, {
188
+ children: /* @__PURE__ */ b(f, {
189
189
  min: .25,
190
190
  max: 4,
191
191
  step: .05,
@@ -195,18 +195,18 @@ function E({ layer: t, param: o, setProp: s }) {
195
195
  }),
196
196
  D && /* @__PURE__ */ x("div", {
197
197
  className: "grid grid-cols-2 gap-2",
198
- children: [/* @__PURE__ */ b(d, {
198
+ children: [/* @__PURE__ */ b(u, {
199
199
  label: "Rate · cycles",
200
- children: /* @__PURE__ */ b(p, {
200
+ children: /* @__PURE__ */ b(f, {
201
201
  min: .25,
202
202
  max: 16,
203
203
  step: .25,
204
204
  value: E?.rate ?? 1,
205
205
  onChange: (e) => M({ rate: e })
206
206
  })
207
- }), /* @__PURE__ */ b(d, {
207
+ }), /* @__PURE__ */ b(u, {
208
208
  label: "Phase",
209
- children: /* @__PURE__ */ b(p, {
209
+ children: /* @__PURE__ */ b(f, {
210
210
  min: 0,
211
211
  max: 1,
212
212
  step: .01,
@@ -216,13 +216,13 @@ function E({ layer: t, param: o, setProp: s }) {
216
216
  })]
217
217
  }),
218
218
  A && /* @__PURE__ */ x(y, { children: [
219
- /* @__PURE__ */ b(d, {
219
+ /* @__PURE__ */ b(u, {
220
220
  label: "Expression",
221
- children: /* @__PURE__ */ b(u, {
221
+ children: /* @__PURE__ */ b(l, {
222
222
  variant: "ghost",
223
223
  size: "sm",
224
- value: l ?? j,
225
- onChange: (e) => f(e.target.value),
224
+ value: d ?? j,
225
+ onChange: (e) => p(e.target.value),
226
226
  onBlur: (e) => N(e.target.value),
227
227
  onKeyDown: (e) => {
228
228
  e.key === "Enter" && e.currentTarget.blur();
@@ -253,7 +253,7 @@ function E({ layer: t, param: o, setProp: s }) {
253
253
  }, e.code))
254
254
  })
255
255
  ] }),
256
- O && /* @__PURE__ */ b(d, {
256
+ O && /* @__PURE__ */ b(u, {
257
257
  label: E?.cc == null ? "MIDI · no CC yet" : `MIDI · CC ${E.cc}`,
258
258
  children: /* @__PURE__ */ b("button", {
259
259
  type: "button",
@@ -266,8 +266,8 @@ function E({ layer: t, param: o, setProp: s }) {
266
266
  children: m ? "Move a knob…" : "Learn"
267
267
  })
268
268
  }),
269
- k && /* @__PURE__ */ b(d, {
270
- label: n(w)?.label ?? "Gamepad",
269
+ k && /* @__PURE__ */ b(u, {
270
+ label: e(w)?.label ?? "Gamepad",
271
271
  children: /* @__PURE__ */ b("button", {
272
272
  type: "button",
273
273
  onClick: F,
@@ -282,35 +282,35 @@ function E({ layer: t, param: o, setProp: s }) {
282
282
  ]
283
283
  });
284
284
  }
285
- function D({ layer: e, schema: t, setProp: r }) {
286
- let a = (t ?? []).filter((t) => {
287
- let n = e[t.key];
288
- return i(n) && n.bind === "mod";
285
+ function D({ layer: t, schema: n, setProp: r }) {
286
+ let i = (n ?? []).filter((e) => {
287
+ let n = t[e.key];
288
+ return o(n) && n.bind === "mod";
289
289
  });
290
- return a.length === 0 ? null : /* @__PURE__ */ x("div", {
290
+ return i.length === 0 ? null : /* @__PURE__ */ x("div", {
291
291
  className: "flex flex-col gap-4",
292
292
  children: [/* @__PURE__ */ b("span", {
293
293
  className: "kol-helper-10 text-meta",
294
294
  children: "Modulation"
295
- }), a.map((t) => {
296
- let i = n(e[t.key].source);
295
+ }), i.map((n) => {
296
+ let i = e(t[n.key].source);
297
297
  return /* @__PURE__ */ x("div", {
298
298
  className: "flex flex-col gap-2 pt-3 border-t border-oq-08",
299
299
  children: [/* @__PURE__ */ x("div", {
300
300
  className: "flex items-center justify-between",
301
301
  children: [/* @__PURE__ */ b("span", {
302
302
  className: "kol-helper-12 text-emphasis",
303
- children: t.label ?? t.key
303
+ children: n.label ?? n.key
304
304
  }), /* @__PURE__ */ b("span", {
305
305
  className: "kol-helper-10 text-meta",
306
- children: i?.label ?? e[t.key].source
306
+ children: i?.label ?? t[n.key].source
307
307
  })]
308
308
  }), /* @__PURE__ */ b(E, {
309
- layer: e,
310
- param: t,
309
+ layer: t,
310
+ param: n,
311
311
  setProp: r
312
312
  })]
313
- }, t.key);
313
+ }, n.key);
314
314
  })]
315
315
  });
316
316
  }
@@ -405,7 +405,7 @@ var O = [
405
405
  opacity: Math.random() > .7 ? .4 + Math.random() * .6 : 1
406
406
  });
407
407
  function L({ value: e, onChange: t, min: n = 0, max: r = 99 }) {
408
- return /* @__PURE__ */ b(m, {
408
+ return /* @__PURE__ */ b(p, {
409
409
  size: "sm",
410
410
  value: e,
411
411
  min: n,
@@ -415,20 +415,23 @@ function L({ value: e, onChange: t, min: n = 0, max: r = 99 }) {
415
415
  });
416
416
  }
417
417
  function R({ active: e, onClick: t, children: n, title: r }) {
418
- return /* @__PURE__ */ b(c, {
419
- variant: e ? "primary" : "outline",
420
- size: "sm",
421
- onClick: t,
422
- title: r,
423
- "aria-pressed": e,
424
- children: n
418
+ return /* @__PURE__ */ b(m, {
419
+ label: r,
420
+ children: /* @__PURE__ */ b(s, {
421
+ "aria-label": r,
422
+ variant: e ? "primary" : "outline",
423
+ size: "sm",
424
+ onClick: t,
425
+ "aria-pressed": e,
426
+ children: n
427
+ })
425
428
  });
426
429
  }
427
430
  function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
428
431
  let i = (n) => t({
429
432
  ...e,
430
433
  ...n
431
- }), a = e.selectKind === "every-col" || e.selectKind === "every-row" || e.selectKind === "every-nth" || e.selectKind === "both", s = e.selectKind === "both", d = e.selectKind === "expression";
434
+ }), a = e.selectKind === "every-col" || e.selectKind === "every-row" || e.selectKind === "every-nth" || e.selectKind === "both", o = e.selectKind === "both", u = e.selectKind === "expression";
432
435
  return /* @__PURE__ */ x("div", {
433
436
  className: "flex flex-col gap-2 p-2 border border-oq-08 rounded",
434
437
  children: [
@@ -437,7 +440,7 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
437
440
  children: [
438
441
  /* @__PURE__ */ b("div", {
439
442
  className: "flex-1 min-w-0",
440
- children: /* @__PURE__ */ b(l, {
443
+ children: /* @__PURE__ */ b(c, {
441
444
  variant: "subtle",
442
445
  size: "sm",
443
446
  className: "w-full",
@@ -446,41 +449,44 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
446
449
  onChange: (e) => i({ selectKind: e })
447
450
  })
448
451
  }),
449
- /* @__PURE__ */ b(c, {
450
- iconComponent: o,
451
- variant: "ghost",
452
- size: "sm",
453
- iconOnly: "refresh",
454
- iconSize: 12,
455
- onClick: r,
456
- "aria-label": "Re-randomize rule",
457
- title: "Re-randomize this rule",
458
- className: "shrink-0",
459
- style: { padding: 6 }
452
+ /* @__PURE__ */ b(m, {
453
+ label: "Re-randomize this rule",
454
+ children: /* @__PURE__ */ b(s, {
455
+ variant: "ghost",
456
+ size: "sm",
457
+ iconOnly: "refresh",
458
+ iconSize: 12,
459
+ onClick: r,
460
+ "aria-label": "Re-randomize rule",
461
+ className: "shrink-0",
462
+ style: { padding: 6 }
463
+ })
460
464
  }),
461
- /* @__PURE__ */ b(c, {
462
- iconComponent: o,
463
- variant: "ghost",
464
- size: "sm",
465
- iconOnly: "close",
466
- iconSize: 12,
467
- onClick: n,
468
- "aria-label": "Remove rule",
469
- className: "shrink-0",
470
- style: { padding: 6 }
465
+ /* @__PURE__ */ b(m, {
466
+ label: "Remove rule",
467
+ children: /* @__PURE__ */ b(s, {
468
+ variant: "ghost",
469
+ size: "sm",
470
+ iconOnly: "x",
471
+ iconSize: 12,
472
+ onClick: n,
473
+ "aria-label": "Remove rule",
474
+ className: "shrink-0",
475
+ style: { padding: 6 }
476
+ })
471
477
  })
472
478
  ]
473
479
  }),
474
480
  a && /* @__PURE__ */ x("div", {
475
481
  className: "grid grid-cols-2 gap-2",
476
- children: [/* @__PURE__ */ b(f, {
482
+ children: [/* @__PURE__ */ b(d, {
477
483
  label: "N",
478
484
  children: /* @__PURE__ */ b(L, {
479
485
  value: e.n,
480
486
  onChange: (e) => i({ n: e }),
481
487
  min: 1
482
488
  })
483
- }), /* @__PURE__ */ b(f, {
489
+ }), /* @__PURE__ */ b(d, {
484
490
  label: "Offset",
485
491
  children: /* @__PURE__ */ b(L, {
486
492
  value: e.offset,
@@ -488,16 +494,16 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
488
494
  })
489
495
  })]
490
496
  }),
491
- s && /* @__PURE__ */ x("div", {
497
+ o && /* @__PURE__ */ x("div", {
492
498
  className: "grid grid-cols-2 gap-2",
493
- children: [/* @__PURE__ */ b(f, {
499
+ children: [/* @__PURE__ */ b(d, {
494
500
  label: "Row N",
495
501
  children: /* @__PURE__ */ b(L, {
496
502
  value: e.n2,
497
503
  onChange: (e) => i({ n2: e }),
498
504
  min: 1
499
505
  })
500
- }), /* @__PURE__ */ b(f, {
506
+ }), /* @__PURE__ */ b(d, {
501
507
  label: "Row offset",
502
508
  children: /* @__PURE__ */ b(L, {
503
509
  value: e.offset2,
@@ -505,10 +511,10 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
505
511
  })
506
512
  })]
507
513
  }),
508
- d && /* @__PURE__ */ x(f, {
514
+ u && /* @__PURE__ */ x(d, {
509
515
  label: "Expression",
510
516
  hint: "matches when > 0",
511
- children: [/* @__PURE__ */ b(u, {
517
+ children: [/* @__PURE__ */ b(l, {
512
518
  variant: "filled",
513
519
  size: "sm",
514
520
  value: e.expression,
@@ -521,14 +527,14 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
521
527
  }),
522
528
  /* @__PURE__ */ x("div", {
523
529
  className: "grid grid-cols-2 gap-2",
524
- children: [/* @__PURE__ */ b(f, {
530
+ children: [/* @__PURE__ */ b(d, {
525
531
  label: "Group W",
526
532
  children: /* @__PURE__ */ b(L, {
527
533
  value: e.groupW,
528
534
  onChange: (e) => i({ groupW: Math.max(1, e) }),
529
535
  min: 1
530
536
  })
531
- }), /* @__PURE__ */ b(f, {
537
+ }), /* @__PURE__ */ b(d, {
532
538
  label: "Group H",
533
539
  children: /* @__PURE__ */ b(L, {
534
540
  value: e.groupH,
@@ -540,7 +546,7 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
540
546
  /* @__PURE__ */ x("div", {
541
547
  className: "flex flex-wrap gap-1",
542
548
  children: [
543
- /* @__PURE__ */ b(l, {
549
+ /* @__PURE__ */ b(c, {
544
550
  variant: "subtle",
545
551
  size: "sm",
546
552
  options: k,
@@ -567,10 +573,10 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
567
573
  })
568
574
  ]
569
575
  }),
570
- /* @__PURE__ */ b(f, {
576
+ /* @__PURE__ */ b(d, {
571
577
  label: "Opacity",
572
578
  hint: `${Math.round(e.opacity * 100)}%`,
573
- children: /* @__PURE__ */ b(p, {
579
+ children: /* @__PURE__ */ b(f, {
574
580
  min: 0,
575
581
  max: 100,
576
582
  value: Math.round(e.opacity * 100),
@@ -1,4 +1,4 @@
1
- import { C as e } from "./EditorIcon-BbFMmc1G.js";
1
+ import { S as e } from "./rolls-CkmuE-Ya.js";
2
2
  import { Dropdown as t, LabeledControl as n, SettingsRow as r, embedFontFace as i } from "@kolkrabbi/kol-component";
3
3
  import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
4
4
  //#region src/loops/lib/util.js