0.2.4 • Published 9 years ago

stylistic v0.2.4

Weekly downloads
77
License
MIT
Repository
github
Last release
9 years ago

Stylistic

A small library to extract style and CSS transform declarations from a React props object into a style object, with some helpful conversions along the way. See stylistic-elements for the higher-level application of this.

For example:

import {extract} from 'stylistic';

extract({
  id: 'myElement',
  onClick: onClickHandler,
  marginTop: 12,
  translateY: 24,
});

// Returns:

{
  id: 'myElement',
  onClick: onClickHandler,
  style: {
    marginTop: 12,
    transform: 'translate(0, 24px)',
  }
}

Note: this is a work-in-progress. Support for browser prefixing is coming.

Supported CSS properties

All CSS properties should be supported. If I missed any, file a bug.

A few properties have special behaviors:

  • Colors can be provided as [r, g, b, a] arrays as well as standard CSS strings (this can be useful for animating).
  • backgroundImage takes a path/URL directly, no need to wrap it in url().
  • letterSpacing and lineHeight assume pixels if you supply a number, no need to add px.

Supported transform properties

  • translateX
  • translateY
  • translateZ
  • scaleX
  • scaleY
  • rotateX
  • rotateY
  • rotateZ
0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago