rapidoc 9.3.2 → 9.3.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 (47) hide show
  1. package/.github/workflow/words.yaml +22 -0
  2. package/dist/index.html +1 -1
  3. package/dist/index.html.gz +0 -0
  4. package/dist/rapidoc-min.js +857 -738
  5. package/dist/rapidoc-min.js.LICENSE.txt +9 -10
  6. package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
  7. package/dist/rapidoc-min.js.gz +0 -0
  8. package/dist/rapidoc-min.js.map +1 -1
  9. package/dist/rapidoc-min.js.map.gz +0 -0
  10. package/dist/rapidoc.js +9341 -25092
  11. package/dist/report.html +5 -4
  12. package/index.html +2 -3
  13. package/package.json +20 -19
  14. package/src/components/api-request.js +344 -154
  15. package/src/components/api-response.js +16 -12
  16. package/src/components/json-tree.js +17 -12
  17. package/src/components/schema-table.js +50 -42
  18. package/src/components/schema-tree.js +56 -53
  19. package/src/components/tag-input.js +7 -4
  20. package/src/json-schema-viewer.js +1 -2
  21. package/src/rapidoc-mini.js +1 -3
  22. package/src/rapidoc.js +112 -45
  23. package/src/styles/endpoint-styles.js +1 -1
  24. package/src/styles/font-styles.js +1 -1
  25. package/src/styles/info-styles.js +2 -1
  26. package/src/styles/input-styles.js +2 -16
  27. package/src/styles/nav-styles.js +57 -10
  28. package/src/styles/schema-styles.js +27 -15
  29. package/src/styles/tab-styles.js +1 -0
  30. package/src/templates/callback-template.js +6 -7
  31. package/src/templates/code-samples-template.js +1 -0
  32. package/src/templates/components-template.js +3 -5
  33. package/src/templates/endpoint-template.js +41 -27
  34. package/src/templates/expanded-endpoint-template.js +63 -13
  35. package/src/templates/focused-endpoint-template.js +4 -1
  36. package/src/templates/header-template.js +2 -2
  37. package/src/templates/json-schema-viewer-template.js +2 -1
  38. package/src/templates/main-body-template.js +19 -18
  39. package/src/templates/navbar-template.js +98 -81
  40. package/src/templates/overview-template.js +1 -1
  41. package/src/templates/security-scheme-template.js +48 -25
  42. package/src/templates/server-template.js +1 -1
  43. package/src/utils/common-utils.js +2 -5
  44. package/src/utils/schema-utils.js +208 -83
  45. package/src/utils/spec-parser.js +1 -0
  46. package/src/utils/theme.js +11 -5
  47. package/webpack.config.js +2 -1
@@ -10,6 +10,7 @@ export default css`
10
10
  width: 100%;
11
11
  box-sizing: content-box;
12
12
  border-bottom: 1px dotted transparent;
13
+ transition: max-height 0.3s ease-out;
13
14
  }
14
15
  .td {
15
16
  display: block;
@@ -21,9 +22,29 @@ export default css`
21
22
  word-break: break-all;
22
23
  }
23
24
 
24
- .collapsed-descr .key {
25
+ .collapsed-all-descr .key {
25
26
  overflow:hidden;
26
27
  }
28
+ .expanded-all-descr .key-descr .descr-expand-toggle {
29
+ display:none;
30
+ }
31
+
32
+ .key-descr .descr-expand-toggle {
33
+ display:inline-block;
34
+ user-select:none;
35
+ color: var(--fg);
36
+ cursor: pointer;
37
+ transform: rotate(45deg);
38
+ transition: transform .2s ease;
39
+ }
40
+
41
+ .expanded-descr .key-descr .descr-expand-toggle {
42
+ transform: rotate(270deg)
43
+ }
44
+
45
+ .key-descr .descr-expand-toggle:hover {
46
+ color: var(--primary-color);
47
+ }
27
48
 
28
49
  .expanded-descr .more-content { display:none; }
29
50
 
@@ -40,13 +61,6 @@ export default css`
40
61
  overflow:hidden;
41
62
  display: none;
42
63
  }
43
- .collapsed-descr .tr {
44
- max-height:20px;
45
- }
46
-
47
- .tr.xxx-of{
48
- border-top: 1px dotted var(--primary-color);
49
- }
50
64
 
51
65
  .xxx-of-key {
52
66
  font-size: calc(var(--font-size-small) - 2px);
@@ -61,10 +75,10 @@ export default css`
61
75
  }
