@ng-matero/extensions 17.3.5 → 18.0.1

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 (179) hide show
  1. package/README.md +11 -0
  2. package/_index.scss +6 -0
  3. package/alert/_alert-theme.scss +2 -3
  4. package/colorpicker/_colorpicker-theme.scss +2 -3
  5. package/colorpicker/colorpicker.d.ts +4 -4
  6. package/{experimental/theming/_color-api-back-compat.scss → core/theming/_color-api-backwards-compatibility.scss} +1 -1
  7. package/{experimental → core}/theming/_config-validation.scss +11 -5
  8. package/{experimental → core}/theming/_definition.scss +4 -3
  9. package/core/theming/prebuilt/azure-blue.scss +26 -0
  10. package/core/theming/prebuilt/cyan-orange.scss +26 -0
  11. package/core/theming/prebuilt/deeppurple-amber.scss +4 -4
  12. package/core/theming/prebuilt/indigo-pink.scss +4 -4
  13. package/core/theming/prebuilt/magenta-violet.scss +26 -0
  14. package/core/theming/prebuilt/pink-bluegrey.scss +4 -4
  15. package/core/theming/prebuilt/purple-green.scss +4 -4
  16. package/core/theming/prebuilt/rose-red.scss +26 -0
  17. package/{experimental/theming/_m3-density.scss → core/tokens/_density.scss} +0 -1
  18. package/core/tokens/_m3-tokens.scss +350 -0
  19. package/core/tokens/_token-utils.scss +164 -40
  20. package/core/tokens/m2/_index.scss +2 -3
  21. package/core/tokens/m2/mdc/_plain-tooltip.scss +1 -2
  22. package/core/tokens/m2/mtx/_alert.scss +5 -6
  23. package/core/tokens/m2/mtx/_colorpicker.scss +2 -3
  24. package/core/tokens/m2/mtx/_datetimepicker.scss +7 -8
  25. package/core/tokens/m2/mtx/_drawer.scss +3 -2
  26. package/core/tokens/m2/mtx/_grid.scss +4 -3
  27. package/core/tokens/m2/mtx/_loader.scss +2 -3
  28. package/core/tokens/m2/mtx/_popover.scss +1 -2
  29. package/core/tokens/m2/mtx/_progress.scss +5 -6
  30. package/core/tokens/m2/mtx/_select.scss +3 -2
  31. package/core/tokens/m2/mtx/_split.scss +2 -3
  32. package/core/tokens/m3/index.scss +45 -0
  33. package/core/tokens/m3/mtx/_alert.scss +31 -0
  34. package/core/tokens/m3/mtx/_colorpicker.scss +19 -0
  35. package/{experimental/theming/_custom-tokens.scss → core/tokens/m3/mtx/_datetimepicker.scss} +15 -191
  36. package/core/tokens/m3/mtx/_drawer.scss +22 -0
  37. package/core/tokens/m3/mtx/_grid.scss +34 -0
  38. package/core/tokens/m3/mtx/_loader.scss +22 -0
  39. package/core/tokens/m3/mtx/_popover.scss +22 -0
  40. package/core/tokens/m3/mtx/_progress.scss +31 -0
  41. package/core/tokens/m3/mtx/_select.scss +72 -0
  42. package/core/tokens/m3/mtx/_split.scss +30 -0
  43. package/datetimepicker/_datetimepicker-theme.scss +3 -4
  44. package/datetimepicker/calendar-body.scss +2 -2
  45. package/datetimepicker/calendar.d.ts +1 -0
  46. package/datetimepicker/datetimepicker-content.scss +0 -2
  47. package/datetimepicker/datetimepicker.d.ts +4 -4
  48. package/drawer/_drawer-theme.scss +2 -3
  49. package/drawer/drawer-container.scss +1 -2
  50. package/esm2022/alert/alert-module.mjs +4 -4
  51. package/esm2022/alert/alert.mjs +3 -3
  52. package/esm2022/button/button-loading.mjs +3 -3
  53. package/esm2022/button/button-module.mjs +4 -4
  54. package/esm2022/checkbox-group/checkbox-group-module.mjs +4 -4
  55. package/esm2022/checkbox-group/checkbox-group.mjs +3 -3
  56. package/esm2022/colorpicker/colorpicker-input.mjs +3 -3
  57. package/esm2022/colorpicker/colorpicker-module.mjs +4 -4
  58. package/esm2022/colorpicker/colorpicker-toggle.mjs +6 -6
  59. package/esm2022/colorpicker/colorpicker.mjs +14 -12
  60. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +3 -3
  61. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +3 -3
  62. package/esm2022/column-resize/column-resize-module.mjs +4 -4
  63. package/esm2022/column-resize/column-resize-notifier.mjs +6 -6
  64. package/esm2022/column-resize/column-resize.mjs +3 -3
  65. package/esm2022/column-resize/column-size-store.mjs +3 -3
  66. package/esm2022/column-resize/event-dispatcher.mjs +3 -3
  67. package/esm2022/column-resize/overlay-handle.mjs +3 -3
  68. package/esm2022/column-resize/resizable.mjs +3 -3
  69. package/esm2022/column-resize/resize-strategy.mjs +9 -9
  70. package/esm2022/core/datetime/datetime.module.mjs +8 -8
  71. package/esm2022/core/datetime/native-datetime-adapter.mjs +3 -3
  72. package/esm2022/core/pipes/is-template-ref.pipe.mjs +3 -3
  73. package/esm2022/core/pipes/pipes.module.mjs +4 -4
  74. package/esm2022/core/pipes/to-observable.pipe.mjs +3 -3
  75. package/esm2022/datetimepicker/calendar-body.mjs +3 -3
  76. package/esm2022/datetimepicker/calendar.mjs +9 -14
  77. package/esm2022/datetimepicker/clock.mjs +5 -5
  78. package/esm2022/datetimepicker/datetimepicker-input.mjs +3 -3
  79. package/esm2022/datetimepicker/datetimepicker-intl.mjs +3 -3
  80. package/esm2022/datetimepicker/datetimepicker-module.mjs +4 -4
  81. package/esm2022/datetimepicker/datetimepicker-toggle.mjs +6 -6
  82. package/esm2022/datetimepicker/datetimepicker.mjs +15 -13
  83. package/esm2022/datetimepicker/month-view.mjs +3 -3
  84. package/esm2022/datetimepicker/multi-year-view.mjs +3 -3
  85. package/esm2022/datetimepicker/time.mjs +6 -6
  86. package/esm2022/datetimepicker/year-view.mjs +3 -3
  87. package/esm2022/dialog/dialog-container.mjs +3 -3
  88. package/esm2022/dialog/dialog-module.mjs +4 -4
  89. package/esm2022/dialog/dialog.mjs +3 -3
  90. package/esm2022/drawer/drawer-container.mjs +5 -5
  91. package/esm2022/drawer/drawer-module.mjs +4 -4
  92. package/esm2022/drawer/drawer.mjs +3 -3
  93. package/esm2022/grid/cell.mjs +3 -3
  94. package/esm2022/grid/column-menu.mjs +5 -5
  95. package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +3 -3
  96. package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +3 -3
  97. package/esm2022/grid/column-resize/column-resize-module.mjs +8 -8
  98. package/esm2022/grid/column-resize/overlay-handle.mjs +3 -3
  99. package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +3 -3
  100. package/esm2022/grid/column-resize/resize-strategy.mjs +3 -3
  101. package/esm2022/grid/expansion-toggle.mjs +3 -3
  102. package/esm2022/grid/grid-module.mjs +4 -4
  103. package/esm2022/grid/grid-pipes.mjs +21 -21
  104. package/esm2022/grid/grid-utils.mjs +3 -3
  105. package/esm2022/grid/grid.mjs +3 -3
  106. package/esm2022/grid/selectable-cell.mjs +3 -3
  107. package/esm2022/loader/loader-module.mjs +4 -4
  108. package/esm2022/loader/loader.mjs +3 -3
  109. package/esm2022/photoviewer/photoviewer-module.mjs +4 -4
  110. package/esm2022/photoviewer/photoviewer.mjs +3 -3
  111. package/esm2022/popover/popover-content.mjs +6 -6
  112. package/esm2022/popover/popover-module.mjs +4 -4
  113. package/esm2022/popover/popover-target.mjs +3 -3
  114. package/esm2022/popover/popover-trigger.mjs +6 -8
  115. package/esm2022/popover/popover.mjs +6 -6
  116. package/esm2022/progress/progress-module.mjs +4 -4
  117. package/esm2022/progress/progress.mjs +3 -3
  118. package/esm2022/select/option.mjs +3 -3
  119. package/esm2022/select/select-module.mjs +4 -4
  120. package/esm2022/select/select.mjs +37 -23
  121. package/esm2022/select/templates.mjs +33 -33
  122. package/esm2022/split/split-module.mjs +4 -4
  123. package/esm2022/split/split-pane.mjs +37 -28
  124. package/esm2022/split/split.mjs +55 -49
  125. package/esm2022/split/utils.mjs +1 -4
  126. package/esm2022/tooltip/tooltip-module.mjs +4 -4
  127. package/esm2022/tooltip/tooltip.mjs +6 -6
  128. package/fesm2022/mtxAlert.mjs +7 -7
  129. package/fesm2022/mtxButton.mjs +7 -7
  130. package/fesm2022/mtxCheckboxGroup.mjs +7 -7
  131. package/fesm2022/mtxColorpicker.mjs +27 -25
  132. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  133. package/fesm2022/mtxColumnResize.mjs +40 -40
  134. package/fesm2022/mtxCore.mjs +21 -21
  135. package/fesm2022/mtxDatetimepicker.mjs +61 -63
  136. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  137. package/fesm2022/mtxDialog.mjs +10 -10
  138. package/fesm2022/mtxDrawer.mjs +13 -13
  139. package/fesm2022/mtxDrawer.mjs.map +1 -1
  140. package/fesm2022/mtxGrid.mjs +68 -68
  141. package/fesm2022/mtxGrid.mjs.map +1 -1
  142. package/fesm2022/mtxLoader.mjs +7 -7
  143. package/fesm2022/mtxPhotoviewer.mjs +7 -7
  144. package/fesm2022/mtxPopover.mjs +24 -26
  145. package/fesm2022/mtxPopover.mjs.map +1 -1
  146. package/fesm2022/mtxProgress.mjs +7 -7
  147. package/fesm2022/mtxSelect.mjs +76 -62
  148. package/fesm2022/mtxSelect.mjs.map +1 -1
  149. package/fesm2022/mtxSplit.mjs +92 -80
  150. package/fesm2022/mtxSplit.mjs.map +1 -1
  151. package/fesm2022/mtxTooltip.mjs +12 -12
  152. package/grid/_grid-theme.scss +3 -4
  153. package/grid/column-menu.scss +15 -9
  154. package/grid/grid.scss +2 -2
  155. package/loader/_loader-theme.scss +2 -3
  156. package/package.json +18 -18
  157. package/popover/_popover-theme.scss +2 -3
  158. package/popover/popover.d.ts +2 -2
  159. package/prebuilt-themes/azure-blue.css +1 -0
  160. package/prebuilt-themes/cyan-orange.css +1 -0
  161. package/prebuilt-themes/deeppurple-amber.css +1 -1
  162. package/prebuilt-themes/indigo-pink.css +1 -1
  163. package/prebuilt-themes/magenta-violet.css +1 -0
  164. package/prebuilt-themes/pink-bluegrey.css +1 -1
  165. package/prebuilt-themes/purple-green.css +1 -1
  166. package/prebuilt-themes/rose-red.css +1 -0
  167. package/progress/_progress-theme.scss +3 -4
  168. package/select/_select-theme.scss +3 -4
  169. package/select/select.d.ts +17 -2
  170. package/select/select.scss +2 -4
  171. package/split/_split-theme.scss +2 -3
  172. package/split/split-pane.d.ts +29 -13
  173. package/split/split.d.ts +44 -20
  174. package/split/utils.d.ts +0 -1
  175. package/tooltip/_tooltip-theme.scss +4 -5
  176. package/core/style/_sass-utils.scss +0 -80
  177. package/experimental/_index.scss +0 -5
  178. package/experimental/theming/_m3-tokens.scss +0 -308
  179. /package/{experimental/theming → core/tokens}/_format-tokens.scss +0 -0
