@charset "UTF-8";

// @description
// * rotate mixin.
// * This mixin provides a convenient way to apply a general rotation
// * using the `transform` property with proper vendor prefixes.
// * It supports both angle values and predefined keywords such as
// * `inherit`, `initial`, `revert`, `unset`, and `none`.

// @access public

// @version 1.4.0

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @reference: https://developer.mozilla.org/en-US/docs/Web/CSS/transform

// @namespace transform

// @module transform/rotate

// @dependencies:
// * - meta.type-of (SASS function).
// * - math.unit (SASS function).
// * - var.$angle-units (variable).
// * - LibMixin.prefixing-all (mixin).
// * - Error.throw (function).

// @param {Number|String} $val
// * The rotation value.
// * Default: 0deg.
// * If a number, the angle unit must be one of: (deg, grad, rad, turn).
// * If a string, it can be: (inherit, initial, revert, unset, none).

// @example
// * .example {
// *   @include rotate(45deg);
// * }

// @output
// * .example {
// *   -webkit-transform: rotate(45deg);
// *   -moz-transform: rotate(45deg);
// *   -ms-transform: rotate(45deg);
// *   -o-transform: rotate(45deg);
// *   transform: rotate(45deg);
// * }

@use "sass:meta";
@use "sass:list";
@use "sass:math";
@use "../../abstract/global-variables" as var;
@use "../../mixins/vendor-prefixes/prefix" as LibMixin;
@use "../../development-utils/toggle-error-message" as Error;

@mixin rotate($val: 0deg) {
    $transform-props-values: (inherit, initial, revert, unset, none) !default;

    @if meta.type-of($val) == number {
        @if not list.index(var.$angle-units, math.unit($val)) {
            content: Error.throw("The parameter of rotate mixin must has one of these units: (#{var.$angle-units})");
        } @else {
            @include LibMixin.prefixing-all(transform, rotate($val));
        }
    } @else if meta.type-of($val) == string {
        @if not list.index($transform-props-values, $val) {
            content: Error.throw(
                "The parameter of rotate mixin must has one of these values: (#{$transform-props-values})"
            );
        } @else {
            @include LibMixin.prefixing-all(transform, rotate($val));
        }
    } @else {
        content: Error.throw("The value of rotate mixin must be in a number or a string type.");
    }
}
