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