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 {
registry:PipeRegistry;
@ -52,6 +56,9 @@ export class DynamicChangeDetection extends ChangeDetection {
}
}
/**
* @publicModule angular2/change_detection
*/
export class JitChangeDetection extends ChangeDetection {
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';
/**
* @publicModule angular2/angular2
* @publicModule angular2/change_detection
*/
export class BindingPropagationConfig {
_cd:ChangeDetector;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,6 +30,9 @@ function _emptyStep() {
return _EMPTY_STEP;
}
/**
* @publicModule angular2/template
*/
export class ShadowDomStrategy {
attachTemplate(el, view:viewModule.View) {}
constructLightDom(lightDomView:viewModule.View, shadowDomView:viewModule.View, el): LightDom { return null; }
@ -77,6 +80,8 @@ export class ShadowDomStrategy {
* Notes:
* - 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
*
* @publicModule angular2/template
*/
@Injectable()
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,
* - a common subset of shadow DOM selectors are supported,
* - see `ShadowCss` for more information and limitations.
*
* @publicModule angular2/template
*/
@Injectable()
export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomStrategy {

View File

@ -11,7 +11,7 @@ import {UrlResolver} from 'angular2/src/services/url_resolver';
/**
* Strategy to load component templates.
* @publicModule angular2/angular2
* @publicModule angular2/template
*/
@Injectable()
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
* @publicModule angular2/angular2
*
* @publicModule angular2/template
*/
@IMPLEMENTS(ChangeDispatcher)
export class View {
@ -284,7 +285,8 @@ export class View {
}
/**
* @publicModule angular2/angular2
*
* @publicModule angular2/template
*/
export class ProtoView {
element;
@ -692,7 +694,6 @@ export class ProtoView {
}
/**
* @publicModule angular2/angular2
*/
export class ElementBindingMemento {
_elementIndex:int;
@ -711,7 +712,6 @@ export class ElementBindingMemento {
}
/**
* @publicModule angular2/angular2
*/
export class DirectiveBindingMemento {
_elementInjectorIndex:int;
@ -757,7 +757,6 @@ class DirectiveMemento {
}
/**
* @publicModule angular2/angular2
*/
export class PropertyUpdate {
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';
/**
* @publicModule angular2/angular2
* @publicModule angular2/template
*/
export class ViewContainer {
parentView: viewModule.View;

View File

@ -2,6 +2,9 @@ import {Injectable} from 'angular2/di';
import {isPresent, print} from 'angular2/src/facade/lang';
import {ListWrapper, isListLikeIterable} from 'angular2/src/facade/collection';
/**
* @publicModule angular2/angular2
*/
@Injectable()
export class ExceptionHandler {
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 {isPresent} from 'angular2/src/facade/lang';
/**
* @publicModule angular2/change_detection
*/
@Injectable()
export class LifeCycle {
_errorHandler;

View File

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

View File

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

View File

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

View File

@ -10,6 +10,9 @@ import {Validators} from './validators';
// set onChange(fn){}
//}
/**
* @publicModule angular2/forms
*/
@Decorator({
selector: '[control]',
events: {
@ -31,6 +34,9 @@ export class DefaultValueAccessor {
}
}
/**
* @publicModule angular2/forms
*/
@Decorator({
selector: 'input[type=checkbox][control]',
events: {
@ -52,6 +58,9 @@ export class CheckboxControlValueAccessor {
}
}
/**
* @publicModule angular2/forms
*/
@Decorator({
lifecycle: [onChange],
selector: '[control]',
@ -109,6 +118,9 @@ export class ControlDirective {
}
}
/**
* @publicModule angular2/forms
*/
@Decorator({
selector: '[control-group]',
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 = [
ControlGroupDirective, ControlDirective, CheckboxControlValueAccessor, DefaultValueAccessor
];

View File

@ -3,6 +3,9 @@ import {isPresent} from 'angular2/src/facade/lang';
import * as modelModule from './model';
/**
* @publicModule angular2/forms
*/
export class FormBuilder {
group(controlsConfig, extra = null):modelModule.ControlGroup {
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 {Validators} from './validators';
/**
* @publicModule angular2/forms
*/
export const VALID = "VALID";
/**
* @publicModule angular2/forms
*/
export const INVALID = "INVALID";
//interface IControl {
@ -18,6 +25,9 @@ export const INVALID = "INVALID";
// setParent(parent){}
//}
/**
* @publicModule angular2/forms
*/
export class AbstractControl {
_value:any;
_status:string;
@ -69,6 +79,9 @@ export class AbstractControl {
}
}
/**
* @publicModule angular2/forms
*/
export class Control extends AbstractControl {
constructor(value:any, validator:Function = Validators.nullValidator) {
super(validator);
@ -94,6 +107,9 @@ export class Control extends AbstractControl {
}
}
/**
* @publicModule angular2/forms
*/
export class ControlGroup extends AbstractControl {
controls:StringMap;
_optionals:StringMap;
@ -169,6 +185,9 @@ export class ControlGroup extends AbstractControl {
}
}
/**
* @publicModule angular2/forms
*/
export class ControlArray extends AbstractControl {
controls:List;

View File

@ -3,6 +3,9 @@ import {List, ListWrapper, StringMapWrapper} from 'angular2/src/facade/collectio
import * as modelModule from './model';
/**
* @publicModule angular2/forms
*/
export class Validators {
static required(c:modelModule.Control) {
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.
*/