{"name":"css-in-js-utils","version":"3.0.3","description":"Useful utility functions for CSS in JS solutions","main":"lib/index.js","module":"es/index.js","jsnext:main":"es/index.js","sideEffects":false,"keywords":["css","cssinjs","utils","small"],"repository":{"type":"git","url":"git+https://github.com/robinweser/css-in-js-utils.git"},"author":{"name":"robinweser","email":"contact@weser.io"},"license":"MIT","scripts":{"build":"yarn run clean && yarn build:lib && yarn build:es","build:lib":"cross-env BABEL_ENV=commonjs babel modules --out-dir lib --ignore __tests__","build:es":"babel modules --out-dir es --ignore __tests__","clean":"rimraf es lib coverage","check":"yarn lint && yarn test:coverage","format":"prettier --write \"modules/**/*.js\"","lint":"eslint modules/**/*.js","release":"git pull --rebase && yarn run check && yarn build && npm publish","test":"cross-env BABEL_ENV=commonjs jest","test:coverage":"cross-env BABEL_ENV=commonjs jest --coverage","watch":"yarn test -- --watch"},"jest":{"moduleDirectories":["node_modules","modules"]},"dependencies":{"hyphenate-style-name":"^1.0.3"},"devDependencies":{"@babel/cli":"^7.2.0","@babel/core":"^7.2.2","@babel/preset-env":"^7.2.0","babel-core":"7.0.0-bridge.0","babel-eslint":"^7.1.1","babel-jest":"^23.6.0","babel-plugin-transform-es2015-modules-commonjs":"^6.24.1","cross-env":"^5.2.0","eslint":"^3.14.1","eslint-config-airbnb":"^14.0.0","eslint-plugin-flowtype":"^2.30.0","eslint-plugin-import":"^2.2.0","eslint-plugin-jsx-a11y":"^3.0.2","eslint-plugin-react":"^6.9.0","jest":"^23.6.0","prettier":"^1.7.4","rimraf":"^2.6.1"},"gitHead":"c00c759404a999243381c7c7d2b7b78c27feea51","bugs":{"url":"https://github.com/robinweser/css-in-js-utils/issues"},"homepage":"https://github.com/robinweser/css-in-js-utils#readme","_id":"css-in-js-utils@3.0.3","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-sV8MnWstlJVRwIPvwgtYnaUy+vBFQKj9ptpcs8yaG5onG+Mh6klxasFRYQmqfc0kHSaE/QE56eWX95LxJwhEUg==","shasum":"947c955a37b94085348738f435b849d16419b5c8","tarball":"http://registry-npm.ywwl.com/css-in-js-utils/download/css-in-js-utils-3.0.3.tgz","fileCount":56,"unpackedSize":111696,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0/FxCRA9TVsSAnZWagAARZwP/3ilNVrR0/MjfTeUNC/Y\n5STkWYAB3uAGFvQS20XVLJhaGI+VLcpoPAcXIb+5e6gwMFwActOTxaVcDqgx\nZAdrhz3w76i9CbxVPXtJBPurfCa0hpiAXTSgtLJHvG3BAzHsYd72ywMwP//0\nD/PPcpCovNqmKxQXCsV5nFyNBkyQsDCf3SMZKTtL2fUB9b2sHZ2HMk4ZR/KZ\n/TlBM/XZBFvHCSCnJZh/RGM3C5wBosBN4bfeRApqYzIvqyRy+BBd5OyviidI\nfTKSYjcmrjOGOhVJztGPeuPm2c/pwxkAvcH1zmL3rBR8qzDLTuZom/5EFviv\nkBmSIPFbr7lA02fl/6zX6QoAAxWFl4s+ZyIbOa6X7IhBjKpZxAT1taECY5qY\nuhVJRcTBs6ovmILfnlC0Mw9eB60vTU0+cElHi2wc6Vs59yyOd20nP0C9qxUi\nT153Gwx3RK1Sco1z4cspPaS86Qo50a2380HF0/kcj5CPwQIFc8UConbkcUpK\ny0aw7X+kQb8QU97mweAYFej+joiSEcNMs38ZejzsYIJY8kIF//66Ip2p4J7N\nTjGfJ12/wY/pUnHQiQHbn5HBPHMs1NbL8qMVjnbV0wcSjYnTWTBxNG1tUY+u\nWxUjKcGU8XouYqAFziH2oHD/OSM+xXnWfJskdgrWoRSMoORA2hA7wvzvVY+f\n+1KU\r\n=/4Tl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAviuDH4ucw/okhtFZ4k+Y+S2U3eqSDqdZpjHlQcDA0XAiEA2zsxiqOlIHUaIPq48+jMA+DGGmt2QLHwBYMZBw4RqsU="}],"size":30616,"noattachment":false,"key":"/css-in-js-utils/-/css-in-js-utils-3.0.3.tgz"},"maintainers":[{"name":"rofrischmann","email":"robin@rofrischmann.de"}],"_npmUser":{"name":"rofrischmann","email":"robin@weser.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/css-in-js-utils_3.0.3_1574170993173_0.5164638465806701"},"_hasShrinkwrap":false,"readme":"# CSS-in-JS Utilities\nA library that provides useful utilities functions for CSS-in-JS solutions.<br>\nThey are intended to be used by CSS-in-JS library authors rather used directly.\n<br>\n\n<img alt=\"TravisCI\" src=\"https://travis-ci.org/rofrischmann/css-in-js-utils.svg?branch=master\"> <img alt=\"Test Coverage\"  src=\"https://api.codeclimate.com/v1/badges/2964ee833f8d2104cac6/test_coverage\" /> <img alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/css-in-js-utils.svg\"> <img alt=\"npm version\" src=\"https://badge.fury.io/js/css-in-js-utils.svg\"> <img alt=\"gzipped size\" src=\"https://img.shields.io/bundlephobia/minzip/css-in-js-utils.svg?colorB=4c1&label=gzipped%20size\">\n\n## Installation\n```sh\nyarn add css-in-js-utils\n```\n\n## Why?\nBy now I have authored and collaborated on many different libraries and found I would rewrite the very same utility functions every time. That's why this repository is hosting small utilities especially built for CSS-in-JS solutions and tools. Even if there are tons of different libraries already, they all basically use the same mechanisms and utilities.\n\n## Utilities\n* [`assignStyle(base, ...extend)`](#assignstylebase-extend)\n* [`camelCaseProperty(property)`](#camelcasepropertyproperty)\n* [`cssifyDeclaration(property, value)`](#cssifydeclarationproperty-value)\n* [`cssifyObject(object)`](#cssifyobjectobject)\n* [`hyphenateProperty(property)`](#hyphenatepropertyproperty)\n* [`isPrefixedProperty(property)`](#isprefixedpropertyproperty)\n* [`isPrefixedValue(value)`](#isprefixedvaluevalue)\n* [`isUnitlessProperty(property)`](#isunitlesspropertyproperty)\n* [`normalizeProperty(property)`](#normalizepropertyproperty)\n* [`resolveArrayValue(property, value)`](#resolvearrayvalueproperty-value)\n* [`unprefixProperty(property)`](#unprefixpropertyproperty)\n* [`unprefixValue(value)`](#unprefixvaluevalue)\n\n------\n\n### `assignStyle(base, ...extend)`\nMerges deep style objects similar to `Object.assign`.<br>\nIt also merges array values into a single array whithout creating duplicates. The last occurence of every item wins.\n\n```javascript\nimport { assignStyle } from 'css-in-js-utils'\n\nassignStyle(\n  { color: 'red', backgroundColor: 'black' },\n  { color: 'blue' }\n)\n// => { color: 'blue', backgroundColor: 'black' }\n\nassignStyle(\n  {\n    color: 'red',\n    ':hover': {\n      backgroundColor: 'black'\n    }\n  },\n  { \n    ':hover': {\n      backgroundColor: 'blue'\n    }\n  }\n)\n// => { color: 'red', ':hover': { backgroundColor: 'blue' }}\n```\n\n------\n\n### `camelCaseProperty(property)`\nConverts the `property` to camelCase.\n\n```javascript\nimport { camelCaseProperty } from 'css-in-js-utils'\n\ncamelCaseProperty('padding-top')\n// => 'paddingTop'\n\ncamelCaseProperty('-webkit-transition')\n// => 'WebkitTransition'\n```\n\n------\n\n### `cssifyDeclaration(property, value)`\nGenerates a CSS declaration (`property`:`value`) string.\n\n```javascript\nimport { cssifyDeclaration } from 'css-in-js-utils'\n\ncssifyDeclaration('paddingTop', '400px')\n// => 'padding-top:400px'\n\ncssifyDeclaration('WebkitFlex', 3)\n// => '-webkit-flex:3'\n```\n\n------\n\n### `cssifyObject(object)`\nGenerates a CSS string using all key-property pairs in `object`.\nIt automatically removes declarations with value types other than `number` and `string`.\n\n```javascript\nimport { cssifyObject } from 'css-in-js-utils'\n\ncssifyObject({\n  paddingTop: '400px',\n  paddingBottom: undefined,\n  WebkitFlex: 3,\n  _anyKey: [1, 2, 4]\n})\n// => 'padding-top:400px;-webkit-flex:3'\n```\n\n------\n\n### `hyphenateProperty(property)`\nConverts the `property` to hyphen-case.\n> Directly mirrors [hyphenate-style-name](https://github.com/rexxars/hyphenate-style-name).\n\n```javascript\nimport { hyphenateProperty } from 'css-in-js-utils'\n\nhyphenateProperty('paddingTop')\n// => 'padding-top'\n\nhyphenateProperty('WebkitTransition')\n// => '-webkit-transition'\n```\n\n------\n\n### `isPrefixedProperty(property)`\nChecks if a `property` includes a vendor prefix.\n\n```javascript\nimport { isPrefixedProperty } from 'css-in-js-utils'\n\nisPrefixedProperty('paddingTop')\n// => false\n\nisPrefixedProperty('WebkitTransition')\n// => true\n```\n\n------\n### `isPrefixedValue(value)`\nChecks if a `value` includes vendor prefixes.\n\n```javascript\nimport { isPrefixedValue } from 'css-in-js-utils'\n\nisPrefixedValue('200px')\nisPrefixedValue(200)\n// => false\n\nisPrefixedValue('-webkit-calc(100% - 50px)')\n// => true\n```\n\n------\n\n### `isUnitlessProperty(property)`\nChecks if a `property` accepts unitless values.\n\n```javascript\nimport { isUnitlessProperty } from 'css-in-js-utils'\n\nisUnitlessProperty('width')\n// => false\n\nisUnitlessProperty('flexGrow')\nisUnitlessProperty('lineHeight')\nisUnitlessProperty('line-height')\n// => true\n```\n\n------\n\n### `normalizeProperty(property)`\nNormalizes the `property` by unprefixing **and** camelCasing it.\n> Uses the [`camelCaseProperty`](#camelcasepropertyproperty) and [`unprefixProperty`](#unprefixpropertyproperty)-methods.\n\n```javascript\nimport { normalizeProperty } from 'css-in-js-utils'\n\nnormalizeProperty('-webkit-transition-delay')\n// => 'transitionDelay'\n```\n\n------\n\n### `resolveArrayValue(property, value)`\nConcatenates array values to single CSS value.\n> Uses the [`hyphenateProperty`](#hyphenatepropertyproperty)-method.\n\n\n```javascript\nimport { resolveArrayValue } from 'css-in-js-utils'\n\nresolveArrayValue('display', [ '-webkit-flex', 'flex' ])\n// => '-webkit-flex;display:flex'\n\nresolveArrayValue('paddingTop', [ 'calc(100% - 50px)', '100px' ])\n// => 'calc(100% - 50px);padding-top:100px'\n```\n\n------\n\n### `unprefixProperty(property)`\nRemoves the vendor prefix (if set) from the `property`.\n\n```javascript\nimport { unprefixProperty } from 'css-in-js-utils'\n\nunprefixProperty('WebkitTransition')\n// => 'transition'\n\nunprefixProperty('transitionDelay')\n// => 'transitionDelay'\n```\n\n------\n\n### `unprefixValue(value)`\nRemoves all vendor prefixes (if any) from the `value`.\n\n```javascript\nimport { unprefixValue } from 'css-in-js-utils'\n\nunprefixValue('-webkit-calc(-moz-calc(100% - 50px)/2)')\n// => 'calc(calc(100% - 50px)/2)'\n\nunprefixValue('100px')\n// => '100px'\n```\n\n## Direct Import\nEvery utility function may be imported directly to save bundle size.\n\n```javascript\nimport camelCaseProperty from 'css-in-js-utils/lib/camelCaseProperty'\n```\n\n## License\ncss-in-js-utils is licensed under the [MIT License](http://opensource.org/licenses/MIT).<br>\nDocumentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).<br>\nCreated with ♥ by [@rofrischmann](http://rofrischmann.de).\n","publish_time":1574170993276,"_cnpm_publish_time":1574170993276,"dist-tags":{"latest":"3.1.0"}}