feat(comparisonStore): replace displayStore with comparisonStore that has only the logic related to ComparisonSlider

This commit is contained in:
Ilia Mashkov
2026-02-02 11:58:50 +03:00
parent d43c873dc9
commit 70f57283a8
4 changed files with 150 additions and 63 deletions

View File

@@ -1 +0,0 @@
export { displayedFontsStore } from './store';

View File

@@ -1,61 +0,0 @@
import {
type UnifiedFont,
selectedFontsStore,
} from '$entities/Font';
/**
* Store for displayed font samples
* - Handles shown text
* - Stores selected fonts for display
*/
export class DisplayedFontsStore {
#sampleText = $state('The quick brown fox jumps over the lazy dog');
#displayedFonts = $derived.by(() => {
return selectedFontsStore.all;
});
#fontA = $state<UnifiedFont | undefined>(undefined);
#fontB = $state<UnifiedFont | undefined>(undefined);
#hasAnySelectedFonts = $derived(this.#displayedFonts.length > 0);
get fonts() {
return this.#displayedFonts;
}
get fontA() {
return this.#fontA ?? this.#displayedFonts[0];
}
set fontA(font: UnifiedFont | undefined) {
this.#fontA = font;
}
get fontB() {
return this.#fontB ?? this.#displayedFonts[1];
}
set fontB(font: UnifiedFont | undefined) {
this.#fontB = font;
}
get text() {
return this.#sampleText;
}
set text(text: string) {
this.#sampleText = text;
}
get hasAnyFonts() {
return this.#hasAnySelectedFonts;
}
getById(id: string): UnifiedFont | undefined {
return selectedFontsStore.getById(id);
}
}
export const displayedFontsStore = new DisplayedFontsStore();

View File

@@ -1 +0,0 @@
export { displayedFontsStore } from './displayedFontsStore.svelte';