@video-editor/shared 0.0.1-beta.3 → 0.0.1-beta.31
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/dist/index.d.ts +29 -16
- package/dist/{videoEditorShared.js → index.js} +14 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -84,18 +84,6 @@ export declare interface IImageFramesSegment extends IFramesSegment {
|
|
|
84
84
|
format: 'img' | 'gif';
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
export declare type IImageSegment = ImageSegment<'image'>;
|
|
88
|
-
|
|
89
|
-
declare interface ImageSegment<T extends ITrackType> extends ISegment<T> {
|
|
90
|
-
segmentType: T;
|
|
91
|
-
format: 'img' | 'gif';
|
|
92
|
-
url: string;
|
|
93
|
-
fillMode?: IFillMode;
|
|
94
|
-
animation?: IAnimation;
|
|
95
|
-
transform?: ITransform;
|
|
96
|
-
palette?: IPalette;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
87
|
export declare interface IPalette {
|
|
100
88
|
temperature: number;
|
|
101
89
|
hue: number;
|
|
@@ -141,15 +129,17 @@ export declare function isFilterSegment(segment: SegmentUnion): segment is IFilt
|
|
|
141
129
|
export declare function isFramesSegment(segment: SegmentUnion): segment is IFramesSegmentUnion;
|
|
142
130
|
|
|
143
131
|
/**
|
|
144
|
-
* Type guard: check if segment is
|
|
132
|
+
* Type guard: check if segment is sticker segment
|
|
145
133
|
*/
|
|
146
|
-
export declare function
|
|
134
|
+
export declare function isStickerSegment(segment: SegmentUnion): segment is IStickerSegment;
|
|
147
135
|
|
|
148
136
|
/**
|
|
149
137
|
* Type guard: check if segment is text segment
|
|
150
138
|
*/
|
|
151
139
|
export declare function isTextSegment(segment: SegmentUnion): segment is ITextSegment;
|
|
152
140
|
|
|
141
|
+
export declare type IStickerSegment = StickerSegment<'sticker'>;
|
|
142
|
+
|
|
153
143
|
/**
|
|
154
144
|
* Check if a time point is within a segment's time range
|
|
155
145
|
*/
|
|
@@ -193,6 +183,7 @@ export declare type ITrack<T extends ITrackType> = {
|
|
|
193
183
|
trackId: string;
|
|
194
184
|
trackType: T;
|
|
195
185
|
children: TrackTypeMapSegment[T][];
|
|
186
|
+
extra?: TrackExtra<T> | null;
|
|
196
187
|
} & (T extends 'frames' ? {
|
|
197
188
|
isMain?: boolean;
|
|
198
189
|
} : object);
|
|
@@ -224,20 +215,37 @@ export declare interface IVideoFramesSegment extends IFramesSegment {
|
|
|
224
215
|
* the numerical value is normalized in range [0, 1] unless otherwise specified
|
|
225
216
|
*/
|
|
226
217
|
export declare interface IVideoProtocol {
|
|
218
|
+
id: string;
|
|
227
219
|
version: `${number}.${number}.${number}`;
|
|
228
220
|
width: number;
|
|
229
221
|
height: number;
|
|
230
222
|
fps: number;
|
|
231
223
|
tracks: TrackUnion[];
|
|
224
|
+
extra?: ProtocolExtra | null;
|
|
232
225
|
}
|
|
233
226
|
|
|
234
|
-
export declare type
|
|
227
|
+
export declare type ProtocolExtra = ProtocolExtraRegistry extends Record<string, never> ? Record<string, never> : NonNullable<ProtocolExtraRegistry>;
|
|
228
|
+
|
|
229
|
+
export declare interface ProtocolExtraRegistry {
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export declare type SegmentExtra<T extends ITrackType> = T extends keyof SegmentExtraRegistry ? NonNullable<SegmentExtraRegistry[T]> : Record<string, never>;
|
|
235
233
|
|
|
236
234
|
export declare interface SegmentExtraRegistry {
|
|
237
235
|
}
|
|
238
236
|
|
|
239
237
|
export declare type SegmentUnion = TrackTypeMapSegment[ITrackType];
|
|
240
238
|
|
|
239
|
+
declare interface StickerSegment<T extends ITrackType> extends ISegment<T> {
|
|
240
|
+
segmentType: T;
|
|
241
|
+
format: 'img' | 'gif';
|
|
242
|
+
url: string;
|
|
243
|
+
fillMode?: IFillMode;
|
|
244
|
+
animation?: IAnimation;
|
|
245
|
+
transform?: ITransform;
|
|
246
|
+
palette?: IPalette;
|
|
247
|
+
}
|
|
248
|
+
|
|
241
249
|
declare interface TextSegment<T extends ITrackType> extends ISegment<T> {
|
|
242
250
|
segmentType: T;
|
|
243
251
|
texts: ITextBasic[];
|
|
@@ -251,10 +259,15 @@ declare interface TextSegment<T extends ITrackType> extends ISegment<T> {
|
|
|
251
259
|
*/
|
|
252
260
|
export declare const TRACK_TYPES: readonly ITrackType[];
|
|
253
261
|
|
|
262
|
+
export declare type TrackExtra<T extends ITrackType> = T extends keyof TrackExtraRegistry ? NonNullable<TrackExtraRegistry[T]> : Record<string, never>;
|
|
263
|
+
|
|
264
|
+
export declare interface TrackExtraRegistry {
|
|
265
|
+
}
|
|
266
|
+
|
|
254
267
|
export declare interface TrackTypeMapSegment {
|
|
255
268
|
frames: IFramesSegmentUnion;
|
|
256
269
|
text: TextSegment<'text'>;
|
|
257
|
-
|
|
270
|
+
sticker: StickerSegment<'sticker'>;
|
|
258
271
|
audio: AudioSegment<'audio'>;
|
|
259
272
|
effect: EffectSegment<'effect'>;
|
|
260
273
|
filter: FilterSegment<'filter'>;
|
|
@@ -5,41 +5,41 @@ function r(e) {
|
|
|
5
5
|
function u(e) {
|
|
6
6
|
return e.segmentType === "frames" && "type" in e && e.type === "video";
|
|
7
7
|
}
|
|
8
|
-
function m(e) {
|
|
9
|
-
return e.segmentType === "text";
|
|
10
|
-
}
|
|
11
8
|
function s(e) {
|
|
12
|
-
return e.segmentType === "
|
|
9
|
+
return e.segmentType === "text";
|
|
13
10
|
}
|
|
14
11
|
function f(e) {
|
|
12
|
+
return e.segmentType === "sticker";
|
|
13
|
+
}
|
|
14
|
+
function m(e) {
|
|
15
15
|
return e.segmentType === "audio";
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function c(e) {
|
|
18
18
|
return e.segmentType === "effect";
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function o(e) {
|
|
21
21
|
return e.segmentType === "filter";
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function T(e) {
|
|
24
24
|
return e.endTime - e.startTime;
|
|
25
25
|
}
|
|
26
26
|
function g(e, t) {
|
|
27
27
|
return e >= t.startTime && e < t.endTime;
|
|
28
28
|
}
|
|
29
|
-
const n = ["frames", "text", "
|
|
29
|
+
const n = ["frames", "text", "sticker", "audio", "effect", "filter"];
|
|
30
30
|
function a(e) {
|
|
31
31
|
return n.includes(e);
|
|
32
32
|
}
|
|
33
33
|
export {
|
|
34
34
|
i as CURRENT_PROTOCOL_VERSION,
|
|
35
35
|
n as TRACK_TYPES,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
T as getSegmentDuration,
|
|
37
|
+
m as isAudioSegment,
|
|
38
|
+
c as isEffectSegment,
|
|
39
|
+
o as isFilterSegment,
|
|
40
40
|
r as isFramesSegment,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
f as isStickerSegment,
|
|
42
|
+
s as isTextSegment,
|
|
43
43
|
g as isTimeInSegment,
|
|
44
44
|
a as isValidTrackType,
|
|
45
45
|
u as isVideoFramesSegment
|