@angular/material 17.0.0-next.0 → 17.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/_index.scss +3 -4
  2. package/autocomplete/_autocomplete-theme.scss +12 -18
  3. package/autocomplete/index.d.ts +15 -24
  4. package/badge/_badge-theme.scss +15 -27
  5. package/badge/index.d.ts +9 -17
  6. package/bottom-sheet/_bottom-sheet-theme.scss +13 -22
  7. package/button/_button-base.scss +3 -3
  8. package/button/_button-theme-private.scss +3 -2
  9. package/button/_button-theme.scss +18 -25
  10. package/button/_fab-theme.scss +31 -49
  11. package/button/_icon-button-theme.scss +19 -26
  12. package/button/index.d.ts +22 -31
  13. package/button-toggle/_button-toggle-theme.scss +17 -28
  14. package/button-toggle/index.d.ts +15 -18
  15. package/card/_card-theme.scss +27 -38
  16. package/checkbox/_checkbox-theme.scss +28 -45
  17. package/checkbox/index.d.ts +21 -27
  18. package/chips/_chips-theme.scss +18 -56
  19. package/core/_core-theme.scss +24 -39
  20. package/core/color/_all-color.scss +7 -15
  21. package/core/density/private/_all-density.scss +34 -39
  22. package/core/focus-indicators/_focus-indicators-theme.scss +6 -8
  23. package/core/focus-indicators/_private.scss +22 -26
  24. package/core/index.d.ts +7 -11
  25. package/core/mdc-helpers/_mdc-helpers.scss +19 -22
  26. package/core/option/_optgroup-theme.scss +13 -23
  27. package/core/option/_option-theme.scss +23 -37
  28. package/core/ripple/_ripple-theme.scss +6 -10
  29. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +17 -24
  30. package/core/style/_form-common.scss +7 -7
  31. package/core/style/_private.scss +5 -7
  32. package/core/style/_sass-utils.scss +7 -0
  33. package/core/testing/index.d.ts +2 -1
  34. package/core/theming/_all-theme.scss +41 -41
  35. package/core/theming/_inspection.scss +133 -59
  36. package/core/theming/_m2-inspection.scss +268 -0
  37. package/core/theming/_theming.scss +59 -20
  38. package/core/tokens/m2/mat/_autocomplete.scss +5 -8
  39. package/core/tokens/m2/mat/_badge.scss +12 -15
  40. package/core/tokens/m2/mat/_bottom-sheet.scss +11 -17
  41. package/core/tokens/m2/mat/_card.scss +15 -21
  42. package/core/tokens/m2/mat/_datepicker.scss +28 -38
  43. package/core/tokens/m2/mat/_divider.scss +5 -8
  44. package/core/tokens/m2/mat/_expansion.scss +24 -28
  45. package/core/tokens/m2/mat/_form-field.scss +21 -25
  46. package/core/tokens/m2/mat/_grid-list.scss +8 -8
  47. package/core/tokens/m2/mat/_icon.scss +3 -3
  48. package/core/tokens/m2/mat/_legacy-button-toggle.scss +15 -19
  49. package/core/tokens/m2/mat/_menu.scss +12 -17
  50. package/core/tokens/m2/mat/_optgroup.scss +12 -17
  51. package/core/tokens/m2/mat/_option.scss +16 -28
  52. package/core/tokens/m2/mat/_paginator.scss +16 -18
  53. package/core/tokens/m2/mat/_radio.scss +7 -10
  54. package/core/tokens/m2/mat/_select.scss +15 -29
  55. package/core/tokens/m2/mat/_sidenav.scss +12 -14
  56. package/core/tokens/m2/mat/_slide-toggle.scss +9 -17
  57. package/core/tokens/m2/mat/_slider.scss +5 -5
  58. package/core/tokens/m2/mat/_snack-bar.scss +7 -8
  59. package/core/tokens/m2/mat/_standard-button-toggle.scss +23 -22
  60. package/core/tokens/m2/mat/_stepper.scss +30 -33
  61. package/core/tokens/m2/mat/_tab-header-with-background.scss +6 -8
  62. package/core/tokens/m2/mat/_tab-header.scss +13 -18
  63. package/core/tokens/m2/mat/_table.scss +19 -23
  64. package/core/tokens/m2/mat/_toolbar.scss +12 -16
  65. package/core/tokens/m2/mdc/_checkbox.scss +21 -20
  66. package/core/tokens/m2/mdc/_chip.scss +38 -24
  67. package/core/tokens/m2/mdc/_circular-progress.scss +5 -6
  68. package/core/tokens/m2/mdc/_dialog.scss +16 -30
  69. package/core/tokens/m2/mdc/_elevated-card.scss +6 -9
  70. package/core/tokens/m2/mdc/_extended-fab.scss +8 -17
  71. package/core/tokens/m2/mdc/_fab.scss +6 -7
  72. package/core/tokens/m2/mdc/_filled-text-field.scss +16 -22
  73. package/core/tokens/m2/mdc/_icon-button.scss +3 -3
  74. package/core/tokens/m2/mdc/_linear-progress.scss +9 -10
  75. package/core/tokens/m2/mdc/_list.scss +44 -42
  76. package/core/tokens/m2/mdc/_outlined-card.scss +7 -10
  77. package/core/tokens/m2/mdc/_outlined-text-field.scss +14 -20
  78. package/core/tokens/m2/mdc/_plain-tooltip.scss +9 -22
  79. package/core/tokens/m2/mdc/_radio.scss +11 -11
  80. package/core/tokens/m2/mdc/_slider.scss +16 -23
  81. package/core/tokens/m2/mdc/_snack-bar.scss +10 -23
  82. package/core/tokens/m2/mdc/_switch.scss +16 -19
  83. package/core/tokens/m2/mdc/_tab-indicator.scss +5 -8
  84. package/core/tokens/m2/mdc/_tab.scss +5 -4
  85. package/core/typography/_all-typography.scss +44 -47
  86. package/core/typography/_definition.scss +258 -0
  87. package/core/typography/_property-getters.scss +63 -0
  88. package/core/typography/_typography-utils.scss +9 -69
  89. package/core/typography/_typography.scss +38 -494
  90. package/core/typography/_versioning.scss +91 -0
  91. package/datepicker/_datepicker-theme.scss +20 -34
  92. package/datepicker/index.d.ts +3 -3
  93. package/dialog/_dialog-theme.scss +22 -23
  94. package/dialog/_mdc-dialog-structure-overrides.scss +12 -10
  95. package/dialog/index.d.ts +2 -0
  96. package/divider/_divider-theme.scss +12 -18
  97. package/esm2022/autocomplete/autocomplete-trigger.mjs +5 -17
  98. package/esm2022/autocomplete/autocomplete.mjs +23 -50
  99. package/esm2022/badge/badge.mjs +11 -29
  100. package/esm2022/button/button-base.mjs +32 -27
  101. package/esm2022/button/button.mjs +6 -6
  102. package/esm2022/button/fab.mjs +23 -31
  103. package/esm2022/button/icon-button.mjs +6 -6
  104. package/esm2022/button/testing/button-harness.mjs +3 -3
  105. package/esm2022/button-toggle/button-toggle.mjs +25 -33
  106. package/esm2022/checkbox/checkbox.mjs +32 -39
  107. package/esm2022/core/option/optgroup.mjs +10 -11
  108. package/esm2022/core/option/option.mjs +6 -6
  109. package/esm2022/core/testing/option-harness.mjs +3 -3
  110. package/esm2022/core/version.mjs +1 -1
  111. package/esm2022/datepicker/calendar.mjs +1 -1
  112. package/esm2022/datepicker/datepicker-base.mjs +2 -2
  113. package/esm2022/datepicker/datepicker-toggle.mjs +1 -1
  114. package/esm2022/datepicker/month-view.mjs +2 -2
  115. package/esm2022/datepicker/multi-year-view.mjs +2 -2
  116. package/esm2022/datepicker/year-view.mjs +2 -2
  117. package/esm2022/dialog/dialog-container.mjs +16 -3
  118. package/esm2022/form-field/form-field.mjs +3 -3
  119. package/esm2022/menu/menu-item.mjs +15 -11
  120. package/esm2022/menu/menu.mjs +9 -22
  121. package/esm2022/paginator/paginator.mjs +1 -1
  122. package/esm2022/select/select.mjs +3 -3
  123. package/esm2022/slide-toggle/slide-toggle.mjs +33 -37
  124. package/esm2022/slider/slider-input.mjs +19 -9
  125. package/esm2022/slider/slider.mjs +2 -2
  126. package/esm2022/snack-bar/simple-snack-bar.mjs +1 -1
  127. package/esm2022/tabs/tab-group.mjs +3 -3
  128. package/expansion/_expansion-theme.scss +16 -24
  129. package/fesm2022/autocomplete.mjs +25 -63
  130. package/fesm2022/autocomplete.mjs.map +1 -1
  131. package/fesm2022/badge.mjs +11 -28
  132. package/fesm2022/badge.mjs.map +1 -1
  133. package/fesm2022/button/testing.mjs +2 -2
  134. package/fesm2022/button/testing.mjs.map +1 -1
  135. package/fesm2022/button-toggle.mjs +25 -32
  136. package/fesm2022/button-toggle.mjs.map +1 -1
  137. package/fesm2022/button.mjs +59 -61
  138. package/fesm2022/button.mjs.map +1 -1
  139. package/fesm2022/checkbox.mjs +31 -38
  140. package/fesm2022/checkbox.mjs.map +1 -1
  141. package/fesm2022/core/testing.mjs +2 -2
  142. package/fesm2022/core/testing.mjs.map +1 -1
  143. package/fesm2022/core.mjs +14 -13
  144. package/fesm2022/core.mjs.map +1 -1
  145. package/fesm2022/datepicker.mjs +6 -6
  146. package/fesm2022/datepicker.mjs.map +1 -1
  147. package/fesm2022/dialog.mjs +15 -2
  148. package/fesm2022/dialog.mjs.map +1 -1
  149. package/fesm2022/form-field.mjs +2 -2
  150. package/fesm2022/form-field.mjs.map +1 -1
  151. package/fesm2022/menu.mjs +23 -31
  152. package/fesm2022/menu.mjs.map +1 -1
  153. package/fesm2022/paginator.mjs +1 -1
  154. package/fesm2022/paginator.mjs.map +1 -1
  155. package/fesm2022/select.mjs +2 -2
  156. package/fesm2022/select.mjs.map +1 -1
  157. package/fesm2022/slide-toggle.mjs +33 -36
  158. package/fesm2022/slide-toggle.mjs.map +1 -1
  159. package/fesm2022/slider.mjs +20 -10
  160. package/fesm2022/slider.mjs.map +1 -1
  161. package/fesm2022/snack-bar.mjs +1 -1
  162. package/fesm2022/snack-bar.mjs.map +1 -1
  163. package/fesm2022/tabs.mjs +2 -2
  164. package/fesm2022/tabs.mjs.map +1 -1
  165. package/form-field/_form-field-density.scss +3 -4
  166. package/form-field/_form-field-focus-overlay.scss +1 -1
  167. package/form-field/_form-field-sizing.scss +1 -1
  168. package/form-field/_form-field-theme.scss +24 -34
  169. package/grid-list/_grid-list-theme.scss +12 -19
  170. package/icon/_icon-theme.scss +17 -25
  171. package/input/_input-theme.scss +11 -23
  172. package/list/_list-theme.scss +27 -42
  173. package/menu/_menu-theme.scss +13 -22
  174. package/menu/index.d.ts +12 -18
  175. package/package.json +2 -2
  176. package/paginator/_paginator-theme.scss +15 -24
  177. package/prebuilt-themes/deeppurple-amber.css +1 -1
  178. package/prebuilt-themes/indigo-pink.css +1 -1
  179. package/prebuilt-themes/pink-bluegrey.css +1 -1
  180. package/prebuilt-themes/purple-green.css +1 -1
  181. package/progress-bar/_progress-bar-theme.scss +17 -24
  182. package/progress-spinner/_progress-spinner-theme.scss +18 -24
  183. package/radio/_radio-theme.scss +23 -38
  184. package/schematics/ng-add/index.js +1 -1
  185. package/schematics/ng-add/index.mjs +1 -1
  186. package/schematics/ng-generate/mdc-migration/index_bundled.js +44 -44
  187. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +1 -1
  188. package/schematics/ng-update/index_bundled.js +25 -25
  189. package/select/_select-theme.scss +17 -31
  190. package/sidenav/_sidenav-theme.scss +12 -18
  191. package/slide-toggle/_slide-toggle-theme.scss +23 -40
  192. package/slide-toggle/index.d.ts +20 -23
  193. package/slider/_slider-theme.scss +25 -42
  194. package/snack-bar/_snack-bar-theme.scss +17 -26
  195. package/sort/_sort-theme.scss +13 -22
  196. package/stepper/_stepper-theme.scss +16 -34
  197. package/table/_table-theme.scss +14 -25
  198. package/tabs/_tabs-theme.scss +31 -45
  199. package/toolbar/_toolbar-theme.scss +22 -31
  200. package/tooltip/_tooltip-theme.scss +15 -23
  201. package/tree/_tree-theme.scss +20 -29
  202. package/button-toggle/_button-toggle-variables.scss +0 -16
  203. package/core/typography/_typography-deprecated.scss +0 -39
  204. package/paginator/_paginator-variables.scss +0 -15
