UNPKG

draw-html-to-canvas

Version:

根据html+css规范绘制 网页到canvas

238 lines (237 loc) 6.66 kB
import type ElementImage from './element-image'; import type Element from './element'; declare const keyList: { inherit: "inherit"; initial: "initial"; auto: "auto"; color: "color"; font: "font"; style: "style"; variant: "variant"; weight: "weight"; stretch: "stretch"; family: "family"; top: "top"; right: "right"; bottom: "bottom"; left: "left"; size: "size"; line: "line"; text: "text"; decoration: "decoration"; none: "none"; background: "background"; image: "image"; position: "position"; repeat: "repeat"; clip: "clip"; origin: "origin"; width: "width"; height: "height"; padding: "padding"; margin: "margin"; border: "border"; radius: "radius"; display: "display"; absolute: "absolute"; relative: "relative"; float: "float"; align: "align"; center: "center"; clear: "clear"; overflow: "overflow"; hidden: "hidden"; visible: "visible"; opacity: "opacity"; thickness: "thickness"; nowrap: "nowrap"; shadow: "shadow"; box: "box"; }; declare const originStyleKeywords: { 'vertical-align': string; 'white-space': string; 'z-index': string; inherit: "inherit"; initial: "initial"; auto: "auto"; color: "color"; font: "font"; style: "style"; variant: "variant"; weight: "weight"; stretch: "stretch"; family: "family"; top: "top"; right: "right"; bottom: "bottom"; left: "left"; size: "size"; line: "line"; text: "text"; decoration: "decoration"; none: "none"; background: "background"; image: "image"; position: "position"; repeat: "repeat"; clip: "clip"; origin: "origin"; width: "width"; height: "height"; padding: "padding"; margin: "margin"; border: "border"; radius: "radius"; display: "display"; absolute: "absolute"; relative: "relative"; float: "float"; align: "align"; center: "center"; clear: "clear"; overflow: "overflow"; hidden: "hidden"; visible: "visible"; opacity: "opacity"; thickness: "thickness"; nowrap: "nowrap"; shadow: "shadow"; box: "box"; }; export declare const styleKeywords: { [x: string]: string; } & typeof keyList & typeof originStyleKeywords; export declare const DEFAULT_FONT_FAMILY = "sans-serif"; export declare const DEFAULT_FONT_SIZE = "16px"; export declare const DEFAULT_COLOR = "#000"; export declare const DEFAULT_VERTICAL_ALIGN: "top"; export declare const DEFAULT_LINE_HEIGHT = "1.2"; export declare enum NodeType { ELEMENT_NODE = 1, TEXT_NODE = 3, CDATA_SECTION_NODE = 4, PROCESSING_INSTRUCTION_NODE = 7, COMMENT_NODE = 8, DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = 10, DOCUMENT_FRAGMENT_NODE = 11 } export declare enum BlockType { block = "block", inline = "inline", inlineBlock = "inline-block", flex = "flex", none = "none" } export declare enum SupportElement { div = "div", img = "img", br = "br", hr = "hr", span = "span" } export declare const REG_COLOR: RegExp; export declare const REG_PX: RegExp; export declare const REG_PCT: RegExp; export declare const REG_REM: RegExp; export declare const REG_EM: RegExp; export declare const REG_NUM: RegExp; export declare const REG_URL: RegExp; export declare const REG_BG_REPEAT: RegExp; export declare const REG_BG_ATTACHMENT: RegExp; export declare const REG_BG_CLIP: RegExp; export declare const REG_BG_POS_ENUM: RegExp; export declare const REG_POS_LR: RegExp; export declare const REG_POS_TB: RegExp; export declare const REG_BG_POSITION: RegExp; export declare const REG_BG_SIZE: RegExp; export declare const REG_BG_POSITION_SIZE: RegExp; export declare const REG_ROUND_AUTO_VALUE: RegExp; export declare const REG_BORDER_RADIUS: RegExp; export declare const REG_RADIUS_VALUE: RegExp; export declare enum BORDER_STYLE { none = "none", hidden = "hidden", dotted = "dotted", dashed = "dashed", solid = "solid", double = "double", ridge = "ridge", inset = "inset", outset = "outset" } export declare const REG_BORDER_WIDTH: RegExp; export declare const REG_BORDER_STYLE: RegExp; export declare const REG_BORDER_COLOR: RegExp; export declare const REG_BORDER: RegExp; export declare const REG_TEXT_SHADOW: RegExp; export declare enum TEXT_DECORATION_LINE { none = "none", underline = "underline", overline = "overline", lineThrough = "line-through" } export declare enum TEXT_DECORATION_STYLE { solid = "solid", double = "double", dotted = "dotted", dashed = "dashed", wavy = "wavy" } export declare const REG_TEXT_DECORATION_STYLE: RegExp; export declare const REG_TEXT_DECORATION_LINE: RegExp; export declare const REG_TEXT_DECORATION_COLOR: RegExp; export declare const REG_TEXT_DECORATION_THICKNESS: RegExp; export declare const REG_GRADIENT_TYPE: RegExp; export declare const REG_GRADIENT_DIRECTION: RegExp; export declare const REG_GRADIENT_COLOR_SIZE: RegExp; export declare const REG_ELEMENT_ATTR: RegExp; export declare const REG_STYLE_ATTR: RegExp; export declare const REG_SINGLE_ELEMENT: RegExp; export declare const URL_HOLD = "#__URL__#"; export declare const REG_URL_HOLD: RegExp; export declare enum GradientType { repeatingLinearGradient = "repeating-linear-gradient", repeatingRadialGradient = "repeating-radial-gradient", linearGradient = "linear-gradient", radialGradient = "radial-gradient" } export declare type SupportElementType = Element | ElementImage; export declare enum BackgroundPosition { left = "left", center = "center", right = "right", top = "top", bottom = "bottom" } export declare enum BackgroundSize { auto = "auto", cover = "cover", contain = "contain" } export declare enum BackgroundRepeat { repeat = "repeat", noRepeat = "no-repeat", repeatX = "repeat-x", repeatY = "repeat-y" } export declare enum BackgroundClip { borderBox = "border-box", paddingBox = "padding-box", contentBox = "content-box" } export declare enum BackgroundAttachment { scroll = "scroll", fixed = "fixed", local = "local" } export declare enum TextAlign { left = "left", center = "center", right = "right" } export declare type TContinueDraw = (ctx: CanvasRenderingContext2D, ...args: any) => void; export declare type TQuadraticCurvePath = [[number, number], [number, number], [number, number]]; export declare type TBezierCurvePath = [[number, number], [number, number], [number, number], [number, number]]; export {};