@kolkrabbi/design-editor 0.27.0 → 0.27.1
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-CMUtpJPX.js → BindDot-CaZu6Uuz.js} +5 -5
- package/dist/{ColorModesWindow-CWhL6nfm.js → ColorModesWindow-D65R5YR5.js} +289 -359
- package/dist/Timeline-OZsY9CvR.js +910 -0
- package/dist/TreePicker-BQYPaQv3.js +166 -0
- package/dist/{core-EWu8GfXL.js → core-DP3uwW4A.js} +3263 -3861
- package/dist/core.js +5 -5
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +1219 -795
- package/dist/{useLayerEdit-BFcZhiNX.js → effectCategories-DJrQJ7vg.js} +3683 -3931
- package/dist/{effects-DZEmfY7a.js → effects-dbxBWOCp.js} +115 -114
- package/dist/effects.js +1 -1
- package/dist/{generators-D1tFSZgG.js → generators-CQQxNX9W.js} +721 -482
- package/dist/generators.js +1 -1
- package/dist/{host-ZLJKCZ54.js → host-DBTmkJuu.js} +1 -1
- package/dist/{host-CRsCCafL.js → host-DXizGh-A.js} +36 -36
- package/dist/morphStore-DaOLa9oj.js +145 -0
- package/dist/motion-yfgCBe5u.js +4261 -0
- package/dist/motion.js +1 -1
- package/dist/{previewScale-BMkeLc6w.js → previewScale-DsG-A1ZC.js} +1 -1
- package/dist/{rolls-BGtqxVYq.js → rolls-CGma4Bua.js} +1809 -2107
- package/dist/{src-BpTckTDZ.js → src-CMdJeS6j.js} +1 -1
- package/dist/useLayerEdit-CnPxtfWc.js +453 -0
- package/package.json +7 -7
- package/dist/Timeline-BObvcdXF.js +0 -3014
- package/dist/TreePicker-nMf17QGH.js +0 -68
- package/dist/motion-C_u7tsis.js +0 -2295
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
import { D as e, J as t, M as n, N as r, gn as i, nn as a, tn as o } from "./rolls-CGma4Bua.js";
|
|
2
|
+
import { m as s, s as c, u as l } from "./morphStore-DaOLa9oj.js";
|
|
3
|
+
import { Button as u, Dropdown as d, Input as f, Tooltip as p, floatSurfaceClass as m, useGrabEdge as h } from "@kolkrabbi/kol-component";
|
|
4
|
+
import { Fragment as g, useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
|
|
5
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
6
|
+
import { Icon as w } from "@kolkrabbi/kol-icons";
|
|
7
|
+
//#region src/editor/compose/labels.js
|
|
8
|
+
var T = {
|
|
9
|
+
background: "Background",
|
|
10
|
+
pattern: "Pattern",
|
|
11
|
+
photo: "Photo",
|
|
12
|
+
shape: "Shape",
|
|
13
|
+
text: "Text",
|
|
14
|
+
group: "Group",
|
|
15
|
+
bool: "Boolean",
|
|
16
|
+
path: "Path",
|
|
17
|
+
loop: "Loop",
|
|
18
|
+
kinetic: "Kinetic type",
|
|
19
|
+
misc: "Misc"
|
|
20
|
+
}, E = {
|
|
21
|
+
unite: "Unite",
|
|
22
|
+
subtract: "Subtract",
|
|
23
|
+
intersect: "Intersect",
|
|
24
|
+
exclude: "Exclude"
|
|
25
|
+
}, D = {
|
|
26
|
+
logo: "Logo",
|
|
27
|
+
rect: "Rectangle",
|
|
28
|
+
ellipse: "Ellipse",
|
|
29
|
+
triangle: "Triangle",
|
|
30
|
+
line: "Line",
|
|
31
|
+
polygon: "Polygon",
|
|
32
|
+
star: "Star",
|
|
33
|
+
flatten: "Flatten"
|
|
34
|
+
};
|
|
35
|
+
function O(e) {
|
|
36
|
+
return e.isMask ? `${O({
|
|
37
|
+
...e,
|
|
38
|
+
isMask: !1
|
|
39
|
+
})} (mask)` : e.name ? e.name : e.type === "text" ? e.text || T.text : e.type === "shape" ? D[e.kind ?? "logo"] ?? T.shape : e.type === "bool" ? E[e.op] ?? T.bool : e.type === "loop" || e.type === "misc" ? e.presetLabel || T[e.type] : e.type === "kinetic" ? e.presetLabel || T.kinetic : T[e.type] ?? e.type;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/editor/params/timelinePinned.js
|
|
43
|
+
var k = "kol-editor-timeline-pinned", A = !1;
|
|
44
|
+
try {
|
|
45
|
+
A = localStorage.getItem(k) === "1";
|
|
46
|
+
} catch {}
|
|
47
|
+
var j = /* @__PURE__ */ new Set();
|
|
48
|
+
function M() {
|
|
49
|
+
A = !A;
|
|
50
|
+
try {
|
|
51
|
+
localStorage.setItem(k, A ? "1" : "0");
|
|
52
|
+
} catch {}
|
|
53
|
+
j.forEach((e) => e(A));
|
|
54
|
+
}
|
|
55
|
+
function N() {
|
|
56
|
+
let [e, t] = b(A);
|
|
57
|
+
return _(() => {
|
|
58
|
+
let e = (e) => t(e);
|
|
59
|
+
return j.add(e), () => j.delete(e);
|
|
60
|
+
}, []), e;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/editor/params/Timeline.jsx
|
|
64
|
+
var P = 268, F = 14, I = 25, L = [
|
|
65
|
+
1,
|
|
66
|
+
2,
|
|
67
|
+
4
|
|
68
|
+
], R = 96;
|
|
69
|
+
function ee(e, t) {
|
|
70
|
+
if (e.length === 0) return 0;
|
|
71
|
+
if (t <= e[0].t) return e[0].v;
|
|
72
|
+
let n = e[e.length - 1];
|
|
73
|
+
if (t >= n.t) return n.v;
|
|
74
|
+
let r = 0;
|
|
75
|
+
for (; r < e.length - 1 && e[r + 1].t <= t;) r++;
|
|
76
|
+
let i = e[r], a = e[r + 1];
|
|
77
|
+
if (typeof i.v != "number" || typeof a.v != "number") return i.v;
|
|
78
|
+
let o = a.t - i.t || 1;
|
|
79
|
+
return i.v + (a.v - i.v) * ((t - i.t) / o);
|
|
80
|
+
}
|
|
81
|
+
function z(t, n = []) {
|
|
82
|
+
for (let r of t) {
|
|
83
|
+
let t = Array.isArray(r.morph?.steps) ? r.morph.steps : null;
|
|
84
|
+
if (t?.length) {
|
|
85
|
+
let i = r.morph.name || "Morph", a = (e) => e.map((e) => t[(Math.round(e.v) % t.length + t.length) % t.length]?.label ?? ""), o = e(r.morphT) && r.morphT.bind === "track" ? r.morphT : null, c = o ? o.keys : s(t.map((e, t) => t), r.morph.cycle ?? "loop", r.morph.curve ?? "in-out");
|
|
86
|
+
n.push({
|
|
87
|
+
id: `${r.id}:morph`,
|
|
88
|
+
layerId: r.id,
|
|
89
|
+
key: "morphT",
|
|
90
|
+
label: i,
|
|
91
|
+
keys: c,
|
|
92
|
+
header: !0,
|
|
93
|
+
readOnly: !o,
|
|
94
|
+
names: a(c),
|
|
95
|
+
steps: t.length
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
for (let i in r) {
|
|
99
|
+
if (i === "morphT" && t?.length) continue;
|
|
100
|
+
let a = r[i];
|
|
101
|
+
e(a) && a.bind === "track" && n.push({
|
|
102
|
+
id: `${r.id}:${i}`,
|
|
103
|
+
layerId: r.id,
|
|
104
|
+
key: i,
|
|
105
|
+
label: `${O(r)} · ${i}`,
|
|
106
|
+
keys: a.keys,
|
|
107
|
+
under: t?.length ? `${r.id}:morph` : null
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
Array.isArray(r.children) && z(r.children, n);
|
|
111
|
+
}
|
|
112
|
+
return n;
|
|
113
|
+
}
|
|
114
|
+
function te(e, t = []) {
|
|
115
|
+
for (let n of e) t.push(n), Array.isArray(n.children) && te(n.children, t);
|
|
116
|
+
return t;
|
|
117
|
+
}
|
|
118
|
+
var ne = (t) => Object.values(t).some((t) => e(t) && t.bind === "mod" && String(t.source).startsWith("audio")), B = {
|
|
119
|
+
background: "square",
|
|
120
|
+
pattern: "ptrn-dot",
|
|
121
|
+
photo: "image",
|
|
122
|
+
shape: "rectangle",
|
|
123
|
+
text: "type",
|
|
124
|
+
group: "layers",
|
|
125
|
+
bool: "layers",
|
|
126
|
+
loop: "refresh",
|
|
127
|
+
misc: "refresh",
|
|
128
|
+
kinetic: "type"
|
|
129
|
+
}, V = (e) => B[e] ?? "rectangle", H = (e, t) => `${(e * t).toFixed(2)}`, re = (e) => `${String(Math.floor(e)).padStart(2, "0")}:${String(Math.floor(e % 1 * 100)).padStart(2, "0")}`;
|
|
130
|
+
function U({ name: e, label: t, on: n = !0, toggle: r = !1, size: i = 14, onClick: a, disabled: o, className: s = "" }) {
|
|
131
|
+
return /* @__PURE__ */ S(p, {
|
|
132
|
+
label: t,
|
|
133
|
+
variant: "float",
|
|
134
|
+
asChild: !0,
|
|
135
|
+
children: /* @__PURE__ */ S("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
"aria-label": t,
|
|
138
|
+
"aria-pressed": r ? n : void 0,
|
|
139
|
+
disabled: o,
|
|
140
|
+
onClick: a,
|
|
141
|
+
className: `flex items-center justify-center shrink-0 rounded cursor-pointer outline-none focus-visible:shadow-[var(--kol-float-focus)] disabled:opacity-40 disabled:cursor-default ${n ? "text-oq-96" : "text-oq-48"} ${s}`.trim(),
|
|
142
|
+
children: /* @__PURE__ */ S(w, {
|
|
143
|
+
name: e,
|
|
144
|
+
size: i
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function ie({ track: e, view: t, selected: n, setSelected: r, writeKeys: i, lit: a }) {
|
|
150
|
+
let o = y(null), s = y(null), [, l] = b(0), u = !!e.header, d = !!e.readOnly, { X: f, fracFromEvent: m } = t, h = (t) => n && n.trackId === e.id && n.index === t, g = (t) => {
|
|
151
|
+
if (t.target.closest("[data-diamond]") || t.target.closest("[data-name]") || d) return;
|
|
152
|
+
let n = m(t, o.current), a = ee(e.keys, n), s = [...e.keys, {
|
|
153
|
+
t: n,
|
|
154
|
+
v: a,
|
|
155
|
+
easing: "linear"
|
|
156
|
+
}].sort((e, t) => e.t - t.t);
|
|
157
|
+
i(e, s), r({
|
|
158
|
+
trackId: e.id,
|
|
159
|
+
index: s.findIndex((e) => e.t === n)
|
|
160
|
+
});
|
|
161
|
+
}, _ = (t) => (n) => {
|
|
162
|
+
if (n.stopPropagation(), !d) {
|
|
163
|
+
if (n.altKey) {
|
|
164
|
+
e.keys.length > 1 && (i(e, e.keys.filter((e, n) => n !== t)), r(null));
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
n.currentTarget.setPointerCapture(n.pointerId), s.current = {
|
|
168
|
+
index: t,
|
|
169
|
+
t: e.keys[t].t
|
|
170
|
+
}, r({
|
|
171
|
+
trackId: e.id,
|
|
172
|
+
index: t
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}, v = (e) => (t) => {
|
|
176
|
+
!s.current || s.current.index !== e || (s.current.t = m(t, o.current), l((e) => e + 1));
|
|
177
|
+
}, x = (t) => () => {
|
|
178
|
+
if (!s.current || s.current.index !== t) return;
|
|
179
|
+
let n = {
|
|
180
|
+
...e.keys[t],
|
|
181
|
+
t: s.current.t
|
|
182
|
+
};
|
|
183
|
+
if (s.current = null, n.t === e.keys[t].t) return;
|
|
184
|
+
let a = e.keys.map((e, r) => r === t ? n : e).sort((e, t) => e.t - t.t);
|
|
185
|
+
i(e, a), r({
|
|
186
|
+
trackId: e.id,
|
|
187
|
+
index: a.indexOf(n)
|
|
188
|
+
});
|
|
189
|
+
}, T = (t) => (n) => {
|
|
190
|
+
n.stopPropagation(), c({ editRequest: (Math.round(e.keys[t].v) % e.steps + e.steps) % e.steps });
|
|
191
|
+
};
|
|
192
|
+
return /* @__PURE__ */ C("div", {
|
|
193
|
+
ref: o,
|
|
194
|
+
className: `relative flex-1 min-w-0 overflow-hidden rounded-[5px] bg-[var(--kol-float-well)] ${d ? "" : "cursor-copy"}`,
|
|
195
|
+
style: { height: I },
|
|
196
|
+
onPointerDown: g,
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ S(W, {
|
|
199
|
+
view: t,
|
|
200
|
+
lit: a,
|
|
201
|
+
label: e.label
|
|
202
|
+
}),
|
|
203
|
+
e.keys.map((n, r) => {
|
|
204
|
+
let i = s.current?.index === r ? s.current.t : n.t, a = u ? e.names?.[r] : null;
|
|
205
|
+
return /* @__PURE__ */ S(p, {
|
|
206
|
+
label: u ? `${a} · ${H(i, t.loop)} s` : `${H(i, t.loop)} s · v=${typeof n.v == "number" ? Math.round(n.v * 100) / 100 : n.v} (alt-click deletes)`,
|
|
207
|
+
variant: "float",
|
|
208
|
+
asChild: !0,
|
|
209
|
+
children: /* @__PURE__ */ S("span", {
|
|
210
|
+
"data-diamond": "",
|
|
211
|
+
onPointerDown: _(r),
|
|
212
|
+
onPointerMove: v(r),
|
|
213
|
+
onPointerUp: x(r),
|
|
214
|
+
className: `absolute top-1/2 -translate-x-1/2 -translate-y-1/2 flex ${d ? "" : "cursor-grab"} ${h(r) ? "text-[var(--kol-accent-primary)]" : "text-oq-96"}`,
|
|
215
|
+
style: { left: `clamp(6px, ${f(i) * 100}%, 100% - 6px)` },
|
|
216
|
+
children: /* @__PURE__ */ S(w, {
|
|
217
|
+
name: "diamond",
|
|
218
|
+
size: 12
|
|
219
|
+
})
|
|
220
|
+
})
|
|
221
|
+
}, r);
|
|
222
|
+
}),
|
|
223
|
+
u && e.keys.map((t, n) => {
|
|
224
|
+
let r = s.current?.index === n ? s.current.t : t.t, i = n === e.keys.length - 1 && r > .5;
|
|
225
|
+
return /* @__PURE__ */ S("button", {
|
|
226
|
+
type: "button",
|
|
227
|
+
"data-name": "",
|
|
228
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
229
|
+
onClick: T(n),
|
|
230
|
+
"aria-label": `Edit step ${e.names?.[n]}`,
|
|
231
|
+
className: "absolute top-0 bottom-0 kol-float-label text-fg-64 hover:text-emphasis truncate cursor-pointer",
|
|
232
|
+
style: {
|
|
233
|
+
left: i ? void 0 : `calc(${f(r) * 100}% + 10px)`,
|
|
234
|
+
right: i ? `calc(${(1 - f(r)) * 100}% + 10px)` : void 0,
|
|
235
|
+
maxWidth: `${100 / e.keys.length}%`
|
|
236
|
+
},
|
|
237
|
+
children: e.names?.[n]
|
|
238
|
+
}, `n${n}`);
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function W({ view: e, lit: t, label: n, mono: r = !1, children: i }) {
|
|
244
|
+
let a = e.X(0), o = e.X(1);
|
|
245
|
+
return /* @__PURE__ */ C("div", {
|
|
246
|
+
className: `absolute top-0.5 h-[21px] rounded ${t ? "bg-fg-16" : "bg-fg-08"}`,
|
|
247
|
+
style: {
|
|
248
|
+
left: `${a * 100}%`,
|
|
249
|
+
width: `${(o - a) * 100}%`
|
|
250
|
+
},
|
|
251
|
+
children: [/* @__PURE__ */ S("span", {
|
|
252
|
+
className: `absolute left-2.5 top-1/2 -translate-y-1/2 ${r ? "kol-float-ruler" : "kol-float-label"} text-fg-64 whitespace-nowrap pointer-events-none`,
|
|
253
|
+
children: n
|
|
254
|
+
}), i]
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function ae({ view: e, lit: t, label: n }) {
|
|
258
|
+
return /* @__PURE__ */ S("div", {
|
|
259
|
+
className: "relative flex-1 min-w-0 overflow-hidden rounded-[5px] bg-[var(--kol-float-well)]",
|
|
260
|
+
style: { height: I },
|
|
261
|
+
children: /* @__PURE__ */ S(W, {
|
|
262
|
+
view: e,
|
|
263
|
+
lit: t,
|
|
264
|
+
label: n ?? `${e.loop.toFixed(2)} s`,
|
|
265
|
+
mono: n == null
|
|
266
|
+
})
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
function G({ view: e, lit: t, label: n, wave: r }) {
|
|
270
|
+
return /* @__PURE__ */ S("div", {
|
|
271
|
+
className: "relative flex-1 min-w-0 overflow-hidden rounded-[5px] bg-[var(--kol-float-well)]",
|
|
272
|
+
style: { height: I },
|
|
273
|
+
children: /* @__PURE__ */ S(W, {
|
|
274
|
+
view: e,
|
|
275
|
+
lit: t,
|
|
276
|
+
label: n,
|
|
277
|
+
children: /* @__PURE__ */ S("span", {
|
|
278
|
+
className: "absolute top-0 bottom-0 left-[120px] right-2.5",
|
|
279
|
+
"aria-hidden": "true",
|
|
280
|
+
children: r.map((e, t) => /* @__PURE__ */ S("span", {
|
|
281
|
+
className: "absolute top-1/2 -translate-y-1/2 w-0.5 bg-oq-40",
|
|
282
|
+
style: {
|
|
283
|
+
left: `${t / R * 100}%`,
|
|
284
|
+
height: 2 + Math.round(e * 10)
|
|
285
|
+
}
|
|
286
|
+
}, t))
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function K({ layer: e, name: t, sub: n, lit: r, select: i, toggleLayer: a, toggleLayerLock: o, fold: s }) {
|
|
292
|
+
return /* @__PURE__ */ C("div", {
|
|
293
|
+
className: `flex items-center gap-2.5 shrink-0 px-2 rounded-md ${r ? "bg-fg-16" : ""} ${e ? "cursor-pointer" : ""}`,
|
|
294
|
+
style: {
|
|
295
|
+
width: P,
|
|
296
|
+
height: I,
|
|
297
|
+
paddingLeft: n ? 32 : void 0
|
|
298
|
+
},
|
|
299
|
+
onClick: e ? () => i(e.id) : void 0,
|
|
300
|
+
children: [
|
|
301
|
+
!n && /* @__PURE__ */ S("span", {
|
|
302
|
+
className: "flex shrink-0 text-oq-64",
|
|
303
|
+
"aria-hidden": "true",
|
|
304
|
+
children: /* @__PURE__ */ S(w, {
|
|
305
|
+
name: e ? e.icon ?? V(e.type) : "layers",
|
|
306
|
+
size: 14
|
|
307
|
+
})
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ S("span", {
|
|
310
|
+
className: `kol-float-label truncate flex-1 min-w-0 ${n ? "text-fg-64" : "text-emphasis"}`,
|
|
311
|
+
children: t
|
|
312
|
+
}),
|
|
313
|
+
s && /* @__PURE__ */ S(U, {
|
|
314
|
+
name: "chevron-down",
|
|
315
|
+
size: 12,
|
|
316
|
+
label: s.folded ? "Show the morph’s tracks" : "Hide the morph’s tracks",
|
|
317
|
+
onClick: (e) => {
|
|
318
|
+
e.stopPropagation(), s.toggle();
|
|
319
|
+
},
|
|
320
|
+
className: s.folded ? "-rotate-90" : ""
|
|
321
|
+
}),
|
|
322
|
+
e && !n && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(U, {
|
|
323
|
+
name: e.visible === !1 ? "eye-off" : "eye-on",
|
|
324
|
+
size: 12,
|
|
325
|
+
label: e.visible === !1 ? "Show layer" : "Hide layer",
|
|
326
|
+
toggle: !0,
|
|
327
|
+
on: e.visible !== !1,
|
|
328
|
+
onClick: (t) => {
|
|
329
|
+
t.stopPropagation(), a(e.id);
|
|
330
|
+
}
|
|
331
|
+
}), /* @__PURE__ */ S(U, {
|
|
332
|
+
name: e.locked ? "lock" : "unlock",
|
|
333
|
+
size: 12,
|
|
334
|
+
label: e.locked ? "Unlock layer" : "Lock layer",
|
|
335
|
+
toggle: !0,
|
|
336
|
+
on: !!e.locked,
|
|
337
|
+
onClick: (t) => {
|
|
338
|
+
t.stopPropagation(), o(e.id);
|
|
339
|
+
}
|
|
340
|
+
})] })
|
|
341
|
+
]
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function oe({ view: e, seek: t }) {
|
|
345
|
+
let n = y(null), r = y(!1), i = Math.ceil(e.origin - 1e-9), a = Math.floor(e.origin + e.span + 1e-9), o = Array.from({ length: Math.max(0, a - i + 1) }, (e, t) => i + t), s = (r) => t(e.fracFromEvent(r, n.current));
|
|
346
|
+
return /* @__PURE__ */ C("div", {
|
|
347
|
+
className: "flex items-center shrink-0",
|
|
348
|
+
style: {
|
|
349
|
+
height: 15,
|
|
350
|
+
gap: F
|
|
351
|
+
},
|
|
352
|
+
children: [/* @__PURE__ */ S("span", {
|
|
353
|
+
className: "kol-float-label leading-none text-meta shrink-0",
|
|
354
|
+
style: { width: P },
|
|
355
|
+
children: "LAYERS"
|
|
356
|
+
}), /* @__PURE__ */ S("div", {
|
|
357
|
+
ref: n,
|
|
358
|
+
className: "relative flex-1 min-w-0 h-full kol-float-ruler text-meta cursor-ew-resize",
|
|
359
|
+
style: { touchAction: "none" },
|
|
360
|
+
onPointerDown: (e) => {
|
|
361
|
+
r.current = !0, e.currentTarget.setPointerCapture(e.pointerId), s(e);
|
|
362
|
+
},
|
|
363
|
+
onPointerMove: (e) => {
|
|
364
|
+
r.current && s(e);
|
|
365
|
+
},
|
|
366
|
+
onPointerUp: () => {
|
|
367
|
+
r.current = !1;
|
|
368
|
+
},
|
|
369
|
+
onPointerCancel: () => {
|
|
370
|
+
r.current = !1;
|
|
371
|
+
},
|
|
372
|
+
children: o.map((t) => {
|
|
373
|
+
let n = (t - e.origin) / e.span;
|
|
374
|
+
return /* @__PURE__ */ S("span", {
|
|
375
|
+
className: "absolute top-0 leading-[15px] whitespace-nowrap",
|
|
376
|
+
style: {
|
|
377
|
+
left: `${n * 100}%`,
|
|
378
|
+
transform: n <= 0 ? void 0 : n >= 1 ? "translateX(-100%)" : "translateX(-50%)"
|
|
379
|
+
},
|
|
380
|
+
children: e.span <= 16 || t % 4 == 0 ? `${String(t).padStart(2, "0")}s` : ""
|
|
381
|
+
}, t);
|
|
382
|
+
})
|
|
383
|
+
})]
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
function q({ view: e, now: t }) {
|
|
387
|
+
let n = e.X(t / e.loop);
|
|
388
|
+
return n < 0 || n > 1 ? null : /* @__PURE__ */ C("div", {
|
|
389
|
+
"aria-hidden": "true",
|
|
390
|
+
className: "absolute pointer-events-none",
|
|
391
|
+
style: {
|
|
392
|
+
left: `calc(282px + (100% - 282px) * ${n})`,
|
|
393
|
+
top: -1,
|
|
394
|
+
bottom: 0
|
|
395
|
+
},
|
|
396
|
+
children: [/* @__PURE__ */ S("span", { className: "absolute top-0 bottom-0 w-px bg-fg-96" }), /* @__PURE__ */ S("span", {
|
|
397
|
+
className: "absolute -top-3 -translate-x-1/2 flex items-center justify-center h-4 w-[43px] rounded kol-float-ruler leading-none bg-[var(--kol-surface-on-primary)] text-[var(--kol-surface-primary)]",
|
|
398
|
+
children: re(t)
|
|
399
|
+
})]
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
var J = (e) => Array.isArray(e) ? e : n[e] ?? null, Y = 132, X = 14;
|
|
403
|
+
function se({ track: e, writeKeys: t, selected: r, setSelected: i }) {
|
|
404
|
+
let a = y(null), [o, s] = b(0), [c, l] = b(null), u = y(null);
|
|
405
|
+
_(() => {
|
|
406
|
+
let e = a.current;
|
|
407
|
+
if (!e) return;
|
|
408
|
+
let t = new ResizeObserver(([e]) => s(e.contentRect.width));
|
|
409
|
+
return t.observe(e), () => t.disconnect();
|
|
410
|
+
}, []);
|
|
411
|
+
let d = c ?? e.keys, f = d.map((e) => e.v), p = Math.min(...f), m = Math.max(...f);
|
|
412
|
+
u.current?.range && ([p, m] = u.current.range), m - p < 1e-9 && (--p, m += 1);
|
|
413
|
+
let h = (e) => e * o, g = (e) => X + (1 - (e - p) / (m - p)) * (Y - 2 * X), v = (e) => {
|
|
414
|
+
let t = a.current.getBoundingClientRect();
|
|
415
|
+
return {
|
|
416
|
+
t: Math.min(1, Math.max(0, (e.clientX - t.left) / t.width)),
|
|
417
|
+
v: p + (1 - (e.clientY - t.top - X) / (Y - 2 * X)) * (m - p)
|
|
418
|
+
};
|
|
419
|
+
}, x = d.slice(0, -1).map((e, t) => ({
|
|
420
|
+
i: t,
|
|
421
|
+
a: e,
|
|
422
|
+
b: d[t + 1],
|
|
423
|
+
bez: e.easing === "hold" ? null : J(e.easing ?? "linear") ?? n.linear
|
|
424
|
+
})), w = (t, n) => (r) => {
|
|
425
|
+
r.stopPropagation(), r.currentTarget.setPointerCapture(r.pointerId), u.current = {
|
|
426
|
+
kind: t,
|
|
427
|
+
i: n,
|
|
428
|
+
range: [p, m],
|
|
429
|
+
moved: !1
|
|
430
|
+
}, t === "key" && i({
|
|
431
|
+
trackId: e.id,
|
|
432
|
+
index: n
|
|
433
|
+
});
|
|
434
|
+
}, T = (e) => {
|
|
435
|
+
let t = u.current;
|
|
436
|
+
if (!t) return;
|
|
437
|
+
t.moved = !0;
|
|
438
|
+
let r = v(e), i = d.map((e) => ({ ...e }));
|
|
439
|
+
if (t.kind === "key") {
|
|
440
|
+
let e = i[t.i - 1]?.t ?? 0, n = i[t.i + 1]?.t ?? 1;
|
|
441
|
+
i[t.i].t = Math.min(n, Math.max(e, r.t)), i[t.i].v = r.v;
|
|
442
|
+
} else {
|
|
443
|
+
let e = i[t.i], a = i[t.i + 1], o = a.t - e.t || 1e-6, s = Math.abs(a.v - e.v) > 1e-9 ? a.v - e.v : m - p, c = Math.min(1, Math.max(0, (r.t - e.t) / o)), l = (r.v - e.v) / s, u = [...J(e.easing ?? "linear") ?? n.linear];
|
|
444
|
+
t.kind === "out" ? (u[0] = c, u[1] = l) : (u[2] = c, u[3] = l), e.easing = u.map((e) => Math.round(e * 1e3) / 1e3);
|
|
445
|
+
}
|
|
446
|
+
l(i);
|
|
447
|
+
}, E = () => {
|
|
448
|
+
let n = u.current;
|
|
449
|
+
if (u.current = null, n?.moved && c) {
|
|
450
|
+
let r = c[n.i];
|
|
451
|
+
t(e, c), n.kind === "key" && i({
|
|
452
|
+
trackId: e.id,
|
|
453
|
+
index: [...c].sort((e, t) => e.t - t.t).indexOf(r)
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
l(null);
|
|
457
|
+
}, D = r?.trackId === e.id ? r.index : -1, O = (e, t, n, r, i, a) => /* @__PURE__ */ C("g", { children: [/* @__PURE__ */ S("line", {
|
|
458
|
+
x1: n,
|
|
459
|
+
y1: r,
|
|
460
|
+
x2: e,
|
|
461
|
+
y2: t,
|
|
462
|
+
stroke: "var(--kol-accent-primary)",
|
|
463
|
+
strokeWidth: 1
|
|
464
|
+
}), /* @__PURE__ */ S("circle", {
|
|
465
|
+
cx: e,
|
|
466
|
+
cy: t,
|
|
467
|
+
r: 4,
|
|
468
|
+
fill: "var(--kol-surface-primary)",
|
|
469
|
+
stroke: "var(--kol-accent-primary)",
|
|
470
|
+
strokeWidth: 1.5,
|
|
471
|
+
style: { cursor: "grab" },
|
|
472
|
+
onPointerDown: w(i, a),
|
|
473
|
+
onPointerMove: T,
|
|
474
|
+
onPointerUp: E,
|
|
475
|
+
onPointerCancel: E
|
|
476
|
+
})] }, `${i}${a}`);
|
|
477
|
+
return /* @__PURE__ */ C("div", {
|
|
478
|
+
className: "flex items-stretch",
|
|
479
|
+
style: { gap: F },
|
|
480
|
+
children: [/* @__PURE__ */ C("span", {
|
|
481
|
+
className: "shrink-0 flex flex-col justify-between items-end kol-float-ruler text-meta py-2",
|
|
482
|
+
style: { width: P },
|
|
483
|
+
children: [/* @__PURE__ */ S("span", { children: Math.round(m * 100) / 100 }), /* @__PURE__ */ S("span", { children: Math.round(p * 100) / 100 })]
|
|
484
|
+
}), /* @__PURE__ */ S("div", {
|
|
485
|
+
ref: a,
|
|
486
|
+
className: "relative flex-1 rounded-[5px] bg-[var(--kol-float-well)]",
|
|
487
|
+
style: {
|
|
488
|
+
height: Y,
|
|
489
|
+
touchAction: "none"
|
|
490
|
+
},
|
|
491
|
+
children: o > 0 && /* @__PURE__ */ C("svg", {
|
|
492
|
+
width: o,
|
|
493
|
+
height: Y,
|
|
494
|
+
className: "absolute inset-0 overflow-visible",
|
|
495
|
+
children: [
|
|
496
|
+
x.map(({ i: e, a: t, b: n, bez: r }) => r ? /* @__PURE__ */ S("path", {
|
|
497
|
+
d: `M ${h(t.t)} ${g(t.v)} C ${h(t.t + r[0] * (n.t - t.t))} ${g(t.v + r[1] * (n.v - t.v))}, ${h(t.t + r[2] * (n.t - t.t))} ${g(t.v + r[3] * (n.v - t.v))}, ${h(n.t)} ${g(n.v)}`,
|
|
498
|
+
fill: "none",
|
|
499
|
+
stroke: "var(--kol-fg-emphasis)",
|
|
500
|
+
strokeWidth: 1.5
|
|
501
|
+
}, `s${e}`) : /* @__PURE__ */ S("path", {
|
|
502
|
+
d: `M ${h(t.t)} ${g(t.v)} H ${h(n.t)} V ${g(n.v)}`,
|
|
503
|
+
fill: "none",
|
|
504
|
+
stroke: "var(--kol-fg-emphasis)",
|
|
505
|
+
strokeWidth: 1.5,
|
|
506
|
+
strokeDasharray: "3 3"
|
|
507
|
+
}, `s${e}`)),
|
|
508
|
+
x.filter(({ i: e, bez: t }) => t && (e === D || e + 1 === D)).map(({ i: e, a: t, b: n, bez: r }) => {
|
|
509
|
+
let i = Math.abs(n.v - t.v) > 1e-9 ? n.v - t.v : m - p;
|
|
510
|
+
return [e === D ? O(h(t.t + r[0] * (n.t - t.t)), g(t.v + r[1] * i), h(t.t), g(t.v), "out", e) : null, e + 1 === D ? O(h(t.t + r[2] * (n.t - t.t)), g(t.v + r[3] * i), h(n.t), g(n.v), "in", e) : null];
|
|
511
|
+
}),
|
|
512
|
+
d.map((e, t) => /* @__PURE__ */ S("rect", {
|
|
513
|
+
x: h(e.t) - 4.5,
|
|
514
|
+
y: g(e.v) - 4.5,
|
|
515
|
+
width: 9,
|
|
516
|
+
height: 9,
|
|
517
|
+
rx: 1.5,
|
|
518
|
+
transform: `rotate(45 ${h(e.t)} ${g(e.v)})`,
|
|
519
|
+
fill: t === D ? "var(--kol-accent-primary)" : "var(--kol-fg-emphasis)",
|
|
520
|
+
style: { cursor: "grab" },
|
|
521
|
+
onPointerDown: w("key", t),
|
|
522
|
+
onPointerMove: T,
|
|
523
|
+
onPointerUp: E,
|
|
524
|
+
onPointerCancel: E
|
|
525
|
+
}, `k${t}`))
|
|
526
|
+
]
|
|
527
|
+
})
|
|
528
|
+
})]
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
var ce = [...r, {
|
|
532
|
+
value: "custom",
|
|
533
|
+
label: "Custom"
|
|
534
|
+
}];
|
|
535
|
+
function le({ tracks: e, selected: t, setSelected: r, writeKeys: i, len: a }) {
|
|
536
|
+
if (!t) return null;
|
|
537
|
+
let o = e.find((e) => e.id === t.trackId), s = o?.keys[t.index];
|
|
538
|
+
if (!s || o.readOnly) return null;
|
|
539
|
+
let c = (e) => {
|
|
540
|
+
i(o, o.keys.map((n, r) => r === t.index ? {
|
|
541
|
+
...n,
|
|
542
|
+
...e
|
|
543
|
+
} : n));
|
|
544
|
+
}, l = typeof s.v == "number", p = Array.isArray(s.easing) ? "custom" : s.easing ?? "linear";
|
|
545
|
+
return /* @__PURE__ */ S("div", {
|
|
546
|
+
className: "flex items-start gap-3 pt-1",
|
|
547
|
+
children: /* @__PURE__ */ C("div", {
|
|
548
|
+
className: "flex items-center gap-2 flex-wrap min-w-0 flex-1",
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ C("span", {
|
|
551
|
+
className: "kol-float-label text-meta shrink-0",
|
|
552
|
+
children: [
|
|
553
|
+
"key @ ",
|
|
554
|
+
H(s.t, a),
|
|
555
|
+
" s"
|
|
556
|
+
]
|
|
557
|
+
}),
|
|
558
|
+
!o.header && /* @__PURE__ */ S(f, {
|
|
559
|
+
variant: "float",
|
|
560
|
+
size: "sm",
|
|
561
|
+
chars: 7,
|
|
562
|
+
type: l ? "number" : "text",
|
|
563
|
+
value: String(s.v),
|
|
564
|
+
onChange: (e) => c({ v: l ? Number(e.target.value) || 0 : e.target.value })
|
|
565
|
+
}),
|
|
566
|
+
/* @__PURE__ */ S(d, {
|
|
567
|
+
variant: "subtle",
|
|
568
|
+
size: "sm",
|
|
569
|
+
options: ce,
|
|
570
|
+
value: p,
|
|
571
|
+
onChange: (e) => c({ easing: e === "custom" ? [...J(s.easing) ?? n["in-out"]] : e })
|
|
572
|
+
}),
|
|
573
|
+
/* @__PURE__ */ S(u, {
|
|
574
|
+
variant: "float",
|
|
575
|
+
tone: "ghost",
|
|
576
|
+
size: "sm",
|
|
577
|
+
onClick: () => {
|
|
578
|
+
o.keys.length > 1 && i(o, o.keys.filter((e, n) => n !== t.index)), r(null);
|
|
579
|
+
},
|
|
580
|
+
children: "Delete key"
|
|
581
|
+
}),
|
|
582
|
+
/* @__PURE__ */ S(u, {
|
|
583
|
+
variant: "float",
|
|
584
|
+
tone: "ghost",
|
|
585
|
+
size: "sm",
|
|
586
|
+
className: "ml-auto",
|
|
587
|
+
onClick: () => r(null),
|
|
588
|
+
children: "Close"
|
|
589
|
+
})
|
|
590
|
+
]
|
|
591
|
+
})
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
var Z = "kol-fxr:dock-h", ue = 128, Q = 480, de = () => {
|
|
595
|
+
try {
|
|
596
|
+
let e = Number(localStorage.getItem(Z));
|
|
597
|
+
return e >= ue ? e : null;
|
|
598
|
+
} catch {
|
|
599
|
+
return null;
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
function fe({ onDrag: e, onEnd: t, onReset: n }) {
|
|
603
|
+
let r = y(null), i = y(null), [a, o] = b(!1);
|
|
604
|
+
return h(r, { axis: "x" }), /* @__PURE__ */ S("div", {
|
|
605
|
+
ref: r,
|
|
606
|
+
className: `kol-timeline-grab ${a ? "is-dragging" : ""}`.trim(),
|
|
607
|
+
role: "separator",
|
|
608
|
+
"aria-orientation": "horizontal",
|
|
609
|
+
"aria-label": "Resize the timeline",
|
|
610
|
+
onPointerDown: (e) => {
|
|
611
|
+
e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), i.current = e.clientY, o(!0);
|
|
612
|
+
},
|
|
613
|
+
onPointerMove: (t) => {
|
|
614
|
+
i.current != null && e(i.current - t.clientY);
|
|
615
|
+
},
|
|
616
|
+
onPointerUp: (e) => {
|
|
617
|
+
e.currentTarget.releasePointerCapture(e.pointerId), i.current = null, o(!1), t?.();
|
|
618
|
+
},
|
|
619
|
+
onPointerCancel: () => {
|
|
620
|
+
i.current = null, o(!1), t?.();
|
|
621
|
+
},
|
|
622
|
+
onDoubleClick: n
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
function pe() {
|
|
626
|
+
let { layers: e } = t(), n = l(), r = N();
|
|
627
|
+
return v(() => z(e).length > 0, [e]) || !!n.active || r;
|
|
628
|
+
}
|
|
629
|
+
function me({ surface: e = "solid" }) {
|
|
630
|
+
let { layers: n, updateLayer: r, selectedIds: s, select: c, toggleLayer: u, toggleLayerLock: d, currentPresetName: f } = t(), { t: p, loopSeconds: m, seek: h } = a(), g = l(), x = N(), w = v(() => z(n), [n]), T = v(() => g.active && !w.some((e) => e.header) ? [{
|
|
631
|
+
id: "morph:empty",
|
|
632
|
+
layerId: null,
|
|
633
|
+
key: "morphT",
|
|
634
|
+
label: g.fileName || "Morph",
|
|
635
|
+
keys: [],
|
|
636
|
+
header: !0,
|
|
637
|
+
readOnly: !0,
|
|
638
|
+
names: [],
|
|
639
|
+
steps: 0
|
|
640
|
+
}, ...w] : w, [
|
|
641
|
+
w,
|
|
642
|
+
g.active,
|
|
643
|
+
g.fileName
|
|
644
|
+
]), [E, D] = b(null), [k, A] = b(() => /* @__PURE__ */ new Set()), [j, M] = b(1), [P, F] = b(de), I = y(null);
|
|
645
|
+
_(() => {
|
|
646
|
+
try {
|
|
647
|
+
P ? localStorage.setItem(Z, String(P)) : localStorage.removeItem(Z);
|
|
648
|
+
} catch {}
|
|
649
|
+
}, [P]);
|
|
650
|
+
let B = y(Array(R).fill(0)), V = v(() => te(n), [n]);
|
|
651
|
+
if (V.some(ne) && (B.current.push(i().level), B.current.shift()), T.length === 0 && !x) return null;
|
|
652
|
+
let H = p * m, re = he(m, j, H), U = (e, t) => {
|
|
653
|
+
let n = [...t].sort((e, t) => e.t - t.t);
|
|
654
|
+
r(e.layerId, { [e.key]: {
|
|
655
|
+
bind: "track",
|
|
656
|
+
keys: n
|
|
657
|
+
} });
|
|
658
|
+
}, ie = (e) => A((t) => {
|
|
659
|
+
let n = new Set(t);
|
|
660
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
661
|
+
}), W = E && T.find((e) => e.id === E.trackId) || T.find((e) => s.includes(e.layerId) && !e.readOnly) || null, ae = () => {
|
|
662
|
+
if (!W) return;
|
|
663
|
+
let e = [...W.keys, {
|
|
664
|
+
t: p,
|
|
665
|
+
v: ee(W.keys, p),
|
|
666
|
+
easing: "linear"
|
|
667
|
+
}].sort((e, t) => e.t - t.t);
|
|
668
|
+
U(W, e), D({
|
|
669
|
+
trackId: W.id,
|
|
670
|
+
index: e.findIndex((e) => e.t === p)
|
|
671
|
+
});
|
|
672
|
+
}, G = /* @__PURE__ */ new Map();
|
|
673
|
+
for (let e of T) {
|
|
674
|
+
let t = G.get(e.layerId) ?? [];
|
|
675
|
+
t.push(e), G.set(e.layerId, t);
|
|
676
|
+
}
|
|
677
|
+
let K = [];
|
|
678
|
+
for (let e of V) {
|
|
679
|
+
let t = G.get(e.id) ?? [];
|
|
680
|
+
t.length === 0 ? K.push({
|
|
681
|
+
id: e.id,
|
|
682
|
+
layer: e,
|
|
683
|
+
kind: ne(e) ? "wave" : "clip"
|
|
684
|
+
}) : t.forEach((t, n) => K.push({
|
|
685
|
+
id: t.id,
|
|
686
|
+
layer: e,
|
|
687
|
+
track: t,
|
|
688
|
+
sub: n > 0
|
|
689
|
+
}));
|
|
690
|
+
}
|
|
691
|
+
for (let e of G.get(null) ?? []) K.push({
|
|
692
|
+
id: e.id,
|
|
693
|
+
layer: null,
|
|
694
|
+
track: e
|
|
695
|
+
});
|
|
696
|
+
let oe = K.filter((e) => !(e.track?.under && k.has(e.track.under))), q = (e) => !!e && s.includes(e.id), J = !!(E && T.find((e) => e.id === E.trackId && !e.header && !e.readOnly)), Y = !!o.clock.state.looping, X = oe.map((e) => ({
|
|
697
|
+
...e,
|
|
698
|
+
lit: q(e.layer) || !!e.track && E?.trackId === e.track.id,
|
|
699
|
+
labelLit: q(e.layer),
|
|
700
|
+
name: e.sub ? e.track.key : e.layer ? O(e.layer) : e.track.label,
|
|
701
|
+
label: e.kind === "wave" ? `${O(e.layer)} · audio` : void 0,
|
|
702
|
+
wave: e.kind === "wave" ? B.current : void 0,
|
|
703
|
+
fold: e.track?.header && T.some((t) => t.under === e.track.id) ? {
|
|
704
|
+
folded: k.has(e.track.id),
|
|
705
|
+
toggle: () => ie(e.track.id)
|
|
706
|
+
} : null,
|
|
707
|
+
graph: e.track && E?.trackId === e.track.id && !e.track.header && !e.track.readOnly && e.track.keys.every((e) => typeof e.v == "number") ? /* @__PURE__ */ S(se, {
|
|
708
|
+
track: e.track,
|
|
709
|
+
writeKeys: U,
|
|
710
|
+
selected: E,
|
|
711
|
+
setSelected: D
|
|
712
|
+
}) : null
|
|
713
|
+
}));
|
|
714
|
+
return /* @__PURE__ */ C("div", {
|
|
715
|
+
className: "kol-timeline-dock relative p-3 select-none",
|
|
716
|
+
style: {
|
|
717
|
+
height: P ?? void 0,
|
|
718
|
+
maxHeight: P ? void 0 : Q
|
|
719
|
+
},
|
|
720
|
+
children: [/* @__PURE__ */ S(fe, {
|
|
721
|
+
onDrag: (e) => {
|
|
722
|
+
I.current ??= P ?? 0, F(Math.min(Q, Math.max(ue, (I.current || 222) + e)));
|
|
723
|
+
},
|
|
724
|
+
onEnd: () => {
|
|
725
|
+
I.current = null;
|
|
726
|
+
},
|
|
727
|
+
onReset: () => F(null)
|
|
728
|
+
}), /* @__PURE__ */ S(ge, {
|
|
729
|
+
surface: e,
|
|
730
|
+
className: "h-full min-h-0",
|
|
731
|
+
title: f || "Untitled",
|
|
732
|
+
count: V.length,
|
|
733
|
+
onAdd: W ? ae : void 0,
|
|
734
|
+
mode: J ? "Curve" : "Keyframes",
|
|
735
|
+
looping: Y,
|
|
736
|
+
onLoop: () => o.clock.set({ looping: !Y }),
|
|
737
|
+
zoom: j,
|
|
738
|
+
onZoom: () => M(L[(L.indexOf(j) + 1) % L.length]),
|
|
739
|
+
onFit: () => M(1),
|
|
740
|
+
expanded: !!P,
|
|
741
|
+
onExpand: () => F(P ? null : Q),
|
|
742
|
+
view: re,
|
|
743
|
+
seek: h,
|
|
744
|
+
now: H,
|
|
745
|
+
rows: X,
|
|
746
|
+
selected: E,
|
|
747
|
+
setSelected: D,
|
|
748
|
+
writeKeys: U,
|
|
749
|
+
select: c,
|
|
750
|
+
toggleLayer: u,
|
|
751
|
+
toggleLayerLock: d,
|
|
752
|
+
footer: /* @__PURE__ */ S(le, {
|
|
753
|
+
tracks: T,
|
|
754
|
+
selected: E,
|
|
755
|
+
setSelected: D,
|
|
756
|
+
writeKeys: U,
|
|
757
|
+
len: m
|
|
758
|
+
})
|
|
759
|
+
})]
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
var $ = () => {};
|
|
763
|
+
function he(e, t = 1, n = 0) {
|
|
764
|
+
let r = e / t, i = t === 1 ? 0 : Math.min(Math.max(0, n - r / 2), e - r);
|
|
765
|
+
return {
|
|
766
|
+
loop: e,
|
|
767
|
+
origin: i,
|
|
768
|
+
span: r,
|
|
769
|
+
X: (t) => (t * e - i) / r,
|
|
770
|
+
fracFromEvent: (t, n) => {
|
|
771
|
+
let a = n.getBoundingClientRect(), o = i + Math.min(1, Math.max(0, (t.clientX - a.left) / a.width)) * r;
|
|
772
|
+
return Math.min(1, Math.max(0, o / e));
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function ge({ surface: e = "solid", title: t, count: n = 0, onAdd: r, mode: i = "Keyframes", looping: a = !1, onLoop: o, zoom: s = 1, onZoom: c, onFit: l, expanded: u = !1, onExpand: d, view: f, seek: h = $, now: _ = 0, rows: v = [], selected: y = null, setSelected: b = $, writeKeys: x = $, select: T = $, toggleLayer: E = $, toggleLayerLock: D = $, footer: O, className: k = "", style: A }) {
|
|
777
|
+
return /* @__PURE__ */ C("div", {
|
|
778
|
+
className: `kol-timeline flex flex-col gap-2 p-3 ${m(e, !0)} ${k}`.trim(),
|
|
779
|
+
style: {
|
|
780
|
+
borderRadius: "var(--kol-float-menu-r)",
|
|
781
|
+
...A
|
|
782
|
+
},
|
|
783
|
+
children: [
|
|
784
|
+
/* @__PURE__ */ C("div", {
|
|
785
|
+
className: "flex items-center justify-between h-6 shrink-0",
|
|
786
|
+
children: [/* @__PURE__ */ C("div", {
|
|
787
|
+
className: "flex items-center gap-3.5",
|
|
788
|
+
children: [
|
|
789
|
+
/* @__PURE__ */ S("span", {
|
|
790
|
+
className: "flex text-oq-96",
|
|
791
|
+
"aria-hidden": "true",
|
|
792
|
+
children: /* @__PURE__ */ S(w, {
|
|
793
|
+
name: "layers",
|
|
794
|
+
size: 14
|
|
795
|
+
})
|
|
796
|
+
}),
|
|
797
|
+
/* @__PURE__ */ S("span", {
|
|
798
|
+
className: "kol-float-panel text-emphasis whitespace-nowrap",
|
|
799
|
+
children: t
|
|
800
|
+
}),
|
|
801
|
+
/* @__PURE__ */ C("span", {
|
|
802
|
+
className: "kol-float-label text-meta whitespace-nowrap",
|
|
803
|
+
children: [
|
|
804
|
+
n,
|
|
805
|
+
" ",
|
|
806
|
+
n === 1 ? "layer" : "layers"
|
|
807
|
+
]
|
|
808
|
+
}),
|
|
809
|
+
/* @__PURE__ */ S(U, {
|
|
810
|
+
name: "plus",
|
|
811
|
+
label: "Add a key at the head",
|
|
812
|
+
disabled: !r,
|
|
813
|
+
onClick: r
|
|
814
|
+
})
|
|
815
|
+
]
|
|
816
|
+
}), /* @__PURE__ */ C("div", {
|
|
817
|
+
className: "flex items-center gap-[18px]",
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ S("span", {
|
|
820
|
+
className: "kol-float-label text-fg-64",
|
|
821
|
+
children: i
|
|
822
|
+
}),
|
|
823
|
+
/* @__PURE__ */ S(U, {
|
|
824
|
+
name: "overlap",
|
|
825
|
+
label: a ? "Loop off" : "Loop on",
|
|
826
|
+
toggle: !0,
|
|
827
|
+
on: a,
|
|
828
|
+
onClick: o
|
|
829
|
+
}),
|
|
830
|
+
/* @__PURE__ */ S(U, {
|
|
831
|
+
name: "cap-round",
|
|
832
|
+
label: "Fit the loop",
|
|
833
|
+
on: s !== 1,
|
|
834
|
+
onClick: l
|
|
835
|
+
}),
|
|
836
|
+
/* @__PURE__ */ S(p, {
|
|
837
|
+
label: "Zoom the lanes",
|
|
838
|
+
variant: "float",
|
|
839
|
+
asChild: !0,
|
|
840
|
+
children: /* @__PURE__ */ C("button", {
|
|
841
|
+
type: "button",
|
|
842
|
+
onClick: c,
|
|
843
|
+
className: "kol-float-timecode text-emphasis leading-none cursor-pointer rounded outline-none focus-visible:shadow-[var(--kol-float-focus)]",
|
|
844
|
+
children: [s * 100, "%"]
|
|
845
|
+
})
|
|
846
|
+
}),
|
|
847
|
+
/* @__PURE__ */ S(U, {
|
|
848
|
+
name: "nav-create",
|
|
849
|
+
label: u ? "Fit the timeline to its lanes" : "Expand the timeline",
|
|
850
|
+
on: u,
|
|
851
|
+
onClick: d
|
|
852
|
+
})
|
|
853
|
+
]
|
|
854
|
+
})]
|
|
855
|
+
}),
|
|
856
|
+
/* @__PURE__ */ C("div", {
|
|
857
|
+
className: "relative flex flex-col gap-2 min-h-0",
|
|
858
|
+
children: [
|
|
859
|
+
/* @__PURE__ */ S(oe, {
|
|
860
|
+
view: f,
|
|
861
|
+
seek: h
|
|
862
|
+
}),
|
|
863
|
+
/* @__PURE__ */ S("div", {
|
|
864
|
+
className: "flex flex-col gap-1 min-h-0 overflow-y-auto",
|
|
865
|
+
children: v.map((e) => /* @__PURE__ */ C(g, { children: [/* @__PURE__ */ C("div", {
|
|
866
|
+
className: "flex items-start shrink-0",
|
|
867
|
+
style: {
|
|
868
|
+
gap: F,
|
|
869
|
+
height: I
|
|
870
|
+
},
|
|
871
|
+
children: [/* @__PURE__ */ S(K, {
|
|
872
|
+
layer: e.layer,
|
|
873
|
+
sub: e.sub,
|
|
874
|
+
lit: e.labelLit ?? e.lit,
|
|
875
|
+
name: e.name,
|
|
876
|
+
select: T,
|
|
877
|
+
toggleLayer: E,
|
|
878
|
+
toggleLayerLock: D,
|
|
879
|
+
fold: e.fold
|
|
880
|
+
}), e.track ? /* @__PURE__ */ S(ie, {
|
|
881
|
+
track: e.track,
|
|
882
|
+
view: f,
|
|
883
|
+
selected: y,
|
|
884
|
+
setSelected: b,
|
|
885
|
+
writeKeys: x,
|
|
886
|
+
lit: !!e.lit
|
|
887
|
+
}) : e.kind === "wave" ? /* @__PURE__ */ S(G, {
|
|
888
|
+
view: f,
|
|
889
|
+
lit: !!e.lit,
|
|
890
|
+
label: e.label,
|
|
891
|
+
wave: e.wave ?? []
|
|
892
|
+
}) : /* @__PURE__ */ S(ae, {
|
|
893
|
+
view: f,
|
|
894
|
+
lit: !!e.lit,
|
|
895
|
+
label: e.label
|
|
896
|
+
})]
|
|
897
|
+
}), e.graph] }, e.id))
|
|
898
|
+
}),
|
|
899
|
+
/* @__PURE__ */ S(q, {
|
|
900
|
+
view: f,
|
|
901
|
+
now: _
|
|
902
|
+
})
|
|
903
|
+
]
|
|
904
|
+
}),
|
|
905
|
+
O
|
|
906
|
+
]
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
//#endregion
|
|
910
|
+
export { M as a, O as c, pe as i, ge as n, N as o, he as r, E as s, me as t };
|