@angular/material 20.1.0-next.1 → 20.1.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 (227) hide show
  1. package/_index.scss +1 -2
  2. package/autocomplete/_autocomplete-theme.scss +28 -37
  3. package/badge/_badge-theme.scss +35 -44
  4. package/badge/_m2-badge.scss +3 -2
  5. package/bottom-sheet/_bottom-sheet-theme.scss +28 -40
  6. package/bottom-sheet/_m2-bottom-sheet.scss +6 -9
  7. package/button/_button-theme.scss +37 -55
  8. package/button/_fab-theme.scss +42 -56
  9. package/button/_icon-button-theme.scss +30 -48
  10. package/button/_m2-button.scss +21 -25
  11. package/button/_m2-fab.scss +5 -5
  12. package/button/testing/index.d.ts +1 -0
  13. package/button-toggle/_button-toggle-theme.scss +29 -44
  14. package/button-toggle/_m2-button-toggle.scss +11 -17
  15. package/card/_card-theme.scss +28 -36
  16. package/card/_m2-card.scss +11 -13
  17. package/checkbox/_checkbox-theme.scss +35 -50
  18. package/checkbox/_m2-checkbox.scss +6 -5
  19. package/chips/_chips-theme.scss +24 -30
  20. package/chips/_m2-chip.scss +6 -5
  21. package/core/_core-theme.scss +48 -67
  22. package/core/focus-indicators/_private.scss +2 -5
  23. package/core/m2/_theming.scss +32 -41
  24. package/core/option/_m2-optgroup.scss +6 -6
  25. package/core/option/_m2-option.scss +6 -5
  26. package/core/option/_optgroup-theme.scss +28 -30
  27. package/core/option/_option-theme.scss +35 -34
  28. package/core/ripple/_ripple-theme.scss +28 -33
  29. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +55 -45
  30. package/core/theming/_all-theme.scss +38 -42
  31. package/core/theming/_definition.scss +20 -13
  32. package/core/theming/_inspection.scss +0 -12
  33. package/core/theming/_m2-inspection.scss +0 -33
  34. package/core/theming/_theming.scss +4 -172
  35. package/core/tokens/_m2-utils.scss +5 -65
  36. package/core/tokens/_m3-utils.scss +2 -14
  37. package/core/tokens/_token-utils.scss +7 -27
  38. package/core/tokens/m2/_index.scss +6 -0
  39. package/core/tokens/m2/_md-sys-color.scss +123 -0
  40. package/core/tokens/m2/_md-sys-elevation.scss +16 -0
  41. package/core/tokens/m2/_md-sys-motion.scss +36 -0
  42. package/core/tokens/m2/_md-sys-shape.scss +22 -0
  43. package/core/tokens/m2/_md-sys-state.scss +15 -0
  44. package/core/tokens/m2/_md-sys-typescale.scss +68 -0
  45. package/core/tokens/m3/_md-sys-color.scss +2 -2
  46. package/core/tokens/m3/_md-sys-typescale.scss +1 -1
  47. package/core/tokens/m3/_theme.scss +14 -26
  48. package/datepicker/_datepicker-theme.scss +38 -40
  49. package/datepicker/_m2-datepicker.scss +7 -14
  50. package/dialog/_dialog-theme.scss +28 -34
  51. package/dialog/_m2-dialog.scss +11 -13
  52. package/divider/_divider-theme.scss +28 -30
  53. package/expansion/_expansion-theme.scss +28 -39
  54. package/expansion/_m2-expansion.scss +11 -10
  55. package/expansion/_m3-expansion.scss +2 -0
  56. package/fesm2022/animation-DfMFjxHu.mjs.map +1 -1
  57. package/fesm2022/autocomplete/testing.mjs.map +1 -1
  58. package/fesm2022/autocomplete.mjs +1 -1
  59. package/fesm2022/autocomplete.mjs.map +1 -1
  60. package/fesm2022/badge/testing.mjs.map +1 -1
  61. package/fesm2022/badge.mjs.map +1 -1
  62. package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
  63. package/fesm2022/bottom-sheet.mjs.map +1 -1
  64. package/fesm2022/button/testing.mjs +7 -4
  65. package/fesm2022/button/testing.mjs.map +1 -1
  66. package/fesm2022/button-toggle/testing.mjs.map +1 -1
  67. package/fesm2022/button-toggle.mjs.map +1 -1
  68. package/fesm2022/button.mjs.map +1 -1
  69. package/fesm2022/card/testing.mjs.map +1 -1
  70. package/fesm2022/card.mjs.map +1 -1
  71. package/fesm2022/checkbox/testing.mjs.map +1 -1
  72. package/fesm2022/checkbox.mjs.map +1 -1
  73. package/fesm2022/chips/testing.mjs.map +1 -1
  74. package/fesm2022/chips.mjs +1 -1
  75. package/fesm2022/chips.mjs.map +1 -1
  76. package/fesm2022/common-module-cKSwHniA.mjs.map +1 -1
  77. package/fesm2022/core/testing.mjs.map +1 -1
  78. package/fesm2022/core.mjs +1 -1
  79. package/fesm2022/core.mjs.map +1 -1
  80. package/fesm2022/date-formats-K6TQue-Y.mjs.map +1 -1
  81. package/fesm2022/date-range-input-harness-DEyfkeOs.mjs.map +1 -1
  82. package/fesm2022/datepicker/testing.mjs.map +1 -1
  83. package/fesm2022/datepicker.mjs +1 -1
  84. package/fesm2022/datepicker.mjs.map +1 -1
  85. package/fesm2022/dialog/testing.mjs.map +1 -1
  86. package/fesm2022/dialog.mjs.map +1 -1
  87. package/fesm2022/divider/testing.mjs.map +1 -1
  88. package/fesm2022/divider.mjs.map +1 -1
  89. package/fesm2022/error-options-DCNQlTOA.mjs.map +1 -1
  90. package/fesm2022/error-state-Dtb1IHM-.mjs.map +1 -1
  91. package/fesm2022/expansion/testing.mjs.map +1 -1
  92. package/fesm2022/expansion.mjs +2 -2
  93. package/fesm2022/expansion.mjs.map +1 -1
  94. package/fesm2022/form-field/testing/control.mjs.map +1 -1
  95. package/fesm2022/form-field/testing.mjs.map +1 -1
  96. package/fesm2022/{form-field-C9DZXojn.mjs → form-field-CFbrnFED.mjs} +3 -3
  97. package/fesm2022/form-field-CFbrnFED.mjs.map +1 -0
  98. package/fesm2022/form-field.mjs +2 -2
  99. package/fesm2022/form-field.mjs.map +1 -1
  100. package/fesm2022/grid-list/testing.mjs.map +1 -1
  101. package/fesm2022/grid-list.mjs.map +1 -1
  102. package/fesm2022/icon/testing.mjs.map +1 -1
  103. package/fesm2022/icon-button-DxiIc1ex.mjs.map +1 -1
  104. package/fesm2022/icon-registry-CwOTJ7YM.mjs.map +1 -1
  105. package/fesm2022/icon.mjs.map +1 -1
  106. package/fesm2022/index-BFRo2fUq.mjs.map +1 -1
  107. package/fesm2022/index-DwiL-HGk.mjs.map +1 -1
  108. package/fesm2022/input/testing.mjs.map +1 -1
  109. package/fesm2022/input-harness-C5Msdc4-.mjs.map +1 -1
  110. package/fesm2022/input-value-accessor-D1GvPuqO.mjs.map +1 -1
  111. package/fesm2022/input.mjs +3 -27
  112. package/fesm2022/input.mjs.map +1 -1
  113. package/fesm2022/internal-form-field-D5iFxU6d.mjs.map +1 -1
  114. package/fesm2022/line-Bz5f9Cyx.mjs.map +1 -1
  115. package/fesm2022/list/testing.mjs.map +1 -1
  116. package/fesm2022/list.mjs.map +1 -1
  117. package/fesm2022/material.mjs.map +1 -1
  118. package/fesm2022/menu/testing.mjs +97 -13
  119. package/fesm2022/menu/testing.mjs.map +1 -1
  120. package/fesm2022/menu.mjs +343 -122
  121. package/fesm2022/menu.mjs.map +1 -1
  122. package/fesm2022/{module-BDiw_nWS.mjs → module-B0CLRw5e.mjs} +3 -3
  123. package/fesm2022/module-B0CLRw5e.mjs.map +1 -0
  124. package/fesm2022/{module-DzZHEh7B.mjs → module-B62K-792.mjs} +2 -2
  125. package/fesm2022/module-B62K-792.mjs.map +1 -0
  126. package/fesm2022/module-CWxMD37a.mjs.map +1 -1
  127. package/fesm2022/module-Ce6F7TNm.mjs.map +1 -1
  128. package/fesm2022/option-BzhYL_xC.mjs.map +1 -1
  129. package/fesm2022/option-harness-BFcc-M_4.mjs.map +1 -1
  130. package/fesm2022/paginator/testing.mjs.map +1 -1
  131. package/fesm2022/paginator.mjs +3 -3
  132. package/fesm2022/paginator.mjs.map +1 -1
  133. package/fesm2022/progress-bar/testing.mjs.map +1 -1
  134. package/fesm2022/progress-bar.mjs.map +1 -1
  135. package/fesm2022/progress-spinner/testing.mjs.map +1 -1
  136. package/fesm2022/progress-spinner.mjs.map +1 -1
  137. package/fesm2022/pseudo-checkbox-DDmgx3P4.mjs.map +1 -1
  138. package/fesm2022/pseudo-checkbox-module-4F8Up4PL.mjs.map +1 -1
  139. package/fesm2022/public-api-BoO5eSq-.mjs.map +1 -1
  140. package/fesm2022/radio/testing.mjs.map +1 -1
  141. package/fesm2022/radio.mjs.map +1 -1
  142. package/fesm2022/ripple-BYgV4oZC.mjs.map +1 -1
  143. package/fesm2022/ripple-loader-BnMiRtmT.mjs.map +1 -1
  144. package/fesm2022/select/testing.mjs.map +1 -1
  145. package/fesm2022/select.mjs +3 -3
  146. package/fesm2022/select.mjs.map +1 -1
  147. package/fesm2022/sidenav/testing.mjs.map +1 -1
  148. package/fesm2022/sidenav.mjs.map +1 -1
  149. package/fesm2022/slide-toggle/testing.mjs.map +1 -1
  150. package/fesm2022/slide-toggle.mjs +2 -2
  151. package/fesm2022/slide-toggle.mjs.map +1 -1
  152. package/fesm2022/slider/testing.mjs.map +1 -1
  153. package/fesm2022/slider.mjs.map +1 -1
  154. package/fesm2022/snack-bar/testing.mjs.map +1 -1
  155. package/fesm2022/snack-bar.mjs +2 -2
  156. package/fesm2022/snack-bar.mjs.map +1 -1
  157. package/fesm2022/sort/testing.mjs.map +1 -1
  158. package/fesm2022/sort.mjs.map +1 -1
  159. package/fesm2022/stepper/testing.mjs.map +1 -1
  160. package/fesm2022/stepper.mjs.map +1 -1
  161. package/fesm2022/structural-styles-CObeNzjn.mjs.map +1 -1
  162. package/fesm2022/table/testing.mjs.map +1 -1
  163. package/fesm2022/table.mjs.map +1 -1
  164. package/fesm2022/tabs/testing.mjs.map +1 -1
  165. package/fesm2022/tabs.mjs.map +1 -1
  166. package/fesm2022/timepicker/testing.mjs.map +1 -1
  167. package/fesm2022/timepicker.mjs +1 -1
  168. package/fesm2022/timepicker.mjs.map +1 -1
  169. package/fesm2022/toolbar/testing.mjs.map +1 -1
  170. package/fesm2022/toolbar.mjs.map +1 -1
  171. package/fesm2022/tooltip/testing.mjs.map +1 -1
  172. package/fesm2022/tooltip.mjs.map +1 -1
  173. package/fesm2022/tree/testing.mjs.map +1 -1
  174. package/fesm2022/tree.mjs.map +1 -1
  175. package/form-field/_form-field-theme.scss +35 -51
  176. package/form-field/_m2-form-field.scss +21 -29
  177. package/grid-list/_grid-list-theme.scss +28 -28
  178. package/grid-list/_m2-grid-list.scss +7 -9
  179. package/icon/_icon-theme.scss +40 -41
  180. package/input/_input-theme.scss +1 -4
  181. package/input/index.d.ts +0 -11
  182. package/list/_list-theme.scss +55 -53
  183. package/list/_m2-list.scss +16 -26
  184. package/menu/_m2-menu.scss +6 -6
  185. package/menu/_menu-theme.scss +28 -33
  186. package/menu/index.d.ts +145 -61
  187. package/menu/testing/index.d.ts +50 -2
  188. package/package.json +2 -2
  189. package/paginator/_m2-paginator.scss +7 -8
  190. package/paginator/_paginator-theme.scss +28 -33
  191. package/prebuilt-themes/deeppurple-amber.css +1 -1
  192. package/prebuilt-themes/indigo-pink.css +1 -1
  193. package/prebuilt-themes/pink-bluegrey.css +1 -1
  194. package/prebuilt-themes/purple-green.css +1 -1
  195. package/progress-bar/_progress-bar-theme.scss +35 -43
  196. package/progress-spinner/_progress-spinner-theme.scss +42 -43
  197. package/radio/_m2-radio.scss +6 -5
  198. package/radio/_radio-theme.scss +33 -46
  199. package/schematics/ng-add/index.js +1 -1
  200. package/select/_m2-select.scss +6 -5
  201. package/select/_select-theme.scss +38 -51
  202. package/sidenav/_sidenav-theme.scss +28 -30
  203. package/slide-toggle/_m2-slide-toggle.scss +45 -58
  204. package/slide-toggle/_m3-slide-toggle.scss +1 -0
  205. package/slide-toggle/_slide-toggle-theme.scss +41 -79
  206. package/slider/_m2-slider.scss +6 -9
  207. package/slider/_slider-theme.scss +38 -45
  208. package/snack-bar/_m2-snack-bar.scss +5 -5
  209. package/snack-bar/_snack-bar-theme.scss +28 -31
  210. package/sort/_sort-theme.scss +28 -33
  211. package/stepper/_m2-stepper.scss +10 -13
  212. package/stepper/_stepper-theme.scss +41 -49
  213. package/table/_m2-table.scss +16 -23
  214. package/table/_table-theme.scss +28 -36
  215. package/tabs/_m2-tabs.scss +6 -5
  216. package/tabs/_tabs-theme.scss +35 -43
  217. package/timepicker/_timepicker-theme.scss +28 -46
  218. package/toolbar/_m2-toolbar.scss +6 -7
  219. package/toolbar/_toolbar-theme.scss +55 -46
  220. package/tooltip/_m2-tooltip.scss +5 -6
  221. package/tooltip/_tooltip-theme.scss +28 -37
  222. package/tree/_m2-tree.scss +4 -3
  223. package/tree/_tree-theme.scss +28 -38
  224. package/core/tokens/_format-tokens.scss +0 -5
  225. package/fesm2022/form-field-C9DZXojn.mjs.map +0 -1
  226. package/fesm2022/module-BDiw_nWS.mjs.map +0 -1
  227. package/fesm2022/module-DzZHEh7B.mjs.map +0 -1
