From 8645c7dcc87d994f17b509700cc8109c13938bc7 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Thu, 16 Apr 2026 08:44:49 +0300 Subject: [PATCH] feat: use typographySettingsStore everywhere for the typography settings --- .../ui/FontSampler/FontSampler.stories.svelte | 1 - .../ui/FontSampler/FontSampler.svelte | 26 +++---- .../model/stores/comparisonStore.svelte.ts | 27 +++---- .../ui/Character/Character.svelte | 3 +- .../ui/ComparisonView/ComparisonView.svelte | 78 +++++++++---------- .../ui/FontList/FontList.svelte | 3 +- .../ComparisonView/ui/Line/Line.svelte | 4 +- .../ui/SliderArea/SliderArea.svelte | 17 ++-- .../ui/SampleList/SampleList.svelte | 10 +-- 9 files changed, 82 insertions(+), 87 deletions(-) diff --git a/src/features/DisplayFont/ui/FontSampler/FontSampler.stories.svelte b/src/features/DisplayFont/ui/FontSampler/FontSampler.stories.svelte index 0238a83..19c1d84 100644 --- a/src/features/DisplayFont/ui/FontSampler/FontSampler.stories.svelte +++ b/src/features/DisplayFont/ui/FontSampler/FontSampler.stories.svelte @@ -35,7 +35,6 @@ const { Story } = defineMeta({ @@ -75,7 +69,7 @@ const stats = $derived([ min-h-60 rounded-none " - style:font-weight={fontWeight} + style:font-weight={typographySettingsStore.weight} >
- +
diff --git a/src/widgets/ComparisonView/model/stores/comparisonStore.svelte.ts b/src/widgets/ComparisonView/model/stores/comparisonStore.svelte.ts index 28c90fe..2bf9844 100644 --- a/src/widgets/ComparisonView/model/stores/comparisonStore.svelte.ts +++ b/src/widgets/ComparisonView/model/stores/comparisonStore.svelte.ts @@ -21,10 +21,7 @@ import { fontStore, getFontUrl, } from '$entities/Font'; -import { - DEFAULT_TYPOGRAPHY_CONTROLS_DATA, - createTypographyControlManager, -} from '$features/SetupFont'; +import { typographySettingsStore } from '$features/SetupFont/model'; import { createPersistentStore } from '$shared/lib'; import { untrack } from 'svelte'; @@ -68,8 +65,8 @@ export class ComparisonStore { #side = $state('A'); /** Slider position for character morphing (0-100) */ #sliderPosition = $state(50); - /** Typography controls for this comparison */ - #typography = createTypographyControlManager(DEFAULT_TYPOGRAPHY_CONTROLS_DATA, 'glyphdiff:comparison:typography'); + // /** Typography controls for this comparison */ + // #typography = createTypographyControlManager(DEFAULT_TYPOGRAPHY_CONTROLS_DATA, 'glyphdiff:comparison:typography'); /** TanStack Query-backed batch font fetcher */ #batchStore: BatchFontStore; @@ -99,7 +96,7 @@ export class ComparisonStore { $effect(() => { const fa = this.#fontA; const fb = this.#fontB; - const weight = this.#typography.weight; + const weight = typographySettingsStore.weight; if (!fa || !fb) return; @@ -152,8 +149,8 @@ export class ComparisonStore { return; } - const weight = this.#typography.weight; - const size = this.#typography.renderedSize; + const weight = typographySettingsStore.weight; + const size = typographySettingsStore.renderedSize; const fontAName = this.#fontA?.name; const fontBName = this.#fontB?.name; @@ -201,12 +198,12 @@ export class ComparisonStore { }; } - // ── Getters / Setters ───────────────────────────────────────────────────── + // // ── Getters / Setters ───────────────────────────────────────────────────── - /** Typography control manager */ - get typography() { - return this.#typography; - } + // /** Typography control manager */ + // get typography() { + // return typographySettingsStore; + // } /** Font for side A */ get fontA() { @@ -273,7 +270,7 @@ export class ComparisonStore { this.#fontB = undefined; this.#batchStore.setIds([]); storage.clear(); - this.#typography.reset(); + typographySettingsStore.reset(); } } diff --git a/src/widgets/ComparisonView/ui/Character/Character.svelte b/src/widgets/ComparisonView/ui/Character/Character.svelte index 0269015..466c234 100644 --- a/src/widgets/ComparisonView/ui/Character/Character.svelte +++ b/src/widgets/ComparisonView/ui/Character/Character.svelte @@ -3,6 +3,7 @@ Renders a single character with morphing animation --> diff --git a/src/widgets/ComparisonView/ui/SliderArea/SliderArea.svelte b/src/widgets/ComparisonView/ui/SliderArea/SliderArea.svelte index c6d1f45..4630937 100644 --- a/src/widgets/ComparisonView/ui/SliderArea/SliderArea.svelte +++ b/src/widgets/ComparisonView/ui/SliderArea/SliderArea.svelte @@ -8,6 +8,8 @@ - Performance optimized using offscreen canvas for measurements and transform-based animations. -->