Refactor/reacrhitecture to fsd+ #49
@@ -1,8 +1,21 @@
|
||||
export * from './api';
|
||||
export * from './domain';
|
||||
export * from './lib';
|
||||
export * from './model';
|
||||
export * from './ui';
|
||||
|
||||
// Pure model surface (types + constants) is part of the convenient top-level
|
||||
// API. Stateful stores are deliberately excluded — see below.
|
||||
export * from './model/const/const';
|
||||
export * from './model/types';
|
||||
|
||||
/*
|
||||
* Stores (`fontCatalogStore`, `fontLifecycleManager`, `FontsByIdsStore`) are
|
||||
* intentionally NOT re-exported here. They instantiate module-level singletons
|
||||
* and pull `@tanstack/query-core`, so funneling them through this barrel would
|
||||
* make every consumer of `$entities/Font` eager-instantiate stores (and break
|
||||
* tree-shaking / test init-order). Import them via the model segment:
|
||||
* import { fontCatalogStore } from '$entities/Font/model';
|
||||
*/
|
||||
|
||||
// `./testing` is intentionally not re-exported: fixtures must not leak into the
|
||||
// production public API. Import them via `$entities/Font/testing`.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* observer, so it lives at module scope, not in any individual widget.
|
||||
*/
|
||||
|
||||
import { fontCatalogStore } from '$entities/Font';
|
||||
import { fontCatalogStore } from '$entities/Font/model';
|
||||
import { untrack } from 'svelte';
|
||||
import { mapAppliedFiltersToParams } from '../../lib/mapper/mapAppliedFiltersToParams';
|
||||
import { appliedFilterStore } from './appliedFilterStore/appliedFilterStore.svelte';
|
||||
|
||||
@@ -15,12 +15,14 @@
|
||||
|
||||
import {
|
||||
type FontLoadRequestConfig,
|
||||
FontsByIdsStore,
|
||||
type UnifiedFont,
|
||||
fontCatalogStore,
|
||||
fontLifecycleManager,
|
||||
getFontUrl,
|
||||
} from '$entities/Font';
|
||||
import {
|
||||
FontsByIdsStore,
|
||||
fontCatalogStore,
|
||||
fontLifecycleManager,
|
||||
} from '$entities/Font/model';
|
||||
import { typographySettingsStore } from '$features/AdjustTypography/model';
|
||||
import { createPersistentStore } from '$shared/lib';
|
||||
import { untrack } from 'svelte';
|
||||
|
||||
@@ -53,6 +53,16 @@ vi.mock('$shared/lib/helpers/createPersistentStore/createPersistentStore.svelte'
|
||||
|
||||
vi.mock('$entities/Font', async importOriginal => {
|
||||
const actual = await importOriginal<typeof import('$entities/Font')>();
|
||||
return {
|
||||
...actual,
|
||||
getFontUrl: vi.fn(() => 'https://example.com/font.woff2'),
|
||||
};
|
||||
});
|
||||
|
||||
// Stores moved behind the model segment; mock them there. FontsByIdsStore is
|
||||
// intentionally left real (spread from actual) so $state reactivity works.
|
||||
vi.mock('$entities/Font/model', async importOriginal => {
|
||||
const actual = await importOriginal<typeof import('$entities/Font/model')>();
|
||||
return {
|
||||
...actual,
|
||||
fontCatalogStore: { fonts: [] },
|
||||
@@ -63,7 +73,6 @@ vi.mock('$entities/Font', async importOriginal => {
|
||||
getFontStatus: vi.fn(),
|
||||
ready: vi.fn(() => Promise.resolve()),
|
||||
},
|
||||
getFontUrl: vi.fn(() => 'https://example.com/font.woff2'),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -84,11 +93,11 @@ vi.mock('$features/AdjustTypography/model', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
import * as proxyFonts from '$entities/Font/api/proxy/proxyFonts';
|
||||
import {
|
||||
fontCatalogStore,
|
||||
fontLifecycleManager,
|
||||
} from '$entities/Font';
|
||||
import * as proxyFonts from '$entities/Font/api/proxy/proxyFonts';
|
||||
} from '$entities/Font/model';
|
||||
import { ComparisonStore } from './comparisonStore.svelte';
|
||||
|
||||
describe('ComparisonStore', () => {
|
||||
|
||||
@@ -9,9 +9,11 @@ import {
|
||||
FontVirtualList,
|
||||
type UnifiedFont,
|
||||
VIRTUAL_INDEX_NOT_LOADED,
|
||||
} from '$entities/Font';
|
||||
import {
|
||||
fontCatalogStore,
|
||||
fontLifecycleManager,
|
||||
} from '$entities/Font';
|
||||
} from '$entities/Font/model';
|
||||
import { getSkeletonWidth } from '$shared/lib/utils';
|
||||
import {
|
||||
Button,
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
import {
|
||||
FontVirtualList,
|
||||
createFontRowSizeResolver,
|
||||
} from '$entities/Font';
|
||||
import {
|
||||
fontCatalogStore,
|
||||
fontLifecycleManager,
|
||||
} from '$entities/Font';
|
||||
} from '$entities/Font/model';
|
||||
import {
|
||||
TypographyMenu,
|
||||
typographySettingsStore,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Wraps SampleList with a Section component
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { fontCatalogStore } from '$entities/Font';
|
||||
import { fontCatalogStore } from '$entities/Font/model';
|
||||
import { NavigationWrapper } from '$features/Breadcrumb';
|
||||
import type { ResponsiveManager } from '$shared/lib';
|
||||
import { cn } from '$shared/lib';
|
||||
|
||||
Reference in New Issue
Block a user