aura-glass
Version:
A comprehensive glassmorphism design system for React applications with 142+ production-ready components
190 lines • 6.1 kB
TypeScript
import React from "react";
export interface ImageFile {
id: string;
file: File;
name: string;
originalName: string;
size: number;
type: string;
width: number;
height: number;
aspectRatio: number;
url: string;
thumbnailUrl?: string;
uploadedAt: Date;
optimizedAt?: Date;
metadata: ImageMetadata;
editHistory: EditOperation[];
cloudUrls?: CloudUrls;
tags?: string[];
faces?: FaceDetection[];
}
export interface ImageMetadata {
format: string;
quality: number;
colorSpace: string;
hasAlpha: boolean;
dpi?: number;
exifData?: Record<string, any>;
dominantColors: string[];
brightness: number;
contrast: number;
saturation: number;
sharpness: number;
fileSize: number;
compressionRatio?: number;
}
export interface EditOperation {
id: string;
type: "crop" | "resize" | "filter" | "color" | "rotate" | "watermark" | "background";
timestamp: Date;
parameters: Record<string, any>;
preview?: string;
}
export interface CloudUrls {
original: string;
optimized: string;
thumbnail: string;
responsive: {
small: string;
medium: string;
large: string;
xlarge: string;
};
}
export interface FaceDetection {
id: string;
x: number;
y: number;
width: number;
height: number;
confidence: number;
landmarks?: {
leftEye: {
x: number;
y: number;
};
rightEye: {
x: number;
y: number;
};
nose: {
x: number;
y: number;
};
mouth: {
x: number;
y: number;
};
};
}
export interface OptimizationOptions {
targetSize?: number;
maxWidth?: number;
maxHeight?: number;
format?: "auto" | "jpeg" | "png" | "webp" | "avif";
quality?: number;
progressive?: boolean;
removeMetadata?: boolean;
smartCrop?: boolean;
responsiveSizes?: number[];
}
export interface FilterOptions {
brightness: number;
contrast: number;
saturation: number;
hue: number;
blur: number;
sharpen: number;
noise: number;
vignette: number;
sepia: number;
grayscale: number;
}
export interface WatermarkOptions {
text?: string;
image?: string;
position: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center";
opacity: number;
size: number;
rotation: number;
color?: string;
font?: string;
}
export interface Template {
id: string;
name: string;
category: "social" | "print" | "web" | "mobile";
width: number;
height: number;
description: string;
thumbnail: string;
preset?: Partial<FilterOptions>;
}
export interface UploadProgress {
imageId: string;
progress: number;
status: "uploading" | "processing" | "optimizing" | "completed" | "error";
message?: string;
}
interface ImageProcessingContextValue {
images: ImageFile[];
addImage: (file: File) => Promise<ImageFile>;
addImages: (files: FileList) => Promise<ImageFile[]>;
removeImage: (id: string) => void;
getImage: (id: string) => ImageFile | undefined;
updateImage: (id: string, updates: Partial<ImageFile>) => void;
optimizeImage: (imageId: string, options?: OptimizationOptions) => Promise<ImageFile>;
batchOptimize: (imageIds: string[], options?: OptimizationOptions) => Promise<ImageFile[]>;
cropImage: (imageId: string, cropArea: {
x: number;
y: number;
width: number;
height: number;
}) => Promise<ImageFile>;
resizeImage: (imageId: string, width: number, height: number, maintainAspect?: boolean) => Promise<ImageFile>;
applyFilter: (imageId: string, filters: Partial<FilterOptions>) => Promise<ImageFile>;
rotateImage: (imageId: string, degrees: number) => Promise<ImageFile>;
addWatermark: (imageId: string, watermark: WatermarkOptions) => Promise<ImageFile>;
detectFaces: (imageId: string) => Promise<FaceDetection[]>;
removeBackground: (imageId: string) => Promise<ImageFile>;
replaceBackground: (imageId: string, backgroundImage: string | string) => Promise<ImageFile>;
smartCrop: (imageId: string, aspectRatio: number) => Promise<ImageFile>;
enhanceImage: (imageId: string) => Promise<ImageFile>;
upscaleImage: (imageId: string, factor: number) => Promise<ImageFile>;
batchResize: (imageIds: string[], width: number, height: number) => Promise<ImageFile[]>;
batchFilter: (imageIds: string[], filters: Partial<FilterOptions>) => Promise<ImageFile[]>;
batchWatermark: (imageIds: string[], watermark: WatermarkOptions) => Promise<ImageFile[]>;
uploadToCloud: (imageId: string, provider?: "aws" | "cloudinary" | "imgur") => Promise<CloudUrls>;
generateResponsiveImages: (imageId: string, sizes: number[]) => Promise<CloudUrls>;
templates: Template[];
applyTemplate: (imageId: string, templateId: string) => Promise<ImageFile>;
createCustomTemplate: (template: Omit<Template, "id">) => Template;
getOptimizationStats: () => {
totalSaved: number;
averageReduction: number;
imagesProcessed: number;
mostUsedFormat: string;
};
getImageInsights: (imageId: string) => {
colorPalette: string[];
dominantColor: string;
brightness: number;
complexity: number;
recommendedFormats: string[];
};
uploadProgresses: UploadProgress[];
clearProgress: (imageId: string) => void;
defaultOptimizations: OptimizationOptions;
setDefaultOptimizations: (options: OptimizationOptions) => void;
autoOptimize: boolean;
setAutoOptimize: (enabled: boolean) => void;
}
export declare const ImageProcessingProvider: React.FC<{
children: React.ReactNode;
className?: string;
"data-testid"?: string;
}>;
export { ImageProcessingProvider as GlassImageProcessingProvider };
export declare const useImageProcessing: () => ImageProcessingContextValue;
//# sourceMappingURL=GlassImageProcessingProvider.d.ts.map