docs: create public API surface

Closes #1181
This commit is contained in:
Misko Hevery 2015-03-31 22:47:11 +00:00
parent c1aa65239e
commit 86dc3e5b07
23 changed files with 115 additions and 10 deletions

View File

@ -39,6 +39,10 @@ export var defaultPipes = {
] ]
}; };
/**
* @publicModule angular2/change_detection
*/
export class DynamicChangeDetection extends ChangeDetection { export class DynamicChangeDetection extends ChangeDetection {
registry:PipeRegistry; registry:PipeRegistry;
@ -52,6 +56,9 @@ export class DynamicChangeDetection extends ChangeDetection {
} }
} }
/**
* @publicModule angular2/change_detection
*/
export class JitChangeDetection extends ChangeDetection { export class JitChangeDetection extends ChangeDetection {
registry:PipeRegistry; registry:PipeRegistry;

3
modules/angular2/pipes.js vendored Normal file
View File

@ -0,0 +1,3 @@
/**
* Define public API for Angular here.
*/

View File

@ -2,7 +2,7 @@ import {ChangeDetector} from './interfaces';
import {CHECK_ONCE, DETACHED, CHECK_ALWAYS} from './constants'; import {CHECK_ONCE, DETACHED, CHECK_ALWAYS} from './constants';
/** /**
* @publicModule angular2/angular2 * @publicModule angular2/change_detection
*/ */
export class BindingPropagationConfig { export class BindingPropagationConfig {
_cd:ChangeDetector; _cd:ChangeDetector;

View File

@ -26,6 +26,9 @@ export class IterableChangesFactory {
} }
} }
/**
* @publicModule angular2/pipes
*/
export class IterableChanges extends Pipe { export class IterableChanges extends Pipe {
_collection; _collection;
_length:int; _length:int;
@ -501,6 +504,9 @@ export class IterableChanges extends Pipe {
} }
} }
/**
* @publicModule angular2/pipes
*/
export class CollectionChangeRecord { export class CollectionChangeRecord {
currentIndex:int; currentIndex:int;
previousIndex:int; previousIndex:int;

View File

@ -3,6 +3,9 @@ import {stringify, looseIdentical, isJsObject} from 'angular2/src/facade/lang';
import {NO_CHANGE, Pipe} from './pipe'; import {NO_CHANGE, Pipe} from './pipe';
/**
* @publicModule angular2/pipes
*/
export class KeyValueChangesFactory { export class KeyValueChangesFactory {
supports(obj):boolean { supports(obj):boolean {
return KeyValueChanges.supportsObj(obj); return KeyValueChanges.supportsObj(obj);
@ -13,6 +16,9 @@ export class KeyValueChangesFactory {
} }
} }
/**
* @publicModule angular2/pipes
*/
export class KeyValueChanges extends Pipe { export class KeyValueChanges extends Pipe {
_records:Map; _records:Map;
@ -349,6 +355,9 @@ export class KeyValueChanges extends Pipe {
/**
* @publicModule angular2/pipes
*/
export class KVChangeRecord { export class KVChangeRecord {
key; key;
previousValue; previousValue;

View File

@ -1,6 +1,9 @@
import {isBlank} from 'angular2/src/facade/lang'; import {isBlank} from 'angular2/src/facade/lang';
import {Pipe, NO_CHANGE} from './pipe'; import {Pipe, NO_CHANGE} from './pipe';
/**
* @publicModule angular2/pipes
*/
export class NullPipeFactory { export class NullPipeFactory {
supports(obj):boolean { supports(obj):boolean {
return NullPipe.supportsObj(obj); return NullPipe.supportsObj(obj);
@ -11,6 +14,9 @@ export class NullPipeFactory {
} }
} }
/**
* @publicModule angular2/pipes
*/
export class NullPipe extends Pipe { export class NullPipe extends Pipe {
called:boolean; called:boolean;
constructor() { constructor() {

View File

@ -1,5 +1,8 @@
export var NO_CHANGE = new Object(); export var NO_CHANGE = new Object();
/**
* @publicModule angular2/angular2
*/
export class Pipe { export class Pipe {
supports(obj):boolean {return false;} supports(obj):boolean {return false;}
onDestroy() {} onDestroy() {}

View File

@ -22,7 +22,6 @@ import {CssProcessor} from './css_processor';
/** /**
* Cache that stores the ProtoView of the template of a component. * Cache that stores the ProtoView of the template of a component.
* Used to prevent duplicate work and resolve cyclic dependencies. * Used to prevent duplicate work and resolve cyclic dependencies.
* @publicModule angular2/angular2
*/ */
@Injectable() @Injectable()
export class CompilerCache { export class CompilerCache {
@ -49,7 +48,8 @@ export class CompilerCache {
* The compiler loads and translates the html templates of components into * The compiler loads and translates the html templates of components into
* nested ProtoViews. To decompose its functionality it uses * nested ProtoViews. To decompose its functionality it uses
* the CompilePipeline and the CompileSteps. * the CompilePipeline and the CompileSteps.
* @publicModule angular2/angular2 *
* @publicModule angular2/template
*/ */
@Injectable() @Injectable()
export class Compiler { export class Compiler {
@ -90,6 +90,7 @@ export class Compiler {
this._cssProcessor = cssProcessor; this._cssProcessor = cssProcessor;
} }
// todo(misko): should be private method
createSteps(component:Type, template: Template):List<CompileStep> { createSteps(component:Type, template: Template):List<CompileStep> {
var dirMetadata = ListWrapper.map(this._flattenDirectives(template), var dirMetadata = ListWrapper.map(this._flattenDirectives(template),
(d) => this._reader.read(d)); (d) => this._reader.read(d));

View File

@ -30,6 +30,9 @@ function _emptyStep() {
return _EMPTY_STEP; return _EMPTY_STEP;
} }
/**
* @publicModule angular2/template
*/
export class ShadowDomStrategy { export class ShadowDomStrategy {
attachTemplate(el, view:viewModule.View) {} attachTemplate(el, view:viewModule.View) {}
constructLightDom(lightDomView:viewModule.View, shadowDomView:viewModule.View, el): LightDom { return null; } constructLightDom(lightDomView:viewModule.View, shadowDomView:viewModule.View, el): LightDom { return null; }
@ -77,6 +80,8 @@ export class ShadowDomStrategy {
* Notes: * Notes:
* - styles are **not** scoped to their component and will apply to the whole document, * - styles are **not** scoped to their component and will apply to the whole document,
* - you can **not** use shadow DOM specific selectors in the styles * - you can **not** use shadow DOM specific selectors in the styles
*
* @publicModule angular2/template
*/ */
@Injectable() @Injectable()
export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy { export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
@ -119,6 +124,8 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
* - styles are scoped to their component and will apply only to it, * - styles are scoped to their component and will apply only to it,
* - a common subset of shadow DOM selectors are supported, * - a common subset of shadow DOM selectors are supported,
* - see `ShadowCss` for more information and limitations. * - see `ShadowCss` for more information and limitations.
*
* @publicModule angular2/template
*/ */
@Injectable() @Injectable()
export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomStrategy { export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomStrategy {

View File

@ -11,7 +11,7 @@ import {UrlResolver} from 'angular2/src/services/url_resolver';
/** /**
* Strategy to load component templates. * Strategy to load component templates.
* @publicModule angular2/angular2 * @publicModule angular2/template
*/ */
@Injectable() @Injectable()
export class TemplateLoader { export class TemplateLoader {

View File

@ -27,7 +27,8 @@ var VIEW_POOL_PREFILL = 0;
/** /**
* Const of making objects: http://jsperf.com/instantiate-size-of-object * Const of making objects: http://jsperf.com/instantiate-size-of-object
* @publicModule angular2/angular2 *
* @publicModule angular2/template
*/ */
@IMPLEMENTS(ChangeDispatcher) @IMPLEMENTS(ChangeDispatcher)
export class View { export class View {
@ -284,7 +285,8 @@ export class View {
} }
/** /**
* @publicModule angular2/angular2 *
* @publicModule angular2/template
*/ */
export class ProtoView { export class ProtoView {
element; element;
@ -692,7 +694,6 @@ export class ProtoView {
} }
/** /**
* @publicModule angular2/angular2
*/ */
export class ElementBindingMemento { export class ElementBindingMemento {
_elementIndex:int; _elementIndex:int;
@ -711,7 +712,6 @@ export class ElementBindingMemento {
} }
/** /**
* @publicModule angular2/angular2
*/ */
export class DirectiveBindingMemento { export class DirectiveBindingMemento {
_elementInjectorIndex:int; _elementInjectorIndex:int;
@ -757,7 +757,6 @@ class DirectiveMemento {
} }
/** /**
* @publicModule angular2/angular2
*/ */
export class PropertyUpdate { export class PropertyUpdate {
currentValue; currentValue;

View File

@ -9,7 +9,7 @@ import {EventManager} from 'angular2/src/render/dom/events/event_manager';
import {LightDom} from './shadow_dom_emulation/light_dom'; import {LightDom} from './shadow_dom_emulation/light_dom';
/** /**
* @publicModule angular2/angular2 * @publicModule angular2/template
*/ */
export class ViewContainer { export class ViewContainer {
parentView: viewModule.View; parentView: viewModule.View;

View File

@ -2,6 +2,9 @@ import {Injectable} from 'angular2/di';
import {isPresent, print} from 'angular2/src/facade/lang'; import {isPresent, print} from 'angular2/src/facade/lang';
import {ListWrapper, isListLikeIterable} from 'angular2/src/facade/collection'; import {ListWrapper, isListLikeIterable} from 'angular2/src/facade/collection';
/**
* @publicModule angular2/angular2
*/
@Injectable() @Injectable()
export class ExceptionHandler { export class ExceptionHandler {
call(error, stackTrace = null, reason = null) { call(error, stackTrace = null, reason = null) {

View File

@ -4,6 +4,9 @@ import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone';
import {ExceptionHandler} from 'angular2/src/core/exception_handler'; import {ExceptionHandler} from 'angular2/src/core/exception_handler';
import {isPresent} from 'angular2/src/facade/lang'; import {isPresent} from 'angular2/src/facade/lang';
/**
* @publicModule angular2/change_detection
*/
@Injectable() @Injectable()
export class LifeCycle { export class LifeCycle {
_errorHandler; _errorHandler;

View File

@ -4,6 +4,9 @@ import {View} from 'angular2/src/core/compiler/view';
import {isPresent, isBlank} from 'angular2/src/facade/lang'; import {isPresent, isBlank} from 'angular2/src/facade/lang';
import {ListWrapper} from 'angular2/src/facade/collection'; import {ListWrapper} from 'angular2/src/facade/collection';
/**
* @publicModule angular2/directives
*/
@Viewport({ @Viewport({
selector: '[for][of]', selector: '[for][of]',
bind: { bind: {

View File

@ -2,6 +2,9 @@ import {Viewport} from 'angular2/src/core/annotations/annotations';
import {ViewContainer} from 'angular2/src/core/compiler/view_container'; import {ViewContainer} from 'angular2/src/core/compiler/view_container';
import {isBlank} from 'angular2/src/facade/lang'; import {isBlank} from 'angular2/src/facade/lang';
/**
* @publicModule angular2/directives
*/
@Viewport({ @Viewport({
selector: '[if]', selector: '[if]',
bind: { bind: {

View File

@ -1,5 +1,8 @@
import {Decorator} from 'angular2/src/core/annotations/annotations'; import {Decorator} from 'angular2/src/core/annotations/annotations';
/**
* @publicModule angular2/directives
*/
@Decorator({ @Decorator({
selector: '[non-bindable]', selector: '[non-bindable]',
compileChildren: false compileChildren: false

View File

@ -29,6 +29,7 @@ import {Parent} from 'angular2/src/core/annotations/visibility';
* <template [switch-default]>...</template> * <template [switch-default]>...</template>
* </ANY> * </ANY>
* ``` * ```
* @publicModule angular2/directives
*/ */
@Decorator({ @Decorator({
selector: '[switch]', selector: '[switch]',
@ -140,6 +141,8 @@ export class Switch {
* // match against a constant string * // match against a constant string
* <template [switch-when]="'stringValue'">...</template> * <template [switch-when]="'stringValue'">...</template>
* ``` * ```
*
* @publicModule angular2/directives
*/ */
@Viewport({ @Viewport({
selector: '[switch-when]', selector: '[switch-when]',
@ -175,6 +178,8 @@ export class SwitchWhen {
* *
* ``` * ```
* <template [switch-default]>...</template> * <template [switch-default]>...</template>
*
* @publicModule angular2/directives
* ``` * ```
*/ */
@Viewport({ @Viewport({

View File

@ -10,6 +10,9 @@ import {Validators} from './validators';
// set onChange(fn){} // set onChange(fn){}
//} //}
/**
* @publicModule angular2/forms
*/
@Decorator({ @Decorator({
selector: '[control]', selector: '[control]',
events: { events: {
@ -31,6 +34,9 @@ export class DefaultValueAccessor {
} }
} }
/**
* @publicModule angular2/forms
*/
@Decorator({ @Decorator({
selector: 'input[type=checkbox][control]', selector: 'input[type=checkbox][control]',
events: { events: {
@ -52,6 +58,9 @@ export class CheckboxControlValueAccessor {
} }
} }
/**
* @publicModule angular2/forms
*/
@Decorator({ @Decorator({
lifecycle: [onChange], lifecycle: [onChange],
selector: '[control]', selector: '[control]',
@ -109,6 +118,9 @@ export class ControlDirective {
} }
} }
/**
* @publicModule angular2/forms
*/
@Decorator({ @Decorator({
selector: '[control-group]', selector: '[control-group]',
bind: { bind: {
@ -157,6 +169,10 @@ export class ControlGroupDirective {
} }
} }
/**
* @publicModule angular2/forms
*/
// todo(misko): rename to lover case as it is not a Type but a var.
export var FormDirectives = [ export var FormDirectives = [
ControlGroupDirective, ControlDirective, CheckboxControlValueAccessor, DefaultValueAccessor ControlGroupDirective, ControlDirective, CheckboxControlValueAccessor, DefaultValueAccessor
]; ];

View File

@ -3,6 +3,9 @@ import {isPresent} from 'angular2/src/facade/lang';
import * as modelModule from './model'; import * as modelModule from './model';
/**
* @publicModule angular2/forms
*/
export class FormBuilder { export class FormBuilder {
group(controlsConfig, extra = null):modelModule.ControlGroup { group(controlsConfig, extra = null):modelModule.ControlGroup {
var controls = this._reduceControls(controlsConfig); var controls = this._reduceControls(controlsConfig);

View File

@ -3,7 +3,14 @@ import {Observable, ObservableController, ObservableWrapper} from 'angular2/src/
import {StringMap, StringMapWrapper, ListWrapper, List} from 'angular2/src/facade/collection'; import {StringMap, StringMapWrapper, ListWrapper, List} from 'angular2/src/facade/collection';
import {Validators} from './validators'; import {Validators} from './validators';
/**
* @publicModule angular2/forms
*/
export const VALID = "VALID"; export const VALID = "VALID";
/**
* @publicModule angular2/forms
*/
export const INVALID = "INVALID"; export const INVALID = "INVALID";
//interface IControl { //interface IControl {
@ -18,6 +25,9 @@ export const INVALID = "INVALID";
// setParent(parent){} // setParent(parent){}
//} //}
/**
* @publicModule angular2/forms
*/
export class AbstractControl { export class AbstractControl {
_value:any; _value:any;
_status:string; _status:string;
@ -69,6 +79,9 @@ export class AbstractControl {
} }
} }
/**
* @publicModule angular2/forms
*/
export class Control extends AbstractControl { export class Control extends AbstractControl {
constructor(value:any, validator:Function = Validators.nullValidator) { constructor(value:any, validator:Function = Validators.nullValidator) {
super(validator); super(validator);
@ -94,6 +107,9 @@ export class Control extends AbstractControl {
} }
} }
/**
* @publicModule angular2/forms
*/
export class ControlGroup extends AbstractControl { export class ControlGroup extends AbstractControl {
controls:StringMap; controls:StringMap;
_optionals:StringMap; _optionals:StringMap;
@ -169,6 +185,9 @@ export class ControlGroup extends AbstractControl {
} }
} }
/**
* @publicModule angular2/forms
*/
export class ControlArray extends AbstractControl { export class ControlArray extends AbstractControl {
controls:List; controls:List;

View File

@ -3,6 +3,9 @@ import {List, ListWrapper, StringMapWrapper} from 'angular2/src/facade/collectio
import * as modelModule from './model'; import * as modelModule from './model';
/**
* @publicModule angular2/forms
*/
export class Validators { export class Validators {
static required(c:modelModule.Control) { static required(c:modelModule.Control) {
return isBlank(c.value) || c.value == "" ? {"required": true} : null; return isBlank(c.value) || c.value == "" ? {"required": true} : null;

3
modules/angular2/template.js vendored Normal file
View File

@ -0,0 +1,3 @@
/**
* Define public API for Angular here.
*/