From 91bb745e50370dd26929768d36400974f5ecb0d5 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Fri, 28 Aug 2015 11:16:17 -0700 Subject: [PATCH] docs wip --- ionic/components/action-menu/action-menu.ts | 8 ++- ionic/components/app/app.ts | 73 +++++++++++++++++++-- ionic/config/annotations.ts | 19 +++++- ionic/config/config.ts | 12 ++-- scripts/docs/dgeni-config.js | 5 +- scripts/docs/templates/common.template.html | 8 +-- scripts/docs/templates/module.template.html | 2 +- 7 files changed, 108 insertions(+), 19 deletions(-) diff --git a/ionic/components/action-menu/action-menu.ts b/ionic/components/action-menu/action-menu.ts index c2a90f78c4..4e66fe653e 100644 --- a/ionic/components/action-menu/action-menu.ts +++ b/ionic/components/action-menu/action-menu.ts @@ -58,7 +58,9 @@ class ActionMenuDirective { } } - +/** + * TODO + */ @Injectable() export class ActionMenu extends Overlay { /** @@ -67,7 +69,6 @@ export class ActionMenu extends Overlay { * * @return Promise that resolves when the action menu is open. */ - open(opts={}) { let config = this.config; let defaults = { @@ -82,6 +83,9 @@ export class ActionMenu extends Overlay { return this.create(OVERLAY_TYPE, ActionMenuDirective, context, context); } + /** + * TODO + */ get() { return Modal.getByType(OVERLAY_TYPE); } diff --git a/ionic/components/app/app.ts b/ionic/components/app/app.ts index ce4f1615e8..050933c421 100644 --- a/ionic/components/app/app.ts +++ b/ionic/components/app/app.ts @@ -11,9 +11,14 @@ import {Modal} from '../modal/modal'; import {Popup} from '../popup/popup'; import {FocusHolder} from '../form/focus-holder'; - +/** + * TODO + */ export class IonicApp { + /** + * TODO + */ constructor() { this.overlays = []; @@ -21,11 +26,20 @@ export class IonicApp { this.components = {}; } + /** + * TODO + * @param {Object} appRef TODO + */ load(appRef) { this.ref(appRef); this._zone = appRef.injector.get(NgZone); } + /** + * TODO + * @param {TODO=} val TODO + * @return {TODO} TODO + */ focusHolder(val) { if (arguments.length) { this._focusHolder = val; @@ -33,10 +47,19 @@ export class IonicApp { return this._focusHolder; } + /** + * Sets the document title. + * @param {string} val Value to set the document title to. + */ title(val) { document.title = val; } + /** + * TODO + * @param {TODO=} val TODO + * @return TODO + */ ref(val) { if (arguments.length) { this._ref = val; @@ -44,16 +67,26 @@ export class IonicApp { return this._ref; } + /** + * TODO + * @return TODO + */ get injector() { return this._ref.injector; } + /** + * TODO + * @param {Function} fn TODO + */ zoneRun(fn) { this._zone.run(fn); } /** * Register a known component with a key, for easy lookups later. + * @param {TODO} key TODO + * @param {TODO} component TODO */ register(key, component) { this.components[key] = component; @@ -62,11 +95,18 @@ export class IonicApp { /** * Unregister a known component with a key. + * @param {TODO} key TODO + * @param {TODO} component TODO */ - unregister(key, component) { + unregister(key, component) { delete this.components[key]; } + /** + * TODO + * @param {Object} cls TODO + * @return TODO + */ getRegisteredComponent(cls) { for(let component of this.components) { if(component instanceof cls) { @@ -77,6 +117,8 @@ export class IonicApp { /** * Get the component for the given key. + * @param {TODO} key TODO + * @return {TODO} TODO */ getComponent(key) { return this.components[key]; @@ -86,13 +128,20 @@ export class IonicApp { * Create and append the given component into the root * element of the app. * - * @param Component the component to create and insert - * @return Promise that resolves with the ContainerRef created + * @param {TODO} componentType the component to create and insert + * @return {Promise} Promise that resolves with the ContainerRef created */ - appendComponent(componentType: Type, context=null) { + appendComponent(componentType: Type) { return this.rootAnchor.append(componentType); } + /** + * TODO + * + * @param {Element} bodyEle the body element + * @param {TODO} platform TODO + * @param {TODO} config TODO + */ applyBodyCss(bodyEle, platform, config) { let versions = platform.versions(); platform.platforms().forEach(platformName => { @@ -130,6 +179,13 @@ export class IonicApp { bodyEle.setAttribute('mode', config.setting('mode')); } + /** + * If val is defined, specifies whether app text is RTL. If val is undefined + * returns whether app text is RTL. + * + * @param {boolean=} val Boolean specifying whether text is RTL or not. + * @returns {boolean} true if app text is RTL, false if otherwise. + */ isRTL(val) { if (arguments.length) { this._rtl = val; @@ -179,6 +235,13 @@ class RootAnchor { } } +/** + * TODO + * + * @param {TODO} rootComponentType TODO + * @param {TODO} config TODO + * @return {Promise} TODO + */ export function ionicBootstrap(rootComponentType, config) { return new Promise(resolve => { try { diff --git a/ionic/config/annotations.ts b/ionic/config/annotations.ts index e166ef53af..8b4f0ae50d 100644 --- a/ionic/config/annotations.ts +++ b/ionic/config/annotations.ts @@ -22,9 +22,12 @@ import { MaterialButton } from '../ionic'; - -// TODO: Why is forwardRef() required when they're already imported above???? +/** + * The core Ionic directives. Automatically available in every IonicView + * template. + */ export const IonicDirectives = [ +// TODO: Why is forwardRef() required when they're already imported above???? // Angular CORE_DIRECTIVES, FORM_DIRECTIVES, @@ -99,6 +102,9 @@ class IonicViewImpl extends View { } } +/** + * TODO + */ export function IonicView(args) { return function(cls) { var annotations = Reflect.getMetadata('annotations', cls) || []; @@ -108,6 +114,9 @@ export function IonicView(args) { } } +/** + * TODO + */ export function IonicDirective(config) { return function(cls) { var annotations = Reflect.getMetadata('annotations', cls) || []; @@ -117,6 +126,9 @@ export function IonicDirective(config) { } } +/** + * TODO + */ export function IonicComponent(config) { return function(cls) { var annotations = Reflect.getMetadata('annotations', cls) || []; @@ -153,6 +165,9 @@ function appendConfig(cls, config) { return config; } +/** + * TODO + */ export function App(args={}) { return function(cls) { // get current annotations diff --git a/ionic/config/config.ts b/ionic/config/config.ts index b2f76ff593..0c5a1aebb2 100644 --- a/ionic/config/config.ts +++ b/ionic/config/config.ts @@ -2,11 +2,14 @@ import {isObject, isDefined, isFunction, extend} from '../util/util'; /** -* This is the Ionic Config -* @usage this is what you do to use it +* TODO */ export class IonicConfig { + /** + * TODO + * @param {Object} settings The settings for your app + */ constructor(settings) { // defaults @@ -18,7 +21,7 @@ export class IonicConfig { } } /** - * @description The settings description + * TODO */ setting() { const args = arguments; @@ -132,7 +135,8 @@ export class IonicConfig { } /** - * The setPlatform description + * TODO + * @param {Object} platform The platform */ setPlatform(platform) { // get the array of active platforms, which also knows the hierarchy, diff --git a/scripts/docs/dgeni-config.js b/scripts/docs/dgeni-config.js index 5d69c849aa..1861b57b92 100644 --- a/scripts/docs/dgeni-config.js +++ b/scripts/docs/dgeni-config.js @@ -9,12 +9,15 @@ var path = require('path'); // Define the dgeni package for generating the docs module.exports = new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage, gitPackage]) -//for debugging docs +// for debugging docs // .processor(function test(){ // return { // $runAfter: ['files-written'], // $process: function(docs){ // docs.forEach(function(doc){ +// if (doc.constructorDoc){ +// debugger; +// } // }) // } // } diff --git a/scripts/docs/templates/common.template.html b/scripts/docs/templates/common.template.html index 3c58715f16..58df91ed04 100644 --- a/scripts/docs/templates/common.template.html +++ b/scripts/docs/templates/common.template.html @@ -1,6 +1,6 @@ -{% macro paramList(params) -%} - {%- if params -%}( - {%- for param in params -%} +{% macro paramList(paramData) -%} + {%- if paramData -%}( + {%- for param in paramData -%} {$ param | escape $}{% if not loop.last %}, {% endif %} {%- endfor %}) {%- endif %} @@ -28,7 +28,7 @@ defined in {$ githubViewLink(doc) $} {%- if doc.constructorDoc %}
-

{$ doc.constructorDoc.name $}{$ paramList(doc.constructorDoc.params) $}

+

{$ doc.constructorDoc.name $}{$ paramList(doc.constructorDoc.paramData) $}

{% marked %} {$ doc.constructorDoc.description $} {% endmarked %} diff --git a/scripts/docs/templates/module.template.html b/scripts/docs/templates/module.template.html index 7441058846..73f0a6788b 100644 --- a/scripts/docs/templates/module.template.html +++ b/scripts/docs/templates/module.template.html @@ -1,5 +1,5 @@

{$ doc.id $}

{%- for export in doc.exports %} - {$ export.name $} + {$ export.name $}
{% endfor %}