{"name":"css-in-js-utils","version":"3.0.4","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":"bc362ca2c34d081bf907c2557b299b37300ff965","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.4","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-4RKm4RXq+TnX3rVRl85cabEc+VtR0yuU8zT9QpZqa9lLlJzw7Ma6Yyg2N9Gm6l9W+TP0IsWF0wvh3Is4Oifr7g==","shasum":"9173c31b1fcb31401f0baf84fb3b680971b49eab","tarball":"http://registry-npm.ywwl.com/css-in-js-utils/download/css-in-js-utils-3.0.4.tgz","fileCount":56,"unpackedSize":111842,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0/IECRA9TVsSAnZWagAA4xEP/2NDb0Uf2rDuaBXkBp88\nMyyJd9R2vGgI4P5ID7QXCFx0ePSlvC2F3bD6sn19Zrp7stJN1GZLAQPl9PFE\nBjaRk00ceYOBv/d1QUn6rSo1+2gL/UHAkc1/oICk4hv0RB5VxH/EdL3p7Pyh\n0fEby1OQwReEv4XiZznXC64/uvBmqkXe9PzI0VMJZ+4Kc3AFEogrEYDiePwU\n2bM9QDJut8gUBdaKjsP5Efnt+6a1DqdXo6ipm6KxeorTOqLFtA/5vI5NTu9Z\nXgLOLdRrHli2gXbYCmV8NCl3Ux20hiIjp7bYq+N6ECg+zjL93UnU5AivEVOU\nPBg/cslV3ynayrgHdrv12Ek/k40R1aA/qihUHCAvRJKbspgm/kijQvZziMAj\nNoMw/FU0UT1Nq7KyprYyLe651R3KilfpgjyvxdcqynSec615lUIifeLYu1iv\n734wrOVG35Ky3PrjzuxQsvW5v2BdWQ/2sJUIKAkKNtW8KOam6m/D+5gxVde7\nTyXCZCNsuixHe5eg7flZqF+TdXFh26PMJC6jAkgPcOMjEvc0JO2PyWdcq2D4\nbMndGLo4cF96vZN4wLRZzAMWTOcTlBk+L7VzCFw++6QCnJVhCeuOc2lf1sZI\n0pC5U5k8YTVWaGVpKL1jaHf/19ebPSIwF6vtpTcXuqUgS86ck5CevoGWT6W4\nuJud\r\n=czG6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEcWx9nEI02pZC6hE43Um9nWO2MyqBlEt30R5ZmjvZAgAiEAtnEp71uMPuSiccCEUrRd3QEBzSVSgoUD314azJES1KQ="}],"size":30613,"noattachment":false,"key":"/css-in-js-utils/-/css-in-js-utils-3.0.4.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.4_1574171139744_0.35244974799472906"},"_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":1574171139888,"_cnpm_publish_time":1574171139888,"dist-tags":{"latest":"3.1.0"}}