_index.sass 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. // Utilities
  10. @each $breakpoint in map.keys(settings.$grid-breakpoints)
  11. // Generate media query if needed
  12. +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. +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. +tools.generate-utility($utility, $infix, 'rtl')
  24. @else
  25. @if meta.type-of($utility) == "map" and (map.get($utility, responsive) or $infix == "")
  26. +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. +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. +tools.generate-utility($utility, "-print", 'rtl')
  38. @else
  39. @if meta.type-of($utility) == "map" and map.get($utility, print) == true
  40. +tools.generate-utility($utility, "-print", 'bidi')