@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
@@ -1958,23 +1958,387 @@ export const soundtrackSoundtrackSchema = z.object({
1958
1958
  export const soundtrackSchema = soundtrackSoundtrackSchema;
1959
1959
 
1960
1960
  /**
1961
- * The SvgAsset is used to create scalable vector graphic (SVG) assets using
1962
- * raw SVG markup.
1961
+ * A color stop in a gradient. Each stop defines a color at a specific position
1962
+ * along the gradient vector. Gradients require at least 2 stops.
1963
1963
  *
1964
+ */
1965
+ export const svgpropertiesSvgGradientStopSchema = z.object({
1966
+ offset: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
1967
+ color: z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
1968
+ }).strict();
1969
+
1970
+ export const svgGradientStopSchema = svgpropertiesSvgGradientStopSchema;
1971
+
1972
+ /**
1973
+ * A linear gradient fill that transitions colors along a straight line.
1974
+ * The gradient direction is controlled by the `angle` property.
1975
+ *
1976
+ */
1977
+ export const svgpropertiesSvgLinearGradientFillSchema = z.object({
1978
+ type: z.enum(["linear"]),
1979
+ angle: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(360)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
1980
+ stops: z.array(svgpropertiesSvgGradientStopSchema).min(2),
1981
+ opacity: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1982
+ }).strict();
1983
+
1984
+ export const svgLinearGradientFillSchema =
1985
+ svgpropertiesSvgLinearGradientFillSchema;
1986
+
1987
+ /**
1988
+ * A radial gradient fill that transitions colors radiating outward from a center point.
1989
+ * The gradient creates a circular or elliptical color transition.
1990
+ *
1991
+ */
1992
+ export const svgpropertiesSvgRadialGradientFillSchema = z.object({
1993
+ type: z.enum(["radial"]),
1994
+ stops: z.array(svgpropertiesSvgGradientStopSchema).min(2),
1995
+ opacity: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1996
+ }).strict();
1997
+
1998
+ export const svgRadialGradientFillSchema =
1999
+ svgpropertiesSvgRadialGradientFillSchema;
2000
+
2001
+ /**
2002
+ * Drop shadow properties for SVG shapes. Creates a shadow effect behind the shape.
2003
+ *
2004
+ */
2005
+ export const svgpropertiesSvgShadowSchema = z.object({
2006
+ offsetX: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2007
+ offsetY: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2008
+ blur: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2009
+ color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),
2010
+ opacity: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5),
2011
+ }).strict();
2012
+
2013
+ export const svgShadowSchema = svgpropertiesSvgShadowSchema;
2014
+
2015
+ /**
2016
+ * A solid color fill for SVG shapes.
2017
+ */
2018
+ export const svgpropertiesSvgSolidFillSchema = z.object({
2019
+ type: z.enum(["solid"]),
2020
+ color: z
2021
+ .string()
2022
+ .regex(/^#[A-Fa-f0-9]{6}$/)
2023
+ .default("#000000"),
2024
+ opacity: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2025
+ }).strict();
2026
+
2027
+ export const svgSolidFillSchema = svgpropertiesSvgSolidFillSchema;
2028
+
2029
+ /**
2030
+ * Fill properties for SVG shapes. Supports solid colors and gradients.
2031
+ * The fill defines how the interior of a shape is painted.
2032
+ *
2033
+ */
2034
+ export const svgpropertiesSvgFillSchema = z.discriminatedUnion("type", [
2035
+ svgpropertiesSvgSolidFillSchema,
2036
+ svgpropertiesSvgLinearGradientFillSchema,
2037
+ svgpropertiesSvgRadialGradientFillSchema,
2038
+ ]);
2039
+
2040
+ export const svgFillSchema = svgpropertiesSvgFillSchema;
2041
+
2042
+ /**
2043
+ * Stroke (outline) properties for SVG shapes. The stroke defines how the outline
2044
+ * of a shape is painted, including its color, width, and line style.
2045
+ *
2046
+ */
2047
+ export const svgpropertiesSvgStrokeSchema = z.object({
2048
+ color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),
2049
+ width: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2050
+ opacity: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2051
+ lineCap: z.optional(z.enum(["butt", "round", "square"])),
2052
+ lineJoin: z.optional(z.enum(["miter", "round", "bevel"])),
2053
+ dashArray: z.optional(z.array(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))),
2054
+ dashOffset: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2055
+ }).strict();
2056
+
2057
+ export const svgStrokeSchema = svgpropertiesSvgStrokeSchema;
2058
+
2059
+ /**
2060
+ * Transformation properties for positioning, rotating, and scaling SVG shapes.
2061
+ *
2062
+ */
2063
+ export const svgpropertiesSvgTransformSchema = z.object({
2064
+ x: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2065
+ y: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2066
+ rotation: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(-360).lte(360)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2067
+ scale: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0.01).lte(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2068
+ originX: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5),
2069
+ originY: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.5),
2070
+ }).strict();
2071
+
2072
+ export const svgTransformSchema = svgpropertiesSvgTransformSchema;
2073
+
2074
+ /**
2075
+ * An arrow shape pointing to the right by default.
2076
+ * Use transform rotation to change direction.
2077
+ *
2078
+ */
2079
+ export const svgshapesSvgArrowShapeSchema = z.object({
2080
+ type: z.enum(["arrow"]),
2081
+ length: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2082
+ headWidth: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(1000)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2083
+ headLength: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(1000)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2084
+ shaftWidth: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(1000)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2085
+ }).strict();
2086
+
2087
+ export const svgArrowShapeSchema = svgshapesSvgArrowShapeSchema;
2088
+
2089
+ /**
2090
+ * A perfect circle shape defined by its radius.
2091
+ * The circle is centered at the shape's position.
2092
+ *
2093
+ */
2094
+ export const svgshapesSvgCircleShapeSchema = z.object({
2095
+ type: z.enum(["circle"]),
2096
+ radius: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2097
+ }).strict();
2098
+
2099
+ export const svgCircleShapeSchema = svgshapesSvgCircleShapeSchema;
2100
+
2101
+ /**
2102
+ * A cross or plus shape with equal or different arm lengths.
2103
+ * Can be styled as a plus sign (+) or a cross (x with rotation).
2104
+ *
2105
+ */
2106
+ export const svgshapesSvgCrossShapeSchema = z.object({
2107
+ type: z.enum(["cross"]),
2108
+ width: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2109
+ height: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2110
+ thickness: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2111
+ }).strict();
2112
+
2113
+ export const svgCrossShapeSchema = svgshapesSvgCrossShapeSchema;
2114
+
2115
+ /**
2116
+ * An ellipse (oval) shape with separate horizontal and vertical radii.
2117
+ * The ellipse is centered at the shape's position.
2118
+ *
2119
+ */
2120
+ export const svgshapesSvgEllipseShapeSchema = z.object({
2121
+ type: z.enum(["ellipse"]),
2122
+ radiusX: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2123
+ radiusY: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2124
+ }).strict();
2125
+
2126
+ export const svgEllipseShapeSchema = svgshapesSvgEllipseShapeSchema;
2127
+
2128
+ /**
2129
+ * A heart shape commonly used for love/like icons.
2130
+ * The heart is defined by a single size parameter.
2131
+ *
2132
+ */
2133
+ export const svgshapesSvgHeartShapeSchema = z.object({
2134
+ type: z.enum(["heart"]),
2135
+ size: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2136
+ }).strict();
2137
+
2138
+ export const svgHeartShapeSchema = svgshapesSvgHeartShapeSchema;
2139
+
2140
+ /**
2141
+ * A straight line shape with a specified length and thickness.
2142
+ * The line is drawn horizontally by default and can be rotated using transform.
2143
+ *
2144
+ */
2145
+ export const svgshapesSvgLineShapeSchema = z.object({
2146
+ type: z.enum(["line"]),
2147
+ length: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2148
+ thickness: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2149
+ }).strict();
2150
+
2151
+ export const svgLineShapeSchema = svgshapesSvgLineShapeSchema;
2152
+
2153
+ /**
2154
+ * A custom shape defined by SVG path data.
2155
+ * Supports all standard SVG path commands for creating complex shapes.
2156
+ *
2157
+ * **Path Commands:**
2158
+ * - `M x y` / `m dx dy` - Move to (absolute/relative)
2159
+ * - `L x y` / `l dx dy` - Line to
2160
+ * - `H x` / `h dx` - Horizontal line to
2161
+ * - `V y` / `v dy` - Vertical line to
2162
+ * - `C x1 y1 x2 y2 x y` / `c` - Cubic Bezier curve
2163
+ * - `S x2 y2 x y` / `s` - Smooth cubic Bezier
2164
+ * - `Q x1 y1 x y` / `q` - Quadratic Bezier curve
2165
+ * - `T x y` / `t` - Smooth quadratic Bezier
2166
+ * - `A rx ry angle large-arc sweep x y` / `a` - Elliptical arc
2167
+ * - `Z` / `z` - Close path
2168
+ *
2169
+ */
2170
+ export const svgshapesSvgPathShapeSchema = z.object({
2171
+ type: z.enum(["path"]),
2172
+ d: z.string().min(1).max(100000),
2173
+ }).strict();
2174
+
2175
+ export const svgPathShapeSchema = svgshapesSvgPathShapeSchema;
2176
+
2177
+ /**
2178
+ * A regular polygon shape with a specified number of sides.
2179
+ * Examples: triangle (3), square (4), pentagon (5), hexagon (6), etc.
2180
+ * The polygon is inscribed in a circle of the given radius.
2181
+ *
2182
+ */
2183
+ export const svgshapesSvgPolygonShapeSchema = z.object({
2184
+ type: z.enum(["polygon"]),
2185
+ sides: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().int().gte(3).lte(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2186
+ radius: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2187
+ }).strict();
2188
+
2189
+ export const svgPolygonShapeSchema = svgshapesSvgPolygonShapeSchema;
2190
+
2191
+ /**
2192
+ * A rectangle shape with optional rounded corners.
2193
+ * The rectangle is defined by its width and height dimensions.
2194
+ *
2195
+ */
2196
+ export const svgshapesSvgRectangleShapeSchema = z.object({
2197
+ type: z.enum(["rectangle"]),
2198
+ width: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2199
+ height: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2200
+ cornerRadius: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
2201
+ }).strict();
2202
+
2203
+ export const svgRectangleShapeSchema = svgshapesSvgRectangleShapeSchema;
2204
+
2205
+ /**
2206
+ * A ring (donut/annulus) shape - a circle with a circular hole in the center.
2207
+ * The ring is defined by outer and inner radii.
2208
+ *
2209
+ */
2210
+ export const svgshapesSvgRingShapeSchema = z.object({
2211
+ type: z.enum(["ring"]),
2212
+ outerRadius: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2213
+ innerRadius: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2214
+ }).strict();
2215
+
2216
+ export const svgRingShapeSchema = svgshapesSvgRingShapeSchema;
2217
+
2218
+ /**
2219
+ * A star shape with a specified number of points.
2220
+ * The star is defined by outer and inner radii, creating the characteristic
2221
+ * pointed appearance.
2222
+ *
2223
+ */
2224
+ export const svgshapesSvgStarShapeSchema = z.object({
2225
+ type: z.enum(["star"]),
2226
+ points: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().int().gte(3).lte(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2227
+ outerRadius: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2228
+ innerRadius: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(1).lte(2048)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
2229
+ }).strict();
2230
+
2231
+ export const svgStarShapeSchema = svgshapesSvgStarShapeSchema;
2232
+
2233
+ /**
2234
+ * The shape definition for an SVG asset. Each shape type has its own specific
2235
+ * properties. The `type` field determines which shape is rendered.
2236
+ *
2237
+ */
2238
+ export const svgshapesSvgShapeSchema = z.discriminatedUnion("type", [
2239
+ svgshapesSvgRectangleShapeSchema,
2240
+ svgshapesSvgCircleShapeSchema,
2241
+ svgshapesSvgEllipseShapeSchema,
2242
+ svgshapesSvgLineShapeSchema,
2243
+ svgshapesSvgPolygonShapeSchema,
2244
+ svgshapesSvgStarShapeSchema,
2245
+ svgshapesSvgArrowShapeSchema,
2246
+ svgshapesSvgHeartShapeSchema,
2247
+ svgshapesSvgCrossShapeSchema,
2248
+ svgshapesSvgRingShapeSchema,
2249
+ svgshapesSvgPathShapeSchema,
2250
+ ]);
2251
+
2252
+ export const svgShapeSchema = svgshapesSvgShapeSchema;
2253
+
2254
+ /**
2255
+ * The SvgAsset is used to add scalable vector graphics (SVG) shapes to a video.
2256
+ * It provides two mutually exclusive ways to define shapes:
2257
+ *
2258
+ * **Option 1: Import SVG markup using `src`**
1964
2259
  * ```json
1965
2260
  * {
1966
2261
  * "type": "svg",
1967
2262
  * "src": "<svg width=\"100\" height=\"100\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#FF0000\"/></svg>"
1968
2263
  * }
1969
2264
  * ```
2265
+ * When using `src`, no other properties are allowed. The fill, stroke, and dimensions
2266
+ * are automatically extracted from the SVG markup.
1970
2267
  *
1971
- * See [W3C SVG 2 Specification](https://www.w3.org/TR/SVG2/) for SVG markup syntax.
2268
+ * **Option 2: Define shapes programmatically using `shape`**
2269
+ * ```json
2270
+ * {
2271
+ * "type": "svg",
2272
+ * "shape": { "type": "circle", "radius": 50 },
2273
+ * "fill": { "type": "solid", "color": "#FF0000" }
2274
+ * }
2275
+ * ```
2276
+ * When using `shape`, you can customize fill, stroke, shadow, transform, and other properties.
2277
+ * The `src` property is not allowed in this mode.
2278
+ *
2279
+ * **Important:** You must provide either `src` OR `shape`, but not both.
2280
+ * These two modes are mutually exclusive.
2281
+ *
2282
+ * **Available Shapes (Option 2 only):**
2283
+ * - `rectangle` - Rectangles with optional rounded corners
2284
+ * - `circle` - Perfect circles
2285
+ * - `ellipse` - Ellipses/ovals with separate x and y radii
2286
+ * - `line` - Straight lines with configurable thickness
2287
+ * - `polygon` - Regular polygons (triangle, pentagon, hexagon, etc.)
2288
+ * - `star` - Multi-pointed stars
2289
+ * - `arrow` - Directional arrows
2290
+ * - `heart` - Heart shapes
2291
+ * - `cross` - Plus/cross shapes
2292
+ * - `ring` - Donut/ring shapes
2293
+ * - `path` - Custom shapes using SVG path data
2294
+ *
2295
+ * See [W3C SVG 2 Specification](https://www.w3.org/TR/SVG2/) for path data syntax.
1972
2296
  *
1973
2297
  */
1974
2298
  export const svgassetSvgAssetSchema = z.object({
1975
2299
  type: z.enum(["svg"]),
1976
- src: z.string().min(1).max(500000),
1977
- }).strict();
2300
+ src: z.optional(z.string().min(1).max(500000)),
2301
+ shape: z.optional(svgshapesSvgShapeSchema),
2302
+ fill: z.optional(svgpropertiesSvgFillSchema),
2303
+ stroke: z.optional(svgpropertiesSvgStrokeSchema),
2304
+ shadow: z.optional(svgpropertiesSvgShadowSchema),
2305
+ transform: z.optional(svgpropertiesSvgTransformSchema),
2306
+ opacity: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
2307
+ width: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().int().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
2308
+ height: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().int().gte(1).lte(4096)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
2309
+ }).strict().superRefine((data, ctx) => {
2310
+ const hasShape = data.shape !== undefined;
2311
+ const hasSrc = data.src !== undefined && data.src.trim() !== "";
2312
+
2313
+ if (!hasShape && !hasSrc) {
2314
+ ctx.addIssue({
2315
+ code: z.ZodIssueCode.custom,
2316
+ message: "Either 'src' or 'shape' must be provided",
2317
+ path: [],
2318
+ });
2319
+ }
2320
+
2321
+ if (hasShape && hasSrc) {
2322
+ ctx.addIssue({
2323
+ code: z.ZodIssueCode.custom,
2324
+ message: "Provide either 'src' or 'shape', not both",
2325
+ path: ["src"],
2326
+ });
2327
+ }
2328
+
2329
+ if (hasSrc) {
2330
+ const disallowedProps = ["shape", "fill", "stroke", "shadow", "transform", "width", "height"];
2331
+ for (const prop of disallowedProps) {
2332
+ if (data[prop] !== undefined) {
2333
+ ctx.addIssue({
2334
+ code: z.ZodIssueCode.custom,
2335
+ message: `'${prop}' is not allowed when using 'src'. Only 'type' and 'src' are allowed in import mode`,
2336
+ path: [prop],
2337
+ });
2338
+ }
2339
+ }
2340
+ }
2341
+ });
1978
2342
 
1979
2343
  export const svgAssetSchema = svgassetSvgAssetSchema;
1980
2344
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",