rapidoc 9.2.0 → 9.3.0

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 (43) hide show
  1. package/.github/FUNDING.yml +13 -0
  2. package/CONTRIBUTING.md +1 -1
  3. package/README.md +13 -6
  4. package/index.html +6 -4
  5. package/package.json +15 -14
  6. package/src/components/api-request.js +44 -29
  7. package/src/components/api-response.js +5 -4
  8. package/src/components/json-tree.js +13 -2
  9. package/src/components/schema-table.js +37 -15
  10. package/src/components/schema-tree.js +40 -11
  11. package/src/json-schema-viewer.js +1 -1
  12. package/src/rapidoc-mini.js +25 -0
  13. package/src/rapidoc.js +39 -1
  14. package/src/styles/endpoint-styles.js +9 -9
  15. package/src/styles/nav-styles.js +3 -1
  16. package/src/styles/schema-styles.js +3 -1
  17. package/src/styles/tab-styles.js +1 -0
  18. package/src/templates/callback-template.js +8 -3
  19. package/src/templates/components-template.js +2 -0
  20. package/src/templates/endpoint-template.js +19 -15
  21. package/src/templates/expanded-endpoint-template.js +75 -71
  22. package/src/templates/header-template.js +1 -1
  23. package/src/templates/json-schema-viewer-template.js +1 -1
  24. package/src/templates/main-body-template.js +1 -1
  25. package/src/templates/navbar-template.js +21 -8
  26. package/src/templates/overview-template.js +1 -1
  27. package/src/templates/security-scheme-template.js +30 -20
  28. package/src/templates/server-template.js +2 -2
  29. package/src/utils/schema-utils.js +34 -22
  30. package/src/utils/spec-parser.js +1 -1
  31. package/src/utils/theme.js +11 -4
  32. package/webpack.config.js +1 -1
  33. package/.vscode/settings.json +0 -12
  34. package/dist/index.html +0 -6
  35. package/dist/index.html.gz +0 -0
  36. package/dist/rapidoc-min.js +0 -3670
  37. package/dist/rapidoc-min.js.LICENSE.txt +0 -68
  38. package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
  39. package/dist/rapidoc-min.js.gz +0 -0
  40. package/dist/rapidoc-min.js.map +0 -1
  41. package/dist/rapidoc-min.js.map.gz +0 -0
  42. package/dist/rapidoc.js +0 -43041
  43. package/dist/report.html +0 -38
@@ -52,7 +52,16 @@ export default class SchemaTree extends LitElement {
52
52
  max-width: 300px;
53
53
  }
54
54
  .key.deprecated .key-label {
55
- text-decoration: line-through;
55
+ color: var(--red);
56
+ }
57
+ .tr.expanded:hover > .td.key > .open-bracket {
58
+ color: var(--primary-color);
59
+ }
60
+ .tr.expanded:hover + .inside-bracket {
61
+ border-left: 1px solid var(--fg3);
62
+ }
63
+ .tr.expanded:hover + .inside-bracket + .close-bracket {
64
+ color: var(--primary-color);
56
65
  }
57
66
 
