Skip to content

Commit 02a4b41

Browse files
committed
refactor: replace map-get() to map.get(), map-has-keys() with map.has-keys(), map-keys() with map.keys(), and map-merge() with map.merge()
1 parent 33847ab commit 02a4b41

22 files changed

+93
-71
lines changed

scss/_alert.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "variables" as *;
23
@use "mixins/border-radius" as *;
34
@use "mixins/ltr-rtl" as *;
@@ -61,7 +62,7 @@
6162

6263
// scss-docs-start alert-modifiers
6364
// Generate contextual modifier classes for colorizing the alert.
64-
@each $state in map-keys($theme-colors) {
65+
@each $state in map.keys($theme-colors) {
6566
.alert-#{$state} {
6667
--#{$prefix}alert-color: var(--#{$prefix}#{$state}-text-emphasis);
6768
--#{$prefix}alert-bg: var(--#{$prefix}#{$state}-bg-subtle);

scss/_avatar.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "variables" as *;
23
@use "mixins/border-radius" as *;
34
@use "mixins/ltr-rtl" as *;
@@ -45,11 +46,11 @@
4546

4647
@each $size, $map in $avatar-sizes {
4748
.avatar-#{$size} {
48-
--#{$prefix}avatar-width: #{map-get($map, "width")};
49-
--#{$prefix}avatar-height: #{map-get($map, "height")};
50-
--#{$prefix}avatar-font-size: #{map-get($map, "font-size")};
51-
--#{$prefix}avatar-status-width: #{map-get($map, "status-width")};
52-
--#{$prefix}avatar-status-height: #{map-get($map, "status-height")};
49+
--#{$prefix}avatar-width: #{map.get($map, "width")};
50+
--#{$prefix}avatar-height: #{map.get($map, "height")};
51+
--#{$prefix}avatar-font-size: #{map.get($map, "font-size")};
52+
--#{$prefix}avatar-status-width: #{map.get($map, "status-width")};
53+
--#{$prefix}avatar-status-height: #{map.get($map, "status-height")};
5354
}
5455
}
5556

scss/_dropdown.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "variables" as *;
23
@use "mixins/border-radius" as *;
34
@use "mixins/box-shadow" as *;
@@ -94,7 +95,7 @@
9495
// We deliberately hardcode the `cui-` prefix because we check
9596
// this custom property in JS to determine Popper's positioning
9697

97-
@each $breakpoint in map-keys($grid-breakpoints) {
98+
@each $breakpoint in map.keys($grid-breakpoints) {
9899
@include media-breakpoint-up($breakpoint) {
99100
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
100101

scss/_list-group.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "variables" as *;
23
@use "mixins/border-radius" as *;
34
@use "mixins/breakpoints" as *;
@@ -124,7 +125,7 @@
124125
//
125126
// Change the layout of list group items from vertical (default) to horizontal.
126127

127-
@each $breakpoint in map-keys($grid-breakpoints) {
128+
@each $breakpoint in map.keys($grid-breakpoints) {
128129
@include media-breakpoint-up($breakpoint) {
129130
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
130131

@@ -185,7 +186,7 @@
185186
// Add modifier classes to change text and background color on individual items.
186187
// Organizationally, this must come after the `:hover` states.
187188

188-
@each $state in map-keys($theme-colors) {
189+
@each $state in map.keys($theme-colors) {
189190
.list-group-item-#{$state} {
190191
--#{$prefix}list-group-color: var(--#{$prefix}#{$state}-text-emphasis);
191192
--#{$prefix}list-group-bg: var(--#{$prefix}#{$state}-bg-subtle);

scss/_maps.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "variables" as *;
23
@use "variables-dark" as *;
34
@use "functions/color" as *;
@@ -110,7 +111,7 @@ $utilities-colors: $theme-colors-rgb !default;
110111
// scss-docs-end utilities-colors
111112

112113
// scss-docs-start utilities-text-colors
113-
$utilities-text: map-merge(
114+
$utilities-text: map.merge(
114115
$utilities-colors,
115116
(
116117
"black": to-rgb($black),
@@ -133,7 +134,7 @@ $utilities-text-emphasis-colors: (
133134
// scss-docs-end utilities-text-colors
134135

135136
// scss-docs-start utilities-bg-colors
136-
$utilities-bg: map-merge(
137+
$utilities-bg: map.merge(
137138
$utilities-colors,
138139
(
139140
"black": to-rgb($black),
@@ -156,7 +157,7 @@ $utilities-bg-subtle: (
156157
// scss-docs-end utilities-bg-colors
157158

158159
// scss-docs-start utilities-border-colors
159-
$utilities-border: map-merge(
160+
$utilities-border: map.merge(
160161
$utilities-colors,
161162
(
162163
"black": to-rgb($black),

scss/_modal.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// stylelint-disable function-disallowed-list
2+
@use "sass:map";
23
@use "variables" as *;
34
@use "mixins/backdrop" as *;
45
@use "mixins/border-radius" as *;
@@ -212,7 +213,7 @@
212213
}
213214

214215
// scss-docs-start modal-fullscreen-loop
215-
@each $breakpoint in map-keys($grid-breakpoints) {
216+
@each $breakpoint in map.keys($grid-breakpoints) {
216217
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
217218
$postfix: if($infix != "", $infix + "-down", "");
218219

scss/_navbar.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "variables" as *;
23
@use "functions/escape-svg" as *;
34
@use "mixins/border-radius" as *;
@@ -202,7 +203,7 @@
202203
// Generate series of `.navbar-expand-*` responsive classes for configuring
203204
// where your navbar collapses.
204205
.navbar-expand {
205-
@each $breakpoint in map-keys($grid-breakpoints) {
206+
@each $breakpoint in map.keys($grid-breakpoints) {
206207
$next: breakpoint-next($breakpoint, $grid-breakpoints);
207208
$infix: breakpoint-infix($next, $grid-breakpoints);
208209

scss/_offcanvas.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// stylelint-disable function-disallowed-list
2+
@use "sass:map";
23
@use "variables" as *;
34
@use "mixins/backdrop" as *;
45
@use "mixins/box-shadow" as *;
@@ -23,7 +24,7 @@
2324
// scss-docs-end offcanvas-css-vars
2425
}
2526

26-
@each $breakpoint in map-keys($grid-breakpoints) {
27+
@each $breakpoint in map.keys($grid-breakpoints) {
2728
$next: breakpoint-next($breakpoint, $grid-breakpoints);
2829
$infix: breakpoint-infix($next, $grid-breakpoints);
2930

@@ -32,7 +33,7 @@
3233
}
3334
}
3435

35-
@each $breakpoint in map-keys($grid-breakpoints) {
36+
@each $breakpoint in map.keys($grid-breakpoints) {
3637
$next: breakpoint-next($breakpoint, $grid-breakpoints);
3738
$infix: breakpoint-infix($next, $grid-breakpoints);
3839

scss/_tables.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "variables" as *;
23
@use "mixins/breakpoints" as *;
34
@use "mixins/table-variants" as *;
@@ -163,7 +164,7 @@
163164
// Generate series of `.table-responsive-*` classes for configuring the screen
164165
// size of where your table will overflow.
165166

166-
@each $breakpoint in map-keys($grid-breakpoints) {
167+
@each $breakpoint in map.keys($grid-breakpoints) {
167168
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
168169

169170
@include media-breakpoint-down($breakpoint) {

scss/_utilities.scss

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "variables" as *;
23
@use "maps" as *;
34
@use "functions/maps" as *;
@@ -6,7 +7,7 @@
67

78
$utilities: () !default;
89
// stylelint-disable-next-line scss/dollar-variable-default
9-
$utilities: map-merge(
10+
$utilities: map.merge(
1011
(
1112
// scss-docs-start utils-vertical-align
1213
"align": (
@@ -184,26 +185,26 @@ $utilities: map-merge(
184185
"border-top-color": (
185186
property: border-top-color,
186187
class: border-top,
187-
values: map-merge($theme-colors, ("white": $white)),
188+
values: map.merge($theme-colors, ("white": $white)),
188189
vars: true
189190
),
190191
"border-end-color": (
191192
property: border-right-color,
192193
class: border-end,
193-
values: map-merge($theme-colors, ("white": $white)),
194+
values: map.merge($theme-colors, ("white": $white)),
194195
vars: true,
195196
rtl: true
196197
),
197198
"border-bottom-color": (
198199
property: border-bottom-color,
199200
class: border-bottom,
200-
values: map-merge($theme-colors, ("white": $white)),
201+
values: map.merge($theme-colors, ("white": $white)),
201202
vars: true
202203
),
203204
"border-start-color": (
204205
property: border-left-color,
205206
class: border-start,
206-
values: map-merge($theme-colors, ("white": $white)),
207+
values: map.merge($theme-colors, ("white": $white)),
207208
vars: true,
208209
rtl: true
209210
),
@@ -411,44 +412,44 @@ $utilities: map-merge(
411412
responsive: true,
412413
property: margin,
413414
class: m,
414-
values: map-merge($spacers, (auto: auto))
415+
values: map.merge($spacers, (auto: auto))
415416
),
416417
"margin-x": (
417418
responsive: true,
418419
property: margin-right margin-left,
419420
class: mx,
420-
values: map-merge($spacers, (auto: auto))
421+
values: map.merge($spacers, (auto: auto))
421422
),
422423
"margin-y": (
423424
responsive: true,
424425
property: margin-top margin-bottom,
425426
class: my,
426-
values: map-merge($spacers, (auto: auto))
427+
values: map.merge($spacers, (auto: auto))
427428
),
428429
"margin-top": (
429430
responsive: true,
430431
property: margin-top,
431432
class: mt,
432-
values: map-merge($spacers, (auto: auto))
433+
values: map.merge($spacers, (auto: auto))
433434
),
434435
"margin-end": (
435436
responsive: true,
436437
property: margin-right,
437438
class: me,
438-
values: map-merge($spacers, (auto: auto)),
439+
values: map.merge($spacers, (auto: auto)),
439440
rtl: true
440441
),
441442
"margin-bottom": (
442443
responsive: true,
443444
property: margin-bottom,
444445
class: mb,
445-
values: map-merge($spacers, (auto: auto))
446+
values: map.merge($spacers, (auto: auto))
446447
),
447448
"margin-start": (
448449
responsive: true,
449450
property: margin-left,
450451
class: ms,
451-
values: map-merge($spacers, (auto: auto)),
452+
values: map.merge($spacers, (auto: auto)),
452453
rtl: true
453454
),
454455
// Negative margin utilities
@@ -645,7 +646,7 @@ $utilities: map-merge(
645646
local-vars: (
646647
"text-opacity": 1
647648
),
648-
values: map-merge(
649+
values: map.merge(
649650
$utilities-text-colors,
650651
(
651652
"muted": var(--#{$prefix}secondary-color), // deprecated
@@ -709,7 +710,7 @@ $utilities: map-merge(
709710
local-vars: (
710711
"link-underline-opacity": 1
711712
),
712-
values: map-merge(
713+
values: map.merge(
713714
$utilities-links-underline,
714715
(
715716
null: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-underline-opacity, 1)),
@@ -738,7 +739,7 @@ $utilities: map-merge(
738739
local-vars: (
739740
"bg-opacity": 1
740741
),
741-
values: map-merge(
742+
values: map.merge(
742743
$utilities-bg-colors,
743744
(
744745
"transparent": transparent,

scss/forms/_form-check.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "../variables" as *;
23
@use "../variables-dark" as *;
34
@use "../functions/escape-svg" as *;
@@ -169,8 +170,8 @@
169170
}
170171

171172
@each $size, $map in $form-switch-widths {
172-
$width: map-get($map, "width");
173-
$height: map-get($map, "height");
173+
$width: map.get($map, "width");
174+
$height: map.get($map, "height");
174175

175176
.form-switch-#{$size} {
176177
min-height: $height;

scss/forms/_input-group.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "sass:string";
23
@use "../variables" as *;
34
@use "../mixins/border-radius" as *;
@@ -122,7 +123,7 @@
122123
}
123124

124125
$validation-messages: "";
125-
@each $state in map-keys($form-validation-states) {
126+
@each $state in map.keys($form-validation-states) {
126127
$validation-messages: $validation-messages + ":not(." + string.unquote($state) + "-tooltip)" + ":not(." + string.unquote($state) + "-feedback)";
127128
}
128129

scss/functions/_color-contrast.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use "sass:color";
2+
@use "sass:map";
23
@use "sass:math";
34
@use "../variables" as *;
45
@use "math" as *;
@@ -45,10 +46,10 @@
4546

4647
@each $name, $value in $rgb {
4748
$value: if(divide($value, 255) < .04045, divide(divide($value, 255), 12.92), math.pow(divide((divide(math.round($value) + 1, 255) + .055), 1.055), 2.4));
48-
$rgb: map-merge($rgb, ($name: $value));
49+
$rgb: map.merge($rgb, ($name: $value));
4950
}
5051

51-
@return (map-get($rgb, "r") * .2126) + (map-get($rgb, "g") * .7152) + (map-get($rgb, "b") * .0722);
52+
@return (map.get($rgb, "r") * .2126) + (map.get($rgb, "g") * .7152) + (map.get($rgb, "b") * .0722);
5253
}
5354

5455
// Return opaque color

scss/functions/_maps.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:map";
12
@use "../variables" as *;
23
@use "color" as *;
34

@@ -12,7 +13,7 @@
1213
$_args: append($_args, if($arg == "$prefix", $prefix, if($arg == "$key", $key, if($arg == "$value", $value, $arg))));
1314
}
1415

15-
$_map: map-merge($_map, ($key: call(get-function($func), $_args...)));
16+
$_map: map.merge($_map, ($key: call(get-function($func), $_args...)));
1617
}
1718
@return $_map;
1819
}
@@ -24,7 +25,7 @@
2425
$result: ();
2526
@each $key, $value in $map {
2627
@if $key != 0 {
27-
$result: map-merge($result, ("n" + $key: (-$value)));
28+
$result: map.merge($result, ("n" + $key: (-$value)));
2829
}
2930
}
3031
@return $result;
@@ -35,7 +36,7 @@
3536
$result: ();
3637
@each $key, $value in $map {
3738
@if (index($values, $key) != null) {
38-
$result: map-merge($result, ($key: $value));
39+
$result: map.merge($result, ($key: $value));
3940
}
4041
}
4142
@return $result;
@@ -46,7 +47,7 @@
4647
$merged-maps: ();
4748

4849
@each $map in $maps {
49-
$merged-maps: map-merge($merged-maps, $map);
50+
$merged-maps: map.merge($merged-maps, $map);
5051
}
5152
@return $merged-maps;
5253
}

0 commit comments

Comments
 (0)