feat: initialize Convert UI - browser-based file conversion app
- Add Next.js 16 with Turbopack and React 19 - Add Tailwind CSS 4 with OKLCH color system - Implement FFmpeg.wasm for video/audio conversion - Implement ImageMagick WASM for image conversion - Add file upload with drag-and-drop - Add format selector with fuzzy search - Add conversion preview and download - Add conversion history with localStorage - Add dark/light theme support - Support 22+ file formats across video, audio, and images 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
127
types/conversion.ts
Normal file
127
types/conversion.ts
Normal file
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* Supported converter engines
|
||||
*/
|
||||
export type ConverterEngine = 'ffmpeg' | 'imagemagick' | 'pandoc';
|
||||
|
||||
/**
|
||||
* File category based on type
|
||||
*/
|
||||
export type FileCategory = 'video' | 'audio' | 'image' | 'document';
|
||||
|
||||
/**
|
||||
* Conversion status
|
||||
*/
|
||||
export type ConversionStatus = 'pending' | 'loading' | 'processing' | 'completed' | 'error';
|
||||
|
||||
/**
|
||||
* Supported conversion format
|
||||
*/
|
||||
export interface ConversionFormat {
|
||||
id: string;
|
||||
name: string;
|
||||
extension: string;
|
||||
mimeType: string;
|
||||
category: FileCategory;
|
||||
converter: ConverterEngine;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion job configuration
|
||||
*/
|
||||
export interface ConversionJob {
|
||||
id: string;
|
||||
inputFile: File;
|
||||
inputFormat: ConversionFormat;
|
||||
outputFormat: ConversionFormat;
|
||||
options: ConversionOptions;
|
||||
status: ConversionStatus;
|
||||
progress: number;
|
||||
result?: Blob;
|
||||
error?: string;
|
||||
startTime?: number;
|
||||
endTime?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic conversion options
|
||||
*/
|
||||
export interface ConversionOptions {
|
||||
// Video options
|
||||
videoBitrate?: string;
|
||||
videoCodec?: string;
|
||||
videoResolution?: string;
|
||||
videoFps?: number;
|
||||
|
||||
// Audio options
|
||||
audioBitrate?: string;
|
||||
audioCodec?: string;
|
||||
audioSampleRate?: number;
|
||||
audioChannels?: number;
|
||||
|
||||
// Image options
|
||||
imageQuality?: number;
|
||||
imageWidth?: number;
|
||||
imageHeight?: number;
|
||||
imageFormat?: string;
|
||||
|
||||
// Document options
|
||||
documentPageSize?: string;
|
||||
documentMargins?: string;
|
||||
documentStyles?: boolean;
|
||||
|
||||
// Generic options
|
||||
[key: string]: string | number | boolean | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* History item for conversion history
|
||||
*/
|
||||
export interface ConversionHistoryItem {
|
||||
id: string;
|
||||
inputFileName: string;
|
||||
inputFormat: string;
|
||||
outputFormat: string;
|
||||
outputFileName: string;
|
||||
timestamp: number;
|
||||
fileSize: number;
|
||||
result?: Blob;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format preset for common conversions
|
||||
*/
|
||||
export interface FormatPreset {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
category: FileCategory;
|
||||
sourceFormats: string[];
|
||||
targetFormat: string;
|
||||
options: ConversionOptions;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* WASM module loading state
|
||||
*/
|
||||
export interface WASMModuleState {
|
||||
ffmpeg: boolean;
|
||||
imagemagick: boolean;
|
||||
pandoc: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress callback for conversion
|
||||
*/
|
||||
export type ProgressCallback = (progress: number) => void;
|
||||
|
||||
/**
|
||||
* Conversion result
|
||||
*/
|
||||
export interface ConversionResult {
|
||||
success: boolean;
|
||||
blob?: Blob;
|
||||
error?: string;
|
||||
duration?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user