From 86dc3e5b07a41d9e5fe19d29b80db19aaecab006 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 31 Mar 2015 22:47:11 +0000 Subject: [PATCH] docs: create public API surface Closes #1181 --- modules/angular2/change_detection.js | 7 +++++++ modules/angular2/pipes.js | 3 +++ .../binding_propagation_config.js | 2 +- .../pipes/iterable_changes.js | 6 ++++++ .../pipes/keyvalue_changes.js | 9 +++++++++ .../src/change_detection/pipes/null_pipe.js | 6 ++++++ .../src/change_detection/pipes/pipe.js | 3 +++ .../angular2/src/core/compiler/compiler.js | 5 +++-- .../src/core/compiler/shadow_dom_strategy.js | 7 +++++++ .../src/core/compiler/template_loader.js | 2 +- modules/angular2/src/core/compiler/view.js | 9 ++++----- .../src/core/compiler/view_container.js | 2 +- .../angular2/src/core/exception_handler.js | 3 +++ .../src/core/life_cycle/life_cycle.js | 3 +++ modules/angular2/src/directives/for.js | 3 +++ modules/angular2/src/directives/if.js | 3 +++ .../angular2/src/directives/non_bindable.js | 3 +++ modules/angular2/src/directives/switch.js | 5 +++++ modules/angular2/src/forms/directives.js | 16 ++++++++++++++++ modules/angular2/src/forms/form_builder.js | 3 +++ modules/angular2/src/forms/model.js | 19 +++++++++++++++++++ modules/angular2/src/forms/validators.js | 3 +++ modules/angular2/template.js | 3 +++ 23 files changed, 115 insertions(+), 10 deletions(-) create mode 100644 modules/angular2/pipes.js create mode 100644 modules/angular2/template.js diff --git a/modules/angular2/change_detection.js b/modules/angular2/change_detection.js index f8555f9dd3..c2b650a6af 100644 --- a/modules/angular2/change_detection.js +++ b/modules/angular2/change_detection.js @@ -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; diff --git a/modules/angular2/pipes.js b/modules/angular2/pipes.js new file mode 100644 index 0000000000..1f650590e0 --- /dev/null +++ b/modules/angular2/pipes.js @@ -0,0 +1,3 @@ +/** + * Define public API for Angular here. + */ diff --git a/modules/angular2/src/change_detection/binding_propagation_config.js b/modules/angular2/src/change_detection/binding_propagation_config.js index 5ff63d3bcf..282b31d279 100644 --- a/modules/angular2/src/change_detection/binding_propagation_config.js +++ b/modules/angular2/src/change_detection/binding_propagation_config.js @@ -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; diff --git a/modules/angular2/src/change_detection/pipes/iterable_changes.js b/modules/angular2/src/change_detection/pipes/iterable_changes.js index 1baaed2afb..8df99e7bf7 100644 --- a/modules/angular2/src/change_detection/pipes/iterable_changes.js +++ b/modules/angular2/src/change_detection/pipes/iterable_changes.js @@ -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; diff --git a/modules/angular2/src/change_detection/pipes/keyvalue_changes.js b/modules/angular2/src/change_detection/pipes/keyvalue_changes.js index 0eb9d2193b..f3b2739d89 100644 --- a/modules/angular2/src/change_detection/pipes/keyvalue_changes.js +++ b/modules/angular2/src/change_detection/pipes/keyvalue_changes.js @@ -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; diff --git a/modules/angular2/src/change_detection/pipes/null_pipe.js b/modules/angular2/src/change_detection/pipes/null_pipe.js index 2648682cb2..9c51fea64e 100644 --- a/modules/angular2/src/change_detection/pipes/null_pipe.js +++ b/modules/angular2/src/change_detection/pipes/null_pipe.js @@ -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() { diff --git a/modules/angular2/src/change_detection/pipes/pipe.js b/modules/angular2/src/change_detection/pipes/pipe.js index c1213ce0af..af0a62134d 100644 --- a/modules/angular2/src/change_detection/pipes/pipe.js +++ b/modules/angular2/src/change_detection/pipes/pipe.js @@ -1,5 +1,8 @@ export var NO_CHANGE = new Object(); +/** + * @publicModule angular2/angular2 + */ export class Pipe { supports(obj):boolean {return false;} onDestroy() {} diff --git a/modules/angular2/src/core/compiler/compiler.js b/modules/angular2/src/core/compiler/compiler.js index f97982c298..0423e11303 100644 --- a/modules/angular2/src/core/compiler/compiler.js +++ b/modules/angular2/src/core/compiler/compiler.js @@ -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 { var dirMetadata = ListWrapper.map(this._flattenDirectives(template), (d) => this._reader.read(d)); diff --git a/modules/angular2/src/core/compiler/shadow_dom_strategy.js b/modules/angular2/src/core/compiler/shadow_dom_strategy.js index 8ed7cf8f70..14bf86aeac 100644 --- a/modules/angular2/src/core/compiler/shadow_dom_strategy.js +++ b/modules/angular2/src/core/compiler/shadow_dom_strategy.js @@ -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 { diff --git a/modules/angular2/src/core/compiler/template_loader.js b/modules/angular2/src/core/compiler/template_loader.js index c25c166ee5..c173887b8b 100644 --- a/modules/angular2/src/core/compiler/template_loader.js +++ b/modules/angular2/src/core/compiler/template_loader.js @@ -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 { diff --git a/modules/angular2/src/core/compiler/view.js b/modules/angular2/src/core/compiler/view.js index fd9a6520e0..f346a0b02a 100644 --- a/modules/angular2/src/core/compiler/view.js +++ b/modules/angular2/src/core/compiler/view.js @@ -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; diff --git a/modules/angular2/src/core/compiler/view_container.js b/modules/angular2/src/core/compiler/view_container.js index 5f8bc3ae1b..3d49624973 100644 --- a/modules/angular2/src/core/compiler/view_container.js +++ b/modules/angular2/src/core/compiler/view_container.js @@ -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; diff --git a/modules/angular2/src/core/exception_handler.js b/modules/angular2/src/core/exception_handler.js index a07d53cb1b..30773b06a5 100644 --- a/modules/angular2/src/core/exception_handler.js +++ b/modules/angular2/src/core/exception_handler.js @@ -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) { diff --git a/modules/angular2/src/core/life_cycle/life_cycle.js b/modules/angular2/src/core/life_cycle/life_cycle.js index 658829da13..75e07c8a38 100644 --- a/modules/angular2/src/core/life_cycle/life_cycle.js +++ b/modules/angular2/src/core/life_cycle/life_cycle.js @@ -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; diff --git a/modules/angular2/src/directives/for.js b/modules/angular2/src/directives/for.js index ef6832c00a..1b74fe8392 100644 --- a/modules/angular2/src/directives/for.js +++ b/modules/angular2/src/directives/for.js @@ -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: { diff --git a/modules/angular2/src/directives/if.js b/modules/angular2/src/directives/if.js index 0f108c06db..90c0adb433 100644 --- a/modules/angular2/src/directives/if.js +++ b/modules/angular2/src/directives/if.js @@ -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: { diff --git a/modules/angular2/src/directives/non_bindable.js b/modules/angular2/src/directives/non_bindable.js index c4978746dd..b1e300b769 100644 --- a/modules/angular2/src/directives/non_bindable.js +++ b/modules/angular2/src/directives/non_bindable.js @@ -1,5 +1,8 @@ import {Decorator} from 'angular2/src/core/annotations/annotations'; +/** + * @publicModule angular2/directives + */ @Decorator({ selector: '[non-bindable]', compileChildren: false diff --git a/modules/angular2/src/directives/switch.js b/modules/angular2/src/directives/switch.js index a706a1ea39..1756ca6189 100644 --- a/modules/angular2/src/directives/switch.js +++ b/modules/angular2/src/directives/switch.js @@ -29,6 +29,7 @@ import {Parent} from 'angular2/src/core/annotations/visibility'; * * * ``` + * @publicModule angular2/directives */ @Decorator({ selector: '[switch]', @@ -140,6 +141,8 @@ export class Switch { * // match against a constant string * * ``` + * + * @publicModule angular2/directives */ @Viewport({ selector: '[switch-when]', @@ -175,6 +178,8 @@ export class SwitchWhen { * * ``` * + * + * @publicModule angular2/directives * ``` */ @Viewport({ diff --git a/modules/angular2/src/forms/directives.js b/modules/angular2/src/forms/directives.js index 9745604d6d..8677ef3172 100644 --- a/modules/angular2/src/forms/directives.js +++ b/modules/angular2/src/forms/directives.js @@ -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 ]; diff --git a/modules/angular2/src/forms/form_builder.js b/modules/angular2/src/forms/form_builder.js index 9111c94bbe..239d5e3810 100644 --- a/modules/angular2/src/forms/form_builder.js +++ b/modules/angular2/src/forms/form_builder.js @@ -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); diff --git a/modules/angular2/src/forms/model.js b/modules/angular2/src/forms/model.js index a4507f5317..824ee2503d 100644 --- a/modules/angular2/src/forms/model.js +++ b/modules/angular2/src/forms/model.js @@ -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; diff --git a/modules/angular2/src/forms/validators.js b/modules/angular2/src/forms/validators.js index 0143e4c0ea..4ec90c3484 100644 --- a/modules/angular2/src/forms/validators.js +++ b/modules/angular2/src/forms/validators.js @@ -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; diff --git a/modules/angular2/template.js b/modules/angular2/template.js new file mode 100644 index 0000000000..1f650590e0 --- /dev/null +++ b/modules/angular2/template.js @@ -0,0 +1,3 @@ +/** + * Define public API for Angular here. + */