openapi-explorer 0.9.310 → 0.9.314
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/CHANGELOG.md +1 -0
- package/dist/{openapi-explorer.min.js → browser/openapi-explorer.min.js} +3 -3
- package/dist/{openapi-explorer.min.js.map → browser/openapi-explorer.min.js.map} +0 -0
- package/dist/es/components/api-request.js +936 -0
- package/dist/es/components/api-response.js +184 -0
- package/dist/es/components/json-tree.js +67 -0
- package/{src → dist/es}/components/mime-types.js +11 -17
- package/dist/es/components/schema-table.js +156 -0
- package/dist/es/components/schema-tree.js +191 -0
- package/dist/es/components/tag-input.js +67 -0
- package/{src → dist/es}/openapi-explorer-oauth-handler.js +2 -2
- package/{src → dist/es}/openapi-explorer.js +364 -371
- package/dist/es/styles/advanced-search-styles.js +2 -0
- package/dist/es/styles/api-request-styles.js +2 -0
- package/dist/es/styles/border-styles.js +2 -0
- package/dist/es/styles/endpoint-styles.js +2 -0
- package/dist/es/styles/flex-styles.js +2 -0
- package/dist/es/styles/font-styles.js +2 -0
- package/dist/es/styles/info-styles.js +2 -0
- package/dist/es/styles/input-styles.js +4 -0
- package/dist/es/styles/nav-styles.js +2 -0
- package/dist/es/styles/prism-styles.js +2 -0
- package/dist/es/styles/schema-styles.js +2 -0
- package/dist/es/styles/tab-styles.js +2 -0
- package/dist/es/styles/table-styles.js +2 -0
- package/dist/es/templates/advance-search-template.js +37 -0
- package/dist/es/templates/callback-template.js +7 -0
- package/dist/es/templates/code-samples-template.js +26 -0
- package/dist/es/templates/components-template.js +17 -0
- package/dist/es/templates/endpoint-template.js +94 -0
- package/dist/es/templates/expanded-endpoint-template.js +32 -0
- package/{src → dist/es}/templates/focused-endpoint-template.js +15 -15
- package/dist/es/templates/navbar-template.js +46 -0
- package/dist/es/templates/overview-template.js +9 -0
- package/dist/es/templates/responsiveViewMainBodyTemplate.js +30 -0
- package/dist/es/templates/security-scheme-template.js +330 -0
- package/dist/es/templates/server-template.js +42 -0
- package/{src → dist/es}/utils/color-utils.js +53 -16
- package/{src → dist/es}/utils/common-utils.js +18 -18
- package/{src → dist/es}/utils/schema-utils.js +248 -124
- package/{src → dist/es}/utils/spec-parser.js +112 -71
- package/dist/es/utils/theme.js +75 -0
- package/{src → dist/es}/utils/xml/xml.js +41 -38
- package/dist/lib/components/api-request.js +957 -0
- package/dist/lib/components/api-response.js +206 -0
- package/dist/lib/components/json-tree.js +82 -0
- package/dist/lib/components/mime-types.js +70 -0
- package/dist/lib/components/schema-table.js +170 -0
- package/dist/lib/components/schema-tree.js +206 -0
- package/dist/lib/components/tag-input.js +76 -0
- package/dist/lib/openapi-explorer-oauth-handler.js +19 -0
- package/dist/lib/openapi-explorer.js +817 -0
- package/dist/lib/styles/advanced-search-styles.js +10 -0
- package/dist/lib/styles/api-request-styles.js +10 -0
- package/dist/lib/styles/border-styles.js +10 -0
- package/dist/lib/styles/endpoint-styles.js +10 -0
- package/dist/lib/styles/flex-styles.js +10 -0
- package/dist/lib/styles/font-styles.js +10 -0
- package/dist/lib/styles/info-styles.js +10 -0
- package/dist/lib/styles/input-styles.js +11 -0
- package/dist/lib/styles/nav-styles.js +10 -0
- package/dist/lib/styles/prism-styles.js +10 -0
- package/dist/lib/styles/schema-styles.js +10 -0
- package/dist/lib/styles/tab-styles.js +10 -0
- package/dist/lib/styles/table-styles.js +10 -0
- package/dist/lib/templates/advance-search-template.js +42 -0
- package/dist/lib/templates/callback-template.js +12 -0
- package/dist/lib/templates/code-samples-template.js +36 -0
- package/dist/lib/templates/components-template.js +27 -0
- package/dist/lib/templates/endpoint-template.js +111 -0
- package/dist/lib/templates/expanded-endpoint-template.js +48 -0
- package/dist/lib/templates/focused-endpoint-template.js +95 -0
- package/dist/lib/templates/navbar-template.js +54 -0
- package/dist/lib/templates/overview-template.js +16 -0
- package/dist/lib/templates/responsiveViewMainBodyTemplate.js +47 -0
- package/dist/lib/templates/security-scheme-template.js +342 -0
- package/dist/lib/templates/server-template.js +49 -0
- package/dist/lib/utils/color-utils.js +112 -0
- package/dist/lib/utils/common-utils.js +156 -0
- package/dist/lib/utils/schema-utils.js +743 -0
- package/dist/lib/utils/spec-parser.js +361 -0
- package/dist/lib/utils/theme.js +84 -0
- package/dist/lib/utils/xml/xml.js +239 -0
- package/package.json +19 -6
- package/dist/openapi-explorer.min.js.LICENSE.txt +0 -71
- package/dist/openapi-explorer.min.js.LICENSE.txt.gz +0 -0
- package/dist/openapi-explorer.min.js.gz +0 -0
- package/dist/openapi-explorer.min.js.map.gz +0 -0
- package/dist/report.html +0 -38
- package/src/components/api-request.js +0 -1244
- package/src/components/api-response.js +0 -340
- package/src/components/json-tree.js +0 -129
- package/src/components/schema-table.js +0 -250
- package/src/components/schema-tree.js +0 -280
- package/src/components/tag-input.js +0 -109
- package/src/styles/advanced-search-styles.js +0 -84
- package/src/styles/api-request-styles.js +0 -111
- package/src/styles/border-styles.js +0 -24
- package/src/styles/css/main.css +0 -24
- package/src/styles/endpoint-styles.js +0 -222
- package/src/styles/flex-styles.js +0 -15
- package/src/styles/font-styles.js +0 -266
- package/src/styles/info-styles.js +0 -20
- package/src/styles/input-styles.js +0 -236
- package/src/styles/nav-styles.js +0 -141
- package/src/styles/prism-styles.js +0 -107
- package/src/styles/schema-styles.js +0 -121
- package/src/styles/tab-styles.js +0 -44
- package/src/styles/table-styles.js +0 -48
- package/src/templates/advance-search-template.js +0 -81
- package/src/templates/callback-template.js +0 -63
- package/src/templates/code-samples-template.js +0 -35
- package/src/templates/components-template.js +0 -43
- package/src/templates/endpoint-template.js +0 -175
- package/src/templates/expanded-endpoint-template.js +0 -104
- package/src/templates/navbar-template.js +0 -175
- package/src/templates/overview-template.js +0 -58
- package/src/templates/responsiveViewMainBodyTemplate.js +0 -72
- package/src/templates/security-scheme-template.js +0 -487
- package/src/templates/server-template.js +0 -106
- package/src/utils/theme.js +0 -163
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-element';
|
|
2
|
-
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
3
|
-
import { marked } from 'marked';
|
|
4
|
-
import '../components/api-request';
|
|
5
|
-
import '../components/api-response';
|
|
6
|
-
import codeSamplesTemplate from './code-samples-template';
|
|
7
|
-
import callbackTemplate from './callback-template';
|
|
8
|
-
import { pathSecurityTemplate } from './security-scheme-template';
|
|
9
|
-
import { getCurrentElement, pathIsInSearch, replaceState } from '../utils/common-utils';
|
|
10
|
-
|
|
11
|
-
function toggleExpand(path) {
|
|
12
|
-
if (path.expanded) {
|
|
13
|
-
path.expanded = false; // collapse
|
|
14
|
-
replaceState(null);
|
|
15
|
-
} else {
|
|
16
|
-
path.expanded = true; // Expand
|
|
17
|
-
if (path.elementId !== getCurrentElement()) {
|
|
18
|
-
replaceState(path.elementId);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
this.requestUpdate();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function toggleTag(tagElement, tagId) {
|
|
25
|
-
const sectionTag = tagElement.target.closest('.section-tag');
|
|
26
|
-
const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
|
|
27
|
-
tag.expanded = !tag.expanded;
|
|
28
|
-
if (tag.expanded) {
|
|
29
|
-
sectionTag.classList.remove('collapsed');
|
|
30
|
-
sectionTag.classList.add('expanded');
|
|
31
|
-
} else {
|
|
32
|
-
sectionTag.classList.remove('expanded');
|
|
33
|
-
sectionTag.classList.add('collapsed');
|
|
34
|
-
}
|
|
35
|
-
this.requestUpdate();
|
|
36
|
-
}
|
|
37
|
-
export function expandCollapseAll(currentElement, action = 'expand-all') {
|
|
38
|
-
const operationsRootEl = currentElement.target.closest('.operations-root');
|
|
39
|
-
const elList = [...operationsRootEl.querySelectorAll('.section-tag')];
|
|
40
|
-
const expand = action === 'expand-all';
|
|
41
|
-
this.resolvedSpec.tags.forEach(t => t.expanded = expand);
|
|
42
|
-
elList.map((el) => {
|
|
43
|
-
if (expand) {
|
|
44
|
-
el.classList.remove('collapsed');
|
|
45
|
-
el.classList.add('expanded');
|
|
46
|
-
} else {
|
|
47
|
-
el.classList.remove('expanded');
|
|
48
|
-
el.classList.add('collapsed');
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* eslint-disable indent */
|
|
54
|
-
function endpointHeadTemplate(path) {
|
|
55
|
-
return html`
|
|
56
|
-
<summary @click="${(e) => { toggleExpand.call(this, path, e); }}" class='endpoint-head ${path.method} ${path.expanded ? 'expanded' : 'collapsed'}'>
|
|
57
|
-
<div class="method ${path.method}"> ${path.method} </div>
|
|
58
|
-
<div class="path">
|
|
59
|
-
${path.path}
|
|
60
|
-
${path.isWebhook ? html`<span style="color:var(--primary-color)"> (Webhook) </span>` : ''}
|
|
61
|
-
</div>
|
|
62
|
-
${path.deprecated
|
|
63
|
-
? html`
|
|
64
|
-
<span style="font-size:var(--font-size-small); text-transform:uppercase; font-weight:bold; color:var(--red); margin:2px 0 0 5px;">
|
|
65
|
-
deprecated
|
|
66
|
-
</span>`
|
|
67
|
-
: ''
|
|
68
|
-
}
|
|
69
|
-
<div class="only-large-screen" style="min-width:60px; flex:1"></div>
|
|
70
|
-
<div class="descr">${path.summary || path.shortSummary} </div>
|
|
71
|
-
</summary>
|
|
72
|
-
`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function endpointBodyTemplate(path) {
|
|
76
|
-
const acceptContentTypes = new Set();
|
|
77
|
-
for (const respStatus in path.responses) {
|
|
78
|
-
for (const acceptContentType in path.responses[respStatus] && path.responses[respStatus].content) {
|
|
79
|
-
acceptContentTypes.add(acceptContentType.trim());
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const accept = [...acceptContentTypes].join(', ');
|
|
83
|
-
// Filter API Keys that are non-empty and are applicable to the the path
|
|
84
|
-
const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter((v) => (v.finalKeyValue && path.security && path.security.some((ps) => ps[v.apiKeyId]))) || [];
|
|
85
|
-
|
|
86
|
-
const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate(path.xCodeSamples) : '';
|
|
87
|
-
return html`
|
|
88
|
-
<div class='endpoint-body ${path.method}'>
|
|
89
|
-
<div class="summary">
|
|
90
|
-
${path.summary ? html`<div class="title">${path.summary}<div>` : path.shortSummary !== path.description ? html`<div class="title">${path.shortSummary}</div>` : ''}
|
|
91
|
-
${path.description ? html`<div class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
|
|
92
|
-
<slot name="${path.elementId}"></slot>
|
|
93
|
-
${pathSecurityTemplate.call(this, path.security)}
|
|
94
|
-
${codeSampleTabPanel}
|
|
95
|
-
</div>
|
|
96
|
-
<div class='req-resp-container'>
|
|
97
|
-
<div style="display:flex; flex-direction:column" class="request">
|
|
98
|
-
<api-request class="request-panel"
|
|
99
|
-
style = "width:100%;"
|
|
100
|
-
method = "${path.method}",
|
|
101
|
-
path = "${path.path}"
|
|
102
|
-
.parameters = "${path.parameters}"
|
|
103
|
-
.request_body = "${path.requestBody}"
|
|
104
|
-
.api_keys = "${nonEmptyApiKeys}"
|
|
105
|
-
.servers = "${path.servers}"
|
|
106
|
-
server-url = "${path.servers && path.servers.length > 0 ? path.servers[0].url : this.selectedServer.computedUrl}"
|
|
107
|
-
active-schema-tab = "${this.defaultSchemaTab}"
|
|
108
|
-
fill-defaults = "${this.fillRequestWithDefault}"
|
|
109
|
-
enable-console = "${this.allowTry}"
|
|
110
|
-
accept = "${accept}"
|
|
111
|
-
render-style="${this.renderStyle}"
|
|
112
|
-
schema-style = "${this.schemaStyle}"
|
|
113
|
-
schema-expand-level = "${this.schemaExpandLevel}"
|
|
114
|
-
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
115
|
-
schema-hide-read-only = "${this.schemaHideReadOnly}"
|
|
116
|
-
fetch-credentials = "${this.fetchCredentials}"
|
|
117
|
-
exportparts="btn btn-fill btn-outline btn-try">
|
|
118
|
-
</api-request>
|
|
119
|
-
</div>
|
|
120
|
-
${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
|
121
|
-
<api-response
|
|
122
|
-
class="request response"
|
|
123
|
-
.responses="${path.responses}"
|
|
124
|
-
active-schema-tab = "${this.defaultSchemaTab}"
|
|
125
|
-
render-style="${this.renderStyle}"
|
|
126
|
-
schema-style="${this.schemaStyle}"
|
|
127
|
-
schema-expand-level = "${this.schemaExpandLevel}"
|
|
128
|
-
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
129
|
-
schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
|
130
|
-
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
131
|
-
exportparts = "btn--resp btn-fill--resp btn-outline--resp"
|
|
132
|
-
> </api-response>
|
|
133
|
-
</div>
|
|
134
|
-
</div>`;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export default function endpointTemplate() {
|
|
138
|
-
return html`
|
|
139
|
-
<div style="display:flex; justify-content:flex-end; padding-right: 1rem; font-size: 14px; margin-top: 16px;">
|
|
140
|
-
<span @click="${(e) => expandCollapseAll.call(this, e, 'expand-all')}" style="color:var(--primary-color); cursor: pointer;">Expand</span>
|
|
141
|
-
|
|
|
142
|
-
<span @click="${(e) => expandCollapseAll.call(this, e, 'collapse-all')}" style="color:var(--primary-color); cursor: pointer;">Collapse</span>
|
|
143
|
-
</div>
|
|
144
|
-
${(this.resolvedSpec && this.resolvedSpec.tags || []).map((tag) => html`
|
|
145
|
-
<div class='regular-font method-section-gap section-tag ${tag.expanded ? 'expanded' : 'collapsed'}' >
|
|
146
|
-
|
|
147
|
-
<div class='section-tag-header' @click="${(e) => toggleTag.call(this, e, tag.elementId)}">
|
|
148
|
-
<div id='${tag.elementId}' class="sub-title tag" style="color:var(--primary-color)">${tag.name}</div>
|
|
149
|
-
</div>
|
|
150
|
-
<div class='section-tag-body'>
|
|
151
|
-
<slot name="${tag.elementId}"></slot>
|
|
152
|
-
${tag.description
|
|
153
|
-
? `html
|
|
154
|
-
<div class="regular-font regular-font-size m-markdown" style="padding-bottom:12px">
|
|
155
|
-
${unsafeHTML(marked(tag.description || ''))}
|
|
156
|
-
</div>`
|
|
157
|
-
: ''
|
|
158
|
-
}
|
|
159
|
-
${tag.paths.filter((v) => {
|
|
160
|
-
if (this.matchPaths) {
|
|
161
|
-
return pathIsInSearch(this.matchPaths, v);
|
|
162
|
-
}
|
|
163
|
-
return true;
|
|
164
|
-
}).map((path) => html`
|
|
165
|
-
<section id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${path.expanded ? 'expanded' : 'collapsed'}'>
|
|
166
|
-
${endpointHeadTemplate.call(this, path)}
|
|
167
|
-
${path.expanded ? endpointBodyTemplate.call(this, path) : ''}
|
|
168
|
-
</section>`)
|
|
169
|
-
}
|
|
170
|
-
</div>
|
|
171
|
-
</div>
|
|
172
|
-
`)
|
|
173
|
-
}`;
|
|
174
|
-
}
|
|
175
|
-
/* eslint-enable indent */
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-element';
|
|
2
|
-
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
3
|
-
import { marked } from 'marked';
|
|
4
|
-
import { pathSecurityTemplate } from './security-scheme-template';
|
|
5
|
-
import codeSamplesTemplate from './code-samples-template';
|
|
6
|
-
import callbackTemplate from './callback-template';
|
|
7
|
-
import '../components/api-request';
|
|
8
|
-
import '../components/api-response';
|
|
9
|
-
|
|
10
|
-
/* eslint-disable indent */
|
|
11
|
-
export function expandedEndpointBodyTemplate(path, tagName = '') {
|
|
12
|
-
const acceptContentTypes = new Set();
|
|
13
|
-
for (const respStatus in path.responses) {
|
|
14
|
-
for (const acceptContentType in path.responses[respStatus] && path.responses[respStatus].content) {
|
|
15
|
-
acceptContentTypes.add(acceptContentType.trim());
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const accept = [...acceptContentTypes].join(', ');
|
|
19
|
-
|
|
20
|
-
// Filter API Keys that are non-empty and are applicable to the the path
|
|
21
|
-
const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter((v) => (v.finalKeyValue && path.security && path.security.some((ps) => ps[v.apiKeyId]))) || [];
|
|
22
|
-
|
|
23
|
-
const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate.call(this, path.xCodeSamples) : '';
|
|
24
|
-
return html`
|
|
25
|
-
${this.renderStyle === 'read' ? html`<div class='divider' part="operation-divider"></div>` : ''}
|
|
26
|
-
<div class='expanded-endpoint-body observe-me ${path.method}' part="section-operation ${path.elementId}" id='${path.elementId}'>
|
|
27
|
-
${(this.renderStyle === 'focused' && tagName !== 'General ⦂') ? html`<h3 class="upper" style="font-weight:bold"> ${tagName} </h3>` : ''}
|
|
28
|
-
${path.deprecated ? html`<div class="bold-text red-text"> DEPRECATED </div>` : ''}
|
|
29
|
-
${html`
|
|
30
|
-
<h2> ${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2>
|
|
31
|
-
<div class='mono-font part="section-operation-url" regular-font-size' style='padding: 8px 0; color:var(--fg3)'>
|
|
32
|
-
${path.isWebhook ? html`<span style="color:var(--primary-color)"> WEBHOOK </span>` : ''}
|
|
33
|
-
<span part="label-operation-method" class='regular-font upper method-fg bold-text ${path.method}'>${path.method}</span>
|
|
34
|
-
<span part="label-operation-path">${path.path}</span>
|
|
35
|
-
</div>`
|
|
36
|
-
}
|
|
37
|
-
${path.description ? html`<div class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
|
|
38
|
-
<slot name="${path.elementId}"></slot>
|
|
39
|
-
${pathSecurityTemplate.call(this, path.security)}
|
|
40
|
-
${codeSampleTabPanel}
|
|
41
|
-
<div class='expanded-req-resp-container'>
|
|
42
|
-
<api-request class="request-panel"
|
|
43
|
-
method = "${path.method}"
|
|
44
|
-
path = "${path.path}"
|
|
45
|
-
.parameters = "${path.parameters}"
|
|
46
|
-
.request_body = "${path.requestBody}"
|
|
47
|
-
.api_keys = "${nonEmptyApiKeys}"
|
|
48
|
-
.servers = "${path.servers}"
|
|
49
|
-
server-url = "${path.servers && path.servers[0] && path.servers[0].url || this.selectedServer.computedUrl}"
|
|
50
|
-
fill-defaults = "${this.fillRequestWithDefault}"
|
|
51
|
-
enable-console = "${this.allowTry}"
|
|
52
|
-
accept = "${accept}"
|
|
53
|
-
render-style="${this.renderStyle}"
|
|
54
|
-
schema-style = "${this.schemaStyle}"
|
|
55
|
-
active-schema-tab = "${this.defaultSchemaTab}"
|
|
56
|
-
schema-expand-level = "${this.schemaExpandLevel}"
|
|
57
|
-
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
58
|
-
schema-hide-read-only = "${this.schemaHideReadOnly}"
|
|
59
|
-
fetch-credentials = "${this.fetchCredentials}"
|
|
60
|
-
exportparts = "btn btn-fill btn-outline btn-try"
|
|
61
|
-
> </api-request>
|
|
62
|
-
|
|
63
|
-
${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
|
|
64
|
-
|
|
65
|
-
<api-response
|
|
66
|
-
class = 'response-panel'
|
|
67
|
-
.responses = "${path.responses}"
|
|
68
|
-
render-style = "${this.renderStyle}"
|
|
69
|
-
schema-style = "${this.schemaStyle}"
|
|
70
|
-
active-schema-tab = "${this.defaultSchemaTab}"
|
|
71
|
-
schema-expand-level = "${this.schemaExpandLevel}"
|
|
72
|
-
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
73
|
-
schema-hide-write-only = "${this.schemaHideWriteOnly}"
|
|
74
|
-
selected-status = "${Object.keys(path.responses || {})[0] || ''}"
|
|
75
|
-
exportparts = "btn--resp btn-fill--resp btn-outline--resp"
|
|
76
|
-
> </api-response>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
`;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export default function expandedEndpointTemplate() {
|
|
83
|
-
return html`
|
|
84
|
-
${(this.resolvedSpec && this.resolvedSpec.tags || []).map((tag) => html`
|
|
85
|
-
<section id="${tag.elementId}" part="section-tag" class="regular-font section-gap--read-mode observe-me" style="border-top:1px solid var(--primary-color);">
|
|
86
|
-
<div class="title tag" part="label-tag-title">${tag.name}</div>
|
|
87
|
-
<slot name="${tag.elementId}"></slot>
|
|
88
|
-
<div class="regular-font-size">
|
|
89
|
-
${
|
|
90
|
-
unsafeHTML(`
|
|
91
|
-
<div class="m-markdown regular-font">
|
|
92
|
-
${marked(tag.description || '')}
|
|
93
|
-
</div>`)
|
|
94
|
-
}
|
|
95
|
-
</div>
|
|
96
|
-
</section>
|
|
97
|
-
<section class='regular-font section-gap--read-mode' part="section-operations-in-tag">
|
|
98
|
-
${tag.paths.map((path) => expandedEndpointBodyTemplate.call(this, path, 'BBB'))}
|
|
99
|
-
</section>
|
|
100
|
-
`)
|
|
101
|
-
}
|
|
102
|
-
`;
|
|
103
|
-
}
|
|
104
|
-
/* eslint-enable indent */
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-element';
|
|
2
|
-
import { pathIsInSearch } from '../utils/common-utils';
|
|
3
|
-
|
|
4
|
-
function onExpandCollapse(tagId) {
|
|
5
|
-
const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
|
|
6
|
-
if (!tag) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
tag.expanded = !tag.expanded;
|
|
10
|
-
if (tag.expanded && this.operationsCollapsed) {
|
|
11
|
-
this.resolvedSpec.tags.filter(t => t.elementId !== tagId).forEach(t => t.expanded = false);
|
|
12
|
-
}
|
|
13
|
-
this.requestUpdate();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function expandCollapseAll() {
|
|
17
|
-
const expand = this.operationsCollapsed;
|
|
18
|
-
this.operationsCollapsed = !expand;
|
|
19
|
-
this.resolvedSpec.tags.forEach(t => { t.expanded = expand; });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* eslint-disable indent */
|
|
23
|
-
export default function navbarTemplate() {
|
|
24
|
-
return html`
|
|
25
|
-
<nav class='nav-bar ${this.renderStyle}' part="section-navbar">
|
|
26
|
-
${(this.allowSearch === 'false' && this.allowAdvancedSearch === 'false')
|
|
27
|
-
? ''
|
|
28
|
-
: html`
|
|
29
|
-
<div style="display:flex; flex-direction:row; justify-content:center; align-items:center; padding:24px; ${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}">
|
|
30
|
-
${this.allowSearch === 'false'
|
|
31
|
-
? ''
|
|
32
|
-
: html`
|
|
33
|
-
<div style="display:flex; flex:1; line-height:22px;">
|
|
34
|
-
<input id="nav-bar-search"
|
|
35
|
-
part = "textbox textbox-nav-filter"
|
|
36
|
-
style = "width:100%; padding-right:20px; color:var(--nav-hover-text-color); border-color:var(--secondary-color); background-color:var(--nav-hover-bg-color)"
|
|
37
|
-
type = "text"
|
|
38
|
-
placeholder = "Filter"
|
|
39
|
-
@change = "${this.onSearchChange}"
|
|
40
|
-
spellcheck = "false"
|
|
41
|
-
>
|
|
42
|
-
<div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor: pointer;">↩</div>
|
|
43
|
-
</div>
|
|
44
|
-
${this.matchPaths
|
|
45
|
-
? html`
|
|
46
|
-
<div @click = '${this.onClearSearch}' style='margin-left:5px; cursor: pointer; align-self:center; color:var(--nav-text-color)' class='small-font-size primary-text bold-text'> CLEAR </div>`
|
|
47
|
-
: ''
|
|
48
|
-
}
|
|
49
|
-
`
|
|
50
|
-
}
|
|
51
|
-
${this.allowAdvancedSearch === 'false' || this.matchPaths
|
|
52
|
-
? ''
|
|
53
|
-
: html`
|
|
54
|
-
<button class="m-btn primary" part="btn btn-fill btn-search" style="margin-left:5px;" @click="${this.onShowSearchModalClicked}">
|
|
55
|
-
Search
|
|
56
|
-
</button>
|
|
57
|
-
`
|
|
58
|
-
}
|
|
59
|
-
</div>
|
|
60
|
-
`
|
|
61
|
-
}
|
|
62
|
-
${html`<nav class='nav-scroll' part="navbar-scroll">
|
|
63
|
-
${(this.showInfo === 'false' || !this.resolvedSpec.info)
|
|
64
|
-
? ''
|
|
65
|
-
: html`<div class='nav-bar-info' id='link-overview' data-content-id='overview' @click = '${(e) => this.scrollToEventTarget(e, false)}'>
|
|
66
|
-
${this.isV1 && this.resolvedSpec.info.title || 'Overview'}
|
|
67
|
-
</div>`
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
${this.allowServerSelection === 'false'
|
|
71
|
-
? ''
|
|
72
|
-
: html`<div class='nav-bar-info' id='link-servers' data-content-id='servers' @click = '${(e) => this.scrollToEventTarget(e, false)}'> API Servers </div>`
|
|
73
|
-
}
|
|
74
|
-
${(this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes)
|
|
75
|
-
? ''
|
|
76
|
-
: html`<div class='nav-bar-info' id='link-auth' data-content-id='auth' @click = '${(e) => this.scrollToEventTarget(e, false)}'> Authentication </div>`
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
<slot name="nav-section" class="custom-nav-section" data-content-id='section' @click = '${(e) => this.scrollToEventTarget(e, false)}'></slot>
|
|
80
|
-
|
|
81
|
-
<div class="sticky-scroll-element">
|
|
82
|
-
<div class='nav-bar-section' part="navbar-operations-header">
|
|
83
|
-
<slot name="operations-header">
|
|
84
|
-
<div class='nav-bar-section-title'>OPERATIONS</div>
|
|
85
|
-
</slot>
|
|
86
|
-
<div style="" part="navbar-operations-header-collapse">
|
|
87
|
-
${this.resolvedSpec.tags.length > 1
|
|
88
|
-
? html`
|
|
89
|
-
${this.operationsCollapsed
|
|
90
|
-
? html`<div @click="${(e) => { expandCollapseAll.call(this, e); }}" style="font-size: 16px; transform: rotate(0deg); cursor: pointer;">▸</div>`
|
|
91
|
-
: html`<div @click="${(e) => { expandCollapseAll.call(this, e); }}" style="font-size: 16px; transform: rotate(90deg); cursor: pointer;">▸</div>`
|
|
92
|
-
}`
|
|
93
|
-
: ''
|
|
94
|
-
}
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
|
|
99
|
-
<!-- TAGS AND PATHS-->
|
|
100
|
-
${this.resolvedSpec.tags
|
|
101
|
-
.filter((tag) => tag.paths.filter((path) => pathIsInSearch(this.matchPaths, path)).length)
|
|
102
|
-
.map((tag) => html`
|
|
103
|
-
<slot name="nav-${tag.elementId}">
|
|
104
|
-
<div class='nav-bar-tag-and-paths ${tag.expanded ? 'expanded' : 'collapsed'}'>
|
|
105
|
-
${tag.name === 'General ⦂'
|
|
106
|
-
? html``
|
|
107
|
-
: html`
|
|
108
|
-
<div class='nav-bar-tag' id="link-${tag.elementId}" data-content-id='${tag.elementId}'
|
|
109
|
-
@click='${() => { onExpandCollapse.call(this, tag.elementId); }}'>
|
|
110
|
-
|
|
111
|
-
<div style="display: flex; justify-content: space-between; width: 100%;">
|
|
112
|
-
<div>${tag.name}</div>
|
|
113
|
-
<div class="nav-bar-tag-icon expand-button-arrow">▸</div>
|
|
114
|
-
<div class="nav-bar-tag-icon collapse-button-arrow">▾</div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
`
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<div class='nav-bar-paths-under-tag'>
|
|
122
|
-
<!-- Paths in each tag (endpoints) -->
|
|
123
|
-
${tag.paths.filter((v) => {
|
|
124
|
-
if (this.matchPaths) {
|
|
125
|
-
return pathIsInSearch(this.matchPaths, v);
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
}).map((p) => html`
|
|
129
|
-
<div class='nav-bar-path ${this.usePathInNavBar === 'true' ? 'small-font' : ''}'
|
|
130
|
-
data-content-id='${p.elementId}' id='link-${p.elementId}' @click = '${(e) => { this.scrollToEventTarget(e, false); }}'>
|
|
131
|
-
<span style="line-break: anywhere; ${p.deprecated ? 'filter:opacity(0.5)' : ''}">
|
|
132
|
-
${this.usePathInNavBar === 'true'
|
|
133
|
-
? html`<span class='mono-font'>${p.method.toUpperCase()} ${p.path}</span>`
|
|
134
|
-
: p.summary || p.shortSummary
|
|
135
|
-
}
|
|
136
|
-
${p.isWebhook ? '(Webhook)' : ''}
|
|
137
|
-
</span>
|
|
138
|
-
</div>`)}
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
</slot>
|
|
142
|
-
`)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
<!-- COMPONENTS -->
|
|
146
|
-
${this.resolvedSpec.components && this.showComponents === 'true'
|
|
147
|
-
? html`
|
|
148
|
-
<div class="sticky-scroll-element">
|
|
149
|
-
<div id='link-components' class='nav-bar-section'>
|
|
150
|
-
<div class='nav-bar-section-title'>COMPONENTS</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
${this.resolvedSpec.components.map((component) => (component.subComponents.filter(s => s.expanded).length
|
|
154
|
-
? html`
|
|
155
|
-
<div class='nav-bar-tag'
|
|
156
|
-
data-content-id='cmp--${component.name.toLowerCase()}'
|
|
157
|
-
id='link-cmp--${component.name.toLowerCase()}'
|
|
158
|
-
@click='${(e) => this.scrollToEventTarget(e, false)}'>
|
|
159
|
-
${component.name}
|
|
160
|
-
</div>
|
|
161
|
-
${component.subComponents.filter(s => s.expanded).map((p) => html`
|
|
162
|
-
<div class='nav-bar-path' data-content-id='cmp--${p.id}' id='link-cmp--${p.id}' @click='${(e) => this.scrollToEventTarget(e, false)}'>
|
|
163
|
-
<span> ${p.name} </span>
|
|
164
|
-
</div>`)
|
|
165
|
-
}`
|
|
166
|
-
: ''))
|
|
167
|
-
}`
|
|
168
|
-
: ''
|
|
169
|
-
}
|
|
170
|
-
</nav>`
|
|
171
|
-
}
|
|
172
|
-
</nav>
|
|
173
|
-
`;
|
|
174
|
-
}
|
|
175
|
-
/* eslint-enable indent */
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-element';
|
|
2
|
-
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
3
|
-
import { marked } from 'marked';
|
|
4
|
-
|
|
5
|
-
/* eslint-disable indent */
|
|
6
|
-
export default function overviewTemplate() {
|
|
7
|
-
return html`
|
|
8
|
-
<section id="overview" part="section-overview"
|
|
9
|
-
class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}">
|
|
10
|
-
${this.resolvedSpec && this.resolvedSpec.info
|
|
11
|
-
? html`
|
|
12
|
-
<slot name="overview">
|
|
13
|
-
<div id="api-title" part="label-overview-title" style="font-size:32px;" class="section-padding">
|
|
14
|
-
${this.resolvedSpec.info.title}
|
|
15
|
-
${!this.resolvedSpec.info.version ? '' : html`
|
|
16
|
-
<span style = 'font-size:var(--font-size-small);font-weight:bold'>
|
|
17
|
-
${this.resolvedSpec.info.version}
|
|
18
|
-
</span>`
|
|
19
|
-
}
|
|
20
|
-
</div>
|
|
21
|
-
<div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px); margin-top:8px;" class="section-padding">
|
|
22
|
-
${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.email
|
|
23
|
-
? html`<span>${this.resolvedSpec.info.contact.name || 'Email'}:
|
|
24
|
-
<a href="mailto:${this.resolvedSpec.info.contact.email}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a>
|
|
25
|
-
</span>`
|
|
26
|
-
: ''
|
|
27
|
-
}
|
|
28
|
-
${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.url
|
|
29
|
-
? html`<span>URL: <a href="${this.resolvedSpec.info.contact.url}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>`
|
|
30
|
-
: ''
|
|
31
|
-
}
|
|
32
|
-
${this.resolvedSpec.info.license
|
|
33
|
-
? html`<span>License:
|
|
34
|
-
${this.resolvedSpec.info.license.url
|
|
35
|
-
? html`<a href="${this.resolvedSpec.info.license.url}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>`
|
|
36
|
-
: this.resolvedSpec.info.license.name
|
|
37
|
-
} </span>`
|
|
38
|
-
: ''
|
|
39
|
-
}
|
|
40
|
-
${this.resolvedSpec.info.termsOfService
|
|
41
|
-
? html`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">Terms of Service</a></span>`
|
|
42
|
-
: ''
|
|
43
|
-
}
|
|
44
|
-
</div>
|
|
45
|
-
</slot>
|
|
46
|
-
<slot name="overview-api-description">
|
|
47
|
-
${this.resolvedSpec.info.description
|
|
48
|
-
? html`${unsafeHTML(`<div class="m-markdown regular-font section-padding">${marked(this.resolvedSpec.info.description)}</div>`)}`
|
|
49
|
-
: ''
|
|
50
|
-
}
|
|
51
|
-
</slot>
|
|
52
|
-
`
|
|
53
|
-
: ''
|
|
54
|
-
}
|
|
55
|
-
</section>
|
|
56
|
-
`;
|
|
57
|
-
}
|
|
58
|
-
/* eslint-enable indent */
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-element';
|
|
2
|
-
|
|
3
|
-
// Templates
|
|
4
|
-
import focusedEndpointTemplate from './focused-endpoint-template';
|
|
5
|
-
import overviewTemplate from './overview-template';
|
|
6
|
-
import endpointTemplate from './endpoint-template';
|
|
7
|
-
import serverTemplate from './server-template';
|
|
8
|
-
import securitySchemeTemplate from './security-scheme-template';
|
|
9
|
-
import navbarTemplate from './navbar-template';
|
|
10
|
-
import advancedSearchTemplate from './advance-search-template';
|
|
11
|
-
import SetTheme from '../utils/theme';
|
|
12
|
-
import ColorUtils from '../utils/color-utils';
|
|
13
|
-
|
|
14
|
-
export default function responsiveViewMainBodyTemplate() {
|
|
15
|
-
const newTheme = {
|
|
16
|
-
bg1: ColorUtils.isValidHexColor(this.bgColor) ? this.bgColor : '',
|
|
17
|
-
fg1: ColorUtils.isValidHexColor(this.textColor) ? this.textColor : '',
|
|
18
|
-
primaryColor: ColorUtils.isValidHexColor(this.primaryColor) ? this.primaryColor : '#3E6077',
|
|
19
|
-
secondaryColor: ColorUtils.isValidHexColor(this.secondaryColor) ? this.secondaryColor : '#FBAF0B',
|
|
20
|
-
headerColor: ColorUtils.isValidHexColor(this.headerColor) ? this.headerColor : '',
|
|
21
|
-
navBgColor: ColorUtils.isValidHexColor(this.navBgColor) ? this.navBgColor : '',
|
|
22
|
-
navTextColor: ColorUtils.isValidHexColor(this.navTextColor) ? this.navTextColor : '',
|
|
23
|
-
navHoverBgColor: ColorUtils.isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
|
24
|
-
navHoverTextColor: ColorUtils.isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/* eslint-disable indent */
|
|
28
|
-
return html`
|
|
29
|
-
${SetTheme.call(this, newTheme)}
|
|
30
|
-
|
|
31
|
-
<!-- Advanced Search -->
|
|
32
|
-
${this.allowAdvancedSearch === 'false' ? '' : advancedSearchTemplate.call(this)}
|
|
33
|
-
|
|
34
|
-
<div id='the-main-body' class="body">
|
|
35
|
-
<!-- Side Nav -->
|
|
36
|
-
${(this.renderStyle === 'focused' && this.resolvedSpec) ? navbarTemplate.call(this) : ''
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
<!-- Main Content -->
|
|
40
|
-
${this.loading === true
|
|
41
|
-
? html`<slot name="loader"><div class="loader"></div></slot>`
|
|
42
|
-
: html`
|
|
43
|
-
<main class="main-content regular-font" part="section-main-content">
|
|
44
|
-
<slot></slot>
|
|
45
|
-
<div id="operations-root" class="main-content-inner">
|
|
46
|
-
${this.loadFailed === true
|
|
47
|
-
? html`<div style="text-align: center;margin: 16px;">Unable to load the Spec${this.specUrl ? ': ' : ''}<strong>${this.specUrl}</strong></div>`
|
|
48
|
-
: html`
|
|
49
|
-
<div class="operations-root" @click="${(e) => { this.handleHref(e); }}">
|
|
50
|
-
${this.renderStyle === 'focused'
|
|
51
|
-
? html`${focusedEndpointTemplate.call(this)}`
|
|
52
|
-
: html`
|
|
53
|
-
${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
|
|
54
|
-
${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''}
|
|
55
|
-
${this.allowAuthentication === 'true' ? securitySchemeTemplate.call(this) : ''}
|
|
56
|
-
<section id='section'
|
|
57
|
-
class='observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}'>
|
|
58
|
-
<slot name="custom-section"></slot>
|
|
59
|
-
</section>
|
|
60
|
-
${endpointTemplate.call(this)}`
|
|
61
|
-
}
|
|
62
|
-
</div>
|
|
63
|
-
`
|
|
64
|
-
}`
|
|
65
|
-
}
|
|
66
|
-
</div>
|
|
67
|
-
<slot name="footer"></slot>
|
|
68
|
-
</main>
|
|
69
|
-
</div>
|
|
70
|
-
`;
|
|
71
|
-
}
|
|
72
|
-
/* eslint-enable indent */
|