@svgd/core
Version:
An SVG optimization tool that converts SVG files into a single path 'd' attribute string for efficient storage and rendering.
47 lines (39 loc) • 1.13 kB
TypeScript
import { Config } from 'svgo';
interface PathAttributes {
d: string;
opacity?: string;
"fill-opacity"?: string;
"stroke-opacity"?: string;
stroke?: string;
fill?: string;
"stroke-width"?: string;
"fill-rule"?: string;
}
interface Comand {
code: string;
attribute: keyof PathAttributes;
regexp: string;
toAttribute: (codeValue: string) => string;
toCommand: (attributeValue: string) => string | null;
}
declare function getPaths(d: string): PathAttributes[];
interface ViewBox {
minX: number;
minY: number;
width: number;
height: number;
}
interface ResizeParams {
targetViewBox: ViewBox;
overrideSvgAttributes?: boolean;
preserveAspectRatio?: boolean;
}
declare function getSvg(d: string, viewbox?: ViewBox): string;
interface SVGDConfig {
resize: ResizeParams;
colors?: boolean;
svgo: Config;
}
declare const defaultConfig: SVGDConfig;
declare const getSvgoConfig: (config?: SVGDConfig) => Config;
export { type Comand, type PathAttributes, type ResizeParams, type SVGDConfig, defaultConfig, getPaths, getSvg, getSvgoConfig };