@@ -1,355 +1,18 @@
1
- @use 'sass:map';
2
- @use 'sass:math';
3
- @use 'sass:meta';
4
1
  @use 'typography-utils';
5
- @use '../theming/theming';
6
- @use '@material/typography' as mdc-typography;
2
+ @use '../theming/inspection';
3
+ @use './versioning';
7
4
 
8
- /// Defines a typography level from the Material Design spec.
9
- /// @param {String} $font-size The font-size for this level.
10
- /// @param {String | Number} $line-height The line-height for this level.
11
- /// @param {String | Number} $font-weight The font-weight for this level.
12
- /// @param {String} $font-family The font-family for this level.
13
- /// @param {String} $letter-spacing The letter-spacing for this level.
14
- /// @returns {Map} A map representing the definition of this typographic level.
15
- @function define-typography-level(
16
- $font-size,
17
- $line-height: $font-size,
18
- $font-weight: 400,
19
- $font-family: null,
20
- $letter-spacing: normal) {
21
-
22
- @return (
23
- font-size: $font-size,
24
- line-height: $line-height,
25
- font-weight: $font-weight,
26
- font-family: $font-family,
27
- letter-spacing: $letter-spacing
28
- );
29
- }
30
-
31
- /// Defines a collection of typography levels to configure typography for an application.
32
- /// Any level not specified defaults to the values defined in the Material Design specification:
33
- /// https://material.io/guidelines/style/typography.html.
34
- ///
35
- /// Note that the Material Design specification does not describe explicit letter-spacing values.
36
- /// The values here come from reverse engineering the Material Design examples.
37
- /// @param {String} $font-family Default font-family for levels that don't specify font-family.
38
- /// @param {Map} $display-4 Configuration for the "display-4" typographic level.
39
- /// @param {Map} $display-3 Configuration for the "display-3" typographic level.
40
- /// @param {Map} $display-2 Configuration for the "display-2" typographic level.
41
- /// @param {Map} $display-1 Configuration for the "display-1" typographic level.
42
- /// @param {Map} $headline Configuration for the "headline" typographic level.
43
- /// @param {Map} $title Configuration for the "title" typographic level.
44
- /// @param {Map} $subheading-2 Configuration for the "subheading-2" typographic level.
45
- /// @param {Map} $subheading-1 Configuration for the "subheading-1" typographic level.
46
- /// @param {Map} $body-2 Configuration for the "body-2" typographic level.
47
- /// @param {Map} $body-1 Configuration for the "body-1" typographic level.
48
- /// @param {Map} $caption Configuration for the "caption" typographic level.
49
- /// @param {Map} $button Configuration for the "button" typographic level.
50
- /// @param {Map} $input Configuration for the "input" typographic level.
51
- /// @returns {Map} A typography config for the application.
52
- ///
53
- /// @deprecated Use `mat.define-typography-config` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
54
- /// @breaking-change 17.0.0
55
- @function define-legacy-typography-config(
56
- $font-family: 'Roboto, "Helvetica Neue", sans-serif',
57
- $display-4: define-typography-level(112px, 112px, 300, $letter-spacing: -0.05em),
58
- $display-3: define-typography-level(56px, 56px, 400, $letter-spacing: -0.02em),
59
- $display-2: define-typography-level(45px, 48px, 400, $letter-spacing: -0.005em),
60
- $display-1: define-typography-level(34px, 40px, 400),
61
- $headline: define-typography-level(24px, 32px, 400),
62
- $title: define-typography-level(20px, 32px, 500),
63
- $subheading-2: define-typography-level(16px, 28px, 400),
64
- $subheading-1: define-typography-level(15px, 24px, 400),
65
- $body-2: define-typography-level(14px, 24px, 500),
66
- $body-1: define-typography-level(14px, 20px, 400),
67
- $caption: define-typography-level(12px, 20px, 400),
68
- $button: define-typography-level(14px, 14px, 500),
69
- // Line-height must be unit-less fraction of the font-size.
70
- $input: define-typography-level(inherit, 1.125, 400)
71
- ) {
72
-
73
- // Declare an initial map with all of the levels.
74
- $config: (
75
- display-4: $display-4,
76
- display-3: $display-3,
77
- display-2: $display-2,
78
- display-1: $display-1,
79
- headline: $headline,
80
- title: $title,
81
- subheading-2: $subheading-2,
82
- subheading-1: $subheading-1,
83
- body-2: $body-2,
84
- body-1: $body-1,
85
- caption: $caption,
86
- button: $button,
87
- input: $input,
88
- );
89
-
90
- // Loop through the levels and set the `font-family` of the ones that don't have one to the base.
91
- // Note that Sass can't modify maps in place, which means that we need to merge and re-assign.
92
- @each $key, $level in $config {
93
- @if map.get($level, font-family) == null {
94
- $new-level: map.merge($level, (font-family: $font-family));
95
- $config: map.merge($config, ($key: $new-level));
96
- }
97
- }
98
-
99
- // Add the base font family to the config.
100
- @return map.merge($config, (font-family: $font-family));
101
- }
102
-
103
- // Converts a map containing rem values to a map containing px values.
104
- @function _rem-to-px($x, $px-per-rem: 16px) {
105
- @if meta.type-of($x) == 'map' {
106
- @each $key, $val in $x {
107
- $x: map.merge($x, ($key: _rem-to-px($val)));
108
- }
109
- @return $x;
110
- }
111
- @if meta.type-of($x) == 'number' and math.unit($x) == 'rem' {
112
- @return math.div($x, 1rem) * $px-per-rem;
113
- }
114
- @else {
115
- @return $x;
116
- }
117
- }
118
-
119
- // Applies the default font family to all levels in a typography config.
120
- @function _apply-font-family($font-family, $initial-config) {
121
- $config: $initial-config;
122
-
123
- @each $key, $level in $config {
124
- @if map.get($level, 'font-family') == null {
125
- // Sass maps are immutable so we have to re-assign the variable each time.
126
- $config: map.set($config, $key, map.set($level, 'font-family', $font-family));
127
- }
128
- }
129
-
130
- @return map.set($config, 'font-family', $font-family);
131
- }
132
-
133
- // Converts an MDC typography level config to an Angular Material one.
134
- @function typography-config-level-from-mdc($mdc-level, $font-family: null) {
135
- $mdc-level-config: map.get(mdc-typography.$styles, $mdc-level);
136
-
137
- // Explicitly default the font family to null since we'll apply it globally
138
- // through the `define-typgraphy-config`/`define-legacy-typography-config`.
139
- @return define-typography-level(
140
- $font-family: $font-family,
141
- $font-size: map.get($mdc-level-config, font-size),
142
- $line-height: map.get($mdc-level-config, line-height),
143
- $font-weight: map.get($mdc-level-config, font-weight),
144
- $letter-spacing: map.get($mdc-level-config, letter-spacing)
145
- );
146
- }
147
-
148
- /// Generates an Angular Material typography config based on values from the official Material
149
- /// Design spec implementation (MDC Web). All arguments are optional, but may be passed to override
150
- /// the default values. The `mat-typography-level` function can be used to generate a custom
151
- /// typography level map which can be passed to this function to override one of the default levels.
152
- /// All default typography sizing generated by this function is in `px` units.
153
- ///
154
- /// @param {String} $font-family The font family to use for levels where it is not explicitly
155
- /// specified.
156
- /// @param {Map} $headline-1 The font settings for the headline-1 font level.
157
- /// @param {Map} $headline-2 The font settings for the headline-2 font level.
158
- /// @param {Map} $headline-3 The font settings for the headline-3 font level.
159
- /// @param {Map} $headline-4 The font settings for the headline-4 font level.
160
- /// @param {Map} $headline-5 The font settings for the headline-5 font level.
161
- /// @param {Map} $headline-6 The font settings for the headline-6 font level.
162
- /// @param {Map} $subtitle-1 The font settings for the subtitle-1 font level.
163
- /// @param {Map} $subtitle-2 The font settings for the subtitle-2 font level.
164
- /// @param {Map} $body-1 The font settings for the body-1 font level.
165
- /// @param {Map} $body-2 The font settings for the body-2 font level.
166
- /// @param {Map} $caption The font settings for the caption font level.
167
- /// @param {Map} $button The font settings for the button font level.
168
- /// @param {Map} $overline The font settings for the overline font level.
169
- /// @return {Map} A map containing font settings for each of the levels in the Material Design spec.
170
- @function define-typography-config(
171
- // TODO(mmalerba): rename this function to define-typography-config,
172
- // and create a predefined px based config for people that need it.
173
- $font-family: mdc-typography.$font-family,
174
- $headline-1: null,
175
- $headline-2: null,
176
- $headline-3: null,
177
- $headline-4: null,
178
- $headline-5: null,
179
- $headline-6: null,
180
- $subtitle-1: null,
181
- $subtitle-2: null,
182
- $body-1: null,
183
- $body-2: null,
184
- $caption: null,
185
- $button: null,
186
- $overline: null,
187
- ) {
188
- @return _apply-font-family($font-family, (
189
- headline-1: $headline-1 or _rem-to-px(typography-config-level-from-mdc(headline1)),
190
- headline-2: $headline-2 or _rem-to-px(typography-config-level-from-mdc(headline2)),
191
- headline-3: $headline-3 or _rem-to-px(typography-config-level-from-mdc(headline3)),
192
- headline-4: $headline-4 or _rem-to-px(typography-config-level-from-mdc(headline4)),
193
- headline-5: $headline-5 or _rem-to-px(typography-config-level-from-mdc(headline5)),
194
- headline-6: $headline-6 or _rem-to-px(typography-config-level-from-mdc(headline6)),
195
- subtitle-1: $subtitle-1 or _rem-to-px(typography-config-level-from-mdc(subtitle1)),
196
- subtitle-2: $subtitle-2 or _rem-to-px(typography-config-level-from-mdc(subtitle2)),
197
- body-1: $body-1 or _rem-to-px(typography-config-level-from-mdc(body1)),
198
- body-2: $body-2 or _rem-to-px(typography-config-level-from-mdc(body2)),
199
- caption: $caption or _rem-to-px(typography-config-level-from-mdc(caption)),
200
- button: $button or _rem-to-px(typography-config-level-from-mdc(button)),
201
- overline: $overline or _rem-to-px(typography-config-level-from-mdc(overline)),
202
- ));
203
- }
204
-
205
- /// Generates an Angular Material typography config based on values from the official Material
206
- /// Design spec implementation (MDC Web). All arguments are optional, but may be passed to override
207
- /// the default values. The `mat-typography-level` function can be used to generate a custom
208
- /// typography level map which can be passed to this function to override one of the default levels.
209
- /// All default typography sizing generated by this function is in `rem` units.
210
- ///
211
- /// @param {String} $font-family The font family to use for levels where it is not explicitly
212
- /// specified.
213
- /// @param {Map} $headline-1 The font settings for the headline-1 font level.
214
- /// @param {Map} $headline-2 The font settings for the headline-2 font level.
215
- /// @param {Map} $headline-3 The font settings for the headline-3 font level.
216
- /// @param {Map} $headline-4 The font settings for the headline-4 font level.
217
- /// @param {Map} $headline-5 The font settings for the headline-5 font level.
218
- /// @param {Map} $headline-6 The font settings for the headline-6 font level.
219
- /// @param {Map} $subtitle-1 The font settings for the subtitle-1 font level.
220
- /// @param {Map} $subtitle-2 The font settings for the subtitle-2 font level.
221
- /// @param {Map} $body-1 The font settings for the body-1 font level.
222
- /// @param {Map} $body-2 The font settings for the body-2 font level.
223
- /// @param {Map} $caption The font settings for the caption font level.
224
- /// @param {Map} $button The font settings for the button font level.
225
- /// @param {Map} $overline The font settings for the overline font level.
226
- /// @return {Map} A map containing font settings for each of the levels in the Material Design spec.
227
- @function define-rem-typography-config(
228
- // TODO(mmalerba): rename this function to define-typography-config,
229
- // and create a predefined px based config for people that need it.
230
- $font-family: mdc-typography.$font-family,
231
- $headline-1: null,
232
- $headline-2: null,
233
- $headline-3: null,
234
- $headline-4: null,
235
- $headline-5: null,
236
- $headline-6: null,
237
- $subtitle-1: null,
238
- $subtitle-2: null,
239
- $body-1: null,
240
- $body-2: null,
241
- $caption: null,
242
- $button: null,
243
- $overline: null,
244
- ) {
245
- @return _apply-font-family($font-family, (
246
- headline-1: $headline-1 or typography-config-level-from-mdc(headline1),
247
- headline-2: $headline-2 or typography-config-level-from-mdc(headline2),
248
- headline-3: $headline-3 or typography-config-level-from-mdc(headline3),
249
- headline-4: $headline-4 or typography-config-level-from-mdc(headline4),
250
- headline-5: $headline-5 or typography-config-level-from-mdc(headline5),
251
- headline-6: $headline-6 or typography-config-level-from-mdc(headline6),
252
- subtitle-1: $subtitle-1 or typography-config-level-from-mdc(subtitle1),
253
- subtitle-2: $subtitle-2 or typography-config-level-from-mdc(subtitle2),
254
- body-1: $body-1 or typography-config-level-from-mdc(body1),
255
- body-2: $body-2 or typography-config-level-from-mdc(body2),
256
- caption: $caption or typography-config-level-from-mdc(caption),
257
- button: $button or typography-config-level-from-mdc(button),
258
- overline: $overline or typography-config-level-from-mdc(overline),
259
- ));
260
- }
261
-
262
- // Whether a config is for the Material Design 2018 typography system.
263
- @function private-typography-is-2018-config($config) {
264
- @return map.get($config, headline-1) != null;
265
- }
266
-
267
- // Whether a config is for the Material Design 2014 typography system.
268
- @function private-typography-is-2014-config($config) {
269
- @return map.get($config, headline) != null;
270
- }
271
-
272
- // Given a config for either the 2014 or 2018 Material Design typography system,
273
- // produces a normalized typography config for the 2014 Material Design typography system.
274
- // 2014 - https://material.io/archive/guidelines/style/typography.html#typography-styles
275
- // 2018 - https://material.io/design/typography/the-type-system.html#type-scale
276
- //
277
- // Components using this function should be migrated to normalize to the 2018 style config instead.
278
- // New components should not use this function.
279
- @function private-typography-to-2014-config($config) {
280
- @if $config == null {
281
- @return null;
282
- }
283
- @if not private-typography-is-2014-config($config) {
284
- $args: (
285
- display-4: map.get($config, headline-1),
286
- display-3: map.get($config, headline-2),
287
- display-2: map.get($config, headline-3),
288
- display-1: map.get($config, headline-4),
289
- headline: map.get($config, headline-5),
290
- title: map.get($config, headline-6),
291
- subheading-2: map.get($config, subtitle-1),
292
- subheading-1: map.get($config, subtitle-2),
293
- body-2: map.get($config, body-1),
294
- body-1: map.get($config, body-2),
295
- button: map.get($config, button),
296
- caption: map.get($config, caption),
297
- font-family: map.get($config, font-family),
298
- );
299
- $non-null-args: ();
300
- @each $key, $value in $args {
301
- @if $value != null {
302
- $non-null-args: map.merge($non-null-args, ($key: $value));
303
- }
304
- }
305
- @return define-legacy-typography-config($non-null-args...);
306
- }
307
- @return $config;
308
- }
309
-
310
- // Given a config for either the 2014 or 2018 Material Design typography system,
311
- // produces a normalized typography config for the 2018 Material Design typography system.
312
- // 2014 - https://material.io/archive/guidelines/style/typography.html#typography-styles
313
- // 2018 - https://material.io/design/typography/the-type-system.html#type-scale
314
- @function private-typography-to-2018-config($config) {
315
- @if $config == null {
316
- @return null;
317
- }
318
- @if not private-typography-is-2018-config($config) {
319
- @return (
320
- headline-1: map.get($config, display-4),
321
- headline-2: map.get($config, display-3),
322
- headline-3: map.get($config, display-2),
323
- headline-4: map.get($config, display-1),
324
- headline-5: map.get($config, headline),
325
- headline-6: map.get($config, title),
326
- subtitle-1: map.get($config, subheading-2),
327
- font-famiy: map.get($config, font-family),
328
-
329
- // These mappings are odd, but body-2 in the 2014 system actually looks closer to subtitle-2
330
- // in the 2018 system, and subeading-1 in the 2014 system looks more like body-1 in the 2018
331
- // system.
332
- subtitle-2: map.get($config, body-2),
333
- body-1: map.get($config, subheading-1),
334
-
335
- body-2: map.get($config, body-1),
336
- button: map.get($config, button),
337
- caption: map.get($config, caption),
338
- overline: if(map.get($config, overline), map.get($config, overline),
339
- define-typography-level(12px, 32px, 500)
340
- )
341
- );
342
- }
343
- @return $config;
344
- }
5
+ // Definition and versioning functions live in their own files to avoid circular dependencies, but
6
+ // we re-export them here so that historical imports from this file continue to work without needing
7
+ // to be updated.
8
+ @forward './definition';
9
+ @forward './versioning';
345
10
 
