@sixbell-telco/sdk
Version:
A collection of reusable components designed for use in Sixbell Telco Angular projects
58 lines (57 loc) • 3 kB
TypeScript
import { RuntimeConfigLoader, RuntimeConfigLoadResult, RuntimeUpdateEvent } from '@sixbell-telco/sdk/utils/runtime-config';
import { FontDefinition, ResolvedThemeScheme, RuntimeThemeConfig, RuntimeThemeConfigFile, ThemeScheme, ThemeStateConfig, ThemeStyleDefinition, ThemeVariablesByCategory } from './models/theme';
import * as i0 from "@angular/core";
export { DEFAULT_BASE_THEME, FALLBACK_RUNTIME_THEME_CONFIG } from './constants';
export type { FontDefinition, ResolvedThemeScheme, RuntimeThemeConfig, RuntimeThemeConfigFile, ThemeScheme, ThemeStyleDefinition, ThemeVariablesByCategory, };
export declare class ThemeService {
private readonly translationService;
private readonly domService;
private readonly storageService;
private readonly schemeResolver;
private readonly assetsService;
private readonly logger;
private isUsingFallbackConfig;
private runtimeHash;
private runtimeLoader?;
private runtimeThemes;
private runtimeEventHashes;
private pendingUpdatedThemes;
private appliedThemeNames;
private refreshHandler?;
readonly updateAvailable: import("@angular/core").WritableSignal<boolean>;
readonly lastRefreshFailed: import("@angular/core").WritableSignal<boolean>;
private config;
readonly selectedTheme: import("@angular/core").WritableSignal<string>;
readonly selectedScheme: import("@angular/core").WritableSignal<ThemeScheme>;
readonly resolvedScheme: import("@angular/core").Signal<ResolvedThemeScheme>;
readonly isDarkTheme: import("@angular/core").Signal<boolean>;
readonly finalTheme: import("@angular/core").Signal<string>;
constructor();
configureRuntime(config: RuntimeThemeConfig, themeName: string, options?: {
blocking?: boolean;
}): Promise<void>;
applyRuntimeConfig(config: ThemeStateConfig, source: RuntimeConfigLoadResult<RuntimeThemeConfigFile>['source']): void;
setTheme(theme: string): void;
setScheme(scheme: ThemeScheme): void;
getAvailableThemes(): string[];
getAvailableSchemes(): ThemeScheme[];
getDefaultTheme(): string;
getDefaultScheme(): ThemeScheme;
getLocalizedSchemeName(scheme: string): string;
getLocalizedThemeName(theme: string): string;
private initializeFromStorage;
private applyTheme;
/**
* Internal method to set runtime loader and enable navigation-based reloading.
* Called by provideRuntimeTheme.
* @internal
*/
setRuntimeLoader(loader: RuntimeConfigLoader<RuntimeThemeConfigFile>, hash?: string): void;
checkForThemeUpdates(loader: RuntimeConfigLoader<RuntimeThemeConfigFile>, event?: RuntimeUpdateEvent): Promise<void>;
refreshTheme(loader?: RuntimeConfigLoader<RuntimeThemeConfigFile>): Promise<void>;
init(): void;
setRefreshHandler(handler: (themes: string[]) => Promise<void>): void;
private waitForFonts;
static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
}