36 lines
952 B
Svelte
36 lines
952 B
Svelte
|
|
<script lang="ts">
|
||
|
|
import { afterNavigate, disableScrollHandling } from '$app/navigation';
|
||
|
|
import '$lib/styles/variables.css';
|
||
|
|
import '$lib/styles/base.css';
|
||
|
|
import '$lib/styles/layout.css';
|
||
|
|
import '$lib/styles/typography.css';
|
||
|
|
import '$lib/styles/buttons.css';
|
||
|
|
import '$lib/styles/forms.css';
|
||
|
|
import '$lib/styles/sections.css';
|
||
|
|
import '$lib/styles/responsive.css';
|
||
|
|
|
||
|
|
afterNavigate(({ from, to }) => {
|
||
|
|
if (!from || !to || to.url.hash) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (from.url.pathname !== to.url.pathname) {
|
||
|
|
disableScrollHandling();
|
||
|
|
|
||
|
|
if (document.activeElement instanceof HTMLElement) {
|
||
|
|
document.activeElement.blur();
|
||
|
|
}
|
||
|
|
|
||
|
|
requestAnimationFrame(() => {
|
||
|
|
requestAnimationFrame(() => {
|
||
|
|
window.scrollTo({ top: 0, left: 0, behavior: 'auto' });
|
||
|
|
document.documentElement.scrollTop = 0;
|
||
|
|
document.body.scrollTop = 0;
|
||
|
|
});
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<slot />
|