@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
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import type { OnInit } from '@angular/core';
|
|
1
2
|
import * as i0 from "@angular/core";
|
|
2
|
-
export declare class CuiRootComponent {
|
|
3
|
+
export declare class CuiRootComponent implements OnInit {
|
|
4
|
+
private readonly document;
|
|
5
|
+
private readonly theme$;
|
|
6
|
+
private readonly destroy$;
|
|
7
|
+
ngOnInit(): void;
|
|
8
|
+
private initThemeSubscription;
|
|
3
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<CuiRootComponent, never>;
|
|
4
10
|
static ɵcmp: i0.ɵɵComponentDeclaration<CuiRootComponent, "cui-root", never, {}, {}, never, ["*"], false, never>;
|
|
5
11
|
}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
|
2
|
+
import { DOCUMENT } from '@angular/common';
|
|
3
|
+
import { CuiDestroyService } from '@cuby-ui/cdk';
|
|
4
|
+
import { takeUntil } from 'rxjs';
|
|
5
|
+
import { CuiThemeService } from '../../services';
|
|
2
6
|
import * as i0 from "@angular/core";
|
|
3
7
|
import * as i1 from "../dialog/dialogs.component";
|
|
4
8
|
import * as i2 from "../alert/alerts.component";
|
|
5
9
|
export class CuiRootComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.document = inject(DOCUMENT);
|
|
12
|
+
this.theme$ = inject(CuiThemeService);
|
|
13
|
+
this.destroy$ = inject(CuiDestroyService);
|
|
14
|
+
}
|
|
15
|
+
ngOnInit() {
|
|
16
|
+
this.initThemeSubscription();
|
|
17
|
+
}
|
|
18
|
+
initThemeSubscription() {
|
|
19
|
+
this.theme$
|
|
20
|
+
.pipe(takeUntil(this.destroy$))
|
|
21
|
+
.subscribe(theme => this.document.documentElement.setAttribute('cuiTheme', theme));
|
|
22
|
+
}
|
|
6
23
|
}
|
|
7
24
|
CuiRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8
|
-
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: i1.CuiDialogsComponent, selector: "cui-dialogs" }, { kind: "component", type: i2.CuiAlertsComponent, selector: "cui-alerts" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
25
|
+
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: i1.CuiDialogsComponent, selector: "cui-dialogs" }, { kind: "component", type: i2.CuiAlertsComponent, selector: "cui-alerts" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9
26
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, decorators: [{
|
|
10
27
|
type: Component,
|
|
11
|
-
args: [{ selector: 'cui-root', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content />\n<cui-dialogs />\n<cui-alerts />\n" }]
|
|
28
|
+
args: [{ selector: 'cui-root', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], template: "<ng-content />\n<cui-dialogs />\n<cui-alerts />\n" }]
|
|
12
29
|
}] });
|
|
13
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm9vdC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb3JlL2NvbXBvbmVudHMvcm9vdC9yb290LmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvcmUvY29tcG9uZW50cy9yb290L3Jvb3QuY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLHVCQUF1QixFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0UsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzNDLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUNqRCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRWpDLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7OztBQVFqRCxNQUFNLE9BQU8sZ0JBQWdCO0lBTjdCO1FBT21CLGFBQVEsR0FBRyxNQUFNLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDNUIsV0FBTSxHQUFHLE1BQU0sQ0FBQyxlQUFlLENBQUMsQ0FBQztRQUNqQyxhQUFRLEdBQUcsTUFBTSxDQUFDLGlCQUFpQixDQUFDLENBQUM7S0FXdkQ7SUFUUSxRQUFRO1FBQ2IsSUFBSSxDQUFDLHFCQUFxQixFQUFFLENBQUM7SUFDL0IsQ0FBQztJQUVPLHFCQUFxQ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WRlcnM6IFtDdWlEZXN0cm95U2VydmljZV1cbn0pXG5leHBvcnQgY2xhc3MgQ3VpUm9vdENvbXBvbmVudCBpbXBsZW1lbnRzIE9uSW5pdCB7XG4gIHByaXZhdGUgcmVhZG9ubHkgZG9jdW1lbnQgPSBpbmplY3QoRE9DVU1FTlQpO1xuICBwcml2YXRlIHJlYWRvbmx5IHRoZW1lJCA9IGluamVjdChDdWlUaGVtZVNlcnZpY2UpO1xuICBwcml2YXRlIHJlYWRvbmx5IGRlc3Ryb3kkID0gaW5qZWN0KEN1aURlc3Ryb3lTZXJ2aWNlKTtcblxuICBwdWJsaWMgbmdPbkluaXQoKTogdm9pZCB7XG4gICAgdGhpcy5pbml0VGhlbWVTdWJzY3JpcHRpb24oKTtcbiAgfVxuXG4gIHByaXZhdGUgaW5pdFRoZW1lU3Vic2NyaXB0aW9uKCk6IHZvaWQge1xuICAgIHRoaXMudGhlbWUkXG4gICAgICAucGlwZSh0YWtlVW50aWwodGhpcy5kZXN0cm95JCkpXG4gICAgICAuc3Vic2NyaWJlKHRoZW1lID0+IHRoaXMuZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LnNldEF0dHJpYnV0ZSgnY3VpVGhlbWUnLCB0aGVtZSkpO1xuICB9XG59XG4iLCI8bmctY29udGVudCAvPlxuPGN1aS1kaWFsb2dzIC8+XG48Y3VpLWFsZXJ0cyAvPlxuIl19
|
|
@@ -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';
|
|
@@ -1736,13 +1736,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1736
1736
|
}]
|
|
1737
1737
|
}] });
|
|
1738
1738
|
|
|
1739
|
+
const CUI_THEME_STORAGE_DEFAULT_KEY = 'cuiTheme';
|
|
1740
|
+
const CUI_DEFAULT_THEME = 'light';
|
|
1741
|
+
const CUI_THEME_STORAGE_KEY = cuiCreateToken(CUI_THEME_STORAGE_DEFAULT_KEY);
|
|
1742
|
+
const CUI_THEME = cuiCreateToken(CUI_DEFAULT_THEME);
|
|
1743
|
+
|
|
1744
|
+
class CuiThemeService extends BehaviorSubject {
|
|
1745
|
+
constructor() {
|
|
1746
|
+
var _a;
|
|
1747
|
+
super((_a = inject(CUI_LOCAL_STORAGE).getItem(inject(CUI_THEME_STORAGE_KEY))) !== null && _a !== void 0 ? _a : inject(CUI_THEME));
|
|
1748
|
+
this.localStorage = inject(CUI_LOCAL_STORAGE);
|
|
1749
|
+
this.key = inject(CUI_THEME_STORAGE_KEY);
|
|
1750
|
+
}
|
|
1751
|
+
next(theme) {
|
|
1752
|
+
this.localStorage.setItem(this.key, theme);
|
|
1753
|
+
super.next(theme);
|
|
1754
|
+
}
|
|
1755
|
+
// При работе только двух тем
|
|
1756
|
+
switch() {
|
|
1757
|
+
this.next(this.value === 'light' ? 'dark' : 'light');
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
CuiThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1761
|
+
CuiThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, providedIn: 'root' });
|
|
1762
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, decorators: [{
|
|
1763
|
+
type: Injectable,
|
|
1764
|
+
args: [{
|
|
1765
|
+
providedIn: 'root'
|
|
1766
|
+
}]
|
|
1767
|
+
}], ctorParameters: function () { return []; } });
|
|
1768
|
+
|
|
1739
1769
|
class CuiRootComponent {
|
|
1770
|
+
constructor() {
|
|
1771
|
+
this.document = inject(DOCUMENT);
|
|
1772
|
+
this.theme$ = inject(CuiThemeService);
|
|
1773
|
+
this.destroy$ = inject(CuiDestroyService);
|
|
1774
|
+
}
|
|
1775
|
+
ngOnInit() {
|
|
1776
|
+
this.initThemeSubscription();
|
|
1777
|
+
}
|
|
1778
|
+
initThemeSubscription() {
|
|
1779
|
+
this.theme$
|
|
1780
|
+
.pipe(takeUntil(this.destroy$))
|
|
1781
|
+
.subscribe(theme => this.document.documentElement.setAttribute('cuiTheme', theme));
|
|
1782
|
+
}
|
|
1740
1783
|
}
|
|
1741
1784
|
CuiRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1742
|
-
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 });
|
|
1785
|
+
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 });
|
|
1743
1786
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, decorators: [{
|
|
1744
1787
|
type: Component,
|
|
1745
|
-
args: [{ selector: 'cui-root', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content />\n<cui-dialogs />\n<cui-alerts />\n" }]
|
|
1788
|
+
args: [{ selector: 'cui-root', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], template: "<ng-content />\n<cui-dialogs />\n<cui-alerts />\n" }]
|
|
1746
1789
|
}] });
|
|
1747
1790
|
|
|
1748
1791
|
class CuiRootModule {
|
|
@@ -1810,36 +1853,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1810
1853
|
}]
|
|
1811
1854
|
}] });
|
|
1812
1855
|
|
|
1813
|
-
const CUI_THEME_STORAGE_DEFAULT_KEY = 'cuiTheme';
|
|
1814
|
-
const CUI_DEFAULT_THEME = 'light';
|
|
1815
|
-
const CUI_THEME_STORAGE_KEY = cuiCreateToken(CUI_THEME_STORAGE_DEFAULT_KEY);
|
|
1816
|
-
const CUI_THEME = cuiCreateToken(CUI_DEFAULT_THEME);
|
|
1817
|
-
|
|
1818
|
-
class CuiThemeService extends BehaviorSubject {
|
|
1819
|
-
constructor() {
|
|
1820
|
-
var _a;
|
|
1821
|
-
super((_a = inject(CUI_LOCAL_STORAGE).getItem(inject(CUI_THEME_STORAGE_KEY))) !== null && _a !== void 0 ? _a : inject(CUI_THEME));
|
|
1822
|
-
this.localStorage = inject(CUI_LOCAL_STORAGE);
|
|
1823
|
-
this.key = inject(CUI_THEME_STORAGE_KEY);
|
|
1824
|
-
}
|
|
1825
|
-
next(theme) {
|
|
1826
|
-
this.localStorage.setItem(this.key, theme);
|
|
1827
|
-
super.next(theme);
|
|
1828
|
-
}
|
|
1829
|
-
// При работе только двух тем
|
|
1830
|
-
switch() {
|
|
1831
|
-
this.next(this.value === 'light' ? 'dark' : 'light');
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
CuiThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1835
|
-
CuiThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, providedIn: 'root' });
|
|
1836
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiThemeService, decorators: [{
|
|
1837
|
-
type: Injectable,
|
|
1838
|
-
args: [{
|
|
1839
|
-
providedIn: 'root'
|
|
1840
|
-
}]
|
|
1841
|
-
}], ctorParameters: function () { return []; } });
|
|
1842
|
-
|
|
1843
1856
|
/**
|
|
1844
1857
|
* Generated bundle index. Do not edit.
|
|
1845
1858
|
*/
|