// Returns truthiness of a value // ------------------------------------------------------------------------------- // @param $value [literal] : value // ------------------------------------------------------------------------------- // @return [bool] @function is-true($value) { @return if($value == null, false, $value and $value != null and $value != "" and $value != ()); } // Checks if item is map //-------------------------------------------------------------------------------- // @param $n [map] : value // ------------------------------------------------------------------------------- // @return [bool] @function is-map($n) { @return type-of($n) == "map"; } // Checks if item is list //-------------------------------------------------------------------------------- // @param $n [list] : value // ------------------------------------------------------------------------------- // @return [bool] @function is-list($n) { @return type-of($n) == "list"; } // Checks if item is number //-------------------------------------------------------------------------------- // @param $n [number] : value // ------------------------------------------------------------------------------- // @return [bool] @function is-number($n) { @return type-of($n) == "number"; } // Checks if item is string //-------------------------------------------------------------------------------- // @param $n [string] : value // ------------------------------------------------------------------------------- // @return [bool] @function is-string($n) { @return type-of($n) == "string"; } // Checks if item is not string //-------------------------------------------------------------------------------- // @param $n [string] : value // ------------------------------------------------------------------------------- // @return [bool] @function is-not-string($n) { @return type-of($n) != "string"; } // Gets list of each breakpoint's key // ------------------------------------------------------------------------------- // @return [list] @function get-all-keys() { $all-keys: (); @for $i from 1 through (length(map-fetch($flint, "config")) - 1) { $key: steal-key($i); $all-keys: append($all-keys, $key, "comma"); } @return $all-keys; } // Gets list of all breakpoints // ------------------------------------------------------------------------------- // @return [list] @function get-all-breakpoints() { $all-breakpoints: (); @each $map, $keys in map-get($flint, "config") { @each $key, $value in $keys { @if $key == "breakpoint" { $all-breakpoints: append($all-breakpoints, $value, "comma"); } } } @return $all-breakpoints; } // Checks if passed $key is the highest breakpoint // ------------------------------------------------------------------------------- // @dependence `get-value()` // ------------------------------------------------------------------------------- // @param $key [string] : alias of breakpoint // ------------------------------------------------------------------------------- // @return [bool] @function is-highest-breakpoint($key) { @if get-value($key, "breakpoint") == max(get-all-breakpoints()...) { @return true; } @else { @return false; } } // Checks if passed $key is the lowest breakpoint // ------------------------------------------------------------------------------- // @dependence `get-value()` // ------------------------------------------------------------------------------- // @param $key [string] : alias of breakpoint // ------------------------------------------------------------------------------- // @return [bool] @function is-lowest-breakpoint($key) { @if get-value($key, "breakpoint") == min(get-all-breakpoints()...) { @return true; } @else { @return false; } } // Checks if $key is grid default // ------------------------------------------------------------------------------- // @dependence `get-value()` // ------------------------------------------------------------------------------- // @param $key [string] : alias of breakpoint // ------------------------------------------------------------------------------- // @return [bool] @function is-default($key) { @if $key == get-value("settings", "default") { @return true; } @else { @return false; } } // Gets all breakpoint column values // ------------------------------------------------------------------------------- // @return [list] @function get-all-columns() { $all-columns: (); @each $map, $keys in map-get($flint, "config") { @each $key, $value in $keys { @if $key == "columns" { $all-columns: append($all-columns, $value, "comma"); } } } @return $all-columns; } // Returns the unit used in config // ------------------------------------------------------------------------------- // @return [literal] @function get-config-unit() { @return unit(get-value("settings", "gutter")); } // Convert pixel value to em // ------------------------------------------------------------------------------- // @param $target [number] : pixel value // @param $context [number] : context to divide by // ------------------------------------------------------------------------------- // @return : em value of $target relative to $context // ------------------------------------------------------------------------------- @function em($target, $context: $flint__base-font-size) { @return ($target / $context) * 1em; }