rapidoc 9.1.0 → 9.1.4

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.
Files changed (67) hide show
  1. package/dist/index.html +1 -1
  2. package/dist/index.html.gz +0 -0
  3. package/dist/rapidoc-min.js +2 -5
  4. package/dist/rapidoc-min.js.LICENSE.txt +17 -1
  5. package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
  6. package/dist/rapidoc-min.js.gz +0 -0
  7. package/dist/report.html +6 -5
  8. package/docker/Dockerfile +5 -5
  9. package/docs/api.html +48 -40
  10. package/docs/examples/auth-test1.html +113 -0
  11. package/docs/examples/auth.html +37 -34
  12. package/docs/examples/badges.html +1 -1
  13. package/docs/examples/dynamic-query-params.html +1 -0
  14. package/docs/examples/mongo.html +33 -0
  15. package/docs/examples/readwrite.html +40 -0
  16. package/docs/examples/slots.html +7 -0
  17. package/docs/examples.html +3 -2
  18. package/docs/index.html +2 -2
  19. package/docs/list.html +15 -3
  20. package/docs/quickstart.html +1 -1
  21. package/docs/rapidoc-min.js +2 -5
  22. package/docs/rapidoc-mini.html +20 -20
  23. package/docs/specs/auth-test1.yaml +35 -0
  24. package/docs/specs/auth.yaml +2 -2
  25. package/docs/specs/code-highlight.yaml +1 -1
  26. package/docs/specs/data-types.yaml +0 -1
  27. package/docs/specs/dynamic-query-params.yaml +41 -0
  28. package/docs/specs/examples.yaml +11 -0
  29. package/docs/specs/mongo.yaml +78 -0
  30. package/docs/specs/multipart-formdata.yaml +3 -0
  31. package/docs/specs/petstore_extended.yaml +1 -1
  32. package/docs/specs/readwrite.yaml +90 -0
  33. package/docs/specs/server.yaml +4 -4
  34. package/docs/specs/temp.json +24 -105
  35. package/docs/specs/temp.yaml +20 -282
  36. package/docs/welcome.html +3 -3
  37. package/index.html +11 -6
  38. package/package.json +22 -21
  39. package/src/components/api-request.js +105 -63
  40. package/src/components/api-response.js +10 -10
  41. package/src/components/json-tree.js +2 -1
  42. package/src/components/schema-table.js +51 -14
  43. package/src/components/schema-tree.js +59 -18
  44. package/src/components/tag-input.js +8 -1
  45. package/src/index.js +2 -1
  46. package/src/json-schema-viewer.js +341 -0
  47. package/src/rapidoc-mini.js +5 -1
  48. package/src/rapidoc.js +11 -7
  49. package/src/styles/font-styles.js +3 -2
  50. package/src/styles/nav-styles.js +2 -2
  51. package/src/templates/components-template.js +9 -10
  52. package/src/templates/endpoint-template.js +1 -1
  53. package/src/templates/expanded-endpoint-template.js +1 -1
  54. package/src/templates/focused-endpoint-template.js +1 -1
  55. package/src/templates/header-template.js +1 -1
  56. package/src/templates/json-schema-viewer-template.js +184 -0
  57. package/src/templates/main-body-template.js +4 -1
  58. package/src/templates/navbar-template.js +3 -3
  59. package/src/templates/overview-template.js +6 -3
  60. package/src/templates/security-scheme-template.js +78 -38
  61. package/src/templates/server-template.js +1 -1
  62. package/src/utils/common-utils.js +2 -1
  63. package/src/utils/schema-utils.js +24 -19
  64. package/src/utils/spec-parser.js +24 -3
  65. package/webpack.config.js +1 -12
  66. package/dist/rapidoc-min.js.map +0 -1
  67. package/dist/rapidoc-min.js.map.gz +0 -0
@@ -1,5 +1,5 @@
1
1
  import { css, LitElement } from 'lit-element';
2
- import marked from 'marked';
2
+ import { marked } from 'marked';
3
3
  import Prism from 'prismjs';
