feature(VirtualList): remove tanstack virtual list solution, add self written one

This commit is contained in:
Ilia Mashkov
2026-01-15 13:33:59 +03:00
parent 925d2eec3e
commit 429a9a0877
5 changed files with 175 additions and 208 deletions

View File

@@ -1,6 +1,5 @@
<script lang="ts">
import { fontshareStore } from '$entities/Font/model/store/fontshareStore.svelte';
import type { UnifiedFont } from '$entities/Font/model/types/normalize';
import {
Content as ItemContent,
Root as ItemRoot,
@@ -13,34 +12,17 @@ import { VirtualList } from '$shared/ui';
* Displays a virtualized list of fonts with loading, empty, and error states.
* Uses unifiedFontStore from context for data, but can accept explicit fonts via props.
*/
interface FontListProps {
/** Font items to display (defaults to filtered fonts from store) */
fonts?: UnifiedFont[];
/** Show loading state */
loading?: boolean;
/** Show empty state when no results */
showEmpty?: boolean;
/** Custom error message to display */
errorMessage?: string;
}
let {
fonts,
loading,
showEmpty = true,
errorMessage,
}: FontListProps = $props();
// const fontshareStore = getFontshareContext();
</script>
{#each fontshareStore.fonts as font (font.id)}
<ItemRoot>
<ItemContent>
<ItemTitle>{font.name}</ItemTitle>
<span class="text-xs text-muted-foreground">
{font.category}{font.provider}
</span>
</ItemContent>
</ItemRoot>
{/each}
<VirtualList items={fontshareStore.fonts} itemHeight={30}>
{#snippet children({ item: font })}
<ItemRoot>
<ItemContent>
<ItemTitle>{font.name}</ItemTitle>
<span class="text-xs text-muted-foreground">
{font.category}{font.provider}
</span>
</ItemContent>
</ItemRoot>
{/snippet}
</VirtualList>