openapi-explorer 1.2.610 → 2.0.612

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.
@@ -1,6 +1,5 @@
1
1
  import { LitElement, html } from 'lit';
2
2
  import { marked } from 'marked';
3
- import mimeTypeResolver from './mime-types.js';
4
3
  import { unsafeHTML } from 'lit/directives/unsafe-html.js';
5
4
  import { keyed } from 'lit/directives/keyed.js';
6
5
  import formatXml from 'xml-but-prettier';
@@ -863,10 +862,12 @@ export default class ApiRequest extends LitElement {
863
862
  }
864
863
 
865
864
  if (this.responseIsBlob) {
865
+ var _filename$;
866
+
866
867
  const contentDisposition = fetchResponse.headers.get('content-disposition');
867
868
  const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
868
869
  const filename = filenameRegex.exec(contentDisposition);
869
- this.respContentDisposition = filename && filename[1] && filename[1].replace(/['"]/g, '') || `download.${(await mimeTypeResolver(contentType)) || 'file'}`;
870
+ this.respContentDisposition = (filename === null || filename === void 0 ? void 0 : (_filename$ = filename[1]) === null || _filename$ === void 0 ? void 0 : _filename$.replace(/['"]/g, '')) || 'download.file';
870
871
  respBlob = await fetchResponse.blob();
871
872
  this.responseBlobUrl = URL.createObjectURL(respBlob);
872
873
  }
@@ -107,9 +107,9 @@ export default class OpenApiExplorer extends LitElement {
107
107
  type: String,
108
108
  attribute: 'show-info'
109
109
  },
110
- allowAuthentication: {
111
- type: String,
112
- attribute: 'show-authentication'
110
+ hideAuthentication: {
111
+ type: Boolean,
112
+ attribute: 'hide-authentication'
113
113
  },
114
114
  allowTry: {
115
115
  type: String,
@@ -119,17 +119,13 @@ export default class OpenApiExplorer extends LitElement {
119
119
  type: Boolean,
120
120
  attribute: 'display-nulls'
121
121
  },
122
- allowSearch: {
123
- type: String,
124
- attribute: 'allow-search'
125
- },
126
- allowAdvancedSearch: {
127
- type: String,
128
- attribute: 'allow-advanced-search'
122
+ hideSearch: {
123
+ type: Boolean,
124
+ attribute: 'hide-search'
129
125
  },
130
- allowServerSelection: {
131
- type: String,
132
- attribute: 'show-server-selection'
126
+ hideServerSelection: {
127
+ type: Boolean,
128
+ attribute: 'hide-server-selection'
133
129
  },
134
130
  hideComponents: {
135
131
  type: Boolean,
@@ -274,14 +270,6 @@ export default class OpenApiExplorer extends LitElement {
274
270
  this.responseAreaHeight = '300px';
275
271
  }
276
272
 
277
- if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) {
278
- this.allowSearch = 'true';
279
- }
280
-
281
- if (!this.allowAdvancedSearch || !'true, false,'.includes(`${this.allowAdvancedSearch},`)) {
282
- this.allowAdvancedSearch = 'true';
283
- }
284
-
285
273
  if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) {
286
274
  this.allowTry = 'true';
287
275
  }
@@ -294,14 +282,6 @@ export default class OpenApiExplorer extends LitElement {
294
282
  this.showInfo = 'true';
295
283
  }
296
284
 
297
- if (!this.allowServerSelection || !'true, false,'.includes(`${this.allowServerSelection},`)) {
298
- this.allowServerSelection = 'true';
299
- }
300
-
301
- if (!this.allowAuthentication || !'true, false,'.includes(`${this.allowAuthentication},`)) {
302
- this.allowAuthentication = 'true';
303
- }
304
-
305
285
  if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) {
306
286
  this.fetchCredentials = '';
307
287
  }
@@ -567,11 +547,11 @@ export default class OpenApiExplorer extends LitElement {
567
547
  return true;
568
548
  }
569
549
 
570
- if (id === 'servers' && this.allowServerSelection) {
550
+ if (id === 'servers' && !this.hideServerSelection) {
571
551
  return true;
572
552
  }
573
553
 
574
- if (id === 'auth' && this.allowAuthentication) {
554
+ if (id === 'auth' && !this.hideAuthentication) {
575
555
  return true;
576
556
  }
577
557
 
@@ -35,9 +35,9 @@ export default function focusedEndpointTemplate() {
35
35
 
36
36
  if (focusElId.startsWith('overview') && this.showInfo === 'true') {
37
37
  focusedTemplate = overviewTemplate.call(this);
38
- } else if (focusElId === 'auth' && this.allowAuthentication === 'true') {
38
+ } else if (focusElId === 'auth' && !this.hideAuthentication) {
39
39
  focusedTemplate = securitySchemeTemplate.call(this);
40
- } else if (focusElId === 'servers' && this.allowServerSelection === 'true') {
40
+ } else if (focusElId === 'servers' && !this.hideServerSelection) {
41
41
  focusedTemplate = serverTemplate.call(this);
42
42
  } else if (focusElId.startsWith('section')) {
43
43
  focusedTemplate = html` <section id="section" class="observe-me"> <slot name="custom-section"></slot> </section>`;
@@ -24,8 +24,8 @@ export default function mainBodyTemplate() {
24
24
  };
25
25
  /* eslint-disable indent */
26
26
 
27
- return html` ${SetTheme.call(this, newTheme)} ${this.allowAdvancedSearch === 'false' ? '' : advancedSearchTemplate.call(this)} <div id="the-main-body" class="body"> ${this.renderStyle === 'focused' && this.resolvedSpec ? navbarTemplate.call(this) : ''} ${this.loading === true ? html`<slot name="loader"><div class="loader"></div></slot>` : html` <main class="main-content regular-font" part="section-main-content"> <slot></slot> <div id="operations-root" class="main-content-inner"> ${this.loadFailed === true ? html`<div style="text-align:center;margin:16px">Unable to load the Spec${this.specUrl ? ': ' : ''}<strong>${this.specUrl}</strong></div>` : html` <div class="operations-root" @click="${e => {
27
+ return html` ${SetTheme.call(this, newTheme)} ${this.hideSearch ? '' : advancedSearchTemplate.call(this)} <div id="the-main-body" class="body"> ${this.renderStyle === 'focused' && this.resolvedSpec ? navbarTemplate.call(this) : ''} ${this.loading === true ? html`<slot name="loader"><div class="loader"></div></slot>` : html` <main class="main-content regular-font" part="section-main-content"> <slot></slot> <div id="operations-root" class="main-content-inner"> ${this.loadFailed === true ? html`<div style="text-align:center;margin:16px">Unable to load the Spec${this.specUrl ? ': ' : ''}<strong>${this.specUrl}</strong></div>` : html` <div class="operations-root" @click="${e => {
28
28
  this.handleHref(e);
29
- }}"> ${this.renderStyle === 'focused' ? html`${focusedEndpointTemplate.call(this)}` : html` ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''} ${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''} ${this.allowAuthentication === 'true' ? securitySchemeTemplate.call(this) : ''} <section id="section" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="custom-section"></slot> </section> ${endpointTemplate.call(this)}`} </div> `}</div></main>`} </div> <slot name="footer"></slot> `;
29
+ }}"> ${this.renderStyle === 'focused' ? html`${focusedEndpointTemplate.call(this)}` : html` ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''} ${!this.hideServerSelection ? serverTemplate.call(this) : ''} ${!this.hideAuthentication ? securitySchemeTemplate.call(this) : ''} <section id="section" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="custom-section"></slot> </section> ${endpointTemplate.call(this)}`} </div> `}</div></main>`} </div> <slot name="footer"></slot> `;
30
30
  }
31
31
  /* eslint-enable indent */
@@ -40,7 +40,7 @@ export function expandCollapseAllComponents() {
40
40
  export default function navbarTemplate() {
41
41
  var _this$resolvedSpec$co;
42
42
 
43
- return html` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> <slot name="nav-header"></slot> ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : html` <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)' : ''}"> ${this.allowSearch === 'false' ? '' : html` <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="${getI18nText('menu.filter')}" @input="${this.onSearchChange}" spellcheck="false"> </div>`} ${this.allowAdvancedSearch === 'false' ? '' : html` <button class="m-btn outline-primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> ${getI18nText('menu.search')} </button> `} </div> `} ${html`<nav class="nav-scroll" part="navbar-scroll"> ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : html`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}"> ${this.resolvedSpec.info.title || getI18nText('menu.overview')} </div>`} ${this.allowServerSelection === 'false' ? '' : html`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}"> ${getI18nText('menu.api-servers')} </div>`} ${this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes ? '' : html`<div class="nav-bar-info" id="link-auth" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> ${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="${() => {
43
+ return html` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> <slot name="nav-header"></slot> ${this.hideSearch ? '' : 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="${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}"> ${getI18nText('menu.search')} </button> </div> `} ${html`<nav class="nav-scroll" part="navbar-scroll"> ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : html`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}"> ${this.resolvedSpec.info.title || getI18nText('menu.overview')} </div>`} ${this.hideServerSelection ? '' : html`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}"> ${getI18nText('menu.api-servers')} </div>`} ${this.hideAuthentication || !this.resolvedSpec.securitySchemes ? '' : html`<div class="nav-bar-info" id="link-auth" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> ${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="${() => {
44
44
  expandCollapseAll.call(this);
45
45
  }}"> <div class="nav-bar-section" part="navbar-operations-header"> <slot name="operations-header"> <div class="nav-bar-section-title">${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 => pathIsInSearch(this.matchPaths, path))) ? html` <div class="toggle">▾</div>` : ''} </div> </div> </div> ${this.resolvedSpec.tags.filter(tag => !tag.paths.length && !this.matchPaths || tag.paths.some(path => pathIsInSearch(this.matchPaths, path))).map(tag => html` <slot name="nav-${tag.elementId}"> <div class="nav-bar-tag-and-paths ${tag.expanded ? '' : 'collapsed'}"> ${tag.name === 'General ⦂' ? html`` : html` <div class="nav-bar-tag" id="link-${tag.elementId}" data-content-id="${tag.elementId}" @click="${() => {
46
46
  onExpandCollapse.call(this, tag.elementId);
@@ -7,8 +7,6 @@ var _lit = require("lit");
7
7
 
8
8
  var _marked = require("marked");
9
9
 
10
- var _mimeTypes = _interopRequireDefault(require("./mime-types.js"));
11
-
12
10
  var _unsafeHtml = require("lit/directives/unsafe-html.js");
13
11
 
14
12
  var _keyed = require("lit/directives/keyed.js");
@@ -883,10 +881,12 @@ class ApiRequest extends _lit.LitElement {
883
881
  }
884
882
 
885
883
  if (this.responseIsBlob) {
884
+ var _filename$;
885
+
886
886
  const contentDisposition = fetchResponse.headers.get('content-disposition');
887
887
  const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
888
888
  const filename = filenameRegex.exec(contentDisposition);
889
- this.respContentDisposition = filename && filename[1] && filename[1].replace(/['"]/g, '') || `download.${(await (0, _mimeTypes.default)(contentType)) || 'file'}`;
889
+ this.respContentDisposition = (filename === null || filename === void 0 ? void 0 : (_filename$ = filename[1]) === null || _filename$ === void 0 ? void 0 : _filename$.replace(/['"]/g, '')) || 'download.file';
890
890
  respBlob = await fetchResponse.blob();
891
891
  this.responseBlobUrl = URL.createObjectURL(respBlob);
892
892
  }
@@ -137,9 +137,9 @@ class OpenApiExplorer extends _lit.LitElement {
137
137
  type: String,
138
138
  attribute: 'show-info'
139
139
  },
140
- allowAuthentication: {
141
- type: String,
142
- attribute: 'show-authentication'
140
+ hideAuthentication: {
141
+ type: Boolean,
142
+ attribute: 'hide-authentication'
143
143
  },
144
144
  allowTry: {
145
145
  type: String,
@@ -149,17 +149,13 @@ class OpenApiExplorer extends _lit.LitElement {
149
149
  type: Boolean,
150
150
  attribute: 'display-nulls'
151
151
  },
152
- allowSearch: {
153
- type: String,
154
- attribute: 'allow-search'
155
- },
156
- allowAdvancedSearch: {
157
- type: String,
158
- attribute: 'allow-advanced-search'
152
+ hideSearch: {
153
+ type: Boolean,
154
+ attribute: 'hide-search'
159
155
  },
160
- allowServerSelection: {
161
- type: String,
162
- attribute: 'show-server-selection'
156
+ hideServerSelection: {
157
+ type: Boolean,
158
+ attribute: 'hide-server-selection'
163
159
  },
164
160
  hideComponents: {
165
161
  type: Boolean,
@@ -304,14 +300,6 @@ class OpenApiExplorer extends _lit.LitElement {
304
300
  this.responseAreaHeight = '300px';
305
301
  }
306
302
 
307
- if (!this.allowSearch || !'true, false,'.includes(`${this.allowSearch},`)) {
308
- this.allowSearch = 'true';
309
- }
310
-
311
- if (!this.allowAdvancedSearch || !'true, false,'.includes(`${this.allowAdvancedSearch},`)) {
312
- this.allowAdvancedSearch = 'true';
313
- }
314
-
315
303
  if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) {
316
304
  this.allowTry = 'true';
317
305
  }
@@ -324,14 +312,6 @@ class OpenApiExplorer extends _lit.LitElement {
324
312
  this.showInfo = 'true';
325
313
  }
326
314
 
327
- if (!this.allowServerSelection || !'true, false,'.includes(`${this.allowServerSelection},`)) {
328
- this.allowServerSelection = 'true';
329
- }
330
-
331
- if (!this.allowAuthentication || !'true, false,'.includes(`${this.allowAuthentication},`)) {
332
- this.allowAuthentication = 'true';
333
- }
334
-
335
315
  if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) {
336
316
  this.fetchCredentials = '';
337
317
  }
@@ -597,11 +577,11 @@ class OpenApiExplorer extends _lit.LitElement {
597
577
  return true;
598
578
  }
599
579
 
600
- if (id === 'servers' && this.allowServerSelection) {
580
+ if (id === 'servers' && !this.hideServerSelection) {
601
581
  return true;
602
582
  }
603
583
 
604
- if (id === 'auth' && this.allowAuthentication) {
584
+ if (id === 'auth' && !this.hideAuthentication) {
605
585
  return true;
606
586
  }
607
587
 
@@ -49,9 +49,9 @@ function focusedEndpointTemplate() {
49
49
 
50
50
  if (focusElId.startsWith('overview') && this.showInfo === 'true') {
51
51
  focusedTemplate = _overviewTemplate.default.call(this);
52
- } else if (focusElId === 'auth' && this.allowAuthentication === 'true') {
52
+ } else if (focusElId === 'auth' && !this.hideAuthentication) {
53
53
  focusedTemplate = _securitySchemeTemplate.default.call(this);
54
- } else if (focusElId === 'servers' && this.allowServerSelection === 'true') {
54
+ } else if (focusElId === 'servers' && !this.hideServerSelection) {
55
55
  focusedTemplate = _serverTemplate.default.call(this);
56
56
  } else if (focusElId.startsWith('section')) {
57
57
  focusedTemplate = (0, _lit.html)` <section id="section" class="observe-me"> <slot name="custom-section"></slot> </section>`;
@@ -41,8 +41,8 @@ function mainBodyTemplate() {
41
41
  };
42
42
  /* eslint-disable indent */
43
43
 
44
- return (0, _lit.html)` ${_theme.default.call(this, newTheme)} ${this.allowAdvancedSearch === 'false' ? '' : _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 => {
44
+ 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
45
  this.handleHref(e);
46
- }}"> ${this.renderStyle === 'focused' ? (0, _lit.html)`${_focusedEndpointTemplate.default.call(this)}` : (0, _lit.html)` ${this.showInfo === 'true' ? _overviewTemplate.default.call(this) : ''} ${this.allowServerSelection === 'true' ? _serverTemplate.default.call(this) : ''} ${this.allowAuthentication === 'true' ? _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> `;
46
+ }}"> ${this.renderStyle === 'focused' ? (0, _lit.html)`${_focusedEndpointTemplate.default.call(this)}` : (0, _lit.html)` ${this.showInfo === 'true' ? _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> `;
47
47
  }
48
48
  /* eslint-enable indent */
@@ -52,7 +52,7 @@ function expandCollapseAllComponents() {
52
52
  function navbarTemplate() {
53
53
  var _this$resolvedSpec$co;
54
54
 
55
- return (0, _lit.html)` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> <slot name="nav-header"></slot> ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : (0, _lit.html)` <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)' : ''}"> ${this.allowSearch === 'false' ? '' : (0, _lit.html)` <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>`} ${this.allowAdvancedSearch === 'false' ? '' : (0, _lit.html)` <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.showInfo === 'false' || !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.allowServerSelection === 'false' ? '' : (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.allowAuthentication === 'false' || !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="${() => {
55
+ 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.showInfo === 'false' || !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="${() => {
56
56
  expandCollapseAll.call(this);
57
57
  }}"> <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="${() => {
58
58
  onExpandCollapse.call(this, tag.elementId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "1.2.610",
3
+ "version": "2.0.612",
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
  "type": "module",
@@ -56,7 +56,6 @@
56
56
  "lodash.clonedeep": "^4.5.0",
57
57
  "lodash.merge": "^4.6.2",
58
58
  "marked": "^4.0.16",
59
- "mime-db": "^1.52.0",
60
59
  "openapi-data-validator": "^2.0.40",
61
60
  "openapi-resolver": "^4.1.35",
62
61
  "prismjs": "^1.29.0",
@@ -1,47 +0,0 @@
1
- const EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
2
- const extensions = {};
3
- /**
4
- * Get the default extension for a MIME type.
5
- *
6
- * @param {string} type
7
- * @return {boolean|string}
8
- */
9
-
10
- export default async function extension(type) {
11
- if (!type || typeof type !== 'string') {
12
- return false;
13
- } // TODO: use media-typer
14
-
15
-
16
- const match = EXTRACT_TYPE_REGEXP.exec(type); // get extensions
17
-
18
- await populateMaps();
19
- const exts = match && extensions[match[1].toLowerCase()];
20
-
21
- if (!exts || !exts.length) {
22
- return false;
23
- }
24
-
25
- return exts[0];
26
- }
27
- let initialized = false;
28
-
29
- async function populateMaps() {
30
- if (initialized) {
31
- return;
32
- }
33
-
34
- const db = await import('mime-db/db.json');
35
- Object.keys(db.default).forEach(function forEachMimeType(type) {
36
- const mime = db[type];
37
- const exts = mime.extensions;
38
-
39
- if (!exts || !exts.length) {
40
- return;
41
- } // mime -> extensions
42
-
43
-
44
- extensions[type] = exts;
45
- });
46
- initialized = true;
47
- }
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = extension;
5
-
6
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
7
-
8
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
9
-
10
- const EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
11
- const extensions = {};
12
- /**
13
- * Get the default extension for a MIME type.
14
- *
15
- * @param {string} type
16
- * @return {boolean|string}
17
- */
18
-
19
- async function extension(type) {
20
- if (!type || typeof type !== 'string') {
21
- return false;
22
- } // TODO: use media-typer
23
-
24
-
25
- const match = EXTRACT_TYPE_REGEXP.exec(type); // get extensions
26
-
27
- await populateMaps();
28
- const exts = match && extensions[match[1].toLowerCase()];
29
-
30
- if (!exts || !exts.length) {
31
- return false;
32
- }
33
-
34
- return exts[0];
35
- }
36
-
37
- let initialized = false;
38
-
39
- async function populateMaps() {
40
- if (initialized) {
41
- return;
42
- }
43
-
44
- const db = await Promise.resolve().then(() => _interopRequireWildcard(require('mime-db/db.json')));
45
- Object.keys(db.default).forEach(function forEachMimeType(type) {
46
- const mime = db[type];
47
- const exts = mime.extensions;
48
-
49
- if (!exts || !exts.length) {
50
- return;
51
- } // mime -> extensions
52
-
53
-
54
- extensions[type] = exts;
55
- });
56
- initialized = true;
57
- }