1 | @use 'sass:map';
|
---|
2 | @use 'sass:math';
|
---|
3 | @use 'sass:meta';
|
---|
4 | @use 'sass:list';
|
---|
5 | @use './elevation';
|
---|
6 |
|
---|
7 | @mixin private-theme-elevation($zValue, $config, $opacity: elevation.$opacity) {
|
---|
8 | $foreground: map.get($config, foreground);
|
---|
9 | $elevation-color: map.get($foreground, elevation);
|
---|
10 | $elevation-color-or-default: if($elevation-color == null, elevation.$color, $elevation-color);
|
---|
11 |
|
---|
12 | @include elevation.elevation($zValue, $elevation-color-or-default, $opacity);
|
---|
13 | }
|
---|
14 |
|
---|
15 | @mixin private-theme-overridable-elevation($zValue, $config, $opacity: elevation.$opacity) {
|
---|
16 | $foreground: map.get($config, foreground);
|
---|
17 | $elevation-color: map.get($foreground, elevation);
|
---|
18 | $elevation-color-or-default: if($elevation-color == null, elevation.$color, $elevation-color);
|
---|
19 |
|
---|
20 | @include elevation.overridable-elevation($zValue, $elevation-color-or-default, $opacity);
|
---|
21 | }
|
---|
22 |
|
---|
23 | // If the mat-animation-noop class is present on the components root element,
|
---|
24 | // prevent non css animations from running.
|
---|
25 | // NOTE: Currently this mixin should only be used with components that do not
|
---|
26 | // have any projected content.
|
---|
27 | @mixin private-animation-noop() {
|
---|
28 | // @at-root is used to steps outside of the hierarchy of the scss rules. This is
|
---|
29 | // done to allow a class to be added to be added to base of the scss nesting
|
---|
30 | // context.
|
---|
31 | // For example:
|
---|
32 | // .my-root {
|
---|
33 | // .my-subclass {
|
---|
34 | // @include mat-private-animation-noop();
|
---|
35 | // }
|
---|
36 | // }
|
---|
37 | // results in:
|
---|
38 | // ._mat-animation-noopable.my-root .my-subclass { ... }
|
---|
39 | @at-root ._mat-animation-noopable#{&} {
|
---|
40 | transition: none;
|
---|
41 | animation: none;
|
---|
42 | @content;
|
---|
43 | }
|
---|
44 | }
|
---|
45 |
|
---|
46 | // Private polyfill for the `math.div` function from Sass to be used until we can update the
|
---|
47 | // minimum required Sass version to 1.34.0 or above.
|
---|
48 | // TODO(crisbeto): replace with `math.div` eventually.
|
---|
49 | @function private-div($a, $b) {
|
---|
50 | @if (meta.function-exists('div', 'math')) {
|
---|
51 | @return math.div($a, $b);
|
---|
52 | }
|
---|
53 | @else {
|
---|
54 | @return $a / $b;
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | // Private polyfill for the `list.slash` function from Sass to be used until we can update the
|
---|
59 | // minimum required Sass version to 1.34.0 or above.
|
---|
60 | // TODO(crisbeto): replace with `list.slash` eventually.
|
---|
61 | @function private-slash($a, $b) {
|
---|
62 | @if (meta.function-exists('slash', 'list')) {
|
---|
63 | @return list.slash($a, $b);
|
---|
64 | }
|
---|
65 | @else {
|
---|
66 | @return #{$a}#{' / '}#{$b};
|
---|
67 | }
|
---|
68 | }
|
---|