@kolkrabbi/design-editor 0.24.0 → 0.26.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/README.md +2 -2
- package/dist/BindDot-CMUtpJPX.js +84 -0
- package/dist/BufferGeometryUtils-Cc8LNd5v.js +150 -0
- package/dist/ColorModesWindow-CWhL6nfm.js +1493 -0
- package/dist/GLTFLoader-BFir8PCc.js +1361 -0
- package/dist/OBJLoader-BgqC_-Jn.js +287 -0
- package/dist/{OrbitControls-Cql8Rn2i.js → OrbitControls-DVpLgmKv.js} +2755 -2202
- package/dist/STLLoader-C6DGLf6r.js +83 -0
- package/dist/TreePicker-nMf17QGH.js +68 -0
- package/dist/core-CfGqY4VB.js +17504 -0
- package/dist/core.js +4 -3
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +2114 -916
- package/dist/effects-DZEmfY7a.js +444 -0
- package/dist/effects.js +1 -1
- package/dist/generators-D1tFSZgG.js +2961 -0
- package/dist/generators.js +1 -1
- package/dist/{host-qtFVROOD.js → host-CRsCCafL.js} +429 -370
- package/dist/{host-be1CWhN1.js → host-ZLJKCZ54.js} +137 -136
- package/dist/motion-BJ8xqUKI.js +3096 -0
- package/dist/motion.js +1 -1
- package/dist/previewScale-BMkeLc6w.js +26 -0
- package/dist/{rolls-Bg1XHuvJ.js → rolls-BGtqxVYq.js} +2621 -1522
- package/dist/{src-B5fQgAVE.js → src-BpTckTDZ.js} +1 -1
- package/dist/{labels-B5qkocWy.js → timelinePinned-BwYq1Msi.js} +321 -164
- package/dist/{useLayerEdit-ieOjHx6x.js → useLayerEdit-BFcZhiNX.js} +20992 -12580
- package/package.json +10 -8
- package/dist/RuleRow-DIbuUt37.js +0 -650
- package/dist/TreePicker-DLmMl0aU.js +0 -68
- package/dist/core-CNI8b_83.js +0 -12314
- package/dist/effectCategories-0PnGZvjd.js +0 -4210
- package/dist/effects-BujxwoNY.js +0 -469
- package/dist/generators-SpRHQDMq.js +0 -2517
- package/dist/motion-Bn3FVkCS.js +0 -2260
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/design-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The design editor as one component",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,12 +32,13 @@
|
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@kolkrabbi/kol-component": ">=0.330.0 <1",
|
|
34
34
|
"@kolkrabbi/kol-framework": ">=0.44.0 <1",
|
|
35
|
+
"@kolkrabbi/kol-hardware": ">=0.10.0 <1",
|
|
35
36
|
"@kolkrabbi/kol-icons": ">=0.29.0 <1",
|
|
36
37
|
"@kolkrabbi/kol-media-client": ">=0.4.0 <1",
|
|
37
38
|
"@kolkrabbi/kol-shell": ">=0.51.0 <1",
|
|
38
39
|
"react": "^19.0.0",
|
|
39
40
|
"react-dom": "^19.0.0",
|
|
40
|
-
"@kolkrabbi/kol-theme": ">=0.
|
|
41
|
+
"@kolkrabbi/kol-theme": ">=0.211.0 <1"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
44
|
"colord": "^2.9.3",
|
|
@@ -59,12 +60,13 @@
|
|
|
59
60
|
"tailwindcss": "^4.2.4",
|
|
60
61
|
"vite": "^8.0.10",
|
|
61
62
|
"vite-plugin-svgr": "^5.2.0",
|
|
62
|
-
"@kolkrabbi/kol-
|
|
63
|
-
"@kolkrabbi/kol-
|
|
64
|
-
"@kolkrabbi/kol-
|
|
65
|
-
"@kolkrabbi/kol-theme": "0.
|
|
66
|
-
"@kolkrabbi/kol-
|
|
67
|
-
"@kolkrabbi/kol-shell": "0.
|
|
63
|
+
"@kolkrabbi/kol-framework": "0.69.0",
|
|
64
|
+
"@kolkrabbi/kol-component": "0.333.3",
|
|
65
|
+
"@kolkrabbi/kol-hardware": "0.10.0",
|
|
66
|
+
"@kolkrabbi/kol-theme": "0.211.1",
|
|
67
|
+
"@kolkrabbi/kol-icons": "0.61.0",
|
|
68
|
+
"@kolkrabbi/kol-shell": "0.101.0",
|
|
69
|
+
"@kolkrabbi/kol-media-client": "0.7.0"
|
|
68
70
|
},
|
|
69
71
|
"keywords": [
|
|
70
72
|
"kol",
|
package/dist/RuleRow-DIbuUt37.js
DELETED
|
@@ -1,650 +0,0 @@
|
|
|
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
|
-
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
|
-
import { useEffect as g, useRef as _, useState as v } from "react";
|
|
4
|
-
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
5
|
-
//#region src/loops/taxonomy.js
|
|
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 = [
|
|
67
|
-
{
|
|
68
|
-
code: "wave(t*2)",
|
|
69
|
-
desc: "Fast sine"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
code: "saw(t)*0.8",
|
|
73
|
-
desc: "Ramp to 80"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
code: "tri(t*0.5)",
|
|
77
|
-
desc: "Slow bounce"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
code: "pulse(t, 0.3)",
|
|
81
|
-
desc: "PWM 30%"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
code: "ease(t*2, 4)",
|
|
85
|
-
desc: "Fast + punchy"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
code: "bell(t)",
|
|
89
|
-
desc: "Bell curve"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
code: "step(t, 4)",
|
|
93
|
-
desc: "4 steps"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
code: "rand()",
|
|
97
|
-
desc: "Noise"
|
|
98
|
-
}
|
|
99
|
-
], D = 196, O = 64;
|
|
100
|
-
function k({ expr: t }) {
|
|
101
|
-
let n = _(null);
|
|
102
|
-
return g(() => {
|
|
103
|
-
let i = n.current;
|
|
104
|
-
if (!i) return;
|
|
105
|
-
let a = Math.min(2, window.devicePixelRatio || 1);
|
|
106
|
-
i.width = D * a, i.height = O * a;
|
|
107
|
-
let o = i.getContext("2d");
|
|
108
|
-
o.setTransform(a, 0, 0, a, 0, 0);
|
|
109
|
-
let s = 0, c = () => {
|
|
110
|
-
s = requestAnimationFrame(c);
|
|
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);
|
|
113
|
-
let h = p, g = new Float64Array(185), _ = Infinity, v = -Infinity;
|
|
114
|
-
for (let e = 0; e <= h; e++) {
|
|
115
|
-
let t = u.ok ? u.fn(e / h * d) : 0;
|
|
116
|
-
g[e] = t, t < _ && (_ = t), t > v && (v = t);
|
|
117
|
-
}
|
|
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;
|
|
119
|
-
o.strokeStyle = "rgba(231,76,60,0.35)", o.lineWidth = 1, o.setLineDash([4, 4]);
|
|
120
|
-
for (let e of [0, 1]) {
|
|
121
|
-
let t = S(e);
|
|
122
|
-
o.beginPath(), o.moveTo(6, t), o.lineTo(D - 6, t), o.stroke();
|
|
123
|
-
}
|
|
124
|
-
if (o.setLineDash([]), u.ok) {
|
|
125
|
-
o.font = "8px var(--kol-font-family-mono, monospace)", o.strokeStyle = l, o.fillStyle = l;
|
|
126
|
-
for (let e of [
|
|
127
|
-
v,
|
|
128
|
-
y,
|
|
129
|
-
_
|
|
130
|
-
]) {
|
|
131
|
-
let t = S(e);
|
|
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);
|
|
133
|
-
}
|
|
134
|
-
o.globalAlpha = 1;
|
|
135
|
-
let e = (e) => {
|
|
136
|
-
o.beginPath();
|
|
137
|
-
for (let t = 0; t <= e; t++) {
|
|
138
|
-
let e = S(g[t]);
|
|
139
|
-
t === 0 ? o.moveTo(C(0), e) : o.lineTo(C(t), e);
|
|
140
|
-
}
|
|
141
|
-
o.stroke();
|
|
142
|
-
};
|
|
143
|
-
o.strokeStyle = a, o.lineWidth = 1, o.globalAlpha = .25, e(h);
|
|
144
|
-
let t = 6 + f * p;
|
|
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();
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
return c(), () => cancelAnimationFrame(s);
|
|
149
|
-
}, [t]), /* @__PURE__ */ b("canvas", {
|
|
150
|
-
ref: n,
|
|
151
|
-
"aria-label": "Expression plot over one loop",
|
|
152
|
-
style: {
|
|
153
|
-
width: D,
|
|
154
|
-
height: O,
|
|
155
|
-
display: "block",
|
|
156
|
-
borderRadius: 3,
|
|
157
|
-
background: "var(--kol-oq-04)"
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
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, {
|
|
165
|
-
...c,
|
|
166
|
-
transform: {
|
|
167
|
-
...w,
|
|
168
|
-
...e
|
|
169
|
-
}
|
|
170
|
-
}), N = (e) => {
|
|
171
|
-
p(null);
|
|
172
|
-
let t = String(e).trim();
|
|
173
|
-
t && t !== j && M({ expr: t });
|
|
174
|
-
}, P = async () => {
|
|
175
|
-
g(!0);
|
|
176
|
-
let e = await t();
|
|
177
|
-
g(!1), e != null && M({ cc: e });
|
|
178
|
-
}, F = async () => {
|
|
179
|
-
S(!0);
|
|
180
|
-
let e = await o();
|
|
181
|
-
S(!1), e && s(r.key, {
|
|
182
|
-
...c,
|
|
183
|
-
source: e
|
|
184
|
-
});
|
|
185
|
-
}, I = w.range ?? (r.min != null && r.max != null ? [r.min, r.max] : [0, 1]), L = (e, t) => {
|
|
186
|
-
let n = Number(e);
|
|
187
|
-
return Number.isFinite(n) ? n : t;
|
|
188
|
-
};
|
|
189
|
-
return /* @__PURE__ */ x("div", {
|
|
190
|
-
className: "flex flex-col gap-3",
|
|
191
|
-
children: [
|
|
192
|
-
/* @__PURE__ */ b(u, {
|
|
193
|
-
label: "Range",
|
|
194
|
-
children: /* @__PURE__ */ x("div", {
|
|
195
|
-
className: "flex items-center gap-2",
|
|
196
|
-
children: [
|
|
197
|
-
/* @__PURE__ */ b(l, {
|
|
198
|
-
variant: "filled",
|
|
199
|
-
size: "sm",
|
|
200
|
-
type: "number",
|
|
201
|
-
chars: 5,
|
|
202
|
-
value: I[0],
|
|
203
|
-
onChange: (e) => M({ range: [L(e.target.value, I[0]), I[1]] })
|
|
204
|
-
}),
|
|
205
|
-
/* @__PURE__ */ b("span", {
|
|
206
|
-
className: "kol-helper-10 text-meta",
|
|
207
|
-
children: "to"
|
|
208
|
-
}),
|
|
209
|
-
/* @__PURE__ */ b(l, {
|
|
210
|
-
variant: "filled",
|
|
211
|
-
size: "sm",
|
|
212
|
-
type: "number",
|
|
213
|
-
chars: 5,
|
|
214
|
-
value: I[1],
|
|
215
|
-
onChange: (e) => M({ range: [I[0], L(e.target.value, I[1])] })
|
|
216
|
-
})
|
|
217
|
-
]
|
|
218
|
-
})
|
|
219
|
-
}),
|
|
220
|
-
/* @__PURE__ */ x("div", {
|
|
221
|
-
className: "grid grid-cols-2 gap-2",
|
|
222
|
-
children: [/* @__PURE__ */ b(u, {
|
|
223
|
-
label: "Invert",
|
|
224
|
-
children: /* @__PURE__ */ b(h, {
|
|
225
|
-
options: [{
|
|
226
|
-
value: "off",
|
|
227
|
-
label: "Off"
|
|
228
|
-
}, {
|
|
229
|
-
value: "on",
|
|
230
|
-
label: "On"
|
|
231
|
-
}],
|
|
232
|
-
viewMode: w?.invert ? "on" : "off",
|
|
233
|
-
onViewChange: (e) => M({ invert: e === "on" })
|
|
234
|
-
})
|
|
235
|
-
}), /* @__PURE__ */ b(u, {
|
|
236
|
-
label: "Smooth",
|
|
237
|
-
children: /* @__PURE__ */ b(f, {
|
|
238
|
-
min: 0,
|
|
239
|
-
max: .95,
|
|
240
|
-
step: .05,
|
|
241
|
-
value: w?.smooth ?? 0,
|
|
242
|
-
onChange: (e) => M({ smooth: e })
|
|
243
|
-
})
|
|
244
|
-
})]
|
|
245
|
-
}),
|
|
246
|
-
/* @__PURE__ */ b(u, {
|
|
247
|
-
label: "Curve",
|
|
248
|
-
children: /* @__PURE__ */ b(f, {
|
|
249
|
-
min: .25,
|
|
250
|
-
max: 4,
|
|
251
|
-
step: .05,
|
|
252
|
-
value: w?.curve ?? 1,
|
|
253
|
-
onChange: (e) => M({ curve: e })
|
|
254
|
-
})
|
|
255
|
-
}),
|
|
256
|
-
T && /* @__PURE__ */ x("div", {
|
|
257
|
-
className: "grid grid-cols-2 gap-2",
|
|
258
|
-
children: [/* @__PURE__ */ b(u, {
|
|
259
|
-
label: "Rate · cycles",
|
|
260
|
-
children: /* @__PURE__ */ b(f, {
|
|
261
|
-
min: .25,
|
|
262
|
-
max: 16,
|
|
263
|
-
step: .25,
|
|
264
|
-
value: w?.rate ?? 1,
|
|
265
|
-
onChange: (e) => M({ rate: e })
|
|
266
|
-
})
|
|
267
|
-
}), /* @__PURE__ */ b(u, {
|
|
268
|
-
label: "Phase",
|
|
269
|
-
children: /* @__PURE__ */ b(f, {
|
|
270
|
-
min: 0,
|
|
271
|
-
max: 1,
|
|
272
|
-
step: .01,
|
|
273
|
-
value: w?.phase ?? 0,
|
|
274
|
-
onChange: (e) => M({ phase: e })
|
|
275
|
-
})
|
|
276
|
-
})]
|
|
277
|
-
}),
|
|
278
|
-
A && /* @__PURE__ */ x(y, { children: [
|
|
279
|
-
/* @__PURE__ */ b(u, {
|
|
280
|
-
label: "Expression",
|
|
281
|
-
children: /* @__PURE__ */ b(l, {
|
|
282
|
-
variant: "ghost",
|
|
283
|
-
size: "sm",
|
|
284
|
-
value: d ?? j,
|
|
285
|
-
onChange: (e) => p(e.target.value),
|
|
286
|
-
onBlur: (e) => N(e.target.value),
|
|
287
|
-
onKeyDown: (e) => {
|
|
288
|
-
e.key === "Enter" && e.currentTarget.blur();
|
|
289
|
-
}
|
|
290
|
-
})
|
|
291
|
-
}),
|
|
292
|
-
/* @__PURE__ */ b(k, { expr: j }),
|
|
293
|
-
/* @__PURE__ */ b("div", {
|
|
294
|
-
className: "flex flex-col",
|
|
295
|
-
children: E.map((e) => /* @__PURE__ */ x("button", {
|
|
296
|
-
type: "button",
|
|
297
|
-
onClick: () => M({ expr: e.code }),
|
|
298
|
-
className: "w-full kol-helper-10 h-6 inline-flex items-center gap-2 text-body hover:text-emphasis text-left",
|
|
299
|
-
style: {
|
|
300
|
-
background: "transparent",
|
|
301
|
-
border: "none",
|
|
302
|
-
cursor: "pointer",
|
|
303
|
-
fontVariantLigatures: "none"
|
|
304
|
-
},
|
|
305
|
-
children: [/* @__PURE__ */ b("span", {
|
|
306
|
-
className: "truncate",
|
|
307
|
-
style: { fontFamily: "var(--kol-font-family-mono, monospace)" },
|
|
308
|
-
children: e.code
|
|
309
|
-
}), /* @__PURE__ */ b("span", {
|
|
310
|
-
className: "flex-1 text-right text-meta truncate",
|
|
311
|
-
children: e.desc
|
|
312
|
-
})]
|
|
313
|
-
}, e.code))
|
|
314
|
-
})
|
|
315
|
-
] }),
|
|
316
|
-
D && /* @__PURE__ */ b(u, {
|
|
317
|
-
label: w?.cc == null ? "MIDI · no CC yet" : `MIDI · CC ${w.cc}`,
|
|
318
|
-
children: /* @__PURE__ */ b("button", {
|
|
319
|
-
type: "button",
|
|
320
|
-
onClick: P,
|
|
321
|
-
className: "kol-helper-12 px-2 py-1 rounded border border-oq-08 text-body hover:text-emphasis",
|
|
322
|
-
style: {
|
|
323
|
-
background: "transparent",
|
|
324
|
-
cursor: "pointer"
|
|
325
|
-
},
|
|
326
|
-
children: m ? "Move a knob…" : "Learn"
|
|
327
|
-
})
|
|
328
|
-
}),
|
|
329
|
-
O && /* @__PURE__ */ b(u, {
|
|
330
|
-
label: i(C)?.label ?? "Gamepad",
|
|
331
|
-
children: /* @__PURE__ */ b("button", {
|
|
332
|
-
type: "button",
|
|
333
|
-
onClick: F,
|
|
334
|
-
className: "kol-helper-12 px-2 py-1 rounded border border-oq-08 text-body hover:text-emphasis",
|
|
335
|
-
style: {
|
|
336
|
-
background: "transparent",
|
|
337
|
-
cursor: "pointer"
|
|
338
|
-
},
|
|
339
|
-
children: _ ? "Move a control…" : "Learn"
|
|
340
|
-
})
|
|
341
|
-
})
|
|
342
|
-
]
|
|
343
|
-
});
|
|
344
|
-
}
|
|
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";
|
|
349
|
-
});
|
|
350
|
-
return r.length === 0 ? null : /* @__PURE__ */ x("div", {
|
|
351
|
-
className: "flex flex-col gap-4",
|
|
352
|
-
children: [/* @__PURE__ */ b("span", {
|
|
353
|
-
className: "kol-helper-10 text-meta",
|
|
354
|
-
children: "Modulation"
|
|
355
|
-
}), r.map((t) => {
|
|
356
|
-
let r = i(e[t.key].source);
|
|
357
|
-
return /* @__PURE__ */ x("div", {
|
|
358
|
-
className: "flex flex-col gap-2 pt-3 border-t border-oq-08",
|
|
359
|
-
children: [/* @__PURE__ */ x("div", {
|
|
360
|
-
className: "flex items-center justify-between",
|
|
361
|
-
children: [/* @__PURE__ */ b("span", {
|
|
362
|
-
className: "kol-helper-12 text-emphasis",
|
|
363
|
-
children: t.label ?? t.key
|
|
364
|
-
}), /* @__PURE__ */ b("span", {
|
|
365
|
-
className: "kol-helper-10 text-meta",
|
|
366
|
-
children: r?.label ?? e[t.key].source
|
|
367
|
-
})]
|
|
368
|
-
}), /* @__PURE__ */ b(A, {
|
|
369
|
-
layer: e,
|
|
370
|
-
param: t,
|
|
371
|
-
setProp: n
|
|
372
|
-
})]
|
|
373
|
-
}, t.key);
|
|
374
|
-
})]
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
//#endregion
|
|
378
|
-
//#region src/editor/modes/pattern/RuleRow.jsx
|
|
379
|
-
var M = [
|
|
380
|
-
{
|
|
381
|
-
value: "all",
|
|
382
|
-
label: "All cells"
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
value: "every-col",
|
|
386
|
-
label: "Every Nth col"
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
value: "every-row",
|
|
390
|
-
label: "Every Nth row"
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
value: "both",
|
|
394
|
-
label: "Nth col × Nth row"
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
value: "every-nth",
|
|
398
|
-
label: "Every Nth (flat)"
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
value: "checker",
|
|
402
|
-
label: "Checker"
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
value: "expression",
|
|
406
|
-
label: "Expression…"
|
|
407
|
-
}
|
|
408
|
-
], N = [
|
|
409
|
-
{
|
|
410
|
-
value: 0,
|
|
411
|
-
label: "0°"
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
value: 90,
|
|
415
|
-
label: "90°"
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
value: 180,
|
|
419
|
-
label: "180°"
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
value: 270,
|
|
423
|
-
label: "270°"
|
|
424
|
-
}
|
|
425
|
-
], P = [
|
|
426
|
-
"every-col",
|
|
427
|
-
"every-row",
|
|
428
|
-
"both",
|
|
429
|
-
"every-nth",
|
|
430
|
-
"checker"
|
|
431
|
-
], F = [
|
|
432
|
-
0,
|
|
433
|
-
90,
|
|
434
|
-
180,
|
|
435
|
-
270
|
|
436
|
-
], I = 1, L = () => `r${I++}`, R = () => ({
|
|
437
|
-
id: L(),
|
|
438
|
-
selectKind: "every-col",
|
|
439
|
-
n: 2,
|
|
440
|
-
offset: 0,
|
|
441
|
-
n2: 2,
|
|
442
|
-
offset2: 0,
|
|
443
|
-
expression: "sin(col * 0.6) + cos(row * 0.6)",
|
|
444
|
-
groupW: 1,
|
|
445
|
-
groupH: 1,
|
|
446
|
-
rotate: 90,
|
|
447
|
-
flipH: !1,
|
|
448
|
-
flipV: !1,
|
|
449
|
-
hide: !1,
|
|
450
|
-
opacity: 1
|
|
451
|
-
}), z = (e) => e[Math.floor(Math.random() * e.length)], B = () => ({
|
|
452
|
-
id: L(),
|
|
453
|
-
selectKind: z(P),
|
|
454
|
-
n: Math.floor(Math.random() * 5) + 2,
|
|
455
|
-
offset: Math.floor(Math.random() * 3),
|
|
456
|
-
n2: Math.floor(Math.random() * 5) + 2,
|
|
457
|
-
offset2: Math.floor(Math.random() * 3),
|
|
458
|
-
expression: "sin(col * 0.6) + cos(row * 0.6)",
|
|
459
|
-
groupW: Math.random() > .6 ? Math.floor(Math.random() * 3) + 1 : 1,
|
|
460
|
-
groupH: Math.random() > .6 ? Math.floor(Math.random() * 3) + 1 : 1,
|
|
461
|
-
rotate: z(F),
|
|
462
|
-
flipH: Math.random() > .6,
|
|
463
|
-
flipV: Math.random() > .6,
|
|
464
|
-
hide: Math.random() > .85,
|
|
465
|
-
opacity: Math.random() > .7 ? .4 + Math.random() * .6 : 1
|
|
466
|
-
});
|
|
467
|
-
function V({ value: e, onChange: t, min: n = 0, max: r = 99 }) {
|
|
468
|
-
return /* @__PURE__ */ b(p, {
|
|
469
|
-
size: "sm",
|
|
470
|
-
value: e,
|
|
471
|
-
min: n,
|
|
472
|
-
max: r,
|
|
473
|
-
onChange: (e) => t(Number(e.target.value)),
|
|
474
|
-
className: "w-full"
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
function H({ active: e, onClick: t, children: n, title: r }) {
|
|
478
|
-
return /* @__PURE__ */ b(m, {
|
|
479
|
-
label: r,
|
|
480
|
-
children: /* @__PURE__ */ b(s, {
|
|
481
|
-
"aria-label": r,
|
|
482
|
-
tone: e ? "primary" : "outline",
|
|
483
|
-
size: "sm",
|
|
484
|
-
onClick: t,
|
|
485
|
-
"aria-pressed": e,
|
|
486
|
-
children: n
|
|
487
|
-
})
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
function U({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
491
|
-
let i = (n) => t({
|
|
492
|
-
...e,
|
|
493
|
-
...n
|
|
494
|
-
}), a = e.selectKind === "every-col" || e.selectKind === "every-row" || e.selectKind === "every-nth" || e.selectKind === "both", o = e.selectKind === "both", u = e.selectKind === "expression";
|
|
495
|
-
return /* @__PURE__ */ x("div", {
|
|
496
|
-
className: "flex flex-col gap-2 p-2 border border-oq-08 rounded",
|
|
497
|
-
children: [
|
|
498
|
-
/* @__PURE__ */ x("div", {
|
|
499
|
-
className: "flex items-center gap-2",
|
|
500
|
-
children: [
|
|
501
|
-
/* @__PURE__ */ b("div", {
|
|
502
|
-
className: "flex-1 min-w-0",
|
|
503
|
-
children: /* @__PURE__ */ b(c, {
|
|
504
|
-
variant: "subtle",
|
|
505
|
-
size: "sm",
|
|
506
|
-
className: "w-full",
|
|
507
|
-
options: M,
|
|
508
|
-
value: e.selectKind,
|
|
509
|
-
onChange: (e) => i({ selectKind: e })
|
|
510
|
-
})
|
|
511
|
-
}),
|
|
512
|
-
/* @__PURE__ */ b(m, {
|
|
513
|
-
label: "Re-randomize this rule",
|
|
514
|
-
children: /* @__PURE__ */ b(s, {
|
|
515
|
-
tone: "ghost",
|
|
516
|
-
size: "sm",
|
|
517
|
-
iconOnly: "refresh",
|
|
518
|
-
iconSize: 12,
|
|
519
|
-
onClick: r,
|
|
520
|
-
"aria-label": "Re-randomize rule",
|
|
521
|
-
className: "shrink-0",
|
|
522
|
-
style: { padding: 6 }
|
|
523
|
-
})
|
|
524
|
-
}),
|
|
525
|
-
/* @__PURE__ */ b(m, {
|
|
526
|
-
label: "Remove rule",
|
|
527
|
-
children: /* @__PURE__ */ b(s, {
|
|
528
|
-
tone: "ghost",
|
|
529
|
-
size: "sm",
|
|
530
|
-
iconOnly: "x",
|
|
531
|
-
iconSize: 12,
|
|
532
|
-
onClick: n,
|
|
533
|
-
"aria-label": "Remove rule",
|
|
534
|
-
className: "shrink-0",
|
|
535
|
-
style: { padding: 6 }
|
|
536
|
-
})
|
|
537
|
-
})
|
|
538
|
-
]
|
|
539
|
-
}),
|
|
540
|
-
a && /* @__PURE__ */ x("div", {
|
|
541
|
-
className: "grid grid-cols-2 gap-2",
|
|
542
|
-
children: [/* @__PURE__ */ b(d, {
|
|
543
|
-
label: "N",
|
|
544
|
-
children: /* @__PURE__ */ b(V, {
|
|
545
|
-
value: e.n,
|
|
546
|
-
onChange: (e) => i({ n: e }),
|
|
547
|
-
min: 1
|
|
548
|
-
})
|
|
549
|
-
}), /* @__PURE__ */ b(d, {
|
|
550
|
-
label: "Offset",
|
|
551
|
-
children: /* @__PURE__ */ b(V, {
|
|
552
|
-
value: e.offset,
|
|
553
|
-
onChange: (e) => i({ offset: e })
|
|
554
|
-
})
|
|
555
|
-
})]
|
|
556
|
-
}),
|
|
557
|
-
o && /* @__PURE__ */ x("div", {
|
|
558
|
-
className: "grid grid-cols-2 gap-2",
|
|
559
|
-
children: [/* @__PURE__ */ b(d, {
|
|
560
|
-
label: "Row N",
|
|
561
|
-
children: /* @__PURE__ */ b(V, {
|
|
562
|
-
value: e.n2,
|
|
563
|
-
onChange: (e) => i({ n2: e }),
|
|
564
|
-
min: 1
|
|
565
|
-
})
|
|
566
|
-
}), /* @__PURE__ */ b(d, {
|
|
567
|
-
label: "Row offset",
|
|
568
|
-
children: /* @__PURE__ */ b(V, {
|
|
569
|
-
value: e.offset2,
|
|
570
|
-
onChange: (e) => i({ offset2: e })
|
|
571
|
-
})
|
|
572
|
-
})]
|
|
573
|
-
}),
|
|
574
|
-
u && /* @__PURE__ */ x(d, {
|
|
575
|
-
label: "Expression",
|
|
576
|
-
hint: "matches when > 0",
|
|
577
|
-
children: [/* @__PURE__ */ b(l, {
|
|
578
|
-
variant: "filled",
|
|
579
|
-
size: "sm",
|
|
580
|
-
value: e.expression,
|
|
581
|
-
onChange: (e) => i({ expression: e.target.value }),
|
|
582
|
-
placeholder: "sin(col * 0.6) + cos(row * 0.6)"
|
|
583
|
-
}), /* @__PURE__ */ b("span", {
|
|
584
|
-
className: "kol-mono-10 text-subtle mt-1",
|
|
585
|
-
children: "vars: i, col, row, cols, rows · Math.* in scope"
|
|
586
|
-
})]
|
|
587
|
-
}),
|
|
588
|
-
/* @__PURE__ */ x("div", {
|
|
589
|
-
className: "grid grid-cols-2 gap-2",
|
|
590
|
-
children: [/* @__PURE__ */ b(d, {
|
|
591
|
-
label: "Group W",
|
|
592
|
-
children: /* @__PURE__ */ b(V, {
|
|
593
|
-
value: e.groupW,
|
|
594
|
-
onChange: (e) => i({ groupW: Math.max(1, e) }),
|
|
595
|
-
min: 1
|
|
596
|
-
})
|
|
597
|
-
}), /* @__PURE__ */ b(d, {
|
|
598
|
-
label: "Group H",
|
|
599
|
-
children: /* @__PURE__ */ b(V, {
|
|
600
|
-
value: e.groupH,
|
|
601
|
-
onChange: (e) => i({ groupH: Math.max(1, e) }),
|
|
602
|
-
min: 1
|
|
603
|
-
})
|
|
604
|
-
})]
|
|
605
|
-
}),
|
|
606
|
-
/* @__PURE__ */ x("div", {
|
|
607
|
-
className: "flex flex-wrap gap-1",
|
|
608
|
-
children: [
|
|
609
|
-
/* @__PURE__ */ b(c, {
|
|
610
|
-
variant: "subtle",
|
|
611
|
-
size: "sm",
|
|
612
|
-
options: N,
|
|
613
|
-
value: e.rotate,
|
|
614
|
-
onChange: (e) => i({ rotate: Number(e) })
|
|
615
|
-
}),
|
|
616
|
-
/* @__PURE__ */ b(H, {
|
|
617
|
-
active: e.flipH,
|
|
618
|
-
onClick: () => i({ flipH: !e.flipH }),
|
|
619
|
-
title: "Flip horizontal",
|
|
620
|
-
children: "⇋"
|
|
621
|
-
}),
|
|
622
|
-
/* @__PURE__ */ b(H, {
|
|
623
|
-
active: e.flipV,
|
|
624
|
-
onClick: () => i({ flipV: !e.flipV }),
|
|
625
|
-
title: "Flip vertical",
|
|
626
|
-
children: "⇵"
|
|
627
|
-
}),
|
|
628
|
-
/* @__PURE__ */ b(H, {
|
|
629
|
-
active: e.hide,
|
|
630
|
-
onClick: () => i({ hide: !e.hide }),
|
|
631
|
-
title: "Hide cell",
|
|
632
|
-
children: "hide"
|
|
633
|
-
})
|
|
634
|
-
]
|
|
635
|
-
}),
|
|
636
|
-
/* @__PURE__ */ b(d, {
|
|
637
|
-
label: "Opacity",
|
|
638
|
-
hint: `${Math.round(e.opacity * 100)}%`,
|
|
639
|
-
children: /* @__PURE__ */ b(f, {
|
|
640
|
-
min: 0,
|
|
641
|
-
max: 100,
|
|
642
|
-
value: Math.round(e.opacity * 100),
|
|
643
|
-
onChange: (e) => i({ opacity: e / 100 })
|
|
644
|
-
})
|
|
645
|
-
})
|
|
646
|
-
]
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
//#endregion
|
|
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 };
|