2026-01-30 17:46:21 +03:00
|
|
|
<!--
|
|
|
|
|
Component: Page
|
|
|
|
|
Description: The main page component of the application.
|
|
|
|
|
-->
|
2026-01-12 08:51:36 +03:00
|
|
|
<script lang="ts">
|
2026-01-26 12:54:40 +03:00
|
|
|
import { appliedFontsManager } from '$entities/Font';
|
|
|
|
|
import { displayedFontsStore } from '$features/DisplayFont';
|
2026-01-18 15:01:19 +03:00
|
|
|
import FontDisplay from '$features/DisplayFont/ui/FontDisplay/FontDisplay.svelte';
|
2026-01-26 12:54:40 +03:00
|
|
|
import { controlManager } from '$features/SetupFont';
|
2026-01-29 14:33:12 +03:00
|
|
|
import { cn } from '$shared/shadcn/utils/shadcn-utils';
|
2026-01-30 17:46:21 +03:00
|
|
|
import { Section } from '$shared/ui';
|
2026-01-26 12:54:40 +03:00
|
|
|
import ComparisonSlider from '$widgets/ComparisonSlider/ui/ComparisonSlider/ComparisonSlider.svelte';
|
2026-01-24 15:39:38 +03:00
|
|
|
import { FontSearch } from '$widgets/FontSearch';
|
2026-02-01 11:53:57 +03:00
|
|
|
import { SampleList } from '$widgets/SampleList';
|
2026-01-30 17:46:21 +03:00
|
|
|
import LineSquiggleIcon from '@lucide/svelte/icons/line-squiggle';
|
|
|
|
|
import ScanEyeIcon from '@lucide/svelte/icons/scan-eye';
|
2026-01-24 15:39:38 +03:00
|
|
|
|
|
|
|
|
let searchContainer: HTMLElement;
|
|
|
|
|
|
|
|
|
|
let isExpanded = $state(false);
|
2026-01-29 14:33:12 +03:00
|
|
|
let isOpen = $state(false);
|
|
|
|
|
|
|
|
|
|
let isEmptyScreen = $derived(!displayedFontsStore.hasAnyFonts && !isExpanded && !isOpen);
|
2026-01-26 12:54:40 +03:00
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
appliedFontsManager.touch(
|
|
|
|
|
displayedFontsStore.fonts.map(font => ({ slug: font.id, weight: controlManager.weight })),
|
|
|
|
|
);
|
|
|
|
|
});
|
2025-12-30 18:57:58 +03:00
|
|
|
</script>
|
|
|
|
|
|
2026-01-13 20:05:33 +03:00
|
|
|
<!-- Font List -->
|
2026-01-30 01:09:39 +03:00
|
|
|
<div class="p-2 h-full flex flex-col gap-3">
|
2026-01-29 14:33:12 +03:00
|
|
|
{#key isEmptyScreen}
|
|
|
|
|
<div
|
|
|
|
|
class={cn(
|
|
|
|
|
'flex flex-col transition-all duration-700 ease-[cubic-bezier(0.23,1,0.32,1)] mx-40',
|
2026-02-01 11:53:57 +03:00
|
|
|
'will-change-[flex-grow] transform-gpu grow-0 justify-start',
|
2026-01-29 14:33:12 +03:00
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class={cn(
|
|
|
|
|
'transition-transform duration-700 ease-[cubic-bezier(0.23,1,0.32,1)]',
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<FontSearch bind:showFilters={isExpanded} bind:isOpen />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/key}
|
2026-01-24 15:39:38 +03:00
|
|
|
|
2026-02-01 11:53:57 +03:00
|
|
|
<Section class="my-12 gap-8" index={1}>
|
|
|
|
|
{#snippet icon({ className })}
|
|
|
|
|
<ScanEyeIcon class={className} />
|
|
|
|
|
{/snippet}
|
|
|
|
|
{#snippet title({ className })}
|
|
|
|
|
<h1 class={className}>
|
|
|
|
|
Optical<br>Comparator
|
|
|
|
|
</h1>
|
|
|
|
|
{/snippet}
|
|
|
|
|
<ComparisonSlider />
|
|
|
|
|
</Section>
|
2026-01-26 12:54:40 +03:00
|
|
|
|
2026-02-01 11:53:57 +03:00
|
|
|
<Section class="my-12 gap-8" index={2}>
|
|
|
|
|
{#snippet icon({ className })}
|
|
|
|
|
<LineSquiggleIcon class={className} />
|
|
|
|
|
{/snippet}
|
|
|
|
|
{#snippet title({ className })}
|
|
|
|
|
<h2 class={className}>
|
|
|
|
|
Sample<br>Set
|
|
|
|
|
</h2>
|
|
|
|
|
{/snippet}
|
|
|
|
|
<SampleList />
|
|
|
|
|
</Section>
|
2026-01-18 15:01:19 +03:00
|
|
|
</div>
|
2026-01-24 15:39:38 +03:00
|
|
|
|
|
|
|
|
<style>
|
2026-01-29 14:33:12 +03:00
|
|
|
@keyframes search {
|
|
|
|
|
0% {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
flex-grow: 1;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
15% {
|
|
|
|
|
opacity: 0.5;
|
|
|
|
|
transform: scale(0.95);
|
|
|
|
|
}
|
|
|
|
|
30% {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
100% {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
flex-grow: 0;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.animate-search {
|
|
|
|
|
animation: search 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-24 15:39:38 +03:00
|
|
|
.content {
|
|
|
|
|
/* Tells the browser to skip rendering off-screen content */
|
|
|
|
|
content-visibility: auto;
|
|
|
|
|
/* Helps the browser reserve space without calculating everything */
|
|
|
|
|
contain-intrinsic-size: 1px 1000px;
|
|
|
|
|
|
|
|
|
|
-webkit-font-smoothing: antialiased;
|
|
|
|
|
-moz-osx-font-smoothing: grayscale;
|
|
|
|
|
}
|
2026-01-29 14:33:12 +03:00
|
|
|
|
|
|
|
|
.will-change-[height] {
|
|
|
|
|
will-change: flex-grow, padding;
|
|
|
|
|
/* Forces GPU acceleration for the layout shift */
|
|
|
|
|
transform: translateZ(0);
|
|
|
|
|
}
|
2026-01-24 15:39:38 +03:00
|
|
|
</style>
|