@angular/material 18.0.0-next.5 → 18.0.0-next.6

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 (296) hide show
  1. package/_index.scss +67 -60
  2. package/autocomplete/_autocomplete-theme.scss +7 -0
  3. package/badge/_badge-theme.scss +9 -0
  4. package/bottom-sheet/_bottom-sheet-theme.scss +7 -0
  5. package/button/_button-theme.scss +25 -0
  6. package/button/_fab-theme.scss +13 -0
  7. package/button/_icon-button-theme.scss +8 -0
  8. package/button-toggle/_button-toggle-theme.scss +12 -0
  9. package/card/_card-theme.scss +9 -0
  10. package/checkbox/_checkbox-theme.scss +2 -4
  11. package/chips/_chips-theme.scss +10 -0
  12. package/core/_core-theme.scss +17 -0
  13. package/core/m2/_index.scss +52 -0
  14. package/core/m2/_theming.scss +295 -0
  15. package/core/{typography/_property-getters.scss → m2/_typography-utils.scss} +14 -0
  16. package/core/{typography/_definition.scss → m2/_typography.scss} +1 -1
  17. package/core/option/_optgroup-theme.scss +7 -0
  18. package/core/option/_option-theme.scss +9 -0
  19. package/core/ripple/_ripple-theme.scss +7 -0
  20. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +13 -0
  21. package/core/style/_sass-utils.scss +14 -1
  22. package/core/theming/_color-api-backwards-compatibility.scss +128 -0
  23. package/core/theming/_config-validation.scss +173 -0
  24. package/core/theming/_definition.scss +113 -0
  25. package/core/theming/_m2-inspection.scss +23 -22
  26. package/core/theming/_palettes.scss +947 -0
  27. package/core/theming/_theming-deprecated.scss +9 -9
  28. package/core/theming/_theming.scss +73 -339
  29. package/core/tokens/_custom-tokens.scss +1918 -0
  30. package/core/tokens/_density.scss +191 -0
  31. package/core/tokens/_format-tokens.scss +5 -0
  32. package/core/tokens/_m3-tokens.scss +1252 -0
  33. package/core/tokens/_token-utils.scss +32 -46
  34. package/core/tokens/m2/mat/_chip.scss +3 -3
  35. package/core/tokens/m2/mat/_form-field.scss +3 -3
  36. package/core/tokens/m2/mdc/_checkbox.scss +3 -2
  37. package/core/tokens/m2/mdc/_chip.scss +3 -3
  38. package/core/tokens/m2/mdc/_radio.scss +3 -2
  39. package/core/typography/_all-typography.scss +3 -2
  40. package/core/typography/_typography-utils.scss +0 -26
  41. package/core/typography/_typography.scss +0 -2
  42. package/core/typography/_versioning.scss +3 -3
  43. package/datepicker/_datepicker-theme.scss +9 -0
  44. package/datepicker/index.d.ts +5 -0
  45. package/dialog/_dialog-theme.scss +8 -0
  46. package/divider/_divider-theme.scss +7 -0
  47. package/esm2022/autocomplete/autocomplete-origin.mjs +3 -3
  48. package/esm2022/autocomplete/autocomplete-trigger.mjs +3 -3
  49. package/esm2022/autocomplete/autocomplete.mjs +3 -3
  50. package/esm2022/autocomplete/module.mjs +4 -4
  51. package/esm2022/badge/badge-module.mjs +4 -4
  52. package/esm2022/badge/badge.mjs +6 -6
  53. package/esm2022/bottom-sheet/bottom-sheet-container.mjs +3 -3
  54. package/esm2022/bottom-sheet/bottom-sheet-module.mjs +4 -4
  55. package/esm2022/bottom-sheet/bottom-sheet.mjs +3 -3
  56. package/esm2022/button/button-base.mjs +6 -6
  57. package/esm2022/button/button.mjs +6 -6
  58. package/esm2022/button/fab.mjs +12 -12
  59. package/esm2022/button/icon-button.mjs +6 -6
  60. package/esm2022/button/module.mjs +4 -4
  61. package/esm2022/button-toggle/button-toggle-module.mjs +4 -4
  62. package/esm2022/button-toggle/button-toggle.mjs +6 -6
  63. package/esm2022/card/card.mjs +42 -42
  64. package/esm2022/card/module.mjs +4 -4
  65. package/esm2022/checkbox/checkbox-required-validator.mjs +3 -3
  66. package/esm2022/checkbox/checkbox.mjs +3 -3
  67. package/esm2022/checkbox/module.mjs +8 -8
  68. package/esm2022/chips/chip-action.mjs +3 -3
  69. package/esm2022/chips/chip-edit-input.mjs +3 -3
  70. package/esm2022/chips/chip-grid.mjs +3 -3
  71. package/esm2022/chips/chip-icons.mjs +9 -9
  72. package/esm2022/chips/chip-input.mjs +3 -3
  73. package/esm2022/chips/chip-listbox.mjs +3 -3
  74. package/esm2022/chips/chip-option.mjs +3 -3
  75. package/esm2022/chips/chip-row.mjs +3 -3
  76. package/esm2022/chips/chip-set.mjs +3 -3
  77. package/esm2022/chips/chip.mjs +3 -3
  78. package/esm2022/chips/module.mjs +4 -4
  79. package/esm2022/core/common-behaviors/common-module.mjs +4 -4
  80. package/esm2022/core/datetime/index.mjs +8 -8
  81. package/esm2022/core/datetime/native-date-adapter.mjs +3 -3
  82. package/esm2022/core/error/error-options.mjs +6 -6
  83. package/esm2022/core/internal-form-field/internal-form-field.mjs +3 -3
  84. package/esm2022/core/line/line.mjs +7 -7
  85. package/esm2022/core/option/index.mjs +4 -4
  86. package/esm2022/core/option/optgroup.mjs +3 -3
  87. package/esm2022/core/option/option.mjs +3 -3
  88. package/esm2022/core/private/ripple-loader.mjs +3 -3
  89. package/esm2022/core/ripple/index.mjs +4 -4
  90. package/esm2022/core/ripple/ripple.mjs +3 -3
  91. package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox-module.mjs +4 -4
  92. package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +3 -3
  93. package/esm2022/core/version.mjs +1 -1
  94. package/esm2022/datepicker/calendar-body.mjs +3 -3
  95. package/esm2022/datepicker/calendar.mjs +6 -6
  96. package/esm2022/datepicker/date-range-input-parts.mjs +9 -9
  97. package/esm2022/datepicker/date-range-input.mjs +9 -4
  98. package/esm2022/datepicker/date-range-picker.mjs +3 -3
  99. package/esm2022/datepicker/date-range-selection-strategy.mjs +3 -3
  100. package/esm2022/datepicker/date-selection-model.mjs +9 -9
  101. package/esm2022/datepicker/datepicker-actions.mjs +9 -9
  102. package/esm2022/datepicker/datepicker-base.mjs +6 -6
  103. package/esm2022/datepicker/datepicker-input-base.mjs +3 -3
  104. package/esm2022/datepicker/datepicker-input.mjs +3 -3
  105. package/esm2022/datepicker/datepicker-intl.mjs +3 -3
  106. package/esm2022/datepicker/datepicker-module.mjs +4 -4
  107. package/esm2022/datepicker/datepicker-toggle.mjs +6 -6
  108. package/esm2022/datepicker/datepicker.mjs +3 -3
  109. package/esm2022/datepicker/month-view.mjs +3 -3
  110. package/esm2022/datepicker/multi-year-view.mjs +3 -3
  111. package/esm2022/datepicker/year-view.mjs +3 -3
  112. package/esm2022/dialog/dialog-container.mjs +3 -3
  113. package/esm2022/dialog/dialog-content-directives.mjs +15 -15
  114. package/esm2022/dialog/dialog.mjs +3 -3
  115. package/esm2022/dialog/module.mjs +4 -4
  116. package/esm2022/divider/divider-module.mjs +4 -4
  117. package/esm2022/divider/divider.mjs +3 -3
  118. package/esm2022/expansion/accordion.mjs +3 -3
  119. package/esm2022/expansion/expansion-module.mjs +4 -4
  120. package/esm2022/expansion/expansion-panel-content.mjs +3 -3
  121. package/esm2022/expansion/expansion-panel-header.mjs +9 -9
  122. package/esm2022/expansion/expansion-panel.mjs +6 -6
  123. package/esm2022/form-field/directives/error.mjs +3 -3
  124. package/esm2022/form-field/directives/floating-label.mjs +3 -3
  125. package/esm2022/form-field/directives/hint.mjs +3 -3
  126. package/esm2022/form-field/directives/label.mjs +3 -3
  127. package/esm2022/form-field/directives/line-ripple.mjs +3 -3
  128. package/esm2022/form-field/directives/notched-outline.mjs +3 -3
  129. package/esm2022/form-field/directives/prefix.mjs +3 -3
  130. package/esm2022/form-field/directives/suffix.mjs +3 -3
  131. package/esm2022/form-field/form-field-control.mjs +4 -4
  132. package/esm2022/form-field/form-field.mjs +6 -6
  133. package/esm2022/form-field/module.mjs +4 -4
  134. package/esm2022/grid-list/grid-list-module.mjs +4 -4
  135. package/esm2022/grid-list/grid-list.mjs +3 -3
  136. package/esm2022/grid-list/grid-tile.mjs +15 -15
  137. package/esm2022/icon/icon-module.mjs +4 -4
  138. package/esm2022/icon/icon-registry.mjs +3 -3
  139. package/esm2022/icon/icon.mjs +3 -3
  140. package/esm2022/icon/testing/fake-icon-registry.mjs +7 -7
  141. package/esm2022/input/input.mjs +3 -3
  142. package/esm2022/input/module.mjs +4 -4
  143. package/esm2022/list/action-list.mjs +3 -3
  144. package/esm2022/list/list-base.mjs +6 -6
  145. package/esm2022/list/list-item-sections.mjs +18 -18
  146. package/esm2022/list/list-module.mjs +4 -4
  147. package/esm2022/list/list-option.mjs +3 -3
  148. package/esm2022/list/list.mjs +6 -6
  149. package/esm2022/list/nav-list.mjs +3 -3
  150. package/esm2022/list/selection-list.mjs +3 -3
  151. package/esm2022/list/subheader.mjs +3 -3
  152. package/esm2022/menu/menu-content.mjs +3 -3
  153. package/esm2022/menu/menu-item.mjs +3 -3
  154. package/esm2022/menu/menu-trigger.mjs +3 -3
  155. package/esm2022/menu/menu.mjs +3 -3
  156. package/esm2022/menu/module.mjs +4 -4
  157. package/esm2022/paginator/module.mjs +4 -4
  158. package/esm2022/paginator/paginator-intl.mjs +3 -3
  159. package/esm2022/paginator/paginator.mjs +3 -3
  160. package/esm2022/progress-bar/module.mjs +4 -4
  161. package/esm2022/progress-bar/progress-bar.mjs +5 -5
  162. package/esm2022/progress-spinner/module.mjs +4 -4
  163. package/esm2022/progress-spinner/progress-spinner.mjs +3 -3
  164. package/esm2022/radio/module.mjs +4 -4
  165. package/esm2022/radio/radio.mjs +6 -6
  166. package/esm2022/select/module.mjs +4 -4
  167. package/esm2022/select/select.mjs +12 -7
  168. package/esm2022/sidenav/drawer.mjs +9 -9
  169. package/esm2022/sidenav/sidenav-module.mjs +4 -4
  170. package/esm2022/sidenav/sidenav.mjs +9 -9
  171. package/esm2022/slide-toggle/module.mjs +8 -8
  172. package/esm2022/slide-toggle/slide-toggle-required-validator.mjs +3 -3
  173. package/esm2022/slide-toggle/slide-toggle.mjs +3 -3
  174. package/esm2022/slider/module.mjs +4 -4
  175. package/esm2022/slider/slider-input.mjs +6 -6
  176. package/esm2022/slider/slider-thumb.mjs +3 -3
  177. package/esm2022/slider/slider.mjs +3 -3
  178. package/esm2022/snack-bar/module.mjs +4 -4
  179. package/esm2022/snack-bar/simple-snack-bar.mjs +3 -3
  180. package/esm2022/snack-bar/snack-bar-container.mjs +3 -3
  181. package/esm2022/snack-bar/snack-bar-content.mjs +9 -9
  182. package/esm2022/snack-bar/snack-bar.mjs +3 -3
  183. package/esm2022/sort/sort-header-intl.mjs +3 -3
  184. package/esm2022/sort/sort-header.mjs +3 -3
  185. package/esm2022/sort/sort-module.mjs +4 -4
  186. package/esm2022/sort/sort.mjs +3 -3
  187. package/esm2022/stepper/step-content.mjs +3 -3
  188. package/esm2022/stepper/step-header.mjs +3 -3
  189. package/esm2022/stepper/step-label.mjs +3 -3
  190. package/esm2022/stepper/stepper-button.mjs +6 -6
  191. package/esm2022/stepper/stepper-icon.mjs +3 -3
  192. package/esm2022/stepper/stepper-intl.mjs +3 -3
  193. package/esm2022/stepper/stepper-module.mjs +4 -4
  194. package/esm2022/stepper/stepper.mjs +6 -6
  195. package/esm2022/table/cell.mjs +21 -21
  196. package/esm2022/table/module.mjs +4 -4
  197. package/esm2022/table/row.mjs +21 -21
  198. package/esm2022/table/table.mjs +6 -6
  199. package/esm2022/table/text-column.mjs +3 -3
  200. package/esm2022/tabs/ink-bar.mjs +3 -3
  201. package/esm2022/tabs/module.mjs +4 -4
  202. package/esm2022/tabs/paginated-tab-header.mjs +3 -3
  203. package/esm2022/tabs/tab-body.mjs +6 -6
  204. package/esm2022/tabs/tab-content.mjs +3 -3
  205. package/esm2022/tabs/tab-group.mjs +3 -3
  206. package/esm2022/tabs/tab-header.mjs +3 -3
  207. package/esm2022/tabs/tab-label-wrapper.mjs +3 -3
  208. package/esm2022/tabs/tab-label.mjs +3 -3
  209. package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +9 -9
  210. package/esm2022/tabs/tab.mjs +3 -3
  211. package/esm2022/toolbar/toolbar-module.mjs +4 -4
  212. package/esm2022/toolbar/toolbar.mjs +6 -6
  213. package/esm2022/tooltip/module.mjs +4 -4
  214. package/esm2022/tooltip/tooltip.mjs +6 -6
  215. package/esm2022/tree/node.mjs +9 -9
  216. package/esm2022/tree/outlet.mjs +3 -3
  217. package/esm2022/tree/padding.mjs +3 -3
  218. package/esm2022/tree/toggle.mjs +3 -3
  219. package/esm2022/tree/tree-module.mjs +4 -4
  220. package/esm2022/tree/tree.mjs +3 -3
  221. package/expansion/_expansion-theme.scss +7 -0
  222. package/fesm2022/autocomplete.mjs +13 -13
  223. package/fesm2022/badge.mjs +10 -10
  224. package/fesm2022/bottom-sheet.mjs +10 -10
  225. package/fesm2022/button-toggle.mjs +10 -10
  226. package/fesm2022/button.mjs +34 -34
  227. package/fesm2022/card.mjs +46 -46
  228. package/fesm2022/checkbox.mjs +14 -14
  229. package/fesm2022/chips.mjs +40 -40
  230. package/fesm2022/core.mjs +59 -59
  231. package/fesm2022/core.mjs.map +1 -1
  232. package/fesm2022/datepicker.mjs +87 -82
  233. package/fesm2022/datepicker.mjs.map +1 -1
  234. package/fesm2022/dialog.mjs +25 -25
  235. package/fesm2022/divider.mjs +7 -7
  236. package/fesm2022/expansion.mjs +25 -25
  237. package/fesm2022/form-field.mjs +36 -36
  238. package/fesm2022/form-field.mjs.map +1 -1
  239. package/fesm2022/grid-list.mjs +22 -22
  240. package/fesm2022/icon/testing.mjs +7 -7
  241. package/fesm2022/icon.mjs +10 -10
  242. package/fesm2022/input.mjs +7 -7
  243. package/fesm2022/list.mjs +49 -49
  244. package/fesm2022/menu.mjs +16 -16
  245. package/fesm2022/paginator.mjs +10 -10
  246. package/fesm2022/progress-bar.mjs +8 -8
  247. package/fesm2022/progress-bar.mjs.map +1 -1
  248. package/fesm2022/progress-spinner.mjs +7 -7
  249. package/fesm2022/radio.mjs +10 -10
  250. package/fesm2022/select.mjs +15 -10
  251. package/fesm2022/select.mjs.map +1 -1
  252. package/fesm2022/sidenav.mjs +22 -22
  253. package/fesm2022/slide-toggle.mjs +14 -14
  254. package/fesm2022/slider.mjs +16 -16
  255. package/fesm2022/snack-bar.mjs +22 -22
  256. package/fesm2022/sort.mjs +13 -13
  257. package/fesm2022/stepper.mjs +31 -31
  258. package/fesm2022/table.mjs +55 -55
  259. package/fesm2022/tabs.mjs +43 -43
  260. package/fesm2022/toolbar.mjs +10 -10
  261. package/fesm2022/tooltip.mjs +10 -10
  262. package/fesm2022/tree.mjs +25 -25
  263. package/form-field/_form-field-theme.scss +15 -0
  264. package/form-field/index.d.ts +6 -0
  265. package/grid-list/_grid-list-theme.scss +7 -0
  266. package/icon/_icon-theme.scss +9 -0
  267. package/input/_input-theme.scss +8 -0
  268. package/list/_list-theme.scss +8 -0
  269. package/menu/_menu-theme.scss +7 -0
  270. package/package.json +3 -2
  271. package/paginator/_paginator-theme.scss +7 -0
  272. package/progress-bar/_progress-bar-theme.scss +11 -0
  273. package/progress-spinner/_progress-spinner-theme.scss +11 -0
  274. package/radio/_radio-theme.scss +10 -0
  275. package/schematics/ng-add/index.js +1 -1
  276. package/schematics/ng-add/index.mjs +1 -1
  277. package/schematics/ng-add/theming/create-custom-theme.js +5 -6
  278. package/schematics/ng-add/theming/create-custom-theme.mjs +5 -6
  279. package/schematics/ng-generate/m3-theme/index_bundled.js +2 -2
  280. package/schematics/ng-generate/m3-theme/index_bundled.js.map +1 -1
  281. package/schematics/ng-update/index_bundled.js +215 -1
  282. package/schematics/ng-update/index_bundled.js.map +4 -4
  283. package/select/_select-theme.scss +9 -0
  284. package/select/index.d.ts +5 -0
  285. package/sidenav/_sidenav-theme.scss +7 -0
  286. package/slide-toggle/_slide-toggle-theme.scss +11 -0
  287. package/slider/_slider-theme.scss +10 -0
  288. package/snack-bar/_snack-bar-theme.scss +10 -0
  289. package/sort/_sort-theme.scss +7 -0
  290. package/stepper/_stepper-theme.scss +9 -0
  291. package/table/_table-theme.scss +7 -0
  292. package/tabs/_tabs-theme.scss +20 -0
  293. package/toolbar/_toolbar-theme.scss +9 -0
  294. package/tooltip/_tooltip-theme.scss +8 -0
  295. package/tree/_tree-theme.scss +7 -0
  296. /package/core/{theming → m2}/_palette.scss +0 -0
