rapidoc 9.3.6 → 9.3.7
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/.eslintrc +9 -1
- package/dist/index.html +1 -1
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js +390 -376
- package/dist/rapidoc-min.js.LICENSE.txt +1 -8
- package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
- package/dist/rapidoc-min.js.gz +0 -0
- package/dist/rapidoc-min.js.map +1 -1
- package/dist/rapidoc-min.js.map.gz +0 -0
- package/dist/rapidoc.js +436 -242
- package/dist/report.html +2 -2
- package/index.html +5 -4
- package/package.json +2 -2
- package/src/components/api-request.js +115 -77
- package/src/components/api-response.js +6 -7
- package/src/components/schema-table.js +6 -5
- package/src/components/schema-tree.js +9 -7
- package/src/json-schema-viewer.js +6 -2
- package/src/rapidoc-mini.js +20 -4
- package/src/rapidoc.js +33 -18
- package/src/styles/border-styles.js +2 -2
- package/src/styles/endpoint-styles.js +13 -10
- package/src/styles/flex-styles.js +1 -1
- package/src/styles/font-styles.js +13 -13
- package/src/styles/input-styles.js +2 -2
- package/src/styles/nav-styles.js +1 -1
- package/src/styles/schema-styles.js +12 -9
- package/src/templates/advance-search-template.js +2 -1
- package/src/templates/endpoint-template.js +29 -26
- package/src/templates/expanded-endpoint-template.js +4 -2
- package/src/templates/json-schema-viewer-template.js +3 -3
- package/src/templates/main-body-template.js +2 -2
- package/src/templates/navbar-template.js +6 -6
- package/src/templates/security-scheme-template.js +9 -7
- package/src/utils/common-utils.js +5 -9
- package/src/utils/schema-utils.js +65 -16
- package/src/utils/spec-parser.js +77 -7
- package/src/utils/theme.js +4 -6
|
@@ -199,7 +199,7 @@ export default class SchemaTable extends LitElement {
|
|
|
199
199
|
${newSchemaLevel >= 0 && key
|
|
200
200
|
? html`
|
|
201
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'>
|
|
202
|
+
<div class="td key ${(isDeprecated || data['::deprecated']) ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
|
|
203
203
|
${(keyLabel || keyDescr)
|
|
204
204
|
? html`
|
|
205
205
|
<span class='obj-toggle ${newSchemaLevel < this.schemaExpandLevel ? 'expanded' : 'collapsed'}' data-obj='${keyLabel}'>
|
|
@@ -210,8 +210,8 @@ export default class SchemaTable extends LitElement {
|
|
|
210
210
|
${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')
|
|
211
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
212
|
: keyLabel.endsWith('*')
|
|
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>`
|
|
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>`
|
|
215
215
|
}
|
|
216
216
|
${data['::type'] === 'xxx-of' && dataType === 'array' ? html`<span style="color:var(--primary-color)">ARRAY</span>` : ''}
|
|
217
217
|
</div>
|
|
@@ -250,6 +250,7 @@ export default class SchemaTable extends LitElement {
|
|
|
250
250
|
newSchemaLevel,
|
|
251
251
|
newIndentLevel,
|
|
252
252
|
data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',
|
|
253
|
+
(isDeprecated || data[dataKey]['::deprecated']),
|
|
253
254
|
)}`
|
|
254
255
|
: ''
|
|
255
256
|
: html`${this.generateTree(
|
|
@@ -261,13 +262,13 @@ export default class SchemaTable extends LitElement {
|
|
|
261
262
|
newSchemaLevel,
|
|
262
263
|
newIndentLevel,
|
|
263
264
|
data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',
|
|
264
|
-
isDeprecated || data[dataKey]['::deprecated'],
|
|
265
|
+
(isDeprecated || data[dataKey]['::deprecated']),
|
|
265
266
|
)}`
|
|
266
267
|
}
|
|
267
268
|
`)}
|
|
268
269
|
`
|
|
269
270
|
}
|
|
270
|
-
|
|
271
|
+
</div>
|
|
271
272
|
`;
|
|
272
273
|
}
|
|
273
274
|
|
|
@@ -121,7 +121,7 @@ export default class SchemaTree extends LitElement {
|
|
|
121
121
|
`;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '') {
|
|
124
|
+
generateTree(data, dataType = 'object', arrayType = '', key = '', description = '', schemaLevel = 0, indentLevel = 0, readOrWrite = '', isDeprecated = false) {
|
|
125
125
|
if (this.schemaHideReadOnly === 'true') {
|
|
126
126
|
if (dataType === 'array') {
|
|
127
127
|
if (readOrWrite === 'readonly') {
|
|
@@ -212,15 +212,15 @@ export default class SchemaTree extends LitElement {
|
|
|
212
212
|
}
|
|
213
213
|
if (typeof data === 'object') {
|
|
214
214
|
return html`
|
|
215
|
-
<div class="tr ${schemaLevel < this.schemaExpandLevel || data['::type']?.startsWith('xxx-of') ? 'expanded' : 'collapsed'} ${data['::type'] || 'no-type-info'}${data['::nullable'] ? ' nullable' : ''}" title="${data['::deprecated'] ? 'Deprecated' : ''}">
|
|
216
|
-
<div class="td key ${data['::deprecated'] ? 'deprecated' : ''}" style='min-width:${minFieldColWidth}px'>
|
|
215
|
+
<div class="tr ${schemaLevel < this.schemaExpandLevel || data['::type']?.startsWith('xxx-of') ? 'expanded' : 'collapsed'} ${data['::type'] || 'no-type-info'}${data['::nullable'] ? ' nullable' : ''}" title="${(isDeprecated || data['::deprecated']) ? 'Deprecated' : ''}">
|
|
216
|
+
<div class="td key ${(isDeprecated || data['::deprecated']) ? 'deprecated' : ''}" style='min-width:${minFieldColWidth}px'>
|
|
217
217
|
${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' || key.startsWith('::OPTION')
|
|
218
218
|
? html`<span class='key-label xxx-of-key'> ${keyLabel}</span><span class="xxx-of-descr">${keyDescr}</span>`
|
|
219
219
|
: keyLabel === '::props' || keyLabel === '::ARRAY~OF'
|
|
220
220
|
? ''
|
|
221
221
|
: schemaLevel > 0
|
|
222
222
|
? html`<span class="key-label" title="${readOrWrite === 'readonly' ? 'Read-Only' : readOrWrite === 'writeonly' ? 'Write-Only' : ''}">
|
|
223
|
-
${data['::deprecated'] ? '✗' : ''}
|
|
223
|
+
${(isDeprecated || data['::deprecated']) ? '✗' : ''}
|
|
224
224
|
${keyLabel.replace(/\*$/, '')}${keyLabel.endsWith('*') ? html`<span style="color:var(--red)">*</span>` : ''}${readOrWrite === 'readonly' ? html` 🆁` : readOrWrite === 'writeonly' ? html` 🆆` : readOrWrite}:
|
|
225
225
|
</span>`
|
|
226
226
|
: ''
|
|
@@ -231,7 +231,7 @@ export default class SchemaTree extends LitElement {
|
|
|
231
231
|
</div>
|
|
232
232
|
<div class='inside-bracket ${data['::type'] || 'no-type-info'}' style='padding-left:${data['::type'] === 'xxx-of-option' || data['::type'] === 'xxx-of-array' ? 0 : leftPadding}px;'>
|
|
233
233
|
${Array.isArray(data) && data[0]
|
|
234
|
-
? html`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, data[0]['::readwrite'])}`
|
|
234
|
+
? html`${this.generateTree(data[0], 'xxx-of-option', '', '::ARRAY~OF', '', newSchemaLevel, newIndentLevel, data[0]['::readwrite'], (isDeprecated || data[0]['::deprecated']))}`
|
|
235
235
|
: html`
|
|
236
236
|
${Object.keys(data).map((dataKey) => html`
|
|
237
237
|
${['::title', '::description', '::type', '::props', '::deprecated', '::array-type', '::readwrite', '::dataTypeLabel', '::nullable'].includes(dataKey)
|
|
@@ -245,6 +245,7 @@ export default class SchemaTree extends LitElement {
|
|
|
245
245
|
newSchemaLevel,
|
|
246
246
|
newIndentLevel,
|
|
247
247
|
data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',
|
|
248
|
+
(isDeprecated || data[dataKey]['::deprecated']),
|
|
248
249
|
)}`
|
|
249
250
|
: ''
|
|
250
251
|
: html`${this.generateTree(
|
|
@@ -256,6 +257,7 @@ export default class SchemaTree extends LitElement {
|
|
|
256
257
|
newSchemaLevel,
|
|
257
258
|
newIndentLevel,
|
|
258
259
|
data[dataKey]['::readwrite'] ? data[dataKey]['::readwrite'] : '',
|
|
260
|
+
(isDeprecated || data[dataKey]['::deprecated']),
|
|
259
261
|
)}`
|
|
260
262
|
}
|
|
261
263
|
`)}
|
|
@@ -300,8 +302,8 @@ export default class SchemaTree extends LitElement {
|
|
|
300
302
|
|
|
301
303
|
return html`
|
|
302
304
|
<div class = "tr primitive" title="${deprecated ? 'Deprecated' : ''}">
|
|
303
|
-
<div class="td key ${deprecated}" style='min-width:${minFieldColWidth}px'>
|
|
304
|
-
${deprecated ? html`<span style='color:var(--red);'>✗</span>` : ''}
|
|
305
|
+
<div class="td key ${isDeprecated || deprecated}" style='min-width:${minFieldColWidth}px'>
|
|
306
|
+
${isDeprecated || deprecated ? html`<span style='color:var(--red);'>✗</span>` : ''}
|
|
305
307
|
${keyLabel.endsWith('*')
|
|
306
308
|
? html`<span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>:`
|
|
307
309
|
: key.startsWith('::OPTION')
|
|
@@ -98,6 +98,7 @@ export default class JsonSchemaViewer extends LitElement {
|
|
|
98
98
|
color:var(--fg);
|
|
99
99
|
background-color:var(--bg);
|
|
100
100
|
font-family:var(--font-regular);
|
|
101
|
+
container-type: inline-size;
|
|
101
102
|
}
|
|
102
103
|
.body {
|
|
103
104
|
display:flex;
|
|
@@ -163,11 +164,11 @@ export default class JsonSchemaViewer extends LitElement {
|
|
|
163
164
|
height: 36px;
|
|
164
165
|
animation: spin 2s linear infinite;
|
|
165
166
|
}
|
|
166
|
-
@
|
|
167
|
+
@container (min-width: 768px) {
|
|
167
168
|
.only-large-screen{
|
|
168
169
|
display:block;
|
|
169
170
|
}
|
|
170
|
-
.only-large-screen-flex{
|
|
171
|
+
.only-large-screen-flex {
|
|
171
172
|
display:flex;
|
|
172
173
|
}
|
|
173
174
|
}`,
|
|
@@ -289,6 +290,9 @@ export default class JsonSchemaViewer extends LitElement {
|
|
|
289
290
|
this.sortTags === 'true',
|
|
290
291
|
this.sortSchemas === 'true',
|
|
291
292
|
this.getAttribute('sort-endpoints-by'),
|
|
293
|
+
this.getAttribute('match-paths'),
|
|
294
|
+
this.getAttribute('match-type'),
|
|
295
|
+
this.getAttribute('remove-endpoints-with-badge-label-as'),
|
|
292
296
|
);
|
|
293
297
|
this.loading = false;
|
|
294
298
|
this.afterSpecParsedAndValidated(spec);
|
package/src/rapidoc-mini.js
CHANGED
|
@@ -84,6 +84,7 @@ export default class RapiDocMini extends LitElement {
|
|
|
84
84
|
// Filters
|
|
85
85
|
matchPaths: { type: String, attribute: 'match-paths' },
|
|
86
86
|
matchType: { type: String, attribute: 'match-type' },
|
|
87
|
+
removeEndpointsWithBadgeLabelAs: { type: String, attribute: 'remove-endpoints-with-badge-label-as' },
|
|
87
88
|
|
|
88
89
|
// Internal Properties
|
|
89
90
|
loading: { type: Boolean }, // indicates spec is being loaded
|
|
@@ -115,13 +116,14 @@ export default class RapiDocMini extends LitElement {
|
|
|
115
116
|
color:var(--fg);
|
|
116
117
|
background-color:var(--bg);
|
|
117
118
|
font-family:var(--font-regular);
|
|
119
|
+
container-type: inline-size;
|
|
118
120
|
}
|
|
119
121
|
|
|
120
|
-
@
|
|
121
|
-
.only-large-screen{
|
|
122
|
+
@container (min-width: 768px) {
|
|
123
|
+
.only-large-screen {
|
|
122
124
|
display:block;
|
|
123
125
|
}
|
|
124
|
-
.only-large-screen-flex{
|
|
126
|
+
.only-large-screen-flex {
|
|
125
127
|
display:flex;
|
|
126
128
|
}
|
|
127
129
|
}`,
|
|
@@ -181,7 +183,10 @@ export default class RapiDocMini extends LitElement {
|
|
|
181
183
|
if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) { this.sortTags = 'false'; }
|
|
182
184
|
if (!this.sortEndpointsBy || !'method, path, summary,'.includes(`${this.sortEndpointsBy},`)) { this.sortEndpointsBy = 'path'; }
|
|
183
185
|
if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }
|
|
186
|
+
|
|
184
187
|
if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }
|
|
188
|
+
if (!this.matchPaths) { this.matchPaths = ''; }
|
|
189
|
+
if (!this.removeEndpointsWithBadgeLabelAs) { this.removeEndpointsWithBadgeLabelAs = ''; }
|
|
185
190
|
|
|
186
191
|
if (!this.allowSchemaDescriptionExpandToggle || !'true, false,'.includes(`${this.allowSchemaDescriptionExpandToggle},`)) { this.allowSchemaDescriptionExpandToggle = 'true'; }
|
|
187
192
|
if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) { this.fetchCredentials = ''; }
|
|
@@ -197,7 +202,7 @@ export default class RapiDocMini extends LitElement {
|
|
|
197
202
|
}
|
|
198
203
|
|
|
199
204
|
render() {
|
|
200
|
-
return mainBodyTemplate.call(this, true,
|
|
205
|
+
return mainBodyTemplate.call(this, true, this.pathsExpanded);
|
|
201
206
|
}
|
|
202
207
|
|
|
203
208
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
@@ -209,6 +214,13 @@ export default class RapiDocMini extends LitElement {
|
|
|
209
214
|
}, 0);
|
|
210
215
|
}
|
|
211
216
|
}
|
|
217
|
+
if (name === 'match-paths' || name === 'match-type' || name === 'remove-endpoints-with-badge-label-as') {
|
|
218
|
+
if (oldVal !== newVal) {
|
|
219
|
+
window.setTimeout(async () => {
|
|
220
|
+
await this.loadSpec(this.specUrl);
|
|
221
|
+
}, 0);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
212
224
|
if (name === 'api-key-name' || name === 'api-key-location' || name === 'api-key-value') {
|
|
213
225
|
let updateSelectedApiKey = false;
|
|
214
226
|
let apiKeyName = '';
|
|
@@ -287,11 +299,15 @@ export default class RapiDocMini extends LitElement {
|
|
|
287
299
|
specUrl,
|
|
288
300
|
this.generateMissingTags === 'true',
|
|
289
301
|
this.sortTags === 'true',
|
|
302
|
+
this.sortSchemas === 'true',
|
|
290
303
|
this.getAttribute('sort-endpoints-by'),
|
|
291
304
|
this.getAttribute('api-key-name'),
|
|
292
305
|
this.getAttribute('api-key-location'),
|
|
293
306
|
this.getAttribute('api-key-value'),
|
|
294
307
|
this.getAttribute('server-url'),
|
|
308
|
+
this.matchPaths,
|
|
309
|
+
this.matchType,
|
|
310
|
+
this.removeEndpointsWithBadgeLabelAs,
|
|
295
311
|
);
|
|
296
312
|
this.loading = false;
|
|
297
313
|
this.afterSpecParsedAndValidated(spec);
|
package/src/rapidoc.js
CHANGED
|
@@ -23,7 +23,7 @@ import NavStyles from '~/styles/nav-styles';
|
|
|
23
23
|
import InfoStyles from '~/styles/info-styles';
|
|
24
24
|
import CustomStyles from '~/styles/custom-styles';
|
|
25
25
|
// import { expandCollapseNavBarTag } from '@/templates/navbar-template';
|
|
26
|
-
import { advancedSearch,
|
|
26
|
+
import { advancedSearch, getMatchedPaths, getMatchedComponents, rapidocApiKey, sleep } from '~/utils/common-utils';
|
|
27
27
|
import ProcessSpec from '~/utils/spec-parser';
|
|
28
28
|
import mainBodyTemplate from '~/templates/main-body-template';
|
|
29
29
|
import { applyApiKey, onClearAllApiKeys } from '~/templates/security-scheme-template';
|
|
@@ -134,12 +134,14 @@ export default class RapiDoc extends LitElement {
|
|
|
134
134
|
// Filters
|
|
135
135
|
matchPaths: { type: String, attribute: 'match-paths' },
|
|
136
136
|
matchType: { type: String, attribute: 'match-type' },
|
|
137
|
+
removeEndpointsWithBadgeLabelAs: { type: String, attribute: 'remove-endpoints-with-badge-label-as' },
|
|
137
138
|
|
|
138
139
|
// Internal Properties
|
|
139
140
|
loading: { type: Boolean }, // indicates spec is being loaded
|
|
140
141
|
focusedElementId: { type: String }, // updating the focusedElementId will automatically render appropriate section in focused mode
|
|
141
142
|
showAdvancedSearchDialog: { type: Boolean },
|
|
142
143
|
advancedSearchMatches: { type: Object },
|
|
144
|
+
searchVal: { type: String },
|
|
143
145
|
};
|
|
144
146
|
}
|
|
145
147
|
|
|
@@ -168,6 +170,7 @@ export default class RapiDoc extends LitElement {
|
|
|
168
170
|
color:var(--fg);
|
|
169
171
|
background-color:var(--bg);
|
|
170
172
|
font-family:var(--font-regular);
|
|
173
|
+
container-type: inline-size;
|
|
171
174
|
}
|
|
172
175
|
:where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
|
173
176
|
:where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
|
@@ -216,11 +219,11 @@ export default class RapiDoc extends LitElement {
|
|
|
216
219
|
cursor: n-resize;
|
|
217
220
|
padding: 12px 0;
|
|
218
221
|
}
|
|
219
|
-
.collapsed .section-tag-header:hover{
|
|
222
|
+
.collapsed .section-tag-header:hover {
|
|
220
223
|
cursor: s-resize;
|
|
221
224
|
}
|
|
222
225
|
|
|
223
|
-
.section-tag-header:hover{
|
|
226
|
+
.section-tag-header:hover {
|
|
224
227
|
background-image: linear-gradient(to right, rgba(0,0,0,0), var(--border-color), rgba(0,0,0,0));
|
|
225
228
|
}
|
|
226
229
|
|
|
@@ -255,7 +258,7 @@ export default class RapiDoc extends LitElement {
|
|
|
255
258
|
margin-left:5px;
|
|
256
259
|
}
|
|
257
260
|
.only-large-screen-flex,
|
|
258
|
-
.only-large-screen{
|
|
261
|
+
.only-large-screen {
|
|
259
262
|
display:none;
|
|
260
263
|
}
|
|
261
264
|
.tag.title {
|
|
@@ -375,15 +378,15 @@ export default class RapiDoc extends LitElement {
|
|
|
375
378
|
background-color: var(--yellow);
|
|
376
379
|
}
|
|
377
380
|
|
|
378
|
-
@
|
|
381
|
+
@container (min-width: 768px) {
|
|
379
382
|
.nav-bar {
|
|
380
383
|
width: 260px;
|
|
381
384
|
display:flex;
|
|
382
385
|
}
|
|
383
|
-
.only-large-screen{
|
|
386
|
+
.only-large-screen {
|
|
384
387
|
display:block;
|
|
385
388
|
}
|
|
386
|
-
.only-large-screen-flex{
|
|
389
|
+
.only-large-screen-flex {
|
|
387
390
|
display:flex;
|
|
388
391
|
}
|
|
389
392
|
.section-gap {
|
|
@@ -401,7 +404,7 @@ export default class RapiDoc extends LitElement {
|
|
|
401
404
|
}
|
|
402
405
|
}
|
|
403
406
|
|
|
404
|
-
@
|
|
407
|
+
@container (min-width: 1024px) {
|
|
405
408
|
.nav-bar {
|
|
406
409
|
width: ${unsafeCSS(this.fontSize === 'default' ? '300px' : this.fontSize === 'large' ? '315px' : '330px')};
|
|
407
410
|
display:flex;
|
|
@@ -513,9 +516,11 @@ export default class RapiDoc extends LitElement {
|
|
|
513
516
|
if (!this.showComponents || !'true false'.includes(this.showComponents)) { this.showComponents = 'false'; }
|
|
514
517
|
if (!this.infoDescriptionHeadingsInNavBar || !'true, false,'.includes(`${this.infoDescriptionHeadingsInNavBar},`)) { this.infoDescriptionHeadingsInNavBar = 'false'; }
|
|
515
518
|
if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) { this.fetchCredentials = ''; }
|
|
516
|
-
if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }
|
|
517
519
|
if (!this.scrollBehavior || !'smooth, auto,'.includes(`${this.scrollBehavior},`)) { this.scrollBehavior = 'auto'; }
|
|
518
520
|
|
|
521
|
+
if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }
|
|
522
|
+
if (!this.matchPaths) { this.matchPaths = ''; }
|
|
523
|
+
if (!this.removeEndpointsWithBadgeLabelAs) { this.removeEndpointsWithBadgeLabelAs = ''; }
|
|
519
524
|
if (!this.showAdvancedSearchDialog) { this.showAdvancedSearchDialog = false; }
|
|
520
525
|
|
|
521
526
|
if (!this.cssFile) { this.cssFile = null; }
|
|
@@ -580,6 +585,13 @@ export default class RapiDoc extends LitElement {
|
|
|
580
585
|
}, 0);
|
|
581
586
|
}
|
|
582
587
|
}
|
|
588
|
+
if (name === 'match-paths' || name === 'match-type' || name === 'remove-endpoints-with-badge-label-as') {
|
|
589
|
+
if (oldVal !== newVal) {
|
|
590
|
+
window.setTimeout(async () => {
|
|
591
|
+
await this.loadSpec(this.specUrl);
|
|
592
|
+
}, 0);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
583
595
|
if (name === 'render-style') {
|
|
584
596
|
if (newVal === 'read') {
|
|
585
597
|
window.setTimeout(() => {
|
|
@@ -657,7 +669,7 @@ export default class RapiDoc extends LitElement {
|
|
|
657
669
|
const specObj = JSON.parse(reader.result);
|
|
658
670
|
this.loadSpec(specObj);
|
|
659
671
|
this.shadowRoot.getElementById('spec-url').value = '';
|
|
660
|
-
} catch
|
|
672
|
+
} catch {
|
|
661
673
|
console.error('RapiDoc: Unable to read or parse json'); // eslint-disable-line no-console
|
|
662
674
|
}
|
|
663
675
|
};
|
|
@@ -670,18 +682,18 @@ export default class RapiDoc extends LitElement {
|
|
|
670
682
|
}
|
|
671
683
|
|
|
672
684
|
onSearchChange(e) {
|
|
673
|
-
this.matchPaths = e.target.value;
|
|
674
|
-
this.
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
if (
|
|
685
|
+
// this.matchPaths = e.target.value;
|
|
686
|
+
this.searchVal = e.target.value;
|
|
687
|
+
this.resolvedSpec.tags.forEach((tag) => tag.paths.filter((path) => {
|
|
688
|
+
if (this.searchVal) {
|
|
689
|
+
if (getMatchedPaths(this.searchVal, path, tag.name)) {
|
|
678
690
|
tag.expanded = true;
|
|
679
691
|
}
|
|
680
692
|
}
|
|
681
693
|
}));
|
|
682
694
|
this.resolvedSpec.components.forEach((component) => component.subComponents.filter((v) => {
|
|
683
695
|
v.expanded = false;
|
|
684
|
-
if (
|
|
696
|
+
if (getMatchedComponents(this.searchVal, v)) {
|
|
685
697
|
v.expanded = true;
|
|
686
698
|
}
|
|
687
699
|
}));
|
|
@@ -691,7 +703,7 @@ export default class RapiDoc extends LitElement {
|
|
|
691
703
|
onClearSearch() {
|
|
692
704
|
const searchEl = this.shadowRoot.getElementById('nav-bar-search');
|
|
693
705
|
searchEl.value = '';
|
|
694
|
-
this.
|
|
706
|
+
this.searchVal = '';
|
|
695
707
|
this.resolvedSpec.components.forEach((component) => component.subComponents.filter((v) => {
|
|
696
708
|
v.expanded = true;
|
|
697
709
|
}));
|
|
@@ -716,7 +728,7 @@ export default class RapiDoc extends LitElement {
|
|
|
716
728
|
if (!specUrl) {
|
|
717
729
|
return;
|
|
718
730
|
}
|
|
719
|
-
this.
|
|
731
|
+
this.searchVal = '';
|
|
720
732
|
try {
|
|
721
733
|
this.resolvedSpec = {
|
|
722
734
|
specLoadError: false,
|
|
@@ -736,6 +748,9 @@ export default class RapiDoc extends LitElement {
|
|
|
736
748
|
this.getAttribute('api-key-location'),
|
|
737
749
|
this.getAttribute('api-key-value'),
|
|
738
750
|
this.getAttribute('server-url'),
|
|
751
|
+
this.matchPaths,
|
|
752
|
+
this.matchType,
|
|
753
|
+
this.removeEndpointsWithBadgeLabelAs,
|
|
739
754
|
);
|
|
740
755
|
this.loading = false;
|
|
741
756
|
this.afterSpecParsedAndValidated(spec);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
3
|
export default css`
|
|
4
|
+
:host {
|
|
5
|
+
container-type: inline-size;
|
|
6
|
+
}
|
|
4
7
|
.only-large-screen { display:none; }
|
|
5
|
-
.endpoint-head .path{
|
|
8
|
+
.endpoint-head .path {
|
|
6
9
|
display: flex;
|
|
7
10
|
font-family:var(--font-mono);
|
|
8
11
|
font-size: var(--font-size-small);
|
|
@@ -21,7 +24,7 @@ export default css`
|
|
|
21
24
|
display:none;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
.m-endpoint.expanded{margin-bottom:16px; }
|
|
27
|
+
.m-endpoint.expanded { margin-bottom:16px; }
|
|
25
28
|
.m-endpoint > .endpoint-head{
|
|
26
29
|
border-width:1px 1px 1px 5px;
|
|
27
30
|
border-style:solid;
|
|
@@ -33,7 +36,7 @@ export default css`
|
|
|
33
36
|
cursor: pointer;
|
|
34
37
|
}
|
|
35
38
|
.m-endpoint > .endpoint-head.put:hover,
|
|
36
|
-
.m-endpoint > .endpoint-head.put.expanded{
|
|
39
|
+
.m-endpoint > .endpoint-head.put.expanded {
|
|
37
40
|
border-color:var(--orange);
|
|
38
41
|
background-color:var(--light-orange);
|
|
39
42
|
}
|
|
@@ -78,20 +81,20 @@ export default css`
|
|
|
78
81
|
}
|
|
79
82
|
.m-endpoint .endpoint-body.delete{ border-color:var(--red); }
|
|
80
83
|
.m-endpoint .endpoint-body.put{ border-color:var(--orange); }
|
|
81
|
-
.m-endpoint .endpoint-body.post{border-color:var(--green);}
|
|
82
|
-
.m-endpoint .endpoint-body.get{ border-color:var(--blue); }
|
|
84
|
+
.m-endpoint .endpoint-body.post { border-color:var(--green); }
|
|
85
|
+
.m-endpoint .endpoint-body.get { border-color:var(--blue); }
|
|
83
86
|
.m-endpoint .endpoint-body.head,
|
|
84
87
|
.m-endpoint .endpoint-body.patch,
|
|
85
88
|
.m-endpoint .endpoint-body.options {
|
|
86
89
|
border-color:var(--yellow);
|
|
87
90
|
}
|
|
88
91
|
|
|
89
|
-
.m-endpoint .endpoint-body.deprecated{
|
|
92
|
+
.m-endpoint .endpoint-body.deprecated {
|
|
90
93
|
border-color:var(--border-color);
|
|
91
94
|
filter:opacity(0.6);
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
.endpoint-head .deprecated{
|
|
97
|
+
.endpoint-head .deprecated {
|
|
95
98
|
color: var(--light-fg);
|
|
96
99
|
filter:opacity(0.6);
|
|
97
100
|
}
|
|
@@ -99,13 +102,13 @@ export default css`
|
|
|
99
102
|
.summary{
|
|
100
103
|
padding:8px 8px;
|
|
101
104
|
}
|
|
102
|
-
.summary .title{
|
|
105
|
+
.summary .title {
|
|
103
106
|
font-size:calc(var(--font-size-regular) + 2px);
|
|
104
107
|
margin-bottom: 6px;
|
|
105
108
|
word-break: break-all;
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
.endpoint-head .method{
|
|
111
|
+
.endpoint-head .method {
|
|
109
112
|
padding:2px 5px;
|
|
110
113
|
vertical-align: middle;
|
|
111
114
|
font-size:var(--font-size-small);
|
|
@@ -169,7 +172,7 @@ api-response.view-mode {
|
|
|
169
172
|
border-color:var(--red);
|
|
170
173
|
}
|
|
171
174
|
|
|
172
|
-
@
|
|
175
|
+
@container (min-width: 1024px) {
|
|
173
176
|
.only-large-screen { display:block; }
|
|
174
177
|
.endpoint-head .path{
|
|
175
178
|
font-size: var(--font-size-regular);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
3
|
export default css`
|
|
4
|
-
.hover-bg:hover{
|
|
4
|
+
.hover-bg:hover {
|
|
5
5
|
background: var(--bg3);
|
|
6
6
|
}
|
|
7
7
|
::selection {
|
|
8
8
|
background: var(--selection-bg);
|
|
9
9
|
color: var(--selection-fg);
|
|
10
10
|
}
|
|
11
|
-
.regular-font{
|
|
11
|
+
.regular-font {
|
|
12
12
|
font-family:var(--font-regular);
|
|
13
13
|
}
|
|
14
14
|
.mono-font {
|
|
@@ -18,7 +18,7 @@ export default css`
|
|
|
18
18
|
font-size: calc(var(--font-size-small) + 18px);
|
|
19
19
|
font-weight: normal
|
|
20
20
|
}
|
|
21
|
-
.sub-title{ font-size: 20px;}
|
|
21
|
+
.sub-title{ font-size: 20px; }
|
|
22
22
|
.req-res-title {
|
|
23
23
|
font-family: var(--font-regular);
|
|
24
24
|
font-size: calc(var(--font-size-small) + 4px);
|
|
@@ -33,11 +33,11 @@ export default css`
|
|
|
33
33
|
.regular-font-size { font-size: var(--font-size-regular); }
|
|
34
34
|
.small-font-size { font-size: var(--font-size-small); }
|
|
35
35
|
.upper { text-transform: uppercase; }
|
|
36
|
-
.primary-text{ color: var(--primary-color); }
|
|
36
|
+
.primary-text { color: var(--primary-color); }
|
|
37
37
|
.bold-text { font-weight:bold; }
|
|
38
38
|
.gray-text { color: var(--light-fg); }
|
|
39
|
-
.red-text {color: var(--red)}
|
|
40
|
-
.blue-text {color: var(--blue)}
|
|
39
|
+
.red-text { color: var(--red) }
|
|
40
|
+
.blue-text { color: var(--blue) }
|
|
41
41
|
.multiline {
|
|
42
42
|
overflow: scroll;
|
|
43
43
|
max-height: var(--resp-area-height, 400px);
|
|
@@ -53,14 +53,14 @@ export default css`
|
|
|
53
53
|
color: var(--yellow);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
h1{ font-family:var(--font-regular); font-size:28px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
57
|
-
h2{ font-family:var(--font-regular); font-size:24px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
58
|
-
h3{ font-family:var(--font-regular); font-size:18px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
59
|
-
h4{ font-family:var(--font-regular); font-size:16px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
60
|
-
h5{ font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
61
|
-
h6{ font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
56
|
+
h1 { font-family:var(--font-regular); font-size:28px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
57
|
+
h2 { font-family:var(--font-regular); font-size:24px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
58
|
+
h3 { font-family:var(--font-regular); font-size:18px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
59
|
+
h4 { font-family:var(--font-regular); font-size:16px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
60
|
+
h5 { font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
61
|
+
h6 { font-family:var(--font-regular); font-size:14px; padding-top: 10px; letter-spacing:normal; font-weight:normal; }
|
|
62
62
|
|
|
63
|
-
h1,h2,h3,h4,h5,h5{
|
|
63
|
+
h1,h2,h3,h4,h5,h5 {
|
|
64
64
|
margin-block-end: 0.2em;
|
|
65
65
|
}
|
|
66
66
|
p { margin-block-start: 0.5em; }
|
|
@@ -37,14 +37,14 @@ export default css`
|
|
|
37
37
|
.m-btn.nav:hover {
|
|
38
38
|
background-color: var(--nav-accent-color);
|
|
39
39
|
}
|
|
40
|
-
.m-btn:disabled{
|
|
40
|
+
.m-btn:disabled {
|
|
41
41
|
background-color: var(--bg3);
|
|
42
42
|
color: var(--fg3);
|
|
43
43
|
border-color: var(--fg3);
|
|
44
44
|
cursor: not-allowed;
|
|
45
45
|
opacity: 0.4;
|
|
46
46
|
}
|
|
47
|
-
.toolbar-btn{
|
|
47
|
+
.toolbar-btn {
|
|
48
48
|
cursor: pointer;
|
|
49
49
|
padding: 4px;
|
|
50
50
|
margin:0 2px;
|
package/src/styles/nav-styles.js
CHANGED
|
@@ -3,6 +3,9 @@ import { css } from 'lit';
|
|
|
3
3
|
export default css`
|
|
4
4
|
|
|
5
5
|
*, *:before, *:after { box-sizing: border-box; }
|
|
6
|
+
:host {
|
|
7
|
+
container-type: inline-size;
|
|
8
|
+
}
|
|
6
9
|
|
|
7
10
|
.tr {
|
|
8
11
|
display: flex;
|
|
@@ -81,13 +84,13 @@ export default css`
|
|
|
81
84
|
margin-left: 2px;
|
|
82
85
|
}
|
|
83
86
|
|
|
84
|
-
.stri, .string, .uri, .url, .byte, .bina, .date, .pass, .ipv4, .ipv4, .uuid, .emai, .host {color:var(--green);}
|
|
85
|
-
.inte, .numb, .number, .int6, .int3, .floa, .doub, .deci .blue {color:var(--blue);}
|
|
86
|
-
.null {color:var(--red);}
|
|
87
|
-
.bool, .boolean{color:var(--orange)}
|
|
88
|
-
.enum {color:var(--purple)}
|
|
89
|
-
.cons {color:var(--purple)}
|
|
90
|
-
.recu {color:var(--brown)}
|
|
87
|
+
.stri, .string, .uri, .url, .byte, .bina, .date, .pass, .ipv4, .ipv4, .uuid, .emai, .host { color:var(--green); }
|
|
88
|
+
.inte, .numb, .number, .int6, .int3, .floa, .doub, .deci .blue { color:var(--blue); }
|
|
89
|
+
.null { color:var(--red); }
|
|
90
|
+
.bool, .boolean { color:var(--orange) }
|
|
91
|
+
.enum { color:var(--purple) }
|
|
92
|
+
.cons { color:var(--purple) }
|
|
93
|
+
.recu { color:var(--brown) }
|
|
91
94
|
.toolbar {
|
|
92
95
|
display:flex;
|
|
93
96
|
width:100%;
|
|
@@ -107,11 +110,11 @@ export default css`
|
|
|
107
110
|
}
|
|
108
111
|
.toolbar-item:first-of-type { margin:0 2px 0 0;}
|
|
109
112
|
|
|
110
|
-
@
|
|
113
|
+
@container (min-width: 500px) {
|
|
111
114
|
.key-descr {
|
|
112
115
|
display: block;
|
|
113
116
|
}
|
|
114
|
-
.expanded-descr .key-descr{
|
|
117
|
+
.expanded-descr .key-descr {
|
|
115
118
|
display: block;
|
|
116
119
|
}
|
|
117
120
|
}
|
|
@@ -13,6 +13,7 @@ export default function searchByPropertiesModalTemplate() {
|
|
|
13
13
|
>
|
|
14
14
|
<span class="advanced-search-options">
|
|
15
15
|
<input
|
|
16
|
+
id="input-advanced-search-dialog"
|
|
16
17
|
style="width:100%; padding-right:20px;"
|
|
17
18
|
type="text"
|
|
18
19
|
part="textbox textbox-search-dialog"
|
|
@@ -52,7 +53,7 @@ export default function searchByPropertiesModalTemplate() {
|
|
|
52
53
|
tabindex = '0'
|
|
53
54
|
@click="${
|
|
54
55
|
(e) => {
|
|
55
|
-
this.
|
|
56
|
+
this.searchVal = ''; // clear quick filter if applied
|
|
56
57
|
this.showAdvancedSearchDialog = false; // Hide Search Dialog
|
|
57
58
|
this.requestUpdate();
|
|
58
59
|
this.scrollToEventTarget(e, true);
|