@charset "UTF-8";

// @description
// * all-but mixin.
// * This mixin provides a convenient way to select the
// * all children but one of elements in the current context.

// @access public

// @version 1.0.0

// @author Lucas Bonomi
// @link: https://github.com/LukyVj/family.scss

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @namespace children

// @module children/all-but

// @dependencies:
// * - meta.type-of (SASS function).
// * - LibFunc.cut-unit (function).
// * - Error.throw (function).

// @update
// * We updated the mixin with validations.

// @param {Number} $num
// * The element you expect of range you want to select.

// @throw {Exception}
// * Throws exceptions if the provided all-but parameter is not a number.

// @example
// * .example {
// *   .child {
// *     @include all-but(4) {
// *        background-color: #212121;
// *        color: #ffffff;
// *     };
// *   }
// * }

// @output
// * .example .child:not(:nth-child(4)) {
// *   background-color: #212121;
// *   color: #ffffff;
// * }

@use "sass:meta";
@use "sass:math";
@use "../../functions/global/cut-unit" as LibFunc;
@use "../../development-utils/toggle-error-message" as Error;

@mixin all-but($num) {
    @if meta.type-of($num) != number {
        content: Error.throw("The parameter of all-but mixin must be in a number type.");
    }

    $num-without-unit: LibFunc.cut-unit($num);

    &:not(:nth-child(#{$num-without-unit})) {
        @content;
    }
}
