@shotstack/shotstack-canvas 1.9.6 → 2.0.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/README.md +13 -13
- package/dist/chunk-5BH5YLM5.js +140 -0
- package/dist/chunk-FPPKRKBX.js +66 -0
- package/dist/chunk-KBAXJEJG.js +178 -0
- package/dist/entry.node.cjs +2593 -15
- package/dist/entry.node.d.cts +748 -39
- package/dist/entry.node.d.ts +748 -39
- package/dist/entry.node.js +2247 -14
- package/dist/entry.web.d.ts +720 -39
- package/dist/entry.web.js +37349 -2969
- package/dist/{hb-ODWKSLMB.js → hb-HSWG3Q47.js} +1 -1
- package/dist/{hbjs-HHU2TAW7.js → hbjs-VGYWXH44.js} +1 -1
- package/dist/mediarecorder-fallback-5JYZBGT3.js +133 -0
- package/dist/mediarecorder-fallback-TSLY4MAU.js +11 -0
- package/dist/web-encoder-7CLF7KX4.js +171 -0
- package/dist/web-encoder-MXBT3N36.js +9 -0
- package/package.json +5 -5
- package/scripts/postinstall.js +58 -58
- package/dist/chunk-HYGMWVDX.js +0 -19
package/dist/entry.node.d.cts
CHANGED
|
@@ -12,15 +12,16 @@ declare const CanvasRichTextAssetSchema: z.ZodObject<{
|
|
|
12
12
|
width: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
13
13
|
color: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
|
|
14
14
|
opacity: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
15
|
-
}, z.core.$
|
|
15
|
+
}, z.core.$strict>>;
|
|
16
16
|
family: z.ZodDefault<z.ZodString>;
|
|
17
17
|
size: z.ZodDefault<z.ZodNumber>;
|
|
18
18
|
weight: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
19
19
|
color: z.ZodDefault<z.ZodString>;
|
|
20
20
|
opacity: z.ZodDefault<z.ZodNumber>;
|
|
21
21
|
background: z.ZodOptional<z.ZodString>;
|
|
22
|
-
}, z.core.$
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
23
|
style: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
wordSpacing: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
24
25
|
letterSpacing: z.ZodDefault<z.ZodNumber>;
|
|
25
26
|
lineHeight: z.ZodDefault<z.ZodNumber>;
|
|
26
27
|
textTransform: z.ZodDefault<z.ZodEnum<{
|
|
@@ -45,24 +46,24 @@ declare const CanvasRichTextAssetSchema: z.ZodObject<{
|
|
|
45
46
|
color: z.ZodString;
|
|
46
47
|
}, z.core.$strip>>;
|
|
47
48
|
}, z.core.$strip>>;
|
|
48
|
-
}, z.core.$
|
|
49
|
+
}, z.core.$strict>>;
|
|
49
50
|
stroke: z.ZodOptional<z.ZodObject<{
|
|
50
51
|
width: z.ZodDefault<z.ZodNumber>;
|
|
51
52
|
color: z.ZodDefault<z.ZodString>;
|
|
52
53
|
opacity: z.ZodDefault<z.ZodNumber>;
|
|
53
|
-
}, z.core.$
|
|
54
|
+
}, z.core.$strict>>;
|
|
54
55
|
shadow: z.ZodOptional<z.ZodObject<{
|
|
55
56
|
offsetX: z.ZodDefault<z.ZodNumber>;
|
|
56
57
|
offsetY: z.ZodDefault<z.ZodNumber>;
|
|
57
58
|
blur: z.ZodDefault<z.ZodNumber>;
|
|
58
59
|
color: z.ZodDefault<z.ZodString>;
|
|
59
60
|
opacity: z.ZodDefault<z.ZodNumber>;
|
|
60
|
-
}, z.core.$
|
|
61
|
+
}, z.core.$strict>>;
|
|
61
62
|
background: z.ZodOptional<z.ZodObject<{
|
|
62
63
|
borderRadius: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
63
64
|
color: z.ZodOptional<z.ZodString>;
|
|
64
65
|
opacity: z.ZodDefault<z.ZodNumber>;
|
|
65
|
-
}, z.core.$
|
|
66
|
+
}, z.core.$strict>>;
|
|
66
67
|
border: z.ZodOptional<z.ZodObject<{
|
|
67
68
|
width: z.ZodDefault<z.ZodNumber>;
|
|
68
69
|
color: z.ZodDefault<z.ZodString>;
|
|
@@ -86,7 +87,7 @@ declare const CanvasRichTextAssetSchema: z.ZodObject<{
|
|
|
86
87
|
bottom: "bottom";
|
|
87
88
|
middle: "middle";
|
|
88
89
|
}>>;
|
|
89
|
-
}, z.core.$
|
|
90
|
+
}, z.core.$strict>>;
|
|
90
91
|
animation: z.ZodOptional<z.ZodObject<{
|
|
91
92
|
preset: z.ZodEnum<{
|
|
92
93
|
typewriter: "typewriter";
|
|
@@ -108,7 +109,7 @@ declare const CanvasRichTextAssetSchema: z.ZodObject<{
|
|
|
108
109
|
up: "up";
|
|
109
110
|
down: "down";
|
|
110
111
|
}>>;
|
|
111
|
-
}, z.core.$
|
|
112
|
+
}, z.core.$strict>>;
|
|
112
113
|
customFonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
113
114
|
src: z.ZodString;
|
|
114
115
|
family: z.ZodString;
|
|
@@ -130,37 +131,37 @@ declare const CanvasSvgAssetSchema: z.ZodObject<{
|
|
|
130
131
|
width: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
131
132
|
height: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
132
133
|
cornerRadius: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
133
|
-
}, z.core.$
|
|
134
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
134
135
|
type: z.ZodEnum<{
|
|
135
136
|
circle: "circle";
|
|
136
137
|
}>;
|
|
137
138
|
radius: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
138
|
-
}, z.core.$
|
|
139
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
139
140
|
type: z.ZodEnum<{
|
|
140
141
|
ellipse: "ellipse";
|
|
141
142
|
}>;
|
|
142
143
|
radiusX: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
143
144
|
radiusY: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
144
|
-
}, z.core.$
|
|
145
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
145
146
|
type: z.ZodEnum<{
|
|
146
147
|
line: "line";
|
|
147
148
|
}>;
|
|
148
149
|
length: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
149
150
|
thickness: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
150
|
-
}, z.core.$
|
|
151
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
151
152
|
type: z.ZodEnum<{
|
|
152
153
|
polygon: "polygon";
|
|
153
154
|
}>;
|
|
154
155
|
sides: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
155
156
|
radius: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
156
|
-
}, z.core.$
|
|
157
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
157
158
|
type: z.ZodEnum<{
|
|
158
159
|
star: "star";
|
|
159
160
|
}>;
|
|
160
161
|
points: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
161
162
|
outerRadius: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
162
163
|
innerRadius: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
163
|
-
}, z.core.$
|
|
164
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
164
165
|
type: z.ZodEnum<{
|
|
165
166
|
arrow: "arrow";
|
|
166
167
|
}>;
|
|
@@ -168,37 +169,37 @@ declare const CanvasSvgAssetSchema: z.ZodObject<{
|
|
|
168
169
|
headWidth: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
169
170
|
headLength: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
170
171
|
shaftWidth: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
171
|
-
}, z.core.$
|
|
172
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
172
173
|
type: z.ZodEnum<{
|
|
173
174
|
heart: "heart";
|
|
174
175
|
}>;
|
|
175
176
|
size: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
176
|
-
}, z.core.$
|
|
177
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
177
178
|
type: z.ZodEnum<{
|
|
178
179
|
cross: "cross";
|
|
179
180
|
}>;
|
|
180
181
|
width: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
181
182
|
height: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
182
183
|
thickness: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
183
|
-
}, z.core.$
|
|
184
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
184
185
|
type: z.ZodEnum<{
|
|
185
186
|
ring: "ring";
|
|
186
187
|
}>;
|
|
187
188
|
outerRadius: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
188
189
|
innerRadius: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
189
|
-
}, z.core.$
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
190
191
|
type: z.ZodEnum<{
|
|
191
192
|
path: "path";
|
|
192
193
|
}>;
|
|
193
194
|
d: z.ZodString;
|
|
194
|
-
}, z.core.$
|
|
195
|
+
}, z.core.$strict>], "type">>;
|
|
195
196
|
fill: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
196
197
|
type: z.ZodEnum<{
|
|
197
198
|
solid: "solid";
|
|
198
199
|
}>;
|
|
199
200
|
color: z.ZodDefault<z.ZodString>;
|
|
200
201
|
opacity: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
201
|
-
}, z.core.$
|
|
202
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
202
203
|
type: z.ZodEnum<{
|
|
203
204
|
linear: "linear";
|
|
204
205
|
}>;
|
|
@@ -206,18 +207,18 @@ declare const CanvasSvgAssetSchema: z.ZodObject<{
|
|
|
206
207
|
stops: z.ZodArray<z.ZodObject<{
|
|
207
208
|
offset: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
208
209
|
color: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
209
|
-
}, z.core.$
|
|
210
|
+
}, z.core.$strict>>;
|
|
210
211
|
opacity: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
211
|
-
}, z.core.$
|
|
212
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
212
213
|
type: z.ZodEnum<{
|
|
213
214
|
radial: "radial";
|
|
214
215
|
}>;
|
|
215
216
|
stops: z.ZodArray<z.ZodObject<{
|
|
216
217
|
offset: z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>;
|
|
217
218
|
color: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
218
|
-
}, z.core.$
|
|
219
|
+
}, z.core.$strict>>;
|
|
219
220
|
opacity: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
220
|
-
}, z.core.$
|
|
221
|
+
}, z.core.$strict>], "type">>;
|
|
221
222
|
stroke: z.ZodOptional<z.ZodObject<{
|
|
222
223
|
color: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
|
|
223
224
|
width: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
@@ -234,14 +235,14 @@ declare const CanvasSvgAssetSchema: z.ZodObject<{
|
|
|
234
235
|
}>>;
|
|
235
236
|
dashArray: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
236
237
|
dashOffset: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
237
|
-
}, z.core.$
|
|
238
|
+
}, z.core.$strict>>;
|
|
238
239
|
shadow: z.ZodOptional<z.ZodObject<{
|
|
239
240
|
offsetX: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
240
241
|
offsetY: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
241
242
|
blur: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
242
243
|
color: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
|
|
243
244
|
opacity: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
244
|
-
}, z.core.$
|
|
245
|
+
}, z.core.$strict>>;
|
|
245
246
|
transform: z.ZodOptional<z.ZodObject<{
|
|
246
247
|
x: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
247
248
|
y: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
@@ -249,13 +250,447 @@ declare const CanvasSvgAssetSchema: z.ZodObject<{
|
|
|
249
250
|
scale: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
250
251
|
originX: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
251
252
|
originY: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
252
|
-
}, z.core.$
|
|
253
|
+
}, z.core.$strict>>;
|
|
253
254
|
opacity: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
254
255
|
width: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
|
|
255
256
|
height: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>;
|
|
257
|
+
}, z.core.$strict>;
|
|
258
|
+
declare const richCaptionAssetSchema: z.ZodObject<{
|
|
259
|
+
type: z.ZodLiteral<"rich-caption">;
|
|
260
|
+
src: z.ZodOptional<z.ZodString>;
|
|
261
|
+
words: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
262
|
+
text: z.ZodString;
|
|
263
|
+
start: z.ZodNumber;
|
|
264
|
+
end: z.ZodNumber;
|
|
265
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
266
|
+
}, z.core.$strict>>>;
|
|
267
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
268
|
+
family: z.ZodDefault<z.ZodString>;
|
|
269
|
+
size: z.ZodDefault<z.ZodNumber>;
|
|
270
|
+
weight: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
271
|
+
color: z.ZodDefault<z.ZodString>;
|
|
272
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
273
|
+
background: z.ZodOptional<z.ZodString>;
|
|
274
|
+
}, z.core.$strip>>;
|
|
275
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
276
|
+
wordSpacing: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
277
|
+
letterSpacing: z.ZodDefault<z.ZodNumber>;
|
|
278
|
+
lineHeight: z.ZodDefault<z.ZodNumber>;
|
|
279
|
+
textTransform: z.ZodDefault<z.ZodEnum<{
|
|
280
|
+
none: "none";
|
|
281
|
+
uppercase: "uppercase";
|
|
282
|
+
lowercase: "lowercase";
|
|
283
|
+
capitalize: "capitalize";
|
|
284
|
+
}>>;
|
|
285
|
+
textDecoration: z.ZodDefault<z.ZodEnum<{
|
|
286
|
+
none: "none";
|
|
287
|
+
underline: "underline";
|
|
288
|
+
"line-through": "line-through";
|
|
289
|
+
}>>;
|
|
290
|
+
gradient: z.ZodOptional<z.ZodObject<{
|
|
291
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
292
|
+
linear: "linear";
|
|
293
|
+
radial: "radial";
|
|
294
|
+
}>>;
|
|
295
|
+
angle: z.ZodDefault<z.ZodNumber>;
|
|
296
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
297
|
+
offset: z.ZodNumber;
|
|
298
|
+
color: z.ZodString;
|
|
299
|
+
}, z.core.$strip>>;
|
|
300
|
+
}, z.core.$strip>>;
|
|
301
|
+
}, z.core.$strict>>;
|
|
302
|
+
stroke: z.ZodOptional<z.ZodObject<{
|
|
303
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
304
|
+
color: z.ZodDefault<z.ZodString>;
|
|
305
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
306
|
+
}, z.core.$strict>>;
|
|
307
|
+
shadow: z.ZodOptional<z.ZodObject<{
|
|
308
|
+
offsetX: z.ZodDefault<z.ZodNumber>;
|
|
309
|
+
offsetY: z.ZodDefault<z.ZodNumber>;
|
|
310
|
+
blur: z.ZodDefault<z.ZodNumber>;
|
|
311
|
+
color: z.ZodDefault<z.ZodString>;
|
|
312
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
313
|
+
}, z.core.$strict>>;
|
|
314
|
+
background: z.ZodOptional<z.ZodObject<{
|
|
315
|
+
borderRadius: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
316
|
+
color: z.ZodOptional<z.ZodString>;
|
|
317
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
318
|
+
}, z.core.$strict>>;
|
|
319
|
+
padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
320
|
+
top: z.ZodDefault<z.ZodNumber>;
|
|
321
|
+
right: z.ZodDefault<z.ZodNumber>;
|
|
322
|
+
bottom: z.ZodDefault<z.ZodNumber>;
|
|
323
|
+
left: z.ZodDefault<z.ZodNumber>;
|
|
324
|
+
}, z.core.$strip>]>>;
|
|
325
|
+
align: z.ZodOptional<z.ZodObject<{
|
|
326
|
+
horizontal: z.ZodDefault<z.ZodEnum<{
|
|
327
|
+
center: "center";
|
|
328
|
+
right: "right";
|
|
329
|
+
left: "left";
|
|
330
|
+
}>>;
|
|
331
|
+
vertical: z.ZodDefault<z.ZodEnum<{
|
|
332
|
+
top: "top";
|
|
333
|
+
bottom: "bottom";
|
|
334
|
+
middle: "middle";
|
|
335
|
+
}>>;
|
|
336
|
+
}, z.core.$strict>>;
|
|
337
|
+
active: z.ZodOptional<z.ZodObject<{
|
|
338
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
339
|
+
color: z.ZodDefault<z.ZodString>;
|
|
340
|
+
background: z.ZodOptional<z.ZodString>;
|
|
341
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
342
|
+
}, z.core.$strip>>;
|
|
343
|
+
stroke: z.ZodOptional<z.ZodObject<{
|
|
344
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
345
|
+
color: z.ZodOptional<z.ZodString>;
|
|
346
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
347
|
+
}, z.core.$strip>>;
|
|
348
|
+
scale: z.ZodDefault<z.ZodNumber>;
|
|
349
|
+
}, z.core.$strict>>;
|
|
350
|
+
wordAnimation: z.ZodOptional<z.ZodObject<{
|
|
351
|
+
style: z.ZodDefault<z.ZodEnum<{
|
|
352
|
+
typewriter: "typewriter";
|
|
353
|
+
none: "none";
|
|
354
|
+
karaoke: "karaoke";
|
|
355
|
+
highlight: "highlight";
|
|
356
|
+
pop: "pop";
|
|
357
|
+
fade: "fade";
|
|
358
|
+
slide: "slide";
|
|
359
|
+
bounce: "bounce";
|
|
360
|
+
}>>;
|
|
361
|
+
speed: z.ZodDefault<z.ZodNumber>;
|
|
362
|
+
direction: z.ZodDefault<z.ZodEnum<{
|
|
363
|
+
right: "right";
|
|
364
|
+
left: "left";
|
|
365
|
+
up: "up";
|
|
366
|
+
down: "down";
|
|
367
|
+
}>>;
|
|
368
|
+
}, z.core.$strict>>;
|
|
369
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
370
|
+
center: "center";
|
|
371
|
+
top: "top";
|
|
372
|
+
bottom: "bottom";
|
|
373
|
+
}>>;
|
|
374
|
+
maxWidth: z.ZodDefault<z.ZodNumber>;
|
|
375
|
+
maxLines: z.ZodDefault<z.ZodNumber>;
|
|
376
|
+
}, z.core.$strip>;
|
|
377
|
+
declare const CanvasRichCaptionAssetSchema: z.ZodObject<{
|
|
378
|
+
type: z.ZodLiteral<"rich-caption">;
|
|
379
|
+
src: z.ZodOptional<z.ZodString>;
|
|
380
|
+
words: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
381
|
+
text: z.ZodString;
|
|
382
|
+
start: z.ZodNumber;
|
|
383
|
+
end: z.ZodNumber;
|
|
384
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
385
|
+
}, z.core.$strict>>>;
|
|
386
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
387
|
+
family: z.ZodDefault<z.ZodString>;
|
|
388
|
+
size: z.ZodDefault<z.ZodNumber>;
|
|
389
|
+
weight: z.ZodDefault<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
390
|
+
color: z.ZodDefault<z.ZodString>;
|
|
391
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
392
|
+
background: z.ZodOptional<z.ZodString>;
|
|
393
|
+
}, z.core.$strip>>;
|
|
394
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
395
|
+
wordSpacing: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
396
|
+
letterSpacing: z.ZodDefault<z.ZodNumber>;
|
|
397
|
+
lineHeight: z.ZodDefault<z.ZodNumber>;
|
|
398
|
+
textTransform: z.ZodDefault<z.ZodEnum<{
|
|
399
|
+
none: "none";
|
|
400
|
+
uppercase: "uppercase";
|
|
401
|
+
lowercase: "lowercase";
|
|
402
|
+
capitalize: "capitalize";
|
|
403
|
+
}>>;
|
|
404
|
+
textDecoration: z.ZodDefault<z.ZodEnum<{
|
|
405
|
+
none: "none";
|
|
406
|
+
underline: "underline";
|
|
407
|
+
"line-through": "line-through";
|
|
408
|
+
}>>;
|
|
409
|
+
gradient: z.ZodOptional<z.ZodObject<{
|
|
410
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
411
|
+
linear: "linear";
|
|
412
|
+
radial: "radial";
|
|
413
|
+
}>>;
|
|
414
|
+
angle: z.ZodDefault<z.ZodNumber>;
|
|
415
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
416
|
+
offset: z.ZodNumber;
|
|
417
|
+
color: z.ZodString;
|
|
418
|
+
}, z.core.$strip>>;
|
|
419
|
+
}, z.core.$strip>>;
|
|
420
|
+
}, z.core.$strict>>;
|
|
421
|
+
stroke: z.ZodOptional<z.ZodObject<{
|
|
422
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
423
|
+
color: z.ZodDefault<z.ZodString>;
|
|
424
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
425
|
+
}, z.core.$strict>>;
|
|
426
|
+
shadow: z.ZodOptional<z.ZodObject<{
|
|
427
|
+
offsetX: z.ZodDefault<z.ZodNumber>;
|
|
428
|
+
offsetY: z.ZodDefault<z.ZodNumber>;
|
|
429
|
+
blur: z.ZodDefault<z.ZodNumber>;
|
|
430
|
+
color: z.ZodDefault<z.ZodString>;
|
|
431
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
432
|
+
}, z.core.$strict>>;
|
|
433
|
+
background: z.ZodOptional<z.ZodObject<{
|
|
434
|
+
borderRadius: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNumber>, z.ZodString]>>>;
|
|
435
|
+
color: z.ZodOptional<z.ZodString>;
|
|
436
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
437
|
+
}, z.core.$strict>>;
|
|
438
|
+
padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
439
|
+
top: z.ZodDefault<z.ZodNumber>;
|
|
440
|
+
right: z.ZodDefault<z.ZodNumber>;
|
|
441
|
+
bottom: z.ZodDefault<z.ZodNumber>;
|
|
442
|
+
left: z.ZodDefault<z.ZodNumber>;
|
|
443
|
+
}, z.core.$strip>]>>;
|
|
444
|
+
align: z.ZodOptional<z.ZodObject<{
|
|
445
|
+
horizontal: z.ZodDefault<z.ZodEnum<{
|
|
446
|
+
center: "center";
|
|
447
|
+
right: "right";
|
|
448
|
+
left: "left";
|
|
449
|
+
}>>;
|
|
450
|
+
vertical: z.ZodDefault<z.ZodEnum<{
|
|
451
|
+
top: "top";
|
|
452
|
+
bottom: "bottom";
|
|
453
|
+
middle: "middle";
|
|
454
|
+
}>>;
|
|
455
|
+
}, z.core.$strict>>;
|
|
456
|
+
active: z.ZodOptional<z.ZodObject<{
|
|
457
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
458
|
+
color: z.ZodDefault<z.ZodString>;
|
|
459
|
+
background: z.ZodOptional<z.ZodString>;
|
|
460
|
+
opacity: z.ZodDefault<z.ZodNumber>;
|
|
461
|
+
}, z.core.$strip>>;
|
|
462
|
+
stroke: z.ZodOptional<z.ZodObject<{
|
|
463
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
464
|
+
color: z.ZodOptional<z.ZodString>;
|
|
465
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
466
|
+
}, z.core.$strip>>;
|
|
467
|
+
scale: z.ZodDefault<z.ZodNumber>;
|
|
468
|
+
}, z.core.$strict>>;
|
|
469
|
+
wordAnimation: z.ZodOptional<z.ZodObject<{
|
|
470
|
+
style: z.ZodDefault<z.ZodEnum<{
|
|
471
|
+
typewriter: "typewriter";
|
|
472
|
+
none: "none";
|
|
473
|
+
karaoke: "karaoke";
|
|
474
|
+
highlight: "highlight";
|
|
475
|
+
pop: "pop";
|
|
476
|
+
fade: "fade";
|
|
477
|
+
slide: "slide";
|
|
478
|
+
bounce: "bounce";
|
|
479
|
+
}>>;
|
|
480
|
+
speed: z.ZodDefault<z.ZodNumber>;
|
|
481
|
+
direction: z.ZodDefault<z.ZodEnum<{
|
|
482
|
+
right: "right";
|
|
483
|
+
left: "left";
|
|
484
|
+
up: "up";
|
|
485
|
+
down: "down";
|
|
486
|
+
}>>;
|
|
487
|
+
}, z.core.$strict>>;
|
|
488
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
489
|
+
center: "center";
|
|
490
|
+
top: "top";
|
|
491
|
+
bottom: "bottom";
|
|
492
|
+
}>>;
|
|
493
|
+
maxWidth: z.ZodDefault<z.ZodNumber>;
|
|
494
|
+
maxLines: z.ZodDefault<z.ZodNumber>;
|
|
256
495
|
}, z.core.$strip>;
|
|
496
|
+
type CanvasRichCaptionAsset = z.infer<typeof CanvasRichCaptionAssetSchema>;
|
|
257
497
|
type CanvasSvgAsset = z.infer<typeof CanvasSvgAssetSchema>;
|
|
258
498
|
|
|
499
|
+
interface HBBlob {
|
|
500
|
+
destroy(): void;
|
|
501
|
+
}
|
|
502
|
+
interface HBFace {
|
|
503
|
+
destroy(): void;
|
|
504
|
+
upem?: number;
|
|
505
|
+
}
|
|
506
|
+
interface HBFont {
|
|
507
|
+
destroy(): void;
|
|
508
|
+
glyphToPath(glyphId: number): string;
|
|
509
|
+
setScale(xScale: number, yScale: number): void;
|
|
510
|
+
setVariations(variations: string): void;
|
|
511
|
+
}
|
|
512
|
+
interface HBGlyphInfo {
|
|
513
|
+
g: number;
|
|
514
|
+
ax: number;
|
|
515
|
+
ay: number;
|
|
516
|
+
dx: number;
|
|
517
|
+
dy: number;
|
|
518
|
+
cl: number;
|
|
519
|
+
}
|
|
520
|
+
interface HBBuffer {
|
|
521
|
+
addText(text: string): void;
|
|
522
|
+
guessSegmentProperties(): void;
|
|
523
|
+
json(): HBGlyphInfo[];
|
|
524
|
+
destroy(): void;
|
|
525
|
+
}
|
|
526
|
+
interface HB {
|
|
527
|
+
createBlob(data: ArrayBuffer): HBBlob;
|
|
528
|
+
createFace(blob: HBBlob, index: number): HBFace;
|
|
529
|
+
createFont(face: HBFace): HBFont;
|
|
530
|
+
createBuffer(): HBBuffer;
|
|
531
|
+
shape(font: HBFont, buffer: HBBuffer): void;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
type FontDescriptor = {
|
|
535
|
+
family: string;
|
|
536
|
+
weight?: string | number;
|
|
537
|
+
};
|
|
538
|
+
declare class FontRegistry {
|
|
539
|
+
private hb;
|
|
540
|
+
private faces;
|
|
541
|
+
private fonts;
|
|
542
|
+
private blobs;
|
|
543
|
+
private fontkitFonts;
|
|
544
|
+
private fontkitBaseFonts;
|
|
545
|
+
private colorEmojiFonts;
|
|
546
|
+
private colorEmojiFontBytes;
|
|
547
|
+
private registeredCanvasFonts;
|
|
548
|
+
private wasmBaseURL?;
|
|
549
|
+
private initPromise?;
|
|
550
|
+
private emojiFallbackDesc?;
|
|
551
|
+
private static sharedInstance;
|
|
552
|
+
private static refCount;
|
|
553
|
+
private static sharedInitPromise;
|
|
554
|
+
private static fallbackLoader?;
|
|
555
|
+
static setFallbackLoader(loader: (desc: FontDescriptor) => Promise<ArrayBuffer | undefined>): void;
|
|
556
|
+
static getSharedInstance(wasmBaseURL?: string): Promise<FontRegistry>;
|
|
557
|
+
static getRefCount(): number;
|
|
558
|
+
static hasSharedInstance(): boolean;
|
|
559
|
+
release(): void;
|
|
560
|
+
static resetSharedInstance(): void;
|
|
561
|
+
setEmojiFallback(desc: FontDescriptor): void;
|
|
562
|
+
isColorEmojiFont(family: string): boolean;
|
|
563
|
+
getColorEmojiFontBytes(family: string): ArrayBuffer | undefined;
|
|
564
|
+
getColorEmojiFontFamilies(): string[];
|
|
565
|
+
private detectColorEmojiFont;
|
|
566
|
+
constructor(wasmBaseURL?: string);
|
|
567
|
+
init(): Promise<void>;
|
|
568
|
+
private _doInit;
|
|
569
|
+
getHB(): Promise<HB>;
|
|
570
|
+
private key;
|
|
571
|
+
hasRegisteredFace(desc: FontDescriptor): boolean;
|
|
572
|
+
registerFromBytes(bytes: ArrayBuffer, desc: FontDescriptor): Promise<void>;
|
|
573
|
+
private tryFallbackInstall;
|
|
574
|
+
getFont(desc: FontDescriptor): Promise<HBFont>;
|
|
575
|
+
private tryDeriveFromExistingFont;
|
|
576
|
+
getFace(desc: FontDescriptor): Promise<HBFace | undefined>;
|
|
577
|
+
getUnitsPerEm(desc: FontDescriptor): Promise<number>;
|
|
578
|
+
glyphPath(desc: FontDescriptor, glyphId: number): Promise<string>;
|
|
579
|
+
private registerWithCanvas;
|
|
580
|
+
destroy(): void;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
interface WordTiming {
|
|
584
|
+
text: string;
|
|
585
|
+
start: number;
|
|
586
|
+
end: number;
|
|
587
|
+
confidence?: number;
|
|
588
|
+
}
|
|
589
|
+
interface CaptionLayoutConfig {
|
|
590
|
+
frameWidth: number;
|
|
591
|
+
frameHeight: number;
|
|
592
|
+
maxWidth: number;
|
|
593
|
+
maxLines: number;
|
|
594
|
+
position: "top" | "center" | "bottom";
|
|
595
|
+
fontSize: number;
|
|
596
|
+
fontFamily: string;
|
|
597
|
+
fontWeight: string | number;
|
|
598
|
+
letterSpacing: number;
|
|
599
|
+
wordSpacing: number;
|
|
600
|
+
lineHeight: number;
|
|
601
|
+
textTransform: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
602
|
+
pauseThreshold: number;
|
|
603
|
+
measureTextWidth?: (text: string, font: string) => number;
|
|
604
|
+
}
|
|
605
|
+
interface ShapedWordGlyph {
|
|
606
|
+
id: number;
|
|
607
|
+
xAdvance: number;
|
|
608
|
+
xOffset: number;
|
|
609
|
+
yOffset: number;
|
|
610
|
+
cluster: number;
|
|
611
|
+
}
|
|
612
|
+
interface ShapedWord {
|
|
613
|
+
text: string;
|
|
614
|
+
width: number;
|
|
615
|
+
glyphs: ShapedWordGlyph[];
|
|
616
|
+
isRTL: boolean;
|
|
617
|
+
}
|
|
618
|
+
interface CaptionLine {
|
|
619
|
+
wordIndices: number[];
|
|
620
|
+
x: number;
|
|
621
|
+
y: number;
|
|
622
|
+
width: number;
|
|
623
|
+
height: number;
|
|
624
|
+
}
|
|
625
|
+
interface CaptionGroup {
|
|
626
|
+
wordIndices: number[];
|
|
627
|
+
startTime: number;
|
|
628
|
+
endTime: number;
|
|
629
|
+
lines: CaptionLine[];
|
|
630
|
+
}
|
|
631
|
+
interface PositionedWord {
|
|
632
|
+
wordIndex: number;
|
|
633
|
+
text: string;
|
|
634
|
+
x: number;
|
|
635
|
+
y: number;
|
|
636
|
+
width: number;
|
|
637
|
+
startTime: number;
|
|
638
|
+
endTime: number;
|
|
639
|
+
isRTL: boolean;
|
|
640
|
+
}
|
|
641
|
+
interface CaptionLayout {
|
|
642
|
+
store: WordTimingStore;
|
|
643
|
+
groups: CaptionGroup[];
|
|
644
|
+
shapedWords: ShapedWord[];
|
|
645
|
+
}
|
|
646
|
+
declare function isRTLText(text: string): boolean;
|
|
647
|
+
declare class WordTimingStore {
|
|
648
|
+
startTimes: Uint32Array;
|
|
649
|
+
endTimes: Uint32Array;
|
|
650
|
+
xPositions: Float32Array;
|
|
651
|
+
yPositions: Float32Array;
|
|
652
|
+
widths: Float32Array;
|
|
653
|
+
words: string[];
|
|
654
|
+
length: number;
|
|
655
|
+
constructor(words: WordTiming[]);
|
|
656
|
+
}
|
|
657
|
+
declare function findWordAtTime(store: WordTimingStore, timeMs: number): number;
|
|
658
|
+
declare function groupWordsByPause(store: WordTimingStore, pauseThreshold?: number): number[][];
|
|
659
|
+
declare class CaptionLayoutEngine {
|
|
660
|
+
private fontRegistry;
|
|
661
|
+
private cache;
|
|
662
|
+
private layoutEngine;
|
|
663
|
+
constructor(fontRegistry: FontRegistry);
|
|
664
|
+
private measureWord;
|
|
665
|
+
layoutCaption(words: WordTiming[], config: CaptionLayoutConfig): Promise<CaptionLayout>;
|
|
666
|
+
getVisibleWordsAtTime(layout: CaptionLayout, timeMs: number): PositionedWord[];
|
|
667
|
+
getActiveWordAtTime(layout: CaptionLayout, timeMs: number): PositionedWord | null;
|
|
668
|
+
clearCache(): void;
|
|
669
|
+
getCacheStats(): {
|
|
670
|
+
size: number;
|
|
671
|
+
calculatedSize: number;
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
type AnimationStyle = "karaoke" | "highlight" | "pop" | "fade" | "slide" | "bounce" | "typewriter" | "none";
|
|
676
|
+
type AnimationDirection = "left" | "right" | "up" | "down";
|
|
677
|
+
interface WordAnimationConfig {
|
|
678
|
+
style: AnimationStyle;
|
|
679
|
+
speed: number;
|
|
680
|
+
direction: AnimationDirection;
|
|
681
|
+
}
|
|
682
|
+
interface WordAnimationState {
|
|
683
|
+
opacity: number;
|
|
684
|
+
scale: number;
|
|
685
|
+
translateX: number;
|
|
686
|
+
translateY: number;
|
|
687
|
+
fillProgress: number;
|
|
688
|
+
isActive: boolean;
|
|
689
|
+
visibleCharacters: number;
|
|
690
|
+
}
|
|
691
|
+
declare function calculateAnimationStatesForGroup(words: PositionedWord[], currentTime: number, config: WordAnimationConfig, activeScale?: number, fontSize?: number): Map<number, WordAnimationState>;
|
|
692
|
+
declare function getDefaultAnimationConfig(): WordAnimationConfig;
|
|
693
|
+
|
|
259
694
|
type ShotstackRichTextAsset = components["schemas"]["RichTextAsset"];
|
|
260
695
|
type ShotstackSvgAsset = components["schemas"]["SvgAsset"];
|
|
261
696
|
type RGBA = {
|
|
@@ -430,6 +865,56 @@ type DrawOp = {
|
|
|
430
865
|
x: number;
|
|
431
866
|
y: number;
|
|
432
867
|
stroke: StrokeSpec;
|
|
868
|
+
} | {
|
|
869
|
+
op: "DrawCaptionWord";
|
|
870
|
+
text: string;
|
|
871
|
+
x: number;
|
|
872
|
+
y: number;
|
|
873
|
+
width: number;
|
|
874
|
+
fontSize: number;
|
|
875
|
+
fontFamily: string;
|
|
876
|
+
fontWeight: string;
|
|
877
|
+
baseColor: string;
|
|
878
|
+
activeColor: string;
|
|
879
|
+
baseOpacity: number;
|
|
880
|
+
activeOpacity: number;
|
|
881
|
+
fillProgress: number;
|
|
882
|
+
transform: {
|
|
883
|
+
scale: number;
|
|
884
|
+
translateX: number;
|
|
885
|
+
translateY: number;
|
|
886
|
+
opacity: number;
|
|
887
|
+
};
|
|
888
|
+
isRTL: boolean;
|
|
889
|
+
visibleCharacters: number;
|
|
890
|
+
letterSpacing?: number;
|
|
891
|
+
stroke?: {
|
|
892
|
+
width: number;
|
|
893
|
+
color: string;
|
|
894
|
+
opacity: number;
|
|
895
|
+
};
|
|
896
|
+
shadow?: {
|
|
897
|
+
offsetX: number;
|
|
898
|
+
offsetY: number;
|
|
899
|
+
blur: number;
|
|
900
|
+
color: string;
|
|
901
|
+
opacity: number;
|
|
902
|
+
};
|
|
903
|
+
background?: {
|
|
904
|
+
color: string;
|
|
905
|
+
opacity: number;
|
|
906
|
+
borderRadius: number;
|
|
907
|
+
padding: number;
|
|
908
|
+
};
|
|
909
|
+
} | {
|
|
910
|
+
op: "DrawCaptionBackground";
|
|
911
|
+
x: number;
|
|
912
|
+
y: number;
|
|
913
|
+
width: number;
|
|
914
|
+
height: number;
|
|
915
|
+
color: string;
|
|
916
|
+
opacity: number;
|
|
917
|
+
borderRadius: number;
|
|
433
918
|
};
|
|
434
919
|
type EngineInit = {
|
|
435
920
|
width: number;
|
|
@@ -441,17 +926,7 @@ type Renderer = {
|
|
|
441
926
|
render(ops: DrawOp[]): Promise<void>;
|
|
442
927
|
toPNG?: () => Promise<Buffer>;
|
|
443
928
|
};
|
|
444
|
-
type ValidAsset = CanvasRichTextAsset | CanvasSvgAsset;
|
|
445
|
-
declare const isShadowFill: (op: DrawOp) => op is Extract<DrawOp, {
|
|
446
|
-
op: "FillPath";
|
|
447
|
-
}> & {
|
|
448
|
-
isShadow: true;
|
|
449
|
-
};
|
|
450
|
-
declare const isGlyphFill: (op: DrawOp) => op is Extract<DrawOp, {
|
|
451
|
-
op: "FillPath";
|
|
452
|
-
}> & {
|
|
453
|
-
isShadow?: false;
|
|
454
|
-
};
|
|
929
|
+
type ValidAsset = CanvasRichTextAsset | CanvasSvgAsset | CanvasRichCaptionAsset;
|
|
455
930
|
|
|
456
931
|
interface VideoGenerationOptions {
|
|
457
932
|
width: number;
|
|
@@ -468,6 +943,7 @@ interface VideoGenerationOptions {
|
|
|
468
943
|
level?: string;
|
|
469
944
|
pixFmt?: string;
|
|
470
945
|
ffmpegPath?: string;
|
|
946
|
+
bgColor?: string;
|
|
471
947
|
}
|
|
472
948
|
|
|
473
949
|
declare function createNodePainter(opts: {
|
|
@@ -477,6 +953,15 @@ declare function createNodePainter(opts: {
|
|
|
477
953
|
}): Promise<{
|
|
478
954
|
render(ops: DrawOp[]): Promise<void>;
|
|
479
955
|
toPNG(): Promise<Buffer>;
|
|
956
|
+
toRawRGBA(): {
|
|
957
|
+
data: Uint8ClampedArray;
|
|
958
|
+
width: number;
|
|
959
|
+
height: number;
|
|
960
|
+
};
|
|
961
|
+
getCanvasSize(): {
|
|
962
|
+
width: number;
|
|
963
|
+
height: number;
|
|
964
|
+
};
|
|
480
965
|
}>;
|
|
481
966
|
|
|
482
967
|
type PathCommandType = "M" | "m" | "L" | "l" | "H" | "h" | "V" | "v" | "C" | "c" | "S" | "s" | "Q" | "q" | "T" | "t" | "A" | "a" | "Z" | "z";
|
|
@@ -560,6 +1045,221 @@ declare function renderSvgAssetToPng(asset: CanvasSvgAsset, options?: {
|
|
|
560
1045
|
background?: string;
|
|
561
1046
|
}): Promise<ResvgRenderResult>;
|
|
562
1047
|
|
|
1048
|
+
interface RichCaptionGeneratorConfig {
|
|
1049
|
+
frameWidth: number;
|
|
1050
|
+
frameHeight: number;
|
|
1051
|
+
pixelRatio: number;
|
|
1052
|
+
}
|
|
1053
|
+
interface FontConfig {
|
|
1054
|
+
family: string;
|
|
1055
|
+
size: number;
|
|
1056
|
+
weight: string;
|
|
1057
|
+
baseColor: string;
|
|
1058
|
+
activeColor: string;
|
|
1059
|
+
baseOpacity: number;
|
|
1060
|
+
activeOpacity: number;
|
|
1061
|
+
letterSpacing: number;
|
|
1062
|
+
}
|
|
1063
|
+
interface StrokeConfig {
|
|
1064
|
+
width: number;
|
|
1065
|
+
color: string;
|
|
1066
|
+
opacity: number;
|
|
1067
|
+
}
|
|
1068
|
+
interface ShadowConfig {
|
|
1069
|
+
offsetX: number;
|
|
1070
|
+
offsetY: number;
|
|
1071
|
+
blur: number;
|
|
1072
|
+
color: string;
|
|
1073
|
+
opacity: number;
|
|
1074
|
+
}
|
|
1075
|
+
interface BackgroundConfig {
|
|
1076
|
+
color: string;
|
|
1077
|
+
opacity: number;
|
|
1078
|
+
borderRadius: number;
|
|
1079
|
+
padding: number;
|
|
1080
|
+
}
|
|
1081
|
+
declare function generateRichCaptionDrawOps(asset: CanvasRichCaptionAsset, layout: CaptionLayout, frameTimeMs: number, layoutEngine: CaptionLayoutEngine, _config: RichCaptionGeneratorConfig): DrawOp[];
|
|
1082
|
+
declare function generateRichCaptionFrame(asset: CanvasRichCaptionAsset, layout: CaptionLayout, frameTimeMs: number, layoutEngine: CaptionLayoutEngine, config: RichCaptionGeneratorConfig): {
|
|
1083
|
+
ops: DrawOp[];
|
|
1084
|
+
visibleWordCount: number;
|
|
1085
|
+
activeWordIndex: number;
|
|
1086
|
+
};
|
|
1087
|
+
declare function createDefaultGeneratorConfig(frameWidth?: number, frameHeight?: number, pixelRatio?: number): RichCaptionGeneratorConfig;
|
|
1088
|
+
declare function isDrawCaptionWordOp(op: DrawOp): op is Extract<DrawOp, {
|
|
1089
|
+
op: "DrawCaptionWord";
|
|
1090
|
+
}>;
|
|
1091
|
+
declare function getDrawCaptionWordOps(ops: DrawOp[]): Extract<DrawOp, {
|
|
1092
|
+
op: "DrawCaptionWord";
|
|
1093
|
+
}>[];
|
|
1094
|
+
|
|
1095
|
+
interface RenderFrame {
|
|
1096
|
+
frameIndex: number;
|
|
1097
|
+
repeatCount: number;
|
|
1098
|
+
timeMs: number;
|
|
1099
|
+
}
|
|
1100
|
+
interface FrameSchedule {
|
|
1101
|
+
renderFrames: RenderFrame[];
|
|
1102
|
+
totalFrames: number;
|
|
1103
|
+
uniqueFrameCount: number;
|
|
1104
|
+
skipRatio: number;
|
|
1105
|
+
}
|
|
1106
|
+
declare function createFrameSchedule(layout: CaptionLayout, durationMs: number, fps: number, animationStyle?: AnimationStyle, speed?: number): FrameSchedule;
|
|
1107
|
+
|
|
1108
|
+
interface RichCaptionRendererOptions {
|
|
1109
|
+
width: number;
|
|
1110
|
+
height: number;
|
|
1111
|
+
pixelRatio?: number;
|
|
1112
|
+
fps?: number;
|
|
1113
|
+
wasmBaseURL?: string;
|
|
1114
|
+
fetchFile?: (pathOrUrl: string) => Promise<ArrayBuffer>;
|
|
1115
|
+
}
|
|
1116
|
+
interface RenderStats {
|
|
1117
|
+
frameCount: number;
|
|
1118
|
+
totalRenderTimeMs: number;
|
|
1119
|
+
averageFrameTimeMs: number;
|
|
1120
|
+
peakMemoryMB: number;
|
|
1121
|
+
cacheHitRate: number;
|
|
1122
|
+
}
|
|
1123
|
+
interface FastVideoOptions {
|
|
1124
|
+
outputPath: string;
|
|
1125
|
+
bgColor?: string;
|
|
1126
|
+
crf?: number;
|
|
1127
|
+
preset?: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow";
|
|
1128
|
+
profile?: "baseline" | "main" | "high";
|
|
1129
|
+
ffmpegPath?: string;
|
|
1130
|
+
}
|
|
1131
|
+
interface FastVideoResult {
|
|
1132
|
+
outputPath: string;
|
|
1133
|
+
totalFrames: number;
|
|
1134
|
+
uniqueFramesRendered: number;
|
|
1135
|
+
skipRatio: number;
|
|
1136
|
+
totalTimeMs: number;
|
|
1137
|
+
renderTimeMs: number;
|
|
1138
|
+
encodeTimeMs: number;
|
|
1139
|
+
realtimeMultiplier: number;
|
|
1140
|
+
}
|
|
1141
|
+
declare class RichCaptionRenderer {
|
|
1142
|
+
private width;
|
|
1143
|
+
private height;
|
|
1144
|
+
private pixelRatio;
|
|
1145
|
+
private fps;
|
|
1146
|
+
private wasmBaseURL?;
|
|
1147
|
+
private fetchFile;
|
|
1148
|
+
private fontRegistry;
|
|
1149
|
+
private layoutEngine;
|
|
1150
|
+
private currentAsset;
|
|
1151
|
+
private currentLayout;
|
|
1152
|
+
private generatorConfig;
|
|
1153
|
+
private frameCount;
|
|
1154
|
+
private totalRenderTimeMs;
|
|
1155
|
+
private peakMemoryMB;
|
|
1156
|
+
private lastMemoryCheckFrame;
|
|
1157
|
+
constructor(options: RichCaptionRendererOptions);
|
|
1158
|
+
initialize(): Promise<void>;
|
|
1159
|
+
registerFont(source: string, desc: {
|
|
1160
|
+
family: string;
|
|
1161
|
+
weight?: string | number;
|
|
1162
|
+
}): Promise<void>;
|
|
1163
|
+
loadAsset(asset: CanvasRichCaptionAsset): Promise<void>;
|
|
1164
|
+
renderFrame(timeMs: number): DrawOp[];
|
|
1165
|
+
generateVideo(outputPath: string, duration: number, options?: Partial<VideoGenerationOptions>): Promise<string>;
|
|
1166
|
+
generateVideoLegacy(outputPath: string, duration: number, options?: Partial<VideoGenerationOptions>): Promise<string>;
|
|
1167
|
+
generateVideoWithChunking(outputPath: string, duration: number, options?: Partial<VideoGenerationOptions>): Promise<string>;
|
|
1168
|
+
getFrameSchedule(duration: number): FrameSchedule;
|
|
1169
|
+
getStats(): RenderStats;
|
|
1170
|
+
resetStats(): void;
|
|
1171
|
+
clearCache(): void;
|
|
1172
|
+
private extractAnimationStyle;
|
|
1173
|
+
private extractAnimationSpeed;
|
|
1174
|
+
private logProgress;
|
|
1175
|
+
private logCompletion;
|
|
1176
|
+
private checkMemoryUsage;
|
|
1177
|
+
destroy(): void;
|
|
1178
|
+
}
|
|
1179
|
+
declare function createRichCaptionRenderer(options: RichCaptionRendererOptions): Promise<RichCaptionRenderer>;
|
|
1180
|
+
|
|
1181
|
+
declare function detectSubtitleFormat(content: string): "vtt" | "srt";
|
|
1182
|
+
declare function parseSubtitleToWords(content: string): WordTiming[];
|
|
1183
|
+
|
|
1184
|
+
interface VideoEncoderConfig {
|
|
1185
|
+
width: number;
|
|
1186
|
+
height: number;
|
|
1187
|
+
fps: number;
|
|
1188
|
+
duration: number;
|
|
1189
|
+
bitrate?: number;
|
|
1190
|
+
codec?: "avc" | "hevc";
|
|
1191
|
+
profile?: "baseline" | "main" | "high";
|
|
1192
|
+
hardwareAcceleration?: "prefer-hardware" | "prefer-software" | "no-preference";
|
|
1193
|
+
crf?: number;
|
|
1194
|
+
preset?: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow";
|
|
1195
|
+
}
|
|
1196
|
+
interface VideoEncoderProgress {
|
|
1197
|
+
framesEncoded: number;
|
|
1198
|
+
totalFrames: number;
|
|
1199
|
+
percentage: number;
|
|
1200
|
+
elapsedMs: number;
|
|
1201
|
+
estimatedRemainingMs: number;
|
|
1202
|
+
currentFps: number;
|
|
1203
|
+
}
|
|
1204
|
+
interface IVideoEncoder {
|
|
1205
|
+
configure(config: VideoEncoderConfig): Promise<void>;
|
|
1206
|
+
encodeFrame(frameData: Uint8ClampedArray | ArrayBuffer, frameIndex: number): Promise<void>;
|
|
1207
|
+
flush(): Promise<Uint8Array | Blob>;
|
|
1208
|
+
close(): void;
|
|
1209
|
+
onProgress?: (progress: VideoEncoderProgress) => void;
|
|
1210
|
+
}
|
|
1211
|
+
interface VideoEncoderCapabilities {
|
|
1212
|
+
encoder: string;
|
|
1213
|
+
codec: string;
|
|
1214
|
+
hardwareAccelerated: boolean;
|
|
1215
|
+
supportsH264: boolean;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
type EncoderType = "webcodecs" | "mediarecorder" | "node-raw";
|
|
1219
|
+
declare function createVideoEncoder(config: VideoEncoderConfig, options?: {
|
|
1220
|
+
platform?: "node" | "web";
|
|
1221
|
+
outputPath?: string;
|
|
1222
|
+
ffmpegPath?: string;
|
|
1223
|
+
canvas?: HTMLCanvasElement | OffscreenCanvas;
|
|
1224
|
+
preferredEncoder?: EncoderType;
|
|
1225
|
+
}): Promise<IVideoEncoder>;
|
|
1226
|
+
declare function isWebCodecsH264Supported(): Promise<boolean>;
|
|
1227
|
+
declare function getEncoderCapabilities(): Promise<VideoEncoderCapabilities>;
|
|
1228
|
+
declare function detectPlatform(): "node" | "web";
|
|
1229
|
+
declare function getEncoderWarning(): string | null;
|
|
1230
|
+
|
|
1231
|
+
declare class NodeRawEncoder implements IVideoEncoder {
|
|
1232
|
+
private ffmpegPath;
|
|
1233
|
+
private ffmpegProcess;
|
|
1234
|
+
private config;
|
|
1235
|
+
private outputPath;
|
|
1236
|
+
private frameCount;
|
|
1237
|
+
private totalFrames;
|
|
1238
|
+
private startTime;
|
|
1239
|
+
private chunks;
|
|
1240
|
+
private outputToMemory;
|
|
1241
|
+
private ffmpegError;
|
|
1242
|
+
private static readonly DRAIN_TIMEOUT_MS;
|
|
1243
|
+
onProgress?: (progress: VideoEncoderProgress) => void;
|
|
1244
|
+
private trySetPath;
|
|
1245
|
+
private initFFmpeg;
|
|
1246
|
+
configure(config: VideoEncoderConfig, options?: {
|
|
1247
|
+
outputPath?: string;
|
|
1248
|
+
ffmpegPath?: string;
|
|
1249
|
+
}): Promise<void>;
|
|
1250
|
+
encodeFrame(frameData: Uint8ClampedArray | ArrayBuffer, _frameIndex: number): Promise<void>;
|
|
1251
|
+
encodeFrameRepeat(frameData: Uint8ClampedArray | ArrayBuffer, repeatCount: number): Promise<void>;
|
|
1252
|
+
flush(): Promise<Uint8Array>;
|
|
1253
|
+
close(): void;
|
|
1254
|
+
private waitForDrain;
|
|
1255
|
+
private toBuffer;
|
|
1256
|
+
private reportProgress;
|
|
1257
|
+
}
|
|
1258
|
+
declare function createNodeRawEncoder(config: VideoEncoderConfig, options?: {
|
|
1259
|
+
outputPath?: string;
|
|
1260
|
+
ffmpegPath?: string;
|
|
1261
|
+
}): Promise<NodeRawEncoder>;
|
|
1262
|
+
|
|
563
1263
|
declare function createTextEngine(opts?: {
|
|
564
1264
|
width?: number;
|
|
565
1265
|
height?: number;
|
|
@@ -586,9 +1286,18 @@ declare function createTextEngine(opts?: {
|
|
|
586
1286
|
}): Promise<{
|
|
587
1287
|
render(ops: DrawOp[]): Promise<void>;
|
|
588
1288
|
toPNG(): Promise<Buffer>;
|
|
1289
|
+
toRawRGBA(): {
|
|
1290
|
+
data: Uint8ClampedArray;
|
|
1291
|
+
width: number;
|
|
1292
|
+
height: number;
|
|
1293
|
+
};
|
|
1294
|
+
getCanvasSize(): {
|
|
1295
|
+
width: number;
|
|
1296
|
+
height: number;
|
|
1297
|
+
};
|
|
589
1298
|
}>;
|
|
590
1299
|
generateVideo(asset: CanvasRichTextAsset, options: Partial<VideoGenerationOptions>): Promise<string>;
|
|
591
1300
|
destroy(): void;
|
|
592
1301
|
}>;
|
|
593
1302
|
|
|
594
|
-
export { type ArcCommand, type BoundingBox, type CanvasRichTextAsset, CanvasRichTextAssetSchema, type CanvasSvgAsset, CanvasSvgAssetSchema, type ClosePathCommand, type CubicBezierCommand, type DrawOp, type EngineInit, type Glyph, type GradientSpec, type LineToCommand, type MoveToCommand, type NormalizedPathCommand, type ParsedPathCommand, type PathCommandType, type Point2D, type QuadraticBezierCommand, type RGBA, type Renderer, type ResvgRenderOptions, type ResvgRenderResult, type ShapedLine, type ShotstackRichTextAsset, type ShotstackSvgAsset, type StrokeSpec, type ValidAsset, arcToCubicBeziers, commandsToPathString, computeSimplePathBounds, createNodePainter, createTextEngine, generateShapePathData,
|
|
1303
|
+
export { type AnimationDirection, type AnimationStyle, type ArcCommand, type BackgroundConfig, type BoundingBox, type CanvasRichCaptionAsset, CanvasRichCaptionAssetSchema, type CanvasRichTextAsset, CanvasRichTextAssetSchema, type CanvasSvgAsset, CanvasSvgAssetSchema, type CaptionGroup, type CaptionLayout, type CaptionLayoutConfig, CaptionLayoutEngine, type CaptionLine, type ClosePathCommand, type CubicBezierCommand, type DrawOp, type EngineInit, type FastVideoOptions, type FastVideoResult, type FontConfig, FontRegistry, type FrameSchedule, type Glyph, type GradientSpec, type IVideoEncoder, type LineToCommand, type MoveToCommand, NodeRawEncoder, type NormalizedPathCommand, type ParsedPathCommand, type PathCommandType, type Point2D, type PositionedWord, type QuadraticBezierCommand, type RGBA, type RenderFrame, type RenderStats, type Renderer, type ResvgRenderOptions, type ResvgRenderResult, type RichCaptionGeneratorConfig, RichCaptionRenderer, type RichCaptionRendererOptions, type ShadowConfig, type ShapedLine, type ShapedWord, type ShapedWordGlyph, type ShotstackRichTextAsset, type ShotstackSvgAsset, type StrokeConfig, type StrokeSpec, type ValidAsset, type VideoEncoderCapabilities, type VideoEncoderConfig, type VideoEncoderProgress, type WordAnimationConfig, type WordAnimationState, type WordTiming, WordTimingStore, arcToCubicBeziers, calculateAnimationStatesForGroup, commandsToPathString, computeSimplePathBounds, createDefaultGeneratorConfig, createFrameSchedule, createNodePainter, createNodeRawEncoder, createRichCaptionRenderer, createTextEngine, createVideoEncoder, detectPlatform, detectSubtitleFormat, findWordAtTime, generateRichCaptionDrawOps, generateRichCaptionFrame, generateShapePathData, getDefaultAnimationConfig, getDrawCaptionWordOps, getEncoderCapabilities, getEncoderWarning, groupWordsByPause, isDrawCaptionWordOp, isRTLText, isWebCodecsH264Supported, normalizePath, normalizePathString, parseSubtitleToWords, parseSvgPath, quadraticToCubic, renderSvgAssetToPng, renderSvgToPng, richCaptionAssetSchema, shapeToSvgString };
|