diff --git a/addon/components/api/x-class/template.hbs b/addon/components/api/x-class/template.hbs index 3ff6e124d..60de60e0a 100644 --- a/addon/components/api/x-class/template.hbs +++ b/addon/components/api/x-class/template.hbs @@ -3,18 +3,36 @@ {{! wrapping in a div seems to work around https://github.com/ember-learn/ember-cli-addon-docs/issues/7 }}
{{{class.description}}}
-{{#if hasContents}} - {{#if hasToggles}} - {{api/x-toggles - toggles=(hash - inherited=(if component.hasInherited showInherited) - protected=(if component.hasProtected showProtected) - private=(if component.hasPrivate showPrivate) - deprecated=(if component.hasDeprecated showDeprecated) - ) - }} - {{/if}} +{{#if (or class.exportType hasToggles)}} + {{#api/x-meta-panel as |panel|}} + {{#if class.exportType}} + {{#panel.header}} + Import Path + {{/panel.header}} + + {{api/x-import-path item=class}} + {{/if}} + + {{#if hasToggles}} + {{#panel.header}} + Show + {{/panel.header}} + {{#if hasToggles}} + {{api/x-toggles + toggles=(hash + inherited=(if class.hasInherited showInherited) + protected=(if class.hasProtected showProtected) + private=(if class.hasPrivate showPrivate) + deprecated=(if class.hasDeprecated showDeprecated) + ) + }} + {{/if}} + {{/if}} + {{/api/x-meta-panel}} +{{/if}} + +{{#if hasContents}} {{api/x-sections sections=(hash constructors=class.constructors diff --git a/addon/components/api/x-component/template.hbs b/addon/components/api/x-component/template.hbs index a9fc968d7..fb0249eb9 100644 --- a/addon/components/api/x-component/template.hbs +++ b/addon/components/api/x-component/template.hbs @@ -3,21 +3,30 @@ {{! wrapping in a div seems to work around https://github.com/ember-learn/ember-cli-addon-docs/issues/7 }}
{{{component.description}}}
-{{#if hasContents}} - {{#if hasToggles}} - {{api/x-toggles - toggles=(hash - inherited=(if component.hasInherited showInherited) - internal=(if component.hasInternal showInternal) - protected=(if component.hasProtected showProtected) - private=(if component.hasPrivate showPrivate) - deprecated=(if component.hasDeprecated showDeprecated) - ) +{{#if hasToggles}} + {{#api/x-meta-panel as |panel|}} + {{#panel.header}} + Show + {{/panel.header}} + + {{#if hasToggles}} + {{api/x-toggles + toggles=(hash + inherited=(if component.hasInherited showInherited) + internal=(if component.hasInternal showInternal) + protected=(if component.hasProtected showProtected) + private=(if component.hasPrivate showPrivate) + deprecated=(if component.hasDeprecated showDeprecated) + ) - onToggle=(action 'updateFilter') - }} - {{/if}} + onToggle=(action 'updateFilter') + }} + {{/if}} + {{/api/x-meta-panel}} +{{/if}} + +{{#if hasContents}} {{api/x-sections sections=(hash constructors=constructors diff --git a/addon/components/api/x-import-path/component.js b/addon/components/api/x-import-path/component.js index 49ab02ebf..91612830b 100644 --- a/addon/components/api/x-import-path/component.js +++ b/addon/components/api/x-import-path/component.js @@ -1,7 +1,20 @@ import Component from '@ember/component'; -import layout from './template'; +import hbs from 'htmlbars-inline-precompile'; export default Component.extend({ - layout, - tagName: '' + tagName: '', + layout: hbs` +
+ import + + {{#if (eq item.exportType "default")}} + {{item.name}} + {{else}} + { {{item.name}} } + {{/if}} + + from + '{{item.file}}'; +
+ `, }); diff --git a/addon/components/api/x-import-path/style.scss b/addon/components/api/x-import-path/style.scss deleted file mode 100644 index 9f9ac503f..000000000 --- a/addon/components/api/x-import-path/style.scss +++ /dev/null @@ -1,3 +0,0 @@ -.import-path { - font-family: Monaco, monospace; -} diff --git a/addon/components/api/x-import-path/template.hbs b/addon/components/api/x-import-path/template.hbs deleted file mode 100644 index b0e0d7cb7..000000000 --- a/addon/components/api/x-import-path/template.hbs +++ /dev/null @@ -1,18 +0,0 @@ -{{#if item.exportType}} -

- Import Path -

- -
- import - - {{#if (eq item.exportType "default")}} - {{item.name}} - {{else}} - { {{item.name}} } - {{/if}} - - from - '{{item.file}}'; -
-{{/if}} diff --git a/addon/components/api/x-meta-panel/component.js b/addon/components/api/x-meta-panel/component.js new file mode 100644 index 000000000..a992edde2 --- /dev/null +++ b/addon/components/api/x-meta-panel/component.js @@ -0,0 +1,13 @@ +import Component from '@ember/component'; +import hbs from 'htmlbars-inline-precompile'; + +export default Component.extend({ + tagName: '', + layout: hbs` +
+ {{yield (hash + header=(component 'api/x-meta-panel/header') + )}} +
+ `, +}); diff --git a/addon/components/api/x-meta-panel/header/component.js b/addon/components/api/x-meta-panel/header/component.js new file mode 100644 index 000000000..f287b1860 --- /dev/null +++ b/addon/components/api/x-meta-panel/header/component.js @@ -0,0 +1,11 @@ +import Component from '@ember/component'; +import hbs from 'htmlbars-inline-precompile'; + +export default Component.extend({ + tagName: '', + layout: hbs` +

+ {{yield}} +

+ `, +}); diff --git a/addon/components/api/x-params/style.scss b/addon/components/api/x-params/style.scss deleted file mode 100644 index 1be19fe05..000000000 --- a/addon/components/api/x-params/style.scss +++ /dev/null @@ -1,21 +0,0 @@ -.item-params { - width: 100%; - - td { - padding-right: 1em; - } - - td:last-of-type { - width: 99%; - padding-right: 0; - } -} - -.item-params__param-name, -.item-params__param-type { - font-family: Monaco, monospace; -} - -.item-params__param-name { - font-weight: bold; -} diff --git a/addon/components/api/x-params/template.hbs b/addon/components/api/x-params/template.hbs deleted file mode 100644 index 67c15ed08..000000000 --- a/addon/components/api/x-params/template.hbs +++ /dev/null @@ -1,17 +0,0 @@ -{{#if shouldDisplayParams}} -

- Params -

- - - - {{#each params as |param|}} - - - - - - {{/each}} - -
{{param.name}}{{param.type}}{{param.description}}
-{{/if}} diff --git a/addon/components/api/x-params/component.js b/addon/components/api/x-section/component.js similarity index 78% rename from addon/components/api/x-params/component.js rename to addon/components/api/x-section/component.js index dc71451d5..a1f436678 100644 --- a/addon/components/api/x-params/component.js +++ b/addon/components/api/x-section/component.js @@ -10,9 +10,9 @@ export default Component.extend({ * Params shouldn't be displayed when there are no descriptions and no subparams, * because the information is already displayed in the type signature and redundant */ - shouldDisplayParams: computed('params.[]', function() { - let params = this.get('params') || []; + shouldDisplayParams: computed('item.params.[]', function() { + let params = this.get('item.params') || []; return params.some(p => p.description || p.name.includes('.')); - }) + }), }); diff --git a/addon/components/api/x-section/template.hbs b/addon/components/api/x-section/template.hbs new file mode 100644 index 000000000..03c959d14 --- /dev/null +++ b/addon/components/api/x-section/template.hbs @@ -0,0 +1,62 @@ +
+

+ {{#if (eq item.exportType 'default')}} + + Default + + {{/if}} + + {{#if (or item.isClass item.isComponent)}} + {{#link-to 'docs.api.item' (concat 'modules/' item.id) class='hover:underline'}} + {{item.name}} + {{/link-to}} + {{else}} + {{#if (eq item.exportType 'default')}} + Default + {{/if}} + + + {{type-signature item}} + + {{/if}} +

+ +

+ {{{item.description}}} +

+ + {{#if (or item.exportType shouldDisplayParams)}} + {{#api/x-meta-panel as |panel|}} + {{#if item.exportType}} + {{#panel.header}} + Import Path + {{/panel.header}} + + {{api/x-import-path item=item}} + {{/if}} + + {{#if shouldDisplayParams}} + {{#panel.header}} + Params + {{/panel.header}} + + + + {{#each item.params as |param|}} + + + + + + {{/each}} + +
{{param.name}}{{param.type}}{{param.description}}
+ {{/if}} + {{/api/x-meta-panel}} + {{/if}} +
diff --git a/addon/components/api/x-sections/component.js b/addon/components/api/x-sections/component.js index 49ab02ebf..65460489f 100644 --- a/addon/components/api/x-sections/component.js +++ b/addon/components/api/x-sections/component.js @@ -1,7 +1,21 @@ import Component from '@ember/component'; -import layout from './template'; +import hbs from 'htmlbars-inline-precompile'; export default Component.extend({ - layout, - tagName: '' + tagName: '', + layout: hbs` + {{#each-in sections as |section items|}} + {{#if items}} +
+

+ {{capitalize section}} +

+ + {{#each items as |item|}} + {{api/x-section item=item}} + {{/each}} +
+ {{/if}} + {{/each-in}} + `, }); diff --git a/addon/components/api/x-sections/style.scss b/addon/components/api/x-sections/style.scss deleted file mode 100644 index 9c79e957f..000000000 --- a/addon/components/api/x-sections/style.scss +++ /dev/null @@ -1,55 +0,0 @@ -.item-section { - margin-bottom: 3em; - - h3 { - margin-top: 1.3em; - position: relative; - - font-family: Monaco, monospace; - font-size: 1.1em; - font-weight: normal; - - strong { - font-weight: bold; - } - } -} - -.item-section__item-header { - a { - color: #333; - text-decoration: none; - } -} - -.item-section__class-header { - .item-section__default-label { - line-height: 1.4em; - vertical-align: text-top; - } - - a { - color: #333; - font-size: 1.4em; - - &:visited { - color: #999; - } - - &:before { - content: '' - } - } -} - -.item-section__default-label { - color: #fff; - background-color: #777; - - padding: 2px 4px; - font-weight: bold; - font-family: Arial, Helvetica, sans-serif; - border-radius: 3px; - font-size: 0.8em; - text-transform: uppercase; -} diff --git a/addon/components/api/x-sections/template.hbs b/addon/components/api/x-sections/template.hbs deleted file mode 100644 index fa25ea073..000000000 --- a/addon/components/api/x-sections/template.hbs +++ /dev/null @@ -1,47 +0,0 @@ -{{#each-in sections as |section items|}} - {{#if items}} -
-

- {{capitalize section}} -

- - {{#each items as |item|}} -
- {{#if (or item.isClass item.isComponent)}} -

- {{#if (eq item.exportType 'default')}} - Default - {{/if}} - - {{#link-to 'docs.api.item' (concat 'modules/' item.id)}} - {{item.name}} - {{/link-to}} -

- - {{{item.description}}} - {{else}} -

- {{#if (eq item.exportType 'default')}} - Default - {{/if}} - - - {{type-signature item}} - -

- -

- {{{item.description}}} -

- -
- {{api/x-import-path item=item}} - - {{api/x-params params=item.params}} -
- {{/if}} -
- {{/each}} -
- {{/if}} -{{/each-in}} diff --git a/addon/components/api/x-toggles/template.hbs b/addon/components/api/x-toggles/template.hbs index 2903fbb30..c4e23cf7f 100644 --- a/addon/components/api/x-toggles/template.hbs +++ b/addon/components/api/x-toggles/template.hbs @@ -1,6 +1,4 @@ -Show: - -