Files
frontend-svelte/src/app/ui/Layout.svelte
T

81 lines
2.1 KiB
Svelte
Raw Normal View History

<!--
Component: Layout
Application shell with providers and page wrapper
-->
<script lang="ts">
import { themeManager } from '$features/ChangeAppTheme';
2026-04-22 13:00:29 +03:00
import G from '$shared/assets/G.svg';
import { ResponsiveProvider } from '$shared/lib';
2026-04-23 09:48:32 +03:00
import { cn } from '$shared/lib';
2026-04-22 13:01:46 +03:00
import { Footer } from '$widgets/Footer';
/*
Preload the two render-critical interface faces (primary + secondary).
`?url` resolves to the content-hashed path Vite emits, so the binary is
fetched immediately rather than waiting for CSS @font-face discovery.
*/
import interWoff2 from '../assets/fonts/inter-latin-opsz-normal.woff2?url';
import spaceGroteskWoff2 from '../assets/fonts/space-grotesk-latin-wght-normal.woff2?url';
import {
type Snippet,
2026-02-27 12:23:31 +03:00
onDestroy,
onMount,
} from 'svelte';
2026-01-24 15:32:01 +03:00
interface Props {
/**
* Content snippet
*/
2026-01-24 15:32:01 +03:00
children: Snippet;
}
2026-01-24 15:32:01 +03:00
let { children }: Props = $props();
let fontsReady = $state(true);
2026-02-27 12:23:31 +03:00
const theme = $derived(themeManager.value);
2026-02-27 12:23:31 +03:00
onMount(() => themeManager.init());
onDestroy(() => themeManager.destroy());
</script>
<svelte:head>
2026-04-22 13:00:29 +03:00
<link rel="icon" href={G} type="image/svg+xml" />
<!-- Self-hosted interface fonts (see src/app/styles/fonts/fonts.css). Preload the two critical faces. -->
<link
rel="preload"
as="font"
type="font/woff2"
href={interWoff2}
crossorigin="anonymous"
/>
2026-01-22 15:31:59 +03:00
<link
rel="preload"
as="font"
type="font/woff2"
href={spaceGroteskWoff2}
crossorigin="anonymous"
/>
<title>GlyphDiff | Typography & Typefaces</title>
2026-04-19 19:15:46 +03:00
<meta
name="description"
content="Compare typefaces side by side. Adjust size, weight, leading, and tracking to find the perfect typographic pairing."
/>
</svelte:head>
<ResponsiveProvider>
2026-02-27 12:23:31 +03:00
<div
id="app-root"
2026-04-23 09:48:32 +03:00
class={cn(
'min-h-dvh w-auto flex flex-col surface-canvas relative',
2026-02-27 12:23:31 +03:00
theme === 'dark' ? 'dark' : '',
)}
>
2026-04-17 13:20:01 +03:00
{#if fontsReady}
{@render children?.()}
{/if}
2026-04-22 13:01:46 +03:00
<Footer />
</div>
</ResponsiveProvider>