import { IClip, ITransitionInfo } from './clips'; interface BaseClipJSON { id?: string; effects?: Array<{ id: string; key: string; startTime: number; duration: number; targets?: number[]; }>; src: string; display: { from: number; to: number; }; playbackRate: number; duration: number; left: number; top: number; width: number; height: number; angle: number; zIndex: number; opacity: number; flip: 'horizontal' | 'vertical' | null; trim?: { from: number; to: number; }; transition?: ITransitionInfo; style?: any; animation?: { keyFrames: Record>; opts: { duration: number; delay?: number; iterCount?: number; }; }; main?: boolean; } export interface VideoJSON extends BaseClipJSON { type: 'Video'; audio?: boolean; volume?: number; } export interface AudioJSON extends BaseClipJSON { type: 'Audio'; loop?: boolean; volume?: number; } export interface ImageJSON extends BaseClipJSON { type: 'Image'; } export interface TextStyleJSON { fontSize?: number; fontFamily?: string; fontWeight?: string | number; fontStyle?: string; color?: string | number | { type: 'gradient'; x0: number; y0: number; x1: number; y1: number; colors: Array<{ ratio: number; color: string | number; }>; }; align?: 'left' | 'center' | 'right'; fontUrl?: string; stroke?: { color: string | number; width: number; join?: 'miter' | 'round' | 'bevel'; cap?: 'butt' | 'round' | 'square'; miterLimit?: number; }; shadow?: { color: string | number; alpha: number; blur: number; distance: number; angle: number; }; wordWrap?: boolean; wordWrapWidth?: number; lineHeight?: number; letterSpacing?: number; textCase?: 'none' | 'uppercase' | 'lowercase' | 'title'; verticalAlign?: 'top' | 'center' | 'bottom'; wordsPerLine?: 'single' | 'multiple'; } export interface TextJSON extends BaseClipJSON { type: 'Text'; text: string; style?: TextStyleJSON; } export interface CaptionColorsJSON { appeared?: string; active?: string; activeFill?: string; background?: string; keyword?: string; } export interface CaptionPositioningJSON { bottomOffset?: number; videoWidth?: number; videoHeight?: number; } export interface CaptionDataJSON { words?: Array<{ text: string; from: number; to: number; isKeyWord: boolean; paragraphIndex?: number; }>; colors?: CaptionColorsJSON; preserveKeywordColor?: boolean; positioning?: CaptionPositioningJSON; } export interface CaptionJSON extends BaseClipJSON { type: 'Caption'; text: string; style?: TextStyleJSON; caption?: CaptionDataJSON; bottomOffset?: number; words?: Array<{ text: string; from: number; to: number; isKeyWord: boolean; paragraphIndex?: number; }>; appearedColor?: string; activeColor?: string; activeFillColor?: string; backgroundColor?: string; isKeyWordColor?: string; preservedColorKeyWord?: boolean; videoWidth?: number; videoHeight?: number; fontUrl?: string; mediaId?: string; wordsPerLine?: 'single' | 'multiple'; } export interface EffectJSON extends BaseClipJSON { type: 'Effect'; effect: { id: string; key: string; name: string; }; } export interface TransitionJSON extends BaseClipJSON { type: 'Transition'; transitionEffect: { id: string; key: string; name: string; }; fromClipId: string | null; toClipId: string | null; } export interface PlaceholderJSON extends BaseClipJSON { type: 'Placeholder'; } export interface GlobalTransitionJSON { key: string; duration: number; clips: string[]; } export type ClipJSON = VideoJSON | AudioJSON | ImageJSON | TextJSON | CaptionJSON | EffectJSON | TransitionJSON | PlaceholderJSON; export interface StudioTrackJSON { id: string; name: string; type: string; clipIds: string[]; } export interface ProjectJSON { tracks?: StudioTrackJSON[]; clips: ClipJSON[]; transition?: GlobalTransitionJSON[]; transitions?: GlobalTransitionJSON[]; globalEffects?: Array<{ id: string; key: string; startTime: number; duration: number; }>; settings?: { width?: number; height?: number; fps?: number; bgColor?: string; videoCodec?: string; bitrate?: number; audio?: boolean; metaDataTags?: Record; }; } /** * Serialize a clip to JSON format * @param clip The clip to serialize * @param main Whether this is the main clip (for Compositor) */ export declare function clipToJSON(clip: IClip, main?: boolean): ClipJSON; /** * Deserialize JSON to a clip instance * Uses fromObject static method if available (fabric.js pattern), otherwise falls back to manual construction */ export declare function jsonToClip(json: ClipJSON): Promise; export {};