chore: follow the general comments style
This commit is contained in:
@@ -41,15 +41,25 @@ type ThemeSource = 'system' | 'user';
|
||||
*/
|
||||
class ThemeManager {
|
||||
// Private reactive state
|
||||
/** Current theme value ('light' or 'dark') */
|
||||
/**
|
||||
* Current theme value ('light' or 'dark')
|
||||
*/
|
||||
#theme = $state<Theme>('light');
|
||||
/** Whether theme is controlled by user or follows system */
|
||||
/**
|
||||
* Whether theme is controlled by user or follows system
|
||||
*/
|
||||
#source = $state<ThemeSource>('system');
|
||||
/** MediaQueryList for detecting system theme changes */
|
||||
/**
|
||||
* MediaQueryList for detecting system theme changes
|
||||
*/
|
||||
#mediaQuery: MediaQueryList | null = null;
|
||||
/** Persistent storage for user's theme preference */
|
||||
/**
|
||||
* Persistent storage for user's theme preference
|
||||
*/
|
||||
#store = createPersistentStore<Theme | null>('glyphdiff:theme', null);
|
||||
/** Bound handler for system theme change events */
|
||||
/**
|
||||
* Bound handler for system theme change events
|
||||
*/
|
||||
#systemChangeHandler = this.#onSystemChange.bind(this);
|
||||
|
||||
constructor() {
|
||||
@@ -64,22 +74,30 @@ class ThemeManager {
|
||||
}
|
||||
}
|
||||
|
||||
/** Current theme value */
|
||||
/**
|
||||
* Current theme value
|
||||
*/
|
||||
get value(): Theme {
|
||||
return this.#theme;
|
||||
}
|
||||
|
||||
/** Source of current theme ('system' or 'user') */
|
||||
/**
|
||||
* Source of current theme ('system' or 'user')
|
||||
*/
|
||||
get source(): ThemeSource {
|
||||
return this.#source;
|
||||
}
|
||||
|
||||
/** Whether dark theme is active */
|
||||
/**
|
||||
* Whether dark theme is active
|
||||
*/
|
||||
get isDark(): boolean {
|
||||
return this.#theme === 'dark';
|
||||
}
|
||||
|
||||
/** Whether theme is controlled by user (not following system) */
|
||||
/**
|
||||
* Whether theme is controlled by user (not following system)
|
||||
*/
|
||||
get isUserControlled(): boolean {
|
||||
return this.#source === 'user';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user