|
| 1 | +export type GradientStop = { |
| 2 | + /** The offset of the gradient stop, specified as a percentage (e.g., '0%', '50%', '100%') or a number between 0 and 1 (e.g., 0, 0.5, 1). */ |
| 3 | + offset: string | number |
| 4 | + /** The color of the gradient stop, specified as a valid CSS color string (e.g., '#FF0000', 'rgb(255, 0, 0)', 'red'). */ |
| 5 | + color: string |
| 6 | + /** The opacity of the gradient stop, specified as a number between 0 and 1 (e.g., 0, 0.5, 1). This is optional and defaults to 1 if not provided. */ |
| 7 | + opacity?: number | undefined |
| 8 | +} |
| 9 | + |
| 10 | +export type LinearGradient = { |
| 11 | + /** |
| 12 | + * The `id` of the gradient, which is used to reference the gradient in the `fill` attribute of the icon's svg element. |
| 13 | + * This must be a unique value to prevent conflicts with other elements on the page. |
| 14 | + */ |
| 15 | + id: string |
| 16 | + /** The x-coordinate of the start of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 17 | + x1?: number | string | undefined |
| 18 | + /** The x-coordinate of the end of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 19 | + x2?: number | string | undefined |
| 20 | + /** The y-coordinate of the start of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 21 | + y1?: number | string | undefined |
| 22 | + /** The y-coordinate of the end of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 23 | + y2?: number | string | undefined |
| 24 | + stops: GradientStop[] |
| 25 | +} |
| 26 | + |
| 27 | +export type RadialGradient = { |
| 28 | + /** |
| 29 | + * The `id` of the gradient, which is used to reference the gradient in the `fill` attribute of the icon's svg element. |
| 30 | + * This must be a unique value to prevent conflicts with other elements on the page. |
| 31 | + */ |
| 32 | + id: string |
| 33 | + /** The x-coordinate of the center of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 34 | + cx?: number | string | undefined |
| 35 | + /** The y-coordinate of the center of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 36 | + cy?: number | string | undefined |
| 37 | + /** The radius of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 38 | + r?: number | string | undefined |
| 39 | + /** The x-coordinate of the focal point of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 40 | + fx?: number | string | undefined |
| 41 | + /** The y-coordinate of the focal point of the gradient. Can be a number or a string (e.g., '0%', '50%', '100%'). */ |
| 42 | + fy?: number | string | undefined |
| 43 | + stops: GradientStop[] |
| 44 | +} |
| 45 | + |
| 46 | +export type Gradient<T extends 'linear' | 'radial'> = T extends 'linear' |
| 47 | + ? { type: 'linear' } & LinearGradient |
| 48 | + : T extends 'radial' |
| 49 | + ? { type: 'radial' } & RadialGradient |
| 50 | + : never |
0 commit comments