UNPKG

vite-awesome-svg-loader

Version:

A universal Vite SVG loader. Imports SVGs as source code, base64 and data URI. Preserves stroke width. Replaces colors with currentColor or custom colors. Creates SVG sprites. Optimizes SVGs.

32 lines (31 loc) 885 B
import { SvgIconStyleProps } from './types'; /** * ID of a `<style>` element that contains SVG icons' styles */ export declare const SVG_ICONS_STYLE_ID = "vite-awesome-svg-loader-icons-styles"; /** * Default `SvgIcon` color transition */ export declare const SVG_ICON_DEFAULT_COLOR_TRANSITION = "0.3s linear"; /** * Initializes SVG icons. Must be called in component's constructor function. Executes only once, so it may be called * multiple times. */ export declare function initSvgIcons(): void; /** * Converts `SvgIcon` props into a "CSS variable -> value" pairs that should be passed to the element's `style` * attribute. * * Example value: * * ```ts * { * "--size": "48rem", * "--color": "red", * } * ``` * * @param props `SvgIcon` props * @returns Icon style */ export declare function getSvgIconStyle(props: SvgIconStyleProps): Record<string, string>;