1 | @use 'sass:map';
|
---|
2 | @use '../core/density/private/compatibility';
|
---|
3 | @use '../core/theming/theming';
|
---|
4 | @use '../core/typography/typography';
|
---|
5 | @use '../core/typography/typography-utils';
|
---|
6 | @use './tree-variables';
|
---|
7 |
|
---|
8 | @mixin color($config-or-theme) {
|
---|
9 | $config: theming.get-color-config($config-or-theme);
|
---|
10 | $background: map.get($config, background);
|
---|
11 | $foreground: map.get($config, foreground);
|
---|
12 |
|
---|
13 | .mat-tree {
|
---|
14 | background: theming.get-color-from-palette($background, 'card');
|
---|
15 | }
|
---|
16 |
|
---|
17 | .mat-tree-node,
|
---|
18 | .mat-nested-tree-node {
|
---|
19 | color: theming.get-color-from-palette($foreground, text);
|
---|
20 | }
|
---|
21 | }
|
---|
22 |
|
---|
23 | @mixin typography($config-or-theme) {
|
---|
24 | $config: typography.private-typography-to-2014-config(
|
---|
25 | theming.get-typography-config($config-or-theme));
|
---|
26 | .mat-tree {
|
---|
27 | font-family: typography-utils.font-family($config);
|
---|
28 | }
|
---|
29 |
|
---|
30 | .mat-tree-node,
|
---|
31 | .mat-nested-tree-node {
|
---|
32 | font-weight: typography-utils.font-weight($config, body-1);
|
---|
33 | font-size: typography-utils.font-size($config, body-1);
|
---|
34 | }
|
---|
35 | }
|
---|
36 |
|
---|
37 | @mixin density($config-or-theme) {
|
---|
38 | $density-scale: theming.get-density-config($config-or-theme);
|
---|
39 | $height: compatibility.private-density-prop-value(tree-variables.$density-config,
|
---|
40 | $density-scale, height);
|
---|
41 |
|
---|
42 | @include compatibility.private-density-legacy-compatibility() {
|
---|
43 | .mat-tree-node {
|
---|
44 | min-height: $height;
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | @mixin theme($theme-or-color-config) {
|
---|
50 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
51 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-tree') {
|
---|
52 | $color: theming.get-color-config($theme);
|
---|
53 | $density: theming.get-density-config($theme);
|
---|
54 | $typography: theming.get-typography-config($theme);
|
---|
55 |
|
---|
56 | @if $color != null {
|
---|
57 | @include color($color);
|
---|
58 | }
|
---|
59 | @if $density != null {
|
---|
60 | @include density($density);
|
---|
61 | }
|
---|
62 | @if $typography != null {
|
---|
63 | @include typography($typography);
|
---|
64 | }
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|