border-radius.styl 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Helper for border-radius().
  3. */
  4. -apply-border-radius(pos, importance)
  5. if length(pos) == 3
  6. // border-radius: <top | bottom> <left | right> <n>
  7. y = pos[0]
  8. x = pos[1]
  9. // We don't use vendor for boder-radius anymore
  10. // vendor('border-radius-%s%s' % pos, pos[2], only: webkit official)
  11. {'border-%s-%s-radius' % pos}: pos[2] importance
  12. else if pos[0] in (top bottom)
  13. // border-radius: <top | bottom> <n>
  14. -apply-border-radius(pos[0] left pos[1], importance)
  15. -apply-border-radius(pos[0] right pos[1], importance)
  16. else if pos[0] in (left right)
  17. // border-radius: <left | right> <n>
  18. unshift(pos, top);
  19. -apply-border-radius(pos, importance)
  20. pos[0] = bottom
  21. -apply-border-radius(pos, importance)
  22. /*
  23. * border-radius supporting augmented behavior.
  24. *
  25. * Examples:
  26. *
  27. * border-radius: 2px 5px
  28. * border-radius: top 5px bottom 10px
  29. * border-radius: left 5px
  30. * border-radius: top left 5px
  31. * border-radius: top left 10px bottom right 5px
  32. * border-radius: top left 10px, bottom right 5px
  33. *
  34. */
  35. border-radius()
  36. pos = ()
  37. augmented = false
  38. importance = arguments[length(arguments) - 1] == !important ? !important : unquote('')
  39. for args in arguments
  40. for arg in args
  41. if arg is a 'ident'
  42. append(pos, arg)
  43. augmented = true
  44. else
  45. append(pos, arg)
  46. if augmented
  47. -apply-border-radius(pos, importance)
  48. pos = ()
  49. border-radius pos unless augmented