@rxap/ngx-theme 19.2.0-dev.0 → 21.0.1-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/compodoc/changelog.html +18 -0
- package/compodoc/dependencies.html +8 -8
- package/compodoc/injectables/ThemeModeService.html +26 -25
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +173 -173
- package/docs/html/classes/ThemeModeService.html +6 -6
- package/docs/html/classes/ThemeService.html +2 -2
- package/docs/html/enums/ColorPaletteAlgorithm.html +2 -2
- package/docs/html/functions/ComputeColorPalette.html +1 -1
- package/docs/html/functions/ObserveCurrentThemeDensity.html +1 -1
- package/docs/html/functions/provideTheme.html +1 -1
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/ColorPalette.html +2 -2
- package/docs/html/interfaces/ColorPaletteConfig.html +2 -2
- package/docs/html/interfaces/ColorPaletteConfigWithName.html +2 -2
- package/docs/html/interfaces/ThemeConfig.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/html/types/ActiveTheme.html +1 -1
- package/docs/html/types/ThemeSetting.html +1 -1
- package/docs/html/variables/THEME_SETTING_KEY.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/ThemeModeService.md +22 -22
- package/docs/markdown/classes/ThemeService.md +31 -31
- package/docs/markdown/enumerations/ColorPaletteAlgorithm.md +4 -4
- package/docs/markdown/functions/ComputeColorPalette.md +2 -2
- package/docs/markdown/functions/ObserveCurrentThemeDensity.md +2 -2
- package/docs/markdown/functions/provideTheme.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/markdown/interfaces/ColorPalette.md +16 -16
- package/docs/markdown/interfaces/ColorPaletteConfig.md +5 -5
- package/docs/markdown/interfaces/ColorPaletteConfigWithName.md +6 -6
- package/docs/markdown/interfaces/ThemeConfig.md +7 -7
- package/docs/markdown/type-aliases/ActiveTheme.md +2 -2
- package/docs/markdown/type-aliases/ThemeSetting.md +2 -2
- package/docs/markdown/variables/THEME_SETTING_KEY.md +2 -2
- package/docs/wiki/Class.ThemeModeService.md +21 -21
- package/docs/wiki/Class.ThemeService.md +30 -30
- package/docs/wiki/Enumeration.ColorPaletteAlgorithm.md +3 -3
- package/docs/wiki/Function.ComputeColorPalette.md +1 -1
- package/docs/wiki/Function.ObserveCurrentThemeDensity.md +1 -1
- package/docs/wiki/Function.provideTheme.md +1 -1
- package/docs/wiki/Interface.ColorPalette.md +15 -15
- package/docs/wiki/Interface.ColorPaletteConfig.md +4 -4
- package/docs/wiki/Interface.ColorPaletteConfigWithName.md +5 -5
- package/docs/wiki/Interface.ThemeConfig.md +6 -6
- package/docs/wiki/TypeAlias.ActiveTheme.md +1 -1
- package/docs/wiki/TypeAlias.ThemeSetting.md +1 -1
- package/docs/wiki/Variable.THEME_SETTING_KEY.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-ngx-theme.mjs +13 -14
- package/fesm2022/rxap-ngx-theme.mjs.map +1 -1
- package/package.json +25 -20
- package/types/rxap-ngx-theme.d.ts +151 -0
- package/index.d.ts +0 -5
- package/lib/compute-color-palette.d.ts +0 -22
- package/lib/observe-current-theme-density.d.ts +0 -3
- package/lib/provide.d.ts +0 -1
- package/lib/theme-mode.service.d.ts +0 -61
- package/lib/theme.service.d.ts +0 -66
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { MediaMatcher } from '@angular/cdk/layout';
|
|
2
|
-
import { OnDestroy, WritableSignal } from '@angular/core';
|
|
3
|
-
import { ConfigService } from '@rxap/config';
|
|
4
|
-
import { PubSubService } from '@rxap/ngx-pub-sub';
|
|
5
|
-
import { Subscription } from 'rxjs';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
export type ThemeSetting = 'system' | 'light' | 'dark';
|
|
8
|
-
export type ActiveTheme = 'light' | 'dark';
|
|
9
|
-
export declare const THEME_SETTING_KEY = "rxap_theme_settings";
|
|
10
|
-
/**
|
|
11
|
-
* Service to manage theme mode (light/dark/system) for the application.
|
|
12
|
-
* It provides functionality to handle theme preferences, persist them, and synchronize changes.
|
|
13
|
-
*
|
|
14
|
-
* This service integrates with media queries to detect system-level theme changes and allows the user
|
|
15
|
-
* or application logic to toggle or set a specific theme.
|
|
16
|
-
*
|
|
17
|
-
* It utilizes dependency injection to access various required services and the document object.
|
|
18
|
-
* Additionally, it publishes theme-related events for other parts of the application to react to
|
|
19
|
-
* theme changes.
|
|
20
|
-
*/
|
|
21
|
-
export declare class ThemeModeService implements OnDestroy {
|
|
22
|
-
protected readonly mediaMatcher: MediaMatcher;
|
|
23
|
-
protected readonly document: Document;
|
|
24
|
-
readonly config: ConfigService<any>;
|
|
25
|
-
readonly pubSub: PubSubService;
|
|
26
|
-
readonly activeTheme: WritableSignal<ActiveTheme>;
|
|
27
|
-
readonly themeSetting: WritableSignal<ThemeSetting>;
|
|
28
|
-
readonly darkMode: import("@angular/core").Signal<boolean>;
|
|
29
|
-
protected readonly darkColorSchemaMediaQuery: MediaQueryList;
|
|
30
|
-
protected readonly subscriptions: Subscription | null;
|
|
31
|
-
protected readonly mediaQueryListener: (this: MediaQueryList, ev: MediaQueryListEventMap['change']) => any;
|
|
32
|
-
protected syncSubscription?: Subscription;
|
|
33
|
-
constructor(mediaMatcher: MediaMatcher, document: Document);
|
|
34
|
-
private get darkModeLocalStorageKey();
|
|
35
|
-
protected restoreFromPubSub(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Cleans up subscriptions and event listeners when the service is destroyed.
|
|
38
|
-
*/
|
|
39
|
-
ngOnDestroy(): void;
|
|
40
|
-
protected restoreThemeSetting(): ThemeSetting;
|
|
41
|
-
protected storeThemeSetting(setting: ThemeSetting): void;
|
|
42
|
-
protected removeThemeClasses(): void;
|
|
43
|
-
protected setThemeClasses(active: ActiveTheme): void;
|
|
44
|
-
/**
|
|
45
|
-
* Toggles the application theme between 'light' and 'dark' modes.
|
|
46
|
-
* It checks the currently active theme and switches to the opposite mode.
|
|
47
|
-
*
|
|
48
|
-
* @return {void} Does not return a value.
|
|
49
|
-
*/
|
|
50
|
-
toggleTheme(): void;
|
|
51
|
-
/**
|
|
52
|
-
* Sets the active theme for the application and optionally publishes the change.
|
|
53
|
-
*
|
|
54
|
-
* @param {ActiveTheme} active - The theme to be set as active.
|
|
55
|
-
* @param {boolean} [publish=true] - Indicates whether to publish the theme change event.
|
|
56
|
-
* @return {void}
|
|
57
|
-
*/
|
|
58
|
-
setTheme(active: ActiveTheme, publish?: boolean): void;
|
|
59
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThemeModeService, never>;
|
|
60
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ThemeModeService>;
|
|
61
|
-
}
|
package/lib/theme.service.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { MediaMatcher } from '@angular/cdk/layout';
|
|
2
|
-
import { WritableSignal } from '@angular/core';
|
|
3
|
-
import { ConfigService } from '@rxap/config';
|
|
4
|
-
import { PubSubService } from '@rxap/ngx-pub-sub';
|
|
5
|
-
import { ThemeDensity } from '@rxap/utilities';
|
|
6
|
-
import { Subscription } from 'rxjs';
|
|
7
|
-
import { ColorPalette } from './compute-color-palette';
|
|
8
|
-
import { ThemeModeService } from './theme-mode.service';
|
|
9
|
-
import * as i0 from "@angular/core";
|
|
10
|
-
export interface ColorPaletteConfigWithName extends ColorPaletteConfig {
|
|
11
|
-
name?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface ThemeConfig {
|
|
14
|
-
primaryColor?: ColorPaletteConfigWithName;
|
|
15
|
-
accentColor?: ColorPaletteConfigWithName;
|
|
16
|
-
warnColor?: ColorPaletteConfigWithName;
|
|
17
|
-
density?: ThemeDensity;
|
|
18
|
-
typography?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface ColorPaletteConfig {
|
|
21
|
-
algorithm?: string;
|
|
22
|
-
base?: string;
|
|
23
|
-
color?: Partial<ColorPalette>;
|
|
24
|
-
}
|
|
25
|
-
export declare class ThemeService {
|
|
26
|
-
private readonly mediaMatcher;
|
|
27
|
-
readonly config: ConfigService<any>;
|
|
28
|
-
readonly pubSub: PubSubService;
|
|
29
|
-
readonly themeModeService: ThemeModeService;
|
|
30
|
-
readonly darkMode: import("@angular/core").Signal<boolean>;
|
|
31
|
-
readonly themeName: WritableSignal<string>;
|
|
32
|
-
readonly density: WritableSignal<ThemeDensity>;
|
|
33
|
-
readonly typography: WritableSignal<string>;
|
|
34
|
-
protected syncSubscription?: Subscription;
|
|
35
|
-
constructor(mediaMatcher: MediaMatcher);
|
|
36
|
-
restore(): void;
|
|
37
|
-
protected restoreFromPubSub(): void;
|
|
38
|
-
private get themeNameLocalStorageKey();
|
|
39
|
-
private get densityLocalStorageKey();
|
|
40
|
-
private get typographyLocalStorageKey();
|
|
41
|
-
restoreThemeName(): string | null;
|
|
42
|
-
restoreTypography(): string | null;
|
|
43
|
-
restoreDensity(): ThemeDensity | null;
|
|
44
|
-
toggleDarkTheme(): void;
|
|
45
|
-
setDarkTheme(darkMode: boolean, silent?: boolean, publish?: boolean): void;
|
|
46
|
-
setDensity(density: ThemeDensity, silent?: boolean, publish?: boolean): void;
|
|
47
|
-
setTypography(typography: string, silent?: boolean, publish?: boolean): void;
|
|
48
|
-
setTheme(themeName: string, silent?: boolean, publish?: boolean): void;
|
|
49
|
-
applyDensity(density: ThemeDensity): void;
|
|
50
|
-
applyTypography(typography: string): void;
|
|
51
|
-
applyTheme(themeName: string): void;
|
|
52
|
-
getDensity(): ThemeDensity;
|
|
53
|
-
getTypography(): string;
|
|
54
|
-
getTheme(): string;
|
|
55
|
-
getAvailableColorPalettes(): string[] | null;
|
|
56
|
-
getAvailableThemes(): string[] | null;
|
|
57
|
-
getAvailableTypographies(): string[] | null;
|
|
58
|
-
getColorPalette(colorPaletteName: string): Partial<ColorPalette>;
|
|
59
|
-
private coerceColorPalette;
|
|
60
|
-
private getThemeConfig;
|
|
61
|
-
private setCssColorVariables;
|
|
62
|
-
private clearCssColorVariables;
|
|
63
|
-
private resetToDefaultTheme;
|
|
64
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
|
|
65
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
|
|
66
|
-
}
|