@ng-matero/extensions 17.1.4 → 17.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.
Files changed (70) hide show
  1. package/_index.scss +2 -0
  2. package/alert/_alert-theme.scss +10 -5
  3. package/alert/alert.scss +4 -1
  4. package/colorpicker/_colorpicker-theme.scss +9 -5
  5. package/colorpicker/colorpicker.d.ts +5 -11
  6. package/core/style/_sass-utils.scss +19 -0
  7. package/core/theming/_inspection.scss +38 -0
  8. package/core/theming/_validation.scss +5 -0
  9. package/core/tokens/_token-utils.scss +140 -0
  10. package/core/tokens/m2/_index.scss +23 -2
  11. package/core/tokens/m2/mtx/_alert.scss +1 -0
  12. package/core/tokens/m2/mtx/_datetimepicker.scss +11 -6
  13. package/core/tokens/m2/mtx/_grid.scss +3 -2
  14. package/core/tokens/m2/mtx/_popover.scss +1 -1
  15. package/core/tokens/m2/mtx/_select.scss +1 -1
  16. package/datetimepicker/_datetimepicker-theme.scss +14 -12
  17. package/datetimepicker/calendar.scss +13 -0
  18. package/datetimepicker/clock.scss +5 -5
  19. package/datetimepicker/datetimepicker-content.scss +9 -2
  20. package/datetimepicker/datetimepicker.d.ts +5 -11
  21. package/datetimepicker/time.scss +10 -8
  22. package/drawer/_drawer-theme.scss +10 -5
  23. package/esm2022/alert/alert.mjs +2 -2
  24. package/esm2022/colorpicker/colorpicker.mjs +10 -16
  25. package/esm2022/datetimepicker/calendar.mjs +3 -3
  26. package/esm2022/datetimepicker/clock.mjs +3 -3
  27. package/esm2022/datetimepicker/datetimepicker.mjs +11 -16
  28. package/esm2022/datetimepicker/time.mjs +3 -3
  29. package/esm2022/grid/grid.mjs +3 -3
  30. package/esm2022/popover/popover.mjs +3 -3
  31. package/esm2022/select/select.mjs +3 -3
  32. package/esm2022/split/split.mjs +7 -14
  33. package/experimental/_index.scss +5 -0
  34. package/experimental/theming/_color-api-back-compat.scss +46 -0
  35. package/experimental/theming/_config-validation.scss +166 -0
  36. package/experimental/theming/_custom-tokens.scss +315 -0
  37. package/experimental/theming/_definition.scss +104 -0
  38. package/experimental/theming/_format-tokens.scss +5 -0
  39. package/experimental/theming/_m3-density.scss +50 -0
  40. package/experimental/theming/_m3-tokens.scss +308 -0
  41. package/fesm2022/mtxAlert.mjs +2 -2
  42. package/fesm2022/mtxAlert.mjs.map +1 -1
  43. package/fesm2022/mtxColorpicker.mjs +10 -16
  44. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  45. package/fesm2022/mtxDatetimepicker.mjs +16 -21
  46. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  47. package/fesm2022/mtxGrid.mjs +2 -2
  48. package/fesm2022/mtxGrid.mjs.map +1 -1
  49. package/fesm2022/mtxPopover.mjs +2 -2
  50. package/fesm2022/mtxPopover.mjs.map +1 -1
  51. package/fesm2022/mtxSelect.mjs +2 -2
  52. package/fesm2022/mtxSelect.mjs.map +1 -1
  53. package/fesm2022/mtxSplit.mjs +6 -13
  54. package/fesm2022/mtxSplit.mjs.map +1 -1
  55. package/grid/_grid-theme.scss +9 -5
  56. package/grid/grid.scss +18 -8
  57. package/loader/_loader-theme.scss +10 -5
  58. package/package.json +12 -12
  59. package/popover/_popover-theme.scss +10 -5
  60. package/popover/popover.scss +1 -1
  61. package/prebuilt-themes/deeppurple-amber.css +1 -1
  62. package/prebuilt-themes/indigo-pink.css +1 -1
  63. package/prebuilt-themes/pink-bluegrey.css +1 -1
  64. package/prebuilt-themes/purple-green.css +1 -1
  65. package/progress/_progress-theme.scss +10 -5
  66. package/select/_select-theme.scss +14 -12
  67. package/select/select.scss +1 -1
  68. package/split/_split-theme.scss +15 -12
  69. package/split/split.d.ts +3 -9
  70. package/tooltip/_tooltip-theme.scss +9 -5
