<commit_before>// --------------------------------------------------------------------------
// Typography
// --------------------------------------------------------------------------

// Font size
// --------------------------------------------------------------------------
// Calls `calc-font-size()` or `base-size()`

@function font-size(
	$font-size,
	$breakpoint-key,
	$text-sizes,
	$rem,
	$base
) {
	@if $base == true {
		@return base-size($font-size);
	} @else {
		@return calc-font-size($font-size, $breakpoint-key, $text-sizes, $rem);
	}
}

// Calculate font-size
// --------------------------------------------------------------------------
// Returns correct rem value depending on breakpoint

@function calc-font-size(
	$font-size,
	$breakpoint-key,
	$text-sizes,
	$rem
) {
	// Convert px and em into rem
	@if $rem {
		@if unit($font-size) == 'em' {
			@return strip-unit($font-size) * 1rem;
		}
		@else if unit($font-size) == 'px' {
			$basemap: map-get($text-sizes, $breakpoint-key);
			$basefont: if(type-of($basemap) == 'list', nth($basemap, 1), $basemap);

			@return $font-size / $basefont * 1rem;
		}
		@else {
			@return $font-size;
		}
	}

	// Converts rem and px into em
	@else {
		@if unit($font-size) == 'rem' {
			@return strip-unit($font-size) * 1em;
		}
		@else if unit($font-size) == 'px' {
			$basemap: map-get($text-sizes, $breakpoint-key);
			$basefont: if(type-of($basemap) == 'list', nth($basemap, 1), $basemap);

			@return convert-to-em($font-size, $basefont);
		}
		@else {
			@return $font-size;
		}
	}
}

// Fluid font size
// --------------------------------------------------------------------------
// Returns viewport unit based font-size calculation,
// e.g. `calc(93.75% + 8 * (100vw - 420px) / 1340);`

@function fluid-font-size($font-size, $breakpoint-key, $text-sizes, $rem, $base) {
	$min-bp-key: nth(nth($text-sizes, 2), 1);									// samllest breakpoint key (e.g. `small` key in $text-sizes);
	$max-bp-key: nth(nth($text-sizes, -1), 1);									// largest breakpoint key
	$min-font-size: nth((nth((nth($text-sizes, 1)), 2)), 1);					// smallest text size in pixels (e.g. `null` key in $text-sizes)
	$max-font-size: nth((nth((nth($text-sizes, -1)), 2)), 1);					// biggest text size in pixels (e.g. `null` key in $text-sizes)
	$min-bp-val: map-get($breakpoints, $min-bp-key);
	$max-bp-val: map-get($breakpoints, $max-bp-key);
	$min-base-val: font-size($font-size, $min-bp-key, $text-sizes, $rem, $base);
	$max-base-val: font-size($max-font-size, $max-bp-key, $text-sizes, $rem, $base);
	$min-vw-val: strip-unit($min-bp-val) * $min-font-size;
	$max-vw-val: strip-unit($max-bp-val) * $max-font-size;<commit_msg>Comment.<commit_after>// --------------------------------------------------------------------------
// Typography
// --------------------------------------------------------------------------

// Font size
// --------------------------------------------------------------------------
// Calls `calc-font-size()` or `base-size()`

@function font-size(
	$font-size,
	$breakpoint-key,
	$text-sizes,
	$rem,
	$base
) {
	@if $base == true {
		@return base-size($font-size);
	} @else {
		@return calc-font-size($font-size, $breakpoint-key, $text-sizes, $rem);
	}
}

// Calculate font-size
// --------------------------------------------------------------------------
// Returns correct rem value depending on breakpoint

@function calc-font-size(
	$font-size,
	$breakpoint-key,
	$text-sizes,
	$rem
) {
	// Convert px and em into rem
	@if $rem {
		@if unit($font-size) == 'em' {
			@return strip-unit($font-size) * 1rem;
		}
		@else if unit($font-size) == 'px' {
			$basemap: map-get($text-sizes, $breakpoint-key);
			$basefont: if(type-of($basemap) == 'list', nth($basemap, 1), $basemap);

			@return $font-size / $basefont * 1rem;
		}
		@else {
			@return $font-size;
		}
	}

	// Converts rem and px into em
	@else {
		@if unit($font-size) == 'rem' {
			@return strip-unit($font-size) * 1em;
		}
		@else if unit($font-size) == 'px' {
			$basemap: map-get($text-sizes, $breakpoint-key);
			$basefont: if(type-of($basemap) == 'list', nth($basemap, 1), $basemap);

			@return convert-to-em($font-size, $basefont);
		}
		@else {
			@return $font-size;
		}
	}
}

// Fluid font size
// --------------------------------------------------------------------------
// Returns viewport unit based font-size calculation,
// e.g. `calc(93.75% + 8 * (100vw - 420px) / 1340);`

@function fluid-font-size($font-size, $breakpoint-key, $text-sizes, $rem, $base) {
	$min-bp-key: nth(nth($text-sizes, 2), 1);									// samllest breakpoint key (e.g. `small` key in $text-sizes);
	$max-bp-key: nth(nth($text-sizes, -1), 1);									// largest breakpoint key
	$min-font-size: nth((nth((nth($text-sizes, 1)), 2)), 1);					// smallest text size in pixels (e.g. `null` key in $text-sizes)
	$max-font-size: nth((nth((nth($text-sizes, -1)), 2)), 1);					// biggest text size in pixels (e.g. largest breakpoint key in $text-sizes)
	$min-bp-val: map-get($breakpoints, $min-bp-key);
	$max-bp-val: map-get($breakpoints, $max-bp-key);
	$min-base-val: font-size($font-size, $min-bp-key, $text-sizes, $rem, $base);
	$max-base-val: font-size($max-font-size, $max-bp-key, $text-sizes, $rem, $base);
	$min-vw-val: strip-unit($min-bp-val) * $min-font-size;
	$max-vw-val: strip-unit($max-bp-val) * $max-font-size;
{'fraction_non_alphanumeric': 0.3289547757553012, 'fraction_numerical': 0.01125914805779696, 'mean_word_length': 1.9237520570488207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '820826', 'n_tokens_mistral': 2127, 'n_tokens_neox': 1961, 'n_words': 402}