@@ -4,19 +4,16 @@
4
4
  @use 'sass:meta';
5
5
  @use 'sass:color';
6
6
 
7
+ // Deprecated flag that is no longer used to control duplication warnings.
8
+ // Remove in v22
9
+ $theme-ignore-duplication-warnings: false;
10
+
7
11
  // Whether to enable compatibility with legacy methods for accessing theme information.
8
12
  $theme-legacy-inspection-api-compatibility: true !default;
9
13
 
10
- // Whether duplication warnings should be disabled. Warnings enabled by default.
11
- $theme-ignore-duplication-warnings: false !default;
12
-
13
14
  // Whether density should be generated by default.
14
15
  $_generate-default-density: true !default;
15
16
 
16
- // Warning that will be printed if duplicated styles are generated by a theme.
17
- $_duplicate-warning: 'Read more about how style duplication can be avoided in a dedicated ' +
18
- 'guide. https://v18.material.angular.dev/guide/duplicate-theming-styles';
19
-
20
17
  // Warning that will be printed if the legacy theming API is used.
21
18
  $private-legacy-theme-warning: 'Angular Material themes should be created from a map containing ' +
22
19
  'the keys "color", "typography", and "density". The color value should be a map containing the ' +
@@ -40,46 +37,6 @@ $_emitted-base: () !default;
40
37
 
