@charset "UTF-8";

// @description
// * col-gap mixin.
// * This mixin provides a convenient way to set the col-gap to a value
// * using the specified vendor prefixes for better
// * cross-browser compatibility.

// @access public

// @version 1.1.0

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @reference: https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap

// @namespace grid

// @module grid/col-gap

// @dependencies:
// * - meta.type-of (SASS function).
// * - math.is-unitless (SASS function).
// * - LibFunc.is-in-list (function).
// * - Error.throw (function).

// @param {Number|String} $value
// * The value of column-gap property.
// * If a string, it can be: (normal, initial, inherit).

// @example
// * .example {
// *   @include col-gap(12rem);
// * }

// @output:
// * .example {
// *   -webkit-column-gap: 12rem;
// *   -moz-column-gap: 12rem;
// *   column-gap: 12rem;
// * }

@use "sass:meta";
@use "sass:math";
@use "../../functions/global/is-in-list" as LibFunc;
@use "../../development-utils/toggle-error-message" as Error;

@mixin col-gap($value) {
    $column-gap-prefixes-values: (-webkit-column-gap, -moz-column-gap, column-gap) !default;

    @if meta.type-of($value) == string {
        $column-gap-property-values: (normal, initial, inherit) !default;

        @if LibFunc.is-in-list($column-gap-property-values, $value) {
            @each $one-item in $column-gap-prefixes-values {
                #{$one-item}: #{$value};
            }
        } @else {
            content: Error.throw(
                "The type parameter of col-gap mixin must be one of these values: (#{$column-gap-property-values})."
            );
        }
    } @else if meta.type-of($value) == number {
        @if not math.is-unitless($value) {
            @each $one-item in $column-gap-prefixes-values {
                #{$one-item}: #{$value};
            }
        } @else {
            content: Error.throw("The parameters of col-gap mixin must be has a unit.");
        }
    } @else {
        content: Error.throw("The parameters of col-gap mixin must be in a number or string type.");
    }
}
