@linker-design-plus/timeline-track 1.0.9 → 1.0.11
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/README.md +328 -372
- package/dist/components/interaction/globalPointerDragSession.d.ts +8 -0
- package/dist/components/panel/ClipConfigPanel.d.ts +48 -0
- package/dist/components/panel/TrackInfoPanel.d.ts +33 -0
- package/dist/components/scrollbar/KonvaScrollbarView.d.ts +58 -0
- package/dist/components/timeline/ManagedPlayhead.d.ts +29 -0
- package/dist/components/{Playhead.d.ts → timeline/Playhead.d.ts} +1 -1
- package/dist/components/{Timeline.d.ts → timeline/Timeline.d.ts} +27 -6
- package/dist/components/timeline/TimelineHeaderView.d.ts +45 -0
- package/dist/components/track/Clip.d.ts +16 -0
- package/dist/components/track/Track.d.ts +121 -0
- package/dist/components/track/trackClipLayout.d.ts +23 -0
- package/dist/components/track/trackInteractionState.d.ts +79 -0
- package/dist/core/commands/timelineCommands.d.ts +121 -0
- package/dist/core/controllers/demoPreviewRebuildState.d.ts +54 -0
- package/dist/core/controllers/domPreviewBackend.d.ts +5 -0
- package/dist/core/controllers/index.d.ts +13 -0
- package/dist/core/controllers/previewBackend.d.ts +53 -0
- package/dist/core/controllers/previewBackendSupport.d.ts +2 -0
- package/dist/core/controllers/previewClockController.d.ts +13 -0
- package/dist/core/controllers/previewTransformMath.d.ts +27 -0
- package/dist/core/controllers/previewTransformOverlay.d.ts +45 -0
- package/dist/core/controllers/timelineClipConfigController.d.ts +15 -0
- package/dist/core/controllers/timelineClipEventController.d.ts +32 -0
- package/dist/core/controllers/timelineClipWorkflowController.d.ts +30 -0
- package/dist/core/controllers/timelineDurationController.d.ts +14 -0
- package/dist/core/controllers/timelineEventDispatcher.d.ts +12 -0
- package/dist/core/controllers/timelinePlaybackResolver.d.ts +17 -0
- package/dist/core/controllers/timelinePreviewSession.d.ts +94 -0
- package/dist/core/controllers/timelineSelectionController.d.ts +17 -0
- package/dist/core/controllers/timelineTrackInfoPanelController.d.ts +19 -0
- package/dist/core/controllers/timelineTrackMutationController.d.ts +46 -0
- package/dist/core/facade/timelineManager.d.ts +382 -0
- package/dist/core/{history.d.ts → history/history.d.ts} +16 -14
- package/dist/core/history/index.d.ts +3 -0
- package/dist/core/history/timelineHistoryExecutor.d.ts +23 -0
- package/dist/core/history/timelineHistoryRecorder.d.ts +15 -0
- package/dist/core/layout/index.d.ts +1 -0
- package/dist/core/layout/timelineManagerDom.d.ts +22 -0
- package/dist/core/layout/timelineTrackLayout.d.ts +10 -0
- package/dist/core/models/clipState.d.ts +3 -0
- package/dist/core/{constants.d.ts → models/constants.d.ts} +4 -0
- package/dist/core/models/index.d.ts +3 -0
- package/dist/core/models/types.d.ts +392 -0
- package/dist/core/presentation/index.d.ts +1 -0
- package/dist/core/presentation/timelinePresentationAdapter.d.ts +22 -0
- package/dist/core/stores/index.d.ts +4 -0
- package/dist/core/stores/playbackStore.d.ts +17 -0
- package/dist/core/stores/selectionStore.d.ts +7 -0
- package/dist/core/stores/timelineStore.d.ts +44 -0
- package/dist/core/stores/viewportStore.d.ts +33 -0
- package/dist/core/testing/konva-test-stub.d.ts +81 -0
- package/dist/core/tracks/index.d.ts +3 -0
- package/dist/core/tracks/timelineTrackBridge.d.ts +37 -0
- package/dist/core/tracks/timelineTrackCollection.d.ts +50 -0
- package/dist/core/tracks/trackManager.d.ts +19 -0
- package/dist/core/utils/mountManager.d.ts +10 -0
- package/dist/index.cjs.js +29 -3
- package/dist/index.d.ts +12 -7
- package/dist/index.es.js +8914 -4353
- package/dist/utils/logging/Logger.d.ts +30 -0
- package/dist/utils/logging/index.d.ts +1 -0
- package/dist/utils/{KonvaUtils.d.ts → rendering/KonvaUtils.d.ts} +3 -43
- package/dist/utils/rendering/clipCoverRenderer.d.ts +23 -0
- package/dist/utils/rendering/clipVisualRenderer.d.ts +5 -0
- package/dist/utils/rendering/index.d.ts +4 -0
- package/dist/utils/rendering/timelineGridDrawing.d.ts +8 -0
- package/dist/utils/time/index.d.ts +1 -0
- package/dist/utils/{timeUtils.d.ts → time/timeUtils.d.ts} +4 -0
- package/package.json +5 -3
- package/dist/components/Clip.d.ts +0 -44
- package/dist/components/VideoTrack.d.ts +0 -126
- package/dist/core/timelineManager.d.ts +0 -212
- package/dist/core/types.d.ts +0 -183
- package/dist/utils/Logger.d.ts +0 -49
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
export type TrackType = 'video' | 'audio';
|
|
2
|
+
export type PlayState = 'playing' | 'paused';
|
|
3
|
+
export type TimeMs = number;
|
|
4
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
5
|
+
export interface LogConfig {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
level?: LogLevel;
|
|
8
|
+
moduleLevels?: Record<string, LogLevel>;
|
|
9
|
+
}
|
|
10
|
+
export interface ThumbnailProvider {
|
|
11
|
+
/**
|
|
12
|
+
* 获取片段的封面图片
|
|
13
|
+
* @param clip 片段对象
|
|
14
|
+
* @returns 封面图片URL、Promise<URL>或封面图片URL数组、Promise<URL数组>
|
|
15
|
+
*/
|
|
16
|
+
getThumbnails(clip: Clip): string[] | Promise<string[]>;
|
|
17
|
+
}
|
|
18
|
+
export interface ClipVisualTransform {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
scale: number;
|
|
22
|
+
}
|
|
23
|
+
export type PreviewBackendType = 'dom' | 'canvas' | 'pixi' | 'auto';
|
|
24
|
+
export interface Mp4PreviewMediaSource {
|
|
25
|
+
url: string;
|
|
26
|
+
mimeType: string;
|
|
27
|
+
kind: 'mp4';
|
|
28
|
+
}
|
|
29
|
+
export interface HlsFmp4PreviewMediaSource {
|
|
30
|
+
url: string;
|
|
31
|
+
mimeType: string;
|
|
32
|
+
kind: 'hls-fmp4';
|
|
33
|
+
}
|
|
34
|
+
export type PreviewMediaSource = Mp4PreviewMediaSource | HlsFmp4PreviewMediaSource;
|
|
35
|
+
export type PreviewSourceResolver = (clip: Clip) => PreviewMediaSource | null | Promise<PreviewMediaSource | null>;
|
|
36
|
+
export interface ClipConfig {
|
|
37
|
+
id?: string;
|
|
38
|
+
type?: TrackType;
|
|
39
|
+
externalId?: string;
|
|
40
|
+
src: string;
|
|
41
|
+
name: string;
|
|
42
|
+
isMuted?: boolean;
|
|
43
|
+
startTime?: TimeMs;
|
|
44
|
+
duration: TimeMs;
|
|
45
|
+
startTimeAtSource?: TimeMs;
|
|
46
|
+
endTimeAtSource?: TimeMs;
|
|
47
|
+
sourceDuration?: TimeMs;
|
|
48
|
+
thumbnails?: string[];
|
|
49
|
+
style?: Record<string, any>;
|
|
50
|
+
visualTransform?: ClipVisualTransform;
|
|
51
|
+
separatedAudioClipId?: string;
|
|
52
|
+
separatedFromVideoClipId?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ClipEntity {
|
|
55
|
+
id: string;
|
|
56
|
+
type: TrackType;
|
|
57
|
+
externalId?: string;
|
|
58
|
+
src: string;
|
|
59
|
+
name: string;
|
|
60
|
+
isMuted?: boolean;
|
|
61
|
+
startTime: TimeMs;
|
|
62
|
+
duration: TimeMs;
|
|
63
|
+
endTime: TimeMs;
|
|
64
|
+
startTimeAtSource: TimeMs;
|
|
65
|
+
endTimeAtSource: TimeMs;
|
|
66
|
+
sourceDuration: TimeMs;
|
|
67
|
+
thumbnails?: string[];
|
|
68
|
+
style?: Record<string, any>;
|
|
69
|
+
visualTransform?: ClipVisualTransform;
|
|
70
|
+
separatedAudioClipId?: string;
|
|
71
|
+
separatedFromVideoClipId?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface ClipViewState {
|
|
74
|
+
isDragging: boolean;
|
|
75
|
+
isResizing: boolean;
|
|
76
|
+
isResizingLeft: boolean;
|
|
77
|
+
isResizingRight: boolean;
|
|
78
|
+
isSelected: boolean;
|
|
79
|
+
zIndex: number;
|
|
80
|
+
opacity: number;
|
|
81
|
+
}
|
|
82
|
+
export type Clip = ClipEntity & ClipViewState;
|
|
83
|
+
export declare const DEFAULT_CLIP_VIEW_STATE: ClipViewState;
|
|
84
|
+
export interface TrackConfig {
|
|
85
|
+
id?: string;
|
|
86
|
+
type?: TrackType;
|
|
87
|
+
name?: string;
|
|
88
|
+
isMuted?: boolean;
|
|
89
|
+
role?: 'primary' | 'normal';
|
|
90
|
+
clips: Clip[];
|
|
91
|
+
}
|
|
92
|
+
export type TrackInsertionPlacement = 'before_primary' | 'after_primary' | 'top_of_type_region' | 'bottom_of_type_region' | 'before_track' | 'after_track';
|
|
93
|
+
export interface Track extends TrackConfig {
|
|
94
|
+
id: string;
|
|
95
|
+
type: TrackType;
|
|
96
|
+
name: string;
|
|
97
|
+
order: number;
|
|
98
|
+
role: 'primary' | 'normal';
|
|
99
|
+
}
|
|
100
|
+
export interface Theme {
|
|
101
|
+
background: string;
|
|
102
|
+
border: string;
|
|
103
|
+
timeTick: string;
|
|
104
|
+
timeText: string;
|
|
105
|
+
trackBackground: string;
|
|
106
|
+
trackSelectedBackground?: string;
|
|
107
|
+
trackBorder: string;
|
|
108
|
+
clipBackground: string;
|
|
109
|
+
clipBorder: string;
|
|
110
|
+
clipName: string;
|
|
111
|
+
clipDuration: string;
|
|
112
|
+
clipHandle: string;
|
|
113
|
+
clipCoverBackground: string;
|
|
114
|
+
audioClipBackground?: string;
|
|
115
|
+
audioClipText?: string;
|
|
116
|
+
audioClipAccent?: string;
|
|
117
|
+
clipSelectedBackground: string;
|
|
118
|
+
clipSelectedBorder: string;
|
|
119
|
+
clipSelectedName: string;
|
|
120
|
+
clipSelectedDuration: string;
|
|
121
|
+
clipSelectedHandle: string;
|
|
122
|
+
clipSelectedCoverBackground: string;
|
|
123
|
+
playhead: string;
|
|
124
|
+
grid: string;
|
|
125
|
+
snapGuideLineColor?: string;
|
|
126
|
+
snapGuideLineWidth?: number;
|
|
127
|
+
scrollbarBackground?: string;
|
|
128
|
+
scrollbarBorder?: string;
|
|
129
|
+
scrollbarThumb?: string;
|
|
130
|
+
scrollbarThumbBorder?: string;
|
|
131
|
+
}
|
|
132
|
+
export type ThemeConfig = Partial<Theme>;
|
|
133
|
+
export type ResolvedTimelineConfig = Omit<TimelineConfig, 'theme'> & {
|
|
134
|
+
theme: Theme;
|
|
135
|
+
};
|
|
136
|
+
export declare const defaultDarkTheme: Theme;
|
|
137
|
+
export declare function resolveTheme(theme?: ThemeConfig): Theme;
|
|
138
|
+
export interface TimelineConfig {
|
|
139
|
+
duration: TimeMs;
|
|
140
|
+
zoom: number;
|
|
141
|
+
currentTime: TimeMs;
|
|
142
|
+
playState: PlayState;
|
|
143
|
+
container?: HTMLElement;
|
|
144
|
+
theme?: ThemeConfig;
|
|
145
|
+
timeScaleHeight?: number;
|
|
146
|
+
logConfig?: LogConfig;
|
|
147
|
+
speed?: number;
|
|
148
|
+
dragActivationThreshold?: number;
|
|
149
|
+
enableClipSnap?: boolean;
|
|
150
|
+
clipSnapThreshold?: number;
|
|
151
|
+
thumbnailProvider?: ThumbnailProvider;
|
|
152
|
+
previewBackend?: PreviewBackendType;
|
|
153
|
+
previewSourceResolver?: PreviewSourceResolver;
|
|
154
|
+
}
|
|
155
|
+
export type PreviewAspectRatioMode = 'auto-first-added-video' | 'auto-first-video' | 'manual';
|
|
156
|
+
export interface PreviewAspectRatio {
|
|
157
|
+
mode: PreviewAspectRatioMode;
|
|
158
|
+
width: number;
|
|
159
|
+
height: number;
|
|
160
|
+
}
|
|
161
|
+
export interface PreviewAspectRatioPreset {
|
|
162
|
+
key: 'default' | '9:16' | '16:9' | '3:4' | '4:3';
|
|
163
|
+
label: string;
|
|
164
|
+
aspectRatio: PreviewAspectRatio;
|
|
165
|
+
}
|
|
166
|
+
export declare const DEFAULT_PREVIEW_ASPECT_RATIO: PreviewAspectRatio;
|
|
167
|
+
export declare const PREVIEW_ASPECT_RATIO_PRESETS: PreviewAspectRatioPreset[];
|
|
168
|
+
export declare function normalizePreviewAspectRatioMode(mode?: PreviewAspectRatioMode | null): PreviewAspectRatioMode;
|
|
169
|
+
export declare function isAutoPreviewAspectRatioMode(mode?: PreviewAspectRatioMode | null): boolean;
|
|
170
|
+
export declare function normalizePreviewAspectRatio(aspectRatio?: Partial<PreviewAspectRatio> | null): PreviewAspectRatio;
|
|
171
|
+
export interface PreviewMountConfig {
|
|
172
|
+
container: HTMLElement;
|
|
173
|
+
aspectRatio?: {
|
|
174
|
+
mode?: PreviewAspectRatioMode;
|
|
175
|
+
width?: number;
|
|
176
|
+
height?: number;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export interface ActiveClipPlaybackInfo {
|
|
180
|
+
trackId: string;
|
|
181
|
+
trackType: TrackType;
|
|
182
|
+
trackOrder: number;
|
|
183
|
+
clip: Clip;
|
|
184
|
+
mediaTime: TimeMs;
|
|
185
|
+
muted: boolean;
|
|
186
|
+
kind: TrackType;
|
|
187
|
+
hasVisual: boolean;
|
|
188
|
+
hasAudio: boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface ClipStateUpdate {
|
|
191
|
+
clipId: string;
|
|
192
|
+
newState: Clip;
|
|
193
|
+
previousState: Clip;
|
|
194
|
+
}
|
|
195
|
+
export interface AddClipAction {
|
|
196
|
+
type: 'add_clip';
|
|
197
|
+
data: Clip;
|
|
198
|
+
timestamp: number;
|
|
199
|
+
}
|
|
200
|
+
export interface RemoveClipAction {
|
|
201
|
+
type: 'remove_clip';
|
|
202
|
+
data: Clip;
|
|
203
|
+
timestamp: number;
|
|
204
|
+
}
|
|
205
|
+
export interface UpdateClipAction {
|
|
206
|
+
type: 'update_clip';
|
|
207
|
+
data: {
|
|
208
|
+
clipId: string;
|
|
209
|
+
updates: Partial<Clip>;
|
|
210
|
+
previousState: Partial<Clip>;
|
|
211
|
+
};
|
|
212
|
+
timestamp: number;
|
|
213
|
+
}
|
|
214
|
+
export interface SplitClipAction {
|
|
215
|
+
type: 'split_clip';
|
|
216
|
+
data: {
|
|
217
|
+
originalClip: Clip;
|
|
218
|
+
clip1: Clip;
|
|
219
|
+
clip2: Clip;
|
|
220
|
+
};
|
|
221
|
+
timestamp: number;
|
|
222
|
+
}
|
|
223
|
+
export interface MoveClipAction {
|
|
224
|
+
type: 'move_clip';
|
|
225
|
+
data: {
|
|
226
|
+
clipId: string;
|
|
227
|
+
newStartTime: number;
|
|
228
|
+
previousStartTime: number;
|
|
229
|
+
};
|
|
230
|
+
timestamp: number;
|
|
231
|
+
}
|
|
232
|
+
export interface ResizeClipAction {
|
|
233
|
+
type: 'resize_clip';
|
|
234
|
+
data: {
|
|
235
|
+
clipId: string;
|
|
236
|
+
newDuration: number;
|
|
237
|
+
newStartTime: number;
|
|
238
|
+
previousDuration: number;
|
|
239
|
+
previousStartTime: number;
|
|
240
|
+
};
|
|
241
|
+
timestamp: number;
|
|
242
|
+
}
|
|
243
|
+
export interface SetTimeAction {
|
|
244
|
+
type: 'set_time';
|
|
245
|
+
data: {
|
|
246
|
+
newTime: number;
|
|
247
|
+
previousTime: number;
|
|
248
|
+
};
|
|
249
|
+
timestamp: number;
|
|
250
|
+
}
|
|
251
|
+
export interface RemoveGapsAction {
|
|
252
|
+
type: 'remove_gaps';
|
|
253
|
+
data: {
|
|
254
|
+
clipsBefore: Clip[];
|
|
255
|
+
};
|
|
256
|
+
timestamp: number;
|
|
257
|
+
}
|
|
258
|
+
export interface MultiClipUpdateAction {
|
|
259
|
+
type: 'multi_clip_update';
|
|
260
|
+
data: {
|
|
261
|
+
clipUpdates: ClipStateUpdate[];
|
|
262
|
+
};
|
|
263
|
+
timestamp: number;
|
|
264
|
+
}
|
|
265
|
+
export interface MoveClipBetweenTracksAction {
|
|
266
|
+
type: 'move_clip_between_tracks';
|
|
267
|
+
data: {
|
|
268
|
+
clipId: string;
|
|
269
|
+
sourceTrackId: string;
|
|
270
|
+
targetTrackId: string;
|
|
271
|
+
clipBefore: Clip;
|
|
272
|
+
clipAfter: Clip;
|
|
273
|
+
sourceTrackSnapshot: Track | null;
|
|
274
|
+
targetTrackSnapshot: Track | null;
|
|
275
|
+
};
|
|
276
|
+
timestamp: number;
|
|
277
|
+
}
|
|
278
|
+
export interface SeparateClipAudioAction {
|
|
279
|
+
type: 'separate_clip_audio';
|
|
280
|
+
data: {
|
|
281
|
+
videoClipBefore: Clip;
|
|
282
|
+
videoClipAfter: Clip;
|
|
283
|
+
audioClip: Clip | null;
|
|
284
|
+
audioTrackId: string | null;
|
|
285
|
+
};
|
|
286
|
+
timestamp: number;
|
|
287
|
+
}
|
|
288
|
+
export interface RestoreClipAudioAction {
|
|
289
|
+
type: 'restore_clip_audio';
|
|
290
|
+
data: {
|
|
291
|
+
videoClipBefore: Clip;
|
|
292
|
+
videoClipAfter: Clip;
|
|
293
|
+
audioClip: Clip | null;
|
|
294
|
+
audioTrackId: string | null;
|
|
295
|
+
};
|
|
296
|
+
timestamp: number;
|
|
297
|
+
}
|
|
298
|
+
export type Action = AddClipAction | RemoveClipAction | UpdateClipAction | SplitClipAction | MoveClipAction | ResizeClipAction | SetTimeAction | RemoveGapsAction | MultiClipUpdateAction | MoveClipBetweenTracksAction | SeparateClipAudioAction | RestoreClipAudioAction;
|
|
299
|
+
export type ActionType = Action['type'];
|
|
300
|
+
export interface Position {
|
|
301
|
+
x: number;
|
|
302
|
+
y: number;
|
|
303
|
+
}
|
|
304
|
+
export interface Range {
|
|
305
|
+
start: number;
|
|
306
|
+
end: number;
|
|
307
|
+
}
|
|
308
|
+
export interface HistoryState {
|
|
309
|
+
past: Action[];
|
|
310
|
+
future: Action[];
|
|
311
|
+
}
|
|
312
|
+
export type TimelineEvent = 'time_change' | 'play_state_change' | 'clip_added' | 'clip_removed' | 'clip_updated' | 'zoom_change' | 'history_change' | 'track_duration_change' | 'clip_selected' | 'selected_clip_change' | 'speed_change' | 'can_play_change' | 'buffering_state_change' | 'source_loading_change' | 'preview_aspect_ratio_change';
|
|
313
|
+
export interface TimeChangeData {
|
|
314
|
+
time: TimeMs;
|
|
315
|
+
}
|
|
316
|
+
export interface PlayStateChangeData {
|
|
317
|
+
playState: PlayState;
|
|
318
|
+
}
|
|
319
|
+
export interface ZoomChangeData {
|
|
320
|
+
zoom: number;
|
|
321
|
+
}
|
|
322
|
+
export interface ClipEventData {
|
|
323
|
+
clip: Clip;
|
|
324
|
+
}
|
|
325
|
+
export interface SelectedClipChangeData {
|
|
326
|
+
clip: Clip | null;
|
|
327
|
+
hasSelectedClip: boolean;
|
|
328
|
+
}
|
|
329
|
+
export interface ClipRemovedEventData {
|
|
330
|
+
clipId: string;
|
|
331
|
+
}
|
|
332
|
+
export interface CanPlayChangeData {
|
|
333
|
+
canPlay: boolean;
|
|
334
|
+
}
|
|
335
|
+
export interface BufferingStateChangeData {
|
|
336
|
+
isBuffering: boolean;
|
|
337
|
+
}
|
|
338
|
+
export interface SourceLoadingChangeData {
|
|
339
|
+
isLoading: boolean;
|
|
340
|
+
pending: number;
|
|
341
|
+
}
|
|
342
|
+
export interface PreviewAspectRatioChangeData {
|
|
343
|
+
aspectRatio: PreviewAspectRatio;
|
|
344
|
+
}
|
|
345
|
+
export interface EventListener {
|
|
346
|
+
(event: TimelineEvent, data?: any): void;
|
|
347
|
+
}
|
|
348
|
+
export interface TimelineManagerConfig {
|
|
349
|
+
initialDuration?: TimeMs;
|
|
350
|
+
initialZoom?: number;
|
|
351
|
+
logConfig?: LogConfig;
|
|
352
|
+
thumbnailProvider?: ThumbnailProvider;
|
|
353
|
+
}
|
|
354
|
+
export interface TimelineExportData {
|
|
355
|
+
version: string;
|
|
356
|
+
exportTime: number;
|
|
357
|
+
coverUrl: string;
|
|
358
|
+
composition: TimelineCompositionExportData;
|
|
359
|
+
tracks: TrackExportData[];
|
|
360
|
+
}
|
|
361
|
+
export interface TimelineCompositionExportData {
|
|
362
|
+
width: number;
|
|
363
|
+
height: number;
|
|
364
|
+
aspectRatio: string;
|
|
365
|
+
mode: PreviewAspectRatioMode;
|
|
366
|
+
}
|
|
367
|
+
export interface TrackExportData {
|
|
368
|
+
id: string;
|
|
369
|
+
type: TrackType;
|
|
370
|
+
name: string;
|
|
371
|
+
order: number;
|
|
372
|
+
isMuted: boolean;
|
|
373
|
+
clips: ClipExportData[];
|
|
374
|
+
}
|
|
375
|
+
export interface ClipExportData {
|
|
376
|
+
id: string;
|
|
377
|
+
type: TrackType;
|
|
378
|
+
externalId?: string;
|
|
379
|
+
src: string;
|
|
380
|
+
name: string;
|
|
381
|
+
isMuted: boolean;
|
|
382
|
+
startTime: TimeMs;
|
|
383
|
+
duration: TimeMs;
|
|
384
|
+
endTime: TimeMs;
|
|
385
|
+
startTimeAtSource: TimeMs;
|
|
386
|
+
endTimeAtSource: TimeMs;
|
|
387
|
+
sourceDuration: TimeMs;
|
|
388
|
+
thumbnails?: string[];
|
|
389
|
+
visualTransform?: ClipVisualTransform;
|
|
390
|
+
separatedAudioClipId?: string;
|
|
391
|
+
separatedFromVideoClipId?: string;
|
|
392
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TimelinePresentationAdapter } from './timelinePresentationAdapter';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Clip, TimeMs } from '../models/types';
|
|
2
|
+
import type { TimelineTrackCollection } from '../tracks/timelineTrackCollection';
|
|
3
|
+
export interface TimelineTimeView {
|
|
4
|
+
setCurrentTime(time: TimeMs): void;
|
|
5
|
+
}
|
|
6
|
+
export interface TimelineZoomView {
|
|
7
|
+
setZoom(zoom: number): void;
|
|
8
|
+
}
|
|
9
|
+
export interface TimelineScrollView {
|
|
10
|
+
setScrollLeft(scrollLeft: number): void;
|
|
11
|
+
}
|
|
12
|
+
export interface TimelineVerticalScrollView {
|
|
13
|
+
setScrollTop(scrollTop: number): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class TimelinePresentationAdapter {
|
|
16
|
+
syncCurrentTime(timeline: TimelineTimeView | null, playhead: TimelineTimeView | null, tracks: TimelineTrackCollection, time: TimeMs): void;
|
|
17
|
+
syncZoom(timeline: TimelineZoomView | null, playhead: TimelineZoomView | null, tracks: TimelineTrackCollection, zoom: number): void;
|
|
18
|
+
syncScrollLeft(playhead: TimelineScrollView | null, tracks: TimelineTrackCollection, scrollLeft: number): void;
|
|
19
|
+
syncScrollTop(panel: TimelineVerticalScrollView | null, scrollbar: TimelineVerticalScrollView | null, scrollTop: number): void;
|
|
20
|
+
syncSelection(tracks: TimelineTrackCollection, selectedClipId: string | null): void;
|
|
21
|
+
findSelectedClip(tracks: TimelineTrackCollection): Clip | null;
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PlayState, TimeMs } from '../models/types';
|
|
2
|
+
export declare class PlaybackStore {
|
|
3
|
+
private currentTime;
|
|
4
|
+
private playState;
|
|
5
|
+
private speed;
|
|
6
|
+
constructor(initial: {
|
|
7
|
+
currentTime: TimeMs;
|
|
8
|
+
playState: PlayState;
|
|
9
|
+
speed: number;
|
|
10
|
+
});
|
|
11
|
+
getCurrentTime(): TimeMs;
|
|
12
|
+
setCurrentTime(time: TimeMs): void;
|
|
13
|
+
getPlayState(): PlayState;
|
|
14
|
+
setPlayState(playState: PlayState): void;
|
|
15
|
+
getSpeed(): number;
|
|
16
|
+
setSpeed(speed: number): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PlayState, TimeMs } from '../models/types';
|
|
2
|
+
export interface TimelineStoreInitialState {
|
|
3
|
+
currentTime: TimeMs;
|
|
4
|
+
playState: PlayState;
|
|
5
|
+
speed: number;
|
|
6
|
+
zoom: number;
|
|
7
|
+
duration: TimeMs;
|
|
8
|
+
scrollLeft?: number;
|
|
9
|
+
scrollTop?: number;
|
|
10
|
+
viewportWidth?: number;
|
|
11
|
+
viewportHeight?: number;
|
|
12
|
+
contentHeight?: number;
|
|
13
|
+
selectedClipId?: string | null;
|
|
14
|
+
}
|
|
15
|
+
export declare class TimelineStore {
|
|
16
|
+
private readonly selectionStore;
|
|
17
|
+
private readonly playbackStore;
|
|
18
|
+
private readonly viewportStore;
|
|
19
|
+
constructor(initial: TimelineStoreInitialState);
|
|
20
|
+
getSelectedClipId(): string | null;
|
|
21
|
+
setSelectedClipId(clipId: string | null): void;
|
|
22
|
+
clearSelection(): void;
|
|
23
|
+
hasSelection(): boolean;
|
|
24
|
+
getCurrentTime(): TimeMs;
|
|
25
|
+
setCurrentTime(time: TimeMs): void;
|
|
26
|
+
getPlayState(): PlayState;
|
|
27
|
+
setPlayState(playState: PlayState): void;
|
|
28
|
+
getSpeed(): number;
|
|
29
|
+
setSpeed(speed: number): void;
|
|
30
|
+
getZoom(): number;
|
|
31
|
+
setZoom(zoom: number): void;
|
|
32
|
+
getDuration(): TimeMs;
|
|
33
|
+
setDuration(duration: TimeMs): void;
|
|
34
|
+
getScrollLeft(): number;
|
|
35
|
+
setScrollLeft(scrollLeft: number): void;
|
|
36
|
+
getScrollTop(): number;
|
|
37
|
+
setScrollTop(scrollTop: number): void;
|
|
38
|
+
getViewportWidth(): number;
|
|
39
|
+
setViewportWidth(viewportWidth: number): void;
|
|
40
|
+
getViewportHeight(): number;
|
|
41
|
+
setViewportHeight(viewportHeight: number): void;
|
|
42
|
+
getContentHeight(): number;
|
|
43
|
+
setContentHeight(contentHeight: number): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TimeMs } from '../models/types';
|
|
2
|
+
export declare class ViewportStore {
|
|
3
|
+
private zoom;
|
|
4
|
+
private duration;
|
|
5
|
+
private scrollLeft;
|
|
6
|
+
private scrollTop;
|
|
7
|
+
private viewportWidth;
|
|
8
|
+
private viewportHeight;
|
|
9
|
+
private contentHeight;
|
|
10
|
+
constructor(initial: {
|
|
11
|
+
zoom: number;
|
|
12
|
+
duration: TimeMs;
|
|
13
|
+
scrollLeft?: number;
|
|
14
|
+
scrollTop?: number;
|
|
15
|
+
viewportWidth?: number;
|
|
16
|
+
viewportHeight?: number;
|
|
17
|
+
contentHeight?: number;
|
|
18
|
+
});
|
|
19
|
+
getZoom(): number;
|
|
20
|
+
setZoom(zoom: number): void;
|
|
21
|
+
getDuration(): TimeMs;
|
|
22
|
+
setDuration(duration: TimeMs): void;
|
|
23
|
+
getScrollLeft(): number;
|
|
24
|
+
setScrollLeft(scrollLeft: number): void;
|
|
25
|
+
getScrollTop(): number;
|
|
26
|
+
setScrollTop(scrollTop: number): void;
|
|
27
|
+
getViewportWidth(): number;
|
|
28
|
+
setViewportWidth(viewportWidth: number): void;
|
|
29
|
+
getViewportHeight(): number;
|
|
30
|
+
setViewportHeight(viewportHeight: number): void;
|
|
31
|
+
getContentHeight(): number;
|
|
32
|
+
setContentHeight(contentHeight: number): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
type AttrMap = Record<string, any>;
|
|
2
|
+
declare class MockNode {
|
|
3
|
+
protected attrs: AttrMap;
|
|
4
|
+
protected children: MockNode[];
|
|
5
|
+
protected listeners: Map<string, ((event: any) => void)[]>;
|
|
6
|
+
constructor(attrs?: AttrMap);
|
|
7
|
+
name(value?: string): any;
|
|
8
|
+
x(value?: number): any;
|
|
9
|
+
y(value?: number): any;
|
|
10
|
+
width(value?: number): any;
|
|
11
|
+
height(value?: number): any;
|
|
12
|
+
visible(value?: boolean): any;
|
|
13
|
+
fill(value?: string): any;
|
|
14
|
+
stroke(value?: string): any;
|
|
15
|
+
strokeWidth(value?: number): any;
|
|
16
|
+
fillEnabled(value?: boolean): any;
|
|
17
|
+
dash(value?: number[]): any;
|
|
18
|
+
cornerRadius(value?: number): any;
|
|
19
|
+
text(value?: string): any;
|
|
20
|
+
ellipsis(value?: boolean): any;
|
|
21
|
+
points(value?: number[]): any;
|
|
22
|
+
setAttr(key: string, value: any): void;
|
|
23
|
+
getAttr(key: string): any;
|
|
24
|
+
add(child: MockNode): this;
|
|
25
|
+
on(eventName: string, handler: (event: any) => void): this;
|
|
26
|
+
off(eventName: string, handler?: (event: any) => void): this;
|
|
27
|
+
fire(eventName: string, event: any): this;
|
|
28
|
+
getChildren(): MockNode[];
|
|
29
|
+
destroyChildren(): void;
|
|
30
|
+
clip(value?: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}): any;
|
|
36
|
+
clipWidth(): number;
|
|
37
|
+
clipHeight(): number;
|
|
38
|
+
container(): any;
|
|
39
|
+
batchDraw(): this;
|
|
40
|
+
draw(): this;
|
|
41
|
+
destroy(): void;
|
|
42
|
+
findOne(selector: string): MockNode | undefined;
|
|
43
|
+
find(selector: string): MockNode[];
|
|
44
|
+
getClassName(): string;
|
|
45
|
+
}
|
|
46
|
+
declare class MockGroup extends MockNode {
|
|
47
|
+
}
|
|
48
|
+
declare class MockLayer extends MockGroup {
|
|
49
|
+
}
|
|
50
|
+
declare class MockRect extends MockNode {
|
|
51
|
+
}
|
|
52
|
+
declare class MockText extends MockNode {
|
|
53
|
+
}
|
|
54
|
+
declare class MockLine extends MockNode {
|
|
55
|
+
}
|
|
56
|
+
declare class MockImage extends MockNode {
|
|
57
|
+
}
|
|
58
|
+
declare class MockRegularPolygon extends MockNode {
|
|
59
|
+
}
|
|
60
|
+
declare class MockStage extends MockNode {
|
|
61
|
+
}
|
|
62
|
+
declare class MockTween {
|
|
63
|
+
private readonly config;
|
|
64
|
+
constructor(config: Record<string, any>);
|
|
65
|
+
play(): void;
|
|
66
|
+
}
|
|
67
|
+
export declare function createKonvaMock(): {
|
|
68
|
+
Group: typeof MockGroup;
|
|
69
|
+
Layer: typeof MockLayer;
|
|
70
|
+
Rect: typeof MockRect;
|
|
71
|
+
Text: typeof MockText;
|
|
72
|
+
Line: typeof MockLine;
|
|
73
|
+
Image: typeof MockImage;
|
|
74
|
+
RegularPolygon: typeof MockRegularPolygon;
|
|
75
|
+
Stage: typeof MockStage;
|
|
76
|
+
Tween: typeof MockTween;
|
|
77
|
+
Easings: {
|
|
78
|
+
EaseInOut: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Konva from 'konva';
|
|
2
|
+
import { Track } from '../../components/track/Track';
|
|
3
|
+
import type { Clip, ClipStateUpdate, Theme, TimeMs, TrackConfig, TrackType } from '../models/types';
|
|
4
|
+
export interface TimelineTrackBridgeHandlers {
|
|
5
|
+
onClipUpdate: (clip: Clip, originalClip?: Clip, clipUpdates?: ClipStateUpdate[]) => void;
|
|
6
|
+
onClipAdd: (clip: Clip) => void;
|
|
7
|
+
onClipRemove: (clipId: string) => void;
|
|
8
|
+
onClipSplit: (clip1: Clip, clip2: Clip) => void;
|
|
9
|
+
onClipSelect: (clip: Clip) => void;
|
|
10
|
+
onTimeJump: (time: TimeMs) => void;
|
|
11
|
+
onHorizontalDragAutoScroll?: (nextScrollLeft: number) => number;
|
|
12
|
+
onClipOverlap?: (clip: Clip, currentTrackId: string) => void;
|
|
13
|
+
onClipCrossTrackPreview?: (clip: Clip, targetTrackY: number, currentTrackId: string) => 'self' | 'external' | 'clear';
|
|
14
|
+
onClipCrossTrack?: (clip: Clip, originalClip: Clip | null, targetTrackY: number, currentTrackId: string) => boolean | void;
|
|
15
|
+
onClearDropPreview?: () => void;
|
|
16
|
+
onClearSelection?: () => void;
|
|
17
|
+
onSnapGuideChange?: (guideTime: TimeMs | null) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface TimelineTrackBridgeCreateOptions {
|
|
20
|
+
layer: Konva.Layer;
|
|
21
|
+
config: TrackConfig;
|
|
22
|
+
trackType: TrackType;
|
|
23
|
+
zoom: number;
|
|
24
|
+
trackY: number;
|
|
25
|
+
trackHeight: number;
|
|
26
|
+
theme: Theme;
|
|
27
|
+
dragActivationThreshold?: number;
|
|
28
|
+
enableClipSnap?: boolean;
|
|
29
|
+
clipSnapThreshold?: number;
|
|
30
|
+
}
|
|
31
|
+
export type TimelineTrackConstructor<TTrack = Track> = new (layer: Konva.Layer, config: TrackConfig, trackType: TrackType, zoom: number, trackY: number, trackHeight: number, theme: Theme, onClipUpdate: (clip: Clip, originalClip?: Clip, clipUpdates?: ClipStateUpdate[]) => void, onClipAdd: (clip: Clip) => void, onClipRemove: (clipId: string) => void, onClipSplit: (clip1: Clip, clip2: Clip) => void, onClipSelect: (clip: Clip) => void, onTimeJump: (time: TimeMs) => void, onHorizontalDragAutoScroll?: (nextScrollLeft: number) => number, onClipOverlap?: (clip: Clip, currentTrackId: string) => void, onClipCrossTrackPreview?: (clip: Clip, targetTrackY: number, currentTrackId: string) => 'self' | 'external' | 'clear', onClipCrossTrack?: (clip: Clip, originalClip: Clip | null, targetTrackY: number, currentTrackId: string) => boolean | void, onClearDropPreview?: () => void, onClearSelection?: () => void, onSnapGuideChange?: (guideTime: TimeMs | null) => void, dragActivationThreshold?: number, enableClipSnap?: boolean, clipSnapThreshold?: number) => TTrack;
|
|
32
|
+
export declare class TimelineTrackBridge<TTrack = Track> {
|
|
33
|
+
private readonly handlers;
|
|
34
|
+
private readonly TrackCtor;
|
|
35
|
+
constructor(handlers: TimelineTrackBridgeHandlers, TrackCtor?: TimelineTrackConstructor<TTrack>);
|
|
36
|
+
createTrack(options: TimelineTrackBridgeCreateOptions): TTrack;
|
|
37
|
+
}
|