@angular/material 17.2.0-next.1 → 17.2.0-rc.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/autocomplete/_autocomplete-theme.scss +18 -3
- package/chips/_chips-theme.scss +7 -1
- package/core/theming/_inspection.scss +1 -1
- package/core/theming/_m2-inspection.scss +2 -1
- package/core/tokens/m2/_index.scss +7 -2
- package/core/tokens/m2/mat/_autocomplete.scss +5 -1
- package/core/tokens/m2/mat/_chip.scss +26 -2
- package/core/tokens/m2/mat/_select.scss +4 -1
- package/core/tokens/m2/mat/_sidenav.scss +3 -0
- package/core/tokens/m2/mat/_switch.scss +61 -0
- package/core/tokens/m2/mdc/_chip.scss +26 -26
- package/core/typography/_typography.scss +126 -1
- package/esm2022/autocomplete/autocomplete.mjs +3 -3
- package/esm2022/chips/chip-option.mjs +3 -3
- package/esm2022/chips/chip-row.mjs +3 -3
- package/esm2022/chips/chip.mjs +3 -3
- package/esm2022/core/option/option.mjs +3 -3
- package/esm2022/core/version.mjs +1 -1
- package/esm2022/select/select.mjs +3 -3
- package/esm2022/sidenav/drawer.mjs +3 -3
- package/esm2022/sidenav/sidenav.mjs +3 -3
- package/esm2022/slide-toggle/slide-toggle.mjs +3 -3
- package/fesm2022/autocomplete.mjs +2 -2
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/chips.mjs +6 -6
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +3 -3
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/select.mjs +2 -2
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +4 -4
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +2 -2
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/package.json +2 -2
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/select/_select-theme.scss +6 -1
- package/slide-toggle/_slide-toggle-theme.scss +20 -7
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
@if inspection.get-theme-version($theme) == 1 {
|
|
11
11
|
@include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
|
|
12
12
|
}
|
|
13
|
-
@else {
|
|
13
|
+
@else {
|
|
14
|
+
@include sass-utils.current-selector-or-root() {
|
|
15
|
+
@include token-utils.create-token-values(tokens-mat-autocomplete.$prefix,
|
|
16
|
+
tokens-mat-autocomplete.get-unthemable-tokens());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
@mixin color($theme) {
|
|
@@ -29,14 +34,24 @@
|
|
|
29
34
|
@if inspection.get-theme-version($theme) == 1 {
|
|
30
35
|
@include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
|
|
31
36
|
}
|
|
32
|
-
@else {
|
|
37
|
+
@else {
|
|
38
|
+
@include sass-utils.current-selector-or-root() {
|
|
39
|
+
@include token-utils.create-token-values(tokens-mat-autocomplete.$prefix,
|
|
40
|
+
tokens-mat-autocomplete.get-typography-tokens($theme));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
@mixin density($theme) {
|
|
36
46
|
@if inspection.get-theme-version($theme) == 1 {
|
|
37
47
|
@include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
|
|
38
48
|
}
|
|
39
|
-
@else {
|
|
49
|
+
@else {
|
|
50
|
+
@include sass-utils.current-selector-or-root() {
|
|
51
|
+
@include token-utils.create-token-values(tokens-mat-autocomplete.$prefix,
|
|
52
|
+
tokens-mat-autocomplete.get-density-tokens($theme));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
40
55
|
}
|
|
41
56
|
|
|
42
57
|
@mixin theme($theme) {
|
package/chips/_chips-theme.scss
CHANGED
|
@@ -44,16 +44,22 @@
|
|
|
44
44
|
&.mat-primary {
|
|
45
45
|
$primary-color-tokens: tokens-mdc-chip.get-color-tokens($theme, primary);
|
|
46
46
|
@include mdc-chip-theme.theme($primary-color-tokens);
|
|
47
|
+
@include token-utils.create-token-values(
|
|
48
|
+
tokens-mat-chip.$prefix, tokens-mat-chip.get-color-tokens($theme, primary));
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
&.mat-accent {
|
|
50
52
|
$accent-color-tokens: tokens-mdc-chip.get-color-tokens($theme, accent);
|
|
51
53
|
@include mdc-chip-theme.theme($accent-color-tokens);
|
|
54
|
+
@include token-utils.create-token-values(
|
|
55
|
+
tokens-mat-chip.$prefix, tokens-mat-chip.get-color-tokens($theme, accent));
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
&.mat-warn {
|
|
55
59
|
$warn-color-tokens: tokens-mdc-chip.get-color-tokens($theme, warn);
|
|
56
60
|
@include mdc-chip-theme.theme($warn-color-tokens);
|
|
61
|
+
@include token-utils.create-token-values(
|
|
62
|
+
tokens-mat-chip.$prefix, tokens-mat-chip.get-color-tokens($theme, warn));
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
}
|
|
@@ -121,7 +127,7 @@
|
|
|
121
127
|
|
|
122
128
|
@mixin _theme-from-tokens($tokens, $options...) {
|
|
123
129
|
$mdc-chip-tokens: token-utils.get-tokens-for($tokens, tokens-mdc-chip.$prefix, $options...);
|
|
124
|
-
$mat-chip-tokens: token-utils.get-tokens-for($tokens, tokens-mat-chip.$prefix);
|
|
130
|
+
$mat-chip-tokens: token-utils.get-tokens-for($tokens, tokens-mat-chip.$prefix, $options...);
|
|
125
131
|
@include mdc-chip-theme.theme($mdc-chip-tokens);
|
|
126
132
|
@include token-utils.create-token-values(tokens-mat-chip.$prefix, $mat-chip-tokens);
|
|
127
133
|
}
|
|
@@ -285,7 +285,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
|
|
|
285
285
|
}
|
|
286
286
|
$result: ();
|
|
287
287
|
@each $system in $systems {
|
|
288
|
-
$result: map.deep-merge($result, map.get($theme, $_internals, '#{$system}-tokens'));
|
|
288
|
+
$result: map.deep-merge($result, map.get($theme, $_internals, '#{$system}-tokens') or ());
|
|
289
289
|
}
|
|
290
290
|
@return $result;
|
|
291
291
|
}
|
|
@@ -123,7 +123,8 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
|
|
|
123
123
|
}
|
|
124
124
|
$palette: map.get($colors, $palette-name);
|
|
125
125
|
@if not $palette {
|
|
126
|
-
@error
|
|
126
|
+
@error $palette-name $args $theme;
|
|
127
|
+
@error #{'Unrecognized palette name:'} $palette-name;
|
|
127
128
|
}
|
|
128
129
|
@return theming.get-color-from-palette($palette, $args...);
|
|
129
130
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
@use './mat/dialog' as tokens-mat-dialog;
|
|
12
12
|
@use './mat/bottom-sheet' as tokens-mat-bottom-sheet;
|
|
13
13
|
@use './mat/card' as tokens-mat-card;
|
|
14
|
+
@use './mat/chip' as tokens-mat-chip;
|
|
14
15
|
@use './mat/datepicker' as tokens-mat-datepicker;
|
|
15
16
|
@use './mat/divider' as tokens-mat-divider;
|
|
16
17
|
@use './mat/expansion' as tokens-mat-expansion;
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
@use './mat/select' as tokens-mat-select;
|
|
33
34
|
@use './mat/sidenav' as tokens-mat-sidenav;
|
|
34
35
|
@use './mat/slider' as tokens-mat-slider;
|
|
36
|
+
@use './mat/switch' as tokens-mat-switch;
|
|
35
37
|
@use './mat/snack-bar' as tokens-mat-snack-bar;
|
|
36
38
|
@use './mat/sort' as tokens-mat-sort;
|
|
37
39
|
@use './mat/standard-button-toggle' as tokens-mat-button-toggle;
|
|
@@ -67,6 +69,7 @@
|
|
|
67
69
|
@use './mdc/switch' as tokens-mdc-switch;
|
|
68
70
|
@use './mdc/tab' as tokens-mdc-tab;
|
|
69
71
|
@use './mdc/tab-indicator' as tokens-mdc-tab-indicator;
|
|
72
|
+
@use '../../theming/inspection';
|
|
70
73
|
|
|
71
74
|
/// Gets the tokens for the given theme, m2 tokens module, and theming system.
|
|
72
75
|
/// @param {Map} $theme The Angular Material theme object to generate token values from.
|
|
@@ -80,11 +83,11 @@
|
|
|
80
83
|
@return meta.call(
|
|
81
84
|
meta.get-function(get-#{$system}-tokens, $module: $module));
|
|
82
85
|
}
|
|
83
|
-
@if not
|
|
86
|
+
@if not inspection.theme-has($theme, $system) {
|
|
84
87
|
@return ();
|
|
85
88
|
}
|
|
86
89
|
@return meta.call(
|
|
87
|
-
meta.get-function(get-#{$system}-tokens, $module: $module),
|
|
90
|
+
meta.get-function(get-#{$system}-tokens, $module: $module), $theme);
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
/// Gets the fully qualified tokens map for the given theme and m2 tokens module.
|
|
@@ -117,6 +120,7 @@
|
|
|
117
120
|
_get-tokens-for-module($theme, tokens-mat-bottom-sheet),
|
|
118
121
|
_get-tokens-for-module($theme, tokens-mat-button-toggle),
|
|
119
122
|
_get-tokens-for-module($theme, tokens-mat-card),
|
|
123
|
+
_get-tokens-for-module($theme, tokens-mat-chip),
|
|
120
124
|
_get-tokens-for-module($theme, tokens-mat-datepicker),
|
|
121
125
|
_get-tokens-for-module($theme, tokens-mat-dialog),
|
|
122
126
|
_get-tokens-for-module($theme, tokens-mat-divider),
|
|
@@ -142,6 +146,7 @@
|
|
|
142
146
|
_get-tokens-for-module($theme, tokens-mat-select),
|
|
143
147
|
_get-tokens-for-module($theme, tokens-mat-sidenav),
|
|
144
148
|
_get-tokens-for-module($theme, tokens-mat-slider),
|
|
149
|
+
_get-tokens-for-module($theme, tokens-mat-switch),
|
|
145
150
|
_get-tokens-for-module($theme, tokens-mat-snack-bar),
|
|
146
151
|
_get-tokens-for-module($theme, tokens-mat-sort),
|
|
147
152
|
_get-tokens-for-module($theme, tokens-mat-stepper),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use '@material/elevation/elevation-theme' as mdc-elevation;
|
|
1
2
|
@use '../../token-utils';
|
|
2
3
|
@use '../../../theming/inspection';
|
|
3
4
|
@use '../../../style/sass-utils';
|
|
@@ -8,7 +9,10 @@ $prefix: (mat, autocomplete);
|
|
|
8
9
|
// Tokens that can't be configured through Angular Material's current theming API,
|
|
9
10
|
// but may be in a future version of the theming API.
|
|
10
11
|
@function get-unthemable-tokens() {
|
|
11
|
-
@return (
|
|
12
|
+
@return (
|
|
13
|
+
container-shape: 4px,
|
|
14
|
+
container-elevation-shadow: mdc-elevation.elevation-box-shadow(8),
|
|
15
|
+
);
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
// Tokens that can be configured through Angular Material's color theming API.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
1
2
|
@use '../../token-utils';
|
|
3
|
+
@use '../../../theming/inspection';
|
|
2
4
|
@use '../../../style/sass-utils';
|
|
5
|
+
@use '../../../theming/palette';
|
|
3
6
|
|
|
4
7
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
5
8
|
$prefix: (mat, chip);
|
|
@@ -9,12 +12,33 @@ $prefix: (mat, chip);
|
|
|
9
12
|
@function get-unthemable-tokens() {
|
|
10
13
|
@return (
|
|
11
14
|
disabled-container-opacity: 0.4,
|
|
15
|
+
trailing-action-opacity: 0.54,
|
|
16
|
+
trailing-action-focus-opacity: 1,
|
|
17
|
+
trailing-action-state-layer-color: transparent,
|
|
18
|
+
selected-trailing-action-state-layer-color: transparent,
|
|
19
|
+
trailing-action-hover-state-layer-opacity: 0,
|
|
20
|
+
trailing-action-focus-state-layer-opacity: 0,
|
|
12
21
|
);
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
// Tokens that can be configured through Angular Material's color theming API.
|
|
16
|
-
@function get-color-tokens($theme) {
|
|
17
|
-
|
|
25
|
+
@function get-color-tokens($theme, $palette-name: null) {
|
|
26
|
+
$foreground: null;
|
|
27
|
+
@if $palette-name == null {
|
|
28
|
+
$is-dark: inspection.get-theme-type($theme) == dark;
|
|
29
|
+
$grey-50: map.get(palette.$grey-palette, 50);
|
|
30
|
+
$grey-900: map.get(palette.$grey-palette, 900);
|
|
31
|
+
$foreground: if($is-dark, $grey-50, $grey-900);
|
|
32
|
+
}
|
|
33
|
+
@else {
|
|
34
|
+
$foreground: inspection.get-theme-color($theme, $palette-name, default-contrast);
|
|
35
|
+
}
|
|
36
|
+
@return (
|
|
37
|
+
// The color of the icon at the end of a disabled chip.
|
|
38
|
+
selected-disabled-trailing-icon-color: $foreground,
|
|
39
|
+
// The color of the icon at the end of the chip.
|
|
40
|
+
selected-trailing-icon-color: $foreground
|
|
41
|
+
);
|
|
18
42
|
}
|
|
19
43
|
|
|
20
44
|
// Tokens that can be configured through Angular Material's typography theming API.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@use '../../token-utils';
|
|
2
2
|
@use '../../../theming/inspection';
|
|
3
3
|
@use '../../../style/sass-utils';
|
|
4
|
+
@use '@material/elevation/elevation-theme' as mdc-elevation;
|
|
4
5
|
|
|
5
6
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
6
7
|
$prefix: (mat, select);
|
|
@@ -8,7 +9,9 @@ $prefix: (mat, select);
|
|
|
8
9
|
// Tokens that can't be configured through Angular Material's current theming API,
|
|
9
10
|
// but may be in a future version of the theming API.
|
|
10
11
|
@function get-unthemable-tokens() {
|
|
11
|
-
@return (
|
|
12
|
+
@return (
|
|
13
|
+
container-elevation-shadow: mdc-elevation.elevation-box-shadow(8),
|
|
14
|
+
);
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
// Tokens that can be configured through Angular Material's color theming API.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use '@material/elevation/elevation-theme' as mdc-elevation;
|
|
1
2
|
@use 'sass:color';
|
|
2
3
|
@use 'sass:meta';
|
|
3
4
|
@use '../../token-utils';
|
|
@@ -14,6 +15,8 @@ $prefix: (mat, sidenav);
|
|
|
14
15
|
// Currently zero, but it appears to be relevant for M3.
|
|
15
16
|
// See: https://m3.material.io/components/navigation-drawer/overview
|
|
16
17
|
container-shape: 0,
|
|
18
|
+
container-elevation-shadow: mdc-elevation.elevation-box-shadow(16),
|
|
19
|
+
container-width: auto,
|
|
17
20
|
);
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use '../../token-utils';
|
|
2
|
+
@use '../../../style/sass-utils';
|
|
3
|
+
|
|
4
|
+
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
5
|
+
$prefix: (mat, switch);
|
|
6
|
+
|
|
7
|
+
// Tokens that can't be configured through Angular Material's current theming API,
|
|
8
|
+
// but may be in a future version of the theming API.
|
|
9
|
+
@function get-unthemable-tokens() {
|
|
10
|
+
@return (
|
|
11
|
+
unselected-handle-size: 20px,
|
|
12
|
+
selected-handle-size: 20px,
|
|
13
|
+
pressed-handle-size: 20px,
|
|
14
|
+
with-icon-handle-size: 20px,
|
|
15
|
+
|
|
16
|
+
selected-handle-horizontal-margin: 0,
|
|
17
|
+
selected-with-icon-handle-horizontal-margin: 0,
|
|
18
|
+
selected-pressed-handle-horizontal-margin: 0,
|
|
19
|
+
unselected-handle-horizontal-margin: 0,
|
|
20
|
+
unselected-with-icon-handle-horizontal-margin: 0,
|
|
21
|
+
unselected-pressed-handle-horizontal-margin: 0,
|
|
22
|
+
|
|
23
|
+
// The hidden and visible track represent whichever track is visible or
|
|
24
|
+
// hidden in the ui. This could be the .mdc-switch__track :before or
|
|
25
|
+
// :after depending on whether the switch is selected or unselected.
|
|
26
|
+
//
|
|
27
|
+
// The m2 slide-toggle uses transforms to hide & show the tracks while
|
|
28
|
+
// the m3 slide-toggle uses opacity.
|
|
29
|
+
|
|
30
|
+
visible-track-opacity: 1,
|
|
31
|
+
hidden-track-opacity: 1,
|
|
32
|
+
visible-track-transition: transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1),
|
|
33
|
+
hidden-track-transition: transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1),
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Tokens that can be configured through Angular Material's color theming API.
|
|
38
|
+
@function get-color-tokens($theme) {
|
|
39
|
+
@return ();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Tokens that can be configured through Angular Material's typography theming API.
|
|
43
|
+
@function get-typography-tokens($theme) {
|
|
44
|
+
@return ();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Tokens that can be configured through Angular Material's density theming API.
|
|
48
|
+
@function get-density-tokens($theme) {
|
|
49
|
+
@return ();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Combines the tokens generated by the above functions into a single map with placeholder values.
|
|
53
|
+
// This is used to create token slots.
|
|
54
|
+
@function get-token-slots() {
|
|
55
|
+
@return sass-utils.deep-merge-all(
|
|
56
|
+
get-unthemable-tokens(),
|
|
57
|
+
get-color-tokens(token-utils.$placeholder-color-config),
|
|
58
|
+
get-typography-tokens(token-utils.$placeholder-typography-config),
|
|
59
|
+
get-density-tokens(token-utils.$placeholder-density-config)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -47,6 +47,18 @@ $prefix: (mdc, chip);
|
|
|
47
47
|
disabled-outline-color: transparent,
|
|
48
48
|
// The chip's border color when focused.
|
|
49
49
|
focus-outline-color: transparent,
|
|
50
|
+
// The opacity of the chip's state overlay when hovered.
|
|
51
|
+
hover-state-layer-opacity: 0.04,
|
|
52
|
+
// The opacity of the chip's avatar when disabled.
|
|
53
|
+
with-avatar-disabled-avatar-opacity: 1,
|
|
54
|
+
// The chip's border width when selected.
|
|
55
|
+
flat-selected-outline-width: 0,
|
|
56
|
+
// The opacity of the chip's state overlay when selected and hovered.
|
|
57
|
+
selected-hover-state-layer-opacity: 0.04,
|
|
58
|
+
// The opacity of the chip's trailing icon when it is disabled.
|
|
59
|
+
with-trailing-icon-disabled-trailing-icon-opacity: 1,
|
|
60
|
+
// The opacity of the chip's leading icon when it is disabled.
|
|
61
|
+
with-icon-disabled-icon-opacity: 1,
|
|
50
62
|
// Not used by MDC.
|
|
51
63
|
disabled-label-text-opacity: null,
|
|
52
64
|
// Not used by MDC.
|
|
@@ -60,20 +72,12 @@ $prefix: (mdc, chip);
|
|
|
60
72
|
// Our chips do not have a border.
|
|
61
73
|
flat-outline-width: null,
|
|
62
74
|
// Our chips do not have a border.
|
|
63
|
-
flat-selected-outline-width: null,
|
|
64
|
-
// Our chips do not have a border.
|
|
65
75
|
flat-unselected-outline-width: null,
|
|
66
76
|
// Not used by MDC.
|
|
67
|
-
with-avatar-disabled-avatar-opacity: null,
|
|
68
|
-
// Not used by MDC.
|
|
69
|
-
with-icon-disabled-icon-opacity: null,
|
|
70
|
-
// Not used by MDC.
|
|
71
77
|
with-leading-icon-disabled-leading-icon-opacity: null,
|
|
72
78
|
// Not used by MDC.
|
|
73
79
|
with-leading-icon-leading-icon-size: null,
|
|
74
80
|
// Not used by MDC.
|
|
75
|
-
with-trailing-icon-disabled-trailing-icon-opacity: null,
|
|
76
|
-
// Not used by MDC.
|
|
77
81
|
with-trailing-icon-trailing-icon-size: null,
|
|
78
82
|
// Elevated chips not implemented.
|
|
79
83
|
container-elevation: null,
|
|
@@ -94,8 +98,6 @@ $prefix: (mdc, chip);
|
|
|
94
98
|
// Elevated chips not implemented.
|
|
95
99
|
elevated-pressed-container-elevation: null,
|
|
96
100
|
// Elevated chips not implemented.
|
|
97
|
-
elevated-selected-container-color: null,
|
|
98
|
-
// Elevated chips not implemented.
|
|
99
101
|
elevated-selected-container-elevation: null,
|
|
100
102
|
// Elevated chips not implemented.
|
|
101
103
|
elevated-unselected-container-color: null,
|
|
@@ -103,8 +105,6 @@ $prefix: (mdc, chip);
|
|
|
103
105
|
flat-container-elevation: null,
|
|
104
106
|
// Our chips do not have a border.
|
|
105
107
|
flat-disabled-outline-color: null,
|
|
106
|
-
// Not providing this uses
|
|
107
|
-
flat-disabled-selected-container-color: null,
|
|
108
108
|
// Not used by MDC.
|
|
109
109
|
flat-disabled-selected-container-opacity: null,
|
|
110
110
|
// Unused.
|
|
@@ -142,10 +142,6 @@ $prefix: (mdc, chip);
|
|
|
142
142
|
// Unused.
|
|
143
143
|
hover-label-text-color: null,
|
|
144
144
|
// Unused.
|
|
145
|
-
hover-state-layer-color: null,
|
|
146
|
-
// Unused.
|
|
147
|
-
hover-state-layer-opacity: null,
|
|
148
|
-
// Unused.
|
|
149
145
|
pressed-label-text-color: null,
|
|
150
146
|
// Unused.
|
|
151
147
|
pressed-state-layer-color: null,
|
|
@@ -154,18 +150,8 @@ $prefix: (mdc, chip);
|
|
|
154
150
|
// Unused.
|
|
155
151
|
selected-focus-label-text-color: null,
|
|
156
152
|
// Unused.
|
|
157
|
-
selected-focus-state-layer-color: null,
|
|
158
|
-
// Unused.
|
|
159
|
-
selected-focus-state-layer-opacity: null,
|
|
160
|
-
// Unused.
|
|
161
153
|
selected-hover-label-text-color: null,
|
|
162
154
|
// Unused.
|
|
163
|
-
selected-hover-state-layer-color: null,
|
|
164
|
-
// Unused.
|
|
165
|
-
selected-hover-state-layer-opacity: null,
|
|
166
|
-
// Unused.
|
|
167
|
-
selected-label-text-color: null,
|
|
168
|
-
// Unused.
|
|
169
155
|
selected-pressed-label-text-color: null,
|
|
170
156
|
// Unused.
|
|
171
157
|
selected-pressed-state-layer-color: null,
|
|
@@ -265,14 +251,28 @@ $prefix: (mdc, chip);
|
|
|
265
251
|
disabled-label-text-color: $foreground,
|
|
266
252
|
// The background-color of the chip.
|
|
267
253
|
elevated-container-color: $background,
|
|
254
|
+
// The background-color of the chip when selected.
|
|
255
|
+
elevated-selected-container-color: $background,
|
|
268
256
|
// The background-color of a disabled chip.
|
|
269
257
|
elevated-disabled-container-color: $background,
|
|
258
|
+
// The background color of the chip when disabled and selected.
|
|
259
|
+
flat-disabled-selected-container-color: $background,
|
|
270
260
|
// The color of the focus state layer.
|
|
271
261
|
focus-state-layer-color: $state-layer-color,
|
|
262
|
+
// The color of the hover state layer.
|
|
263
|
+
hover-state-layer-color: $state-layer-color,
|
|
264
|
+
// The color of the chip's state overlay when selected and hovered.
|
|
265
|
+
selected-hover-state-layer-color: $state-layer-color,
|
|
272
266
|
// The opacity of the focus state layer.
|
|
273
267
|
focus-state-layer-opacity: $state-layer-opacity,
|
|
268
|
+
// The color of the chip's state overlay when selected and focused.
|
|
269
|
+
selected-focus-state-layer-color: $state-layer-color,
|
|
270
|
+
// The opacity of the chip's state overlay when selected and focused.
|
|
271
|
+
selected-focus-state-layer-opacity: $state-layer-opacity,
|
|
274
272
|
// The chip text color.
|
|
275
273
|
label-text-color: $foreground,
|
|
274
|
+
// The chip text color when selected.
|
|
275
|
+
selected-label-text-color: $foreground,
|
|
276
276
|
// The icon color of a chip.
|
|
277
277
|
with-icon-icon-color: $foreground,
|
|
278
278
|
// The color of the icon of a disabled chip.
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:string';
|
|
1
4
|
@use 'typography-utils';
|
|
2
5
|
@use '../theming/inspection';
|
|
3
6
|
@use './versioning';
|
|
@@ -8,11 +11,133 @@
|
|
|
8
11
|
@forward './definition';
|
|
9
12
|
@forward './versioning';
|
|
10
13
|
|
|
14
|
+
@mixin typography-hierarchy($theme, $selector: '.mat-typography', $back-compat: false) {
|
|
15
|
+
@if inspection.get-theme-version($theme) == 1 {
|
|
16
|
+
@include _m3-typography-hierarchy($theme, $selector, $back-compat);
|
|
17
|
+
}
|
|
18
|
+
@else {
|
|
19
|
+
@include _m2-typography-hierarchy($theme, $selector);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@function _get-selector($selectors, $prefix) {
|
|
24
|
+
$result: ();
|
|
25
|
+
@each $selector in $selectors {
|
|
26
|
+
// Don't add "naked" tag selectors, and don't nest prefix selector.
|
|
27
|
+
@if string.index($selector, '.') == 1 {
|
|
28
|
+
$result: list.append($result, $selector, $separator: comma);
|
|
29
|
+
}
|
|
30
|
+
// Don't nest the prefix selector in itself.
|
|
31
|
+
@if $selector != $prefix {
|
|
32
|
+
$result: list.append($result, '#{$prefix} #{$selector}', $separator: comma);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
@return $result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@mixin _m3-typography-level($theme, $selector-prefix, $level, $selectors, $margin: null) {
|
|
39
|
+
#{_get-selector($selectors, $selector-prefix)} {
|
|
40
|
+
// TODO(mmalerba): When we expose system tokens as CSS vars, we should change this to emit token
|
|
41
|
+
// slots.
|
|
42
|
+
font: inspection.get-theme-typography($theme, $level, font);
|
|
43
|
+
letter-spacing: inspection.get-theme-typography($theme, $level, letter-spacing);
|
|
44
|
+
@if $margin != null {
|
|
45
|
+
margin: 0 0 $margin;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@mixin _m3-typography-hierarchy($theme, $selector-prefix, $add-m2-selectors) {
|
|
51
|
+
$levels: (
|
|
52
|
+
display-large: (
|
|
53
|
+
selectors: ('.mat-display-large', 'h1'),
|
|
54
|
+
m2-selectors: ('.mat-h1', '.mat-headline-1'),
|
|
55
|
+
margin: 0.5em
|
|
56
|
+
),
|
|
57
|
+
display-medium: (
|
|
58
|
+
selectors: ('.mat-display-medium', 'h2'),
|
|
59
|
+
m2-selectors: ('.mat-h2', '.mat-headline-2'),
|
|
60
|
+
margin: 0.5em
|
|
61
|
+
),
|
|
62
|
+
display-small: (
|
|
63
|
+
selectors: ('.mat-display-small', 'h3'),
|
|
64
|
+
m2-selectors: ('.mat-h3', '.mat-headline-3'),
|
|
65
|
+
margin: 0.5em
|
|
66
|
+
),
|
|
67
|
+
headline-large: (
|
|
68
|
+
selectors: ('.mat-headline-large', 'h4'),
|
|
69
|
+
m2-selectors: ('.mat-h4', '.mat-headline-4'),
|
|
70
|
+
margin: 0.5em
|
|
71
|
+
),
|
|
72
|
+
headline-medium: (
|
|
73
|
+
selectors: ('.mat-headline-medium', 'h5'),
|
|
74
|
+
m2-selectors: ('.mat-h5', '.mat-headline-5'),
|
|
75
|
+
margin: 0.5em
|
|
76
|
+
),
|
|
77
|
+
headline-small: (
|
|
78
|
+
selectors: ('.mat-headline-small', 'h6'),
|
|
79
|
+
m2-selectors: ('.mat-h6', '.mat-headline-6'),
|
|
80
|
+
margin: 0.5em
|
|
81
|
+
),
|
|
82
|
+
title-large: (
|
|
83
|
+
selectors: ('.mat-title-large'),
|
|
84
|
+
m2-selectors: ('.mat-subtitle-1'),
|
|
85
|
+
),
|
|
86
|
+
title-medium: (
|
|
87
|
+
selectors: ('.mat-title-medium'),
|
|
88
|
+
m2-selectors: ('.mat-subtitle-2'),
|
|
89
|
+
),
|
|
90
|
+
title-small: (
|
|
91
|
+
selectors: ('.mat-title-small')
|
|
92
|
+
),
|
|
93
|
+
body-large: (
|
|
94
|
+
selectors: ('.mat-body-large', $selector-prefix),
|
|
95
|
+
m2-selectors: ('.mat-body', '.mat-body-strong', '.mat-body-2'),
|
|
96
|
+
),
|
|
97
|
+
body-medium: (
|
|
98
|
+
selectors: ('.mat-body-medium')
|
|
99
|
+
),
|
|
100
|
+
body-small: (
|
|
101
|
+
selectors: ('.mat-body-small')
|
|
102
|
+
),
|
|
103
|
+
label-large: (
|
|
104
|
+
selectors: ('.mat-label-large')
|
|
105
|
+
),
|
|
106
|
+
label-medium: (
|
|
107
|
+
selectors: ('.mat-label-medium')
|
|
108
|
+
),
|
|
109
|
+
label-small: (
|
|
110
|
+
selectors: ('.mat-label-small'),
|
|
111
|
+
m2-selectors: ('.mat-small', '.mat-caption')
|
|
112
|
+
),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
@each $level, $options in $levels {
|
|
116
|
+
@if $add-m2-selectors {
|
|
117
|
+
$options: map.set($options, selectors,
|
|
118
|
+
list.join(map.get($options, selectors), map.get($options, m2-selectors) or ()));
|
|
119
|
+
}
|
|
120
|
+
$options: map.remove($options, m2-selectors);
|
|
121
|
+
|
|
122
|
+
// Apply styles for the level.
|
|
123
|
+
@include _m3-typography-level($theme, $selector-prefix, $level, $options...);
|
|
124
|
+
|
|
125
|
+
// Also style <p> inside body-large.
|
|
126
|
+
@if $level == body-large {
|
|
127
|
+
#{_get-selector(map.get($options, selectors), $selector-prefix)} {
|
|
128
|
+
p {
|
|
129
|
+
margin: 0 0 0.75em;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
11
136
|
/// Emits baseline typographic styles based on a given config.
|
|
12
137
|
/// @param {Map} $config-or-theme A typography config for an entire theme.
|
|
13
138
|
/// @param {String} $selector Ancestor selector under which native elements, such as h1, will
|
|
14
139
|
/// be styled.
|
|
15
|
-
@mixin typography-hierarchy($theme, $selector
|
|
140
|
+
@mixin _m2-typography-hierarchy($theme, $selector) {
|
|
16
141
|
// Note that it seems redundant to prefix the class rules with the `$selector`, however it's
|
|
17
142
|
// necessary if we want to allow people to overwrite the tag selectors. This is due to
|
|
18
143
|
// selectors like `#{$selector} h1` being more specific than ones like `.mat-title`.
|