rapidoc 9.3.3 → 9.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflow/words.yaml +22 -0
- package/README.md +2 -7
- package/dist/index.html +1 -1
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js +858 -748
- package/dist/rapidoc-min.js.LICENSE.txt +14 -9
- package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
- package/dist/rapidoc-min.js.gz +0 -0
- package/dist/rapidoc-min.js.map +1 -1
- package/dist/rapidoc-min.js.map.gz +0 -0
- package/dist/rapidoc.js +11948 -32008
- package/dist/report.html +6 -5
- package/index.html +2 -1
- package/package.json +25 -24
- package/src/components/api-request.js +266 -122
- package/src/components/api-response.js +11 -10
- package/src/components/json-tree.js +17 -12
- package/src/components/schema-table.js +58 -49
- package/src/components/schema-tree.js +60 -56
- package/src/components/tag-input.js +7 -4
- package/src/json-schema-viewer.js +2 -1
- package/src/rapidoc-mini.js +1 -1
- package/src/rapidoc.js +108 -35
- package/src/styles/endpoint-styles.js +1 -1
- package/src/styles/info-styles.js +2 -1
- package/src/styles/input-styles.js +2 -16
- package/src/styles/nav-styles.js +57 -10
- package/src/styles/schema-styles.js +27 -15
- package/src/styles/tab-styles.js +1 -0
- package/src/templates/advance-search-template.js +3 -3
- package/src/templates/callback-template.js +3 -3
- package/src/templates/code-samples-template.js +1 -0
- package/src/templates/components-template.js +3 -5
- package/src/templates/endpoint-template.js +39 -26
- package/src/templates/expanded-endpoint-template.js +58 -9
- package/src/templates/focused-endpoint-template.js +5 -2
- package/src/templates/header-template.js +2 -2
- package/src/templates/json-schema-viewer-template.js +2 -1
- package/src/templates/main-body-template.js +19 -18
- package/src/templates/navbar-template.js +99 -82
- package/src/templates/overview-template.js +1 -1
- package/src/templates/security-scheme-template.js +51 -27
- package/src/templates/server-template.js +1 -1
- package/src/utils/common-utils.js +2 -2
- package/src/utils/schema-utils.js +192 -67
- package/src/utils/spec-parser.js +9 -3
- package/src/utils/theme.js +9 -3
- package/webpack.config.js +2 -1
package/src/rapidoc.js
CHANGED
|
@@ -38,7 +38,9 @@ export default class RapiDoc extends LitElement {
|
|
|
38
38
|
threshold: 0,
|
|
39
39
|
};
|
|
40
40
|
this.showSummaryWhenCollapsed = true;
|
|
41
|
-
|
|
41
|
+
// Will activate intersection observer only after spec load and hash analyze
|
|
42
|
+
// to scroll to the proper element without being reverted by observer behavior
|
|
43
|
+
this.isIntersectionObserverActive = false;
|
|
42
44
|
this.intersectionObserver = new IntersectionObserver((entries) => { this.onIntersect(entries); }, intersectionObserverOptions);
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -53,6 +55,7 @@ export default class RapiDoc extends LitElement {
|
|
|
53
55
|
routePrefix: { type: String, attribute: 'route-prefix' },
|
|
54
56
|
specUrl: { type: String, attribute: 'spec-url' },
|
|
55
57
|
sortTags: { type: String, attribute: 'sort-tags' },
|
|
58
|
+
sortSchemas: { type: String, attribute: 'sort-schemas' },
|
|
56
59
|
generateMissingTags: { type: String, attribute: 'generate-missing-tags' },
|
|
57
60
|
sortEndpointsBy: { type: String, attribute: 'sort-endpoints-by' },
|
|
58
61
|
specFile: { type: String, attribute: false },
|
|
@@ -87,6 +90,7 @@ export default class RapiDoc extends LitElement {
|
|
|
87
90
|
showInfo: { type: String, attribute: 'show-info' },
|
|
88
91
|
allowAuthentication: { type: String, attribute: 'allow-authentication' },
|
|
89
92
|
allowTry: { type: String, attribute: 'allow-try' },
|
|
93
|
+
showCurlBeforeTry: { type: String, attribute: 'show-curl-before-try' },
|
|
90
94
|
allowSpecUrlLoad: { type: String, attribute: 'allow-spec-url-load' },
|
|
91
95
|
allowSpecFileLoad: { type: String, attribute: 'allow-spec-file-load' },
|
|
92
96
|
allowSpecFileDownload: { type: String, attribute: 'allow-spec-file-download' },
|
|
@@ -96,6 +100,7 @@ export default class RapiDoc extends LitElement {
|
|
|
96
100
|
allowSchemaDescriptionExpandToggle: { type: String, attribute: 'allow-schema-description-expand-toggle' },
|
|
97
101
|
showComponents: { type: String, attribute: 'show-components' },
|
|
98
102
|
pageDirection: { type: String, attribute: 'page-direction' },
|
|
103
|
+
scrollBehavior: { type: String, attribute: 'scroll-behavior' },
|
|
99
104
|
|
|
100
105
|
// Main Colors and Font
|
|
101
106
|
theme: { type: String },
|
|
@@ -116,6 +121,8 @@ export default class RapiDoc extends LitElement {
|
|
|
116
121
|
navHoverBgColor: { type: String, attribute: 'nav-hover-bg-color' },
|
|
117
122
|
navHoverTextColor: { type: String, attribute: 'nav-hover-text-color' },
|
|
118
123
|
navAccentColor: { type: String, attribute: 'nav-accent-color' },
|
|
124
|
+
navAccentTextColor: { type: String, attribute: 'nav-accent-text-color' },
|
|
125
|
+
navActiveItemMarker: { type: String, attribute: 'nav-active-item-marker' },
|
|
119
126
|
navItemSpacing: { type: String, attribute: 'nav-item-spacing' },
|
|
120
127
|
showMethodInNavBar: { type: String, attribute: 'show-method-in-nav-bar' },
|
|
121
128
|
usePathInNavBar: { type: String, attribute: 'use-path-in-nav-bar' },
|
|
@@ -162,13 +169,14 @@ export default class RapiDoc extends LitElement {
|
|
|
162
169
|
background-color:var(--bg);
|
|
163
170
|
font-family:var(--font-regular);
|
|
164
171
|
}
|
|
165
|
-
|
|
172
|
+
:where(button, input[type="checkbox"], [tabindex="0"]):focus-visible { box-shadow: var(--focus-shadow); }
|
|
173
|
+
:where(input[type="text"], input[type="password"], select, textarea):focus-visible { border-color: var(--primary-color); }
|
|
174
|
+
.body {
|
|
166
175
|
display:flex;
|
|
167
176
|
height:100%;
|
|
168
177
|
width:100%;
|
|
169
178
|
overflow:hidden;
|
|
170
179
|
}
|
|
171
|
-
|
|
172
180
|
.main-content {
|
|
173
181
|
margin:0;
|
|
174
182
|
padding: 0;
|
|
@@ -282,11 +290,21 @@ export default class RapiDoc extends LitElement {
|
|
|
282
290
|
height: 36px;
|
|
283
291
|
animation: spin 2s linear infinite;
|
|
284
292
|
}
|
|
285
|
-
.expanded-endpoint-body{
|
|
293
|
+
.expanded-endpoint-body {
|
|
286
294
|
position: relative;
|
|
287
295
|
padding: 6px 0px;
|
|
288
296
|
}
|
|
289
|
-
.expanded-endpoint-body
|
|
297
|
+
.expanded-endpoint-body .tag-description {
|
|
298
|
+
background: var(--code-bg);
|
|
299
|
+
border-radius: var(--border-radius);
|
|
300
|
+
transition: max-height .2s ease-out;
|
|
301
|
+
}
|
|
302
|
+
.expanded-endpoint-body .tag-icon {
|
|
303
|
+
transition: transform .2s ease-out;
|
|
304
|
+
}
|
|
305
|
+
.expanded-endpoint-body .tag-icon.expanded {
|
|
306
|
+
transform: rotate(180deg);
|
|
307
|
+
}
|
|
290
308
|
.divider {
|
|
291
309
|
border-top: 2px solid var(--border-color);
|
|
292
310
|
margin: 24px 0;
|
|
@@ -345,6 +363,9 @@ export default class RapiDoc extends LitElement {
|
|
|
345
363
|
border-radius: 4px 0 0 4px;
|
|
346
364
|
color: #000;
|
|
347
365
|
}
|
|
366
|
+
.colored-block .nav-method.as-colored-block {
|
|
367
|
+
outline: 1px solid;
|
|
368
|
+
}
|
|
348
369
|
|
|
349
370
|
.nav-method.as-colored-block.get { background-color: var(--blue); }
|
|
350
371
|
.nav-method.as-colored-block.put { background-color: var(--orange); }
|
|
@@ -438,7 +459,7 @@ export default class RapiDoc extends LitElement {
|
|
|
438
459
|
}
|
|
439
460
|
|
|
440
461
|
if (!this.layout || !'row, column,'.includes(`${this.layout},`)) { this.layout = 'row'; }
|
|
441
|
-
if (!this.renderStyle || !'read, view, focused,'.includes(`${this.renderStyle},`)) { this.renderStyle = '
|
|
462
|
+
if (!this.renderStyle || !'read, view, focused,'.includes(`${this.renderStyle},`)) { this.renderStyle = 'focused'; }
|
|
442
463
|
if (!this.schemaStyle || !'tree, table,'.includes(`${this.schemaStyle},`)) { this.schemaStyle = 'tree'; }
|
|
443
464
|
if (!this.theme || !'light, dark,'.includes(`${this.theme},`)) {
|
|
444
465
|
this.theme = (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) ? 'light' : 'dark';
|
|
@@ -456,7 +477,6 @@ export default class RapiDoc extends LitElement {
|
|
|
456
477
|
|
|
457
478
|
if (!this.fillRequestFieldsWithExample || !'true, false,'.includes(`${this.fillRequestFieldsWithExample},`)) { this.fillRequestFieldsWithExample = 'true'; }
|
|
458
479
|
if (!this.persistAuth || !'true, false,'.includes(`${this.persistAuth},`)) { this.persistAuth = 'false'; }
|
|
459
|
-
if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) { this.onNavTagClick = 'expand-collapse'; }
|
|
460
480
|
if (!this.responseAreaHeight) {
|
|
461
481
|
this.responseAreaHeight = '400px';
|
|
462
482
|
}
|
|
@@ -473,13 +493,17 @@ export default class RapiDoc extends LitElement {
|
|
|
473
493
|
if (!this.updateRoute || !'true, false,'.includes(`${this.updateRoute},`)) { this.updateRoute = 'true'; }
|
|
474
494
|
if (!this.routePrefix) { this.routePrefix = '#'; }
|
|
475
495
|
if (!this.sortTags || !'true, false,'.includes(`${this.sortTags},`)) { this.sortTags = 'false'; }
|
|
496
|
+
if (!this.sortSchemas || !'true, false,'.includes(`${this.sortSchemas},`)) { this.sortSchemas = 'false'; }
|
|
476
497
|
if (!this.generateMissingTags || !'true, false,'.includes(`${this.generateMissingTags},`)) { this.generateMissingTags = 'false'; }
|
|
477
498
|
if (!this.sortEndpointsBy || !'method, path, summary, none,'.includes(`${this.sortEndpointsBy},`)) { this.sortEndpointsBy = 'path'; }
|
|
499
|
+
|
|
500
|
+
if (!this.onNavTagClick || !'expand-collapse, show-description,'.includes(`${this.onNavTagClick},`)) { this.onNavTagClick = 'expand-collapse'; }
|
|
478
501
|
if (!this.navItemSpacing || !'compact, relaxed, default,'.includes(`${this.navItemSpacing},`)) { this.navItemSpacing = 'default'; }
|
|
479
502
|
if (!this.showMethodInNavBar || !'false, as-plain-text, as-colored-text, as-colored-block,'.includes(`${this.showMethodInNavBar},`)) { this.showMethodInNavBar = 'false'; }
|
|
480
503
|
if (!this.usePathInNavBar || !'true, false,'.includes(`${this.usePathInNavBar},`)) { this.usePathInNavBar = 'false'; }
|
|
481
|
-
if (!this.
|
|
504
|
+
if (!this.navActiveItemMarker || !'left-bar, colored-block'.includes(`${this.navActiveItemMarker},`)) { this.navActiveItemMarker = 'left-bar'; }
|
|
482
505
|
|
|
506
|
+
if (!this.fontSize || !'default, large, largest,'.includes(`${this.fontSize},`)) { this.fontSize = 'default'; }
|
|
483
507
|
if (!this.showInfo || !'true, false,'.includes(`${this.showInfo},`)) { this.showInfo = 'true'; }
|
|
484
508
|
if (!this.allowServerSelection || !'true, false,'.includes(`${this.allowServerSelection},`)) { this.allowServerSelection = 'true'; }
|
|
485
509
|
if (!this.allowAuthentication || !'true, false,'.includes(`${this.allowAuthentication},`)) { this.allowAuthentication = 'true'; }
|
|
@@ -490,6 +514,7 @@ export default class RapiDoc extends LitElement {
|
|
|
490
514
|
if (!this.infoDescriptionHeadingsInNavBar || !'true, false,'.includes(`${this.infoDescriptionHeadingsInNavBar},`)) { this.infoDescriptionHeadingsInNavBar = 'false'; }
|
|
491
515
|
if (!this.fetchCredentials || !'omit, same-origin, include,'.includes(`${this.fetchCredentials},`)) { this.fetchCredentials = ''; }
|
|
492
516
|
if (!this.matchType || !'includes regex'.includes(this.matchType)) { this.matchType = 'includes'; }
|
|
517
|
+
if (!this.scrollBehavior || !'smooth, auto,'.includes(`${this.scrollBehavior},`)) { this.scrollBehavior = 'auto'; }
|
|
493
518
|
|
|
494
519
|
if (!this.showAdvancedSearchDialog) { this.showAdvancedSearchDialog = false; }
|
|
495
520
|
|
|
@@ -506,9 +531,7 @@ export default class RapiDoc extends LitElement {
|
|
|
506
531
|
});
|
|
507
532
|
|
|
508
533
|
window.addEventListener('hashchange', () => {
|
|
509
|
-
|
|
510
|
-
const elementId = window.location.hash.replace(regEx, '');
|
|
511
|
-
this.scrollTo(elementId);
|
|
534
|
+
this.scrollToPath(this.getElementIDFromURL());
|
|
512
535
|
}, true);
|
|
513
536
|
}
|
|
514
537
|
|
|
@@ -552,7 +575,7 @@ export default class RapiDoc extends LitElement {
|
|
|
552
575
|
await this.loadSpec(newVal);
|
|
553
576
|
// If goto-path is provided and no location-hash is present then try to scroll there
|
|
554
577
|
if (this.gotoPath && !window.location.hash) {
|
|
555
|
-
this.
|
|
578
|
+
this.scrollToPath(this.gotoPath);
|
|
556
579
|
}
|
|
557
580
|
}, 0);
|
|
558
581
|
}
|
|
@@ -621,11 +644,11 @@ export default class RapiDoc extends LitElement {
|
|
|
621
644
|
super.attributeChangedCallback(name, oldVal, newVal);
|
|
622
645
|
}
|
|
623
646
|
|
|
624
|
-
|
|
647
|
+
onSpecUrlChange() {
|
|
625
648
|
this.setAttribute('spec-url', this.shadowRoot.getElementById('spec-url').value);
|
|
626
649
|
}
|
|
627
650
|
|
|
628
|
-
|
|
651
|
+
onSpecFileChange(e) {
|
|
629
652
|
this.setAttribute('spec-file', this.shadowRoot.getElementById('spec-file').value);
|
|
630
653
|
const specFile = e.target.files[0];
|
|
631
654
|
const reader = new FileReader();
|
|
@@ -707,6 +730,7 @@ export default class RapiDoc extends LitElement {
|
|
|
707
730
|
specUrl,
|
|
708
731
|
this.generateMissingTags === 'true',
|
|
709
732
|
this.sortTags === 'true',
|
|
733
|
+
this.sortSchemas === 'true',
|
|
710
734
|
this.getAttribute('sort-endpoints-by'),
|
|
711
735
|
this.getAttribute('api-key-name'),
|
|
712
736
|
this.getAttribute('api-key-location'),
|
|
@@ -754,25 +778,62 @@ export default class RapiDoc extends LitElement {
|
|
|
754
778
|
this.observeExpandedContent(); // This will auto-highlight the selected nav-item in read-mode
|
|
755
779
|
}
|
|
756
780
|
|
|
781
|
+
this.isIntersectionObserverActive = true;
|
|
782
|
+
|
|
757
783
|
// On first time Spec load, try to navigate to location hash if provided
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
const elementId = window.location.hash.replace(regEx, '');
|
|
784
|
+
const elementId = this.getElementIDFromURL();
|
|
785
|
+
|
|
786
|
+
if (elementId) {
|
|
762
787
|
if (this.renderStyle === 'view') {
|
|
763
788
|
this.expandAndGotoOperation(elementId, true, true);
|
|
764
789
|
} else {
|
|
765
|
-
this.
|
|
790
|
+
this.scrollToPath(elementId);
|
|
766
791
|
}
|
|
767
792
|
} else if (this.renderStyle === 'focused') {
|
|
768
793
|
// If goto-path is provided and no location-hash is present then try to scroll to default element
|
|
769
794
|
if (!this.gotoPath) {
|
|
770
795
|
const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags[0]?.paths[0];
|
|
771
|
-
this.
|
|
796
|
+
this.scrollToPath(defaultElementId);
|
|
772
797
|
}
|
|
773
798
|
}
|
|
774
799
|
}
|
|
775
800
|
|
|
801
|
+
/**
|
|
802
|
+
* Return the URL from where is served the RapiDoc component, removing any hash and route prefix
|
|
803
|
+
*/
|
|
804
|
+
getComponentBaseURL() {
|
|
805
|
+
const { href } = window.location;
|
|
806
|
+
|
|
807
|
+
// Remove end of string # or /
|
|
808
|
+
const cleanRouterPrefix = this.routePrefix.replace(/(#|\/)$/, '');
|
|
809
|
+
|
|
810
|
+
if (!cleanRouterPrefix) {
|
|
811
|
+
return href.split('#')[0];
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
const indexOfRoutePrefix = href.lastIndexOf(cleanRouterPrefix);
|
|
815
|
+
|
|
816
|
+
if (indexOfRoutePrefix === -1) {
|
|
817
|
+
return href;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
return href.slice(0, indexOfRoutePrefix);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* From the URL return the ID of the element whether it is in the hash or if used a router prefix without a hash
|
|
825
|
+
*/
|
|
826
|
+
getElementIDFromURL() {
|
|
827
|
+
const baseURL = this.getComponentBaseURL();
|
|
828
|
+
const elementId = window.location.href.replace(baseURL + this.routePrefix, '');
|
|
829
|
+
return elementId;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
replaceHistoryState(hashId) {
|
|
833
|
+
const baseURL = this.getComponentBaseURL();
|
|
834
|
+
window.history.replaceState(null, null, `${baseURL}${this.routePrefix || '#'}${hashId}`);
|
|
835
|
+
}
|
|
836
|
+
|
|
776
837
|
expandAndGotoOperation(elementId, scrollToElement = true) {
|
|
777
838
|
if (!this.resolvedSpec) {
|
|
778
839
|
return;
|
|
@@ -804,9 +865,9 @@ export default class RapiDoc extends LitElement {
|
|
|
804
865
|
window.setTimeout(() => {
|
|
805
866
|
const gotoEl = this.shadowRoot.getElementById(tmpElementId);
|
|
806
867
|
if (gotoEl) {
|
|
807
|
-
gotoEl.scrollIntoView({ behavior:
|
|
868
|
+
gotoEl.scrollIntoView({ behavior: this.scrollBehavior, block: 'start' });
|
|
808
869
|
if (this.updateRoute === 'true') {
|
|
809
|
-
|
|
870
|
+
this.replaceHistoryState(tmpElementId);
|
|
810
871
|
}
|
|
811
872
|
}
|
|
812
873
|
}, isExpandingNeeded ? 150 : 0);
|
|
@@ -837,6 +898,7 @@ export default class RapiDoc extends LitElement {
|
|
|
837
898
|
if (this.isIntersectionObserverActive === false) {
|
|
838
899
|
return;
|
|
839
900
|
}
|
|
901
|
+
|
|
840
902
|
entries.forEach((entry) => {
|
|
841
903
|
if (entry.isIntersecting && entry.intersectionRatio > 0) {
|
|
842
904
|
const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active');
|
|
@@ -845,14 +907,18 @@ export default class RapiDoc extends LitElement {
|
|
|
845
907
|
// Add active class in the new element
|
|
846
908
|
if (newNavEl) {
|
|
847
909
|
if (this.updateRoute === 'true') {
|
|
848
|
-
|
|
910
|
+
this.replaceHistoryState(entry.target.id);
|
|
849
911
|
}
|
|
850
|
-
newNavEl.scrollIntoView({ behavior:
|
|
912
|
+
newNavEl.scrollIntoView({ behavior: this.scrollBehavior, block: 'center' });
|
|
851
913
|
newNavEl.classList.add('active');
|
|
914
|
+
newNavEl.part.add('section-navbar-active-item');
|
|
852
915
|
}
|
|
916
|
+
|
|
853
917
|
// Remove active class from previous element
|
|
854
|
-
if (
|
|
918
|
+
// if it is different from the new one (edge case on loading in read render style)
|
|
919
|
+
if (oldNavEl && oldNavEl !== newNavEl) {
|
|
855
920
|
oldNavEl.classList.remove('active');
|
|
921
|
+
oldNavEl.part.remove('section-navbar-active-item');
|
|
856
922
|
}
|
|
857
923
|
}
|
|
858
924
|
});
|
|
@@ -864,7 +930,7 @@ export default class RapiDoc extends LitElement {
|
|
|
864
930
|
if (e.target.getAttribute('href').startsWith('#')) {
|
|
865
931
|
const gotoEl = this.shadowRoot.getElementById(e.target.getAttribute('href').replace('#', ''));
|
|
866
932
|
if (gotoEl) {
|
|
867
|
-
gotoEl.scrollIntoView({ behavior:
|
|
933
|
+
gotoEl.scrollIntoView({ behavior: this.scrollBehavior, block: 'start' });
|
|
868
934
|
}
|
|
869
935
|
}
|
|
870
936
|
}
|
|
@@ -882,7 +948,10 @@ export default class RapiDoc extends LitElement {
|
|
|
882
948
|
*
|
|
883
949
|
*/
|
|
884
950
|
async scrollToEventTarget(event, scrollNavItemToView = true) {
|
|
885
|
-
|
|
951
|
+
if (!(event.type === 'click' || (event.type === 'keyup' && event.keyCode === 13))) {
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
const navEl = event.target;
|
|
886
955
|
if (!navEl.dataset.contentId) {
|
|
887
956
|
return;
|
|
888
957
|
}
|
|
@@ -890,21 +959,22 @@ export default class RapiDoc extends LitElement {
|
|
|
890
959
|
if (this.renderStyle === 'focused') {
|
|
891
960
|
const requestEl = this.shadowRoot.querySelector('api-request');
|
|
892
961
|
if (requestEl) {
|
|
893
|
-
requestEl.
|
|
962
|
+
requestEl.beforeNavigationFocusedMode();
|
|
894
963
|
}
|
|
895
964
|
}
|
|
896
|
-
this.
|
|
965
|
+
this.scrollToPath(navEl.dataset.contentId, true, scrollNavItemToView);
|
|
897
966
|
setTimeout(() => {
|
|
898
967
|
this.isIntersectionObserverActive = true;
|
|
899
968
|
}, 300);
|
|
900
969
|
}
|
|
901
970
|
|
|
902
971
|
// Public Method (scrolls to a given path and highlights the left-nav selection)
|
|
903
|
-
async
|
|
972
|
+
async scrollToPath(elementId, expandPath = true, scrollNavItemToView = true) {
|
|
904
973
|
if (this.renderStyle === 'focused') {
|
|
905
974
|
// for focused mode update this.focusedElementId to update the rendering, else it wont find the needed html elements
|
|
906
975
|
// focusedElementId will get validated in the template
|
|
907
976
|
this.focusedElementId = elementId;
|
|
977
|
+
await sleep(0);
|
|
908
978
|
}
|
|
909
979
|
if (this.renderStyle === 'view') {
|
|
910
980
|
this.expandAndGotoOperation(elementId, expandPath, true);
|
|
@@ -913,7 +983,7 @@ export default class RapiDoc extends LitElement {
|
|
|
913
983
|
const contentEl = this.shadowRoot.getElementById(elementId);
|
|
914
984
|
if (contentEl) {
|
|
915
985
|
isValidElementId = true;
|
|
916
|
-
contentEl.scrollIntoView({ behavior:
|
|
986
|
+
contentEl.scrollIntoView({ behavior: this.scrollBehavior, block: 'start' });
|
|
917
987
|
} else {
|
|
918
988
|
isValidElementId = false;
|
|
919
989
|
}
|
|
@@ -932,7 +1002,7 @@ export default class RapiDoc extends LitElement {
|
|
|
932
1002
|
|
|
933
1003
|
// Update Location Hash
|
|
934
1004
|
if (this.updateRoute === 'true') {
|
|
935
|
-
|
|
1005
|
+
this.replaceHistoryState(elementId);
|
|
936
1006
|
}
|
|
937
1007
|
|
|
938
1008
|
// Update NavBar View and Styles
|
|
@@ -940,14 +1010,17 @@ export default class RapiDoc extends LitElement {
|
|
|
940
1010
|
|
|
941
1011
|
if (newNavEl) {
|
|
942
1012
|
if (scrollNavItemToView) {
|
|
943
|
-
newNavEl.scrollIntoView({ behavior:
|
|
1013
|
+
newNavEl.scrollIntoView({ behavior: this.scrollBehavior, block: 'center' });
|
|
944
1014
|
}
|
|
945
1015
|
await sleep(0);
|
|
946
1016
|
const oldNavEl = this.shadowRoot.querySelector('.nav-bar-tag.active, .nav-bar-path.active, .nav-bar-info.active, .nav-bar-h1.active, .nav-bar-h2.active, .operations.active');
|
|
947
1017
|
if (oldNavEl) {
|
|
948
1018
|
oldNavEl.classList.remove('active');
|
|
1019
|
+
oldNavEl.part.remove('active');
|
|
1020
|
+
oldNavEl.part.remove('section-navbar-active-item');
|
|
949
1021
|
}
|
|
950
1022
|
newNavEl.classList.add('active'); // must add the class after scrolling
|
|
1023
|
+
newNavEl.part.add('section-navbar-active-item');
|
|
951
1024
|
// this.requestUpdate();
|
|
952
1025
|
}
|
|
953
1026
|
}
|
|
@@ -986,8 +1059,8 @@ export default class RapiDoc extends LitElement {
|
|
|
986
1059
|
} else {
|
|
987
1060
|
searchInputEl = eventTargetEl.closest('.advanced-search-options').querySelector('input[type=text]');
|
|
988
1061
|
}
|
|
989
|
-
const
|
|
990
|
-
this.advancedSearchMatches = advancedSearch(searchInputEl.value, this.resolvedSpec.tags,
|
|
1062
|
+
const searchOptions = [...eventTargetEl.closest('.advanced-search-options').querySelectorAll('input:checked')].map((v) => v.id);
|
|
1063
|
+
this.advancedSearchMatches = advancedSearch(searchInputEl.value, this.resolvedSpec.tags, searchOptions);
|
|
991
1064
|
}, delay);
|
|
992
1065
|
}
|
|
993
1066
|
}
|
|
@@ -105,15 +105,6 @@ input[type="password"]::placeholder {
|
|
|
105
105
|
opacity:1;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
select:focus,
|
|
109
|
-
textarea:focus,
|
|
110
|
-
input[type="text"]:focus,
|
|
111
|
-
input[type="password"]:focus,
|
|
112
|
-
textarea:active,
|
|
113
|
-
input[type="text"]:active,
|
|
114
|
-
input[type="password"]:active {
|
|
115
|
-
border:1px solid var(--primary-color);
|
|
116
|
-
}
|
|
117
108
|
|
|
118
109
|
input[type="file"]{
|
|
119
110
|
font-family: var(--font-regular);
|
|
@@ -167,10 +158,6 @@ textarea::-webkit-scrollbar-thumb {
|
|
|
167
158
|
margin-bottom:2px;
|
|
168
159
|
}
|
|
169
160
|
|
|
170
|
-
input[type="checkbox"]:focus{
|
|
171
|
-
outline:0;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
161
|
/* Toggle Body */
|
|
175
162
|
input[type="checkbox"] {
|
|
176
163
|
appearance: none;
|
|
@@ -203,7 +190,7 @@ input[type="checkbox"]:after {
|
|
|
203
190
|
|
|
204
191
|
/* Toggle Body - Checked */
|
|
205
192
|
input[type="checkbox"]:checked {
|
|
206
|
-
|
|
193
|
+
background-color: var(--green);
|
|
207
194
|
border-color: var(--green);
|
|
208
195
|
}
|
|
209
196
|
/* Toggle Thumb - Checked*/
|
|
@@ -212,5 +199,4 @@ input[type="checkbox"]:checked:after {
|
|
|
212
199
|
left: 16px;
|
|
213
200
|
right: 1px;
|
|
214
201
|
transition: border .25s, left .15s .25s, right .25s .175s;
|
|
215
|
-
}
|
|
216
|
-
`;
|
|
202
|
+
}`;
|
package/src/styles/nav-styles.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
3
|
export default css`
|
|
4
|
+
.nav-bar-info:focus-visible,
|
|
5
|
+
.nav-bar-tag:focus-visible,
|
|
6
|
+
.nav-bar-path:focus-visible {
|
|
7
|
+
outline: 1px solid;
|
|
8
|
+
box-shadow: none;
|
|
9
|
+
outline-offset: -4px;
|
|
10
|
+
}
|
|
11
|
+
.nav-bar-expand-all:focus-visible,
|
|
12
|
+
.nav-bar-collapse-all:focus-visible,
|
|
13
|
+
.nav-bar-tag-icon:focus-visible {
|
|
14
|
+
outline: 1px solid;
|
|
15
|
+
box-shadow: none;
|
|
16
|
+
outline-offset: 2px;
|
|
17
|
+
}
|
|
4
18
|
.nav-bar {
|
|
5
19
|
width:0;
|
|
6
20
|
height:100%;
|
|
@@ -35,6 +49,26 @@ export default css`
|
|
|
35
49
|
.nav-bar.read .nav-bar-tag-icon {
|
|
36
50
|
display:none;
|
|
37
51
|
}
|
|
52
|
+
.nav-bar-paths-under-tag {
|
|
53
|
+
overflow:hidden;
|
|
54
|
+
transition: max-height .2s ease-out, visibility .3s;
|
|
55
|
+
}
|
|
56
|
+
.collapsed .nav-bar-paths-under-tag {
|
|
57
|
+
visibility: hidden;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.nav-bar-expand-all {
|
|
61
|
+
transform: rotate(90deg);
|
|
62
|
+
cursor:pointer;
|
|
63
|
+
margin-right:10px;
|
|
64
|
+
}
|
|
65
|
+
.nav-bar-collapse-all {
|
|
66
|
+
transform: rotate(270deg);
|
|
67
|
+
cursor:pointer;
|
|
68
|
+
}
|
|
69
|
+
.nav-bar-expand-all:hover, .nav-bar-collapse-all:hover {
|
|
70
|
+
color: var(--primary-color);
|
|
71
|
+
}
|
|
38
72
|
|
|
39
73
|
.nav-bar-tag-icon {
|
|
40
74
|
color: var(--nav-text-color);
|
|
@@ -43,9 +77,6 @@ export default css`
|
|
|
43
77
|
.nav-bar-tag-icon:hover {
|
|
44
78
|
color:var(--nav-hover-text-color);
|
|
45
79
|
}
|
|
46
|
-
.nav-bar.focused .nav-bar-tag-and-paths.collapsed .nav-bar-paths-under-tag {
|
|
47
|
-
display:none;
|
|
48
|
-
}
|
|
49
80
|
.nav-bar.focused .nav-bar-tag-and-paths.collapsed .nav-bar-tag-icon::after {
|
|
50
81
|
content: '⌵';
|
|
51
82
|
width:16px;
|
|
@@ -89,7 +120,12 @@ export default css`
|
|
|
89
120
|
.nav-bar-tag,
|
|
90
121
|
.nav-bar-path {
|
|
91
122
|
display:flex;
|
|
92
|
-
cursor:pointer;
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
width: 100%;
|
|
125
|
+
border: none;
|
|
126
|
+
border-radius:4px;
|
|
127
|
+
color: var(--nav-text-color);
|
|
128
|
+
background: transparent;
|
|
93
129
|
border-left:4px solid transparent;
|
|
94
130
|
}
|
|
95
131
|
|
|
@@ -130,16 +166,27 @@ export default css`
|
|
|
130
166
|
}
|
|
131
167
|
.nav-bar-h2 {margin-left:12px;}
|
|
132
168
|
|
|
133
|
-
.nav-bar-h1.active,
|
|
134
|
-
.nav-bar-h2.active,
|
|
135
|
-
.nav-bar-info.active,
|
|
136
|
-
.nav-bar-tag.active,
|
|
137
|
-
.nav-bar-path.active,
|
|
138
|
-
.nav-bar-section.operations.active {
|
|
169
|
+
.nav-bar-h1.left-bar.active,
|
|
170
|
+
.nav-bar-h2.left-bar.active,
|
|
171
|
+
.nav-bar-info.left-bar.active,
|
|
172
|
+
.nav-bar-tag.left-bar.active,
|
|
173
|
+
.nav-bar-path.left-bar.active,
|
|
174
|
+
.nav-bar-section.left-bar.operations.active {
|
|
139
175
|
border-left:4px solid var(--nav-accent-color);
|
|
140
176
|
color:var(--nav-hover-text-color);
|
|
141
177
|
}
|
|
142
178
|
|
|
179
|
+
.nav-bar-h1.colored-block.active,
|
|
180
|
+
.nav-bar-h2.colored-block.active,
|
|
181
|
+
.nav-bar-info.colored-block.active,
|
|
182
|
+
.nav-bar-tag.colored-block.active,
|
|
183
|
+
.nav-bar-path.colored-block.active,
|
|
184
|
+
.nav-bar-section.colored-block.operations.active {
|
|
185
|
+
background-color: var(--nav-accent-color);
|
|
186
|
+
color: var(--nav-accent-text-color);
|
|
187
|
+
border-radius: 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
143
190
|
.nav-bar-h1:hover,
|
|
144
191
|
.nav-bar-h2:hover,
|
|
145
192
|
.nav-bar-info:hover,
|
|
@@ -10,6 +10,7 @@ export default css`
|
|
|
10
10
|
width: 100%;
|
|
11
11
|
box-sizing: content-box;
|
|
12
12
|
border-bottom: 1px dotted transparent;
|
|
13
|
+
transition: max-height 0.3s ease-out;
|
|
13
14
|
}
|
|
14
15
|
.td {
|
|
15
16
|
display: block;
|
|
@@ -21,9 +22,29 @@ export default css`
|
|
|
21
22
|
word-break: break-all;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
.collapsed-descr .key {
|
|
25
|
+
.collapsed-all-descr .key {
|
|
25
26
|
overflow:hidden;
|
|
26
27
|
}
|
|
28
|
+
.expanded-all-descr .key-descr .descr-expand-toggle {
|
|
29
|
+
display:none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.key-descr .descr-expand-toggle {
|
|
33
|
+
display:inline-block;
|
|
34
|
+
user-select:none;
|
|
35
|
+
color: var(--fg);
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transform: rotate(45deg);
|
|
38
|
+
transition: transform .2s ease;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.expanded-descr .key-descr .descr-expand-toggle {
|
|
42
|
+
transform: rotate(270deg)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.key-descr .descr-expand-toggle:hover {
|
|
46
|
+
color: var(--primary-color);
|
|
47
|
+
}
|
|
27
48
|
|
|
28
49
|
.expanded-descr .more-content { display:none; }
|
|
29
50
|
|
|
@@ -40,13 +61,6 @@ export default css`
|
|
|
40
61
|
overflow:hidden;
|
|
41
62
|
display: none;
|
|
42
63
|
}
|
|
43
|
-
.collapsed-descr .tr {
|
|
44
|
-
max-height:20px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.tr.xxx-of{
|
|
48
|
-
border-top: 1px dotted var(--primary-color);
|
|
49
|
-
}
|
|
50
64
|
|
|
51
65
|
.xxx-of-key {
|
|
52
66
|
font-size: calc(var(--font-size-small) - 2px);
|
|
@@ -61,10 +75,10 @@ export default css`
|
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
.xxx-of-descr {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
font-family: var(--font-regular);
|
|
79
|
+
color: var(--primary-color);
|
|
80
|
+
font-size: calc(var(--font-size-small) - 1px);
|
|
81
|
+
margin-left: 2px;
|
|
68
82
|
}
|
|
69
83
|
|
|
70
84
|
.stri, .string, .uri, .url, .byte, .bina, .date, .pass, .ipv4, .ipv4, .uuid, .emai, .host {color:var(--green);}
|
|
@@ -72,6 +86,7 @@ export default css`
|
|
|
72
86
|
.null {color:var(--red);}
|
|
73
87
|
.bool, .boolean{color:var(--orange)}
|
|
74
88
|
.enum {color:var(--purple)}
|
|
89
|
+
.cons {color:var(--purple)}
|
|
75
90
|
.recu {color:var(--brown)}
|
|
76
91
|
.toolbar {
|
|
77
92
|
display:flex;
|
|
@@ -90,9 +105,6 @@ export default css`
|
|
|
90
105
|
font-weight: bold;
|
|
91
106
|
text-transform: uppercase;
|
|
92
107
|
}
|
|
93
|
-
.schema-root-type.xxx-of {
|
|
94
|
-
display:none;
|
|
95
|
-
}
|
|
96
108
|
.toolbar-item:first-of-type { margin:0 2px 0 0;}
|
|
97
109
|
|
|
98
110
|
@media only screen and (min-width: 500px) {
|
package/src/styles/tab-styles.js
CHANGED
|
@@ -59,9 +59,9 @@ export default function searchByPropertiesModalTemplate() {
|
|
|
59
59
|
}
|
|
60
60
|
}"
|
|
61
61
|
>
|
|
62
|
-
<span class="upper bold-text method-fg ${path.method}">${path.method}</span>
|
|
63
|
-
<span>${path.path}</span>
|
|
64
|
-
<span class="regular-font gray-text">${path.summary}</span>
|
|
62
|
+
<span style="pointer-events: none" class="upper bold-text method-fg ${path.method}">${path.method}</span>
|
|
63
|
+
<span style="pointer-events: none">${path.path}</span>
|
|
64
|
+
<span style="pointer-events: none" class="regular-font gray-text">${path.summary}</span>
|
|
65
65
|
</div>
|
|
66
66
|
`)
|
|
67
67
|
}
|
|
@@ -35,14 +35,14 @@ export default function callbackTemplate(callbacks) {
|
|
|
35
35
|
active-schema-tab = "${this.defaultSchemaTab}"
|
|
36
36
|
schema-expand-level = "${this.schemaExpandLevel}"
|
|
37
37
|
schema-description-expanded = "${this.schemaDescriptionExpanded}"
|
|
38
|
-
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
38
|
+
allow-schema-description-expand-toggle = "${this.allowSchemaDescriptionExpandToggle}"
|
|
39
39
|
schema-hide-read-only = "false"
|
|
40
40
|
schema-hide-write-only = "${this.schemaHideWriteOnly === 'never' ? 'false' : 'true'}"
|
|
41
41
|
fetch-credentials = "${this.fetchCredentials}"
|
|
42
|
-
exportparts = "btn:btn, btn-fill:btn-fill, btn-outline:btn-outline, btn-try:btn-try, btn-clear:btn-clear, btn-clear-resp:btn-clear-resp,
|
|
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
43
|
file-input:file-input, textbox:textbox, textbox-param:textbox-param, textarea:textarea, textarea-param:textarea-param,
|
|
44
44
|
anchor:anchor, anchor-param-example:anchor-param-example, schema-description:schema-description, schema-multiline-toggle:schema-multiline-toggle"
|
|
45
|
-
|
|
45
|
+
> </api-request>
|
|
46
46
|
|
|
47
47
|
<api-response
|
|
48
48
|
style = "width:100%;"
|