@ng-matero/extensions 18.1.3 → 18.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/alert.scss +1 -1
- package/core/theming/_definition.scss +16 -5
- package/core/tokens/_m3-tokens.scss +311 -153
- package/core/tokens/_token-definition.scss +271 -0
- package/core/tokens/_token-utils.scss +70 -301
- package/core/tokens/m2/mdc/_plain-tooltip.scss +4 -4
- package/core/tokens/m2/mtx/_alert.scss +4 -4
- package/core/tokens/m2/mtx/_colorpicker.scss +4 -4
- package/core/tokens/m2/mtx/_datetimepicker.scss +4 -4
- package/core/tokens/m2/mtx/_drawer.scss +4 -4
- package/core/tokens/m2/mtx/_grid.scss +4 -4
- package/core/tokens/m2/mtx/_loader.scss +4 -4
- package/core/tokens/m2/mtx/_popover.scss +4 -4
- package/core/tokens/m2/mtx/_progress.scss +4 -4
- package/core/tokens/m2/mtx/_select.scss +4 -4
- package/core/tokens/m2/mtx/_split.scss +4 -4
- package/core/tokens/m3/mtx/_alert.scss +2 -2
- package/core/tokens/m3/mtx/_colorpicker.scss +2 -2
- package/core/tokens/m3/mtx/_datetimepicker.scss +6 -6
- package/core/tokens/m3/mtx/_drawer.scss +3 -3
- package/core/tokens/m3/mtx/_grid.scss +3 -3
- package/core/tokens/m3/mtx/_loader.scss +2 -2
- package/core/tokens/m3/mtx/_popover.scss +3 -3
- package/core/tokens/m3/mtx/_progress.scss +7 -6
- package/core/tokens/m3/mtx/_select.scss +4 -4
- package/core/tokens/m3/mtx/_split.scss +2 -2
- package/datetimepicker/calendar-body.scss +1 -1
- package/datetimepicker/calendar.scss +5 -5
- package/esm2022/alert/alert-module.mjs +4 -4
- package/esm2022/alert/alert.mjs +5 -5
- package/esm2022/button/button-loading.mjs +3 -3
- package/esm2022/button/button-module.mjs +4 -4
- package/esm2022/checkbox-group/checkbox-group-module.mjs +4 -4
- package/esm2022/checkbox-group/checkbox-group.mjs +5 -5
- package/esm2022/colorpicker/colorpicker-input.mjs +3 -3
- package/esm2022/colorpicker/colorpicker-module.mjs +4 -4
- package/esm2022/colorpicker/colorpicker-toggle.mjs +8 -8
- package/esm2022/colorpicker/colorpicker.mjs +6 -6
- 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-module.mjs +4 -4
- package/esm2022/column-resize/column-resize-notifier.mjs +6 -6
- package/esm2022/column-resize/column-resize.mjs +3 -3
- package/esm2022/column-resize/column-size-store.mjs +3 -3
- package/esm2022/column-resize/event-dispatcher.mjs +3 -3
- package/esm2022/column-resize/overlay-handle.mjs +3 -3
- package/esm2022/column-resize/resizable.mjs +3 -3
- package/esm2022/column-resize/resize-strategy.mjs +9 -9
- package/esm2022/core/datetime/datetime.module.mjs +8 -8
- package/esm2022/core/datetime/native-datetime-adapter.mjs +3 -3
- package/esm2022/core/pipes/is-template-ref.pipe.mjs +3 -3
- package/esm2022/core/pipes/pipes.module.mjs +4 -4
- package/esm2022/core/pipes/to-observable.pipe.mjs +3 -3
- package/esm2022/datetimepicker/calendar-body.mjs +4 -4
- package/esm2022/datetimepicker/calendar.mjs +5 -5
- package/esm2022/datetimepicker/clock.mjs +4 -4
- package/esm2022/datetimepicker/datetimepicker-actions.mjs +12 -12
- package/esm2022/datetimepicker/datetimepicker-input.mjs +3 -3
- package/esm2022/datetimepicker/datetimepicker-intl.mjs +3 -3
- package/esm2022/datetimepicker/datetimepicker-module.mjs +4 -4
- package/esm2022/datetimepicker/datetimepicker-toggle.mjs +8 -8
- package/esm2022/datetimepicker/datetimepicker.mjs +8 -8
- package/esm2022/datetimepicker/month-view.mjs +3 -3
- package/esm2022/datetimepicker/multi-year-view.mjs +3 -3
- package/esm2022/datetimepicker/time.mjs +8 -8
- package/esm2022/datetimepicker/year-view.mjs +3 -3
- package/esm2022/dialog/dialog-container.mjs +3 -3
- package/esm2022/dialog/dialog-module.mjs +4 -4
- package/esm2022/dialog/dialog.mjs +3 -3
- package/esm2022/drawer/drawer-container.mjs +5 -5
- package/esm2022/drawer/drawer-module.mjs +4 -4
- package/esm2022/drawer/drawer.mjs +3 -3
- package/esm2022/grid/cell.mjs +4 -4
- package/esm2022/grid/column-menu.mjs +5 -5
- package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +3 -3
- package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +3 -3
- package/esm2022/grid/column-resize/column-resize-module.mjs +8 -8
- package/esm2022/grid/column-resize/overlay-handle.mjs +3 -3
- package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +3 -3
- package/esm2022/grid/column-resize/resize-strategy.mjs +3 -3
- package/esm2022/grid/expansion-toggle.mjs +3 -3
- package/esm2022/grid/grid-module.mjs +4 -4
- package/esm2022/grid/grid-pipes.mjs +21 -21
- package/esm2022/grid/grid-utils.mjs +3 -3
- package/esm2022/grid/grid.mjs +5 -5
- package/esm2022/grid/selectable-cell.mjs +3 -3
- package/esm2022/loader/loader-module.mjs +4 -4
- package/esm2022/loader/loader.mjs +5 -5
- package/esm2022/photoviewer/photoviewer-module.mjs +4 -4
- package/esm2022/photoviewer/photoviewer.mjs +3 -3
- package/esm2022/popover/popover-content.mjs +6 -6
- package/esm2022/popover/popover-module.mjs +4 -4
- package/esm2022/popover/popover-target.mjs +3 -3
- package/esm2022/popover/popover-trigger.mjs +5 -4
- package/esm2022/popover/popover.mjs +5 -5
- package/esm2022/progress/progress-module.mjs +4 -4
- package/esm2022/progress/progress.mjs +4 -4
- package/esm2022/select/option.mjs +3 -3
- package/esm2022/select/select-module.mjs +12 -8
- package/esm2022/select/select.mjs +9 -6
- package/esm2022/select/templates.mjs +45 -34
- package/esm2022/split/split-module.mjs +4 -4
- package/esm2022/split/split-pane.mjs +3 -3
- package/esm2022/split/split.mjs +4 -4
- package/esm2022/tooltip/tooltip-module.mjs +4 -4
- package/esm2022/tooltip/tooltip.mjs +6 -6
- package/fesm2022/mtxAlert.mjs +8 -8
- package/fesm2022/mtxAlert.mjs.map +1 -1
- package/fesm2022/mtxButton.mjs +7 -7
- package/fesm2022/mtxCheckboxGroup.mjs +8 -8
- package/fesm2022/mtxCheckboxGroup.mjs.map +1 -1
- package/fesm2022/mtxColorpicker.mjs +20 -20
- package/fesm2022/mtxColorpicker.mjs.map +1 -1
- package/fesm2022/mtxColumnResize.mjs +40 -40
- package/fesm2022/mtxCore.mjs +21 -21
- package/fesm2022/mtxDatetimepicker.mjs +64 -64
- package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2022/mtxDialog.mjs +10 -10
- package/fesm2022/mtxDrawer.mjs +11 -11
- package/fesm2022/mtxDrawer.mjs.map +1 -1
- package/fesm2022/mtxGrid.mjs +68 -68
- package/fesm2022/mtxGrid.mjs.map +1 -1
- package/fesm2022/mtxLoader.mjs +8 -8
- package/fesm2022/mtxLoader.mjs.map +1 -1
- package/fesm2022/mtxPhotoviewer.mjs +7 -7
- package/fesm2022/mtxPopover.mjs +21 -20
- package/fesm2022/mtxPopover.mjs.map +1 -1
- package/fesm2022/mtxProgress.mjs +8 -8
- package/fesm2022/mtxProgress.mjs.map +1 -1
- package/fesm2022/mtxSelect.mjs +65 -47
- package/fesm2022/mtxSelect.mjs.map +1 -1
- package/fesm2022/mtxSplit.mjs +11 -11
- package/fesm2022/mtxSplit.mjs.map +1 -1
- package/fesm2022/mtxTooltip.mjs +10 -10
- package/grid/column-menu.scss +3 -3
- package/grid/column-resize/_column-resize.scss +2 -2
- package/grid/grid.scss +8 -8
- package/loader/loader.scss +2 -2
- package/package.json +25 -13
- package/prebuilt-themes/azure-blue.css +1 -1
- package/prebuilt-themes/cyan-orange.css +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/magenta-violet.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/prebuilt-themes/rose-red.css +1 -1
- package/select/select-module.d.ts +1 -1
- package/select/select.d.ts +2 -1
- package/select/select.scss +8 -8
- package/select/templates.d.ts +6 -0
|
@@ -1,58 +1,13 @@
|
|
|
1
1
|
@use 'sass:list';
|
|
2
2
|
@use 'sass:map';
|
|
3
|
-
@use 'sass:meta';
|
|
4
3
|
@use 'sass:string';
|
|
5
|
-
@use 'sass:color';
|
|
6
|
-
@use 'sass:math';
|
|
7
4
|
@use '@angular/material' as mat;
|
|
8
5
|
@use '../style/elevation';
|
|
9
|
-
@use '
|
|
10
|
-
|
|
11
|
-
// Indicates whether we're building internally. Used for backwards compatibility.
|
|
12
|
-
$private-is-internal-build: false;
|
|
13
|
-
|
|
14
|
-
$_placeholder-color-palette: mat.m2-define-palette(mat.$m2-red-palette);
|
|
15
|
-
|
|
16
|
-
// Placeholder color config that can be passed to token getter functions when generating token
|
|
17
|
-
// slots.
|
|
18
|
-
$placeholder-color-config: (
|
|
19
|
-
primary: $_placeholder-color-palette,
|
|
20
|
-
accent: $_placeholder-color-palette,
|
|
21
|
-
warn: $_placeholder-color-palette,
|
|
22
|
-
is-dark: false,
|
|
23
|
-
foreground: mat.$m2-light-theme-foreground-palette,
|
|
24
|
-
background: mat.$m2-light-theme-background-palette,
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
$_placeholder-typography-level-config: m2-typography.typography-config-level-from-mdc(body1);
|
|
28
|
-
|
|
29
|
-
// Placeholder typography config that can be passed to token getter functions when generating token
|
|
30
|
-
// slots.
|
|
31
|
-
$placeholder-typography-config: (
|
|
32
|
-
font-family: 'Roboto, sans-serif',
|
|
33
|
-
headline-1: $_placeholder-typography-level-config,
|
|
34
|
-
headline-2: $_placeholder-typography-level-config,
|
|
35
|
-
headline-3: $_placeholder-typography-level-config,
|
|
36
|
-
headline-4: $_placeholder-typography-level-config,
|
|
37
|
-
headline-5: $_placeholder-typography-level-config,
|
|
38
|
-
headline-6: $_placeholder-typography-level-config,
|
|
39
|
-
subtitle-1: $_placeholder-typography-level-config,
|
|
40
|
-
subtitle-2: $_placeholder-typography-level-config,
|
|
41
|
-
body-1: $_placeholder-typography-level-config,
|
|
42
|
-
body-2: $_placeholder-typography-level-config,
|
|
43
|
-
caption: $_placeholder-typography-level-config,
|
|
44
|
-
button: $_placeholder-typography-level-config,
|
|
45
|
-
overline: $_placeholder-typography-level-config,
|
|
46
|
-
subheading-1: $_placeholder-typography-level-config,
|
|
47
|
-
title: $_placeholder-typography-level-config,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
// Placeholder density config that can be passed to token getter functions when generating token
|
|
51
|
-
// slots.
|
|
52
|
-
$placeholder-density-config: 0;
|
|
6
|
+
@use './m3-tokens';
|
|
53
7
|
|
|
54
8
|
$_tokens: null;
|
|
55
9
|
$_component-prefix: null;
|
|
10
|
+
$_system-fallbacks: m3-tokens.create-system-fallbacks();
|
|
56
11
|
|
|
57
12
|
// Sets the token prefix and map to use when creating token slots.
|
|
58
13
|
@mixin use-tokens($prefix, $tokens) {
|
|
@@ -66,8 +21,8 @@ $_component-prefix: null;
|
|
|
66
21
|
}
|
|
67
22
|
|
|
68
23
|
// Combines a prefix and a string to generate a CSS variable name for a token.
|
|
69
|
-
@function
|
|
70
|
-
@if $prefix == null or $
|
|
24
|
+
@function _create-var-name($prefix, $token) {
|
|
25
|
+
@if $prefix == null or $token == null {
|
|
71
26
|
@error 'Must specify both prefix and name when generating token';
|
|
72
27
|
}
|
|
73
28
|
|
|
@@ -78,68 +33,91 @@ $_component-prefix: null;
|
|
|
78
33
|
$string-prefix: if($string-prefix == '', $part, '#{$string-prefix}-#{$part}');
|
|
79
34
|
}
|
|
80
35
|
|
|
81
|
-
@return string.unquote('--#{$string-prefix}-#{$
|
|
36
|
+
@return string.unquote('--#{$string-prefix}-#{$token}');
|
|
82
37
|
}
|
|
83
38
|
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
@
|
|
39
|
+
// Creates a CSS variable, including the fallback if provided.
|
|
40
|
+
@function _create-var($name, $fallback: null) {
|
|
41
|
+
@if ($fallback) {
|
|
42
|
+
@return var($name, $fallback);
|
|
43
|
+
} @else {
|
|
44
|
+
@return var($name);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Gets the value of the token given the current global context state.
|
|
49
|
+
@function _get-token-value($token, $fallback) {
|
|
50
|
+
$var-name: _create-var-name($_component-prefix, $token);
|
|
51
|
+
$fallback: _get-token-fallback($token, $fallback);
|
|
52
|
+
@return _create-var($var-name, $fallback);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Assertion mixin that throws an error if the global state has not been set up by wrapping
|
|
56
|
+
// calls with `use-tokens`.
|
|
57
|
+
@function _assert-use-tokens($token) {
|
|
87
58
|
@if $_component-prefix == null or $_tokens == null {
|
|
88
|
-
@error '
|
|
59
|
+
@error 'Function was not called within a wrapping call of `use-tokens`';
|
|
89
60
|
}
|
|
90
61
|
@if not map.has-key($_tokens, $token) {
|
|
91
62
|
@error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
|
|
92
63
|
}
|
|
93
|
-
@if map.get($_tokens, $token) != null {
|
|
94
|
-
$fallback: null;
|
|
95
|
-
|
|
96
|
-
@if ($emit-fallback == true) {
|
|
97
|
-
$fallback: map.get($_tokens, $token);
|
|
98
|
-
}
|
|
99
|
-
@else if ($emit-fallback) {
|
|
100
|
-
$fallback: $emit-fallback;
|
|
101
|
-
}
|
|
102
64
|
|
|
103
|
-
|
|
104
|
-
|
|
65
|
+
@return true;
|
|
66
|
+
}
|
|
105
67
|
|
|
106
|
-
|
|
68
|
+
// Emits a slot for the given token, provided that it has a non-null value in the token map passed
|
|
69
|
+
// to `use-tokens`.
|
|
70
|
+
// Accepts an optional fallback parameter to include in the CSS variable.
|
|
71
|
+
// If $fallback is `true`, then use the tokens map to get the fallback.
|
|
72
|
+
// TODO: Remove the use case where we accept "true" and handle any failing client screenshots
|
|
73
|
+
@mixin create-token-slot($property, $token, $fallback: null) {
|
|
74
|
+
$_assert: _assert-use-tokens($token);
|
|
75
|
+
@if map.get($_tokens, $token) != null {
|
|
76
|
+
#{$property}: #{_get-token-value($token, $fallback)};
|
|
107
77
|
}
|
|
108
78
|
}
|
|
109
79
|
|
|
110
80
|
// Returns the name of a token including the current prefix. Intended to be used in calculations
|
|
111
81
|
// involving tokens. `create-token-slot` should be used when outputting tokens.
|
|
112
|
-
@function get-token-variable($token) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
@if not map.has-key($_tokens, $token) {
|
|
117
|
-
@error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
@return _get-css-variable($_component-prefix, $token);
|
|
82
|
+
@function get-token-variable-name($token) {
|
|
83
|
+
$_assert: _assert-use-tokens($token);
|
|
84
|
+
@return _create-var-name($_component-prefix, $token);
|
|
121
85
|
}
|
|
122
86
|
|
|
123
|
-
// TODO(crisbeto): should be able to replace the usages of `get-token-variable` with this.
|
|
124
87
|
// Returns a `var()` reference to a specific token. Intended for declarations
|
|
125
88
|
// where the token has to be referenced as a part of a larger expression.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
89
|
+
// Accepts an optional fallback parameter to include in the CSS variable.
|
|
90
|
+
// If $fallback is `true`, then use the tokens map to get the fallback.
|
|
91
|
+
// TODO: Remove the use case where we accept "true" and handle any failing client screenshots
|
|
92
|
+
@function get-token-variable($token, $fallback: null) {
|
|
93
|
+
$_assert: _assert-use-tokens($token);
|
|
94
|
+
@return _get-token-value($token, $fallback);
|
|
95
|
+
}
|
|
133
96
|
|
|
134
|
-
|
|
135
|
-
|
|
97
|
+
// Gets the token's fallback value. Prefers adding a system-level fallback if one exists, otherwise
|
|
98
|
+
// use the provided fallback.
|
|
99
|
+
@function _get-token-fallback($token, $fallback: null) {
|
|
100
|
+
// If the $fallback is `true`, this is the component's signal to use the current token map value
|
|
101
|
+
@if ($fallback == true) {
|
|
102
|
+
$fallback: map.get($_tokens, $token);
|
|
103
|
+
}
|
|
136
104
|
|
|
137
|
-
|
|
138
|
-
|
|
105
|
+
// Check whether there's a system-level fallback. If not, return the optional
|
|
106
|
+
// provided fallback (otherwise null).
|
|
107
|
+
$sys-fallback: map.get($_system-fallbacks, $_component-prefix, $token);
|
|
108
|
+
@if (not $sys-fallback) {
|
|
109
|
+
@return $fallback;
|
|
139
110
|
}
|
|
140
|
-
|
|
141
|
-
|
|
111
|
+
|
|
112
|
+
@if (mat.private-is-css-var-name($sys-fallback)) {
|
|
113
|
+
@return _create-var($sys-fallback, $fallback);
|
|
142
114
|
}
|
|
115
|
+
|
|
116
|
+
// TODO(mat-app-theme): Return the system-level fallback.
|
|
117
|
+
// Changing this will affect clients that do not properly call theme mixins since the tokens
|
|
118
|
+
// will be undefined and now default to M3 system values, causing a number of screenshot failures.
|
|
119
|
+
// @return $sys-fallback;
|
|
120
|
+
@return $fallback;
|
|
143
121
|
}
|
|
144
122
|
|
|
145
123
|
// Outputs a map of tokens under a specific prefix.
|
|
@@ -147,24 +125,14 @@ $_component-prefix: null;
|
|
|
147
125
|
@if $tokens != null {
|
|
148
126
|
@each $key, $value in $tokens {
|
|
149
127
|
@if $value != null {
|
|
150
|
-
|
|
128
|
+
& {
|
|
129
|
+
#{_create-var-name($prefix, $key)}: #{$value};
|
|
130
|
+
}
|
|
151
131
|
}
|
|
152
132
|
}
|
|
153
133
|
}
|
|
154
134
|
}
|
|
155
135
|
|
|
156
|
-
/// Gets all the MDC token values for a specific component. This function serves as single
|
|
157
|
-
/// point at which we directly reference a specific version of the MDC tokens.
|
|
158
|
-
/// @param {String} $component Name of the component for which to get the tokens
|
|
159
|
-
/// @param {Map} $systems The MDC system tokens
|
|
160
|
-
/// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
|
|
161
|
-
/// @return {List} Map of token names to values
|
|
162
|
-
@function get-mdc-tokens($component, $systems, $exclude-hardcoded) {
|
|
163
|
-
$full-name: 'md-comp-' + $component + '-values';
|
|
164
|
-
$fn: meta.get-function($name: $full-name, $module: 'm3-token-definitions');
|
|
165
|
-
@return meta.call($fn, $systems, $exclude-hardcoded);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
136
|
// MDC doesn't currently handle elevation tokens properly. As a temporary workaround we can combine
|
|
169
137
|
// the elevation and shadow-color tokens into a full box-shadow and use it as the value for the
|
|
170
138
|
// elevation token.
|
|
@@ -258,177 +226,6 @@ $_component-prefix: null;
|
|
|
258
226
|
}
|
|
259
227
|
}
|
|
260
228
|
|
|
261
|
-
/// Gets the MDC tokens for the given prefix, M3 token values, and supported token slots.
|
|
262
|
-
/// @param {List} $prefix The token prefix for the given tokens.
|
|
263
|
-
/// @param {Map|(Map, Map)} $values A map of M3 token values for the given prefix.
|
|
264
|
-
/// This param may also be a tuple of maps, the first one representing the default M3 token values,
|
|
265
|
-
// and the second containing overrides for different color variants.
|
|
266
|
-
// Single map example:
|
|
267
|
-
// (token1: green, token2: 2px)
|
|
268
|
-
// Tuple example:
|
|
269
|
-
// (
|
|
270
|
-
// (token1: green, token2: 2px),
|
|
271
|
-
// (
|
|
272
|
-
// secondary: (token1: blue),
|
|
273
|
-
// error: (token1: red),
|
|
274
|
-
// )
|
|
275
|
-
// )
|
|
276
|
-
/// @param {Map} $slots A map of token slots, with null value indicating the token is not supported.
|
|
277
|
-
/// @param {String|null} $variant The name of the variant the token values are for.
|
|
278
|
-
/// @return {Map} A map of fully qualified token names to values, for only the supported tokens.
|
|
279
|
-
@function namespace-tokens($prefix, $values, $slots, $variant: null) {
|
|
280
|
-
$result: ();
|
|
281
|
-
@if $variant == null and meta.type-of($values) == 'list' and list.length($values == 2) {
|
|
282
|
-
$variants: list.nth($values, 2);
|
|
283
|
-
$values: list.nth($values, 1);
|
|
284
|
-
@each $variant, $overrides in $variants {
|
|
285
|
-
$result: map.merge($result, namespace-tokens($prefix, $overrides, $slots, $variant));
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
$used-token-names: map.keys(_filter-nulls(map.get($slots, $prefix)));
|
|
289
|
-
$used-m3-tokens: _pick(_filter-nulls($values), $used-token-names);
|
|
290
|
-
$prefix: if($variant == null, $prefix, list.append($prefix, $variant));
|
|
291
|
-
@return map.merge($result, ($prefix: $used-m3-tokens));
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/// Hardcode the given value, or null if hardcoded values are excluded.
|
|
295
|
-
@function hardcode($value, $exclude-hardcoded) {
|
|
296
|
-
@return if($exclude-hardcoded, null, $value);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/// Sets all of the standard typography tokens for the given token base name to the given typography
|
|
300
|
-
/// level.
|
|
301
|
-
/// @param {Map} $systems The MDC system tokens
|
|
302
|
-
/// @param {String} $base-name The token base name to get the typography tokens for
|
|
303
|
-
/// @param {String} $typography-level The typography level to base the token values on
|
|
304
|
-
/// @return {Map} A map containing the typography tokens for the given base token name
|
|
305
|
-
@function generate-typography-tokens($systems, $base-name, $typography-level) {
|
|
306
|
-
$result: ();
|
|
307
|
-
@each $prop in (font, line-height, size, tracking, weight) {
|
|
308
|
-
$result: map.set($result, #{$base-name}-#{$prop},
|
|
309
|
-
map.get($systems, md-sys-typescale, #{$typography-level}-#{$prop}));
|
|
310
|
-
}
|
|
311
|
-
@return $result;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/// Maps the values in a map to new values using the given mapping function
|
|
315
|
-
/// @param {Map} $map The maps whose values will be mapped to new values.
|
|
316
|
-
/// @param {Function} $fn The value mapping function.
|
|
317
|
-
/// @param {Map} A new map with its values updated using the mapping function.
|
|
318
|
-
/* stylelint-disable-next-line scss/no-global-function-names */
|
|
319
|
-
@function map-values($map, $fn) {
|
|
320
|
-
$result: ();
|
|
321
|
-
@each $key, $value in $map {
|
|
322
|
-
$result: map.set($result, $key, meta.call($fn, $value));
|
|
323
|
-
}
|
|
324
|
-
@return $result;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/// Renames the keys in a map
|
|
328
|
-
/// @param {Map} $map The map whose keys should be renamed
|
|
329
|
-
/// @param {Map} $rename-keys A map of original key to renamed key to apply to $map
|
|
330
|
-
/// @return {Map} The result of applying the given key renames to the given map.
|
|
331
|
-
@function rename-map-keys($map, $rename-keys) {
|
|
332
|
-
$result: $map;
|
|
333
|
-
@each $old-key-name, $new-key-name in $rename-keys {
|
|
334
|
-
@if map.has-key($map, $old-key-name) {
|
|
335
|
-
$result: map.set($result, $new-key-name, map.get($map, $old-key-name));
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
@return $result;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/// At the time of writing, some color tokens (e.g. disabled state) are defined as a solid color
|
|
342
|
-
/// token and a separate opacity token. This function applies the opacity to the color and drops the
|
|
343
|
-
/// opacity key from the map. Can be removed once b/213331407 is resolved.
|
|
344
|
-
/// @param {Map} $tokens The map of tokens currently being generated
|
|
345
|
-
/// @param {Map} $all-tokens A map of all tokens, including hardcoded values
|
|
346
|
-
/// @param {List} $pairs Pairs of color token names and their opacities. Should be in the shape of
|
|
347
|
-
/// `((color: 'color-key', opacity: 'opacity-key'))`.
|
|
348
|
-
/// @return {Map} The initial tokens with the combined color values.
|
|
349
|
-
@function combine-color-tokens($tokens, $opacity-lookup, $pairs) {
|
|
350
|
-
$result: $tokens;
|
|
351
|
-
|
|
352
|
-
@each $pair in $pairs {
|
|
353
|
-
$color-key: map.get($pair, color);
|
|
354
|
-
$opacity-key: map.get($pair, opacity);
|
|
355
|
-
$color: map.get($tokens, $color-key);
|
|
356
|
-
$opacity: map.get($opacity-lookup, $opacity-key);
|
|
357
|
-
|
|
358
|
-
@if(meta.type-of($color) == 'color') {
|
|
359
|
-
$result: map.remove($result, $opacity-key);
|
|
360
|
-
$result: map.set($result, $color-key, rgba($color, $opacity));
|
|
361
|
-
}
|
|
362
|
-
@else if($color != null) {
|
|
363
|
-
$result: map.remove($result, $opacity-key);
|
|
364
|
-
$combined-color: #{color-mix(in srgb, #{$color} #{($opacity * 100) + '%'}, transparent)};
|
|
365
|
-
$result: map.set($result, $color-key, $combined-color);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
@return $result;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/// Inherited function from MDC that computes which contrast tone to use on top of a color.
|
|
373
|
-
/// This is used only in a narrow set of use cases when generating M2 button tokens to maintain
|
|
374
|
-
/// backwards compatibility.
|
|
375
|
-
/// @param {Color} $value Color for which we're calculating the contrast tone.
|
|
376
|
-
/// @param {Boolean} $is-dark Whether the current theme is dark.
|
|
377
|
-
/// @return {Map} Either `dark` or `light`.
|
|
378
|
-
@function contrast-tone($value, $is-dark) {
|
|
379
|
-
@if ($value == 'dark') {
|
|
380
|
-
@return 'light';
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
@if ($value == 'light') {
|
|
384
|
-
@return 'dark';
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// Fallback if the app is using a non-color palette (e.g. CSS variable based).
|
|
388
|
-
@if (meta.type-of($value) != 'color') {
|
|
389
|
-
@return if($is-dark, 'light', 'dark');
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
$minimum-contrast: 3.1;
|
|
393
|
-
$light-contrast: _contrast($value, #fff);
|
|
394
|
-
$dark-contrast: _contrast($value, rgba(0, 0, 0, 0.87));
|
|
395
|
-
|
|
396
|
-
@if ($light-contrast < $minimum-contrast) and ($dark-contrast > $light-contrast) {
|
|
397
|
-
@return 'dark';
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
@return 'light';
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
@function _linear-channel-value($channel-value) {
|
|
404
|
-
$normalized-channel-value: math.div($channel-value, 255);
|
|
405
|
-
|
|
406
|
-
@if ($normalized-channel-value < 0.03928) {
|
|
407
|
-
@return math.div($normalized-channel-value, 12.92);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
@return math.pow(math.div($normalized-channel-value + 0.055, 1.055), 2.4);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// Calculate the luminance for a color.
|
|
414
|
-
// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
|
|
415
|
-
@function _luminance($color) {
|
|
416
|
-
$red: _linear-channel-value(color.red($color));
|
|
417
|
-
$green: _linear-channel-value(color.green($color));
|
|
418
|
-
$blue: _linear-channel-value(color.blue($color));
|
|
419
|
-
|
|
420
|
-
@return 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// Calculate the contrast ratio between two colors.
|
|
424
|
-
// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
|
|
425
|
-
@function _contrast($back, $front) {
|
|
426
|
-
$back-lum: _luminance($back) + 0.05;
|
|
427
|
-
$fore-lum: _luminance($front) + 0.05;
|
|
428
|
-
|
|
429
|
-
@return math.div(math.max($back-lum, $fore-lum), math.min($back-lum, $fore-lum));
|
|
430
|
-
}
|
|
431
|
-
|
|
432
229
|
/// Verifies that the token overrides exist and are used in one of the given token maps.
|
|
433
230
|
@mixin _validate-token-overrides($overrides: (), $token-maps) {
|
|
434
231
|
$valid-token-names: ();
|
|
@@ -450,31 +247,3 @@ $_component-prefix: null;
|
|
|
450
247
|
}
|
|
451
248
|
}
|
|
452
249
|
}
|
|
453
|
-
|
|
454
|
-
/// Picks a submap containing only the given keys out the given map.
|
|
455
|
-
/// @param {Map} $map The map to pick from.
|
|
456
|
-
/// @param {List} $keys The map keys to pick.
|
|
457
|
-
/// @return {Map} A submap containing only the given keys.
|
|
458
|
-
@function _pick($map, $keys) {
|
|
459
|
-
$result: ();
|
|
460
|
-
@each $key in $keys {
|
|
461
|
-
@if map.has-key($map, $key) {
|
|
462
|
-
$result: map.set($result, $key, map.get($map, $key));
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
@return $result;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
/// Filters keys with a null value out of the map.
|
|
470
|
-
/// @param {Map} $map The map to filter.
|
|
471
|
-
/// @return {Map} The given map with all of the null keys filtered out.
|
|
472
|
-
@function _filter-nulls($map) {
|
|
473
|
-
$result: ();
|
|
474
|
-
@each $key, $val in $map {
|
|
475
|
-
@if $val != null {
|
|
476
|
-
$result: map.set($result, $key, $val);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
@return $result;
|
|
480
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@use '@angular/material' as mat;
|
|
2
|
-
@use '../../token-
|
|
2
|
+
@use '../../token-definition';
|
|
3
3
|
|
|
4
4
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
5
5
|
$prefix: (mdc, plain-tooltip);
|
|
@@ -56,8 +56,8 @@ $prefix: (mdc, plain-tooltip);
|
|
|
56
56
|
@function get-token-slots() {
|
|
57
57
|
@return mat.private-deep-merge-all(
|
|
58
58
|
get-unthemable-tokens(),
|
|
59
|
-
get-color-tokens(token-
|
|
60
|
-
get-typography-tokens(token-
|
|
61
|
-
get-density-tokens(token-
|
|
59
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
60
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
61
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
62
62
|
);
|
|
63
63
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '@angular/material' as mat;
|
|
3
|
-
@use '../../token-
|
|
3
|
+
@use '../../token-definition';
|
|
4
4
|
|
|
5
5
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
6
6
|
$prefix: (mtx, alert);
|
|
@@ -55,8 +55,8 @@ $prefix: (mtx, alert);
|
|
|
55
55
|
@function get-token-slots() {
|
|
56
56
|
@return mat.private-deep-merge-all(
|
|
57
57
|
get-unthemable-tokens(),
|
|
58
|
-
get-color-tokens(token-
|
|
59
|
-
get-typography-tokens(token-
|
|
60
|
-
get-density-tokens(token-
|
|
58
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
59
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
60
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
61
61
|
);
|
|
62
62
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@use 'sass:map';
|
|
3
3
|
@use 'sass:meta';
|
|
4
4
|
@use '@angular/material' as mat;
|
|
5
|
-
@use '../../token-
|
|
5
|
+
@use '../../token-definition';
|
|
6
6
|
|
|
7
7
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
8
8
|
$prefix: (mtx, colorpicker);
|
|
@@ -44,8 +44,8 @@ $prefix: (mtx, colorpicker);
|
|
|
44
44
|
@function get-token-slots() {
|
|
45
45
|
@return mat.private-deep-merge-all(
|
|
46
46
|
get-unthemable-tokens(),
|
|
47
|
-
get-color-tokens(token-
|
|
48
|
-
get-typography-tokens(token-
|
|
49
|
-
get-density-tokens(token-
|
|
47
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
48
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
49
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
50
50
|
);
|
|
51
51
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@use 'sass:map';
|
|
3
3
|
@use 'sass:meta';
|
|
4
4
|
@use '@angular/material' as mat;
|
|
5
|
-
@use '../../token-
|
|
5
|
+
@use '../../token-definition';
|
|
6
6
|
@use '../../../style/elevation';
|
|
7
7
|
|
|
8
8
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
@@ -144,8 +144,8 @@ $_today-fade-amount: .2;
|
|
|
144
144
|
@function get-token-slots() {
|
|
145
145
|
@return mat.private-deep-merge-all(
|
|
146
146
|
get-unthemable-tokens(),
|
|
147
|
-
get-color-tokens(token-
|
|
148
|
-
get-typography-tokens(token-
|
|
149
|
-
get-density-tokens(token-
|
|
147
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
148
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
149
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
150
150
|
);
|
|
151
151
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '@angular/material' as mat;
|
|
3
|
-
@use '../../token-
|
|
3
|
+
@use '../../token-definition';
|
|
4
4
|
@use '../../../style/elevation';
|
|
5
5
|
|
|
6
6
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
@@ -38,8 +38,8 @@ $prefix: (mtx, drawer);
|
|
|
38
38
|
@function get-token-slots() {
|
|
39
39
|
@return mat.private-deep-merge-all(
|
|
40
40
|
get-unthemable-tokens(),
|
|
41
|
-
get-color-tokens(token-
|
|
42
|
-
get-typography-tokens(token-
|
|
43
|
-
get-density-tokens(token-
|
|
41
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
42
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
43
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
44
44
|
);
|
|
45
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '@angular/material' as mat;
|
|
3
|
-
@use '../../token-
|
|
3
|
+
@use '../../token-definition';
|
|
4
4
|
|
|
5
5
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
6
6
|
$prefix: (mtx, grid);
|
|
@@ -62,8 +62,8 @@ $prefix: (mtx, grid);
|
|
|
62
62
|
@function get-token-slots() {
|
|
63
63
|
@return mat.private-deep-merge-all(
|
|
64
64
|
get-unthemable-tokens(),
|
|
65
|
-
get-color-tokens(token-
|
|
66
|
-
get-typography-tokens(token-
|
|
67
|
-
get-density-tokens(token-
|
|
65
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
66
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
67
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
68
68
|
);
|
|
69
69
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@use 'sass:map';
|
|
3
3
|
@use 'sass:meta';
|
|
4
4
|
@use '@angular/material' as mat;
|
|
5
|
-
@use '../../token-
|
|
5
|
+
@use '../../token-definition';
|
|
6
6
|
|
|
7
7
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
8
8
|
$prefix: (mtx, loader);
|
|
@@ -37,8 +37,8 @@ $prefix: (mtx, loader);
|
|
|
37
37
|
@function get-token-slots() {
|
|
38
38
|
@return mat.private-deep-merge-all(
|
|
39
39
|
get-unthemable-tokens(),
|
|
40
|
-
get-color-tokens(token-
|
|
41
|
-
get-typography-tokens(token-
|
|
42
|
-
get-density-tokens(token-
|
|
40
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
41
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
42
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '@angular/material' as mat;
|
|
3
|
-
@use '../../token-
|
|
3
|
+
@use '../../token-definition';
|
|
4
4
|
|
|
5
5
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
6
6
|
$prefix: (mtx, popover);
|
|
@@ -40,8 +40,8 @@ $prefix: (mtx, popover);
|
|
|
40
40
|
@function get-token-slots() {
|
|
41
41
|
@return mat.private-deep-merge-all(
|
|
42
42
|
get-unthemable-tokens(),
|
|
43
|
-
get-color-tokens(token-
|
|
44
|
-
get-typography-tokens(token-
|
|
45
|
-
get-density-tokens(token-
|
|
43
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
44
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
45
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
46
46
|
);
|
|
47
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '@angular/material' as mat;
|
|
3
|
-
@use '../../token-
|
|
3
|
+
@use '../../token-definition';
|
|
4
4
|
|
|
5
5
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
6
6
|
$prefix: (mtx, progress);
|
|
@@ -49,8 +49,8 @@ $prefix: (mtx, progress);
|
|
|
49
49
|
@function get-token-slots() {
|
|
50
50
|
@return mat.private-deep-merge-all(
|
|
51
51
|
get-unthemable-tokens(),
|
|
52
|
-
get-color-tokens(token-
|
|
53
|
-
get-typography-tokens(token-
|
|
54
|
-
get-density-tokens(token-
|
|
52
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
53
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
54
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
55
55
|
);
|
|
56
56
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use 'sass:math';
|
|
3
3
|
@use '@angular/material' as mat;
|
|
4
|
-
@use '../../token-
|
|
4
|
+
@use '../../token-definition';
|
|
5
5
|
@use '../../../style/elevation';
|
|
6
6
|
|
|
7
7
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
@@ -74,8 +74,8 @@ $prefix: (mtx, select);
|
|
|
74
74
|
@function get-token-slots() {
|
|
75
75
|
@return mat.private-deep-merge-all(
|
|
76
76
|
get-unthemable-tokens(),
|
|
77
|
-
get-color-tokens(token-
|
|
78
|
-
get-typography-tokens(token-
|
|
79
|
-
get-density-tokens(token-
|
|
77
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
78
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
79
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
80
80
|
);
|
|
81
81
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@use 'sass:map';
|
|
3
3
|
@use 'sass:meta';
|
|
4
4
|
@use '@angular/material' as mat;
|
|
5
|
-
@use '../../token-
|
|
5
|
+
@use '../../token-definition';
|
|
6
6
|
|
|
7
7
|
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
8
8
|
$prefix: (mtx, split);
|
|
@@ -43,8 +43,8 @@ $prefix: (mtx, split);
|
|
|
43
43
|
@function get-token-slots() {
|
|
44
44
|
@return mat.private-deep-merge-all(
|
|
45
45
|
get-unthemable-tokens(),
|
|
46
|
-
get-color-tokens(token-
|
|
47
|
-
get-typography-tokens(token-
|
|
48
|
-
get-density-tokens(token-
|
|
46
|
+
get-color-tokens(token-definition.$placeholder-color-config),
|
|
47
|
+
get-typography-tokens(token-definition.$placeholder-typography-config),
|
|
48
|
+
get-density-tokens(token-definition.$placeholder-density-config)
|
|
49
49
|
);
|
|
50
50
|
}
|