Skip to content

Commit bbbd298

Browse files
chore(*): reorganized exports and extracted some more Classes/objects into separate files
1 parent b6efb28 commit bbbd298

38 files changed

+625
-496
lines changed

src/common/trace.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ class Trace {
132132
}
133133
}
134134

135-
export var trace = new Trace();
135+
var trace = new Trace();
136+
export default trace;
136137

137138
angular.module("ui.router").run(function($rootScope) {
138139
$rootScope.$watch(function() { trace.approximateDigests++; });

src/params/param.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {isInjectable, extend, isDefined, isString, isArray, filter, map, indexOf} from "../common/common";
22
import {runtime} from "../common/angular1";
3-
import {matcherConfig} from "../url/urlMatcherConfig";
4-
import {paramTypes} from "./paramTypes";
5-
import {Type} from "./type";
3+
import matcherConfig from "../url/urlMatcherConfig";
4+
import paramTypes from "./paramTypes";
5+
import Type from "./type";
66

7-
export class Param {
7+
export default class Param {
88
id: string;
99
type: Type;
1010
location: string;

src/params/paramSet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {extend, inherit, forEach, objectKeys, indexOf, isString} from "../common/common";
22

3-
export class ParamSet {
3+
export default class ParamSet {
44
constructor(params?: any) {
55
extend(this, params || {});
66
}

src/params/paramTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {isDefined, fromJson, toJson, isObject, identity, equals, inherit, map, extend} from "../common/common";
2-
import {Type} from "./type";
2+
import Type from "./type";
33
import {runtime} from "../common/angular1";
44

55
function valToString(val) { return val != null ? val.toString().replace(/\//g, "%2F") : val; }
@@ -97,4 +97,4 @@ class ParamTypes {
9797
}
9898
}
9999

100-
export var paramTypes: ParamTypes = new ParamTypes();
100+
export default new ParamTypes();

src/params/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {extend, isArray, isDefined, filter, map} from "../common/common";
3030
*
3131
* @returns {Object} Returns a new `Type` object.
3232
*/
33-
export class Type {
33+
export default class Type {
3434
pattern: RegExp;
3535
name: string;
3636

src/resolve/path.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import {extend, isArray, identity, noop,
44
defaults, map, omit, pluck, find, pipe, prop, eq} from "../common/common";
5-
import {trace} from "../common/trace";
5+
import trace from "../common/trace";
66
import {IPromise} from "angular";
7-
import {IState} from "../interface";
7+
import {IState} from "../state/interface";
88
import {runtime} from "../common/angular1"
99
import PathElement from "./pathElement";
1010
import Resolvable from "./resolvable";
@@ -24,7 +24,7 @@ import Resolvable from "./resolvable";
2424
* @param statesOrPathElements [array]: an array of either state(s) or PathElement(s)
2525
*/
2626

27-
class Path {
27+
export default class Path {
2828
constructor(statesOrPathElements: (IState[] | PathElement[])) {
2929
if (!isArray(statesOrPathElements))
3030
throw new Error("states must be an array of state(s) or PathElement(s): ${statesOrPathElements}");
@@ -118,5 +118,3 @@ class Path {
118118
return `Path([${elements}])`;
119119
}
120120
}
121-
122-
export default Path;

src/view/viewContext.ts renamed to src/resolve/pathContext.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import Path from "../resolve/path";
2-
import PathElement from "../resolve/pathElement";
3-
import {IState} from "../interface";
1+
import Path from "path";
2+
import PathElement from "pathElement";
3+
import {IState} from "../state/interface";
44
import {objectKeys, zipObject, pick} from "../common/common";
55

6-
export class ViewContext {
7-
//state: IState;
8-
_pathElement: PathElement;
9-
_path: Path;
10-
_options: any;
11-
_injector: ng.auto.IInjectorService;
6+
export default class PathContext {
7+
private _pathElement: PathElement;
8+
private _path: Path;
9+
private _options: any;
10+
private _injector: ng.auto.IInjectorService;
1211

1312
constructor(pathElement: PathElement, path: Path, options: any, $injector: ng.auto.IInjectorService) {
14-
//this.state = pathElement.state;
1513
this._pathElement = pathElement;
1614
this._path = path;
1715
this._options = options;
@@ -35,4 +33,4 @@ export class ViewContext {
3533
injectMe.$inject = objectKeys(pick(this._pathElement.getResolvables(), this._injector.annotate(fn)));
3634
return this._pathElement.invokeLater(injectMe, {}, this._path, this._options);
3735
}
38-
}
36+
}

src/resolve/pathElement.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/// <reference path='../../typings/angularjs/angular.d.ts' />
22

33
import {isObject, isString, extend, forEach, noop, pick, map, filter, parse} from "../common/common";
4-
import {trace} from "../common/trace";
4+
import trace from "../common/trace";
55
import {IPromise} from "angular";
6-
import {IState} from "../interface";
6+
import {IState} from "../state/interface";
77
import Path from "./path";
88
import Resolvable from "./resolvable";
99
import {runtime} from "../common/angular1"

src/resolve/resolvable.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/// <reference path='../../typings/angularjs/angular.d.ts' />
22

33
import {pick, map} from "../common/common";
4-
import {trace} from "../common/trace";
4+
import trace from "../common/trace";
55
import {IPromise} from "angular";
6-
import {IState} from "../interface";
6+
import {IState} from "../state/interface";
77
import {runtime} from "../common/angular1"
88

99
/**
@@ -18,7 +18,7 @@ import {runtime} from "../common/angular1"
1818
* Resolvable.get() and Resolvable.resolve() both execute within a context Path, which is passed as the first
1919
* parameter to those fns.
2020
*/
21-
class Resolvable {
21+
export default class Resolvable {
2222
constructor(name: string, resolveFn: Function, state: IState) {
2323
this.name = name;
2424
this.resolveFn = resolveFn;
@@ -92,5 +92,3 @@ class Resolvable {
9292
return `Resolvable(name: ${this.name}, state: ${this.state.name}, requires: [${this.deps}])`;
9393
}
9494
}
95-
96-
export default Resolvable;

src/state/glob.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export class Glob {
1+
export default class Glob {
22
text: string;
33
glob: Array<string>;
44

0 commit comments

Comments
 (0)