@@ -0,0 +1,350 @@
1
+ @use 'sass:map';
2
+ @use '@material/tokens/v0_161' as mdc-tokens;
3
+ @use '@angular/material' as mat;
4
+ @use './m3';
5
+ @use '../tokens/m2' as m2-tokens;
6
+ @use './density';
7
+ @use './format-tokens';
8
+
9
+ /// Generates tokens for the given palette with the given prefix.
10
+ /// @param {Map} $palette The palette to generate tokens for
11
+ /// @param {String} $prefix The key prefix used to name the tokens
12
+ /// @return {Map} A set of tokens for the given palette
13
+ @function _generate-palette-tokens($palette, $prefix) {
14
+ $palette: map.remove($palette, neutral, neutral-variant);
15
+ $result: ();
16
+ @each $hue, $value in $palette {
17
+ $result: map.set($result, '#{$prefix}#{$hue}', $value);
18
+ }
19
+ @return $result;
20
+ }
21
+
22
+ /// Creates a set of `md-ref-palette` tokens from the given palettes. (See
23
+ /// https://github.com/material-components/material-components-web/blob/master/packages/mdc-tokens/v0_161/_md-ref-palette.scss)
24
+ /// @param {Map} $primary The primary palette
25
+ /// @param {Map} $secondary The secondary palette
26
+ /// @param {Map} $tertiary The tertiary palette
27
+ /// @param {Map} $error The error palette
28
+ /// @return {Map} A set of `md-ref-palette` tokens
29
+ @function _generate-ref-palette-tokens($primary, $tertiary, $error) {
30
+ @return mat.private-merge-all(
31
+ (black: #000, white: #fff),
32
+ _generate-palette-tokens($primary, primary),
33
+ _generate-palette-tokens(map.get($primary, secondary), secondary),
34
+ _generate-palette-tokens($tertiary, tertiary),
35
+ _generate-palette-tokens(map.get($primary, neutral), neutral),
36
+ _generate-palette-tokens(map.get($primary, neutral-variant), neutral-variant),
37
+ _generate-palette-tokens($error, error),
38
+ );
39
+ }
40
+
41
+ /// Creates a set of `md-ref-typeface` tokens from the given palettes. (See
42
+ /// https://github.com/material-components/material-components-web/blob/master/packages/mdc-tokens/v0_161/_md-ref-typeface.scss)
43
+ /// @param {List|String} $brand The font-family to use for brand text
44
+ /// @param {List|String} $plain The font-family to use for plain text
45
+ /// @param {String} $bold The font-weight to use for bold text
46
+ /// @param {String} $medium The font-weight to use for medium text
47
+ /// @param {String} $regular The font-weight to use for regular text
48
+ /// @return {Map} A set of `md-ref-typeface` tokens
49
+ @function _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular) {
50
+ @return (
51
+ brand: $brand,
52
+ plain: $plain,
53
+ weight-bold: $bold,
54
+ weight-medium: $medium,
55
+ weight-regular: $regular,
56
+ );
57
+ }
58
+
59
+ $_cached-token-slots: null;
60
+
61
+ /// Determines the token slots for all components.
62
+ @function _get-token-slots() {
63
+ // Cache the slots since they're constant and calculating
64
+ // them appears to be expensive (see #29009).
65
+ @if ($_cached-token-slots) {
66
+ @return $_cached-token-slots;
67
+ }
68
+
69
+ // TODO(mmalerba): Refactor this to not depend on the legacy theme when moving out of
70
+ // material-experimental. This is a hack for now because there is no good way to get the token
71
+ // slots in material-experimental without exposing them all from material.
72
+ $fake-theme: mat.m2-define-light-theme((
73
+ color: (
74
+ primary: mat.m2-define-palette(mat.$m2-red-palette),
75
+ accent: mat.m2-define-palette(mat.$m2-red-palette),
76
+ warn: mat.m2-define-palette(mat.$m2-red-palette),
77
+ ),
78
+ typography: mat.m2-define-typography-config(),
79
+ density: 0
80
+ ));
81
+ $_cached-token-slots: m2-tokens.m2-tokens-from-theme($fake-theme) !global;
82
+ @return $_cached-token-slots;
83
+ }
84
+
85
+ /// Generates a set of namespaced tokens for all components.
86
+ /// @param {Map} $systems The MDC system tokens
87
+ /// @param {Boolean} $include-non-systemized Whether to include non-systemized tokens
88
+ /// @return {Map} A map of namespaced tokens
89
+ @function _generate-tokens($systems, $include-non-systemized: false) {
90
+ $systems: map.merge((
91
+ md-sys-color: (),
92
+ md-sys-elevation: (),
93
+ md-sys-motion: (),
94
+ md-sys-shape: (),
95
+ md-sys-state: (),
96
+ md-sys-typescale: ()
97
+ ), $systems);
98
+ $exclude-hardcoded: not $include-non-systemized;
99
+
100
+ // DO NOT REMOVE
101
+ // This function is used internally.
102
+ $systems: format-tokens.private-format-tokens($systems);
103
+ $token-slots: _get-token-slots();
104
+
105
+ // TODO(mmalerba): Fill in remaining tokens.
106
+ $result: mat.private-deep-merge-all(
107
+ // Add the system color & typography tokens (so we can give users access via an API).
108
+ (
109
+ (mdc, theme): map.get($systems, md-sys-color),
110
+ (mdc, typography): map.get($systems, md-sys-typescale),
111
+ ),
112
+ m3.get-m3-tokens($systems, $exclude-hardcoded, $token-slots),
113
+ );
114
+
115
+ // Strip out tokens that are systemized by our made up density system.
116
+ @each $namespace, $tokens in $result {
117
+ @each $token, $value in $tokens {
118
+ @if density.is-systemized($namespace, $token) {
119
+ $tokens: map.remove($tokens, $token);
120
+ }
121
+ }
122
+ $result: map.set($result, $namespace, $tokens);
123
+ }
124
+ @return $result;
125
+ }
126
+
127
+ @function _get-sys-color($type, $ref) {
128
+ $mdc-sys-color: if($type == dark,
129
+ mdc-tokens.md-sys-color-values-dark($ref),
130
+ mdc-tokens.md-sys-color-values-light($ref));
131
+
132
+ @if (mat.$private-use-system-color-variables) {
133
+ @return (
134
+ 'background': var(--sys-background),
135
+ 'error': var(--sys-error),
136
+ 'error-container': var(--sys-error-container),
137
+ 'inverse-on-surface': var(--sys-inverse-on-surface),
138
+ 'inverse-primary': var(--sys-inverse-primary),
139
+ 'inverse-surface': var(--sys-inverse-surface),
140
+ 'on-background': var(--sys-on-background),
141
+ 'on-error': var(--sys-on-error),
142
+ 'on-error-container': var(--sys-on-error-container),
143
+ 'on-primary': var(--sys-on-primary),
144
+ 'on-primary-container': var(--sys-on-primary-container),
145
+ 'on-primary-fixed': var(--sys-on-primary-fixed),
146
+ 'on-primary-fixed-variant': var(--sys-on-primary-fixed-variant),
147
+ 'on-secondary': var(--sys-on-secondary),
148
+ 'on-secondary-container': var(--sys-on-secondary-container),
149
+ 'on-secondary-fixed': var(--sys-on-secondary-fixed),
150
+ 'on-secondary-fixed-variant': var(--sys-on-secondary-fixed-variant),
151
+ 'on-surface': var(--sys-on-surface),
152
+ 'on-surface-variant': var(--sys-on-surface-variant),
153
+ 'on-tertiary': var(--sys-on-tertiary),
154
+ 'on-tertiary-container': var(--sys-on-tertiary-container),
155
+ 'on-tertiary-fixed': var(--sys-on-tertiary-fixed),
156
+ 'on-tertiary-fixed-variant': var(--sys-on-tertiary-fixed-variant),
157
+ 'outline': var(--sys-outline),
158
+ 'outline-variant': var(--sys-outline-variant),
159
+ 'primary': var(--sys-primary),
160
+ 'primary-container': var(--sys-primary-container),
161
+ 'primary-fixed': var(--sys-primary-fixed),
162
+ 'primary-fixed-dim': var(--sys-primary-fixed-dim),
163
+ 'scrim': var(--sys-scrim),
164
+ 'secondary': var(--sys-secondary),
165
+ 'secondary-container': var(--sys-secondary-container),
166
+ 'secondary-fixed': var(--sys-secondary-fixed),
167
+ 'secondary-fixed-dim': var(--sys-secondary-fixed-dim),
168
+ 'shadow': map.get($mdc-sys-color, shadow),
169
+ 'surface': var(--sys-surface),
170
+ 'surface-bright': var(--sys-surface-bright),
171
+ 'surface-container': var(--sys-surface-container),
172
+ 'surface-container-high': var(--sys-surface-container-high),
173
+ 'surface-container-highest': var(--sys-surface-container-highest),
174
+ 'surface-container-low': var(--sys-surface-container-low),
175
+ 'surface-container-lowest': var(--sys-surface-container-lowest),
176
+ 'surface-dim': var(--sys-surface-dim),
177
+ 'surface-tint': var(--sys-surface-tint),
178
+ 'surface-variant': var(--sys-surface-variant),
179
+ 'tertiary': var(--sys-tertiary),
180
+ 'tertiary-container': var(--sys-tertiary-container),
181
+ 'tertiary-fixed': var(--sys-tertiary-fixed),
182
+ 'tertiary-fixed-dim': var(--sys-tertiary-fixed-dim),
183
+ );
184
+ }
185
+
186
+ @return $mdc-sys-color;
187
+ }
188
+
189
+ @function _get-sys-typeface($ref) {
190
+ @if (mat.$private-use-system-typography-variables) {
191
+ @return (
192
+ 'body-large': var(--sys-body-large),
193
+ 'body-large-font': var(--sys-body-large-font),
194
+ 'body-large-line-height': var(--sys-body-large-line-height),
195
+ 'body-large-size': var(--sys-body-large-size),
196
+ 'body-large-tracking': var(--sys-body-large-tracking),
197
+ 'body-large-weight': var(--sys-body-large-weight),
198
+ 'body-medium': var(--sys-body-medium),
199
+ 'body-medium-font': var(--sys-body-medium-font),
200
+ 'body-medium-line-height': var(--sys-body-medium-line-height),
201
+ 'body-medium-size': var(--sys-body-medium-size),
202
+ 'body-medium-tracking': var(--sys-body-medium-tracking),
203
+ 'body-medium-weight': var(--sys-body-medium-weight),
204
+ 'body-small': var(--sys-body-small),
205
+ 'body-small-font': var(--sys-body-small-font),
206
+ 'body-small-line-height': var(--sys-body-small-line-height),
207
+ 'body-small-size': var(--sys-body-small-size),
208
+ 'body-small-tracking': var(--sys-body-small-tracking),
209
+ 'body-small-weight': var(--sys-body-small-weight),
210
+ 'display-large': var(--sys-display-large),
211
+ 'display-large-font': var(--sys-display-large-font),
212
+ 'display-large-line-height': var(--sys-display-large-line-height),
213
+ 'display-large-size': var(--sys-display-large-size),
214
+ 'display-large-tracking': var(--sys-display-large-tracking),
215
+ 'display-large-weight': var(--sys-display-large-weight),
216
+ 'display-medium': var(--sys-display-medium),
217
+ 'display-medium-font': var(--sys-display-medium-font),
218
+ 'display-medium-line-height': var(--sys-display-medium-line-height),
219
+ 'display-medium-size': var(--sys-display-medium-size),
220
+ 'display-medium-tracking': var(--sys-display-medium-tracking),
221
+ 'display-medium-weight': var(--sys-display-medium-weight),
222
+ 'display-small': var(--sys-display-small),
223
+ 'display-small-font': var(--sys-display-small-font),
224
+ 'display-small-line-height': var(--sys-display-small-line-height),
225
+ 'display-small-size': var(--sys-display-small-size),
226
+ 'display-small-tracking': var(--sys-display-small-tracking),
227
+ 'display-small-weight': var(--sys-display-small-weight),
228
+ 'headline-large': var(--sys-headline-large),
229
+ 'headline-large-font': var(--sys-headline-large-font),
230
+ 'headline-large-line-height': var(--sys-headline-large-line-height),
231
+ 'headline-large-size': var(--sys-headline-large-size),
232
+ 'headline-large-tracking': var(--sys-headline-large-tracking),
233
+ 'headline-large-weight': var(--sys-headline-large-weight),
234
+ 'headline-medium': var(--sys-headline-medium),
235
+ 'headline-medium-font': var(--sys-headline-medium-font),
236
+ 'headline-medium-line-height': var(--sys-headline-medium-line-height),
237
+ 'headline-medium-size': var(--sys-headline-medium-size),
238
+ 'headline-medium-tracking': var(--sys-headline-medium-tracking),
239
+ 'headline-medium-weight': var(--sys-headline-medium-weight),
240
+ 'headline-small': var(--sys-headline-small),
241
+ 'headline-small-font': var(--sys-headline-small-font),
242
+ 'headline-small-line-height': var(--sys-headline-small-line-height),
243
+ 'headline-small-size': var(--sys-headline-small-size),
244
+ 'headline-small-tracking': var(--sys-headline-small-tracking),
245
+ 'headline-small-weight': var(--sys-headline-small-weight),
246
+ 'label-large': var(--sys-label-large),
247
+ 'label-large-font': var(--sys-label-large-font),
248
+ 'label-large-line-height': var(--sys-label-large-line-height),
249
+ 'label-large-size': var(--sys-label-large-size),
250
+ 'label-large-tracking': var(--sys-label-large-tracking),
251
+ 'label-large-weight': var(--sys-label-large-weight),
252
+ 'label-large-weight-prominent': var(--sys-label-large-weight-prominent),
253
+ 'label-medium': var(--sys-label-medium),
254
+ 'label-medium-font': var(--sys-label-medium-font),
255
+ 'label-medium-line-height': var(--sys-label-medium-line-height),
256
+ 'label-medium-size': var(--sys-label-medium-size),
257
+ 'label-medium-tracking': var(--sys-label-medium-tracking),
258
+ 'label-medium-weight': var(--sys-label-medium-weight),
259
+ 'label-medium-weight-prominent': var(--sys-label-medium-weight-prominent),
260
+ 'label-small': var(--sys-label-small),
261
+ 'label-small-font': var(--sys-label-small-font),
262
+ 'label-small-line-height': var(--sys-label-small-line-height),
263
+ 'label-small-size': var(--sys-label-small-size),
264
+ 'label-small-tracking': var(--sys-label-small-tracking),
265
+ 'label-small-weight': var(--sys-label-small-weight),
266
+ 'title-large': var(--sys-title-large),
267
+ 'title-large-font': var(--sys-title-large-font),
268
+ 'title-large-line-height': var(--sys-title-large-line-height),
269
+ 'title-large-size': var(--sys-title-large-size),
270
+ 'title-large-tracking': var(--sys-title-large-tracking),
271
+ 'title-large-weight': var(--sys-title-large-weight),
272
+ 'title-medium': var(--sys-title-medium),
273
+ 'title-medium-font': var(--sys-title-medium-font),
274
+ 'title-medium-line-height': var(--sys-title-medium-line-height),
275
+ 'title-medium-size': var(--sys-title-medium-size),
276
+ 'title-medium-tracking': var(--sys-title-medium-tracking),
277
+ 'title-medium-weight': var(--sys-title-medium-weight),
278
+ 'title-small': var(--sys-title-small),
279
+ 'title-small-font': var(--sys-title-small-font),
280
+ 'title-small-line-height': var(--sys-title-small-line-height),
281
+ 'title-small-size': var(--sys-title-small-size),
282
+ 'title-small-tracking': var(--sys-title-small-tracking),
283
+ 'title-small-weight': var(--sys-title-small-weight),
284
+ );
285
+ }
286
+ @return mdc-tokens.md-sys-typescale-values($ref);
287
+ }
288
+
289
+ /// Generates a set of namespaced color tokens for all components.
290
+ /// @param {String} $type The type of theme system (light or dark)
291
+ /// @param {Map} $primary The primary palette
292
+ /// @param {Map} $tertiary The tertiary palette
293
+ /// @param {Map} $error The error palette
294
+ /// @return {Map} A map of namespaced color tokens
295
+ @function generate-color-tokens($type, $primary, $tertiary, $error) {
296
+ $ref: (
297
+ md-ref-palette: _generate-ref-palette-tokens($primary, $tertiary, $error)
298
+ );
299
+
300
+ $sys-color: _get-sys-color($type, $ref);
301
+
302
+ @return _generate-tokens(map.merge($ref, (
303
+ md-sys-color: $sys-color,
304
+ // Because the elevation values are always combined with color values to create the box shadow,
305
+ // elevation needs to be part of the color dimension.
306
+ md-sys-elevation: mdc-tokens.md-sys-elevation-values(),
307
+ // Because the state values are sometimes combined with color values to create rgba colors,
308
+ // state needs to be part of color dimension.
309
+ // TODO(mmalerba): If at some point we remove the need for these combined values, we can move
310
+ // state to the base dimension.
311
+ md-sys-state: mdc-tokens.md-sys-state-values(),
312
+ )));
313
+ }
314
+
315
+ /// Generates a set of namespaced color tokens for all components.
316
+ /// @param {String|List} $brand The brand font-family
317
+ /// @param {String|List} $plain The plain fort-family
318
+ /// @param {String|Number} $bold The bold font-weight
319
+ /// @param {String|Number} $medium The medium font-weight
320
+ /// @param {String|Number} $regular The regular font-weight
321
+ /// @return {Map} A map of namespaced typography tokens
322
+ @function generate-typography-tokens($brand, $plain, $bold, $medium, $regular) {
323
+ $ref: (
324
+ md-ref-typeface: _generate-ref-typeface-tokens($brand, $plain, $bold, $medium, $regular)
325
+ );
326
+
327
+ $sys-typeface: _get-sys-typeface($ref);
328
+
329
+ @return _generate-tokens((
330
+ md-sys-typescale: $sys-typeface
331
+ ));
332
+ }
333
+
334
+ /// Generates a set of namespaced density tokens for all components.
335
+ /// @param {String|Number} $scale The regular font-weight
336
+ /// @return {Map} A map of namespaced density tokens
337
+ @function generate-density-tokens($scale) {
338
+ @return density.get-tokens-for-scale($scale);
339
+ }
340
+
341
+ /// Generates a set of namespaced tokens not related to color, typography, or density for all
342
+ /// components.
343
+ /// @return {Map} A map of namespaced tokens not related to color, typography, or density
344
+ @function generate-base-tokens() {
345
+ // TODO(mmalerba): Exclude density tokens once implemented.
346
+ @return _generate-tokens((
347
+ md-sys-motion: mdc-tokens.md-sys-motion-values(),
348
+ md-sys-shape: mdc-tokens.md-sys-shape-values(),
349
+ ), $include-non-systemized: true);
350
+ }
@@ -1,17 +1,17 @@
1
1
  @use 'sass:list';
