@designcombo/state 0.1.32 → 0.1.34
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/events.d.ts +69 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1911 -1759
- package/dist/index.umd.js +2 -2
- package/dist/state.d.ts +1 -0
- package/dist/utils/find-track.d.ts +6 -0
- package/dist/utils/load-item.d.ts +143 -141
- package/dist/utils/math.d.ts +8 -0
- package/package.json +5 -5
- package/dist/utils/validateColision.d.ts +0 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IAudio,
|
1
|
+
import { IAudio, ICaption, IDisplay, IImage, ISize, ITemplate, IText, ITrack, ITrackItem, ITrim, IVideo, IVideoDetails } from '@designcombo/types';
|
2
2
|
|
3
3
|
type OptionsType = {
|
4
4
|
size: {
|
@@ -22,6 +22,7 @@ export declare const loadVideoItem: (layer: ITrackItem & IVideo, options: Partia
|
|
22
22
|
isMain?: boolean;
|
23
23
|
animation?: any;
|
24
24
|
modifier?: IDisplay;
|
25
|
+
activeEdit?: boolean;
|
25
26
|
}>;
|
26
27
|
export declare const loadAudioItem: (payload: ITrackItem & IAudio) => Promise<{
|
27
28
|
id: string;
|
@@ -31,130 +32,28 @@ export declare const loadAudioItem: (payload: ITrackItem & IAudio) => Promise<{
|
|
31
32
|
trim: ITrim;
|
32
33
|
playbackRate: number;
|
33
34
|
details: {
|
34
|
-
src:
|
35
|
-
volume:
|
35
|
+
src: any;
|
36
|
+
volume: any;
|
36
37
|
};
|
37
38
|
metadata: {
|
38
39
|
[x: string]: any;
|
39
40
|
};
|
40
41
|
duration: number;
|
41
42
|
}>;
|
42
|
-
export declare const loadTemplateItem: (payload:
|
43
|
+
export declare const loadTemplateItem: (payload: ITemplate, options: {
|
43
44
|
size: ISize;
|
44
45
|
}) => Promise<{
|
45
46
|
id: string;
|
46
|
-
details:
|
47
|
-
trim: ITrim;
|
48
|
-
type: string;
|
49
|
-
name: string;
|
50
|
-
details: IVideoDetails;
|
51
|
-
playbackRate: number;
|
52
|
-
display: IDisplay;
|
53
|
-
duration: number;
|
54
|
-
id: string;
|
55
|
-
preview?: string;
|
56
|
-
position?: import('@designcombo/types').IPosition | null;
|
57
|
-
metadata: Record<string, any>;
|
58
|
-
isMain?: boolean;
|
59
|
-
animation?: any;
|
60
|
-
modifier?: IDisplay;
|
61
|
-
} | {
|
62
|
-
id: string;
|
63
|
-
name: string;
|
64
|
-
type: string;
|
65
|
-
display: IDisplay;
|
66
|
-
trim: ITrim;
|
67
|
-
playbackRate: number;
|
68
|
-
details: {
|
69
|
-
src: string;
|
70
|
-
volume: number;
|
71
|
-
};
|
72
|
-
metadata: {
|
73
|
-
[x: string]: any;
|
74
|
-
};
|
75
|
-
duration: number;
|
76
|
-
} | {
|
77
|
-
id: string;
|
78
|
-
name: string;
|
79
|
-
type: string;
|
80
|
-
display: IDisplay;
|
81
|
-
details: {
|
82
|
-
text: string;
|
83
|
-
height: number;
|
84
|
-
fontUrl: string;
|
85
|
-
top: string | number;
|
86
|
-
left: string | number;
|
87
|
-
borderWidth: number;
|
88
|
-
borderColor: string;
|
89
|
-
boxShadow: {
|
90
|
-
color: string;
|
91
|
-
x: number;
|
92
|
-
y: number;
|
93
|
-
blur: number;
|
94
|
-
};
|
95
|
-
fontSize: number;
|
96
|
-
fontFamily: string;
|
97
|
-
color: string;
|
98
|
-
lineHeight: number | string;
|
99
|
-
letterSpacing: number | string;
|
100
|
-
fontWeight: number;
|
101
|
-
fontStyle: string;
|
102
|
-
textDecoration: string;
|
103
|
-
textAlign: "center" | "left" | "right";
|
104
|
-
wordSpacing: number | string;
|
105
|
-
textShadow: string;
|
106
|
-
backgroundColor: string;
|
107
|
-
opacity: number;
|
108
|
-
width: number;
|
109
|
-
textTransform: "capitalize" | "uppercase" | "lowercase";
|
110
|
-
border: string;
|
111
|
-
wordWrap: "normal" | "break-word";
|
112
|
-
wordBreak: "normal" | "break-word" | "break-all";
|
113
|
-
WebkitTextStrokeColor: string;
|
114
|
-
WebkitTextStrokeWidth: string;
|
115
|
-
transform?: string;
|
116
|
-
borderRadius?: number;
|
117
|
-
};
|
118
|
-
metadata: {};
|
119
|
-
} | {
|
120
|
-
id: string;
|
121
|
-
type: string;
|
122
|
-
name: string;
|
123
|
-
display: IDisplay;
|
124
|
-
playbackRate: number;
|
125
|
-
details: {
|
126
|
-
src: string;
|
127
|
-
width: number;
|
128
|
-
height: number;
|
129
|
-
opacity: number;
|
130
|
-
transform: string;
|
131
|
-
border: string;
|
132
|
-
borderRadius: number;
|
133
|
-
boxShadow: IBoxShadow;
|
134
|
-
top: string;
|
135
|
-
left: string;
|
136
|
-
borderWidth: number;
|
137
|
-
borderColor: string;
|
138
|
-
blur: number;
|
139
|
-
brightness: number;
|
140
|
-
flipX: boolean;
|
141
|
-
flipY: boolean;
|
142
|
-
rotate: string;
|
143
|
-
visibility: "hidden" | "visible";
|
144
|
-
mediaWidth: number;
|
145
|
-
mediaHeight: number;
|
146
|
-
};
|
147
|
-
metadata: Record<string, any>;
|
148
|
-
} | undefined)[];
|
149
|
-
size: ISize;
|
150
|
-
position: {
|
47
|
+
details: {
|
151
48
|
top: number;
|
152
49
|
left: number;
|
50
|
+
scale: number;
|
51
|
+
rotate: number;
|
52
|
+
width: number;
|
53
|
+
height: number;
|
153
54
|
};
|
154
55
|
trim: IDisplay;
|
155
|
-
scale: number;
|
156
56
|
display: IDisplay;
|
157
|
-
rotate: number;
|
158
57
|
activeEdit: boolean;
|
159
58
|
}>;
|
160
59
|
export declare const loadImageItem: (payload: ITrackItem & IImage, options: {
|
@@ -170,26 +69,26 @@ export declare const loadImageItem: (payload: ITrackItem & IImage, options: {
|
|
170
69
|
display: IDisplay;
|
171
70
|
playbackRate: number;
|
172
71
|
details: {
|
173
|
-
src:
|
174
|
-
width:
|
175
|
-
height:
|
176
|
-
opacity:
|
177
|
-
transform:
|
178
|
-
border:
|
179
|
-
borderRadius:
|
180
|
-
boxShadow:
|
181
|
-
top:
|
182
|
-
left:
|
183
|
-
borderWidth:
|
184
|
-
borderColor:
|
185
|
-
blur:
|
186
|
-
brightness:
|
187
|
-
flipX:
|
188
|
-
flipY:
|
189
|
-
rotate:
|
190
|
-
visibility:
|
191
|
-
mediaWidth:
|
192
|
-
mediaHeight:
|
72
|
+
src: any;
|
73
|
+
width: any;
|
74
|
+
height: any;
|
75
|
+
opacity: any;
|
76
|
+
transform: any;
|
77
|
+
border: any;
|
78
|
+
borderRadius: any;
|
79
|
+
boxShadow: any;
|
80
|
+
top: any;
|
81
|
+
left: any;
|
82
|
+
borderWidth: any;
|
83
|
+
borderColor: any;
|
84
|
+
blur: any;
|
85
|
+
brightness: any;
|
86
|
+
flipX: any;
|
87
|
+
flipY: any;
|
88
|
+
rotate: any;
|
89
|
+
visibility: any;
|
90
|
+
mediaWidth: any;
|
91
|
+
mediaHeight: any;
|
193
92
|
};
|
194
93
|
metadata: Record<string, any>;
|
195
94
|
}>;
|
@@ -256,19 +155,119 @@ export declare const loadTextItem: (payload: ITrackItem & IText, options: {
|
|
256
155
|
type: string;
|
257
156
|
display: IDisplay;
|
258
157
|
details: {
|
259
|
-
text:
|
158
|
+
text: any;
|
260
159
|
height: number;
|
261
|
-
fontUrl:
|
160
|
+
fontUrl: any;
|
262
161
|
top: string | number;
|
263
162
|
left: string | number;
|
264
|
-
borderWidth:
|
265
|
-
borderColor:
|
266
|
-
boxShadow:
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
163
|
+
borderWidth: any;
|
164
|
+
borderColor: any;
|
165
|
+
boxShadow: any;
|
166
|
+
fontSize: number;
|
167
|
+
fontFamily: string;
|
168
|
+
color: string;
|
169
|
+
lineHeight: number | string;
|
170
|
+
letterSpacing: number | string;
|
171
|
+
fontWeight: number;
|
172
|
+
fontStyle: string;
|
173
|
+
textDecoration: string;
|
174
|
+
textAlign: "center" | "left" | "right";
|
175
|
+
wordSpacing: number | string;
|
176
|
+
textShadow: string;
|
177
|
+
backgroundColor: string;
|
178
|
+
opacity: number;
|
179
|
+
width: number;
|
180
|
+
textTransform: "capitalize" | "uppercase" | "lowercase";
|
181
|
+
border: string;
|
182
|
+
wordWrap: "normal" | "break-word";
|
183
|
+
wordBreak: "normal" | "break-word" | "break-all";
|
184
|
+
WebkitTextStrokeColor: string;
|
185
|
+
WebkitTextStrokeWidth: string;
|
186
|
+
transform?: string;
|
187
|
+
borderRadius?: number;
|
188
|
+
};
|
189
|
+
metadata: {};
|
190
|
+
}>;
|
191
|
+
export declare const loadTrackItem: (payload: ITrackItem & (IVideo | IAudio | IImage | IText | ICaption), options?: {
|
192
|
+
size?: {
|
193
|
+
width: number;
|
194
|
+
height: number;
|
195
|
+
};
|
196
|
+
origin?: number;
|
197
|
+
}) => Promise<{
|
198
|
+
trim: ITrim;
|
199
|
+
type: string;
|
200
|
+
name: string;
|
201
|
+
details: IVideoDetails;
|
202
|
+
playbackRate: number;
|
203
|
+
display: IDisplay;
|
204
|
+
duration: number;
|
205
|
+
id: string;
|
206
|
+
preview?: string;
|
207
|
+
position?: import('@designcombo/types').IPosition | null;
|
208
|
+
metadata: Record<string, any>;
|
209
|
+
isMain?: boolean;
|
210
|
+
animation?: any;
|
211
|
+
modifier?: IDisplay;
|
212
|
+
activeEdit?: boolean;
|
213
|
+
} | {
|
214
|
+
id: string;
|
215
|
+
name: string;
|
216
|
+
type: string;
|
217
|
+
display: IDisplay;
|
218
|
+
trim: ITrim;
|
219
|
+
playbackRate: number;
|
220
|
+
details: {
|
221
|
+
src: any;
|
222
|
+
volume: any;
|
223
|
+
};
|
224
|
+
metadata: {
|
225
|
+
[x: string]: any;
|
226
|
+
};
|
227
|
+
duration: number;
|
228
|
+
} | {
|
229
|
+
id: string;
|
230
|
+
type: string;
|
231
|
+
name: string;
|
232
|
+
display: IDisplay;
|
233
|
+
playbackRate: number;
|
234
|
+
details: {
|
235
|
+
src: any;
|
236
|
+
width: any;
|
237
|
+
height: any;
|
238
|
+
opacity: any;
|
239
|
+
transform: any;
|
240
|
+
border: any;
|
241
|
+
borderRadius: any;
|
242
|
+
boxShadow: any;
|
243
|
+
top: any;
|
244
|
+
left: any;
|
245
|
+
borderWidth: any;
|
246
|
+
borderColor: any;
|
247
|
+
blur: any;
|
248
|
+
brightness: any;
|
249
|
+
flipX: any;
|
250
|
+
flipY: any;
|
251
|
+
rotate: any;
|
252
|
+
visibility: any;
|
253
|
+
mediaWidth: any;
|
254
|
+
mediaHeight: any;
|
255
|
+
};
|
256
|
+
metadata: Record<string, any>;
|
257
|
+
} | {
|
258
|
+
id: string;
|
259
|
+
name: string;
|
260
|
+
type: string;
|
261
|
+
display: IDisplay;
|
262
|
+
details: {
|
263
|
+
text: any;
|
264
|
+
height: number;
|
265
|
+
fontUrl: any;
|
266
|
+
top: string | number;
|
267
|
+
left: string | number;
|
268
|
+
borderWidth: any;
|
269
|
+
borderColor: any;
|
270
|
+
boxShadow: any;
|
272
271
|
fontSize: number;
|
273
272
|
fontFamily: string;
|
274
273
|
color: string;
|
@@ -294,4 +293,7 @@ export declare const loadTextItem: (payload: ITrackItem & IText, options: {
|
|
294
293
|
};
|
295
294
|
metadata: {};
|
296
295
|
}>;
|
296
|
+
export declare function checkIfItemIsInTrack(tracks: ITrack[], trackItemIds: string[]): boolean;
|
297
|
+
export declare function checkIfTrackExists(currentTracks: ITrack[], nextTracks: ITrack[]): boolean;
|
298
|
+
export declare const loadTracks: (tracks?: Partial<ITrack>[], trackItems?: ITrackItem[]) => ITrack[];
|
297
299
|
export {};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* Clamps a value between a minimum and maximum range
|
3
|
+
* @param value The value to clamp
|
4
|
+
* @param min The minimum value
|
5
|
+
* @param max The maximum value
|
6
|
+
* @returns The clamped value
|
7
|
+
*/
|
8
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@designcombo/state",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.34",
|
4
4
|
"private": false,
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -24,8 +24,8 @@
|
|
24
24
|
"typescript": "^5.3.3",
|
25
25
|
"vite": "^5.2.0",
|
26
26
|
"vite-plugin-dts": "^3.9.1",
|
27
|
-
"@designcombo/events": "0.1.
|
28
|
-
"@designcombo/types": "0.1.
|
27
|
+
"@designcombo/events": "0.1.34",
|
28
|
+
"@designcombo/types": "0.1.34",
|
29
29
|
"@designcombo/typescript-config": "0.0.0"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
@@ -38,8 +38,8 @@
|
|
38
38
|
"nanoid": "^5.0.7"
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
|
-
"@designcombo/events": "0.1.
|
42
|
-
"@designcombo/types": "0.1.
|
41
|
+
"@designcombo/events": "0.1.34",
|
42
|
+
"@designcombo/types": "0.1.34"
|
43
43
|
},
|
44
44
|
"scripts": {
|
45
45
|
"dev": "vite",
|