UNPKG

image-editor-canva

Version:

A Canva-like image editor plugin for React

52 lines (51 loc) 1.75 kB
import { fabric } from 'fabric'; export { default as psdToJson, type PsdFile } from './psd'; /** * Checks if the given type is a text type */ export declare const isTextType: (type?: string) => type is "text" | "textbox" | "i-text"; interface FabricObject { type?: string; fontFamily?: string; objects?: FabricObject[]; } /** * Downloads a file with the given data URL and format */ export declare const downloadFile: (dataUrl: string, format: string) => void; /** * Transforms text objects in preparation for export */ export declare const transformText: (objects: FabricObject[]) => Promise<void>; /** * Creates a filter based on the given type */ export declare const createFilter: (type: string) => fabric.IBaseFilter | undefined; /** * Centers an object in the canvas */ export declare const centerObjectInCanvas: (canvas: fabric.Canvas, object: fabric.Object) => void; /** * Generates a random ID */ export declare const generateRandomId: () => string; /** * Gets a property value from an object */ export declare const getPropertyValue: (object: fabric.Object, property: string) => any; export interface GenericRecord { [key: string]: unknown; } export declare const deepMerge: (target: GenericRecord, source: GenericRecord) => GenericRecord; /** * Creates a debounced version of a function */ export declare const debounce: <F extends (...args: unknown[]) => unknown>(func: F, waitFor: number) => (...args: Parameters<F>) => ReturnType<F>; /** * Loads a font using the FontFace API if available */ export declare const loadFont: (fontFamily: string, url: string) => Promise<boolean>; /** * Converts a Base64 string to a Blob */ export declare const base64ToBlob: (base64: string, mimeType: string) => Blob;