2
2
  @use 'sass:map';
3
+ @use 'sass:meta';
3
4
  @use '@material/elevation/elevation-theme' as mdc-elevation-theme;
4
5
  @use '@material/theme/custom-properties' as mdc-custom-properties;
5
6
  @use '@material/theme/theme' as mdc-theme;
6
7
  @use '@material/theme/keys' as mdc-keys;
7
8
  @use '@angular/material' as mat;
8
- @use '../style/sass-utils';
9
9
  @use '../typography/typography';
10
10
 
11
11
  // Indicates whether we're building internally. Used for backwards compatibility.
12
12
  $private-is-internal-build: false;
13
13
 
14
- $_placeholder-color-palette: mat.define-palette(mat.$red-palette);
14
+ $_placeholder-color-palette: mat.m2-define-palette(mat.$m2-red-palette);
15
15
 
16
16
  // Placeholder color config that can be passed to token getter functions when generating token
17
17
  // slots.
@@ -20,8 +20,8 @@ $placeholder-color-config: (
20
20
  accent: $_placeholder-color-palette,
21
21
  warn: $_placeholder-color-palette,
22
22
  is-dark: false,
23
- foreground: mat.$light-theme-foreground-palette,
24
- background: mat.$light-theme-background-palette,
23
+ foreground: mat.$m2-light-theme-foreground-palette,
24
+ background: mat.$m2-light-theme-background-palette,
25
25
  );
