openapi-explorer 0.9.393 → 0.10.395
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/CHANGELOG.md +3 -0
- package/README.md +3 -2
- package/dist/browser/openapi-explorer.min.js +6 -6
- package/dist/browser/openapi-explorer.min.js.map +1 -1
- package/dist/es/components/api-request.js +9 -8
- package/dist/es/components/api-response.js +5 -4
- package/dist/es/components/json-tree.js +3 -2
- package/dist/es/components/mime-types.js +5 -5
- package/dist/es/components/schema-table.js +1 -1
- package/dist/es/components/schema-tree.js +3 -2
- package/dist/es/languages/en.js +59 -0
- package/dist/es/languages/fr.js +59 -0
- package/dist/es/languages/index.js +20 -0
- package/dist/es/openapi-explorer.js +4 -3
- package/dist/es/styles/input-styles.js +1 -1
- package/dist/es/templates/code-samples-template.js +2 -1
- package/dist/es/templates/components-template.js +1 -1
- package/dist/es/templates/navbar-template.js +3 -2
- package/dist/es/templates/overview-template.js +2 -1
- package/dist/es/templates/security-scheme-template.js +6 -5
- package/dist/es/templates/server-template.js +4 -3
- package/dist/es/utils/common-utils.js +4 -2
- package/dist/es/utils/schema-utils.js +1 -1
- package/dist/es/utils/spec-parser.js +3 -2
- package/dist/lib/components/api-request.js +10 -8
- package/dist/lib/components/api-response.js +6 -4
- package/dist/lib/components/json-tree.js +4 -2
- package/dist/lib/components/mime-types.js +8 -9
- package/dist/lib/components/schema-table.js +1 -1
- package/dist/lib/components/schema-tree.js +4 -2
- package/dist/lib/languages/en.js +64 -0
- package/dist/lib/languages/fr.js +64 -0
- package/dist/lib/languages/index.js +32 -0
- package/dist/lib/openapi-explorer.js +5 -3
- package/dist/lib/styles/input-styles.js +1 -1
- package/dist/lib/templates/code-samples-template.js +3 -1
- package/dist/lib/templates/components-template.js +1 -1
- package/dist/lib/templates/navbar-template.js +4 -2
- package/dist/lib/templates/overview-template.js +3 -1
- package/dist/lib/templates/security-scheme-template.js +7 -5
- package/dist/lib/templates/server-template.js +5 -3
- package/dist/lib/utils/common-utils.js +4 -2
- package/dist/lib/utils/schema-utils.js +1 -1
- package/dist/lib/utils/spec-parser.js +4 -2
- package/package.json +7 -4
|
@@ -11,7 +11,9 @@ var _unsafeHtml = require("lit-html/directives/unsafe-html.js");
|
|
|
11
11
|
|
|
12
12
|
var _schemaUtils = require("../utils/schema-utils");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _languages = require("../languages");
|
|
15
|
+
|
|
16
|
+
var _fontStyles = _interopRequireDefault(require("../styles/font-styles.js"));
|
|
15
17
|
|
|
16
18
|
var _flexStyles = _interopRequireDefault(require("../styles/flex-styles"));
|
|
17
19
|
|
|
@@ -94,7 +96,7 @@ class ApiResponse extends _litElement.LitElement {
|
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
render() {
|
|
97
|
-
return (0, _litElement.html)` <div class="col regular-font response-panel ${this.renderStyle}-mode"> <div class="${this.callback === 'true' ? 'tiny-title' : 'req-res-title'}"> ${this.callback === 'true' ? 'CALLBACK RESPONSE' : '
|
|
99
|
+
return (0, _litElement.html)` <div class="col regular-font response-panel ${this.renderStyle}-mode"> <div class="${this.callback === 'true' ? 'tiny-title' : 'req-res-title'}"> ${this.callback === 'true' ? 'CALLBACK RESPONSE' : (0, _languages.getI18nText)('operations.response')} </div> <div> ${this.responseTemplate()} <div> </div> </div></div>`;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
resetSelection() {
|
|
@@ -164,11 +166,11 @@ class ApiResponse extends _litElement.LitElement {
|
|
|
164
166
|
if (e.target.tagName.toLowerCase() === 'button') {
|
|
165
167
|
this.activeSchemaTab = e.target.dataset.tab;
|
|
166
168
|
}
|
|
167
|
-
}}"> <button class="tab-btn ${this.activeSchemaTab === 'model' ? 'active' : ''}" data-tab="model"
|
|
169
|
+
}}"> <button class="tab-btn ${this.activeSchemaTab === 'model' ? 'active' : ''}" data-tab="model">${(0, _languages.getI18nText)('operations.model')}</button> <button class="tab-btn ${this.activeSchemaTab === 'body' ? 'active' : ''}" data-tab="body">${(0, _languages.getI18nText)('operations.example')}</button> <div style="flex:1"></div> ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 1 ? (0, _litElement.html)`<span class="small-font-size gray-text" style="align-self:center;margin-top:8px"> ${Object.keys(this.mimeResponsesForEachStatus[status])[0]} </span>` : (0, _litElement.html)`${this.mimeTypeDropdownTemplate(Object.keys(this.mimeResponsesForEachStatus[status]))}`} </div> ${this.activeSchemaTab === 'body' ? (0, _litElement.html)`<div class="tab-content col" style="flex:1"> ${this.mimeExampleTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])} </div>` : (0, _litElement.html)`<div class="tab-content col" style="flex:1"> ${this.mimeSchemaTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])} </div>`} </div> `}</div>`)} `;
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
responseHeaderListTemplate(respHeaders) {
|
|
171
|
-
return (0, _litElement.html)` <div style="padding:16px 0 8px 0" class="resp-headers small-font-size bold-text"
|
|
173
|
+
return (0, _litElement.html)` <div style="padding:16px 0 8px 0" class="resp-headers small-font-size bold-text">${(0, _languages.getI18nText)('operations.response-headers')}</div> <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"> ${respHeaders.map(v => (0, _litElement.html)` <tr> <td style="padding:8px;vertical-align:baseline;min-width:120px;border-top:1px solid var(--light-border-color);text-overflow:ellipsis"> ${v.name || ''} </td> <td style="padding:4px;vertical-align:baseline;padding:0 5px;border-top:1px solid var(--light-border-color);text-overflow:ellipsis"> ${v.schema.type || ''} </td> <td style="padding:8px;vertical-align:baseline;border-top:1px solid var(--light-border-color);text-overflow:ellipsis"> <div class="m-markdown-small regular-font">${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(v.description || ''))}</div> </td> <td style="padding:8px;vertical-align:baseline;border-top:1px solid var(--light-border-color);text-overflow:ellipsis"> ${v.schema.example || ''} </td> </tr> `)} </table>`;
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
mimeTypeDropdownTemplate(mimeTypes) {
|
|
@@ -7,7 +7,9 @@ var _litElement = require("lit-element");
|
|
|
7
7
|
|
|
8
8
|
var _commonUtils = require("../utils/common-utils");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _languages = require("../languages");
|
|
11
|
+
|
|
12
|
+
var _fontStyles = _interopRequireDefault(require("../styles/font-styles.js"));
|
|
11
13
|
|
|
12
14
|
var _borderStyles = _interopRequireDefault(require("../styles/border-styles"));
|
|
13
15
|
|
|
@@ -37,7 +39,7 @@ class JsonTree extends _litElement.LitElement {
|
|
|
37
39
|
render() {
|
|
38
40
|
return (0, _litElement.html)` <div class="json-tree tree"> <div class="toolbar"> <div> </div> <div class="toolbar-item"> <button class="toolbar-copy-btn" part="btn btn-fill" @click="${e => {
|
|
39
41
|
(0, _commonUtils.copyToClipboard)(JSON.stringify(this.data, null, 2), e);
|
|
40
|
-
}}"
|
|
42
|
+
}}">${(0, _languages.getI18nText)('operations.copy')}</button> </div> </div> ${this.generateTree(this.data, true)} </div> `;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
generateTree(data, isLast = false) {
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = extension;
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _db = _interopRequireDefault(require("mime-db/db.json"));
|
|
7
7
|
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
9
|
|
|
10
10
|
const EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
11
|
+
const extensions = {};
|
|
12
|
+
const types = {};
|
|
13
|
+
populateMaps();
|
|
11
14
|
/**
|
|
12
15
|
* Get the default extension for a MIME type.
|
|
13
16
|
*
|
|
@@ -23,7 +26,7 @@ function extension(type) {
|
|
|
23
26
|
|
|
24
27
|
const match = EXTRACT_TYPE_REGEXP.exec(type); // get extensions
|
|
25
28
|
|
|
26
|
-
const exts = match &&
|
|
29
|
+
const exts = match && extensions[match[1].toLowerCase()];
|
|
27
30
|
|
|
28
31
|
if (!exts || !exts.length) {
|
|
29
32
|
return false;
|
|
@@ -32,15 +35,11 @@ function extension(type) {
|
|
|
32
35
|
return exts[0];
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
const extensions = {};
|
|
36
|
-
const types = {};
|
|
37
|
-
populateMaps();
|
|
38
|
-
|
|
39
38
|
function populateMaps() {
|
|
40
39
|
// source preference (least -> most)
|
|
41
40
|
const preference = ['nginx', 'apache', undefined, 'iana'];
|
|
42
|
-
Object.keys(
|
|
43
|
-
const mime =
|
|
41
|
+
Object.keys(_db.default).forEach(function forEachMimeType(type) {
|
|
42
|
+
const mime = _db.default[type];
|
|
44
43
|
const exts = mime.extensions;
|
|
45
44
|
|
|
46
45
|
if (!exts || !exts.length) {
|
|
@@ -54,7 +53,7 @@ function populateMaps() {
|
|
|
54
53
|
const extensionToTest = exts[i];
|
|
55
54
|
|
|
56
55
|
if (types[extensionToTest]) {
|
|
57
|
-
const from = preference.indexOf(
|
|
56
|
+
const from = preference.indexOf(_db.default[types[extensionToTest]].source);
|
|
58
57
|
const to = preference.indexOf(mime.source);
|
|
59
58
|
|
|
60
59
|
if (types[extensionToTest] !== 'application/octet-stream' && (from > to || from === to && types[extensionToTest].substr(0, 12) === 'application/')) {
|
|
@@ -9,7 +9,7 @@ var _marked = require("marked");
|
|
|
9
9
|
|
|
10
10
|
var _unsafeHtml = require("lit-html/directives/unsafe-html.js");
|
|
11
11
|
|
|
12
|
-
var _fontStyles = _interopRequireDefault(require("../styles/font-styles"));
|
|
12
|
+
var _fontStyles = _interopRequireDefault(require("../styles/font-styles.js"));
|
|
13
13
|
|
|
14
14
|
var _schemaStyles = _interopRequireDefault(require("../styles/schema-styles"));
|
|
15
15
|
|
|
@@ -9,7 +9,9 @@ var _marked = require("marked");
|
|
|
9
9
|
|
|
10
10
|
var _unsafeHtml = require("lit-html/directives/unsafe-html.js");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _languages = require("../languages");
|
|
13
|
+
|
|
14
|
+
var _fontStyles = _interopRequireDefault(require("../styles/font-styles.js"));
|
|
13
15
|
|
|
14
16
|
var _schemaStyles = _interopRequireDefault(require("../styles/schema-styles"));
|
|
15
17
|
|
|
@@ -66,7 +68,7 @@ class SchemaTree extends _litElement.LitElement {
|
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
render() {
|
|
69
|
-
return (0, _litElement.html)` <div class="tree"> <div class="toolbar"> ${this.data && this.data['::description'] ? (0, _litElement.html)`<span class="m-markdown" style="margin-block-start:0"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(this.data['::description'] || ''))}</span>` : (0, _litElement.html)`<div> </div>`} <div class="toolbar-item" @click="${() => this.toggleSchemaDescription()}"> ${this.schemaDescriptionExpanded ? '
|
|
71
|
+
return (0, _litElement.html)` <div class="tree"> <div class="toolbar"> ${this.data && this.data['::description'] ? (0, _litElement.html)`<span class="m-markdown" style="margin-block-start:0"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(this.data['::description'] || ''))}</span>` : (0, _litElement.html)`<div> </div>`} <div class="toolbar-item" @click="${() => this.toggleSchemaDescription()}"> ${this.schemaDescriptionExpanded === 'true' ? (0, _languages.getI18nText)('schemas.collapse-desc') : (0, _languages.getI18nText)('schemas.expand-desc')} </div> </div> ${this.data ? (0, _litElement.html)`${this.generateTree(this.data['::type'] === 'array' ? this.data['::props'] : this.data, this.data['::type'], this.data['::array-type'] || '')}` : (0, _litElement.html)`<span class="mono-font" style="color:var(--red)"> ${(0, _languages.getI18nText)('schemas.schema-missing')} </span>`} </div> `;
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
toggleSchemaDescription() {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _default = {
|
|
6
|
+
translation: {
|
|
7
|
+
'menu': {
|
|
8
|
+
'filter': 'Filter',
|
|
9
|
+
'search': 'Search',
|
|
10
|
+
'overview': 'Overview',
|
|
11
|
+
'api-servers': 'API Servers',
|
|
12
|
+
'authentication': 'Authentication',
|
|
13
|
+
'operations': 'OPERATIONS',
|
|
14
|
+
'components': 'COMPONENTS',
|
|
15
|
+
'schemas': 'Schemas'
|
|
16
|
+
},
|
|
17
|
+
'headers': {
|
|
18
|
+
'api-servers': 'API SERVER',
|
|
19
|
+
'authentication': 'AUTHENTICATION'
|
|
20
|
+
},
|
|
21
|
+
'overview': {
|
|
22
|
+
'email': 'Email',
|
|
23
|
+
'terms-of-service': 'Terms of Service'
|
|
24
|
+
},
|
|
25
|
+
'api-servers': {
|
|
26
|
+
'server-variables': 'SERVER VARIABLES',
|
|
27
|
+
'selected': 'SELECTED'
|
|
28
|
+
},
|
|
29
|
+
'authentication': {
|
|
30
|
+
'no-api-key-applied': 'No API key applied',
|
|
31
|
+
'http-basic': 'HTTP Basic',
|
|
32
|
+
'http-basic-desc': 'Send the Authorization header containing the type Basic followed by a space and a base64 encoded string of username:password',
|
|
33
|
+
'username': 'username',
|
|
34
|
+
'password': 'password',
|
|
35
|
+
'requires': 'Requires',
|
|
36
|
+
'http-basic-note': 'Base 64 encoded username:password',
|
|
37
|
+
'in-auth-header': 'in Authorization header',
|
|
38
|
+
'set': 'SET'
|
|
39
|
+
},
|
|
40
|
+
'operations': {
|
|
41
|
+
'request': 'REQUEST',
|
|
42
|
+
'request-body': 'REQUEST BODY',
|
|
43
|
+
'model': 'MODEL',
|
|
44
|
+
'body': 'BODY',
|
|
45
|
+
'request-headers': 'REQUEST HEADERS',
|
|
46
|
+
'clear': 'CLEAR',
|
|
47
|
+
'clear-response': 'CLEAR RESPONSE',
|
|
48
|
+
'execute': 'EXECUTE',
|
|
49
|
+
'response': 'RESPONSE',
|
|
50
|
+
'response-headers': 'RESPONSE HEADERS',
|
|
51
|
+
'example': 'EXAMPLE',
|
|
52
|
+
'response-status': 'Response Status',
|
|
53
|
+
'fetch-fail': 'Failed to fetch (Check the browser network tab for more information.)',
|
|
54
|
+
'copy': 'Copy',
|
|
55
|
+
'copied': 'Copied'
|
|
56
|
+
},
|
|
57
|
+
'schemas': {
|
|
58
|
+
'collapse-desc': 'Collapse',
|
|
59
|
+
'expand-desc': 'Expand',
|
|
60
|
+
'schema-missing': 'Schema not found'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.default = _default;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _default = {
|
|
6
|
+
translation: {
|
|
7
|
+
'menu': {
|
|
8
|
+
'filter': 'Filtre',
|
|
9
|
+
'search': 'Chercher',
|
|
10
|
+
'overview': 'Aperçu',
|
|
11
|
+
'api-servers': 'Serveur API',
|
|
12
|
+
'authentication': 'Authentification',
|
|
13
|
+
'operations': 'OPÉRATIONS',
|
|
14
|
+
'components': 'COMPOSANTS',
|
|
15
|
+
'schemas': 'Schémas'
|
|
16
|
+
},
|
|
17
|
+
'headers': {
|
|
18
|
+
'api-servers': 'SERVEUR API',
|
|
19
|
+
'authentication': 'AUTHENTIFICATION'
|
|
20
|
+
},
|
|
21
|
+
'overview': {
|
|
22
|
+
'email': 'Courriel',
|
|
23
|
+
'terms-of-service': 'Avis'
|
|
24
|
+
},
|
|
25
|
+
'api-servers': {
|
|
26
|
+
'server-variables': 'VARIABLES SERVEUR',
|
|
27
|
+
'selected': 'CHOISI'
|
|
28
|
+
},
|
|
29
|
+
'authentication': {
|
|
30
|
+
'no-api-key-applied': "Aucune clé d'API appliquée",
|
|
31
|
+
'http-basic': 'HTTP Basique',
|
|
32
|
+
'http-basic-desc': "Envoyez l'en-tête Authorization contenant le type Basic suivi d'un espace et d'une chaîne encodée en base64 de nom d'utilisateur:mot de passe",
|
|
33
|
+
'username': "nom d'utilisateur",
|
|
34
|
+
'password': 'mot de passe',
|
|
35
|
+
'requires': 'Nécessite',
|
|
36
|
+
'http-basic-note': "un nom d'utilisateur/mot de passe encodé en base64",
|
|
37
|
+
'in-auth-header': "dans l'en-tête Authorization",
|
|
38
|
+
'set': 'DÉFINIR'
|
|
39
|
+
},
|
|
40
|
+
'operations': {
|
|
41
|
+
'request': 'REQUÊTE',
|
|
42
|
+
'request-body': 'CORPS DE LA REQUÊTE',
|
|
43
|
+
'model': 'MODÈLE',
|
|
44
|
+
'body': 'CORPS',
|
|
45
|
+
'request-headers': 'EN-TÊTES DE LA REQUÊTE',
|
|
46
|
+
'clear': 'VIDER',
|
|
47
|
+
'clear-response': 'VIDER LA RÉPONSE',
|
|
48
|
+
'execute': 'EXÉCUTER',
|
|
49
|
+
'response': 'RÉPONSE',
|
|
50
|
+
'response-headers': 'EN-TÊTES DE LA RÉPONSE',
|
|
51
|
+
'example': 'EXEMPLE',
|
|
52
|
+
'response-status': 'Statut de réponse',
|
|
53
|
+
'fetch-fail': "Échec d'obtenir (Consultez l'onglet Réseau de navigateur pour plus d'information.)",
|
|
54
|
+
'copy': 'Copier',
|
|
55
|
+
'copied': 'Copié'
|
|
56
|
+
},
|
|
57
|
+
'schemas': {
|
|
58
|
+
'collapse-desc': 'Réduire',
|
|
59
|
+
'expand-desc': 'Agrandir',
|
|
60
|
+
'schema-missing': 'Schéma introuvable'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.default = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getI18nText = getI18nText;
|
|
5
|
+
exports.initI18n = initI18n;
|
|
6
|
+
|
|
7
|
+
var _i18next = _interopRequireDefault(require("i18next"));
|
|
8
|
+
|
|
9
|
+
var _en = _interopRequireDefault(require("./en"));
|
|
10
|
+
|
|
11
|
+
var _fr = _interopRequireDefault(require("./fr"));
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
async function initI18n() {
|
|
16
|
+
const initLang = window.navigator.language.substring(0, 2);
|
|
17
|
+
await _i18next.default.init({
|
|
18
|
+
lng: initLang,
|
|
19
|
+
fallbackLng: 'en',
|
|
20
|
+
debug: true,
|
|
21
|
+
ns: ['translation'],
|
|
22
|
+
defaultNS: 'translation',
|
|
23
|
+
resources: {
|
|
24
|
+
en: _en.default,
|
|
25
|
+
fr: _fr.default
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getI18nText(key) {
|
|
31
|
+
return _i18next.default.t(key);
|
|
32
|
+
}
|
|
@@ -27,7 +27,7 @@ require("prismjs/components/prism-http");
|
|
|
27
27
|
|
|
28
28
|
require("prismjs/components/prism-csharp");
|
|
29
29
|
|
|
30
|
-
var _fontStyles = _interopRequireDefault(require("./styles/font-styles"));
|
|
30
|
+
var _fontStyles = _interopRequireDefault(require("./styles/font-styles.js"));
|
|
31
31
|
|
|
32
32
|
var _inputStyles = _interopRequireDefault(require("./styles/input-styles"));
|
|
33
33
|
|
|
@@ -49,6 +49,8 @@ var _advancedSearchStyles = _interopRequireDefault(require("./styles/advanced-se
|
|
|
49
49
|
|
|
50
50
|
var _commonUtils = require("./utils/common-utils");
|
|
51
51
|
|
|
52
|
+
var _languages = require("./languages");
|
|
53
|
+
|
|
52
54
|
var _specParser = _interopRequireDefault(require("./utils/spec-parser"));
|
|
53
55
|
|
|
54
56
|
var _responsiveViewMainBodyTemplate = _interopRequireDefault(require("./templates/responsiveViewMainBodyTemplate"));
|
|
@@ -254,7 +256,7 @@ class OpenApiExplorer extends _litElement.LitElement {
|
|
|
254
256
|
}
|
|
255
257
|
|
|
256
258
|
static get styles() {
|
|
257
|
-
return [_fontStyles.default, _inputStyles.default, _flexStyles.default, _tableStyles.default, _endpointStyles.default, _prismStyles.default, _tabStyles.default, _navStyles.default, _infoStyles.default, _advancedSearchStyles.default, _apiRequestStyles.default, (0, _litElement.css)`:not(:defined){display:none}:host{display:flex;flex-direction:column;width:100%;height:100%;margin:0;padding:0;overflow:hidden;letter-spacing:normal;color:var(--fg);background-color:var(--bg);font-family:var(--font-regular)}.body{display:flex;height:100%;width:100%;overflow:hidden}.main-content{margin:0;padding:0;display:block;flex:1;height:100%;overflow-y:overlay;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--border-color) transparent}.main-content::-webkit-scrollbar{width:8px;height:8px}.main-content::-webkit-scrollbar-track{background:0 0}.main-content::-webkit-scrollbar-thumb{background-color:var(--border-color)}.section-gap.section-tag{border-bottom:1px solid var(--border-color)}.method-section-gap{padding:24px 8px 0 4px}.section-gap{padding:24px 0 0}.section-tag-header{position:relative;cursor:n-resize;padding:12px 0}.collapsed .section-tag-header:hover{cursor:s-resize}.section-tag-header:hover{background-image:linear-gradient(to right,rgba(0,0,0,0),var(--border-color),rgba(0,0,0,0))}.collapsed .section-tag-header:hover::after{color:var(--primary-color)}.collapsed .section-tag-body{display:none}.logo{height:36px;width:36px;margin-left:5px}.only-large-screen,.only-large-screen-flex{display:none}.header-title{font-size:calc(var(--font-size-regular) + 8px);padding:0 8px}.tag.title{text-transform:uppercase}.header{background-color:var(--header-bg);color:var(--header-fg);width:100%}input.header-input{background:var(--header-color-darker);color:var(--header-fg);border:1px solid var(--header-color-border);flex:1;padding-right:24px;border-radius:3px}input.header-input::placeholder{opacity:.4}input:disabled{cursor:not-allowed}.loader{margin:16px auto 16px auto;border:4px solid var(--bg3);border-radius:50%;border-top:4px solid var(--primary-color);width:36px;height:36px;animation:spin 2s linear infinite}.expanded-endpoint-body{position:relative;padding:6px 0}.divider{border-top:2px solid var(--border-color);margin:24px 0;width:100%}.tooltip{border:1px solid var(--border-color);border-left-width:4px;margin-left:2px}.tooltip a{color:var(--fg2);text-decoration:none}.tooltip-text{color:var(--fg2);background-color:var(--bg2);visibility:hidden;overflow-wrap:break-word}.tooltip:hover{color:var(--primary-color);border-color:var(--primary-color)}.tooltip:hover a:hover{color:var(--primary-color)}.tooltip:hover .tooltip-text{visibility:visible;opacity:1}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@media only screen and (max-width:767.98px){.section-padding{margin:1rem}.sub-title.tag{margin-left:1rem}.section-tag-body .description{margin-left:1rem;margin-right:1rem}}@media only screen and (min-width:768px){.nav-bar{width:260px;display:flex}.only-large-screen{display:block}.only-large-screen-flex{display:flex}.section-gap{padding:24px 24px}.section-gap--read-mode{padding:24px 8px}.section-gap--focused-mode{padding:
|
|
259
|
+
return [_fontStyles.default, _inputStyles.default, _flexStyles.default, _tableStyles.default, _endpointStyles.default, _prismStyles.default, _tabStyles.default, _navStyles.default, _infoStyles.default, _advancedSearchStyles.default, _apiRequestStyles.default, (0, _litElement.css)`:not(:defined){display:none}:host{display:flex;flex-direction:column;width:100%;height:100%;margin:0;padding:0;overflow:hidden;letter-spacing:normal;color:var(--fg);background-color:var(--bg);font-family:var(--font-regular)}.body{display:flex;height:100%;width:100%;overflow:hidden}.main-content{margin:0;padding:0;display:block;flex:1;height:100%;overflow-y:overlay;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--border-color) transparent}.main-content::-webkit-scrollbar{width:8px;height:8px}.main-content::-webkit-scrollbar-track{background:0 0}.main-content::-webkit-scrollbar-thumb{background-color:var(--border-color)}.section-gap.section-tag{border-bottom:1px solid var(--border-color)}.method-section-gap{padding:24px 8px 0 4px}.section-gap{padding:24px 0 0}.section-tag-header{position:relative;cursor:n-resize;padding:12px 0}.collapsed .section-tag-header:hover{cursor:s-resize}.section-tag-header:hover{background-image:linear-gradient(to right,rgba(0,0,0,0),var(--border-color),rgba(0,0,0,0))}.collapsed .section-tag-header:hover::after{color:var(--primary-color)}.collapsed .section-tag-body{display:none}.logo{height:36px;width:36px;margin-left:5px}.only-large-screen,.only-large-screen-flex{display:none}.header-title{font-size:calc(var(--font-size-regular) + 8px);padding:0 8px}.tag.title{text-transform:uppercase}.header{background-color:var(--header-bg);color:var(--header-fg);width:100%}input.header-input{background:var(--header-color-darker);color:var(--header-fg);border:1px solid var(--header-color-border);flex:1;padding-right:24px;border-radius:3px}input.header-input::placeholder{opacity:.4}input:disabled{cursor:not-allowed}.loader{margin:16px auto 16px auto;border:4px solid var(--bg3);border-radius:50%;border-top:4px solid var(--primary-color);width:36px;height:36px;animation:spin 2s linear infinite}.expanded-endpoint-body{position:relative;padding:6px 0}.divider{border-top:2px solid var(--border-color);margin:24px 0;width:100%}.tooltip{border:1px solid var(--border-color);border-left-width:4px;margin-left:2px}.tooltip a{color:var(--fg2);text-decoration:none}.tooltip-text{color:var(--fg2);background-color:var(--bg2);visibility:hidden;overflow-wrap:break-word}.tooltip:hover{color:var(--primary-color);border-color:var(--primary-color)}.tooltip:hover a:hover{color:var(--primary-color)}.tooltip:hover .tooltip-text{visibility:visible;opacity:1}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@media only screen and (max-width:767.98px){.section-padding{margin:1rem}.sub-title.tag{margin-left:1rem}.section-tag-body .description{margin-left:1rem;margin-right:1rem}}@media only screen and (min-width:768px){.nav-bar{width:260px;display:flex}.only-large-screen{display:block}.only-large-screen-flex{display:flex}.section-gap{padding:24px 24px}.section-gap--read-mode{padding:24px 8px}.section-gap--focused-mode{padding:1.5rem}.endpoint-body{position:relative;padding:36px 0 48px 0}}@media only screen and (min-width:1024px){.nav-bar{width:${(0, _litElement.unsafeCSS)(this.fontSize === 'default' ? '300px' : this.fontSize === 'large' ? '315px' : '330px')};display:flex}.section-gap--read-mode{padding:24px 24px 12px}.main-content-inner{padding:24px}}`];
|
|
258
260
|
} // Startup
|
|
259
261
|
|
|
260
262
|
|
|
@@ -263,6 +265,7 @@ class OpenApiExplorer extends _litElement.LitElement {
|
|
|
263
265
|
this.handleResize = this.handleResize.bind(this);
|
|
264
266
|
window.addEventListener('resize', this.handleResize);
|
|
265
267
|
this.loading = true;
|
|
268
|
+
(0, _languages.initI18n)();
|
|
266
269
|
const parent = this.parentElement;
|
|
267
270
|
|
|
268
271
|
if (parent) {
|
|
@@ -410,7 +413,6 @@ class OpenApiExplorer extends _litElement.LitElement {
|
|
|
410
413
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
411
414
|
if (name === 'spec-url') {
|
|
412
415
|
if (oldVal !== newVal) {
|
|
413
|
-
// put it at the end of event-loop to load all the attributes
|
|
414
416
|
window.setTimeout(async () => {
|
|
415
417
|
await this.loadSpec(newVal); // If the initial location is set, then attempt to scroll there
|
|
416
418
|
|
|
@@ -6,6 +6,6 @@ exports.default = void 0;
|
|
|
6
6
|
var _litElement = require("lit-element");
|
|
7
7
|
|
|
8
8
|
/* eslint-disable max-len */
|
|
9
|
-
var _default = (0, _litElement.css)`.m-btn{border-radius:var(--border-radius);font-weight:600;display:inline-block;padding:6px 16px;font-size:var(--font-size-small);outline:0;line-height:1;text-align:center;white-space:nowrap;border:2px solid var(--primary-color);background-color:transparent;transition:background-color .2s;user-select:none;cursor:pointer;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}.m-btn.primary{background-color:var(--primary-color);color:var(--primary-btn-text-color)}.m-btn.thin-border{border-width:1px}.m-btn.large{padding:8px 14px}.m-btn.small{padding:5px 12px}.m-btn.tiny{padding:5px 6px}.m-btn.circle{border-radius:50%}.m-btn:hover{background-color:var(--primary-color);color:var(--primary-btn-text-color)}.m-btn.nav{border:2px solid var(--secondary-color)}.m-btn.nav:hover{background-color:var(--secondary-color)}.m-btn:disabled{background-color:var(--bg3);color:var(--fg3);border-color:var(--fg3);cursor:progress;opacity:.4}.toolbar-copy-btn{cursor:pointer;padding:.125rem .5rem;margin:0 2px;font-size:.8rem;width:
|
|
9
|
+
var _default = (0, _litElement.css)`.m-btn{border-radius:var(--border-radius);font-weight:600;display:inline-block;padding:6px 16px;font-size:var(--font-size-small);outline:0;line-height:1;text-align:center;white-space:nowrap;border:2px solid var(--primary-color);background-color:transparent;transition:background-color .2s;user-select:none;cursor:pointer;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}.m-btn.primary{background-color:var(--primary-color);color:var(--primary-btn-text-color)}.m-btn.thin-border{border-width:1px}.m-btn.large{padding:8px 14px}.m-btn.small{padding:5px 12px}.m-btn.tiny{padding:5px 6px}.m-btn.circle{border-radius:50%}.m-btn:hover{background-color:var(--primary-color);color:var(--primary-btn-text-color)}.m-btn.nav{border:2px solid var(--secondary-color)}.m-btn.nav:hover{background-color:var(--secondary-color)}.m-btn:disabled{background-color:var(--bg3);color:var(--fg3);border-color:var(--fg3);cursor:progress;opacity:.4}.toolbar-copy-btn{cursor:pointer;padding:.125rem .5rem;margin:0 2px;font-size:.8rem;width:60px;color:var(--primary-btn-text-color);border-radius:2px;border:none;background-color:var(--primary-color)}.tab-content .toolbar-copy-btn{position:absolute;top:8px;right:8px;margin-right:8px}.tab-content .toolbar-copy-btn+pre{white-space:pre;max-height:400px;overflow:auto;display:flex;padding-right:70px}button,input,pre,select,textarea{color:var(--fg);outline:0;background-color:var(--input-bg);border:1px solid var(--border-color);border-radius:var(--border-radius)}button{font-family:var(--font-regular)}input[type=file],input[type=password],input[type=text],pre,select,textarea{font-family:var(--font-mono);font-weight:400;font-size:var(--font-size-small);transition:border .2s;padding:6px 5px}select{font-family:var(--font-regular);padding-right:30px;background-image:url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%3E%3Cpath%20d%3D%22M10.3%203.3L6%207.6%201.7%203.3A1%201%200%2000.3%204.7l5%205a1%201%200%20001.4%200l5-5a1%201%200%2010-1.4-1.4z%22%20fill%3D%22%23777777%22%2F%3E%3C%2Fsvg%3E");background-position:calc(100% - 5px) center;background-repeat:no-repeat;background-size:10px;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer}select:hover{border-color:var(--primary-color)}input[type=password]::placeholder,input[type=text]::placeholder,textarea::placeholder{color:var(--placeholder-color);opacity:1}input[type=password]:active,input[type=password]:focus,input[type=text]:active,input[type=text]:focus,select:focus,textarea:active,textarea:focus{border:1px solid var(--primary-color)}input[type=file]{font-family:var(--font-regular);padding:2px;cursor:pointer;border:1px solid var(--primary-color);min-height:calc(var(--font-size-small) + 18px)}input[type=file]::-webkit-file-upload-button{font-family:var(--font-regular);font-size:var(--font-size-small);outline:0;cursor:pointer;padding:3px 8px;border:1px solid var(--primary-color);background-color:var(--primary-color);color:var(--primary-btn-text-color);border-radius:var(--border-radius);-webkit-appearance:none}pre,textarea{scrollbar-width:thin;scrollbar-color:var(--border-color) var(--input-bg)}pre::-webkit-scrollbar,textarea::-webkit-scrollbar{width:8px;height:8px}pre::-webkit-scrollbar-track,textarea::-webkit-scrollbar-track{background:var(--input-bg)}pre::-webkit-scrollbar-thumb,textarea::-webkit-scrollbar-thumb{border-radius:2px;background-color:var(--border-color)}.link{font-size:var(--font-size-small);text-decoration:underline;color:var(--blue);font-family:var(--font-mono);margin-bottom:2px}input[type=checkbox]:focus{outline:0}input[type=checkbox]{appearance:none;display:inline-block;background-color:var(--light-bg);border-radius:9px;cursor:pointer;height:18px;position:relative;transition:border .15s,padding .25s;min-width:36px;width:36px;vertical-align:top}input[type=checkbox]:after{position:absolute;background-color:var(--bg);border-radius:8px;content:'';top:0;left:0;right:16px;display:block;height:16px;transition:left .25s .1s,right .15s .175s}input[type=checkbox]:checked{box-shadow:inset 0 0 0 13px var(--primary-color);border-color:var(--primary-color)}input[type=checkbox]:checked:after{border:1px solid var(--primary-color);left:16px;right:1px;transition:border .25s,left .15s .25s,right .25s .175s}input.oauth-client-id{flex-grow:1;max-width:300px}input.oauth-client-secret{flex-grow:1;max-width:300px}`;
|
|
10
10
|
|
|
11
11
|
exports.default = _default;
|
|
@@ -11,6 +11,8 @@ var _prismjs = _interopRequireDefault(require("prismjs"));
|
|
|
11
11
|
|
|
12
12
|
var _commonUtils = require("../utils/common-utils");
|
|
13
13
|
|
|
14
|
+
var _languages = require("../languages");
|
|
15
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
18
|
/* eslint-disable indent */
|
|
@@ -29,7 +31,7 @@ function codeSamplesTemplate(xCodeSamples) {
|
|
|
29
31
|
});
|
|
30
32
|
}}"> <div class="tab-buttons row" style="width:100"> ${xCodeSamples.map((v, i) => (0, _litElement.html)`<button class="tab-btn ${i === 0 ? 'active' : ''}" data-tab="${v.lang}${i}"> ${v.label || v.lang} </button>`)} </div> ${xCodeSamples.map((v, i) => (0, _litElement.html)` <div class="tab-content m-markdown code-sample-wrapper" style="display:${i === 0 ? 'block' : 'none'}" data-tab="${v.lang}${i}"> <button class="toolbar-copy-btn" @click="${e => {
|
|
31
33
|
(0, _commonUtils.copyToClipboard)(v.source, e);
|
|
32
|
-
}}"
|
|
34
|
+
}}">${(0, _languages.getI18nText)('operations.copy')}</button> <pre>
|
|
33
35
|
<code>${_prismjs.default.languages[v.lang && v.lang.toLowerCase()] ? (0, _unsafeHtml.unsafeHTML)(_prismjs.default.highlight(v.source, _prismjs.default.languages[v.lang && v.lang.toLowerCase()], v.lang && v.lang.toLowerCase())) : v.source}</code>
|
|
34
36
|
</pre> </div>`)} </div></section>`;
|
|
35
37
|
}
|
|
@@ -24,6 +24,6 @@ function componentBodyTemplate(sComponent) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function componentsTemplate() {
|
|
27
|
-
return (0, _litElement.html)` ${this.resolvedSpec.components.map(component => (0, _litElement.html)` <div id="cmp--${component.name.toLowerCase()}" class="regular-font section-gap--
|
|
27
|
+
return (0, _litElement.html)` ${this.resolvedSpec.components.map(component => (0, _litElement.html)` <div id="cmp--${component.name.toLowerCase()}" class="regular-font section-gap--focused-mode observe-me" style="padding-bottom:0"> <div class="title tag">${component.name}</div> <div class="regular-font-size"> ${(0, _unsafeHtml.unsafeHTML)(`<div class='m-markdown regular-font'>${(0, _marked.marked)(component.description ? component.description : '')}</div>`)} </div> </div> <div class="regular-font section-gap--focused-mode" style="padding-top:0"> ${component.subComponents.filter(c => c.expanded).map(sComponent => componentBodyTemplate.call(this, sComponent))} </div> `)} `;
|
|
28
28
|
}
|
|
29
29
|
/* eslint-enable indent */
|
|
@@ -11,6 +11,8 @@ var _marked = require("marked");
|
|
|
11
11
|
|
|
12
12
|
var _commonUtils = require("../utils/common-utils");
|
|
13
13
|
|
|
14
|
+
var _languages = require("../languages");
|
|
15
|
+
|
|
14
16
|
function onExpandCollapse(tagId) {
|
|
15
17
|
const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
|
|
16
18
|
|
|
@@ -50,7 +52,7 @@ function expandCollapseAllComponents() {
|
|
|
50
52
|
function navbarTemplate() {
|
|
51
53
|
var _this$resolvedSpec$co;
|
|
52
54
|
|
|
53
|
-
return (0, _litElement.html)` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : (0, _litElement.html)` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px;${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}"> ${this.allowSearch === 'false' ? '' : (0, _litElement.html)` <div style="display:flex;flex:1;line-height:22px"> <input id="nav-bar-search" part="textbox textbox-nav-filter" style="width:100%;padding-right:20px;color:var(--nav-hover-text-color);border-color:var(--secondary-color);background-color:var(--nav-hover-bg-color)" type="text" placeholder="
|
|
55
|
+
return (0, _litElement.html)` <nav class="nav-bar ${this.renderStyle}" part="section-navbar"> ${this.allowSearch === 'false' && this.allowAdvancedSearch === 'false' ? '' : (0, _litElement.html)` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px;${this.allowAdvancedSearch === 'false' ? 'border-bottom: 1px solid var(--nav-hover-bg-color)' : ''}"> ${this.allowSearch === 'false' ? '' : (0, _litElement.html)` <div style="display:flex;flex:1;line-height:22px"> <input id="nav-bar-search" part="textbox textbox-nav-filter" style="width:100%;padding-right:20px;color:var(--nav-hover-text-color);border-color:var(--secondary-color);background-color:var(--nav-hover-bg-color)" type="text" placeholder="${(0, _languages.getI18nText)('menu.filter')}" @change="${this.onSearchChange}" spellcheck="false"> <div style="margin:6px 5px 0 -24px;font-size:var(--font-size-regular);cursor:pointer">↩</div> </div> ${this.matchPaths ? (0, _litElement.html)` <div @click="${this.onClearSearch}" style="margin-left:5px;cursor:pointer;align-self:center;color:var(--nav-text-color)" class="small-font-size primary-text bold-text"> CLEAR </div>` : ''} `} ${this.allowAdvancedSearch === 'false' || this.matchPaths ? '' : (0, _litElement.html)` <button class="m-btn primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> ${(0, _languages.getI18nText)('menu.search')} </button> `} </div> `} ${(0, _litElement.html)`<nav class="nav-scroll" part="navbar-scroll"> ${this.showInfo === 'false' || !this.resolvedSpec.info ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}"> ${this.isV1 && this.resolvedSpec.info.title || (0, _languages.getI18nText)('menu.overview')} </div>`} ${this.allowServerSelection === 'false' ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}"> ${(0, _languages.getI18nText)('menu.api-servers')} </div>`} ${this.allowAuthentication === 'false' || !this.resolvedSpec.securitySchemes ? '' : (0, _litElement.html)`<div class="nav-bar-info" id="link-auth" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> ${(0, _languages.getI18nText)('menu.authentication')} </div>`} <slot name="nav-section" class="custom-nav-section" data-content-id="section" @click="${e => this.scrollToCustomNavSectionTarget(e, false)}"></slot> <div class="sticky-scroll-element"> <div class="nav-bar-section" part="navbar-operations-header"> <slot name="operations-header"> <div class="nav-bar-section-title">${(0, _languages.getI18nText)('menu.operations')}</div> </slot> <div style="" part="navbar-operations-header-collapse"> ${this.resolvedSpec.tags.length > 1 && this.resolvedSpec.tags.some(tag => tag.paths.some(path => (0, _commonUtils.pathIsInSearch)(this.matchPaths, path))) ? (0, _litElement.html)` ${this.operationsCollapsed ? (0, _litElement.html)`<div @click="${() => {
|
|
54
56
|
expandCollapseAll.call(this);
|
|
55
57
|
}}" style="font-size:16px;transform:rotate(0);cursor:pointer">▸</div>` : (0, _litElement.html)`<div @click="${() => {
|
|
56
58
|
expandCollapseAll.call(this);
|
|
@@ -58,7 +60,7 @@ function navbarTemplate() {
|
|
|
58
60
|
onExpandCollapse.call(this, tag.elementId);
|
|
59
61
|
}}"> <div style="display:flex;justify-content:space-between;width:100%"> <div>${tag.name}</div> <div class="nav-bar-tag-icon expand-button-arrow">▸</div> <div class="nav-bar-tag-icon collapse-button-arrow">▾</div> </div> </div> `} <div class="tag-headers"> ${tag.headers.map(header => (0, _litElement.html)` <div class="nav-bar-h${header.depth}" id="link-${tag.elementId}--${new _marked.marked.Slugger().slug(header.text)}" data-content-id="${tag.elementId}--${new _marked.marked.Slugger().slug(header.text)}" @click="${e => this.scrollToEventTarget(e, false)}"> ${header.text} </div>`)} </div> <div class="nav-bar-paths-under-tag"> ${tag.paths.filter(v => (0, _commonUtils.pathIsInSearch)(this.matchPaths, v)).map(p => (0, _litElement.html)` <div class="nav-bar-path ${this.usePathInNavBar === 'true' ? 'small-font' : ''}" data-content-id="${p.elementId}" id="link-${p.elementId}" @click="${e => {
|
|
60
62
|
this.scrollToEventTarget(e, false);
|
|
61
|
-
}}"> <span style="line-break:anywhere;${p.deprecated ? 'filter:opacity(0.5)' : ''}"> ${this.usePathInNavBar === 'true' ? (0, _litElement.html)`<span class="mono-font">${p.method.toUpperCase()} ${p.path}</span>` : p.summary || p.shortSummary} ${p.isWebhook ? '(Webhook)' : ''} </span> </div>`)} </div> </div> </slot> `)} ${(_this$resolvedSpec$co = this.resolvedSpec.components) !== null && _this$resolvedSpec$co !== void 0 && _this$resolvedSpec$co.length && !this.hideComponents ? (0, _litElement.html)` <div class="sticky-scroll-element"> <div id="link-components" class="nav-bar-section"> <slot name="components-header"> <div class="nav-bar-section-title"
|
|
63
|
+
}}"> <span style="line-break:anywhere;${p.deprecated ? 'filter:opacity(0.5)' : ''}"> ${this.usePathInNavBar === 'true' ? (0, _litElement.html)`<span class="mono-font">${p.method.toUpperCase()} ${p.path}</span>` : p.summary || p.shortSummary} ${p.isWebhook ? '(Webhook)' : ''} </span> </div>`)} </div> </div> </slot> `)} ${(_this$resolvedSpec$co = this.resolvedSpec.components) !== null && _this$resolvedSpec$co !== void 0 && _this$resolvedSpec$co.length && !this.hideComponents ? (0, _litElement.html)` <div class="sticky-scroll-element"> <div id="link-components" class="nav-bar-section"> <slot name="components-header"> <div class="nav-bar-section-title">${(0, _languages.getI18nText)('menu.components')}</div> </slot> ${this.resolvedSpec.components.some(c => c.subComponents.some(s => (0, _commonUtils.componentIsInSearch)(this.matchPaths, s))) ? (0, _litElement.html)` <div style="" part="navbar-components-header-collapse"> ${this.componentsCollapsed ? (0, _litElement.html)`<div @click="${() => {
|
|
62
64
|
expandCollapseAllComponents.call(this);
|
|
63
65
|
}}" style="font-size:16px;transform:rotate(0);cursor:pointer">▸</div>` : (0, _litElement.html)`<div @click="${() => {
|
|
64
66
|
expandCollapseAllComponents.call(this);
|
|
@@ -9,8 +9,10 @@ var _unsafeHtml = require("lit-html/directives/unsafe-html.js");
|
|
|
9
9
|
|
|
10
10
|
var _marked = require("marked");
|
|
11
11
|
|
|
12
|
+
var _languages = require("../languages");
|
|
13
|
+
|
|
12
14
|
/* eslint-disable indent */
|
|
13
15
|
function overviewTemplate() {
|
|
14
|
-
return (0, _litElement.html)` <section id="overview" part="section-overview" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> ${this.resolvedSpec && this.resolvedSpec.info ? (0, _litElement.html)` <slot name="overview"> <div id="api-title" part="label-overview-title" style="font-size:32px" class="section-padding"> ${this.resolvedSpec.info.title} ${!this.resolvedSpec.info.version ? '' : (0, _litElement.html)` <span style="font-size:var(--font-size-small);font-weight:700"> ${this.resolvedSpec.info.version} </span>`} </div> <div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px);margin-top:8px" class="section-padding"> ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.email ? (0, _litElement.html)`<span>${this.resolvedSpec.info.contact.name || '
|
|
16
|
+
return (0, _litElement.html)` <section id="overview" part="section-overview" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> ${this.resolvedSpec && this.resolvedSpec.info ? (0, _litElement.html)` <slot name="overview"> <div id="api-title" part="label-overview-title" style="font-size:32px" class="section-padding"> ${this.resolvedSpec.info.title} ${!this.resolvedSpec.info.version ? '' : (0, _litElement.html)` <span style="font-size:var(--font-size-small);font-weight:700"> ${this.resolvedSpec.info.version} </span>`} </div> <div id="api-info" style="font-size:calc(var(--font-size-regular) - 1px);margin-top:8px" class="section-padding"> ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.email ? (0, _litElement.html)`<span>${this.resolvedSpec.info.contact.name || (0, _languages.getI18nText)('overview.email')}: <a href="mailto:${this.resolvedSpec.info.contact.email}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.email}</a> </span>` : ''} ${this.resolvedSpec.info.contact && this.resolvedSpec.info.contact.url ? (0, _litElement.html)`<span>URL: <a href="${this.resolvedSpec.info.contact.url}" part="anchor anchor-overview">${this.resolvedSpec.info.contact.url}</a></span>` : ''} ${this.resolvedSpec.info.license ? (0, _litElement.html)`<span>License: ${this.resolvedSpec.info.license.url ? (0, _litElement.html)`<a href="${this.resolvedSpec.info.license.url}" part="anchor anchor-overview">${this.resolvedSpec.info.license.name}</a>` : this.resolvedSpec.info.license.name} </span>` : ''} ${this.resolvedSpec.info.termsOfService ? (0, _litElement.html)`<span><a href="${this.resolvedSpec.info.termsOfService}" part="anchor anchor-overview">${(0, _languages.getI18nText)('overview.terms-of-service')}</a></span>` : ''} </div> </slot> <slot name="overview-api-description"> ${this.resolvedSpec.info.description ? (0, _litElement.html)`${(0, _unsafeHtml.unsafeHTML)(`<div class="m-markdown regular-font section-padding">${(0, _marked.marked)(this.resolvedSpec.info.description)}</div>`)}` : ''} </slot> ` : ''} </section> `;
|
|
15
17
|
}
|
|
16
18
|
/* eslint-enable indent */
|
|
@@ -13,6 +13,8 @@ var _marked = require("marked");
|
|
|
13
13
|
|
|
14
14
|
var _base64url = _interopRequireDefault(require("base64url"));
|
|
15
15
|
|
|
16
|
+
var _languages = require("../languages");
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
function onApiKeyChange(apiKeyId, e) {
|
|
@@ -293,16 +295,16 @@ function securitySchemeTemplate() {
|
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
const providedApiKeys = schemes.filter(v => v.finalKeyValue);
|
|
296
|
-
return (0, _litElement.html)` <section id="auth" part="section-auth" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="authentication"> <div class="section-padding"> <div class="sub-title regular-font"
|
|
298
|
+
return (0, _litElement.html)` <section id="auth" part="section-auth" class="observe-me ${this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <slot name="authentication"> <div class="section-padding"> <div class="sub-title regular-font">${(0, _languages.getI18nText)('headers.authentication')}</div> <div class="small-font-size" style="display:flex;align-items:center;min-height:30px"> ${providedApiKeys.length > 0 ? (0, _litElement.html)` <div class="blue-text"> ${providedApiKeys.length} API key applied </div> <div style="flex:1"></div> <button class="m-btn thin-border" part="btn btn-outline" @click="${() => {
|
|
297
299
|
onClearAllApiKeys.call(this);
|
|
298
|
-
}}">CLEAR ALL API KEYS</button>` : (0, _litElement.html)`<div class="red-text"
|
|
300
|
+
}}">CLEAR ALL API KEYS</button>` : (0, _litElement.html)`<div class="red-text">${(0, _languages.getI18nText)('authentication.no-api-key-applied')}</div>`} </div> ${schemes.length > 0 ? (0, _litElement.html)` <table role="presentation" class="m-table" style="width:100%"> ${schemes.map(v => (0, _litElement.html)` <tr> <td style="max-width:500px;overflow-wrap:break-word"> <div style="min-height:24px"> <span style="font-weight:700">${v.typeDisplay}</span> ${v.finalKeyValue ? (0, _litElement.html)` <span class="blue-text"> ${v.finalKeyValue ? 'Key Applied' : ''} </span> <button class="m-btn thin-border small" part="btn btn-outline" @click="${() => {
|
|
299
301
|
v.finalKeyValue = '';
|
|
300
302
|
this.requestUpdate();
|
|
301
303
|
}}">REMOVE</button> ` : ''} </div> ${v.description ? (0, _litElement.html)` <div class="m-markdown"> ${(0, _unsafeHtml.unsafeHTML)((0, _marked.marked)(v.description || ''))} </div>` : ''} </td> <td> ${v.type && (v.type.toLowerCase() === 'apikey' || v.type.toLowerCase() === 'http' && v.scheme && v.scheme.toLowerCase() === 'bearer') ? (0, _litElement.html)` ${v.type.toLowerCase() === 'apikey' ? (0, _litElement.html)`Send <code>${v.name}</code> in <code>${v.in}</code> with the given value:` : (0, _litElement.html)`Send <code>Authorization</code> in <code>header</code> containing the word <code>Bearer</code> followed by a space and a Token String.`} <form style="display:flex"> ${v.in === 'cookie' ? (0, _litElement.html)` <div style="display:block"> <input type="text" value="${getCookieValue(v.apiKeyId)}" disabled="disabled" class="api-key-input" placeholder="IygRVGf54B59e0GAkKmigGfuiVlp/uhFfk2ifA+jMMJzau2F1jPldc09gPTfnMw13BFBxqUZIFDm55DPfwkb0A==" spellcheck="false" style="resize:horizontal;width:100%"> <br> <small> <strong>Cookies</strong> are set and configured by the remote service, therefore it is not possible to configure them from the browser. </small> </div>` : (0, _litElement.html)` <input type="text" value="${v.value}" class="api-key-input" placeholder="api-token" spellcheck="false"> <button type="submit" class="m-btn thin-border" style="margin-left:5px" part="btn btn-outline" @click="${e => {
|
|
302
304
|
onApiKeyChange.call(this, v.apiKeyId, e);
|
|
303
|
-
}}"> ${v.finalKeyValue ? 'UPDATE' : 'SET'} </button>`} </form>` : ''} ${v.type && v.type.toLowerCase() === 'http' && v.scheme && v.scheme.toLowerCase() === 'basic' ? (0, _litElement.html)`
|
|
305
|
+
}}"> ${v.finalKeyValue ? 'UPDATE' : 'SET'} </button>`} </form>` : ''} ${v.type && v.type.toLowerCase() === 'http' && v.scheme && v.scheme.toLowerCase() === 'basic' ? (0, _litElement.html)` ${(0, _languages.getI18nText)('authentication.http-basic-desc')} <form style="display:flex"> <input type="text" value="${v.user}" placeholder="${(0, _languages.getI18nText)('authentication.username')}" spellcheck="false" class="api-key-user" style="width:100px"> <input type="password" value="${v.password}" placeholder="${(0, _languages.getI18nText)('authentication.password')}" spellcheck="false" class="api-key-password" style="width:100px;margin:0 5px"> <button type="submit" class="m-btn thin-border" @click="${e => {
|
|
304
306
|
onApiKeyChange.call(this, v.apiKeyId, e);
|
|
305
|
-
}}" part="btn btn-outline"> ${v.finalKeyValue ? 'UPDATE' : '
|
|
307
|
+
}}" part="btn btn-outline"> ${v.finalKeyValue ? 'UPDATE' : (0, _languages.getI18nText)('authentication.set')} </button> </form>` : ''} </td> </tr> ${v.type.toLowerCase() === 'oauth2' ? (0, _litElement.html)` <tr> <td colspan="2" style="border:none;padding-left:48px"> ${Object.keys(v.flows).map(f => oAuthFlowTemplate.call(this, f, v, v.flows[f]))} </td> </tr> ` : ''} `)} </table>` : ''} </div> </slot> </section> `;
|
|
306
308
|
}
|
|
307
309
|
|
|
308
310
|
function getOauthScopeTemplate(scopes) {
|
|
@@ -334,7 +336,7 @@ function pathSecurityTemplate(pathSecurity) {
|
|
|
334
336
|
securityDefs: andSecurityKeys1
|
|
335
337
|
});
|
|
336
338
|
});
|
|
337
|
-
return (0, _litElement.html)`<div class="security-info-button" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> <div style="position:relative;display:flex;min-width:350px;max-width:700px;justify-content:flex-end"> <svg width="16" height="24" style="cursor:pointer"> <g> <path style="fill:var(--fg3)" d="m13.8,8.5l0,-2.6l0,0c0,-3.2 -2.6,-5.8 -5.8,-5.8s-5.8,2.6 -5.8,5.8l0,0l0,2.6l-2.1,0l0,11.2l16,0l0,-11.2l-2.1,0l-0,0l0,0l0,0l-0,0zm-9.8,-2.6c0,0 0,0 0,0c0,-2.2 1.8,-4 4,-4c2.2,0 4,1.8 4,4c0,0 0,0 0,0l0,2.6l-8.03,0l0,-2.6l0,0l0,0z"/> </g> </svg> ${orSecurityKeys1.map((orSecurityItem1, i) => (0, _litElement.html)` ${i !== 0 ? (0, _litElement.html)`<div style="padding:3px 4px"> OR </div>` : ''} <div class="tooltip" style="cursor:pointer"> <div style="padding:2px 4px;white-space:nowrap;text-overflow:ellipsis;max-width:150px;overflow:hidden"> <span part="anchor anchor-operation-security"> ${orSecurityItem1.securityTypes} </span> </div> <div class="tooltip-text" style="position:absolute;color:var(--fg);top:26px;right:0;border:1px solid var(--border-color);padding:2px 4px;display:block"> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<div>Requires <b>all</b> of the following </div>` : ''} <div style="padding-left:8px"> ${orSecurityItem1.securityDefs.map((andSecurityItem, j) => (0, _litElement.html)` ${andSecurityItem.type === 'oauth2' ? (0, _litElement.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<b>${j + 1}.</b> ` : (0, _litElement.html)`Requires`} OAuth token (${andSecurityItem.apiKeyId}) in <b>Authorization header</b> ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>` : andSecurityItem.type === 'http' ? (0, _litElement.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<b>${j + 1}.</b> ` : (0, _litElement.html)`
|
|
339
|
+
return (0, _litElement.html)`<div class="security-info-button" data-content-id="auth" @click="${e => this.scrollToEventTarget(e, false)}"> <div style="position:relative;display:flex;min-width:350px;max-width:700px;justify-content:flex-end"> <svg width="16" height="24" style="cursor:pointer"> <g> <path style="fill:var(--fg3)" d="m13.8,8.5l0,-2.6l0,0c0,-3.2 -2.6,-5.8 -5.8,-5.8s-5.8,2.6 -5.8,5.8l0,0l0,2.6l-2.1,0l0,11.2l16,0l0,-11.2l-2.1,0l-0,0l0,0l0,0l-0,0zm-9.8,-2.6c0,0 0,0 0,0c0,-2.2 1.8,-4 4,-4c2.2,0 4,1.8 4,4c0,0 0,0 0,0l0,2.6l-8.03,0l0,-2.6l0,0l0,0z"/> </g> </svg> ${orSecurityKeys1.map((orSecurityItem1, i) => (0, _litElement.html)` ${i !== 0 ? (0, _litElement.html)`<div style="padding:3px 4px"> OR </div>` : ''} <div class="tooltip" style="cursor:pointer"> <div style="padding:2px 4px;white-space:nowrap;text-overflow:ellipsis;max-width:150px;overflow:hidden"> <span part="anchor anchor-operation-security"> ${orSecurityItem1.securityTypes} </span> </div> <div class="tooltip-text" style="position:absolute;color:var(--fg);top:26px;right:0;border:1px solid var(--border-color);padding:2px 4px;display:block"> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<div>Requires <b>all</b> of the following </div>` : ''} <div style="padding-left:8px"> ${orSecurityItem1.securityDefs.map((andSecurityItem, j) => (0, _litElement.html)` ${andSecurityItem.type === 'oauth2' ? (0, _litElement.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<b>${j + 1}.</b> ` : (0, _litElement.html)`Requires`} OAuth token (${andSecurityItem.apiKeyId}) in <b>Authorization header</b> ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>` : andSecurityItem.type === 'http' ? (0, _litElement.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<b>${j + 1}.</b> ` : (0, _litElement.html)`${(0, _languages.getI18nText)('authentication.requires')}`} ${andSecurityItem.scheme === 'basic' ? (0, _languages.getI18nText)('authentication.http-basic-note') : 'Bearer Token'} ${(0, _languages.getI18nText)('authentication.in-auth-header')} ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>` : (0, _litElement.html)` <div> ${orSecurityItem1.securityDefs.length > 1 ? (0, _litElement.html)`<b>${j + 1}.</b> ` : (0, _litElement.html)`Requires`} Token in <b>${andSecurityItem.name} ${andSecurityItem.in}</b> ${getOauthScopeTemplate(andSecurityItem.scopes)} </div>`} `)} </div> </div> </div> `)} </div> </div>`;
|
|
338
340
|
}
|
|
339
341
|
|
|
340
342
|
return '';
|
|
@@ -9,6 +9,8 @@ var _marked = require("marked");
|
|
|
9
9
|
|
|
10
10
|
var _unsafeHtml = require("lit-html/directives/unsafe-html.js");
|
|
11
11
|
|
|
12
|
+
var _languages = require("../languages");
|
|
13
|
+
|
|
12
14
|
function onApiServerChange(e, server) {
|
|
13
15
|
if (e && e.target.checked) {
|
|
14
16
|
this.selectedServer = server;
|
|
@@ -30,7 +32,7 @@ function onApiServerVarChange(e, serverObj) {
|
|
|
30
32
|
|
|
31
33
|
|
|
32
34
|
function serverVarsTemplate() {
|
|
33
|
-
return this.selectedServer && this.selectedServer.variables ? (0, _litElement.html)` <div class="table-title"
|
|
35
|
+
return this.selectedServer && this.selectedServer.variables ? (0, _litElement.html)` <div class="table-title">${(0, _languages.getI18nText)('api-servers.server-variables')}</div> <table role="presentation" class="m-table"> ${Object.entries(this.selectedServer.variables).map(kv => (0, _litElement.html)` <tr> <td style="vertical-align:middle">${kv[0]}</td> <td> ${kv[1].enum ? (0, _litElement.html)` <select data-var="${kv[0]}" @input="${e => {
|
|
34
36
|
onApiServerVarChange.call(this, e, this.selectedServer);
|
|
35
37
|
}}"> ${Object.entries(kv[1].enum).map(e => kv[1].default === e[1] ? (0, _litElement.html)` <option selected="selected" label="${e[1]}" value="${e[1]}">` : (0, _litElement.html)` <option label="${e[1]}" value="${e[1]}">`)} </select>` : (0, _litElement.html)` <input type="text" part="textbox textbox-server-var" spellcheck="false" data-var="${kv[0]}" value="${kv[1].default}" @input="${e => {
|
|
36
38
|
onApiServerVarChange.call(this, e, this.selectedServer);
|
|
@@ -42,8 +44,8 @@ function serverTemplate() {
|
|
|
42
44
|
return undefined;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
return (0, _litElement.html)` <section id="servers" part="section-servers" style="margin-top:24px;margin-bottom:24px" class="regular-font observe-me section-padding ${this.renderStyle === 'read' ? 'section-gap--read-mode' : this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <div class="sub-title"
|
|
47
|
+
return (0, _litElement.html)` <section id="servers" part="section-servers" style="margin-top:24px;margin-bottom:24px" class="regular-font observe-me section-padding ${this.renderStyle === 'read' ? 'section-gap--read-mode' : this.renderStyle === 'focused' ? 'section-gap--focused-mode' : 'section-gap'}"> <div class="sub-title">${(0, _languages.getI18nText)('headers.api-servers')}</div> <div class="mono-font" style="margin:12px 0;font-size:calc(var(--font-size-small) + 1px)"> ${!this.resolvedSpec.servers || !this.resolvedSpec.servers.length ? '' : (0, _litElement.html)` ${this.resolvedSpec.servers.map((server, i) => (0, _litElement.html)` <input type="radio" name="api_server" id="srvr-opt-${i}" value="${server.url}" @change="${e => {
|
|
46
48
|
onApiServerChange.call(this, e, server);
|
|
47
|
-
}}" .checked="${this.selectedServer.url === server.url}" style="margin:4px 0;cursor:pointer"> <label style="cursor:pointer" for="srvr-opt-${i}"> ${server.url} ${server.description ? (0, _litElement.html)`- <span class="regular-font">${server.description} </span>` : ''} </label> <br> `)} `} <div class="table-title primary-text" part="label-selected-server">
|
|
49
|
+
}}" .checked="${this.selectedServer.url === server.url}" style="margin:4px 0;cursor:pointer"> <label style="cursor:pointer" for="srvr-opt-${i}"> ${server.url} ${server.description ? (0, _litElement.html)`- <span class="regular-font">${server.description} </span>` : ''} </label> <br> `)} `} <div class="table-title primary-text" part="label-selected-server"> ${(0, _languages.getI18nText)('api-servers.selected')}: ${this.selectedServer && this.selectedServer.computedUrl || 'none'}</div> </div> <slot name="servers"></slot> ${serverVarsTemplate.call(this)} </section>`;
|
|
48
50
|
}
|
|
49
51
|
/* eslint-enable indent */
|