take-shot
Version:
Screenshots with JavaScript
44 lines (43 loc) • 1.99 kB
TypeScript
import { Context } from '../core/context';
import { CSSRuleSelector, FilterFontFace } from './extra/embed-webfonts';
export interface CloneOptions {
ignoreElements?: (element: Element) => boolean;
onclone?: (document: Document, element: HTMLElement) => void;
allowTaint?: boolean;
}
export interface WindowOptions {
scrollX: number;
scrollY: number;
windowWidth: number;
windowHeight: number;
}
export type CloneConfigurations = CloneOptions & {
inlineImages: boolean;
cssRuleSelector?: CSSRuleSelector;
};
export declare class DocumentCloner {
private readonly context;
private readonly options;
documentElement: HTMLElement;
private readonly counters;
private quoteDepth;
constructor(context: Context, element: HTMLElement, options: CloneConfigurations);
embed(filterFontFace?: FilterFontFace, placeholder?: string): Promise<void>;
createElementClone<T extends HTMLElement | SVGElement>(node: T): HTMLElement | SVGElement;
createCustomElementClone(node: HTMLElement): HTMLElement;
createStyleClone(node: HTMLStyleElement): HTMLStyleElement;
createCanvasClone(canvas: HTMLCanvasElement): HTMLImageElement | HTMLCanvasElement;
createVideoClone(video: HTMLVideoElement): HTMLCanvasElement;
isVisible(style?: CSSStyleDeclaration): boolean;
appendChildNode(clone: HTMLElement | SVGElement, child: Node, copyStyles: boolean): void;
cloneChildNodes(node: Element, clone: HTMLElement | SVGElement, copyStyles: boolean): void;
cloneNode(node: Node, copyStyles: boolean, notAddChildren?: boolean): Node;
resolvePseudoContent(node: Element, clone: Element, style: CSSStyleDeclaration, pseudoElt: PseudoElementType): HTMLElement | void;
static destroy(container: HTMLIFrameElement): boolean;
}
declare enum PseudoElementType {
BEFORE = 0,
AFTER = 1
}
export declare const copyCSSStyles: <T extends HTMLElement | SVGElement>(style: CSSStyleDeclaration, target: T) => T;
export {};