@flycut/timeline-kit 0.0.0-stage → 0.2.1
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 +661 -0
- package/README.md +227 -2
- package/dist/chunks/TimelineEditor-ZMbJ8-ee.js +2051 -0
- package/dist/chunks/TimelineEditor-ZMbJ8-ee.js.map +1 -0
- package/dist/chunks/index-KK9cAE8q.js +661 -0
- package/dist/chunks/index-KK9cAE8q.js.map +1 -0
- package/dist/chunks/interactionManager-JoPxZ8st.js +775 -0
- package/dist/chunks/interactionManager-JoPxZ8st.js.map +1 -0
- package/dist/chunks/otio-6KO_Tfi1.js +510 -0
- package/dist/chunks/otio-6KO_Tfi1.js.map +1 -0
- package/dist/core.js +1673 -0
- package/dist/core.js.map +1 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/otio.js +313 -0
- package/dist/otio.js.map +1 -0
- package/dist/plugins.js +243 -0
- package/dist/plugins.js.map +1 -0
- package/dist/react.js +259 -0
- package/dist/react.js.map +1 -0
- package/dist/types/adapters/react/index.d.ts +45 -0
- package/dist/types/adapters/vue/index.d.ts +202 -0
- package/dist/types/src/adapters/otio.d.ts +7 -0
- package/dist/types/src/core-entry.d.ts +8 -0
- package/dist/types/src/editor/TimelineEditor.d.ts +96 -0
- package/dist/types/src/editor/index.d.ts +2 -0
- package/dist/types/src/editor/types.d.ts +30 -0
- package/dist/types/src/engine/hitTest.d.ts +23 -0
- package/dist/types/src/engine/index.d.ts +7 -0
- package/dist/types/src/engine/layout.d.ts +47 -0
- package/dist/types/src/engine/magnet.d.ts +46 -0
- package/dist/types/src/engine/placement.d.ts +13 -0
- package/dist/types/src/engine/snap.d.ts +28 -0
- package/dist/types/src/engine/timeScale.d.ts +12 -0
- package/dist/types/src/engine/virtualization.d.ts +11 -0
- package/dist/types/src/frameworks/slotBridge.d.ts +13 -0
- package/dist/types/src/index.d.ts +10 -0
- package/dist/types/src/model/demoDocument.d.ts +3 -0
- package/dist/types/src/model/index.d.ts +4 -0
- package/dist/types/src/model/operations.d.ts +77 -0
- package/dist/types/src/model/structuralSharing.d.ts +11 -0
- package/dist/types/src/model/types.d.ts +55 -0
- package/dist/types/src/otio-core/commands/create.d.ts +6 -0
- package/dist/types/src/otio-core/commands/helpers.d.ts +5 -0
- package/dist/types/src/otio-core/commands/insert.d.ts +2 -0
- package/dist/types/src/otio-core/commands/move.d.ts +2 -0
- package/dist/types/src/otio-core/commands/split.d.ts +2 -0
- package/dist/types/src/otio-core/commands/trim.d.ts +3 -0
- package/dist/types/src/otio-core/flycut-otio-draft.d.ts +239 -0
- package/dist/types/src/otio-core/guards.d.ts +5 -0
- package/dist/types/src/otio-core/index.d.ts +14 -0
- package/dist/types/src/otio-core/media/clipMetadata.d.ts +18 -0
- package/dist/types/src/otio-core/media/reference.d.ts +9 -0
- package/dist/types/src/otio-core/selectors/clip.d.ts +4 -0
- package/dist/types/src/otio-core/selectors/timeline.d.ts +5 -0
- package/dist/types/src/otio-core/selectors/track.d.ts +8 -0
- package/dist/types/src/otio-core/types.d.ts +61 -0
- package/dist/types/src/otio-entry.d.ts +2 -0
- package/dist/types/src/plugins/clipDragPlugin.d.ts +2 -0
- package/dist/types/src/plugins/clipTrimPlugin.d.ts +2 -0
- package/dist/types/src/plugins/externalDropPlugin.d.ts +13 -0
- package/dist/types/src/plugins/index.d.ts +17 -0
- package/dist/types/src/plugins/interactionManager.d.ts +33 -0
- package/dist/types/src/plugins/marqueeSelectPlugin.d.ts +2 -0
- package/dist/types/src/plugins/playheadPlugin.d.ts +2 -0
- package/dist/types/src/plugins/selectionPlugin.d.ts +2 -0
- package/dist/types/src/plugins/shortcutsPlugin.d.ts +7 -0
- package/dist/types/src/plugins/snapProviders.d.ts +9 -0
- package/dist/types/src/plugins/types.d.ts +110 -0
- package/dist/types/src/plugins/wheelPlugin.d.ts +2 -0
- package/dist/types/src/plugins-entry.d.ts +1 -0
- package/dist/types/src/renderer/domRenderer.d.ts +73 -0
- package/dist/types/src/renderer/index.d.ts +6 -0
- package/dist/types/src/renderer/ruler.d.ts +18 -0
- package/dist/types/src/renderer/styles.d.ts +1 -0
- package/dist/types/src/renderer/types.d.ts +65 -0
- package/dist/types/src/renderer/ui/icons.d.ts +7 -0
- package/dist/types/src/renderer/ui/sidebar.d.ts +14 -0
- package/dist/types/src/renderer/ui/toolbar.d.ts +16 -0
- package/dist/types/src/store/builtinCommands.d.ts +56 -0
- package/dist/types/src/store/commandBus.d.ts +18 -0
- package/dist/types/src/store/index.d.ts +4 -0
- package/dist/types/src/store/store.d.ts +53 -0
- package/dist/types/src/store/types.d.ts +59 -0
- package/dist/types/src/utils/trimOffset.d.ts +9 -0
- package/dist/vue.js +278 -0
- package/dist/vue.js.map +1 -0
- package/package.json +111 -4
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { type PropType, type VNode, type Ref, type ShallowRef } from 'vue';
|
|
2
|
+
import type { Timeline as OtioTimeline } from '../../src/otio-core/index.js';
|
|
3
|
+
import { TimelineEditor as VanillaTimelineEditor, type BeforeCommandHook, type EditPolicies, type HistoryMode, type KeyBinding, type MediaProvider, type ThemeMode, type TimelineDocument, type TimelinePlugin, type TimelineRenderHints, type TimelineState, type ToolbarConfig, type TrackConfigMap, type UIConfig } from '../../src/index.js';
|
|
4
|
+
export declare function useTimelineSelector<TSelected>(editorRef: Ref<VanillaTimelineEditor | null>, selector: (state: TimelineState) => TSelected): ShallowRef<TSelected | undefined>;
|
|
5
|
+
export declare const TimelineEditor: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
6
|
+
document: {
|
|
7
|
+
type: PropType<TimelineDocument>;
|
|
8
|
+
default: undefined;
|
|
9
|
+
};
|
|
10
|
+
timeline: {
|
|
11
|
+
type: PropType<TimelineDocument | OtioTimeline>;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
14
|
+
fps: {
|
|
15
|
+
type: NumberConstructor;
|
|
16
|
+
default: undefined;
|
|
17
|
+
};
|
|
18
|
+
currentFrame: {
|
|
19
|
+
type: NumberConstructor;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
trackScale: {
|
|
23
|
+
type: NumberConstructor;
|
|
24
|
+
default: undefined;
|
|
25
|
+
};
|
|
26
|
+
isMagnetEnabled: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: undefined;
|
|
29
|
+
};
|
|
30
|
+
trackConfigs: {
|
|
31
|
+
type: PropType<TrackConfigMap>;
|
|
32
|
+
default: undefined;
|
|
33
|
+
};
|
|
34
|
+
toolsConfigs: {
|
|
35
|
+
type: PropType<ToolbarConfig[]>;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
ui: {
|
|
39
|
+
type: PropType<UIConfig>;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
theme: {
|
|
43
|
+
type: PropType<ThemeMode>;
|
|
44
|
+
default: undefined;
|
|
45
|
+
};
|
|
46
|
+
injectStyles: {
|
|
47
|
+
type: BooleanConstructor;
|
|
48
|
+
default: boolean;
|
|
49
|
+
};
|
|
50
|
+
policies: {
|
|
51
|
+
type: PropType<Partial<EditPolicies>>;
|
|
52
|
+
default: undefined;
|
|
53
|
+
};
|
|
54
|
+
history: {
|
|
55
|
+
type: PropType<HistoryMode>;
|
|
56
|
+
default: undefined;
|
|
57
|
+
};
|
|
58
|
+
plugins: {
|
|
59
|
+
type: PropType<TimelinePlugin[]>;
|
|
60
|
+
default: undefined;
|
|
61
|
+
};
|
|
62
|
+
disableDefaultPlugins: {
|
|
63
|
+
type: BooleanConstructor;
|
|
64
|
+
default: boolean;
|
|
65
|
+
};
|
|
66
|
+
shortcuts: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
70
|
+
keymap: {
|
|
71
|
+
type: PropType<Record<string, KeyBinding | null>>;
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
mediaProvider: {
|
|
75
|
+
type: PropType<MediaProvider>;
|
|
76
|
+
default: undefined;
|
|
77
|
+
};
|
|
78
|
+
renderHints: {
|
|
79
|
+
type: PropType<Partial<TimelineRenderHints>>;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
82
|
+
onBeforeCommand: {
|
|
83
|
+
type: PropType<BeforeCommandHook>;
|
|
84
|
+
default: undefined;
|
|
85
|
+
};
|
|
86
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("command" | "selectionchange" | "documentchange" | "timelinechange" | "currentframechange" | "trackscalechange" | "magnetchange" | "update:document" | "update:currentFrame" | "update:trackScale" | "ready")[], "command" | "selectionchange" | "documentchange" | "timelinechange" | "currentframechange" | "trackscalechange" | "magnetchange" | "update:document" | "update:currentFrame" | "update:trackScale" | "ready", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
89
|
+
document: {
|
|
90
|
+
type: PropType<TimelineDocument>;
|
|
91
|
+
default: undefined;
|
|
92
|
+
};
|
|
93
|
+
timeline: {
|
|
94
|
+
type: PropType<TimelineDocument | OtioTimeline>;
|
|
95
|
+
default: undefined;
|
|
96
|
+
};
|
|
97
|
+
fps: {
|
|
98
|
+
type: NumberConstructor;
|
|
99
|
+
default: undefined;
|
|
100
|
+
};
|
|
101
|
+
currentFrame: {
|
|
102
|
+
type: NumberConstructor;
|
|
103
|
+
default: undefined;
|
|
104
|
+
};
|
|
105
|
+
trackScale: {
|
|
106
|
+
type: NumberConstructor;
|
|
107
|
+
default: undefined;
|
|
108
|
+
};
|
|
109
|
+
isMagnetEnabled: {
|
|
110
|
+
type: BooleanConstructor;
|
|
111
|
+
default: undefined;
|
|
112
|
+
};
|
|
113
|
+
trackConfigs: {
|
|
114
|
+
type: PropType<TrackConfigMap>;
|
|
115
|
+
default: undefined;
|
|
116
|
+
};
|
|
117
|
+
toolsConfigs: {
|
|
118
|
+
type: PropType<ToolbarConfig[]>;
|
|
119
|
+
default: undefined;
|
|
120
|
+
};
|
|
121
|
+
ui: {
|
|
122
|
+
type: PropType<UIConfig>;
|
|
123
|
+
default: undefined;
|
|
124
|
+
};
|
|
125
|
+
theme: {
|
|
126
|
+
type: PropType<ThemeMode>;
|
|
127
|
+
default: undefined;
|
|
128
|
+
};
|
|
129
|
+
injectStyles: {
|
|
130
|
+
type: BooleanConstructor;
|
|
131
|
+
default: boolean;
|
|
132
|
+
};
|
|
133
|
+
policies: {
|
|
134
|
+
type: PropType<Partial<EditPolicies>>;
|
|
135
|
+
default: undefined;
|
|
136
|
+
};
|
|
137
|
+
history: {
|
|
138
|
+
type: PropType<HistoryMode>;
|
|
139
|
+
default: undefined;
|
|
140
|
+
};
|
|
141
|
+
plugins: {
|
|
142
|
+
type: PropType<TimelinePlugin[]>;
|
|
143
|
+
default: undefined;
|
|
144
|
+
};
|
|
145
|
+
disableDefaultPlugins: {
|
|
146
|
+
type: BooleanConstructor;
|
|
147
|
+
default: boolean;
|
|
148
|
+
};
|
|
149
|
+
shortcuts: {
|
|
150
|
+
type: BooleanConstructor;
|
|
151
|
+
default: boolean;
|
|
152
|
+
};
|
|
153
|
+
keymap: {
|
|
154
|
+
type: PropType<Record<string, KeyBinding | null>>;
|
|
155
|
+
default: undefined;
|
|
156
|
+
};
|
|
157
|
+
mediaProvider: {
|
|
158
|
+
type: PropType<MediaProvider>;
|
|
159
|
+
default: undefined;
|
|
160
|
+
};
|
|
161
|
+
renderHints: {
|
|
162
|
+
type: PropType<Partial<TimelineRenderHints>>;
|
|
163
|
+
default: undefined;
|
|
164
|
+
};
|
|
165
|
+
onBeforeCommand: {
|
|
166
|
+
type: PropType<BeforeCommandHook>;
|
|
167
|
+
default: undefined;
|
|
168
|
+
};
|
|
169
|
+
}>> & Readonly<{
|
|
170
|
+
onCommand?: ((...args: any[]) => any) | undefined;
|
|
171
|
+
onReady?: ((...args: any[]) => any) | undefined;
|
|
172
|
+
onSelectionchange?: ((...args: any[]) => any) | undefined;
|
|
173
|
+
onDocumentchange?: ((...args: any[]) => any) | undefined;
|
|
174
|
+
onTimelinechange?: ((...args: any[]) => any) | undefined;
|
|
175
|
+
onCurrentframechange?: ((...args: any[]) => any) | undefined;
|
|
176
|
+
onTrackscalechange?: ((...args: any[]) => any) | undefined;
|
|
177
|
+
onMagnetchange?: ((...args: any[]) => any) | undefined;
|
|
178
|
+
"onUpdate:document"?: ((...args: any[]) => any) | undefined;
|
|
179
|
+
"onUpdate:currentFrame"?: ((...args: any[]) => any) | undefined;
|
|
180
|
+
"onUpdate:trackScale"?: ((...args: any[]) => any) | undefined;
|
|
181
|
+
}>, {
|
|
182
|
+
fps: number;
|
|
183
|
+
theme: ThemeMode;
|
|
184
|
+
trackConfigs: TrackConfigMap;
|
|
185
|
+
injectStyles: boolean;
|
|
186
|
+
mediaProvider: MediaProvider;
|
|
187
|
+
shortcuts: boolean;
|
|
188
|
+
document: TimelineDocument<Record<string, unknown>, Record<string, unknown>>;
|
|
189
|
+
timeline: TimelineDocument<Record<string, unknown>, Record<string, unknown>> | OtioTimeline;
|
|
190
|
+
currentFrame: number;
|
|
191
|
+
trackScale: number;
|
|
192
|
+
isMagnetEnabled: boolean;
|
|
193
|
+
toolsConfigs: ToolbarConfig[];
|
|
194
|
+
ui: UIConfig;
|
|
195
|
+
policies: Partial<EditPolicies>;
|
|
196
|
+
history: HistoryMode;
|
|
197
|
+
plugins: TimelinePlugin[];
|
|
198
|
+
disableDefaultPlugins: boolean;
|
|
199
|
+
keymap: Record<string, KeyBinding | null>;
|
|
200
|
+
renderHints: Partial<TimelineRenderHints>;
|
|
201
|
+
onBeforeCommand: BeforeCommandHook;
|
|
202
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Timeline as OtioTimeline } from '../otio-core/index.js';
|
|
2
|
+
import type { TimelineDocument } from '../model/types.js';
|
|
3
|
+
export declare function isOtioTimeline(value: unknown): value is OtioTimeline;
|
|
4
|
+
export declare function fromOtioTimeline(timeline: OtioTimeline): TimelineDocument;
|
|
5
|
+
export declare function toOtioTimeline(doc: TimelineDocument): OtioTimeline;
|
|
6
|
+
export declare const OTIO_DEMO_FPS = 24;
|
|
7
|
+
export declare const otioDemoTimeline: OtioTimeline;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './model/index.js';
|
|
2
|
+
export * from './engine/index.js';
|
|
3
|
+
export * from './store/index.js';
|
|
4
|
+
export * from './plugins/types.js';
|
|
5
|
+
export { InteractionManager, matchesKeyChord } from './plugins/interactionManager.js';
|
|
6
|
+
export { createSlotBridge, type SlotBridge, type SlotPortalEntry } from './frameworks/slotBridge.js';
|
|
7
|
+
export { isOtioTimeline, fromOtioTimeline, toOtioTimeline } from './adapters/otio.js';
|
|
8
|
+
export type { SlotHandle, SlotRenderer, SlotRendererFn, SlotRendererObject, ClipRenderContext, TrackHeaderContext, TrackConfig, TrackConfigMap, ToolbarContext, ToolbarConfig, SidebarConfig, UIConfig, MediaProvider, } from './renderer/types.js';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { Timeline as OtioTimeline } from '../otio-core/index.js';
|
|
2
|
+
import { type EditPolicies, type TimelineDocument } from '../model/types.js';
|
|
3
|
+
import { type TimelinePlugin } from '../plugins/index.js';
|
|
4
|
+
import type { MediaProvider, ToolbarConfig, TrackConfigMap, UIConfig } from '../renderer/types.js';
|
|
5
|
+
import type { BeforeCommandHook, CommandSpec, HistoryMode, ThemeMode, TimelineRenderHints, TimelineState, TimelineStateChange } from '../store/types.js';
|
|
6
|
+
import type { TimelineEditorOptions, TimelineEditorSnapshot, TimelineSelectionInput } from './types.js';
|
|
7
|
+
export declare class TimelineEditor extends EventTarget {
|
|
8
|
+
private readonly container;
|
|
9
|
+
private readonly store;
|
|
10
|
+
private readonly commands;
|
|
11
|
+
private readonly renderer;
|
|
12
|
+
private readonly interactions;
|
|
13
|
+
private policies;
|
|
14
|
+
private uiConfig;
|
|
15
|
+
private resizeObserver;
|
|
16
|
+
private destroyed;
|
|
17
|
+
private readonly onPointerDownRef;
|
|
18
|
+
private readonly onFocusInRef;
|
|
19
|
+
private readonly onPointerMoveRef;
|
|
20
|
+
private readonly onPointerUpRef;
|
|
21
|
+
private readonly onPointerCancelRef;
|
|
22
|
+
private readonly onWheelRef;
|
|
23
|
+
private readonly onClickRef;
|
|
24
|
+
private readonly onInputRef;
|
|
25
|
+
private readonly onScrollRef;
|
|
26
|
+
private readonly onDragOverRef;
|
|
27
|
+
private readonly onDragLeaveRef;
|
|
28
|
+
private readonly onDropRef;
|
|
29
|
+
private readonly onKeyDownRef;
|
|
30
|
+
private readonly onKeyUpRef;
|
|
31
|
+
private readonly onWindowResizeRef;
|
|
32
|
+
private readonly unsubscribeStore;
|
|
33
|
+
private readonly unsubscribeAfterCommand;
|
|
34
|
+
constructor(container: HTMLElement, options?: TimelineEditorOptions);
|
|
35
|
+
getDocument(): TimelineDocument;
|
|
36
|
+
setDocument(doc: TimelineDocument, options?: {
|
|
37
|
+
pushHistory?: boolean;
|
|
38
|
+
}): void;
|
|
39
|
+
getTimeline(): TimelineDocument;
|
|
40
|
+
setTimeline(timeline: TimelineDocument | OtioTimeline, options?: {
|
|
41
|
+
pushHistory?: boolean;
|
|
42
|
+
}): void;
|
|
43
|
+
getOtioTimeline(): OtioTimeline;
|
|
44
|
+
getCurrentFrame(): number;
|
|
45
|
+
setCurrentFrame(frame: number): void;
|
|
46
|
+
getTrackScale(): number;
|
|
47
|
+
setTrackScale(scale: number, renderHints?: Partial<TimelineRenderHints>): void;
|
|
48
|
+
fitToView(): number | null;
|
|
49
|
+
scrollToTime(ms: number): void;
|
|
50
|
+
setSelection(selection: TimelineSelectionInput): void;
|
|
51
|
+
clearSelection(): void;
|
|
52
|
+
setMagnetEnabled(enabled: boolean): void;
|
|
53
|
+
setHistoryMode(mode: HistoryMode): void;
|
|
54
|
+
setExternalHistoryState(flags: {
|
|
55
|
+
canUndo?: boolean;
|
|
56
|
+
canRedo?: boolean;
|
|
57
|
+
}): void;
|
|
58
|
+
setTrackConfigs(trackConfigs: TrackConfigMap | undefined): void;
|
|
59
|
+
setToolsConfigs(toolsConfigs: ToolbarConfig[] | undefined): void;
|
|
60
|
+
setUI(ui: UIConfig): void;
|
|
61
|
+
setTheme(theme: ThemeMode): void;
|
|
62
|
+
setPolicies(policies: Partial<EditPolicies>): void;
|
|
63
|
+
setRenderHints(renderHints: Partial<TimelineRenderHints>): void;
|
|
64
|
+
setMediaProvider(provider: MediaProvider | undefined): void;
|
|
65
|
+
exec(command: string, payload?: unknown): boolean;
|
|
66
|
+
canExecute(command: string, payload?: unknown): boolean;
|
|
67
|
+
registerCommand<TPayload = any>(type: string, spec: CommandSpec<TPayload>): () => void;
|
|
68
|
+
onBeforeCommand(hook: BeforeCommandHook): () => void;
|
|
69
|
+
use(plugin: TimelinePlugin): () => void;
|
|
70
|
+
removePlugin(name: string): boolean;
|
|
71
|
+
getState(): TimelineState;
|
|
72
|
+
getSnapshot(): TimelineEditorSnapshot;
|
|
73
|
+
subscribe(listener: (change: TimelineStateChange) => void): () => void;
|
|
74
|
+
subscribeSelector<TSelected>(selector: (state: TimelineState) => TSelected, listener: (selected: TSelected, prevSelected: TSelected) => void, isEqual?: (a: TSelected, b: TSelected) => boolean): () => void;
|
|
75
|
+
resize(): void;
|
|
76
|
+
destroy(): void;
|
|
77
|
+
private bindEvents;
|
|
78
|
+
private unbindEvents;
|
|
79
|
+
private handleStateChange;
|
|
80
|
+
private emitStateEvent;
|
|
81
|
+
private emitCommandEvent;
|
|
82
|
+
private markActive;
|
|
83
|
+
private onPointerDown;
|
|
84
|
+
private onPointerMove;
|
|
85
|
+
private onPointerUp;
|
|
86
|
+
private onWheel;
|
|
87
|
+
private onDragOver;
|
|
88
|
+
private onDrop;
|
|
89
|
+
private onClick;
|
|
90
|
+
private onInput;
|
|
91
|
+
private onKeyDown;
|
|
92
|
+
private onKeyUp;
|
|
93
|
+
private shouldHandleWindowKeyEvent;
|
|
94
|
+
private computeFitToViewScale;
|
|
95
|
+
}
|
|
96
|
+
export declare function createTimelineEditor(container: HTMLElement, options?: TimelineEditorOptions): TimelineEditor;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Timeline as OtioTimeline } from '../otio-core/index.js';
|
|
2
|
+
import type { EditPolicies, TimelineDocument, TimelineSelection } from '../model/types.js';
|
|
3
|
+
import type { KeyBinding, TimelinePlugin } from '../plugins/types.js';
|
|
4
|
+
import type { ShortcutsPluginOptions } from '../plugins/shortcutsPlugin.js';
|
|
5
|
+
import type { MediaProvider, ToolbarConfig, TrackConfigMap, UIConfig } from '../renderer/types.js';
|
|
6
|
+
import type { BeforeCommandHook, HistoryMode, ThemeMode, TimelineRenderHints, TimelineState } from '../store/types.js';
|
|
7
|
+
export interface TimelineEditorOptions {
|
|
8
|
+
document?: TimelineDocument;
|
|
9
|
+
timeline?: TimelineDocument | OtioTimeline;
|
|
10
|
+
fps?: number;
|
|
11
|
+
currentFrame?: number;
|
|
12
|
+
trackScale?: number;
|
|
13
|
+
isMagnetEnabled?: boolean;
|
|
14
|
+
trackConfigs?: TrackConfigMap;
|
|
15
|
+
toolsConfigs?: ToolbarConfig[];
|
|
16
|
+
ui?: UIConfig;
|
|
17
|
+
theme?: ThemeMode;
|
|
18
|
+
injectStyles?: boolean;
|
|
19
|
+
policies?: Partial<EditPolicies>;
|
|
20
|
+
history?: HistoryMode;
|
|
21
|
+
onBeforeCommand?: BeforeCommandHook;
|
|
22
|
+
plugins?: TimelinePlugin[];
|
|
23
|
+
disableDefaultPlugins?: boolean;
|
|
24
|
+
shortcuts?: boolean | ShortcutsPluginOptions;
|
|
25
|
+
keymap?: Record<string, KeyBinding | null>;
|
|
26
|
+
mediaProvider?: MediaProvider;
|
|
27
|
+
renderHints?: Partial<TimelineRenderHints>;
|
|
28
|
+
}
|
|
29
|
+
export type TimelineEditorSnapshot = TimelineState;
|
|
30
|
+
export type TimelineSelectionInput = Partial<TimelineSelection> | string | string[] | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TimelineDocument } from '../model/types.js';
|
|
2
|
+
import type { TimelineLayoutSnapshot } from './layout.js';
|
|
3
|
+
export type HitZone = 'clip-body' | 'trim-start' | 'trim-end' | 'ruler' | 'playhead' | 'track-empty' | 'sidebar' | 'toolbar' | 'outside';
|
|
4
|
+
export interface TimelineHitTarget {
|
|
5
|
+
zone: HitZone;
|
|
6
|
+
timeMs: number;
|
|
7
|
+
frame: number;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
trackIndex: number;
|
|
11
|
+
clipIndex: number;
|
|
12
|
+
clipId: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface HitTestOptions {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
trimHandleWidthPx?: number;
|
|
18
|
+
minClipWidthPx?: number;
|
|
19
|
+
zoneHint?: HitZone;
|
|
20
|
+
hintClipId?: string | null;
|
|
21
|
+
hintTrackIndex?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function hitTestLayout(layout: TimelineLayoutSnapshot, doc: TimelineDocument, options: HitTestOptions): TimelineHitTarget;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { TimelineClip, TimelineDocument, TimelineTrack } from '../model/types.js';
|
|
2
|
+
export interface TrackLayoutConfigEntry {
|
|
3
|
+
height?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface LayoutClip {
|
|
6
|
+
clip: TimelineClip;
|
|
7
|
+
track: TimelineTrack;
|
|
8
|
+
trackIndex: number;
|
|
9
|
+
clipIndex: number;
|
|
10
|
+
type: string;
|
|
11
|
+
startMs: number;
|
|
12
|
+
endMs: number;
|
|
13
|
+
leftPx: number;
|
|
14
|
+
widthPx: number;
|
|
15
|
+
}
|
|
16
|
+
export interface LayoutTrack {
|
|
17
|
+
track: TimelineTrack;
|
|
18
|
+
trackIndex: number;
|
|
19
|
+
type: string;
|
|
20
|
+
height: number;
|
|
21
|
+
startY: number;
|
|
22
|
+
endY: number;
|
|
23
|
+
clips: LayoutClip[];
|
|
24
|
+
}
|
|
25
|
+
export interface TimelineLayoutSnapshot {
|
|
26
|
+
fps: number;
|
|
27
|
+
trackScale: number;
|
|
28
|
+
framePixel: number;
|
|
29
|
+
pixelsPerSecond: number;
|
|
30
|
+
totalDurationMs: number;
|
|
31
|
+
totalDurationSec: number;
|
|
32
|
+
contentTop: number;
|
|
33
|
+
contentBottom: number;
|
|
34
|
+
contentHeight: number;
|
|
35
|
+
tracks: LayoutTrack[];
|
|
36
|
+
}
|
|
37
|
+
export declare const DEFAULT_TRACK_HEIGHT = 64;
|
|
38
|
+
export declare const DEFAULT_TRACK_GAP = 4;
|
|
39
|
+
export declare const DEFAULT_TRACK_PADDING_TOP = 20;
|
|
40
|
+
export declare function getTrackHeight(config?: TrackLayoutConfigEntry): number;
|
|
41
|
+
export declare function computeTimelineLayout(doc: TimelineDocument, options: {
|
|
42
|
+
trackScale: number;
|
|
43
|
+
trackConfigs?: Record<string, TrackLayoutConfigEntry | undefined>;
|
|
44
|
+
viewportHeight?: number;
|
|
45
|
+
trackGap?: number;
|
|
46
|
+
paddingTop?: number;
|
|
47
|
+
}): TimelineLayoutSnapshot;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TimelineClip, TimelineTrack } from '../model/types.js';
|
|
2
|
+
import type { LayoutTrack } from './layout.js';
|
|
3
|
+
export interface MagnetAffectedClip {
|
|
4
|
+
clipId: string;
|
|
5
|
+
originalStartMs: number;
|
|
6
|
+
originalEndMs: number;
|
|
7
|
+
newStartMs: number;
|
|
8
|
+
newEndMs: number;
|
|
9
|
+
}
|
|
10
|
+
export interface TimelineMagnetState {
|
|
11
|
+
isEnabled: boolean;
|
|
12
|
+
targetTrackIndex: number;
|
|
13
|
+
insertPosition: number;
|
|
14
|
+
dragClipDurationMs: number;
|
|
15
|
+
affectedClips: MagnetAffectedClip[];
|
|
16
|
+
previewArrangement: TimelineClip[];
|
|
17
|
+
}
|
|
18
|
+
export interface MagnetPreviewTransform {
|
|
19
|
+
clipId: string;
|
|
20
|
+
offsetX: number;
|
|
21
|
+
}
|
|
22
|
+
export interface MagnetDetectionResult {
|
|
23
|
+
magnetState?: TimelineMagnetState;
|
|
24
|
+
isMagnetMode: boolean;
|
|
25
|
+
reason?: 'new-track' | 'invalid-track' | 'non-magnet-track' | 'magnet-disabled';
|
|
26
|
+
}
|
|
27
|
+
export declare function isMagnetTrack(track: TimelineTrack | undefined, magnetEnabled: boolean): boolean;
|
|
28
|
+
export declare function calculateMagnetArrangement(track: TimelineTrack, dragClipStartMs: number, dragClipDurationMs: number, cursorX: number, targetTrackLayout?: Pick<LayoutTrack, 'clips'>, excludeClipId?: string): {
|
|
29
|
+
insertPosition: number;
|
|
30
|
+
newArrangement: TimelineClip[];
|
|
31
|
+
affectedClips: MagnetAffectedClip[];
|
|
32
|
+
};
|
|
33
|
+
export declare function detectMagnetState(options: {
|
|
34
|
+
tracks: readonly TimelineTrack[];
|
|
35
|
+
tracksLayout: readonly (Pick<LayoutTrack, 'clips'> | undefined)[];
|
|
36
|
+
targetTrackIndex: number;
|
|
37
|
+
isNewTrack: boolean;
|
|
38
|
+
targetX: number;
|
|
39
|
+
cursorX: number;
|
|
40
|
+
dragClipDurationMs: number;
|
|
41
|
+
sourceTrackIndex: number;
|
|
42
|
+
sourceClipId: string;
|
|
43
|
+
pixelToMs: (pixel: number) => number;
|
|
44
|
+
magnetEnabled: boolean;
|
|
45
|
+
}): MagnetDetectionResult;
|
|
46
|
+
export declare function getMagnetPreviewTransforms(magnetState: TimelineMagnetState, dragClipId: string, msToPixel: (ms: number) => number, targetTrackLayout?: Pick<LayoutTrack, 'clips'>): MagnetPreviewTransform[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type EditPolicies, type TimelineClip, type TimelineTrack } from '../model/types.js';
|
|
2
|
+
import type { LayoutTrack } from './layout.js';
|
|
3
|
+
export interface PlacementTargetInfo {
|
|
4
|
+
isNewTrack: boolean;
|
|
5
|
+
insertIndex: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function checkTrackOverlap(tracks: readonly TimelineTrack[], targetTrackIndex: number, startMs: number, endMs: number, excludeClipId?: string, policies?: EditPolicies, magnetEnabled?: boolean): boolean;
|
|
8
|
+
export declare function resolveTargetTrack(tracks: readonly TimelineTrack[], tracksLayout: readonly Pick<LayoutTrack, 'startY' | 'endY' | 'type'>[], y: number, dragClip: Pick<TimelineClip, 'id' | 'type' | 'startMs' | 'endMs'>, options: {
|
|
9
|
+
targetStartMs: number;
|
|
10
|
+
sourceTrackIndex?: number;
|
|
11
|
+
magnetEnabled: boolean;
|
|
12
|
+
policies?: EditPolicies;
|
|
13
|
+
}): PlacementTargetInfo;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TimelineLayoutSnapshot } from './layout.js';
|
|
2
|
+
export interface SnapPoint {
|
|
3
|
+
timeMs: number;
|
|
4
|
+
x: number;
|
|
5
|
+
source: string;
|
|
6
|
+
clipId?: string;
|
|
7
|
+
kind?: 'start' | 'end' | 'playhead' | 'grid' | 'custom';
|
|
8
|
+
}
|
|
9
|
+
export interface SnapContext {
|
|
10
|
+
layout: TimelineLayoutSnapshot;
|
|
11
|
+
currentFrame: number;
|
|
12
|
+
excludeClipIds: ReadonlySet<string>;
|
|
13
|
+
targetLeftPx: number;
|
|
14
|
+
durationMs: number;
|
|
15
|
+
}
|
|
16
|
+
export interface SnapProvider {
|
|
17
|
+
id: string;
|
|
18
|
+
getSnapPoints: (ctx: SnapContext) => SnapPoint[];
|
|
19
|
+
}
|
|
20
|
+
export interface SnapResult {
|
|
21
|
+
leftPx: number;
|
|
22
|
+
startMs: number;
|
|
23
|
+
guidelineX: number;
|
|
24
|
+
point: SnapPoint;
|
|
25
|
+
edge: 'start' | 'end';
|
|
26
|
+
}
|
|
27
|
+
export declare function collectSnapPoints(providers: readonly SnapProvider[], ctx: SnapContext): SnapPoint[];
|
|
28
|
+
export declare function findBestSnap(targetLeftPx: number, durationMs: number, points: readonly SnapPoint[], pixelsPerSecond: number, thresholdPx?: number): SnapResult | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function clampTrackScale(scale: number): number;
|
|
2
|
+
export declare function getPixelsPerSecond(scale: number, fps?: number): number;
|
|
3
|
+
export declare function getGridSize(scale: number, fps?: number): number;
|
|
4
|
+
export declare function getFramePixel(scale: number, fps?: number): number;
|
|
5
|
+
export declare function msToPx(ms: number, pixelsPerSecond: number): number;
|
|
6
|
+
export declare function pxToMs(px: number, pixelsPerSecond: number): number;
|
|
7
|
+
export declare function frameToSeconds(frame: number, fps: number): number;
|
|
8
|
+
export declare function secondsToFrame(seconds: number, fps: number): number;
|
|
9
|
+
export declare function msToFrame(ms: number, fps: number): number;
|
|
10
|
+
export declare function frameToMs(frame: number, fps: number): number;
|
|
11
|
+
export declare function pxToFrame(px: number, scale: number, fps: number): number;
|
|
12
|
+
export declare function scaleToPixelsPerSecond(scale: number, fps?: number): number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LayoutClip } from './layout.js';
|
|
2
|
+
export interface VisibleTimeRange {
|
|
3
|
+
startMs: number;
|
|
4
|
+
endMs: number;
|
|
5
|
+
startPx: number;
|
|
6
|
+
endPx: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEFAULT_OVERSCAN_PX = 240;
|
|
9
|
+
export declare function computeVisibleRange(scrollLeft: number, viewportWidth: number, pixelsPerSecond: number, paddingLeft?: number, overscanPx?: number): VisibleTimeRange;
|
|
10
|
+
export declare function isClipInVisibleRange(clip: Pick<LayoutClip, 'startMs' | 'endMs'>, range: VisibleTimeRange): boolean;
|
|
11
|
+
export declare function filterVisibleClips(clips: readonly LayoutClip[], range: VisibleTimeRange, alwaysIncludeIds?: ReadonlySet<string>): LayoutClip[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SlotRendererObject } from '../renderer/types.js';
|
|
2
|
+
export interface SlotPortalEntry<TCtx> {
|
|
3
|
+
key: string;
|
|
4
|
+
host: HTMLElement;
|
|
5
|
+
context: TCtx;
|
|
6
|
+
}
|
|
7
|
+
export interface SlotBridge<TCtx> {
|
|
8
|
+
slot: SlotRendererObject<TCtx>;
|
|
9
|
+
getEntries: () => readonly SlotPortalEntry<TCtx>[];
|
|
10
|
+
subscribe: (listener: () => void) => () => void;
|
|
11
|
+
clear: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function createSlotBridge<TCtx>(getKey: (ctx: TCtx) => string): SlotBridge<TCtx>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { TimelineEditor, TimelineEditor as NativeTimelineEditor, TimelineEditor as default, createTimelineEditor, } from './editor/index.js';
|
|
2
|
+
export type { TimelineEditorOptions, TimelineEditorOptions as NativeTimelineEditorOptions, TimelineEditorSnapshot, TimelineEditorSnapshot as NativeTimelineEditorSnapshot, TimelineSelectionInput, } from './editor/index.js';
|
|
3
|
+
export * from './model/index.js';
|
|
4
|
+
export * from './engine/index.js';
|
|
5
|
+
export * from './store/index.js';
|
|
6
|
+
export * from './plugins/index.js';
|
|
7
|
+
export * from './renderer/index.js';
|
|
8
|
+
export * from './adapters/otio.js';
|
|
9
|
+
export { createSlotBridge, type SlotBridge, type SlotPortalEntry, } from './frameworks/slotBridge.js';
|
|
10
|
+
export { getTrimOffset } from './utils/trimOffset.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type EditPolicies, type TimelineClip, type TimelineDocument, type TimelineSelection, type TimelineTrack } from './types.js';
|
|
2
|
+
export declare function cloneClip<TMeta = Record<string, unknown>>(clip: TimelineClip<TMeta>): TimelineClip<TMeta>;
|
|
3
|
+
export declare function cloneTrack<TTrackMeta = Record<string, unknown>, TClipMeta = Record<string, unknown>>(track: TimelineTrack<TTrackMeta, TClipMeta>): TimelineTrack<TTrackMeta, TClipMeta>;
|
|
4
|
+
export declare function cloneDocument<TTrackMeta = Record<string, unknown>, TClipMeta = Record<string, unknown>>(doc: TimelineDocument<TTrackMeta, TClipMeta>): TimelineDocument<TTrackMeta, TClipMeta>;
|
|
5
|
+
export declare function getDocumentDurationMs(doc: TimelineDocument): number;
|
|
6
|
+
export declare function findClipLocation(doc: TimelineDocument, clipId: string | null | undefined): {
|
|
7
|
+
trackIndex: number;
|
|
8
|
+
clipIndex: number;
|
|
9
|
+
track: TimelineTrack;
|
|
10
|
+
clip: TimelineClip;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function resolveSelection(doc: TimelineDocument, clipIds: readonly string[], primaryClipId?: string | null): TimelineSelection;
|
|
13
|
+
export declare function cleanupTracks(doc: TimelineDocument, policies?: EditPolicies, magnetEnabled?: boolean): {
|
|
14
|
+
document: TimelineDocument;
|
|
15
|
+
changed: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function trimClip(doc: TimelineDocument, params: {
|
|
18
|
+
trackIndex: number;
|
|
19
|
+
clipIndex: number;
|
|
20
|
+
offsetMs: number;
|
|
21
|
+
edge: 'start' | 'end';
|
|
22
|
+
}, policies?: EditPolicies): {
|
|
23
|
+
document: TimelineDocument;
|
|
24
|
+
changed: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function splitClipAtMs(doc: TimelineDocument, params: {
|
|
27
|
+
trackIndex: number;
|
|
28
|
+
clipIndex: number;
|
|
29
|
+
splitMs: number;
|
|
30
|
+
}, policies?: EditPolicies): {
|
|
31
|
+
document: TimelineDocument;
|
|
32
|
+
leftClipId: string | null;
|
|
33
|
+
rightClipId: string | null;
|
|
34
|
+
changed: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function deleteClips(doc: TimelineDocument, clipIds: readonly string[], policies?: EditPolicies, magnetEnabled?: boolean): {
|
|
37
|
+
document: TimelineDocument;
|
|
38
|
+
changed: boolean;
|
|
39
|
+
};
|
|
40
|
+
export declare function moveClip(doc: TimelineDocument, params: {
|
|
41
|
+
sourceTrackIndex: number;
|
|
42
|
+
sourceClipIndex: number;
|
|
43
|
+
targetTrackIndex: number;
|
|
44
|
+
isNewTrack: boolean;
|
|
45
|
+
startMs: number;
|
|
46
|
+
endMs: number;
|
|
47
|
+
clipType?: string;
|
|
48
|
+
}, policies?: EditPolicies, magnetEnabled?: boolean): {
|
|
49
|
+
document: TimelineDocument;
|
|
50
|
+
selection: TimelineSelection;
|
|
51
|
+
changed: boolean;
|
|
52
|
+
};
|
|
53
|
+
export declare function applyMagnetMove(doc: TimelineDocument, params: {
|
|
54
|
+
sourceTrackIndex: number;
|
|
55
|
+
sourceClipIndex: number;
|
|
56
|
+
targetTrackIndex: number;
|
|
57
|
+
insertPosition: number;
|
|
58
|
+
previewArrangement: TimelineClip[];
|
|
59
|
+
dragClipDurationMs: number;
|
|
60
|
+
}, policies?: EditPolicies): {
|
|
61
|
+
document: TimelineDocument;
|
|
62
|
+
selection: TimelineSelection;
|
|
63
|
+
changed: boolean;
|
|
64
|
+
};
|
|
65
|
+
export declare function insertClip(doc: TimelineDocument, params: {
|
|
66
|
+
trackIndex: number;
|
|
67
|
+
isNewTrack: boolean;
|
|
68
|
+
clip: TimelineClip;
|
|
69
|
+
}, policies?: EditPolicies, magnetEnabled?: boolean): {
|
|
70
|
+
document: TimelineDocument;
|
|
71
|
+
selection: TimelineSelection;
|
|
72
|
+
changed: boolean;
|
|
73
|
+
};
|
|
74
|
+
export declare function toggleTrackFlag(doc: TimelineDocument, trackIndex: number, flag: 'locked' | 'visible' | 'muted'): {
|
|
75
|
+
document: TimelineDocument;
|
|
76
|
+
changed: boolean;
|
|
77
|
+
};
|