346
11
  /// Emits baseline typographic styles based on a given config.
347
12
  /// @param {Map} $config-or-theme A typography config for an entire theme.
348
13
  /// @param {String} $selector Ancestor selector under which native elements, such as h1, will
349
14
  /// be styled.
350
- @mixin typography-hierarchy($config-or-theme, $selector: '.mat-typography') {
351
- $config: private-typography-to-2018-config(theming.get-typography-config($config-or-theme));
352
-
15
+ @mixin typography-hierarchy($theme, $selector: '.mat-typography') {
353
16
  // Note that it seems redundant to prefix the class rules with the `$selector`, however it's
354
17
  // necessary if we want to allow people to overwrite the tag selectors. This is due to
355
18
  // selectors like `#{$selector} h1` being more specific than ones like `.mat-title`.
@@ -358,7 +21,8 @@
358
21
  #{$selector} .mat-h1,
359
22
  #{$selector} .mat-headline-5,
360
23
  #{$selector} h1 {
361
- @include typography-utils.typography-level($config, headline-5);
24
+ font: inspection.get-theme-typography($theme, headline-5, font);
25
+ letter-spacing: inspection.get-theme-typography($theme, headline-5, letter-spacing);
362
26
  margin: 0 0 16px;
363
27
  }
364
28
 
@@ -367,7 +31,8 @@
367
31
  #{$selector} .mat-h2,
368
32
  #{$selector} .mat-headline-6,
369
33
  #{$selector} h2 {
370
- @include typography-utils.typography-level($config, headline-6);
34
+ font: inspection.get-theme-typography($theme, headline-6, font);
35
+ letter-spacing: inspection.get-theme-typography($theme, headline-6, letter-spacing);
371
36
  margin: 0 0 16px;
372
37
  }
