2015-08-14 10:03:45 -07:00
|
|
|
/**
|
|
|
|
* This indirection is needed to free up Component, etc symbols in the public API
|
|
|
|
* to be used by the decorator versions of these annotations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
export {
|
|
|
|
QueryMetadata,
|
2015-09-17 18:45:14 -07:00
|
|
|
ContentChildrenMetadata,
|
2015-09-19 18:39:35 -07:00
|
|
|
ContentChildMetadata,
|
2015-09-17 18:45:14 -07:00
|
|
|
ViewChildrenMetadata,
|
2015-08-14 10:03:45 -07:00
|
|
|
ViewQueryMetadata,
|
2015-09-19 18:39:35 -07:00
|
|
|
ViewChildMetadata,
|
|
|
|
AttributeMetadata
|
2015-08-14 10:03:45 -07:00
|
|
|
} from './metadata/di';
|
|
|
|
|
|
|
|
export {
|
|
|
|
ComponentMetadata,
|
|
|
|
DirectiveMetadata,
|
|
|
|
PipeMetadata,
|
2015-09-30 20:59:23 -07:00
|
|
|
InputMetadata,
|
|
|
|
OutputMetadata,
|
2015-09-04 14:07:16 -07:00
|
|
|
HostBindingMetadata,
|
|
|
|
HostListenerMetadata
|
2015-08-14 10:03:45 -07:00
|
|
|
} from './metadata/directives';
|
|
|
|
|
|
|
|
export {ViewMetadata, ViewEncapsulation} from './metadata/view';
|
|
|
|
|
|
|
|
import {
|
|
|
|
QueryMetadata,
|
2015-09-17 18:45:14 -07:00
|
|
|
ContentChildrenMetadata,
|
2015-09-19 18:39:35 -07:00
|
|
|
ContentChildMetadata,
|
2015-09-17 18:45:14 -07:00
|
|
|
ViewChildrenMetadata,
|
2015-09-19 18:39:35 -07:00
|
|
|
ViewChildMetadata,
|
2015-08-14 10:03:45 -07:00
|
|
|
ViewQueryMetadata,
|
2015-09-19 18:39:35 -07:00
|
|
|
AttributeMetadata
|
2015-08-14 10:03:45 -07:00
|
|
|
} from './metadata/di';
|
|
|
|
|
2015-08-07 11:41:38 -07:00
|
|
|
import {
|
2015-08-14 10:03:45 -07:00
|
|
|
ComponentMetadata,
|
|
|
|
DirectiveMetadata,
|
|
|
|
PipeMetadata,
|
2015-09-30 20:59:23 -07:00
|
|
|
InputMetadata,
|
|
|
|
OutputMetadata,
|
2015-09-04 14:07:16 -07:00
|
|
|
HostBindingMetadata,
|
|
|
|
HostListenerMetadata
|
2015-08-14 10:03:45 -07:00
|
|
|
} from './metadata/directives';
|
|
|
|
|
|
|
|
import {ViewMetadata, ViewEncapsulation} from './metadata/view';
|
2015-08-26 11:44:59 -07:00
|
|
|
import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection/change_detection';
|
2015-08-14 10:03:45 -07:00
|
|
|
|
2015-09-03 15:10:48 -07:00
|
|
|
import {
|
|
|
|
makeDecorator,
|
|
|
|
makeParamDecorator,
|
|
|
|
makePropDecorator,
|
|
|
|
TypeDecorator,
|
|
|
|
Class
|
|
|
|
} from './util/decorators';
|
2015-08-20 14:28:25 -07:00
|
|
|
import {Type} from 'angular2/src/core/facade/lang';
|
2015-06-12 23:51:42 -07:00
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* Interface for the {@link DirectiveMetadata} decorator function.
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* See {@link DirectiveFactory}.
|
|
|
|
*/
|
2015-07-02 22:26:07 +02:00
|
|
|
export interface DirectiveDecorator extends TypeDecorator {}
|
2015-06-12 23:51:42 -07:00
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* Interface for the {@link ComponentMetadata} decorator function.
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* See {@link ComponentFactory}.
|
|
|
|
*/
|
|
|
|
export interface ComponentDecorator extends TypeDecorator {
|
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* Chain {@link ViewMetadata} annotation.
|
2015-07-07 08:15:58 +02:00
|
|
|
*/
|
2015-07-07 22:09:19 +02:00
|
|
|
View(obj: {
|
|
|
|
templateUrl?: string,
|
|
|
|
template?: string,
|
2015-09-18 10:33:23 -07:00
|
|
|
directives?: Array<Type | any[]>,
|
|
|
|
pipes?: Array<Type | any[]>,
|
2015-07-07 22:09:19 +02:00
|
|
|
renderer?: string,
|
2015-08-28 11:29:19 -07:00
|
|
|
styles?: string[],
|
|
|
|
styleUrls?: string[],
|
2015-07-07 22:09:19 +02:00
|
|
|
}): ViewDecorator;
|
2015-07-07 08:15:58 +02:00
|
|
|
}
|
2015-06-12 23:51:42 -07:00
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* Interface for the {@link ViewMetadata} decorator function.
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* See {@link ViewFactory}.
|
|
|
|
*/
|
|
|
|
export interface ViewDecorator extends TypeDecorator {
|
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* Chain {@link ViewMetadata} annotation.
|
2015-07-07 08:15:58 +02:00
|
|
|
*/
|
2015-07-07 22:09:19 +02:00
|
|
|
View(obj: {
|
|
|
|
templateUrl?: string,
|
|
|
|
template?: string,
|
2015-09-18 10:33:23 -07:00
|
|
|
directives?: Array<Type | any[]>,
|
|
|
|
pipes?: Array<Type | any[]>,
|
2015-07-07 22:09:19 +02:00
|
|
|
renderer?: string,
|
2015-08-28 11:29:19 -07:00
|
|
|
styles?: string[],
|
|
|
|
styleUrls?: string[],
|
2015-07-15 12:12:23 -07:00
|
|
|
}): ViewDecorator;
|
2015-07-07 08:15:58 +02:00
|
|
|
}
|
2015-06-12 23:51:42 -07:00
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link DirectiveMetadata} factory for creating annotations, decorators or DSL.
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* ## Example as TypeScript Decorator
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* import {Directive} from "angular2/angular2";
|
|
|
|
*
|
|
|
|
* @Directive({...})
|
|
|
|
* class MyDirective {
|
|
|
|
* constructor() {
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* ## Example as ES5 DSL
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyDirective = ng
|
|
|
|
* .Directive({...})
|
|
|
|
* .Class({
|
|
|
|
* constructor: function() {
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* })
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* ## Example as ES5 annotation
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyDirective = function() {
|
|
|
|
* ...
|
|
|
|
* };
|
|
|
|
*
|
|
|
|
* MyDirective.annotations = [
|
|
|
|
* new ng.Directive({...})
|
|
|
|
* ]
|
|
|
|
* ```
|
|
|
|
*/
|
2015-07-02 22:26:07 +02:00
|
|
|
export interface DirectiveFactory {
|
2015-07-07 22:09:19 +02:00
|
|
|
(obj: {
|
2015-09-17 18:45:14 -07:00
|
|
|
selector?: string,
|
2015-09-30 20:59:23 -07:00
|
|
|
inputs?: string[],
|
|
|
|
outputs?: string[],
|
2015-10-02 16:21:49 -07:00
|
|
|
properties?: string[],
|
|
|
|
events?: string[],
|
2015-10-02 16:47:54 -07:00
|
|
|
host?: {[key: string]: string},
|
2015-09-17 18:45:14 -07:00
|
|
|
bindings?: any[],
|
|
|
|
exportAs?: string,
|
|
|
|
moduleId?: string,
|
2015-10-02 16:47:54 -07:00
|
|
|
queries?: {[key: string]: any}
|
2015-07-07 22:09:19 +02:00
|
|
|
}): DirectiveDecorator;
|
|
|
|
new (obj: {
|
2015-09-17 18:45:14 -07:00
|
|
|
selector?: string,
|
2015-09-30 20:59:23 -07:00
|
|
|
inputs?: string[],
|
|
|
|
outputs?: string[],
|
2015-10-02 16:21:49 -07:00
|
|
|
properties?: string[],
|
|
|
|
events?: string[],
|
2015-10-02 16:47:54 -07:00
|
|
|
host?: {[key: string]: string},
|
2015-09-17 18:45:14 -07:00
|
|
|
bindings?: any[],
|
|
|
|
exportAs?: string,
|
|
|
|
moduleId?: string,
|
2015-10-02 16:47:54 -07:00
|
|
|
queries?: {[key: string]: any}
|
2015-08-14 10:03:45 -07:00
|
|
|
}): DirectiveMetadata;
|
2015-06-12 23:51:42 -07:00
|
|
|
}
|
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-09-16 23:28:16 -07:00
|
|
|
* {@link ComponentMetadata} factory for creating annotations, decorators or DSL.
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* ## Example as TypeScript Decorator
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* import {Component, View} from "angular2/angular2";
|
|
|
|
*
|
|
|
|
* @Component({...})
|
|
|
|
* @View({...})
|
|
|
|
* class MyComponent {
|
|
|
|
* constructor() {
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* ## Example as ES5 DSL
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyComponent = ng
|
|
|
|
* .Component({...})
|
|
|
|
* .View({...})
|
|
|
|
* .Class({
|
|
|
|
* constructor: function() {
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* })
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* ## Example as ES5 annotation
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyComponent = function() {
|
|
|
|
* ...
|
|
|
|
* };
|
|
|
|
*
|
|
|
|
* MyComponent.annotations = [
|
2015-08-19 11:42:59 +02:00
|
|
|
* new ng.Component({...}),
|
2015-07-07 08:15:58 +02:00
|
|
|
* new ng.View({...})
|
|
|
|
* ]
|
|
|
|
* ```
|
|
|
|
*/
|
2015-07-02 22:26:07 +02:00
|
|
|
export interface ComponentFactory {
|
2015-07-07 22:09:19 +02:00
|
|
|
(obj: {
|
|
|
|
selector?: string,
|
2015-09-30 20:59:23 -07:00
|
|
|
inputs?: string[],
|
|
|
|
outputs?: string[],
|
2015-10-02 16:21:49 -07:00
|
|
|
properties?: string[],
|
|
|
|
events?: string[],
|
2015-10-02 16:47:54 -07:00
|
|
|
host?: {[key: string]: string},
|
2015-08-28 11:29:19 -07:00
|
|
|
bindings?: any[],
|
2015-07-07 22:09:19 +02:00
|
|
|
exportAs?: string,
|
2015-09-14 15:59:09 -07:00
|
|
|
moduleId?: string,
|
2015-10-02 16:47:54 -07:00
|
|
|
queries?: {[key: string]: any},
|
2015-08-28 11:29:19 -07:00
|
|
|
viewBindings?: any[],
|
2015-08-26 11:44:59 -07:00
|
|
|
changeDetection?: ChangeDetectionStrategy,
|
2015-10-06 17:03:37 -07:00
|
|
|
templateUrl?: string,
|
|
|
|
template?: string,
|
|
|
|
styleUrls?: string[],
|
|
|
|
styles?: string[],
|
|
|
|
directives?: Array<Type | any[]>,
|
|
|
|
pipes?: Array<Type | any[]>,
|
|
|
|
encapsulation?: ViewEncapsulation
|
2015-07-07 22:09:19 +02:00
|
|
|
}): ComponentDecorator;
|
|
|
|
new (obj: {
|
|
|
|
selector?: string,
|
2015-09-30 20:59:23 -07:00
|
|
|
inputs?: string[],
|
|
|
|
outputs?: string[],
|
2015-10-02 16:21:49 -07:00
|
|
|
properties?: string[],
|
|
|
|
events?: string[],
|
2015-10-02 16:47:54 -07:00
|
|
|
host?: {[key: string]: string},
|
2015-08-28 11:29:19 -07:00
|
|
|
bindings?: any[],
|
2015-07-07 22:09:19 +02:00
|
|
|
exportAs?: string,
|
2015-09-14 15:59:09 -07:00
|
|
|
moduleId?: string,
|
2015-10-02 16:47:54 -07:00
|
|
|
queries?: {[key: string]: any},
|
2015-08-28 11:29:19 -07:00
|
|
|
viewBindings?: any[],
|
2015-08-26 11:44:59 -07:00
|
|
|
changeDetection?: ChangeDetectionStrategy,
|
2015-10-06 17:03:37 -07:00
|
|
|
templateUrl?: string,
|
|
|
|
template?: string,
|
|
|
|
styleUrls?: string[],
|
|
|
|
styles?: string[],
|
|
|
|
directives?: Array<Type | any[]>,
|
|
|
|
pipes?: Array<Type | any[]>,
|
|
|
|
encapsulation?: ViewEncapsulation
|
2015-08-14 10:03:45 -07:00
|
|
|
}): ComponentMetadata;
|
2015-06-12 23:51:42 -07:00
|
|
|
}
|
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-09-16 23:28:16 -07:00
|
|
|
* {@link ViewMetadata} factory for creating annotations, decorators or DSL.
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* ## Example as TypeScript Decorator
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* import {Component, View} from "angular2/angular2";
|
|
|
|
*
|
|
|
|
* @Component({...})
|
|
|
|
* @View({...})
|
|
|
|
* class MyComponent {
|
|
|
|
* constructor() {
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* ## Example as ES5 DSL
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyComponent = ng
|
|
|
|
* .Component({...})
|
|
|
|
* .View({...})
|
|
|
|
* .Class({
|
|
|
|
* constructor: function() {
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* })
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* ## Example as ES5 annotation
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyComponent = function() {
|
|
|
|
* ...
|
|
|
|
* };
|
|
|
|
*
|
|
|
|
* MyComponent.annotations = [
|
2015-08-19 11:42:59 +02:00
|
|
|
* new ng.Component({...}),
|
2015-07-07 08:15:58 +02:00
|
|
|
* new ng.View({...})
|
|
|
|
* ]
|
|
|
|
* ```
|
|
|
|
*/
|
2015-07-02 22:26:07 +02:00
|
|
|
export interface ViewFactory {
|
2015-07-07 22:09:19 +02:00
|
|
|
(obj: {
|
|
|
|
templateUrl?: string,
|
|
|
|
template?: string,
|
2015-09-18 10:33:23 -07:00
|
|
|
directives?: Array<Type | any[]>,
|
|
|
|
pipes?: Array<Type | any[]>,
|
2015-07-24 15:28:44 -07:00
|
|
|
encapsulation?: ViewEncapsulation,
|
2015-08-28 11:29:19 -07:00
|
|
|
styles?: string[],
|
|
|
|
styleUrls?: string[],
|
2015-07-07 22:09:19 +02:00
|
|
|
}): ViewDecorator;
|
|
|
|
new (obj: {
|
|
|
|
templateUrl?: string,
|
|
|
|
template?: string,
|
2015-09-18 10:33:23 -07:00
|
|
|
directives?: Array<Type | any[]>,
|
|
|
|
pipes?: Array<Type | any[]>,
|
2015-07-24 15:28:44 -07:00
|
|
|
encapsulation?: ViewEncapsulation,
|
2015-08-28 11:29:19 -07:00
|
|
|
styles?: string[],
|
|
|
|
styleUrls?: string[],
|
2015-08-14 10:03:45 -07:00
|
|
|
}): ViewMetadata;
|
2015-06-12 23:51:42 -07:00
|
|
|
}
|
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link AttributeMetadata} factory for creating annotations, decorators or DSL.
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* ## Example as TypeScript Decorator
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* import {Attribute, Component, View} from "angular2/angular2";
|
|
|
|
*
|
|
|
|
* @Component({...})
|
|
|
|
* @View({...})
|
|
|
|
* class MyComponent {
|
|
|
|
* constructor(@Attribute('title') title: string) {
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* ## Example as ES5 DSL
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyComponent = ng
|
|
|
|
* .Component({...})
|
|
|
|
* .View({...})
|
|
|
|
* .Class({
|
|
|
|
* constructor: [new ng.Attribute('title'), function(title) {
|
|
|
|
* ...
|
|
|
|
* }]
|
|
|
|
* })
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* ## Example as ES5 annotation
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyComponent = function(title) {
|
|
|
|
* ...
|
|
|
|
* };
|
|
|
|
*
|
|
|
|
* MyComponent.annotations = [
|
2015-08-19 11:42:59 +02:00
|
|
|
* new ng.Component({...}),
|
2015-07-07 08:15:58 +02:00
|
|
|
* new ng.View({...})
|
|
|
|
* ]
|
|
|
|
* MyComponent.parameters = [
|
|
|
|
* [new ng.Attribute('title')]
|
|
|
|
* ]
|
|
|
|
* ```
|
|
|
|
*/
|
2015-07-02 22:26:07 +02:00
|
|
|
export interface AttributeFactory {
|
|
|
|
(name: string): TypeDecorator;
|
2015-08-14 10:03:45 -07:00
|
|
|
new (name: string): AttributeMetadata;
|
2015-07-02 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link QueryMetadata} factory for creating annotations, decorators or DSL.
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
2015-09-17 22:33:51 -07:00
|
|
|
* ### Example as TypeScript Decorator
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* import {Query, QueryList, Component, View} from "angular2/angular2";
|
|
|
|
*
|
|
|
|
* @Component({...})
|
|
|
|
* @View({...})
|
|
|
|
* class MyComponent {
|
2015-09-17 22:33:51 -07:00
|
|
|
* constructor(@Query(SomeType) queryList: QueryList<SomeType>) {
|
2015-07-07 08:15:58 +02:00
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
2015-09-17 22:33:51 -07:00
|
|
|
* ### Example as ES5 DSL
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyComponent = ng
|
|
|
|
* .Component({...})
|
|
|
|
* .View({...})
|
|
|
|
* .Class({
|
|
|
|
* constructor: [new ng.Query(SomeType), function(queryList) {
|
|
|
|
* ...
|
|
|
|
* }]
|
|
|
|
* })
|
|
|
|
* ```
|
|
|
|
*
|
2015-09-17 22:33:51 -07:00
|
|
|
* ### Example as ES5 annotation
|
2015-07-07 08:15:58 +02:00
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* var MyComponent = function(queryList) {
|
|
|
|
* ...
|
|
|
|
* };
|
|
|
|
*
|
|
|
|
* MyComponent.annotations = [
|
2015-08-19 11:42:59 +02:00
|
|
|
* new ng.Component({...}),
|
2015-07-07 08:15:58 +02:00
|
|
|
* new ng.View({...})
|
|
|
|
* ]
|
|
|
|
* MyComponent.parameters = [
|
|
|
|
* [new ng.Query(SomeType)]
|
|
|
|
* ]
|
|
|
|
* ```
|
|
|
|
*/
|
2015-07-02 22:26:07 +02:00
|
|
|
export interface QueryFactory {
|
|
|
|
(selector: Type | string, {descendants}?: {descendants?: boolean}): ParameterDecorator;
|
2015-08-14 10:03:45 -07:00
|
|
|
new (selector: Type | string, {descendants}?: {descendants?: boolean}): QueryMetadata;
|
2015-07-02 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
2015-09-17 18:45:14 -07:00
|
|
|
export interface ContentChildrenFactory {
|
|
|
|
(selector: Type | string, {descendants}?: {descendants?: boolean}): any;
|
|
|
|
new (selector: Type | string, {descendants}?: {descendants?: boolean}): ContentChildrenMetadata;
|
|
|
|
}
|
|
|
|
|
2015-09-19 18:39:35 -07:00
|
|
|
export interface ContentChildFactory {
|
|
|
|
(selector: Type | string): any;
|
|
|
|
new (selector: Type | string): ContentChildFactory;
|
|
|
|
}
|
|
|
|
|
2015-09-17 18:45:14 -07:00
|
|
|
export interface ViewChildrenFactory {
|
|
|
|
(selector: Type | string): any;
|
|
|
|
new (selector: Type | string): ViewChildrenMetadata;
|
|
|
|
}
|
|
|
|
|
2015-09-19 18:39:35 -07:00
|
|
|
export interface ViewChildFactory {
|
|
|
|
(selector: Type | string): any;
|
|
|
|
new (selector: Type | string): ViewChildFactory;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-07 11:41:38 -07:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link PipeMetadata} factory for creating decorators.
|
2015-08-07 11:41:38 -07:00
|
|
|
*
|
|
|
|
* ## Example as TypeScript Decorator
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* import {Pipe} from "angular2/angular2";
|
|
|
|
*
|
|
|
|
* @Pipe({...})
|
|
|
|
* class MyPipe {
|
|
|
|
* constructor() {
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* transform(v, args) {}
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
export interface PipeFactory {
|
2015-09-08 09:17:58 -07:00
|
|
|
(obj: {name: string, pure?: boolean}): any;
|
|
|
|
new (obj: {name: string, pure?: boolean}): any;
|
2015-08-07 11:41:38 -07:00
|
|
|
}
|
2015-05-04 11:11:22 -07:00
|
|
|
|
2015-09-03 15:10:48 -07:00
|
|
|
/**
|
2015-09-30 20:59:23 -07:00
|
|
|
* {@link InputMetadata} factory for creating decorators.
|
2015-09-03 15:10:48 -07:00
|
|
|
*
|
2015-09-30 20:59:23 -07:00
|
|
|
* See {@link InputMetadata}.
|
2015-09-03 15:10:48 -07:00
|
|
|
*/
|
2015-09-30 20:59:23 -07:00
|
|
|
export interface InputFactory {
|
2015-09-03 15:10:48 -07:00
|
|
|
(bindingPropertyName?: string): any;
|
|
|
|
new (bindingPropertyName?: string): any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-09-30 20:59:23 -07:00
|
|
|
* {@link OutputMetadata} factory for creating decorators.
|
2015-09-03 15:10:48 -07:00
|
|
|
*
|
2015-09-30 20:59:23 -07:00
|
|
|
* See {@link OutputMetadata}.
|
2015-09-03 15:10:48 -07:00
|
|
|
*/
|
2015-09-30 20:59:23 -07:00
|
|
|
export interface OutputFactory {
|
2015-09-03 15:10:48 -07:00
|
|
|
(bindingPropertyName?: string): any;
|
|
|
|
new (bindingPropertyName?: string): any;
|
|
|
|
}
|
|
|
|
|
2015-09-04 14:07:16 -07:00
|
|
|
/**
|
2015-10-01 15:47:51 -07:00
|
|
|
* {@link HostBindingMetadata} factory function.
|
2015-09-04 14:07:16 -07:00
|
|
|
*/
|
|
|
|
export interface HostBindingFactory {
|
|
|
|
(hostPropertyName?: string): any;
|
|
|
|
new (hostPropertyName?: string): any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-10-01 15:47:51 -07:00
|
|
|
* {@link HostListenerMetadata} factory function.
|
2015-09-04 14:07:16 -07:00
|
|
|
*/
|
|
|
|
export interface HostListenerFactory {
|
|
|
|
(eventName: string, args?: string[]): any;
|
|
|
|
new (eventName: string, args?: string[]): any;
|
|
|
|
}
|
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link ComponentMetadata} factory function.
|
2015-07-07 08:15:58 +02:00
|
|
|
*/
|
2015-07-02 22:26:07 +02:00
|
|
|
export var Component: ComponentFactory =
|
2015-08-14 10:03:45 -07:00
|
|
|
<ComponentFactory>makeDecorator(ComponentMetadata, (fn: any) => fn.View = View);
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link DirectiveMetadata} factory function.
|
2015-07-07 08:15:58 +02:00
|
|
|
*/
|
2015-08-14 10:03:45 -07:00
|
|
|
export var Directive: DirectiveFactory = <DirectiveFactory>makeDecorator(DirectiveMetadata);
|
2015-05-04 11:11:22 -07:00
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link ViewMetadata} factory function.
|
2015-07-07 08:15:58 +02:00
|
|
|
*/
|
2015-07-02 22:26:07 +02:00
|
|
|
export var View: ViewFactory =
|
2015-08-14 10:03:45 -07:00
|
|
|
<ViewFactory>makeDecorator(ViewMetadata, (fn: any) => fn.View = View);
|
2015-05-04 11:11:22 -07:00
|
|
|
|
2015-07-07 08:15:58 +02:00
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link AttributeMetadata} factory function.
|
2015-07-07 08:15:58 +02:00
|
|
|
*/
|
2015-08-14 10:03:45 -07:00
|
|
|
export var Attribute: AttributeFactory = makeParamDecorator(AttributeMetadata);
|
2015-07-07 08:15:58 +02:00
|
|
|
|
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link QueryMetadata} factory function.
|
2015-07-07 08:15:58 +02:00
|
|
|
*/
|
2015-08-14 10:03:45 -07:00
|
|
|
export var Query: QueryFactory = makeParamDecorator(QueryMetadata);
|
2015-07-10 10:30:31 -07:00
|
|
|
|
2015-09-17 18:45:14 -07:00
|
|
|
/**
|
|
|
|
* {@link ContentChildrenMetadata} factory function.
|
|
|
|
*/
|
|
|
|
export var ContentChildren: ContentChildrenFactory = makePropDecorator(ContentChildrenMetadata);
|
|
|
|
|
2015-09-19 18:39:35 -07:00
|
|
|
/**
|
|
|
|
* {@link ContentChildMetadata} factory function.
|
|
|
|
*/
|
|
|
|
export var ContentChild: ContentChildFactory = makePropDecorator(ContentChildMetadata);
|
|
|
|
|
2015-09-17 18:45:14 -07:00
|
|
|
/**
|
|
|
|
* {@link ViewChildrenMetadata} factory function.
|
|
|
|
*/
|
|
|
|
export var ViewChildren: ViewChildrenFactory = makePropDecorator(ViewChildrenMetadata);
|
2015-07-10 10:30:31 -07:00
|
|
|
|
|
|
|
/**
|
2015-09-19 18:39:35 -07:00
|
|
|
* {@link ViewChildMetadata} factory function.
|
|
|
|
*/
|
|
|
|
export var ViewChild: ViewChildFactory = makePropDecorator(ViewChildMetadata);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@link di/ViewQueryMetadata} factory function.
|
2015-07-10 10:30:31 -07:00
|
|
|
*/
|
2015-08-14 10:03:45 -07:00
|
|
|
export var ViewQuery: QueryFactory = makeParamDecorator(ViewQueryMetadata);
|
2015-08-07 11:41:38 -07:00
|
|
|
|
|
|
|
/**
|
2015-08-14 10:03:45 -07:00
|
|
|
* {@link PipeMetadata} factory function.
|
2015-08-07 11:41:38 -07:00
|
|
|
*/
|
2015-08-14 10:03:45 -07:00
|
|
|
export var Pipe: PipeFactory = <PipeFactory>makeDecorator(PipeMetadata);
|
2015-09-03 15:10:48 -07:00
|
|
|
|
|
|
|
/**
|
2015-09-30 20:59:23 -07:00
|
|
|
* {@link InputMetadata} factory function.
|
2015-09-24 13:46:13 -07:00
|
|
|
*
|
2015-09-30 20:59:23 -07:00
|
|
|
* See {@link InputMetadata}.
|
2015-09-03 15:10:48 -07:00
|
|
|
*/
|
2015-09-30 20:59:23 -07:00
|
|
|
export var Input: InputFactory = makePropDecorator(InputMetadata);
|
2015-09-03 15:10:48 -07:00
|
|
|
|
|
|
|
/**
|
2015-09-30 20:59:23 -07:00
|
|
|
* {@link OutputMetadata} factory function.
|
2015-09-24 13:46:13 -07:00
|
|
|
*
|
2015-09-30 20:59:23 -07:00
|
|
|
* See {@link OutputMetadatas}.
|
2015-09-03 15:10:48 -07:00
|
|
|
*/
|
2015-09-30 20:59:23 -07:00
|
|
|
export var Output: OutputFactory = makePropDecorator(OutputMetadata);
|
2015-09-04 14:07:16 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* {@link HostBindingMetadata} factory function.
|
|
|
|
*/
|
|
|
|
export var HostBinding: HostBindingFactory = makePropDecorator(HostBindingMetadata);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@link HostListenerMetadata} factory function.
|
|
|
|
*/
|
2015-08-31 18:32:32 -07:00
|
|
|
export var HostListener: HostListenerFactory = makePropDecorator(HostListenerMetadata);
|