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

Commit

Permalink
refactor(package): Use barrel file for src/lib/common files (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
trimox authored Aug 26, 2017
1 parent 0b934fc commit bdf5bed
Show file tree
Hide file tree
Showing 29 changed files with 146 additions and 52 deletions.
17 changes: 7 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"devDependencies": {
"@angular/compiler-cli": "^4.3.6",
"@angular/flex-layout": "2.0.0-beta.9",
"@angular/flex-layout": "^2.0.0-beta.8",
"@types/node": "^8.0.21",
"angular2-template-loader": "^0.6.2",
"autoprefixer": "^7.1.2",
Expand All @@ -79,7 +79,7 @@
"node-sass": "^4.5.3",
"postcss-loader": "^2.0.6",
"rimraf": "^2.6.1",
"rollup": "^0.48.2",
"rollup": "^0.47.6",
"rollup-plugin-commonjs": "^8.1.0",
"rollup-plugin-node-resolve": "^3.0.0",
"sass-loader": "^6.0.6",
Expand Down
82 changes: 82 additions & 0 deletions src/demo-app/app.module-dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { ApplicationRef, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { FlexLayoutModule } from '@angular/flex-layout';

import { AppComponent } from './app.component';
import { ButtonDemoComponent } from './components/button-demo/button-demo.component';
import { CardDemoComponent } from './components/card-demo/card-demo.component';
import { CheckboxDemoComponent } from './components/checkbox-demo/checkbox-demo.component';
import { DialogDemoComponent } from './components/dialog-demo/dialog-demo.component';
import { DrawerDemoComponent } from './components/drawer-demo/drawer-demo.component';
import { FabDemoComponent } from './components/fab-demo/fab-demo.component';
import { ElevationDemoComponent } from './components/elevation-demo/elevation-demo.component';
import { IconToggleDemoComponent } from './components/icon-toggle-demo/icon-toggle-demo.component';
import { LinearProgressDemoComponent } from './components/linear-progress-demo/linear-progress-demo.component';
import { ListDemoComponent } from './components/list-demo/list-demo.component';
import { MenuDemoComponent } from './components/menu-demo/menu-demo.component';
import { RadioDemoComponent } from './components/radio-demo/radio-demo.component';
import { SnackbarDemoComponent } from './components/snackbar-demo/snackbar-demo.component';
import { SwitchDemoComponent } from './components/switch-demo/switch-demo.component';
import { TextfieldDemoComponent } from './components/textfield-demo/textfield-demo.component';
import { ToolbarDemoComponent } from './components/toolbar-demo/toolbar-demo.component';
import { TypographyDemoComponent } from './components/typography-demo/typography-demo.component';
import { TabDemoComponent, ItemOneContent, ItemTwoContent, ItemThreeContent } from './components/tab-demo/tab-demo.component';

import { MaterialModule } from '../lib/public_api';

import { HomeComponent } from './components/home/home.component';
import { NavbarComponent } from './components/navigation/navbar.component';

import { demoAppRoutes } from './routes';

@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
ReactiveFormsModule,
FlexLayoutModule,
MaterialModule,
RouterModule.forRoot(demoAppRoutes, { useHash: true })
],
declarations: [
AppComponent,
ButtonDemoComponent,
CardDemoComponent,
CheckboxDemoComponent,
DialogDemoComponent,
DrawerDemoComponent,
ElevationDemoComponent,
FabDemoComponent,
IconToggleDemoComponent,
HomeComponent,
LinearProgressDemoComponent,
ListDemoComponent,
MenuDemoComponent,
NavbarComponent,
RadioDemoComponent,
SnackbarDemoComponent,
SwitchDemoComponent,
TabDemoComponent,
TextfieldDemoComponent,
ToolbarDemoComponent,
TypographyDemoComponent,
ItemOneContent,
ItemTwoContent,
ItemThreeContent,
],
entryComponents: [
AppComponent
]
})
export class AppModule {
constructor(private _appRef: ApplicationRef) { }

ngDoBootstrap() {
this._appRef.bootstrap(AppComponent);
}
}
18 changes: 18 additions & 0 deletions src/demo-app/sass/mdc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,21 @@
$mdc-theme-primary: #1565c0;

