From 1573950605b7bc99a2e9f24e53a7be966d3a8f66 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Sun, 24 May 2026 13:54:15 +0300 Subject: [PATCH 01/29] chore(Font): move batchFontStore to separate directory --- .../store/{ => batchFontStore}/batchFontStore.svelte.ts | 6 +++--- .../model/store/{ => batchFontStore}/batchFontStore.test.ts | 4 ++-- src/entities/Font/model/store/index.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename src/entities/Font/model/store/{ => batchFontStore}/batchFontStore.svelte.ts (94%) rename src/entities/Font/model/store/{ => batchFontStore}/batchFontStore.test.ts (97%) diff --git a/src/entities/Font/model/store/batchFontStore.svelte.ts b/src/entities/Font/model/store/batchFontStore/batchFontStore.svelte.ts similarity index 94% rename from src/entities/Font/model/store/batchFontStore.svelte.ts rename to src/entities/Font/model/store/batchFontStore/batchFontStore.svelte.ts index 79a4846..7b0e9fe 100644 --- a/src/entities/Font/model/store/batchFontStore.svelte.ts +++ b/src/entities/Font/model/store/batchFontStore/batchFontStore.svelte.ts @@ -3,12 +3,12 @@ import { BaseQueryStore } from '$shared/lib/helpers/BaseQueryStore.svelte'; import { fetchFontsByIds, seedFontCache, -} from '../../api/proxy/proxyFonts'; +} from '../../../api/proxy/proxyFonts'; import { FontNetworkError, FontResponseError, -} from '../../lib/errors/errors'; -import type { UnifiedFont } from '../../model/types'; +} from '../../../lib/errors/errors'; +import type { UnifiedFont } from '../../types'; /** * Internal fetcher that seeds the cache and handles error wrapping. diff --git a/src/entities/Font/model/store/batchFontStore.test.ts b/src/entities/Font/model/store/batchFontStore/batchFontStore.test.ts similarity index 97% rename from src/entities/Font/model/store/batchFontStore.test.ts rename to src/entities/Font/model/store/batchFontStore/batchFontStore.test.ts index 2045d9d..3b112ac 100644 --- a/src/entities/Font/model/store/batchFontStore.test.ts +++ b/src/entities/Font/model/store/batchFontStore/batchFontStore.test.ts @@ -7,11 +7,11 @@ import { it, vi, } from 'vitest'; -import * as api from '../../api/proxy/proxyFonts'; +import * as api from '../../../api/proxy/proxyFonts'; import { FontNetworkError, FontResponseError, -} from '../../lib/errors/errors'; +} from '../../../lib/errors/errors'; import { BatchFontStore } from './batchFontStore.svelte'; describe('BatchFontStore', () => { diff --git a/src/entities/Font/model/store/index.ts b/src/entities/Font/model/store/index.ts index 3ef8061..48dd140 100644 --- a/src/entities/Font/model/store/index.ts +++ b/src/entities/Font/model/store/index.ts @@ -2,7 +2,7 @@ export * from './appliedFontsStore/appliedFontsStore.svelte'; // Batch font store -export { BatchFontStore } from './batchFontStore.svelte'; +export { BatchFontStore } from './batchFontStore/batchFontStore.svelte'; // Single FontStore export { -- 2.52.0 From e60309af780d8b0de2184dbf81d20e0f9bdfc68a Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Sun, 24 May 2026 15:05:28 +0300 Subject: [PATCH 02/29] =?UTF-8?q?refactor(GetFonts):=20centralize=20filter?= =?UTF-8?q?Manager/sortStore=20=E2=86=92=20fontStore=20bridge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the duplicated $effect blocks that mapped filterManager and sortStore into fontStore params out of Search, FontSearch and FilterControls into a single $effect.root in features/GetFonts/model/state/bindings.svelte.ts. Consumers now bind to the manager/store directly; the bridge is installed once via a side-effect import from the feature barrel. --- src/features/GetFonts/model/index.ts | 6 ++++ .../GetFonts/model/state/bindings.svelte.ts | 36 +++++++++++++++++++ .../ui/FiltersControl/FilterControls.svelte | 11 +----- .../ComparisonView/ui/Search/Search.svelte | 15 ++------ .../ui/FontSearch/FontSearch.svelte | 8 ----- 5 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 src/features/GetFonts/model/state/bindings.svelte.ts diff --git a/src/features/GetFonts/model/index.ts b/src/features/GetFonts/model/index.ts index 2c8f3c8..d3ed458 100644 --- a/src/features/GetFonts/model/index.ts +++ b/src/features/GetFonts/model/index.ts @@ -29,6 +29,12 @@ export { filterManager, } from './state/manager.svelte'; +/** + * Side-effect import: installs the global filterManager+sortStore → fontStore + * bridge on first import of this feature barrel. No exports. + */ +import './state/bindings.svelte'; + /** * Sorting logic */ diff --git a/src/features/GetFonts/model/state/bindings.svelte.ts b/src/features/GetFonts/model/state/bindings.svelte.ts new file mode 100644 index 0000000..c5f4905 --- /dev/null +++ b/src/features/GetFonts/model/state/bindings.svelte.ts @@ -0,0 +1,36 @@ +/** + * Bridges feature-level UI state (filterManager + sortStore) to the + * entity-level fontStore query params. + * + * Centralizing this here means consumers (Search, FontSearch, + * FilterControls, etc.) bind to the manager/store directly without + * each repeating the same mapping effect. The bridge is a singleton + * concern — it tracks singleton state and writes to a singleton query + * observer, so it lives at module scope, not in any individual widget. + */ + +import { fontStore } from '$entities/Font'; +import { untrack } from 'svelte'; +import { mapManagerToParams } from '../../lib/mapper/mapManagerToParams'; +import { sortStore } from '../store/sortStore.svelte'; +import { filterManager } from './manager.svelte'; + +$effect.root(() => { + /** + * Mirror filter selections + debounced search query into fontStore params. + * untrack the write so fontStore's internal $state reads don't feed back + * into this effect's dependency graph. + */ + $effect(() => { + const params = mapManagerToParams(filterManager); + untrack(() => fontStore.setParams(params)); + }); + + /** + * Mirror sort selection into fontStore. + */ + $effect(() => { + const apiSort = sortStore.apiValue; + untrack(() => fontStore.setSort(apiSort)); + }); +}); diff --git a/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte b/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte index 5187324..e9af16b 100644 --- a/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte +++ b/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte @@ -4,16 +4,12 @@ Sits below the filter list, separated by a top border. -->
diff --git a/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte b/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte index 30c6ca4..9b2fc73 100644 --- a/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte +++ b/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte @@ -3,12 +3,10 @@ Provides a search input and filtration for fonts --> -{#each filterManager.groups as group (group.id)} +{#each appliedFilterStore.groups as group (group.id)} { beforeEach(() => { - // Clear groups and mock filtersStore to be empty so the auto-sync effect doesn't overwrite us - filterManager.setGroups([]); - vi.spyOn(filtersStore, 'filters', 'get').mockReturnValue([]); + // Clear groups and mock availableFilterStore to be empty so the auto-sync effect doesn't overwrite us + appliedFilterStore.setGroups([]); + vi.spyOn(availableFilterStore, 'filters', 'get').mockReturnValue([]); }); afterEach(() => { @@ -28,7 +28,7 @@ describe('Filters', () => { }); it('renders a label for each filter group', () => { - filterManager.setGroups([ + appliedFilterStore.setGroups([ { id: 'cat', label: 'Categories', properties: [] }, { id: 'prov', label: 'Font Providers', properties: [] }, ]); @@ -38,7 +38,7 @@ describe('Filters', () => { }); it('renders filter properties within groups', () => { - filterManager.setGroups([ + appliedFilterStore.setGroups([ { id: 'cat', label: 'Category', @@ -54,7 +54,7 @@ describe('Filters', () => { }); it('renders multiple groups with their properties', () => { - filterManager.setGroups([ + appliedFilterStore.setGroups([ { id: 'cat', label: 'Category', diff --git a/src/features/GetFonts/ui/FiltersControl/FilterControls.stories.svelte b/src/features/GetFonts/ui/FiltersControl/FilterControls.stories.svelte index e1643a6..f8b7c0a 100644 --- a/src/features/GetFonts/ui/FiltersControl/FilterControls.stories.svelte +++ b/src/features/GetFonts/ui/FiltersControl/FilterControls.stories.svelte @@ -10,7 +10,7 @@ const { Story } = defineMeta({ docs: { description: { component: - 'Sort options and Reset_Filters button rendered below the filter list. Reads sort state from sortStore and dispatches resets via filterManager. Requires responsive context — wrap with Providers.', + 'Sort options and Reset_Filters button rendered below the filter list. Reads sort state from sortStore and dispatches resets via appliedFilterStore. Requires responsive context — wrap with Providers.', }, story: { inline: false }, }, diff --git a/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte b/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte index e9af16b..f249f99 100644 --- a/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte +++ b/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte @@ -12,7 +12,7 @@ import RefreshCwIcon from '@lucide/svelte/icons/refresh-cw'; import { getContext } from 'svelte'; import { SORT_OPTIONS, - filterManager, + appliedFilterStore, sortStore, } from '../../model'; @@ -31,7 +31,7 @@ const responsive = getContext('responsive'); const isMobileOrTabletPortrait = $derived(responsive.isMobile || responsive.isTabletPortrait); function handleReset() { - filterManager.deselectAllGlobal(); + appliedFilterStore.deselectAllGlobal(); } diff --git a/src/widgets/ComparisonView/ui/Search/Search.svelte b/src/widgets/ComparisonView/ui/Search/Search.svelte index c496a1d..d2b9162 100644 --- a/src/widgets/ComparisonView/ui/Search/Search.svelte +++ b/src/widgets/ComparisonView/ui/Search/Search.svelte @@ -1,11 +1,11 @@ @@ -15,7 +15,7 @@ import { SearchBar } from '$shared/ui'; class="w-full" placeholder="Typeface Search" aria-label="Search typefaces" - bind:value={filterManager.queryValue} + bind:value={appliedFilterStore.queryValue} fullWidth />
diff --git a/src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts b/src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts index e5a89d2..4490af1 100644 --- a/src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts +++ b/src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts @@ -1,4 +1,4 @@ -import { filterManager } from '$features/GetFonts'; +import { appliedFilterStore } from '$features/GetFonts'; import { render, screen, @@ -7,7 +7,7 @@ import Search from './Search.svelte'; describe('Search', () => { beforeEach(() => { - filterManager.queryValue = ''; + appliedFilterStore.queryValue = ''; }); describe('Rendering', () => { @@ -23,8 +23,8 @@ describe('Search', () => { }); describe('Value binding', () => { - it('reflects filterManager.queryValue as initial value', () => { - filterManager.queryValue = 'Inter'; + it('reflects appliedFilterStore.queryValue as initial value', () => { + appliedFilterStore.queryValue = 'Inter'; render(Search); expect(screen.getByRole('textbox')).toHaveValue('Inter'); }); diff --git a/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte b/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte index 9b2fc73..07d25e5 100644 --- a/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte +++ b/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte @@ -6,7 +6,7 @@ import { FilterControls, Filters, - filterManager, + appliedFilterStore, } from '$features/GetFonts'; import { springySlideFade } from '$shared/lib'; import { @@ -58,7 +58,7 @@ function toggleFilters() { class="w-full" placeholder="Typeface Search" aria-label="Search typefaces" - bind:value={filterManager.queryValue} + bind:value={appliedFilterStore.queryValue} fullWidth /> -- 2.52.0 From ca382fd43dd7ed6a1c533f93d689af2db41d389e Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Sun, 24 May 2026 18:16:16 +0300 Subject: [PATCH 10/29] refactor(features): rename GetFonts to FilterAndSortFonts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The feature does not fetch fonts — that lives in \$entities/Font's fontStore. It owns the user's filter selections, sort preference, and search-by-name query that drive the listing. The new name describes what it actually does. Directory + every \$features/GetFonts import path updated; no symbol renames in this commit. --- .../{GetFonts => FilterAndSortFonts}/api/filters/filters.ts | 0 src/features/{GetFonts => FilterAndSortFonts}/api/index.ts | 0 src/features/{GetFonts => FilterAndSortFonts}/index.ts | 0 src/features/{GetFonts => FilterAndSortFonts}/lib/index.ts | 0 .../lib/mapper/mapAppliedFiltersToParams.test.ts | 0 .../lib/mapper/mapAppliedFiltersToParams.ts | 0 .../{GetFonts => FilterAndSortFonts}/model/const/const.ts | 0 .../{GetFonts => FilterAndSortFonts}/model/index.ts | 0 .../store/appliedFilterStore/appliedFilterStore.svelte.ts | 0 .../store/appliedFilterStore/appliedFilterStore.test.ts | 0 .../availableFilterStore/availableFilterStore.svelte.ts | 6 +++--- .../store/availableFilterStore/availableFilterStore.test.ts | 0 .../model/store/bindings.svelte.ts | 0 .../model/store/sortStore/sortStore.svelte.ts | 0 .../model/store/sortStore/sortStore.test.ts | 0 .../{GetFonts => FilterAndSortFonts}/model/types/filter.ts | 0 .../ui/Filters/Filters.stories.svelte | 0 .../ui/Filters/Filters.svelte | 0 .../ui/Filters/Filters.svelte.test.ts | 2 +- .../ui/FiltersControl/FilterControls.stories.svelte | 0 .../ui/FiltersControl/FilterControls.svelte | 0 src/features/{GetFonts => FilterAndSortFonts}/ui/index.ts | 0 src/widgets/ComparisonView/ui/Search/Search.svelte | 4 ++-- src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts | 2 +- src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte | 2 +- 25 files changed, 8 insertions(+), 8 deletions(-) rename src/features/{GetFonts => FilterAndSortFonts}/api/filters/filters.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/api/index.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/index.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/lib/index.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/lib/mapper/mapAppliedFiltersToParams.test.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/lib/mapper/mapAppliedFiltersToParams.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/const/const.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/index.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/store/appliedFilterStore/appliedFilterStore.svelte.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/store/appliedFilterStore/appliedFilterStore.test.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/store/availableFilterStore/availableFilterStore.svelte.ts (91%) rename src/features/{GetFonts => FilterAndSortFonts}/model/store/availableFilterStore/availableFilterStore.test.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/store/bindings.svelte.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/store/sortStore/sortStore.svelte.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/store/sortStore/sortStore.test.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/model/types/filter.ts (100%) rename src/features/{GetFonts => FilterAndSortFonts}/ui/Filters/Filters.stories.svelte (100%) rename src/features/{GetFonts => FilterAndSortFonts}/ui/Filters/Filters.svelte (100%) rename src/features/{GetFonts => FilterAndSortFonts}/ui/Filters/Filters.svelte.test.ts (98%) rename src/features/{GetFonts => FilterAndSortFonts}/ui/FiltersControl/FilterControls.stories.svelte (100%) rename src/features/{GetFonts => FilterAndSortFonts}/ui/FiltersControl/FilterControls.svelte (100%) rename src/features/{GetFonts => FilterAndSortFonts}/ui/index.ts (100%) diff --git a/src/features/GetFonts/api/filters/filters.ts b/src/features/FilterAndSortFonts/api/filters/filters.ts similarity index 100% rename from src/features/GetFonts/api/filters/filters.ts rename to src/features/FilterAndSortFonts/api/filters/filters.ts diff --git a/src/features/GetFonts/api/index.ts b/src/features/FilterAndSortFonts/api/index.ts similarity index 100% rename from src/features/GetFonts/api/index.ts rename to src/features/FilterAndSortFonts/api/index.ts diff --git a/src/features/GetFonts/index.ts b/src/features/FilterAndSortFonts/index.ts similarity index 100% rename from src/features/GetFonts/index.ts rename to src/features/FilterAndSortFonts/index.ts diff --git a/src/features/GetFonts/lib/index.ts b/src/features/FilterAndSortFonts/lib/index.ts similarity index 100% rename from src/features/GetFonts/lib/index.ts rename to src/features/FilterAndSortFonts/lib/index.ts diff --git a/src/features/GetFonts/lib/mapper/mapAppliedFiltersToParams.test.ts b/src/features/FilterAndSortFonts/lib/mapper/mapAppliedFiltersToParams.test.ts similarity index 100% rename from src/features/GetFonts/lib/mapper/mapAppliedFiltersToParams.test.ts rename to src/features/FilterAndSortFonts/lib/mapper/mapAppliedFiltersToParams.test.ts diff --git a/src/features/GetFonts/lib/mapper/mapAppliedFiltersToParams.ts b/src/features/FilterAndSortFonts/lib/mapper/mapAppliedFiltersToParams.ts similarity index 100% rename from src/features/GetFonts/lib/mapper/mapAppliedFiltersToParams.ts rename to src/features/FilterAndSortFonts/lib/mapper/mapAppliedFiltersToParams.ts diff --git a/src/features/GetFonts/model/const/const.ts b/src/features/FilterAndSortFonts/model/const/const.ts similarity index 100% rename from src/features/GetFonts/model/const/const.ts rename to src/features/FilterAndSortFonts/model/const/const.ts diff --git a/src/features/GetFonts/model/index.ts b/src/features/FilterAndSortFonts/model/index.ts similarity index 100% rename from src/features/GetFonts/model/index.ts rename to src/features/FilterAndSortFonts/model/index.ts diff --git a/src/features/GetFonts/model/store/appliedFilterStore/appliedFilterStore.svelte.ts b/src/features/FilterAndSortFonts/model/store/appliedFilterStore/appliedFilterStore.svelte.ts similarity index 100% rename from src/features/GetFonts/model/store/appliedFilterStore/appliedFilterStore.svelte.ts rename to src/features/FilterAndSortFonts/model/store/appliedFilterStore/appliedFilterStore.svelte.ts diff --git a/src/features/GetFonts/model/store/appliedFilterStore/appliedFilterStore.test.ts b/src/features/FilterAndSortFonts/model/store/appliedFilterStore/appliedFilterStore.test.ts similarity index 100% rename from src/features/GetFonts/model/store/appliedFilterStore/appliedFilterStore.test.ts rename to src/features/FilterAndSortFonts/model/store/appliedFilterStore/appliedFilterStore.test.ts diff --git a/src/features/GetFonts/model/store/availableFilterStore/availableFilterStore.svelte.ts b/src/features/FilterAndSortFonts/model/store/availableFilterStore/availableFilterStore.svelte.ts similarity index 91% rename from src/features/GetFonts/model/store/availableFilterStore/availableFilterStore.svelte.ts rename to src/features/FilterAndSortFonts/model/store/availableFilterStore/availableFilterStore.svelte.ts index c4bebb7..6aa3d6f 100644 --- a/src/features/GetFonts/model/store/availableFilterStore/availableFilterStore.svelte.ts +++ b/src/features/FilterAndSortFonts/model/store/availableFilterStore/availableFilterStore.svelte.ts @@ -6,7 +6,7 @@ * * @example * ```ts - * import { availableFilterStore } from '$features/GetFonts'; + * import { availableFilterStore } from '$features/FilterAndSortFonts'; * * // Access filters (reactive) * $: filters = availableFilterStore.filters; @@ -15,8 +15,8 @@ * ``` */ -import { fetchProxyFilters } from '$features/GetFonts/api/filters/filters'; -import type { FilterMetadata } from '$features/GetFonts/api/filters/filters'; +import { fetchProxyFilters } from '$features/FilterAndSortFonts/api/filters/filters'; +import type { FilterMetadata } from '$features/FilterAndSortFonts/api/filters/filters'; import { queryClient } from '$shared/api/queryClient'; import { type QueryKey, diff --git a/src/features/GetFonts/model/store/availableFilterStore/availableFilterStore.test.ts b/src/features/FilterAndSortFonts/model/store/availableFilterStore/availableFilterStore.test.ts similarity index 100% rename from src/features/GetFonts/model/store/availableFilterStore/availableFilterStore.test.ts rename to src/features/FilterAndSortFonts/model/store/availableFilterStore/availableFilterStore.test.ts diff --git a/src/features/GetFonts/model/store/bindings.svelte.ts b/src/features/FilterAndSortFonts/model/store/bindings.svelte.ts similarity index 100% rename from src/features/GetFonts/model/store/bindings.svelte.ts rename to src/features/FilterAndSortFonts/model/store/bindings.svelte.ts diff --git a/src/features/GetFonts/model/store/sortStore/sortStore.svelte.ts b/src/features/FilterAndSortFonts/model/store/sortStore/sortStore.svelte.ts similarity index 100% rename from src/features/GetFonts/model/store/sortStore/sortStore.svelte.ts rename to src/features/FilterAndSortFonts/model/store/sortStore/sortStore.svelte.ts diff --git a/src/features/GetFonts/model/store/sortStore/sortStore.test.ts b/src/features/FilterAndSortFonts/model/store/sortStore/sortStore.test.ts similarity index 100% rename from src/features/GetFonts/model/store/sortStore/sortStore.test.ts rename to src/features/FilterAndSortFonts/model/store/sortStore/sortStore.test.ts diff --git a/src/features/GetFonts/model/types/filter.ts b/src/features/FilterAndSortFonts/model/types/filter.ts similarity index 100% rename from src/features/GetFonts/model/types/filter.ts rename to src/features/FilterAndSortFonts/model/types/filter.ts diff --git a/src/features/GetFonts/ui/Filters/Filters.stories.svelte b/src/features/FilterAndSortFonts/ui/Filters/Filters.stories.svelte similarity index 100% rename from src/features/GetFonts/ui/Filters/Filters.stories.svelte rename to src/features/FilterAndSortFonts/ui/Filters/Filters.stories.svelte diff --git a/src/features/GetFonts/ui/Filters/Filters.svelte b/src/features/FilterAndSortFonts/ui/Filters/Filters.svelte similarity index 100% rename from src/features/GetFonts/ui/Filters/Filters.svelte rename to src/features/FilterAndSortFonts/ui/Filters/Filters.svelte diff --git a/src/features/GetFonts/ui/Filters/Filters.svelte.test.ts b/src/features/FilterAndSortFonts/ui/Filters/Filters.svelte.test.ts similarity index 98% rename from src/features/GetFonts/ui/Filters/Filters.svelte.test.ts rename to src/features/FilterAndSortFonts/ui/Filters/Filters.svelte.test.ts index 84a754e..0ef079f 100644 --- a/src/features/GetFonts/ui/Filters/Filters.svelte.test.ts +++ b/src/features/FilterAndSortFonts/ui/Filters/Filters.svelte.test.ts @@ -1,7 +1,7 @@ import { appliedFilterStore, availableFilterStore, -} from '$features/GetFonts'; +} from '$features/FilterAndSortFonts'; import { render, screen, diff --git a/src/features/GetFonts/ui/FiltersControl/FilterControls.stories.svelte b/src/features/FilterAndSortFonts/ui/FiltersControl/FilterControls.stories.svelte similarity index 100% rename from src/features/GetFonts/ui/FiltersControl/FilterControls.stories.svelte rename to src/features/FilterAndSortFonts/ui/FiltersControl/FilterControls.stories.svelte diff --git a/src/features/GetFonts/ui/FiltersControl/FilterControls.svelte b/src/features/FilterAndSortFonts/ui/FiltersControl/FilterControls.svelte similarity index 100% rename from src/features/GetFonts/ui/FiltersControl/FilterControls.svelte rename to src/features/FilterAndSortFonts/ui/FiltersControl/FilterControls.svelte diff --git a/src/features/GetFonts/ui/index.ts b/src/features/FilterAndSortFonts/ui/index.ts similarity index 100% rename from src/features/GetFonts/ui/index.ts rename to src/features/FilterAndSortFonts/ui/index.ts diff --git a/src/widgets/ComparisonView/ui/Search/Search.svelte b/src/widgets/ComparisonView/ui/Search/Search.svelte index d2b9162..388412e 100644 --- a/src/widgets/ComparisonView/ui/Search/Search.svelte +++ b/src/widgets/ComparisonView/ui/Search/Search.svelte @@ -1,11 +1,11 @@ diff --git a/src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts b/src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts index 4490af1..1bd7575 100644 --- a/src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts +++ b/src/widgets/ComparisonView/ui/Search/Search.svelte.test.ts @@ -1,4 +1,4 @@ -import { appliedFilterStore } from '$features/GetFonts'; +import { appliedFilterStore } from '$features/FilterAndSortFonts'; import { render, screen, diff --git a/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte b/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte index 07d25e5..b5f66b3 100644 --- a/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte +++ b/src/widgets/FontSearch/ui/FontSearch/FontSearch.svelte @@ -7,7 +7,7 @@ import { FilterControls, Filters, appliedFilterStore, -} from '$features/GetFonts'; +} from '$features/FilterAndSortFonts'; import { springySlideFade } from '$shared/lib'; import { Button, -- 2.52.0 From df59dfda02b5799b89a3201bd5b5c2dc2032cf78 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Sun, 24 May 2026 18:27:10 +0300 Subject: [PATCH 11/29] refactor(features): rename SetupFont to AdjustTypography + reorganize Structural: - Merge factory + singleton from lib/settingsManager and model/state into one model/store/typographySettingsStore/ slice - Drop now-empty lib/ and model/state/ directories Semantic: - Rename feature SetupFont -> AdjustTypography (the feature owns continuous typography adjustment, not one-time font setup) - Drop "Manager" from TypographySettingsManager -> TypographySettingsStore (class + factory); singleton typographySettingsStore unchanged All consumers (Character, Line, SampleList, SliderArea, FontSampler, comparisonStore) updated. Public barrel signature changed: now exports createTypographySettingsStore and type TypographySettingsStore. --- src/features/AdjustTypography/index.ts | 6 ++ src/features/AdjustTypography/model/index.ts | 5 ++ .../typographySettingsStore.svelte.ts} | 15 +++- .../typographySettingsStore.test.ts} | 90 +++++++++---------- .../TypographyMenu.stories.svelte | 0 .../ui/TypographyMenu/TypographyMenu.svelte | 0 .../ui/index.ts | 0 .../ui/FontSampler/FontSampler.svelte | 2 +- src/features/SetupFont/index.ts | 6 -- src/features/SetupFont/lib/index.ts | 4 - src/features/SetupFont/model/index.ts | 1 - .../model/state/typographySettingsStore.ts | 7 -- .../model/stores/comparisonStore.svelte.ts | 2 +- .../model/stores/comparisonStore.test.ts | 4 +- .../ui/Character/Character.svelte | 2 +- .../ComparisonView/ui/Line/Line.svelte | 2 +- .../ui/SliderArea/SliderArea.svelte | 4 +- .../ui/SampleList/SampleList.svelte | 4 +- 18 files changed, 78 insertions(+), 76 deletions(-) create mode 100644 src/features/AdjustTypography/index.ts create mode 100644 src/features/AdjustTypography/model/index.ts rename src/features/{SetupFont/lib/settingsManager/settingsManager.svelte.ts => AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.svelte.ts} (95%) rename src/features/{SetupFont/lib/settingsManager/settingsManager.test.ts => AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.test.ts} (89%) rename src/features/{SetupFont => AdjustTypography}/ui/TypographyMenu/TypographyMenu.stories.svelte (100%) rename src/features/{SetupFont => AdjustTypography}/ui/TypographyMenu/TypographyMenu.svelte (100%) rename src/features/{SetupFont => AdjustTypography}/ui/index.ts (100%) delete mode 100644 src/features/SetupFont/index.ts delete mode 100644 src/features/SetupFont/lib/index.ts delete mode 100644 src/features/SetupFont/model/index.ts delete mode 100644 src/features/SetupFont/model/state/typographySettingsStore.ts diff --git a/src/features/AdjustTypography/index.ts b/src/features/AdjustTypography/index.ts new file mode 100644 index 0000000..da1afb9 --- /dev/null +++ b/src/features/AdjustTypography/index.ts @@ -0,0 +1,6 @@ +export { + createTypographySettingsStore, + type TypographySettingsStore, + typographySettingsStore, +} from './model'; +export { TypographyMenu } from './ui'; diff --git a/src/features/AdjustTypography/model/index.ts b/src/features/AdjustTypography/model/index.ts new file mode 100644 index 0000000..67419fd --- /dev/null +++ b/src/features/AdjustTypography/model/index.ts @@ -0,0 +1,5 @@ +export { + createTypographySettingsStore, + type TypographySettingsStore, + typographySettingsStore, +} from './store/typographySettingsStore/typographySettingsStore.svelte'; diff --git a/src/features/SetupFont/lib/settingsManager/settingsManager.svelte.ts b/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.svelte.ts similarity index 95% rename from src/features/SetupFont/lib/settingsManager/settingsManager.svelte.ts rename to src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.svelte.ts index 3702b2f..2365196 100644 --- a/src/features/SetupFont/lib/settingsManager/settingsManager.svelte.ts +++ b/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.svelte.ts @@ -16,6 +16,7 @@ import { DEFAULT_FONT_WEIGHT, DEFAULT_LETTER_SPACING, DEFAULT_LINE_HEIGHT, + DEFAULT_TYPOGRAPHY_CONTROLS_DATA, } from '$entities/Font'; import { type ControlDataModel, @@ -67,7 +68,7 @@ export interface TypographySettings { * Manages multiple typography controls with persistent storage and * responsive scaling support for font size. */ -export class TypographySettingsManager { +export class TypographySettingsStore { /** * Internal map of reactive controls keyed by their identifier */ @@ -303,7 +304,7 @@ export class TypographySettingsManager { * @param storageId - Persistent storage identifier * @returns Typography control manager instance */ -export function createTypographySettingsManager( +export function createTypographySettingsStore( configs: ControlModel[], storageId: string = 'glyphdiff:typography', ) { @@ -313,5 +314,13 @@ export function createTypographySettingsManager( lineHeight: DEFAULT_LINE_HEIGHT, letterSpacing: DEFAULT_LETTER_SPACING, }); - return new TypographySettingsManager(configs, storage); + return new TypographySettingsStore(configs, storage); } + +/** + * App-wide typography settings singleton, keyed for the comparison view. + */ +export const typographySettingsStore = createTypographySettingsStore( + DEFAULT_TYPOGRAPHY_CONTROLS_DATA, + 'glyphdiff:comparison:typography', +); diff --git a/src/features/SetupFont/lib/settingsManager/settingsManager.test.ts b/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.test.ts similarity index 89% rename from src/features/SetupFont/lib/settingsManager/settingsManager.test.ts rename to src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.test.ts index 31d4c8d..094bf75 100644 --- a/src/features/SetupFont/lib/settingsManager/settingsManager.test.ts +++ b/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.test.ts @@ -17,13 +17,13 @@ import { } from 'vitest'; import { type TypographySettings, - TypographySettingsManager, -} from './settingsManager.svelte'; + TypographySettingsStore, +} from './typographySettingsStore.svelte'; /** - * Test Strategy for TypographySettingsManager + * Test Strategy for TypographySettingsStore * - * This test suite validates the TypographySettingsManager state management logic. + * This test suite validates the TypographySettingsStore state management logic. * These are unit tests for the manager logic, separate from component rendering. * * NOTE: Svelte 5's $effect runs in microtasks, so we need to flush effects @@ -46,7 +46,7 @@ async function flushEffects() { await Promise.resolve(); } -describe('TypographySettingsManager - Unit Tests', () => { +describe('TypographySettingsStore - Unit Tests', () => { let mockStorage: TypographySettings; let mockPersistentStore: { value: TypographySettings; @@ -86,7 +86,7 @@ describe('TypographySettingsManager - Unit Tests', () => { describe('Initialization', () => { it('creates manager with default values from storage', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -106,7 +106,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }; mockPersistentStore = createMockPersistentStore(mockStorage); - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -118,7 +118,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('initializes font size control with base size multiplied by current multiplier (1)', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -127,7 +127,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('returns all controls via controls getter', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -143,7 +143,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('returns individual controls via specific getters', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -161,7 +161,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('control instances have expected interface', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -180,7 +180,7 @@ describe('TypographySettingsManager - Unit Tests', () => { describe('Multiplier System', () => { it('has default multiplier of 1', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -189,7 +189,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('updates multiplier when set', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -202,7 +202,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('does not update multiplier if set to same value', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -218,7 +218,7 @@ describe('TypographySettingsManager - Unit Tests', () => { mockStorage = { fontSize: 48, fontWeight: 400, lineHeight: 1.5, letterSpacing: 0 }; mockPersistentStore = createMockPersistentStore(mockStorage); - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -242,7 +242,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('updates font size control display value when multiplier increases', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -263,7 +263,7 @@ describe('TypographySettingsManager - Unit Tests', () => { describe('Base Size Setter', () => { it('updates baseSize when set directly', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -274,7 +274,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('updates size control value when baseSize is set', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -285,7 +285,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('applies multiplier to size control when baseSize is set', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -299,7 +299,7 @@ describe('TypographySettingsManager - Unit Tests', () => { describe('Rendered Size Calculation', () => { it('calculates renderedSize as baseSize * multiplier', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -308,7 +308,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('updates renderedSize when multiplier changes', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -321,7 +321,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('updates renderedSize when baseSize changes', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -341,7 +341,7 @@ describe('TypographySettingsManager - Unit Tests', () => { // proxy effect behavior should be tested in E2E tests. it('does NOT immediately update baseSize from control change (effect is async)', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -356,7 +356,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('updates baseSize via direct setter (synchronous)', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -381,7 +381,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }; mockPersistentStore = createMockPersistentStore(mockStorage); - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -394,7 +394,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('syncs to storage after effect flush (async)', async () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -410,7 +410,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('syncs control changes to storage after effect flush (async)', async () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -423,7 +423,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('syncs height control changes to storage after effect flush (async)', async () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -435,7 +435,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('syncs spacing control changes to storage after effect flush (async)', async () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -449,7 +449,7 @@ describe('TypographySettingsManager - Unit Tests', () => { describe('Control Value Getters', () => { it('returns current weight value', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -461,7 +461,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('returns current height value', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -473,7 +473,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('returns current spacing value', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -486,7 +486,7 @@ describe('TypographySettingsManager - Unit Tests', () => { it('returns default value when control is not found', () => { // Create a manager with empty configs (no controls) - const manager = new TypographySettingsManager([], mockPersistentStore); + const manager = new TypographySettingsStore([], mockPersistentStore); expect(manager.weight).toBe(DEFAULT_FONT_WEIGHT); expect(manager.height).toBe(DEFAULT_LINE_HEIGHT); @@ -504,7 +504,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }; mockPersistentStore = createMockPersistentStore(mockStorage); - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -537,7 +537,7 @@ describe('TypographySettingsManager - Unit Tests', () => { clear: clearSpy, }; - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -548,7 +548,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('respects multiplier when resetting font size control', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -566,7 +566,7 @@ describe('TypographySettingsManager - Unit Tests', () => { describe('Complex Scenarios', () => { it('handles changing multiplier then modifying baseSize', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -587,7 +587,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('maintains correct renderedSize throughout changes', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -609,7 +609,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('handles multiple control changes in sequence', async () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -634,7 +634,7 @@ describe('TypographySettingsManager - Unit Tests', () => { mockStorage = { fontSize: 48, fontWeight: 400, lineHeight: 1.5, letterSpacing: 0 }; mockPersistentStore = createMockPersistentStore(mockStorage); - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -646,7 +646,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('handles very small multiplier', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -659,7 +659,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('handles large base size with multiplier', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -672,7 +672,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('handles floating point precision in multiplier', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -691,7 +691,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('handles control methods (increase/decrease)', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); @@ -705,7 +705,7 @@ describe('TypographySettingsManager - Unit Tests', () => { }); it('handles control boundary conditions', () => { - const manager = new TypographySettingsManager( + const manager = new TypographySettingsStore( DEFAULT_TYPOGRAPHY_CONTROLS_DATA, mockPersistentStore, ); diff --git a/src/features/SetupFont/ui/TypographyMenu/TypographyMenu.stories.svelte b/src/features/AdjustTypography/ui/TypographyMenu/TypographyMenu.stories.svelte similarity index 100% rename from src/features/SetupFont/ui/TypographyMenu/TypographyMenu.stories.svelte rename to src/features/AdjustTypography/ui/TypographyMenu/TypographyMenu.stories.svelte diff --git a/src/features/SetupFont/ui/TypographyMenu/TypographyMenu.svelte b/src/features/AdjustTypography/ui/TypographyMenu/TypographyMenu.svelte similarity index 100% rename from src/features/SetupFont/ui/TypographyMenu/TypographyMenu.svelte rename to src/features/AdjustTypography/ui/TypographyMenu/TypographyMenu.svelte diff --git a/src/features/SetupFont/ui/index.ts b/src/features/AdjustTypography/ui/index.ts similarity index 100% rename from src/features/SetupFont/ui/index.ts rename to src/features/AdjustTypography/ui/index.ts diff --git a/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte b/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte index 79b4e9c..7b362a4 100644 --- a/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte +++ b/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte @@ -8,7 +8,7 @@ import { FontApplicator, type UnifiedFont, } from '$entities/Font'; -import { typographySettingsStore } from '$features/SetupFont/model'; +import { typographySettingsStore } from '$features/AdjustTypography/model'; import { Badge, ContentEditable, diff --git a/src/features/SetupFont/index.ts b/src/features/SetupFont/index.ts deleted file mode 100644 index c48f481..0000000 --- a/src/features/SetupFont/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { - createTypographySettingsManager, - type TypographySettingsManager, -} from './lib'; -export { typographySettingsStore } from './model'; -export { TypographyMenu } from './ui'; diff --git a/src/features/SetupFont/lib/index.ts b/src/features/SetupFont/lib/index.ts deleted file mode 100644 index a05ed6e..0000000 --- a/src/features/SetupFont/lib/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { - createTypographySettingsManager, - type TypographySettingsManager, -} from './settingsManager/settingsManager.svelte'; diff --git a/src/features/SetupFont/model/index.ts b/src/features/SetupFont/model/index.ts deleted file mode 100644 index 204e237..0000000 --- a/src/features/SetupFont/model/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { typographySettingsStore } from './state/typographySettingsStore'; diff --git a/src/features/SetupFont/model/state/typographySettingsStore.ts b/src/features/SetupFont/model/state/typographySettingsStore.ts deleted file mode 100644 index 592b355..0000000 --- a/src/features/SetupFont/model/state/typographySettingsStore.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { DEFAULT_TYPOGRAPHY_CONTROLS_DATA } from '$entities/Font'; -import { createTypographySettingsManager } from '../../lib'; - -export const typographySettingsStore = createTypographySettingsManager( - DEFAULT_TYPOGRAPHY_CONTROLS_DATA, - 'glyphdiff:comparison:typography', -); diff --git a/src/widgets/ComparisonView/model/stores/comparisonStore.svelte.ts b/src/widgets/ComparisonView/model/stores/comparisonStore.svelte.ts index 812976a..cf19174 100644 --- a/src/widgets/ComparisonView/model/stores/comparisonStore.svelte.ts +++ b/src/widgets/ComparisonView/model/stores/comparisonStore.svelte.ts @@ -21,7 +21,7 @@ import { fontStore, getFontUrl, } from '$entities/Font'; -import { typographySettingsStore } from '$features/SetupFont/model'; +import { typographySettingsStore } from '$features/AdjustTypography/model'; import { createPersistentStore } from '$shared/lib'; import { untrack } from 'svelte'; import { getPretextFontString } from '../../lib'; diff --git a/src/widgets/ComparisonView/model/stores/comparisonStore.test.ts b/src/widgets/ComparisonView/model/stores/comparisonStore.test.ts index 72a3cec..d42686d 100644 --- a/src/widgets/ComparisonView/model/stores/comparisonStore.test.ts +++ b/src/widgets/ComparisonView/model/stores/comparisonStore.test.ts @@ -71,7 +71,7 @@ vi.mock('$entities/Font', async importOriginal => { }; }); -vi.mock('$features/SetupFont', () => ({ +vi.mock('$features/AdjustTypography', () => ({ DEFAULT_TYPOGRAPHY_CONTROLS_DATA: [], createTypographyControlManager: vi.fn(() => ({ weight: 400, @@ -80,7 +80,7 @@ vi.mock('$features/SetupFont', () => ({ })), })); -vi.mock('$features/SetupFont/model', () => ({ +vi.mock('$features/AdjustTypography/model', () => ({ typographySettingsStore: { weight: 400, renderedSize: 48, diff --git a/src/widgets/ComparisonView/ui/Character/Character.svelte b/src/widgets/ComparisonView/ui/Character/Character.svelte index c247f15..7261b16 100644 --- a/src/widgets/ComparisonView/ui/Character/Character.svelte +++ b/src/widgets/ComparisonView/ui/Character/Character.svelte @@ -3,7 +3,7 @@ Renders a single character with morphing animation -->
diff --git a/src/shared/ui/SidebarContainer/SidebarContainer.svelte b/src/shared/ui/SidebarContainer/SidebarContainer.svelte index 3bfb2ec..57108c9 100644 --- a/src/shared/ui/SidebarContainer/SidebarContainer.svelte +++ b/src/shared/ui/SidebarContainer/SidebarContainer.svelte @@ -59,7 +59,7 @@ function close() {
@@ -83,11 +83,10 @@ function close() { 'shrink-0 z-30 h-full relative', 'overflow-hidden', 'will-change-[width]', - 'transition-[width] duration-300 ease-out', 'border-r border-subtle', - 'bg-surface dark:bg-dark-bg', + 'surface-canvas', isOpen ? 'w-80 opacity-100' : 'w-0 opacity-0', - 'transition-[width,opacity] duration-300 ease-out', + 'transition-[width,opacity] duration-slow ease-out', className, )} > diff --git a/src/shared/ui/Slider/Slider.svelte b/src/shared/ui/Slider/Slider.svelte index 2b2de67..081dd29 100644 --- a/src/shared/ui/Slider/Slider.svelte +++ b/src/shared/ui/Slider/Slider.svelte @@ -70,17 +70,17 @@ let { const isVertical = $derived(orientation === 'vertical'); const labelClasses = `font-mono text-2xs tabular-nums shrink-0 - text-secondary + text-subtle group-hover:text-neutral-700 dark:group-hover:text-neutral-300 transition-colors`; const thumbClasses = `block w-2.5 h-2.5 bg-brand - rotate-45 shadow-sm + rotate-45 shadow-rest hover:scale-125 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/20 data-active:scale-90 - transition-transform duration-150 + transition-transform duration-fast disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing`; diff --git a/src/widgets/ComparisonView/ui/FontList/FontList.svelte b/src/widgets/ComparisonView/ui/FontList/FontList.svelte index 70b9fb7..0d2b94c 100644 --- a/src/widgets/ComparisonView/ui/FontList/FontList.svelte +++ b/src/widgets/ComparisonView/ui/FontList/FontList.svelte @@ -110,28 +110,28 @@ function isFontReady(font: UnifiedFont): boolean {
- +
{/each}
{/snippet} {#snippet children({ item: font, index })} -
+
{#if !isFontReady(font)}
- +
{:else} {@const isSelectedA = font.id === comparisonStore.fontA?.id} @@ -141,9 +141,10 @@ function isFontReady(font: UnifiedFont): boolean {
-
+
{#if main} {@render main()} {/if} @@ -101,7 +101,7 @@ let {
-
+
diff --git a/src/widgets/ComparisonView/ui/Thumb/Thumb.svelte b/src/widgets/ComparisonView/ui/Thumb/Thumb.svelte index d7f665a..fb41ca4 100644 --- a/src/widgets/ComparisonView/ui/Thumb/Thumb.svelte +++ b/src/widgets/ComparisonView/ui/Thumb/Thumb.svelte @@ -36,9 +36,9 @@ let { sliderPos, isDragging }: Props = $props(); '-ml-2.5 md:-ml-3', 'mt-2 md:mt-4', 'bg-brand text-white', - 'flex items-center justify-center', + 'flex-center', 'rounded-none shadow-md', - 'transition-transform duration-150', + 'transition-transform duration-fast', isDragging ? 'scale-110' : 'scale-100', )} > @@ -52,9 +52,9 @@ let { sliderPos, isDragging }: Props = $props(); '-ml-2.5 md:-ml-3', 'mb-2 md:mb-4', 'bg-brand text-white', - 'flex items-center justify-center', + 'flex-center', 'rounded-none shadow-md', - 'transition-transform duration-150', + 'transition-transform duration-fast', isDragging ? 'scale-110' : 'scale-100', )} > diff --git a/src/widgets/Footer/ui/Footer/Footer.svelte b/src/widgets/Footer/ui/Footer/Footer.svelte index 6452d7e..25be409 100644 --- a/src/widgets/Footer/ui/Footer/Footer.svelte +++ b/src/widgets/Footer/ui/Footer/Footer.svelte @@ -14,15 +14,19 @@ const isVertical = $derived(responsive?.isDesktop || responsive?.isDesktopLarge) const currentYear = new Date().getFullYear(); +