File tree Expand file tree Collapse file tree
packages/theming-material/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { inject } from '@angular/core' ;
2+ import {
3+ ThemeBuilder ,
4+ ThemeBuilderContext ,
5+ ThemeTokens ,
6+ } from '@angularity/theming' ;
7+
8+ import { TypescaleBuilder , TypescaleConfig } from './typescale' ;
9+
10+ export interface StandardTypescaleBuilderConfig {
11+ font : string ;
12+ }
13+
14+ export class StandardTypescaleBuilder
15+ implements ThemeBuilder < StandardTypescaleBuilderConfig >
16+ {
17+ protected core = inject ( TypescaleBuilder ) ;
18+ build (
19+ context : ThemeBuilderContext < StandardTypescaleBuilderConfig > ,
20+ ) : ThemeTokens {
21+ const { name, config } = context ;
22+ const typescales = STANDARD_TYPESCALES . map ( ( typescale ) => ( {
23+ ...typescale ,
24+ font : config . font ,
25+ } ) ) ;
26+ return this . core . build ( { name, config : typescales } ) ;
27+ }
28+ }
29+
30+ export const STANDARD_TYPESCALES : Omit < TypescaleConfig , 'font' > [ ] = [
31+ {
32+ name : 'display-large' ,
33+ weight : '400' ,
34+ size : '57px' ,
35+ lineHeight : '112.28%' ,
36+ tracking : '-0.2px' ,
37+ } ,
38+ {
39+ name : 'display-medium' ,
40+ weight : '400' ,
41+ size : '45px' ,
42+ lineHeight : '115.56%' ,
43+ tracking : '0.0px' ,
44+ } ,
45+ {
46+ name : 'display-small' ,
47+ weight : '400' ,
48+ size : '36px' ,
49+ lineHeight : '122.22%' ,
50+ tracking : '0.0px' ,
51+ } ,
52+ {
53+ name : 'headline-large' ,
54+ weight : '400' ,
55+ size : '32px' ,
56+ lineHeight : '125%' ,
57+ tracking : '0.0px' ,
58+ } ,
59+ {
60+ name : 'headline-medium' ,
61+ weight : '400' ,
62+ size : '28px' ,
63+ lineHeight : '128.57%' ,
64+ tracking : '0.0px' ,
65+ } ,
66+ {
67+ name : 'headline-small' ,
68+ weight : '400' ,
69+ size : '24px' ,
70+ lineHeight : '133.33%' ,
71+ tracking : '0.0px' ,
72+ } ,
73+ {
74+ name : 'title-large' ,
75+ weight : '400' ,
76+ size : '22px' ,
77+ lineHeight : '127.27%' ,
78+ tracking : '0.0px' ,
79+ } ,
80+ {
81+ name : 'title-medium' ,
82+ weight : '500' ,
83+ size : '16px' ,
84+ lineHeight : '150%' ,
85+ tracking : '0.2px' ,
86+ } ,
87+ {
88+ name : 'title-small' ,
89+ weight : '500' ,
90+ size : '14px' ,
91+ lineHeight : '142.86%' ,
92+ tracking : '0.1px' ,
93+ } ,
94+ {
95+ name : 'body-large' ,
96+ weight : '400' ,
97+ size : '16px' ,
98+ lineHeight : '150%' ,
99+ tracking : '0.5px' ,
100+ } ,
101+ {
102+ name : 'body-medium' ,
103+ weight : '400' ,
104+ size : '14px' ,
105+ lineHeight : '142.86%' ,
106+ tracking : '0.2px' ,
107+ } ,
108+ {
109+ name : 'body-small' ,
110+ weight : '400' ,
111+ size : '12px' ,
112+ lineHeight : '133.33%' ,
113+ tracking : '0.4px' ,
114+ } ,
115+ {
116+ name : 'label-large' ,
117+ weight : '500' ,
118+ size : '14px' ,
119+ lineHeight : '142.86%' ,
120+ tracking : '0.1px' ,
121+ } ,
122+ {
123+ name : 'label-medium' ,
124+ weight : '500' ,
125+ size : '12px' ,
126+ lineHeight : '133.33%' ,
127+ tracking : '0.5px' ,
128+ } ,
129+ {
130+ name : 'label-small' ,
131+ weight : '500' ,
132+ size : '11px' ,
133+ lineHeight : '145.45%' ,
134+ tracking : '0.5px' ,
135+ } ,
136+ ] ;
You can’t perform that action at this time.
0 commit comments