////
/// (c) hidoo | MIT License
/// @group font features
////

@use "sass:list";
@use "sass:meta";
@use "../../function";
@use "../../../settings";

/// apply font-family settings
/// @param {List|String} $value [null] - setting for `font-family` (one of `"default"`, `"monospace"` or `(...)`)
/// @param {Boolean} $important [false] - set `!important` or not
///
/// @deprecated
///
/// @example scss - scss inputs
///   .selector {
///     @include mixin.font-apply-family($value: "default", $important: true);
///   }
///
/// @example css - css outputs
///   .selector {
///     font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic Medium", "游ゴシック Medium", YuGothic, Meiryo, "メイリオ", sans-serif !important;
///   }
///
@mixin apply-family($value: null, $important: false) {
  @warn "[DEPRECATED] mixin.font-apply-family is deprecated. Use --#{settings.$pkg}-font-family-* custom properties.";

  @if function.meta-is-empty($value) {
    @error "@mixin mixin.font-apply-family: Argument $value must not be empty.";
  }

  $type: meta.type-of($value);

  @if $type != "list" and $type != "string" {
    @error "@mixin mixin.font-apply-family: Argument $value must be list or string.";
  }

  @if $value == "default" {
    @if function.meta-is-empty(settings.$font-family) {
      @error "@mixin mixin.font-apply-family: settings.$font-family is not valid.";
    }

    font-family: settings.$font-family if($important, !important, null);
  } @else if $value == "monospace" {
    @if function.meta-is-empty(settings.$font-family-monospace) {
      @error "@mixin mixin.font-apply-family: settings.$font-family-monospace is not valid.";
    }

    font-family: settings.$font-family-monospace
      if($important, !important, null);
  } @else {
    font-family: $value if($important, !important, null);
  }
}
