refactor(Font): rename fontStore and appliedFontsManager
Both names were vague or overloaded: - fontStore / FontStore -> fontCatalogStore / FontCatalogStore Three font-related stores live in this slice; the new name names the paginated catalog specifically. - appliedFontsManager / AppliedFontsManager -> fontLifecycleManager / FontLifecycleManager "Applied" collided with the filter-side appliedFilterStore (different meaning). The class actually orchestrates a load-use-evict lifecycle with FontBufferCache + FontEvictionPolicy + FontLoadQueue collaborators, so "Manager" is justified. Companion types file moved alongside (appliedFonts.ts -> fontLifecycle.ts). Directories, file basenames, factory (createFontStore -> createFontCatalogStore), and the AppliedFontsManagerDeps interface all renamed. All consumers (ComparisonView, SampleList, FontList, FontApplicator, FontVirtualList, FilterAndSortFonts bindings, createFontRowSizeResolver, mocks) updated.
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
import {
|
||||
type FontLoadRequestConfig,
|
||||
type UnifiedFont,
|
||||
appliedFontsManager,
|
||||
fontStore,
|
||||
fontCatalogStore,
|
||||
fontLifecycleManager,
|
||||
getFontUrl,
|
||||
} from '$entities/Font';
|
||||
import { typographySettingsStore } from '$features/AdjustTypography/model';
|
||||
@@ -140,7 +140,7 @@ export class ComparisonStore {
|
||||
});
|
||||
|
||||
if (configs.length > 0) {
|
||||
appliedFontsManager.touch(configs);
|
||||
fontLifecycleManager.touch(configs);
|
||||
this.#checkFontsLoaded();
|
||||
}
|
||||
});
|
||||
@@ -151,7 +151,7 @@ export class ComparisonStore {
|
||||
return;
|
||||
}
|
||||
|
||||
const fonts = fontStore.fonts;
|
||||
const fonts = fontCatalogStore.fonts;
|
||||
if (fonts.length >= 2) {
|
||||
untrack(() => {
|
||||
const id1 = fonts[0].id;
|
||||
@@ -168,17 +168,17 @@ export class ComparisonStore {
|
||||
const fb = this.#fontB;
|
||||
const w = typographySettingsStore.weight;
|
||||
if (fa) {
|
||||
appliedFontsManager.pin(fa.id, w, fa.features?.isVariable);
|
||||
fontLifecycleManager.pin(fa.id, w, fa.features?.isVariable);
|
||||
}
|
||||
if (fb) {
|
||||
appliedFontsManager.pin(fb.id, w, fb.features?.isVariable);
|
||||
fontLifecycleManager.pin(fb.id, w, fb.features?.isVariable);
|
||||
}
|
||||
return () => {
|
||||
if (fa) {
|
||||
appliedFontsManager.unpin(fa.id, w, fa.features?.isVariable);
|
||||
fontLifecycleManager.unpin(fa.id, w, fa.features?.isVariable);
|
||||
}
|
||||
if (fb) {
|
||||
appliedFontsManager.unpin(fb.id, w, fb.features?.isVariable);
|
||||
fontLifecycleManager.unpin(fb.id, w, fb.features?.isVariable);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user