@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.
- package/dist/BindDot-CuCS4LS-.js +127 -0
- package/dist/{RuleRow-D0nV-GvB.js → RuleRow-DlouS36V.js} +115 -109
- package/dist/{TreePicker-DlEXH2kw.js → TreePicker-D5XZT0Zi.js} +1 -1
- package/dist/{core-EQZBciYo.js → core-B78-YLQh.js} +3630 -5555
- package/dist/core.js +3 -3
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +564 -532
- package/dist/{effects-C0ojfSm8.js → effects-B743CHEU.js} +511 -501
- package/dist/effects.js +1 -1
- package/dist/{generators-RjXuwET7.js → generators-B0uhjxUs.js} +488 -867
- package/dist/generators.js +1 -1
- package/dist/{host-BMD1sgpp.js → host-bXQMgZeW.js} +4 -4
- package/dist/{motion-ejcDWbeh.js → motion-9j3WO6a2.js} +628 -724
- package/dist/motion.js +1 -1
- package/dist/{registry-C7rLJN2U.js → registry-CSOtIU7o.js} +35 -35
- package/dist/{EditorIcon-BbFMmc1G.js → rolls-CkmuE-Ya.js} +1826 -1914
- package/dist/{src-BOZt8ciR.js → src-DFtETCsY.js} +1 -1
- package/dist/{useLayerEdit-BElo4uVW.js → useLayerEdit-BDXtPeAP.js} +69 -67
- package/package.json +8 -8
- package/dist/BindDot-xnv1FDLI.js +0 -125
|
@@ -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 {
|
|
2
|
-
import { Button as
|
|
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
|
|
44
|
-
if (!
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
let n = getComputedStyle(
|
|
52
|
-
|
|
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
|
-
|
|
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
|
-
|
|
62
|
+
o.beginPath(), o.moveTo(6, t), o.lineTo(C - 6, t), o.stroke();
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
65
|
-
|
|
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
|
-
|
|
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
|
-
|
|
74
|
+
o.globalAlpha = 1;
|
|
75
75
|
let e = (e) => {
|
|
76
|
-
|
|
76
|
+
o.beginPath();
|
|
77
77
|
for (let t = 0; t <= e; t++) {
|
|
78
78
|
let e = S(g[t]);
|
|
79
|
-
t === 0 ?
|
|
79
|
+
t === 0 ? o.moveTo(T(0), e) : o.lineTo(T(t), e);
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
o.stroke();
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
o.strokeStyle = a, o.lineWidth = 1, o.globalAlpha = .25, e(h);
|
|
84
84
|
let t = 6 + f * p;
|
|
85
|
-
|
|
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(
|
|
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-
|
|
97
|
+
background: "var(--kol-oq-04)"
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
function E({ layer: t, param:
|
|
102
|
-
let c = t[
|
|
103
|
-
if (!
|
|
104
|
-
let w = c.source, E = c.transform ?? {}, D = w.startsWith("lfo-"), O = w === "midi", k =
|
|
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
|
-
|
|
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
|
|
116
|
+
let e = await n();
|
|
117
117
|
g(!1), e != null && M({ cc: e });
|
|
118
118
|
}, F = async () => {
|
|
119
119
|
C(!0);
|
|
120
|
-
let
|
|
121
|
-
C(!1),
|
|
120
|
+
let e = await a();
|
|
121
|
+
C(!1), e && s(r.key, {
|
|
122
122
|
...c,
|
|
123
|
-
source:
|
|
123
|
+
source: e
|
|
124
124
|
});
|
|
125
|
-
}, I = E.range ?? (
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
175
|
+
}), /* @__PURE__ */ b(u, {
|
|
176
176
|
label: "Smooth",
|
|
177
|
-
children: /* @__PURE__ */ b(
|
|
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(
|
|
186
|
+
/* @__PURE__ */ b(u, {
|
|
187
187
|
label: "Curve",
|
|
188
|
-
children: /* @__PURE__ */ b(
|
|
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(
|
|
198
|
+
children: [/* @__PURE__ */ b(u, {
|
|
199
199
|
label: "Rate · cycles",
|
|
200
|
-
children: /* @__PURE__ */ b(
|
|
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(
|
|
207
|
+
}), /* @__PURE__ */ b(u, {
|
|
208
208
|
label: "Phase",
|
|
209
|
-
children: /* @__PURE__ */ b(
|
|
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(
|
|
219
|
+
/* @__PURE__ */ b(u, {
|
|
220
220
|
label: "Expression",
|
|
221
|
-
children: /* @__PURE__ */ b(
|
|
221
|
+
children: /* @__PURE__ */ b(l, {
|
|
222
222
|
variant: "ghost",
|
|
223
223
|
size: "sm",
|
|
224
|
-
value:
|
|
225
|
-
onChange: (e) =>
|
|
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(
|
|
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(
|
|
270
|
-
label:
|
|
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:
|
|
286
|
-
let
|
|
287
|
-
let n = e
|
|
288
|
-
return
|
|
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
|
|
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
|
-
}),
|
|
296
|
-
let i =
|
|
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:
|
|
303
|
+
children: n.label ?? n.key
|
|
304
304
|
}), /* @__PURE__ */ b("span", {
|
|
305
305
|
className: "kol-helper-10 text-meta",
|
|
306
|
-
children: i?.label ??
|
|
306
|
+
children: i?.label ?? t[n.key].source
|
|
307
307
|
})]
|
|
308
308
|
}), /* @__PURE__ */ b(E, {
|
|
309
|
-
layer:
|
|
310
|
-
param:
|
|
309
|
+
layer: t,
|
|
310
|
+
param: n,
|
|
311
311
|
setProp: r
|
|
312
312
|
})]
|
|
313
|
-
},
|
|
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(
|
|
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(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
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",
|
|
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(
|
|
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(
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
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(
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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(
|
|
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(
|
|
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
|
-
|
|
497
|
+
o && /* @__PURE__ */ x("div", {
|
|
492
498
|
className: "grid grid-cols-2 gap-2",
|
|
493
|
-
children: [/* @__PURE__ */ b(
|
|
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(
|
|
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
|
-
|
|
514
|
+
u && /* @__PURE__ */ x(d, {
|
|
509
515
|
label: "Expression",
|
|
510
516
|
hint: "matches when > 0",
|
|
511
|
-
children: [/* @__PURE__ */ b(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
576
|
+
/* @__PURE__ */ b(d, {
|
|
571
577
|
label: "Opacity",
|
|
572
578
|
hint: `${Math.round(e.opacity * 100)}%`,
|
|
573
|
-
children: /* @__PURE__ */ b(
|
|
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 {
|
|
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
|