import * as PIXI from "pixi.js"; import { z } from "zod"; import { AudioClipOptions, Clip, ClipOptions, HtmlTextClipOptions, ImageClipOptions, TextClipOptions, VideoClipOptions } from "../clip"; import { AdjustmentClipOptions } from "../clip/clips/adjustment/AdjustmentClip"; import { GifClipOptions } from "../clip/clips/gif/GifClip"; import { LottieClipOptions } from "../clip/clips/lottie/LottieClip"; import { ShapeClipOptions } from "../clip/clips/shape/ShapeClip"; import { SvgClipOptions } from "../clip/clips/svg/SvgClip"; import { Transition, TransitionOptions } from "../transition/Transition"; interface AddClipOptions { adjustLayout?: boolean; } type ClipOptionsUnion = ClipOptions | ImageClipOptions | SvgClipOptions | AdjustmentClipOptions | VideoClipOptions | TextClipOptions | AudioClipOptions | GifClipOptions | ShapeClipOptions | HtmlTextClipOptions | LottieClipOptions; /** * Zod schema for serialized timeline layers. */ export declare const LayerSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodOptional; visible: z.ZodOptional; muted: z.ZodOptional; volume: z.ZodOptional; clips: z.ZodArray; transitions: z.ZodArray, "many">; }, "strip", z.ZodTypeAny, { properties: [string, any][]; id: string; provider: string; startClipId: string; endClipId: string; inDuration: number; outDuration: number; transitionId: string; }, { properties: [string, any][]; id: string; provider: string; startClipId: string; endClipId: string; inDuration: number; outDuration: number; transitionId: string; }>, "many">; customData: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { id: string; transitions: { properties: [string, any][]; id: string; provider: string; startClipId: string; endClipId: string; inDuration: number; outDuration: number; transitionId: string; }[]; clips: any[]; name?: string | undefined; visible?: boolean | undefined; muted?: boolean | undefined; volume?: number | undefined; customData?: [string, unknown][] | undefined; }, { id: string; transitions: { properties: [string, any][]; id: string; provider: string; startClipId: string; endClipId: string; inDuration: number; outDuration: number; transitionId: string; }[]; clips: any[]; name?: string | undefined; visible?: boolean | undefined; muted?: boolean | undefined; volume?: number | undefined; customData?: [string, unknown][] | undefined; }>; /** * Represents a timeline layer that owns clips, transitions, and layer-level playback state. */ export declare class Layer { id: string; name: string; visible: boolean; muted: boolean; volume: number; clipsIds: string[]; clips: Record; transitions: Transition[]; container: PIXI.Container; protected customData?: Map; /** * Creates an empty layer and records its creation in the undo stack. */ constructor(); /** * Initializes the PIXI container for this layer and initializes all contained transitions and clips. * * @returns A promise that resolves after the layer is ready for rendering. */ init(): Promise; /** * Destroys the layer container and all owned clips and transitions. * * @returns Nothing. */ destroy(): void; addClip(clipOptions: Clip, addClipOptions?: AddClipOptions): Promise; addClip(clipOptions: ClipOptionsUnion, addClipOptions?: AddClipOptions): Promise; /** * Removes a clip and any transitions that depend on it. * * @param clipId Clip ID to remove. * @returns `true` if the clip was found and removed; otherwise `false`. */ removeClip(clipId: string): boolean; /** * Sets the layer volume multiplier. * * @param volume Layer volume multiplier. * @returns Nothing. */ setVolume(volume: number): void; /** * Returns the layer volume multiplier. * * @returns The layer volume. */ getVolume(): number; /** * Mutes or unmutes the layer. * * @param muted Whether the layer should be muted. * @returns Nothing. */ setMuted(muted: boolean): void; /** * Indicates whether the layer is muted. * * @returns `true` if the layer is muted; otherwise `false`. */ isMuted(): boolean; /** * Shows or hides the entire layer container. * * @param visible Whether the layer should be visible. * @returns Nothing. */ setVisibility(visible: boolean): void; /** * Returns whether the layer is currently visible. * * @returns `true` if the layer is visible; otherwise `false`. */ getVisibility(): boolean; /** * Stores custom metadata on the layer. * * @param key Metadata key to write. * @param value Metadata value to store. * @param overwrite When `false`, preserves existing values and rejects duplicate keys. * @returns `true` if the value was stored; otherwise `false`. */ setCustomData(key: string, value: unknown, overwrite?: boolean): boolean; /** * Returns a custom metadata value stored on the layer. * * @param key Metadata key to read. * @returns The stored value, or `undefined` if the key is not present. */ getCustomData(key: string): unknown; /** * Checks whether a custom metadata entry exists on the layer. * * @param key Metadata key to check. * @returns `true` if the key exists; otherwise `false`. */ hasCustomData(key: string): boolean; /** * Removes all custom metadata entries from the layer. * * @returns Nothing. */ clearAllCustomData(): void; /** * Replaces all custom metadata entries on the layer. * * @param data Metadata map to store. * @returns Nothing. */ setAllCustomData(data: Map): void; /** * Returns a copy of the layer's custom metadata. * * @returns A new metadata map, or `undefined` if no custom metadata has been set. */ getAllCustomData(): Map | undefined; /** * Sets the display name of the layer. * * @param name Layer name to assign. * @returns Nothing. */ setName(name: string): void; /** * Returns the display name of the layer. * * @returns The layer name. */ getName(): string; /** * Moves a clip from this layer to another layer. * * @param clipId Clip ID to move. * @param newLayerId Destination layer ID. * @returns Nothing. */ moveClipToLayer(clipId: string, newLayerId: string): void; /** * Splits a clip into two clips at the supplied timeline time. * * @param clipId Clip ID to split. * @param time Timeline time, in seconds, where the split should happen. * @returns A promise that resolves to the newly created right-side clip, or `null` if the split is invalid. */ splitClip(clipId: string, time: number): Promise; /** * Adds a transition between clips on this layer. * * @param data Transition instance or transition constructor options. * @returns The created transition instance ID. */ addTransition(data: TransitionOptions | Transition): string; removeTransition(id: string): void; /** * Removes all transitions that were created from the specified transition definition ID. * * @param transitionId Transition definition ID to remove. * @returns Nothing. */ removeAllTransitionsByTransitionId(transitionId: string): void; /** * Returns all transitions on this layer. * * @returns The transition list. */ getTransitions(): Transition[]; /** * Returns a transition by its instance ID. * * @param id Transition instance ID to look up. * @returns The matching transition, or `null` if not found. */ getTransitionById(id: string): Transition | null; /** * Returns the right-most occupied time on the layer. * * @returns The layer duration in timeline seconds. */ getDuration(): number; /** * Checks whether the supplied time range is free of clip overlap on this layer. * * @param startTime Range start time in seconds. * @param endTime Range end time in seconds. * @returns `true` if the range is empty on this layer; otherwise `false`. */ hasEmptySpace(startTime: number, endTime: number): boolean; /** * Returns a clip by its ID. * * @param clipId Clip ID to look up. * @returns The matching clip, or `undefined` if not found. */ getClipById(clipId: string): Clip | undefined; /** * Returns the clip map owned by this layer. * * @returns The clip record keyed by clip ID. */ getClips(): Record>>; /** * Returns the clip IDs in layer order. * * @returns The ordered clip ID list. */ getClipIds(): string[]; /** * Returns the earliest available start time at or after the requested range that avoids overlaps. * * @param startTime Desired start time in seconds. * @param endTime Desired end time in seconds. * @returns The next available start time in seconds. */ getNextEmptySpace(startTime: number, endTime: number): number; /** * Resolves negative positions and overlapping clips by moving clips to the next valid slot. * * @returns `true` if any clip positions changed; otherwise `false`. */ adjustClipsLayout(): boolean; /** * Sets the renderer z-index for this layer container. * * @param zIndex Layer z-index. * @returns Nothing. */ setZIndex(zIndex: number): void; /** * Lifecycle hook called when playback starts. * * @param currentTime Current timeline time, in seconds. * @returns A promise that resolves after all owned clips and transitions have handled playback start. */ onPlay(currentTime: number): Promise; /** * Lifecycle hook called when playback pauses. * * @param currentTime Current timeline time, in seconds. * @returns Nothing. */ onPause(currentTime: number): void; /** * Lifecycle hook called when the render size changes. * * @param width New render width in pixels. * @param height New render height in pixels. * @returns Nothing. */ onResize(width: number, height: number): void; /** * Updates all clips and transitions owned by this layer for the current time. * * @param currentTime Current timeline time, in seconds. * @returns Nothing. */ update(currentTime: number): void; /** * Renders all clips and transitions owned by this layer for the current frame. * * @param currentTime Current timeline time, in seconds. * @returns The PIXI container used to display the layer. */ render(currentTime: number): PIXI.Container; /** * Performs post-render work for all clips and transitions on this layer. * * @param currentTime Current timeline time, in seconds. * @returns Nothing. */ postRender(currentTime: number): void; /** * Indicates whether the layer contains any clips. * * @returns `true` if the layer has no clips; otherwise `false`. */ isEmpty(): boolean; private createClip; /** * Serializes the layer, including clips, transitions, and custom data. * * @returns The serialized layer payload. */ serialize(): { id: string; transitions: { properties: [string, any][]; id: string; provider: string; startClipId: string; endClipId: string; inDuration: number; outDuration: number; transitionId: string; }[]; clips: any[]; name?: string | undefined; visible?: boolean | undefined; muted?: boolean | undefined; volume?: number | undefined; customData?: [string, unknown][] | undefined; }; static _deserializeClip(clipData: any): Clip | null; /** * Creates a layer from serialized data. * * @param data Serialized layer payload. * @returns The deserialized layer. */ static deserialize(data: object): Layer; } export {};