26
26
 
27
27
  $_placeholder-typography-level-config: typography.typography-config-level-from-mdc(body1);
@@ -190,7 +190,7 @@ $_component-prefix: null;
190
190
  /// @throws If given options are invalid
191
191
  /// @return {Map} The token values for the requested component.
192
192
  @function get-tokens-for($tokens, $prefix, $options...) {
193
- $options: sass-utils.validate-keyword-args($options, (color-variant, emit-overrides-only));
193
+ $options: mat.private-validate-keyword-args($options, (color-variant, emit-overrides-only));
194
194
  @if $tokens == () {
195
195
  @return ();
196
196
  }
@@ -209,35 +209,149 @@ $_component-prefix: null;
209
209
  @return if($emit-overrides-only, $overrides, map.merge($values, $overrides));
210
210
  }
211
211
 
212
- /// Emits new token values for the given tokens.
213
- /// Verifies that the tokens passed in are valid tokens.
212
+ /// Emits new token values for the given token overrides.
213
+ /// Verifies that the overrides passed in are valid tokens.
214
214
  /// New token values are emitted under the current selector or root.
215
- @mixin batch-create-token-values(
216
- $tokens: (),
217
- $mat-prefix: '',
218
- $mdc-prefix: '',
219
- $mat-tokens: (),
220
- $mdc-tokens: ()
221
- ) {
222
- $custom-mat-tokens: ();
223
- $custom-mdc-tokens: ();
224
-
225
- $mat-token-names: map.keys($mat-tokens);
226
- $mdc-token-names: map.keys($mdc-tokens);
227
- $valid-token-names: _get-valid-token-names($mat-tokens, $mdc-tokens);
228
-
229
- @each $name, $value in $tokens {
230
- $is-mat-token: list.index($mat-token-names, $name) != null;
231
- $is-mdc-token: list.index($mdc-token-names, $name) != null;
232
-
233
- @if ($is-mat-token) {
234
- $custom-mat-tokens: map.set($custom-mat-tokens, $name, $value);
215
+ @mixin batch-create-token-values($overrides: (), $token-maps...) {
216
+ @include _validate-token-overrides($overrides, $token-maps);
217
+
218
+ @each $token-map in $token-maps {
219
+ $prefix: map.get($token-map, prefix);
220
+ $tokens: map.get($token-map, tokens);
221
+
222
+ @each $name, $value in $tokens {
223
+ $tokens: map.set($tokens, $name, map.get($overrides, $name));
224
+ }
225
+
226
+ @include mat.private-current-selector-or-root() {
227
+ @include create-token-values($prefix, $tokens);
228
+ }
229
+ }
230
+ }
231
+
232
+ /// Gets the MDC tokens for the given prefix, M3 token values, and supported token slots.
233
+ /// @param {List} $prefix The token prefix for the given tokens.
234
+ /// @param {Map|(Map, Map)} $values A map of M3 token values for the given prefix.
235
+ /// This param may also be a tuple of maps, the first one representing the default M3 token values,
236
+ // and the second containing overrides for different color variants.
237
+ // Single map example:
238
+ // (token1: green, token2: 2px)
239
+ // Tuple example:
240
+ // (
241
+ // (token1: green, token2: 2px),
242
+ // (
243
+ // secondary: (token1: blue),
244
+ // error: (token1: red),
245
+ // )
246
+ // )
247
+ /// @param {Map} $slots A map of token slots, with null value indicating the token is not supported.
248
+ /// @param {String|null} $variant The name of the variant the token values are for.
249
+ /// @return {Map} A map of fully qualified token names to values, for only the supported tokens.
250
+ @function namespace-tokens($prefix, $values, $slots, $variant: null) {
251
+ $result: ();
252
+ @if $variant == null and meta.type-of($values) == 'list' and list.length($values == 2) {
253
+ $variants: list.nth($values, 2);
254
+ $values: list.nth($values, 1);
255
+ @each $variant, $overrides in $variants {
256
+ $result: map.merge($result, namespace-tokens($prefix, $overrides, $slots, $variant));
257
+ }
258
+ }
259
+ $used-token-names: map.keys(_filter-nulls(map.get($slots, $prefix)));
260
+ $used-m3-tokens: _pick(_filter-nulls($values), $used-token-names);
261
+ $prefix: if($variant == null, $prefix, list.append($prefix, $variant));
262
+ @return map.merge($result, ($prefix: $used-m3-tokens));
263
+ }
264
+
265
+ /// Hardcode the given value, or null if hardcoded values are excluded.
266
+ @function hardcode($value, $exclude-hardcoded) {
267
+ @return if($exclude-hardcoded, null, $value);
268
+ }
269
+
270
+ /// Sets all of the standard typography tokens for the given token base name to the given typography
271
+ /// level.
272
+ /// @param {Map} $systems The MDC system tokens
273
+ /// @param {String} $base-name The token base name to get the typography tokens for
274
+ /// @param {String} $typography-level The typography level to base the token values on
275
+ /// @return {Map} A map containing the typography tokens for the given base token name
276
+ @function generate-typography-tokens($systems, $base-name, $typography-level) {
277
+ $result: ();
278
+ @each $prop in (font, line-height, size, tracking, weight) {
279
+ $result: map.set($result, #{$base-name}-#{$prop},
280
+ map.get($systems, md-sys-typescale, #{$typography-level}-#{$prop}));
281
+ }
282
+ @return $result;
283
+ }
284
+
285
+ /// Maps the values in a map to new values using the given mapping function
286
+ /// @param {Map} $map The maps whose values will be mapped to new values.
287
+ /// @param {Function} $fn The value mapping function.
288
+ /// @param {Map} A new map with its values updated using the mapping function.
289
+ @function map-values($map, $fn) {
290
+ $result: ();
291
+ @each $key, $value in $map {
292
+ $result: map.set($result, $key, meta.call($fn, $value));
293
+ }
294
+ @return $result;
295
+ }
296
+
297
+ /// Renames the keys in a map
298
+ /// @param {Map} $map The map whose keys should be renamed
299
+ /// @param {Map} $rename-keys A map of original key to renamed key to apply to $map
300
+ /// @return {Map} The result of applying the given key renames to the given map.
301
+ @function rename-map-keys($map, $rename-keys) {
302
+ $result: $map;
303
+ @each $old-key-name, $new-key-name in $rename-keys {
304
+ @if map.has-key($map, $old-key-name) {
305
+ $result: map.set($result, $new-key-name, map.get($map, $old-key-name));
235
306
  }
307
+ }
308
+ @return $result;
309
+ }
310
+
311
+ /// At the time of writing, some color tokens (e.g. disabled state) are defined as a solid color
312
+ /// token and a separate opacity token. This function applies the opacity to the color and drops the
313
+ /// opacity key from the map. Can be removed once b/213331407 is resolved.
314
+ /// @param {Map} $tokens The map of tokens currently being generated
315
+ /// @param {Map} $all-tokens A map of all tokens, including hardcoded values
316
+ /// @param {List} $pairs Pairs of color token names and their opacities. Should be in the shape of
317
+ /// `((color: 'color-key', opacity: 'opacity-key'))`.
318
+ /// @return {Map} The initial tokens with the combined color values.
319
+ @function combine-color-tokens($tokens, $opacity-lookup, $pairs) {
320
+ $result: $tokens;
321
+
322
+ @each $pair in $pairs {
323
+ $color-key: map.get($pair, color);
324
+ $opacity-key: map.get($pair, opacity);
325
+ $color: map.get($tokens, $color-key);
326
+ $opacity: map.get($opacity-lookup, $opacity-key);
327
+
328
+ @if(meta.type-of($color) == 'color') {
329
+ $result: map.remove($result, $opacity-key);
330
+ $result: map.set($result, $color-key, rgba($color, $opacity));
331
+ }
332
+ @else if($color != null) {
333
+ $result: map.remove($result, $opacity-key);
334
+ $combined-color: #{color-mix(in srgb, #{$color} #{($opacity * 100) + '%'}, transparent)};
335
+ $result: map.set($result, $color-key, $combined-color);
336
+ }
337
+ }
338
+
339
+ @return $result;
340
+ }
341
+
342
+ /// Verifies that the token overrides exist and are used in one of the given token maps.
343
+ @mixin _validate-token-overrides($overrides: (), $token-maps) {
344
+ $valid-token-names: ();
236
345
 
237
- @if ($is-mdc-token) {
238
- $custom-mdc-tokens: map.set($custom-mdc-tokens, $name, $value);
346
+ @each $token-map in $token-maps {
347
+ @each $name, $value in map.get($token-map, tokens) {
348
+ @if ($value != null and list.index($valid-token-names, $name) == null) {
349
+ $valid-token-names: list.append($valid-token-names, $name);
350
+ }
239
351
  }
352
+ }
240
353
 
354
+ @each $name in map.keys($overrides) {
241
355
  @if (list.index($valid-token-names, $name) == null) {
242
356
  @error (
243
357
  'Invalid token: "' + $name + '"'
@@ -245,22 +359,32 @@ $_component-prefix: null;
245
359
  );
246
360
  }
247
361
  }
362
+ }
248
363
 
249
- @include sass-utils.current-selector-or-root() {
250
- @include create-token-values($mat-prefix, $custom-mat-tokens);
251
- @include create-token-values($mdc-prefix, $custom-mdc-tokens);
364
+ /// Picks a submap containing only the given keys out the given map.
365
+ /// @param {Map} $map The map to pick from.
366
+ /// @param {List} $keys The map keys to pick.
367
+ /// @return {Map} A submap containing only the given keys.
368
+ @function _pick($map, $keys) {
369
+ $result: ();
370
+ @each $key in $keys {
371
+ @if map.has-key($map, $key) {
372
+ $result: map.set($result, $key, map.get($map, $key));
373
+ }
252
374
  }
375
+ @return $result;
253
376
  }
254
377
 
255
- /// Returns the union of token names whose values are not null.
256
- @function _get-valid-token-names($mat-tokens, $mdc-tokens) {
257
- $mat-and-mdc-tokens: map.merge($mat-tokens, $mdc-tokens);
258
378
 
259
- @each $name, $value in $mat-and-mdc-tokens {
260
- @if ($value == null) {
261
- $mat-and-mdc-tokens: map.remove($mat-and-mdc-tokens, $name);
379
+ /// Filters keys with a null value out of the map.
380
+ /// @param {Map} $map The map to filter.
381
+ /// @return {Map} The given map with all of the null keys filtered out.
382
+ @function _filter-nulls($map) {
383
+ $result: ();
384
+ @each $key, $val in $map {
385
+ @if $val != null {
386
+ $result: map.set($result, $key, $val);
262
387
  }
263
388
  }
264
-
265
- @return map.keys($mat-and-mdc-tokens);
389
+ @return $result;
266
390
  }
@@ -1,7 +1,6 @@
1
1
  @use 'sass:map';
2
2
  @use 'sass:meta';
3
3
  @use '@angular/material' as mat;
4
- @use '../../style/sass-utils';
5
4
  @use './mtx/alert' as tokens-mtx-alert;
6
5
  @use './mtx/colorpicker' as tokens-mtx-colorpicker;
7
6
  @use './mtx/datetimepicker' as tokens-mtx-datetimepicker;
@@ -38,7 +37,7 @@
38
37
  /// @return {Map} The token map by calling the token getters in the given module with the given
39
38
  /// Angular Material theme. Token names are fully-qualified.
40
39
  @function _get-tokens-for-module($theme, $module) {
41
- $tokens: sass-utils.deep-merge-all(
40
+ $tokens: mat.private-deep-merge-all(
42
41
  _get-tokens-for-module-and-system($theme, $module, unthemable),
43
42
  _get-tokens-for-module-and-system($theme, $module, color),
44
43
  _get-tokens-for-module-and-system($theme, $module, typography),
@@ -55,7 +54,7 @@
55
54
  /// )
56
55
  /// )
57
56
  @function m2-tokens-from-theme($theme) {
58
- @return sass-utils.deep-merge-all(
57
+ @return mat.private-deep-merge-all(
59
58
  _get-tokens-for-module($theme, tokens-mtx-alert),
60
59
  _get-tokens-for-module($theme, tokens-mtx-colorpicker),
61
60
  _get-tokens-for-module($theme, tokens-mtx-datetimepicker),
@@ -1,5 +1,4 @@
1
1
  @use '@angular/material' as mat;
2
- @use '../../../style/sass-utils';
3
2
  @use '../../token-utils';
4
3
 
5
4
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -55,7 +54,7 @@ $prefix: (mdc, plain-tooltip);
55
54
  // Combines the tokens generated by the above functions into a single map with placeholder values.
56
55
  // This is used to create token slots.
57
56
  @function get-token-slots() {
58
- @return sass-utils.deep-merge-all(
57
+ @return mat.private-deep-merge-all(
59
58
  get-unthemable-tokens(),
60
59
  get-color-tokens(token-utils.$placeholder-color-config),
61
60
  get-typography-tokens(token-utils.$placeholder-typography-config),