docs(*): add @publicModule tags

Initial set of tags to demonstrate the public docs filtering

Closes #988
This commit is contained in:
Peter Bacon Darwin 2015-03-17 19:22:13 +00:00 committed by Misko Hevery
parent 8229d7edc2
commit 85799aa1a5
14 changed files with 302 additions and 213 deletions

View File

@ -5,8 +5,10 @@ module.exports = function processClassDocs(log, getJSDocComment) {
return { return {
$runAfter: ['processModuleDocs'], $runAfter: ['processModuleDocs'],
$runBefore: ['parsing-tags', 'generateDocsFromComments'], $runBefore: ['parsing-tags', 'generateDocsFromComments'],
ignorePrivateMembers: false,
$process: function(docs) { $process: function(docs) {
var memberDocs = []; var memberDocs = [];
var ignorePrivateMembers = this.ignorePrivateMembers;
_.forEach(docs, function(classDoc) { _.forEach(docs, function(classDoc) {
if ( classDoc.docType === 'class' ) { if ( classDoc.docType === 'class' ) {
@ -15,6 +17,8 @@ module.exports = function processClassDocs(log, getJSDocComment) {
// Create a new doc for each member of the class // Create a new doc for each member of the class
_.forEach(classDoc.elements, function(memberDoc) { _.forEach(classDoc.elements, function(memberDoc) {
if (ignorePrivateMembers && memberDoc.name.literalToken.value.charAt(0) === '_') return;
classDoc.members.push(memberDoc); classDoc.members.push(memberDoc);
memberDocs.push(memberDoc); memberDocs.push(memberDoc);
@ -22,6 +26,7 @@ module.exports = function processClassDocs(log, getJSDocComment) {
memberDoc.classDoc = classDoc; memberDoc.classDoc = classDoc;
memberDoc.name = memberDoc.name.literalToken.value; memberDoc.name = memberDoc.name.literalToken.value;
if (memberDoc.commentBefore ) { if (memberDoc.commentBefore ) {
// If this export has a comment, remove it from the list of // If this export has a comment, remove it from the list of
// comments collected in the module // comments collected in the module

View File

@ -17,8 +17,10 @@ module.exports = function ExportTreeVisitor(ParseTreeVisitor, log) {
ParseTreeVisitor.prototype.visitExportDeclaration.call(this, tree); ParseTreeVisitor.prototype.visitExportDeclaration.call(this, tree);
log.silly('exit', this.currentExport); log.silly('exit', this.currentExport);
if(this.currentExport) {
// We are exiting the export declaration - store the export object // We are exiting the export declaration - store the export object
this.exports.push(this.currentExport); this.exports.push(this.currentExport);
}
this.currentExport = null; this.currentExport = null;
}, },
@ -78,14 +80,15 @@ module.exports = function ExportTreeVisitor(ParseTreeVisitor, log) {
}, },
visitNamedExport: function(tree) { visitNamedExport: function(tree) {
if ( this.currentExport ) { this.currentExport = null;
this.updateExport(tree); // if ( this.currentExport ) {
// this.updateExport(tree);
this.currentExport.namedExport = tree; // this.currentExport.namedExport = tree;
this.currentExport.name = 'NAMED_EXPORT'; // this.currentExport.name = 'NAMED_EXPORT';
// TODO: work out this bit!! // // TODO: work out this bit!!
// We need to cope with any export specifiers in the named export // // We need to cope with any export specifiers in the named export
} // }
}, },
// TODO - if the export is an expression, find the thing that is being // TODO - if the export is an expression, find the thing that is being

View File

@ -10,6 +10,10 @@ module.exports = new Package('angular-public', [basePackage])
parseTagsProcessor.tagDefinitions.push({ name: 'publicModule' }); parseTagsProcessor.tagDefinitions.push({ name: 'publicModule' });
}) })
.config(function(processClassDocs) {
processClassDocs.ignorePrivateMembers = true;
})
// Configure file writing // Configure file writing
.config(function(writeFilesProcessor) { .config(function(writeFilesProcessor) {
writeFilesProcessor.outputFolder = 'dist/public_docs'; writeFilesProcessor.outputFolder = 'dist/public_docs';

View File

@ -7,6 +7,7 @@ import {ListWrapper, List} from 'angular2/src/facade/collection';
* Directives allow you to attach behavior to the DOM elements. * Directives allow you to attach behavior to the DOM elements.
* *
* Directive is an abstract concept, instead use concrete directives such as: [Component], [Decorator] or [Viewport]. * Directive is an abstract concept, instead use concrete directives such as: [Component], [Decorator] or [Viewport].
* @publicModule angular2/angular2
*/ */
@ABSTRACT() @ABSTRACT()
export class Directive { export class Directive {
@ -28,10 +29,12 @@ export class Directive {
* *
* And the following HTML: * And the following HTML:
* *
* ```html
* <form> * <form>
* <input type="text"> * <input type="text">
* <input type="radio"> * <input type="radio">
* <form> * <form>
* ```
* *
* The directive would only be instantiated on the `<input type="text">` element. * The directive would only be instantiated on the `<input type="text">` element.
* *
@ -50,6 +53,8 @@ export class Directive {
* change detection of the value. * change detection of the value.
* *
* ## Syntax * ## Syntax
*
* ```
* @Directive({ * @Directive({
* bind: { * bind: {
* 'directiveProperty1': 'bindingProperty1', * 'directiveProperty1': 'bindingProperty1',
@ -57,10 +62,12 @@ export class Directive {
* ... * ...
* } * }
* } * }
* ```
* *
* *
* ## Basic Property Binding: * ## Basic Property Binding:
* *
* ```
* @Decorator({ * @Decorator({
* selector: '[tooltip]', * selector: '[tooltip]',
* bind: { * bind: {
@ -72,10 +79,13 @@ export class Directive {
* // This will get called every time the 'tooltip' binding changes with the new value. * // This will get called every time the 'tooltip' binding changes with the new value.
* } * }
* } * }
* ```
* *
* As used in this example: * As used in this example:
* *
* ```html
* <div [tooltip]="someExpression"> * <div [tooltip]="someExpression">
* ```
* *
* Whenever the `someExpression` expression changes, the `bind` declaration instructs Angular to update the * Whenever the `someExpression` expression changes, the `bind` declaration instructs Angular to update the
* `Tooltip`'s `tooltipText` property. * `Tooltip`'s `tooltipText` property.
@ -83,13 +93,16 @@ export class Directive {
* *
* Similarly in this example: * Similarly in this example:
* *
* ```html
* <div tooltip="Some Text"> * <div tooltip="Some Text">
* ```
* *
* The `Tooltip`'s `tooltipText` property gets initialized to the `Some Text` literal. * The `Tooltip`'s `tooltipText` property gets initialized to the `Some Text` literal.
* *
* *
* ## Bindings With Pipes: * ## Bindings With Pipes:
* *
* ```
* @Decorator({ * @Decorator({
* selector: '[class-set]', * selector: '[class-set]',
* bind: { * bind: {
@ -101,9 +114,13 @@ export class Directive {
* // This will get called every time the `class-set` expressions changes its structure. * // This will get called every time the `class-set` expressions changes its structure.
* } * }
* } * }
* ```
* *
* As used in this example: * As used in this example:
*
* ```html
* <div [class-set]="someExpression"> * <div [class-set]="someExpression">
* ```
* *
* In the above example, the `ClassSet` uses the `keyValDiff` [Pipe] for watching structural changes. This means that * In the above example, the `ClassSet` uses the `keyValDiff` [Pipe] for watching structural changes. This means that
* the `classChanges` setter gets invoked if the expression changes to a different reference, or if the * the `classChanges` setter gets invoked if the expression changes to a different reference, or if the
@ -125,15 +142,19 @@ export class Directive {
* *
* *
* ## Syntax * ## Syntax
*
* ```
* @Directive({ * @Directive({
* events: { * events: {
* 'event1': 'onMethod', * 'event1': 'onMethod',
* ... * ...
* } * }
* } * }
* ```
* *
* ## Basic Event Binding: * ## Basic Event Binding:
* *
* ```
* @Decorator({ * @Decorator({
* selector: 'input', * selector: 'input',
* event: { * event: {
@ -145,6 +166,7 @@ export class Directive {
* // invoked whenever the DOM element fires the 'change' event. * // invoked whenever the DOM element fires the 'change' event.
* } * }
* } * }
* ```
* *
*/ */
events:any; // StringMap events:any; // StringMap
@ -178,6 +200,9 @@ export class Directive {
} }
} }
/**
* @publicModule angular2/angular2
*/
export class Component extends Directive { export class Component extends Directive {
//TODO: vsavkin: uncomment it once the issue with defining fields in a sublass works //TODO: vsavkin: uncomment it once the issue with defining fields in a sublass works
services:any; //List; services:any; //List;
@ -208,6 +233,9 @@ export class Component extends Directive {
} }
} }
/**
* @publicModule angular2/angular2
*/
export class Decorator extends Directive { export class Decorator extends Directive {
compileChildren: boolean; compileChildren: boolean;
@CONST() @CONST()
@ -235,6 +263,9 @@ export class Decorator extends Directive {
} }
} }
/**
* @publicModule angular2/angular2
*/
export class Viewport extends Directive { export class Viewport extends Directive {
@CONST() @CONST()
constructor({ constructor({
@ -264,6 +295,7 @@ export class Viewport extends Directive {
* *
* ## Example * ## Example
* *
* ```
* @Decorator({ * @Decorator({
* ..., * ...,
* lifecycle: [ onDestroy ] * lifecycle: [ onDestroy ]
@ -273,6 +305,8 @@ export class Viewport extends Directive {
* // invoked to notify directive of the containing view destruction. * // invoked to notify directive of the containing view destruction.
* } * }
* } * }
* ```
* @publicModule angular2/angular2
*/ */
export const onDestroy = "onDestroy"; export const onDestroy = "onDestroy";
@ -282,6 +316,7 @@ export const onDestroy = "onDestroy";
* *
* ## Example: * ## Example:
* *
* ```
* @Decorator({ * @Decorator({
* selector: '[class-set]', * selector: '[class-set]',
* bind: { * bind: {
@ -292,7 +327,6 @@ export const onDestroy = "onDestroy";
* class ClassSet { * class ClassSet {
* propA; * propA;
* propB; * propB;
*
* onChange(changes:{[idx: string, PropertyUpdate]}) { * onChange(changes:{[idx: string, PropertyUpdate]}) {
* // This will get called after any of the properties have been updated. * // This will get called after any of the properties have been updated.
* if (changes['propA']) { * if (changes['propA']) {
@ -303,5 +337,7 @@ export const onDestroy = "onDestroy";
* } * }
* } * }
* } * }
* ```
* @publicModule angular2/angular2
*/ */
export const onChange = "onChange"; export const onChange = "onChange";

View File

@ -1,5 +1,8 @@
import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang'; import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
/**
* @publicModule angular2/angular2
*/
export class Template { export class Template {
url:any; //string; url:any; //string;
inline:any; //string; inline:any; //string;

View File

@ -4,6 +4,7 @@ import {DependencyAnnotation} from 'angular2/di';
/** /**
* The directive can only be injected from the current element * The directive can only be injected from the current element
* or from its parent. * or from its parent.
* @publicModule angular2/angular2
*/ */
export class Parent extends DependencyAnnotation { export class Parent extends DependencyAnnotation {
@CONST() @CONST()
@ -15,6 +16,7 @@ export class Parent extends DependencyAnnotation {
/** /**
* The directive can only be injected from the current element * The directive can only be injected from the current element
* or from its ancestor. * or from its ancestor.
* @publicModule angular2/angular2
*/ */
export class Ancestor extends DependencyAnnotation { export class Ancestor extends DependencyAnnotation {
@CONST() @CONST()

View File

@ -126,12 +126,15 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
* ## Simple Example * ## Simple Example
* *
* Assuming this `index.html`: * Assuming this `index.html`:
*
* ```html
* <html> * <html>
* <!-- load Angular script tags here. --> * <!-- load Angular script tags here. -->
* <body> * <body>
* <my-app>loading...</my-app> * <my-app>loading...</my-app>
* </body> * </body>
* </html> * </html>
* ```
* *
* An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike Angular 1, Angular 2 * An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike Angular 1, Angular 2
* does not compile/process bindings in `index.html`. This is mainly for security reasons, as well as architectural * does not compile/process bindings in `index.html`. This is mainly for security reasons, as well as architectural
@ -139,6 +142,8 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
* which may use double-curly `{{syntax}}` without collision from Angular 2 component double-curly `{{syntax}}`. * which may use double-curly `{{syntax}}` without collision from Angular 2 component double-curly `{{syntax}}`.
* *
* We can use this script code: * We can use this script code:
*
* ```
* @Component({ * @Component({
* selector: 'my-app' * selector: 'my-app'
* }) * })
@ -156,6 +161,7 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
* main() { * main() {
* bootstrap(MyApp); * bootstrap(MyApp);
* } * }
* ```
* *
* When the app developer invokes `bootstrap()` with the root component `MyApp` as its argument, Angular performs the * When the app developer invokes `bootstrap()` with the root component `MyApp` as its argument, Angular performs the
* following tasks: * following tasks:
@ -211,6 +217,8 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
* - [errorReporter]: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions. * - [errorReporter]: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions.
* *
* Returns the application`s private [Injector]. * Returns the application`s private [Injector].
*
* @publicModule angular2/angular2
*/ */
export function bootstrap(appComponentType: Type, export function bootstrap(appComponentType: Type,
componentServiceBindings: List<Binding>=null, componentServiceBindings: List<Binding>=null,

View File

@ -1,5 +1,8 @@
import {ChangeDetector, CHECK_ONCE, DETACHED, CHECK_ALWAYS} from 'angular2/change_detection'; import {ChangeDetector, CHECK_ONCE, DETACHED, CHECK_ALWAYS} from 'angular2/change_detection';
/**
* @publicModule angular2/angular2
*/
export class BindingPropagationConfig { export class BindingPropagationConfig {
_cd:ChangeDetector; _cd:ChangeDetector;

View File

@ -21,6 +21,7 @@ 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
*/ */
export class CompilerCache { export class CompilerCache {
_cache:Map; _cache:Map;
@ -46,6 +47,7 @@ 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
*/ */
export class Compiler { export class Compiler {
_reader: DirectiveMetadataReader; _reader: DirectiveMetadataReader;

View File

@ -1,3 +1,6 @@
/**
* @publicModule angular2/angular2
*/
export class OnChange { export class OnChange {
onChange(changes) { onChange(changes) {
throw "OnChange.onChange is not implemented"; throw "OnChange.onChange is not implemented";

View File

@ -10,6 +10,7 @@ import {UrlResolver} from './url_resolver';
/** /**
* Strategy to load component templates. * Strategy to load component templates.
* @publicModule angular2/angular2
*/ */
export class TemplateLoader { export class TemplateLoader {
_xhr: XHR; _xhr: XHR;

View File

@ -28,6 +28,7 @@ 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
*/ */
@IMPLEMENTS(ChangeDispatcher) @IMPLEMENTS(ChangeDispatcher)
export class View { export class View {
@ -280,6 +281,9 @@ export class View {
} }
} }
/**
* @publicModule angular2/angular2
*/
export class ProtoView { export class ProtoView {
element; element;
elementBinders:List<ElementBinder>; elementBinders:List<ElementBinder>;
@ -640,6 +644,9 @@ export class ProtoView {
} }
} }
/**
* @publicModule angular2/angular2
*/
export class ElementBindingMemento { export class ElementBindingMemento {
_elementIndex:int; _elementIndex:int;
_setterName:string; _setterName:string;
@ -656,6 +663,9 @@ export class ElementBindingMemento {
} }
} }
/**
* @publicModule angular2/angular2
*/
export class DirectiveBindingMemento { export class DirectiveBindingMemento {
_elementInjectorIndex:int; _elementInjectorIndex:int;
_directiveIndex:int; _directiveIndex:int;
@ -712,6 +722,9 @@ class DirectiveMemento {
} }
} }
/**
* @publicModule angular2/angular2
*/
export class PropertyUpdate { export class PropertyUpdate {
currentValue; currentValue;
previousValue; previousValue;

View File

@ -8,6 +8,9 @@ import {isPresent, isBlank} from 'angular2/src/facade/lang';
import {EventManager} from 'angular2/src/core/events/event_manager'; import {EventManager} from 'angular2/src/core/events/event_manager';
import * as ldModule from './shadow_dom_emulation/light_dom'; import * as ldModule from './shadow_dom_emulation/light_dom';
/**
* @publicModule angular2/angular2
*/
export class ViewContainer { export class ViewContainer {
parentView: viewModule.View; parentView: viewModule.View;
templateElement; templateElement;

View File

@ -1,6 +1,9 @@
import {DOM} from 'angular2/src/dom/dom_adapter'; import {DOM} from 'angular2/src/dom/dom_adapter';
import {normalizeBlank} from 'angular2/src/facade/lang'; import {normalizeBlank} from 'angular2/src/facade/lang';
/**
* @publicModule angular2/angular2
*/
export class NgElement { export class NgElement {
domElement; domElement;
constructor(domElement) { constructor(domElement) {