feature/comparison-slider #19

Merged
ilia merged 129 commits from feature/comparison-slider into main 2026-02-02 09:23:46 +00:00
2 changed files with 10 additions and 1 deletions
Showing only changes of commit c07800cc96 - Show all commits

View File

@@ -1 +1,2 @@
export { displayedFontsStore } from './model';
export { FontDisplay } from './ui'; export { FontDisplay } from './ui';

View File

@@ -28,6 +28,8 @@ export class DisplayedFontsStore {
#selectedPair = $state<Partial<[UnifiedFont, UnifiedFont]>>([]); #selectedPair = $state<Partial<[UnifiedFont, UnifiedFont]>>([]);
#hasAnySelectedFonts = $derived(this.#displayedFonts.length > 0);
get fonts() { get fonts() {
return this.#displayedFonts; return this.#displayedFonts;
} }
@@ -41,7 +43,9 @@ export class DisplayedFontsStore {
} }
set selectedPair(pair: Partial<[UnifiedFont, UnifiedFont]>) { set selectedPair(pair: Partial<[UnifiedFont, UnifiedFont]>) {
this.#selectedPair = pair; const [first, second] = this.#selectedPair;
const [newFist, newSecond] = pair;
this.#selectedPair = [newFist ?? first, newSecond ?? second];
} }
get text() { get text() {
@@ -52,6 +56,10 @@ export class DisplayedFontsStore {
this.#sampleText = text; this.#sampleText = text;
} }
get hasAnyFonts() {
return this.#hasAnySelectedFonts;
}
isSelectedPairEmpty(): boolean { isSelectedPairEmpty(): boolean {
const [font1, font2] = this.#selectedPair; const [font1, font2] = this.#selectedPair;
return !font1 || !font2; return !font1 || !font2;