UNPKG

dropflow

Version:

A small CSS2 document renderer built from specifications

41 lines (40 loc) 2.33 kB
import '#register-default-environment'; import { HTMLElement, TextNode } from './dom.js'; import { DeclaredStyle } from './style.js'; import { fonts, FontFace, createFaceFromTables, createFaceFromTablesSync } from './text-font.js'; import { BlockContainer } from './layout-flow.js'; import { Canvas, CanvasRenderingContext2D } from './paint-canvas.js'; export { environment } from './environment.js'; export type { BlockContainer, DeclaredStyle }; export type { HTMLElement }; export { createDeclaredStyle as style, setOriginStyle } from './style.js'; export { fonts, FontFace, createFaceFromTables, createFaceFromTablesSync }; export declare function generate(rootElement: HTMLElement): BlockContainer; export declare function layout(root: BlockContainer, width?: number, height?: number): void; /** * Old paint target for testing, not maintained much anymore */ export declare function paintToHtml(root: BlockContainer): string; export declare function paintToSvg(root: BlockContainer): string; export declare function paintToSvgElements(root: BlockContainer): string; export { eachRegisteredFont } from './text-font.js'; export declare function paintToCanvas(root: BlockContainer, ctx: CanvasRenderingContext2D): void; export declare function renderToCanvasContext(rootElement: HTMLElement, ctx: CanvasRenderingContext2D, width: number, height: number): Promise<void>; export declare function renderToCanvas(rootElement: HTMLElement, canvas: Canvas): Promise<void>; type HsChild = HTMLElement | string; interface HsData { style?: DeclaredStyle | DeclaredStyle[]; attrs?: { [k: string]: string; }; } export declare function dom(el: HsChild | HsChild[]): HTMLElement; export declare function h(tagName: string): HTMLElement; export declare function h(tagName: string, data: HsData): HTMLElement; export declare function h(tagName: string, children: HsChild[]): HTMLElement; export declare function h(tagName: string, text: string): HTMLElement; export declare function h(tagName: string, data: HsData, children: HsChild[] | string): HTMLElement; export declare function t(text: string): TextNode; export declare function staticLayoutContribution(box: BlockContainer): number; export declare function load(root: HTMLElement): Promise<void>; export declare function loadSync(root: HTMLElement): Promise<void>;