Skip to content

Commit 438445b

Browse files
docs(ng2): Mark internal docs as @internalapi to reduce clutter
1 parent 1c03c16 commit 438445b

File tree

9 files changed

+121
-57
lines changed

9 files changed

+121
-57
lines changed

src/ng2.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
/**
2-
* Main entry point for angular 2.x build
3-
* @module ng2
4-
*/
5-
/** for typedoc */
6-
1+
/** @module ng2 */ /** for typedoc */
72
export * from "ui-router-core";
83
import "ui-router-core/lib/justjs";
94

src/ng2/directives/directives.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* - [[UISref]]: A state ref to a target state; navigates when clicked
66
* - [[UISrefActive]]: (and `UISrefActiveEq`) Adds a css class when a UISref's target state (or a child state) is active
77
*
8-
* @preferred @module ng2_directives
8+
* @preferred @module directives
99
*/ /** */
1010
import {UISref, AnchorUISref} from "./uiSref";
1111
import {UISrefActive} from "./uiSrefActive";
@@ -17,10 +17,12 @@ export * from "./uiSref";
1717
export * from "./uiSrefStatus";
1818
export * from "./uiSrefActive";
1919

20+
/** @internalapi */
2021
export const _UIROUTER_DIRECTIVES = [UISref, AnchorUISref, UIView, UISrefActive, UISrefStatus];
2122

2223
/**
2324
* References to the UI-Router directive classes, for use within a @Component's `directives:` property
2425
* @deprecated use [[UIRouterModule]]
26+
* @internalapi
2527
*/
2628
export const UIROUTER_DIRECTIVES = _UIROUTER_DIRECTIVES;

src/ng2/directives/uiSref.ts

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @module ng2_directives */ /** */
1+
/** @module directives */ /** */
22
import {UIRouter, UIRouterGlobals} from "ui-router-core";
33
import {Directive, Inject, Input} from "@angular/core";
44
import {Optional} from "@angular/core";
@@ -12,7 +12,10 @@ import {Subscription, ReplaySubject} from "rxjs/Rx";
1212
import {TargetState} from "ui-router-core";
1313
import "../rx";
1414

