UNPKG

use-vibes

Version:

Transform any DOM element into an AI-powered micro-app

43 lines (42 loc) 1.71 kB
import * as React from 'react'; import type { ImageGenOptions } from 'call-ai'; import { Database } from 'use-fireproof'; import { ImgGenClasses } from '../utils/style-utils'; import './ImgGen.css'; export interface ImgGenProps { /** Text prompt for image generation (required unless _id is provided) */ prompt?: string; /** Document ID to load a specific image instead of generating a new one */ _id?: string; /** Classname(s) to apply to the image */ className?: string; /** Alt text for the image */ alt?: string; /** Array of images to edit or combine with AI */ images?: File[]; /** Image generation options */ options?: ImageGenOptions; /** Database name or instance to use for storing images */ database?: string | Database; /** Callback when image load completes successfully */ onComplete?: () => void; /** Callback when image load fails */ onError?: (error: Error) => void; /** Callback when document is deleted */ onDelete?: (id: string) => void; /** Callback when prompt is edited */ onPromptEdit?: (id: string, newPrompt: string) => void; /** Custom CSS classes for styling component parts */ classes?: ImgGenClasses; /** Callback when a new document is created via drop or file picker */ onDocumentCreated?: (docId: string) => void; /** Enable debug logging */ debug?: boolean; } /** * Main component for generating images with call-ai's imageGen * Provides automatic caching, reactive updates, and placeholder handling * Uses a mountKey to ensure clean state when switching documents */ export declare function ImgGen(props: ImgGenProps): React.ReactElement; export default ImgGen;