@charset "UTF-8";

// @description
// * align-self mixin.
// * This mixin provides a convenient way to set the `align-self` property
// * with vendor prefixes for better cross-browser compatibility.

// @access public

// @version 1.3.1

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @reference: https://developer.mozilla.org/en-US/docs/Web/CSS/align-self

// @namespace main-props

// @module main-props/align-self

// @dependencies:
// * - meta.type-of (SASS function).
// * - LibFunc.is-in-list (function).
// * - Error.throw (function).

// @param {String} $val
// * The value for the `align-self` property.
// * Allowed values: auto, normal, stretch, start, end, self-start,
// * self-end, center, flex-start, flex-end, baseline, inherit.
// * Default: auto.

// @throws {Error}
// * Throws an error if the provided $val is not one of the
// * allowed values.

// @example
// * .example {
// *   @include align-self(center);
// * }

// @output:
// * .example {
// *   -webkit-align-self: center;
// *   -ms-grid-row-align: center;
// *   -ms-align-self: center;
// *   -moz-align-self: center;
// *   -o-align-self: center;
// *   align-self: center;
// * }

// @note
// * There are two mixins in this file.
// * The first is the (align-self) mixin and second is (a-s) mixin.
// * The second one is for only simplicity when using (align-self) mixin.
// * The core logic of (a-s) mixin is to call the first one.
// * You can use one of them as you want.

@use "sass:meta";
@use "../../../functions/global/is-in-list" as LibFunc;
@use "../../../development-utils/toggle-error-message" as Error;

@mixin align-self($value: auto) {
    $align-self-props: (
        -webkit-align-self,
        -ms-grid-row-align,
        -ms-align-self,
        -moz-align-self,
        -o-align-self,
        align-self
    ) !default;

    // stylelint-disable-next-line scss/dollar-variable-empty-line-before
    $align-self-values: (
        auto,
        normal,
        stretch,
        start,
        end,
        self-start,
        self-end,
        center,
        flex-start,
        flex-end,
        baseline,
        inherit
    ) !default;

    @if meta.type-of($value) != string {
        content: Error.throw("The parameter of align-self mixin must be in type string.");
    }

    @if LibFunc.is-in-list($align-self-values, $value) {
        @each $prop in $align-self-props {
            #{$prop}: $value;
        }
    } @else {
        content: Error.throw("The parameter of align-self mixin must be one of: (#{$align-self-values}).");
    }
}

@mixin a-s($value: auto) {
    @include align-self($value);
}
