import * as _angular_core from '@angular/core'; import { ElementRef } from '@angular/core'; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** Crop rectangle in source-image (natural) pixel coordinates. */ interface WrCropRect { readonly x: number; readonly y: number; readonly width: number; readonly height: number; } /** Possible drag handles on the crop overlay. */ type WrCropHandle = 'move' | 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw'; /** Supported output MIME types for {@link WrImageCropper.toBlob}. */ type WrImageOutputType = 'image/png' | 'image/jpeg' | 'image/webp'; interface RectPx { x: number; y: number; w: number; h: number; } /** * Image crop UI. Pass `[src]` (URL, `File`, or `Blob`); the user drags * the crop window or any of its eight handles. Optionally lock the crop * to a fixed `[aspectRatio]`. * * `(cropped)` fires after each drag end with a freshly-rendered `Blob` * of the cropped region. For one-off reads use `toBlob()` / `toDataUrl()`. * * @example * ```html * * ``` * * @see https://ngwr.dev/components/image-cropper */ declare class WrImageCropper { /** Image source — URL string, `File`, or `Blob`. */ readonly src: _angular_core.InputSignal; /** Aspect ratio (width / height). `null` = free. @default null */ readonly aspectRatio: _angular_core.InputSignal; /** Minimum crop width in display pixels. @default 32 */ readonly minWidth: _angular_core.InputSignalWithTransform; /** Minimum crop height in display pixels. @default 32 */ readonly minHeight: _angular_core.InputSignalWithTransform; /** Default output type for `(cropped)`. @default 'image/png' */ readonly outputType: _angular_core.InputSignal; /** JPEG / WebP quality for `(cropped)` in [0, 1]. @default 0.92 */ readonly outputQuality: _angular_core.InputSignal; /** Emits a Blob after each drag end. */ readonly cropped: _angular_core.OutputEmitterRef; protected readonly imgEl: _angular_core.Signal>; /** Resolved object URL for `src` (so File / Blob render in ``). */ protected readonly objectUrl: _angular_core.WritableSignal; /** Previous object URL we created — kept off-signal so the resolve * effect doesn't depend on its own writes (which would loop). */ private previousObjectUrl; /** Natural (source) pixel dimensions. */ protected readonly natural: _angular_core.WritableSignal<{ w: number; h: number; }>; /** Display (rendered) pixel dimensions. */ protected readonly display: _angular_core.WritableSignal<{ w: number; h: number; }>; /** Crop rect in display coordinates. */ protected readonly cropDisplay: _angular_core.WritableSignal; /** Currently active drag handle. */ private active; private startPointer; private startRect; private readonly destroyRef; /** Resolved crop rect in natural (source) pixel coordinates. */ readonly cropRect: _angular_core.Signal; constructor(); protected onImageLoad(): void; /** Compute a sensible initial crop — centered, respecting aspectRatio. */ private initialCrop; protected readonly handles: readonly WrCropHandle[]; protected onPointerDown(handle: WrCropHandle, event: PointerEvent): void; protected onPointerMove(event: PointerEvent): void; protected onPointerUp(event: PointerEvent): void; private applyMove; private applyResize; /** Render the current crop as a Blob. */ toBlob(type?: WrImageOutputType, quality?: number): Promise; /** Render the current crop as a data URL. */ toDataUrl(type?: WrImageOutputType, quality?: number): string; /** Re-emit the crop without waiting for a drag (e.g. after a programmatic change). */ refresh(): Promise; private toCanvas; private emitCropped; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } export { WrImageCropper }; export type { WrCropHandle, WrCropRect, WrImageOutputType };