15-
/** @hidden */
15+
/**
16+
* @internalapi
17+
* # blah blah blah
18+
*/
1619
@Directive({ selector: 'a[uiSref]' })
1720
export class AnchorUISref {
1821
constructor(public _el: ElementRef, public _renderer: Renderer) { }
@@ -67,26 +70,58 @@ export class AnchorUISref {
6770
host: { '(click)': 'go()' }
6871
})
6972
export class UISref {
73+
/**
74+
* `@Input('uiSref')` The name of the state to link to
75+
*
76+
* ```html
77+
* <a uiSref="hoome">Home</a>
78+
* ```
79+
*/
7080
@Input('uiSref') state: string;
81+
82+
/**
83+
* `@Input('uiParams')` The parameter values to use (as key/values)
84+
*
85+
* ```html
86+
* <a uiSref="book" [uiParams]="{ bookId: book.id }">Book {{ book.name }}</a>
87+
* ```
88+
*/
7189
@Input('uiParams') params: any;
72-
@Input('uiOptions') options: any;
7390

91+
/**
92+
* `@Input('uiOptions')` The transition options
93+
*
94+
* ```html
95+
* <a uiSref="books" [uiOptions]="{ reload: true }">Book {{ book.name }}</a>
96+
* ```
97+
*/
98+
@Input('uiOptions') options: TransitionOptions;
99+
100+
/**
101+
* An observable (ReplaySubject) of the state this UISref is targeting.
102+
* When the UISref is clicked, it will transition to this [[TargetState]].
103+
*/
74104
public targetState$ = new ReplaySubject<TargetState>(1);
75-
private _emit: boolean = false;
76105

106+
/** @internalapi */
107+
private _emit: boolean = false;
108+
/** @internalapi */
77109
private _statesSub: Subscription;
78110

79111
constructor(
80-
private _router: UIRouter,
81-
@Inject(UIView.PARENT_INJECT) public parent: ParentUIViewInject,
82-
@Optional() private _anchorUISref: AnchorUISref,
112+
/** @internalapi */ private _router: UIRouter,
113+
/** @internalapi */ @Inject(UIView.PARENT_INJECT) public parent: ParentUIViewInject,
114+
/** @internalapi */ @Optional() private _anchorUISref: AnchorUISref,
83115
@Inject(Globals) _globals: UIRouterGlobals
84116
) {
85117
this._statesSub = _globals.states$.subscribe(() => this.update())
86118
}
87119

120+
/** @internalapi */
88121
set "uiSref"(val: string) { this.state = val; this.update(); }
122+
/** @internalapi */
89123
set "uiParams"(val: Obj) { this.params = val; this.update(); }
124+
/** @internalapi */
90125
set "uiOptions"(val: TransitionOptions) { this.options = val; this.update(); }
91126

92127
ngOnInit() {
@@ -122,6 +157,7 @@ export class UISref {
122157
return extend(defaultOpts, this.options || {});
123158
}
124159

160+
/** When triggered by a (click) event, this function transitions to the UISref's target state */
125161
go() {
126162
this._router.stateService.go(this.state, this.params, this.getOptions());
127163
return false;

src/ng2/directives/uiSrefActive.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @module ng2_directives */ /** */
1+
/** @module directives */ /** */
22
import {Directive, Input, ElementRef, Host, Renderer} from "@angular/core";
33
import {UISrefStatus, SrefStatus} from "./uiSrefStatus";
44
import {Subscription} from "rxjs/Rx";
@@ -80,10 +80,6 @@ import {Subscription} from "rxjs/Rx";
8080
* </li>
8181
* </ul>
8282
* ```
83-
*
84-
* ---
85-
*
86-
* As
8783
*/
8884
@Directive({
8985
selector: '[uiSrefActive],[uiSrefActiveEq]'

src/ng2/directives/uiSrefStatus.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @module ng2_directives */ /** */
1+
/** @module directives */ /** */
22
import {Directive, Output, EventEmitter, ContentChildren, QueryList, Inject} from "@angular/core";
33
import {UISref} from "./uiSref";
44
import {PathNode} from "ui-router-core";
@@ -11,10 +11,11 @@ import {Param} from "ui-router-core";
1111
import {PathFactory} from "ui-router-core";
1212
import {Subscription, Observable, BehaviorSubject} from "rxjs/Rx";
1313

14+
/** @internalapi */
1415
interface TransEvt { evt: string, trans: Transition }
1516

1617
/**
17-
* uiSref status booleans
18+
* UISref status emitted from [[UISrefStatus]]
1819
*/
1920
export interface SrefStatus {
2021
/** The sref's target state (or one of its children) is currently active */
@@ -27,6 +28,7 @@ export interface SrefStatus {
2728
exiting: boolean;
2829
}
2930

31+
/** @internalapi */
3032
const inactiveStatus: SrefStatus = {
3133
active: false,
3234
exact: false,
@@ -39,6 +41,8 @@ const inactiveStatus: SrefStatus = {
3941
*
4042
* The predicate returns true when the target state (and param values)
4143
* match the (tail of) the path, and the path's param values
44+
*
45+
* @internalapi
4246
*/
4347
const pathMatches = (target: TargetState): Predicate<PathNode[]> => {
4448
if (!target.exists()) return () => false;
@@ -61,6 +65,8 @@ const pathMatches = (target: TargetState): Predicate<PathNode[]> => {
6165
* Given basePath: [a, b], appendPath: [c, d]),
6266
* Expands the path to [c], [c, d]
6367
* Then appends each to [a,b,] and returns: [a, b, c], [a, b, c, d]
68+
*
69+
* @internalapi
6470
*/
6571
function spreadToSubPaths(basePath: PathNode[], appendPath: PathNode[]): PathNode[][] {
6672
return appendPath.map(node => basePath.concat(PathFactory.subPath(appendPath, n => n.state === node.state)));
@@ -71,6 +77,8 @@ function spreadToSubPaths(basePath: PathNode[], appendPath: PathNode[]): PathNod
7177
* and a UISref Target State, return a SrefStatus object
7278
* which represents the current status of that Sref:
7379
* active, activeEq (exact match), entering, exiting
80+
*
81+
* @internalapi
7482
*/
7583
function getSrefStatus(event: TransEvt, srefTarget: TargetState): SrefStatus {
7684
const pathMatchesTarget = pathMatches(srefTarget);
@@ -106,6 +114,7 @@ function getSrefStatus(event: TransEvt, srefTarget: TargetState): SrefStatus {
106114
} as SrefStatus;
107115
}
108116

117+
/** @internalapi */
109118
function mergeSrefStatus(left: SrefStatus, right: SrefStatus) {
110119
return {
111120
active: left.active || right.active,
@@ -118,11 +127,17 @@ function mergeSrefStatus(left: SrefStatus, right: SrefStatus) {
118127
/**
119128
* A directive which emits events when a paired [[UISref]] status changes.
120129
*
121-
* This directive is primarily used by the [[UISrefActive]]/[[UISrefActiveEq]] directives to monitor `UISref`(s).
122-
* This directive shares the same attribute selectors as `UISrefActive/Eq`, so it is created whenever a `UISrefActive/Eq` is created.
130+
* This directive is primarily used by the [[UISrefActive]] directives to monitor `UISref`(s).
131+
*
132+
* This directive shares two attribute selectors with `UISrefActive`:
133+
*
134+
* - `[uiSrefActive]`
135+
* - `[uiSrefActiveEq]`.
136+
*
137+
* Thus, whenever a `UISrefActive` directive is created, a `UISrefStatus` directive is also created.
123138
*
124-
* Most apps should simply use [[UISrefActive]], but some advanced components may want to process the
125-
* `uiSrefStatus` events directly.
139+
* Most apps should simply use `UISrefActive`, but some advanced components may want to process the
140+
* [[SrefStatus]] events directly.
126141
*
127142
* ```js
128143
* <li (uiSrefStatus)="onSrefStatusChanged($event)">

src/ng2/directives/uiView.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @module ng2_directives */ /** */
1+
/** @module directives */ /** */
22
import {
33
Component, ComponentFactoryResolver, ViewContainerRef, Input, ComponentRef, Type,
44
ReflectiveInjector, ViewChild, Injector, Inject
@@ -16,18 +16,26 @@ import {MergeInjector} from "../mergeInjector";
1616
/** @hidden */
1717
let id = 0;
1818

19-
// These are provide()d as the string UIView.PARENT_INJECT
19+
/** @internalapi These are provide()d as the string UIView.PARENT_INJECT */
2020
export interface ParentUIViewInject {
2121
context: ViewContext;
2222
fqn: string;
2323
}
2424

25+
/** @internalapi */
2526
interface InputMapping {
2627
token: string;
2728
prop: string;
2829
}
2930

30-
/** @hidden */
31+
/**
32+
* Given a component class, gets the inputs of styles:
33+
*
34+
* - @Input('foo') _foo
35+
* - `inputs: ['foo']`
36+
*
37+
* @internalapi
38+
*/
3139
const ng2ComponentInputs = (ng2CompClass: Type<any>) => {
3240
/** Get "@Input('foo') _foo" inputs */
3341
let props = reflector.propMetadata(ng2CompClass);
@@ -66,9 +74,8 @@ const ng2ComponentInputs = (ng2CompClass: Type<any>) => {
6674
* is filled in by a view (as defined by a [[Ng2ViewDeclaration]] inside a [[Ng2StateDeclaration]]) when the view's
6775
* state has been activated.
6876
*
69-
* @example
77+
* #### Example:
7078
* ```js
71-
*
7279
* // This app has two states, 'foo' and 'bar'
7380
* stateRegistry.register({ name: 'foo', url: '/foo', component: FooComponent });
7481
* stateRegistry.register({ name: 'bar', url: '/bar', component: BarComponent });
@@ -85,9 +92,8 @@ const ng2ComponentInputs = (ng2CompClass: Type<any>) => {
8592
* an unnamed `ui-view` is internally named `$default`*. When a `ui-view` has a name, it will be filled in
8693
* by a matching named view.
8794
*
88-
* @example
95+
* #### Example:
8996
* ```js
90-
*
9197
* stateRegistry.register({
9298
* name: 'foo',
9399
* url: '/foo',

src/ng2/interface.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @module ng2 */ /** */
1+
/** @module state */ /** */
22
import {StateDeclaration, _ViewDeclaration} from "ui-router-core";
33
import {Transition} from "ui-router-core";
44
import {Type, OpaqueToken} from "@angular/core";
@@ -8,9 +8,8 @@ import {HookResult} from "ui-router-core";
88
* The StateDeclaration object is used to define a state or nested state.
99
* It should be registered with the [[StateRegistry]].
1010
*
11-
* @example
11+
* #### Example:
1212
* ```js
13-
*
1413
* import {FoldersComponent} from "./folders";
1514
*
1615
* // StateDeclaration object
@@ -44,19 +43,17 @@ export interface Ng2StateDeclaration extends StateDeclaration, Ng2ViewDeclaratio
4443
*
4544
* Targets three named ui-views in the parent state's template
4645
*
47-
* @example
46+
* #### Example:
4847
* ```js
49-
*
5048
* views: {
5149
* header: {component: HeaderComponent},
5250
* body: {component: BodyComponent},
5351
* footer: {component: FooterComponent}
5452
* }
5553
* ```
5654
*
57-
* @example
55+
* #### Example:
5856
* ```js
59-
*
6057
* // Targets named ui-view="header" in the template of the ancestor state 'top'
6158
* // and the named `ui-view="body" from the parent state's template.
6259
* views: {
@@ -74,9 +71,8 @@ export interface Ng2StateDeclaration extends StateDeclaration, Ng2ViewDeclaratio
7471
*
7572
* Addresses without an `@` are anchored to the parent state.
7673
*
77-
* @example
74+
* #### Example:
7875
* ```js
79-
*
8076
* // target the `<div ui-view='foo'></div>` created in the parent state's view
8177
* views: { foo: {...} }
8278
* ```
@@ -99,9 +95,8 @@ export interface Ng2StateDeclaration extends StateDeclaration, Ng2ViewDeclaratio
9995
* You can address a `ui-view` absolutely, using dotted notation, by prefixing the address with a `!`. Dotted
10096
* addresses map to the hierarchy of `ui-view`s active in the DOM:
10197
*
102-
* @example
98+
* #### Example:
10399
* ```js
104-
*
105100
* // absolutely target the `<div ui-view='nested'></div>`... which was created
106101
* // in the unnamed/$default root `<ui-view></ui-view>`
107102
* views: { '!$default.nested': {...} }
@@ -112,18 +107,16 @@ export interface Ng2StateDeclaration extends StateDeclaration, Ng2ViewDeclaratio
112107
* Absolute addressing is actually relative addressing, only anchored to the unnamed root state. You can also use
113108
* relative addressing anchored to any state, in order to target a target deeply nested `ui-views`:
114109
*
115-
* @example
110+
* #### Example:
116111
* ```js
117112
*
118-
*
119113
* // target the `<div ui-view='bar'></div>`... which was created inside the
120114
* // `<div ui-view='bar'></div>`... which was created inside the parent state's template.
121115
* views: { 'foo.bar': {...} }
122116
* ```
123117
*
124-
* @example
118+
* #### Example:
125119
* ```js
126-
*
127120
* // target the `<div ui-view='bar'></div>`... which was created in
128121
* // `<div ui-view='foo'></div>`... which was created in a template crom the state `baz.qux`
129122
* views: { 'foo.bar@baz.qux': {...} }
@@ -147,9 +140,8 @@ export interface Ng2ViewDeclaration extends _ViewDeclaration {
147140
*
148141
* ### The component class which will be used for this view.
149142
*
150-
* @example
143+
* #### Example:
151144
* ```js
152-
*
153145
* .state('profile', {
154146
* // Use the <my-profile></my-profile> component for the Unnamed view
155147
* component: MyProfileComponent,
@@ -239,9 +231,8 @@ export interface Ng2ViewDeclaration extends _ViewDeclaration {
239231
* Any component bindings that are omitted from this map get the default behavior of mapping to a resolve of the
240232
* same name.
241233
*
242-
* @example
234+
* #### Example:
243235
* ```js
244-
*
245236
* $stateProvider.state('foo', {
246237
* resolve: {
247238
* foo: function(FooService) { return FooService.get(); },

0 commit comments

Comments
 (0)