41
38
  $private-internal-name: _mat-theming-internals-do-not-access;
42
39
 
43
- // Checks if configurations that have been declared in the given theme have been generated
44
- // before. If so, warnings will be reported. This should notify developers in case duplicate
45
- // styles are accidentally generated due to wrong usage of the all-theme mixins.
46
- //
47
- // Additionally, this mixin controls the default value for the density configuration. By
48
- // default, density styles are generated at scale zero. If the same density styles would be
49
- // generated a second time though, the default value will change to avoid duplicate styles.
50
- //
51
- // The mixin keeps track of all configurations in a list that is scoped to the specified
52
- // id. This is necessary because a given theme can be passed to multiple disjoint theme mixins
53
- // (e.g. `all-component-themes` and `all-legacy-component-themes`) without causing any
54
- // style duplication.
55
- @mixin private-check-duplicate-theme-styles($theme-or-color-config, $id) {
56
- // TODO(mmalerba): use get-theme-version for this check when its moved out of experimental.
57
- @if map.get($theme-or-color-config, $private-internal-name, theme-version) == 1 {
58
- @include _check-duplicate-theme-styles-v1($theme-or-color-config, $id) {
59
- // Optionally, consumers of this mixin can wrap contents inside so that nested
60
- // duplicate style checks do not report another warning. e.g. if developers include
61
- // the `all-component-themes` mixin twice, only the top-level duplicate styles check
62
- // should report a warning. Not all individual components should report a warning too.
63
- $orig-mat-theme-ignore-duplication-warnings: $theme-ignore-duplication-warnings;
64
- $theme-ignore-duplication-warnings: true !global;
65
- @content;
66
- $theme-ignore-duplication-warnings: $orig-mat-theme-ignore-duplication-warnings !global;
67
- }
68
- }
69
- @else {
70
- @include _check-duplicate-theme-styles-v0($theme-or-color-config, $id) {
71
- // Optionally, consumers of this mixin can wrap contents inside so that nested
72
- // duplicate style checks do not report another warning. e.g. if developers include
73
- // the `all-component-themes` mixin twice, only the top-level duplicate styles check
74
- // should report a warning. Not all individual components should report a warning too.
75
- $orig-mat-theme-ignore-duplication-warnings: $theme-ignore-duplication-warnings;
76
- $theme-ignore-duplication-warnings: true !global;
77
- @content;
78
- $theme-ignore-duplication-warnings: $orig-mat-theme-ignore-duplication-warnings !global;
79
- }
80
- }
81
- }
82
-
83
40
  /// Strip out any settings map entries that have empty values (null or ()).
84
41
  @function _strip-empty-settings($settings) {
85
42
  $result: ();
@@ -91,131 +48,6 @@ $private-internal-name: _mat-theming-internals-do-not-access;
91
48
  @return if($result == (), null, $result);
92
49
  }
93
50
 
94
- // Checks for duplicate styles in a `theme-version: 1` style theme.
95
- @mixin _check-duplicate-theme-styles-v1($theme-or-color-config, $id) {
96
- $color-settings: _strip-empty-settings((
97
- theme-type: map.get($theme-or-color-config, $private-internal-name, theme-type),
98
- color-tokens: map.get($theme-or-color-config, $private-internal-name, color-tokens),
99
- ));
100
- $typography-settings: _strip-empty-settings((
101
- typography-tokens:
102
- map.get($theme-or-color-config, $private-internal-name, typography-tokens),
103
- ));
104
- $density-settings: _strip-empty-settings((
105
- density-scale:
106
- map.get($theme-or-color-config, $private-internal-name, density-scale),
107
- density-tokens:
108
- map.get($theme-or-color-config, $private-internal-name, density-tokens),
109
- ));
110
- $base-settings: _strip-empty-settings((
111
- base-tokens: map.get($theme-or-color-config, $private-internal-name, base-tokens),
112
- ));
113
- $previous-color-settings: map.get($_emitted-color, $id) or ();
114
- $previous-typography-settings: map.get($_emitted-typography, $id) or ();
115
- $previous-density-settings: map.get($_emitted-density, $id) or ();
116
- $previous-base-settings: map.get($_emitted-base, $id) or ();
117
-
118
- // Check if the color configuration has been generated before.
119
- @if $color-settings != null {
120
- @if list.index($previous-color-settings, $color-settings) != null and
121
- not $theme-ignore-duplication-warnings {
122
- @warn 'The same color styles are generated multiple times. ' + $_duplicate-warning;
123
- }
124
- $previous-color-settings: list.append($previous-color-settings, $color-settings);
125
- }
126
-
127
- // Check if the typography configuration has been generated before.
128
- @if $typography-settings != null {
129
- @if list.index($previous-typography-settings, $typography-settings) != null and
130
- not $theme-ignore-duplication-warnings {
131
- @warn 'The same typography styles are generated multiple times. ' + $_duplicate-warning;
132
- }
133
- $previous-typography-settings: list.append($previous-typography-settings, $typography-settings);
134
- }
135
-
136
- // Check if the density configuration has been generated before.
137
- @if $density-settings != null {
138
- @if list.index($previous-density-settings, $density-settings) != null and
139
- not $theme-ignore-duplication-warnings {
140
- @warn 'The same density styles are generated multiple times. ' + $_duplicate-warning;
141
- }
142
- $previous-density-settings: list.append($previous-density-settings, $density-settings);
143
- }
144
-
145
- // Check if the base configuration has been generated before.
146
- @if $base-settings != null {
147
- @if list.index($previous-base-settings, $base-settings) != null and
148
- not $theme-ignore-duplication-warnings {
149
- @warn 'The same base theme styles are generated multiple times. ' + $_duplicate-warning;
150
- }
151
- $previous-base-settings: list.append($previous-base-settings, $base-settings);
152
- }
153
-
154
- $_emitted-color: map.set($_emitted-color, $id, $previous-color-settings) !global;
155
- $_emitted-density: map.set($_emitted-density, $id, $previous-density-settings) !global;
156
- $_emitted-typography: map.set($_emitted-typography, $id, $previous-typography-settings) !global;
157
- $_emitted-base: map.set($_emitted-base, $id, $previous-base-settings) !global;
158
-
159
- @content;
160
- }
161
-
162
- // Checks for duplicate styles in a `theme-version: 0` style theme.
163
- @mixin _check-duplicate-theme-styles-v0($theme-or-color-config, $id) {
164
- $theme: private-legacy-get-theme($theme-or-color-config);
165
- $color-config: map.get($theme, $private-internal-name, m2-config, color) or
166
- private-get-color-config($theme);
167
- $density-config: map.get($theme, $private-internal-name, m2-config, density) or
168
- private-get-density-config($theme);
169
- $typography-config: map.get($theme, $private-internal-name, m2-config, typography) or
170
- private-get-typography-config($theme);
171
- // Lists of previous `color`, `density` and `typography` configurations.
172
- $previous-color: map.get($_emitted-color, $id) or ();
173
- $previous-typography: map.get($_emitted-typography, $id) or ();
174
- $previous-density: map.get($_emitted-density, $id) or ();
175
- // Whether duplicate legacy density styles would be generated.
176
- $duplicate-legacy-density: false;
177
-
178
- // Check if the color configuration has been generated before.
179
- @if $color-config != null {
180
- @if list.index($previous-color, $color-config) != null and
181
- not $theme-ignore-duplication-warnings {
182
- @warn 'The same color styles are generated multiple times. ' + $_duplicate-warning;
183
- }
184
- $previous-color: list.append($previous-color, $color-config);
185
- }
186
-
187
- // Check if the typography configuration has been generated before.
188
- @if $typography-config != null {
189
- @if list.index($previous-typography, $typography-config) != null and
190
- not $theme-ignore-duplication-warnings {
191
- @warn 'The same typography styles are generated multiple times. ' + $_duplicate-warning;
192
- }
193
- $previous-typography: list.append($previous-typography, $typography-config);
194
- }
195
-
196
- // Check if the density configuration has been generated before.
197
- @if $density-config != null {
198
- @if list.index($previous-density, $density-config) != null {
199
- // Only report a warning if density styles would be duplicated for non-legacy theme
200
- // definitions. For legacy themes, we have compatibility logic that avoids duplication
201
- // of default density styles. We don't want to report a warning in those cases.
202
- @if private-is-legacy-constructed-theme($theme) {
203
- $duplicate-legacy-density: true;
204
- }
205
- @else if not $theme-ignore-duplication-warnings {
206
- @warn 'The same density styles are generated multiple times. ' + $_duplicate-warning;
207
- }
208
- }
209
- $previous-density: list.append($previous-density, $density-config);
210
- }
211
-
212
- $_emitted-color: map.merge($_emitted-color, ($id: $previous-color)) !global;
213
- $_emitted-density: map.merge($_emitted-density, ($id: $previous-density)) !global;
214
- $_emitted-typography: map.merge($_emitted-typography, ($id: $previous-typography)) !global;
215
-
216
- @content;
217
- }
218
-
219
51
  // Checks whether the given value resolves to a theme object. Theme objects are always
220
52
  // of type `map` and can optionally only specify `color`, `density` or `typography`.
221
53
  @function private-is-theme-object($value) {
@@ -1,10 +1,5 @@
1
- @use 'sass:color';
2
- @use 'sass:math';
3
- @use 'sass:meta';
4
1
  @use 'sass:map';
5
-
6
- // Indicates whether we're building internally. Used for backwards compatibility.
7
- $private-is-internal-build: false;
2
+ @use './m2';
8
3
 
9
4
  // Gets the theme's system values as a flat map.
10
5
  @function get-system($theme) {
@@ -13,65 +8,10 @@ $private-is-internal-build: false;
13
8
  @return $system;
14
9
  }
15
10
 
16
- @return ();
17
- }
18
-
19
- /// Inherited function from MDC that computes which contrast tone to use on top of a color.
20
- /// This is used only in a narrow set of use cases when generating M2 button tokens to maintain
21
- /// backwards compatibility.
22
- /// @param {Color} $value Color for which we're calculating the contrast tone.
23
- /// @param {Boolean} $is-dark Whether the current theme is dark.
24
- /// @return {Map} Either `dark` or `light`.
25
- @function contrast-tone($value, $is-dark) {
26
- @if ($value == 'dark') {
27
- @return 'light';
28
- }
29
-
30
- @if ($value == 'light') {
31
- @return 'dark';
11
+ // If the $theme is a typography-config, convert it to a system map.
12
+ @if map.has-key($theme, body-1) {
13
+ @return m2.md-sys-typescale-values($theme);
32
14
  }
33
15
 
34
- // Fallback if the app is using a non-color palette (e.g. CSS variable based).
35
- @if (meta.type-of($value) != 'color') {
36
- @return if($is-dark, 'light', 'dark');
37
- }
38
-
39
- $minimum-contrast: 3.1;
40
- $light-contrast: _contrast($value, #fff);
41
- $dark-contrast: _contrast($value, rgba(0, 0, 0, 0.87));
42
-
43
- @if ($light-contrast < $minimum-contrast) and ($dark-contrast > $light-contrast) {
44
- @return 'dark';
45
- }
46
-
47
- @return 'light';
48
- }
49
-
50
- @function _linear-channel-value($channel-value) {
51
- $normalized-channel-value: math.div($channel-value, 255);
52
-
53
- @if ($normalized-channel-value < 0.03928) {
54
- @return math.div($normalized-channel-value, 12.92);
55
- }
56
-
57
- @return math.pow(math.div($normalized-channel-value + 0.055, 1.055), 2.4);
58
- }
59
-
60
- // Calculate the luminance for a color.
61
- // See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
62
- @function _luminance($color) {
63
- $red: _linear-channel-value(color.red($color));
64
- $green: _linear-channel-value(color.green($color));
65
- $blue: _linear-channel-value(color.blue($color));
66
-
67
- @return 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
68
- }
69
-
70
- // Calculate the contrast ratio between two colors.
71
- // See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
72
- @function _contrast($back, $front) {
73
- $back-lum: _luminance($back) + 0.05;
74
- $fore-lum: _luminance($front) + 0.05;
75
-
76
- @return math.div(math.max($back-lum, $fore-lum), math.min($back-lum, $fore-lum));
16
+ @return ();
77
17
  }
@@ -8,25 +8,13 @@
8
8
  $system: map.set($system, on-#{$color}-container, map.get($system, on-#{$variant}-container));
9
9
  $system: map.set($system, #{$color}, map.get($system, #{$variant}));
10
10
  $system: map.set($system, #{$color}-container, map.get($system, #{$variant}-container));
11
+ $system: map.set($system, inverse-#{$color}, map.get($system, inverse-#{$variant}));
11
12
  @return $system;
12
13
  }
13
14
 
14
15
  // Gets the theme's system values as a flat map.
15
16
  @function get-system($theme) {
16
- $system: ();
17
- $system: map.merge($system,
18
- map.get($theme, _mat-theming-internals-do-not-access, md-sys-color));
19
- $system: map.merge($system,
20
- map.get($theme, _mat-theming-internals-do-not-access, md-sys-elevation));
21
- $system: map.merge($system,
22
- map.get($theme, _mat-theming-internals-do-not-access, md-sys-shape));
23
- $system: map.merge($system,
24
- map.get($theme, _mat-theming-internals-do-not-access, md-sys-state));
25
- $system: map.merge($system,
26
- map.get($theme, _mat-theming-internals-do-not-access, md-sys-typescale));
27
- $system: map.merge($system,
28
- map.get($theme, _mat-theming-internals-do-not-access, md-ref-palette));
29
- @return $system;
17
+ @return map.get($theme, _mat-system);
30
18
  }
31
19
 
32
20
  // Returns the color with an opacity value using color-mix. If the color is a variable name, it
@@ -69,32 +69,12 @@
69
69
  @return _create-var(--mat-#{$token}, $sys-fallback);
70
70
  }
71
71
 
72
- // Outputs a map of tokens.
73
- @mixin create-token-values($tokens) {
74
- @include _create-token-values-internal($tokens, false);
75
- }
76
-
77
- // Outputs a map of tokens under a specific prefix in scenarios where tokens may be mixed with
78
- // other declarations (e.g. M2 themes). Used to avoid https://sass-lang.com/documentation/breaking-changes/mixed-decls/
79
- @mixin create-token-values-mixed($tokens) {
80
- @include _create-token-values-internal($tokens, true);
81
- }
82
-
83
- @mixin _create-token-values-internal($tokens, $in-place) {
84
- @if ($tokens != null) {
85
- @if ($in-place) {
86
- & {
87
- @each $key, $value in $tokens {
88
- @if $value != null {
89
- --mat-#{$key}: #{$value};
90
- }
91
- }
92
- }
93
- } @else {
94
- @each $key, $value in $tokens {
95
- @if $value != null {
96
- --mat-#{$key}: #{$value};
97
- }
72
+ // Outputs a map of token values as CSS variable definitions.
73
+ @mixin values($tokens) {
74
+ @include sass-utils.current-selector-or-root() {
75
+ @each $key, $value in $tokens {
76
+ @if $value != null {
77
+ --mat-#{$key}: #{$value};
98
78
  }
99
79
  }
100
80
  }
@@ -125,7 +105,7 @@
125
105
  $namespace: list.nth($data, 1);
126
106
  $name: list.nth($data, 2);
127
107
  $prefixed-name: $namespace + '-' + $name;
128
- @include create-token-values(($prefixed-name: $value));
108
+ @include values(($prefixed-name: $value));
129
109
  } @else {
130
110
  @error #{'Invalid token name `'}#{$name}#{'`. '}#{'Valid tokens are: '}#{$all-names};
131
111
  }
@@ -0,0 +1,6 @@
1
+ @forward './md-sys-color';
2
+ @forward './md-sys-elevation';
3
+ @forward './md-sys-motion';
4
+ @forward './md-sys-shape';
5
+ @forward './md-sys-state';
6
+ @forward './md-sys-typescale';
@@ -0,0 +1,123 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @use 'sass:map';
7
+ @use '../../m2/palette';
8
+
9
+ @function md-sys-color-values-dark($palettes) {
10
+ @return (
11
+ primary: map.get($palettes, primary, default),
12
+ on-primary: map.get($palettes, primary, default-contrast),
13
+ inverse-primary: map.get($palettes, primary, 600),
14
+ secondary: map.get($palettes, accent, default),
15
+ on-secondary: map.get($palettes, accent, default-contrast),
16
+ inverse-secondary: map.get($palettes, accent, 600),
17
+ error: map.get($palettes, warn, default),
18
+ on-error: map.get($palettes, warn, default-contrast),
19
+ inverse-error: map.get($palettes, warn, 600),
20
+ shadow: black,
21
+ surface: map.get(palette.$grey-palette, 800),
22
+ on-surface: white,
23
+ surface-variant: #4a4a4a,
24
+ on-surface-variant: rgba(white, 0.7),
25
+ background: #303030,
26
+ inverse-surface: white,
27
+ inverse-on-surface: rgba(black, 0.87),
28
+ outline: rgba(white, 0.12),
29
+ outline-variant: rgba(white, 0.38),
30
+
31
+ // TBD
32
+ error-container: null,
33
+ on-background: null,
34
+ on-error-container: null,
35
+ on-primary-container: null,
36
+ on-primary-fixed: null,
37
+ on-primary-fixed-variant: null,
38
+ on-secondary-container: null,
39
+ on-secondary-fixed: null,
40
+ on-secondary-fixed-variant: null,
41
+ on-tertiary: null,
42
+ on-tertiary-container: null,
43
+ on-tertiary-fixed: null,
44
+ on-tertiary-fixed-variant: null,
45
+ primary-container: null,
46
+ primary-fixed: null,
47
+ primary-fixed-dim: null,
48
+ scrim: null,
49
+ secondary-container: null,
50
+ secondary-fixed: null,
51
+ secondary-fixed-dim: null,
52
+ surface-bright: null,
53
+ surface-container: null,
54
+ surface-container-high: null,
55
+ surface-container-highest: null,
56
+ surface-container-low: null,
57
+ surface-container-lowest: null,
58
+ surface-dim: null,
59
+ surface-tint: null,
60
+ tertiary: null,
61
+ tertiary-container: null,
62
+ tertiary-fixed: null,
63
+ tertiary-fixed-dim: null,
64
+ );
65
+ }
66
+
67
+ @function md-sys-color-values-light($palettes) {
68
+ @return (
69
+ primary: map.get($palettes, primary, default),
70
+ on-primary: map.get($palettes, primary, default-contrast),
71
+ inverse-primary: map.get($palettes, primary, 300),
72
+ secondary: map.get($palettes, accent, default),
73
+ on-secondary: map.get($palettes, accent, default-contrast),
74
+ inverse-secondary: map.get($palettes, accent, 300),
75
+ error: map.get($palettes, warn, default),
76
+ on-error: map.get($palettes, warn, default-contrast),
77
+ inverse-error: map.get($palettes, warn, 300),
78
+ shadow: black,
79
+ surface: white,
80
+ on-surface: rgba(black, 0.87),
81
+ surface-variant: #f6f6f6,
82
+ on-surface-variant: rgba(black, 0.54),
83
+ background: map.get(palette.$grey-palette, 50),
84
+ inverse-surface: map.get(palette.$grey-palette, 800),
85
+ inverse-on-surface: white,
86
+ outline: rgba(black, 0.12),
87
+ outline-variant: rgba(black, 0.38),
88
+
89
+ // TBD
90
+ error-container: null,
91
+ on-background: null,
92
+ on-error-container: null,
93
+ on-primary-container: null,
94
+ on-primary-fixed: null,
95
+ on-primary-fixed-variant: null,
96
+ on-secondary-container: null,
97
+ on-secondary-fixed: null,
98
+ on-secondary-fixed-variant: null,
99
+ on-tertiary: null,
100
+ on-tertiary-container: null,
101
+ on-tertiary-fixed: null,
102
+ on-tertiary-fixed-variant: null,
103
+ primary-container: null,
104
+ primary-fixed: null,
105
+ primary-fixed-dim: null,
106
+ scrim: null,
107
+ secondary-container: null,
108
+ secondary-fixed: null,
109
+ secondary-fixed-dim: null,
110
+ surface-bright: null,
111
+ surface-container: null,
112
+ surface-container-high: null,
113
+ surface-container-highest: null,
114
+ surface-container-low: null,
115
+ surface-container-lowest: null,
116
+ surface-dim: null,
117
+ surface-tint: null,
118
+ tertiary: null,
119
+ tertiary-container: null,
120
+ tertiary-fixed: null,
121
+ tertiary-fixed-dim: null,
122
+ );
123
+ }
@@ -0,0 +1,16 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @function md-sys-elevation-values() {
7
+ @return (
8
+ // TBD
9
+ level0: null,
10
+ level1: null,
11
+ level2: null,
12
+ level3: null,
13
+ level4: null,
14
+ level5: null,
15
+ );
16
+ }
@@ -0,0 +1,36 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @function md-sys-motion-values() {
7
+ @return (
8
+ // TBD
9
+ duration-extra-long1: null,
10
+ duration-extra-long2: null,
11
+ duration-extra-long3: null,
12
+ duration-extra-long4: null,
13
+ duration-long1: null,
14
+ duration-long2: null,
15
+ duration-long3: null,
16
+ duration-long4: null,
17
+ duration-medium1: null,
18
+ duration-medium2: null,
19
+ duration-medium3: null,
20
+ duration-medium4: null,
21
+ duration-short1: null,
22
+ duration-short2: null,
23
+ duration-short3: null,
24
+ duration-short4: null,
25
+ easing-emphasized: null,
26
+ easing-emphasized-accelerate: null,
27
+ easing-emphasized-decelerate: null,
28
+ easing-legacy: null,
29
+ easing-legacy-accelerate: null,
30
+ easing-legacy-decelerate: null,
31
+ easing-linear: null,
32
+ easing-standard: null,
33
+ easing-standard-accelerate: null,
34
+ easing-standard-decelerate: null,
35
+ );
36
+ }
@@ -0,0 +1,22 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @function md-sys-shape-values() {
7
+ @return (
8
+ // TBD
9
+ corner-extra-large: null,
10
+ corner-extra-large-top: null,
11
+ corner-extra-small: null,
12
+ corner-extra-small-top: null,
13
+ corner-full: null,
14
+ corner-large: null,
15
+ corner-large-end: null,
16
+ corner-large-start: null,
17
+ corner-large-top: null,
18
+ corner-medium: null,
19
+ corner-none: null,
20
+ corner-small: null,
21
+ );
22
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Design system display name: Material 3
3
+ // Design system version: v0.161
4
+ //
5
+
6
+ @function md-sys-state-values($exclude-hardcoded-values: false) {
7
+ @return (
8
+ focus-state-layer-opacity: 0.12,
9
+ hover-state-layer-opacity: 0.04,
10
+ pressed-state-layer-opacity: 0.12,
11
+
12
+ // TBD
13
+ dragged-state-layer-opacity: 0.16,
14
+ );
15
+ }
@@ -0,0 +1,68 @@
1
+ @use 'sass:map';
2
+ @use 'sass:string';
3
+ @use 'sass:meta';
4
+
5
+ @function md-sys-typescale-values($config) {
6
+ // Mapping is according to the old 2014 version of the typography spec.
7
+ $sys-to-config: (
8
+ body-large: subheading-1,
9
+ body-medium: body-1,
10
+ body-small: caption,
11
+ display-large: display-4,
12
+ display-medium: display-4,
13
+ display-small: display-4,
14
+ headline-large: display-3,
15
+ headline-medium: display-2,
16
+ headline-small: display-1,
17
+ label-large: subheading-2,
18
+ label-medium: body-2,
19
+ label-small: button,
20
+ title-large: headline,
21
+ title-medium: headline,
22
+ title-small: title,
23
+ );
24
+
25
+ // If the config is based on the updated 2018 version of the typography spec, then
26
+ // use the correct config keys mapping.
27
+ @if (map.get($config, headline-1) != null) {
28
+ $sys-to-config: (
29
+ body-large: body-1,
30
+ body-medium: body-2,
31
+ body-small: caption,
32
+ label-large: subtitle-1,
33
+ label-medium: subtitle-2,
34
+ label-small: button,
35
+ display-large: headline-1,
36
+ display-medium: headline-1,
37
+ display-small: headline-1,
38
+ headline-large: headline-2,
39
+ headline-medium: headline-3,
40
+ headline-small: headline-4,
41
+ title-large: headline-5,
42
+ title-medium: headline-5,
43
+ title-small: headline-6,
44
+ );
45
+ }
46
+
47
+ $typography: ();
48
+ @each $sys-key, $config-key in $sys-to-config {
49
+ $font: map.get($config, $config-key, font-family);
50
+ @if (meta.type-of($font) == 'string') {
51
+ $font: string.unquote($font);
52
+ }
53
+ $line-height: map.get($config, $config-key, line-height);
54
+ $size: map.get($config, $config-key, font-size);
55
+ $tracking: map.get($config, $config-key, letter-spacing);
56
+ $weight: map.get($config, $config-key, font-weight);
57
+ $typography: map.merge($typography, (
58
+ #{$sys-key}: $weight $size #{'/'} $line-height $font,
59
+ #{$sys-key}-font: $font,
60
+ #{$sys-key}-line-height: $line-height,
61
+ #{$sys-key}-size: $size,
62
+ #{$sys-key}-tracking: $tracking,
63
+ #{$sys-key}-weight: $weight,
64
+ ));
65
+ }
66
+
67
+ @return $typography;
68
+ }
@@ -8,7 +8,7 @@
8
8
  // Indicates whether alternative tokens should be used
9
9
  $_alternate-tokens: false;
10
10
 
11
- @function md-sys-color-values-dark($palettes) {
11
+ @function md-sys-color-values-dark($palettes: ()) {
12
12
  $values: (
13
13
  background: map.get($palettes, neutral, 6),
14
14
  error: map.get($palettes, error, 80),
@@ -80,7 +80,7 @@ $_alternate-tokens: false;
80
80
  @return $values;
81
81
  }
82
82
 
83
- @function md-sys-color-values-light($palettes) {
83
+ @function md-sys-color-values-light($palettes: ()) {
84
84
  $values: (
85
85
  background: map.get($palettes, neutral, 98),
86
86
  error: map.get($palettes, error, 40),
@@ -8,7 +8,7 @@
8
8
  // Indicates whether alternative tokens should be used
9
9
  $_alternate-tokens: false;
10
10
 
11
- @function md-sys-typescale-values($typography) {
11
+ @function md-sys-typescale-values($typography: ()) {
12
12
  $plain: map.get($typography, plain);
13
13
  $brand: map.get($typography, brand);
14
14
  $bold: map.get($typography, bold);