@cliquify.me/types 4.0.14 → 4.0.15
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 +315 -322
- package/package.json +4 -11
- package/src/index.ts +816 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// BASIC TYPES AND ENUMS
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
export type ItemType =
|
|
6
|
+
| "text"
|
|
7
|
+
| "image"
|
|
8
|
+
| "video"
|
|
9
|
+
| "audio"
|
|
10
|
+
| "helper"
|
|
11
|
+
| "caption"
|
|
12
|
+
| "template"
|
|
13
|
+
| "composition"
|
|
14
|
+
| "illustration"
|
|
15
|
+
| "shape"
|
|
16
|
+
| "rect"
|
|
17
|
+
| "progressBar"
|
|
18
|
+
| "progressFrame"
|
|
19
|
+
| "radialAudioBars"
|
|
20
|
+
| "linealAudioBars"
|
|
21
|
+
| "waveAudioBars"
|
|
22
|
+
| "hillAudioBars";
|
|
23
|
+
|
|
24
|
+
export type ITrackType =
|
|
25
|
+
| "main"
|
|
26
|
+
| "text"
|
|
27
|
+
| "image"
|
|
28
|
+
| "video"
|
|
29
|
+
| "audio"
|
|
30
|
+
| "helper"
|
|
31
|
+
| "caption"
|
|
32
|
+
| "template"
|
|
33
|
+
| "composition"
|
|
34
|
+
| "illustration"
|
|
35
|
+
| "shape"
|
|
36
|
+
| "rect"
|
|
37
|
+
| "progressBar"
|
|
38
|
+
| "progressFrame"
|
|
39
|
+
| "radialAudioBars"
|
|
40
|
+
| "linealAudioBars";
|
|
41
|
+
|
|
42
|
+
export type ITransitionType =
|
|
43
|
+
| "none"
|
|
44
|
+
| "fade"
|
|
45
|
+
| "slide"
|
|
46
|
+
| "wipe"
|
|
47
|
+
| "flip"
|
|
48
|
+
| "clockWipe"
|
|
49
|
+
| "star"
|
|
50
|
+
| "circle"
|
|
51
|
+
| "rectangle"
|
|
52
|
+
| "slidingDoors";
|
|
53
|
+
|
|
54
|
+
export type IKindHistory =
|
|
55
|
+
| "add"
|
|
56
|
+
| "remove"
|
|
57
|
+
| "update"
|
|
58
|
+
| "replace"
|
|
59
|
+
| "update:details"
|
|
60
|
+
| "layer:selection"
|
|
61
|
+
| "undo"
|
|
62
|
+
| "design:resize"
|
|
63
|
+
| "design:load"
|
|
64
|
+
| "redo"
|
|
65
|
+
| "add:transition";
|
|
66
|
+
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// CORE INTERFACES
|
|
69
|
+
// ============================================================================
|
|
70
|
+
|
|
71
|
+
export interface ISize {
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
type?: string;
|
|
75
|
+
name?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface IDisplay {
|
|
79
|
+
from: number;
|
|
80
|
+
to: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface ITrim {
|
|
84
|
+
from: number;
|
|
85
|
+
to: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface IBoxShadow {
|
|
89
|
+
color: string;
|
|
90
|
+
x: number;
|
|
91
|
+
y: number;
|
|
92
|
+
blur: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface IMetadata {
|
|
96
|
+
resourceId: string;
|
|
97
|
+
order: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ============================================================================
|
|
101
|
+
// ANIMATION TYPES
|
|
102
|
+
// ============================================================================
|
|
103
|
+
|
|
104
|
+
export interface IBasicAnimation {
|
|
105
|
+
name: string;
|
|
106
|
+
composition: ICompositionAnimation[];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface ICompositionAnimation {
|
|
110
|
+
property: string;
|
|
111
|
+
from: number;
|
|
112
|
+
to: number;
|
|
113
|
+
durationInFrames: number;
|
|
114
|
+
ease?: (t: number) => number;
|
|
115
|
+
easing: string;
|
|
116
|
+
delay: number;
|
|
117
|
+
details?: {
|
|
118
|
+
fonts: {
|
|
119
|
+
fontFamily: string;
|
|
120
|
+
url: string;
|
|
121
|
+
}[];
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ============================================================================
|
|
126
|
+
// TRANSITION TYPES
|
|
127
|
+
// ============================================================================
|
|
128
|
+
|
|
129
|
+
export interface ITransition {
|
|
130
|
+
id: string;
|
|
131
|
+
trackId: string;
|
|
132
|
+
fromId: string;
|
|
133
|
+
toId: string;
|
|
134
|
+
type: string;
|
|
135
|
+
name?: string;
|
|
136
|
+
duration: number;
|
|
137
|
+
preview?: string;
|
|
138
|
+
direction?: any;
|
|
139
|
+
kind: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ============================================================================
|
|
143
|
+
// TRACK AND TIMELINE TYPES
|
|
144
|
+
// ============================================================================
|
|
145
|
+
|
|
146
|
+
export interface ITrack {
|
|
147
|
+
id: string;
|
|
148
|
+
type: ITrackType;
|
|
149
|
+
items: string[];
|
|
150
|
+
metadata?: Partial<IMetadata>;
|
|
151
|
+
accepts?: string[];
|
|
152
|
+
index?: number;
|
|
153
|
+
magnetic?: boolean;
|
|
154
|
+
static?: boolean;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface ITimelineScaleState {
|
|
158
|
+
unit: number;
|
|
159
|
+
zoom: number;
|
|
160
|
+
segments: number;
|
|
161
|
+
index: number;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface ITimelineScrollState {
|
|
165
|
+
/**
|
|
166
|
+
* Timeline scroll state by X-axis.
|
|
167
|
+
*/
|
|
168
|
+
left: number;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Timeline scroll state by Y-axis.
|
|
172
|
+
*/
|
|
173
|
+
top: number;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface CanvasSpacing {
|
|
177
|
+
left: number;
|
|
178
|
+
right: number;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface ItemStructure {
|
|
182
|
+
id: string;
|
|
183
|
+
items: string[];
|
|
184
|
+
transitions: string[];
|
|
185
|
+
tracks: ITrack[];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ============================================================================
|
|
189
|
+
// COMMON DETAILS INTERFACE
|
|
190
|
+
// ============================================================================
|
|
191
|
+
|
|
192
|
+
interface ICommonDetails {
|
|
193
|
+
width?: number;
|
|
194
|
+
height?: number;
|
|
195
|
+
transform?: string;
|
|
196
|
+
opacity?: number;
|
|
197
|
+
border?: string;
|
|
198
|
+
borderRadius?: number;
|
|
199
|
+
boxShadow?: IBoxShadow;
|
|
200
|
+
top?: number | string;
|
|
201
|
+
left?: number | string;
|
|
202
|
+
borderColor?: string;
|
|
203
|
+
borderWidth?: number;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// ============================================================================
|
|
207
|
+
// TRACK ITEM BASE AND TYPES
|
|
208
|
+
// ============================================================================
|
|
209
|
+
|
|
210
|
+
export interface ITrackItemBase {
|
|
211
|
+
id: string;
|
|
212
|
+
name: string;
|
|
213
|
+
type: ItemType;
|
|
214
|
+
preview?: string;
|
|
215
|
+
display: IDisplay;
|
|
216
|
+
duration?: number;
|
|
217
|
+
trim?: ITrim;
|
|
218
|
+
isMain?: boolean;
|
|
219
|
+
animations?: {
|
|
220
|
+
in: IBasicAnimation;
|
|
221
|
+
out: IBasicAnimation;
|
|
222
|
+
loop: IBasicAnimation;
|
|
223
|
+
};
|
|
224
|
+
playbackRate?: number;
|
|
225
|
+
modifier?: IDisplay;
|
|
226
|
+
details?: any;
|
|
227
|
+
activeEdit?: boolean;
|
|
228
|
+
metadata: Record<string, any>;
|
|
229
|
+
transitionInfo?: {
|
|
230
|
+
isFrom: boolean;
|
|
231
|
+
isTo: boolean;
|
|
232
|
+
transition: ITransition;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export type ITrackItem =
|
|
237
|
+
| IAudio
|
|
238
|
+
| IImage
|
|
239
|
+
| IText
|
|
240
|
+
| IVideo
|
|
241
|
+
| ICaption
|
|
242
|
+
| ITemplate
|
|
243
|
+
| IComposition
|
|
244
|
+
| IIllustration
|
|
245
|
+
| IShape
|
|
246
|
+
| IRect
|
|
247
|
+
| IProgressBar
|
|
248
|
+
| IProgressFrame
|
|
249
|
+
| IRadialAudioBars
|
|
250
|
+
| ILinealAudioBars
|
|
251
|
+
| IWaveAudioBars
|
|
252
|
+
| IHillAudioBars;
|
|
253
|
+
|
|
254
|
+
// ============================================================================
|
|
255
|
+
// DETAILS INTERFACES
|
|
256
|
+
// ============================================================================
|
|
257
|
+
|
|
258
|
+
export interface ICaptionWord {
|
|
259
|
+
end: number;
|
|
260
|
+
start: number;
|
|
261
|
+
word: string;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface ICaptionDetails extends ICommonDetails {
|
|
265
|
+
skewX: number;
|
|
266
|
+
skewY: number;
|
|
267
|
+
text: string;
|
|
268
|
+
fontSize: number;
|
|
269
|
+
fontFamily: string;
|
|
270
|
+
fontUrl: string;
|
|
271
|
+
color: string;
|
|
272
|
+
lineHeight: number | string;
|
|
273
|
+
letterSpacing: number | string;
|
|
274
|
+
fontWeight: number;
|
|
275
|
+
fontStyle: string;
|
|
276
|
+
textDecoration: string;
|
|
277
|
+
textAlign: "center" | "left" | "right";
|
|
278
|
+
wordSpacing: number | string;
|
|
279
|
+
textShadow: string;
|
|
280
|
+
backgroundColor: string;
|
|
281
|
+
opacity: number;
|
|
282
|
+
width: number;
|
|
283
|
+
height: number;
|
|
284
|
+
top: number | string;
|
|
285
|
+
left: number | string;
|
|
286
|
+
border: string;
|
|
287
|
+
wordWrap: "normal" | "break-word";
|
|
288
|
+
wordBreak: "normal" | "break-word" | "break-all";
|
|
289
|
+
WebkitTextStrokeColor: string;
|
|
290
|
+
WebkitTextStrokeWidth: string;
|
|
291
|
+
borderWidth: number;
|
|
292
|
+
borderColor: string;
|
|
293
|
+
boxShadow: { color: string; x: number; y: number; blur: number };
|
|
294
|
+
textTransform: "capitalize" | "uppercase" | "lowercase";
|
|
295
|
+
words: ICaptionWord[];
|
|
296
|
+
appearedColor?: string;
|
|
297
|
+
activeColor?: string;
|
|
298
|
+
activeFillColor?: string;
|
|
299
|
+
animation?: string;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface ITextDetails extends ICommonDetails {
|
|
303
|
+
skewX: number;
|
|
304
|
+
skewY: number;
|
|
305
|
+
text: string;
|
|
306
|
+
fontSize: number;
|
|
307
|
+
fontFamily: string;
|
|
308
|
+
fontUrl: string;
|
|
309
|
+
color: string;
|
|
310
|
+
lineHeight: number | string;
|
|
311
|
+
letterSpacing: number | string;
|
|
312
|
+
fontWeight: number;
|
|
313
|
+
fontStyle: string;
|
|
314
|
+
textDecoration: string;
|
|
315
|
+
textAlign: "center" | "left" | "right";
|
|
316
|
+
wordSpacing: number | string;
|
|
317
|
+
textShadow: string;
|
|
318
|
+
backgroundColor: string;
|
|
319
|
+
opacity: number;
|
|
320
|
+
width: number;
|
|
321
|
+
textTransform: "capitalize" | "uppercase" | "lowercase";
|
|
322
|
+
height: number;
|
|
323
|
+
top: number | string;
|
|
324
|
+
left: number | string;
|
|
325
|
+
border: string;
|
|
326
|
+
wordWrap: "normal" | "break-word";
|
|
327
|
+
wordBreak: "normal" | "break-word" | "break-all";
|
|
328
|
+
WebkitTextStrokeColor: string;
|
|
329
|
+
WebkitTextStrokeWidth: string;
|
|
330
|
+
borderWidth: number;
|
|
331
|
+
borderColor: string;
|
|
332
|
+
boxShadow: { color: string; x: number; y: number; blur: number };
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface IImageDetails extends ICommonDetails {
|
|
336
|
+
src: string;
|
|
337
|
+
background: string;
|
|
338
|
+
width: number;
|
|
339
|
+
height: number;
|
|
340
|
+
opacity: number;
|
|
341
|
+
transform: string;
|
|
342
|
+
border: string;
|
|
343
|
+
borderRadius: number;
|
|
344
|
+
boxShadow: IBoxShadow;
|
|
345
|
+
top: string;
|
|
346
|
+
left: string;
|
|
347
|
+
transformOrigin: string;
|
|
348
|
+
crop: {
|
|
349
|
+
x: number;
|
|
350
|
+
y: number;
|
|
351
|
+
width: number;
|
|
352
|
+
height: number;
|
|
353
|
+
};
|
|
354
|
+
blur: number;
|
|
355
|
+
brightness: number;
|
|
356
|
+
flipX: boolean;
|
|
357
|
+
flipY: boolean;
|
|
358
|
+
rotate: string;
|
|
359
|
+
visibility: "visible" | "hidden";
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export interface IVideoDetails extends ICommonDetails {
|
|
363
|
+
src: string;
|
|
364
|
+
frames?: number;
|
|
365
|
+
background?: string;
|
|
366
|
+
stream?: ReadableStream<Uint8Array>;
|
|
367
|
+
blob?: Blob;
|
|
368
|
+
width: number;
|
|
369
|
+
height: number;
|
|
370
|
+
volume?: number;
|
|
371
|
+
boxShadow?: IBoxShadow;
|
|
372
|
+
transformOrigin?: string;
|
|
373
|
+
crop?: {
|
|
374
|
+
x: number;
|
|
375
|
+
y: number;
|
|
376
|
+
width: number;
|
|
377
|
+
height: number;
|
|
378
|
+
};
|
|
379
|
+
blur: number;
|
|
380
|
+
brightness: number;
|
|
381
|
+
flipX: boolean;
|
|
382
|
+
flipY: boolean;
|
|
383
|
+
rotate: string;
|
|
384
|
+
visibility: "visible" | "hidden";
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export interface IAudioDetails extends ICommonDetails {
|
|
388
|
+
src: string;
|
|
389
|
+
volume?: number;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface IIllustrationDetails extends ICommonDetails {
|
|
393
|
+
path: string;
|
|
394
|
+
src: string;
|
|
395
|
+
width: number;
|
|
396
|
+
height: number;
|
|
397
|
+
opacity: number;
|
|
398
|
+
transform: string;
|
|
399
|
+
border: string;
|
|
400
|
+
top: string;
|
|
401
|
+
left: string;
|
|
402
|
+
flipX: boolean;
|
|
403
|
+
flipY: boolean;
|
|
404
|
+
rotate: string;
|
|
405
|
+
svgString: string;
|
|
406
|
+
initialSvgString: string;
|
|
407
|
+
visibility: "visible" | "hidden";
|
|
408
|
+
colorMap: Record<string, string>;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface IShapeDetails extends ICommonDetails {
|
|
412
|
+
path: string;
|
|
413
|
+
src: string;
|
|
414
|
+
width: number;
|
|
415
|
+
height: number;
|
|
416
|
+
opacity: number;
|
|
417
|
+
transform: string;
|
|
418
|
+
border: string;
|
|
419
|
+
top: string;
|
|
420
|
+
left: string;
|
|
421
|
+
flipX: boolean;
|
|
422
|
+
flipY: boolean;
|
|
423
|
+
rotate: string;
|
|
424
|
+
visibility: "visible" | "hidden";
|
|
425
|
+
backgroundColor: string;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export interface IRectDetails extends ICommonDetails {
|
|
429
|
+
width: number;
|
|
430
|
+
height: number;
|
|
431
|
+
opacity: number;
|
|
432
|
+
transform: string;
|
|
433
|
+
border: string;
|
|
434
|
+
top: string;
|
|
435
|
+
left: string;
|
|
436
|
+
flipX: boolean;
|
|
437
|
+
flipY: boolean;
|
|
438
|
+
rotate: string;
|
|
439
|
+
visibility: "visible" | "hidden";
|
|
440
|
+
backgroundColor: string;
|
|
441
|
+
boxShadow: IBoxShadow;
|
|
442
|
+
blur: number;
|
|
443
|
+
brightness: number;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface IProgressBarDetails extends ICommonDetails {
|
|
447
|
+
width: number;
|
|
448
|
+
height: number;
|
|
449
|
+
top: string;
|
|
450
|
+
left: string;
|
|
451
|
+
backgroundColors: string[];
|
|
452
|
+
border: string;
|
|
453
|
+
borderRadius: number;
|
|
454
|
+
borderWidth: number;
|
|
455
|
+
borderColor: string;
|
|
456
|
+
opacity: number;
|
|
457
|
+
flipX: boolean;
|
|
458
|
+
flipY: boolean;
|
|
459
|
+
inverted: boolean;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface IProgressFrameDetails extends ICommonDetails {
|
|
463
|
+
width: number;
|
|
464
|
+
height: number;
|
|
465
|
+
top: string;
|
|
466
|
+
left: string;
|
|
467
|
+
backgroundColors: string[];
|
|
468
|
+
border: string;
|
|
469
|
+
borderRadius: number;
|
|
470
|
+
borderWidth: number;
|
|
471
|
+
borderColor: string;
|
|
472
|
+
opacity: number;
|
|
473
|
+
flipX: boolean;
|
|
474
|
+
flipY: boolean;
|
|
475
|
+
inverted: boolean;
|
|
476
|
+
barThickness: number;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export interface IRadialAudioBarsDetails extends ICommonDetails {
|
|
480
|
+
width: number;
|
|
481
|
+
height: number;
|
|
482
|
+
top: string;
|
|
483
|
+
left: string;
|
|
484
|
+
border: string;
|
|
485
|
+
borderRadius: number;
|
|
486
|
+
borderWidth: number;
|
|
487
|
+
borderColor: string;
|
|
488
|
+
opacity: number;
|
|
489
|
+
flipX: boolean;
|
|
490
|
+
flipY: boolean;
|
|
491
|
+
srcs: string[];
|
|
492
|
+
reproduceAudio: boolean;
|
|
493
|
+
radialBarColor: string;
|
|
494
|
+
audioDatas: any[];
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export interface ILinealAudioBarsDetails extends ICommonDetails {
|
|
498
|
+
width: number;
|
|
499
|
+
height: number;
|
|
500
|
+
top: string;
|
|
501
|
+
left: string;
|
|
502
|
+
border: string;
|
|
503
|
+
borderRadius: number;
|
|
504
|
+
borderWidth: number;
|
|
505
|
+
borderColor: string;
|
|
506
|
+
opacity: number;
|
|
507
|
+
flipX: boolean;
|
|
508
|
+
flipY: boolean;
|
|
509
|
+
srcs: string[];
|
|
510
|
+
reproduceAudio: boolean;
|
|
511
|
+
audioDatas: any[];
|
|
512
|
+
linealBarColor: string;
|
|
513
|
+
backgroundColor: string;
|
|
514
|
+
lineThickness: number;
|
|
515
|
+
gapSize: number;
|
|
516
|
+
roundness: number;
|
|
517
|
+
placement: string | null;
|
|
518
|
+
inverted: boolean;
|
|
519
|
+
strokeColor: string;
|
|
520
|
+
fillColor: string | null;
|
|
521
|
+
strokeWidth: number | null;
|
|
522
|
+
copies: number | null;
|
|
523
|
+
offsetPixelSpeed: number;
|
|
524
|
+
lineColor: string | string[];
|
|
525
|
+
lineGap: number;
|
|
526
|
+
topRoundness: number;
|
|
527
|
+
bottomRoundness: number;
|
|
528
|
+
lines: number;
|
|
529
|
+
sections: number;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface IWaveAudioBarsDetails extends ICommonDetails {
|
|
533
|
+
width: number;
|
|
534
|
+
height: number;
|
|
535
|
+
top: string;
|
|
536
|
+
left: string;
|
|
537
|
+
border: string;
|
|
538
|
+
borderRadius: number;
|
|
539
|
+
borderWidth: number;
|
|
540
|
+
borderColor: string;
|
|
541
|
+
opacity: number;
|
|
542
|
+
flipX: boolean;
|
|
543
|
+
flipY: boolean;
|
|
544
|
+
srcs: string[];
|
|
545
|
+
reproduceAudio: boolean;
|
|
546
|
+
radialBarColor: string;
|
|
547
|
+
audioDatas: any[];
|
|
548
|
+
offsetPixelSpeed: number;
|
|
549
|
+
lineColor: string | string[];
|
|
550
|
+
lineGap: number;
|
|
551
|
+
topRoundness: number;
|
|
552
|
+
bottomRoundness: number;
|
|
553
|
+
lines: number;
|
|
554
|
+
sections: number;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export interface IHillAudioBarsDetails extends ICommonDetails {
|
|
558
|
+
width: number;
|
|
559
|
+
height: number;
|
|
560
|
+
top: string;
|
|
561
|
+
left: string;
|
|
562
|
+
border: string;
|
|
563
|
+
borderRadius: number;
|
|
564
|
+
borderWidth: number;
|
|
565
|
+
borderColor: string;
|
|
566
|
+
opacity: number;
|
|
567
|
+
flipX: boolean;
|
|
568
|
+
flipY: boolean;
|
|
569
|
+
srcs: string[];
|
|
570
|
+
reproduceAudio: boolean;
|
|
571
|
+
radialBarColor: string;
|
|
572
|
+
audioDatas: any[];
|
|
573
|
+
strokeColor: string;
|
|
574
|
+
fillColor: string | null;
|
|
575
|
+
strokeWidth: number | null;
|
|
576
|
+
copies: number | null;
|
|
577
|
+
blendMode: string | null;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// ============================================================================
|
|
581
|
+
// TRACK ITEM INTERFACES
|
|
582
|
+
// ============================================================================
|
|
583
|
+
|
|
584
|
+
export interface IText extends ITrackItemBase {
|
|
585
|
+
type: "text";
|
|
586
|
+
details: ITextDetails;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export interface ICaption extends ITrackItemBase {
|
|
590
|
+
type: "caption";
|
|
591
|
+
details: ICaptionDetails;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export interface IImage extends ITrackItemBase {
|
|
595
|
+
type: "image";
|
|
596
|
+
details: IImageDetails;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
export interface IVideo extends ITrackItemBase {
|
|
600
|
+
type: "video";
|
|
601
|
+
details: IVideoDetails;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export interface IAudio extends ITrackItemBase {
|
|
605
|
+
type: "audio";
|
|
606
|
+
details: IAudioDetails;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export interface IIllustration extends ITrackItemBase {
|
|
610
|
+
type: "illustration";
|
|
611
|
+
details: IIllustrationDetails;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export interface IShape extends ITrackItemBase {
|
|
615
|
+
type: "shape";
|
|
616
|
+
details: IShapeDetails;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export interface IRect extends ITrackItemBase {
|
|
620
|
+
type: "rect";
|
|
621
|
+
details: IRectDetails;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export interface IProgressBar extends ITrackItemBase {
|
|
625
|
+
type: "progressBar";
|
|
626
|
+
details: IProgressBarDetails;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export interface IProgressFrame extends ITrackItemBase {
|
|
630
|
+
type: "progressFrame";
|
|
631
|
+
details: IProgressFrameDetails;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export interface IRadialAudioBars extends ITrackItemBase {
|
|
635
|
+
type: "radialAudioBars";
|
|
636
|
+
details: IRadialAudioBarsDetails;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export interface ILinealAudioBars extends ITrackItemBase {
|
|
640
|
+
type: "linealAudioBars";
|
|
641
|
+
details: ILinealAudioBarsDetails;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export interface IWaveAudioBars extends ITrackItemBase {
|
|
645
|
+
type: "waveAudioBars";
|
|
646
|
+
details: IWaveAudioBarsDetails;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export interface IHillAudioBars extends ITrackItemBase {
|
|
650
|
+
type: "hillAudioBars";
|
|
651
|
+
details: IHillAudioBarsDetails;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export interface IComposition extends ITrackItemBase {
|
|
655
|
+
type: "composition";
|
|
656
|
+
trackItemIds: string[];
|
|
657
|
+
trackItemsMap: Record<string, ITrackItem>;
|
|
658
|
+
tracks: ITrack[];
|
|
659
|
+
size: ISize;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export interface ITemplate extends ITrackItemBase {
|
|
663
|
+
type: "template";
|
|
664
|
+
trackItemIds: string[];
|
|
665
|
+
trackItemsMap: Record<string, ITrackItem>;
|
|
666
|
+
transitionsMap: Record<string, ITransition>;
|
|
667
|
+
transitionIds: string[];
|
|
668
|
+
size: ISize;
|
|
669
|
+
tracks: ITrack[];
|
|
670
|
+
structure: ItemStructure[];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// ============================================================================
|
|
674
|
+
// STATE AND DESIGN INTERFACES
|
|
675
|
+
// ============================================================================
|
|
676
|
+
|
|
677
|
+
export interface State {
|
|
678
|
+
tracks: ITrack[];
|
|
679
|
+
trackItemIds: string[];
|
|
680
|
+
trackItemsMap: Record<string, ITrackItem>;
|
|
681
|
+
transitionIds: string[];
|
|
682
|
+
transitionsMap: Record<string, ITransition>;
|
|
683
|
+
scale: ITimelineScaleState;
|
|
684
|
+
duration: number;
|
|
685
|
+
activeIds: string[];
|
|
686
|
+
size: ISize;
|
|
687
|
+
structure: ItemStructure[];
|
|
688
|
+
fps: number;
|
|
689
|
+
background: {
|
|
690
|
+
type: "color" | "image";
|
|
691
|
+
value: string;
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export interface IDesign {
|
|
696
|
+
id: string | number;
|
|
697
|
+
size: ISize;
|
|
698
|
+
duration?: number;
|
|
699
|
+
fps: number; // frames per second
|
|
700
|
+
tracks: ITrack[];
|
|
701
|
+
trackItemIds: string[];
|
|
702
|
+
trackItemsMap: Record<string, ITrackItem>;
|
|
703
|
+
transitionIds: string[];
|
|
704
|
+
transitionsMap: Record<string, ITransition>;
|
|
705
|
+
structure?: ItemStructure[];
|
|
706
|
+
background?: {
|
|
707
|
+
type: "color" | "image";
|
|
708
|
+
value: string;
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// ============================================================================
|
|
713
|
+
// STATE MANAGEMENT INTERFACES
|
|
714
|
+
// ============================================================================
|
|
715
|
+
|
|
716
|
+
export interface IUpdateStateOptions {
|
|
717
|
+
updateHistory?: boolean;
|
|
718
|
+
kind?: IKindHistory;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
export interface IStateManager {
|
|
722
|
+
getState(): State;
|
|
723
|
+
subscribe(callback: (state: State) => void): void;
|
|
724
|
+
updateState(
|
|
725
|
+
partialState: Partial<State>,
|
|
726
|
+
updateHistory?: IUpdateStateOptions
|
|
727
|
+
): void;
|
|
728
|
+
subscribeToScale: (callback: (v: { scale: State["scale"] }) => void) => void;
|
|
729
|
+
subscribeToDuration: (
|
|
730
|
+
callback: (duration: { duration: State["duration"] }) => void
|
|
731
|
+
) => void;
|
|
732
|
+
subscribeToActiveIds: (
|
|
733
|
+
callback: (activeIds: { activeIds: State["activeIds"] }) => void
|
|
734
|
+
) => void;
|
|
735
|
+
subscribeToAddOrRemoveItems: (
|
|
736
|
+
callback: (trackItemIds: { trackItemIds: State["trackItemIds"] }) => void
|
|
737
|
+
) => void;
|
|
738
|
+
subscribeToHistory: (
|
|
739
|
+
callback: (history: {
|
|
740
|
+
tracks: State["tracks"];
|
|
741
|
+
trackItemsMap: State["trackItemsMap"];
|
|
742
|
+
trackItemIds: State["trackItemIds"];
|
|
743
|
+
transitionIds: State["transitionIds"];
|
|
744
|
+
transitionsMap: State["transitionsMap"];
|
|
745
|
+
}) => void
|
|
746
|
+
) => void;
|
|
747
|
+
subscribeToUpdateTrackItem: (
|
|
748
|
+
callback: (trackItemUpdate: {
|
|
749
|
+
trackItemsMap: State["trackItemsMap"];
|
|
750
|
+
}) => void
|
|
751
|
+
) => void;
|
|
752
|
+
subscribeToUpdateItemDetails: (
|
|
753
|
+
callback: (trackItemUpdate: {
|
|
754
|
+
trackItemsMap: State["trackItemsMap"];
|
|
755
|
+
}) => void
|
|
756
|
+
) => void;
|
|
757
|
+
|
|
758
|
+
subscribeToUpdateTrackItemTiming: (
|
|
759
|
+
callback: (trackItemUpdate: {
|
|
760
|
+
trackItemsMap: State["trackItemsMap"];
|
|
761
|
+
changedTrimIds?: string[];
|
|
762
|
+
changedDisplayIds?: string[];
|
|
763
|
+
}) => void
|
|
764
|
+
) => void;
|
|
765
|
+
|
|
766
|
+
subscribeToFps: (callback: (fps: { fps: State["fps"] }) => void) => void;
|
|
767
|
+
|
|
768
|
+
subscribeToUpdateAnimations: (
|
|
769
|
+
callback: (trackItemUpdate: {
|
|
770
|
+
trackItemsMap: State["trackItemsMap"];
|
|
771
|
+
changedAnimationIds?: string[];
|
|
772
|
+
}) => void
|
|
773
|
+
) => void;
|
|
774
|
+
|
|
775
|
+
subscribeToTracks: (
|
|
776
|
+
callback: (tracksUpdate: {
|
|
777
|
+
tracks: State["tracks"];
|
|
778
|
+
changedTracks: string[];
|
|
779
|
+
}) => void
|
|
780
|
+
) => void;
|
|
781
|
+
|
|
782
|
+
subscribeToState: (
|
|
783
|
+
callback: (tracksInfo: {
|
|
784
|
+
tracks: State["tracks"];
|
|
785
|
+
trackItemIds: State["trackItemIds"];
|
|
786
|
+
trackItemsMap: State["trackItemsMap"];
|
|
787
|
+
transitionIds: State["transitionIds"];
|
|
788
|
+
transitionsMap: State["transitionsMap"];
|
|
789
|
+
structure: State["structure"];
|
|
790
|
+
}) => void
|
|
791
|
+
) => void;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// ============================================================================
|
|
795
|
+
// UTILITY TYPES AND MAPS
|
|
796
|
+
// ============================================================================
|
|
797
|
+
|
|
798
|
+
export interface ITrackItemsMap {
|
|
799
|
+
[id: string]: ITrackItem;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
export interface IItemsDetailsMap {
|
|
803
|
+
[id: string]: ITrackItem;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export interface ItransitionsMap {
|
|
807
|
+
[id: string]: ITransition;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
export type ITrackItemAndDetails = ITrackItem;
|
|
811
|
+
export type IRecordItemAndDetails = Record<string, ITrackItem>;
|
|
812
|
+
|
|
813
|
+
export interface IBulkAction {
|
|
814
|
+
type: string;
|
|
815
|
+
payload?: any;
|
|
816
|
+
}
|