Skip to content

chore: remove all @internal to fix offline compile #781

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 1 commit into from
Jul 7, 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
4 changes: 2 additions & 2 deletions src/components/button-toggle/button-toggle.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<label [attr.for]="inputId" class="md-button-toggle-label">
<input #input class="md-button-toggle-input"
[type]="type"
[type]="_type"
[id]="inputId"
[checked]="checked"
[disabled]="disabled"
[name]="name"
(change)="onInputChange($event)">
(change)="_onInputChange($event)">

<div class="md-button-toggle-label-content">
<ng-content></ng-content>
Expand Down
21 changes: 7 additions & 14 deletions src/components/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class MdButtonToggleGroup implements ControlValueAccessor {

/** Child button toggle buttons. */
@ContentChildren(forwardRef(() => MdButtonToggle))
private _buttonToggles: QueryList<MdButtonToggle> = null;
_buttonToggles: QueryList<MdButtonToggle> = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this one changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ContentChildren etc. also can't be private, since Angular itself needs to touch them


@Input()
get name(): string {
Expand Down Expand Up @@ -219,11 +219,8 @@ export class MdButtonToggle implements OnInit {
/** Whether or not this button toggle is checked. */
private _checked: boolean = false;

/**
* Type of the button toggle. Either 'radio' or 'checkbox'.
* @internal
*/
type: ToggleType;
/** Type of the button toggle. Either 'radio' or 'checkbox'. */
_type: ToggleType;

/** The unique ID for this button toggle. */
@HostBinding()
Expand Down Expand Up @@ -269,18 +266,17 @@ export class MdButtonToggle implements OnInit {
}
});

this.type = 'radio';
this._type = 'radio';
this.name = this.buttonToggleGroup.name;
this._isSingleSelector = true;
} else {
// Even if there is no group at all, treat the button toggle as a checkbox so it can be
// toggled on or off.
this.type = 'checkbox';
this._type = 'checkbox';
this._isSingleSelector = false;
}
}

