@parcility/kennel
Version:
A comprehensive, easy-to-use native depiction renderer.
38 lines (37 loc) • 1.9 kB
TypeScript
import { RenderableElement } from "../renderable";
import { DepictionBaseView } from "../views";
export declare class KennelError extends Error {
constructor(message: string);
}
export declare function parseSize(str: string): number[];
export declare function fontWeightParse(fontWeight: string): string;
export declare function buttonLinkHandler(el: RenderableElement, url: string, label?: string): void;
export declare enum Alignment {
Left = 0,
Center = 1,
Right = 2
}
export declare function getAlignment(value: any): Alignment;
export declare function textAlignment(value: any): string;
export declare function applyAlignmentMargin(el: RenderableElement, alignment: Alignment): void;
export declare function constructView(view: any): DepictionBaseView | undefined;
export declare function constructViews(views: any[]): DepictionBaseView[];
export declare function makeView(view: DepictionBaseView): Promise<RenderableElement>;
export declare function makeViews(views: DepictionBaseView[]): Promise<RenderableElement[]>;
export interface ValidTypes {
undefined: undefined;
object: null | ArrayLike<any> | Record<string | number | symbol, any>;
array: any[];
boolean: boolean;
number: number;
bigint: bigint;
string: string;
symbol: symbol;
function: Function;
color: string;
}
export declare function isType<T extends keyof ValidTypes>(value: any, type: T): boolean;
export declare function undefIfNotType<T extends keyof ValidTypes, U extends ValidTypes[T]>(value: any, type: T): U | undefined;
export declare function defaultIfNotType<T extends keyof ValidTypes, U extends ValidTypes[T]>(value: any, type: T, defaultValue: U): U;
export declare function guardIfNotType<T extends keyof ValidTypes, U extends ValidTypes[T]>(value: any, type: T): U;
export declare function escapeHTML(potentialHTML: string, isAttribute?: boolean): string;