From 09869aed00709a9315132ba5f57efe36e2f20950 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Wed, 3 Jun 2026 08:34:49 +0300 Subject: [PATCH] refactor(entities/Font): relocate FontSampler from DisplayFont, invert typography MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DisplayFont was not a feature (FSD+ A-6): the whole slice was one presentational component that renders a Font styled by typography, with no model/domain/action. To get typography it reached sideways into a sibling feature (`$features/AdjustTypography/model`) — a feature->feature edge (C-1), the symptom of the mislayering, not the disease. Fix by inversion, mirroring the existing `status` prop pattern: - move FontSampler into entities/Font/ui (it now uses only entity siblings + $shared/ui) - it accepts a `typography` prop typed to a minimal contract defined in the component; the AdjustTypography store satisfies it structurally, so the entity has no dependency on the feature - SampleList (owns both) injects its typographySettingsStore as the prop - delete the DisplayFont slice; export FontSampler from the Font barrel; relocate the story (now passes a mock typography) Resolves A-6, A-7, and the FontSampler half of C-1. Verified: 0 type errors, 0 lint (boundary rule satisfied), 905 unit + 213 component tests, production build OK. --- src/entities/Font/index.ts | 1 + .../ui/FontSampler/FontSampler.stories.svelte | 14 ++++- .../Font}/ui/FontSampler/FontSampler.svelte | 61 +++++++++++++------ src/entities/Font/ui/index.ts | 2 + src/features/DisplayFont/index.ts | 1 - src/features/DisplayFont/ui/index.ts | 3 - .../ui/SampleList/SampleList.svelte | 4 +- 7 files changed, 61 insertions(+), 25 deletions(-) rename src/{features/DisplayFont => entities/Font}/ui/FontSampler/FontSampler.stories.svelte (90%) rename src/{features/DisplayFont => entities/Font}/ui/FontSampler/FontSampler.svelte (78%) delete mode 100644 src/features/DisplayFont/index.ts delete mode 100644 src/features/DisplayFont/ui/index.ts diff --git a/src/entities/Font/index.ts b/src/entities/Font/index.ts index af4d2b2..b93f0fc 100644 --- a/src/entities/Font/index.ts +++ b/src/entities/Font/index.ts @@ -19,6 +19,7 @@ export type { FontRowSizeResolverOptions } from './lib'; export { FontApplicator, + FontSampler, FontVirtualList, } from './ui'; diff --git a/src/features/DisplayFont/ui/FontSampler/FontSampler.stories.svelte b/src/entities/Font/ui/FontSampler/FontSampler.stories.svelte similarity index 90% rename from src/features/DisplayFont/ui/FontSampler/FontSampler.stories.svelte rename to src/entities/Font/ui/FontSampler/FontSampler.stories.svelte index 0a5dadb..b01a5c8 100644 --- a/src/features/DisplayFont/ui/FontSampler/FontSampler.stories.svelte +++ b/src/entities/Font/ui/FontSampler/FontSampler.stories.svelte @@ -4,7 +4,7 @@ import { defineMeta } from '@storybook/addon-svelte-csf'; import FontSampler from './FontSampler.svelte'; const { Story } = defineMeta({ - title: 'Features/FontSampler', + title: 'Entities/Font/FontSampler', component: FontSampler, tags: ['autodocs'], parameters: { @@ -39,8 +39,8 @@ const { Story } = defineMeta({ {#snippet template(args: ComponentProps)} @@ -111,6 +120,7 @@ const mockGeorgia: UnifiedFont = { text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.', index: 1, + typography: mockTypography, }} > {#snippet template(args: ComponentProps)} diff --git a/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte b/src/entities/Font/ui/FontSampler/FontSampler.svelte similarity index 78% rename from src/features/DisplayFont/ui/FontSampler/FontSampler.svelte rename to src/entities/Font/ui/FontSampler/FontSampler.svelte index 4d15486..bf019e8 100644 --- a/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte +++ b/src/entities/Font/ui/FontSampler/FontSampler.svelte @@ -4,12 +4,6 @@ Visual design matches FontCard: sharp corners, red hover accent, header stats. --> @@ -73,7 +100,7 @@ const stats = $derived([ min-h-60 rounded-none " - style:font-weight={typographySettingsStore.weight} + style:font-weight={typography.weight} >
diff --git a/src/entities/Font/ui/index.ts b/src/entities/Font/ui/index.ts index 7dae687..2ba384f 100644 --- a/src/entities/Font/ui/index.ts +++ b/src/entities/Font/ui/index.ts @@ -1,7 +1,9 @@ import FontApplicator from './FontApplicator/FontApplicator.svelte'; +import FontSampler from './FontSampler/FontSampler.svelte'; import FontVirtualList from './FontVirtualList/FontVirtualList.svelte'; export { FontApplicator, + FontSampler, FontVirtualList, }; diff --git a/src/features/DisplayFont/index.ts b/src/features/DisplayFont/index.ts deleted file mode 100644 index a15fd38..0000000 --- a/src/features/DisplayFont/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { FontSampler } from './ui'; diff --git a/src/features/DisplayFont/ui/index.ts b/src/features/DisplayFont/ui/index.ts deleted file mode 100644 index b055bdf..0000000 --- a/src/features/DisplayFont/ui/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import FontSampler from './FontSampler/FontSampler.svelte'; - -export { FontSampler }; diff --git a/src/widgets/SampleList/ui/SampleList/SampleList.svelte b/src/widgets/SampleList/ui/SampleList/SampleList.svelte index b6a63ed..4c16149 100644 --- a/src/widgets/SampleList/ui/SampleList/SampleList.svelte +++ b/src/widgets/SampleList/ui/SampleList/SampleList.svelte @@ -6,6 +6,7 @@ -->