rapidoc 9.3.3 → 9.3.5

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 (48) hide show
  1. package/.github/workflow/words.yaml +22 -0
  2. package/README.md +2 -7
  3. package/dist/index.html +1 -1
  4. package/dist/index.html.gz +0 -0
  5. package/dist/rapidoc-min.js +858 -748
  6. package/dist/rapidoc-min.js.LICENSE.txt +14 -9
  7. package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
  8. package/dist/rapidoc-min.js.gz +0 -0
  9. package/dist/rapidoc-min.js.map +1 -1
  10. package/dist/rapidoc-min.js.map.gz +0 -0
  11. package/dist/rapidoc.js +11948 -32008
  12. package/dist/report.html +6 -5
  13. package/index.html +2 -1
  14. package/package.json +25 -24
  15. package/src/components/api-request.js +266 -122
  16. package/src/components/api-response.js +11 -10
  17. package/src/components/json-tree.js +17 -12
  18. package/src/components/schema-table.js +58 -49
  19. package/src/components/schema-tree.js +60 -56
  20. package/src/components/tag-input.js +7 -4
  21. package/src/json-schema-viewer.js +2 -1
  22. package/src/rapidoc-mini.js +1 -1
  23. package/src/rapidoc.js +108 -35
  24. package/src/styles/endpoint-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/advance-search-template.js +3 -3
  31. package/src/templates/callback-template.js +3 -3
  32. package/src/templates/code-samples-template.js +1 -0
  33. package/src/templates/components-template.js +3 -5
  34. package/src/templates/endpoint-template.js +39 -26
  35. package/src/templates/expanded-endpoint-template.js +58 -9
  36. package/src/templates/focused-endpoint-template.js +5 -2
  37. package/src/templates/header-template.js +2 -2
  38. package/src/templates/json-schema-viewer-template.js +2 -1
  39. package/src/templates/main-body-template.js +19 -18
  40. package/src/templates/navbar-template.js +99 -82
  41. package/src/templates/overview-template.js +1 -1
  42. package/src/templates/security-scheme-template.js +51 -27
  43. package/src/templates/server-template.js +1 -1
  44. package/src/utils/common-utils.js +2 -2
  45. package/src/utils/schema-utils.js +192 -67
  46. package/src/utils/spec-parser.js +9 -3
  47. package/src/utils/theme.js +9 -3
  48. package/webpack.config.js +2 -1
@@ -9,6 +9,7 @@ import InputStyles from '~/styles/input-styles';
9
9
  import TabStyles from '~/styles/tab-styles';
10
10
  import BorderStyles from '~/styles/border-styles';
11
11
  import CustomStyles from '~/styles/custom-styles';
12
+ import '~/components/json-tree';
12
13
  import '~/components/schema-tree';
13
14
  import '~/components/schema-table';
14
15
 
