@ng-matero/extensions 17.1.3 → 17.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_index.scss +6 -0
- package/alert/_alert-theme.scss +10 -5
- package/alert/alert.scss +4 -1
- package/colorpicker/_colorpicker-theme.scss +9 -5
- package/colorpicker/colorpicker.d.ts +5 -11
- package/core/style/_sass-utils.scss +19 -0
- package/core/theming/_inspection.scss +38 -0
- package/core/theming/_validation.scss +5 -0
- package/core/theming/m3/_color-api-back-compat.scss +46 -0
- package/core/theming/m3/_config-validation.scss +166 -0
- package/core/theming/m3/_custom-tokens.scss +315 -0
- package/core/theming/m3/_definition.scss +104 -0
- package/core/theming/m3/_format-tokens.scss +5 -0
- package/core/theming/m3/_m3-density.scss +50 -0
- package/core/theming/m3/_m3-tokens.scss +308 -0
- package/core/tokens/_token-utils.scss +140 -0
- package/core/tokens/m2/_index.scss +23 -2
- package/core/tokens/m2/mtx/_alert.scss +1 -0
- package/core/tokens/m2/mtx/_datetimepicker.scss +13 -7
- package/core/tokens/m2/mtx/_grid.scss +3 -2
- package/core/tokens/m2/mtx/_popover.scss +1 -1
- package/core/tokens/m2/mtx/_select.scss +1 -1
- package/datetimepicker/_datetimepicker-theme.scss +14 -12
- package/datetimepicker/calendar.scss +13 -0
- package/datetimepicker/clock.scss +5 -5
- package/datetimepicker/datetimepicker-content.scss +9 -2
- package/datetimepicker/datetimepicker.d.ts +5 -11
- package/datetimepicker/time.scss +10 -8
- package/drawer/_drawer-theme.scss +10 -5
- package/esm2022/alert/alert-module.mjs +4 -4
- package/esm2022/alert/alert.mjs +4 -4
- 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 +3 -3
- package/esm2022/colorpicker/colorpicker-input.mjs +3 -3
- package/esm2022/colorpicker/colorpicker-module.mjs +4 -4
- package/esm2022/colorpicker/colorpicker-toggle.mjs +6 -6
- package/esm2022/colorpicker/colorpicker.mjs +14 -20
- 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 +3 -3
- package/esm2022/datetimepicker/calendar.mjs +5 -5
- package/esm2022/datetimepicker/clock.mjs +5 -5
- 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 +6 -6
- package/esm2022/datetimepicker/datetimepicker.mjs +15 -20
- 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 +3 -3
- package/esm2022/drawer/drawer-module.mjs +4 -4
- package/esm2022/drawer/drawer.mjs +3 -3
- package/esm2022/grid/cell.mjs +3 -3
- package/esm2022/grid/column-menu.mjs +3 -3
- 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 +8 -8
- package/esm2022/loader/loader-module.mjs +4 -4
- package/esm2022/loader/loader.mjs +3 -3
- 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 +3 -3
- package/esm2022/popover/popover.mjs +5 -5
- package/esm2022/progress/progress-module.mjs +4 -4
- package/esm2022/progress/progress.mjs +3 -3
- package/esm2022/select/option.mjs +3 -3
- package/esm2022/select/select-module.mjs +4 -4
- package/esm2022/select/select.mjs +50 -37
- package/esm2022/select/templates.mjs +33 -33
- package/esm2022/split/split-module.mjs +4 -4
- package/esm2022/split/split-pane.mjs +3 -3
- package/esm2022/split/split.mjs +9 -16
- 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 +7 -7
- package/fesm2022/mtxColorpicker.mjs +27 -33
- package/fesm2022/mtxColorpicker.mjs.map +1 -1
- package/fesm2022/mtxColumnResize.mjs +40 -40
- package/fesm2022/mtxCore.mjs +21 -21
- package/fesm2022/mtxDatetimepicker.mjs +57 -62
- package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2022/mtxDialog.mjs +10 -10
- package/fesm2022/mtxDrawer.mjs +10 -10
- package/fesm2022/mtxGrid.mjs +67 -67
- package/fesm2022/mtxGrid.mjs.map +1 -1
- package/fesm2022/mtxLoader.mjs +7 -7
- package/fesm2022/mtxPhotoviewer.mjs +7 -7
- package/fesm2022/mtxPopover.mjs +20 -20
- package/fesm2022/mtxPopover.mjs.map +1 -1
- package/fesm2022/mtxProgress.mjs +7 -7
- package/fesm2022/mtxSelect.mjs +88 -75
- package/fesm2022/mtxSelect.mjs.map +1 -1
- package/fesm2022/mtxSplit.mjs +15 -22
- package/fesm2022/mtxSplit.mjs.map +1 -1
- package/fesm2022/mtxTooltip.mjs +10 -10
- package/grid/_grid-theme.scss +9 -5
- package/grid/grid.scss +18 -8
- package/loader/_loader-theme.scss +10 -5
- package/package.json +11 -11
- package/popover/_popover-theme.scss +10 -5
- package/popover/popover.scss +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/progress/_progress-theme.scss +10 -5
- package/select/_select-theme.scss +14 -12
- package/select/select.d.ts +18 -25
- package/select/select.scss +1 -1
- package/split/_split-theme.scss +15 -12
- package/split/split.d.ts +3 -9
- package/tooltip/_tooltip-theme.scss +9 -5
package/_index.scss
CHANGED
|
@@ -23,7 +23,13 @@ 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;
|
|
29
31
|
@forward './core/density/all-density' show all-component-densities;
|
|
32
|
+
|
|
33
|
+
// Experimental M3 Token-based theming API
|
|
34
|
+
@forward './core/theming/m3/definition' show define-theme, define-colors, define-typography, define-density;
|
|
35
|
+
@forward './core/theming/m3/color-api-back-compat' show color-variants-back-compat;
|
package/alert/_alert-theme.scss
CHANGED
|
@@ -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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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,
|
|
4
|
-
import {
|
|
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
|
-
|
|
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(
|
|
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,46 @@
|
|
|
1
|
+
@use '@angular/material' as mat;
|
|
2
|
+
@use '../../../datetimepicker/datetimepicker-theme';
|
|
3
|
+
@use '../../../select/select-theme';
|
|
4
|
+
@use '../../../split/split-theme';
|
|
5
|
+
|
|
6
|
+
// We want to emit only the overrides, because the backwards compatibility styles are usually
|
|
7
|
+
// emitted after all the tokens have been included once already. This allows us to save ~50kb
|
|
8
|
+
// from the bundle.
|
|
9
|
+
$_overrides-only: true;
|
|
10
|
+
|
|
11
|
+
@mixin color-variant-styles($theme, $color-variant) {
|
|
12
|
+
$primary-options: (color-variant: $color-variant, emit-overrides-only: $_overrides-only);
|
|
13
|
+
|
|
14
|
+
// Some components use the secondary color rather than primary color for `.mat-primary`.
|
|
15
|
+
// Those components should use the $secondary-color-variant.
|
|
16
|
+
$secondary-options: (
|
|
17
|
+
color-variant: if($color-variant == primary, secondary, $color-variant),
|
|
18
|
+
emit-overrides-only: $_overrides-only
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
&.mtx-split-gutter {
|
|
22
|
+
@include split-theme.color($theme, $primary-options...);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.mtx-datetimepicker-content {
|
|
26
|
+
@include datetimepicker-theme.color($theme, $primary-options...);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.ng-dropdown-panel {
|
|
30
|
+
@include select-theme.color($theme, $secondary-options...);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@mixin color-variants-back-compat($theme) {
|
|
35
|
+
.mat-primary {
|
|
36
|
+
@include color-variant-styles($theme, primary);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.mat-accent {
|
|
40
|
+
@include color-variant-styles($theme, tertiary);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.mat-warn {
|
|
44
|
+
@include color-variant-styles($theme, error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:string';
|
|
5
|
+
@use '@angular/material' as mat;
|
|
6
|
+
@use '@angular/material-experimental' as matx;
|
|
7
|
+
|
|
8
|
+
/// Creates an error message by finding `$config` in the existing message and appending a suffix to
|
|
9
|
+
/// it.
|
|
10
|
+
/// @param {List|String} $err The error message.
|
|
11
|
+
/// @param {String} $suffix The suffix to add.
|
|
12
|
+
/// @return {List|String} The updated error message.
|
|
13
|
+
@function _create-dollar-config-error-message($err, $suffix) {
|
|
14
|
+
@if meta.type-of($err) == 'list' {
|
|
15
|
+
@for $i from 1 through list.length($err) {
|
|
16
|
+
$err: list.set-nth($err, $i,
|
|
17
|
+
_create-dollar-config-error-message(list.nth($err, $i), $suffix));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
@else if meta.type-of($err) == 'string' {
|
|
21
|
+
$start: string.index($err, '$config');
|
|
22
|
+
@if $start {
|
|
23
|
+
$err: string.insert($err, $suffix, $start + 7);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
@return $err;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// Validates that the given object is an M3 palette.
|
|
30
|
+
/// @param {*} $palette The object to test
|
|
31
|
+
/// @return {Boolean|null} null if it is a valid M3 palette, else true.
|
|
32
|
+
@function _validate-palette($palette) {
|
|
33
|
+
@if not meta.type-of($palette) == 'map' {
|
|
34
|
+
@return true;
|
|
35
|
+
}
|
|
36
|
+
$keys: map.keys($palette);
|
|
37
|
+
$expected-keys: map.keys(matx.$m3-red-palette);
|
|
38
|
+
@if mat.private-validate-allowed-values($keys, $expected-keys...) or
|
|
39
|
+
mat.private-validate-required-values($keys, $expected-keys...) {
|
|
40
|
+
@return true;
|
|
41
|
+
}
|
|
42
|
+
$nv-keys: map.keys(map.get($palette, neutral-variant));
|
|
43
|
+
$expected-nv-keys: map.keys(map.get(matx.$m3-red-palette, neutral-variant));
|
|
44
|
+
@if mat.private-validate-allowed-values($nv-keys, $expected-nv-keys...) or
|
|
45
|
+
mat.private-validate-required-values($nv-keys, $expected-nv-keys...) {
|
|
46
|
+
@return true;
|
|
47
|
+
}
|
|
48
|
+
@return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// Validates a theme config.
|
|
52
|
+
/// @param {Map} $config The config to test.
|
|
53
|
+
/// @return {List} null if no error, else the error message
|
|
54
|
+
@function validate-theme-config($config) {
|
|
55
|
+
$err: mat.private-validate-type($config, 'map', 'null');
|
|
56
|
+
@if $err {
|
|
57
|
+
@return (#{'$config should be a configuration object. Got:'} $config);
|
|
58
|
+
}
|
|
59
|
+
$allowed: (color, typography, density);
|
|
60
|
+
$err: mat.private-validate-allowed-values(map.keys($config or ()), $allowed...);
|
|
61
|
+
@if $err {
|
|
62
|
+
@return (
|
|
63
|
+
#{'$config has unexpected properties. Valid properties are'}
|
|
64
|
+
#{'#{$allowed}.'}
|
|
65
|
+
#{'Found:'}
|
|
66
|
+
$err
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
$err: validate-color-config(map.get($config, color));
|
|
70
|
+
@if $err {
|
|
71
|
+
@return _create-dollar-config-error-message($err, '.color');
|
|
72
|
+
}
|
|
73
|
+
$err: validate-typography-config(map.get($config, typography));
|
|
74
|
+
@if $err {
|
|
75
|
+
@return _create-dollar-config-error-message($err, '.typography');
|
|
76
|
+
}
|
|
77
|
+
$err: validate-density-config(map.get($config, density));
|
|
78
|
+
@if $err {
|
|
79
|
+
@return _create-dollar-config-error-message($err, '.density');
|
|
80
|
+
}
|
|
81
|
+
@return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// Validates a theme color config.
|
|
85
|
+
/// @param {Map} $config The config to test.
|
|
86
|
+
/// @return {List} null if no error, else the error message
|
|
87
|
+
@function validate-color-config($config) {
|
|
88
|
+
$err: mat.private-validate-type($config, 'map', 'null');
|
|
89
|
+
@if $err {
|
|
90
|
+
@return (#{'$config should be a color configuration object. Got:'} $config);
|
|
91
|
+
}
|
|
92
|
+
$allowed: (theme-type, primary, tertiary);
|
|
93
|
+
$err: mat.private-validate-allowed-values(map.keys($config or ()), $allowed...);
|
|
94
|
+
@if $err {
|
|
95
|
+
@return (
|
|
96
|
+
#{'$config has unexpected properties. Valid properties are'}
|
|
97
|
+
#{'#{$allowed}.'}
|
|
98
|
+
#{'Found:'}
|
|
99
|
+
$err
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
@if $config and map.has-key($config, theme-type) and
|
|
103
|
+
not list.index((light, dark), map.get($config, theme-type)) {
|
|
104
|
+
@return (
|
|
105
|
+
#{'Expected $config.theme-type to be one of: light, dark. Got:'}
|
|
106
|
+
map.get($config, theme-type)
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
@each $palette in (primary, secondary, tertiary) {
|
|
110
|
+
@if $config and map.has-key($config, $palette) {
|
|
111
|
+
$err: _validate-palette(map.get($config, $palette));
|
|
112
|
+
@if $err {
|
|
113
|
+
@return (
|
|
114
|
+
#{'Expected $config.#{$palette} to be a valid M3 palette. Got:'}
|
|
115
|
+
map.get($config, $palette)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
@return null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/// Validates a theme typography config.
|
|
124
|
+
/// @param {Map} $config The config to test.
|
|
125
|
+
/// @return {List} null if no error, else the error message
|
|
126
|
+
@function validate-typography-config($config) {
|
|
127
|
+
$err: mat.private-validate-type($config, 'map', 'null');
|
|
128
|
+
@if $err {
|
|
129
|
+
@return (#{'$config should be a typography configuration object. Got:'} $config);
|
|
130
|
+
}
|
|
131
|
+
$allowed: (brand-family, plain-family, bold-weight, medium-weight, regular-weight);
|
|
132
|
+
$err: mat.private-validate-allowed-values(map.keys($config or ()), $allowed...);
|
|
133
|
+
@if $err {
|
|
134
|
+
@return (
|
|
135
|
+
#{'$config has unexpected properties. Valid properties are'}
|
|
136
|
+
#{'#{$allowed}.'}
|
|
137
|
+
#{'Found:'}
|
|
138
|
+
$err
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
@return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/// Validates a theme density config.
|
|
145
|
+
/// @param {Map} $config The config to test.
|
|
146
|
+
/// @return {List} null if no error, else the error message
|
|
147
|
+
@function validate-density-config($config) {
|
|
148
|
+
$err: mat.private-validate-type($config, 'map', 'null');
|
|
149
|
+
@if $err {
|
|
150
|
+
@return (#{'$config should be a density configuration object. Got:'} $config);
|
|
151
|
+
}
|
|
152
|
+
$err: mat.private-validate-allowed-values(map.keys($config or ()), scale);
|
|
153
|
+
@if $err {
|
|
154
|
+
@return (#{'$config has unexpected properties. Valid properties are: scale. Found:'} $err);
|
|
155
|
+
}
|
|
156
|
+
@if $config and map.has-key($config, scale) {
|
|
157
|
+
$allowed-scales: (0, -1, -2, -3, -4, -5, minimum, maximum);
|
|
158
|
+
@if mat.private-validate-allowed-values(map.get($config, scale), $allowed-scales...) {
|
|
159
|
+
@return (
|
|
160
|
+
#{'Expected $config.scale to be one of: #{$allowed-scales}. Got:'}
|
|
161
|
+
map.get($config, scale)
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
@return null;
|
|
166
|
+
}
|