mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Update angular2 d.ts to alpha34
This commit is contained in:
parent
284c2b8828
commit
a95ee80de0
6564
angular2/angular2-2.0.0-alpha.34.d.ts
vendored
Normal file
6564
angular2/angular2-2.0.0-alpha.34.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
568
angular2/angular2.d.ts
vendored
568
angular2/angular2.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.33
|
||||
// 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
|
||||
@ -20,12 +20,6 @@ interface Map<K,V> {}
|
||||
interface StringMap<K,V> extends Map<K,V> {}
|
||||
|
||||
declare module ng {
|
||||
type SetterFn = typeof Function;
|
||||
type int = number;
|
||||
interface Type extends Function {
|
||||
new (...args: any[]): any;
|
||||
}
|
||||
|
||||
// See https://github.com/Microsoft/TypeScript/issues/1168
|
||||
class BaseException /* extends Error */ {
|
||||
message: string;
|
||||
@ -183,7 +177,7 @@ declare module ng {
|
||||
* When a component is instantiated, Angular
|
||||
* - creates a shadow DOM for the component.
|
||||
* - loads the selected template into the shadow DOM.
|
||||
* - creates all the injectable objects configured with `hostInjector` and `viewInjector`.
|
||||
* - creates all the injectable objects configured with `bindings` and `viewBindings`.
|
||||
*
|
||||
* All template expressions and statements are then evaluated against the component instance.
|
||||
*
|
||||
@ -251,7 +245,7 @@ declare module ng {
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'greet',
|
||||
* viewInjector: [
|
||||
* viewBindings: [
|
||||
* Greeter
|
||||
* ]
|
||||
* })
|
||||
@ -264,7 +258,7 @@ declare module ng {
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
viewInjector: List<any>;
|
||||
viewBindings: List<any>;
|
||||
}
|
||||
|
||||
|
||||
@ -318,11 +312,9 @@ declare module ng {
|
||||
*
|
||||
* To inject other directives, declare the constructor parameter as:
|
||||
* - `directive:DirectiveType`: a directive on the current element only
|
||||
* - `@Ancestor() directive:DirectiveType`: any directive that matches the type between the current
|
||||
* - `@Host() directive:DirectiveType`: any directive that matches the type between the current
|
||||
* element and the
|
||||
* Shadow DOM root. Current element is not included in the resolution, therefore even if it could
|
||||
* resolve it, it will
|
||||
* be ignored.
|
||||
* Shadow DOM root.
|
||||
* - `@Query(DirectiveType) query:QueryList<DirectiveType>`: A live collection of direct child
|
||||
* directives.
|
||||
* - `@QueryDescendants(DirectiveType) query:QueryList<DirectiveType>`: A live collection of any
|
||||
@ -429,21 +421,19 @@ declare module ng {
|
||||
* ### Injecting a directive from any ancestor elements
|
||||
*
|
||||
* Directives can inject other directives declared on any ancestor element (in the current Shadow
|
||||
* DOM), i.e. on the
|
||||
* parent element and its parents. By definition, a directive with an `@Ancestor` annotation does
|
||||
* not attempt to
|
||||
* resolve dependencies for the current element, even if this would satisfy the dependency.
|
||||
*
|
||||
* DOM), i.e. on the current element, the
|
||||
* parent element, or its parents.
|
||||
* ```
|
||||
* @Directive({ selector: '[my-directive]' })
|
||||
* class MyDirective {
|
||||
* constructor(@Ancestor() dependency: Dependency) {
|
||||
* constructor(@Host() dependency: Dependency) {
|
||||
* expect(dependency.id).toEqual(2);
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* `@Ancestor` checks the parent, as well as its parents recursively. If `dependency="2"` didn't
|
||||
* `@Host` checks the current element, the parent, as well as its parents recursively. If
|
||||
* `dependency="2"` didn't
|
||||
* exist on the direct parent, this injection would
|
||||
* have returned
|
||||
* `dependency="1"`.
|
||||
@ -982,7 +972,7 @@ declare module ng {
|
||||
*
|
||||
* @Directive({
|
||||
* selector: 'greet',
|
||||
* hostInjector: [
|
||||
* bindings: [
|
||||
* Greeter
|
||||
* ]
|
||||
* })
|
||||
@ -995,7 +985,7 @@ declare module ng {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
hostInjector: List<any>;
|
||||
bindings: List<any>;
|
||||
|
||||
|
||||
/**
|
||||
@ -1078,7 +1068,7 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Specifies an inline template for an angular component.
|
||||
* Specifies a template URL for an angular component.
|
||||
*
|
||||
* NOTE: either `templateUrl` or `template` should be used, but not both.
|
||||
*/
|
||||
@ -1086,7 +1076,7 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Specifies a template URL for an angular component.
|
||||
* Specifies an inline template for an angular component.
|
||||
*
|
||||
* NOTE: either `templateUrl` or `template` should be used, but not both.
|
||||
*/
|
||||
@ -1132,8 +1122,9 @@ declare module ng {
|
||||
|
||||
/**
|
||||
* Specify how the template and the styles should be encapsulated.
|
||||
* The default is {@link ViewEncapsulation.EMULATED} if the view has styles,
|
||||
* otherwise {@link ViewEncapsulation.NONE}.
|
||||
* The default is {@link ViewEncapsulation#EMULATED `ViewEncapsulation.EMULATED`} if the view
|
||||
* has styles,
|
||||
* otherwise {@link ViewEncapsulation#NONE `ViewEncapsulation.NONE`}.
|
||||
*/
|
||||
encapsulation: ViewEncapsulation;
|
||||
}
|
||||
@ -1207,8 +1198,9 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Defines lifecycle method [onAllChangesDone ] called when the bindings of all its children have
|
||||
* been changed.
|
||||
* Defines lifecycle method
|
||||
* {@link annotations/LifeCycleEvent#onAllChangesDone `LifeCycleEvent.onAllChangesDone`}
|
||||
* called when the bindings of all its children have been changed.
|
||||
*/
|
||||
interface OnAllChangesDone {
|
||||
|
||||
@ -1217,8 +1209,8 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Defines lifecycle method [onChange] called after all of component's bound
|
||||
* properties are updated.
|
||||
* Defines lifecycle method {@link annotations/LifeCycleEvent#onChange `LifeCycleEvent.onChange`}
|
||||
* called after all of component's bound properties are updated.
|
||||
*/
|
||||
interface OnChange {
|
||||
|
||||
@ -1227,7 +1219,8 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Defines lifecycle method [onDestroy] called when a directive is being destroyed.
|
||||
* Defines lifecycle method {@link annotations/LifeCycleEvent#onDestroy `LifeCycleEvent.onDestroy`}
|
||||
* called when a directive is being destroyed.
|
||||
*/
|
||||
interface OnDestroy {
|
||||
|
||||
@ -1236,7 +1229,8 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Defines lifecycle method [onInit] called when a directive is being checked the first time.
|
||||
* Defines lifecycle method {@link annotations/LifeCycleEvent#onInit `LifeCycleEvent.onInit`}
|
||||
* called when a directive is being checked the first time.
|
||||
*/
|
||||
interface OnInit {
|
||||
|
||||
@ -1245,7 +1239,8 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Defines lifecycle method [onCheck] called when a directive is being checked.
|
||||
* Defines lifecycle method {@link annotations/LifeCycleEvent#onCheck `LifeCycleEvent.onCheck`}
|
||||
* called when a directive is being checked.
|
||||
*/
|
||||
interface OnCheck {
|
||||
|
||||
@ -1362,21 +1357,6 @@ declare module ng {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An interface implemented by all Angular parameter decorators, which allows them to be used as ES7
|
||||
* decorators.
|
||||
*/
|
||||
interface ParameterDecorator {
|
||||
|
||||
|
||||
/**
|
||||
* Invoke as ES7 decorator.
|
||||
*/
|
||||
(cls: Type, unusedKey: any, index: number): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An interface implemented by all Angular type decorators, which allows them to be used as ES7
|
||||
* decorators as well as
|
||||
@ -1565,10 +1545,10 @@ declare module ng {
|
||||
events?: List<string>,
|
||||
host?: StringMap<string, string>,
|
||||
lifecycle?: List<LifecycleEvent>,
|
||||
hostInjector?: List<any>,
|
||||
bindings?: List<any>,
|
||||
exportAs?: string,
|
||||
compileChildren?: boolean,
|
||||
viewInjector?: List<any>,
|
||||
viewBindings?: List<any>,
|
||||
changeDetection?: string,
|
||||
}): ComponentAnnotation;
|
||||
|
||||
@ -1579,10 +1559,10 @@ declare module ng {
|
||||
events?: List<string>,
|
||||
host?: StringMap<string, string>,
|
||||
lifecycle?: List<LifecycleEvent>,
|
||||
hostInjector?: List<any>,
|
||||
bindings?: List<any>,
|
||||
exportAs?: string,
|
||||
compileChildren?: boolean,
|
||||
viewInjector?: List<any>,
|
||||
viewBindings?: List<any>,
|
||||
changeDetection?: string,
|
||||
}): ComponentDecorator;
|
||||
|
||||
@ -1648,15 +1628,15 @@ declare module ng {
|
||||
|
||||
new(obj: {
|
||||
selector?: string, properties?: List<string>, events?: List<string>,
|
||||
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>,
|
||||
hostInjector?: List<any>, exportAs?: string, compileChildren?: boolean;
|
||||
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>, bindings?: List<any>,
|
||||
exportAs?: string, compileChildren?: boolean;
|
||||
}): DirectiveAnnotation;
|
||||
|
||||
|
||||
(obj: {
|
||||
selector?: string, properties?: List<string>, events?: List<string>,
|
||||
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>,
|
||||
hostInjector?: List<any>, exportAs?: string, compileChildren?: boolean;
|
||||
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>, bindings?: List<any>,
|
||||
exportAs?: string, compileChildren?: boolean;
|
||||
}): DirectiveDecorator;
|
||||
|
||||
}
|
||||
@ -1892,6 +1872,48 @@ declare module ng {
|
||||
location: string;
|
||||
}
|
||||
|
||||
interface ChangeDetector {
|
||||
|
||||
parent: ChangeDetector;
|
||||
|
||||
mode: string;
|
||||
|
||||
addChild(cd: ChangeDetector): void;
|
||||
|
||||
addShadowDomChild(cd: ChangeDetector): void;
|
||||
|
||||
removeChild(cd: ChangeDetector): void;
|
||||
|
||||
removeShadowDomChild(cd: ChangeDetector): void;
|
||||
|
||||
remove(): void;
|
||||
|
||||
hydrate(context: any, locals: Locals, directives: any, pipes: any): void;
|
||||
|
||||
dehydrate(): void;
|
||||
|
||||
markPathToRootAsCheckOnce(): void;
|
||||
|
||||
detectChanges(): void;
|
||||
|
||||
checkNoChanges(): void;
|
||||
}
|
||||
|
||||
class Locals {
|
||||
|
||||
parent: Locals;
|
||||
|
||||
current: Map<any, any>;
|
||||
|
||||
contains(name: string): boolean;
|
||||
|
||||
get(name: string): any;
|
||||
|
||||
set(name: string, value: any): void;
|
||||
|
||||
clearValues(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Controls change detection.
|
||||
@ -1938,6 +1960,8 @@ declare module ng {
|
||||
wrapped: any;
|
||||
}
|
||||
|
||||
const defaultPipes : Pipes ;
|
||||
|
||||
|
||||
/**
|
||||
* An interface which all pipes must implement.
|
||||
@ -1985,7 +2009,7 @@ declare module ng {
|
||||
* 'json': [jsonPipeFactory]
|
||||
* }
|
||||
* @Component({
|
||||
* viewInjector: [
|
||||
* viewBindings: [
|
||||
* bind(Pipes).toValue(new Pipes(pipesConfig))
|
||||
* ]
|
||||
* })
|
||||
@ -1996,6 +2020,64 @@ declare module ng {
|
||||
get(type: string, obj: any, cdRef?: ChangeDetectorRef, existingPipe?: Pipe): Pipe;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
|
||||
*/
|
||||
class IterableDiffers {
|
||||
|
||||
factories: IterableDifferFactory[];
|
||||
|
||||
find(iterable: Object): IterableDifferFactory;
|
||||
}
|
||||
|
||||
interface IterableDiffer {
|
||||
|
||||
diff(object: Object): any;
|
||||
|
||||
onDestroy(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides a factory for {@link IterableDiffer}.
|
||||
*/
|
||||
interface IterableDifferFactory {
|
||||
|
||||
supports(objects: Object): boolean;
|
||||
|
||||
create(cdRef: ChangeDetectorRef): IterableDiffer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
|
||||
*/
|
||||
class KeyValueDiffers {
|
||||
|
||||
factories: KeyValueDifferFactory[];
|
||||
|
||||
find(kv: Object): KeyValueDifferFactory;
|
||||
}
|
||||
|
||||
interface KeyValueDiffer {
|
||||
|
||||
diff(object: Object): void;
|
||||
|
||||
onDestroy(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides a factory for {@link KeyValueDiffer}.
|
||||
*/
|
||||
interface KeyValueDifferFactory {
|
||||
|
||||
supports(objects: Object): boolean;
|
||||
|
||||
create(cdRef: ChangeDetectorRef): KeyValueDiffer;
|
||||
}
|
||||
|
||||
interface PipeFactory {
|
||||
|
||||
supports(obs: any): boolean;
|
||||
@ -2097,6 +2179,18 @@ declare module ng {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runtime representation of a type.
|
||||
*
|
||||
* In JavaScript a Type is a constructor function.
|
||||
*/
|
||||
interface Type extends Function {
|
||||
|
||||
new(args: any): any;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specifies app root url for the application.
|
||||
*
|
||||
@ -2606,6 +2700,59 @@ declare module ng {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides access to explicitly trigger change detection in an application.
|
||||
*
|
||||
* By default, `Zone` triggers change detection in Angular on each virtual machine (VM) turn. When
|
||||
* testing, or in some
|
||||
* limited application use cases, a developer can also trigger change detection with the
|
||||
* `lifecycle.tick()` method.
|
||||
*
|
||||
* Each Angular application has a single `LifeCycle` instance.
|
||||
*
|
||||
* # Example
|
||||
*
|
||||
* This is a contrived example, since the bootstrap automatically runs inside of the `Zone`, which
|
||||
* invokes
|
||||
* `lifecycle.tick()` on your behalf.
|
||||
*
|
||||
* ```javascript
|
||||
* bootstrap(MyApp).then((ref:ComponentRef) => {
|
||||
* var lifeCycle = ref.injector.get(LifeCycle);
|
||||
* var myApp = ref.instance;
|
||||
*
|
||||
* ref.doSomething();
|
||||
* lifecycle.tick();
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
class LifeCycle {
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
registerWith(zone: NgZone, changeDetector?: ChangeDetector): void;
|
||||
|
||||
|
||||
/**
|
||||
* Invoke this method to explicitly process change detection and its side-effects.
|
||||
*
|
||||
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
|
||||
* further
|
||||
* changes are detected. If additional changes are picked up during this second cycle, bindings
|
||||
* in
|
||||
* the app have
|
||||
* side-effects that cannot be resolved in a single change detection pass. In this case, Angular
|
||||
* throws an error,
|
||||
* since an Angular application can only have one change detection pass during which all change
|
||||
* detection must
|
||||
* complete.
|
||||
*/
|
||||
tick(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reference to the element.
|
||||
*
|
||||
@ -3099,21 +3246,6 @@ declare module ng {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specifies how injector should resolve a dependency.
|
||||
*
|
||||
* See {@link Self}, {@link Ancestor}, {@link Unbounded}.
|
||||
*/
|
||||
class VisibilityMetadata {
|
||||
|
||||
crossBoundaries: boolean;
|
||||
|
||||
includeSelf: boolean;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specifies that an injector should retrieve a dependency from itself.
|
||||
*
|
||||
@ -3132,14 +3264,15 @@ declare module ng {
|
||||
* expect(nd.dependency).toBeAnInstanceOf(Dependency);
|
||||
* ```
|
||||
*/
|
||||
class SelfMetadata extends VisibilityMetadata {
|
||||
class SelfMetadata {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specifies that an injector should retrieve a dependency from any ancestor from the same boundary.
|
||||
* Specifies that an injector should retrieve a dependency from any injector until reaching the
|
||||
* closest host.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
@ -3148,65 +3281,52 @@ declare module ng {
|
||||
* }
|
||||
*
|
||||
* class NeedsDependency {
|
||||
* constructor(public @Ancestor() dependency:Dependency) {}
|
||||
* constructor(public @Host() dependency:Dependency) {}
|
||||
* }
|
||||
*
|
||||
* var parent = Injector.resolveAndCreate([
|
||||
* bind(Dependency).toClass(AncestorDependency)
|
||||
* bind(Dependency).toClass(HostDependency)
|
||||
* ]);
|
||||
* var child = parent.resolveAndCreateChild([]);
|
||||
* var grandChild = child.resolveAndCreateChild([NeedsDependency, Depedency]);
|
||||
* var nd = grandChild.get(NeedsDependency);
|
||||
* expect(nd.dependency).toBeAnInstanceOf(AncestorDependency);
|
||||
* ```
|
||||
*
|
||||
* You can make an injector to retrive a dependency either from itself or its ancestor by setting
|
||||
* self to true.
|
||||
*
|
||||
* ```
|
||||
* class NeedsDependency {
|
||||
* constructor(public @Ancestor({self:true}) dependency:Dependency) {}
|
||||
* }
|
||||
* expect(nd.dependency).toBeAnInstanceOf(HostDependency);
|
||||
* ```
|
||||
*/
|
||||
class AncestorMetadata extends VisibilityMetadata {
|
||||
class HostMetadata {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specifies that an injector should retrieve a dependency from any ancestor, crossing boundaries.
|
||||
* Specifies that the dependency resolution should start from the parent injector.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* class Dependency {
|
||||
* class Service {}
|
||||
*
|
||||
* class ParentService implements Service {
|
||||
* }
|
||||
*
|
||||
* class NeedsDependency {
|
||||
* constructor(public @Ancestor() dependency:Dependency) {}
|
||||
* class ChildService implements Service {
|
||||
* constructor(public @SkipSelf() parentService:Service) {}
|
||||
* }
|
||||
*
|
||||
* var parent = Injector.resolveAndCreate([
|
||||
* bind(Dependency).toClass(AncestorDependency)
|
||||
* bind(Service).toClass(ParentService)
|
||||
* ]);
|
||||
* var child = parent.resolveAndCreateChild([]);
|
||||
* var grandChild = child.resolveAndCreateChild([NeedsDependency, Depedency]);
|
||||
* var nd = grandChild.get(NeedsDependency);
|
||||
* expect(nd.dependency).toBeAnInstanceOf(AncestorDependency);
|
||||
* ```
|
||||
*
|
||||
* You can make an injector to retrive a dependency either from itself or its ancestor by setting
|
||||
* self to true.
|
||||
*
|
||||
* ```
|
||||
* class NeedsDependency {
|
||||
* constructor(public @Ancestor({self:true}) dependency:Dependency) {}
|
||||
* }
|
||||
* var child = parent.resolveAndCreateChild([
|
||||
* bind(Service).toClass(ChildSerice)
|
||||
* ]);
|
||||
* var s = child.get(Service);
|
||||
* expect(s).toBeAnInstanceOf(ChildService);
|
||||
* expect(s.parentService).toBeAnInstanceOf(ParentService);
|
||||
* ```
|
||||
*/
|
||||
class UnboundedMetadata extends VisibilityMetadata {
|
||||
class SkipSelfMetadata {
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
@ -3243,8 +3363,6 @@ declare module ng {
|
||||
token: void;
|
||||
}
|
||||
|
||||
const DEFAULT_VISIBILITY : VisibilityMetadata ;
|
||||
|
||||
|
||||
/**
|
||||
* Allows to refer to references which are not yet defined.
|
||||
@ -3749,7 +3867,9 @@ declare module ng {
|
||||
|
||||
optional: boolean;
|
||||
|
||||
visibility: VisibilityMetadata;
|
||||
lowerBoundVisibility: any;
|
||||
|
||||
upperBoundVisibility: any;
|
||||
|
||||
properties: List<any>;
|
||||
}
|
||||
@ -3971,27 +4091,27 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Factory for creating {@link AncestorMetadata}.
|
||||
* Factory for creating {@link HostMetadata}.
|
||||
*/
|
||||
interface AncestorFactory {
|
||||
interface HostFactory {
|
||||
|
||||
new(visibility?: {self: boolean}): AncestorMetadata;
|
||||
new(): HostMetadata;
|
||||
|
||||
|
||||
(visibility?: {self: boolean}): any;
|
||||
(): any;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Factory for creating {@link UnboundedMetadata}.
|
||||
* Factory for creating {@link SkipSelfMetadata}.
|
||||
*/
|
||||
interface UnboundedFactory {
|
||||
interface SkipSelfFactory {
|
||||
|
||||
new(visibility?: {self: boolean}): UnboundedMetadata;
|
||||
new(): SkipSelfMetadata;
|
||||
|
||||
|
||||
(visibility?: {self: boolean}): any;
|
||||
(): any;
|
||||
|
||||
}
|
||||
|
||||
@ -4021,15 +4141,15 @@ declare module ng {
|
||||
|
||||
|
||||
/**
|
||||
* Factory for creating {@link AncestorMetadata}.
|
||||
* Factory for creating {@link HostMetadata}.
|
||||
*/
|
||||
var Ancestor : AncestorFactory ;
|
||||
var Host : HostFactory ;
|
||||
|
||||
|
||||
/**
|
||||
* Factory for creating {@link UnboundedMetadata}.
|
||||
* Factory for creating {@link SkipSelfMetadata}.
|
||||
*/
|
||||
var Unbounded : UnboundedFactory ;
|
||||
var SkipSelf : SkipSelfFactory ;
|
||||
|
||||
|
||||
/**
|
||||
@ -4142,7 +4262,7 @@ declare module ng {
|
||||
|
||||
templateRef: TemplateRef;
|
||||
|
||||
pipes: Pipes;
|
||||
iterableDiffers: IterableDiffers;
|
||||
|
||||
cdr: ChangeDetectorRef;
|
||||
|
||||
@ -4855,7 +4975,7 @@ declare module ng {
|
||||
* ```
|
||||
* import {Http, MyNodeBackend, httpInjectables, BaseRequestOptions} from 'angular2/http';
|
||||
* @Component({
|
||||
* viewInjector: [
|
||||
* viewBindings: [
|
||||
* httpInjectables,
|
||||
* bind(Http).toFactory((backend, options) => {
|
||||
* return new Http(backend, options);
|
||||
@ -4944,7 +5064,7 @@ declare module ng {
|
||||
*
|
||||
* ```
|
||||
* import {Http, httpInjectables} from 'angular2/http';
|
||||
* @Component({selector: 'http-app', viewInjector: [httpInjectables]})
|
||||
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
|
||||
* @View({templateUrl: 'people.html'})
|
||||
* class PeopleComponent {
|
||||
* constructor(http: Http) {
|
||||
@ -5226,7 +5346,7 @@ declare module ng {
|
||||
*
|
||||
* ```
|
||||
* import {httpInjectables, Http} from 'angular2/http';
|
||||
* @Component({selector: 'http-app', viewInjector: [httpInjectables]})
|
||||
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
|
||||
* @View({template: '{{data}}'})
|
||||
* class MyApp {
|
||||
* constructor(http:Http) {
|
||||
@ -6029,7 +6149,7 @@ declare module ng {
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'login-comp',
|
||||
* viewInjector: [
|
||||
* viewBindings: [
|
||||
* FormBuilder
|
||||
* ]
|
||||
* })
|
||||
@ -6093,6 +6213,82 @@ declare module ng {
|
||||
|
||||
const formInjectables : List<Type> ;
|
||||
|
||||
class DirectiveMetadata {
|
||||
|
||||
id: any;
|
||||
|
||||
selector: string;
|
||||
|
||||
compileChildren: boolean;
|
||||
|
||||
events: List<string>;
|
||||
|
||||
properties: List<string>;
|
||||
|
||||
readAttributes: List<string>;
|
||||
|
||||
type: number;
|
||||
|
||||
callOnDestroy: boolean;
|
||||
|
||||
callOnChange: boolean;
|
||||
|
||||
callOnCheck: boolean;
|
||||
|
||||
callOnInit: boolean;
|
||||
|
||||
callOnAllChangesDone: boolean;
|
||||
|
||||
changeDetection: string;
|
||||
|
||||
exportAs: string;
|
||||
|
||||
hostListeners: Map<string, string>;
|
||||
|
||||
hostProperties: Map<string, string>;
|
||||
|
||||
hostAttributes: Map<string, string>;
|
||||
|
||||
hostActions: Map<string, string>;
|
||||
}
|
||||
|
||||
class DomRenderer extends Renderer {
|
||||
|
||||
createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number, hostElementSelector: string): RenderViewWithFragments;
|
||||
|
||||
createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments;
|
||||
|
||||
destroyView(viewRef: RenderViewRef): void;
|
||||
|
||||
getNativeElementSync(location: RenderElementRef): any;
|
||||
|
||||
getRootNodes(fragment: RenderFragmentRef): List<Node>;
|
||||
|
||||
attachFragmentAfterFragment(previousFragmentRef: RenderFragmentRef, fragmentRef: RenderFragmentRef): void;
|
||||
|
||||
attachFragmentAfterElement(elementRef: RenderElementRef, fragmentRef: RenderFragmentRef): void;
|
||||
|
||||
detachFragment(fragmentRef: RenderFragmentRef): void;
|
||||
|
||||
hydrateView(viewRef: RenderViewRef): void;
|
||||
|
||||
dehydrateView(viewRef: RenderViewRef): void;
|
||||
|
||||
setElementProperty(location: RenderElementRef, propertyName: string, propertyValue: any): void;
|
||||
|
||||
setElementAttribute(location: RenderElementRef, attributeName: string, attributeValue: string): void;
|
||||
|
||||
setElementClass(location: RenderElementRef, className: string, isAdd: boolean): void;
|
||||
|
||||
setElementStyle(location: RenderElementRef, styleName: string, styleValue: string): void;
|
||||
|
||||
invokeElementMethod(location: RenderElementRef, methodName: string, args: List<any>): void;
|
||||
|
||||
setText(viewRef: RenderViewRef, textNodeIndex: number, text: string): void;
|
||||
|
||||
setEventDispatcher(viewRef: RenderViewRef, dispatcher: any): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A dispatcher for all events happening in a view.
|
||||
@ -6236,41 +6432,21 @@ declare module ng {
|
||||
fragmentRefs: RenderFragmentRef[];
|
||||
}
|
||||
|
||||
class DomRenderer extends Renderer {
|
||||
class ViewDefinition {
|
||||
|
||||
createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number, hostElementSelector: string): RenderViewWithFragments;
|
||||
componentId: string;
|
||||
|
||||
createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments;
|
||||
templateAbsUrl: string;
|
||||
|
||||
destroyView(viewRef: RenderViewRef): void;
|
||||
template: string;
|
||||
|
||||
getNativeElementSync(location: RenderElementRef): any;
|
||||
directives: List<DirectiveMetadata>;
|
||||
|
||||
getRootNodes(fragment: RenderFragmentRef): List<Node>;
|
||||
styleAbsUrls: List<string>;
|
||||
|
||||
attachFragmentAfterFragment(previousFragmentRef: RenderFragmentRef, fragmentRef: RenderFragmentRef): void;
|
||||
styles: List<string>;
|
||||
|
||||
attachFragmentAfterElement(elementRef: RenderElementRef, fragmentRef: RenderFragmentRef): void;
|
||||
|
||||
detachFragment(fragmentRef: RenderFragmentRef): void;
|
||||
|
||||
hydrateView(viewRef: RenderViewRef): void;
|
||||
|
||||
dehydrateView(viewRef: RenderViewRef): void;
|
||||
|
||||
setElementProperty(location: RenderElementRef, propertyName: string, propertyValue: any): void;
|
||||
|
||||
setElementAttribute(location: RenderElementRef, attributeName: string, attributeValue: string): void;
|
||||
|
||||
setElementClass(location: RenderElementRef, className: string, isAdd: boolean): void;
|
||||
|
||||
setElementStyle(location: RenderElementRef, styleName: string, styleValue: string): void;
|
||||
|
||||
invokeElementMethod(location: RenderElementRef, methodName: string, args: List<any>): void;
|
||||
|
||||
setText(viewRef: RenderViewRef, textNodeIndex: number, text: string): void;
|
||||
|
||||
setEventDispatcher(viewRef: RenderViewRef, dispatcher: any): void;
|
||||
encapsulation: ViewEncapsulation;
|
||||
}
|
||||
|
||||
const DOCUMENT_TOKEN : OpaqueToken ;
|
||||
@ -6283,6 +6459,84 @@ declare module ng {
|
||||
|
||||
const DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Defines when a compiled template should be stored as a string
|
||||
* rather than keeping its Nodes to preserve memory.
|
||||
*/
|
||||
const MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN : OpaqueToken ;
|
||||
|
||||
|
||||
/**
|
||||
* Create trace scope.
|
||||
*
|
||||
* Scopes must be strictly nested and are analogous to stack frames, but
|
||||
* do not have to follow the stack frames. Instead it is recommended that they follow logical
|
||||
* nesting. You may want to use
|
||||
* [Event
|
||||
* Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
|
||||
* as they are defined in WTF.
|
||||
*
|
||||
* Used to mark scope entry. The return value is used to leave the scope.
|
||||
*
|
||||
* final myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
|
||||
*
|
||||
* someMethod() {
|
||||
* var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
|
||||
* // DO SOME WORK HERE
|
||||
* return wtfLeave(s, 123); // Return value 123
|
||||
* }
|
||||
*
|
||||
* Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
|
||||
* negatively impact the performance of your application. For this reason we recommend that
|
||||
* you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
|
||||
* so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
|
||||
* exception, will produce incorrect trace, but presence of exception signifies logic error which
|
||||
* needs to be fixed before the app should be profiled. Add try-finally only when you expect that
|
||||
* an exception is expected during normal execution while profiling.
|
||||
*/
|
||||
var wtfCreateScope : WtfScopeFn ;
|
||||
|
||||
|
||||
/**
|
||||
* Used to mark end of Scope.
|
||||
*
|
||||
* - `scope` to end.
|
||||
* - `returnValue` (optional) to be passed to the WTF.
|
||||
*
|
||||
* Returns the `returnValue for easy chaining.
|
||||
*/
|
||||
var wtfLeave : <T>(scope: any, returnValue?: T) => T ;
|
||||
|
||||
|
||||
/**
|
||||
* Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
|
||||
* The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
|
||||
* enabled.
|
||||
*
|
||||
* someMethod() {
|
||||
* var s = wtfStartTimeRange('HTTP:GET', 'some.url');
|
||||
* var future = new Future.delay(5).then((_) {
|
||||
* wtfEndTimeRange(s);
|
||||
* });
|
||||
* }
|
||||
*/
|
||||
var wtfStartTimeRange : (rangeType: string, action: string) => any ;
|
||||
|
||||
|
||||
/**
|
||||
* Ends a async time range operation.
|
||||
* [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
|
||||
* enabled.
|
||||
*/
|
||||
var wtfEndTimeRange : (range: any) => void ;
|
||||
|
||||
interface WtfScopeFn {
|
||||
|
||||
(arg0?: any, arg1?: any): any;
|
||||
|
||||
}
|
||||
|
||||
var ChangeDetectorRef: InjectableReference;
|
||||
|
||||
var ApplicationRef: InjectableReference;
|
||||
@ -6303,8 +6557,8 @@ declare module ng {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
declare module "angular2/angular2" {
|
||||
export = ng;
|
||||
}
|
||||
|
||||
|
||||
|
||||
469
angular2/router-2.0.0-alpha.34.d.ts
vendored
Normal file
469
angular2/router-2.0.0-alpha.34.d.ts
vendored
Normal file
@ -0,0 +1,469 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
372
angular2/router.d.ts
vendored
372
angular2/router.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.31
|
||||
// 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
|
||||
@ -18,120 +18,56 @@
|
||||
* 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 },
|
||||
@ -139,48 +75,48 @@ declare module ng {
|
||||
* ]);
|
||||
* ```
|
||||
*/
|
||||
config(config: StringMap<string, any>| List<StringMap<string, any>>): Promise<any>;
|
||||
|
||||
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): Promise<any>;
|
||||
|
||||
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Updates this router and all descendant routers according to the given instruction
|
||||
*/
|
||||
commit(instruction: Instruction): Promise<any>;
|
||||
|
||||
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to URL updates from the router
|
||||
*/
|
||||
subscribe(onNext: any): void;
|
||||
|
||||
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
|
||||
@ -188,71 +124,71 @@ declare module ng {
|
||||
*/
|
||||
generate(linkParams: List<any>): string;
|
||||
}
|
||||
|
||||
|
||||
class RootRouter extends Router {
|
||||
|
||||
commit(instruction: any): Promise<any>;
|
||||
|
||||
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'
|
||||
* });
|
||||
* @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
|
||||
@ -260,21 +196,21 @@ declare module ng {
|
||||
* 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.
|
||||
@ -282,26 +218,26 @@ declare module ng {
|
||||
* parameters.
|
||||
*/
|
||||
class RouteRegistry {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Given a component and a configuration object, add the route to this registry
|
||||
*/
|
||||
config(parentComponent: any, config: StringMap<string, any>): void;
|
||||
|
||||
config(parentComponent: any, config: RouteDefinition, isRootLevelRoute?: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Reads the annotations of a component and configures the registry based on them
|
||||
*/
|
||||
configFromComponent(component: any): void;
|
||||
|
||||
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 }]`
|
||||
@ -309,56 +245,56 @@ declare module ng {
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
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:
|
||||
@ -367,93 +303,167 @@ declare module ng {
|
||||
* - `/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;
|
||||
|
||||
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
|
||||
}
|
||||
|
||||
var appBaseHrefToken : OpaqueToken ;
|
||||
|
||||
|
||||
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 ;
|
||||
|
||||
|
||||
var CanActivate:any;
|
||||
|
||||
var routerDirectives : List<any> ;
|
||||
|
||||
/**
|
||||
* 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> ;
|
||||
|
||||
var RouteConfig: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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user