init commit

This commit is contained in:
Carlos
2026-02-21 10:33:18 +01:00
parent c863a943ed
commit 9d955bf338
9512 changed files with 2015317 additions and 1305 deletions

View File

@@ -0,0 +1,40 @@
export type ObjectFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
export type ObjectFitResult = {
sourceX: number;
sourceY: number;
sourceWidth: number;
sourceHeight: number;
destX: number;
destY: number;
destWidth: number;
destHeight: number;
};
type ObjectFitParams = {
containerSize: {
width: number;
height: number;
left: number;
top: number;
};
intrinsicSize: {
width: number;
height: number;
};
};
/**
* Calculates how to draw an image based on object-fit CSS property.
*
* @param objectFit - The CSS object-fit value
* @param containerSize - The container dimensions (where the image should be drawn)
* @param intrinsicSize - The natural/intrinsic size of the image
* @returns Source and destination rectangles for drawImage
*/
export declare const calculateObjectFit: ({ objectFit, containerSize, intrinsicSize, }: {
objectFit: ObjectFit;
} & ObjectFitParams) => ObjectFitResult;
/**
* Parse an object-fit CSS value string into our ObjectFit type.
* Returns 'fill' as the default if the value is not recognized.
*/
export declare const parseObjectFit: (value: string | null | undefined) => ObjectFit;
export {};