@@ -0,0 +1,1252 @@
1
+ @use 'sass:list';
2
+ @use 'sass:map';
3
+ @use 'sass:meta';
4
+ @use '@material/tokens/v0_161' as mdc-tokens;
5
+ @use '../style/sass-utils';
6
+ @use '../m2' as m2-theming;
7
+ @use '../tokens/m2' as m2-tokens;
8
+ @use './density';
9
+ @use './custom-tokens';
10
+ @use './format-tokens';
11
+
12
+ // TODO(mmalerba): Split up this file into smaller pieces.
13
+
14
+ /// Maps the values in a map to new values using the given mapping function
15
+ /// @param {Map} $map The maps whose values will be mapped to new values.
16
+ /// @param {Function} $fn The value mapping function.
17
+ /// @param {Map} A new map with its values updated using the mapping function.
18
+ @function _map-values($map, $fn) {
19
+ $result: ();
20
+ @each $key, $value in $map {
21
+ $result: map.set($result, $key, meta.call($fn, $value));
22
+ }
23
+ @return $result;
24
+ }
25
+
26
+ /// Picks a submap containing only the given keys out the given map.
27
+ /// @param {Map} $map The map to pick from.
28
+ /// @param {List} $keys The map keys to pick.
29
+ /// @return {Map} A submap containing only the given keys.
30
+ @function _pick($map, $keys) {
31
+ $result: ();
32
+ @each $key in $keys {
33
+ @if map.has-key($map, $key) {
34
+ $result: map.set($result, $key, map.get($map, $key));
35
+ }
36
+ }
37
+ @return $result;
38
+ }
39
+
40
+ /// Filters keys with a null value out of the map.
41
+ /// @param {Map} $map The map to filter.
42
+ /// @return {Map} The given map with all of the null keys filtered out.
43
+ @function _filter-nulls($map) {
44
+ $result: ();
45
+ @each $key, $val in $map {
46
+ @if $val != null {
47
+ $result: map.set($result, $key, $val);
48
+ }
49
+ }
50
+ @return $result;
51
+ }
52
+
53
+ /// Renames the keys in a map
54
+ /// @param {Map} $map The map whose keys should be renamed
55
+ /// @param {Map} $rename-keys A map of original key to renamed key to apply to $map
56
+ /// @return {Map} The result of applying the given key renames to the given map.
57
+ @function _rename-map-keys($map, $rename-keys) {
58
+ $result: $map;
59
+ @each $old-key-name, $new-key-name in $rename-keys {
60
+ @if map.has-key($map, $old-key-name) {
61
+ $result: map.set($result, $new-key-name, map.get($map, $old-key-name));
62
+ }
63
+ }
64
+ @return $result;
65
+ }
66
+
67
+ /// Gets the MDC tokens for the given prefix, M3 token values, and supported token slots.
68
+ /// @param {List} $prefix The token prefix for the given tokens.
69
+ /// @param {Map|(Map, Map)} $values A map of M3 token values for the given prefix.
70
+ /// This param may also be a tuple of maps, the first one representing the default M3 token values,
71
+ // and the second containing overrides for different color variants.
72
+ // Single map example:
73
+ // (token1: green, token2: 2px)
74
+ // Tuple example:
75
+ // (
76
+ // (token1: green, token2: 2px),
77
+ // (
78
+ // secondary: (token1: blue),
79
+ // error: (token1: red),
80
+ // )
81
+ // )
82
+ /// @param {Map} $slots A map of token slots, with null value indicating the token is not supported.
83
+ /// @param {String|null} $variant The name of the variant the token values are for.
84
+ /// @return {Map} A map of fully qualified token names to values, for only the supported tokens.
85
+ @function _namespace-tokens($prefix, $values, $slots, $variant: null) {
86
+ $result: ();
87
+ @if $variant == null and meta.type-of($values) == 'list' and list.length($values == 2) {
88
+ $variants: list.nth($values, 2);
89
+ $values: list.nth($values, 1);
90
+ @each $variant, $overrides in $variants {
91
+ $result: map.merge($result, _namespace-tokens($prefix, $overrides, $slots, $variant));
92
+ }
93
+ }
94
+ $used-token-names: map.keys(_filter-nulls(map.get($slots, $prefix)));
95
+ $used-m3-tokens: _pick(_filter-nulls($values), $used-token-names);
96
+ $prefix: if($variant == null, $prefix, list.append($prefix, $variant));
97
+ @return map.merge($result, ($prefix: $used-m3-tokens));
98
+ }
99
+
100
+ /// Generates tokens for the given palette with the given prefix.
101
+ /// @param {Map} $palette The palette to generate tokens for
102
+ /// @param {String} $prefix The key prefix used to name the tokens
103
+ /// @return {Map} A set of tokens for the given palette
104
+ @function _generate-palette-tokens($palette, $prefix) {
105
+ $palette: map.remove($palette, neutral, neutral-variant);
106
+ $result: ();
107
+ @each $hue, $value in $palette {
108
+ $result: map.set($result, '#{$prefix}#{$hue}', $value);
109
+ }
110
+ @return $result;
111
+ }
112
+
113
+ /// Creates a set of `md-ref-palette` tokens from the given palettes. (See
114
+ /// https://github.com/material-components/material-components-web/blob/master/packages/mdc-tokens/v0_161/_md-ref-palette.scss)
115
+ /// @param {Map} $primary The primary palette
116
+ /// @param {Map} $secondary The secondary palette
117
+ /// @param {Map} $tertiary The tertiary palette
118
+ /// @param {Map} $error The error palette
119
+ /// @return {Map} A set of `md-ref-palette` tokens
120
+ @function _generate-ref-palette-tokens($primary, $tertiary, $error) {
121
+ @return sass-utils.merge-all(
122
+ (black: #000, white: #fff),
123
+ _generate-palette-tokens($primary, primary),
124
+ _generate-palette-tokens(map.get($primary, secondary), secondary),
125
+ _generate-palette-tokens($tertiary, tertiary),
126
+ _generate-palette-tokens(map.get($primary, neutral), neutral),
127
+ _generate-palette-tokens(map.get($primary, neutral-variant), neutral-variant),
128
+ _generate-palette-tokens($error, error),
129
+ );
130
+ }
131
+
132
+ /// Creates a set of `md-ref-typeface` tokens from the given palettes. (See
133
+ /// https://github.com/material-components/material-components-web/blob/master/packages/mdc-tokens/v0_161/_md-ref-typeface.scss)
134
+ /// @param {List|String} $brand The font-family to use for brand text
135
+ /// @param {List|String} $plain The font-family to use for plain text
136
+ /// @param {String} $bold The font-weight to use for bold text
137
+ /// @param {String} $medium The font-weight to use for medium text
138
+ /// @param {String} $regular The font-weight to use for regular text
139
+ /// @return {Map} A set of `md-ref-typeface` tokens
140
+ @function _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular) {
141
+ @return (
142
+ brand: $brand,
143
+ plain: $plain,
144
+ weight-bold: $bold,
145
+ weight-medium: $medium,
146
+ weight-regular: $regular,
147
+ );
148
+ }
149
+
150
+ /// At the time of writing, some color tokens (e.g. disabled state) are defined as a solid color
151
+ /// token and a separate opacity token. This function applies the opacity to the color and drops the
152
+ /// opacity key from the map. Can be removed once b/213331407 is resolved.
153
+ /// @param {Map} $tokens The map of tokens currently being generated
154
+ /// @param {Map} $all-tokens A map of all tokens, including hardcoded values
155
+ /// @param {List} $pairs Pairs of color token names and their opacities. Should be in the shape of
156
+ /// `((color: 'color-key', opacity: 'opacity-key'))`.
157
+ /// @return {Map} The initial tokens with the combined color values.
158
+ @function _combine-color-tokens($tokens, $opacity-lookup, $pairs) {
159
+ $result: $tokens;
160
+
161
+ @each $pair in $pairs {
162
+ $color-key: map.get($pair, color);
163
+ $opacity-key: map.get($pair, opacity);
164
+ $color: map.get($tokens, $color-key);
165
+ $opacity: map.get($opacity-lookup, $opacity-key);
166
+
167
+ @if(meta.type-of($color) == 'color') {
168
+ $result: map.remove($result, $opacity-key);
169
+ $result: map.set($result, $color-key, rgba($color, $opacity));
170
+ }
171
+ @else if($color != null) {
172
+ $result: map.remove($result, $opacity-key);
173
+ $combined-color: #{color-mix(in srgb, #{$color} #{($opacity * 100) + '%'}, transparent)};
174
+ $result: map.set($result, $color-key, $combined-color);
175
+ }
176
+ }
177
+
178
+ @return $result;
179
+ }
180
+
181
+ /// Renames the official checkbox tokens to match the names actually used in MDC's code (which are
182
+ /// different). This is a temporary workaround until MDC updates to use the correct names for the
183
+ /// tokens.
184
+ /// @param {Map} $tokens The map of checkbox tokens with the official tokens names
185
+ /// @param {Map} $all-tokens Map of all checkbox tokens, including hardcoded values.
186
+ /// This is necessary in order to do opacity lookups.
187
+ /// @return {Map} The given tokens, renamed to be compatible with MDC's token implementation.
188
+ @function _fix-checkbox-tokens($tokens) {
189
+ // Need to get the hardcoded values, because they include opacities that are used for the disabled
190
+ // state.
191
+ $hardcoded-tokens: mdc-tokens.md-comp-checkbox-values((), false);
192
+
193
+ $rename-keys: (
194
+ selected-icon-color: selected-checkmark-color,
195
+ selected-disabled-icon-color: disabled-selected-checkmark-color,
196
+ selected-container-color: selected-icon-color,
197
+ selected-hover-container-color: selected-hover-icon-color,
198
+ selected-disabled-container-color: disabled-selected-icon-color,
199
+ selected-disabled-container-opacity: disabled-selected-icon-opacity,
200
+ selected-focus-container-color: selected-focus-icon-color,
201
+ selected-pressed-container-color: selected-pressed-icon-color,
202
+ unselected-disabled-outline-color: disabled-unselected-icon-color,
203
+ unselected-disabled-container-opacity: disabled-unselected-icon-opacity,
204
+ unselected-focus-outline-color: unselected-focus-icon-color,
205
+ unselected-hover-outline-color: unselected-hover-icon-color,
206
+ unselected-outline-color: unselected-icon-color,
207
+ unselected-pressed-outline-color: unselected-pressed-icon-color
208
+ );
209
+
210
+ $remapped-tokens: _rename-map-keys($tokens, $rename-keys);
211
+ $remapped-hardcoded-tokens: _rename-map-keys($hardcoded-tokens, $rename-keys);
212
+
213
+ @return _combine-color-tokens($remapped-tokens, $remapped-hardcoded-tokens, (
214
+ (
215
+ color: disabled-selected-icon-color,
216
+ opacity: disabled-selected-icon-opacity,
217
+ ),
218
+ (
219
+ color: disabled-unselected-icon-color,
220
+ opacity: disabled-unselected-icon-opacity,
221
+ ),
222
+ ));
223
+ }
224
+
225
+ /// Fixes inconsistent values in the filled text field tokens so that they can produce valid
226
+ /// styles.
227
+ /// @param {Map} $initial-tokens Map of filled text field tokens currently being generated.
228
+ /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
229
+ @function _fix-filled-text-field-tokens($initial-tokens) {
230
+ // Need to get the hardcoded values, because they include opacities that are used for the disabled
231
+ // state.
232
+ $hardcoded-tokens: mdc-tokens.md-comp-filled-text-field-values((), false);
233
+
234
+ $tokens: _combine-color-tokens($initial-tokens, $hardcoded-tokens, (
235
+ (
236
+ color: disabled-active-indicator-color,
237
+ opacity: disabled-active-indicator-opacity
238
+ ),
239
+ (
240
+ color: disabled-container-color,
241
+ opacity: disabled-container-opacity
242
+ ),
243
+ (
244
+ color: disabled-input-text-color,
245
+ opacity: disabled-input-text-opacity
246
+ ),
247
+ (
248
+ color: disabled-label-text-color,
249
+ opacity: disabled-label-text-opacity
250
+ ),
251
+ (
252
+ color: disabled-leading-icon-color,
253
+ opacity: disabled-leading-icon-opacity
254
+ ),
255
+ (
256
+ color: disabled-supporting-text-color,
257
+ opacity: disabled-supporting-text-opacity
258
+ ),
259
+ (
260
+ color: disabled-trailing-icon-color,
261
+ opacity: disabled-trailing-icon-opacity
262
+ )
263
+ ));
264
+
265
+ $container-shape: map.get($tokens, container-shape);
266
+
267
+ // The M2 token slots define a single `container-shape` slot while the M3 tokens provide a list
268
+ // of shapes (e.g. top/bottom/left/right). Extract the first value so it matches the expected
269
+ // token slot in M2.
270
+ @if meta.type-of($container-shape) == 'list' {
271
+ $tokens: map.set($tokens, container-shape, list.nth($container-shape, 1));
272
+ }
273
+
274
+ @return $tokens;
275
+ }
276
+
277
+
278
+ /// Fixes inconsistent values in the text button tokens so that they can produce valid styles.
279
+ /// @param {Map} $initial-tokens Map of text button tokens currently being generated.
280
+ /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
281
+ @function _fix-text-button-tokens($initial-tokens) {
282
+ // Need to get the hardcoded values, because they include opacities that are used for the disabled
283
+ // state.
284
+ $hardcoded-tokens: mdc-tokens.md-comp-text-button-values((), false);
285
+
286
+ @return _combine-color-tokens($initial-tokens, $hardcoded-tokens, (
287
+ (
288
+ color: disabled-label-text-color,
289
+ opacity: disabled-label-text-opacity,
290
+ ),
291
+ ));
292
+ }
293
+
294
+ /// Fixes inconsistent values in the filled button tokens so that they can produce valid styles.
295
+ /// @param {Map} $initial-tokens Map of filled button tokens currently being generated.
296
+ /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
297
+ @function _fix-filled-button-tokens($initial-tokens) {
298
+ // Need to get the hardcoded values, because they include opacities that are used for the disabled
299
+ // state.
300
+ $hardcoded-tokens: mdc-tokens.md-comp-filled-button-values((), false);
301
+
302
+ @return _combine-color-tokens($initial-tokens, $hardcoded-tokens, (
303
+ (
304
+ color: disabled-label-text-color,
305
+ opacity: disabled-label-text-opacity,
306
+ ),
307
+ (
308
+ color: disabled-container-color,
309
+ opacity: disabled-container-opacity,
310
+ )
311
+ ));
312
+ }
313
+
314
+ /// Fixes inconsistent values in the protected button tokens so that they can produce valid styles.
315
+ /// @param {Map} $initial-tokens Map of protected button tokens currently being generated.
316
+ /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
317
+ @function _fix-protected-button-tokens($initial-tokens) {
318
+ // Need to get the hardcoded values, because they include opacities that are used for the disabled
319
+ // state.
320
+ $hardcoded-tokens: mdc-tokens.md-comp-elevated-button-values((), false);
321
+
322
+ @return _combine-color-tokens($initial-tokens, $hardcoded-tokens, (
323
+ (
324
+ color: disabled-label-text-color,
325
+ opacity: disabled-label-text-opacity,
326
+ ),
327
+ (
328
+ color: disabled-container-color,
329
+ opacity: disabled-container-opacity,
330
+ )
331
+ ));
332
+ }
333
+
334
+ /// Fixes inconsistent values in the outlined button tokens so that they can produce valid styles.
335
+ /// @param {Map} $initial-tokens Map of outlined button tokens currently being generated.
336
+ /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
337
+ @function _fix-outlined-button-tokens($initial-tokens) {
338
+ $hardcoded-tokens: mdc-tokens.md-comp-outlined-button-values((), false);
339
+
340
+ @return _combine-color-tokens($initial-tokens, $hardcoded-tokens, (
341
+ (
342
+ color: disabled-label-text-color,
343
+ opacity: disabled-label-text-opacity,
344
+ ),
345
+ (
346
+ color: disabled-outline-color,
347
+ opacity: disabled-outline-opacity,
348
+ )
349
+ ));
350
+ }
351
+
352
+ /// Fixes inconsistent values in the outlined text field tokens so that they can produce valid
353
+ /// styles.
354
+ /// @param {Map} $initial-tokens Map of outlined text field tokens currently being generated.
355
+ /// @param {Map} $all-tokens Map of all outlined text field tokens, including hardcoded values.
356
+ /// This is necessary in order to do opacity lookups.
357
+ /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
358
+ @function _fix-outlined-text-field-tokens($initial-tokens) {
359
+ // Need to get the hardcoded values, because they include opacities that are used for the disabled
360
+ // state.
361
+ $hardcoded-tokens: mdc-tokens.md-comp-outlined-text-field-values((), false);
362
+
363
+ @return _combine-color-tokens($initial-tokens, $hardcoded-tokens, (
364
+ (
365
+ color: disabled-outline-color,
366
+ opacity: disabled-outline-opacity
367
+ ),
368
+ (
369
+ color: disabled-active-indicator-color,
370
+ opacity: disabled-active-indicator-opacity
371
+ ),
372
+ (
373
+ color: disabled-container-color,
374
+ opacity: disabled-container-opacity
375
+ ),
376
+ (
377
+ color: disabled-input-text-color,
378
+ opacity: disabled-input-text-opacity
379
+ ),
380
+ (
381
+ color: disabled-label-text-color,
382
+ opacity: disabled-label-text-opacity
383
+ ),
384
+ (
385
+ color: disabled-leading-icon-color,
386
+ opacity: disabled-leading-icon-opacity
387
+ ),
388
+ (
389
+ color: disabled-supporting-text-color,
390
+ opacity: disabled-supporting-text-opacity
391
+ ),
392
+ (
393
+ color: disabled-trailing-icon-color,
394
+ opacity: disabled-trailing-icon-opacity
395
+ )
396
+ ));
397
+ }
398
+
399
+ /// Gets the token values for the MDC form field.
400
+ /// @param {Map} $systems The MDC system tokens.
401
+ /// @return {Map} The form field tokens.
402
+ @function _get-form-field-tokens($systems) {
403
+ @return (
404
+ // TODO: MDC currently doesn't provide tokens for the form field so we need to
405
+ // define them ourselves. Clean this up once b/246297033 is resolved.
406
+ label-text-color: map.get($systems, 'md-sys-color', 'on-surface'),
407
+ label-text-font: map.get($systems, 'md-sys-typescale', 'body-medium-font'),
408
+ label-text-line-height: map.get($systems, 'md-sys-typescale', 'body-medium-line-height'),
409
+ label-text-size: map.get($systems, 'md-sys-typescale', 'body-medium-size'),
410
+ label-text-tracking: map.get($systems, 'md-sys-typescale', 'body-medium-tracking'),
411
+ label-text-weight: map.get($systems, 'md-sys-typescale', 'body-medium-weight'),
412
+ );
413
+ }
414
+
415
+ /// Fixes inconsistent values in the icon button tokens so that they can produce valid styles.
416
+ /// @param {Map} $initial-tokens Map of icon button tokens currently being generated.
417
+ /// @param {Map} $all-tokens Map of all icon button tokens, including hardcoded values.
418
+ /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
419
+ @function _fix-icon-button-tokens($tokens) {
420
+ // Need to get the hardcoded values, because they include opacities that are used for the disabled
421
+ // state.
422
+ $hardcoded-tokens: mdc-tokens.md-comp-icon-button-values((), false);
423
+
424
+ $rename-keys: (
425
+ unselected-icon-color: icon-color,
426
+ );
427
+
428
+ $remapped-tokens: _rename-map-keys($tokens, $rename-keys);
429
+ $remapped-hardcoded-tokens: _rename-map-keys($hardcoded-tokens, $rename-keys);
430
+
431
+ @return _combine-color-tokens($remapped-tokens, $remapped-hardcoded-tokens, (
432
+ (
433
+ color: disabled-icon-color,
434
+ opacity: disabled-icon-opacity,
435
+ ),
436
+ ));
437
+ }
438
+
439
+ /// Fixes inconsistent values in the dialog tokens so that they can produce valid styles.
440
+ /// @param {Map} $initial-tokens Map of dialog tokens currently being generated.
441
+ /// @param {Map} $all-tokens Map of all dialog tokens, including hardcoded values.
442
+ /// @return {Map} The given tokens, with the invalid values replaced with valid ones.
443
+ @function _fix-dialog-tokens($systems, $tokens) {
444
+ $tokens: _rename-map-keys($tokens, (
445
+ headline-color: subhead-color,
446
+ headline-font: subhead-font,
447
+ headline-line-height: subhead-line-height,
448
+ headline-size: subhead-size,
449
+ headline-tracking: subhead-tracking,
450
+ headline-weight: subhead-weight,
451
+ ));
452
+
453
+ @if map.get($tokens, container-elevation) != null {
454
+ $tokens: map.merge($tokens, (
455
+ // The spec has the dialog at an elevation of 3 which is consistent with the current
456
+ // version of the tokens (0_161), however both the designs and MDC's implementation
457
+ // have the elevation set to 0. Set it manually to 0 here since the value in the
458
+ // exported tokens is likely outdated.
459
+ container-elevation: 0,
460
+
461
+ // This color needs to be supplied for MDC to produce the shadow. Technically we don't
462
+ // have to provide it since the elevation is set to 0 above, but we do it in case
463
+ // the value changes in the future.
464
+ container-shadow-color: #000,
465
+ ));
466
+ }
467
+
468
+ @return $tokens;
469
+ }
470
+
471
+ /// Fixes values in the list tokens that are inconsistent with its usage.
472
+ /// @param {Map} $initial-tokens Map of list tokens currently being generated.
473
+ /// @return {Map} The given tokens, with the inconsistent values replaced with valid ones.
474
+ @function _fix-list-tokens($tokens) {
475
+ // This does not match the spec, which defines this to be `md.sys.color.surface`.
476
+ // However, this interferes with the use case of placing a list on other components. For example,
477
+ // the bottom sheet's container color is `md.sys.color.surface-container-low`. Instead, allow the
478
+ // list to just display the colors for its background.
479
+ @if map.get($tokens, list-item-container-color) != null {
480
+ $tokens: map.set($tokens, list-item-container-color, transparent);
481
+ }
482
+
483
+ // Match spec, which has list-item-leading-icon-size of 24px. Current version of tokens (0_161)
484
+ // has 18px.
485
+ @if map.get($tokens, list-item-leading-icon-size) != null {
486
+ $tokens: map.set($tokens, list-item-leading-icon-size, 24px);
487
+ }
488
+
489
+ @return $tokens;
490
+ }
491
+
492
+ /// Generates a set of namespaced tokens for all components.
493
+ /// @param {Map} $systems The MDC system tokens
494
+ /// @param {Boolean} $include-non-systemized Whether to include non-systemized tokens
495
+ /// @return {Map} A map of namespaced tokens
496
+ @function _generate-tokens($systems, $include-non-systemized: false) {
497
+ $systems: map.merge((
498
+ md-sys-color: (),
499
+ md-sys-elevation: (),
500
+ md-sys-motion: (),
501
+ md-sys-shape: (),
502
+ md-sys-state: (),
503
+ md-sys-typescale: ()
504
+ ), $systems);
505
+ $exclude-hardcoded: not $include-non-systemized;
506
+
507
+ // DO NOT REMOVE
508
+ // This function is used internally.
509
+ $systems: format-tokens.private-format-tokens($systems);
510
+
511
+ // TODO(mmalerba): Refactor this to not depend on the legacy theme when moving out of
512
+ // material-experimental. This is a hack for now because there is no good way to get the token
513
+ // slots in material-experimental without exposing them all from material.
514
+ $fake-theme: m2-theming.define-light-theme((
515
+ color: (
516
+ primary: m2-theming.define-palette(m2-theming.$red-palette),
517
+ accent: m2-theming.define-palette(m2-theming.$red-palette),
518
+ warn: m2-theming.define-palette(m2-theming.$red-palette),
519
+ ),
520
+ typography: m2-theming.define-typography-config(),
521
+ density: 0
522
+ ));
523
+ $token-slots: m2-tokens.m2-tokens-from-theme($fake-theme);
524
+
525
+ // TODO(mmalerba): Fill in remaining tokens.
526
+ $result: sass-utils.deep-merge-all(
527
+ // Add the system color & typography tokens (so we can give users access via an API).
528
+ (
529
+ (mdc, theme): map.get($systems, md-sys-color),
530
+ (mdc, typography): map.get($systems, md-sys-typescale),
531
+ ),
532
+ // Get the official MDC component tokens
533
+ _namespace-tokens(
534
+ (mdc, checkbox),
535
+ (
536
+ _fix-checkbox-tokens(mdc-tokens.md-comp-checkbox-values($systems, $exclude-hardcoded)),
537
+ _map-values(
538
+ custom-tokens.mdc-checkbox-color-variants($systems, $exclude-hardcoded),
539
+ meta.get-function(_fix-checkbox-tokens)
540
+ )
541
+ ),
542
+ $token-slots
543
+ ),
544
+ _namespace-tokens(
545
+ (mdc, chip),
546
+ custom-tokens.mdc-chip($systems, $exclude-hardcoded),
547
+ $token-slots
548
+ ),
549
+ _namespace-tokens(
550
+ (mdc, circular-progress),
551
+ (
552
+ mdc-tokens.md-comp-circular-progress-indicator-values($systems, $exclude-hardcoded),
553
+ custom-tokens.mdc-circular-progress-color-variants($systems, $exclude-hardcoded),
554
+ ),
555
+ $token-slots
556
+ ),
557
+ _namespace-tokens(
558
+ (mdc, dialog),
559
+ _fix-dialog-tokens($systems, mdc-tokens.md-comp-dialog-values($systems, $exclude-hardcoded)),
560
+ $token-slots
561
+ ),
562
+ _namespace-tokens(
563
+ (mdc, elevated-card),
564
+ mdc-tokens.md-comp-elevated-card-values($systems, $exclude-hardcoded),
565
+ $token-slots
566
+ ),
567
+ _namespace-tokens(
568
+ (mdc, fab),
569
+ (
570
+ mdc-tokens.md-comp-fab-primary-values($systems, $exclude-hardcoded),
571
+ (
572
+ // Color variants
573
+ primary: (), // Default, no overrides needed.
574
+ secondary: mdc-tokens.md-comp-fab-secondary-values($systems, $exclude-hardcoded),
575
+ tertiary: mdc-tokens.md-comp-fab-tertiary-values($systems, $exclude-hardcoded)
576
+ )
577
+ ),
578
+ $token-slots
579
+ ),
580
+ _namespace-tokens(
581
+ (mdc, fab-small),
582
+ (
583
+ mdc-tokens.md-comp-fab-primary-small-values($systems, $exclude-hardcoded),
584
+ (
585
+ // Color variants
586
+ primary: (), // Default, no overrides needed.
587
+ secondary: mdc-tokens.md-comp-fab-secondary-small-values($systems, $exclude-hardcoded),
588
+ tertiary: mdc-tokens.md-comp-fab-tertiary-small-values($systems, $exclude-hardcoded)
589
+ )
590
+ ),
591
+ $token-slots
592
+ ),
593
+ _namespace-tokens(
594
+ (mdc, extended-fab),
595
+ (
596
+ mdc-tokens.md-comp-extended-fab-primary-values($systems, $exclude-hardcoded),
597
+ (
598
+ // Color variants
599
+ primary: (), // Default, no overrides needed.
600
+ secondary: mdc-tokens.md-comp-extended-fab-secondary-values($systems, $exclude-hardcoded),
601
+ tertiary: mdc-tokens.md-comp-extended-fab-tertiary-values($systems, $exclude-hardcoded)
602
+ ),
603
+ ),
604
+ $token-slots
605
+ ),
606
+ _namespace-tokens(
607
+ (mdc, filled-text-field),
608
+ (
609
+ _fix-filled-text-field-tokens(
610
+ mdc-tokens.md-comp-filled-text-field-values($systems, $exclude-hardcoded)
611
+ ),
612
+ _map-values(
613
+ custom-tokens.mdc-filled-text-field-color-variants($systems, $exclude-hardcoded),
614
+ meta.get-function(_fix-filled-text-field-tokens)
615
+ )
616
+ ),
617
+ $token-slots
618
+ ),
619
+ _namespace-tokens(
620
+ (mdc, form-field),
621
+ _get-form-field-tokens($systems),
622
+ $token-slots
623
+ ),
624
+ _namespace-tokens(
625
+ (mdc, icon-button),
626
+ _fix-icon-button-tokens(mdc-tokens.md-comp-icon-button-values($systems, $exclude-hardcoded)),
627
+ $token-slots
628
+ ),
629
+ _namespace-tokens(
630
+ (mdc, text-button),
631
+ (
632
+ _fix-text-button-tokens(
633
+ mdc-tokens.md-comp-text-button-values($systems, $exclude-hardcoded)
634
+ ),
635
+ _map-values(
636
+ custom-tokens.mdc-text-button-color-variants($systems, $exclude-hardcoded),
637
+ meta.get-function(_fix-text-button-tokens)
638
+ )
639
+ ),
640
+ $token-slots
641
+ ),
642
+ _namespace-tokens(
643
+ // Note: in M3 the "protected" button is called "elevated".
644
+ (mdc, protected-button),
645
+ (
646
+ _fix-protected-button-tokens(
647
+ mdc-tokens.md-comp-elevated-button-values($systems, $exclude-hardcoded)
648
+ ),
649
+ _map-values(
650
+ custom-tokens.mdc-elevated-button-color-variants($systems, $exclude-hardcoded),
651
+ meta.get-function(_fix-protected-button-tokens)
652
+ )
653
+ ),
654
+ $token-slots
655
+ ),
656
+ _namespace-tokens(
657
+ (mdc, filled-button),
658
+ (
659
+ _fix-filled-button-tokens(
660
+ mdc-tokens.md-comp-filled-button-values($systems, $exclude-hardcoded),
661
+ ),
662
+ _map-values(
663
+ custom-tokens.mdc-filled-button-color-variants($systems, $exclude-hardcoded),
664
+ meta.get-function(_fix-filled-button-tokens)
665
+ )
666
+ ),
667
+ $token-slots
668
+ ),
669
+ _namespace-tokens(
670
+ (mdc, outlined-button),
671
+ (
672
+ _fix-outlined-button-tokens(
673
+ mdc-tokens.md-comp-outlined-button-values($systems, $exclude-hardcoded),
674
+ ),
675
+ _map-values(
676
+ custom-tokens.mdc-outlined-button-color-variants($systems, $exclude-hardcoded),
677
+ meta.get-function(_fix-outlined-button-tokens)
678
+ )
679
+ ),
680
+ $token-slots
681
+ ),
682
+ _namespace-tokens(
683
+ (mdc, linear-progress),
684
+ (
685
+ mdc-tokens.md-comp-linear-progress-indicator-values($systems, $exclude-hardcoded),
686
+ custom-tokens.mdc-linear-progress-color-variants($systems, $exclude-hardcoded),
687
+ ),
688
+ $token-slots
689
+ ),
690
+ _namespace-tokens(
691
+ (mdc, list),
692
+ _fix-list-tokens(
693
+ mdc-tokens.md-comp-list-values($systems, $exclude-hardcoded)
694
+ ),
695
+ $token-slots
696
+ ),
697
+ _namespace-tokens(
698
+ (mdc, outlined-card),
699
+ mdc-tokens.md-comp-outlined-card-values($systems, $exclude-hardcoded),
700
+ $token-slots
701
+ ),
702
+ _namespace-tokens(
703
+ (mdc, outlined-text-field),
704
+ (
705
+ _fix-outlined-text-field-tokens(
706
+ mdc-tokens.md-comp-outlined-text-field-values($systems, $exclude-hardcoded)
707
+ ),
708
+ _map-values(
709
+ custom-tokens.mdc-outlined-text-field-color-variants($systems, $exclude-hardcoded),
710
+ meta.get-function(_fix-outlined-text-field-tokens)
711
+ )
712
+ ),
713
+ $token-slots
714
+ ),
715
+ _namespace-tokens(
716
+ (mdc, plain-tooltip),
717
+ mdc-tokens.md-comp-plain-tooltip-values($systems, $exclude-hardcoded),
718
+ $token-slots
719
+ ),
720
+ _namespace-tokens(
721
+ (mdc, radio),
722
+ (
723
+ mdc-tokens.md-comp-radio-button-values($systems, $exclude-hardcoded),
724
+ custom-tokens.mdc-radio-color-variants($systems, $exclude-hardcoded)
725
+ ),
726
+ $token-slots
727
+ ),
728
+ _namespace-tokens(
729
+ (mdc, slider),
730
+ (
731
+ mdc-tokens.md-comp-slider-values($systems, $exclude-hardcoded),
732
+ custom-tokens.mdc-slider-color-variants($systems, $exclude-hardcoded)
733
+ ),
734
+ $token-slots
735
+ ),
736
+ _namespace-tokens(
737
+ (mdc, snackbar),
738
+ mdc-tokens.md-comp-snackbar-values($systems, $exclude-hardcoded),
739
+ $token-slots,
740
+ ),
741
+ _namespace-tokens(
742
+ (mdc, switch),
743
+ (
744
+ mdc-tokens.md-comp-switch-values($systems, $exclude-hardcoded),
745
+ custom-tokens.mdc-switch-color-variants($systems, $exclude-hardcoded)
746
+ ),
747
+ $token-slots
748
+ ),
749
+ _namespace-tokens(
750
+ (mdc, tab),
751
+ mdc-tokens.md-comp-secondary-navigation-tab-values($systems, $exclude-hardcoded),
752
+ $token-slots
753
+ ),
754
+
755
+ // Choose values for our made up tokens based on MDC system tokens or sensible hardcoded
756
+ // values.
757
+ _namespace-tokens(
758
+ (mat, app),
759
+ custom-tokens.app($systems, $exclude-hardcoded),
760
+ $token-slots
761
+ ),
762
+ _namespace-tokens(
763
+ (mdc, tab-indicator),
764
+ custom-tokens.tab-indicator($systems, $exclude-hardcoded),
765
+ $token-slots
766
+ ),
767
+ _namespace-tokens(
768
+ (mat, autocomplete),
769
+ custom-tokens.autocomplete($systems, $exclude-hardcoded),
770
+ $token-slots
771
+ ),
772
+ _namespace-tokens(
773
+ (mat, badge),
774
+ custom-tokens.badge($systems, $exclude-hardcoded),
775
+ $token-slots
776
+ ),
777
+ _namespace-tokens(
778
+ (mat, bottom-sheet),
779
+ custom-tokens.bottom-sheet($systems, $exclude-hardcoded),
780
+ $token-slots
781
+ ),
782
+ _namespace-tokens(
783
+ (mat, card),
784
+ custom-tokens.card($systems, $exclude-hardcoded),
785
+ $token-slots
786
+ ),
787
+ _namespace-tokens(
788
+ (mat, chip),
789
+ custom-tokens.chip($systems, $exclude-hardcoded),
790
+ $token-slots
791
+ ),
792
+ _namespace-tokens(
793
+ (mat, datepicker),
794
+ custom-tokens.datepicker($systems, $exclude-hardcoded),
795
+ $token-slots
796
+ ),
797
+ _namespace-tokens(
798
+ (mat, dialog),
799
+ custom-tokens.dialog($systems, $exclude-hardcoded),
800
+ $token-slots
801
+ ),
802
+ _namespace-tokens(
803
+ (mat, divider),
804
+ custom-tokens.divider($systems, $exclude-hardcoded),
805
+ $token-slots
806
+ ),
807
+ _namespace-tokens(
808
+ (mat, fab),
809
+ custom-tokens.fab($systems, $exclude-hardcoded),
810
+ $token-slots
811
+ ),
812
+ _namespace-tokens(
813
+ (mat, fab-small),
814
+ custom-tokens.fab-small($systems, $exclude-hardcoded),
815
+ $token-slots
816
+ ),
817
+ _namespace-tokens(
818
+ (mat, form-field),
819
+ custom-tokens.form-field($systems, $exclude-hardcoded),
820
+ $token-slots
821
+ ),
822
+ _namespace-tokens(
823
+ (mat, expansion),
824
+ custom-tokens.expansion($systems, $exclude-hardcoded),
825
+ $token-slots
826
+ ),
827
+ _namespace-tokens(
828
+ (mat, grid-list),
829
+ custom-tokens.grid-list($systems, $exclude-hardcoded),
830
+ $token-slots
831
+ ),
832
+ _namespace-tokens(
833
+ (mat, icon),
834
+ custom-tokens.icon($systems, $exclude-hardcoded),
835
+ $token-slots
836
+ ),
837
+ _namespace-tokens(
838
+ (mat, text-button),
839
+ custom-tokens.text-button($systems, $exclude-hardcoded),
840
+ $token-slots
841
+ ),
842
+ _namespace-tokens(
843
+ (mat, filled-button),
844
+ custom-tokens.filled-button($systems, $exclude-hardcoded),
845
+ $token-slots
846
+ ),
847
+ _namespace-tokens(
848
+ (mat, list),
849
+ custom-tokens.list($systems, $exclude-hardcoded),
850
+ $token-slots
851
+ ),
852
+ _namespace-tokens(
853
+ // Note: in M3 the "protected" button is called "elevated".
854
+ (mat, protected-button),
855
+ custom-tokens.elevated-button($systems, $exclude-hardcoded),
856
+ $token-slots
857
+ ),
858
+ _namespace-tokens(
859
+ (mat, outlined-button),
860
+ custom-tokens.outlined-button($systems, $exclude-hardcoded),
861
+ $token-slots
862
+ ),
863
+ _namespace-tokens(
864
+ (mat, icon-button),
865
+ custom-tokens.icon-button($systems, $exclude-hardcoded),
866
+ $token-slots
867
+ ),
868
+ _namespace-tokens(
869
+ (mat, menu),
870
+ custom-tokens.menu($systems, $exclude-hardcoded),
871
+ $token-slots
872
+ ),
873
+ _namespace-tokens(
874
+ (mat, optgroup),
875
+ custom-tokens.optgroup($systems, $exclude-hardcoded),
876
+ $token-slots
877
+ ),
878
+ _namespace-tokens(
879
+ (mat, option),
880
+ custom-tokens.option($systems, $exclude-hardcoded),
881
+ $token-slots
882
+ ),
883
+ _namespace-tokens(
884
+ (mat, paginator),
885
+ custom-tokens.paginator($systems, $exclude-hardcoded),
886
+ $token-slots
887
+ ),
888
+ _namespace-tokens(
889
+ (mat, full-pseudo-checkbox),
890
+ custom-tokens.full-pseudo-checkbox($systems, $exclude-hardcoded),
891
+ $token-slots
892
+ ),
893
+ _namespace-tokens(
894
+ (mat, minimal-pseudo-checkbox),
895
+ custom-tokens.minimal-pseudo-checkbox($systems, $exclude-hardcoded),
896
+ $token-slots
897
+ ),
898
+ _namespace-tokens(
899
+ (mat, checkbox),
900
+ custom-tokens.checkbox($systems, $exclude-hardcoded),
901
+ $token-slots
902
+ ),
903
+ _namespace-tokens(
904
+ (mat, radio),
905
+ custom-tokens.radio($systems, $exclude-hardcoded),
906
+ $token-slots
907
+ ),
908
+ _namespace-tokens(
909
+ (mat, ripple),
910
+ custom-tokens.ripple($systems, $exclude-hardcoded),
911
+ $token-slots
912
+ ),
913
+ _namespace-tokens(
914
+ (mat, select),
915
+ custom-tokens.select($systems, $exclude-hardcoded),
916
+ $token-slots
917
+ ),
918
+ _namespace-tokens(
919
+ (mat, sidenav),
920
+ custom-tokens.sidenav($systems, $exclude-hardcoded),
921
+ $token-slots
922
+ ),
923
+ _namespace-tokens(
924
+ (mat, slider),
925
+ custom-tokens.slider($systems, $exclude-hardcoded),
926
+ $token-slots
927
+ ),
928
+ _namespace-tokens(
929
+ (mat, snack-bar),
930
+ custom-tokens.snack-bar($systems, $exclude-hardcoded),
931
+ $token-slots
932
+ ),
933
+ _namespace-tokens(
934
+ (mat, sort),
935
+ custom-tokens.sort($systems, $exclude-hardcoded),
936
+ $token-slots
937
+ ),
938
+ _namespace-tokens(
939
+ (mat, standard-button-toggle),
940
+ custom-tokens.button-toggle($systems, $exclude-hardcoded),
941
+ $token-slots
942
+ ),
943
+ _namespace-tokens(
944
+ (mat, stepper),
945
+ custom-tokens.stepper($systems, $exclude-hardcoded),
946
+ $token-slots
947
+ ),
948
+ _namespace-tokens(
949
+ (mat, switch),
950
+ custom-tokens.switch($systems, $exclude-hardcoded),
951
+ $token-slots
952
+ ),
953
+ _namespace-tokens(
954
+ (mat, tab-header),
955
+ custom-tokens.tab-header($systems, $exclude-hardcoded),
956
+ $token-slots
957
+ ),
958
+ _namespace-tokens(
959
+ (mat, table),
960
+ custom-tokens.table($systems, $exclude-hardcoded),
961
+ $token-slots
962
+ ),
963
+ _namespace-tokens(
964
+ (mat, toolbar),
965
+ custom-tokens.toolbar($systems, $exclude-hardcoded),
966
+ $token-slots,
967
+ ),
968
+ _namespace-tokens(
969
+ (mat, tree),
970
+ custom-tokens.tree($systems, $exclude-hardcoded),
971
+ $token-slots
972
+ ),
973
+ );
974
+
975
+ // Strip out tokens that are systemized by our made up density system.
976
+ @each $namespace, $tokens in $result {
977
+ @each $token, $value in $tokens {
978
+ @if density.is-systemized($namespace, $token) {
979
+ $tokens: map.remove($tokens, $token);
980
+ }
981
+ }
982
+ $result: map.set($result, $namespace, $tokens);
983
+ }
984
+ @return $result;
985
+ }
986
+
987
+ @mixin system-level-colors($theme, $overrides: ()) {
988
+ $palettes: map.get($theme, _mat-theming-internals-do-not-access, palettes);
989
+ $base-palettes: (
990
+ neutral: map.get($palettes, neutral),
991
+ neutral-variant: map.get($palettes, neutral-variant),
992
+ secondary: map.get($palettes, secondary),
993
+ error: map.get($palettes, error),
994
+ );
995
+
996
+ $type: map.get($theme, _mat-theming-internals-do-not-access, theme-type);
997
+ $primary: map.merge(map.get($palettes, primary), $base-palettes);
998
+ $tertiary: map.merge(map.get($palettes, tertiary), $base-palettes);
999
+ $error: map.get($palettes, error);
1000
+
1001
+ $ref: (
1002
+ md-ref-palette: _generate-ref-palette-tokens($primary, $tertiary, $error)
1003
+ );
1004
+
1005
+ $sys-colors: if($type == dark,
1006
+ mdc-tokens.md-sys-color-values-dark($ref),
1007
+ mdc-tokens.md-sys-color-values-light($ref));
1008
+
1009
+ @each $name, $value in $sys-colors {
1010
+ --sys-#{$name}: #{map.get($overrides, $name) or $value};
1011
+ }
1012
+ }
1013
+
1014
+ @mixin system-level-typography($theme, $overrides: ()) {
1015
+ $font-definition: map.get($theme, _mat-theming-internals-do-not-access, font-definition);
1016
+ $brand: map.get($font-definition, brand);
1017
+ $plain: map.get($font-definition, plain);
1018
+ $bold: map.get($font-definition, bold);
1019
+ $medium: map.get($font-definition, medium);
1020
+ $regular: map.get($font-definition, regular);
1021
+
1022
+ $ref: (
1023
+ md-ref-typeface: _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular)
1024
+ );
1025
+
1026
+ $sys-typescale: mdc-tokens.md-sys-typescale-values($ref);
1027
+
1028
+ @each $name, $value in $sys-typescale {
1029
+ --sys-#{$name}: #{map.get($overrides, $name) or $value};
1030
+ }
1031
+ }
1032
+
1033
+ @function _get-sys-color($type, $ref) {
1034
+ @if (sass-utils.$use-system-color-variables) {
1035
+ @return (
1036
+ 'background': var(--sys-background),
1037
+ 'error': var(--sys-error),
1038
+ 'error-container': var(--sys-error-container),
1039
+ 'inverse-on-surface': var(--sys-inverse-on-surface),
1040
+ 'inverse-primary': var(--sys-inverse-primary),
1041
+ 'inverse-surface': var(--sys-inverse-surface),
1042
+ 'on-background': var(--sys-on-background),
1043
+ 'on-error': var(--sys-on-error),
1044
+ 'on-error-container': var(--sys-on-error-container),
1045
+ 'on-primary': var(--sys-on-primary),
1046
+ 'on-primary-container': var(--sys-on-primary-container),
1047
+ 'on-primary-fixed': var(--sys-on-primary-fixed),
1048
+ 'on-primary-fixed-variant': var(--sys-on-primary-fixed-variant),
1049
+ 'on-secondary': var(--sys-on-secondary),
1050
+ 'on-secondary-container': var(--sys-on-secondary-container),
1051
+ 'on-secondary-fixed': var(--sys-on-secondary-fixed),
1052
+ 'on-secondary-fixed-variant': var(--sys-on-secondary-fixed-variant),
1053
+ 'on-surface': var(--sys-on-surface),
1054
+ 'on-surface-variant': var(--sys-on-surface-variant),
1055
+ 'on-tertiary': var(--sys-on-tertiary),
1056
+ 'on-tertiary-container': var(--sys-on-tertiary-container),
1057
+ 'on-tertiary-fixed': var(--sys-on-tertiary-fixed),
1058
+ 'on-tertiary-fixed-variant': var(--sys-on-tertiary-fixed-variant),
1059
+ 'outline': var(--sys-outline),
1060
+ 'outline-variant': var(--sys-outline-variant),
1061
+ 'primary': var(--sys-primary),
1062
+ 'primary-container': var(--sys-primary-container),
1063
+ 'primary-fixed': var(--sys-primary-fixed),
1064
+ 'primary-fixed-dim': var(--sys-primary-fixed-dim),
1065
+ 'scrim': var(--sys-scrim),
1066
+ 'secondary': var(--sys-secondary),
1067
+ 'secondary-container': var(--sys-secondary-container),
1068
+ 'secondary-fixed': var(--sys-secondary-fixed),
1069
+ 'secondary-fixed-dim': var(--sys-secondary-fixed-dim),
1070
+ 'shadow': var(--sys-shadow),
1071
+ 'surface': var(--sys-surface),
1072
+ 'surface-bright': var(--sys-surface-bright),
1073
+ 'surface-container': var(--sys-surface-container),
1074
+ 'surface-container-high': var(--sys-surface-container-high),
1075
+ 'surface-container-highest': var(--sys-surface-container-highest),
1076
+ 'surface-container-low': var(--sys-surface-container-low),
1077
+ 'surface-container-lowest': var(--sys-surface-container-lowest),
1078
+ 'surface-dim': var(--sys-surface-dim),
1079
+ 'surface-tint': var(--sys-surface-tint),
1080
+ 'surface-variant': var(--sys-surface-variant),
1081
+ 'tertiary': var(--sys-tertiary),
1082
+ 'tertiary-container': var(--sys-tertiary-container),
1083
+ 'tertiary-fixed': var(--sys-tertiary-fixed),
1084
+ 'tertiary-fixed-dim': var(--sys-tertiary-fixed-dim),
1085
+ );
1086
+ }
1087
+
1088
+ @return if($type == dark,
1089
+ mdc-tokens.md-sys-color-values-dark($ref),
1090
+ mdc-tokens.md-sys-color-values-light($ref));
1091
+ }
1092
+
1093
+ @function _get-sys-typeface($ref) {
1094
+ @if (sass-utils.$use-system-typography-variables) {
1095
+ @return (
1096
+ 'body-large': var(--sys-body-large),
1097
+ 'body-large-font': var(--sys-body-large-font),
1098
+ 'body-large-line-height': var(--sys-body-large-line-height),
1099
+ 'body-large-size': var(--sys-body-large-size),
1100
+ 'body-large-tracking': var(--sys-body-large-tracking),
1101
+ 'body-large-weight': var(--sys-body-large-weight),
1102
+ 'body-medium': var(--sys-body-medium),
1103
+ 'body-medium-font': var(--sys-body-medium-font),
1104
+ 'body-medium-line-height': var(--sys-body-medium-line-height),
1105
+ 'body-medium-size': var(--sys-body-medium-size),
1106
+ 'body-medium-tracking': var(--sys-body-medium-tracking),
1107
+ 'body-medium-weight': var(--sys-body-medium-weight),
1108
+ 'body-small': var(--sys-body-small),
1109
+ 'body-small-font': var(--sys-body-small-font),
1110
+ 'body-small-line-height': var(--sys-body-small-line-height),
1111
+ 'body-small-size': var(--sys-body-small-size),
1112
+ 'body-small-tracking': var(--sys-body-small-tracking),
1113
+ 'body-small-weight': var(--sys-body-small-weight),
1114
+ 'display-large': var(--sys-display-large),
1115
+ 'display-large-font': var(--sys-display-large-font),
1116
+ 'display-large-line-height': var(--sys-display-large-line-height),
1117
+ 'display-large-size': var(--sys-display-large-size),
1118
+ 'display-large-tracking': var(--sys-display-large-tracking),
1119
+ 'display-large-weight': var(--sys-display-large-weight),
1120
+ 'display-medium': var(--sys-display-medium),
1121
+ 'display-medium-font': var(--sys-display-medium-font),
1122
+ 'display-medium-line-height': var(--sys-display-medium-line-height),
1123
+ 'display-medium-size': var(--sys-display-medium-size),
1124
+ 'display-medium-tracking': var(--sys-display-medium-tracking),
1125
+ 'display-medium-weight': var(--sys-display-medium-weight),
1126
+ 'display-small': var(--sys-display-small),
1127
+ 'display-small-font': var(--sys-display-small-font),
1128
+ 'display-small-line-height': var(--sys-display-small-line-height),
1129
+ 'display-small-size': var(--sys-display-small-size),
1130
+ 'display-small-tracking': var(--sys-display-small-tracking),
1131
+ 'display-small-weight': var(--sys-display-small-weight),
1132
+ 'headline-large': var(--sys-headline-large),
1133
+ 'headline-large-font': var(--sys-headline-large-font),
1134
+ 'headline-large-line-height': var(--sys-headline-large-line-height),
1135
+ 'headline-large-size': var(--sys-headline-large-size),
1136
+ 'headline-large-tracking': var(--sys-headline-large-tracking),
1137
+ 'headline-large-weight': var(--sys-headline-large-weight),
1138
+ 'headline-medium': var(--sys-headline-medium),
1139
+ 'headline-medium-font': var(--sys-headline-medium-font),
1140
+ 'headline-medium-line-height': var(--sys-headline-medium-line-height),
1141
+ 'headline-medium-size': var(--sys-headline-medium-size),
1142
+ 'headline-medium-tracking': var(--sys-headline-medium-tracking),
1143
+ 'headline-medium-weight': var(--sys-headline-medium-weight),
1144
+ 'headline-small': var(--sys-headline-small),
1145
+ 'headline-small-font': var(--sys-headline-small-font),
1146
+ 'headline-small-line-height': var(--sys-headline-small-line-height),
1147
+ 'headline-small-size': var(--sys-headline-small-size),
1148
+ 'headline-small-tracking': var(--sys-headline-small-tracking),
1149
+ 'headline-small-weight': var(--sys-headline-small-weight),
1150
+ 'label-large': var(--sys-label-large),
1151
+ 'label-large-font': var(--sys-label-large-font),
1152
+ 'label-large-line-height': var(--sys-label-large-line-height),
1153
+ 'label-large-size': var(--sys-label-large-size),
1154
+ 'label-large-tracking': var(--sys-label-large-tracking),
1155
+ 'label-large-weight': var(--sys-label-large-weight),
1156
+ 'label-large-weight-prominent': var(--sys-label-large-weight-prominent),
1157
+ 'label-medium': var(--sys-label-medium),
1158
+ 'label-medium-font': var(--sys-label-medium-font),
1159
+ 'label-medium-line-height': var(--sys-label-medium-line-height),
1160
+ 'label-medium-size': var(--sys-label-medium-size),
1161
+ 'label-medium-tracking': var(--sys-label-medium-tracking),
1162
+ 'label-medium-weight': var(--sys-label-medium-weight),
1163
+ 'label-medium-weight-prominent': var(--sys-label-medium-weight-prominent),
1164
+ 'label-small': var(--sys-label-small),
1165
+ 'label-small-font': var(--sys-label-small-font),
1166
+ 'label-small-line-height': var(--sys-label-small-line-height),
1167
+ 'label-small-size': var(--sys-label-small-size),
1168
+ 'label-small-tracking': var(--sys-label-small-tracking),
1169
+ 'label-small-weight': var(--sys-label-small-weight),
1170
+ 'title-large': var(--sys-title-large),
1171
+ 'title-large-font': var(--sys-title-large-font),
1172
+ 'title-large-line-height': var(--sys-title-large-line-height),
1173
+ 'title-large-size': var(--sys-title-large-size),
1174
+ 'title-large-tracking': var(--sys-title-large-tracking),
1175
+ 'title-large-weight': var(--sys-title-large-weight),
1176
+ 'title-medium': var(--sys-title-medium),
1177
+ 'title-medium-font': var(--sys-title-medium-font),
1178
+ 'title-medium-line-height': var(--sys-title-medium-line-height),
1179
+ 'title-medium-size': var(--sys-title-medium-size),
1180
+ 'title-medium-tracking': var(--sys-title-medium-tracking),
1181
+ 'title-medium-weight': var(--sys-title-medium-weight),
1182
+ 'title-small': var(--sys-title-small),
1183
+ 'title-small-font': var(--sys-title-small-font),
1184
+ 'title-small-line-height': var(--sys-title-small-line-height),
1185
+ 'title-small-size': var(--sys-title-small-size),
1186
+ 'title-small-tracking': var(--sys-title-small-tracking),
1187
+ 'title-small-weight': var(--sys-title-small-weight),
1188
+ );
1189
+ }
1190
+ @return mdc-tokens.md-sys-typescale-values($ref);
1191
+ }
1192
+
1193
+ /// Generates a set of namespaced color tokens for all components.
1194
+ /// @param {String} $type The type of theme system (light or dark)
1195
+ /// @param {Map} $primary The primary palette
1196
+ /// @param {Map} $tertiary The tertiary palette
1197
+ /// @param {Map} $error The error palette
1198
+ /// @return {Map} A map of namespaced color tokens
1199
+ @function generate-color-tokens($type, $primary, $tertiary, $error) {
1200
+ $ref: (
1201
+ md-ref-palette: _generate-ref-palette-tokens($primary, $tertiary, $error)
1202
+ );
1203
+
1204
+ $sys-color: _get-sys-color($type, $ref);
1205
+
1206
+ @return _generate-tokens(map.merge($ref, (
1207
+ md-sys-color: $sys-color,
1208
+ // Because the elevation values are always combined with color values to create the box shadow,
1209
+ // elevation needs to be part of the color dimension.
1210
+ md-sys-elevation: mdc-tokens.md-sys-elevation-values(),
1211
+ // Because the state values are sometimes combined with color values to create rgba colors,
1212
+ // state needs to be part of color dimension.
1213
+ // TODO(mmalerba): If at some point we remove the need for these combined values, we can move
1214
+ // state to the base dimension.
1215
+ md-sys-state: mdc-tokens.md-sys-state-values(),
1216
+ )));
1217
+ }
1218
+
1219
+ /// Generates a set of namespaced color tokens for all components.
1220
+ /// @param {String|List} $brand The brand font-family
1221
+ /// @param {String|List} $plain The plain fort-family
1222
+ /// @param {String|Number} $bold The bold font-weight
1223
+ /// @param {String|Number} $medium The medium font-weight
1224
+ /// @param {String|Number} $regular The regular font-weight
1225
+ /// @return {Map} A map of namespaced typography tokens
1226
+ @function generate-typography-tokens($brand, $plain, $bold, $medium, $regular) {
1227
+ $ref: (
1228
+ md-ref-typeface: _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular)
1229
+ );
1230
+ $sys-typeface: _get-sys-typeface($ref);
1231
+ @return _generate-tokens((
1232
+ md-sys-typescale: $sys-typeface
1233
+ ));
1234
+ }
1235
+
1236
+ /// Generates a set of namespaced density tokens for all components.
1237
+ /// @param {String|Number} $scale The regular font-weight
1238
+ /// @return {Map} A map of namespaced density tokens
1239
+ @function generate-density-tokens($scale) {
1240
+ @return density.get-tokens-for-scale($scale);
1241
+ }
1242
+
1243
+ /// Generates a set of namespaced tokens not related to color, typography, or density for all
1244
+ /// components.
1245
+ /// @return {Map} A map of namespaced tokens not related to color, typography, or density
1246
+ @function generate-base-tokens() {
1247
+ // TODO(mmalerba): Exclude density tokens once implemented.
1248
+ @return _generate-tokens((
1249
+ md-sys-motion: mdc-tokens.md-sys-motion-values(),
1250
+ md-sys-shape: mdc-tokens.md-sys-shape-values(),
1251
+ ), $include-non-systemized: true);
1252
+ }