{"name":"css-to-react-native","version":"1.0.5","description":"Convert CSS text to a React Native stylesheet object","main":"dist/index.js","scripts":{"build-grammar":"nearleyc src/grammar.ne -o src/grammar.js","build":"npm run build-grammar; babel src --ignore test.js --out-dir dist","test":"npm run build-grammar; jest","prepublish":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/styled-components/css-to-react-native.git"},"keywords":["styled-components","React","ReactNative","styles","CSS"],"author":{"name":"Jacob Parker"},"license":"MIT","bugs":{"url":"https://github.com/styled-components/css-to-react-native/issues"},"homepage":"https://github.com/styled-components/css-to-react-native#readme","devDependencies":{"babel-cli":"^6.18.0","babel-preset-es2015":"^6.18.0","eslint":"^3.9.1","eslint-config-airbnb-base":"^10.0.1","eslint-plugin-import":"^2.2.0","jest":"^17.0.0"},"dependencies":{"css-color-list":"0.0.1","fbjs":"^0.8.5","nearley":"^2.7.7"},"gitHead":"e3ea005b82943077a3e5bebf3032e023ff6c07df","_id":"css-to-react-native@1.0.5","_shasum":"0b47f50723031973ec6ff56413985085b3869c9b","_from":".","_npmVersion":"3.10.7","_nodeVersion":"6.6.0","_npmUser":{"name":"jacobp100","email":"jacobparker1992@gmail.com"},"dist":{"shasum":"0b47f50723031973ec6ff56413985085b3869c9b","tarball":"http://registry-npm.ywwl.com/css-to-react-native/download/css-to-react-native-1.0.5.tgz","integrity":"sha512-2I7A2RtT1UEL2YmsPkXZvvNvcrdt2GPXG3dZT3eXaY+U19HYo575tlDGxywghhwcGrn9sk6f5LCWSD0ZUD7Y6g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjpkakaJastettdaTLXNrPBa6d0BVROgEiYjDG/W9y5gIhAP6L2JW0LL+pwIPgcdT7fhSxKqDLcqWMoeto55w3csyP"}],"size":43503,"noattachment":false,"key":"/css-to-react-native/-/css-to-react-native-1.0.5.tgz"},"maintainers":[{"name":"jacobp100","email":"jacobparker1992@gmail.com"},{"name":"mxstbr","email":"npm@mxstbr.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/css-to-react-native-1.0.5.tgz_1480014346703_0.3604941663797945"},"directories":{},"readme":"# css-to-react-native\n\nConverts CSS text to a React Native stylesheet object.\n\n[Try it here](https://csstox.surge.sh)\n\n```css\nfont-size: 18px;\nline-height: 24px;\ncolor: red;\n```\n\n```js\n{\n  fontSize: 18,\n  lineHeight: 24,\n  color: 'red',\n}\n```\n\nConverts all number-like values to numbers, and string-like to strings.\n\nAutomatically converts indirect values to their React Native equivalents.\n\n```css\ntext-shadow-offset: 10px 5px;\nfont-variant: small-caps;\ntransform: translate(10px, 5px) scale(5);\n```\n\n```js\n{\n  textShadowOffset: { width: 10, height: 5 },\n  fontVariant: ['small-caps'],\n  // Fixes backwards transform order\n  transform: [\n    { translateY: 5 },\n    { translateX: 10 },\n    { scale: 5 },\n  ]\n}\n```\n\nAlso allows shorthand values.\n\n```css\nfont: bold 14px/16px \"Helvetica\";\nmargin: 5px 7px 2px;\n```\n\n```js\n{\n  fontFamily: 'Helvetica',\n  fontSize: 14,\n  fontWeight: 'bold',\n  fontStyle: 'normal',\n  fontVariant: [],\n  lineHeight: 16,\n  marginTop: 5,\n  marginRight: 7,\n  marginBottom: 2,\n  marginLeft: 7,\n}\n```\n\nShorthands will only accept values that are supported in React, so `background` will only accept a colour, `backgroundColor`\n\nThere is also support for the `box-shadow` shorthand, and this converts into `shadow-` properties. Note that these only work on iOS.\n\n#### Shorthand Notes\n\n`border{Top,Right,Bottom,Left}` shorthands are not supported, because `borderStyle` cannot be applied to individual border sides.\n\n# API\n\nThe API is mostly for implementors. However, the main API may be useful for non-implementors. The main API is an array of `[property, value]` tuples.\n\n```js\nimport transform from 'css-to-react-native';\n// or const transform = require('css-to-react-native').default;\n\ntransform([\n  ['font', 'bold 14px/16px \"Helvetica\"'],\n  ['margin', '5px 7px 2px'],\n  ['border-left-width', '5px'],\n]); // => { fontFamily: 'Helvetica', ... }\n```\n\nWe don't provide a way to get these style tuples in this library, so you'll need to do that yourself. I expect most people will use postCSS or another CSS parser. You should try avoid getting these with `string.split`, as that has a lot of edge cases (colons and semi-colons appearing in comments etc.)\n\nFor implementors, there is also a few extra APIs available.\n\nThese are for specific use-cases, and most people should just be using the API above.\n\n```js\nimport { getPropertyName, getStylesForProperty } from 'css-to-react-native';\n\ngetPropertyName('border-width'); // => 'borderWidth'\ngetStylesForProperty('borderWidth', '1px 0px 2px 0px'); // => { borderTopWidth: 1, ... }\n```\n\nShould you wish to opt-out of transforming certain shorthands, an array of property names in camelCase can be passed as a second argument to `transform`.\n\n```js\ntransform([['border-radius', '50px']], ['borderRadius']);\n// { borderRadius: 50 } rather than { borderTopLeft: ... }\n```\n\nThis can also be done by passing a third argument, `false` to `getStylesForProperty`.\n\n## License\n\nLicensed under the MIT License, Copyright © 2019 Krister Kari, Jacob Parker, and Maximilian Stoiber.\n\nSee [LICENSE.md](./LICENSE.md) for more information.\n","publish_time":1480014347242,"_cnpm_publish_time":1480014347242,"dist-tags":{"latest":"3.2.0"}}