@import "material-components-web/material-components-web";

.mdc-button {
border-radius: 2px;
}

.mdc-dialog {
@media (max-width: 599px) {
&__surface {
width: calc(100% - 30px);
}
}

@media (min-width: 600px) {
&__surface {
width: auto;
}
}
}
2 changes: 1 addition & 1 deletion src/lib/card/card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Renderer2,
ViewEncapsulation,
} from '@angular/core';
import { toBoolean } from '../common/boolean-property';
import { toBoolean } from '../common';

import { Ripple } from '../ripple/ripple.directive';
import { ButtonComponent } from '../button/button.component';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/checkbox/checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
ViewEncapsulation,
} from '@angular/core';
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
import { toBoolean } from '../common/boolean-property';
import { toBoolean } from '../common';
import { EventRegistry } from '../common/event-registry';
import { Ripple } from '.././ripple/ripple.directive';
import { Ripple } from '../ripple/ripple.directive';

import { MDCCheckboxAdapter } from './checkbox-adapter';
import { MDCCheckboxFoundation } from '@material/checkbox';
Expand Down
1 change: 0 additions & 1 deletion src/lib/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './boolean-property';
export * from './event-registry';
export * from './events';
export * from './keycodes';
export * from './number-property';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/dialog/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import { isBrowser } from '../common/platform';
import { isBrowser } from '../common';
import { EventRegistry } from '../common/event-registry';
import focusTrap from 'focus-trap';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/drawer/persistent/drawer-persistent.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { isBrowser } from '../../common/platform';
import { isBrowser } from '../../common';
import { EventRegistry } from '../../common/event-registry';

import { MDCDrawerPersistentAdapter } from '../drawer-adapter';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/drawer/temporary/drawer-temporary.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { isBrowser } from '../../common/platform';
import { isBrowser } from '../../common';
import { EventRegistry } from '../../common/event-registry';

import { MDCDrawerTemporaryAdapter } from '../drawer-adapter';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/elevation/elevation.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Renderer2,
SimpleChange,
} from '@angular/core';
import { toNumber } from '../common/number-property';
import { toNumber } from '../common';

