@shotstack/schemas 1.8.4 → 1.8.5

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.
Files changed (34) hide show
  1. package/dist/api.bundled.json +832 -6
  2. package/dist/json-schema/asset.json +853 -1
  3. package/dist/json-schema/clip.json +853 -1
  4. package/dist/json-schema/edit.json +854 -2
  5. package/dist/json-schema/schemas.json +950 -5
  6. package/dist/json-schema/svg-arrow-shape.json +49 -0
  7. package/dist/json-schema/svg-asset.json +857 -6
  8. package/dist/json-schema/svg-circle-shape.json +28 -0
  9. package/dist/json-schema/svg-cross-shape.json +42 -0
  10. package/dist/json-schema/svg-ellipse-shape.json +35 -0
  11. package/dist/json-schema/svg-fill.json +169 -0
  12. package/dist/json-schema/svg-gradient-stop.json +25 -0
  13. package/dist/json-schema/svg-heart-shape.json +28 -0
  14. package/dist/json-schema/svg-line-shape.json +35 -0
  15. package/dist/json-schema/svg-linear-gradient-fill.json +80 -0
  16. package/dist/json-schema/svg-path-shape.json +26 -0
  17. package/dist/json-schema/svg-polygon-shape.json +35 -0
  18. package/dist/json-schema/svg-radial-gradient-fill.json +66 -0
  19. package/dist/json-schema/svg-rectangle-shape.json +49 -0
  20. package/dist/json-schema/svg-ring-shape.json +35 -0
  21. package/dist/json-schema/svg-shadow.json +79 -0
  22. package/dist/json-schema/svg-shape.json +404 -0
  23. package/dist/json-schema/svg-solid-fill.json +40 -0
  24. package/dist/json-schema/svg-star-shape.json +42 -0
  25. package/dist/json-schema/svg-stroke.json +115 -0
  26. package/dist/json-schema/svg-transform.json +93 -0
  27. package/dist/json-schema/timeline.json +854 -2
  28. package/dist/json-schema/track.json +854 -2
  29. package/dist/schema.d.ts +659 -7
  30. package/dist/zod/zod.gen.cjs +598 -8
  31. package/dist/zod/zod.gen.d.ts +8230 -156
  32. package/dist/zod/zod.gen.js +594 -5
  33. package/dist/zod/zod.gen.ts +369 -5
  34. package/package.json +1 -1
@@ -2107,23 +2107,612 @@ export const soundtrackSoundtrackSchema = z.object({
2107
2107
  }).strict();
2108
2108
  export const soundtrackSchema = soundtrackSoundtrackSchema;
