mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-24 11:29:30 +08:00
Remove stale angular2 alpha typings
This commit is contained in:
-4624
File diff suppressed because it is too large
Load Diff
-6162
File diff suppressed because it is too large
Load Diff
-6875
File diff suppressed because it is too large
Load Diff
-6137
File diff suppressed because it is too large
Load Diff
-6043
File diff suppressed because it is too large
Load Diff
-6310
File diff suppressed because it is too large
Load Diff
-6564
File diff suppressed because it is too large
Load Diff
-5775
File diff suppressed because it is too large
Load Diff
-5920
File diff suppressed because it is too large
Load Diff
-12214
File diff suppressed because it is too large
Load Diff
-17106
File diff suppressed because it is too large
Load Diff
-17105
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
/// <reference path="angular2.d.ts"/>
|
||||
|
||||
// No tests, because angular 2 typings are not in DefinitelyTyped.
|
||||
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
// Type definitions for Angular 2
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Angular 2 distributes typings in our NPM package.
|
||||
// To get the typings, simply:
|
||||
// $ npm install angular2
|
||||
// and use TypeScript 1.6.2 or later.
|
||||
//
|
||||
// Note that TypeScript must be configured with
|
||||
// --moduleResolution node
|
||||
// which is the default when --module commonjs
|
||||
Vendored
-1007
File diff suppressed because it is too large
Load Diff
Vendored
-1310
File diff suppressed because it is too large
Load Diff
Vendored
-1310
File diff suppressed because it is too large
Load Diff
Vendored
-352
@@ -1,352 +0,0 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.30
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
///<reference path="./angular2-2.0.0-alpha.30.d.ts"/>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @public
|
||||
* @description
|
||||
* Maps application URLs into application states, to support deep-linking and navigation.
|
||||
*/
|
||||
declare module ng {
|
||||
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*
|
||||
* @exportedAs angular2/router
|
||||
*/
|
||||
class Router {
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
previousUrl: string;
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
parent: Router;
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an object to notify of route changes. You probably don't need to use this unless
|
||||
* you're writing a reusable component.
|
||||
*/
|
||||
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
* ```
|
||||
* router.config({ 'path': '/', 'component': IndexCmp});
|
||||
* ```
|
||||
*
|
||||
* Or:
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(config: StringMap<string, any>| List<StringMap<string, any>>): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: List<any>): string;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: any): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, update the contents of this outlet.
|
||||
*/
|
||||
activate(instruction: Instruction): Promise<any>;
|
||||
|
||||
deactivate(): Promise<any>;
|
||||
|
||||
canDeactivate(instruction: Instruction): Promise<boolean>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig({
|
||||
* path: '/user', component: UserCmp, as: 'user'
|
||||
* });
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
* children for the route. And if the route begins with `../`, the router will look at the
|
||||
* current component's parent.
|
||||
*
|
||||
* @exportedAs angular2/router
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
routeParams: void;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
class RouteParams {
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: StringMap<string, any>): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: List<any>, parentComponent: any): string;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
onPopState(fn: any): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class HTML5LocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
* - `/my/app/user/123` is normalized
|
||||
* - `my/app/user/123` **is not** normalized
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
path(): string;
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
subscribe(onNext: any, onThrow?: any, onReturn?: any): void;
|
||||
}
|
||||
|
||||
var appBaseHrefToken : OpaqueToken ;
|
||||
|
||||
class Instruction {
|
||||
reuseComponentsFrom(oldInstruction: Instruction): void;
|
||||
params(): StringMap<string, string>;
|
||||
hasChild(): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: List<Function>;
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
var routerDirectives : List<any> ;
|
||||
|
||||
var routerInjectables : List<any> ;
|
||||
|
||||
var RouteConfig:any;
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/router" {
|
||||
export = ng;
|
||||
}
|
||||
Vendored
-459
@@ -1,459 +0,0 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.31
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
///<reference path="./angular2-2.0.0-alpha.31.d.ts"/>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Maps application URLs into application states, to support deep-linking and navigation.
|
||||
*/
|
||||
declare module ng {
|
||||
interface List<T> extends Array<T> {}
|
||||
interface Map<K,V> {}
|
||||
interface StringMap<K,V> extends Map<K,V> {}
|
||||
|
||||
export class Instruction {
|
||||
// "capturedUrl" is the part of the URL captured by this instruction
|
||||
// "accumulatedUrl" is the part of the URL captured by this instruction and all children
|
||||
accumulatedUrl: string;
|
||||
reuse: boolean;
|
||||
specificity: number;
|
||||
|
||||
private _params: StringMap<string, string>;
|
||||
|
||||
constructor (component: any, capturedUrl: string,
|
||||
_recognizer: PathRecognizer, child: Instruction);
|
||||
|
||||
params(): StringMap<string, string>;
|
||||
}
|
||||
|
||||
class TouchMap {
|
||||
map: StringMap<string, string>;
|
||||
keys: StringMap<string, boolean>;
|
||||
|
||||
constructor(map: StringMap<string, any>);
|
||||
|
||||
get(key: string): string;
|
||||
|
||||
getUnused(): StringMap<string, any>;
|
||||
}
|
||||
|
||||
export class Segment {
|
||||
name: string;
|
||||
regex: string;
|
||||
generate(params: TouchMap): string;
|
||||
}
|
||||
|
||||
export class PathRecognizer {
|
||||
segments: List<Segment>;
|
||||
regex: RegExp;
|
||||
specificity: number;
|
||||
terminal: boolean;
|
||||
path: string;
|
||||
handler: RouteHandler;
|
||||
|
||||
constructor(path: string, handler: RouteHandler);
|
||||
|
||||
parseParams(url: string): StringMap<string, string>;
|
||||
|
||||
generate(params: StringMap<string, any>): string;
|
||||
|
||||
resolveComponentType(): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
export interface RouteHandler {
|
||||
componentType: Function;
|
||||
resolveComponentType(): Promise<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
class Router {
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
parent: Router;
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an object to notify of route changes. You probably don't need to use this unless
|
||||
* you're writing a reusable component.
|
||||
*/
|
||||
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
* ```
|
||||
* router.config({ 'path': '/', 'component': IndexCmp});
|
||||
* ```
|
||||
*
|
||||
* Or:
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(config: StringMap<string, any>| List<StringMap<string, any>>): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: List<any>): string;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: any): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
childRouter: Router;
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, update the contents of this outlet.
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canDeactivate(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canReuse(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
deactivate(nextInstruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig({
|
||||
* path: '/user', component: UserCmp, as: 'user'
|
||||
* });
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
* children for the route. And if the route begins with `../`, the router will look at the
|
||||
* current component's parent.
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
routeParams: void;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
class RouteParams {
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: StringMap<string, any>): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: List<any>, parentComponent: any): string;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
onPopState(fn: any): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class HTML5LocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
* - `/my/app/user/123` is normalized
|
||||
* - `my/app/user/123` **is not** normalized
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
path(): string;
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
subscribe(onNext: any, onThrow?: any, onReturn?: any): void;
|
||||
}
|
||||
|
||||
var appBaseHrefToken : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: List<Function>;
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onActivate]
|
||||
*/
|
||||
interface OnActivate {
|
||||
|
||||
onActivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onDeactivate]
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
|
||||
onDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onReuse]
|
||||
*/
|
||||
interface OnReuse {
|
||||
|
||||
onReuse(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canDeactivate]
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
|
||||
canDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canReuse]
|
||||
*/
|
||||
interface CanReuse {
|
||||
|
||||
canReuse(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
var CanActivate:any;
|
||||
|
||||
var routerDirectives : List<any> ;
|
||||
|
||||
var routerInjectables : List<any> ;
|
||||
|
||||
var RouteConfig:any;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
declare module "angular2/router" {
|
||||
export = ng;
|
||||
}
|
||||
Vendored
-469
@@ -1,469 +0,0 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.34
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
///<reference path="./angular2-2.0.0-alpha.34.d.ts"/>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Maps application URLs into application states, to support deep-linking and navigation.
|
||||
*/
|
||||
declare module ng {
|
||||
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
class Router {
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
parent: Router;
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an object to notify of route changes. You probably don't need to use this unless
|
||||
* you're writing a reusable component.
|
||||
*/
|
||||
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: List<RouteDefinition>): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): void;
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: List<any>): string;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
childRouter: Router;
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, update the contents of this outlet.
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canDeactivate(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canReuse(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
deactivate(nextInstruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig([
|
||||
* { path: '/user', component: UserCmp, as: 'user' }
|
||||
* ]);
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
* children for the route. And if the route begins with `../`, the router will look at the
|
||||
* current component's parent.
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
routeParams: void;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
class RouteParams {
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: RouteDefinition, isRootLevelRoute?: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any, isRootComponent?: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: List<any>, parentComponent: any): string;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
onPopState(fn: (_: any) => any): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class HTML5LocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
* - `/my/app/user/123` is normalized
|
||||
* - `my/app/user/123` **is not** normalized
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
path(): string;
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
|
||||
}
|
||||
|
||||
const appBaseHrefToken : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: List<Function>;
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onActivate]
|
||||
*/
|
||||
interface OnActivate {
|
||||
|
||||
onActivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onDeactivate]
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
|
||||
onDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onReuse]
|
||||
*/
|
||||
interface OnReuse {
|
||||
|
||||
onReuse(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canDeactivate]
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
|
||||
canDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canReuse]
|
||||
*/
|
||||
interface CanReuse {
|
||||
|
||||
canReuse(nextInstruction: Instruction, prevInstruction: Instruction): any;
|
||||
}
|
||||
|
||||
var CanActivate : (hook: (next: Instruction, prev: Instruction) => Promise<boolean>| boolean) => ClassDecorator ;
|
||||
|
||||
|
||||
/**
|
||||
* An `Instruction` represents the component hierarchy of the application based on a given route
|
||||
*/
|
||||
class Instruction {
|
||||
|
||||
accumulatedUrl: string;
|
||||
|
||||
reuse: boolean;
|
||||
|
||||
specificity: number;
|
||||
|
||||
component: any;
|
||||
|
||||
capturedUrl: string;
|
||||
|
||||
child: Instruction;
|
||||
|
||||
params(): StringMap<string, string>;
|
||||
}
|
||||
|
||||
const routerDirectives : List<any> ;
|
||||
|
||||
var routerInjectables : List<any> ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class Redirect implements RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
redirectTo: string;
|
||||
|
||||
as: string;
|
||||
}
|
||||
|
||||
class AsyncRoute implements RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
as: string;
|
||||
}
|
||||
|
||||
interface RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
component?: Type | ComponentDefinition;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
redirectTo?: string;
|
||||
|
||||
as?: string;
|
||||
}
|
||||
|
||||
var RouteConfig : (configs: List<RouteDefinition>) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
type: string;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
component?: Type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/router" {
|
||||
export = ng;
|
||||
}
|
||||
|
||||
|
||||
Vendored
-689
@@ -1,689 +0,0 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.35
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/router depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2-2.0.0-alpha.35.d.ts"/>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Maps application URLs into application states, to support deep-linking and navigation.
|
||||
*/
|
||||
declare module ngRouter {
|
||||
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
class Router {
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
parent: Router;
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an object to notify of route changes. You probably don't need to use this unless
|
||||
* you're writing a reusable component.
|
||||
*/
|
||||
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: Array<RouteDefinition>): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
||||
* complete.
|
||||
*/
|
||||
navigateInstruction(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): void;
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: Array<any>): Instruction;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
childRouter: Router;
|
||||
|
||||
name: string;
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, update the contents of this outlet.
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canDeactivate(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canReuse(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
deactivate(nextInstruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig([
|
||||
* { path: '/user', component: UserCmp, as: 'user' }
|
||||
* ]);
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
* children for the route. And if the route begins with `../`, the router will look at the
|
||||
* current component's parent.
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
routeParams: void;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
class RouteParams {
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: RouteDefinition): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: Array<any>, parentComponent: any): Instruction;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
onPopState(fn: (_: any) => any): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class HTML5LocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
* - `/my/app/user/123` is normalized
|
||||
* - `my/app/user/123` **is not** normalized
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
path(): string;
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
|
||||
}
|
||||
|
||||
const APP_BASE_HREF : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: Array<Function>;
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onActivate], which is called by the router at the end of a
|
||||
* successful route navigation.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* If `onActivate` returns a promise, the route change will wait until the promise settles to
|
||||
* instantiate and activate child components.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements OnActivate {
|
||||
* onActivate(next, prev) {
|
||||
* this.log = 'Finished navigating from ' + prev.urlPath + ' to ' + next.urlPath;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnActivate {
|
||||
|
||||
onActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onDeactivate], which is called by the router before destroying
|
||||
* a component as part of a route change.
|
||||
*
|
||||
* If `onDeactivate` returns a promise, the route change will wait until the promise settles.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
|
||||
onDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onReuse], which is called by the router at the end of a
|
||||
* successful route navigation when [canReuse] is implemented and returns or resolves to true.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnReuse {
|
||||
|
||||
onReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canDeactivate], which is called by the router to determine
|
||||
* if a component can be removed as part of a navigation.
|
||||
*
|
||||
* If `canDeactivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canDeactivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanDeactivate {
|
||||
* canDeactivate(next, prev) {
|
||||
* return askUserIfTheyAreSureTheyWantToQuit();
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
|
||||
canDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canReuse], which is called by the router to determine whether a
|
||||
* component should be reused across routes, or whether to destroy and instantiate a new component.
|
||||
*
|
||||
* If `canReuse` returns or resolves to `true`, the component instance will be reused.
|
||||
*
|
||||
* If `canReuse` throws or rejects, the navigation will be cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse(next, prev) {
|
||||
* return next.params.id == prev.params.id;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.id = next.params.id;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanReuse {
|
||||
|
||||
canReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canActivate], which is called by the router to determine
|
||||
* if a component can be instantiated as part of a navigation.
|
||||
*
|
||||
* Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
|
||||
* This is because [canActivate] is called before the component is instantiated.
|
||||
*
|
||||
* If `canActivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canActivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'control-panel-cmp'
|
||||
* })
|
||||
* @CanActivate(() => checkIfUserIsLoggedIn())
|
||||
* class ControlPanelCmp {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
var CanActivate : (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>
|
||||
ClassDecorator ;
|
||||
|
||||
|
||||
/**
|
||||
* `Instruction` is a tree of `ComponentInstructions`, with all the information needed
|
||||
* to transition each component in the app to a given route, including all auxiliary routes.
|
||||
*
|
||||
* This is a public API.
|
||||
*/
|
||||
class Instruction {
|
||||
|
||||
component: ComponentInstruction;
|
||||
|
||||
child: Instruction;
|
||||
|
||||
auxInstruction: StringMap<string, Instruction>;
|
||||
|
||||
replaceChild(child: Instruction): Instruction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
|
||||
* composed of a tree of these `ComponentInstruction`s.
|
||||
*
|
||||
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
|
||||
* to route lifecycle hooks, like {@link CanActivate}.
|
||||
*/
|
||||
class ComponentInstruction {
|
||||
|
||||
reuse: boolean;
|
||||
|
||||
urlPath: string;
|
||||
|
||||
urlParams: Array<string>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
componentType: void;
|
||||
|
||||
resolveComponentType(): Promise<Type>;
|
||||
|
||||
specificity: void;
|
||||
|
||||
terminal: void;
|
||||
|
||||
routeData(): Object;
|
||||
}
|
||||
|
||||
class Url {
|
||||
|
||||
path: string;
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: Array<Url>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
toString(): string;
|
||||
|
||||
segmentToString(): string;
|
||||
}
|
||||
|
||||
class OpaqueToken {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runtime representation of a type.
|
||||
*
|
||||
* In JavaScript a Type is a constructor function.
|
||||
*/
|
||||
interface Type extends Function {
|
||||
|
||||
new(args: any): any;
|
||||
|
||||
}
|
||||
|
||||
const routerDirectives : Array<any> ;
|
||||
|
||||
var routerInjectables : Array<any> ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class Redirect implements RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
redirectTo: string;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
data: any;
|
||||
}
|
||||
|
||||
class AuxRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class AsyncRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
as: string;
|
||||
}
|
||||
|
||||
interface RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
component?: Type | ComponentDefinition;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
redirectTo?: string;
|
||||
|
||||
as?: string;
|
||||
|
||||
data?: any;
|
||||
}
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
var RouteConfig : (configs: Array<RouteDefinition>) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
type: string;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
component?: Type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/router" {
|
||||
export = ngRouter;
|
||||
}
|
||||
|
||||
|
||||
Vendored
-689
@@ -1,689 +0,0 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.36
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/router depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2-2.0.0-alpha.36.d.ts"/>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Maps application URLs into application states, to support deep-linking and navigation.
|
||||
*/
|
||||
declare module ngRouter {
|
||||
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
class Router {
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
parent: Router;
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an object to notify of route changes. You probably don't need to use this unless
|
||||
* you're writing a reusable component.
|
||||
*/
|
||||
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: Array<RouteDefinition>): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
||||
* complete.
|
||||
*/
|
||||
navigateInstruction(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): Object;
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: Array<any>): Instruction;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
childRouter: Router;
|
||||
|
||||
name: string;
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, update the contents of this outlet.
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canDeactivate(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by Router during recognition phase
|
||||
*/
|
||||
canReuse(nextInstruction: Instruction): Promise<boolean>;
|
||||
|
||||
deactivate(nextInstruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig([
|
||||
* { path: '/user', component: UserCmp, as: 'user' }
|
||||
* ]);
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
* children for the route. And if the route begins with `../`, the router will look at the
|
||||
* current component's parent.
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
routeParams: any;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
class RouteParams {
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: RouteDefinition): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: Array<any>, parentComponent: any): Instruction;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
onPopState(fn: (_: any) => any): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class PathLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
* - `/my/app/user/123` is normalized
|
||||
* - `my/app/user/123` **is not** normalized
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
path(): string;
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
|
||||
}
|
||||
|
||||
const APP_BASE_HREF : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: Array<Function>;
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onActivate], which is called by the router at the end of a
|
||||
* successful route navigation.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* If `onActivate` returns a promise, the route change will wait until the promise settles to
|
||||
* instantiate and activate child components.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements OnActivate {
|
||||
* onActivate(next, prev) {
|
||||
* this.log = 'Finished navigating from ' + prev.urlPath + ' to ' + next.urlPath;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnActivate {
|
||||
|
||||
onActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onDeactivate], which is called by the router before destroying
|
||||
* a component as part of a route change.
|
||||
*
|
||||
* If `onDeactivate` returns a promise, the route change will wait until the promise settles.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
|
||||
onDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onReuse], which is called by the router at the end of a
|
||||
* successful route navigation when [canReuse] is implemented and returns or resolves to true.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnReuse {
|
||||
|
||||
onReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canDeactivate], which is called by the router to determine
|
||||
* if a component can be removed as part of a navigation.
|
||||
*
|
||||
* If `canDeactivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canDeactivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanDeactivate {
|
||||
* canDeactivate(next, prev) {
|
||||
* return askUserIfTheyAreSureTheyWantToQuit();
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
|
||||
canDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canReuse], which is called by the router to determine whether a
|
||||
* component should be reused across routes, or whether to destroy and instantiate a new component.
|
||||
*
|
||||
* If `canReuse` returns or resolves to `true`, the component instance will be reused.
|
||||
*
|
||||
* If `canReuse` throws or rejects, the navigation will be cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse(next, prev) {
|
||||
* return next.params.id == prev.params.id;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.id = next.params.id;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanReuse {
|
||||
|
||||
canReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canActivate], which is called by the router to determine
|
||||
* if a component can be instantiated as part of a navigation.
|
||||
*
|
||||
* Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
|
||||
* This is because [canActivate] is called before the component is instantiated.
|
||||
*
|
||||
* If `canActivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canActivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'control-panel-cmp'
|
||||
* })
|
||||
* @CanActivate(() => checkIfUserIsLoggedIn())
|
||||
* class ControlPanelCmp {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
var CanActivate : (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>
|
||||
ClassDecorator ;
|
||||
|
||||
|
||||
/**
|
||||
* `Instruction` is a tree of `ComponentInstructions`, with all the information needed
|
||||
* to transition each component in the app to a given route, including all auxiliary routes.
|
||||
*
|
||||
* This is a public API.
|
||||
*/
|
||||
class Instruction {
|
||||
|
||||
component: ComponentInstruction;
|
||||
|
||||
child: Instruction;
|
||||
|
||||
auxInstruction: StringMap<string, Instruction>;
|
||||
|
||||
replaceChild(child: Instruction): Instruction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
|
||||
* composed of a tree of these `ComponentInstruction`s.
|
||||
*
|
||||
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
|
||||
* to route lifecycle hooks, like {@link CanActivate}.
|
||||
*/
|
||||
class ComponentInstruction {
|
||||
|
||||
reuse: boolean;
|
||||
|
||||
urlPath: string;
|
||||
|
||||
urlParams: Array<string>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
componentType: any;
|
||||
|
||||
resolveComponentType(): Promise<Type>;
|
||||
|
||||
specificity: any;
|
||||
|
||||
terminal: any;
|
||||
|
||||
routeData(): Object;
|
||||
}
|
||||
|
||||
class Url {
|
||||
|
||||
path: string;
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: Array<Url>;
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
toString(): string;
|
||||
|
||||
segmentToString(): string;
|
||||
}
|
||||
|
||||
class OpaqueToken {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runtime representation of a type.
|
||||
*
|
||||
* In JavaScript a Type is a constructor function.
|
||||
*/
|
||||
interface Type extends Function {
|
||||
|
||||
new(args: any): any;
|
||||
|
||||
}
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
const ROUTER_DIRECTIVES : Array<any> ;
|
||||
|
||||
const ROUTER_BINDINGS : Array<any> ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class Redirect implements RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
redirectTo: string;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
data: any;
|
||||
}
|
||||
|
||||
class AuxRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class AsyncRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
as: string;
|
||||
}
|
||||
|
||||
interface RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
component?: Type | ComponentDefinition;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
redirectTo?: string;
|
||||
|
||||
as?: string;
|
||||
|
||||
data?: any;
|
||||
}
|
||||
|
||||
var RouteConfig : (configs: Array<RouteDefinition>) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
type: string;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
component?: Type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/router" {
|
||||
export = ngRouter;
|
||||
}
|
||||
|
||||
|
||||
Vendored
-738
@@ -1,738 +0,0 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.37
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/router depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2-2.0.0-alpha.37.d.ts"/>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Maps application URLs into application states, to support deep-linking and navigation.
|
||||
*/
|
||||
declare module ngRouter {
|
||||
|
||||
/**
|
||||
* # Router
|
||||
* The router is responsible for mapping URLs to components.
|
||||
*
|
||||
* You can see the state of the router by inspecting the read-only field `router.navigating`.
|
||||
* This may be useful for showing a spinner, for instance.
|
||||
*
|
||||
* ## Concepts
|
||||
* Routers and component instances have a 1:1 correspondence.
|
||||
*
|
||||
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
|
||||
* router dynamically fills in depending on the current URL.
|
||||
*
|
||||
* When the router navigates from a URL, it must first recognizes it and serialize it into an
|
||||
* `Instruction`.
|
||||
* The router uses the `RouteRegistry` to get an `Instruction`.
|
||||
*/
|
||||
class Router {
|
||||
|
||||
navigating: boolean;
|
||||
|
||||
lastNavigationAttempt: string;
|
||||
|
||||
registry: RouteRegistry;
|
||||
|
||||
parent: Router;
|
||||
|
||||
hostComponent: any;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
childRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
|
||||
* component.
|
||||
*/
|
||||
auxRouter(hostComponent: any): Router;
|
||||
|
||||
|
||||
/**
|
||||
* Register an outlet to notified of primary route changes.
|
||||
*
|
||||
* You probably don't need to use this unless you're writing a reusable component.
|
||||
*/
|
||||
registerPrimaryOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Register an outlet to notified of auxiliary route changes.
|
||||
*
|
||||
* You probably don't need to use this unless you're writing a reusable component.
|
||||
*/
|
||||
registerAuxOutlet(outlet: RouterOutlet): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Given an instruction, returns `true` if the instruction is currently active,
|
||||
* otherwise `false`.
|
||||
*/
|
||||
isRouteActive(instruction: Instruction): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Dynamically update the routing configuration and trigger a navigation.
|
||||
*
|
||||
* # Usage
|
||||
*
|
||||
* ```
|
||||
* router.config([
|
||||
* { 'path': '/', 'component': IndexComp },
|
||||
* { 'path': '/user/:id', 'component': UserComp },
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(definitions: RouteDefinition[]): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
|
||||
*
|
||||
* If the given URL begins with a `/`, router will navigate absolutely.
|
||||
* If the given URL does not begin with `/`, the router will navigate relative to this component.
|
||||
*/
|
||||
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigate via the provided instruction. Returns a promise that resolves when navigation is
|
||||
* complete.
|
||||
*/
|
||||
navigateInstruction(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: (value: any) => void): Object;
|
||||
|
||||
|
||||
/**
|
||||
* Removes the contents of this router's outlet and all descendant outlets
|
||||
*/
|
||||
deactivate(instruction: Instruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL, returns an instruction representing the component graph
|
||||
*/
|
||||
recognize(url: string): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
|
||||
* router has yet to successfully navigate.
|
||||
*/
|
||||
renavigate(): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
|
||||
* app's base href.
|
||||
*/
|
||||
generate(linkParams: any[]): Instruction;
|
||||
}
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
|
||||
*
|
||||
* ## Use
|
||||
*
|
||||
* ```
|
||||
* <router-outlet></router-outlet>
|
||||
* ```
|
||||
*/
|
||||
class RouterOutlet {
|
||||
|
||||
name: string;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the Router to instantiate a new component during the commit phase of a navigation.
|
||||
* This method in turn is responsible for calling the `onActivate` hook of its child.
|
||||
*/
|
||||
activate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during the commit phase of a navigation when an outlet
|
||||
* reuses a component between different routes.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
reuse(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} when an outlet reuses a component across navigations.
|
||||
* This method in turn is responsible for calling the `onReuse` hook of its child.
|
||||
*/
|
||||
deactivate(nextInstruction: ComponentInstruction): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If this resolves to `false`, the given navigation is cancelled.
|
||||
*
|
||||
* This method delegates to the child component's `canDeactivate` hook if it exists,
|
||||
* and otherwise resolves to true.
|
||||
*/
|
||||
canDeactivate(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
|
||||
|
||||
/**
|
||||
* Called by the {@link Router} during recognition phase of a navigation.
|
||||
*
|
||||
* If the new child component has a different Type than the existing child component,
|
||||
* this will resolve to `false`. You can't reuse an old component when the new component
|
||||
* is of a different Type.
|
||||
*
|
||||
* Otherwise, this method delegates to the child component's `canReuse` hook if it exists,
|
||||
* or resolves to true if the hook is not present.
|
||||
*/
|
||||
canReuse(nextInstruction: ComponentInstruction): Promise<boolean>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouterLink directive lets you link to specific parts of your app.
|
||||
*
|
||||
* Consider the following route configuration:
|
||||
*
|
||||
* ```
|
||||
* @RouteConfig([
|
||||
* { path: '/user', component: UserCmp, as: 'user' }
|
||||
* ]);
|
||||
* class MyComp {}
|
||||
* ```
|
||||
*
|
||||
* When linking to this `user` route, you can write:
|
||||
*
|
||||
* ```
|
||||
* <a [router-link]="['./user']">link to user component</a>
|
||||
* ```
|
||||
*
|
||||
* RouterLink expects the value to be an array of route names, followed by the params
|
||||
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
|
||||
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
|
||||
* and with a child route `user` with params `{userId: 2}`.
|
||||
*
|
||||
* The first route name should be prepended with `/`, `./`, or `../`.
|
||||
* If the route begins with `/`, the router will look up the route from the root of the app.
|
||||
* If the route begins with `./`, the router will instead look in the current component's
|
||||
* children for the route. And if the route begins with `../`, the router will look at the
|
||||
* current component's parent.
|
||||
*/
|
||||
class RouterLink {
|
||||
|
||||
visibleHref: string;
|
||||
|
||||
isRouteActive: boolean;
|
||||
|
||||
routeParams: any;
|
||||
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
class RouteParams {
|
||||
|
||||
params: StringMap<string, string>;
|
||||
|
||||
get(param: string): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The RouteRegistry holds route configurations for each component in an Angular app.
|
||||
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: RouteDefinition): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Given a URL and a parent component, return the most specific instruction for navigating
|
||||
* the application into the state specified by the url
|
||||
*/
|
||||
recognize(url: string, parentComponent: any): Promise<Instruction>;
|
||||
|
||||
|
||||
/**
|
||||
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
|
||||
* generates a url with a leading slash relative to the provided `parentComponent`.
|
||||
*/
|
||||
generate(linkParams: any[], parentComponent: any): Instruction;
|
||||
}
|
||||
|
||||
class LocationStrategy {
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(ctx: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
onPopState(fn: (_: any) => any): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
}
|
||||
|
||||
class HashLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
class PathLocationStrategy extends LocationStrategy {
|
||||
|
||||
onPopState(fn: EventListener): void;
|
||||
|
||||
getBaseHref(): string;
|
||||
|
||||
path(): string;
|
||||
|
||||
pushState(state: any, title: string, url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is the service that an application developer will directly interact with.
|
||||
*
|
||||
* Responsible for normalizing the URL against the application's base href.
|
||||
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
|
||||
* trailing slash:
|
||||
* - `/my/app/user/123` is normalized
|
||||
* - `my/app/user/123` **is not** normalized
|
||||
* - `/my/app/user/123/` **is not** normalized
|
||||
*/
|
||||
class Location {
|
||||
|
||||
platformStrategy: LocationStrategy;
|
||||
|
||||
path(): string;
|
||||
|
||||
normalize(url: string): string;
|
||||
|
||||
normalizeAbsolutely(url: string): string;
|
||||
|
||||
go(url: string): void;
|
||||
|
||||
forward(): void;
|
||||
|
||||
back(): void;
|
||||
|
||||
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
|
||||
}
|
||||
|
||||
const APP_BASE_HREF : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Responsible for performing each step of navigation.
|
||||
* "Steps" are conceptually similar to "middleware"
|
||||
*/
|
||||
class Pipeline {
|
||||
|
||||
steps: Function[];
|
||||
|
||||
process(instruction: Instruction): Promise<any>;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onActivate], which is called by the router at the end of a
|
||||
* successful route navigation.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* If `onActivate` returns a promise, the route change will wait until the promise settles to
|
||||
* instantiate and activate child components.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements OnActivate {
|
||||
* onActivate(next, prev) {
|
||||
* this.log = 'Finished navigating from ' + prev.urlPath + ' to ' + next.urlPath;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnActivate {
|
||||
|
||||
onActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onDeactivate], which is called by the router before destroying
|
||||
* a component as part of a route change.
|
||||
*
|
||||
* If `onDeactivate` returns a promise, the route change will wait until the promise settles.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnDeactivate {
|
||||
|
||||
onDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [onReuse], which is called by the router at the end of a
|
||||
* successful route navigation when [canReuse] is implemented and returns or resolves to true.
|
||||
*
|
||||
* For a single component's navigation, only one of either [onActivate] or [onReuse] will be called,
|
||||
* depending on the result of [canReuse].
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse() {
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.params = next.params;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface OnReuse {
|
||||
|
||||
onReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canDeactivate], which is called by the router to determine
|
||||
* if a component can be removed as part of a navigation.
|
||||
*
|
||||
* If `canDeactivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canDeactivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanDeactivate {
|
||||
* canDeactivate(next, prev) {
|
||||
* return askUserIfTheyAreSureTheyWantToQuit();
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanDeactivate {
|
||||
|
||||
canDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canReuse], which is called by the router to determine whether a
|
||||
* component should be reused across routes, or whether to destroy and instantiate a new component.
|
||||
*
|
||||
* If `canReuse` returns or resolves to `true`, the component instance will be reused.
|
||||
*
|
||||
* If `canReuse` throws or rejects, the navigation will be cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'my-cmp'
|
||||
* })
|
||||
* class MyCmp implements CanReuse, OnReuse {
|
||||
* canReuse(next, prev) {
|
||||
* return next.params.id == prev.params.id;
|
||||
* }
|
||||
*
|
||||
* onReuse(next, prev) {
|
||||
* this.id = next.params.id;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface CanReuse {
|
||||
|
||||
canReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines route lifecycle method [canActivate], which is called by the router to determine
|
||||
* if a component can be instantiated as part of a navigation.
|
||||
*
|
||||
* Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
|
||||
* This is because [canActivate] is called before the component is instantiated.
|
||||
*
|
||||
* If `canActivate` returns or resolves to `false`, the navigation is cancelled.
|
||||
*
|
||||
* If `canActivate` throws or rejects, the navigation is also cancelled.
|
||||
*
|
||||
* ## Example
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'control-panel-cmp'
|
||||
* })
|
||||
* @CanActivate(() => checkIfUserIsLoggedIn())
|
||||
* class ControlPanelCmp {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
var CanActivate : (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>
|
||||
ClassDecorator ;
|
||||
|
||||
|
||||
/**
|
||||
* `Instruction` is a tree of `ComponentInstructions`, with all the information needed
|
||||
* to transition each component in the app to a given route, including all auxiliary routes.
|
||||
*
|
||||
* This is a public API.
|
||||
*/
|
||||
class Instruction {
|
||||
|
||||
component: ComponentInstruction;
|
||||
|
||||
child: Instruction;
|
||||
|
||||
auxInstruction: StringMap<string, Instruction>;
|
||||
|
||||
replaceChild(child: Instruction): Instruction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A `ComponentInstruction` represents the route state for a single component. An `Instruction` is
|
||||
* composed of a tree of these `ComponentInstruction`s.
|
||||
*
|
||||
* `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
|
||||
* to route lifecycle hooks, like {@link CanActivate}.
|
||||
*
|
||||
* `ComponentInstruction`s are [https://en.wikipedia.org/wiki/Hash_consing](hash consed). You should
|
||||
* never construct one yourself with "new." Instead, rely on {@link PathRecognizer} to construct
|
||||
* `ComponentInstruction`s.
|
||||
*
|
||||
* You should not modify this object. It should be treated as immutable.
|
||||
*/
|
||||
class ComponentInstruction {
|
||||
|
||||
reuse: boolean;
|
||||
|
||||
urlPath: string;
|
||||
|
||||
urlParams: string[];
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
componentType: any;
|
||||
|
||||
resolveComponentType(): Promise<ng.Type>;
|
||||
|
||||
specificity: any;
|
||||
|
||||
terminal: any;
|
||||
|
||||
routeData(): Object;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This class represents a parsed URL
|
||||
*/
|
||||
class Url {
|
||||
|
||||
path: string;
|
||||
|
||||
child: Url;
|
||||
|
||||
auxiliary: Url[];
|
||||
|
||||
params: StringMap<string, any>;
|
||||
|
||||
toString(): string;
|
||||
|
||||
segmentToString(): string;
|
||||
}
|
||||
|
||||
class OpaqueToken {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
const ROUTE_DATA : OpaqueToken ;
|
||||
|
||||
const ROUTER_DIRECTIVES : any[] ;
|
||||
|
||||
const ROUTER_BINDINGS : any[] ;
|
||||
|
||||
class Route implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: ng.Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class Redirect implements RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
redirectTo: string;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
data: any;
|
||||
}
|
||||
|
||||
class AuxRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
component: ng.Type;
|
||||
|
||||
as: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
redirectTo: string;
|
||||
}
|
||||
|
||||
class AsyncRoute implements RouteDefinition {
|
||||
|
||||
data: any;
|
||||
|
||||
path: string;
|
||||
|
||||
loader: Function;
|
||||
|
||||
as: string;
|
||||
}
|
||||
|
||||
interface RouteDefinition {
|
||||
|
||||
path: string;
|
||||
|
||||
component?: ng.Type | ComponentDefinition;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
redirectTo?: string;
|
||||
|
||||
as?: string;
|
||||
|
||||
data?: any;
|
||||
}
|
||||
|
||||
var RouteConfig : (configs: RouteDefinition[]) => ClassDecorator ;
|
||||
|
||||
interface ComponentDefinition {
|
||||
|
||||
type: string;
|
||||
|
||||
loader?: Function;
|
||||
|
||||
component?: ng.Type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/router" {
|
||||
export = ngRouter;
|
||||
}
|
||||
|
||||
|
||||
Vendored
-1330
File diff suppressed because it is too large
Load Diff
Vendored
-1330
File diff suppressed because it is too large
Load Diff
-408
@@ -1,408 +0,0 @@
|
||||
// Type definitions for Angular v2.0.0-local_sha.f77234e
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/test_lib depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2-2.0.0-alpha.38.d.ts"/>
|
||||
///<reference path="../jasmine/jasmine.d.ts"/>
|
||||
|
||||
|
||||
|
||||
declare module ngTestLib {
|
||||
/**
|
||||
* Allows injecting dependencies in `beforeEach()` and `it()`.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* beforeEach(inject([Dependency, AClass], (dep, object) => {
|
||||
* // some code that uses `dep` and `object`
|
||||
* // ...
|
||||
* }));
|
||||
*
|
||||
* it('...', inject([AClass, AsyncTestCompleter], (object, async) => {
|
||||
* object.doSomething().then(() => {
|
||||
* expect(...);
|
||||
* async.done();
|
||||
* });
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* Notes:
|
||||
* - injecting an `AsyncTestCompleter` allow completing async tests - this is the equivalent of
|
||||
* adding a `done` parameter in Jasmine,
|
||||
* - inject is currently a function because of some Traceur limitation the syntax should eventually
|
||||
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
|
||||
*
|
||||
* @param {Array} tokens
|
||||
* @param {Function} fn
|
||||
* @return {FunctionWithParamTokens}
|
||||
*/
|
||||
function inject(tokens: any[], fn: Function): FunctionWithParamTokens;
|
||||
|
||||
|
||||
|
||||
var proxy: ClassDecorator;
|
||||
|
||||
|
||||
|
||||
var afterEach: Function;
|
||||
|
||||
|
||||
|
||||
type SyncTestFn = () => void
|
||||
|
||||
|
||||
interface NgMatchers extends jasmine.Matchers {
|
||||
|
||||
toBe(expected: any): boolean;
|
||||
|
||||
toEqual(expected: any): boolean;
|
||||
|
||||
toBePromise(): boolean;
|
||||
|
||||
toBeAnInstanceOf(expected: any): boolean;
|
||||
|
||||
toHaveText(expected: any): boolean;
|
||||
|
||||
toHaveCssClass(expected: any): boolean;
|
||||
|
||||
toImplement(expected: any): boolean;
|
||||
|
||||
toContainError(expected: any): boolean;
|
||||
|
||||
toThrowErrorWith(expectedMessage: any): boolean;
|
||||
|
||||
not: NgMatchers;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var expect: (actual: any) => NgMatchers;
|
||||
|
||||
|
||||
|
||||
class AsyncTestCompleter {
|
||||
|
||||
constructor(_done: Function);
|
||||
|
||||
done(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function describe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function ddescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function xdescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function beforeEach(fn: FunctionWithParamTokens | SyncTestFn): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows overriding default bindings defined in test_injector.js.
|
||||
*
|
||||
* The given function must return a list of DI bindings.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* beforeEachBindings(() => [
|
||||
* bind(Compiler).toClass(MockCompiler),
|
||||
* bind(SomeToken).toValue(myValue),
|
||||
* ]);
|
||||
*/
|
||||
function beforeEachBindings(fn: any): void;
|
||||
|
||||
|
||||
|
||||
function it(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function xit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function iit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
interface GuinessCompatibleSpy extends jasmine.Spy {
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.returnValue, all calls to the function will return a specific
|
||||
* value.
|
||||
*/
|
||||
andReturn(val: any): void;
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied
|
||||
* function.
|
||||
*/
|
||||
andCallFake(fn: Function): GuinessCompatibleSpy;
|
||||
|
||||
/**
|
||||
* removes all recorded calls
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SpyObject {
|
||||
|
||||
constructor(type?: any);
|
||||
|
||||
static stub(object?: any, config?: any, overrides?: any): void;
|
||||
|
||||
noSuchMethod(args: any): void;
|
||||
|
||||
spy(name: any): void;
|
||||
|
||||
prop(name: any, value: any): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isInInnerZone(): boolean;
|
||||
|
||||
|
||||
|
||||
interface RootTestComponent {
|
||||
|
||||
debugElement: ng.DebugElement;
|
||||
|
||||
detectChanges(): void;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds a RootTestComponent for use in component level tests.
|
||||
*/
|
||||
class TestComponentBuilder {
|
||||
|
||||
constructor(_injector: ng.Injector);
|
||||
|
||||
/**
|
||||
* Overrides only the html of a {@link ComponentMetadata}.
|
||||
* All the other properties of the component's {@link ng.ViewMetadata} are preserved.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {string} html
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideTemplate(componentType: ng.Type, template: string): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides a component's {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {view} View
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideView(componentType: ng.Type, view: ng.ViewMetadata): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides the directives from the component {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {ng.Type} from
|
||||
* @param {ng.Type} to
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideDirective(componentType: ng.Type, from: ng.Type, to: ng.Type): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideViewBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Builds and returns a RootTestComponent.
|
||||
*
|
||||
* @return {Promise<RootTestComponent>}
|
||||
*/
|
||||
createAsync(rootComponentType: ng.Type): Promise<RootTestComponent>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function createTestInjector(bindings: Array<ng.Type | ng.Binding | any[]>): ng.Injector;
|
||||
|
||||
|
||||
|
||||
class FunctionWithParamTokens {
|
||||
|
||||
constructor(_tokens: any[], _fn: Function);
|
||||
|
||||
/**
|
||||
* Returns the value of the executed function.
|
||||
*/
|
||||
execute(injector: ng.Injector): any;
|
||||
|
||||
hasToken(token: any): boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to be executed in the fakeAsync zone:
|
||||
* - microtasks are manually executed by calling `flushMicrotasks()`,
|
||||
* - timers are synchronous, `tick()` simulates the asynchronous passage of time.
|
||||
*
|
||||
* If there are any pending timers at the end of the function, an exception will be thrown.
|
||||
*
|
||||
* @param fn
|
||||
* @returns {Function} The function wrapped to be executed in the fakeAsync zone
|
||||
*/
|
||||
function fakeAsync(fn: Function): Function;
|
||||
|
||||
|
||||
|
||||
function clearPendingTimers(): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone.
|
||||
*
|
||||
* The microtasks queue is drained at the very start of this function and after any timer callback
|
||||
* has been executed.
|
||||
*
|
||||
* @param {number} millis Number of millisecond, defaults to 0
|
||||
*/
|
||||
function tick(millis?: number): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Flush any pending microtasks.
|
||||
*/
|
||||
function flushMicrotasks(): void;
|
||||
|
||||
|
||||
|
||||
class Log {
|
||||
|
||||
constructor();
|
||||
|
||||
add(value: any): void;
|
||||
|
||||
fn(value: any): void;
|
||||
|
||||
clear(): void;
|
||||
|
||||
result(): string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class BrowserDetection {
|
||||
|
||||
constructor(ua: string);
|
||||
|
||||
isFirefox: boolean;
|
||||
|
||||
isAndroid: boolean;
|
||||
|
||||
isEdge: boolean;
|
||||
|
||||
isIE: boolean;
|
||||
|
||||
isWebkit: boolean;
|
||||
|
||||
isIOS7: boolean;
|
||||
|
||||
isSlow: boolean;
|
||||
|
||||
supportsIntlApi: boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var browserDetection: BrowserDetection;
|
||||
|
||||
|
||||
|
||||
function dispatchEvent(element: any, eventType: any): void;
|
||||
|
||||
|
||||
|
||||
function el(html: string): HTMLElement;
|
||||
|
||||
|
||||
|
||||
function containsRegexp(input: string): RegExp;
|
||||
|
||||
|
||||
|
||||
function normalizeCSS(css: string): string;
|
||||
|
||||
|
||||
|
||||
function stringifyElement(el: any): string;
|
||||
|
||||
|
||||
|
||||
var RootTestComponent: ng.InjectableReference;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/test_lib" {
|
||||
export = ngTestLib;
|
||||
}
|
||||
|
||||
|
||||
-408
@@ -1,408 +0,0 @@
|
||||
// Type definitions for Angular v2.0.0-local_sha.7d5c3eb
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ***********************************************************
|
||||
// This file is generated by the Angular build process.
|
||||
// Please do not create manual edits or send pull requests
|
||||
// modifying this file.
|
||||
// ***********************************************************
|
||||
|
||||
// angular2/test_lib depends transitively on these libraries.
|
||||
// If you don't have them installed you can install them using TSD
|
||||
// https://github.com/DefinitelyTyped/tsd
|
||||
|
||||
///<reference path="./angular2-2.0.0-alpha.39.d.ts"/>
|
||||
///<reference path="../jasmine/jasmine.d.ts"/>
|
||||
|
||||
|
||||
|
||||
declare module ngTestLib {
|
||||
/**
|
||||
* Allows injecting dependencies in `beforeEach()` and `it()`.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* beforeEach(inject([Dependency, AClass], (dep, object) => {
|
||||
* // some code that uses `dep` and `object`
|
||||
* // ...
|
||||
* }));
|
||||
*
|
||||
* it('...', inject([AClass, AsyncTestCompleter], (object, async) => {
|
||||
* object.doSomething().then(() => {
|
||||
* expect(...);
|
||||
* async.done();
|
||||
* });
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* Notes:
|
||||
* - injecting an `AsyncTestCompleter` allow completing async tests - this is the equivalent of
|
||||
* adding a `done` parameter in Jasmine,
|
||||
* - inject is currently a function because of some Traceur limitation the syntax should eventually
|
||||
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
|
||||
*
|
||||
* @param {Array} tokens
|
||||
* @param {Function} fn
|
||||
* @return {FunctionWithParamTokens}
|
||||
*/
|
||||
function inject(tokens: any[], fn: Function): FunctionWithParamTokens;
|
||||
|
||||
|
||||
|
||||
var proxy: ClassDecorator;
|
||||
|
||||
|
||||
|
||||
var afterEach: Function;
|
||||
|
||||
|
||||
|
||||
type SyncTestFn = () => void
|
||||
|
||||
|
||||
interface NgMatchers extends jasmine.Matchers {
|
||||
|
||||
toBe(expected: any): boolean;
|
||||
|
||||
toEqual(expected: any): boolean;
|
||||
|
||||
toBePromise(): boolean;
|
||||
|
||||
toBeAnInstanceOf(expected: any): boolean;
|
||||
|
||||
toHaveText(expected: any): boolean;
|
||||
|
||||
toHaveCssClass(expected: any): boolean;
|
||||
|
||||
toImplement(expected: any): boolean;
|
||||
|
||||
toContainError(expected: any): boolean;
|
||||
|
||||
toThrowErrorWith(expectedMessage: any): boolean;
|
||||
|
||||
not: NgMatchers;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var expect: (actual: any) => NgMatchers;
|
||||
|
||||
|
||||
|
||||
class AsyncTestCompleter {
|
||||
|
||||
constructor(_done: Function);
|
||||
|
||||
done(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function describe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function ddescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function xdescribe(...args: any[]): void;
|
||||
|
||||
|
||||
|
||||
function beforeEach(fn: FunctionWithParamTokens | SyncTestFn): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows overriding default bindings defined in test_injector.js.
|
||||
*
|
||||
* The given function must return a list of DI bindings.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* beforeEachBindings(() => [
|
||||
* bind(Compiler).toClass(MockCompiler),
|
||||
* bind(SomeToken).toValue(myValue),
|
||||
* ]);
|
||||
*/
|
||||
function beforeEachBindings(fn: any): void;
|
||||
|
||||
|
||||
|
||||
function it(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function xit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
function iit(name: any, fn: any, timeOut?: any): void;
|
||||
|
||||
|
||||
|
||||
interface GuinessCompatibleSpy extends jasmine.Spy {
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.returnValue, all calls to the function will return a specific
|
||||
* value.
|
||||
*/
|
||||
andReturn(val: any): void;
|
||||
|
||||
/**
|
||||
* By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied
|
||||
* function.
|
||||
*/
|
||||
andCallFake(fn: Function): GuinessCompatibleSpy;
|
||||
|
||||
/**
|
||||
* removes all recorded calls
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SpyObject {
|
||||
|
||||
constructor(type?: any);
|
||||
|
||||
static stub(object?: any, config?: any, overrides?: any): void;
|
||||
|
||||
noSuchMethod(args: any): void;
|
||||
|
||||
spy(name: any): void;
|
||||
|
||||
prop(name: any, value: any): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function isInInnerZone(): boolean;
|
||||
|
||||
|
||||
|
||||
interface RootTestComponent {
|
||||
|
||||
debugElement: ng.DebugElement;
|
||||
|
||||
detectChanges(): void;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Builds a RootTestComponent for use in component level tests.
|
||||
*/
|
||||
class TestComponentBuilder {
|
||||
|
||||
constructor(_injector: ng.Injector);
|
||||
|
||||
/**
|
||||
* Overrides only the html of a {@link ComponentMetadata}.
|
||||
* All the other properties of the component's {@link ng.ViewMetadata} are preserved.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {string} html
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideTemplate(componentType: ng.Type, template: string): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides a component's {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {view} View
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideView(componentType: ng.Type, view: ng.ViewMetadata): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides the directives from the component {@link ng.ViewMetadata}.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {ng.Type} from
|
||||
* @param {ng.Type} to
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideDirective(componentType: ng.Type, from: ng.Type, to: ng.Type): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Overrides one or more injectables configured via `bindings` metadata property of a directive or
|
||||
* component.
|
||||
* Very useful when certain bindings need to be mocked out.
|
||||
*
|
||||
* The bindings specified via this method are appended to the existing `bindings` causing the
|
||||
* duplicated bindings to
|
||||
* be overridden.
|
||||
*
|
||||
* @param {ng.Type} component
|
||||
* @param {any[]} bindings
|
||||
*
|
||||
* @return {TestComponentBuilder}
|
||||
*/
|
||||
overrideViewBindings(type: ng.Type, bindings: any[]): TestComponentBuilder;
|
||||
|
||||
/**
|
||||
* Builds and returns a RootTestComponent.
|
||||
*
|
||||
* @return {Promise<RootTestComponent>}
|
||||
*/
|
||||
createAsync(rootComponentType: ng.Type): Promise<RootTestComponent>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function createTestInjector(bindings: Array<ng.Type | ng.Binding | any[]>): ng.Injector;
|
||||
|
||||
|
||||
|
||||
class FunctionWithParamTokens {
|
||||
|
||||
constructor(_tokens: any[], _fn: Function);
|
||||
|
||||
/**
|
||||
* Returns the value of the executed function.
|
||||
*/
|
||||
execute(injector: ng.Injector): any;
|
||||
|
||||
hasToken(token: any): boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wraps a function to be executed in the fakeAsync zone:
|
||||
* - microtasks are manually executed by calling `flushMicrotasks()`,
|
||||
* - timers are synchronous, `tick()` simulates the asynchronous passage of time.
|
||||
*
|
||||
* If there are any pending timers at the end of the function, an exception will be thrown.
|
||||
*
|
||||
* @param fn
|
||||
* @returns {Function} The function wrapped to be executed in the fakeAsync zone
|
||||
*/
|
||||
function fakeAsync(fn: Function): Function;
|
||||
|
||||
|
||||
|
||||
function clearPendingTimers(): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone.
|
||||
*
|
||||
* The microtasks queue is drained at the very start of this function and after any timer callback
|
||||
* has been executed.
|
||||
*
|
||||
* @param {number} millis Number of millisecond, defaults to 0
|
||||
*/
|
||||
function tick(millis?: number): void;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Flush any pending microtasks.
|
||||
*/
|
||||
function flushMicrotasks(): void;
|
||||
|
||||
|
||||
|
||||
class Log {
|
||||
|
||||
constructor();
|
||||
|
||||
add(value: any): void;
|
||||
|
||||
fn(value: any): void;
|
||||
|
||||
clear(): void;
|
||||
|
||||
result(): string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class BrowserDetection {
|
||||
|
||||
constructor(ua: string);
|
||||
|
||||
isFirefox: boolean;
|
||||
|
||||
isAndroid: boolean;
|
||||
|
||||
isEdge: boolean;
|
||||
|
||||
isIE: boolean;
|
||||
|
||||
isWebkit: boolean;
|
||||
|
||||
isIOS7: boolean;
|
||||
|
||||
isSlow: boolean;
|
||||
|
||||
supportsIntlApi: boolean;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var browserDetection: BrowserDetection;
|
||||
|
||||
|
||||
|
||||
function dispatchEvent(element: any, eventType: any): void;
|
||||
|
||||
|
||||
|
||||
function el(html: string): HTMLElement;
|
||||
|
||||
|
||||
|
||||
function containsRegexp(input: string): RegExp;
|
||||
|
||||
|
||||
|
||||
function normalizeCSS(css: string): string;
|
||||
|
||||
|
||||
|
||||
function stringifyElement(el: any): string;
|
||||
|
||||
|
||||
|
||||
var RootTestComponent: ng.InjectableReference;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare module "angular2/test_lib" {
|
||||
export = ngTestLib;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user