@import '../core/density/private/compatibility';
@import '../core/theming/palette';
@import '../core/theming/theming';
@import '../core/typography/typography-utils';
@import  './tree-variables';

@mixin mat-tree-color($config-or-theme) {
  $config: mat-get-color-config($config-or-theme);
  $background: map-get($config, background);
  $foreground: map-get($config, foreground);

  .mat-tree {
    background: mat-color($background, 'card');
  }

  .mat-tree-node,
  .mat-nested-tree-node {
    color: mat-color($foreground, text);
  }
}

@mixin mat-tree-typography($config-or-theme) {
  $config: mat-get-typography-config($config-or-theme);
  .mat-tree {
    font-family: mat-font-family($config);
  }

  .mat-tree-node,
  .mat-nested-tree-node {
    font-weight: mat-font-weight($config, body-1);
    font-size: mat-font-size($config, body-1);
  }
}

@mixin mat-tree-density($config-or-theme) {
  $density-scale: mat-get-density-config($config-or-theme);
  $height: mat-private-density-prop-value($mat-tree-density-config, $density-scale, height);

  @include mat-private-density-legacy-compatibility() {
    .mat-tree-node {
      min-height: $height;
    }
  }
}

@mixin mat-tree-theme($theme-or-color-config) {
  $theme: mat-private-legacy-get-theme($theme-or-color-config);
  @include mat-private-check-duplicate-theme-styles($theme, 'mat-tree') {
    $color: mat-get-color-config($theme);
    $density: mat-get-density-config($theme);
    $typography: mat-get-typography-config($theme);

    @if $color != null {
      @include mat-tree-color($color);
    }
    @if $density != null {
      @include mat-tree-density($density);
    }
    @if $typography != null {
      @include mat-tree-typography($typography);
    }
  }
}