373
38
 
@@ -376,7 +41,8 @@
376
41
  #{$selector} .mat-h3,
377
42
  #{$selector} .mat-subtitle-1,
378
43
  #{$selector} h3 {
379
- @include typography-utils.typography-level($config, subtitle-1);
44
+ font: inspection.get-theme-typography($theme, subtitle-1, font);
45
+ letter-spacing: inspection.get-theme-typography($theme, subtitle-1, letter-spacing);
380
46
  margin: 0 0 16px;
381
47
  }
382
48
 
@@ -385,7 +51,8 @@
385
51
  #{$selector} .mat-h4,
386
52
  #{$selector} .mat-body-1,
387
53
  #{$selector} h4 {
388
- @include typography-utils.typography-level($config, body-1);
54
+ font: inspection.get-theme-typography($theme, body-1, font);
55
+ letter-spacing: inspection.get-theme-typography($theme, body-1, letter-spacing);
389
56
  margin: 0 0 16px;
390
57
  }
391
58
 
@@ -397,10 +64,10 @@
397
64
  #{$selector} h5 {
398
65
  @include typography-utils.font-shorthand(
399
66
  // calc is used here to support css variables
400
- calc(#{typography-utils.font-size($config, body-2)} * 0.83),
401
- typography-utils.font-weight($config, body-2),
402
- typography-utils.line-height($config, body-2),
403
- typography-utils.font-family($config, body-2)
67
+ calc(#{inspection.get-theme-typography($theme, body-2, font-size)} * 0.83),
68
+ inspection.get-theme-typography($theme, body-2, font-weight),
69
+ inspection.get-theme-typography($theme, body-2, line-height),
70
+ inspection.get-theme-typography($theme, body-2, font-family)
404
71
  );
405
72
 
406
73
  margin: 0 0 12px;
@@ -411,10 +78,10 @@
411
78
  #{$selector} h6 {
412
79
  @include typography-utils.font-shorthand(
413
80
  // calc is used here to support css variables
414
- calc(#{typography-utils.font-size($config, body-2)} * 0.67),
415
- typography-utils.font-weight($config, body-2),
416
- typography-utils.line-height($config, body-2),
417
- typography-utils.font-family($config, body-2)
81
+ calc(#{inspection.get-theme-typography($theme, body-2, font-size)} * 0.67),
82
+ inspection.get-theme-typography($theme, body-2, font-weight),
83
+ inspection.get-theme-typography($theme, body-2, line-height),
84
+ inspection.get-theme-typography($theme, body-2, font-family)
418
85
  );
419
86
 
420
87
  margin: 0 0 12px;
@@ -424,7 +91,8 @@
424
91
  .mat-subtitle-2,
425
92
  #{$selector} .mat-body-strong,
426
93
  #{$selector} .mat-subtitle-2 {
427
- @include typography-utils.typography-level($config, subtitle-2);
94
+ font: inspection.get-theme-typography($theme, subtitle-2, font);
95
+ letter-spacing: inspection.get-theme-typography($theme, subtitle-2, letter-spacing);
428
96
  }
429
97
 
430
98
  .mat-body,
@@ -432,7 +100,8 @@
432
100
  #{$selector} .mat-body,
433
101
  #{$selector} .mat-body-2,
434
102
  #{$selector} {
435
- @include typography-utils.typography-level($config, body-2);
103
+ font: inspection.get-theme-typography($theme, body-2, font);
104
+ letter-spacing: inspection.get-theme-typography($theme, body-2, letter-spacing);
436
105
 
437
106
  p {
438
107
  margin: 0 0 12px;
@@ -443,160 +112,35 @@
443
112
  .mat-caption,
444
113
  #{$selector} .mat-small,
445
114
  #{$selector} .mat-caption {
446
- @include typography-utils.typography-level($config, caption);
115
+ font: inspection.get-theme-typography($theme, caption, font);
116
+ letter-spacing: inspection.get-theme-typography($theme, caption, letter-spacing);
447
117
  }
448
118
 
449
119
  .mat-headline-1,
450
120
  #{$selector} .mat-headline-1 {
451
- @include typography-utils.typography-level($config, headline-1);
121
+ font: inspection.get-theme-typography($theme, headline-1, font);
122
+ letter-spacing: inspection.get-theme-typography($theme, headline-1, letter-spacing);
452
123
  margin: 0 0 56px;
453
124
  }
454
125
 
455
126
  .mat-headline-2,
456
127
  #{$selector} .mat-headline-2 {
457
- @include typography-utils.typography-level($config, headline-2);
128
+ font: inspection.get-theme-typography($theme, headline-2, font);
129
+ letter-spacing: inspection.get-theme-typography($theme, headline-2, letter-spacing);
458
130
  margin: 0 0 64px;
459
131
  }
460
132
 
461
133
  .mat-headline-3,
462
134
  #{$selector} .mat-headline-3 {
463
- @include typography-utils.typography-level($config, headline-3);
135
+ font: inspection.get-theme-typography($theme, headline-3, font);
136
+ letter-spacing: inspection.get-theme-typography($theme, headline-3, letter-spacing);
464
137
  margin: 0 0 64px;
465
138
  }
