diff --git a/CHANGELOG.md b/CHANGELOG.md index 03dd5985..06c55151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This package follows standard semvar, `..`. No breaking cha * Automatically retry fetching the spec if it doesn't work for any reason. * Fix array description display preference to be first--The Array description, and then only second--The array item schema description, so that the "more specific" description wins, even though the "items" description is more deeply nested. This aligns to the expected behavior of preference in the json schema. * Fix selecte drop down menu update trigger. +* Add missing link to Tag display page. +* Replace `replaceState` with `pushState` so forwards and backwards navigation actually work. ## 2.1 * Add `x-locale` vendor extension to specify the locale of the spec. diff --git a/docs/documentation.md b/docs/documentation.md index 7a417fec..913e5ecc 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -154,6 +154,14 @@ onEvent(event) {
Methods

+ + +
+
+ + +
+
``` #### Custom Navigation section diff --git a/src/styles/main-body-styles.js b/src/styles/main-body-styles.js index 9ee0564a..305d261c 100644 --- a/src/styles/main-body-styles.js +++ b/src/styles/main-body-styles.js @@ -97,6 +97,7 @@ export default css` } .tag.title { text-transform: uppercase; + margin-bottom: 16px; } .header{ background-color:var(--header-bg); diff --git a/src/styles/schema-styles.js b/src/styles/schema-styles.js index 9de55e93..d23f6a16 100644 --- a/src/styles/schema-styles.js +++ b/src/styles/schema-styles.js @@ -107,7 +107,7 @@ export default css` } } -.expanded-endpoint-component > h2:hover, .schema-link:hover { +.expanded-endpoint-component > h2:hover, .schema-link:hover, .expanded-endpoint-body > .tag-link:hover { cursor: pointer; text-decoration: underline; } diff --git a/src/templates/expanded-endpoint-template.js b/src/templates/expanded-endpoint-template.js index 5154798a..1ded4757 100644 --- a/src/templates/expanded-endpoint-template.js +++ b/src/templates/expanded-endpoint-template.js @@ -8,7 +8,7 @@ import '../components/api-request.js'; import '../components/api-response.js'; /* eslint-disable indent */ -export function expandedEndpointBodyTemplate(path, tagName = '') { +export function expandedEndpointBodyTemplate(path, tag) { // Filter API Keys that are non-empty and are applicable to the the path const nonEmptyApiKeys = this.resolvedSpec.securitySchemes.filter((v) => (v.finalKeyValue && path.security && path.security.some((ps) => ps[v.apiKeyId]))) || []; @@ -16,11 +16,17 @@ export function expandedEndpointBodyTemplate(path, tagName = '') { return html` ${this.renderStyle === 'read' ? html`
` : ''}
- ${(this.renderStyle === 'focused' && tagName && tagName !== 'General ⦂') ? html`

${tagName}

` : ''} - ${path.deprecated ? html`
DEPRECATED
` : ''} + ${(this.renderStyle === 'focused' && tag && tag.name !== 'General ⦂') + ? html`` + : ''} + +
-

${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}

+

+
${path.shortSummary || `${path.method.toUpperCase()} ${path.path}`}
+
${path.deprecated ? html`
 - DEPRECATED
` : ''}
+

${path.isWebhook ? html` WEBHOOK ` : ''} ${path.method} @@ -87,7 +93,6 @@ export function expandedTagTemplate(tagId, subsectionFullId) { return html`
${tag.name}
-
${ @@ -98,6 +103,29 @@ export function expandedTagTemplate(tagId, subsectionFullId) { }
+ + +
+ Operations + + + +
`; } /* eslint-enable indent */ diff --git a/src/templates/focused-endpoint-template.js b/src/templates/focused-endpoint-template.js index a6504acb..d2167df0 100644 --- a/src/templates/focused-endpoint-template.js +++ b/src/templates/focused-endpoint-template.js @@ -22,7 +22,7 @@ function defaultContentTemplate() { const selectedTagObj = this.resolvedSpec.tags[0]; const selectedPathObj = selectedTagObj?.paths[0]; return (selectedPathObj) - ? wrapFocusedTemplate(expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name)) + ? wrapFocusedTemplate(expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj)) : wrapFocusedTemplate(''); } @@ -65,7 +65,7 @@ export default function focusedEndpointTemplate() { } } if (selectedPathObj) { - focusedTemplate = wrapFocusedTemplate.call(this, expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj.name)); + focusedTemplate = wrapFocusedTemplate.call(this, expandedEndpointBodyTemplate.call(this, selectedPathObj, selectedTagObj)); } else { // if explorerLocation is not found then show the default content (overview or first-path) focusedTemplate = defaultContentTemplate.call(this); diff --git a/src/utils/common-utils.js b/src/utils/common-utils.js index 69e507bf..d2ed0d95 100644 --- a/src/utils/common-utils.js +++ b/src/utils/common-utils.js @@ -149,7 +149,7 @@ export function replaceState(rawElementId) { const query = new URLSearchParams(currentQuery); query.delete('route'); const newQuery = query.toString().length > 1 ? `${query.toString()}&route=${elementId}` : `route=${elementId}`; - window.history.replaceState(null, null, `#${currentNavigationHashPart}?${newQuery}`); + window.history.pushState(null, null, `#${currentNavigationHashPart}?${newQuery}`); } export function toMarkdown(markdownStringRaw) {