Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit b3e2cc5

Browse files
enatariojclusso
andauthored
Ran the SASS migration tool on division so deprecation warnings stop being thrown. (#1107) (#1110)
Co-authored-by: Jarrett Lusso <[email protected]>
1 parent 10b4973 commit b3e2cc5

File tree

6 files changed

+27
-17
lines changed

6 files changed

+27
-17
lines changed

Diff for: core/bourbon/library/_modular-scale.scss

+7-5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
///
6868
/// @require {function} _fetch-bourbon-setting
6969

70+
@use "sass:math";
71+
7072
@function modular-scale(
7173
$increment,
7274
$value: _fetch-bourbon-setting("modular-scale-base"),
@@ -78,7 +80,7 @@
7880

7981
// scale $v2 to just above $v1
8082
@while $v2 > $v1 {
81-
$v2: ($v2 / $ratio); // will be off-by-1
83+
$v2: math.div($v2, $ratio); // will be off-by-1
8284
}
8385
@while $v2 < $v1 {
8486
$v2: ($v2 * $ratio); // will fix off-by-1
@@ -102,15 +104,15 @@
102104
@if $increment < 0 {
103105
// adjust $v2 to just below $v1
104106
@if $double-stranded {
105-
$v2: ($v2 / $ratio);
107+
$v2: math.div($v2, $ratio);
106108
}
107109

108110
@for $i from $increment through -1 {
109-
@if $double-stranded and ($v1 / $ratio) < $v2 {
111+
@if $double-stranded and math.div($v1, $ratio) < $v2 {
110112
$value: $v2;
111-
$v2: ($v2 / $ratio);
113+
$v2: math.div($v2, $ratio);
112114
} @else {
113-
$v1: ($v1 / $ratio);
115+
$v1: math.div($v1, $ratio);
114116
$value: $v1;
115117
}
116118
}

Diff for: core/bourbon/library/_strip-unit.scss

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
/// // Output
1313
/// $dimension: 10;
1414

15+
@use "sass:math";
16+
1517
@function strip-unit($value) {
16-
@return ($value / ($value * 0 + 1));
18+
@return math.div($value, $value * 0 + 1);
1719
}

Diff for: core/bourbon/library/_triangle.scss

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,25 @@
5555

5656
@if $direction == "up" {
5757
border-color: transparent transparent $color;
58-
border-width: 0 ($width / 2) $height;
58+
border-width: 0 ($width * 0.5) $height;
5959
} @else if $direction == "up-right" {
6060
border-color: transparent $color transparent transparent;
6161
border-width: 0 $width $width 0;
6262
} @else if $direction == "right" {
6363
border-color: transparent transparent transparent $color;
64-
border-width: ($height / 2) 0 ($height / 2) $width;
64+
border-width: ($height * 0.5) 0 ($height * 0.5) $width;
6565
} @else if $direction == "down-right" {
6666
border-color: transparent transparent $color;
6767
border-width: 0 0 $width $width;
6868
} @else if $direction == "down" {
6969
border-color: $color transparent transparent;
70-
border-width: $height ($width / 2) 0;
70+
border-width: $height ($width * 0.5) 0;
7171
} @else if $direction == "down-left" {
7272
border-color: transparent transparent transparent $color;
7373
border-width: $width 0 0 $width;
7474
} @else if $direction == "left" {
7575
border-color: transparent $color transparent transparent;
76-
border-width: ($height / 2) $width ($height / 2) 0;
76+
border-width: ($height * 0.5) $width ($height * 0.5) 0;
7777
} @else if $direction == "up-left" {
7878
border-color: $color transparent transparent;
7979
border-width: $width $width 0 0;

Diff for: core/bourbon/utilities/_contrast-ratio.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
///
2020
/// @access private
2121

22+
@use "sass:math";
23+
2224
@function _contrast-ratio($color-1, $color-2) {
2325
$-local-lightness-1: _lightness($color-1) + 0.05;
2426
$-local-lightness-2: _lightness($color-2) + 0.05;
2527

2628
@if $-local-lightness-1 > $-local-lightness-2 {
27-
@return $-local-lightness-1 / $-local-lightness-2;
29+
@return math.div($-local-lightness-1, $-local-lightness-2);
2830
} @else {
29-
@return $-local-lightness-2 / $-local-lightness-1;
31+
@return math.div($-local-lightness-2, $-local-lightness-1);
3032
}
3133
}

Diff for: core/bourbon/utilities/_gamma.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
///
1111
/// @access private
1212

13+
@use "sass:math";
14+
1315
@function _gamma($channel) {
1416
@if $channel < 0.03928 {
15-
@return $channel / 12.92;
17+
@return math.div($channel, 12.92);
1618
} @else {
17-
$c: ($channel + 0.055) / 1.055;
19+
$c: math.div($channel + 0.055, 1.055);
1820
@if function-exists("pow") {
1921
@return pow($c, 2.4);
2022
} @else {

Diff for: core/bourbon/utilities/_lightness.scss

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
///
1212
/// @access private
1313

14+
@use "sass:math";
15+
1416
@function _lightness($hex-color) {
1517
$-local-red-raw: red(rgba($hex-color, 1));
1618
$-local-green-raw: green(rgba($hex-color, 1));
1719
$-local-blue-raw: blue(rgba($hex-color, 1));
1820

19-
$-local-red: _gamma($-local-red-raw / 255);
20-
$-local-green: _gamma($-local-green-raw / 255);
21-
$-local-blue: _gamma($-local-blue-raw / 255);
21+
$-local-red: _gamma(math.div($-local-red-raw, 255));
22+
$-local-green: _gamma(math.div($-local-green-raw, 255));
23+
$-local-blue: _gamma(math.div($-local-blue-raw, 255));
2224

2325
@return $-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722;
2426
}

0 commit comments

Comments
 (0)