@use './variables' as v;

$viewboxSize: v.$slick-icon-svg-viewbox-size !default;
$svg-icon-vertical-align: bottom !default;

@keyframes sg-spin {
  0% {
    transform: rotate(0deg) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
  }
  100% {
    transform: rotate(360deg) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
  }
}

// credit goes to UnoCSS https://antfu.me/posts/icons-in-pure-css
@mixin generateSvgClass($cssVarName, $svgPath) {
  .#{$cssVarName} {
    @include generateSvgStyle(#{$cssVarName + '-icon-svg'}, $svgPath); // all icon will create css variable named "[icon name]-icon-svg"
  }
}

// create SVG as a url() and the url string must be html escaped,
// we will also use the name to create a CSS variable so that user could override any of the icon
// by providing the full url string without needing else since it was already created
@mixin generateSvgStyle($cssVarName, $svgPath) {
  --#{$cssVarName}: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 #{$viewboxSize} #{$viewboxSize}" height="1em" width="1em" vertical-align="text-bottom" xmlns="http://www.w3.org/2000/svg" %3E%3Cpath fill="currentColor" d="#{$svgPath}"/%3E%3C/svg%3E');
  -webkit-mask: var(--#{$cssVarName}) no-repeat;
  mask: var(--#{$cssVarName}) no-repeat;
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
}
