From 4ec6225a9273b8f0c93e4b3d93ecf1e1686b719c Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 4 Feb 2022 20:28:18 +0100 Subject: Fix errors from transition from node-sass to sass --- src/_gradients.scss | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/_gradients.scss') diff --git a/src/_gradients.scss b/src/_gradients.scss index 7c52d63..657efa2 100644 --- a/src/_gradients.scss +++ b/src/_gradients.scss @@ -15,6 +15,9 @@ /// @access public //// +@use 'sass:math'; +@use 'sass:meta'; + /// /// Number of intermediate color stops generated to achieve easing. /// A higher value results in better quality, but also much more generated code. @@ -340,7 +343,7 @@ $iro-easing-gradient-steps: 10 !default; $distance: $next-stop-pos - $prev-stop-pos; @for $i from 1 through $iro-easing-gradient-steps { - $perc: $i / $iro-easing-gradient-steps; + $perc: math.div($i, $iro-easing-gradient-steps); $color: null; $pos: $prev-stop-pos + $perc * $distance; @@ -359,20 +362,20 @@ $iro-easing-gradient-steps: 10 !default; @if type-of($prev-stop-pos) != number { // must be calc() - @if (type-of($prev-stop-pos) != string) or (str-index($prev-stop-pos, 'calc(') != 1) { + @if type-of($prev-stop-pos) != calculation { @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; } - $prev-stop-pos: str-slice($prev-stop-pos, 6, str-length($prev-stop-pos) - 1); + $prev-stop-pos: meta.calc-args($prev-stop-pos); } @if type-of($next-stop-pos) != number { // must be calc() - @if (type-of($next-stop-pos) != string) or (str-index($next-stop-pos, 'calc(') != 1) { + @if type-of($next-stop-pos) != calculation { @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; } - $next-stop-pos: str-slice($next-stop-pos, 6, str-length($next-stop-pos) - 1); + $next-stop-pos: meta.calc-args($next-stop-pos); } @for $i from 1 through $iro-easing-gradient-steps { @@ -454,20 +457,20 @@ $iro-easing-gradient-steps: 10 !default; @if type-of($prev-stop-pos) != number { // must be calc() - @if (type-of($prev-stop-pos) != string) or (str-index($prev-stop-pos, 'calc(') != 1) { + @if type-of($prev-stop-pos) != calculation { @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; } - $prev-stop-pos: str-slice($prev-stop-pos, 6, str-length($prev-stop-pos) - 1); + $prev-stop-pos: meta.calc-args($prev-stop-pos); } @if type-of($next-stop-pos) != number { // must be calc() - @if (type-of($next-stop-pos) != string) or (str-index($next-stop-pos, 'calc(') != 1) { + @if type-of($next-stop-pos) != calculation { @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; } - $next-stop-pos: str-slice($next-stop-pos, 6, str-length($next-stop-pos) - 1); + $next-stop-pos: meta.calc-args($next-stop-pos); } @for $i from 1 through $steps { @@ -550,20 +553,20 @@ $iro-easing-gradient-steps: 10 !default; @if type-of($prev-stop-pos) != number { // must be calc() - @if (type-of($prev-stop-pos) != string) or (str-index($prev-stop-pos, 'calc(') != 1) { + @if type-of($prev-stop-pos) != calculation { @error 'Invalid color stop position: #{inspect($prev-stop-pos)}'; } - $prev-stop-pos: str-slice($prev-stop-pos, 6, str-length($prev-stop-pos) - 1); + $prev-stop-pos: meta.calc-args($prev-stop-pos); } @if type-of($next-stop-pos) != number { // must be calc() - @if (type-of($next-stop-pos) != string) or (str-index($next-stop-pos, 'calc(') != 1) { + @if type-of($next-stop-pos) != calculation { @error 'Invalid color stop position: #{inspect($next-stop-pos)}'; } - $next-stop-pos: str-slice($next-stop-pos, 6, str-length($next-stop-pos) - 1); + $next-stop-pos: meta.calc-args($next-stop-pos); } @for $i from 1 through length($stops) { -- cgit v1.3.1