| | |
| | | import micromorph from "micromorph" |
| | | import { CanonicalSlug, RelativeURL } from "../../path" |
| | | import { CanonicalSlug, RelativeURL, getCanonicalSlug } from "../../path" |
| | | |
| | | // adapted from `micromorph` |
| | | // https://github.com/natemoo-re/micromorph |
| | |
| | | .catch(() => { |
| | | window.location.assign(url) |
| | | }) |
| | | |
| | | if (!contents) return; |
| | | if (!isBack) { |
| | | history.pushState({}, "", url) |
| | |
| | | const elementsToAdd = html.head.querySelectorAll(':not([spa-preserve])') |
| | | elementsToAdd.forEach(el => document.head.appendChild(el)) |
| | | |
| | | notifyNav(document.body.dataset.slug!) |
| | | notifyNav(getCanonicalSlug(window)) |
| | | delete announcer.dataset.persist |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | createRouter() |
| | | notifyNav(document.body.dataset.slug!) |
| | | notifyNav(getCanonicalSlug(window)) |
| | | |
| | | if (!customElements.get('route-announcer')) { |
| | | const attrs = { |