rapidoc 9.3.8 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -61
- package/dist/rapidoc-min.js +279 -3914
- package/package.json +23 -46
- package/.babelrc.json +0 -42
- package/.eslintrc +0 -53
- package/.github/FUNDING.yml +0 -13
- package/.github/workflow/words.yaml +0 -22
- package/CONTRIBUTING.md +0 -35
- package/dist/index.html +0 -1010
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js.LICENSE.txt +0 -64
- package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
- package/dist/rapidoc-min.js.gz +0 -0
- package/dist/rapidoc-min.js.map +0 -1
- package/dist/rapidoc-min.js.map.gz +0 -0
- package/dist/rapidoc.js +0 -21603
- package/dist/report.html +0 -39
- package/index-hashroute.html +0 -65
- package/index.html +0 -1045
- package/index_bak.html +0 -251
- package/jsconfig.json +0 -11
- package/logo.png +0 -0
- package/performance.html +0 -31
- package/src/components/api-request.js +0 -1793
- package/src/components/api-response.js +0 -335
- package/src/components/dialog-box.js +0 -73
- package/src/components/json-tree.js +0 -145
- package/src/components/schema-table.js +0 -367
- package/src/components/schema-tree.js +0 -381
- package/src/components/tag-input.js +0 -135
- package/src/index.js +0 -7
- package/src/json-schema-viewer.js +0 -346
- package/src/oauth-receiver.js +0 -56
- package/src/rapidoc-mini.js +0 -382
- package/src/rapidoc.js +0 -1083
- package/src/styles/border-styles.js +0 -24
- package/src/styles/custom-styles.js +0 -10
- package/src/styles/dialog-box-styles.js +0 -75
- package/src/styles/endpoint-styles.js +0 -202
- package/src/styles/flex-styles.js +0 -15
- package/src/styles/font-styles.js +0 -268
- package/src/styles/info-styles.js +0 -21
- package/src/styles/input-styles.js +0 -207
- package/src/styles/nav-styles.js +0 -198
- package/src/styles/prism-styles.js +0 -105
- package/src/styles/schema-styles.js +0 -121
- package/src/styles/tab-styles.js +0 -47
- package/src/styles/table-styles.js +0 -58
- package/src/templates/advance-search-template.js +0 -72
- package/src/templates/callback-template.js +0 -75
- package/src/templates/code-samples-template.js +0 -34
- package/src/templates/components-template.js +0 -76
- package/src/templates/endpoint-template.js +0 -251
- package/src/templates/expanded-endpoint-template.js +0 -199
- package/src/templates/focused-endpoint-template.js +0 -110
- package/src/templates/header-template.js +0 -66
- package/src/templates/json-schema-viewer-template.js +0 -185
- package/src/templates/logo-template.js +0 -18
- package/src/templates/main-body-template.js +0 -110
- package/src/templates/navbar-template.js +0 -272
- package/src/templates/overview-template.js +0 -79
- package/src/templates/security-scheme-template.js +0 -612
- package/src/templates/server-template.js +0 -115
- package/src/utils/color-utils.js +0 -59
- package/src/utils/common-utils.js +0 -168
- package/src/utils/schema-utils.js +0 -1086
- package/src/utils/spec-parser.js +0 -462
- package/src/utils/theme.js +0 -288
- package/webpack.config.js +0 -142
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
|
|
3
|
-
// Templates
|
|
4
|
-
import expandedEndpointTemplate from '~/templates/expanded-endpoint-template';
|
|
5
|
-
import focusedEndpointTemplate from '~/templates/focused-endpoint-template';
|
|
6
|
-
import overviewTemplate from '~/templates/overview-template';
|
|
7
|
-
import endpointTemplate from '~/templates/endpoint-template';
|
|
8
|
-
import serverTemplate from '~/templates/server-template';
|
|
9
|
-
import securitySchemeTemplate, { recoverPersistedApiKeys } from '~/templates/security-scheme-template';
|
|
10
|
-
import headerTemplate from '~/templates/header-template';
|
|
11
|
-
import navbarTemplate from '~/templates/navbar-template';
|
|
12
|
-
import advancedSearchTemplate from '~/templates/advance-search-template';
|
|
13
|
-
import SetTheme from '~/utils/theme';
|
|
14
|
-
import { isValidHexColor } from '~/utils/color-utils';
|
|
15
|
-
|
|
16
|
-
export default function mainBodyTemplate(isMini = false, pathsExpanded = false) {
|
|
17
|
-
if (!this.resolvedSpec) {
|
|
18
|
-
return '';
|
|
19
|
-
}
|
|
20
|
-
if (this.persistAuth === 'true') {
|
|
21
|
-
recoverPersistedApiKeys.call(this);
|
|
22
|
-
}
|
|
23
|
-
const newTheme = {
|
|
24
|
-
bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',
|
|
25
|
-
fg1: isValidHexColor(this.textColor) ? this.textColor : '',
|
|
26
|
-
headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',
|
|
27
|
-
primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',
|
|
28
|
-
navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',
|
|
29
|
-
navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',
|
|
30
|
-
navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
|
31
|
-
navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
|
|
32
|
-
navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
|
|
33
|
-
navAccentTextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',
|
|
34
|
-
};
|
|
35
|
-
/* eslint-disable indent */
|
|
36
|
-
if (this.resolvedSpec.specLoadError) {
|
|
37
|
-
return html`
|
|
38
|
-
${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
|
|
39
|
-
<div id="spec-not-found" style='display:flex; align-items:center; justify-content: center; border:1px dashed var(--border-color); height:42px; padding:5px; font-size:var(--font-size-small); color:var(--red); font-family:var(--font-mono)'>
|
|
40
|
-
${this.resolvedSpec.info.description}
|
|
41
|
-
</div>
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (this.resolvedSpec.isSpecLoading) {
|
|
46
|
-
return html`
|
|
47
|
-
${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
|
|
48
|
-
<main class='main-content regular-font' part='section-main-content'>
|
|
49
|
-
<slot></slot>
|
|
50
|
-
<div class='main-content-inner--${this.renderStyle}-mode'>
|
|
51
|
-
<div class='loader'></div>
|
|
52
|
-
</div>
|
|
53
|
-
</main>
|
|
54
|
-
`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return html`
|
|
58
|
-
${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
|
|
59
|
-
|
|
60
|
-
<!-- Header -->
|
|
61
|
-
${this.showHeader === 'false' ? '' : headerTemplate.call(this)}
|
|
62
|
-
|
|
63
|
-
<!-- Advanced Search -->
|
|
64
|
-
${this.allowAdvancedSearch === 'false' ? '' : advancedSearchTemplate.call(this)}
|
|
65
|
-
|
|
66
|
-
<div id='the-main-body' class='body ${this.cssClasses}' dir='${this.pageDirection}' >
|
|
67
|
-
<!-- Side Nav -->
|
|
68
|
-
${((this.renderStyle === 'read' || this.renderStyle === 'focused')
|
|
69
|
-
&& this.showSideNav === 'true'
|
|
70
|
-
&& this.resolvedSpec
|
|
71
|
-
) ? navbarTemplate.call(this) : ''
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
<!-- Main Content -->
|
|
75
|
-
<main class='main-content regular-font' tabindex='-1' part='section-main-content'>
|
|
76
|
-
<slot></slot>
|
|
77
|
-
<div class='main-content-inner--${this.renderStyle}-mode'>
|
|
78
|
-
${this.loading === true
|
|
79
|
-
? html`<div class='loader'></div>`
|
|
80
|
-
: html`
|
|
81
|
-
${this.loadFailed === true
|
|
82
|
-
? html`<div style='text-align: center;margin: 16px;'> Unable to load the Spec</div>`
|
|
83
|
-
: html`
|
|
84
|
-
<div class='operations-root' @click='${(e) => { this.handleHref(e); }}'>
|
|
85
|
-
${this.renderStyle === 'focused'
|
|
86
|
-
? html`${focusedEndpointTemplate.call(this)}`
|
|
87
|
-
: html`
|
|
88
|
-
${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
|
|
89
|
-
${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''}
|
|
90
|
-
${this.allowAuthentication === 'true' ? securitySchemeTemplate.call(this) : ''}
|
|
91
|
-
<div id='operations-top' class='observe-me'>
|
|
92
|
-
<slot name='operations-top'></slot>
|
|
93
|
-
</div>
|
|
94
|
-
${this.renderStyle === 'read'
|
|
95
|
-
? expandedEndpointTemplate.call(this)
|
|
96
|
-
: endpointTemplate.call(this, isMini, pathsExpanded)
|
|
97
|
-
}
|
|
98
|
-
`
|
|
99
|
-
}
|
|
100
|
-
</div>
|
|
101
|
-
`
|
|
102
|
-
}`
|
|
103
|
-
}
|
|
104
|
-
</div>
|
|
105
|
-
<slot name='footer'></slot>
|
|
106
|
-
</main>
|
|
107
|
-
</div>
|
|
108
|
-
`;
|
|
109
|
-
}
|
|
110
|
-
/* eslint-enable indent */
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { marked } from 'marked';
|
|
3
|
-
import { getMatchedPaths } from '~/utils/common-utils';
|
|
4
|
-
|
|
5
|
-
export function expandCollapseNavBarTag(navLinkEl, action = 'toggle') {
|
|
6
|
-
const tagAndPathEl = navLinkEl?.closest('.nav-bar-tag-and-paths');
|
|
7
|
-
const pathsUnderTagEl = tagAndPathEl?.querySelector('.nav-bar-paths-under-tag');
|
|
8
|
-
if (tagAndPathEl) {
|
|
9
|
-
const isExpanded = tagAndPathEl.classList.contains('expanded');
|
|
10
|
-
if (isExpanded && (action === 'toggle' || action === 'collapse')) {
|
|
11
|
-
pathsUnderTagEl.style.maxHeight = 0;
|
|
12
|
-
tagAndPathEl.classList.replace('expanded', 'collapsed');
|
|
13
|
-
} else if (!isExpanded && (action === 'toggle' || action === 'expand')) {
|
|
14
|
-
tagAndPathEl.classList.replace('collapsed', 'expanded');
|
|
15
|
-
pathsUnderTagEl.style.maxHeight = `${pathsUnderTagEl.scrollHeight}px`;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function expandCollapseAll(event, action = 'expand-all') {
|
|
21
|
-
if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const navEl = event.target.closest('.nav-scroll');
|
|
25
|
-
const elList = [...navEl.querySelectorAll('.nav-bar-tag-and-paths')];
|
|
26
|
-
if (action === 'expand-all') {
|
|
27
|
-
elList.forEach((el) => {
|
|
28
|
-
const navBarPathsUnderTagEl = el.querySelector('.nav-bar-paths-under-tag');
|
|
29
|
-
el.classList.replace('collapsed', 'expanded');
|
|
30
|
-
navBarPathsUnderTagEl.style.maxHeight = `${navBarPathsUnderTagEl?.scrollHeight}px`;
|
|
31
|
-
});
|
|
32
|
-
} else {
|
|
33
|
-
elList.forEach((el) => {
|
|
34
|
-
el.classList.replace('expanded', 'collapsed');
|
|
35
|
-
el.querySelector('.nav-bar-paths-under-tag').style.maxHeight = 0;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function navBarClickAndEnterHandler(event) {
|
|
41
|
-
if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const navEl = event.target;
|
|
45
|
-
event.stopPropagation();
|
|
46
|
-
if (navEl.dataset?.action === 'navigate') {
|
|
47
|
-
this.scrollToEventTarget(event, false);
|
|
48
|
-
} else if (navEl.dataset?.action === 'expand-all' || (navEl.dataset?.action === 'collapse-all')) {
|
|
49
|
-
expandCollapseAll(event, navEl.dataset.action);
|
|
50
|
-
} else if (navEl.dataset?.action === 'expand-collapse-tag') {
|
|
51
|
-
expandCollapseNavBarTag(navEl, 'toggle');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* eslint-disable indent */
|
|
56
|
-
export default function navbarTemplate() {
|
|
57
|
-
if (!this.resolvedSpec || this.resolvedSpec.specLoadError) {
|
|
58
|
-
return html`
|
|
59
|
-
<nav class='nav-bar' part='section-navbar'>
|
|
60
|
-
<slot name='nav-logo' class='logo'></slot>
|
|
61
|
-
</nav>
|
|
62
|
-
`;
|
|
63
|
-
}
|
|
64
|
-
return html`
|
|
65
|
-
<nav class='nav-bar ${this.renderStyle}' part='section-navbar'>
|
|
66
|
-
<slot name='nav-logo' class='logo'></slot>
|
|
67
|
-
${(this.allowSearch === 'false' && this.allowAdvancedSearch === 'false')
|
|
68
|
-
? ''
|
|
69
|
-
: html`
|
|
70
|
-
<div style='display:flex; flex-direction:row; justify-content:center; align-items:stretch; padding:8px 24px 12px 24px; ${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}' part='section-navbar-search'>
|
|
71
|
-
${this.allowSearch === 'false'
|
|
72
|
-
? ''
|
|
73
|
-
: html`
|
|
74
|
-
<div style = 'display:flex; flex:1; line-height:22px;'>
|
|
75
|
-
<input id = 'nav-bar-search'
|
|
76
|
-
part = 'textbox textbox-nav-filter'
|
|
77
|
-
style = 'width:100%; padding-right:20px; color:var(--nav-hover-text-color); border-color:var(--nav-accent-color); background-color:var(--nav-hover-bg-color)'
|
|
78
|
-
type = 'text'
|
|
79
|
-
placeholder = 'Filter'
|
|
80
|
-
@change = '${this.onSearchChange}'
|
|
81
|
-
spellcheck = 'false'
|
|
82
|
-
>
|
|
83
|
-
<div style='margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;'>↩</div>
|
|
84
|
-
</div>
|
|
85
|
-
${this.searchVal
|
|
86
|
-
? html`
|
|
87
|
-
<button @click = '${this.onClearSearch}' class='m-btn thin-border' style='margin-left:5px; color:var(--nav-text-color); width:75px; padding:6px 8px;' part='btn btn-outline btn-clear-filter'>
|
|
88
|
-
CLEAR
|
|
89
|
-
</button>`
|
|
90
|
-
: ''
|
|
91
|
-
}
|
|
92
|
-
`
|
|
93
|
-
}
|
|
94
|
-
${this.allowAdvancedSearch === 'false' || this.searchVal
|
|
95
|
-
? ''
|
|
96
|
-
: html`
|
|
97
|
-
<button class='m-btn primary' part='btn btn-fill btn-search' style='margin-left:5px; padding:6px 8px; width:75px' @click='${this.onShowSearchModalClicked}'>
|
|
98
|
-
SEARCH
|
|
99
|
-
</button>
|
|
100
|
-
`
|
|
101
|
-
}
|
|
102
|
-
</div>
|
|
103
|
-
`
|
|
104
|
-
}
|
|
105
|
-
${html`<nav class='nav-scroll' tabindex='-1' part='section-navbar-scroll' @click='${(e) => navBarClickAndEnterHandler.call(this, e)}' @keyup='${(e) => navBarClickAndEnterHandler.call(this, e)}' >
|
|
106
|
-
${(this.showInfo === 'false' || !this.resolvedSpec.info)
|
|
107
|
-
? ''
|
|
108
|
-
: html`
|
|
109
|
-
${(this.infoDescriptionHeadingsInNavBar === 'true')
|
|
110
|
-
? html`
|
|
111
|
-
${this.resolvedSpec.infoDescriptionHeaders.length > 0
|
|
112
|
-
? html`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-overview' data-content-id='overview' data-action='navigate' tabindex='0' part='section-navbar-item section-navbar-overview'>
|
|
113
|
-
${this.resolvedSpec.info?.title?.trim() || 'Overview'}
|
|
114
|
-
</div>`
|
|
115
|
-
: ''
|
|
116
|
-
}
|
|
117
|
-
<div class='overview-headers'>
|
|
118
|
-
${this.resolvedSpec.infoDescriptionHeaders.map((header) => html`
|
|
119
|
-
<div
|
|
120
|
-
class='nav-bar-h${header.depth} ${this.navActiveItemMarker}'
|
|
121
|
-
id='link-overview--${new marked.Slugger().slug(header.text)}'
|
|
122
|
-
data-action='navigate'
|
|
123
|
-
data-content-id='overview--${new marked.Slugger().slug(header.text)}'
|
|
124
|
-
>
|
|
125
|
-
${header.text}
|
|
126
|
-
</div>`)
|
|
127
|
-
}
|
|
128
|
-
</div>
|
|
129
|
-
${this.resolvedSpec.infoDescriptionHeaders.length > 0 ? html`<hr style='border-top: 1px solid var(--nav-hover-bg-color); border-width:1px 0 0 0; margin: 15px 0 0 0'/>` : ''}
|
|
130
|
-
`
|
|
131
|
-
: html`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-overview' data-action='navigate' data-content-id='overview' tabindex='0'>
|
|
132
|
-
${this.resolvedSpec.info?.title?.trim() || 'Overview'}
|
|
133
|
-
</div>`
|
|
134
|
-
}
|
|
135
|
-
`
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
${this.allowServerSelection === 'false'
|
|
139
|
-
? ''
|
|
140
|
-
: html`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-servers' data-action='navigate' data-content-id='servers' tabindex='0' part='section-navbar-item section-navbar-servers'> API Servers </div>`
|
|
141
|
-
}
|
|
142
|
-
${(this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes)
|
|
143
|
-
? ''
|
|
144
|
-
: html`<div class='nav-bar-info ${this.navActiveItemMarker}' id='link-auth' data-action='navigate' data-content-id='auth' tabindex='0' part='section-navbar-item section-navbar-auth'> Authentication </div>`
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
<div id='link-operations-top' class='nav-bar-section operations' data-action='navigate' data-content-id='${this.renderStyle === 'focused' ? '' : 'operations-top'}' part='section-navbar-item section-navbar-operations-top'>
|
|
148
|
-
<div style='font-size:16px; display:flex; margin-left:10px;'>
|
|
149
|
-
${this.renderStyle === 'focused'
|
|
150
|
-
? html`
|
|
151
|
-
<div class='nav-bar-expand-all'
|
|
152
|
-
data-action='expand-all'
|
|
153
|
-
tabindex='0'
|
|
154
|
-
title='Expand all'
|
|
155
|
-
>▸</div>
|
|
156
|
-
<div class='nav-bar-collapse-all'
|
|
157
|
-
data-action='collapse-all'
|
|
158
|
-
tabindex='0'
|
|
159
|
-
title='Collapse all'
|
|
160
|
-
>▸</div>`
|
|
161
|
-
: ''
|
|
162
|
-
}
|
|
163
|
-
</div>
|
|
164
|
-
<div class='nav-bar-section-title'> OPERATIONS </div>
|
|
165
|
-
</div>
|
|
166
|
-
|
|
167
|
-
<!-- TAGS AND PATHS-->
|
|
168
|
-
${this.resolvedSpec.tags
|
|
169
|
-
.filter((tag) => tag.paths.filter((path) => getMatchedPaths(this.searchVal, path, tag.name)).length)
|
|
170
|
-
.map((tag) => html`
|
|
171
|
-
<div class='nav-bar-tag-and-paths ${(this.renderStyle === 'read' ? 'expanded' : (tag.expanded ? 'expanded' : 'collapsed'))}' >
|
|
172
|
-
${tag.name === 'General ⦂'
|
|
173
|
-
? html`<hr style='border:none; border-top: 1px dotted var(--nav-text-color); opacity:0.3; margin:-1px 0 0 0;'/>`
|
|
174
|
-
: html`
|
|
175
|
-
<div
|
|
176
|
-
class='nav-bar-tag ${this.navActiveItemMarker}'
|
|
177
|
-
part='section-navbar-item section-navbar-tag'
|
|
178
|
-
id='link-${tag.elementId}'
|
|
179
|
-
data-action='${(this.renderStyle === 'read' ? 'navigate' : this.onNavTagClick === 'show-description') ? 'navigate' : 'expand-collapse-tag'}'
|
|
180
|
-
data-content-id='${(this.renderStyle === 'read' ? `${tag.elementId}` : this.onNavTagClick === 'show-description') ? `${tag.elementId}` : ''}'
|
|
181
|
-
data-first-path-id='${tag.firstPathId}'
|
|
182
|
-
tabindex='0'
|
|
183
|
-
>
|
|
184
|
-
<div style="pointer-events:none;">${tag.displayName || tag.name}</div>
|
|
185
|
-
<div class='nav-bar-tag-icon' tabindex='0' data-action='expand-collapse-tag'></div>
|
|
186
|
-
</div>
|
|
187
|
-
`
|
|
188
|
-
}
|
|
189
|
-
${(this.infoDescriptionHeadingsInNavBar === 'true')
|
|
190
|
-
? html`
|
|
191
|
-
${this.renderStyle === 'focused' && this.onNavTagClick === 'expand-collapse'
|
|
192
|
-
? ''
|
|
193
|
-
: html`
|
|
194
|
-
<div class='tag-headers'>
|
|
195
|
-
${tag.headers.map((header) => html`
|
|
196
|
-
<div
|
|
197
|
-
class='nav-bar-h${header.depth} ${this.navActiveItemMarker}'
|
|
198
|
-
part='section-navbar-item section-navbar-h${header.depth}'
|
|
199
|
-
id='link-${tag.elementId}--${new marked.Slugger().slug(header.text)}'
|
|
200
|
-
data-action='navigate'
|
|
201
|
-
data-content-id='${tag.elementId}--${new marked.Slugger().slug(header.text)}'
|
|
202
|
-
tabindex='0'
|
|
203
|
-
> ${header.text}</div>`)}
|
|
204
|
-
</div>`
|
|
205
|
-
}`
|
|
206
|
-
: ''
|
|
207
|
-
}
|
|
208
|
-
<div class='nav-bar-paths-under-tag' style='max-height:${(tag.expanded || this.renderStyle === 'read') ? ((tag.paths?.length || 1) * 50) : 0}px;'>
|
|
209
|
-
<!-- Paths in each tag (endpoints) -->
|
|
210
|
-
${tag.paths.filter((v) => {
|
|
211
|
-
if (this.searchVal) {
|
|
212
|
-
return getMatchedPaths(this.searchVal, v, tag.name);
|
|
213
|
-
}
|
|
214
|
-
return true;
|
|
215
|
-
}).map((p) => html`
|
|
216
|
-
<div
|
|
217
|
-
class='nav-bar-path ${this.navActiveItemMarker} ${this.usePathInNavBar === 'true' ? 'small-font' : ''}'
|
|
218
|
-
part='section-navbar-item section-navbar-path'
|
|
219
|
-
data-action='navigate'
|
|
220
|
-
data-content-id='${p.elementId}'
|
|
221
|
-
id='link-${p.elementId}'
|
|
222
|
-
tabindex='0'
|
|
223
|
-
>
|
|
224
|
-
<span style = 'display:flex; pointer-events: none; align-items:start; ${p.deprecated ? 'filter:opacity(0.5)' : ''}'>
|
|
225
|
-
${html`<span class='nav-method ${this.showMethodInNavBar} ${p.method}' style='pointer-events: none;'>
|
|
226
|
-
${this.showMethodInNavBar === 'as-colored-block' ? p.method.substring(0, 3).toUpperCase() : p.method.toUpperCase()}
|
|
227
|
-
</span>`
|
|
228
|
-
}
|
|
229
|
-
${p.isWebhook ? html`<span style='font-weight:bold; pointer-events: none; margin-right:8px; font-size: calc(var(--font-size-small) - 2px)'>WEBHOOK</span>` : ''}
|
|
230
|
-
${this.usePathInNavBar === 'true'
|
|
231
|
-
? html`<span style='pointer-events: none;' class='mono-font'>${p.path}</span>`
|
|
232
|
-
: p.summary || p.shortSummary
|
|
233
|
-
}
|
|
234
|
-
</span>
|
|
235
|
-
</div>`)}
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
`)
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
<!-- COMPONENTS -->
|
|
242
|
-
${this.resolvedSpec.components && this.showComponents === 'true' && this.renderStyle === 'focused'
|
|
243
|
-
? html`
|
|
244
|
-
<div id='link-components' class='nav-bar-section components'>
|
|
245
|
-
<div></div>
|
|
246
|
-
<div class='nav-bar-section-title'>COMPONENTS</div>
|
|
247
|
-
</div>
|
|
248
|
-
${this.resolvedSpec.components.map((component) => (component.subComponents.length
|
|
249
|
-
? html`
|
|
250
|
-
<div class='nav-bar-tag'
|
|
251
|
-
part='section-navbar-item section-navbar-tag'
|
|
252
|
-
data-action='navigate'
|
|
253
|
-
data-content-id='cmp--${component.name.toLowerCase()}'
|
|
254
|
-
id='link-cmp--${component.name.toLowerCase()}'
|
|
255
|
-
>
|
|
256
|
-
${component.name}
|
|
257
|
-
</div>
|
|
258
|
-
${component.subComponents.filter((p) => p.expanded !== false).map((p) => html`
|
|
259
|
-
<div class='nav-bar-path' data-action='navigate' data-content-id='cmp--${p.id}' id='link-cmp--${p.id}'>
|
|
260
|
-
<span style = 'pointer-events: none;'> ${p.name} </span>
|
|
261
|
-
</div>`)
|
|
262
|
-
}`
|
|
263
|
-
: ''))
|
|
264
|
-
}`
|
|
265
|
-
: ''
|
|
266
|
-
}
|
|
267
|
-
</nav>`
|
|
268
|
-
}
|
|
269
|
-
</nav>
|
|
270
|
-
`;
|
|
271
|
-
}
|
|
272
|
-
/* eslint-enable indent */
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
3
|
-
import { marked } from 'marked';
|
|
4
|
-
import { downloadResource, viewResource } from '~/utils/common-utils';
|
|
5
|
-
|
|
6
|
-
/* eslint-disable indent */
|
|
7
|
-
function headingRenderer() {
|
|
8
|
-
const renderer = new marked.Renderer();
|
|
9
|
-
renderer.heading = ((text, level, raw, slugger) => `<h${level} class="observe-me" id="overview--${slugger.slug(raw)}">${text}</h${level}>`);
|
|
10
|
-
return renderer;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default function overviewTemplate() {
|
|
14
|
-
return html`
|
|
15
|
-
<section id="overview" part="section-overview"
|
|
16
|
-
class="observe-me ${this.renderStyle === 'view' ? 'section-gap' : 'section-gap--read-mode'}">
|
|
17
|
-
${this.resolvedSpec?.info
|
|
18
|
-
? html`
|
|
19
|
-
<div id="api-title" part="section-overview-title" style="font-size:32px">
|
|
20
|
-
${this.resolvedSpec.info.title}
|
|
21
|
-
${!this.resolvedSpec.info.version ? '' : html`
|
|
22
|
-
<span style = 'font-size:var(--font-size-small);font-weight:bold'>
|
|
23
|
-
${this.resolvedSpec.info.version}
|
|
24
|
-
</span>`
|
|
25
|
-
}
|
|
26
|
-
</div>
|
|
27
|
-
<div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px); margin-top:8px;">
|
|
28
|
-
${this.resolvedSpec.info.contact?.email
|
|
29
|
-
? html`<span>${this.resolvedSpec.info.contact.name || 'Email'}:
|
|
30
|
-
<a href="mailto:${this.resolvedSpec.info.contact.email}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a>
|
|
31
|
-
</span>`
|
|
32
|
-
: ''
|
|
33
|
-
}
|
|
34
|
-
${this.resolvedSpec.info.contact?.url
|
|
35
|
-
? html`<span>URL: <a href="${this.resolvedSpec.info.contact.url}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>`
|
|
36
|
-
: ''
|
|
37
|
-
}
|
|
38
|
-
${this.resolvedSpec.info.license
|
|
39
|
-
? html`<span>License:
|
|
40
|
-
${this.resolvedSpec.info.license.url
|
|
41
|
-
? html`<a href="${this.resolvedSpec.info.license.url}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>`
|
|
42
|
-
: this.resolvedSpec.info.license.name
|
|
43
|
-
} </span>`
|
|
44
|
-
: ''
|
|
45
|
-
}
|
|
46
|
-
${this.resolvedSpec.info.termsOfService
|
|
47
|
-
? html`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">Terms of Service</a></span>`
|
|
48
|
-
: ''
|
|
49
|
-
}
|
|
50
|
-
${this.specUrl && this.allowSpecFileDownload === 'true'
|
|
51
|
-
? html`
|
|
52
|
-
<div style="display:flex; margin:12px 0; gap:8px; justify-content: start;">
|
|
53
|
-
<button class="m-btn thin-border" style="min-width:170px" part="btn btn-outline" @click='${(e) => { downloadResource(this.specUrl, 'openapi-spec', e); }}'>Download OpenAPI spec</button>
|
|
54
|
-
${this.specUrl?.trim().toLowerCase().endsWith('json')
|
|
55
|
-
? html`<button class="m-btn thin-border" style="width:200px" part="btn btn-outline" @click='${(e) => { viewResource(this.specUrl, e); }}'>View OpenAPI spec (New Tab)</button>`
|
|
56
|
-
: ''
|
|
57
|
-
}
|
|
58
|
-
</div>`
|
|
59
|
-
: ''
|
|
60
|
-
}
|
|
61
|
-
</div>
|
|
62
|
-
<slot name="overview"></slot>
|
|
63
|
-
<div id="api-description">
|
|
64
|
-
${this.resolvedSpec.info.description
|
|
65
|
-
? html`${
|
|
66
|
-
unsafeHTML(`
|
|
67
|
-
<div class="m-markdown regular-font">
|
|
68
|
-
${marked(this.resolvedSpec.info.description, this.infoDescriptionHeadingsInNavBar === 'true' ? { renderer: headingRenderer() } : undefined)}
|
|
69
|
-
</div>`)}`
|
|
70
|
-
: ''
|
|
71
|
-
}
|
|
72
|
-
</div>
|
|
73
|
-
`
|
|
74
|
-
: ''
|
|
75
|
-
}
|
|
76
|
-
</section>
|
|
77
|
-
`;
|
|
78
|
-
}
|
|
79
|
-
/* eslint-enable indent */
|