@ecodev/natural 66.0.0 → 66.0.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.
- package/fesm2022/ecodev-natural.mjs +16 -13
- package/fesm2022/ecodev-natural.mjs.map +1 -1
- package/index.d.ts +4 -2
- package/package.json +1 -1
|
@@ -8,8 +8,8 @@ import * as i1 from '@angular/material/dialog';
|
|
|
8
8
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|
9
9
|
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
10
10
|
import { MatButton, MatIconButton, MatFabButton } from '@angular/material/button';
|
|
11
|
-
import { Observable, switchMap, take, BehaviorSubject, of, timer, tap, endWith, last, EMPTY, finalize, Subject, merge as merge$1, first as first$1, takeUntil as takeUntil$1, map as map$1, ReplaySubject, debounceTime, raceWith, mergeMap, shareReplay, catchError, forkJoin, combineLatest, from, filter as filter$1, startWith as startWith$1, asyncScheduler, throwError } from 'rxjs';
|
|
12
|
-
import { takeUntilDestroyed, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
11
|
+
import { Observable, switchMap, take, BehaviorSubject, of, timer, tap, endWith, last, EMPTY, finalize, Subject, merge as merge$1, first as first$1, takeUntil as takeUntil$1, map as map$1, ReplaySubject, debounceTime, raceWith, mergeMap, shareReplay, catchError, forkJoin, combineLatest, from, fromEvent, filter as filter$1, startWith as startWith$1, asyncScheduler, throwError } from 'rxjs';
|
|
12
|
+
import { takeUntilDestroyed, toSignal, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
13
13
|
import { filter, switchMap as switchMap$1, first, map, takeUntil, takeWhile, debounceTime as debounceTime$1, tap as tap$1, shareReplay as shareReplay$1, startWith, distinctUntilChanged, finalize as finalize$1, throttleTime } from 'rxjs/operators';
|
|
14
14
|
import { mergeWith, defaultsDeep, pick, defaults, isEmpty, isEqual as isEqual$1 } from 'es-toolkit/compat';
|
|
15
15
|
import { MatTableDataSource, MatTable, MatHeaderCellDef, MatHeaderRowDef, MatColumnDef, MatCellDef, MatRowDef, MatHeaderCell, MatCell, MatHeaderRow, MatRow } from '@angular/material/table';
|
|
@@ -5327,9 +5327,19 @@ class NaturalThemeService {
|
|
|
5327
5327
|
storage = inject(LOCAL_STORAGE);
|
|
5328
5328
|
platformId = inject(PLATFORM_ID);
|
|
5329
5329
|
document = inject(DOCUMENT);
|
|
5330
|
-
|
|
5330
|
+
isDarkSystem = toSignal(isPlatformBrowser(this.platformId)
|
|
5331
|
+
? fromEvent(this.document.defaultView.matchMedia('(prefers-color-scheme: dark)'), 'change').pipe(startWith(this.document.defaultView.matchMedia('(prefers-color-scheme: dark)')), map$1(e => e.matches))
|
|
5332
|
+
: of(false), { initialValue: false });
|
|
5333
|
+
isDark = computed(() => {
|
|
5334
|
+
return (this.colorScheme() === ColorScheme.Dark || (this.colorScheme() === ColorScheme.Auto && this.isDarkSystem()));
|
|
5335
|
+
}, ...(ngDevMode ? [{ debugName: "isDark" }] : []));
|
|
5331
5336
|
theme = signal(this.allThemes[0], ...(ngDevMode ? [{ debugName: "theme" }] : []));
|
|
5332
|
-
colorScheme = signal(ColorScheme.
|
|
5337
|
+
colorScheme = signal(ColorScheme.Auto, ...(ngDevMode ? [{ debugName: "colorScheme" }] : []));
|
|
5338
|
+
constructor() {
|
|
5339
|
+
effect(() => {
|
|
5340
|
+
this.document.documentElement.setAttribute('data-is-dark', this.isDark() ? 'true' : 'false');
|
|
5341
|
+
});
|
|
5342
|
+
}
|
|
5333
5343
|
/**
|
|
5334
5344
|
* Set theme in memory, local storage and dom
|
|
5335
5345
|
*/
|
|
@@ -5339,18 +5349,11 @@ class NaturalThemeService {
|
|
|
5339
5349
|
this.document.documentElement.setAttribute('data-theme', name);
|
|
5340
5350
|
}
|
|
5341
5351
|
/**
|
|
5342
|
-
* Set
|
|
5352
|
+
* Set dark/light/auto
|
|
5343
5353
|
*/
|
|
5344
5354
|
setColorScheme(scheme, persistInStorage = true) {
|
|
5345
5355
|
this.colorScheme.set(scheme); // memory
|
|
5346
5356
|
this.document.documentElement.setAttribute('data-color-scheme', scheme); // dom
|
|
5347
|
-
// If manual dark, or auto + dark system
|
|
5348
|
-
const dark = scheme === ColorScheme.Dark ||
|
|
5349
|
-
(scheme === ColorScheme.Auto &&
|
|
5350
|
-
isPlatformBrowser(this.platformId) &&
|
|
5351
|
-
!!this.document.defaultView?.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
5352
|
-
this.isDark.set(dark); // memory
|
|
5353
|
-
this.document.documentElement.setAttribute('data-is-dark', dark ? 'true' : 'false'); // dom;
|
|
5354
5357
|
if (persistInStorage) {
|
|
5355
5358
|
this.storage.setItem('color-scheme', this.colorScheme()); // storage
|
|
5356
5359
|
}
|
|
@@ -5363,7 +5366,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
|
|
|
5363
5366
|
args: [{
|
|
5364
5367
|
providedIn: 'root',
|
|
5365
5368
|
}]
|
|
5366
|
-
}] });
|
|
5369
|
+
}], ctorParameters: () => [] });
|
|
5367
5370
|
|
|
5368
5371
|
const patterns = [
|
|
5369
5372
|
/^(?<day>\d{1,2})\.(?<month>\d{1,2})\.(?<year>\d{4}|\d{2})$/,
|