@rxap/services 16.0.0-dev.16 → 16.0.0-dev.18

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.
@@ -1,13 +1,98 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, isDevMode, Injectable, Optional, Inject } from '@angular/core';
3
- import { Subject, BehaviorSubject, Subscription } from 'rxjs';
2
+ import { Injectable, InjectionToken, isDevMode, Optional, Inject, inject } from '@angular/core';
3
+ import { HttpRequest, HttpParams } from '@angular/common/http';
4
+ import { TinyColor } from '@ctrl/tinycolor';
5
+ import { Subject, BehaviorSubject, Subscription, Observable } from 'rxjs';
4
6
  import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
5
7
  import { map, filter, delay } from 'rxjs/operators';
6
- import * as i1 from '@angular/cdk/layout';
7
- import * as i1$1 from '@angular/router';
8
+ import * as i1 from '@angular/router';
8
9
  import { NavigationStart, NavigationEnd, NavigationCancel, Router } from '@angular/router';
9
- import { HttpRequest, HttpParams } from '@angular/common/http';
10
10
  import { ToggleSubject } from '@rxap/rxjs';
11
+ import * as i1$1 from '@angular/cdk/layout';
12
+ import { ConfigService } from '@rxap/config';
13
+
14
+ class AvatarImageService {
15
+ get({ name }) {
16
+ return new HttpRequest('GET', 'https://eu.ui-avatars.com/api', {
17
+ params: new HttpParams({ fromObject: { name } }),
18
+ }).urlWithParams;
19
+ }
20
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
21
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, providedIn: 'root' }); }
22
+ }
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, decorators: [{
24
+ type: Injectable,
25
+ args: [{ providedIn: 'root' }]
26
+ }] });
27
+
28
+ var ColorPaletteAlgorithm;
29
+ (function (ColorPaletteAlgorithm) {
30
+ ColorPaletteAlgorithm["CONSTANTIN"] = "constantin";
31
+ ColorPaletteAlgorithm["BUCKNER"] = "buckner";
32
+ })(ColorPaletteAlgorithm || (ColorPaletteAlgorithm = {}));
33
+ function ComputeColorPalette(color, colorPalette = {}, algorithm) {
34
+ colorPalette = { ...colorPalette };
35
+ const baseLight = new TinyColor('#ffffff');
36
+ const baseDark = multiply(new TinyColor(color).toRgb(), new TinyColor(color).toRgb());
37
+ const baseTriad = new TinyColor(color).tetrad();
38
+ switch (algorithm) {
39
+ case ColorPaletteAlgorithm.CONSTANTIN:
40
+ colorPalette[50] ??= baseLight.mix(color, 12).toHexString();
41
+ colorPalette[100] ??= baseLight.mix(color, 30).toHexString();
42
+ colorPalette[200] ??= baseLight.mix(color, 50).toHexString();
43
+ colorPalette[300] ??= baseLight.mix(color, 70).toHexString();
44
+ colorPalette[400] ??= baseLight.mix(color, 85).toHexString();
45
+ colorPalette[500] ??= baseLight.mix(color, 100).toHexString();
46
+ colorPalette[600] ??= baseDark.mix(color, 87).toHexString();
47
+ colorPalette[700] ??= baseDark.mix(color, 70).toHexString();
48
+ colorPalette[800] ??= baseDark.mix(color, 54).toHexString();
49
+ colorPalette[900] ??= baseDark.mix(color, 25).toHexString();
50
+ colorPalette.A100 ??= baseDark.mix(baseTriad[4], 15).saturate(80).lighten(65).toHexString();
51
+ colorPalette.A200 ??= baseDark.mix(baseTriad[4], 15).saturate(80).lighten(55).toHexString();
52
+ colorPalette.A400 ??= baseDark.mix(baseTriad[4], 15).saturate(100).lighten(45).toHexString();
53
+ colorPalette.A700 ??= baseDark.mix(baseTriad[4], 15).saturate(100).lighten(40).toHexString();
54
+ break;
55
+ case ColorPaletteAlgorithm.BUCKNER:
56
+ colorPalette[50] ??= baseLight.mix(color, 12).toHexString();
57
+ colorPalette[100] ??= baseLight.mix(color, 30).toHexString();
58
+ colorPalette[200] ??= baseLight.mix(color, 50).toHexString();
59
+ colorPalette[300] ??= baseLight.mix(color, 70).toHexString();
60
+ colorPalette[400] ??= baseLight.mix(color, 85).toHexString();
61
+ colorPalette[500] ??= baseLight.mix(color, 100).toHexString();
62
+ colorPalette[600] ??= baseDark.mix(color, 87).toHexString();
63
+ colorPalette[700] ??= baseDark.mix(color, 70).toHexString();
64
+ colorPalette[800] ??= baseDark.mix(color, 54).toHexString();
65
+ colorPalette[900] ??= baseDark.mix(color, 25).toHexString();
66
+ colorPalette.A100 ??= baseDark.mix(baseTriad[3], 15).saturate(80).lighten(48).toHexString();
67
+ colorPalette.A200 ??= baseDark.mix(baseTriad[3], 15).saturate(80).lighten(36).toHexString();
68
+ colorPalette.A400 ??= baseDark.mix(baseTriad[3], 15).saturate(100).lighten(31).toHexString();
69
+ colorPalette.A700 ??= baseDark.mix(baseTriad[3], 15).saturate(100).lighten(28).toHexString();
70
+ break;
71
+ default:
72
+ colorPalette[50] ??= new TinyColor(color).lighten(52).toHexString();
73
+ colorPalette[100] ??= new TinyColor(color).lighten(37).toHexString();
74
+ colorPalette[200] ??= new TinyColor(color).lighten(26).toHexString();
75
+ colorPalette[300] ??= new TinyColor(color).lighten(12).toHexString();
76
+ colorPalette[400] ??= new TinyColor(color).lighten(6).toHexString();
77
+ colorPalette[500] ??= new TinyColor(color).toHexString();
78
+ colorPalette[600] ??= new TinyColor(color).darken(6).toHexString();
79
+ colorPalette[700] ??= new TinyColor(color).darken(12).toHexString();
80
+ colorPalette[800] ??= new TinyColor(color).darken(18).toHexString();
81
+ colorPalette[900] ??= new TinyColor(color).darken(24).toHexString();
82
+ colorPalette.A100 ??= new TinyColor(color).lighten(50).saturate(30).toHexString();
83
+ colorPalette.A200 ??= new TinyColor(color).lighten(30).saturate(30).toHexString();
84
+ colorPalette.A400 ??= new TinyColor(color).lighten(10).saturate(15).toHexString();
85
+ colorPalette.A700 ??= new TinyColor(color).lighten(5).saturate(5).toHexString();
86
+ break;
87
+ }
88
+ return colorPalette;
89
+ }
90
+ function multiply(rgb1, rgb2) {
91
+ rgb1.b = Math.floor(rgb1.b * rgb2.b / 255);
92
+ rgb1.g = Math.floor(rgb1.g * rgb2.g / 255);
93
+ rgb1.r = Math.floor(rgb1.r * rgb2.r / 255);
94
+ return new TinyColor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b);
95
+ }
11
96
 
