openapi-explorer 0.8.266 → 0.8.271
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/openapi-explorer.min.js +4 -4
- 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/components/api-request.js +3 -3
- package/src/openapi-explorer.js +15 -8
- package/src/styles/input-styles.js +8 -0
- package/src/templates/code-samples-template.js +1 -1
- package/src/templates/endpoint-template.js +1 -1
- package/src/templates/focused-endpoint-template.js +1 -1
- package/src/templates/overview-template.js +1 -1
- package/src/templates/{main-body-template.js → responsiveViewMainBodyTemplate.js} +3 -3
- package/src/templates/security-scheme-template.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-explorer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.271",
|
|
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": {
|
|
@@ -733,7 +733,7 @@ export default class ApiRequest extends LitElement {
|
|
|
733
733
|
: html`
|
|
734
734
|
<div class="tab-content col m-markdown" style="flex:1;display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};" >
|
|
735
735
|
<button class="toolbar-btn" @click='${(e) => { copyToClipboard(this.responseText, e); }}' part="btn btn-fill"> Copy </button>
|
|
736
|
-
<pre
|
|
736
|
+
<pre>${responseFormat
|
|
737
737
|
? html`<code>${unsafeHTML(Prism.highlight(this.responseText, Prism.languages[responseFormat], responseFormat))}</code>`
|
|
738
738
|
: `${this.responseText}`
|
|
739
739
|
}
|
|
@@ -742,11 +742,11 @@ export default class ApiRequest extends LitElement {
|
|
|
742
742
|
}
|
|
743
743
|
<div class="tab-content col m-markdown" style="flex:1;display:${this.activeResponseTab === 'headers' ? 'flex' : 'none'};" >
|
|
744
744
|
<button class="toolbar-btn" @click='${(e) => { copyToClipboard(this.responseHeaders, e); }}' part="btn btn-fill"> Copy </button>
|
|
745
|
-
<pre
|
|
745
|
+
<pre><code>${unsafeHTML(Prism.highlight(this.responseHeaders, Prism.languages.css, 'css'))}</code></pre>
|
|
746
746
|
</div>
|
|
747
747
|
<div class="tab-content col m-markdown" style="flex:1;display:${this.activeResponseTab === 'curl' ? 'flex' : 'none'};">
|
|
748
748
|
<button class="toolbar-btn" @click='${(e) => { copyToClipboard(this.curlSyntax.replace(/\\$/, ''), e); }}' part="btn btn-fill"> Copy </button>
|
|
749
|
-
<pre
|
|
749
|
+
<pre><code>${unsafeHTML(Prism.highlight(this.curlSyntax.trim().replace(/\\$/, ''), Prism.languages.shell, 'shell'))}</code></pre>
|
|
750
750
|
</div>
|
|
751
751
|
</div>`;
|
|
752
752
|
}
|
package/src/openapi-explorer.js
CHANGED
|
@@ -27,7 +27,7 @@ import advancedSearchStyles from './styles/advanced-search-styles';
|
|
|
27
27
|
|
|
28
28
|
import { advancedSearch, getCurrentElement, pathIsInSearch, replaceState, sleep } from './utils/common-utils';
|
|
29
29
|
import ProcessSpec from './utils/spec-parser';
|
|
30
|
-
import
|
|
30
|
+
import responsiveViewMainBodyTemplate from './templates/responsiveViewMainBodyTemplate';
|
|
31
31
|
import apiRequestStyles from './styles/api-request-styles';
|
|
32
32
|
import { checkForAuthToken } from './templates/security-scheme-template';
|
|
33
33
|
|
|
@@ -180,8 +180,11 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
180
180
|
.section-gap.section-tag {
|
|
181
181
|
border-bottom:1px solid var(--border-color);
|
|
182
182
|
}
|
|
183
|
+
.method-section-gap {
|
|
184
|
+
padding: 24px 8px 0px 4px;
|
|
185
|
+
}
|
|
183
186
|
.section-gap {
|
|
184
|
-
padding: 0px
|
|
187
|
+
padding: 24px 0px 0px;
|
|
185
188
|
}
|
|
186
189
|
.section-tag-header {
|
|
187
190
|
position:relative;
|
|
@@ -432,7 +435,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
432
435
|
}
|
|
433
436
|
|
|
434
437
|
render() {
|
|
435
|
-
return
|
|
438
|
+
return responsiveViewMainBodyTemplate.call(this);
|
|
436
439
|
}
|
|
437
440
|
|
|
438
441
|
observeExpandedContent() {
|
|
@@ -700,8 +703,9 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
700
703
|
|
|
701
704
|
let repeatedElementIndex;
|
|
702
705
|
if (navEl.dataset.contentId === 'section') {
|
|
703
|
-
const
|
|
704
|
-
|
|
706
|
+
const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
|
|
707
|
+
const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
|
|
708
|
+
repeatedElementIndex = assignedNodes && [].findIndex.call(assignedNodes, (slot) => slot === event.target);
|
|
705
709
|
}
|
|
706
710
|
this.isIntersectionObserverActive = false;
|
|
707
711
|
this.scrollTo(navEl.dataset.contentId, true, scrollNavItemToView, repeatedElementIndex);
|
|
@@ -757,8 +761,9 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
757
761
|
// Update NavBar View and Styles
|
|
758
762
|
let newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
|
759
763
|
if (elementId === 'section') {
|
|
760
|
-
const
|
|
761
|
-
|
|
764
|
+
const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
|
|
765
|
+
const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
|
|
766
|
+
newNavEl = assignedNodes && assignedNodes[repeatedElementIndex || 0];
|
|
762
767
|
}
|
|
763
768
|
|
|
764
769
|
if (!newNavEl) {
|
|
@@ -773,7 +778,9 @@ export default class OpenApiExplorer extends LitElement {
|
|
|
773
778
|
if (oldNavEl) {
|
|
774
779
|
oldNavEl.classList.remove('active');
|
|
775
780
|
}
|
|
776
|
-
this.shadowRoot.querySelector('slot.custom-nav-section')
|
|
781
|
+
const navSectionSlot = this.shadowRoot.querySelector('slot.custom-nav-section');
|
|
782
|
+
const assignedNodes = navSectionSlot && navSectionSlot.assignedNodes();
|
|
783
|
+
(assignedNodes || []).filter((n, nodeIndex) => nodeIndex !== repeatedElementIndex).forEach((node) => {
|
|
777
784
|
node.classList.remove('active');
|
|
778
785
|
});
|
|
779
786
|
newNavEl.classList.add('active'); // must add the class after scrolling
|
|
@@ -59,6 +59,14 @@ export default css`
|
|
|
59
59
|
position: absolute;
|
|
60
60
|
top: 8px;
|
|
61
61
|
right: 8px;
|
|
62
|
+
margin-right: 8px;
|
|
63
|
+
}
|
|
64
|
+
.tab-content .toolbar-btn + pre {
|
|
65
|
+
white-space: pre;
|
|
66
|
+
max-height:400px;
|
|
67
|
+
overflow: auto;
|
|
68
|
+
display: flex;
|
|
69
|
+
padding-right: 70px;
|
|
62
70
|
}
|
|
63
71
|
|
|
64
72
|
input, textarea, select, button, pre {
|
|
@@ -25,7 +25,7 @@ export default function codeSamplesTemplate(xCodeSamples) {
|
|
|
25
25
|
${xCodeSamples.map((v, i) => html`
|
|
26
26
|
<div class="tab-content m-markdown code-sample-wrapper" style= "display:${i === 0 ? 'block' : 'none'}" data-tab = '${v.lang}${i}'>
|
|
27
27
|
<button class="toolbar-btn" @click='${(e) => { copyToClipboard(v.source, e); }}'> Copy </button>
|
|
28
|
-
<pre
|
|
28
|
+
<pre>
|
|
29
29
|
<code>${Prism.languages[v.lang && v.lang.toLowerCase()] ? unsafeHTML(Prism.highlight(v.source, Prism.languages[v.lang && v.lang.toLowerCase()], v.lang && v.lang.toLowerCase())) : v.source}</code>
|
|
30
30
|
</pre>
|
|
31
31
|
</div>`)
|
|
@@ -144,7 +144,7 @@ export default function endpointTemplate() {
|
|
|
144
144
|
<span @click="${(e) => expandCollapseAll.call(this, e, 'collapse-all')}" style="color:var(--primary-color); cursor: pointer;">Collapse</span>
|
|
145
145
|
</div>
|
|
146
146
|
${(this.resolvedSpec && this.resolvedSpec.tags || []).map((tag) => html`
|
|
147
|
-
<div class='regular-font section-gap section-tag ${tag.expanded ? 'expanded' : 'collapsed'}' >
|
|
147
|
+
<div class='regular-font method-section-gap section-tag ${tag.expanded ? 'expanded' : 'collapsed'}' >
|
|
148
148
|
|
|
149
149
|
<div class='section-tag-header' @click="${(e) => toggleTag.call(this, e, tag.elementId)}">
|
|
150
150
|
<div id='${tag.elementId}' class="sub-title tag" style="color:var(--primary-color)">${tag.name}</div>
|
|
@@ -72,7 +72,7 @@ export default function focusedEndpointTemplate() {
|
|
|
72
72
|
} else if (focusElId === 'section') {
|
|
73
73
|
focusedTemplate = html`
|
|
74
74
|
<section id='section' style="margin-top:24px; margin-bottom:24px;"
|
|
75
|
-
class='observe-me ${this.renderStyle === '
|
|
75
|
+
class='observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}'>
|
|
76
76
|
<slot name="custom-section"></slot>
|
|
77
77
|
</section>`;
|
|
78
78
|
} else if (focusElId.startsWith('cmp--') && this.showComponents === 'true') {
|
|
@@ -12,7 +12,7 @@ function headingRenderer() {
|
|
|
12
12
|
export default function overviewTemplate() {
|
|
13
13
|
return html`
|
|
14
14
|
<section id="overview" part="section-overview"
|
|
15
|
-
class="observe-me ${this.renderStyle === '
|
|
15
|
+
class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}">
|
|
16
16
|
${this.resolvedSpec && this.resolvedSpec.info
|
|
17
17
|
? html`
|
|
18
18
|
<slot name="overview">
|
|
@@ -12,7 +12,7 @@ import advancedSearchTemplate from './advance-search-template';
|
|
|
12
12
|
import SetTheme from '../utils/theme';
|
|
13
13
|
import ColorUtils from '../utils/color-utils';
|
|
14
14
|
|
|
15
|
-
export default function
|
|
15
|
+
export default function responsiveViewMainBodyTemplate() {
|
|
16
16
|
const newTheme = {
|
|
17
17
|
bg1: ColorUtils.isValidHexColor(this.bgColor) ? this.bgColor : '',
|
|
18
18
|
fg1: ColorUtils.isValidHexColor(this.textColor) ? this.textColor : '',
|
|
@@ -57,8 +57,8 @@ export default function mainBodyTemplate() {
|
|
|
57
57
|
${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
|
|
58
58
|
${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''}
|
|
59
59
|
${this.allowAuthentication === 'true' ? securitySchemeTemplate.call(this) : ''}
|
|
60
|
-
<section id='section'
|
|
61
|
-
class='observe-me ${this.renderStyle === '
|
|
60
|
+
<section id='section'
|
|
61
|
+
class='observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}'>
|
|
62
62
|
<slot name="custom-section"></slot>
|
|
63
63
|
</section>
|
|
64
64
|
${this.renderStyle === 'read'
|
|
@@ -298,7 +298,7 @@ export default function securitySchemeTemplate() {
|
|
|
298
298
|
}
|
|
299
299
|
const providedApiKeys = schemes.filter((v) => (v.finalKeyValue));
|
|
300
300
|
return html`
|
|
301
|
-
<section id='auth' part="section-auth" class = 'observe-me ${this.renderStyle === '
|
|
301
|
+
<section id='auth' part="section-auth" class = 'observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}'>
|
|
302
302
|
<slot name="authentication">
|
|
303
303
|
<div class="section-padding">
|
|
304
304
|
<div class='sub-title regular-font'>AUTHENTICATION</div>
|