import React from 'react'; import { DomPngOptions } from './types'; /** * React Hook for generating screenshots. * * This hook provides several utility functions for converting React components to SVG. * * @param {Object} params - The parameters for the hook. * @param {string} [params.fontPath='/Inter-Bold.ttf'] - The path to the font file to use. * @param {Object} [params.fontObj={ name: 'Inter', style: 'normal', weight: 700 }] - The font object to use. * @param {string} params.fontObj.name - The name of the font. * @param {string} params.fontObj.style - The style of the font. * @param {number} params.fontObj.weight - The weight of the font. * @return {Object} An object containing several utility functions. * * @example * const { reactToSVG } = useScreenshot(); * const svg = await reactToSVG(, { width: 800, height: 600 }); */ export declare const useScreenshot: ({ fontPath, fontObj, }: { fontPath?: string; fontObj?: { name: string; style: string; weight: number; }; }) => { reactToSVG: (Component: React.ReactElement, props: { width: number; height?: number; }) => Promise; }; /** * Downloads a file from a specified URL. * * @param {string} url - The URL of the file to download. * @param {string} [name='File'] - The name of the file. * @param {() => void} [runOnFinish] - A function to run after the file has been downloaded. */ export declare const downloadFile: (url: string, name?: string, runOnFinish?: () => void) => Promise; /** * Downloads an SVG as a PNG. * * @param {HTMLElement | string | SVGElement} svg - The SVG to download. * @param {DomPngOptions} [props={ scale: 2 }] - The options for the PNG. * @param {string} [name='Image.png'] - The name of the PNG file. * @param {() => void} [runOnFinish] - A function to run after the PNG has been downloaded. */ export declare const downloadSvgAsPng: (svg: HTMLElement | string | SVGElement, props?: DomPngOptions, name?: string, runOnFinish?: () => void) => Promise; /** * Converts an SVG string to a PNG data URL. * * @param {string} svg - The SVG string to convert. * @return {Promise} A promise that resolves to the PNG data URL. */ export declare const svgToPngURI: (svg: string) => Promise; /** * Converts an HTML element to a data URL. * * @param {HTMLElement | string | SVGElement} element - The element to convert. * @param {DomPngOptions} props - The options for the PNG. * @return {Promise} A promise that resolves to the data URL. */ export declare const domToURI: (element: HTMLElement | string | SVGElement, props: DomPngOptions) => Promise; /** * Converts an SVG string to an SVGElement. * * This function uses the DOMParser API to parse the SVG string into a Document, then returns the root element of the Document (which is an SVGElement). * * @param {string} svgString - The SVG string to convert. * @return {SVGElement} The resulting SVGElement. * * @example * const svgElement = svgStringtoElement(''); * console.log(svgElement); // Logs the SVGElement to the console. */ export declare function svgStringtoElement(svgString: string): SVGElement; /** * Copies an image to the clipboard. * * @param {string} URI - The data URI of the image to copy. * @param {string} [toastMessage] - A message to display in a toast notification after the image has been copied. * @param {'bottom-right' | 'top-center'} [toastPosition] - The position of the toast notification. * @param {() => void} [runOnFinish] - A function to run after the PNG has been downloaded. */ export declare function copyToClipboard(URI: string, toastMessage?: string, toastPosition?: 'bottom-right' | 'top-center', runOnFinish?: () => void): Promise; /** * Shares an image using the Web Share API. * * @param {string} dataURI - The data URI of the image to share. * @param {() => void} [runOnFinish] - A function to run after the PNG has been downloaded. * */ export declare function shareImage(dataURI: string, runOnFinish?: () => void): Promise; /** * Checks if the Web Share API and the Clipboard API are supported. * * @return {Object} An object containing two properties: `copyToClipboard` and `shareImage`, which are both booleans indicating whether the respective APIs are supported. */ export declare function shareAPISupport(): object;