1 | import Canvg from '../Canvg';
|
---|
2 | import Screen, { IScreenViewBoxConfig } from '../Screen';
|
---|
3 | import Property from '../Property';
|
---|
4 | import SVGFontLoader from '../SVGFontLoader';
|
---|
5 | import Element from './Element';
|
---|
6 | import TextNode from './TextNode';
|
---|
7 | import ImageElement from './ImageElement';
|
---|
8 | import SVGElement from './SVGElement';
|
---|
9 | /**
|
---|
10 | * Function to create new canvas.
|
---|
11 | */
|
---|
12 | export declare type CreateCanvas = (width: number, height: number) => HTMLCanvasElement | OffscreenCanvas;
|
---|
13 | /**
|
---|
14 | * Function to create new image.
|
---|
15 | */
|
---|
16 | export declare type CreateImage = (src: string, anonymousCrossOrigin?: boolean) => Promise<CanvasImageSource>;
|
---|
17 | export interface IDocumentOptions {
|
---|
18 | /**
|
---|
19 | * Default `rem` size.
|
---|
20 | */
|
---|
21 | rootEmSize?: number;
|
---|
22 | /**
|
---|
23 | * Default `em` size.
|
---|
24 | */
|
---|
25 | emSize?: number;
|
---|
26 | /**
|
---|
27 | * Function to create new canvas.
|
---|
28 | */
|
---|
29 | createCanvas?: CreateCanvas;
|
---|
30 | /**
|
---|
31 | * Function to create new image.
|
---|
32 | */
|
---|
33 | createImage?: CreateImage;
|
---|
34 | /**
|
---|
35 | * Load images anonymously.
|
---|
36 | */
|
---|
37 | anonymousCrossOrigin?: boolean;
|
---|
38 | }
|
---|
39 | export declare type IViewBoxConfig = Omit<IScreenViewBoxConfig, 'document'>;
|
---|
40 | declare type DOMDocument = typeof window.document;
|
---|
41 | declare function createCanvas(width: number, height: number): HTMLCanvasElement;
|
---|
42 | declare function createImage(src: string, anonymousCrossOrigin?: boolean): Promise<HTMLImageElement>;
|
---|
43 | export default class Document {
|
---|
44 | readonly canvg: Canvg;
|
---|
45 | static readonly createCanvas: typeof createCanvas;
|
---|
46 | static readonly createImage: typeof createImage;
|
---|
47 | static readonly elementTypes: {
|
---|
48 | svg: typeof SVGElement;
|
---|
49 | rect: typeof import("./RectElement").default;
|
---|
50 | circle: typeof import("./CircleElement").default;
|
---|
51 | ellipse: typeof import("./EllipseElement").default;
|
---|
52 | line: typeof import("./LineElement").default;
|
---|
53 | polyline: typeof import("./PolylineElement").default;
|
---|
54 | polygon: typeof import("./PolygonElement").default;
|
---|
55 | path: typeof import("./PathElement").default;
|
---|
56 | pattern: typeof import("./PatternElement").default;
|
---|
57 | marker: typeof import("./MarkerElement").default;
|
---|
58 | defs: typeof import("./DefsElement").default;
|
---|
59 | linearGradient: typeof import("./LinearGradientElement").default;
|
---|
60 | radialGradient: typeof import("./RadialGradientElement").default;
|
---|
61 | stop: typeof import("./StopElement").default;
|
---|
62 | animate: typeof import("./AnimateElement").default;
|
---|
63 | animateColor: typeof import("./AnimateColorElement").default;
|
---|
64 | animateTransform: typeof import("./AnimateTransformElement").default;
|
---|
65 | font: typeof import("./FontElement").default;
|
---|
66 | 'font-face': typeof import("./FontFaceElement").default;
|
---|
67 | 'missing-glyph': typeof import("./MissingGlyphElement").default;
|
---|
68 | glyph: typeof import("./GlyphElement").default;
|
---|
69 | text: typeof import("./TextElement").default;
|
---|
70 | tspan: typeof import("./TSpanElement").default;
|
---|
71 | tref: typeof import("./TRefElement").default;
|
---|
72 | a: typeof import("./AElement").default;
|
---|
73 | textPath: typeof import("./TextPathElement").default;
|
---|
74 | image: typeof ImageElement;
|
---|
75 | g: typeof import("./GElement").default;
|
---|
76 | symbol: typeof import("./SymbolElement").default;
|
---|
77 | style: typeof import("./StyleElement").default;
|
---|
78 | use: typeof import("./UseElement").default;
|
---|
79 | mask: typeof import("./MaskElement").default;
|
---|
80 | clipPath: typeof import("./ClipPathElement").default;
|
---|
81 | filter: typeof import("./FilterElement").default;
|
---|
82 | feDropShadow: typeof import("./FeDropShadowElement").default;
|
---|
83 | feMorphology: typeof import("./FeMorphologyElement").default;
|
---|
84 | feComposite: typeof import("./FeCompositeElement").default;
|
---|
85 | feColorMatrix: typeof import("./FeColorMatrixElement").default;
|
---|
86 | feGaussianBlur: typeof import("./FeGaussianBlurElement").default;
|
---|
87 | title: typeof import("./TitleElement").default;
|
---|
88 | desc: typeof import("./DescElement").default;
|
---|
89 | };
|
---|
90 | rootEmSize: number;
|
---|
91 | documentElement: SVGElement;
|
---|
92 | readonly screen: Screen;
|
---|
93 | readonly createCanvas: CreateCanvas;
|
---|
94 | readonly createImage: CreateImage;
|
---|
95 | readonly definitions: Record<string, Element>;
|
---|
96 | readonly styles: Record<string, Record<string, Property>>;
|
---|
97 | readonly stylesSpecificity: Record<string, string>;
|
---|
98 | readonly images: ImageElement[];
|
---|
99 | readonly fonts: SVGFontLoader[];
|
---|
100 | private readonly emSizeStack;
|
---|
101 | private uniqueId;
|
---|
102 | constructor(canvg: Canvg, { rootEmSize, emSize, createCanvas, createImage, anonymousCrossOrigin }?: IDocumentOptions);
|
---|
103 | private bindCreateImage;
|
---|
104 | get window(): Window;
|
---|
105 | get fetch(): typeof fetch;
|
---|
106 | get ctx(): import("..").RenderingContext2D;
|
---|
107 | get emSize(): number;
|
---|
108 | set emSize(value: number);
|
---|
109 | popEmSize(): void;
|
---|
110 | getUniqueId(): string;
|
---|
111 | isImagesLoaded(): boolean;
|
---|
112 | isFontsLoaded(): boolean;
|
---|
113 | createDocumentElement(document: DOMDocument): SVGElement;
|
---|
114 | createElement<T extends Element>(node: HTMLElement): T;
|
---|
115 | createTextNode(node: HTMLElement): TextNode;
|
---|
116 | setViewBox(config: IViewBoxConfig): void;
|
---|
117 | }
|
---|
118 | export {};
|
---|
119 | //# sourceMappingURL=Document.d.ts.map |
---|