rapidoc 9.3.7 → 9.3.8

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.
@@ -5,6 +5,8 @@
5
5
  <meta charset="utf-8">
6
6
  <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
7
7
  <title>RapiDoc</title>
8
+ <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/default.min.css">
9
+ <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/highlight.min.js"></script>
8
10
  </head>
9
11
 
10
12
  <script>
@@ -26,27 +28,32 @@
26
28
  https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
27
29
  ./specs/petstore_anyof.yaml <<< contains complex one-of with inline primitives and recursive objects
28
30
  ./specs/oneof1.yaml <<< nested oneof
31
+ https://cesdev.eng.sonicwall.com/api/q/openapi
29
32
  -->
30
33
  <rapi-doc
31
- spec-url = "./specs/petstore.yaml"
32
- route-prefix="#tab-pets/"
34
+ spec-url = "./specs/temp.yaml"
33
35
  id="thedoc"
34
36
  theme = "dark"
35
- render-style="read"
37
+ render-style="focused"
36
38
  schema-style="tree"
37
- use-path-in-nav-bar="true"
39
+ show-method-in-nav-bar = "true"
40
+ use-path-in-nav-bar = "true"
38
41
  show-components = "true"
39
42
  show-info = "true"
40
43
  show-header = "true"
41
- allow-search = "false"
44
+ allow-search = "true"
42
45
  allow-advanced-search = "true"
43
46
  allow-spec-url-load="false"
44
- allow-spec-file-load="false"
45
47
  allow-spec-file-download="true"
46
48
  allow-server-selection = "true"
47
49
  allow-authentication = "true"
50
+ update-route="false"
51
+ remove-endpoints-with-badge-label-as="one"
48
52
  match-type="regex"
49
53
  persist-auth="true"
54
+ scroll-behavior="smooth"
55
+ allow-try = "false"
56
+ show-curl-before-try = "true"
50
57
  ></rapi-doc>
51
58
  <!--
52
59
  <rapi-doc-mini
package/jsconfig.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "baseUrl": ".",
6
6
  // Relative to "baseUrl"
7
7
  "paths": {
8
- "@/*": ["./src/*"],
8
+ "~/*": ["./src/*"],
9
9
  }
10
10
  }
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapidoc",
3
- "version": "9.3.7",
3
+ "version": "9.3.8",
4
4
  "description": "RapiDoc - Open API spec viewer with built in console",
5
5
  "author": "Mrinmoy Majumdar <mrin9@yahoo.com>",
6
6
  "homepage": "https://rapidocweb.com",
@@ -36,7 +36,7 @@
36
36
  "@apitools/openapi-parser": "0.0.33",
37
37
  "base64-arraybuffer": "^1.0.2",
38
38
  "buffer": "^6.0.3",
39
- "lit": "^3.2.0",
39
+ "lit": "^3.2.1",
40
40
  "marked": "4.3.0",
41
41
  "prismjs": "^1.29.0",
42
42
  "randexp": "^0.5.3",
@@ -52,9 +52,9 @@
52
52
  "lint-fix": "./node_modules/eslint/bin/eslint.js --fix ./src/**"
53
53
  },
54
54
  "devDependencies": {
55
- "@babel/core": "^7.25.2",
56
- "@babel/eslint-parser": "^7.25.1",
57
- "@babel/preset-env": "^7.25.4",
55
+ "@babel/core": "^7.25.8",
56
+ "@babel/eslint-parser": "^7.25.8",
57
+ "@babel/preset-env": "^7.25.8",
58
58
  "babel-loader": "^9.2.1",
59
59
  "babel-plugin-template-html-minifier": "^4.1.0",
60
60
  "clean-webpack-plugin": "^4.0.0",
@@ -63,7 +63,7 @@
63
63
  "eslint": "^8.57.1",
64
64
  "eslint-config-airbnb": "^19.0.4",
65
65
  "eslint-import-resolver-webpack": "^0.13.9",
66
- "eslint-plugin-import": "^2.30.0",
66
+ "eslint-plugin-import": "^2.31.0",
67
67
  "eslint-webpack-plugin": "4.2.0",
68
68
  "file-loader": "^6.2.0",
69
69
  "filemanager-webpack-plugin": "^8.0.0",
@@ -72,7 +72,7 @@
72
72
  "style-loader": "^4.0.0",
73
73
  "terser-webpack-plugin": "^5.3.10",
74
74
  "unminified-webpack-plugin": "^3.0.0",
75
- "webpack": "^5.94.0",
75
+ "webpack": "^5.95.0",
76
76
  "webpack-bundle-analyzer": "^4.10.2",
77
77
  "webpack-cli": "^5.1.4",
78
78
  "webpack-dev-server": "4.11.1"
@@ -203,6 +203,7 @@ export default class ApiRequest extends LitElement {
203
203
  ];
204
204
  }
