import { ReactElement } from 'react'; export interface EmbedDefinition { /** Unique identifier for this embed type */ id: string; /** Display name for slash menu */ label: string; /** Icon component for slash menu */ icon: ReactElement; /** Placeholder text for URL input */ placeholder: string; /** Error message for invalid URLs */ invalidUrlMessage: string; /** Test if URL matches this embed type */ matcher: (url: string) => boolean; /** Convert URL to embeddable format */ convertUrl: (url: string) => string; /** Optional custom renderer props */ renderProps?: { title?: (url: string) => string; /** Dynamic height based on URL (e.g., Spotify track vs album) */ height?: (url: string) => number; allowFullscreen?: boolean; /** Custom iframe allow attribute (e.g., "encrypted-media" for Spotify) */ allow?: string; sandbox?: string; referrerPolicy?: 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin'; }; } export type EmbedType = string | null; /** * Configuration for creating an embed provider via the factory function. * This provides a declarative way to define providers with minimal boilerplate. */ export interface EmbedProviderConfig { /** Unique identifier for this embed type */ id: string; /** Display name for slash menu */ label: string; /** Icon component for slash menu */ icon: ReactElement; /** Regex pattern to match URLs for this embed type */ regex: RegExp; /** Build the embed URL from regex match groups */ buildEmbedUrl: (match: RegExpMatchArray, cleanedUrl: string) => string; /** Placeholder text for URL input (defaults to "Paste a {label} link...") */ placeholder?: string; /** Error message for invalid URLs (defaults to "Please enter a valid {label} URL") */ invalidUrlMessage?: string; /** Custom title builder (defaults to "{label} Embed") */ buildTitle?: (url: string) => string; /** Additional render props */ renderProps?: Partial; }