feat(ComparisonView): add redesigned font comparison widget

This commit is contained in:
Ilia Mashkov
2026-03-02 22:18:05 +03:00
parent 6cd325ce38
commit ba186d00a1
14 changed files with 1884 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<!--
Component: Line
Renders a line of text in the SliderArea
-->
<script lang="ts">
import type { Snippet } from 'svelte';
import { comparisonStore } from '../../model';
interface Props {
/**
* Line text
*/
text: string;
/**
* DOM element reference
*/
element?: HTMLElement;
/**
* Character render snippet
*/
character: Snippet<[{ char: string; index: number }]>;
}
const typography = $derived(comparisonStore.typography);
let { text, element = $bindable<HTMLElement>(), character }: Props = $props();
const characters = $derived(text.split(''));
</script>
<div
bind:this={element}
class="relative flex w-full justify-center items-center whitespace-nowrap"
style:height="{typography.height}em"
style:line-height="{typography.height}em"
>
{#each characters as char, index}
{@render character?.({ char, index })}
{/each}
</div>