-
-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathindex.js
More file actions
93 lines (74 loc) · 2.2 KB
/
Copy pathindex.js
File metadata and controls
93 lines (74 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { classify } from '../../utils/string';
import { addonPrefix } from 'ember-cli-addon-docs/utils/computed';
import { inject as service } from '@ember/service';
import { reads } from '@ember/object/computed';
import { action } from '@ember/object';
import { addonDocsConfig } from 'ember-cli-addon-docs/-private/config';
/**
Render a header showing a link to your documentation, your project logo, a
search bar, and a link to your repo on GitHub.
Yields a `link` contextual component which can be used to add additional
header links.
```hbs
<DocsHeader as |header|>
<header.link @route="sandbox">
Sandbox
</header.link>
</DocsHeader>
```
@class DocsHeader
@public
@yield {Hash} header
@yield {Component} header.link
*/
export default class DocsHeader extends Component {
@service projectVersion;
@addonDocsConfig config;
@tracked query;
constructor() {
super(...arguments);
this.projectVersion.loadAvailableVersions();
}
/**
The prefix of your project, typically "Ember", "EmberCLI" or "EmberData".
By default the prefix will be autodiscovered from the `name` field of your addon's package.json.
```hbs
<DocsHeader @prefix="EmberData"/>
```
@argument prefix
@type String?
*/
get prefix() {
return this.args.prefix ?? addonPrefix(this.config.projectName);
}
/**
The name of your project (without the "ember", "ember-cli" or "ember-data" prefix).
By default the name will be autodiscovered from the `name` field of your addon's package.json.
```hbs
<DocsHeader @name="MyProject"/>
```
@argument name
@type String?
*/
get name() {
if (this.args.name) {
return this.args.name;
} else {
let name = this.config.projectName;
name = name.replace('ember-data-', '');
name = name.replace('ember-cli-', '');
name = name.replace('ember-', '');
return classify(name);
}
}
@reads('projectVersion.currentVersion')
currentVersion;
@action
didVisitPage() {
this.query = null;
let search = document.querySelector('[data-search-box-input]');
search.blur();
}
}