62
76
 
63
77
  .xxx-of-descr {
64
- font-family: var(--font-regular);
65
- color: var(--primary-color);
66
- font-size: calc(var(--font-size-small) - 1px);
67
- margin-left: 2px;
78
+ font-family: var(--font-regular);
79
+ color: var(--primary-color);
80
+ font-size: calc(var(--font-size-small) - 1px);
81
+ margin-left: 2px;
68
82
  }
69
83
 
70
84
  .stri, .string, .uri, .url, .byte, .bina, .date, .pass, .ipv4, .ipv4, .uuid, .emai, .host {color:var(--green);}
@@ -72,6 +86,7 @@ export default css`
72
86
  .null {color:var(--red);}
73
87
  .bool, .boolean{color:var(--orange)}
74
88
  .enum {color:var(--purple)}
89
+ .cons {color:var(--purple)}
75
90
  .recu {color:var(--brown)}
76
91
  .toolbar {
77
92
  display:flex;
@@ -90,9 +105,6 @@ export default css`
90
105
  font-weight: bold;
91
106
  text-transform: uppercase;
92
107
  }
93
- .schema-root-type.xxx-of {
94
- display:none;
95
- }
96
108
  .toolbar-item:first-of-type { margin:0 2px 0 0;}
97
109
 
98
110
  @media only screen and (min-width: 500px) {
@@ -6,6 +6,7 @@ export default css`
6
6
  }
7
7
  .tab-buttons {
8
8
  height:30px;
9
+ padding: 4px 4px 0 4px;
9
10
  border-bottom: 1px solid var(--light-border-color) ;
10
11
  align-items: stretch;
11
12
  overflow-y: hidden;
@@ -9,7 +9,7 @@ export default function callbackTemplate(callbacks) {
9
9
  ${kv[0]}
10
10
  ${Object.entries(kv[1]).map((pathObj) => html`
11
11
  <div class="mono-font small-font-size" style="display:flex; margin-left:16px;">
12
- <div>
12
+ <div style="width:100%">
13
13
  ${Object.entries(pathObj[1]).map((method) => html`
14
14
  <div>
15
15
  <div style="margin-top:12px;">
@@ -29,21 +29,20 @@ export default function callbackTemplate(callbacks) {
29
29
  .parameters = "${method[1]?.parameters || ''}"
30
30
  .request_body = "${method[1]?.requestBody || ''}"
31
31
  fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
32
- use-summary-to-list-example = "${this.useSummaryToListExamples}"
33
32
  allow-try = "false"
34
33
  render-style="${this.renderStyle}"
35
34
  schema-style = "${this.schemaStyle}"
36
35
  active-schema-tab = "${this.defaultSchemaTab}"
37
36
  schema-expand-level = "${this.schemaExpandLevel}"
38
37
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
39
- allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
38
+ allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
40
39
  schema-hide-read-only = "false"
41
- schema-hide-write-only = "${this.schemaHideWriteOnly}"
40
+ schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : 'true'}"
42
41
  fetch-credentials = "${this.fetchCredentials}"
43
- exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
42
+ exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
44
43
  file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
45
44
  anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
46
- > </api-request>
45
+ > </api-request>
47
46
 
48
47
  <api-response
49
48
  style = "width:100%;"
@@ -56,7 +55,7 @@ export default function callbackTemplate(callbacks) {
56
55
  schema-expand-level = "${this.schemaExpandLevel}"
57
56
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
58
57
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
59
- schema-hide-read-only = "${this.schemaHideReadOnly}"
58
+ schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : 'true'}"
60
59
  schema-hide-write-only = "false"
61
60
  exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
62
61
  schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
@@ -28,6 +28,7 @@ export default function codeSamplesTemplate(xCodeSamples) {
28
28
  <pre><code class="language">${Prism.languages[v.lang?.toLowerCase()] ? unsafeHTML(Prism.highlight(v.source, Prism.languages[v.lang?.toLowerCase()], v.lang?.toLowerCase())) : v.source}</code></pre>
29
29
  </div>`)
30
30
  }
31
+ </div>
31
32
  </section>`;
32
33
  }
33
34
  /* eslint-enable indent */
@@ -14,22 +14,20 @@ function schemaBodyTemplate(sComponent) {
14
14
  ${this.schemaStyle === 'table'
15
15
  ? html`
16
16
  <schema-table
17
- render-style = '${this.renderStyle}'
18
17
  .data = '${schemaInObjectNotation(sComponent.component, {})}'
19
18
  schema-expand-level = "${this.schemaExpandLevel}"
20
19
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
21
- allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
20
+ allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
22
21
  schema-hide-read-only = "false"
23
22
  schema-hide-write-only = "${this.schemaHideWriteOnly}"
24
23
  exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
25
- > </schema-tree> `
24
+ > </schema-table>`
26
25
  : html`
27
26
  <schema-tree
28
- render-style = '${this.renderStyle}'
29
27
  .data = '${schemaInObjectNotation(sComponent.component, {})}'
30
28
  schema-expand-level = "${this.schemaExpandLevel}"
31
29
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
32
- allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
30
+ allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
33
31
  schema-hide-read-only = "false"
34
32
  schema-hide-write-only = "${this.schemaHideWriteOnly}"
35
33
  exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
@@ -12,14 +12,14 @@ function toggleExpand(path) {
12
12
  if (path.expanded) {
13
13
  path.expanded = false; // collapse
14
14
  if (this.updateRoute === 'true') {
15
- window.history.replaceState(null, null, `${window.location.href.split('#')[0]}${this.routePrefix === '#' ? '' : `${this.routePrefix}`}`);
15
+ this.replaceHistoryState('');
16
16
  }
17
17
  } else {
18
18
  path.expanded = true; // Expand
19
19
  if (this.updateRoute === 'true') {
20
20
  const newHash = `${this.routePrefix || '#'}${path.elementId}`;
21
21
  if (window.location.hash !== newHash) {
22
- window.history.replaceState(null, null, `${window.location.href.split('#')[0]}${newHash}`);
22
+ this.replaceHistoryState(path.elementId);
23
23
  }
24
24
  }
25
25
  }
@@ -109,6 +109,18 @@ function endpointBodyTemplate(path) {
109
109
  }
110
110
 
111
111
  ${path.description ? html`<div part="section-endpoint-body-description" class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
112
+ ${path.externalDocs?.url || path.externalDocs?.description
113
+ ? html`<div style="background-color:var(--bg3); padding:2px 8px 8px 8px; margin:8px 0; border-radius:var(--border-radius)">
114
+ <div class="m-markdown"> ${unsafeHTML(marked(path.externalDocs?.description || ''))} </div>
115
+ ${path.externalDocs?.url
116
+ ? html`<a style="font-family:var(--font-mono); font-size:var(--font-size-small)" href="${path.externalDocs?.url}" target="_blank">
117
+ ${path.externalDocs?.url} <div style="transform: rotate(270deg) scale(1.5); display: inline-block; margin-left:5px">⇲</div>
118
+ </a>`
119
+ : ''
120
+ }
121
+ </div>`
122
+ : ''
123
+ }
112
124
  <slot name="${path.elementId}"></slot>
113
125
  ${pathSecurityTemplate.call(this, path.security)}
114
126
  ${codeSampleTabPanel}
@@ -118,7 +130,8 @@ function endpointBodyTemplate(path) {
118
130
  <api-request
119
131
  class = "${this.renderStyle}-mode ${this.layout}-layout"
120
132
  style = "width:100%;"
121
- method = "${path.method}",
133
+ webhook = "${path.isWebhook}"
134
+ method = "${path.method}"
122
135
  path = "${path.path}"
123
136
  .security = "${path.security}"
124
137
  .parameters = "${path.parameters}"
@@ -128,43 +141,44 @@ function endpointBodyTemplate(path) {
128
141
  server-url = "${path.servers && path.servers.length > 0 ? path.servers[0].url : this.selectedServer.computedUrl}"
129
142
  active-schema-tab = "${this.defaultSchemaTab}"
130
143
  fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
131
- use-summary-to-list-example = "${this.useSummaryToListExamples}"
132
144
  allow-try = "${this.allowTry}"
145
+ show-curl-before-try = "${this.showCurlBeforeTry}"
133
146
  accept = "${accept}"
134
147
  render-style="${this.renderStyle}"
135
148
  schema-style = "${this.schemaStyle}"
136
149
  schema-expand-level = "${this.schemaExpandLevel}"
137
150
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
138
151
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
139
- schema-hide-read-only = "${path.isWebhook ? this.schemaHideWriteOnly : this.schemaHideReadOnly}"
140
- schema-hide-write-only = "${path.isWebhook ? this.schemaHideReadOnly : this.schemaHideWriteOnly}"
152
+ schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
153
+ schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
141
154
  fetch-credentials = "${this.fetchCredentials}"
142
- exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
155
+ exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
143
156
  file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
144
157
  anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
145
- > </api-request>
158
+ > </api-request>
146
159
 
147
160
  ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
148
- </div>
161
+ </div>
149
162
 
150
- <api-response
151
- class = "${this.renderStyle}-mode"
152
- style = "width:100%;"
153
- .responses="${path.responses}"
154
- active-schema-tab = "${this.defaultSchemaTab}"
155
- render-style="${this.renderStyle}"
156
- schema-style="${this.schemaStyle}"
157
- schema-expand-level = "${this.schemaExpandLevel}"
158
- schema-description-expanded = "${this.schemaDescriptionExpanded}"
159
- allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
160
- schema-hide-read-only = "${path.isWebhook ? this.schemaHideWriteOnly : this.schemaHideReadOnly}"
161
- schema-hide-write-only = "${path.isWebhook ? this.schemaHideReadOnly : this.schemaHideWriteOnly}"
162
- selected-status = "${Object.keys(path.responses || {})[0] || ''}"
163
- exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input,
164
- textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, anchor:anchor, anchor-param-example:anchor-param-example, btn-clear-resp:btn-clear-resp,
165
- schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
166
- > </api-response>
167
- </div>
163
+ <api-response
164
+ class = "${this.renderStyle}-mode"
165
+ style = "width:100%;"
166
+ webhook = "${path.isWebhook}"
167
+ .responses="${path.responses}"
168
+ active-schema-tab = "${this.defaultSchemaTab}"
169
+ render-style="${this.renderStyle}"
170
+ schema-style="${this.schemaStyle}"
171
+ schema-expand-level = "${this.schemaExpandLevel}"
172
+ schema-description-expanded = "${this.schemaDescriptionExpanded}"
173
+ allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
174
+ schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
175
+ schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
176
+ selected-status = "${Object.keys(path.responses || {})[0] || ''}"
177
+ exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input,
178
+ textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, anchor:anchor, anchor-param-example:anchor-param-example, btn-clear-resp:btn-clear-resp,
179
+ schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
180
+ > </api-response>
181
+ </div>
168
182
  </div>`;
169
183
  }
170
184
 
@@ -15,7 +15,24 @@ function headingRenderer(tagElementId) {
15
15
  return renderer;
16
16
  }
17
17
 
18
- export function expandedEndpointBodyTemplate(path, tagName = '') {
18
+ function expandCollapseTagDescription(e) {
19
+ const tagDescriptionEl = e.target.closest('.tag-container').querySelector('.tag-description');
20
+ const tagIconEl = e.target.closest('.tag-container').querySelector('.tag-icon');
21
+ if (tagDescriptionEl && tagIconEl) {
22
+ const isExpanded = tagDescriptionEl.classList.contains('expanded');
23
+ if (isExpanded) {
24
+ tagDescriptionEl.style.maxHeight = 0;
25
+ tagDescriptionEl.classList.replace('expanded', 'collapsed');
26
+ tagIconEl.classList.replace('expanded', 'collapsed');
27
+ } else {
28
+ tagDescriptionEl.style.maxHeight = `${tagDescriptionEl.scrollHeight}px`;
29
+ tagDescriptionEl.classList.replace('collapsed', 'expanded');
30
+ tagIconEl.classList.replace('collapsed', 'expanded');
31
+ }
32
+ }
33
+ }
34
+
35
+ export function expandedEndpointBodyTemplate(path, tagName = '', tagDescription = '') {
19
36
  const acceptContentTypes = new Set();
20
37
  for (const respStatus in path.responses) {
21
38
  for (const acceptContentType in (path.responses[respStatus]?.content)) {
@@ -37,7 +54,26 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
37
54
  return html`
38
55
  ${this.renderStyle === 'read' ? html`<div class='divider' part="operation-divider"></div>` : ''}
39
56
  <div class='expanded-endpoint-body observe-me ${path.method} ${path.deprecated ? 'deprecated' : ''} ' part="section-operation ${path.elementId}" id='${path.elementId}'>
40
- ${(this.renderStyle === 'focused' && tagName !== 'General ⦂') ? html`<h3 class="upper" style="font-weight:bold" part="section-operation-tag"> ${tagName} </h3>` : ''}
57
+ ${(this.renderStyle === 'focused' && tagName !== 'General ⦂')
58
+ ? html`
59
+ <div class="tag-container" part="section-operation-tag">
60
+ <span class="upper" style="font-weight:bold; font-size:18px;"> ${tagName} </span>
61
+ ${tagDescription
62
+ ? html`
63
+ <svg class="tag-icon collapsed" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" fill="none" style="stroke:var(--primary-color); vertical-align:top; cursor:pointer"
64
+ @click="${(e) => { expandCollapseTagDescription.call(this, e); }}"
65
+ >
66
+ <path d="M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h8"></path><path d="M18 4v17"></path><path d="M15 18l3 3l3 -3"></path>
67
+ </svg>
68
+ <div class="tag-description collapsed" style="max-height:0px; overflow:hidden; margin-top:16px; border:1px solid var(--border-color)">
69
+ <div class="m-markdown" style="padding:8px"> ${unsafeHTML(marked(tagDescription))}</div>
70
+ </div>`
71
+ : ''
72
+ }
73
+ </div>
74
+ `
75
+ : ''
76
+ }
41
77
  ${path.deprecated ? html`<div class="bold-text red-text"> DEPRECATED </div>` : ''}
42
78
  ${html`
43
79
  ${path.xBadges && path.xBadges?.length > 0
@@ -53,10 +89,10 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
53
89
  }
54
90
  <h2 part="section-operation-summary"> ${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}</h2>
55
91
  ${path.isWebhook
56
- ? html`<span part="section-operation-webhook style="color:var(--primary-color); font-weight:bold; font-size: var(--font-size-regular);"> WEBHOOK </span>`
92
+ ? html`<span part="section-operation-webhook" style="color:var(--primary-color); font-weight:bold; font-size: var(--font-size-regular);"> WEBHOOK </span>`
57
93
  : html`
58
- <div class='mono-font part="section-operation-webhook-method" regular-font-size' style='text-align:left; direction:ltr; padding: 8px 0; color:var(--fg3)'>
59
- <span part="label-operation-method" class='regular-font upper method-fg bold-text ${path.method}'>${path.method}</span>
94
+ <div part="section-operation-webhook-method" class="mono-font regular-font-size" style="text-align:left; direction:ltr; padding: 8px 0; color:var(--fg3)">
95
+ <span part="label-operation-method" class="regular-font upper method-fg bold-text ${path.method}">${path.method}</span>
60
96
  <span part="label-operation-path">${path.path}</span>
61
97
  </div>
62
98
  `
@@ -65,11 +101,24 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
65
101
  }
66
102
  ${path.description ? html`<div class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
67
103
  ${pathSecurityTemplate.call(this, path.security)}
104
+ ${path.externalDocs?.url || path.externalDocs?.description
105
+ ? html`<div style="background-color:var(--bg3); padding:2px 8px 8px 8px; margin:8px 0; border-radius:var(--border-radius)">
106
+ <div class="m-markdown"> ${unsafeHTML(marked(path.externalDocs?.description || ''))} </div>
107
+ ${path.externalDocs?.url
108
+ ? html`<a style="font-family:var(--font-mono); font-size:var(--font-size-small)" href="${path.externalDocs?.url}" target="_blank">
109
+ ${path.externalDocs?.url} <div style="transform: rotate(270deg) scale(1.5); display: inline-block; margin-left:5px">⇲</div>
110
+ </a>`
111
+ : ''
112
+ }
113
+ </div>`
114
+ : ''
115
+ }
68
116
  ${codeSampleTabPanel}
69
117
  <div class='expanded-req-resp-container'>
70
118
  <api-request
71
119
  class = "${this.renderStyle}-mode"
72
120
  style = "width:100%;"
121
+ webhook = "${path.isWebhook}"
73
122
  method = "${path.method}"
74
123
  path = "${path.path}"
75
124
  .security = "${path.security}"
@@ -79,8 +128,8 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
79
128
  .servers = "${path.servers}"
80
129
  server-url = "${path.servers?.[0]?.url || this.selectedServer.computedUrl}"
81
130
  fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
82
- use-summary-to-list-example = "${this.useSummaryToListExamples}"
83
131
  allow-try = "${this.allowTry}"
132
+ show-curl-before-try = "${this.showCurlBeforeTry}"
84
133
  accept = "${accept}"
85
134
  render-style="${this.renderStyle}"
86
135
  schema-style = "${this.schemaStyle}"
@@ -88,10 +137,10 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
88
137
  schema-expand-level = "${this.schemaExpandLevel}"
89
138
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
90
139
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
91
- schema-hide-read-only = "${path.isWebhook ? false : this.schemaHideReadOnly}"
92
- schema-hide-write-only = "${path.isWebhook ? this.schemaHideWriteOnly : false}"
140
+ schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
141
+ schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
93
142
  fetch-credentials = "${this.fetchCredentials}"
94
- exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
143
+ exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
95
144
  file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
96
145
  anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
97
146
  > </api-request>
@@ -101,6 +150,7 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
101
150
  <api-response
102
151
  class = "${this.renderStyle}-mode"
103
152
  style = "width:100%;"
153
+ webhook = "${path.isWebhook}"
104
154
  .responses = "${path.responses}"
105
155
  render-style = "${this.renderStyle}"
106
156
  schema-style = "${this.schemaStyle}"
@@ -108,8 +158,8 @@ export function expandedEndpointBodyTemplate(path, tagName = '') {
108
158
  schema-expand-level = "${this.schemaExpandLevel}"
109
159
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
110
160
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
111
- schema-hide-read-only = "${path.isWebhook ? this.schemaHideReadOnly : false}"
112
- schema-hide-write-only = "${path.isWebhook ? false : this.schemaHideWriteOnly}"
161
+ schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
162
+ schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
113
163
  selected-status = "${Object.keys(path.responses || {})[0] || ''}"
114
164
  exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
115
165
  schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
@@ -135,8 +185,8 @@ export default function expandedEndpointTemplate() {
135
185
  }
136
186
  </div>
137
187
  </section>
138
- <section class='regular-font section-gap--read-mode' part="section-operations-in-tag">
139
- ${tag.paths.map((path) => expandedEndpointBodyTemplate.call(this, path, 'BBB'))}
188
+ <section class="regular-font section-gap--read-mode" part="section-operations-in-tag">
189
+ ${tag.paths.map((path) => expandedEndpointBodyTemplate.call(this, path))}
140
190
  </section>
141
191
  `)
142
192
  }
@@ -96,7 +96,10 @@ export default function focusedEndpointTemplate() {
96
96
  // In focused mode we must expand the nav-bar tag element if it is collapsed
97
97
  const newNavEl = this.shadowRoot.getElementById(`link-${focusElId}`);
98
98
  expandCollapseNavBarTag(newNavEl, 'expand');
99
- focusedTemplate = wrapFocusedTemplate.call(this, expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name));
99
+ focusedTemplate = wrapFocusedTemplate.call(
100
+ this,
101
+ expandedEndpointBodyTemplate.call(this, selectedPathObj, (selectedTagObj.name || ''), (selectedTagObj.description || '')),
102
+ );
100
103
  } else {
101
104
  // if focusedElementId is not found then show the default content (overview or first-path)
102
105
  focusedTemplate = defaultContentTemplate.call(this);
@@ -23,7 +23,7 @@ export default function headerTemplate() {
23
23
  part="textbox textbox-spec-url"
24
24
  placeholder="Spec URL"
25
25
  value="${this.specUrl || ''}"
26
- @change="${this.onSepcUrlChange}"
26
+ @change="${this.onSpecUrlChange}"
27
27
  spellcheck="false"
28
28
  >
29
29
  <div style="margin: 6px 5px 0 -24px; font-size:var(--font-size-regular); cursor:pointer;">&#x21a9;</div>
@@ -37,7 +37,7 @@ export default function headerTemplate() {
37
37
  type="file"
38
38
  style="display:none"
39
39
  value="${this.specFile || ''}"
40
- @change="${this.onSepcFileChange}"
40
+ @change="${this.onSpecFileChange}"
41
41
  spellcheck="false"
42
42
  >
43
43
  <button class="m-btn primary only-large-screen" style="margin-left:10px;" part="btn btn-fill" @click="${this.onFileLoadClick}"> LOCAL JSON FILE </button>
@@ -63,7 +63,7 @@ function jsonSchemaBodyTemplate() {
63
63
  .data = "${schemaInObjectNotation(jSchemaBody.schema, {})}"
64
64
  schema-expand-level = "${this.schemaExpandLevel}"
65
65
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
66
- allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
66
+ allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
67
67
  schema-hide-read-only = "false"
68
68
  schema-hide-write-only = "false"
69
69
  > </schema-tree>
@@ -113,6 +113,7 @@ export default function jsonSchemaViewerTemplate(isMini = false) {
113
113
  navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
114
114
  navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
115
115
  navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
116
+ navAccenttextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',
116
117
  };
117
118
  /* eslint-disable indent */
118
119
  if (this.resolvedSpec.specLoadError) {
@@ -30,24 +30,25 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
30
30
  navHoverBgColor: isValidHexColor(this.navHoverBgColor) ? this.navHoverBgColor : '',
31
31
  navHoverTextColor: isValidHexColor(this.navHoverTextColor) ? this.navHoverTextColor : '',
32
32
  navAccentColor: isValidHexColor(this.navAccentColor) ? this.navAccentColor : '',
33
+ navAccentTextColor: isValidHexColor(this.navAccentTextColor) ? this.navAccentTextColor : '',
33
34
  };
34
35
  /* eslint-disable indent */
35
36
  if (this.resolvedSpec.specLoadError) {
36
37
  if (isMini) {
37
38
  return html`
38
39
  ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
39
- <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>
40
+ <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>
40
41
  `;
41
42
  }
42
43
  return html`
43
44
  ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
44
45
  <!-- Header -->
45
46
  ${headerTemplate.call(this)}
46
- <main class="main-content regular-font" part="section-main-content">
47
+ <main class='main-content regular-font' part='section-main-content'>
47
48
  <slot></slot>
48
- <div style="margin:24px; text-align: center;">
49
- <h1 style="color: var(--red)"> ${this.resolvedSpec.info.title} </h1>
50
- <div style="font-family:var(--font-mono)"> ${this.resolvedSpec.info.description} </div>
49
+ <div style='margin:24px; text-align: center;'>
50
+ <h1 style='color: var(--red)'> ${this.resolvedSpec.info.title} </h1>
51
+ <div style='font-family:var(--font-mono)'> ${this.resolvedSpec.info.description} </div>
51
52
  </div>
52
53
  </main>
53
54
  `;
@@ -55,12 +56,12 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
55
56
  if (this.resolvedSpec.isSpecLoading) {
56
57
  return html`
57
58
  ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
58
- <main class="main-content regular-font" part="section-main-content">
59
+ <main class='main-content regular-font' part='section-main-content'>
59
60
  <slot></slot>
60
- <div class="main-content-inner--${this.renderStyle}-mode">
61
- <div class="loader"></div>
61
+ <div class='main-content-inner--${this.renderStyle}-mode'>
62
+ <div class='loader'></div>
62
63
  </div>
63
- </main>
64
+ </main>
64
65
  `;
65
66
  }
66
67
 
@@ -73,7 +74,7 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
73
74
  <!-- Advanced Search -->
74
75
  ${this.allowAdvancedSearch === 'false' ? '' : advancedSearchTemplate.call(this)}
75
76
 
76
- <div id='the-main-body' class="body ${this.cssClasses}" dir= ${this.pageDirection} >
77
+ <div id='the-main-body' class='body ${this.cssClasses}' dir='${this.pageDirection}' >
77
78
  <!-- Side Nav -->
78
79
  ${((this.renderStyle === 'read' || this.renderStyle === 'focused')
79
80
  && this.showSideNav === 'true'
@@ -82,24 +83,24 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
82
83
  }
83
84
 
84
85
  <!-- Main Content -->
85
- <main class="main-content regular-font" part="section-main-content">
86
+ <main class='main-content regular-font' tabindex='-1' part='section-main-content'>
86
87
  <slot></slot>
87
- <div class="main-content-inner--${this.renderStyle}-mode">
88
+ <div class='main-content-inner--${this.renderStyle}-mode'>
88
89
  ${this.loading === true
89
- ? html`<div class="loader"></div>`
90
+ ? html`<div class='loader'></div>`
90
91
  : html`
91
92
  ${this.loadFailed === true
92
- ? html`<div style="text-align: center;margin: 16px;"> Unable to load the Spec</div>`
93
+ ? html`<div style='text-align: center;margin: 16px;'> Unable to load the Spec</div>`
93
94
  : html`
94
- <div class="operations-root" @click="${(e) => { this.handleHref(e); }}">
95
+ <div class='operations-root' @click='${(e) => { this.handleHref(e); }}'>
95
96
  ${this.renderStyle === 'focused'
96
97
  ? html`${focusedEndpointTemplate.call(this)}`
97
98
  : html`
98
99
  ${this.showInfo === 'true' ? overviewTemplate.call(this) : ''}
99
100
  ${this.allowServerSelection === 'true' ? serverTemplate.call(this) : ''}
100
101
  ${this.allowAuthentication === 'true' ? securitySchemeTemplate.call(this) : ''}
101
- <div id="operations-top" class="observe-me">
102
- <slot name="operations-top"></slot>
102
+ <div id='operations-top' class='observe-me'>
103
+ <slot name='operations-top'></slot>
103
104
  </div>
104
105
  ${this.renderStyle === 'read'
105
106
  ? expandedEndpointTemplate.call(this)
@@ -112,7 +113,7 @@ export default function mainBodyTemplate(isMini = false, showExpandCollapse = tr
112
113
  }`
113
114
  }
114
115
  </div>
115
- <slot name="footer"></slot>
116
+ <slot name='footer'></slot>
116
117
  </main>
117
118
  </div>
118
119
  `;