import { ContainerReflection, DefaultTheme, DefaultThemeRenderContext, // eslint-disable-next-line @typescript-eslint/no-unused-vars JSX, Options, PageEvent, Reflection, ReflectionCategory, ReflectionKind, } from "typedoc"; class SdkThemeContext extends DefaultThemeRenderContext { constructor(theme: DefaultTheme, options: Options) { super(theme, options); const oldToolbar = this.toolbar; const oldHeader = this.header; const oldFooter = this.footer; this.toolbar = (props) => { const script = ` // REDIRECT BROKEN CLIENT INDEX PAGES (() => { if (window.location.href.includes('clients/client') && /clients\\\/client-[^\\\/]+\\\//.test(window.location.href) === false) { window.location.href = window.location.href + '/' } })(); // MENU CONTROLS (() => { const menu = document.querySelector('.menu') function toggleMenu () { const html = document.documentElement if (html.classList.contains('is-mobile')) { if (html.classList.contains('has-menu')) { html.classList.remove('has-menu') } else { html.classList.add('has-menu') document.querySelector('.col-menu a').focus() } } } menu.addEventListener('keyup', (e) => { if (e.key === 'Enter') { toggleMenu() } }) document.addEventListener('keyup', (e) => { if (e.key === 'Escape') { document.documentElement.classList.remove('has-menu') } }) })(); // SEARCH LIVE REGION & RESULTS KEYBOARD NAVIGATION WITH ARROW KEYS (() => { function debounce(fn) { let timeoutId; return function () { const invoke = () => { fn.call(null) } if (timeoutId) { clearTimeout(timeoutId) } timeoutId = setTimeout(() => { invoke() }, 300) } } const searchField = document.querySelector('#tsd-search-field') const liveRegion = document.querySelector('#search-live-region') const results = document.querySelector('.results') function handleResults () { let resultText = '' if (document.querySelector('.results .current')) { resultText = 'Selected ' + document.querySelector('.results .current').innerText } if (document.querySelector('.results .current')) { resultText = document.querySelector('.results .current').innerText + ' is currently selected, type to search and use arrow keys to navigate results' } else if (results.children.length === 0) { resultText = 'Enter text to search, use arrow keys to navigate results.' } else { resultText = results.children.length + " items found, use arrow keys to navigate results" } liveRegion.innerText = resultText } searchField.addEventListener('keydown', debounce(handleResults)); // ADD ARIA-TAGS TO SHIELDS/BADGES function waitForElm(selector) { return new Promise(resolve => { if (document.querySelector(selector)) { return resolve(document.querySelector(selector)); } const observer = new MutationObserver(mutations => { if (document.querySelector(selector)) { resolve(document.querySelector(selector)); observer.disconnect(); } }); observer.observe(document.body, { childList: true, subtree: true }); }); } // wait for container to exist waitForElm('.container-main') .then(elm => { elm.role = "main" elm.tabIndex = "-1" document.querySelector('.container-main').id = 'jump-to-content' document.querySelector('.tsd-navigation.secondary')['ariaLabel'] = "Secondary" }) })(); `; const style = ` .tsd-tag.ts-flagProtected { display: none; } details.tsd-index-content { border-color: var(--color-accent); border-width: 1px 0; border-style: solid; } .skip-to-content-nav { position: absolute; height: 1px; width: 1px; overflow: hidden; top: .2em; left: .2em; } .skip-to-content-nav:active, .skip-to-content-nav:focus { z-index: 1000; background: var(--color-background); border: 1px solid var(--color-link); padding: .5em; height: fit-content; width: fit-content; } #search-live-region { z-index: -1; position: absolute; width: 1; height: 1; } `; return ( <> Jump to Content {oldToolbar(props)}
> ); }; this.header = (props: PageEventWe are excited to announce our{" "} new API Documentation.