@Directive({
selector: '[mdc-elevation-transition]'
Expand Down
6 changes: 2 additions & 4 deletions src/lib/fab/fab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import {
SimpleChange,
ViewEncapsulation,
} from '@angular/core';
import { Ripple } from '.././ripple/ripple.directive';
import { toBoolean } from '../common/boolean-property';
import { KeyCodes } from '../common/keycodes';
import { isSpaceKey } from '../common/events';
import { Ripple } from '../ripple/ripple.directive';
import { toBoolean, KeyCodes, isSpaceKey } from '../common';

@Directive({
selector: ' mdc-fab-icon, [mdc-fab-icon]'
Expand Down
4 changes: 2 additions & 2 deletions src/lib/icon-toggle/icon-toggle.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {
ViewEncapsulation,
} from '@angular/core';
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
import { toBoolean } from '../common/boolean-property';
import { toBoolean } from '../common';
import { EventRegistry } from '../common/event-registry';
import { Ripple } from '.././ripple/ripple.directive';
import { Ripple } from '../ripple/ripple.directive';

import { MDCIconToggleAdapter } from './adapter';
import { MDCIconToggleFoundation } from '@material/icon-toggle';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/list/list-divider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import { toBoolean } from '../common/boolean-property';
import { toBoolean } from '../common';

@Component({
selector: '[mdc-list-divider], mdc-list-divider',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/list/list-item.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
OnChanges,
SimpleChange,
} from '@angular/core';
import { ListComponent } from './list.component';
import { toBoolean } from '../common';
import { Ripple } from '../ripple/ripple.directive';
import { toBoolean } from '../common/boolean-property';
import { ListComponent } from './list.component';

@Directive({
selector: 'mdc-list-item, a[mdc-list-item]',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/list/list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ViewEncapsulation,
} from '@angular/core';
import { ListItemDirective } from './list-item.directive';
import { toBoolean } from '../common/boolean-property';
import { toBoolean } from '../common';

@Component({
selector: 'mdc-list',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { isBrowser } from '../common/platform';
import { isBrowser } from '../common';
import { EventRegistry } from '../common/event-registry';

import { MDCMenuAdapter } from './menu-adapter';
Expand Down
1 change: 1 addition & 0 deletions src/lib/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './button/index';
export * from './card/index';
export * from './checkbox/index';
export * from './common/index';
export * from './common/event-registry';
export * from './dialog/index';
export * from './drawer/index';
export * from './elevation/index';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/radio/radio.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
forwardRef
} from '@angular/core';
import { NG_VALUE_ACCESSOR, RadioControlValueAccessor } from '@angular/forms';
import { toBoolean } from '../common/boolean-property';
import { Ripple } from '.././ripple/ripple.directive';
import { toBoolean } from '../common';
import { Ripple } from '../ripple/ripple.directive';

import { MDCRadioAdapter } from './radio-adapter';
import { MDCRadioFoundation } from '@material/radio';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/ripple/ripple.directive.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
import {
Directive,
ElementRef,
OnDestroy,
Renderer2,
} from '@angular/core';
import { EventRegistry } from '../common/event-registry';
import { toBoolean } from '../common/boolean-property';
import { toBoolean } from '../common';

import { MDCRippleAdapter } from './ripple-adapter';
import { supportsCssVariables } from '@material/ripple/util';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/snackbar/snackbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { isBrowser } from '../common/platform';
import { isBrowser } from '../common';
import { EventRegistry } from '../common/event-registry';

import { MDCSnackbarAdapter } from './snackbar-adapter';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/switch/switch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
ViewEncapsulation,
} from '@angular/core';
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
import { toBoolean } from '../common/boolean-property';
import { Ripple } from '.././ripple/ripple.directive';
import { toBoolean } from '../common';
import { Ripple } from '../ripple/ripple.directive';

export const MD_SWITCH_CONTROL_VALUE_ACCESSOR: Provider = {
provide: NG_VALUE_ACCESSOR,
Expand Down
3 changes: 1 addition & 2 deletions src/lib/tabs/tab-bar-scroller/tab-bar-scroller.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
Renderer2,
ViewEncapsulation,
} from '@angular/core';
import { toBoolean } from '../../common/boolean-property';
import { isBrowser } from '../../common/platform';
import { toBoolean, isBrowser } from '../../common';
import { EventRegistry } from '../../common/event-registry';

import { getCorrectPropertyName } from '@material/animation';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tabs/tab-bar/tab-bar.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
QueryList,
Renderer2,
} from '@angular/core';
import { isBrowser } from '../../common/platform';
import { isBrowser } from '../../common';
import { EventRegistry } from '../../common/event-registry';
import { Subscription } from 'rxjs';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/tabs/tab/tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
Renderer2,
ViewEncapsulation,
} from '@angular/core';
import { toBoolean } from '../../common';
import { EventRegistry } from '../../common/event-registry';
import { toBoolean } from '../../common/boolean-property';
import { Ripple } from '../../ripple/ripple.directive';

import { MDCTabAdapter } from './tab-adapter';
Expand Down
12 changes: 6 additions & 6 deletions src/lib/textfield/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { TextfieldInputDirective } from './textfield-input.directive';
import {
TextfieldComponent,
TextfieldHelptextDirective,
Expand All @@ -12,16 +13,15 @@ import {
TextfieldBottomLineDirective,
} from './textfield-box.component';
import { TextareaComponent } from './textarea.component';
import { TextfieldInputDirective } from './textfield-input.directive';

const TEXTFIELD_COMPONENTS = [
TextfieldComponent,
TextfieldInputDirective,
TextfieldHelptextDirective,
TextfieldBoxComponent,
TextfieldBottomLineDirective,
TextfieldLabelDirective,
TextfieldInputDirective,
TextfieldComponent,
TextfieldBottomLineDirective,
TextareaComponent,
TextfieldBoxComponent,
];

@NgModule({
Expand All @@ -32,6 +32,6 @@ const TEXTFIELD_COMPONENTS = [
export class TextfieldModule { }

export * from './textfield.component';
export * from './textfield-input.directive';
export * from './textfield-box.component';
export * from './textarea.component';
export * from './textfield-input.directive';
Loading

0 comments on commit bdf5bed

Please sign in to comment.