2.8.23 • Published 3 years ago

@o/css v2.8.23

Weekly downloads
4
License
MIT
Repository
-
Last release
3 years ago

@o/css

Turns objects into nice CSS styles. Has a few helpers:

  • Arrays to strings:
{
  border: [1, 'solid', '#eee'], // 1px solid #eee
  border: [1, '#eee'], // defaults (solid)
  color: [0, 0, 0, 0.5], // rgba(0,0,0,0.5)
}
  • Transform objects:
{
  transform: { x: 0, y: 10, z: 0, rotate: '100deg' }
}
  • Color objects:
{
  background: [0, 255, 0, 0.5] // rgba(0, 255, 0, 0.5)
}
  • Converts css-able functions/objects:
{
  background: chroma('#fff') // will call .css() automatically
}
  • Recurses into media queries + & selectors
{
  '@media screen': { ... }
}
{
  '& child': { ... }
}
  • Extra border shorthands
{
  borderLeftRadius: ['borderTopLeftRadius', 'borderBottomLeftRadius'],
  borderRightRadius: ['borderTopRightRadius', 'borderBottomRightRadius'],
  borderBottomRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius'],
  borderTopRadius: ['borderTopRightRadius', 'borderTopLeftRadius'],
}
  • Position shorthand
{
  position: [0, 'auto', 20, '50%'],
  /*
    position: absolute;
    top: 0px;
    right: auto;
    bottom: 20px;
    left: 50%;
  */
  position: ['fixed', 0, 'auto'],
  /*
    position: fixed;
    top: 0px;
    right: auto;
  */
}
  • Comma separations for multiple boxShadows and transitions:
{
  boxShadow: [
    { x: 5, y: 5, blur: 2, spread: 5, color: [0, 0, 0, 0.1] },
    [0, 0, 10, [0, 0, 0, 0.2]],
  ]
}
  • Object to value:
{
  background: {
    color: 'green',
    image: 'url(image.jpg)',
    position: [0, 0],
    repeat: 'no-repeat'
  }
}
2.8.19

3 years ago

2.8.18

3 years ago

2.8.17

3 years ago

2.8.11

3 years ago

2.8.16

3 years ago

2.8.15

3 years ago

2.8.23

3 years ago

2.8.22

3 years ago

2.8.21

3 years ago

2.8.20

3 years ago

2.7.21

3 years ago

2.7.20

3 years ago

2.7.9

3 years ago

2.7.19

3 years ago

2.7.18

3 years ago

2.7.17

3 years ago

2.7.16

3 years ago

2.7.11

3 years ago

2.7.10

3 years ago

2.7.15

3 years ago

2.7.14

3 years ago

2.7.13

3 years ago

2.7.12

3 years ago

2.7.1

4 years ago

2.7.0

4 years ago

2.6.0

5 years ago

2.5.5

5 years ago

2.5.4

5 years ago

2.5.3

5 years ago

2.5.2

5 years ago

2.5.0

5 years ago

2.4.1

5 years ago

2.4.0

5 years ago

2.3.10

5 years ago