1 | import { Canvg } from '../Canvg';
|
2 | import { IScreenViewBoxConfig, Screen } 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 | import { AnyElement } from './elements';
|
10 |
|
11 |
|
12 |
|
13 | export type CreateCanvas = (width: number, height: number) => HTMLCanvasElement | (OffscreenCanvas & {
|
14 | getContext(contextId: '2d'): OffscreenCanvasRenderingContext2D;
|
15 | });
|
16 |
|
17 |
|
18 |
|
19 | export type CreateImage = (src: string, anonymousCrossOrigin?: boolean) => Promise<CanvasImageSource>;
|
20 | export interface IDocumentOptions {
|
21 | |
22 |
|
23 |
|
24 | rootEmSize?: number;
|
25 | |
26 |
|
27 |
|
28 | emSize?: number;
|
29 | |
30 |
|
31 |
|
32 | createCanvas?: CreateCanvas;
|
33 | |
34 |
|
35 |
|
36 | createImage?: CreateImage;
|
37 | |
38 |
|
39 |
|
40 | anonymousCrossOrigin?: boolean;
|
41 | }
|
42 | export type IViewBoxConfig = Omit<IScreenViewBoxConfig, 'document'>;
|
43 | type DOMDocument = typeof window.document;
|
44 | declare function createCanvas(width: number, height: number): HTMLCanvasElement;
|
45 | declare function createImage(src: string, anonymousCrossOrigin?: boolean): Promise<HTMLImageElement>;
|
46 | export declare class Document {
|
47 | readonly canvg: Canvg;
|
48 | static readonly createCanvas: typeof createCanvas;
|
49 | static readonly createImage: typeof createImage;
|
50 | static readonly elementTypes: Record<string, AnyElement>;
|
51 | rootEmSize: number;
|
52 | documentElement?: SVGElement;
|
53 | readonly screen: Screen;
|
54 | readonly createCanvas: CreateCanvas;
|
55 | readonly createImage: CreateImage;
|
56 | readonly definitions: Record<string, Element>;
|
57 | readonly styles: Record<string, Record<string, Property>>;
|
58 | readonly stylesSpecificity: Record<string, string>;
|
59 | readonly images: ImageElement[];
|
60 | readonly fonts: SVGFontLoader[];
|
61 | private readonly emSizeStack;
|
62 | private uniqueId;
|
63 | constructor(canvg: Canvg, { rootEmSize, emSize, createCanvas, createImage, anonymousCrossOrigin }?: IDocumentOptions);
|
64 | private bindCreateImage;
|
65 | get window(): Window;
|
66 | get fetch(): typeof fetch;
|
67 | get ctx(): import("..").RenderingContext2D;
|
68 | get emSize(): number;
|
69 | set emSize(value: number);
|
70 | popEmSize(): void;
|
71 | getUniqueId(): string;
|
72 | isImagesLoaded(): boolean;
|
73 | isFontsLoaded(): boolean;
|
74 | createDocumentElement(document: DOMDocument): SVGElement;
|
75 | createElement<T extends Element>(node: HTMLElement): T;
|
76 | createTextNode(node: HTMLElement): TextNode;
|
77 | setViewBox(config: IViewBoxConfig): void;
|
78 | }
|
79 | export {};
|
80 |
|
\ | No newline at end of file |