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

Commit

Permalink
refactor(infrastructure): Use ES2015 import for MDC Foundation API's
Browse files Browse the repository at this point in the history
* Use import instead of require
  • Loading branch information
trimox committed Jul 13, 2017
1 parent 65b421a commit dd21a75
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/lib/checkbox/checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
import { MDCCheckboxAdapter } from './checkbox-adapter';
import { Ripple } from '.././ripple/ripple.directive';

const { MDCFormField } = require('@material/form-field');
const { MDCCheckboxFoundation } = require('@material/checkbox');
import { MDCFormField } from '@material/form-field';
import { MDCCheckboxFoundation } from '@material/checkbox';

let formField_ = null;
let nextElId_ = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/form-field/form-field.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { MDCFormFieldAdapter } from './form-field-adapter';
import { CheckboxComponent } from '.././checkbox/checkbox.component';

const { MDCFormField, MDCFormFieldFoundation } = require('@material/form-field');
import { MDCFormField, MDCFormFieldFoundation } from '@material/form-field';

@Component({
selector: 'mdc-form-field',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/linear-progress/linear-progress.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@angular/core';
import { MDCLinearProgressAdapter } from './linear-progress-adapter';

const { MDCLinearProgressFoundation } = require('@material/linear-progress');
import { MDCLinearProgressFoundation } from '@material/linear-progress';

@Component({
selector: 'mdc-linear-progress',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/menu/menu-item.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ export class MenuItemDirective {
constructor(
private _renderer: Renderer2,
private _root: ElementRef) { }
}
}
4 changes: 2 additions & 2 deletions src/lib/menu/menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { MDCMenuAdapter } from './menu-adapter';
import { MenuItemDirective } from './menu-item.directive';
import { isBrowser } from '../common/platform';

const { MDCSimpleMenuFoundation } = require('@material/menu/simple');
const { getTransformPropertyName } = require('@material/menu/util');
import { MDCSimpleMenuFoundation } from '@material/menu/simple';
import { getTransformPropertyName } from '@material/menu/util';

export enum MDC_OPEN_FROM {
TOP_LEFT = 'mdc-simple-menu--open-from-top-left',
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 @@ -17,8 +17,8 @@ import { NG_VALUE_ACCESSOR, RadioControlValueAccessor } from '@angular/forms';
import { MDCRadioAdapter } from './radio-adapter';
import { Ripple } from '.././ripple/ripple.directive';

const { MDCFormField } = require('@material/form-field');
const { MDCRadioFoundation } = require('@material/radio');
import { MDCFormField } from '@material/form-field';
import { MDCRadioFoundation } from '@material/radio';

let formField_ = null;
let nextElId_ = 0;
Expand Down
5 changes: 2 additions & 3 deletions src/lib/ripple/ripple.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
Renderer2
} from '@angular/core';
import { MDCRippleAdapter } from './ripple-adapter';
import { supportsCssVariables } from '@material/ripple/util';

const { MDCRippleFoundation } = require('@material/ripple');
import { MDCRippleFoundation, util } from '@material/ripple';

type UnlistenerMap = WeakMap<EventListener, Function>;

Expand All @@ -21,7 +20,7 @@ export class Ripple implements OnDestroy {
private _unlisteners: Map<string, UnlistenerMap> = new Map<string, UnlistenerMap>();

private _mdcAdapter: MDCRippleAdapter = {
browserSupportsCssVars: () => (typeof window !== 'undefined') ? supportsCssVariables(window) : false,
browserSupportsCssVars: () => (typeof window !== 'undefined') ? util.supportsCssVariables(window) : false,
isUnbounded: () => this.unbounded,
isSurfaceActive: () => this.active,
isSurfaceDisabled: () => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/snackbar/snackbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { SnackbarActionWrapperDirective } from './snackbar-action-wrapper.direct
import { SnackbarActionButtonDirective } from './snackbar-action-button.directive';
import { isBrowser } from '../common/platform';

const { MDCSnackbarFoundation } = require('@material/snackbar');
const { getCorrectEventName } = require('@material/animation');
import { MDCSnackbarFoundation } from '@material/snackbar';
import { getCorrectEventName } from '@material/animation';

type UnlistenerMap = WeakMap<EventListener, Function>;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/switch/switch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
import { Ripple } from '.././ripple/ripple.directive';

const { MDCFormField } = require('@material/form-field');
import { MDCFormField } from '@material/form-field';

export const MD_SWITCH_CONTROL_VALUE_ACCESSOR: Provider = {
provide: NG_VALUE_ACCESSOR,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/textfield/textfield.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
import { MDCTextfieldAdapter } from './textfield-adapter';

const { MDCTextfieldFoundation } = require('@material/textfield');
import { MDCTextfieldFoundation } from '@material/textfield';

export const MD_TEXTFIELD_CONTROL_VALUE_ACCESSOR: Provider = {
provide: NG_VALUE_ACCESSOR,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toolbar/toolbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { ToolbarTitleDirective } from './toolbar-title.directive';
import { ToolbarRowDirective } from './toolbar-row.directive';
import { isBrowser } from '../common/platform';

const { MDCToolbarFoundation, util } = require('@material/toolbar');
import { MDCToolbarFoundation, util } from '@material/toolbar';

type UnlistenerMap = WeakMap<EventListener, Function>;

Expand Down

0 comments on commit dd21a75

Please sign in to comment.