// ============================================================================================= //
//                                            TYPEFACE                                           //
// ============================================================================================= //

@use "sass:map";
@use "../core/functions";
@use "../core/mixins";
@use "../core/variables";

$_custom-property-prefix: map.get(variables.$typeface, "prefix");
$_tokens: map.get(variables.$typeface, "tokens");

///
/// The "typeface.theme()" emit `--mg-typeface-*` custom properties for a user-provided theme's tokens.
///
/// @example - scss
///   @use "@magnesium/theme/typography/typeface";
///
///   .foo {
///     @include typeface.theme(
///       "brand": "Open Sans",
///       "plain": "Roboto"
///     );
///   }
///
/// @example - css
///   .foo {
///     --mg-typeface-brand: "Open Sans";
///     --mg-typeface-plain: "Roboto";
///   }
///
/// @param {Map} $tokens - The `typeface` tokens map.
///
@mixin theme($tokens) {
    $tokens: functions.validation($_tokens, $tokens, $_custom-property-prefix);

    @include mixins.emit-custom-props($tokens, $_custom-property-prefix);
}
