rapidoc 9.3.8 → 10.0.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.
- package/README.md +193 -61
- package/dist/rapidoc-min.js +279 -3914
- package/package.json +23 -46
- package/.babelrc.json +0 -42
- package/.eslintrc +0 -53
- package/.github/FUNDING.yml +0 -13
- package/.github/workflow/words.yaml +0 -22
- package/CONTRIBUTING.md +0 -35
- package/dist/index.html +0 -1010
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js.LICENSE.txt +0 -64
- package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
- package/dist/rapidoc-min.js.gz +0 -0
- package/dist/rapidoc-min.js.map +0 -1
- package/dist/rapidoc-min.js.map.gz +0 -0
- package/dist/rapidoc.js +0 -21603
- package/dist/report.html +0 -39
- package/index-hashroute.html +0 -65
- package/index.html +0 -1045
- package/index_bak.html +0 -251
- package/jsconfig.json +0 -11
- package/logo.png +0 -0
- package/performance.html +0 -31
- package/src/components/api-request.js +0 -1793
- package/src/components/api-response.js +0 -335
- package/src/components/dialog-box.js +0 -73
- package/src/components/json-tree.js +0 -145
- package/src/components/schema-table.js +0 -367
- package/src/components/schema-tree.js +0 -381
- package/src/components/tag-input.js +0 -135
- package/src/index.js +0 -7
- package/src/json-schema-viewer.js +0 -346
- package/src/oauth-receiver.js +0 -56
- package/src/rapidoc-mini.js +0 -382
- package/src/rapidoc.js +0 -1083
- package/src/styles/border-styles.js +0 -24
- package/src/styles/custom-styles.js +0 -10
- package/src/styles/dialog-box-styles.js +0 -75
- package/src/styles/endpoint-styles.js +0 -202
- package/src/styles/flex-styles.js +0 -15
- package/src/styles/font-styles.js +0 -268
- package/src/styles/info-styles.js +0 -21
- package/src/styles/input-styles.js +0 -207
- package/src/styles/nav-styles.js +0 -198
- package/src/styles/prism-styles.js +0 -105
- package/src/styles/schema-styles.js +0 -121
- package/src/styles/tab-styles.js +0 -47
- package/src/styles/table-styles.js +0 -58
- package/src/templates/advance-search-template.js +0 -72
- package/src/templates/callback-template.js +0 -75
- package/src/templates/code-samples-template.js +0 -34
- package/src/templates/components-template.js +0 -76
- package/src/templates/endpoint-template.js +0 -251
- package/src/templates/expanded-endpoint-template.js +0 -199
- package/src/templates/focused-endpoint-template.js +0 -110
- package/src/templates/header-template.js +0 -66
- package/src/templates/json-schema-viewer-template.js +0 -185
- package/src/templates/logo-template.js +0 -18
- package/src/templates/main-body-template.js +0 -110
- package/src/templates/navbar-template.js +0 -272
- package/src/templates/overview-template.js +0 -79
- package/src/templates/security-scheme-template.js +0 -612
- package/src/templates/server-template.js +0 -115
- package/src/utils/color-utils.js +0 -59
- package/src/utils/common-utils.js +0 -168
- package/src/utils/schema-utils.js +0 -1086
- package/src/utils/spec-parser.js +0 -462
- package/src/utils/theme.js +0 -288
- package/webpack.config.js +0 -142
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; // eslint-disable-line import/extensions
|
|
3
|
-
import { marked } from 'marked';
|
|
4
|
-
import FontStyles from '~/styles/font-styles';
|
|
5
|
-
import SchemaStyles from '~/styles/schema-styles';
|
|
6
|
-
import CustomStyles from '~/styles/custom-styles';
|
|
7
|
-
|
|
8
|
-
export default class SchemaTable extends LitElement {
|
|
9
|
-
static get properties() {
|
|
10
|
-
return {
|
|
11
|
-
schemaExpandLevel: { type: Number, attribute: 'schema-expand-level' },
|
|
12
|
-
schemaDescriptionExpanded: { type: String, attribute: 'schema-description-expanded' },
|
|
13
|
-
allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },
|
|
14
|
-
schemaHideReadOnly: { type: String, attribute: 'schema-hide-read-only' },
|
|
15
|
-
schemaHideWriteOnly: { type: String, attribute: 'schema-hide-write-only' },
|
|
16
|
-
data: { type: Object },
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
connectedCallback() {
|
|
21
|
-
super.connectedCallback();
|
|
22
|
-
if (!this.schemaExpandLevel || this.schemaExpandLevel < 1) { this.schemaExpandLevel = 99999; }
|
|
23
|
-
if (!this.schemaDescriptionExpanded || !'true false'.includes(this.schemaDescriptionExpanded)) { this.schemaDescriptionExpanded = 'false'; }
|
|
24
|
-
if (!this.schemaHideReadOnly || !'true false'.includes(this.schemaHideReadOnly)) { this.schemaHideReadOnly = 'true'; }
|
|
25
|
-
if (!this.schemaHideWriteOnly || !'true false'.includes(this.schemaHideWriteOnly)) { this.schemaHideWriteOnly = 'true'; }
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return [
|
|
30
|
-
FontStyles,
|
|
31
|
-
SchemaStyles,
|
|
32
|
-
css`
|
|
33
|
-
.table {
|
|
34
|
-
font-size: var(--font-size-small);
|
|
35
|
-
text-align: left;
|
|
36
|
-
line-height: calc(var(--font-size-small) + 6px);
|
|
37
|
-
}
|
|
38
|
-
.table .tr {
|
|
39
|
-
width: calc(100% - 5px);
|
|
40
|
-
padding: 0 0 0 5px;
|
|
41
|
-
border-bottom: 1px dotted var(--light-border-color);
|
|
42
|
-
}
|
|
43
|
-
.table .td {
|
|
44
|
-
padding: 4px 0;
|
|
45
|
-
}
|
|
46
|
-
.table .key {
|
|
47
|
-
width: 240px;
|
|
48
|
-
}
|
|
49
|
-
.key .key-label {
|
|
50
|
-
font-size: var(--font-size-mono);
|
|
51
|
-
}
|
|
52
|
-
.key.deprecated .key-label {
|
|
53
|
-
color: var(--red);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.table .key-type {
|
|
57
|
-
white-space: normal;
|
|
58
|
-
width: 150px;
|
|
59
|
-
}
|
|
60
|
-
.collapsed-all-descr .tr:not(.expanded-descr) {
|
|
61
|
-
max-height: calc(var(--font-size-small) + var(--font-size-small));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.obj-toggle {
|
|
65
|
-
padding: 0 2px;
|
|
66
|
-
border-radius:2px;
|
|
67
|
-
border: 1px solid transparent;
|
|
68
|
-
display: inline-block;
|
|
69
|
-
margin-left: -16px;
|
|
70
|
-
color:var(--primary-color);
|
|
71
|
-
cursor:pointer;
|
|
72
|
-
font-size: calc(var(--font-size-small) + 4px);
|
|
73
|
-
font-family: var(--font-mono);
|
|
74
|
-
background-clip: border-box;
|
|
75
|
-
}
|
|
76
|
-
.obj-toggle:hover {
|
|
77
|
-
border-color: var(--primary-color);
|
|
78
|
-
}
|
|
79
|
-
.tr.expanded + .object-body {
|
|
80
|
-
display:block;
|
|
81
|
-
}
|
|
82
|
-
.tr.collapsed + .object-body {
|
|
83
|
-
display:none;
|
|
84
|
-
}`,
|
|
85
|
-
CustomStyles,
|
|
86
|
-
];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/* eslint-disable indent */
|
|
90
|
-
render() {
|
|
91
|
-
return html`
|
|
92
|
-
<div class="table ${this.schemaDescriptionExpanded === 'true' ? 'expanded-all-descr' : 'collapsed-all-descr'}" @click="${(e) => this.handleAllEvents(e)}">
|
|
93
|
-
<div class='toolbar'>
|
|
94
|
-
<div class="toolbar-item schema-root-type ${this.data?.['::type'] || ''} "> ${this.data?.['::type'] || ''} </div>
|
|
95
|
-
${this.allowSchemaDescriptionExpandToggle === 'true'
|
|
96
|
-
? html`
|
|
97
|
-
<div style="flex:1"></div>
|
|
98
|
-
<div part="schema-multiline-toggle" class='toolbar-item schema-multiline-toggle' >
|
|
99
|
-
${this.schemaDescriptionExpanded === 'true' ? 'Single line description' : 'Multiline description'}
|
|
100
|
-
</div>
|
|
101
|
-
`
|
|
102
|
-
: ''
|
|
103
|
-
}
|
|
104
|
-
</div>
|
|
105
|
-
<span part="schema-description" class='m-markdown'> ${unsafeHTML(marked(this.data?.['::description'] || ''))} </span>
|
|
106
|
-
<div style = 'border:1px solid var(--light-border-color)'>
|
|
107
|
-
<div style='display:flex; background-color: var(--bg2); padding:8px 4px; border-bottom:1px solid var(--light-border-color);'>
|
|
108
|
-
<div class='key' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Field </div>
|
|
109
|
-
<div class='key-type' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Type </div>
|
|
110
|
-
<div class='key-descr' style='font-family:var(--font-regular); font-weight:bold; color:var(--fg);'> Description </div>
|
|
111
|
-
</div>
|
|
112
|
-
${this.data
|
|
113
|
-
? html`
|
|
114
|
-
${this.generateTree(
|
|
115
|
-
this.data['::type'] === 'array' ? this.data['::props'] : this.data,
|
|
116
|
-
this.data['::type'],
|
|
117
|
-
this.data['::array-type'],
|
|
118
|
-
)}`
|
|
119
|
-
: ''
|
|
120
|
-
}
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
`;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '', isDeprecated = false) {
|
|
127
|
-
if (this.schemaHideReadOnly === 'true') {
|
|
128
|
-
if (dataType === 'array') {
|
|
129
|
-
if (readOrWrite === 'readonly') {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (data && data['::readwrite'] === 'readonly') {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (this.schemaHideWriteOnly === 'true') {
|
|
138
|
-
if (dataType === 'array') {
|
|
139
|
-
if (readOrWrite === 'writeonly') {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (data && data['::readwrite'] === 'writeonly') {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (!data) {
|
|
148
|
-
return html`<div class="null" style="display:inline;">
|
|
149
|
-
<span style='margin-left:${(schemaLevel + 1) * 16}px'> </span>
|
|
150
|
-
<span class="key-label xxx-of-key"> ${key.replace('::OPTION~', '')}</span>
|
|
151
|
-
${
|
|
152
|
-
dataType === 'array'
|
|
153
|
-
? html`<span class='mono-font'> [ ] </span>`
|
|
154
|
-
: dataType === 'object'
|
|
155
|
-
? html`<span class='mono-font'> { } </span>`
|
|
156
|
-
: html`<span class='mono-font'> schema undefined </span>`
|
|
157
|
-
}
|
|
158
|
-
</div>`;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const newSchemaLevel = data['::type']?.startsWith('xxx-of') ? schemaLevel : (schemaLevel + 1);
|
|
162
|
-
const newIndentLevel = dataType === 'xxx-of-option' || data['::type'] === 'xxx-of-option' || key.startsWith('::OPTION') ? indentLevel : (indentLevel + 1);
|
|
163
|
-
const leftPadding = 16 * newIndentLevel; // 2 space indentation at each level
|
|
164
|
-
if (Object.keys(data).length === 0) {
|
|
165
|
-
return html`<span class="td key object" style='padding-left:${leftPadding}px'>${key}</span>`;
|
|
166
|
-
}
|
|
167
|
-
let keyLabel = '';
|
|
168
|
-
let keyDescr = '';
|
|
169
|
-
let isOneOfLabel = false;
|
|
170
|
-
if (key.startsWith('::ONE~OF') || key.startsWith('::ANY~OF')) {
|
|
171
|
-
keyLabel = key.replace('::', '').replace('~', ' ');
|
|
172
|
-
isOneOfLabel = true;
|
|
173
|
-
} else if (key.startsWith('::OPTION')) {
|
|
174
|
-
const parts = key.split('~');
|
|
175
|
-
keyLabel = parts[1]; // eslint-disable-line prefer-destructuring
|
|
176
|
-
keyDescr = parts[2]; // eslint-disable-line prefer-destructuring
|
|
177
|
-
} else {
|
|
178
|
-
keyLabel = key;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
let detailObjType = '';
|
|
182
|
-
if (data['::type'] === 'object') {
|
|
183
|
-
if (dataType === 'array') {
|
|
184
|
-
detailObjType = 'array of object'; // Array of Object
|
|
185
|
-
} else {
|
|
186
|
-
detailObjType = data['::dataTypeLabel'] || data['::type'];
|
|
187
|
-
}
|
|
188
|
-
} else if (data['::type'] === 'array') {
|
|
189
|
-
if (dataType === 'array') {
|
|
190
|
-
// detailObjType = 'array of array'; // Array of array
|
|
191
|
-
detailObjType = `array of array ${arrayType !== 'object' ? `of ${arrayType}` : ''}`; // Array of array
|
|
192
|
-
} else {
|
|
193
|
-
detailObjType = data['::dataTypeLabel'] || data['::type'];
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (typeof data === 'object') {
|
|
198
|
-
return html`
|
|
199
|
-
${newSchemaLevel >= 0 && key
|
|
200
|
-
? html`
|
|
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
|
-
${(keyLabel || keyDescr)
|
|
204
|
-
? html`
|
|
205
|
-
<span class='obj-toggle ${newSchemaLevel < this.schemaExpandLevel ? 'expanded' : 'collapsed'}' data-obj='${keyLabel}'>
|
|
206
|
-
${schemaLevel < this.schemaExpandLevel ? '-' : '+'}
|
|
207
|
-
</span>`
|
|
208
|
-
: ''
|
|
209
|
-
}
|
|
210
|
-
${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')
|
|
211
|
-
? html`<span class="xxx-of-key" style="margin-left:-6px">${keyLabel}</span><span class="${isOneOfLabel ? 'xxx-of-key' : 'xxx-of-descr'}">${keyDescr}</span>`
|
|
212
|
-
: keyLabel.endsWith('*')
|
|
213
|
-
? html`<span class="key-label" style="display:inline-block; margin-left:-6px;">${(isDeprecated || data['::deprecated'])
|
|
214
|
-
? html`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>`
|
|
215
|
-
: ''
|
|
216
|
-
} ${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>`
|
|
217
|
-
: html`<span class="key-label" style="display:inline-block; margin-left:-6px;">${(isDeprecated || data['::deprecated'])
|
|
218
|
-
? html`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>`
|
|
219
|
-
: ''
|
|
220
|
-
} ${keyLabel === '::props' ? '' : keyLabel}</span>`
|
|
221
|
-
}
|
|
222
|
-
${data['::type'] === 'xxx-of' && dataType === 'array' ? html`<span style="color:var(--primary-color)">ARRAY</span>` : ''}
|
|
223
|
-
</div>
|
|
224
|
-
<div class='td key-type' title="${data['::readwrite'] === 'readonly' ? 'Read-Only' : data['::readwrite'] === 'writeonly' ? 'Write-Only' : ''}">
|
|
225
|
-
${(data['::type'] || '').includes('xxx-of') ? '' : detailObjType}
|
|
226
|
-
${data['::readwrite'] === 'readonly' ? ' 🆁' : data['::readwrite'] === 'writeonly' ? ' 🆆' : ''}
|
|
227
|
-
</div>
|
|
228
|
-
<div class='td key-descr m-markdown-small' style='line-height:1.7'>${unsafeHTML(marked(description || ''))}</div>
|
|
229
|
-
</div>`
|
|
230
|
-
: html`
|
|
231
|
-
${data['::type'] === 'array' && dataType === 'array'
|
|
232
|
-
? html`
|
|
233
|
-
<div class='tr'>
|
|
234
|
-
<div class='td key'></div>
|
|
235
|
-
<div class='td key-type'>
|
|
236
|
-
${arrayType && arrayType !== 'object' ? `${dataType} of ${arrayType}` : dataType}
|
|
237
|
-
</div>
|
|
238
|
-
<div class='td key-descr'></div>
|
|
239
|
-
</div>`
|
|
240
|
-
: ''
|
|
241
|
-
}`
|
|
242
|
-
}
|
|
243
|
-
<div class='object-body'>
|
|
244
|
-
${Array.isArray(data) && data[0]
|
|
245
|
-
? html`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, '')}`
|
|
246
|
-
: html`
|
|
247
|
-
${Object.keys(data).map((dataKey) => html`
|
|
248
|
-
${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel', '::nullable'].includes(dataKey)
|
|
249
|
-
? data[dataKey]['::type'] === 'array' || data[dataKey]['::type'] === 'object'
|
|
250
|
-
? html`${this.generateTree(
|
|
251
|
-
data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],
|
|
252
|
-
data[dataKey]['::type'],
|
|
253
|
-
data[dataKey]['::array-type'] || '',
|
|
254
|
-
dataKey,
|
|
255
|
-
data[dataKey]['::description'],
|
|
256
|
-
newSchemaLevel,
|
|
257
|
-
newIndentLevel,
|
|
258
|
-
data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',
|
|
259
|
-
(isDeprecated || data[dataKey]['::deprecated']),
|
|
260
|
-
)}`
|
|
261
|
-
: ''
|
|
262
|
-
: html`${this.generateTree(
|
|
263
|
-
data[dataKey]['::type'] === 'array' ? data[dataKey]['::props'] : data[dataKey],
|
|
264
|
-
data[dataKey]['::type'],
|
|
265
|
-
data[dataKey]['::array-type'] || '',
|
|
266
|
-
dataKey,
|
|
267
|
-
data[dataKey]?.['::description'] || '',
|
|
268
|
-
newSchemaLevel,
|
|
269
|
-
newIndentLevel,
|
|
270
|
-
data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',
|
|
271
|
-
(isDeprecated || data[dataKey]['::deprecated']),
|
|
272
|
-
)}`
|
|
273
|
-
}
|
|
274
|
-
`)}
|
|
275
|
-
`
|
|
276
|
-
}
|
|
277
|
-
</div>
|
|
278
|
-
`;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// For Primitive Data types
|
|
282
|
-
// eslint-disable-next-line no-unused-vars
|
|
283
|
-
const [type, readOrWriteOnly, constraint, defaultValue, allowedValues, pattern, schemaDescription, schemaTitle, deprecated] = data.split('~|~');
|
|
284
|
-
if (readOrWriteOnly === '🆁' && this.schemaHideReadOnly === 'true') {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
if (readOrWriteOnly === '🆆' && this.schemaHideWriteOnly === 'true') {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
const dataTypeCss = type.replace(/┃.*/g, '').replace(/[^a-zA-Z0-9+]/g, '').substring(0, 4).toLowerCase();
|
|
291
|
-
const descrExpander = `${constraint || defaultValue || allowedValues || pattern ? '<span class="descr-expand-toggle">➔</span>' : ''}`;
|
|
292
|
-
let dataTypeHtml = '';
|
|
293
|
-
if (dataType === 'array') {
|
|
294
|
-
dataTypeHtml = html`
|
|
295
|
-
<div class='td key-type ${dataTypeCss}' title="${readOrWrite === 'readonly' ? 'Read-Only' : readOrWriteOnly === 'writeonly' ? 'Write-Only' : ''}">
|
|
296
|
-
[${type}] ${readOrWrite === 'readonly' ? '🆁' : readOrWrite === 'writeonly' ? '🆆' : ''}
|
|
297
|
-
</div>`;
|
|
298
|
-
} else {
|
|
299
|
-
dataTypeHtml = html`
|
|
300
|
-
<div class='td key-type ${dataTypeCss}' title="${readOrWriteOnly === '🆁' ? 'Read-Only' : readOrWriteOnly === '🆆' ? 'Write-Only' : ''}">
|
|
301
|
-
${type} ${readOrWriteOnly}
|
|
302
|
-
</div>`;
|
|
303
|
-
}
|
|
304
|
-
return html`
|
|
305
|
-
<div class = "tr primitive" title="${isDeprecated || deprecated ? 'Deprecated' : ''}">
|
|
306
|
-
<div class="td key ${isDeprecated || deprecated ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
|
|
307
|
-
${isDeprecated || deprecated
|
|
308
|
-
? html`<svg viewBox="0 0 10 10" width="10" height="10" style="stroke:var(--red); margin-right:-6px"><path d="M2 2L8 8M2 8L8 2"/></svg>`
|
|
309
|
-
: ''
|
|
310
|
-
}
|
|
311
|
-
${keyLabel?.endsWith('*')
|
|
312
|
-
? html`
|
|
313
|
-
<span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span>
|
|
314
|
-
<span style='color:var(--red);'>*</span>`
|
|
315
|
-
: key.startsWith('::OPTION')
|
|
316
|
-
? html`<span class='xxx-of-key'>${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>`
|
|
317
|
-
: html`${keyLabel ? html`<span class="key-label"> ${keyLabel}</span>` : html`<span class="xxx-of-descr">${schemaTitle}</span>`}`
|
|
318
|
-
}
|
|
319
|
-
</div>
|
|
320
|
-
${dataTypeHtml}
|
|
321
|
-
<div class='td key-descr' style='font-size: var(--font-size-small)'>
|
|
322
|
-
${html`<span class="m-markdown-small">
|
|
323
|
-
${unsafeHTML(marked(dataType === 'array'
|
|
324
|
-
? `${descrExpander} ${description}`
|
|
325
|
-
: schemaTitle
|
|
326
|
-
? `${descrExpander} <b>${schemaTitle}:</b> ${schemaDescription}`
|
|
327
|
-
: `${descrExpander} ${schemaDescription}`))}
|
|
328
|
-
</span>`
|
|
329
|
-
}
|
|
330
|
-
${constraint ? html`<div class='' style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Constraints: </span> ${constraint}</div>` : ''}
|
|
331
|
-
${defaultValue ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Default: </span>${defaultValue}</div>` : ''}
|
|
332
|
-
${allowedValues ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>${type === 'const' ? 'Value' : 'Allowed'}: </span>${allowedValues}</div>` : ''}
|
|
333
|
-
${pattern ? html`<div style='display:inline-block; line-break:anywhere; margin-right:8px;'> <span class='bold-text'>Pattern: </span>${pattern}</div>` : ''}
|
|
334
|
-
</div>
|
|
335
|
-
</div>
|
|
336
|
-
`;
|
|
337
|
-
}
|
|
338
|
-
/* eslint-enable indent */
|
|
339
|
-
|
|
340
|
-
handleAllEvents(e) {
|
|
341
|
-
if (e.target.classList.contains('obj-toggle')) {
|
|
342
|
-
this.toggleObjectExpand(e);
|
|
343
|
-
} else if (e.target.classList.contains('schema-multiline-toggle')) {
|
|
344
|
-
this.schemaDescriptionExpanded = (this.schemaDescriptionExpanded === 'true' ? 'false' : 'true');
|
|
345
|
-
} else if (e.target.classList.contains('descr-expand-toggle')) {
|
|
346
|
-
const trEl = e.target.closest('.tr');
|
|
347
|
-
if (trEl) {
|
|
348
|
-
trEl.classList.toggle('expanded-descr');
|
|
349
|
-
trEl.style.maxHeight = trEl.scrollHeight;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
toggleObjectExpand(e) {
|
|
355
|
-
const rowEl = e.target.closest('.tr');
|
|
356
|
-
if (rowEl.classList.contains('expanded')) {
|
|
357
|
-
rowEl.classList.add('collapsed');
|
|
358
|
-
rowEl.classList.remove('expanded');
|
|
359
|
-
e.target.innerText = '+';
|
|
360
|
-
} else {
|
|
361
|
-
rowEl.classList.remove('collapsed');
|
|
362
|
-
rowEl.classList.add('expanded');
|
|
363
|
-
e.target.innerText = '-';
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
customElements.define('schema-table', SchemaTable);
|