@video-editor/ui 0.0.1-beta.7 → 0.0.1-beta.9
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 +48 -11
- package/dist/VideoEditorTimeline.js +122 -100
- package/dist/VideoTimeline.js +1 -1
- package/dist/{index-y5KhRW21.js → index-B4a4-K9f.js} +171 -171
- package/dist/index.d.ts +66 -29
- package/dist/index.js +1 -1
- package/dist/ui.css +1 -1
- package/package.json +4 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as pe, createElementBlock as k, openBlock as _, withModifiers as le, normalizeStyle as D, createStaticVNode as Se, createElementVNode as c, Fragment as ge, renderList as he, normalizeClass as $e, createCommentVNode as ee, toDisplayString as G, renderSlot as V, computed as
|
|
1
|
+
import { defineComponent as pe, createElementBlock as k, openBlock as _, withModifiers as le, normalizeStyle as D, createStaticVNode as Se, createElementVNode as c, Fragment as ge, renderList as he, normalizeClass as $e, createCommentVNode as ee, toDisplayString as G, renderSlot as V, computed as M, ref as z, watch as fe, toRef as Re, onMounted as Pe, onBeforeUnmount as Ge, createVNode as ye, withDirectives as Ve, unref as K, vShow as Le } from "vue";
|
|
2
2
|
const Ne = /* @__PURE__ */ pe({
|
|
3
3
|
name: "TimelinePlayhead",
|
|
4
4
|
__name: "TimelinePlayhead",
|
|
@@ -11,9 +11,9 @@ const Ne = /* @__PURE__ */ pe({
|
|
|
11
11
|
return (o, i) => (_(), k("div", {
|
|
12
12
|
class: "ve-playhead",
|
|
13
13
|
style: D({ left: `${l.left}px` }),
|
|
14
|
-
onMousedown: i[0] || (i[0] = le((
|
|
14
|
+
onMousedown: i[0] || (i[0] = le((b) => s("dragStart", b), ["stop", "prevent"]))
|
|
15
15
|
}, [...i[1] || (i[1] = [
|
|
16
|
-
Se('<svg class="ve-playhead__icon" width="12" height="18" viewBox="0 0 12 18" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-
|
|
16
|
+
Se('<svg class="ve-playhead__icon" width="12" height="18" viewBox="0 0 12 18" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-601eb0b9><g filter="url(#ve_playhead_drop_shadow)" data-v-601eb0b9><path d="M2 3C2 1.89543 2.89543 1 4 1H8C9.10457 1 10 1.89543 10 3V11.0925C10 11.6692 9.75104 12.2178 9.31701 12.5976L7.31701 14.3476C6.56296 15.0074 5.43704 15.0074 4.68299 14.3476L2.68299 12.5976C2.24896 12.2178 2 11.6692 2 11.0925V3Z" fill="white" data-v-601eb0b9></path><path d="M4 1.5H8C8.82843 1.5 9.5 2.17157 9.5 3V11.0928C9.49991 11.5252 9.31275 11.9369 8.9873 12.2217L6.9873 13.9717C6.42191 14.466 5.57809 14.466 5.0127 13.9717L3.0127 12.2217C2.68725 11.9369 2.50009 11.5252 2.5 11.0928V3C2.5 2.17157 3.17157 1.5 4 1.5Z" stroke="currentColor" data-v-601eb0b9></path></g><defs data-v-601eb0b9><filter id="ve_playhead_drop_shadow" x="0" y="0" width="12" height="17.8428" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB" data-v-601eb0b9><feFlood flood-opacity="0" result="BackgroundImageFix" data-v-601eb0b9></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha" data-v-601eb0b9></feColorMatrix><feOffset dy="1" data-v-601eb0b9></feOffset><feGaussianBlur stdDeviation="1" data-v-601eb0b9></feGaussianBlur><feComposite in2="hardAlpha" operator="out" data-v-601eb0b9></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0" data-v-601eb0b9></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow" data-v-601eb0b9></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape" data-v-601eb0b9></feBlend></filter></defs></svg><div class="ve-playhead__line" data-v-601eb0b9></div>', 2)
|
|
17
17
|
])], 36));
|
|
18
18
|
}
|
|
19
19
|
}), xe = (l, f) => {
|
|
@@ -21,7 +21,7 @@ const Ne = /* @__PURE__ */ pe({
|
|
|
21
21
|
for (const [o, i] of f)
|
|
22
22
|
s[o] = i;
|
|
23
23
|
return s;
|
|
24
|
-
}, Oe = /* @__PURE__ */ xe(Ne, [["__scopeId", "data-v-
|
|
24
|
+
}, Oe = /* @__PURE__ */ xe(Ne, [["__scopeId", "data-v-601eb0b9"]]), Ye = { class: "ve-ruler" }, He = { class: "ve-ruler__ticks" }, We = {
|
|
25
25
|
key: 0,
|
|
26
26
|
class: "ve-ruler__label"
|
|
27
27
|
}, Ae = /* @__PURE__ */ pe({
|
|
@@ -47,7 +47,7 @@ const Ne = /* @__PURE__ */ pe({
|
|
|
47
47
|
])
|
|
48
48
|
]));
|
|
49
49
|
}
|
|
50
|
-
}), je = /* @__PURE__ */ xe(Ae, [["__scopeId", "data-v-30f91636"]]), Ue = { class: "ve-toolbar" }, Ke = { class: "ve-toolbar__group" }, qe = ["disabled"], Je = { class: "ve-toolbar__group" }, Qe = { class: "ve-zoom" }, et = { class: "ve-toolbar__group" }, tt = ["disabled"],
|
|
50
|
+
}), je = /* @__PURE__ */ xe(Ae, [["__scopeId", "data-v-30f91636"]]), Ue = { class: "ve-toolbar" }, Ke = { class: "ve-toolbar__group" }, qe = ["disabled"], Je = { class: "ve-toolbar__group" }, Qe = { class: "ve-zoom" }, et = { class: "ve-toolbar__group" }, tt = ["disabled"], nt = { class: "ve-toolbar__time" }, at = /* @__PURE__ */ pe({
|
|
51
51
|
name: "TimelineToolbar",
|
|
52
52
|
__name: "TimelineToolbar",
|
|
53
53
|
props: {
|
|
@@ -68,7 +68,7 @@ const Ne = /* @__PURE__ */ pe({
|
|
|
68
68
|
class: "ve-btn",
|
|
69
69
|
type: "button",
|
|
70
70
|
disabled: l.zoom <= l.minZoom,
|
|
71
|
-
onClick: i[0] || (i[0] = (
|
|
71
|
+
onClick: i[0] || (i[0] = (b) => s("zoomOut"))
|
|
72
72
|
}, " - ", 8, qe)
|
|
73
73
|
], !0)
|
|
74
74
|
]),
|
|
@@ -83,11 +83,11 @@ const Ne = /* @__PURE__ */ pe({
|
|
|
83
83
|
class: "ve-btn",
|
|
84
84
|
type: "button",
|
|
85
85
|
disabled: l.zoom >= l.maxZoom,
|
|
86
|
-
onClick: i[1] || (i[1] = (
|
|
86
|
+
onClick: i[1] || (i[1] = (b) => s("zoomIn"))
|
|
87
87
|
}, " + ", 8, tt)
|
|
88
88
|
], !0)
|
|
89
89
|
]),
|
|
90
|
-
c("div",
|
|
90
|
+
c("div", nt, [
|
|
91
91
|
V(o.$slots, "time", {
|
|
92
92
|
currentTime: l.currentTime,
|
|
93
93
|
duration: l.duration
|
|
@@ -99,7 +99,7 @@ const Ne = /* @__PURE__ */ pe({
|
|
|
99
99
|
])
|
|
100
100
|
]));
|
|
101
101
|
}
|
|
102
|
-
}), st = /* @__PURE__ */ xe(
|
|
102
|
+
}), st = /* @__PURE__ */ xe(at, [["__scopeId", "data-v-85ddeb0f"]]);
|
|
103
103
|
function lt(l, f, s, o) {
|
|
104
104
|
function i(Z) {
|
|
105
105
|
if (!l.value || !f.value.length)
|
|
@@ -108,13 +108,13 @@ function lt(l, f, s, o) {
|
|
|
108
108
|
if (I < p / 2)
|
|
109
109
|
return { isGap: !0, insertIndex: 0 };
|
|
110
110
|
for (let g = 0; g < f.value.length; g++) {
|
|
111
|
-
const
|
|
112
|
-
if (I >=
|
|
111
|
+
const d = (g + 1) * r - p / 2, te = (g + 1) * r + p / 2;
|
|
112
|
+
if (I >= d && I < te)
|
|
113
113
|
return { isGap: !0, insertIndex: g + 1 };
|
|
114
114
|
}
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function b(Z) {
|
|
118
118
|
if (!l.value || !f.value.length)
|
|
119
119
|
return -1;
|
|
120
120
|
const h = l.value.getBoundingClientRect(), I = Z - h.top, r = s.value + o.value;
|
|
@@ -125,18 +125,18 @@ function lt(l, f, s, o) {
|
|
|
125
125
|
}
|
|
126
126
|
return {
|
|
127
127
|
detectTrackGap: i,
|
|
128
|
-
resolveTrackIndexFromClientY:
|
|
128
|
+
resolveTrackIndexFromClientY: b
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
function ot(l, f, s) {
|
|
132
132
|
return {
|
|
133
|
-
snapGuides:
|
|
133
|
+
snapGuides: M(() => {
|
|
134
134
|
if (!l.value)
|
|
135
135
|
return [];
|
|
136
|
-
const i = /* @__PURE__ */ new Set(),
|
|
136
|
+
const i = /* @__PURE__ */ new Set(), b = l.value.startTime, Z = l.value.endTime, h = 100;
|
|
137
137
|
return ("value" in f ? f.value : f).forEach((r) => {
|
|
138
138
|
r.segments.forEach((p) => {
|
|
139
|
-
p.id !== l.value?.segment.id && (Math.abs(p.start -
|
|
139
|
+
p.id !== l.value?.segment.id && (Math.abs(p.start - b) < h && i.add(p.start), Math.abs(p.end - b) < h && i.add(p.end), Math.abs(p.start - Z) < h && i.add(p.start), Math.abs(p.end - Z) < h && i.add(p.end));
|
|
140
140
|
});
|
|
141
141
|
}), Array.from(i).map((r) => ({
|
|
142
142
|
time: r,
|
|
@@ -151,21 +151,21 @@ function it(l) {
|
|
|
151
151
|
tracksRef: s,
|
|
152
152
|
trackHeightPx: o,
|
|
153
153
|
trackGapPx: i,
|
|
154
|
-
pixelsPerMs:
|
|
154
|
+
pixelsPerMs: b,
|
|
155
155
|
disableInteraction: Z,
|
|
156
156
|
snap: h,
|
|
157
157
|
onDragStart: I,
|
|
158
158
|
onDrag: r,
|
|
159
159
|
onDragEnd: p
|
|
160
|
-
} = l, g = z(null),
|
|
160
|
+
} = l, g = z(null), d = z(null), { detectTrackGap: te, resolveTrackIndexFromClientY: ke } = lt(
|
|
161
161
|
s,
|
|
162
162
|
f,
|
|
163
163
|
o,
|
|
164
164
|
i
|
|
165
165
|
), { snapGuides: oe } = ot(
|
|
166
|
-
|
|
166
|
+
d,
|
|
167
167
|
f,
|
|
168
|
-
|
|
168
|
+
b
|
|
169
169
|
);
|
|
170
170
|
function ie(v, q) {
|
|
171
171
|
Z.value || (g.value = {
|
|
@@ -176,74 +176,74 @@ function it(l) {
|
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
function re(v, q, F, $) {
|
|
179
|
-
const { layout:
|
|
179
|
+
const { layout: u, initialX: _e, initialY: be } = v, ue = q - _e, O = F - be, Y = Math.abs(ue) > 5 || Math.abs(O) > 5;
|
|
180
180
|
if (!v.moved && Y) {
|
|
181
181
|
v.moved = !0;
|
|
182
182
|
const E = {
|
|
183
|
-
segment:
|
|
184
|
-
track:
|
|
185
|
-
trackIndex:
|
|
186
|
-
segmentIndex:
|
|
187
|
-
startTime:
|
|
188
|
-
endTime:
|
|
189
|
-
targetTrackIndex:
|
|
190
|
-
targetTrackId:
|
|
183
|
+
segment: u.segment,
|
|
184
|
+
track: u.track,
|
|
185
|
+
trackIndex: u.trackIndex,
|
|
186
|
+
segmentIndex: u.segmentIndex,
|
|
187
|
+
startTime: u.segment.start,
|
|
188
|
+
endTime: u.segment.end,
|
|
189
|
+
targetTrackIndex: u.trackIndex,
|
|
190
|
+
targetTrackId: u.track.id,
|
|
191
191
|
isNewTrack: !1,
|
|
192
|
-
visualTrackIndex:
|
|
192
|
+
visualTrackIndex: u.trackIndex,
|
|
193
193
|
isValidTarget: !0,
|
|
194
194
|
mouseDeltaY: 0
|
|
195
195
|
};
|
|
196
196
|
I(E);
|
|
197
197
|
}
|
|
198
|
-
const H =
|
|
199
|
-
let x, Q, A, B = !1,
|
|
198
|
+
const H = u.segment.end - u.segment.start, W = u.segment.type || u.track.type, J = ke(F), w = J >= 0 ? J : u.trackIndex, L = f.value[w];
|
|
199
|
+
let x, Q, A, B = !1, ne, R = !0;
|
|
200
200
|
if (L && L.type === W) {
|
|
201
201
|
const E = te(F);
|
|
202
|
-
E ? (B = !0,
|
|
202
|
+
E ? (B = !0, ne = E.insertIndex, x = E.insertIndex, Q = E.insertIndex, A = u.track.id, R = !0) : (x = w, Q = w, A = L.id, R = !0);
|
|
203
203
|
} else if (!s.value)
|
|
204
|
-
x =
|
|
204
|
+
x = u.trackIndex, Q = w, A = u.track.id, R = !1;
|
|
205
205
|
else {
|
|
206
|
-
const E = s.value.getBoundingClientRect(),
|
|
207
|
-
B = !0,
|
|
206
|
+
const E = s.value.getBoundingClientRect(), de = F - E.top, ce = o.value + i.value, me = w * ce + o.value / 2, ve = de < me;
|
|
207
|
+
B = !0, ne = ve ? w : w + 1, x = ne, Q = w, A = u.track.id, R = !0;
|
|
208
208
|
}
|
|
209
|
-
const
|
|
210
|
-
segment:
|
|
211
|
-
track:
|
|
212
|
-
trackIndex:
|
|
213
|
-
segmentIndex:
|
|
209
|
+
const Te = h(u.segment.start + ue / Math.max(b.value, 1e-4)), j = Math.max(0, Te), Ie = j + H, se = {
|
|
210
|
+
segment: u.segment,
|
|
211
|
+
track: u.track,
|
|
212
|
+
trackIndex: u.trackIndex,
|
|
213
|
+
segmentIndex: u.segmentIndex,
|
|
214
214
|
startTime: j,
|
|
215
215
|
endTime: Ie,
|
|
216
216
|
targetTrackIndex: x,
|
|
217
217
|
targetTrackId: A,
|
|
218
218
|
isNewTrack: B,
|
|
219
|
-
newTrackInsertIndex:
|
|
219
|
+
newTrackInsertIndex: ne,
|
|
220
220
|
visualTrackIndex: Q,
|
|
221
221
|
isValidTarget: R,
|
|
222
222
|
mouseDeltaY: O
|
|
223
223
|
};
|
|
224
|
-
v.moved && (
|
|
224
|
+
v.moved && (d.value = se, $ === "drag" ? r(se) : $ === "end" && p(se));
|
|
225
225
|
}
|
|
226
226
|
function S(v) {
|
|
227
227
|
g.value && re(g.value, v.clientX, v.clientY, "drag");
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
g.value && (re(g.value, v.clientX, v.clientY, "end"), g.value = null,
|
|
229
|
+
function T(v) {
|
|
230
|
+
g.value && (re(g.value, v.clientX, v.clientY, "end"), g.value = null, d.value = null);
|
|
231
231
|
}
|
|
232
232
|
return {
|
|
233
233
|
// State
|
|
234
234
|
draggingState: g,
|
|
235
|
-
dragPreview:
|
|
235
|
+
dragPreview: d,
|
|
236
236
|
snapGuides: oe,
|
|
237
237
|
// Methods
|
|
238
238
|
startDrag: ie,
|
|
239
239
|
handleDragMove: S,
|
|
240
|
-
handleDragEnd:
|
|
240
|
+
handleDragEnd: T
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
|
-
const rt = { class: "ve-timeline" },
|
|
243
|
+
const rt = { class: "ve-timeline" }, ut = { class: "ve-track__body" }, dt = ["onMousedown", "onClick"], ct = { class: "ve-segment__content" }, mt = { class: "ve-segment__title" }, vt = { class: "ve-segment__time" }, ft = {
|
|
244
244
|
key: 0,
|
|
245
245
|
class: "ve-segment__selection"
|
|
246
|
-
}, gt = ["onMousedown"], ht = ["onMousedown"], pt = { class: "ve-segment__content" }, xt = { class: "ve-segment__title" }, kt = { class: "ve-segment__time" }, _t = 120, Ee = 10,
|
|
246
|
+
}, gt = ["onMousedown"], ht = ["onMousedown"], pt = { class: "ve-segment__content" }, xt = { class: "ve-segment__title" }, kt = { class: "ve-segment__time" }, _t = 120, Ee = 10, bt = /* @__PURE__ */ pe({
|
|
247
247
|
name: "VideoTimeline",
|
|
248
248
|
__name: "index",
|
|
249
249
|
props: {
|
|
@@ -264,46 +264,46 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
264
264
|
},
|
|
265
265
|
emits: ["update:currentTime", "update:zoom", "segmentClick", "segmentDragStart", "segmentDrag", "segmentDragEnd", "segmentResizeStart", "segmentResize", "segmentResizeEnd", "backgroundClick"],
|
|
266
266
|
setup(l, { emit: f }) {
|
|
267
|
-
const s = l, o = f, i = z(null),
|
|
267
|
+
const s = l, o = f, i = z(null), b = z(null), Z = z(null), h = z(0);
|
|
268
268
|
let I = null;
|
|
269
269
|
const r = z(B(s.zoom ?? s.minZoom)), p = z(!1);
|
|
270
270
|
fe(() => s.zoom, (e) => {
|
|
271
271
|
typeof e == "number" && (r.value = B(e));
|
|
272
272
|
}), fe(r, (e) => o("update:zoom", e));
|
|
273
|
-
const g =
|
|
273
|
+
const g = M(() => typeof s.duration == "number" ? Math.max(s.duration, 0) : Math.max(
|
|
274
274
|
0,
|
|
275
275
|
...s.tracks.flatMap(
|
|
276
|
-
(
|
|
276
|
+
(a) => a.segments.map((t) => t.end)
|
|
277
277
|
)
|
|
278
278
|
));
|
|
279
|
-
fe(g, (e,
|
|
280
|
-
if (!
|
|
279
|
+
fe(g, (e, a) => {
|
|
280
|
+
if (!a || !e || a <= 0 || e <= 0 || !p.value || !h.value)
|
|
281
281
|
return;
|
|
282
|
-
const t = h.value * r.value /
|
|
282
|
+
const t = h.value * r.value / a;
|
|
283
283
|
if (!Number.isFinite(t) || t <= 0)
|
|
284
284
|
return;
|
|
285
|
-
const
|
|
286
|
-
Math.abs(
|
|
285
|
+
const n = B(t * e / h.value);
|
|
286
|
+
Math.abs(n - r.value) > 1e-6 && (r.value = n);
|
|
287
287
|
});
|
|
288
|
-
const
|
|
288
|
+
const d = M(() => {
|
|
289
289
|
const e = Math.max(g.value, 1);
|
|
290
290
|
return Math.max(h.value, 1) * r.value / e;
|
|
291
|
-
}), te =
|
|
292
|
-
const e = g.value *
|
|
293
|
-
return Math.max(Math.ceil(
|
|
294
|
-
}), ke =
|
|
295
|
-
const e = Math.max(
|
|
291
|
+
}), te = M(() => {
|
|
292
|
+
const e = g.value * d.value, a = Number.isFinite(e) ? Math.max(e, 0) : 0;
|
|
293
|
+
return Math.max(Math.ceil(a), Math.ceil(h.value || 0));
|
|
294
|
+
}), ke = M(() => {
|
|
295
|
+
const e = Math.max(d.value, 1e-4), t = (te.value || h.value || 0) / e;
|
|
296
296
|
return Math.max(g.value, t);
|
|
297
|
-
}), oe =
|
|
297
|
+
}), oe = M(() => s.currentTime * d.value), ie = M(() => Te(ke.value, d.value)), re = M(() => 1e3 / Math.max(s.fps || 30, 1)), S = M(() => s.trackHeight), T = M(() => s.trackGap), v = M(() => s.rulerHeight), q = M(() => s.tracks.map((e, a) => ({
|
|
298
298
|
track: e,
|
|
299
|
-
trackIndex:
|
|
300
|
-
segments: e.segments.map((t,
|
|
301
|
-
const m = Math.max((t.end - t.start) *
|
|
299
|
+
trackIndex: a,
|
|
300
|
+
segments: e.segments.map((t, n) => {
|
|
301
|
+
const m = Math.max((t.end - t.start) * d.value, 6), C = t.start * d.value;
|
|
302
302
|
return {
|
|
303
303
|
track: e,
|
|
304
|
-
trackIndex:
|
|
304
|
+
trackIndex: a,
|
|
305
305
|
segment: t,
|
|
306
|
-
segmentIndex:
|
|
306
|
+
segmentIndex: n,
|
|
307
307
|
left: C,
|
|
308
308
|
width: m,
|
|
309
309
|
isSelected: s.selectedSegmentId === t.id
|
|
@@ -312,16 +312,16 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
312
312
|
}))), {
|
|
313
313
|
draggingState: F,
|
|
314
314
|
dragPreview: $,
|
|
315
|
-
snapGuides:
|
|
315
|
+
snapGuides: u,
|
|
316
316
|
startDrag: _e,
|
|
317
|
-
handleDragMove:
|
|
318
|
-
handleDragEnd:
|
|
317
|
+
handleDragMove: be,
|
|
318
|
+
handleDragEnd: ue
|
|
319
319
|
} = it({
|
|
320
320
|
tracks: Re(s, "tracks"),
|
|
321
321
|
tracksRef: Z,
|
|
322
322
|
trackHeightPx: S,
|
|
323
|
-
trackGapPx:
|
|
324
|
-
pixelsPerMs:
|
|
323
|
+
trackGapPx: T,
|
|
324
|
+
pixelsPerMs: d,
|
|
325
325
|
disableInteraction: Re(s, "disableInteraction"),
|
|
326
326
|
snap: j,
|
|
327
327
|
onDragStart: (e) => {
|
|
@@ -333,29 +333,29 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
333
333
|
onDragEnd: (e) => {
|
|
334
334
|
o("segmentDragEnd", e);
|
|
335
335
|
}
|
|
336
|
-
}), O = z(null), Y =
|
|
336
|
+
}), O = z(null), Y = M(() => $.value), H = M(() => O.value), W = z(null), J = z(!1), w = z(!1), L = z(!1), x = M(() => {
|
|
337
337
|
if (!$.value)
|
|
338
338
|
return null;
|
|
339
339
|
const e = $.value, t = q.value.find((y) => y.track.id === e.track.id)?.segments.find((y) => y.segment.id === e.segment.id);
|
|
340
340
|
if (!t)
|
|
341
341
|
return null;
|
|
342
|
-
const
|
|
342
|
+
const n = (e.startTime - e.segment.start) * d.value, C = v.value + e.trackIndex * (S.value + T.value) + T.value + e.mouseDeltaY;
|
|
343
343
|
return {
|
|
344
344
|
...t,
|
|
345
|
-
left: t.left +
|
|
345
|
+
left: t.left + n,
|
|
346
346
|
top: C
|
|
347
347
|
};
|
|
348
|
-
}), Q =
|
|
348
|
+
}), Q = M(() => {
|
|
349
349
|
if (!$.value)
|
|
350
350
|
return 0;
|
|
351
351
|
const e = $.value;
|
|
352
|
-
return e.isNewTrack && e.newTrackInsertIndex === 0 ? v.value +
|
|
352
|
+
return e.isNewTrack && e.newTrackInsertIndex === 0 ? v.value + T.value : v.value + e.targetTrackIndex * (S.value + T.value) + T.value;
|
|
353
353
|
});
|
|
354
354
|
Pe(() => {
|
|
355
355
|
i.value && (I = new ResizeObserver((e) => {
|
|
356
|
-
const
|
|
357
|
-
h.value =
|
|
358
|
-
}), I.observe(i.value), h.value = i.value.clientWidth || 0), window.addEventListener("mousemove", me), window.addEventListener("mouseup", ve),
|
|
356
|
+
const a = e[0];
|
|
357
|
+
h.value = a?.contentRect.width || i.value?.clientWidth || 0;
|
|
358
|
+
}), I.observe(i.value), h.value = i.value.clientWidth || 0), window.addEventListener("mousemove", me), window.addEventListener("mouseup", ve), ne();
|
|
359
359
|
}), Ge(() => {
|
|
360
360
|
I?.disconnect(), I = null, window.removeEventListener("mousemove", me), window.removeEventListener("mouseup", ve);
|
|
361
361
|
}), fe(r, () => {
|
|
@@ -365,13 +365,13 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
365
365
|
const e = i.value;
|
|
366
366
|
if (!e)
|
|
367
367
|
return;
|
|
368
|
-
const
|
|
368
|
+
const a = e.clientWidth / 2, t = s.currentTime * d.value - a;
|
|
369
369
|
e.scrollLeft = Math.max(0, t);
|
|
370
370
|
}
|
|
371
371
|
function B(e) {
|
|
372
372
|
return Number.isFinite(e) ? Math.min(Math.max(e, s.minZoom), s.maxZoom) : s.minZoom;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function ne() {
|
|
375
375
|
if (p.value)
|
|
376
376
|
return;
|
|
377
377
|
if (s.zoom !== void 0) {
|
|
@@ -384,19 +384,19 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
384
384
|
r.value = e, p.value = !0;
|
|
385
385
|
}
|
|
386
386
|
function R(e) {
|
|
387
|
-
const
|
|
388
|
-
return `${
|
|
387
|
+
const a = Math.max(e, 0), t = Math.floor(a / 1e3), n = Math.floor(t / 60).toString().padStart(2, "0"), m = (t % 60).toString().padStart(2, "0"), C = Math.floor(a % 1e3 / 10).toString().padStart(2, "0");
|
|
388
|
+
return `${n}:${m}.${C}`;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
391
|
-
const
|
|
392
|
-
return `${
|
|
390
|
+
function Me(e) {
|
|
391
|
+
const a = Math.max(e, 0), t = Math.floor(a / 1e3), n = Math.floor(t / 60).toString().padStart(2, "0"), m = (t % 60).toString().padStart(2, "0");
|
|
392
|
+
return `${n}:${m}`;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
if (!e || !
|
|
394
|
+
function Te(e, a) {
|
|
395
|
+
if (!e || !a)
|
|
396
396
|
return [];
|
|
397
|
-
const t = Ze(
|
|
397
|
+
const t = Ze(a, s.fps || 30), n = Math.max(1, Math.round(t.mainMs / t.minorMs)), m = Math.max(e, 1), C = Math.ceil(m / t.minorMs), y = [];
|
|
398
398
|
for (let X = 0; X <= C; X += 1) {
|
|
399
|
-
const P = Math.min(m, X * t.minorMs), N = P *
|
|
399
|
+
const P = Math.min(m, X * t.minorMs), N = P * a, U = X % n === 0;
|
|
400
400
|
y.push({
|
|
401
401
|
position: N,
|
|
402
402
|
timeMs: P,
|
|
@@ -407,64 +407,64 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
407
407
|
return y;
|
|
408
408
|
}
|
|
409
409
|
function j(e) {
|
|
410
|
-
const
|
|
410
|
+
const a = s.snapStep, t = a && a > 0 ? a : re.value;
|
|
411
411
|
return Math.max(Math.round(e / t) * t, 0);
|
|
412
412
|
}
|
|
413
413
|
function Ie(e) {
|
|
414
|
-
if (!
|
|
414
|
+
if (!b.value)
|
|
415
415
|
return;
|
|
416
416
|
if (L.value) {
|
|
417
417
|
L.value = !1;
|
|
418
418
|
return;
|
|
419
419
|
}
|
|
420
|
-
const
|
|
421
|
-
o("update:currentTime",
|
|
420
|
+
const a = b.value.getBoundingClientRect(), t = e.clientX - a.left, n = j(t / Math.max(d.value, 1e-4));
|
|
421
|
+
o("update:currentTime", n), o("backgroundClick", e), w.value = !0;
|
|
422
422
|
}
|
|
423
423
|
function se(e) {
|
|
424
424
|
s.disableInteraction || (e.preventDefault(), J.value = !0, w.value = !0, E(e.clientX), A());
|
|
425
425
|
}
|
|
426
426
|
function E(e) {
|
|
427
|
-
if (!
|
|
427
|
+
if (!b.value)
|
|
428
428
|
return;
|
|
429
|
-
const
|
|
430
|
-
o("update:currentTime",
|
|
429
|
+
const a = b.value.getBoundingClientRect(), t = e - a.left, n = j(t / Math.max(d.value, 1e-4));
|
|
430
|
+
o("update:currentTime", n);
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function de(e, a, t) {
|
|
433
433
|
if (s.disableInteraction)
|
|
434
434
|
return;
|
|
435
435
|
t.stopPropagation(), t.preventDefault(), W.value = {
|
|
436
436
|
layout: e,
|
|
437
|
-
edge:
|
|
437
|
+
edge: a,
|
|
438
438
|
initialX: t.clientX
|
|
439
439
|
};
|
|
440
|
-
const
|
|
440
|
+
const n = {
|
|
441
441
|
segment: e.segment,
|
|
442
442
|
track: e.track,
|
|
443
443
|
trackIndex: e.trackIndex,
|
|
444
444
|
segmentIndex: e.segmentIndex,
|
|
445
445
|
startTime: e.segment.start,
|
|
446
446
|
endTime: e.segment.end,
|
|
447
|
-
edge:
|
|
447
|
+
edge: a
|
|
448
448
|
};
|
|
449
|
-
O.value =
|
|
449
|
+
O.value = n, o("segmentResizeStart", n);
|
|
450
450
|
}
|
|
451
|
-
function ce(e,
|
|
452
|
-
const { layout:
|
|
453
|
-
let N =
|
|
454
|
-
m === "start" ? (N = j(Math.max(0,
|
|
455
|
-
const
|
|
456
|
-
segment:
|
|
457
|
-
track:
|
|
458
|
-
trackIndex:
|
|
459
|
-
segmentIndex:
|
|
451
|
+
function ce(e, a, t) {
|
|
452
|
+
const { layout: n, edge: m, initialX: C } = e, X = (a - C) / Math.max(d.value, 1e-4), P = Math.max(s.minSegmentDuration, 10);
|
|
453
|
+
let N = n.segment.start, U = n.segment.end;
|
|
454
|
+
m === "start" ? (N = j(Math.max(0, n.segment.start + X)), n.segment.end - N < P && (N = n.segment.end - P)) : U = j(Math.max(n.segment.start + P, n.segment.end + X));
|
|
455
|
+
const ae = {
|
|
456
|
+
segment: n.segment,
|
|
457
|
+
track: n.track,
|
|
458
|
+
trackIndex: n.trackIndex,
|
|
459
|
+
segmentIndex: n.segmentIndex,
|
|
460
460
|
startTime: N,
|
|
461
461
|
endTime: U,
|
|
462
462
|
edge: m
|
|
463
463
|
};
|
|
464
|
-
O.value =
|
|
464
|
+
O.value = ae, t === "drag" ? o("segmentResize", ae) : t === "end" && o("segmentResizeEnd", ae);
|
|
465
465
|
}
|
|
466
|
-
function we(e,
|
|
467
|
-
F.value?.layout.segment.id === e.segment.id && F.value.moved || o("segmentClick", e,
|
|
466
|
+
function we(e, a) {
|
|
467
|
+
F.value?.layout.segment.id === e.segment.id && F.value.moved || o("segmentClick", e, a);
|
|
468
468
|
}
|
|
469
469
|
function me(e) {
|
|
470
470
|
if (J.value) {
|
|
@@ -475,7 +475,7 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
475
475
|
ce(W.value, e.clientX, "drag");
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
|
|
478
|
+
be(e);
|
|
479
479
|
}
|
|
480
480
|
function ve(e) {
|
|
481
481
|
if (J.value) {
|
|
@@ -490,10 +490,10 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
490
490
|
if (F.value.moved)
|
|
491
491
|
L.value = !0;
|
|
492
492
|
else {
|
|
493
|
-
const { layout:
|
|
494
|
-
we(
|
|
493
|
+
const { layout: a } = F.value;
|
|
494
|
+
we(a, e);
|
|
495
495
|
}
|
|
496
|
-
|
|
496
|
+
ue(e), w.value = !1;
|
|
497
497
|
}
|
|
498
498
|
function Ce() {
|
|
499
499
|
r.value = B(r.value * 1.25);
|
|
@@ -501,24 +501,24 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
501
501
|
function De() {
|
|
502
502
|
r.value = B(r.value / 1.25);
|
|
503
503
|
}
|
|
504
|
-
function Ze(e,
|
|
505
|
-
const
|
|
504
|
+
function Ze(e, a) {
|
|
505
|
+
const n = 1e3 / (Number.isFinite(a) && a > 0 ? a : 30), m = e * n, C = Xe(n), y = Fe(n), X = m >= Ee ? [...y, ...C] : C;
|
|
506
506
|
let P = null, N = 1 / 0;
|
|
507
507
|
for (const U of X) {
|
|
508
|
-
const
|
|
509
|
-
if (
|
|
508
|
+
const ae = U.mainMs * e;
|
|
509
|
+
if (ae < Ee)
|
|
510
510
|
continue;
|
|
511
|
-
const ze = Math.abs(
|
|
511
|
+
const ze = Math.abs(ae - _t);
|
|
512
512
|
ze < N && (P = U, N = ze);
|
|
513
513
|
}
|
|
514
514
|
return P || X[X.length - 1] || y[y.length - 1];
|
|
515
515
|
}
|
|
516
516
|
function Xe(e) {
|
|
517
517
|
return [600, 300, 180, 120, 60, 30, 20, 15, 10, 5, 3, 2, 1].map((t) => {
|
|
518
|
-
const
|
|
518
|
+
const n = t * 1e3;
|
|
519
519
|
return {
|
|
520
|
-
mainMs:
|
|
521
|
-
minorMs: Math.max(
|
|
520
|
+
mainMs: n,
|
|
521
|
+
minorMs: Math.max(n / 10, e),
|
|
522
522
|
mode: "time",
|
|
523
523
|
label: "time"
|
|
524
524
|
};
|
|
@@ -546,14 +546,14 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
546
546
|
}
|
|
547
547
|
];
|
|
548
548
|
}
|
|
549
|
-
function Be(e,
|
|
549
|
+
function Be(e, a, t) {
|
|
550
550
|
if (t.label === "frame") {
|
|
551
|
-
const
|
|
552
|
-
return y === 0 ?
|
|
551
|
+
const n = Number.isFinite(a) && a > 0 ? a : 30, m = 1e3 / n, y = Math.round(e / m) % n;
|
|
552
|
+
return y === 0 ? Me(e) : `${y}f`;
|
|
553
553
|
}
|
|
554
|
-
return
|
|
554
|
+
return Me(e);
|
|
555
555
|
}
|
|
556
|
-
return (e,
|
|
556
|
+
return (e, a) => (_(), k("div", rt, [
|
|
557
557
|
V(e.$slots, "toolbar", {
|
|
558
558
|
zoom: r.value,
|
|
559
559
|
canZoomIn: r.value < l.maxZoom,
|
|
@@ -583,13 +583,13 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
583
583
|
}, [
|
|
584
584
|
c("div", {
|
|
585
585
|
ref_key: "contentRef",
|
|
586
|
-
ref:
|
|
586
|
+
ref: b,
|
|
587
587
|
class: "ve-timeline__content",
|
|
588
588
|
style: D({ width: `${te.value}px` })
|
|
589
589
|
}, [
|
|
590
590
|
V(e.$slots, "ruler", {
|
|
591
591
|
ticks: ie.value,
|
|
592
|
-
pixelsPerMs:
|
|
592
|
+
pixelsPerMs: d.value
|
|
593
593
|
}, () => [
|
|
594
594
|
ye(je, {
|
|
595
595
|
ticks: ie.value,
|
|
@@ -610,7 +610,7 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
610
610
|
ref_key: "tracksRef",
|
|
611
611
|
ref: Z,
|
|
612
612
|
class: "ve-timeline__tracks",
|
|
613
|
-
style: D({ gap: `${
|
|
613
|
+
style: D({ gap: `${T.value}px`, paddingTop: `${T.value}px` })
|
|
614
614
|
}, [
|
|
615
615
|
(_(!0), k(ge, null, he(q.value, (t) => (_(), k("div", {
|
|
616
616
|
key: t.track.id,
|
|
@@ -621,50 +621,50 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
621
621
|
track: t.track,
|
|
622
622
|
index: t.trackIndex,
|
|
623
623
|
segments: t.segments,
|
|
624
|
-
pixelsPerMs:
|
|
624
|
+
pixelsPerMs: d.value,
|
|
625
625
|
height: S.value
|
|
626
626
|
}, () => [
|
|
627
|
-
c("div",
|
|
628
|
-
(_(!0), k(ge, null, he(t.segments, (
|
|
629
|
-
key:
|
|
627
|
+
c("div", ut, [
|
|
628
|
+
(_(!0), k(ge, null, he(t.segments, (n) => Ve((_(), k("div", {
|
|
629
|
+
key: n.segment.id,
|
|
630
630
|
class: $e(["ve-segment", {
|
|
631
|
-
"ve-segment--selected":
|
|
631
|
+
"ve-segment--selected": n.isSelected
|
|
632
632
|
}]),
|
|
633
633
|
style: D({
|
|
634
|
-
left: `${
|
|
635
|
-
width: `${
|
|
636
|
-
backgroundColor:
|
|
634
|
+
left: `${n.left}px`,
|
|
635
|
+
width: `${n.width}px`,
|
|
636
|
+
backgroundColor: n.segment.color || t.track.color || "var(--ve-primary)"
|
|
637
637
|
}),
|
|
638
|
-
onMousedown: le((m) => K(_e)(
|
|
639
|
-
onClick: le((m) => we(
|
|
638
|
+
onMousedown: le((m) => K(_e)(n, m), ["prevent", "stop"]),
|
|
639
|
+
onClick: le((m) => we(n, m), ["stop"])
|
|
640
640
|
}, [
|
|
641
641
|
V(e.$slots, "segment", {
|
|
642
|
-
layout:
|
|
643
|
-
segment:
|
|
644
|
-
track:
|
|
645
|
-
isSelected:
|
|
642
|
+
layout: n,
|
|
643
|
+
segment: n.segment,
|
|
644
|
+
track: n.track,
|
|
645
|
+
isSelected: n.isSelected
|
|
646
646
|
}, () => [
|
|
647
647
|
c("div", ct, [
|
|
648
|
-
c("div", mt, G(
|
|
649
|
-
c("div", vt, G(R(
|
|
648
|
+
c("div", mt, G(n.segment.type || "segment"), 1),
|
|
649
|
+
c("div", vt, G(R(n.segment.start)) + " - " + G(R(n.segment.end)), 1)
|
|
650
650
|
])
|
|
651
651
|
], !0),
|
|
652
|
-
|
|
652
|
+
n.isSelected ? (_(), k("div", ft, [
|
|
653
653
|
c("div", {
|
|
654
654
|
class: "ve-segment__handle ve-segment__handle--left",
|
|
655
|
-
onMousedown: le((m) =>
|
|
656
|
-
}, [...
|
|
657
|
-
Se('<div class="ve-segment__handle-dots" data-v-
|
|
655
|
+
onMousedown: le((m) => de(n, "start", m), ["stop"])
|
|
656
|
+
}, [...a[0] || (a[0] = [
|
|
657
|
+
Se('<div class="ve-segment__handle-dots" data-v-553c608f><div class="ve-segment__handle-dot" data-v-553c608f></div><div class="ve-segment__handle-dot" data-v-553c608f></div><div class="ve-segment__handle-dot" data-v-553c608f></div><div class="ve-segment__handle-dot" data-v-553c608f></div></div>', 1)
|
|
658
658
|
])], 40, gt),
|
|
659
659
|
c("div", {
|
|
660
660
|
class: "ve-segment__handle ve-segment__handle--right",
|
|
661
|
-
onMousedown: le((m) =>
|
|
662
|
-
}, [...
|
|
663
|
-
Se('<div class="ve-segment__handle-dots" data-v-
|
|
661
|
+
onMousedown: le((m) => de(n, "end", m), ["stop"])
|
|
662
|
+
}, [...a[1] || (a[1] = [
|
|
663
|
+
Se('<div class="ve-segment__handle-dots" data-v-553c608f><div class="ve-segment__handle-dot" data-v-553c608f></div><div class="ve-segment__handle-dot" data-v-553c608f></div><div class="ve-segment__handle-dot" data-v-553c608f></div><div class="ve-segment__handle-dot" data-v-553c608f></div></div>', 1)
|
|
664
664
|
])], 40, ht)
|
|
665
665
|
])) : ee("", !0)
|
|
666
|
-
], 46,
|
|
667
|
-
[Le, K($)?.segment.id !==
|
|
666
|
+
], 46, dt)), [
|
|
667
|
+
[Le, K($)?.segment.id !== n.segment.id && O.value?.segment.id !== n.segment.id]
|
|
668
668
|
])), 128))
|
|
669
669
|
])
|
|
670
670
|
], !0)
|
|
@@ -697,8 +697,8 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
697
697
|
key: 1,
|
|
698
698
|
class: "ve-segment ve-segment--placeholder",
|
|
699
699
|
style: D({
|
|
700
|
-
left: `${Y.value.startTime *
|
|
701
|
-
width: `${(Y.value.endTime - Y.value.startTime) *
|
|
700
|
+
left: `${Y.value.startTime * d.value}px`,
|
|
701
|
+
width: `${(Y.value.endTime - Y.value.startTime) * d.value}px`,
|
|
702
702
|
top: `${Q.value}px`,
|
|
703
703
|
height: `${S.value}px`
|
|
704
704
|
})
|
|
@@ -714,14 +714,14 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
714
714
|
key: 2,
|
|
715
715
|
class: "ve-segment ve-segment--preview",
|
|
716
716
|
style: D({
|
|
717
|
-
left: `${H.value.startTime *
|
|
718
|
-
width: `${(H.value.endTime - H.value.startTime) *
|
|
719
|
-
top: `${v.value + H.value.trackIndex * (S.value +
|
|
717
|
+
left: `${H.value.startTime * d.value}px`,
|
|
718
|
+
width: `${(H.value.endTime - H.value.startTime) * d.value}px`,
|
|
719
|
+
top: `${v.value + H.value.trackIndex * (S.value + T.value) + T.value}px`,
|
|
720
720
|
height: `${S.value}px`,
|
|
721
721
|
backgroundColor: H.value.segment.color || "var(--ve-primary)"
|
|
722
722
|
})
|
|
723
723
|
}, null, 4)) : ee("", !0),
|
|
724
|
-
K($) && K(
|
|
724
|
+
K($) && K(u).length ? (_(!0), k(ge, { key: 3 }, he(K(u), (t) => (_(), k("div", {
|
|
725
725
|
key: `snap-${t.time}`,
|
|
726
726
|
class: "ve-snap-guide",
|
|
727
727
|
style: D({
|
|
@@ -734,7 +734,7 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
734
734
|
key: 4,
|
|
735
735
|
class: "ve-new-track-line",
|
|
736
736
|
style: D({
|
|
737
|
-
top: `${v.value + K($).targetTrackIndex * (S.value +
|
|
737
|
+
top: `${v.value + K($).targetTrackIndex * (S.value + T.value)}px`,
|
|
738
738
|
left: "0",
|
|
739
739
|
right: "0"
|
|
740
740
|
})
|
|
@@ -743,8 +743,8 @@ const rt = { class: "ve-timeline" }, dt = { class: "ve-track__body" }, ut = ["on
|
|
|
743
743
|
], 512)
|
|
744
744
|
]));
|
|
745
745
|
}
|
|
746
|
-
}),
|
|
746
|
+
}), Tt = /* @__PURE__ */ xe(bt, [["__scopeId", "data-v-553c608f"]]);
|
|
747
747
|
export {
|
|
748
|
-
|
|
748
|
+
Tt as V,
|
|
749
749
|
xe as _
|
|
750
750
|
};
|