/** * @typedef {object} ThemeService * @property {function():object} getStyles Gets the resolved styles object. * @property {function():object} getTheme Gets the current theme API. * @property {function(object):undefined} setTheme Sets a new theme API. */ /** * Creates a theme-service. * * @param {object} args Arguments object. * @param {object} args.theme Theme API. * @param {object} [args.config] Configuration object. * @param {string} [args.config.id] Chart specific theming ID. * @param {any[][]} [args.config.resolve] Matrix with styles to resolve. * @param {any[][]} [args.config.transform] Matrix with style values to transform. * @param {any[][]} [args.config.extend] Matrix with values to add to the resolved result. * * @returns {ThemeService} The created theme-service. * * @example * * const service = createThemeService({ * theme, * config: { * resolve: [ * ['object', 'grid.line.major', 'color', '#111111'], * ['object', 'grid.line.minor', 'color', '#222222'], * ], * }, * }); * * service.getStyles(); * // => { grid: { line: { major: { color: '#59595959' }, minor: { color: '#737373' } } } } */ export default function createThemeService({ theme, config }: { theme: object; config?: { id?: string | undefined; resolve?: any[][] | undefined; transform?: any[][] | undefined; extend?: any[][] | undefined; } | undefined; }): ThemeService; export type ThemeService = { /** * Gets the resolved styles object. */ getStyles: () => object; /** * Gets the current theme API. */ getTheme: () => object; /** * Sets a new theme API. */ setTheme: (arg0: object) => undefined; };