Skip to content

Commit 358af3b

Browse files
committed
fix: correct access-level on many APIs (#437)
1 parent e977984 commit 358af3b

File tree

8 files changed

+99
-88
lines changed

8 files changed

+99
-88
lines changed

src/components/button/button.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class MdButton {
4747
this._updateColor(value);
4848
}
4949

50+
/** @internal */
5051
setMousedown() {
5152
// We only *show* the focus style when focus has come to the button via the keyboard.
5253
// The Material Design spec is silent on this topic, and without doing this, the
@@ -68,10 +69,12 @@ export class MdButton {
6869
}
6970
}
7071

72+
/** @internal */
7173
setKeyboardFocus() {
7274
this.isKeyboardFocused = !this.isMouseDown;
7375
}
7476

77+
/** @internal */
7578
removeKeyboardFocus() {
7679
this.isKeyboardFocused = false;
7780
}
@@ -118,6 +121,7 @@ export class MdAnchor extends MdButton {
118121
this._disabled = (value != null && value != false) ? true : null;
119122
}
120123

124+
/** @internal */
121125
haltDisabledEvents(event: Event) {
122126
// A disabled button shouldn't apply any actions
123127
if (this.disabled) {

src/components/grid-list/grid-list.ts

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,29 @@ const MD_FIT_MODE = 'fit';
3535
})
3636
export class MdGridList implements OnInit, AfterContentChecked {
3737
/** Number of columns being rendered. */
38-
_cols: number;
38+
private _cols: number;
3939

40-
/** Row height value passed in by user. This can be one of three types:
40+
/**
41+
* Row height value passed in by user. This can be one of three types:
4142
* - Number value (ex: "100px"): sets a fixed row height to that value
4243
* - Ratio value (ex: "4:3"): sets the row height based on width:height ratio
4344
* - "Fit" mode (ex: "fit"): sets the row height to total height divided by number of rows
44-
* */
45-
_rowHeight: string;
45+
*/
46+
private _rowHeight: string;
4647

4748
/** The amount of space between tiles. This will be something like '5px' or '2em'. */
48-
_gutter: string = '1px';
49+
private _gutter: string = '1px';
4950

5051
/** Sets position and size styles for a tile */
51-
_tileStyler: TileStyler;
52+
private _tileStyler: TileStyler;
5253

5354
/** Query list of tiles that are being rendered. */
54-
@ContentChildren(MdGridTile) _tiles: QueryList<MdGridTile>;
55+
@ContentChildren(MdGridTile) private _tiles: QueryList<MdGridTile>;
5556

56-
constructor(private _renderer: Renderer, private _element: ElementRef,
57-
private _dir: Dir) {}
57+
constructor(
58+
private _renderer: Renderer,
59+
private _element: ElementRef,
60+
private _dir: Dir) {}
5861

5962
@Input()
6063
get cols() {
@@ -81,13 +84,17 @@ export class MdGridList implements OnInit, AfterContentChecked {
8184
this._setTileStyler();
8285
}
8386

87+
/** @internal */
8488
ngOnInit() {
8589
this._checkCols();
8690
this._checkRowHeight();
8791
}
8892

89-
/** The layout calculation is fairly cheap if nothing changes, so there's little cost
90-
* to run it frequently. */
93+
/**
94+
* The layout calculation is fairly cheap if nothing changes, so there's little cost
95+
* to run it frequently.
96+
* @internal
97+
*/
9198
ngAfterContentChecked() {
9299
this._layoutTiles();
93100
}
@@ -131,8 +138,9 @@ export class MdGridList implements OnInit, AfterContentChecked {
131138
this.setListStyle(this._tileStyler.getComputedHeight());
132139
}
133140

134-
/** Sets style on the main grid-list element, given the style name and value.
135-
* @internal
141+
/**
142+
* Sets style on the main grid-list element, given the style name and value.
143+
* @internal
136144
*/
137145
setListStyle(style: [string, string]): void {
138146
if (style) {
@@ -141,14 +149,16 @@ export class MdGridList implements OnInit, AfterContentChecked {
141149
}
142150
}
143151

144-
/** Converts values into strings. Falsy values become empty strings.
152+
/**
153+
* Converts values into strings. Falsy values become empty strings.
145154
* @internal
146155
*/
147156
export function coerceToString(value: string | number): string {
148157
return `${value || ''}`;
149158
}
150159

151-
/** Converts a value that might be a string into a number.
160+
/**
161+
* Converts a value that might be a string into a number.
152162
* @internal
153163
*/
154164
export function coerceToNumber(value: string | number): number {

src/components/icon/icon.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ export class MdIcon implements OnChanges, OnInit, AfterViewChecked {
8080
constructor(
8181
private _element: ElementRef,
8282
private _renderer: Renderer,
83-
private _mdIconRegistry: MdIconRegistry) {
84-
}
83+
private _mdIconRegistry: MdIconRegistry) { }
8584

8685
/**
8786
* Splits an svgIcon binding value into its icon set and icon name components.
@@ -112,6 +111,7 @@ export class MdIcon implements OnChanges, OnInit, AfterViewChecked {
112111
}
113112
}
114113

114+
/** @internal */
115115
ngOnChanges(changes: { [propertyName: string]: SimpleChange }) {
116116
const changedInputs = Object.keys(changes);
117117
// Only update the inline SVG icon if the inputs changed, to avoid unnecessary DOM operations.
@@ -133,6 +133,7 @@ export class MdIcon implements OnChanges, OnInit, AfterViewChecked {
133133
this._updateAriaLabel();
134134
}
135135

136+
/** @internal */
136137
ngOnInit() {
137138
// Update font classes because ngOnChanges won't be called if none of the inputs are present,
138139
// e.g. <md-icon>arrow</md-icon>. In this case we need to add a CSS class for the default font.
@@ -141,6 +142,7 @@ export class MdIcon implements OnChanges, OnInit, AfterViewChecked {
141142
}
142143
}
143144

145+
/** @internal */
144146
ngAfterViewChecked() {
145147
// Update aria label here because it may depend on the projected text content.
146148
// (e.g. <md-icon>home</md-icon> should use 'home').

src/components/input/input.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ import {MdError} from '../../core/errors/error';
2424

2525
const noop = () => {};
2626

27-
const MD_INPUT_CONTROL_VALUE_ACCESSOR = new Provider(
28-
NG_VALUE_ACCESSOR, {
29-
useExisting: forwardRef(() => MdInput),
30-
multi: true
31-
});
27+
const MD_INPUT_CONTROL_VALUE_ACCESSOR = new Provider(NG_VALUE_ACCESSOR, {
28+
useExisting: forwardRef(() => MdInput),
29+
multi: true
30+
});
3231

3332
// Invalid input type. Using one of these will throw an MdInputUnsupportedTypeError.
3433
const MD_INPUT_INVALID_INPUT_TYPE = [
@@ -71,9 +70,7 @@ export class MdInputDuplicatedHintError extends MdError {
7170
export class MdPlaceholder {}
7271

7372

74-
/**
75-
* The hint directive, used to tag content as hint labels (going under the input).
76-
*/
73+
/** The hint directive, used to tag content as hint labels (going under the input). */
7774
@Directive({
7875
selector: 'md-hint',
7976
host: {
@@ -202,6 +199,7 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
202199
this._onTouchedCallback = fn;
203200
}
204201

202+
/** @internal */
205203
ngAfterContentInit() {
206204
this._validateConstraints();
207205

@@ -211,6 +209,7 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
211209
});
212210
}
213211

212+
/** @internal */
214213
ngOnChanges(changes: {[key: string]: SimpleChange}) {
215214
this._validateConstraints();
216215
}

src/components/list/list.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class MdListAvatar {}
3838
export class MdListItem implements AfterContentInit {
3939
@ContentChildren(MdLine) _lines: QueryList<MdLine>;
4040

41+
/** @internal */
4142
ngAfterContentInit() {
4243
this._setLineClass(this._lines.length);
4344

@@ -47,25 +48,25 @@ export class MdListItem implements AfterContentInit {
4748
}
4849

4950
@ContentChild(MdListAvatar)
50-
set _hasAvatar(avatar: MdListAvatar) {
51+
private set _hasAvatar(avatar: MdListAvatar) {
5152
this._setClass('md-list-avatar', avatar != null);
5253
}
5354

5455
constructor(private _renderer: Renderer, private _element: ElementRef) {}
5556

56-
_setLineClass(count: number): void {
57+
private _setLineClass(count: number): void {
5758
this._resetClasses();
5859
if (count === 2 || count === 3) {
5960
this._setClass(`md-${count}-line`, true);
6061
}
6162
}
6263

63-
_resetClasses(): void {
64+
private _resetClasses(): void {
6465
this._setClass('md-2-line', false);
6566
this._setClass('md-3-line', false);
6667
}
6768

68-
_setClass(className: string, bool: boolean): void {
69+
private _setClass(className: string, bool: boolean): void {
6970
this._renderer.setElementClass(this._element.nativeElement, className, bool);
7071
}
7172
}

src/components/progress-bar/progress-bar.ts

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,31 @@ import {
2525
changeDetection: ChangeDetectionStrategy.OnPush,
2626
})
2727
export class MdProgressBar {
28-
/**
29-
* Value of the progressbar.
30-
*
31-
* Defaults to zero. Mirrored to aria-valuenow.
32-
*/
28+
/** Value of the progressbar. Defaults to zero. Mirrored to aria-valuenow. */
3329
private _value: number = 0;
30+
3431
@Input()
3532
@HostBinding('attr.aria-valuenow')
3633
get value() {
3734
return this._value;
3835
}
36+
3937
set value(v: number) {
40-
this._value = MdProgressBar.clamp(v || 0);
38+
this._value = clamp(v || 0);
4139
}
4240

43-
44-
/**
45-
* Buffer value of the progress bar.
46-
*
47-
* Defaults to zero.
48-
*/
41+
/** Buffer value of the progress bar. Defaults to zero. */
4942
private _bufferValue: number = 0;
43+
5044
@Input()
5145
get bufferValue() {
5246
return this._bufferValue;
5347
}
48+
5449
set bufferValue(v: number) {
55-
this._bufferValue = MdProgressBar.clamp(v || 0);
50+
this._bufferValue = clamp(v || 0);
5651
}
5752

58-
5953
/**
6054
* Mode of the progress bar.
6155
*
@@ -67,29 +61,29 @@ export class MdProgressBar {
6761
@HostBinding('attr.mode')
6862
mode: 'determinate' | 'indeterminate' | 'buffer' | 'query' = 'determinate';
6963

70-
71-
72-
/** Gets the current transform value for the progress bar's primary indicator. */
64+
/**
65+
* Gets the current transform value for the progress bar's primary indicator.
66+
* @internal
67+
*/
7368
primaryTransform() {
7469
let scale = this.value / 100;
7570
return `scaleX(${scale})`;
7671
}
7772

78-
7973
/**
8074
* Gets the current transform value for the progress bar's buffer indicator. Only used if the
8175
* progress mode is set to buffer, otherwise returns an undefined, causing no transformation.
76+
* @internal
8277
*/
8378
bufferTransform() {
8479
if (this.mode == 'buffer') {
8580
let scale = this.bufferValue / 100;
8681
return `scaleX(${scale})`;
8782
}
8883
}
84+
}
8985

90-
91-
/** Clamps a value to be between two numbers, by default 0 and 100. */
92-
static clamp(v: number, min = 0, max = 100) {
93-
return Math.max(min, Math.min(max, v));
94-
}
86+
/** Clamps a value to be between two numbers, by default 0 and 100. */
87+
function clamp(v: number, min = 0, max = 100) {
88+
return Math.max(min, Math.min(max, v));
9589
}

0 commit comments

Comments
 (0)