@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
|
@@ -0,0 +1,455 @@
|
|
|
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, I as o, J as s, Jn as c, Kn as l, L as u, Qn as d, Qt as f, T as p, Wn as m, Xn as h, Yn as g, Zn as _, Zt as v, en as y, er as b, j as x, qn as S, tr as C } from "./rolls-Cnu6g8th.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
|
+
//#region src/editor/lib/viewport.js
|
|
6
|
+
var M = Math.PI * 2, N = {
|
|
7
|
+
vpZoom: 1,
|
|
8
|
+
vpSpin: 0,
|
|
9
|
+
vpPulse: 0,
|
|
10
|
+
vpWobble: 0,
|
|
11
|
+
vpRate: 1
|
|
12
|
+
}, P = {
|
|
13
|
+
vpTime: "linear",
|
|
14
|
+
vpSpeed: 1,
|
|
15
|
+
vpPhase: 0
|
|
16
|
+
}, F = [
|
|
17
|
+
{
|
|
18
|
+
key: "vpTime",
|
|
19
|
+
label: "Time",
|
|
20
|
+
type: "select",
|
|
21
|
+
default: "linear",
|
|
22
|
+
options: [
|
|
23
|
+
{
|
|
24
|
+
value: "linear",
|
|
25
|
+
label: "Linear"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: "ease",
|
|
29
|
+
label: "Ease"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: "pingpong",
|
|
33
|
+
label: "Ping-pong"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: "steps",
|
|
37
|
+
label: "Steps"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
value: "bounce",
|
|
41
|
+
label: "Bounce"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: "drift",
|
|
45
|
+
label: "Drift"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
tab: "anim",
|
|
49
|
+
section: "Form"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "vpSpeed",
|
|
53
|
+
label: "Speed",
|
|
54
|
+
type: "range",
|
|
55
|
+
min: 1,
|
|
56
|
+
max: 8,
|
|
57
|
+
rMin: 1,
|
|
58
|
+
rMax: 4,
|
|
59
|
+
step: 1,
|
|
60
|
+
default: 1,
|
|
61
|
+
tab: "anim",
|
|
62
|
+
section: "Form"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "vpPhase",
|
|
66
|
+
label: "Phase",
|
|
67
|
+
type: "range",
|
|
68
|
+
min: 0,
|
|
69
|
+
max: 1,
|
|
70
|
+
step: .05,
|
|
71
|
+
default: 0,
|
|
72
|
+
tab: "anim",
|
|
73
|
+
section: "Form"
|
|
74
|
+
}
|
|
75
|
+
], I = (e) => e - Math.floor(e);
|
|
76
|
+
function L(e, t) {
|
|
77
|
+
if (!t) return e;
|
|
78
|
+
let n = t.vpTime || "linear", r = Math.max(1, Math.round(t.vpSpeed || 1)), i = t.vpPhase || 0;
|
|
79
|
+
if (n === "linear" && r === 1 && !i) return e;
|
|
80
|
+
let a = I(e * r);
|
|
81
|
+
switch (n) {
|
|
82
|
+
case "ease":
|
|
83
|
+
a = .5 - .5 * Math.cos(a * Math.PI);
|
|
84
|
+
break;
|
|
85
|
+
case "pingpong":
|
|
86
|
+
a = a < .5 ? a * 2 : 2 - a * 2;
|
|
87
|
+
break;
|
|
88
|
+
case "steps":
|
|
89
|
+
a = Math.floor(a * 4) / 4;
|
|
90
|
+
break;
|
|
91
|
+
case "bounce": {
|
|
92
|
+
let e = Math.abs(Math.sin(a * Math.PI * 2));
|
|
93
|
+
a = a < .5 ? e : 1 - e * .5, a = I(a);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case "drift":
|
|
97
|
+
a = I(a + .08 * Math.sin(a * M) + .04 * Math.sin(a * M * 3));
|
|
98
|
+
break;
|
|
99
|
+
default: break;
|
|
100
|
+
}
|
|
101
|
+
return I(a + i);
|
|
102
|
+
}
|
|
103
|
+
var R = [
|
|
104
|
+
{
|
|
105
|
+
key: "vpSpin",
|
|
106
|
+
label: "Spin",
|
|
107
|
+
type: "range",
|
|
108
|
+
min: -8,
|
|
109
|
+
max: 8,
|
|
110
|
+
rMin: 0,
|
|
111
|
+
rMax: 4,
|
|
112
|
+
step: 1,
|
|
113
|
+
default: 0,
|
|
114
|
+
tab: "anim",
|
|
115
|
+
section: "Frame"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "vpZoom",
|
|
119
|
+
label: "Zoom",
|
|
120
|
+
type: "range",
|
|
121
|
+
min: 1,
|
|
122
|
+
max: 2.5,
|
|
123
|
+
step: .05,
|
|
124
|
+
default: 1,
|
|
125
|
+
tab: "anim",
|
|
126
|
+
section: "Frame"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
key: "vpPulse",
|
|
130
|
+
label: "Pulse",
|
|
131
|
+
type: "range",
|
|
132
|
+
min: 0,
|
|
133
|
+
max: 1,
|
|
134
|
+
step: .05,
|
|
135
|
+
default: 0,
|
|
136
|
+
tab: "anim",
|
|
137
|
+
section: "Form"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
key: "vpWobble",
|
|
141
|
+
label: "Wobble",
|
|
142
|
+
type: "range",
|
|
143
|
+
min: 0,
|
|
144
|
+
max: 30,
|
|
145
|
+
step: 1,
|
|
146
|
+
default: 0,
|
|
147
|
+
tab: "anim",
|
|
148
|
+
section: "Form"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
key: "vpRate",
|
|
152
|
+
label: "Rate",
|
|
153
|
+
type: "range",
|
|
154
|
+
min: 1,
|
|
155
|
+
max: 8,
|
|
156
|
+
rMin: 1,
|
|
157
|
+
rMax: 4,
|
|
158
|
+
step: 1,
|
|
159
|
+
default: 1,
|
|
160
|
+
tab: "anim",
|
|
161
|
+
section: "Form"
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
function z(e, t, n, r, i) {
|
|
165
|
+
let a = Math.round(i.vpSpin || 0), o = i.vpZoom ?? 1, s = i.vpPulse || 0, c = i.vpWobble || 0;
|
|
166
|
+
if (!a && s === 0 && c === 0 && o === 1) return !1;
|
|
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
|
+
return e.translate(n / 2, r / 2), e.rotate(u), e.scale(p, p), e.translate(-n / 2, -r / 2), !0;
|
|
169
|
+
}
|
|
170
|
+
function B(e, t, n, r, i, a) {
|
|
171
|
+
if (!t) return;
|
|
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
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/editor/components/Hint.jsx
|
|
177
|
+
function V({ children: e, className: t = "kol-mono-12 text-meta", always: n = !1 }) {
|
|
178
|
+
return /* @__PURE__ */ A("p", {
|
|
179
|
+
className: `${n ? "" : "kol-placeholder "}${t}`,
|
|
180
|
+
children: e
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/editor/params/AutoControls.jsx
|
|
185
|
+
function H({ schema: e, layer: t, setProp: n, palette: a, renderAnimate: o, tab: s, emptyHint: c, inline: l = !0 }) {
|
|
186
|
+
let u = y(e, t);
|
|
187
|
+
if (s && (u = u.filter((e) => r(e) === s)), u.length === 0) return c ? /* @__PURE__ */ A(V, { children: c }) : null;
|
|
188
|
+
let d = [];
|
|
189
|
+
for (let e of u) {
|
|
190
|
+
let t = f(e), n = d[d.length - 1];
|
|
191
|
+
n && n.section === t ? n.params.push(e) : d.push({
|
|
192
|
+
section: t,
|
|
193
|
+
params: [e]
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
for (let e = 0; e < d.length; e++) {
|
|
197
|
+
let t = d[e];
|
|
198
|
+
if (t.section) continue;
|
|
199
|
+
let n = 0;
|
|
200
|
+
for (; n < t.params.length && t.params[n].type === "select";) n++;
|
|
201
|
+
n === 0 || n === t.params.length || (d.splice(e, 1, {
|
|
202
|
+
section: void 0,
|
|
203
|
+
params: t.params.slice(0, n)
|
|
204
|
+
}, {
|
|
205
|
+
section: void 0,
|
|
206
|
+
params: t.params.slice(n)
|
|
207
|
+
}), e++);
|
|
208
|
+
}
|
|
209
|
+
return /* @__PURE__ */ A(k, { children: d.map((e) => {
|
|
210
|
+
let r = Math.max(0, ...e.params.filter((e) => e.type === "range").map(U)), s = e.section && e.params.some((e) => e.collapsed), c = /* @__PURE__ */ A(h, {
|
|
211
|
+
label: !s && e.section && e.section !== e.params[0].label ? e.section : void 0,
|
|
212
|
+
divided: !s,
|
|
213
|
+
children: e.params.map((e) => {
|
|
214
|
+
let s = i(t[e.key]);
|
|
215
|
+
return /* @__PURE__ */ A(q, {
|
|
216
|
+
param: e,
|
|
217
|
+
layer: t,
|
|
218
|
+
setProp: n,
|
|
219
|
+
palette: a,
|
|
220
|
+
bound: s,
|
|
221
|
+
animate: o && v(e) ? o(e, s) : null,
|
|
222
|
+
inline: l,
|
|
223
|
+
chars: r || void 0
|
|
224
|
+
}, e.key);
|
|
225
|
+
})
|
|
226
|
+
}, e.params[0].key);
|
|
227
|
+
return s ? /* @__PURE__ */ A(m, {
|
|
228
|
+
title: e.section,
|
|
229
|
+
children: c
|
|
230
|
+
}, e.params[0].key) : c;
|
|
231
|
+
}) });
|
|
232
|
+
}
|
|
233
|
+
function U(e) {
|
|
234
|
+
let t = e.step && e.step < 1 ? String(e.step).split(".")[1]?.length ?? 2 : 0;
|
|
235
|
+
return Math.max(2, String(Math.round(e.max ?? 0)).length, String(Math.round(e.min ?? 0)).length) + (t ? t + 1 : 0);
|
|
236
|
+
}
|
|
237
|
+
function W({ param: n, layer: r, setProp: a, chars: o }) {
|
|
238
|
+
let s = u(), l = r[n.key], f = i(l), p = f && l.bind === "mod" && l.source === "expr", m = e(f), h = f ? x(l, m, r) : l, g = typeof h == "number" ? h : n.default ?? 0, _ = n.step && n.step < 1 ? String(n.step).split(".")[1]?.length ?? 2 : 0, v = p ? l.transform?.expr ?? "wave(t)" : n.format ? String(n.format(g)) : _ ? g.toFixed(_) : String(Math.round(g)), y = o ?? U(n), [b, 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: [!f && /* @__PURE__ */ A(d, {
|
|
244
|
+
min: n.min,
|
|
245
|
+
max: n.max,
|
|
246
|
+
step: n.step ?? 1,
|
|
247
|
+
value: g,
|
|
248
|
+
onChange: (e) => a(n.key, Number(e)),
|
|
249
|
+
readout: "none",
|
|
250
|
+
className: "flex-1"
|
|
251
|
+
}), /* @__PURE__ */ A(c, {
|
|
252
|
+
type: "text",
|
|
253
|
+
variant: "filled",
|
|
254
|
+
size: s,
|
|
255
|
+
width: `calc(${y}ch + 24px)`,
|
|
256
|
+
value: b,
|
|
257
|
+
title: "Number sets a constant · an expression like sin(t) binds it",
|
|
258
|
+
onFocus: (e) => {
|
|
259
|
+
w(!0), e.target.select();
|
|
260
|
+
},
|
|
261
|
+
onChange: (e) => S(e.target.value),
|
|
262
|
+
onBlur: () => {
|
|
263
|
+
w(!1);
|
|
264
|
+
let e = b.trim();
|
|
265
|
+
if (e === "") {
|
|
266
|
+
S(v);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
let r = Number(e);
|
|
270
|
+
if (Number.isFinite(r)) {
|
|
271
|
+
a(n.key, r);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (!t(e).ok) {
|
|
275
|
+
S(v);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
let i = f && l.transform?.range || (n.min != null && n.max != null ? [n.min, n.max] : [0, 1]);
|
|
279
|
+
a(n.key, {
|
|
280
|
+
bind: "mod",
|
|
281
|
+
source: "expr",
|
|
282
|
+
transform: {
|
|
283
|
+
...f ? l.transform : {},
|
|
284
|
+
expr: e,
|
|
285
|
+
range: i
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
},
|
|
289
|
+
onKeyDown: (e) => {
|
|
290
|
+
e.key === "Enter" && e.currentTarget.blur(), e.key === "Escape" && (S(v), w(!1), e.currentTarget.blur());
|
|
291
|
+
},
|
|
292
|
+
inputClassName: "text-center"
|
|
293
|
+
})]
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
var G = a, K = {
|
|
297
|
+
xs: "h-[var(--kol-ctl-xs)]",
|
|
298
|
+
sm: "h-[var(--kol-ctl-sm)]",
|
|
299
|
+
md: "h-[var(--kol-ctl-md)]",
|
|
300
|
+
lg: "h-[var(--kol-ctl-lg)]"
|
|
301
|
+
};
|
|
302
|
+
function q({ param: e, layer: t, setProp: r, palette: i, bound: a, animate: s, inline: c, chars: d }) {
|
|
303
|
+
let f = u(), m = t[e.key], h = m === void 0 ? e.default : m;
|
|
304
|
+
if (e.type === "color") return /* @__PURE__ */ j("div", {
|
|
305
|
+
className: "flex items-end gap-2",
|
|
306
|
+
children: [/* @__PURE__ */ A("div", {
|
|
307
|
+
className: "flex-1 min-w-0",
|
|
308
|
+
children: /* @__PURE__ */ A(p, {
|
|
309
|
+
label: e.label,
|
|
310
|
+
value: h,
|
|
311
|
+
onChange: (t) => r(e.key, t),
|
|
312
|
+
palette: i,
|
|
313
|
+
inline: c
|
|
314
|
+
})
|
|
315
|
+
}), s]
|
|
316
|
+
});
|
|
317
|
+
let v = c, y = null;
|
|
318
|
+
if (e.type === "range") f !== "sm" && (v = !1), y = /* @__PURE__ */ A(W, {
|
|
319
|
+
param: e,
|
|
320
|
+
layer: t,
|
|
321
|
+
setProp: r,
|
|
322
|
+
chars: d
|
|
323
|
+
});
|
|
324
|
+
else if (e.type === "select") y = /* @__PURE__ */ A(S, {
|
|
325
|
+
variant: "subtle",
|
|
326
|
+
size: f,
|
|
327
|
+
className: "w-full",
|
|
328
|
+
options: e.options ?? [],
|
|
329
|
+
value: h,
|
|
330
|
+
onChange: (t) => r(e.key, e.numeric ? Number(t) : t)
|
|
331
|
+
});
|
|
332
|
+
else if (e.type === "segmented") y = c ? /* @__PURE__ */ A(l, {
|
|
333
|
+
layout: "joined",
|
|
334
|
+
tone: "sunken",
|
|
335
|
+
size: f,
|
|
336
|
+
className: `w-full ${o(f) ?? ""}`,
|
|
337
|
+
options: e.options ?? [],
|
|
338
|
+
value: h,
|
|
339
|
+
onChange: (t) => r(e.key, t)
|
|
340
|
+
}) : /* @__PURE__ */ A(C, {
|
|
341
|
+
size: f,
|
|
342
|
+
options: e.options ?? [],
|
|
343
|
+
viewMode: h,
|
|
344
|
+
onViewChange: (t) => r(e.key, t)
|
|
345
|
+
});
|
|
346
|
+
else if (e.type === "toggle") {
|
|
347
|
+
let [t, n] = e.labels ?? ["Off", "On"];
|
|
348
|
+
e.labels ? c ? y = /* @__PURE__ */ A(l, {
|
|
349
|
+
layout: "joined",
|
|
350
|
+
tone: "sunken",
|
|
351
|
+
size: f,
|
|
352
|
+
className: `w-full ${o(f) ?? ""}`,
|
|
353
|
+
options: [{
|
|
354
|
+
value: "off",
|
|
355
|
+
label: t
|
|
356
|
+
}, {
|
|
357
|
+
value: "on",
|
|
358
|
+
label: n
|
|
359
|
+
}],
|
|
360
|
+
value: h ? "on" : "off",
|
|
361
|
+
onChange: (t) => r(e.key, t === "on")
|
|
362
|
+
}) : (v = !1, y = /* @__PURE__ */ A(C, {
|
|
363
|
+
size: f,
|
|
364
|
+
options: [{
|
|
365
|
+
value: "off",
|
|
366
|
+
label: t
|
|
367
|
+
}, {
|
|
368
|
+
value: "on",
|
|
369
|
+
label: n
|
|
370
|
+
}],
|
|
371
|
+
viewMode: h ? "on" : "off",
|
|
372
|
+
onViewChange: (t) => r(e.key, t === "on")
|
|
373
|
+
})) : (c || (v = !1), y = /* @__PURE__ */ A(b, {
|
|
374
|
+
size: f,
|
|
375
|
+
checked: !!h,
|
|
376
|
+
onChange: (t) => r(e.key, t)
|
|
377
|
+
}));
|
|
378
|
+
} else if (e.type === "text") v = !1, y = /* @__PURE__ */ A(n, {
|
|
379
|
+
variant: "filled",
|
|
380
|
+
size: f,
|
|
381
|
+
rows: e.rows ?? 2,
|
|
382
|
+
axis: "y",
|
|
383
|
+
value: h ?? "",
|
|
384
|
+
onChange: (t) => r(e.key, t.target.value),
|
|
385
|
+
placeholder: e.placeholder
|
|
386
|
+
});
|
|
387
|
+
else return null;
|
|
388
|
+
let x = e.type === "range" && e.format && typeof h == "number" && !a ? e.format(h) : void 0, w = s ? /* @__PURE__ */ j("div", {
|
|
389
|
+
className: "flex items-center gap-2",
|
|
390
|
+
children: [/* @__PURE__ */ A("div", {
|
|
391
|
+
className: "flex-1 min-w-0",
|
|
392
|
+
children: y
|
|
393
|
+
}), s]
|
|
394
|
+
}) : y, T = e.type === "toggle" && !e.labels ? "end" : "fill", E = e.type === "toggle" && !e.labels && !c, D = (e) => String(e).toUpperCase();
|
|
395
|
+
return v && T === "end" && !x ? /* @__PURE__ */ A(g, {
|
|
396
|
+
horizontal: !0,
|
|
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
|
+
})
|
|
403
|
+
}) : v ? /* @__PURE__ */ A(_, {
|
|
404
|
+
label: e.label,
|
|
405
|
+
hint: x,
|
|
406
|
+
align: T,
|
|
407
|
+
labelWidth: G,
|
|
408
|
+
children: w
|
|
409
|
+
}) : /* @__PURE__ */ A(g, {
|
|
410
|
+
horizontal: E,
|
|
411
|
+
label: c ? D(e.label) : e.label,
|
|
412
|
+
hint: x,
|
|
413
|
+
labelWidth: E ? "auto" : G,
|
|
414
|
+
children: w
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/editor/compose/useLayerEdit.js
|
|
419
|
+
function J(e, { history: t = "discrete", coalesceMs: n = 250 } = {}) {
|
|
420
|
+
let { updateLayer: r, beginTransaction: i, commitTransaction: a } = s(), o = D(null), c = w(() => {
|
|
421
|
+
o.current !== null && (clearTimeout(o.current), o.current = null, a());
|
|
422
|
+
}, [a]), l = w((s) => {
|
|
423
|
+
if (e) {
|
|
424
|
+
if (t === "discrete") {
|
|
425
|
+
r(e, s);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if (t === "coalesce") {
|
|
429
|
+
o.current === null && i(), r(e, s), o.current !== null && clearTimeout(o.current), o.current = setTimeout(() => {
|
|
430
|
+
o.current = null, a();
|
|
431
|
+
}, n);
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
r(e, s);
|
|
435
|
+
}
|
|
436
|
+
}, [
|
|
437
|
+
e,
|
|
438
|
+
t,
|
|
439
|
+
n,
|
|
440
|
+
r,
|
|
441
|
+
i,
|
|
442
|
+
a
|
|
443
|
+
]), u = w((e, t) => l({ [e]: t }), [l]);
|
|
444
|
+
return T(() => () => c(), [c, e]), E(() => ({
|
|
445
|
+
patch: l,
|
|
446
|
+
setProp: u,
|
|
447
|
+
flush: c
|
|
448
|
+
}), [
|
|
449
|
+
l,
|
|
450
|
+
u,
|
|
451
|
+
c
|
|
452
|
+
]);
|
|
453
|
+
}
|
|
454
|
+
//#endregion
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/design-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The design editor as one component",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,23 +23,25 @@
|
|
|
23
23
|
"./motion": {
|
|
24
24
|
"import": "./dist/motion.js"
|
|
25
25
|
},
|
|
26
|
-
"./style.css": "./dist/design-editor.css"
|
|
26
|
+
"./style.css": "./dist/design-editor.css",
|
|
27
|
+
"./kolbox.css": "./dist/kolbox.css"
|
|
27
28
|
},
|
|
28
29
|
"files": [
|
|
29
30
|
"dist",
|
|
30
31
|
"README.md"
|
|
31
32
|
],
|
|
32
33
|
"peerDependencies": {
|
|
33
|
-
"@kolkrabbi/kol-component": ">=0.
|
|
34
|
+
"@kolkrabbi/kol-component": ">=0.380.0 <1",
|
|
34
35
|
"@kolkrabbi/kol-framework": ">=0.44.0 <1",
|
|
35
36
|
"@kolkrabbi/kol-hardware": ">=0.10.0 <1",
|
|
36
37
|
"@kolkrabbi/kol-icons": ">=0.69.0 <1",
|
|
37
38
|
"@kolkrabbi/kol-media-client": ">=0.4.0 <1",
|
|
38
|
-
"@kolkrabbi/kol-shell": ">=0.
|
|
39
|
+
"@kolkrabbi/kol-shell": ">=0.132.0 <1",
|
|
39
40
|
"react": "^19.0.0",
|
|
40
41
|
"react-dom": "^19.0.0",
|
|
41
|
-
"@kolkrabbi/kol-theme": ">=0.
|
|
42
|
-
"@kolkrabbi/kol-dashboards": ">=0.
|
|
42
|
+
"@kolkrabbi/kol-theme": ">=0.227.0 <1",
|
|
43
|
+
"@kolkrabbi/kol-dashboards": ">=0.18.0 <1",
|
|
44
|
+
"@kolkrabbi/kol-tuner": ">=0.1.0 <1"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
47
|
"colord": "^2.9.3",
|
|
@@ -54,9 +56,6 @@
|
|
|
54
56
|
"three": "^0.185.1"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
|
-
"@kolkrabbi/kol-component": ">=0.378.0 <1",
|
|
58
|
-
"@kolkrabbi/kol-shell": ">=0.131.0 <1",
|
|
59
|
-
"@kolkrabbi/kol-theme": ">=0.225.0 <1",
|
|
60
59
|
"@tailwindcss/vite": "^4.2.4",
|
|
61
60
|
"@vitejs/plugin-react": "^6.0.1",
|
|
62
61
|
"react": "^19.0.0",
|
|
@@ -64,9 +63,13 @@
|
|
|
64
63
|
"tailwindcss": "^4.2.4",
|
|
65
64
|
"vite": "^8.0.10",
|
|
66
65
|
"vite-plugin-svgr": "^5.2.0",
|
|
66
|
+
"@kolkrabbi/kol-component": "0.380.0",
|
|
67
67
|
"@kolkrabbi/kol-framework": "0.74.1",
|
|
68
|
-
"@kolkrabbi/kol-icons": "0.
|
|
69
|
-
"@kolkrabbi/kol-
|
|
68
|
+
"@kolkrabbi/kol-icons": "0.72.0",
|
|
69
|
+
"@kolkrabbi/kol-theme": "0.227.0",
|
|
70
|
+
"@kolkrabbi/kol-shell": "0.132.0",
|
|
71
|
+
"@kolkrabbi/kol-dashboards": "0.18.0",
|
|
72
|
+
"@kolkrabbi/kol-tuner": "0.1.0",
|
|
70
73
|
"@kolkrabbi/kol-hardware": "0.11.1",
|
|
71
74
|
"@kolkrabbi/kol-media-client": "0.7.0"
|
|
72
75
|
},
|
|
@@ -86,8 +89,8 @@
|
|
|
86
89
|
"access": "public"
|
|
87
90
|
},
|
|
88
91
|
"scripts": {
|
|
89
|
-
"build": "vite build --config vite.lib.config.js",
|
|
92
|
+
"build": "vite build --config vite.lib.config.js && vite build --config vite.kolbox.config.js",
|
|
90
93
|
"check:core": "node scripts/check-core.mjs",
|
|
91
|
-
"check:
|
|
94
|
+
"check:frames": "node scripts/check-frames.mjs"
|
|
92
95
|
}
|
|
93
96
|
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { F as e, L as t, dn as n, hn as r, pn as i } from "./rolls-KpWCAeDv.js";
|
|
2
|
-
import { embedFontFace as a } from "@kolkrabbi/kol-component";
|
|
3
|
-
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
4
|
-
//#region src/kinetic/fonts.js
|
|
5
|
-
var l = [
|
|
6
|
-
{
|
|
7
|
-
key: "rot",
|
|
8
|
-
label: "Rot",
|
|
9
|
-
family: "TG Rot",
|
|
10
|
-
url: "/fonts/tg/TGRotVF.ttf",
|
|
11
|
-
axes: [{
|
|
12
|
-
tag: "wdth",
|
|
13
|
-
min: 64,
|
|
14
|
-
max: 172,
|
|
15
|
-
def: 100
|
|
16
|
-
}, {
|
|
17
|
-
tag: "wght",
|
|
18
|
-
min: 100,
|
|
19
|
-
max: 900,
|
|
20
|
-
def: 400
|
|
21
|
-
}]
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
key: "malromur",
|
|
25
|
-
label: "Malromur",
|
|
26
|
-
family: "TG Malromur",
|
|
27
|
-
url: "/fonts/tg/TGMalromurRomanVF.ttf",
|
|
28
|
-
axes: [{
|
|
29
|
-
tag: "wght",
|
|
30
|
-
min: 300,
|
|
31
|
-
max: 900,
|
|
32
|
-
def: 300
|
|
33
|
-
}]
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
key: "gullhamrar",
|
|
37
|
-
label: "Gullhamrar",
|
|
38
|
-
family: "TG Gullhamrar",
|
|
39
|
-
url: "/fonts/tg/TGGullhamrarVF.ttf",
|
|
40
|
-
axes: [{
|
|
41
|
-
tag: "wght",
|
|
42
|
-
min: 300,
|
|
43
|
-
max: 900,
|
|
44
|
-
def: 300
|
|
45
|
-
}]
|
|
46
|
-
}
|
|
47
|
-
], u = l.map((e) => ({
|
|
48
|
-
value: e.key,
|
|
49
|
-
label: e.label
|
|
50
|
-
})), d = {
|
|
51
|
-
wght: "Weight",
|
|
52
|
-
wdth: "Width",
|
|
53
|
-
ital: "Italic",
|
|
54
|
-
slnt: "Slant",
|
|
55
|
-
opsz: "Optical size"
|
|
56
|
-
}, f = (e) => l.find((t) => t.key === e) || l[0];
|
|
57
|
-
function p(e) {
|
|
58
|
-
let t = {};
|
|
59
|
-
for (let n of e.axes) t[n.tag] = n.def;
|
|
60
|
-
return t;
|
|
61
|
-
}
|
|
62
|
-
function m(e) {
|
|
63
|
-
let t = Object.entries(e || {}).map(([e, t]) => `'${e}' ${Math.round(t * 100) / 100}`);
|
|
64
|
-
return t.length ? t.join(", ") : "normal";
|
|
65
|
-
}
|
|
66
|
-
var h = !1;
|
|
67
|
-
async function g() {
|
|
68
|
-
if (!(h || typeof FontFace > "u")) {
|
|
69
|
-
h = !0;
|
|
70
|
-
for (let e of l) {
|
|
71
|
-
let t = {}, n = e.axes.find((e) => e.tag === "wght"), r = e.axes.find((e) => e.tag === "wdth");
|
|
72
|
-
n && (t.weight = `${n.min} ${n.max}`), r && (t.stretch = `${r.min}% ${r.max}%`);
|
|
73
|
-
try {
|
|
74
|
-
let n = new FontFace(e.family, `url(${e.url})`, t);
|
|
75
|
-
document.fonts.add(n), n.load().catch(() => {});
|
|
76
|
-
} catch {}
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
await document.fonts.ready;
|
|
80
|
-
} catch {}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
var _ = /* @__PURE__ */ new Map(), v = null;
|
|
84
|
-
function y() {
|
|
85
|
-
return v || (v = Promise.all(l.map(async (e) => {
|
|
86
|
-
if (!_.has(e.url)) try {
|
|
87
|
-
_.set(e.url, await a({
|
|
88
|
-
family: e.family,
|
|
89
|
-
url: e.url
|
|
90
|
-
}));
|
|
91
|
-
} catch (t) {
|
|
92
|
-
console.warn(`[design-editor] font not embedded, export will fall back for ${e.family}:`, t);
|
|
93
|
-
}
|
|
94
|
-
})), v);
|
|
95
|
-
}
|
|
96
|
-
function b(e) {
|
|
97
|
-
let t = /* @__PURE__ */ new Set();
|
|
98
|
-
for (let n of e?.instances ?? []) t.add(f(n.font).url);
|
|
99
|
-
return [...t].map((e) => _.get(e)).filter(Boolean).join("\n");
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region src/editor/compose/inspectors/TreePicker.jsx
|
|
103
|
-
function x(e) {
|
|
104
|
-
return /* @__PURE__ */ s(n, {
|
|
105
|
-
variant: "subtle",
|
|
106
|
-
size: t(),
|
|
107
|
-
className: "w-full",
|
|
108
|
-
...e
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function S({ label: t, options: n, value: a, onChange: o, children: c, inline: l = !0 }) {
|
|
112
|
-
let u = c ?? /* @__PURE__ */ s(x, {
|
|
113
|
-
options: n,
|
|
114
|
-
value: a,
|
|
115
|
-
onChange: o
|
|
116
|
-
});
|
|
117
|
-
return l ? /* @__PURE__ */ s(r, {
|
|
118
|
-
label: t,
|
|
119
|
-
align: "fill",
|
|
120
|
-
labelWidth: e,
|
|
121
|
-
children: u
|
|
122
|
-
}) : /* @__PURE__ */ s(i, {
|
|
123
|
-
label: t,
|
|
124
|
-
children: u
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
function C({ tree: e, presets: t, current: n, onPick: r, inline: i = !0, subLabel: a = (e) => e }) {
|
|
128
|
-
let l = e.find((e) => e.label === n.typeLabel) ?? 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);
|
|
129
|
-
return /* @__PURE__ */ c(o, { children: [
|
|
130
|
-
/* @__PURE__ */ s(S, {
|
|
131
|
-
inline: i,
|
|
132
|
-
label: "Type",
|
|
133
|
-
options: e.map((e) => ({
|
|
134
|
-
value: e.label,
|
|
135
|
-
label: e.label
|
|
136
|
-
})),
|
|
137
|
-
value: l.label,
|
|
138
|
-
onChange: (t) => {
|
|
139
|
-
let n = e.find((e) => e.label === t);
|
|
140
|
-
n && r(d(n.subs[0]));
|
|
141
|
-
}
|
|
142
|
-
}),
|
|
143
|
-
/* @__PURE__ */ s(S, {
|
|
144
|
-
inline: i,
|
|
145
|
-
label: "Category",
|
|
146
|
-
options: l.subs.map((e) => ({
|
|
147
|
-
value: e,
|
|
148
|
-
label: a(e)
|
|
149
|
-
})),
|
|
150
|
-
value: n.sub,
|
|
151
|
-
onChange: (e) => r(d(e))
|
|
152
|
-
}),
|
|
153
|
-
/* @__PURE__ */ s(S, {
|
|
154
|
-
inline: i,
|
|
155
|
-
label: "Preset",
|
|
156
|
-
options: u.map((e) => ({
|
|
157
|
-
value: e.id,
|
|
158
|
-
label: e.label
|
|
159
|
-
})),
|
|
160
|
-
value: n.id,
|
|
161
|
-
onChange: (e) => r(t.find((t) => t.id === e))
|
|
162
|
-
})
|
|
163
|
-
] });
|
|
164
|
-
}
|
|
165
|
-
//#endregion
|
|
166
|
-
export { l as a, f as c, m as d, y as f, d as i, b as l, S as n, u as o, C as r, p as s, x as t, g as u };
|