466
139
 
467
140
  .mat-headline-4,
468
141
  #{$selector} .mat-headline-4 {
469
- @include typography-utils.typography-level($config, headline-4);
470
- margin: 0 0 64px;
471
- }
472
- }
473
-
474
- /// Emits baseline typographic styles based on a given config.
475
- /// @param {Map} $config-or-theme A typography config for an entire theme.
476
- /// @param {String} $selector Ancestor selector under which native elements, such as h1, will
477
- /// be styled.
478
- /// @deprecated Use `mat.typography-hierarchy` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
479
- /// @breaking-change 17.0.0
480
- @mixin legacy-typography-hierarchy($config-or-theme, $selector: '.mat-typography') {
481
- $config: private-typography-to-2014-config(theming.get-typography-config($config-or-theme));
482
-
483
- // Note that it seems redundant to prefix the class rules with the `$selector`, however it's
484
- // necessary if we want to allow people to overwrite the tag selectors. This is due to
485
- // selectors like `#{$selector} h1` being more specific than ones like `.mat-title`.
486
- .mat-h1,
487
- .mat-headline,
488
- #{$selector} .mat-h1,
489
- #{$selector} .mat-headline,
490
- #{$selector} h1 {
491
- @include typography-utils.typography-level($config, headline);
492
- margin: 0 0 16px;
493
- }
494
-
495
- .mat-h2,
496
- .mat-title,
497
- #{$selector} .mat-h2,
498
- #{$selector} .mat-title,
499
- #{$selector} h2 {
500
- @include typography-utils.typography-level($config, title);
501
- margin: 0 0 16px;
502
- }
503
-
504
- .mat-h3,
505
- .mat-subheading-2,
506
- #{$selector} .mat-h3,
507
- #{$selector} .mat-subheading-2,
508
- #{$selector} h3 {
509
- @include typography-utils.typography-level($config, subheading-2);
510
- margin: 0 0 16px;
511
- }
512
-
513
- .mat-h4,
514
- .mat-subheading-1,
515
- #{$selector} .mat-h4,
516
- #{$selector} .mat-subheading-1,
517
- #{$selector} h4 {
518
- @include typography-utils.typography-level($config, subheading-1);
519
- margin: 0 0 16px;
520
- }
521
-
522
- // Note: the spec doesn't have anything that would correspond to h5 and h6, but we add these for
523
- // consistency. The font sizes come from the Chrome user agent styles which have h5 at 0.83em
524
- // and h6 at 0.67em.
525
- .mat-h5,
526
- #{$selector} .mat-h5,
527
- #{$selector} h5 {
528
- @include typography-utils.font-shorthand(
529
- // calc is used here to support css variables
530
- calc(#{typography-utils.font-size($config, body-1)} * 0.83),
531
- typography-utils.font-weight($config, body-1),
532
- typography-utils.line-height($config, body-1),
533
- typography-utils.font-family($config, body-1)
534
- );
535
-
536
- margin: 0 0 12px;
537
- }
538
-
539
- .mat-h6,
540
- #{$selector} .mat-h6,
541
- #{$selector} h6 {
542
- @include typography-utils.font-shorthand(
543
- // calc is used here to support css variables
544
- calc(#{typography-utils.font-size($config, body-1)} * 0.67),
545
- typography-utils.font-weight($config, body-1),
546
- typography-utils.line-height($config, body-1),
547
- typography-utils.font-family($config, body-1)
548
- );
549
-
550
- margin: 0 0 12px;
551
- }
552
-
553
- .mat-body-strong,
554
- .mat-body-2,
555
- #{$selector} .mat-body-strong,
556
- #{$selector} .mat-body-2 {
557
- @include typography-utils.typography-level($config, body-2);
558
- }
559
-
560
- .mat-body,
561
- .mat-body-1,
562
- #{$selector} .mat-body,
563
- #{$selector} .mat-body-1,
564
- #{$selector} {
565
- @include typography-utils.typography-level($config, body-1);
566
-
567
- p {
568
- margin: 0 0 12px;
569
- }
570
- }
571
-
572
- .mat-small,
573
- .mat-caption,
574
- #{$selector} .mat-small,
575
- #{$selector} .mat-caption {
576
- @include typography-utils.typography-level($config, caption);
577
- }
578
-
579
- .mat-display-4,
580
- #{$selector} .mat-display-4 {
581
- @include typography-utils.typography-level($config, display-4);
582
- margin: 0 0 56px;
583
- }
584
-
585
- .mat-display-3,
586
- #{$selector} .mat-display-3 {
587
- @include typography-utils.typography-level($config, display-3);
588
- margin: 0 0 64px;
589
- }
590
-
591
- .mat-display-2,
592
- #{$selector} .mat-display-2 {
593
- @include typography-utils.typography-level($config, display-2);
594
- margin: 0 0 64px;
595
- }
596
-
597
- .mat-display-1,
598
- #{$selector} .mat-display-1 {
599
- @include typography-utils.typography-level($config, display-1);
142
+ font: inspection.get-theme-typography($theme, headline-4, font);
143
+ letter-spacing: inspection.get-theme-typography($theme, headline-4, letter-spacing);
600
144
  margin: 0 0 64px;
601
145
  }
602
146
  }