Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 68bb43c

Browse files
authored
feat(core): MdcThemeModule moved into MdcCoreModule (#277)
Remove requirement for developers to import `MdcThemeModule` separately. BREAKING CHANGE: Remove `MdcThemeModule` import from your code, and replace it with `MdcCoreModule` if not already imported. Closes #243
1 parent 2437511 commit 68bb43c

File tree

7 files changed

+11
-17
lines changed

7 files changed

+11
-17
lines changed

src/demo-app/demo-material.module.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
MdcCheckboxModule,
66
MdcDialogModule,
77
MdcDrawerModule,
8-
MdcElevationModule,
98
MdcFabModule,
109
MdcFormFieldModule,
1110
MdcIconToggleModule,
@@ -19,9 +18,7 @@ import {
1918
MdcSwitchModule,
2019
MdcTabModule,
2120
MdcTextfieldModule,
22-
MdcThemeModule,
2321
MdcToolbarModule,
24-
MdcRippleModule,
2522
// } from '@angular-mdc/web';
2623
} from '../lib/public_api';
2724

@@ -32,7 +29,6 @@ import {
3229
MdcCheckboxModule,
3330
MdcDialogModule,
3431
MdcDrawerModule,
35-
MdcElevationModule,
3632
MdcFabModule,
3733
MdcFormFieldModule,
3834
MdcIconToggleModule,
@@ -46,9 +42,7 @@ import {
4642
MdcSwitchModule,
4743
MdcTabModule,
4844
MdcTextfieldModule,
49-
MdcThemeModule,
5045
MdcToolbarModule,
51-
MdcRippleModule,
5246
]
5347
})
5448
export class DemoMaterialModule { }

src/lib/core/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import { MdcRippleModule } from './ripple/index';
44
import { MdcMaterialIconModule } from './material-icon/index';
55
import { MdcTypographyModule } from './typography/index';
66
import { MdcElevationModule } from './elevation/index';
7+
import { MdcThemeModule } from './theme/index';
78

89
const CORE_DIRECTIVES = [
910
MdcElevationModule,
1011
MdcMaterialIconModule,
1112
MdcTypographyModule,
1213
MdcRippleModule,
14+
MdcThemeModule,
1315
];
1416

1517
@NgModule({

src/lib/core/public_api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './elevation/index';
22
export * from './material-icon/index';
33
export * from './typography/index';
44
export * from './ripple/index';
5+
export * from './theme/index';
File renamed without changes.

src/lib/theme/theme-dark.directive.ts renamed to src/lib/core/theme/theme-dark.directive.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,28 @@ import {
66
Renderer2,
77
SimpleChange,
88
} from '@angular/core';
9-
import { toBoolean } from '../common';
9+
import { toBoolean } from '../../common';
1010

1111
@Directive({
1212
selector: '[mdc-theme-dark]'
1313
})
1414
export class MdcThemeDark implements OnChanges {
15-
private nativeEl: ElementRef;
16-
private _mdcThemeDark: boolean;
15+
private mdcThemeDark_: boolean;
1716

1817
@Input('mdc-theme-dark') mdcThemeDark: boolean;
1918

2019
constructor(
21-
private _renderer: Renderer2,
22-
private _root: ElementRef) {
23-
this.nativeEl = this._root.nativeElement;
20+
private renderer_: Renderer2,
21+
public elementRef: ElementRef) {
2422
}
2523

2624
ngOnChanges(changes: { [key: string]: SimpleChange }) {
2725
let change = changes['mdcThemeDark'];
2826

2927
if (!toBoolean(change.currentValue)) {
30-
this._renderer.removeClass(this.nativeEl, 'mdc-theme--dark');
28+
this.renderer_.removeClass(this.elementRef.nativeElement, 'mdc-theme--dark');
3129
} else {
32-
this._renderer.addClass(this.nativeEl, 'mdc-theme--dark');
30+
this.renderer_.addClass(this.elementRef.nativeElement, 'mdc-theme--dark');
3331
}
3432
}
3533
}

src/lib/module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { MdcDialogModule } from './dialog/index';
88
import { MdcDrawerModule } from './drawer/index';
99
import { MdcFabModule } from './fab/index';
1010
import { MdcFormFieldModule } from './form-field/index';
11+
import { MdcIconModule } from './icon/index';
1112
import { MdcIconToggleModule } from './icon-toggle/index';
1213
import { MdcLinearProgressModule } from './linear-progress/index';
1314
import { MdcListModule } from './list/index';
@@ -18,7 +19,6 @@ import { MdcSnackbarModule } from './snackbar/index';
1819
import { MdcSwitchModule } from './switch/index';
1920
import { MdcTabModule } from './tabs/index';
2021
import { MdcTextfieldModule } from './textfield/index';
21-
import { MdcThemeModule } from './theme/index';
2222
import { MdcToolbarModule } from './toolbar/index';
2323

2424
const MATERIAL_MODULES = [
@@ -30,6 +30,7 @@ const MATERIAL_MODULES = [
3030
MdcDrawerModule,
3131
MdcFabModule,
3232
MdcFormFieldModule,
33+
MdcIconModule,
3334
MdcIconToggleModule,
3435
MdcLinearProgressModule,
3536
MdcListModule,
@@ -40,7 +41,6 @@ const MATERIAL_MODULES = [
4041
MdcSwitchModule,
4142
MdcTabModule,
4243
MdcTextfieldModule,
43-
MdcThemeModule,
4444
MdcToolbarModule,
4545
];
4646

src/lib/public_api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export * from './snackbar/index';
1919
export * from './switch/index';
2020
export * from './tabs/index';
2121
export * from './textfield/index';
22-
export * from './theme/index';
2322
export * from './toolbar/index';
2423

2524
export * from './cdk/overlay/index';

0 commit comments

Comments
 (0)