@rxap/ngx-theme 19.2.0 → 21.0.1-dev.1

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/compodoc/changelog.html +33 -0
  3. package/compodoc/dependencies.html +8 -8
  4. package/compodoc/injectables/ThemeModeService.html +95 -83
  5. package/compodoc/injectables/ThemeService.html +58 -83
  6. package/compodoc/interfaces/ColorPaletteConfig.html +8 -3
  7. package/compodoc/interfaces/ColorPaletteConfigWithName.html +8 -3
  8. package/compodoc/interfaces/ThemeConfig.html +8 -3
  9. package/compodoc/js/search/search_index.js +2 -2
  10. package/compodoc/properties.html +1 -1
  11. package/docs/documentation.json +489 -551
  12. package/docs/html/assets/hierarchy.js +1 -1
  13. package/docs/html/assets/search.js +1 -1
  14. package/docs/html/classes/ThemeModeService.html +6 -6
  15. package/docs/html/classes/ThemeService.html +2 -2
  16. package/docs/html/enums/ColorPaletteAlgorithm.html +2 -2
  17. package/docs/html/functions/ComputeColorPalette.html +1 -1
  18. package/docs/html/functions/ObserveCurrentThemeDensity.html +1 -1
  19. package/docs/html/functions/provideTheme.html +1 -1
  20. package/docs/html/hierarchy.html +1 -1
  21. package/docs/html/index.html +2 -2
  22. package/docs/html/interfaces/ColorPalette.html +2 -2
  23. package/docs/html/interfaces/ColorPaletteConfig.html +2 -2
  24. package/docs/html/interfaces/ColorPaletteConfigWithName.html +2 -2
  25. package/docs/html/interfaces/ThemeConfig.html +2 -2
  26. package/docs/html/modules.html +1 -1
  27. package/docs/html/types/ActiveTheme.html +1 -1
  28. package/docs/html/types/ThemeSetting.html +1 -1
  29. package/docs/html/variables/THEME_SETTING_KEY.html +1 -1
  30. package/docs/markdown/README.md +1 -1
  31. package/docs/markdown/classes/ThemeModeService.md +23 -33
  32. package/docs/markdown/classes/ThemeService.md +32 -38
  33. package/docs/markdown/enumerations/ColorPaletteAlgorithm.md +4 -4
  34. package/docs/markdown/functions/ComputeColorPalette.md +2 -2
  35. package/docs/markdown/functions/ObserveCurrentThemeDensity.md +2 -2
  36. package/docs/markdown/functions/provideTheme.md +2 -2
  37. package/docs/markdown/globals.md +2 -2
  38. package/docs/markdown/interfaces/ColorPalette.md +16 -16
  39. package/docs/markdown/interfaces/ColorPaletteConfig.md +5 -5
  40. package/docs/markdown/interfaces/ColorPaletteConfigWithName.md +6 -6
  41. package/docs/markdown/interfaces/ThemeConfig.md +7 -7
  42. package/docs/markdown/type-aliases/ActiveTheme.md +2 -2
  43. package/docs/markdown/type-aliases/ThemeSetting.md +2 -2
  44. package/docs/markdown/variables/THEME_SETTING_KEY.md +2 -2
  45. package/docs/wiki/Class.ThemeModeService.md +22 -32
  46. package/docs/wiki/Class.ThemeService.md +31 -37
  47. package/docs/wiki/Enumeration.ColorPaletteAlgorithm.md +3 -3
  48. package/docs/wiki/Function.ComputeColorPalette.md +1 -1
  49. package/docs/wiki/Function.ObserveCurrentThemeDensity.md +1 -1
  50. package/docs/wiki/Function.provideTheme.md +1 -1
  51. package/docs/wiki/Interface.ColorPalette.md +15 -15
  52. package/docs/wiki/Interface.ColorPaletteConfig.md +4 -4
  53. package/docs/wiki/Interface.ColorPaletteConfigWithName.md +5 -5
  54. package/docs/wiki/Interface.ThemeConfig.md +6 -6
  55. package/docs/wiki/TypeAlias.ActiveTheme.md +1 -1
  56. package/docs/wiki/TypeAlias.ThemeSetting.md +1 -1
  57. package/docs/wiki/Variable.THEME_SETTING_KEY.md +1 -1
  58. package/docs/wiki/globals.md +1 -1
  59. package/fesm2022/rxap-ngx-theme.mjs +28 -27
  60. package/fesm2022/rxap-ngx-theme.mjs.map +1 -1
  61. package/package.json +25 -20
  62. package/types/rxap-ngx-theme.d.ts +151 -0
  63. package/index.d.ts +0 -5
  64. package/lib/compute-color-palette.d.ts +0 -22
  65. package/lib/observe-current-theme-density.d.ts +0 -3
  66. package/lib/provide.d.ts +0 -1
  67. package/lib/theme-mode.service.d.ts +0 -61
  68. package/lib/theme.service.d.ts +0 -66
@@ -1,12 +1,11 @@
1
1
  import { TinyColor } from '@ctrl/tinycolor';
2
2
  import { Observable, Subscription, debounceTime, map, tap } from 'rxjs';
3
3
  import * as i0 from '@angular/core';
4
- import { inject, computed, signal, effect, Injectable, Inject, isDevMode, provideAppInitializer } from '@angular/core';
5
- import * as i1 from '@angular/cdk/layout';
4
+ import { inject, DOCUMENT, computed, signal, effect, Injectable, isDevMode, provideAppInitializer } from '@angular/core';
5
+ import { MediaMatcher } from '@angular/cdk/layout';
6
6
  import { ConfigService } from '@rxap/config';
7
7
  import { PubSubService, RXAP_TOPICS } from '@rxap/ngx-pub-sub';
8
8
  import { isDefined } from '@rxap/rxjs';
9
- import { DOCUMENT } from '@angular/common';
10
9
 
11
10
  var ColorPaletteAlgorithm;
12
11
  (function (ColorPaletteAlgorithm) {
@@ -117,15 +116,15 @@ const THEME_SETTING_KEY = 'rxap_theme_settings';
117
116
  * theme changes.
118
117
  */
119
118
  class ThemeModeService {
120
- constructor(mediaMatcher, document) {
121
- this.mediaMatcher = mediaMatcher;
122
- this.document = document;
119
+ constructor() {
120
+ this.mediaMatcher = inject(MediaMatcher);
121
+ this.document = inject(DOCUMENT);
123
122
  this.config = inject(ConfigService);
124
123
  this.pubSub = inject(PubSubService);
125
- this.darkMode = computed(() => this.activeTheme() === 'dark');
124
+ this.darkMode = computed(() => this.activeTheme() === 'dark', ...(ngDevMode ? [{ debugName: "darkMode" }] : /* istanbul ignore next */ []));
126
125
  this.subscriptions = null;
127
126
  this.darkColorSchemaMediaQuery = this.mediaMatcher.matchMedia('(prefers-color-scheme: dark)');
128
- this.themeSetting = signal(this.restoreThemeSetting());
127
+ this.themeSetting = signal(this.restoreThemeSetting(), ...(ngDevMode ? [{ debugName: "themeSetting" }] : /* istanbul ignore next */ []));
129
128
  let activeTheme;
130
129
  const themeSetting = this.themeSetting();
131
130
  switch (themeSetting) {
@@ -142,7 +141,7 @@ class ThemeModeService {
142
141
  activeTheme = this.config.get('theme.active', 'light');
143
142
  break;
144
143
  }
145
- this.activeTheme = signal(activeTheme);
144
+ this.activeTheme = signal(activeTheme, ...(ngDevMode ? [{ debugName: "activeTheme" }] : /* istanbul ignore next */ []));
146
145
  effect(() => {
147
146
  const setting = this.themeSetting();
148
147
  this.storeThemeSetting(setting);
@@ -228,27 +227,24 @@ class ThemeModeService {
228
227
  this.pubSub.publish(RXAP_TOPICS.theme.darkMode.changed, this.darkMode());
229
228
  }
230
229
  }
231
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ThemeModeService, deps: [{ token: i1.MediaMatcher }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
232
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ThemeModeService, providedIn: 'root' }); }
230
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeModeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
231
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeModeService, providedIn: 'root' }); }
233
232
  }
234
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ThemeModeService, decorators: [{
233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeModeService, decorators: [{
235
234
  type: Injectable,
236
235
  args: [{ providedIn: 'root' }]
237
- }], ctorParameters: () => [{ type: i1.MediaMatcher }, { type: Document, decorators: [{
238
- type: Inject,
239
- args: [DOCUMENT]
240
- }] }] });
236
+ }], ctorParameters: () => [] });
241
237
 
