@angular/material-experimental 17.1.0-next.3 → 17.1.0
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.
- package/LICENSE +1 -1
- package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +3 -3
- package/esm2022/column-resize/column-resize-directives/column-resize.mjs +3 -3
- package/esm2022/column-resize/column-resize-directives/default-enabled-column-resize-flex.mjs +3 -3
- package/esm2022/column-resize/column-resize-directives/default-enabled-column-resize.mjs +3 -3
- package/esm2022/column-resize/column-resize-module.mjs +12 -12
- package/esm2022/column-resize/overlay-handle.mjs +3 -3
- package/esm2022/column-resize/resizable-directives/default-enabled-resizable.mjs +3 -3
- package/esm2022/column-resize/resizable-directives/resizable.mjs +3 -3
- package/esm2022/column-resize/resize-strategy.mjs +3 -3
- package/esm2022/menubar/menubar-item.mjs +3 -3
- package/esm2022/menubar/menubar-module.mjs +4 -4
- package/esm2022/menubar/menubar.mjs +3 -3
- package/esm2022/popover-edit/lens-directives.mjs +9 -9
- package/esm2022/popover-edit/popover-edit-module.mjs +4 -4
- package/esm2022/popover-edit/table-directives.mjs +12 -12
- package/esm2022/selection/row-selection.mjs +3 -3
- package/esm2022/selection/select-all.mjs +3 -3
- package/esm2022/selection/selection-column.mjs +3 -3
- package/esm2022/selection/selection-module.mjs +4 -4
- package/esm2022/selection/selection-toggle.mjs +3 -3
- package/esm2022/selection/selection.mjs +3 -3
- package/esm2022/version.mjs +1 -1
- package/fesm2022/column-resize.mjs +36 -36
- package/fesm2022/material-experimental.mjs +1 -1
- package/fesm2022/material-experimental.mjs.map +1 -1
- package/fesm2022/menubar.mjs +10 -10
- package/fesm2022/popover-edit.mjs +25 -25
- package/fesm2022/selection.mjs +19 -19
- package/package.json +55 -55
- package/theming/_custom-tokens.scss +103 -1
- package/theming/_m3-density.scss +19 -1
- package/theming/_m3-tokens.scss +329 -8
- package/theming-next/_card.scss +0 -93
- package/theming-next/_checkbox.scss +0 -109
- package/theming-next/_m3-tokens.scss +0 -146
- package/theming-next/_theming.scss +0 -130
- package/theming-next/_token-resolution.scss +0 -88
package/theming/_m3-tokens.scss
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
1
2
|
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
2
4
|
@use '@angular/material' as mat;
|
|
3
5
|
@use '@material/tokens/v0_161' as mdc-tokens;
|
|
4
6
|
@use './m3-density';
|
|
@@ -49,15 +51,35 @@
|
|
|
49
51
|
|
|
50
52
|
/// Gets the MDC tokens for the given prefix, M3 token values, and supported token slots.
|
|
51
53
|
/// @param {List} $prefix The token prefix for the given tokens.
|
|
52
|
-
/// @param {Map} $m3-values A map of M3 token values for the given prefix.
|
|
54
|
+
/// @param {Map|(Map, Map)} $m3-values A map of M3 token values for the given prefix.
|
|
55
|
+
/// This param may also be a tuple of maps, the first one representing the default M3 token values,
|
|
56
|
+
// and the second containing overrides for different color variants.
|
|
57
|
+
// Single map example:
|
|
58
|
+
// (token1: green, token2: 2px)
|
|
59
|
+
// Tuple example:
|
|
60
|
+
// (
|
|
61
|
+
// (token1: green, token2: 2px),
|
|
62
|
+
// (
|
|
63
|
+
// secondary: (token1: blue),
|
|
64
|
+
// error: (token1: red),
|
|
65
|
+
// )
|
|
66
|
+
// )
|
|
53
67
|
/// @param {Map} $slots A map of token slots, with null value indicating the token is not supported.
|
|
68
|
+
/// @param {String|null} $variant The name of the variant the token values are for.
|
|
54
69
|
/// @return {Map} A map of fully qualified token names to values, for only the supported tokens.
|
|
55
|
-
@function _namespace-tokens($prefix, $m3-values, $slots) {
|
|
70
|
+
@function _namespace-tokens($prefix, $m3-values, $slots, $variant: null) {
|
|
71
|
+
$result: ();
|
|
72
|
+
@if $variant == null and meta.type-of($m3-values) == 'list' and list.length($m3-values == 2) {
|
|
73
|
+
$variants: list.nth($m3-values, 2);
|
|
74
|
+
$m3-values: list.nth($m3-values, 1);
|
|
75
|
+
@each $variant, $overrides in $variants {
|
|
76
|
+
$result: map.merge($result, _namespace-tokens($prefix, $overrides, $slots, $variant));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
56
79
|
$used-token-names: map.keys(_filter-nulls(map.get($slots, $prefix)));
|
|
57
80
|
$used-m3-tokens: _pick(_filter-nulls($m3-values), $used-token-names);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
);
|
|
81
|
+
$prefix: if($variant == null, $prefix, list.append($prefix, $variant));
|
|
82
|
+
@return map.merge($result, ($prefix: $used-m3-tokens));
|
|
61
83
|
}
|
|
62
84
|
|
|
63
85
|
/// Generates tokens for the given palette with the given prefix.
|
|
@@ -110,6 +132,36 @@
|
|
|
110
132
|
);
|
|
111
133
|
}
|
|
112
134
|
|
|
135
|
+
/// At the time of writing, some color tokens (e.g. disabled state) are defined as a solid color
|
|
136
|
+
/// token and a separate opacity token. This function applies the opacity to the color and drops the
|
|
137
|
+
/// opacity key from the map. Can be removed once b/213331407 is resolved.
|
|
138
|
+
/// @param {Map} $tokens The map of tokens currently being generated
|
|
139
|
+
/// @param {Map} $all-tokens A map of all tokens, including hardcoded values
|
|
140
|
+
/// @param {List} $pairs Pairs of color token names and their opacities. Should be in the shape of
|
|
141
|
+
/// `((color: 'color-key', opacity: 'opacity-key'))`.
|
|
142
|
+
/// @return {Map} The initial tokens with the combined color values.
|
|
143
|
+
@function _combine-color-tokens($tokens, $opacity-lookup, $pairs) {
|
|
144
|
+
$result: $tokens;
|
|
145
|
+
|
|
146
|
+
@each $pair in $pairs {
|
|
147
|
+
$color-key: map.get($pair, color);
|
|
148
|
+
$opacity-key: map.get($pair, opacity);
|
|
149
|
+
$color: map.get($tokens, $color-key);
|
|
150
|
+
$opacity: map.get($opacity-lookup, $opacity-key);
|
|
151
|
+
|
|
152
|
+
@if meta.type-of($color) == 'color' {
|
|
153
|
+
@if meta.type-of($opacity) != 'number' {
|
|
154
|
+
@error 'Cannot find valid opacity value for color token "#{$color-key}"';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
$result: map.remove($result, $opacity-key);
|
|
158
|
+
$result: map.set($result, $color-key, rgba($color, $opacity));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@return $result;
|
|
163
|
+
}
|
|
164
|
+
|
|
113
165
|
/// Renames the official checkbox tokens to match the names actually used in MDC's code (which are
|
|
114
166
|
/// different). This is a temporary workaround until MDC updates to use the correct names for the
|
|
115
167
|
/// tokens.
|
|
@@ -135,6 +187,203 @@
|
|
|
135
187
|
@return _rename-map-keys($tokens, $rename-keys);
|
|
136
188
|
}
|
|
137
189
|
|
|
190
|
+
/// Fixes inconsistent values in the text field color tokens. Applies to both filled and outlined
|
|
191
|
+
/// variants.
|
|
192
|
+
/// @param {Map} $initial-tokens Map of text field tokens currently being generated.
|
|
193
|
+
/// @param {Map} $all-tokens Map of all text field tokens, including hardcoded values.
|
|
194
|
+
/// This is necessary in order to do opacity lookups.
|
|
195
|
+
/// @return {Map} The given tokens, with the invalid values replaced with valid ones.
|
|
196
|
+
@function _fix-text-field-color-tokens($initial-tokens, $all-tokens) {
|
|
197
|
+
@return _combine-color-tokens($initial-tokens, $all-tokens, (
|
|
198
|
+
(
|
|
199
|
+
color: 'disabled-active-indicator-color',
|
|
200
|
+
opacity: 'disabled-active-indicator-opacity'
|
|
201
|
+
),
|
|
202
|
+
(
|
|
203
|
+
color: 'disabled-container-color',
|
|
204
|
+
opacity: 'disabled-container-opacity'
|
|
205
|
+
),
|
|
206
|
+
(
|
|
207
|
+
color: 'disabled-input-text-color',
|
|
208
|
+
opacity: 'disabled-input-text-opacity'
|
|
209
|
+
),
|
|
210
|
+
(
|
|
211
|
+
color: 'disabled-label-text-color',
|
|
212
|
+
opacity: 'disabled-label-text-opacity'
|
|
213
|
+
),
|
|
214
|
+
(
|
|
215
|
+
color: 'disabled-leading-icon-color',
|
|
216
|
+
opacity: 'disabled-leading-icon-opacity'
|
|
217
|
+
),
|
|
218
|
+
(
|
|
219
|
+
color: 'disabled-supporting-text-color',
|
|
220
|
+
opacity: 'disabled-supporting-text-opacity'
|
|
221
|
+
),
|
|
222
|
+
(
|
|
223
|
+
color: 'disabled-trailing-icon-color',
|
|
224
|
+
opacity: 'disabled-trailing-icon-opacity'
|
|
225
|
+
)
|
|
226
|
+
));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
/// Fixes inconsistent values in the filled text field tokens so that they can produce valid
|
|
231
|
+
/// styles.
|
|
232
|
+
/// @param {Map} $initial-tokens Map of filled text field tokens currently being generated.
|
|
233
|
+
/// @param {Map} $all-tokens Map of all filled text field tokens, including hardcoded values.
|
|
234
|
+
/// @return {Map} The given tokens, with the invalid values replaced with valid ones.
|
|
235
|
+
@function _fix-filled-text-field-tokens($initial-tokens, $all-tokens) {
|
|
236
|
+
$tokens: _combine-color-tokens($initial-tokens, $all-tokens, (
|
|
237
|
+
(
|
|
238
|
+
color: 'disabled-active-indicator-color',
|
|
239
|
+
opacity: 'disabled-active-indicator-opacity'
|
|
240
|
+
),
|
|
241
|
+
(
|
|
242
|
+
color: 'disabled-container-color',
|
|
243
|
+
opacity: 'disabled-container-opacity'
|
|
244
|
+
),
|
|
245
|
+
(
|
|
246
|
+
color: 'disabled-input-text-color',
|
|
247
|
+
opacity: 'disabled-input-text-opacity'
|
|
248
|
+
),
|
|
249
|
+
(
|
|
250
|
+
color: 'disabled-label-text-color',
|
|
251
|
+
opacity: 'disabled-label-text-opacity'
|
|
252
|
+
),
|
|
253
|
+
(
|
|
254
|
+
color: 'disabled-leading-icon-color',
|
|
255
|
+
opacity: 'disabled-leading-icon-opacity'
|
|
256
|
+
),
|
|
257
|
+
(
|
|
258
|
+
color: 'disabled-supporting-text-color',
|
|
259
|
+
opacity: 'disabled-supporting-text-opacity'
|
|
260
|
+
),
|
|
261
|
+
(
|
|
262
|
+
color: 'disabled-trailing-icon-color',
|
|
263
|
+
opacity: 'disabled-trailing-icon-opacity'
|
|
264
|
+
)
|
|
265
|
+
));
|
|
266
|
+
|
|
267
|
+
$container-shape: map.get($tokens, container-shape);
|
|
268
|
+
|
|
269
|
+
// The M2 token slots define a single `container-shape` slot while the M3 tokens provide a list
|
|
270
|
+
// of shapes (e.g. top/bottom/left/right). Extract the first value so it matches the expected
|
|
271
|
+
// token slot in M2.
|
|
272
|
+
@if meta.type-of($container-shape) == 'list' {
|
|
273
|
+
$tokens: map.set($tokens, container-shape, list.nth($container-shape, 1));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@return $tokens;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
/// Fixes inconsistent values in the text button tokens so that they can produce valid styles.
|
|
281
|
+
/// @param {Map} $initial-tokens Map of text button tokens currently being generated.
|
|
282
|
+
/// @param {Map} $all-tokens Map of all text button tokens, including hardcoded values.
|
|
283
|
+
/// @return {Map} The given tokens, with the invalid values replaced with valid ones.
|
|
284
|
+
@function _fix-text-button-tokens($initial-tokens, $all-tokens) {
|
|
285
|
+
@return _combine-color-tokens($initial-tokens, $all-tokens, (
|
|
286
|
+
(
|
|
287
|
+
color: 'disabled-label-text-color',
|
|
288
|
+
opacity: 'disabled-label-text-opacity',
|
|
289
|
+
),
|
|
290
|
+
));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/// Fixes inconsistent values in the filled button tokens so that they can produce valid styles.
|
|
294
|
+
/// @param {Map} $initial-tokens Map of filled button tokens currently being generated.
|
|
295
|
+
/// @param {Map} $all-tokens Map of all filled button tokens, including hardcoded values.
|
|
296
|
+
/// @return {Map} The given tokens, with the invalid values replaced with valid ones.
|
|
297
|
+
@function _fix-filled-button-tokens($initial-tokens, $all-tokens) {
|
|
298
|
+
@return _combine-color-tokens($initial-tokens, $all-tokens, (
|
|
299
|
+
(
|
|
300
|
+
color: 'disabled-label-text-color',
|
|
301
|
+
opacity: 'disabled-label-text-opacity',
|
|
302
|
+
),
|
|
303
|
+
(
|
|
304
|
+
color: 'disabled-container-color',
|
|
305
|
+
opacity: 'disabled-container-opacity',
|
|
306
|
+
)
|
|
307
|
+
));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/// Fixes inconsistent values in the protected button tokens so that they can produce valid styles.
|
|
311
|
+
/// @param {Map} $initial-tokens Map of protected button tokens currently being generated.
|
|
312
|
+
/// @param {Map} $all-tokens Map of all protected button tokens, including hardcoded values.
|
|
313
|
+
/// @return {Map} The given tokens, with the invalid values replaced with valid ones.
|
|
314
|
+
@function _fix-protected-button-tokens($initial-tokens, $all-tokens) {
|
|
315
|
+
@return _combine-color-tokens($initial-tokens, $all-tokens, (
|
|
316
|
+
(
|
|
317
|
+
color: 'disabled-label-text-color',
|
|
318
|
+
opacity: 'disabled-label-text-opacity',
|
|
319
|
+
),
|
|
320
|
+
(
|
|
321
|
+
color: 'disabled-container-color',
|
|
322
|
+
opacity: 'disabled-container-opacity',
|
|
323
|
+
)
|
|
324
|
+
));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/// Fixes inconsistent values in the outlined button tokens so that they can produce valid styles.
|
|
328
|
+
/// @param {Map} $initial-tokens Map of outlined button tokens currently being generated.
|
|
329
|
+
/// @param {Map} $all-tokens Map of all outlined button tokens, including hardcoded values.
|
|
330
|
+
/// @return {Map} The given tokens, with the invalid values replaced with valid ones.
|
|
331
|
+
@function _fix-outlined-button-tokens($initial-tokens, $all-tokens) {
|
|
332
|
+
@return _combine-color-tokens($initial-tokens, $all-tokens, (
|
|
333
|
+
(
|
|
334
|
+
color: 'disabled-label-text-color',
|
|
335
|
+
opacity: 'disabled-label-text-opacity',
|
|
336
|
+
),
|
|
337
|
+
(
|
|
338
|
+
color: 'disabled-outline-color',
|
|
339
|
+
opacity: 'disabled-outline-opacity',
|
|
340
|
+
)
|
|
341
|
+
));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/// Fixes inconsistent values in the outlined text field tokens so that they can produce valid
|
|
345
|
+
/// styles.
|
|
346
|
+
/// @param {Map} $initial-tokens Map of outlined text field tokens currently being generated.
|
|
347
|
+
/// @param {Map} $all-tokens Map of all outlined text field tokens, including hardcoded values.
|
|
348
|
+
/// This is necessary in order to do opacity lookups.
|
|
349
|
+
/// @return {Map} The given tokens, with the invalid values replaced with valid ones.
|
|
350
|
+
@function _fix-outlined-text-field-tokens($initial-tokens, $all-tokens) {
|
|
351
|
+
@return _combine-color-tokens($initial-tokens, $all-tokens, (
|
|
352
|
+
(
|
|
353
|
+
color: 'disabled-outline-color',
|
|
354
|
+
opacity: 'disabled-outline-opacity'
|
|
355
|
+
),
|
|
356
|
+
(
|
|
357
|
+
color: 'disabled-active-indicator-color',
|
|
358
|
+
opacity: 'disabled-active-indicator-opacity'
|
|
359
|
+
),
|
|
360
|
+
(
|
|
361
|
+
color: 'disabled-container-color',
|
|
362
|
+
opacity: 'disabled-container-opacity'
|
|
363
|
+
),
|
|
364
|
+
(
|
|
365
|
+
color: 'disabled-input-text-color',
|
|
366
|
+
opacity: 'disabled-input-text-opacity'
|
|
367
|
+
),
|
|
368
|
+
(
|
|
369
|
+
color: 'disabled-label-text-color',
|
|
370
|
+
opacity: 'disabled-label-text-opacity'
|
|
371
|
+
),
|
|
372
|
+
(
|
|
373
|
+
color: 'disabled-leading-icon-color',
|
|
374
|
+
opacity: 'disabled-leading-icon-opacity'
|
|
375
|
+
),
|
|
376
|
+
(
|
|
377
|
+
color: 'disabled-supporting-text-color',
|
|
378
|
+
opacity: 'disabled-supporting-text-opacity'
|
|
379
|
+
),
|
|
380
|
+
(
|
|
381
|
+
color: 'disabled-trailing-icon-color',
|
|
382
|
+
opacity: 'disabled-trailing-icon-opacity'
|
|
383
|
+
)
|
|
384
|
+
));
|
|
385
|
+
}
|
|
386
|
+
|
|
138
387
|
/// Generates a set of namespaced tokens for all components.
|
|
139
388
|
/// @param {Map} $systems The MDC system tokens
|
|
140
389
|
/// @param {Boolean} $include-non-systemized Whether to include non-systemized tokens
|
|
@@ -165,7 +414,7 @@
|
|
|
165
414
|
$token-slots: mat.m2-tokens-from-theme($fake-theme);
|
|
166
415
|
|
|
167
416
|
// TODO(mmalerba): Fill in remaining tokens.
|
|
168
|
-
$result: mat.private-merge-all(
|
|
417
|
+
$result: mat.private-deep-merge-all(
|
|
169
418
|
// Add the system color & typography tokens (so we can give users access via an API).
|
|
170
419
|
(
|
|
171
420
|
(mdc, theme): map.get($systems, md-sys-color),
|
|
@@ -209,7 +458,12 @@
|
|
|
209
458
|
),
|
|
210
459
|
_namespace-tokens(
|
|
211
460
|
(mdc, filled-text-field),
|
|
212
|
-
|
|
461
|
+
_fix-filled-text-field-tokens(
|
|
462
|
+
mdc-tokens.md-comp-filled-text-field-values($systems, $exclude-hardcoded),
|
|
463
|
+
// Need to pass in the hardcoded values, because they
|
|
464
|
+
// include opacities that are used for the disabled state.
|
|
465
|
+
mdc-tokens.md-comp-filled-text-field-values($systems, false)
|
|
466
|
+
),
|
|
213
467
|
$token-slots
|
|
214
468
|
),
|
|
215
469
|
_namespace-tokens(
|
|
@@ -217,6 +471,47 @@
|
|
|
217
471
|
mdc-tokens.md-comp-icon-button-values($systems, $exclude-hardcoded),
|
|
218
472
|
$token-slots
|
|
219
473
|
),
|
|
474
|
+
_namespace-tokens(
|
|
475
|
+
(mdc, text-button),
|
|
476
|
+
_fix-text-button-tokens(
|
|
477
|
+
mdc-tokens.md-comp-text-button-values($systems, $exclude-hardcoded),
|
|
478
|
+
// Need to pass in the hardcoded values, because they
|
|
479
|
+
// include opacities that are used for the disabled state.
|
|
480
|
+
mdc-tokens.md-comp-text-button-values($systems, false),
|
|
481
|
+
),
|
|
482
|
+
$token-slots
|
|
483
|
+
),
|
|
484
|
+
_namespace-tokens(
|
|
485
|
+
// Note: in M3 the "protected" button is called "elevated".
|
|
486
|
+
(mdc, protected-button),
|
|
487
|
+
_fix-protected-button-tokens(
|
|
488
|
+
mdc-tokens.md-comp-elevated-button-values($systems, $exclude-hardcoded),
|
|
489
|
+
// Need to pass in the hardcoded values, because they
|
|
490
|
+
// include opacities that are used for the disabled state.
|
|
491
|
+
mdc-tokens.md-comp-elevated-button-values($systems, false),
|
|
492
|
+
),
|
|
493
|
+
$token-slots
|
|
494
|
+
),
|
|
495
|
+
_namespace-tokens(
|
|
496
|
+
(mdc, filled-button),
|
|
497
|
+
_fix-filled-button-tokens(
|
|
498
|
+
mdc-tokens.md-comp-filled-button-values($systems, $exclude-hardcoded),
|
|
499
|
+
// Need to pass in the hardcoded values, because they
|
|
500
|
+
// include opacities that are used for the disabled state.
|
|
501
|
+
mdc-tokens.md-comp-filled-button-values($systems, false),
|
|
502
|
+
),
|
|
503
|
+
$token-slots
|
|
504
|
+
),
|
|
505
|
+
_namespace-tokens(
|
|
506
|
+
(mdc, outlined-button),
|
|
507
|
+
_fix-outlined-button-tokens(
|
|
508
|
+
mdc-tokens.md-comp-outlined-button-values($systems, $exclude-hardcoded),
|
|
509
|
+
// Need to pass in the hardcoded values, because they
|
|
510
|
+
// include opacities that are used for the disabled state.
|
|
511
|
+
mdc-tokens.md-comp-outlined-button-values($systems, false),
|
|
512
|
+
),
|
|
513
|
+
$token-slots
|
|
514
|
+
),
|
|
220
515
|
_namespace-tokens(
|
|
221
516
|
(mdc, linear-progress),
|
|
222
517
|
mdc-tokens.md-comp-linear-progress-indicator-values($systems, $exclude-hardcoded),
|
|
@@ -234,7 +529,12 @@
|
|
|
234
529
|
),
|
|
235
530
|
_namespace-tokens(
|
|
236
531
|
(mdc, outlined-text-field),
|
|
237
|
-
|
|
532
|
+
_fix-outlined-text-field-tokens(
|
|
533
|
+
mdc-tokens.md-comp-outlined-text-field-values($systems, $exclude-hardcoded),
|
|
534
|
+
// Need to pass in the hardcoded values, because they
|
|
535
|
+
// include opacities that are used for the disabled state.
|
|
536
|
+
mdc-tokens.md-comp-outlined-text-field-values($systems, false),
|
|
537
|
+
),
|
|
238
538
|
$token-slots
|
|
239
539
|
),
|
|
240
540
|
_namespace-tokens(
|
|
@@ -330,6 +630,27 @@
|
|
|
330
630
|
custom-tokens.icon($systems, $exclude-hardcoded),
|
|
331
631
|
$token-slots
|
|
332
632
|
),
|
|
633
|
+
_namespace-tokens(
|
|
634
|
+
(mat, text-button),
|
|
635
|
+
custom-tokens.text-button($systems, $exclude-hardcoded),
|
|
636
|
+
$token-slots
|
|
637
|
+
),
|
|
638
|
+
_namespace-tokens(
|
|
639
|
+
(mat, filled-button),
|
|
640
|
+
custom-tokens.filled-button($systems, $exclude-hardcoded),
|
|
641
|
+
$token-slots
|
|
642
|
+
),
|
|
643
|
+
_namespace-tokens(
|
|
644
|
+
// Note: in M3 the "protected" button is called "elevated".
|
|
645
|
+
(mat, protected-button),
|
|
646
|
+
custom-tokens.elevated-button($systems, $exclude-hardcoded),
|
|
647
|
+
$token-slots
|
|
648
|
+
),
|
|
649
|
+
_namespace-tokens(
|
|
650
|
+
(mat, outlined-button),
|
|
651
|
+
custom-tokens.outlined-button($systems, $exclude-hardcoded),
|
|
652
|
+
$token-slots
|
|
653
|
+
),
|
|
333
654
|
_namespace-tokens(
|
|
334
655
|
(mat, icon-button),
|
|
335
656
|
custom-tokens.icon-button($systems, $exclude-hardcoded),
|
package/theming-next/_card.scss
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
@use 'sass:color';
|
|
2
|
-
@use 'sass:meta';
|
|
3
|
-
@use '@angular/material' as mat;
|
|
4
|
-
@use './token-resolution';
|
|
5
|
-
|
|
6
|
-
// TODO(mmalerba): This should live under material/card when moving out of experimental.
|
|
7
|
-
|
|
8
|
-
/// Gets tokens for setting the card's shape.
|
|
9
|
-
/// @param {String} $shape The card's shape.
|
|
10
|
-
/// @return {Map} A map of tokens for setting the card's shape.
|
|
11
|
-
// Note: we use a function rather than simple rename, because we want to map a single shape value to
|
|
12
|
-
// multiple tokens, rather than offer separate shape customizations for elevated and outlined cards.
|
|
13
|
-
@function _get-tokens-for-card-shape($shape) {
|
|
14
|
-
@return (
|
|
15
|
-
(mdc, elevated-card): (container-shape: $shape),
|
|
16
|
-
(mdc, outline-card): (container-shape: $shape),
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/// Gets tokens for setting the card's color.
|
|
21
|
-
/// @param {String} $shape The card's shape.
|
|
22
|
-
/// @return {Map} A map of tokens for setting the card's shape.
|
|
23
|
-
@function _get-tokens-for-card-color($color) {
|
|
24
|
-
@return (
|
|
25
|
-
(mdc, elevated-card): (container-color: $color),
|
|
26
|
-
(mdc, outline-card): (container-color: $color),
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/// Gets a map of card token values that are derived from the theme type.
|
|
31
|
-
/// @param {'light' | 'dark'} $theme-type The type of theme.
|
|
32
|
-
/// @return {Map} A map of card token values derived from the given theme type.
|
|
33
|
-
@function _get-tokens-for-theme-type($theme-type) {
|
|
34
|
-
$is-dark: $theme-type == 'dark';
|
|
35
|
-
$foreground: if($is-dark, white, black);
|
|
36
|
-
$card-color: if($is-dark, mat.get-color-from-palette(mat.$gray-palette, 800), white);
|
|
37
|
-
$outline-color: color.change($foreground, $alpha: 0.12);
|
|
38
|
-
$subtitle-color: if($is-dark, rgba(white, 0.7), rgba(black, 0.54));
|
|
39
|
-
|
|
40
|
-
@return (
|
|
41
|
-
(mdc, elevated-card): (
|
|
42
|
-
container-color: $card-color,
|
|
43
|
-
),
|
|
44
|
-
(mdc, outlined-card): (
|
|
45
|
-
container-color: $card-color,
|
|
46
|
-
outline-color: $outline-color,
|
|
47
|
-
),
|
|
48
|
-
(mat, card): (
|
|
49
|
-
subtitle-text-color: $subtitle-color,
|
|
50
|
-
),
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/// Resolvers for mat-card customizations.
|
|
55
|
-
$_customization-resolvers: mat.private-merge-all(
|
|
56
|
-
token-resolution.alias((
|
|
57
|
-
elevation: container-elevation,
|
|
58
|
-
shadow-color: container-shadow-color,
|
|
59
|
-
), (mdc, elevated-card)),
|
|
60
|
-
token-resolution.forward((
|
|
61
|
-
outline-width,
|
|
62
|
-
outline-color
|
|
63
|
-
), (mdc, outlined-card)),
|
|
64
|
-
token-resolution.alias((
|
|
65
|
-
title-font: title-text-font,
|
|
66
|
-
title-line-height: title-text-line-height,
|
|
67
|
-
title-font-size: title-text-size,
|
|
68
|
-
title-letter-spacing: title-text-tracking,
|
|
69
|
-
title-font-weight: title-text-weight,
|
|
70
|
-
subtitle-font: subtitle-text-font,
|
|
71
|
-
subtitle-line-height: subtitle-text-line-height,
|
|
72
|
-
subtitle-font-size: subtitle-text-size,
|
|
73
|
-
subtitle-letter-spacing: subtitle-text-tracking,
|
|
74
|
-
subtitle-font-weight: subtitle-text-weight,
|
|
75
|
-
subtitle-color: subtitle-text-color
|
|
76
|
-
), (mat, card)),
|
|
77
|
-
(
|
|
78
|
-
background-color: meta.get-function(_get-tokens-for-card-color),
|
|
79
|
-
border-radius: meta.get-function(_get-tokens-for-card-shape),
|
|
80
|
-
theme-type: meta.get-function(_get-tokens-for-theme-type),
|
|
81
|
-
)
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
/// Configure the mat-card's theme.
|
|
85
|
-
/// @param {Map} $customizations [()] A map of custom values to use when theming mat-card.
|
|
86
|
-
@function card($customizations: ()) {
|
|
87
|
-
@return (
|
|
88
|
-
id: 'mat.card',
|
|
89
|
-
customizations: token-resolution.resolve-customized-tokens(
|
|
90
|
-
'mat.card', $_customization-resolvers, $customizations),
|
|
91
|
-
deps: (),
|
|
92
|
-
);
|
|
93
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
@use 'sass:color';
|
|
2
|
-
@use 'sass:map';
|
|
3
|
-
@use 'sass:meta';
|
|
4
|
-
@use '@angular/material' as mat;
|
|
5
|
-
@use '@material/theme/theme-color' as mdc-theme-color;
|
|
6
|
-
@use './token-resolution';
|
|
7
|
-
|
|
8
|
-
// TODO(mmalerba): This should live under material/checkbox when moving out of experimental.
|
|
9
|
-
|
|
10
|
-
// Duplicated from core/tokens/m2/mdc/checkbox
|
|
11
|
-
// TODO(mmalerba): Delete duplicated code when this is moved out of experimental.
|
|
12
|
-
@function _contrast-tone($value, $light-color: '#fff', $dark-color: '#000') {
|
|
13
|
-
@if ($value == 'dark' or $value == 'light' or type-of($value) == 'color') {
|
|
14
|
-
@return if(mdc-theme-color.contrast-tone($value) == 'dark', $dark-color, $light-color);
|
|
15
|
-
}
|
|
16
|
-
@return false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/// Gets a map of checkbox token values that are derived from the given palette.
|
|
20
|
-
/// @param {Map} $palette An Angular Material palette object.
|
|
21
|
-
/// @return {Map} A map of checkbox token values derived from the given palette.
|
|
22
|
-
@function _get-tokens-for-color-palette($palette) {
|
|
23
|
-
$palette-default-color: mat.get-color-from-palette($palette);
|
|
24
|
-
$checkmark-color: _contrast-tone($palette-default-color);
|
|
25
|
-
|
|
26
|
-
@return (
|
|
27
|
-
(mdc, checkbox): (
|
|
28
|
-
selected-checkmark-color: $checkmark-color,
|
|
29
|
-
selected-focus-icon-color: $palette-default-color,
|
|
30
|
-
selected-hover-icon-color: $palette-default-color,
|
|
31
|
-
selected-icon-color: $palette-default-color,
|
|
32
|
-
selected-pressed-icon-color: $palette-default-color,
|
|
33
|
-
selected-focus-state-layer-color: $palette-default-color,
|
|
34
|
-
selected-hover-state-layer-color: $palette-default-color,
|
|
35
|
-
selected-pressed-state-layer-color: $palette-default-color,
|
|
36
|
-
)
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/// Gets a map of checkbox token values that are derived from the theme type.
|
|
41
|
-
/// @param {'light' | 'dark'} $theme-type The type of theme.
|
|
42
|
-
/// @return {Map} A map of checkbox token values derived from the given theme type.
|
|
43
|
-
@function _get-tokens-for-theme-type($theme-type) {
|
|
44
|
-
$is-dark: $theme-type == dark;
|
|
45
|
-
$foreground: if($is-dark, white, black);
|
|
46
|
-
$disabled-color: color.change($foreground, $alpha: 0.38);
|
|
47
|
-
$border-color: color.change($foreground, $alpha: 0.54);
|
|
48
|
-
$active-border-color: mat.get-color-from-palette(mat.$gray-palette, if($is-dark, 200, 900));
|
|
49
|
-
|
|
50
|
-
@return (
|
|
51
|
-
(mdc, checkbox): (
|
|
52
|
-
disabled-selected-icon-color: $disabled-color,
|
|
53
|
-
disabled-unselected-icon-color: $disabled-color,
|
|
54
|
-
unselected-focus-icon-color: $active-border-color,
|
|
55
|
-
unselected-hover-icon-color: $active-border-color,
|
|
56
|
-
unselected-icon-color: $border-color,
|
|
57
|
-
unselected-pressed-icon-color: $border-color,
|
|
58
|
-
unselected-focus-state-layer-color: $foreground,
|
|
59
|
-
unselected-hover-state-layer-color: $foreground,
|
|
60
|
-
unselected-pressed-state-layer-color: $foreground,
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/// Resolvers for mat-checkbox customizations.
|
|
66
|
-
$_customization-resolvers: map.merge(
|
|
67
|
-
token-resolution.alias((
|
|
68
|
-
checkmark-color: selected-checkmark-color,
|
|
69
|
-
disabled-checkmark-color: disabled-selected-checkmark-color,
|
|
70
|
-
selected-focus-ring-opacity: selected-focus-state-layer-opacity,
|
|
71
|
-
selected-hover-ring-opacity: selected-hover-state-layer-opacity,
|
|
72
|
-
selected-pressed-ring-opacity: selected-pressed-state-layer-opacity,
|
|
73
|
-
unselected-focus-ring-opacity: unselected-focus-state-layer-opacity,
|
|
74
|
-
unselected-hover-ring-opacity: unselected-hover-state-layer-opacity,
|
|
75
|
-
unselected-pressed-ring-opacity: unselected-pressed-state-layer-opacity,
|
|
76
|
-
disabled-selected-box-color: disabled-selected-icon-color,
|
|
77
|
-
disabled-unselected-box-color: disabled-unselected-icon-color,
|
|
78
|
-
selected-focus-box-color: selected-focus-icon-color,
|
|
79
|
-
selected-hover-box-color: selected-hover-icon-color,
|
|
80
|
-
selected-box-color: selected-icon-color,
|
|
81
|
-
selected-pressed-box-color: selected-pressed-icon-color,
|
|
82
|
-
unselected-focus-box-color: unselected-focus-icon-color,
|
|
83
|
-
unselected-hover-box-color: unselected-hover-icon-color,
|
|
84
|
-
unselected-box-color: unselected-icon-color,
|
|
85
|
-
unselected-pressed-box-color: unselected-pressed-icon-color,
|
|
86
|
-
selected-focus-ring-color: selected-focus-state-layer-color,
|
|
87
|
-
selected-hover-ring-color: selected-hover-state-layer-color,
|
|
88
|
-
selected-pressed-ring-color: selected-pressed-state-layer-color,
|
|
89
|
-
unselected-focus-ring-color: unselected-focus-state-layer-color,
|
|
90
|
-
unselected-hover-ring-color: unselected-hover-state-layer-color,
|
|
91
|
-
unselected-pressed-ring-color: unselected-pressed-state-layer-color,
|
|
92
|
-
ripple-size: state-layer-size,
|
|
93
|
-
), (mdc, checkbox)),
|
|
94
|
-
(
|
|
95
|
-
color-palette: meta.get-function(_get-tokens-for-color-palette),
|
|
96
|
-
theme-type: meta.get-function(_get-tokens-for-theme-type),
|
|
97
|
-
)
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
/// Configure the mat-checkbox's theme.
|
|
101
|
-
/// @param {Map} $customizations [()] A map of custom values to use when theming mat-checkbox.
|
|
102
|
-
@function checkbox($customizations: ()) {
|
|
103
|
-
@return (
|
|
104
|
-
id: 'mat.checkbox',
|
|
105
|
-
customizations: token-resolution.resolve-customized-tokens(
|
|
106
|
-
'mat.checkbox', $_customization-resolvers, $customizations),
|
|
107
|
-
deps: (),
|
|
108
|
-
);
|
|
109
|
-
}
|