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