Skip to content

Commit

Permalink
chore (scss): replace all deprecated rules in latest dart sass changes
Browse files Browse the repository at this point in the history
  • Loading branch information
firestar300 committed Nov 5, 2024
1 parent 0f14042 commit e457c5f
Show file tree
Hide file tree
Showing 69 changed files with 501 additions and 337 deletions.
2 changes: 2 additions & 0 deletions src/scss/01-abstract/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@use "sass:map";
@use "sass:math";

$entry-file-name: "style";

/**
* Variables
*/
Expand Down
4 changes: 2 additions & 2 deletions src/scss/01-abstract/abstract.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import "./constants";
@import "./variables";
@use "constants";
@use "variables";
17 changes: 10 additions & 7 deletions src/scss/02-tools/_f-column.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use "sass:meta";
@use "../01-abstract/variables";

@use "sass:map";
@use "sass:math";

Expand Down Expand Up @@ -55,7 +58,7 @@

@if not $var {

@return map.get(map.get($column-preset, $device), $prop);
@return map.get(map.get(variables.$column-preset, $device), $prop);
} @else {

@return $var;
Expand All @@ -68,15 +71,15 @@

@function column($device, $nb-column: null, $nb-gutter: null, $total-column: null, $total-gutter: null) {
// shift vars if $device is number
@if type-of($device) == "number" {
@if meta.type-of($device) == "number" {
$total-gutter: $total-column;
$total-column: $nb-gutter;
$nb-gutter: $nb-column;
$nb-column: $device;
$device: d;
}

$preset: map.get($column-preset, $device);
$preset: map.get(variables.$column-preset, $device);
$gutter-width: map.get($preset, gutter-width);
$column-width: map.get($preset, column-width);
$total-column: column-set-var($total-column, $device, total-column);
Expand All @@ -98,13 +101,13 @@

@function column-px($device, $nb-column: null, $nb-gutter: null, $unitless: false) {
// shift vars if $device is number
@if type-of($device) == "number" {
@if meta.type-of($device) == "number" {
$nb-gutter: $nb-column;
$nb-column: $device;
$device: d;
}

$preset: map.get($column-preset, $device);
$preset: map.get(variables.$column-preset, $device);
$gutter-width: map.get($preset, gutter-width);
$column-width: map.get($preset, column-width);

Expand All @@ -125,13 +128,13 @@

@function column-full($device, $nb-column: null, $nb-gutter: null) {
// shift vars if $device is number
@if type-of($device) == "number" {
@if meta.type-of($device) == "number" {
$nb-gutter: $nb-column;
$nb-column: $device;
$device: d;
}

$preset: map.get($column-preset, $device);
$preset: map.get(variables.$column-preset, $device);
$gutter-width: map.get($preset, gutter-width);
$column-width: map.get($preset, column-width);
$total-column: map.get($preset, total-column);
Expand Down
6 changes: 4 additions & 2 deletions src/scss/02-tools/_f-context-align.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "../01-abstract/variables";

/**
* Align - Make a context align (editor / style)
*
Expand Down Expand Up @@ -27,13 +29,13 @@ $function-context-align-last-value: "";

@function context-align($value: null, $suffix: " > ") {
@if not $value {
@if ($entry-file-name == "style") {
@if (variables.$entry-file-name == "style") {
@return ".align" + $function-context-align-last-value;
}
} @else {
$function-context-align-last-value: $value !global;

@if ($entry-file-name == "editor") {
@if (variables.$entry-file-name == "editor") {
@return "[data-align=\"" + $value + "\"]" + $suffix;
}
}
Expand Down
11 changes: 7 additions & 4 deletions src/scss/02-tools/_f-context-selector.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use "sass:meta";
@use "../01-abstract/variables";

/**
* Context selector - Make a context selector (editor / style)
*
Expand Down Expand Up @@ -53,17 +56,17 @@
$full-selector: "";
$parent: "";

@if ($entry-file-name == "editor" and $editor) {
@if (variables.$entry-file-name == "editor" and $editor) {
$parent: $editor;
} @else if ($entry-file-name == "style" and $default) {
} @else if (variables.$entry-file-name == "style" and $default) {
$parent: $default;
} @else {
@return $selector;
}

@if (type-of($selector) == "string") {
@if (meta.type-of($selector) == "string") {
$full-selector: $parent + " " + $selector;
} @else if (type-of($selector) == "list") {
} @else if (meta.type-of($selector) == "list") {
@each $s in $selector {
$full-selector: $full-selector + $parent + " " + $s;
}
Expand Down
13 changes: 8 additions & 5 deletions src/scss/02-tools/_f-em.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use "../01-abstract/variables";
@use "f-strip-units";

@use "sass:math";

/**
Expand All @@ -20,14 +23,14 @@
*
*/

@function em($pxval, $base: $font-size-base) {
@function em($pxval, $base: variables.$font-size-base) {

@if not unitless($pxval) {
$pxval: strip-units($pxval);
@if not math.is-unitless($pxval) {
$pxval: f-strip-units.strip-units($pxval);
}

@if not unitless($base) {
$base: strip-units($base);
@if not math.is-unitless($base) {
$base: f-strip-units.strip-units($base);
}

@return math.div($pxval, $base) * 1em;
Expand Down
9 changes: 6 additions & 3 deletions src/scss/02-tools/_f-fluid-size.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use "../01-abstract/variables";
@use "f-strip-units";

/**
* Fluid size
*
Expand Down Expand Up @@ -25,8 +28,8 @@
@use "sass:math";

@function fluid-size($min, $max, $start: xs, $end: sm) {
$start: math.div(map.get($breakpoints, $start), 100);
$end: math.div(map.get($breakpoints, $end), 100);
$start: math.div(map.get(variables.$breakpoints, $start), 100);
$end: math.div(map.get(variables.$breakpoints, $end), 100);

@return clamp(#{$min}, #{$min} + (1vw - #{$start}px) / #{$end - $start} * #{strip-units($max - $min)}, #{$max});
@return clamp(#{$min}, #{$min} + (1vw - #{$start}px) / #{$end - $start} * #{f-strip-units.strip-units($max - $min)}, #{$max});
}
4 changes: 3 additions & 1 deletion src/scss/02-tools/_f-get-gutter-width.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "../01-abstract/variables";

@use "sass:map";

/**
Expand All @@ -24,7 +26,7 @@
*/

@function get-gutter($preset: d) {
@return map.get(map.get($column-preset, $preset), gutter-width);
@return map.get(map.get(variables.$column-preset, $preset), gutter-width);
}

@function get-gutter-width($preset: d) {
Expand Down
12 changes: 8 additions & 4 deletions src/scss/02-tools/_f-get-svg-url.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@use "sass:color";
@use "sass:list";
@use "../01-abstract/variables";

@use "sass:map";

/**
Expand Down Expand Up @@ -30,7 +34,7 @@
*
*/

@function get-svg-url($name: null, $fill: $color-dark, $opacity: 1, $style: "") {
@function get-svg-url($name: null, $fill: variables.$color-dark, $opacity: 1, $style: "") {

$svgs: (
// name-of-the-svg: (viewBox, content of the svg element)
Expand All @@ -40,7 +44,7 @@
"close": ("0 0 20 20", "3Cpath d='M5.442 5.442 5 5.883l2.058 2.059L9.116 10l-2.058 2.058L5 14.117l.442.441.441.442 2.059-2.058L10 10.884l2.058 2.058L14.117 15l.441-.442.442-.441-2.058-2.059L10.884 10l2.058-2.058L15 5.883l-.442-.441L14.117 5l-2.059 2.058L10 9.116 7.942 7.058 5.883 5l-.441.442'/%3E"),
);

@if not map-has-key($svgs, $name) {
@if not map.has-key($svgs, $name) {
@return "";
}

Expand All @@ -49,8 +53,8 @@
}

@if ($fill != "") {
$fill: " fill='rgba(#{red($fill), green($fill), blue($fill), $opacity})'";
$fill: " fill='rgba(#{color.channel($fill, 'red'), color.channel($fill, 'green'), color.channel($fill, 'blue'), $opacity})'";
}

@return url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg'" + $fill + $style + " viewBox='" + nth(map.get($svgs, $name), 1) + "'%3E%" + nth(map.get($svgs, $name), 2) + "%3C/svg%3E"); /* stylelint-disable-line */
@return url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg'" + $fill + $style + " viewBox='" + list.nth(map.get($svgs, $name), 1) + "'%3E%" + list.nth(map.get($svgs, $name), 2) + "%3C/svg%3E"); /* stylelint-disable-line */
}
7 changes: 5 additions & 2 deletions src/scss/02-tools/_m-bg-fullwidth.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use "../01-abstract/variables";
@use "m-style-only";

/**
* Background fullwidth - Make a fullwidth background in a container element
*
Expand All @@ -13,7 +16,7 @@
*
*/

@mixin bg-fullwidth($color: $color-grey-100) {
@mixin bg-fullwidth($color: variables.$color-grey-100) {
position: relative;

&::before {
Expand All @@ -27,7 +30,7 @@
background-color: $color;
transform: translate3d(-50%, 0, 0);

@include style-only {
@include m-style-only.style-only {
z-index: -1;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/scss/02-tools/_m-block-vertical-spacing.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "f-context-selector";

/**
* Block vertical spacing
*/
Expand All @@ -22,7 +24,7 @@
*
*/
@mixin block-vertical-spacing($type : margin, $spacing : var(--spacing--block-3)) {
#{context-selector(".blocks-container > &", ".is-root-container &")} {
#{f-context-selector.context-selector(".blocks-container > &", ".is-root-container &")} {
#{$type}-top: $spacing;
#{$type}-bottom: $spacing;

Expand Down
12 changes: 8 additions & 4 deletions src/scss/02-tools/_m-breakpoint.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@use "sass:meta";
@use "../01-abstract/variables";
@use "f-em";

@use "sass:map";

/**
Expand All @@ -24,19 +28,19 @@
@mixin breakpoints($breakpoint, $min-or-max-or-breakpoint: min) {
$font-size: 16px; // don't use em function whitout param, $font-size-base can be modified

@if (type-of(map.get($breakpoints, $min-or-max-or-breakpoint)) == "number") {
@if (meta.type-of(map.get(variables.$breakpoints, $min-or-max-or-breakpoint)) == "number") {

@media screen and (min-width: em(map.get($breakpoints, $breakpoint), $font-size)) and (max-width: em(map.get($breakpoints, $min-or-max-or-breakpoint) - 1, $font-size)) {
@media screen and (min-width: f-em.em(map.get(variables.$breakpoints, $breakpoint), $font-size)) and (max-width: f-em.em(map.get(variables.$breakpoints, $min-or-max-or-breakpoint) - 1, $font-size)) {
@content;
}
} @else if ($min-or-max-or-breakpoint == max) {

@media screen and (max-width: em(map.get($breakpoints, $breakpoint) - 1, $font-size)) {
@media screen and (max-width: f-em.em(map.get(variables.$breakpoints, $breakpoint) - 1, $font-size)) {
@content;
}
} @else {

@media screen and (min-width: em(map.get($breakpoints, $breakpoint), $font-size)) {
@media screen and (min-width: f-em.em(map.get(variables.$breakpoints, $breakpoint), $font-size)) {
@content;
}
}
Expand Down
17 changes: 10 additions & 7 deletions src/scss/02-tools/_m-btn.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@use "../01-abstract/variables";
@use "m-hover";

/**
* Button - All mixins for buttons - Used in src/scss/05-components/_btn.scss
*
Expand Down Expand Up @@ -31,21 +34,21 @@
font-size: 12px;
font-weight: 700;
line-height: 16px;
color: $color-dark;
color: variables.$color-dark;
text-align: center;
background-color: $color-primary;
background-color: variables.$color-primary;
border-radius: 10px;

@include hover {
@include m-hover.hover {
@include btn-block-hover;
}
}

// hover of the button block

@mixin btn-block-hover {
color: $color-primary;
background-color: $color-dark;
color: variables.$color-primary;
background-color: variables.$color-dark;
}

// Coloring
Expand All @@ -54,7 +57,7 @@
color: $color;
background-color: $background-color;

@include hover {
@include m-hover.hover {
color: $background-color;
background-color: $color;
}
Expand All @@ -67,7 +70,7 @@
background-color: transparent;
border: 2px solid currentColor; // Force button width VS Gutenberg CSS

@include hover {
@include m-hover.hover {
@include btn-block-outline-hover;
}
}
Expand Down
14 changes: 9 additions & 5 deletions src/scss/02-tools/_m-checkbox-custom.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@use "../01-abstract/variables";
@use "m-rtl";
@use "m-sr-only";

@use "sass:math";

/**
Expand All @@ -21,8 +25,8 @@
*
*/

@mixin checkbox-custom($color: $color-primary, $size: 18px, $border-width: 1px) {
@include sr-only;
@mixin checkbox-custom($color: variables.$color-primary, $size: 18px, $border-width: 1px) {
@include m-sr-only.sr-only;

+ label {
position: relative;
Expand All @@ -38,10 +42,10 @@
height: $size;
margin: 0;
content: "";
background-color: $color-light;
background-color: variables.$color-light;
border: $border-width solid $color;

@include rtl {
@include m-rtl.rtl {
right: 0;
left: auto;
}
Expand All @@ -61,7 +65,7 @@
transition: opacity .2s;
transform: translate(-50%, -50%) rotate(-45deg);

@include rtl {
@include m-rtl.rtl {
right: math.round(math.div($size, 2));
left: auto;
transform: translate(50%, -50%) rotate(-45deg);
Expand Down
Loading

0 comments on commit e457c5f

Please sign in to comment.