@designcombo/state 5.0.5 → 5.1.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/dist/events.d.ts +1 -0
- package/dist/handlers/add/audio.d.ts +1 -0
- package/dist/handlers/add/composition.d.ts +1 -1
- package/dist/handlers/add/custom.d.ts +2 -2
- package/dist/handlers/add/image.d.ts +1 -0
- package/dist/handlers/add/video.d.ts +1 -0
- package/dist/handlers/replace-layer.d.ts +2 -2
- package/dist/handlers/replace-media.d.ts +2 -2
- package/dist/index.es.js +2724 -2620
- package/dist/index.umd.js +3 -3
- package/dist/state.d.ts +2 -5
- package/dist/utils/delete-items.d.ts +6 -0
- package/dist/utils/load-item.d.ts +219 -168
- package/dist/utils/manage-tracks.d.ts +1 -0
- package/dist/utils/replace-item.d.ts +2 -2
- package/dist/utils/update-string-ids.d.ts +4 -0
- package/dist/utils/validate-display.d.ts +6 -0
- package/package.json +4 -4
- package/dist/utils/update-transitions.d.ts +0 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IAudio, ICaption, IComposition, IDisplay, IIllustration, IImage, ILinealAudioBars, IProgressBar, IProgressFrame, IRadialAudioBars, IRect, IShape, ISize, ITemplate, IText, ITrack, ITrackItem, ITrim, IVideo, IVideoDetails } from '@designcombo/types';
|
1
|
+
import { IAudio, IBoxShadow, ICaption, IComposition, IDisplay, IIllustration, IImage, ILinealAudioBars, IProgressBar, IProgressFrame, IProgressSquare, IRadialAudioBars, IRect, IShape, ISize, ITemplate, IText, ITrack, ITrackItem, ITrim, IVideo, IVideoDetails } from '@designcombo/types';
|
2
2
|
|
3
3
|
type OptionsType = {
|
4
4
|
size: {
|
@@ -9,6 +9,15 @@ type OptionsType = {
|
|
9
9
|
scaleMode?: string;
|
10
10
|
scaleAspectRatio?: number;
|
11
11
|
};
|
12
|
+
type TargetSize = {
|
13
|
+
width: number;
|
14
|
+
height: number;
|
15
|
+
};
|
16
|
+
export declare function getTextPosition(options: Partial<OptionsType>, info: TargetSize): {
|
17
|
+
top: string;
|
18
|
+
left: string;
|
19
|
+
transform: string;
|
20
|
+
};
|
12
21
|
export declare const loadVideoItem: (layer: ITrackItem & IVideo, options: Partial<OptionsType>) => Promise<{
|
13
22
|
trim: ITrim;
|
14
23
|
type: string;
|
@@ -42,8 +51,8 @@ export declare const loadAudioItem: (payload: ITrackItem & IAudio) => Promise<{
|
|
42
51
|
trim: ITrim;
|
43
52
|
playbackRate: number;
|
44
53
|
details: {
|
45
|
-
src:
|
46
|
-
volume:
|
54
|
+
src: string;
|
55
|
+
volume: number;
|
47
56
|
};
|
48
57
|
metadata: {
|
49
58
|
[x: string]: any;
|
@@ -60,19 +69,19 @@ export declare const loadProgressBarItem: (payload: ITrackItem & IProgressBar, o
|
|
60
69
|
type: "progressBar";
|
61
70
|
display: IDisplay;
|
62
71
|
details: {
|
63
|
-
width:
|
64
|
-
height:
|
65
|
-
top:
|
66
|
-
left:
|
67
|
-
border:
|
68
|
-
borderRadius:
|
69
|
-
borderWidth:
|
70
|
-
borderColor:
|
71
|
-
opacity:
|
72
|
-
flipX:
|
73
|
-
flipY:
|
74
|
-
inverted:
|
75
|
-
backgroundColors:
|
72
|
+
width: number;
|
73
|
+
height: number;
|
74
|
+
top: string;
|
75
|
+
left: string;
|
76
|
+
border: string;
|
77
|
+
borderRadius: number;
|
78
|
+
borderWidth: number;
|
79
|
+
borderColor: string;
|
80
|
+
opacity: number;
|
81
|
+
flipX: boolean;
|
82
|
+
flipY: boolean;
|
83
|
+
inverted: boolean;
|
84
|
+
backgroundColors: string[];
|
76
85
|
};
|
77
86
|
metadata: {};
|
78
87
|
}>;
|
@@ -86,20 +95,20 @@ export declare const loadProgressFrameItem: (payload: ITrackItem & IProgressFram
|
|
86
95
|
type: "progressFrame";
|
87
96
|
display: IDisplay;
|
88
97
|
details: {
|
89
|
-
width:
|
90
|
-
height:
|
91
|
-
top:
|
92
|
-
left:
|
93
|
-
border:
|
94
|
-
borderRadius:
|
95
|
-
borderWidth:
|
96
|
-
borderColor:
|
97
|
-
opacity:
|
98
|
-
flipX:
|
99
|
-
flipY:
|
100
|
-
inverted:
|
101
|
-
backgroundColors:
|
102
|
-
barThickness:
|
98
|
+
width: number;
|
99
|
+
height: number;
|
100
|
+
top: string;
|
101
|
+
left: string;
|
102
|
+
border: string;
|
103
|
+
borderRadius: number;
|
104
|
+
borderWidth: number;
|
105
|
+
borderColor: string;
|
106
|
+
opacity: number;
|
107
|
+
flipX: boolean;
|
108
|
+
flipY: boolean;
|
109
|
+
inverted: boolean;
|
110
|
+
backgroundColors: string[];
|
111
|
+
barThickness: number;
|
103
112
|
};
|
104
113
|
metadata: {};
|
105
114
|
}>;
|
@@ -113,18 +122,47 @@ export declare const loadRadialAudioBarsItem: (payload: ITrackItem & IRadialAudi
|
|
113
122
|
type: "radialAudioBars";
|
114
123
|
display: IDisplay;
|
115
124
|
details: {
|
116
|
-
width:
|
117
|
-
height:
|
118
|
-
top:
|
119
|
-
left:
|
120
|
-
radialBarColor:
|
121
|
-
border:
|
122
|
-
borderRadius:
|
123
|
-
borderWidth:
|
124
|
-
borderColor:
|
125
|
-
opacity:
|
126
|
-
flipX:
|
127
|
-
flipY:
|
125
|
+
width: number;
|
126
|
+
height: number;
|
127
|
+
top: string;
|
128
|
+
left: string;
|
129
|
+
radialBarColor: string;
|
130
|
+
border: string;
|
131
|
+
borderRadius: number;
|
132
|
+
borderWidth: number;
|
133
|
+
borderColor: string;
|
134
|
+
opacity: number;
|
135
|
+
flipX: boolean;
|
136
|
+
flipY: boolean;
|
137
|
+
};
|
138
|
+
metadata: {};
|
139
|
+
}>;
|
140
|
+
export declare const loadProgressSquareItem: (payload: ITrackItem & IProgressSquare, options: {
|
141
|
+
size: ISize;
|
142
|
+
scaleMode?: string;
|
143
|
+
scaleAspectRatio?: number;
|
144
|
+
}) => Promise<{
|
145
|
+
id: string;
|
146
|
+
name: "progressSquare";
|
147
|
+
type: "progressSquare";
|
148
|
+
display: IDisplay;
|
149
|
+
details: {
|
150
|
+
width: number;
|
151
|
+
height: number;
|
152
|
+
top: string;
|
153
|
+
left: string;
|
154
|
+
border: string;
|
155
|
+
borderRadius: number;
|
156
|
+
borderWidth: number;
|
157
|
+
borderColor: string;
|
158
|
+
opacity: number;
|
159
|
+
strokeColors: string[];
|
160
|
+
strokeWidth: number;
|
161
|
+
strokeBackground: string;
|
162
|
+
flipX: boolean;
|
163
|
+
flipY: boolean;
|
164
|
+
rotate: string;
|
165
|
+
transform: string;
|
128
166
|
};
|
129
167
|
metadata: {};
|
130
168
|
}>;
|
@@ -141,34 +179,34 @@ export declare const loadLinealAudioBarsItem: (payload: ITrackItem & ILinealAudi
|
|
141
179
|
to: number;
|
142
180
|
};
|
143
181
|
details: {
|
144
|
-
width:
|
145
|
-
height:
|
146
|
-
top:
|
147
|
-
left:
|
148
|
-
border:
|
149
|
-
borderRadius:
|
150
|
-
borderWidth:
|
151
|
-
borderColor:
|
152
|
-
opacity:
|
153
|
-
flipX:
|
154
|
-
flipY:
|
155
|
-
inverted:
|
156
|
-
linealBarColor:
|
157
|
-
lineThickness:
|
158
|
-
gapSize:
|
159
|
-
roundness:
|
160
|
-
placement:
|
161
|
-
strokeColor:
|
162
|
-
fillColor:
|
163
|
-
strokeWidth:
|
164
|
-
copies:
|
165
|
-
offsetPixelSpeed:
|
166
|
-
lineColor:
|
167
|
-
lineGap:
|
168
|
-
topRoundness:
|
169
|
-
bottomRoundness:
|
170
|
-
lines:
|
171
|
-
sections:
|
182
|
+
width: number;
|
183
|
+
height: number;
|
184
|
+
top: string;
|
185
|
+
left: string;
|
186
|
+
border: string;
|
187
|
+
borderRadius: number;
|
188
|
+
borderWidth: number;
|
189
|
+
borderColor: string;
|
190
|
+
opacity: number;
|
191
|
+
flipX: boolean;
|
192
|
+
flipY: boolean;
|
193
|
+
inverted: boolean;
|
194
|
+
linealBarColor: string;
|
195
|
+
lineThickness: number;
|
196
|
+
gapSize: number;
|
197
|
+
roundness: number;
|
198
|
+
placement: string | null;
|
199
|
+
strokeColor: string;
|
200
|
+
fillColor: string | null;
|
201
|
+
strokeWidth: number | null;
|
202
|
+
copies: number | null;
|
203
|
+
offsetPixelSpeed: number;
|
204
|
+
lineColor: string | string[];
|
205
|
+
lineGap: number;
|
206
|
+
topRoundness: number;
|
207
|
+
bottomRoundness: number;
|
208
|
+
lines: number;
|
209
|
+
sections: number;
|
172
210
|
};
|
173
211
|
metadata: {};
|
174
212
|
}>;
|
@@ -229,24 +267,24 @@ export declare const loadIllustrationItem: (payload: ITrackItem & IIllustration,
|
|
229
267
|
display: IDisplay;
|
230
268
|
playbackRate: number;
|
231
269
|
details: {
|
232
|
-
src:
|
233
|
-
width:
|
234
|
-
height:
|
235
|
-
opacity:
|
236
|
-
transform:
|
237
|
-
border:
|
238
|
-
borderRadius:
|
239
|
-
top:
|
240
|
-
left:
|
241
|
-
borderWidth:
|
242
|
-
borderColor:
|
243
|
-
flipX:
|
244
|
-
flipY:
|
245
|
-
rotate:
|
246
|
-
visibility:
|
270
|
+
src: string;
|
271
|
+
width: number;
|
272
|
+
height: number;
|
273
|
+
opacity: number;
|
274
|
+
transform: string;
|
275
|
+
border: string;
|
276
|
+
borderRadius: number;
|
277
|
+
top: string;
|
278
|
+
left: string;
|
279
|
+
borderWidth: number;
|
280
|
+
borderColor: string;
|
281
|
+
flipX: boolean;
|
282
|
+
flipY: boolean;
|
283
|
+
rotate: string;
|
284
|
+
visibility: "hidden" | "visible";
|
247
285
|
svgString: string;
|
248
286
|
initialSvgString: string;
|
249
|
-
colorMap:
|
287
|
+
colorMap: Record<string, string>;
|
250
288
|
};
|
251
289
|
metadata: Record<string, any>;
|
252
290
|
}>;
|
@@ -264,22 +302,22 @@ export declare const loadShapeItem: (payload: ITrackItem & IShape, options: {
|
|
264
302
|
display: IDisplay;
|
265
303
|
playbackRate: number;
|
266
304
|
details: {
|
267
|
-
src:
|
268
|
-
width:
|
269
|
-
height:
|
270
|
-
opacity:
|
271
|
-
transform:
|
272
|
-
border:
|
273
|
-
borderRadius:
|
274
|
-
top:
|
275
|
-
left:
|
276
|
-
borderWidth:
|
277
|
-
borderColor:
|
278
|
-
flipX:
|
279
|
-
flipY:
|
280
|
-
rotate:
|
281
|
-
visibility:
|
282
|
-
backgroundColor:
|
305
|
+
src: string;
|
306
|
+
width: number;
|
307
|
+
height: number;
|
308
|
+
opacity: number;
|
309
|
+
transform: string;
|
310
|
+
border: string;
|
311
|
+
borderRadius: number;
|
312
|
+
top: string;
|
313
|
+
left: string;
|
314
|
+
borderWidth: number;
|
315
|
+
borderColor: string;
|
316
|
+
flipX: boolean;
|
317
|
+
flipY: boolean;
|
318
|
+
rotate: string;
|
319
|
+
visibility: "hidden" | "visible";
|
320
|
+
backgroundColor: string;
|
283
321
|
};
|
284
322
|
metadata: Record<string, any>;
|
285
323
|
}>;
|
@@ -297,24 +335,24 @@ export declare const loadRectItem: (payload: ITrackItem & IRect, options: {
|
|
297
335
|
display: IDisplay;
|
298
336
|
playbackRate: number;
|
299
337
|
details: {
|
300
|
-
width:
|
301
|
-
height:
|
302
|
-
opacity:
|
303
|
-
transform:
|
304
|
-
border:
|
305
|
-
borderRadius:
|
306
|
-
top:
|
307
|
-
left:
|
308
|
-
borderWidth:
|
309
|
-
borderColor:
|
310
|
-
flipX:
|
311
|
-
flipY:
|
312
|
-
rotate:
|
313
|
-
visibility:
|
314
|
-
backgroundColor:
|
315
|
-
boxShadow:
|
316
|
-
blur:
|
317
|
-
brightness:
|
338
|
+
width: number;
|
339
|
+
height: number;
|
340
|
+
opacity: number;
|
341
|
+
transform: string;
|
342
|
+
border: string;
|
343
|
+
borderRadius: number;
|
344
|
+
top: string;
|
345
|
+
left: string;
|
346
|
+
borderWidth: number;
|
347
|
+
borderColor: string;
|
348
|
+
flipX: boolean;
|
349
|
+
flipY: boolean;
|
350
|
+
rotate: string;
|
351
|
+
visibility: "hidden" | "visible";
|
352
|
+
backgroundColor: string;
|
353
|
+
boxShadow: IBoxShadow;
|
354
|
+
blur: number;
|
355
|
+
brightness: number;
|
318
356
|
};
|
319
357
|
metadata: Record<string, any>;
|
320
358
|
}>;
|
@@ -333,24 +371,24 @@ export declare const loadImageItem: (payload: ITrackItem & IImage, options: {
|
|
333
371
|
display: IDisplay;
|
334
372
|
playbackRate: number;
|
335
373
|
details: {
|
336
|
-
src:
|
337
|
-
width:
|
338
|
-
height:
|
339
|
-
opacity:
|
340
|
-
transform:
|
341
|
-
border:
|
342
|
-
borderRadius:
|
343
|
-
boxShadow:
|
344
|
-
top:
|
345
|
-
left:
|
346
|
-
borderWidth:
|
347
|
-
borderColor:
|
348
|
-
blur:
|
349
|
-
brightness:
|
350
|
-
flipX:
|
351
|
-
flipY:
|
352
|
-
rotate:
|
353
|
-
visibility:
|
374
|
+
src: string;
|
375
|
+
width: number;
|
376
|
+
height: number;
|
377
|
+
opacity: number;
|
378
|
+
transform: string;
|
379
|
+
border: string;
|
380
|
+
borderRadius: number;
|
381
|
+
boxShadow: IBoxShadow;
|
382
|
+
top: string;
|
383
|
+
left: string;
|
384
|
+
borderWidth: number;
|
385
|
+
borderColor: string;
|
386
|
+
blur: number;
|
387
|
+
brightness: number;
|
388
|
+
flipX: boolean;
|
389
|
+
flipY: boolean;
|
390
|
+
rotate: string;
|
391
|
+
visibility: "hidden" | "visible";
|
354
392
|
};
|
355
393
|
metadata: Record<string, any>;
|
356
394
|
}>;
|
@@ -383,6 +421,8 @@ export declare const loadCaptionItem: (trackItem: ITrackItem, options: {
|
|
383
421
|
appearedColor: string;
|
384
422
|
activeColor: string;
|
385
423
|
activeFillColor: string;
|
424
|
+
isKeywordColor: string;
|
425
|
+
preservedColorKeyWord: boolean;
|
386
426
|
skewX: number;
|
387
427
|
skewY: number;
|
388
428
|
fontSize: number;
|
@@ -407,6 +447,7 @@ export declare const loadCaptionItem: (trackItem: ITrackItem, options: {
|
|
407
447
|
WebkitTextStrokeWidth: string;
|
408
448
|
transform?: string;
|
409
449
|
borderRadius?: number;
|
450
|
+
animation?: string;
|
410
451
|
};
|
411
452
|
metadata: Record<string, any>;
|
412
453
|
}>;
|
@@ -422,14 +463,19 @@ export declare const loadTextItem: (payload: ITrackItem & IText, options: {
|
|
422
463
|
type: string;
|
423
464
|
display: IDisplay;
|
424
465
|
details: {
|
425
|
-
text:
|
466
|
+
text: string;
|
426
467
|
height: number;
|
427
|
-
fontUrl:
|
468
|
+
fontUrl: string;
|
428
469
|
top: string | number;
|
429
470
|
left: string | number;
|
430
|
-
borderWidth:
|
431
|
-
borderColor:
|
432
|
-
boxShadow:
|
471
|
+
borderWidth: number;
|
472
|
+
borderColor: string;
|
473
|
+
boxShadow: {
|
474
|
+
color: string;
|
475
|
+
x: number;
|
476
|
+
y: number;
|
477
|
+
blur: number;
|
478
|
+
};
|
433
479
|
skewX: number;
|
434
480
|
skewY: number;
|
435
481
|
fontSize: number;
|
@@ -497,8 +543,8 @@ export declare const loadTrackItem: (payload: ITrackItem & (IVideo | IAudio | II
|
|
497
543
|
trim: ITrim;
|
498
544
|
playbackRate: number;
|
499
545
|
details: {
|
500
|
-
src:
|
501
|
-
volume:
|
546
|
+
src: string;
|
547
|
+
volume: number;
|
502
548
|
};
|
503
549
|
metadata: {
|
504
550
|
[x: string]: any;
|
@@ -529,24 +575,24 @@ export declare const loadTrackItem: (payload: ITrackItem & (IVideo | IAudio | II
|
|
529
575
|
display: IDisplay;
|
530
576
|
playbackRate: number;
|
531
577
|
details: {
|
532
|
-
src:
|
533
|
-
width:
|
534
|
-
height:
|
535
|
-
opacity:
|
536
|
-
transform:
|
537
|
-
border:
|
538
|
-
borderRadius:
|
539
|
-
boxShadow:
|
540
|
-
top:
|
541
|
-
left:
|
542
|
-
borderWidth:
|
543
|
-
borderColor:
|
544
|
-
blur:
|
545
|
-
brightness:
|
546
|
-
flipX:
|
547
|
-
flipY:
|
548
|
-
rotate:
|
549
|
-
visibility:
|
578
|
+
src: string;
|
579
|
+
width: number;
|
580
|
+
height: number;
|
581
|
+
opacity: number;
|
582
|
+
transform: string;
|
583
|
+
border: string;
|
584
|
+
borderRadius: number;
|
585
|
+
boxShadow: IBoxShadow;
|
586
|
+
top: string;
|
587
|
+
left: string;
|
588
|
+
borderWidth: number;
|
589
|
+
borderColor: string;
|
590
|
+
blur: number;
|
591
|
+
brightness: number;
|
592
|
+
flipX: boolean;
|
593
|
+
flipY: boolean;
|
594
|
+
rotate: string;
|
595
|
+
visibility: "hidden" | "visible";
|
550
596
|
};
|
551
597
|
metadata: Record<string, any>;
|
552
598
|
} | {
|
@@ -555,14 +601,19 @@ export declare const loadTrackItem: (payload: ITrackItem & (IVideo | IAudio | II
|
|
555
601
|
type: string;
|
556
602
|
display: IDisplay;
|
557
603
|
details: {
|
558
|
-
text:
|
604
|
+
text: string;
|
559
605
|
height: number;
|
560
|
-
fontUrl:
|
606
|
+
fontUrl: string;
|
561
607
|
top: string | number;
|
562
608
|
left: string | number;
|
563
|
-
borderWidth:
|
564
|
-
borderColor:
|
565
|
-
boxShadow:
|
609
|
+
borderWidth: number;
|
610
|
+
borderColor: string;
|
611
|
+
boxShadow: {
|
612
|
+
color: string;
|
613
|
+
x: number;
|
614
|
+
y: number;
|
615
|
+
blur: number;
|
616
|
+
};
|
566
617
|
skewX: number;
|
567
618
|
skewY: number;
|
568
619
|
fontSize: number;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { ITrackItem } from '@designcombo/types';
|
2
2
|
|
3
|
-
export declare const getDimension: (item:
|
3
|
+
export declare const getDimension: (item: ITrackItem, info: {
|
4
4
|
width: number;
|
5
5
|
height: number;
|
6
6
|
}) => {
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { ITrackItem, ItemStructure } from '@designcombo/types';
|
2
|
+
|
3
|
+
export declare function updateStringIds(ids: string[], jsonString: string): string;
|
4
|
+
export declare function findItemIdsTemplateComposition(structure: ItemStructure[], itemId: string, trackItemsMap: Record<string, ITrackItem>): string[];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@designcombo/state",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.1.1",
|
4
4
|
"private": false,
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -25,8 +25,8 @@
|
|
25
25
|
"typescript": "^5.3.3",
|
26
26
|
"vite": "^5.2.0",
|
27
27
|
"vite-plugin-dts": "^3.9.1",
|
28
|
-
"@designcombo/
|
29
|
-
"@designcombo/
|
28
|
+
"@designcombo/typescript-config": "0.0.0",
|
29
|
+
"@designcombo/types": "5.1.1"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
32
|
"immer": "^10.1.1",
|
@@ -39,7 +39,7 @@
|
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
41
|
"@designcombo/events": "^1.0.2",
|
42
|
-
"@designcombo/types": "5.
|
42
|
+
"@designcombo/types": "5.1.1"
|
43
43
|
},
|
44
44
|
"scripts": {
|
45
45
|
"dev": "vite",
|