@video-editor/ui 0.0.1-beta.14 → 0.0.1-beta.16
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/VideoEditorTimeline.d.ts +2 -0
- package/dist/VideoEditorTimeline.js +2 -2
- package/dist/VideoTimeline.d.ts +2 -0
- package/dist/VideoTimeline.js +1 -1
- package/dist/index-Czb5PTVP.js +759 -0
- package/dist/index-D22E5BT6.js +370 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -3
- package/dist/ui.css +1 -1
- package/package.json +3 -3
- package/dist/index-CsdNgHvd.js +0 -348
- package/dist/index-t1DKjcCO.js +0 -750
package/dist/index-CsdNgHvd.js
DELETED
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import { defineComponent as _, reactive as q, watch as j, onBeforeUnmount as G, createElementBlock as g, openBlock as d, renderSlot as i, normalizeStyle as E, createElementVNode as u, Fragment as M, renderList as A, toDisplayString as v, createCommentVNode as U, computed as C, ref as K, createBlock as Q, createSlots as W, withCtx as z, createVNode as b, unref as h, normalizeProps as F, guardReactiveProps as L } from "vue";
|
|
2
|
-
import { _ as N, V as X } from "./index-t1DKjcCO.js";
|
|
3
|
-
import { generateThumbnails as Z } from "@video-editor/protocol";
|
|
4
|
-
import { isVideoFramesSegment as x } from "@video-editor/shared";
|
|
5
|
-
const ee = { class: "frames-segment" }, te = { class: "frames-segment__video" }, ne = {
|
|
6
|
-
key: 1,
|
|
7
|
-
class: "frames-segment__placeholder"
|
|
8
|
-
}, se = { class: "frames-segment__placeholder" }, re = {
|
|
9
|
-
key: 0,
|
|
10
|
-
class: "frames-segment__badge"
|
|
11
|
-
}, oe = /* @__PURE__ */ _({
|
|
12
|
-
name: "FramesSegment",
|
|
13
|
-
__name: "FramesSegment",
|
|
14
|
-
props: {
|
|
15
|
-
segment: {}
|
|
16
|
-
},
|
|
17
|
-
setup(o) {
|
|
18
|
-
const f = o, n = q({ items: [], loading: !1, error: null });
|
|
19
|
-
let c = 0;
|
|
20
|
-
j(() => f.segment, (s, a) => {
|
|
21
|
-
if (!x(s))
|
|
22
|
-
return;
|
|
23
|
-
(!a || y(a, s)) && V(s);
|
|
24
|
-
}, { immediate: !0, deep: !0 }), G(() => {
|
|
25
|
-
$();
|
|
26
|
-
});
|
|
27
|
-
function y(s, a) {
|
|
28
|
-
return s.url !== a.url || s.startTime !== a.startTime || s.endTime !== a.endTime || s.fromTime !== a.fromTime;
|
|
29
|
-
}
|
|
30
|
-
async function V(s) {
|
|
31
|
-
if (!s.url)
|
|
32
|
-
return;
|
|
33
|
-
const a = ++c;
|
|
34
|
-
$(), n.loading = !0, n.error = null;
|
|
35
|
-
try {
|
|
36
|
-
const m = w(s), p = await Z(s.url, m);
|
|
37
|
-
if (c !== a)
|
|
38
|
-
return;
|
|
39
|
-
const R = p.map((T) => ({
|
|
40
|
-
tsMs: Math.round(T.ts / 1e3),
|
|
41
|
-
url: URL.createObjectURL(T.img)
|
|
42
|
-
}));
|
|
43
|
-
n.items = R, n.loading = !1;
|
|
44
|
-
} catch (m) {
|
|
45
|
-
if (c !== a)
|
|
46
|
-
return;
|
|
47
|
-
n.error = m instanceof Error ? m.message : String(m), n.loading = !1;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function w(s) {
|
|
51
|
-
const a = Math.max(s.fromTime ?? 0, 0) * 1e3, m = Math.max(s.endTime - s.startTime, 1), p = a + m * 1e3, T = Math.max(Math.floor((p - a) / 8), 2e5);
|
|
52
|
-
return { start: a, end: p, step: T };
|
|
53
|
-
}
|
|
54
|
-
function $() {
|
|
55
|
-
n.items.forEach((s) => URL.revokeObjectURL(s.url)), n.items = [];
|
|
56
|
-
}
|
|
57
|
-
function I() {
|
|
58
|
-
return {
|
|
59
|
-
backgroundImage: f.segment.url ? `url(${f.segment.url})` : "",
|
|
60
|
-
backgroundRepeat: "repeat-x",
|
|
61
|
-
backgroundSize: "56px 56px",
|
|
62
|
-
backgroundPosition: "left center"
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return (s, a) => (d(), g("div", ee, [
|
|
66
|
-
o.segment.type === "image" ? i(s.$slots, "image", {
|
|
67
|
-
key: 0,
|
|
68
|
-
segment: o.segment,
|
|
69
|
-
style: E(I())
|
|
70
|
-
}, () => [
|
|
71
|
-
u("div", {
|
|
72
|
-
class: "frames-segment__image",
|
|
73
|
-
style: E(I())
|
|
74
|
-
}, null, 4)
|
|
75
|
-
], !0) : o.segment.type === "video" ? (d(), g(M, { key: 1 }, [
|
|
76
|
-
n.items.length ? i(s.$slots, "video", {
|
|
77
|
-
key: 0,
|
|
78
|
-
segment: o.segment,
|
|
79
|
-
thumbnails: n.items
|
|
80
|
-
}, () => [
|
|
81
|
-
u("div", te, [
|
|
82
|
-
(d(!0), g(M, null, A(n.items, (m) => (d(), g("div", {
|
|
83
|
-
key: `${o.segment.id}-${m.tsMs}`,
|
|
84
|
-
class: "frames-segment__thumb",
|
|
85
|
-
style: E({ backgroundImage: `url(${m.url})` })
|
|
86
|
-
}, null, 4))), 128))
|
|
87
|
-
])
|
|
88
|
-
], !0) : (d(), g("div", ne, [
|
|
89
|
-
n.loading ? i(s.$slots, "loading", {
|
|
90
|
-
key: 0,
|
|
91
|
-
segment: o.segment
|
|
92
|
-
}, () => [
|
|
93
|
-
a[0] || (a[0] = u("span", null, "抽帧中…", -1))
|
|
94
|
-
], !0) : n.error ? i(s.$slots, "error", {
|
|
95
|
-
key: 1,
|
|
96
|
-
segment: o.segment,
|
|
97
|
-
error: n.error
|
|
98
|
-
}, () => [
|
|
99
|
-
a[1] || (a[1] = u("span", null, "生成失败", -1))
|
|
100
|
-
], !0) : i(s.$slots, "empty", {
|
|
101
|
-
key: 2,
|
|
102
|
-
segment: o.segment
|
|
103
|
-
}, () => [
|
|
104
|
-
a[2] || (a[2] = u("span", null, "未生成缩略图", -1))
|
|
105
|
-
], !0)
|
|
106
|
-
]))
|
|
107
|
-
], 64)) : i(s.$slots, "fallback", {
|
|
108
|
-
key: 2,
|
|
109
|
-
segment: o.segment
|
|
110
|
-
}, () => [
|
|
111
|
-
u("div", se, [
|
|
112
|
-
u("span", null, v(o.segment.type), 1)
|
|
113
|
-
])
|
|
114
|
-
], !0),
|
|
115
|
-
i(s.$slots, "overlay", { segment: o.segment }, () => [
|
|
116
|
-
o.segment.extra?.label ? (d(), g("span", re, v(o.segment.extra?.label), 1)) : U("", !0)
|
|
117
|
-
], !0)
|
|
118
|
-
]));
|
|
119
|
-
}
|
|
120
|
-
}), ae = /* @__PURE__ */ N(oe, [["__scopeId", "data-v-4ab97cd2"]]), le = { class: "segment-base" }, ie = { class: "segment-base__content" }, ce = { class: "segment-base__pill segment-base__pill--primary" }, me = { class: "segment-base__pill segment-base__pill--muted" }, de = {
|
|
121
|
-
key: 0,
|
|
122
|
-
class: "segment-base__badge"
|
|
123
|
-
}, ue = /* @__PURE__ */ _({
|
|
124
|
-
name: "SegmentBase",
|
|
125
|
-
__name: "SegmentBase",
|
|
126
|
-
props: {
|
|
127
|
-
segment: {},
|
|
128
|
-
trackType: {},
|
|
129
|
-
accentColor: { default: "#222226" }
|
|
130
|
-
},
|
|
131
|
-
setup(o) {
|
|
132
|
-
const f = o, n = C(() => {
|
|
133
|
-
const c = f.segment?.extra?.label;
|
|
134
|
-
return typeof c == "string" ? c : null;
|
|
135
|
-
});
|
|
136
|
-
return (c, y) => (d(), g("div", le, [
|
|
137
|
-
u("div", ie, [
|
|
138
|
-
u("span", ce, v(o.trackType), 1),
|
|
139
|
-
u("span", me, v(o.segment.segmentType), 1)
|
|
140
|
-
]),
|
|
141
|
-
n.value ? (d(), g("span", de, v(n.value), 1)) : U("", !0)
|
|
142
|
-
]));
|
|
143
|
-
}
|
|
144
|
-
}), S = /* @__PURE__ */ N(ue, [["__scopeId", "data-v-d386af72"]]), ge = { class: "ve-editor-segment__preview" }, D = "#222226", pe = 0.4, fe = /* @__PURE__ */ _({
|
|
145
|
-
name: "VideoEditorTimeline",
|
|
146
|
-
__name: "index",
|
|
147
|
-
props: {
|
|
148
|
-
protocol: { default: null },
|
|
149
|
-
currentTime: {},
|
|
150
|
-
zoom: {},
|
|
151
|
-
snapStep: { default: 0 },
|
|
152
|
-
selectedSegmentId: { default: null },
|
|
153
|
-
trackTypes: { default: void 0 },
|
|
154
|
-
disableInteraction: { type: Boolean, default: !1 }
|
|
155
|
-
},
|
|
156
|
-
emits: ["update:currentTime", "update:zoom", "update:selectedSegmentId", "segmentClick", "segmentDragEnd", "segmentResizeEnd"],
|
|
157
|
-
setup(o, { emit: f }) {
|
|
158
|
-
const n = o, c = f, y = K(n.selectedSegmentId ?? null);
|
|
159
|
-
j(() => n.selectedSegmentId, (e) => {
|
|
160
|
-
y.value = e ?? null;
|
|
161
|
-
});
|
|
162
|
-
const V = {
|
|
163
|
-
frames: D,
|
|
164
|
-
audio: "#0ea5e9",
|
|
165
|
-
text: "#16a34a",
|
|
166
|
-
sticker: "#f97316",
|
|
167
|
-
effect: "#a855f7",
|
|
168
|
-
filter: "#64748b"
|
|
169
|
-
}, w = C(() => n.protocol?.tracks?.length ? n.trackTypes?.length ? n.protocol.tracks.filter((e) => n.trackTypes?.includes(e.trackType)) : n.protocol.tracks : []), $ = C(() => w.value.map((e, l) => {
|
|
170
|
-
const t = V[e.trackType] || D, r = s(t, pe), B = e.trackType === "frames" && e.isMain === !0;
|
|
171
|
-
return {
|
|
172
|
-
id: e.trackId || `${e.trackType}-${l}`,
|
|
173
|
-
label: e.trackType,
|
|
174
|
-
type: e.trackType,
|
|
175
|
-
color: t,
|
|
176
|
-
isMain: B,
|
|
177
|
-
payload: e,
|
|
178
|
-
segments: e.children.map((k) => ({
|
|
179
|
-
id: k.id,
|
|
180
|
-
start: k.startTime,
|
|
181
|
-
end: k.endTime,
|
|
182
|
-
type: k.segmentType,
|
|
183
|
-
color: r,
|
|
184
|
-
payload: k
|
|
185
|
-
}))
|
|
186
|
-
};
|
|
187
|
-
})), I = C(() => {
|
|
188
|
-
if (!n.protocol?.tracks?.length)
|
|
189
|
-
return 0;
|
|
190
|
-
const e = n.protocol.tracks.flatMap((l) => l.children.map((t) => t.endTime));
|
|
191
|
-
return e.length ? Math.max(...e) : 0;
|
|
192
|
-
});
|
|
193
|
-
function s(e, l) {
|
|
194
|
-
const t = e.replace("#", "");
|
|
195
|
-
if (!(t.length === 3 || t.length === 6))
|
|
196
|
-
return e;
|
|
197
|
-
const r = t.length === 3 ? t.split("").map((P) => P + P).join("") : t, B = Number.parseInt(r.slice(0, 2), 16), k = Number.parseInt(r.slice(2, 4), 16), Y = Number.parseInt(r.slice(4, 6), 16);
|
|
198
|
-
return `rgba(${B}, ${k}, ${Y}, ${l})`;
|
|
199
|
-
}
|
|
200
|
-
function a(e) {
|
|
201
|
-
return e && typeof e == "object" && "segmentType" in e ? e : null;
|
|
202
|
-
}
|
|
203
|
-
function m(e) {
|
|
204
|
-
const l = e.payload;
|
|
205
|
-
if (l)
|
|
206
|
-
return l;
|
|
207
|
-
if (n.protocol)
|
|
208
|
-
return n.protocol.tracks.find((t) => t.trackId === e.id);
|
|
209
|
-
}
|
|
210
|
-
function p(e) {
|
|
211
|
-
y.value = e, c("update:selectedSegmentId", e);
|
|
212
|
-
}
|
|
213
|
-
function R(e) {
|
|
214
|
-
const l = a(e.segment.payload), t = m(e.track);
|
|
215
|
-
l && (p(l.id), t && c("segmentClick", { segment: l, track: t }));
|
|
216
|
-
}
|
|
217
|
-
function T(e) {
|
|
218
|
-
p(e.segment.id);
|
|
219
|
-
}
|
|
220
|
-
function O(e) {
|
|
221
|
-
c("segmentDragEnd", e);
|
|
222
|
-
}
|
|
223
|
-
function H(e) {
|
|
224
|
-
p(e.segment.id);
|
|
225
|
-
}
|
|
226
|
-
function J(e) {
|
|
227
|
-
c("segmentResizeEnd", e);
|
|
228
|
-
}
|
|
229
|
-
return (e, l) => (d(), Q(X, {
|
|
230
|
-
tracks: $.value,
|
|
231
|
-
duration: I.value,
|
|
232
|
-
"current-time": o.currentTime,
|
|
233
|
-
zoom: o.zoom,
|
|
234
|
-
fps: o.protocol?.fps || 30,
|
|
235
|
-
"snap-step": o.snapStep,
|
|
236
|
-
"selected-segment-id": y.value ?? null,
|
|
237
|
-
"disable-interaction": o.disableInteraction,
|
|
238
|
-
"onUpdate:currentTime": l[0] || (l[0] = (t) => c("update:currentTime", t)),
|
|
239
|
-
"onUpdate:zoom": l[1] || (l[1] = (t) => c("update:zoom", t)),
|
|
240
|
-
onSegmentClick: R,
|
|
241
|
-
onSegmentDragStart: T,
|
|
242
|
-
onSegmentDragEnd: O,
|
|
243
|
-
onSegmentResizeStart: H,
|
|
244
|
-
onSegmentResizeEnd: J,
|
|
245
|
-
onBackgroundClick: l[2] || (l[2] = (t) => p(null))
|
|
246
|
-
}, W({
|
|
247
|
-
segment: z(({ layout: t }) => [
|
|
248
|
-
(d(!0), g(M, null, A([a(t.segment.payload)], (r) => (d(), g(M, {
|
|
249
|
-
key: r?.id || t.segment.id
|
|
250
|
-
}, [
|
|
251
|
-
r ? (d(), g("div", {
|
|
252
|
-
key: 0,
|
|
253
|
-
class: "ve-editor-segment",
|
|
254
|
-
style: E({ "--ve-segment-accent": t.track.color || D })
|
|
255
|
-
}, [
|
|
256
|
-
u("div", ge, [
|
|
257
|
-
r.segmentType === "frames" ? i(e.$slots, "segment-frames", {
|
|
258
|
-
key: 0,
|
|
259
|
-
segment: r,
|
|
260
|
-
layout: t
|
|
261
|
-
}, () => [
|
|
262
|
-
b(h(ae), { segment: r }, null, 8, ["segment"])
|
|
263
|
-
], !0) : r.segmentType === "text" ? i(e.$slots, "segment-text", {
|
|
264
|
-
key: 1,
|
|
265
|
-
segment: r,
|
|
266
|
-
layout: t
|
|
267
|
-
}, () => [
|
|
268
|
-
b(h(S), {
|
|
269
|
-
segment: r,
|
|
270
|
-
"track-type": t.track.type || "unknown",
|
|
271
|
-
"accent-color": t.track.color
|
|
272
|
-
}, null, 8, ["segment", "track-type", "accent-color"])
|
|
273
|
-
], !0) : r.segmentType === "sticker" ? i(e.$slots, "segment-sticker", {
|
|
274
|
-
key: 2,
|
|
275
|
-
segment: r,
|
|
276
|
-
layout: t
|
|
277
|
-
}, () => [
|
|
278
|
-
b(h(S), {
|
|
279
|
-
segment: r,
|
|
280
|
-
"track-type": t.track.type || "unknown",
|
|
281
|
-
"accent-color": t.track.color
|
|
282
|
-
}, null, 8, ["segment", "track-type", "accent-color"])
|
|
283
|
-
], !0) : r.segmentType === "audio" ? i(e.$slots, "segment-audio", {
|
|
284
|
-
key: 3,
|
|
285
|
-
segment: r,
|
|
286
|
-
layout: t
|
|
287
|
-
}, () => [
|
|
288
|
-
b(h(S), {
|
|
289
|
-
segment: r,
|
|
290
|
-
"track-type": t.track.type || "unknown",
|
|
291
|
-
"accent-color": t.track.color
|
|
292
|
-
}, null, 8, ["segment", "track-type", "accent-color"])
|
|
293
|
-
], !0) : r.segmentType === "effect" ? i(e.$slots, "segment-effect", {
|
|
294
|
-
key: 4,
|
|
295
|
-
segment: r,
|
|
296
|
-
layout: t
|
|
297
|
-
}, () => [
|
|
298
|
-
b(h(S), {
|
|
299
|
-
segment: r,
|
|
300
|
-
"track-type": t.track.type || "unknown",
|
|
301
|
-
"accent-color": t.track.color
|
|
302
|
-
}, null, 8, ["segment", "track-type", "accent-color"])
|
|
303
|
-
], !0) : r.segmentType === "filter" ? i(e.$slots, "segment-filter", {
|
|
304
|
-
key: 5,
|
|
305
|
-
segment: r,
|
|
306
|
-
layout: t
|
|
307
|
-
}, () => [
|
|
308
|
-
b(h(S), {
|
|
309
|
-
segment: r,
|
|
310
|
-
"track-type": t.track.type || "unknown",
|
|
311
|
-
"accent-color": t.track.color
|
|
312
|
-
}, null, 8, ["segment", "track-type", "accent-color"])
|
|
313
|
-
], !0) : U("", !0)
|
|
314
|
-
])
|
|
315
|
-
], 4)) : U("", !0)
|
|
316
|
-
], 64))), 128))
|
|
317
|
-
]),
|
|
318
|
-
_: 2
|
|
319
|
-
}, [
|
|
320
|
-
e.$slots.toolbar ? {
|
|
321
|
-
name: "toolbar",
|
|
322
|
-
fn: z((t) => [
|
|
323
|
-
i(e.$slots, "toolbar", F(L(t)), void 0, !0)
|
|
324
|
-
]),
|
|
325
|
-
key: "0"
|
|
326
|
-
} : void 0,
|
|
327
|
-
e.$slots.ruler ? {
|
|
328
|
-
name: "ruler",
|
|
329
|
-
fn: z((t) => [
|
|
330
|
-
i(e.$slots, "ruler", F(L(t)), void 0, !0)
|
|
331
|
-
]),
|
|
332
|
-
key: "1"
|
|
333
|
-
} : void 0,
|
|
334
|
-
e.$slots.playhead ? {
|
|
335
|
-
name: "playhead",
|
|
336
|
-
fn: z((t) => [
|
|
337
|
-
i(e.$slots, "playhead", F(L(t)), void 0, !0)
|
|
338
|
-
]),
|
|
339
|
-
key: "2"
|
|
340
|
-
} : void 0
|
|
341
|
-
]), 1032, ["tracks", "duration", "current-time", "zoom", "fps", "snap-step", "selected-segment-id", "disable-interaction"]));
|
|
342
|
-
}
|
|
343
|
-
}), he = /* @__PURE__ */ N(fe, [["__scopeId", "data-v-a04dee74"]]);
|
|
344
|
-
export {
|
|
345
|
-
ae as F,
|
|
346
|
-
S,
|
|
347
|
-
he as V
|
|
348
|
-
};
|