@sixbell-telco/sdk
Version:
A collection of reusable components designed for use in Sixbell Telco Angular projects
48 lines (47 loc) • 1.7 kB
TypeScript
import { ThemeScheme } from '../models/theme';
import * as i0 from "@angular/core";
/**
* Service for managing theme preferences in local storage
* Provides safe access to localStorage with error handling
* Works gracefully in non-browser environments (SSR)
*/
export declare class ThemeStorageService {
private readonly logger;
/**
* Retrieves the saved theme preference from localStorage
* Returns null if no saved preference or storage unavailable
* @returns Saved theme name or null
*/
getSavedTheme(): string | null;
/**
* Saves the current theme preference to localStorage
* Fails silently if storage is unavailable
* @param theme - Theme name to save
*/
saveTheme(theme: string): void;
/**
* Retrieves the saved scheme preference from localStorage
* Returns null if no saved preference or storage unavailable
* @returns Saved scheme ('system', 'light', 'dark') or null
*/
getSavedScheme(): ThemeScheme | null;
/**
* Saves the current scheme preference to localStorage
* Fails silently if storage is unavailable
* @param scheme - Scheme to save
*/
saveScheme(scheme: ThemeScheme): void;
/**
* Clears all saved theme preferences from localStorage
* Useful for resetting to defaults
*/
clear(): void;
/**
* Constructs a namespaced storage key to avoid collisions
* @param key - The base storage key
* @returns Namespaced key (e.g., "theme:selectedTheme")
*/
private getStorageKey;
static ɵfac: i0.ɵɵFactoryDeclaration<ThemeStorageService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ThemeStorageService>;
}