TocToggle
Places <ktjs-toc-toggle> in the desktop table of contents.
This class is the Node-safe half: it knows where the toggle belongs (Docusaurus's TOC column) and what it should say, and it inserts a plain custom-element tag. The tag itself — the button, the stored preference, the layout switch — belongs to ktjs-docusaurus-kit-browser, which is loaded by the browser alone. Nothing here touches an element the kit's own module cannot safely evaluate.
install() is idempotent and wires the viewport listener; refresh() reconciles the tag with the page. The TOC is rendered by React, so it exists only on pages with headings and only on wide viewports; the tag is inserted in front of the list and removed again otherwise, and re-inserted when React has rebuilt the column underneath it.
private val toggle = TocToggle()
@JsExport
fun onRouteDidUpdate() {
toggle.install()
toggle.refresh()
}