@kolkrabbi/design-editor 0.20.0 → 0.21.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/{RuleRow-DNVlUgGV.js → RuleRow-BXkjpTyN.js} +136 -76
- package/dist/TreePicker-DLmMl0aU.js +68 -0
- package/dist/{core-BWSY6z9e.js → core-B2bfXyS5.js} +2514 -2146
- package/dist/core.js +3 -3
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +986 -1254
- package/dist/{effects-At3W3Ak1.js → effectCategories-BcaQSD_V.js} +734 -1076
- package/dist/effects-pCd8YTdQ.js +469 -0
- package/dist/effects.js +1 -1
- package/dist/{generators-C4R15Cgp.js → generators-B8_StNAy.js} +261 -322
- package/dist/generators.js +1 -1
- package/dist/{host-BE7dtdx9.js → host-B4SRaN9h.js} +170 -171
- package/dist/labels-B5qkocWy.js +2007 -0
- package/dist/motion-DFnAar_2.js +2263 -0
- package/dist/motion.js +1 -1
- package/dist/{rolls-CkmuE-Ya.js → rolls-Bg1XHuvJ.js} +2198 -1963
- package/dist/{src-DFtETCsY.js → src-B5fQgAVE.js} +1 -1
- package/dist/{registry-CSOtIU7o.js → useLayerEdit-ieOjHx6x.js} +2873 -2619
- package/package.json +5 -5
- package/dist/BindDot-CuCS4LS-.js +0 -127
- package/dist/TreePicker-D5XZT0Zi.js +0 -303
- package/dist/labels-B10g9Um5.js +0 -40
- package/dist/motion-CntX25g3.js +0 -4229
- package/dist/useLayerEdit-B-NfMWe-.js +0 -257
|
@@ -1,9 +1,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gt as e, Jt as t, Kt as n, Rt as r, Ut as i, m as a, qt as o } from "./rolls-Bg1XHuvJ.js";
|
|
2
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
|
-
//#region src/
|
|
5
|
+
//#region src/loops/taxonomy.js
|
|
6
6
|
var S = [
|
|
7
|
+
{
|
|
8
|
+
label: "Scanline",
|
|
9
|
+
groups: ["scanline"]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "Pattern",
|
|
13
|
+
groups: ["pattern"]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "Loops",
|
|
17
|
+
groups: [
|
|
18
|
+
"shape",
|
|
19
|
+
"field",
|
|
20
|
+
"patternloop"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: "Math",
|
|
25
|
+
groups: ["math"]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: "Penrose",
|
|
29
|
+
groups: ["penrose"]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "Drift",
|
|
33
|
+
groups: ["drift"]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "Gradients",
|
|
37
|
+
groups: ["gradients"]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: "Soft Forms",
|
|
41
|
+
groups: ["softforms"]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "Soft Forms 3D",
|
|
45
|
+
groups: ["softforms3d"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: "3D Scene",
|
|
49
|
+
groups: [
|
|
50
|
+
"scene",
|
|
51
|
+
"ribbon",
|
|
52
|
+
"forms",
|
|
53
|
+
"environment",
|
|
54
|
+
"abstract"
|
|
55
|
+
],
|
|
56
|
+
labels: { scene: "Primitive" }
|
|
57
|
+
}
|
|
58
|
+
], C = [{
|
|
59
|
+
label: "Para Type",
|
|
60
|
+
groups: ["paratype"]
|
|
61
|
+
}], w = S, T = {
|
|
62
|
+
optic: "Pattern · Effects",
|
|
63
|
+
paratype: "Para Type · Misc",
|
|
64
|
+
distress: "Distressor · Vector",
|
|
65
|
+
modulator: "Modulator · Vector"
|
|
66
|
+
}, E = [
|
|
7
67
|
{
|
|
8
68
|
code: "wave(t*2)",
|
|
9
69
|
desc: "Fast sine"
|
|
@@ -36,30 +96,30 @@ var S = [
|
|
|
36
96
|
code: "rand()",
|
|
37
97
|
desc: "Noise"
|
|
38
98
|
}
|
|
39
|
-
],
|
|
40
|
-
function
|
|
99
|
+
], D = 196, O = 64;
|
|
100
|
+
function k({ expr: t }) {
|
|
41
101
|
let n = _(null);
|
|
42
102
|
return g(() => {
|
|
43
103
|
let i = n.current;
|
|
44
104
|
if (!i) return;
|
|
45
105
|
let a = Math.min(2, window.devicePixelRatio || 1);
|
|
46
|
-
i.width =
|
|
106
|
+
i.width = D * a, i.height = O * a;
|
|
47
107
|
let o = i.getContext("2d");
|
|
48
108
|
o.setTransform(a, 0, 0, a, 0, 0);
|
|
49
109
|
let s = 0, c = () => {
|
|
50
110
|
s = requestAnimationFrame(c);
|
|
51
|
-
let n = getComputedStyle(i), a = n.getPropertyValue("--kol-accent-primary").trim() || "#2dd4bf", l = n.color || "rgb(160,160,160)", u =
|
|
52
|
-
o.clearRect(0, 0,
|
|
111
|
+
let n = getComputedStyle(i), a = n.getPropertyValue("--kol-accent-primary").trim() || "#2dd4bf", l = n.color || "rgb(160,160,160)", u = e(t), d = r.getLoopSeconds(), f = r.getCtx().t ?? 0, p = D - 12, m = O - 12;
|
|
112
|
+
o.clearRect(0, 0, D, O);
|
|
53
113
|
let h = p, g = new Float64Array(185), _ = Infinity, v = -Infinity;
|
|
54
114
|
for (let e = 0; e <= h; e++) {
|
|
55
115
|
let t = u.ok ? u.fn(e / h * d) : 0;
|
|
56
116
|
g[e] = t, t < _ && (_ = t), t > v && (v = t);
|
|
57
117
|
}
|
|
58
|
-
let y = (_ + v) / 2, b = Math.min(_, 0), x = Math.max(v, 1) - b || 1, S = (e) => 6 + m * (1 - (e - b) / x),
|
|
118
|
+
let y = (_ + v) / 2, b = Math.min(_, 0), x = Math.max(v, 1) - b || 1, S = (e) => 6 + m * (1 - (e - b) / x), C = (e) => 6 + e / h * p;
|
|
59
119
|
o.strokeStyle = "rgba(231,76,60,0.35)", o.lineWidth = 1, o.setLineDash([4, 4]);
|
|
60
120
|
for (let e of [0, 1]) {
|
|
61
121
|
let t = S(e);
|
|
62
|
-
o.beginPath(), o.moveTo(6, t), o.lineTo(
|
|
122
|
+
o.beginPath(), o.moveTo(6, t), o.lineTo(D - 6, t), o.stroke();
|
|
63
123
|
}
|
|
64
124
|
if (o.setLineDash([]), u.ok) {
|
|
65
125
|
o.font = "8px var(--kol-font-family-mono, monospace)", o.strokeStyle = l, o.fillStyle = l;
|
|
@@ -69,42 +129,42 @@ function T({ expr: e }) {
|
|
|
69
129
|
_
|
|
70
130
|
]) {
|
|
71
131
|
let t = S(e);
|
|
72
|
-
o.globalAlpha = .12, o.beginPath(), o.moveTo(6, t), o.lineTo(
|
|
132
|
+
o.globalAlpha = .12, o.beginPath(), o.moveTo(6, t), o.lineTo(D - 6, t), o.stroke(), o.globalAlpha = .5, o.fillText(e.toFixed(2), 8, t - 2);
|
|
73
133
|
}
|
|
74
134
|
o.globalAlpha = 1;
|
|
75
135
|
let e = (e) => {
|
|
76
136
|
o.beginPath();
|
|
77
137
|
for (let t = 0; t <= e; t++) {
|
|
78
138
|
let e = S(g[t]);
|
|
79
|
-
t === 0 ? o.moveTo(
|
|
139
|
+
t === 0 ? o.moveTo(C(0), e) : o.lineTo(C(t), e);
|
|
80
140
|
}
|
|
81
141
|
o.stroke();
|
|
82
142
|
};
|
|
83
143
|
o.strokeStyle = a, o.lineWidth = 1, o.globalAlpha = .25, e(h);
|
|
84
144
|
let t = 6 + f * p;
|
|
85
|
-
o.globalAlpha = .4, o.beginPath(), o.moveTo(t, 6), o.lineTo(t,
|
|
145
|
+
o.globalAlpha = .4, o.beginPath(), o.moveTo(t, 6), o.lineTo(t, O - 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
146
|
}
|
|
87
147
|
};
|
|
88
148
|
return c(), () => cancelAnimationFrame(s);
|
|
89
|
-
}, [
|
|
149
|
+
}, [t]), /* @__PURE__ */ b("canvas", {
|
|
90
150
|
ref: n,
|
|
91
151
|
"aria-label": "Expression plot over one loop",
|
|
92
152
|
style: {
|
|
93
|
-
width:
|
|
94
|
-
height:
|
|
153
|
+
width: D,
|
|
154
|
+
height: O,
|
|
95
155
|
display: "block",
|
|
96
156
|
borderRadius: 3,
|
|
97
157
|
background: "var(--kol-oq-04)"
|
|
98
158
|
}
|
|
99
159
|
});
|
|
100
160
|
}
|
|
101
|
-
function
|
|
102
|
-
let c =
|
|
103
|
-
if (!
|
|
104
|
-
let
|
|
161
|
+
function A({ layer: e, param: r, setProp: s }) {
|
|
162
|
+
let c = e[r.key], [d, p] = v(null), [m, g] = v(!1), [_, S] = v(!1);
|
|
163
|
+
if (!a(c) || c.bind !== "mod") return null;
|
|
164
|
+
let C = c.source, w = c.transform ?? {}, T = C.startsWith("lfo-"), D = C === "midi", O = n(C), A = C === "expr", j = w.expr ?? "wave(t)", M = (e) => s(r.key, {
|
|
105
165
|
...c,
|
|
106
166
|
transform: {
|
|
107
|
-
...
|
|
167
|
+
...w,
|
|
108
168
|
...e
|
|
109
169
|
}
|
|
110
170
|
}), N = (e) => {
|
|
@@ -113,16 +173,16 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
113
173
|
t && t !== j && M({ expr: t });
|
|
114
174
|
}, P = async () => {
|
|
115
175
|
g(!0);
|
|
116
|
-
let e = await
|
|
176
|
+
let e = await t();
|
|
117
177
|
g(!1), e != null && M({ cc: e });
|
|
118
178
|
}, F = async () => {
|
|
119
|
-
|
|
120
|
-
let e = await
|
|
121
|
-
|
|
179
|
+
S(!0);
|
|
180
|
+
let e = await o();
|
|
181
|
+
S(!1), e && s(r.key, {
|
|
122
182
|
...c,
|
|
123
183
|
source: e
|
|
124
184
|
});
|
|
125
|
-
}, I =
|
|
185
|
+
}, I = w.range ?? (r.min != null && r.max != null ? [r.min, r.max] : [0, 1]), L = (e, t) => {
|
|
126
186
|
let n = Number(e);
|
|
127
187
|
return Number.isFinite(n) ? n : t;
|
|
128
188
|
};
|
|
@@ -169,7 +229,7 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
169
229
|
value: "on",
|
|
170
230
|
label: "On"
|
|
171
231
|
}],
|
|
172
|
-
viewMode:
|
|
232
|
+
viewMode: w?.invert ? "on" : "off",
|
|
173
233
|
onViewChange: (e) => M({ invert: e === "on" })
|
|
174
234
|
})
|
|
175
235
|
}), /* @__PURE__ */ b(u, {
|
|
@@ -178,7 +238,7 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
178
238
|
min: 0,
|
|
179
239
|
max: .95,
|
|
180
240
|
step: .05,
|
|
181
|
-
value:
|
|
241
|
+
value: w?.smooth ?? 0,
|
|
182
242
|
onChange: (e) => M({ smooth: e })
|
|
183
243
|
})
|
|
184
244
|
})]
|
|
@@ -189,11 +249,11 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
189
249
|
min: .25,
|
|
190
250
|
max: 4,
|
|
191
251
|
step: .05,
|
|
192
|
-
value:
|
|
252
|
+
value: w?.curve ?? 1,
|
|
193
253
|
onChange: (e) => M({ curve: e })
|
|
194
254
|
})
|
|
195
255
|
}),
|
|
196
|
-
|
|
256
|
+
T && /* @__PURE__ */ x("div", {
|
|
197
257
|
className: "grid grid-cols-2 gap-2",
|
|
198
258
|
children: [/* @__PURE__ */ b(u, {
|
|
199
259
|
label: "Rate · cycles",
|
|
@@ -201,7 +261,7 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
201
261
|
min: .25,
|
|
202
262
|
max: 16,
|
|
203
263
|
step: .25,
|
|
204
|
-
value:
|
|
264
|
+
value: w?.rate ?? 1,
|
|
205
265
|
onChange: (e) => M({ rate: e })
|
|
206
266
|
})
|
|
207
267
|
}), /* @__PURE__ */ b(u, {
|
|
@@ -210,7 +270,7 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
210
270
|
min: 0,
|
|
211
271
|
max: 1,
|
|
212
272
|
step: .01,
|
|
213
|
-
value:
|
|
273
|
+
value: w?.phase ?? 0,
|
|
214
274
|
onChange: (e) => M({ phase: e })
|
|
215
275
|
})
|
|
216
276
|
})]
|
|
@@ -229,10 +289,10 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
229
289
|
}
|
|
230
290
|
})
|
|
231
291
|
}),
|
|
232
|
-
/* @__PURE__ */ b(
|
|
292
|
+
/* @__PURE__ */ b(k, { expr: j }),
|
|
233
293
|
/* @__PURE__ */ b("div", {
|
|
234
294
|
className: "flex flex-col",
|
|
235
|
-
children:
|
|
295
|
+
children: E.map((e) => /* @__PURE__ */ x("button", {
|
|
236
296
|
type: "button",
|
|
237
297
|
onClick: () => M({ expr: e.code }),
|
|
238
298
|
className: "w-full kol-helper-10 h-6 inline-flex items-center gap-2 text-body hover:text-emphasis text-left",
|
|
@@ -253,8 +313,8 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
253
313
|
}, e.code))
|
|
254
314
|
})
|
|
255
315
|
] }),
|
|
256
|
-
|
|
257
|
-
label:
|
|
316
|
+
D && /* @__PURE__ */ b(u, {
|
|
317
|
+
label: w?.cc == null ? "MIDI · no CC yet" : `MIDI · CC ${w.cc}`,
|
|
258
318
|
children: /* @__PURE__ */ b("button", {
|
|
259
319
|
type: "button",
|
|
260
320
|
onClick: P,
|
|
@@ -266,8 +326,8 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
266
326
|
children: m ? "Move a knob…" : "Learn"
|
|
267
327
|
})
|
|
268
328
|
}),
|
|
269
|
-
|
|
270
|
-
label:
|
|
329
|
+
O && /* @__PURE__ */ b(u, {
|
|
330
|
+
label: i(C)?.label ?? "Gamepad",
|
|
271
331
|
children: /* @__PURE__ */ b("button", {
|
|
272
332
|
type: "button",
|
|
273
333
|
onClick: F,
|
|
@@ -282,41 +342,41 @@ function E({ layer: t, param: r, setProp: s }) {
|
|
|
282
342
|
]
|
|
283
343
|
});
|
|
284
344
|
}
|
|
285
|
-
function
|
|
286
|
-
let
|
|
287
|
-
let n = t
|
|
288
|
-
return
|
|
345
|
+
function j({ layer: e, schema: t, setProp: n }) {
|
|
346
|
+
let r = (t ?? []).filter((t) => {
|
|
347
|
+
let n = e[t.key];
|
|
348
|
+
return a(n) && n.bind === "mod";
|
|
289
349
|
});
|
|
290
|
-
return
|
|
350
|
+
return r.length === 0 ? null : /* @__PURE__ */ x("div", {
|
|
291
351
|
className: "flex flex-col gap-4",
|
|
292
352
|
children: [/* @__PURE__ */ b("span", {
|
|
293
353
|
className: "kol-helper-10 text-meta",
|
|
294
354
|
children: "Modulation"
|
|
295
|
-
}),
|
|
296
|
-
let
|
|
355
|
+
}), r.map((t) => {
|
|
356
|
+
let r = i(e[t.key].source);
|
|
297
357
|
return /* @__PURE__ */ x("div", {
|
|
298
358
|
className: "flex flex-col gap-2 pt-3 border-t border-oq-08",
|
|
299
359
|
children: [/* @__PURE__ */ x("div", {
|
|
300
360
|
className: "flex items-center justify-between",
|
|
301
361
|
children: [/* @__PURE__ */ b("span", {
|
|
302
362
|
className: "kol-helper-12 text-emphasis",
|
|
303
|
-
children:
|
|
363
|
+
children: t.label ?? t.key
|
|
304
364
|
}), /* @__PURE__ */ b("span", {
|
|
305
365
|
className: "kol-helper-10 text-meta",
|
|
306
|
-
children:
|
|
366
|
+
children: r?.label ?? e[t.key].source
|
|
307
367
|
})]
|
|
308
|
-
}), /* @__PURE__ */ b(
|
|
309
|
-
layer:
|
|
310
|
-
param:
|
|
311
|
-
setProp:
|
|
368
|
+
}), /* @__PURE__ */ b(A, {
|
|
369
|
+
layer: e,
|
|
370
|
+
param: t,
|
|
371
|
+
setProp: n
|
|
312
372
|
})]
|
|
313
|
-
},
|
|
373
|
+
}, t.key);
|
|
314
374
|
})]
|
|
315
375
|
});
|
|
316
376
|
}
|
|
317
377
|
//#endregion
|
|
318
378
|
//#region src/editor/modes/pattern/RuleRow.jsx
|
|
319
|
-
var
|
|
379
|
+
var M = [
|
|
320
380
|
{
|
|
321
381
|
value: "all",
|
|
322
382
|
label: "All cells"
|
|
@@ -345,7 +405,7 @@ var O = [
|
|
|
345
405
|
value: "expression",
|
|
346
406
|
label: "Expression…"
|
|
347
407
|
}
|
|
348
|
-
],
|
|
408
|
+
], N = [
|
|
349
409
|
{
|
|
350
410
|
value: 0,
|
|
351
411
|
label: "0°"
|
|
@@ -362,19 +422,19 @@ var O = [
|
|
|
362
422
|
value: 270,
|
|
363
423
|
label: "270°"
|
|
364
424
|
}
|
|
365
|
-
],
|
|
425
|
+
], P = [
|
|
366
426
|
"every-col",
|
|
367
427
|
"every-row",
|
|
368
428
|
"both",
|
|
369
429
|
"every-nth",
|
|
370
430
|
"checker"
|
|
371
|
-
],
|
|
431
|
+
], F = [
|
|
372
432
|
0,
|
|
373
433
|
90,
|
|
374
434
|
180,
|
|
375
435
|
270
|
|
376
|
-
],
|
|
377
|
-
id:
|
|
436
|
+
], I = 1, L = () => `r${I++}`, R = () => ({
|
|
437
|
+
id: L(),
|
|
378
438
|
selectKind: "every-col",
|
|
379
439
|
n: 2,
|
|
380
440
|
offset: 0,
|
|
@@ -388,9 +448,9 @@ var O = [
|
|
|
388
448
|
flipV: !1,
|
|
389
449
|
hide: !1,
|
|
390
450
|
opacity: 1
|
|
391
|
-
}),
|
|
392
|
-
id:
|
|
393
|
-
selectKind:
|
|
451
|
+
}), z = (e) => e[Math.floor(Math.random() * e.length)], B = () => ({
|
|
452
|
+
id: L(),
|
|
453
|
+
selectKind: z(P),
|
|
394
454
|
n: Math.floor(Math.random() * 5) + 2,
|
|
395
455
|
offset: Math.floor(Math.random() * 3),
|
|
396
456
|
n2: Math.floor(Math.random() * 5) + 2,
|
|
@@ -398,13 +458,13 @@ var O = [
|
|
|
398
458
|
expression: "sin(col * 0.6) + cos(row * 0.6)",
|
|
399
459
|
groupW: Math.random() > .6 ? Math.floor(Math.random() * 3) + 1 : 1,
|
|
400
460
|
groupH: Math.random() > .6 ? Math.floor(Math.random() * 3) + 1 : 1,
|
|
401
|
-
rotate: F
|
|
461
|
+
rotate: z(F),
|
|
402
462
|
flipH: Math.random() > .6,
|
|
403
463
|
flipV: Math.random() > .6,
|
|
404
464
|
hide: Math.random() > .85,
|
|
405
465
|
opacity: Math.random() > .7 ? .4 + Math.random() * .6 : 1
|
|
406
466
|
});
|
|
407
|
-
function
|
|
467
|
+
function V({ value: e, onChange: t, min: n = 0, max: r = 99 }) {
|
|
408
468
|
return /* @__PURE__ */ b(p, {
|
|
409
469
|
size: "sm",
|
|
410
470
|
value: e,
|
|
@@ -414,7 +474,7 @@ function L({ value: e, onChange: t, min: n = 0, max: r = 99 }) {
|
|
|
414
474
|
className: "w-full"
|
|
415
475
|
});
|
|
416
476
|
}
|
|
417
|
-
function
|
|
477
|
+
function H({ active: e, onClick: t, children: n, title: r }) {
|
|
418
478
|
return /* @__PURE__ */ b(m, {
|
|
419
479
|
label: r,
|
|
420
480
|
children: /* @__PURE__ */ b(s, {
|
|
@@ -427,7 +487,7 @@ function R({ active: e, onClick: t, children: n, title: r }) {
|
|
|
427
487
|
})
|
|
428
488
|
});
|
|
429
489
|
}
|
|
430
|
-
function
|
|
490
|
+
function U({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
431
491
|
let i = (n) => t({
|
|
432
492
|
...e,
|
|
433
493
|
...n
|
|
@@ -444,7 +504,7 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
444
504
|
variant: "subtle",
|
|
445
505
|
size: "sm",
|
|
446
506
|
className: "w-full",
|
|
447
|
-
options:
|
|
507
|
+
options: M,
|
|
448
508
|
value: e.selectKind,
|
|
449
509
|
onChange: (e) => i({ selectKind: e })
|
|
450
510
|
})
|
|
@@ -481,14 +541,14 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
481
541
|
className: "grid grid-cols-2 gap-2",
|
|
482
542
|
children: [/* @__PURE__ */ b(d, {
|
|
483
543
|
label: "N",
|
|
484
|
-
children: /* @__PURE__ */ b(
|
|
544
|
+
children: /* @__PURE__ */ b(V, {
|
|
485
545
|
value: e.n,
|
|
486
546
|
onChange: (e) => i({ n: e }),
|
|
487
547
|
min: 1
|
|
488
548
|
})
|
|
489
549
|
}), /* @__PURE__ */ b(d, {
|
|
490
550
|
label: "Offset",
|
|
491
|
-
children: /* @__PURE__ */ b(
|
|
551
|
+
children: /* @__PURE__ */ b(V, {
|
|
492
552
|
value: e.offset,
|
|
493
553
|
onChange: (e) => i({ offset: e })
|
|
494
554
|
})
|
|
@@ -498,14 +558,14 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
498
558
|
className: "grid grid-cols-2 gap-2",
|
|
499
559
|
children: [/* @__PURE__ */ b(d, {
|
|
500
560
|
label: "Row N",
|
|
501
|
-
children: /* @__PURE__ */ b(
|
|
561
|
+
children: /* @__PURE__ */ b(V, {
|
|
502
562
|
value: e.n2,
|
|
503
563
|
onChange: (e) => i({ n2: e }),
|
|
504
564
|
min: 1
|
|
505
565
|
})
|
|
506
566
|
}), /* @__PURE__ */ b(d, {
|
|
507
567
|
label: "Row offset",
|
|
508
|
-
children: /* @__PURE__ */ b(
|
|
568
|
+
children: /* @__PURE__ */ b(V, {
|
|
509
569
|
value: e.offset2,
|
|
510
570
|
onChange: (e) => i({ offset2: e })
|
|
511
571
|
})
|
|
@@ -529,14 +589,14 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
529
589
|
className: "grid grid-cols-2 gap-2",
|
|
530
590
|
children: [/* @__PURE__ */ b(d, {
|
|
531
591
|
label: "Group W",
|
|
532
|
-
children: /* @__PURE__ */ b(
|
|
592
|
+
children: /* @__PURE__ */ b(V, {
|
|
533
593
|
value: e.groupW,
|
|
534
594
|
onChange: (e) => i({ groupW: Math.max(1, e) }),
|
|
535
595
|
min: 1
|
|
536
596
|
})
|
|
537
597
|
}), /* @__PURE__ */ b(d, {
|
|
538
598
|
label: "Group H",
|
|
539
|
-
children: /* @__PURE__ */ b(
|
|
599
|
+
children: /* @__PURE__ */ b(V, {
|
|
540
600
|
value: e.groupH,
|
|
541
601
|
onChange: (e) => i({ groupH: Math.max(1, e) }),
|
|
542
602
|
min: 1
|
|
@@ -549,23 +609,23 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
549
609
|
/* @__PURE__ */ b(c, {
|
|
550
610
|
variant: "subtle",
|
|
551
611
|
size: "sm",
|
|
552
|
-
options:
|
|
612
|
+
options: N,
|
|
553
613
|
value: e.rotate,
|
|
554
614
|
onChange: (e) => i({ rotate: Number(e) })
|
|
555
615
|
}),
|
|
556
|
-
/* @__PURE__ */ b(
|
|
616
|
+
/* @__PURE__ */ b(H, {
|
|
557
617
|
active: e.flipH,
|
|
558
618
|
onClick: () => i({ flipH: !e.flipH }),
|
|
559
619
|
title: "Flip horizontal",
|
|
560
620
|
children: "⇋"
|
|
561
621
|
}),
|
|
562
|
-
/* @__PURE__ */ b(
|
|
622
|
+
/* @__PURE__ */ b(H, {
|
|
563
623
|
active: e.flipV,
|
|
564
624
|
onClick: () => i({ flipV: !e.flipV }),
|
|
565
625
|
title: "Flip vertical",
|
|
566
626
|
children: "⇵"
|
|
567
627
|
}),
|
|
568
|
-
/* @__PURE__ */ b(
|
|
628
|
+
/* @__PURE__ */ b(H, {
|
|
569
629
|
active: e.hide,
|
|
570
630
|
onClick: () => i({ hide: !e.hide }),
|
|
571
631
|
title: "Hide cell",
|
|
@@ -587,4 +647,4 @@ function z({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
587
647
|
});
|
|
588
648
|
}
|
|
589
649
|
//#endregion
|
|
590
|
-
export {
|
|
650
|
+
export { S as a, w as c, j as i, R as n, T as o, B as r, C as s, U as t };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { S as e } from "./rolls-Bg1XHuvJ.js";
|
|
2
|
+
import { Dropdown as t, LabeledControl as n, SettingsRow as r } from "@kolkrabbi/kol-component";
|
|
3
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
//#region src/editor/compose/inspectors/TreePicker.jsx
|
|
5
|
+
function s(n) {
|
|
6
|
+
return /* @__PURE__ */ a(t, {
|
|
7
|
+
variant: "subtle",
|
|
8
|
+
size: e(),
|
|
9
|
+
className: "w-full",
|
|
10
|
+
...n
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function c({ label: e, options: t, value: i, onChange: o, children: c, inline: l = !1 }) {
|
|
14
|
+
let u = c ?? /* @__PURE__ */ a(s, {
|
|
15
|
+
options: t,
|
|
16
|
+
value: i,
|
|
17
|
+
onChange: o
|
|
18
|
+
});
|
|
19
|
+
return l ? /* @__PURE__ */ a(r, {
|
|
20
|
+
label: e,
|
|
21
|
+
align: "fill",
|
|
22
|
+
labelWidth: 112,
|
|
23
|
+
children: u
|
|
24
|
+
}) : /* @__PURE__ */ a(n, {
|
|
25
|
+
label: e,
|
|
26
|
+
children: u
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function l({ tree: e, presets: t, current: n, onPick: r, inline: s = !1 }) {
|
|
30
|
+
let l = e.find((e) => e.subs.includes(n.sub)) ?? e[0], u = t.filter((e) => e.sub === n.sub), d = (e) => t.find((t) => t.sub === e);
|
|
31
|
+
return /* @__PURE__ */ o(i, { children: [
|
|
32
|
+
/* @__PURE__ */ a(c, {
|
|
33
|
+
inline: s,
|
|
34
|
+
label: "Type",
|
|
35
|
+
options: e.map((e) => ({
|
|
36
|
+
value: e.label,
|
|
37
|
+
label: e.label
|
|
38
|
+
})),
|
|
39
|
+
value: l.label,
|
|
40
|
+
onChange: (t) => {
|
|
41
|
+
let n = e.find((e) => e.label === t);
|
|
42
|
+
n && r(d(n.subs[0]));
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ a(c, {
|
|
46
|
+
inline: s,
|
|
47
|
+
label: "Category",
|
|
48
|
+
options: l.subs.map((e) => ({
|
|
49
|
+
value: e,
|
|
50
|
+
label: e
|
|
51
|
+
})),
|
|
52
|
+
value: n.sub,
|
|
53
|
+
onChange: (e) => r(d(e))
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ a(c, {
|
|
56
|
+
inline: s,
|
|
57
|
+
label: "Preset",
|
|
58
|
+
options: u.map((e) => ({
|
|
59
|
+
value: e.id,
|
|
60
|
+
label: e.label
|
|
61
|
+
})),
|
|
62
|
+
value: n.id,
|
|
63
|
+
onChange: (e) => r(t.find((t) => t.id === e))
|
|
64
|
+
})
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { c as n, l as r, s as t };
|