4
4
  import 'prismjs/components/prism-css';
5
5
  import 'prismjs/components/prism-yaml';
@@ -49,6 +49,7 @@ export default class RapiDocMini extends LitElement {
49
49
  responseAreaHeight: { type: String, attribute: 'response-area-height' },
50
50
  showSummaryWhenCollapsed: { type: String, attribute: 'show-summary-when-collapsed' },
51
51
  fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },
52
+ persistAuth: { type: String, attribute: 'persist-auth' },
52
53
 
53
54
  // Schema Styles
54
55
  schemaStyle: { type: String, attribute: 'schema-style' },
@@ -166,6 +167,7 @@ export default class RapiDocMini extends LitElement {
166
167
  if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }
167
168
  if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) { this.schemaDescriptionExpanded = 'false'; }
168
169
  if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }
170
+ if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }
169
171
  if (!this.responseAreaHeight) { this.responseAreaHeight = '300px'; }
170
172
 
171
173
  if (!this.allowTry || !'true, false,'.includes(`${this.allowTry},`)) { this.allowTry = 'true'; }
@@ -318,6 +320,8 @@ export default class RapiDocMini extends LitElement {
318
320
  }
319
321
  }
320
322
  this.requestUpdate();
323
+ // eslint-disable-next-line no-await-in-loop
324
+ while (!await this.updateComplete);
321
325
  const specLoadedEvent = new CustomEvent('spec-loaded', { detail: spec });
322
326
  this.dispatchEvent(specLoadedEvent);
323
327
  }
package/src/rapidoc.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { css, LitElement, unsafeCSS } from 'lit-element';
2
- import marked from 'marked';
2
+ import { marked } from 'marked';
3
3
  import Prism from 'prismjs';
4
4
  import 'prismjs/components/prism-css';
5
5
  import 'prismjs/components/prism-yaml';
@@ -63,6 +63,7 @@ export default class RapiDoc extends LitElement {
63
63
  defaultSchemaTab: { type: String, attribute: 'default-schema-tab' },
64
64
  responseAreaHeight: { type: String, attribute: 'response-area-height' },
65
65
  fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },
66
+ persistAuth: { type: String, attribute: 'persist-auth' },
66
67
  onNavTagClick: { type: String, attribute: 'on-nav-tag-click' },
67
68
 
68
69
  // Schema Styles
