1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-21 17:34:25 +04:00

Migrate SASS to module API (#2477)

This commit is contained in:
Paweł Kuna
2025-09-12 17:48:31 +02:00
committed by GitHub
parent 212d560a87
commit 736e60408b
21 changed files with 392 additions and 45 deletions

View File

@@ -0,0 +1,5 @@
---
"@tabler/core": patch
---
Updated deprecated global functions (`map-merge`, `str-slice`, `percentage`, etc.) with their module-based equivalents (`map.merge`, `string.slice`, `math.percentage`, etc.).

View File

@@ -1,5 +1,4 @@
// Config // Config
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables"; @import "bootstrap/scss/variables";
@import "bootstrap/scss/variables-dark"; @import "bootstrap/scss/variables-dark";
@import "bootstrap/scss/maps"; @import "bootstrap/scss/maps";

View File

@@ -1,3 +1,5 @@
@use "sass:color";
@mixin caret($direction: down) { @mixin caret($direction: down) {
$selector: "after"; $selector: "after";
@@ -74,5 +76,5 @@
// TODO: remove when https://github.com/twbs/bootstrap/pull/37425/ will be released // TODO: remove when https://github.com/twbs/bootstrap/pull/37425/ will be released
// //
@function opaque($background, $foreground) { @function opaque($background, $foreground) {
@return mix(rgba($foreground, 1), $background, opacity($foreground) * 100%); @return color.mix(rgba($foreground, 1), $background, color.alpha($foreground) * 100%);
} }

View File

@@ -1,4 +1,4 @@
@import "bootstrap/scss/functions";
@import "mixins"; @import "mixins";
@import "variables"; @import "variables";

View File

@@ -1,3 +1,4 @@
@use "sass:map";
@import "config"; @import "config";
:root, :root,
@@ -30,7 +31,7 @@
--#{$prefix}brand: #{$primary}; --#{$prefix}brand: #{$primary};
/** Theme colors */ /** Theme colors */
@each $name, $color in map-merge($theme-colors, $social-colors) { @each $name, $color in map.merge($theme-colors, $social-colors) {
--#{$prefix}#{$name}: #{$color}; --#{$prefix}#{$name}: #{$color};
--#{$prefix}#{$name}-rgb: #{to-rgb($color)}; --#{$prefix}#{$name}-rgb: #{to-rgb($color)};
--#{$prefix}#{$name}-fg: #{if(contrast-ratio($color) > $min-contrast-ratio, var(--#{$prefix}light), var(--#{$prefix}dark))}; --#{$prefix}#{$name}-fg: #{if(contrast-ratio($color) > $min-contrast-ratio, var(--#{$prefix}light), var(--#{$prefix}dark))};

View File

@@ -1,6 +1,8 @@
@use "sass:map";
$negative-spacers-extra: if( $negative-spacers-extra: if(
$enable-negative-margins, $enable-negative-margins,
negativify-map(map-merge($spacers, $spacers-extra)), negativify-map(map.merge($spacers, $spacers-extra)),
null null
); );

View File

@@ -1,3 +1,8 @@
@use "sass:string";
@use "sass:math";
@use "sass:map";
@use "sass:color";
$prefix: "tblr-" !default; $prefix: "tblr-" !default;
// BASE CONFIG // BASE CONFIG
@@ -23,8 +28,8 @@ $font-google-monospaced: null !default;
$font-local: null !default; $font-local: null !default;
$font-icons: () !default; $font-icons: () !default;
$font-family-sans-serif: unquote("#{if($font-local, "#{$font-local}, ", ' ')}#{if($font-google, "#{$font-google}, ", ' ')}") 'Inter Var', Inter, -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif !default; $font-family-sans-serif: string.unquote("#{if($font-local, "#{$font-local}, ", ' ')}#{if($font-google, "#{$font-google}, ", ' ')}") 'Inter Var', Inter, -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif !default;
$font-family-monospace: unquote("#{if($font-google-monospaced, "#{$font-google-monospaced}, ", '')}") Monaco, Consolas, Liberation Mono, Courier New, monospace !default; $font-family-monospace: string.unquote("#{if($font-google-monospaced, "#{$font-google-monospaced}, ", '')}") Monaco, Consolas, Liberation Mono, Courier New, monospace !default;
$font-family-serif: "Georgia", "Times New Roman", times, serif !default; $font-family-serif: "Georgia", "Times New Roman", times, serif !default;
$font-family-comic: "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Comic Neue", sans-serif, cursive !default; $font-family-comic: "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Comic Neue", sans-serif, cursive !default;
@@ -200,7 +205,7 @@ $border-color-translucent: rgba(4, 32, 69, 0.1);
$border-dark-color: $gray-400 !default; $border-dark-color: $gray-400 !default;
$border-dark-color-translucent: rgba(4, 32, 69, 0.27); $border-dark-color-translucent: rgba(4, 32, 69, 0.27);
$border-active-color: mix($text-secondary, #ffffff, percentage($border-active-opacity)) !default; $border-active-color: color.mix($text-secondary, #ffffff, math.percentage($border-active-opacity)) !default;
$border-active-color-translucent: rgba($text-secondary, $border-active-opacity) !default; $border-active-color-translucent: rgba($text-secondary, $border-active-opacity) !default;
$active-bg: rgba(var(--#{$prefix}primary-rgb), 0.04) !default; $active-bg: rgba(var(--#{$prefix}primary-rgb), 0.04) !default;
@@ -282,7 +287,7 @@ $gray-colors: (
gray-950: $gray-950, gray-950: $gray-950,
) !default; ) !default;
$theme-colors: map-merge($theme-colors, map-merge($extra-colors, ())); $theme-colors: map.merge($theme-colors, map.merge($extra-colors, ()));
// BACKDROPS // BACKDROPS
$backdrop-opacity: .32 !default; $backdrop-opacity: .32 !default;
@@ -477,7 +482,7 @@ $size-spacers: (
full: 100%, full: 100%,
) !default; ) !default;
$size-values: map-merge( $size-values: map.merge(
$spacers, $spacers,
( (
25: 25%, 25: 25%,

View File

@@ -1,3 +1,5 @@
@use "sass:map";
// //
// Clearfix // Clearfix
// //
@@ -86,7 +88,7 @@
} }
// Responsive sticky top and bottom // Responsive sticky top and bottom
@each $breakpoint in map-keys($grid-breakpoints) { @each $breakpoint in map.keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) { @include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints); $infix: breakpoint-infix($breakpoint, $grid-breakpoints);

View File

@@ -1,3 +1,5 @@
@use "sass:map";
// stylelint-disable property-no-vendor-prefix // stylelint-disable property-no-vendor-prefix
body { body {
letter-spacing: $body-letter-spacing; letter-spacing: $body-letter-spacing;
@@ -35,7 +37,7 @@ body {
// //
.layout-boxed { .layout-boxed {
--#{$prefix}theme-boxed-border-radius: 0; --#{$prefix}theme-boxed-border-radius: 0;
--#{$prefix}theme-boxed-width: #{map-get($container-max-widths, xxl)}; --#{$prefix}theme-boxed-width: #{map.get($container-max-widths, xxl)};
@include media-breakpoint-up(md) { @include media-breakpoint-up(md) {
background: $dark linear-gradient(to right, rgba(#fff, .1), transparent) fixed; background: $dark linear-gradient(to right, rgba(#fff, .1), transparent) fixed;

View File

@@ -1,3 +1,5 @@
@use "sass:map";
@mixin navbar-vertical-nav { @mixin navbar-vertical-nav {
.navbar-collapse { .navbar-collapse {
flex-direction: column; flex-direction: column;
@@ -124,7 +126,7 @@ Navbar
} }
.navbar-expand { .navbar-expand {
@each $breakpoint in map-keys($grid-breakpoints) { @each $breakpoint in map.keys($grid-breakpoints) {
$next: breakpoint-next($breakpoint, $grid-breakpoints); $next: breakpoint-next($breakpoint, $grid-breakpoints);
$infix: breakpoint-infix($next, $grid-breakpoints); $infix: breakpoint-infix($next, $grid-breakpoints);
@@ -307,7 +309,7 @@ Navbar vertical
@if $enable-navbar-vertical { @if $enable-navbar-vertical {
.navbar-vertical { .navbar-vertical {
&.navbar-expand { &.navbar-expand {
@each $breakpoint in map-keys($grid-breakpoints) { @each $breakpoint in map.keys($grid-breakpoints) {
$next: breakpoint-next($breakpoint, $grid-breakpoints); $next: breakpoint-next($breakpoint, $grid-breakpoints);
$infix: breakpoint-infix($next, $grid-breakpoints); $infix: breakpoint-infix($next, $grid-breakpoints);

View File

@@ -1,3 +1,5 @@
@use "sass:map";
.shape { .shape {
--#{$prefix}shape-size: #{$avatar-size}; --#{$prefix}shape-size: #{$avatar-size};
--#{$prefix}shape-icon-size: #{$avatar-icon-size}; --#{$prefix}shape-icon-size: #{$avatar-icon-size};
@@ -18,8 +20,8 @@
@each $avatar-size, $size in $avatar-sizes { @each $avatar-size, $size in $avatar-sizes {
.shape-#{$avatar-size} { .shape-#{$avatar-size} {
--#{$prefix}shape-size: #{map-get($size, size)}; --#{$prefix}shape-size: #{map.get($size, size)};
--#{$prefix}shape-icon-size: #{map-get($size, icon-size)}; --#{$prefix}shape-icon-size: #{map.get($size, icon-size)};
} }
} }

View File

@@ -1,5 +1,12 @@
@use "sass:math";
@use "sass:string";
@use "sass:list";
@use "sass:map";
@use "sass:color";
@use "sass:meta";
@function theme-color-lighter($color, $background: #fff) { @function theme-color-lighter($color, $background: #fff) {
@return mix($color, $background, 10%); @return color.mix($color, $background, 10%);
} }
@function theme-color-darker($color) { @function theme-color-darker($color) {
@@ -10,10 +17,10 @@
// Replace all occurrences of a substring within a string. // Replace all occurrences of a substring within a string.
// //
@function str-replace($string, $search, $replace: "") { @function str-replace($string, $search, $replace: "") {
$index: str-index($string, $search); $index: string.index($string, $search);
@if $index { @if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace); @return string.slice($string, 1, $index - 1) + $replace + str-replace(string.slice($string, $index + string.length($search)), $search, $replace);
} }
@return $string; @return $string;
@@ -37,23 +44,23 @@
} }
} }
@function breakpoint-prev($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) { @function breakpoint-prev($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map.keys($breakpoints)) {
$n: index($breakpoint-names, $name); $n: index($breakpoint-names, $name);
@if not $n { @if not $n {
@error "breakpoint `#{$name}` not found in `#{$breakpoints}`"; @error "breakpoint `#{$name}` not found in `#{$breakpoints}`";
} }
@return if($n > 1, nth($breakpoint-names, $n - 1), null); @return if($n > 1, list.nth($breakpoint-names, $n - 1), null);
} }
// //
// Escape SVG strings. // Escape SVG strings.
// //
@function escape-svg($string) { @function escape-svg($string) {
@if str-index($string, "data:image/svg+xml") { @if string.index($string, "data:image/svg+xml") {
@each $char, $encoded in $escaped-characters { @each $char, $encoded in $escaped-characters {
// Do not escape the url brackets // Do not escape the url brackets
@if str-index($string, "url(") == 1 { @if string.index($string, "url(") == 1 {
$string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}"); $string: url("#{str-replace(string.slice($string, 6, -3), $char, $encoded)}");
} @else { } @else {
$string: str-replace($string, $char, $encoded); $string: str-replace($string, $char, $encoded);
} }
@@ -70,7 +77,7 @@
* @return {String} - The percentage representation of the value. * @return {String} - The percentage representation of the value.
*/ */
@function to-percentage($value) { @function to-percentage($value) {
@return if(unitless($value), percentage($value), $value); @return if(math.is-unitless($value), math.percentage($value), $value);
} }
/** /**
@@ -93,4 +100,307 @@
$svg: str-replace($svg, '<svg', '<svg xmlns="http://www.w3.org/2000/svg"'); $svg: str-replace($svg, '<svg', '<svg xmlns="http://www.w3.org/2000/svg"');
@return url('data:image/svg+xml;charset=UTF-8,#{$svg}'); @return url('data:image/svg+xml;charset=UTF-8,#{$svg}');
}
// Bootstrap functions
//
// Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
// Ascending
// Used to evaluate Sass maps like our grid breakpoints.
@mixin _assert-ascending($map, $map-name) {
$prev-key: null;
$prev-num: null;
@each $key, $num in $map {
@if $prev-num == null or math.unit($num) == "%" or math.unit($prev-num) == "%" {
// Do nothing
} @else if not math.compatible($prev-num, $num) {
@warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
} @else if $prev-num >= $num {
@warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
}
$prev-key: $key;
$prev-num: $num;
}
}
// Starts at zero
// Used to ensure the min-width of the lowest breakpoint starts at 0.
@mixin _assert-starts-at-zero($map, $map-name: "$grid-breakpoints") {
@if list.length($map) > 0 {
$values: map.values($map);
$first-value: list.nth($values, 1);
@if $first-value != 0 {
@warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
}
}
}
// Colors
@function to-rgb($value) {
@return color.channel($value, "red", $space: rgb), color.channel($value, "green", $space: rgb), color.channel($value, "blue", $space: rgb);
}
// stylelint-disable scss/dollar-variable-pattern
@function rgba-css-var($identifier, $target) {
@if $identifier == "body" and $target == "bg" {
@return rgba(var(--#{$prefix}#{$identifier}-bg-rgb), var(--#{$prefix}#{$target}-opacity));
} @if $identifier == "body" and $target == "text" {
@return rgba(var(--#{$prefix}#{$identifier}-color-rgb), var(--#{$prefix}#{$target}-opacity));
} @else {
@return rgba(var(--#{$prefix}#{$identifier}-rgb), var(--#{$prefix}#{$target}-opacity));
}
}
@function map-loop($map, $func, $args...) {
$_map: ();
@each $key, $value in $map {
// allow to pass the $key and $value of the map as an function argument
$_args: ();
@each $arg in $args {
$_args: list.append($_args, if($arg == "$key", $key, if($arg == "$value", $value, $arg)));
}
$_map: map.merge($_map, ($key: meta.call(meta.get-function($func), $_args...)));
}
@return $_map;
}
// stylelint-enable scss/dollar-variable-pattern
@function varify($list) {
$result: null;
@each $entry in $list {
$result: list.append($result, var(--#{$prefix}#{$entry}), space);
}
@return $result;
}
// Internal Bootstrap function to turn maps into its negative variant.
// It prefixes the keys with `n` and makes the value negative.
@function negativify-map($map) {
$result: ();
@each $key, $value in $map {
@if $key != 0 {
$result: map.merge($result, ("n" + $key: (-$value)));
}
}
@return $result;
}
// Get multiple keys from a sass map
@function map-get-multiple($map, $values) {
$result: ();
@each $key, $value in $map {
@if (index($values, $key) != null) {
$result: map.merge($result, ($key: $value));
}
}
@return $result;
}
// Merge multiple maps
@function map-merge-multiple($maps...) {
$merged-maps: ();
@each $map in $maps {
$merged-maps: map.merge($merged-maps, $map);
}
@return $merged-maps;
}
// Replace `$search` with `$replace` in `$string`
// Used on our SVG icon backgrounds for custom forms.
//
// @author Kitty Giraudel
// @param {String} $string - Initial string
// @param {String} $search - Substring to replace
// @param {String} $replace ('') - New value
// @return {String} - Updated string
@function str-replace($string, $search, $replace: "") {
$index: string.index($string, $search);
@if $index {
@return string.slice($string, 1, $index - 1) + $replace + str-replace(string.slice($string, $index + string.length($search)), $search, $replace);
}
@return $string;
}
// See https://codepen.io/kevinweber/pen/dXWoRw
//
// Requires the use of quotes around data URIs.
@function escape-svg($string) {
@if string.index($string, "data:image/svg+xml") {
@each $char, $encoded in $escaped-characters {
// Do not escape the url brackets
@if string.index($string, "url(") == 1 {
$string: url("#{str-replace(string.slice($string, 6, -3), $char, $encoded)}");
} @else {
$string: str-replace($string, $char, $encoded);
}
}
}
@return $string;
}
// Color contrast
// See https://github.com/twbs/bootstrap/pull/30168
// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
// stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
$_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
@function color-contrast($background, $color-contrast-dark: $color-contrast-dark, $color-contrast-light: $color-contrast-light, $min-contrast-ratio: $min-contrast-ratio) {
$foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black;
$max-ratio: 0;
$max-ratio-color: null;
@each $color in $foregrounds {
$contrast-ratio: contrast-ratio($background, $color);
@if $contrast-ratio >= $min-contrast-ratio {
@return $color;
} @else if $contrast-ratio > $max-ratio {
$max-ratio: $contrast-ratio;
$max-ratio-color: $color;
}
}
@warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}...";
@return $max-ratio-color;
}
@function contrast-ratio($background, $foreground: $color-contrast-light) {
$l1: luminance($background);
$l2: luminance(opaque($background, $foreground));
@return if($l1 > $l2, divide($l1 + .05, $l2 + .05), divide($l2 + .05, $l1 + .05));
}
// Return WCAG2.2 relative luminance
// See https://www.w3.org/TR/WCAG/#dfn-relative-luminance
// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
@function luminance($color) {
$rgb: (
"r": math.round(color.channel($color, "red", $space: rgb)),
"g": math.round(color.channel($color, "green", $space: rgb)),
"b": math.round(color.channel($color, "blue", $space: rgb))
);
@each $name, $value in $rgb {
$value: if(divide($value, 255) < .04045, divide(divide($value, 255), 12.92), list.nth($_luminance-list, $value + 1));
$rgb: map.merge($rgb, ($name: $value));
}
@return (map.get($rgb, "r") * .2126) + (map.get($rgb, "g") * .7152) + (map.get($rgb, "b") * .0722);
}
// Return opaque color
// opaque(#fff, rgba(0, 0, 0, .5)) => #808080
@function opaque($background, $foreground) {
@return color.mix(rgba($foreground, 1), $background, color.opacity($foreground) * 100%);
}
// scss-docs-start color-functions
// Tint a color: mix a color with white
@function tint-color($color, $weight) {
@return color.mix(white, $color, $weight);
}
// Shade a color: mix a color with black
@function shade-color($color, $weight) {
@return color.mix(black, $color, $weight);
}
// Shade the color if the weight is positive, else tint it
@function shift-color($color, $weight) {
@return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight));
}
// scss-docs-end color-functions
// Return valid calc
@function add($value1, $value2, $return-calc: true) {
@if $value1 == null {
@return $value2;
}
@if $value2 == null {
@return $value1;
}
@if meta.type-of($value1) == number and meta.type-of($value2) == number and math.compatible($value1, $value2) {
@return $value1 + $value2;
}
@return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + string.unquote(" + ") + $value2);
}
@function subtract($value1, $value2, $return-calc: true) {
@if $value1 == null and $value2 == null {
@return null;
}
@if $value1 == null {
@return -$value2;
}
@if $value2 == null {
@return $value1;
}
@if meta.type-of($value1) == number and meta.type-of($value2) == number and math.compatible($value1, $value2) {
@return $value1 - $value2;
}
@if meta.type-of($value2) != number {
$value2: string.unquote("(") + $value2 + string.unquote(")");
}
@return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + string.unquote(" - ") + $value2);
}
@function divide($dividend, $divisor, $precision: 10) {
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
$dividend: math.abs($dividend);
$divisor: math.abs($divisor);
@if $dividend == 0 {
@return 0;
}
@if $divisor == 0 {
@error "Cannot divide by 0";
}
$remainder: $dividend;
$result: 0;
$factor: 10;
@while ($remainder > 0 and $precision >= 0) {
$quotient: 0;
@while ($remainder >= $divisor) {
$remainder: $remainder - $divisor;
$quotient: $quotient + 1;
}
$result: $result * 10 + $quotient;
$factor: $factor * .1;
$remainder: $remainder * 10;
$precision: $precision - 1;
@if ($precision < 0 and $remainder >= $divisor * 5) {
$result: $result + 1;
}
}
$result: $result * $factor * $sign;
$dividend-unit: math.unit($dividend);
$divisor-unit: math.unit($divisor);
$unit-map: (
"px": 1px,
"rem": 1rem,
"em": 1em,
"%": 1%
);
@if ($dividend-unit != $divisor-unit and map.has-key($unit-map, $dividend-unit)) {
$result: $result * map.get($unit-map, $dividend-unit);
}
@return $result;
} }

View File

@@ -1,3 +1,5 @@
@use "sass:map";
.avatar { .avatar {
--#{$prefix}avatar-size: var(--#{$prefix}avatar-list-size, #{$avatar-size}); --#{$prefix}avatar-size: var(--#{$prefix}avatar-list-size, #{$avatar-size});
--#{$prefix}avatar-status-size: #{$avatar-status-size}; --#{$prefix}avatar-status-size: #{$avatar-status-size};
@@ -55,15 +57,15 @@
@each $avatar-size, $size in $avatar-sizes { @each $avatar-size, $size in $avatar-sizes {
.avatar-#{$avatar-size} { .avatar-#{$avatar-size} {
--#{$prefix}avatar-size: #{map-get($size, size)}; --#{$prefix}avatar-size: #{map.get($size, size)};
--#{$prefix}avatar-status-size: #{map-get($size, status-size)}; --#{$prefix}avatar-status-size: #{map.get($size, status-size)};
--#{$prefix}avatar-font-size: #{map-get($size, font-size)}; --#{$prefix}avatar-font-size: #{map.get($size, font-size)};
--#{$prefix}avatar-icon-size: #{map-get($size, icon-size)}; --#{$prefix}avatar-icon-size: #{map.get($size, icon-size)};
--#{$prefix}avatar-brand-size: #{map-get($size, brand-size)}; --#{$prefix}avatar-brand-size: #{map.get($size, brand-size)};
.badge:empty { .badge:empty {
width: map-get($size, status-size); width: map.get($size, status-size);
height: map-get($size, status-size); height: map.get($size, status-size);
} }
} }
} }
@@ -94,7 +96,7 @@
@each $avatar-size, $size in $avatar-sizes { @each $avatar-size, $size in $avatar-sizes {
.avatar-list-#{$avatar-size} { .avatar-list-#{$avatar-size} {
--#{$prefix}avatar-list-size: #{map-get($size, size)}; --#{$prefix}avatar-list-size: #{map.get($size, size)};
} }
} }

View File

@@ -1,4 +1,5 @@
@use "sass:color"; @use "sass:color";
@use "sass:map";
// //
// Button // Button
@@ -76,7 +77,7 @@
// //
// Button color variations // Button color variations
// //
@each $color, $value in map-merge($theme-colors, $social-colors) { @each $color, $value in map.merge($theme-colors, $social-colors) {
.btn-#{$color} { .btn-#{$color} {
@if $color == "dark" { @if $color == "dark" {
--#{$prefix}btn-border-color: var(--#{$prefix}dark-mode-border-color); --#{$prefix}btn-border-color: var(--#{$prefix}dark-mode-border-color);

View File

@@ -1,3 +1,5 @@
@use "sass:map";
$countries: ( $countries: (
'ad', 'af', 'ae', 'afrun', 'ag', 'ai', 'al', 'am', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bl', 'bm', 'bn', 'bo', 'bq-bo', 'bq-sa', 'bq-se', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cw', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb-eng', 'gb-sct', 'gb', 'gb-wls', 'gb-nir', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mf', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 'rainbow', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'ss', 'st', 'sv', 'sx', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'um', 'unasur', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'za', 'zm', 'zw' 'ad', 'af', 'ae', 'afrun', 'ag', 'ai', 'al', 'am', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bl', 'bm', 'bn', 'bo', 'bq-bo', 'bq-sa', 'bq-se', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cw', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb-eng', 'gb-sct', 'gb', 'gb-wls', 'gb-nir', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mf', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 'rainbow', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'ss', 'st', 'sv', 'sx', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'um', 'unasur', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'za', 'zm', 'zw'
); );
@@ -26,6 +28,6 @@ $countries: (
@each $flag-size, $size in $flag-sizes { @each $flag-size, $size in $flag-sizes {
.flag-#{$flag-size} { .flag-#{$flag-size} {
height: map-get($size, size); height: map.get($size, size);
} }
} }

View File

@@ -1,3 +1,5 @@
@use "sass:map";
.row > * { .row > * {
min-width: 0; min-width: 0;
} }
@@ -54,7 +56,7 @@
} }
} }
@each $name, $size in map-merge((null: $spacer), $spacers) { @each $name, $size in map.merge((null: $spacer), $spacers) {
$name-prefixed: if($name == null, null, '-#{$name}'); $name-prefixed: if($name == null, null, '-#{$name}');
.space-y#{$name-prefixed} { .space-y#{$name-prefixed} {
@@ -69,7 +71,7 @@
} }
} }
@each $name, $size in map-merge((null: $spacer), $spacers) { @each $name, $size in map.merge((null: $spacer), $spacers) {
$name-prefixed: if($name == null, null, '-#{$name}'); $name-prefixed: if($name == null, null, '-#{$name}');
.divide-y#{$name-prefixed} { .divide-y#{$name-prefixed} {

View File

@@ -1,5 +1,7 @@
@use "sass:math";
.img-responsive { .img-responsive {
--#{$prefix}img-responsive-ratio: #{percentage(.75)}; --#{$prefix}img-responsive-ratio: #{math.percentage(.75)};
background: no-repeat center/cover; background: no-repeat center/cover;
padding-top: var(--#{$prefix}img-responsive-ratio); padding-top: var(--#{$prefix}img-responsive-ratio);
} }

View File

@@ -1,3 +1,5 @@
@use "sass:map";
$payment-icons: ("2c2p", "2checkout", "adyen", "affirm", "alipay-plus", "alipay", "allegro-pay", "amazon-pay", "amazon", "americanexpress", "applepay", "authorize", "autopay", "bancontact", "binance-usd", "bitcoin", "bitpay", "bkash", "blik", "braintree", "cash-app", "chime", "cirrus", "clickandbuy", "coinkite", "dinersclub", "directdebit", "discover", "dotpay", "dwolla", "easypaisa", "ebay", "elo", "epayco", "esewa", "ethereum", "eway", "fonepay", "giropay", "google-pay", "googlewallet", "hubspot", "ingenico", "ideal", "imepay", "jcb", "khalti", "klarna", "laser", "litecoin", "maestro", "mastercard", "mercado-pago", "metamask", "mir", "monero", "moneygram", "neteller", "ogone", "okpay", "opensea", "paybox", "payconiq", "payka", "payline", "paymill", "payone", "payoneer", "paypal", "paypo", "paysafe", "paysafecard", "payu", "payza", "poli", "przelewy24", "revolut-pay", "ripple", "sage", "samsung-pay", "sepa", "shop-pay", "shopify", "skrill", "solana", "solo", "spingo", "square", "stax", "stripe", "switch", "tether", "tpay", "troy", "true-usd", "ukash", "unionpay", "venmo", "verifone", "verisign", "visa", "we-chat-pay", "webmoney", "westernunion", "wise", "worldpay", "zelle"); $payment-icons: ("2c2p", "2checkout", "adyen", "affirm", "alipay-plus", "alipay", "allegro-pay", "amazon-pay", "amazon", "americanexpress", "applepay", "authorize", "autopay", "bancontact", "binance-usd", "bitcoin", "bitpay", "bkash", "blik", "braintree", "cash-app", "chime", "cirrus", "clickandbuy", "coinkite", "dinersclub", "directdebit", "discover", "dotpay", "dwolla", "easypaisa", "ebay", "elo", "epayco", "esewa", "ethereum", "eway", "fonepay", "giropay", "google-pay", "googlewallet", "hubspot", "ingenico", "ideal", "imepay", "jcb", "khalti", "klarna", "laser", "litecoin", "maestro", "mastercard", "mercado-pago", "metamask", "mir", "monero", "moneygram", "neteller", "ogone", "okpay", "opensea", "paybox", "payconiq", "payka", "payline", "paymill", "payone", "payoneer", "paypal", "paypo", "paysafe", "paysafecard", "payu", "payza", "poli", "przelewy24", "revolut-pay", "ripple", "sage", "samsung-pay", "sepa", "shop-pay", "shopify", "skrill", "solana", "solo", "spingo", "square", "stax", "stripe", "switch", "tether", "tpay", "troy", "true-usd", "ukash", "unionpay", "venmo", "verifone", "verisign", "visa", "we-chat-pay", "webmoney", "westernunion", "wise", "worldpay", "zelle");
.payment { .payment {
@@ -23,6 +25,6 @@ $payment-icons: ("2c2p", "2checkout", "adyen", "affirm", "alipay-plus", "alipay"
@each $payment-size, $size in $payment-sizes { @each $payment-size, $size in $payment-sizes {
.payment-#{$payment-size} { .payment-#{$payment-size} {
height: map-get($size, size); height: map.get($size, size);
} }
} }

View File

@@ -1,3 +1,5 @@
@use "sass:map";
$apps: ( $apps: (
"apple", "apple",
"discord", "discord",
@@ -47,6 +49,6 @@ $apps: (
@each $flag-size, $size in $flag-sizes { @each $flag-size, $size in $flag-sizes {
.social-#{$flag-size} { .social-#{$flag-size} {
height: map-get($size, size); height: map.get($size, size);
} }
} }

View File

@@ -1,5 +1,7 @@
@use "sass:map";
// All colors // All colors
@each $color, $value in map-merge($theme-colors, ( white: $white)) { @each $color, $value in map.merge($theme-colors, ( white: $white)) {
.bg-#{"" + $color} { .bg-#{"" + $color} {
background-color: color-mix(in srgb, var(--#{$prefix}#{$color}) calc(var(--#{$prefix}bg-opacity, 1) * 100%), transparent) !important; background-color: color-mix(in srgb, var(--#{$prefix}#{$color}) calc(var(--#{$prefix}bg-opacity, 1) * 100%), transparent) !important;
} }

View File

@@ -1,6 +1,6 @@
{ {
"css": "sha384-kz+I4+mczbNiZfLAJMxOlJaZmnbRYhARHNkR2k6tal4gz7OL33/0puDD3SvkiNX9", "css": "sha384-b08Yxo9kzlsLLcHA4bMBkC8EAIBeP3G8rhhIT584owzLn88bcWJkSVtGZMc78Rax",
"css-rtl": "sha384-oBsMN4t4hqHp2yPeHCvYqwzbzTIQj7tW4JvGHxhmk14iAV8n8UWc8nl5PjfN0Cmp", "css-rtl": "sha384-EVH/sV9+QVa/y7Vl1JFsVYjru0/gKkqDf8zBqdfu2R8t84BwCBeV7jsu7kQ93abg",
"css-flags": "sha384-kmvP0hkBXZ2hMSZlbvE1Q2HIXzPCQRL3ijUeqNiwaPd2nl2Aks+s3gW+V5fAHOX9", "css-flags": "sha384-kmvP0hkBXZ2hMSZlbvE1Q2HIXzPCQRL3ijUeqNiwaPd2nl2Aks+s3gW+V5fAHOX9",
"css-flags-rtl": "sha384-Q/h6koANGclsGnwB8rvF8h84H54NKHDeNWFj6yiE4WLLEXyHcz+Zu6Afkh2ssYTC", "css-flags-rtl": "sha384-Q/h6koANGclsGnwB8rvF8h84H54NKHDeNWFj6yiE4WLLEXyHcz+Zu6Afkh2ssYTC",
"css-marketing": "sha384-4dAlYnPzCom9yeC/5++PFq2FG/szJRlUPsDSrjZ3EWP8IAzK7g7rrsnSfqrS67Se", "css-marketing": "sha384-4dAlYnPzCom9yeC/5++PFq2FG/szJRlUPsDSrjZ3EWP8IAzK7g7rrsnSfqrS67Se",
@@ -9,8 +9,8 @@
"css-payments-rtl": "sha384-69CxgA+uEPtM07SLA8MMAdnBmwtVGndDJf8nIPdfvNrDayBfPqOK3wS3nvV5yyk+", "css-payments-rtl": "sha384-69CxgA+uEPtM07SLA8MMAdnBmwtVGndDJf8nIPdfvNrDayBfPqOK3wS3nvV5yyk+",
"css-socials": "sha384-eWmz8gyiLzrDw3JcT/PJxjGyKizQjvByfHqocjrMMkIrbKFCnOuP/qMwAz3bHmsC", "css-socials": "sha384-eWmz8gyiLzrDw3JcT/PJxjGyKizQjvByfHqocjrMMkIrbKFCnOuP/qMwAz3bHmsC",
"css-socials-rtl": "sha384-yobKDIyTOxB1z7t/uZ2ImuXrcKWF24vDYg2vR1n7x2msF09iWnvyIxQtfEl9+OFl", "css-socials-rtl": "sha384-yobKDIyTOxB1z7t/uZ2ImuXrcKWF24vDYg2vR1n7x2msF09iWnvyIxQtfEl9+OFl",
"css-props": "sha384-yctdHmQqHsVGkRviR41l44mMU+tmJq7aIvUiRG05pnl2kIjaX1e9yuT6SdYTVMg/", "css-props": "sha384-HpzBfAj1xJcNLtdedYZunJBHqgdO12KqrCrc6/7pmKDiP8YmUF71cm+iGBtVawWM",
"css-props-rtl": "sha384-xMuKYM+iQpCesX0ZyyH7tW8KJgLkUOyHlPwNjEY8ZepdiAXhT9+psV8ohJ4xqlkg", "css-props-rtl": "sha384-/vKK+yuQsAI8lJmR4uothydKQAHFK+fp1QrbJnfk2deAzII9WUj3h5rXUxZPyUAo",
"css-themes": "sha384-jTe/MdN6BlY4S3eYe6Qw++yTjuezmVnxWp/l7GAG1qXGC+jttphHqsAN/bGPvJOk", "css-themes": "sha384-jTe/MdN6BlY4S3eYe6Qw++yTjuezmVnxWp/l7GAG1qXGC+jttphHqsAN/bGPvJOk",
"css-themes-rtl": "sha384-WTp4aZ+OGqnkNR6Xe0sJwwfd0JHGq3dZTLU2ITKxTK2zjcJTBUMY/+Z4eXgm8ipF", "css-themes-rtl": "sha384-WTp4aZ+OGqnkNR6Xe0sJwwfd0JHGq3dZTLU2ITKxTK2zjcJTBUMY/+Z4eXgm8ipF",
"css-vendors-rtl": "sha384-V555LUGE2xyN4wNbzdVMgsajsKmJdlLFm20Ws72jEyPiSsTXXITV0PebNzVeBjnb", "css-vendors-rtl": "sha384-V555LUGE2xyN4wNbzdVMgsajsKmJdlLFm20Ws72jEyPiSsTXXITV0PebNzVeBjnb",