|
183 | 183 | @mixin typography-hierarchy($config-or-theme, $selector: '.mat-typography') { |
184 | 184 | $config: private-typography-to-2014-config(theming.get-typography-config($config-or-theme)); |
185 | 185 |
|
186 | | - .mat-h1, .mat-headline, #{$selector} h1 { |
| 186 | + // Note that it seems redundant to prefix the class rules with the `$selector`, however it's |
| 187 | + // necessary if we want to allow people to overwrite the tag selectors. This is due to |
| 188 | + // selectors like `#{$selector} h1` being more specific than ones like `.mat-title`. |
| 189 | + .mat-h1, |
| 190 | + .mat-headline, |
| 191 | + #{$selector} .mat-h1, |
| 192 | + #{$selector} .mat-headline, |
| 193 | + #{$selector} h1 { |
187 | 194 | @include typography-utils.typography-level($config, headline); |
188 | 195 | margin: 0 0 16px; |
189 | 196 | } |
190 | 197 |
|
191 | | - .mat-h2, .mat-title, #{$selector} h2 { |
| 198 | + .mat-h2, |
| 199 | + .mat-title, |
| 200 | + #{$selector} .mat-h2, |
| 201 | + #{$selector} .mat-title, |
| 202 | + #{$selector} h2 { |
192 | 203 | @include typography-utils.typography-level($config, title); |
193 | 204 | margin: 0 0 16px; |
194 | 205 | } |
195 | 206 |
|
196 | | - .mat-h3, .mat-subheading-2, #{$selector} h3 { |
| 207 | + .mat-h3, |
| 208 | + .mat-subheading-2, |
| 209 | + #{$selector} .mat-h3, |
| 210 | + #{$selector} .mat-subheading-2, |
| 211 | + #{$selector} h3 { |
197 | 212 | @include typography-utils.typography-level($config, subheading-2); |
198 | 213 | margin: 0 0 16px; |
199 | 214 | } |
200 | 215 |
|
201 | | - .mat-h4, .mat-subheading-1, #{$selector} h4 { |
| 216 | + .mat-h4, |
| 217 | + .mat-subheading-1, |
| 218 | + #{$selector} .mat-h4, |
| 219 | + #{$selector} .mat-subheading-1, |
| 220 | + #{$selector} h4 { |
202 | 221 | @include typography-utils.typography-level($config, subheading-1); |
203 | 222 | margin: 0 0 16px; |
204 | 223 | } |
205 | 224 |
|
206 | 225 | // Note: the spec doesn't have anything that would correspond to h5 and h6, but we add these for |
207 | 226 | // consistency. The font sizes come from the Chrome user agent styles which have h5 at 0.83em |
208 | 227 | // and h6 at 0.67em. |
209 | | - .mat-h5, #{$selector} h5 { |
| 228 | + .mat-h5, |
| 229 | + #{$selector} .mat-h5, |
| 230 | + #{$selector} h5 { |
210 | 231 | @include typography-utils.font-shorthand( |
211 | 232 | // calc is used here to support css variables |
212 | 233 | calc(#{typography-utils.font-size($config, body-1)} * 0.83), |
|
218 | 239 | margin: 0 0 12px; |
219 | 240 | } |
220 | 241 |
|
221 | | - .mat-h6, #{$selector} h6 { |
| 242 | + .mat-h6, |
| 243 | + #{$selector} .mat-h6, |
| 244 | + #{$selector} h6 { |
222 | 245 | @include typography-utils.font-shorthand( |
223 | 246 | // calc is used here to support css variables |
224 | 247 | calc(#{typography-utils.font-size($config, body-1)} * 0.67), |
|
230 | 253 | margin: 0 0 12px; |
231 | 254 | } |
232 | 255 |
|
233 | | - .mat-body-strong, .mat-body-2 { |
| 256 | + .mat-body-strong, |
| 257 | + .mat-body-2, |
| 258 | + #{$selector} .mat-body-strong, |
| 259 | + #{$selector} .mat-body-2 { |
234 | 260 | @include typography-utils.typography-level($config, body-2); |
235 | 261 | } |
236 | 262 |
|
237 | | - .mat-body, .mat-body-1, #{$selector} { |
| 263 | + .mat-body, |
| 264 | + .mat-body-1, |
| 265 | + #{$selector} .mat-body, |
| 266 | + #{$selector} .mat-body-1, |
| 267 | + #{$selector} { |
238 | 268 | @include typography-utils.typography-level($config, body-1); |
239 | 269 |
|
240 | 270 | p { |
241 | 271 | margin: 0 0 12px; |
242 | 272 | } |
243 | 273 | } |
244 | 274 |
|
245 | | - .mat-small, .mat-caption { |
| 275 | + .mat-small, |
| 276 | + .mat-caption, |
| 277 | + #{$selector} .mat-small, |
| 278 | + #{$selector} .mat-caption { |
246 | 279 | @include typography-utils.typography-level($config, caption); |
247 | 280 | } |
248 | 281 |
|
249 | | - .mat-display-4, #{$selector} .mat-display-4 { |
| 282 | + .mat-display-4, |
| 283 | + #{$selector} .mat-display-4 { |
250 | 284 | @include typography-utils.typography-level($config, display-4); |
251 | 285 | margin: 0 0 56px; |
252 | 286 | } |
253 | 287 |
|
254 | | - .mat-display-3, #{$selector} .mat-display-3 { |
| 288 | + .mat-display-3, |
| 289 | + #{$selector} .mat-display-3 { |
255 | 290 | @include typography-utils.typography-level($config, display-3); |
256 | 291 | margin: 0 0 64px; |
257 | 292 | } |
258 | 293 |
|
259 | | - .mat-display-2, #{$selector} .mat-display-2 { |
| 294 | + .mat-display-2, |
| 295 | + #{$selector} .mat-display-2 { |
260 | 296 | @include typography-utils.typography-level($config, display-2); |
261 | 297 | margin: 0 0 64px; |
262 | 298 | } |
263 | 299 |
|
264 | | - .mat-display-1, #{$selector} .mat-display-1 { |
| 300 | + .mat-display-1, |
| 301 | + #{$selector} .mat-display-1 { |
265 | 302 | @include typography-utils.typography-level($config, display-1); |
266 | 303 | margin: 0 0 64px; |
267 | 304 | } |
|
0 commit comments