From 82981988c23bff355c777f2f45809b75a5612148 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Thu, 8 May 2025 16:26:39 +1200 Subject: [PATCH 1/2] feat: fill out types more --- types/index.d.ts | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index b9601014..6d642749 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -149,7 +149,39 @@ export interface CropperResult { } export declare const Cropper: DefineComponent< - any, + { + src?: string; + backgroundClass?: string; + foregroundClass?: string; + imageRestriction?: 'fill-area' | 'fit-area' | 'stencil' | 'none'; + defaultBoundaries?: 'fill'; + defaultPosition?: Limits; + defaultVisibleArea?: Coordinates; + defaultSize?: Size | ((size: { visibleArea : VisibleArea , imageSize: ImageSize }) => Size); + stencilSize?: Size | ((size: { boundaries: Boundaries }) => Size); + stencilProps?: { + lines?: unknown; + handlers?: unknown; + movable?: boolean; + resizable?: boolean; + scalable?: boolean; + aspectRatio?: number; + previewClass?: string; + minAspectRatio?: number; + maxAspectRatio?: number; + handlerComponent?: unknown; + handlersClasses?: Record; + }; + stencilComponent?: string; + canvas?: boolean | SizeRestrictions; + debounce?: boolean; + transitions?: boolean; + minWidth?: number; + minHeight?: number; + priority?: 'visibleArea'; + sizeRestrictionsAlgorithm?: 'pixelsRestriction'; + defaultTransforms?: unknown; + }, { getResult: () => CropperResult; setCoordinates: (transform: Transform | Transform[]) => void; @@ -159,7 +191,13 @@ export declare const Cropper: DefineComponent< rotate: (angle: number) => void; flip: (horizontal: boolean, vertical?: boolean) => void; reset: () => void; - } + }, + {imageSize: ImageSize, sizeRestrictions: SizeRestrictions; coordinates: Coordinates}, + {}, + {}, + {}, + {}, + {ready: () => void; change: (event: CropperResult) => void; error: () => void;} >; export declare const PreviewResult: DefineComponent; From 15c724cc8171b6d0469c210a5f854549845bf6f0 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 9 May 2025 13:11:57 +1200 Subject: [PATCH 2/2] refactor: use tabs --- types/index.d.ts | 86 ++++++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 6d642749..e527ebcd 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -149,39 +149,39 @@ export interface CropperResult { } export declare const Cropper: DefineComponent< - { - src?: string; - backgroundClass?: string; - foregroundClass?: string; - imageRestriction?: 'fill-area' | 'fit-area' | 'stencil' | 'none'; - defaultBoundaries?: 'fill'; - defaultPosition?: Limits; - defaultVisibleArea?: Coordinates; - defaultSize?: Size | ((size: { visibleArea : VisibleArea , imageSize: ImageSize }) => Size); - stencilSize?: Size | ((size: { boundaries: Boundaries }) => Size); - stencilProps?: { - lines?: unknown; - handlers?: unknown; - movable?: boolean; - resizable?: boolean; - scalable?: boolean; - aspectRatio?: number; - previewClass?: string; - minAspectRatio?: number; - maxAspectRatio?: number; - handlerComponent?: unknown; - handlersClasses?: Record; - }; - stencilComponent?: string; - canvas?: boolean | SizeRestrictions; - debounce?: boolean; - transitions?: boolean; - minWidth?: number; - minHeight?: number; - priority?: 'visibleArea'; - sizeRestrictionsAlgorithm?: 'pixelsRestriction'; - defaultTransforms?: unknown; - }, + { + src?: string; + backgroundClass?: string; + foregroundClass?: string; + imageRestriction?: 'fill-area' | 'fit-area' | 'stencil' | 'none'; + defaultBoundaries?: 'fill'; + defaultPosition?: Limits; + defaultVisibleArea?: Coordinates; + defaultSize?: Size | ((size: { visibleArea : VisibleArea , imageSize: ImageSize }) => Size); + stencilSize?: Size | ((size: { boundaries: Boundaries }) => Size); + stencilProps?: { + lines?: unknown; + handlers?: unknown; + movable?: boolean; + resizable?: boolean; + scalable?: boolean; + aspectRatio?: number; + previewClass?: string; + minAspectRatio?: number; + maxAspectRatio?: number; + handlerComponent?: unknown; + handlersClasses?: Record; + }; + stencilComponent?: string; + canvas?: boolean | SizeRestrictions; + debounce?: boolean; + transitions?: boolean; + minWidth?: number; + minHeight?: number; + priority?: 'visibleArea'; + sizeRestrictionsAlgorithm?: 'pixelsRestriction'; + defaultTransforms?: unknown; + }, { getResult: () => CropperResult; setCoordinates: (transform: Transform | Transform[]) => void; @@ -192,12 +192,20 @@ export declare const Cropper: DefineComponent< flip: (horizontal: boolean, vertical?: boolean) => void; reset: () => void; }, - {imageSize: ImageSize, sizeRestrictions: SizeRestrictions; coordinates: Coordinates}, - {}, - {}, - {}, - {}, - {ready: () => void; change: (event: CropperResult) => void; error: () => void;} + { + imageSize: ImageSize; + sizeRestrictions: SizeRestrictions; + coordinates: Coordinates; + }, + {}, + {}, + {}, + {}, + { + ready: () => void; + change: (event: CropperResult) => void; + error: () => void; + } >; export declare const PreviewResult: DefineComponent;