12
97
  const RXAP_FOOTER_COMPONENT = new InjectionToken('rxap/services/footer-component');
13
98
  function IsFooterTemplate(obj) {
@@ -184,6 +269,160 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
184
269
  args: [RXAP_FOOTER_COMPONENT]
185
270
  }] }]; } });
186
271
 
272
+ class HeaderService {
273
+ constructor(router) {
274
+ this.router = router;
275
+ this.update$ = new Subject();
276
+ this.components = [];
277
+ this.navigating$ = this.router.events.pipe(filter(event => event instanceof NavigationStart ||
278
+ event instanceof NavigationEnd ||
279
+ event instanceof NavigationCancel), map(event => event instanceof NavigationStart));
280
+ }
281
+ get countComponent() {
282
+ return this.components.length + 1;
283
+ }
284
+ addComponent(component, order = 0) {
285
+ this.components.push({
286
+ component,
287
+ order,
288
+ });
289
+ this.update$.next();
290
+ }
291
+ /**
292
+ * Returns all added components ordered based on the order property
293
+ */
294
+ getComponents() {
295
+ return this
296
+ .components
297
+ .sort((a, b) => a.order - b.order)
298
+ .map(item => item.component);
299
+ }
300
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, deps: [{ token: Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
301
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, providedIn: 'root' }); }
302
+ }
303
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, decorators: [{
304
+ type: Injectable,
305
+ args: [{ providedIn: 'root' }]
306
+ }], ctorParameters: function () { return [{ type: i1.Router, decorators: [{
307
+ type: Inject,
308
+ args: [Router]
309
+ }] }]; } });
310
+
311
+ class ImageLoaderService {
312
+ constructor() {
313
+ this.loading = new Map();
314
+ this.loaded = new Map();
315
+ }
316
+ load(imageSrc) {
317
+ if (this.loaded.has(imageSrc)) {
318
+ return Promise.resolve();
319
+ }
320
+ if (this.loading.has(imageSrc)) {
321
+ return this.loading.get(imageSrc);
322
+ }
323
+ const loading = new Promise((resolve, reject) => {
324
+ const image = new Image();
325
+ image.src = imageSrc;
326
+ image.onerror = reject;
327
+ image.onload = () => resolve();
328
+ }).then(() => {
329
+ this.loaded.set(imageSrc, true);
330
+ }).finally(() => {
331
+ this.loading.delete(imageSrc);
332
+ });
333
+ this.loading.set(imageSrc, loading);
334
+ return loading;
335
+ }
336
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
337
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, providedIn: 'root' }); }
338
+ }
339
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, decorators: [{
340
+ type: Injectable,
341
+ args: [{ providedIn: 'root' }]
342
+ }] });
343
+
344
+ class LoadingIndicatorService {
345
+ constructor() {
346
+ this.loading$ = new ToggleSubject(true);
347
+ this._attachedLoadingSubscription = new Subscription();
348
+ this.isLoading$ = this.loading$.asObservable();
349
+ }
350
+ attachLoading(loading$) {
351
+ this._attachedLoadingSubscription.add(loading$.pipe(map(Boolean), delay(0)).subscribe(this.loading$.next));
352
+ }
353
+ ngOnDestroy() {
354
+ this._attachedLoadingSubscription.unsubscribe();
355
+ }
356
+ disable() {
357
+ setTimeout(() => {
358
+ this.loading$.disable();
359
+ });
360
+ }
361
+ enable() {
362
+ setTimeout(() => {
363
+ this.loading$.enable();
364
+ });
365
+ }
366
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
367
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService }); }
368
+ }
369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService, decorators: [{
370
+ type: Injectable
371
+ }], ctorParameters: function () { return []; } });
372
+
373
+ class LocalStorageService {
374
+ has(key) {
375
+ return localStorage.getItem(key) !== null;
376
+ }
377
+ set(key, value) {
378
+ if (typeof value !== 'string') {
379
+ localStorage.setItem(key, JSON.stringify(value));
380
+ }
381
+ else {
382
+ localStorage.setItem(key, value);
383
+ }
384
+ }
385
+ get(key) {
386
+ return localStorage.getItem(key);
387
+ }
388
+ remove(key) {
389
+ localStorage.removeItem(key);
390
+ }
391
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
392
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LocalStorageService, providedIn: 'root' }); }
393
+ }
394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LocalStorageService, decorators: [{
395
+ type: Injectable,
396
+ args: [{ providedIn: 'root' }]
397
+ }] });
398
+
399
+ function ObserveCurrentThemeDensity() {
400
+ return new Observable((subscriber) => {
401
+ const observer = new MutationObserver((mutations) => {
402
+ mutations.forEach((mutation) => {
403
+ if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
404
+ const classList = mutation.target.classList;
405
+ const matchingClasses = Array.from(classList).filter((className) => /density-\d/.test(className));
406
+ if (matchingClasses.length > 0) {
407
+ const match = matchingClasses[0].match(/density-(\d)/);
408
+ if (match) {
409
+ subscriber.next(Number(match[1]) * -1);
410
+ }
411
+ }
412
+ else {
413
+ subscriber.next(0);
414
+ }
415
+ }
416
+ });
417
+ });
418
+ subscriber.add(() => observer.disconnect());
419
+ observer.observe(document.body, {
420
+ attributes: true,
421
+ attributeFilter: ['class'],
422
+ });
423
+ });
424
+ }
425
+
187
426
  class ResetService {
188
427
  constructor() {
189
428
  this.view$ = new Subject();
@@ -210,6 +449,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
210
449
 
211
450
  class ThemeService {
212
451
  constructor(mediaMatcher) {
452
+ this.config = inject(ConfigService);
213
453
  const darkModeCached = localStorage.getItem('rxap-dark-mode');
214
454
  const darkModeMediaQuery = mediaMatcher.matchMedia('(prefers-color-scheme: dark)');
215
455
  let darkMode = null;
@@ -249,52 +489,151 @@ class ThemeService {
249
489
  this.darkMode$.next(checked);
250
490
  }
251
491
  }
252
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ThemeService, deps: [{ token: i1.MediaMatcher }], target: i0.ɵɵFactoryTarget.Injectable }); }
253
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
254
- }
255
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ThemeService, decorators: [{
256
- type: Injectable,
257
- args: [{ providedIn: 'root' }]
258
- }], ctorParameters: function () { return [{ type: i1.MediaMatcher }]; } });
259
-
260
- class HeaderService {
261
- constructor(router) {
262
- this.router = router;
263
- this.update$ = new Subject();
264
- this.components = [];
265
- this.navigating$ = this.router.events.pipe(filter(event => event instanceof NavigationStart ||
266
- event instanceof NavigationEnd ||
267
- event instanceof NavigationCancel), map(event => event instanceof NavigationStart));
268
- }
269
- get countComponent() {
270
- return this.components.length + 1;
492
+ setDensity(density) {
493
+ document.body.classList.remove('density-0', 'density-1', 'density-2', 'density-3');
494
+ if (density < 0) {
495
+ document.body.classList.add(`density${density}`);
496
+ }
271
497
  }
272
- addComponent(component, order = 0) {
273
- this.components.push({
274
- component,
275
- order,
498
+ getDensity() {
499
+ let density = 0;
500
+ document.body.classList.forEach((className) => {
501
+ const match = className.match(/density-([123])/);
502
+ if (match) {
503
+ density = Number(match[1]) * -1;
504
+ }
276
505
  });
277
- this.update$.next();
506
+ return density;
278
507
  }
279
- /**
280
- * Returns all added components ordered based on the order property
281
- */
282
- getComponents() {
283
- return this
284
- .components
285
- .sort((a, b) => a.order - b.order)
286
- .map(item => item.component);
508
+ setTypography(typography) {
509
+ document.body.style.setProperty('--font-family', `var(--font-family-${typography})`);
287
510
  }
288
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, deps: [{ token: Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
289
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, providedIn: 'root' }); }
511
+ getTypography() {
512
+ const variable = document.body.style.getPropertyValue('--font-family');
513
+ const match = variable.match(/var\(--font-family-(.*)\)/);
514
+ if (match) {
515
+ return match[1];
516
+ }
517
+ return 'default';
518
+ }
519
+ getAvailableColorPalettes() {
520
+ const colorPalettesConfigs = this.config.get('colorPalettes', {});
521
+ const availableColorPalettes = Object.keys(colorPalettesConfigs);
522
+ availableColorPalettes.unshift('default');
523
+ return availableColorPalettes;
524
+ }
525
+ getColorPalette(colorPaletteName) {
526
+ const colorPaletteConfig = this.config.getOrThrow(`colorPalettes.${colorPaletteName}`);
527
+ return this.coerceColorPalette(colorPaletteConfig);
528
+ }
529
+ getAvailableThemes() {
530
+ const themeConfigs = this.config.get('themes', {});
531
+ const availableThemes = Object.keys(themeConfigs);
532
+ availableThemes.unshift('default');
533
+ return availableThemes;
534
+ }
535
+ setTheme(themeName) {
536
+ if (themeName === 'default') {
537
+ this.resetToDefaultTheme();
538
+ return;
539
+ }
540
+ const theme = this.getTheme(themeName);
541
+ if (theme.primaryColor?.color) {
542
+ this.setCssColorVariables('primary', theme.primaryColor.color);
543
+ }
544
+ if (theme.accentColor?.color) {
545
+ this.setCssColorVariables('accent', theme.accentColor.color);
546
+ }
547
+ if (theme.warnColor?.color) {
548
+ this.setCssColorVariables('warn', theme.warnColor.color);
549
+ }
550
+ if (theme.density !== undefined) {
551
+ this.setDensity(theme.density);
552
+ }
553
+ if (theme.typography) {
554
+ this.setTypography(theme.typography);
555
+ }
556
+ document.body.style.setProperty(`--theme-name`, themeName);
557
+ }
558
+ getCurrentTheme() {
559
+ return document.body.style.getPropertyValue('--theme-name') || 'default';
560
+ }
561
+ coerceColorPalette(colorPaletteConfig) {
562
+ let colorPalette = {};
563
+ if (colorPaletteConfig.color) {
564
+ if (Object.keys(colorPaletteConfig.color).length !== 14) {
565
+ // the color palette is not complete
566
+ if (colorPaletteConfig.base) {
567
+ colorPalette =
568
+ ComputeColorPalette(colorPaletteConfig.base, colorPaletteConfig.color, colorPaletteConfig.algorithm);
569
+ }
570
+ }
571
+ colorPalette = colorPaletteConfig.color;
572
+ }
573
+ else if (colorPaletteConfig.base) {
574
+ colorPalette = ComputeColorPalette(colorPaletteConfig.base, {}, colorPaletteConfig.algorithm);
575
+ }
576
+ if (Object.keys(colorPalette).length === 0) {
577
+ throw new Error('FATAL: The color palette has neither a base nor a color property');
578
+ }
579
+ return colorPalette;
580
+ }
581
+ getTheme(themeName) {
582
+ const themeConfig = this.config.getOrThrow(`themes.${themeName}`);
583
+ if (themeConfig.accentColor) {
584
+ themeConfig.accentColor.color = this.coerceColorPalette(themeConfig.accentColor);
585
+ }
586
+ if (themeConfig.primaryColor) {
587
+ themeConfig.primaryColor.color = this.coerceColorPalette(themeConfig.primaryColor);
588
+ }
589
+ if (themeConfig.warnColor) {
590
+ themeConfig.warnColor.color = this.coerceColorPalette(themeConfig.warnColor);
591
+ }
592
+ return themeConfig;
593
+ }
594
+ getAvailableTypographies() {
595
+ return Array
596
+ .from(document.styleSheets)
597
+ .filter(sheet => sheet.href === null || sheet.href.startsWith(window.location.origin))
598
+ .flatMap(sheet => Array.from(sheet.cssRules || []))
599
+ .filter((rule) => rule.selectorText === ':root')
600
+ .flatMap((rule) => Array.from(rule.style))
601
+ .filter((prop) => prop.startsWith('--'))
602
+ .filter((prop) => prop.startsWith('--font-family-'))
603
+ .map((prop) => prop.replace('--font-family-', ''))
604
+ .sort();
605
+ }
606
+ setCssColorVariables(name, colorPalette) {
607
+ this.clearCssColorVariables(name);
608
+ for (const [index, color] of Object.entries(colorPalette)) {
609
+ document.body.style.setProperty(`--${name}-${index}`, color);
610
+ }
611
+ }
612
+ clearCssColorVariables(name) {
613
+ document.body.style.removeProperty(`--${name}-50`);
614
+ for (let index = 100; index <= 900; index += 100) {
615
+ document.body.style.removeProperty(`--${name}-${index}`);
616
+ }
617
+ document.body.style.removeProperty(`--${name}-a100`);
618
+ document.body.style.removeProperty(`--${name}-a200`);
619
+ document.body.style.removeProperty(`--${name}-a400`);
620
+ document.body.style.removeProperty(`--${name}-a700`);
621
+ }
622
+ resetToDefaultTheme() {
623
+ this.clearCssColorVariables('primary');
624
+ this.clearCssColorVariables('accent');
625
+ this.clearCssColorVariables('warn');
626
+ this.setDensity(0);
627
+ this.setTypography('default');
628
+ document.body.style.removeProperty(`--theme-name`);
629
+ }
630
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ThemeService, deps: [{ token: i1$1.MediaMatcher }], target: i0.ɵɵFactoryTarget.Injectable }); }
631
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
290
632
  }
291
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: HeaderService, decorators: [{
633
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ThemeService, decorators: [{
292
634
  type: Injectable,
293
635
  args: [{ providedIn: 'root' }]
294
- }], ctorParameters: function () { return [{ type: i1$1.Router, decorators: [{
295
- type: Inject,
296
- args: [Router]
297
- }] }]; } });
636
+ }], ctorParameters: function () { return [{ type: i1$1.MediaMatcher }]; } });
298
637
 
