@import "./theme/default";

$dt: map_get($theme-default, '');

@function plv($key) {
  @if (map_has_key($globalTheme, $key)) {
    @return map-get($globalTheme, $key);
  } @else {
    @return map-get($dt, $key);
  }
}

@mixin generateThemeContent($name,$theme) {
  $globalTheme: $theme !global;
  $globalThemeName: $name !global;

  $colorPrimary: plv(colorPrimary) !global;
  $colorPrimaryLight: mix(white, $colorPrimary, 85%) !global;
  $colorSuccess: plv(colorSuccess) !global;
  $colorWarn: plv(colorWarn) !global;
  $colorError: plv(colorError) !global;
  $colorInfo: plv(colorInfo) !global;
  $disabled: plv(disabled) !global;
  $disabledLight: plv(disabledLight) !global;
  $disabledDeep: plv(disabledDeep) !global;
  $disabledText: plv(disabledText) !global;
  $font: plv(font) !global;
  $ibc: plv(ibc) !global;
  $ibl: plv(ibl) !global;
  $itc: plv(itc) !global;
  $itl: plv(itl) !global;
  $ihc: plv(ihc) !global;
  $ipc: plv(ipc) !global;
  $icc: plv(icc) !global;
  $transitionFlexible: plv(transitionFlexible) !global;
  $transition: plv(transition) !global;
  $transition2: plv(transition2) !global;
  $shapeFillet: plv(shapeFillet) !global;
  $popperRadius: plv(popperRadius) !global;
  $boxshadow: plv(boxshadow) !global;
  $boxshadowColor: plv(boxshadowColor) !global;

  @if (str_length($name)>0) {
    .theme-#{$name} {
      @content;
    }
  } @else {
    html {
      @content;
    }
  }
}

@mixin statusMixin($component) {
  @each $key in (Primary, Success, Warn, Error, Info) {

    $value: plv(color#{$key}) !global;

    $name: to-lower-case($key) !global;
    &.ms-#{$component}-status-#{$name} {
      @content;
    }
  }
}

@mixin shapeMixin($component) {
  @each $key in (Fillet, Round, Square) {

    $value: plv(shape#{$key}) !global;
    $name: to-lower-case($key) !global;

    &.ms-#{$component}-shape-#{$name} {
      @content;
    }
  }
}

@mixin sizeMixin($component) {
  @each $key in (Large, Normal, Small, Mini) {

    $value: plv(size#{$key}) !global;
    $name: to-lower-case($key) !global;

    &.ms-#{$component}-size-#{$name} {
      @content;
    }
  }
}

@mixin public-style {
  box-sizing: border-box;
  font-weight: 400;
  color: $itc;
  margin: 0;
  padding: 0;
}

@mixin transition {
  transition: all $transition 300ms;
}
