UNPKG

1.15 kBTypeScriptView Raw
1import Group from '../graphic/Group';
2import Element from '../Element';
3import { RectLike } from '../core/BoundingRect';
4import { parseXML } from './parseXML';
5interface SVGParserOption {
6 width?: number;
7 height?: number;
8 ignoreViewBox?: boolean;
9 ignoreRootClip?: boolean;
10}
11export interface SVGParserResult {
12 root: Group;
13 width: number;
14 height: number;
15 viewBoxRect: RectLike;
16 viewBoxTransform: {
17 x: number;
18 y: number;
19 scale: number;
20 };
21 named: SVGParserResultNamedItem[];
22}
23export interface SVGParserResultNamedItem {
24 name: string;
25 namedFrom: SVGParserResultNamedItem;
26 svgNodeTagLower: SVGNodeTagLower;
27 el: Element;
28}
29export declare type SVGNodeTagLower = 'g' | 'rect' | 'circle' | 'line' | 'ellipse' | 'polygon' | 'polyline' | 'image' | 'text' | 'tspan' | 'path' | 'defs' | 'switch';
30export declare function makeViewBoxTransform(viewBoxRect: RectLike, boundingRect: RectLike): {
31 scale: number;
32 x: number;
33 y: number;
34};
35export declare function parseSVG(xml: string | Document | SVGElement, opt: SVGParserOption): SVGParserResult;
36export { parseXML };