UNPKG

tgui-angular

Version:

🚀 Angular UI library for Telegram Web Apps with modern components and theming support | 💼 Author is open to work opportunities | 📧 Contact: a.blagovestnov@gmail.com | 💬 Telegram: @ablagovestnov

55 lines (54 loc) 1.77 kB
import { OnDestroy, RendererFactory2 } from '@angular/core'; import * as i0 from "@angular/core"; export type AppearanceType = 'light' | 'dark'; export declare class ThemeService implements OnDestroy { appearance: import("@angular/core").WritableSignal<AppearanceType>; private themeChangeListener; private mediaQueryList; private handleThemeChange; private useSystemTheme; private currentTheme; private renderer; private telegramService; private document; constructor(rendererFactory: RendererFactory2); ngOnDestroy(): void; /** * Change the theme manually * @param theme The theme to set * @param followSystem If true, will follow system theme changes after setting. Default false. */ setTheme(theme: AppearanceType, followSystem?: boolean): void; /** * Setup theme based on inputs and system preferences * @param appearance Appearance to use * @param followSystem Whether to follow system theme */ setupTheme(appearance?: AppearanceType, followSystem?: boolean): void; /** * Detect and apply system theme */ detectSystemTheme(): void; /** * Load global CSS variables to make them available for all components */ loadGlobalStyles(): void; /** * Initialize the theme detection */ private initializeTheme; /** * Setup browser theme detection using prefers-color-scheme */ private setupBrowserThemeDetection; /** * Apply theme class to DOM */ private applyThemeToDOM; /** * Clean up event listeners */ private cleanupListeners; static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>; }