import type { DefinePluginOpts, UIPluginOptions, Uppy } from '@uppy/core'; import { UIPlugin } from '@uppy/core'; import type { Body, LocalUppyFile, Meta, UppyFile } from '@uppy/utils'; declare module '@uppy/core' { interface UppyEventMap { 'thumbnail:all-generated': () => void; 'thumbnail:generated': (file: UppyFile, preview: string) => void; 'thumbnail:error': (file: UppyFile, error: Error) => void; 'thumbnail:request': (file: UppyFile) => void; 'thumbnail:cancel': (file: UppyFile) => void; } interface PluginTypeRegistry { ThumbnailGenerator: ThumbnailGenerator; } } export interface ThumbnailGeneratorOptions extends UIPluginOptions { thumbnailWidth?: number | null; thumbnailHeight?: number | null; thumbnailType?: string; waitForThumbnailsBeforeUpload?: boolean; lazy?: boolean; } declare const defaultOptions: { thumbnailWidth: null; thumbnailHeight: null; thumbnailType: string; waitForThumbnailsBeforeUpload: boolean; lazy: boolean; }; type Opts = DefinePluginOpts; /** * The Thumbnail Generator plugin */ export default class ThumbnailGenerator extends UIPlugin { static VERSION: string; queue: string[]; queueProcessing: boolean; defaultThumbnailDimension: number; thumbnailType: string; constructor(uppy: Uppy, opts?: ThumbnailGeneratorOptions); createThumbnail(file: LocalUppyFile, targetWidth: number | null, targetHeight: number | null): Promise; /** * Get the new calculated dimensions for the given image and a target width * or height. If both width and height are given, only width is taken into * account. If neither width nor height are given, the default dimension * is used. */ getProportionalDimensions(img: HTMLImageElement, width: number | null, height: number | null, deg: number): { width: number; height: number; }; /** * Resize an image to the target `width` and `height`. * * Returns a Canvas with the resized image on it. */ resizeImage(image: HTMLCanvasElement, targetWidth: number, targetHeight: number): HTMLCanvasElement; /** * Set the preview URL for a file. */ setPreviewURL(fileID: string, preview: string): void; addToQueue(fileID: string): void; processQueue(): Promise; requestThumbnail(file: UppyFile): Promise; onFileAdded: (file: UppyFile) => void; /** * Cancel a lazy request for a thumbnail if the thumbnail has not yet been generated. */ onCancelRequest: (file: UppyFile) => void; /** * Clean up the thumbnail for a file. Cancel lazy requests and free the thumbnail URL. */ onFileRemoved: (file: UppyFile) => void; onRestored: () => void; onAllFilesRemoved: () => void; waitUntilAllProcessed: (fileIDs: string[]) => Promise; install(): void; uninstall(): void; } declare module '@uppy/core' { interface PluginTypeRegistry { ThumbnailGenerator: ThumbnailGenerator; } } export {}; //# sourceMappingURL=index.d.ts.map