@molecule/app-feature-video-timeline-angular 0.0.0-stage → 1.1.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/LICENSE +202 -0
- package/README.md +600 -2
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/timeline.d.ts +89 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +148 -0
- package/dist/timeline.js.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/video-timeline.component.d.ts +420 -0
- package/dist/video-timeline.component.d.ts.map +1 -0
- package/dist/video-timeline.component.js +781 -0
- package/dist/video-timeline.component.js.map +1 -0
- package/package.json +77 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular multi-track video timeline for video editors, DAWs and animation
|
|
3
|
+
* tools. Composes one `<TrackLane>` per track row with a shared time ruler,
|
|
4
|
+
* playhead, zoom slider + Ctrl+wheel zoom, and ripple/insert edit modes.
|
|
5
|
+
*
|
|
6
|
+
* Angular counterpart of `@molecule/app-feature-video-timeline-react`: the
|
|
7
|
+
* same props (React names), the same DOM for the same input, and the same
|
|
8
|
+
* callback calls, so an app switches framework by changing only the package
|
|
9
|
+
* name it imports.
|
|
10
|
+
*
|
|
11
|
+
* Exports `VideoTimeline`, the `Track` and `VideoTimelineMode` types,
|
|
12
|
+
* and the pure-function helpers `clampZoom`, `zoomFromWheelDelta`,
|
|
13
|
+
* `computeRulerTicks`, `computeRippleUpdates`, and `formatTickTime`
|
|
14
|
+
* that back the zoom math, ruler tick generation, and ripple-mode
|
|
15
|
+
* fan-out.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { Component, signal } from '@angular/core'
|
|
20
|
+
* import { VideoTimeline } from '@molecule/app-feature-video-timeline-angular'
|
|
21
|
+
*
|
|
22
|
+
* @Component({
|
|
23
|
+
* selector: 'app-editor',
|
|
24
|
+
* standalone: true,
|
|
25
|
+
* imports: [VideoTimeline],
|
|
26
|
+
* template: `
|
|
27
|
+
* <div
|
|
28
|
+
* mol-video-timeline
|
|
29
|
+
* [tracks]="tracks"
|
|
30
|
+
* [currentTime]="currentTime()"
|
|
31
|
+
* [duration]="60"
|
|
32
|
+
* [pixelsPerSecond]="zoom()"
|
|
33
|
+
* mode="ripple"
|
|
34
|
+
* [onSeek]="seek"
|
|
35
|
+
* ></div>
|
|
36
|
+
* `,
|
|
37
|
+
* })
|
|
38
|
+
* export class Editor {
|
|
39
|
+
* readonly currentTime = signal(3.2)
|
|
40
|
+
* readonly zoom = signal(20)
|
|
41
|
+
* readonly tracks = [
|
|
42
|
+
* {
|
|
43
|
+
* id: 'v1',
|
|
44
|
+
* kind: 'video',
|
|
45
|
+
* clips: [{ id: 'a', startTime: 0, duration: 5, label: 'Intro' }],
|
|
46
|
+
* },
|
|
47
|
+
* {
|
|
48
|
+
* id: 'a1',
|
|
49
|
+
* kind: 'audio',
|
|
50
|
+
* clips: [{ id: 'b', startTime: 0, duration: 12 }],
|
|
51
|
+
* },
|
|
52
|
+
* ]
|
|
53
|
+
*
|
|
54
|
+
* seek = (time: number): void => {
|
|
55
|
+
* this.currentTime.set(time)
|
|
56
|
+
* }
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* - The host IS React's root `<div>` — render `div[mol-video-timeline]` and
|
|
62
|
+
* bind the React-named inputs (`[onSeek]`, `[onClipMove]`, … take functions).
|
|
63
|
+
* - Requires a bonded ClassMap (`cm.flex`, `cm.cn`, …) and the binding's i18n
|
|
64
|
+
* provider for the translated labels — rendering throws without a ClassMap.
|
|
65
|
+
* - Ripple mode (default) shifts all later clips on the same lane by the same
|
|
66
|
+
* delta when a clip is dragged, preserving inter-clip gaps. Switch to
|
|
67
|
+
* `mode="insert"` to drop the dragged clip at its new position without
|
|
68
|
+
* disturbing the rest of the lane.
|
|
69
|
+
* - Every visible string comes from `useTranslation()` (`videoTimeline.aria.*`,
|
|
70
|
+
* `videoTimeline.trackKind.*`, `videoTimeline.mode.*`, `videoTimeline.zoom.*`),
|
|
71
|
+
* so a locale switch re-renders the timeline.
|
|
72
|
+
*
|
|
73
|
+
* @module
|
|
74
|
+
*/
|
|
75
|
+
export * from './timeline.js';
|
|
76
|
+
export * from './types.js';
|
|
77
|
+
export * from './video-timeline.component.js';
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,+BAA+B,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers of the video timeline: the same constants and the same math
|
|
3
|
+
* `@molecule/app-feature-video-timeline-react` exports — the zoom clamping,
|
|
4
|
+
* the Ctrl+wheel zoom step, the ruler tick generation, the ripple-mode
|
|
5
|
+
* fan-out and the tick time formatting.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { Clip } from '@molecule/app-feature-track-lane-angular';
|
|
10
|
+
/** Default horizontal scale. */
|
|
11
|
+
export declare const DEFAULT_PIXELS_PER_SECOND = 20;
|
|
12
|
+
/** Default lower zoom bound. */
|
|
13
|
+
export declare const DEFAULT_ZOOM_MIN = 2;
|
|
14
|
+
/** Default upper zoom bound. */
|
|
15
|
+
export declare const DEFAULT_ZOOM_MAX = 200;
|
|
16
|
+
/** Default per-track row height. */
|
|
17
|
+
export declare const DEFAULT_TRACK_HEIGHT = 44;
|
|
18
|
+
/** Default lane-header column width. */
|
|
19
|
+
export declare const DEFAULT_LANE_HEADER_WIDTH = 120;
|
|
20
|
+
/** Default ruler height. */
|
|
21
|
+
export declare const DEFAULT_RULER_HEIGHT = 28;
|
|
22
|
+
/** Multiplier per Ctrl+wheel notch (positive deltaY zooms out). */
|
|
23
|
+
export declare const ZOOM_WHEEL_FACTOR = 1.1;
|
|
24
|
+
/** Minimum spacing (px) between adjacent ruler ticks. */
|
|
25
|
+
export declare const MIN_TICK_PIXEL_SPACING = 60;
|
|
26
|
+
/**
|
|
27
|
+
* Clamp a candidate `pixelsPerSecond` value into `[min, max]`. Used by
|
|
28
|
+
* the zoom slider, Ctrl+wheel, and any external zoom button that calls
|
|
29
|
+
* `onZoomChange`.
|
|
30
|
+
*
|
|
31
|
+
* @param value - Candidate horizontal scale in px/sec.
|
|
32
|
+
* @param min - Lower bound (inclusive).
|
|
33
|
+
* @param max - Upper bound (inclusive).
|
|
34
|
+
* @returns The clamped value.
|
|
35
|
+
*/
|
|
36
|
+
export declare function clampZoom(value: number, min: number, max: number): number;
|
|
37
|
+
/**
|
|
38
|
+
* Compute the next zoom value for a Ctrl+wheel notch. Negative `deltaY`
|
|
39
|
+
* (scroll-up) zooms in; positive zooms out. Result is clamped into
|
|
40
|
+
* `[min, max]`.
|
|
41
|
+
*
|
|
42
|
+
* @param current - Current `pixelsPerSecond`.
|
|
43
|
+
* @param deltaY - Wheel `deltaY` (sign-only — magnitude is ignored).
|
|
44
|
+
* @param min - Lower zoom bound.
|
|
45
|
+
* @param max - Upper zoom bound.
|
|
46
|
+
* @returns The clamped next zoom value.
|
|
47
|
+
*/
|
|
48
|
+
export declare function zoomFromWheelDelta(current: number, deltaY: number, min: number, max: number): number;
|
|
49
|
+
/**
|
|
50
|
+
* Compute time tick marks for the ruler. Picks an interval (1, 2, 5, 10,
|
|
51
|
+
* 30, or 60 seconds, etc.) so that adjacent ticks are at least
|
|
52
|
+
* `MIN_TICK_PIXEL_SPACING` apart on screen. Always emits a tick at 0 and
|
|
53
|
+
* stops at the last tick `<= duration`.
|
|
54
|
+
*
|
|
55
|
+
* @param duration - Total duration in seconds.
|
|
56
|
+
* @param pixelsPerSecond - Horizontal scale.
|
|
57
|
+
* @returns Tick descriptors with `{ time, pixel }`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function computeRulerTicks(duration: number, pixelsPerSecond: number): {
|
|
60
|
+
time: number;
|
|
61
|
+
pixel: number;
|
|
62
|
+
}[];
|
|
63
|
+
/**
|
|
64
|
+
* Compute the ripple-mode update for a clip drag on a single lane.
|
|
65
|
+
* Returns one update per affected clip — at minimum the dragged clip,
|
|
66
|
+
* plus every clip whose original `startTime` is strictly greater (which
|
|
67
|
+
* shifts by the same `delta`).
|
|
68
|
+
*
|
|
69
|
+
* Negative deltas are clamped so no clip's `startTime` goes below 0
|
|
70
|
+
* (the dragged clip is the limiting factor — later clips can never
|
|
71
|
+
* cross zero before it does, since they all started later).
|
|
72
|
+
*
|
|
73
|
+
* @param clips - All clips on the lane (any order).
|
|
74
|
+
* @param draggedClipId - The id of the clip being dragged.
|
|
75
|
+
* @param proposedStartTime - The candidate new `startTime` for the dragged clip.
|
|
76
|
+
* @returns Array of `{ id, startTime }` updates to apply.
|
|
77
|
+
*/
|
|
78
|
+
export declare function computeRippleUpdates(clips: Clip[], draggedClipId: string, proposedStartTime: number): {
|
|
79
|
+
id: string;
|
|
80
|
+
startTime: number;
|
|
81
|
+
}[];
|
|
82
|
+
/**
|
|
83
|
+
* Format a tick time for the ruler — `mm:ss` over a minute, `s.s` below.
|
|
84
|
+
*
|
|
85
|
+
* @param seconds - Time in seconds.
|
|
86
|
+
* @returns Formatted string for the tick label.
|
|
87
|
+
*/
|
|
88
|
+
export declare function formatTickTime(seconds: number): string;
|
|
89
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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CAiBrC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOtD"}
|
package/dist/timeline.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers of the video timeline: the same constants and the same math
|
|
3
|
+
* `@molecule/app-feature-video-timeline-react` exports — the zoom clamping,
|
|
4
|
+
* the Ctrl+wheel zoom step, the ruler tick generation, the ripple-mode
|
|
5
|
+
* fan-out and the tick time formatting.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/** Default horizontal scale. */
|
|
10
|
+
export const DEFAULT_PIXELS_PER_SECOND = 20;
|
|
11
|
+
/** Default lower zoom bound. */
|
|
12
|
+
export const DEFAULT_ZOOM_MIN = 2;
|
|
13
|
+
/** Default upper zoom bound. */
|
|
14
|
+
export const DEFAULT_ZOOM_MAX = 200;
|
|
15
|
+
/** Default per-track row height. */
|
|
16
|
+
export const DEFAULT_TRACK_HEIGHT = 44;
|
|
17
|
+
/** Default lane-header column width. */
|
|
18
|
+
export const DEFAULT_LANE_HEADER_WIDTH = 120;
|
|
19
|
+
/** Default ruler height. */
|
|
20
|
+
export const DEFAULT_RULER_HEIGHT = 28;
|
|
21
|
+
/** Multiplier per Ctrl+wheel notch (positive deltaY zooms out). */
|
|
22
|
+
export const ZOOM_WHEEL_FACTOR = 1.1;
|
|
23
|
+
/** Minimum spacing (px) between adjacent ruler ticks. */
|
|
24
|
+
export const MIN_TICK_PIXEL_SPACING = 60;
|
|
25
|
+
/**
|
|
26
|
+
* Clamp a candidate `pixelsPerSecond` value into `[min, max]`. Used by
|
|
27
|
+
* the zoom slider, Ctrl+wheel, and any external zoom button that calls
|
|
28
|
+
* `onZoomChange`.
|
|
29
|
+
*
|
|
30
|
+
* @param value - Candidate horizontal scale in px/sec.
|
|
31
|
+
* @param min - Lower bound (inclusive).
|
|
32
|
+
* @param max - Upper bound (inclusive).
|
|
33
|
+
* @returns The clamped value.
|
|
34
|
+
*/
|
|
35
|
+
export function clampZoom(value, min, max) {
|
|
36
|
+
if (!Number.isFinite(value))
|
|
37
|
+
return min;
|
|
38
|
+
if (value < min)
|
|
39
|
+
return min;
|
|
40
|
+
if (value > max)
|
|
41
|
+
return max;
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Compute the next zoom value for a Ctrl+wheel notch. Negative `deltaY`
|
|
46
|
+
* (scroll-up) zooms in; positive zooms out. Result is clamped into
|
|
47
|
+
* `[min, max]`.
|
|
48
|
+
*
|
|
49
|
+
* @param current - Current `pixelsPerSecond`.
|
|
50
|
+
* @param deltaY - Wheel `deltaY` (sign-only — magnitude is ignored).
|
|
51
|
+
* @param min - Lower zoom bound.
|
|
52
|
+
* @param max - Upper zoom bound.
|
|
53
|
+
* @returns The clamped next zoom value.
|
|
54
|
+
*/
|
|
55
|
+
export function zoomFromWheelDelta(current, deltaY, min, max) {
|
|
56
|
+
if (deltaY === 0)
|
|
57
|
+
return clampZoom(current, min, max);
|
|
58
|
+
const factor = deltaY < 0 ? ZOOM_WHEEL_FACTOR : 1 / ZOOM_WHEEL_FACTOR;
|
|
59
|
+
return clampZoom(current * factor, min, max);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compute time tick marks for the ruler. Picks an interval (1, 2, 5, 10,
|
|
63
|
+
* 30, or 60 seconds, etc.) so that adjacent ticks are at least
|
|
64
|
+
* `MIN_TICK_PIXEL_SPACING` apart on screen. Always emits a tick at 0 and
|
|
65
|
+
* stops at the last tick `<= duration`.
|
|
66
|
+
*
|
|
67
|
+
* @param duration - Total duration in seconds.
|
|
68
|
+
* @param pixelsPerSecond - Horizontal scale.
|
|
69
|
+
* @returns Tick descriptors with `{ time, pixel }`.
|
|
70
|
+
*/
|
|
71
|
+
export function computeRulerTicks(duration, pixelsPerSecond) {
|
|
72
|
+
if (duration <= 0 || pixelsPerSecond <= 0)
|
|
73
|
+
return [{ time: 0, pixel: 0 }];
|
|
74
|
+
const targetPx = MIN_TICK_PIXEL_SPACING;
|
|
75
|
+
const minSecondsBetween = targetPx / pixelsPerSecond;
|
|
76
|
+
// 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 1800, 3600
|
|
77
|
+
const candidates = [0.1, 0.2, 0.5, 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 1800, 3600];
|
|
78
|
+
let interval = candidates[candidates.length - 1];
|
|
79
|
+
for (const c of candidates) {
|
|
80
|
+
if (c >= minSecondsBetween) {
|
|
81
|
+
interval = c;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const ticks = [];
|
|
86
|
+
// Use integer step counter to avoid floating-point drift.
|
|
87
|
+
let step = 0;
|
|
88
|
+
while (true) {
|
|
89
|
+
const time = step * interval;
|
|
90
|
+
if (time > duration + 1e-9)
|
|
91
|
+
break;
|
|
92
|
+
ticks.push({ time, pixel: time * pixelsPerSecond });
|
|
93
|
+
step += 1;
|
|
94
|
+
if (step > 10000)
|
|
95
|
+
break; // hard safety cap
|
|
96
|
+
}
|
|
97
|
+
return ticks;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Compute the ripple-mode update for a clip drag on a single lane.
|
|
101
|
+
* Returns one update per affected clip — at minimum the dragged clip,
|
|
102
|
+
* plus every clip whose original `startTime` is strictly greater (which
|
|
103
|
+
* shifts by the same `delta`).
|
|
104
|
+
*
|
|
105
|
+
* Negative deltas are clamped so no clip's `startTime` goes below 0
|
|
106
|
+
* (the dragged clip is the limiting factor — later clips can never
|
|
107
|
+
* cross zero before it does, since they all started later).
|
|
108
|
+
*
|
|
109
|
+
* @param clips - All clips on the lane (any order).
|
|
110
|
+
* @param draggedClipId - The id of the clip being dragged.
|
|
111
|
+
* @param proposedStartTime - The candidate new `startTime` for the dragged clip.
|
|
112
|
+
* @returns Array of `{ id, startTime }` updates to apply.
|
|
113
|
+
*/
|
|
114
|
+
export function computeRippleUpdates(clips, draggedClipId, proposedStartTime) {
|
|
115
|
+
const dragged = clips.find((c) => c.id === draggedClipId);
|
|
116
|
+
if (!dragged)
|
|
117
|
+
return [];
|
|
118
|
+
const clamped = proposedStartTime < 0 ? 0 : proposedStartTime;
|
|
119
|
+
const delta = clamped - dragged.startTime;
|
|
120
|
+
if (delta === 0) {
|
|
121
|
+
return [{ id: dragged.id, startTime: clamped }];
|
|
122
|
+
}
|
|
123
|
+
const updates = [{ id: dragged.id, startTime: clamped }];
|
|
124
|
+
for (const c of clips) {
|
|
125
|
+
if (c.id === dragged.id)
|
|
126
|
+
continue;
|
|
127
|
+
if (c.startTime > dragged.startTime) {
|
|
128
|
+
const next = c.startTime + delta;
|
|
129
|
+
updates.push({ id: c.id, startTime: next < 0 ? 0 : next });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return updates;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Format a tick time for the ruler — `mm:ss` over a minute, `s.s` below.
|
|
136
|
+
*
|
|
137
|
+
* @param seconds - Time in seconds.
|
|
138
|
+
* @returns Formatted string for the tick label.
|
|
139
|
+
*/
|
|
140
|
+
export function formatTickTime(seconds) {
|
|
141
|
+
if (seconds < 60) {
|
|
142
|
+
return seconds === Math.floor(seconds) ? `${seconds}s` : `${seconds.toFixed(1)}s`;
|
|
143
|
+
}
|
|
144
|
+
const m = Math.floor(seconds / 60);
|
|
145
|
+
const s = Math.floor(seconds - m * 60);
|
|
146
|
+
return `${m}:${s.toString().padStart(2, '0')}`;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.js","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,gCAAgC;AAChC,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAA;AAE3C,gCAAgC;AAChC,MAAM,CAAC,MAAM,gB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AAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAA;IACnF,CAAC;IACD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAA;IAClC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC,CAAA;IACtC,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;AAChD,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of `@molecule/app-feature-video-timeline-angular` — the Angular
|
|
3
|
+
* counterpart of `@molecule/app-feature-video-timeline-react`, same props and
|
|
4
|
+
* DOM.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { Clip } from '@molecule/app-feature-track-lane-angular';
|
|
9
|
+
/**
|
|
10
|
+
* The kind of media a track holds. Drives the lane name fallback,
|
|
11
|
+
* the default clip color, and the data attribute parents can hook
|
|
12
|
+
* onto for kind-specific styling.
|
|
13
|
+
*/
|
|
14
|
+
export type TrackKind = 'video' | 'audio' | 'subtitle';
|
|
15
|
+
/**
|
|
16
|
+
* One track row on a `<VideoTimeline>`. Tracks are rendered in array
|
|
17
|
+
* order top-to-bottom and each track delegates clip rendering to a
|
|
18
|
+
* `<TrackLane>` row.
|
|
19
|
+
*/
|
|
20
|
+
export interface Track {
|
|
21
|
+
/** Stable identifier — used as the row key and lane id passed to handlers. */
|
|
22
|
+
id: string;
|
|
23
|
+
/** The kind of media on this track. */
|
|
24
|
+
kind: TrackKind;
|
|
25
|
+
/** Clips on this track. Order is preserved as-is. */
|
|
26
|
+
clips: Clip[];
|
|
27
|
+
/** Optional human-friendly track name; falls back to a translated kind label. */
|
|
28
|
+
name?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Edit mode applied to clip drags.
|
|
32
|
+
*
|
|
33
|
+
* - `insert` — dragging a clip just drops it at the new position; other clips
|
|
34
|
+
* on the lane stay where they are.
|
|
35
|
+
* - `ripple` — dragging a clip shifts every later clip on the same lane by
|
|
36
|
+
* the same delta, preserving inter-clip gaps.
|
|
37
|
+
*/
|
|
38
|
+
export type VideoTimelineMode = 'ripple' | 'insert';
|
|
39
|
+
/**
|
|
40
|
+
* Props accepted by {@link VideoTimeline} — the same props
|
|
41
|
+
* `@molecule/app-feature-video-timeline-react` accepts. Node-valued fields of
|
|
42
|
+
* a clip's `label` are `TemplateRef`s in Angular.
|
|
43
|
+
*/
|
|
44
|
+
export interface VideoTimelineProps {
|
|
45
|
+
/** Tracks to render. Order is preserved as-is. */
|
|
46
|
+
tracks: Track[];
|
|
47
|
+
/** Current playhead time in seconds. Drives the playhead vertical line. */
|
|
48
|
+
currentTime: number;
|
|
49
|
+
/** Total timeline duration in seconds — used to size the scrollable body. */
|
|
50
|
+
duration: number;
|
|
51
|
+
/** Called when the user clicks/scrubs the ruler. */
|
|
52
|
+
onSeek?: (time: number) => void;
|
|
53
|
+
/** Called when a clip on a lane is dragged horizontally. */
|
|
54
|
+
onClipMove?: (clipId: string, startTime: number, trackId: string) => void;
|
|
55
|
+
/** Called when a clip's right-edge resize handle is dragged. */
|
|
56
|
+
onClipResize?: (clipId: string, duration: number, trackId: string) => void;
|
|
57
|
+
/** Horizontal scale (px per second). Defaults to 20. */
|
|
58
|
+
pixelsPerSecond?: number;
|
|
59
|
+
/** Lower zoom bound for Ctrl+wheel / slider. Defaults to 2. */
|
|
60
|
+
zoomMin?: number;
|
|
61
|
+
/** Upper zoom bound for Ctrl+wheel / slider. Defaults to 200. */
|
|
62
|
+
zoomMax?: number;
|
|
63
|
+
/** Edit mode for clip drags. Defaults to `'ripple'`. */
|
|
64
|
+
mode?: VideoTimelineMode;
|
|
65
|
+
/** Called when the user changes the zoom (slider or Ctrl+wheel). */
|
|
66
|
+
onZoomChange?: (pixelsPerSecond: number) => void;
|
|
67
|
+
/** Optional currently-selected clip id. */
|
|
68
|
+
selectedClipId?: string;
|
|
69
|
+
/** Called when a clip is clicked (no drag). */
|
|
70
|
+
onClipClick?: (clipId: string, trackId: string) => void;
|
|
71
|
+
/** Per-track row height in pixels. Defaults to 44. */
|
|
72
|
+
trackHeight?: number;
|
|
73
|
+
/** Width of the leading lane-header column in pixels. Defaults to 120. */
|
|
74
|
+
laneHeaderWidth?: number;
|
|
75
|
+
/** Height of the time ruler row in pixels. Defaults to 28. */
|
|
76
|
+
rulerHeight?: number;
|
|
77
|
+
/** Extra classes merged onto the root element. */
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAA;AAEpE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAA;AAEtD;;;;GAIG;AACH,MAAM,WAAW,KAAK;IACpB,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAA;IACV,uCAAuC;IACvC,IAAI,EAAE,SAAS,CAAA;IACf,qDAAqD;IACrD,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEnD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,QAAQ,EAAE,MAA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