@tdb/web
Version:
Common condiguration for serving a web-site and testing web-based UI components.
94 lines (80 loc) • 1.71 kB
text/typescript
export type IParseResponse<T = {}> = {
data?: T;
error?: { message: string };
};
export type IManifestResponse = {
status: number;
elapsed: number;
error?: { message: string };
manifest?: IManifest;
};
export type IManifest = {
path: string;
resources: IManifestResource[];
};
export type IManifestResource =
| IManifestFolder
| IManifestFile
| IManifestImage
| IManifestMarkdown
| IManifestJson
| IManifestYaml;
export type ManifestFileType =
| IManifestFolder['type']
| IManifestFile['type']
| IManifestImage['type']
| IManifestMarkdown['type']
| IManifestJson['type']
| IManifestYaml['type'];
/**
* Manifest types.
*/
export type IManifestCommon = {
path: string;
error?: { message: string };
};
export type IManifestFolder = IManifestCommon & {
type: 'FOLDER';
};
export type IManifestFile = IManifestCommon & {
type: 'FILE';
};
export type IManifestImage = IManifestCommon & {
type: 'FILE/image';
name: string;
ext: string;
path2x?: string;
width?: number;
height?: number;
};
export type IManifestMarkdown = IManifestCommon & {
type: 'FILE/markdown';
markdown?: IMarkdown;
};
export type IManifestJson = IManifestCommon & {
type: 'FILE/json';
data?: { [key: string]: any };
};
export type IManifestYaml = IManifestCommon & {
type: 'FILE/yaml';
data?: { [key: string]: any };
};
/**
* Markdown.
*/
export type IMarkdown = {
title?: string;
sections: IMarkdownSection[];
};
export type IMarkdownSection<T = {}> = {
index: number;
depth: number;
data: Array<IMarkdownData<T>>;
title?: string;
titleHtml?: string;
html?: string;
};
export type IMarkdownData<T = {}> = {
value: T;
meta?: string;
};