@linker-design-plus/timeline-track 1.0.10 → 2.0.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.
Files changed (75) hide show
  1. package/README.md +328 -381
  2. package/dist/components/interaction/globalPointerDragSession.d.ts +8 -0
  3. package/dist/components/panel/ClipConfigPanel.d.ts +48 -0
  4. package/dist/components/panel/TrackInfoPanel.d.ts +33 -0
  5. package/dist/components/scrollbar/KonvaScrollbarView.d.ts +58 -0
  6. package/dist/components/timeline/ManagedPlayhead.d.ts +29 -0
  7. package/dist/components/{Playhead.d.ts → timeline/Playhead.d.ts} +1 -1
  8. package/dist/components/{Timeline.d.ts → timeline/Timeline.d.ts} +8 -7
  9. package/dist/components/timeline/TimelineHeaderView.d.ts +45 -0
  10. package/dist/components/track/Clip.d.ts +16 -0
  11. package/dist/components/track/Track.d.ts +121 -0
  12. package/dist/components/track/trackClipLayout.d.ts +23 -0
  13. package/dist/components/track/trackInteractionState.d.ts +79 -0
  14. package/dist/core/commands/timelineCommands.d.ts +121 -0
  15. package/dist/core/controllers/demoPreviewRebuildState.d.ts +54 -0
  16. package/dist/core/controllers/domPreviewBackend.d.ts +5 -0
  17. package/dist/core/controllers/index.d.ts +13 -0
  18. package/dist/core/controllers/previewBackend.d.ts +53 -0
  19. package/dist/core/controllers/previewBackendSupport.d.ts +2 -0
  20. package/dist/core/controllers/previewClockController.d.ts +13 -0
  21. package/dist/core/controllers/previewTransformMath.d.ts +27 -0
  22. package/dist/core/controllers/previewTransformOverlay.d.ts +45 -0
  23. package/dist/core/controllers/timelineClipConfigController.d.ts +17 -0
  24. package/dist/core/controllers/timelineClipEventController.d.ts +32 -0
  25. package/dist/core/controllers/timelineClipWorkflowController.d.ts +30 -0
  26. package/dist/core/controllers/timelineDurationController.d.ts +14 -0
  27. package/dist/core/controllers/timelineEventDispatcher.d.ts +12 -0
  28. package/dist/core/controllers/timelinePlaybackResolver.d.ts +17 -0
  29. package/dist/core/controllers/timelinePreviewSession.d.ts +94 -0
  30. package/dist/core/controllers/timelineSelectionController.d.ts +17 -0
  31. package/dist/core/controllers/timelineTrackInfoPanelController.d.ts +19 -0
  32. package/dist/core/controllers/timelineTrackMutationController.d.ts +46 -0
  33. package/dist/core/facade/timelineManager.d.ts +385 -0
  34. package/dist/core/{history.d.ts → history/history.d.ts} +16 -14
  35. package/dist/core/history/index.d.ts +3 -0
  36. package/dist/core/history/timelineHistoryExecutor.d.ts +23 -0
  37. package/dist/core/history/timelineHistoryRecorder.d.ts +15 -0
  38. package/dist/core/layout/index.d.ts +1 -0
  39. package/dist/core/layout/timelineManagerDom.d.ts +22 -0
  40. package/dist/core/layout/timelineTrackLayout.d.ts +10 -0
  41. package/dist/core/models/clipState.d.ts +3 -0
  42. package/dist/core/{constants.d.ts → models/constants.d.ts} +4 -0
  43. package/dist/core/models/index.d.ts +3 -0
  44. package/dist/core/models/types.d.ts +400 -0
  45. package/dist/core/presentation/index.d.ts +1 -0
  46. package/dist/core/presentation/timelinePresentationAdapter.d.ts +22 -0
  47. package/dist/core/stores/index.d.ts +4 -0
  48. package/dist/core/stores/playbackStore.d.ts +17 -0
  49. package/dist/core/stores/selectionStore.d.ts +7 -0
  50. package/dist/core/stores/timelineStore.d.ts +44 -0
  51. package/dist/core/stores/viewportStore.d.ts +33 -0
  52. package/dist/core/testing/konva-test-stub.d.ts +81 -0
  53. package/dist/core/tracks/index.d.ts +3 -0
  54. package/dist/core/tracks/timelineTrackBridge.d.ts +37 -0
  55. package/dist/core/tracks/timelineTrackCollection.d.ts +50 -0
  56. package/dist/core/tracks/trackManager.d.ts +19 -0
  57. package/dist/core/utils/mountManager.d.ts +10 -0
  58. package/dist/index.cjs.js +29 -3
  59. package/dist/index.d.ts +12 -7
  60. package/dist/index.es.js +8924 -4414
  61. package/dist/utils/logging/Logger.d.ts +30 -0
  62. package/dist/utils/logging/index.d.ts +1 -0
  63. package/dist/utils/{KonvaUtils.d.ts → rendering/KonvaUtils.d.ts} +3 -43
  64. package/dist/utils/rendering/clipCoverRenderer.d.ts +23 -0
  65. package/dist/utils/rendering/clipVisualRenderer.d.ts +5 -0
  66. package/dist/utils/rendering/index.d.ts +4 -0
  67. package/dist/utils/rendering/timelineGridDrawing.d.ts +8 -0
  68. package/dist/utils/time/index.d.ts +1 -0
  69. package/dist/utils/{timeUtils.d.ts → time/timeUtils.d.ts} +4 -0
  70. package/package.json +4 -2
  71. package/dist/components/Clip.d.ts +0 -44
  72. package/dist/components/VideoTrack.d.ts +0 -137
  73. package/dist/core/timelineManager.d.ts +0 -226
  74. package/dist/core/types.d.ts +0 -187
  75. package/dist/utils/Logger.d.ts +0 -49
