@sandlada/mdk
Version:
A JavaScript library based on Material Design 3, providing data such as color, shape, shadow level, etc.
26 lines (25 loc) • 1.05 kB
JavaScript
export class Typeface {
Key;
Value;
toJSON() { return ({ Key: this.Key, Value: this.Value }); }
ToCSSDeclaration({ Semicolon = false } = {}) {
return `${this.Key}: ${this.Value}${Semicolon ? ';' : ''}`;
}
ToCSSVariable() {
return `var(${this.Key}, ${this.Value})`;
}
toString() { return this.ToCSSDeclaration(); }
constructor(Key, Value) {
this.Key = Key;
this.Value = Value;
}
static FontBrand = new Typeface('--md-ref-typeface-font-brand', `Roboto`);
static FontPlain = new Typeface('--md-ref-typeface-font-plain', `Roboto`);
static WeightBold = new Typeface('--md-ref-typeface-weight-bold', 700);
static WeightMedium = new Typeface('--md-ref-typeface-weight-medium', 500);
static WeightRegular = new Typeface('--md-ref-typeface-weight-regular', 400);
static AllEnums = {
FontBrand: this.FontBrand, FontPlain: this.FontPlain,
WeightBold: this.WeightBold, WeightMedium: this.WeightMedium, WeightRegular: this.WeightRegular,
};
}