Skip to content

Commit 8d3c6c7

Browse files
committed
fix: remove cdk re-exports from @angular/material
BREAKING CHANGE: `@angular/material` no longer re-exports symbols from `@angular/cdk`.
1 parent dcf3b27 commit 8d3c6c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+137
-509
lines changed
File renamed without changes.

src/cdk/a11y/focus-monitor.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {ComponentFixture, inject, TestBed, fakeAsync, tick} from '@angular/core/testing';
2-
import {Component, Renderer2} from '@angular/core';
3-
import {A11yModule} from './index';
4-
import {By} from '@angular/platform-browser';
51
import {TAB} from '@angular/cdk/keycodes';
6-
import {FocusOrigin, FocusMonitor, TOUCH_BUFFER_MS} from './focus-monitor';
72
import {dispatchFakeEvent, dispatchKeyboardEvent, dispatchMouseEvent} from '@angular/cdk/testing';
3+
import {Component, Renderer2} from '@angular/core';
4+
import {ComponentFixture, fakeAsync, inject, TestBed, tick} from '@angular/core/testing';
5+
import {By} from '@angular/platform-browser';
6+
import {FocusMonitor, FocusOrigin, TOUCH_BUFFER_MS} from './focus-monitor';
7+
import {A11yModule} from './index';
88

99

