@charset "UTF-8";

// @description
// * laptop-general mixin.
// * The laptop-general mixin is designed to simplify the creation of media
// * queries targeting laptop device with 1200px × 1600px.
// * It allows you to specify the orientation type (portrait or landscape)
// * and includes common device-specific media query conditions.

// @access public

// @version 1.5.1

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @reference: https://developer.mozilla.org/en-US/docs/Web/CSS/@media

// @namespace laptops

// @module laptops/laptop-general

// @dependencies:
// * - meta.type-of (SASS function).
// * - list.index (SASS function).
// * - LibFunc1.is-in-list (function).
// * - LibFunc2.merge (function).
// * - Error.throw (function).

// @param {String} $retina-value
// * If you want to apply mixin with retina screen or not.
// * It can be (retina, non-retina, yes, no, y, n).

// @example
// * .example {
// *   @include laptop-general(yes) {
    // *     content: "example";
// *   }
// * }

// @output
// * @media screen and (min-device-width: 1200px)
// * and (max-device-width: 1600px)
// * and (-webkit-min-device-pixel-ratio: 2)
// * and (min-resolution: 192dpi) {
    // *   .example {
        // *     content: "example";
        // *   }
// * }

// @note 1
// * This mixin implements media query for screens for
// * laptop as general device. But for simplicity we wrote
// * the name of the mixin with lap-gen.

// @note 2
// * There are two mixins in this file.
// * The first is the (laptop-general) mixin and second is (lap-gen) mixin.
// * The second one is for only simplicity when using (laptop-general) mixin.
// * The core logic of (lap-gen) mixin is to call the first one.
// * You can use one of them as you want.

// stylelint-disable media-feature-name-no-vendor-prefix
// stylelint-disable scss/operator-no-newline-after
// stylelint-disable media-query-no-invalid

@use "sass:meta";
@use "sass:list";
@use "../../../../functions/global/is-in-list" as LibFunc1;
@use "../../../../functions/list/merge" as LibFunc2;
@use "../../../../development-utils/toggle-error-message" as Error;

@mixin laptop-general($retina-value) {
    @if meta.type-of($retina-value) != string {
        content: Error.throw("The parameter of laptop-general mixin must be in a string type.");
    }

    $accepted-retina-values: (retina, yes, y) !default;
    $unaccepted-retina-values: (non-retina, no, non, n) !default;
    $all-retina-values: LibFunc2.merge($accepted-retina-values, $unaccepted-retina-values) !default;
    $min-device-width: 1200px !default;
    $max-device-width: 1600px !default;
    $min-resolution: 192dpi !default;

    @if LibFunc1.is-in-list($all-retina-values, $retina-value) {
        @if list.index($accepted-retina-values, $retina-value) {
            @media screen and (min-device-width: $min-device-width)
                and (max-device-width: $max-device-width)
                and (-webkit-min-device-pixel-ratio: 2)
                and (min-resolution: $min-resolution) {
                @content;
            }
        } @else if list.index($unaccepted-retina-values, $retina-value) {
            @media screen and (min-device-width: $min-device-width)
                and (max-device-width: $max-device-width)
                and (-webkit-min-device-pixel-ratio: 1) {
                @content;
            }
        } @else {
            content: Error.throw(
                "The parameter of laptop-general mixin must be one value of (#{$all-retina-values})."
            );
        }
    } @else {
        content: Error.throw("The parameter of laptop-general mixin must be one of: (#{$all-retina-values}).");
    }
}

@mixin lap-gen($retina-value) {
    @include laptop-general($retina-value) {
        @content;
    }
}
