feat(comparisonStore): replace displayStore with comparisonStore that has only the logic related to ComparisonSlider
This commit is contained in:
@@ -1 +0,0 @@
|
||||
export { displayedFontsStore } from './store';
|
||||
@@ -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();
|
||||
@@ -1 +0,0 @@
|
||||
export { displayedFontsStore } from './displayedFontsStore.svelte';
|
||||
Reference in New Issue
Block a user