openapi-explorer 2.2.770 → 2.2.771

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,11 @@ import { getI18nText } from '../languages/index.js';
5
5
  import { expandCollapseComponent } from './endpoint-template.js';
6
6
  import { getComponentInfo } from './components-template.js';
7
7
  function onExpandCollapseTag(event, tagId) {
8
+ if (tagId === 'link-overview') {
9
+ this.resolvedSpec.info.expanded = !this.resolvedSpec.info.expanded;
10
+ this.scrollToEventTarget(event, false);
11
+ return;
12
+ }
8
13
  const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
9
14
  if (!tag) {
10
15
  return;
@@ -12,6 +17,7 @@ function onExpandCollapseTag(event, tagId) {
12
17
  tag.expanded = !tag.expanded;
13
18
  if (tag.expanded && this.operationsCollapsed) {
14
19
  this.resolvedSpec.tags.filter(t => t.elementId !== tagId).forEach(t => t.expanded = false);
20
+ this.resolvedSpec.info.expanded = false;
15
21
  }
16
22
 
17
23
  // Only display the dedicated tag page if the tag has a description, otherwise, it will be an ugly page with nothing on it.
@@ -39,12 +45,14 @@ export function expandCollapseAllComponents() {
39
45
 
40
46
  /* eslint-disable indent */
41
47
  export default function navbarTemplate() {
42
- var _this$resolvedSpec$co;
43
- return html` <nav class="nav-bar ${this.renderStyle}" part="section-navbar" aria-label="${getI18nText('menu.menu')}"> <slot name="nav-header"></slot> ${this.hideSearch ? '' : html` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px"> <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="${getI18nText('menu.filter')}" @input="${this.onSearchChange}" spellcheck="false"> </div> <button class="m-btn outline-primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> ${getI18nText('menu.search')} </button> </div> `} ${html`<nav class="nav-scroll" part="navbar-scroll"> ${this.hideInfo || !this.resolvedSpec.info ? '' : html`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}" role="link" tabindex="0" @keydown="${e => {
48
+ var _this$resolvedSpec$in, _this$resolvedSpec$co;
49
+ return html` <nav class="nav-bar ${this.renderStyle}" part="section-navbar" aria-label="${getI18nText('menu.menu')}"> <slot name="nav-header"></slot> ${this.hideSearch ? '' : html` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px"> <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="${getI18nText('menu.filter')}" @input="${this.onSearchChange}" spellcheck="false"> </div> <button class="m-btn outline-primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> ${getI18nText('menu.search')} </button> </div> `} ${html`<nav class="nav-scroll" part="navbar-scroll"> ${this.hideInfo || !this.resolvedSpec.info ? '' : html` <div class="nav-bar-tag-and-paths ${this.resolvedSpec.info.expanded ? '' : 'collapsed'}"> <div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => {
50
+ onExpandCollapseTag.call(this, e, 'link-overview');
51
+ }}" role="link" tabindex="0" @keydown="${e => {
44
52
  if (e.key === 'Enter') {
45
53
  e.target.click();
46
54
  }
47
- }}" ; }> ${this.resolvedSpec.info.title || getI18nText('menu.overview')} </div>`} ${this.hideServerSelection ? '' : html`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}" role="link" tabindex="0" @keydown="${e => {
55
+ }}" ; }> ${this.resolvedSpec.info.title || getI18nText('menu.overview')} </div> <div class="nav-bar-section-wrapper"> <div> ${((_this$resolvedSpec$in = this.resolvedSpec.info.headers) === null || _this$resolvedSpec$in === void 0 ? void 0 : _this$resolvedSpec$in.map(header => html` <div class="nav-bar-h${header.depth}" id="link-overview--${new marked.Slugger().slug(header.text)}" data-content-id="overview--${new marked.Slugger().slug(header.text)}" @click="${e => this.scrollToEventTarget(e, false)}"> ${header.text} </div>`)) || ''} </div> </div> </div> `} ${this.hideServerSelection ? '' : html`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}" role="link" tabindex="0" @keydown="${e => {
48
56
  if (e.key === 'Enter') {
49
57
  e.target.click();
50
58
  }
@@ -110,8 +110,11 @@ export default async function ProcessSpec(specUrlOrObject, serverUrl = '') {
110
110
  }];
111
111
  }
112
112
  const parsedSpec = {
113
- info: jsonParsedSpec.info,
114
- infoDescriptionHeaders,
113
+ info: {
114
+ ...jsonParsedSpec.info,
115
+ expanded: true,
116
+ headers: infoDescriptionHeaders
117
+ },
115
118
  tags,
116
119
  components,
117
120
  // pathGroups,
@@ -11,6 +11,11 @@ var _index = require("../languages/index.js");
11
11
  var _endpointTemplate = require("./endpoint-template.js");
12
12
  var _componentsTemplate = require("./components-template.js");
13
13
  function onExpandCollapseTag(event, tagId) {
14
+ if (tagId === 'link-overview') {
15
+ this.resolvedSpec.info.expanded = !this.resolvedSpec.info.expanded;
16
+ this.scrollToEventTarget(event, false);
17
+ return;
18
+ }
14
19
  const tag = this.resolvedSpec.tags.find(t => t.elementId === tagId);
15
20
  if (!tag) {
16
21
  return;
@@ -18,6 +23,7 @@ function onExpandCollapseTag(event, tagId) {
18
23
  tag.expanded = !tag.expanded;
19
24
  if (tag.expanded && this.operationsCollapsed) {
20
25
  this.resolvedSpec.tags.filter(t => t.elementId !== tagId).forEach(t => t.expanded = false);
26
+ this.resolvedSpec.info.expanded = false;
21
27
  }
22
28
 
23
29
  // Only display the dedicated tag page if the tag has a description, otherwise, it will be an ugly page with nothing on it.
@@ -45,12 +51,14 @@ function expandCollapseAllComponents() {
45
51
 
46
52
  /* eslint-disable indent */
47
53
  function navbarTemplate() {
48
- var _this$resolvedSpec$co;
49
- return (0, _lit.html)` <nav class="nav-bar ${this.renderStyle}" part="section-navbar" aria-label="${(0, _index.getI18nText)('menu.menu')}"> <slot name="nav-header"></slot> ${this.hideSearch ? '' : (0, _lit.html)` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px"> <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, _index.getI18nText)('menu.filter')}" @input="${this.onSearchChange}" spellcheck="false"> </div> <button class="m-btn outline-primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> ${(0, _index.getI18nText)('menu.search')} </button> </div> `} ${(0, _lit.html)`<nav class="nav-scroll" part="navbar-scroll"> ${this.hideInfo || !this.resolvedSpec.info ? '' : (0, _lit.html)`<div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => this.scrollToEventTarget(e, false)}" role="link" tabindex="0" @keydown="${e => {
54
+ var _this$resolvedSpec$in, _this$resolvedSpec$co;
55
+ return (0, _lit.html)` <nav class="nav-bar ${this.renderStyle}" part="section-navbar" aria-label="${(0, _index.getI18nText)('menu.menu')}"> <slot name="nav-header"></slot> ${this.hideSearch ? '' : (0, _lit.html)` <div style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding:24px"> <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, _index.getI18nText)('menu.filter')}" @input="${this.onSearchChange}" spellcheck="false"> </div> <button class="m-btn outline-primary" part="btn btn-fill btn-search" style="margin-left:5px" @click="${this.onShowSearchModalClicked}"> ${(0, _index.getI18nText)('menu.search')} </button> </div> `} ${(0, _lit.html)`<nav class="nav-scroll" part="navbar-scroll"> ${this.hideInfo || !this.resolvedSpec.info ? '' : (0, _lit.html)` <div class="nav-bar-tag-and-paths ${this.resolvedSpec.info.expanded ? '' : 'collapsed'}"> <div class="nav-bar-info" id="link-overview" data-content-id="overview" @click="${e => {
56
+ onExpandCollapseTag.call(this, e, 'link-overview');
57
+ }}" role="link" tabindex="0" @keydown="${e => {
50
58
  if (e.key === 'Enter') {
51
59
  e.target.click();
52
60
  }
53
- }}" ; }> ${this.resolvedSpec.info.title || (0, _index.getI18nText)('menu.overview')} </div>`} ${this.hideServerSelection ? '' : (0, _lit.html)`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}" role="link" tabindex="0" @keydown="${e => {
61
+ }}" ; }> ${this.resolvedSpec.info.title || (0, _index.getI18nText)('menu.overview')} </div> <div class="nav-bar-section-wrapper"> <div> ${((_this$resolvedSpec$in = this.resolvedSpec.info.headers) === null || _this$resolvedSpec$in === void 0 ? void 0 : _this$resolvedSpec$in.map(header => (0, _lit.html)` <div class="nav-bar-h${header.depth}" id="link-overview--${new _marked.marked.Slugger().slug(header.text)}" data-content-id="overview--${new _marked.marked.Slugger().slug(header.text)}" @click="${e => this.scrollToEventTarget(e, false)}"> ${header.text} </div>`)) || ''} </div> </div> </div> `} ${this.hideServerSelection ? '' : (0, _lit.html)`<div class="nav-bar-info" id="link-servers" data-content-id="servers" @click="${e => this.scrollToEventTarget(e, false)}" role="link" tabindex="0" @keydown="${e => {
54
62
  if (e.key === 'Enter') {
55
63
  e.target.click();
56
64
  }
@@ -116,8 +116,11 @@ async function ProcessSpec(specUrlOrObject, serverUrl = '') {
116
116
  }];
117
117
  }
118
118
  const parsedSpec = {
119
- info: jsonParsedSpec.info,
120
- infoDescriptionHeaders,
119
+ info: {
120
+ ...jsonParsedSpec.info,
121
+ expanded: true,
122
+ headers: infoDescriptionHeaders
123
+ },
121
124
  tags,
122
125
  components,
123
126
  // pathGroups,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "2.2.770",
3
+ "version": "2.2.771",
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",