@rxap/ngx-theme 19.0.3 → 19.1.0-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 +10 -0
- package/README.md +85 -0
- package/compodoc/changelog.html +7 -0
- package/compodoc/dependencies.html +6 -6
- package/compodoc/index.html +69 -1
- package/compodoc/injectables/ThemeModeService.html +1256 -0
- package/compodoc/injectables/ThemeService.html +82 -265
- package/compodoc/interfaces/ColorPaletteConfig.html +6 -71
- package/compodoc/interfaces/ColorPaletteConfigWithName.html +6 -71
- package/compodoc/interfaces/ThemeConfig.html +6 -71
- package/compodoc/js/menu-wc.js +6 -0
- package/compodoc/js/menu-wc_es5.js +1 -1
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/miscellaneous/typealiases.html +235 -0
- package/compodoc/miscellaneous/variables.html +32 -0
- package/compodoc/overview.html +1 -1
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +1672 -532
- package/docs/html/assets/hierarchy.js +1 -1
- package/docs/html/assets/highlight.css +28 -0
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/ThemeModeService.html +35 -0
- package/docs/html/classes/ThemeService.html +4 -6
- 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 +60 -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 -0
- package/docs/html/types/ThemeSetting.html +1 -0
- package/docs/html/variables/THEME_SETTING_KEY.html +1 -0
- package/docs/markdown/README.md +86 -1
- package/docs/markdown/classes/ThemeModeService.md +282 -0
- package/docs/markdown/classes/ThemeService.md +39 -69
- 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 +12 -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 +11 -0
- package/docs/markdown/type-aliases/ThemeSetting.md +11 -0
- package/docs/markdown/variables/THEME_SETTING_KEY.md +11 -0
- package/docs/wiki/Class.ThemeModeService.md +278 -0
- package/docs/wiki/Class.ThemeService.md +38 -68
- 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/Home.md +85 -0
- 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 +7 -0
- package/docs/wiki/TypeAlias.ThemeSetting.md +7 -0
- package/docs/wiki/Variable.THEME_SETTING_KEY.md +7 -0
- package/docs/wiki/_Sidebar.md +10 -0
- package/docs/wiki/globals.md +11 -1
- package/fesm2022/rxap-ngx-theme.mjs +145 -64
- package/fesm2022/rxap-ngx-theme.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/theme-mode.service.d.ts +61 -0
- package/lib/theme.service.d.ts +3 -5
- package/package.json +16 -16
|
@@ -316,6 +316,7 @@ import {
|
|
|
316
316
|
ColorPalette,
|
|
317
317
|
ComputeColorPalette,
|
|
318
318
|
} from './compute-color-palette';
|
|
319
|
+
import { ThemeModeService } from './theme-mode.service';
|
|
319
320
|
|
|
320
321
|
export interface ColorPaletteConfigWithName extends ColorPaletteConfig {
|
|
321
322
|
name?: string;
|
|
@@ -341,39 +342,25 @@ export class ThemeService {
|
|
|
341
342
|
public readonly config = inject(ConfigService);
|
|
342
343
|
public readonly pubSub = inject(PubSubService);
|
|
343
344
|
|
|
344
|
-
public readonly
|
|
345
|
+
public readonly themeModeService = inject(ThemeModeService);
|
|
346
|
+
|
|
347
|
+
public readonly darkMode = this.themeModeService.darkMode;
|
|
345
348
|
public readonly themeName: WritableSignal<string>;
|
|
346
349
|
public readonly density: WritableSignal<ThemeDensity>;
|
|
347
350
|
public readonly typography: WritableSignal<string>;
|
|
348
351
|
|
|
349
|
-
protected readonly darkModeMediaQuery: MediaQueryList;
|
|
350
|
-
|
|
351
352
|
protected syncSubscription?: Subscription;
|
|
352
353
|
|
|
353
354
|
constructor(private readonly mediaMatcher: MediaMatcher) {
|
|
354
|
-
this.darkModeMediaQuery = this.mediaMatcher.matchMedia('(prefers-color-scheme: dark)');
|
|
355
|
-
this.darkMode = signal(this.darkModeMediaQuery.matches);
|
|
356
355
|
this.themeName = signal(this.getTheme());
|
|
357
356
|
this.density = signal(this.getDensity());
|
|
358
357
|
this.typography = signal(this.getTypography());
|
|
359
|
-
this.darkModeMediaQuery.addEventListener('change', (event) => {
|
|
360
|
-
this.setDarkTheme(event.matches, true);
|
|
361
|
-
});
|
|
362
358
|
}
|
|
363
359
|
|
|
364
360
|
public restore() {
|
|
365
361
|
if (isDevMode()) {
|
|
366
362
|
console.log('Restore theme settings from local storage');
|
|
367
363
|
}
|
|
368
|
-
// region restore dark mode
|
|
369
|
-
let darkMode = this.restoreDarkMode();
|
|
370
|
-
// if the dark/light mode is not restored from the local storage
|
|
371
|
-
if (darkMode === null) {
|
|
372
|
-
// set the dark mode based on the media query
|
|
373
|
-
darkMode = this.darkModeMediaQuery.matches;
|
|
374
|
-
this.setDarkTheme(darkMode, true);
|
|
375
|
-
}
|
|
376
|
-
// endregion
|
|
377
364
|
|
|
378
365
|
this.restoreThemeName();
|
|
379
366
|
this.restoreDensity();
|
|
@@ -405,18 +392,6 @@ export class ThemeService {
|
|
|
405
392
|
isDefined(),
|
|
406
393
|
tap(data => this.setTypography(data, false, false))
|
|
407
394
|
).subscribe());
|
|
408
|
-
this.syncSubscription.add(this.pubSub.subscribe<boolean>(RXAP_TOPICS.theme.darkMode.restore).pipe(
|
|
409
|
-
debounceTime(1000),
|
|
410
|
-
map(event => event.data),
|
|
411
|
-
isDefined(),
|
|
412
|
-
tap(data => this.setDarkTheme(data, false, false))
|
|
413
|
-
).subscribe());
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
private get darkModeLocalStorageKey() {
|
|
417
|
-
return (
|
|
418
|
-
window as any
|
|
419
|
-
)?.['__rxap__']?.['ngx']?.['theme']?.['darkMode']?.['key'] ?? `rxap-dark-mode`;
|
|
420
395
|
}
|
|
421
396
|
|
|
422
397
|
private get themeNameLocalStorageKey() {
|
|
@@ -439,21 +414,6 @@ export class ThemeService {
|
|
|
439
414
|
|
|
440
415
|
// region restore
|
|
441
416
|
|
|
442
|
-
public restoreDarkMode() {
|
|
443
|
-
let darkMode: boolean | null = null;
|
|
444
|
-
const darkModeCached = localStorage.getItem(this.darkModeLocalStorageKey);
|
|
445
|
-
if (darkModeCached === 'true') {
|
|
446
|
-
darkMode = true;
|
|
447
|
-
}
|
|
448
|
-
if (darkModeCached === 'false') {
|
|
449
|
-
darkMode = false;
|
|
450
|
-
}
|
|
451
|
-
if (darkMode !== null) {
|
|
452
|
-
this.setDarkTheme(darkMode, true);
|
|
453
|
-
}
|
|
454
|
-
return darkMode;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
417
|
public restoreThemeName() {
|
|
458
418
|
const themeName = localStorage.getItem(this.themeNameLocalStorageKey);
|
|
459
419
|
if (themeName) {
|
|
@@ -485,22 +445,13 @@ export class ThemeService {
|
|
|
485
445
|
// endregion
|
|
486
446
|
|
|
487
447
|
public toggleDarkTheme(): void {
|
|
488
|
-
this.
|
|
448
|
+
this.themeModeService.toggleTheme();
|
|
489
449
|
}
|
|
490
450
|
|
|
491
451
|
// region set theme configuration state
|
|
492
452
|
|
|
493
453
|
public setDarkTheme(darkMode: boolean, silent = false, publish = true): void {
|
|
494
|
-
this.
|
|
495
|
-
if (this.darkMode() !== darkMode) {
|
|
496
|
-
this.darkMode.set(darkMode);
|
|
497
|
-
if (!silent) {
|
|
498
|
-
localStorage.setItem(this.darkModeLocalStorageKey, String(darkMode));
|
|
499
|
-
if (publish) {
|
|
500
|
-
this.pubSub.publish(RXAP_TOPICS.theme.darkMode.changed, darkMode);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
}
|
|
454
|
+
this.themeModeService.setTheme(darkMode ? 'dark' : 'light', publish);
|
|
504
455
|
}
|
|
505
456
|
|
|
506
457
|
public setDensity(density: ThemeDensity, silent = false, publish = true): void {
|
|
@@ -548,22 +499,6 @@ export class ThemeService {
|
|
|
548
499
|
|
|
549
500
|
// region apply theme configuration state
|
|
550
501
|
|
|
551
|
-
public applyDarkMode(darkMode: boolean): void {
|
|
552
|
-
if (darkMode) {
|
|
553
|
-
// region deprecated
|
|
554
|
-
document.body.classList.add('dark-theme');
|
|
555
|
-
localStorage.removeItem('rxap-light-theme');
|
|
556
|
-
// endregion
|
|
557
|
-
document.body.classList.add('dark');
|
|
558
|
-
} else {
|
|
559
|
-
// region deprecated
|
|
560
|
-
document.body.classList.remove('dark-theme');
|
|
561
|
-
localStorage.setItem('rxap-light-theme', 'true');
|
|
562
|
-
// endregion
|
|
563
|
-
document.body.classList.remove('dark');
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
502
|
public applyDensity(density: ThemeDensity): void {
|
|
568
503
|
document.body.classList.remove('density-0', 'density-1', 'density-2', 'density-3');
|
|
569
504
|
if (density < 0) {
|
|
@@ -232,6 +232,7 @@ import {
|
|
|
232
232
|
ColorPalette,
|
|
233
233
|
ComputeColorPalette,
|
|
234
234
|
} from './compute-color-palette';
|
|
235
|
+
import { ThemeModeService } from './theme-mode.service';
|
|
235
236
|
|
|
236
237
|
export interface ColorPaletteConfigWithName extends ColorPaletteConfig {
|
|
237
238
|
name?: string;
|
|
@@ -257,39 +258,25 @@ export class ThemeService {
|
|
|
257
258
|
public readonly config = inject(ConfigService);
|
|
258
259
|
public readonly pubSub = inject(PubSubService);
|
|
259
260
|
|
|
260
|
-
public readonly
|
|
261
|
+
public readonly themeModeService = inject(ThemeModeService);
|
|
262
|
+
|
|
263
|
+
public readonly darkMode = this.themeModeService.darkMode;
|
|
261
264
|
public readonly themeName: WritableSignal<string>;
|
|
262
265
|
public readonly density: WritableSignal<ThemeDensity>;
|
|
263
266
|
public readonly typography: WritableSignal<string>;
|
|
264
267
|
|
|
265
|
-
protected readonly darkModeMediaQuery: MediaQueryList;
|
|
266
|
-
|
|
267
268
|
protected syncSubscription?: Subscription;
|
|
268
269
|
|
|
269
270
|
constructor(private readonly mediaMatcher: MediaMatcher) {
|
|
270
|
-
this.darkModeMediaQuery = this.mediaMatcher.matchMedia('(prefers-color-scheme: dark)');
|
|
271
|
-
this.darkMode = signal(this.darkModeMediaQuery.matches);
|
|
272
271
|
this.themeName = signal(this.getTheme());
|
|
273
272
|
this.density = signal(this.getDensity());
|
|
274
273
|
this.typography = signal(this.getTypography());
|
|
275
|
-
this.darkModeMediaQuery.addEventListener('change', (event) => {
|
|
276
|
-
this.setDarkTheme(event.matches, true);
|
|
277
|
-
});
|
|
278
274
|
}
|
|
279
275
|
|
|
280
276
|
public restore() {
|
|
281
277
|
if (isDevMode()) {
|
|
282
278
|
console.log('Restore theme settings from local storage');
|
|
283
279
|
}
|
|
284
|
-
// region restore dark mode
|
|
285
|
-
let darkMode = this.restoreDarkMode();
|
|
286
|
-
// if the dark/light mode is not restored from the local storage
|
|
287
|
-
if (darkMode === null) {
|
|
288
|
-
// set the dark mode based on the media query
|
|
289
|
-
darkMode = this.darkModeMediaQuery.matches;
|
|
290
|
-
this.setDarkTheme(darkMode, true);
|
|
291
|
-
}
|
|
292
|
-
// endregion
|
|
293
280
|
|
|
294
281
|
this.restoreThemeName();
|
|
295
282
|
this.restoreDensity();
|
|
@@ -321,18 +308,6 @@ export class ThemeService {
|
|
|
321
308
|
isDefined(),
|
|
322
309
|
tap(data => this.setTypography(data, false, false))
|
|
323
310
|
).subscribe());
|
|
324
|
-
this.syncSubscription.add(this.pubSub.subscribe<boolean>(RXAP_TOPICS.theme.darkMode.restore).pipe(
|
|
325
|
-
debounceTime(1000),
|
|
326
|
-
map(event => event.data),
|
|
327
|
-
isDefined(),
|
|
328
|
-
tap(data => this.setDarkTheme(data, false, false))
|
|
329
|
-
).subscribe());
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
private get darkModeLocalStorageKey() {
|
|
333
|
-
return (
|
|
334
|
-
window as any
|
|
335
|
-
)?.['__rxap__']?.['ngx']?.['theme']?.['darkMode']?.['key'] ?? `rxap-dark-mode`;
|
|
336
311
|
}
|
|
337
312
|
|
|
338
313
|
private get themeNameLocalStorageKey() {
|
|
@@ -355,21 +330,6 @@ export class ThemeService {
|
|
|
355
330
|
|
|
356
331
|
// region restore
|
|
357
332
|
|
|
358
|
-
public restoreDarkMode() {
|
|
359
|
-
let darkMode: boolean | null = null;
|
|
360
|
-
const darkModeCached = localStorage.getItem(this.darkModeLocalStorageKey);
|
|
361
|
-
if (darkModeCached === 'true') {
|
|
362
|
-
darkMode = true;
|
|
363
|
-
}
|
|
364
|
-
if (darkModeCached === 'false') {
|
|
365
|
-
darkMode = false;
|
|
366
|
-
}
|
|
367
|
-
if (darkMode !== null) {
|
|
368
|
-
this.setDarkTheme(darkMode, true);
|
|
369
|
-
}
|
|
370
|
-
return darkMode;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
333
|
public restoreThemeName() {
|
|
374
334
|
const themeName = localStorage.getItem(this.themeNameLocalStorageKey);
|
|
375
335
|
if (themeName) {
|
|
@@ -401,22 +361,13 @@ export class ThemeService {
|
|
|
401
361
|
// endregion
|
|
402
362
|
|
|
403
363
|
public toggleDarkTheme(): void {
|
|
404
|
-
this.
|
|
364
|
+
this.themeModeService.toggleTheme();
|
|
405
365
|
}
|
|
406
366
|
|
|
407
367
|
// region set theme configuration state
|
|
408
368
|
|
|
409
369
|
public setDarkTheme(darkMode: boolean, silent = false, publish = true): void {
|
|
410
|
-
this.
|
|
411
|
-
if (this.darkMode() !== darkMode) {
|
|
412
|
-
this.darkMode.set(darkMode);
|
|
413
|
-
if (!silent) {
|
|
414
|
-
localStorage.setItem(this.darkModeLocalStorageKey, String(darkMode));
|
|
415
|
-
if (publish) {
|
|
416
|
-
this.pubSub.publish(RXAP_TOPICS.theme.darkMode.changed, darkMode);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
370
|
+
this.themeModeService.setTheme(darkMode ? 'dark' : 'light', publish);
|
|
420
371
|
}
|
|
421
372
|
|
|
422
373
|
public setDensity(density: ThemeDensity, silent = false, publish = true): void {
|
|
@@ -464,22 +415,6 @@ export class ThemeService {
|
|
|
464
415
|
|
|
465
416
|
// region apply theme configuration state
|
|
466
417
|
|
|
467
|
-
public applyDarkMode(darkMode: boolean): void {
|
|
468
|
-
if (darkMode) {
|
|
469
|
-
// region deprecated
|
|
470
|
-
document.body.classList.add('dark-theme');
|
|
471
|
-
localStorage.removeItem('rxap-light-theme');
|
|
472
|
-
// endregion
|
|
473
|
-
document.body.classList.add('dark');
|
|
474
|
-
} else {
|
|
475
|
-
// region deprecated
|
|
476
|
-
document.body.classList.remove('dark-theme');
|
|
477
|
-
localStorage.setItem('rxap-light-theme', 'true');
|
|
478
|
-
// endregion
|
|
479
|
-
document.body.classList.remove('dark');
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
418
|
public applyDensity(density: ThemeDensity): void {
|
|
484
419
|
document.body.classList.remove('density-0', 'density-1', 'density-2', 'density-3');
|
|
485
420
|
if (density < 0) {
|
|
@@ -406,6 +406,7 @@ import {
|
|
|
406
406
|
ColorPalette,
|
|
407
407
|
ComputeColorPalette,
|
|
408
408
|
} from './compute-color-palette';
|
|
409
|
+
import { ThemeModeService } from './theme-mode.service';
|
|
409
410
|
|
|
410
411
|
export interface ColorPaletteConfigWithName extends ColorPaletteConfig {
|
|
411
412
|
name?: string;
|
|
@@ -431,39 +432,25 @@ export class ThemeService {
|
|
|
431
432
|
public readonly config = inject(ConfigService);
|
|
432
433
|
public readonly pubSub = inject(PubSubService);
|
|
433
434
|
|
|
434
|
-
public readonly
|
|
435
|
+
public readonly themeModeService = inject(ThemeModeService);
|
|
436
|
+
|
|
437
|
+
public readonly darkMode = this.themeModeService.darkMode;
|
|
435
438
|
public readonly themeName: WritableSignal<string>;
|
|
436
439
|
public readonly density: WritableSignal<ThemeDensity>;
|
|
437
440
|
public readonly typography: WritableSignal<string>;
|
|
438
441
|
|
|
439
|
-
protected readonly darkModeMediaQuery: MediaQueryList;
|
|
440
|
-
|
|
441
442
|
protected syncSubscription?: Subscription;
|
|
442
443
|
|
|
443
444
|
constructor(private readonly mediaMatcher: MediaMatcher) {
|
|
444
|
-
this.darkModeMediaQuery = this.mediaMatcher.matchMedia('(prefers-color-scheme: dark)');
|
|
445
|
-
this.darkMode = signal(this.darkModeMediaQuery.matches);
|
|
446
445
|
this.themeName = signal(this.getTheme());
|
|
447
446
|
this.density = signal(this.getDensity());
|
|
448
447
|
this.typography = signal(this.getTypography());
|
|
449
|
-
this.darkModeMediaQuery.addEventListener('change', (event) => {
|
|
450
|
-
this.setDarkTheme(event.matches, true);
|
|
451
|
-
});
|
|
452
448
|
}
|
|
453
449
|
|
|
454
450
|
public restore() {
|
|
455
451
|
if (isDevMode()) {
|
|
456
452
|
console.log('Restore theme settings from local storage');
|
|
457
453
|
}
|
|
458
|
-
// region restore dark mode
|
|
459
|
-
let darkMode = this.restoreDarkMode();
|
|
460
|
-
// if the dark/light mode is not restored from the local storage
|
|
461
|
-
if (darkMode === null) {
|
|
462
|
-
// set the dark mode based on the media query
|
|
463
|
-
darkMode = this.darkModeMediaQuery.matches;
|
|
464
|
-
this.setDarkTheme(darkMode, true);
|
|
465
|
-
}
|
|
466
|
-
// endregion
|
|
467
454
|
|
|
468
455
|
this.restoreThemeName();
|
|
469
456
|
this.restoreDensity();
|
|
@@ -495,18 +482,6 @@ export class ThemeService {
|
|
|
495
482
|
isDefined(),
|
|
496
483
|
tap(data => this.setTypography(data, false, false))
|
|
497
484
|
).subscribe());
|
|
498
|
-
this.syncSubscription.add(this.pubSub.subscribe<boolean>(RXAP_TOPICS.theme.darkMode.restore).pipe(
|
|
499
|
-
debounceTime(1000),
|
|
500
|
-
map(event => event.data),
|
|
501
|
-
isDefined(),
|
|
502
|
-
tap(data => this.setDarkTheme(data, false, false))
|
|
503
|
-
).subscribe());
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
private get darkModeLocalStorageKey() {
|
|
507
|
-
return (
|
|
508
|
-
window as any
|
|
509
|
-
)?.['__rxap__']?.['ngx']?.['theme']?.['darkMode']?.['key'] ?? `rxap-dark-mode`;
|
|
510
485
|
}
|
|
511
486
|
|
|
512
487
|
private get themeNameLocalStorageKey() {
|
|
@@ -529,21 +504,6 @@ export class ThemeService {
|
|
|
529
504
|
|
|
530
505
|
// region restore
|
|
531
506
|
|
|
532
|
-
public restoreDarkMode() {
|
|
533
|
-
let darkMode: boolean | null = null;
|
|
534
|
-
const darkModeCached = localStorage.getItem(this.darkModeLocalStorageKey);
|
|
535
|
-
if (darkModeCached === 'true') {
|
|
536
|
-
darkMode = true;
|
|
537
|
-
}
|
|
538
|
-
if (darkModeCached === 'false') {
|
|
539
|
-
darkMode = false;
|
|
540
|
-
}
|
|
541
|
-
if (darkMode !== null) {
|
|
542
|
-
this.setDarkTheme(darkMode, true);
|
|
543
|
-
}
|
|
544
|
-
return darkMode;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
507
|
public restoreThemeName() {
|
|
548
508
|
const themeName = localStorage.getItem(this.themeNameLocalStorageKey);
|
|
549
509
|
if (themeName) {
|
|
@@ -575,22 +535,13 @@ export class ThemeService {
|
|
|
575
535
|
// endregion
|
|
576
536
|
|
|
577
537
|
public toggleDarkTheme(): void {
|
|
578
|
-
this.
|
|
538
|
+
this.themeModeService.toggleTheme();
|
|
579
539
|
}
|
|
580
540
|
|
|
581
541
|
// region set theme configuration state
|
|
582
542
|
|
|
583
543
|
public setDarkTheme(darkMode: boolean, silent = false, publish = true): void {
|
|
584
|
-
this.
|
|
585
|
-
if (this.darkMode() !== darkMode) {
|
|
586
|
-
this.darkMode.set(darkMode);
|
|
587
|
-
if (!silent) {
|
|
588
|
-
localStorage.setItem(this.darkModeLocalStorageKey, String(darkMode));
|
|
589
|
-
if (publish) {
|
|
590
|
-
this.pubSub.publish(RXAP_TOPICS.theme.darkMode.changed, darkMode);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
}
|
|
544
|
+
this.themeModeService.setTheme(darkMode ? 'dark' : 'light', publish);
|
|
594
545
|
}
|
|
595
546
|
|
|
596
547
|
public setDensity(density: ThemeDensity, silent = false, publish = true): void {
|
|
@@ -638,22 +589,6 @@ export class ThemeService {
|
|
|
638
589
|
|
|
639
590
|
// region apply theme configuration state
|
|
640
591
|
|
|
641
|
-
public applyDarkMode(darkMode: boolean): void {
|
|
642
|
-
if (darkMode) {
|
|
643
|
-
// region deprecated
|
|
644
|
-
document.body.classList.add('dark-theme');
|
|
645
|
-
localStorage.removeItem('rxap-light-theme');
|
|
646
|
-
// endregion
|
|
647
|
-
document.body.classList.add('dark');
|
|
648
|
-
} else {
|
|
649
|
-
// region deprecated
|
|
650
|
-
document.body.classList.remove('dark-theme');
|
|
651
|
-
localStorage.setItem('rxap-light-theme', 'true');
|
|
652
|
-
// endregion
|
|
653
|
-
document.body.classList.remove('dark');
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
592
|
public applyDensity(density: ThemeDensity): void {
|
|
658
593
|
document.body.classList.remove('density-0', 'density-1', 'density-2', 'density-3');
|
|
659
594
|
if (density < 0) {
|
package/compodoc/js/menu-wc.js
CHANGED
|
@@ -63,6 +63,9 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
|
|
63
63
|
<span class="icon ion-ios-arrow-down"></span>
|
|
64
64
|
</div>
|
|
65
65
|
<ul class="links collapse " ${ isNormalMode ? 'id="injectables-links"' : 'id="xs-injectables-links"' }>
|
|
66
|
+
<li class="link">
|
|
67
|
+
<a href="injectables/ThemeModeService.html" data-type="entity-link" >ThemeModeService</a>
|
|
68
|
+
</li>
|
|
66
69
|
<li class="link">
|
|
67
70
|
<a href="injectables/ThemeService.html" data-type="entity-link" >ThemeService</a>
|
|
68
71
|
</li>
|
|
@@ -104,6 +107,9 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
|
|
104
107
|
<li class="link">
|
|
105
108
|
<a href="miscellaneous/functions.html" data-type="entity-link">Functions</a>
|
|
106
109
|
</li>
|
|
110
|
+
<li class="link">
|
|
111
|
+
<a href="miscellaneous/typealiases.html" data-type="entity-link">Type aliases</a>
|
|
112
|
+
</li>
|
|
107
113
|
<li class="link">
|
|
108
114
|
<a href="miscellaneous/variables.html" data-type="entity-link">Variables</a>
|
|
109
115
|
</li>
|
|
@@ -33,7 +33,7 @@ customElements.define('compodoc-menu', /*#__PURE__*/function (_HTMLElement) {
|
|
|
33
33
|
}, {
|
|
34
34
|
key: "render",
|
|
35
35
|
value: function render(isNormalMode) {
|
|
36
|
-
var tp = lithtml.html("\n <nav>\n <ul class=\"list\">\n <li class=\"title\">\n <a href=\"index.html\" data-type=\"index-link\">angular-theme</a>\n </li>\n\n <li class=\"divider\"></li>\n ".concat(isNormalMode ? "<div id=\"book-search-input\" role=\"search\"><input type=\"text\" placeholder=\"Type to search\"></div>" : '', "\n <li class=\"chapter\">\n <a data-type=\"chapter-link\" href=\"index.html\"><span class=\"icon ion-ios-home\"></span>Getting started</a>\n <ul class=\"links\">\n <li class=\"link\">\n <a href=\"overview.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-keypad\"></span>Overview\n </a>\n </li>\n <li class=\"link\">\n <a href=\"index.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-paper\"></span>README\n </a>\n </li>\n <li class=\"link\">\n <a href=\"changelog.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-paper\"></span>CHANGELOG\n </a>\n </li>\n <li class=\"link\">\n <a href=\"license.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-paper\"></span>LICENSE\n </a>\n </li>\n <li class=\"link\">\n <a href=\"dependencies.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-list\"></span>Dependencies\n </a>\n </li>\n <li class=\"link\">\n <a href=\"properties.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-apps\"></span>Properties\n </a>\n </li>\n </ul>\n </li>\n <li class=\"chapter\">\n <div class=\"simple menu-toggler\" data-bs-toggle=\"collapse\" ").concat(isNormalMode ? 'data-bs-target="#injectables-links"' : 'data-bs-target="#xs-injectables-links"', ">\n <span class=\"icon ion-md-arrow-round-down\"></span>\n <span>Injectables</span>\n <span class=\"icon ion-ios-arrow-down\"></span>\n </div>\n <ul class=\"links collapse \" ").concat(isNormalMode ? 'id="injectables-links"' : 'id="xs-injectables-links"', ">\n <li class=\"link\">\n <a href=\"injectables/ThemeService.html\" data-type=\"entity-link\" >ThemeService</a>\n </li>\n </ul>\n </li>\n <li class=\"chapter\">\n <div class=\"simple menu-toggler\" data-bs-toggle=\"collapse\" ").concat(isNormalMode ? 'data-bs-target="#interfaces-links"' : 'data-bs-target="#xs-interfaces-links"', ">\n <span class=\"icon ion-md-information-circle-outline\"></span>\n <span>Interfaces</span>\n <span class=\"icon ion-ios-arrow-down\"></span>\n </div>\n <ul class=\"links collapse \" ").concat(isNormalMode ? ' id="interfaces-links"' : 'id="xs-interfaces-links"', ">\n <li class=\"link\">\n <a href=\"interfaces/ColorPalette.html\" data-type=\"entity-link\" >ColorPalette</a>\n </li>\n <li class=\"link\">\n <a href=\"interfaces/ColorPaletteConfig.html\" data-type=\"entity-link\" >ColorPaletteConfig</a>\n </li>\n <li class=\"link\">\n <a href=\"interfaces/ColorPaletteConfigWithName.html\" data-type=\"entity-link\" >ColorPaletteConfigWithName</a>\n </li>\n <li class=\"link\">\n <a href=\"interfaces/ThemeConfig.html\" data-type=\"entity-link\" >ThemeConfig</a>\n </li>\n </ul>\n </li>\n <li class=\"chapter\">\n <div class=\"simple menu-toggler\" data-bs-toggle=\"collapse\" ").concat(isNormalMode ? 'data-bs-target="#miscellaneous-links"' : 'data-bs-target="#xs-miscellaneous-links"', ">\n <span class=\"icon ion-ios-cube\"></span>\n <span>Miscellaneous</span>\n <span class=\"icon ion-ios-arrow-down\"></span>\n </div>\n <ul class=\"links collapse \" ").concat(isNormalMode ? 'id="miscellaneous-links"' : 'id="xs-miscellaneous-links"', ">\n <li class=\"link\">\n <a href=\"miscellaneous/enumerations.html\" data-type=\"entity-link\">Enums</a>\n </li>\n <li class=\"link\">\n <a href=\"miscellaneous/functions.html\" data-type=\"entity-link\">Functions</a>\n </li>\n <li class=\"link\">\n <a href=\"miscellaneous/variables.html\" data-type=\"entity-link\">Variables</a>\n </li>\n </ul>\n </li>\n <li class=\"divider\"></li>\n <li class=\"copyright\">\n Documentation generated using <a href=\"https://compodoc.app/\" target=\"_blank\" rel=\"noopener noreferrer\">\n <img data-src=\"images/compodoc-vectorise.png\" class=\"img-responsive\" data-type=\"compodoc-logo\">\n </a>\n </li>\n </ul>\n </nav>\n "));
|
|
36
|
+
var tp = lithtml.html("\n <nav>\n <ul class=\"list\">\n <li class=\"title\">\n <a href=\"index.html\" data-type=\"index-link\">angular-theme</a>\n </li>\n\n <li class=\"divider\"></li>\n ".concat(isNormalMode ? "<div id=\"book-search-input\" role=\"search\"><input type=\"text\" placeholder=\"Type to search\"></div>" : '', "\n <li class=\"chapter\">\n <a data-type=\"chapter-link\" href=\"index.html\"><span class=\"icon ion-ios-home\"></span>Getting started</a>\n <ul class=\"links\">\n <li class=\"link\">\n <a href=\"overview.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-keypad\"></span>Overview\n </a>\n </li>\n <li class=\"link\">\n <a href=\"index.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-paper\"></span>README\n </a>\n </li>\n <li class=\"link\">\n <a href=\"changelog.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-paper\"></span>CHANGELOG\n </a>\n </li>\n <li class=\"link\">\n <a href=\"license.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-paper\"></span>LICENSE\n </a>\n </li>\n <li class=\"link\">\n <a href=\"dependencies.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-list\"></span>Dependencies\n </a>\n </li>\n <li class=\"link\">\n <a href=\"properties.html\" data-type=\"chapter-link\">\n <span class=\"icon ion-ios-apps\"></span>Properties\n </a>\n </li>\n </ul>\n </li>\n <li class=\"chapter\">\n <div class=\"simple menu-toggler\" data-bs-toggle=\"collapse\" ").concat(isNormalMode ? 'data-bs-target="#injectables-links"' : 'data-bs-target="#xs-injectables-links"', ">\n <span class=\"icon ion-md-arrow-round-down\"></span>\n <span>Injectables</span>\n <span class=\"icon ion-ios-arrow-down\"></span>\n </div>\n <ul class=\"links collapse \" ").concat(isNormalMode ? 'id="injectables-links"' : 'id="xs-injectables-links"', ">\n <li class=\"link\">\n <a href=\"injectables/ThemeModeService.html\" data-type=\"entity-link\" >ThemeModeService</a>\n </li>\n <li class=\"link\">\n <a href=\"injectables/ThemeService.html\" data-type=\"entity-link\" >ThemeService</a>\n </li>\n </ul>\n </li>\n <li class=\"chapter\">\n <div class=\"simple menu-toggler\" data-bs-toggle=\"collapse\" ").concat(isNormalMode ? 'data-bs-target="#interfaces-links"' : 'data-bs-target="#xs-interfaces-links"', ">\n <span class=\"icon ion-md-information-circle-outline\"></span>\n <span>Interfaces</span>\n <span class=\"icon ion-ios-arrow-down\"></span>\n </div>\n <ul class=\"links collapse \" ").concat(isNormalMode ? ' id="interfaces-links"' : 'id="xs-interfaces-links"', ">\n <li class=\"link\">\n <a href=\"interfaces/ColorPalette.html\" data-type=\"entity-link\" >ColorPalette</a>\n </li>\n <li class=\"link\">\n <a href=\"interfaces/ColorPaletteConfig.html\" data-type=\"entity-link\" >ColorPaletteConfig</a>\n </li>\n <li class=\"link\">\n <a href=\"interfaces/ColorPaletteConfigWithName.html\" data-type=\"entity-link\" >ColorPaletteConfigWithName</a>\n </li>\n <li class=\"link\">\n <a href=\"interfaces/ThemeConfig.html\" data-type=\"entity-link\" >ThemeConfig</a>\n </li>\n </ul>\n </li>\n <li class=\"chapter\">\n <div class=\"simple menu-toggler\" data-bs-toggle=\"collapse\" ").concat(isNormalMode ? 'data-bs-target="#miscellaneous-links"' : 'data-bs-target="#xs-miscellaneous-links"', ">\n <span class=\"icon ion-ios-cube\"></span>\n <span>Miscellaneous</span>\n <span class=\"icon ion-ios-arrow-down\"></span>\n </div>\n <ul class=\"links collapse \" ").concat(isNormalMode ? 'id="miscellaneous-links"' : 'id="xs-miscellaneous-links"', ">\n <li class=\"link\">\n <a href=\"miscellaneous/enumerations.html\" data-type=\"entity-link\">Enums</a>\n </li>\n <li class=\"link\">\n <a href=\"miscellaneous/functions.html\" data-type=\"entity-link\">Functions</a>\n </li>\n <li class=\"link\">\n <a href=\"miscellaneous/typealiases.html\" data-type=\"entity-link\">Type aliases</a>\n </li>\n <li class=\"link\">\n <a href=\"miscellaneous/variables.html\" data-type=\"entity-link\">Variables</a>\n </li>\n </ul>\n </li>\n <li class=\"divider\"></li>\n <li class=\"copyright\">\n Documentation generated using <a href=\"https://compodoc.app/\" target=\"_blank\" rel=\"noopener noreferrer\">\n <img data-src=\"images/compodoc-vectorise.png\" class=\"img-responsive\" data-type=\"compodoc-logo\">\n </a>\n </li>\n </ul>\n </nav>\n "));
|
|
37
37
|
this.innerHTML = tp.strings;
|
|
38
38
|
}
|
|
39
39
|
}]);
|