uu-console
Version:
An enhanced version of console.log
60 lines (59 loc) • 2.21 kB
TypeScript
import { TThemeItem, TTheme, TSizeItem, TSize, TLocalThemeItem, TLocalSizeItem } from '@/types';
declare type TOptions = {
theme?: string;
size?: string;
};
declare type TCustomItem = {
[styleProperty: string]: string | number;
} | string;
declare type TLogTextOptions = {
text: string;
theme?: string;
size?: string;
style?: Record<string, string | number> | string;
};
declare type TLastLog = {
content: string;
styles: string[];
};
declare class UUConsole {
theme: string;
themeOnce: string | null;
themeSort: number[];
themeSortOnce: number[] | null;
size: string;
sizeOnce: string | null;
sizeSort: number[];
sizeSortOnce: number[] | null;
lastLogText: TLastLog;
constructor(options?: TOptions);
getSize(name: string): TSizeItem | void;
getSizes(): TSize;
useSize(this: any, name: string): this;
useSizeOnce(this: any, name: string): this;
useSizeSort(this: any, sort: number[]): this;
useSizeSortOnce(this: any, sort: number[]): this;
setCustomSize(this: any, name: string, sizes: TCustomItem[]): this;
deleteCustomSize(this: any, name: string): this;
getTheme(name: string): TThemeItem | void;
getThemes(): TTheme;
useTheme(this: any, name: string): this;
useThemeOnce(this: any, name: string): this;
useThemeSort(this: any, sort: number[]): this;
useThemeSortOnce(this: any, sort: number[]): this;
setCustomTheme(this: any, name: string, themes: TCustomItem[]): this;
deleteCustomTheme(this: any, name: string): this;
log(this: any, ...combineText: Array<string | TLogTextOptions>): this;
installTheme(first: TLocalThemeItem | TLocalThemeItem[], ...themes: TLocalThemeItem[]): void;
installSize(first: TLocalSizeItem | TLocalSizeItem[], ...sizes: TLocalSizeItem[]): void;
private _getThemeName;
private _getSizeName;
private _getThemeItemProps;
private _getSizeItemProps;
create(): UUConsole;
clone(this: any): any;
getClass(): typeof UUConsole;
toAry(obj: Record<string, unknown>): unknown[];
}
declare const uuConsole: UUConsole;
export default uuConsole;