w1-system-font-validator
Version:
VS Code extension for validating W1 System font variables (both fontConfig.json and localFontConfig.json)
97 lines • 2.44 kB
TypeScript
/**
* Type definitions for W1 Font System configurations
* Supports both fontConfig.json and localFontConfig.json
*/
export interface FontConfig {
generated: string;
fontConfig: string;
validVariables: string[];
roles: Record<string, FontRole>;
summary: {
totalRoles: number;
totalVariables: number;
fontsWithItalics: number;
};
}
export interface FontRole {
fontId?: string;
displayName: string;
cssFamily: string;
hasItalics: boolean;
availableWeights: Record<string, WeightInfo | null>;
variables: {
family: string;
};
}
export interface WeightInfo {
weight: number;
style: "normal" | "italic";
}
export interface LocalFontConfig {
generated: string;
fontConfig?: string;
validVariables: string[];
roles: Record<string, string | null>;
detailedRoles?: Record<string, LocalFontRole>;
fonts: Record<string, LocalFont>;
summary: {
totalFonts: number;
totalVariants: number;
totalRoles: number;
assignedRoles: number;
totalVariables?: number;
fontsWithItalics?: number;
};
}
export interface LocalFontRole {
fontId: string;
displayName: string;
cssFamily: string;
hasItalics: boolean;
availableWeights: Record<string, WeightInfo | null>;
variables: {
family: string;
};
}
export interface LocalFont {
fontName: string;
displayName: string;
cssFamily: string;
variants: FontVariant[];
directory: string;
lastUpdated: string;
}
export interface FontVariant {
weight: number;
style: "normal" | "italic";
filename: string;
}
export interface ProjectFontConfig {
hasFontConfig: boolean;
hasLocalFontConfig: boolean;
fontConfigPath?: string;
localFontConfigPath?: string;
fontConfig?: FontConfig;
localFontConfig?: LocalFontConfig;
}
export interface ValidationPattern {
fontFamilyPattern: RegExp;
validWeights: string[];
deprecatedWeightPattern?: RegExp;
}
export interface ValidationError {
type: 'invalid-font-family' | 'invalid-weight' | 'deprecated-pattern' | 'missing-config';
message: string;
suggestions?: string[];
range: {
start: {
line: number;
character: number;
};
end: {
line: number;
character: number;
};
};
}
//# sourceMappingURL=fontConfig.d.ts.map