@@ -49,6 +50,8 @@ export default class ApiResponse extends LitElement {
49
50
  InputStyles,
50
51
  BorderStyles,
51
52
  css`
53
+ :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
54
+ :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
52
55
  .resp-head{
53
56
  vertical-align: middle;
54
57
  padding:16px 0 8px;
@@ -207,20 +210,20 @@ export default class ApiResponse extends LitElement {
207
210
  responseHeaderListTemplate(respHeaders) {
208
211
  return html`
209
212
  <div style="padding:16px 0 8px 0" class="resp-headers small-font-size bold-text">RESPONSE HEADERS</div>
210
- <table style="border-collapse: collapse; margin-bottom:16px; border:1px solid var(--border-color); border-radius: var(--border-radius)" class="small-font-size mono-font">
213
+ <table role="presentation" style="border-collapse: collapse; margin-bottom:16px; border:1px solid var(--border-color); border-radius: var(--border-radius)" class="small-font-size mono-font">
211
214
  ${respHeaders.map((v) => html`
212
215
  <tr>
213
216
  <td style="padding:8px; vertical-align: baseline; min-width:120px; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
214
217
  ${v.name || ''}
215
218
  </td>
216
219
  <td style="padding:4px; vertical-align: baseline; padding:0 5px; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
217
- ${v.schema.type || ''}
220
+ ${v.schema?.type || ''}
218
221
  </td>
219
222
  <td style="padding:8px; vertical-align: baseline; border-top: 1px solid var(--light-border-color);text-overflow: ellipsis;">
220
223
  <div class="m-markdown-small regular-font" >${unsafeHTML(marked(v.description || ''))}</div>
221
224
  </td>
222
225
  <td style="padding:8px; vertical-align: baseline; border-top: 1px solid var(--light-border-color); text-overflow: ellipsis;">
223
- ${v.schema.example || ''}
226
+ ${v.schema?.example || ''}
224
227
  </td>
225
228
  </tr>
226
229
  `)}
@@ -229,7 +232,7 @@ export default class ApiResponse extends LitElement {
229
232
 
230
233
  mimeTypeDropdownTemplate(mimeTypes) {
231
234
  return html`
232
- <select @change="${(e) => { this.selectedMimeType = e.target.value; }}" style='margin-bottom: -1px; z-index:1'>
235
+ <select aria-label='mime types' @change="${(e) => { this.selectedMimeType = e.target.value; }}" style='margin-bottom: -1px; z-index:1'>
233
236
  ${mimeTypes.map((mimeType) => html`<option value='${mimeType}' ?selected = '${mimeType === this.selectedMimeType}'> ${mimeType} </option>`)}
234
237
  </select>`;
235
238
  }
@@ -270,7 +273,7 @@ export default class ApiResponse extends LitElement {
270
273
  }`
271
274
  : html`
272
275
  <span class = 'example-panel ${this.renderStyle === 'read' ? 'border pad-8-16' : 'border-top pad-top-8'}'>
273
- <select style="min-width:100px; max-width:100%" @change='${(e) => this.onSelectExample(e)}'>
276
+ <select aria-label='response examples' style="min-width:100px; max-width:100%" @change='${(e) => this.onSelectExample(e)}'>
274
277
  ${mimeRespDetails.examples.map((v) => html`<option value="${v.exampleId}" ?selected=${v.exampleId === mimeRespDetails.selectedExample} >
275
278
  ${v.exampleSummary.length > 80 ? v.exampleId : v.exampleSummary}
276
279
  </option>`)}
@@ -306,22 +309,20 @@ export default class ApiResponse extends LitElement {
306
309
  ${this.schemaStyle === 'table'
307
310
  ? html`
308
311
  <schema-table
309
- render-style = "${this.renderStyle}"
310
312
  .data = "${mimeRespDetails.schemaTree}"
311
313
  schema-expand-level = "${this.schemaExpandLevel}"
312
314
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
313
- allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
315
+ allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
314
316
  schema-hide-read-only = "${this.schemaHideReadOnly}"
315
317
  schema-hide-write-only = "${this.schemaHideWriteOnly}"
316
318
  exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
317
- > </schema-tree> `
319
+ > </schema-table> `
318
320
  : html`
319
321
  <schema-tree
320
- render-style = "${this.renderStyle}"
321
322
  .data = '${mimeRespDetails.schemaTree}'
322
323
  schema-expand-level = "${this.schemaExpandLevel}"
323
324
  schema-description-expanded = "${this.schemaDescriptionExpanded}"
324
- allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}",
325
+ allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
325
326
  schema-hide-read-only = "${this.schemaHideReadOnly}"
326
327
  schema-hide-write-only = "${this.schemaHideWriteOnly}"
327
328
  exportparts = "schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
@@ -22,6 +22,8 @@ export default class JsonTree extends LitElement {
22
22
  :host{
23
23
  display:flex;
24
24
  }
25
+ :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
26
+ :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
25
27
  .json-tree {
26
28
  position: relative;
27
29
  font-family: var(--font-mono);
@@ -31,6 +33,7 @@ export default class JsonTree extends LitElement {
31
33
  word-break: break-all;
32
34
  flex:1;
33
35
  line-height: calc(var(--font-size-small) + 6px);
36
+ min-height: 40px;
34
37
  direction: ltr;
35
38
  text-align: left;
36
39
  }
@@ -58,8 +61,9 @@ export default class JsonTree extends LitElement {
58
61
  .open-bracket.expanded:hover ~ .close-bracket {
59
62
  color:var(--primary-color);
60
63
  }
61
- .inside-bracket{
64
+ .inside-bracket {
62
65
  padding-left:12px;
66
+ overflow: hidden;
63
67
  border-left:1px dotted var(--border-color);
64
68
  }
65
69
  .open-bracket.collapsed + .inside-bracket,
@@ -87,11 +91,11 @@ export default class JsonTree extends LitElement {
87
91
  /* eslint-disable indent */
88
92
  render() {
89
93
  return html`
90
- <div class = "json-tree" >
94
+ <div class = "json-tree" @click='${(e) => { if (e.target.classList.contains('btn-copy')) { copyToClipboard(JSON.stringify(this.data, null, 2), e); } else { this.toggleExpand(e); } }}'>
91
95
  <div class='toolbar'>
92
- <button class="toolbar-btn" part="btn btn-fill btn-copy" @click='${(e) => { copyToClipboard(JSON.stringify(this.data, null, 2), e); }}'> Copy </button>
96
+ <button class="toolbar-btn btn-copy" part="btn btn-fill btn-copy"> Copy </button>
93
97
  </div>
94
- ${this.generateTree(this.data, true)}
98
+ ${this.generateTree(this.data, true)}
95
99
  </div>
96
100
  `;
97
101
  }
@@ -106,7 +110,7 @@ export default class JsonTree extends LitElement {
106
110
  return html`${(Array.isArray(data) ? '[ ],' : '{ },')}`;
107
111
  }
108
112
  return html`
109
- <div class="open-bracket expanded ${detailType === 'array' ? 'array' : 'object'} " @click="${this.toggleExpand}" > ${detailType === 'array' ? '[' : '{'}</div>
113
+ <div class="open-bracket expanded ${detailType === 'array' ? 'array' : 'object'}" > ${detailType === 'array' ? '[' : '{'}</div>
110
114
  <div class="inside-bracket">
111
115
  ${Object.keys(data).map((key, i, a) => html`
112
116
  <div class="item">
@@ -118,7 +122,6 @@ export default class JsonTree extends LitElement {
118
122
  <div class="close-bracket">${detailType === 'array' ? ']' : '}'}${isLast ? '' : ','}</div>
119
123
  `;
120
124
  }
121
-
122
125
  return (typeof data === 'string' || data instanceof Date)
123
126
  ? html`<span class="${typeof data}">"${data}"</span>${isLast ? '' : ','}`
124
127
  : html`<span class="${typeof data}">${data}</span>${isLast ? '' : ','}`;
@@ -127,12 +130,14 @@ export default class JsonTree extends LitElement {
127
130
 
128
131
  toggleExpand(e) {
129
132
  const openBracketEl = e.target;
130
- if (openBracketEl.classList.contains('expanded')) {
131
- openBracketEl.classList.replace('expanded', 'collapsed');
132
- e.target.innerHTML = e.target.classList.contains('array') ? '[...]' : '{...}';
133
- } else {
134
- openBracketEl.classList.replace('collapsed', 'expanded');
135
- e.target.innerHTML = e.target.classList.contains('array') ? '[' : '{';
133
+ if (e.target.classList.contains('open-bracket')) {
134
+ if (openBracketEl.classList.contains('expanded')) {
135
+ openBracketEl.classList.replace('expanded', 'collapsed');
136
+ e.target.innerHTML = e.target.classList.contains('array') ? '[...]' : '{...}';
137
+ } else {
138
+ openBracketEl.classList.replace('collapsed', 'expanded');
139
+ e.target.innerHTML = e.target.classList.contains('array') ? '[' : '{';
140
+ }
136
141
  }
137
142
  }
138
143
  }
@@ -46,6 +46,9 @@ export default class SchemaTable extends LitElement {
46
46
  .table .key {
47
47
  width: 240px;
48
48
  }
49
+ .key .key-label {
50
+ font-size: var(--font-size-mono);
51
+ }
49
52
  .key.deprecated .key-label {
50
53
  color: var(--red);
51
54
  }
@@ -54,8 +57,8 @@ export default class SchemaTable extends LitElement {
54
57
  white-space: normal;
55
58
  width: 150px;
56
59
  }
57
- .collapsed-descr .tr {
58
- max-height: calc(var(--font-size-small) + var(--font-size-small) + 4px);
60
+ .collapsed-all-descr .tr:not(.expanded-descr) {
61
+ max-height: calc(var(--font-size-small) + var(--font-size-small));
59
62
  }
60
63
 
61
64
  .obj-toggle {
@@ -86,23 +89,20 @@ export default class SchemaTable extends LitElement {
86
89
  /* eslint-disable indent */
87
90
  render() {
88
91
  return html`
89
- <div class="table ${this.schemaDescriptionExpanded === 'true' ? 'expanded-descr' : 'collapsed-descr'}">
92
+ <div class="table ${this.schemaDescriptionExpanded === 'true' ? 'expanded-all-descr' : 'collapsed-all-descr'}" @click="${(e) => this.handleAllEvents(e)}">
90
93
  <div class='toolbar'>
91
94
  <div class="toolbar-item schema-root-type ${this.data?.['::type'] || ''} "> ${this.data?.['::type'] || ''} </div>
92
95
  ${this.allowSchemaDescriptionExpandToggle === 'true'
93
96
  ? html`
94
97
  <div style="flex:1"></div>
95
- <div part="schema-multiline-toggle" class='toolbar-item' @click='${() => { this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true'); }}'>
98
+ <div part="schema-multiline-toggle" class='toolbar-item schema-multiline-toggle' >
96
99
  ${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}
97
100
  </div>
98
101
  `
99
102
  : ''
100
103
  }
101
104
  </div>
102
- ${this.data?.['::description']
103
- ? html`<span part="schema-description" class='m-markdown'> ${unsafeHTML(marked(this.data['::description'] || ''))}</span>`
104
- : ''
105
- }
105
+ <span part="schema-description" class='m-markdown'> ${unsafeHTML(marked(this.data?.['::description'] || ''))} </span>
106
106
  <div style = 'border:1px solid var(--light-border-color)'>
107
107
  <div style='display:flex; background-color: var(--bg2); padding:8px 4px; border-bottom:1px solid var(--light-border-color);'>
108
108
  <div class='key' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Field </div>
@@ -123,7 +123,7 @@ export default class SchemaTable extends LitElement {
123
123
  `;
124
124
  }
125
125
 
126
- generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '') {
126
+ generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '', isDeprecated = false) {
127
127
  if (this.schemaHideReadOnly === 'true') {
128
128
  if (dataType === 'array') {
129
129
  if (readOrWrite === 'readonly') {
@@ -198,15 +198,11 @@ export default class SchemaTable extends LitElement {
198
198
  return html`
199
199
  ${newSchemaLevel >= 0 && key
200
200
  ? html`
201
- <div class='tr ${newSchemaLevel <= this.schemaExpandLevel ? 'expanded' : 'collapsed'} ${data['::type']}' data-obj='${keyLabel}' title="${data['::deprecated'] ? 'Deprecated' : ''}">
202
- <div class="td key ${data['::deprecated'] ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
201
+ <div class='tr ${newSchemaLevel <= this.schemaExpandLevel ? 'expanded' : 'collapsed'} ${data['::type']}' data-obj='${keyLabel}' title="${isDeprecated || data['::deprecated'] ? 'Deprecated' : ''}">
202
+ <div class="td key ${isDeprecated || data['::deprecated'] ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
203
203
  ${(keyLabel || keyDescr)
204
204
  ? html`
205
- <span
206
- class='obj-toggle ${newSchemaLevel < this.schemaExpandLevel ? 'expanded' : 'collapsed'}'
207
- data-obj='${keyLabel}'
208
- @click= ${(e) => this.toggleObjectExpand(e, keyLabel)}
209
- >
205
+ <span class='obj-toggle ${newSchemaLevel < this.schemaExpandLevel ? 'expanded' : 'collapsed'}' data-obj='${keyLabel}'>
210
206
  ${schemaLevel < this.schemaExpandLevel ? '-' : '+'}
211
207
  </span>`
212
208
  : ''
@@ -214,8 +210,8 @@ export default class SchemaTable extends LitElement {
214
210
  ${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')
215
211
  ? html`<span class="xxx-of-key" style="margin-left:-6px">${keyLabel}</span><span class="${isOneOfLabel ? 'xxx-of-key' : 'xxx-of-descr'}">${keyDescr}</span>`
216
212
  : keyLabel.endsWith('*')
217
- ? html`<span class="key-label" style="display:inline-block; margin-left:-6px;">${data['::deprecated'] ? '✗' : ''} ${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>`
218
- : html`<span class="key-label" style="display:inline-block; margin-left:-6px;">${data['::deprecated'] ? '✗' : ''} ${keyLabel === '::props' ? '' : keyLabel}</span>`
213
+ ? html`<span class="key-label" style="display:inline-block; margin-left:-6px;">${isDeprecated || data['::deprecated'] ? '✗' : ''} ${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>`
214
+ : html`<span class="key-label" style="display:inline-block; margin-left:-6px;">${isDeprecated || data['::deprecated'] ? '✗' : ''} ${keyLabel === '::props' ? '' : keyLabel}</span>`
219
215
  }
220
216
  ${data['::type'] === 'xxx-of' && dataType === 'array' ? html`<span style="color:var(--primary-color)">ARRAY</span>` : ''}
221
217
  </div>
@@ -226,28 +222,27 @@ export default class SchemaTable extends LitElement {
226
222
  <div class='td key-descr m-markdown-small' style='line-height:1.7'>${unsafeHTML(marked(description || ''))}</div>
227
223
  </div>`
228
224
  : html`
229
- ${data['::type'] === 'array' && dataType === 'array'
230
- ? html`
231
- <div class='tr'>
232
- <div class='td key'></div>
233
- <div class='td key-type'>
234
- ${arrayType && arrayType !== 'object' ? `${dataType} of ${arrayType}` : dataType}
235
- </div>
236
- <div class='td key-descr'></div>
237
- </div>`
238
- : ''
239
- }
240
- `
225
+ ${data['::type'] === 'array' && dataType === 'array'
226
+ ? html`
227
+ <div class='tr'>
228
+ <div class='td key'></div>
229
+ <div class='td key-type'>
230
+ ${arrayType && arrayType !== 'object' ? `${dataType} of ${arrayType}` : dataType}
231
+ </div>
232
+ <div class='td key-descr'></div>
233
+ </div>`
234
+ : ''
235
+ }`
241
236
  }
242
237
  <div class='object-body'>
243
238
  ${Array.isArray(data) && data[0]
244
239
  ? html`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, '')}`
245
240
  : html`
246
241
  ${Object.keys(data).map((dataKey) => html`
247
- ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel'].includes(dataKey)
242
+ ${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel', '::nullable'].includes(dataKey)
248
243
  ? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object'
249
244
  ? html`${this.generateTree(
250
- data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],
245
+ data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],
251
246
  data[dataKey]['::type'],
252
247
  data[dataKey]['::array-type'] || '',
253
248
  dataKey,
@@ -262,10 +257,11 @@ export default class SchemaTable extends LitElement {
262
257
  data[dataKey]['::type'],
263
258
  data[dataKey]['::array-type'] || '',
264
259
  dataKey,
265
- data[dataKey]['::description'],
260
+ data[dataKey]?.['::description'] || '',
266
261
  newSchemaLevel,
267
262
  newIndentLevel,
268
263
  data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',
264
+ isDeprecated || data[dataKey]['::deprecated'],
269
265
  )}`
270
266
  }
271
267
  `)}
@@ -276,6 +272,7 @@ export default class SchemaTable extends LitElement {
276
272
  }
277
273
 
278
274
  // For Primitive Data types
275
+ // eslint-disable-next-line no-unused-vars
279
276
  const [type, readOrWriteOnly, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');
280
277
  if (readOrWriteOnly === '🆁' && this.schemaHideReadOnly === 'true') {
281
278
  return;
@@ -284,6 +281,7 @@ export default class SchemaTable extends LitElement {
284
281
  return;
285
282
  }
286
283
  const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();
284
+ const descrExpander = `${constraint || defaultValue || allowedValues || pattern ? '<span class="descr-expand-toggle">➔</span>' : ''}`;
287
285
  let dataTypeHtml = '';
288
286
  if (dataType === 'array') {
289
287
  dataTypeHtml = html`
@@ -297,9 +295,9 @@ export default class SchemaTable extends LitElement {
297
295
  </div>`;
298
296
  }
299
297
  return html`
300
- <div class = "tr primitive" title="${deprecated ? 'Deprecated' : ''}">
301
- <div class="td key ${deprecated}" style='padding-left:${leftPadding}px'>
302
- ${deprecated ? html`<span style='color:var(--red);'>✗</span>` : ''}
298
+ <div class = "tr primitive" title="${isDeprecated || deprecated ? 'Deprecated' : ''}">
299
+ <div class="td key ${isDeprecated || deprecated ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
300
+ ${isDeprecated || deprecated ? html`<span style='color:var(--red);'>✗</span>` : ''}
303
301
  ${keyLabel?.endsWith('*')
304
302
  ? html`
305
303
  <span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span>
@@ -310,21 +308,18 @@ export default class SchemaTable extends LitElement {
310
308
  }
311
309
  </div>
312
310
  ${dataTypeHtml}
313
- <div class='td key-descr' @click="${() => { this.schemaDescriptionExpanded = 'true'; }}">
314
- ${dataType === 'array' ? html`<span class="m-markdown-small">${unsafeHTML(marked(description))}</span>` : ''}
315
- ${schemaDescription
316
- ? html`<span class="m-markdown-small">
317
- ${unsafeHTML(marked(`${schemaTitle ? `**${schemaTitle}:**` : ''} ${schemaDescription} ${constraint || defaultValue || allowedValues || pattern ? '<span class="more-content">⤵</span>' : ''}`))}
318
- </span>`
319
- : schemaTitle
320
- ? html`${schemaTitle} ${constraint || defaultValue || allowedValues || pattern
321
- ? html`<span class="more-content">⤵</span>`
322
- : ''}`
323
- : ''
311
+ <div class='td key-descr' style='font-size: var(--font-size-small)'>
312
+ ${html`<span class="m-markdown-small">
313
+ ${unsafeHTML(marked(dataType === 'array'
314
+ ? `${descrExpander} ${description}`
315
+ : schemaTitle
316
+ ? `${descrExpander} <b>${schemaTitle}:</b> ${schemaDescription}`
317
+ : `${descrExpander} ${schemaDescription}`))}
318
+ </span>`
324
319
  }
325
- ${constraint ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Constraints: </span> ${constraint}</div>` : ''}
320
+ ${constraint ? html`<div class='' style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Constraints: </span> ${constraint}</div>` : ''}
326
321
  ${defaultValue ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Default: </span>${defaultValue}</div>` : ''}
327
- ${allowedValues ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Allowed: </span>${allowedValues}</div>` : ''}
322
+ ${allowedValues ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>${type === 'const' ? 'Value' : 'Allowed'}: </span>${allowedValues}</div>` : ''}
328
323
  ${pattern ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Pattern: </span>${pattern}</div>` : ''}
329
324
  </div>
330
325
  </div>
@@ -332,6 +327,20 @@ export default class SchemaTable extends LitElement {
332
327
  }
333
328
  /* eslint-enable indent */
334
329
 
330
+ handleAllEvents(e) {
331
+ if (e.target.classList.contains('obj-toggle')) {
332
+ this.toggleObjectExpand(e);
333
+ } else if (e.target.classList.contains('schema-multiline-toggle')) {
334
+ this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true');
335
+ } else if (e.target.classList.contains('descr-expand-toggle')) {
336
+ const trEl = e.target.closest('.tr');
337
+ if (trEl) {
338
+ trEl.classList.toggle('expanded-descr');
339
+ trEl.style.maxHeight = trEl.scrollHeight;
340
+ }
341
+ }
342
+ }
343
+
335
344
  toggleObjectExpand(e) {
336
345
  const rowEl = e.target.closest('.tr');
337
346
  if (rowEl.classList.contains('expanded')) {