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