UNPKG

@rb-mwindh/ngx-theme-manager

Version:

Angular component to switch between different theming stylesheets

65 lines (64 loc) 2.77 kB
import { InjectionToken, OnDestroy } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { StorageService, ThemeRegistryService, ThemeStyleManagerService, ThemeTrackingService } from './internal'; import * as i0 from "@angular/core"; /** * @group InjectionToken */ export declare const STORAGE_KEY: InjectionToken<string>; /** * @group InjectionToken */ export declare const QUERY_PARAM: InjectionToken<string>; /** * Service for managing and switching between different themes in an application. * * @group Services * @group Public API */ export declare class ThemeService implements OnDestroy { #private; private readonly registry; private readonly tracker; private readonly manager; private readonly storage; private readonly activatedRoute; private readonly router; private readonly storageKey?; private readonly queryParam?; /** * Observable stream that emits the currently active theme. */ readonly themes$: import("rxjs").Observable<import("@rb-mwindh/ngx-theme-manager").Theme[]>; /** * Observable stream of all registered themes. */ readonly currentTheme$: import("rxjs").Observable<string | null>; /** * Creates a new instance * * @param {ThemeRegistryService} registry - Service for registering available themes * @param {ThemeTrackingService} tracker - Service for tracking the currently selected theme * @param {ThemeStyleManagerService} manager - Service for theme discovery, activation and deactivation * @param {StorageService} storage - Service for storing the currently selected theme in the browser storage * @param {ActivatedRoute} activatedRoute - Angular service for managing the current route * @param {Router} router - Angular service for navigating between routes * @param {string} storageKey - Key for storing the currently selected theme in browser storage * @param {string} queryParam - Query parameter name for specifying the theme in the route */ constructor(registry: ThemeRegistryService, tracker: ThemeTrackingService, manager: ThemeStyleManagerService, storage: StorageService, activatedRoute: ActivatedRoute, router: Router, storageKey?: string | undefined, queryParam?: string | undefined); /** * Cleanup logic to be executed when the service is destroyed. * * @internal */ ngOnDestroy(): void; /** * Select the theme to be used * * @param {string} theme */ selectTheme(theme: string): void; static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, [null, null, null, null, null, null, { optional: true; }, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>; }