299
638
  class VersionService {
300
639
  constructor() {
@@ -320,32 +659,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
320
659
  args: [{ providedIn: 'root' }]
321
660
  }] });
322
661
 
323
- class LocalStorageService {
324
- has(key) {
325
- return localStorage.getItem(key) !== null;
326
- }
327
- set(key, value) {
328
- if (typeof value !== 'string') {
329
- localStorage.setItem(key, JSON.stringify(value));
330
- }
331
- else {
332
- localStorage.setItem(key, value);
333
- }
334
- }
335
- get(key) {
336
- return localStorage.getItem(key);
337
- }
338
- remove(key) {
339
- localStorage.removeItem(key);
340
- }
341
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LocalStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
342
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LocalStorageService, providedIn: 'root' }); }
343
- }
344
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LocalStorageService, decorators: [{
345
- type: Injectable,
346
- args: [{ providedIn: 'root' }]
347
- }] });
348
-
349
662
  class WindowContainerSidenavService {
350
663
  constructor() {
351
664
  this.add$ = new Subject();
@@ -377,85 +690,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImpor
377
690
  args: [{ providedIn: 'root' }]
378
691
  }] });
379
692
 
380
- class ImageLoaderService {
381
- constructor() {
382
- this.loading = new Map();
383
- this.loaded = new Map();
384
- }
385
- load(imageSrc) {
386
- if (this.loaded.has(imageSrc)) {
387
- return Promise.resolve();
388
- }
389
- if (this.loading.has(imageSrc)) {
390
- return this.loading.get(imageSrc);
391
- }
392
- const loading = new Promise((resolve, reject) => {
393
- const image = new Image();
394
- image.src = imageSrc;
395
- image.onerror = reject;
396
- image.onload = () => resolve();
397
- }).then(() => {
398
- this.loaded.set(imageSrc, true);
399
- }).finally(() => {
400
- this.loading.delete(imageSrc);
401
- });
402
- this.loading.set(imageSrc, loading);
403
- return loading;
404
- }
405
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
406
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, providedIn: 'root' }); }
407
- }
408
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ImageLoaderService, decorators: [{
409
- type: Injectable,
410
- args: [{ providedIn: 'root' }]
411
- }] });
412
-
413
- class AvatarImageService {
414
- get({ name }) {
415
- return new HttpRequest('GET', 'https://eu.ui-avatars.com/api', {
416
- params: new HttpParams({ fromObject: { name } }),
417
- }).urlWithParams;
418
- }
419
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
420
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, providedIn: 'root' }); }
421
- }
422
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AvatarImageService, decorators: [{
423
- type: Injectable,
424
- args: [{ providedIn: 'root' }]
425
- }] });
426
-
427
- class LoadingIndicatorService {
428
- constructor() {
429
- this.loading$ = new ToggleSubject(true);
430
- this._attachedLoadingSubscription = new Subscription();
431
- this.isLoading$ = this.loading$.asObservable();
432
- }
433
- attachLoading(loading$) {
434
- this._attachedLoadingSubscription.add(loading$.pipe(map(Boolean), delay(0)).subscribe(this.loading$.next));
435
- }
436
- ngOnDestroy() {
437
- this._attachedLoadingSubscription.unsubscribe();
438
- }
439
- disable() {
440
- setTimeout(() => {
441
- this.loading$.disable();
442
- });
443
- }
444
- enable() {
445
- setTimeout(() => {
446
- this.loading$.enable();
447
- });
448
- }
449
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
450
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService }); }
451
- }
452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingIndicatorService, decorators: [{
453
- type: Injectable
454
- }], ctorParameters: function () { return []; } });
693
+ // region
694
+ // endregion
455
695
 
456
696
  /**
457
697
  * Generated bundle index. Do not edit.
458
698
  */
459
699
 
460
- export { AvatarImageService, FooterService, HeaderService, ImageLoaderService, IsFooterComponent, IsFooterTemplate, LoadingIndicatorService, LocalStorageService, RXAP_FOOTER_COMPONENT, ResetService, ThemeService, VersionService, WindowContainerSidenavService };
700
+ export { AvatarImageService, ColorPaletteAlgorithm, ComputeColorPalette, FooterService, HeaderService, ImageLoaderService, IsFooterComponent, IsFooterTemplate, LoadingIndicatorService, LocalStorageService, ObserveCurrentThemeDensity, RXAP_FOOTER_COMPONENT, ResetService, ThemeService, VersionService, WindowContainerSidenavService };
461
701
  //# sourceMappingURL=rxap-services.mjs.map