chore(.d.ts): remove *Args files

This commit is contained in:
Misko Hevery 2015-07-07 22:09:19 +02:00 committed by Alex Eagle
parent 3ab8a0c438
commit c33e3be735
5 changed files with 183 additions and 129 deletions

View File

@ -13,7 +13,6 @@
export {
ComponentAnnotation,
ComponentArgs,
DirectiveAnnotation,
LifecycleEvent,
onDestroy,
@ -23,7 +22,7 @@ export {
onAllChangesDone
} from './src/core/annotations/annotations';
export {ViewAnnotation, ViewArgs} from 'angular2/src/core/annotations/view';
export {ViewAnnotation} from 'angular2/src/core/annotations/view';
export {QueryAnnotation, AttributeAnnotation} from 'angular2/src/core/annotations/di';
export {

View File

@ -1,10 +1,5 @@
import {
ComponentAnnotation,
DirectiveAnnotation,
ComponentArgs,
DirectiveArgs
} from './annotations';
import {ViewAnnotation, ViewArgs} from './view';
import {ComponentAnnotation, DirectiveAnnotation, LifecycleEvent} from './annotations';
import {ViewAnnotation} from './view';
import {AttributeAnnotation, QueryAnnotation} from './di';
import {
makeDecorator,
@ -31,7 +26,14 @@ export interface ComponentDecorator extends TypeDecorator {
/**
* Chain {@link View} annotation.
*/
View(obj: ViewArgs): ViewDecorator;
View(obj: {
templateUrl?: string,
template?: string,
directives?: List<Type | any | List<any>>,
renderer?: string,
styles?: List<string>,
styleUrls?: List<string>,
}): ViewDecorator;
}
/**
@ -43,7 +45,14 @@ export interface ViewDecorator extends TypeDecorator {
/**
* Chain {@link View} annotation.
*/
View(obj: ViewArgs): ViewDecorator
View(obj: {
templateUrl?: string,
template?: string,
directives?: List<Type | any | List<any>>,
renderer?: string,
styles?: List<string>,
styleUrls?: List<string>,
}): ViewDecorator
}
/**
@ -87,8 +96,16 @@ export interface ViewDecorator extends TypeDecorator {
* ```
*/
export interface DirectiveFactory {
(obj: DirectiveArgs): DirectiveDecorator;
new (obj: DirectiveAnnotation): DirectiveAnnotation;
(obj: {
selector?: string, properties?: List<string>, events?: List<string>,
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>, exportAs?: string, compileChildren?: boolean;
}): DirectiveDecorator;
new (obj: {
selector?: string, properties?: List<string>, events?: List<string>,
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>, exportAs?: string, compileChildren?: boolean;
}): DirectiveAnnotation;
}
/**
@ -135,8 +152,30 @@ export interface DirectiveFactory {
* ```
*/
export interface ComponentFactory {
(obj: ComponentArgs): ComponentDecorator;
new (obj: ComponentAnnotation): ComponentAnnotation;
(obj: {
selector?: string,
properties?: List<string>,
events?: List<string>,
host?: StringMap<string, string>,
lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>,
exportAs?: string,
compileChildren?: boolean,
viewInjector?: List<any>,
changeDetection?: string,
}): ComponentDecorator;
new (obj: {
selector?: string,
properties?: List<string>,
events?: List<string>,
host?: StringMap<string, string>,
lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>,
exportAs?: string,
compileChildren?: boolean,
viewInjector?: List<any>,
changeDetection?: string,
}): ComponentAnnotation;
}
/**
@ -183,8 +222,22 @@ export interface ComponentFactory {
* ```
*/
export interface ViewFactory {
(obj: ViewArgs): ViewDecorator;
new (obj: ViewArgs): ViewAnnotation;
(obj: {
templateUrl?: string,
template?: string,
directives?: List<Type | any | List<any>>,
renderer?: string,
styles?: List<string>,
styleUrls?: List<string>,
}): ViewDecorator;
new (obj: {
templateUrl?: string,
template?: string,
directives?: List<Type | any | List<any>>,
renderer?: string,
styles?: List<string>,
styleUrls?: List<string>,
}): ViewAnnotation;
}
/**

View File

@ -1 +1 @@
export {View as ViewAnnotation, ViewArgs} from '../annotations_impl/view';
export {View as ViewAnnotation} from '../annotations_impl/view';

View File

@ -408,33 +408,6 @@ import {DEFAULT} from 'angular2/change_detection';
*/
@CONST()
export class Directive extends Injectable {
selector: string;
properties: List<string>;
events: List<string>;
host: StringMap<string, string>;
lifecycle: List<LifecycleEvent>;
// TODO(vsavkin): This would better fall under the Macro directive concept.
compileChildren: boolean;
hostInjector: List<any>;
exportAs: string;
constructor({
selector, properties, events, host, lifecycle, hostInjector, exportAs,
compileChildren = true,
}: DirectiveArgs = {}) {
super(self);
this.selector = selector;
this.properties = properties;
this.events = events;
this.host = host;
this.exportAs = exportAs;
this.lifecycle = lifecycle;
this.compileChildren = compileChildren;
this.hostInjector = hostInjector;
}
}
export interface DirectiveArgs {
/**
* The CSS selector that triggers the instantiation of a directive.
*
@ -467,7 +440,7 @@ export interface DirectiveArgs {
* The directive would only be instantiated on the `<input type="text">` element.
*
*/
selector?: string;
selector: string;
/**
* Enumerates the set of properties that accept data binding for a directive.
@ -562,7 +535,7 @@ export interface DirectiveArgs {
* keyValDiff`.
*
*/
properties?: List<string>;
properties: List<string>;
/**
* Enumerates the set of emitted events.
@ -607,7 +580,7 @@ export interface DirectiveArgs {
* ```
*
*/
events?: List<string>;
events: List<string>;
/**
* Specifiy the events, actions, properties and attributes related to the host element.
@ -734,14 +707,20 @@ export interface DirectiveArgs {
*
* In this example calling focus on InputDirective will result in calling focus on the input.
*/
host?: StringMap<string, string>;
host: StringMap<string, string>;
/**
* Specifies which lifecycle should be notified to the directive.
*
* See {@link LifecycleEvent} for details.
*/
lifecycle?: List<LifecycleEvent>;
lifecycle: List<LifecycleEvent>;
/**
* If set to false the compiler does not compile the children of this directive.
*/
// TODO(vsavkin): This would better fall under the Macro directive concept.
compileChildren: boolean;
/**
* Defines the set of injectable objects that are visible to a Directive and its light dom
@ -773,7 +752,7 @@ export interface DirectiveArgs {
* }
* ```
*/
hostInjector?: List<any>;
hostInjector: List<any>;
/**
* Defines the name that can be used in the template to assign this directive to a variable.
@ -800,15 +779,33 @@ export interface DirectiveArgs {
*
* ```
*/
exportAs?: string;
exportAs: string;
/**
* If set to false the compiler does not compile the children of this directive.
*/
compileChildren?: boolean;
constructor({
selector, properties, events, host, lifecycle, hostInjector, exportAs,
compileChildren = true,
}: {
selector?: string,
properties?: List<string>,
events?: List<string>,
host?: StringMap<string, string>,
lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>,
exportAs?: string,
compileChildren?: boolean,
} = {}) {
super(self);
this.selector = selector;
this.properties = properties;
this.events = events;
this.host = host;
this.exportAs = exportAs;
this.lifecycle = lifecycle;
this.compileChildren = compileChildren;
this.hostInjector = hostInjector;
}
}
/**
* Declare reusable UI building blocks for an application.
*
@ -849,28 +846,19 @@ export interface DirectiveArgs {
*/
@CONST()
export class Component extends Directive {
/**
* Defines the used change detection strategy.
*
* When a component is instantiated, Angular creates a change detector, which is responsible for
* propagating
* the component's bindings.
*
* The `changeDetection` property defines, whether the change detection will be checked every time
* or only when the component
* tells it to do so.
*/
changeDetection: string;
viewInjector: List<any>;
constructor({selector, properties, events, host, exportAs, lifecycle, hostInjector, viewInjector,
changeDetection = DEFAULT, compileChildren = true}: ComponentArgs = {}) {
super({
selector: selector,
properties: properties,
events: events,
host: host,
exportAs: exportAs,
hostInjector: hostInjector,
lifecycle: lifecycle,
compileChildren: compileChildren
});
this.changeDetection = changeDetection;
this.viewInjector = viewInjector;
}
}
export interface ComponentArgs extends DirectiveArgs {
/**
* Defines the set of injectable objects that are visible to its view dom children.
*
@ -911,20 +899,35 @@ export interface ComponentArgs extends DirectiveArgs {
*
* ```
*/
viewInjector?: List<any>;
viewInjector: List<any>;
/**
* Defines the used change detection strategy.
*
* When a component is instantiated, Angular creates a change detector, which is responsible for
* propagating
* the component's bindings.
*
* The `changeDetection` property defines, whether the change detection will be checked every time
* or only when the component
* tells it to do so.
*/
changeDetection?: string;
constructor({selector, properties, events, host, exportAs, lifecycle, hostInjector, viewInjector,
changeDetection = DEFAULT, compileChildren = true}: {
selector?: string,
properties?: List<string>,
events?: List<string>,
host?: StringMap<string, string>,
lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>,
exportAs?: string,
compileChildren?: boolean,
viewInjector?: List<any>,
changeDetection?: string,
} = {}) {
super({
selector: selector,
properties: properties,
events: events,
host: host,
exportAs: exportAs,
hostInjector: hostInjector,
lifecycle: lifecycle,
compileChildren: compileChildren
});
this.changeDetection = changeDetection;
this.viewInjector = viewInjector;
}
}
/**

View File

@ -35,39 +35,29 @@ import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
*/
@CONST()
export class View {
templateUrl: string;
template: string;
styleUrls: List<string>;
styles: List<string>;
// TODO(tbosch): use Type | Binding | List<any> when Dart supports union types,
// as otherwise we would need to import Binding type and Dart would warn
// for an unused import.
directives: List<Type | any | List<any>>;
renderer: string;
constructor({templateUrl, template, directives, renderer, styles, styleUrls}: ViewArgs = {}) {
this.templateUrl = templateUrl;
this.template = template;
this.styleUrls = styleUrls;
this.styles = styles;
this.directives = directives;
this.renderer = renderer;
}
}
export interface ViewArgs {
/**
* Specifies a template URL for an angular component.
*
* NOTE: either `templateUrl` or `template` should be used, but not both.
*/
templateUrl?: string;
/**
* Specifies an inline template for an angular component.
*
* NOTE: either `templateUrl` or `template` should be used, but not both.
*/
template?: string;
templateUrl: string;
/**
* Specifies a template URL for an angular component.
*
* NOTE: either `templateUrl` or `template` should be used, but not both.
*/
template: string;
/**
* Specifies stylesheet URLs for an angular component.
*/
styleUrls: List<string>;
/**
* Specifies an inline stylesheet for an angular component.
*/
styles: List<string>;
/**
* Specifies a list of directives that can be used within a template.
@ -91,22 +81,31 @@ export interface ViewArgs {
* }
* ```
*/
directives?: List<Type | any | List<any>>;
// TODO(tbosch): use Type | Binding | List<any> when Dart supports union types,
// as otherwise we would need to import Binding type and Dart would warn
// for an unused import.
directives: List<Type | any | List<any>>;
/**
* Specify a custom renderer for this View.
* If this is set, neither `template`, `templateUrl`, `styles`, `styleUrls` nor `directives` are
* used.
*/
renderer?: string;
renderer: string;
/**
* Specifies an inline stylesheet for an angular component.
*/
styles?: List<string>;
/**
* Specifies stylesheet URLs for an angular component.
*/
styleUrls?: List<string>;
constructor({templateUrl, template, directives, renderer, styles, styleUrls}: {
templateUrl?: string,
template?: string,
directives?: List<Type | any | List<any>>,
renderer?: string,
styles?: List<string>,
styleUrls?: List<string>,
} = {}) {
this.templateUrl = templateUrl;
this.template = template;
this.styleUrls = styleUrls;
this.styles = styles;
this.directives = directives;
this.renderer = renderer;
}
}