@charset "UTF-8";

// @description
// * flex-grow mixin.
// * This mixin provides a convenient way to set the `flex-grow` property
// * with vendor prefixes for better cross-browser compatibility.

// @access public

// @version 1.2.1

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @reference: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow

// @namespace main-props

// @module main-props/flex-grow

// @dependencies:
// * - meta.type-of (SASS function).
// * - var.$flex-grow-props (variable).
// * - var.$flex-grow-values (variable).
// * - LibFunc.is-in-list (function).
// * - Error.throw (function).
// * - LibFunc.cut-unit (function).

// @param {Number} $val
// * The value for the `flex-grow` property.
// * Must be a non-negative number.
// * Default: 0.

// @throws {Error}
// * Throws an error if the provided $val is not a number
// * or if it's a negative number.

// @example
// * .example {
// *   @include flex-grow(2);
// * }

// @output:
// * .example {
// *   -webkit-flex-grow: 2;
// *   -webkit-box-flex: 2;
// *   -ms-flex-positive: 2;
// *   -moz-box-flex: 2;
// *   flex-grow: 2;
// * }

// @note
// * There are two mixins in this file.
// * The first is the (flex-grow) mixin and second is (f-g) mixin.
// * The second one is for only simplicity when using (flex-grow) mixin.
// * The core logic of (f-g) mixin is to call the first one.
// * You can use one of them as you want.

@use "sass:meta";
@use "../../../abstract/global-variables" as var;
@use "../../../functions/global" as LibFunc;
@use "../../../development-utils/toggle-error-message" as Error;

@mixin flex-grow($value: 0 or "") {
    @if meta.type-of($value) == string {
        @if meta.type-of($value) == string {
            @if LibFunc.is-in-list(var.$flex-grow-values, $value) {
                @each $prop in var.$flex-grow-props {
                    #{$prop}: $value;
                }
            } @else {
                content: Error.throw("The parameter of flex-grow mixin must be one of: (#{var.$flex-grow-values}).");
            }
        }
    }

    @if meta.type-of($value) == number {
        @if $value < 0 {
            content: Error.throw("The parameter of flex-grow mixin must be greater than or equal to zero.");
        } @else {
            @each $prop in var.$flex-grow-props {
                #{$prop}: $value;
            }
        }
    }
}

@mixin f-g($value: 0 or "") {
    @include flex-grow($value);
}
