// Calculate from-to breakpoints // ------------------------------------------------------------------------------- // @dependence `map-fetch()` // @dependence `get-value()` // ------------------------------------------------------------------------------- // @param $n ["from | "to"] : how to calculate breakpoint // @param $key [Value] : key of breakpoint // @param $i [Value] : index of current breakpoint // ------------------------------------------------------------------------------- // @return [Value] @function calc-breakpoint($n, $key, $i) { @if get-value(settings, grid) == "fluid" { @if $n == "from" { @if $i == (length(map-fetch($flint, config)) - 1) { @return 0; } @else { @return (get-value(next-index($i), breakpoint) + 1); } } @else if $n == "to" { @return get-value($key, breakpoint); } } @else if get-value(settings, grid) == "fixed" { @if $n == "from" { @if $i == (length(map-fetch($flint, config)) - 1) { @return 0; } @else { @return get-value($key, breakpoint); } } @else if $n == "to" { @if steal-key($i) != steal-key(1) { @return (get-value(steal-key(($i - 1)), breakpoint) - 1); } @else { @return (get-value(steal-key($i), breakpoint) - 1); } } } }