import * as _angular_core from '@angular/core'; import { EnvironmentProviders, OnDestroy, ElementRef, OnInit } from '@angular/core'; import { GlobalConfig } from 'ngx-toastr'; import { MatDialogRef } from '@angular/material/dialog'; import { Observable } from 'rxjs'; import * as angular_material_image_uploader from 'angular-material-image-uploader'; import { CdkDragDrop } from '@angular/cdk/drag-drop'; import { ImageCropperComponent, ImageTransform, ImageCroppedEvent } from 'ngx-image-cropper'; /** * Registers everything the uploader needs: Material animations, HttpClient (for uploads) * and ngx-toastr. Add it to your application's providers: * * bootstrapApplication(App, { providers: [provideAngularMaterialImageUploader()] }); * * Skip it and register those three yourself if your app already provides them. */ declare function provideAngularMaterialImageUploader(toastr?: Partial): EnvironmentProviders; type AspectRatioKey = 'free' | '1:1' | '4:3' | '3:2' | '16:9' | '9:16'; type OutputFormat = 'png' | 'jpeg' | 'webp'; interface AspectRatioOption { key: AspectRatioKey; label: string; value: number | null; } declare const ASPECT_RATIOS: AspectRatioOption[]; declare const OUTPUT_FORMATS: { value: OutputFormat; label: string; mime: string; lossy: boolean; }[]; /** * Everything the uploader can be tuned with. Pass a partial object to * or edit DEFAULT_UPLOADER_CONFIG below. */ interface UploaderConfig { /** Allow picking / dropping / pasting several images at once. */ multiple: boolean; /** Upper bound on items in the list (only enforced when `multiple` is true). */ maxFiles: number; /** Per-file size limit in megabytes. */ maxFileSizeMB: number; /** Accepted image subtypes (the part after "image/"). */ allowedTypes: string[]; /** Open the cropper for every picked image before it is added to the list. */ cropBeforeAdd: boolean; /** Show a "Use original" button in the cropper so a file can skip cropping. */ allowSkipCrop: boolean; /** Aspect ratio the cropper starts with. */ defaultAspectRatio: AspectRatioKey; /** Format the cropped file is exported in. */ outputFormat: OutputFormat; /** Quality (1-100) for lossy output formats. */ outputQuality: number; /** Downscale cropped output to this width in px. 0 keeps the original scale. */ resizeToWidth: number; /** Start uploading as soon as an image is added. */ autoUpload: boolean; /** Allow drag-and-drop reordering of the list. */ allowReorder: boolean; /** Accept images pasted from the clipboard (Ctrl/Cmd+V anywhere on the page). */ allowPaste: boolean; /** * Multipart upload endpoint. The file is POSTed as form-data (fields: file, originalName, cropped) * with real progress events. Leave empty to simulate uploads in the UI. */ uploadUrl: string; } declare const DEFAULT_UPLOADER_CONFIG: UploaderConfig; type UploadStatus = 'ready' | 'uploading' | 'done' | 'error'; interface UploadItem { id: string; name: string; type: string; size: number; width: number; height: number; /** The file exactly as the user picked it (kept so the image can be re-cropped). */ originalFile: File; /** The file that will be uploaded: cropped output, or the original if cropping was skipped. */ file: File; /** Data URL used for thumbnails and previews. */ previewUrl: string; cropped: boolean; status: UploadStatus; progress: number; error?: string; addedAt: Date; } /** What the cropper dialog returns for each image in a batch. */ interface CropResult { originalFile: File; file: File; dataUrl: string; width: number; height: number; cropped: boolean; } declare class AlertService { private toastr; showSuccess(message: string, title?: string): void; showError(message: string, title?: string): void; showInfo(message: string, title?: string): void; showWarning(message: string, title?: string): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } interface ConfirmDialogData { /** Plain-text question or notice. Rendered as text, never as HTML. */ message: string; /** Optional item name shown on its own line (for example a file name). */ name?: string; confirmYes?: string; confirmNo: string; } declare class MatConfirmDialogComponent { readonly data: ConfirmDialogData; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare class DialogService { private dialog; /** Yes/No question. `name` (for example a file name) is shown as plain text under the message. */ openConfirmDialog(message: string, name?: string): MatDialogRef; popup(message: string): MatDialogRef; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } declare class ImageUtilService { private counter; uid(): string; fileToDataUrl(file: File): Promise; getImageDimensions(dataUrl: string): Promise<{ width: number; height: number; }>; dataUrlToBlob(dataUrl: string): Blob; dataUrlToFile(dataUrl: string, name: string): File; /** Approximate decoded byte size of a base64 data URL without decoding it. */ estimateDataUrlBytes(dataUrl: string): number; replaceExtension(name: string, format: OutputFormat): string; mimeForFormat(format: OutputFormat): string; formatBytes(bytes: number): string; download(file: Blob, name: string): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } /** * Uploads a single item and reports progress as 0-100. * * When `uploadUrl` is set the file is POSTed as multipart/form-data * (field name "file") with real progress events. When it is empty the upload is * simulated so the UI can be exercised without a backend. */ declare class UploadService { private readonly http; upload(item: UploadItem, uploadUrl?: string): Observable; private uploadToServer; private simulate; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } declare class ImageUploaderComponent implements OnDestroy { /** Override any subset of the defaults from the parent: */ set config(value: Partial | null | undefined); get config(): Partial; /** @deprecated v1 name for `config.allowedTypes`. */ set allowImageType(value: string[] | null | undefined); /** @deprecated v1 name for `config.maxFileSizeMB`. */ set sizeLimit(value: number | null | undefined); /** @deprecated v1 name for `config.cropBeforeAdd`. */ set Iscrop(value: boolean | null | undefined); /** Show the gear icon that opens the in-page settings panel. */ readonly showSettingsButton: _angular_core.InputSignal; /** Emits the current list whenever an image is added, edited, reordered, uploaded, or removed. */ readonly imageDetails: _angular_core.OutputEmitterRef; /** Emits an item when its upload finishes successfully. */ readonly uploadComplete: _angular_core.OutputEmitterRef; uploadInput?: ElementRef; private readonly dialog; private readonly alertService; private readonly dialogService; private readonly imageUtil; private readonly uploadService; /** Settings are edited through ngModel, so a plain object is enough here. */ cfg: UploaderConfig; readonly items: _angular_core.WritableSignal; readonly isDragOver: _angular_core.WritableSignal; readonly showSettings: _angular_core.WritableSignal; readonly busy: _angular_core.WritableSignal; readonly totalSize: _angular_core.Signal; readonly readyItems: _angular_core.Signal; readonly uploadingCount: _angular_core.Signal; readonly doneCount: _angular_core.Signal; readonly aspectRatios: angular_material_image_uploader.AspectRatioOption[]; readonly outputFormats: { value: angular_material_image_uploader.OutputFormat; label: string; mime: string; lossy: boolean; }[]; private uploads; constructor(); ngOnDestroy(): void; get acceptAttr(): string; get allowedTypesLabel(): string; get remainingSlots(): number; get canAddMore(): boolean; /** Re-emit the list after an item was mutated in place so the view refreshes. */ private touch; onFilesSelected(event: Event): void; onDragOver(event: DragEvent): void; onDragLeave(event: DragEvent): void; onDrop(event: DragEvent): void; onPaste(event: ClipboardEvent): void; private handleFiles; private validate; private openCropper; editItem(item: UploadItem): void; private addResult; private addUncropped; preview(item: UploadItem): void; download(item: UploadItem): void; remove(item: UploadItem): void; clearAll(): void; reorder(event: CdkDragDrop): void; upload(item: UploadItem): void; uploadAll(): void; cancelUpload(item: UploadItem): void; onMultipleChanged(): void; formatBytes(bytes: number): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } interface CropDialogData { files: File[]; config: UploaderConfig; } interface CropDialogResult { event: 'done' | 'cancel'; results: CropResult[]; } interface Size { width: number; height: number; } declare class NgImageCropperComponent implements OnInit { cropperCmp?: ImageCropperComponent; private readonly alertService; private readonly imageUtil; readonly dialogRef: MatDialogRef; readonly data: CropDialogData; readonly aspectRatios: angular_material_image_uploader.AspectRatioOption[]; readonly outputFormats: { value: OutputFormat; label: string; mime: string; lossy: boolean; }[]; readonly queue: _angular_core.WritableSignal; readonly index: _angular_core.WritableSignal; readonly thumbs: _angular_core.WritableSignal; readonly currentFile: _angular_core.WritableSignal; readonly originalSize: _angular_core.WritableSignal; private results; private currentDataUrl; readonly loading: _angular_core.WritableSignal; readonly aspectKey: _angular_core.WritableSignal; readonly maintainAspectRatio: _angular_core.WritableSignal; readonly aspectRatio: _angular_core.WritableSignal; roundCropper: boolean; readonly canvasRotation: _angular_core.WritableSignal; readonly transform: _angular_core.WritableSignal; readonly zoom: _angular_core.WritableSignal; format: OutputFormat; quality: number; resizeToWidth: number; readonly croppedImage: _angular_core.WritableSignal; readonly croppedWidth: _angular_core.WritableSignal; readonly croppedHeight: _angular_core.WritableSignal; readonly croppedBytes: _angular_core.WritableSignal; readonly total: _angular_core.Signal; readonly isBatch: _angular_core.Signal; readonly isLast: _angular_core.Signal; readonly zoomPercent: _angular_core.Signal; readonly currentName: _angular_core.Signal; readonly currentSize: _angular_core.Signal; get isLossy(): boolean; get canSkip(): boolean; ngOnInit(): void; private loadCurrent; private advance; cropAndNext(): void; useOriginal(): void; removeFromBatch(): void; cancel(): void; imageCropped(event: ImageCroppedEvent): void; cropperReady(): void; loadImageFailed(): void; setAspect(key: AspectRatioKey): void; rotate(direction: number): void; flip(axis: 'h' | 'v'): void; setZoom(value: number | null): void; zoomBy(delta: number): void; resetAdjustments(): void; resetCropArea(): void; formatBytes(bytes: number): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } interface PreviewDialogData { items: UploadItem[]; index: number; } interface PreviewDialogResult { action: 'edit'; item: UploadItem; } declare class ImagePreviewDialogComponent { private readonly imageUtil; readonly dialogRef: MatDialogRef; readonly data: PreviewDialogData; index: number; get item(): UploadItem; get hasPrev(): boolean; get hasNext(): boolean; prev(): void; next(): void; onKey(event: KeyboardEvent): void; download(): void; edit(): void; formatBytes(bytes: number): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } export { ASPECT_RATIOS, AlertService, DEFAULT_UPLOADER_CONFIG, DialogService, ImagePreviewDialogComponent, ImageUploaderComponent, ImageUtilService, MatConfirmDialogComponent, NgImageCropperComponent, OUTPUT_FORMATS, UploadService, provideAngularMaterialImageUploader }; export type { AspectRatioKey, AspectRatioOption, ConfirmDialogData, CropDialogData, CropDialogResult, CropResult, OutputFormat, PreviewDialogData, PreviewDialogResult, UploadItem, UploadStatus, UploaderConfig };