@shotstack/schemas 1.8.3 → 1.8.4
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 +204 -972
- package/dist/json-schema/asset.json +3 -936
- package/dist/json-schema/clip.json +3 -936
- package/dist/json-schema/destinations.json +111 -23
- package/dist/json-schema/edit.json +256 -1083
- package/dist/json-schema/output.json +106 -0
- package/dist/json-schema/rich-caption-asset.json +140 -221
- package/dist/json-schema/schemas.json +295 -1207
- package/dist/json-schema/svg-asset.json +6 -857
- package/dist/json-schema/timeline.json +3 -936
- package/dist/json-schema/track.json +3 -936
- package/dist/schema.d.ts +68 -695
- package/dist/zod/zod.gen.cjs +44 -625
- package/dist/zod/zod.gen.d.ts +543 -8241
- package/dist/zod/zod.gen.js +38 -618
- package/dist/zod/zod.gen.ts +50 -382
- package/package.json +1 -1
- package/dist/json-schema/svg-arrow-shape.json +0 -49
- package/dist/json-schema/svg-circle-shape.json +0 -28
- package/dist/json-schema/svg-cross-shape.json +0 -42
- package/dist/json-schema/svg-ellipse-shape.json +0 -35
- package/dist/json-schema/svg-fill.json +0 -169
- package/dist/json-schema/svg-gradient-stop.json +0 -25
- package/dist/json-schema/svg-heart-shape.json +0 -28
- package/dist/json-schema/svg-line-shape.json +0 -35
- package/dist/json-schema/svg-linear-gradient-fill.json +0 -80
- package/dist/json-schema/svg-path-shape.json +0 -26
- package/dist/json-schema/svg-polygon-shape.json +0 -35
- package/dist/json-schema/svg-radial-gradient-fill.json +0 -66
- package/dist/json-schema/svg-rectangle-shape.json +0 -49
- package/dist/json-schema/svg-ring-shape.json +0 -35
- package/dist/json-schema/svg-shadow.json +0 -79
- package/dist/json-schema/svg-shape.json +0 -404
- package/dist/json-schema/svg-solid-fill.json +0 -40
- package/dist/json-schema/svg-star-shape.json +0 -42
- package/dist/json-schema/svg-stroke.json +0 -115
- package/dist/json-schema/svg-transform.json +0 -93
package/dist/zod/zod.gen.ts
CHANGED
|
@@ -788,6 +788,50 @@ export const cropCropSchema = z.object({
|
|
|
788
788
|
|
|
789
789
|
export const cropSchema = cropCropSchema;
|
|
790
790
|
|
|
791
|
+
/**
|
|
792
|
+
* Pass additional options to control how files are stored in Akamai NetStorage.
|
|
793
|
+
*/
|
|
794
|
+
export const akamaiNetStorageDestinationOptionsAkamaiNetStorageDestinationOptionsSchema =
|
|
795
|
+
z.object({
|
|
796
|
+
host: z.string(),
|
|
797
|
+
cpCode: z.string(),
|
|
798
|
+
path: z.optional(z.unknown()),
|
|
799
|
+
filename: z.optional(z.unknown()),
|
|
800
|
+
}).strict();
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Send videos and assets to [Akamai NetStorage](https://techdocs.akamai.com/netstorage-usage/docs). Send files to your NetStorage upload directory with a custom path and filename. Akamai credentials are required and added via the [dashboard](https://dashboard.shotstack.io/integrations/akamai-netstorage), not in the request.
|
|
804
|
+
*/
|
|
805
|
+
export const akamaiNetStorageDestinationAkamaiNetStorageDestinationSchema =
|
|
806
|
+
z.object({
|
|
807
|
+
provider: z.string().default("akamai-netstorage"),
|
|
808
|
+
options: z.optional(
|
|
809
|
+
akamaiNetStorageDestinationOptionsAkamaiNetStorageDestinationOptionsSchema,
|
|
810
|
+
),
|
|
811
|
+
}).strict();
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Pass additional options to control how files are stored in Azure Blob Storage.
|
|
815
|
+
*/
|
|
816
|
+
export const azureBlobStorageDestinationOptionsAzureBlobStorageDestinationOptionsSchema =
|
|
817
|
+
z.object({
|
|
818
|
+
accountName: z.string(),
|
|
819
|
+
container: z.string(),
|
|
820
|
+
prefix: z.optional(z.unknown()),
|
|
821
|
+
filename: z.optional(z.unknown()),
|
|
822
|
+
}).strict();
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Send videos and assets to [Azure Blob Storage](https://learn.microsoft.com/en-us/azure/storage/blobs/). Send files to any container with a custom prefix and filename. Azure credentials are required and added via the [dashboard](https://dashboard.shotstack.io/integrations/azure-blob-storage), not in the request.
|
|
826
|
+
*/
|
|
827
|
+
export const azureBlobStorageDestinationAzureBlobStorageDestinationSchema =
|
|
828
|
+
z.object({
|
|
829
|
+
provider: z.string().default("azure-blob-storage"),
|
|
830
|
+
options: z.optional(
|
|
831
|
+
azureBlobStorageDestinationOptionsAzureBlobStorageDestinationOptionsSchema,
|
|
832
|
+
),
|
|
833
|
+
}).strict();
|
|
834
|
+
|
|
791
835
|
/**
|
|
792
836
|
* Pass additional options to control how files are stored in Google Cloud Storage.
|
|
793
837
|
*/
|
|
@@ -1392,18 +1436,6 @@ export const richcaptionpropertiesRichCaptionActiveFontSchema = z.object({
|
|
|
1392
1436
|
export const richCaptionActiveFontSchema =
|
|
1393
1437
|
richcaptionpropertiesRichCaptionActiveFontSchema;
|
|
1394
1438
|
|
|
1395
|
-
/**
|
|
1396
|
-
* Font properties for rich captions. Defaults to Roboto.
|
|
1397
|
-
*/
|
|
1398
|
-
export const richcaptionpropertiesRichCaptionFontSchema = z.object({
|
|
1399
|
-
family: z.optional(z.string()).default("Roboto"),
|
|
1400
|
-
size: 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(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),
|
|
1401
|
-
weight: z.optional(z.unknown()).default("400"),
|
|
1402
|
-
color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffffff"),
|
|
1403
|
-
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),
|
|
1404
|
-
background: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
|
|
1405
|
-
}).strict();
|
|
1406
|
-
|
|
1407
1439
|
/**
|
|
1408
1440
|
* Word-level animation properties for caption effects.
|
|
1409
1441
|
*/
|
|
@@ -1595,7 +1627,7 @@ export const richcaptionassetRichCaptionAssetSchema = z.object({
|
|
|
1595
1627
|
type: z.enum(["rich-caption"]),
|
|
1596
1628
|
src: z.optional(z.string().min(1)),
|
|
1597
1629
|
words: z.optional(z.array(richcaptionpropertiesWordTimingSchema).max(100000)),
|
|
1598
|
-
font: z.optional(
|
|
1630
|
+
font: z.optional(richtextpropertiesRichTextFontSchema),
|
|
1599
1631
|
style: z.optional(richtextpropertiesRichTextStyleSchema),
|
|
1600
1632
|
stroke: z.optional(richtextpropertiesRichTextStrokeSchema),
|
|
1601
1633
|
shadow: z.optional(richtextpropertiesRichTextShadowSchema),
|
|
@@ -1926,387 +1958,23 @@ export const soundtrackSoundtrackSchema = z.object({
|
|
|
1926
1958
|
export const soundtrackSchema = soundtrackSoundtrackSchema;
|
|
1927
1959
|
|
|
1928
1960
|
/**
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
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.
|
|
1961
|
+
* The SvgAsset is used to create scalable vector graphic (SVG) assets using
|
|
1962
|
+
* raw SVG markup.
|
|
2013
1963
|
*
|
|
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`**
|
|
2227
1964
|
* ```json
|
|
2228
1965
|
* {
|
|
2229
1966
|
* "type": "svg",
|
|
2230
1967
|
* "src": "<svg width=\"100\" height=\"100\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#FF0000\"/></svg>"
|
|
2231
1968
|
* }
|
|
2232
1969
|
* ```
|
|
2233
|
-
* When using `src`, no other properties are allowed. The fill, stroke, and dimensions
|
|
2234
|
-
* are automatically extracted from the SVG markup.
|
|
2235
|
-
*
|
|
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
1970
|
*
|
|
2263
|
-
* See [W3C SVG 2 Specification](https://www.w3.org/TR/SVG2/) for
|
|
1971
|
+
* See [W3C SVG 2 Specification](https://www.w3.org/TR/SVG2/) for SVG markup syntax.
|
|
2264
1972
|
*
|
|
2265
1973
|
*/
|
|
2266
1974
|
export const svgassetSvgAssetSchema = z.object({
|
|
2267
1975
|
type: z.enum(["svg"]),
|
|
2268
|
-
src: z.
|
|
2269
|
-
|
|
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
|
-
});
|
|
1976
|
+
src: z.string().min(1).max(500000),
|
|
1977
|
+
}).strict();
|
|
2310
1978
|
|
|
2311
1979
|
export const svgAssetSchema = svgassetSvgAssetSchema;
|
|
2312
1980
|
|
package/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "SvgArrowShape",
|
|
3
|
-
"strict": true,
|
|
4
|
-
"schema": {
|
|
5
|
-
"description": "An arrow shape pointing to the right by default.\nUse transform rotation to change direction.\n",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"additionalProperties": false,
|
|
8
|
-
"properties": {
|
|
9
|
-
"type": {
|
|
10
|
-
"description": "The shape type - set to `arrow`.",
|
|
11
|
-
"type": "string",
|
|
12
|
-
"enum": [
|
|
13
|
-
"arrow"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"length": {
|
|
17
|
-
"description": "The total length of the arrow from tail to tip in pixels.",
|
|
18
|
-
"type": "number",
|
|
19
|
-
"minimum": 1,
|
|
20
|
-
"maximum": 4096
|
|
21
|
-
},
|
|
22
|
-
"headWidth": {
|
|
23
|
-
"description": "The width of the arrow head (the widest part) in pixels.",
|
|
24
|
-
"type": "number",
|
|
25
|
-
"minimum": 1,
|
|
26
|
-
"maximum": 1000
|
|
27
|
-
},
|
|
28
|
-
"headLength": {
|
|
29
|
-
"description": "The length of the arrow head portion in pixels.",
|
|
30
|
-
"type": "number",
|
|
31
|
-
"minimum": 1,
|
|
32
|
-
"maximum": 1000
|
|
33
|
-
},
|
|
34
|
-
"shaftWidth": {
|
|
35
|
-
"description": "The width of the arrow shaft (body) in pixels.",
|
|
36
|
-
"type": "number",
|
|
37
|
-
"minimum": 1,
|
|
38
|
-
"maximum": 1000
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"required": [
|
|
42
|
-
"type",
|
|
43
|
-
"length",
|
|
44
|
-
"headWidth",
|
|
45
|
-
"headLength",
|
|
46
|
-
"shaftWidth"
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "SvgCircleShape",
|
|
3
|
-
"strict": true,
|
|
4
|
-
"schema": {
|
|
5
|
-
"description": "A perfect circle shape defined by its radius.\nThe circle is centered at the shape's position.\n",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"additionalProperties": false,
|
|
8
|
-
"properties": {
|
|
9
|
-
"type": {
|
|
10
|
-
"description": "The shape type - set to `circle`.",
|
|
11
|
-
"type": "string",
|
|
12
|
-
"enum": [
|
|
13
|
-
"circle"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"radius": {
|
|
17
|
-
"description": "The radius of the circle in pixels.",
|
|
18
|
-
"type": "number",
|
|
19
|
-
"minimum": 1,
|
|
20
|
-
"maximum": 2048
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"required": [
|
|
24
|
-
"type",
|
|
25
|
-
"radius"
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "SvgCrossShape",
|
|
3
|
-
"strict": true,
|
|
4
|
-
"schema": {
|
|
5
|
-
"description": "A cross or plus shape with equal or different arm lengths.\nCan be styled as a plus sign (+) or a cross (x with rotation).\n",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"additionalProperties": false,
|
|
8
|
-
"properties": {
|
|
9
|
-
"type": {
|
|
10
|
-
"description": "The shape type - set to `cross`.",
|
|
11
|
-
"type": "string",
|
|
12
|
-
"enum": [
|
|
13
|
-
"cross"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"width": {
|
|
17
|
-
"description": "The total width of the cross in pixels.",
|
|
18
|
-
"type": "number",
|
|
19
|
-
"minimum": 1,
|
|
20
|
-
"maximum": 4096
|
|
21
|
-
},
|
|
22
|
-
"height": {
|
|
23
|
-
"description": "The total height of the cross in pixels.",
|
|
24
|
-
"type": "number",
|
|
25
|
-
"minimum": 1,
|
|
26
|
-
"maximum": 4096
|
|
27
|
-
},
|
|
28
|
-
"thickness": {
|
|
29
|
-
"description": "The thickness of the cross arms in pixels.",
|
|
30
|
-
"type": "number",
|
|
31
|
-
"minimum": 1,
|
|
32
|
-
"maximum": 500
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"required": [
|
|
36
|
-
"type",
|
|
37
|
-
"width",
|
|
38
|
-
"height",
|
|
39
|
-
"thickness"
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "SvgEllipseShape",
|
|
3
|
-
"strict": true,
|
|
4
|
-
"schema": {
|
|
5
|
-
"description": "An ellipse (oval) shape with separate horizontal and vertical radii.\nThe ellipse is centered at the shape's position.\n",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"additionalProperties": false,
|
|
8
|
-
"properties": {
|
|
9
|
-
"type": {
|
|
10
|
-
"description": "The shape type - set to `ellipse`.",
|
|
11
|
-
"type": "string",
|
|
12
|
-
"enum": [
|
|
13
|
-
"ellipse"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"radiusX": {
|
|
17
|
-
"description": "The horizontal radius (semi-major axis) in pixels.",
|
|
18
|
-
"type": "number",
|
|
19
|
-
"minimum": 1,
|
|
20
|
-
"maximum": 2048
|
|
21
|
-
},
|
|
22
|
-
"radiusY": {
|
|
23
|
-
"description": "The vertical radius (semi-minor axis) in pixels.",
|
|
24
|
-
"type": "number",
|
|
25
|
-
"minimum": 1,
|
|
26
|
-
"maximum": 2048
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"required": [
|
|
30
|
-
"type",
|
|
31
|
-
"radiusX",
|
|
32
|
-
"radiusY"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
}
|