@@ -0,0 +1,385 @@
1
+ import { TimelineConfig, Clip, ClipConfig, TimeMs, PlayState, Action, TimelineEvent, EventListener as TimelineEventListener, TimelineExportData, ThumbnailProvider, TrackInsertionPlacement, TrackType, ActiveClipPlaybackInfo, PreviewAspectRatio, PreviewMountConfig, PreviewBackendType } from '../models';
2
+ import type { ResolvedPlaybackPlan } from '../controllers/timelinePlaybackResolver';
3
+ import { TimelineClipConfigController } from '../controllers/timelineClipConfigController';
4
+ export declare class TimelineManager {
5
+ private timeline;
6
+ private tracks;
7
+ private trackManager;
8
+ private trackInfoPanelController;
9
+ private playhead;
10
+ private history;
11
+ private config;
12
+ private eventDispatcher;
13
+ private animationFrameId;
14
+ private lastUpdateTime;
15
+ private isInitialized;
16
+ private stage;
17
+ private headerStage;
18
+ private headerLayer;
19
+ private backgroundLayer;
20
+ private trackLayer;
21
+ private snapGuideLayer;
22
+ private resizeObserver;
23
+ private rootContainer;
24
+ private layout;
25
+ private bodyBackgroundRect;
26
+ private snapGuideLine;
27
+ private trackInsertionPreviewLine;
28
+ private trackInsertionPreviewY;
29
+ private snapGuideTime;
30
+ private horizontalScrollbar;
31
+ private verticalScrollbar;
32
+ private isExecutingHistoryAction;
33
+ private lastTrackDuration;
34
+ private thumbnailProvider;
35
+ private canPlay;
36
+ private sourceLoadingCount;
37
+ private timelineStore?;
38
+ private timelineCommands?;
39
+ private timelineHistoryExecutor?;
40
+ private timelineHistoryRecorder?;
41
+ private timelinePresentationAdapter?;
42
+ private timelineTrackBridge?;
43
+ private timelinePlaybackResolver?;
44
+ private previewSession?;
45
+ private previewMountContainer;
46
+ private resolvedPreviewBackend;
47
+ private runtimePreviewBackendOverride;
48
+ private lastSelectedClipId;
49
+ private previewSourceLoadingCount;
50
+ private previewBuffering;
51
+ private pendingPreviewState;
52
+ private nextPendingPreviewSyncRequestId;
53
+ private activePreviewCallbackToken;
54
+ private previewAspectRatio;
55
+ private readonly bodyViewportScrollListener;
56
+ private readonly bodyCanvasHostClickListener;
57
+ private readonly rootWheelListener;
58
+ private mountManager;
59
+ private pendingDraftData;
60
+ constructor(config?: Partial<TimelineConfig>);
61
+ private getTimelineStore;
62
+ private getTimelineCommands;
63
+ private getTrackCollection;
64
+ private getTimelinePresentationAdapter;
65
+ private getTimelineTrackBridge;
66
+ private getTimelinePlaybackResolver;
67
+ private resolveConfiguredPreviewBackend;
68
+ private createPreviewBackendCallbacks;
69
+ private createPreviewBackend;
70
+ private isActivePreviewCallbackToken;
71
+ private getPreviewSession;
72
+ private getEventDispatcher;
73
+ private getDefaultTrackForHistory;
74
+ private getTimelineHistoryRecorder;
75
+ private getTimelineHistoryExecutor;
76
+ private get selectedClipId();
77
+ private set selectedClipId(value);
78
+ private ensureConfigState;
79
+ private getCurrentTimeState;
80
+ private getPlayStateState;
81
+ private setPlayStateState;
82
+ private getSpeedState;
83
+ private getZoomState;
84
+ private getDurationState;
85
+ private setDurationState;
86
+ private getScrollLeftState;
87
+ private setScrollLeftState;
88
+ private getScrollTopState;
89
+ private setScrollTopState;
90
+ private setViewportMetrics;
91
+ private syncCurrentTimeToScene;
92
+ private syncZoomToScene;
93
+ private syncScrollTopPresentation;
94
+ private refreshScrollbarMetrics;
95
+ private getTimeScaleHeight;
96
+ private getTrackContentTopOffset;
97
+ private getViewportWidth;
98
+ private getViewportHeight;
99
+ private getHorizontalContentWidth;
100
+ private getVerticalContentHeight;
101
+ private clampScrollLeft;
102
+ private clampScrollTop;
103
+ private syncScrollLeft;
104
+ private syncScrollTop;
105
+ private getResolvedTracksSnapshot;
106
+ private getPlaybackTracksSnapshot;
107
+ private buildPlaybackPlan;
108
+ private getPreviewAutoAspectRatioClipOrderMap;
109
+ private getNextPreviewAutoAspectRatioOrder;
110
+ private getAutoAspectRatioClip;
111
+ private registerPreviewAutoAspectRatioClip;
112
+ private syncPreviewSession;
113
+ private beginPendingPreview;
114
+ private updatePendingPreviewState;
115
+ private buildPreviewPendingState;
116
+ private ensurePendingPreviewTimeout;
117
+ private clearPendingPreviewTimeout;
118
+ private clearPendingPreviewState;
119
+ private resetPreviewRuntimeState;
120
+ private destroyPreviewSession;
121
+ private recreateDetachedPreviewSession;
122
+ private retryPendingPreview;
123
+ private handlePreviewBackendRuntimeError;
124
+ init(container: HTMLElement): void;
125
+ createTrack(type: TrackType, name?: string, insertionPlacement?: TrackInsertionPlacement, referenceTrackId?: string): string;
126
+ removeTrack(trackId: string): boolean;
127
+ renameTrack(trackId: string, newName: string): boolean;
128
+ getTracks(): any[];
129
+ initTrackInfoPanel(container: HTMLElement): void;
130
+ updateTrackInfoPanel(): void;
131
+ muteTrack(trackId: string, isMuted: boolean): boolean;
132
+ isTrackMuted(trackId: string): boolean;
133
+ private calculateTrackY;
134
+ private calculateTotalHeight;
135
+ private updateAllTrackPositions;
136
+ private cleanupEmptyTracks;
137
+ private clearAllTrackDropPreviews;
138
+ private showClipDropPreview;
139
+ private ensureTrackInsertionPreviewLine;
140
+ private refreshTrackInsertionPreview;
141
+ private showTrackInsertionPreview;
142
+ private hideTrackInsertionPreview;
143
+ private resolveTrackInsertionPreviewY;
144
+ private updateViewportLayout;
145
+ private renderBodyBackground;
146
+ private handleBodyBackgroundClick;
147
+ private handleBodyCanvasHostClick;
148
+ private ensureSnapGuideLine;
149
+ private refreshSnapGuideLine;
150
+ private updateSnapGuideLine;
151
+ private handleBodyViewportScroll;
152
+ private handleHorizontalDragAutoScroll;
153
+ private handleUnifiedWheel;
154
+ private normalizeWheelDelta;
155
+ private getPrimaryWheelDelta;
156
+ private isHorizontalWheelGesture;
157
+ private getHorizontalScrollDelta;
158
+ private handleWheelZoom;
159
+ private getWheelAnchorPointerX;
160
+ play(): void;
161
+ pause(): void;
162
+ togglePlay(): void;
163
+ private animate;
164
+ setCurrentTime(time: TimeMs): void;
165
+ getCurrentTime(): TimeMs;
166
+ setEnableClipSnap(enabled: boolean): void;
167
+ getEnableClipSnap(): boolean;
168
+ setZoom(zoom: number): void;
169
+ /**
170
+ * 以游标(playhead)为中心设置缩放,用于外置 slider 等非幕布上的缩放操作
171
+ * 调整 scrollLeft 使游标在屏幕上的位置保持不变
172
+ */
173
+ setZoomCenteredOnPlayhead(zoom: number): void;
174
+ /**
175
+ * 外部缩放入口:
176
+ * - 鼠标在时间轴内:以鼠标位置为中心缩放
177
+ * - 鼠标不在时间轴内:回退为以游标(playhead)为中心缩放
178
+ */
179
+ setZoomByInteraction(zoom: number): void;
180
+ /**
181
+ * 以时间轴上的指定像素点为中心缩放,保持该像素对应时间不变
182
+ */
183
+ setZoomCenteredOnTimelinePointer(zoom: number, pointerX: number): void;
184
+ getZoom(): number;
185
+ /**
186
+ * 设置播放倍速
187
+ * @param speed 播放倍速,默认为 1.0
188
+ */
189
+ setSpeed(speed: number): void;
190
+ /**
191
+ * 获取当前播放倍速
192
+ * @returns 当前播放倍速
193
+ */
194
+ getSpeed(): number;
195
+ /**
196
+ * 获取当前是否可以播放
197
+ * @returns 是否可以播放
198
+ */
199
+ getCanPlay(): boolean;
200
+ /**
201
+ * 当前是否存在视频源加载任务(例如 addClip 期间读取视频时长)
202
+ */
203
+ isSourceLoading(): boolean;
204
+ /**
205
+ * 获取视频源加载状态
206
+ */
207
+ getSourceLoadingState(): {
208
+ isLoading: boolean;
209
+ pending: number;
210
+ };
211
+ /**
212
+ * 设置缩略图提供器
213
+ * @param provider 缩略图提供器
214
+ */
215
+ setThumbnailProvider(provider: ThumbnailProvider): void;
216
+ /**
217
+ * 加载片段的封面
218
+ * @param clip 片段对象
219
+ * @returns Promise<boolean> 加载是否成功
220
+ */
221
+ private loadClipThumbnails;
222
+ /**
223
+ * 刷新指定片段的封面
224
+ * @param clipId 片段 ID
225
+ * @returns Promise<boolean> 刷新是否成功
226
+ */
227
+ refreshClipThumbnails(clipId: string): Promise<boolean>;
228
+ /**
229
+ * 刷新所有片段的封面
230
+ * @returns Promise<boolean[]> 每个片段的刷新结果
231
+ */
232
+ refreshAllClipThumbnails(): Promise<boolean[]>;
233
+ addClip(clipConfig: ClipConfig): Promise<string>;
234
+ /**
235
+ * 批量添加片段。批量模式下仅维护一段连续的视频源加载状态。
236
+ */
237
+ addClips(clipConfigs: ClipConfig[]): Promise<string[]>;
238
+ private addClipInternal;
239
+ removeClip(clipId: string): void;
240
+ updateClip(clipId: string, updates: Partial<Clip>): void;
241
+ splitClip(clipId: string, time: TimeMs): void;
242
+ splitCurrentClip(): void;
243
+ getClips(): Clip[];
244
+ private getExportComposition;
245
+ exportTimeline(): TimelineExportData;
246
+ importTimeline(data: TimelineExportData): Promise<void>;
247
+ getClipsData(): Clip[];
248
+ /**
249
+ * 获取插件版本号
250
+ */
251
+ getVersion(): string;
252
+ undo(): boolean;
253
+ redo(): boolean;
254
+ getHistoryState(): {
255
+ past: Action[];
256
+ future: Action[];
257
+ };
258
+ /** 调整缩放比例以适应当前所有片段 */
259
+ fitZoom(): void;
260
+ /** 删除轨道内clip 间的空隙 */
261
+ removeClipGaps(): void;
262
+ private handleTimeChange;
263
+ private handleScrollChange;
264
+ private handleClipUpdate;
265
+ private handleClipAdd;
266
+ private handleClipRemove;
267
+ /**
268
+ * 检查并重新加载关键帧(如果需要)
269
+ * @param clip 更新后的片段
270
+ * @param originalClip 原始片段
271
+ */
272
+ private reloadClipThumbnailsIfNeeded;
273
+ /**
274
+ * 更新 canPlay 状态
275
+ */
276
+ private updateCanPlayState;
277
+ private handleClipSplit;
278
+ private handleClipSelect;
279
+ private handleActionUndo;
280
+ private handleActionRedo;
281
+ on(event: TimelineEvent, listener: TimelineEventListener): void;
282
+ off(event: TimelineEvent, listener: TimelineEventListener): void;
283
+ private emitEvent;
284
+ private emitSelectedClipChangeIfNeeded;
285
+ private beginSourceLoading;
286
+ private endSourceLoading;
287
+ private handleClipOverlap;
288
+ private handleClipCrossTrackPreview;
289
+ private handleClipCrossTrack;
290
+ getPlayState(): PlayState;
291
+ setDuration(duration: TimeMs): void;
292
+ getDuration(): TimeMs;
293
+ /**
294
+ * 调整时间轴大小以适配容器
295
+ * @param width 新的宽度
296
+ * @param height 新的高度
297
+ */
298
+ resize(width: number, height: number): void;
299
+ /**
300
+ * 滚动到指定时间
301
+ * @param time 目标时间(毫秒)
302
+ * @param setCurrentTime 是否同时将当前时间设置为该时间点,默认为 false
303
+ */
304
+ scrollToTime(time: TimeMs, setCurrentTime?: boolean): void;
305
+ /**
306
+ * 选择指定的片段
307
+ * @param clipId 目标片段的 ID
308
+ */
309
+ private notifySelectionChange;
310
+ selectClip(clipId: string, clip?: any): void;
311
+ /**
312
+ * 清空所有轨道的选中状态
313
+ */
314
+ clearSelection(): void;
315
+ /**
316
+ * 滚动到指定片段
317
+ * @param clipId 目标片段的 ID
318
+ * @param options 配置选项
319
+ */
320
+ scrollToClip(clipId: string, options?: {
321
+ selectClip?: boolean;
322
+ setCurrentTime?: boolean;
323
+ }): void;
324
+ /**
325
+ * 获取当前时间点所在的clip
326
+ * @returns 当前时间点所在的clip,如果没有则返回null
327
+ */
328
+ /**
329
+ * 获取当前选中的 clip
330
+ * @returns 当前选中的 clip,如果没有则返回 null
331
+ */
332
+ getSelectedClip(): Clip | null;
333
+ getCurrentActiveClips(): ActiveClipPlaybackInfo[];
334
+ getCurrentPlaybackPlan(): ResolvedPlaybackPlan;
335
+ getPlaybackPlanAtTime(time: TimeMs): ResolvedPlaybackPlan;
336
+ getActiveClipsAtTime(time: TimeMs): ActiveClipPlaybackInfo[];
337
+ attachPreview(containerOrConfig: HTMLElement | PreviewMountConfig): void;
338
+ detachPreview(): void;
339
+ attachClipConfig(container: HTMLElement): TimelineClipConfigController;
340
+ getPreviewBackendType(): Exclude<PreviewBackendType, 'auto'>;
341
+ getPreviewAspectRatio(): PreviewAspectRatio;
342
+ setPreviewAspectRatio(aspectRatio: {
343
+ width: number;
344
+ height: number;
345
+ }): void;
346
+ resetPreviewAspectRatioToAuto(): void;
347
+ /**
348
+ * 删除当前选中的 clip
349
+ * @returns 是否成功删除了选中的 clip
350
+ */
351
+ removeSelectedClip(): boolean;
352
+ canSeparateClipAudio(clipId: string): boolean;
353
+ canRestoreClipAudio(clipId: string): boolean;
354
+ separateClipAudio(clipId: string): Promise<string | null>;
355
+ restoreClipAudio(clipId: string): boolean;
356
+ /**
357
+ * 将片段从一个轨道移动到另一个轨道
358
+ * @param clipId 要移动的片段 ID
359
+ * @param targetTrackId 目标轨道 ID
360
+ * @returns 是否成功移动
361
+ */
362
+ moveClipToTrack(clipId: string, targetTrackId: string): boolean;
363
+ private moveClipToTrackWithHistorySnapshot;
364
+ /**
365
+ * 获取轨道内的总时长(包含空隙)
366
+ * @returns 从0到最后一个clip结束时间的总时长(毫秒)
367
+ */
368
+ getTrackTotalDuration(): TimeMs;
369
+ destroy(): void;
370
+ /** 清除历史堆栈 */
371
+ clearHistory(): void;
372
+ private handleClipChange;
373
+ private addClipToTrack;
374
+ private cloneTrackSnapshot;
375
+ private ensureTrackFromHistorySnapshot;
376
+ private resolveTrackIdByClipId;
377
+ private findTrackByClipId;
378
+ /**
379
+ * 检查轨道总时长是否变化,如果变化则触发事件并更新时间轴时长
380
+ */
381
+ private checkTrackDurationChange;
382
+ private resolveSelectedClipSnapshot;
383
+ private commitPreviewVisualTransform;
384
+ clearAllTracksAndClips(): void;
385
+ }
@@ -1,4 +1,4 @@
1
- import { Action, HistoryState } from './types';
1
+ import { Action, Clip, ClipStateUpdate, HistoryState, MoveClipBetweenTracksAction, MoveClipAction, MultiClipUpdateAction, RemoveClipAction, RemoveGapsAction, RestoreClipAudioAction, ResizeClipAction, SeparateClipAudioAction, SetTimeAction, SplitClipAction, Track, UpdateClipAction, AddClipAction } from '../models/types';
2
2
  export declare class HistoryManager {
3
3
  private state;
4
4
  private maxHistorySize;
@@ -37,41 +37,43 @@ export declare class HistoryManager {
37
37
  /**
38
38
  * 创建添加片段操作
39
39
  */
40
- createAddClipAction(clip: any): Action;
40
+ createAddClipAction(clip: Clip): AddClipAction;
41
41
  /**
42
42
  * 创建移除片段操作
43
43
  */
44
- createRemoveClipAction(clip: any): Action;
44
+ createRemoveClipAction(clip: Clip): RemoveClipAction;
45
45
  /**
46
46
  * 创建更新片段操作
47
47
  */
48
- createUpdateClipAction(clipId: string, updates: any, previousState: any): Action;
48
+ createUpdateClipAction(clipId: string, updates: Partial<Clip>, previousState: Partial<Clip>): UpdateClipAction;
49
49
  /**
50
50
  * 创建分割片段操作
51
51
  */
52
- createSplitClipAction(originalClip: any, clip1: any, clip2: any): Action;
52
+ createSplitClipAction(originalClip: Clip, clip1: Clip, clip2: Clip): SplitClipAction;
53
53
  /**
54
54
  * 创建移动片段操作
55
55
  */
56
- createMoveClipAction(clipId: string, newStartTime: number, previousStartTime: number): Action;
56
+ createMoveClipAction(clipId: string, newStartTime: number, previousStartTime: number): MoveClipAction;
57
57
  /**
58
58
  * 创建调整片段大小操作
59
59
  */
60
- createResizeClipAction(clipId: string, newDuration: number, newStartTime: number, previousDuration: number, previousStartTime: number): Action;
60
+ createResizeClipAction(clipId: string, newDuration: number, newStartTime: number, previousDuration: number, previousStartTime: number): ResizeClipAction;
61
61
  /**
62
62
  * 创建设置时间操作
63
63
  */
64
- createSetTimeAction(newTime: number, previousTime: number): Action;
64
+ createSetTimeAction(newTime: number, previousTime: number): SetTimeAction;
65
65
  /**
66
66
  * 创建移除间隙操作
67
67
  */
68
- createRemoveGapsAction(clipsBefore: any[]): Action;
68
+ createRemoveGapsAction(clipsBefore: Clip[]): RemoveGapsAction;
69
69
  /**
70
70
  * 创建多个片段同时更新操作
71
71
  */
72
- createMultiClipUpdateAction(clipUpdates: Array<{
73
- clipId: string;
74
- newState: any;
75
- previousState: any;
76
- }>): Action;
72
+ createMultiClipUpdateAction(clipUpdates: ClipStateUpdate[]): MultiClipUpdateAction;
73
+ /**
74
+ * 创建跨轨道移动片段操作
75
+ */
76
+ createMoveClipBetweenTracksAction(clipId: string, sourceTrackId: string, targetTrackId: string, clipBefore: Clip, clipAfter: Clip, sourceTrackSnapshot: Track | null, targetTrackSnapshot: Track | null): MoveClipBetweenTracksAction;
77
+ createSeparateClipAudioAction(videoClipBefore: Clip, videoClipAfter: Clip, audioClip: Clip | null, audioTrackId: string | null): SeparateClipAudioAction;
78
+ createRestoreClipAudioAction(videoClipBefore: Clip, videoClipAfter: Clip, audioClip: Clip | null, audioTrackId: string | null): RestoreClipAudioAction;
77
79
  }
@@ -0,0 +1,3 @@
1
+ export { HistoryManager } from './history';
2
+ export { TimelineHistoryExecutor } from './timelineHistoryExecutor';
3
+ export { TimelineHistoryRecorder } from './timelineHistoryRecorder';
@@ -0,0 +1,23 @@
1
+ import type { Action, Clip, Track } from '../models/types';
2
+ export interface TimelineHistoryExecutionTrack {
3
+ addClip(clip: Clip): void;
4
+ }
5
+ export interface TimelineHistoryExecutionTarget {
6
+ removeClip(clipId: string): void;
7
+ addClipToTrack(trackId: string, clip: Clip): boolean;
8
+ updateClip(clipId: string, updates: Partial<Clip>): void;
9
+ moveClipToTrack(clipId: string, targetTrackId: string): boolean;
10
+ ensureTrackFromHistorySnapshot(trackSnapshot: Track): string | null;
11
+ removeClipGaps(): void;
12
+ getClips(): Clip[];
13
+ findTrackByClipId(clipId: string): TimelineHistoryExecutionTrack | null;
14
+ getDefaultTrack(): TimelineHistoryExecutionTrack | null;
15
+ loadClipThumbnails?(clip: Clip): Promise<boolean> | void;
16
+ }
17
+ export declare class TimelineHistoryExecutor {
18
+ private readonly target;
19
+ constructor(target: TimelineHistoryExecutionTarget);
20
+ executeUndo(action: Action): void;
21
+ executeRedo(action: Action): void;
22
+ private restoreMovedClip;
23
+ }
@@ -0,0 +1,15 @@
1
+ import { HistoryManager } from '../history/history';
2
+ import type { Action, Clip, ClipStateUpdate, Track } from '../models/types';
3
+ export declare class TimelineHistoryRecorder {
4
+ private readonly history;
5
+ constructor(history: HistoryManager);
6
+ recordAddClip(clip: Clip): Action;
7
+ recordRemoveClip(clip: Clip): Action;
8
+ recordClipUpdate(clip: Clip, originalClip?: Clip, clipUpdates?: ClipStateUpdate[]): Action | null;
9
+ recordSplitClip(clip1: Clip, clip2: Clip): Action;
10
+ recordRemoveGaps(clipsBefore: Clip[]): Action | null;
11
+ recordMoveClipBetweenTracks(clipId: string, sourceTrackId: string, targetTrackId: string, clipBefore: Clip, clipAfter: Clip, sourceTrackSnapshot: Track | null, targetTrackSnapshot: Track | null): Action;
12
+ recordSeparateClipAudio(videoClipBefore: Clip, videoClipAfter: Clip, audioClip: Clip | null, audioTrackId: string | null): Action;
13
+ recordRestoreClipAudio(videoClipBefore: Clip, videoClipAfter: Clip, audioClip: Clip | null, audioTrackId: string | null): Action;
14
+ private createClipUpdateAction;
15
+ }
@@ -0,0 +1 @@
1
+ export * from './timelineTrackLayout';
@@ -0,0 +1,22 @@
1
+ import type { Theme } from '../models/types';
2
+ export declare const TIMELINE_MANAGER_LEFT_PANEL_WIDTH = 200;
3
+ export declare const TIMELINE_MANAGER_SCROLLBAR_SIZE = 8;
4
+ export interface TimelineManagerLayoutElements {
5
+ headerCorner: HTMLDivElement;
6
+ headerViewport: HTMLDivElement;
7
+ headerCanvasHost: HTMLDivElement;
8
+ trackInfoViewport: HTMLDivElement;
9
+ bodyViewport: HTMLDivElement;
10
+ bodyCanvasHost: HTMLDivElement;
11
+ verticalScrollbarCanvasHost: HTMLDivElement;
12
+ horizontalScrollbarCanvasHost: HTMLDivElement;
13
+ playheadOverlay: HTMLDivElement;
14
+ }
15
+ export interface CreateTimelineManagerLayoutOptions {
16
+ theme: Theme;
17
+ timeScaleHeight: number;
18
+ leftPanelWidth?: number;
19
+ scrollbarSize?: number;
20
+ }
21
+ export declare function ensureTimelineManagerStyles(): void;
22
+ export declare function createTimelineManagerLayout(container: HTMLElement, options: CreateTimelineManagerLayoutOptions): TimelineManagerLayoutElements;
@@ -0,0 +1,10 @@
1
+ import { Track, TrackType } from '../models/types';
2
+ export interface TrackLayout {
3
+ trackId: string;
4
+ y: number;
5
+ height: number;
6
+ }
7
+ export declare function getTrackHeightByType(type: TrackType): number;
8
+ export declare function calculateTrackY(tracks: Track[], trackId: string, timeScaleHeight: number): number;
9
+ export declare function calculateTotalTrackHeight(tracks: Track[], timeScaleHeight: number): number;
10
+ export declare function buildTrackLayouts(tracks: Track[], timeScaleHeight: number): TrackLayout[];
@@ -0,0 +1,3 @@
1
+ import type { Clip, ClipEntity, ClipViewState } from '../models/types';
2
+ export declare function createClipViewState(overrides?: Partial<ClipViewState>): ClipViewState;
3
+ export declare function createClipWithViewState(clip: ClipEntity, viewState?: Partial<ClipViewState>): Clip;
@@ -20,3 +20,7 @@ export declare const TIME_SCALE: {
20
20
  };
21
21
  export declare const TIMELINE_LEFT_PADDING = 15;
22
22
  export declare const MIN_CLIP_LINE_WIDTH = 6;
23
+ export declare const TRACK_HEIGHT: {
24
+ VIDEO: number;
25
+ AUDIO: number;
26
+ };
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './constants';
3
+ export * from './clipState';