openapi-explorer 2.2.772 → 2.2.774
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.
@@ -495,24 +495,6 @@ export default class OpenApiExplorer extends LitElement {
|
|
495
495
|
}
|
496
496
|
}, isExpandingNeeded ? 150 : 0);
|
497
497
|
}
|
498
|
-
isValidTopId(id) {
|
499
|
-
return id.startsWith('overview') || id === 'servers' || id === 'auth';
|
500
|
-
}
|
501
|
-
isValidPathId(id) {
|
502
|
-
if (id === 'overview' && !this.hideInfo) {
|
503
|
-
return true;
|
504
|
-
}
|
505
|
-
if (id === 'servers' && !this.hideServerSelection) {
|
506
|
-
return true;
|
507
|
-
}
|
508
|
-
if (id === 'auth' && !this.hideAuthentication) {
|
509
|
-
return true;
|
510
|
-
}
|
511
|
-
if (id.startsWith('tag--')) {
|
512
|
-
return this.resolvedSpec.tags && this.resolvedSpec.tags.find(tag => tag.elementId === id);
|
513
|
-
}
|
514
|
-
return this.resolvedSpec.tags && this.resolvedSpec.tags.find(tag => tag.paths.find(path => path.elementId === id));
|
515
|
-
}
|
516
498
|
onIntersect(entries) {
|
517
499
|
if (this.isIntersectionObserverActive === false) {
|
518
500
|
return;
|
@@ -630,15 +612,21 @@ export default class OpenApiExplorer extends LitElement {
|
|
630
612
|
|
631
613
|
// explorerLocation will get validated in the focused-endpoint-template
|
632
614
|
this.explorerLocation = elementId;
|
633
|
-
const
|
634
|
-
if (
|
635
|
-
|
615
|
+
const tagFoundByPath = this.resolvedSpec.tags.find(t => t.paths.some(p => p.elementId === elementId));
|
616
|
+
if (tagFoundByPath) {
|
617
|
+
tagFoundByPath.expanded = true;
|
636
618
|
}
|
619
|
+
|
637
620
|
// Convert to Async and to the background, so that we can be sure that the operation has been expanded and put into view before trying to directly scroll to it (or it won't be found in the next line and even if it is, it might not be able to be scrolled into view)
|
638
621
|
await sleep(0);
|
639
622
|
|
640
623
|
// In the case of section scrolling, these are hard swaps, so just load "section". In the case of `tags` the headers have the element html Id in the last `--id`, so split that off and check for it
|
641
|
-
|
624
|
+
// NOTE: Really this whole nonsense is because Marked, inserts -- between the prefix and the type and we cannot control it at all. When upgrading to Node 20, marked 16+, we will have to change this and we might even be able to make it work correctly. The biggest problem is that both the separator `--` and invalid character replacement `-`, can stack up.
|
625
|
+
const contentEl = this.shadowRoot.getElementById(elementId !== null && elementId !== void 0 && elementId.startsWith('section') ? 'section' : elementId)
|
626
|
+
// Remove the prefix of the section as headers in sub sections are not prefixed with the type.
|
627
|
+
|| elementId.split('--').length > 1 && this.shadowRoot.getElementById(elementId.split('--').slice(1).join('--'))
|
628
|
+
// Remove the prefix of the operation (tag--) and the tag name (tag--NAME--) from header, as headers in sub sections are not prefixed with the type.
|
629
|
+
|| elementId.split('--').length > 2 && this.shadowRoot.getElementById(elementId.split('--').slice(2).join('--')) || this.shadowRoot.getElementById(elementId.split('--').slice(-1)[0]);
|
642
630
|
if (!contentEl) {
|
643
631
|
return;
|
644
632
|
}
|
@@ -684,8 +672,8 @@ export default class OpenApiExplorer extends LitElement {
|
|
684
672
|
// Update Location Hash
|
685
673
|
replaceState(elementId);
|
686
674
|
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
687
|
-
} else if (
|
688
|
-
|
675
|
+
} else if (elementId.match('cmp--') || elementId.match('tag--') || elementId.match('overview--') || elementId.match('auth--') || elementId.match('servers--')) {
|
676
|
+
contentEl.scrollIntoView({
|
689
677
|
behavior: 'auto',
|
690
678
|
block: 'start'
|
691
679
|
});
|
@@ -694,7 +682,7 @@ export default class OpenApiExplorer extends LitElement {
|
|
694
682
|
replaceState(elementId);
|
695
683
|
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
696
684
|
} else {
|
697
|
-
|
685
|
+
this.shadowRoot.getElementById('operations-root').scrollIntoView({
|
698
686
|
behavior: 'auto',
|
699
687
|
block: 'start'
|
700
688
|
});
|
@@ -12,7 +12,7 @@ export function debounce(fn, delay) {
|
|
12
12
|
}, delay);
|
13
13
|
};
|
14
14
|
}
|
15
|
-
export const invalidCharsRegEx = new RegExp(/[\s#:?&={}]
|
15
|
+
export const invalidCharsRegEx = new RegExp(/[\s#:?&={}-]+/, 'g'); // used for generating valid html element ids by replacing the invalid chars with hyphen (-)
|
16
16
|
|
17
17
|
export function sleep(ms) {
|
18
18
|
return new Promise(resolve => setTimeout(resolve, ms));
|
@@ -501,24 +501,6 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
501
501
|
}
|
502
502
|
}, isExpandingNeeded ? 150 : 0);
|
503
503
|
}
|
504
|
-
isValidTopId(id) {
|
505
|
-
return id.startsWith('overview') || id === 'servers' || id === 'auth';
|
506
|
-
}
|
507
|
-
isValidPathId(id) {
|
508
|
-
if (id === 'overview' && !this.hideInfo) {
|
509
|
-
return true;
|
510
|
-
}
|
511
|
-
if (id === 'servers' && !this.hideServerSelection) {
|
512
|
-
return true;
|
513
|
-
}
|
514
|
-
if (id === 'auth' && !this.hideAuthentication) {
|
515
|
-
return true;
|
516
|
-
}
|
517
|
-
if (id.startsWith('tag--')) {
|
518
|
-
return this.resolvedSpec.tags && this.resolvedSpec.tags.find(tag => tag.elementId === id);
|
519
|
-
}
|
520
|
-
return this.resolvedSpec.tags && this.resolvedSpec.tags.find(tag => tag.paths.find(path => path.elementId === id));
|
521
|
-
}
|
522
504
|
onIntersect(entries) {
|
523
505
|
if (this.isIntersectionObserverActive === false) {
|
524
506
|
return;
|
@@ -636,15 +618,21 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
636
618
|
|
637
619
|
// explorerLocation will get validated in the focused-endpoint-template
|
638
620
|
this.explorerLocation = elementId;
|
639
|
-
const
|
640
|
-
if (
|
641
|
-
|
621
|
+
const tagFoundByPath = this.resolvedSpec.tags.find(t => t.paths.some(p => p.elementId === elementId));
|
622
|
+
if (tagFoundByPath) {
|
623
|
+
tagFoundByPath.expanded = true;
|
642
624
|
}
|
625
|
+
|
643
626
|
// Convert to Async and to the background, so that we can be sure that the operation has been expanded and put into view before trying to directly scroll to it (or it won't be found in the next line and even if it is, it might not be able to be scrolled into view)
|
644
627
|
await (0, _commonUtils.sleep)(0);
|
645
628
|
|
646
629
|
// In the case of section scrolling, these are hard swaps, so just load "section". In the case of `tags` the headers have the element html Id in the last `--id`, so split that off and check for it
|
647
|
-
|
630
|
+
// NOTE: Really this whole nonsense is because Marked, inserts -- between the prefix and the type and we cannot control it at all. When upgrading to Node 20, marked 16+, we will have to change this and we might even be able to make it work correctly. The biggest problem is that both the separator `--` and invalid character replacement `-`, can stack up.
|
631
|
+
const contentEl = this.shadowRoot.getElementById(elementId !== null && elementId !== void 0 && elementId.startsWith('section') ? 'section' : elementId)
|
632
|
+
// Remove the prefix of the section as headers in sub sections are not prefixed with the type.
|
633
|
+
|| elementId.split('--').length > 1 && this.shadowRoot.getElementById(elementId.split('--').slice(1).join('--'))
|
634
|
+
// Remove the prefix of the operation (tag--) and the tag name (tag--NAME--) from header, as headers in sub sections are not prefixed with the type.
|
635
|
+
|| elementId.split('--').length > 2 && this.shadowRoot.getElementById(elementId.split('--').slice(2).join('--')) || this.shadowRoot.getElementById(elementId.split('--').slice(-1)[0]);
|
648
636
|
if (!contentEl) {
|
649
637
|
return;
|
650
638
|
}
|
@@ -690,8 +678,8 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
690
678
|
// Update Location Hash
|
691
679
|
(0, _commonUtils.replaceState)(elementId);
|
692
680
|
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
693
|
-
} else if (
|
694
|
-
|
681
|
+
} else if (elementId.match('cmp--') || elementId.match('tag--') || elementId.match('overview--') || elementId.match('auth--') || elementId.match('servers--')) {
|
682
|
+
contentEl.scrollIntoView({
|
695
683
|
behavior: 'auto',
|
696
684
|
block: 'start'
|
697
685
|
});
|
@@ -700,7 +688,7 @@ class OpenApiExplorer extends _lit.LitElement {
|
|
700
688
|
(0, _commonUtils.replaceState)(elementId);
|
701
689
|
newNavEl = this.shadowRoot.getElementById(`link-${elementId}`);
|
702
690
|
} else {
|
703
|
-
|
691
|
+
this.shadowRoot.getElementById('operations-root').scrollIntoView({
|
704
692
|
behavior: 'auto',
|
705
693
|
block: 'start'
|
706
694
|
});
|
@@ -27,7 +27,7 @@ function debounce(fn, delay) {
|
|
27
27
|
}, delay);
|
28
28
|
};
|
29
29
|
}
|
30
|
-
const invalidCharsRegEx = exports.invalidCharsRegEx = new RegExp(/[\s#:?&={}]
|
30
|
+
const invalidCharsRegEx = exports.invalidCharsRegEx = new RegExp(/[\s#:?&={}-]+/, 'g'); // used for generating valid html element ids by replacing the invalid chars with hyphen (-)
|
31
31
|
|
32
32
|
function sleep(ms) {
|
33
33
|
return new Promise(resolve => setTimeout(resolve, ms));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "openapi-explorer",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.774",
|
4
4
|
"description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
|
5
5
|
"author": "Authress Developers <developers@authress.io>",
|
6
6
|
"type": "module",
|