Skip to content

refactor: change the toolkit directive prefixes and remove Md prefix from toolkit classes #2258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/components/dialog/dialog.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('dialog', () => {
browser.actions()
// We need to move the cursor to the top left so
// the dialog doesn't receive the click accidentally.
.mouseMove(element(by.css('.md-overlay-backdrop')).getWebElement(), { x: 0, y: 0 })
.mouseMove(element(by.css('.cdk-overlay-backdrop')).getWebElement(), { x: 0, y: 0 })
.click()
.perform();
}
Expand Down
2 changes: 1 addition & 1 deletion e2e/components/menu/menu-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class MenuPage {

triggerTwo() { return element(by.id('trigger-two')); }

backdrop() { return element(by.css('.md-overlay-backdrop')); }
backdrop() { return element(by.css('.cdk-overlay-backdrop')); }

items(index: number) { return element.all(by.css('[md-menu-item]')).get(index); }

Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/button-toggle/button-toggle-demo.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {Component} from '@angular/core';
import {MdUniqueSelectionDispatcher} from '@angular/material';
import {UniqueSelectionDispatcher} from '@angular/material';

@Component({
moduleId: module.id,
selector: 'button-toggle-demo',
templateUrl: 'button-toggle-demo.html',
providers: [MdUniqueSelectionDispatcher],
providers: [UniqueSelectionDispatcher],
})
export class ButtonToggleDemo {
isVertical = false;
Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/live-announcer/live-announcer-demo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {MdLiveAnnouncer} from '@angular/material';
import {LiveAnnouncer} from '@angular/material';

@Component({
moduleId: module.id,
Expand All @@ -8,7 +8,7 @@ import {MdLiveAnnouncer} from '@angular/material';
})
export class LiveAnnouncerDemo {

constructor(private live: MdLiveAnnouncer) {}
constructor(private live: LiveAnnouncer) {}

announceText(message: string) {
this.live.announce(message);
Expand Down
10 changes: 5 additions & 5 deletions src/demo-app/overlay/overlay-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
Pasta 2
</button>

<button overlay-origin (click)="openSpaghettiPanel()">
<button cdk-overlay-origin (click)="openSpaghettiPanel()">
Pasta 3
</button>


<button overlay-origin #trigger="overlayOrigin" (click)="isMenuOpen = !isMenuOpen">
<button cdk-overlay-origin #trigger="cdkOverlayOrigin" (click)="isMenuOpen = !isMenuOpen">
Open menu
</button>

<template connected-overlay [origin]="trigger" [width]="500" hasBackdrop [open]="isMenuOpen"
<template cdk-connected-overlay [origin]="trigger" [width]="500" hasBackdrop [open]="isMenuOpen"
(backdropClick)="isMenuOpen=false">
<div style="background-color: mediumpurple" >
This is the menu panel.
</div>
</template>

<!-- Template to load into an overlay. -->
<template portal>
<template cdk-portal>
<p class="demo-fusilli"> Fusilli </p>
</template>

<button (click)="openPanelWithBackdrop()">Backdrop panel</button>
<button (click)="openPanelWithBackdrop()">Backdrop panel</button>
2 changes: 1 addition & 1 deletion src/demo-app/overlay/overlay-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class OverlayDemo {
.global()
.centerHorizontally();
config.hasBackdrop = true;
config.backdropClass = 'md-overlay-transparent-backdrop';
config.backdropClass = 'cdk-overlay-transparent-backdrop';

let overlayRef = this.overlay.create(config);
overlayRef.attach(this.templatePortals.first);
Expand Down
4 changes: 2 additions & 2 deletions src/demo-app/platform/platform-demo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {MdPlatform, getSupportedInputTypes} from '@angular/material';
import {Platform, getSupportedInputTypes} from '@angular/material';


@Component({
Expand All @@ -10,5 +10,5 @@ import {MdPlatform, getSupportedInputTypes} from '@angular/material';
export class PlatformDemo {
supportedInputTypes = getSupportedInputTypes();

constructor(public platform: MdPlatform) {}
constructor(public platform: Platform) {}
}
6 changes: 3 additions & 3 deletions src/demo-app/portal/portal-demo.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2> The portal host is here: </h2>
<div class="demo-portal-host">
<template [portalHost]="selectedPortal"></template>
<template [cdkPortalHost]="selectedPortal"></template>
</div>

<button type="button" (click)="selectedPortal = programmingJoke">
Expand All @@ -20,12 +20,12 @@ <h2> The portal host is here: </h2>
referring to something *in* the template (such as #item in ngFor). As such, the component
has to use @ViewChild / @ViewChildren to get these references.
See https://github.com/angular/angular/issues/7158 -->
<template portal>
<template cdk-portal>
<p> - Why don't jokes work in octal?</p>
<p> - Because 7 10 11.</p>
</template>

<div *portal>
<div *cdk-portal>
<p> - Did you hear about this year's Fibonacci Conference? </p>
<p> - It's going to be as big as the last two put together. </p>
</div>
2 changes: 1 addition & 1 deletion src/demo-app/projection/projection-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {DomProjectionHost, DomProjection} from '@angular/material';
template: `
<div class="demo-outer {{cssClass}}">
Before
<dom-projection-host><ng-content></ng-content></dom-projection-host>
<cdk-dom-projection-host><ng-content></ng-content></cdk-dom-projection-host>
After
</div>
`,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/button-toggle/button-toggle.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<label [attr.for]="inputId" class="md-button-toggle-label">
<input #input class="md-button-toggle-input md-visually-hidden"
<input #input class="md-button-toggle-input cdk-visually-hidden"
[type]="_type"
[id]="inputId"
[checked]="checked"
Expand Down
6 changes: 3 additions & 3 deletions src/lib/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import {NG_VALUE_ACCESSOR, ControlValueAccessor, FormsModule} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import {
MdUniqueSelectionDispatcher,
UniqueSelectionDispatcher,
coerceBooleanProperty,
DefaultStyleCompatibilityModeModule,
} from '../core';
Expand Down Expand Up @@ -298,7 +298,7 @@ export class MdButtonToggle implements OnInit {

constructor(@Optional() toggleGroup: MdButtonToggleGroup,
@Optional() toggleGroupMultiple: MdButtonToggleGroupMultiple,
public buttonToggleDispatcher: MdUniqueSelectionDispatcher,
public buttonToggleDispatcher: UniqueSelectionDispatcher,
private _renderer: Renderer) {
this.buttonToggleGroup = toggleGroup;

Expand Down Expand Up @@ -445,7 +445,7 @@ export class MdButtonToggleModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdButtonToggleModule,
providers: [MdUniqueSelectionDispatcher]
providers: [UniqueSelectionDispatcher]
};
}
}
4 changes: 2 additions & 2 deletions src/lib/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
pointer-events: none;
opacity: 0;

@include md-high-contrast {
@include cdk-high-contrast {
// Note that IE will render this in the same way, no
// matter whether the theme is light or dark. This helps
// with the readability of focused buttons.
Expand All @@ -98,7 +98,7 @@
}

// Add an outline to make it more visible in high contrast mode.
@include md-high-contrast {
@include cdk-high-contrast {
[md-button], [md-raised-button], [md-icon-button], [md-fab], [md-mini-fab] {
outline: solid 1px;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ md-card {
border-radius: $md-card-border-radius;
font-family: $md-font-family;

@include md-high-contrast {
@include cdk-high-contrast {
outline: solid 1px;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/checkbox/checkbox.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<label class="md-checkbox-layout">
<div class="md-checkbox-inner-container">
<input #input
class="md-checkbox-input md-visually-hidden" type="checkbox"
class="md-checkbox-input cdk-visually-hidden" type="checkbox"
[id]="inputId"
[required]="required"
[checked]="checked"
Expand Down
4 changes: 2 additions & 2 deletions src/lib/chips/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Renderer
} from '@angular/core';

import {MdFocusable} from '../core/a11y/list-key-manager';
import {Focusable} from '../core/a11y/list-key-manager';
import {coerceBooleanProperty} from '../core/coercion/boolean-property';

export interface MdChipEvent {
Expand All @@ -32,7 +32,7 @@ export interface MdChipEvent {
'(click)': '_handleClick($event)'
}
})
export class MdChip implements MdFocusable, OnInit, OnDestroy {
export class MdChip implements Focusable, OnInit, OnDestroy {

/* Whether or not the chip is disabled. */
protected _disabled: boolean = null;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
}

@include md-ripple();
@include md-a11y();
@include md-overlay();
@include cdk-a11y();
@include cdk-overlay();
}

// Mixin that renders all of the core styles that depend on the theme.
Expand Down
8 changes: 4 additions & 4 deletions src/lib/core/a11y/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# MdLiveAnnouncer
`MdLiveAnnouncer` is a service, which announces messages to several screenreaders.
# LiveAnnouncer
`LiveAnnouncer` is a service, which announces messages to several screenreaders.

### Methods

Expand All @@ -12,11 +12,11 @@ The service can be injected in a component.
```ts
@Component({
selector: 'my-component'
providers: [MdLiveAnnouncer]
providers: [LiveAnnouncer]
})
export class MyComponent {

constructor(live: MdLiveAnnouncer) {
constructor(live: LiveAnnouncer) {
live.announce("Hey Google");
}

Expand Down
6 changes: 3 additions & 3 deletions src/lib/core/a11y/_a11y.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@mixin md-a11y {
.md-visually-hidden {
@mixin cdk-a11y {
.cdk-visually-hidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
Expand All @@ -17,7 +17,7 @@
* to Microsoft browsers. Chrome can be included by checking for the `html[hc]`
* attribute, however Chrome handles high contrast differently.
*/
@mixin md-high-contrast {
@mixin cdk-high-contrast {
@media screen and (-ms-high-contrast: active) {
@content;
}
Expand Down
20 changes: 10 additions & 10 deletions src/lib/core/a11y/focus-trap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {By} from '@angular/platform-browser';
import {Component} from '@angular/core';
import {FocusTrap} from './focus-trap';
import {InteractivityChecker} from './interactivity-checker';
import {MdPlatform} from '../platform/platform';
import {Platform} from '../platform/platform';


describe('FocusTrap', () => {
Expand All @@ -12,12 +12,12 @@ describe('FocusTrap', () => {

let fixture: ComponentFixture<FocusTrapTestApp>;
let focusTrapInstance: FocusTrap;
let platform: MdPlatform = new MdPlatform();
let platform: Platform = new Platform();

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [FocusTrap, FocusTrapTestApp],
providers: [InteractivityChecker, MdPlatform]
providers: [InteractivityChecker, Platform]
});

TestBed.compileComponents();
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('FocusTrap', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [FocusTrap, FocusTrapTargetTestApp],
providers: [InteractivityChecker, MdPlatform]
providers: [InteractivityChecker, Platform]
});

TestBed.compileComponents();
Expand Down Expand Up @@ -87,23 +87,23 @@ describe('FocusTrap', () => {

@Component({
template: `
<focus-trap>
<cdk-focus-trap>
<input>
<button>SAVE</button>
</focus-trap>
</cdk-focus-trap>
`
})
class FocusTrapTestApp { }


@Component({
template: `
<focus-trap>
<cdk-focus-trap>
<input>
<button id="last" md-focus-end></button>
<button id="first" md-focus-start>SAVE</button>
<button id="last" cdk-focus-end></button>
<button id="first" cdk-focus-start>SAVE</button>
<input>
</focus-trap>
</cdk-focus-trap>
`
})
class FocusTrapTargetTestApp { }
6 changes: 3 additions & 3 deletions src/lib/core/a11y/focus-trap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {coerceBooleanProperty} from '../coercion/boolean-property';
*/
@Component({
moduleId: module.id,
selector: 'focus-trap',
selector: 'cdk-focus-trap, focus-trap',
templateUrl: 'focus-trap.html',
encapsulation: ViewEncapsulation.None,
})
Expand Down Expand Up @@ -51,7 +51,7 @@ export class FocusTrap {
/** Focuses the first tabbable element within the focus trap region. */
focusFirstTabbableElement() {
let rootElement = this.trappedContent.nativeElement;
let redirectToElement = rootElement.querySelector('[md-focus-start]') as HTMLElement ||
let redirectToElement = rootElement.querySelector('[cdk-focus-start]') as HTMLElement ||
this._getFirstTabbableElement(rootElement);

if (redirectToElement) {
Expand All @@ -62,7 +62,7 @@ export class FocusTrap {
/** Focuses the last tabbable element within the focus trap region. */
focusLastTabbableElement() {
let rootElement = this.trappedContent.nativeElement;
let focusTargets = rootElement.querySelectorAll('[md-focus-end]');
let focusTargets = rootElement.querySelectorAll('[cdk-focus-end]');
let redirectToElement: HTMLElement = null;

if (focusTargets.length) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/core/a11y/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {FocusTrap} from './focus-trap';
import {MdLiveAnnouncer} from './live-announcer';
import {LiveAnnouncer} from './live-announcer';
import {InteractivityChecker} from './interactivity-checker';
import {CommonModule} from '@angular/common';
import {PlatformModule} from '../platform/index';

export const A11Y_PROVIDERS = [MdLiveAnnouncer, InteractivityChecker];
export const A11Y_PROVIDERS = [LiveAnnouncer, InteractivityChecker];

@NgModule({
imports: [CommonModule, PlatformModule],
Expand Down
Loading