dropflow
Version:
A small CSS2 document renderer built from specifications
58 lines (57 loc) • 2.94 kB
TypeScript
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';
import type { Style } from './style.js';
import type { Image } from './layout-image.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;
type LoadableResource = FontFace | Image;
export interface LoadWalkerContext {
fontCache: {
style: Style;
faces: FontFace[];
}[];
fontEntry: {
style: Style;
faces: FontFace[];
} | undefined;
onLoadableResource: (resource: LoadableResource) => void;
}
export declare function load(root: HTMLElement): Promise<LoadableResource[]>;
export declare function loadSync(root: HTMLElement): LoadableResource[];
export declare const objectStore: Map<string, ArrayBufferLike>;
export declare function createObjectURL(buffer: ArrayBufferLike): string;
export declare function revokeObjectURL(url: string): void;