rapidoc 9.3.2 → 9.3.4
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/.github/workflow/words.yaml +22 -0
- package/dist/index.html +1 -1
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js +857 -738
- package/dist/rapidoc-min.js.LICENSE.txt +9 -10
- package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
- package/dist/rapidoc-min.js.gz +0 -0
- package/dist/rapidoc-min.js.map +1 -1
- package/dist/rapidoc-min.js.map.gz +0 -0
- package/dist/rapidoc.js +9341 -25092
- package/dist/report.html +5 -4
- package/index.html +2 -3
- package/package.json +20 -19
- package/src/components/api-request.js +344 -154
- package/src/components/api-response.js +16 -12
- package/src/components/json-tree.js +17 -12
- package/src/components/schema-table.js +50 -42
- package/src/components/schema-tree.js +56 -53
- package/src/components/tag-input.js +7 -4
- package/src/json-schema-viewer.js +1 -2
- package/src/rapidoc-mini.js +1 -3
- package/src/rapidoc.js +112 -45
- package/src/styles/endpoint-styles.js +1 -1
- package/src/styles/font-styles.js +1 -1
- package/src/styles/info-styles.js +2 -1
- package/src/styles/input-styles.js +2 -16
- package/src/styles/nav-styles.js +57 -10
- package/src/styles/schema-styles.js +27 -15
- package/src/styles/tab-styles.js +1 -0
- package/src/templates/callback-template.js +6 -7
- package/src/templates/code-samples-template.js +1 -0
- package/src/templates/components-template.js +3 -5
- package/src/templates/endpoint-template.js +41 -27
- package/src/templates/expanded-endpoint-template.js +63 -13
- package/src/templates/focused-endpoint-template.js +4 -1
- package/src/templates/header-template.js +2 -2
- package/src/templates/json-schema-viewer-template.js +2 -1
- package/src/templates/main-body-template.js +19 -18
- package/src/templates/navbar-template.js +98 -81
- package/src/templates/overview-template.js +1 -1
- package/src/templates/security-scheme-template.js +48 -25
- package/src/templates/server-template.js +1 -1
- package/src/utils/common-utils.js +2 -5
- package/src/utils/schema-utils.js +208 -83
- package/src/utils/spec-parser.js +1 -0
- package/src/utils/theme.js +11 -5
- package/webpack.config.js +2 -1
|
@@ -10,6 +10,7 @@ export default css`
|
|
|
10
10
|
width: 100%;
|
|
11
11
|
box-sizing: content-box;
|
|
12
12
|
border-bottom: 1px dotted transparent;
|
|
13
|
+
transition: max-height 0.3s ease-out;
|
|
13
14
|
}
|
|
14
15
|
.td {
|
|
15
16
|
display: block;
|
|
@@ -21,9 +22,29 @@ export default css`
|
|
|
21
22
|
word-break: break-all;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
.collapsed-descr .key {
|
|
25
|
+
.collapsed-all-descr .key {
|
|
25
26
|
overflow:hidden;
|
|
26
27
|
}
|
|
28
|
+
.expanded-all-descr .key-descr .descr-expand-toggle {
|
|
29
|
+
display:none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.key-descr .descr-expand-toggle {
|
|
33
|
+
display:inline-block;
|
|
34
|
+
user-select:none;
|
|
35
|
+
color: var(--fg);
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transform: rotate(45deg);
|
|
38
|
+
transition: transform .2s ease;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.expanded-descr .key-descr .descr-expand-toggle {
|
|
42
|
+
transform: rotate(270deg)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.key-descr .descr-expand-toggle:hover {
|
|
46
|
+
color: var(--primary-color);
|
|
47
|
+
}
|
|
27
48
|
|
|
28
49
|
.expanded-descr .more-content { display:none; }
|
|
29
50
|
|
|
@@ -40,13 +61,6 @@ export default css`
|
|
|
40
61
|
overflow:hidden;
|
|
41
62
|
display: none;
|
|
42
63
|
}
|
|
43
|
-
.collapsed-descr .tr {
|
|
44
|
-
max-height:20px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.tr.xxx-of{
|
|
48
|
-
border-top: 1px dotted var(--primary-color);
|
|
49
|
-
}
|
|
50
64
|
|
|
51
65
|
.xxx-of-key {
|
|
52
66
|
font-size: calc(var(--font-size-small) - 2px);
|
|
@@ -61,10 +75,10 @@ export default css`
|
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
.xxx-of-descr {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
font-family: var(--font-regular);
|
|
79
|
+
color: var(--primary-color);
|
|
80
|
+
font-size: calc(var(--font-size-small) - 1px);
|
|
81
|
+
margin-left: 2px;
|
|
68
82
|
}
|
|
69
83
|
|
|
70
84
|
.stri, .string, .uri, .url, .byte, .bina, .date, .pass, .ipv4, .ipv4, .uuid, .emai, .host {color:var(--green);}
|
|
@@ -72,6 +86,7 @@ export default css`
|
|
|
72
86
|
.null {color:var(--red);}
|
|
73
87
|
.bool, .boolean{color:var(--orange)}
|
|
74
88
|
.enum {color:var(--purple)}
|
|
89
|
+
.cons {color:var(--purple)}
|
|
75
90
|
.recu {color:var(--brown)}
|
|
76
91
|
.toolbar {
|
|
77
92
|
display:flex;
|
|
@@ -90,9 +105,6 @@ export default css`
|
|
|
90
105
|
font-weight: bold;
|
|
91
106
|
text-transform: uppercase;
|
|
92
107
|
}
|
|
93
|
-
.schema-root-type.xxx-of {
|
|
94
|
-
display:none;
|
|
95
|
-
}
|
|
96
108
|
.toolbar-item:first-of-type { margin:0 2px 0 0;}
|
|
97
109
|
|
|
98
110
|
@media only screen and (min-width: 500px) {
|
package/src/styles/tab-styles.js
CHANGED
|
@@ -9,7 +9,7 @@ export default function callbackTemplate(callbacks) {
|
|
|
9
9
|
${kv[0]}
|
|
10
10
|
${Object.entries(kv[1]).map((pathObj) => html`
|
|
11
11
|
<div class="mono-font small-font-size" style="display:flex; margin-left:16px;">
|
|
12
|
-
<div>
|
|
12
|
+
<div style="width:100%">
|
|
13
13
|
${Object.entries(pathObj[1]).map((method) => html`
|
|
14
14
|
<div>
|
|
15
15
|
<div style="margin-top:12px;">
|
|
@@ -29,21 +29,20 @@ export default function callbackTemplate(callbacks) {
|
|
|
29
29
|
.parameters = "${method[1]?.parameters || ''}"
|
|
30
30
|
.request_body = "${method[1]?.requestBody || ''}"
|
|
31
31
|
fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
|
32
|
-
use-summary-to-list-example = "${this.useSummaryToListExamples}"
|
|
33
32
|
allow-try = "false"
|
|
34
33
|
render-style="${this.renderStyle}"
|
|
35
34
|
schema-style = "${this.schemaStyle}"
|
|
36
35
|
active-schema-tab = "${this.defaultSchemaTab}"
|
|
37
36
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
38
37
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
39
|
-
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
38
|
+
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
40
39
|
schema-hide-read-only = "false"
|
|
41
|
-
schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
|
40
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : 'true'}"
|
|
42
41
|
fetch-credentials = "${this.fetchCredentials}"
|
|
43
|
-
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
42
|
+
exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
44
43
|
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
45
44
|
anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
46
|
-
|
|
45
|
+
> </api-request>
|
|
47
46
|
|
|
48
47
|
<api-response
|
|
49
48
|
style = "width:100%;"
|
|
@@ -56,7 +55,7 @@ export default function callbackTemplate(callbacks) {
|
|
|
56
55
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
57
56
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
58
57
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
59
|
-
schema-hide-read-only = "${this.schemaHideReadOnly}"
|
|
58
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : 'true'}"
|
|
60
59
|
schema-hide-write-only = "false"
|
|
61
60
|
exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
|
|
62
61
|
schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
@@ -28,6 +28,7 @@ export default function codeSamplesTemplate(xCodeSamples) {
|
|
|
28
28
|
<pre><code class="language">${Prism.languages[v.lang?.toLowerCase()] ? unsafeHTML(Prism.highlight(v.source, Prism.languages[v.lang?.toLowerCase()], v.lang?.toLowerCase())) : v.source}</code></pre>
|
|
29
29
|
</div>`)
|
|
30
30
|
}
|
|
31
|
+
</div>
|
|
31
32
|
</section>`;
|
|
32
33
|
}
|
|
33
34
|
/* eslint-enable indent */
|
|
@@ -14,22 +14,20 @@ function schemaBodyTemplate(sComponent) {
|
|
|
14
14
|
${this.schemaStyle === 'table'
|
|
15
15
|
? html`
|
|
16
16
|
<schema-table
|
|
17
|
-
render-style = '${this.renderStyle}'
|
|
18
17
|
.data = '${schemaInObjectNotation(sComponent.component, {})}'
|
|
19
18
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
20
19
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
21
|
-
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
20
|
+
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
22
21
|
schema-hide-read-only = "false"
|
|
23
22
|
schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
|
24
23
|
exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
25
|
-
> </schema-
|
|
24
|
+
> </schema-table>`
|
|
26
25
|
: html`
|
|
27
26
|
<schema-tree
|
|
28
|
-
render-style = '${this.renderStyle}'
|
|
29
27
|
.data = '${schemaInObjectNotation(sComponent.component, {})}'
|
|
30
28
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
31
29
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
32
|
-
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
30
|
+
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
33
31
|
schema-hide-read-only = "false"
|
|
34
32
|
schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
|
35
33
|
exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
@@ -12,14 +12,14 @@ function toggleExpand(path) {
|
|
|
12
12
|
if (path.expanded) {
|
|
13
13
|
path.expanded = false; // collapse
|
|
14
14
|
if (this.updateRoute === 'true') {
|
|
15
|
-
|
|
15
|
+
this.replaceHistoryState('');
|
|
16
16
|
}
|
|
17
17
|
} else {
|
|
18
18
|
path.expanded = true; // Expand
|
|
19
19
|
if (this.updateRoute === 'true') {
|
|
20
20
|
const newHash = `${this.routePrefix || '#'}${path.elementId}`;
|
|
21
21
|
if (window.location.hash !== newHash) {
|
|
22
|
-
|
|
22
|
+
this.replaceHistoryState(path.elementId);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -109,6 +109,18 @@ function endpointBodyTemplate(path) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
${path.description ? html`<div part="section-endpoint-body-description" class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
|
|
112
|
+
${path.externalDocs?.url || path.externalDocs?.description
|
|
113
|
+
? html`<div style="background-color:var(--bg3); padding:2px 8px 8px 8px; margin:8px 0; border-radius:var(--border-radius)">
|
|
114
|
+
<div class="m-markdown"> ${unsafeHTML(marked(path.externalDocs?.description || ''))} </div>
|
|
115
|
+
${path.externalDocs?.url
|
|
116
|
+
? html`<a style="font-family:var(--font-mono); font-size:var(--font-size-small)" href="${path.externalDocs?.url}" target="_blank">
|
|
117
|
+
${path.externalDocs?.url} <div style="transform: rotate(270deg) scale(1.5); display: inline-block; margin-left:5px">⇲</div>
|
|
118
|
+
</a>`
|
|
119
|
+
: ''
|
|
120
|
+
}
|
|
121
|
+
</div>`
|
|
122
|
+
: ''
|
|
123
|
+
}
|
|
112
124
|
<slot name="${path.elementId}"></slot>
|
|
113
125
|
${pathSecurityTemplate.call(this, path.security)}
|
|
114
126
|
${codeSampleTabPanel}
|
|
@@ -118,7 +130,8 @@ function endpointBodyTemplate(path) {
|
|
|
118
130
|
<api-request
|
|
119
131
|
class = "${this.renderStyle}-mode ${this.layout}-layout"
|
|
120
132
|
style = "width:100%;"
|
|
121
|
-
|
|
133
|
+
webhook = "${path.isWebhook}"
|
|
134
|
+
method = "${path.method}"
|
|
122
135
|
path = "${path.path}"
|
|
123
136
|
.security = "${path.security}"
|
|
124
137
|
.parameters = "${path.parameters}"
|
|
@@ -128,43 +141,44 @@ function endpointBodyTemplate(path) {
|
|
|
128
141
|
server-url = "${path.servers && path.servers.length > 0 ? path.servers[0].url : this.selectedServer.computedUrl}"
|
|
129
142
|
active-schema-tab = "${this.defaultSchemaTab}"
|
|
130
143
|
fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
|
131
|
-
use-summary-to-list-example = "${this.useSummaryToListExamples}"
|
|
132
144
|
allow-try = "${this.allowTry}"
|
|
145
|
+
show-curl-before-try = "${this.showCurlBeforeTry}"
|
|
133
146
|
accept = "${accept}"
|
|
134
147
|
render-style="${this.renderStyle}"
|
|
135
148
|
schema-style = "${this.schemaStyle}"
|
|
136
149
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
137
150
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
138
151
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
139
|
-
schema-hide-read-only = "${path.isWebhook ?
|
|
140
|
-
schema-hide-write-only = "${path.isWebhook ?
|
|
152
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
|
153
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
|
141
154
|
fetch-credentials = "${this.fetchCredentials}"
|
|
142
|
-
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
155
|
+
exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
143
156
|
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
144
157
|
anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
145
|
-
|
|
158
|
+
> </api-request>
|
|
146
159
|
|
|
147
160
|
${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
|
148
|
-
|
|
161
|
+
</div>
|
|
149
162
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
<api-response
|
|
164
|
+
class = "${this.renderStyle}-mode"
|
|
165
|
+
style = "width:100%;"
|
|
166
|
+
webhook = "${path.isWebhook}"
|
|
167
|
+
.responses="${path.responses}"
|
|
168
|
+
active-schema-tab = "${this.defaultSchemaTab}"
|
|
169
|
+
render-style="${this.renderStyle}"
|
|
170
|
+
schema-style="${this.schemaStyle}"
|
|
171
|
+
schema-expand-level = "${this.schemaExpandLevel}"
|
|
172
|
+
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
173
|
+
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
174
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
|
175
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
|
176
|
+
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
177
|
+
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input,
|
|
178
|
+
textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, anchor:anchor, anchor-param-example:anchor-param-example, btn-clear-resp:btn-clear-resp,
|
|
179
|
+
schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
180
|
+
> </api-response>
|
|
181
|
+
</div>
|
|
168
182
|
</div>`;
|
|
169
183
|
}
|
|
170
184
|
|
|
@@ -15,7 +15,24 @@ function headingRenderer(tagElementId) {
|
|
|
15
15
|
return renderer;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
function expandCollapseTagDescription(e) {
|
|
19
|
+
const tagDescriptionEl = e.target.closest('.tag-container').querySelector('.tag-description');
|
|
20
|
+
const tagIconEl = e.target.closest('.tag-container').querySelector('.tag-icon');
|
|
21
|
+
if (tagDescriptionEl && tagIconEl) {
|
|
22
|
+
const isExpanded = tagDescriptionEl.classList.contains('expanded');
|
|
23
|
+
if (isExpanded) {
|
|
24
|
+
tagDescriptionEl.style.maxHeight = 0;
|
|
25
|
+
tagDescriptionEl.classList.replace('expanded', 'collapsed');
|
|
26
|
+
tagIconEl.classList.replace('expanded', 'collapsed');
|
|
27
|
+
} else {
|
|
28
|
+
tagDescriptionEl.style.maxHeight = `${tagDescriptionEl.scrollHeight}px`;
|
|
29
|
+
tagDescriptionEl.classList.replace('collapsed', 'expanded');
|
|
30
|
+
tagIconEl.classList.replace('collapsed', 'expanded');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function expandedEndpointBodyTemplate(path, tagName = '', tagDescription = '') {
|
|
19
36
|
const acceptContentTypes = new Set();
|
|
20
37
|
for (const respStatus in path.responses) {
|
|
21
38
|
for (const acceptContentType in (path.responses[respStatus]?.content)) {
|
|
@@ -37,7 +54,26 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
37
54
|
return html`
|
|
38
55
|
${this.renderStyle === 'read' ? html`<div class='divider' part="operation-divider"></div>` : ''}
|
|
39
56
|
<div class='expanded-endpoint-body observe-me ${path.method} ${path.deprecated ? 'deprecated' : ''} ' part="section-operation ${path.elementId}" id='${path.elementId}'>
|
|
40
|
-
${(this.renderStyle === 'focused' && tagName !== 'General ⦂')
|
|
57
|
+
${(this.renderStyle === 'focused' && tagName !== 'General ⦂')
|
|
58
|
+
? html`
|
|
59
|
+
<div class="tag-container" part="section-operation-tag">
|
|
60
|
+
<span class="upper" style="font-weight:bold; font-size:18px;"> ${tagName} </span>
|
|
61
|
+
${tagDescription
|
|
62
|
+
? html`
|
|
63
|
+
<svg class="tag-icon collapsed" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" fill="none" style="stroke:var(--primary-color); vertical-align:top; cursor:pointer"
|
|
64
|
+
@click="${(e) => { expandCollapseTagDescription.call(this, e); }}"
|
|
65
|
+
>
|
|
66
|
+
<path d="M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h8"></path><path d="M18 4v17"></path><path d="M15 18l3 3l3 -3"></path>
|
|
67
|
+
</svg>
|
|
68
|
+
<div class="tag-description collapsed" style="max-height:0px; overflow:hidden; margin-top:16px; border:1px solid var(--border-color)">
|
|
69
|
+
<div class="m-markdown" style="padding:8px"> ${unsafeHTML(marked(tagDescription))}</div>
|
|
70
|
+
</div>`
|
|
71
|
+
: ''
|
|
72
|
+
}
|
|
73
|
+
</div>
|
|
74
|
+
`
|
|
75
|
+
: ''
|
|
76
|
+
}
|
|
41
77
|
${path.deprecated ? html`<div class="bold-text red-text"> DEPRECATED </div>` : ''}
|
|
42
78
|
${html`
|
|
43
79
|
${path.xBadges && path.xBadges?.length > 0
|
|
@@ -53,10 +89,10 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
53
89
|
}
|
|
54
90
|
<h2 part="section-operation-summary"> ${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2>
|
|
55
91
|
${path.isWebhook
|
|
56
|
-
? html`<span part="section-operation-webhook style="color:var(--primary-color); font-weight:bold; font-size: var(--font-size-regular);"> WEBHOOK </span>`
|
|
92
|
+
? html`<span part="section-operation-webhook" style="color:var(--primary-color); font-weight:bold; font-size: var(--font-size-regular);"> WEBHOOK </span>`
|
|
57
93
|
: html`
|
|
58
|
-
<div
|
|
59
|
-
<span part="label-operation-method" class=
|
|
94
|
+
<div part="section-operation-webhook-method" class="mono-font regular-font-size" style="text-align:left; direction:ltr; padding: 8px 0; color:var(--fg3)">
|
|
95
|
+
<span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method}</span>
|
|
60
96
|
<span part="label-operation-path">${path.path}</span>
|
|
61
97
|
</div>
|
|
62
98
|
`
|
|
@@ -65,11 +101,24 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
65
101
|
}
|
|
66
102
|
${path.description ? html`<div class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
|
|
67
103
|
${pathSecurityTemplate.call(this, path.security)}
|
|
104
|
+
${path.externalDocs?.url || path.externalDocs?.description
|
|
105
|
+
? html`<div style="background-color:var(--bg3); padding:2px 8px 8px 8px; margin:8px 0; border-radius:var(--border-radius)">
|
|
106
|
+
<div class="m-markdown"> ${unsafeHTML(marked(path.externalDocs?.description || ''))} </div>
|
|
107
|
+
${path.externalDocs?.url
|
|
108
|
+
? html`<a style="font-family:var(--font-mono); font-size:var(--font-size-small)" href="${path.externalDocs?.url}" target="_blank">
|
|
109
|
+
${path.externalDocs?.url} <div style="transform: rotate(270deg) scale(1.5); display: inline-block; margin-left:5px">⇲</div>
|
|
110
|
+
</a>`
|
|
111
|
+
: ''
|
|
112
|
+
}
|
|
113
|
+
</div>`
|
|
114
|
+
: ''
|
|
115
|
+
}
|
|
68
116
|
${codeSampleTabPanel}
|
|
69
117
|
<div class='expanded-req-resp-container'>
|
|
70
118
|
<api-request
|
|
71
119
|
class = "${this.renderStyle}-mode"
|
|
72
120
|
style = "width:100%;"
|
|
121
|
+
webhook = "${path.isWebhook}"
|
|
73
122
|
method = "${path.method}"
|
|
74
123
|
path = "${path.path}"
|
|
75
124
|
.security = "${path.security}"
|
|
@@ -79,8 +128,8 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
79
128
|
.servers = "${path.servers}"
|
|
80
129
|
server-url = "${path.servers?.[0]?.url || this.selectedServer.computedUrl}"
|
|
81
130
|
fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
|
|
82
|
-
use-summary-to-list-example = "${this.useSummaryToListExamples}"
|
|
83
131
|
allow-try = "${this.allowTry}"
|
|
132
|
+
show-curl-before-try = "${this.showCurlBeforeTry}"
|
|
84
133
|
accept = "${accept}"
|
|
85
134
|
render-style="${this.renderStyle}"
|
|
86
135
|
schema-style = "${this.schemaStyle}"
|
|
@@ -88,10 +137,10 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
88
137
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
89
138
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
90
139
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
91
|
-
schema-hide-read-only = "${path.isWebhook ? false :
|
|
92
|
-
schema-hide-write-only = "${path.isWebhook ?
|
|
140
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
|
141
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
|
93
142
|
fetch-credentials = "${this.fetchCredentials}"
|
|
94
|
-
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
143
|
+
exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
95
144
|
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
96
145
|
anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
97
146
|
> </api-request>
|
|
@@ -101,6 +150,7 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
101
150
|
<api-response
|
|
102
151
|
class = "${this.renderStyle}-mode"
|
|
103
152
|
style = "width:100%;"
|
|
153
|
+
webhook = "${path.isWebhook}"
|
|
104
154
|
.responses = "${path.responses}"
|
|
105
155
|
render-style = "${this.renderStyle}"
|
|
106
156
|
schema-style = "${this.schemaStyle}"
|
|
@@ -108,8 +158,8 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
|
108
158
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
109
159
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
110
160
|
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
111
|
-
schema-hide-read-only = "${path.isWebhook ?
|
|
112
|
-
schema-hide-write-only = "${path.isWebhook ? false :
|
|
161
|
+
schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
|
|
162
|
+
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
|
|
113
163
|
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
114
164
|
exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
|
|
115
165
|
schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
@@ -135,8 +185,8 @@ export default function expandedEndpointTemplate() {
|
|
|
135
185
|
}
|
|
136
186
|
</div>
|
|
137
187
|
</section>
|
|
138
|
-
<section class=
|
|
139
|
-
${tag.paths.map((path) => expandedEndpointBodyTemplate.call(this, path
|
|
188
|
+
<section class="regular-font section-gap--read-mode" part="section-operations-in-tag">
|
|
189
|
+
${tag.paths.map((path) => expandedEndpointBodyTemplate.call(this, path))}
|
|
140
190
|
</section>
|
|
141
191
|
`)
|
|
142
192
|
}
|
|
@@ -96,7 +96,10 @@ export default function focusedEndpointTemplate() {
|
|
|
96
96
|
// In focused mode we must expand the nav-bar tag element if it is collapsed
|
|
97
97
|
const newNavEl = this.shadowRoot.getElementById(`link-${focusElId}`);
|
|
98
98
|
expandCollapseNavBarTag(newNavEl, 'expand');
|
|
99
|
-
focusedTemplate = wrapFocusedTemplate.call(
|
|
99
|
+
focusedTemplate = wrapFocusedTemplate.call(
|
|
100
|
+
this,
|
|
101
|
+
expandedEndpointBodyTemplate.call(this, selectedPathObj, (selectedTagObj.name || ''), (selectedTagObj.description || '')),
|
|
102
|
+
);
|
|
100
103
|
} else {
|
|
101
104
|
// if focusedElementId is not found then show the default content (overview or first-path)
|
|
102
105
|
focusedTemplate = defaultContentTemplate.call(this);
|
|
@@ -23,7 +23,7 @@ export default function headerTemplate() {
|
|
|
23
23
|
part="textbox textbox-spec-url"
|
|
24
24
|
placeholder="Spec URL"
|
|
25
25
|
value="${this.specUrl || ''}"
|
|
26
|
-
@change="${this.
|
|
26
|
+
@change="${this.onSpecUrlChange}"
|
|
27
27
|
spellcheck="false"
|
|
28
28
|
>
|
|
29
29
|
<div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">↩</div>
|
|
@@ -37,7 +37,7 @@ export default function headerTemplate() {
|
|
|
37
37
|
type="file"
|
|
38
38
|
style="display:none"
|
|
39
39
|
value="${this.specFile || ''}"
|
|
40
|
-
@change="${this.
|
|
40
|
+
@change="${this.onSpecFileChange}"
|
|
41
41
|
spellcheck="false"
|
|
42
42
|
>
|
|
43
43
|
<button class="m-btn primary only-large-screen" style="margin-left:10px;" part="btn btn-fill" @click="${this.onFileLoadClick}"> LOCAL JSON FILE </button>
|
|
@@ -63,7 +63,7 @@ function jsonSchemaBodyTemplate() {
|
|
|
63
63
|
.data = "${schemaInObjectNotation(jSchemaBody.schema, {})}"
|
|
64
64
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
65
65
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
66
|
-
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
66
|
+
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
67
67
|
schema-hide-read-only = "false"
|
|
68
68
|
schema-hide-write-only = "false"
|
|
69
69
|
> </schema-tree>
|
|
@@ -113,6 +113,7 @@ export default function jsonSchemaViewerTemplate(isMini = false) {
|
|
|
113
113
|
navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
|
114
114
|
navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
|
|
115
115
|
navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
|
|
116
|
+
navAccenttextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',
|
|
116
117
|
};
|
|
117
118
|
/* eslint-disable indent */
|
|
118
119
|
if (this.resolvedSpec.specLoadError) {
|
|
@@ -30,24 +30,25 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
|
|
|
30
30
|
navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
|
31
31
|
navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
|
|
32
32
|
navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
|
|
33
|
+
navAccentTextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',
|
|
33
34
|
};
|
|
34
35
|
/* eslint-disable indent */
|
|
35
36
|
if (this.resolvedSpec.specLoadError) {
|
|
36
37
|
if (isMini) {
|
|
37
38
|
return html`
|
|
38
39
|
${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
|
|
39
|
-
<div style=
|
|
40
|
+
<div style='display:flex; align-items: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)'> ${this.resolvedSpec.info.description} </div>
|
|
40
41
|
`;
|
|
41
42
|
}
|
|
42
43
|
return html`
|
|
43
44
|
${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
|
|
44
45
|
<!-- Header -->
|
|
45
46
|
${headerTemplate.call(this)}
|
|
46
|
-
<main class=
|
|
47
|
+
<main class='main-content regular-font' part='section-main-content'>
|
|
47
48
|
<slot></slot>
|
|
48
|
-
<div style=
|
|
49
|
-
<h1 style=
|
|
50
|
-
<div style=
|
|
49
|
+
<div style='margin:24px; text-align: center;'>
|
|
50
|
+
<h1 style='color: var(--red)'> ${this.resolvedSpec.info.title} </h1>
|
|
51
|
+
<div style='font-family:var(--font-mono)'> ${this.resolvedSpec.info.description} </div>
|
|
51
52
|
</div>
|
|
52
53
|
</main>
|
|
53
54
|
`;
|
|
@@ -55,12 +56,12 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
|
|
|
55
56
|
if (this.resolvedSpec.isSpecLoading) {
|
|
56
57
|
return html`
|
|
57
58
|
${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
|
|
58
|
-
<main class=
|
|
59
|
+
<main class='main-content regular-font' part='section-main-content'>
|
|
59
60
|
<slot></slot>
|
|
60
|
-
<div class=
|
|
61
|
-
<div class=
|
|
61
|
+
<div class='main-content-inner--${this.renderStyle}-mode'>
|
|
62
|
+
<div class='loader'></div>
|
|
62
63
|
</div>
|
|
63
|
-
</main>
|
|
64
|
+
</main>
|
|
64
65
|
`;
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -73,7 +74,7 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
|
|
|
73
74
|
<!-- Advanced Search -->
|
|
74
75
|
${this.allowAdvancedSearch === 'false' ? '' : advancedSearchTemplate.call(this)}
|
|
75
76
|
|
|
76
|
-
<div id='the-main-body' class=
|
|
77
|
+
<div id='the-main-body' class='body ${this.cssClasses}' dir='${this.pageDirection}' >
|
|
77
78
|
<!-- Side Nav -->
|
|
78
79
|
${((this.renderStyle === 'read' || this.renderStyle === 'focused')
|
|
79
80
|
&& this.showSideNav === 'true'
|
|
@@ -82,24 +83,24 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
<!-- Main Content -->
|
|
85
|
-
<main class=
|
|
86
|
+
<main class='main-content regular-font' tabindex='-1' part='section-main-content'>
|
|
86
87
|
<slot></slot>
|
|
87
|
-
<div class=
|
|
88
|
+
<div class='main-content-inner--${this.renderStyle}-mode'>
|
|
88
89
|
${this.loading === true
|
|
89
|
-
? html`<div class=
|
|
90
|
+
? html`<div class='loader'></div>`
|
|
90
91
|
: html`
|
|
91
92
|
${this.loadFailed === true
|
|
92
|
-
? html`<div style=
|
|
93
|
+
? html`<div style='text-align: center;margin: 16px;'> Unable to load the Spec</div>`
|
|
93
94
|
: html`
|
|
94
|
-
<div class=
|
|
95
|
+
<div class='operations-root' @click='${(e) => { this.handleHref(e); }}'>
|
|
95
96
|
${this.renderStyle === 'focused'
|
|
96
97
|
? html`${focusedEndpointTemplate.call(this)}`
|
|
97
98
|
: html`
|
|
98
99
|
${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
|
|
99
100
|
${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''}
|
|
100
101
|
${this.allowAuthentication === 'true' ? securitySchemeTemplate.call(this) : ''}
|
|
101
|
-
<div id=
|
|
102
|
-
<slot name=
|
|
102
|
+
<div id='operations-top' class='observe-me'>
|
|
103
|
+
<slot name='operations-top'></slot>
|
|
103
104
|
</div>
|
|
104
105
|
${this.renderStyle === 'read'
|
|
105
106
|
? expandedEndpointTemplate.call(this)
|
|
@@ -112,7 +113,7 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
|
|
|
112
113
|
}`
|
|
113
114
|
}
|
|
114
115
|
</div>
|
|
115
|
-
<slot name=
|
|
116
|
+
<slot name='footer'></slot>
|
|
116
117
|
</main>
|
|
117
118
|
</div>
|
|
118
119
|
`;
|