|
20 | 20 | // THE SOFTWARE.
|
21 | 21 | //
|
22 | 22 |
|
| 23 | +@import "@material/feature-targeting/functions"; |
| 24 | +@import "@material/feature-targeting/mixins"; |
23 | 25 | @import "./variables";
|
24 | 26 |
|
25 |
| -@mixin mdc-typography-base { |
26 |
| - @each $key, $value in $mdc-typography-base { |
27 |
| - #{$key}: $value; |
| 27 | +@mixin mdc-typography-base($query: mdc-feature-all()) { |
| 28 | + $feat-typography: mdc-feature-create-target($query, typography); |
| 29 | + |
| 30 | + @include mdc-feature-targets($feat-typography) { |
| 31 | + @each $key, $value in $mdc-typography-base { |
| 32 | + #{$key}: $value; |
| 33 | + } |
28 | 34 | }
|
29 | 35 | }
|
30 | 36 |
|
31 |
| -@mixin mdc-typography($style) { |
| 37 | +@mixin mdc-typography($style, $query: mdc-feature-all()) { |
| 38 | + $feat-typography: mdc-feature-create-target($query, typography); |
32 | 39 | $style-props: map-get($mdc-typography-styles, $style);
|
33 | 40 |
|
34 | 41 | @if not map-has-key($mdc-typography-styles, $style) {
|
35 | 42 | @error "Invalid style specified! #{$style} doesn't exist. Choose one of #{map-keys($mdc-typography-styles)}";
|
36 | 43 | }
|
37 | 44 |
|
38 |
| - @each $key, $value in $style-props { |
39 |
| - #{$key}: $value; |
| 45 | + @include mdc-feature-targets($feat-typography) { |
| 46 | + @each $key, $value in $style-props { |
| 47 | + #{$key}: $value; |
| 48 | + } |
40 | 49 | }
|
41 | 50 | }
|
42 | 51 |
|
43 | 52 | // Element must be `display: block` or `display: inline-block` for this to work.
|
44 |
| -@mixin mdc-typography-overflow-ellipsis { |
45 |
| - text-overflow: ellipsis; |
46 |
| - white-space: nowrap; |
47 |
| - overflow: hidden; |
| 53 | +@mixin mdc-typography-overflow-ellipsis($query: mdc-feature-all()) { |
| 54 | + $feat-structure: mdc-feature-create-target($query, structure); |
| 55 | + |
| 56 | + @include mdc-feature-targets($feat-structure) { |
| 57 | + text-overflow: ellipsis; |
| 58 | + white-space: nowrap; |
| 59 | + overflow: hidden; |
| 60 | + } |
48 | 61 | }
|
49 | 62 |
|
50 |
| -@mixin mdc-typography-baseline-top($distance) { |
51 |
| - display: block; |
52 |
| - margin-top: 0; |
53 |
| - /* @alternate */ |
54 |
| - line-height: normal; |
| 63 | +@mixin mdc-typography-baseline-top($distance, $query: mdc-feature-all()) { |
| 64 | + $feat-structure: mdc-feature-create-target($query, structure); |
| 65 | + |
| 66 | + @include mdc-feature-targets($feat-structure) { |
| 67 | + display: block; |
| 68 | + margin-top: 0; |
| 69 | + /* @alternate */ |
| 70 | + line-height: normal; |
| 71 | + } |
55 | 72 |
|
56 | 73 | &::before {
|
57 |
| - @include mdc-typography-baseline-strut_($distance); |
| 74 | + @include mdc-feature-targets($feat-structure) { |
| 75 | + @include mdc-typography-baseline-strut_($distance); |
58 | 76 |
|
59 |
| - vertical-align: 0; |
| 77 | + vertical-align: 0; |
| 78 | + } |
60 | 79 | }
|
61 | 80 | }
|
62 | 81 |
|
63 |
| -@mixin mdc-typography-baseline-bottom($distance) { |
64 |
| - margin-bottom: -1 * $distance; |
| 82 | +@mixin mdc-typography-baseline-bottom($distance, $query: mdc-feature-all()) { |
| 83 | + $feat-structure: mdc-feature-create-target($query, structure); |
| 84 | + |
| 85 | + @include mdc-feature-targets($feat-structure) { |
| 86 | + margin-bottom: -1 * $distance; |
| 87 | + } |
65 | 88 |
|
66 | 89 | &::after {
|
67 |
| - @include mdc-typography-baseline-strut_($distance); |
| 90 | + @include mdc-feature-targets($feat-structure) { |
| 91 | + @include mdc-typography-baseline-strut_($distance); |
68 | 92 |
|
69 |
| - vertical-align: -1 * $distance; |
| 93 | + vertical-align: -1 * $distance; |
| 94 | + } |
70 | 95 | }
|
71 | 96 | }
|
72 | 97 |
|
|
0 commit comments