@ng-matero/extensions 16.1.2 → 16.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/README.md +2 -2
- package/_index.scss +0 -3
- package/_theming.scss +0 -3
- package/alert/_alert-theme.scss +12 -28
- package/alert/alert.scss +28 -0
- package/colorpicker/_colorpicker-theme.scss +20 -8
- package/colorpicker/colorpicker-toggle.scss +23 -17
- package/core/style/_sass-utils.scss +49 -0
- package/core/theming/_all-theme.scss +0 -2
- package/core/tokens/_token-utils.scss +127 -0
- package/core/tokens/m2/_index.scss +49 -0
- package/core/tokens/m2/mdc/_plain-tooltip.scss +72 -0
- package/core/tokens/m2/mtx/_alert.scss +55 -0
- package/core/tokens/m2/mtx/_colorpicker.scss +55 -0
- package/core/tokens/m2/mtx/_datetimepicker.scss +155 -0
- package/core/tokens/m2/mtx/_drawer.scss +45 -0
- package/core/tokens/m2/mtx/_grid.scss +53 -0
- package/core/tokens/m2/mtx/_loader.scss +45 -0
- package/core/tokens/m2/mtx/_popover.scss +46 -0
- package/core/tokens/m2/mtx/_progress.scss +56 -0
- package/core/tokens/m2/mtx/_select.scss +83 -0
- package/core/tokens/m2/mtx/_split.scss +54 -0
- package/core/typography/_typography.scss +203 -36
- package/datetimepicker/_datetimepicker-theme.scss +31 -183
- package/datetimepicker/calendar-body.scss +81 -1
- package/datetimepicker/calendar.scss +33 -3
- package/datetimepicker/clock.scss +50 -10
- package/datetimepicker/datetimepicker-content.scss +12 -0
- package/datetimepicker/datetimepicker-toggle.scss +23 -17
- package/datetimepicker/time.scss +41 -1
- package/drawer/_drawer-theme.scss +6 -10
- package/drawer/drawer-container.scss +11 -0
- package/esm2022/alert/alert.mjs +4 -4
- package/esm2022/colorpicker/colorpicker-toggle.mjs +2 -2
- package/esm2022/datetimepicker/calendar-body.mjs +2 -2
- package/esm2022/datetimepicker/calendar.mjs +3 -3
- package/esm2022/datetimepicker/clock.mjs +2 -2
- package/esm2022/datetimepicker/datetimepicker-toggle.mjs +2 -2
- package/esm2022/datetimepicker/datetimepicker.mjs +3 -3
- package/esm2022/datetimepicker/time.mjs +3 -3
- package/esm2022/drawer/drawer-container.mjs +3 -3
- package/esm2022/grid/cell.mjs +6 -21
- package/esm2022/grid/grid-module.mjs +18 -9
- package/esm2022/grid/grid-utils.mjs +4 -2
- package/esm2022/grid/grid.mjs +20 -20
- package/esm2022/grid/image-preview.mjs +50 -0
- package/esm2022/grid/public-api.mjs +2 -1
- package/esm2022/loader/loader.mjs +2 -2
- package/esm2022/popover/popover.mjs +3 -3
- package/esm2022/progress/progress.mjs +4 -4
- package/esm2022/select/select.mjs +11 -3
- package/esm2022/split/split.mjs +2 -2
- package/esm2022/tooltip/tooltip.mjs +2 -2
- package/fesm2022/mtxAlert.mjs +3 -3
- package/fesm2022/mtxAlert.mjs.map +1 -1
- package/fesm2022/mtxColorpicker.mjs +2 -2
- package/fesm2022/mtxColorpicker.mjs.map +1 -1
- package/fesm2022/mtxDatetimepicker.mjs +12 -12
- package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2022/mtxDrawer.mjs +2 -2
- package/fesm2022/mtxDrawer.mjs.map +1 -1
- package/fesm2022/mtxGrid.mjs +223 -182
- package/fesm2022/mtxGrid.mjs.map +1 -1
- package/fesm2022/mtxLoader.mjs +2 -2
- package/fesm2022/mtxLoader.mjs.map +1 -1
- package/fesm2022/mtxPopover.mjs +2 -2
- package/fesm2022/mtxPopover.mjs.map +1 -1
- package/fesm2022/mtxProgress.mjs +3 -3
- package/fesm2022/mtxProgress.mjs.map +1 -1
- package/fesm2022/mtxSelect.mjs +10 -2
- package/fesm2022/mtxSelect.mjs.map +1 -1
- package/fesm2022/mtxSplit.mjs +2 -2
- package/fesm2022/mtxSplit.mjs.map +1 -1
- package/fesm2022/mtxTooltip.mjs +2 -2
- package/fesm2022/mtxTooltip.mjs.map +1 -1
- package/grid/_grid-theme.scss +14 -84
- package/grid/cell.d.ts +0 -2
- package/grid/cell.scss +2 -1
- package/grid/grid-module.d.ts +22 -21
- package/grid/grid.d.ts +7 -7
- package/grid/grid.scss +104 -16
- package/grid/image-preview.d.ts +13 -0
- package/grid/public-api.d.ts +1 -0
- package/loader/_loader-theme.scss +6 -6
- package/loader/loader.scss +7 -0
- package/package.json +14 -20
- package/popover/_popover-theme.scss +6 -40
- package/popover/popover.scss +32 -2
- 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 +6 -25
- package/progress/progress.scss +42 -0
- package/select/_select-theme.scss +19 -133
- package/select/select.d.ts +1 -0
- package/select/select.scss +147 -36
- package/split/_split-theme.scss +21 -18
- package/split/split.scss +13 -0
- package/tooltip/_tooltip-theme.scss +19 -24
- package/tooltip/tooltip.scss +18 -17
- package/esm2022/slider/mtxSlider.mjs +0 -5
- package/esm2022/slider/public-api.mjs +0 -3
- package/esm2022/slider/slider-module.mjs +0 -19
- package/esm2022/slider/slider.mjs +0 -1115
- package/fesm2022/mtxSlider.mjs +0 -1137
- package/fesm2022/mtxSlider.mjs.map +0 -1
- package/slider/_slider-theme.import.scss +0 -2
- package/slider/_slider-theme.scss +0 -232
- package/slider/index.d.ts +0 -5
- package/slider/public-api.d.ts +0 -2
- package/slider/slider-module.d.ts +0 -9
- package/slider/slider.d.ts +0 -277
- package/slider/slider.scss +0 -514
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.codefactor.io/repository/github/ng-matero/extensions)
|
|
4
4
|
[](https://www.npmjs.com/package/@ng-matero/extensions)
|
|
5
5
|
[](https://github.com/ng-matero/extensions/releases)
|
|
6
|
-
[](https://github.com/ng-matero/extensions/blob/
|
|
6
|
+
[](https://github.com/ng-matero/extensions/blob/main/LICENSE)
|
|
7
7
|
[](https://gitter.im/matero-io/extensions)
|
|
8
8
|
|
|
9
9
|
The Ng-Matero Extensions is an extended component library for Angular Material.
|
|
@@ -41,7 +41,7 @@ export class YourAppModule {
|
|
|
41
41
|
|
|
42
42
|
## Theming
|
|
43
43
|
|
|
44
|
-
After import modules, you must define a theme. [More
|
|
44
|
+
After import modules, you must define a theme. [More about theming](https://material.angular.io/guide/theming).
|
|
45
45
|
|
|
46
46
|
```scss
|
|
47
47
|
@use '@ng-matero/extensions' as mtx;
|
package/_index.scss
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@forward 'photoviewer';
|
|
2
|
-
|
|
3
1
|
@forward './alert/alert-theme' as alert-* show alert-theme;
|
|
4
2
|
@forward './button/button-theme' as button-* show button-theme;
|
|
5
3
|
@forward './colorpicker/colorpicker-theme' as colorpicker-* show colorpicker-theme;
|
|
@@ -10,7 +8,6 @@
|
|
|
10
8
|
@forward './popover/popover-theme' as popover-* show popover-theme;
|
|
11
9
|
@forward './progress/progress-theme' as progress-* show progress-theme;
|
|
12
10
|
@forward './select/select-theme' as select-* show select-theme;
|
|
13
|
-
@forward './slider/slider-theme' as slider-* show slider-theme;
|
|
14
11
|
@forward './split/split-theme' as split-* show split-theme;
|
|
15
12
|
@forward './tooltip/tooltip-theme' as tooltip-* show tooltip-theme;
|
|
16
13
|
|
package/_theming.scss
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@forward 'photoviewer';
|
|
2
|
-
|
|
3
1
|
@forward './alert/alert-theme.import';
|
|
4
2
|
@forward './button/button-theme.import';
|
|
5
3
|
@forward './colorpicker/colorpicker-theme.import';
|
|
@@ -10,7 +8,6 @@
|
|
|
10
8
|
@forward './popover/popover-theme.import';
|
|
11
9
|
@forward './progress/progress-theme.import';
|
|
12
10
|
@forward './select/select-theme.import';
|
|
13
|
-
@forward './slider/slider-theme.import';
|
|
14
11
|
@forward './split/split-theme.import';
|
|
15
12
|
@forward './tooltip/tooltip-theme.import';
|
|
16
13
|
|
package/alert/_alert-theme.scss
CHANGED
|
@@ -1,33 +1,14 @@
|
|
|
1
|
-
@use 'sass
|
|
1
|
+
@use '../core/style/sass-utils';
|
|
2
2
|
@use '../core/theming/theming';
|
|
3
|
-
@use '../core/
|
|
3
|
+
@use '../core/tokens/token-utils';
|
|
4
|
+
@use '../core/tokens/m2/mtx/alert' as tokens-mtx-alert;
|
|
4
5
|
|
|
5
6
|
@mixin color($config-or-theme) {
|
|
6
7
|
$config: theming.get-color-config($config-or-theme);
|
|
7
|
-
$background: map.get($config, background);
|
|
8
8
|
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.mtx-alert-info.mtx-alert {
|
|
14
|
-
background-color: theming.get-color-from-palette(palette.$blue-palette, 500);
|
|
15
|
-
color: white;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.mtx-alert-success.mtx-alert {
|
|
19
|
-
background-color: theming.get-color-from-palette(palette.$green-palette, 500);
|
|
20
|
-
color: white;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.mtx-alert-warning.mtx-alert {
|
|
24
|
-
background-color: theming.get-color-from-palette(palette.$orange-palette, 500);
|
|
25
|
-
color: white;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.mtx-alert-danger.mtx-alert {
|
|
29
|
-
background-color: theming.get-color-from-palette(palette.$red-palette, 500);
|
|
30
|
-
color: white;
|
|
9
|
+
@include sass-utils.current-selector-or-root() {
|
|
10
|
+
@include token-utils.create-token-values(tokens-mtx-alert.$prefix,
|
|
11
|
+
tokens-mtx-alert.get-color-tokens($config));
|
|
31
12
|
}
|
|
32
13
|
}
|
|
33
14
|
|
|
@@ -37,18 +18,21 @@
|
|
|
37
18
|
|
|
38
19
|
@mixin theme($theme-or-color-config) {
|
|
39
20
|
$theme: theming.private-legacy-get-theme($theme-or-color-config);
|
|
21
|
+
|
|
40
22
|
@include theming.private-check-duplicate-theme-styles($theme, 'mtx-alert') {
|
|
41
23
|
$color: theming.get-color-config($theme);
|
|
42
24
|
$density: theming.get-density-config($theme);
|
|
43
25
|
$typography: theming.get-typography-config($theme);
|
|
44
26
|
|
|
45
|
-
@if $color !=
|
|
27
|
+
@if $color !=null {
|
|
46
28
|
@include color($color);
|
|
47
29
|
}
|
|
48
|
-
|
|
30
|
+
|
|
31
|
+
@if $density !=null {
|
|
49
32
|
@include density($density);
|
|
50
33
|
}
|
|
51
|
-
|
|
34
|
+
|
|
35
|
+
@if $typography !=null {
|
|
52
36
|
@include typography($typography);
|
|
53
37
|
}
|
|
54
38
|
}
|
package/alert/alert.scss
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
@use '../core/tokens/token-utils';
|
|
2
|
+
@use '../core/tokens/m2/mtx/alert' as tokens-mtx-alert;
|
|
3
|
+
|
|
1
4
|
.mtx-alert {
|
|
2
5
|
position: relative;
|
|
3
6
|
display: block;
|
|
@@ -5,6 +8,31 @@
|
|
|
5
8
|
margin-bottom: 1rem;
|
|
6
9
|
border: 1px solid transparent;
|
|
7
10
|
border-radius: .25rem;
|
|
11
|
+
|
|
12
|
+
@include token-utils.use-tokens(tokens-mtx-alert.$prefix, tokens-mtx-alert.get-token-slots()) {
|
|
13
|
+
@include token-utils.create-token-slot(background-color, background-color);
|
|
14
|
+
@include token-utils.create-token-slot(color, text-color);
|
|
15
|
+
|
|
16
|
+
&.mtx-alert-info {
|
|
17
|
+
@include token-utils.create-token-slot(background-color, info-background-color);
|
|
18
|
+
@include token-utils.create-token-slot(color, info-text-color);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.mtx-alert-success {
|
|
22
|
+
@include token-utils.create-token-slot(background-color, success-background-color);
|
|
23
|
+
@include token-utils.create-token-slot(color, success-text-color);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.mtx-alert-warning {
|
|
27
|
+
@include token-utils.create-token-slot(background-color, warning-background-color);
|
|
28
|
+
@include token-utils.create-token-slot(color, warning-text-color);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.mtx-alert-danger {
|
|
32
|
+
@include token-utils.create-token-slot(background-color, danger-background-color);
|
|
33
|
+
@include token-utils.create-token-slot(color, danger-text-color);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
8
36
|
}
|
|
9
37
|
|
|
10
38
|
.mtx-alert-close {
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
1
2
|
@use 'sass:map';
|
|
2
3
|
@use '../core/theming/theming';
|
|
3
|
-
@use '../core/
|
|
4
|
+
@use '../core/typography/typography';
|
|
5
|
+
@use '../core/style/sass-utils';
|
|
6
|
+
@use '../core/tokens/token-utils';
|
|
7
|
+
@use '../core/tokens/m2/mtx/colorpicker' as tokens-mtx-colorpicker;
|
|
4
8
|
|
|
5
9
|
@mixin color($config-or-theme) {
|
|
6
10
|
$config: theming.get-color-config($config-or-theme);
|
|
7
11
|
$background: map.get($config, background);
|
|
8
12
|
|
|
9
|
-
.
|
|
10
|
-
|
|
13
|
+
@include sass-utils.current-selector-or-root() {
|
|
14
|
+
@include token-utils.create-token-values(tokens-mtx-colorpicker.$prefix,
|
|
15
|
+
tokens-mtx-colorpicker.get-color-tokens($config));
|
|
16
|
+
}
|
|
11
17
|
|
|
18
|
+
.mtx-colorpicker-toggle-active {
|
|
12
19
|
&.mat-accent {
|
|
13
|
-
|
|
20
|
+
$accent-tokens: tokens-mtx-colorpicker.private-get-toggle-color-palette-color-tokens($config, accent);
|
|
21
|
+
@include token-utils.create-token-values(tokens-mtx-colorpicker.$prefix, $accent-tokens);
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
&.mat-warn {
|
|
17
|
-
|
|
25
|
+
$warn-tokens: tokens-mtx-colorpicker.private-get-toggle-color-palette-color-tokens($config, warn);
|
|
26
|
+
@include token-utils.create-token-values(tokens-mtx-colorpicker.$prefix, $warn-tokens);
|
|
18
27
|
}
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -25,18 +34,21 @@
|
|
|
25
34
|
|
|
26
35
|
@mixin theme($theme-or-color-config) {
|
|
27
36
|
$theme: theming.private-legacy-get-theme($theme-or-color-config);
|
|
37
|
+
|
|
28
38
|
@include theming.private-check-duplicate-theme-styles($theme, 'mtx-colorpicker') {
|
|
29
39
|
$color: theming.get-color-config($theme);
|
|
30
40
|
$density: theming.get-density-config($theme);
|
|
31
41
|
$typography: theming.get-typography-config($theme);
|
|
32
42
|
|
|
33
|
-
@if $color !=
|
|
43
|
+
@if $color !=null {
|
|
34
44
|
@include color($color);
|
|
35
45
|
}
|
|
36
|
-
|
|
46
|
+
|
|
47
|
+
@if $density !=null {
|
|
37
48
|
@include density($density);
|
|
38
49
|
}
|
|
39
|
-
|
|
50
|
+
|
|
51
|
+
@if $typography !=null {
|
|
40
52
|
@include typography($typography);
|
|
41
53
|
}
|
|
42
54
|
}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
@use '@angular/cdk';
|
|
2
|
+
@use '../core/tokens/token-utils';
|
|
3
|
+
@use '../core/tokens/m2/mtx/colorpicker' as tokens-mtx-colorpicker;
|
|
4
|
+
|
|
5
|
+
$_tokens: tokens-mtx-colorpicker.$prefix, tokens-mtx-colorpicker.get-token-slots();
|
|
6
|
+
|
|
7
|
+
// We support the case where the form field is disabled, but the datepicker is not.
|
|
8
|
+
// MDC sets `pointer-events: none` on disabled form fields which prevents clicks on the toggle.
|
|
9
|
+
.mtx-colorpicker-toggle {
|
|
10
|
+
pointer-events: auto;
|
|
11
|
+
|
|
12
|
+
@include token-utils.use-tokens($_tokens...) {
|
|
13
|
+
@include token-utils.create-token-slot(color, toggle-icon-color);
|
|
7
14
|
}
|
|
8
15
|
}
|
|
9
16
|
|
|
10
|
-
.
|
|
11
|
-
.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
width: 1.5em;
|
|
16
|
-
height: 1.5em;
|
|
17
|
-
}
|
|
17
|
+
.mtx-colorpicker-toggle-active {
|
|
18
|
+
@include token-utils.use-tokens($_tokens...) {
|
|
19
|
+
@include token-utils.create-token-slot(color, toggle-active-state-icon-color);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
@include cdk.high-contrast(active, off) {
|
|
24
|
+
.mtx-colorpicker-toggle-default-icon {
|
|
25
|
+
// On Chromium-based browsers the icon doesn't appear to inherit the text color in high
|
|
26
|
+
// contrast mode so we have to set it explicitly. This is a no-op on IE and Firefox.
|
|
27
|
+
color: CanvasText;
|
|
22
28
|
}
|
|
23
29
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:meta';
|
|
3
|
+
|
|
4
|
+
/// Include content under the current selector (&) or the document root if there is no current
|
|
5
|
+
/// selector.
|
|
6
|
+
/// @param {String} $root [html] The default root selector to use when there is no current selector.
|
|
7
|
+
/// @output The given content under the current selector, or root selector if there is no current
|
|
8
|
+
/// selector.
|
|
9
|
+
/// @content Content to output under the current selector, or root selector if there is no current
|
|
10
|
+
/// selector.
|
|
11
|
+
@mixin current-selector-or-root($root: html) {
|
|
12
|
+
@at-root #{& or $root} {
|
|
13
|
+
@content;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/// A version of the standard `map.merge` function that takes a variable number of arguments.
|
|
18
|
+
/// Each argument is merged into the final result from left to right.
|
|
19
|
+
/// @param {List} $maps The maps to combine with map.merge
|
|
20
|
+
/// @return {Map} The combined result of successively calling map.merge with each parameter.
|
|
21
|
+
@function merge-all($maps...) {
|
|
22
|
+
$result: ();
|
|
23
|
+
@each $map in $maps {
|
|
24
|
+
$result: map.merge($result, $map);
|
|
25
|
+
}
|
|
26
|
+
@return $result;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// A version of the standard `map.deep-merge` function that takes a variable number of arguments.
|
|
30
|
+
/// Each argument is deep-merged into the final result from left to right.
|
|
31
|
+
/// @param {List} $maps The maps to combine with map.deep-merge
|
|
32
|
+
/// @return {Map} The combined result of successively calling map.deep-merge with each parameter.
|
|
33
|
+
@function deep-merge-all($maps...) {
|
|
34
|
+
$result: ();
|
|
35
|
+
@each $map in $maps {
|
|
36
|
+
$result: map.deep-merge($result, $map);
|
|
37
|
+
}
|
|
38
|
+
@return $result;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// Coerces the given value to a list, by converting any non-list value into a single-item list.
|
|
42
|
+
/// This should be used when dealing with user-passed lists of args to avoid confusing errors,
|
|
43
|
+
/// since Sass treats `($x)` as equivalent to `$x`.
|
|
44
|
+
/// @param {Any} $value The value to coerce to a list.
|
|
45
|
+
/// @return {List} The original $value if it was a list, otherwise a single-item list containing
|
|
46
|
+
/// $value.
|
|
47
|
+
@function coerce-to-list($value) {
|
|
48
|
+
@return if(meta.type-of($value) != 'list', ($value,), $value);
|
|
49
|
+
}
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
@use '../../popover/popover-theme';
|
|
10
10
|
@use '../../progress/progress-theme';
|
|
11
11
|
@use '../../select/select-theme';
|
|
12
|
-
@use '../../slider/slider-theme';
|
|
13
12
|
@use '../../split/split-theme';
|
|
14
13
|
@use '../../tooltip/tooltip-theme';
|
|
15
14
|
@use './theming';
|
|
@@ -28,7 +27,6 @@
|
|
|
28
27
|
@include popover-theme.theme($theme-or-color-config);
|
|
29
28
|
@include progress-theme.theme($theme-or-color-config);
|
|
30
29
|
@include select-theme.theme($theme-or-color-config);
|
|
31
|
-
@include slider-theme.theme($theme-or-color-config);
|
|
32
30
|
@include split-theme.theme($theme-or-color-config);
|
|
33
31
|
@include tooltip-theme.theme($theme-or-color-config);
|
|
34
32
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '@material/elevation/elevation-theme' as mdc-elevation-theme;
|
|
3
|
+
@use '@material/theme/custom-properties' as mdc-custom-properties;
|
|
4
|
+
@use '@material/theme/theme' as mdc-theme;
|
|
5
|
+
@use '@material/theme/keys' as mdc-keys;
|
|
6
|
+
@use '../theming/palette';
|
|
7
|
+
@use '../theming/theming';
|
|
8
|
+
@use '../typography/typography';
|
|
9
|
+
|
|
10
|
+
$_placeholder-color-palette: theming.define-palette(palette.$red-palette);
|
|
11
|
+
|
|
12
|
+
// Placeholder color config that can be passed to token getter functions when generating token
|
|
13
|
+
// slots.
|
|
14
|
+
$placeholder-color-config: (
|
|
15
|
+
primary: $_placeholder-color-palette,
|
|
16
|
+
accent: $_placeholder-color-palette,
|
|
17
|
+
warn: $_placeholder-color-palette,
|
|
18
|
+
is-dark: false,
|
|
19
|
+
foreground: palette.$light-theme-foreground-palette,
|
|
20
|
+
background: palette.$light-theme-background-palette,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
$_placeholder-typography-level-config: typography.typography-config-level-from-mdc(body1);
|
|
24
|
+
|
|
25
|
+
// Placeholder typography config that can be passed to token getter functions when generating token
|
|
26
|
+
// slots.
|
|
27
|
+
$placeholder-typography-config: (
|
|
28
|
+
font-family: 'Roboto, sans-serif',
|
|
29
|
+
headline-1: $_placeholder-typography-level-config,
|
|
30
|
+
headline-2: $_placeholder-typography-level-config,
|
|
31
|
+
headline-3: $_placeholder-typography-level-config,
|
|
32
|
+
headline-4: $_placeholder-typography-level-config,
|
|
33
|
+
headline-5: $_placeholder-typography-level-config,
|
|
34
|
+
headline-6: $_placeholder-typography-level-config,
|
|
35
|
+
subtitle-1: $_placeholder-typography-level-config,
|
|
36
|
+
subtitle-2: $_placeholder-typography-level-config,
|
|
37
|
+
body-1: $_placeholder-typography-level-config,
|
|
38
|
+
body-2: $_placeholder-typography-level-config,
|
|
39
|
+
caption: $_placeholder-typography-level-config,
|
|
40
|
+
button: $_placeholder-typography-level-config,
|
|
41
|
+
overline: $_placeholder-typography-level-config,
|
|
42
|
+
subheading-1: $_placeholder-typography-level-config,
|
|
43
|
+
title: $_placeholder-typography-level-config,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// Placeholder density config that can be passed to token getter functions when generating token
|
|
47
|
+
// slots.
|
|
48
|
+
$placeholder-density-config: 0;
|
|
49
|
+
|
|
50
|
+
$_tokens: null;
|
|
51
|
+
$_component-prefix: null;
|
|
52
|
+
|
|
53
|
+
@mixin _configure-token-prefix($first, $rest...) {
|
|
54
|
+
$_component-prefix: '' !global;
|
|
55
|
+
@each $item in $rest {
|
|
56
|
+
$_component-prefix:
|
|
57
|
+
if($_component-prefix == '', $item, '#{$_component-prefix}-#{$item}') !global;
|
|
58
|
+
}
|
|
59
|
+
@include mdc-custom-properties.configure($varname-prefix: $first) {
|
|
60
|
+
@content;
|
|
61
|
+
}
|
|
62
|
+
$_component-prefix: null !global;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Sets the token prefix and map to use when creating token slots.
|
|
66
|
+
@mixin use-tokens($prefix, $tokens) {
|
|
67
|
+
$_tokens: $tokens !global;
|
|
68
|
+
@include _configure-token-prefix($prefix...) {
|
|
69
|
+
@content;
|
|
70
|
+
}
|
|
71
|
+
$_tokens: null !global;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Emits a slot for the given token, provided that it has a non-null value in the token map passed
|
|
75
|
+
// to `use-tokens`.
|
|
76
|
+
@mixin create-token-slot($property, $token, $emit-fallback: false) {
|
|
77
|
+
@if $_component-prefix == null or $_tokens == null {
|
|
78
|
+
@error '`create-token-slot` must be used within `use-tokens`';
|
|
79
|
+
}
|
|
80
|
+
@if not map.has-key($_tokens, $token) {
|
|
81
|
+
@error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
|
|
82
|
+
}
|
|
83
|
+
@if map.get($_tokens, $token) != null {
|
|
84
|
+
$fallback: null;
|
|
85
|
+
|
|
86
|
+
@if ($emit-fallback == true) {
|
|
87
|
+
$fallback: map.get($_tokens, $token);
|
|
88
|
+
}
|
|
89
|
+
@else if ($emit-fallback) {
|
|
90
|
+
$fallback: $emit-fallback;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
$value: mdc-custom-properties.create('#{$_component-prefix}-#{$token}', $fallback: $fallback);
|
|
94
|
+
@include mdc-theme.property($property, $value);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Returns the name of a token including the current prefix. Intended to be used in calculations
|
|
99
|
+
// involving tokens. `create-token-slot` should be used when outputting tokens.
|
|
100
|
+
@function get-token-variable($token) {
|
|
101
|
+
@if $_component-prefix == null or $_tokens == null {
|
|
102
|
+
@error '`get-token-variable` must be used within `use-tokens`';
|
|
103
|
+
}
|
|
104
|
+
@if not map.has-key($_tokens, $token) {
|
|
105
|
+
@error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@return mdc-custom-properties.create-varname('#{$_component-prefix}-#{$token}');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@mixin create-token-values($prefix, $tokens) {
|
|
112
|
+
@include _configure-token-prefix($prefix...) {
|
|
113
|
+
@include mdc-keys.declare-custom-properties($tokens, $_component-prefix);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// MDC doesn't currently handle elevation tokens properly. As a temporary workaround we can combine
|
|
118
|
+
// the elevation and shadow-color tokens into a full box-shadow and use it as the value for the
|
|
119
|
+
// elevation token.
|
|
120
|
+
@function resolve-elevation($tokens, $elevation-token, $shadow-color-token) {
|
|
121
|
+
$elevation: map.get($tokens, $elevation-token);
|
|
122
|
+
$shadow-color: map.get($tokens, $shadow-color-token);
|
|
123
|
+
@return map.merge($tokens, (
|
|
124
|
+
$elevation-token: mdc-elevation-theme.elevation-box-shadow($elevation, $shadow-color),
|
|
125
|
+
$shadow-color-token: null,
|
|
126
|
+
));
|
|
127
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:meta';
|
|
3
|
+
@use '../../style/sass-utils';
|
|
4
|
+
|
|
5
|
+
/// Gets the tokens for the given theme, m2 tokens module, and theming system.
|
|
6
|
+
/// @param {Map} $theme The Angular Material theme object to generate token values from.
|
|
7
|
+
/// @param {String} $module The Sass module containing the token getter functions.
|
|
8
|
+
/// @param {String} $system The theming system to get tokens for. Valid values are: unthemable,
|
|
9
|
+
/// color, typography, density.
|
|
10
|
+
/// @return {Map} The token map by calling the token getter for the given system in the given module
|
|
11
|
+
/// with the given Angular Material theme. Token names are not fully-qualified.
|
|
12
|
+
@function _get-tokens-for-module-and-system($theme, $module, $system) {
|
|
13
|
+
@if $system == unthemable {
|
|
14
|
+
@return meta.call(
|
|
15
|
+
meta.get-function(get-#{$system}-tokens, $module: $module));
|
|
16
|
+
}
|
|
17
|
+
@if not map.get($theme, $system) {
|
|
18
|
+
@return ();
|
|
19
|
+
}
|
|
20
|
+
@return meta.call(
|
|
21
|
+
meta.get-function(get-#{$system}-tokens, $module: $module), map.get($theme, $system));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// Gets the fully qualified tokens map for the given theme and m2 tokens module.
|
|
25
|
+
/// @param {Map} $theme The Angular Material theme object to generate token values from.
|
|
26
|
+
/// @param {String} $module The Sass module containing the token getter functions.
|
|
27
|
+
/// @return {Map} The token map by calling the token getters in the given module with the given
|
|
28
|
+
/// Angular Material theme. Token names are fully-qualified.
|
|
29
|
+
@function _get-tokens-for-module($theme, $module) {
|
|
30
|
+
$tokens: sass-utils.deep-merge-all(
|
|
31
|
+
_get-tokens-for-module-and-system($theme, $module, unthemable),
|
|
32
|
+
_get-tokens-for-module-and-system($theme, $module, color),
|
|
33
|
+
_get-tokens-for-module-and-system($theme, $module, typography),
|
|
34
|
+
_get-tokens-for-module-and-system($theme, $module, density));
|
|
35
|
+
@return map.set((), map.get(meta.module-variables($module), prefix), $tokens);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// Gets the full set of M2 tokens for the given theme object.
|
|
39
|
+
/// @param {Map} $theme The Angular Material theme object to generate token values from.
|
|
40
|
+
/// @return {Map} The token map for the given Angular Material theme. Returned format:
|
|
41
|
+
/// (
|
|
42
|
+
/// (fully, qualified, namespace): (
|
|
43
|
+
/// token: value
|
|
44
|
+
/// )
|
|
45
|
+
/// )
|
|
46
|
+
@function m2-tokens-from-theme($theme) {
|
|
47
|
+
@return sass-utils.deep-merge-all(
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../../theming/theming';
|
|
3
|
+
@use '../../../typography/typography-utils';
|
|
4
|
+
@use '../../../mdc-helpers/mdc-helpers';
|
|
5
|
+
@use '../../../style/sass-utils';
|
|
6
|
+
@use '../../token-utils';
|
|
7
|
+
|
|
8
|
+
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
9
|
+
$prefix: (mdc, plain-tooltip);
|
|
10
|
+
|
|
11
|
+
// Tokens that can't be configured through Angular Material's current theming API,
|
|
12
|
+
// but may be in a future version of the theming API.
|
|
13
|
+
//
|
|
14
|
+
// Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
|
|
15
|
+
// `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
|
|
16
|
+
// our CSS.
|
|
17
|
+
@function get-unthemable-tokens() {
|
|
18
|
+
@return ( // Border radius for the tooltip container.
|
|
19
|
+
container-shape: 4px,
|
|
20
|
+
// Line height of the tooltip text.
|
|
21
|
+
supporting-text-line-height: 16px,
|
|
22
|
+
// MDC does not seem to use these token.
|
|
23
|
+
supporting-text-type: null,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Tokens that can be configured through Angular Material's color theming API.
|
|
28
|
+
@function get-color-tokens($config) {
|
|
29
|
+
$background: map.get($config, background);
|
|
30
|
+
|
|
31
|
+
@return ( // Color of the tooltip container.
|
|
32
|
+
container-color: theming.get-color-from-palette($background, tooltip),
|
|
33
|
+
// Color of the tooltip text.
|
|
34
|
+
supporting-text-color: #fff,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Tokens that can be configured through Angular Material's typography theming API.
|
|
39
|
+
@function get-typography-tokens($config) {
|
|
40
|
+
|
|
41
|
+
// TODO(amysorto): The earlier implementation of the tooltip used MDC's APIs to create the
|
|
42
|
+
// typography tokens. As a result, we unintentionally allowed `null` typography configs to be
|
|
43
|
+
// passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
|
|
44
|
+
// fallback.
|
|
45
|
+
@if ($config ==null) {
|
|
46
|
+
$config: mdc-helpers.private-fallback-typography-from-mdc();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@return ( // Font for the tooltip text.
|
|
50
|
+
supporting-text-font: typography-utils.font-family($config, caption) or typography-utils.font-family($config),
|
|
51
|
+
// Font size for the tooltip text.
|
|
52
|
+
supporting-text-size: typography-utils.font-size($config, caption),
|
|
53
|
+
// Font weight of the tooltip text.
|
|
54
|
+
supporting-text-weight: typography-utils.font-weight($config, caption),
|
|
55
|
+
// Tracking (space between letters) of the tooltip text.
|
|
56
|
+
supporting-text-tracking: typography-utils.letter-spacing($config, caption),
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Tokens that can be configured through Angular Material's density theming API.
|
|
61
|
+
@function get-density-tokens($config) {
|
|
62
|
+
@return ();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Combines the tokens generated by the above functions into a single map with placeholder values.
|
|
66
|
+
// This is used to create token slots.
|
|
67
|
+
@function get-token-slots() {
|
|
68
|
+
@return sass-utils.deep-merge-all(get-unthemable-tokens(),
|
|
69
|
+
get-color-tokens(token-utils.$placeholder-color-config),
|
|
70
|
+
get-typography-tokens(token-utils.$placeholder-typography-config),
|
|
71
|
+
get-density-tokens(token-utils.$placeholder-density-config));
|
|
72
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../token-utils';
|
|
3
|
+
@use '../../../theming/theming';
|
|
4
|
+
@use '../../../style/sass-utils';
|
|
5
|
+
@use '../../../theming/palette';
|
|
6
|
+
|
|
7
|
+
// The prefix used to generate the fully qualified name for tokens in this file.
|
|
8
|
+
$prefix: (mtx, alert);
|
|
9
|
+
|
|
10
|
+
// Tokens that can't be configured through Angular Material's current theming API,
|
|
11
|
+
// but may be in a future version of the theming API.
|
|
12
|
+
@function get-unthemable-tokens() {
|
|
13
|
+
@return ();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Tokens that can be configured through Angular Material's color theming API.
|
|
17
|
+
@function get-color-tokens($config) {
|
|
18
|
+
$foreground: map.get($config, foreground);
|
|
19
|
+
$background: map.get($config, background);
|
|
20
|
+
$is-dark-theme: map.get($config, is-dark);
|
|
21
|
+
|
|
22
|
+
@return (
|
|
23
|
+
background-color: theming.get-color-from-palette($background, dialog),
|
|
24
|
+
text-color: theming.get-color-from-palette($foreground, text),
|
|
25
|
+
info-background-color: theming.get-color-from-palette(palette.$blue-palette, if($is-dark-theme, 900, 500)),
|
|
26
|
+
info-text-color: white,
|
|
27
|
+
success-background-color: theming.get-color-from-palette(palette.$green-palette, if($is-dark-theme, 900, 500)),
|
|
28
|
+
success-text-color: white,
|
|
29
|
+
warning-background-color: theming.get-color-from-palette(palette.$orange-palette, if($is-dark-theme, 900, 500)),
|
|
30
|
+
warning-text-color: white,
|
|
31
|
+
danger-background-color: theming.get-color-from-palette(palette.$red-palette, if($is-dark-theme, 900, 500)),
|
|
32
|
+
danger-text-color: white,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Tokens that can be configured through Angular Material's typography theming API.
|
|
37
|
+
@function get-typography-tokens($config) {
|
|
38
|
+
@return ();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Tokens that can be configured through Angular Material's density theming API.
|
|
42
|
+
@function get-density-tokens($config) {
|
|
43
|
+
@return ();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Combines the tokens generated by the above functions into a single map with placeholder values.
|
|
47
|
+
// This is used to create token slots.
|
|
48
|
+
@function get-token-slots() {
|
|
49
|
+
@return sass-utils.deep-merge-all(
|
|
50
|
+
get-unthemable-tokens(),
|
|
51
|
+
get-color-tokens(token-utils.$placeholder-color-config),
|
|
52
|
+
get-typography-tokens(token-utils.$placeholder-typography-config),
|
|
53
|
+
get-density-tokens(token-utils.$placeholder-density-config)
|
|
54
|
+
);
|
|
55
|
+
}
|