import * as StyleNS from './style'; import * as TextNS from './text'; import { CompiledWhitelist } from './whitelist'; declare type Style = StyleNS.Style; declare type Text = TextNS.CompiledText; /** CSS property whitelist. */ interface Whitelist { /** Properties allowed in para {} rules */ para: string[]; /** Properties allowed in span [close] {} rules */ span: string[]; /** Properties allowed in cont {} rules */ cont: string[]; } /** Parameters for configuring a Context */ interface Options { /** * List of allowable CSS properties */ whitelist?: Whitelist; /** * Wether links [url](text) are allowed. */ links?: boolean; } interface InternalOptions { links: boolean; } declare const defaultOptions: { whitelist: { para: string[]; span: string[]; cont: string[]; }; links: boolean; }; /** Primary user-facing entry point */ declare class Context { whitelist: CompiledWhitelist; options: InternalOptions; /** Create a context * * @param options Optional configs. If none is provided, sane defautls will be used. */ constructor(options?: Options); /** Compiles a style * @param data The raw style string to compile * @returns The compiled style, ready to be passed to compileText(). */ compileStyle(data: string): Style; /** Performs a full compilation of a text all at once. * @param text The text to compile * @param styles Styles to be applied to the text. * @returns The compiled text. */ compileText(text: string, styles: Style[]): Text; /** Validates that a style is safely usable. Meant to be used after deserialization. * @param style The style to validate * @returns Whether or not the style is safe to use. */ isStyleValid(style: Style): boolean; /** Validates that a text is safely usable. Meant to be used after deserialization. * @param text The text to validate * @returns Whether or not the text is safe to use. */ isTextValid(text: Text): boolean; } export { Options, Context, Whitelist, defaultOptions, Style, Text };