58
67
  .open-bracket{
@@ -98,7 +107,7 @@ export default class SchemaTree extends LitElement {
98
107
  ${this.allowSchemaDescriptionExpandToggle === 'true'
99
108
  ? html`
100
109
  <div style="flex:1"></div>
101
- <div class='toolbar-item' @click='${() => { this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true'); }}'>
110
+ <div part="schema-toolbar-item schema-multiline-toggle" class='toolbar-item' @click='${() => { this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true'); }}'>
102
111
  ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}
103
112
  </div>
104
113
  `
@@ -106,7 +115,7 @@ export default class SchemaTree extends LitElement {
106
115
  }
107
116
  </div>
108
117
  ${this.data?.['::description']
109
- ? html`<span class='m-markdown'> ${unsafeHTML(marked(this.data['::description'] || ''))}</span>`
118
+ ? html`<span part="schema-description" class='m-markdown'> ${unsafeHTML(marked(this.data['::description'] || ''))}</span>`
110
119
  : ''
111
120
  }
112
121
  ${this.data
@@ -129,7 +138,7 @@ export default class SchemaTree extends LitElement {
129
138
  return;
130
139
  }
131
140
  }
132
- if (data['::readwrite'] === 'readonly') {
141
+ if (data && data['::readwrite'] === 'readonly') {
133
142
  return;
134
143
  }
135
144
  }
@@ -139,13 +148,22 @@ export default class SchemaTree extends LitElement {
139
148
  return;
140
149
  }
141
150
  }
142
- if (data['::readwrite'] === 'writeonly') {
151
+ if (data && data['::readwrite'] === 'writeonly') {
143
152
  return;
144
153
  }
145
154
  }
146
155
 
147
156
  if (!data) {
148
- return html`<div class="null" style="display:inline;">null</div>`;
157
+ return html`<div class="null" style="display:inline;">
158
+ <span class="key-label xxx-of-key"> ${key.replace('::OPTION~', '')}</span>
159
+ ${
160
+ dataType === 'array'
161
+ ? html`<span class='mono-font'> [ ] </span>`
162
+ : dataType === 'object'
163
+ ? html`<span class='mono-font'> { } </span>`
164
+ : html`<span class='mono-font'> schema undefined </span>`
165
+ }
166
+ </div>`;
149
167
  }
150
168
  if (Object.keys(data).length === 0) {
151
169
  return html`<span class="key object">${key}:{ }</span>`;
@@ -205,14 +223,15 @@ export default class SchemaTree extends LitElement {
205
223
  }
206
224
  if (typeof data === 'object') {
207
225
  return html`
208
- <div class="tr ${schemaLevel < this.schemaExpandLevel || data['::type']?.startsWith('xxx-of') ? 'expanded' : 'collapsed'} ${data['::type'] || 'no-type-info'}">
226
+ <div class="tr ${schemaLevel < this.schemaExpandLevel || data['::type']?.startsWith('xxx-of') ? 'expanded' : 'collapsed'} ${data['::type'] || 'no-type-info'}" title="${data['::deprecated'] ? 'Deprecated' : ''}">
209
227
  <div class="td key ${data['::deprecated'] ? 'deprecated' : ''}" style='min-width:${minFieldColWidth}px'>
210
228
  ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')
211
- ? html`<span class='key-label xxx-of-key'>${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>`
229
+ ? html`<span class='key-label xxx-of-key'> ${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>`
212
230
  : keyLabel === '::props' || keyLabel === '::ARRAY~OF'
213
231
  ? ''
214
232
  : schemaLevel > 0
215
233
  ? html`<span class="key-label" title="${readOrWrite === 'readonly' ? 'Read-Only' : readOrWrite === 'writeonly' ? 'Write-Only' : ''}">
234
+ ${data['::deprecated'] ? '✗' : ''}
216
235
  ${keyLabel.replace(/\*$/, '')}${keyLabel.endsWith('*') ? html`<span style="color:var(--red)">*</span>` : ''}${readOrWrite === 'readonly' ? html` 🆁` : readOrWrite === 'writeonly' ? html` 🆆` : readOrWrite}:
217
236
  </span>`
218
237
  : ''
@@ -291,8 +310,9 @@ export default class SchemaTree extends LitElement {
291
310
  }
292
311
 
293
312
  return html`
294
- <div class = "tr primitive">
295
- <div class="td key ${deprecated}" style='min-width:${minFieldColWidth}px' >
313
+ <div class = "tr primitive" title="${deprecated ? 'Deprecated' : ''}">
314
+ <div class="td key ${deprecated}" style='min-width:${minFieldColWidth}px'>
315
+ ${deprecated ? html`<span style='color:var(--red);'>✗</span>` : ''}
296
316
  ${keyLabel.endsWith('*')
297
317
  ? html`<span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>:`
298
318
  : key.startsWith('::OPTION')
@@ -306,11 +326,20 @@ export default class SchemaTree extends LitElement {
306
326
  </div>
307
327
  <div class='td key-descr'>
308
328
  ${dataType === 'array' ? html`<span class="m-markdown-small">${unsafeHTML(marked(description))}</span>` : ''}
329
+ ${schemaDescription
330
+ ? html`<span class="m-markdown-small">
331
+ ${unsafeHTML(marked(`${schemaTitle ? `**${schemaTitle}:**` : ''} ${schemaDescription} ${constraint || defaultValue || allowedValues || pattern ? '<span class="more-content">⤵</span>' : ''}`))}
332
+ </span>`
333
+ : schemaTitle
334
+ ? html`${schemaTitle} ${constraint || defaultValue || allowedValues || pattern
335
+ ? html`<span class="more-content">⤵</span>`
336
+ : ''}`
337
+ : ''
338
+ }
309
339
  ${constraint ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Constraints: </span>${constraint}</div>` : ''}
310
340
  ${defaultValue ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Default: </span>${defaultValue}</div>` : ''}
311
341
  ${allowedValues ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px'><span class='bold-text'>Allowed: </span>${allowedValues}</div>` : ''}
312
342
  ${pattern ? html`<div style='display:inline-block; line-break: anywhere; margin-right:8px'><span class='bold-text'>Pattern: </span>${pattern}</div>` : ''}
313
- ${schemaDescription ? html`<span class="m-markdown-small">${unsafeHTML(marked(`${schemaTitle ? `**${schemaTitle}:**` : ''} ${schemaDescription}`))}</span>` : ''}
314
343
  </div>
315
344
  </div>
316
345
  `;
@@ -134,7 +134,7 @@ export default class JsonSchemaViewer extends LitElement {
134
134
  .main-content::-webkit-scrollbar-thumb {
135
135
  background-color: var(--border-color);
136
136
  }
137
- .header {
137
+ .main-header {
138
138
  background-color:var(--header-bg);
139
139
  color:var(--header-fg);
140
140
  width:100%;
@@ -25,6 +25,8 @@ import EndpointStyles from '~/styles/endpoint-styles';
25
25
  import { rapidocApiKey } from '~/utils/common-utils';
26
26
  import ProcessSpec from '~/utils/spec-parser';
27
27
  import mainBodyTemplate from '~/templates/main-body-template';
28
+ import { applyApiKey, onClearAllApiKeys } from '~/templates/security-scheme-template';
29
+ import { setApiServer } from '~/templates/server-template';
28
30
 
29
31
  export default class RapiDocMini extends LitElement {
30
32
  constructor() {
@@ -49,6 +51,7 @@ export default class RapiDocMini extends LitElement {
49
51
  responseAreaHeight: { type: String, attribute: 'response-area-height' },
50
52
  showSummaryWhenCollapsed: { type: String, attribute: 'show-summary-when-collapsed' },
51
53
  fillRequestFieldsWithExample: { type: String, attribute: 'fill-request-fields-with-example' },
54
+ useSummaryToListExamples: { type: String, attribute: 'use-summary-to-list-example' },
52
55
  persistAuth: { type: String, attribute: 'persist-auth' },
53
56
 
54
57
  // Schema Styles
@@ -167,6 +170,7 @@ export default class RapiDocMini extends LitElement {
167
170
  if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }
168
171
  if (!this.schemaDescriptionExpanded || !'true, false,'.includes(`${this.schemaDescriptionExpanded},`)) { this.schemaDescriptionExpanded = 'false'; }
169
172
  if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }
173
+ if (!this.useSummaryToListExamples || !'true, false,'.includes(`${this.useSummaryToListExamples},`)) { this.useSummaryToListExamples = 'false'; }
170
174
  if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }
171
175
  if (!this.responseAreaHeight) { this.responseAreaHeight = '300px'; }
172
176
 
@@ -301,6 +305,27 @@ export default class RapiDocMini extends LitElement {
301
305
  }
302
306
  }
303
307
 
308
+ // Public Method - to update security-scheme of type http
309
+ setHttpUserNameAndPassword(securitySchemeId, username, password) {
310
+ return applyApiKey.call(this, securitySchemeId, username, password);
311
+ }
312
+
313
+ // Public Method - to update security-scheme of type apiKey or OAuth
314
+ setApiKey(securitySchemeId, apiKeyValue) {
315
+ return applyApiKey.call(this, securitySchemeId, '', '', apiKeyValue);
316
+ }
317
+
318
+ // Public Method
319
+ removeAllSecurityKeys() {
320
+ return onClearAllApiKeys.call(this);
321
+ }
322
+
323
+ // Public Method
324
+ setApiServer(apiServerUrl) {
325
+ // return apiServerUrl;
326
+ return setApiServer.call(this, apiServerUrl);
327
+ }
328
+
304
329
  async afterSpecParsedAndValidated(spec) {
305
330
  this.resolvedSpec = spec;
306
331
  this.selectedServer = undefined;
package/src/rapidoc.js CHANGED
@@ -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
+ useSummaryToListExamples: { type: String, attribute: 'use-summary-to-list-example' },
66
67
  persistAuth: { type: String, attribute: 'persist-auth' },
67
68
  onNavTagClick: { type: String, attribute: 'on-nav-tag-click' },
68
69
 
@@ -107,6 +108,8 @@ export default class RapiDoc extends LitElement {
107
108
  regularFont: { type: String, attribute: 'regular-font' },
108
109
  monoFont: { type: String, attribute: 'mono-font' },
109
110
  loadFonts: { type: String, attribute: 'load-fonts' },
111
+ cssFile: { type: String, attribute: 'css-file' },
112
+ cssClasses: { type: String, attribute: 'css-classes' },
110
113
 
111
114
  // Nav Bar Colors
112
115
  navBgColor: { type: String, attribute: 'nav-bg-color' },
@@ -115,6 +118,7 @@ export default class RapiDoc extends LitElement {
115
118
  navHoverTextColor: { type: String, attribute: 'nav-hover-text-color' },
116
119
  navAccentColor: { type: String, attribute: 'nav-accent-color' },
117
120
  navItemSpacing: { type: String, attribute: 'nav-item-spacing' },
121
+ showMethodInNavBar: { type: String, attribute: 'show-method-in-nav-bar' },
118
122
  usePathInNavBar: { type: String, attribute: 'use-path-in-nav-bar' },
119
123
  infoDescriptionHeadingsInNavBar: { type: String, attribute: 'info-description-headings-in-navbar' },
120
124
 
@@ -250,7 +254,7 @@ export default class RapiDoc extends LitElement {
250
254
  .tag.title {
251
255
  text-transform: uppercase;
252
256
  }
253
- .header {
257
+ .main-header {
254
258
  background-color:var(--header-bg);
255
259
  color:var(--header-fg);
256
260
  width:100%;
@@ -327,6 +331,30 @@ export default class RapiDoc extends LitElement {
327
331
  100% { transform: rotate(360deg); }
328
332
  }
329
333
 
334
+ .nav-method { font-weight: bold; margin-right: 4px; font-size: calc(var(--font-size-small) - 2px); white-space: nowrap; }
335
+ .nav-method.false { display: none; }
336
+
337
+ .nav-method.as-colored-text.get { color:var(--nav-get-color); }
338
+ .nav-method.as-colored-text.put { color:var(--nav-put-color); }
339
+ .nav-method.as-colored-text.post { color:var(--nav-post-color); }
340
+ .nav-method.as-colored-text.delete { color:var(--nav-delete-color); }
341
+ .nav-method.as-colored-text.head, .nav-method.as-colored-text.patch, .nav-method.as-colored-text.options { color:var(--nav-head-color); }
342
+
343
+ .nav-method.as-colored-block {
344
+ padding: 1px 4px;
345
+ min-width: 30px;
346
+ border-radius: 4px 0 0 4px;
347
+ color: #000;
348
+ }
349
+
350
+ .nav-method.as-colored-block.get { background-color: var(--blue); }
351
+ .nav-method.as-colored-block.put { background-color: var(--orange); }
352
+ .nav-method.as-colored-block.post { background-color: var(--green); }
353
+ .nav-method.as-colored-block.delete { background-color: var(--red); }
354
+ .nav-method.as-colored-block.head, .nav-method.as-colored-block.patch , .nav-method.as-colored-block.options {
355
+ background-color: var(--yellow);
356
+ }
357
+
330
358
  @media only screen and (min-width: 768px) {
331
359
  .nav-bar {
332
360
  width: 260px;
@@ -435,6 +463,7 @@ export default class RapiDoc extends LitElement {
435
463
  this.schemaHideReadOnly += ['get', 'head', 'delete', 'options'];
436
464
  this.schemaHideWriteOnly = this.schemaHideWriteOnly !== 'never';
437
465
  if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }
466
+ if (!this.useSummaryToListExamples || !'true, false,'.includes(`${this.useSummaryToListExamples},`)) { this.useSummaryToListExamples = 'false'; }
438
467
  if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }
439
468
  if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) { this.onNavTagClick = 'expand-collapse'; }
440
469
  if (!this.responseAreaHeight) {
@@ -456,6 +485,7 @@ export default class RapiDoc extends LitElement {
456
485
  if (!this.generateMissingTags || !'true, false,'.includes(`${this.generateMissingTags},`)) { this.generateMissingTags = 'false'; }
457
486
  if (!this.sortEndpointsBy || !'method, path, summary, none,'.includes(`${this.sortEndpointsBy},`)) { this.sortEndpointsBy = 'path'; }
458
487
  if (!this.navItemSpacing || !'compact, relaxed, default,'.includes(`${this.navItemSpacing},`)) { this.navItemSpacing = 'default'; }
488
+ if (!this.showMethodInNavBar || !'false, as-plain-text, as-colored-text, as-colored-block,'.includes(`${this.showMethodInNavBar},`)) { this.showMethodInNavBar = 'false'; }
459
489
  if (!this.usePathInNavBar || !'true, false,'.includes(`${this.usePathInNavBar},`)) { this.usePathInNavBar = 'false'; }
460
490
  if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }
461
491
 
@@ -472,6 +502,9 @@ export default class RapiDoc extends LitElement {
472
502
 
473
503
  if (!this.showAdvancedSearchDialog) { this.showAdvancedSearchDialog = false; }
474
504
 
505
+ if (!this.cssFile) { this.cssFile = null; }
506
+ if (!this.cssClasses) { this.cssClasses = ''; }
507
+
475
508
  marked.setOptions({
476
509
  highlight: (code, lang) => {
477
510
  if (Prism.languages[lang]) {
@@ -504,6 +537,11 @@ export default class RapiDoc extends LitElement {
504
537
 
505
538
  render() {
506
539
  // return render(mainBodyTemplate(this), this.shadowRoot, { eventContext: this });
540
+ const cssLinkEl = document.querySelector(`link[href*="${this.cssFile}"]`);
541
+ // adding custom style for RapiDoc
542
+ if (cssLinkEl) {
543
+ this.shadowRoot.appendChild(cssLinkEl.cloneNode());
544
+ }
507
545
  return mainBodyTemplate.call(this);
508
546
  }
509
547
 
@@ -105,7 +105,7 @@ export default css`
105
105
  word-break: break-all;
106
106
  }
107
107
 
108
- .method{
108
+ .endpoint-head .method{
109
109
  padding:2px 5px;
110
110
  vertical-align: middle;
111
111
  font-size:var(--font-size-small);
@@ -119,14 +119,14 @@ export default css`
119
119
  text-transform:uppercase;
120
120
  margin-right:5px;
121
121
  }
122
- .method.delete{ border: 2px solid var(--red);}
123
- .method.put{ border: 2px solid var(--orange); }
124
- .method.post{ border: 2px solid var(--green); }
125
- .method.get{ border: 2px solid var(--blue); }
126
- .method.get.deprecated{ border: 2px solid var(--border-color); }
127
- .method.head,
128
- .method.patch,
129
- .method.options {
122
+ .endpoint-head .method.delete{ border: 2px solid var(--red);}
123
+ .endpoint-head .method.put{ border: 2px solid var(--orange); }
124
+ .endpoint-head .method.post{ border: 2px solid var(--green); }
125
+ .endpoint-head .method.get{ border: 2px solid var(--blue); }
126
+ .endpoint-head .method.get.deprecated{ border: 2px solid var(--border-color); }
127
+ .endpoint-head .method.head,
128
+ .endpoint-head .method.patch,
129
+ .endpoint-head .method.options {
130
130
  border: 2px solid var(--yellow);
131
131
  }
132
132
 
@@ -52,7 +52,8 @@ export default css`
52
52
  height:16px;
53
53
  text-align: center;
54
54
  display: inline-block;
55
- transform: rotate(270deg);
55
+ transform: rotate(-90deg);
56
+ transition: transform 0.2s ease-out 0s;
56
57
  }
57
58
  .nav-bar.focused .nav-bar-tag-and-paths.expanded .nav-bar-tag-icon::after {
58
59
  content: '⌵';
@@ -60,6 +61,7 @@ export default css`
60
61
  height:16px;
61
62
  text-align: center;
62
63
  display: inline-block;
64
+ transition: transform 0.2s ease-out 0s;
63
65
  }
64
66
  .nav-scroll::-webkit-scrollbar {
65
67
  width: var(--scroll-bar-width, 8px);
@@ -21,10 +21,12 @@ export default css`
21
21
  word-break: break-all;
22
22
  }
23
23
 
24
- .collapsed-descr .key{
24
+ .collapsed-descr .key {
25
25
  overflow:hidden;
26
26
  }
27
27
 
28
+ .expanded-descr .more-content { display:none; }
29
+
28
30
  .key-descr {
29
31
  font-family:var(--font-regular);
30
32
  color:var(--light-fg);
@@ -41,5 +41,6 @@ export default css`
41
41
  .tab-content {
42
42
  margin:-1px 0 0 0;
43
43
  position:relative;
44
+ min-height: 50px;
44
45
  }
45
46
  `;
@@ -29,6 +29,7 @@ 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}"
32
33
  allow-try = "false"
33
34
  render-style="${this.renderStyle}"
34
35
  schema-style = "${this.schemaStyle}"
@@ -36,11 +37,12 @@ export default function callbackTemplate(callbacks) {
36
37
  schema-expand-level = "${this.schemaExpandLevel}"
37
38
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
38
39
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
39
- schema-hide-read-only = "${this.schemaHideReadOnly}"
40
+ schema-hide-read-only = "false"
41
+ schema-hide-write-only = "${this.schemaHideWriteOnly}"
40
42
  fetch-credentials = "${this.fetchCredentials}"
41
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
44
  file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
43
- anchor:anchor, anchor-param-example:anchor-param-example"
45
+ anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
44
46
  > </api-request>
45
47
 
46
48
  <api-response
@@ -54,7 +56,10 @@ export default function callbackTemplate(callbacks) {
54
56
  schema-expand-level = "${this.schemaExpandLevel}"
55
57
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
56
58
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
57
- 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"
59
+ schema-hide-read-only = "${this.schemaHideReadOnly}"
60
+ schema-hide-write-only = "false"
61
+ 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
+ schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
58
63
  > </api-response>
59
64
  </div>
60
65
  </div>
@@ -21,6 +21,7 @@ function schemaBodyTemplate(sComponent) {
21
21
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
22
22
  schema-hide-read-only = "false"
23
23
  schema-hide-write-only = "${this.schemaHideWriteOnly}"
24
+ exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
24
25
  > </schema-tree> `
25
26
  : html`
26
27
  <schema-tree
@@ -31,6 +32,7 @@ function schemaBodyTemplate(sComponent) {
31
32
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
32
33
  schema-hide-read-only = "false"
33
34
  schema-hide-write-only = "${this.schemaHideWriteOnly}"
35
+ exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
34
36
  > </schema-tree>`
35
37
  }
36
38
  </div>`;
@@ -46,9 +46,9 @@ function onExpandCollapseAll(e, action = 'expand-all') {
46
46
  /* eslint-disable indent */
47
47
  function endpointHeadTemplate(path, pathsExpanded = false) {
48
48
  return html`
49
- <summary @click="${(e) => { toggleExpand.call(this, path, e); }}" class='endpoint-head ${path.method} ${path.deprecated ? 'deprecated' : ''} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
50
- <div class="method ${path.method} ${path.deprecated ? 'deprecated' : ''}"> ${path.method} </div>
51
- <div class="path ${path.deprecated ? 'deprecated' : ''}">
49
+ <summary @click="${(e) => { toggleExpand.call(this, path, e); }}" part="section-endpoint-head-${path.expanded ? 'expanded' : 'collapsed'}" class='endpoint-head ${path.method} ${path.deprecated ? 'deprecated' : ''} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
50
+ <div part="section-endpoint-head-method" class="method ${path.method} ${path.deprecated ? 'deprecated' : ''}"> ${path.method} </div>
51
+ <div part="section-endpoint-head-path" class="path ${path.deprecated ? 'deprecated' : ''}">
52
52
  ${path.path}
53
53
  ${path.isWebhook ? html`<span style="font-family: var(--font-regular); font-size: var(--); font-size: var(--font-size-small); color:var(--primary-color); margin-left: 16px"> Webhook</span>` : ''}
54
54
  </div>
@@ -62,7 +62,7 @@ function endpointHeadTemplate(path, pathsExpanded = false) {
62
62
  ${this.showSummaryWhenCollapsed
63
63
  ? html`
64
64
  <div class="only-large-screen" style="min-width:60px; flex:1"></div>
65
- <div class="descr">${path.summary || path.shortSummary} </div>`
65
+ <div part="section-endpoint-head-description" class="descr">${path.summary || path.shortSummary} </div>`
66
66
  : ''
67
67
  }
68
68
  </summary>
@@ -88,19 +88,19 @@ function endpointBodyTemplate(path) {
88
88
 
89
89
  const codeSampleTabPanel = path.xCodeSamples ? codeSamplesTemplate(path.xCodeSamples) : '';
90
90
  return html`
91
- <div class='endpoint-body ${path.method} ${path.deprecated ? 'deprecated' : ''}'>
91
+ <div part="section-endpoint-body-${path.expanded ? 'expanded' : 'collapsed'}" class='endpoint-body ${path.method} ${path.deprecated ? 'deprecated' : ''}'>
92
92
  <div class="summary">
93
93
  ${path.summary
94
- ? html`<div class="title">${path.summary}<div>`
94
+ ? html`<div class="title" part="section-endpoint-body-title">${path.summary}<div>`
95
95
  : path.shortSummary !== path.description
96
- ? html`<div class="title">${path.shortSummary}</div>`
96
+ ? html`<div class="title" part="section-endpoint-body-title">${path.shortSummary}</div>`
97
97
  : ''
98
98
  }
99
99
  ${path.xBadges && path.xBadges?.length > 0
100
100
  ? html`
101
101
  <div style="display:flex; flex-wrap:wrap;font-size: var(--font-size-small);">
102
102
  ${path.xBadges.map((v) => (
103
- html`<span style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`
103
+ html`<span part="endpoint-badge" style="margin:1px; margin-right:5px; padding:1px 8px; font-weight:bold; border-radius:12px; background-color: var(--light-${v.color}, var(--input-bg)); color:var(--${v.color}); border:1px solid var(--${v.color})">${v.label}</span>`
104
104
  ))
105
105
  }
106
106
  </div>
@@ -108,7 +108,7 @@ function endpointBodyTemplate(path) {
108
108
  : ''
109
109
  }
110
110
 
111
- ${path.description ? html`<div class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
111
+ ${path.description ? html`<div part="section-endpoint-body-description" class="m-markdown"> ${unsafeHTML(marked(path.description))}</div>` : ''}
112
112
  <slot name="${path.elementId}"></slot>
113
113
  ${pathSecurityTemplate.call(this, path.security)}
114
114
  ${codeSampleTabPanel}
@@ -128,6 +128,7 @@ function endpointBodyTemplate(path) {
128
128
  server-url = "${path.servers && path.servers.length > 0 ? path.servers[0].url : this.selectedServer.computedUrl}"
129
129
  active-schema-tab = "${this.defaultSchemaTab}"
130
130
  fill-request-fields-with-example = "${this.fillRequestFieldsWithExample}"
131
+ use-summary-to-list-example = "${this.useSummaryToListExamples}"
131
132
  allow-try = "${this.allowTry}"
132
133
  accept = "${accept}"
133
134
  render-style="${this.renderStyle}"
@@ -135,11 +136,12 @@ function endpointBodyTemplate(path) {
135
136
  schema-expand-level = "${this.schemaExpandLevel}"
136
137
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
137
138
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
138
- schema-hide-read-only = "${this.schemaHideReadOnly}"
139
+ schema-hide-read-only = "${path.isWebhook ? this.schemaHideWriteOnly : this.schemaHideReadOnly}"
140
+ schema-hide-write-only = "${path.isWebhook ? this.schemaHideReadOnly : this.schemaHideWriteOnly}"
139
141
  fetch-credentials = "${this.fetchCredentials}"
140
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,
141
143
  file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
142
- anchor:anchor, anchor-param-example:anchor-param-example"
144
+ anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
143
145
  > </api-request>
144
146
 
145
147
  ${path.callbacks ? callbackTemplate.call(this, path.callbacks) : ''}
@@ -155,10 +157,12 @@ function endpointBodyTemplate(path) {
155
157
  schema-expand-level = "${this.schemaExpandLevel}"
156
158
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
157
159
  allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
158
- schema-hide-write-only = "${this.schemaHideWriteOnly}"
160
+ schema-hide-read-only = "${path.isWebhook ? this.schemaHideWriteOnly : this.schemaHideReadOnly}"
161
+ schema-hide-write-only = "${path.isWebhook ? this.schemaHideReadOnly : this.schemaHideWriteOnly}"
159
162
  selected-status = "${Object.keys(path.responses || {})[0] || ''}"
160
- exportparts =
161
- "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input, 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"
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"
162
166
  > </api-response>
163
167
  </div>
164
168
  </div>`;
@@ -199,7 +203,7 @@ export default function endpointTemplate(showExpandCollapse = true, showTags = t
199
203
  }
200
204
  return true;
201
205
  }).map((path) => html`
202
- <section id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
206
+ <section part="section-endpoint" id='${path.elementId}' class='m-endpoint regular-font ${path.method} ${pathsExpanded || path.expanded ? 'expanded' : 'collapsed'}'>
203
207
  ${endpointHeadTemplate.call(this, path, pathsExpanded)}
204
208
  ${pathsExpanded || path.expanded ? endpointBodyTemplate.call(this, path) : ''}
205
209
  </section>`)