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

View File

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

View File

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

View File

@ -1,5 +1,8 @@
import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
/**
* @publicModule angular2/angular2
*/
export class Template {
url: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
* or from its parent.
* @publicModule angular2/angular2
*/
export class Parent extends DependencyAnnotation {
@CONST()
@ -15,6 +16,7 @@ export class Parent extends DependencyAnnotation {
/**
* The directive can only be injected from the current element
* or from its ancestor.
* @publicModule angular2/angular2
*/
export class Ancestor extends DependencyAnnotation {
@CONST()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,6 +28,7 @@ var VIEW_POOL_PREFILL = 0;
/**
* Const of making objects: http://jsperf.com/instantiate-size-of-object
* @publicModule angular2/angular2
*/
@IMPLEMENTS(ChangeDispatcher)
export class View {
@ -280,6 +281,9 @@ export class View {
}
}
/**
* @publicModule angular2/angular2
*/
export class ProtoView {
element;
elementBinders:List<ElementBinder>;
@ -640,6 +644,9 @@ export class ProtoView {
}
}
/**
* @publicModule angular2/angular2
*/
export class ElementBindingMemento {
_elementIndex:int;
_setterName:string;
@ -656,6 +663,9 @@ export class ElementBindingMemento {
}
}
/**
* @publicModule angular2/angular2
*/
export class DirectiveBindingMemento {
_elementInjectorIndex:int;
_directiveIndex:int;
@ -712,6 +722,9 @@ class DirectiveMemento {
}
}
/**
* @publicModule angular2/angular2
*/
export class PropertyUpdate {
currentValue;
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 * as ldModule from './shadow_dom_emulation/light_dom';
/**
* @publicModule angular2/angular2
*/
export class ViewContainer {
parentView: viewModule.View;
templateElement;

View File

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