openapi-explorer 2.1.654 → 2.1.658
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/dist/browser/openapi-explorer.min.js +2 -2
- package/dist/es/components/api-request.js +58 -140
- package/dist/es/components/api-response.js +9 -34
- package/dist/es/components/json-tree.js +4 -18
- package/dist/es/components/request-form-table.js +13 -36
- package/dist/es/components/schema-table.js +28 -42
- package/dist/es/components/schema-tree.js +31 -61
- package/dist/es/components/syntax-highlighter.js +7 -26
- package/dist/es/components/tag-input.js +2 -14
- package/dist/es/openapi-explorer-oauth-handler.js +0 -2
- package/dist/es/openapi-explorer.js +62 -174
- package/dist/es/react.js +4 -4
- package/dist/es/styles/input-styles.js +1 -1
- package/dist/es/styles/schema-styles.js +1 -1
- package/dist/es/templates/advance-search-template.js +1 -5
- package/dist/es/templates/callback-template.js +2 -2
- package/dist/es/templates/code-samples-template.js +1 -3
- package/dist/es/templates/components-template.js +41 -4
- package/dist/es/templates/endpoint-template.js +6 -17
- package/dist/es/templates/expanded-endpoint-template.js +4 -7
- package/dist/es/templates/focused-endpoint-template.js +0 -10
- package/dist/es/templates/mainBodyTemplate.js +3 -2
- package/dist/es/templates/navbar-template.js +9 -12
- package/dist/es/templates/overview-template.js +2 -2
- package/dist/es/templates/security-scheme-template.js +12 -73
- package/dist/es/templates/server-template.js +1 -8
- package/dist/es/utils/color-utils.js +2 -21
- package/dist/es/utils/common-utils.js +3 -20
- package/dist/es/utils/schema-utils.js +35 -132
- package/dist/es/utils/spec-parser.js +35 -120
- package/dist/es/utils/theme.js +3 -6
- package/dist/es/utils/xml/xml.js +1 -40
- package/dist/lib/components/api-request.js +58 -157
- package/dist/lib/components/api-response.js +9 -54
- package/dist/lib/components/json-tree.js +4 -27
- package/dist/lib/components/request-form-table.js +14 -42
- package/dist/lib/components/schema-table.js +28 -52
- package/dist/lib/components/schema-tree.js +31 -72
- package/dist/lib/components/syntax-highlighter.js +6 -49
- package/dist/lib/components/tag-input.js +2 -18
- package/dist/lib/languages/en.js +2 -3
- package/dist/lib/languages/fr.js +2 -3
- package/dist/lib/languages/index.js +0 -6
- package/dist/lib/openapi-explorer-oauth-handler.js +0 -6
- package/dist/lib/openapi-explorer.js +61 -197
- package/dist/lib/react.js +4 -5
- package/dist/lib/styles/advanced-search-styles.js +1 -5
- package/dist/lib/styles/api-request-styles.js +1 -5
- package/dist/lib/styles/border-styles.js +1 -5
- package/dist/lib/styles/endpoint-styles.js +1 -5
- package/dist/lib/styles/flex-styles.js +1 -5
- package/dist/lib/styles/font-styles.js +1 -5
- package/dist/lib/styles/info-styles.js +1 -5
- package/dist/lib/styles/input-styles.js +1 -5
- package/dist/lib/styles/key-frame-styles.js +1 -5
- package/dist/lib/styles/nav-styles.js +1 -5
- package/dist/lib/styles/prism-styles.js +1 -5
- package/dist/lib/styles/schema-styles.js +1 -5
- package/dist/lib/styles/tab-styles.js +1 -5
- package/dist/lib/styles/table-styles.js +1 -5
- package/dist/lib/styles/tag-input-styles.js +1 -5
- package/dist/lib/templates/advance-search-template.js +0 -6
- package/dist/lib/templates/callback-template.js +1 -3
- package/dist/lib/templates/code-samples-template.js +0 -4
- package/dist/lib/templates/components-template.js +43 -9
- package/dist/lib/templates/endpoint-template.js +6 -29
- package/dist/lib/templates/expanded-endpoint-template.js +3 -17
- package/dist/lib/templates/focused-endpoint-template.js +0 -19
- package/dist/lib/templates/mainBodyTemplate.js +2 -13
- package/dist/lib/templates/navbar-template.js +9 -20
- package/dist/lib/templates/overview-template.js +1 -6
- package/dist/lib/templates/security-scheme-template.js +12 -79
- package/dist/lib/templates/server-template.js +1 -12
- package/dist/lib/utils/color-utils.js +4 -25
- package/dist/lib/utils/common-utils.js +3 -33
- package/dist/lib/utils/schema-utils.js +33 -141
- package/dist/lib/utils/spec-parser.js +35 -128
- package/dist/lib/utils/theme.js +3 -16
- package/dist/lib/utils/xml/xml.js +1 -42
- package/package.json +2 -2
@@ -3,46 +3,32 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.expandedEndpointBodyTemplate = expandedEndpointBodyTemplate;
|
5
5
|
exports.expandedTagTemplate = expandedTagTemplate;
|
6
|
-
|
7
6
|
var _lit = require("lit");
|
8
|
-
|
9
7
|
var _unsafeHtml = require("lit/directives/unsafe-html.js");
|
10
|
-
|
11
8
|
var _marked = require("marked");
|
12
|
-
|
13
9
|
var _securitySchemeTemplate = require("./security-scheme-template.js");
|
14
|
-
|
15
10
|
var _codeSamplesTemplate = _interopRequireDefault(require("./code-samples-template.js"));
|
16
|
-
|
17
11
|
var _callbackTemplate = _interopRequireDefault(require("./callback-template.js"));
|
18
|
-
|
19
12
|
require("../components/api-request.js");
|
20
|
-
|
21
13
|
require("../components/api-response.js");
|
22
|
-
|
23
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
24
|
-
|
25
15
|
/* eslint-disable indent */
|
26
16
|
function expandedEndpointBodyTemplate(path, tagName = '') {
|
27
17
|
var _path$servers, _path$servers$, _this$selectedServer;
|
28
|
-
|
29
18
|
const acceptContentTypes = new Set();
|
30
|
-
|
31
19
|
for (const respStatus in path.responses) {
|
32
20
|
for (const acceptContentType in (_path$responses$respS = path.responses[respStatus]) === null || _path$responses$respS === void 0 ? void 0 : _path$responses$respS.content) {
|
33
21
|
var _path$responses$respS;
|
34
|
-
|
35
22
|
acceptContentTypes.add(acceptContentType.trim());
|
36
23
|
}
|
37
24
|
}
|
25
|
+
const accept = [...acceptContentTypes].join(', ');
|
38
26
|
|
39
|
-
|
40
|
-
|
27
|
+
// Filter API Keys that are non-empty and are applicable to the the path
|
41
28
|
const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter(v => v.finalKeyValue && path.security && path.security.some(ps => ps[v.apiKeyId])) || [];
|
42
29
|
const codeSampleTabPanel = path.xCodeSamples ? _codeSamplesTemplate.default.call(this, path.xCodeSamples) : '';
|
43
|
-
return (0, _lit.html)` ${this.renderStyle === 'read' ? (0, _lit.html)`<div class="divider" part="operation-divider"></div>` : ''} <div class="expanded-endpoint-body observe-me ${path.method}" part="section-operation ${path.elementId}" id="${path.elementId}"> ${this.renderStyle === 'focused' && tagName && tagName !== 'General ⦂' ? (0, _lit.html)`<h3 class="upper" style="font-weight:700"> ${tagName} </h3>` : ''} ${path.deprecated ? (0, _lit.html)`<div class="bold-text red-text"> DEPRECATED </div>` : ''} <div style="display:flex;justify-content:space-between"> <div style="flex-grow:1"> <h2>${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2> <div class='mono-font part="section-operation-url" regular-font-size' style="padding:8px 0;color:var(--fg3)"> ${path.isWebhook ? (0, _lit.html)`<span style="color:var(--primary-color)"> WEBHOOK </span>` : ''} <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method}</span> <span part="label-operation-path">${path.path}</span> </div> </div> ${path.externalDocs ? (0, _lit.html)`<div class="m-markdown" style="margin-top:2rem;margin-bottom:.5rem;max-width:300px"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.externalDocs.description || ''))} <a href="${path.externalDocs.url}">Navigate to documentation ↗</a> </div>` : ''} </div> <div class="m-markdown" style="margin-right:2rem"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.description || ''))}</div> <slot name="${path.elementId}"></slot> <slot name="path-details" data-method="${path.method}" data-path="${path.path}"></slot> ${_securitySchemeTemplate.pathSecurityTemplate.call(this, path.security)} ${codeSampleTabPanel} <div class="expanded-req-resp-container"> <api-request class="request-panel" method="${path.method}" path="${path.path}" element-id="${path.elementId}" .parameters="${path.parameters}" .request_body="${path.requestBody}" .api_keys="${nonEmptyApiKeys}" .servers="${path.servers}" server-url="${((_path$servers = path.servers) === null || _path$servers === void 0 ? void 0 : (_path$servers$ = _path$servers[0]) === null || _path$servers$ === void 0 ? void 0 : _path$servers$.url) || ((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl)}" fill-defaults="${!this.hideDefaults}" display-nulls="${!!this.includeNulls}" enable-console="${!this.hideExecution}" accept="${accept}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTable ? 'table' : 'tree'}" active-schema-tab="${this.defaultSchemaTab}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-read-only="${this.schemaHideReadOnly}" fetch-credentials="${this.fetchCredentials}" exportparts="btn btn-fill btn-outline btn-try"> </api-request> ${path.callbacks ? _callbackTemplate.default.call(this, path.callbacks) : ''} <api-response class="response-panel" .responses="${path.responses}" display-nulls="${!!this.includeNulls}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTable ? 'table' : 'tree'}" active-schema-tab="${this.defaultSchemaTab}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-write-only="${this.schemaHideWriteOnly}" selected-status="${Object.keys(path.responses || {})[0] || ''}" exportparts="btn--resp btn-fill--resp btn-outline--resp"> </api-response> </div> </div>`;
|
30
|
+
return (0, _lit.html)` ${this.renderStyle === 'read' ? (0, _lit.html)`<div class="divider" part="operation-divider"></div>` : ''} <div class="expanded-endpoint-body observe-me ${path.method}" part="section-operation ${path.elementId}" id="${path.elementId}"> ${this.renderStyle === 'focused' && tagName && tagName !== 'General ⦂' ? (0, _lit.html)`<h3 class="upper" style="font-weight:700"> ${tagName} </h3>` : ''} ${path.deprecated ? (0, _lit.html)`<div class="bold-text red-text"> DEPRECATED </div>` : ''} <div style="display:flex;justify-content:space-between"> <div style="flex-grow:1"> <h2>${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2> <div class='mono-font part="section-operation-url" regular-font-size' style="padding:8px 0;color:var(--fg3)"> ${path.isWebhook ? (0, _lit.html)`<span style="color:var(--primary-color)"> WEBHOOK </span>` : ''} <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method}</span> <span part="label-operation-path">${path.path}</span> </div> </div> ${path.externalDocs ? (0, _lit.html)`<div class="m-markdown" style="margin-top:2rem;margin-bottom:.5rem;max-width:300px"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.externalDocs.description || ''))} <a href="${path.externalDocs.url}">Navigate to documentation ↗</a> </div>` : ''} </div> <div class="m-markdown" style="margin-right:2rem"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(path.description || ''))}</div> <slot name="${path.elementId}"></slot> <slot name="path-details" data-method="${path.method}" data-path="${path.path}"></slot> ${_securitySchemeTemplate.pathSecurityTemplate.call(this, path.security)} ${codeSampleTabPanel} <div class="expanded-req-resp-container"> <api-request class="request-panel" method="${path.method}" path="${path.path}" element-id="${path.elementId}" .parameters="${path.parameters}" .request_body="${path.requestBody}" .api_keys="${nonEmptyApiKeys}" .servers="${path.servers}" server-url="${((_path$servers = path.servers) === null || _path$servers === void 0 ? void 0 : (_path$servers$ = _path$servers[0]) === null || _path$servers$ === void 0 ? void 0 : _path$servers$.url) || ((_this$selectedServer = this.selectedServer) === null || _this$selectedServer === void 0 ? void 0 : _this$selectedServer.computedUrl)}" fill-defaults="${!this.hideDefaults}" display-nulls="${!!this.includeNulls}" enable-console="${!this.hideExecution}" accept="${accept}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTable ? 'table' : 'tree'}" active-schema-tab="${this.defaultSchemaTab}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-read-only="${this.schemaHideReadOnly}" fetch-credentials="${this.fetchCredentials}" @scrollToSchemaComponentByName="${v => this.scrollToSchemaComponentByName(v)}" exportparts="btn btn-fill btn-outline btn-try"> </api-request> ${path.callbacks ? _callbackTemplate.default.call(this, path.callbacks) : ''} <api-response class="response-panel" .responses="${path.responses}" display-nulls="${!!this.includeNulls}" render-style="${this.renderStyle}" schema-style="${this.displaySchemaAsTable ? 'table' : 'tree'}" active-schema-tab="${this.defaultSchemaTab}" schema-expand-level="${this.schemaExpandLevel}" schema-hide-write-only="${this.schemaHideWriteOnly}" selected-status="${Object.keys(path.responses || {})[0] || ''}" @scrollToSchemaComponentByName="${v => this.scrollToSchemaComponentByName(v)}" exportparts="btn--resp btn-fill--resp btn-outline--resp"> </api-response> </div> </div>`;
|
44
31
|
}
|
45
|
-
|
46
32
|
function expandedTagTemplate(tagId, subsectionFullId) {
|
47
33
|
const tag = (this.resolvedSpec.tags || []).find(t => t.elementId === tagId);
|
48
34
|
const subsectionId = subsectionFullId.replace(`${tagId}--`, '');
|
@@ -2,51 +2,36 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = focusedEndpointTemplate;
|
5
|
-
|
6
5
|
var _lit = require("lit");
|
7
|
-
|
8
6
|
var _expandedEndpointTemplate = require("./expanded-endpoint-template.js");
|
9
|
-
|
10
7
|
require("../components/api-request.js");
|
11
|
-
|
12
8
|
require("../components/api-response.js");
|
13
|
-
|
14
9
|
var _componentsTemplate = _interopRequireDefault(require("./components-template.js"));
|
15
|
-
|
16
10
|
var _overviewTemplate = _interopRequireDefault(require("./overview-template.js"));
|
17
|
-
|
18
11
|
var _serverTemplate = _interopRequireDefault(require("./server-template.js"));
|
19
|
-
|
20
12
|
var _securitySchemeTemplate = _interopRequireDefault(require("./security-scheme-template.js"));
|
21
|
-
|
22
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
|
-
|
24
14
|
function wrapFocusedTemplate(templateToWrap) {
|
25
15
|
return (0, _lit.html)` <div class="regular-font section-gap--focused-mode" part="section-operations-in-tag"> ${templateToWrap} </div>`;
|
26
16
|
}
|
27
|
-
|
28
17
|
function defaultContentTemplate() {
|
29
18
|
// In focused mode default content is overview or first path
|
30
19
|
if (!this.hideInfo) {
|
31
20
|
return _overviewTemplate.default.call(this);
|
32
21
|
}
|
33
|
-
|
34
22
|
const selectedTagObj = this.resolvedSpec.tags[0];
|
35
23
|
const selectedPathObj = selectedTagObj === null || selectedTagObj === void 0 ? void 0 : selectedTagObj.paths[0];
|
36
24
|
return selectedPathObj ? wrapFocusedTemplate(_expandedEndpointTemplate.expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name)) : wrapFocusedTemplate('');
|
37
25
|
}
|
38
|
-
|
39
26
|
function focusedEndpointTemplate() {
|
40
27
|
if (!this.explorerLocation || !this.resolvedSpec) {
|
41
28
|
return undefined;
|
42
29
|
}
|
43
|
-
|
44
30
|
const focusElId = this.explorerLocation;
|
45
31
|
let selectedPathObj = null;
|
46
32
|
let selectedTagObj = null;
|
47
33
|
let focusedTemplate;
|
48
34
|
let i = 0;
|
49
|
-
|
50
35
|
if (focusElId.startsWith('overview') && !this.hideInfo) {
|
51
36
|
focusedTemplate = _overviewTemplate.default.call(this);
|
52
37
|
} else if (focusElId === 'auth' && !this.hideAuthentication) {
|
@@ -60,7 +45,6 @@ function focusedEndpointTemplate() {
|
|
60
45
|
} else if (focusElId.startsWith('tag--')) {
|
61
46
|
const idToFocus = focusElId.indexOf('--', 4) > 0 ? focusElId.substring(0, focusElId.indexOf('--', 5)) : focusElId;
|
62
47
|
selectedTagObj = this.resolvedSpec.tags.find(v => v.elementId === idToFocus);
|
63
|
-
|
64
48
|
if (selectedTagObj) {
|
65
49
|
focusedTemplate = _expandedEndpointTemplate.expandedTagTemplate.call(this, idToFocus, focusElId);
|
66
50
|
} else {
|
@@ -70,12 +54,10 @@ function focusedEndpointTemplate() {
|
|
70
54
|
for (i = 0; i < this.resolvedSpec.tags.length; i += 1) {
|
71
55
|
selectedTagObj = this.resolvedSpec.tags[i];
|
72
56
|
selectedPathObj = this.resolvedSpec.tags[i].paths.find(v => `${v.elementId}` === focusElId);
|
73
|
-
|
74
57
|
if (selectedPathObj) {
|
75
58
|
break;
|
76
59
|
}
|
77
60
|
}
|
78
|
-
|
79
61
|
if (selectedPathObj) {
|
80
62
|
focusedTemplate = wrapFocusedTemplate.call(this, _expandedEndpointTemplate.expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name));
|
81
63
|
} else {
|
@@ -83,7 +65,6 @@ function focusedEndpointTemplate() {
|
|
83
65
|
focusedTemplate = defaultContentTemplate.call(this);
|
84
66
|
}
|
85
67
|
}
|
86
|
-
|
87
68
|
return focusedTemplate;
|
88
69
|
}
|
89
70
|
/* eslint-enable indent */
|
@@ -2,30 +2,19 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = mainBodyTemplate;
|
5
|
-
|
6
5
|
var _lit = require("lit");
|
7
|
-
|
8
6
|
var _focusedEndpointTemplate = _interopRequireDefault(require("./focused-endpoint-template.js"));
|
9
|
-
|
10
7
|
var _overviewTemplate = _interopRequireDefault(require("./overview-template.js"));
|
11
|
-
|
12
8
|
var _endpointTemplate = _interopRequireDefault(require("./endpoint-template.js"));
|
13
|
-
|
14
9
|
var _serverTemplate = _interopRequireDefault(require("./server-template.js"));
|
15
|
-
|
16
10
|
var _securitySchemeTemplate = _interopRequireDefault(require("./security-scheme-template.js"));
|
17
|
-
|
18
11
|
var _navbarTemplate = _interopRequireDefault(require("./navbar-template.js"));
|
19
|
-
|
20
12
|
var _advanceSearchTemplate = _interopRequireDefault(require("./advance-search-template.js"));
|
21
|
-
|
22
13
|
var _theme = _interopRequireDefault(require("../utils/theme.js"));
|
23
|
-
|
24
14
|
var _colorUtils = _interopRequireDefault(require("../utils/color-utils.js"));
|
25
|
-
|
26
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
27
|
-
|
28
16
|
// Templates
|
17
|
+
|
29
18
|
function mainBodyTemplate() {
|
30
19
|
const newTheme = {
|
31
20
|
bg1: _colorUtils.default.isValidHexColor(this.bgColor) ? this.bgColor : '',
|
@@ -39,8 +28,8 @@ function mainBodyTemplate() {
|
|
39
28
|
navHoverBgColor: _colorUtils.default.isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
|
40
29
|
navHoverTextColor: _colorUtils.default.isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : ''
|
41
30
|
};
|
42
|
-
/* eslint-disable indent */
|
43
31
|
|
32
|
+
/* eslint-disable indent */
|
44
33
|
return (0, _lit.html)` ${_theme.default.call(this, newTheme)} ${this.hideSearch ? '' : _advanceSearchTemplate.default.call(this)} <div id="the-main-body" class="body"> ${this.renderStyle === 'focused' && this.resolvedSpec ? _navbarTemplate.default.call(this) : ''} ${this.loading === true ? (0, _lit.html)`<slot name="loader"><div class="loader"></div></slot>` : (0, _lit.html)` <main class="main-content regular-font" part="section-main-content"> <slot></slot> <div id="operations-root" class="main-content-inner"> ${this.loadFailed === true ? (0, _lit.html)`<div style="text-align:center;margin:16px">Unable to load the Spec${this.specUrl ? ': ' : ''}<strong>${this.specUrl}</strong></div>` : (0, _lit.html)` <div class="operations-root" @click="${e => {
|
45
34
|
this.handleHref(e);
|
46
35
|
}}"> ${this.renderStyle === 'focused' ? (0, _lit.html)`${_focusedEndpointTemplate.default.call(this)}` : (0, _lit.html)` ${!this.hideInfo ? _overviewTemplate.default.call(this) : ''} ${!this.hideServerSelection ? _serverTemplate.default.call(this) : ''} ${!this.hideAuthentication ? _securitySchemeTemplate.default.call(this) : ''} <section id="section" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="custom-section"></slot> </section> ${_endpointTemplate.default.call(this)}`} </div> `}</div></main>`} </div> <slot name="footer"></slot> `;
|
@@ -4,33 +4,23 @@ exports.__esModule = true;
|
|
4
4
|
exports.default = navbarTemplate;
|
5
5
|
exports.expandCollapseAll = expandCollapseAll;
|
6
6
|
exports.expandCollapseAllComponents = expandCollapseAllComponents;
|
7
|
-
|
8
7
|
var _lit = require("lit");
|
9
|
-
|
10
8
|
var _marked = require("marked");
|
11
|
-
|
12
9
|
var _commonUtils = require("../utils/common-utils.js");
|
13
|
-
|
14
10
|
var _index = require("../languages/index.js");
|
15
|
-
|
16
11
|
var _endpointTemplate = require("./endpoint-template.js");
|
17
|
-
|
12
|
+
var _componentsTemplate = require("./components-template.js");
|
18
13
|
function onExpandCollapse(tagId) {
|
19
14
|
const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
|
20
|
-
|
21
15
|
if (!tag) {
|
22
16
|
return;
|
23
17
|
}
|
24
|
-
|
25
18
|
tag.expanded = !tag.expanded;
|
26
|
-
|
27
19
|
if (tag.expanded && this.operationsCollapsed) {
|
28
20
|
this.resolvedSpec.tags.filter(t => t.elementId !== tagId).forEach(t => t.expanded = false);
|
29
21
|
}
|
30
|
-
|
31
22
|
this.requestUpdate();
|
32
23
|
}
|
33
|
-
|
34
24
|
function expandCollapseAll() {
|
35
25
|
const expand = this.operationsCollapsed;
|
36
26
|
this.operationsCollapsed = !expand;
|
@@ -39,7 +29,6 @@ function expandCollapseAll() {
|
|
39
29
|
});
|
40
30
|
this.requestUpdate();
|
41
31
|
}
|
42
|
-
|
43
32
|
function expandCollapseAllComponents() {
|
44
33
|
const expand = this.componentsCollapsed;
|
45
34
|
this.componentsCollapsed = !expand;
|
@@ -48,22 +37,22 @@ function expandCollapseAllComponents() {
|
|
48
37
|
});
|
49
38
|
this.requestUpdate();
|
50
39
|
}
|
51
|
-
/* eslint-disable indent */
|
52
|
-
|
53
40
|
|
41
|
+
/* eslint-disable indent */
|
54
42
|
function navbarTemplate() {
|
55
43
|
var _this$resolvedSpec$co;
|
56
|
-
|
57
44
|
return (0, _lit.html)` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> <slot name="nav-header"></slot> ${this.hideSearch ? '' : (0, _lit.html)` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px"> <div style="display:flex;flex:1;line-height:22px"> <input id="nav-bar-search" part="textbox textbox-nav-filter" style="width:100%;padding-right:20px;color:var(--nav-hover-text-color);border-color:var(--secondary-color);background-color:var(--nav-hover-bg-color)" type="text" placeholder="${(0, _index.getI18nText)('menu.filter')}" @input="${this.onSearchChange}" spellcheck="false"> </div> <button class="m-btn outline-primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> ${(0, _index.getI18nText)('menu.search')} </button> </div> `} ${(0, _lit.html)`<nav class="nav-scroll" part="navbar-scroll"> ${this.hideInfo || !this.resolvedSpec.info ? '' : (0, _lit.html)`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}"> ${this.resolvedSpec.info.title || (0, _index.getI18nText)('menu.overview')} </div>`} ${this.hideServerSelection ? '' : (0, _lit.html)`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}"> ${(0, _index.getI18nText)('menu.api-servers')} </div>`} ${this.hideAuthentication || !this.resolvedSpec.securitySchemes ? '' : (0, _lit.html)`<div class="nav-bar-info" id="link-auth" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> ${(0, _index.getI18nText)('menu.authentication')} </div>`} <slot name="nav-section" class="custom-nav-section" data-content-id="section" @click="${e => this.scrollToCustomNavSectionTarget(e, false)}"></slot> <div class="sticky-scroll-element ${this.operationsCollapsed ? 'collapsed' : ''}" @click="${() => {
|
58
45
|
expandCollapseAll.call(this);
|
59
46
|
}}"> <div class="nav-bar-section" part="navbar-operations-header"> <slot name="operations-header"> <div class="nav-bar-section-title">${(0, _index.getI18nText)('menu.operations')}</div> </slot> <div style="" part="navbar-operations-header-collapse"> ${this.resolvedSpec.tags.length > 1 && this.resolvedSpec.tags.some(tag => !tag.paths.length && !this.matchPaths || tag.paths.some(path => (0, _commonUtils.pathIsInSearch)(this.matchPaths, path))) ? (0, _lit.html)` <div class="toggle">▾</div>` : ''} </div> </div> </div> ${this.resolvedSpec.tags.filter(tag => !tag.paths.length && !this.matchPaths || tag.paths.some(path => (0, _commonUtils.pathIsInSearch)(this.matchPaths, path))).map(tag => (0, _lit.html)` <slot name="nav-${tag.elementId}"> <div class="nav-bar-tag-and-paths ${tag.expanded ? '' : 'collapsed'}"> ${tag.name === 'General ⦂' ? (0, _lit.html)`` : (0, _lit.html)` <div class="nav-bar-tag" id="link-${tag.elementId}" data-content-id="${tag.elementId}" @click="${() => {
|
60
47
|
onExpandCollapse.call(this, tag.elementId);
|
61
48
|
}}"> <div style="display:flex;justify-content:space-between;width:100%"> <div style="margin-right:.5rem">${tag.name}</div> <div class="toggle">▾</div> </div> </div> `} <div class="nav-bar-section-wrapper"> <div> ${tag.headers.map(header => (0, _lit.html)` <div class="nav-bar-h${header.depth}" id="link-${tag.elementId}--${new _marked.marked.Slugger().slug(header.text)}" data-content-id="${tag.elementId}--${new _marked.marked.Slugger().slug(header.text)}" @click="${e => this.scrollToEventTarget(e, false)}"> ${header.text} </div>`)} </div> <div class="nav-bar-paths-under-tag"> ${tag.paths.filter(v => (0, _commonUtils.pathIsInSearch)(this.matchPaths, v)).map(p => (0, _lit.html)` <div class="nav-bar-path ${this.usePathInNavBar ? 'small-font' : ''}" data-content-id="${p.elementId}" id="link-${p.elementId}" @click="${e => {
|
62
49
|
this.scrollToEventTarget(e, false);
|
63
|
-
}}"> <span style="${p.deprecated ? 'filter:opacity(0.5)' : ''}"> ${this.usePathInNavBar ? (0, _lit.html)`<div class="mono-font" style="display:flex;align-items:center"> <div class="method ${p.method}"><span style="line-height:1">${p.method}</span></div> <div style="display:flex;flex-wrap:wrap">${p.path.split('/').filter(t => t.trim()).map(t => (0, _lit.html)`<span>/${t}</span>`)}</div> </div>` : p.summary || p.shortSummary} ${p.isWebhook ? '(Webhook)' : ''} </span> </div>`)} </div> </div> </div> </slot> `)} ${(_this$resolvedSpec$co = this.resolvedSpec.components) !== null && _this$resolvedSpec$co !== void 0 && _this$resolvedSpec$co.length && !this.hideComponents ? (0, _lit.html)` <div class="sticky-scroll-element"> <div id="link-components" class="nav-bar-section"> <slot name="components-header"> <div class="nav-bar-section-title">${(0, _index.getI18nText)('menu.components')}</div> </slot> </div> </div> ${this.resolvedSpec.components.filter(c => c.subComponents.some(s => (0, _commonUtils.componentIsInSearch)(this.matchPaths, s))).map(component =>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
50
|
+
}}"> <span style="${p.deprecated ? 'filter:opacity(0.5)' : ''}"> ${this.usePathInNavBar ? (0, _lit.html)`<div class="mono-font" style="display:flex;align-items:center"> <div class="method ${p.method}"><span style="line-height:1">${p.method}</span></div> <div style="display:flex;flex-wrap:wrap">${p.path.split('/').filter(t => t.trim()).map(t => (0, _lit.html)`<span>/${t}</span>`)}</div> </div>` : p.summary || p.shortSummary} ${p.isWebhook ? '(Webhook)' : ''} </span> </div>`)} </div> </div> </div> </slot> `)} ${(_this$resolvedSpec$co = this.resolvedSpec.components) !== null && _this$resolvedSpec$co !== void 0 && _this$resolvedSpec$co.length && !this.hideComponents ? (0, _lit.html)` <div class="sticky-scroll-element"> <div id="link-components" class="nav-bar-section"> <slot name="components-header"> <div class="nav-bar-section-title">${(0, _index.getI18nText)('menu.components')}</div> </slot> </div> </div> ${this.resolvedSpec.components.filter(c => c.subComponents.some(s => (0, _commonUtils.componentIsInSearch)(this.matchPaths, s))).map(component => {
|
51
|
+
const componentInfo = (0, _componentsTemplate.getComponentInfo)(component.componentKeyId);
|
52
|
+
return (0, _lit.html)` <div class="nav-bar-tag-and-paths ${component.expanded ? '' : 'collapsed'}"> <div class="nav-bar-tag" data-content-id="cmp--${componentInfo.name.toLowerCase()}" id="link-cmp--${componentInfo.name.toLowerCase()}" @click="${e => {
|
53
|
+
_endpointTemplate.expandCollapseComponent.call(this, component);
|
54
|
+
this.scrollToEventTarget(e, false);
|
55
|
+
}}"> <div> ${componentInfo.name} </div> <div style="" part="navbar-components-header-collapse"> <div class="toggle">▾</div> </div> </div> <div class="nav-bar-section-wrapper"> <div class="nav-bar-paths-under-tag"> ${component.subComponents.filter(s => (0, _commonUtils.componentIsInSearch)(this.matchPaths, s)).map(p => (0, _lit.html)` <div class="nav-bar-path" data-content-id="cmp--${p.id}" id="link-cmp--${p.id}" @click="${e => this.scrollToEventTarget(e, false)}"> <span> ${p.name} </span> </div>`)} </div> </div> </div>`;
|
56
|
+
})}` : ''} </nav>`} </nav> `;
|
68
57
|
}
|
69
58
|
/* eslint-enable indent */
|
@@ -2,17 +2,12 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = overviewTemplate;
|
5
|
-
|
6
5
|
var _lit = require("lit");
|
7
|
-
|
8
6
|
var _unsafeHtml = require("lit/directives/unsafe-html.js");
|
9
|
-
|
10
7
|
var _marked = require("marked");
|
11
|
-
|
12
8
|
var _index = require("../languages/index.js");
|
13
|
-
|
14
9
|
/* eslint-disable indent */
|
15
10
|
function overviewTemplate() {
|
16
|
-
return (0, _lit.html)` <section id="overview" part="section-overview" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> ${this.resolvedSpec && this.resolvedSpec.info ? (0, _lit.html)` <slot name="overview"> <div id="api-title" part="label-overview-title" style="font-size:32px" class="section-padding"> ${this.resolvedSpec.info.title} ${!this.resolvedSpec.info.version ? '' : (0, _lit.html)` <span style="font-size:var(--font-size-small);font-weight:700"> ${this.resolvedSpec.info.version} </span>`} </div> <div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px);margin-top:8px" class="section-padding"> ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.email ? (0, _lit.html)`<span>${this.resolvedSpec.info.contact.name || (0, _index.getI18nText)('overview.email')}: <a href="mailto:${this.resolvedSpec.info.contact.email}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a> </span>` : ''} ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.url ? (0, _lit.html)`<span>URL: <a href="${this.resolvedSpec.info.contact.url}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>` : ''} ${this.resolvedSpec.info.license ? (0, _lit.html)`<span>License: ${this.resolvedSpec.info.license.url ? (0, _lit.html)`<a href="${this.resolvedSpec.info.license.url}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>` : this.resolvedSpec.info.license.name} </span>` : ''} ${this.resolvedSpec.info.termsOfService ? (0, _lit.html)`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">${(0, _index.getI18nText)('overview.terms-of-service')}</a></span>` : ''} </div> </slot> <slot name="overview-api-description"> ${this.resolvedSpec.info.description ? (0, _lit.html)`${(0, _unsafeHtml.unsafeHTML)(`<div class="m-markdown regular-font section-padding">${(0, _marked.marked)(this.resolvedSpec.info.description)}</div>`)}` : ''} </slot> ` : ''} </section> `;
|
11
|
+
return (0, _lit.html)` <section id="overview" part="section-overview" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> ${this.resolvedSpec && this.resolvedSpec.info ? (0, _lit.html)` <slot name="overview-header"></slot> <slot name="overview"> <div id="api-title" part="label-overview-title" style="font-size:32px" class="section-padding"> ${this.resolvedSpec.info.title} ${!this.resolvedSpec.info.version ? '' : (0, _lit.html)` <span style="font-size:var(--font-size-small);font-weight:700"> ${this.resolvedSpec.info.version} </span>`} </div> <div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px);margin-top:8px" class="section-padding"> ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.email ? (0, _lit.html)`<span>${this.resolvedSpec.info.contact.name || (0, _index.getI18nText)('overview.email')}: <a href="mailto:${this.resolvedSpec.info.contact.email}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a> </span>` : ''} ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.url ? (0, _lit.html)`<span>URL: <a href="${this.resolvedSpec.info.contact.url}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>` : ''} ${this.resolvedSpec.info.license ? (0, _lit.html)`<span>License: ${this.resolvedSpec.info.license.url ? (0, _lit.html)`<a href="${this.resolvedSpec.info.license.url}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>` : this.resolvedSpec.info.license.name} </span>` : ''} ${this.resolvedSpec.info.termsOfService ? (0, _lit.html)`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">${(0, _index.getI18nText)('overview.terms-of-service')}</a></span>` : ''} </div> </slot> <slot name="overview-body"></slot> <slot name="overview-api-description"> ${this.resolvedSpec.info.description ? (0, _lit.html)`${(0, _unsafeHtml.unsafeHTML)(`<div class="m-markdown regular-font section-padding">${(0, _marked.marked)(this.resolvedSpec.info.description)}</div>`)}` : ''} </slot> <slot name="overview-footer"></slot> ` : ''} </section> `;
|
17
12
|
}
|
18
13
|
/* eslint-enable indent */
|