@shotstack/shotstack-canvas 1.9.6 → 2.0.0
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 +2575 -15
- package/dist/entry.node.d.cts +746 -39
- package/dist/entry.node.d.ts +746 -39
- package/dist/entry.node.js +2229 -14
- package/dist/entry.web.d.ts +718 -39
- package/dist/entry.web.js +37331 -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,445 @@ 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 wasmBaseURL?;
|
|
548
|
+
private initPromise?;
|
|
549
|
+
private emojiFallbackDesc?;
|
|
550
|
+
private static sharedInstance;
|
|
551
|
+
private static refCount;
|
|
552
|
+
private static sharedInitPromise;
|
|
553
|
+
private static fallbackLoader?;
|
|
554
|
+
static setFallbackLoader(loader: (desc: FontDescriptor) => Promise<ArrayBuffer | undefined>): void;
|
|
555
|
+
static getSharedInstance(wasmBaseURL?: string): Promise<FontRegistry>;
|
|
556
|
+
static getRefCount(): number;
|
|
557
|
+
static hasSharedInstance(): boolean;
|
|
558
|
+
release(): void;
|
|
559
|
+
static resetSharedInstance(): void;
|
|
560
|
+
setEmojiFallback(desc: FontDescriptor): void;
|
|
561
|
+
isColorEmojiFont(family: string): boolean;
|
|
562
|
+
getColorEmojiFontBytes(family: string): ArrayBuffer | undefined;
|
|
563
|
+
getColorEmojiFontFamilies(): string[];
|
|
564
|
+
private detectColorEmojiFont;
|
|
565
|
+
constructor(wasmBaseURL?: string);
|
|
566
|
+
init(): Promise<void>;
|
|
567
|
+
private _doInit;
|
|
568
|
+
getHB(): Promise<HB>;
|
|
569
|
+
private key;
|
|
570
|
+
hasRegisteredFace(desc: FontDescriptor): boolean;
|
|
571
|
+
registerFromBytes(bytes: ArrayBuffer, desc: FontDescriptor): Promise<void>;
|
|
572
|
+
private tryFallbackInstall;
|
|
573
|
+
getFont(desc: FontDescriptor): Promise<HBFont>;
|
|
574
|
+
private tryDeriveFromExistingFont;
|
|
575
|
+
getFace(desc: FontDescriptor): Promise<HBFace | undefined>;
|
|
576
|
+
getUnitsPerEm(desc: FontDescriptor): Promise<number>;
|
|
577
|
+
glyphPath(desc: FontDescriptor, glyphId: number): Promise<string>;
|
|
578
|
+
destroy(): void;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
interface WordTiming {
|
|
582
|
+
text: string;
|
|
583
|
+
start: number;
|
|
584
|
+
end: number;
|
|
585
|
+
confidence?: number;
|
|
586
|
+
}
|
|
587
|
+
interface CaptionLayoutConfig {
|
|
588
|
+
frameWidth: number;
|
|
589
|
+
frameHeight: number;
|
|
590
|
+
maxWidth: number;
|
|
591
|
+
maxLines: number;
|
|
592
|
+
position: "top" | "center" | "bottom";
|
|
593
|
+
fontSize: number;
|
|
594
|
+
fontFamily: string;
|
|
595
|
+
fontWeight: string | number;
|
|
596
|
+
letterSpacing: number;
|
|
597
|
+
wordSpacing: number;
|
|
598
|
+
lineHeight: number;
|
|
599
|
+
textTransform: "none" | "uppercase" | "lowercase" | "capitalize";
|
|
600
|
+
pauseThreshold: number;
|
|
601
|
+
measureTextWidth?: (text: string, font: string) => number;
|
|
602
|
+
}
|
|
603
|
+
interface ShapedWordGlyph {
|
|
604
|
+
id: number;
|
|
605
|
+
xAdvance: number;
|
|
606
|
+
xOffset: number;
|
|
607
|
+
yOffset: number;
|
|
608
|
+
cluster: number;
|
|
609
|
+
}
|
|
610
|
+
interface ShapedWord {
|
|
611
|
+
text: string;
|
|
612
|
+
width: number;
|
|
613
|
+
glyphs: ShapedWordGlyph[];
|
|
614
|
+
isRTL: boolean;
|
|
615
|
+
}
|
|
616
|
+
interface CaptionLine {
|
|
617
|
+
wordIndices: number[];
|
|
618
|
+
x: number;
|
|
619
|
+
y: number;
|
|
620
|
+
width: number;
|
|
621
|
+
height: number;
|
|
622
|
+
}
|
|
623
|
+
interface CaptionGroup {
|
|
624
|
+
wordIndices: number[];
|
|
625
|
+
startTime: number;
|
|
626
|
+
endTime: number;
|
|
627
|
+
lines: CaptionLine[];
|
|
628
|
+
}
|
|
629
|
+
interface PositionedWord {
|
|
630
|
+
wordIndex: number;
|
|
631
|
+
text: string;
|
|
632
|
+
x: number;
|
|
633
|
+
y: number;
|
|
634
|
+
width: number;
|
|
635
|
+
startTime: number;
|
|
636
|
+
endTime: number;
|
|
637
|
+
isRTL: boolean;
|
|
638
|
+
}
|
|
639
|
+
interface CaptionLayout {
|
|
640
|
+
store: WordTimingStore;
|
|
641
|
+
groups: CaptionGroup[];
|
|
642
|
+
shapedWords: ShapedWord[];
|
|
643
|
+
}
|
|
644
|
+
declare function isRTLText(text: string): boolean;
|
|
645
|
+
declare class WordTimingStore {
|
|
646
|
+
startTimes: Uint32Array;
|
|
647
|
+
endTimes: Uint32Array;
|
|
648
|
+
xPositions: Float32Array;
|
|
649
|
+
yPositions: Float32Array;
|
|
650
|
+
widths: Float32Array;
|
|
651
|
+
words: string[];
|
|
652
|
+
length: number;
|
|
653
|
+
constructor(words: WordTiming[]);
|
|
654
|
+
}
|
|
655
|
+
declare function findWordAtTime(store: WordTimingStore, timeMs: number): number;
|
|
656
|
+
declare function groupWordsByPause(store: WordTimingStore, pauseThreshold?: number): number[][];
|
|
657
|
+
declare class CaptionLayoutEngine {
|
|
658
|
+
private fontRegistry;
|
|
659
|
+
private cache;
|
|
660
|
+
private layoutEngine;
|
|
661
|
+
constructor(fontRegistry: FontRegistry);
|
|
662
|
+
private measureWord;
|
|
663
|
+
layoutCaption(words: WordTiming[], config: CaptionLayoutConfig): Promise<CaptionLayout>;
|
|
664
|
+
getVisibleWordsAtTime(layout: CaptionLayout, timeMs: number): PositionedWord[];
|
|
665
|
+
getActiveWordAtTime(layout: CaptionLayout, timeMs: number): PositionedWord | null;
|
|
666
|
+
clearCache(): void;
|
|
667
|
+
getCacheStats(): {
|
|
668
|
+
size: number;
|
|
669
|
+
calculatedSize: number;
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
type AnimationStyle = "karaoke" | "highlight" | "pop" | "fade" | "slide" | "bounce" | "typewriter" | "none";
|
|
674
|
+
type AnimationDirection = "left" | "right" | "up" | "down";
|
|
675
|
+
interface WordAnimationConfig {
|
|
676
|
+
style: AnimationStyle;
|
|
677
|
+
speed: number;
|
|
678
|
+
direction: AnimationDirection;
|
|
679
|
+
}
|
|
680
|
+
interface WordAnimationState {
|
|
681
|
+
opacity: number;
|
|
682
|
+
scale: number;
|
|
683
|
+
translateX: number;
|
|
684
|
+
translateY: number;
|
|
685
|
+
fillProgress: number;
|
|
686
|
+
isActive: boolean;
|
|
687
|
+
visibleCharacters: number;
|
|
688
|
+
}
|
|
689
|
+
declare function calculateAnimationStatesForGroup(words: PositionedWord[], currentTime: number, config: WordAnimationConfig, activeScale?: number, fontSize?: number): Map<number, WordAnimationState>;
|
|
690
|
+
declare function getDefaultAnimationConfig(): WordAnimationConfig;
|
|
691
|
+
|
|
259
692
|
type ShotstackRichTextAsset = components["schemas"]["RichTextAsset"];
|
|
260
693
|
type ShotstackSvgAsset = components["schemas"]["SvgAsset"];
|
|
261
694
|
type RGBA = {
|
|
@@ -430,6 +863,56 @@ type DrawOp = {
|
|
|
430
863
|
x: number;
|
|
431
864
|
y: number;
|
|
432
865
|
stroke: StrokeSpec;
|
|
866
|
+
} | {
|
|
867
|
+
op: "DrawCaptionWord";
|
|
868
|
+
text: string;
|
|
869
|
+
x: number;
|
|
870
|
+
y: number;
|
|
871
|
+
width: number;
|
|
872
|
+
fontSize: number;
|
|
873
|
+
fontFamily: string;
|
|
874
|
+
fontWeight: string;
|
|
875
|
+
baseColor: string;
|
|
876
|
+
activeColor: string;
|
|
877
|
+
baseOpacity: number;
|
|
878
|
+
activeOpacity: number;
|
|
879
|
+
fillProgress: number;
|
|
880
|
+
transform: {
|
|
881
|
+
scale: number;
|
|
882
|
+
translateX: number;
|
|
883
|
+
translateY: number;
|
|
884
|
+
opacity: number;
|
|
885
|
+
};
|
|
886
|
+
isRTL: boolean;
|
|
887
|
+
visibleCharacters: number;
|
|
888
|
+
letterSpacing?: number;
|
|
889
|
+
stroke?: {
|
|
890
|
+
width: number;
|
|
891
|
+
color: string;
|
|
892
|
+
opacity: number;
|
|
893
|
+
};
|
|
894
|
+
shadow?: {
|
|
895
|
+
offsetX: number;
|
|
896
|
+
offsetY: number;
|
|
897
|
+
blur: number;
|
|
898
|
+
color: string;
|
|
899
|
+
opacity: number;
|
|
900
|
+
};
|
|
901
|
+
background?: {
|
|
902
|
+
color: string;
|
|
903
|
+
opacity: number;
|
|
904
|
+
borderRadius: number;
|
|
905
|
+
padding: number;
|
|
906
|
+
};
|
|
907
|
+
} | {
|
|
908
|
+
op: "DrawCaptionBackground";
|
|
909
|
+
x: number;
|
|
910
|
+
y: number;
|
|
911
|
+
width: number;
|
|
912
|
+
height: number;
|
|
913
|
+
color: string;
|
|
914
|
+
opacity: number;
|
|
915
|
+
borderRadius: number;
|
|
433
916
|
};
|
|
434
917
|
type EngineInit = {
|
|
435
918
|
width: number;
|
|
@@ -441,17 +924,7 @@ type Renderer = {
|
|
|
441
924
|
render(ops: DrawOp[]): Promise<void>;
|
|
442
925
|
toPNG?: () => Promise<Buffer>;
|
|
443
926
|
};
|
|
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
|
-
};
|
|
927
|
+
type ValidAsset = CanvasRichTextAsset | CanvasSvgAsset | CanvasRichCaptionAsset;
|
|
455
928
|
|
|
456
929
|
interface VideoGenerationOptions {
|
|
457
930
|
width: number;
|
|
@@ -468,6 +941,7 @@ interface VideoGenerationOptions {
|
|
|
468
941
|
level?: string;
|
|
469
942
|
pixFmt?: string;
|
|
470
943
|
ffmpegPath?: string;
|
|
944
|
+
bgColor?: string;
|
|
471
945
|
}
|
|
472
946
|
|
|
473
947
|
declare function createNodePainter(opts: {
|
|
@@ -477,6 +951,15 @@ declare function createNodePainter(opts: {
|
|
|
477
951
|
}): Promise<{
|
|
478
952
|
render(ops: DrawOp[]): Promise<void>;
|
|
479
953
|
toPNG(): Promise<Buffer>;
|
|
954
|
+
toRawRGBA(): {
|
|
955
|
+
data: Uint8ClampedArray;
|
|
956
|
+
width: number;
|
|
957
|
+
height: number;
|
|
958
|
+
};
|
|
959
|
+
getCanvasSize(): {
|
|
960
|
+
width: number;
|
|
961
|
+
height: number;
|
|
962
|
+
};
|
|
480
963
|
}>;
|
|
481
964
|
|
|
482
965
|
type PathCommandType = "M" | "m" | "L" | "l" | "H" | "h" | "V" | "v" | "C" | "c" | "S" | "s" | "Q" | "q" | "T" | "t" | "A" | "a" | "Z" | "z";
|
|
@@ -560,6 +1043,221 @@ declare function renderSvgAssetToPng(asset: CanvasSvgAsset, options?: {
|
|
|
560
1043
|
background?: string;
|
|
561
1044
|
}): Promise<ResvgRenderResult>;
|
|
562
1045
|
|
|
1046
|
+
interface RichCaptionGeneratorConfig {
|
|
1047
|
+
frameWidth: number;
|
|
1048
|
+
frameHeight: number;
|
|
1049
|
+
pixelRatio: number;
|
|
1050
|
+
}
|
|
1051
|
+
interface FontConfig {
|
|
1052
|
+
family: string;
|
|
1053
|
+
size: number;
|
|
1054
|
+
weight: string;
|
|
1055
|
+
baseColor: string;
|
|
1056
|
+
activeColor: string;
|
|
1057
|
+
baseOpacity: number;
|
|
1058
|
+
activeOpacity: number;
|
|
1059
|
+
letterSpacing: number;
|
|
1060
|
+
}
|
|
1061
|
+
interface StrokeConfig {
|
|
1062
|
+
width: number;
|
|
1063
|
+
color: string;
|
|
1064
|
+
opacity: number;
|
|
1065
|
+
}
|
|
1066
|
+
interface ShadowConfig {
|
|
1067
|
+
offsetX: number;
|
|
1068
|
+
offsetY: number;
|
|
1069
|
+
blur: number;
|
|
1070
|
+
color: string;
|
|
1071
|
+
opacity: number;
|
|
1072
|
+
}
|
|
1073
|
+
interface BackgroundConfig {
|
|
1074
|
+
color: string;
|
|
1075
|
+
opacity: number;
|
|
1076
|
+
borderRadius: number;
|
|
1077
|
+
padding: number;
|
|
1078
|
+
}
|
|
1079
|
+
declare function generateRichCaptionDrawOps(asset: CanvasRichCaptionAsset, layout: CaptionLayout, frameTimeMs: number, layoutEngine: CaptionLayoutEngine, _config: RichCaptionGeneratorConfig): DrawOp[];
|
|
1080
|
+
declare function generateRichCaptionFrame(asset: CanvasRichCaptionAsset, layout: CaptionLayout, frameTimeMs: number, layoutEngine: CaptionLayoutEngine, config: RichCaptionGeneratorConfig): {
|
|
1081
|
+
ops: DrawOp[];
|
|
1082
|
+
visibleWordCount: number;
|
|
1083
|
+
activeWordIndex: number;
|
|
1084
|
+
};
|
|
1085
|
+
declare function createDefaultGeneratorConfig(frameWidth?: number, frameHeight?: number, pixelRatio?: number): RichCaptionGeneratorConfig;
|
|
1086
|
+
declare function isDrawCaptionWordOp(op: DrawOp): op is Extract<DrawOp, {
|
|
1087
|
+
op: "DrawCaptionWord";
|
|
1088
|
+
}>;
|
|
1089
|
+
declare function getDrawCaptionWordOps(ops: DrawOp[]): Extract<DrawOp, {
|
|
1090
|
+
op: "DrawCaptionWord";
|
|
1091
|
+
}>[];
|
|
1092
|
+
|
|
1093
|
+
interface RenderFrame {
|
|
1094
|
+
frameIndex: number;
|
|
1095
|
+
repeatCount: number;
|
|
1096
|
+
timeMs: number;
|
|
1097
|
+
}
|
|
1098
|
+
interface FrameSchedule {
|
|
1099
|
+
renderFrames: RenderFrame[];
|
|
1100
|
+
totalFrames: number;
|
|
1101
|
+
uniqueFrameCount: number;
|
|
1102
|
+
skipRatio: number;
|
|
1103
|
+
}
|
|
1104
|
+
declare function createFrameSchedule(layout: CaptionLayout, durationMs: number, fps: number, animationStyle?: AnimationStyle, speed?: number): FrameSchedule;
|
|
1105
|
+
|
|
1106
|
+
interface RichCaptionRendererOptions {
|
|
1107
|
+
width: number;
|
|
1108
|
+
height: number;
|
|
1109
|
+
pixelRatio?: number;
|
|
1110
|
+
fps?: number;
|
|
1111
|
+
wasmBaseURL?: string;
|
|
1112
|
+
fetchFile?: (pathOrUrl: string) => Promise<ArrayBuffer>;
|
|
1113
|
+
}
|
|
1114
|
+
interface RenderStats {
|
|
1115
|
+
frameCount: number;
|
|
1116
|
+
totalRenderTimeMs: number;
|
|
1117
|
+
averageFrameTimeMs: number;
|
|
1118
|
+
peakMemoryMB: number;
|
|
1119
|
+
cacheHitRate: number;
|
|
1120
|
+
}
|
|
1121
|
+
interface FastVideoOptions {
|
|
1122
|
+
outputPath: string;
|
|
1123
|
+
bgColor?: string;
|
|
1124
|
+
crf?: number;
|
|
1125
|
+
preset?: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow";
|
|
1126
|
+
profile?: "baseline" | "main" | "high";
|
|
1127
|
+
ffmpegPath?: string;
|
|
1128
|
+
}
|
|
1129
|
+
interface FastVideoResult {
|
|
1130
|
+
outputPath: string;
|
|
1131
|
+
totalFrames: number;
|
|
1132
|
+
uniqueFramesRendered: number;
|
|
1133
|
+
skipRatio: number;
|
|
1134
|
+
totalTimeMs: number;
|
|
1135
|
+
renderTimeMs: number;
|
|
1136
|
+
encodeTimeMs: number;
|
|
1137
|
+
realtimeMultiplier: number;
|
|
1138
|
+
}
|
|
1139
|
+
declare class RichCaptionRenderer {
|
|
1140
|
+
private width;
|
|
1141
|
+
private height;
|
|
1142
|
+
private pixelRatio;
|
|
1143
|
+
private fps;
|
|
1144
|
+
private wasmBaseURL?;
|
|
1145
|
+
private fetchFile;
|
|
1146
|
+
private fontRegistry;
|
|
1147
|
+
private layoutEngine;
|
|
1148
|
+
private currentAsset;
|
|
1149
|
+
private currentLayout;
|
|
1150
|
+
private generatorConfig;
|
|
1151
|
+
private frameCount;
|
|
1152
|
+
private totalRenderTimeMs;
|
|
1153
|
+
private peakMemoryMB;
|
|
1154
|
+
private lastMemoryCheckFrame;
|
|
1155
|
+
constructor(options: RichCaptionRendererOptions);
|
|
1156
|
+
initialize(): Promise<void>;
|
|
1157
|
+
registerFont(source: string, desc: {
|
|
1158
|
+
family: string;
|
|
1159
|
+
weight?: string | number;
|
|
1160
|
+
}): Promise<void>;
|
|
1161
|
+
loadAsset(asset: CanvasRichCaptionAsset): Promise<void>;
|
|
1162
|
+
renderFrame(timeMs: number): DrawOp[];
|
|
1163
|
+
generateVideo(outputPath: string, duration: number, options?: Partial<VideoGenerationOptions>): Promise<string>;
|
|
1164
|
+
generateVideoLegacy(outputPath: string, duration: number, options?: Partial<VideoGenerationOptions>): Promise<string>;
|
|
1165
|
+
generateVideoWithChunking(outputPath: string, duration: number, options?: Partial<VideoGenerationOptions>): Promise<string>;
|
|
1166
|
+
getFrameSchedule(duration: number): FrameSchedule;
|
|
1167
|
+
getStats(): RenderStats;
|
|
1168
|
+
resetStats(): void;
|
|
1169
|
+
clearCache(): void;
|
|
1170
|
+
private extractAnimationStyle;
|
|
1171
|
+
private extractAnimationSpeed;
|
|
1172
|
+
private logProgress;
|
|
1173
|
+
private logCompletion;
|
|
1174
|
+
private checkMemoryUsage;
|
|
1175
|
+
destroy(): void;
|
|
1176
|
+
}
|
|
1177
|
+
declare function createRichCaptionRenderer(options: RichCaptionRendererOptions): Promise<RichCaptionRenderer>;
|
|
1178
|
+
|
|
1179
|
+
declare function detectSubtitleFormat(content: string): "vtt" | "srt";
|
|
1180
|
+
declare function parseSubtitleToWords(content: string): WordTiming[];
|
|
1181
|
+
|
|
1182
|
+
interface VideoEncoderConfig {
|
|
1183
|
+
width: number;
|
|
1184
|
+
height: number;
|
|
1185
|
+
fps: number;
|
|
1186
|
+
duration: number;
|
|
1187
|
+
bitrate?: number;
|
|
1188
|
+
codec?: "avc" | "hevc";
|
|
1189
|
+
profile?: "baseline" | "main" | "high";
|
|
1190
|
+
hardwareAcceleration?: "prefer-hardware" | "prefer-software" | "no-preference";
|
|
1191
|
+
crf?: number;
|
|
1192
|
+
preset?: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow";
|
|
1193
|
+
}
|
|
1194
|
+
interface VideoEncoderProgress {
|
|
1195
|
+
framesEncoded: number;
|
|
1196
|
+
totalFrames: number;
|
|
1197
|
+
percentage: number;
|
|
1198
|
+
elapsedMs: number;
|
|
1199
|
+
estimatedRemainingMs: number;
|
|
1200
|
+
currentFps: number;
|
|
1201
|
+
}
|
|
1202
|
+
interface IVideoEncoder {
|
|
1203
|
+
configure(config: VideoEncoderConfig): Promise<void>;
|
|
1204
|
+
encodeFrame(frameData: Uint8ClampedArray | ArrayBuffer, frameIndex: number): Promise<void>;
|
|
1205
|
+
flush(): Promise<Uint8Array | Blob>;
|
|
1206
|
+
close(): void;
|
|
1207
|
+
onProgress?: (progress: VideoEncoderProgress) => void;
|
|
1208
|
+
}
|
|
1209
|
+
interface VideoEncoderCapabilities {
|
|
1210
|
+
encoder: string;
|
|
1211
|
+
codec: string;
|
|
1212
|
+
hardwareAccelerated: boolean;
|
|
1213
|
+
supportsH264: boolean;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
type EncoderType = "webcodecs" | "mediarecorder" | "node-raw";
|
|
1217
|
+
declare function createVideoEncoder(config: VideoEncoderConfig, options?: {
|
|
1218
|
+
platform?: "node" | "web";
|
|
1219
|
+
outputPath?: string;
|
|
1220
|
+
ffmpegPath?: string;
|
|
1221
|
+
canvas?: HTMLCanvasElement | OffscreenCanvas;
|
|
1222
|
+
preferredEncoder?: EncoderType;
|
|
1223
|
+
}): Promise<IVideoEncoder>;
|
|
1224
|
+
declare function isWebCodecsH264Supported(): Promise<boolean>;
|
|
1225
|
+
declare function getEncoderCapabilities(): Promise<VideoEncoderCapabilities>;
|
|
1226
|
+
declare function detectPlatform(): "node" | "web";
|
|
1227
|
+
declare function getEncoderWarning(): string | null;
|
|
1228
|
+
|
|
1229
|
+
declare class NodeRawEncoder implements IVideoEncoder {
|
|
1230
|
+
private ffmpegPath;
|
|
1231
|
+
private ffmpegProcess;
|
|
1232
|
+
private config;
|
|
1233
|
+
private outputPath;
|
|
1234
|
+
private frameCount;
|
|
1235
|
+
private totalFrames;
|
|
1236
|
+
private startTime;
|
|
1237
|
+
private chunks;
|
|
1238
|
+
private outputToMemory;
|
|
1239
|
+
private ffmpegError;
|
|
1240
|
+
private static readonly DRAIN_TIMEOUT_MS;
|
|
1241
|
+
onProgress?: (progress: VideoEncoderProgress) => void;
|
|
1242
|
+
private trySetPath;
|
|
1243
|
+
private initFFmpeg;
|
|
1244
|
+
configure(config: VideoEncoderConfig, options?: {
|
|
1245
|
+
outputPath?: string;
|
|
1246
|
+
ffmpegPath?: string;
|
|
1247
|
+
}): Promise<void>;
|
|
1248
|
+
encodeFrame(frameData: Uint8ClampedArray | ArrayBuffer, _frameIndex: number): Promise<void>;
|
|
1249
|
+
encodeFrameRepeat(frameData: Uint8ClampedArray | ArrayBuffer, repeatCount: number): Promise<void>;
|
|
1250
|
+
flush(): Promise<Uint8Array>;
|
|
1251
|
+
close(): void;
|
|
1252
|
+
private waitForDrain;
|
|
1253
|
+
private toBuffer;
|
|
1254
|
+
private reportProgress;
|
|
1255
|
+
}
|
|
1256
|
+
declare function createNodeRawEncoder(config: VideoEncoderConfig, options?: {
|
|
1257
|
+
outputPath?: string;
|
|
1258
|
+
ffmpegPath?: string;
|
|
1259
|
+
}): Promise<NodeRawEncoder>;
|
|
1260
|
+
|
|
563
1261
|
declare function createTextEngine(opts?: {
|
|
564
1262
|
width?: number;
|
|
565
1263
|
height?: number;
|
|
@@ -586,9 +1284,18 @@ declare function createTextEngine(opts?: {
|
|
|
586
1284
|
}): Promise<{
|
|
587
1285
|
render(ops: DrawOp[]): Promise<void>;
|
|
588
1286
|
toPNG(): Promise<Buffer>;
|
|
1287
|
+
toRawRGBA(): {
|
|
1288
|
+
data: Uint8ClampedArray;
|
|
1289
|
+
width: number;
|
|
1290
|
+
height: number;
|
|
1291
|
+
};
|
|
1292
|
+
getCanvasSize(): {
|
|
1293
|
+
width: number;
|
|
1294
|
+
height: number;
|
|
1295
|
+
};
|
|
589
1296
|
}>;
|
|
590
1297
|
generateVideo(asset: CanvasRichTextAsset, options: Partial<VideoGenerationOptions>): Promise<string>;
|
|
591
1298
|
destroy(): void;
|
|
592
1299
|
}>;
|
|
593
1300
|
|
|
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,
|
|
1301
|
+
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 };
|