@video-editor/shared 0.0.1-beta.1 → 0.0.1-beta.10
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 +35 -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;
|
|
@@ -121,12 +109,13 @@ export declare function isAudioSegment(segment: SegmentUnion): segment is IAudio
|
|
|
121
109
|
*/
|
|
122
110
|
export declare function isEffectSegment(segment: SegmentUnion): segment is IEffectSegment;
|
|
123
111
|
|
|
124
|
-
export declare interface ISegment<T extends ITrackType> {
|
|
112
|
+
export declare interface ISegment<T extends ITrackType = ITrackType> {
|
|
125
113
|
id: string;
|
|
126
114
|
startTime: number;
|
|
127
115
|
endTime: number;
|
|
128
116
|
segmentType: T;
|
|
129
117
|
url?: string;
|
|
118
|
+
extra?: SegmentExtra<T> | null;
|
|
130
119
|
}
|
|
131
120
|
|
|
132
121
|
/**
|
|
@@ -140,15 +129,17 @@ export declare function isFilterSegment(segment: SegmentUnion): segment is IFilt
|
|
|
140
129
|
export declare function isFramesSegment(segment: SegmentUnion): segment is IFramesSegmentUnion;
|
|
141
130
|
|
|
142
131
|
/**
|
|
143
|
-
* Type guard: check if segment is
|
|
132
|
+
* Type guard: check if segment is sticker segment
|
|
144
133
|
*/
|
|
145
|
-
export declare function
|
|
134
|
+
export declare function isStickerSegment(segment: SegmentUnion): segment is IStickerSegment;
|
|
146
135
|
|
|
147
136
|
/**
|
|
148
137
|
* Type guard: check if segment is text segment
|
|
149
138
|
*/
|
|
150
139
|
export declare function isTextSegment(segment: SegmentUnion): segment is ITextSegment;
|
|
151
140
|
|
|
141
|
+
export declare type IStickerSegment = StickerSegment<'sticker'>;
|
|
142
|
+
|
|
152
143
|
/**
|
|
153
144
|
* Check if a time point is within a segment's time range
|
|
154
145
|
*/
|
|
@@ -192,6 +183,7 @@ export declare type ITrack<T extends ITrackType> = {
|
|
|
192
183
|
trackId: string;
|
|
193
184
|
trackType: T;
|
|
194
185
|
children: TrackTypeMapSegment[T][];
|
|
186
|
+
extra?: TrackExtra<T> | null;
|
|
195
187
|
} & (T extends 'frames' ? {
|
|
196
188
|
isMain?: boolean;
|
|
197
189
|
} : object);
|
|
@@ -223,15 +215,37 @@ export declare interface IVideoFramesSegment extends IFramesSegment {
|
|
|
223
215
|
* the numerical value is normalized in range [0, 1] unless otherwise specified
|
|
224
216
|
*/
|
|
225
217
|
export declare interface IVideoProtocol {
|
|
218
|
+
id: string;
|
|
226
219
|
version: `${number}.${number}.${number}`;
|
|
227
220
|
width: number;
|
|
228
221
|
height: number;
|
|
229
222
|
fps: number;
|
|
230
223
|
tracks: TrackUnion[];
|
|
224
|
+
extra?: ProtocolExtra | null;
|
|
225
|
+
}
|
|
226
|
+
|
|
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>;
|
|
233
|
+
|
|
234
|
+
export declare interface SegmentExtraRegistry {
|
|
231
235
|
}
|
|
232
236
|
|
|
233
237
|
export declare type SegmentUnion = TrackTypeMapSegment[ITrackType];
|
|
234
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
|
+
|
|
235
249
|
declare interface TextSegment<T extends ITrackType> extends ISegment<T> {
|
|
236
250
|
segmentType: T;
|
|
237
251
|
texts: ITextBasic[];
|
|
@@ -245,10 +259,15 @@ declare interface TextSegment<T extends ITrackType> extends ISegment<T> {
|
|
|
245
259
|
*/
|
|
246
260
|
export declare const TRACK_TYPES: readonly ITrackType[];
|
|
247
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
|
+
|
|
248
267
|
export declare interface TrackTypeMapSegment {
|
|
249
268
|
frames: IFramesSegmentUnion;
|
|
250
269
|
text: TextSegment<'text'>;
|
|
251
|
-
|
|
270
|
+
sticker: StickerSegment<'sticker'>;
|
|
252
271
|
audio: AudioSegment<'audio'>;
|
|
253
272
|
effect: EffectSegment<'effect'>;
|
|
254
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
|