/** @internal */
ngOnInit() {
if (this.id == null) {
this.id = `md-button-toggle-${_uniqueIdCounter++}`;
Expand Down Expand Up @@ -359,11 +355,8 @@ export class MdButtonToggle implements OnInit {
this.checked = !this.checked;
}

/**
* Checks the button toggle due to an interaction with the underlying native input.
* @internal
*/
onInputChange(event: Event) {
/** Checks the button toggle due to an interaction with the underlying native input. */
_onInputChange(event: Event) {
event.stopPropagation();

if (this._isSingleSelector) {
Expand Down
46 changes: 21 additions & 25 deletions src/components/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
inputs: ['color'],
host: {
'[class.md-button-focus]': 'isKeyboardFocused',
'(mousedown)': 'setMousedown()',
'(focus)': 'setKeyboardFocus()',
'(blur)': 'removeKeyboardFocus()',
'(mousedown)': '_setMousedown()',
'(focus)': '_setKeyboardFocus()',
'(blur)': '_removeKeyboardFocus()',
},
templateUrl: 'button.html',
styleUrls: ['button.css'],
Expand All @@ -34,12 +34,12 @@ export class MdButton {
private _color: string;

/** Whether the button has focus from the keyboard (not the mouse). Used for class binding. */
isKeyboardFocused: boolean = false;
_isKeyboardFocused: boolean = false;

/** Whether a mousedown has occurred on this element in the last 100ms. */
isMouseDown: boolean = false;
_isMouseDown: boolean = false;

constructor(private elementRef: ElementRef, private renderer: Renderer) { }
constructor(private _elementRef: ElementRef, private _renderer: Renderer) { }

get color(): string {
return this._color;
Expand All @@ -49,14 +49,13 @@ export class MdButton {
this._updateColor(value);
}

/** @internal */
setMousedown() {
_setMousedown() {
// We only *show* the focus style when focus has come to the button via the keyboard.
// The Material Design spec is silent on this topic, and without doing this, the
// button continues to look :active after clicking.
// @see http://marcysutton.com/button-focus-hell/
this.isMouseDown = true;
setTimeout(() => { this.isMouseDown = false; }, 100);
this._isMouseDown = true;
setTimeout(() => { this._isMouseDown = false; }, 100);
}

_updateColor(newColor: string) {
Expand All @@ -67,23 +66,21 @@ export class MdButton {

_setElementColor(color: string, isAdd: boolean) {
if (color != null && color != '') {
this.renderer.setElementClass(this.elementRef.nativeElement, `md-${color}`, isAdd);
this._renderer.setElementClass(this._elementRef.nativeElement, `md-${color}`, isAdd);
}
}

/** @internal */
setKeyboardFocus() {
this.isKeyboardFocused = !this.isMouseDown;
_setKeyboardFocus() {
this._isKeyboardFocused = !this._isMouseDown;
}

/** @internal */
removeKeyboardFocus() {
this.isKeyboardFocused = false;
_removeKeyboardFocus() {
this._isKeyboardFocused = false;
}

/** TODO(hansl): e2e test this function. */
focus() {
this.elementRef.nativeElement.focus();
this._elementRef.nativeElement.focus();
}
}

Expand All @@ -92,11 +89,11 @@ export class MdButton {
selector: 'a[md-button], a[md-raised-button], a[md-icon-button], a[md-fab], a[md-mini-fab]',
inputs: ['color'],
host: {
'[class.md-button-focus]': 'isKeyboardFocused',
'(mousedown)': 'setMousedown()',
'(focus)': 'setKeyboardFocus()',
'(blur)': 'removeKeyboardFocus()',
'(click)': 'haltDisabledEvents($event)',
'[class.md-button-focus]': '_isKeyboardFocused',
'(mousedown)': '_setMousedown()',
'(focus)': '_setKeyboardFocus()',
'(blur)': '_removeKeyboardFocus()',
'(click)': '_haltDisabledEvents($event)',
},
templateUrl: 'button.html',
styleUrls: ['button.css'],
Expand Down Expand Up @@ -129,8 +126,7 @@ export class MdAnchor extends MdButton {
this._disabled = (value != null && value != false) ? true : null;
}

/** @internal */
haltDisabledEvents(event: Event) {
_haltDisabledEvents(event: Event) {
// A disabled button shouldn't apply any actions
if (this.disabled) {
event.preventDefault();
Expand Down
8 changes: 4 additions & 4 deletions src/components/checkbox/checkbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
[indeterminate]="indeterminate"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledby"
(focus)="onInputFocus()"
(blur)="onInputBlur()"
(change)="onInteractionEvent($event)"
(click)="onInputClick($event)">
(focus)="_onInputFocus()"
(blur)="_onInputBlur()"
(change)="_onInteractionEvent($event)"
(click)="_onInputClick($event)">
<div class="md-ink-ripple"></div>
<div class="md-checkbox-frame"></div>
<div class="md-checkbox-background">
Expand Down
4 changes: 2 additions & 2 deletions src/components/checkbox/checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ describe('MdCheckbox', () => {
expect(checkboxInstance.checked).toBe(false);
expect(checkboxInstance.indeterminate).toBe(true);

checkboxInstance.onInteractionEvent(<Event>{stopPropagation: () => {}});
checkboxInstance._onInteractionEvent(<Event>{stopPropagation: () => {}});

expect(checkboxInstance.checked).toBe(true);
expect(checkboxInstance.indeterminate).toBe(false);

checkboxInstance.onInteractionEvent(<Event>{stopPropagation: () => {}});
checkboxInstance._onInteractionEvent(<Event>{stopPropagation: () => {}});
fixture.detectChanges();

expect(checkboxInstance.checked).toBe(false);
Expand Down
20 changes: 6 additions & 14 deletions src/components/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,13 @@ export class MdCheckbox implements AfterContentInit, ControlValueAccessor {
this.change.emit(event);
}

/**
* Informs the component when the input has focus so that we can style accordingly
* @internal
*/
onInputFocus() {
/** Informs the component when the input has focus so that we can style accordingly */
_onInputFocus() {
this.hasFocus = true;
}

/**
* Informs the component when we lose focus in order to style accordingly
* @internal
*/
onInputBlur() {
/** Informs the component when we lose focus in order to style accordingly */
_onInputBlur() {
this.hasFocus = false;
this.onTouched();
}
Expand All @@ -265,9 +259,8 @@ export class MdCheckbox implements AfterContentInit, ControlValueAccessor {
* Event handler for checkbox input element.
* Toggles checked state if element is not disabled.
* @param event
* @internal
*/
onInteractionEvent(event: Event) {
_onInteractionEvent(event: Event) {
// We always have to stop propagation on the change event.
// Otherwise the change event, from the input element, will bubble up and
// emit its event object to the `change` output.
Expand All @@ -278,8 +271,7 @@ export class MdCheckbox implements AfterContentInit, ControlValueAccessor {
}
}

/** @internal */
onInputClick(event: Event) {
_onInputClick(event: Event) {
// We have to stop propagation for click events on the visual hidden input element.
// By default, when a user clicks on a label element, a generated click event will be
// dispatched on the associated input element. Since we are using a label element as our
Expand Down
4 changes: 2 additions & 2 deletions src/components/grid-list/grid-list-measure.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

/**
* Converts values into strings. Falsy values become empty strings.
* @internal
* TODO: internal
*/
export function coerceToString(value: string | number): string {
return `${value || ''}`;
}

/**
* Converts a value that might be a string into a number.
* @internal
* TODO: internal
*/
export function coerceToNumber(value: string | number): number {
return typeof value === 'string' ? parseInt(value, 10) : value;
Expand Down
11 changes: 4 additions & 7 deletions src/components/grid-list/grid-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class MdGridList implements OnInit, AfterContentChecked {
private _tileStyler: TileStyler;

/** Query list of tiles that are being rendered. */
@ContentChildren(MdGridTile) private _tiles: QueryList<MdGridTile>;
@ContentChildren(MdGridTile) _tiles: QueryList<MdGridTile>;

constructor(
private _renderer: Renderer,
Expand Down Expand Up @@ -139,14 +139,11 @@ export class MdGridList implements OnInit, AfterContentChecked {
let tile = tiles[i];
this._tileStyler.setStyle(tile, pos.row, pos.col);
}
this.setListStyle(this._tileStyler.getComputedHeight());
this._setListStyle(this._tileStyler.getComputedHeight());
}

/**
* Sets style on the main grid-list element, given the style name and value.
* @internal
*/
setListStyle(style: [string, string]): void {
/** Sets style on the main grid-list element, given the style name and value. */
_setListStyle(style: [string, string]): void {
if (style) {
this._renderer.setElementStyle(this._element.nativeElement, style[0], style[1]);
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/grid-list/grid-tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export class MdGridTile {
this._colspan = coerceToNumber(value);
}

/** Sets the style of the grid-tile element. Needs to be set manually to avoid
/**
* Sets the style of the grid-tile element. Needs to be set manually to avoid
* "Changed after checked" errors that would occur with HostBinding.
* @internal
*/
setStyle(property: string, value: string): void {
_setStyle(property: string, value: string): void {
this._renderer.setElementStyle(this._element.nativeElement, property, value);
}

Expand Down
4 changes: 1 addition & 3 deletions src/components/grid-list/tile-coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ export class TileCoordinator {
}
}

/** Simple data structure for tile position (row, col).
* @internal
*/
/** Simple data structure for tile position (row, col). */
export class TilePosition {
constructor(public row: number, public col: number) {}
}
Loading