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 { export {
ComponentAnnotation, ComponentAnnotation,
ComponentArgs,
DirectiveAnnotation, DirectiveAnnotation,
LifecycleEvent, LifecycleEvent,
onDestroy, onDestroy,
@ -23,7 +22,7 @@ export {
onAllChangesDone onAllChangesDone
} from './src/core/annotations/annotations'; } 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 {QueryAnnotation, AttributeAnnotation} from 'angular2/src/core/annotations/di';
export { export {

View File

@ -1,10 +1,5 @@
import { import {ComponentAnnotation, DirectiveAnnotation, LifecycleEvent} from './annotations';
ComponentAnnotation, import {ViewAnnotation} from './view';
DirectiveAnnotation,
ComponentArgs,
DirectiveArgs
} from './annotations';
import {ViewAnnotation, ViewArgs} from './view';
import {AttributeAnnotation, QueryAnnotation} from './di'; import {AttributeAnnotation, QueryAnnotation} from './di';
import { import {
makeDecorator, makeDecorator,
@ -31,7 +26,14 @@ export interface ComponentDecorator extends TypeDecorator {
/** /**
* Chain {@link View} annotation. * 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. * 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 { export interface DirectiveFactory {
(obj: DirectiveArgs): DirectiveDecorator; (obj: {
new (obj: DirectiveAnnotation): DirectiveAnnotation; 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 { export interface ComponentFactory {
(obj: ComponentArgs): ComponentDecorator; (obj: {
new (obj: ComponentAnnotation): ComponentAnnotation; 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 { export interface ViewFactory {
(obj: ViewArgs): ViewDecorator; (obj: {
new (obj: ViewArgs): ViewAnnotation; 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() @CONST()
export class Directive extends Injectable { 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. * 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. * 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. * Enumerates the set of properties that accept data binding for a directive.
@ -562,7 +535,7 @@ export interface DirectiveArgs {
* keyValDiff`. * keyValDiff`.
* *
*/ */
properties?: List<string>; properties: List<string>;
/** /**
* Enumerates the set of emitted events. * 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. * 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. * 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. * Specifies which lifecycle should be notified to the directive.
* *
* See {@link LifecycleEvent} for details. * 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 * 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. * 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;
/** constructor({
* If set to false the compiler does not compile the children of this directive. selector, properties, events, host, lifecycle, hostInjector, exportAs,
*/ compileChildren = true,
compileChildren?: boolean; }: {
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. * Declare reusable UI building blocks for an application.
* *
@ -849,28 +846,19 @@ export interface DirectiveArgs {
*/ */
@CONST() @CONST()
export class Component extends Directive { 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; 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. * 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>;
/** constructor({selector, properties, events, host, exportAs, lifecycle, hostInjector, viewInjector,
* Defines the used change detection strategy. changeDetection = DEFAULT, compileChildren = true}: {
* selector?: string,
* When a component is instantiated, Angular creates a change detector, which is responsible for properties?: List<string>,
* propagating events?: List<string>,
* the component's bindings. host?: StringMap<string, string>,
* lifecycle?: List<LifecycleEvent>,
* The `changeDetection` property defines, whether the change detection will be checked every time hostInjector?: List<any>,
* or only when the component exportAs?: string,
* tells it to do so. compileChildren?: boolean,
*/ viewInjector?: List<any>,
changeDetection?: string; 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() @CONST()
export class View { 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. * Specifies an inline template for an angular component.
* *
* NOTE: either `templateUrl` or `template` should be used, but not both. * 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. * 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. * Specify a custom renderer for this View.
* If this is set, neither `template`, `templateUrl`, `styles`, `styleUrls` nor `directives` are * If this is set, neither `template`, `templateUrl`, `styles`, `styleUrls` nor `directives` are
* used. * used.
*/ */
renderer?: string; renderer: string;
/** constructor({templateUrl, template, directives, renderer, styles, styleUrls}: {
* Specifies an inline stylesheet for an angular component. templateUrl?: string,
*/ template?: string,
styles?: List<string>; directives?: List<Type | any | List<any>>,
renderer?: string,
/** styles?: List<string>,
* Specifies stylesheet URLs for an angular component. styleUrls?: List<string>,
*/ } = {}) {
styleUrls?: List<string>; this.templateUrl = templateUrl;
this.template = template;
this.styleUrls = styleUrls;
this.styles = styles;
this.directives = directives;
this.renderer = renderer;
}
} }