import Service from '@ember/service'; import { Theme } from "../utils/themes"; import { LocalStorageService } from 'ember-browser-services/types'; declare class ThemeManagerService extends Service { storage: LocalStorageService; private callbacks; /** * @public * @abstract * * Callback for when the theme updates * * @param currentTheme * @param wasSaved */ /** * @public * @abstract * * Callback for when the theme updates * * @param currentTheme * @param wasSaved */ onUpdateTheme?(currentTheme: Theme, wasSaved: boolean): void; /** * @public * * Represents the currently selected theme. * Must be one of THEMES */ currentTheme: Theme; /** * @public * * Whether the setup() method has been called */ isSetup: boolean; /** * @public * * Indicator if theme switching is allowed or not. * * NOTE: * there is a bug that has been carried over from the previous implementation * where this flag is only for UI purposes and doesn't actually provide * safety for preventing the theme from being switched. */ isThemeSwitchingEnabled: boolean; /** * @public * * Override the currently selected theme, and don't allow theme switching in navbar * Useful if a route does not support any other theme * The overridden theme can later be restored using clearForceSelectedTheme * * @param {THEMES} theme */ /** * @public * * Override the currently selected theme, and don't allow theme switching in navbar * Useful if a route does not support any other theme * The overridden theme can later be restored using clearForceSelectedTheme * * @param {THEMES} theme */ forceSelectTheme(theme: Theme): void; /** * @public * * Restores the theme previously overridden by forceSelectTheme * Also restores the previous value of isThemeSwitchingEnabled * * @param {THEMES} theme */ /** * @public * * Restores the theme previously overridden by forceSelectTheme * Also restores the previous value of isThemeSwitchingEnabled * * @param {THEMES} theme */ clearForceSelectedTheme(): void; registerThemeSwitchListener(callback: (theme: Theme) => void): void; /** * @public * * Initializes the Theme Manager with a customizable defaultTheme * * @param {THEMES} defaultTheme */ /** * @public * * Initializes the Theme Manager with a customizable defaultTheme * * @param {THEMES} defaultTheme */ setup(defaultTheme?: Theme): void; /** * @public * @deprecated * * At the moment, there are only two themes. * This getter returns the theme that is currently *not* active. * * If more themes are added, it's likely that either this getter * will be removed */ get alternateTheme(): "theme-dark" | "theme-light"; get inactiveThemes(): ("theme-dark" | "theme-light")[]; /** * @public * * Changes the currentTheme * * @param {THEME} theme - theme to change to * @param {Object} * @property {Boolean} shouldSaveTheme - flag to control if the theme change should be persisted to localStorage */ /** * @public * * Changes the currentTheme * * @param {THEME} theme - theme to change to * @param {Object} * @property {Boolean} shouldSaveTheme - flag to control if the theme change should be persisted to localStorage */ selectTheme(theme: Theme, { shouldSaveTheme }?: { shouldSaveTheme?: boolean | undefined; }): void; private _selectTheme; notifyThemeChange(shouldSaveTheme: boolean): void; /** * @public * * Toggles between the LIGHT and DARK themes * * @param {Object} * @property {Boolean} shouldSaveTheme - flag to control if the theme change should be persisted to localStorage */ /** * @public * * Toggles between the LIGHT and DARK themes * * @param {Object} * @property {Boolean} shouldSaveTheme - flag to control if the theme change should be persisted to localStorage */ toggleTheme({ shouldSaveTheme }?: { shouldSaveTheme?: boolean | undefined; }): void; /** * @private * * The theme that was active before forceSelectTheme overrode it */ _previouslySelectedTheme: Theme; /** * @private * * The value of isThemeSwitchingEnabled before forceSelectTheme was called */ _previousIsThemeSwitchingEnabled: boolean; } declare module '@ember/service' { interface Registry { 'theme-manager': ThemeManagerService; } } export { ThemeManagerService as default };