openapi-explorer 0.8.298 → 0.8.301
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 -1
- package/dist/openapi-explorer.min.js +2 -2
- package/dist/openapi-explorer.min.js.LICENSE.txt +1 -1
- package/dist/openapi-explorer.min.js.LICENSE.txt.gz +0 -0
- package/dist/openapi-explorer.min.js.gz +0 -0
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/openapi-explorer.js +7 -8
- package/src/templates/navbar-template.js +24 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.301",
|
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
|
5
5
|
"author": "Rhosys Developers <developers@rhosys.ch>",
|
|
6
6
|
"repository": {
|
package/src/openapi-explorer.js
CHANGED
|
@@ -58,7 +58,6 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
58
58
|
|
|
59
59
|
// Spec
|
|
60
60
|
specUrl: { type: String, attribute: 'spec-url' },
|
|
61
|
-
specFile: { type: String, attribute: false },
|
|
62
61
|
|
|
63
62
|
// UI Layouts
|
|
64
63
|
layout: { type: String },
|
|
@@ -79,8 +78,6 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
79
78
|
showInfo: { type: String, attribute: 'show-info' },
|
|
80
79
|
allowAuthentication: { type: String, attribute: 'show-authentication' },
|
|
81
80
|
allowTry: { type: String, attribute: 'enable-console' },
|
|
82
|
-
allowSpecUrlLoad: { type: String, attribute: 'allow-spec-url-load' },
|
|
83
|
-
allowSpecFileLoad: { type: String, attribute: 'allow-spec-file-load' },
|
|
84
81
|
allowSearch: { type: String, attribute: 'allow-search' },
|
|
85
82
|
allowAdvancedSearch: { type: String, attribute: 'allow-advanced-search' },
|
|
86
83
|
allowServerSelection: { type: String, attribute: 'show-server-selection' },
|
|
@@ -466,6 +463,11 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
466
463
|
this.intersectionObserver.disconnect();
|
|
467
464
|
}
|
|
468
465
|
}
|
|
466
|
+
if (name === 'explorer-location') {
|
|
467
|
+
window.setTimeout(() => {
|
|
468
|
+
this.scrollTo(newVal);
|
|
469
|
+
}, 0);
|
|
470
|
+
}
|
|
469
471
|
super.attributeChangedCallback(name, oldVal, newVal);
|
|
470
472
|
}
|
|
471
473
|
|
|
@@ -527,10 +529,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
527
529
|
}
|
|
528
530
|
}
|
|
529
531
|
|
|
530
|
-
|
|
531
|
-
this.setAuthenticationConfiguration(apiKeyId, { token });
|
|
532
|
-
}
|
|
533
|
-
|
|
532
|
+
// Public Method
|
|
534
533
|
async setAuthenticationConfiguration(apiKeyId, { token, clientId, clientSecret, redirectUri }) {
|
|
535
534
|
const securityObj = this.resolvedSpec && this.resolvedSpec.securitySchemes.find((v) => (v.apiKeyId === apiKeyId));
|
|
536
535
|
if (!securityObj) {
|
|
@@ -558,7 +557,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
558
557
|
afterSpecParsedAndValidated(spec) {
|
|
559
558
|
this.resolvedSpec = spec;
|
|
560
559
|
|
|
561
|
-
this.dispatchEvent(new CustomEvent('spec-loaded', { detail: spec }));
|
|
560
|
+
this.dispatchEvent(new CustomEvent('spec-loaded', { bubbles: true, detail: spec }));
|
|
562
561
|
this.requestUpdate();
|
|
563
562
|
|
|
564
563
|
// Initiate IntersectionObserver and put it at the end of event loop, to allow loading all the child elements (must for larger specs)
|
|
@@ -1,51 +1,22 @@
|
|
|
1
1
|
import { html } from 'lit-element';
|
|
2
2
|
import { pathIsInSearch } from '../utils/common-utils';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const tagAndPathEl = navLinkEl && navLinkEl.closest('.nav-bar-tag-and-paths');
|
|
6
|
-
if (tagAndPathEl) {
|
|
7
|
-
const expand = tagAndPathEl.classList.contains('collapsed') && action === 'toggle' || action === 'expand';
|
|
8
|
-
if (expand) {
|
|
9
|
-
tagAndPathEl.classList.remove('collapsed');
|
|
10
|
-
tagAndPathEl.classList.add('expanded');
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
tagAndPathEl.classList.remove('expanded');
|
|
15
|
-
tagAndPathEl.classList.add('collapsed');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function onExpandCollapse(tagId, e) {
|
|
4
|
+
function onExpandCollapse(tagId) {
|
|
20
5
|
const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
|
|
21
6
|
if (!tag) {
|
|
22
7
|
return;
|
|
23
8
|
}
|
|
24
|
-
expandCollapseNavBarTag(e.target, 'toggle');
|
|
25
9
|
tag.expanded = !tag.expanded;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.operationsCollapsed = false;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (this.resolvedSpec.tags.every(t => !t.expanded)) {
|
|
32
|
-
this.operationsCollapsed = true;
|
|
10
|
+
if (tag.expanded && this.operationsCollapsed) {
|
|
11
|
+
this.resolvedSpec.tags.filter(t => t.elementId !== tagId).forEach(t => t.expanded = false);
|
|
33
12
|
}
|
|
13
|
+
this.requestUpdate();
|
|
34
14
|
}
|
|
35
15
|
|
|
36
|
-
export function expandCollapseAll(
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (action === 'expand-all') {
|
|
41
|
-
elList.map((el) => { expandCollapseNavBarTag(el, 'expand'); });
|
|
42
|
-
this.resolvedSpec.tags.forEach(t => { t.expanded = true; });
|
|
43
|
-
this.operationsCollapsed = false;
|
|
44
|
-
} else {
|
|
45
|
-
elList.map((el) => { expandCollapseNavBarTag(el, 'collapse'); });
|
|
46
|
-
this.resolvedSpec.tags.forEach(t => { t.expanded = false; });
|
|
47
|
-
this.operationsCollapsed = true;
|
|
48
|
-
}
|
|
16
|
+
export function expandCollapseAll() {
|
|
17
|
+
const expand = this.operationsCollapsed;
|
|
18
|
+
this.operationsCollapsed = !expand;
|
|
19
|
+
this.resolvedSpec.tags.forEach(t => { t.expanded = expand; });
|
|
49
20
|
}
|
|
50
21
|
|
|
51
22
|
/* eslint-disable indent */
|
|
@@ -107,23 +78,23 @@ export default function navbarTemplate() {
|
|
|
107
78
|
|
|
108
79
|
<slot name="nav-section" class="custom-nav-section" data-content-id='section' @click = '${(e) => this.scrollToEventTarget(e, false)}'></slot>
|
|
109
80
|
|
|
110
|
-
<
|
|
111
|
-
<div class="
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
+
}
|
|
124
95
|
</div>
|
|
125
96
|
</div>
|
|
126
|
-
</
|
|
97
|
+
</div>
|
|
127
98
|
|
|
128
99
|
<!-- TAGS AND PATHS-->
|
|
129
100
|
${this.resolvedSpec.tags
|
|
@@ -135,7 +106,7 @@ export default function navbarTemplate() {
|
|
|
135
106
|
? html``
|
|
136
107
|
: html`
|
|
137
108
|
<div class='nav-bar-tag' id="link-${tag.elementId}" data-content-id='${tag.elementId}'
|
|
138
|
-
@click='${(
|
|
109
|
+
@click='${() => { onExpandCollapse.call(this, tag.elementId); }}'>
|
|
139
110
|
|
|
140
111
|
<div style="display: flex; justify-content: space-between; width: 100%;">
|
|
141
112
|
<div>${tag.name}</div>
|