@arsedizioni/ars-utils 18.2.231 → 18.2.233
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/core/core.module.d.ts +1 -0
- package/core/services/theme.service.d.ts +21 -0
- package/esm2022/clipper.ui/ui/document/document.component.mjs +19 -15
- package/esm2022/core/core.module.mjs +2 -1
- package/esm2022/core/services/theme.service.mjs +46 -0
- package/esm2022/ui/ui/dialogs/reset-password/reset-password-dialog.component.mjs +3 -3
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +18 -14
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.mjs +46 -2
- package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.mjs +2 -2
- package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Injectable, Pipe, EventEmitter, Directive, Input, Output, HostListener, forwardRef, Optional, Inject, ElementRef, signal, NgModule } from '@angular/core';
|
|
2
|
+
import { inject, Injectable, Pipe, EventEmitter, Directive, Input, Output, HostListener, forwardRef, Optional, Inject, ElementRef, signal, RendererFactory2, computed, NgModule } from '@angular/core';
|
|
3
3
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
4
|
import { parseISO, parse, format, setHours, endOfDay, getYear, getMonth, getDate, getDay, getDaysInMonth, addYears, addMonths, addDays, formatISO, isDate, isValid } from 'date-fns';
|
|
5
5
|
import { it } from 'date-fns/locale';
|
|
@@ -1843,6 +1843,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
|
|
|
1843
1843
|
}]
|
|
1844
1844
|
}] });
|
|
1845
1845
|
|
|
1846
|
+
class ThemeService {
|
|
1847
|
+
constructor() {
|
|
1848
|
+
this.renderFactory2 = inject(RendererFactory2);
|
|
1849
|
+
this.renderer = this.renderFactory2.createRenderer(null, null);
|
|
1850
|
+
this.theme = signal("light");
|
|
1851
|
+
this.themeIcon = computed(() => {
|
|
1852
|
+
return this.theme() === "dark" ? "light_mode" : "dark_mode";
|
|
1853
|
+
});
|
|
1854
|
+
this.themeName = computed(() => {
|
|
1855
|
+
return this.theme() === "dark" ? "Passa a tema chiaro" : "Passa a tema scuro";
|
|
1856
|
+
});
|
|
1857
|
+
this.setTheme(localStorage.getItem("preferred-theme") ?? null);
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Set the new theme
|
|
1861
|
+
* @param theme : the theme
|
|
1862
|
+
*/
|
|
1863
|
+
setTheme(theme = null) {
|
|
1864
|
+
if (!theme) {
|
|
1865
|
+
this.theme.set(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
1866
|
+
}
|
|
1867
|
+
else {
|
|
1868
|
+
this.renderer.removeClass(document.body, this.theme());
|
|
1869
|
+
this.theme.set(theme);
|
|
1870
|
+
}
|
|
1871
|
+
this.renderer.addClass(document.body, this.theme());
|
|
1872
|
+
localStorage.setItem("preferred-theme", this.theme());
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Toggle theme
|
|
1876
|
+
*/
|
|
1877
|
+
toggleTheme() {
|
|
1878
|
+
this.setTheme(this.theme() === "dark" ? "light" : "dark");
|
|
1879
|
+
}
|
|
1880
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1881
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ThemeService, providedIn: "root" }); }
|
|
1882
|
+
}
|
|
1883
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ThemeService, decorators: [{
|
|
1884
|
+
type: Injectable,
|
|
1885
|
+
args: [{
|
|
1886
|
+
providedIn: "root",
|
|
1887
|
+
}]
|
|
1888
|
+
}], ctorParameters: () => [] });
|
|
1889
|
+
|
|
1846
1890
|
class ArsDateFnsModule {
|
|
1847
1891
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ArsDateFnsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1848
1892
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.1", ngImport: i0, type: ArsDateFnsModule }); }
|
|
@@ -1980,5 +2024,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
|
|
|
1980
2024
|
* Generated bundle index. Do not edit.
|
|
1981
2025
|
*/
|
|
1982
2026
|
|
|
1983
|
-
export { ArsCoreModule, ArsDateFnsModule, AutoFocusDirective, BroadcastService, CopyClipboardDirective, DateFnsAdapter, DateFormat, DateInterval, DateIntervalChangeDirective, DeleteModel, EmailsValidatorDirective, EnvironmentService, EqualsValidatorDirective, FileInfo, FileSizeValidatorDirective, FormatPipe, GroupModel, GuidValidatorDirective, IDModel, ImportModel, MAT_DATE_FNS_FORMATS, NotFutureValidatorDirective, PasswordValidatorDirective, QueryModel, RelationModel, ReplacePipe, SafeHtmlPipe, SafeUrlPipe, ScreenService, SearchCallbackPipe, SearchFilterPipe, SelectableModel, SqlDateValidatorDirective, SystemUtils, TimeValidatorDirective, UpdateRelationsModel, UrlValidatorDirective, ValidIfDirective, ValidatorDirective, ValueModel };
|
|
2027
|
+
export { ArsCoreModule, ArsDateFnsModule, AutoFocusDirective, BroadcastService, CopyClipboardDirective, DateFnsAdapter, DateFormat, DateInterval, DateIntervalChangeDirective, DeleteModel, EmailsValidatorDirective, EnvironmentService, EqualsValidatorDirective, FileInfo, FileSizeValidatorDirective, FormatPipe, GroupModel, GuidValidatorDirective, IDModel, ImportModel, MAT_DATE_FNS_FORMATS, NotFutureValidatorDirective, PasswordValidatorDirective, QueryModel, RelationModel, ReplacePipe, SafeHtmlPipe, SafeUrlPipe, ScreenService, SearchCallbackPipe, SearchFilterPipe, SelectableModel, SqlDateValidatorDirective, SystemUtils, ThemeService, TimeValidatorDirective, UpdateRelationsModel, UrlValidatorDirective, ValidIfDirective, ValidatorDirective, ValueModel };
|
|
1984
2028
|
//# sourceMappingURL=arsedizioni-ars-utils-core.mjs.map
|