@kolkrabbi/design-editor 0.46.0 → 0.48.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-B0VcuOag.js → BindDot-Cx-M0iQt.js} +9 -8
- package/dist/{BufferResource-BfLgK37S.js → BufferResource-Di5teicy.js} +2 -2
- package/dist/{CanvasPool-YNSF8hsR.js → CanvasPool-JdLj49b-.js} +1 -1
- package/dist/CanvasRenderer-fXDObOOi.js +2 -0
- package/dist/{FederatedEventTarget-BJgROaRQ.js → FederatedEventTarget-CH0bzxx1.js} +1 -1
- package/dist/{FilterSystem-BUrPNXx-.js → FilterSystem-C-ZoyuTO.js} +3 -3
- package/dist/{Geometry-C5s5KpWq.js → Geometry-D4tiuMOr.js} +1 -1
- package/dist/KolboxView-BjYfn_tl.js +21615 -0
- package/dist/{RenderTargetSystem-oFwWv5IW.js → RenderTargetSystem-Bom_vhlS.js} +1 -1
- package/dist/{Timeline-Ck1rBV8S.js → Timeline-CRr43b4B.js} +49 -53
- package/dist/TreePicker-DXsAlHK6.js +209 -0
- package/dist/WebGLRenderer-4hvrGmfW.js +2 -0
- package/dist/WebGPURenderer-BjzMV7Pg.js +2 -0
- package/dist/__vite-browser-external-y2xWjzgx.js +780 -0
- package/dist/browserAll-BFE0MRLW.js +6 -0
- package/dist/{canvasUtils-BoNfkAod.js → canvasUtils-DUNsu3ct.js} +1 -1
- package/dist/{core-BBb9Tk4Q.js → core-BbKj9Svq.js} +5877 -8206
- package/dist/core.js +6 -5
- package/dist/design-editor.css +2 -1
- package/dist/design-editor.js +7 -3644
- package/dist/{effectCategories-Ccye-8LP.js → effectCategories-wHY9ih8L.js} +8966 -4985
- package/dist/effects-D7J0e5xl.js +447 -0
- package/dist/effects.js +1 -1
- package/dist/{generators-BdVXv0jY.js → generators-BtRZ3Stj.js} +2473 -2538
- package/dist/generators.js +1 -1
- package/dist/{getTextureBatchBindGroup-CNWhZRbV.js → getTextureBatchBindGroup-ZMqkwiZS.js} +1 -1
- package/dist/{host-meUhieO9.js → host-0qv2SCjk.js} +1 -1
- package/dist/{host-9pJ7NvnR.js → host-II9SeVCH.js} +50 -50
- package/dist/init-DkGhdexn.js +4 -0
- package/dist/kolbox-sheet.js +0 -0
- package/dist/kolbox.css +3 -0
- package/dist/{morphStore-D6mkLJ-8.js → morphStore-s-rjCe-y.js} +1 -1
- package/dist/{motion-wsc6Qd7S.js → motion-CKtZAccJ.js} +765 -762
- package/dist/motion.js +1 -1
- package/dist/{pipeline-CMpuPUaX.js → pipeline-hZsOKbHd.js} +12 -12
- package/dist/{previewScale-SYKvfhUm.js → previewScale-C6EBx--U.js} +8 -8
- package/dist/{rolls-KpWCAeDv.js → rolls-Cnu6g8th.js} +10671 -4810
- package/dist/src-3UkpFoNW.js +3430 -0
- package/dist/{src-B5o6fGRJ.js → src-D-TQbBo2.js} +1 -2
- package/dist/{store-iBb0I6hk.js → store-YIW6P2zN.js} +289 -269
- package/dist/useLayerEdit-W_Tf3adq.js +455 -0
- package/dist/webworkerAll-0WBQ2FBr.js +2 -0
- package/package.json +16 -13
- package/dist/CanvasRenderer-Bl0rlqNq.js +0 -2
- package/dist/TreePicker-Dv0zpJwe.js +0 -166
- package/dist/WebGLRenderer-CXxpVIx3.js +0 -2
- package/dist/WebGPURenderer-BwLEUYBa.js +0 -2
- package/dist/browserAll-CAzdTUbR.js +0 -6
- package/dist/chunk-3b4jIN3o.js +0 -13
- package/dist/effects-B47bpwGh.js +0 -447
- package/dist/init-jApIMi04.js +0 -4
- package/dist/useLayerEdit-Ba7RA6qX.js +0 -454
- package/dist/webworkerAll-DEZhpG90.js +0 -2
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
import { D as e, F as t, I as n, J as r, L as i, Pn as a, T as o, _n as s, cn as c, dn as l, fn as u, gn as d, gt as f, hn as p, ht as m, j as h, kn as g, mn as _, mt as v, pn as y, pt as b, un as x, vn as S, xn as C, yn as w } from "./rolls-KpWCAeDv.js";
|
|
2
|
-
import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as k } from "react";
|
|
3
|
-
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
4
|
-
//#region src/editor/lib/viewport.js
|
|
5
|
-
var N = Math.PI * 2, P = {
|
|
6
|
-
vpZoom: 1,
|
|
7
|
-
vpSpin: 0,
|
|
8
|
-
vpPulse: 0,
|
|
9
|
-
vpWobble: 0,
|
|
10
|
-
vpRate: 1
|
|
11
|
-
}, F = {
|
|
12
|
-
vpTime: "linear",
|
|
13
|
-
vpSpeed: 1,
|
|
14
|
-
vpPhase: 0
|
|
15
|
-
}, I = [
|
|
16
|
-
{
|
|
17
|
-
key: "vpTime",
|
|
18
|
-
label: "Time",
|
|
19
|
-
type: "select",
|
|
20
|
-
default: "linear",
|
|
21
|
-
options: [
|
|
22
|
-
{
|
|
23
|
-
value: "linear",
|
|
24
|
-
label: "Linear"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
value: "ease",
|
|
28
|
-
label: "Ease"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
value: "pingpong",
|
|
32
|
-
label: "Ping-pong"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
value: "steps",
|
|
36
|
-
label: "Steps"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
value: "bounce",
|
|
40
|
-
label: "Bounce"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
value: "drift",
|
|
44
|
-
label: "Drift"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
tab: "anim",
|
|
48
|
-
section: "Form"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
key: "vpSpeed",
|
|
52
|
-
label: "Speed",
|
|
53
|
-
type: "range",
|
|
54
|
-
min: 1,
|
|
55
|
-
max: 8,
|
|
56
|
-
rMin: 1,
|
|
57
|
-
rMax: 4,
|
|
58
|
-
step: 1,
|
|
59
|
-
default: 1,
|
|
60
|
-
tab: "anim",
|
|
61
|
-
section: "Form"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
key: "vpPhase",
|
|
65
|
-
label: "Phase",
|
|
66
|
-
type: "range",
|
|
67
|
-
min: 0,
|
|
68
|
-
max: 1,
|
|
69
|
-
step: .05,
|
|
70
|
-
default: 0,
|
|
71
|
-
tab: "anim",
|
|
72
|
-
section: "Form"
|
|
73
|
-
}
|
|
74
|
-
], L = (e) => e - Math.floor(e);
|
|
75
|
-
function R(e, t) {
|
|
76
|
-
if (!t) return e;
|
|
77
|
-
let n = t.vpTime || "linear", r = Math.max(1, Math.round(t.vpSpeed || 1)), i = t.vpPhase || 0;
|
|
78
|
-
if (n === "linear" && r === 1 && !i) return e;
|
|
79
|
-
let a = L(e * r);
|
|
80
|
-
switch (n) {
|
|
81
|
-
case "ease":
|
|
82
|
-
a = .5 - .5 * Math.cos(a * Math.PI);
|
|
83
|
-
break;
|
|
84
|
-
case "pingpong":
|
|
85
|
-
a = a < .5 ? a * 2 : 2 - a * 2;
|
|
86
|
-
break;
|
|
87
|
-
case "steps":
|
|
88
|
-
a = Math.floor(a * 4) / 4;
|
|
89
|
-
break;
|
|
90
|
-
case "bounce": {
|
|
91
|
-
let e = Math.abs(Math.sin(a * Math.PI * 2));
|
|
92
|
-
a = a < .5 ? e : 1 - e * .5, a = L(a);
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
case "drift":
|
|
96
|
-
a = L(a + .08 * Math.sin(a * N) + .04 * Math.sin(a * N * 3));
|
|
97
|
-
break;
|
|
98
|
-
default: break;
|
|
99
|
-
}
|
|
100
|
-
return L(a + i);
|
|
101
|
-
}
|
|
102
|
-
var z = [
|
|
103
|
-
{
|
|
104
|
-
key: "vpSpin",
|
|
105
|
-
label: "Spin",
|
|
106
|
-
type: "range",
|
|
107
|
-
min: -8,
|
|
108
|
-
max: 8,
|
|
109
|
-
rMin: 0,
|
|
110
|
-
rMax: 4,
|
|
111
|
-
step: 1,
|
|
112
|
-
default: 0,
|
|
113
|
-
tab: "anim",
|
|
114
|
-
section: "Frame"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
key: "vpZoom",
|
|
118
|
-
label: "Zoom",
|
|
119
|
-
type: "range",
|
|
120
|
-
min: 1,
|
|
121
|
-
max: 2.5,
|
|
122
|
-
step: .05,
|
|
123
|
-
default: 1,
|
|
124
|
-
tab: "anim",
|
|
125
|
-
section: "Frame"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
key: "vpPulse",
|
|
129
|
-
label: "Pulse",
|
|
130
|
-
type: "range",
|
|
131
|
-
min: 0,
|
|
132
|
-
max: 1,
|
|
133
|
-
step: .05,
|
|
134
|
-
default: 0,
|
|
135
|
-
tab: "anim",
|
|
136
|
-
section: "Form"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
key: "vpWobble",
|
|
140
|
-
label: "Wobble",
|
|
141
|
-
type: "range",
|
|
142
|
-
min: 0,
|
|
143
|
-
max: 30,
|
|
144
|
-
step: 1,
|
|
145
|
-
default: 0,
|
|
146
|
-
tab: "anim",
|
|
147
|
-
section: "Form"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
key: "vpRate",
|
|
151
|
-
label: "Rate",
|
|
152
|
-
type: "range",
|
|
153
|
-
min: 1,
|
|
154
|
-
max: 8,
|
|
155
|
-
rMin: 1,
|
|
156
|
-
rMax: 4,
|
|
157
|
-
step: 1,
|
|
158
|
-
default: 1,
|
|
159
|
-
tab: "anim",
|
|
160
|
-
section: "Form"
|
|
161
|
-
}
|
|
162
|
-
];
|
|
163
|
-
function B(e, t, n, r, i) {
|
|
164
|
-
let a = Math.round(i.vpSpin || 0), o = i.vpZoom ?? 1, s = i.vpPulse || 0, c = i.vpWobble || 0;
|
|
165
|
-
if (!a && s === 0 && c === 0 && o === 1) return !1;
|
|
166
|
-
let l = t * N * Math.round(i.vpRate || 1), u = t * N * 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);
|
|
167
|
-
return e.translate(n / 2, r / 2), e.rotate(u), e.scale(p, p), e.translate(-n / 2, -r / 2), !0;
|
|
168
|
-
}
|
|
169
|
-
function V(e, t, n, r, i, a) {
|
|
170
|
-
if (!t) return;
|
|
171
|
-
let o = R(n, a);
|
|
172
|
-
e.save(), B(e, o, r, i, a), t.draw(e, o, r, i, a), e.restore();
|
|
173
|
-
}
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/editor/components/Hint.jsx
|
|
176
|
-
function H({ children: e, className: t = "kol-mono-12 text-meta", always: n = !1 }) {
|
|
177
|
-
return /* @__PURE__ */ j("p", {
|
|
178
|
-
className: `${n ? "" : "kol-placeholder "}${t}`,
|
|
179
|
-
children: e
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
//#endregion
|
|
183
|
-
//#region src/editor/params/AutoControls.jsx
|
|
184
|
-
function U({ schema: t, layer: n, setProp: r, palette: i, renderAnimate: a, tab: o, emptyHint: s, inline: l = !0 }) {
|
|
185
|
-
let u = f(t, n);
|
|
186
|
-
if (o && (u = u.filter((e) => m(e) === o)), u.length === 0) return s ? /* @__PURE__ */ j(H, { children: s }) : null;
|
|
187
|
-
let d = [];
|
|
188
|
-
for (let e of u) {
|
|
189
|
-
let t = v(e), n = d[d.length - 1];
|
|
190
|
-
n && n.section === t ? n.params.push(e) : d.push({
|
|
191
|
-
section: t,
|
|
192
|
-
params: [e]
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
for (let e = 0; e < d.length; e++) {
|
|
196
|
-
let t = d[e];
|
|
197
|
-
if (t.section) continue;
|
|
198
|
-
let n = 0;
|
|
199
|
-
for (; n < t.params.length && t.params[n].type === "select";) n++;
|
|
200
|
-
n === 0 || n === t.params.length || (d.splice(e, 1, {
|
|
201
|
-
section: void 0,
|
|
202
|
-
params: t.params.slice(0, n)
|
|
203
|
-
}, {
|
|
204
|
-
section: void 0,
|
|
205
|
-
params: t.params.slice(n)
|
|
206
|
-
}), e++);
|
|
207
|
-
}
|
|
208
|
-
return /* @__PURE__ */ j(A, { children: d.map((t) => {
|
|
209
|
-
let o = Math.max(0, ...t.params.filter((e) => e.type === "range").map(W)), s = t.section && t.params.some((e) => e.collapsed), u = /* @__PURE__ */ j(_, {
|
|
210
|
-
label: !s && t.section && t.section !== t.params[0].label ? t.section : void 0,
|
|
211
|
-
divided: !s,
|
|
212
|
-
children: t.params.map((t) => {
|
|
213
|
-
let s = e(n[t.key]);
|
|
214
|
-
return /* @__PURE__ */ j(J, {
|
|
215
|
-
param: t,
|
|
216
|
-
layer: n,
|
|
217
|
-
setProp: r,
|
|
218
|
-
palette: i,
|
|
219
|
-
bound: s,
|
|
220
|
-
animate: a && b(t) ? a(t, s) : null,
|
|
221
|
-
inline: l,
|
|
222
|
-
chars: o || void 0
|
|
223
|
-
}, t.key);
|
|
224
|
-
})
|
|
225
|
-
}, t.params[0].key);
|
|
226
|
-
return s ? /* @__PURE__ */ j(c, {
|
|
227
|
-
title: t.section,
|
|
228
|
-
children: u
|
|
229
|
-
}, t.params[0].key) : u;
|
|
230
|
-
}) });
|
|
231
|
-
}
|
|
232
|
-
function W(e) {
|
|
233
|
-
let t = e.step && e.step < 1 ? String(e.step).split(".")[1]?.length ?? 2 : 0;
|
|
234
|
-
return Math.max(2, String(Math.round(e.max ?? 0)).length, String(Math.round(e.min ?? 0)).length) + (t ? t + 1 : 0);
|
|
235
|
-
}
|
|
236
|
-
function G({ param: t, layer: n, setProp: r, chars: o }) {
|
|
237
|
-
let s = i(), c = n[t.key], l = e(c), f = l && c.bind === "mod" && c.source === "expr", p = g(l), m = l ? h(c, p, n) : c, _ = typeof m == "number" ? m : t.default ?? 0, v = t.step && t.step < 1 ? String(t.step).split(".")[1]?.length ?? 2 : 0, y = f ? c.transform?.expr ?? "wave(t)" : t.format ? String(t.format(_)) : v ? _.toFixed(v) : String(Math.round(_)), b = o ?? W(t), [x, S] = k(y), [w, T] = k(!1);
|
|
238
|
-
return E(() => {
|
|
239
|
-
w || S(y);
|
|
240
|
-
}, [y, w]), /* @__PURE__ */ M("div", {
|
|
241
|
-
className: `flex items-center gap-3${C() === "float" ? " w-full" : ""}`,
|
|
242
|
-
children: [!l && /* @__PURE__ */ j(d, {
|
|
243
|
-
min: t.min,
|
|
244
|
-
max: t.max,
|
|
245
|
-
step: t.step ?? 1,
|
|
246
|
-
value: _,
|
|
247
|
-
onChange: (e) => r(t.key, Number(e)),
|
|
248
|
-
readout: "none",
|
|
249
|
-
className: "flex-1"
|
|
250
|
-
}), /* @__PURE__ */ j(u, {
|
|
251
|
-
type: "text",
|
|
252
|
-
variant: "filled",
|
|
253
|
-
size: s,
|
|
254
|
-
width: `calc(${b}ch + 24px)`,
|
|
255
|
-
value: x,
|
|
256
|
-
title: "Number sets a constant · an expression like sin(t) binds it",
|
|
257
|
-
onFocus: (e) => {
|
|
258
|
-
T(!0), e.target.select();
|
|
259
|
-
},
|
|
260
|
-
onChange: (e) => S(e.target.value),
|
|
261
|
-
onBlur: () => {
|
|
262
|
-
T(!1);
|
|
263
|
-
let e = x.trim();
|
|
264
|
-
if (e === "") {
|
|
265
|
-
S(y);
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
let n = Number(e);
|
|
269
|
-
if (Number.isFinite(n)) {
|
|
270
|
-
r(t.key, n);
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (!a(e).ok) {
|
|
274
|
-
S(y);
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
let i = l && c.transform?.range || (t.min != null && t.max != null ? [t.min, t.max] : [0, 1]);
|
|
278
|
-
r(t.key, {
|
|
279
|
-
bind: "mod",
|
|
280
|
-
source: "expr",
|
|
281
|
-
transform: {
|
|
282
|
-
...l ? c.transform : {},
|
|
283
|
-
expr: e,
|
|
284
|
-
range: i
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
},
|
|
288
|
-
onKeyDown: (e) => {
|
|
289
|
-
e.key === "Enter" && e.currentTarget.blur(), e.key === "Escape" && (S(y), T(!1), e.currentTarget.blur());
|
|
290
|
-
},
|
|
291
|
-
inputClassName: "text-center"
|
|
292
|
-
})]
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
var K = t, q = {
|
|
296
|
-
xs: "h-[var(--kol-ctl-xs)]",
|
|
297
|
-
sm: "h-[var(--kol-ctl-sm)]",
|
|
298
|
-
md: "h-[var(--kol-ctl-md)]",
|
|
299
|
-
lg: "h-[var(--kol-ctl-lg)]"
|
|
300
|
-
};
|
|
301
|
-
function J({ param: e, layer: t, setProp: r, palette: a, bound: c, animate: u, inline: d, chars: f }) {
|
|
302
|
-
let m = i(), h = C() === "float", g = t[e.key], _ = g === void 0 ? e.default : g;
|
|
303
|
-
if (e.type === "color") return /* @__PURE__ */ M("div", {
|
|
304
|
-
className: "flex items-end gap-2",
|
|
305
|
-
children: [/* @__PURE__ */ j("div", {
|
|
306
|
-
className: "flex-1 min-w-0",
|
|
307
|
-
children: /* @__PURE__ */ j(o, {
|
|
308
|
-
label: e.label,
|
|
309
|
-
value: _,
|
|
310
|
-
onChange: (t) => r(e.key, t),
|
|
311
|
-
palette: a,
|
|
312
|
-
inline: d
|
|
313
|
-
})
|
|
314
|
-
}), u]
|
|
315
|
-
});
|
|
316
|
-
let v = d, b = null;
|
|
317
|
-
if (e.type === "range") m !== "sm" && (v = !1), b = /* @__PURE__ */ j(G, {
|
|
318
|
-
param: e,
|
|
319
|
-
layer: t,
|
|
320
|
-
setProp: r,
|
|
321
|
-
chars: f
|
|
322
|
-
});
|
|
323
|
-
else if (e.type === "select") b = /* @__PURE__ */ j(l, {
|
|
324
|
-
variant: "subtle",
|
|
325
|
-
size: m,
|
|
326
|
-
className: "w-full",
|
|
327
|
-
options: e.options ?? [],
|
|
328
|
-
value: _,
|
|
329
|
-
onChange: (t) => r(e.key, e.numeric ? Number(t) : t)
|
|
330
|
-
});
|
|
331
|
-
else if (e.type === "segmented") b = d ? /* @__PURE__ */ j(x, {
|
|
332
|
-
layout: "joined",
|
|
333
|
-
tone: "sunken",
|
|
334
|
-
size: m,
|
|
335
|
-
className: `w-full ${n(m) ?? ""}`,
|
|
336
|
-
options: e.options ?? [],
|
|
337
|
-
value: _,
|
|
338
|
-
onChange: (t) => r(e.key, t)
|
|
339
|
-
}) : /* @__PURE__ */ j(w, {
|
|
340
|
-
size: m,
|
|
341
|
-
options: e.options ?? [],
|
|
342
|
-
viewMode: _,
|
|
343
|
-
onViewChange: (t) => r(e.key, t)
|
|
344
|
-
});
|
|
345
|
-
else if (e.type === "toggle") {
|
|
346
|
-
let [t, i] = e.labels ?? ["Off", "On"];
|
|
347
|
-
e.labels ? d ? b = /* @__PURE__ */ j(x, {
|
|
348
|
-
layout: "joined",
|
|
349
|
-
tone: "sunken",
|
|
350
|
-
size: m,
|
|
351
|
-
className: `w-full ${n(m) ?? ""}`,
|
|
352
|
-
options: [{
|
|
353
|
-
value: "off",
|
|
354
|
-
label: t
|
|
355
|
-
}, {
|
|
356
|
-
value: "on",
|
|
357
|
-
label: i
|
|
358
|
-
}],
|
|
359
|
-
value: _ ? "on" : "off",
|
|
360
|
-
onChange: (t) => r(e.key, t === "on")
|
|
361
|
-
}) : (v = !1, b = /* @__PURE__ */ j(w, {
|
|
362
|
-
size: m,
|
|
363
|
-
options: [{
|
|
364
|
-
value: "off",
|
|
365
|
-
label: t
|
|
366
|
-
}, {
|
|
367
|
-
value: "on",
|
|
368
|
-
label: i
|
|
369
|
-
}],
|
|
370
|
-
viewMode: _ ? "on" : "off",
|
|
371
|
-
onViewChange: (t) => r(e.key, t === "on")
|
|
372
|
-
})) : (d || (v = !1), b = /* @__PURE__ */ j(S, {
|
|
373
|
-
size: m,
|
|
374
|
-
checked: !!_,
|
|
375
|
-
onChange: (t) => r(e.key, t)
|
|
376
|
-
}));
|
|
377
|
-
} else if (e.type === "text") v = !1, b = /* @__PURE__ */ j(s, {
|
|
378
|
-
variant: "filled",
|
|
379
|
-
size: m,
|
|
380
|
-
rows: e.rows ?? 2,
|
|
381
|
-
axis: "y",
|
|
382
|
-
value: _ ?? "",
|
|
383
|
-
onChange: (t) => r(e.key, t.target.value),
|
|
384
|
-
placeholder: e.placeholder
|
|
385
|
-
});
|
|
386
|
-
else return null;
|
|
387
|
-
let T = e.type === "range" && e.format && typeof _ == "number" && !c ? e.format(_) : void 0, E = u ? /* @__PURE__ */ M("div", {
|
|
388
|
-
className: "flex items-center gap-2",
|
|
389
|
-
children: [/* @__PURE__ */ j("div", {
|
|
390
|
-
className: "flex-1 min-w-0",
|
|
391
|
-
children: b
|
|
392
|
-
}), u]
|
|
393
|
-
}) : b, D = e.type === "toggle" && !e.labels ? "end" : "fill", O = e.type === "toggle" && !e.labels && !d, k = (e) => h ? e : String(e).toUpperCase();
|
|
394
|
-
return v && D === "end" && !T ? /* @__PURE__ */ j(y, {
|
|
395
|
-
horizontal: !0,
|
|
396
|
-
label: k(e.label),
|
|
397
|
-
labelWidth: K,
|
|
398
|
-
children: /* @__PURE__ */ j("div", {
|
|
399
|
-
className: `flex w-full items-center justify-end ${q[m] ?? ""}`,
|
|
400
|
-
children: E
|
|
401
|
-
})
|
|
402
|
-
}) : v ? /* @__PURE__ */ j(p, {
|
|
403
|
-
label: e.label,
|
|
404
|
-
hint: T,
|
|
405
|
-
align: D,
|
|
406
|
-
labelWidth: K,
|
|
407
|
-
children: E
|
|
408
|
-
}) : /* @__PURE__ */ j(y, {
|
|
409
|
-
horizontal: O,
|
|
410
|
-
label: d ? k(e.label) : e.label,
|
|
411
|
-
hint: T,
|
|
412
|
-
labelWidth: O ? "auto" : K,
|
|
413
|
-
children: E
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
//#endregion
|
|
417
|
-
//#region src/editor/compose/useLayerEdit.js
|
|
418
|
-
function Y(e, { history: t = "discrete", coalesceMs: n = 250 } = {}) {
|
|
419
|
-
let { updateLayer: i, beginTransaction: a, commitTransaction: o } = r(), s = O(null), c = T(() => {
|
|
420
|
-
s.current !== null && (clearTimeout(s.current), s.current = null, o());
|
|
421
|
-
}, [o]), l = T((r) => {
|
|
422
|
-
if (e) {
|
|
423
|
-
if (t === "discrete") {
|
|
424
|
-
i(e, r);
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
if (t === "coalesce") {
|
|
428
|
-
s.current === null && a(), i(e, r), s.current !== null && clearTimeout(s.current), s.current = setTimeout(() => {
|
|
429
|
-
s.current = null, o();
|
|
430
|
-
}, n);
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
i(e, r);
|
|
434
|
-
}
|
|
435
|
-
}, [
|
|
436
|
-
e,
|
|
437
|
-
t,
|
|
438
|
-
n,
|
|
439
|
-
i,
|
|
440
|
-
a,
|
|
441
|
-
o
|
|
442
|
-
]), u = T((e, t) => l({ [e]: t }), [l]);
|
|
443
|
-
return E(() => () => c(), [c, e]), D(() => ({
|
|
444
|
-
patch: l,
|
|
445
|
-
setProp: u,
|
|
446
|
-
flush: c
|
|
447
|
-
}), [
|
|
448
|
-
l,
|
|
449
|
-
u,
|
|
450
|
-
c
|
|
451
|
-
]);
|
|
452
|
-
}
|
|
453
|
-
//#endregion
|
|
454
|
-
export { I as a, V as c, F as i, R as l, U as n, P as o, H as r, z as s, Y as t };
|