242
238
  class ThemeService {
243
- constructor(mediaMatcher) {
244
- this.mediaMatcher = mediaMatcher;
239
+ constructor() {
240
+ this.mediaMatcher = inject(MediaMatcher);
245
241
  this.config = inject(ConfigService);
246
242
  this.pubSub = inject(PubSubService);
247
243
  this.themeModeService = inject(ThemeModeService);
248
244
  this.darkMode = this.themeModeService.darkMode;
249
- this.themeName = signal(this.getTheme());
250
- this.density = signal(this.getDensity());
251
- this.typography = signal(this.getTypography());
245
+ this.themeName = signal(this.getTheme(), ...(ngDevMode ? [{ debugName: "themeName" }] : /* istanbul ignore next */ []));
246
+ this.density = signal(this.getDensity(), ...(ngDevMode ? [{ debugName: "density" }] : /* istanbul ignore next */ []));
247
+ this.typography = signal(this.getTypography(), ...(ngDevMode ? [{ debugName: "typography" }] : /* istanbul ignore next */ []));
252
248
  }
253
249
  restore() {
254
250
  if (isDevMode()) {
@@ -293,7 +289,7 @@ class ThemeService {
293
289
  return typography;
294
290
  }
295
291
  restoreDensity() {
296
- const density = localStorage.getItem('rxap-theme-density');
292
+ const density = localStorage.getItem(this.densityLocalStorageKey);
297
293
  if (density) {
298
294
  const value = Number(density);
299
295
  if (value <= 0 && value >= -3) {
@@ -457,8 +453,13 @@ class ThemeService {
457
453
  colorPalette =
458
454
  ComputeColorPalette(colorPaletteConfig.base, colorPaletteConfig.color, colorPaletteConfig.algorithm);
459
455
  }
456
+ else {
457
+ colorPalette = colorPaletteConfig.color;
458
+ }
459
+ }
460
+ else {
461
+ colorPalette = colorPaletteConfig.color;
460
462
  }
461
- colorPalette = colorPaletteConfig.color;
462
463
  }
463
464
  else if (colorPaletteConfig.base) {
464
465
  colorPalette = ComputeColorPalette(colorPaletteConfig.base, {}, colorPaletteConfig.algorithm);
@@ -508,13 +509,13 @@ class ThemeService {
508
509
  localStorage.removeItem(this.densityLocalStorageKey);
509
510
  localStorage.removeItem(this.typographyLocalStorageKey);
510
511
  }
511
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ThemeService, deps: [{ token: i1.MediaMatcher }], target: i0.ɵɵFactoryTarget.Injectable }); }
512
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
512
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
513
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
513
514
  }
514
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ThemeService, decorators: [{
515
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeService, decorators: [{
515
516
  type: Injectable,
516
517
  args: [{ providedIn: 'root' }]
517
- }], ctorParameters: () => [{ type: i1.MediaMatcher }] });
518
+ }], ctorParameters: () => [] });
518
519
 
