rough-markup
Version:
A markup-style wrapper for `rough.js`.
45 lines • 1.23 kB
TypeScript
import { Config, Drawable } from "roughjs/bin/core";
/**
* Virtual node structure.
*
* @alpha
*/
declare class VNode {
readonly type: string;
readonly props: Record<string, any>;
readonly children: VNode[];
constructor(type: string, props: Record<string, any>, children: VNode[]);
}
/**
* The SVG tag that renders the given string template to virtual nodes.
*
* @public
*/
declare const svg: (strings: TemplateStringsArray, ...values: any[]) => VNode | VNode[];
/**
* The render configs.
*
* @alpha
*/
type RenderConfig = {
clear?: boolean;
rough?: Config;
};
/**
* Render the virtuanl nodes and mounted to given element.
*
* @param node - the virtual nodes.
* @param el - the element (or css selector string) to draw on.
* @public
*/
declare function render(node: VNode | VNode[], el: string | HTMLCanvasElement | SVGSVGElement, config?: RenderConfig): void;
/**
* Convert the virtual nodes into drawables.
*
* @param nodes - the virtual nodes.
* @returns rough drawables.
* @public
*/
declare function renderToDrawables(nodes: VNode[], config?: Config): Drawable[];
export { svg, VNode, render, RenderConfig, renderToDrawables };
//# sourceMappingURL=rough-markup.esm.d.ts.map