205
205
 
206
+ /* eslint-disable indent */
206
207
  render() {
207
208
  return html`
208
209
  <div class="col regular-font request-panel ${'read focused'.includes(this.renderStyle) || this.callback === 'true' ? 'read-mode' : 'view-mode'}">
@@ -274,7 +275,6 @@ export default class ApiRequest extends LitElement {
274
275
  }
275
276
  }
276
277
 
277
- /* eslint-disable indent */
278
278
  renderExample(example, paramType, paramName) {
279
279
  return html`
280
280
  ${paramType === 'array' ? '[' : ''}
@@ -399,7 +399,10 @@ export default class ApiRequest extends LitElement {
399
399
  <tr title="${param.deprecated ? 'Deprecated' : ''}">
400
400
  <td rowspan="${this.allowTry === 'true' ? '1' : '2'}" style="width:${labelColWidth}; min-width:100px;">
401
401
  <div class="param-name ${param.deprecated ? 'deprecated' : ''}" >
402
- ${param.deprecated ? html`<span style='color:var(--red);'>✗</span>` : ''}
402
+ ${param.deprecated
403
+ ? 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>`
404
+ : ''
405
+ }
403
406
  ${param.required ? html`<span style='color:var(--red)'>*</span>` : ''}
404
407
  ${param.name}
405
408
  </div>
@@ -435,19 +438,19 @@ export default class ApiRequest extends LitElement {
435
438
  </tag-input>`
436
439
  : paramSchema.type === 'object'
437
440
  ? html`
438
- <div class="tab-panel col" style="border-width:0 0 1px 0;">
439
- <div class="tab-buttons row" @click="${(e) => {
441
+ <div part="tab-panel" class="tab-panel col" style="border-width:0 0 1px 0;">
442
+ <div part="tab-btn-row" class="tab-buttons row" @click="${(e) => {
440
443
  if (e.target.tagName.toLowerCase() === 'button') {
441
444
  const newState = { ...this.activeParameterSchemaTabs };
442
445
  newState[param.name] = e.target.dataset.tab;
443
446
  this.activeParameterSchemaTabs = newState;
444
447
  }
445
448
  }}">
446
- <button class="tab-btn ${this.activeParameterSchemaTabs[param.name] === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE </button>
447
- <button class="tab-btn ${this.activeParameterSchemaTabs[param.name] !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
449
+ <button part="tab-btn" class="tab-btn ${this.activeParameterSchemaTabs[param.name] === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE </button>
450
+ <button part="tab-btn" class="tab-btn ${this.activeParameterSchemaTabs[param.name] !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
448
451
  </div>
449
452
 
450
- ${html`<div class="tab-content col" data-tab = 'example' style="display:${this.activeParameterSchemaTabs[param.name] === 'example' ? 'block' : 'none'}; padding-left:5px; width:100%">
453
+ ${html`<div part="tab-content" class="tab-content col" data-tab = 'example' style="display:${this.activeParameterSchemaTabs[param.name] === 'example' ? 'block' : 'none'}; padding-left:5px; width:100%">
451
454
  <textarea
452
455
  id = "textarea-request-param-${param.name}"
453
456
  class = "textarea request-param"
@@ -469,7 +472,7 @@ export default class ApiRequest extends LitElement {
469
472
  ></textarea>
470
473
  </div>`
471
474
  }
472
- ${html`<div class="tab-content col" data-tab = 'schema' style="display:${this.activeParameterSchemaTabs[param.name] !== 'example' ? 'block' : 'none'}; padding-left:5px; width:100%;">
475
+ ${html`<div part="tab-content" class="tab-content col" data-tab = 'schema' style="display:${this.activeParameterSchemaTabs[param.name] !== 'example' ? 'block' : 'none'}; padding-left:5px; width:100%;">
473
476
  <schema-tree
474
477
  class = 'json'
475
478
  style = 'display: block'
@@ -787,13 +790,13 @@ export default class ApiRequest extends LitElement {
787
790
 
788
791
  ${(this.selectedRequestBodyType.includes('json') || this.selectedRequestBodyType.includes('xml') || this.selectedRequestBodyType.includes('text') || this.selectedRequestBodyType.includes('jose'))
789
792
  ? html`
790
- <div class="tab-panel col" style="border-width:0 0 1px 0;">
791
- <div class="tab-buttons row" @click="${(e) => { if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}">
792
- <button class="tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE</button>
793
- <button class="tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
793
+ <div part="tab-panel" class="tab-panel col" style="border-width:0 0 1px 0;">
794
+ <div part="tab-btn-row" class="tab-buttons row" @click="${(e) => { if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}">
795
+ <button part="tab-btn" class="tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE</button>
796
+ <button part="tab-btn" class="tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema'>SCHEMA</button>
794
797
  </div>
795
- ${html`<div class="tab-content col" style="display:${this.activeSchemaTab === 'example' ? 'block' : 'none'};"> ${reqBodyExampleHtml}</div>`}
796
- ${html`<div class="tab-content col" style="display:${this.activeSchemaTab === 'example' ? 'none' : 'block'};"> ${reqBodySchemaHtml}</div>`}
798
+ ${html`<div part="tab-content" class="tab-content col" style="display:${this.activeSchemaTab === 'example' ? 'block' : 'none'};"> ${reqBodyExampleHtml}</div>`}
799
+ ${html`<div part="tab-content" class="tab-content col" style="display:${this.activeSchemaTab === 'example' ? 'none' : 'block'};"> ${reqBodySchemaHtml}</div>`}
797
800
  </div>`
798
801
  : html`
799
802
  ${reqBodyFileInputHtml}
@@ -818,7 +821,7 @@ export default class ApiRequest extends LitElement {
818
821
  );
819
822
 
820
823
  return html`
821
- <div class="tab-panel row" style="min-height:220px; border-left: 6px solid var(--light-border-color); align-items: stretch;">
824
+ <div part="tab-panel" class="tab-panel row" style="min-height:220px; border-left: 6px solid var(--light-border-color); align-items: stretch;">
822
825
  <div style="width:24px; background-color:var(--light-border-color)">
823
826
  <div class="row" style="flex-direction:row-reverse; width:160px; height:24px; transform:rotate(270deg) translateX(-160px); transform-origin:top left; display:block;" @click="${(e) => {
824
827
  if (e.target.classList.contains('v-tab-btn')) {
@@ -1052,20 +1055,20 @@ export default class ApiRequest extends LitElement {
1052
1055
  <div style="flex:1"></div>
1053
1056
  <button class="m-btn" part="btn btn-outline btn-clear-response" @click="${this.clearResponseData}">CLEAR RESPONSE</button>
1054
1057
  </div>
1055
- <div class="tab-panel col" style="border-width:0 0 1px 0;">
1056
- <div id="tab_buttons" class="tab-buttons row" @click="${(e) => {
1058
+ <div part="tab-panel" class="tab-panel col" style="border-width:0 0 1px 0;">
1059
+ <div id="tab_buttons" part="tab-btn-row" class="tab-buttons row" @click="${(e) => {
1057
1060
  if (e.target.classList.contains('tab-btn') === false) { return; }
1058
1061
  this.activeResponseTab = e.target.dataset.tab;
1059
1062
  }}">
1060
- <button class="tab-btn ${this.activeResponseTab === 'response' ? 'active' : ''}" data-tab = 'response' > RESPONSE</button>
1061
- <button class="tab-btn ${this.activeResponseTab === 'headers' ? 'active' : ''}" data-tab = 'headers' > RESPONSE HEADERS</button>
1063
+ <button part="tab-btn" class="tab-btn ${this.activeResponseTab === 'response' ? 'active' : ''}" data-tab = 'response' > RESPONSE</button>
1064
+ <button part="tab-btn" class="tab-btn ${this.activeResponseTab === 'headers' ? 'active' : ''}" data-tab = 'headers' > RESPONSE HEADERS</button>
1062
1065
  ${this.showCurlBeforeTry === 'true'
1063
1066
  ? ''
1064
- : html`<button class="tab-btn ${this.activeResponseTab === 'curl' ? 'active' : ''}" data-tab = 'curl'>CURL</button>`}
1067
+ : html`<button part="tab-btn" class="tab-btn ${this.activeResponseTab === 'curl' ? 'active' : ''}" data-tab = 'curl'>CURL</button>`}
1065
1068
  </div>
1066
1069
  ${this.responseIsBlob
1067
1070
  ? html`
1068
- <div class="tab-content col" style="flex:1; display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};">
1071
+ <div part="tab-content" class="tab-content col" style="flex:1; display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};">
1069
1072
  ${this.responseBlobType === 'image'
1070
1073
  ? html`<img style="max-height:var(--resp-area-height, 400px); object-fit:contain;" class="mar-top-8" src="${ifDefined(this.responseBlobUrl)}"></img>`
1071
1074
  : ''
@@ -1079,12 +1082,12 @@ export default class ApiRequest extends LitElement {
1079
1082
  }
1080
1083
  </div>`
1081
1084
  : html`
1082
- <div class="tab-content col m-markdown" style="flex:1; display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};" >
1085
+ <div part="tab-content" class="tab-content col m-markdown" style="flex:1; display:${this.activeResponseTab === 'response' ? 'flex' : 'none'};" >
1083
1086
  <button class="toolbar-btn" style="position:absolute; top:12px; right:8px" @click='${(e) => { copyToClipboard(this.responseText, e); }}' part="btn btn-fill"> Copy </button>
1084
1087
  <pre style="white-space:pre; min-height:50px; height:var(--resp-area-height, 400px); resize:vertical; overflow:auto">${responseContent}</pre>
1085
1088
  </div>`
1086
1089
  }
1087
- <div class="tab-content col m-markdown" style="flex:1; display:${this.activeResponseTab === 'headers' ? 'flex' : 'none'};" >
1090
+ <div part="tab-content" class="tab-content col m-markdown" style="flex:1; display:${this.activeResponseTab === 'headers' ? 'flex' : 'none'};" >
1088
1091
  <button class="toolbar-btn" style = "position:absolute; top:12px; right:8px" @click='${(e) => { copyToClipboard(this.responseHeaders, e); }}' part="btn btn-fill"> Copy </button>
1089
1092
  <pre style="white-space:pre"><code>${unsafeHTML(Prism.highlight(this.responseHeaders, Prism.languages.css, 'css'))}</code></pre>
1090
1093
  </div>
@@ -1524,11 +1527,12 @@ export default class ApiRequest extends LitElement {
1524
1527
  respHeadersObj[hdr] = hdrVal;
1525
1528
  this.responseHeaders = `${this.responseHeaders}${hdr}: ${hdrVal}\n`;
1526
1529
  });
1527
- const contentType = fetchResponse.headers.get('content-type').split(';')[0].trim();
1530
+ let contentType = fetchResponse.headers.get('content-type');
1528
1531
  const respEmpty = (await fetchResponse.clone().text()).length === 0;
1529
1532
  if (respEmpty) {
1530
1533
  this.responseText = '';
1531
1534
  } else if (contentType) {
1535
+ contentType = contentType.split(';')[0].trim();
1532
1536
  if (contentType === 'application/x-ndjson') {
1533
1537
  this.responseText = await fetchResponse.text();
1534
1538
  } else if (contentType.includes('json')) {
@@ -1569,16 +1573,18 @@ export default class ApiRequest extends LitElement {
1569
1573
  }
1570
1574
  }
1571
1575
  if (this.responseIsBlob) {
1572
- const contentDisposition = fetchResponse.headers.get('content-disposition');
1576
+ const contentDisposition = fetchResponse.headers.get('content-disposition') || '';
1573
1577
  let filenameFromContentDeposition = 'filename';
1574
- const filenameStarRegexMatch = contentDisposition.match(/filename\*=\s*UTF-8''([^;]+)/); // Support Headers like >>> Content-Disposition: attachment; filename*=UTF-8''example%20file.pdf
1575
- if (filenameStarRegexMatch) {
1576
- filenameFromContentDeposition = decodeURIComponent(filenameStarRegexMatch[1]); // the filename* format in the Content-Disposition header follows RFC 5987, which allows encoding non-ASCII characters using percent encoding. so example%20file.pdf becomes example file.pdf
1577
- } else {
1578
- // Fallback to the regular filename format
1579
- const filenameMatch = contentDisposition.match(/filename="?([^"]+)"?/); // Content-Disposition: attachment; filename=example.pdf
1580
- if (filenameMatch) {
1581
- filenameFromContentDeposition = filenameMatch[1];
1578
+ if (contentDisposition) {
1579
+ const filenameStarRegexMatch = contentDisposition.match(/filename\*=\s*UTF-8''([^;]+)/); // Support Headers like >>> Content-Disposition: attachment; filename*=UTF-8''example%20file.pdf
1580
+ if (filenameStarRegexMatch) {
1581
+ filenameFromContentDeposition = decodeURIComponent(filenameStarRegexMatch[1]); // the filename* format in the Content-Disposition header follows RFC 5987, which allows encoding non-ASCII characters using percent encoding. so example%20file.pdf becomes example file.pdf
1582
+ } else {
1583
+ // Fallback to the regular filename format
1584
+ const filenameMatch = contentDisposition.match(/filename="?([^"]+)"?/); // Content-Disposition: attachment; filename=example.pdf
1585
+ if (filenameMatch) {
1586
+ filenameFromContentDeposition = filenameMatch[1];
1587
+ }
1582
1588
  }
1583
1589
  }
1584
1590
  this.respContentDisposition = filenameFromContentDeposition;
@@ -181,10 +181,10 @@ export default class ApiResponse extends LitElement {
181
181
  ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 0
182
182
  ? ''
183
183
  : html`
184
- <div class="tab-panel col">
185
- <div class="tab-buttons row" @click="${(e) => { if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}" >
186
- <button class="tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE </button>
187
- <button class="tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema' >SCHEMA</button>
184
+ <div part="tab-panel" class="tab-panel col">
185
+ <div part="tab-btn-row" class="tab-buttons row" @click="${(e) => { if (e.target.tagName.toLowerCase() === 'button') { this.activeSchemaTab = e.target.dataset.tab; } }}" >
186
+ <button part="tab-btn" class="tab-btn ${this.activeSchemaTab === 'example' ? 'active' : ''}" data-tab = 'example'>EXAMPLE </button>
187
+ <button part="tab-btn" class="tab-btn ${this.activeSchemaTab !== 'example' ? 'active' : ''}" data-tab = 'schema' >SCHEMA</button>
188
188
  <div style="flex:1"></div>
189
189
  ${Object.keys(this.mimeResponsesForEachStatus[status]).length === 1
190
190
  ? html`<span class='small-font-size gray-text' style='align-self:center; margin-top:8px;'> ${Object.keys(this.mimeResponsesForEachStatus[status])[0]} </span>`
@@ -192,10 +192,10 @@ export default class ApiResponse extends LitElement {
192
192
  }
193
193
  </div>
194
194
  ${this.activeSchemaTab === 'example'
195
- ? html`<div class ='tab-content col' style = 'flex:1;'>
195
+ ? html`<div part="tab-content" class ='tab-content col' style = 'flex:1;'>
196
196
  ${this.mimeExampleTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}
197
197
  </div>`
198
- : html`<div class ='tab-content col' style = 'flex:1;'>
198
+ : html`<div part="tab-content" class ='tab-content col' style = 'flex:1;'>
199
199
  ${this.mimeSchemaTemplate(this.mimeResponsesForEachStatus[status][this.selectedMimeType])}
200
200
  </div>`
201
201
  }
@@ -102,7 +102,7 @@ export default class JsonTree extends LitElement {
102
102
 
103
103
  generateTree(data, isLast = false) {
104
104
  if (data === null) {
105
- return html`<div class="null" style="display:inline;">null</div>`;
105
+ return html`<span class="null">null</span>${isLast ? '' : ','}`;
106
106
  }
107
107
  if (typeof data === 'object' && (data instanceof Date === false)) {
108
108
  const detailType = Array.isArray(data) ? 'array' : 'pure_object';
@@ -210,8 +210,14 @@ 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'])
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>`
215
221
  }
216
222
  ${data['::type'] === 'xxx-of' && dataType === 'array' ? html`<span style="color:var(--primary-color)">ARRAY</span>` : ''}
217
223
  </div>
@@ -298,7 +304,10 @@ export default class SchemaTable extends LitElement {
298
304
  return html`
299
305
  <div class = "tr primitive" title="${isDeprecated || deprecated ? 'Deprecated' : ''}">
300
306
  <div class="td key ${isDeprecated || deprecated ? 'deprecated' : ''}" style='padding-left:${leftPadding}px'>
301
- ${isDeprecated || deprecated ? html`<span style='color:var(--red);'>✗</span>` : ''}
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
+ }
302
311
  ${keyLabel?.endsWith('*')
303
312
  ? html`
304
313
  <span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span>
@@ -48,9 +48,6 @@ export default class SchemaTree extends LitElement {
48
48
  .tree .key {
49
49
  max-width: 300px;
50
50
  }
51
- .key.deprecated .key-label {
52
- color: var(--red);
53
- }
54
51
  .tr.expanded:hover > .td.key > .open-bracket {
55
52
  color: var(--primary-color);
56
53
  }
@@ -220,7 +217,10 @@ export default class SchemaTree extends LitElement {
220
217
  ? ''
221
218
  : schemaLevel > 0
222
219
  ? html`<span class="key-label" title="${readOrWrite === 'readonly' ? 'Read-Only' : readOrWrite === 'writeonly' ? 'Write-Only' : ''}">
223
- ${(isDeprecated || data['::deprecated']) ? '✗' : ''}
220
+ ${(isDeprecated || data['::deprecated'])
221
+ ? 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>`
222
+ : ''
223
+ }
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
  : ''
@@ -303,7 +303,10 @@ export default class SchemaTree extends LitElement {
303
303
  return html`
304
304
  <div class = "tr primitive" title="${deprecated ? 'Deprecated' : ''}">
305
305
  <div class="td key ${isDeprecated || deprecated}" style='min-width:${minFieldColWidth}px'>
306
- ${isDeprecated || deprecated ? html`<span style='color:var(--red);'>✗</span>` : ''}
306
+ ${isDeprecated || deprecated
307
+ ? 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>`
308
+ : ''
309
+ }
307
310
  ${keyLabel.endsWith('*')
308
311
  ? html`<span class="key-label">${keyLabel.substring(0, keyLabel.length - 1)}</span><span style='color:var(--red);'>*</span>:`
309
312
  : key.startsWith('::OPTION')
@@ -86,6 +86,7 @@ export default class JsonSchemaViewer extends LitElement {
86
86
  InfoStyles,
87
87
  css`
88
88
  :host {
89
+ all: initial;
89
90
  display:flex;
90
91
  flex-direction: column;
91
92
  min-width:360px;
@@ -67,6 +67,7 @@ export default class RapiDocMini extends LitElement {
67
67
  oauthReceiver: { type: String, attribute: 'oauth-receiver' },
68
68
 
69
69
  allowTry: { type: String, attribute: 'allow-try' },
70
+ showCurlBeforeTry: { type: String, attribute: 'show-curl-before-try' },
70
71
 
71
72
  // Main Colors and Font
72
73
  theme: { type: String },
@@ -104,6 +105,7 @@ export default class RapiDocMini extends LitElement {
104
105
  InfoStyles,
105
106
  css`
106
107
  :host {
108
+ all: initial;
107
109
  display:flex;
108
110
  flex-direction: column;
109
111
  min-width:360px;
package/src/rapidoc.js CHANGED
@@ -158,6 +158,7 @@ export default class RapiDoc extends LitElement {
158
158
  InfoStyles,
159
159
  css`
160
160
  :host {
161
+ all: initial;
161
162
  display:flex;
162
163
  flex-direction: column;
163
164
  min-width:360px;
@@ -174,7 +175,7 @@ export default class RapiDoc extends LitElement {
174
175
  }
175
176
  :where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
176
177
  :where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
177
- .body {
178
+ .body {
178
179
  display:flex;
179
180
  height:100%;
180
181
  width:100%;
@@ -15,10 +15,10 @@ export default css`
15
15
  white-space: nowrap;
16
16
  border: 2px solid var(--primary-color);
17
17
  background-color:transparent;
18
- transition: background-color 0.2s;
19
18
  user-select: none;
20
19
  cursor: pointer;
21
20
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
21
+ transition-duration: 0.75s;
22
22
  }
23
23
  .m-btn.primary {
24
24
  background-color: var(--primary-color);
@@ -44,6 +44,11 @@ export default css`
44
44
  cursor: not-allowed;
45
45
  opacity: 0.4;
46
46
  }
47
+ .m-btn:active {
48
+ filter: brightness(75%);
49
+ transform: scale(0.95);
50
+ transition:scale 0s;
51
+ }
47
52
  .toolbar-btn {
48
53
  cursor: pointer;
49
54
  padding: 4px;
@@ -40,6 +40,7 @@ export default function callbackTemplate(callbacks) {
40
40
  schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : 'true'}"
41
41
  fetch-credentials = "${this.fetchCredentials}"
42
42
  exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
43
+ tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
43
44
  file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
44
45
  anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
45
46
  > </api-request>
@@ -58,7 +59,8 @@ export default function callbackTemplate(callbacks) {
58
59
  schema-hide-read-only = "${this.schemaHideReadOnly === 'never' ? 'false' : 'true'}"
59
60
  schema-hide-write-only = "false"
60
61
  exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
61
- schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
62
+ tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
63
+ schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
62
64
  > </api-response>
63
65
  </div>
64
66
  </div>
@@ -7,7 +7,7 @@ import { copyToClipboard } from '~/utils/common-utils';
7
7
  export default function codeSamplesTemplate(xCodeSamples) {
8
8
  return html`
9
9
  <section class="table-title" style="margin-top:24px;">CODE SAMPLES</div>
10
- <div class="tab-panel col"
10
+ <div part="tab-panel" class="tab-panel col"
11
11
  @click="${
12
12
  (e) => {
13
13
  if (!e.target.classList.contains('tab-btn')) { return; }
@@ -19,8 +19,8 @@ export default function codeSamplesTemplate(xCodeSamples) {
19
19
  tabContents.forEach((tabBodyEl) => { tabBodyEl.style.display = (tabBodyEl.dataset.tab === clickedTab ? 'block' : 'none'); });
20
20
  }
21
21
  }">
22
- <div class="tab-buttons row" style="width:100; overflow">
23
- ${xCodeSamples.map((v, i) => html`<button class="tab-btn ${i === 0 ? 'active' : ''}" data-tab = '${v.lang}${i}'> ${v.label || v.lang} </button>`)}
22
+ <div part="tab-btn-row" class="tab-buttons row" style="width:100; overflow">
23
+ ${xCodeSamples.map((v, i) => html`<button part="tab-btn" class="tab-btn ${i === 0 ? 'active' : ''}" data-tab = '${v.lang}${i}'> ${v.label || v.lang} </button>`)}
24
24
  </div>
25
25
  ${xCodeSamples.map((v, i) => html`
26
26
  <div class="tab-content m-markdown" style= "display:${i === 0 ? 'block' : 'none'}" data-tab = '${v.lang}${i}'>
@@ -155,6 +155,7 @@ function endpointBodyTemplate(path) {
155
155
  schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
156
156
  fetch-credentials = "${this.fetchCredentials}"
157
157
  exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
158
+ tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
158
159
  file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
159
160
  anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
160
161
  > </api-request>
@@ -177,8 +178,9 @@ function endpointBodyTemplate(path) {
177
178
  schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
178
179
  selected-status = "${Object.keys(path.responses || {})[0] || ''}"
179
180
  exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, file-input:file-input,
180
- textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, anchor:anchor, anchor-param-example:anchor-param-example, btn-clear-resp:btn-clear-resp,
181
- schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
181
+ textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param, anchor:anchor, anchor-param-example:anchor-param-example, btn-clear-resp:btn-clear-resp,
182
+ tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
183
+ schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
182
184
  > </api-response>
183
185
  </div>
184
186
  </div>`;
@@ -143,6 +143,7 @@ export function expandedEndpointBodyTemplate(path, tagName = '', tagDescription
143
143
  schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'true' : 'false'}"
144
144
  fetch-credentials = "${this.fetchCredentials}"
145
145
  exportparts = "wrap-request-btn:wrap-request-btn, btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
146
+ tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
146
147
  file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
147
148
  anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
148
149
  > </api-request>
@@ -164,7 +165,8 @@ export function expandedEndpointBodyTemplate(path, tagName = '', tagDescription
164
165
  schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : path.isWebhook ? 'false' : 'true'}"
165
166
  selected-status = "${Object.keys(path.responses || {})[0] || ''}"
166
167
  exportparts = "btn:btn, btn-response-status:btn-response-status, btn-selected-response-status:btn-selected-response-status, btn-fill:btn-fill, btn-copy:btn-copy,
167
- schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
168
+ tab-panel:tab-panel, tab-btn:tab-btn, tab-btn-row:tab-btn-row, tab-coontent:tab-content,
169
+ schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
168
170
  > </api-response>
169
171
  </div>
170
172
  </div>
@@ -4,7 +4,7 @@ import { html } from 'lit';
4
4
  export default function logoTemplate(style) {
5
5
  return html`
6
6
  <div style=${style}>
7
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="1 0 511 512">
7
+ <svg viewBox="1 0 511 512">
8
8
  <path d="M351 411a202 202 0 01-350 0 203 203 0 01333-24 203 203 0 0117 24zm0 0" fill="#adc165"/>
9
9
  <path d="M334 387a202 202 0 01-216-69 202 202 0 01216 69zm78 32H85a8 8 0 01-8-8 8 8 0 018-8h327a8 8 0 017 8 8 8 0 01-7 8zm0 0" fill="#99aa52"/>
10
10
  <path d="M374 338l-5 30a202 202 0 01-248-248 203 203 0 01253 218zm0 0" fill="#ffc73b"/>
@@ -34,25 +34,14 @@ export default function mainBodyTemplate(isMini = false, pathsExpanded = false)
34
34
  };
35
35
  /* eslint-disable indent */
36
36
  if (this.resolvedSpec.specLoadError) {
37
- if (isMini) {
38
- return html`
39
- ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
40
- <div style='display:flex; align-items:center; border:1px dashed var(--border-color); height:42px; padding:5px; font-size:var(--font-size-small); color:var(--red); font-family:var(--font-mono)'> ${this.resolvedSpec.info.description} </div>
41
- `;
42
- }
43
37
  return html`
44
38
  ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
45
- <!-- Header -->
46
- ${headerTemplate.call(this)}
47
- <main class='main-content regular-font' part='section-main-content'>
48
- <slot></slot>
49
- <div style='margin:24px; text-align: center;'>
50
- <h1 style='color: var(--red)'> ${this.resolvedSpec.info.title} </h1>
51
- <div style='font-family:var(--font-mono)'> ${this.resolvedSpec.info.description} </div>
52
- </div>
53
- </main>
39
+ <div id="spec-not-found" style='display:flex; align-items:center; justify-content: center; border:1px dashed var(--border-color); height:42px; padding:5px; font-size:var(--font-size-small); color:var(--red); font-family:var(--font-mono)'>
40
+ ${this.resolvedSpec.info.description}
41
+ </div>
54
42
  `;
55
43
  }
44
+
56
45
  if (this.resolvedSpec.isSpecLoading) {
57
46
  return html`
58
47
  ${this.theme === 'dark' ? SetTheme.call(this, 'dark', newTheme) : SetTheme.call(this, 'light', newTheme)}
@@ -408,7 +408,9 @@ export default function securitySchemeTemplate() {
408
408
  ${this.resolvedSpec.securitySchemes && this.resolvedSpec.securitySchemes.length > 0
409
409
  ? html`
410
410
  <table role="presentation" id="auth-table" class='m-table padded-12' style="width:100%;">
411
- ${this.resolvedSpec.securitySchemes.map((v) => html`
411
+ ${this.resolvedSpec.securitySchemes
412
+ .filter((v) => v.type)
413
+ .map((v) => html`
412
414
  <tr id="security-scheme-${v.securitySchemeId}" class="${v.type.toLowerCase()}">
413
415
  <td style="max-width:500px; overflow-wrap: break-word;">
414
416
  <div style="line-height:28px; margin-bottom:5px;">
@@ -429,7 +431,7 @@ export default function securitySchemeTemplate() {
429
431
  : ''
430
432
  }
431
433
 
432
- ${(v.type.toLowerCase() === 'apikey') || (v.type.toLowerCase() === 'http' && v.scheme.toLowerCase() === 'bearer')
434
+ ${(v.type.toLowerCase() === 'apikey') || (v.type.toLowerCase() === 'http' && v.scheme?.toLowerCase() === 'bearer')
433
435
  ? html`
434
436
  <div style="margin-bottom:5px">
435
437
  ${v.type.toLowerCase() === 'apikey'
@@ -451,7 +453,7 @@ export default function securitySchemeTemplate() {
451
453
  </div>`
452
454
  : ''
453
455
  }
454
- ${v.type.toLowerCase() === 'http' && v.scheme.toLowerCase() === 'basic'
456
+ ${v.type.toLowerCase() === 'http' && v.scheme?.toLowerCase() === 'basic'
455
457
  ? html`
456
458
  <div style="margin-bottom:5px">
457
459
  Send <code>Authorization</code> in <code>header</code> containing the word <code>Basic</code> followed by a space and a base64 encoded string of <code>username:password</code>.