519
520
  function provideTheme() {
520
521
  return [
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-ngx-theme.mjs","sources":["../../../../../packages/angular/theme/src/lib/compute-color-palette.ts","../../../../../packages/angular/theme/src/lib/observe-current-theme-density.ts","../../../../../packages/angular/theme/src/lib/theme-mode.service.ts","../../../../../packages/angular/theme/src/lib/theme.service.ts","../../../../../packages/angular/theme/src/lib/provide.ts","../../../../../packages/angular/theme/src/index.ts","../../../../../packages/angular/theme/src/rxap-ngx-theme.ts"],"sourcesContent":["import {\n ColorInput,\n Numberify,\n RGBA,\n TinyColor,\n} from '@ctrl/tinycolor';\n\nexport interface ColorPalette {\n 50: string;\n 100: string;\n 200: string;\n 300: string;\n 400: string;\n 500: string;\n 600: string;\n 700: string;\n 800: string;\n 900: string;\n A100: string;\n A200: string;\n A400: string;\n A700: string;\n}\n\nexport enum ColorPaletteAlgorithm {\n CONSTANTIN = 'constantin',\n BUCKNER = 'buckner',\n}\n\nexport function ComputeColorPalette(\n color: ColorInput,\n colorPalette: Partial<ColorPalette> = {},\n algorithm?: ColorPaletteAlgorithm | string,\n): ColorPalette {\n colorPalette = { ...colorPalette };\n\n const baseLight = new TinyColor('#ffffff');\n const baseDark = multiply(new TinyColor(color).toRgb(), new TinyColor(color).toRgb());\n const baseTriad = new TinyColor(color).tetrad();\n\n switch (algorithm) {\n\n case ColorPaletteAlgorithm.CONSTANTIN:\n colorPalette[50] ??= baseLight.mix(color, 12).toHexString();\n colorPalette[100] ??= baseLight.mix(color, 30).toHexString();\n colorPalette[200] ??= baseLight.mix(color, 50).toHexString();\n colorPalette[300] ??= baseLight.mix(color, 70).toHexString();\n colorPalette[400] ??= baseLight.mix(color, 85).toHexString();\n colorPalette[500] ??= baseLight.mix(color, 100).toHexString();\n colorPalette[600] ??= baseDark.mix(color, 87).toHexString();\n colorPalette[700] ??= baseDark.mix(color, 70).toHexString();\n colorPalette[800] ??= baseDark.mix(color, 54).toHexString();\n colorPalette[900] ??= baseDark.mix(color, 25).toHexString();\n colorPalette.A100 ??= baseDark.mix(baseTriad[4], 15).saturate(80).lighten(65).toHexString();\n colorPalette.A200 ??= baseDark.mix(baseTriad[4], 15).saturate(80).lighten(55).toHexString();\n colorPalette.A400 ??= baseDark.mix(baseTriad[4], 15).saturate(100).lighten(45).toHexString();\n colorPalette.A700 ??= baseDark.mix(baseTriad[4], 15).saturate(100).lighten(40).toHexString();\n break;\n\n case ColorPaletteAlgorithm.BUCKNER:\n colorPalette[50] ??= baseLight.mix(color, 12).toHexString();\n colorPalette[100] ??= baseLight.mix(color, 30).toHexString();\n colorPalette[200] ??= baseLight.mix(color, 50).toHexString();\n colorPalette[300] ??= baseLight.mix(color, 70).toHexString();\n colorPalette[400] ??= baseLight.mix(color, 85).toHexString();\n colorPalette[500] ??= baseLight.mix(color, 100).toHexString();\n colorPalette[600] ??= baseDark.mix(color, 87).toHexString();\n colorPalette[700] ??= baseDark.mix(color, 70).toHexString();\n colorPalette[800] ??= baseDark.mix(color, 54).toHexString();\n colorPalette[900] ??= baseDark.mix(color, 25).toHexString();\n colorPalette.A100 ??= baseDark.mix(baseTriad[3], 15).saturate(80).lighten(48).toHexString();\n colorPalette.A200 ??= baseDark.mix(baseTriad[3], 15).saturate(80).lighten(36).toHexString();\n colorPalette.A400 ??= baseDark.mix(baseTriad[3], 15).saturate(100).lighten(31).toHexString();\n colorPalette.A700 ??= baseDark.mix(baseTriad[3], 15).saturate(100).lighten(28).toHexString();\n break;\n\n default:\n colorPalette[50] ??= new TinyColor(color).lighten(52).toHexString();\n colorPalette[100] ??= new TinyColor(color).lighten(37).toHexString();\n colorPalette[200] ??= new TinyColor(color).lighten(26).toHexString();\n colorPalette[300] ??= new TinyColor(color).lighten(12).toHexString();\n colorPalette[400] ??= new TinyColor(color).lighten(6).toHexString();\n colorPalette[500] ??= new TinyColor(color).toHexString();\n colorPalette[600] ??= new TinyColor(color).darken(6).toHexString();\n colorPalette[700] ??= new TinyColor(color).darken(12).toHexString();\n colorPalette[800] ??= new TinyColor(color).darken(18).toHexString();\n colorPalette[900] ??= new TinyColor(color).darken(24).toHexString();\n colorPalette.A100 ??= new TinyColor(color).lighten(50).saturate(30).toHexString();\n colorPalette.A200 ??= new TinyColor(color).lighten(30).saturate(30).toHexString();\n colorPalette.A400 ??= new TinyColor(color).lighten(10).saturate(15).toHexString();\n colorPalette.A700 ??= new TinyColor(color).lighten(5).saturate(5).toHexString();\n break;\n\n }\n\n return colorPalette as ColorPalette;\n}\n\nfunction multiply(rgb1: Numberify<RGBA>, rgb2: Numberify<RGBA>) {\n rgb1.b = Math.floor(rgb1.b * rgb2.b / 255);\n rgb1.g = Math.floor(rgb1.g * rgb2.g / 255);\n rgb1.r = Math.floor(rgb1.r * rgb2.r / 255);\n return new TinyColor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b);\n}\n","import { ThemeDensity } from '@rxap/utilities';\nimport { Observable } from 'rxjs';\n\nexport function ObserveCurrentThemeDensity(): Observable<ThemeDensity> {\n return new Observable((subscriber) => {\n\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'class') {\n const classList = (mutation.target as HTMLElement).classList;\n const matchingClasses = Array.from(classList).filter((className) =>\n /density-\\d/.test(className),\n );\n if (matchingClasses.length > 0) {\n const match = matchingClasses[0].match(/density-(\\d)/);\n if (match) {\n subscriber.next(Number(match[1]) * -1 as ThemeDensity);\n }\n } else {\n subscriber.next(0);\n }\n }\n });\n });\n\n subscriber.add(() => observer.disconnect());\n\n observer.observe(document.body, {\n attributes: true,\n attributeFilter: [ 'class' ],\n });\n\n });\n}\n","import { MediaMatcher } from '@angular/cdk/layout';\nimport { DOCUMENT } from '@angular/common';\nimport {\n computed,\n effect,\n inject,\n Inject,\n Injectable,\n OnDestroy,\n Renderer2,\n signal,\n WritableSignal,\n} from '@angular/core';\nimport { ConfigService } from '@rxap/config';\nimport {\n PubSubService,\n RXAP_TOPICS,\n} from '@rxap/ngx-pub-sub';\nimport { isDefined } from '@rxap/rxjs';\nimport {\n debounceTime,\n map,\n Subscription,\n tap,\n} from 'rxjs';\n\n// Represents the user's preference setting ('system', 'light', or 'dark')\nexport type ThemeSetting = 'system' | 'light' | 'dark';\n// Represents the currently active theme ('light' or 'dark')\nexport type ActiveTheme = 'light' | 'dark';\n\nexport const THEME_SETTING_KEY = 'rxap_theme_settings';\n\n/**\n * Service to manage theme mode (light/dark/system) for the application.\n * It provides functionality to handle theme preferences, persist them, and synchronize changes.\n *\n * This service integrates with media queries to detect system-level theme changes and allows the user\n * or application logic to toggle or set a specific theme.\n *\n * It utilizes dependency injection to access various required services and the document object.\n * Additionally, it publishes theme-related events for other parts of the application to react to\n * theme changes.\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeModeService implements OnDestroy {\n\n public readonly config = inject(ConfigService);\n public readonly pubSub = inject(PubSubService);\n\n public readonly activeTheme: WritableSignal<ActiveTheme>;\n public readonly themeSetting: WritableSignal<ThemeSetting>;\n public readonly darkMode = computed(() => this.activeTheme() === 'dark');\n\n protected readonly darkColorSchemaMediaQuery: MediaQueryList;\n\n protected readonly subscriptions: Subscription | null = null;\n protected readonly mediaQueryListener: (this: MediaQueryList, ev: MediaQueryListEventMap['change']) => any;\n\n protected syncSubscription?: Subscription;\n\n constructor(\n protected readonly mediaMatcher: MediaMatcher,\n @Inject(DOCUMENT) protected readonly document: Document,\n ) {\n this.darkColorSchemaMediaQuery = this.mediaMatcher.matchMedia('(prefers-color-scheme: dark)');\n this.themeSetting = signal(this.restoreThemeSetting());\n let activeTheme: ActiveTheme;\n const themeSetting = this.themeSetting();\n switch (themeSetting) {\n case 'system':\n activeTheme = this.darkColorSchemaMediaQuery.matches ? 'dark' : 'light';\n break;\n case 'light':\n activeTheme = 'light';\n break;\n case 'dark':\n activeTheme = 'dark';\n break;\n default:\n activeTheme = this.config.get('theme.active', 'light');\n break;\n }\n this.activeTheme = signal(activeTheme);\n effect(() => {\n const setting = this.themeSetting();\n this.storeThemeSetting(setting);\n });\n effect(() => {\n const active = this.activeTheme();\n this.setThemeClasses(active);\n });\n this.mediaQueryListener = (event: MediaQueryListEventMap['change']) => {\n if (this.themeSetting() === 'system') {\n this.activeTheme.set(event.matches ? 'dark' : 'light');\n }\n };\n this.darkColorSchemaMediaQuery.addEventListener('change', this.mediaQueryListener);\n this.restoreFromPubSub();\n }\n\n private get darkModeLocalStorageKey() {\n return (\n window as any\n )?.['__rxap__']?.['ngx']?.['theme']?.['darkMode']?.['key'] ?? THEME_SETTING_KEY;\n }\n\n protected restoreFromPubSub() {\n if (this.syncSubscription) {\n return;\n }\n this.syncSubscription = new Subscription();\n this.syncSubscription.add(this.pubSub.subscribe<boolean>(RXAP_TOPICS.theme.darkMode.restore).pipe(\n debounceTime(1000),\n map(event => event.data),\n isDefined(),\n tap(data => {\n const active = data ? 'dark' : 'light';\n this.themeSetting.set(active);\n this.activeTheme.set(active);\n })\n ).subscribe());\n }\n\n /**\n * Cleans up subscriptions and event listeners when the service is destroyed.\n */\n ngOnDestroy(): void {\n // Remove the media query listener if it exists.\n this.darkColorSchemaMediaQuery.removeEventListener('change', this.mediaQueryListener);\n // Unsubscribe from all RxJS subscriptions.\n this.subscriptions?.unsubscribe();\n this.syncSubscription?.unsubscribe();\n }\n\n protected restoreThemeSetting() {\n const setting = localStorage.getItem(this.darkModeLocalStorageKey) ?? this.config.get('theme.setting', 'system');\n if (setting && ['system', 'dark', 'light'].includes(setting)) {\n return setting as ThemeSetting;\n }\n return 'system';\n }\n\n protected storeThemeSetting(setting: ThemeSetting) {\n localStorage.setItem(this.darkModeLocalStorageKey, setting);\n }\n\n protected removeThemeClasses() {\n this.document.body.classList.remove('light');\n this.document.body.classList.remove('dark');\n }\n\n protected setThemeClasses(active: ActiveTheme) {\n this.document.body.classList.remove(active === 'light' ? 'dark' : 'light');\n this.document.body.classList.add(active);\n }\n\n /**\n * Toggles the application theme between 'light' and 'dark' modes.\n * It checks the currently active theme and switches to the opposite mode.\n *\n * @return {void} Does not return a value.\n */\n public toggleTheme(): void {\n const currentActive = this.activeTheme();\n // Determine the new setting based on the *currently active* theme.\n const newActive = currentActive === 'light' ? 'dark' : 'light';\n this.themeSetting.set(newActive);\n this.activeTheme.set(newActive);\n }\n\n /**\n * Sets the active theme for the application and optionally publishes the change.\n *\n * @param {ActiveTheme} active - The theme to be set as active.\n * @param {boolean} [publish=true] - Indicates whether to publish the theme change event.\n * @return {void}\n */\n public setTheme(active: ActiveTheme, publish = true) {\n this.themeSetting.set(active);\n this.activeTheme.set(active);\n if (publish) {\n this.pubSub.publish(RXAP_TOPICS.theme.darkMode.changed, this.darkMode());\n }\n }\n\n}\n","import { MediaMatcher } from '@angular/cdk/layout';\nimport {\n inject,\n Injectable,\n isDevMode,\n signal,\n WritableSignal,\n} from '@angular/core';\nimport { ConfigService } from '@rxap/config';\nimport {\n PubSubService,\n RXAP_TOPICS,\n} from '@rxap/ngx-pub-sub';\nimport { isDefined } from '@rxap/rxjs';\nimport { ThemeDensity } from '@rxap/utilities';\nimport {\n debounceTime,\n map,\n Subscription,\n tap,\n} from 'rxjs';\nimport {\n ColorPalette,\n ComputeColorPalette,\n} from './compute-color-palette';\nimport { ThemeModeService } from './theme-mode.service';\n\nexport interface ColorPaletteConfigWithName extends ColorPaletteConfig {\n name?: string;\n}\n\nexport interface ThemeConfig {\n primaryColor?: ColorPaletteConfigWithName;\n accentColor?: ColorPaletteConfigWithName;\n warnColor?: ColorPaletteConfigWithName;\n density?: ThemeDensity;\n typography?: string;\n}\n\nexport interface ColorPaletteConfig {\n algorithm?: string;\n base?: string;\n color?: Partial<ColorPalette>;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class ThemeService {\n\n public readonly config = inject(ConfigService);\n public readonly pubSub = inject(PubSubService);\n\n public readonly themeModeService = inject(ThemeModeService);\n\n public readonly darkMode = this.themeModeService.darkMode;\n public readonly themeName: WritableSignal<string>;\n public readonly density: WritableSignal<ThemeDensity>;\n public readonly typography: WritableSignal<string>;\n\n protected syncSubscription?: Subscription;\n\n constructor(private readonly mediaMatcher: MediaMatcher) {\n this.themeName = signal(this.getTheme());\n this.density = signal(this.getDensity());\n this.typography = signal(this.getTypography());\n }\n\n public restore() {\n if (isDevMode()) {\n console.log('Restore theme settings from local storage');\n }\n\n this.restoreThemeName();\n this.restoreDensity();\n this.restoreTypography();\n\n this.restoreFromPubSub();\n }\n\n protected restoreFromPubSub() {\n if (this.syncSubscription) {\n return;\n }\n this.syncSubscription = new Subscription();\n this.syncSubscription.add(this.pubSub.subscribe<ThemeDensity>(RXAP_TOPICS.theme.density.restore).pipe(\n debounceTime(1000),\n map(event => event.data),\n isDefined(),\n tap(data => this.setDensity(data, false, false))\n ).subscribe());\n this.syncSubscription.add(this.pubSub.subscribe<string>(RXAP_TOPICS.theme.preset.restore).pipe(\n debounceTime(1000),\n map(event => event.data),\n isDefined(),\n tap(data => this.setTheme(data, false, false))\n ).subscribe());\n this.syncSubscription.add(this.pubSub.subscribe<string>(RXAP_TOPICS.theme.typography.restore).pipe(\n debounceTime(1000),\n map(event => event.data),\n isDefined(),\n tap(data => this.setTypography(data, false, false))\n ).subscribe());\n }\n\n private get themeNameLocalStorageKey() {\n return (\n window as any\n )?.['__rxap__']?.['ngx']?.['theme']?.['name']?.['key'] ?? `rxap-theme-name`;\n }\n\n private get densityLocalStorageKey() {\n return (\n window as any\n )?.['__rxap__']?.['ngx']?.['theme']?.['density']?.['key'] ?? `rxap-theme-density`;\n }\n\n private get typographyLocalStorageKey() {\n return (\n window as any\n )?.['__rxap__']?.['ngx']?.['theme']?.['typography']?.['key'] ?? `rxap-theme-typography`;\n }\n\n // region restore\n\n public restoreThemeName() {\n const themeName = localStorage.getItem(this.themeNameLocalStorageKey);\n if (themeName) {\n this.setTheme(themeName, true);\n }\n return themeName;\n }\n\n public restoreTypography() {\n const typography = localStorage.getItem(this.typographyLocalStorageKey);\n if (typography) {\n this.setTypography(typography, true);\n }\n return typography;\n }\n\n public restoreDensity() {\n const density = localStorage.getItem('rxap-theme-density');\n if (density) {\n const value = Number(density) as ThemeDensity;\n if (value <= 0 && value >= -3) {\n this.setDensity(Number(density) as ThemeDensity, true);\n return value;\n }\n }\n return null;\n }\n\n // endregion\n\n public toggleDarkTheme(): void {\n this.themeModeService.toggleTheme();\n }\n\n // region set theme configuration state\n\n public setDarkTheme(darkMode: boolean, silent = false, publish = true): void {\n this.themeModeService.setTheme(darkMode ? 'dark' : 'light', publish);\n }\n\n public setDensity(density: ThemeDensity, silent = false, publish = true): void {\n this.applyDensity(density);\n if (this.density() !== density) {\n this.density.set(density);\n if (!silent) {\n localStorage.setItem(this.densityLocalStorageKey, String(density));\n if (publish) {\n this.pubSub.publish(RXAP_TOPICS.theme.density.changed, density);\n }\n }\n }\n }\n\n public setTypography(typography: string, silent = false, publish = true): void {\n this.applyTypography(typography);\n if (this.typography() !== typography) {\n this.typography.set(typography);\n if (!silent) {\n localStorage.setItem(this.typographyLocalStorageKey, typography);\n if (publish) {\n this.pubSub.publish(RXAP_TOPICS.theme.typography.changed, typography);\n }\n }\n }\n }\n\n public setTheme(themeName: string, silent = false, publish = true) {\n this.applyTheme(themeName);\n this.density.set(this.getDensity());\n this.typography.set(this.getTypography());\n if (this.themeName() !== themeName) {\n this.themeName.set(themeName);\n if (!silent) {\n localStorage.setItem(this.themeNameLocalStorageKey, themeName);\n if (publish) {\n this.pubSub.publish(RXAP_TOPICS.theme.preset.changed, themeName);\n }\n }\n }\n }\n\n // endregion\n\n // region apply theme configuration state\n\n public applyDensity(density: ThemeDensity): void {\n document.body.classList.remove('density-0', 'density-1', 'density-2', 'density-3');\n if (density < 0) {\n document.body.classList.add(`density${ density }`);\n }\n }\n\n public applyTypography(typography: string): void {\n document.body.style.setProperty('--font-family', `var(--font-family-${ typography })`);\n }\n\n public applyTheme(themeName: string): void {\n if (themeName === 'default') {\n this.resetToDefaultTheme();\n return;\n }\n\n const theme = this.getThemeConfig(themeName);\n\n if (theme.primaryColor?.color) {\n this.setCssColorVariables('primary', theme.primaryColor.color);\n }\n\n if (theme.accentColor?.color) {\n this.setCssColorVariables('accent', theme.accentColor.color);\n }\n\n if (theme.warnColor?.color) {\n this.setCssColorVariables('warn', theme.warnColor.color);\n }\n\n if (theme.density !== undefined) {\n this.applyDensity(theme.density);\n }\n\n if (theme.typography) {\n this.applyTypography(theme.typography);\n }\n\n document.body.style.setProperty(`--theme-name`, themeName);\n }\n\n // endregion\n\n // region get theme configuration state\n\n public getDensity(): ThemeDensity {\n let density = 0;\n document.body.classList.forEach((className) => {\n const match = className.match(/density-([123])/);\n if (match) {\n density = Number(match[1]) * -1;\n }\n });\n return density as ThemeDensity;\n }\n\n public getTypography(): string {\n const variable = document.body.style.getPropertyValue('--font-family');\n const match = variable.match(/var\\(--font-family-(.*)\\)/);\n if (match) {\n return match[1];\n }\n return 'default';\n }\n\n public getTheme() {\n return document.body.style.getPropertyValue('--theme-name') || 'default';\n }\n\n // endregion\n\n // region get available\n\n public getAvailableColorPalettes(): string[] | null {\n const colorPalettesConfigs: Record<string, unknown> | boolean = this.config.get('colorPalettes', false);\n if (!colorPalettesConfigs) {\n return null;\n }\n const availableColorPalettes: string[] = Object.keys(colorPalettesConfigs);\n availableColorPalettes.unshift('default');\n return availableColorPalettes;\n }\n\n public getAvailableThemes(): string[] | null {\n const themeConfigs: Record<string, unknown> | boolean = this.config.get('themes', false);\n if (!themeConfigs) {\n return null;\n }\n const availableThemes: string[] = Object.keys(themeConfigs);\n availableThemes.unshift('default');\n return availableThemes;\n }\n\n public getAvailableTypographies(): string[] | null {\n const availableTypographies = this.config.get('typographies', false);\n if (!availableTypographies) {\n return null;\n }\n return Array\n .from(document.styleSheets)\n .filter(sheet => sheet.href === null || sheet.href.startsWith(window.location.origin))\n .flatMap(sheet => Array.from(sheet.cssRules || []))\n .filter((rule: any) => rule.selectorText === ':root')\n .flatMap((rule: any) => Array.from(rule.style))\n .filter((prop: any) => prop.startsWith('--'))\n .filter((prop: any) => prop.startsWith('--font-family-'))\n .map((prop: any) => prop.replace('--font-family-', ''))\n .sort();\n }\n\n // endregion\n\n public getColorPalette(colorPaletteName: string): Partial<ColorPalette> {\n const colorPaletteConfig = this.config.getOrThrow<ColorPaletteConfig>(`colorPalettes.${ colorPaletteName }`);\n return this.coerceColorPalette(colorPaletteConfig);\n }\n\n // region utility\n\n private coerceColorPalette(colorPaletteConfig: ColorPaletteConfig): Partial<ColorPalette> {\n let colorPalette: Partial<ColorPalette> = {};\n\n if (colorPaletteConfig.color) {\n if (Object.keys(colorPaletteConfig.color).length !== 14) {\n // the color palette is not complete\n if (colorPaletteConfig.base) {\n colorPalette =\n ComputeColorPalette(colorPaletteConfig.base, colorPaletteConfig.color, colorPaletteConfig.algorithm);\n }\n }\n colorPalette = colorPaletteConfig.color;\n } else if (colorPaletteConfig.base) {\n colorPalette = ComputeColorPalette(colorPaletteConfig.base, {}, colorPaletteConfig.algorithm);\n }\n\n if (Object.keys(colorPalette).length === 0) {\n throw new Error('FATAL: The color palette has neither a base nor a color property');\n }\n\n return colorPalette;\n }\n\n private getThemeConfig(themeName: string): ThemeConfig {\n const themeConfig = this.config.getOrThrow<ThemeConfig>(`themes.${ themeName }`);\n\n if (themeConfig.accentColor) {\n themeConfig.accentColor.color = this.coerceColorPalette(themeConfig.accentColor);\n }\n\n if (themeConfig.primaryColor) {\n themeConfig.primaryColor.color = this.coerceColorPalette(themeConfig.primaryColor);\n }\n\n if (themeConfig.warnColor) {\n themeConfig.warnColor.color = this.coerceColorPalette(themeConfig.warnColor);\n }\n\n return themeConfig;\n }\n\n private setCssColorVariables(name: string, colorPalette: Partial<ColorPalette>): void {\n this.clearCssColorVariables(name);\n for (const [ index, color ] of Object.entries(colorPalette)) {\n document.body.style.setProperty(`--${ name }-${ index }`, color);\n }\n }\n\n private clearCssColorVariables(name: string): void {\n document.body.style.removeProperty(`--${ name }-50`);\n for (let index = 100; index <= 900; index += 100) {\n document.body.style.removeProperty(`--${ name }-${ index }`);\n }\n document.body.style.removeProperty(`--${ name }-a100`);\n document.body.style.removeProperty(`--${ name }-a200`);\n document.body.style.removeProperty(`--${ name }-a400`);\n document.body.style.removeProperty(`--${ name }-a700`);\n }\n\n private resetToDefaultTheme() {\n this.clearCssColorVariables('primary');\n this.clearCssColorVariables('accent');\n this.clearCssColorVariables('warn');\n this.setDensity(0);\n this.setTypography('default');\n document.body.style.removeProperty(`--theme-name`);\n localStorage.removeItem(this.themeNameLocalStorageKey);\n localStorage.removeItem(this.densityLocalStorageKey);\n localStorage.removeItem(this.typographyLocalStorageKey);\n }\n\n // endregion\n\n}\n","import {\n inject,\n provideAppInitializer,\n} from '@angular/core';\nimport { ThemeService } from './theme.service';\n\nexport function provideTheme() {\n return [\n provideAppInitializer(() => {\n const initializerFn = ((themeService: ThemeService) => () => themeService.restore())(inject(ThemeService));\n return initializerFn();\n })\n ];\n}\n","// region \nexport * from './lib/compute-color-palette';\nexport * from './lib/observe-current-theme-density';\nexport * from './lib/provide';\nexport * from './lib/theme-mode.service';\nexport * from './lib/theme.service';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\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AAU,CAAC,IAAI,CAAC,sBAAsB,CAAC;AACpD,QAAA,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,yBAAyB,CAAC;;+GA9V9C,YAAY,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAZ,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA,CAAA;;4FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;SCvClB,YAAY,GAAA;IAC1B,OAAO;QACL,qBAAqB,CAAC,MAAK;YACvB,MAAM,aAAa,GAAG,CAAC,CAAC,YAA0B,KAAK,MAAM,YAAY,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;YAC1G,OAAO,aAAa,EAAE;AACxB,SAAC;KACJ;AACH;;ACbA;AAMA;;ACNA;;AAEG;;;;"}
1
+ {"version":3,"file":"rxap-ngx-theme.mjs","sources":["../../../../../packages/angular/theme/src/lib/compute-color-palette.ts","../../../../../packages/angular/theme/src/lib/observe-current-theme-density.ts","../../../../../packages/angular/theme/src/lib/theme-mode.service.ts","../../../../../packages/angular/theme/src/lib/theme.service.ts","../../../../../packages/angular/theme/src/lib/provide.ts","../../../../../packages/angular/theme/src/index.ts","../../../../../packages/angular/theme/src/rxap-ngx-theme.ts"],"sourcesContent":["import {\n ColorInput,\n Numberify,\n RGBA,\n TinyColor,\n} from '@ctrl/tinycolor';\n\nexport interface ColorPalette {\n 50: string;\n 100: string;\n 200: string;\n 300: string;\n 400: string;\n 500: string;\n 600: string;\n 700: string;\n 800: string;\n 900: string;\n A100: string;\n A200: string;\n A400: string;\n A700: string;\n}\n\nexport enum ColorPaletteAlgorithm {\n CONSTANTIN = 'constantin',\n BUCKNER = 'buckner',\n}\n\nexport function ComputeColorPalette(\n color: ColorInput,\n colorPalette: Partial<ColorPalette> = {},\n algorithm?: ColorPaletteAlgorithm | string,\n): ColorPalette {\n colorPalette = { ...colorPalette };\n\n const baseLight = new TinyColor('#ffffff');\n const baseDark = multiply(new TinyColor(color).toRgb(), new TinyColor(color).toRgb());\n const baseTriad = new TinyColor(color).tetrad();\n\n switch (algorithm) {\n\n case ColorPaletteAlgorithm.CONSTANTIN:\n colorPalette[50] ??= baseLight.mix(color, 12).toHexString();\n colorPalette[100] ??= baseLight.mix(color, 30).toHexString();\n colorPalette[200] ??= baseLight.mix(color, 50).toHexString();\n colorPalette[300] ??= baseLight.mix(color, 70).toHexString();\n colorPalette[400] ??= baseLight.mix(color, 85).toHexString();\n colorPalette[500] ??= baseLight.mix(color, 100).toHexString();\n colorPalette[600] ??= baseDark.mix(color, 87).toHexString();\n colorPalette[700] ??= baseDark.mix(color, 70).toHexString();\n colorPalette[800] ??= baseDark.mix(color, 54).toHexString();\n colorPalette[900] ??= baseDark.mix(color, 25).toHexString();\n colorPalette.A100 ??= baseDark.mix(baseTriad[4], 15).saturate(80).lighten(65).toHexString();\n colorPalette.A200 ??= baseDark.mix(baseTriad[4], 15).saturate(80).lighten(55).toHexString();\n colorPalette.A400 ??= baseDark.mix(baseTriad[4], 15).saturate(100).lighten(45).toHexString();\n colorPalette.A700 ??= baseDark.mix(baseTriad[4], 15).saturate(100).lighten(40).toHexString();\n break;\n\n case ColorPaletteAlgorithm.BUCKNER:\n colorPalette[50] ??= baseLight.mix(color, 12).toHexString();\n colorPalette[100] ??= baseLight.mix(color, 30).toHexString();\n colorPalette[200] ??= baseLight.mix(color, 50).toHexString();\n colorPalette[300] ??= baseLight.mix(color, 70).toHexString();\n colorPalette[400] ??= baseLight.mix(color, 85).toHexString();\n colorPalette[500] ??= baseLight.mix(color, 100).toHexString();\n colorPalette[600] ??= baseDark.mix(color, 87).toHexString();\n colorPalette[700] ??= baseDark.mix(color, 70).toHexString();\n colorPalette[800] ??= baseDark.mix(color, 54).toHexString();\n colorPalette[900] ??= baseDark.mix(color, 25).toHexString();\n colorPalette.A100 ??= baseDark.mix(baseTriad[3], 15).saturate(80).lighten(48).toHexString();\n colorPalette.A200 ??= baseDark.mix(baseTriad[3], 15).saturate(80).lighten(36).toHexString();\n colorPalette.A400 ??= baseDark.mix(baseTriad[3], 15).saturate(100).lighten(31).toHexString();\n colorPalette.A700 ??= baseDark.mix(baseTriad[3], 15).saturate(100).lighten(28).toHexString();\n break;\n\n default:\n colorPalette[50] ??= new TinyColor(color).lighten(52).toHexString();\n colorPalette[100] ??= new TinyColor(color).lighten(37).toHexString();\n colorPalette[200] ??= new TinyColor(color).lighten(26).toHexString();\n colorPalette[300] ??= new TinyColor(color).lighten(12).toHexString();\n colorPalette[400] ??= new TinyColor(color).lighten(6).toHexString();\n colorPalette[500] ??= new TinyColor(color).toHexString();\n colorPalette[600] ??= new TinyColor(color).darken(6).toHexString();\n colorPalette[700] ??= new TinyColor(color).darken(12).toHexString();\n colorPalette[800] ??= new TinyColor(color).darken(18).toHexString();\n colorPalette[900] ??= new TinyColor(color).darken(24).toHexString();\n colorPalette.A100 ??= new TinyColor(color).lighten(50).saturate(30).toHexString();\n colorPalette.A200 ??= new TinyColor(color).lighten(30).saturate(30).toHexString();\n colorPalette.A400 ??= new TinyColor(color).lighten(10).saturate(15).toHexString();\n colorPalette.A700 ??= new TinyColor(color).lighten(5).saturate(5).toHexString();\n break;\n\n }\n\n return colorPalette as ColorPalette;\n}\n\nfunction multiply(rgb1: Numberify<RGBA>, rgb2: Numberify<RGBA>) {\n rgb1.b = Math.floor(rgb1.b * rgb2.b / 255);\n rgb1.g = Math.floor(rgb1.g * rgb2.g / 255);\n rgb1.r = Math.floor(rgb1.r * rgb2.r / 255);\n return new TinyColor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b);\n}\n","import { ThemeDensity } from '@rxap/utilities';\nimport { Observable } from 'rxjs';\n\nexport function ObserveCurrentThemeDensity(): Observable<ThemeDensity> {\n return new Observable((subscriber) => {\n\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'class') {\n const classList = (mutation.target as HTMLElement).classList;\n const matchingClasses = Array.from(classList).filter((className) =>\n /density-\\d/.test(className),\n );\n if (matchingClasses.length > 0) {\n const match = matchingClasses[0].match(/density-(\\d)/);\n if (match) {\n subscriber.next(Number(match[1]) * -1 as ThemeDensity);\n }\n } else {\n subscriber.next(0);\n }\n }\n });\n });\n\n subscriber.add(() => observer.disconnect());\n\n observer.observe(document.body, {\n attributes: true,\n attributeFilter: [ 'class' ],\n });\n\n });\n}\n","import { MediaMatcher } from '@angular/cdk/layout';\n\nimport { computed, effect, inject, Injectable, OnDestroy, Renderer2, signal, WritableSignal, DOCUMENT } from '@angular/core';\nimport { ConfigService } from '@rxap/config';\nimport {\n PubSubService,\n RXAP_TOPICS,\n} from '@rxap/ngx-pub-sub';\nimport { isDefined } from '@rxap/rxjs';\nimport {\n debounceTime,\n map,\n Subscription,\n tap,\n} from 'rxjs';\n\n// Represents the user's preference setting ('system', 'light', or 'dark')\nexport type ThemeSetting = 'system' | 'light' | 'dark';\n// Represents the currently active theme ('light' or 'dark')\nexport type ActiveTheme = 'light' | 'dark';\n\nexport const THEME_SETTING_KEY = 'rxap_theme_settings';\n\n/**\n * Service to manage theme mode (light/dark/system) for the application.\n * It provides functionality to handle theme preferences, persist them, and synchronize changes.\n *\n * This service integrates with media queries to detect system-level theme changes and allows the user\n * or application logic to toggle or set a specific theme.\n *\n * It utilizes dependency injection to access various required services and the document object.\n * Additionally, it publishes theme-related events for other parts of the application to react to\n * theme changes.\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeModeService implements OnDestroy {\n protected readonly mediaMatcher = inject(MediaMatcher);\n protected readonly document = inject<Document>(DOCUMENT);\n\n\n public readonly config = inject(ConfigService);\n public readonly pubSub = inject(PubSubService);\n\n public readonly activeTheme: WritableSignal<ActiveTheme>;\n public readonly themeSetting: WritableSignal<ThemeSetting>;\n public readonly darkMode = computed(() => this.activeTheme() === 'dark');\n\n protected readonly darkColorSchemaMediaQuery: MediaQueryList;\n\n protected readonly subscriptions: Subscription | null = null;\n protected readonly mediaQueryListener: (this: MediaQueryList, ev: MediaQueryListEventMap['change']) => any;\n\n protected syncSubscription?: Subscription;\n\n constructor() {\n this.darkColorSchemaMediaQuery = this.mediaMatcher.matchMedia('(prefers-color-scheme: dark)');\n this.themeSetting = signal(this.restoreThemeSetting());\n let activeTheme: ActiveTheme;\n const themeSetting = this.themeSetting();\n switch (themeSetting) {\n case 'system':\n activeTheme = this.darkColorSchemaMediaQuery.matches ? 'dark' : 'light';\n break;\n case 'light':\n activeTheme = 'light';\n break;\n case 'dark':\n activeTheme = 'dark';\n break;\n default:\n activeTheme = this.config.get('theme.active', 'light');\n break;\n }\n this.activeTheme = signal(activeTheme);\n effect(() => {\n const setting = this.themeSetting();\n this.storeThemeSetting(setting);\n });\n effect(() => {\n const active = this.activeTheme();\n this.setThemeClasses(active);\n });\n this.mediaQueryListener = (event: MediaQueryListEventMap['change']) => {\n if (this.themeSetting() === 'system') {\n this.activeTheme.set(event.matches ? 'dark' : 'light');\n }\n };\n this.darkColorSchemaMediaQuery.addEventListener('change', this.mediaQueryListener);\n this.restoreFromPubSub();\n }\n\n private get darkModeLocalStorageKey() {\n return (\n window as any\n )?.['__rxap__']?.['ngx']?.['theme']?.['darkMode']?.['key'] ?? THEME_SETTING_KEY;\n }\n\n protected restoreFromPubSub() {\n if (this.syncSubscription) {\n return;\n }\n this.syncSubscription = new Subscription();\n this.syncSubscription.add(this.pubSub.subscribe<boolean>(RXAP_TOPICS.theme.darkMode.restore).pipe(\n debounceTime(1000),\n map(event => event.data),\n isDefined(),\n tap(data => {\n const active = data ? 'dark' : 'light';\n this.themeSetting.set(active);\n this.activeTheme.set(active);\n })\n ).subscribe());\n }\n\n /**\n * Cleans up subscriptions and event listeners when the service is destroyed.\n */\n ngOnDestroy(): void {\n // Remove the media query listener if it exists.\n this.darkColorSchemaMediaQuery.removeEventListener('change', this.mediaQueryListener);\n // Unsubscribe from all RxJS subscriptions.\n this.subscriptions?.unsubscribe();\n this.syncSubscription?.unsubscribe();\n }\n\n protected restoreThemeSetting() {\n const setting = localStorage.getItem(this.darkModeLocalStorageKey) ?? this.config.get('theme.setting', 'system');\n if (setting && ['system', 'dark', 'light'].includes(setting)) {\n return setting as ThemeSetting;\n }\n return 'system';\n }\n\n protected storeThemeSetting(setting: ThemeSetting) {\n localStorage.setItem(this.darkModeLocalStorageKey, setting);\n }\n\n protected removeThemeClasses() {\n this.document.body.classList.remove('light');\n this.document.body.classList.remove('dark');\n }\n\n protected setThemeClasses(active: ActiveTheme) {\n this.document.body.classList.remove(active === 'light' ? 'dark' : 'light');\n this.document.body.classList.add(active);\n }\n\n /**\n * Toggles the application theme between 'light' and 'dark' modes.\n * It checks the currently active theme and switches to the opposite mode.\n *\n * @return {void} Does not return a value.\n */\n public toggleTheme(): void {\n const currentActive = this.activeTheme();\n // Determine the new setting based on the *currently active* theme.\n const newActive = currentActive === 'light' ? 'dark' : 'light';\n this.themeSetting.set(newActive);\n this.activeTheme.set(newActive);\n }\n\n /**\n * Sets the active theme for the application and optionally publishes the change.\n *\n * @param {ActiveTheme} active - The theme to be set as active.\n * @param {boolean} [publish=true] - Indicates whether to publish the theme change event.\n * @return {void}\n */\n public setTheme(active: ActiveTheme, publish = true) {\n this.themeSetting.set(active);\n this.activeTheme.set(active);\n if (publish) {\n this.pubSub.publish(RXAP_TOPICS.theme.darkMode.changed, this.darkMode());\n }\n }\n\n}\n","import { MediaMatcher } from '@angular/cdk/layout';\nimport {\n inject,\n Injectable,\n isDevMode,\n signal,\n WritableSignal,\n} from '@angular/core';\nimport { ConfigService } from '@rxap/config';\nimport {\n PubSubService,\n RXAP_TOPICS,\n} from '@rxap/ngx-pub-sub';\nimport { isDefined } from '@rxap/rxjs';\nimport { ThemeDensity } from '@rxap/utilities';\nimport {\n debounceTime,\n map,\n Subscription,\n tap,\n} from 'rxjs';\nimport {\n ColorPalette,\n ComputeColorPalette,\n} from './compute-color-palette';\nimport { ThemeModeService } from './theme-mode.service';\n\nexport interface ColorPaletteConfigWithName extends ColorPaletteConfig {\n name?: string;\n}\n\nexport interface ThemeConfig {\n primaryColor?: ColorPaletteConfigWithName;\n accentColor?: ColorPaletteConfigWithName;\n warnColor?: ColorPaletteConfigWithName;\n density?: ThemeDensity;\n typography?: string;\n}\n\nexport interface ColorPaletteConfig {\n algorithm?: string;\n base?: string;\n color?: Partial<ColorPalette>;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class ThemeService {\n private readonly mediaMatcher = inject(MediaMatcher);\n\n\n public readonly config = inject(ConfigService);\n public readonly pubSub = inject(PubSubService);\n\n public readonly themeModeService = inject(ThemeModeService);\n\n public readonly darkMode = this.themeModeService.darkMode;\n public readonly themeName: WritableSignal<string>;\n public readonly density: WritableSignal<ThemeDensity>;\n public readonly typography: WritableSignal<string>;\n\n protected syncSubscription?: Subscription;\n\n constructor() {\n this.themeName = signal(this.getTheme());\n this.density = signal(this.getDensity());\n this.typography = signal(this.getTypography());\n }\n\n public restore() {\n if (isDevMode()) {\n console.log('Restore theme settings from local storage');\n }\n\n this.restoreThemeName();\n this.restoreDensity();\n this.restoreTypography();\n\n this.restoreFromPubSub();\n }\n\n protected restoreFromPubSub() {\n if (this.syncSubscription) {\n return;\n }\n this.syncSubscription = new Subscription();\n this.syncSubscription.add(this.pubSub.subscribe<ThemeDensity>(RXAP_TOPICS.theme.density.restore).pipe(\n debounceTime(1000),\n map(event => event.data),\n isDefined(),\n tap(data => this.setDensity(data, false, false))\n ).subscribe());\n this.syncSubscription.add(this.pubSub.subscribe<string>(RXAP_TOPICS.theme.preset.restore).pipe(\n debounceTime(1000),\n map(event => event.data),\n isDefined(),\n tap(data => this.setTheme(data, false, false))\n ).subscribe());\n this.syncSubscription.add(this.pubSub.subscribe<string>(RXAP_TOPICS.theme.typography.restore).pipe(\n debounceTime(1000),\n map(event => event.data),\n isDefined(),\n tap(data => this.setTypography(data, false, false))\n ).subscribe());\n }\n\n private get themeNameLocalStorageKey() {\n return (\n window as any\n )?.['__rxap__']?.['ngx']?.['theme']?.['name']?.['key'] ?? `rxap-theme-name`;\n }\n\n private get densityLocalStorageKey() {\n return (\n window as any\n )?.['__rxap__']?.['ngx']?.['theme']?.['density']?.['key'] ?? `rxap-theme-density`;\n }\n\n private get typographyLocalStorageKey() {\n return (\n window as any\n )?.['__rxap__']?.['ngx']?.['theme']?.['typography']?.['key'] ?? `rxap-theme-typography`;\n }\n\n // region restore\n\n public restoreThemeName() {\n const themeName = localStorage.getItem(this.themeNameLocalStorageKey);\n if (themeName) {\n this.setTheme(themeName, true);\n }\n return themeName;\n }\n\n public restoreTypography() {\n const typography = localStorage.getItem(this.typographyLocalStorageKey);\n if (typography) {\n this.setTypography(typography, true);\n }\n return typography;\n }\n\n public restoreDensity() {\n const density = localStorage.getItem(this.densityLocalStorageKey);\n if (density) {\n const value = Number(density) as ThemeDensity;\n if (value <= 0 && value >= -3) {\n this.setDensity(Number(density) as ThemeDensity, true);\n return value;\n }\n }\n return null;\n }\n\n // endregion\n\n public toggleDarkTheme(): void {\n this.themeModeService.toggleTheme();\n }\n\n // region set theme configuration state\n\n public setDarkTheme(darkMode: boolean, silent = false, publish = true): void {\n this.themeModeService.setTheme(darkMode ? 'dark' : 'light', publish);\n }\n\n public setDensity(density: ThemeDensity, silent = false, publish = true): void {\n this.applyDensity(density);\n if (this.density() !== density) {\n this.density.set(density);\n if (!silent) {\n localStorage.setItem(this.densityLocalStorageKey, String(density));\n if (publish) {\n this.pubSub.publish(RXAP_TOPICS.theme.density.changed, density);\n }\n }\n }\n }\n\n public setTypography(typography: string, silent = false, publish = true): void {\n this.applyTypography(typography);\n if (this.typography() !== typography) {\n this.typography.set(typography);\n if (!silent) {\n localStorage.setItem(this.typographyLocalStorageKey, typography);\n if (publish) {\n this.pubSub.publish(RXAP_TOPICS.theme.typography.changed, typography);\n }\n }\n }\n }\n\n public setTheme(themeName: string, silent = false, publish = true) {\n this.applyTheme(themeName);\n this.density.set(this.getDensity());\n this.typography.set(this.getTypography());\n if (this.themeName() !== themeName) {\n this.themeName.set(themeName);\n if (!silent) {\n localStorage.setItem(this.themeNameLocalStorageKey, themeName);\n if (publish) {\n this.pubSub.publish(RXAP_TOPICS.theme.preset.changed, themeName);\n }\n }\n }\n }\n\n // endregion\n\n // region apply theme configuration state\n\n public applyDensity(density: ThemeDensity): void {\n document.body.classList.remove('density-0', 'density-1', 'density-2', 'density-3');\n if (density < 0) {\n document.body.classList.add(`density${ density }`);\n }\n }\n\n public applyTypography(typography: string): void {\n document.body.style.setProperty('--font-family', `var(--font-family-${ typography })`);\n }\n\n public applyTheme(themeName: string): void {\n if (themeName === 'default') {\n this.resetToDefaultTheme();\n return;\n }\n\n const theme = this.getThemeConfig(themeName);\n\n if (theme.primaryColor?.color) {\n this.setCssColorVariables('primary', theme.primaryColor.color);\n }\n\n if (theme.accentColor?.color) {\n this.setCssColorVariables('accent', theme.accentColor.color);\n }\n\n if (theme.warnColor?.color) {\n this.setCssColorVariables('warn', theme.warnColor.color);\n }\n\n if (theme.density !== undefined) {\n this.applyDensity(theme.density);\n }\n\n if (theme.typography) {\n this.applyTypography(theme.typography);\n }\n\n document.body.style.setProperty(`--theme-name`, themeName);\n }\n\n // endregion\n\n // region get theme configuration state\n\n public getDensity(): ThemeDensity {\n let density = 0;\n document.body.classList.forEach((className) => {\n const match = className.match(/density-([123])/);\n if (match) {\n density = Number(match[1]) * -1;\n }\n });\n return density as ThemeDensity;\n }\n\n public getTypography(): string {\n const variable = document.body.style.getPropertyValue('--font-family');\n const match = variable.match(/var\\(--font-family-(.*)\\)/);\n if (match) {\n return match[1];\n }\n return 'default';\n }\n\n public getTheme() {\n return document.body.style.getPropertyValue('--theme-name') || 'default';\n }\n\n // endregion\n\n // region get available\n\n public getAvailableColorPalettes(): string[] | null {\n const colorPalettesConfigs: Record<string, unknown> | boolean = this.config.get('colorPalettes', false);\n if (!colorPalettesConfigs) {\n return null;\n }\n const availableColorPalettes: string[] = Object.keys(colorPalettesConfigs);\n availableColorPalettes.unshift('default');\n return availableColorPalettes;\n }\n\n public getAvailableThemes(): string[] | null {\n const themeConfigs: Record<string, unknown> | boolean = this.config.get('themes', false);\n if (!themeConfigs) {\n return null;\n }\n const availableThemes: string[] = Object.keys(themeConfigs);\n availableThemes.unshift('default');\n return availableThemes;\n }\n\n public getAvailableTypographies(): string[] | null {\n const availableTypographies = this.config.get('typographies', false);\n if (!availableTypographies) {\n return null;\n }\n return Array\n .from(document.styleSheets)\n .filter(sheet => sheet.href === null || sheet.href.startsWith(window.location.origin))\n .flatMap(sheet => Array.from(sheet.cssRules || []))\n .filter((rule: any) => rule.selectorText === ':root')\n .flatMap((rule: any) => Array.from(rule.style))\n .filter((prop: any) => prop.startsWith('--'))\n .filter((prop: any) => prop.startsWith('--font-family-'))\n .map((prop: any) => prop.replace('--font-family-', ''))\n .sort();\n }\n\n // endregion\n\n public getColorPalette(colorPaletteName: string): Partial<ColorPalette> {\n const colorPaletteConfig = this.config.getOrThrow<ColorPaletteConfig>(`colorPalettes.${ colorPaletteName }`);\n return this.coerceColorPalette(colorPaletteConfig);\n }\n\n // region utility\n\n private coerceColorPalette(colorPaletteConfig: ColorPaletteConfig): Partial<ColorPalette> {\n let colorPalette: Partial<ColorPalette> = {};\n\n if (colorPaletteConfig.color) {\n if (Object.keys(colorPaletteConfig.color).length !== 14) {\n // the color palette is not complete\n if (colorPaletteConfig.base) {\n colorPalette =\n ComputeColorPalette(colorPaletteConfig.base, colorPaletteConfig.color, colorPaletteConfig.algorithm);\n } else {\n colorPalette = colorPaletteConfig.color;\n }\n } else {\n colorPalette = colorPaletteConfig.color;\n }\n } else if (colorPaletteConfig.base) {\n colorPalette = ComputeColorPalette(colorPaletteConfig.base, {}, colorPaletteConfig.algorithm);\n }\n\n if (Object.keys(colorPalette).length === 0) {\n throw new Error('FATAL: The color palette has neither a base nor a color property');\n }\n\n return colorPalette;\n }\n\n private getThemeConfig(themeName: string): ThemeConfig {\n const themeConfig = this.config.getOrThrow<ThemeConfig>(`themes.${ themeName }`);\n\n if (themeConfig.accentColor) {\n themeConfig.accentColor.color = this.coerceColorPalette(themeConfig.accentColor);\n }\n\n if (themeConfig.primaryColor) {\n themeConfig.primaryColor.color = this.coerceColorPalette(themeConfig.primaryColor);\n }\n\n if (themeConfig.warnColor) {\n themeConfig.warnColor.color = this.coerceColorPalette(themeConfig.warnColor);\n }\n\n return themeConfig;\n }\n\n private setCssColorVariables(name: string, colorPalette: Partial<ColorPalette>): void {\n this.clearCssColorVariables(name);\n for (const [ index, color ] of Object.entries(colorPalette)) {\n document.body.style.setProperty(`--${ name }-${ index }`, color);\n }\n }\n\n private clearCssColorVariables(name: string): void {\n document.body.style.removeProperty(`--${ name }-50`);\n for (let index = 100; index <= 900; index += 100) {\n document.body.style.removeProperty(`--${ name }-${ index }`);\n }\n document.body.style.removeProperty(`--${ name }-a100`);\n document.body.style.removeProperty(`--${ name }-a200`);\n document.body.style.removeProperty(`--${ name }-a400`);\n document.body.style.removeProperty(`--${ name }-a700`);\n }\n\n private resetToDefaultTheme() {\n this.clearCssColorVariables('primary');\n this.clearCssColorVariables('accent');\n this.clearCssColorVariables('warn');\n this.setDensity(0);\n this.setTypography('default');\n document.body.style.removeProperty(`--theme-name`);\n localStorage.removeItem(this.themeNameLocalStorageKey);\n localStorage.removeItem(this.densityLocalStorageKey);\n localStorage.removeItem(this.typographyLocalStorageKey);\n }\n\n // endregion\n\n}\n","import {\n inject,\n provideAppInitializer,\n} from '@angular/core';\nimport { ThemeService } from './theme.service';\n\nexport function provideTheme() {\n return [\n provideAppInitializer(() => {\n const initializerFn = ((themeService: ThemeService) => () => themeService.restore())(inject(ThemeService));\n return initializerFn();\n })\n ];\n}\n","// region \nexport * from './lib/compute-color-palette';\nexport * from './lib/observe-current-theme-density';\nexport * from './lib/provide';\nexport * from './lib/theme-mode.service';\nexport * from './lib/theme.service';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;IAwBY;AAAZ,CAAA,UAAY,qBAAqB,EAAA;AAC/B,IAAA,qBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AACzB,IAAA,qBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,GAAA,EAAA,CAAA,CAAA;AAK3B,SAAU,mBAAmB,CACjC,KAAiB,EACjB,YAAA,GAAsC,EAAE,EACxC,SAA0C,EAAA;AAE1C,IAAA,YAAY,GAAG,EAAE,GAAG,YAAY,EAAE;AAElC,IAAA,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC;IAC1C,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;IACrF,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;IAE/C,QAAQ,SAAS;QAEf,KAAK,qBAAqB,CAAC,UAAU;AACnC,YAAA,YAAY,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE;AAC3D,YAAA,YAAY,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE;AAC5D,YAAA,YAAY,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE;AAC5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AAA;;2FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;SCvClB,YAAY,GAAA;IAC1B,OAAO;QACL,qBAAqB,CAAC,MAAK;YACvB,MAAM,aAAa,GAAG,CAAC,CAAC,YAA0B,KAAK,MAAM,YAAY,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;YAC1G,OAAO,aAAa,EAAE;AACxB,QAAA,CAAC;KACJ;AACH;;ACbA;AAMA;;ACNA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
- "version": "19.2.0",
2
+ "version": "21.0.1-dev.1",
3
3
  "name": "@rxap/ngx-theme",
4
4
  "description": "This package provides an Angular theme service that allows you to manage and customize the look and feel of your application. It includes features such as dark mode support, theme density control, typography settings, and color palette management. The service also provides utilities for computing color palettes and observing theme density changes.\n",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "dependencies": {
7
7
  "@ctrl/tinycolor": "^4.0.2",
8
- "@nx/devkit": "20.5.0",
8
+ "@nx/devkit": "22.7.5",
9
9
  "tslib": "2.6.2"
10
10
  },
11
11
  "peerDependencies": {
12
- "@angular/cdk": "^19.1.1",
13
- "@angular/core": "^19.2.1",
14
- "@rxap/config": "^19.3.0",
15
- "@rxap/ngx-pub-sub": "^19.1.0",
16
- "@rxap/rxjs": "^1.1.17",
17
- "@rxap/utilities": "^16.5.1",
18
- "rxjs": "^7.8.1"
12
+ "@angular/cdk": "^21.2.9",
13
+ "@angular/core": "^21.2.9",
14
+ "@rxap/config": "^21.0.1-dev.1",
15
+ "@rxap/ngx-pub-sub": "^21.0.1-dev.1",
16
+ "@rxap/rxjs": "^1.1.18-dev.1",
17
+ "@rxap/utilities": "^16.5.2-dev.1",
18
+ "rxjs": "^7.8.2"
19
19
  },
20
20
  "author": {
21
21
  "name": "Merzough Münker",
@@ -39,35 +39,39 @@
39
39
  "packageGroup": [
40
40
  {
41
41
  "package": "@angular/cdk",
42
- "version": "19.2.19"
42
+ "version": "21.2.9"
43
43
  },
44
44
  {
45
45
  "package": "@angular/common",
46
- "version": "19.2.16"
46
+ "version": "21.2.9"
47
47
  },
48
48
  {
49
49
  "package": "@angular/core",
50
- "version": "19.2.16"
50
+ "version": "21.2.9"
51
+ },
52
+ {
53
+ "package": "@angular/platform-browser",
54
+ "version": "21.2.9"
51
55
  },
52
56
  {
53
57
  "package": "@rxap/config",
54
- "version": "19.3.0"
58
+ "version": "21.0.1-dev.1"
55
59
  },
56
60
  {
57
61
  "package": "@rxap/environment",
58
- "version": "19.2.0"
62
+ "version": "21.0.1-dev.1"
59
63
  },
60
64
  {
61
65
  "package": "@rxap/ngx-pub-sub",
62
- "version": "19.1.0"
66
+ "version": "21.0.1-dev.1"
63
67
  },
64
68
  {
65
69
  "package": "@rxap/rxjs",
66
- "version": "1.1.17"
70
+ "version": "1.1.18-dev.1"
67
71
  },
68
72
  {
69
73
  "package": "@rxap/utilities",
70
- "version": "16.5.1"
74
+ "version": "16.5.2-dev.1"
71
75
  }
72
76
  ]
73
77
  },
@@ -83,15 +87,16 @@
83
87
  "schematics": "./generators.json",
84
88
  "sideEffects": false,
85
89
  "module": "fesm2022/rxap-ngx-theme.mjs",
86
- "typings": "index.d.ts",
90
+ "typings": "types/rxap-ngx-theme.d.ts",
87
91
  "exports": {
88
92
  "./package.json": {
89
93
  "default": "./package.json"
90
94
  },
91
95
  ".": {
92
- "types": "./index.d.ts",
96
+ "types": "./types/rxap-ngx-theme.d.ts",
93
97
  "default": "./fesm2022/rxap-ngx-theme.mjs"
94
98
  },
95
99
  "./theme": "./theme.css"
96
- }
100
+ },
101
+ "type": "module"
97
102
  }
