import { ComputedRef, Ref } from 'vue'; import { QRCodeRenderResponse, QRCodeBaseOptions } from './types'; export interface UseQRCodeOptions extends Partial { /** * Text to be encoded in the QR code (required) */ text: string; /** * GIF background URL to be loaded and used */ gifBackgroundURL?: string; } export type QRCodeGenerationStatus = 'idle' | 'loading' | 'success' | 'error' | 'cancelled'; export type QRCodeGenerationConcurrency = 'reject' | 'latest'; export interface UseQRCodeConfig { defaultOptions?: Partial; concurrency?: QRCodeGenerationConcurrency; } export interface UseQRCodeConfigWithDefaults extends UseQRCodeConfig { defaultOptions: UseQRCodeOptions; } export declare class QRCodeGenerationCancelledError extends Error { constructor(message?: string); } export interface UseQRCodeReturnBase { qrcodeURL: Ref; isLoading: Ref; status: Ref; error: Ref; canDownload: ComputedRef; download: (fileName?: string, sourceOverride?: QRCodeRenderResponse) => Promise; cancel: () => void; reset: () => void; clear: () => void; dispose: () => void; } export interface UseQRCodeReturn extends UseQRCodeReturnBase { generate: (options: UseQRCodeOptions) => Promise; } export interface UseQRCodeReturnWithDefaults extends UseQRCodeReturnBase { generate: (options?: Partial) => Promise; } /** * Composable for generating QR codes. * * The default `reject` concurrency mode preserves the original API behavior. * Use `latest` when only the newest overlapping request should own the result. */ export declare function useQRCode(): UseQRCodeReturn; export declare function useQRCode(config: UseQRCodeConfigWithDefaults): UseQRCodeReturnWithDefaults; export declare function useQRCode(config: UseQRCodeConfig): UseQRCodeReturn; export type UseQRCodeReturnType = UseQRCodeReturn;