Skip to content

Commit

Permalink
fix: remove cdk re-exports from @angular/material
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `@angular/material` no longer re-exports symbols from
`@angular/cdk`.
  • Loading branch information
jelbourn committed Sep 15, 2017
1 parent 548eca0 commit 0c4f08a
Show file tree
Hide file tree
Showing 66 changed files with 135 additions and 478 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/cdk/a11y/focus-trap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
import {Platform} from '@angular/cdk/platform';
import {Component, ViewChild} from '@angular/core';
import {FocusTrapFactory, FocusTrapDirective, FocusTrap} from './focus-trap';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {FocusTrap, FocusTrapDirective, FocusTrapFactory} from './focus-trap';
import {InteractivityChecker} from './interactivity-checker';
import {Platform} from '../platform/platform';


describe('FocusTrap', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/cdk/a11y/interactivity-checker.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Platform} from '@angular/cdk/platform';
import {InteractivityChecker} from './interactivity-checker';
import {Platform} from '../platform/platform';


describe('InteractivityChecker', () => {
let testContainerElement: HTMLElement;
Expand Down
8 changes: 4 additions & 4 deletions src/cdk/a11y/list-key-manager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {DOWN_ARROW, TAB, UP_ARROW} from '@angular/cdk/keycodes';
import {first} from '@angular/cdk/rxjs';
import {QueryList} from '@angular/core';
import {fakeAsync, tick} from '@angular/core/testing';
import {createKeyboardEvent} from '../testing/event-objects';
import {ActiveDescendantKeyManager} from './activedescendant-key-manager';
import {FocusKeyManager} from './focus-key-manager';
import {DOWN_ARROW, UP_ARROW, TAB} from '../keycodes/keycodes';
import {ListKeyManager} from './list-key-manager';
import {ActiveDescendantKeyManager} from './activedescendant-key-manager';
import {createKeyboardEvent} from '../testing/event-objects';
import {first} from '../rxjs/index';


class FakeFocusable {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/cdk/portal/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
export * from './portal';
export * from './dom-portal-host';
export * from './portal-directives';
export * from './portal-injector';
6 changes: 4 additions & 2 deletions src/demo-app/snack-bar/snack-bar-demo.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {Dir} from '@angular/cdk/bidi';
import {Component, ViewEncapsulation} from '@angular/core';
import {
MdSnackBar,
MdSnackBarConfig,
MdSnackBarHorizontalPosition,
MdSnackBarVerticalPosition,
Dir,
} from '@angular/material';


@Component({
moduleId: module.id,
selector: 'snack-bar-demo',
Expand All @@ -24,7 +25,8 @@ export class SnackBarDemo {
horizontalPosition: MdSnackBarHorizontalPosition = 'center';
verticalPosition: MdSnackBarVerticalPosition = 'bottom';

constructor(public snackBar: MdSnackBar, private dir: Dir) { }
constructor(public snackBar: MdSnackBar, private dir: Dir) {
}

open() {
let config = new MdSnackBarConfig();
Expand Down
1 change: 0 additions & 1 deletion src/lib/button-toggle/button-toggle.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import '../core/a11y/a11y';
@import '../core/style/elevation';
@import '../core/style/vendor-prefixes';
@import '../core/style/layout-common';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/button/button.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// TODO(jelbourn): Measure perf benefits for translate3d and will-change.
// TODO(jelbourn): Figure out if anchor hover underline actually happens in any browser.
@import 'button-base';
@import '../core/a11y/a11y';
@import '../../cdk/a11y/a11y';
@import '../core/style/layout-common';

.mat-button, .mat-icon-button {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/card/card.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import '../core/style/variables';
@import '../core/style/elevation';
@import '../core/a11y/a11y';
@import '../../cdk/a11y/a11y';


$mat-card-default-padding: 24px !default;
Expand Down
5 changes: 3 additions & 2 deletions src/lib/chips/chip-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Directive, Output, EventEmitter, ElementRef, Input} from '@angular/core';
import {coerceBooleanProperty} from '@angular/cdk/coercion';
import {ENTER} from '@angular/material/core';
import {ENTER} from '@angular/cdk/keycodes';
import {Directive, ElementRef, EventEmitter, Input, Output} from '@angular/core';
import {MdChipList} from './chip-list';


export interface MdChipInputEvent {
input: HTMLInputElement;
value: string;
Expand Down
18 changes: 9 additions & 9 deletions src/lib/chips/chip-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
* found in the LICENSE file at https://angular.io/license
*/

import {FocusKeyManager} from '@angular/cdk/a11y';
import {Directionality} from '@angular/cdk/bidi';
import {coerceBooleanProperty} from '@angular/cdk/coercion';
import {BACKSPACE, DELETE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW} from '@angular/cdk/keycodes';
import {
AfterContentInit,
ChangeDetectionStrategy,
Component,
ContentChildren,
ElementRef,
Input,
QueryList,
ViewEncapsulation,
OnDestroy,
Optional,
ElementRef,
QueryList,
Renderer2,
ViewEncapsulation,
} from '@angular/core';

import {MdChip} from './chip';
import {FocusKeyManager} from '@angular/cdk/a11y';
import {BACKSPACE, DELETE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW} from '@angular/material/core';
import {Directionality} from '@angular/cdk/bidi';
import {Subscription} from 'rxjs/Subscription';
import {coerceBooleanProperty} from '@angular/cdk/coercion';
import {MdChip} from './chip';


/**
* A material design chips component (named ChipList for it's similarity to the List component).
Expand Down
47 changes: 27 additions & 20 deletions src/lib/chips/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import {FocusableOption} from '@angular/cdk/a11y';
import {coerceBooleanProperty} from '@angular/cdk/coercion';
import {BACKSPACE, DELETE, SPACE} from '@angular/cdk/keycodes';
import {
ContentChild,
Directive,
Expand All @@ -19,26 +20,21 @@ import {
Output,
Renderer2,
} from '@angular/core';
import {
BACKSPACE,
CanColor,
CanDisable,
DELETE,
mixinColor,
mixinDisabled,
SPACE,
} from '@angular/material/core';
import {CanColor, CanDisable, mixinColor, mixinDisabled} from '@angular/material/core';
import {Subject} from 'rxjs/Subject';


export interface MdChipEvent {
chip: MdChip;
}

// Boilerplate for applying mixins to MdChip.
/** @docs-private */
export class MdChipBase {
constructor(public _renderer: Renderer2, public _elementRef: ElementRef) {}
constructor(public _renderer: Renderer2, public _elementRef: ElementRef) {
}
}

export const _MdChipMixinBase = mixinColor(mixinDisabled(MdChipBase), 'primary');


Expand All @@ -48,9 +44,10 @@ export const _MdChipMixinBase = mixinColor(mixinDisabled(MdChipBase), 'primary')
*/
@Directive({
selector: `md-basic-chip, [md-basic-chip], mat-basic-chip, [mat-basic-chip]`,
host: {'class': 'mat-basic-chip'}
host: {'class': 'mat-basic-chip'},
})
export class MdBasicChip { }
export class MdBasicChip {
}

/**
* Material design styled Chip component. Used inside the MdChipList component.
Expand All @@ -72,44 +69,53 @@ export class MdBasicChip { }
'(keydown)': '_handleKeydown($event)',
'(focus)': '_hasFocus = true',
'(blur)': '_hasFocus = false',
}
},
})
export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestroy, CanColor,
CanDisable {
CanDisable {

@ContentChild(forwardRef(() => MdChipRemove)) _chipRemove: MdChipRemove;

/** Whether the chip is selected. */
@Input() get selected(): boolean { return this._selected; }
@Input()
get selected(): boolean {
return this._selected;
}

set selected(value: boolean) {
this._selected = coerceBooleanProperty(value);
(this.selected ? this.select : this.deselect).emit({chip: this});
}

protected _selected: boolean = false;

/**
* Whether or not the chips are selectable. When a chip is not selectable,
* changes to it's selected state are always ignored.
*/
@Input() get selectable(): boolean {
@Input()
get selectable(): boolean {
return this._selectable;
}

set selectable(value: boolean) {
this._selectable = coerceBooleanProperty(value);
}

protected _selectable: boolean = true;

/**
* Determines whether or not the chip displays the remove styling and emits (remove) events.
*/
@Input() get removable(): boolean {
@Input()
get removable(): boolean {
return this._removable;
}

set removable(value: boolean) {
this._removable = coerceBooleanProperty(value);
}

protected _removable: boolean = true;

/** Whether the chip has focus. */
Expand Down Expand Up @@ -224,11 +230,12 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
selector: '[mdChipRemove], [matChipRemove]',
host: {
'class': 'mat-chip-remove',
'(click)': '_handleClick($event)'
}
'(click)': '_handleClick($event)',
},
})
export class MdChipRemove {
constructor(protected _parentChip: MdChip) {}
constructor(protected _parentChip: MdChip) {
}

/** Calls the parent chip's public `remove()` method if applicable. */
_handleClick() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/chips/chips.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../core/a11y/a11y';
@import '../../cdk/a11y/a11y';
@import '../core/style/elevation';

$mat-chip-vertical-padding: 7px;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/_core.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// We can use relative imports for imports from the cdk because we bundle everything
// up into a single flat scss file for material.
@import '../../cdk/overlay/overlay';
@import '../../cdk/a11y/a11y';

// Core styles that can be used to apply material design treatments to any element.
@import 'a11y/a11y';
@import 'style/elevation';
@import 'ripple/ripple';
@import 'option/option';
Expand Down
1 change: 0 additions & 1 deletion src/lib/core/a11y/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions src/lib/core/a11y/activedescendant-key-manager.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/lib/core/a11y/fake-mousedown.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/lib/core/a11y/focus-key-manager.ts

This file was deleted.

19 changes: 0 additions & 19 deletions src/lib/core/a11y/focus-trap.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/lib/core/a11y/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/lib/core/a11y/interactivity-checker.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/lib/core/a11y/list-key-manager.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/lib/core/a11y/live-announcer.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/lib/core/bidi/dir.ts

This file was deleted.

Loading

0 comments on commit 0c4f08a

Please sign in to comment.