|
1 | 1 | import { service } from '@ember/service'; |
2 | 2 | import Component from '@glimmer/component'; |
3 | | -import join from "ember-composable-helpers/helpers/join"; |
4 | | -import mapBy from "ember-composable-helpers/helpers/map-by"; |
5 | | -import svgJar from "ember-svg-jar/helpers/svg-jar"; |
6 | | -import { LinkTo } from "@ember/routing"; |
7 | | -import { array, concat } from "@ember/helper"; |
8 | | -import githubLink from "ember-api-docs/helpers/github-link"; |
9 | | -import and from "ember-truth-helpers/helpers/and"; |
10 | | -import eq from "ember-api-docs/helpers/eq"; |
11 | | -import ImportExample from "ember-api-docs/components/import-example"; |
12 | | -import MarkdownToHtml from "ember-cli-showdown/components/markdown-to-html"; |
| 3 | +import join from 'ember-composable-helpers/helpers/join'; |
| 4 | +import mapBy from 'ember-composable-helpers/helpers/map-by'; |
| 5 | +import svgJar from 'ember-svg-jar/helpers/svg-jar'; |
| 6 | +import { LinkTo } from '@ember/routing'; |
| 7 | +import { array, concat } from '@ember/helper'; |
| 8 | +import githubLink from 'ember-api-docs/helpers/github-link'; |
| 9 | +import and from 'ember-truth-helpers/helpers/and'; |
| 10 | +import eq from 'ember-api-docs/helpers/eq'; |
| 11 | +import ImportExample from 'ember-api-docs/components/import-example'; |
| 12 | +import MarkdownToHtml from 'ember-cli-showdown/components/markdown-to-html'; |
13 | 13 |
|
14 | | -export default class ClassFieldDescription extends Component {<template>{{!-- template-lint-disable no-invalid-interactive --}} |
15 | | -<section class="class-field-description {{@type}}"> |
16 | | - <h3 id="{{@field.name}}" class="class-field-description--header"> |
17 | | - <span class="signature"> |
18 | | - <span class="{{@type}}-name"> |
19 | | - {{@field.name}} |
20 | | - </span> |
21 | | - {{#if @field.params}}(<span class="args">{{join ", " (mapBy "name" @field.params)}}</span>){{/if}} |
22 | | - {{#if @field.return}} |
23 | | - : <span class="return-type">{{@field.return.type}}</span> |
| 14 | +export default class ClassFieldDescription extends Component { |
| 15 | + <template> |
| 16 | + {{! template-lint-disable no-invalid-interactive }} |
| 17 | + <section class="class-field-description {{@type}}"> |
| 18 | + <h3 id="{{@field.name}}" class="class-field-description--header"> |
| 19 | + <span class="signature"> |
| 20 | + <span class="{{@type}}-name"> |
| 21 | + {{@field.name}} |
| 22 | + </span> |
| 23 | + {{#if @field.params}}(<span class="args">{{join |
| 24 | + ", " |
| 25 | + (mapBy "name" @field.params) |
| 26 | + }}</span>){{/if}} |
| 27 | + {{#if @field.return}} |
| 28 | + : |
| 29 | + <span class="return-type">{{@field.return.type}}</span> |
| 30 | + {{/if}} |
| 31 | + </span> |
| 32 | + {{#if @field.access}} |
| 33 | + <span class="access">{{@field.access}}</span> |
| 34 | + {{/if}} |
| 35 | + {{#if @field.deprecated}} |
| 36 | + <span class="access">deprecated</span> |
| 37 | + {{/if}} |
| 38 | + <a |
| 39 | + class="class-field-description--link" |
| 40 | + href="#{{@field.name}}" |
| 41 | + aria-label="Jump to {{@field.name}}" |
| 42 | + > |
| 43 | + {{svgJar "link" width="20px" height="20px" aria-hidden="true"}} |
| 44 | + </a> |
| 45 | + </h3> |
| 46 | + {{#if @model.module}} |
| 47 | + <div class="attributes"> |
| 48 | + <div class="attribute"> |
| 49 | + <span class="attribute-label">Module:</span> |
| 50 | + <span class="attribute-value"><LinkTo |
| 51 | + @route="project-version.modules.module" |
| 52 | + @models={{array |
| 53 | + @model.projectVersion.compactVersion |
| 54 | + @model.module |
| 55 | + }} |
| 56 | + >{{@model.module}}</LinkTo></span> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + {{/if}} |
| 60 | + <p class="github-link" data-test-file={{@field.file}}> |
| 61 | + {{#if @field.inherited}} |
| 62 | + Inherited from |
| 63 | + <a |
| 64 | + href="{{githubLink |
| 65 | + @model.project.id |
| 66 | + @model.projectVersion.version |
| 67 | + @field.file |
| 68 | + @field.line |
| 69 | + }}" |
| 70 | + target="_blank" |
| 71 | + rel="noopener noreferrer" |
| 72 | + > |
| 73 | + {{@field.inheritedFrom}} |
| 74 | + {{@field.file}}:{{@field.line}} |
| 75 | + </a> |
| 76 | + {{else}} |
| 77 | + Defined in |
| 78 | + <a |
| 79 | + href="{{githubLink |
| 80 | + @model.project.id |
| 81 | + @model.projectVersion.version |
| 82 | + @field.file |
| 83 | + @field.line |
| 84 | + }}" |
| 85 | + target="_blank" |
| 86 | + rel="noopener noreferrer" |
| 87 | + > |
| 88 | + {{@field.file}}:{{@field.line}} |
| 89 | + </a> |
| 90 | + {{/if}} |
| 91 | + </p> |
| 92 | + {{#if @field.since}} |
| 93 | + <p class="field-since"> |
| 94 | + Available since v{{@field.since}} |
| 95 | + </p> |
| 96 | + {{/if}} |
| 97 | + {{#if |
| 98 | + (and |
| 99 | + (eq @field.static 1) |
| 100 | + (eq @field.itemtype "method") |
| 101 | + this.hasImportExample |
| 102 | + ) |
| 103 | + }} |
| 104 | + <ImportExample |
| 105 | + @item={{concat "{ " @field.name " }"}} |
| 106 | + @package={{@field.class}} |
| 107 | + /> |
24 | 108 | {{/if}} |
25 | | - </span> |
26 | | - {{#if @field.access}} |
27 | | - <span class="access">{{@field.access}}</span> |
28 | | - {{/if}} |
29 | | - {{#if @field.deprecated}} |
30 | | - <span class="access">deprecated</span> |
31 | | - {{/if}} |
32 | | - <a class="class-field-description--link" href="#{{@field.name}}" aria-label="Jump to {{@field.name}}"> |
33 | | - {{svgJar "link" width="20px" height="20px" aria-hidden="true"}} |
34 | | - </a> |
35 | | - </h3> |
36 | | - {{#if @model.module}} |
37 | | - <div class="attributes"> |
38 | | - <div class="attribute"> |
39 | | - <span class="attribute-label">Module:</span> |
40 | | - <span class="attribute-value"><LinkTo @route="project-version.modules.module" @models={{array @model.projectVersion.compactVersion @model.module}}>{{@model.module}}</LinkTo></span> |
41 | | - </div> |
42 | | - </div> |
43 | | - {{/if}} |
44 | | - <p class="github-link" data-test-file={{@field.file}}> |
45 | | - {{#if @field.inherited}} |
46 | | - Inherited from |
47 | | - <a href="{{githubLink @model.project.id @model.projectVersion.version @field.file @field.line}}" target="_blank" rel="noopener noreferrer"> |
48 | | - {{@field.inheritedFrom}} {{@field.file}}:{{@field.line}} |
49 | | - </a> |
50 | | - {{else}} |
51 | | - Defined in |
52 | | - <a href="{{githubLink @model.project.id @model.projectVersion.version @field.file @field.line}}" target="_blank" rel="noopener noreferrer"> |
53 | | - {{@field.file}}:{{@field.line}} |
54 | | - </a> |
55 | | - {{/if}} |
56 | | - </p> |
57 | | - {{#if @field.since}} |
58 | | - <p class="field-since"> |
59 | | - Available since v{{@field.since}} |
60 | | - </p> |
61 | | - {{/if}} |
62 | | - {{#if (and (eq @field.static 1) (eq @field.itemtype "method") this.hasImportExample)}} |
63 | | - <ImportExample @item={{concat "{ " @field.name " }"}} @package={{@field.class}} /> |
64 | | - {{/if}} |
65 | | - <dl class="parameters"> |
66 | | - {{#each @field.params as |param|}} |
67 | | - <div class="parameter"> |
68 | | - <dt>{{param.name}}</dt> |
69 | | - <dd class="parameter-type">{{param.type}}</dd> |
70 | | - <dd><MarkdownToHtml @markdown={{param.description}} /></dd> |
71 | | - {{#if param.props}} |
72 | | - <dl class="parameters"> |
73 | | - {{#each param.props as |prop|}} |
74 | | - <div class="prop"> |
75 | | - <dt>{{prop.name}}</dt> |
76 | | - <dd class="parameter-type">{{prop.type}}</dd> |
77 | | - <dd><MarkdownToHtml @markdown={{prop.description}} /></dd> |
78 | | - </div> |
79 | | - {{/each}} |
80 | | - </dl> |
| 109 | + <dl class="parameters"> |
| 110 | + {{#each @field.params as |param|}} |
| 111 | + <div class="parameter"> |
| 112 | + <dt>{{param.name}}</dt> |
| 113 | + <dd class="parameter-type">{{param.type}}</dd> |
| 114 | + <dd><MarkdownToHtml @markdown={{param.description}} /></dd> |
| 115 | + {{#if param.props}} |
| 116 | + <dl class="parameters"> |
| 117 | + {{#each param.props as |prop|}} |
| 118 | + <div class="prop"> |
| 119 | + <dt>{{prop.name}}</dt> |
| 120 | + <dd class="parameter-type">{{prop.type}}</dd> |
| 121 | + <dd><MarkdownToHtml @markdown={{prop.description}} /></dd> |
| 122 | + </div> |
| 123 | + {{/each}} |
| 124 | + </dl> |
| 125 | + {{/if}} |
| 126 | + </div> |
| 127 | + {{/each}} |
| 128 | + {{#if @field.return}} |
| 129 | + <div class="return"> |
| 130 | + <dt>returns</dt> |
| 131 | + <dd class="return-type">{{@field.return.type}}</dd> |
| 132 | + <dd><MarkdownToHtml @markdown={{@field.return.description}} /></dd> |
| 133 | + </div> |
81 | 134 | {{/if}} |
82 | | - </div> |
83 | | - {{/each}} |
84 | | - {{#if @field.return}} |
85 | | - <div class="return"> |
86 | | - <dt>returns</dt> |
87 | | - <dd class="return-type">{{@field.return.type}}</dd> |
88 | | - <dd><MarkdownToHtml @markdown={{@field.return.description}} /></dd> |
89 | | - </div> |
90 | | - {{/if}} |
91 | | - </dl> |
92 | | - <MarkdownToHtml @markdown={{@field.description}} /> |
93 | | -</section> |
94 | | -</template> |
| 135 | + </dl> |
| 136 | + <MarkdownToHtml @markdown={{@field.description}} /> |
| 137 | + </section> |
| 138 | + </template> |
95 | 139 | @service |
96 | 140 | legacyModuleMappings; |
97 | 141 |
|
|
0 commit comments