2109
2109
  /**
2110
- * The SvgAsset is used to create scalable vector graphic (SVG) assets using
2111
- * raw SVG markup.
2110
+ * A color stop in a gradient. Each stop defines a color at a specific position
2111
+ * along the gradient vector. Gradients require at least 2 stops.
2112
2112
  *
2113
+ */
2114
+ export const svgpropertiesSvgGradientStopSchema = z.object({
2115
+ offset: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2116
+ return undefined; if (Array.isArray(v))
2117
+ return v; if (typeof v === 'string') {
2118
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2119
+ return v;
2120
+ return Number(v);
2121
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2122
+ color: z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2123
+ }).strict();
2124
+ export const svgGradientStopSchema = svgpropertiesSvgGradientStopSchema;
2125
+ /**
2126
+ * A linear gradient fill that transitions colors along a straight line.
2127
+ * The gradient direction is controlled by the `angle` property.
2128
+ *
2129
+ */
2130
+ export const svgpropertiesSvgLinearGradientFillSchema = z.object({
2131
+ type: z.enum(["linear"]),
2132
+ angle: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2133
+ return undefined; if (Array.isArray(v))
2134
+ return v; if (typeof v === 'string') {
2135
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2136
+ return v;
2137
+ return Number(v);
2138
+ } return v; }), z.number().gte(0).lte(360)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2139
+ stops: z.array(svgpropertiesSvgGradientStopSchema).min(2),
2140
+ opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2141
+ return undefined; if (Array.isArray(v))
2142
+ return v; if (typeof v === 'string') {
2143
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2144
+ return v;
2145
+ return Number(v);
2146
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2147
+ }).strict();
2148
+ export const svgLinearGradientFillSchema = svgpropertiesSvgLinearGradientFillSchema;
2149
+ /**
2150
+ * A radial gradient fill that transitions colors radiating outward from a center point.
2151
+ * The gradient creates a circular or elliptical color transition.
2152
+ *
2153
+ */
2154
+ export const svgpropertiesSvgRadialGradientFillSchema = z.object({
2155
+ type: z.enum(["radial"]),
2156
+ stops: z.array(svgpropertiesSvgGradientStopSchema).min(2),
2157
+ opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2158
+ return undefined; if (Array.isArray(v))
2159
+ return v; if (typeof v === 'string') {
2160
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2161
+ return v;
2162
+ return Number(v);
2163
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2164
+ }).strict();
2165
+ export const svgRadialGradientFillSchema = svgpropertiesSvgRadialGradientFillSchema;
2166
+ /**
2167
+ * Drop shadow properties for SVG shapes. Creates a shadow effect behind the shape.
2168
+ *
2169
+ */
2170
+ export const svgpropertiesSvgShadowSchema = z.object({
2171
+ offsetX: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2172
+ return undefined; if (Array.isArray(v))
2173
+ return v; if (typeof v === 'string') {
2174
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2175
+ return v;
2176
+ return Number(v);
2177
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2178
+ offsetY: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2179
+ return undefined; if (Array.isArray(v))
2180
+ return v; if (typeof v === 'string') {
2181
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2182
+ return v;
2183
+ return Number(v);
2184
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2185
+ blur: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2186
+ return undefined; if (Array.isArray(v))
2187
+ return v; if (typeof v === 'string') {
2188
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2189
+ return v;
2190
+ return Number(v);
2191
+ } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2192
+ color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),
2193
+ opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2194
+ return undefined; if (Array.isArray(v))
2195
+ return v; if (typeof v === 'string') {
2196
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2197
+ return v;
2198
+ return Number(v);
2199
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5),
2200
+ }).strict();
2201
+ export const svgShadowSchema = svgpropertiesSvgShadowSchema;
2202
+ /**
2203
+ * A solid color fill for SVG shapes.
2204
+ */
2205
+ export const svgpropertiesSvgSolidFillSchema = z.object({
2206
+ type: z.enum(["solid"]),
2207
+ color: z
2208
+ .string()
2209
+ .regex(/^#[A-Fa-f0-9]{6}$/)
2210
+ .default("#000000"),
2211
+ opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2212
+ return undefined; if (Array.isArray(v))
2213
+ return v; if (typeof v === 'string') {
2214
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2215
+ return v;
2216
+ return Number(v);
2217
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2218
+ }).strict();
2219
+ export const svgSolidFillSchema = svgpropertiesSvgSolidFillSchema;
2220
+ /**
2221
+ * Fill properties for SVG shapes. Supports solid colors and gradients.
2222
+ * The fill defines how the interior of a shape is painted.
2223
+ *
2224
+ */
2225
+ export const svgpropertiesSvgFillSchema = z.discriminatedUnion("type", [
2226
+ svgpropertiesSvgSolidFillSchema,
2227
+ svgpropertiesSvgLinearGradientFillSchema,
2228
+ svgpropertiesSvgRadialGradientFillSchema,
2229
+ ]);
2230
+ export const svgFillSchema = svgpropertiesSvgFillSchema;
2231
+ /**
2232
+ * Stroke (outline) properties for SVG shapes. The stroke defines how the outline
2233
+ * of a shape is painted, including its color, width, and line style.
2234
+ *
2235
+ */
2236
+ export const svgpropertiesSvgStrokeSchema = z.object({
2237
+ color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),
2238
+ width: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2239
+ return undefined; if (Array.isArray(v))
2240
+ return v; if (typeof v === 'string') {
2241
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2242
+ return v;
2243
+ return Number(v);
2244
+ } return v; }), z.number().gte(0).lte(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2245
+ opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2246
+ return undefined; if (Array.isArray(v))
2247
+ return v; if (typeof v === 'string') {
2248
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2249
+ return v;
2250
+ return Number(v);
2251
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2252
+ lineCap: z.optional(z.enum(["butt", "round", "square"])),
2253
+ lineJoin: z.optional(z.enum(["miter", "round", "bevel"])),
2254
+ dashArray: z.optional(z.array(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2255
+ return undefined; if (Array.isArray(v))
2256
+ return v; if (typeof v === 'string') {
2257
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2258
+ return v;
2259
+ return Number(v);
2260
+ } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))),
2261
+ dashOffset: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2262
+ return undefined; if (Array.isArray(v))
2263
+ return v; if (typeof v === 'string') {
2264
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2265
+ return v;
2266
+ return Number(v);
2267
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2268
+ }).strict();
2269
+ export const svgStrokeSchema = svgpropertiesSvgStrokeSchema;
2270
+ /**
2271
+ * Transformation properties for positioning, rotating, and scaling SVG shapes.
2272
+ *
2273
+ */
2274
+ export const svgpropertiesSvgTransformSchema = z.object({
2275
+ x: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2276
+ return undefined; if (Array.isArray(v))
2277
+ return v; if (typeof v === 'string') {
2278
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2279
+ return v;
2280
+ return Number(v);
2281
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2282
+ y: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2283
+ return undefined; if (Array.isArray(v))
2284
+ return v; if (typeof v === 'string') {
2285
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2286
+ return v;
2287
+ return Number(v);
2288
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2289
+ rotation: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2290
+ return undefined; if (Array.isArray(v))
2291
+ return v; if (typeof v === 'string') {
2292
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2293
+ return v;
2294
+ return Number(v);
2295
+ } return v; }), z.number().gte(-360).lte(360)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2296
+ scale: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2297
+ return undefined; if (Array.isArray(v))
2298
+ return v; if (typeof v === 'string') {
2299
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2300
+ return v;
2301
+ return Number(v);
2302
+ } return v; }), z.number().gte(0.01).lte(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2303
+ originX: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2304
+ return undefined; if (Array.isArray(v))
2305
+ return v; if (typeof v === 'string') {
2306
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2307
+ return v;
2308
+ return Number(v);
2309
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5),
2310
+ originY: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2311
+ return undefined; if (Array.isArray(v))
2312
+ return v; if (typeof v === 'string') {
2313
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2314
+ return v;
2315
+ return Number(v);
2316
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5),
2317
+ }).strict();
2318
+ export const svgTransformSchema = svgpropertiesSvgTransformSchema;
2319
+ /**
2320
+ * An arrow shape pointing to the right by default.
2321
+ * Use transform rotation to change direction.
2322
+ *
2323
+ */
2324
+ export const svgshapesSvgArrowShapeSchema = z.object({
2325
+ type: z.enum(["arrow"]),
2326
+ length: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2327
+ return undefined; if (Array.isArray(v))
2328
+ return v; if (typeof v === 'string') {
2329
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2330
+ return v;
2331
+ return Number(v);
2332
+ } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2333
+ headWidth: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2334
+ return undefined; if (Array.isArray(v))
2335
+ return v; if (typeof v === 'string') {
2336
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2337
+ return v;
2338
+ return Number(v);
2339
+ } return v; }), z.number().gte(1).lte(1000)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2340
+ headLength: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2341
+ return undefined; if (Array.isArray(v))
2342
+ return v; if (typeof v === 'string') {
2343
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2344
+ return v;
2345
+ return Number(v);
2346
+ } return v; }), z.number().gte(1).lte(1000)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2347
+ shaftWidth: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2348
+ return undefined; if (Array.isArray(v))
2349
+ return v; if (typeof v === 'string') {
2350
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2351
+ return v;
2352
+ return Number(v);
2353
+ } return v; }), z.number().gte(1).lte(1000)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2354
+ }).strict();
2355
+ export const svgArrowShapeSchema = svgshapesSvgArrowShapeSchema;
2356
+ /**
2357
+ * A perfect circle shape defined by its radius.
2358
+ * The circle is centered at the shape's position.
2359
+ *
2360
+ */
2361
+ export const svgshapesSvgCircleShapeSchema = z.object({
2362
+ type: z.enum(["circle"]),
2363
+ radius: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2364
+ return undefined; if (Array.isArray(v))
2365
+ return v; if (typeof v === 'string') {
2366
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2367
+ return v;
2368
+ return Number(v);
2369
+ } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2370
+ }).strict();
2371
+ export const svgCircleShapeSchema = svgshapesSvgCircleShapeSchema;
2372
+ /**
2373
+ * A cross or plus shape with equal or different arm lengths.
2374
+ * Can be styled as a plus sign (+) or a cross (x with rotation).
2375
+ *
2376
+ */
2377
+ export const svgshapesSvgCrossShapeSchema = z.object({
2378
+ type: z.enum(["cross"]),
2379
+ width: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2380
+ return undefined; if (Array.isArray(v))
2381
+ return v; if (typeof v === 'string') {
2382
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2383
+ return v;
2384
+ return Number(v);
2385
+ } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2386
+ height: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2387
+ return undefined; if (Array.isArray(v))
2388
+ return v; if (typeof v === 'string') {
2389
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2390
+ return v;
2391
+ return Number(v);
2392
+ } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2393
+ thickness: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2394
+ return undefined; if (Array.isArray(v))
2395
+ return v; if (typeof v === 'string') {
2396
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2397
+ return v;
2398
+ return Number(v);
2399
+ } return v; }), z.number().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2400
+ }).strict();
2401
+ export const svgCrossShapeSchema = svgshapesSvgCrossShapeSchema;
2402
+ /**
2403
+ * An ellipse (oval) shape with separate horizontal and vertical radii.
2404
+ * The ellipse is centered at the shape's position.
2405
+ *
2406
+ */
2407
+ export const svgshapesSvgEllipseShapeSchema = z.object({
2408
+ type: z.enum(["ellipse"]),
2409
+ radiusX: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2410
+ return undefined; if (Array.isArray(v))
2411
+ return v; if (typeof v === 'string') {
2412
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2413
+ return v;
2414
+ return Number(v);
2415
+ } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2416
+ radiusY: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2417
+ return undefined; if (Array.isArray(v))
2418
+ return v; if (typeof v === 'string') {
2419
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2420
+ return v;
2421
+ return Number(v);
2422
+ } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2423
+ }).strict();
2424
+ export const svgEllipseShapeSchema = svgshapesSvgEllipseShapeSchema;
2425
+ /**
2426
+ * A heart shape commonly used for love/like icons.
2427
+ * The heart is defined by a single size parameter.
2428
+ *
2429
+ */
2430
+ export const svgshapesSvgHeartShapeSchema = z.object({
2431
+ type: z.enum(["heart"]),
2432
+ size: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2433
+ return undefined; if (Array.isArray(v))
2434
+ return v; if (typeof v === 'string') {
2435
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2436
+ return v;
2437
+ return Number(v);
2438
+ } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2439
+ }).strict();
2440
+ export const svgHeartShapeSchema = svgshapesSvgHeartShapeSchema;
2441
+ /**
2442
+ * A straight line shape with a specified length and thickness.
2443
+ * The line is drawn horizontally by default and can be rotated using transform.
2444
+ *
2445
+ */
2446
+ export const svgshapesSvgLineShapeSchema = z.object({
2447
+ type: z.enum(["line"]),
2448
+ length: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2449
+ return undefined; if (Array.isArray(v))
2450
+ return v; if (typeof v === 'string') {
2451
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2452
+ return v;
2453
+ return Number(v);
2454
+ } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2455
+ thickness: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2456
+ return undefined; if (Array.isArray(v))
2457
+ return v; if (typeof v === 'string') {
2458
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2459
+ return v;
2460
+ return Number(v);
2461
+ } return v; }), z.number().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2462
+ }).strict();
2463
+ export const svgLineShapeSchema = svgshapesSvgLineShapeSchema;
2464
+ /**
2465
+ * A custom shape defined by SVG path data.
2466
+ * Supports all standard SVG path commands for creating complex shapes.
2467
+ *
2468
+ * **Path Commands:**
2469
+ * - `M x y` / `m dx dy` - Move to (absolute/relative)
2470
+ * - `L x y` / `l dx dy` - Line to
2471
+ * - `H x` / `h dx` - Horizontal line to
2472
+ * - `V y` / `v dy` - Vertical line to
2473
+ * - `C x1 y1 x2 y2 x y` / `c` - Cubic Bezier curve
2474
+ * - `S x2 y2 x y` / `s` - Smooth cubic Bezier
2475
+ * - `Q x1 y1 x y` / `q` - Quadratic Bezier curve
2476
+ * - `T x y` / `t` - Smooth quadratic Bezier
2477
+ * - `A rx ry angle large-arc sweep x y` / `a` - Elliptical arc
2478
+ * - `Z` / `z` - Close path
2479
+ *
2480
+ */
2481
+ export const svgshapesSvgPathShapeSchema = z.object({
2482
+ type: z.enum(["path"]),
2483
+ d: z.string().min(1).max(100000),
2484
+ }).strict();
2485
+ export const svgPathShapeSchema = svgshapesSvgPathShapeSchema;
2486
+ /**
2487
+ * A regular polygon shape with a specified number of sides.
2488
+ * Examples: triangle (3), square (4), pentagon (5), hexagon (6), etc.
2489
+ * The polygon is inscribed in a circle of the given radius.
2490
+ *
2491
+ */
2492
+ export const svgshapesSvgPolygonShapeSchema = z.object({
2493
+ type: z.enum(["polygon"]),
2494
+ sides: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2495
+ return undefined; if (Array.isArray(v))
2496
+ return v; if (typeof v === 'string') {
2497
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2498
+ return v;
2499
+ return Number(v);
2500
+ } return v; }), z.number().int().gte(3).lte(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2501
+ radius: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2502
+ return undefined; if (Array.isArray(v))
2503
+ return v; if (typeof v === 'string') {
2504
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2505
+ return v;
2506
+ return Number(v);
2507
+ } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2508
+ }).strict();
2509
+ export const svgPolygonShapeSchema = svgshapesSvgPolygonShapeSchema;
2510
+ /**
2511
+ * A rectangle shape with optional rounded corners.
2512
+ * The rectangle is defined by its width and height dimensions.
2513
+ *
2514
+ */
2515
+ export const svgshapesSvgRectangleShapeSchema = z.object({
2516
+ type: z.enum(["rectangle"]),
2517
+ width: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2518
+ return undefined; if (Array.isArray(v))
2519
+ return v; if (typeof v === 'string') {
2520
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2521
+ return v;
2522
+ return Number(v);
2523
+ } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2524
+ height: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2525
+ return undefined; if (Array.isArray(v))
2526
+ return v; if (typeof v === 'string') {
2527
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2528
+ return v;
2529
+ return Number(v);
2530
+ } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2531
+ cornerRadius: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2532
+ return undefined; if (Array.isArray(v))
2533
+ return v; if (typeof v === 'string') {
2534
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2535
+ return v;
2536
+ return Number(v);
2537
+ } return v; }), z.number().gte(0).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2538
+ }).strict();
2539
+ export const svgRectangleShapeSchema = svgshapesSvgRectangleShapeSchema;
2540
+ /**
2541
+ * A ring (donut/annulus) shape - a circle with a circular hole in the center.
2542
+ * The ring is defined by outer and inner radii.
2543
+ *
2544
+ */
2545
+ export const svgshapesSvgRingShapeSchema = z.object({
2546
+ type: z.enum(["ring"]),
2547
+ outerRadius: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2548
+ return undefined; if (Array.isArray(v))
2549
+ return v; if (typeof v === 'string') {
2550
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2551
+ return v;
2552
+ return Number(v);
2553
+ } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2554
+ innerRadius: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2555
+ return undefined; if (Array.isArray(v))
2556
+ return v; if (typeof v === 'string') {
2557
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2558
+ return v;
2559
+ return Number(v);
2560
+ } return v; }), z.number().gte(0).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2561
+ }).strict();
2562
+ export const svgRingShapeSchema = svgshapesSvgRingShapeSchema;
2563
+ /**
2564
+ * A star shape with a specified number of points.
2565
+ * The star is defined by outer and inner radii, creating the characteristic
2566
+ * pointed appearance.
2567
+ *
2568
+ */
2569
+ export const svgshapesSvgStarShapeSchema = z.object({
2570
+ type: z.enum(["star"]),
2571
+ points: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2572
+ return undefined; if (Array.isArray(v))
2573
+ return v; if (typeof v === 'string') {
2574
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2575
+ return v;
2576
+ return Number(v);
2577
+ } return v; }), z.number().int().gte(3).lte(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2578
+ outerRadius: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2579
+ return undefined; if (Array.isArray(v))
2580
+ return v; if (typeof v === 'string') {
2581
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2582
+ return v;
2583
+ return Number(v);
2584
+ } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2585
+ innerRadius: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2586
+ return undefined; if (Array.isArray(v))
2587
+ return v; if (typeof v === 'string') {
2588
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2589
+ return v;
2590
+ return Number(v);
2591
+ } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2592
+ }).strict();
2593
+ export const svgStarShapeSchema = svgshapesSvgStarShapeSchema;
2594
+ /**
2595
+ * The shape definition for an SVG asset. Each shape type has its own specific
2596
+ * properties. The `type` field determines which shape is rendered.
2597
+ *
2598
+ */
2599
+ export const svgshapesSvgShapeSchema = z.discriminatedUnion("type", [
2600
+ svgshapesSvgRectangleShapeSchema,
2601
+ svgshapesSvgCircleShapeSchema,
2602
+ svgshapesSvgEllipseShapeSchema,
2603
+ svgshapesSvgLineShapeSchema,
2604
+ svgshapesSvgPolygonShapeSchema,
2605
+ svgshapesSvgStarShapeSchema,
2606
+ svgshapesSvgArrowShapeSchema,
2607
+ svgshapesSvgHeartShapeSchema,
2608
+ svgshapesSvgCrossShapeSchema,
2609
+ svgshapesSvgRingShapeSchema,
2610
+ svgshapesSvgPathShapeSchema,
2611
+ ]);
2612
+ export const svgShapeSchema = svgshapesSvgShapeSchema;
2613
+ /**
2614
+ * The SvgAsset is used to add scalable vector graphics (SVG) shapes to a video.
2615
+ * It provides two mutually exclusive ways to define shapes:
2616
+ *
2617
+ * **Option 1: Import SVG markup using `src`**
2113
2618
  * ```json
2114
2619
  * {
2115
2620
  * "type": "svg",
2116
2621
  * "src": "<svg width=\"100\" height=\"100\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#FF0000\"/></svg>"
2117
2622
  * }
2118
2623
  * ```
2624
+ * When using `src`, no other properties are allowed. The fill, stroke, and dimensions
2625
+ * are automatically extracted from the SVG markup.
2626
+ *
2627
+ * **Option 2: Define shapes programmatically using `shape`**
2628
+ * ```json
2629
+ * {
2630
+ * "type": "svg",
2631
+ * "shape": { "type": "circle", "radius": 50 },
2632
+ * "fill": { "type": "solid", "color": "#FF0000" }
2633
+ * }
2634
+ * ```
2635
+ * When using `shape`, you can customize fill, stroke, shadow, transform, and other properties.
2636
+ * The `src` property is not allowed in this mode.
2637
+ *
2638
+ * **Important:** You must provide either `src` OR `shape`, but not both.
2639
+ * These two modes are mutually exclusive.
2640
+ *
2641
+ * **Available Shapes (Option 2 only):**
2642
+ * - `rectangle` - Rectangles with optional rounded corners
2643
+ * - `circle` - Perfect circles
2644
+ * - `ellipse` - Ellipses/ovals with separate x and y radii
2645
+ * - `line` - Straight lines with configurable thickness
2646
+ * - `polygon` - Regular polygons (triangle, pentagon, hexagon, etc.)
2647
+ * - `star` - Multi-pointed stars
2648
+ * - `arrow` - Directional arrows
2649
+ * - `heart` - Heart shapes
2650
+ * - `cross` - Plus/cross shapes
2651
+ * - `ring` - Donut/ring shapes
2652
+ * - `path` - Custom shapes using SVG path data
2119
2653
  *
2120
- * See [W3C SVG 2 Specification](https://www.w3.org/TR/SVG2/) for SVG markup syntax.
2654
+ * See [W3C SVG 2 Specification](https://www.w3.org/TR/SVG2/) for path data syntax.
2121
2655
  *
2122
2656
  */