@@ -88,6 +89,7 @@ export default class RapiDoc extends LitElement {
88
89
  allowTry: { type: String, attribute: 'allow-try' },
89
90
  allowSpecUrlLoad: { type: String, attribute: 'allow-spec-url-load' },
90
91
  allowSpecFileLoad: { type: String, attribute: 'allow-spec-file-load' },
92
+ allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' },
91
93
  allowSearch: { type: String, attribute: 'allow-search' },
92
94
  allowAdvancedSearch: { type: String, attribute: 'allow-advanced-search' },
93
95
  allowServerSelection: { type: String, attribute: 'allow-server-selection' },
@@ -245,19 +247,18 @@ export default class RapiDoc extends LitElement {
245
247
  .only-large-screen{
246
248
  display:none;
247
249
  }
248
- .header-title{
249
- font-size:calc(var(--font-size-regular) + 8px);
250
- padding:0 8px;
251
- }
252
250
  .tag.title {
253
251
  text-transform: uppercase;
254
252
  }
255
- .header{
253
+ .header {
256
254
  background-color:var(--header-bg);
257
255
  color:var(--header-fg);
258
256
  width:100%;
259
257
  }
260
-
258
+ .header-title {
259
+ font-size:calc(var(--font-size-regular) + 8px);
260
+ padding:0 8px;
261
+ }
261
262
  input.header-input{
262
263
  background:var(--header-color-darker);
263
264
  color:var(--header-fg);
@@ -434,6 +435,7 @@ export default class RapiDoc extends LitElement {
434
435
  this.schemaHideReadOnly += ['get', 'head', 'delete', 'options'];
435
436
  this.schemaHideWriteOnly = this.schemaHideWriteOnly !== 'never';
436
437
  if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }
438
+ if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }
437
439
  if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) { this.onNavTagClick = 'expand-collapse'; }
438
440
  if (!this.responseAreaHeight) {
439
441
  this.responseAreaHeight = '300px';
@@ -709,6 +711,8 @@ export default class RapiDoc extends LitElement {
709
711
  }
710
712
  }
711
713
  this.requestUpdate();
714
+ // eslint-disable-next-line no-await-in-loop
715
+ while (!await this.updateComplete);
712
716
  const specLoadedEvent = new CustomEvent('spec-loaded', { detail: spec });
713
717
  this.dispatchEvent(specLoadedEvent);
714
718
 
@@ -88,8 +88,9 @@ export default css`
88
88
  font-size: var(--font-size-regular);
89
89
  line-height:calc(var(--font-size-regular) + 8px);
90
90
  }
91
- .m-markdown li{
92
- line-height:calc(var(--font-size-regular) + 12px);
91
+ .m-markdown li {
92
+ font-size: var(--font-size-regular);
93
+ line-height:calc(var(--font-size-regular) + 10px);
93
94
  }
94
95
 
95
96
  .m-markdown-small p,
@@ -15,8 +15,8 @@ export default css`
15
15
  flex-wrap:nowrap;
16
16
  word-break:break-word;
17
17
  }
18
- ::slotted(*){
19
- padding:16px 30px 0 16px;
18
+ ::slotted([slot=nav-logo]){
19
+ padding:16px 16px 0 16px;
20
20
  }
21
21
  .nav-scroll {
22
22
  overflow-x: hidden;
@@ -1,7 +1,6 @@
1
- /* eslint-disable no-console */
2
1
  import { html } from 'lit-element';
3
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html';
4
- import marked from 'marked';
3
+ import { marked } from 'marked';
5
4
  import { schemaInObjectNotation } from '~/utils/schema-utils';
6
5
  import '~/components/json-tree';
7
6
  import '~/components/schema-tree';
@@ -11,7 +10,7 @@ function schemaBodyTemplate(sComponent) {
11
10
  return html`
12
11
  <div class='divider'></div>
13
12
  <div class='expanded-endpoint-body observe-me ${sComponent.name}' id='cmp--${sComponent.id}' >
14
- <h1> ${sComponent.name} </h1>
13
+ <div style="font-weight:bold"> ${sComponent.name} <span style="color:var(--light-fg); font-size:var(--font-size-small); font-weight:400;"> Schema </span></div>
15
14
  ${this.schemaStyle === 'table'
16
15
  ? html`
17
16
  <schema-table
@@ -20,8 +19,8 @@ function schemaBodyTemplate(sComponent) {
20
19
  schema-expand-level = "${this.schemaExpandLevel}"
21
20
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
22
21
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
23
- schema-hide-read-only = false
24
- schema-hide-write-only = ${this.schemaHideWriteOnly}
22
+ schema-hide-read-only = "false"
23
+ schema-hide-write-only = "${this.schemaHideWriteOnly}"
25
24
  > </schema-tree> `
26
25
  : html`
27
26
  <schema-tree
@@ -30,14 +29,14 @@ function schemaBodyTemplate(sComponent) {
30
29
  schema-expand-level = "${this.schemaExpandLevel}"
31
30
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
32
31
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
33
- schema-hide-read-only = false
34
- schema-hide-write-only = ${this.schemaHideWriteOnly}
32
+ schema-hide-read-only = "false"
33
+ schema-hide-write-only = "${this.schemaHideWriteOnly}"
35
34
  > </schema-tree>`
36
35
  }
37
36
  </div>`;
38
37
  }
39
38
 
40
- function componentBodyTemplate(sComponent) {
39
+ function componentBodyTemplate(sComponent, componentType) {
41
40
  if (sComponent.id.indexOf('schemas-') !== -1) {
42
41
  return schemaBodyTemplate.call(this, sComponent);
43
42
  }
@@ -45,7 +44,7 @@ function componentBodyTemplate(sComponent) {
45
44
  <div class='divider'></div>
46
45
  <div class='expanded-endpoint-body observe-me ${sComponent.name}' id='cmp--${sComponent.id}' >
47
46
  ${html`
48
- <h1> ${sComponent.name} </h1>
47
+ <div style="font-weight:bold"> ${sComponent.name} <span style="color:var(--light-fg); font-size:var(--font-size-small); font-weight:400"> ${componentType} </span> </div>
49
48
  ${sComponent.component
50
49
  ? html`
51
50
  <div class='mono-font regular-font-size' style='padding: 8px 0; color:var(--fg2)'>
@@ -68,7 +67,7 @@ export default function componentsTemplate() {
68
67
  </div>
69
68
  </div>
70
69
  <div class='regular-font section-gap--read-mode'>
71
- ${component.subComponents.filter((c) => c.expanded !== false).map((sComponent) => componentBodyTemplate.call(this, sComponent))}
70
+ ${component.subComponents.filter((c) => c.expanded !== false).map((sComponent) => componentBodyTemplate.call(this, sComponent, component.name))}
72
71
  </div>
73
72
  `)
74
73
  }
@@ -1,6 +1,6 @@
1
1
  import { html } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html';
3
- import marked from 'marked';
3
+ import { marked } from 'marked';
4
4
  import '~/components/api-request';
5
5
  import '~/components/api-response';
6
6
  import codeSamplesTemplate from '~/templates/code-samples-template';
@@ -1,6 +1,6 @@
1
1
  import { html } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html';
3
- import marked from 'marked';
3
+ import { marked } from 'marked';
4
4
  import { rapidocApiKey } from '~/utils/common-utils';
5
5
  import { pathSecurityTemplate } from '~/templates/security-scheme-template';
6
6
  import codeSamplesTemplate from '~/templates/code-samples-template';
@@ -1,6 +1,6 @@
1
1
  import { html } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html';
3
- import marked from 'marked';
3
+ import { marked } from 'marked';
4
4
  import { expandedEndpointBodyTemplate } from '~/templates/expanded-endpoint-template';
5
5
  import '~/components/api-request';
6
6
  import '~/components/api-response';
@@ -52,7 +52,7 @@ export default function headerTemplate() {
52
52
  `
53
53
  }
54
54
 
55
- ${(this.allowSearch === 'false' || this.allowAdvancedSearch === 'false' || 'read focused'.includes(this.renderStyle))
55
+ ${(this.allowAdvancedSearch === 'false' || 'read focused'.includes(this.renderStyle))
56
56
  ? ''
57
57
  : html`
58
58
  <button class="m-btn primary only-large-screen" part="btn btn-fill btn-search" style="margin-left:10px;" @click="${this.onShowSearchModalClicked}">
@@ -0,0 +1,184 @@
1
+ import { html } from 'lit-element';
2
+ import { marked } from 'marked';
3
+ import { unsafeHTML } from 'lit-html/directives/unsafe-html';
4
+
5
+ // Templates
6
+ import overviewTemplate from '~/templates/overview-template';
7
+ import headerTemplate from '~/templates/header-template';
8
+ import { schemaInObjectNotation, generateExample } from '~/utils/schema-utils';
9
+ import '~/components/json-tree';
10
+ import '~/components/schema-tree';
11
+ import SetTheme from '~/utils/theme';
12
+ import { isValidHexColor } from '~/utils/color-utils';
13
+
14
+ /* eslint-disable indent */
15
+ // Json Schema Nav Template
16
+ function jsonSchemaNavTemplate() {
17
+ return html`
18
+ <nav class='nav-bar' part="section-navbar">
19
+ <slot name="nav-logo" class="logo"></slot>
20
+ <div style="display:flex;line-height:22px; padding:8px">
21
+ <input id="nav-bar-search"
22
+ part = "textbox textbox-nav-filter"
23
+ style = "width:100%; height: 26px; padding-right:20px; color:var(--nav-hover-text-color); border-color:var(--nav-accent-color); background-color:var(--nav-hover-bg-color)"
24
+ type = "text"
25
+ placeholder = "Filter"
26
+ @change = "${this.onSearchChange}"
27
+ spellcheck = "false"
28
+ >
29
+ <div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">&#x21a9;</div>
30
+ </div>
31
+ <nav style="flex:1" class='nav-scroll' part="section-navbar-scroll">
32
+ ${this.resolvedSpec.schemaAndExamples.map((v) => html`
33
+ <div class='nav-bar-path' data-content-id='${v.elementId}' id='link-${v.elementId}'
34
+ @click = '${(e) => {
35
+ this.scrollToEventTarget(e, false);
36
+ }}'
37
+ >
38
+ ${v.name}
39
+ </div>`)
40
+ }
41
+ </nav>
42
+ </nav>
43
+ `;
44
+ }
45
+
46
+ // Json Schema Body Template
47
+ function jsonSchemaBodyTemplate() {
48
+ return html`
49
+ ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
50
+ <div style="font-size:var(--font-size-regular);">
51
+ ${this.resolvedSpec.schemaAndExamples.map((jSchemaBody) => {
52
+ const examplesObj = generateExample(jSchemaBody.schema, 'json', jSchemaBody.examples, jSchemaBody.example, true, false, 'json', true);
53
+ jSchemaBody.selectedExample = examplesObj[0]?.exampleId;
54
+ return html`
55
+ <section id='${jSchemaBody.elementId}' class='json-schema-and-example regular-font' style="display:flex; flex-direction: column; border:1px solid var(--border-color); margin-bottom:32px; border-top: 5px solid var(--border-color)">
56
+ <div style="padding:16px; border-bottom: 1px solid var(--border-color)">
57
+ <div style="font-size:var(--font-size-small); font-weight:bold">${jSchemaBody.name}</div>
58
+ <span class="json-schema-description m-markdown ">${unsafeHTML(marked(jSchemaBody.description || ''))}</span>
59
+ </div>
60
+ <div style="display:flex; flex-direction: row; gap:16px;">
61
+ <div class="json-schema-def" style="flex:1; padding:16px 0 16px 16px; ">
62
+ <schema-tree
63
+ .data = "${schemaInObjectNotation(jSchemaBody.schema, {})}"
64
+ schema-expand-level = "${this.schemaExpandLevel}"
65
+ schema-description-expanded = "${this.schemaDescriptionExpanded}"
66
+ allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
67
+ schema-hide-read-only = "false"
68
+ schema-hide-write-only = "false"
69
+ > </schema-tree>
70
+ </div>
71
+ <div class="json-schema-example-panel" style="width:400px; background-color: var(--input-bg); padding:16px 0 16px 16px; border-left: 1px dashed var(--border-color);">
72
+ ${examplesObj.length > 1
73
+ ? html`<select style="min-width:100px; max-width:100%" @change='${(e) => this.onSelectExample(e, jSchemaBody)}'>
74
+ ${examplesObj.map((v) => html`
75
+ <option value="${v.exampleId}" ?selected=${(v.exampleId === jSchemaBody.selectedExample)}>
76
+ ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary}
77
+ </option>`)
78
+ }
79
+ </select>`
80
+ : html`<div style="font-size: var(--font-size-small);font-weight:700; margin:5px 0"> ${examplesObj[0].exampleSummary}</div>`
81
+ }
82
+ ${examplesObj.map((v) => html`
83
+ <json-tree
84
+ .data = "${v.exampleValue}"
85
+ data-example = "${v.exampleId}"
86
+ class = "example"
87
+ style = "margin-top:16px; display: ${v.exampleId === jSchemaBody.selectedExample ? 'flex' : 'none'}"
88
+ ></json-tree>`)
89
+ }
90
+ </div>
91
+ </div>
92
+ </section>`;
93
+ })
94
+ }
95
+ </div>
96
+ `;
97
+ }
98
+ /* eslint-enable indent */
99
+
100
+ // Json Schema Root Template
101
+ export default function jsonSchemaViewerTemplate(isMini = false) {
102
+ // export default function jsonSchemaViewerTemplate(isMini = false, showExpandCollapse = true, showTags = true, pathsExpanded = false) {
103
+ if (!this.resolvedSpec) {
104
+ return '';
105
+ }
106
+ const newTheme = {
107
+ bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',
108
+ fg1: isValidHexColor(this.textColor) ? this.textColor : '',
109
+ headerColor: isValidHexColor(this.headerColor) ? this.headerColor : '',
110
+ primaryColor: isValidHexColor(this.primaryColor) ? this.primaryColor : '',
111
+ navBgColor: isValidHexColor(this.navBgColor) ? this.navBgColor : '',
112
+ navTextColor: isValidHexColor(this.navTextColor) ? this.navTextColor : '',
113
+ navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
114
+ navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
115
+ navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
116
+ };
117
+ /* eslint-disable indent */
118
+ if (this.resolvedSpec.specLoadError) {
119
+ if (isMini) {
120
+ return html`
121
+ ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
122
+ <div style="display:flex; align-items:center; border:1px dashed var(--border-color); height:42px; padding:5px; font-size:var(--font-size-small); color:var(--red); font-family:var(--font-mono)"> ${this.resolvedSpec.info.description} </div>
123
+ `;
124
+ }
125
+ return html`
126
+ ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
127
+ <!-- Header -->
128
+ ${headerTemplate.call(this)}
129
+ <h1> Header </h1>
130
+ <main class="main-content regular-font" part="section-main-content">
131
+ <slot></slot>
132
+ <div style="margin:24px; text-align: center;">
133
+ <h1 style="color: var(--red)"> ${this.resolvedSpec.info.title} </h1>
134
+ <div style="font-family:var(--font-mono)"> ${this.resolvedSpec.info.description} </div>
135
+ </div>
136
+ </main>
137
+ `;
138
+ }
139
+ if (this.resolvedSpec.isSpecLoading) {
140
+ return html`
141
+ ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
142
+ <main class="main-content regular-font" part="section-main-content">
143
+ <slot></slot>
144
+ <div class="main-content-inner--${this.renderStyle}-mode">
145
+ <div class="loader"></div>
146
+ </div>
147
+ </main>
148
+ `;
149
+ }
150
+
151
+ return html`
152
+ ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
153
+
154
+ <!-- Header -->
155
+ ${this.showHeader === 'false' ? '' : headerTemplate.call(this)}
156
+
157
+ <div id='the-main-body' class="body" dir= ${this.pageDirection}>
158
+
159
+ <!-- Side Nav -->
160
+ ${jsonSchemaNavTemplate.call(this)}
161
+
162
+ <!-- Main Content -->
163
+ <main class="main-content regular-font" part="section-main-content">
164
+ <slot></slot>
165
+ <div class="main-content-inner--${this.renderStyle}-mode">
166
+ ${this.loading === true
167
+ ? html`<div class="loader"></div>`
168
+ : html`
169
+ ${this.loadFailed === true
170
+ ? html`<div style="text-align: center;margin: 16px;"> Unable to load the Spec</div>`
171
+ : html`
172
+ <div class="operations-root" @click="${(e) => { this.handleHref(e); }}">
173
+ ${jsonSchemaBodyTemplate.call(this)}
174
+ </div>
175
+ `
176
+ }`
177
+ }
178
+ </div>
179
+ <slot name="footer"></slot>
180
+ </main>
181
+ </div>
182
+ `;
183
+ }
184
+ /* eslint-enable indent */
@@ -6,7 +6,7 @@ import focusedEndpointTemplate from '~/templates/focused-endpoint-template';
6
6
  import overviewTemplate from '~/templates/overview-template';
7
7
  import endpointTemplate from '~/templates/endpoint-template';
8
8
  import serverTemplate from '~/templates/server-template';
9
- import securitySchemeTemplate from '~/templates/security-scheme-template';
9
+ import securitySchemeTemplate, { recoverPersistedApiKeys } from '~/templates/security-scheme-template';
10
10
  import headerTemplate from '~/templates/header-template';
11
11
  import navbarTemplate from '~/templates/navbar-template';
12
12
  import advancedSearchTemplate from '~/templates/advance-search-template';
@@ -17,6 +17,9 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
17
17
  if (!this.resolvedSpec) {
18
18
  return '';
19
19
  }
20
+ if (this.persistAuth === 'true') {
21
+ recoverPersistedApiKeys.call(this);
22
+ }
20
23
  const newTheme = {
21
24
  bg1: isValidHexColor(this.bgColor) ? this.bgColor : '',
22
25
  fg1: isValidHexColor(this.textColor) ? this.textColor : '',
@@ -1,5 +1,5 @@
1
1
  import { html } from 'lit-element';
2
- import marked from 'marked';
2
+ import { marked } from 'marked';
3
3
  import { pathIsInSearch } from '~/utils/common-utils';
4
4
 
5
5
  export function expandCollapseNavBarTag(navLinkEl, action = 'toggle') {
@@ -50,7 +50,7 @@ export default function navbarTemplate() {
50
50
  ${(this.allowSearch === 'false' && this.allowAdvancedSearch === 'false')
51
51
  ? ''
52
52
  : html`
53
- <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)' : ''}">
53
+ <div style="display:flex; flex-direction:row; justify-content:center; align-items:center; padding:8px 24px 12px 24px; ${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}">
54
54
  ${this.allowSearch === 'false'
55
55
  ? ''
56
56
  : html`
@@ -136,7 +136,7 @@ export default function navbarTemplate() {
136
136
  .map((tag) => html`
137
137
  <div class='nav-bar-tag-and-paths ${tag.expanded ? 'expanded' : 'collapsed'}'>
138
138
  ${tag.name === 'General ⦂'
139
- ? html`<hr style="border:none; border-top: 1px dotted var(--nav-text-color); opacity:0.4; margin:-1px 0 0 0;"/>`
139
+ ? html`<hr style="border:none; border-top: 1px dotted var(--nav-text-color); opacity:0.3; margin:-1px 0 0 0;"/>`
140
140
  : html`
141
141
  <div
142
142
  class='nav-bar-tag'
@@ -1,6 +1,6 @@
1
1
  import { html } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html';
3
- import marked from 'marked';
3
+ import { marked } from 'marked';
4
4
  import { downloadResource, viewResource } from '~/utils/common-utils';
5
5
 
6
6
  /* eslint-disable indent */
@@ -47,11 +47,14 @@ export default function overviewTemplate() {
47
47
  ? html`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">Terms of Service</a></span>`
48
48
  : ''
49
49
  }
50
- ${this.specUrl
50
+ ${this.specUrl && this.allowSpecFileDownload === 'true'
51
51
  ? html`
52
52
  <div style="display:flex; margin:12px 0; gap:8px; justify-content: start;">
53
53
  <button class="m-btn thin-border" style="width:170px" part="btn btn-outline" @click='${(e) => { downloadResource(this.specUrl, 'openapi-spec', e); }}'>Download OpenAPI spec</button>
54
- <button class="m-btn thin-border" style="width:200px" part="btn btn-outline" @click='${(e) => { viewResource(this.specUrl, e); }}'>View OpenAPI spec (New Tab)</button>
54
+ ${this.specUrl?.trim().toLowerCase().endsWith('json')
55
+ ? html`<button class="m-btn thin-border" style="width:200px" part="btn btn-outline" @click='${(e) => { viewResource(this.specUrl, e); }}'>View OpenAPI spec (New Tab)</button>`
56
+ : ''
57
+ }
55
58
  </div>`
56
59
  : ''
57
60
  }