1010
describe('FocusMonitor', () => {

src/cdk/a11y/focus-monitor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
import {Platform} from '@angular/cdk/platform';
910
import {
1011
Directive,
1112
ElementRef,
@@ -18,11 +19,10 @@ import {
1819
Renderer2,
1920
SkipSelf,
2021
} from '@angular/core';
21-
import {Platform} from '@angular/cdk/platform';
2222
import {Observable} from 'rxjs/Observable';
23+
import {of as observableOf} from 'rxjs/observable/of';
2324
import {Subject} from 'rxjs/Subject';
2425
import {Subscription} from 'rxjs/Subscription';
25-
import {of as observableOf} from 'rxjs/observable/of';
2626

2727

2828
// This is the value used by AngularJS Material. Through trial and error (on iPhone 6S) they found

src/cdk/a11y/focus-trap.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
1+
import {Platform} from '@angular/cdk/platform';
22
import {Component, ViewChild} from '@angular/core';
3-
import {FocusTrapFactory, FocusTrapDirective, FocusTrap} from './focus-trap';
3+
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
4+
import {FocusTrap, FocusTrapDirective, FocusTrapFactory} from './focus-trap';
45
import {InteractivityChecker} from './interactivity-checker';
5-
import {Platform} from '../platform/platform';
66

77

88
describe('FocusTrap', () => {

src/cdk/a11y/interactivity-checker.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import {Platform} from '@angular/cdk/platform';
12
import {InteractivityChecker} from './interactivity-checker';
2-
import {Platform} from '../platform/platform';
3+
34

45
describe('InteractivityChecker', () => {
56
let testContainerElement: HTMLElement;

src/cdk/a11y/list-key-manager.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import {DOWN_ARROW, TAB, UP_ARROW} from '@angular/cdk/keycodes';
2+
import {first} from '@angular/cdk/rxjs';
13
import {QueryList} from '@angular/core';
24
import {fakeAsync, tick} from '@angular/core/testing';
5+
import {createKeyboardEvent} from '../testing/event-objects';
6+
import {ActiveDescendantKeyManager} from './activedescendant-key-manager';
37
import {FocusKeyManager} from './focus-key-manager';
4-
import {DOWN_ARROW, UP_ARROW, TAB} from '../keycodes/keycodes';
58
import {ListKeyManager} from './list-key-manager';
6-
import {ActiveDescendantKeyManager} from './activedescendant-key-manager';
7-
import {createKeyboardEvent} from '../testing/event-objects';
8-
import {first} from '../rxjs/index';
99

1010

1111
class FakeFocusable {

src/cdk/portal/public_api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
export * from './portal';
1010
export * from './dom-portal-host';
1111
export * from './portal-directives';
12+
export * from './portal-injector';

src/demo-app/snack-bar/snack-bar-demo.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import {Dir} from '@angular/cdk/bidi';
12
import {Component, ViewEncapsulation} from '@angular/core';
23
import {
34
MdSnackBar,
45
MdSnackBarConfig,
56
MdSnackBarHorizontalPosition,
67
MdSnackBarVerticalPosition,
7-
Dir,
88
} from '@angular/material';
99

10+
1011
@Component({
1112
moduleId: module.id,
1213
selector: 'snack-bar-demo',
@@ -24,7 +25,8 @@ export class SnackBarDemo {
2425
horizontalPosition: MdSnackBarHorizontalPosition = 'center';
2526
verticalPosition: MdSnackBarVerticalPosition = 'bottom';
2627

27-
constructor(public snackBar: MdSnackBar, private dir: Dir) { }
28+
constructor(public snackBar: MdSnackBar, private dir: Dir) {
29+
}
2830

2931
open() {
3032
let config = new MdSnackBarConfig();

src/lib/button-toggle/button-toggle.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@import '../core/a11y/a11y';
21
@import '../core/style/elevation';
32
@import '../core/style/vendor-prefixes';
43
@import '../core/style/layout-common';

src/lib/button/button.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// TODO(jelbourn): Measure perf benefits for translate3d and will-change.
22
// TODO(jelbourn): Figure out if anchor hover underline actually happens in any browser.
33
@import 'button-base';
4-
@import '../core/a11y/a11y';
4+
@import '../../cdk/a11y/a11y';
55
@import '../core/style/layout-common';
66

77
.mat-button, .mat-icon-button {

src/lib/card/card.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import '../core/style/variables';
22
@import '../core/style/elevation';
3-
@import '../core/a11y/a11y';
3+
@import '../../cdk/a11y/a11y';
44

55

66
$mat-card-default-padding: 24px !default;

src/lib/chips/chip-input.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,12 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {
10-
Directive,
11-
ElementRef,
12-
Output,
13-
EventEmitter,
14-
Input,
15-
} from '@angular/core';
169
import {coerceBooleanProperty} from '@angular/cdk/coercion';
17-
import {ENTER} from '@angular/material/core';
10+
import {ENTER} from '@angular/cdk/keycodes';
11+
import {Directive, ElementRef, EventEmitter, Input, Output,} from '@angular/core';
1812
import {MdChipList} from './chip-list';
1913

14+
2015
export interface MdChipInputEvent {
2116
input: HTMLInputElement;
2217
value: string;

src/lib/chips/chip-list.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8+
89
import {FocusKeyManager} from '@angular/cdk/a11y';
10+
import {Directionality} from '@angular/cdk/bidi';
911
import {coerceBooleanProperty} from '@angular/cdk/coercion';
1012
import {SelectionModel} from '@angular/cdk/collections';
13+
import {BACKSPACE, DELETE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW,} from '@angular/cdk/keycodes';
1114
import {startWith} from '@angular/cdk/rxjs';
1215
import {
1316
AfterContentInit,
14-
ChangeDetectorRef,
1517
ChangeDetectionStrategy,
18+
ChangeDetectorRef,
1619
Component,
1720
ContentChildren,
1821
ElementRef,
@@ -28,21 +31,11 @@ import {
2831
ViewEncapsulation,
2932
} from '@angular/core';
3033
import {ControlValueAccessor, FormGroupDirective, NgControl, NgForm} from '@angular/forms';
31-
import {
32-
BACKSPACE,
33-
DELETE,
34-
Directionality,
35-
LEFT_ARROW,
36-
RIGHT_ARROW,
37-
UP_ARROW
38-
} from '@angular/material/core';
3934
import {MdFormFieldControl} from '@angular/material/form-field';
40-
4135
import {Observable} from 'rxjs/Observable';
4236
import {merge} from 'rxjs/observable/merge';
4337
import {Subject} from 'rxjs/Subject';
4438
import {Subscription} from 'rxjs/Subscription';
45-
4639
import {MdChip, MdChipEvent, MdChipSelectionChange} from './chip';
4740
import {MdChipInput} from './chip-input';
4841

src/lib/chips/chip.ts

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import {FocusableOption} from '@angular/cdk/a11y';
1010
import {coerceBooleanProperty} from '@angular/cdk/coercion';
11+
import {BACKSPACE, DELETE, SPACE} from '@angular/cdk/keycodes';
1112
import {
1213
Directive,
1314
ElementRef,
@@ -17,17 +18,10 @@ import {
1718
Output,
1819
Renderer2,
1920
} from '@angular/core';
20-
import {
21-
BACKSPACE,
22-
CanColor,
23-
CanDisable,
24-
DELETE,
25-
mixinColor,
26-
mixinDisabled,
27-
SPACE,
28-
} from '@angular/material/core';
21+
import {CanColor, CanDisable, mixinColor, mixinDisabled} from '@angular/material/core';
2922
import {Subject} from 'rxjs/Subject';
3023

24+
3125
export interface MdChipEvent {
3226
chip: MdChip;
3327
}
@@ -41,8 +35,10 @@ export class MdChipSelectionChange {
4135
// Boilerplate for applying mixins to MdChip.
4236
/** @docs-private */
4337
export class MdChipBase {
44-
constructor(public _renderer: Renderer2, public _elementRef: ElementRef) {}
38+
constructor(public _renderer: Renderer2, public _elementRef: ElementRef) {
39+
}
4540
}
41+
4642
export const _MdChipMixinBase = mixinColor(mixinDisabled(MdChipBase), 'primary');
4743

4844

@@ -52,9 +48,10 @@ export const _MdChipMixinBase = mixinColor(mixinDisabled(MdChipBase), 'primary')
5248
*/
5349
@Directive({
5450
selector: `md-basic-chip, [md-basic-chip], mat-basic-chip, [mat-basic-chip]`,
55-
host: {'class': 'mat-basic-chip'}
51+
host: {'class': 'mat-basic-chip'},
5652
})
57-
export class MdBasicChip { }
53+
export class MdBasicChip {
54+
}
5855

5956
/**
6057
* Material design styled Chip component. Used inside the MdChipList component.
@@ -80,7 +77,7 @@ export class MdBasicChip { }
8077

8178
})
8279
export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestroy, CanColor,
83-
CanDisable {
80+
CanDisable {
8481

8582
protected _value: any;
8683

@@ -95,35 +92,44 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
9592

9693
/** Whether the chip is selected. */
9794
@Input()
98-
get selected(): boolean { return this._selected; }
95+
get selected(): boolean {
96+
return this._selected;
97+
}
9998
set selected(value: boolean) {
10099
this._selected = coerceBooleanProperty(value);
101100
this.onSelectionChange.emit({source: this, isUserInput: false});
102101
}
103-
104102
/** The value of the chip. Defaults to the content inside <md-chip> tags. */
105103
@Input()
106104
get value(): any {
107105
return this._value != undefined
108106
? this._value
109107
: this._elementRef.nativeElement.textContent;
110108
}
111-
set value(newValue: any) { this._value = newValue; }
109+
set value(newValue: any) { this._value = newValue;}
112110

113111
/**
114112
* Whether or not the chips are selectable. When a chip is not selectable,
115113
* changes to it's selected state are always ignored.
116114
*/
117-
@Input()
118-
get selectable(): boolean { return this._selectable; }
119-
set selectable(value: boolean) { this._selectable = coerceBooleanProperty(value); }
115+
@Input() get selectable(): boolean {
116+
return this._selectable;}
117+
118+
119+
set selectable(value: boolean) {
120+
this._selectable = coerceBooleanProperty(value);
121+
}
120122

121123
/**
122124
* Determines whether or not the chip displays the remove styling and emits (remove) events.
123125
*/
124-
@Input()
125-
get removable(): boolean { return this._removable; }
126-
set removable(value: boolean) { this._removable = coerceBooleanProperty(value); }
126+
@Input() get removable(): boolean {
127+
return this._removable;}
128+
129+
130+
set removable(value: boolean) {
131+
this._removable = coerceBooleanProperty(value);
132+
}
127133

128134
/** Emits when the chip is focused. */
129135
_onFocus = new Subject<MdChipEvent>();
@@ -259,11 +265,12 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
259265
selector: '[mdChipRemove], [matChipRemove]',
260266
host: {
261267
'class': 'mat-chip-remove',
262-
'(click)': '_handleClick($event)'
263-
}
268+
'(click)': '_handleClick($event)',
269+
},
264270
})
265271
export class MdChipRemove {
266-
constructor(protected _parentChip: MdChip) {}
272+
constructor(protected _parentChip: MdChip) {
273+
}
267274

268275
/** Calls the parent chip's public `remove()` method if applicable. */
269276
_handleClick() {

src/lib/chips/chips.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../core/a11y/a11y';
1+
@import '../../cdk/a11y/a11y';
22
@import '../core/style/elevation';
33

44
$mat-chip-vertical-padding: 7px;

src/lib/core/_core.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// We can use relative imports for imports from the cdk because we bundle everything
22
// up into a single flat scss file for material.
33
@import '../../cdk/overlay/overlay';
4+
@import '../../cdk/a11y/a11y';
45

56
// Core styles that can be used to apply material design treatments to any element.
6-
@import 'a11y/a11y';
77
@import 'style/elevation';
88
@import 'ripple/ripple';
99
@import 'option/option';

src/lib/core/a11y/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/lib/core/a11y/activedescendant-key-manager.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/lib/core/a11y/fake-mousedown.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/lib/core/a11y/focus-key-manager.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/lib/core/a11y/focus-trap.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/lib/core/a11y/index.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)