import type { AgLink } from './shared/agLink'; import type { AgWidgetData, AgWidgetDataFormat } from './shared/agWidget'; /** * Object fit options controlling how the image fits within its container. * - `scale-down`: Scales down to fit, never scales up * - `contain`: Scales to fit entirely within container (may have letterboxing) * - `cover`: Scales to cover container (may crop) * - `fill`: Stretches to fill container (may distort) * - `none`: No scaling, original size */ export type AgObjectFit = 'scale-down' | 'contain' | 'cover' | 'fill' | 'none'; /** * Object position options controlling image alignment within its container. */ export type AgObjectPosition = 'center' | 'top' | 'top right' | 'right' | 'bottom right' | 'bottom' | 'bottom left' | 'left' | 'top left'; /** * Style configuration for the image widget display. */ export interface AgImageWidgetStyle { /** * URL of the image to display. * Can be absolute or relative URL, or data URI. * @example 'https://example.com/image.png', '/images/logo.svg' */ src?: string; /** * Link configuration for making the image clickable. */ link?: AgLink; /** * How the image should fit within its container. * @default 'contain' */ objectFit?: AgObjectFit; /** * Position of the image within its container. * Only applies when objectFit causes the image to not fill the container. * @default 'center' */ objectPosition?: AgObjectPosition; } /** * Format configuration for the image widget. * Controls the visual presentation of the image. */ export type AgImageWidgetFormat = AgWidgetDataFormat; export interface AgImageWidgetDataMapping { } /** * Complete configuration for an Image widget. * Displays an image with optional link and positioning controls. * Useful for adding logos, icons, or visual elements to Studio components. * * @example * const imageWidget: AgImageWidget = { * format: { * title: { text: 'Company Logo', enabled: false }, * style: { * url: '/images/logo.png', * objectFit: 'contain', * objectPosition: 'center', * link: { enabled: true, href: 'https://company.com', target: '_blank' } * } * } * }; */ export interface AgImageWidget extends AgWidgetData { /** * Widget type identifier. */ type: 'image'; }