Skip to content

Commit 0265f81

Browse files
doc: Migrate to typedoc generation via docgen tool
- Remove all @module annotations and most @packageDocumentation (each file gets its own module) - Manually construct navigation via new typedoc-plugin-ui-router
1 parent ee36ea0 commit 0265f81

Some content is hidden

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

83 files changed

+460
-616
lines changed

docgen.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"publishDir": "_core_docs",
3+
"include": [],
4+
"tsconfig": {
5+
"compilerOptions": {}
6+
},
7+
"navigation": {
8+
"": ["UIRouter"],
9+
"Services": ["StateService", "StateRegistry", "TransitionService", "UrlService", "UrlConfig", "UrlRules"],
10+
"Other": ["Transition", "Trace"]
11+
}
12+
}

src/common/common.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*
44
* These functions are exported, but are subject to change without notice.
55
*
6-
* @packageDocumentation @preferred @publicapi @module common
6+
* @packageDocumentation
7+
* @preferred
78
*/
89
import { isFunction, isString, isArray, isRegExp, isDate } from './predicates';
910
import { all, any, prop, curry, not } from './hof';
@@ -57,8 +58,6 @@ export type PredicateBinary<X, Y> = (x?: X, y?: Y) => boolean;
5758
*
5859
* }];
5960
* ```
60-
*
61-
* @publicapi
6261
*/
6362
export type IInjectable = Function | any[];
6463

@@ -129,9 +128,9 @@ export function createProxyFunctions(
129128
fnNames?: string[],
130129
latebind = false
131130
): Obj {
132-
const bindFunction = fnName => source()[fnName].bind(bind());
131+
const bindFunction = (fnName) => source()[fnName].bind(bind());
133132

134-
const makeLateRebindFn = fnName =>
133+
const makeLateRebindFn = (fnName) =>
135134
function lateRebindFunction() {
136135
target[fnName] = bindFunction(fnName);
137136
return target[fnName].apply(null, arguments);
@@ -182,7 +181,7 @@ export function _pushTo(arr, val?): any {
182181

183182
/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */
184183
export const deregAll = (functions: Function[]) =>
185-
functions.slice().forEach(fn => {
184+
functions.slice().forEach((fn) => {
186185
typeof fn === 'function' && fn();
187186
removeFrom(functions, fn);
188187
});
@@ -275,8 +274,8 @@ export function filter<T>(collection: TypedMap<T>, callback: (t: T, key?: string
275274
export function filter<T>(collection: any, callback: Function): T {
276275
const arr = isArray(collection),
277276
result: any = arr ? [] : {};
278-
const accept = arr ? x => result.push(x) : (x, key) => (result[key] = x);
279-
forEach(collection, function(item, i) {
277+
const accept = arr ? (x) => result.push(x) : (x, key) => (result[key] = x);
278+
forEach(collection, function (item, i) {
280279
if (callback(item, i)) accept(item, i);
281280
});
282281
return <T>result;
@@ -290,7 +289,7 @@ export function find<T>(collection: T[], callback: Predicate<T>): T;
290289
export function find(collection: any, callback: any) {
291290
let result;
292291

293-
forEach(collection, function(item, i) {
292+
forEach(collection, function (item, i) {
294293
if (result) return;
295294
if (callback(item, i)) result = item;
296295
});
@@ -328,7 +327,7 @@ export function map(collection: any, callback: any, target: typeof collection):
328327
* let vals = values(foo); // [ 1, 2, 3 ]
329328
* ```
330329
*/
331-
export const values: (<T>(obj: TypedMap<T>) => T[]) = (obj: Obj) => Object.keys(obj).map(key => obj[key]);
330+
export const values: <T>(obj: TypedMap<T>) => T[] = (obj: Obj) => Object.keys(obj).map((key) => obj[key]);
332331