@@ -0,0 +1,151 @@
1
+ import { ColorInput } from '@ctrl/tinycolor';
2
+ import { ThemeDensity } from '@rxap/utilities';
3
+ import { Observable, Subscription } from 'rxjs';
4
+ import * as i0 from '@angular/core';
5
+ import { OnDestroy, WritableSignal } from '@angular/core';
6
+ import { MediaMatcher } from '@angular/cdk/layout';
7
+ import { ConfigService } from '@rxap/config';
8
+ import { PubSubService } from '@rxap/ngx-pub-sub';
9
+
10
+ interface ColorPalette {
11
+ 50: string;
12
+ 100: string;
13
+ 200: string;
14
+ 300: string;
15
+ 400: string;
16
+ 500: string;
17
+ 600: string;
18
+ 700: string;
19
+ 800: string;
20
+ 900: string;
21
+ A100: string;
22
+ A200: string;
23
+ A400: string;
24
+ A700: string;
25
+ }
26
+ declare enum ColorPaletteAlgorithm {
27
+ CONSTANTIN = "constantin",
28
+ BUCKNER = "buckner"
29
+ }
30
+ declare function ComputeColorPalette(color: ColorInput, colorPalette?: Partial<ColorPalette>, algorithm?: ColorPaletteAlgorithm | string): ColorPalette;
31
+
32
+ declare function ObserveCurrentThemeDensity(): Observable<ThemeDensity>;
33
+
34
+ declare function provideTheme(): i0.EnvironmentProviders[];
35
+
36
+ type ThemeSetting = 'system' | 'light' | 'dark';
37
+ type ActiveTheme = 'light' | 'dark';
38
+ declare const THEME_SETTING_KEY = "rxap_theme_settings";
39
+ /**
40
+ * Service to manage theme mode (light/dark/system) for the application.
41
+ * It provides functionality to handle theme preferences, persist them, and synchronize changes.
42
+ *
43
+ * This service integrates with media queries to detect system-level theme changes and allows the user
44
+ * or application logic to toggle or set a specific theme.
45
+ *
46
+ * It utilizes dependency injection to access various required services and the document object.
47
+ * Additionally, it publishes theme-related events for other parts of the application to react to
48
+ * theme changes.
49
+ */
50
+ declare class ThemeModeService implements OnDestroy {
51
+ protected readonly mediaMatcher: MediaMatcher;
52
+ protected readonly document: Document;
53
+ readonly config: ConfigService<any>;
54
+ readonly pubSub: PubSubService;
55
+ readonly activeTheme: WritableSignal<ActiveTheme>;
56
+ readonly themeSetting: WritableSignal<ThemeSetting>;
57
+ readonly darkMode: i0.Signal<boolean>;
58
+ protected readonly darkColorSchemaMediaQuery: MediaQueryList;
59
+ protected readonly subscriptions: Subscription | null;
60
+ protected readonly mediaQueryListener: (this: MediaQueryList, ev: MediaQueryListEventMap['change']) => any;
61
+ protected syncSubscription?: Subscription;
62
+ constructor();
63
+ private get darkModeLocalStorageKey();
64
+ protected restoreFromPubSub(): void;
65
+ /**
66
+ * Cleans up subscriptions and event listeners when the service is destroyed.
67
+ */
68
+ ngOnDestroy(): void;
69
+ protected restoreThemeSetting(): ThemeSetting;
70
+ protected storeThemeSetting(setting: ThemeSetting): void;
71
+ protected removeThemeClasses(): void;
72
+ protected setThemeClasses(active: ActiveTheme): void;
73
+ /**
74
+ * Toggles the application theme between 'light' and 'dark' modes.
75
+ * It checks the currently active theme and switches to the opposite mode.
76
+ *
77
+ * @return {void} Does not return a value.
78
+ */
79
+ toggleTheme(): void;
80
+ /**
81
+ * Sets the active theme for the application and optionally publishes the change.
82
+ *
83
+ * @param {ActiveTheme} active - The theme to be set as active.
84
+ * @param {boolean} [publish=true] - Indicates whether to publish the theme change event.
85
+ * @return {void}
86
+ */
87
+ setTheme(active: ActiveTheme, publish?: boolean): void;
88
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeModeService, never>;
89
+ static ɵprov: i0.ɵɵInjectableDeclaration<ThemeModeService>;
90
+ }
91
+
92
+ interface ColorPaletteConfigWithName extends ColorPaletteConfig {
93
+ name?: string;
94
+ }
95
+ interface ThemeConfig {
96
+ primaryColor?: ColorPaletteConfigWithName;
97
+ accentColor?: ColorPaletteConfigWithName;
98
+ warnColor?: ColorPaletteConfigWithName;
99
+ density?: ThemeDensity;
100
+ typography?: string;
101
+ }
102
+ interface ColorPaletteConfig {
103
+ algorithm?: string;
104
+ base?: string;
105
+ color?: Partial<ColorPalette>;
106
+ }
107
+ declare class ThemeService {
108
+ private readonly mediaMatcher;
109
+ readonly config: ConfigService<any>;
110
+ readonly pubSub: PubSubService;
111
+ readonly themeModeService: ThemeModeService;
112
+ readonly darkMode: i0.Signal<boolean>;
113
+ readonly themeName: WritableSignal<string>;
114
+ readonly density: WritableSignal<ThemeDensity>;
115
+ readonly typography: WritableSignal<string>;
116
+ protected syncSubscription?: Subscription;
117
+ constructor();
118
+ restore(): void;
119
+ protected restoreFromPubSub(): void;
120
+ private get themeNameLocalStorageKey();
121
+ private get densityLocalStorageKey();
122
+ private get typographyLocalStorageKey();
123
+ restoreThemeName(): string | null;
124
+ restoreTypography(): string | null;
125
+ restoreDensity(): ThemeDensity | null;
126
+ toggleDarkTheme(): void;
127
+ setDarkTheme(darkMode: boolean, silent?: boolean, publish?: boolean): void;
128
+ setDensity(density: ThemeDensity, silent?: boolean, publish?: boolean): void;
129
+ setTypography(typography: string, silent?: boolean, publish?: boolean): void;
130
+ setTheme(themeName: string, silent?: boolean, publish?: boolean): void;
131
+ applyDensity(density: ThemeDensity): void;
132
+ applyTypography(typography: string): void;
133
+ applyTheme(themeName: string): void;
134
+ getDensity(): ThemeDensity;
135
+ getTypography(): string;
136
+ getTheme(): string;
137
+ getAvailableColorPalettes(): string[] | null;
138
+ getAvailableThemes(): string[] | null;
139
+ getAvailableTypographies(): string[] | null;
140
+ getColorPalette(colorPaletteName: string): Partial<ColorPalette>;
141
+ private coerceColorPalette;
142
+ private getThemeConfig;
143
+ private setCssColorVariables;
144
+ private clearCssColorVariables;
145
+ private resetToDefaultTheme;
146
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
147
+ static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
148
+ }
149
+
150
+ export { ColorPaletteAlgorithm, ComputeColorPalette, ObserveCurrentThemeDensity, THEME_SETTING_KEY, ThemeModeService, ThemeService, provideTheme };
151
+ export type { ActiveTheme, ColorPalette, ColorPaletteConfig, ColorPaletteConfigWithName, ThemeConfig, ThemeSetting };
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './lib/compute-color-palette';
2
- export * from './lib/observe-current-theme-density';
3
- export * from './lib/provide';
4
- export * from './lib/theme-mode.service';
5
- export * from './lib/theme.service';
@@ -1,22 +0,0 @@
1
- import { ColorInput } from '@ctrl/tinycolor';
2
- export interface ColorPalette {
3
- 50: string;
4
- 100: string;
5
- 200: string;
6
- 300: string;
7
- 400: string;
8
- 500: string;
9
- 600: string;
10
- 700: string;
11
- 800: string;
12
- 900: string;
13
- A100: string;
14
- A200: string;
15
- A400: string;
16
- A700: string;
17
- }
18
- export declare enum ColorPaletteAlgorithm {
19
- CONSTANTIN = "constantin",
20
- BUCKNER = "buckner"
21
- }
22
- export declare function ComputeColorPalette(color: ColorInput, colorPalette?: Partial<ColorPalette>, algorithm?: ColorPaletteAlgorithm | string): ColorPalette;