From f0f84513f8efe533b6ee670a6f1a0c074387b2ec Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 13 Aug 2025 12:01:46 +0200 Subject: Make use of SASS modules --- src/_harmony.scss | 65 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 32 deletions(-) (limited to 'src/_harmony.scss') diff --git a/src/_harmony.scss b/src/_harmony.scss index aaab726..c0cb772 100644 --- a/src/_harmony.scss +++ b/src/_harmony.scss @@ -8,7 +8,10 @@ /// @access public //// +@use 'sass:list'; +@use 'sass:map'; @use 'sass:math'; +@use 'sass:meta'; @use './functions'; @use './responsive'; @@ -26,35 +29,35 @@ /// @return {number} /// @function modular-scale($times, $base, $ratio) { - @if type-of($base) == number { - @return $base * math.pow($ratio, $times); - } + @if meta.type-of($base) == number { + @return $base * math.pow($ratio, $times); + } - $main-base: nth($base, 1); - $norm-bases: (); + $main-base: list.nth($base, 1); + $norm-bases: (); - @each $b in functions.list-slice($base, 2) { - @if $b > $main-base { - @while $b > $main-base { - $b: math.div($b, $ratio); - } - $b: $b * $ratio; - } @else if $b < $main-base { - @while $b < $main-base { - $b: $b * $ratio; - } - } + @each $b in functions.list-slice($base, 2) { + @if $b > $main-base { + @while $b > $main-base { + $b: math.div($b, $ratio); + } + $b: $b * $ratio; + } @else if $b < $main-base { + @while $b < $main-base { + $b: $b * $ratio; + } + } - $norm-bases: append($norm-bases, $b); - } + $norm-bases: list.append($norm-bases, $b); + } - $all-bases: append($norm-bases, $main-base); - $all-bases: functions.quicksort($all-bases); + $all-bases: list.append($norm-bases, $main-base); + $all-bases: functions.quicksort($all-bases); - $base-index: $times % length($all-bases) + 1; - $exp: math.floor(math.div($times, length($all-bases))); + $base-index: $times % list.length($all-bases) + 1; + $exp: math.floor(math.div($times, list.length($all-bases))); - @return nth($all-bases, $base-index) * math.pow($ratio, $exp); + @return list.nth($all-bases, $base-index) * math.pow($ratio, $exp); } /// @@ -86,15 +89,13 @@ /// } /// @mixin responsive-modular-scale($props, $times, $responsive-map, $fluid: true) { - $new-map: (); + $new-map: (); - @each $key, $value in $responsive-map { - $new-map: map-merge( - $new-map, ( - $key: modular-scale($times, $value...) - ) - ); - } + @each $key, $value in $responsive-map { + $new-map: map.merge($new-map, ( + $key: modular-scale($times, $value...) + )); + } - @include responsive.property($props, $new-map, $fluid); + @include responsive.property($props, $new-map, $fluid); } -- cgit v1.2.3-70-g09d2