@aicut/core 0.4.2 → 0.5.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/README.md +128 -4
- package/dist/i18n-B-DFWgKe.d.cts +51 -0
- package/dist/i18n-B-DFWgKe.d.ts +51 -0
- package/dist/index.cjs +429 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +200 -6
- package/dist/index.d.ts +200 -6
- package/dist/index.js +371 -17
- package/dist/index.js.map +1 -1
- package/dist/lighting/index.d.cts +2 -1
- package/dist/lighting/index.d.ts +2 -1
- package/dist/playback/webcodecs/index.cjs +10572 -0
- package/dist/playback/webcodecs/index.cjs.map +1 -0
- package/dist/playback/webcodecs/index.d.cts +109 -0
- package/dist/playback/webcodecs/index.d.ts +109 -0
- package/dist/playback/webcodecs/index.js +10568 -0
- package/dist/playback/webcodecs/index.js.map +1 -0
- package/dist/types-CHplD9V5.d.cts +70 -0
- package/dist/types-CHplD9V5.d.ts +70 -0
- package/dist/types-DvKlxylu.d.cts +75 -0
- package/dist/types-rwZx6FxE.d.ts +75 -0
- package/package.json +15 -4
- package/styles/theme.css +25 -13
- package/dist/types-C95koNwJ.d.cts +0 -120
- package/dist/types-C95koNwJ.d.ts +0 -120
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,147 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { P as PlaybackEngine, a as PlaybackEngineOptions, b as PlaybackEngineFactory } from './types-DvKlxylu.cjs';
|
|
2
|
+
import { M as Ms, P as Project, T as Track, C as Clip, a as MediaSource, b as Theme } from './types-CHplD9V5.cjs';
|
|
3
|
+
import { L as Locale } from './i18n-B-DFWgKe.cjs';
|
|
4
|
+
export { f as formatLabel, l as localeEn, a as localeZh, m as mergeLocale } from './i18n-B-DFWgKe.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Default preview engine — one hidden `<video>` per `MediaSource`,
|
|
8
|
+
* "active" video shown for the current playhead. Tick loop drives a
|
|
9
|
+
* single video track's playhead, advancing through clips end-to-end.
|
|
10
|
+
* When the playhead crosses a clip boundary we pause the outgoing
|
|
11
|
+
* video and resume the next at `clip.in`.
|
|
12
|
+
*
|
|
13
|
+
* Strengths: zero deps, browser-native decode (GPU when available),
|
|
14
|
+
* works in every browser today.
|
|
15
|
+
*
|
|
16
|
+
* Limits: no multi-track compositing (one video visible at a time),
|
|
17
|
+
* seek snaps to keyframes (browser controls the decode pipeline), no
|
|
18
|
+
* transitions / shaders / filters. See `WebCodecsEngine` for the
|
|
19
|
+
* frame-accurate path.
|
|
20
|
+
*/
|
|
21
|
+
declare class HtmlVideoEngine implements PlaybackEngine {
|
|
22
|
+
private host;
|
|
23
|
+
private mount;
|
|
24
|
+
private videos;
|
|
25
|
+
private project;
|
|
26
|
+
private currentClipId;
|
|
27
|
+
private playing;
|
|
28
|
+
private timeMs;
|
|
29
|
+
private rafHandle;
|
|
30
|
+
private lastFrameTs;
|
|
31
|
+
/** Public event hooks — set by Editor. */
|
|
32
|
+
onTimeUpdate?: (ms: Ms) => void;
|
|
33
|
+
onEnded?: () => void;
|
|
34
|
+
onError?: (err: Error) => void;
|
|
35
|
+
onReady?: () => void;
|
|
36
|
+
onSourceMetadata?: (sourceId: string, durationMs: Ms) => void;
|
|
37
|
+
constructor(opts: PlaybackEngineOptions);
|
|
38
|
+
setProject(next: Project): void;
|
|
39
|
+
play(): void;
|
|
40
|
+
pause(): void;
|
|
41
|
+
isPlaying(): boolean;
|
|
42
|
+
getTime(): Ms;
|
|
43
|
+
seek(timeMs: Ms): void;
|
|
44
|
+
destroy(): void;
|
|
45
|
+
private syncSources;
|
|
46
|
+
private activate;
|
|
47
|
+
private seekVideoToClipOffset;
|
|
48
|
+
private clipById;
|
|
49
|
+
/**
|
|
50
|
+
* Find the clip whose timeline range contains `timeMs`, searching
|
|
51
|
+
* across ALL video tracks. If multiple tracks have a clip at this
|
|
52
|
+
* moment, the lowest-index track wins (matches the "Track 1 is
|
|
53
|
+
* background" convention used in the auto-split UX — overlapping
|
|
54
|
+
* placements would have created a new track on top, but here we
|
|
55
|
+
* fall back to the underlying clip).
|
|
56
|
+
*/
|
|
57
|
+
private clipAtTime;
|
|
58
|
+
/** Earliest clip starting at-or-after `timeMs` across all video tracks. */
|
|
59
|
+
private nextClipAfterTime;
|
|
60
|
+
/** Max clip end across all video tracks. */
|
|
61
|
+
private totalDuration;
|
|
62
|
+
private startTickLoop;
|
|
63
|
+
private stopTickLoop;
|
|
64
|
+
private advance;
|
|
65
|
+
}
|
|
66
|
+
/** Factory shorthand for `Editor.create({ playbackEngine })`. */
|
|
67
|
+
declare const htmlVideoEngineFactory: PlaybackEngineFactory;
|
|
68
|
+
|
|
69
|
+
interface CanvasCompositorEngineOptions extends PlaybackEngineOptions {
|
|
70
|
+
/**
|
|
71
|
+
* Show the corner HUD ("engine: canvas compositor • t=… • frames
|
|
72
|
+
* painted: …"). Off by default — production hosts get a clean canvas
|
|
73
|
+
* with no chrome painted on top. Turn on in development / demos to
|
|
74
|
+
* see who's drawing and what the current state is.
|
|
75
|
+
*/
|
|
76
|
+
debug?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Reference second engine — demonstrates that the `PlaybackEngine`
|
|
80
|
+
* surface really is engine-agnostic. Same `<video>`-based decode as
|
|
81
|
+
* `HtmlVideoEngine` (so it works in every browser, no WebCodecs gate),
|
|
82
|
+
* but rendering happens via `ctx.drawImage(video, …)` on a single
|
|
83
|
+
* canvas instead of the browser painting the video element itself.
|
|
84
|
+
*
|
|
85
|
+
* Why ship it: it's tangible proof that a host can swap the rendering
|
|
86
|
+
* surface for compositing / shaders / overlays / capture-to-canvas
|
|
87
|
+
* without touching Editor internals. It's also the natural stepping
|
|
88
|
+
* stone toward a WebGL or WebCodecs path (those replace the decoder
|
|
89
|
+
* but keep the canvas-blit pattern).
|
|
90
|
+
*
|
|
91
|
+
* Limits: same as `HtmlVideoEngine` (one source visible at a time,
|
|
92
|
+
* seek snaps to the browser's keyframe pipeline). The point is the
|
|
93
|
+
* surface, not new capability.
|
|
94
|
+
*/
|
|
95
|
+
declare class CanvasCompositorEngine implements PlaybackEngine {
|
|
96
|
+
private host;
|
|
97
|
+
private mount;
|
|
98
|
+
private canvas;
|
|
99
|
+
private ctx;
|
|
100
|
+
/** Only created when constructed with `debug: true`. */
|
|
101
|
+
private badge;
|
|
102
|
+
private videos;
|
|
103
|
+
private project;
|
|
104
|
+
private currentClipId;
|
|
105
|
+
private playing;
|
|
106
|
+
private timeMs;
|
|
107
|
+
private rafHandle;
|
|
108
|
+
private lastFrameTs;
|
|
109
|
+
private paintedFrames;
|
|
110
|
+
onTimeUpdate?: (ms: Ms) => void;
|
|
111
|
+
onEnded?: () => void;
|
|
112
|
+
onError?: (err: Error) => void;
|
|
113
|
+
onReady?: () => void;
|
|
114
|
+
onSourceMetadata?: (sourceId: string, durationMs: Ms) => void;
|
|
115
|
+
constructor(opts: CanvasCompositorEngineOptions);
|
|
116
|
+
setProject(next: Project): void;
|
|
117
|
+
play(): void;
|
|
118
|
+
pause(): void;
|
|
119
|
+
isPlaying(): boolean;
|
|
120
|
+
getTime(): Ms;
|
|
121
|
+
seek(timeMs: Ms): void;
|
|
122
|
+
destroy(): void;
|
|
123
|
+
private syncSources;
|
|
124
|
+
private activate;
|
|
125
|
+
private seekVideoToClipOffset;
|
|
126
|
+
private clipById;
|
|
127
|
+
private clipAtTime;
|
|
128
|
+
private nextClipAfterTime;
|
|
129
|
+
private totalDuration;
|
|
130
|
+
private resizeCanvas;
|
|
131
|
+
private startTickLoop;
|
|
132
|
+
private stopTickLoop;
|
|
133
|
+
private advance;
|
|
134
|
+
/**
|
|
135
|
+
* One paint per rAF — clears the canvas, draws the current active
|
|
136
|
+
* video frame letterboxed to fit, then refreshes the HUD. Done
|
|
137
|
+
* unconditionally (not just on `playing`) so the HUD frame counter
|
|
138
|
+
* and the seek preview both update when paused.
|
|
139
|
+
*/
|
|
140
|
+
private paint;
|
|
141
|
+
private updateBadge;
|
|
142
|
+
}
|
|
143
|
+
/** Factory shorthand for `Editor.create({ playbackEngine })`. */
|
|
144
|
+
declare const canvasCompositorEngineFactory: PlaybackEngineFactory;
|
|
3
145
|
|
|
4
146
|
interface EditorOptions {
|
|
5
147
|
/** Host element to mount the editor into. Will be wiped on init. */
|
|
@@ -20,6 +162,38 @@ interface EditorOptions {
|
|
|
20
162
|
* Call `editor.setLocale(...)` to switch at runtime.
|
|
21
163
|
*/
|
|
22
164
|
locale?: Partial<Locale>;
|
|
165
|
+
/**
|
|
166
|
+
* Optional factory for a custom playback engine. Receives the
|
|
167
|
+
* editor's preview host element + the initial project, returns
|
|
168
|
+
* anything satisfying `PlaybackEngine`. Defaults to the built-in
|
|
169
|
+
* `HtmlVideoEngine` (one hidden `<video>` per source, swap on
|
|
170
|
+
* boundaries). Hosts that need frame-accurate editing, multi-track
|
|
171
|
+
* compositing, transitions, etc. pass a `WebCodecsEngine` factory
|
|
172
|
+
* (v0.6+) or their own.
|
|
173
|
+
*/
|
|
174
|
+
playbackEngine?: PlaybackEngineFactory;
|
|
175
|
+
/**
|
|
176
|
+
* Pixel height of each track row in the timeline (default 56). Lower
|
|
177
|
+
* values (~32–40) shrink the timeline footprint for small viewports
|
|
178
|
+
* where the default crowds out the preview. Reasonable range:
|
|
179
|
+
* [28, 96]. Applied process-wide via `setTimelineMetrics` — multi-
|
|
180
|
+
* editor mounts share the value.
|
|
181
|
+
*/
|
|
182
|
+
trackHeight?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Pixel height of the timeline ruler / time-label strip (default 24).
|
|
185
|
+
* Pair with `trackHeight` to compact the whole timeline. Reasonable
|
|
186
|
+
* range: [18, 36].
|
|
187
|
+
*/
|
|
188
|
+
rulerHeight?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Pixel height of the whole bottom timeline area (default 240). The
|
|
191
|
+
* canvas inside fills 100% of this and shows a vertical scrollbar
|
|
192
|
+
* when there are more tracks than fit. Lower this (~120–180) on
|
|
193
|
+
* small viewports so the preview takes more of the editor's height.
|
|
194
|
+
* Reasonable range: [120, 480].
|
|
195
|
+
*/
|
|
196
|
+
timelineHeight?: number;
|
|
23
197
|
}
|
|
24
198
|
interface EditorEventMap {
|
|
25
199
|
/** Emitted whenever the project mutates. */
|
|
@@ -282,10 +456,30 @@ declare function normalizeProject(project: Project): Project;
|
|
|
282
456
|
*/
|
|
283
457
|
declare function createId(prefix?: string): string;
|
|
284
458
|
|
|
285
|
-
/** Visual constants — kept here so draw + hit-test share one source of truth.
|
|
286
|
-
|
|
287
|
-
|
|
459
|
+
/** Visual constants — kept here so draw + hit-test share one source of truth.
|
|
460
|
+
* The two row-height values are `let` rather than `const` so hosts can
|
|
461
|
+
* shrink the timeline footprint for small screens via
|
|
462
|
+
* `setTimelineMetrics(...)`. ES module live bindings mean every importer
|
|
463
|
+
* sees the updated value automatically. */
|
|
464
|
+
declare let TRACK_HEIGHT: number;
|
|
465
|
+
declare let RULER_HEIGHT: number;
|
|
288
466
|
declare const HEADER_WIDTH = 96;
|
|
467
|
+
/**
|
|
468
|
+
* Override the default timeline row + ruler heights. Process-wide — call
|
|
469
|
+
* before / during editor construction. Useful when the editor is mounted
|
|
470
|
+
* in a small viewport (e.g. side-by-side panel on a laptop) and the
|
|
471
|
+
* default 56px tracks crowd out the preview.
|
|
472
|
+
*
|
|
473
|
+
* Reasonable ranges: trackHeight ∈ [28, 96], rulerHeight ∈ [18, 36].
|
|
474
|
+
* Anything smaller leaves no room for the clip label or the time ticks.
|
|
475
|
+
*
|
|
476
|
+
* Multi-editor mounts share these values. If you have two editors with
|
|
477
|
+
* different needs, agree on the smaller one or remount on switch.
|
|
478
|
+
*/
|
|
479
|
+
declare function setTimelineMetrics(opts: {
|
|
480
|
+
trackHeight?: number;
|
|
481
|
+
rulerHeight?: number;
|
|
482
|
+
}): void;
|
|
289
483
|
|
|
290
484
|
/**
|
|
291
485
|
* Public options for the standalone `Timeline` component. The class
|
|
@@ -532,4 +726,4 @@ declare class Timeline {
|
|
|
532
726
|
private applySnap;
|
|
533
727
|
}
|
|
534
728
|
|
|
535
|
-
export { Clip, Editor, type EditorApi, type EditorEventMap, type EditorEventName, type EditorOptions, HEADER_WIDTH, Locale, MediaSource, Ms, Project, RULER_HEIGHT, TRACK_HEIGHT, Theme, Timeline, type TimelineOptions, Track, createEmptyProject, createId, normalizeProject };
|
|
729
|
+
export { CanvasCompositorEngine, type CanvasCompositorEngineOptions, Clip, Editor, type EditorApi, type EditorEventMap, type EditorEventName, type EditorOptions, HEADER_WIDTH, HtmlVideoEngine, Locale, MediaSource, Ms, PlaybackEngine, PlaybackEngineFactory, PlaybackEngineOptions, Project, RULER_HEIGHT, TRACK_HEIGHT, Theme, Timeline, type TimelineOptions, Track, canvasCompositorEngineFactory, createEmptyProject, createId, htmlVideoEngineFactory, normalizeProject, setTimelineMetrics };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,147 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { P as PlaybackEngine, a as PlaybackEngineOptions, b as PlaybackEngineFactory } from './types-rwZx6FxE.js';
|
|
2
|
+
import { M as Ms, P as Project, T as Track, C as Clip, a as MediaSource, b as Theme } from './types-CHplD9V5.js';
|
|
3
|
+
import { L as Locale } from './i18n-B-DFWgKe.js';
|
|
4
|
+
export { f as formatLabel, l as localeEn, a as localeZh, m as mergeLocale } from './i18n-B-DFWgKe.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Default preview engine — one hidden `<video>` per `MediaSource`,
|
|
8
|
+
* "active" video shown for the current playhead. Tick loop drives a
|
|
9
|
+
* single video track's playhead, advancing through clips end-to-end.
|
|
10
|
+
* When the playhead crosses a clip boundary we pause the outgoing
|
|
11
|
+
* video and resume the next at `clip.in`.
|
|
12
|
+
*
|
|
13
|
+
* Strengths: zero deps, browser-native decode (GPU when available),
|
|
14
|
+
* works in every browser today.
|
|
15
|
+
*
|
|
16
|
+
* Limits: no multi-track compositing (one video visible at a time),
|
|
17
|
+
* seek snaps to keyframes (browser controls the decode pipeline), no
|
|
18
|
+
* transitions / shaders / filters. See `WebCodecsEngine` for the
|
|
19
|
+
* frame-accurate path.
|
|
20
|
+
*/
|
|
21
|
+
declare class HtmlVideoEngine implements PlaybackEngine {
|
|
22
|
+
private host;
|
|
23
|
+
private mount;
|
|
24
|
+
private videos;
|
|
25
|
+
private project;
|
|
26
|
+
private currentClipId;
|
|
27
|
+
private playing;
|
|
28
|
+
private timeMs;
|
|
29
|
+
private rafHandle;
|
|
30
|
+
private lastFrameTs;
|
|
31
|
+
/** Public event hooks — set by Editor. */
|
|
32
|
+
onTimeUpdate?: (ms: Ms) => void;
|
|
33
|
+
onEnded?: () => void;
|
|
34
|
+
onError?: (err: Error) => void;
|
|
35
|
+
onReady?: () => void;
|
|
36
|
+
onSourceMetadata?: (sourceId: string, durationMs: Ms) => void;
|
|
37
|
+
constructor(opts: PlaybackEngineOptions);
|
|
38
|
+
setProject(next: Project): void;
|
|
39
|
+
play(): void;
|
|
40
|
+
pause(): void;
|
|
41
|
+
isPlaying(): boolean;
|
|
42
|
+
getTime(): Ms;
|
|
43
|
+
seek(timeMs: Ms): void;
|
|
44
|
+
destroy(): void;
|
|
45
|
+
private syncSources;
|
|
46
|
+
private activate;
|
|
47
|
+
private seekVideoToClipOffset;
|
|
48
|
+
private clipById;
|
|
49
|
+
/**
|
|
50
|
+
* Find the clip whose timeline range contains `timeMs`, searching
|
|
51
|
+
* across ALL video tracks. If multiple tracks have a clip at this
|
|
52
|
+
* moment, the lowest-index track wins (matches the "Track 1 is
|
|
53
|
+
* background" convention used in the auto-split UX — overlapping
|
|
54
|
+
* placements would have created a new track on top, but here we
|
|
55
|
+
* fall back to the underlying clip).
|
|
56
|
+
*/
|
|
57
|
+
private clipAtTime;
|
|
58
|
+
/** Earliest clip starting at-or-after `timeMs` across all video tracks. */
|
|
59
|
+
private nextClipAfterTime;
|
|
60
|
+
/** Max clip end across all video tracks. */
|
|
61
|
+
private totalDuration;
|
|
62
|
+
private startTickLoop;
|
|
63
|
+
private stopTickLoop;
|
|
64
|
+
private advance;
|
|
65
|
+
}
|
|
66
|
+
/** Factory shorthand for `Editor.create({ playbackEngine })`. */
|
|
67
|
+
declare const htmlVideoEngineFactory: PlaybackEngineFactory;
|
|
68
|
+
|
|
69
|
+
interface CanvasCompositorEngineOptions extends PlaybackEngineOptions {
|
|
70
|
+
/**
|
|
71
|
+
* Show the corner HUD ("engine: canvas compositor • t=… • frames
|
|
72
|
+
* painted: …"). Off by default — production hosts get a clean canvas
|
|
73
|
+
* with no chrome painted on top. Turn on in development / demos to
|
|
74
|
+
* see who's drawing and what the current state is.
|
|
75
|
+
*/
|
|
76
|
+
debug?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Reference second engine — demonstrates that the `PlaybackEngine`
|
|
80
|
+
* surface really is engine-agnostic. Same `<video>`-based decode as
|
|
81
|
+
* `HtmlVideoEngine` (so it works in every browser, no WebCodecs gate),
|
|
82
|
+
* but rendering happens via `ctx.drawImage(video, …)` on a single
|
|
83
|
+
* canvas instead of the browser painting the video element itself.
|
|
84
|
+
*
|
|
85
|
+
* Why ship it: it's tangible proof that a host can swap the rendering
|
|
86
|
+
* surface for compositing / shaders / overlays / capture-to-canvas
|
|
87
|
+
* without touching Editor internals. It's also the natural stepping
|
|
88
|
+
* stone toward a WebGL or WebCodecs path (those replace the decoder
|
|
89
|
+
* but keep the canvas-blit pattern).
|
|
90
|
+
*
|
|
91
|
+
* Limits: same as `HtmlVideoEngine` (one source visible at a time,
|
|
92
|
+
* seek snaps to the browser's keyframe pipeline). The point is the
|
|
93
|
+
* surface, not new capability.
|
|
94
|
+
*/
|
|
95
|
+
declare class CanvasCompositorEngine implements PlaybackEngine {
|
|
96
|
+
private host;
|
|
97
|
+
private mount;
|
|
98
|
+
private canvas;
|
|
99
|
+
private ctx;
|
|
100
|
+
/** Only created when constructed with `debug: true`. */
|
|
101
|
+
private badge;
|
|
102
|
+
private videos;
|
|
103
|
+
private project;
|
|
104
|
+
private currentClipId;
|
|
105
|
+
private playing;
|
|
106
|
+
private timeMs;
|
|
107
|
+
private rafHandle;
|
|
108
|
+
private lastFrameTs;
|
|
109
|
+
private paintedFrames;
|
|
110
|
+
onTimeUpdate?: (ms: Ms) => void;
|
|
111
|
+
onEnded?: () => void;
|
|
112
|
+
onError?: (err: Error) => void;
|
|
113
|
+
onReady?: () => void;
|
|
114
|
+
onSourceMetadata?: (sourceId: string, durationMs: Ms) => void;
|
|
115
|
+
constructor(opts: CanvasCompositorEngineOptions);
|
|
116
|
+
setProject(next: Project): void;
|
|
117
|
+
play(): void;
|
|
118
|
+
pause(): void;
|
|
119
|
+
isPlaying(): boolean;
|
|
120
|
+
getTime(): Ms;
|
|
121
|
+
seek(timeMs: Ms): void;
|
|
122
|
+
destroy(): void;
|
|
123
|
+
private syncSources;
|
|
124
|
+
private activate;
|
|
125
|
+
private seekVideoToClipOffset;
|
|
126
|
+
private clipById;
|
|
127
|
+
private clipAtTime;
|
|
128
|
+
private nextClipAfterTime;
|
|
129
|
+
private totalDuration;
|
|
130
|
+
private resizeCanvas;
|
|
131
|
+
private startTickLoop;
|
|
132
|
+
private stopTickLoop;
|
|
133
|
+
private advance;
|
|
134
|
+
/**
|
|
135
|
+
* One paint per rAF — clears the canvas, draws the current active
|
|
136
|
+
* video frame letterboxed to fit, then refreshes the HUD. Done
|
|
137
|
+
* unconditionally (not just on `playing`) so the HUD frame counter
|
|
138
|
+
* and the seek preview both update when paused.
|
|
139
|
+
*/
|
|
140
|
+
private paint;
|
|
141
|
+
private updateBadge;
|
|
142
|
+
}
|
|
143
|
+
/** Factory shorthand for `Editor.create({ playbackEngine })`. */
|
|
144
|
+
declare const canvasCompositorEngineFactory: PlaybackEngineFactory;
|
|
3
145
|
|
|
4
146
|
interface EditorOptions {
|
|
5
147
|
/** Host element to mount the editor into. Will be wiped on init. */
|
|
@@ -20,6 +162,38 @@ interface EditorOptions {
|
|
|
20
162
|
* Call `editor.setLocale(...)` to switch at runtime.
|
|
21
163
|
*/
|
|
22
164
|
locale?: Partial<Locale>;
|
|
165
|
+
/**
|
|
166
|
+
* Optional factory for a custom playback engine. Receives the
|
|
167
|
+
* editor's preview host element + the initial project, returns
|
|
168
|
+
* anything satisfying `PlaybackEngine`. Defaults to the built-in
|
|
169
|
+
* `HtmlVideoEngine` (one hidden `<video>` per source, swap on
|
|
170
|
+
* boundaries). Hosts that need frame-accurate editing, multi-track
|
|
171
|
+
* compositing, transitions, etc. pass a `WebCodecsEngine` factory
|
|
172
|
+
* (v0.6+) or their own.
|
|
173
|
+
*/
|
|
174
|
+
playbackEngine?: PlaybackEngineFactory;
|
|
175
|
+
/**
|
|
176
|
+
* Pixel height of each track row in the timeline (default 56). Lower
|
|
177
|
+
* values (~32–40) shrink the timeline footprint for small viewports
|
|
178
|
+
* where the default crowds out the preview. Reasonable range:
|
|
179
|
+
* [28, 96]. Applied process-wide via `setTimelineMetrics` — multi-
|
|
180
|
+
* editor mounts share the value.
|
|
181
|
+
*/
|
|
182
|
+
trackHeight?: number;
|
|
183
|
+
/**
|
|
184
|
+
* Pixel height of the timeline ruler / time-label strip (default 24).
|
|
185
|
+
* Pair with `trackHeight` to compact the whole timeline. Reasonable
|
|
186
|
+
* range: [18, 36].
|
|
187
|
+
*/
|
|
188
|
+
rulerHeight?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Pixel height of the whole bottom timeline area (default 240). The
|
|
191
|
+
* canvas inside fills 100% of this and shows a vertical scrollbar
|
|
192
|
+
* when there are more tracks than fit. Lower this (~120–180) on
|
|
193
|
+
* small viewports so the preview takes more of the editor's height.
|
|
194
|
+
* Reasonable range: [120, 480].
|
|
195
|
+
*/
|
|
196
|
+
timelineHeight?: number;
|
|
23
197
|
}
|
|
24
198
|
interface EditorEventMap {
|
|
25
199
|
/** Emitted whenever the project mutates. */
|
|
@@ -282,10 +456,30 @@ declare function normalizeProject(project: Project): Project;
|
|
|
282
456
|
*/
|
|
283
457
|
declare function createId(prefix?: string): string;
|
|
284
458
|
|
|
285
|
-
/** Visual constants — kept here so draw + hit-test share one source of truth.
|
|
286
|
-
|
|
287
|
-
|
|
459
|
+
/** Visual constants — kept here so draw + hit-test share one source of truth.
|
|
460
|
+
* The two row-height values are `let` rather than `const` so hosts can
|
|
461
|
+
* shrink the timeline footprint for small screens via
|
|
462
|
+
* `setTimelineMetrics(...)`. ES module live bindings mean every importer
|
|
463
|
+
* sees the updated value automatically. */
|
|
464
|
+
declare let TRACK_HEIGHT: number;
|
|
465
|
+
declare let RULER_HEIGHT: number;
|
|
288
466
|
declare const HEADER_WIDTH = 96;
|
|
467
|
+
/**
|
|
468
|
+
* Override the default timeline row + ruler heights. Process-wide — call
|
|
469
|
+
* before / during editor construction. Useful when the editor is mounted
|
|
470
|
+
* in a small viewport (e.g. side-by-side panel on a laptop) and the
|
|
471
|
+
* default 56px tracks crowd out the preview.
|
|
472
|
+
*
|
|
473
|
+
* Reasonable ranges: trackHeight ∈ [28, 96], rulerHeight ∈ [18, 36].
|
|
474
|
+
* Anything smaller leaves no room for the clip label or the time ticks.
|
|
475
|
+
*
|
|
476
|
+
* Multi-editor mounts share these values. If you have two editors with
|
|
477
|
+
* different needs, agree on the smaller one or remount on switch.
|
|
478
|
+
*/
|
|
479
|
+
declare function setTimelineMetrics(opts: {
|
|
480
|
+
trackHeight?: number;
|
|
481
|
+
rulerHeight?: number;
|
|
482
|
+
}): void;
|
|
289
483
|
|
|
290
484
|
/**
|
|
291
485
|
* Public options for the standalone `Timeline` component. The class
|
|
@@ -532,4 +726,4 @@ declare class Timeline {
|
|
|
532
726
|
private applySnap;
|
|
533
727
|
}
|
|
534
728
|
|
|
535
|
-
export { Clip, Editor, type EditorApi, type EditorEventMap, type EditorEventName, type EditorOptions, HEADER_WIDTH, Locale, MediaSource, Ms, Project, RULER_HEIGHT, TRACK_HEIGHT, Theme, Timeline, type TimelineOptions, Track, createEmptyProject, createId, normalizeProject };
|
|
729
|
+
export { CanvasCompositorEngine, type CanvasCompositorEngineOptions, Clip, Editor, type EditorApi, type EditorEventMap, type EditorEventName, type EditorOptions, HEADER_WIDTH, HtmlVideoEngine, Locale, MediaSource, Ms, PlaybackEngine, PlaybackEngineFactory, PlaybackEngineOptions, Project, RULER_HEIGHT, TRACK_HEIGHT, Theme, Timeline, type TimelineOptions, Track, canvasCompositorEngineFactory, createEmptyProject, createId, htmlVideoEngineFactory, normalizeProject, setTimelineMetrics };
|