refactor(font): consolidate all types into single types.ts file
- Created unified model/types.ts with all type definitions - Consolidated domain types (FontCategory, FontProvider, FontSubset) - Consolidated Google Fonts API types (FontItem, GoogleFontsApiModel, etc.) - Consolidated Fontshare API types (FontshareFont, FontshareStyle, etc.) - Consolidated normalization types (UnifiedFont, FontStyleUrls, etc.) - Consolidated store types (FontCollectionStore, FontCollectionFilters, etc.) - Removed duplicate type files (font.ts, google_fonts.ts, fontshare_fonts.ts) - Updated all imports to use consolidated types - Updated normalize module to import from /Font - Updated API clients to re-export types for backward compatibility - Updated store to use centralized types - Updated Font index.ts to export all types Benefits: - Centralized type definitions in single location - Cleaner imports (single import from /Font) - Better code organization with clear sections - Follows FSD principles (types in model layer) - No duplicate type definitions
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
* @see https://developers.google.com/fonts/docs/developer_api
|
||||
*/
|
||||
|
||||
import type {
|
||||
FontItem,
|
||||
GoogleFontsApiModel,
|
||||
} from '$entities/Font';
|
||||
import { api } from '$shared/api/api';
|
||||
import { buildQueryString } from '$shared/utils';
|
||||
import type { QueryParams } from '$shared/utils';
|
||||
@@ -43,25 +47,15 @@ export interface GoogleFontsParams extends QueryParams {
|
||||
|
||||
/**
|
||||
* Google Fonts API response wrapper
|
||||
* Re-exported from model/types for backward compatibility
|
||||
*/
|
||||
export interface GoogleFontsResponse {
|
||||
kind: string;
|
||||
items: GoogleFontItem[];
|
||||
}
|
||||
export type GoogleFontsResponse = GoogleFontsApiModel;
|
||||
|
||||
/**
|
||||
* Simplified font item from Google Fonts API
|
||||
* Re-exported from model/types for backward compatibility
|
||||
*/
|
||||
export interface GoogleFontItem {
|
||||
family: string;
|
||||
category: string;
|
||||
variants: string[];
|
||||
subsets: string[];
|
||||
version: string;
|
||||
lastModified: string;
|
||||
files: Record<string, string>;
|
||||
menu: string;
|
||||
}
|
||||
export type GoogleFontItem = FontItem;
|
||||
|
||||
/**
|
||||
* Google Fonts API base URL
|
||||
|
||||
Reference in New Issue
Block a user