@acontplus/ng-components 2.1.30 → 2.1.32
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 +21 -0
- package/fesm2022/acontplus-ng-components.mjs +5957 -3544
- package/fesm2022/acontplus-ng-components.mjs.map +1 -1
- package/package.json +41 -16
- package/src/_index.scss +22 -0
- package/src/core/color/_all-color.scss +15 -0
- package/src/core/density/_all-density.scss +17 -0
- package/src/core/style/_elevation.scss +207 -0
- package/src/core/theming/_all-theme.scss +36 -0
- package/src/core/theming/_config-validation.scss +171 -0
- package/src/core/theming/_definition.scss +158 -0
- package/src/core/theming/_palettes.scss +1576 -0
- package/src/core/theming/prebuilt/aqua.scss +21 -0
- package/src/core/theming/prebuilt/blue.scss +21 -0
- package/src/core/theming/prebuilt/cyan.scss +21 -0
- package/src/core/theming/prebuilt/green.scss +21 -0
- package/src/core/theming/prebuilt/orange.scss +21 -0
- package/src/core/theming/prebuilt/pink.scss +21 -0
- package/src/core/theming/prebuilt/purple.scss +21 -0
- package/src/core/theming/prebuilt/rose.scss +21 -0
- package/src/core/tokens/_m3-tokens.scss +141 -0
- package/src/core/tokens/_m3-utils.scss +36 -0
- package/src/core/tokens/_system.scss +388 -0
- package/src/core/tokens/_token-utils.scss +117 -0
- package/src/core/tokens/m3/_index.scss +7 -0
- package/src/core/tokens/m3/_md-sys-color.scss +150 -0
- package/src/core/tokens/m3/_md-sys-elevation.scss +8 -0
- package/src/core/tokens/m3/_md-sys-motion.scss +35 -0
- package/src/core/tokens/m3/_md-sys-shape.scss +31 -0
- package/src/core/tokens/m3/_md-sys-state.scss +13 -0
- package/src/core/tokens/m3/_md-sys-typescale.scss +131 -0
- package/src/core/tokens/m3/_theme.scss +41 -0
- package/src/core/typography/_all-typography.scss +12 -0
- package/src/lib/components/alert/_alert-theme.scss +57 -0
- package/src/lib/components/alert/_m3-alert.scss +72 -0
- package/src/lib/components/alert/alert.scss +60 -0
- package/src/lib/components/autocomplete-wrapper/autocomplete-wrapper.scss +667 -0
- package/src/lib/components/button/button.scss +297 -0
- package/src/lib/components/cards/dynamic-card/dynamic-card.scss +131 -0
- package/src/lib/components/checkbox-group/checkbox-group.scss +14 -0
- package/src/lib/components/date-range-input/calendar/date-range-calendar.scss +29 -0
- package/src/lib/components/date-range-input/date-range-input.scss +194 -0
- package/src/lib/components/dialog-wrapper/dialog-wrapper.scss +36 -0
- package/src/lib/components/drawer/_drawer-theme.scss +57 -0
- package/src/lib/components/drawer/_m3-drawer.scss +23 -0
- package/src/lib/components/drawer/drawer-container.scss +97 -0
- package/src/lib/components/grid/_grid-theme.scss +53 -0
- package/src/lib/components/grid/_m3-grid.scss +34 -0
- package/src/lib/components/grid/cell/cell.scss +38 -0
- package/src/lib/components/grid/column-menu/column-menu.scss +117 -0
- package/src/lib/components/grid/column-resize/_column-resize.scss +126 -0
- package/src/lib/components/grid/grid.scss +245 -0
- package/src/lib/components/icons/svg-icon/svg-icon.scss +16 -0
- package/src/lib/components/icons/user-icon/user-icon.scss +0 -0
- package/src/lib/components/input-chip/input-chip.scss +0 -0
- package/src/lib/components/popover/_m3-popover.scss +24 -0
- package/src/lib/components/popover/_popover-theme.scss +57 -0
- package/src/lib/components/popover/popover.scss +239 -0
- package/src/lib/components/spinner/spinner.scss +6 -0
- package/src/lib/components/tables/tabulator-table/tabulator-table.scss +68 -0
- package/src/lib/components/theme-toggle/theme-toggle.scss +3 -0
- package/src/lib/styles/_elevation.scss +168 -0
- package/src/lib/styles/_token-utils.scss +115 -0
- package/types/acontplus-ng-components.d.ts +1017 -536
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use '@angular/material' as mat;
|
|
5
|
+
@use './../../lib/components/alert/m3-alert';
|
|
6
|
+
@use './../../lib/components/drawer/m3-drawer';
|
|
7
|
+
@use './../../lib/components/grid/m3-grid';
|
|
8
|
+
@use './../../lib/components/popover/m3-popover';
|
|
9
|
+
@use './../style/elevation';
|
|
10
|
+
@use './../theming/config-validation';
|
|
11
|
+
@use '../theming/definition';
|
|
12
|
+
@use '../theming/palettes';
|
|
13
|
+
@use './m3';
|
|
14
|
+
|
|
15
|
+
/// Emits necessary CSS variables for Material's system level values for the values defined in the
|
|
16
|
+
/// config map. The config map can have values color, typography, and/or density.
|
|
17
|
+
///
|
|
18
|
+
/// If the config map's color value is an Angular Material color palette, it will be used as the
|
|
19
|
+
/// primary and tertiary colors with a `color-scheme` theme type. Otherwise if the color value is a
|
|
20
|
+
/// map, it must have a `primary` value containing an Angular Material color palette, and
|
|
21
|
+
/// optionally a different `tertiary` palette (defaults to primary palette) and `theme-type` that
|
|
22
|
+
/// is either `light`, `dark`, or 'color-scheme` (defaults to `color-scheme`). Color variable
|
|
23
|
+
/// definitions will not be emitted if there are no color values in the config.
|
|
24
|
+
///
|
|
25
|
+
/// If the config map's typography value is a font family string, it will be used as the
|
|
26
|
+
/// plain and brand font family with default bold, medium, and regular weights of 700, 500, and 400,
|
|
27
|
+
/// respectfully. Otherwise if the typography value is a map, it must have a `plain-family` font
|
|
28
|
+
/// family value, and optionally a different `brand-family` font family (defaults to the plain
|
|
29
|
+
/// value) and weights for `bold-weight` (default: 700), `bold-weight` (default: 500), and
|
|
30
|
+
/// `bold-weight` (default: 400). Typography variable definitions will not be emitted if there are
|
|
31
|
+
/// no typography values in the config.
|
|
32
|
+
///
|
|
33
|
+
/// If the config map's density value is a number, it will be used as the density scale. Otherwise
|
|
34
|
+
/// if the density value is a map, it must have a `scale` value. Density variable definitions will
|
|
35
|
+
/// not be emitted if there are no density values in the config.
|
|
36
|
+
///
|
|
37
|
+
/// The application variables emitted use the namespace prefix "--mat-sys".
|
|
38
|
+
/// e.g. --mat-sys-surface: #E5E5E5
|
|
39
|
+
///
|
|
40
|
+
/// @param {Map} $config The color configuration with optional keys color, typography, or density.
|
|
41
|
+
@mixin theme($config, $overrides: ()) {
|
|
42
|
+
$color: map.get($config, color);
|
|
43
|
+
$color-config: null;
|
|
44
|
+
@if ($color) {
|
|
45
|
+
// validate-palette returns null if it is a valid M3 palette
|
|
46
|
+
$is-palette: config-validation.validate-palette($color) == null;
|
|
47
|
+
|
|
48
|
+
// Default to "color-scheme" theme type if the config's color does not provide one.
|
|
49
|
+
@if (not $is-palette and not map.has-key($color, theme-type)) {
|
|
50
|
+
$color: map.set($color, theme-type, color-scheme);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
$color-config: $color;
|
|
54
|
+
@if ($is-palette) {
|
|
55
|
+
$color: map.set($color, tertiary, $color);
|
|
56
|
+
$color-config: (
|
|
57
|
+
definition.$internals: (
|
|
58
|
+
palettes: (
|
|
59
|
+
primary: map.remove($color, neutral, neutral-variant, secondary),
|
|
60
|
+
secondary: map.get($color, secondary),
|
|
61
|
+
tertiary: map.remove($color, neutral, neutral-variant, secondary, error),
|
|
62
|
+
neutral: map.get($color, neutral),
|
|
63
|
+
neutral-variant: map.get($color, neutral-variant),
|
|
64
|
+
error: map.get($color, error),
|
|
65
|
+
),
|
|
66
|
+
theme-type: color-scheme,
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
} @else {
|
|
70
|
+
$primary: map.get($color, primary) or palettes.$violet-palette;
|
|
71
|
+
$tertiary: map.get($color, tertiary) or $primary;
|
|
72
|
+
$color-config: (
|
|
73
|
+
definition.$internals: (
|
|
74
|
+
palettes: (
|
|
75
|
+
primary: map.remove($primary, neutral, neutral-variant, secondary),
|
|
76
|
+
secondary: map.get($primary, secondary),
|
|
77
|
+
tertiary: map.remove($tertiary, neutral, neutral-variant, secondary, error),
|
|
78
|
+
neutral: map.get($primary, neutral),
|
|
79
|
+
neutral-variant: map.get($primary, neutral-variant),
|
|
80
|
+
error: map.get($primary, error),
|
|
81
|
+
),
|
|
82
|
+
theme-type: map.get($color, theme-type),
|
|
83
|
+
),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@include system-level-colors($color-config, $overrides, definition.$system-fallback-prefix);
|
|
88
|
+
@include system-level-elevation($color-config, $overrides, definition.$system-fallback-prefix);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
$typography: map.get($config, typography);
|
|
92
|
+
$typography-config: null;
|
|
93
|
+
@if ($typography) {
|
|
94
|
+
$plain: (Roboto, sans-serif);
|
|
95
|
+
$brand: $plain;
|
|
96
|
+
$bold: 700;
|
|
97
|
+
$medium: 500;
|
|
98
|
+
$regular: 400;
|
|
99
|
+
@if (meta.type-of($typography) == map) {
|
|
100
|
+
$plain: map.get($typography, plain-family);
|
|
101
|
+
$brand: map.get($typography, brand-family) or $plain;
|
|
102
|
+
$bold: map.get($typography, bold-weight) or $bold;
|
|
103
|
+
$medium: map.get($typography, medium-weight) or $medium;
|
|
104
|
+
$regular: map.get($typography, regular-weight) or $regular;
|
|
105
|
+
} @else {
|
|
106
|
+
$plain: $typography;
|
|
107
|
+
$brand: $typography;
|
|
108
|
+
}
|
|
109
|
+
$typography-config: (
|
|
110
|
+
definition.$internals: (
|
|
111
|
+
font-definition: (
|
|
112
|
+
plain: $plain,
|
|
113
|
+
brand: $brand,
|
|
114
|
+
bold: $bold,
|
|
115
|
+
medium: $medium,
|
|
116
|
+
regular: $regular,
|
|
117
|
+
),
|
|
118
|
+
),
|
|
119
|
+
);
|
|
120
|
+
@include system-level-typography(
|
|
121
|
+
$typography-config,
|
|
122
|
+
$overrides,
|
|
123
|
+
definition.$system-fallback-prefix
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
$density: map.get($config, density);
|
|
128
|
+
$density-config: null;
|
|
129
|
+
@if ($density) {
|
|
130
|
+
$scale: 0;
|
|
131
|
+
@if (meta.type-of($density) == map) {
|
|
132
|
+
$scale: map.get($density, scale);
|
|
133
|
+
} @else {
|
|
134
|
+
$scale: $density;
|
|
135
|
+
}
|
|
136
|
+
@if ($scale != 0) {
|
|
137
|
+
// Emit component-level density tokens if the scale is lower than 0. The density tokens
|
|
138
|
+
// do not fallback to any system-level values and must be defined if the scale is different.
|
|
139
|
+
$density-tokens: get-density-tokens($scale);
|
|
140
|
+
@each $tokens in $density-tokens {
|
|
141
|
+
@each $token-name, $token-value in $tokens {
|
|
142
|
+
--mat-#{$token-name}: #{$token-value};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@include system-level-shape($overrides: $overrides, $prefix: definition.$system-fallback-prefix);
|
|
149
|
+
@include system-level-state($overrides: $overrides, $prefix: definition.$system-fallback-prefix);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Gets all density-related tokens from the components.
|
|
153
|
+
@function get-density-tokens($scale) {
|
|
154
|
+
@return (
|
|
155
|
+
m3-alert.get-density-tokens($scale),
|
|
156
|
+
m3-colorpicker.get-density-tokens($scale),
|
|
157
|
+
m3-datetimepicker.get-density-tokens($scale),
|
|
158
|
+
m3-drawer.get-density-tokens($scale),
|
|
159
|
+
m3-grid.get-density-tokens($scale),
|
|
160
|
+
m3-loader.get-density-tokens($scale),
|
|
161
|
+
m3-popover.get-density-tokens($scale),
|
|
162
|
+
m3-progress.get-density-tokens($scale),
|
|
163
|
+
m3-select.get-density-tokens($scale),
|
|
164
|
+
m3-split.get-density-tokens($scale),
|
|
165
|
+
m3-tooltip.get-density-tokens($scale)
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/// Emits the system-level CSS variables for each of the provided override values. E.g. to
|
|
170
|
+
/// change the primary color to red, use `mat.theme-overrides((primary: red));`
|
|
171
|
+
@mixin theme-overrides($overrides, $prefix: definition.$system-fallback-prefix) {
|
|
172
|
+
$sys-names: map-merge-all(
|
|
173
|
+
m3.md-sys-color-values-light(palettes.$blue-palette),
|
|
174
|
+
m3.md-sys-typescale-values(
|
|
175
|
+
(
|
|
176
|
+
brand: (
|
|
177
|
+
Roboto,
|
|
178
|
+
),
|
|
179
|
+
plain: (
|
|
180
|
+
Roboto,
|
|
181
|
+
),
|
|
182
|
+
bold: 700,
|
|
183
|
+
medium: 500,
|
|
184
|
+
regular: 400,
|
|
185
|
+
)
|
|
186
|
+
),
|
|
187
|
+
m3.md-sys-elevation-values(),
|
|
188
|
+
m3.md-sys-shape-values(),
|
|
189
|
+
m3.md-sys-state-values()
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
@include mat.private-current-selector-or-root {
|
|
193
|
+
@each $name, $value in $overrides {
|
|
194
|
+
@if (map.has-key($sys-names, $name)) {
|
|
195
|
+
--#{$prefix}-#{$name}: #{map.get($overrides, $name)};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@mixin system-level-colors($theme, $overrides: (), $prefix: null) {
|
|
202
|
+
$palettes: map.get($theme, definition.$internals, palettes);
|
|
203
|
+
$type: map.get($theme, definition.$internals, theme-type);
|
|
204
|
+
|
|
205
|
+
@if (not $prefix) {
|
|
206
|
+
$prefix: map.get($theme, definition.$internals, color-system-variables-prefix) or
|
|
207
|
+
definition.$system-level-prefix;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
$sys-colors: _generate-sys-colors($palettes, $type);
|
|
211
|
+
|
|
212
|
+
// Manually insert a subset of palette values that are used directly by components
|
|
213
|
+
// instead of system variables.
|
|
214
|
+
$sys-colors: map.set($sys-colors, neutral-variant20, map.get($palettes, neutral-variant, 20));
|
|
215
|
+
$sys-colors: map.set($sys-colors, neutral10, map.get($palettes, neutral, 10));
|
|
216
|
+
|
|
217
|
+
@include mat.private-current-selector-or-root {
|
|
218
|
+
@each $name, $value in $sys-colors {
|
|
219
|
+
--#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@function _generate-sys-colors($palettes, $type) {
|
|
225
|
+
$light-sys-colors: m3.md-sys-color-values-light($palettes);
|
|
226
|
+
@if ($type == light) {
|
|
227
|
+
@return $light-sys-colors;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
$dark-sys-colors: m3.md-sys-color-values-dark($palettes);
|
|
231
|
+
@if ($type == dark) {
|
|
232
|
+
@return $dark-sys-colors;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@if ($type == color-scheme) {
|
|
236
|
+
$light-dark-sys-colors: ();
|
|
237
|
+
@each $name, $light-value in $light-sys-colors {
|
|
238
|
+
$dark-value: map.get($dark-sys-colors, $name);
|
|
239
|
+
$light-dark-sys-colors: map.set(
|
|
240
|
+
$light-dark-sys-colors,
|
|
241
|
+
$name,
|
|
242
|
+
light-dark($light-value, $dark-value)
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
@return $light-dark-sys-colors;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@error 'Unknown theme-type provided: #{$type}';
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@mixin system-level-typography($theme, $overrides: (), $prefix: null) {
|
|
252
|
+
$font-definition: map.get($theme, definition.$internals, font-definition);
|
|
253
|
+
|
|
254
|
+
@if (not $prefix) {
|
|
255
|
+
$prefix: map.get($theme, definition.$internals, typography-system-variables-prefix) or
|
|
256
|
+
definition.$system-level-prefix;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@include mat.private-current-selector-or-root {
|
|
260
|
+
@each $name, $value in m3.md-sys-typescale-values($font-definition) {
|
|
261
|
+
--#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@mixin system-level-elevation($theme, $overrides: (), $prefix: definition.$system-level-prefix) {
|
|
267
|
+
$shadow-color: map.get($theme, definition.$internals, palettes, neutral, 0);
|
|
268
|
+
|
|
269
|
+
@include mat.private-current-selector-or-root {
|
|
270
|
+
@each $name, $value in m3.md-sys-elevation-values() {
|
|
271
|
+
$level: map.get($overrides, $name) or $value;
|
|
272
|
+
$value: elevation.get-box-shadow($level, $shadow-color);
|
|
273
|
+
|
|
274
|
+
--#{$prefix}-#{$name}: #{$value};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@mixin system-level-shape($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
|
|
280
|
+
@include mat.private-current-selector-or-root {
|
|
281
|
+
@each $name, $value in m3.md-sys-shape-values() {
|
|
282
|
+
--#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
@mixin system-level-state($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
|
|
288
|
+
@include mat.private-current-selector-or-root {
|
|
289
|
+
@each $name, $value in m3.md-sys-state-values() {
|
|
290
|
+
--#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/// Creates a single merged map from the provided variable-length map arguments
|
|
296
|
+
@function map-merge-all($maps...) {
|
|
297
|
+
$result: ();
|
|
298
|
+
@each $map in $maps {
|
|
299
|
+
$result: map.merge($result, $map);
|
|
300
|
+
}
|
|
301
|
+
@return $result;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Defines Angular Material system variables using M2 values provided by
|
|
305
|
+
// an M2 theme config created with `mat.m2-define-light-theme` or `mat.m2-define-dark-theme`.
|
|
306
|
+
//
|
|
307
|
+
// This enables applications to style custom components with system-level CSS
|
|
308
|
+
// variables instead of creating a separate component theme mixin that relies on
|
|
309
|
+
// the theme config.
|
|
310
|
+
//
|
|
311
|
+
// For example, use `var(--mat-sys-primary)` to get a theme's primary color instead of
|
|
312
|
+
// pulling it from the theme with `m2-get-color-from-palette($primary-palette, default)`.
|
|
313
|
+
//
|
|
314
|
+
// Unlike M3's `mat.theme()`, this mixin does not replace the need to call
|
|
315
|
+
// individual component theme mixins for Angular Material components.
|
|
316
|
+
@mixin m2-theme($theme-config, $overrides: ()) {
|
|
317
|
+
@if mat.get-theme-version($theme-config) == 1 {
|
|
318
|
+
@error '`m2-theme` mixin should only be called for M2 theme ' +
|
|
319
|
+
'configs created with define-light-theme or define-dark-theme';
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Check whether any override keys do not match keys in the theme
|
|
323
|
+
// config system map.
|
|
324
|
+
$invalid-keys: ();
|
|
325
|
+
$config-system: map.get($theme-config, _mat-system);
|
|
326
|
+
@each $key, $value in $overrides {
|
|
327
|
+
@if (not map.has-key($config-system, $key)) {
|
|
328
|
+
$invalid-keys: list.append($invalid-keys, $key);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
@if (list.length($invalid-keys) > 0) {
|
|
332
|
+
@error 'The following overrides are not valid system variables: #{$invalid-keys}. ' +
|
|
333
|
+
'Valid keys are: #{map.keys($config-system)}';
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
$config: m2-inspection.get-m2-config($theme-config);
|
|
337
|
+
|
|
338
|
+
$color: map.get($config, color);
|
|
339
|
+
@if (m2-inspection.theme-has($theme-config, color)) {
|
|
340
|
+
$system-colors: null;
|
|
341
|
+
|
|
342
|
+
@if (map.get($color, is-dark)) {
|
|
343
|
+
$system-colors: m2.md-sys-color-values-dark($color);
|
|
344
|
+
} @else {
|
|
345
|
+
$system-colors: m2.md-sys-color-values-light($color);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
@include _define-m2-system-vars($system-colors, $overrides);
|
|
349
|
+
|
|
350
|
+
$shadow: map.get($theme-config, _mat-system, shadow);
|
|
351
|
+
$system-elevations: ();
|
|
352
|
+
@each $name, $value in m2.md-sys-elevation-values() {
|
|
353
|
+
$level: map.get($overrides, $name) or $value;
|
|
354
|
+
$value: elevation.get-box-shadow($level, $shadow);
|
|
355
|
+
$system-elevations: map.set($system-elevations, $name, $value);
|
|
356
|
+
}
|
|
357
|
+
@include _define-m2-system-vars($system-elevations, $overrides);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
$typography: map.get($config, typography);
|
|
361
|
+
@if ($typography) {
|
|
362
|
+
$system-typography: m2.md-sys-typescale-values($typography);
|
|
363
|
+
@include _define-m2-system-vars($system-typography, $overrides);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
@include _define-m2-system-vars(m2.md-sys-shape-values(), $overrides);
|
|
367
|
+
@include _define-m2-system-vars(m2.md-sys-state-values(), $overrides);
|
|
368
|
+
|
|
369
|
+
// The icon button's color token is set to `inherit` for M2 and intended to display
|
|
370
|
+
// the color inherited from its parent element. This is crucial because it's unknown
|
|
371
|
+
// whether the icon button sits on a container with background like "surface" or "primary",
|
|
372
|
+
// where both may have different contrast colors like white or black.
|
|
373
|
+
// However, variables set to inherit AND define a fallback will always use the fallback,
|
|
374
|
+
// which is "on-surface-variant". This mixin now defines this value.
|
|
375
|
+
// To avoid this, and continue using `inherit` for the icon button color, set the color explicitly
|
|
376
|
+
// to the token without a fallback.
|
|
377
|
+
.mat-mdc-button-base.mat-mdc-icon-button:not(.mat-mdc-button-disabled) {
|
|
378
|
+
color: var(--mat-icon-button-icon-color);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@mixin _define-m2-system-vars($vars, $overrides) {
|
|
383
|
+
@include mat.private-current-selector-or-root {
|
|
384
|
+
@each $name, $value in $vars {
|
|
385
|
+
--#{definition.$system-fallback-prefix}-#{$name}: #{map.get($overrides, $name) or $value};
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
@use '@angular/material' as mat;
|
|
5
|
+
|
|
6
|
+
// Creates a CSS variable, including the fallback if provided.
|
|
7
|
+
@function _create-var($name, $fallback: null) {
|
|
8
|
+
@if ($fallback) {
|
|
9
|
+
@return var($name, $fallback);
|
|
10
|
+
} @else {
|
|
11
|
+
@return var($name);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Returns a list of overrides for the given M3 get-tokens mixin and prefix. Each token has its
|
|
16
|
+
// prefix removed since the overrides API expects its absence. The returned map includes "all" for
|
|
17
|
+
// all override tokens, and also the subsets with keys base, color, typography, and density.
|
|
18
|
+
@function get-overrides($tokens, $prefix) {
|
|
19
|
+
$base: remove-token-prefixes(map.get($tokens, base), $prefix);
|
|
20
|
+
$color: remove-token-prefixes(map.get($tokens, color), $prefix);
|
|
21
|
+
$typography: remove-token-prefixes(map.get($tokens, typography), $prefix);
|
|
22
|
+
$density: remove-token-prefixes(map.get($tokens, density), $prefix);
|
|
23
|
+
$all: ();
|
|
24
|
+
@each $map in ($base, $color, $typography, $density) {
|
|
25
|
+
$all: map.merge($all, $map);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@return (all: $all, base: $base, color: $color, typography: $typography, density: $density);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Removes a prefix from each component token in the provided map of prefixed tokens.
|
|
32
|
+
@function remove-token-prefixes($prefixed-tokens: (), $prefix) {
|
|
33
|
+
$tokens: ();
|
|
34
|
+
@each $prefixed-token, $value in $prefixed-tokens {
|
|
35
|
+
$token: string.slice($prefixed-token, string.length($prefix) + 2);
|
|
36
|
+
$tokens: map.set($tokens, $token, $value);
|
|
37
|
+
}
|
|
38
|
+
@return $tokens;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Returns the token slot value.
|
|
42
|
+
// Accepts an optional fallback parameter to include in the CSS variable.
|
|
43
|
+
// If $fallback is `true`, then use the tokens map to get the fallback.
|
|
44
|
+
@function slot($token, $fallbacks, $fallback: null) {
|
|
45
|
+
// Fallbacks are a map of base, color, typography, and density tokens. To simplify
|
|
46
|
+
// lookup, flatten these token groups into a single map.
|
|
47
|
+
$fallbacks-flattened: ();
|
|
48
|
+
@each $tokens in map.values($fallbacks) {
|
|
49
|
+
@each $token, $value in $tokens {
|
|
50
|
+
$fallbacks-flattened: map.set($fallbacks-flattened, $token, $value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
@if not map.has-key($fallbacks-flattened, $token) {
|
|
54
|
+
@error 'Token #{$token} does not exist. Configured tokens are:' +
|
|
55
|
+
#{map.keys($fallbacks-flattened)};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
$sys-fallback: map.get($fallbacks-flattened, $token);
|
|
59
|
+
@if (mat.private-is-css-var-name($sys-fallback)) {
|
|
60
|
+
$sys-fallback: _create-var($sys-fallback, $fallback);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@return _create-var(--acp-#{$token}, $sys-fallback);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Outputs a map of token values as CSS variable definitions.
|
|
67
|
+
@mixin values($tokens) {
|
|
68
|
+
@include mat.private-current-selector-or-root() {
|
|
69
|
+
@each $key, $value in $tokens {
|
|
70
|
+
@if $value != null {
|
|
71
|
+
--acp-#{$key}: #{$value};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// Emits new token values for the given token overrides.
|
|
78
|
+
/// Verifies that the overrides passed in are valid tokens.
|
|
79
|
+
/// New token values are emitted under the current selector or root.
|
|
80
|
+
@mixin batch-create-token-values($overrides: (), $namespace-configs) {
|
|
81
|
+
@include mat.private-current-selector-or-root() {
|
|
82
|
+
$prefixed-name-data: ();
|
|
83
|
+
$all-names: ();
|
|
84
|
+
|
|
85
|
+
@each $config in $namespace-configs {
|
|
86
|
+
$namespace: map.get($config, namespace);
|
|
87
|
+
$tokens: map.get(map.get($config, tokens), all);
|
|
88
|
+
$prefix: '';
|
|
89
|
+
|
|
90
|
+
@if (map.has-key($config, prefix)) {
|
|
91
|
+
$prefix: map.get($config, prefix);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@each $name, $value in $tokens {
|
|
95
|
+
$prefixed-name: $prefix + $name;
|
|
96
|
+
$all-names: list.append($all-names, $prefixed-name, $separator: comma);
|
|
97
|
+
$prefixed-name-data: map.set($prefixed-name-data, $prefixed-name, ($namespace, $name));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@each $name, $value in $overrides {
|
|
102
|
+
@if map.has-key($prefixed-name-data, $name) {
|
|
103
|
+
$data: map.get($prefixed-name-data, $name);
|
|
104
|
+
$namespace: list.nth($data, 1);
|
|
105
|
+
$name: list.nth($data, 2);
|
|
106
|
+
$prefixed-name: $namespace + '-' + $name;
|
|
107
|
+
@include values(
|
|
108
|
+
(
|
|
109
|
+
$prefixed-name: $value,
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
} @else {
|
|
113
|
+
@error #{'Invalid token name `'}#{$name}#{'`. '}#{'Valid tokens are: '}#{$all-names};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
// Indicates whether alternative tokens should be used
|
|
4
|
+
$_alternate-tokens: false;
|
|
5
|
+
|
|
6
|
+
@function md-sys-color-values-dark($palettes: ()) {
|
|
7
|
+
$values: (
|
|
8
|
+
background: map.get($palettes, neutral, 6),
|
|
9
|
+
error: map.get($palettes, error, 80),
|
|
10
|
+
error-container: map.get($palettes, error, 30),
|
|
11
|
+
inverse-on-surface: map.get($palettes, neutral, 20),
|
|
12
|
+
inverse-primary: map.get($palettes, primary, 40),
|
|
13
|
+
inverse-surface: map.get($palettes, neutral, 90),
|
|
14
|
+
on-background: map.get($palettes, neutral, 90),
|
|
15
|
+
on-error: map.get($palettes, error, 20),
|
|
16
|
+
on-error-container: map.get($palettes, error, 90),
|
|
17
|
+
on-primary: map.get($palettes, primary, 20),
|
|
18
|
+
on-primary-container: map.get($palettes, primary, 90),
|
|
19
|
+
on-primary-fixed: map.get($palettes, primary, 10),
|
|
20
|
+
on-primary-fixed-variant: map.get($palettes, primary, 30),
|
|
21
|
+
on-secondary: map.get($palettes, secondary, 20),
|
|
22
|
+
on-secondary-container: map.get($palettes, secondary, 90),
|
|
23
|
+
on-secondary-fixed: map.get($palettes, secondary, 10),
|
|
24
|
+
on-secondary-fixed-variant: map.get($palettes, secondary, 30),
|
|
25
|
+
on-surface: map.get($palettes, neutral, 90),
|
|
26
|
+
on-surface-variant: map.get($palettes, neutral-variant, 90),
|
|
27
|
+
on-tertiary: map.get($palettes, tertiary, 20),
|
|
28
|
+
on-tertiary-container: map.get($palettes, tertiary, 90),
|
|
29
|
+
on-tertiary-fixed: map.get($palettes, tertiary, 10),
|
|
30
|
+
on-tertiary-fixed-variant: map.get($palettes, tertiary, 30),
|
|
31
|
+
outline: map.get($palettes, neutral-variant, 60),
|
|
32
|
+
outline-variant: map.get($palettes, neutral-variant, 30),
|
|
33
|
+
primary: map.get($palettes, primary, 80),
|
|
34
|
+
primary-container: map.get($palettes, primary, 30),
|
|
35
|
+
primary-fixed: map.get($palettes, primary, 90),
|
|
36
|
+
primary-fixed-dim: map.get($palettes, primary, 80),
|
|
37
|
+
scrim: map.get($palettes, neutral, 0),
|
|
38
|
+
secondary: map.get($palettes, secondary, 80),
|
|
39
|
+
secondary-container: map.get($palettes, secondary, 30),
|
|
40
|
+
secondary-fixed: map.get($palettes, secondary, 90),
|
|
41
|
+
secondary-fixed-dim: map.get($palettes, secondary, 80),
|
|
42
|
+
shadow: map.get($palettes, neutral, 0),
|
|
43
|
+
surface: map.get($palettes, neutral, 6),
|
|
44
|
+
surface-bright: map.get($palettes, neutral, 24),
|
|
45
|
+
surface-container: map.get($palettes, neutral, 12),
|
|
46
|
+
surface-container-high: map.get($palettes, neutral, 17),
|
|
47
|
+
surface-container-highest: map.get($palettes, neutral, 22),
|
|
48
|
+
surface-container-low: map.get($palettes, neutral, 10),
|
|
49
|
+
surface-container-lowest: map.get($palettes, neutral, 4),
|
|
50
|
+
surface-dim: map.get($palettes, neutral, 6),
|
|
51
|
+
surface-tint: map.get($palettes, primary, 80),
|
|
52
|
+
surface-variant: map.get($palettes, neutral-variant, 30),
|
|
53
|
+
tertiary: map.get($palettes, tertiary, 80),
|
|
54
|
+
tertiary-container: map.get($palettes, tertiary, 30),
|
|
55
|
+
tertiary-fixed: map.get($palettes, tertiary, 90),
|
|
56
|
+
tertiary-fixed-dim: map.get($palettes, tertiary, 80),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
@if ($_alternate-tokens) {
|
|
60
|
+
$values: map.merge(
|
|
61
|
+
$values,
|
|
62
|
+
(
|
|
63
|
+
on-surface-variant: map.get($palettes, neutral-variant, 80),
|
|
64
|
+
surface-bright: #37393b,
|
|
65
|
+
surface-container: #1e1f20,
|
|
66
|
+
surface-container-high: #282a2c,
|
|
67
|
+
surface-container-highest: #333537,
|
|
68
|
+
surface-container-low: #1b1b1b,
|
|
69
|
+
surface-container-lowest: #0e0e0e,
|
|
70
|
+
surface-dim: #131313,
|
|
71
|
+
surface-tint: #d1e1ff,
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@return $values;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@function md-sys-color-values-light($palettes: ()) {
|
|
80
|
+
$values: (
|
|
81
|
+
background: map.get($palettes, neutral, 98),
|
|
82
|
+
error: map.get($palettes, error, 40),
|
|
83
|
+
error-container: map.get($palettes, error, 90),
|
|
84
|
+
inverse-on-surface: map.get($palettes, neutral, 95),
|
|
85
|
+
inverse-primary: map.get($palettes, primary, 80),
|
|
86
|
+
inverse-surface: map.get($palettes, neutral, 20),
|
|
87
|
+
on-background: map.get($palettes, neutral, 10),
|
|
88
|
+
on-error: map.get($palettes, error, 100),
|
|
89
|
+
on-error-container: map.get($palettes, error, 30),
|
|
90
|
+
on-primary: map.get($palettes, primary, 100),
|
|
91
|
+
on-primary-container: map.get($palettes, primary, 30),
|
|
92
|
+
on-primary-fixed: map.get($palettes, primary, 10),
|
|
93
|
+
on-primary-fixed-variant: map.get($palettes, primary, 30),
|
|
94
|
+
on-secondary: map.get($palettes, secondary, 100),
|
|
95
|
+
on-secondary-container: map.get($palettes, secondary, 30),
|
|
96
|
+
on-secondary-fixed: map.get($palettes, secondary, 10),
|
|
97
|
+
on-secondary-fixed-variant: map.get($palettes, secondary, 30),
|
|
98
|
+
on-surface: map.get($palettes, neutral, 10),
|
|
99
|
+
on-surface-variant: map.get($palettes, neutral-variant, 30),
|
|
100
|
+
on-tertiary: map.get($palettes, tertiary, 100),
|
|
101
|
+
on-tertiary-container: map.get($palettes, tertiary, 30),
|
|
102
|
+
on-tertiary-fixed: map.get($palettes, tertiary, 10),
|
|
103
|
+
on-tertiary-fixed-variant: map.get($palettes, tertiary, 30),
|
|
104
|
+
outline: map.get($palettes, neutral-variant, 50),
|
|
105
|
+
outline-variant: map.get($palettes, neutral-variant, 80),
|
|
106
|
+
primary: map.get($palettes, primary, 40),
|
|
107
|
+
primary-container: map.get($palettes, primary, 90),
|
|
108
|
+
primary-fixed: map.get($palettes, primary, 90),
|
|
109
|
+
primary-fixed-dim: map.get($palettes, primary, 80),
|
|
110
|
+
scrim: map.get($palettes, neutral, 0),
|
|
111
|
+
secondary: map.get($palettes, secondary, 40),
|
|
112
|
+
secondary-container: map.get($palettes, secondary, 90),
|
|
113
|
+
secondary-fixed: map.get($palettes, secondary, 90),
|
|
114
|
+
secondary-fixed-dim: map.get($palettes, secondary, 80),
|
|
115
|
+
shadow: map.get($palettes, neutral, 0),
|
|
116
|
+
surface: map.get($palettes, neutral, 98),
|
|
117
|
+
surface-bright: map.get($palettes, neutral, 98),
|
|
118
|
+
surface-container: map.get($palettes, neutral, 94),
|
|
119
|
+
surface-container-high: map.get($palettes, neutral, 92),
|
|
120
|
+
surface-container-highest: map.get($palettes, neutral, 90),
|
|
121
|
+
surface-container-low: map.get($palettes, neutral, 96),
|
|
122
|
+
surface-container-lowest: map.get($palettes, neutral, 100),
|
|
123
|
+
surface-dim: map.get($palettes, neutral, 87),
|
|
124
|
+
surface-tint: map.get($palettes, primary, 40),
|
|
125
|
+
surface-variant: map.get($palettes, neutral-variant, 90),
|
|
126
|
+
tertiary: map.get($palettes, tertiary, 40),
|
|
127
|
+
tertiary-container: map.get($palettes, tertiary, 90),
|
|
128
|
+
tertiary-fixed: map.get($palettes, tertiary, 90),
|
|
129
|
+
tertiary-fixed-dim: map.get($palettes, tertiary, 80),
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
@if ($_alternate-tokens) {
|
|
133
|
+
$values: map.merge(
|
|
134
|
+
$values,
|
|
135
|
+
(
|
|
136
|
+
background: map.get($palettes, neutral, 100),
|
|
137
|
+
surface: map.get($palettes, neutral, 100),
|
|
138
|
+
surface-bright: map.get($palettes, neutral, 100),
|
|
139
|
+
surface-container: #f0f4f9,
|
|
140
|
+
surface-container-high: #e9eef6,
|
|
141
|
+
surface-container-highest: #dde3ea,
|
|
142
|
+
surface-container-low: #f8fafd,
|
|
143
|
+
surface-dim: #d3dbe5,
|
|
144
|
+
surface-tint: #6991d6,
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@return $values;
|
|
150
|
+
}
|