refactor: consolidate font domain and model types into font.ts
This commit is contained in:
@@ -1,15 +1,7 @@
|
||||
/**
|
||||
* ============================================================================
|
||||
* UNIFIED FONT STORE EXPORTS
|
||||
* ============================================================================
|
||||
*
|
||||
* Single export point for the unified font store infrastructure.
|
||||
*/
|
||||
|
||||
// Applied fonts manager (CSS loading - unchanged)
|
||||
// Applied fonts manager
|
||||
export { appliedFontsManager } from './appliedFontsStore/appliedFontsStore.svelte';
|
||||
|
||||
// Single FontStore (new implementation)
|
||||
// Single FontStore
|
||||
export {
|
||||
createFontStore,
|
||||
FontStore,
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* Common font domain types
|
||||
*
|
||||
* Shared types for font entities across providers (Google, Fontshare).
|
||||
* Includes categories, subsets, weights, and filter types.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Unified font category across all providers
|
||||
*/
|
||||
export type FontCategory =
|
||||
| 'sans-serif'
|
||||
| 'serif'
|
||||
| 'display'
|
||||
| 'handwriting'
|
||||
| 'monospace'
|
||||
| 'slab'
|
||||
| 'script';
|
||||
|
||||
/**
|
||||
* Font provider identifier
|
||||
*/
|
||||
export type FontProvider = 'google' | 'fontshare';
|
||||
|
||||
/**
|
||||
* Character subset support
|
||||
*/
|
||||
export type FontSubset = 'latin' | 'latin-ext' | 'cyrillic' | 'greek' | 'arabic' | 'devanagari';
|
||||
|
||||
/**
|
||||
* Combined filter state for font queries
|
||||
*/
|
||||
export interface FontFilters {
|
||||
/** Selected font providers */
|
||||
providers: FontProvider[];
|
||||
/** Selected font categories */
|
||||
categories: FontCategory[];
|
||||
/** Selected character subsets */
|
||||
subsets: FontSubset[];
|
||||
}
|
||||
|
||||
/** Filter group identifier */
|
||||
export type FilterGroup = 'providers' | 'categories' | 'subsets';
|
||||
|
||||
/** Filter type including search query */
|
||||
export type FilterType = FilterGroup | 'searchQuery';
|
||||
|
||||
/**
|
||||
* Numeric font weights (100-900)
|
||||
*/
|
||||
export type FontWeight = '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
||||
|
||||
/**
|
||||
* Italic variant with weight: "100italic", "400italic", "700italic", etc.
|
||||
*/
|
||||
export type FontWeightItalic = `${FontWeight}italic`;
|
||||
|
||||
/**
|
||||
* All possible font variant identifiers
|
||||
*
|
||||
* Includes:
|
||||
* - Numeric weights: "400", "700", etc.
|
||||
* - Italic variants: "400italic", "700italic", etc.
|
||||
* - Legacy names: "regular", "italic", "bold", "bolditalic"
|
||||
*/
|
||||
export type FontVariant =
|
||||
| FontWeight
|
||||
| FontWeightItalic
|
||||
| 'regular'
|
||||
| 'italic'
|
||||
| 'bold'
|
||||
| 'bolditalic';
|
||||
@@ -1,18 +1,78 @@
|
||||
/**
|
||||
* ============================================================================
|
||||
* NORMALIZATION TYPES
|
||||
* ============================================================================
|
||||
* Font domain types
|
||||
*
|
||||
* Shared types for font entities across providers (Google, Fontshare).
|
||||
* Includes categories, subsets, weights, and the unified font model.
|
||||
*/
|
||||
|
||||
import type {
|
||||
FontCategory,
|
||||
FontProvider,
|
||||
FontSubset,
|
||||
FontVariant,
|
||||
} from './common';
|
||||
/**
|
||||
* Unified font category across all providers
|
||||
*/
|
||||
export type FontCategory =
|
||||
| 'sans-serif'
|
||||
| 'serif'
|
||||
| 'display'
|
||||
| 'handwriting'
|
||||
| 'monospace'
|
||||
| 'slab'
|
||||
| 'script';
|
||||
|
||||
/**
|
||||
* Font variant types (standardized)
|
||||
* Font provider identifier
|
||||
*/
|
||||
export type FontProvider = 'google' | 'fontshare';
|
||||
|
||||
/**
|
||||
* Character subset support
|
||||
*/
|
||||
export type FontSubset = 'latin' | 'latin-ext' | 'cyrillic' | 'greek' | 'arabic' | 'devanagari';
|
||||
|
||||
/**
|
||||
* Combined filter state for font queries
|
||||
*/
|
||||
export interface FontFilters {
|
||||
/** Selected font providers */
|
||||
providers: FontProvider[];
|
||||
/** Selected font categories */
|
||||
categories: FontCategory[];
|
||||
/** Selected character subsets */
|
||||
subsets: FontSubset[];
|
||||
}
|
||||
|
||||
/** Filter group identifier */
|
||||
export type FilterGroup = 'providers' | 'categories' | 'subsets';
|
||||
|
||||
/** Filter type including search query */
|
||||
export type FilterType = FilterGroup | 'searchQuery';
|
||||
|
||||
/**
|
||||
* Numeric font weights (100-900)
|
||||
*/
|
||||
export type FontWeight = '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
||||
|
||||
/**
|
||||
* Italic variant with weight: "100italic", "400italic", "700italic", etc.
|
||||
*/
|
||||
export type FontWeightItalic = `${FontWeight}italic`;
|
||||
|
||||
/**
|
||||
* All possible font variant identifiers
|
||||
*
|
||||
* Includes:
|
||||
* - Numeric weights: "400", "700", etc.
|
||||
* - Italic variants: "400italic", "700italic", etc.
|
||||
* - Legacy names: "regular", "italic", "bold", "bolditalic"
|
||||
*/
|
||||
export type FontVariant =
|
||||
| FontWeight
|
||||
| FontWeightItalic
|
||||
| 'regular'
|
||||
| 'italic'
|
||||
| 'bold'
|
||||
| 'bolditalic';
|
||||
|
||||
/**
|
||||
* Standardized font variant alias
|
||||
*/
|
||||
export type UnifiedFontVariant = FontVariant;
|
||||
|
||||
@@ -7,24 +7,23 @@
|
||||
* All imports should use: `import { X } from '$entities/Font/model/types'`
|
||||
*/
|
||||
|
||||
// Domain types
|
||||
// Font domain and model types
|
||||
export type {
|
||||
FilterGroup,
|
||||
FilterType,
|
||||
FontCategory,
|
||||
FontFeatures,
|
||||
FontFilters,
|
||||
FontMetadata,
|
||||
FontProvider,
|
||||
FontStyleUrls,
|
||||
FontSubset,
|
||||
FontVariant,
|
||||
FontWeight,
|
||||
FontWeightItalic,
|
||||
} from './common';
|
||||
|
||||
// Normalization types
|
||||
export type {
|
||||
FontFeatures,
|
||||
FontMetadata,
|
||||
FontStyleUrls,
|
||||
UnifiedFont,
|
||||
UnifiedFontVariant,
|
||||
} from './normalize';
|
||||
} from './font';
|
||||
|
||||
// Store types
|
||||
export type {
|
||||
|
||||
@@ -8,8 +8,8 @@ import type {
|
||||
FontCategory,
|
||||
FontProvider,
|
||||
FontSubset,
|
||||
} from './common';
|
||||
import type { UnifiedFont } from './normalize';
|
||||
UnifiedFont,
|
||||
} from './font';
|
||||
|
||||
/**
|
||||
* Font collection state
|
||||
|
||||
@@ -18,8 +18,8 @@ import {
|
||||
type FontLoadRequestConfig,
|
||||
type UnifiedFont,
|
||||
appliedFontsManager,
|
||||
fontStore,
|
||||
} from '../../model';
|
||||
import { fontStore } from '../../model/store';
|
||||
|
||||
interface Props extends
|
||||
Omit<
|
||||
|
||||
Reference in New Issue
Block a user