@ng-matero/extensions 17.1.4 → 17.2.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/_index.scss +6 -0
- package/alert/_alert-theme.scss +10 -5
- package/alert/alert.scss +4 -1
- package/colorpicker/_colorpicker-theme.scss +9 -5
- package/colorpicker/colorpicker.d.ts +5 -11
- package/core/style/_sass-utils.scss +19 -0
- package/core/theming/_inspection.scss +38 -0
- package/core/theming/_validation.scss +5 -0
- package/core/theming/m3/_color-api-back-compat.scss +46 -0
- package/core/theming/m3/_config-validation.scss +166 -0
- package/core/theming/m3/_custom-tokens.scss +315 -0
- package/core/theming/m3/_definition.scss +104 -0
- package/core/theming/m3/_format-tokens.scss +5 -0
- package/core/theming/m3/_m3-density.scss +50 -0
- package/core/theming/m3/_m3-tokens.scss +308 -0
- package/core/tokens/_token-utils.scss +140 -0
- package/core/tokens/m2/_index.scss +23 -2
- package/core/tokens/m2/mtx/_alert.scss +1 -0
- package/core/tokens/m2/mtx/_datetimepicker.scss +11 -6
- package/core/tokens/m2/mtx/_grid.scss +3 -2
- package/core/tokens/m2/mtx/_popover.scss +1 -1
- package/core/tokens/m2/mtx/_select.scss +1 -1
- package/datetimepicker/_datetimepicker-theme.scss +14 -12
- package/datetimepicker/calendar.scss +13 -0
- package/datetimepicker/clock.scss +5 -5
- package/datetimepicker/datetimepicker-content.scss +9 -2
- package/datetimepicker/datetimepicker.d.ts +5 -11
- package/datetimepicker/time.scss +10 -8
- package/drawer/_drawer-theme.scss +10 -5
- package/esm2022/alert/alert.mjs +2 -2
- package/esm2022/colorpicker/colorpicker.mjs +10 -16
- package/esm2022/datetimepicker/calendar.mjs +3 -3
- package/esm2022/datetimepicker/clock.mjs +3 -3
- package/esm2022/datetimepicker/datetimepicker.mjs +11 -16
- package/esm2022/datetimepicker/time.mjs +3 -3
- package/esm2022/grid/grid.mjs +3 -3
- package/esm2022/popover/popover.mjs +3 -3
- package/esm2022/select/select.mjs +3 -3
- package/esm2022/split/split.mjs +7 -14
- package/fesm2022/mtxAlert.mjs +2 -2
- package/fesm2022/mtxAlert.mjs.map +1 -1
- package/fesm2022/mtxColorpicker.mjs +10 -16
- package/fesm2022/mtxColorpicker.mjs.map +1 -1
- package/fesm2022/mtxDatetimepicker.mjs +16 -21
- package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2022/mtxGrid.mjs +2 -2
- package/fesm2022/mtxGrid.mjs.map +1 -1
- package/fesm2022/mtxPopover.mjs +2 -2
- package/fesm2022/mtxPopover.mjs.map +1 -1
- package/fesm2022/mtxSelect.mjs +2 -2
- package/fesm2022/mtxSelect.mjs.map +1 -1
- package/fesm2022/mtxSplit.mjs +6 -13
- package/fesm2022/mtxSplit.mjs.map +1 -1
- package/grid/_grid-theme.scss +9 -5
- package/grid/grid.scss +18 -8
- package/loader/_loader-theme.scss +10 -5
- package/package.json +13 -13
- package/popover/_popover-theme.scss +10 -5
- package/popover/popover.scss +1 -1
- 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/progress/_progress-theme.scss +10 -5
- package/select/_select-theme.scss +14 -12
- package/select/select.scss +1 -1
- package/split/_split-theme.scss +15 -12
- package/split/split.d.ts +3 -9
- package/tooltip/_tooltip-theme.scss +9 -5
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '@angular/material' as mat;
|
|
3
|
+
@use '@angular/material-experimental' as matx;
|
|
4
|
+
@use '@material/elevation/elevation-theme' as mdc-elevation;
|
|
5
|
+
|
|
6
|
+
/// Hardcode the given value, or null if hardcoded values are excluded.
|
|
7
|
+
@function _hardcode($value, $exclude-hardcoded) {
|
|
8
|
+
@return if($exclude-hardcoded, null, $value);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/// Sets all of the standard typography tokens for the given token base name to the given typography
|
|
12
|
+
/// level.
|
|
13
|
+
/// @param {Map} $systems The MDC system tokens
|
|
14
|
+
/// @param {String} $base-name The token base name to get the typography tokens for
|
|
15
|
+
/// @param {String} $typography-level The typography level to base the token values on
|
|
16
|
+
/// @return {Map} A map containing the typography tokens for the given base token name
|
|
17
|
+
@function _generate-typography-tokens($systems, $base-name, $typography-level) {
|
|
18
|
+
$result: ();
|
|
19
|
+
@each $prop in (font, line-height, size, tracking, weight) {
|
|
20
|
+
$result: map.set($result, #{$base-name}-#{$prop},
|
|
21
|
+
map.get($systems, md-sys-typescale, #{$typography-level}-#{$prop}));
|
|
22
|
+
}
|
|
23
|
+
@return $result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@function alert($systems, $exclude-hardcoded) {
|
|
27
|
+
@return (
|
|
28
|
+
container-shape: map.get($systems, md-sys-shape, corner-small),
|
|
29
|
+
|
|
30
|
+
outline-color: _hardcode(transparent, $exclude-hardcoded),
|
|
31
|
+
background-color: map.get($systems, md-sys-color, surface-container),
|
|
32
|
+
text-color: map.get($systems, md-sys-color, on-surface),
|
|
33
|
+
info-background-color: map.get(matx.$m3-blue-palette, 50),
|
|
34
|
+
info-text-color: _hardcode(white, $exclude-hardcoded),
|
|
35
|
+
success-background-color: map.get(matx.$m3-green-palette, 50),
|
|
36
|
+
success-text-color: _hardcode(white, $exclude-hardcoded),
|
|
37
|
+
warning-background-color: map.get(matx.$m3-orange-palette, 50),
|
|
38
|
+
warning-text-color: _hardcode(white, $exclude-hardcoded),
|
|
39
|
+
danger-background-color: map.get(matx.$m3-red-palette, 50),
|
|
40
|
+
danger-text-color: _hardcode(white, $exclude-hardcoded),
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@function colorpicker($systems, $exclude-hardcoded) {
|
|
45
|
+
@return (
|
|
46
|
+
toggle-active-state-icon-color: map.get($systems, md-sys-color, on-surface-variant),
|
|
47
|
+
toggle-icon-color: map.get($systems, md-sys-color, on-surface-variant),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@function datetimepicker($systems, $exclude-hardcoded) {
|
|
52
|
+
@return ((
|
|
53
|
+
calendar-header-background-color: _hardcode(transparent, $exclude-hardcoded),
|
|
54
|
+
calendar-date-selected-state-text-color: map.get($systems, md-sys-color, on-primary),
|
|
55
|
+
calendar-date-selected-state-background-color: map.get($systems, md-sys-color, primary),
|
|
56
|
+
calendar-date-selected-disabled-state-background-color: mat.private-safe-color-change(
|
|
57
|
+
map.get($systems, md-sys-color, on-surface),
|
|
58
|
+
$alpha: 0.38
|
|
59
|
+
),
|
|
60
|
+
calendar-date-today-selected-state-outline-color: map.get($systems, md-sys-color, primary),
|
|
61
|
+
calendar-date-focus-state-background-color: mat.private-safe-color-change(
|
|
62
|
+
map.get($systems, md-sys-color, on-surface),
|
|
63
|
+
$alpha: map.get($systems, md-sys-state, focus-state-layer-opacity)
|
|
64
|
+
),
|
|
65
|
+
calendar-date-hover-state-background-color: mat.private-safe-color-change(
|
|
66
|
+
map.get($systems, md-sys-color, on-surface),
|
|
67
|
+
$alpha: map.get($systems, md-sys-state, hover-state-layer-opacity)
|
|
68
|
+
),
|
|
69
|
+
toggle-active-state-icon-color: map.get($systems, md-sys-color, on-surface-variant),
|
|
70
|
+
toggle-icon-color: map.get($systems, md-sys-color, on-surface-variant),
|
|
71
|
+
calendar-body-label-text-color: map.get($systems, md-sys-color, on-surface),
|
|
72
|
+
calendar-header-text-color: map.get($systems, md-sys-color, on-surface-variant),
|
|
73
|
+
calendar-header-divider-color: map.get($systems, md-sys-color, outline-variant),
|
|
74
|
+
calendar-table-header-text-color: map.get($systems, md-sys-color, on-surface),
|
|
75
|
+
calendar-date-today-outline-color: map.get($systems, md-sys-color, primary),
|
|
76
|
+
calendar-date-text-color: map.get($systems, md-sys-color, on-surface),
|
|
77
|
+
calendar-date-outline-color: _hardcode(transparent, $exclude-hardcoded),
|
|
78
|
+
calendar-date-disabled-state-text-color: mat.private-safe-color-change(
|
|
79
|
+
map.get($systems, md-sys-color, on-surface),
|
|
80
|
+
$alpha: 0.38
|
|
81
|
+
),
|
|
82
|
+
container-background-color: map.get($systems, md-sys-color, surface-container-high),
|
|
83
|
+
container-text-color: map.get($systems, md-sys-color, on-surface),
|
|
84
|
+
|
|
85
|
+
clock-dial-background-color: map.get($systems, md-sys-color, surface-container-highest),
|
|
86
|
+
clock-cell-text-color: map.get($systems, md-sys-color, on-surface),
|
|
87
|
+
clock-cell-hover-state-background-color: mat.private-safe-color-change(
|
|
88
|
+
map.get($systems, md-sys-color, on-surface),
|
|
89
|
+
$alpha: map.get($systems, md-sys-state, hover-state-layer-opacity)
|
|
90
|
+
),
|
|
91
|
+
clock-cell-disabled-state-text-color: mat.private-safe-color-change(
|
|
92
|
+
map.get($systems, md-sys-color, on-surface),
|
|
93
|
+
$alpha: 0.38
|
|
94
|
+
),
|
|
95
|
+
clock-cell-selected-state-background-color: map.get($systems, md-sys-color, primary),
|
|
96
|
+
clock-hand-background-color: map.get($systems, md-sys-color, primary),
|
|
97
|
+
time-input-active-state-text-color: map.get($systems, md-sys-color, on-primary-container),
|
|
98
|
+
time-input-active-state-background-color: map.get($systems, md-sys-color, primary-container),
|
|
99
|
+
time-input-focus-state-outline-color: map.get($systems, md-sys-color, primary),
|
|
100
|
+
time-input-focus-state-placeholder-text-color: map.get($systems, md-sys-color, on-primary-container),
|
|
101
|
+
time-input-text-color: map.get($systems, md-sys-color, on-surface),
|
|
102
|
+
time-input-background-color: map.get($systems, md-sys-color, surface-container-highest),
|
|
103
|
+
time-input-focus-state-background-color: map.get($systems, md-sys-color, primary-container),
|
|
104
|
+
time-input-warn-state-outline-color: map.get($systems, md-sys-color, error),
|
|
105
|
+
time-ampm-text-color: map.get($systems, md-sys-color, on-surface),
|
|
106
|
+
time-ampm-outline-color: map.get($systems, md-sys-color, outline),
|
|
107
|
+
time-ampm-selected-state-text-color: map.get($systems, md-sys-color, on-tertiary-container),
|
|
108
|
+
time-ampm-selected-state-background-color: map.get($systems, md-sys-color, tertiary-container),
|
|
109
|
+
|
|
110
|
+
container-elevation-shadow: _hardcode(mdc-elevation.elevation-box-shadow(0), $exclude-hardcoded),
|
|
111
|
+
container-touch-elevation-shadow: _hardcode(mdc-elevation.elevation-box-shadow(0), $exclude-hardcoded),
|
|
112
|
+
container-shape: map.get($systems, md-sys-shape, corner-large),
|
|
113
|
+
container-touch-shape: map.get($systems, md-sys-shape, corner-extra-large),
|
|
114
|
+
selector-container-shape: map.get($systems, md-sys-shape, corner-small),
|
|
115
|
+
|
|
116
|
+
calendar-text-font: map.get($systems, md-sys-typescale, body-large-font),
|
|
117
|
+
calendar-text-size: map.get($systems, md-sys-typescale, body-large-size),
|
|
118
|
+
calendar-body-label-text-size: map.get($systems, md-sys-typescale, title-small-size),
|
|
119
|
+
calendar-body-label-text-weight: map.get($systems, md-sys-typescale, title-small-weight),
|
|
120
|
+
calendar-period-button-text-size: map.get($systems, md-sys-typescale, title-small-size),
|
|
121
|
+
calendar-period-button-text-weight: map.get($systems, md-sys-typescale, title-small-weight),
|
|
122
|
+
calendar-header-text-size: map.get($systems, md-sys-typescale, title-small-size),
|
|
123
|
+
calendar-header-text-weight: map.get($systems, md-sys-typescale, title-small-weight),
|
|
124
|
+
clock-text-size: map.get($systems, md-sys-typescale, title-small-size),
|
|
125
|
+
), (
|
|
126
|
+
// Color variants:
|
|
127
|
+
primary: (), // Default, no overrides needed.
|
|
128
|
+
secondary: (
|
|
129
|
+
calendar-date-selected-state-text-color: map.get($systems, md-sys-color, on-secondary),
|
|
130
|
+
calendar-date-selected-state-background-color: map.get($systems, md-sys-color, secondary),
|
|
131
|
+
calendar-date-today-selected-state-outline-color: map.get($systems, md-sys-color, secondary),
|
|
132
|
+
calendar-date-today-outline-color: map.get($systems, md-sys-color, secondary),
|
|
133
|
+
clock-hand-background-color: map.get($systems, md-sys-color, secondary),
|
|
134
|
+
clock-cell-selected-state-background-color: map.get($systems, md-sys-color, secondary),
|
|
135
|
+
time-input-active-state-text-color: map.get($systems, md-sys-color, on-secondary-container),
|
|
136
|
+
time-input-active-state-background-color: map.get($systems, md-sys-color, secondary-container),
|
|
137
|
+
time-input-focus-state-outline-color: map.get($systems, md-sys-color, secondary),
|
|
138
|
+
time-input-focus-state-placeholder-text-color: map.get($systems, md-sys-color, on-secondary-container),
|
|
139
|
+
time-input-focus-state-background-color: map.get($systems, md-sys-color, secondary-container),
|
|
140
|
+
time-ampm-selected-state-text-color: map.get($systems, md-sys-color, on-tertiary-container),
|
|
141
|
+
time-ampm-selected-state-background-color: map.get($systems, md-sys-color, tertiary-container),
|
|
142
|
+
),
|
|
143
|
+
tertiary: (
|
|
144
|
+
calendar-date-selected-state-text-color: map.get($systems, md-sys-color, on-tertiary),
|
|
145
|
+
calendar-date-selected-state-background-color: map.get($systems, md-sys-color, tertiary),
|
|
146
|
+
calendar-date-today-selected-state-outline-color: map.get($systems, md-sys-color, tertiary),
|
|
147
|
+
calendar-date-today-outline-color: map.get($systems, md-sys-color, tertiary),
|
|
148
|
+
clock-hand-background-color: map.get($systems, md-sys-color, tertiary),
|
|
149
|
+
clock-cell-selected-state-background-color: map.get($systems, md-sys-color, tertiary),
|
|
150
|
+
time-input-active-state-text-color: map.get($systems, md-sys-color, on-tertiary-container),
|
|
151
|
+
time-input-active-state-background-color: map.get($systems, md-sys-color, tertiary-container),
|
|
152
|
+
time-input-focus-state-outline-color: map.get($systems, md-sys-color, tertiary),
|
|
153
|
+
time-input-focus-state-placeholder-text-color: map.get($systems, md-sys-color, on-tertiary-container),
|
|
154
|
+
time-input-focus-state-background-color: map.get($systems, md-sys-color, tertiary-container),
|
|
155
|
+
time-ampm-selected-state-text-color: map.get($systems, md-sys-color, on-error-container),
|
|
156
|
+
time-ampm-selected-state-background-color: map.get($systems, md-sys-color, error-container),
|
|
157
|
+
),
|
|
158
|
+
error: (
|
|
159
|
+
calendar-date-selected-state-text-color: map.get($systems, md-sys-color, on-error),
|
|
160
|
+
calendar-date-selected-state-background-color: map.get($systems, md-sys-color, error),
|
|
161
|
+
calendar-date-today-selected-state-outline-color: map.get($systems, md-sys-color, error),
|
|
162
|
+
calendar-date-today-outline-color: map.get($systems, md-sys-color, error),
|
|
163
|
+
clock-hand-background-color: map.get($systems, md-sys-color, error),
|
|
164
|
+
clock-cell-selected-state-background-color: map.get($systems, md-sys-color, error),
|
|
165
|
+
time-input-active-state-text-color: map.get($systems, md-sys-color, on-error-container),
|
|
166
|
+
time-input-active-state-background-color: map.get($systems, md-sys-color, error-container),
|
|
167
|
+
time-input-focus-state-outline-color: map.get($systems, md-sys-color, error),
|
|
168
|
+
time-input-focus-state-placeholder-text-color: map.get($systems, md-sys-color, on-error-container),
|
|
169
|
+
time-input-focus-state-background-color: map.get($systems, md-sys-color, error-container),
|
|
170
|
+
time-ampm-selected-state-text-color: map.get($systems, md-sys-color, on-primary-container),
|
|
171
|
+
time-ampm-selected-state-background-color: map.get($systems, md-sys-color, primary-container),
|
|
172
|
+
)
|
|
173
|
+
));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@function drawer($systems, $exclude-hardcoded) {
|
|
177
|
+
@return (
|
|
178
|
+
container-shape: map.get($systems, md-sys-shape, corner-large),
|
|
179
|
+
|
|
180
|
+
container-background-color: map.get($systems, md-sys-color, surface),
|
|
181
|
+
container-text-color: map.get($systems, md-sys-color, on-surface-variant),
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@function grid($systems, $exclude-hardcoded) {
|
|
186
|
+
@return (
|
|
187
|
+
container-shape: map.get($systems, md-sys-shape, corner-medium),
|
|
188
|
+
table-cell-min-width: _hardcode(80px, $exclude-hardcoded),
|
|
189
|
+
|
|
190
|
+
outline-color: map.get($systems, md-sys-color, outline-variant),
|
|
191
|
+
column-menu-text-color: map.get($systems, md-sys-color, on-surface-variant),
|
|
192
|
+
column-menu-divider-color: map.get($systems, md-sys-color, outline-variant),
|
|
193
|
+
table-footer-background-color: map.get($systems, md-sys-color, surface-container),
|
|
194
|
+
table-row-striped-background-color: map.get($systems, md-sys-color, surface-container),
|
|
195
|
+
table-row-hover-background-color: map.get($systems, md-sys-color, secondary-container),
|
|
196
|
+
table-row-selected-background-color: map.get($systems, md-sys-color, secondary-container),
|
|
197
|
+
table-row-selected-hover-background-color: map.get($systems, md-sys-color, primary-container),
|
|
198
|
+
table-cell-selected-outline-color: map.get($systems, md-sys-color, primary),
|
|
199
|
+
resizable-handle-active-background-color: map.get($systems, md-sys-color, primary),
|
|
200
|
+
resizable-handle-hover-background-color: map.get($systems, md-sys-color, primary),
|
|
201
|
+
resizable-handle-disabled-background-color: map.get($systems, md-sys-color, outline-variant),
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@function loader($systems, $exclude-hardcoded) {
|
|
206
|
+
@return (
|
|
207
|
+
backdrop-background-color: mat.private-safe-color-change(
|
|
208
|
+
map.get($systems, md-sys-color, surface),
|
|
209
|
+
$alpha: 0.75
|
|
210
|
+
),
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@function popover($systems, $exclude-hardcoded) {
|
|
215
|
+
@return (
|
|
216
|
+
container-shape: map.get($systems, md-sys-shape, corner-extra-small),
|
|
217
|
+
|
|
218
|
+
outline-color: map.get($systems, md-sys-color, surface-container),
|
|
219
|
+
background-color: map.get($systems, md-sys-color, surface-container),
|
|
220
|
+
text-color: map.get($systems, md-sys-color, on-surface),
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@function progress($systems, $exclude-hardcoded) {
|
|
225
|
+
@return (
|
|
226
|
+
container-shape: map.get($systems, md-sys-shape, corner-extra-small),
|
|
227
|
+
|
|
228
|
+
track-color: map.get($systems, md-sys-color, surface-container),
|
|
229
|
+
indicator-color: map.get($systems, md-sys-color, outline-variant),
|
|
230
|
+
text-color: map.get($systems, md-sys-color, on-surface),
|
|
231
|
+
info-indicator-color: map.get(matx.$m3-blue-palette, 50),
|
|
232
|
+
info-text-color:_hardcode(white, $exclude-hardcoded),
|
|
233
|
+
success-indicator-color: map.get(matx.$m3-green-palette, 50),
|
|
234
|
+
success-text-color:_hardcode(white, $exclude-hardcoded),
|
|
235
|
+
warning-indicator-color: map.get(matx.$m3-orange-palette, 50),
|
|
236
|
+
warning-text-color:_hardcode(white, $exclude-hardcoded),
|
|
237
|
+
danger-indicator-color: map.get(matx.$m3-red-palette, 50),
|
|
238
|
+
danger-text-color:_hardcode(white, $exclude-hardcoded),
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@function select($systems, $exclude-hardcoded) {
|
|
243
|
+
@return ((
|
|
244
|
+
container-shape: map.get($systems, md-sys-shape, corner-extra-small),
|
|
245
|
+
|
|
246
|
+
container-text-color: map.get($systems, md-sys-color, on-surface),
|
|
247
|
+
placeholder-text-color: mat.private-safe-color-change(
|
|
248
|
+
map.get($systems, md-sys-color, on-surface),
|
|
249
|
+
$alpha: 0.38
|
|
250
|
+
),
|
|
251
|
+
disabled-text-color: mat.private-safe-color-change(
|
|
252
|
+
map.get($systems, md-sys-color, on-surface),
|
|
253
|
+
$alpha: 0.38
|
|
254
|
+
),
|
|
255
|
+
|
|
256
|
+
multiple-value-background-color: _hardcode(transparent, $exclude-hardcoded),
|
|
257
|
+
multiple-value-outline-color: map.get($systems, md-sys-color, outline),
|
|
258
|
+
multiple-value-icon-hover-background-color: map.get($systems, md-sys-color, outline-variant),
|
|
259
|
+
|
|
260
|
+
clear-icon-color: map.get($systems, md-sys-color, on-surface),
|
|
261
|
+
clear-icon-hover-color: map.get($systems, md-sys-color, error),
|
|
262
|
+
|
|
263
|
+
enabled-arrow-color: map.get($systems, md-sys-color, on-surface),
|
|
264
|
+
disabled-arrow-color: mat.private-safe-color-change(
|
|
265
|
+
map.get($systems, md-sys-color, on-surface),
|
|
266
|
+
$alpha: 0.38
|
|
267
|
+
),
|
|
268
|
+
invalid-arrow-color: map.get($systems, md-sys-color, error),
|
|
269
|
+
|
|
270
|
+
panel-background-color: map.get($systems, md-sys-color, surface-container),
|
|
271
|
+
panel-divider-color: map.get($systems, md-sys-color, outline),
|
|
272
|
+
optgroup-label-text-color: map.get($systems, md-sys-color, on-surface),
|
|
273
|
+
option-label-text-color: map.get($systems, md-sys-color, on-surface),
|
|
274
|
+
option-selected-state-background-color: map.get($systems, md-sys-color, secondary-container),
|
|
275
|
+
option-selected-state-text-color: map.get($systems, md-sys-color, on-surface),
|
|
276
|
+
option-hover-state-background-color: mat.private-safe-color-change(
|
|
277
|
+
map.get($systems, md-sys-color, on-surface),
|
|
278
|
+
$alpha: map.get($systems, md-sys-state, hover-state-layer-opacity)
|
|
279
|
+
),
|
|
280
|
+
option-disabled-state-text-color: mat.private-safe-color-change(
|
|
281
|
+
map.get($systems, md-sys-color, on-surface),
|
|
282
|
+
$alpha: 0.38
|
|
283
|
+
),
|
|
284
|
+
), (
|
|
285
|
+
// Color variants:
|
|
286
|
+
primary: (
|
|
287
|
+
option-selected-state-background-color: map.get($systems, md-sys-color, primary-container),
|
|
288
|
+
),
|
|
289
|
+
secondary: (), // Default, no overrides needed.
|
|
290
|
+
tertiary: (
|
|
291
|
+
option-selected-state-background-color: map.get($systems, md-sys-color, tertiary-container),
|
|
292
|
+
),
|
|
293
|
+
error: (
|
|
294
|
+
option-selected-state-background-color: map.get($systems, md-sys-color, error-container),
|
|
295
|
+
)
|
|
296
|
+
));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@function split($systems, $exclude-hardcoded) {
|
|
300
|
+
@return ((
|
|
301
|
+
gutter-background-color: map.get($systems, md-sys-color, outline-variant),
|
|
302
|
+
gutter-hover-state-background-color: map.get($systems, md-sys-color, primary),
|
|
303
|
+
), (
|
|
304
|
+
primary: (),
|
|
305
|
+
secondary: (
|
|
306
|
+
gutter-hover-state-background-color: map.get($systems, md-sys-color, secondary),
|
|
307
|
+
),
|
|
308
|
+
tertiary: (
|
|
309
|
+
gutter-hover-state-background-color: map.get($systems, md-sys-color, tertiary),
|
|
310
|
+
),
|
|
311
|
+
error: (
|
|
312
|
+
gutter-hover-state-background-color: map.get($systems, md-sys-color, error),
|
|
313
|
+
)
|
|
314
|
+
));
|
|
315
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// This file contains functions used to define Angular Material theme objects.
|
|
2
|
+
|
|
3
|
+
@use 'sass:map';
|
|
4
|
+
@use '@angular/material' as mat;
|
|
5
|
+
@use '@angular/material-experimental' as matx;
|
|
6
|
+
@use './m3-tokens';
|
|
7
|
+
@use './config-validation';
|
|
8
|
+
|
|
9
|
+
/// Map key used to store internals of theme config.
|
|
10
|
+
$internals: _mat-theming-internals-do-not-access;
|
|
11
|
+
/// The theme version of generated themes.
|
|
12
|
+
$theme-version: 1;
|
|
13
|
+
|
|
14
|
+
/// Defines an Angular Material theme object with color, typography, and density settings.
|
|
15
|
+
/// @param {Map} $config The theme configuration
|
|
16
|
+
/// @return {Map} A theme object
|
|
17
|
+
@function define-theme($config: ()) {
|
|
18
|
+
$err: config-validation.validate-theme-config($config);
|
|
19
|
+
@if $err {
|
|
20
|
+
@error $err;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@return mat.private-deep-merge-all(
|
|
24
|
+
define-colors(map.get($config, color) or ()),
|
|
25
|
+
define-typography(map.get($config, typography) or ()),
|
|
26
|
+
define-density(map.get($config, density) or ()),
|
|
27
|
+
($internals: (base-tokens: m3-tokens.generate-base-tokens())),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// Defines an Angular Material theme object with color settings.
|
|
32
|
+
/// @param {Map} $config The color configuration
|
|
33
|
+
/// @return {Map} A theme object
|
|
34
|
+
@function define-colors($config: ()) {
|
|
35
|
+
$err: config-validation.validate-color-config($config);
|
|
36
|
+
@if $err {
|
|
37
|
+
@error $err;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
$type: map.get($config, theme-type) or light;
|
|
41
|
+
$primary: map.get($config, primary) or matx.$m3-violet-palette;
|
|
42
|
+
$tertiary: map.get($config, tertiary) or $primary;
|
|
43
|
+
|
|
44
|
+
@return (
|
|
45
|
+
$internals: (
|
|
46
|
+
theme-version: $theme-version,
|
|
47
|
+
theme-type: $type,
|
|
48
|
+
palettes: (
|
|
49
|
+
primary: map.remove($primary, neutral, neutral-variant, secondary),
|
|
50
|
+
secondary: map.get($primary, secondary),
|
|
51
|
+
tertiary: map.remove($tertiary, neutral, neutral-variant, secondary),
|
|
52
|
+
neutral: map.get($primary, neutral),
|
|
53
|
+
neutral-variant: map.get($primary, neutral-variant),
|
|
54
|
+
error: map.get($primary, error),
|
|
55
|
+
),
|
|
56
|
+
color-tokens: m3-tokens.generate-color-tokens(
|
|
57
|
+
$type, $primary, $tertiary, map.get($primary, error))
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// Defines an Angular Material theme object with typography settings.
|
|
63
|
+
/// @param {Map} $config The typography configuration
|
|
64
|
+
/// @return {Map} A theme object
|
|
65
|
+
@function define-typography($config: ()) {
|
|
66
|
+
$err: config-validation.validate-typography-config($config);
|
|
67
|
+
@if $err {
|
|
68
|
+
@error $err;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
$plain: map.get($config, plain-family) or (Roboto, sans-serif);
|
|
72
|
+
$brand: map.get($config, brand-family) or $plain;
|
|
73
|
+
$bold: map.get($config, bold-weight) or 700;
|
|
74
|
+
$medium: map.get($config, medium-weight) or 500;
|
|
75
|
+
$regular: map.get($config, regular-weight) or 400;
|
|
76
|
+
|
|
77
|
+
@return (
|
|
78
|
+
$internals: (
|
|
79
|
+
theme-version: $theme-version,
|
|
80
|
+
typography-tokens: m3-tokens.generate-typography-tokens(
|
|
81
|
+
$brand, $plain, $bold, $medium, $regular)
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// Defines an Angular Material theme object with density settings.
|
|
87
|
+
/// @param {Map} $config The density configuration
|
|
88
|
+
/// @return {Map} A theme object
|
|
89
|
+
@function define-density($config: ()) {
|
|
90
|
+
$err: config-validation.validate-density-config($config);
|
|
91
|
+
@if $err {
|
|
92
|
+
@error $err;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$density-scale: map.get($config, scale) or 0;
|
|
96
|
+
|
|
97
|
+
@return (
|
|
98
|
+
$internals: (
|
|
99
|
+
theme-version: $theme-version,
|
|
100
|
+
density-scale: $density-scale,
|
|
101
|
+
density-tokens: m3-tokens.generate-density-tokens($density-scale)
|
|
102
|
+
)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use '@angular/material' as mat;
|
|
4
|
+
|
|
5
|
+
/// Maps namespaced tokens to per-density-scale values.
|
|
6
|
+
/// This is used as a temporary solution for density, since Material Design currently does not have
|
|
7
|
+
/// systemized density.
|
|
8
|
+
/// Format:
|
|
9
|
+
/// (
|
|
10
|
+
/// (mdc, comp): (
|
|
11
|
+
/// token: (<scale 0 value>, <scale -1 value>, <scale -2 value>, ...),
|
|
12
|
+
/// ...
|
|
13
|
+
/// ),
|
|
14
|
+
/// ...
|
|
15
|
+
/// )
|
|
16
|
+
// TODO(mmalerba): Add density tokens for remaining components.
|
|
17
|
+
$_density-tokens: (
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
/// Gets the value for the given density scale from the given set of density values.
|
|
21
|
+
/// @param {List} $density-values The list of values for each density scale.
|
|
22
|
+
/// @param {Number} $scale The density scale to get the value for.
|
|
23
|
+
/// @return {*} The value for the given scale.
|
|
24
|
+
@function _get-value-for-scale($density-values, $scale) {
|
|
25
|
+
$scale: mat.private-clamp-density($scale, -1 * list.length($density-values) + 1);
|
|
26
|
+
$index: -$scale + 1;
|
|
27
|
+
@return list.nth($density-values, $index);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Gets a map of all density tokens for the given scale
|
|
31
|
+
/// @param {Number} $scale The density scale
|
|
32
|
+
/// @return {Map} Map of all fully qualified density tokens for the given scale.
|
|
33
|
+
@function get-tokens-for-scale($scale) {
|
|
34
|
+
$result: ();
|
|
35
|
+
@each $namespace, $tokens in $_density-tokens {
|
|
36
|
+
@each $token, $density-values in $tokens {
|
|
37
|
+
$tokens: map.set($tokens, $token, _get-value-for-scale($density-values, $scale));
|
|
38
|
+
}
|
|
39
|
+
$result: map.set($result, $namespace, $tokens);
|
|
40
|
+
}
|
|
41
|
+
@return $result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// Checks whether the given token is systemized by Angular Material's made up density system.
|
|
45
|
+
/// @param {List} $namespace The namespace of the token
|
|
46
|
+
/// @param {String} $token The name of the token
|
|
47
|
+
/// @return {Boolean} Whether the token is systemized by the density system
|
|
48
|
+
@function is-systemized($namespace, $token) {
|
|
49
|
+
@return map.get($_density-tokens, $namespace, $token) != null;
|
|
50
|
+
}
|