2123
2657
  export const svgassetSvgAssetSchema = z.object({
2124
2658
  type: z.enum(["svg"]),
2125
- src: z.string().min(1).max(500000),
2126
- }).strict();
2659
+ src: z.optional(z.string().min(1).max(500000)),
2660
+ shape: z.optional(svgshapesSvgShapeSchema),
2661
+ fill: z.optional(svgpropertiesSvgFillSchema),
2662
+ stroke: z.optional(svgpropertiesSvgStrokeSchema),
2663
+ shadow: z.optional(svgpropertiesSvgShadowSchema),
2664
+ transform: z.optional(svgpropertiesSvgTransformSchema),
2665
+ opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2666
+ return undefined; if (Array.isArray(v))
2667
+ return v; if (typeof v === 'string') {
2668
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2669
+ return v;
2670
+ return Number(v);
2671
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2672
+ width: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2673
+ return undefined; if (Array.isArray(v))
2674
+ return v; if (typeof v === 'string') {
2675
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2676
+ return v;
2677
+ return Number(v);
2678
+ } return v; }), z.number().int().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
2679
+ height: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2680
+ return undefined; if (Array.isArray(v))
2681
+ return v; if (typeof v === 'string') {
2682
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2683
+ return v;
2684
+ return Number(v);
2685
+ } return v; }), z.number().int().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
2686
+ }).strict().superRefine((data, ctx) => {
2687
+ const hasShape = data.shape !== undefined;
2688
+ const hasSrc = data.src !== undefined && data.src.trim() !== "";
2689
+ if (!hasShape && !hasSrc) {
2690
+ ctx.addIssue({
2691
+ code: z.ZodIssueCode.custom,
2692
+ message: "Either 'src' or 'shape' must be provided",
2693
+ path: [],
2694
+ });
2695
+ }
2696
+ if (hasShape && hasSrc) {
2697
+ ctx.addIssue({
2698
+ code: z.ZodIssueCode.custom,
2699
+ message: "Provide either 'src' or 'shape', not both",
2700
+ path: ["src"],
2701
+ });
2702
+ }
2703
+ if (hasSrc) {
2704
+ const disallowedProps = ["shape", "fill", "stroke", "shadow", "transform", "width", "height"];
2705
+ for (const prop of disallowedProps) {
2706
+ if (data[prop] !== undefined) {
2707
+ ctx.addIssue({
2708
+ code: z.ZodIssueCode.custom,
2709
+ message: `'${prop}' is not allowed when using 'src'. Only 'type' and 'src' are allowed in import mode`,
2710
+ path: [prop],
2711
+ });
2712
+ }
2713
+ }
2714
+ }
2715
+ });
2127
2716
  export const svgAssetSchema = svgassetSvgAssetSchema;
2128
2717
  /**
2129
2718
  * Configure the id and optional merge fields to render a template by id.