openapi-explorer 0.8.296 → 0.8.297

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "0.8.296",
3
+ "version": "0.8.297",
4
4
  "description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
5
5
  "author": "Rhosys Developers <developers@rhosys.ch>",
6
6
  "repository": {
@@ -558,26 +558,20 @@ export default class OpenApiExplorer extends LitElement {
558
558
  this.resolvedSpec = spec;
559
559
  this.selectedServer = this.resolvedSpec.servers.find((s) => s.url === this.serverUrl || !this.serverUrl);
560
560
  this.dispatchEvent(new CustomEvent('spec-loaded', { detail: spec }));
561
+ // Wait for 10 milliseconds to account for any changes to the spec via spec-loaded
562
+ await sleep(10);
561
563
  this.requestUpdate();
562
564
 
563
565
  // Initiate IntersectionObserver and put it at the end of event loop, to allow loading all the child elements (must for larger specs)
564
566
  this.intersectionObserver.disconnect();
565
- if (this.renderStyle === 'read') {
566
- await sleep(100);
567
- this.observeExpandedContent(); // This will auto-highlight the selected nav-item in read-mode
567
+
568
+ if (this.renderStyle === 'focused') {
569
+ const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags && this.resolvedSpec.tags[0] && this.resolvedSpec.tags[0].paths[0];
570
+ this.scrollTo(this.explorerLocation || defaultElementId);
568
571
  }
569
572
 
570
- // On first time Spec load, try to navigate to location hash if provided
571
- const locationHash = this.explorerLocation;
572
- if (locationHash) {
573
- if (this.renderStyle === 'view') {
574
- this.expandAndGotoOperation(locationHash);
575
- } else if (this.renderStyle === 'focused') {
576
- this.scrollTo(locationHash);
577
- }
578
- } else if (this.renderStyle === 'focused') {
579
- const defaultElementId = this.showInfo ? 'overview' : this.resolvedSpec.tags[0] && this.resolvedSpec.tags[0].paths[0];
580
- this.scrollTo(defaultElementId);
573
+ if (this.renderStyle === 'view' && this.explorerLocation) {
574
+ this.expandAndGotoOperation(this.explorerLocation);
581
575
  }
582
576
  }
583
577
 
@@ -702,11 +696,9 @@ export default class OpenApiExplorer extends LitElement {
702
696
  return;
703
697
  }
704
698
 
705
- if (this.renderStyle === 'focused') {
706
- // explorerLocation will get validated in the focused-endpoint-template
707
- this.explorerLocation = elementId;
708
- await sleep(0);
709
- }
699
+ // explorerLocation will get validated in the focused-endpoint-template
700
+ this.explorerLocation = elementId;
701
+ await sleep(0);
710
702
 
711
703
  const contentEl = this.shadowRoot.getElementById(elementId);
712
704
  if (!contentEl) {
@@ -714,22 +706,20 @@ export default class OpenApiExplorer extends LitElement {
714
706
  }
715
707
 
716
708
  // For focused APIs, always scroll to the top of the component
717
- if (this.renderStyle === 'focused' && !elementId.match('cmp--')) {
709
+ if (!elementId.match('cmp--')) {
718
710
  this.shadowRoot.getElementById('operations-root').scrollIntoView({ behavior: 'auto', block: 'start' });
719
711
  } else {
720
712
  contentEl.scrollIntoView({ behavior: 'auto', block: 'start' });
721
713
  }
722
714
 
723
715
  // for focused style it is important to reset request-body-selection and response selection which maintains the state for in case of multiple req-body or multiple response mime-type
724
- if (this.renderStyle === 'focused') {
725
- const requestEl = this.shadowRoot.querySelector('api-request');
726
- if (requestEl) {
727
- requestEl.resetRequestBodySelection();
728
- }
729
- const responseEl = this.shadowRoot.querySelector('api-response');
730
- if (responseEl) {
731
- responseEl.resetSelection();
732
- }
716
+ const requestEl = this.shadowRoot.querySelector('api-request');
717
+ if (requestEl) {
718
+ requestEl.resetRequestBodySelection();
719
+ }
720
+ const responseEl = this.shadowRoot.querySelector('api-response');
721
+ if (responseEl) {
722
+ responseEl.resetSelection();
733
723
  }
734
724
 
735
725
  // Update Location Hash
@@ -761,7 +751,7 @@ export default class OpenApiExplorer extends LitElement {
761
751
  node.classList.remove('active');
762
752
  });
763
753
  newNavEl.classList.add('active'); // must add the class after scrolling
764
- // this.requestUpdate();
754
+ this.requestUpdate();
765
755
  }
766
756
 
767
757
  // Event handler for Advanced Search text-inputs and checkboxes