// ============================================================================================= //
//                                           TYPESCALE                                           //
// ============================================================================================= //

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

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

///
/// The "typescale.theme()" emit `--mg-typescale-*` custom properties for a user-provided theme's tokens.
///
/// @example - scss
///   @use "@magnesium/theme/typography/typescale";
///
///   .foo {
///     @include typescale.theme(
///       "body-size": 16px,
///       "body-weight": 400
///     );
///   }
///
/// @example - css
///   .foo {
///     --md-typescale-body-size: 16px;
///     --md-typescale-body-weight: 400;
///   }
///
/// @param {Map} $tokens - The `typescale` tokens map.
///
@mixin theme($tokens) {
    $tokens: functions.validation($_tokens, $tokens, $_custom-property-prefix);

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