@cuby-ui/core 0.0.29 → 0.0.30
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/components/root/root.component.d.ts +7 -1
- package/esm2020/components/root/root.component.mjs +21 -4
- package/fesm2015/cuby-ui-core.mjs +46 -33
- package/fesm2015/cuby-ui-core.mjs.map +1 -1
- package/fesm2020/cuby-ui-core.mjs +46 -33
- package/fesm2020/cuby-ui-core.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { CommonModule, DOCUMENT } from '@angular/common';
|
|
|
5
5
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
6
6
|
import { cuiIsIcon, CUI_ICONS } from '@cuby-ui/icons';
|
|
7
7
|
import * as i2 from '@cuby-ui/cdk';
|
|
8
|
-
import { cuiCreateToken, cuiCreateTokenFromFactory, CuiDestroyService, CuiFilterPipe, CuiPopoverService, CuiItemDirective, cuiProvide,
|
|
8
|
+
import { cuiCreateToken, cuiCreateTokenFromFactory, CuiDestroyService, CuiFilterPipe, CuiPopoverService, CuiItemDirective, cuiProvide, CUI_LOCAL_STORAGE, CuiAutoResizingDirective } from '@cuby-ui/cdk';
|
|
9
9
|
import { BehaviorSubject, takeUntil } from 'rxjs';
|
|
10
10
|
import * as i2$1 from '@angular/forms';
|
|
11
11
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
@@ -1735,13 +1735,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1735
1735
|
}]
|
|
1736
1736
|
}] });
|
|
1737
1737
|
|
|
1738
|
+
const CUI_THEME_STORAGE_DEFAULT_KEY = 'cuiTheme';
|
|
1739
|
+
const CUI_DEFAULT_THEME = 'light';
|
|
1740
|
+
const CUI_THEME_STORAGE_KEY = cuiCreateToken(CUI_THEME_STORAGE_DEFAULT_KEY);
|
|
1741
|
+
const CUI_THEME = cuiCreateToken(CUI_DEFAULT_THEME);
|
|
1742
|
+
|
|
1743
|
+
class CuiThemeService extends BehaviorSubject {
|
|
1744
|
+
constructor() {
|
|
1745
|
+
super(inject(CUI_LOCAL_STORAGE).getItem(inject(CUI_THEME_STORAGE_KEY))
|
|
1746
|
+
?? inject(CUI_THEME));
|
|
1747
|
+
this.localStorage = inject(CUI_LOCAL_STORAGE);
|
|
1748
|
+
this.key = inject(CUI_THEME_STORAGE_KEY);
|
|
1749
|
+
}
|
|
1750
|
+
next(theme) {
|
|
1751
|
+
this.localStorage.setItem(this.key, theme);
|
|
1752
|
+
super.next(theme);
|
|
1753
|
+
}
|
|
1754
|
+
// При работе только двух тем
|
|
1755
|
+
switch() {
|
|
1756
|
+
this.next(this.value === 'light' ? 'dark' : 'light');
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
CuiThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1760
|
+
CuiThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, providedIn: 'root' });
|
|
1761
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, decorators: [{
|
|
1762
|
+
type: Injectable,
|
|
1763
|
+
args: [{
|
|
1764
|
+
providedIn: 'root'
|
|
1765
|
+
}]
|
|
1766
|
+
}], ctorParameters: function () { return []; } });
|
|
1767
|
+
|
|
1738
1768
|
class CuiRootComponent {
|
|
1769
|
+
constructor() {
|
|
1770
|
+
this.document = inject(DOCUMENT);
|
|
1771
|
+
this.theme$ = inject(CuiThemeService);
|
|
1772
|
+
this.destroy$ = inject(CuiDestroyService);
|
|
1773
|
+
}
|
|
1774
|
+
ngOnInit() {
|
|
1775
|
+
this.initThemeSubscription();
|
|
1776
|
+
}
|
|
1777
|
+
initThemeSubscription() {
|
|
1778
|
+
this.theme$
|
|
1779
|
+
.pipe(takeUntil(this.destroy$))
|
|
1780
|
+
.subscribe(theme => this.document.documentElement.setAttribute('cuiTheme', theme));
|
|
1781
|
+
}
|
|
1739
1782
|
}
|
|
1740
1783
|
CuiRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1741
|
-
CuiRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiRootComponent, selector: "cui-root", ngImport: i0, template: "<ng-content />\n<cui-dialogs />\n<cui-alerts />\n", dependencies: [{ kind: "component", type: CuiDialogsComponent, selector: "cui-dialogs" }, { kind: "component", type: CuiAlertsComponent, selector: "cui-alerts" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1784
|
+
CuiRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiRootComponent, selector: "cui-root", providers: [CuiDestroyService], ngImport: i0, template: "<ng-content />\n<cui-dialogs />\n<cui-alerts />\n", dependencies: [{ kind: "component", type: CuiDialogsComponent, selector: "cui-dialogs" }, { kind: "component", type: CuiAlertsComponent, selector: "cui-alerts" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1742
1785
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, decorators: [{
|
|
1743
1786
|
type: Component,
|
|
1744
|
-
args: [{ selector: 'cui-root', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content />\n<cui-dialogs />\n<cui-alerts />\n" }]
|
|
1787
|
+
args: [{ selector: 'cui-root', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], template: "<ng-content />\n<cui-dialogs />\n<cui-alerts />\n" }]
|
|
1745
1788
|
}] });
|
|
1746
1789
|
|
|
1747
1790
|
class CuiRootModule {
|
|
@@ -1809,36 +1852,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1809
1852
|
}]
|
|
1810
1853
|
}] });
|
|
1811
1854
|
|
|
1812
|
-
const CUI_THEME_STORAGE_DEFAULT_KEY = 'cuiTheme';
|
|
1813
|
-
const CUI_DEFAULT_THEME = 'light';
|
|
1814
|
-
const CUI_THEME_STORAGE_KEY = cuiCreateToken(CUI_THEME_STORAGE_DEFAULT_KEY);
|
|
1815
|
-
const CUI_THEME = cuiCreateToken(CUI_DEFAULT_THEME);
|
|
1816
|
-
|
|
1817
|
-
class CuiThemeService extends BehaviorSubject {
|
|
1818
|
-
constructor() {
|
|
1819
|
-
super(inject(CUI_LOCAL_STORAGE).getItem(inject(CUI_THEME_STORAGE_KEY))
|
|
1820
|
-
?? inject(CUI_THEME));
|
|
1821
|
-
this.localStorage = inject(CUI_LOCAL_STORAGE);
|
|
1822
|
-
this.key = inject(CUI_THEME_STORAGE_KEY);
|
|
1823
|
-
}
|
|
1824
|
-
next(theme) {
|
|
1825
|
-
this.localStorage.setItem(this.key, theme);
|
|
1826
|
-
super.next(theme);
|
|
1827
|
-
}
|
|
1828
|
-
// При работе только двух тем
|
|
1829
|
-
switch() {
|
|
1830
|
-
this.next(this.value === 'light' ? 'dark' : 'light');
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
CuiThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1834
|
-
CuiThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, providedIn: 'root' });
|
|
1835
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, decorators: [{
|
|
1836
|
-
type: Injectable,
|
|
1837
|
-
args: [{
|
|
1838
|
-
providedIn: 'root'
|
|
1839
|
-
}]
|
|
1840
|
-
}], ctorParameters: function () { return []; } });
|
|
1841
|
-
|
|
1842
1855
|
/**
|
|
1843
1856
|
* Generated bundle index. Do not edit.
|
|
1844
1857
|
*/
|