333332
/**
334333
* Reduce function that returns true if all of the values are truthy.
@@ -451,7 +450,7 @@ export const assertPredicate: <T>(predicate: Predicate<T>, errMsg: string | Func
451450
*/
452451
export const assertMap: <T, U>(mapFn: (t: T) => U, errMsg: string | Function) => (t: T) => U = assertFn;
453452
export function assertFn(predicateOrMap: Function, errMsg: string | Function = 'assert failure'): any {
454-
return obj => {
453+
return (obj) => {
455454
const result = predicateOrMap(obj);
456455
if (!result) {
457456
throw new Error(isFunction(errMsg) ? (<Function>errMsg)(obj) : errMsg);
@@ -469,7 +468,7 @@ export function assertFn(predicateOrMap: Function, errMsg: string | Function = '
469468
* pairs({ foo: "FOO", bar: "BAR }) // [ [ "foo", "FOO" ], [ "bar": "BAR" ] ]
470469
* ```
471470
*/
472-
export const pairs = (obj: Obj) => Object.keys(obj).map(key => [key, obj[key]]);
471+
export const pairs = (obj: Obj) => Object.keys(obj).map((key) => [key, obj[key]]);
473472

474473
/**
475474
* Given two or more parallel arrays, returns an array of tuples where
@@ -507,7 +506,7 @@ export function arrayTuples(...args: any[]): any[] {
507506
result.push([args[0][i], args[1][i], args[2][i], args[3][i]]);
508507
break;
509508
default:
510-
result.push(args.map(array => array[i]));
509+
result.push(args.map((array) => array[i]));
511510
break;
512511
}
513512
}
@@ -552,15 +551,15 @@ export function tail<T>(arr: T[]): T {
552551
* shallow copy from src to dest
553552
*/
554553
export function copy(src: Obj, dest?: Obj) {
555-
if (dest) Object.keys(dest).forEach(key => delete dest[key]);
554+
if (dest) Object.keys(dest).forEach((key) => delete dest[key]);
556555
if (!dest) dest = {};
557556
return extend(dest, src);
558557
}
559558

560559
/** Naive forEach implementation works with Objects or Arrays */
561560
function _forEach(obj: any[] | any, cb: (el, idx?) => void, _this: Obj) {
562561
if (isArray(obj)) return obj.forEach(cb, _this);
563-
Object.keys(obj).forEach(key => cb(obj[key], key));
562+
Object.keys(obj).forEach((key) => cb(obj[key], key));
564563
}
565564

566565
/** Like Object.assign() */
@@ -615,5 +614,5 @@ function _arraysEq(a1: any[], a2: any[]) {
615614
}
616615

617616
// issue #2676
618-
export const silenceUncaughtInPromise = (promise: Promise<any>) => promise.catch(e => 0) && promise;
617+
export const silenceUncaughtInPromise = (promise: Promise<any>) => promise.catch((e) => 0) && promise;
619618
export const silentRejection = (error: any) => silenceUncaughtInPromise(services.$q.reject(error));

src/common/coreservices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* This module is a stub for core services such as Dependency Injection or Browser Location.
33
* Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.
44
*
5-
* @packageDocumentation @publicapi @module common
5+
* @packageDocumentation
66
*/
77
import { IInjectable, Obj } from './common';
88
import { Disposable } from '../interface';

src/common/glob.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/** @packageDocumentation @publicapi @module core */
21
/**
32
* Matches state names using glob-like pattern strings.
43
*
@@ -46,6 +45,7 @@
4645
* | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` |
4746
* | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` |
4847
*
48+
* @packageDocumentation
4949
*/
5050
export class Glob {
5151
text: string;
@@ -68,7 +68,7 @@ export class Glob {
6868

6969
const regexpString = this.text
7070
.split('.')
71-
.map(seg => {
71+
.map((seg) => {
7272
if (seg === '**') return '(?:|(?:\\.[^.]*)*)';
7373
if (seg === '*') return '\\.[^.]*';
7474
return '\\.' + seg;

src/common/hof.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* These utility functions are exported, but are subject to change without notice.
55
*
6-
* @packageDocumentation @module common_hof
6+
* @packageDocumentation
77
*/
88

99
import { Predicate } from './common';
@@ -67,7 +67,7 @@ export function curry(fn: Function): Function {
6767
export function compose() {
6868
const args = arguments;
6969
const start = args.length - 1;
70-
return function() {
70+
return function () {
7171
let i = start,
7272
result = args[start].apply(this, arguments);
7373
while (i--) result = args[i].call(this, result);
@@ -203,7 +203,7 @@ export function invoke(fnName: string, args?: any[]): Function {
203203
* @returns {function(any): *}
204204
*/
205205
export function pattern(struct: Function[][]): Function {
206-
return function(x: any) {
206+
return function (x: any) {
207207
for (let i = 0; i < struct.length; i++) {
208208
if (struct[i][0](x)) return struct[i][1](x);
209209
}

src/common/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/** @packageDocumentation @publicapi @module common */
21
export * from './common';
32
export * from './coreservices';
43
export * from './glob';

src/common/predicates.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/** Predicates
1+
/**
2+
* Predicates
23
*
34
* These predicates return true/false based on the input.
45
* Although these functions are exported, they are subject to change without notice.
56
*
6-
* @packageDocumentation @module common_predicates
7+
* @packageDocumentation
78
*/
89
import { and, not, pipe, prop, or } from './hof';
910
import { Predicate } from './common'; // has or is using
@@ -43,10 +44,4 @@ export function isInjectable(val: any) {
4344
*
4445
* It is probably a Promise if it's an object, and it has a `then` property which is a Function
4546
*/
46-
export const isPromise = <(x: any) => x is Promise<any>>and(
47-
isObject,
48-
pipe(
49-
prop('then'),
50-
isFunction
51-
)
52-
);
47+
export const isPromise = <(x: any) => x is Promise<any>>and(isObject, pipe(prop('then'), isFunction));

src/common/queue.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/** @packageDocumentation @publicapi @module common */
21
import { pushTo } from './common';
32

43
export class Queue<T> {
@@ -16,7 +15,7 @@ export class Queue<T> {
1615

1716
evict(): T {
1817
const item: T = this._items.shift();
19-
this._evictListeners.forEach(fn => fn(item));
18+
this._evictListeners.forEach((fn) => fn(item));
2019
return item;
2120
}
2221

src/common/safeConsole.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* workaround for missing console object in IE9 when dev tools haven't been opened o_O
3-
* @packageDocumentation @module core
3+
* @packageDocumentation
44
*/
55
/* tslint:disable:no-console */
66
import { noop } from './common';

src/common/strings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Although these functions are exported, they are subject to change without notice.
55
*
6-
* @packageDocumentation @module common_strings
6+
* @packageDocumentation
77
*/
88

99
import { isArray, isFunction, isInjectable, isNull, isObject, isPromise, isString, isUndefined } from './predicates';
@@ -41,8 +41,8 @@ export function padString(length: number, str: string) {
4141

4242
export function kebobString(camelCase: string) {
4343
return camelCase
44-
.replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char
45-
.replace(/([A-Z])/g, $1 => '-' + $1.toLowerCase()); // replace rest
44+
.replace(/^([A-Z])/, ($1) => $1.toLowerCase()) // replace first char
45+
.replace(/([A-Z])/g, ($1) => '-' + $1.toLowerCase()); // replace rest
4646
}
4747

4848
export function functionToString(fn: Function) {

0 commit comments

Comments
 (0)