@sheetxl/models
Version:
Models - A Headless javascript spreadsheet library.
63 lines (62 loc) • 1.88 kB
TypeScript
import { JSONSerializable } from "@sheetxl/common";
import { SerializableProperties } from "../primitives";
import { IDocTheme, DocThemeValues } from './IDocTheme';
export declare enum GetThemeType {
BuiltIn = "builtIn",
All = "all",
Custom = "custom"
}
/**
* For managing themes.
*/
export interface IDocThemes extends JSONSerializable<SerializableProperties<DocThemeValues>[]> {
/**
* Return the theme for the given name.
* @remarks
*
* Will try to return:
* 1. The custom theme for the name
* 2. The builtin theme for the name.
* 3. nul if it doesn't exist.
*/
getTheme(name: string): IDocTheme | null;
/**
* Returns new map of all themes.
* @defaultValue GetThemeType.All
* @remarks
* Generates a new map so this can be mutated without affecting the internal state.
*/
getThemes(type?: GetThemeType): Map<string, IDocTheme>;
/**
* This will add or update a theme.
* @remarks
*
* Case insensitive; for duplicate detection purposes.
*
* @param theme
* @return the original theme
*/
setCustomTheme(theme: IDocTheme): IDocTheme | null;
/**
* This will remove a custom theme.
* @param theme or theme name
* @returns true if the Theme was removed.
*/
deleteCustomTheme(theme: IDocTheme | string): IDocTheme | null;
/**
* Returns the name of the default Theme.
* @returns
*/
getDefaultTheme: () => IDocTheme;
/**
* Set the new default theme.
* @returns 'the previous default theme'
*/
setDefaultTheme: (theme: IDocTheme) => IDocTheme;
/**
* creates a persistable version of Themes
*/
toJSON(): SerializableProperties<DocThemeValues>[];
fromJSON(json: SerializableProperties<DocThemeValues>[]): void;
}
//# sourceMappingURL=IDocThemes.d.ts.map