_index.sass 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. @use 'sass:string'
  2. @use 'sass:map'
  3. @use 'sass:meta'
  4. @use '../settings'
  5. @use '../tools'
  6. @use './display'
  7. @use './elevation'
  8. @use './screenreaders'
  9. @include tools.layer('utilities')
  10. @each $breakpoint in map.keys(settings.$grid-breakpoints)
  11. // Generate media query if needed
  12. @include tools.media-breakpoint-up($breakpoint)
  13. $infix: tools.breakpoint-infix($breakpoint, settings.$grid-breakpoints)
  14. // Loop over each utility property
  15. @each $key, $utility in settings.$utilities
  16. // The utility can be disabled with `false`, thus check if the utility is a map first
  17. // Only proceed if responsive media queries are enabled or if it's the base media query
  18. @if string.slice($key, -4) == ':ltr'
  19. @if meta.type-of($utility) == "map" and (map.get($utility, responsive) or $infix == "")
  20. @include tools.generate-utility($utility, $infix, 'ltr')
  21. @else if string.slice($key, -4) == ':rtl'
  22. @if meta.type-of($utility) == "map" and (map.get($utility, responsive) or $infix == "")
  23. @include tools.generate-utility($utility, $infix, 'rtl')
  24. @else
  25. @if meta.type-of($utility) == "map" and (map.get($utility, responsive) or $infix == "")
  26. @include tools.generate-utility($utility, $infix, 'bidi')
  27. // Print utilities
  28. @media print
  29. @each $key, $utility in settings.$utilities
  30. // The utility can be disabled with `false`, thus check if the utility is a map first
  31. // Then check if the utility needs print styles
  32. @if string.slice($key, -4) == ':ltr'
  33. @if meta.type-of($utility) == "map" and map.get($utility, print) == true
  34. @include tools.generate-utility($utility, "-print", 'ltr')
  35. @else if string.slice($key, -4) == ':rtl'
  36. @if meta.type-of($utility) == "map" and map.get($utility, print) == true
  37. @include tools.generate-utility($utility, "-print", 'rtl')
  38. @else
  39. @if meta.type-of($utility) == "map" and map.get($utility, print) == true
  40. @include tools.generate-utility($utility, "-print", 'bidi')