package/_index.scss CHANGED
@@ -23,6 +23,8 @@ split-color, split-typography, split-density, split-base;
23
23
  @forward './tooltip/tooltip-theme' as tooltip-* show tooltip-theme,
24
24
  tooltip-color, tooltip-typography, tooltip-density, tooltip-base;
25
25
 
26
+ @forward './core/tokens/m2' show m2-tokens-from-theme;
27
+
26
28
  @forward './core/theming/all-theme' show all-component-themes, all-component-bases;
27
29
  @forward './core/color/all-color' show all-component-colors;
28
30
  @forward './core/typography/all-typography' show all-component-typographies;
@@ -1,11 +1,14 @@
1
+ @use 'sass:map';
1
2
  @use '@angular/material' as mat;
2
3
  @use '../core/style/sass-utils';
4
+ @use '../core/theming/inspection';
5
+ @use '../core/theming/validation';
3
6
  @use '../core/tokens/token-utils';
4
7
  @use '../core/tokens/m2/mtx/alert' as tokens-mtx-alert;
5
8
 
6
9
  @mixin base($theme) {
7
10
  @if mat.get-theme-version($theme) == 1 {
8
- @include _theme-from-tokens(mat.get-theme-tokens($theme, base));
11
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
9
12
  }
10
13
  @else {
11
14
  @include sass-utils.current-selector-or-root() {
@@ -17,7 +20,7 @@
17
20
 
18
21
  @mixin color($theme) {
19
22
  @if mat.get-theme-version($theme) == 1 {
20
- @include _theme-from-tokens(mat.get-theme-tokens($theme, color));
23
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
21
24
  }
22
25
  @else {
23
26
  @include sass-utils.current-selector-or-root() {
@@ -29,14 +32,14 @@
29
32
 
30
33
  @mixin typography($theme) {
31
34
  @if mat.get-theme-version($theme) == 1 {
32
- @include _theme-from-tokens(mat.get-theme-tokens($theme, typography));
35
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
33
36
  }
34
37
  @else {}
35
38
  }
36
39
 
37
40
  @mixin density($theme) {
38
41
  @if mat.get-theme-version($theme) == 1 {
39
- @include _theme-from-tokens(mat.get-theme-tokens($theme, density));
42
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
40
43
  }
41
44
  @else {}
42
45
  }
@@ -44,7 +47,7 @@
44
47
  @mixin theme($theme) {
45
48
  @include mat.private-check-duplicate-theme-styles($theme, 'mtx-alert') {
46
49
  @if mat.get-theme-version($theme) == 1 {
47
- @include _theme-from-tokens(mat.get-theme-tokens($theme));
50
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme));
48
51
  }
49
52
  @else {
50
53
  @include base($theme);
@@ -62,6 +65,8 @@
62
65
  }
63
66
 
64
67
  @mixin _theme-from-tokens($tokens) {
68
+ @include validation.selector-defined(
69
+ 'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector');
65
70
  @if ($tokens != ()) {
66
71
  @include token-utils.create-token-values(tokens-mtx-alert.$prefix,
67
72
  map.get($tokens, tokens-mtx-alert.$prefix));
package/alert/alert.scss CHANGED
@@ -6,9 +6,12 @@
6
6
  display: block;
7
7
  padding: 12px 20px;
8
8
  margin-bottom: 16px;
9
- border: 1px solid transparent;
10
9
 
11
10
  @include token-utils.use-tokens(tokens-mtx-alert.$prefix, tokens-mtx-alert.get-token-slots()) {
11
+ $border-color: token-utils.get-token-variable(outline-color);
12
+
13
+ border: 1px solid var($border-color);
14
+
12
15
  @include token-utils.create-token-slot(border-radius, container-shape);
13
16
  @include token-utils.create-token-slot(background-color, background-color);
14
17
  @include token-utils.create-token-slot(color, text-color);
@@ -2,12 +2,14 @@
2
2
  @use 'sass:map';
3
3
  @use '@angular/material' as mat;
4
4
  @use '../core/style/sass-utils';
5
+ @use '../core/theming/inspection';
6
+ @use '../core/theming/validation';
5
7
  @use '../core/tokens/token-utils';
6
8
  @use '../core/tokens/m2/mtx/colorpicker' as tokens-mtx-colorpicker;
7
9
 
8
10
  @mixin base($theme) {
9
11
  @if mat.get-theme-version($theme) == 1 {
10
- @include _theme-from-tokens(mat.get-theme-tokens($theme, base));
12
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
11
13
  }
12
14
  @else {
13
15
  @include sass-utils.current-selector-or-root() {
@@ -19,7 +21,7 @@
19
21
 
20
22
  @mixin color($theme) {
21
23
  @if mat.get-theme-version($theme) == 1 {
22
- @include _theme-from-tokens(mat.get-theme-tokens($theme, color));
24
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
23
25
  }
24
26
  @else {
25
27
  @include sass-utils.current-selector-or-root() {
@@ -43,14 +45,14 @@
43
45
 
44
46
  @mixin typography($theme) {
45
47
  @if mat.get-theme-version($theme) == 1 {
46
- @include _theme-from-tokens(mat.get-theme-tokens($theme, typography));
48
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
47
49
  }
48
50
  @else {}
49
51
  }
50
52
 
51
53
  @mixin density($theme) {
52
54
  @if mat.get-theme-version($theme) == 1 {
53
- @include _theme-from-tokens(mat.get-theme-tokens($theme, density));
55
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
54
56
  }
55
57
  @else {}
56
58
  }
@@ -58,7 +60,7 @@
58
60
  @mixin theme($theme) {
59
61
  @include mat.private-check-duplicate-theme-styles($theme, 'mtx-colorpicker') {
60
62
  @if mat.get-theme-version($theme) == 1 {
61
- @include _theme-from-tokens(mat.get-theme-tokens($theme));
63
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme));
62
64
  }
63
65
  @else {
64
66
  @include base($theme);
@@ -76,6 +78,8 @@
76
78
  }
77
79
 
78
80
  @mixin _theme-from-tokens($tokens) {
81
+ @include validation.selector-defined(
82
+ 'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector');
79
83
  @if ($tokens != ()) {
80
84
  @include token-utils.create-token-values(tokens-mtx-colorpicker.$prefix,
81
85
  map.get($tokens, tokens-mtx-colorpicker.$prefix));
@@ -1,7 +1,7 @@
1
1
  import { Directionality } from '@angular/cdk/bidi';
2
2
  import { Overlay, ScrollStrategy } from '@angular/cdk/overlay';
3
- import { ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, NgZone, OnChanges, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
4
- import { CanColor, ThemePalette } from '@angular/material/core';
3
+ import { ChangeDetectorRef, EventEmitter, InjectionToken, NgZone, OnChanges, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
4
+ import { ThemePalette } from '@angular/material/core';
5
5
  import { Subject } from 'rxjs';
6
6
  import { ColorEvent } from 'ngx-color';
7
7
  import { ColorFormat, MtxColorpickerInput } from './colorpicker-input';
@@ -18,20 +18,15 @@ export declare const MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER: {
18
18
  deps: (typeof Overlay)[];
19
19
  useFactory: typeof MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY;
20
20
  };
21
- /** @docs-private */
22
- declare const _MtxColorpickerContentBase: import("@angular/material/core")._Constructor<CanColor> & import("@angular/material/core")._AbstractConstructor<CanColor> & {
23
- new (_elementRef: ElementRef): {
24
- _elementRef: ElementRef;
25
- };
26
- };
27
- export declare class MtxColorpickerContent extends _MtxColorpickerContentBase implements OnDestroy, CanColor {
21
+ export declare class MtxColorpickerContent implements OnDestroy {
28
22
  private _changeDetectorRef;
23
+ color: ThemePalette;
29
24
  picker: MtxColorpicker;
30
25
  /** Current state of the animation. */
31
26
  _animationState: 'enter-dropdown' | 'void';
32
27
  /** Emits when an animation has finished. */
33
28
  readonly _animationDone: Subject<void>;
34
- constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef);
29
+ constructor(_changeDetectorRef: ChangeDetectorRef);
35
30
  _startExitAnimation(): void;
36
31
  ngOnDestroy(): void;
37
32
  getColorString(e: ColorEvent): string;
@@ -129,4 +124,3 @@ export declare class MtxColorpicker implements OnChanges, OnDestroy {
129
124
  static ngAcceptInputType_restoreFocus: unknown;
130
125
  static ngAcceptInputType_opened: unknown;
131
126
  }
132
- export {};
@@ -1,4 +1,5 @@
1
1
  @use 'sass:color';
2
+ @use 'sass:list';
2
3
  @use 'sass:map';
3
4
  @use 'sass:meta';
4
5
 
@@ -59,3 +60,21 @@
59
60
  $args: meta.keywords($args);
60
61
  @return if(meta.type-of($color) == 'color', color.change($color, $args...), $color);
61
62
  }
63
+
64
+ /// Gets the given arguments as a map of keywords and validates that only supported arguments were
65
+ /// passed.
66
+ /// @param {ArgList} $args The arguments to convert to a keywords map.
67
+ /// @param {List} $supported-args The supported argument names.
68
+ /// @return {Map} The $args as a map of argument name to argument value.
69
+ @function validate-keyword-args($args, $supported-args) {
70
+ @if list.length($args) > 0 {
71
+ @error #{'Expected keyword args, but got positional args: '}#{$args};
72
+ }
73
+ $kwargs: meta.keywords($args);
74
+ @each $arg, $v in $kwargs {
75
+ @if list.index($supported-args, $arg) == null {
76
+ @error #{'Unsupported argument '}#{$arg}#{'. Valid arguments are: '}#{$supported-args};
77
+ }
78
+ }
79
+ @return $kwargs;
80
+ }
@@ -0,0 +1,38 @@
1
+ @use 'sass:list';
2
+ @use 'sass:map';
3
+ @use '@angular/material' as mat;
4
+
5
+ $_internals: _mat-theming-internals-do-not-access;
6
+
7
+ /// Validates that the given value is a versioned theme object.
8
+ /// @param {Any} $theme The theme object to validate.
9
+ /// @return {Boolean|Null} true if the theme has errors, else null.
10
+ @function _validate-theme-object($theme) {
11
+ $err: mat.private-validate-type($theme, 'map') or
12
+ map.get($theme, $_internals, theme-version) == null;
13
+ @return if($err, true, null);
14
+ }
15
+
16
+ /// Gets the set of tokens from the given theme, limited to those affected by the requested theming
17
+ /// systems.
18
+ /// @param {Map} $theme The theme to get tokens from.
19
+ /// @param {String...} $systems The theming systems to get tokens for. Valid values are: color,
20
+ /// typography, density, base. If no systems are passed, all tokens will be returned.
21
+ /// @return {Map} The requested tokens for the theme.
22
+ @function get-theme-tokens($theme, $systems...) {
23
+ $systems: if(list.length($systems) == 0, (color, typography, density, base), $systems);
24
+ $err: _validate-theme-object($theme);
25
+ @if $err {
26
+ @error #{'Expected $theme to be an Angular Material theme object. Got:'} $theme;
27
+ }
28
+ $err: mat.private-validate-allowed-values($systems, color, typography, density, base);
29
+ @if $err {
30
+ @error #{'Expected $systems to contain valid system names (color, typography, density, or'}
31
+ #{'base). Got invalid system names:'} $err;
32
+ }
33
+ $result: ();
34
+ @each $system in $systems {
35
+ $result: map.deep-merge($result, map.get($theme, $_internals, '#{$system}-tokens') or ());
36
+ }
37
+ @return $result;
38
+ }
@@ -0,0 +1,5 @@
1
+ @mixin selector-defined($msg) {
2
+ @if #{&} == '' {
3
+ @error $msg;
4
+ }
5
+ }
@@ -1,11 +1,16 @@
1
+ @use 'sass:list';
1
2
  @use 'sass:map';
2
3
  @use '@material/elevation/elevation-theme' as mdc-elevation-theme;
3
4
  @use '@material/theme/custom-properties' as mdc-custom-properties;
4
5
  @use '@material/theme/theme' as mdc-theme;
5
6
  @use '@material/theme/keys' as mdc-keys;
6
7
  @use '@angular/material' as mat;
8
+ @use '../style/sass-utils';
7
9
  @use '../typography/typography';
8
10
 
11
+ // Indicates whether we're building internally. Used for backwards compatibility.
12
+ $private-is-internal-build: false;
13
+
9
14
  $_placeholder-color-palette: mat.define-palette(mat.$red-palette);
10
15
 
11
16
  // Placeholder color config that can be passed to token getter functions when generating token
@@ -107,6 +112,28 @@ $_component-prefix: null;
107
112
  @return mdc-custom-properties.create-varname('#{$_component-prefix}-#{$token}');
108
113
  }
109
114
 
115
+ // TODO(crisbeto): should be able to replace the usages of `get-token-variable` with this.
116
+ // Returns a `var()` reference to a specific token. Intended for declarations
117
+ // where the token has to be referenced as a part of a larger expression.
118
+ @function get-token-variable-reference($token, $emit-fallback: false) {
119
+ @if $_component-prefix == null or $_tokens == null {
120
+ @error '`get-token-variable-reference` must be used within `use-tokens`';
121
+ }
122
+ @if not map.has-key($_tokens, $token) {
123
+ @error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
124
+ }
125
+
126
+ $var: get-token-variable($token);
127
+ $fallback: if($emit-fallback, map.get($_tokens, $token), null);
128
+
129
+ @if ($fallback != null) {
130
+ @return var($var, $fallback);
131
+ }
132
+ @else {
133
+ @return var($var);
134
+ }
135
+ }
136
+
110
137
  @mixin create-token-values($prefix, $tokens) {
111
138
  @include _configure-token-prefix($prefix...) {
112
139
  @include mdc-keys.declare-custom-properties($tokens, $_component-prefix);
@@ -124,3 +151,116 @@ $_component-prefix: null;
124
151
  $shadow-color-token: null,
125
152
  ));
126
153
  }
154
+
155
+ /// Checks whether a list starts wih a given prefix
156
+ /// @param {List} $list The list value to check the prefix of.
157
+ /// @param {List} $prefix The prefix to check.
158
+ /// @return {Boolean} Whether the list starts with the prefix.
159
+ @function _is-prefix($list, $prefix) {
160
+ @for $i from 1 through list.length($prefix) {
161
+ @if list.nth($list, $i) != list.nth($prefix, $i) {
162
+ @return false;
163
+ }
164
+ }
165
+ @return true;
166
+ }
167
+
168
+ /// Gets the supported color variants in the given token set for the given prefix.
169
+ /// @param {Map} $tokens The full token map.
170
+ /// @param {List} $prefix The component prefix to get color variants for.
171
+ /// @return {List} The supported color variants.
172
+ @function _supported-color-variants($tokens, $prefix) {
173
+ $result: ();
174
+ @each $namespace in map.keys($tokens) {
175
+ @if list.length($prefix) == list.length($namespace) - 1 and _is-prefix($namespace, $prefix) {
176
+ $result: list.append($result, list.nth($namespace, list.length($namespace)), comma);
177
+ }
178
+ }
179
+ @return $result;
180
+ }
181
+
182
+ /// Gets the token values for the given components prefix with the given options.
183
+ /// @param {Map} $tokens The full token map.
184
+ /// @param {List} $prefix The component prefix to get the token values for.
185
+ /// @param {ArgList} Any additional options
186
+ /// Currently the additional supported options are:
187
+ // - $color-variant - The color variant to use for the component
188
+ // - $emit-overrides-only - Whether to emit *only* the overrides for the
189
+ // specific color variant, or all color styles. Defaults to false.
190
+ /// @throws If given options are invalid
191
+ /// @return {Map} The token values for the requested component.
192
+ @function get-tokens-for($tokens, $prefix, $options...) {
193
+ $options: sass-utils.validate-keyword-args($options, (color-variant, emit-overrides-only));
194
+ @if $tokens == () {
195
+ @return ();
196
+ }
197
+ $values: map.get($tokens, $prefix);
198
+ $color-variant: map.get($options, color-variant);
199
+ $emit-overrides-only: map.get($options, emit-overrides-only);
200
+ @if $color-variant == null {
201
+ @return $values;
202
+ }
203
+ $overrides: map.get($tokens, list.append($prefix, $color-variant));
204
+ @if $overrides == null {
205
+ @error #{'Invalid color variant: '}#{$color-variant}#{'. Supported color variants are: '}#{
206
+ _supported-color-variants($tokens, $prefix)
207
+ }#{'.'};
208
+ }
209
+ @return if($emit-overrides-only, $overrides, map.merge($values, $overrides));
210
+ }
211
+
212
+ /// Emits new token values for the given tokens.
213
+ /// Verifies that the tokens passed in are valid tokens.
214
+ /// New token values are emitted under the current selector or root.
215
+ @mixin batch-create-token-values(
216
+ $tokens: (),
217
+ $mat-prefix: '',
218
+ $mdc-prefix: '',
219
+ $mat-tokens: (),
220
+ $mdc-tokens: ()
221
+ ) {
222
+ $custom-mat-tokens: ();
223
+ $custom-mdc-tokens: ();
224
+
225
+ $mat-token-names: map.keys($mat-tokens);
226
+ $mdc-token-names: map.keys($mdc-tokens);
227
+ $valid-token-names: _get-valid-token-names($mat-tokens, $mdc-tokens);
228
+
229
+ @each $name, $value in $tokens {
230
+ $is-mat-token: list.index($mat-token-names, $name) != null;
231
+ $is-mdc-token: list.index($mdc-token-names, $name) != null;
232
+
233
+ @if ($is-mat-token) {
234
+ $custom-mat-tokens: map.set($custom-mat-tokens, $name, $value);
235
+ }
236
+
237
+ @if ($is-mdc-token) {
238
+ $custom-mdc-tokens: map.set($custom-mdc-tokens, $name, $value);
239
+ }
240
+
241
+ @if (list.index($valid-token-names, $name) == null) {
242
+ @error (
243
+ 'Invalid token: "' + $name + '"'
244
+ 'Valid tokens include: ' $valid-token-names
245
+ );
246
+ }
247
+ }
248
+
249
+ @include sass-utils.current-selector-or-root() {
250
+ @include create-token-values($mat-prefix, $custom-mat-tokens);
251
+ @include create-token-values($mdc-prefix, $custom-mdc-tokens);
252
+ }
253
+ }
254
+
255
+ /// Returns the union of token names whose values are not null.
256
+ @function _get-valid-token-names($mat-tokens, $mdc-tokens) {
257
+ $mat-and-mdc-tokens: map.merge($mat-tokens, $mdc-tokens);
258
+
259
+ @each $name, $value in $mat-and-mdc-tokens {
260
+ @if ($value == null) {
261
+ $mat-and-mdc-tokens: map.remove($mat-and-mdc-tokens, $name);
262
+ }
263
+ }
264
+
265
+ @return map.keys($mat-and-mdc-tokens);
266
+ }
@@ -1,6 +1,17 @@
1
1
  @use 'sass:map';
2
2
  @use 'sass:meta';
3
+ @use '@angular/material' as mat;
3
4
  @use '../../style/sass-utils';
5
+ @use './mtx/alert' as tokens-mtx-alert;
6
+ @use './mtx/colorpicker' as tokens-mtx-colorpicker;
7
+ @use './mtx/datetimepicker' as tokens-mtx-datetimepicker;
8
+ @use './mtx/drawer' as tokens-mtx-drawer;
9
+ @use './mtx/grid' as tokens-mtx-grid;
10
+ @use './mtx/loader' as tokens-mtx-loader;
11
+ @use './mtx/popover' as tokens-mtx-popover;
12
+ @use './mtx/progress' as tokens-mtx-progress;
13
+ @use './mtx/select' as tokens-mtx-select;
14
+ @use './mtx/split' as tokens-mtx-split;
4
15
 
5
16
  /// Gets the tokens for the given theme, m2 tokens module, and theming system.
6
17
  /// @param {Map} $theme The Angular Material theme object to generate token values from.
@@ -14,11 +25,11 @@
14
25
  @return meta.call(
15
26
  meta.get-function(get-#{$system}-tokens, $module: $module));
16
27
  }
17
- @if not map.get($theme, $system) {
28
+ @if not mat.theme-has($theme, $system) {
18
29
  @return ();
19
30
  }
20
31
  @return meta.call(
21
- meta.get-function(get-#{$system}-tokens, $module: $module), map.get($theme, $system));
32
+ meta.get-function(get-#{$system}-tokens, $module: $module), $theme);
22
33
  }
23
34
 
24
35
  /// Gets the fully qualified tokens map for the given theme and m2 tokens module.
@@ -45,5 +56,15 @@
45
56
  /// )
46
57
  @function m2-tokens-from-theme($theme) {
47
58
  @return sass-utils.deep-merge-all(
59
+ _get-tokens-for-module($theme, tokens-mtx-alert),
60
+ _get-tokens-for-module($theme, tokens-mtx-colorpicker),
61
+ _get-tokens-for-module($theme, tokens-mtx-datetimepicker),
62
+ _get-tokens-for-module($theme, tokens-mtx-drawer),
63
+ _get-tokens-for-module($theme, tokens-mtx-grid),
64
+ _get-tokens-for-module($theme, tokens-mtx-loader),
65
+ _get-tokens-for-module($theme, tokens-mtx-popover),
66
+ _get-tokens-for-module($theme, tokens-mtx-progress),
67
+ _get-tokens-for-module($theme, tokens-mtx-select),
68
+ _get-tokens-for-module($theme, tokens-mtx-split),
48
69
  );
49
70
  }
@@ -19,6 +19,7 @@ $prefix: (mtx, alert);
19
19
  $is-dark: mat.get-theme-type($theme) == dark;
20
20
 
21
21
  @return (
22
+ outline-color: transparent,
22
23
  background-color: mat.get-theme-color($theme, background, dialog),
23
24
  text-color: mat.get-theme-color($theme, foreground, text),
24
25
  info-background-color: mat.get-color-from-palette(mat.$blue-palette, if($is-dark, 900, 500)),
@@ -1,6 +1,7 @@
1
1
  @use 'sass:color';
2
2
  @use 'sass:map';
3
3
  @use 'sass:meta';
4
+ @use '@material/elevation/elevation-theme' as mdc-elevation;
4
5
  @use '@angular/material' as mat;
5
6
  @use '../../token-utils';
6
7
  @use '../../../style/sass-utils';
@@ -39,7 +40,7 @@ $_today-fade-amount: .2;
39
40
 
40
41
  time-input-active-state-text-color: $palette-color,
41
42
  time-input-active-state-background-color: sass-utils.safe-color-change($palette-color, $alpha: .2),
42
- time-input-focus-state-border-color: $palette-color,
43
+ time-input-focus-state-outline-color: $palette-color,
43
44
  time-input-focus-state-placeholder-text-color: sass-utils.safe-color-change($palette-color, $alpha: .6),
44
45
 
45
46
  time-ampm-selected-state-background-color: sass-utils.safe-color-change($palette-color, $alpha: .2),
@@ -56,7 +57,11 @@ $_today-fade-amount: .2;
56
57
  // but may be in a future version of the theming API.
57
58
  @function get-unthemable-tokens() {
58
59
  @return (
60
+ container-elevation-shadow: mdc-elevation.elevation-box-shadow(4),
61
+ container-touch-elevation-shadow: mdc-elevation.elevation-box-shadow(24),
59
62
  container-shape: 4px,
63
+ container-touch-shape: 4px,
64
+ selector-container-shape: 4px,
60
65
  );
61
66
  }
62
67
 
@@ -81,7 +86,7 @@ $_today-fade-amount: .2;
81
86
  // calendar-period-button-icon-color: $inactive-icon-color,
82
87
  // calendar-navigation-button-icon-color: $inactive-icon-color,
83
88
  calendar-header-text-color: white,
84
- calendar-header-divider-color: $divider-color,
89
+ calendar-header-divider-color: transparent,
85
90
  calendar-table-header-text-color: $secondary-text-color,
86
91
 
87
92
  // Note: though it's not text, the border is a hint about the fact
@@ -93,8 +98,8 @@ $_today-fade-amount: .2;
93
98
  calendar-date-disabled-state-text-color: $disabled-text-color,
94
99
  // calendar-date-preview-state-outline-color: $preview-outline-color,
95
100
 
96
- calendar-container-background-color: mat.get-theme-color($theme, background, card),
97
- calendar-container-text-color: $text-color,
101
+ container-background-color: mat.get-theme-color($theme, background, card),
102
+ container-text-color: $text-color,
98
103
 
99
104
  clock-dial-background-color: $divider-color,
100
105
  clock-cell-text-color: $text-color,
@@ -104,9 +109,9 @@ $_today-fade-amount: .2;
104
109
  time-input-text-color: $text-color,
105
110
  time-input-background-color: $divider-color,
106
111
  time-input-focus-state-background-color: mat.get-theme-color($theme, background, background),
107
- time-input-warn-state-border-color: mat.get-theme-color($theme, warn),
112
+ time-input-warn-state-outline-color: mat.get-theme-color($theme, warn),
108
113
  time-ampm-text-color: sass-utils.safe-color-change($text-color, $alpha: .75),
109
- time-ampm-border-color: $hint-text-color,
114
+ time-ampm-outline-color: $hint-text-color,
110
115
  time-ampm-selected-state-text-color: $text-color,
111
116
  ));
112
117
  }
@@ -27,8 +27,9 @@ $prefix: (mtx, grid);
27
27
  column-menu-divider-color: $divider-color,
28
28
  table-footer-background-color: mat.get-theme-color($theme, background, app-bar),
29
29
  table-row-striped-background-color: if($is-dark, #3a3a3a, #f5f5f5),
30
- table-row-hover-background-color: if($is-dark, #2a2a2a, #e5e5e5),
31
- table-row-selected-background-color: if($is-dark, #2a2a2a, #e5e5e5),
30
+ table-row-hover-background-color: if($is-dark, #2a2a2a, #eee),
31
+ table-row-selected-background-color: if($is-dark, #2a2a2a, #eee),
32
+ table-row-selected-hover-background-color: if($is-dark, #1a1a1a, #e0e0e0),
32
33
  table-cell-selected-outline-color: mat.get-theme-color($theme, accent),
33
34
  resizable-handle-active-background-color: mat.get-theme-color($theme, primary),
34
35
  resizable-handle-hover-background-color: mat.get-theme-color($theme, primary),
@@ -17,9 +17,9 @@ $prefix: (mtx, popover);
17
17
  // Tokens that can be configured through Angular Material's color theming API.
18
18
  @function get-color-tokens($theme) {
19
19
  @return (
20
+ outline-color: mat.get-theme-color($theme, foreground, divider),
20
21
  background-color: mat.get-theme-color($theme, background, card),
21
22
  text-color: mat.get-theme-color($theme, foreground, text),
22
- arrow-outline-color: mat.get-theme-color($theme, foreground, divider),
23
23
  );
24
24
  }
25
25
 
@@ -40,7 +40,7 @@ $prefix: (mtx, select);
40
40
  disabled-text-color: $hint-text-color,
41
41
 
42
42
  multiple-value-background-color: mat.get-theme-color($theme, background, unselected-chip),
43
- multiple-value-border-color: $divider-color,
43
+ multiple-value-outline-color: $divider-color,
44
44
  multiple-value-icon-hover-background-color: $divider-color,
45
45
 
46
46
  clear-icon-color: $secondary-text-color,
@@ -1,6 +1,8 @@
1
1
  @use 'sass:map';
2
2
  @use '@angular/material' as mat;
3
3
  @use '../core/style/sass-utils';
4
+ @use '../core/theming/inspection';
5
+ @use '../core/theming/validation';
4
6
  @use '../core/tokens/token-utils';
5
7
  @use '../core/tokens/m2/mtx/datetimepicker' as tokens-mtx-datetimepicker;
6
8
 
@@ -13,7 +15,7 @@
13
15
 
14
16
  @mixin base($theme) {
15
17
  @if mat.get-theme-version($theme) == 1 {
16
- @include _theme-from-tokens(mat.get-theme-tokens($theme, base));
18
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
17
19
  }
18
20
  @else {
19
21
  @include sass-utils.current-selector-or-root() {
@@ -23,9 +25,9 @@
23
25
  }
24
26
  }
25
27
 
26
- @mixin color($theme) {
28
+ @mixin color($theme, $options...) {
27
29
  @if mat.get-theme-version($theme) == 1 {
28
- @include _theme-from-tokens(mat.get-theme-tokens($theme, color));
30
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, color), $options...);
29
31
  }
30
32
  @else {
31
33
  @include sass-utils.current-selector-or-root() {
@@ -59,7 +61,7 @@
59
61
 
60
62
  @mixin typography($theme) {
61
63
  @if mat.get-theme-version($theme) == 1 {
62
- @include _theme-from-tokens(mat.get-theme-tokens($theme, typography));
64
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
63
65
  }
64
66
  @else {
65
67
  @include sass-utils.current-selector-or-root() {
@@ -71,15 +73,15 @@
71
73
 
72
74
  @mixin density($theme) {
73
75
  @if mat.get-theme-version($theme) == 1 {
74
- @include _theme-from-tokens(mat.get-theme-tokens($theme, density));
76
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
75
77
  }
76
78
  @else {}
77
79
  }
78
80
 
79
- @mixin theme($theme) {
81
+ @mixin theme($theme, $options...) {
80
82
  @include mat.private-check-duplicate-theme-styles($theme, 'mtx-datetimepicker') {
81
83
  @if mat.get-theme-version($theme) == 1 {
82
- @include _theme-from-tokens(mat.get-theme-tokens($theme));
84
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme), $options...);
83
85
  }
84
86
  @else {
85
87
  @include base($theme);
@@ -96,9 +98,9 @@
96
98
  }
97
99
  }
98
100
 
99
- @mixin _theme-from-tokens($tokens) {
100
- @if ($tokens != ()) {
101
- @include token-utils.create-token-values(tokens-mtx-datetimepicker.$prefix,
102
- map.get($tokens, tokens-mtx-datetimepicker.$prefix));
103
- }
101
+ @mixin _theme-from-tokens($tokens, $options...) {
102
+ @include validation.selector-defined(
103
+ 'Calls to Angular Material theme mixins with an M3 theme must be wrapped in a selector');
104
+ $mtx-datetimepicker-tokens: token-utils.get-tokens-for($tokens, tokens-mtx-datetimepicker.$prefix, $options...);
105
+ @include token-utils.create-token-values(tokens-mtx-datetimepicker.$prefix, $mtx-datetimepicker-tokens);
104
106
  }